import{parse as e,format as t}from"@citation-js/name";import{parse as r,format as i}from"@citation-js/date";import o from"citeproc";import a from"js-yaml";var n={__proto__:null,currentVersion:function(){return this.log.length},retrieveVersion:function(e=1){if(e<=0||e>this.currentVersion())return null;{const[t,r]=this.log[e-1],i=new this.constructor(JSON.parse(t),JSON.parse(r));return i.log=this.log.slice(0,e),i}},retrieveLastVersion:function(){return this.retrieveVersion(this.currentVersion())},undo:function(e=1){return this.retrieveVersion(this.currentVersion()-e)},save:function(){return this.log.push([JSON.stringify(this.data),JSON.stringify(this._options)]),this}};const s=["real","string"],l=["json","html","string","rtf"],c=["csl","bibtex","bibtxt","citation-*","ris","ndjson"],m=["string","function"];function u(e){if("object"!=typeof e)throw new TypeError("Options not an object!");const{format:t,type:r,style:i,lang:o,append:a,prepend:n}=e;if(t&&!s.includes(t))throw new TypeError(`Option format ("${t}") should be one of: ${s}`);if(r&&!l.includes(r))throw new TypeError(`Option type ("${r}") should be one of: ${l}`);if(i&&!c.includes(i)&&!/^citation/.test(i))throw new TypeError(`Option style ("${i}") should be one of: ${c}`);if(o&&"string"!=typeof o)throw new TypeError("Option lang should be a string, but is a "+typeof o);if(n&&!m.includes(typeof n))throw new TypeError("Option prepend should be a string or a function, but is a "+typeof n);if(a&&!m.includes(typeof a))throw new TypeError("Option append should be a string or a function, but is a "+typeof a);if(/^citation/.test(i)&&"json"===r)throw new Error(`Combination type/style of json/citation-* is not valid: ${r}/${i}`);return!0}var p={__proto__:null,options:function(e,t){return u(e),t&&this.save(),Object.assign(this._options,e),this},defaultOptions:{format:"real",type:"json",style:"csl",lang:"en-US"}};function h(e){switch(e){case void 0:return"Undefined";case null:return"Null";default:return e.constructor.name}}function f(e){switch(typeof e){case"string":return"String";case"object":if(Array.isArray(e))return"Array";if("Object"===h(e))return"SimpleObject";if("Null"!==h(e))return"ComplexObject";default:return"Primitive"}}var d={__proto__:null,typeOf:h,dataTypeOf:f};function g(e,t){if(e._graph){const r=t.findIndex(({type:e})=>"@else/list+object"===e);-1!==r&&t.splice(r+1,0,...e._graph.slice(0,-1))}return e._graph=t,e}function b(e){return delete e._graph,e}var y={__proto__:null,applyGraph:g,removeGraph:b};const v={_output(e,t,r){this._log.push(t,r),this._levels.indexOf(e)v._output(e,t,r);v._console="function"==typeof console.Console?new console.Console(process.stderr):console;const x={},w={},k={};function T(e,t){switch(t){case"Array":return 0===e.length||e.every(e=>"@csl/object"===j(e))?"@csl/list+object":"@else/list+object";case"SimpleObject":case"ComplexObject":return"@csl/object";default:return"@invalid"}}function E(e=[],t){for(const r of e)if(x[r].predicate(t))return E(x[r].extensions,t)||r}function j(e){const t=f(e);return"Array"===t&&0===e.length?T(e,t):E(w[t],e)||T(e,t)}function S(e,{dataType:t,predicate:r,extends:i}){let o=[];if(e in k&&(o=k[e],delete k[e],v.debug("[core]",`Subclasses "${o}" finally registered to parent type "${e}"`)),x[e]={predicate:r,extensions:o},i){const t=x[i];t?t.extensions.push(e):(k[i]||(k[i]=[]),k[i].push(e),v.debug("[core]",`Subclass "${e}" is waiting on parent type "${i}"`))}else(w[t]||(w[t]=[])).push(e)}function O(e){delete x[e];const t=[...Object.keys(w).map(e=>w[e]),...Object.keys(x).map(e=>x[e].extensions).filter(e=>e.length>0)];t.forEach(t=>{const r=t.indexOf(e);r>-1&&t.splice(r,1)})}const _=/^(?:@(.+?))(?:\/(?:(.+?)\+)?(?:(.+)))?$/;class A{constructor(e){this.validDataTypes=["String","Array","SimpleObject","ComplexObject","Primitive"],this.data=e}validateDataType(){const e=this.data.dataType;if(e&&!this.validDataTypes.includes(e))throw new RangeError(`dataType was ${e}; expected one of ${this.validDataTypes}`)}validateParseType(){const e=this.data.predicate;if(e&&!(e instanceof RegExp||"function"==typeof e))throw new TypeError(`predicate was ${typeof e}; expected RegExp or function`)}validateTokenList(){const e=this.data.tokenList;if(e&&"object"!=typeof e)throw new TypeError(`tokenList was ${typeof e}; expected object or RegExp`)}validatePropertyConstraint(){const e=this.data.propertyConstraint;if(e&&"object"!=typeof e)throw new TypeError(`propertyConstraint was ${typeof e}; expected array or object`)}validateElementConstraint(){const e=this.data.elementConstraint;if(e&&"string"!=typeof e)throw new TypeError(`elementConstraint was ${typeof e}; expected string`)}validateExtends(){const e=this.data.extends;if(e&&"string"!=typeof e)throw new TypeError(`extends was ${typeof e}; expected string`)}validate(){if(null===this.data||"object"!=typeof this.data)throw new TypeError(`typeParser was ${typeof this.data}; expected object`);this.validateDataType(),this.validateParseType(),this.validateTokenList(),this.validatePropertyConstraint(),this.validateElementConstraint(),this.validateExtends()}parseTokenList(){let e=this.data.tokenList;if(!e)return[];e instanceof RegExp&&(e={token:e});const{token:t,split:r=/\s+/,trim:i=!0,every:o=!0}=e,a=o?"every":"some";return[e=>(e=>i?e.trim():e)(e).split(r)[a](e=>t.test(e))]}parsePropertyConstraint(){return[].concat(this.data.propertyConstraint||[]).map(({props:e,match:t,value:r})=>{switch(e=[].concat(e),t){case"any":case"some":return t=>e.some(e=>e in t&&(!r||r(t[e])));case"none":return t=>!e.some(e=>e in t&&(!r||r(t[e])));default:return t=>e.every(e=>e in t&&(!r||r(t[e])))}})}parseElementConstraint(){const e=this.data.elementConstraint;return e?[t=>t.every(t=>j(t)===e)]:[]}parsePredicate(){return this.data.predicate instanceof RegExp?[this.data.predicate.test.bind(this.data.predicate)]:this.data.predicate?[this.data.predicate]:[]}getCombinedPredicate(){const e=[...this.parsePredicate(),...this.parseTokenList(),...this.parsePropertyConstraint(),...this.parseElementConstraint()];return 0===e.length?()=>!0:1===e.length?e[0]:t=>e.every(e=>e(t))}getDataType(){return this.data.dataType?this.data.dataType:this.data.predicate instanceof RegExp||this.data.tokenList?"String":this.data.elementConstraint?"Array":"Primitive"}get dataType(){return this.getDataType()}get predicate(){return this.getCombinedPredicate()}get extends(){return this.data.extends}}class C{constructor(e,{async:t}={}){this.parser=e,this.async=t}validate(){const e=this.parser;if("function"!=typeof e)throw new TypeError(`parser was ${typeof e}; expected function`)}}class R{constructor(e,t={}){this.format=e,t.parseType&&(this.typeParser=new A(t.parseType)),t.parse&&(this.dataParser=new C(t.parse,{async:!1})),t.parseAsync&&(this.asyncDataParser=new C(t.parseAsync,{async:!0}))}validateFormat(){const e=this.format;if(!_.test(e))throw new TypeError(`format name was "${e}"; didn't match expected pattern`)}validate(){this.validateFormat(),this.typeParser&&this.typeParser.validate(),this.dataParser&&this.dataParser.validate(),this.asyncDataParser&&this.asyncDataParser.validate()}}var I={__proto__:null,TypeParser:A,DataParser:C,FormatParser:R};function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t"number"==typeof e)?e:!t||e.some(e=>isNaN(parseInt(e)))?void 0:e.map(e=>parseInt(e))}function q(e,t,r){const i=[].concat($[e]);switch($[e]){case P:return N(t,r);case L:return function(e,t){if(e instanceof Array){const r=e.map(e=>N(e,t)).filter(Boolean);return r.length?r:void 0}}(t,r);case z:return function(e,t){const r="date-parts";if("object"==typeof e&&null!==e){if(e[r]instanceof Array&&e[r].every(e=>e instanceof Array)){const i=e[r].map(e=>M(e,t)).filter(Boolean);return i.length?B({},e,{"date-parts":i}):void 0}if(e instanceof Array&&e.every(e=>e[r]instanceof Array)){const i=e.map(e=>M(e[r],t)).filter(Boolean);return i.length?{"date-parts":i}:void 0}if(e[r]instanceof Array){const i=M(e[r],t);return i&&{"date-parts":[i]}}return"literal"in e||"raw"in e?e:void 0}}(t,r);case U:return function(e,t){return e=q("language",e,t),!0===D[e]?e:t&&e in D?D[e]:void 0}(t,r)}if(r){if("string"==typeof t&&i.includes("number")&&!i.includes("string")&&!isNaN(+t))return parseFloat(t);if("number"==typeof t&&i.includes("string")&&!i.includes("number"))return t.toString();if(Array.isArray(t)&&t.length)return q(e,t[0],r)}if(i.includes(typeof t))return t}function F(e,t=!0){return e.map(function(e){const r={};for(const i in e){const o=q(i,e[i],t);void 0!==o&&(r[i]=o)}return r})}var H={__proto__:null,clean:F};function G(e){return Array.isArray(e)?e.map(G):("event"in(e=B({},e))&&(e["event-title"]=e.event,delete e.event),"book"===e.type&&"version"in e&&(e.type="software"),e)}function J(e){return Array.isArray(e)?e.map(J):("event-title"in(e=B({},e))&&(e.event=e["event-title"],delete e["event-title"]),"software"===e.type&&(e.type="book"),e)}function V(e,t=new Set){if("object"!=typeof e||null===e||e.constructor!==Object&&e.constructor!==Array)return e;if(t.has(e))throw new TypeError("Recursively copying circular structure");let r;if(t.add(e),e.constructor===Array)r=e.map(e=>V(e,t));else{const i={};for(const r in e)i[r]=V(e[r],t);r=i}return t.delete(e),r}var K="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function W(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function X(e){var t={exports:{}};return e(t,t.exports),t.exports}for(var Y=[],Z=[],Q="undefined"!=typeof Uint8Array?Uint8Array:Array,ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",te=0;te<64;++te)Y[te]=ee[te],Z[ee.charCodeAt(te)]=te;function re(e,t,r){for(var i,o=[],a=t;a>18&63]+Y[i>>12&63]+Y[i>>6&63]+Y[63&i]);return o.join("")}Z["-".charCodeAt(0)]=62,Z["_".charCodeAt(0)]=63;var ie=function(e,t,r,i,o){var a,n,s=8*o-i-1,l=(1<>1,m=-7,u=r?o-1:0,p=r?-1:1,h=e[t+u];for(u+=p,a=h&(1<<-m)-1,h>>=-m,m+=s;m>0;a=256*a+e[t+u],u+=p,m-=8);for(n=a&(1<<-m)-1,a>>=-m,m+=i;m>0;n=256*n+e[t+u],u+=p,m-=8);if(0===a)a=1-c;else{if(a===l)return n?NaN:Infinity*(h?-1:1);n+=Math.pow(2,i),a-=c}return(h?-1:1)*n*Math.pow(2,a-i)},oe=function(e,t,r,i,o,a){var n,s,l,c=8*a-o-1,m=(1<>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:a-1,f=i?1:-1,d=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||Infinity===t?(s=isNaN(t)?1:0,n=m):(n=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-n))<1&&(n--,l*=2),(t+=n+u>=1?p/l:p*Math.pow(2,1-u))*l>=2&&(n++,l/=2),n+u>=m?(s=0,n=m):n+u>=1?(s=(t*l-1)*Math.pow(2,o),n+=u):(s=t*Math.pow(2,u-1)*Math.pow(2,o),n=0));o>=8;e[r+h]=255&s,h+=f,s/=256,o-=8);for(n=n<0;e[r+h]=255&n,h+=f,n/=256,c-=8);e[r+h-f]|=128*d},ae=X(function(e,t){var r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=a,t.SlowBuffer=function(e){return+e!=e&&(e=0),a.alloc(+e)},t.INSPECT_MAX_BYTES=50;var i=2147483647;function o(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return n(e,t,r)}function n(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|p(e,t),i=o(r),n=i.write(e,t);return n!==r&&(i=i.slice(0,n)),i}(e,t);if(ArrayBuffer.isView(e))return function(e){if(D(e,Uint8Array)){var t=new Uint8Array(e);return m(t.buffer,t.byteOffset,t.byteLength)}return c(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(D(e,ArrayBuffer)||e&&D(e.buffer,ArrayBuffer))return m(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(D(e,SharedArrayBuffer)||e&&D(e.buffer,SharedArrayBuffer)))return m(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return a.from(i,t,r);var n=function(e){if(a.isBuffer(e)){var t=0|u(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||$(e.length)?o(0):c(e):"Buffer"===e.type&&Array.isArray(e.data)?c(e.data):void 0}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function s(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return s(e),o(e<0?0:0|u(e))}function c(e){for(var t=e.length<0?0:0|u(e.length),r=o(t),i=0;i=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function p(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||D(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return L(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(e).length;default:if(o)return i?-1:L(e).length;t=(""+t).toLowerCase(),o=!0}}function h(e,t,r){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,r);case"utf8":case"utf-8":return T(this,t,r);case"ascii":return j(this,t,r);case"latin1":case"binary":return S(this,t,r);case"base64":return k(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function f(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function d(e,t,r,i,o){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),$(r=+r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=a.from(t,i)),a.isBuffer(t))return 0===t.length?-1:g(e,t,r,i,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,i,o);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,i,o){var a,n=1,s=e.length,l=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;n=2,s/=2,l/=2,r/=2}function c(e,t){return 1===n?e[t]:e.readUInt16BE(t*n)}if(o){var m=-1;for(a=r;as&&(r=s-l),a=r;a>=0;a--){for(var u=!0,p=0;po&&(i=o):i=o;var a=t.length;i>a/2&&(i=a/2);for(var n=0;n>8,o.push(r%256),o.push(i);return o}(t,e.length-r),e,r,i)}function k(e,t,r){return function(e){for(var t,r=e.length,i=r%3,o=[],a=16383,n=0,s=r-i;ns?s:n+a));return 1===i?o.push(Y[(t=e[r-1])>>2]+Y[t<<4&63]+"=="):2===i&&o.push(Y[(t=(e[r-2]<<8)+e[r-1])>>10]+Y[t>>4&63]+Y[t<<2&63]+"="),o.join("")}(0===t&&r===e.length?e:e.slice(t,r))}function T(e,t,r){r=Math.min(e.length,r);for(var i=[],o=t;o239?4:c>223?3:c>191?2:1;if(o+u<=r)switch(u){case 1:c<128&&(m=c);break;case 2:128==(192&(a=e[o+1]))&&(l=(31&c)<<6|63&a)>127&&(m=l);break;case 3:n=e[o+2],128==(192&(a=e[o+1]))&&128==(192&n)&&(l=(15&c)<<12|(63&a)<<6|63&n)>2047&&(l<55296||l>57343)&&(m=l);break;case 4:n=e[o+2],s=e[o+3],128==(192&(a=e[o+1]))&&128==(192&n)&&128==(192&s)&&(l=(15&c)<<18|(63&a)<<12|(63&n)<<6|63&s)>65535&&l<1114112&&(m=l)}null===m?(m=65533,u=1):m>65535&&(i.push((m-=65536)>>>10&1023|55296),m=56320|1023&m),i.push(m),o+=u}return function(e){var t=e.length;if(t<=E)return String.fromCharCode.apply(String,e);for(var r="",i=0;ii.length?a.from(n).copy(i,o):Uint8Array.prototype.set.call(i,n,o);else{if(!a.isBuffer(n))throw new TypeError('"list" argument must be an Array of Buffers');n.copy(i,o)}o+=n.length}return i},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(e,t,r,i,o){if(D(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),t<0||r>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&t>=r)return 0;if(i>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var n=(o>>>=0)-(i>>>=0),s=(r>>>=0)-(t>>>=0),l=Math.min(n,s),c=this.slice(i,o),m=e.slice(t,r),u=0;u>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return y(this,e,t,r);case"ascii":case"latin1":case"binary":return v(this,e,t,r);case"base64":return x(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var E=4096;function j(e,t,r){var i="";r=Math.min(e.length,r);for(var o=t;oi)&&(r=i);for(var o="",a=t;ar)throw new RangeError("Trying to access beyond buffer length")}function C(e,t,r,i,o,n){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function R(e,t,r,i,o,a){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(e,t,r,i,o){return t=+t,r>>>=0,o||R(e,0,r,4),oe(e,t,r,i,23,4),r+4}function B(e,t,r,i,o){return t=+t,r>>>=0,o||R(e,0,r,8),oe(e,t,r,i,52,8),r+8}a.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||A(e,t,this.length);for(var i=this[e],o=1,a=0;++a>>=0,t>>>=0,r||A(e,t,this.length);for(var i=this[e+--t],o=1;t>0&&(o*=256);)i+=this[e+--t]*o;return i},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var i=this[e],o=1,a=0;++a=(o*=128)&&(i-=Math.pow(2,8*t)),i},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var i=t,o=1,a=this[e+--i];i>0&&(o*=256);)a+=this[e+--i]*o;return a>=(o*=128)&&(a-=Math.pow(2,8*t)),a},a.prototype.readInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||A(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||A(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||A(e,4,this.length),ie(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||A(e,4,this.length),ie(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||A(e,8,this.length),ie(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||A(e,8,this.length),ie(this,e,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,r,i){e=+e,t>>>=0,r>>>=0,i||C(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,a=0;for(this[t]=255&e;++a>>=0,r>>>=0,i||C(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,a=1;for(this[t+o]=255&e;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t>>>=0,!i){var o=Math.pow(2,8*r-1);C(this,e,t,r,o-1,-o)}var a=0,n=1,s=0;for(this[t]=255&e;++a>0)-s&255;return t+r},a.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t>>>=0,!i){var o=Math.pow(2,8*r-1);C(this,e,t,r,o-1,-o)}var a=r-1,n=1,s=0;for(this[t+a]=255&e;--a>=0&&(n*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/n>>0)-s&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return I(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return I(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return B(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return B(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,i){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(n+1===i){(t-=3)>-1&&a.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&a.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function z(e){return function(e){var t,r,i=function(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}(e),o=i[0],a=i[1],n=new Q(function(e,t,r){return 3*(t+r)/4-r}(0,o,a)),s=0,l=a>0?o-4:o;for(r=0;r>16&255,n[s++]=t>>8&255,n[s++]=255&t;return 2===a&&(t=Z[e.charCodeAt(r)]<<2|Z[e.charCodeAt(r+1)]>>4,n[s++]=255&t),1===a&&(t=Z[e.charCodeAt(r)]<<10|Z[e.charCodeAt(r+1)]<<4|Z[e.charCodeAt(r+2)]>>2,n[s++]=t>>8&255,n[s++]=255&t),n}(function(e){if((e=(e=e.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function U(e,t,r,i){for(var o=0;o=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function D(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function $(e){return e!=e}var N=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var i=16*r,o=0;o<16;++o)t[i+o]=e[r]+e[o];return t}()});const{Buffer:ne}=ae;function se(...e){const t=new se.Request(...e),r=new XMLHttpRequest;r.withCredentials="include"===t.credentials,r.timeout=t[le].timeout,r.open(t.method,t.url,!1);let i=!1;try{r.responseType="arraybuffer"}catch(e){r.overrideMimeType("text/plain; charset=x-user-defined"),i=!0}for(const e of t.headers)r.setRequestHeader(...e);r.send(t.body||null);let o=r.getAllResponseHeaders();o=o&&o.split("\r\n").filter(Boolean).map(e=>e.split(": ",2));let a=r.response;if(i){const e=ne.alloc(a.length);for(let t=0;t=200&&e<300}get redirected(){return this[le].redirected}get status(){return this[le].status}get statusText(){return this[le].statusText}get url(){return this[le].url}clone(){return this.redirect(this[le].url,this[le].status)}redirect(e,t){fe(this);const r=new pe(this[le].body,{headers:this[le].headers,status:t||this[le].status,statusText:me[t]||this[le].statusText});return r[le].url=e||this[le].url,r[le].redirected=this[le].redirected,r}}class he{constructor(e){this[le]={body:ne.from(e),bodyUsed:!1}}get bodyUsed(){return this[le].bodyUsed}static mixin(e){for(const t of Object.getOwnPropertyNames(he.prototype)){if("constructor"===t)continue;const r=Object.getOwnPropertyDescriptor(he.prototype,t);Object.defineProperty(e,t,{...r,enumerable:!0})}}arrayBuffer(){const e=de(this);return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}blob(){const e=this.headers&&this.headers.get("content-type");return new Blob([de(this)],e&&{type:e})}text(){return de(this).toString()}json(){try{return JSON.parse(de(this).toString())}catch(e){throw new TypeError(`invalid json response body at ${this.url} reason: ${e.message}`,"invalid-json")}}buffer(){return de(this).clone()}}function fe(e){if(e.bodyUsed)throw new TypeError(`body used already for: ${e.url}`)}function de(e){return fe(e),e[le].bodyUsed=!0,e[le].body||ne.alloc(0)}he.mixin(ue.prototype),he.mixin(pe.prototype);class ge{constructor(e){if(e instanceof se.Headers)this[le]={...e[le]};else if(this[le]={},Array.isArray(e))for(const[t,r]of e)this.append(t,r);else if("object"==typeof e)for(const t in e)this.set(t,e[t])}append(e,t){e=e.toLowerCase(),this[le][e]||(this[le][e]=[]),this[le][e].push(t)}delete(e){delete this[le][e.toLowerCase()]}set(e,t){this[le][e.toLowerCase()]=[t]}entries(){const e=[];for(const t in this[le])for(const r of this[le][t])e.push([t,r]);return e}get(e){return(e=e.toLowerCase())in this[le]?this[le][e].join(", "):null}keys(){return Object.keys(this[le])}has(e){return e.toLowerCase()in this[le]}values(){const e=[];for(const t in this[le])for(const r of this[le][t])e.push(r);return e}*[Symbol.iterator](){for(const e in this[le])for(const t of this[le][e])yield[e,t]}}se.Headers=ge,se.Request=ue,se.Response=pe;var be=X(function(e,t){!function(r){e.exports=function(e){var i=e&&e.Promise||r.Promise,o=e&&e.XMLHttpRequest||r.XMLHttpRequest;return function(){var e=Object.create(r,{fetch:{value:void 0,writable:!0}});return function(t){var r=void 0!==e&&e||"undefined"!=typeof self&&self||void 0!==r&&r,a="URLSearchParams"in r,n="Symbol"in r&&"iterator"in Symbol,s="FileReader"in r&&"Blob"in r&&function(){try{return new Blob,!0}catch(e){return!1}}(),l="FormData"in r,c="ArrayBuffer"in r;if(c)var m=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&m.indexOf(Object.prototype.toString.call(e))>-1};function p(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function h(e){return"string"!=typeof e&&(e=String(e)),e}function f(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function g(e){if(e.bodyUsed)return i.reject(new TypeError("Already read"));e.bodyUsed=!0}function b(e){return new i(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function y(e){var t=new FileReader,r=b(t);return t.readAsArrayBuffer(e),r}function v(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function x(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:s&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:l&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:a&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():c&&s&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=v(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=v(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s&&(this.blob=function(){var e=g(this);if(e)return e;if(this._bodyBlob)return i.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return i.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return i.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?g(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?i.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):i.resolve(this._bodyArrayBuffer)):this.blob().then(y)}),this.text=function(){var e,t,r,o=g(this);if(o)return o;if(this._bodyBlob)return e=this._bodyBlob,r=b(t=new FileReader),t.readAsText(e),r;if(this._bodyArrayBuffer)return i.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),i=0;i-1?i:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(o),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var a=/([?&])_=[^&]*/;a.test(this.url)?this.url=this.url.replace(a,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function T(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(o))}}),t}function E(e,t){if(!(this instanceof E))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"",this.headers=new d(t.headers),this.url=t.url||"",this._initBody(e)}k.prototype.clone=function(){return new k(this,{body:this._bodyInit})},x.call(k.prototype),x.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},E.error=function(){var e=new E(null,{status:0,statusText:""});return e.type="error",e};var j=[301,302,303,307,308];E.redirect=function(e,t){if(-1===j.indexOf(t))throw new RangeError("Invalid status code");return new E(null,{status:t,headers:{location:e}})},t.DOMException=r.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function S(e,a){return new i(function(i,n){var l=new k(e,a);if(l.signal&&l.signal.aborted)return n(new t.DOMException("Aborted","AbortError"));var m=new o;function u(){m.abort()}m.onload=function(){var e,t,r={status:m.status,statusText:m.statusText,headers:(e=m.getAllResponseHeaders()||"",t=new d,e.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e}).forEach(function(e){var r=e.split(":"),i=r.shift().trim();if(i){var o=r.join(":").trim();t.append(i,o)}}),t)};r.url="responseURL"in m?m.responseURL:r.headers.get("X-Request-URL");var o="response"in m?m.response:m.responseText;setTimeout(function(){i(new E(o,r))},0)},m.onerror=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},m.ontimeout=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},m.onabort=function(){setTimeout(function(){n(new t.DOMException("Aborted","AbortError"))},0)},m.open(l.method,function(e){try{return""===e&&r.location.href?r.location.href:e}catch(t){return e}}(l.url),!0),"include"===l.credentials?m.withCredentials=!0:"omit"===l.credentials&&(m.withCredentials=!1),"responseType"in m&&(s?m.responseType="blob":c&&l.headers.get("Content-Type")&&-1!==l.headers.get("Content-Type").indexOf("application/octet-stream")&&(m.responseType="arraybuffer")),!a||"object"!=typeof a.headers||a.headers instanceof d?l.headers.forEach(function(e,t){m.setRequestHeader(t,e)}):Object.getOwnPropertyNames(a.headers).forEach(function(e){m.setRequestHeader(e,h(a.headers[e]))}),l.signal&&(l.signal.addEventListener("abort",u),m.onreadystatechange=function(){4===m.readyState&&l.signal.removeEventListener("abort",u)}),m.send(void 0===l._bodyInit?null:l._bodyInit)})}S.polyfill=!0,r.fetch||(r.fetch=S,r.Headers=d,r.Request=k,r.Response=E),t.Headers=d,t.Request=k,t.Response=E,t.fetch=S,Object.defineProperty(t,"__esModule",{value:!0})}(t),{fetch:e.fetch,Headers:e.Headers,Request:e.Request,Response:e.Response,DOMException:e.DOMException}}()}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:K)});function ye(e,t){let r;for(;void 0===r||e.includes(r);)r=`${t}${Math.random().toString().slice(2)}`;return r}/*@__PURE__*/W(be)();class ve{constructor(e={}){this.data=e}set(e,t){return this.data[e]=t,this}add(...e){return this.set(...e)}delete(e){return delete this.data[e],this}remove(...e){return this.delete(...e)}get(e){return this.data[e]}has(e){return Object.prototype.hasOwnProperty.call(this.data,e)}list(){return Object.keys(this.data)}}class xe{constructor(e,t){this.rules=e,this.defaultState=t,this.mainRule=Object.keys(e)[0],this.log=[]}parse(e,t){return this.lexer=e,this.token=this.lexer.next(),this.state=V(this.defaultState),this.log=[],this.consumeRule(t||this.mainRule)}matchEndOfFile(){return!this.token}matchToken(e){return this.token&&e===this.token.type}consumeToken(e,t){const r=this.token;if(!e||r&&r.type===e)return this.token=this.lexer.next(),r;if(!t){const t=new SyntaxError(this.lexer.formatError(r,`expected "${e}", got ${r?`"${r.type}"`:"EOF"}`));throw t.message+=` (${this.log.join("->")})`,t}}consumeRule(e){this.log.push(e);const t=this.rules[e].call(this);return this.log.pop(),t}}function we(e,t){return t=t===ke.CONVERT_TO_SOURCE,e=e.map(e=>function(e,t){let r,i,o,a;if("string"==typeof e)r=i=e;else{if(!e)return null;r=t?e.target:e.source,i=t?e.source:e.target,e.convert&&(o=t?e.convert.toSource:e.convert.toTarget),e.when&&(a=t?e.when.target:e.when.source,null!=a&&(a=function(e){return function(t){return"boolean"==typeof e?e:Object.keys(e).every(r=>{const i=e[r];return!0===i?r in t:!1===i?!(r in t):"function"==typeof i?i(t[r]):Array.isArray(i)?i.includes(t[r]):t[r]===i})}}(a)))}return r=[].concat(r).filter(Boolean),i=[].concat(i).filter(Boolean),{inputProp:r,outputProp:i,convert:o,condition:a}}(e,t)).filter(Boolean),function(t){const r={};for(const{inputProp:i,outputProp:o,convert:a,condition:n}of e){if(0===o.length)continue;if(n&&!n(t))continue;if(0!==i.length&&i.every(e=>!(e in t)))continue;let e=i.map(e=>t[e]);if(a)try{const r=a.apply(t,e);e=1===o.length?[r]:r}catch(e){throw new Error(`Failed to convert ${i} to ${o}`,{cause:e})}o.forEach((t,i)=>{const o=e[i];void 0!==o&&(r[t]=o)})}return r}}class ke{constructor(e){this.convertToSource=we(e,ke.CONVERT_TO_SOURCE),this.convertToTarget=we(e,ke.CONVERT_TO_TARGET)}}ke.CONVERT_TO_SOURCE=Symbol("convert to source"),ke.CONVERT_TO_TARGET=Symbol("convert to target");class Te{constructor(e,t={}){this.options=Object.assign({generateGraph:!0,forceType:j(e),maxChainLength:10,strict:!0,target:"@csl/list+object"},t),this.type=this.options.forceType,this.data="object"==typeof e?V(e):e,this.graph=[{type:this.type,data:e}],this.iteration=0}iterate(){if(0!==this.iteration){const e=ze(this.type);this.type=e&&e.outputs?e.outputs:j(this.data),this.graph.push({type:this.type})}return!this.error&&this.type!==this.options.target&&(this.iteration>=this.options.maxChainLength?(this.error=new RangeError(`Max. number of parsing iterations reached (${function(e){return e.reduce((e,t)=>{const r=e[e.length-1];return r&&r.type===t.type?r.count=r.count+1||2:e.push(t),e},[]).map(e=>(e.count>1?e.count+"x ":"")+e.type).join(" -> ")}(this.graph)})`),!1):(this.iteration++,!0))}end(){if(this.error){if(v.error("[core]",this.error.message),!1!==this.options.strict)throw this.error;return[]}return"@csl/list+object"===this.options.target?G(this.data).map(this.options.generateGraph?e=>g(e,this.graph):b):this.data}}const Ee=(...e)=>{const t=new Te(...e);for(;t.iterate();)try{t.data=Ce(t.data,t.type)}catch(e){t.error=e}return t.end()},je=async(...e)=>{const t=new Te(...e);for(;t.iterate();)t.data=await Re(t.data,t.type).catch(e=>{t.error=e});return t.end()},Se={},Oe={},_e={"@csl/object":e=>[e],"@csl/list+object":e=>e,"@else/list+object":e=>e.map(Ee).flat(),"@invalid":()=>{throw new Error("This format is not supported or recognized")}},Ae={"@else/list+object":async e=>(await Promise.all(e.map(je))).flat()};function Ce(e,t){if("function"==typeof Se[t])return Se[t](e);throw new Error("This format is not supported or recognized")}async function Re(e,t){if("function"==typeof Oe[t])return Oe[t](e);if("function"==typeof Ae[t])return Ae[t](e);if(Be(t,!1))return Ce(e,t);throw new TypeError(`No parser found for ${t}`)}function Ie(e,{parser:t,async:r}){r?Oe[e]=t:Se[e]=t}function Be(e,t){return t?Oe[e]||Ae[e]:Se[e]||_e[e]}function Pe(e,t){delete(t?Oe:Se)[e]}const Le={};function ze(e){return Le[e]}var Ue={__proto__:null,util:Object.assign({},d,y,I,H),add:function(e,t){const r=new R(e,t);r.validate();const i=Le[e]||(Le[e]={});r.typeParser&&(S(e,r.typeParser),i.type=!0),r.dataParser&&(Ie(e,r.dataParser),i.data=!0),r.asyncDataParser&&(Ie(e,r.asyncDataParser),i.asyncData=!0),t.outputs&&(i.outputs=t.outputs)},get:ze,remove:function(e){const t=Le[e];t&&(t.type&&O(e),t.data&&Pe(e),t.asyncData&&Pe(e,!0),delete Le[e])},has:function(e){return e in Le},list:function(){return Object.keys(Le)},chain:Ee,chainLink:e=>{const t=j(e);return Ce(t.match(/array|object/)?V(e):e,t)},chainAsync:je,chainLinkAsync:async e=>{const t=j(e);return Re(t.match(/array|object/)?V(e):e,t)},type:j,addTypeParser:S,hasTypeParser:function(e){return Object.prototype.hasOwnProperty.call(x,e)},removeTypeParser:O,listTypeParser:function(){return Object.keys(x)},treeTypeParser:function(){const e=t=>({name:t,children:x[t].extensions.map(e)});return{name:"Type tree",children:Object.keys(w).map(t=>({name:t,children:w[t].map(e)}))}},typeMatcher:_,data:Ce,dataAsync:Re,addDataParser:Ie,hasDataParser:Be,removeDataParser:Pe,listDataParser:function(e){return Object.keys(e?Oe:Se)}},De={__proto__:null,add:function(e,t={},r=!1){return!0!==t&&!0!==r||this.save(),this.data.push(...Ee(e,t)),this.data.filter(e=>!Object.prototype.hasOwnProperty.call(e,"id")).forEach(e=>{e.id=ye(this.getIds(),"temp_id_")}),this},addAsync:async function(e,t={},r=!1){return!0!==t&&!0!==r||this.save(),this.data.push(...await je(e,t)),this.data.filter(e=>!Object.prototype.hasOwnProperty.call(e,"id")).forEach(e=>{e.id=ye(this.getIds(),"temp_id_")}),this},set:function(e,t={},r=!1){return!0!==t&&!0!==r||this.save(),this.data=[],"boolean"!=typeof t?this.add(e,t):this.add(e)},setAsync:async function(e,t={},r=!1){return!0!==t&&!0!==r||this.save(),this.data=[],"boolean"!=typeof t?this.addAsync(e,t):this.addAsync(e)},reset:function(e){return e&&this.save(),this.data=[],this._options={},this}};function $e(e){if("citation-label"in e)return e["citation-label"];let t="";return e.author&&(t+=e.author[0].family||e.author[0].literal),e.issued&&e.issued["date-parts"]&&e.issued["date-parts"][0]&&(t+=e.issued["date-parts"][0][0]),e["year-suffix"]?t+=e["year-suffix"]:e.title&&(t+=e.title.replace(/<\/?.*?>/g,"").match(/^(?:(?:the|a|an)\s+)?(\S+)/i)[1]),t}var Ne={label:e=>e.reduce((e,t)=>(e[t.id]=$e(t),e),{})};function Me(e,r,i="label"===r){let o=i?$e(e):e[r];switch(r){case"author":case"editor":return o.map(e=>e.literal||e.family||t(e));case"accessed":case"issued":return o["date-parts"][0];case"page":return o.split("-").map(e=>parseInt(e));case"edition":case"issue":case"volume":return o=parseInt(o),isNaN(o)?-Infinity:o;default:return o||-Infinity}}function qe(e,t,r,i=/^!/.test(r)){const o=Me(e,r=r.replace(/^!/,"")),a=Me(t,r);return(i?-1:1)*(o>a?1:o{const i=e.slice();let o=0;for(;!o&&i.length;)o=qe(t,r,i.shift());return o}}(...e,"label")),this}};const He=new ve;function Ge(e,t,...r){if(!He.has(e))throw new Error(`Output format "${e}" unavailable`);return He.get(e)(t,...r)}var Je={__proto__:null,register:He,add:function(e,t){!function(e,t){if("string"!=typeof e)throw new TypeError("Invalid output format name, expected string, got "+typeof e);if("function"!=typeof t)throw new TypeError("Invalid formatter, expected function, got "+typeof t)}(e,t),He.set(e,t)},remove:function(e){He.remove(e)},has:function(e){return He.has(e)},list:function(){return He.list()},format:Ge},Ve={__proto__:null,getIds:function(){return this.data.map(e=>e.id)},format:function(e,...t){return Ge(e,F(this.data),...t)},get:function(e={}){u(e);const t=Object.assign({},this.defaultOptions,this._options.output,e),{type:r,style:i}=t,[o,a]=i.split("-"),n="citation"===o?"bibliography":"csl"===o?"data":o,s="string"===r?"text":"json"===r?"object":r;let l;switch(n){case"bibliography":{const{lang:e,append:r,prepend:i}=t;l={template:a,lang:e,format:s,append:r,prepend:i};break}case"data":case"bibtex":case"bibtxt":case"ndjson":case"ris":l={type:s};break;default:throw new Error(`Invalid style "${n}"`)}const c=this.format(n,Object.assign(l,e._newOptions)),{format:m}=t;if("real"===m&&"html"===s&&"undefined"!=typeof document&&"function"==typeof document.createElement){const e=document.createElement("div");return e.innerHTML=c,e.firstChild}return"string"===m&&"object"==typeof c?JSON.stringify(c):c}},Ke={__proto__:null,async:function(e,t,r){"function"!=typeof t||r||(r=t,t=void 0);const i=(new this).setAsync(e,t);return"function"==typeof r?void i.then(r):i},validateOutputOptions:u,validateOptions:function(e){if("object"!=typeof e)throw new TypeError("Options should be an object");if(e.output)u(e.output);else{if(e.maxChainLength&&"number"!=typeof e.maxChainLength)throw new TypeError("Option maxChainLength should be a number");if(e.forceType&&"string"!=typeof e.forceType)throw new TypeError("Option forceType should be a string");if(null!=e.generateGraph&&"boolean"!=typeof e.generateGraph)throw new TypeError("Option generateGraph should be a boolean");if(null!=e.strict&&"boolean"!=typeof e.strict)throw new TypeError("Option strict should be a boolean");if(null!=e.target&&"string"!=typeof e.target)throw new TypeError("Option target should be a boolean")}return!0}};function We(e,t={}){return this instanceof We?(this._options=t,this.log=[],this.data=[],e.forEach(e=>{this.add(e,t)}),this.options(t),this):new We(e,t)}Object.assign(We.prototype,n,p,De,Fe,Ve),We.prototype[Symbol.iterator]=function*(){yield*this.data},Object.assign(We,Ke);const Xe=new ve({html:{bibliographyContainer:['
',"
"],entry:['
',"
"],list:['
    ',"
"],listItem:["
  • ","
  • "]},text:{bibliographyContainer:["","\n"],entry:["","\n"],list:["\n",""],listItem:["\t","\n"]}});function Ye(e){return Xe.has(e)}function Ze(e){if(!Xe.has(e))throw new Error(`Dict "${e}" unavailable`);return Xe.get(e)}var Qe={__proto__:null,register:Xe,add:function(e,t){!function(e,t){if("string"!=typeof e)throw new TypeError("Invalid dict name, expected string, got "+typeof e);if("object"!=typeof t)throw new TypeError("Invalid dict, expected object, got "+typeof t);for(const e in t){const r=t[e];if(!Array.isArray(r)||r.some(e=>"string"!=typeof e))throw new TypeError(`Invalid dict entry "${e}", expected array of strings`)}}(e,t),Xe.set(e,t)},remove:function(e){Xe.remove(e)},has:Ye,list:function(){return Xe.list()},get:Ze,htmlDict:{wr_start:'
    ',wr_end:"
    ",en_start:'
    ',en_end:"
    ",ul_start:'
      ',ul_end:"
    ",li_start:"
  • ",li_end:"
  • "},textDict:{wr_start:"",wr_end:"\n",en_start:"",en_end:"\n",ul_start:"\n",ul_end:"",li_start:"\t",li_end:"\n"}};const et={};var tt={__proto__:null,add:function(e,t){et[e]=t},get:function(e){return et[e]},has:function(e){return Object.prototype.hasOwnProperty.call(et,e)},remove:function(e){delete et[e]},list:function(){return Object.keys(et)}};const rt={input:Ue,output:Je,dict:Qe,config:tt},it={};function ot(e,t={}){const r=it[e]={};for(const i in t){if("config"===i){r.config={[e]:t.config},rt.config.add(e,t.config);continue}const o=r[i]={},a=t[i];for(const e in a){const t=a[e];o[e]=!0,rt[i].add(e,t)}}}var at={__proto__:null,add:ot,remove:function(e){const t=it[e];for(const e in t){const r=t[e];for(const t in r)rt[e].remove(t)}delete it[e]},has:function(e){return e in it},list:function(){return Object.keys(it)},input:Ue,output:Je,dict:Qe,config:tt};function nt(){return[]}const st=[[/((?:\[|:|,)\s*)'((?:\\'|[^'])*?[^\\])?'(?=\s*(?:\]|}|,))/g,'$1"$2"'],[/((?:(?:"|]|}|\/[gmiuys]|\.|(?:\d|\.|-)*\d)\s*,|{)\s*)(?:"([^":\n]+?)"|'([^":\n]+?)'|([^":\n]+?))(\s*):/g,'$1"$2$3$4"$5:']],lt={"@empty/text":{parse:nt,parseType:{dataType:"String",predicate:e=>""===e}},"@empty/whitespace+text":{parse:nt,parseType:{dataType:"String",predicate:/^\s+$/}},"@empty":{parse:nt,parseType:{dataType:"Primitive",predicate:e=>null==e}},"@else/json":{parse:function(e){if("string"!=typeof e)return JSON.parse(e);try{return JSON.parse(e)}catch(t){return v.debug("[plugin-common]","Invalid JSON, switching to experimental parser"),st.forEach(([t,r])=>{e=e.replace(t,r)}),JSON.parse(e)}},parseType:{dataType:"String",predicate:/^\s*(\{[\S\s]*\}|\[[\S\s]*\])\s*$/}},"@else/url":{parseType:{dataType:"String",predicate:/^https?:\/\/(([\w-]+\.)*[\w-]+)(:\d+)?(\/[^?/]*)*(\?[^#]*)?(#.*)?$/i}},"@else/jquery":{parse:function(e){return e.val()||e.text()||e.html()},parseType:{dataType:"ComplexObject",predicate:e=>"undefined"!=typeof jQuery&&e instanceof jQuery}},"@else/html":{parse:function(e){return e.value||e.textContent},parseType:{dataType:"ComplexObject",predicate:e=>"undefined"!=typeof HTMLElement&&e instanceof HTMLElement}}};function ct(e,t,r){return e+(tut(e,t)):Object.keys(e).filter(t=>JSON.stringify(e[t])).map(r=>`"${r}": ${ut(e[r],t)}`),i=i.map(ct).map(e=>t.listItem.join(e)),i=t.list.join(i.join("")),r?`[${i}]`:`{${i}}`}function ut(e,t){return"object"==typeof e&&null!==e?0===e.length?"[]":0===Object.keys(e).length?"{}":mt(e,t):JSON.stringify(e)}var pt={data:(e,{type:t,format:r=t||"text",version:i="1.0.2"}={})=>(i<"1.0.2"&&(e=J(e)),"object"===r?V(e):"text"===r?JSON.stringify(e,null,2):(v.warn("[core]","This feature (JSON output with special formatting) is unstable. See https://github.com/larsgw/citation.js/issues/144"),function(e,t){let r=e.map(e=>mt(e,t));return r=r.map(ct).map(e=>t.entry.join(e)),r=r.join(""),t.bibliographyContainer.join(`[${r}]`)}(e,Ze(r)))),ndjson:(e,{version:t="1.0.2"}={})=>(t<"1.0.2"&&(e=J(e)),e.map(e=>JSON.stringify(e)).join("\n"))};function ht(t){const{firstname:r,lastname:i,firstName:o=r,lastName:a=i}=t;return o&&a?{given:o,family:a}:t.name?e(t.name):void 0}ot("@else",{input:lt,output:Object.assign({},pt,Ne)});const ft=["PMID","PMCID","DOI","ISBN"],dt=["ISSN"];function gt(e,t){const r={};for(const i in e){const o=i.toUpperCase();t.includes(o)&&(r[o]=e[i])}if(e.identifier)for(let{id:i,type:o=""}of e.identifier)o=o.toUpperCase(),t.includes(o)&&(r[o]=i);return r}const bt={article:"article",book:"book",booklet:"book",proceedings:"book",mastersthesis:"thesis",inbook:"chapter",incollection:"chapter",conference:"paper-conference",inproceedings:"paper-conference",manual:"report",misc:"document",online:"website",patent:"patent",phdthesis:"thesis",techreport:"report",unpublished:"manuscript"};function yt(e){const t={type:bt[e.type]||"document",title:e.title};if(e.author&&(t.author=e.author.map(ht).filter(Boolean)),e.editor&&(t.editor=e.editor.map(ht).filter(Boolean)),e.reviewer&&(e.author&&(t["reviewed-author"]=t.author),t.author=e.reviewer.map(ht).filter(Boolean)),Array.isArray(e.keywords)?t.keyword=e.keywords.join():e.keywords&&(t.keyword=e.keywords),e.publisher&&(t.publisher=e.publisher.name||e.publisher),e.date&&e.date.published?t.issued=r(e.date.published):e.year&&(t.issued={"date-parts":[[+e.year]]}),e.date&&e.date.submitted&&(t.submitted=r(e.date.submitted)),e.journal){const r=e.journal;r.name&&(t["container-title"]=r.name),r.volume&&(t.volume=r.volume),r.issue&&(t.issue=r.issue),Object.assign(t,gt(r,dt)),r.firstpage&&(t["page-first"]=r.firstpage),r.pages?t.page=r.pages.replace("--","-"):r.firstpage&&r.lastpage&&(t.page=r.firstpage+"-"+r.lastpage)}return e.link&&"object"==typeof e.link[0]&&(t.URL=e.link[0].url),Object.assign(t,gt(e,ft)),e.cid?t.id=e.cid:t.DOI&&(t.id=t.DOI),t}const vt=["fulltext_html","fulltext_xml","fulltext_pdf"],xt=["name","lastname","lastName","firstname","firstName"],wt={"@bibjson/quickscrape+record+object":{parse:function(e){return Object.assign(yt(e),{type:"article-journal"})},parseType:{propertyConstraint:{props:"link",value:e=>vt.some(t=>e.find(({type:e})=>e===t))},extends:"@bibjson/record+object"}},"@bibjson/record+object":{parse:function(e){return yt(e)},parseType:{dataType:"SimpleObject",propertyConstraint:[{props:"title"},{props:["author","editor"],match:"some",value:e=>Array.isArray(e)&&e[0]&&xt.some(t=>t in e[0])}]}},"@bibjson/collection+object":{parse:e=>e.records,parseType:{dataType:"SimpleObject",propertyConstraint:[{props:"metadata",value:e=>"collection"in e},{props:"records",value:e=>Array.isArray(e)}]}}};ot("@bibjson",{input:wt});var kt=X(function(e){!function(t,r){e.exports?e.exports=r():t.moo=r()}(K,function(){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r="boolean"==typeof(new RegExp).sticky;function i(e){return e&&"[object RegExp]"===t.call(e)}function o(e){return e&&"object"==typeof e&&!i(e)&&!Array.isArray(e)}function a(e){return e.length?"(?:"+e.map(function(e){return"(?:"+e+")"}).join("|")+")":"(?!)"}function n(e){if("string"==typeof e)return"(?:"+e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+")";if(i(e)){if(e.ignoreCase)throw new Error("RegExp /i flag not allowed");if(e.global)throw new Error("RegExp /g flag is implied");if(e.sticky)throw new Error("RegExp /y flag is implied");if(e.multiline)throw new Error("RegExp /m flag is implied");return e.source}throw new Error("Not a pattern: "+e)}function s(e,t){return e.length>t?e:Array(t-e.length+1).join(" ")+e}function l(t,r){if(o(r)||(r={match:r}),r.include)throw new Error("Matching rules cannot also include states");var a={defaultType:t,lineBreaks:!!r.error||!!r.fallback,pop:!1,next:null,push:null,error:!1,fallback:!1,value:null,type:null,shouldThrow:!1};for(var n in r)e.call(r,n)&&(a[n]=r[n]);if("string"==typeof a.type&&t!==a.type)throw new Error("Type transform cannot be a string (type '"+a.type+"' for token '"+t+"')");var s=a.match;return a.match=Array.isArray(s)?s:s?[s]:[],a.match.sort(function(e,t){return i(e)&&i(t)?0:i(t)?-1:i(e)?1:t.length-e.length}),a}function c(e){return Array.isArray(e)?function(e){for(var t=[],r=0;r0)throw new Error("RegExp has capture groups: "+v+"\nUse (?: … ) instead");if(!f.lineBreaks&&v.test("\n"))throw new Error("Rule should declare lineBreaks: "+v);p.push("("+y+")")}}var x=o&&o.fallback,w=r&&!x?"ym":"gm",k=r||x?"":"|";return!0===c&&(w+="u"),{regexp:new RegExp(a(p)+k,w),groups:u,fast:s,error:o||m}}function p(e,t,r){var i=e&&(e.push||e.next);if(i&&!r[i])throw new Error("Missing state '"+i+"' (in token '"+e.defaultType+"' of state '"+t+"')");if(e&&e.pop&&1!=+e.pop)throw new Error("pop must be 1 (in token '"+e.defaultType+"' of state '"+t+"')")}var h=function(e,t){this.startState=t,this.states=e,this.buffer="",this.stack=[],this.reset()};h.prototype.reset=function(e,t){return this.buffer=e||"",this.index=0,this.line=t?t.line:1,this.col=t?t.col:1,this.queuedToken=t?t.queuedToken:null,this.queuedText=t?t.queuedText:"",this.queuedThrow=t?t.queuedThrow:null,this.setState(t?t.state:this.startState),this.stack=t&&t.stack?t.stack.slice():[],this},h.prototype.save=function(){return{line:this.line,col:this.col,state:this.state,stack:this.stack.slice(),queuedToken:this.queuedToken,queuedText:this.queuedText,queuedThrow:this.queuedThrow}},h.prototype.setState=function(e){if(e&&this.state!==e){this.state=e;var t=this.states[e];this.groups=t.groups,this.error=t.error,this.re=t.regexp,this.fast=t.fast}},h.prototype.popState=function(){this.setState(this.stack.pop())},h.prototype.pushState=function(e){this.stack.push(this.state),this.setState(e)};var f=r?function(e,t){return e.exec(t)}:function(e,t){var r=e.exec(t);return 0===r[0].length?null:r};function d(){return this.value}if(h.prototype._getGroup=function(e){for(var t=this.groups.length,r=0;r",textbackslash:"\\",textasciicircum:"^",textunderscore:"_",textbraceleft:"{",textbar:"|",textbraceright:"}",textasciitilde:"~",textexclamdown:"¡",textcent:"¢",textsterling:"£",textcurrency:"¤",textyen:"¥",textbrokenbar:"¦",textsection:"§",textasciidieresis:"¨",textcopyright:"©",textordfeminine:"ª",guillemetleft:"«",guillemotleft:"«",textlnot:"¬",textregistered:"®",textasciimacron:"¯",textdegree:"°",textpm:"±",texttwosuperior:"²",textthreesuperior:"³",textasciiacute:"´",textmu:"µ",textparagraph:"¶",textperiodcentered:"·",textonesuperior:"¹",textordmasculine:"º",guillemetright:"»",guillemotright:"»",textonequarter:"¼",textonehalf:"½",textthreequarters:"¾",textquestiondown:"¿",AE:"Æ",DH:"Ð",texttimes:"×",O:"Ø",TH:"Þ",ss:"ß",ae:"æ",dh:"ð",textdiv:"÷",o:"ø",th:"þ",DJ:"Đ",dj:"đ",i:"ı",IJ:"IJ",ij:"ij",L:"Ł",l:"ł",NG:"Ŋ",ng:"ŋ",OE:"Œ",oe:"œ",textflorin:"ƒ",j:"ȷ",textasciicaron:"ˇ",textasciibreve:"˘",textacutedbl:"˝",textgravedbl:"˵",texttildelow:"˷",textbaht:"฿",SS:"ẞ",textcompwordmark:"‌",textendash:"–",textemdash:"—",textbardbl:"‖",textquoteleft:"‘",textquoteright:"’",quotesinglbase:"‚",textquotedblleft:"“",textquotedblright:"”",quotedblbase:"„",textdagger:"†",textdaggerdbl:"‡",textbullet:"•",textellipsis:"…",textperthousand:"‰",textpertenthousand:"‱",guilsinglleft:"‹",guilsinglright:"›",textreferencemark:"※",textinterrobang:"‽",textfractionsolidus:"⁄",textlquill:"⁅",textrquill:"⁆",textdiscount:"⁒",textcolonmonetary:"₡",textlira:"₤",textnaira:"₦",textwon:"₩",textdong:"₫",texteuro:"€",textpeso:"₱",textcelsius:"℃",textnumero:"№",textcircledP:"℗",textrecipe:"℞",textservicemark:"℠",texttrademark:"™",textohm:"Ω",textmho:"℧",textestimated:"℮",textleftarrow:"←",textuparrow:"↑",textrightarrow:"→",textdownarrow:"↓",textminus:"−",Hwithstroke:"Ħ",hwithstroke:"ħ",textasteriskcentered:"∗",textsurd:"√",textlangle:"〈",textrangle:"〉",textblank:"␢",textvisiblespace:"␣",textopenbullet:"◦",textbigcircle:"◯",textmusicalnote:"♪",textmarried:"⚭",textdivorced:"⚮",textinterrobangdown:"⸘",textcommabelow:null,copyright:"©",Gamma:"Γ",Delta:"Δ",Theta:"Θ",Lambda:"Λ",Xi:"Ξ",Pi:"Π",Sigma:"Σ",Phi:"Φ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",varepsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",pi:"π",rho:"ρ",varsigma:"ς",sigma:"σ",tau:"τ",upsilon:"υ",varphi:"φ",chi:"χ",psi:"ψ",omega:"ω",vartheta:"ϑ",Upsilon:"ϒ",phi:"ϕ",varpi:"ϖ",varrho:"ϱ",epsilon:"ϵ"},Ot={jan:"01",feb:"02",mar:"03",apr:"04",may:"05",jun:"06",jul:"07",aug:"08",sep:"09",oct:"10",nov:"11",dec:"12",acmcs:"ACM Computing Surveys",acta:"Acta Informatica",cacm:"Communications of the ACM",ibmjrd:"IBM Journal of Research and Development",ibmsj:"IBM Systems Journal",ieeese:"IEEE Transactions on Software Engineering",ieeetc:"IEEE Transactions on Computers",ieeetcad:"IEEE Transactions on Computer-Aided Design of Integrated Circuits",ipl:"Information Processing Letters",jacm:"Journal of the ACM",jcss:"Journal of Computer and System Sciences",scp:"Science of Computer Programming",sicomp:"SIAM Journal on Computing",tocs:"ACM Transactions on Computer Systems",tods:"ACM Transactions on Database Systems",tog:"ACM Transactions on Graphics",toms:"ACM Transactions on Mathematical Software",toois:"ACM Transactions on Office Information Systems",toplas:"ACM Transactions on Programming Languages and Systems",tcs:"Theoretical Computer Science"},_t={it:"italics",itshape:"italics",sl:"italics",slshape:"italics",em:"italics",bf:"bold",bfseries:"bold",sc:"smallcaps",scshape:"smallcaps",rm:void 0,sf:void 0,tt:void 0},At={textit:"italics",textsl:"italics",emph:"italics",mkbibitalic:"italics",mkbibemph:"italics",textbf:"bold",strong:"bold",mkbibbold:"bold",textsc:"smallcaps",textsuperscript:"superscript",textsubscript:"subscript",enquote:"quotes",mkbibquote:"quotes",textmd:void 0,textrm:void 0,textsf:void 0,texttt:void 0,textup:void 0},Ct={italics:["",""],bold:["",""],superscript:["",""],subscript:["",""],smallcaps:['',""],nocase:['',""],quotes:["“","”"]},Rt={ElsevierGlyph:e=>String.fromCharCode(parseInt(e,16)),href:(e,t)=>e,url:e=>e},It=/---?|''|``|~/g,Bt={"--":"–","---":"—","``":"“","''":"”","~":" "},Pt={"^":"superscript",sp:"superscript",_:"subscript",sb:"subscript",mathrm:void 0},Lt={"^":{0:"⁰",1:"¹",2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹","+":"⁺","-":"⁻","=":"⁼","(":"⁽",")":"⁾",i:"ⁱ",n:"ⁿ"},_:{0:"₀",1:"₁",2:"₂",3:"₃",4:"₄",5:"₅",6:"₆",7:"₇",8:"₈",9:"₉","+":"₊","-":"₋","=":"₌","(":"₍",")":"₎",a:"ₐ",e:"ₑ",o:"ₒ",x:"ₓ",ə:"ₔ",h:"ₕ",k:"ₖ",l:"ₗ",m:"ₘ",n:"ₙ",s:"ₚ",p:"ₛ",t:"ₜ"}},zt=["american","british","canadian","english","australian","newzealand","usenglish","ukenglish","en","eng","en-au","en-bz","en-ca","en-cb","en-gb","en-ie","en-jm","en-nz","en-ph","en-tt","en-us","en-za","en-zw","anglais"];var Ut={__proto__:null,required:Tt,fieldTypes:Et,diacritics:jt,commands:St,defaultStrings:Ot,formattingEnvs:_t,formattingCommands:At,formatting:Ct,argumentCommands:Rt,ligaturePattern:It,ligatures:Bt,mathScriptFormatting:Pt,mathScripts:Lt,sentenceCaseLanguages:zt};const Dt=/[a-zA-Z_][a-zA-Z0-9_:-]*/,$t={comment:/%.*/,whitespace:{match:/\s+/,lineBreaks:!0}},Nt=kt.states({main:{junk:{match:/@[cC][oO][mM][mM][eE][nN][tT].+|[^@]+/,lineBreaks:!0},at:{match:"@",push:"entry"}},entry:B({},$t,{otherEntryType:{match:/[sS][tT][rR][iI][nN][gG]|[pP][rR][eE][aA][mM][bB][lL][eE]/,next:"otherEntryContents"},dataEntryType:{match:Dt,next:"dataEntryContents"}}),otherEntryContents:B({},$t,{lbrace:{match:/[{(]/,next:"fields"}}),dataEntryContents:B({},$t,{lbrace:{match:/[{(]/,next:"dataEntryContents"},label:/[^,\s]+/,comma:{match:",",next:"fields"}}),fields:B({},$t,{identifier:Dt,number:/-?\d+/,hash:"#",equals:"=",comma:",",quote:{match:'"',push:"quotedLiteral"},lbrace:{match:"{",push:"bracedLiteral"},rbrace:{match:/[})]/,pop:!0}}),quotedLiteral:{lbrace:{match:"{",push:"bracedLiteral"},quote:{match:'"',pop:!0},text:{match:/(?:\\[\\{]|[^{"])+/,lineBreaks:!0}},bracedLiteral:{lbrace:{match:"{",push:"bracedLiteral"},rbrace:{match:"}",pop:!0},text:{match:/(?:\\[\\{}]|[^{}])+/,lineBreaks:!0}}}),Mt={"(":")","{":"}"},qt=new xe({Main(){const e=[];for(;;){for(;this.matchToken("junk");)this.consumeToken("junk");if(this.matchEndOfFile())break;e.push(this.consumeRule("Entry"))}return e.filter(Boolean)},_(){let e;for(;e!==this.token;)e=this.token,this.consumeToken("whitespace",!0),this.consumeToken("comment",!0)},Entry(){this.consumeToken("at"),this.consumeRule("_");const e=(this.matchToken("otherEntryType")?this.consumeToken("otherEntryType"):this.consumeToken("dataEntryType")).value.toLowerCase();this.consumeRule("_");const t=this.consumeToken("lbrace").value;let r;if(this.consumeRule("_"),"string"===e){const[e,t]=this.consumeRule("Field");this.state.strings[e]=t}else if("preamble"===e)this.consumeRule("Expression");else{const t=this.consumeToken("label").value;this.consumeRule("_"),this.consumeToken("comma"),this.consumeRule("_"),r={type:e,label:t,properties:this.consumeRule("EntryBody")}}this.consumeRule("_");const i=this.consumeToken("rbrace").value;return i!==Mt[t]&&v.warn("[plugin-bibtex]",`entry started with "${t}", but ends with "${i}"`),r},EntryBody(){const e={};for(;this.matchToken("identifier");){const[t,r]=this.consumeRule("Field");if(e[t]=r,this.consumeRule("_"),!this.consumeToken("comma",!0))break;this.consumeRule("_")}return e},Field(){const e=this.consumeToken("identifier").value.toLowerCase();return this.consumeRule("_"),this.consumeToken("equals"),this.consumeRule("_"),[e,this.consumeRule("Expression")]},Expression(){let e=this.consumeRule("ExpressionPart");for(this.consumeRule("_");this.matchToken("hash");)this.consumeToken("hash"),this.consumeRule("_"),e+=this.consumeRule("ExpressionPart").toString(),this.consumeRule("_");return e},ExpressionPart(){return this.matchToken("identifier")?this.state.strings[this.consumeToken("identifier").value.toLowerCase()]||"":this.matchToken("number")?parseInt(this.consumeToken("number")):this.matchToken("quote")?this.consumeRule("QuoteString"):this.consumeRule("BracketString")},QuoteString(){let e="";for(this.consumeToken("quote");!this.matchToken("quote");)e+=this.consumeRule("Text");return this.consumeToken("quote"),e},BracketString(){let e="";for(this.consumeToken("lbrace");!this.matchToken("rbrace");)e+=this.consumeRule("Text");return this.consumeToken("rbrace"),e},Text(){return this.matchToken("lbrace")?`{${this.consumeRule("BracketString")}}`:this.consumeToken("text").value}},{strings:Ot});function Ft(e){return qt.parse(Nt.reset(e))}const Ht=/\n\s*(?=\[)/g,Gt=/^\[(.+?)\]\s*(?:\n([\s\S]+))?$/,Jt=/((?=.)\s)*\n\s*/g,Vt=/:(.*)/,Kt=e=>{const[,t,r]=e.match(Gt)||[];if(t&&r){const e={type:"book",label:t,properties:{}};return r.trim().split(Jt).filter(e=>e).forEach(t=>{let[r,i]=t.split(Vt);i&&(r=r.trim(),i=i.trim(),"type"===r?e.type=i:e.properties[r]=i)}),e}return{}},Wt={source:{article:"article-journal",book:"book",mvbook:"book",inbook:"chapter",bookinbook:"book",booklet:"book",collection:"book",mvcollection:"book",incollection:"chapter",dataset:"dataset",online:"webpage",patent:"patent",periodical:"article-journal",proceedings:"book",mvproceedings:"book",inproceedings:"paper-conference",reference:"book",mvreference:"book",inreference:"entry",report:"report",software:"book",thesis:"thesis",unpublished:"manuscript",artwork:"graphic",audio:"song",image:"figure",jurisdiction:"legal_case",legislation:"legislation",legal:"treaty",letter:"personal_communication",movie:"motion_picture",music:"musical_score",review:"review",video:"motion_picture",conference:"paper-conference",electronic:"webpage",mastersthesis:"thesis",phdthesis:"thesis",techreport:"report",www:"webpage"},target:{article:"article","article-journal":"article","article-magazine":"article","article-newspaper":"article",bill:"legislation",book:"book",broadcast:"audio",chapter:"inbook",dataset:"dataset",entry:"inreference","entry-dictionary":"inreference","entry-encyclopedia":"inreference",figure:"artwork",graphic:"artwork",interview:"audio",legal_case:"jurisdiction",legislation:"legislation",manuscript:"unpublished",motion_picture:"movie",musical_score:"music","paper-conference":"inproceedings",patent:"patent",personal_communication:"letter",post:"online","post-weblog":"online",report:"report",review:"review","review-book":"review",song:"music",speech:"audio",thesis:"thesis",treaty:"legal",webpage:"online"}},Xt={source:{article:"article-journal",book:"book",booklet:"book",conference:"paper-conference",inbook:"chapter",incollection:"chapter",inproceedings:"paper-conference",mastersthesis:"thesis",phdthesis:"thesis",proceedings:"book",techreport:"report",unpublished:"manuscript"},target:{article:"article","article-journal":"article","article-magazine":"article","article-newspaper":"article",book:"book",chapter:"inbook",manuscript:"unpublished","paper-conference":"inproceedings",report:"techreport",review:"article","review-book":"article"}};var Yt={constants:Ut,types:{biblatex:Wt,bibtex:Xt},parse:{biblatex:!0,strict:!1,sentenceCase:"never"},format:{useIdAsLabel:!1}};const Zt=new Set(["the","a","an"]),Qt=/(?:<\/?.*?>|[\u0020-\u002F\u003A-\u0040\u005B-\u005E\u0060\u007B-\u007F])+/g,er=/[^\u0020-\u007F]+/g;function tr(e){return e?e.normalize("NFKD").replace(er,"").split(Qt).find(e=>e.length&&!Zt.has(e.toLowerCase())):""}const rr=new ke([{source:"given",target:"given"},{source:"family",target:"family"},{source:"suffix",target:"suffix"},{source:"prefix",target:"non-dropping-particle"},{source:"family",target:"literal",when:{source:!1,target:{family:!1,given:!1}}}]),ir=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],or="BibTeX type",ar="BibTeX label",nr={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12,january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},sr={bathesis:"Bachelor's thesis",mathesis:"Master's thesis",phdthesis:"PhD thesis",candthesis:"Candidate thesis",techreport:"technical report",resreport:"research report",software:"computer software",datacd:"data cd",audiocd:"audio cd",patent:"patent",patentde:"German patent",patenteu:"European patent",patentfr:"French patent",patentuk:"British patent",patentus:"U.S. patent",patreq:"patent request",patreqde:"German patent request",patreqeu:"European patent request",patreqfr:"French patent request",patrequk:"British patent request",patrequs:"U.S. patent request"},lr=/(^(?:ISAN )?(?:[0-9a-f]{4}-){4}[0-9a-z](?:-(?:[0-9a-f]{4}-){2}[0-9a-z])?$)|(^(?:979-?0-?|M-?)(?:\d{9}|(?=[\d-]{11}$)\d+-\d+-\d)$)|(^ISRN .{1,36}$)|(^(?:ISWC )?T-?\d{9}-?\d$)/i;function cr(e){if(null==e)return[];if(+e)return[parseInt(e,10)];if((e=e.trim().toLowerCase())in nr)return[nr[e]];const t=e.split(/\s+/);let r,i;return t[0]in nr?(r=nr[t[0]],i=parseInt(t[1])):t[1]in nr&&(r=nr[t[1]],i=parseInt(t[0])),i?[r,i]:r?[r]:[]}const mr={PICK:{toTarget:(...e)=>e.find(Boolean),toSource:e=>[e]},DATE:{toTarget(e){const t=e.split("/").map(e=>e&&".."!==e?function(e){const t=e.split("T")[0].replace(/[?~%]$/,"").split("-"),r=+t[0].replace(/^Y(?=-?\d{4}\d+)/,"").replace(/X/g,"0"),i=+t[1],o=+t[2];return!i||i>20?[r]:o?[r,i,o]:[r,i]}(e):void 0);return isNaN(t[0][0])?{literal:e}:{"date-parts":t}},toSource(e){if("date-parts"in e)return e["date-parts"].map(e=>e.map(e=>e.toString().padStart(2,"0")).join("-")).join("/")}},YEAR_MONTH:{toTarget:(e,t,r)=>isNaN(+e)?{literal:e}:isNaN(+r)||isNaN(+t)?{"date-parts":[[+e,...cr(t)]]}:{"date-parts":[[+e,+t,+r]]},toSource(e){if("date-parts"in e){const[t,r,i]=e["date-parts"][0];return[t.toString(),r?i?`${ir[r-1]} ${i}`:r:void 0]}}},EPRINT:{toTarget(e,t){if("pubmed"===t)return e},toSource:e=>[e,"pubmed"]},HOW_PUBLISHED:{toTarget(e){if(e.startsWith("http"))return e}},KEYWORDS:{toTarget:e=>e.join(","),toSource:e=>e.split(",")},LABEL:{toTarget:e=>[e,e],toSource(e,t,r,i,o,a){let n;return n=null===e?"null":void 0===e?"undefined":e.toString().replace(Qt,""),Yt.format.useIdAsLabel?n:t&&!Qt.test(t)?t:function(e,t,r,i){let o="";return e&&e[0]&&(o+=tr(e[0].family||e[0].literal)),t&&t["date-parts"]&&t["date-parts"][0]&&(o+=t["date-parts"][0][0]),r?o+=r:i&&(o+=tr(i)),o}(r,i,o,a)||n}},NAMES:{toTarget:e=>e.map(rr.convertToTarget),toSource:e=>e.map(rr.convertToSource)},STANDARD_NUMBERS:{toTarget:(...e)=>e.find(Boolean),toSource(e){const t=e.toString().match(lr);return t?t.slice(1,5):[]}},STATUS:{toSource(e){if(/^(inpreparation|submitted|forthcoming|inpress|prepublished)$/i.test(e))return e}},TITLE:{toTarget:(e,t,r)=>(t&&(e+=": "+t),e),toSource:e=>[e]}},ur=[{source:"note",target:"accessed",when:{source:!1,target:{note:!1,addendum:!1}},convert:{toSource:e=>`[Online; accessed ${i(e)}]`}},{source:"numpages",target:"number-of-pages",when:{source:{pagetotal:!1},target:!1}},{source:"pmid",target:"PMID",when:{source:{eprinttype:e=>"pmid"!==e,archiveprefix:e=>"pmid"!==e},target:!1}},{source:"pmcid",target:"PMCID",when:{target:!1}},{source:"s2id",target:"custom",convert:{toTarget:e=>({S2ID:e}),toSource:({S2ID:e})=>e}}];var pr=new ke([{source:"annote",target:"annote",when:{source:{annotation:!1},target:!1}},{source:"address",target:"publisher-place",convert:mr.PICK,when:{source:{location:!1},target:!1}},{source:["eprint","archiveprefix"],target:"PMID",convert:mr.EPRINT,when:{source:{eprinttype:!1},target:!1}},{source:"journal",target:"container-title",when:{source:{maintitle:!1,booktitle:!1,journaltitle:!1},target:!1}},{source:"school",target:"publisher",convert:mr.PICK,when:{source:{institution:!1,organization:!1,publisher:!1},target:!1}},...ur,{source:"abstract",target:"abstract"},{source:"urldate",target:"accessed",convert:mr.DATE},{source:"annotation",target:"annote"},{source:"author",target:"author",convert:mr.NAMES},{source:"library",target:"call-number"},{source:"chapter",target:"chapter-number"},{source:"bookauthor",target:"container-author",convert:mr.NAMES},{source:["maintitle","mainsubtitle","maintitleaddon"],target:"container-title",when:{source:!0,target:{"number-of-volumes":!0}},convert:mr.TITLE},{source:["booktitle","booksubtitle","booktitleaddon"],target:"container-title",when:{source:{maintitle:!1},target:{"number-of-volumes":!1,type:e=>!e||!e.startsWith("article")}},convert:mr.TITLE},{source:["journaltitle","journalsubtitle","journaltitleaddon"],target:"container-title",when:{source:{[or]:"article"},target:{type:["article","article-newspaper","article-journal","article-magazine"]}},convert:mr.TITLE},{source:"shortjournal",target:"container-title-short",when:{source:{[or]:"article"},target:{type:["article","article-newspaper","article-journal","article-magazine"]}}},{source:"shortjournal",target:"journalAbbreviation",when:{source:!1,target:{"container-title-short":!1}}},{source:"number",target:"collection-number",when:{source:{[or]:["book","mvbook","inbook","bookinbook","suppbook","collection","mvcollection","incollection","suppcollection","manual","suppperiodical","proceedings","mvproceedings","refererence"]},target:{type:["bill","book","broadcast","chapter","dataset","entry","entry-dictionary","entry-encyclopedia","figure","graphic","interview","legislation","legal_case","manuscript","map","motion_picture","musical_score","pamphlet","post","post-weblog","personal_communication","review","review-book","song","speech","thesis","treaty","webpage"]}}},{source:"series",target:"collection-title"},{source:"shortseries",target:"collection-title-short"},{source:"doi",target:"DOI"},{source:"edition",target:"edition"},{source:"editor",target:"editor",convert:mr.NAMES},{source:[or,"entrysubtype","type"],target:["type","genre"],convert:{toTarget:(e,t,r)=>(r||("mastersthesis"===e&&(r="mathesis"),"phdthesis"===e&&(r="phdthesis"),"techreport"===e&&(r="techreport")),[Wt.source[e]||"document",r||t]),toSource(e,t){const r=Wt.target[e]||"misc";return t in sr?[r,void 0,t]:[r,t]}}},{source:or,when:{target:{type:!1}},convert:{toSource:()=>"misc"}},{source:"eventdate",target:"event-date",convert:mr.DATE},{source:"venue",target:"event-place"},{source:["eventtitle","eventtitleaddon"],target:"event-title",convert:mr.EVENT_TITLE},{source:["eventtitle","eventtitleaddon"],target:"event",convert:mr.EVENT_TITLE,when:{source:!1,target:{"event-title":!1}}},{source:ar,target:["id","citation-key","author","issued","year-suffix","title"],convert:mr.LABEL},{source:"isbn",target:"ISBN"},{source:"issn",target:"ISSN"},{source:"issue",target:"issue",when:{source:{number:!1,[or]:["article","periodical"]},target:{issue:e=>"string"==typeof e&&!e.match(/\d+/),type:["article","article-journal","article-newspaper","article-magazine","periodical"]}}},{source:"number",target:"issue",when:{source:{[or]:["article","periodical","inproceedings"]},target:{issue:e=>e&&("number"==typeof e||e.match(/\d+/)),type:["article","article-journal","article-newspaper","article-magazine","paper-conference","periodical"]}}},{source:"date",target:"issued",convert:mr.DATE},{source:["year","month","day"],target:"issued",convert:mr.YEAR_MONTH,when:{source:{date:!1},target:!1}},{source:"location",target:"jurisdiction",when:{source:{type:"patent"},target:{type:"patent"}}},{source:"keywords",target:"keyword",convert:mr.KEYWORDS},{source:"language",target:"language",convert:mr.PICK},{source:"langid",target:"language",when:{source:{language:!1},target:!1}},{source:"note",target:"note"},{source:"addendum",target:"note",when:{source:{note:!1},target:!1}},{source:"eid",target:"number",when:{target:{type:["article-journal"]}}},{source:["isan","ismn","isrn","iswc"],target:"number",convert:mr.STANDARD_NUMBERS,when:{source:{[or]:e=>"patent"!==e},target:{type:e=>"patent"!==e}}},{source:"number",target:"number",when:{source:{[or]:["patent","report","techreport","legislation"]},target:{type:["patent","report","legislation"]}}},{source:"origdate",target:"original-date",convert:mr.DATE},{source:"origlocation",target:"original-publisher-place",convert:mr.PICK},{source:"origpublisher",target:"original-publisher",convert:mr.PICK},{source:"origtitle",target:"original-title"},{source:"pages",target:"page",when:{source:{bookpagination:[void 0,"page"]}},convert:mr.PAGES},{source:"pagetotal",target:"number-of-pages"},{source:"part",target:"part-number"},{source:["eprint","eprinttype"],target:"PMID",convert:mr.EPRINT},{source:"location",target:"publisher-place",convert:mr.PICK},{source:"publisher",target:"publisher",convert:mr.PICK,when:{source:!0,target:{type:["article","article-journal","article-magazine","article-newspaper","bill","book","broadcast","chapter","classic","collection","dataset","document","entry","entry-dictionary","entry-encyclopedia","event","figure","graphic","hearing","interview","legal_case","legislation","manuscript","map","motion_picture","musical_score","pamphlet","paper-conference","patent","performance","periodical","personal_communication","post","post-weblog","regulation","review","review-book","software","song","speech","standard","treaty"]}}},{source:"organization",target:"publisher",convert:mr.PICK,when:{source:{publisher:!1},target:{type:"webpage"}}},{source:"institution",target:"publisher",convert:mr.PICK,when:{source:{publisher:!1,organization:!1},target:{type:["report","thesis"]}}},{source:"howpublished",target:"publisher",convert:mr.PICK,when:{source:{howpublished:e=>e&&!e.startsWith("http"),publisher:!1,organization:!1,institution:!1},target:{type:"manuscript"}}},{source:["pages","bookpagination"],target:"section",when:{source:{bookpagination:"section"},target:{page:!1}},convert:{toTarget:e=>e,toSource:e=>[e,"section"]}},{source:"pubstate",target:"status",convert:mr.STATUS},{source:"shorttitle",target:"title-short"},{source:"shorttitle",target:"shortTitle",when:{source:!1,target:{"title-short":!1}}},{source:["title","subtitle","titleaddon"],target:"title",convert:mr.TITLE},{source:"translator",target:"translator",convert:mr.NAMES},{source:"url",target:"URL"},{source:"howpublished",target:"URL",convert:mr.HOW_PUBLISHED,when:{source:{url:!1},target:!1}},{source:"version",target:"version"},{source:"volume",target:"volume"},{source:"volumes",target:"number-of-volumes"},{source:["issuetitle","issuesubtitle","issuetitleaddon"],target:"volume-title",convert:mr.TITLE}]),hr=new ke([{source:"note",target:"accessed",when:{source:!1,target:{note:!1}},convert:{toSource:e=>`[Online; accessed ${i(e)}]`}},{source:"annote",target:"annote"},{source:"address",target:"publisher-place",convert:mr.PICK},{source:"author",target:"author",convert:mr.NAMES},{source:"chapter",target:"chapter-number"},{source:"number",target:"collection-number",when:{source:{[or]:["book","mvbook","inbook","collection","mvcollection","incollection","suppcollection","manual","suppperiodical","proceedings","mvproceedings","refererence"]},target:{type:["bill","book","broadcast","chapter","dataset","entry","entry-dictionary","entry-encyclopedia","figure","graphic","interview","legislation","legal_case","manuscript","map","motion_picture","musical_score","pamphlet","post","post-weblog","personal_communication","review","review-book","song","speech","thesis","treaty","webpage"]}}},{source:"series",target:"collection-title"},{source:"booktitle",target:"container-title",when:{target:{type:["chapter","paper-conference"]}}},{source:"journal",target:"container-title",when:{source:{[or]:"article"},target:{type:["article","article-newspaper","article-journal","article-magazine"]}}},{source:"edition",target:"edition"},{source:"editor",target:"editor",convert:mr.NAMES},{source:ar,target:["id","citation-key","author","issued","year-suffix","title"],convert:mr.LABEL},{source:"number",target:"issue",when:{source:{[or]:["article","periodical","inproceedings"]},target:{issue:e=>"number"==typeof e||"string"==typeof e&&e.match(/\d+/),type:["article","article-journal","article-newspaper","article-magazine","paper-conference","periodical"]}}},{source:["year","month","day"],target:"issued",convert:mr.YEAR_MONTH},{source:"note",target:"note"},{source:"number",target:"number",when:{source:{[or]:["patent","report","techreport"]},target:{type:["patent","report"]}}},{source:"pages",target:"page",convert:mr.PAGES},{source:"publisher",target:"publisher",convert:mr.PICK,when:{target:{type:["article","article-journal","article-magazine","article-newspaper","bill","book","broadcast","chapter","classic","collection","dataset","document","entry","entry-dictionary","entry-encyclopedia","event","figure","graphic","hearing","interview","legal_case","legislation","map","motion_picture","musical_score","pamphlet","patent","performance","periodical","personal_communication","post","post-weblog","regulation","review","review-book","software","song","speech","standard","treaty","webpage"]}}},{source:"organization",target:"publisher",convert:mr.PICK,when:{source:{publisher:!1},target:{type:"paper-conference"}}},{source:"institution",target:"publisher",convert:mr.PICK,when:{source:{publisher:!1,organization:!1},target:{type:"report"}}},{source:"school",target:"publisher",convert:mr.PICK,when:{source:{institution:!1,organization:!1,publisher:!1},target:{type:"thesis"}}},{source:"howpublished",target:"publisher",convert:mr.PICK,when:{source:{howpublished:e=>e&&!e.startsWith("http"),publisher:!1,organization:!1,institution:!1,school:!1},target:{type:"manuscript"}}},{source:"title",target:"title"},{source:[or,"type"],target:["type","genre"],convert:{toTarget(e,t){const r=Xt.source[e]||"document";return t?[r,t]:"mastersthesis"===e?[r,"Master's thesis"]:"phdthesis"===e?[r,"PhD thesis"]:[r]},toSource(e,t){const r=Xt.target[e]||"misc";return/^(master'?s|diploma) thesis$/i.test(t)?["mastersthesis"]:/^(phd|doctoral) thesis$/i.test(t)?["phdthesis"]:[r,t]}}},{source:or,when:{target:{type:!1}},convert:{toSource:()=>"misc"}},{source:"howpublished",target:"URL",convert:mr.HOW_PUBLISHED,when:{target:{publisher:!1}}},{source:"volume",target:"volume"}]);function fr(e,t){if(null==e)return{};var r,i,o=function(e,t){if(null==e)return{};var r,i,o={},a=Object.keys(e);for(i=0;i=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function dr(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function gr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function br(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yr(e,t){if(e.crossref in t){const r=t[e.crossref].properties;return r===e?e:Object.assign({},yr(r,t),e)}return e}function vr(e,t){const r={};for(const t of e)r[t.label]=t;return e.map(({type:e,label:i,properties:o})=>t.convertToTarget(function(e){for(var t=1;t{const r=t.convertToSource(e),{[or]:i,[ar]:o}=r;return{type:i,label:o,properties:fr(r,[or,ar].map(dr))}})}function wr(e){const t=e.toUpperCase(),r=e.toLowerCase();for(let i=0;i1;){const{value:r,hyphenated:i}=e.shift();t+=r+(i?"-":" ")}const r=t+e[0].value;return r[0]&&r}function Tr(e){if(e[0][0].label){const t={};for(const[{value:r,label:i}]of e)t[i]=r;return t}const t={},[r,i,o]=function(e,t=!0){const r=[],i=[];if(t)for(;e.length>1&&!1!==e[0].upperCase;){for(r.push(...i),i.length=0;e.length>1&&!1!==e[0].upperCase&&!e[0].hyphenated;)r.push(e.shift());for(;e.length>0&&!1!==e[0].upperCase&&e[0].hyphenated;)i.push(e.shift())}const o=[],a=[];for(;e.length>1;){for(o.push(...a),a.length=0;e.length>1&&!1===e[0].upperCase;)o.push(e.shift());for(;e.length>0&&!1!==e[0].upperCase;)a.push(e.shift())}return i.length&&a.unshift(...i),e.length&&a.push(e[0]),[kr(r),kr(o),kr(a)]}(e[0],1===e.length);return o&&(t.family=o),i&&(t.prefix=i),3===e.length?(t.given=kr(e[2]),t.suffix=kr(e[1])):2===e.length?t.given=kr(e[1]):r&&(t.given=r),t}const Er={command:{match:/\\(?:[a-zA-Z]+|.) */,type:kt.keywords({commandBegin:"\\begin",commandEnd:"\\end"}),value:e=>e.slice(1).trim()},lbrace:{match:"{",push:"bracedLiteral"},mathShift:{match:"$",push:"mathLiteral"},whitespace:{match:/[\s]+|~/,lineBreaks:!0,value:e=>"~"===e?" ":" "}},jr=kt.states({stringLiteral:B({},Er,{text:/[^{$}\s~\\]+/}),namesLiteral:B({and:/\s+[aA][nN][dD]\s+/,comma:",",hyphen:"-",equals:"="},Er,{text:/[^{$}\s~\\,=-]+/}),listLiteral:B({and:/\s+and\s+/},Er,{text:/[^{$}\s~\\]+/}),separatedLiteral:B({comma:","},Er,{text:/[^{$}\s~\\,]+/}),bracedLiteral:B({},Er,{rbrace:{match:"}",pop:!0},text:/[^{$}\s~\\]+/}),mathLiteral:B({},Er,{mathShift:{match:"$",pop:!0},script:/[\^_]/,text:/[^{$}\s~\\^_]+/})});function Sr(e,t){return t in Ct?e&&Ct[t].join(e):e}const Or=new xe({String(){let e="";for(;!this.matchEndOfFile();)e+=this.consumeRule("Text");return e},StringNames(){const e=[];for(;;){if(this.consumeToken("whitespace",!0),e.push(this.consumeRule("Name")),this.consumeToken("whitespace",!0),this.matchEndOfFile())return e;this.consumeToken("and")}},Name(){const e=[];for(;;){if(e.push(this.consumeRule("NamePiece")),this.matchEndOfFile()||this.matchToken("and"))return Tr(e);this.consumeToken("comma"),this.consumeToken("whitespace",!0)}},NamePiece(){const e=[];for(;;){const t=this.consumeRule("NameToken");if(t.label)return t.label=kr([...e,{value:t.label}]),[t];if(e.push(t),this.matchEndOfFile()||this.matchToken("and")||this.matchToken("comma"))return e;for(;this.matchToken("hyphen")||this.matchToken("whitespace");)this.consumeToken()}},NameToken(){let e=null,t="";for(;;)if(null===e&&this.matchToken("text")){const r=this.consumeToken().value;t+=r,e=wr(r)}else{if(this.matchEndOfFile()||this.matchToken("and")||this.matchToken("comma")||this.matchToken("whitespace"))return{value:t,upperCase:e};if(this.matchToken("hyphen"))return{value:t,upperCase:e,hyphenated:!0};if(this.matchToken("equals")){this.consumeToken("equals");const e=this.consumeRule("NamePiece");return e[0].label&&(t+="="+e[0].label),{value:kr(e),label:t}}t+=this.consumeRule("Text")}},StringList(){const e=[];for(;!this.matchEndOfFile();){let t="";for(;!this.matchEndOfFile()&&!this.matchToken("and");)t+=this.consumeRule("Text");e.push(t),this.consumeToken("and",!0)}return 1===e.length?e[0]:e},StringSeparated(){const e=[];for(;!this.matchEndOfFile();){let t="";for(;!this.matchEndOfFile()&&!this.matchToken("comma");)t+=this.consumeRule("Text");e.push(t.trim()),this.consumeToken("comma",!0),this.consumeToken("whitespace",!0)}return e},StringVerbatim(){let e="";for(;!this.matchEndOfFile();)e+=this.consumeToken().text;return e},StringUri(){const e=this.consumeRule("StringVerbatim");try{return decodeURI(e)===e?encodeURI(e):e}catch(t){return encodeURI(e)}},StringTitleCase(){this.state.sentenceCase=!0;let e="";for(;!this.matchEndOfFile();)e+=this.consumeRule("Text");return e},BracketString(){var e;let t="";this.consumeToken("lbrace");const r=this.state.sentenceCase;for(this.state.sentenceCase=r&&this.matchToken("command"),(e=this.state).partlyLowercase&&(e.partlyLowercase=this.state.sentenceCase);!this.matchToken("rbrace");)t+=this.consumeRule("Text");const i=r&&!this.state.sentenceCase&&this.state.partlyLowercase;return this.state.sentenceCase=r,this.consumeToken("rbrace"),i?Sr(t,"nocase"):t},MathString(){let e="";for(this.consumeToken("mathShift");!this.matchToken("mathShift");)if(this.matchToken("script")){const t=this.consumeToken("script").value,r=this.consumeRule("Text").split("");r.every(e=>e in Lt[t])?e+=r.map(e=>Lt[t][e]).join(""):e+=Ct[Pt[t]].join(r.join(""))}else{if(this.matchToken("command")){const t=this.token.value;if(t in Pt){this.consumeToken("command"),e+=Sr(this.consumeRule("BracketString"),Pt[t]);continue}}e+=this.consumeRule("Text")}return this.consumeToken("mathShift"),e},Text(){if(this.matchToken("lbrace"))return this.consumeRule("BracketString");if(this.matchToken("mathShift"))return this.consumeRule("MathString");if(this.matchToken("whitespace"))return this.consumeToken("whitespace").value;if(this.matchToken("commandBegin"))return this.consumeRule("EnclosedEnv");if(this.matchToken("command"))return this.consumeRule("Command");const e=this.consumeToken("text").value.replace(It,e=>Bt[e]),t=this.state.afterPunctuation;var r;if(this.state.afterPunctuation=/[?!.:]$/.test(e),!this.state.sentenceCase)return(r=this.state).partlyLowercase||(r.partlyLowercase=e===e.toLowerCase()&&e!==e.toUpperCase()),e;const[i,...o]=e,a=o.join(""),n=a.toLowerCase();return a!==n?e:t?i+n:e.toLowerCase()},Command(){const e=this.consumeToken("command"),t=e.value;if(t in _t)return Sr(this.consumeRule("Env"),_t[t]);if(t in At)return Sr(this.consumeRule("BracketString"),At[t]);if(t in St)return St[t];if(t in jt&&!this.matchEndOfFile()){const e=this.consumeRule("Text");return(e[0]+jt[t]).normalize("NFC")+e.slice(1)}if(t in Rt){const e=Rt[t],r=[];let i=e.length;for(;i-- >0;)this.consumeToken("whitespace",!0),r.push(this.consumeRule("BracketString"));return e(...r)}return/^[&%$#_{}]$/.test(t)?e.text.slice(1):e.text},Env(){let e="";for(;!this.matchEndOfFile()&&!this.matchToken("rbrace");)e+=this.consumeRule("Text");return e},EnclosedEnv(){this.consumeToken("commandBegin");const e=this.consumeRule("BracketString");let t="";for(;!this.matchToken("commandEnd");)t+=this.consumeRule("Text");const r=this.consumeToken("commandEnd"),i=this.consumeRule("BracketString");if(e!==i)throw new SyntaxError(this.lexer.formatError(r,`environment started with "${e}", ended with "${i}"`));return Sr(t,_t[e])}},{sentenceCase:!1,partlyLowercase:!1,afterPunctuation:!0});function _r(e){return zt.includes(e.toLowerCase())}function Ar(e){if("name"===e[1])return"namesLiteral";switch(e[0]){case"list":return"listLiteral";case"separated":return"separatedLiteral";default:return"stringLiteral"}}function Cr(e,t,r=[]){const i=Et[t]||[];return Or.parse(jr.reset(e,{state:Ar(i),line:0,col:0}),function(e,t){if("name"===e[1])return"list"===e[0]?"StringNames":"Name";if("title"===e[1]){const e=Yt.parse.sentenceCase;return"always"===e||"english"===e&&function(e){return Array.isArray(e)?e.every(_r):_r(e)}(t)?"StringTitleCase":"String"}switch("field"===e[0]?e[1]:e[0]){case"list":return"StringList";case"separated":return"StringSeparated";case"verbatim":return"StringVerbatim";case"uri":return"StringUri";default:return"String"}}(i,r))}function Rr(e,t){const r=[];for(const{type:i,label:o,properties:a}of e)if(i in t){const e=[];for(const r of t[i])Array.isArray(r)&&!r.some(e=>e in a)?e.push(r.join("/")):"string"!=typeof r||r in a||e.push(r);e.length&&r.push([o,`missing fields: ${e.join(", ")}`])}else r.push([o,`invalid type: "${i}"`]);if(r.length)throw new RangeError(["Invalid entries:"].concat(r.map(([e,t])=>` - ${e} has ${t}`)).join("\n"))}function Ir(e){const t={};"language"in e.properties&&(t.language=Cr(e.properties.language,"language"));for(const r in e.properties){const i=e.properties[r];""!==i&&(t[r]=Cr(i+"",r,t.language))}return B({},e,{properties:t})}function Br(e){return Yt.parse.strict&&Rr(e,Tt.biblatex),function(e){return vr(e,pr)}(e.map(Ir))}function Pr(e){return Yt.parse.strict&&Rr(e,Tt.bibtex),function(e){return vr(e,hr)}(e.map(Ir))}const Lr={"@biblatex/text":{parse:Ft,parseType:{dataType:"String",predicate:/@\s{0,5}[A-Za-z]{1,13}\s{0,5}\{\s{0,5}[^@{}"=,\\\s]{0,100}\s{0,5},[\s\S]*\}/}},"@biblatex/entry+object":{parse:e=>Br([e]),parseType:{dataType:"SimpleObject",propertyConstraint:{props:["type","label","properties"]}}},"@biblatex/entries+list":{parse:Br,parseType:{elementConstraint:"@biblatex/entry+object"}},"@bibtex/text":{parse:Ft,outputs:"@bibtex/entries+list"},"@bibtex/entry+object":{parse:e=>Pr([e])},"@bibtex/entries+list":{parse:Pr},"@bibtxt/text":{parse:e=>e.trim().split(Ht).map(Kt),parseType:{dataType:"String",predicate:/^\s*(\[(?!\s*[{[]).*?\]\s*(\n\s*[^[]((?!:)\S)+\s*:\s*.+?\s*)*\s*)+$/}}},zr={};for(const e in St)zr[St[e]]=e;for(const e in jt)zr[jt[e]]=e;for(const e in Bt)zr[Bt[e]]=e;const Ur=/[^a-zA-Z0-9\s!"#%&'()*+,\-./:;=?@[\]{}\u0300-\u0308\u030a-\u030c\u0332\u0323\u0327\u0328\u0361\u0326]/g,Dr=/.[\u0300-\u0308\u030a-\u030c\u0332\u0323\u0327\u0328\u0361\u0326]+/g,$r={separated:",",list:" and "},Nr={i:"\\textit{",b:"\\textbf{",sc:"\\textsc{",sup:"\\textsuperscript{",sub:"\\textsubscript{",'span style="font-variant:small-caps;"':"\\textsc{",'span class="nocase"':"{"};function Mr(e){return e.normalize("NFKD").replace(Ur,e=>e in zr?zr[e]in Bt?zr[e]:`\\${zr[e]}{}`:"").replace(Dr,e=>Array.from(e).reduce((e,t)=>`{\\${zr[t]} ${e}}`))}function qr(e){const t=[];let r=e.split(/<(\/?(?:i|b|sc|sup|sub|span)|span .*?)>/g);return r=r.map((e,r)=>r%2==0?Mr(e):e in Nr?(t.push("/"+e.split(" ")[0]),Nr[e]):e===t[t.length-1]?(t.pop(),"}"):""),r.join("")}function Fr(e,t){switch(t){case"title":return qr(e).split(/(:\s*)/).map((e,t)=>t%2?e:e.replace(/(?!^)\b[a-z]*[A-Z].*?\b/g,"{$&}")).join("");case"literal":return qr(e.toString());case"name":return function(e){if(e.family&&!e.prefix&&!e.given&!e.suffix)return e.family.includes($r.list)?e.family:`{${e.family}}`;const t=[""];return e.prefix&&e.family&&(t[0]+=e.prefix+" "),e.family&&(t[0]+=e.family),e.suffix?(t.push(e.suffix),t.push(e.given||"")):t.push(e.given),Mr(t.join(", ").trim())}(e);case"verbatim":case"uri":return e.toString();default:return Mr(e.toString())}}function Hr(e,t){if(!(e in Et))return Fr(t,"verbatim");const[r,i]=Et[e];return r in $r?function(e,t,r){const i=$r[r];return e.map(e=>{const r=Fr(e,t);return r.includes(i)?`{${r}}`:r}).join(i)}(t,i,r):Fr(t,i)}function Gr({type:e,label:t,properties:r}){const i={};for(const e in r)i[e]=Hr(e,r[e]);return{type:e,label:t,properties:i}}function Jr(e){return function(e){return xr(e,hr)}(e).map(Gr)}function Vr(e,t){const r=e.map(e=>function({type:e,label:t,properties:r},i){const o=Object.entries(r).map(([e,t])=>i.listItem.join(`${e} = {${t}},`));return i.entry.join(`@${e}{${t},${i.list.join(o.join(""))}}`)}(e,t)).join("");return t.bibliographyContainer.join(r)}const Kr=function(e,t){return function(r,i={}){const{type:o,format:a=o||"text"}=i;if(r=e(r),"object"===a)return r;if(Ye(a))return t(r,Ze(a),i);throw new RangeError(`Output dictionary "${a}" not available`)}};var Wr={bibtex:Kr(Jr,Vr),biblatex:Kr(function(e){return function(e){return xr(e,pr)}(e).map(Gr)},Vr),bibtxt:Kr(Jr,function(e,t){const r=e.map(e=>function({type:e,label:t,properties:r},i){const o=Object.entries(r).concat([["type",e]]).map(([e,t])=>i.listItem.join(`${e}: ${t}`));return i.entry.join(`[${t}]${i.list.join(o.join(""))}`)}(e,t)).join("\n");return t.bibliographyContainer.join(r)})};ot("@bibtex",{input:Lr,output:Wr,config:Yt});const Xr=new ve({"en-US":'Andrew DunningSebastian KarcherRintze M. ZelleDenis MeierBrenton M. WiernikThis work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License2015-10-10T23:31:02+00:00advance online publicationalbumaudio recordingfilmhenceforthloc. cit.no placen.p.no publishern.p.onop. cit.original work publishedpersonal communicationpodcastpodcast episodepreprintradio broadcastradio seriesradio series episodespecial issuespecial sectiontelevision broadcasttelevision seriestelevision series episodevideoworking paperaccessedandand othersanonymousanon.atavailable atbycircac.citededitioneditionsed.et al.forthcomingfromibid.inin pressinternetinterviewletterno daten.d.onlinepresented at thereferencereferencesref.refs.retrievedscaleversionpreprintjournal articlemagazine articlenewspaper articlebillbookbroadcastbook chapterclassiccollectiondatasetdocumententrydictionary entryencyclopedia entryeventgraphichearinginterviewlegal caselegislationmanuscriptmapvideo recordingmusical scorepamphletconference paperpatentperformanceperiodicalpersonal communicationpostblog postregulationreportreviewbook reviewsoftwareaudio recordingpresentationstandardthesistreatywebpagejournal art.mag. art.newspaper art.bk.bk. chap.doc.graph.interv.MSvideo rec.rep.rev.bk. rev.audio rec.ADBCBCECE:,;thstndrdthththfirstsecondthirdfourthfifthsixthseventheighthninthtenthactactsappendixappendicesarticlearticlescanoncanonslocationlocationsequationequationsrulerulesscenescenestabletablestitletitlesbookbookschapterchapterscolumncolumnsfigurefiguresfoliofoliosnumbernumberslinelinesnotenotesopusoperapagepagespagepagesparagraphparagraphspartpartssectionsectionssub verbosub verbisverseversesvolumevolumesapp.apps.art.arts.loc.locs.eq.eqs.r.rr.sc.scs.tbl.tbls.tit.tits.bk.bks.chap.chaps.col.cols.fig.figs.fol.fols.no.nos.l.ll.n.nn.op.opp.p.pp.p.pp.para.paras.pt.pts.sec.secs.s.v.s.vv.v.vv.vol.vols.¶¶§§§chairchairscompilercompilerscontributorcontributorscuratorcuratorsexecutive producerexecutive producersguestguestshosthostsnarratornarratorsorganizerorganizersperformerperformersproducerproducerswriterwritersseries creatorseries creatorsdirectordirectorseditoreditorseditoreditorsillustratorillustratorstranslatortranslatorseditor & translatoreditors & translatorscomp.comps.contrib.contribs.cur.curs.exec. prod.exec. prods.narr.narrs.org.orgs.perf.perfs.prod.prods.writ.writs.cre.cres.dir.dirs.ed.eds.ed.eds.ill.ills.tran.trans.ed. & tran.eds. & trans.chaired bycompiled bywithcurated byexecutive produced bywith guesthosted bynarrated byorganized byperformed byproduced bywritten bycreated bybydirected byedited byedited byillustrated byinterview bytobytranslated byedited & translated bycomp. byw.cur. byexec. prod. byw. guesthosted bynarr. byorg. byperf. byprod. bywrit. bycre. bydir. byed. byed. byillus. bytrans. byed. & trans. byJanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecemberJan.Feb.Mar.Apr.MayJun.Jul.Aug.Sep.Oct.Nov.Dec.SpringSummerAutumnWinter'}),Yr=new ve({apa:''}),Zr=Symbol.for("proxied"),Qr=function(e){const t=function(t,r){if(t.sys.wrapBibliographyEntry){const[e,i]=t.sys.wrapBibliographyEntry(this.system_id);r=[e,r,i].join("")}return e.call(this,t,r)};return t[Zr]=!0,t};for(const e in o.Output.Formats){const t=o.Output.Formats[e]["@bibliography/entry"];t&&!t[Zr]&&(o.Output.Formats[e]["@bibliography/entry"]=Qr(t))}function ei(e){if(Xr.has(e))return Xr.get(e);const t=e.replace("-","_");return Xr.has(t)?Xr.get(t):{}}const ti={},ri=function(e,t,r,i){if(!o.Output.Formats[i]||!o.Output.Formats[i]["@bibliography/entry"])throw new TypeError(`Cannot find format '${i}'`);const a=e.reduce((e,t)=>(e[t.id]=t,e),{}),n=Yr.get(Yr.has(t)?t:"apa"),s=function(e,t,r,i,a){const n=`${e}|${t}`;let s;return ti[n]instanceof o.Engine?(s=ti[n],s.sys.retrieveItem=i,s.sys.wrapBibliographyEntry=void 0,s.updateItems([])):s=ti[n]=new o.Engine({retrieveLocale:a,retrieveItem:i},r,t,!0),s}(t,r=Xr.has(r)?r:void 0,n,function(e){if(Object.prototype.hasOwnProperty.call(a,e))return a[e];throw new Error(`Cannot find entry with id '${e}'`)},ei);return s.setOutputFormat(i),s},ii=(e,t)=>"function"==typeof t?t(e):t||"";function oi(e){return"object"==typeof e?e:{id:e}}function ai(e){return e.citationItems?e:{citationItems:[].concat(e).map(oi),properties:{noteIndex:0}}}function ni(e){return e?e.map(ai):[]}ot("@csl",{output:{bibliography:function(e,t={}){const{template:r="apa",lang:i,format:o="text",nosort:a=!1}=t,n=t.entry?[].concat(t.entry):e.map(({id:e})=>e);e=J(e);const s=ri(e,r,i,o),l=s.updateItems(n,a);if(t.append||t.prepend){const r=e.reduce((e,t)=>(e[t.id]=t,e),{});s.sys.wrapBibliographyEntry=function(e){const i=r[e];return[ii(i,t.prepend),ii(i,t.append)]}}const c=s.makeBibliography(),[{bibstart:m,bibend:u},p]=c,h=p.map((e,t)=>e.replace(/^\s*<[a-z]+/i,`$& data-csl-entry-id="${l[t]}"`));return t.asEntryArray?h.map((e,t)=>[l[t],e]):m+h.join("")+u},citation:function(e,t={}){const{template:r="apa",lang:i,format:o="text"}=t,a=e.map(({id:e})=>e),n=t.entry?t.entry:a;e=J(e);const s=ri(e,r,i,o),l=ni(t.citationsPre),c=ai(n),m=ni(t.citationsPost);return s.rebuildProcessorState([...l,c,...m],o,[])[l.length][2]}},config:{engine:ri,locales:Xr,templates:Yr}});const si="tag:yaml.org,2002:timestamp",li=a.DEFAULT_SCHEMA.compiledTypeMap.scalar[si],ci=new a.Type(si,{kind:"scalar",resolve:li.resolve,construct:li.construct,instanceOf:Date,represent:e=>e.toISOString().split("T")[0]}),mi=a.DEFAULT_SCHEMA.extend({implicit:[ci],explicit:[]});ot("@else",{input:{"@else/yaml":{parseType:{dataType:"String",tokenList:{split:/\n(\s{2})*(-\s)?/,token:/^[\w-]*: /,every:!1}},parse:e=>a.load(e,{json:!0})}},output:{yaml:e=>a.dump(e,{schema:mi})}});const ui={art:"graphic",article:"article-journal",audiovisual:"motion_picture",bill:"bill",blog:"post-weblog",book:"book",catalogue:"collection",conference:"event","conference-paper":"paper-conference",data:"dataset",database:"dataset",dictionary:"entry-dictionary","edited-work":"document",encyclopedia:"entry-encyclopedia","film-broadcast":"broadcast",generic:"document","government-document":"regulation",grant:"document",hearing:"hearing","historical-work":"classic","legal-case":"legal_case","legal-rule":"legislation","magazine-article":"article-magazine",manual:"report",map:"map",multimedia:"motion_picture",music:"musical_score","newspaper-article":"article-newspaper",pamphlet:"pamphlet",patent:"patent","personal-communication":"personal_communication",proceedings:"book",report:"report",serial:"periodical",slides:"speech",software:"software","software-code":"software","software-container":"software","software-executable":"software","software-virtual-machine":"software","sound-recording":"song",standard:"standard",statute:"legislation",thesis:"thesis",unpublished:"article",video:"motion_picture",website:"webpage"},pi={article:"article","article-journal":"article","article-magazine":"magazine-article","article-newspaper":"newspaper-article",bill:"bill",book:"book",broadcast:"film-broadcast",chapter:"generic",classic:"historical-work",collection:"catalogue",dataset:"data",document:"generic",entry:"generic","entry-dictionary":"dictionary","entry-encyclopedia":"encyclopedia",event:"conference",figure:"generic",graphic:"art",hearing:"hearing",interview:"sound-recording",legal_case:"legal-case",legislation:"statute",manuscript:"historical-work",map:"map",motion_picture:"film-broadcast",musical_score:"music",pamphlet:"pamphlet","paper-conference":"conference-paper",patent:"patent",performance:"generic",periodical:"serial",personal_communication:"personal-communication",post:"serial","post-weblog":"blog",regulation:"government-document",report:"report",review:"generic","review-book":"generic",software:"software",song:"sound-recording",speech:"slides",standard:"standard",thesis:"thesis",treaty:"generic",webpage:"website"},hi=new ke([{source:"family-names",target:"family"},{source:"given-names",target:"given"},{source:"name-particle",target:"non-dropping-particle"},{source:"name-suffix",target:"suffix"},{source:"name",target:"literal"},{source:"orcid",target:"_orcid"}]),fi={names:{toTarget:e=>e.map(hi.convertToTarget),toSource:e=>e.map(hi.convertToSource)},publisher:{toTarget:({name:e,city:t,region:r,country:i})=>[e,[t,r,i].filter(Boolean).join(", ")||void 0],toSource(e,t){const r={name:e};if(t){const e=t.split(", ");r.country=e.pop(),2===e.length&&(r.region=e.pop()),1===e.length&&(r.city=e.pop())}return r}},date:{toTarget:e=>e instanceof Date?r(e.toISOString()):r(new Date(e).toISOString()),toSource(e){if(e.raw)return e.raw;const[t,r,i]=e["date-parts"][0];return i?new Date(Date.UTC(t,r-1,i)):r?new Date(Date.UTC(t,r-1)):new Date(Date.UTC(t))}}},di=["abstract",{source:"authors",target:"author",convert:fi.names},{source:"date-released",target:"issued",when:{target:{type:"software"}},convert:fi.date},{source:"doi",target:"DOI"},{source:"identifiers",target:["DOI","ISBN","ISSN","PMCID","PMID","URL"],convert:{toTarget(e){const t=Array(6).fill(void 0);for(const{type:r,value:i}of e)this.doi||"doi"!==r||(t[0]=i),this.url||"url"!==r||(t[5]=i),"other"===r&&i.startsWith("urn:isbn:")&&(t[1]=i.slice(9)),"other"===r&&i.startsWith("urn:issn:")&&(t[2]=i.slice(9)),"other"===r&&i.startsWith("pmcid:")&&(t[3]=i.slice(6)),"other"===r&&i.startsWith("pmid:")&&(t[4]=i.slice(5));return t},toSource:(e,t,r,i,o,a)=>[e&&{type:"doi",value:e},a&&{type:"url",value:a},t&&{type:"other",value:`urn:isbn:${t}`},r&&{type:"other",value:`urn:issn:${r}`},i&&{type:"other",value:`pmcid:${i}`},o&&{type:"other",value:`pmid:${o}`}].filter(Boolean)}},{source:"keywords",target:"keyword",convert:{toTarget:e=>e.join(","),toSource:e=>e.split(/,\s*/g)}},{source:"title",target:"title",when:{source:{term:!1,entry:!1},target:{type:e=>!["entry","entry-dictionary","entry-encyclopedia"].includes(e)}}},{source:"title",target:"container-title",when:{source:{entry:!0,journal:!1},target:{type:["entry"]}}},{source:"title",target:"container-title",when:{source:{term:!0,journal:!1},target:{type:["entry-dictionary","entry-encyclopedia"]}}},{source:"url",target:"URL"},"version"],gi=[{source:"type",target:"type",convert:{toSource:e=>"dataset"===e?"dataset":"software",toTarget:e=>"dataset"===e?"dataset":"software"}},...di],bi=[...di,{source:"abbreviation",target:"title-short"},{source:"abbreviation",target:"shortTitle"},"collection-title",{source:"recipients",target:"recipient",convert:fi.names},{source:"senders",target:"authors",convert:fi.names},{source:"conference",target:["event-title","event-date","event-place","event"],convert:{toSource(e,t,r,i){const o={name:e||i};return r&&(o.location=r),t&&(o["date-start"]=fi.date.toSource(t),t["date-parts"]&&2===t["date-parts"].length&&(o["date-end"]=fi.date.toSource({"date-parts":[t["date-parts"][1]]}))),o},toTarget:e=>[e.name,r(e["date-start"].toISOString(),e["date-end"].toISOString()),e.location]}},{source:"database",target:"source"},{source:"date-accessed",target:"accessed",convert:fi.date},{source:"date-downloaded",target:"accessed",convert:fi.date,when:{source:{"date-accessed":!1},target:!1}},{source:"date-published",target:"issued",convert:fi.date,when:{source:{"date-released":!1},target(){return"book"!==this.type||!this.version}}},{source:["year","month"],target:"issued",when:{source:{"date-published":!1,"date-released":!1,year:!0}},convert:{toTarget:(e,t)=>({"date-parts":[t?[e,t]:[e]]}),toSource(e){const[t,r]=e["date-parts"][0];return[t,r]}}},{source:"year-original",target:"original-date",convert:{toTarget:e=>({"date-parts":[[e]]}),toSource:e=>e["date-parts"][0][0]}},"edition",{source:"editors",target:"editor",convert:fi.names},{source:"editors-series",target:"collection-editor",convert:fi.names},{source:"entry",target:"title",when:{source:{term:!1},target:{type:"entry"}}},{source:"term",target:"title",when:{target:{type:["entry-dictionary","entry-encyclopedia"]}}},{source:"format",target:"dimensions"},"medium",{source:"data-type",target:"genre",when:{target:{type:e=>"thesis"!==e}}},{source:"thesis-type",target:"genre",when:{source:{"data-type":!1},target:{type:"thesis"}}},{source:"isbn",target:"ISBN"},{source:"issn",target:"ISSN"},{source:"pmcid",target:"PMCID"},"issue",{source:"journal",target:"container-title"},{source:"volume-title",target:"volume-title"},{source:"issue-title",target:"volume-title",when:{source:{"volume-title":!1},target:!1}},{source:"languages",target:"language",when:{target:!0,source:{language:e=>/[a-z]{2,3}/.test(e)}},convert:{toSource:e=>[e],toTarget:e=>e[0]}},{source:"location",target:["archive","archive-place"],convert:fi.publisher},{source:"notes",target:"note",when:{source:{scope:!1}}},{source:"scope",target:"note",when:{target:!1}},"number",{source:"patent-states",target:"jurisdiction",when:{target:!1},convert:{toTarget:e=>e.join(", ")}},{source:["institution","department"],target:["publisher","publisher-place"],when:{source:{publisher:!1},target:{type:"thesis"}},convert:{toTarget(e,t){const[r,i]=fi.publisher.toTarget(e);return[t?`${t}, ${r}`:r,i]},toSource:(e,t)=>[fi.publisher.toSource(e,t)]}},{source:"publisher",target:["publisher","publisher-place"],when:{target:{type:e=>"thesis"!==e}},convert:fi.publisher},"section",{source:"status",target:"status",when:{source:!0,target:{status:["in-preparation","abstract","submitted","in-press","advance-online","preprint"]}}},{source:"start",target:"page-first",when:{target:{page:!1}}},{source:["start","end"],target:"page",convert:{toTarget:(e,t)=>t?`${e}-${t}`:e,toSource(e){const[t,r]=e.split("-");return r?[t,r]:[t]}}},{source:"pages",target:"number-of-pages"},{source:"translators",target:"translator",convert:fi.names},{source:"type",target:"type",convert:{toTarget:e=>ui[e]||"document",toSource(e){return"book"===e&&this["event-title"]?"proceedings":pi[e]||"generic"}}},"volume",{source:"number-volumes",target:"number-of-volumes"}],yi=new ke(gi),vi=new ke(bi),xi="1.2.0";function wi(e){"DOI"in e?e.id=e.DOI:"URL"in e&&(e.id=e.URL.replace("http://","").replace("https://",""))}function ki(e,t){if(!(this instanceof ki))return new ki(e,t);const r=new We(e,t);this._options=r._options,this.log=r.log,this.data=r.data}ot("@cff",{input:{"@cff/object":{parseType:{dataType:"SimpleObject",propertyConstraint:{props:"cff-version"}},parse:function(e){const t=yi.convertToTarget(e);e["cff-version"]<="1.1.0"&&(t.type=ui.software),t._cff_mainReference=!0,wi(t);const r=[t];if(e["preferred-citation"]){const t=vi.convertToTarget(e["preferred-citation"]);wi(t),r.push(t)}return Array.isArray(e.references)&&r.push(...e.references.map(vi.convertToTarget)),r}}},output:{cff(e,t={}){const r=function(e,t={}){e=e.slice();const{main:r,preferred:i,cffVersion:o=xi,message:a="Please cite the following works when using this software."}=t;let n;const s=e.findIndex(e=>i&&e.id===i);o>="1.2.0"&&s>-1&&(n=vi.convertToSource(...e.splice(s,1)));let l=e.findIndex(e=>r?e.id===r:e._cff_mainReference);l=l>-1?l:0;const c=e[l]?yi.convertToSource(...e.splice(l,1)):{};c&&o<"1.2.0"&&delete c.type;const m=B({"cff-version":o,message:a},c);return n&&(m["preferred-citation"]=n),e.length&&(m.references=e.map(vi.convertToSource)),m}(e,t);return"object"===t.type?r:Ge("yaml",r)}}}),ki.plugins=function e(t){const r={};for(const i in t)r[i]="object"==typeof t[i]?e(t[i]):t[i];return r}(at);export{ki as default}; //# sourceMappingURL=cite.mjs.map