@talisdev/bibliographic-resource-parsers-lib 5.35.0 → 5.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.BibliographicResourceParsersLib={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);Object.freeze({status:`aborted`});function n(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var r=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},i=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},a={};function o(e){return e&&Object.assign(a,e),a}function s(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function c(e,t){return typeof t==`bigint`?t.toString():t}function l(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function u(e){return e==null}function d(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function f(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var p=Symbol(`evaluating`);function m(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==p)return r===void 0&&(r=p,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function h(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function g(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function _(e){return JSON.stringify(e)}function v(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var y=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ee(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var te=l(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ne(e){if(ee(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(ee(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function re(e){return ne(e)?{...e}:Array.isArray(e)?[...e]:e}var ie=new Set([`string`,`number`,`symbol`]);function ae(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function oe(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function b(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function se(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ce={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function le(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return oe(e,g(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return h(this,`shape`,e),e},checks:[]}))}function ue(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return oe(e,g(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return h(this,`shape`,r),r},checks:[]}))}function de(e,t){if(!ne(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return oe(e,g(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return h(this,`shape`,n),n}}))}function fe(e,t){if(!ne(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return oe(e,g(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return h(this,`shape`,n),n}}))}function pe(e,t){return oe(e,g(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return h(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function me(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return oe(t,g(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return h(this,`shape`,i),i},checks:[]}))}function he(e,t,n){return oe(t,g(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return h(this,`shape`,i),i}}))}function ge(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function _e(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ve(e){return typeof e==`string`?e:e?.message}function ye(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=ve(e.inst?._zod.def?.error?.(e))??ve(t?.error?.(e))??ve(n.customError?.(e))??ve(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function be(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function xe(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Se=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,c,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Ce=n(`$ZodError`,Se),we=n(`$ZodError`,Se,{Parent:Error});function Te(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ee(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var De=e=>(t,n,i,a)=>{let s=i?Object.assign(i,{async:!1}):{async:!1},c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new r;if(c.issues.length){let t=new(a?.Err??e)(c.issues.map(e=>ye(e,s,o())));throw y(t,a?.callee),t}return c.value},Oe=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){let t=new(i?.Err??e)(s.issues.map(e=>ye(e,a,o())));throw y(t,i?.callee),t}return s.value},ke=e=>(t,n,i)=>{let a=i?{...i,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise)throw new r;return s.issues.length?{success:!1,error:new(e??Ce)(s.issues.map(e=>ye(e,a,o())))}:{success:!0,data:s.value}},Ae=ke(we),je=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>ye(e,i,o())))}:{success:!0,data:a.value}},Me=je(we),Ne=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return De(e)(t,n,i)},Pe=e=>(t,n,r)=>De(e)(t,n,r),Fe=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Oe(e)(t,n,i)},Ie=e=>async(t,n,r)=>Oe(e)(t,n,r),Le=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ke(e)(t,n,i)},Re=e=>(t,n,r)=>ke(e)(t,n,r),ze=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return je(e)(t,n,i)},Be=e=>async(t,n,r)=>je(e)(t,n,r),Ve=/^[cC][^\s-]{8,}$/,He=/^[0-9a-z]+$/,Ue=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,We=/^[0-9a-vA-V]{20}$/,Ge=/^[A-Za-z0-9]{27}$/,Ke=/^[a-zA-Z0-9_-]{21}$/,qe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Je=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ye=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Xe=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ze=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Qe(){return new RegExp(Ze,`u`)}var $e=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,et=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,tt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,nt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,rt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,it=/^[A-Za-z0-9_-]*$/,at=/^\+[1-9]\d{6,14}$/,ot=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,st=RegExp(`^${ot}$`);function ct(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function lt(e){return RegExp(`^${ct(e)}$`)}function ut(e){let t=ct({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${ot}T(?:${r})$`)}var dt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},ft=/^-?\d+$/,pt=/^-?\d+(?:\.\d+)?$/,mt=/^null$/i,ht=/^[^A-Z]*$/,gt=/^[^a-z]*$/,x=n(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),_t={number:`number`,bigint:`bigint`,object:`date`},vt=n(`$ZodCheckLessThan`,(e,t)=>{x.init(e,t);let n=_t[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yt=n(`$ZodCheckGreaterThan`,(e,t)=>{x.init(e,t);let n=_t[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),bt=n(`$ZodCheckMultipleOf`,(e,t)=>{x.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):f(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),xt=n(`$ZodCheckNumberFormat`,(e,t)=>{x.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ce[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=ft)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),St=n(`$ZodCheckMaxLength`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!u(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=be(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ct=n(`$ZodCheckMinLength`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!u(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=be(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),wt=n(`$ZodCheckLengthEquals`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!u(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=be(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Tt=n(`$ZodCheckStringFormat`,(e,t)=>{var n,r;x.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Et=n(`$ZodCheckRegex`,(e,t)=>{Tt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Dt=n(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ht,Tt.init(e,t)}),Ot=n(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=gt,Tt.init(e,t)}),kt=n(`$ZodCheckIncludes`,(e,t)=>{x.init(e,t);let n=ae(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),At=n(`$ZodCheckStartsWith`,(e,t)=>{x.init(e,t);let n=RegExp(`^${ae(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),jt=n(`$ZodCheckEndsWith`,(e,t)=>{x.init(e,t);let n=RegExp(`.*${ae(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Mt=n(`$ZodCheckOverwrite`,(e,t)=>{x.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Nt=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.BibliographicResourceParsersLib={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);Object.freeze({status:`aborted`});function n(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var r=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},i=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},a={};function o(e){return e&&Object.assign(a,e),a}function s(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function c(e,t){return typeof t==`bigint`?t.toString():t}function l(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function u(e){return e==null}function d(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function f(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var p=Symbol(`evaluating`);function m(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==p)return r===void 0&&(r=p,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function h(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function g(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function _(e){return JSON.stringify(e)}function v(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var y=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ee(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var te=l(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ne(e){if(ee(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(ee(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function re(e){return ne(e)?{...e}:Array.isArray(e)?[...e]:e}var ie=new Set([`string`,`number`,`symbol`]);function ae(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function oe(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function b(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function se(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ce={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function le(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return oe(e,g(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return h(this,`shape`,e),e},checks:[]}))}function ue(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return oe(e,g(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return h(this,`shape`,r),r},checks:[]}))}function de(e,t){if(!ne(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return oe(e,g(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return h(this,`shape`,n),n}}))}function fe(e,t){if(!ne(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return oe(e,g(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return h(this,`shape`,n),n}}))}function pe(e,t){return oe(e,g(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return h(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function me(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return oe(t,g(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return h(this,`shape`,i),i},checks:[]}))}function he(e,t,n){return oe(t,g(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return h(this,`shape`,i),i}}))}function ge(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function _e(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ve(e){return typeof e==`string`?e:e?.message}function ye(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=ve(e.inst?._zod.def?.error?.(e))??ve(t?.error?.(e))??ve(n.customError?.(e))??ve(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function be(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function xe(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Se=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,c,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Ce=n(`$ZodError`,Se),we=n(`$ZodError`,Se,{Parent:Error});function Te(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ee(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var De=e=>(t,n,i,a)=>{let s=i?Object.assign(i,{async:!1}):{async:!1},c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new r;if(c.issues.length){let t=new(a?.Err??e)(c.issues.map(e=>ye(e,s,o())));throw y(t,a?.callee),t}return c.value},Oe=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){let t=new(i?.Err??e)(s.issues.map(e=>ye(e,a,o())));throw y(t,i?.callee),t}return s.value},ke=e=>(t,n,i)=>{let a=i?{...i,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise)throw new r;return s.issues.length?{success:!1,error:new(e??Ce)(s.issues.map(e=>ye(e,a,o())))}:{success:!0,data:s.value}},Ae=ke(we),je=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>ye(e,i,o())))}:{success:!0,data:a.value}},Me=je(we),Ne=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return De(e)(t,n,i)},Pe=e=>(t,n,r)=>De(e)(t,n,r),Fe=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Oe(e)(t,n,i)},Ie=e=>async(t,n,r)=>Oe(e)(t,n,r),Le=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ke(e)(t,n,i)},Re=e=>(t,n,r)=>ke(e)(t,n,r),ze=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return je(e)(t,n,i)},Be=e=>async(t,n,r)=>je(e)(t,n,r),Ve=/^[cC][^\s-]{8,}$/,He=/^[0-9a-z]+$/,Ue=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,We=/^[0-9a-vA-V]{20}$/,Ge=/^[A-Za-z0-9]{27}$/,Ke=/^[a-zA-Z0-9_-]{21}$/,qe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Je=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ye=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Xe=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ze=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Qe(){return new RegExp(Ze,`u`)}var $e=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,et=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,tt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,nt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,rt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,it=/^[A-Za-z0-9_-]*$/,at=/^\+[1-9]\d{6,14}$/,ot=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,st=RegExp(`^${ot}$`);function ct(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function lt(e){return RegExp(`^${ct(e)}$`)}function ut(e){let t=ct({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${ot}T(?:${r})$`)}var dt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},ft=/^-?\d+$/,pt=/^-?\d+(?:\.\d+)?$/,mt=/^null$/i,ht=/^[^A-Z]*$/,gt=/^[^a-z]*$/,x=n(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),_t={number:`number`,bigint:`bigint`,object:`date`},vt=n(`$ZodCheckLessThan`,(e,t)=>{x.init(e,t);let n=_t[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yt=n(`$ZodCheckGreaterThan`,(e,t)=>{x.init(e,t);let n=_t[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),bt=n(`$ZodCheckMultipleOf`,(e,t)=>{x.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):f(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),xt=n(`$ZodCheckNumberFormat`,(e,t)=>{x.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ce[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=ft)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),St=n(`$ZodCheckMaxLength`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!u(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=be(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ct=n(`$ZodCheckMinLength`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!u(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=be(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),wt=n(`$ZodCheckLengthEquals`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!u(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=be(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Tt=n(`$ZodCheckStringFormat`,(e,t)=>{var n,r;x.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Et=n(`$ZodCheckRegex`,(e,t)=>{Tt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Dt=n(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ht,Tt.init(e,t)}),Ot=n(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=gt,Tt.init(e,t)}),kt=n(`$ZodCheckIncludes`,(e,t)=>{x.init(e,t);let n=ae(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),At=n(`$ZodCheckStartsWith`,(e,t)=>{x.init(e,t);let n=RegExp(`^${ae(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),jt=n(`$ZodCheckEndsWith`,(e,t)=>{x.init(e,t);let n=RegExp(`.*${ae(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Mt=n(`$ZodCheckOverwrite`,(e,t)=>{x.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Nt=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
2
2
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
3
3
|
`))}},Pt={major:4,minor:3,patch:6},S=n(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Pt;let i=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&i.unshift(e);for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let i=ge(e),a;for(let o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&n?.async===!1)throw new r;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(i||=ge(e,t))});else{if(e.issues.length===t)continue;i||=ge(e,t)}}return a?a.then(()=>e):e},n=(n,a,o)=>{if(ge(n))return n.aborted=!0,n;let s=t(a,i,o);if(s instanceof Promise){if(o.async===!1)throw new r;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if(o.direction===`backward`){let t=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,a,o)):n(t,a,o)}let s=e._zod.parse(a,o);if(s instanceof Promise){if(o.async===!1)throw new r;return s.then(e=>t(e,i,o))}return t(s,i,o)}}m(e,`~standard`,()=>({validate:t=>{try{let n=Ae(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Me(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Ft=n(`$ZodString`,(e,t)=>{S.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??dt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),C=n(`$ZodStringFormat`,(e,t)=>{Tt.init(e,t),Ft.init(e,t)}),It=n(`$ZodGUID`,(e,t)=>{t.pattern??=Je,C.init(e,t)}),Lt=n(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ye(e)}else t.pattern??=Ye();C.init(e,t)}),Rt=n(`$ZodEmail`,(e,t)=>{t.pattern??=Xe,C.init(e,t)}),zt=n(`$ZodURL`,(e,t)=>{C.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Bt=n(`$ZodEmoji`,(e,t)=>{t.pattern??=Qe(),C.init(e,t)}),Vt=n(`$ZodNanoID`,(e,t)=>{t.pattern??=Ke,C.init(e,t)}),Ht=n(`$ZodCUID`,(e,t)=>{t.pattern??=Ve,C.init(e,t)}),Ut=n(`$ZodCUID2`,(e,t)=>{t.pattern??=He,C.init(e,t)}),Wt=n(`$ZodULID`,(e,t)=>{t.pattern??=Ue,C.init(e,t)}),Gt=n(`$ZodXID`,(e,t)=>{t.pattern??=We,C.init(e,t)}),Kt=n(`$ZodKSUID`,(e,t)=>{t.pattern??=Ge,C.init(e,t)}),qt=n(`$ZodISODateTime`,(e,t)=>{t.pattern??=ut(t),C.init(e,t)}),Jt=n(`$ZodISODate`,(e,t)=>{t.pattern??=st,C.init(e,t)}),Yt=n(`$ZodISOTime`,(e,t)=>{t.pattern??=lt(t),C.init(e,t)}),Xt=n(`$ZodISODuration`,(e,t)=>{t.pattern??=qe,C.init(e,t)}),Zt=n(`$ZodIPv4`,(e,t)=>{t.pattern??=$e,C.init(e,t),e._zod.bag.format=`ipv4`}),Qt=n(`$ZodIPv6`,(e,t)=>{t.pattern??=et,C.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),$t=n(`$ZodCIDRv4`,(e,t)=>{t.pattern??=tt,C.init(e,t)}),en=n(`$ZodCIDRv6`,(e,t)=>{t.pattern??=nt,C.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function tn(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var nn=n(`$ZodBase64`,(e,t)=>{t.pattern??=rt,C.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{tn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function rn(e){if(!it.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return tn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var an=n(`$ZodBase64URL`,(e,t)=>{t.pattern??=it,C.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{rn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),on=n(`$ZodE164`,(e,t)=>{t.pattern??=at,C.init(e,t)});function sn(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var cn=n(`$ZodJWT`,(e,t)=>{C.init(e,t),e._zod.check=n=>{sn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),ln=n(`$ZodNumber`,(e,t)=>{S.init(e,t),e._zod.pattern=e._zod.bag.pattern??pt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),un=n(`$ZodNumberFormat`,(e,t)=>{xt.init(e,t),ln.init(e,t)}),dn=n(`$ZodNull`,(e,t)=>{S.init(e,t),e._zod.pattern=mt,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),fn=n(`$ZodUnknown`,(e,t)=>{S.init(e,t),e._zod.parse=e=>e}),pn=n(`$ZodNever`,(e,t)=>{S.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function mn(e,t,n){e.issues.length&&t.issues.push(..._e(n,e.issues)),t.value[n]=e.value}var hn=n(`$ZodArray`,(e,t)=>{S.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>mn(t,n,e))):mn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function gn(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(..._e(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function _n(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=se(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function vn(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>gn(e,n,i,t,u))):gn(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var yn=n(`$ZodObject`,(e,t)=>{if(S.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=l(()=>_n(t));m(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=ee,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>gn(n,t,e,s,r))):gn(i,t,e,s,r)}return i?vn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),bn=n(`$ZodObjectJIT`,(e,t)=>{yn.init(e,t);let n=e._zod.parse,r=l(()=>_n(t)),i=e=>{let t=new Nt([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=_(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=_(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
|
|
4
4
|
if (${n}.issues.length) {
|
|
@@ -36,4 +36,4 @@
|
|
|
36
36
|
|
|
37
37
|
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},o,s=ee,c=!a.jitless,u=c&&te.value,d=t.catchall,f;e._zod.parse=(a,l)=>{f??=r.value;let p=a.value;return s(p)?c&&u&&l?.async===!1&&l.jitless!==!0?(o||=i(t.shape),a=o(a,l),d?vn([],p,a,l,f,e):a):n(a,l):(a.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),a)}});function xn(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!ge(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>ye(e,r,o())))}),t)}var Sn=n(`$ZodUnion`,(e,t)=>{S.init(e,t),m(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),m(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),m(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),m(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>d(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>xn(t,i,e,a)):xn(s,i,e,a)}}),Cn=n(`$ZodIntersection`,(e,t)=>{S.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Tn(e,t,n)):Tn(e,i,a)}});function wn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ne(e)&&ne(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=wn(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=wn(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Tn(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),ge(e))return e;let o=wn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var En=n(`$ZodRecord`,(e,t)=>{S.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!ne(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],s=t.keyType._zod.values;if(s){n.value={};let o=new Set;for(let e of s)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){o.add(typeof e==`number`?e.toString():e);let s=t.valueType._zod.run({value:i[e],issues:[]},r);s instanceof Promise?a.push(s.then(t=>{t.issues.length&&n.issues.push(..._e(e,t.issues)),n.value[e]=t.value})):(s.issues.length&&n.issues.push(..._e(e,s.issues)),n.value[e]=s.value)}let c;for(let e in i)o.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let s of Reflect.ownKeys(i)){if(s===`__proto__`)continue;let c=t.keyType._zod.run({value:s,issues:[]},r);if(c instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof s==`string`&&pt.test(s)&&c.issues.length){let e=t.keyType._zod.run({value:Number(s),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(c=e)}if(c.issues.length){t.mode===`loose`?n.value[s]=i[s]:n.issues.push({code:`invalid_key`,origin:`record`,issues:c.issues.map(e=>ye(e,r,o())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:i[s],issues:[]},r);l instanceof Promise?a.push(l.then(e=>{e.issues.length&&n.issues.push(..._e(s,e.issues)),n.value[c.value]=e.value})):(l.issues.length&&n.issues.push(..._e(s,l.issues)),n.value[c.value]=l.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Dn=n(`$ZodEnum`,(e,t)=>{S.init(e,t);let n=s(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ie.has(typeof e)).map(e=>typeof e==`string`?ae(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),On=n(`$ZodLiteral`,(e,t)=>{if(S.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?ae(e):e?ae(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),kn=n(`$ZodTransform`,(e,t)=>{S.init(e,t),e._zod.parse=(n,a)=>{if(a.direction===`backward`)throw new i(e.constructor.name);let o=t.transform(n.value,n);if(a.async)return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(n.value=e,n));if(o instanceof Promise)throw new r;return n.value=o,n}});function An(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var jn=n(`$ZodOptional`,(e,t)=>{S.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,m(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),m(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${d(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>An(t,e.value)):An(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Mn=n(`$ZodExactOptional`,(e,t)=>{jn.init(e,t),m(e._zod,`values`,()=>t.innerType._zod.values),m(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Nn=n(`$ZodNullable`,(e,t)=>{S.init(e,t),m(e._zod,`optin`,()=>t.innerType._zod.optin),m(e._zod,`optout`,()=>t.innerType._zod.optout),m(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${d(e.source)}|null)$`):void 0}),m(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Pn=n(`$ZodDefault`,(e,t)=>{S.init(e,t),e._zod.optin=`optional`,m(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Fn(e,t)):Fn(r,t)}});function Fn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var In=n(`$ZodPrefault`,(e,t)=>{S.init(e,t),e._zod.optin=`optional`,m(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Ln=n(`$ZodNonOptional`,(e,t)=>{S.init(e,t),m(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Rn(t,e)):Rn(i,e)}});function Rn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var zn=n(`$ZodCatch`,(e,t)=>{S.init(e,t),m(e._zod,`optin`,()=>t.innerType._zod.optin),m(e._zod,`optout`,()=>t.innerType._zod.optout),m(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ye(e,n,o()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ye(e,n,o()))},input:e.value}),e.issues=[]),e)}}),Bn=n(`$ZodPipe`,(e,t)=>{S.init(e,t),m(e._zod,`values`,()=>t.in._zod.values),m(e._zod,`optin`,()=>t.in._zod.optin),m(e._zod,`optout`,()=>t.out._zod.optout),m(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Vn(e,t.in,n)):Vn(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Vn(e,t.out,n)):Vn(r,t.out,n)}});function Vn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Hn=n(`$ZodReadonly`,(e,t)=>{S.init(e,t),m(e._zod,`propValues`,()=>t.innerType._zod.propValues),m(e._zod,`values`,()=>t.innerType._zod.values),m(e._zod,`optin`,()=>t.innerType?._zod?.optin),m(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Un):Un(r)}});function Un(e){return e.value=Object.freeze(e.value),e}var Wn=n(`$ZodCustom`,(e,t)=>{x.init(e,t),S.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Gn(t,n,r,e));Gn(i,n,r,e)}});function Gn(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(xe(e))}}var Kn,qn=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Jn(){return new qn}(Kn=globalThis).__zod_globalRegistry??(Kn.__zod_globalRegistry=Jn());var Yn=globalThis.__zod_globalRegistry;function Xn(e,t){return new e({type:`string`,...b(t)})}function Zn(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...b(t)})}function Qn(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...b(t)})}function $n(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...b(t)})}function er(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...b(t)})}function tr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...b(t)})}function nr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...b(t)})}function rr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...b(t)})}function ir(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...b(t)})}function ar(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...b(t)})}function or(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...b(t)})}function sr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...b(t)})}function cr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...b(t)})}function lr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...b(t)})}function ur(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...b(t)})}function dr(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...b(t)})}function fr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...b(t)})}function pr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...b(t)})}function mr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...b(t)})}function hr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...b(t)})}function gr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...b(t)})}function _r(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...b(t)})}function vr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...b(t)})}function yr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...b(t)})}function br(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...b(t)})}function xr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...b(t)})}function Sr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...b(t)})}function Cr(e,t){return new e({type:`number`,checks:[],...b(t)})}function wr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...b(t)})}function Tr(e,t){return new e({type:`null`,...b(t)})}function Er(e){return new e({type:`unknown`})}function Dr(e,t){return new e({type:`never`,...b(t)})}function Or(e,t){return new vt({check:`less_than`,...b(t),value:e,inclusive:!1})}function kr(e,t){return new vt({check:`less_than`,...b(t),value:e,inclusive:!0})}function Ar(e,t){return new yt({check:`greater_than`,...b(t),value:e,inclusive:!1})}function jr(e,t){return new yt({check:`greater_than`,...b(t),value:e,inclusive:!0})}function Mr(e,t){return new bt({check:`multiple_of`,...b(t),value:e})}function Nr(e,t){return new St({check:`max_length`,...b(t),maximum:e})}function Pr(e,t){return new Ct({check:`min_length`,...b(t),minimum:e})}function Fr(e,t){return new wt({check:`length_equals`,...b(t),length:e})}function Ir(e,t){return new Et({check:`string_format`,format:`regex`,...b(t),pattern:e})}function Lr(e){return new Dt({check:`string_format`,format:`lowercase`,...b(e)})}function Rr(e){return new Ot({check:`string_format`,format:`uppercase`,...b(e)})}function zr(e,t){return new kt({check:`string_format`,format:`includes`,...b(t),includes:e})}function Br(e,t){return new At({check:`string_format`,format:`starts_with`,...b(t),prefix:e})}function Vr(e,t){return new jt({check:`string_format`,format:`ends_with`,...b(t),suffix:e})}function Hr(e){return new Mt({check:`overwrite`,tx:e})}function Ur(e){return Hr(t=>t.normalize(e))}function Wr(){return Hr(e=>e.trim())}function Gr(){return Hr(e=>e.toLowerCase())}function Kr(){return Hr(e=>e.toUpperCase())}function qr(){return Hr(e=>v(e))}function Jr(e,t,n){return new e({type:`array`,element:t,...b(n)})}function Yr(e,t,n){let r=b(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function Xr(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...b(n)})}function Zr(e){let t=Qr(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(xe(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(xe(r))}},e(n.value,n)));return t}function Qr(e,t){let n=new x({check:`custom`,...b(t)});return n._zod.check=e,n}function $r(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Yn,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function w(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,w(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&T(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function ei(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
38
38
|
|
|
39
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ti(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:ri(t,`input`,e.processors),output:ri(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function T(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return T(r.element,n);if(r.type===`set`)return T(r.valueType,n);if(r.type===`lazy`)return T(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return T(r.innerType,n);if(r.type===`intersection`)return T(r.left,n)||T(r.right,n);if(r.type===`record`||r.type===`map`)return T(r.keyType,n)||T(r.valueType,n);if(r.type===`pipe`)return T(r.in,n)||T(r.out,n);if(r.type===`object`){for(let e in r.shape)if(T(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(T(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(T(e,n))return!0;return!!(r.rest&&T(r.rest,n))}return!1}var ni=(e,t={})=>n=>{let r=$r({...n,processors:t});return w(e,r),ei(r,e),ti(r,e)},ri=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=$r({...i??{},target:a,io:t,processors:n});return w(e,o),ei(o,e),ti(o,e)},ii={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ai=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ii[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},oi=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},si=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},ci=(e,t,n,r)=>{n.not={}},li=(e,t,n,r)=>{let i=e._zod.def,a=s(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ui=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},di=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},fi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},pi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=w(a.element,t,{...r,path:[...r.path,`items`]})},mi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=w(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=w(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},hi=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>w(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},gi=(e,t,n,r)=>{let i=e._zod.def,a=w(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=w(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},_i=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=w(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=w(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=w(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},vi=(e,t,n,r)=>{let i=e._zod.def,a=w(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},yi=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},bi=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},xi=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Si=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Ci=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;w(a,t,r);let o=t.seen.get(e);o.ref=a},wi=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ti=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ei=n(`ZodISODateTime`,(e,t)=>{qt.init(e,t),k.init(e,t)});function Di(e){return yr(Ei,e)}var Oi=n(`ZodISODate`,(e,t)=>{Jt.init(e,t),k.init(e,t)});function ki(e){return br(Oi,e)}var Ai=n(`ZodISOTime`,(e,t)=>{Yt.init(e,t),k.init(e,t)});function ji(e){return xr(Ai,e)}var Mi=n(`ZodISODuration`,(e,t)=>{Xt.init(e,t),k.init(e,t)});function Ni(e){return Sr(Mi,e)}var Pi=(e,t)=>{Ce.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ee(e,t)},flatten:{value:t=>Te(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,c,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,c,2)}},isEmpty:{get(){return e.issues.length===0}}})};n(`ZodError`,Pi);var E=n(`ZodError`,Pi,{Parent:Error}),Fi=De(E),Ii=Oe(E),Li=ke(E),Ri=je(E),zi=Ne(E),Bi=Pe(E),Vi=Fe(E),Hi=Ie(E),Ui=Le(E),Wi=Re(E),Gi=ze(E),Ki=Be(E),D=n(`ZodType`,(e,t)=>(S.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ri(e,`input`),output:ri(e,`output`)}}),e.toJSONSchema=ni(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(g(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>oe(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Fi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Li(e,t,n),e.parseAsync=async(t,n)=>Ii(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ri(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>zi(e,t,n),e.decode=(t,n)=>Bi(e,t,n),e.encodeAsync=async(t,n)=>Vi(e,t,n),e.decodeAsync=async(t,n)=>Hi(e,t,n),e.safeEncode=(t,n)=>Ui(e,t,n),e.safeDecode=(t,n)=>Wi(e,t,n),e.safeEncodeAsync=async(t,n)=>Gi(e,t,n),e.safeDecodeAsync=async(t,n)=>Ki(e,t,n),e.refine=(t,n)=>e.check(no(t,n)),e.superRefine=t=>e.check(ro(t)),e.overwrite=t=>e.check(Hr(t)),e.optional=()=>P(e),e.exactOptional=()=>za(e),e.nullable=()=>Va(e),e.nullish=()=>P(Va(e)),e.nonoptional=t=>qa(e,t),e.array=()=>A(e),e.or=t=>M([e,t]),e.and=t=>ka(e,t),e.transform=t=>Za(e,Ia(t)),e.default=t=>Ua(e,t),e.prefault=t=>Ga(e,t),e.catch=t=>Ya(e,t),e.pipe=t=>Za(e,t),e.readonly=()=>$a(e),e.describe=t=>{let n=e.clone();return Yn.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Yn.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Yn.get(e);let n=e.clone();return Yn.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),qi=n(`_ZodString`,(e,t)=>{Ft.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ai(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Ir(...t)),e.includes=(...t)=>e.check(zr(...t)),e.startsWith=(...t)=>e.check(Br(...t)),e.endsWith=(...t)=>e.check(Vr(...t)),e.min=(...t)=>e.check(Pr(...t)),e.max=(...t)=>e.check(Nr(...t)),e.length=(...t)=>e.check(Fr(...t)),e.nonempty=(...t)=>e.check(Pr(1,...t)),e.lowercase=t=>e.check(Lr(t)),e.uppercase=t=>e.check(Rr(t)),e.trim=()=>e.check(Wr()),e.normalize=(...t)=>e.check(Ur(...t)),e.toLowerCase=()=>e.check(Gr()),e.toUpperCase=()=>e.check(Kr()),e.slugify=()=>e.check(qr())}),Ji=n(`ZodString`,(e,t)=>{Ft.init(e,t),qi.init(e,t),e.email=t=>e.check(Zn(Yi,t)),e.url=t=>e.check(rr(Qi,t)),e.jwt=t=>e.check(vr(ma,t)),e.emoji=t=>e.check(ir(ea,t)),e.guid=t=>e.check(Qn(Xi,t)),e.uuid=t=>e.check($n(Zi,t)),e.uuidv4=t=>e.check(er(Zi,t)),e.uuidv6=t=>e.check(tr(Zi,t)),e.uuidv7=t=>e.check(nr(Zi,t)),e.nanoid=t=>e.check(ar(ta,t)),e.guid=t=>e.check(Qn(Xi,t)),e.cuid=t=>e.check(or(na,t)),e.cuid2=t=>e.check(sr(ra,t)),e.ulid=t=>e.check(cr(ia,t)),e.base64=t=>e.check(hr(da,t)),e.base64url=t=>e.check(gr(fa,t)),e.xid=t=>e.check(lr(aa,t)),e.ksuid=t=>e.check(ur(oa,t)),e.ipv4=t=>e.check(dr(sa,t)),e.ipv6=t=>e.check(fr(ca,t)),e.cidrv4=t=>e.check(pr(la,t)),e.cidrv6=t=>e.check(mr(ua,t)),e.e164=t=>e.check(_r(pa,t)),e.datetime=t=>e.check(Di(t)),e.date=t=>e.check(ki(t)),e.time=t=>e.check(ji(t)),e.duration=t=>e.check(Ni(t))});function O(e){return Xn(Ji,e)}var k=n(`ZodStringFormat`,(e,t)=>{C.init(e,t),qi.init(e,t)}),Yi=n(`ZodEmail`,(e,t)=>{Rt.init(e,t),k.init(e,t)}),Xi=n(`ZodGUID`,(e,t)=>{It.init(e,t),k.init(e,t)}),Zi=n(`ZodUUID`,(e,t)=>{Lt.init(e,t),k.init(e,t)}),Qi=n(`ZodURL`,(e,t)=>{zt.init(e,t),k.init(e,t)});function $i(e){return rr(Qi,e)}var ea=n(`ZodEmoji`,(e,t)=>{Bt.init(e,t),k.init(e,t)}),ta=n(`ZodNanoID`,(e,t)=>{Vt.init(e,t),k.init(e,t)}),na=n(`ZodCUID`,(e,t)=>{Ht.init(e,t),k.init(e,t)}),ra=n(`ZodCUID2`,(e,t)=>{Ut.init(e,t),k.init(e,t)}),ia=n(`ZodULID`,(e,t)=>{Wt.init(e,t),k.init(e,t)}),aa=n(`ZodXID`,(e,t)=>{Gt.init(e,t),k.init(e,t)}),oa=n(`ZodKSUID`,(e,t)=>{Kt.init(e,t),k.init(e,t)}),sa=n(`ZodIPv4`,(e,t)=>{Zt.init(e,t),k.init(e,t)}),ca=n(`ZodIPv6`,(e,t)=>{Qt.init(e,t),k.init(e,t)}),la=n(`ZodCIDRv4`,(e,t)=>{$t.init(e,t),k.init(e,t)}),ua=n(`ZodCIDRv6`,(e,t)=>{en.init(e,t),k.init(e,t)}),da=n(`ZodBase64`,(e,t)=>{nn.init(e,t),k.init(e,t)}),fa=n(`ZodBase64URL`,(e,t)=>{an.init(e,t),k.init(e,t)}),pa=n(`ZodE164`,(e,t)=>{on.init(e,t),k.init(e,t)}),ma=n(`ZodJWT`,(e,t)=>{cn.init(e,t),k.init(e,t)}),ha=n(`ZodNumber`,(e,t)=>{ln.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oi(e,t,n,r),e.gt=(t,n)=>e.check(Ar(t,n)),e.gte=(t,n)=>e.check(jr(t,n)),e.min=(t,n)=>e.check(jr(t,n)),e.lt=(t,n)=>e.check(Or(t,n)),e.lte=(t,n)=>e.check(kr(t,n)),e.max=(t,n)=>e.check(kr(t,n)),e.int=t=>e.check(va(t)),e.safe=t=>e.check(va(t)),e.positive=t=>e.check(Ar(0,t)),e.nonnegative=t=>e.check(jr(0,t)),e.negative=t=>e.check(Or(0,t)),e.nonpositive=t=>e.check(kr(0,t)),e.multipleOf=(t,n)=>e.check(Mr(t,n)),e.step=(t,n)=>e.check(Mr(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ga(e){return Cr(ha,e)}var _a=n(`ZodNumberFormat`,(e,t)=>{un.init(e,t),ha.init(e,t)});function va(e){return wr(_a,e)}var ya=n(`ZodNull`,(e,t)=>{dn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>si(e,t,n,r)});function ba(e){return Tr(ya,e)}var xa=n(`ZodUnknown`,(e,t)=>{fn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Sa(){return Er(xa)}var Ca=n(`ZodNever`,(e,t)=>{pn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ci(e,t,n,r)});function wa(e){return Dr(Ca,e)}var Ta=n(`ZodArray`,(e,t)=>{hn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pi(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Pr(t,n)),e.nonempty=t=>e.check(Pr(1,t)),e.max=(t,n)=>e.check(Nr(t,n)),e.length=(t,n)=>e.check(Fr(t,n)),e.unwrap=()=>e.element});function A(e,t){return Jr(Ta,e,t)}var Ea=n(`ZodObject`,(e,t)=>{bn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mi(e,t,n,r),m(e,`shape`,()=>t.shape),e.keyof=()=>Na(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Sa()}),e.loose=()=>e.clone({...e._zod.def,catchall:Sa()}),e.strict=()=>e.clone({...e._zod.def,catchall:wa()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>de(e,t),e.safeExtend=t=>fe(e,t),e.merge=t=>pe(e,t),e.pick=t=>le(e,t),e.omit=t=>ue(e,t),e.partial=(...t)=>me(La,e,t[0]),e.required=(...t)=>he(Ka,e,t[0])});function j(e,t){return new Ea({type:`object`,shape:e??{},...b(t)})}var Da=n(`ZodUnion`,(e,t)=>{Sn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hi(e,t,n,r),e.options=t.options});function M(e,t){return new Da({type:`union`,options:e,...b(t)})}var Oa=n(`ZodIntersection`,(e,t)=>{Cn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gi(e,t,n,r)});function ka(e,t){return new Oa({type:`intersection`,left:e,right:t})}var Aa=n(`ZodRecord`,(e,t)=>{En.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_i(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function ja(e,t,n){return new Aa({type:`record`,keyType:e,valueType:t,...b(n)})}var Ma=n(`ZodEnum`,(e,t)=>{Dn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>li(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ma({...t,checks:[],...b(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ma({...t,checks:[],...b(r),entries:i})}});function Na(e,t){return new Ma({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...b(t)})}var Pa=n(`ZodLiteral`,(e,t)=>{On.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ui(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function N(e,t){return new Pa({type:`literal`,values:Array.isArray(e)?e:[e],...b(t)})}var Fa=n(`ZodTransform`,(e,t)=>{kn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fi(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new i(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(xe(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(xe(t))}};let a=t.transform(n.value,n);return a instanceof Promise?a.then(e=>(n.value=e,n)):(n.value=a,n)}});function Ia(e){return new Fa({type:`transform`,transform:e})}var La=n(`ZodOptional`,(e,t)=>{jn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function P(e){return new La({type:`optional`,innerType:e})}var Ra=n(`ZodExactOptional`,(e,t)=>{Mn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function za(e){return new Ra({type:`optional`,innerType:e})}var Ba=n(`ZodNullable`,(e,t)=>{Nn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Va(e){return new Ba({type:`nullable`,innerType:e})}var Ha=n(`ZodDefault`,(e,t)=>{Pn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ua(e,t){return new Ha({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():re(t)}})}var Wa=n(`ZodPrefault`,(e,t)=>{In.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ga(e,t){return new Wa({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():re(t)}})}var Ka=n(`ZodNonOptional`,(e,t)=>{Ln.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qa(e,t){return new Ka({type:`nonoptional`,innerType:e,...b(t)})}var Ja=n(`ZodCatch`,(e,t)=>{zn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ya(e,t){return new Ja({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Xa=n(`ZodPipe`,(e,t)=>{Bn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),e.in=t.in,e.out=t.out});function Za(e,t){return new Xa({type:`pipe`,in:e,out:t})}var Qa=n(`ZodReadonly`,(e,t)=>{Hn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $a(e){return new Qa({type:`readonly`,innerType:e})}var eo=n(`ZodCustom`,(e,t)=>{Wn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>di(e,t,n,r)});function to(e,t){return Yr(eo,e??(()=>!0),t)}function no(e,t={}){return Xr(eo,e,t)}function ro(e){return Zr(e)}var F=function(e){return e.Article=`article`,e.AudioDocument=`audiodocument`,e.AudioVisualDocument=`audiovisualdocument`,e.Book=`book`,e.Bookitem=`bookitem`,e.Conference=`conference`,e.Document=`document`,e.Image=`image`,e.Issue=`issue`,e.Journal=`journal`,e.Preprint=`preprint`,e.Proceeding=`proceeding`,e.Report=`report`,e.Unknown=`unknown`,e.Webpage=`webpage`,e}({}),io=M([N(F.Book),N(F.Bookitem),N(F.Conference),N(F.Document),N(F.Report),N(F.Proceeding),N(F.Unknown)]),ao=M([N(F.Article),N(F.Conference),N(F.Issue),N(F.Journal),N(F.Preprint),N(F.Proceeding),N(F.Unknown)]),oo=j({artnum:O(),atitle:O(),aufirst:O(),aulast:O(),auinit:O(),auinit1:O(),auinitm:O(),ausuffix:O(),au:A(O()),aucorp:O(),bici:O(),btitle:O(),chron:O(),coden:O(),date:O(),edition:O(),eissn:O(),epage:O(),externalDBID:O(),externalDocID:O(),genre:Na(F),id:O(),isbn:O(),issn:O(),issue:O(),jtitle:O(),pages:O(),part:O(),place:O(),pub:O(),quarter:O(),rft_id:A(O()),series:O(),sici:O(),spage:O(),ssn:O(),stitle:O(),title:O(),tpages:O(),volume:O()}).partial(),so=j({bibid:O(),doi:O(),uri:O()}).partial(),co=oo.pick({atitle:!0,aufirst:!0,aulast:!0,auinit:!0,auinit1:!0,auinitm:!0,ausuffix:!0,au:!0,aucorp:!0,bici:!0,btitle:!0,date:!0,edition:!0,epage:!0,id:!0,isbn:!0,issn:!0,pages:!0,place:!0,pub:!0,rft_id:!0,title:!0,tpages:!0,series:!0,spage:!0}).partial(),lo=oo.pick({artnum:!0,atitle:!0,aufirst:!0,aulast:!0,auinit:!0,auinit1:!0,auinitm:!0,ausuffix:!0,au:!0,aucorp:!0,chron:!0,coden:!0,date:!0,epage:!0,id:!0,isbn:!0,eissn:!0,issn:!0,issue:!0,title:!0,jtitle:!0,pages:!0,part:!0,pub:!0,rft_id:!0,sici:!0,spage:!0,stitle:!0,ssn:!0,quarter:!0,volume:!0}).partial(),uo=oo.pick({au:!0,date:!0,isbn:!0,pub:!0,title:!0}).partial(),fo=oo.pick({au:!0,date:!0,pub:!0,title:!0}).partial(),po=oo.pick({au:!0,date:!0,pub:!0,title:!0,spage:!0,epage:!0}).partial(),mo=oo.pick({au:!0,date:!0,title:!0}).partial(),ho=j({...oo.shape,...so.shape}),I=(e,t)=>({...t,genre:e}),L=(e,t)=>({...t,genre:e}),R=e=>({...e,genre:F.AudioVisualDocument}),go=e=>({...e,genre:F.Image}),_o=e=>({...e,genre:F.Document}),vo=e=>({...e,genre:F.Webpage}),yo=e=>Object.keys(e.shape),bo=yo(oo),xo=yo(so),So=(e,t,n)=>{if(n.length>0&&typeof n[0]==`string`){let r=t.startsWith(`rft_`)?t:`rft.${t}`;e.append(r,n[0])}},Co=(e,t,n)=>{e.append(t,n)},wo=(e,t,n)=>{e.append(`rft.${t}`,n)},To=e=>xo.includes(e),Eo=e=>{let t=new URLSearchParams;return Object.entries(e).forEach(([e,n])=>{Array.isArray(n)?So(t,e,n):typeof n==`string`&&n&&(To(e)?Co(t,e,n):wo(t,e,n))}),t},Do=(e,t,n,r)=>{let i=t.getAll(n).filter(e=>!!e).map(e=>e.trim());return i.length===0?e:{...e,[r]:i}},Oo=e=>{let t=ko(e),n=(e,n)=>{if(n===`au`)return Do(e,t,`rft.au`,`au`);if(n===`rft_id`)return Do(e,t,`rft_id`,`rft_id`);let r=To(n)?n:`rft.${n}`,i=t.get(r);return i?{...e,[n]:i.trim()}:e},r=[...bo,...xo].reduce(n,{});return Object.keys(r).length===0?null:r},ko=e=>URL.canParse(e)?new URL(e).searchParams:new URLSearchParams(e);function Ao(e){return typeof e==`string`?Object.values(F).includes(e):!1}var jo=function(e){return e.CA=`CA`,e.EUAPAC=`EUAPAC`,e}({}),Mo=j({id:O(),name:O(),region:Na(jo)}),No=j({tenants:A(Mo)}),Po=9*1024*1024,Fo=j({url:$i({error:e=>e.input===void 0?`should have the required string property "url"`:`"url" must be a string`}),html:O({error:e=>e.input===void 0?`should have the required string property "html"`:void 0}).max(Po,{error:`"html" should be a string with a MAX Length of ${Po}`}),tenantCode:O({error:e=>e.input===void 0?`should have the required string property "tenantCode"`:void 0}).min(1,{error:`"tenantCode" must be a string`}),region:Na([jo.EUAPAC,jo.CA],{error:e=>e.input===void 0?`should have the required string property "region"`:`"region" must be a string of EUAPAC or CA`})});function Io(e){return Fo.safeParse(e).success}var Lo=j({name:O(),region:Na(jo),apps:ja(O(),O())}),Ro=ja(O(),Lo),zo=e=>Lo.safeParse(e).success,Bo=e=>Ro.safeParse(e).success;function Vo(e){return Mo.safeParse(e).success}function Ho(e){return typeof e==`string`&&Object.keys(jo).includes(e)}var Uo=e=>{if(!Bo(e))throw Error(`Error: the customer list data is invalid.`);return{tenants:Object.entries(e).map(([e,t])=>Wo(e,t))}},Wo=(e,t)=>{if(!zo(t))throw Error(`Invalid customer: ${t}`);let{name:n,region:r}=t,i={id:e,name:n,region:r};if(!Vo(i))throw Error(`Invalid tenant: ${JSON.stringify(i)}`);return i},Go=j({parserType:O(),parserName:O().nullable(),referrer:O()}),Ko=j({bookmarkingWorkflowUrl:ba(),resource:ba()}),qo=j({bookmarkingWorkflowUrl:O(),resource:ba()}),Jo=j({bookmarkingWorkflowUrl:ba(),resource:ho}),Yo=j({z3988SearchResult:N(!0)}),Xo=j({summonSearchResult:N(!0)}),Zo=M([qo,Ko,Jo,Yo,Xo]),Qo=j({meta:Go}).and(Zo);function $o(e){return{bookmarkingWorkflowUrl:e,resource:null}}function z(){return{bookmarkingWorkflowUrl:null,resource:null}}function B(e){return{bookmarkingWorkflowUrl:null,resource:e}}function es(){return{z3988SearchResult:!0}}function ts(){return{summonSearchResult:!0}}var ns=e=>{let t=e.getAttribute(`title`);return t?Oo(t):null},rs=({document:e})=>{let t=Array.from(e.querySelectorAll(`.Z3988`));if(t.length===0)return z();let n=t.map(ns).find(e=>e!==null);return n?B(n):z()},is=e=>{let t=Array.from(e.querySelectorAll(`.author > a`)).map(e=>e.textContent.trim()).filter(Boolean);return t.length?t:void 0},as=e=>e.querySelector(`#rpi-attribute-book_details-edition > .rpi-attribute-value > span`)?.textContent??void 0,os=e=>{let t=e.querySelector(`#rpi-attribute-book_details-isbn10 > .rpi-attribute-value > span`)?.textContent??void 0,n=e.querySelector(`#rpi-attribute-book_details-isbn13 > .rpi-attribute-value > span`)?.textContent??void 0;if(t&&n)return`${t},${n}`;if(t)return t;if(n)return n},ss=e=>e.querySelector(`#rpi-attribute-book_details-publication_date > .rpi-attribute-value > span`)?.textContent??void 0,cs=e=>e.querySelector(`#rpi-attribute-book_details-publisher > .rpi-attribute-value > span`)?.textContent??void 0,ls=e=>e.querySelector(`#rpi-attribute-book_details-series > .rpi-attribute-value > a`)?.textContent??void 0,us=e=>{let t=e.querySelector(`#rpi-attribute-book_details-fiona_pages > .rpi-attribute-value > span`)?.textContent??void 0;return(t?/\d+/.exec(t)?.[0]:null)??void 0},ds=({document:e})=>{let t=is(e),n=as(e),r=os(e),i=ss(e),a=cs(e),o=ls(e),s=e.getElementById(`productTitle`)?.textContent.trim()??void 0,c=us(e);return{bookmarkingWorkflowUrl:null,resource:I(F.Book,{au:t,date:i,edition:n,isbn:r,pub:a,series:o,title:s,tpages:c})}},V=(e,t,n)=>{let r=H(e,t,n);return r.length>0?r[0]:void 0},H=(e,t,n)=>Array.from(e.querySelectorAll(`meta[${t}='${n}']`)).map(e=>e.getAttribute(`content`)).filter(e=>!!e?.trim()),fs=e=>{let t=new Map,n=e.split(`;`).filter(e=>!!e);for(let e of n){let[n,r,i]=e.split(`:`);t.set(n,{type:r,value:i})}return t},U=function(e){return e[e.None=0]=`None`,e[e.Book=1]=`Book`,e[e.Chapter=2]=`Chapter`,e[e.Journal=3]=`Journal`,e[e.Article=4]=`Article`,e[e.AudioVisual=5]=`AudioVisual`,e[e.Webpage=6]=`Webpage`,e[e.Document=7]=`Document`,e}({}),ps=e=>{if(!e)return;let t=/\b\d{4}\b/.exec(e);return t?t[0]:void 0},ms=e=>ps(e.querySelector(`#publication_date p`)?.textContent.trim()??V(e,`name`,`bepress_citation_date`)),hs=e=>({spage:V(e,`name`,`bepress_citation_firstpage`),epage:V(e,`name`,`bepress_citation_lastpage`)}),gs=e=>{let t=/https?:\/\/doi\.org\/(.+)/i,n=(e.querySelector(`#source p`)?.textContent.trim())?.match(t);if(n?.length===2)return n[1];let r=(e.querySelector(`#recommended_citation p a`)?.textContent.trim())?.match(t);if(r?.length===2)return r[1]},_s=e=>{let t=[],n=e.querySelectorAll(`tbody td`);for(let e of n){let n=e.querySelector(`strong`);if(n&&!n.querySelector(`a`)){let e=n.textContent.trim();e&&t.push(e)}}return t},vs=e=>V(e,`name`,`bepress_citation_title`)??e.querySelector(`title`)?.textContent.trim(),ys=e=>H(e,`name`,`author`),bs=e=>V(e,`name`,`bepress_citation_publisher`),xs=e=>V(e,`name`,`bepress_citation_pdf_url`),Ss=(e,t)=>{if(t.includes(`/etd/`))return U.Document;if(t.includes(`/sophpm_music/`)||t.includes(`/streaming/`))return U.AudioVisual;if(t.includes(`/vol`))return U.Article;if(t.includes(`/facpub`)||t.includes(`/studentpub/`)){let t={"book chapter":U.Book,"conference paper":U.Book,"peer-reviewed article":U.Article,other:U.Document},n=e.querySelector(`#document_type p`)?.textContent.toLowerCase().trim();return n?t[n]:void 0}return U.Journal},Cs=e=>{let t=vs(e),n=ys(e),r=ms(e),i=V(e,`name`,`bepress_citation_journal_title`),a=V(e,`name`,`bepress_citation_volume`),o=V(e,`name`,`bepress_citation_issue`),{epage:s,spage:c}=hs(e),l=xs(e),u=gs(e);return L(F.Article,{atitle:t,jtitle:i,au:n,date:r,volume:a,issue:o,epage:s,spage:c,doi:u,uri:l})},ws=(e,t)=>{let n=e.querySelector(`.inherit-title a`)?.textContent.trim()??vs(e),r=_s(e),i=ms(e),a=bs(e),o=gs(e);return L(F.Journal,{jtitle:n,au:r,date:i,pub:a,doi:o,uri:t})},Ts=e=>{let t=vs(e),n=ys(e),r=ms(e),i=bs(e),a=xs(e),o=e.querySelector(`#document_type p`)?.textContent.toLowerCase().trim();if(o===`book chapter`){let o=e.querySelector(`#source p`)?.textContent.trim();return I(F.Bookitem,{pub:i,atitle:t,btitle:o,au:n,date:r,uri:a})}let s=gs(e);return I(o===`conference paper`?F.Conference:F.Document,{pub:i,title:t,au:n,date:r,doi:s,uri:a})},Es=(e,t)=>R({title:vs(e),au:ys(e),date:ms(e),pub:bs(e),uri:t}),Ds=e=>{let t=vs(e),n=ys(e),r=ms(e);return _o({pub:bs(e),title:t,au:n,date:r,uri:xs(e)})},Os=({url:e,document:t})=>{switch(Ss(t,e)){case U.Article:return B(Cs(t));case U.Journal:return B(ws(t,e));case U.Book:return B(Ts(t));case U.AudioVisual:return B(Es(t,e));case U.Document:return B(Ds(t));default:return z()}},ks=e=>{if(e)return e.replace(/[^0-9]/g,``)},As=e=>Array.from(e.querySelectorAll(`.author-source-list li a`)).filter(e=>e.childNodes.length>0).map(e=>e.childNodes[0].textContent?.trim()).filter(e=>!!e),js=e=>e.querySelector(`.article-header`)?.querySelector(`h1 span`)?.textContent.trim(),Ms=e=>({date:e?.textContent.match(/\d{4}/)?.[0],pub:`Elsevier Inc.`}),Ns=e=>{let t=e.querySelector(`.article-meta`);if(!t)return{};let n=t.querySelector(`.issue`)?.textContent??void 0,r=t.querySelector(`.title`)?.textContent.trim()??void 0,[i,a]=(n?.split(`,`)??[]).map(e=>e.trim());return{volume:ks(i),issue:ks(a),jtitle:r}},Ps=e=>{let t=e.querySelector(`.article-header .source`)?.textContent,n=t?.match(/\d{4}-\d{2}-\d{2}/)?.[0],[r,i]=((t?.match(/Pages (\d+-\d+)/))?.[1].split(`-`)??[]).map(e=>e.trim()),{jtitle:a,volume:o,issue:s}=Ns(e);return B(L(F.Article,{au:As(e),atitle:js(e),spage:r,epage:i,date:n,jtitle:a,volume:o,issue:s}))},Fs=e=>{let[t,n]=e.querySelectorAll(`.source`),{date:r,pub:i}=Ms(n),[a,o]=(e.querySelector(`.browse__book-toc`)?.querySelector(`h1`)?.textContent.split(`,`)??[]).map(e=>e.trim());return B(I(F.Book,{btitle:a,edition:o,pub:i,au:t.textContent?[t.textContent]:void 0,date:r}))},Is=e=>{let t=e.querySelector(`.article-meta`);if(!t)return{};let n=t.querySelector(`.edition`)?.textContent??void 0,r=t.querySelector(`.title`)?.textContent.trim()??void 0,{date:i,pub:a}=Ms(t.querySelector(`.copyright`));return{edition:n,btitle:r,date:i,pub:a}},Ls=e=>{let{edition:t,btitle:n,date:r,pub:i}=Is(e),[a,o]=(((e.querySelector(`.article-header .source`)?.textContent)?.match(/(\d+-\d+|[IVXLCDM]+-[IVXLCDM]+)/i))?.[1].split(`-`)??[]).map(e=>e.trim());return B(I(F.Bookitem,{au:As(e),atitle:js(e),btitle:n,edition:t,pub:i,date:r,spage:a,epage:o}))},Rs=/^[0-9X]$/,zs=e=>{if(!e)return;let t=``;for(let n of e)Rs.test(n)&&(t+=n);if(t)return t},Bs=(e,t)=>{let n=e.querySelector(`.c-cksc-content-header__title`)?.textContent.trim(),r=e.querySelector(`.c-cksc-content-nice__button`)?.textContent.trim(),i=e.querySelector(`.c-cksc-content-nice__date`)?.textContent.trim(),a=zs(e.evaluate(`//p[contains(text(), "ISBN")]`,e,null,XPathResult.ANY_TYPE).iterateNext()?.textContent);return B({genre:F.Document,title:n,pub:r,date:i,uri:t,isbn:a})},Vs=e=>e.querySelector(`.browse-toc`)??e.querySelector(`.browse__journal`),Hs=e=>(Vs(e)?.querySelector(`h1`)?.firstElementChild)?.textContent.trim(),Us=e=>{let t=Vs(e),n=t?.querySelector(`figure figcaption.source`);if(n){let[e,t,r]=n.textContent.split(`,`).map(e=>e.trim());return{date:e,volume:ks(t),issue:ks(r)}}let[r,i]=(t?.querySelector(`p`)?.textContent)?.split(`,`)??[];return{date:t?.querySelector(`.source span`)?.textContent??void 0,volume:ks(r),issue:ks(i)}},Ws=e=>{let{date:t,volume:n,issue:r}=Us(e);return B(L(F.Journal,{jtitle:Hs(e),date:t,volume:n,issue:r}))},Gs=function(e){return e.Book=`Book`,e.Chapter=`Book Chapter`,e.Article=`Full Text Article`,e.Journal=`Journal`,e.Guideline=`Guideline`,e}(Gs||{}),Ks=e=>Object.values(Gs).includes(e),qs=(e,t)=>{let n=e.querySelector(`.content-type`)??e.querySelector(`.c-cksc-content-header__content-type`);if(!n)return t.includes(`journal`)?Gs.Journal:void 0;let r=n.textContent;if(r&&Ks(r))return r},Js=({url:e,document:t})=>{switch(qs(t,e)){case Gs.Book:return Fs(t);case Gs.Chapter:return Ls(t);case Gs.Article:return Ps(t);case Gs.Journal:return Ws(t);case Gs.Guideline:return Bs(t,e);case void 0:return z()}},Ys=j({"@context":O()}),Xs=e=>Ys.safeParse(e).success,Zs=`script[type="application/ld+json"]`,Qs=e=>Array.from(e.querySelectorAll(Zs)),$s=e=>e.querySelector(Zs),ec=e=>{let t=e.textContent;if(!t)return null;try{let e=JSON.parse(t);if(Xs(e))return e}catch{return null}return null},tc=j({"@id":O(),"@type":O(),author:j({"@id":O()}).optional(),datePublished:O().optional(),dateModified:O().optional(),description:O().optional(),inLanguage:O().optional(),isPartOf:j({"@id":O()}).optional(),name:O().optional(),url:O().optional()}),nc=Ys.extend({"@graph":A(tc)}),rc=e=>nc.safeParse(e).success,ic=e=>{let t=Qs(e);if(t.length===0)return null;let n=t.map(ec).filter(rc).map(e=>e[`@graph`]);return n.length===1?n[0]:null},ac=(e,t)=>e.find(e=>e[`@type`]===t)??null,oc=(e,t)=>e.find(e=>e[`@id`]===t)??null,sc=e=>{let t=ac(e,`WebPage`);if(!t)return null;let n=t.author?oc(e,t.author[`@id`]):void 0;return vo({au:n?.name?[n.name]:void 0,date:t.datePublished,title:t.name})},cc=({document:e})=>{let t=ic(e);return t?{bookmarkingWorkflowUrl:null,resource:sc(t)}:z()},lc=()=>z(),uc=function(e){return e.Journal=`journal`,e.Article=`article`,e}(uc||{}),dc=e=>{let{pathname:t}=new URL(e);if(t.startsWith(`/toc/`))return uc.Journal;if(t.startsWith(`/article/`))return uc.Article},fc=e=>{let t=e.querySelector(`header h1 span`)?.firstChild?.textContent?.trim(),n=(e.querySelector(`header p span`)?.textContent.trim())?.match(/\d{4}-\d{3}[\dX]/g)??[],[r,i]=[n[0],n[1]],a=e.evaluate(`//dt[contains(text(), "Publisher")]/following-sibling::dd/a`,e,null,XPathResult.STRING_TYPE).stringValue.trim();return B(L(F.Journal,{pub:a,jtitle:t,issn:r,eissn:i}))},pc=e=>{let t,n,r=H(e,`name`,`citation_issn`);return r.length===2?(t=r[1],n=r[0]):t=r[0],{eissn:t,issn:n}},mc=e=>{let t=V(e,`name`,`citation_journal_title`),n=V(e,`name`,`citation_title`),r=H(e,`name`,`citation_author`),i=V(e,`name`,`citation_doi`),{eissn:a,issn:o}=pc(e),s=V(e,`name`,`citation_publisher`),c=V(e,`name`,`citation_publication_date`),l=V(e,`name`,`citation_volume`),u=V(e,`name`,`citation_issue`),d=V(e,`name`,`citation_firstpage`),f=V(e,`name`,`citation_lastpage`);return B(L(F.Article,{jtitle:t,atitle:n,au:r,doi:i,eissn:a,issn:o,pub:s,date:c,volume:l,issue:u,spage:d,epage:f}))},hc=({document:e,url:t})=>{switch(dc(t)){case uc.Journal:return fc(e);case uc.Article:return mc(e);case void 0:return z()}},gc=e=>{let t=V(e,`name`,`pbContext`);if(!t)return U.None;let n=fs(t);switch(n.has(`page`)?n.get(`page`)?.value:null){case`Article/Chapter View`:return U.Article;case`Table of Contents`:return U.Journal;default:return U.None}},_c=e=>{let t=e.querySelector(`meta[property="article:author"]`)?.getAttribute(`content`)?.split(`,`).map(e=>e.trim());return t&&t.length>0?t:void 0},vc=e=>{let t=new Map,n=Array.from(e.querySelectorAll(`.rlist>li>span`)).map(e=>e.textContent.trim()).join(``),r=/^ISSN:\s(\d{4}-\d{3}(?:\d|X))/.exec(n);r&&t.set(`issn`,r[1]);let i=/Online ISSN:\s(\d{4}-\d{3}(?:\d|X))/.exec(n);return i&&t.set(`eissn`,i[1]),t},yc=e=>e.querySelector(`span[property="isPartOf"][typeof="PublicationVolume"] > span[property="volumeNumber"]`)?.textContent??void 0,bc=e=>e.querySelector(`span[property="isPartOf"][typeof="PublicationIssue"] > span[property="issueNumber"]`)?.textContent??void 0,xc=e=>e.querySelector(`meta[name="dc.Identifier"][scheme="doi"]`)?.getAttribute(`content`)??void 0,Sc=e=>e.querySelector(`h1`)?.textContent??void 0,Cc=e=>{let t=new Map,n=e.querySelector(`h2.heading-m`)?.textContent,r=n?.match(/Issue\s+(\d+(?:-\d+)?)/);r&&t.set(`issue`,r[1]);let i=n?.match(/Volume\s+(\d+)/);i&&t.set(`volume`,i[1]);let a=n?.match(/(\d{4})$/);return a&&t.set(`date`,a[1]),t},wc=e=>{let t=_c(e.document),n=V(e.document,`name`,`dc.Date`),r=xc(e.document),i=vc(e.document),a=i.get(`issn`),o=i.get(`eissn`),s=bc(e.document),c=V(e.document,`name`,`citation_journal_title`),l=V(e.document,`name`,`dc.Publisher`),u=V(e.document,`name`,`dc.Title`),d=yc(e.document);return L(F.Article,{au:t,date:n,eissn:o,issn:a,issue:s,jtitle:c,pub:l,title:u,volume:d,doi:r})},Tc=e=>{let t=vc(e.document),n=t.get(`issn`),r=t.get(`eissn`),i=Sc(e.document),a=Cc(e.document),o=a.get(`issue`),s=a.get(`volume`),c=a.get(`date`);return L(F.Journal,{eissn:r,issn:n,jtitle:i,title:i,issue:o,volume:s,date:c})},Ec=e=>{switch(gc(e.document)){case U.Article:return B(wc(e));case U.Journal:return B(Tc(e));default:return z()}},Dc=e=>{let t=V(e,`name`,`citation_type`),n=V(e,`name`,`citation_article_type`);return t===`JOUR`&&n?U.Article:t===`CHP`?U.Chapter:e.querySelector(`.book-edition-year`)?.textContent.includes(`Book`)?U.Book:e.getElementById(`journal-title`)?U.Journal:U.None},Oc=e=>V(e,`name`,`citation_doi`)??V(e,`name`,`dc.identifier`)??e.querySelector(`.doi .anchor-text`)?.textContent??void 0,kc=e=>{let t=Array.from(e.querySelectorAll(`.kf-details .kf-detail-item:has(h3)`)),n=new Map;for(let e of t){let t=e.querySelector(`h3`)?.textContent,r=e.querySelector(`p`)?.textContent;t&&r&&n.set(t,r)}return n},Ac=(e,t)=>{let n=Array.from(e.querySelectorAll(t)).map(e=>e.textContent).filter(e=>!!e);return n.length>0?n:void 0},jc=e=>{let t=e.querySelector(`.js-issn`)?.textContent;if(t)return t.replace(`Online ISSN: `,``)},Mc=e=>{let t=e.get(`DOI`);if(t)return URL.canParse(t)?new URL(t).pathname.substring(1):t},Nc=e=>{let t=kc(e),n=V(e,`property`,`og:title`),r=V(e,`property`,`og:book:isbn`),i=t.get(`Published`),a=Ac(e,`.authors-container .author-detail h3`),o=Oc(e)??Mc(t);return I(F.Book,{au:a,date:i,doi:o,isbn:r,title:n})},Pc=e=>{let t=V(e,`property`,`og:title`),n=V(e,`property`,`og:book:isbn`),r=V(e,`name`,`citation_publication_date`),i=Ac(e,`.author-group .button-link-text`),a=V(e,`name`,`citation_firstpage`),o=V(e,`name`,`citation_lastpage`),s=V(e,`name`,`citation_publisher`),c=Oc(e),l=V(e,`name`,`citation_inbook_title`)??e.querySelector(`.publication-title`)?.textContent??void 0;return I(F.Bookitem,{au:i,btitle:l,date:r,doi:c,epage:o,isbn:n,pub:s,spage:a,title:t})},Fc=e=>{let t=V(e,`property`,`og:title`),n=V(e,`name`,`citation_issn`),r=V(e,`name`,`citation_publication_date`),i=Ac(e,`.author-group .button-link-text`),a=V(e,`name`,`citation_publisher`),o=V(e,`name`,`citation_firstpage`),s=V(e,`name`,`citation_issue`),c=V(e,`name`,`citation_volume`),l=Oc(e),u=V(e,`name`,`citation_journal_title`)??e.querySelector(`.publication-title`)?.textContent??void 0;return L(F.Article,{au:i,jtitle:u,date:r,doi:l,issn:n,issue:s,pub:a,spage:o,title:t,volume:c})},Ic=e=>{let t=e.getElementById(`journal-title`)?.textContent??void 0,n=jc(e);return L(F.Journal,{issn:n,title:t})},Lc=({document:e})=>{switch(Dc(e)){case U.Book:return B(Nc(e));case U.Chapter:return B(Pc(e));case U.Article:return B(Fc(e));case U.Journal:return B(Ic(e));default:return z()}},Rc=e=>{let t=V(e,`name`,`pbContext`);return t&&fs(t).has(`article`)?U.Article:U.Journal},zc=e=>{let t=e.querySelector(`.itemPageRangeHistory`);if(!t)return;let n=Array.from(t.childNodes).find(e=>e.textContent?.trim().startsWith(`Page`));if(n)return n.textContent?.replace(/Pages?/,``).trim()??void 0},Bc=e=>{let t=e.querySelector(`.issue-heading`)?.textContent;if(t)return t.split(`,`)[0]?.replace(`Volume`,``).trim()},Vc=e=>{let t=e.querySelector(`.issue-heading .nav-toc-list`)?.textContent;if(t)return t.replace(`Issue`,``).trim()},Hc=e=>{let t=V(e,`property`,`og:title`),n=V(e,`name`,`dc.Publisher`),r=V(e,`name`,`dc.Date`),i=V(e,`name`,`publication_doi`),a=V(e,`name`,`citation_journal_title`),o=H(e,`name`,`dc.Creator`),s=Bc(e),c=Vc(e),l=zc(e),u=l?.includes(`-`)?l.split(`-`)[0]:l,d=l?.includes(`-`)?l.split(`-`)[1]:l;return L(F.Article,{au:o,jtitle:a,date:r,doi:i,issue:c,pub:n,spage:u,epage:d,title:t,volume:s})},Uc=e=>{let t=V(e,`property`,`og:title`),n=V(e,`name`,`publication_doi`);return L(F.Journal,{doi:n,title:t})},Wc=({document:e})=>{switch(Rc(e)){case U.Article:return B(Hc(e));case U.Journal:return B(Uc(e));default:return z()}},Gc=e=>Zo.safeParse(e).success,Kc=e=>Qo.safeParse(e).success,qc=e=>Go.safeParse(e).success;function Jc(e){return qo.safeParse(e).success}function Yc(e){return Jo.safeParse(e).success}function Xc(e){return Yo.safeParse(e).success}function Zc(e){return Xo.safeParse(e).success}function Qc(e){return Ko.safeParse(e).success}var $c=e=>Array.from(e.querySelectorAll(`tr th`)).find(e=>e.textContent.trim()===`DOI:`)?.nextElementSibling?.querySelector(`span[property="identifier"]`)?.textContent??void 0,el=e=>{let t=/Record\/(\d+)/.exec(e);if(t&&t.length>1)return t[1]},tl=e=>{let{url:t,document:n}=e,r=rs(e);if(!Yc(r))return r;let i=$c(n);return i&&(r.resource.rft_id=[`info:doi/${i}`]),r.resource.bibid=el(t),r},nl=Ys.extend({"@type":N(`VideoObject`),name:O(),author:O(),genre:O(),description:O(),uploadDate:O(),duration:O(),thumbnailUrl:A(O())}),rl=e=>nl.safeParse(e).success,il=e=>{let t=Qs(e);if(t.length===0)return null;let n=t.map(ec).filter(rl);return n.length===1?n[0]:null},al=({url:e,document:t})=>{let n=il(t);return n?{bookmarkingWorkflowUrl:null,resource:R({au:[n.author],date:n.uploadDate,title:n.name,uri:e})}:z()},ol=e=>V(e,`name`,`doi`)??V(e,`name`,`DOI`)??V(e,`name`,`citation_doi`)??V(e,`name`,`dc.identifier`)??V(e,`name`,`prism.doi`)??void 0,sl=e=>{let t=e.editor?.map(e=>e.name)??[],n=[...e.author?.map(e=>e.name)??[],...t];if(n.length!==0)return n},cl=function(e){return e.Book=`Book`,e.Journal=`Journal`,e.Periodical=`Periodical`,e.PublicationVolume=`PublicationVolume`,e.ScholarlyArticle=`ScholarlyArticle`,e.VideoObject=`VideoObject`,e.WebPage=`WebPage`,e}({}),ll=function(e){return e.Article=`article`,e.Book=`book`,e.Paper=`Paper`,e.Video=`video.other`,e.Website=`website`,e}({}),W=function(e){return e.Article=`/article/`,e.Book=`/book/`,e.Chapter=`/chapter/`,e.Video=`/video/`,e.ReferenceWorkEntry=`/referenceworkentry/`,e.ReferenceWork=`/referencework/`,e.Protocol=`/protocol/`,e.Collections=`/collections/`,e.Journal=`/journal/`,e.JournalIssue=`/volumes-and-issues/`,e}({}),ul=j({"@type":N(cl.ScholarlyArticle),author:A(j({"@type":O(),name:O()})).optional(),editor:A(j({"@type":O(),name:O()})).optional(),datePublished:O().optional(),headline:O().optional(),issn:A(O()).optional(),pageStart:O().optional(),pageEnd:O().optional(),isPartOf:j({"@type":M([O(),A(O())]),name:O(),issn:A(O()).optional(),volumeNumber:O().optional(),isbn:A(O()).optional()}),publisher:j({"@type":O(),name:O()}).optional()}),dl=e=>ul.safeParse(e).success,fl=Ys.extend({"@type":N(cl.WebPage),mainEntity:ul}),pl=e=>fl.safeParse(e).success,ml=j({"@type":A(O()),name:O().optional(),issn:A(O()),volumeNumber:O().optional()}),hl=e=>ml.safeParse(e).success,gl=(e,t)=>V(e,`name`,`citation_issn`)??V(e,`name`,`prism.issn`)??(dl(t.isPartOf)?t.isPartOf.issn?.[0]:void 0),_l=(e,t)=>{let n=sl(t),r=V(e,`name`,`citation_online_date`),i=ol(e),a=V(e,`name`,`citation_issue`),o=gl(e,t),s=hl(t.isPartOf)&&t.isPartOf.issn.length>0?t.isPartOf.issn[1]:void 0,c=t.pageStart,l=t.pageEnd,u=t.headline,d=t.isPartOf.name,f=hl(t.isPartOf)?t.isPartOf.volumeNumber:void 0;return L(F.Article,{au:n,date:r,doi:i,issue:a,eissn:o,issn:s,spage:c,epage:l,atitle:u,jtitle:d,volume:f})},vl=Ys.extend({"@type":N(cl.Book),copyrightYear:O().optional(),author:A(j({"@type":O(),name:O()})).optional(),editor:A(j({"@type":O(),name:O()})).optional(),isbn:O().optional(),name:O().optional(),numberOfPages:ga().optional(),publisher:j({"@type":O(),name:O()}).optional()}),yl=e=>vl.safeParse(e).success,bl=function(e){return e.BOOK_TITLE=`Book Title`,e.AUTHORS=`Authors`,e.SERIES_TITLE=`Series Title`,e.DOI=`DOI`,e.PUBLISHER=`Publisher`,e.SOFTCOVER_ISBN=`Softcover ISBN`,e.EBOOK_ISBN=`eBook ISBN`,e.SERIES_ISSN=`Series ISSN`,e.SERIES_EISSN=`Series E-ISSN`,e.EDITION_NUMBER=`Edition Number`,e.NUMBER_OF_PAGES=`Number of Pages`,e}(bl||{}),xl=e=>{let t=e.querySelectorAll(`.c-bibliographic-information__list-item`),n=new Map;return t.forEach(e=>{let t=e.querySelector(`.u-text-bold`)?.textContent.trim(),r=e.querySelector(`.c-bibliographic-information__value`)?.textContent.trim();t&&r&&n.set(t,r)}),n},Sl=(e,t)=>{let n=xl(e),r=sl(t),i=t.copyrightYear?.toString(),a=ol(e)??n.get(bl.DOI),o=t.name??n.get(bl.BOOK_TITLE),s=t.isbn??n.get(bl.SOFTCOVER_ISBN),c=t.numberOfPages?.toString()??n.get(bl.NUMBER_OF_PAGES),l=t.publisher?.name??n.get(bl.PUBLISHER);return I(F.Book,{au:r,date:i,doi:a,title:o,isbn:s,tpages:c,pub:l})},Cl=j({"@type":N(`Periodical`),name:O(),url:O(),issn:A(O()),editor:A(j({givenName:O(),familyName:O()})),publisher:j({name:O()}),description:O()}),wl=e=>Cl.safeParse(e).success,Tl=e=>{let t=e.editor.map(({givenName:e,familyName:t})=>`${e} ${t}`),n=e.name,[r,i]=e.issn,a=e.publisher.name;return L(F.Journal,{au:t,jtitle:n,eissn:r,issn:i,pub:a})},El=j({"@type":N(cl.VideoObject),name:O().optional(),description:O().optional(),thumbnailUrl:O().optional(),uploadDate:O().optional(),contentUrl:O().optional(),duration:O().optional()}),Dl=e=>El.safeParse(e).success,Ol=(e,t)=>{let n=Array.from(e.querySelectorAll(`dd[data-test="video-segment-author"]`)).map(e=>e.textContent.trim()).filter(e=>!!e),r=t?.uploadDate?new Date(t.uploadDate).getFullYear().toString():void 0,i=t?.name??V(e,`property`,`og:title`)??void 0,a=e.querySelector(`video-about-doi`)?.textContent??void 0;return R({au:n.length>0?n:void 0,date:r,doi:a,title:i})},kl=e=>vo({title:V(e,`property`,`og:title`)}),Al=(e,t)=>{let n=V(t,`property`,`og:type`);return n===ll.Article&&e.includes(W.Article)?U.Article:n===ll.Book&&(e.includes(W.Book)||e.includes(W.ReferenceWork))?U.Book:n===ll.Paper&&e.includes(W.Chapter)?U.Chapter:n===ll.Paper&&(e.includes(W.ReferenceWorkEntry)||e.includes(W.Protocol))?U.Article:n===ll.Video&&e.includes(W.Video)?U.AudioVisual:n===ll.Website&&(e.includes(W.Collections)||e.includes(W.JournalIssue))?U.Webpage:n===ll.Website&&e.includes(W.Journal)?U.Journal:U.None},jl=(e,t,n)=>e===U.AudioVisual&&Dl(n)?B(Ol(t,n)):e===U.Book&&yl(n)?B(Sl(t,n)):(e===U.Chapter||e===U.Article)&&dl(n)?B(_l(t,n)):e===U.Article&&pl(n)?B(_l(t,n.mainEntity)):e===U.Journal&&wl(n)?B(Tl(n)):z(),Ml=({url:e,document:t})=>{let n=Al(e,t);if(n===U.Webpage)return B(kl(t));let r=$s(t);if(!r)return z();let i=ec(r);return i?jl(n,t,i):z()},G=function(e){return e.PrintIsbn=`Print ISBN`,e.OnlineIsbn=`Online ISBN`,e.Doi=`DOI`,e.FirstPublished=`First published`,e.OnlineIssn=`Online ISSN`,e.PrintIssn=`Print ISSN`,e}(G||{}),Nl=new Set([G.PrintIsbn,G.OnlineIsbn,G.Doi,G.FirstPublished,G.OnlineIssn,G.PrintIssn]),Pl=j({content:j({item:j({title:O(),"published-date":O()}),group:j({volume:O(),issue:O()}),series:j({title:O(),type:O(),eissn:O()})}).optional()}),Fl=(e,t)=>{if(!e)return;let n=e.indexOf(t);return n>-1?e.substring(0,n):e},Il=e=>{let t=/\d+/.exec(e);if(t?.[0])return t[0]},Ll=e=>{let t=e.querySelectorAll(`script`),n=Array.from(t).find(e=>e.textContent.includes(`adobeDataLayerJson`))?.textContent.match(/var adobeDataLayerJson = (\{.*?});/s);if(n?.length===2)try{let e=JSON.parse(n[1]);return Pl.parse(e)}catch{return}},Rl=(e,t)=>{let n=V(e,`property`,`og:type`),r=t.includes(`epdf`);return n===`Book`||n===`books.book`?U.Book:n===`Chapter`?U.Chapter:n===`Journal`?U.Journal:n===`Article`||r?U.Article:U.None},zl=e=>{let t=H(e,`name`,`citation_author`),n=Array.from(e.querySelectorAll(`#product-details-content .product-authors`)).map(e=>e.textContent).filter(e=>!!e),r=new Set([...t,...n]);return r.size>0?[...r]:void 0},Bl=e=>{let t=Array.from(e.querySelectorAll(`#product-details-content .text-piped p`)).map(e=>e.textContent).find(e=>e.endsWith(` pages`));if(t)return Il(t)},Vl=e=>{let t=new Map,n=Array.from(e.querySelectorAll(`.journal-info-container .info-block`)).flatMap(e=>Array.from(e.querySelectorAll(`.info_label`)));for(let e of n){let n=e.nextElementSibling;if(!n?.classList.contains(`info_value`))continue;let r=Fl(e.textContent,`:`),i=Fl(n.textContent,`:`);!r||!i||Nl.has(r)&&t.set(r,i)}return t},Hl=(e,t)=>V(e,`property`,`books:release_date`)??V(e,`name`,`citation_online_date`)??t.get(G.FirstPublished)??void 0,Ul=(e,t)=>V(e,`name`,`dc.identifier`)??V(e,`name`,`citation_doi`)??V(e,`name`,`publication_doi`)??t.get(G.Doi)??void 0,Wl=(e,t)=>{let n=new Set([V(e,`property`,`books:isbn`),t.get(G.PrintIsbn),t.get(G.OnlineIsbn)].filter(e=>!!e));return n.size>0?[...n].join(`,`):void 0},Gl=e=>{let t,n,r=e.querySelector(`.cover-image__details div:first-of-type`);if(r?.childNodes.length===2){let[e,i]=r.childNodes;e.textContent&&(t=Il(e.textContent)),i.textContent&&(n=Il(i.textContent))}return{volume:t,issue:n}},Kl=e=>{let t=Array.from(e.querySelectorAll(`.authors .author`)).map(e=>e.textContent.trim().replace(`,`,``)).filter(e=>!!e);return t.length>0?t:void 0},ql=e=>{let t=Array.from(e.querySelectorAll(`.details-section .details-entry`)),n=t.find(e=>e.querySelector(`.details-label`)?.textContent.trim()===`ISSN`),r=t.find(e=>e.querySelector(`.details-label`)?.textContent.trim()===`eISSN`),i,a;return n&&(i=n.querySelector(`.details-value`)?.textContent.trim()),r&&(a=r.querySelector(`.details-value`)?.textContent.trim()),{issn:i,eissn:a}},Jl=e=>{if(!e?.content?.group)return{volume:void 0,issue:void 0};let t=e.content.group.volume,n=e.content.group.issue;return n===`0`&&t===`0`?{volume:void 0,issue:void 0}:{volume:t,issue:n}},Yl=e=>{let[t,n]=((Array.from(e.querySelectorAll(`.details-section .details-entry`)).find(e=>e.querySelector(`.details-label`)?.textContent.trim()===`Pages`)?.querySelector(`.details-value`)?.textContent.trim())?.split(`-`)??[void 0,void 0]).map(e=>e?.trim());return t?.toLowerCase()===`n/a`&&n?.toLowerCase()===`n/a`?{spage:void 0,epage:void 0}:{spage:t,epage:n}},Xl=e=>{let t=Vl(e),n=zl(e),r=V(e,`property`,`og:title`),i=Hl(e,t),a=Ul(e,t),o=Wl(e,t),s=Bl(e);return I(F.Book,{au:n,date:i,doi:a,isbn:o,pages:s,title:r})},Zl=e=>{let t=Vl(e),n=zl(e),r=V(e,`name`,`citation_book_title`),i=Hl(e,t),a=Ul(e,t),o=Wl(e,t),s=V(e,`name`,`citation_publisher`),c=V(e,`property`,`og:title`);return I(F.Bookitem,{au:n,btitle:r,date:i,doi:a,isbn:o,pub:s,title:c})},Ql=e=>{let t=Vl(e),n=zl(e),r=Hl(e,t),i=t.get(G.OnlineIssn),a=t.get(G.PrintIssn),o=V(e,`property`,`og:title`),{volume:s,issue:c}=Gl(e);return L(F.Journal,{au:n,date:r,eissn:i,issn:a,issue:c,title:o,volume:s})},$l=e=>{let t=Vl(e),n=Ll(e),r=zl(e)??Kl(e),i=Hl(e,t)??n?.content?.item[`published-date`],a=Ul(e,t),{issn:o,eissn:s}=ql(e),{volume:c,issue:l}=Jl(n),u=V(e,`property`,`og:title`)??n?.content?.item.title,d=V(e,`name`,`citation_journal_title`)??n?.content?.series.title,{spage:f,epage:p}=Yl(e);return L(F.Article,{au:r,date:i,doi:a,eissn:s,issn:o??V(e,`name`,`citation_issn`),issue:l,jtitle:d,title:u,volume:c,spage:f,epage:p})},eu=({document:e,url:t})=>{switch(Rl(e,t)){case U.Book:return B(Xl(e));case U.Chapter:return B(Zl(e));case U.Journal:return B(Ql(e));case U.Article:return B($l(e));default:return z()}},tu=e=>{let t=H(e,`name`,`citation_author`);return t.length>0?t:void 0},nu=({document:e})=>B(R({au:tu(e),date:V(e,`name`,`citation_publication_date`),doi:V(e,`name`,`citation_doi`),isbn:V(e,`name`,`citation_isbn`),pub:V(e,`name`,`citation_publisher`),title:V(e,`name`,`citation_title`)??e.title})),ru=({document:e})=>Array.from(e.querySelectorAll(`.Z3988`)).length<=1?z():es(),iu=e=>{if(!(!e||e.length===0))return e[0]};function au(e,t){return iu(t.map(t=>{let n=e.querySelector(t)?.textContent??null;if(n&&n.trim()!==``)return n}).filter(e=>e))??null}function ou(e,t){let n=t.flatMap(t=>Array.from(e.querySelectorAll(t)).flatMap(e=>{let t=e.textContent;return t&&t.trim()!==``?t.split(`;`).map(e=>e.trim()).filter(e=>e.length>0):[]}));return n.length>0?n:null}var su=(e,t)=>au(e,[t])?.trim(),cu=e=>{let t=e.querySelector(`.content-meta-data__authors`)?.textContent;if(t)return t.split(/,\s+|\s+and\s+/).filter(e=>!!e)},lu=e=>{let t=Array.from(e.querySelectorAll(`.tombstone-metadata [data-qa="item-authors"]`)).map(e=>e.textContent).filter(e=>!!e);return t.length?t:void 0},uu=e=>{let t=Array.from(e.querySelectorAll(`.item-authors [data-qa="item-contributors"], .item-authors [data-qa="item-creators"]`)).map(e=>e.textContent).filter(e=>!!e);return t.length?t:void 0},du=e=>{let t=Array.from(e.querySelectorAll(`.contrib-type-author .name`)).map(e=>e.textContent).filter(e=>!!e);return t.length?t:void 0},fu=e=>{let t=new Set([...uu(e)??[],...cu(e)??[],...du(e)??[],...lu(e)??[]]);return t.size?[...t]:void 0},pu=(e,t)=>e.querySelector(`[data-qa="published-date"]`)?.textContent??e.querySelector(`.summary-image`)?.textContent??_u(t?.get(`date`))??_u(t?.get(`copyright date`))??_u(t?.get(`published date`)),mu=e=>{let t=e.find(e=>e.startsWith(`https://doi.org/`));if(t)return t.replace(`https://doi.org/`,``)},hu=e=>{let t=e.get(`local identifier`);if(t?.length)return mu(t)},gu=e=>e.querySelector(`.doi`)?.getAttribute(`href`)??void 0,_u=e=>{if(e?.length)return e[0]},vu=e=>{let t=new Map;return Array.from(e.querySelectorAll(`.metadata-element, .metadata`)).map(e=>({name:e.querySelector(`.metadata-label`)?.textContent.trim().toLowerCase(),values:Array.from(e.querySelectorAll(`.metadata-value`)).map(e=>e.textContent).filter(e=>!!e)})).forEach(({name:e,values:n})=>{!e||!n.length||t.set(e,n)}),t},yu=e=>{let t=vu(e),n=e.querySelector(`.summary-journal`),r=Array.from(n?.childNodes??[]),i=r[0]?.textContent??e.querySelector(`.journal-link`)?.textContent??void 0,a=r[2]?.textContent?.replace(/Published By:\s+?/i,``)??_u(t.get(`publisher`))??e.querySelector(`.publisher-link`)?.textContent??void 0;return{pub:a&&a.trim()!==``?a:void 0,jtitle:i&&i.trim()!==``?i:void 0}},bu=e=>{let t=au(e,[`[data-qa="journal"]:first-child cite`,`[data-qa="copyright-statement"] > cite`,`[data-qa="collection-links"] mfe-content-details-pharos-link`]);return t&&t.trim()!==``?t:void 0},xu=e=>ks(e.querySelector(`[data-qa="page-count"]`)?.textContent),Su=(e,t)=>e.querySelector(`.publisher-link`)?.textContent??_u(t?.get(`publisher`)),Cu=e=>e.querySelector(`[data-qa="item-title"]`)?.textContent.trim()??e.querySelector(`mfe-turnaway-pharos-heading`)?.textContent.trim()??e.querySelector(`.metadata mfe-toc-pharos-heading`)?.textContent.trim()??e.querySelector(`.journal_header-title`)?.textContent.trim()??void 0,wu=e=>{if(!URL.canParse(e))return;let t=new URL(e);return t.origin+t.pathname},Tu=e=>{let t=e.querySelector(`.ccda-container > :first-child`),n,r;if(t?.textContent.includes(`Volume`)||t?.textContent.includes(`Issue`)){let e=t.textContent.trim().split(/,\s+/);for(let t of e)t.startsWith(`Volume`)?r=ks(t):t.startsWith(`Issue`)&&(n=ks(t))}return{issue:n,volume:r}},Eu=e=>{let t=e.querySelector(`[data-qa="item-src-info"]`)?.textContent??V(e,`property`,`og:description`)??V(e,`name`,`description`);if(!t)return{};let n=/Vol\.\s*(\d+)/.exec(t),r=n?n[1]:void 0,i=/No\.\s*(\d+)/.exec(t),a=i?i[1]:void 0,o=/pp\.\s*(\d+)-(\d+)/.exec(t),s=o?o[1]:void 0,c=o?o[2]:void 0,l=/pp\.\s*\d+-\d+\s*\((\d+)\s*pages\)/.exec(t);return{issue:a,volume:r,spage:s,epage:c,pages:l?l[1]:void 0}},Du=e=>{let t=au(e,[`mfe-turnaway-pharos-link`,`[data-qa="item-src-info"]`]);if(!t)return;let n=/\(.+\)/.exec(t)?.map(e=>{let t=/\d{4}/.exec(e);return t?t[0]:void 0});return iu(n)},Ou=(e,t)=>{let n=Cu(e),r=fu(e),i=pu(e)??Du(e),a=yu(e),o=a.jtitle??bu(e)??void 0,s=a.pub,c=Tu(e),l=Eu(e),u=c.issue??l.issue,d=c.volume??l.volume,f=xu(e)??l.pages,p=l.spage,m=l.epage,h=wu(t),g=mu(Array.from(e.querySelector(`.content-meta-data-stables`)?.childNodes??[]).map(e=>e.textContent??``))??gu(e);return L(F.Article,{atitle:n,au:r,date:i,doi:g,epage:m,issue:u,jtitle:o,pages:f,pub:s,spage:p,uri:h,volume:d})},ku=(e,t)=>{let n=vu(e),r=fu(e),i=pu(e,n),a=Cu(e);return R({au:r,date:i,pub:Su(e,n),title:a,uri:wu(t)})},Au=(e,t)=>{let n=vu(e),r=fu(e),i=Cu(e),a=pu(e),o=xu(e),s=Su(e,n),c=wu(t),l=hu(n);return I(F.Book,{au:r,date:a,doi:l,pages:o,pub:s,title:i,uri:c})},ju=(e,t)=>{let n=vu(e),r=fu(e),i=Cu(e),a=e.querySelector(`.book-title-link`)?.textContent??void 0,o=pu(e,n),s=Array.from(e.querySelectorAll(`[data-qa="book"] > span`)).map(e=>e.textContent),c=xu(e),l=s.find(e=>e.includes(`pp.`))?.match(/(\d+)-(\d+)/)??void 0,u=Su(e,n),d=wu(t);return I(F.Bookitem,{atitle:i,au:r,btitle:a,date:o,epage:l?.[2],pub:u,pages:c,spage:l?.[1],uri:d})},Mu=(e,t)=>{let n=vu(e),r=fu(e),i=Cu(e),a=pu(e),o=xu(e),s=Su(e,n),c=wu(t),l=hu(n);return I(F.Document,{au:r,date:a,doi:l,pages:o,pub:s,title:i,uri:c})},Nu=(e,t)=>{let n=vu(e);return go({au:fu(e),date:pu(e,n),title:Cu(e),uri:wu(t)})},Pu=(e,t)=>{let{pub:n}=yu(e),r=Cu(e),i=e.querySelector(`.eissn`)?.textContent.replace(/EISSN\s+/,``).trim()??void 0,a=e.querySelector(`.issn`)?.textContent.replace(/ISSN\s+/,``).trim()??void 0,o=wu(t);return L(F.Journal,{eissn:i,issn:a,jtitle:r,pub:n,uri:o})},K=function(e){return e.Article=`journal article`,e.Audio=`audio`,e.Book=`book`,e.Chapter=`book chapter`,e.Document=`document`,e.Image=`image`,e.Journal=`journal`,e.ResearchReport=`research report`,e.Serial=`serial`,e.Video=`video`,e}({}),Fu=(e,t)=>{let n=vu(e),r=fu(e),i=pu(e,n),a=Cu(e);return R({au:r,date:i,pub:Su(e,n),title:a,uri:wu(t)})},Iu=e=>Object.values(K).includes(e),Lu=e=>{if(e.querySelector(`.journal_header-title`))return K.Journal;if(e.querySelector(`.journal-link`))return K.Article;let t=e.querySelector(`.content-type > span`)?.textContent.toLowerCase().trim()??e.querySelector(`.content-meta-data-label`)?.textContent.toLowerCase().trim();return Iu(t)?t:null},Ru=(e,t)=>{switch(Lu(e)){case K.Article:case K.Serial:return Ou(e,t);case K.Audio:return ku(e,t);case K.Book:return Au(e,t);case K.Chapter:case K.ResearchReport:return ju(e,t);case K.Document:return Mu(e,t);case K.Image:return Nu(e,t);case K.Journal:return Pu(e,t);case K.Video:return Fu(e,t);default:return null}},zu=({document:e,url:t})=>{let n=Ru(e,t);return n?B(n):z()},Bu=/([0-9]{4}-[0-9]{1,2}-[0-9]{1,2}|[0-9]{4}-[0-9]{1,2}|[0-9]{4})/,Vu=/(E?ISBN|E?ISSN|DOI)\s*:\s*/gi,Hu=e=>{if(!e)return;let t=Bu.exec(e);if(t)return t.length>1?t[1]:void 0},Uu=e=>{let t={};return e.forEach(e=>{let n=[],r;for(Vu.lastIndex=0;(r=Vu.exec(e))!==null;)n.push({id:r[1].toLowerCase(),index:r.index,start:Vu.lastIndex});n.forEach(({id:r,start:i},a)=>{t[r]??=[],t[r].push(e.substring(i,n[a+1]?.index).trim())})}),t},Wu=e=>[...e.isbn??[],...e.eisbn??[]].map(e=>zs(e)).filter(e=>!!e),Gu=e=>{if(e){if(typeof e==`string`)return e;if(e.length>0)return e[0]}},Ku=e=>{if(e)return typeof e==`string`?e:Array.isArray(e)?e.length===0?void 0:Gu(e[0].name):Gu(e.name)},qu=(...e)=>{let t=new Set(e.filter(e=>!!e));if(t.size!==0)return[...t]},Ju=e=>{let t=Uu(e.identifierValues),[n]=e.isPartOf?.split(`,`)??[],r=Hu(e.publicationDate??e.creationDate),i=Wu(t);return{authors:e.authors,date:r,dois:t.doi,edition:e.edition,eissns:t.eissn,isbns:i,issns:t.issn,jtitle:n,lcn:e.lcn,publisher:e.publisher,title:e.title}},Yu=({lcn:e,title:t})=>({bibid:e,title:t}),Xu=e=>{let t=e.mainEntity.creator;if(t)return typeof t==`string`?[t]:Array.isArray(t)?t.map(e=>Gu(e.name)).filter(e=>!!e):[Gu(t.name)].filter(e=>!!e)},Zu=e=>{let t=e.mainEntity.issn;return t?typeof t==`string`?[t]:t:[]},Qu=e=>{let t=e.mainEntity.datePublished;if(t)return t.replace(/-$/,``)||void 0},$u=e=>e.replace(/[.,;]+$/,``).trim(),ed=(e,t)=>{let n=$u(e),r=$u(t);return n.startsWith(r)||r.startsWith(n)},td=e=>{let t=[];for(let n of e)n&&(t.some(e=>ed(e,n))||t.push(n));return t.length>0?t:void 0},nd=(e,t)=>{let n=td([...(e&&Xu(e))??[],...t.authors??[]]),r=qu(...t.eissns??[]),i=qu(e?.mainEntity.isbn?zs(e.mainEntity.isbn):void 0,...t.isbns??[]),a=qu(...e?Zu(e):[],...t.issns??[]),[o,s]=e?.mainEntity.pagination?.split(`-`)??[];return{authors:n,btitle:e?.mainEntity.isPartOf?.name??t.jtitle,date:t.date??(e?Qu(e):void 0),doi:Gu(t.dois),edition:e?.mainEntity.edition??t.edition,eissn:Gu(r),epage:s,isbn:i?.join(`,`),issn:Gu(a),issue:e?.mainEntity.issueNumber,jtitle:t.jtitle,lcn:t.lcn??e?.identifier.value,publisher:t.publisher??Ku(e?.mainEntity.publisher),spage:o,title:e?.name??t.title,volume:e?.mainEntity.volumeNumber}},rd=j({"@type":N(`Organization`),name:M([O(),A(O())])}),id=j({"@type":N(`Person`),name:M([O(),A(O())])}),ad=j({"@type":M([O(),A(O())]),"@id":O().optional(),issn:O().optional(),name:O().optional(),volume:O().optional()}),od=Ys.extend({identifier:j({"@type":O(),propertyID:O(),value:O()}),mainEntity:j({"@type":O(),"@id":O(),bookFormat:P(O()),creator:P(M([O(),id,A(id)])),datePublished:P(O()),description:P(M([O(),A(O())])),edition:P(O()),inLanguage:P(O()),isbn:P(O()),issn:P(M([O(),A(O())])),isPartOf:P(ad),issueNumber:P(O()),pagination:P(O()),publisher:P(M([O(),rd,A(rd)])),volumeNumber:P(O())}),name:O()}),sd=e=>{let t=$s(e);if(!t)return null;let n=ec(t),r=od.safeParse(n);return r.success?r.data:null},cd=e=>L(F.Article,{...Yu(e),au:e.authors,doi:e.doi,eissn:e.eissn,epage:e.epage,issn:e.issn,issue:e.issue,jtitle:e.jtitle,pub:e.publisher,spage:e.spage,volume:e.volume}),ld=e=>I(F.Book,{...Yu(e),au:e.authors,date:e.date,doi:e.doi,edition:e.edition,epage:e.epage,isbn:e.isbn,pub:e.publisher,spage:e.spage}),ud=e=>I(F.Bookitem,{bibid:e.lcn,atitle:e.title,btitle:e.btitle,au:e.authors,date:e.date,doi:e.doi,epage:e.epage,isbn:e.isbn,pub:e.publisher,spage:e.spage}),dd=e=>I(F.Conference,{...Yu(e),au:e.authors,date:e.date,doi:e.doi,isbn:e.isbn,pub:e.publisher}),fd=e=>_o({...Yu(e),au:e.authors,date:e.date,pub:e.publisher}),pd=e=>L(F.Journal,{...Yu(e),date:e.date,doi:e.doi,eissn:e.eissn,issn:e.issn,pub:e.publisher}),md=e=>R({...Yu(e),au:e.authors,date:e.date,pub:e.publisher}),hd=e=>R({...Yu(e),au:e.authors,date:e.date,pub:e.publisher}),q=function(e){return e.Article=`Article`,e.Audio=`Audio`,e.Book=`Book`,e.BookChapter=`BookChapter`,e.Conference=`Conference`,e.Dissertation=`Dissertation`,e.Journal=`Journal`,e.Video=`Video`,e}({}),gd=(e,t)=>({document:n})=>{let r=sd(n),i=nd(r,e(n));switch(t(n,r)){case q.Article:return B(cd(i));case q.Book:return B(ld(i));case q.BookChapter:return B(ud(i));case q.Conference:return B(dd(i));case q.Dissertation:return B(fd(i));case q.Journal:return B(pd(i));case q.Audio:return B(hd(i));case q.Video:return B(md(i));default:return z()}},_d=e=>`*:has([title*="${e}" i]) + .item-details-element-container prm-highlight`,vd=e=>Array.from(e.querySelectorAll(_d(`Identifier`))).map(e=>e.textContent).filter(e=>!!e),yd=e=>Array.from(e.querySelectorAll(_d(`Author`))).filter(e=>!!e.textContent&&e.parentElement!==null&&e.parentElement.getAttribute(`aria-hidden`)!==`true`).map(e=>e.textContent.trim()),bd=(e,t)=>e.querySelector(_d(t))?.textContent.trim(),xd=e=>Ju({authors:yd(e),title:bd(e,`Title`),publisher:bd(e,`Publisher`),creationDate:bd(e,`Creation Date`),publicationDate:bd(e,`Publication Date`),edition:bd(e,`Edition`),isPartOf:bd(e,`Is Part Of`),identifierValues:vd(e),lcn:bd(e,`MMS ID`)??bd(e,`Record ID`)}),Sd={Article:q.Article,Book:q.Book,"Book Chapter":q.BookChapter,Chapter:q.BookChapter,Periodical:q.Journal,Journal:q.Journal,"Audio CD":q.Audio,CreativeWork:q.Audio,Movie:q.Video,Video:q.Video},Cd=gd(xd,(e,t)=>{let n=t?.mainEntity[`@type`]??e.querySelector(`.media-content-type`)?.textContent??void 0;return n?Sd[n]:void 0}),wd=e=>{let t=e.querySelectorAll(`[id="Info"] > p`),n=Array.from(t).find(e=>e.textContent.includes(`Document Type`))?.textContent,r=V(e,`name`,`DC.identifier`);if(r?.startsWith(`info:doi/`)||n?.includes(`Article`))return U.Article;if(r?.startsWith(`urn:issn:`))return U.Journal},Td=e=>{let[t,n,r,i]=V(e,`name`,`DCTERMS.bibliographicCitation`)?.split(`,`)??[];return{journalTitle:t,volume:n,issue:r,pages:i}},Ed=e=>{let t=V(e,`name`,`DC.identifier`);return(t?t.split(`info:doi/`):null)?.[1]??void 0},Dd=e=>e.evaluate(`//*[@id="altLayoutPublisherLogo"]/p/a[1]`,e,null,XPathResult.STRING_TYPE,null).stringValue,Od=e=>{let[t,n]=e?e.trim().split(`-`):[void 0,void 0];return{spage:t,epage:n?.replace(/\(\d+\)/,``).trim()}},kd=e=>{let t=V(e,`name`,`DCTERMS.issued`);if(!t)return;let n=/\d{4}/.exec(t);return n?n[0]:void 0},Ad=e=>{let t=V(e,`name`,`DC.title`),n=V(e,`name`,`DC.publisher`),r=kd(e),i=Td(e),a=i.journalTitle?.trim(),o=i.volume?.trim(),s=i.issue?.trim(),c=i.pages?Od(i.pages):void 0,l=c?.spage,u=c?.epage,d=H(e,`name`,`DC.creator`),f=Ed(e);return L(F.Article,{au:d,jtitle:a,date:r,doi:f,issue:s,pub:n,spage:l,epage:u,atitle:t,volume:o})},jd=e=>{let t=V(e,`name`,`DC.title`),n=V(e,`name`,`DC.publisher`),r=Dd(e);return L(F.Journal,{issn:r,title:t,pub:n})},Md=({document:e})=>{switch(wd(e)){case U.Article:return B(Ad(e));case U.Journal:return B(jd(e));default:return z()}},Nd=/^\d{4}-\d{3}[\dX]$/i,Pd=e=>Nd.test(e),Fd=e=>{let t=e.filter(Pd);return t.length?t:void 0},Id=e=>{let t=H(e,`name`,`citation_author`);return t.length?t:void 0},Ld=e=>V(e,`name`,`citation_publication_date`)?.match(/^\d{4}/)?.[0],Rd=e=>V(e,`name`,`citation_doi`),zd=e=>{let t=H(e,`name`,`citation_isbn`);return t.length?t.join(`,`):void 0},Bd=e=>Fd(H(e,`name`,`citation_issn`)),Vd=e=>V(e,`name`,`citation_journal_title`),Hd=e=>V(e,`name`,`citation_publisher`),Ud=e=>V(e,`name`,`citation_title`),Wd=e=>V(e,`name`,`citation_doi`),Gd=e=>V(e,`name`,`citation_firstpage`),Kd=e=>V(e,`name`,`citation_lastpage`),qd=e=>V(e,`name`,`citation_issue`),Jd=e=>V(e,`name`,`citation_volume`),Yd=e=>L(F.Article,{atitle:Ud(e),au:Id(e),date:Ld(e),doi:Rd(e),issn:Bd(e)?.[0],issue:qd(e),jtitle:Vd(e),pub:Hd(e),volume:Jd(e),spage:Gd(e),epage:Kd(e)}),Xd=e=>I(F.Bookitem,{atitle:Ud(e),au:Id(e),btitle:Vd(e),date:Ld(e),isbn:zd(e),pub:Hd(e),spage:Gd(e),epage:Kd(e)}),Zd=e=>_o({title:Ud(e),au:Id(e),date:Ld(e),pub:Hd(e),spage:Gd(e),epage:Kd(e)}),Qd=e=>!!e.isbn,$d=e=>!!e.issn||e.type===`Article`&&!!e.journalTitle||!Qd(e)&&!!e.journalTitle,ef=e=>!!e.title,tf=e=>{let t={type:Wd(e),isbn:zd(e),issn:Bd(e),journalTitle:Vd(e),title:Ud(e)};return Qd(t)?Xd(e):$d(t)?Yd(e):ef(t)?Zd(e):null},nf=({url:e,document:t})=>{let n=tf(t);return n?B({...n,uri:e}):z()},rf=j({"@content":O(),datePublished:O().optional(),mainEntity:j({type:O().optional(),name:O().optional(),author:A(j({name:O()})).optional(),publisher:j({type:O(),name:O()}).optional(),isbn:O().optional()})}),af=e=>rf.safeParse(e).success,of=e=>{let t=e.textContent;if(!t)return null;try{let e=JSON.parse(t);if(af(e))return e}catch{return null}return null},sf=({document:e})=>{let t=$s(e);if(!t)return z();let n=of(t);if(!n)return z();let r=n.mainEntity.type,i=n.mainEntity.author?.map(e=>e.name),a=n.datePublished?.substring(0,4),o=n.mainEntity.name,s=n.mainEntity.isbn,c=n.mainEntity.publisher?.name;switch(r){case`Book`:return B(I(F.Book,{au:i,date:a,title:o,isbn:s,pub:c}));default:return z()}},cf=Ys.extend({"@type":O().optional(),name:O().optional(),copyrightYear:ga().optional(),author:A(j({name:O()})).optional(),publisher:A(j({name:O()})).optional()}),lf=e=>cf.safeParse(e).success,uf=({document:e,url:t})=>{let n=$s(e);if(!n)return z();let r=ec(n);if(!r||!lf(r))return z();let i=r[`@type`],a=r.author?.map(e=>e.name),o=r.copyrightYear?.toString()??V(e,`property`,`og:book:release_date`),s=r.name,c=iu(r.publisher?.map(e=>e.name)),l=V(e,`property`,`og:book:isbn`);switch(i){case`Book`:return B(I(F.Book,{au:a,date:o,title:s,isbn:l,pub:c,uri:t}));default:return z()}},df=e=>{let t=Array.from(e.querySelectorAll(`a[rel=author]`)).map(e=>e.textContent.trim()).filter(Boolean);return t.length?t:void 0},ff=e=>{let t=Array.from(e.querySelectorAll(`strong`)).filter(e=>e.textContent.startsWith(`ISBN`)).map(e=>e.nextElementSibling?.textContent.trim());if(t.length!==0)return t[0]?.replace(/\s+/,`,`)},pf=({url:e,document:t})=>{let n=t.querySelector(`h3.page-title`)?.textContent.trim()??void 0,r=df(t),i=V(t,`property`,`article:published_time`),a=ff(t);return B(I(F.Book,{au:r,date:i?.substring(0,4),isbn:a,pub:`Milne Open Textbooks`,title:n,uri:e}))},mf=({document:e,url:t})=>{switch(gf(t)){case U.Chapter:return B(xf(e));case U.Book:return B(Sf(e));case U.Article:return B(_f(e));case U.Journal:return B(vf(e));default:return z()}},hf=function(e){return e.Print=`Print`,e.Online=`Online`,e}(hf||{}),gf=e=>{let{pathname:t}=new URL(e);return t.includes(`/books/abs/`)?U.Chapter:t.includes(`/books/`)?U.Book:/\/journals\/.+\/article\//.exec(t)==null?t.includes(`/journals/`)?U.Journal:U.None:U.Article},_f=e=>{let t=V(e,`name`,`citation_title`),n=V(e,`name`,`citation_journal_title`),r=V(e,`name`,`citation_doi`),i=V(e,`name`,`citation_volume`),a=V(e,`name`,`citation_issue`),o=V(e,`name`,`citation_firstpage`),s=V(e,`name`,`citation_lastpage`),c=V(e,`name`,`citation_publication_date`)?.substring(0,4),l=V(e,`name`,`citation_publisher`),u=Cf(e),d=Fd(H(e,`name`,`citation_issn`));return L(F.Article,{atitle:t,au:u,jtitle:n,doi:r,volume:i,issue:a,issn:d?.[0],spage:o,epage:s,date:c,pub:l})},vf=e=>{let t=yf(e),n=bf(e),r=n.find(e=>e.type===hf.Print),i=n.find(e=>e.type===hf.Online),a=r?r.value:void 0,o=i?i.value:void 0;return L(F.Journal,{title:t,issn:a,eissn:o})},yf=e=>e.querySelector(`h1.title`)?.textContent.trim()??void 0,bf=e=>{let t=Array.from(e.querySelectorAll(`span.bold`)).find(e=>e.textContent.trim()===`ISSN:`),n=/^([0-9]{4}-[0-9]{3}[0-9X]) \((Print|Online)\)/,r=[];return t&&(t.parentElement?.querySelectorAll(`span.value`))?.forEach(e=>{let t=e.textContent.trim(),i=n.exec(t);i&&r.push({value:i[1],type:i[2]})}),r},xf=e=>{let t=V(e,`name`,`citation_title`),n=V(e,`name`,`citation_inbook_title`),r=V(e,`name`,`citation_doi`),i=V(e,`name`,`citation_publication_date`)?.substring(0,4),a=V(e,`name`,`citation_publisher`);return I(F.Bookitem,{atitle:t,btitle:n,doi:r,date:i,pub:a})},Sf=e=>{let t=V(e,`name`,`citation_title`),n=V(e,`name`,`citation_doi`),r=V(e,`name`,`citation_isbn`),i=V(e,`name`,`citation_publication_date`)?.substring(0,4),a=V(e,`name`,`citation_publisher`),o=Cf(e);return I(F.Book,{title:t,au:o,doi:n,isbn:r,date:i,pub:a})},Cf=e=>{let t=H(e,`name`,`citation_author`);return t.length?t:void 0},wf=function(e){return e.Journal=`Journal`,e.Article=`Article`,e}(wf||{}),Tf=e=>{switch(V(e,`property`,`og:type`)){case`Article`:return wf.Article;case`Journal`:return wf.Journal;default:return}};function Ef(e){let t=V(e,`property`,`og:title`),n=V(e,`name`,`dc.Publisher`),r=V(e,`name`,`publication_doi`);return B(L(F.Journal,{jtitle:t,pub:n,doi:r}))}function Df(e){let t=V(e,`name`,`dc.Title`),n=H(e,`name`,`dc.Creator`),r=V(e,`name`,`dc.Date`)?.substring(0,4),i=V(e,`name`,`publication_doi`),a=V(e,`name`,`citation_journal_title`),o=V(e,`name`,`dc.Publisher`);return B(L(F.Article,{atitle:t,au:n,date:r,doi:i,jtitle:a,pub:o}))}var Of=({document:e})=>{switch(Tf(e)){case wf.Journal:return Ef(e);case wf.Article:return Df(e);default:return z()}},kf=e=>{if(!e)return;let[t,n]=e.trim().split(`-`);return{spage:t,epage:n}},Af=e=>{let{pathname:t}=new URL(e);if(t.includes(`/article/`))return U.Article},jf=e=>{let t=V(e,`name`,`DC.Source`),n=V(e,`name`,`DC.Title`),r=H(e,`name`,`DC.Creator.PersonalName`),i=V(e,`name`,`DC.Source.ISSN`),a=V(e,`name`,`citation_date`)?.substring(0,4),o=V(e,`name`,`DC.Source.Volume`),s=V(e,`name`,`DC.Source.Issue`),c=V(e,`name`,`DC.Identifier.URI`),l=V(e,`name`,`DC.Identifier.pageNumber`),u=l?kf(l):void 0,d=u?.spage,f=u?.epage;return L(F.Article,{jtitle:t,atitle:n,au:r,issn:i,date:a,spage:d,epage:f,volume:o,issue:s,uri:c})},Mf=({document:e,url:t})=>{switch(Af(t)){case U.Article:return B(jf(e));default:return z()}},Nf=function(e){return e.Book=`Book`,e.Chapter=`Chapter`,e}(Nf||{}),Pf=e=>{switch(Ff(e)){case`eBook`:return Nf.Book;case`Reference`:return Nf.Chapter;default:return}},Ff=e=>e.querySelector(`#vol-contentType a`)?.textContent??void 0;function If(e,t){let n=Rf(e),r=Vf(e),i=Uf(e),a=Wf(e),o=Gf(e),s=Kf(e),c=Vf(e),l=t,{startPage:u,endPage:d}=qf(e)??{};return B(I(F.Book,{au:n,btitle:r,date:i,doi:a,epage:d,isbn:o,pub:s,spage:u,title:c,uri:l}))}function Lf(e,t){let n=Rf(e),r=Hf(e),i=Vf(e),a=Uf(e),o=Wf(e),s=Gf(e),c=Kf(e),l=Hf(e),u=t,{startPage:d,endPage:f}=qf(e)??{};return B(I(F.Book,{au:n,atitle:r,btitle:i,date:a,doi:o,epage:f,isbn:s,pub:c,spage:d,title:l,uri:u}))}var Rf=e=>{let t=e.querySelectorAll(`div#article_author p.author-bio b`),n=Array.from(t).map(e=>e.textContent).filter(e=>!!e).map(e=>e.trim());return n.length>0?n:void 0},zf=(e,t)=>e.querySelector(`input#${t}`)?.getAttribute(`value`)??void 0,Bf=e=>V(e,`property`,`og:title`),Vf=e=>zf(e,`titlevalue`)??Bf(e),Hf=e=>zf(e,`chapter-title-squid`),Uf=e=>zf(e,`pubdate-squid`),Wf=e=>zf(e,`doi-squid`),Gf=e=>zf(e,`isbn-squid`),Kf=e=>zf(e,`pubname-squid`),qf=e=>{let t=e.querySelector(`#pageRange`)?.textContent??void 0;if(!t)return;let n=/(\d+)–(\d+)/.exec(t);if(n)return{startPage:n[1],endPage:n[2]}},Jf=({document:e,url:t})=>{switch(Pf(e)){case Nf.Book:return If(e,t);case Nf.Chapter:return Lf(e,t);default:return z()}},Yf=(e,t)=>e.evaluate(`//*[@class="singleRecord_view_label"][contains(text(), "${t}")]/following-sibling::*[@class="singleRecord_view_data"]`,e,null,XPathResult.STRING_TYPE).stringValue.toLowerCase().trim(),Xf=e=>{switch(Yf(e,`Medium`)){case`book`:case`e-book`:return F.Book;case`e-journal`:return F.Journal;default:return F.Unknown}},Zf=e=>{delete e.rft_id},Qf=e=>{let t=rs(e);if(Yc(t)){let n=Xf(e.document);t.resource.genre=n,Zf(t.resource)}return t},$f=e=>{let t=V(e,`name`,`type`)?.toLowerCase(),n=V(e,`name`,`og:type`)?.toLowerCase(),r=V(e,`name`,`citation_article_type`)?.toLowerCase();if(t===`article`||r===`article`||n===`article`)return U.Article;let i=V(e,`name`,`twitter:title`)?.trim(),a=V(e,`name`,`description`)?.trim();if(i||a)return U.Webpage},ep=e=>{let t=V(e,`name`,`DC.Title`),n=V(e,`name`,`DC.Publisher`),r=V(e,`name`,`DC.Date`),i=V(e,`name`,`DC.Identifier`),a=V(e,`name`,`citation_journal_title`),o=V(e,`name`,`citation_volume`),s=V(e,`name`,`citation_issn`),c=H(e,`name`,`citation_author`);return L(F.Article,{au:c,jtitle:a,date:r,doi:i,issn:s,pub:n,title:t,volume:o})},tp=(e,t)=>vo({uri:e,title:V(t,`name`,`twitter:title`)}),np=({url:e,document:t})=>{switch($f(t)){case U.Article:return B(ep(t));case U.Webpage:return B(tp(e,t))}return z()},rp=({document:e})=>Array.from(e.querySelectorAll(`.availability.documentSummaryAvailability.availabilityContent`)).length===0?z():ts(),ip=/([0-9]{4})\s+at/;function ap(e){if(!e)return;let t=ip.exec(e);if(t&&t.length>1)return t[1]}function op(e,t){let n=e.getElementsByClassName(t);if(n.length!==0)return n[0].textContent}function sp(e){return Array.from(e.getElementsByTagName(`li`)).reduce((e,t)=>{let n=op(t,`title`),r=op(t,`content`);return n&&r&&(e[n]=r),e},{})}function cp(e){let t=e.getElementsByClassName(`information`);if(t.length===0)return{};let n=sp(t[0]);return{date:ap(n.Published),series:n.Show}}var lp=({url:e,document:t})=>{if(!new URL(e).searchParams.has(`i`))return z();let n=F.AudioDocument;return B({genre:n,pub:V(t,`property`,`og:site_name`),title:V(t,`property`,`og:title`),uri:e,...cp(t)})},up=e=>{let t=V(e,`name`,`citation_date`);if(t)return t.split(`/`).find(e=>/^\d{4}/.test(e))??void 0},dp=e=>{let t=e.querySelector(`#arxiv-doi-link`)?.textContent;if(t)return t.replace(`https://doi.org/`,``).trim()},fp=({document:e})=>{let t=V(e,`name`,`citation_title`),n=V(e,`name`,`citation_pdf_url`),r=H(e,`name`,`citation_author`),i=up(e),a=dp(e);return!t&&r.length===0&&!i&&!a?z():B(L(F.Article,{au:r,date:i,doi:a,title:t,uri:n}))},pp=e=>{let t=su(e,`div.director-section div.term-info-section-items`);if(!t)return;let n=t.split(`,`).map(e=>e.replace(/\s+/g,` `).trim()).filter(e=>e.length>0);return n.length>0?n:void 0},mp=e=>{let t=new Map;return Array.from(e.querySelectorAll(`.info-section-container`)).forEach(e=>{let n=e.querySelector(`.info-section-header .info-section-title`)?.textContent.trim().toLowerCase();if(!n)return;let r=Array.from(e.querySelectorAll(`.term-info-section-item`)).map(e=>e.textContent.replace(`,`,``).trim()).filter(e=>!!e);r.length&&t.set(n,r)}),t},hp=({url:e,document:t})=>{let n=mp(t);return B(R({au:pp(t)??n.get(`director`),date:su(t,`div.product-release-year`),pub:su(t,`div.studio-section div.term-info-section-item`)??_u(n.get(`supplier`)),title:su(t,`.product-title`)??su(t,`.movie-title`),uri:e}))},gp=e=>{if(V(e,`property`,`og:type`)===`article`)return U.Article};function _p(e){let t={},n=e.querySelector(`[data-id=layout-form]`);return n&&Array.from(n.getElementsByTagName(`h2`)).forEach(e=>{let n=e.textContent.toLowerCase(),r=Array.from(e.parentElement?.getElementsByTagName(`span`)??[]).map(e=>e.textContent||``);n&&(t[n]=r[0])}),t}function vp(e,t,n){return n.includes(`publisher`)?t.publisher:n.includes(`place of publication, exhibition, or creation`)?t[`place of publication, exhibition, or creation`]:V(e,`name`,`DC.publisher`)}function yp(e){let t=V(e,`name`,`citation_publication_date`);return t?t.substring(0,4):V(e,`name`,`citation_online_date`)?.substring(0,4)}var bp=e=>{let t=_p(e),n=V(e,`name`,`DataCite.title`),r=H(e,`name`,`DataCite.contributor`),i=yp(e),a=V(e,`name`,`DC.identifier.DOI`),o=Object.keys(t),s=vp(e,t,o),c=o.includes(`journal`)?t.journal:void 0,l=o.includes(`volume`)?t.volume:void 0,u=o.includes(`issue`)?t.issue:void 0,d=o.includes(`issn`)?t.issn:void 0,f=o.includes(`electronic location (url)`)?t[`electronic location (url)`]:void 0;return L(F.Article,{jtitle:c,atitle:n,pub:s,au:r,date:i,doi:a,volume:l,issue:u,issn:d,uri:f})},xp=({document:e})=>{switch(gp(e)){case U.Article:return B(bp(e));default:return z()}},J=function(e){return e.ISSN=`issn (print)`,e.EISSN=`issn (electronic)`,e.ISBN=`isbn (print)`,e.VOLUME=`volume`,e.ISSUE=`issue`,e.PUBLISHER=`publisher`,e.DATE_OF_PUBLICATION=`date of publication`,e.RESOURCE_TYPE=`resource type`,e.JOURNAL_TITLE=`journal`,e.BOOK_TITLE=`book title`,e.PAGE_RANGE=`page range`,e}(J||{}),Sp=e=>{let t=Y(e,J.RESOURCE_TYPE);return t?t===`Other Journal Article`||t===`Journal Article`||t===`Journal Item`||t===`Book Review`?U.Article:t===`Book Chapter`||t===`Book Part`||t===`Conference Abstract`||t===`Book ChapterConference Paper`||t===`Conference Paper`||t===`Other Book Part`?U.Document:U.None:U.None},Cp=e=>e.replace(`:`,``).replace(` | `,``).trim().toLowerCase(),wp=e=>{let t=new Map,n=e.querySelector(`ul.rlist.publication-details__list`);return n&&Array.from(n.querySelectorAll(`li`)).forEach(e=>{let n=Array.from(e.querySelectorAll(`span.label`)),r=Array.from(e.querySelectorAll(`span.info`));n.forEach((e,n)=>{let i=Cp(e.textContent),a=r[n]?.textContent?.trim();i&&a&&(t.has(i)||t.set(i,[]),t.get(i)?.push(a))})}),t},Y=(e,t)=>{let n=e.get(t);if(n)return iu(n)},Tp=e=>H(e,`name`,`dc.Creator`).map(e=>e.trim()),Ep=e=>{let t=ou(e,[`.loa-accordion a.author-name`]);if(t)return t.map(e=>e.replace(`Authors:`,``).trim())},Dp=e=>{let t=Tp(e);return t.length>0?t:Ep(e)},Op=e=>V(e,`name`,`dc.Title`)??V(e,`property`,`og:title`),kp=e=>V(e,`name`,`publication_doi`),Ap=(e,t)=>Y(t,J.DATE_OF_PUBLICATION)??V(e,`name`,`dc.Date`),jp=e=>{let t=Y(e,J.PAGE_RANGE),n,r;return t?.includes(`-`)&&(n=t?t.split(`-`)[0].trim():void 0,r=t?t.split(`-`)[1].trim():void 0),{pages:t,spage:n,epage:r}},Mp=(e,t,n)=>{let r=Op(e),i=Y(t,J.JOURNAL_TITLE),a=V(e,`name`,`citation_journal_title`),o=i??a,s=kp(e),c=Ap(e,t),l=Y(t,J.PUBLISHER),u=Dp(e),d=Y(t,J.VOLUME),f=Y(t,J.ISSUE),p=jp(t),m=Y(t,J.ISSN),h=Y(t,J.EISSN);return L(F.Article,{title:r,jtitle:o,doi:s,date:c,pub:l,au:u,volume:d,issue:f,pages:p.pages,spage:p.spage,epage:p.epage,issn:m,eissn:h,uri:n})},Np=(e,t,n)=>{let r=Op(e),i=Y(t,J.BOOK_TITLE),a=kp(e),o=Ap(e,t),s=Y(t,J.PUBLISHER),c=Dp(e),l=jp(t),u=Y(t,J.ISBN);return I(F.Conference,{title:r,btitle:i,doi:a,date:o,pub:s,au:c,pages:l.pages,spage:l.spage,epage:l.epage,isbn:u,uri:n})},Pp=(e,t,n)=>{let r=Op(e),i=kp(e),a=Ap(e,t),o=Y(t,J.PUBLISHER),s=Dp(e),c=Y(t,J.ISBN);return I(F.Document,{title:r,doi:i,date:a,pub:o,au:s,uri:n,isbn:c})},Fp=({url:e,document:t})=>{let n=wp(t);switch(Sp(n)){case U.Article:return B(Mp(t,n,e));case U.Document:return B(Np(t,n,e));case U.None:return B(Pp(t,n,e));default:return z()}},Ip=e=>V(e,`property`,`og:title`)?.trim()??void 0,Lp=e=>V(e,`name`,`dc.identifier`)??V(e,`name`,`citation_doi`),Rp=e=>{let t=Ip(e),n=t,r=Wp(e),i=Up(e),a=Vp(e),o=Hp(e),{issn:s,eissn:c}=Bp(e);return B(L(F.Journal,{date:r,eissn:c,issn:s,issue:i,jtitle:n,pub:a,title:t,volume:o}))},zp=e=>e.includes(`/journals/`)&&e.includes(`issue`),Bp=e=>({issn:e.querySelector(`dd.printissn.text-metadata-value > span`)?.textContent.trim(),eissn:e.querySelector(`dd.onlineissn.text-metadata-value > span`)?.textContent.trim()}),Vp=e=>e.querySelector(`dd.publisher.text-metadata-value span`)?.textContent.trim()??void 0,Hp=e=>Ip(e)?.match(/Volume\s+(\d+)/i)?.[1],Up=e=>Ip(e)?.match(/Issue\s+(\d+)/i)?.[1],Wp=e=>Ip(e)?.match(/\((\d{4})\)/)?.[1],Gp=e=>{let t=Ip(e),n=V(e,`name`,`citation_title`)??t,r=H(e,`property`,`article:author`),i=Kp(e),a=Lp(e),o=V(e,`name`,`citation_lastpage`),s=V(e,`name`,`citation_issn`),c=V(e,`name`,`citation_issue`),l=V(e,`name`,`citation_journal_title`),u=V(e,`name`,`citation_publisher`),d=V(e,`name`,`citation_firstpage`),f=V(e,`name`,`citation_volume`);return B(L(F.Article,{atitle:n,au:r,date:i,doi:a,epage:o,issn:s,issue:c,jtitle:l,pub:u,spage:d,title:t,volume:f}))},Kp=e=>V(e,`property`,`article:published_time`)??V(e,`name`,`citation_publication_date`),qp=e=>{let t=Ip(e),n=V(e,`name`,`citation_title`)??t,r=Jp(e),i=Xp(e),a=Lp(e),o=Zp(e),s=V(e,`name`,`citation_publisher`);return B(I(F.Book,{au:r,btitle:n,date:i,doi:a,isbn:o,pub:s,title:t}))},Jp=e=>{let t=H(e,`property`,`book:author`);if(t.length>0)return t;let n=H(e,`name`,`citation_author`);return n.length>0?n:Yp(e)},Yp=e=>Array.from(e.querySelectorAll(`.contributor-details span[data-testid="author-name"]`)).map(e=>(e.textContent||``).trim()).filter(e=>e.length>0),Xp=e=>V(e,`property`,`book:release_date`)??V(e,`name`,`citation_publication_date`),Zp=e=>V(e,`property`,`book:isbn`)??V(e,`name`,`citation_isbn`),Qp=(e,t)=>{switch(V(e,`property`,`og:type`)){case`article`:return U.Article;case`book`:return U.Book;default:break}return zp(t)?U.Journal:U.None},$p=({document:e,url:t})=>{switch(Qp(e,t)){case U.Article:return Gp(e);case U.Journal:return Rp(e);case U.Book:return qp(e);default:return z()}},em=e=>`[data-qa="detail_${e}"]`,tm=(e,t)=>{let n=e.querySelector(em(t));return n?Array.from(n.querySelectorAll(`nde-highlight`)).map(e=>e.textContent.trim()).filter(e=>!!e):[]},nm=(e,t)=>{let n=tm(e,t);return n.length>0?n[0]:void 0},rm=e=>{let t=e.querySelector(em(`creator`));if(!t)return[];let n=Array.from(t.querySelectorAll(`nde-highlight`)).map(e=>e.textContent.trim()).filter(e=>!!e).map(e=>e.replace(/,?\s*author\s*$/i,``).trim());return n.length>0?n:[]},im=e=>{let t=tm(e,`identifier`),n=tm(e,`ispartof`),r=t.find(e=>e.startsWith(`LC:`));return Ju({authors:rm(e),title:nm(e,`title`),publisher:nm(e,`publisher`),creationDate:nm(e,`creationdate`),isPartOf:n.length>0?n[0]:void 0,identifierValues:t,lcn:r?.replace(`LC:`,``).trim()})},am={Article:q.Article,Audio:q.Audio,Book:q.Book,"Book Chapter":q.BookChapter,"Conference Paper":q.Conference,Dissertation:q.Dissertation,Journal:q.Journal,"Magazine Article":q.Article,Newspaper:q.Journal,Video:q.Video},om={CreativeWork:q.Audio,Movie:q.Video,Periodical:q.Journal,Thesis:q.Dissertation},sm={...am,...om},cm=e=>{if(e)return e.mainEntity[`@type`]},lm=e=>e.querySelector(`.record-type`)?.textContent.trim()??void 0,um=gd(im,(e,t)=>{let n=lm(e)??cm(t);return n?sm[n]:void 0}),X=function(e){return e.NoResourceFound=`NoResourceFound`,e.Z3988=`Z3988`,e.Z3988SearchResult=`Z3988SearchResult`,e.Amazon=`Amazon`,e.CupOfJo=`CupOfJo`,e.IngentaConnect=`IngentaConnect`,e.Jstor=`Jstor`,e.Milne=`Milne`,e.Primo=`Primo`,e.SagePub=`SagePub`,e.SageVideo=`SageVideo`,e.ScienceDirect=`ScienceDirect`,e.Springer=`Springer`,e.Youtube=`Youtube`,e.TaylorFrancis=`TaylorFrancis`,e.Wiley=`Wiley`,e.VuFind=`VuFind`,e.ClinicalKey=`ClinicalKey`,e.DOAJ=`DOAJ`,e.Ebscohost=`Ebscohost`,e.OpenStax=`OpenStax`,e.CambridgeJournalsOnline=`CambridgeJournalsOnline`,e.OpenTextbook=`OpenTextbook`,e.AhaJournals=`AhaJournals`,e.Ijees=`Ijees`,e.BloomsburyCollections=`BloomsburyCollections`,e.HeritageCirqa=`HeritageCirqa`,e.BritishMedicalJournal=`BritishMedicalJournal`,e.SummonSearchResult=`SummonSearchResult`,e.ApplePodcasts=`ApplePodcasts`,e.Arxiv=`Arxiv`,e.KanopyVideo=`KanopyVideo`,e.LaTrobeOpal=`LaTrobeOpal`,e.BYUScholarsArchive=`BYUScholarsArchive`,e.Informit=`Informit`,e.Brill=`Brill`,e.PrimoNde=`PrimoNde`,e}({}),dm={[X.NoResourceFound]:lc,[X.Z3988]:rs,[X.Z3988SearchResult]:ru,[X.Amazon]:ds,[X.CupOfJo]:cc,[X.Jstor]:zu,[X.Youtube]:al,[X.SagePub]:Ec,[X.SageVideo]:nu,[X.ScienceDirect]:Lc,[X.Springer]:Ml,[X.TaylorFrancis]:Wc,[X.Wiley]:eu,[X.VuFind]:tl,[X.ClinicalKey]:Js,[X.DOAJ]:hc,[X.Primo]:Cd,[X.IngentaConnect]:Md,[X.Ebscohost]:nf,[X.OpenStax]:sf,[X.OpenTextbook]:uf,[X.Milne]:pf,[X.CambridgeJournalsOnline]:mf,[X.AhaJournals]:Of,[X.Ijees]:Mf,[X.BloomsburyCollections]:Jf,[X.HeritageCirqa]:Qf,[X.BritishMedicalJournal]:np,[X.SummonSearchResult]:rp,[X.ApplePodcasts]:lp,[X.Arxiv]:fp,[X.KanopyVideo]:hp,[X.LaTrobeOpal]:xp,[X.BYUScholarsArchive]:Os,[X.Informit]:Fp,[X.Brill]:$p,[X.PrimoNde]:um},fm=`5.35.0`,pm=()=>fm,mm=[`com.au`,`com`,`ca`,`co.uk`,`de`,`fr`,`nl`].flatMap(e=>[`amazon.${e}`,`www.amazon.${e}`]),hm={version:pm(),siteRegistrations:[{matcher:{regexp:`^https://[a-z0-9\\-]+\\.on\\.worldcat\\.org/search`},name:`Worldcat Search Results`,parsers:[X.Z3988SearchResult]},{matcher:{regexp:`^https://[a-z0-9\\-]+\\.summon\\.serialssolutions\\.com/`},name:`Summon Search Results`,parsers:[X.SummonSearchResult]},{matcher:{regexp:`cupofjo[.-]com`},name:`Cup of Jo`,parsers:[X.CupOfJo]},{matcher:{hostnames:[`youtube.com`,`www.youtube.com`]},name:`Youtube`,parsers:[X.Youtube]},{matcher:{regexp:`www[-.]sciencedirect[.-]com`},name:`Science Direct`,parsers:[X.ScienceDirect]},{matcher:{hostnames:mm},name:`Amazon`,parsers:[X.Amazon]},{matcher:{regexp:`^https://sk\\.sagepub\\.com/video/`},name:`Sage Video`,parsers:[X.SageVideo]},{matcher:{regexp:`[/.-]((www|journals)[.-])?sagepub[.-]com`},name:`Sage Publishing`,parsers:[X.SagePub]},{matcher:{regexp:`www[.-]tandfonline[.-]com`},name:`Taylor & Francis`,parsers:[X.TaylorFrancis]},{matcher:{regexp:`[/.-]((www|onlinelibrary)[.-])?wiley[.-]com`},name:`Wiley`,parsers:[X.Wiley]},{matcher:{regexp:`^https://[a-z0-9\\-]+[.-]on[.-]worldcat[.-]org`},name:`Worldcat`,parsers:[X.Z3988]},{matcher:{hostnames:[`catalogue.rau.ac.uk`]},name:`Royal Agricultural University Library`,parsers:[X.Z3988]},{matcher:{regexp:`link[.-]springer[.-]com`},name:`Springer`,parsers:[X.Springer]},{matcher:{regexp:`^https://vufind\\.lboro\\.ac\\.uk/(Record|PrimoRecord)`},name:`VuFind`,parsers:[X.VuFind]},{matcher:{regexp:`www[.-]clinicalkey[.-]com`},name:`ClinicalKey`,parsers:[X.ClinicalKey]},{matcher:{regexp:`www[.-]jstor[.-]org`},name:`JSTOR`,parsers:[X.Jstor]},{matcher:{regexp:`doaj[.-]org`},name:`DOAJ`,parsers:[X.DOAJ]},{matcher:{regexp:`[/.-]ingentaconnect[.-]com`},name:`IngentaConnect`,parsers:[X.IngentaConnect]},{matcher:{regexp:`research[.-]ebsco[.-]com`},name:`EBSCOHost`,parsers:[X.Ebscohost]},{matcher:{regexp:`openstax[-.]org`},name:`OpenStax`,parsers:[X.OpenStax]},{matcher:{regexp:`open[.-]umn[.-]edu`},name:`OpenTextbook`,parsers:[X.OpenTextbook]},{matcher:{regexp:`milneopentextbooks[-.]org`},name:`Milne Open Textbooks`,parsers:[X.Milne]},{matcher:{regexp:`www[.-]perlego[.-]com`},name:`Perlego`,parsers:[X.Z3988]},{matcher:{regexp:`www[.-]ahajournals[.-]org`},name:`AHA Journals`,parsers:[X.AhaJournals]},{matcher:{regexp:`www[.-]cambridge[.-]org`},name:`Cambridge Journals Online`,parsers:[X.CambridgeJournalsOnline]},{matcher:{regexp:`www[.-]nieindia[.-]org`},name:`International Journal of Ecology and Environmental Sciences`,parsers:[X.Ijees]},{matcher:{regexp:`www[.-]bloomsburycollections[.-]com`},name:`Bloomsbury Collections`,parsers:[X.BloomsburyCollections]},{matcher:{regexp:`cirqahosting[.-]com`},name:`Heritage Cirqa`,parsers:[X.HeritageCirqa]},{matcher:{regexp:`www[.-]bmj[.-]com`},name:`British Medical Journal`,parsers:[X.BritishMedicalJournal]},{matcher:{regexp:`podcasts[.-]apple[.-]com`},name:`Apple Podcasts`,parsers:[X.ApplePodcasts]},{matcher:{regexp:`arxiv[.-]org`},name:`arxiv`,parsers:[X.Arxiv]},{matcher:{regexp:`kanopy[.-]com`},name:`Kanopy Video`,parsers:[X.KanopyVideo]},{matcher:{regexp:`opal[.-]latrobe[.-]edu[.-]au`},name:`La Trobe Opal`,parsers:[X.LaTrobeOpal]},{matcher:{hostnames:[`scholarsarchive.byu.edu`]},name:`BYU Scholars Archive`,parsers:[X.BYUScholarsArchive]},{matcher:{regexp:`informit[.-]org`},name:`Informit`,parsers:[X.Informit]},{matcher:{regexp:`brill[.-]com`},name:`Brill`,parsers:[X.Brill]},{matcher:{regexp:`/nde/fulldisplay`},name:`Primo NDE`,parsers:[X.PrimoNde]},{matcher:{regexp:`/(discovery|primo-explore)/fulldisplay`},name:`Primo`,parsers:[X.Primo]}]},gm=j({hostnames:A(O()).min(1)}),_m=j({regexp:O()}),vm=M([gm,_m]),ym=j({matcher:vm,name:O(),parsers:A(O()),libraryVersionRange:O().optional()}),bm=j({siteRegistrations:A(ym),version:O()}),xm=e=>bm.safeParse(e).success,Sm=e=>ym.safeParse(e).success,Cm=e=>vm.safeParse(e).success,wm=e=>Object.values(X).includes(e),Tm=j({url:O(),document:to(e=>typeof e==`object`&&!!e)}),Em=e=>Tm.safeParse(e).success,Dm=t(((e,t)=>{var n=`2.0.0`,r=256;t.exports={MAX_LENGTH:r,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:r-6,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:n,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),Om=t(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),km=t(((e,t)=>{var{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=Dm(),a=Om();e=t.exports={};var o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),Am=t(((e,t)=>{var n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),jm=t(((e,t)=>{var n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),Z=t(((e,t)=>{var n=Om(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=Dm(),{safeRe:a,t:o}=km(),s=Am(),{compareIdentifiers:c}=jm();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),Mm=t(((e,t)=>{var n=Z();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),Nm=t(((e,t)=>{var n=Mm();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),Pm=t(((e,t)=>{var n=Mm();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),Fm=t(((e,t)=>{var n=Z();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),Im=t(((e,t)=>{var n=Mm();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),Lm=t(((e,t)=>{var n=Z();t.exports=(e,t)=>new n(e,t).major})),Rm=t(((e,t)=>{var n=Z();t.exports=(e,t)=>new n(e,t).minor})),zm=t(((e,t)=>{var n=Z();t.exports=(e,t)=>new n(e,t).patch})),Bm=t(((e,t)=>{var n=Mm();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),Q=t(((e,t)=>{var n=Z();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),Vm=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(t,e,r)})),Hm=t(((e,t)=>{var n=Q();t.exports=(e,t)=>n(e,t,!0)})),Um=t(((e,t)=>{var n=Z();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),Wm=t(((e,t)=>{var n=Um();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),Gm=t(((e,t)=>{var n=Um();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),Km=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(e,t,r)>0})),qm=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(e,t,r)<0})),Jm=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(e,t,r)===0})),Ym=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(e,t,r)!==0})),Xm=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(e,t,r)>=0})),Zm=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(e,t,r)<=0})),Qm=t(((e,t)=>{var n=Jm(),r=Ym(),i=Km(),a=Xm(),o=qm(),s=Zm();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),$m=t(((e,t)=>{var n=Z(),r=Mm(),{safeRe:i,t:a}=km();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t||={};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),eh=t(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),$=t(((e,t)=>{var n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,se(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>v(e,this.options)).join(` `).split(/\s+/).map(e=>b(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let _=new Map,y=g.map(e=>new a(e,this.options));for(let e of y){if(h(e))return[e];_.set(e.value,e)}_.size>1&&_.has(``)&&_.delete(``);let ee=[..._.values()];return r.set(t,ee),ee}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>_(e,n)&&t.set.some(t=>_(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(ce(this.set[t],e,this.options))return!0;return!1}};var r=new(eh()),i=Am(),a=th(),o=Om(),s=Z(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=km(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=Dm(),h=e=>e.value===`<0.0.0-0`,g=e=>e.value===``,_=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=ne(e,t),o(`caret`,e),e=ee(e,t),o(`tildes`,e),e=ie(e,t),o(`xrange`,e),e=oe(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,ee=(e,t)=>e.trim().split(/\s+/).map(e=>te(e,t)).join(` `),te=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return y(n)?s=``:y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},ne=(e,t)=>e.trim().split(/\s+/).map(e=>re(e,t)).join(` `),re=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return y(n)?c=``:y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},ie=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>ae(e,t)).join(` `)),ae=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=y(i),u=l||y(a),d=u||y(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},oe=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),b=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),se=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=y(r)?``:y(i)?`>=${r}.0.0${e?`-0`:``}`:y(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=y(l)?``:y(u)?`<${+l+1}.0.0-0`:y(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),ce=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),th=t(((e,t)=>{var n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};var r=Am(),{safeRe:i,t:a}=km(),o=Qm(),s=Om(),c=Z(),l=$()})),nh=t(((e,t)=>{var n=$();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),rh=t(((e,t)=>{var n=$();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),ih=t(((e,t)=>{var n=Z(),r=$();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),ah=t(((e,t)=>{var n=Z(),r=$();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),oh=t(((e,t)=>{var n=Z(),r=$(),i=Km();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t<e.set.length;++t){let r=e.set[t],o=null;r.forEach(e=>{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),sh=t(((e,t)=>{var n=$();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),ch=t(((e,t)=>{var n=Z(),r=th(),{ANY:i}=r,a=$(),o=nh(),s=Km(),c=qm(),l=Zm(),u=Xm();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,_;switch(d){case`>`:p=s,m=l,h=c,g=`>`,_=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,_=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n<t.set.length;++n){let a=t.set[n],o=null,s=null;if(a.forEach(e=>{e.semver===i&&(e=new r(`>=0.0.0`)),o||=e,s||=e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===_||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===_&&h(e,s.semver))return!1}return!0}})),lh=t(((e,t)=>{var n=ch();t.exports=(e,t,r)=>n(e,t,`>`,r)})),uh=t(((e,t)=>{var n=ch();t.exports=(e,t,r)=>n(e,t,`<`,r)})),dh=t(((e,t)=>{var n=$();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),fh=t(((e,t)=>{var n=nh(),r=Q();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||=e):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length<d.length?u:t}})),ph=t(((e,t)=>{var n=$(),r=th(),{ANY:i}=r,a=nh(),o=Q(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i||=t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,_,v=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,y=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;v&&v.prerelease.length===1&&u.operator===`<`&&v.prerelease[0]===0&&(v=!1);for(let e of t){if(_=_||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!a(s.semver,String(e),n))return!1}if(u){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!a(u.semver,String(e),n))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&_&&!s&&p!==0||y||v)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),mh=t(((e,t)=>{var n=km(),r=Dm(),i=Z(),a=jm();t.exports={parse:Mm(),valid:Nm(),clean:Pm(),inc:Fm(),diff:Im(),major:Lm(),minor:Rm(),patch:zm(),prerelease:Bm(),compare:Q(),rcompare:Vm(),compareLoose:Hm(),compareBuild:Um(),sort:Wm(),rsort:Gm(),gt:Km(),lt:qm(),eq:Jm(),neq:Ym(),gte:Xm(),lte:Zm(),cmp:Qm(),coerce:$m(),Comparator:th(),Range:$(),satisfies:nh(),toComparators:rh(),maxSatisfying:ih(),minSatisfying:ah(),minVersion:oh(),validRange:sh(),outside:ch(),gtr:lh(),ltr:uh(),intersects:dh(),simplifyRange:fh(),subset:ph(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}}))(),hh=(e,t)=>gh(t)?t.hostnames.includes(new URL(e).hostname):_h(t)?!!e.match(t.regexp):!1,gh=e=>gm.safeParse(e).success,_h=e=>_m.safeParse(e).success,vh=(e,t)=>t?(0,mh.satisfies)(e,t):!0,yh=(e,t,n)=>vh(t,n.libraryVersionRange)&&hh(e,n.matcher),bh=(e,t)=>e.siteRegistrations.filter(e=>yh(t,pm(),e)),xh=(e,t)=>bh(e,t).flatMap(({parsers:e,name:t})=>e.filter(e=>wm(e)&&e in dm).map(e=>({parser:dm[e],parserType:e,name:t}))),Sh=(e,t)=>{let n=xh(e,t.url);for(let{parser:e,parserType:r,name:i}of n){let n=e(t);if(Yc(n)||Xc(n)||Zc(n))return{...n,meta:{parserName:i,parserType:r,referrer:t.url}}}return{...lc(t),meta:{parserName:null,parserType:X.NoResourceFound,referrer:t.url}}},Ch=(e,t)=>{switch(t){case jo.CA:return new URL(`https://${e}.rl.ca.talis.com`);default:return new URL(`https://${e}.rl.talis.com`)}};e.BookGenresSchema=io,e.CustomerListSchema=Ro,e.CustomerSchema=Lo,e.DirectLinkOnlyResultSchema=qo,e.Genre=F,e.HostnamesMatcherSchema=gm,e.JournalGenresSchema=ao,e.NON_OPENURL_PROPERTIES=xo,e.NonOpenUrlPropertiesSchema=so,e.NothingParsedResultSchema=Ko,e.OPENURL_KEYS=bo,e.OpenUrlAudioVisualResourceSchema=uo,e.OpenUrlBookResourceSchema=co,e.OpenUrlDocumentResourceSchema=po,e.OpenUrlImageResourceSchema=fo,e.OpenUrlJournalResourceSchema=lo,e.OpenUrlResourceSchema=oo,e.OpenUrlResultSchema=Jo,e.OpenUrlWebpageResourceSchema=mo,e.PARSERS=dm,e.ParserRegistrySchema=bm,e.ParserType=X,e.ParsingMetadataSchema=Go,e.ParsingRequestSchema=Fo,e.ParsingResponseSchema=Qo,e.ParsingResultSchema=Zo,e.REGISTRY=hm,e.RegExpMatcherSchema=_m,e.ResourceDataSchema=Tm,e.ResourceSchema=ho,e.SiteRegistrationSchema=ym,e.SummonSearchResultSchema=Xo,e.TenantRegion=jo,e.TenantRegistrySchema=No,e.TenantSchema=Mo,e.UrlMatcherSchema=vm,e.Z3988SearchResultSchema=Yo,e.convertCustomerListToTenantRegistry=Uo,e.createAudioVisual=R,e.createBook=I,e.createDocument=_o,e.createImage=go,e.createJournal=L,e.createWebpage=vo,e.directLinkOnly=$o,e.fromOpenUrl=Oo,e.getBaseBookmarkingUrl=(e,t)=>{let n=Ch(e,t);return new URL(`/ui/forms/bookmarklet.html`,n)},e.getLibraryVersion=pm,e.isCustomer=zo,e.isCustomerList=Bo,e.isDirectLinkOnlyResult=Jc,e.isGenre=Ao,e.isNothingParsedResult=Qc,e.isOpenUrlResult=Yc,e.isParserRegistry=xm,e.isParserType=wm,e.isParsingMetadata=qc,e.isParsingRequest=Io,e.isParsingResponse=Kc,e.isParsingResult=Gc,e.isResourceData=Em,e.isSiteRegistration=Sm,e.isSummonSearchResult=Zc,e.isTenant=Vo,e.isTenantRegion=Ho,e.isUrlMatcher=Cm,e.isZ3988SearchResult=Xc,e.nothingParsed=z,e.openUrlResource=B,e.parseResource=Sh,e.summonSearchResult=ts,e.toBookmarkingWorkflowUrl=(e,t,n)=>{let r=Eo(t);r.append(`fast`,`true`),r.append(`breakout`,`true`),n&&(n.parserName&&r.append(`targetTitle`,n.parserName),r.append(`referrer`,n.referrer));let i=new URL(e.toString());return i.search=r.toString(),i},e.toOpenUrl=Eo,e.z3988SearchResult=es});
|
|
39
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ti(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:ri(t,`input`,e.processors),output:ri(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function T(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return T(r.element,n);if(r.type===`set`)return T(r.valueType,n);if(r.type===`lazy`)return T(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return T(r.innerType,n);if(r.type===`intersection`)return T(r.left,n)||T(r.right,n);if(r.type===`record`||r.type===`map`)return T(r.keyType,n)||T(r.valueType,n);if(r.type===`pipe`)return T(r.in,n)||T(r.out,n);if(r.type===`object`){for(let e in r.shape)if(T(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(T(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(T(e,n))return!0;return!!(r.rest&&T(r.rest,n))}return!1}var ni=(e,t={})=>n=>{let r=$r({...n,processors:t});return w(e,r),ei(r,e),ti(r,e)},ri=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=$r({...i??{},target:a,io:t,processors:n});return w(e,o),ei(o,e),ti(o,e)},ii={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ai=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ii[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},oi=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},si=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},ci=(e,t,n,r)=>{n.not={}},li=(e,t,n,r)=>{let i=e._zod.def,a=s(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ui=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},di=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},fi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},pi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=w(a.element,t,{...r,path:[...r.path,`items`]})},mi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=w(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=w(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},hi=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>w(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},gi=(e,t,n,r)=>{let i=e._zod.def,a=w(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=w(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},_i=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=w(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=w(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=w(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},vi=(e,t,n,r)=>{let i=e._zod.def,a=w(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},yi=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},bi=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},xi=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Si=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Ci=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;w(a,t,r);let o=t.seen.get(e);o.ref=a},wi=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ti=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ei=n(`ZodISODateTime`,(e,t)=>{qt.init(e,t),k.init(e,t)});function Di(e){return yr(Ei,e)}var Oi=n(`ZodISODate`,(e,t)=>{Jt.init(e,t),k.init(e,t)});function ki(e){return br(Oi,e)}var Ai=n(`ZodISOTime`,(e,t)=>{Yt.init(e,t),k.init(e,t)});function ji(e){return xr(Ai,e)}var Mi=n(`ZodISODuration`,(e,t)=>{Xt.init(e,t),k.init(e,t)});function Ni(e){return Sr(Mi,e)}var Pi=(e,t)=>{Ce.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ee(e,t)},flatten:{value:t=>Te(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,c,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,c,2)}},isEmpty:{get(){return e.issues.length===0}}})};n(`ZodError`,Pi);var E=n(`ZodError`,Pi,{Parent:Error}),Fi=De(E),Ii=Oe(E),Li=ke(E),Ri=je(E),zi=Ne(E),Bi=Pe(E),Vi=Fe(E),Hi=Ie(E),Ui=Le(E),Wi=Re(E),Gi=ze(E),Ki=Be(E),D=n(`ZodType`,(e,t)=>(S.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ri(e,`input`),output:ri(e,`output`)}}),e.toJSONSchema=ni(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(g(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>oe(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Fi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Li(e,t,n),e.parseAsync=async(t,n)=>Ii(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ri(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>zi(e,t,n),e.decode=(t,n)=>Bi(e,t,n),e.encodeAsync=async(t,n)=>Vi(e,t,n),e.decodeAsync=async(t,n)=>Hi(e,t,n),e.safeEncode=(t,n)=>Ui(e,t,n),e.safeDecode=(t,n)=>Wi(e,t,n),e.safeEncodeAsync=async(t,n)=>Gi(e,t,n),e.safeDecodeAsync=async(t,n)=>Ki(e,t,n),e.refine=(t,n)=>e.check(no(t,n)),e.superRefine=t=>e.check(ro(t)),e.overwrite=t=>e.check(Hr(t)),e.optional=()=>P(e),e.exactOptional=()=>za(e),e.nullable=()=>Va(e),e.nullish=()=>P(Va(e)),e.nonoptional=t=>qa(e,t),e.array=()=>A(e),e.or=t=>M([e,t]),e.and=t=>ka(e,t),e.transform=t=>Za(e,Ia(t)),e.default=t=>Ua(e,t),e.prefault=t=>Ga(e,t),e.catch=t=>Ya(e,t),e.pipe=t=>Za(e,t),e.readonly=()=>$a(e),e.describe=t=>{let n=e.clone();return Yn.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Yn.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Yn.get(e);let n=e.clone();return Yn.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),qi=n(`_ZodString`,(e,t)=>{Ft.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ai(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Ir(...t)),e.includes=(...t)=>e.check(zr(...t)),e.startsWith=(...t)=>e.check(Br(...t)),e.endsWith=(...t)=>e.check(Vr(...t)),e.min=(...t)=>e.check(Pr(...t)),e.max=(...t)=>e.check(Nr(...t)),e.length=(...t)=>e.check(Fr(...t)),e.nonempty=(...t)=>e.check(Pr(1,...t)),e.lowercase=t=>e.check(Lr(t)),e.uppercase=t=>e.check(Rr(t)),e.trim=()=>e.check(Wr()),e.normalize=(...t)=>e.check(Ur(...t)),e.toLowerCase=()=>e.check(Gr()),e.toUpperCase=()=>e.check(Kr()),e.slugify=()=>e.check(qr())}),Ji=n(`ZodString`,(e,t)=>{Ft.init(e,t),qi.init(e,t),e.email=t=>e.check(Zn(Yi,t)),e.url=t=>e.check(rr(Qi,t)),e.jwt=t=>e.check(vr(ma,t)),e.emoji=t=>e.check(ir(ea,t)),e.guid=t=>e.check(Qn(Xi,t)),e.uuid=t=>e.check($n(Zi,t)),e.uuidv4=t=>e.check(er(Zi,t)),e.uuidv6=t=>e.check(tr(Zi,t)),e.uuidv7=t=>e.check(nr(Zi,t)),e.nanoid=t=>e.check(ar(ta,t)),e.guid=t=>e.check(Qn(Xi,t)),e.cuid=t=>e.check(or(na,t)),e.cuid2=t=>e.check(sr(ra,t)),e.ulid=t=>e.check(cr(ia,t)),e.base64=t=>e.check(hr(da,t)),e.base64url=t=>e.check(gr(fa,t)),e.xid=t=>e.check(lr(aa,t)),e.ksuid=t=>e.check(ur(oa,t)),e.ipv4=t=>e.check(dr(sa,t)),e.ipv6=t=>e.check(fr(ca,t)),e.cidrv4=t=>e.check(pr(la,t)),e.cidrv6=t=>e.check(mr(ua,t)),e.e164=t=>e.check(_r(pa,t)),e.datetime=t=>e.check(Di(t)),e.date=t=>e.check(ki(t)),e.time=t=>e.check(ji(t)),e.duration=t=>e.check(Ni(t))});function O(e){return Xn(Ji,e)}var k=n(`ZodStringFormat`,(e,t)=>{C.init(e,t),qi.init(e,t)}),Yi=n(`ZodEmail`,(e,t)=>{Rt.init(e,t),k.init(e,t)}),Xi=n(`ZodGUID`,(e,t)=>{It.init(e,t),k.init(e,t)}),Zi=n(`ZodUUID`,(e,t)=>{Lt.init(e,t),k.init(e,t)}),Qi=n(`ZodURL`,(e,t)=>{zt.init(e,t),k.init(e,t)});function $i(e){return rr(Qi,e)}var ea=n(`ZodEmoji`,(e,t)=>{Bt.init(e,t),k.init(e,t)}),ta=n(`ZodNanoID`,(e,t)=>{Vt.init(e,t),k.init(e,t)}),na=n(`ZodCUID`,(e,t)=>{Ht.init(e,t),k.init(e,t)}),ra=n(`ZodCUID2`,(e,t)=>{Ut.init(e,t),k.init(e,t)}),ia=n(`ZodULID`,(e,t)=>{Wt.init(e,t),k.init(e,t)}),aa=n(`ZodXID`,(e,t)=>{Gt.init(e,t),k.init(e,t)}),oa=n(`ZodKSUID`,(e,t)=>{Kt.init(e,t),k.init(e,t)}),sa=n(`ZodIPv4`,(e,t)=>{Zt.init(e,t),k.init(e,t)}),ca=n(`ZodIPv6`,(e,t)=>{Qt.init(e,t),k.init(e,t)}),la=n(`ZodCIDRv4`,(e,t)=>{$t.init(e,t),k.init(e,t)}),ua=n(`ZodCIDRv6`,(e,t)=>{en.init(e,t),k.init(e,t)}),da=n(`ZodBase64`,(e,t)=>{nn.init(e,t),k.init(e,t)}),fa=n(`ZodBase64URL`,(e,t)=>{an.init(e,t),k.init(e,t)}),pa=n(`ZodE164`,(e,t)=>{on.init(e,t),k.init(e,t)}),ma=n(`ZodJWT`,(e,t)=>{cn.init(e,t),k.init(e,t)}),ha=n(`ZodNumber`,(e,t)=>{ln.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oi(e,t,n,r),e.gt=(t,n)=>e.check(Ar(t,n)),e.gte=(t,n)=>e.check(jr(t,n)),e.min=(t,n)=>e.check(jr(t,n)),e.lt=(t,n)=>e.check(Or(t,n)),e.lte=(t,n)=>e.check(kr(t,n)),e.max=(t,n)=>e.check(kr(t,n)),e.int=t=>e.check(va(t)),e.safe=t=>e.check(va(t)),e.positive=t=>e.check(Ar(0,t)),e.nonnegative=t=>e.check(jr(0,t)),e.negative=t=>e.check(Or(0,t)),e.nonpositive=t=>e.check(kr(0,t)),e.multipleOf=(t,n)=>e.check(Mr(t,n)),e.step=(t,n)=>e.check(Mr(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ga(e){return Cr(ha,e)}var _a=n(`ZodNumberFormat`,(e,t)=>{un.init(e,t),ha.init(e,t)});function va(e){return wr(_a,e)}var ya=n(`ZodNull`,(e,t)=>{dn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>si(e,t,n,r)});function ba(e){return Tr(ya,e)}var xa=n(`ZodUnknown`,(e,t)=>{fn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Sa(){return Er(xa)}var Ca=n(`ZodNever`,(e,t)=>{pn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ci(e,t,n,r)});function wa(e){return Dr(Ca,e)}var Ta=n(`ZodArray`,(e,t)=>{hn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pi(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Pr(t,n)),e.nonempty=t=>e.check(Pr(1,t)),e.max=(t,n)=>e.check(Nr(t,n)),e.length=(t,n)=>e.check(Fr(t,n)),e.unwrap=()=>e.element});function A(e,t){return Jr(Ta,e,t)}var Ea=n(`ZodObject`,(e,t)=>{bn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mi(e,t,n,r),m(e,`shape`,()=>t.shape),e.keyof=()=>Na(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Sa()}),e.loose=()=>e.clone({...e._zod.def,catchall:Sa()}),e.strict=()=>e.clone({...e._zod.def,catchall:wa()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>de(e,t),e.safeExtend=t=>fe(e,t),e.merge=t=>pe(e,t),e.pick=t=>le(e,t),e.omit=t=>ue(e,t),e.partial=(...t)=>me(La,e,t[0]),e.required=(...t)=>he(Ka,e,t[0])});function j(e,t){return new Ea({type:`object`,shape:e??{},...b(t)})}var Da=n(`ZodUnion`,(e,t)=>{Sn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hi(e,t,n,r),e.options=t.options});function M(e,t){return new Da({type:`union`,options:e,...b(t)})}var Oa=n(`ZodIntersection`,(e,t)=>{Cn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gi(e,t,n,r)});function ka(e,t){return new Oa({type:`intersection`,left:e,right:t})}var Aa=n(`ZodRecord`,(e,t)=>{En.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_i(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function ja(e,t,n){return new Aa({type:`record`,keyType:e,valueType:t,...b(n)})}var Ma=n(`ZodEnum`,(e,t)=>{Dn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>li(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ma({...t,checks:[],...b(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ma({...t,checks:[],...b(r),entries:i})}});function Na(e,t){return new Ma({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...b(t)})}var Pa=n(`ZodLiteral`,(e,t)=>{On.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ui(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function N(e,t){return new Pa({type:`literal`,values:Array.isArray(e)?e:[e],...b(t)})}var Fa=n(`ZodTransform`,(e,t)=>{kn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fi(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new i(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(xe(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(xe(t))}};let a=t.transform(n.value,n);return a instanceof Promise?a.then(e=>(n.value=e,n)):(n.value=a,n)}});function Ia(e){return new Fa({type:`transform`,transform:e})}var La=n(`ZodOptional`,(e,t)=>{jn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function P(e){return new La({type:`optional`,innerType:e})}var Ra=n(`ZodExactOptional`,(e,t)=>{Mn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function za(e){return new Ra({type:`optional`,innerType:e})}var Ba=n(`ZodNullable`,(e,t)=>{Nn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Va(e){return new Ba({type:`nullable`,innerType:e})}var Ha=n(`ZodDefault`,(e,t)=>{Pn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ua(e,t){return new Ha({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():re(t)}})}var Wa=n(`ZodPrefault`,(e,t)=>{In.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ga(e,t){return new Wa({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():re(t)}})}var Ka=n(`ZodNonOptional`,(e,t)=>{Ln.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qa(e,t){return new Ka({type:`nonoptional`,innerType:e,...b(t)})}var Ja=n(`ZodCatch`,(e,t)=>{zn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ya(e,t){return new Ja({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Xa=n(`ZodPipe`,(e,t)=>{Bn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),e.in=t.in,e.out=t.out});function Za(e,t){return new Xa({type:`pipe`,in:e,out:t})}var Qa=n(`ZodReadonly`,(e,t)=>{Hn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $a(e){return new Qa({type:`readonly`,innerType:e})}var eo=n(`ZodCustom`,(e,t)=>{Wn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>di(e,t,n,r)});function to(e,t){return Yr(eo,e??(()=>!0),t)}function no(e,t={}){return Xr(eo,e,t)}function ro(e){return Zr(e)}var F=function(e){return e.Article=`article`,e.AudioDocument=`audiodocument`,e.AudioVisualDocument=`audiovisualdocument`,e.Book=`book`,e.Bookitem=`bookitem`,e.Conference=`conference`,e.Document=`document`,e.Image=`image`,e.Issue=`issue`,e.Journal=`journal`,e.Preprint=`preprint`,e.Proceeding=`proceeding`,e.Report=`report`,e.Unknown=`unknown`,e.Webpage=`webpage`,e}({}),io=M([N(F.Book),N(F.Bookitem),N(F.Conference),N(F.Document),N(F.Report),N(F.Proceeding),N(F.Unknown)]),ao=M([N(F.Article),N(F.Conference),N(F.Issue),N(F.Journal),N(F.Preprint),N(F.Proceeding),N(F.Unknown)]),oo=j({artnum:O(),atitle:O(),aufirst:O(),aulast:O(),auinit:O(),auinit1:O(),auinitm:O(),ausuffix:O(),au:A(O()),aucorp:O(),bici:O(),btitle:O(),chron:O(),coden:O(),date:O(),edition:O(),eissn:O(),epage:O(),externalDBID:O(),externalDocID:O(),genre:Na(F),id:O(),isbn:O(),issn:O(),issue:O(),jtitle:O(),pages:O(),part:O(),place:O(),pub:O(),quarter:O(),rft_id:A(O()),series:O(),sici:O(),spage:O(),ssn:O(),stitle:O(),title:O(),tpages:O(),volume:O()}).partial(),so=j({bibid:O(),doi:O(),uri:O()}).partial(),co=oo.pick({atitle:!0,aufirst:!0,aulast:!0,auinit:!0,auinit1:!0,auinitm:!0,ausuffix:!0,au:!0,aucorp:!0,bici:!0,btitle:!0,date:!0,edition:!0,epage:!0,id:!0,isbn:!0,issn:!0,pages:!0,place:!0,pub:!0,rft_id:!0,title:!0,tpages:!0,series:!0,spage:!0}).partial(),lo=oo.pick({artnum:!0,atitle:!0,aufirst:!0,aulast:!0,auinit:!0,auinit1:!0,auinitm:!0,ausuffix:!0,au:!0,aucorp:!0,chron:!0,coden:!0,date:!0,epage:!0,id:!0,isbn:!0,eissn:!0,issn:!0,issue:!0,title:!0,jtitle:!0,pages:!0,part:!0,pub:!0,rft_id:!0,sici:!0,spage:!0,stitle:!0,ssn:!0,quarter:!0,volume:!0}).partial(),uo=oo.pick({au:!0,date:!0,isbn:!0,pub:!0,title:!0}).partial(),fo=oo.pick({au:!0,date:!0,pub:!0,title:!0}).partial(),po=oo.pick({au:!0,date:!0,pub:!0,title:!0,spage:!0,epage:!0}).partial(),mo=oo.pick({au:!0,date:!0,title:!0}).partial(),ho=j({...oo.shape,...so.shape}),I=(e,t)=>({...t,genre:e}),L=(e,t)=>({...t,genre:e}),R=e=>({...e,genre:F.AudioVisualDocument}),go=e=>({...e,genre:F.Image}),_o=e=>({...e,genre:F.Document}),vo=e=>({...e,genre:F.Webpage}),yo=e=>Object.keys(e.shape),bo=yo(oo),xo=yo(so),So=(e,t,n)=>{if(n.length>0&&typeof n[0]==`string`){let r=t.startsWith(`rft_`)?t:`rft.${t}`;e.append(r,n[0])}},Co=(e,t,n)=>{e.append(t,n)},wo=(e,t,n)=>{e.append(`rft.${t}`,n)},To=e=>xo.includes(e),Eo=e=>{let t=new URLSearchParams;return Object.entries(e).forEach(([e,n])=>{Array.isArray(n)?So(t,e,n):typeof n==`string`&&n&&(To(e)?Co(t,e,n):wo(t,e,n))}),t},Do=(e,t,n,r)=>{let i=t.getAll(n).filter(e=>!!e).map(e=>e.trim());return i.length===0?e:{...e,[r]:i}},Oo=e=>{let t=ko(e),n=(e,n)=>{if(n===`au`)return Do(e,t,`rft.au`,`au`);if(n===`rft_id`)return Do(e,t,`rft_id`,`rft_id`);let r=To(n)?n:`rft.${n}`,i=t.get(r);return i?{...e,[n]:i.trim()}:e},r=[...bo,...xo].reduce(n,{});return Object.keys(r).length===0?null:r},ko=e=>URL.canParse(e)?new URL(e).searchParams:new URLSearchParams(e);function Ao(e){return typeof e==`string`?Object.values(F).includes(e):!1}var jo=function(e){return e.CA=`CA`,e.EUAPAC=`EUAPAC`,e}({}),Mo=j({id:O(),name:O(),region:Na(jo)}),No=j({tenants:A(Mo)}),Po=9*1024*1024,Fo=j({url:$i({error:e=>e.input===void 0?`should have the required string property "url"`:`"url" must be a string`}),html:O({error:e=>e.input===void 0?`should have the required string property "html"`:void 0}).max(Po,{error:`"html" should be a string with a MAX Length of ${Po}`}),tenantCode:O({error:e=>e.input===void 0?`should have the required string property "tenantCode"`:void 0}).min(1,{error:`"tenantCode" must be a string`}),region:Na([jo.EUAPAC,jo.CA],{error:e=>e.input===void 0?`should have the required string property "region"`:`"region" must be a string of EUAPAC or CA`})});function Io(e){return Fo.safeParse(e).success}var Lo=j({name:O(),region:Na(jo),apps:ja(O(),O())}),Ro=ja(O(),Lo),zo=e=>Lo.safeParse(e).success,Bo=e=>Ro.safeParse(e).success;function Vo(e){return Mo.safeParse(e).success}function Ho(e){return typeof e==`string`&&Object.keys(jo).includes(e)}var Uo=e=>{if(!Bo(e))throw Error(`Error: the customer list data is invalid.`);return{tenants:Object.entries(e).map(([e,t])=>Wo(e,t))}},Wo=(e,t)=>{if(!zo(t))throw Error(`Invalid customer: ${t}`);let{name:n,region:r}=t,i={id:e,name:n,region:r};if(!Vo(i))throw Error(`Invalid tenant: ${JSON.stringify(i)}`);return i},Go=j({parserType:O(),parserName:O().nullable(),referrer:O()}),Ko=j({bookmarkingWorkflowUrl:ba(),resource:ba()}),qo=j({bookmarkingWorkflowUrl:O(),resource:ba()}),Jo=j({bookmarkingWorkflowUrl:ba(),resource:ho}),Yo=j({z3988SearchResult:N(!0)}),Xo=j({summonSearchResult:N(!0)}),Zo=M([qo,Ko,Jo,Yo,Xo]),Qo=j({meta:Go}).and(Zo);function $o(e){return{bookmarkingWorkflowUrl:e,resource:null}}function z(){return{bookmarkingWorkflowUrl:null,resource:null}}function B(e){return{bookmarkingWorkflowUrl:null,resource:e}}function es(){return{z3988SearchResult:!0}}function ts(){return{summonSearchResult:!0}}var ns=e=>{let t=e.getAttribute(`title`);return t?Oo(t):null},rs=({document:e})=>{let t=Array.from(e.querySelectorAll(`.Z3988`));if(t.length===0)return z();let n=t.map(ns).find(e=>e!==null);return n?B(n):z()},is=e=>{let t=Array.from(e.querySelectorAll(`.author > a`)).map(e=>e.textContent.trim()).filter(Boolean);return t.length?t:void 0},as=e=>e.querySelector(`#rpi-attribute-book_details-edition > .rpi-attribute-value > span`)?.textContent??void 0,os=e=>{let t=e.querySelector(`#rpi-attribute-book_details-isbn10 > .rpi-attribute-value > span`)?.textContent??void 0,n=e.querySelector(`#rpi-attribute-book_details-isbn13 > .rpi-attribute-value > span`)?.textContent??void 0;if(t&&n)return`${t},${n}`;if(t)return t;if(n)return n},ss=e=>e.querySelector(`#rpi-attribute-book_details-publication_date > .rpi-attribute-value > span`)?.textContent??void 0,cs=e=>e.querySelector(`#rpi-attribute-book_details-publisher > .rpi-attribute-value > span`)?.textContent??void 0,ls=e=>e.querySelector(`#rpi-attribute-book_details-series > .rpi-attribute-value > a`)?.textContent??void 0,us=e=>{let t=e.querySelector(`#rpi-attribute-book_details-fiona_pages > .rpi-attribute-value > span`)?.textContent??void 0;return(t?/\d+/.exec(t)?.[0]:null)??void 0},ds=({document:e})=>{let t=is(e),n=as(e),r=os(e),i=ss(e),a=cs(e),o=ls(e),s=e.getElementById(`productTitle`)?.textContent.trim()??void 0,c=us(e);return{bookmarkingWorkflowUrl:null,resource:I(F.Book,{au:t,date:i,edition:n,isbn:r,pub:a,series:o,title:s,tpages:c})}},V=(e,t,n)=>{let r=H(e,t,n);return r.length>0?r[0]:void 0},H=(e,t,n)=>Array.from(e.querySelectorAll(`meta[${t}='${n}']`)).map(e=>e.getAttribute(`content`)).filter(e=>!!e?.trim()),fs=e=>{let t=new Map,n=e.split(`;`).filter(e=>!!e);for(let e of n){let[n,r,i]=e.split(`:`);t.set(n,{type:r,value:i})}return t},U=function(e){return e[e.None=0]=`None`,e[e.Book=1]=`Book`,e[e.Chapter=2]=`Chapter`,e[e.Journal=3]=`Journal`,e[e.Article=4]=`Article`,e[e.AudioVisual=5]=`AudioVisual`,e[e.Webpage=6]=`Webpage`,e[e.Document=7]=`Document`,e}({}),ps=e=>{if(!e)return;let t=/\b\d{4}\b/.exec(e);return t?t[0]:void 0},ms=e=>ps(e.querySelector(`#publication_date p`)?.textContent.trim()??V(e,`name`,`bepress_citation_date`)),hs=e=>({spage:V(e,`name`,`bepress_citation_firstpage`),epage:V(e,`name`,`bepress_citation_lastpage`)}),gs=e=>{let t=/https?:\/\/doi\.org\/(.+)/i,n=(e.querySelector(`#source p`)?.textContent.trim())?.match(t);if(n?.length===2)return n[1];let r=(e.querySelector(`#recommended_citation p a`)?.textContent.trim())?.match(t);if(r?.length===2)return r[1]},_s=e=>{let t=[],n=e.querySelectorAll(`tbody td`);for(let e of n){let n=e.querySelector(`strong`);if(n&&!n.querySelector(`a`)){let e=n.textContent.trim();e&&t.push(e)}}return t},vs=e=>V(e,`name`,`bepress_citation_title`)??e.querySelector(`title`)?.textContent.trim(),ys=e=>H(e,`name`,`author`),bs=e=>V(e,`name`,`bepress_citation_publisher`),xs=e=>V(e,`name`,`bepress_citation_pdf_url`),Ss=(e,t)=>{if(t.includes(`/etd/`))return U.Document;if(t.includes(`/sophpm_music/`)||t.includes(`/streaming/`))return U.AudioVisual;if(t.includes(`/vol`))return U.Article;if(t.includes(`/facpub`)||t.includes(`/studentpub/`)){let t={"book chapter":U.Book,"conference paper":U.Book,"peer-reviewed article":U.Article,other:U.Document},n=e.querySelector(`#document_type p`)?.textContent.toLowerCase().trim();return n?t[n]:void 0}return U.Journal},Cs=e=>{let t=vs(e),n=ys(e),r=ms(e),i=V(e,`name`,`bepress_citation_journal_title`),a=V(e,`name`,`bepress_citation_volume`),o=V(e,`name`,`bepress_citation_issue`),{epage:s,spage:c}=hs(e),l=xs(e),u=gs(e);return L(F.Article,{atitle:t,jtitle:i,au:n,date:r,volume:a,issue:o,epage:s,spage:c,doi:u,uri:l})},ws=(e,t)=>{let n=e.querySelector(`.inherit-title a`)?.textContent.trim()??vs(e),r=_s(e),i=ms(e),a=bs(e),o=gs(e);return L(F.Journal,{jtitle:n,au:r,date:i,pub:a,doi:o,uri:t})},Ts=e=>{let t=vs(e),n=ys(e),r=ms(e),i=bs(e),a=xs(e),o=e.querySelector(`#document_type p`)?.textContent.toLowerCase().trim();if(o===`book chapter`){let o=e.querySelector(`#source p`)?.textContent.trim();return I(F.Bookitem,{pub:i,atitle:t,btitle:o,au:n,date:r,uri:a})}let s=gs(e);return I(o===`conference paper`?F.Conference:F.Document,{pub:i,title:t,au:n,date:r,doi:s,uri:a})},Es=(e,t)=>R({title:vs(e),au:ys(e),date:ms(e),pub:bs(e),uri:t}),Ds=e=>{let t=vs(e),n=ys(e),r=ms(e);return _o({pub:bs(e),title:t,au:n,date:r,uri:xs(e)})},Os=({url:e,document:t})=>{switch(Ss(t,e)){case U.Article:return B(Cs(t));case U.Journal:return B(ws(t,e));case U.Book:return B(Ts(t));case U.AudioVisual:return B(Es(t,e));case U.Document:return B(Ds(t));default:return z()}},ks=e=>{if(e)return e.replace(/[^0-9]/g,``)},As=e=>Array.from(e.querySelectorAll(`.author-source-list li a`)).filter(e=>e.childNodes.length>0).map(e=>e.childNodes[0].textContent?.trim()).filter(e=>!!e),js=e=>e.querySelector(`.article-header`)?.querySelector(`h1 span`)?.textContent.trim(),Ms=e=>({date:e?.textContent.match(/\d{4}/)?.[0],pub:`Elsevier Inc.`}),Ns=e=>{let t=e.querySelector(`.article-meta`);if(!t)return{};let n=t.querySelector(`.issue`)?.textContent??void 0,r=t.querySelector(`.title`)?.textContent.trim()??void 0,[i,a]=(n?.split(`,`)??[]).map(e=>e.trim());return{volume:ks(i),issue:ks(a),jtitle:r}},Ps=e=>{let t=e.querySelector(`.article-header .source`)?.textContent,n=t?.match(/\d{4}-\d{2}-\d{2}/)?.[0],[r,i]=((t?.match(/Pages (\d+-\d+)/))?.[1].split(`-`)??[]).map(e=>e.trim()),{jtitle:a,volume:o,issue:s}=Ns(e);return B(L(F.Article,{au:As(e),atitle:js(e),spage:r,epage:i,date:n,jtitle:a,volume:o,issue:s}))},Fs=e=>{let[t,n]=e.querySelectorAll(`.source`),{date:r,pub:i}=Ms(n),[a,o]=(e.querySelector(`.browse__book-toc`)?.querySelector(`h1`)?.textContent.split(`,`)??[]).map(e=>e.trim());return B(I(F.Book,{btitle:a,edition:o,pub:i,au:t.textContent?[t.textContent]:void 0,date:r}))},Is=e=>{let t=e.querySelector(`.article-meta`);if(!t)return{};let n=t.querySelector(`.edition`)?.textContent??void 0,r=t.querySelector(`.title`)?.textContent.trim()??void 0,{date:i,pub:a}=Ms(t.querySelector(`.copyright`));return{edition:n,btitle:r,date:i,pub:a}},Ls=e=>{let{edition:t,btitle:n,date:r,pub:i}=Is(e),[a,o]=(((e.querySelector(`.article-header .source`)?.textContent)?.match(/(\d+-\d+|[IVXLCDM]+-[IVXLCDM]+)/i))?.[1].split(`-`)??[]).map(e=>e.trim());return B(I(F.Bookitem,{au:As(e),atitle:js(e),btitle:n,edition:t,pub:i,date:r,spage:a,epage:o}))},Rs=/^[0-9X]$/,zs=e=>{if(!e)return;let t=``;for(let n of e)Rs.test(n)&&(t+=n);if(t)return t},Bs=(e,t)=>{let n=e.querySelector(`.c-cksc-content-header__title`)?.textContent.trim(),r=e.querySelector(`.c-cksc-content-nice__button`)?.textContent.trim(),i=e.querySelector(`.c-cksc-content-nice__date`)?.textContent.trim(),a=zs(e.evaluate(`//p[contains(text(), "ISBN")]`,e,null,XPathResult.ANY_TYPE).iterateNext()?.textContent);return B({genre:F.Document,title:n,pub:r,date:i,uri:t,isbn:a})},Vs=e=>e.querySelector(`.browse-toc`)??e.querySelector(`.browse__journal`),Hs=e=>(Vs(e)?.querySelector(`h1`)?.firstElementChild)?.textContent.trim(),Us=e=>{let t=Vs(e),n=t?.querySelector(`figure figcaption.source`);if(n){let[e,t,r]=n.textContent.split(`,`).map(e=>e.trim());return{date:e,volume:ks(t),issue:ks(r)}}let[r,i]=(t?.querySelector(`p`)?.textContent)?.split(`,`)??[];return{date:t?.querySelector(`.source span`)?.textContent??void 0,volume:ks(r),issue:ks(i)}},Ws=e=>{let{date:t,volume:n,issue:r}=Us(e);return B(L(F.Journal,{jtitle:Hs(e),date:t,volume:n,issue:r}))},Gs=function(e){return e.Book=`Book`,e.Chapter=`Book Chapter`,e.Article=`Full Text Article`,e.Journal=`Journal`,e.Guideline=`Guideline`,e}(Gs||{}),Ks=e=>Object.values(Gs).includes(e),qs=(e,t)=>{let n=e.querySelector(`.content-type`)??e.querySelector(`.c-cksc-content-header__content-type`);if(!n)return t.includes(`journal`)?Gs.Journal:void 0;let r=n.textContent;if(r&&Ks(r))return r},Js=({url:e,document:t})=>{switch(qs(t,e)){case Gs.Book:return Fs(t);case Gs.Chapter:return Ls(t);case Gs.Article:return Ps(t);case Gs.Journal:return Ws(t);case Gs.Guideline:return Bs(t,e);case void 0:return z()}},Ys=j({"@context":O()}),Xs=e=>Ys.safeParse(e).success,Zs=`script[type="application/ld+json"]`,Qs=e=>Array.from(e.querySelectorAll(Zs)),$s=e=>e.querySelector(Zs),ec=e=>{let t=e.textContent;if(!t)return null;try{let e=JSON.parse(t);if(Xs(e))return e}catch{return null}return null},tc=j({"@id":O(),"@type":O(),author:j({"@id":O()}).optional(),datePublished:O().optional(),dateModified:O().optional(),description:O().optional(),inLanguage:O().optional(),isPartOf:j({"@id":O()}).optional(),name:O().optional(),url:O().optional()}),nc=Ys.extend({"@graph":A(tc)}),rc=e=>nc.safeParse(e).success,ic=e=>{let t=Qs(e);if(t.length===0)return null;let n=t.map(ec).filter(rc).map(e=>e[`@graph`]);return n.length===1?n[0]:null},ac=(e,t)=>e.find(e=>e[`@type`]===t)??null,oc=(e,t)=>e.find(e=>e[`@id`]===t)??null,sc=e=>{let t=ac(e,`WebPage`);if(!t)return null;let n=t.author?oc(e,t.author[`@id`]):void 0;return vo({au:n?.name?[n.name]:void 0,date:t.datePublished,title:t.name})},cc=({document:e})=>{let t=ic(e);return t?{bookmarkingWorkflowUrl:null,resource:sc(t)}:z()},lc=()=>z(),uc=function(e){return e.Journal=`journal`,e.Article=`article`,e}(uc||{}),dc=e=>{let{pathname:t}=new URL(e);if(t.startsWith(`/toc/`))return uc.Journal;if(t.startsWith(`/article/`))return uc.Article},fc=e=>{let t=e.querySelector(`header h1 span`)?.firstChild?.textContent?.trim(),n=(e.querySelector(`header p span`)?.textContent.trim())?.match(/\d{4}-\d{3}[\dX]/g)??[],[r,i]=[n[0],n[1]],a=e.evaluate(`//dt[contains(text(), "Publisher")]/following-sibling::dd/a`,e,null,XPathResult.STRING_TYPE).stringValue.trim();return B(L(F.Journal,{pub:a,jtitle:t,issn:r,eissn:i}))},pc=e=>{let t,n,r=H(e,`name`,`citation_issn`);return r.length===2?(t=r[1],n=r[0]):t=r[0],{eissn:t,issn:n}},mc=e=>{let t=V(e,`name`,`citation_journal_title`),n=V(e,`name`,`citation_title`),r=H(e,`name`,`citation_author`),i=V(e,`name`,`citation_doi`),{eissn:a,issn:o}=pc(e),s=V(e,`name`,`citation_publisher`),c=V(e,`name`,`citation_publication_date`),l=V(e,`name`,`citation_volume`),u=V(e,`name`,`citation_issue`),d=V(e,`name`,`citation_firstpage`),f=V(e,`name`,`citation_lastpage`);return B(L(F.Article,{jtitle:t,atitle:n,au:r,doi:i,eissn:a,issn:o,pub:s,date:c,volume:l,issue:u,spage:d,epage:f}))},hc=({document:e,url:t})=>{switch(dc(t)){case uc.Journal:return fc(e);case uc.Article:return mc(e);case void 0:return z()}},gc=e=>{let t=V(e,`name`,`pbContext`);if(!t)return U.None;let n=fs(t);switch(n.has(`page`)?n.get(`page`)?.value:null){case`Article/Chapter View`:return U.Article;case`Table of Contents`:return U.Journal;default:return U.None}},_c=e=>{let t=e.querySelector(`meta[property="article:author"]`)?.getAttribute(`content`)?.split(`,`).map(e=>e.trim());return t&&t.length>0?t:void 0},vc=e=>{let t=new Map,n=Array.from(e.querySelectorAll(`.rlist>li>span`)).map(e=>e.textContent.trim()).join(``),r=/^ISSN:\s(\d{4}-\d{3}(?:\d|X))/.exec(n);r&&t.set(`issn`,r[1]);let i=/Online ISSN:\s(\d{4}-\d{3}(?:\d|X))/.exec(n);return i&&t.set(`eissn`,i[1]),t},yc=e=>e.querySelector(`span[property="isPartOf"][typeof="PublicationVolume"] > span[property="volumeNumber"]`)?.textContent??void 0,bc=e=>e.querySelector(`span[property="isPartOf"][typeof="PublicationIssue"] > span[property="issueNumber"]`)?.textContent??void 0,xc=e=>e.querySelector(`meta[name="dc.Identifier"][scheme="doi"]`)?.getAttribute(`content`)??void 0,Sc=e=>e.querySelector(`h1`)?.textContent??void 0,Cc=e=>{let t=new Map,n=e.querySelector(`h2.heading-m`)?.textContent,r=n?.match(/Issue\s+(\d+(?:-\d+)?)/);r&&t.set(`issue`,r[1]);let i=n?.match(/Volume\s+(\d+)/);i&&t.set(`volume`,i[1]);let a=n?.match(/(\d{4})$/);return a&&t.set(`date`,a[1]),t},wc=e=>{let t=_c(e.document),n=V(e.document,`name`,`dc.Date`),r=xc(e.document),i=vc(e.document),a=i.get(`issn`),o=i.get(`eissn`),s=bc(e.document),c=V(e.document,`name`,`citation_journal_title`),l=V(e.document,`name`,`dc.Publisher`),u=V(e.document,`name`,`dc.Title`),d=yc(e.document);return L(F.Article,{au:t,date:n,eissn:o,issn:a,issue:s,jtitle:c,pub:l,title:u,volume:d,doi:r})},Tc=e=>{let t=vc(e.document),n=t.get(`issn`),r=t.get(`eissn`),i=Sc(e.document),a=Cc(e.document),o=a.get(`issue`),s=a.get(`volume`),c=a.get(`date`);return L(F.Journal,{eissn:r,issn:n,jtitle:i,title:i,issue:o,volume:s,date:c})},Ec=e=>{switch(gc(e.document)){case U.Article:return B(wc(e));case U.Journal:return B(Tc(e));default:return z()}},Dc=e=>{let t=V(e,`name`,`citation_type`),n=V(e,`name`,`citation_article_type`);return t===`JOUR`&&n?U.Article:t===`CHP`?U.Chapter:e.querySelector(`.book-edition-year`)?.textContent.includes(`Book`)?U.Book:e.getElementById(`journal-title`)?U.Journal:U.None},Oc=e=>V(e,`name`,`citation_doi`)??V(e,`name`,`dc.identifier`)??e.querySelector(`.doi .anchor-text`)?.textContent??void 0,kc=e=>{let t=Array.from(e.querySelectorAll(`.kf-details .kf-detail-item:has(h3)`)),n=new Map;for(let e of t){let t=e.querySelector(`h3`)?.textContent,r=e.querySelector(`p`)?.textContent;t&&r&&n.set(t,r)}return n},Ac=(e,t)=>{let n=Array.from(e.querySelectorAll(t)).map(e=>e.textContent).filter(e=>!!e);return n.length>0?n:void 0},jc=e=>{let t=e.querySelector(`.js-issn`)?.textContent;if(t)return t.replace(`Online ISSN: `,``)},Mc=e=>{let t=e.get(`DOI`);if(t)return URL.canParse(t)?new URL(t).pathname.substring(1):t},Nc=e=>{let t=kc(e),n=V(e,`property`,`og:title`),r=V(e,`property`,`og:book:isbn`),i=t.get(`Published`),a=Ac(e,`.authors-container .author-detail h3`),o=Oc(e)??Mc(t);return I(F.Book,{au:a,date:i,doi:o,isbn:r,title:n})},Pc=e=>{let t=V(e,`property`,`og:title`),n=V(e,`property`,`og:book:isbn`),r=V(e,`name`,`citation_publication_date`),i=Ac(e,`.author-group .button-link-text`),a=V(e,`name`,`citation_firstpage`),o=V(e,`name`,`citation_lastpage`),s=V(e,`name`,`citation_publisher`),c=Oc(e),l=V(e,`name`,`citation_inbook_title`)??e.querySelector(`.publication-title`)?.textContent??void 0;return I(F.Bookitem,{au:i,btitle:l,date:r,doi:c,epage:o,isbn:n,pub:s,spage:a,title:t})},Fc=e=>{let t=V(e,`property`,`og:title`),n=V(e,`name`,`citation_issn`),r=V(e,`name`,`citation_publication_date`),i=Ac(e,`.author-group .button-link-text`),a=V(e,`name`,`citation_publisher`),o=V(e,`name`,`citation_firstpage`),s=V(e,`name`,`citation_issue`),c=V(e,`name`,`citation_volume`),l=Oc(e),u=V(e,`name`,`citation_journal_title`)??e.querySelector(`.publication-title`)?.textContent??void 0;return L(F.Article,{au:i,jtitle:u,date:r,doi:l,issn:n,issue:s,pub:a,spage:o,title:t,volume:c})},Ic=e=>{let t=e.getElementById(`journal-title`)?.textContent??void 0,n=jc(e);return L(F.Journal,{issn:n,title:t})},Lc=({document:e})=>{switch(Dc(e)){case U.Book:return B(Nc(e));case U.Chapter:return B(Pc(e));case U.Article:return B(Fc(e));case U.Journal:return B(Ic(e));default:return z()}},Rc=e=>{let t=V(e,`name`,`pbContext`);return t&&fs(t).has(`article`)?U.Article:U.Journal},zc=e=>{let t=e.querySelector(`.itemPageRangeHistory`);if(!t)return;let n=Array.from(t.childNodes).find(e=>e.textContent?.trim().startsWith(`Page`));if(n)return n.textContent?.replace(/Pages?/,``).trim()??void 0},Bc=e=>{let t=e.querySelector(`.issue-heading`)?.textContent;if(t)return t.split(`,`)[0]?.replace(`Volume`,``).trim()},Vc=e=>{let t=e.querySelector(`.issue-heading .nav-toc-list`)?.textContent;if(t)return t.replace(`Issue`,``).trim()},Hc=e=>{let t=V(e,`property`,`og:title`),n=V(e,`name`,`dc.Publisher`),r=V(e,`name`,`dc.Date`),i=V(e,`name`,`publication_doi`),a=V(e,`name`,`citation_journal_title`),o=H(e,`name`,`dc.Creator`),s=Bc(e),c=Vc(e),l=zc(e),u=l?.includes(`-`)?l.split(`-`)[0]:l,d=l?.includes(`-`)?l.split(`-`)[1]:l;return L(F.Article,{au:o,jtitle:a,date:r,doi:i,issue:c,pub:n,spage:u,epage:d,title:t,volume:s})},Uc=e=>{let t=V(e,`property`,`og:title`),n=V(e,`name`,`publication_doi`);return L(F.Journal,{doi:n,title:t})},Wc=({document:e})=>{switch(Rc(e)){case U.Article:return B(Hc(e));case U.Journal:return B(Uc(e));default:return z()}},Gc=e=>Zo.safeParse(e).success,Kc=e=>Qo.safeParse(e).success,qc=e=>Go.safeParse(e).success;function Jc(e){return qo.safeParse(e).success}function Yc(e){return Jo.safeParse(e).success}function Xc(e){return Yo.safeParse(e).success}function Zc(e){return Xo.safeParse(e).success}function Qc(e){return Ko.safeParse(e).success}var $c=e=>Array.from(e.querySelectorAll(`tr th`)).find(e=>e.textContent.trim()===`DOI:`)?.nextElementSibling?.querySelector(`span[property="identifier"]`)?.textContent??void 0,el=e=>{let t=/Record\/(\d+)/.exec(e);if(t&&t.length>1)return t[1]},tl=e=>{let{url:t,document:n}=e,r=rs(e);if(!Yc(r))return r;let i=$c(n);return i&&(r.resource.rft_id=[`info:doi/${i}`]),r.resource.bibid=el(t),r},nl=Ys.extend({"@type":N(`VideoObject`),name:O(),author:O(),genre:O(),description:O(),uploadDate:O(),duration:O(),thumbnailUrl:A(O())}),rl=e=>nl.safeParse(e).success,il=e=>{let t=Qs(e);if(t.length===0)return null;let n=t.map(ec).filter(rl);return n.length===1?n[0]:null},al=({url:e,document:t})=>{let n=il(t);return n?{bookmarkingWorkflowUrl:null,resource:R({au:[n.author],date:n.uploadDate,title:n.name,uri:e})}:z()},ol=e=>V(e,`name`,`doi`)??V(e,`name`,`DOI`)??V(e,`name`,`citation_doi`)??V(e,`name`,`dc.identifier`)??V(e,`name`,`prism.doi`)??void 0,sl=e=>{let t=e.editor?.map(e=>e.name)??[],n=[...e.author?.map(e=>e.name)??[],...t];if(n.length!==0)return n},cl=function(e){return e.Book=`Book`,e.Journal=`Journal`,e.Periodical=`Periodical`,e.PublicationVolume=`PublicationVolume`,e.ScholarlyArticle=`ScholarlyArticle`,e.VideoObject=`VideoObject`,e.WebPage=`WebPage`,e}({}),ll=function(e){return e.Article=`article`,e.Book=`book`,e.Paper=`Paper`,e.Video=`video.other`,e.Website=`website`,e}({}),W=function(e){return e.Article=`/article/`,e.Book=`/book/`,e.Chapter=`/chapter/`,e.Video=`/video/`,e.ReferenceWorkEntry=`/referenceworkentry/`,e.ReferenceWork=`/referencework/`,e.Protocol=`/protocol/`,e.Collections=`/collections/`,e.Journal=`/journal/`,e.JournalIssue=`/volumes-and-issues/`,e}({}),ul=j({"@type":N(cl.ScholarlyArticle),author:A(j({"@type":O(),name:O()})).optional(),editor:A(j({"@type":O(),name:O()})).optional(),datePublished:O().optional(),headline:O().optional(),issn:A(O()).optional(),pageStart:O().optional(),pageEnd:O().optional(),isPartOf:j({"@type":M([O(),A(O())]),name:O(),issn:A(O()).optional(),volumeNumber:O().optional(),isbn:A(O()).optional()}),publisher:j({"@type":O(),name:O()}).optional()}),dl=e=>ul.safeParse(e).success,fl=Ys.extend({"@type":N(cl.WebPage),mainEntity:ul}),pl=e=>fl.safeParse(e).success,ml=j({"@type":A(O()),name:O().optional(),issn:A(O()),volumeNumber:O().optional()}),hl=e=>ml.safeParse(e).success,gl=(e,t)=>V(e,`name`,`citation_issn`)??V(e,`name`,`prism.issn`)??(dl(t.isPartOf)?t.isPartOf.issn?.[0]:void 0),_l=(e,t)=>{let n=sl(t),r=V(e,`name`,`citation_online_date`),i=ol(e),a=V(e,`name`,`citation_issue`),o=gl(e,t),s=hl(t.isPartOf)&&t.isPartOf.issn.length>0?t.isPartOf.issn[1]:void 0,c=t.pageStart,l=t.pageEnd,u=t.headline,d=t.isPartOf.name,f=hl(t.isPartOf)?t.isPartOf.volumeNumber:void 0;return L(F.Article,{au:n,date:r,doi:i,issue:a,eissn:o,issn:s,spage:c,epage:l,atitle:u,jtitle:d,volume:f})},vl=Ys.extend({"@type":N(cl.Book),copyrightYear:O().optional(),author:A(j({"@type":O(),name:O()})).optional(),editor:A(j({"@type":O(),name:O()})).optional(),isbn:O().optional(),name:O().optional(),numberOfPages:ga().optional(),publisher:j({"@type":O(),name:O()}).optional()}),yl=e=>vl.safeParse(e).success,bl=function(e){return e.BOOK_TITLE=`Book Title`,e.AUTHORS=`Authors`,e.SERIES_TITLE=`Series Title`,e.DOI=`DOI`,e.PUBLISHER=`Publisher`,e.SOFTCOVER_ISBN=`Softcover ISBN`,e.EBOOK_ISBN=`eBook ISBN`,e.SERIES_ISSN=`Series ISSN`,e.SERIES_EISSN=`Series E-ISSN`,e.EDITION_NUMBER=`Edition Number`,e.NUMBER_OF_PAGES=`Number of Pages`,e}(bl||{}),xl=e=>{let t=e.querySelectorAll(`.c-bibliographic-information__list-item`),n=new Map;return t.forEach(e=>{let t=e.querySelector(`.u-text-bold`)?.textContent.trim(),r=e.querySelector(`.c-bibliographic-information__value`)?.textContent.trim();t&&r&&n.set(t,r)}),n},Sl=(e,t)=>{let n=xl(e),r=sl(t),i=t.copyrightYear?.toString(),a=ol(e)??n.get(bl.DOI),o=t.name??n.get(bl.BOOK_TITLE),s=t.isbn??n.get(bl.SOFTCOVER_ISBN),c=t.numberOfPages?.toString()??n.get(bl.NUMBER_OF_PAGES),l=t.publisher?.name??n.get(bl.PUBLISHER);return I(F.Book,{au:r,date:i,doi:a,title:o,isbn:s,tpages:c,pub:l})},Cl=j({"@type":N(`Periodical`),name:O(),url:O(),issn:A(O()),editor:A(j({givenName:O(),familyName:O()})),publisher:j({name:O()}),description:O()}),wl=e=>Cl.safeParse(e).success,Tl=e=>{let t=e.editor.map(({givenName:e,familyName:t})=>`${e} ${t}`),n=e.name,[r,i]=e.issn,a=e.publisher.name;return L(F.Journal,{au:t,jtitle:n,eissn:r,issn:i,pub:a})},El=j({"@type":N(cl.VideoObject),name:O().optional(),description:O().optional(),thumbnailUrl:O().optional(),uploadDate:O().optional(),contentUrl:O().optional(),duration:O().optional()}),Dl=e=>El.safeParse(e).success,Ol=(e,t)=>{let n=Array.from(e.querySelectorAll(`dd[data-test="video-segment-author"]`)).map(e=>e.textContent.trim()).filter(e=>!!e),r=t?.uploadDate?new Date(t.uploadDate).getFullYear().toString():void 0,i=t?.name??V(e,`property`,`og:title`)??void 0,a=e.querySelector(`video-about-doi`)?.textContent??void 0;return R({au:n.length>0?n:void 0,date:r,doi:a,title:i})},kl=e=>vo({title:V(e,`property`,`og:title`)}),Al=(e,t)=>{let n=V(t,`property`,`og:type`);return n===ll.Article&&e.includes(W.Article)?U.Article:n===ll.Book&&(e.includes(W.Book)||e.includes(W.ReferenceWork))?U.Book:n===ll.Paper&&e.includes(W.Chapter)?U.Chapter:n===ll.Paper&&(e.includes(W.ReferenceWorkEntry)||e.includes(W.Protocol))?U.Article:n===ll.Video&&e.includes(W.Video)?U.AudioVisual:n===ll.Website&&(e.includes(W.Collections)||e.includes(W.JournalIssue))?U.Webpage:n===ll.Website&&e.includes(W.Journal)?U.Journal:U.None},jl=(e,t,n)=>e===U.AudioVisual&&Dl(n)?B(Ol(t,n)):e===U.Book&&yl(n)?B(Sl(t,n)):(e===U.Chapter||e===U.Article)&&dl(n)?B(_l(t,n)):e===U.Article&&pl(n)?B(_l(t,n.mainEntity)):e===U.Journal&&wl(n)?B(Tl(n)):z(),Ml=({url:e,document:t})=>{let n=Al(e,t);if(n===U.Webpage)return B(kl(t));let r=$s(t);if(!r)return z();let i=ec(r);return i?jl(n,t,i):z()},G=function(e){return e.PrintIsbn=`Print ISBN`,e.OnlineIsbn=`Online ISBN`,e.Doi=`DOI`,e.FirstPublished=`First published`,e.OnlineIssn=`Online ISSN`,e.PrintIssn=`Print ISSN`,e}(G||{}),Nl=new Set([G.PrintIsbn,G.OnlineIsbn,G.Doi,G.FirstPublished,G.OnlineIssn,G.PrintIssn]),Pl=j({content:j({item:j({title:O(),"published-date":O()}),group:j({volume:O(),issue:O()}),series:j({title:O(),type:O(),eissn:O()})}).optional()}),Fl=(e,t)=>{if(!e)return;let n=e.indexOf(t);return n>-1?e.substring(0,n):e},Il=e=>{let t=/\d+/.exec(e);if(t?.[0])return t[0]},Ll=e=>{let t=e.querySelectorAll(`script`),n=Array.from(t).find(e=>e.textContent.includes(`adobeDataLayerJson`))?.textContent.match(/var adobeDataLayerJson = (\{.*?});/s);if(n?.length===2)try{let e=JSON.parse(n[1]);return Pl.parse(e)}catch{return}},Rl=(e,t)=>{let n=V(e,`property`,`og:type`),r=t.includes(`epdf`);return n===`Book`||n===`books.book`?U.Book:n===`Chapter`?U.Chapter:n===`Journal`?U.Journal:n===`Article`||r?U.Article:U.None},zl=e=>{let t=H(e,`name`,`citation_author`),n=Array.from(e.querySelectorAll(`#product-details-content .product-authors`)).map(e=>e.textContent).filter(e=>!!e),r=new Set([...t,...n]);return r.size>0?[...r]:void 0},Bl=e=>{let t=Array.from(e.querySelectorAll(`#product-details-content .text-piped p`)).map(e=>e.textContent).find(e=>e.endsWith(` pages`));if(t)return Il(t)},Vl=e=>{let t=new Map,n=Array.from(e.querySelectorAll(`.journal-info-container .info-block`)).flatMap(e=>Array.from(e.querySelectorAll(`.info_label`)));for(let e of n){let n=e.nextElementSibling;if(!n?.classList.contains(`info_value`))continue;let r=Fl(e.textContent,`:`),i=Fl(n.textContent,`:`);!r||!i||Nl.has(r)&&t.set(r,i)}return t},Hl=(e,t)=>V(e,`property`,`books:release_date`)??V(e,`name`,`citation_online_date`)??t.get(G.FirstPublished)??void 0,Ul=(e,t)=>V(e,`name`,`dc.identifier`)??V(e,`name`,`citation_doi`)??V(e,`name`,`publication_doi`)??t.get(G.Doi)??void 0,Wl=(e,t)=>{let n=new Set([V(e,`property`,`books:isbn`),t.get(G.PrintIsbn),t.get(G.OnlineIsbn)].filter(e=>!!e));return n.size>0?[...n].join(`,`):void 0},Gl=e=>{let t,n,r=e.querySelector(`.cover-image__details div:first-of-type`);if(r?.childNodes.length===2){let[e,i]=r.childNodes;e.textContent&&(t=Il(e.textContent)),i.textContent&&(n=Il(i.textContent))}return{volume:t,issue:n}},Kl=e=>{let t=Array.from(e.querySelectorAll(`.authors .author`)).map(e=>e.textContent.trim().replace(`,`,``)).filter(e=>!!e);return t.length>0?t:void 0},ql=e=>{let t=Array.from(e.querySelectorAll(`.details-section .details-entry`)),n=t.find(e=>e.querySelector(`.details-label`)?.textContent.trim()===`ISSN`),r=t.find(e=>e.querySelector(`.details-label`)?.textContent.trim()===`eISSN`),i,a;return n&&(i=n.querySelector(`.details-value`)?.textContent.trim()),r&&(a=r.querySelector(`.details-value`)?.textContent.trim()),{issn:i,eissn:a}},Jl=e=>{if(!e?.content?.group)return{volume:void 0,issue:void 0};let t=e.content.group.volume,n=e.content.group.issue;return n===`0`&&t===`0`?{volume:void 0,issue:void 0}:{volume:t,issue:n}},Yl=e=>{let[t,n]=((Array.from(e.querySelectorAll(`.details-section .details-entry`)).find(e=>e.querySelector(`.details-label`)?.textContent.trim()===`Pages`)?.querySelector(`.details-value`)?.textContent.trim())?.split(`-`)??[void 0,void 0]).map(e=>e?.trim());return t?.toLowerCase()===`n/a`&&n?.toLowerCase()===`n/a`?{spage:void 0,epage:void 0}:{spage:t,epage:n}},Xl=e=>{let t=Vl(e),n=zl(e),r=V(e,`property`,`og:title`),i=Hl(e,t),a=Ul(e,t),o=Wl(e,t),s=Bl(e);return I(F.Book,{au:n,date:i,doi:a,isbn:o,pages:s,title:r})},Zl=e=>{let t=Vl(e),n=zl(e),r=V(e,`name`,`citation_book_title`),i=Hl(e,t),a=Ul(e,t),o=Wl(e,t),s=V(e,`name`,`citation_publisher`),c=V(e,`property`,`og:title`);return I(F.Bookitem,{au:n,btitle:r,date:i,doi:a,isbn:o,pub:s,title:c})},Ql=e=>{let t=Vl(e),n=zl(e),r=Hl(e,t),i=t.get(G.OnlineIssn),a=t.get(G.PrintIssn),o=V(e,`property`,`og:title`),{volume:s,issue:c}=Gl(e);return L(F.Journal,{au:n,date:r,eissn:i,issn:a,issue:c,title:o,volume:s})},$l=e=>{let t=Vl(e),n=Ll(e),r=zl(e)??Kl(e),i=Hl(e,t)??n?.content?.item[`published-date`],a=Ul(e,t),{issn:o,eissn:s}=ql(e),{volume:c,issue:l}=Jl(n),u=V(e,`property`,`og:title`)??n?.content?.item.title,d=V(e,`name`,`citation_journal_title`)??n?.content?.series.title,{spage:f,epage:p}=Yl(e);return L(F.Article,{au:r,date:i,doi:a,eissn:s,issn:o??V(e,`name`,`citation_issn`),issue:l,jtitle:d,title:u,volume:c,spage:f,epage:p})},eu=({document:e,url:t})=>{switch(Rl(e,t)){case U.Book:return B(Xl(e));case U.Chapter:return B(Zl(e));case U.Journal:return B(Ql(e));case U.Article:return B($l(e));default:return z()}},tu=e=>{let t=H(e,`name`,`citation_author`);return t.length>0?t:void 0},nu=({document:e})=>B(R({au:tu(e),date:V(e,`name`,`citation_publication_date`),doi:V(e,`name`,`citation_doi`),isbn:V(e,`name`,`citation_isbn`),pub:V(e,`name`,`citation_publisher`),title:V(e,`name`,`citation_title`)??e.title})),ru=({document:e})=>Array.from(e.querySelectorAll(`.Z3988`)).length<=1?z():es(),iu=e=>{if(!(!e||e.length===0))return e[0]};function au(e,t){return iu(t.map(t=>{let n=e.querySelector(t)?.textContent??null;if(n&&n.trim()!==``)return n}).filter(e=>e))??null}function ou(e,t){let n=t.flatMap(t=>Array.from(e.querySelectorAll(t)).flatMap(e=>{let t=e.textContent;return t&&t.trim()!==``?t.split(`;`).map(e=>e.trim()).filter(e=>e.length>0):[]}));return n.length>0?n:null}var su=(e,t)=>au(e,[t])?.trim(),cu=e=>{let t=e.querySelector(`.content-meta-data__authors`)?.textContent;if(t)return t.split(/,\s+|\s+and\s+/).filter(e=>!!e)},lu=e=>{let t=Array.from(e.querySelectorAll(`.tombstone-metadata [data-qa="item-authors"]`)).map(e=>e.textContent).filter(e=>!!e);return t.length?t:void 0},uu=e=>{let t=Array.from(e.querySelectorAll(`.item-authors [data-qa="item-contributors"], .item-authors [data-qa="item-creators"]`)).map(e=>e.textContent).filter(e=>!!e);return t.length?t:void 0},du=e=>{let t=Array.from(e.querySelectorAll(`.contrib-type-author .name`)).map(e=>e.textContent).filter(e=>!!e);return t.length?t:void 0},fu=e=>{let t=new Set([...uu(e)??[],...cu(e)??[],...du(e)??[],...lu(e)??[]]);return t.size?[...t]:void 0},pu=(e,t)=>e.querySelector(`[data-qa="published-date"]`)?.textContent??e.querySelector(`.summary-image`)?.textContent??_u(t?.get(`date`))??_u(t?.get(`copyright date`))??_u(t?.get(`published date`)),mu=e=>{let t=e.find(e=>e.startsWith(`https://doi.org/`));if(t)return t.replace(`https://doi.org/`,``)},hu=e=>{let t=e.get(`local identifier`);if(t?.length)return mu(t)},gu=e=>e.querySelector(`.doi`)?.getAttribute(`href`)??void 0,_u=e=>{if(e?.length)return e[0]},vu=e=>{let t=new Map;return Array.from(e.querySelectorAll(`.metadata-element, .metadata`)).map(e=>({name:e.querySelector(`.metadata-label`)?.textContent.trim().toLowerCase(),values:Array.from(e.querySelectorAll(`.metadata-value`)).map(e=>e.textContent).filter(e=>!!e)})).forEach(({name:e,values:n})=>{!e||!n.length||t.set(e,n)}),t},yu=e=>{let t=vu(e),n=e.querySelector(`.summary-journal`),r=Array.from(n?.childNodes??[]),i=r[0]?.textContent??e.querySelector(`.journal-link`)?.textContent??void 0,a=r[2]?.textContent?.replace(/Published By:\s+?/i,``)??_u(t.get(`publisher`))??e.querySelector(`.publisher-link`)?.textContent??void 0;return{pub:a&&a.trim()!==``?a:void 0,jtitle:i&&i.trim()!==``?i:void 0}},bu=e=>{let t=au(e,[`[data-qa="journal"]:first-child cite`,`[data-qa="copyright-statement"] > cite`,`[data-qa="collection-links"] mfe-content-details-pharos-link`]);return t&&t.trim()!==``?t:void 0},xu=e=>ks(e.querySelector(`[data-qa="page-count"]`)?.textContent),Su=(e,t)=>e.querySelector(`.publisher-link`)?.textContent??_u(t?.get(`publisher`)),Cu=e=>e.querySelector(`[data-qa="item-title"]`)?.textContent.trim()??e.querySelector(`mfe-turnaway-pharos-heading`)?.textContent.trim()??e.querySelector(`.metadata mfe-toc-pharos-heading`)?.textContent.trim()??e.querySelector(`.journal_header-title`)?.textContent.trim()??void 0,wu=e=>{if(!URL.canParse(e))return;let t=new URL(e);return t.origin+t.pathname},Tu=e=>{let t=e.querySelector(`.ccda-container > :first-child`),n,r;if(t?.textContent.includes(`Volume`)||t?.textContent.includes(`Issue`)){let e=t.textContent.trim().split(/,\s+/);for(let t of e)t.startsWith(`Volume`)?r=ks(t):t.startsWith(`Issue`)&&(n=ks(t))}return{issue:n,volume:r}},Eu=e=>{let t=e.querySelector(`[data-qa="item-src-info"]`)?.textContent??V(e,`property`,`og:description`)??V(e,`name`,`description`);if(!t)return{};let n=/Vol\.\s*(\d+)/.exec(t),r=n?n[1]:void 0,i=/No\.\s*(\d+)/.exec(t),a=i?i[1]:void 0,o=/pp\.\s*(\d+)-(\d+)/.exec(t),s=o?o[1]:void 0,c=o?o[2]:void 0,l=/pp\.\s*\d+-\d+\s*\((\d+)\s*pages\)/.exec(t);return{issue:a,volume:r,spage:s,epage:c,pages:l?l[1]:void 0}},Du=e=>{let t=au(e,[`mfe-turnaway-pharos-link`,`[data-qa="item-src-info"]`]);if(!t)return;let n=/\(.+\)/.exec(t)?.map(e=>{let t=/\d{4}/.exec(e);return t?t[0]:void 0});return iu(n)},Ou=(e,t)=>{let n=Cu(e),r=fu(e),i=pu(e)??Du(e),a=yu(e),o=a.jtitle??bu(e)??void 0,s=a.pub,c=Tu(e),l=Eu(e),u=c.issue??l.issue,d=c.volume??l.volume,f=xu(e)??l.pages,p=l.spage,m=l.epage,h=wu(t),g=mu(Array.from(e.querySelector(`.content-meta-data-stables`)?.childNodes??[]).map(e=>e.textContent??``))??gu(e);return L(F.Article,{atitle:n,au:r,date:i,doi:g,epage:m,issue:u,jtitle:o,pages:f,pub:s,spage:p,uri:h,volume:d})},ku=(e,t)=>{let n=vu(e),r=fu(e),i=pu(e,n),a=Cu(e);return R({au:r,date:i,pub:Su(e,n),title:a,uri:wu(t)})},Au=(e,t)=>{let n=vu(e),r=fu(e),i=Cu(e),a=pu(e),o=xu(e),s=Su(e,n),c=wu(t),l=hu(n);return I(F.Book,{au:r,date:a,doi:l,pages:o,pub:s,title:i,uri:c})},ju=(e,t)=>{let n=vu(e),r=fu(e),i=Cu(e),a=e.querySelector(`.book-title-link`)?.textContent??void 0,o=pu(e,n),s=Array.from(e.querySelectorAll(`[data-qa="book"] > span`)).map(e=>e.textContent),c=xu(e),l=s.find(e=>e.includes(`pp.`))?.match(/(\d+)-(\d+)/)??void 0,u=Su(e,n),d=wu(t);return I(F.Bookitem,{atitle:i,au:r,btitle:a,date:o,epage:l?.[2],pub:u,pages:c,spage:l?.[1],uri:d})},Mu=(e,t)=>{let n=vu(e),r=fu(e),i=Cu(e),a=pu(e),o=xu(e),s=Su(e,n),c=wu(t),l=hu(n);return I(F.Document,{au:r,date:a,doi:l,pages:o,pub:s,title:i,uri:c})},Nu=(e,t)=>{let n=vu(e);return go({au:fu(e),date:pu(e,n),title:Cu(e),uri:wu(t)})},Pu=(e,t)=>{let{pub:n}=yu(e),r=Cu(e),i=e.querySelector(`.eissn`)?.textContent.replace(/EISSN\s+/,``).trim()??void 0,a=e.querySelector(`.issn`)?.textContent.replace(/ISSN\s+/,``).trim()??void 0,o=wu(t);return L(F.Journal,{eissn:i,issn:a,jtitle:r,pub:n,uri:o})},K=function(e){return e.Article=`journal article`,e.Audio=`audio`,e.Book=`book`,e.Chapter=`book chapter`,e.Document=`document`,e.Image=`image`,e.Journal=`journal`,e.ResearchReport=`research report`,e.Serial=`serial`,e.Video=`video`,e}({}),Fu=(e,t)=>{let n=vu(e),r=fu(e),i=pu(e,n),a=Cu(e);return R({au:r,date:i,pub:Su(e,n),title:a,uri:wu(t)})},Iu=e=>Object.values(K).includes(e),Lu=e=>{if(e.querySelector(`.journal_header-title`))return K.Journal;if(e.querySelector(`.journal-link`))return K.Article;let t=e.querySelector(`.content-type > span`)?.textContent.toLowerCase().trim()??e.querySelector(`.content-meta-data-label`)?.textContent.toLowerCase().trim();return Iu(t)?t:null},Ru=(e,t)=>{switch(Lu(e)){case K.Article:case K.Serial:return Ou(e,t);case K.Audio:return ku(e,t);case K.Book:return Au(e,t);case K.Chapter:case K.ResearchReport:return ju(e,t);case K.Document:return Mu(e,t);case K.Image:return Nu(e,t);case K.Journal:return Pu(e,t);case K.Video:return Fu(e,t);default:return null}},zu=({document:e,url:t})=>{let n=Ru(e,t);return n?B(n):z()},Bu=/([0-9]{4}-[0-9]{1,2}-[0-9]{1,2}|[0-9]{4}-[0-9]{1,2}|[0-9]{4})/,Vu=/(E?ISBN|E?ISSN|DOI)\s*:\s*/gi,Hu=e=>{if(!e)return;let t=Bu.exec(e);if(t)return t.length>1?t[1]:void 0},Uu=e=>{let t={};return e.forEach(e=>{let n=[],r;for(Vu.lastIndex=0;(r=Vu.exec(e))!==null;)n.push({id:r[1].toLowerCase(),index:r.index,start:Vu.lastIndex});n.forEach(({id:r,start:i},a)=>{t[r]??=[],t[r].push(e.substring(i,n[a+1]?.index).trim())})}),t},Wu=e=>[...e.isbn??[],...e.eisbn??[]].map(e=>zs(e)).filter(e=>!!e),Gu=e=>{if(e){if(typeof e==`string`)return e;if(e.length>0)return e[0]}},Ku=e=>{if(e)return typeof e==`string`?e:Array.isArray(e)?e.length===0?void 0:Gu(e[0].name):Gu(e.name)},qu=(...e)=>{let t=new Set(e.filter(e=>!!e));if(t.size!==0)return[...t]},Ju=e=>{let t=Uu(e.identifierValues),[n]=e.isPartOf?.split(`,`)??[],r=Hu(e.publicationDate??e.creationDate),i=Wu(t);return{authors:e.authors,date:r,dois:t.doi,edition:e.edition,eissns:t.eissn,isbns:i,issns:t.issn,jtitle:n,lcn:e.lcn,publisher:e.publisher,title:e.title}},Yu=({lcn:e,title:t})=>({bibid:e,title:t}),Xu=e=>{let t=e.mainEntity.creator;if(t)return typeof t==`string`?[t]:Array.isArray(t)?t.map(e=>Gu(e.name)).filter(e=>!!e):[Gu(t.name)].filter(e=>!!e)},Zu=e=>{let t=e.mainEntity.issn;return t?typeof t==`string`?[t]:t:[]},Qu=e=>{let t=e.mainEntity.datePublished;if(t)return t.replace(/-$/,``)||void 0},$u=e=>e.replace(/[.,;]+$/,``).trim(),ed=(e,t)=>{let n=$u(e),r=$u(t);return n.startsWith(r)||r.startsWith(n)},td=e=>{let t=[];for(let n of e)n&&(t.some(e=>ed(e,n))||t.push(n));return t.length>0?t:void 0},nd=(e,t)=>{let n=td([...(e&&Xu(e))??[],...t.authors??[]]),r=qu(...t.eissns??[]),i=qu(e?.mainEntity.isbn?zs(e.mainEntity.isbn):void 0,...t.isbns??[]),a=qu(...e?Zu(e):[],...t.issns??[]),[o,s]=e?.mainEntity.pagination?.split(`-`)??[];return{authors:n,btitle:e?.mainEntity.isPartOf?.name??t.jtitle,date:t.date??(e?Qu(e):void 0),doi:Gu(t.dois),edition:e?.mainEntity.edition??t.edition,eissn:Gu(r),epage:s,isbn:i?.join(`,`),issn:Gu(a),issue:e?.mainEntity.issueNumber,jtitle:t.jtitle,lcn:t.lcn??e?.identifier.value,publisher:t.publisher??Ku(e?.mainEntity.publisher),spage:o,title:e?.name??t.title,volume:e?.mainEntity.volumeNumber}},rd=j({"@type":N(`Organization`),name:M([O(),A(O())])}),id=j({"@type":N(`Person`),name:M([O(),A(O())])}),ad=j({"@type":M([O(),A(O())]),"@id":O().optional(),issn:O().optional(),name:O().optional(),volume:O().optional()}),od=Ys.extend({identifier:j({"@type":O(),propertyID:O(),value:O()}),mainEntity:j({"@type":O(),"@id":O(),bookFormat:P(O()),creator:P(M([O(),id,A(id)])),datePublished:P(O()),description:P(M([O(),A(O())])),edition:P(O()),inLanguage:P(O()),isbn:P(O()),issn:P(M([O(),A(O())])),isPartOf:P(ad),issueNumber:P(O()),pagination:P(O()),publisher:P(M([O(),rd,A(rd)])),volumeNumber:P(O())}),name:O()}),sd=e=>{let t=$s(e);if(!t)return null;let n=ec(t),r=od.safeParse(n);return r.success?r.data:null},cd=e=>L(F.Article,{...Yu(e),au:e.authors,doi:e.doi,eissn:e.eissn,epage:e.epage,issn:e.issn,issue:e.issue,jtitle:e.jtitle,pub:e.publisher,spage:e.spage,volume:e.volume}),ld=e=>I(F.Book,{...Yu(e),au:e.authors,date:e.date,doi:e.doi,edition:e.edition,epage:e.epage,isbn:e.isbn,pub:e.publisher,spage:e.spage}),ud=e=>I(F.Bookitem,{bibid:e.lcn,atitle:e.title,btitle:e.btitle,au:e.authors,date:e.date,doi:e.doi,epage:e.epage,isbn:e.isbn,pub:e.publisher,spage:e.spage}),dd=e=>I(F.Conference,{...Yu(e),au:e.authors,date:e.date,doi:e.doi,isbn:e.isbn,pub:e.publisher}),fd=e=>_o({...Yu(e),au:e.authors,date:e.date,pub:e.publisher}),pd=e=>L(F.Journal,{...Yu(e),date:e.date,doi:e.doi,eissn:e.eissn,issn:e.issn,pub:e.publisher}),md=e=>R({...Yu(e),au:e.authors,date:e.date,pub:e.publisher}),hd=e=>R({...Yu(e),au:e.authors,date:e.date,pub:e.publisher}),q=function(e){return e.Article=`Article`,e.Audio=`Audio`,e.Book=`Book`,e.BookChapter=`BookChapter`,e.Conference=`Conference`,e.Dissertation=`Dissertation`,e.Journal=`Journal`,e.Video=`Video`,e}({}),gd=(e,t)=>({document:n})=>{let r=sd(n),i=nd(r,e(n));switch(t(n,r)){case q.Article:return B(cd(i));case q.Book:return B(ld(i));case q.BookChapter:return B(ud(i));case q.Conference:return B(dd(i));case q.Dissertation:return B(fd(i));case q.Journal:return B(pd(i));case q.Audio:return B(hd(i));case q.Video:return B(md(i));default:return z()}},_d=e=>`*:has([title*="${e}" i]) + .item-details-element-container prm-highlight`,vd=e=>Array.from(e.querySelectorAll(_d(`Identifier`))).map(e=>e.textContent).filter(e=>!!e),yd=e=>Array.from(e.querySelectorAll(_d(`Author`))).filter(e=>!!e.textContent&&e.parentElement!==null&&e.parentElement.getAttribute(`aria-hidden`)!==`true`).map(e=>e.textContent.trim()),bd=(e,t)=>e.querySelector(_d(t))?.textContent.trim(),xd=e=>Ju({authors:yd(e),title:bd(e,`Title`),publisher:bd(e,`Publisher`),creationDate:bd(e,`Creation Date`),publicationDate:bd(e,`Publication Date`),edition:bd(e,`Edition`),isPartOf:bd(e,`Is Part Of`),identifierValues:vd(e),lcn:bd(e,`MMS ID`)??bd(e,`Record ID`)}),Sd={Article:q.Article,Book:q.Book,"Book Chapter":q.BookChapter,Chapter:q.BookChapter,Periodical:q.Journal,Journal:q.Journal,"Audio CD":q.Audio,CreativeWork:q.Audio,Movie:q.Video,Video:q.Video},Cd=gd(xd,(e,t)=>{let n=t?.mainEntity[`@type`]??e.querySelector(`.media-content-type`)?.textContent??void 0;return n?Sd[n]:void 0}),wd=e=>{let t=e.querySelectorAll(`[id="Info"] > p`),n=Array.from(t).find(e=>e.textContent.includes(`Document Type`))?.textContent,r=V(e,`name`,`DC.identifier`);if(r?.startsWith(`info:doi/`)||n?.includes(`Article`))return U.Article;if(r?.startsWith(`urn:issn:`))return U.Journal},Td=e=>{let[t,n,r,i]=V(e,`name`,`DCTERMS.bibliographicCitation`)?.split(`,`)??[];return{journalTitle:t,volume:n,issue:r,pages:i}},Ed=e=>{let t=V(e,`name`,`DC.identifier`);return(t?t.split(`info:doi/`):null)?.[1]??void 0},Dd=e=>e.evaluate(`//*[@id="altLayoutPublisherLogo"]/p/a[1]`,e,null,XPathResult.STRING_TYPE,null).stringValue,Od=e=>{let[t,n]=e?e.trim().split(`-`):[void 0,void 0];return{spage:t,epage:n?.replace(/\(\d+\)/,``).trim()}},kd=e=>{let t=V(e,`name`,`DCTERMS.issued`);if(!t)return;let n=/\d{4}/.exec(t);return n?n[0]:void 0},Ad=e=>{let t=V(e,`name`,`DC.title`),n=V(e,`name`,`DC.publisher`),r=kd(e),i=Td(e),a=i.journalTitle?.trim(),o=i.volume?.trim(),s=i.issue?.trim(),c=i.pages?Od(i.pages):void 0,l=c?.spage,u=c?.epage,d=H(e,`name`,`DC.creator`),f=Ed(e);return L(F.Article,{au:d,jtitle:a,date:r,doi:f,issue:s,pub:n,spage:l,epage:u,atitle:t,volume:o})},jd=e=>{let t=V(e,`name`,`DC.title`),n=V(e,`name`,`DC.publisher`),r=Dd(e);return L(F.Journal,{issn:r,title:t,pub:n})},Md=({document:e})=>{switch(wd(e)){case U.Article:return B(Ad(e));case U.Journal:return B(jd(e));default:return z()}},Nd=/^\d{4}-\d{3}[\dX]$/i,Pd=e=>Nd.test(e),Fd=e=>{let t=e.filter(Pd);return t.length?t:void 0},Id=e=>{let t=H(e,`name`,`citation_author`);return t.length?t:void 0},Ld=e=>V(e,`name`,`citation_publication_date`)?.match(/^\d{4}/)?.[0],Rd=e=>V(e,`name`,`citation_doi`),zd=e=>{let t=H(e,`name`,`citation_isbn`);return t.length?t.join(`,`):void 0},Bd=e=>Fd(H(e,`name`,`citation_issn`)),Vd=e=>V(e,`name`,`citation_journal_title`),Hd=e=>V(e,`name`,`citation_publisher`),Ud=e=>V(e,`name`,`citation_title`),Wd=e=>V(e,`name`,`citation_doi`),Gd=e=>V(e,`name`,`citation_firstpage`),Kd=e=>V(e,`name`,`citation_lastpage`),qd=e=>V(e,`name`,`citation_issue`),Jd=e=>V(e,`name`,`citation_volume`),Yd=e=>L(F.Article,{atitle:Ud(e),au:Id(e),date:Ld(e),doi:Rd(e),issn:Bd(e)?.[0],issue:qd(e),jtitle:Vd(e),pub:Hd(e),volume:Jd(e),spage:Gd(e),epage:Kd(e)}),Xd=e=>I(F.Bookitem,{atitle:Ud(e),au:Id(e),btitle:Vd(e),date:Ld(e),isbn:zd(e),pub:Hd(e),spage:Gd(e),epage:Kd(e)}),Zd=e=>_o({title:Ud(e),au:Id(e),date:Ld(e),pub:Hd(e),spage:Gd(e),epage:Kd(e)}),Qd=e=>!!e.isbn,$d=e=>!!e.issn||e.type===`Article`&&!!e.journalTitle||!Qd(e)&&!!e.journalTitle,ef=e=>!!e.title,tf=e=>{let t={type:Wd(e),isbn:zd(e),issn:Bd(e),journalTitle:Vd(e),title:Ud(e)};return Qd(t)?Xd(e):$d(t)?Yd(e):ef(t)?Zd(e):null},nf=({url:e,document:t})=>{let n=tf(t);return n?B({...n,uri:e}):z()},rf=j({"@content":O(),datePublished:O().optional(),mainEntity:j({type:O().optional(),name:O().optional(),author:A(j({name:O()})).optional(),publisher:j({type:O(),name:O()}).optional(),isbn:O().optional()})}),af=e=>rf.safeParse(e).success,of=e=>{let t=e.textContent;if(!t)return null;try{let e=JSON.parse(t);if(af(e))return e}catch{return null}return null},sf=({document:e})=>{let t=$s(e);if(!t)return z();let n=of(t);if(!n)return z();let r=n.mainEntity.type,i=n.mainEntity.author?.map(e=>e.name),a=n.datePublished?.substring(0,4),o=n.mainEntity.name,s=n.mainEntity.isbn,c=n.mainEntity.publisher?.name;switch(r){case`Book`:return B(I(F.Book,{au:i,date:a,title:o,isbn:s,pub:c}));default:return z()}},cf=Ys.extend({"@type":O().optional(),name:O().optional(),copyrightYear:ga().optional(),author:A(j({name:O()})).optional(),publisher:A(j({name:O()})).optional()}),lf=e=>cf.safeParse(e).success,uf=({document:e,url:t})=>{let n=$s(e);if(!n)return z();let r=ec(n);if(!r||!lf(r))return z();let i=r[`@type`],a=r.author?.map(e=>e.name),o=r.copyrightYear?.toString()??V(e,`property`,`og:book:release_date`),s=r.name,c=iu(r.publisher?.map(e=>e.name)),l=V(e,`property`,`og:book:isbn`);switch(i){case`Book`:return B(I(F.Book,{au:a,date:o,title:s,isbn:l,pub:c,uri:t}));default:return z()}},df=e=>{let t=Array.from(e.querySelectorAll(`a[rel=author]`)).map(e=>e.textContent.trim()).filter(Boolean);return t.length?t:void 0},ff=e=>{let t=Array.from(e.querySelectorAll(`strong`)).filter(e=>e.textContent.startsWith(`ISBN`)).map(e=>e.nextElementSibling?.textContent.trim());if(t.length!==0)return t[0]?.replace(/\s+/,`,`)},pf=({url:e,document:t})=>{let n=t.querySelector(`h3.page-title`)?.textContent.trim()??void 0,r=df(t),i=V(t,`property`,`article:published_time`),a=ff(t);return B(I(F.Book,{au:r,date:i?.substring(0,4),isbn:a,pub:`Milne Open Textbooks`,title:n,uri:e}))},mf=({document:e,url:t})=>{switch(gf(t)){case U.Chapter:return B(xf(e));case U.Book:return B(Sf(e));case U.Article:return B(_f(e));case U.Journal:return B(vf(e));default:return z()}},hf=function(e){return e.Print=`Print`,e.Online=`Online`,e}(hf||{}),gf=e=>{let{pathname:t}=new URL(e);return t.includes(`/books/abs/`)?U.Chapter:t.includes(`/books/`)?U.Book:/\/journals\/.+\/article\//.exec(t)==null?t.includes(`/journals/`)?U.Journal:U.None:U.Article},_f=e=>{let t=V(e,`name`,`citation_title`),n=V(e,`name`,`citation_journal_title`),r=V(e,`name`,`citation_doi`),i=V(e,`name`,`citation_volume`),a=V(e,`name`,`citation_issue`),o=V(e,`name`,`citation_firstpage`),s=V(e,`name`,`citation_lastpage`),c=V(e,`name`,`citation_publication_date`)?.substring(0,4),l=V(e,`name`,`citation_publisher`),u=Cf(e),d=Fd(H(e,`name`,`citation_issn`));return L(F.Article,{atitle:t,au:u,jtitle:n,doi:r,volume:i,issue:a,issn:d?.[0],spage:o,epage:s,date:c,pub:l})},vf=e=>{let t=yf(e),n=bf(e),r=n.find(e=>e.type===hf.Print),i=n.find(e=>e.type===hf.Online),a=r?r.value:void 0,o=i?i.value:void 0;return L(F.Journal,{title:t,issn:a,eissn:o})},yf=e=>e.querySelector(`h1.title`)?.textContent.trim()??void 0,bf=e=>{let t=Array.from(e.querySelectorAll(`span.bold`)).find(e=>e.textContent.trim()===`ISSN:`),n=/^([0-9]{4}-[0-9]{3}[0-9X]) \((Print|Online)\)/,r=[];return t&&(t.parentElement?.querySelectorAll(`span.value`))?.forEach(e=>{let t=e.textContent.trim(),i=n.exec(t);i&&r.push({value:i[1],type:i[2]})}),r},xf=e=>{let t=V(e,`name`,`citation_title`),n=V(e,`name`,`citation_inbook_title`),r=V(e,`name`,`citation_doi`),i=V(e,`name`,`citation_publication_date`)?.substring(0,4),a=V(e,`name`,`citation_publisher`);return I(F.Bookitem,{atitle:t,btitle:n,doi:r,date:i,pub:a})},Sf=e=>{let t=V(e,`name`,`citation_title`),n=V(e,`name`,`citation_doi`),r=V(e,`name`,`citation_isbn`),i=V(e,`name`,`citation_publication_date`)?.substring(0,4),a=V(e,`name`,`citation_publisher`),o=Cf(e);return I(F.Book,{title:t,au:o,doi:n,isbn:r,date:i,pub:a})},Cf=e=>{let t=H(e,`name`,`citation_author`);return t.length?t:void 0},wf=function(e){return e.Journal=`Journal`,e.Article=`Article`,e}(wf||{}),Tf=e=>{switch(V(e,`property`,`og:type`)){case`Article`:return wf.Article;case`Journal`:return wf.Journal;default:return}};function Ef(e){let t=V(e,`property`,`og:title`),n=V(e,`name`,`dc.Publisher`),r=V(e,`name`,`publication_doi`);return B(L(F.Journal,{jtitle:t,pub:n,doi:r}))}function Df(e){let t=V(e,`name`,`dc.Title`),n=H(e,`name`,`dc.Creator`),r=V(e,`name`,`dc.Date`)?.substring(0,4),i=V(e,`name`,`publication_doi`),a=V(e,`name`,`citation_journal_title`),o=V(e,`name`,`dc.Publisher`);return B(L(F.Article,{atitle:t,au:n,date:r,doi:i,jtitle:a,pub:o}))}var Of=({document:e})=>{switch(Tf(e)){case wf.Journal:return Ef(e);case wf.Article:return Df(e);default:return z()}},kf=e=>{if(!e)return;let[t,n]=e.trim().split(`-`);return{spage:t,epage:n}},Af=e=>{let{pathname:t}=new URL(e);if(t.includes(`/article/`))return U.Article},jf=e=>{let t=V(e,`name`,`DC.Source`),n=V(e,`name`,`DC.Title`),r=H(e,`name`,`DC.Creator.PersonalName`),i=V(e,`name`,`DC.Source.ISSN`),a=V(e,`name`,`citation_date`)?.substring(0,4),o=V(e,`name`,`DC.Source.Volume`),s=V(e,`name`,`DC.Source.Issue`),c=V(e,`name`,`DC.Identifier.URI`),l=V(e,`name`,`DC.Identifier.pageNumber`),u=l?kf(l):void 0,d=u?.spage,f=u?.epage;return L(F.Article,{jtitle:t,atitle:n,au:r,issn:i,date:a,spage:d,epage:f,volume:o,issue:s,uri:c})},Mf=({document:e,url:t})=>{switch(Af(t)){case U.Article:return B(jf(e));default:return z()}},Nf=function(e){return e.Book=`Book`,e.Chapter=`Chapter`,e}(Nf||{}),Pf=e=>{switch(Ff(e)){case`eBook`:return Nf.Book;case`Reference`:return Nf.Chapter;default:return}},Ff=e=>e.querySelector(`#vol-contentType a`)?.textContent??void 0;function If(e,t){let n=Rf(e),r=Vf(e),i=Uf(e),a=Wf(e),o=Gf(e),s=Kf(e),c=Vf(e),l=t,{startPage:u,endPage:d}=qf(e)??{};return B(I(F.Book,{au:n,btitle:r,date:i,doi:a,epage:d,isbn:o,pub:s,spage:u,title:c,uri:l}))}function Lf(e,t){let n=Rf(e),r=Hf(e),i=Vf(e),a=Uf(e),o=Wf(e),s=Gf(e),c=Kf(e),l=Hf(e),u=t,{startPage:d,endPage:f}=qf(e)??{};return B(I(F.Book,{au:n,atitle:r,btitle:i,date:a,doi:o,epage:f,isbn:s,pub:c,spage:d,title:l,uri:u}))}var Rf=e=>{let t=e.querySelectorAll(`div#article_author p.author-bio b`),n=Array.from(t).map(e=>e.textContent).filter(e=>!!e).map(e=>e.trim());return n.length>0?n:void 0},zf=(e,t)=>e.querySelector(`input#${t}`)?.getAttribute(`value`)??void 0,Bf=e=>V(e,`property`,`og:title`),Vf=e=>zf(e,`titlevalue`)??Bf(e),Hf=e=>zf(e,`chapter-title-squid`),Uf=e=>zf(e,`pubdate-squid`),Wf=e=>zf(e,`doi-squid`),Gf=e=>zf(e,`isbn-squid`),Kf=e=>zf(e,`pubname-squid`),qf=e=>{let t=e.querySelector(`#pageRange`)?.textContent??void 0;if(!t)return;let n=/(\d+)–(\d+)/.exec(t);if(n)return{startPage:n[1],endPage:n[2]}},Jf=({document:e,url:t})=>{switch(Pf(e)){case Nf.Book:return If(e,t);case Nf.Chapter:return Lf(e,t);default:return z()}},Yf=(e,t)=>e.evaluate(`//*[@class="singleRecord_view_label"][contains(text(), "${t}")]/following-sibling::*[@class="singleRecord_view_data"]`,e,null,XPathResult.STRING_TYPE).stringValue.toLowerCase().trim(),Xf=e=>{switch(Yf(e,`Medium`)){case`book`:case`e-book`:return F.Book;case`e-journal`:return F.Journal;default:return F.Unknown}},Zf=e=>{delete e.rft_id},Qf=e=>{let t=rs(e);if(Yc(t)){let n=Xf(e.document);t.resource.genre=n,Zf(t.resource)}return t},$f=e=>{let t=V(e,`name`,`type`)?.toLowerCase(),n=V(e,`name`,`og:type`)?.toLowerCase(),r=V(e,`name`,`citation_article_type`)?.toLowerCase();if(t===`article`||r===`article`||n===`article`)return U.Article;let i=V(e,`name`,`twitter:title`)?.trim(),a=V(e,`name`,`description`)?.trim();if(i||a)return U.Webpage},ep=e=>{let t=V(e,`name`,`DC.Title`),n=V(e,`name`,`DC.Publisher`),r=V(e,`name`,`DC.Date`),i=V(e,`name`,`DC.Identifier`),a=V(e,`name`,`citation_journal_title`),o=V(e,`name`,`citation_volume`),s=V(e,`name`,`citation_issn`),c=H(e,`name`,`citation_author`);return L(F.Article,{au:c,jtitle:a,date:r,doi:i,issn:s,pub:n,title:t,volume:o})},tp=(e,t)=>vo({uri:e,title:V(t,`name`,`twitter:title`)}),np=({url:e,document:t})=>{switch($f(t)){case U.Article:return B(ep(t));case U.Webpage:return B(tp(e,t))}return z()},rp=({document:e})=>Array.from(e.querySelectorAll(`.availability.documentSummaryAvailability.availabilityContent`)).length===0?z():ts(),ip=/([0-9]{4})\s+at/;function ap(e){if(!e)return;let t=ip.exec(e);if(t&&t.length>1)return t[1]}function op(e,t){let n=e.getElementsByClassName(t);if(n.length!==0)return n[0].textContent}function sp(e){return Array.from(e.getElementsByTagName(`li`)).reduce((e,t)=>{let n=op(t,`title`),r=op(t,`content`);return n&&r&&(e[n]=r),e},{})}function cp(e){let t=e.getElementsByClassName(`information`);if(t.length===0)return{};let n=sp(t[0]);return{date:ap(n.Published),series:n.Show}}var lp=({url:e,document:t})=>{if(!new URL(e).searchParams.has(`i`))return z();let n=F.AudioDocument;return B({genre:n,pub:V(t,`property`,`og:site_name`),title:V(t,`property`,`og:title`),uri:e,...cp(t)})},up=e=>{let t=V(e,`name`,`citation_date`);if(t)return t.split(`/`).find(e=>/^\d{4}/.test(e))??void 0},dp=e=>{let t=e.querySelector(`#arxiv-doi-link`)?.textContent;if(t)return t.replace(`https://doi.org/`,``).trim()},fp=({document:e})=>{let t=V(e,`name`,`citation_title`),n=V(e,`name`,`citation_pdf_url`),r=H(e,`name`,`citation_author`),i=up(e),a=dp(e);return!t&&r.length===0&&!i&&!a?z():B(L(F.Article,{au:r,date:i,doi:a,title:t,uri:n}))},pp=e=>{let t=su(e,`div.director-section div.term-info-section-items`);if(!t)return;let n=t.split(`,`).map(e=>e.replace(/\s+/g,` `).trim()).filter(e=>e.length>0);return n.length>0?n:void 0},mp=e=>{let t=new Map;return Array.from(e.querySelectorAll(`.info-section-container`)).forEach(e=>{let n=e.querySelector(`.info-section-header .info-section-title`)?.textContent.trim().toLowerCase();if(!n)return;let r=Array.from(e.querySelectorAll(`.term-info-section-item`)).map(e=>e.textContent.replace(`,`,``).trim()).filter(e=>!!e);r.length&&t.set(n,r)}),t},hp=({url:e,document:t})=>{let n=mp(t);return B(R({au:pp(t)??n.get(`director`),date:su(t,`div.product-release-year`),pub:su(t,`div.studio-section div.term-info-section-item`)??_u(n.get(`supplier`)),title:su(t,`.product-title`)??su(t,`.movie-title`),uri:e}))},gp=e=>{if(V(e,`property`,`og:type`)===`article`)return U.Article};function _p(e){let t={},n=e.querySelector(`[data-id=layout-form]`);return n&&Array.from(n.getElementsByTagName(`h2`)).forEach(e=>{let n=e.textContent.toLowerCase(),r=Array.from(e.parentElement?.getElementsByTagName(`span`)??[]).map(e=>e.textContent||``);n&&(t[n]=r[0])}),t}function vp(e,t,n){return n.includes(`publisher`)?t.publisher:n.includes(`place of publication, exhibition, or creation`)?t[`place of publication, exhibition, or creation`]:V(e,`name`,`DC.publisher`)}function yp(e){let t=V(e,`name`,`citation_publication_date`);return t?t.substring(0,4):V(e,`name`,`citation_online_date`)?.substring(0,4)}var bp=e=>{let t=_p(e),n=V(e,`name`,`DataCite.title`),r=H(e,`name`,`DataCite.contributor`),i=yp(e),a=V(e,`name`,`DC.identifier.DOI`),o=Object.keys(t),s=vp(e,t,o),c=o.includes(`journal`)?t.journal:void 0,l=o.includes(`volume`)?t.volume:void 0,u=o.includes(`issue`)?t.issue:void 0,d=o.includes(`issn`)?t.issn:void 0,f=o.includes(`electronic location (url)`)?t[`electronic location (url)`]:void 0;return L(F.Article,{jtitle:c,atitle:n,pub:s,au:r,date:i,doi:a,volume:l,issue:u,issn:d,uri:f})},xp=({document:e})=>{switch(gp(e)){case U.Article:return B(bp(e));default:return z()}},J=function(e){return e.ISSN=`issn (print)`,e.EISSN=`issn (electronic)`,e.ISBN=`isbn (print)`,e.VOLUME=`volume`,e.ISSUE=`issue`,e.PUBLISHER=`publisher`,e.DATE_OF_PUBLICATION=`date of publication`,e.RESOURCE_TYPE=`resource type`,e.JOURNAL_TITLE=`journal`,e.BOOK_TITLE=`book title`,e.PAGE_RANGE=`page range`,e}(J||{}),Sp=e=>{let t=Y(e,J.RESOURCE_TYPE);return t?t===`Other Journal Article`||t===`Journal Article`||t===`Journal Item`||t===`Book Review`?U.Article:t===`Book Chapter`||t===`Book Part`||t===`Conference Abstract`||t===`Book ChapterConference Paper`||t===`Conference Paper`||t===`Other Book Part`?U.Document:U.None:U.None},Cp=e=>e.replace(`:`,``).replace(` | `,``).trim().toLowerCase(),wp=e=>{let t=new Map,n=e.querySelector(`ul.rlist.publication-details__list`);return n&&Array.from(n.querySelectorAll(`li`)).forEach(e=>{let n=Array.from(e.querySelectorAll(`span.label`)),r=Array.from(e.querySelectorAll(`span.info`));n.forEach((e,n)=>{let i=Cp(e.textContent),a=r[n]?.textContent?.trim();i&&a&&(t.has(i)||t.set(i,[]),t.get(i)?.push(a))})}),t},Y=(e,t)=>{let n=e.get(t);if(n)return iu(n)},Tp=e=>H(e,`name`,`dc.Creator`).map(e=>e.trim()),Ep=e=>{let t=ou(e,[`.loa-accordion a.author-name`]);if(t)return t.map(e=>e.replace(`Authors:`,``).trim())},Dp=e=>{let t=Tp(e);return t.length>0?t:Ep(e)},Op=e=>V(e,`name`,`dc.Title`)??V(e,`property`,`og:title`),kp=e=>V(e,`name`,`publication_doi`),Ap=(e,t)=>Y(t,J.DATE_OF_PUBLICATION)??V(e,`name`,`dc.Date`),jp=e=>{let t=Y(e,J.PAGE_RANGE),n,r;return t?.includes(`-`)&&(n=t?t.split(`-`)[0].trim():void 0,r=t?t.split(`-`)[1].trim():void 0),{pages:t,spage:n,epage:r}},Mp=(e,t,n)=>{let r=Op(e),i=Y(t,J.JOURNAL_TITLE),a=V(e,`name`,`citation_journal_title`),o=i??a,s=kp(e),c=Ap(e,t),l=Y(t,J.PUBLISHER),u=Dp(e),d=Y(t,J.VOLUME),f=Y(t,J.ISSUE),p=jp(t),m=Y(t,J.ISSN),h=Y(t,J.EISSN);return L(F.Article,{title:r,jtitle:o,doi:s,date:c,pub:l,au:u,volume:d,issue:f,pages:p.pages,spage:p.spage,epage:p.epage,issn:m,eissn:h,uri:n})},Np=(e,t,n)=>{let r=Op(e),i=Y(t,J.BOOK_TITLE),a=kp(e),o=Ap(e,t),s=Y(t,J.PUBLISHER),c=Dp(e),l=jp(t),u=Y(t,J.ISBN);return I(F.Conference,{title:r,btitle:i,doi:a,date:o,pub:s,au:c,pages:l.pages,spage:l.spage,epage:l.epage,isbn:u,uri:n})},Pp=(e,t,n)=>{let r=Op(e),i=kp(e),a=Ap(e,t),o=Y(t,J.PUBLISHER),s=Dp(e),c=Y(t,J.ISBN);return I(F.Document,{title:r,doi:i,date:a,pub:o,au:s,uri:n,isbn:c})},Fp=({url:e,document:t})=>{let n=wp(t);switch(Sp(n)){case U.Article:return B(Mp(t,n,e));case U.Document:return B(Np(t,n,e));case U.None:return B(Pp(t,n,e));default:return z()}},Ip=e=>V(e,`property`,`og:title`)?.trim()??void 0,Lp=e=>V(e,`name`,`dc.identifier`)??V(e,`name`,`citation_doi`),Rp=e=>{let t=Ip(e),n=t,r=Wp(e),i=Up(e),a=Vp(e),o=Hp(e),{issn:s,eissn:c}=Bp(e);return B(L(F.Journal,{date:r,eissn:c,issn:s,issue:i,jtitle:n,pub:a,title:t,volume:o}))},zp=e=>e.includes(`/journals/`)&&e.includes(`issue`),Bp=e=>({issn:e.querySelector(`dd.printissn.text-metadata-value > span`)?.textContent.trim(),eissn:e.querySelector(`dd.onlineissn.text-metadata-value > span`)?.textContent.trim()}),Vp=e=>e.querySelector(`dd.publisher.text-metadata-value span`)?.textContent.trim()??void 0,Hp=e=>Ip(e)?.match(/Volume\s+(\d+)/i)?.[1],Up=e=>Ip(e)?.match(/Issue\s+(\d+)/i)?.[1],Wp=e=>Ip(e)?.match(/\((\d{4})\)/)?.[1],Gp=e=>{let t=Ip(e),n=V(e,`name`,`citation_title`)??t,r=H(e,`property`,`article:author`),i=Kp(e),a=Lp(e),o=V(e,`name`,`citation_lastpage`),s=V(e,`name`,`citation_issn`),c=V(e,`name`,`citation_issue`),l=V(e,`name`,`citation_journal_title`),u=V(e,`name`,`citation_publisher`),d=V(e,`name`,`citation_firstpage`),f=V(e,`name`,`citation_volume`);return B(L(F.Article,{atitle:n,au:r,date:i,doi:a,epage:o,issn:s,issue:c,jtitle:l,pub:u,spage:d,title:t,volume:f}))},Kp=e=>V(e,`property`,`article:published_time`)??V(e,`name`,`citation_publication_date`),qp=e=>{let t=Ip(e),n=V(e,`name`,`citation_title`)??t,r=Jp(e),i=Xp(e),a=Lp(e),o=Zp(e),s=V(e,`name`,`citation_publisher`);return B(I(F.Book,{au:r,btitle:n,date:i,doi:a,isbn:o,pub:s,title:t}))},Jp=e=>{let t=H(e,`property`,`book:author`);if(t.length>0)return t;let n=H(e,`name`,`citation_author`);return n.length>0?n:Yp(e)},Yp=e=>Array.from(e.querySelectorAll(`.contributor-details span[data-testid="author-name"]`)).map(e=>(e.textContent||``).trim()).filter(e=>e.length>0),Xp=e=>V(e,`property`,`book:release_date`)??V(e,`name`,`citation_publication_date`),Zp=e=>V(e,`property`,`book:isbn`)??V(e,`name`,`citation_isbn`),Qp=(e,t)=>{switch(V(e,`property`,`og:type`)){case`article`:return U.Article;case`book`:return U.Book;default:break}return zp(t)?U.Journal:U.None},$p=({document:e,url:t})=>{switch(Qp(e,t)){case U.Article:return Gp(e);case U.Journal:return Rp(e);case U.Book:return qp(e);default:return z()}},em=e=>{let t=e.getAttribute(`title`);return t?Oo(t):null},tm=({url:e,document:t})=>{let n=t.querySelector(`.Z3988`);if(!n)return z();let r=em(n);return r?(r.genre===F.Article&&!r.jtitle&&r.title&&(r.jtitle=r.title),B({...r,uri:e})):z()},nm=e=>`[data-qa="detail_${e}"]`,rm=(e,t)=>{let n=e.querySelector(nm(t));return n?Array.from(n.querySelectorAll(`nde-highlight`)).map(e=>e.textContent.trim()).filter(e=>!!e):[]},im=(e,t)=>{let n=rm(e,t);return n.length>0?n[0]:void 0},am=e=>{let t=e.querySelector(nm(`creator`));if(!t)return[];let n=Array.from(t.querySelectorAll(`nde-highlight`)).map(e=>e.textContent.trim()).filter(e=>!!e).map(e=>e.replace(/,?\s*author\s*$/i,``).trim());return n.length>0?n:[]},om=e=>{let t=rm(e,`identifier`),n=rm(e,`ispartof`),r=t.find(e=>e.startsWith(`LC:`));return Ju({authors:am(e),title:im(e,`title`),publisher:im(e,`publisher`),creationDate:im(e,`creationdate`),isPartOf:n.length>0?n[0]:void 0,identifierValues:t,lcn:r?.replace(`LC:`,``).trim()})},sm={Article:q.Article,Audio:q.Audio,Book:q.Book,"Book Chapter":q.BookChapter,"Conference Paper":q.Conference,Dissertation:q.Dissertation,Journal:q.Journal,"Magazine Article":q.Article,Newspaper:q.Journal,Video:q.Video},cm={CreativeWork:q.Audio,Movie:q.Video,Periodical:q.Journal,Thesis:q.Dissertation},lm={...sm,...cm},um=e=>{if(e)return e.mainEntity[`@type`]},dm=e=>e.querySelector(`.record-type`)?.textContent.trim()??void 0,fm=gd(om,(e,t)=>{let n=dm(e)??um(t);return n?lm[n]:void 0}),X=function(e){return e.NoResourceFound=`NoResourceFound`,e.Z3988=`Z3988`,e.Z3988SearchResult=`Z3988SearchResult`,e.Amazon=`Amazon`,e.CupOfJo=`CupOfJo`,e.IngentaConnect=`IngentaConnect`,e.Jstor=`Jstor`,e.Milne=`Milne`,e.Primo=`Primo`,e.SagePub=`SagePub`,e.SageVideo=`SageVideo`,e.ScienceDirect=`ScienceDirect`,e.Springer=`Springer`,e.Youtube=`Youtube`,e.TaylorFrancis=`TaylorFrancis`,e.Wiley=`Wiley`,e.VuFind=`VuFind`,e.ClinicalKey=`ClinicalKey`,e.DOAJ=`DOAJ`,e.Ebscohost=`Ebscohost`,e.OpenStax=`OpenStax`,e.CambridgeJournalsOnline=`CambridgeJournalsOnline`,e.OpenTextbook=`OpenTextbook`,e.AhaJournals=`AhaJournals`,e.Ijees=`Ijees`,e.BloomsburyCollections=`BloomsburyCollections`,e.HeritageCirqa=`HeritageCirqa`,e.BritishMedicalJournal=`BritishMedicalJournal`,e.SummonSearchResult=`SummonSearchResult`,e.ApplePodcasts=`ApplePodcasts`,e.Arxiv=`Arxiv`,e.KanopyVideo=`KanopyVideo`,e.LaTrobeOpal=`LaTrobeOpal`,e.BYUScholarsArchive=`BYUScholarsArchive`,e.Informit=`Informit`,e.Brill=`Brill`,e.HeinOnline=`HeinOnline`,e.PrimoNde=`PrimoNde`,e}({}),pm={[X.NoResourceFound]:lc,[X.Z3988]:rs,[X.Z3988SearchResult]:ru,[X.Amazon]:ds,[X.CupOfJo]:cc,[X.Jstor]:zu,[X.Youtube]:al,[X.SagePub]:Ec,[X.SageVideo]:nu,[X.ScienceDirect]:Lc,[X.Springer]:Ml,[X.TaylorFrancis]:Wc,[X.Wiley]:eu,[X.VuFind]:tl,[X.ClinicalKey]:Js,[X.DOAJ]:hc,[X.Primo]:Cd,[X.IngentaConnect]:Md,[X.Ebscohost]:nf,[X.OpenStax]:sf,[X.OpenTextbook]:uf,[X.Milne]:pf,[X.CambridgeJournalsOnline]:mf,[X.AhaJournals]:Of,[X.Ijees]:Mf,[X.BloomsburyCollections]:Jf,[X.HeritageCirqa]:Qf,[X.BritishMedicalJournal]:np,[X.SummonSearchResult]:rp,[X.ApplePodcasts]:lp,[X.Arxiv]:fp,[X.KanopyVideo]:hp,[X.LaTrobeOpal]:xp,[X.BYUScholarsArchive]:Os,[X.Informit]:Fp,[X.Brill]:$p,[X.HeinOnline]:tm,[X.PrimoNde]:fm},mm=`5.36.0`,hm=()=>mm,gm=[`com.au`,`com`,`ca`,`co.uk`,`de`,`fr`,`nl`].flatMap(e=>[`amazon.${e}`,`www.amazon.${e}`]),_m={version:hm(),siteRegistrations:[{matcher:{regexp:`^https://[a-z0-9\\-]+\\.on\\.worldcat\\.org/search`},name:`Worldcat Search Results`,parsers:[X.Z3988SearchResult]},{matcher:{regexp:`^https://[a-z0-9\\-]+\\.summon\\.serialssolutions\\.com/`},name:`Summon Search Results`,parsers:[X.SummonSearchResult]},{matcher:{regexp:`cupofjo[.-]com`},name:`Cup of Jo`,parsers:[X.CupOfJo]},{matcher:{hostnames:[`youtube.com`,`www.youtube.com`]},name:`Youtube`,parsers:[X.Youtube]},{matcher:{regexp:`www[-.]sciencedirect[.-]com`},name:`Science Direct`,parsers:[X.ScienceDirect]},{matcher:{hostnames:gm},name:`Amazon`,parsers:[X.Amazon]},{matcher:{regexp:`^https://sk\\.sagepub\\.com/video/`},name:`Sage Video`,parsers:[X.SageVideo]},{matcher:{regexp:`[/.-]((www|journals)[.-])?sagepub[.-]com`},name:`Sage Publishing`,parsers:[X.SagePub]},{matcher:{regexp:`www[.-]tandfonline[.-]com`},name:`Taylor & Francis`,parsers:[X.TaylorFrancis]},{matcher:{regexp:`[/.-]((www|onlinelibrary)[.-])?wiley[.-]com`},name:`Wiley`,parsers:[X.Wiley]},{matcher:{regexp:`^https://[a-z0-9\\-]+[.-]on[.-]worldcat[.-]org`},name:`Worldcat`,parsers:[X.Z3988]},{matcher:{hostnames:[`catalogue.rau.ac.uk`]},name:`Royal Agricultural University Library`,parsers:[X.Z3988]},{matcher:{regexp:`link[.-]springer[.-]com`},name:`Springer`,parsers:[X.Springer]},{matcher:{regexp:`^https://vufind\\.lboro\\.ac\\.uk/(Record|PrimoRecord)`},name:`VuFind`,parsers:[X.VuFind]},{matcher:{regexp:`www[.-]clinicalkey[.-]com`},name:`ClinicalKey`,parsers:[X.ClinicalKey]},{matcher:{regexp:`www[.-]jstor[.-]org`},name:`JSTOR`,parsers:[X.Jstor]},{matcher:{regexp:`doaj[.-]org`},name:`DOAJ`,parsers:[X.DOAJ]},{matcher:{regexp:`[/.-]ingentaconnect[.-]com`},name:`IngentaConnect`,parsers:[X.IngentaConnect]},{matcher:{regexp:`research[.-]ebsco[.-]com`},name:`EBSCOHost`,parsers:[X.Ebscohost]},{matcher:{regexp:`openstax[-.]org`},name:`OpenStax`,parsers:[X.OpenStax]},{matcher:{regexp:`open[.-]umn[.-]edu`},name:`OpenTextbook`,parsers:[X.OpenTextbook]},{matcher:{regexp:`milneopentextbooks[-.]org`},name:`Milne Open Textbooks`,parsers:[X.Milne]},{matcher:{regexp:`www[.-]perlego[.-]com`},name:`Perlego`,parsers:[X.Z3988]},{matcher:{regexp:`www[.-]ahajournals[.-]org`},name:`AHA Journals`,parsers:[X.AhaJournals]},{matcher:{regexp:`www[.-]cambridge[.-]org`},name:`Cambridge Journals Online`,parsers:[X.CambridgeJournalsOnline]},{matcher:{regexp:`www[.-]nieindia[.-]org`},name:`International Journal of Ecology and Environmental Sciences`,parsers:[X.Ijees]},{matcher:{regexp:`www[.-]bloomsburycollections[.-]com`},name:`Bloomsbury Collections`,parsers:[X.BloomsburyCollections]},{matcher:{regexp:`cirqahosting[.-]com`},name:`Heritage Cirqa`,parsers:[X.HeritageCirqa]},{matcher:{regexp:`www[.-]bmj[.-]com`},name:`British Medical Journal`,parsers:[X.BritishMedicalJournal]},{matcher:{regexp:`podcasts[.-]apple[.-]com`},name:`Apple Podcasts`,parsers:[X.ApplePodcasts]},{matcher:{regexp:`arxiv[.-]org`},name:`arxiv`,parsers:[X.Arxiv]},{matcher:{regexp:`kanopy[.-]com`},name:`Kanopy Video`,parsers:[X.KanopyVideo]},{matcher:{regexp:`opal[.-]latrobe[.-]edu[.-]au`},name:`La Trobe Opal`,parsers:[X.LaTrobeOpal]},{matcher:{hostnames:[`scholarsarchive.byu.edu`]},name:`BYU Scholars Archive`,parsers:[X.BYUScholarsArchive]},{matcher:{regexp:`informit[.-]org`},name:`Informit`,parsers:[X.Informit]},{matcher:{regexp:`brill[.-]com`},name:`Brill`,parsers:[X.Brill]},{matcher:{regexp:`^https://heinonline[.-]org+.+HOL/LuceneSearch+.*`},name:`HeinOnline Search Results`,parsers:[X.Z3988SearchResult]},{matcher:{regexp:`^https://heinonline[.-]org+.+HOL/Page+.*`},name:`HeinOnline`,parsers:[X.HeinOnline]},{matcher:{regexp:`/nde/fulldisplay`},name:`Primo NDE`,parsers:[X.PrimoNde]},{matcher:{regexp:`/(discovery|primo-explore)/fulldisplay`},name:`Primo`,parsers:[X.Primo]}]},vm=j({hostnames:A(O()).min(1)}),ym=j({regexp:O()}),bm=M([vm,ym]),xm=j({matcher:bm,name:O(),parsers:A(O()),libraryVersionRange:O().optional()}),Sm=j({siteRegistrations:A(xm),version:O()}),Cm=e=>Sm.safeParse(e).success,wm=e=>xm.safeParse(e).success,Tm=e=>bm.safeParse(e).success,Em=e=>Object.values(X).includes(e),Dm=j({url:O(),document:to(e=>typeof e==`object`&&!!e)}),Om=e=>Dm.safeParse(e).success,km=t(((e,t)=>{var n=`2.0.0`,r=256;t.exports={MAX_LENGTH:r,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:r-6,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:n,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),Am=t(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),jm=t(((e,t)=>{var{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=km(),a=Am();e=t.exports={};var o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),Mm=t(((e,t)=>{var n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),Nm=t(((e,t)=>{var n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),Z=t(((e,t)=>{var n=Am(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=km(),{safeRe:a,t:o}=jm(),s=Mm(),{compareIdentifiers:c}=Nm();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),Pm=t(((e,t)=>{var n=Z();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),Fm=t(((e,t)=>{var n=Pm();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),Im=t(((e,t)=>{var n=Pm();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),Lm=t(((e,t)=>{var n=Z();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),Rm=t(((e,t)=>{var n=Pm();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),zm=t(((e,t)=>{var n=Z();t.exports=(e,t)=>new n(e,t).major})),Bm=t(((e,t)=>{var n=Z();t.exports=(e,t)=>new n(e,t).minor})),Vm=t(((e,t)=>{var n=Z();t.exports=(e,t)=>new n(e,t).patch})),Hm=t(((e,t)=>{var n=Pm();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),Q=t(((e,t)=>{var n=Z();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),Um=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(t,e,r)})),Wm=t(((e,t)=>{var n=Q();t.exports=(e,t)=>n(e,t,!0)})),Gm=t(((e,t)=>{var n=Z();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),Km=t(((e,t)=>{var n=Gm();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),qm=t(((e,t)=>{var n=Gm();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),Jm=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(e,t,r)>0})),Ym=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(e,t,r)<0})),Xm=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(e,t,r)===0})),Zm=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(e,t,r)!==0})),Qm=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(e,t,r)>=0})),$m=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(e,t,r)<=0})),eh=t(((e,t)=>{var n=Xm(),r=Zm(),i=Jm(),a=Qm(),o=Ym(),s=$m();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),th=t(((e,t)=>{var n=Z(),r=Pm(),{safeRe:i,t:a}=jm();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t||={};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),nh=t(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),$=t(((e,t)=>{var n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,se(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>v(e,this.options)).join(` `).split(/\s+/).map(e=>b(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let _=new Map,y=g.map(e=>new a(e,this.options));for(let e of y){if(h(e))return[e];_.set(e.value,e)}_.size>1&&_.has(``)&&_.delete(``);let ee=[..._.values()];return r.set(t,ee),ee}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>_(e,n)&&t.set.some(t=>_(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(ce(this.set[t],e,this.options))return!0;return!1}};var r=new(nh()),i=Mm(),a=rh(),o=Am(),s=Z(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=jm(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=km(),h=e=>e.value===`<0.0.0-0`,g=e=>e.value===``,_=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=ne(e,t),o(`caret`,e),e=ee(e,t),o(`tildes`,e),e=ie(e,t),o(`xrange`,e),e=oe(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,ee=(e,t)=>e.trim().split(/\s+/).map(e=>te(e,t)).join(` `),te=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return y(n)?s=``:y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},ne=(e,t)=>e.trim().split(/\s+/).map(e=>re(e,t)).join(` `),re=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return y(n)?c=``:y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},ie=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>ae(e,t)).join(` `)),ae=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=y(i),u=l||y(a),d=u||y(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},oe=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),b=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),se=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=y(r)?``:y(i)?`>=${r}.0.0${e?`-0`:``}`:y(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=y(l)?``:y(u)?`<${+l+1}.0.0-0`:y(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),ce=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),rh=t(((e,t)=>{var n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};var r=Mm(),{safeRe:i,t:a}=jm(),o=eh(),s=Am(),c=Z(),l=$()})),ih=t(((e,t)=>{var n=$();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),ah=t(((e,t)=>{var n=$();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),oh=t(((e,t)=>{var n=Z(),r=$();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),sh=t(((e,t)=>{var n=Z(),r=$();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),ch=t(((e,t)=>{var n=Z(),r=$(),i=Jm();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t<e.set.length;++t){let r=e.set[t],o=null;r.forEach(e=>{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),lh=t(((e,t)=>{var n=$();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),uh=t(((e,t)=>{var n=Z(),r=rh(),{ANY:i}=r,a=$(),o=ih(),s=Jm(),c=Ym(),l=$m(),u=Qm();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,_;switch(d){case`>`:p=s,m=l,h=c,g=`>`,_=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,_=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n<t.set.length;++n){let a=t.set[n],o=null,s=null;if(a.forEach(e=>{e.semver===i&&(e=new r(`>=0.0.0`)),o||=e,s||=e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===_||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===_&&h(e,s.semver))return!1}return!0}})),dh=t(((e,t)=>{var n=uh();t.exports=(e,t,r)=>n(e,t,`>`,r)})),fh=t(((e,t)=>{var n=uh();t.exports=(e,t,r)=>n(e,t,`<`,r)})),ph=t(((e,t)=>{var n=$();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),mh=t(((e,t)=>{var n=ih(),r=Q();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||=e):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length<d.length?u:t}})),hh=t(((e,t)=>{var n=$(),r=rh(),{ANY:i}=r,a=ih(),o=Q(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i||=t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,_,v=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,y=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;v&&v.prerelease.length===1&&u.operator===`<`&&v.prerelease[0]===0&&(v=!1);for(let e of t){if(_=_||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!a(s.semver,String(e),n))return!1}if(u){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!a(u.semver,String(e),n))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&_&&!s&&p!==0||y||v)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),gh=t(((e,t)=>{var n=jm(),r=km(),i=Z(),a=Nm();t.exports={parse:Pm(),valid:Fm(),clean:Im(),inc:Lm(),diff:Rm(),major:zm(),minor:Bm(),patch:Vm(),prerelease:Hm(),compare:Q(),rcompare:Um(),compareLoose:Wm(),compareBuild:Gm(),sort:Km(),rsort:qm(),gt:Jm(),lt:Ym(),eq:Xm(),neq:Zm(),gte:Qm(),lte:$m(),cmp:eh(),coerce:th(),Comparator:rh(),Range:$(),satisfies:ih(),toComparators:ah(),maxSatisfying:oh(),minSatisfying:sh(),minVersion:ch(),validRange:lh(),outside:uh(),gtr:dh(),ltr:fh(),intersects:ph(),simplifyRange:mh(),subset:hh(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}}))(),_h=(e,t)=>vh(t)?t.hostnames.includes(new URL(e).hostname):yh(t)?!!e.match(t.regexp):!1,vh=e=>vm.safeParse(e).success,yh=e=>ym.safeParse(e).success,bh=(e,t)=>t?(0,gh.satisfies)(e,t):!0,xh=(e,t,n)=>bh(t,n.libraryVersionRange)&&_h(e,n.matcher),Sh=(e,t)=>e.siteRegistrations.filter(e=>xh(t,hm(),e)),Ch=(e,t)=>Sh(e,t).flatMap(({parsers:e,name:t})=>e.filter(e=>Em(e)&&e in pm).map(e=>({parser:pm[e],parserType:e,name:t}))),wh=(e,t)=>{let n=Ch(e,t.url);for(let{parser:e,parserType:r,name:i}of n){let n=e(t);if(Yc(n)||Xc(n)||Zc(n))return{...n,meta:{parserName:i,parserType:r,referrer:t.url}}}return{...lc(t),meta:{parserName:null,parserType:X.NoResourceFound,referrer:t.url}}},Th=(e,t)=>{switch(t){case jo.CA:return new URL(`https://${e}.rl.ca.talis.com`);default:return new URL(`https://${e}.rl.talis.com`)}};e.BookGenresSchema=io,e.CustomerListSchema=Ro,e.CustomerSchema=Lo,e.DirectLinkOnlyResultSchema=qo,e.Genre=F,e.HostnamesMatcherSchema=vm,e.JournalGenresSchema=ao,e.NON_OPENURL_PROPERTIES=xo,e.NonOpenUrlPropertiesSchema=so,e.NothingParsedResultSchema=Ko,e.OPENURL_KEYS=bo,e.OpenUrlAudioVisualResourceSchema=uo,e.OpenUrlBookResourceSchema=co,e.OpenUrlDocumentResourceSchema=po,e.OpenUrlImageResourceSchema=fo,e.OpenUrlJournalResourceSchema=lo,e.OpenUrlResourceSchema=oo,e.OpenUrlResultSchema=Jo,e.OpenUrlWebpageResourceSchema=mo,e.PARSERS=pm,e.ParserRegistrySchema=Sm,e.ParserType=X,e.ParsingMetadataSchema=Go,e.ParsingRequestSchema=Fo,e.ParsingResponseSchema=Qo,e.ParsingResultSchema=Zo,e.REGISTRY=_m,e.RegExpMatcherSchema=ym,e.ResourceDataSchema=Dm,e.ResourceSchema=ho,e.SiteRegistrationSchema=xm,e.SummonSearchResultSchema=Xo,e.TenantRegion=jo,e.TenantRegistrySchema=No,e.TenantSchema=Mo,e.UrlMatcherSchema=bm,e.Z3988SearchResultSchema=Yo,e.convertCustomerListToTenantRegistry=Uo,e.createAudioVisual=R,e.createBook=I,e.createDocument=_o,e.createImage=go,e.createJournal=L,e.createWebpage=vo,e.directLinkOnly=$o,e.fromOpenUrl=Oo,e.getBaseBookmarkingUrl=(e,t)=>{let n=Th(e,t);return new URL(`/ui/forms/bookmarklet.html`,n)},e.getLibraryVersion=hm,e.isCustomer=zo,e.isCustomerList=Bo,e.isDirectLinkOnlyResult=Jc,e.isGenre=Ao,e.isNothingParsedResult=Qc,e.isOpenUrlResult=Yc,e.isParserRegistry=Cm,e.isParserType=Em,e.isParsingMetadata=qc,e.isParsingRequest=Io,e.isParsingResponse=Kc,e.isParsingResult=Gc,e.isResourceData=Om,e.isSiteRegistration=wm,e.isSummonSearchResult=Zc,e.isTenant=Vo,e.isTenantRegion=Ho,e.isUrlMatcher=Tm,e.isZ3988SearchResult=Xc,e.nothingParsed=z,e.openUrlResource=B,e.parseResource=wh,e.summonSearchResult=ts,e.toBookmarkingWorkflowUrl=(e,t,n)=>{let r=Eo(t);r.append(`fast`,`true`),r.append(`breakout`,`true`),n&&(n.parserName&&r.append(`targetTitle`,n.parserName),r.append(`referrer`,n.referrer));let i=new URL(e.toString());return i.search=r.toString(),i},e.toOpenUrl=Eo,e.z3988SearchResult=es});
|