@talisdev/bibliographic-resource-parsers-lib 5.29.0 → 5.31.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,20 +1,20 @@
1
- (function(v,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(v=typeof globalThis<"u"?globalThis:v||self,m(v.BibliographicResourceParsersLib={}))})(this,(function(v){"use strict";function m(e,t,r){function n(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(e),t(a,c);for(const l in i.prototype)l in a||Object.defineProperty(a,l,{value:i.prototype[l].bind(a)});a._zod.constr=i,a._zod.def=c}const o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const u=r?.Parent?new s:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Pe extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class mn extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const gn={};function ge(e){return gn}function mi(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function $t(e,t){return typeof t=="bigint"?t.toString():t}function At(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Rt(e){return e==null}function wt(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function gi(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){const c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const s=r>o?r:o,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}const vn=Symbol("evaluating");function V(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==vn)return n===void 0&&(n=vn,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Ae(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Re(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function bn(e){return JSON.stringify(e)}const _n="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function He(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const vi=At(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Oe(e){if(He(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(He(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function yn(e){return Oe(e)?{...e}:Array.isArray(e)?[...e]:e}const bi=new Set(["string","number","symbol"]);function Ne(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ve(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function $(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new 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 _i(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const yi={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Si(e,t){const r=e._zod.def,n=Re(e._zod.def,{get shape(){const o={};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(o[s]=r.shape[s])}return Ae(this,"shape",o),o},checks:[]});return ve(e,n)}function Ei(e,t){const r=e._zod.def,n=Re(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete o[s]}return Ae(this,"shape",o),o},checks:[]});return ve(e,n)}function $i(e,t){if(!Oe(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const o=Re(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Ae(this,"shape",s),s},checks:[]});return ve(e,o)}function Ai(e,t){if(!Oe(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Ae(this,"shape",n),n},checks:e._zod.def.checks};return ve(e,r)}function Ri(e,t){const r=Re(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Ae(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return ve(e,r)}function wi(e,t,r){const n=Re(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(r)for(const i in r){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=e?new e({type:"optional",innerType:o[i]}):o[i])}else for(const i in o)s[i]=e?new e({type:"optional",innerType:o[i]}):o[i];return Ae(this,"shape",s),s},checks:[]});return ve(t,n)}function Ii(e,t,r){const n=Re(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(r)for(const i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return Ae(this,"shape",s),s},checks:[]});return ve(t,n)}function ze(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Le(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Ye(e){return typeof e=="string"?e:e?.message}function be(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=Ye(e.inst?._zod.def?.error?.(e))??Ye(t?.error?.(e))??Ye(r.customError?.(e))??Ye(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function It(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ze(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Sn=(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,$t,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},En=m("$ZodError",Sn),$n=m("$ZodError",Sn,{Parent:Error});function ki(e,t=r=>r.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Ci(e,t=r=>r.message){const r={_errors:[]},n=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>n({issues:i}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)r._errors.push(t(s));else{let i=r,a=0;for(;a<s.path.length;){const c=s.path[a];a===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s))):i[c]=i[c]||{_errors:[]},i=i[c],a++}}};return n(e),r}const kt=e=>(t,r,n,o)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Pe;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>be(c,s,ge())));throw _n(a,o?.callee),a}return i.value},Ct=e=>async(t,r,n,o)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>be(c,s,ge())));throw _n(a,o?.callee),a}return i.value},Ke=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Pe;return s.issues.length?{success:!1,error:new(e??En)(s.issues.map(i=>be(i,o,ge())))}:{success:!0,data:s.value}},Pi=Ke($n),Qe=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>be(i,o,ge())))}:{success:!0,data:s.value}},Oi=Qe($n),Ni=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return kt(e)(t,r,o)},zi=e=>(t,r,n)=>kt(e)(t,r,n),Li=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ct(e)(t,r,o)},xi=e=>async(t,r,n)=>Ct(e)(t,r,n),Ti=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ke(e)(t,r,o)},qi=e=>(t,r,n)=>Ke(e)(t,r,n),Zi=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Qe(e)(t,r,o)},ji=e=>async(t,r,n)=>Qe(e)(t,r,n),Di=/^[cC][^\s-]{8,}$/,Ui=/^[0-9a-z]+$/,Bi=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Vi=/^[0-9a-vA-V]{20}$/,Fi=/^[A-Za-z0-9]{27}$/,Ji=/^[a-zA-Z0-9_-]{21}$/,Mi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Wi=/^([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})$/,An=e=>e?new 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)$/,Gi=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Xi="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Hi(){return new RegExp(Xi,"u")}const Yi=/^(?:(?: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])$/,Ki=/^(([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}|:))$/,Qi=/^((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])$/,ea=/^(([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])$/,ta=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Rn=/^[A-Za-z0-9_-]*$/,ra=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,na=/^\+(?:[0-9]){6,14}[0-9]$/,wn="(?:(?:\\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])))",oa=new RegExp(`^${wn}$`);function In(e){const 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 sa(e){return new RegExp(`^${In(e)}$`)}function ia(e){const t=In({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${wn}T(?:${n})$`)}const aa=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ca=/^-?\d+$/,ua=/^-?\d+(?:\.\d+)?/,la=/^null$/i,pa=/^[^A-Z]*$/,ha=/^[^a-z]*$/,se=m("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),kn={number:"number",bigint:"bigint",object:"date"},Cn=m("$ZodCheckLessThan",(e,t)=>{se.init(e,t);const r=kn[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Pn=m("$ZodCheckGreaterThan",(e,t)=>{se.init(e,t);const r=kn[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fa=m("$ZodCheckMultipleOf",(e,t)=>{se.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):gi(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),da=m("$ZodCheckNumberFormat",(e,t)=>{se.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,s]=yi[t.format];e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,a.minimum=o,a.maximum=s,r&&(a.pattern=ca)}),e._zod.check=i=>{const a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:e})}}),ma=m("$ZodCheckMaxLength",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Rt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const i=It(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ga=m("$ZodCheckMinLength",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Rt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const i=It(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),va=m("$ZodCheckLengthEquals",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Rt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{const o=n.value,s=o.length;if(s===t.length)return;const i=It(o),a=s>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),et=m("$ZodCheckStringFormat",(e,t)=>{var r,n;se.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),ba=m("$ZodCheckRegex",(e,t)=>{et.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),_a=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=pa),et.init(e,t)}),ya=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ha),et.init(e,t)}),Sa=m("$ZodCheckIncludes",(e,t)=>{se.init(e,t);const r=Ne(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Ea=m("$ZodCheckStartsWith",(e,t)=>{se.init(e,t);const r=new RegExp(`^${Ne(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),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})}}),$a=m("$ZodCheckEndsWith",(e,t)=>{se.init(e,t);const r=new RegExp(`.*${Ne(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),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})}}),Aa=m("$ZodCheckOverwrite",(e,t)=>{se.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Ra{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
1
+ (function(b,d){typeof exports=="object"&&typeof module<"u"?d(exports):typeof define=="function"&&define.amd?define(["exports"],d):(b=typeof globalThis<"u"?globalThis:b||self,d(b.BibliographicResourceParsersLib={}))})(this,(function(b){"use strict";function d(e,t,r){function n(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(e),t(a,c);for(const l in i.prototype)l in a||Object.defineProperty(a,l,{value:i.prototype[l].bind(a)});a._zod.constr=i,a._zod.def=c}const o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const u=r?.Parent?new s:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Oe extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class In extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const kn={};function ve(e){return kn}function Ii(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Ct(e,t){return typeof t=="bigint"?t.toString():t}function Pt(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ot(e){return e==null}function Nt(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function ki(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){const c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const s=r>o?r:o,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}const Cn=Symbol("evaluating");function V(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Cn)return n===void 0&&(n=Cn,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Re(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function we(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Pn(e){return JSON.stringify(e)}const On="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Qe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ci=Pt(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Ne(e){if(Qe(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(Qe(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Nn(e){return Ne(e)?{...e}:Array.isArray(e)?[...e]:e}const Pi=new Set(["string","number","symbol"]);function ze(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function be(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function $(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new 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 Oi(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Ni={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function zi(e,t){const r=e._zod.def,n=we(e._zod.def,{get shape(){const o={};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(o[s]=r.shape[s])}return Re(this,"shape",o),o},checks:[]});return be(e,n)}function Li(e,t){const r=e._zod.def,n=we(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete o[s]}return Re(this,"shape",o),o},checks:[]});return be(e,n)}function xi(e,t){if(!Ne(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const o=we(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Re(this,"shape",s),s},checks:[]});return be(e,o)}function Ti(e,t){if(!Ne(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Re(this,"shape",n),n},checks:e._zod.def.checks};return be(e,r)}function qi(e,t){const r=we(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Re(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return be(e,r)}function Zi(e,t,r){const n=we(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(r)for(const i in r){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=e?new e({type:"optional",innerType:o[i]}):o[i])}else for(const i in o)s[i]=e?new e({type:"optional",innerType:o[i]}):o[i];return Re(this,"shape",s),s},checks:[]});return be(t,n)}function Di(e,t,r){const n=we(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(r)for(const i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return Re(this,"shape",s),s},checks:[]});return be(t,n)}function Le(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function xe(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function et(e){return typeof e=="string"?e:e?.message}function _e(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=et(e.inst?._zod.def?.error?.(e))??et(t?.error?.(e))??et(r.customError?.(e))??et(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function zt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function De(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const zn=(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,Ct,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ln=d("$ZodError",zn),xn=d("$ZodError",zn,{Parent:Error});function ji(e,t=r=>r.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Bi(e,t=r=>r.message){const r={_errors:[]},n=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>n({issues:i}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)r._errors.push(t(s));else{let i=r,a=0;for(;a<s.path.length;){const c=s.path[a];a===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s))):i[c]=i[c]||{_errors:[]},i=i[c],a++}}};return n(e),r}const Lt=e=>(t,r,n,o)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Oe;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>_e(c,s,ve())));throw On(a,o?.callee),a}return i.value},xt=e=>async(t,r,n,o)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>_e(c,s,ve())));throw On(a,o?.callee),a}return i.value},tt=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Oe;return s.issues.length?{success:!1,error:new(e??Ln)(s.issues.map(i=>_e(i,o,ve())))}:{success:!0,data:s.value}},Ui=tt(xn),rt=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>_e(i,o,ve())))}:{success:!0,data:s.value}},Vi=rt(xn),Fi=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Lt(e)(t,r,o)},Ji=e=>(t,r,n)=>Lt(e)(t,r,n),Mi=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return xt(e)(t,r,o)},Wi=e=>async(t,r,n)=>xt(e)(t,r,n),Gi=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return tt(e)(t,r,o)},Xi=e=>(t,r,n)=>tt(e)(t,r,n),Hi=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return rt(e)(t,r,o)},Yi=e=>async(t,r,n)=>rt(e)(t,r,n),Ki=/^[cC][^\s-]{8,}$/,Qi=/^[0-9a-z]+$/,ea=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ta=/^[0-9a-vA-V]{20}$/,ra=/^[A-Za-z0-9]{27}$/,na=/^[a-zA-Z0-9_-]{21}$/,oa=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,sa=/^([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})$/,Tn=e=>e?new 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)$/,ia=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,aa="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ca(){return new RegExp(aa,"u")}const ua=/^(?:(?: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])$/,la=/^(([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}|:))$/,pa=/^((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])$/,ha=/^(([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])$/,fa=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,qn=/^[A-Za-z0-9_-]*$/,ma=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,da=/^\+(?:[0-9]){6,14}[0-9]$/,Zn="(?:(?:\\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])))",ga=new RegExp(`^${Zn}$`);function Dn(e){const 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 va(e){return new RegExp(`^${Dn(e)}$`)}function ba(e){const t=Dn({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Zn}T(?:${n})$`)}const _a=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ya=/^-?\d+$/,Sa=/^-?\d+(?:\.\d+)?/,Ea=/^null$/i,Aa=/^[^A-Z]*$/,$a=/^[^a-z]*$/,se=d("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),jn={number:"number",bigint:"bigint",object:"date"},Bn=d("$ZodCheckLessThan",(e,t)=>{se.init(e,t);const r=jn[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Un=d("$ZodCheckGreaterThan",(e,t)=>{se.init(e,t);const r=jn[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ra=d("$ZodCheckMultipleOf",(e,t)=>{se.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):ki(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),wa=d("$ZodCheckNumberFormat",(e,t)=>{se.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,s]=Ni[t.format];e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,a.minimum=o,a.maximum=s,r&&(a.pattern=ya)}),e._zod.check=i=>{const a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:e})}}),Ia=d("$ZodCheckMaxLength",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Ot(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const i=zt(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ka=d("$ZodCheckMinLength",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Ot(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const i=zt(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ca=d("$ZodCheckLengthEquals",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Ot(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{const o=n.value,s=o.length;if(s===t.length)return;const i=zt(o),a=s>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),nt=d("$ZodCheckStringFormat",(e,t)=>{var r,n;se.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Pa=d("$ZodCheckRegex",(e,t)=>{nt.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Oa=d("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Aa),nt.init(e,t)}),Na=d("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=$a),nt.init(e,t)}),za=d("$ZodCheckIncludes",(e,t)=>{se.init(e,t);const r=ze(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),La=d("$ZodCheckStartsWith",(e,t)=>{se.init(e,t);const r=new RegExp(`^${ze(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),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})}}),xa=d("$ZodCheckEndsWith",(e,t)=>{se.init(e,t);const r=new RegExp(`.*${ze(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),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})}}),Ta=d("$ZodCheckOverwrite",(e,t)=>{se.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class qa{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
2
2
  `).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,r=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...r,o.join(`
3
- `))}}const wa={major:4,minor:1,patch:12},G=m("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=wa;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(i,a,c)=>{let u=ze(i),l;for(const f of a){if(f._zod.def.when){if(!f._zod.def.when(i))continue}else if(u)continue;const d=i.issues.length,g=f._zod.check(i);if(g instanceof Promise&&c?.async===!1)throw new Pe;if(l||g instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await g,i.issues.length!==d&&(u||(u=ze(i,d)))});else{if(i.issues.length===d)continue;u||(u=ze(i,d))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(ze(i))return i.aborted=!0,i;const u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new Pe;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Pe;return c.then(u=>o(u,n,a))}return o(c,n,a)}}e["~standard"]={validate:o=>{try{const s=Pi(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Oi(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),Pt=m("$ZodString",(e,t)=>{G.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??aa(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),J=m("$ZodStringFormat",(e,t)=>{et.init(e,t),Pt.init(e,t)}),Ia=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Wi),J.init(e,t)}),ka=m("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=An(n))}else t.pattern??(t.pattern=An());J.init(e,t)}),Ca=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Gi),J.init(e,t)}),Pa=m("$ZodURL",(e,t)=>{J.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:ra.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Oa=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Hi()),J.init(e,t)}),Na=m("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ji),J.init(e,t)}),za=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Di),J.init(e,t)}),La=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ui),J.init(e,t)}),xa=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Bi),J.init(e,t)}),Ta=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Vi),J.init(e,t)}),qa=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Fi),J.init(e,t)}),Za=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=ia(t)),J.init(e,t)}),ja=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=oa),J.init(e,t)}),Da=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=sa(t)),J.init(e,t)}),Ua=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Mi),J.init(e,t)}),Ba=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Yi),J.init(e,t),e._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv4"})}),Va=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ki),J.init(e,t),e._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv6"}),e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Fa=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Qi),J.init(e,t)}),Ja=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ea),J.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[o,s]=n;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function On(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Ma=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ta),J.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{On(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Wa(e){if(!Rn.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return On(r)}const Ga=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Rn),J.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{Wa(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Xa=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=na),J.init(e,t)});function Ha(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const Ya=m("$ZodJWT",(e,t)=>{J.init(e,t),e._zod.check=r=>{Ha(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Nn=m("$ZodNumber",(e,t)=>{G.init(e,t),e._zod.pattern=e._zod.bag.pattern??ua,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),Ka=m("$ZodNumber",(e,t)=>{da.init(e,t),Nn.init(e,t)}),Qa=m("$ZodNull",(e,t)=>{G.init(e,t),e._zod.pattern=la,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{const o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),ec=m("$ZodUnknown",(e,t)=>{G.init(e,t),e._zod.parse=r=>r}),tc=m("$ZodNever",(e,t)=>{G.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function zn(e,t,r){e.issues.length&&t.issues.push(...Le(r,e.issues)),t.value[r]=e.value}const rc=m("$ZodArray",(e,t)=>{G.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const a=o[i],c=t.element._zod.run({value:a,issues:[]},n);c instanceof Promise?s.push(c.then(u=>zn(u,r,i))):zn(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function tt(e,t,r,n){e.issues.length&&t.issues.push(...Le(r,e.issues)),e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Ln(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=_i(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function xn(e,t,r,n,o,s){const i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type;for(const l of Object.keys(t)){if(a.has(l))continue;if(u==="never"){i.push(l);continue}const f=c.run({value:t[l],issues:[]},n);f instanceof Promise?e.push(f.then(d=>tt(d,r,l,t))):tt(f,r,l,t)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}const nc=m("$ZodObject",(e,t)=>{if(G.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const n=At(()=>Ln(t));V(e._zod,"propValues",()=>{const a=t.shape,c={};for(const u in a){const l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(const f of l.values)c[u].add(f)}}return c});const o=He,s=t.catchall;let i;e._zod.parse=(a,c)=>{i??(i=n.value);const u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};const l=[],f=i.shape;for(const d of i.keys){const P=f[d]._zod.run({value:u[d],issues:[]},c);P instanceof Promise?l.push(P.then(b=>tt(b,a,d,u))):tt(P,a,d,u)}return s?xn(l,u,a,c,n.value,e):l.length?Promise.all(l).then(()=>a):a}}),oc=m("$ZodObjectJIT",(e,t)=>{nc.init(e,t);const r=e._zod.parse,n=At(()=>Ln(t)),o=d=>{const g=new Ra(["shape","payload","ctx"]),P=n.value,b=L=>{const B=bn(L);return`shape[${B}]._zod.run({ value: input[${B}], issues: [] }, ctx)`};g.write("const input = payload.value;");const O=Object.create(null);let Z=0;for(const L of P.keys)O[L]=`key_${Z++}`;g.write("const newResult = {};");for(const L of P.keys){const B=O[L],Q=bn(L);g.write(`const ${B} = ${b(L)};`),g.write(`
4
- if (${B}.issues.length) {
5
- payload.issues = payload.issues.concat(${B}.issues.map(iss => ({
3
+ `))}}const Za={major:4,minor:1,patch:12},X=d("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Za;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(i,a,c)=>{let u=Le(i),l;for(const f of a){if(f._zod.def.when){if(!f._zod.def.when(i))continue}else if(u)continue;const m=i.issues.length,g=f._zod.check(i);if(g instanceof Promise&&c?.async===!1)throw new Oe;if(l||g instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await g,i.issues.length!==m&&(u||(u=Le(i,m)))});else{if(i.issues.length===m)continue;u||(u=Le(i,m))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(Le(i))return i.aborted=!0,i;const u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new Oe;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Oe;return c.then(u=>o(u,n,a))}return o(c,n,a)}}e["~standard"]={validate:o=>{try{const s=Ui(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Vi(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),Tt=d("$ZodString",(e,t)=>{X.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??_a(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),M=d("$ZodStringFormat",(e,t)=>{nt.init(e,t),Tt.init(e,t)}),Da=d("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=sa),M.init(e,t)}),ja=d("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Tn(n))}else t.pattern??(t.pattern=Tn());M.init(e,t)}),Ba=d("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ia),M.init(e,t)}),Ua=d("$ZodURL",(e,t)=>{M.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:ma.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Va=d("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ca()),M.init(e,t)}),Fa=d("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=na),M.init(e,t)}),Ja=d("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ki),M.init(e,t)}),Ma=d("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Qi),M.init(e,t)}),Wa=d("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ea),M.init(e,t)}),Ga=d("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ta),M.init(e,t)}),Xa=d("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ra),M.init(e,t)}),Ha=d("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=ba(t)),M.init(e,t)}),Ya=d("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ga),M.init(e,t)}),Ka=d("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=va(t)),M.init(e,t)}),Qa=d("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=oa),M.init(e,t)}),ec=d("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ua),M.init(e,t),e._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv4"})}),tc=d("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=la),M.init(e,t),e._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv6"}),e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),rc=d("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=pa),M.init(e,t)}),nc=d("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ha),M.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[o,s]=n;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Vn(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const oc=d("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=fa),M.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{Vn(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function sc(e){if(!qn.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Vn(r)}const ic=d("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=qn),M.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{sc(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ac=d("$ZodE164",(e,t)=>{t.pattern??(t.pattern=da),M.init(e,t)});function cc(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const uc=d("$ZodJWT",(e,t)=>{M.init(e,t),e._zod.check=r=>{cc(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Fn=d("$ZodNumber",(e,t)=>{X.init(e,t),e._zod.pattern=e._zod.bag.pattern??Sa,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),lc=d("$ZodNumber",(e,t)=>{wa.init(e,t),Fn.init(e,t)}),pc=d("$ZodNull",(e,t)=>{X.init(e,t),e._zod.pattern=Ea,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{const o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),hc=d("$ZodUnknown",(e,t)=>{X.init(e,t),e._zod.parse=r=>r}),fc=d("$ZodNever",(e,t)=>{X.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Jn(e,t,r){e.issues.length&&t.issues.push(...xe(r,e.issues)),t.value[r]=e.value}const mc=d("$ZodArray",(e,t)=>{X.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const a=o[i],c=t.element._zod.run({value:a,issues:[]},n);c instanceof Promise?s.push(c.then(u=>Jn(u,r,i))):Jn(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function ot(e,t,r,n){e.issues.length&&t.issues.push(...xe(r,e.issues)),e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Mn(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=Oi(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Wn(e,t,r,n,o,s){const i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type;for(const l of Object.keys(t)){if(a.has(l))continue;if(u==="never"){i.push(l);continue}const f=c.run({value:t[l],issues:[]},n);f instanceof Promise?e.push(f.then(m=>ot(m,r,l,t))):ot(f,r,l,t)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}const dc=d("$ZodObject",(e,t)=>{if(X.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const n=Pt(()=>Mn(t));V(e._zod,"propValues",()=>{const a=t.shape,c={};for(const u in a){const l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(const f of l.values)c[u].add(f)}}return c});const o=Qe,s=t.catchall;let i;e._zod.parse=(a,c)=>{i??(i=n.value);const u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};const l=[],f=i.shape;for(const m of i.keys){const C=f[m]._zod.run({value:u[m],issues:[]},c);C instanceof Promise?l.push(C.then(_=>ot(_,a,m,u))):ot(C,a,m,u)}return s?Wn(l,u,a,c,n.value,e):l.length?Promise.all(l).then(()=>a):a}}),gc=d("$ZodObjectJIT",(e,t)=>{dc.init(e,t);const r=e._zod.parse,n=Pt(()=>Mn(t)),o=m=>{const g=new qa(["shape","payload","ctx"]),C=n.value,_=T=>{const U=Pn(T);return`shape[${U}]._zod.run({ value: input[${U}], issues: [] }, ctx)`};g.write("const input = payload.value;");const O=Object.create(null);let D=0;for(const T of C.keys)O[T]=`key_${D++}`;g.write("const newResult = {};");for(const T of C.keys){const U=O[T],Q=Pn(T);g.write(`const ${U} = ${_(T)};`),g.write(`
4
+ if (${U}.issues.length) {
5
+ payload.issues = payload.issues.concat(${U}.issues.map(iss => ({
6
6
  ...iss,
7
7
  path: iss.path ? [${Q}, ...iss.path] : [${Q}]
8
8
  })));
9
9
  }
10
10
 
11
11
 
12
- if (${B}.value === undefined) {
12
+ if (${U}.value === undefined) {
13
13
  if (${Q} in input) {
14
14
  newResult[${Q}] = undefined;
15
15
  }
16
16
  } else {
17
- newResult[${Q}] = ${B}.value;
17
+ newResult[${Q}] = ${U}.value;
18
18
  }
19
19
 
20
- `)}g.write("payload.value = newResult;"),g.write("return payload;");const K=g.compile();return(L,B)=>K(d,L,B)};let s;const i=He,a=!gn.jitless,u=a&&vi.value,l=t.catchall;let f;e._zod.parse=(d,g)=>{f??(f=n.value);const P=d.value;return i(P)?a&&u&&g?.async===!1&&g.jitless!==!0?(s||(s=o(t.shape)),d=s(d,g),l?xn([],P,d,g,f,e):d):r(d,g):(d.issues.push({expected:"object",code:"invalid_type",input:P,inst:e}),d)}});function Tn(e,t,r,n){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!ze(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>be(i,n,ge())))}),t)}const sc=m("$ZodUnion",(e,t)=>{G.init(e,t),V(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),V(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),V(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),V(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>wt(s.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(r)return n(o,s);let i=!1;const a=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(c=>Tn(c,o,e,s)):Tn(a,o,e,s)}}),ic=m("$ZodIntersection",(e,t)=>{G.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>qn(r,c,u)):qn(r,s,i)}});function Ot(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Oe(e)&&Oe(t)){const r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};for(const s of n){const i=Ot(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=e[n],s=t[n],i=Ot(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function qn(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),ze(e))return e;const n=Ot(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const ac=m("$ZodRecord",(e,t)=>{G.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Oe(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;const s=[];if(t.keyType._zod.values){const i=t.keyType._zod.values;r.value={};for(const c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){const u=t.valueType._zod.run({value:o[c],issues:[]},n);u instanceof Promise?s.push(u.then(l=>{l.issues.length&&r.issues.push(...Le(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(...Le(c,u.issues)),r.value[c]=u.value)}let a;for(const c in o)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{r.value={};for(const i of Reflect.ownKeys(o)){if(i==="__proto__")continue;const a=t.keyType._zod.run({value:i,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(u=>be(u,n,ge())),input:i,path:[i],inst:e}),r.value[a.value]=a.value;continue}const c=t.valueType._zod.run({value:o[i],issues:[]},n);c instanceof Promise?s.push(c.then(u=>{u.issues.length&&r.issues.push(...Le(i,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...Le(i,c.issues)),r.value[a.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}}),cc=m("$ZodEnum",(e,t)=>{G.init(e,t);const r=mi(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>bi.has(typeof o)).map(o=>typeof o=="string"?Ne(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),uc=m("$ZodLiteral",(e,t)=>{if(G.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Ne(r):r?Ne(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,n)=>{const o=r.value;return e._zod.values.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),lc=m("$ZodTransform",(e,t)=>{G.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mn(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new Pe;return r.value=o,r}});function Zn(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const pc=m("$ZodOptional",(e,t)=>{G.init(e,t),e._zod.optin="optional",e._zod.optout="optional",V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),V(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${wt(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Zn(s,r.value)):Zn(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),hc=m("$ZodNullable",(e,t)=>{G.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${wt(r.source)}|null)$`):void 0}),V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),fc=m("$ZodDefault",(e,t)=>{G.init(e,t),e._zod.optin="optional",V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>jn(s,t)):jn(o,t)}});function jn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const dc=m("$ZodPrefault",(e,t)=>{G.init(e,t),e._zod.optin="optional",V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),mc=m("$ZodNonOptional",(e,t)=>{G.init(e,t),V(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Dn(s,e)):Dn(o,e)}});function Dn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const gc=m("$ZodCatch",(e,t)=>{G.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>be(i,n,ge()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(s=>be(s,n,ge()))},input:r.value}),r.issues=[]),r)}}),vc=m("$ZodPipe",(e,t)=>{G.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>rt(i,t.in,n)):rt(s,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>rt(s,t.out,n)):rt(o,t.out,n)}});function rt(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const bc=m("$ZodReadonly",(e,t)=>{G.init(e,t),V(e._zod,"propValues",()=>t.innerType._zod.propValues),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Un):Un(o)}});function Un(e){return e.value=Object.freeze(e.value),e}const _c=m("$ZodCustom",(e,t)=>{se.init(e,t),G.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>Bn(s,r,n,e));Bn(o,r,n,e)}});function Bn(e,t,r,n){if(!e){const o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Ze(o))}}class yc{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Sc(){return new yc}const nt=Sc();function Ec(e,t){return new e({type:"string",...$(t)})}function $c(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...$(t)})}function Vn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...$(t)})}function Ac(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...$(t)})}function Rc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...$(t)})}function wc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...$(t)})}function Ic(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...$(t)})}function Fn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...$(t)})}function kc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...$(t)})}function Cc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...$(t)})}function Pc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...$(t)})}function Oc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...$(t)})}function Nc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...$(t)})}function zc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...$(t)})}function Lc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...$(t)})}function xc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...$(t)})}function Tc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...$(t)})}function qc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...$(t)})}function Zc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...$(t)})}function jc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...$(t)})}function Dc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...$(t)})}function Uc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...$(t)})}function Bc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...$(t)})}function Vc(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...$(t)})}function Fc(e,t){return new e({type:"string",format:"date",check:"string_format",...$(t)})}function Jc(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...$(t)})}function Mc(e,t){return new e({type:"string",format:"duration",check:"string_format",...$(t)})}function Wc(e,t){return new e({type:"number",checks:[],...$(t)})}function Gc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...$(t)})}function Xc(e,t){return new e({type:"null",...$(t)})}function Hc(e){return new e({type:"unknown"})}function Yc(e,t){return new e({type:"never",...$(t)})}function Jn(e,t){return new Cn({check:"less_than",...$(t),value:e,inclusive:!1})}function Nt(e,t){return new Cn({check:"less_than",...$(t),value:e,inclusive:!0})}function Mn(e,t){return new Pn({check:"greater_than",...$(t),value:e,inclusive:!1})}function zt(e,t){return new Pn({check:"greater_than",...$(t),value:e,inclusive:!0})}function Wn(e,t){return new fa({check:"multiple_of",...$(t),value:e})}function Gn(e,t){return new ma({check:"max_length",...$(t),maximum:e})}function ot(e,t){return new ga({check:"min_length",...$(t),minimum:e})}function Xn(e,t){return new va({check:"length_equals",...$(t),length:e})}function Kc(e,t){return new ba({check:"string_format",format:"regex",...$(t),pattern:e})}function Qc(e){return new _a({check:"string_format",format:"lowercase",...$(e)})}function eu(e){return new ya({check:"string_format",format:"uppercase",...$(e)})}function tu(e,t){return new Sa({check:"string_format",format:"includes",...$(t),includes:e})}function ru(e,t){return new Ea({check:"string_format",format:"starts_with",...$(t),prefix:e})}function nu(e,t){return new $a({check:"string_format",format:"ends_with",...$(t),suffix:e})}function je(e){return new Aa({check:"overwrite",tx:e})}function ou(e){return je(t=>t.normalize(e))}function su(){return je(e=>e.trim())}function iu(){return je(e=>e.toLowerCase())}function au(){return je(e=>e.toUpperCase())}function cu(e,t,r){return new e({type:"array",element:t,...$(r)})}function uu(e,t,r){const n=$(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function lu(e,t,r){return new e({type:"custom",check:"custom",fn:t,...$(r)})}function pu(e){const t=hu(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Ze(n,r.value,t._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(Ze(o))}},e(r.value,r)));return t}function hu(e,t){const r=new se({check:"custom",...$(t)});return r._zod.check=e,r}const fu=m("ZodISODateTime",(e,t)=>{Za.init(e,t),X.init(e,t)});function du(e){return Vc(fu,e)}const mu=m("ZodISODate",(e,t)=>{ja.init(e,t),X.init(e,t)});function gu(e){return Fc(mu,e)}const vu=m("ZodISOTime",(e,t)=>{Da.init(e,t),X.init(e,t)});function bu(e){return Jc(vu,e)}const _u=m("ZodISODuration",(e,t)=>{Ua.init(e,t),X.init(e,t)});function yu(e){return Mc(_u,e)}const ae=m("ZodError",(e,t)=>{En.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Ci(e,r)},flatten:{value:r=>ki(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,$t,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,$t,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Su=kt(ae),Eu=Ct(ae),$u=Ke(ae),Au=Qe(ae),Ru=Ni(ae),wu=zi(ae),Iu=Li(ae),ku=xi(ae),Cu=Ti(ae),Pu=qi(ae),Ou=Zi(ae),Nu=ji(ae),H=m("ZodType",(e,t)=>(G.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Re(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>ve(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>Su(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>$u(e,r,n),e.parseAsync=async(r,n)=>Eu(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Au(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Ru(e,r,n),e.decode=(r,n)=>wu(e,r,n),e.encodeAsync=async(r,n)=>Iu(e,r,n),e.decodeAsync=async(r,n)=>ku(e,r,n),e.safeEncode=(r,n)=>Cu(e,r,n),e.safeDecode=(r,n)=>Pu(e,r,n),e.safeEncodeAsync=async(r,n)=>Ou(e,r,n),e.safeDecodeAsync=async(r,n)=>Nu(e,r,n),e.refine=(r,n)=>e.check($l(r,n)),e.superRefine=r=>e.check(Al(r)),e.overwrite=r=>e.check(je(r)),e.optional=()=>he(e),e.nullable=()=>so(e),e.nullish=()=>he(so(e)),e.nonoptional=r=>gl(e,r),e.array=()=>U(e),e.or=r=>pe([e,r]),e.and=r=>il(e,r),e.transform=r=>ao(e,ll(r)),e.default=r=>fl(e,r),e.prefault=r=>ml(e,r),e.catch=r=>bl(e,r),e.pipe=r=>ao(e,r),e.readonly=()=>Sl(e),e.describe=r=>{const n=e.clone();return nt.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return nt.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return nt.get(e);const n=e.clone();return nt.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Hn=m("_ZodString",(e,t)=>{Pt.init(e,t),H.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(Kc(...n)),e.includes=(...n)=>e.check(tu(...n)),e.startsWith=(...n)=>e.check(ru(...n)),e.endsWith=(...n)=>e.check(nu(...n)),e.min=(...n)=>e.check(ot(...n)),e.max=(...n)=>e.check(Gn(...n)),e.length=(...n)=>e.check(Xn(...n)),e.nonempty=(...n)=>e.check(ot(1,...n)),e.lowercase=n=>e.check(Qc(n)),e.uppercase=n=>e.check(eu(n)),e.trim=()=>e.check(su()),e.normalize=(...n)=>e.check(ou(...n)),e.toLowerCase=()=>e.check(iu()),e.toUpperCase=()=>e.check(au())}),zu=m("ZodString",(e,t)=>{Pt.init(e,t),Hn.init(e,t),e.email=r=>e.check($c(Lu,r)),e.url=r=>e.check(Fn(Kn,r)),e.jwt=r=>e.check(Bc(Hu,r)),e.emoji=r=>e.check(kc(Tu,r)),e.guid=r=>e.check(Vn(Yn,r)),e.uuid=r=>e.check(Ac(st,r)),e.uuidv4=r=>e.check(Rc(st,r)),e.uuidv6=r=>e.check(wc(st,r)),e.uuidv7=r=>e.check(Ic(st,r)),e.nanoid=r=>e.check(Cc(qu,r)),e.guid=r=>e.check(Vn(Yn,r)),e.cuid=r=>e.check(Pc(Zu,r)),e.cuid2=r=>e.check(Oc(ju,r)),e.ulid=r=>e.check(Nc(Du,r)),e.base64=r=>e.check(jc(Wu,r)),e.base64url=r=>e.check(Dc(Gu,r)),e.xid=r=>e.check(zc(Uu,r)),e.ksuid=r=>e.check(Lc(Bu,r)),e.ipv4=r=>e.check(xc(Vu,r)),e.ipv6=r=>e.check(Tc(Fu,r)),e.cidrv4=r=>e.check(qc(Ju,r)),e.cidrv6=r=>e.check(Zc(Mu,r)),e.e164=r=>e.check(Uc(Xu,r)),e.datetime=r=>e.check(du(r)),e.date=r=>e.check(gu(r)),e.time=r=>e.check(bu(r)),e.duration=r=>e.check(yu(r))});function p(e){return Ec(zu,e)}const X=m("ZodStringFormat",(e,t)=>{J.init(e,t),Hn.init(e,t)}),Lu=m("ZodEmail",(e,t)=>{Ca.init(e,t),X.init(e,t)}),Yn=m("ZodGUID",(e,t)=>{Ia.init(e,t),X.init(e,t)}),st=m("ZodUUID",(e,t)=>{ka.init(e,t),X.init(e,t)}),Kn=m("ZodURL",(e,t)=>{Pa.init(e,t),X.init(e,t)});function xu(e){return Fn(Kn,e)}const Tu=m("ZodEmoji",(e,t)=>{Oa.init(e,t),X.init(e,t)}),qu=m("ZodNanoID",(e,t)=>{Na.init(e,t),X.init(e,t)}),Zu=m("ZodCUID",(e,t)=>{za.init(e,t),X.init(e,t)}),ju=m("ZodCUID2",(e,t)=>{La.init(e,t),X.init(e,t)}),Du=m("ZodULID",(e,t)=>{xa.init(e,t),X.init(e,t)}),Uu=m("ZodXID",(e,t)=>{Ta.init(e,t),X.init(e,t)}),Bu=m("ZodKSUID",(e,t)=>{qa.init(e,t),X.init(e,t)}),Vu=m("ZodIPv4",(e,t)=>{Ba.init(e,t),X.init(e,t)}),Fu=m("ZodIPv6",(e,t)=>{Va.init(e,t),X.init(e,t)}),Ju=m("ZodCIDRv4",(e,t)=>{Fa.init(e,t),X.init(e,t)}),Mu=m("ZodCIDRv6",(e,t)=>{Ja.init(e,t),X.init(e,t)}),Wu=m("ZodBase64",(e,t)=>{Ma.init(e,t),X.init(e,t)}),Gu=m("ZodBase64URL",(e,t)=>{Ga.init(e,t),X.init(e,t)}),Xu=m("ZodE164",(e,t)=>{Xa.init(e,t),X.init(e,t)}),Hu=m("ZodJWT",(e,t)=>{Ya.init(e,t),X.init(e,t)}),Qn=m("ZodNumber",(e,t)=>{Nn.init(e,t),H.init(e,t),e.gt=(n,o)=>e.check(Mn(n,o)),e.gte=(n,o)=>e.check(zt(n,o)),e.min=(n,o)=>e.check(zt(n,o)),e.lt=(n,o)=>e.check(Jn(n,o)),e.lte=(n,o)=>e.check(Nt(n,o)),e.max=(n,o)=>e.check(Nt(n,o)),e.int=n=>e.check(to(n)),e.safe=n=>e.check(to(n)),e.positive=n=>e.check(Mn(0,n)),e.nonnegative=n=>e.check(zt(0,n)),e.negative=n=>e.check(Jn(0,n)),e.nonpositive=n=>e.check(Nt(0,n)),e.multipleOf=(n,o)=>e.check(Wn(n,o)),e.step=(n,o)=>e.check(Wn(n,o)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function eo(e){return Wc(Qn,e)}const Yu=m("ZodNumberFormat",(e,t)=>{Ka.init(e,t),Qn.init(e,t)});function to(e){return Gc(Yu,e)}const Ku=m("ZodNull",(e,t)=>{Qa.init(e,t),H.init(e,t)});function it(e){return Xc(Ku,e)}const Qu=m("ZodUnknown",(e,t)=>{ec.init(e,t),H.init(e,t)});function ro(){return Hc(Qu)}const el=m("ZodNever",(e,t)=>{tc.init(e,t),H.init(e,t)});function tl(e){return Yc(el,e)}const rl=m("ZodArray",(e,t)=>{rc.init(e,t),H.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(ot(r,n)),e.nonempty=r=>e.check(ot(1,r)),e.max=(r,n)=>e.check(Gn(r,n)),e.length=(r,n)=>e.check(Xn(r,n)),e.unwrap=()=>e.element});function U(e,t){return cu(rl,e,t)}const nl=m("ZodObject",(e,t)=>{oc.init(e,t),H.init(e,t),V(e,"shape",()=>t.shape),e.keyof=()=>De(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ro()}),e.loose=()=>e.clone({...e._zod.def,catchall:ro()}),e.strict=()=>e.clone({...e._zod.def,catchall:tl()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>$i(e,r),e.safeExtend=r=>Ai(e,r),e.merge=r=>Ri(e,r),e.pick=r=>Si(e,r),e.omit=r=>Ei(e,r),e.partial=(...r)=>wi(oo,e,r[0]),e.required=(...r)=>Ii(io,e,r[0])});function I(e,t){const r={type:"object",shape:e??{},...$(t)};return new nl(r)}const ol=m("ZodUnion",(e,t)=>{sc.init(e,t),H.init(e,t),e.options=t.options});function pe(e,t){return new ol({type:"union",options:e,...$(t)})}const sl=m("ZodIntersection",(e,t)=>{ic.init(e,t),H.init(e,t)});function il(e,t){return new sl({type:"intersection",left:e,right:t})}const al=m("ZodRecord",(e,t)=>{ac.init(e,t),H.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function no(e,t,r){return new al({type:"record",keyType:e,valueType:t,...$(r)})}const Lt=m("ZodEnum",(e,t)=>{cc.init(e,t),H.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{const s={};for(const i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Lt({...t,checks:[],...$(o),entries:s})},e.exclude=(n,o)=>{const s={...t.entries};for(const i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Lt({...t,checks:[],...$(o),entries:s})}});function De(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Lt({type:"enum",entries:r,...$(t)})}const cl=m("ZodLiteral",(e,t)=>{uc.init(e,t),H.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function M(e,t){return new cl({type:"literal",values:Array.isArray(e)?e:[e],...$(t)})}const ul=m("ZodTransform",(e,t)=>{lc.init(e,t),H.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mn(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(Ze(s,r.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(Ze(i))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function ll(e){return new ul({type:"transform",transform:e})}const oo=m("ZodOptional",(e,t)=>{pc.init(e,t),H.init(e,t),e.unwrap=()=>e._zod.def.innerType});function he(e){return new oo({type:"optional",innerType:e})}const pl=m("ZodNullable",(e,t)=>{hc.init(e,t),H.init(e,t),e.unwrap=()=>e._zod.def.innerType});function so(e){return new pl({type:"nullable",innerType:e})}const hl=m("ZodDefault",(e,t)=>{fc.init(e,t),H.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fl(e,t){return new hl({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():yn(t)}})}const dl=m("ZodPrefault",(e,t)=>{dc.init(e,t),H.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ml(e,t){return new dl({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():yn(t)}})}const io=m("ZodNonOptional",(e,t)=>{mc.init(e,t),H.init(e,t),e.unwrap=()=>e._zod.def.innerType});function gl(e,t){return new io({type:"nonoptional",innerType:e,...$(t)})}const vl=m("ZodCatch",(e,t)=>{gc.init(e,t),H.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function bl(e,t){return new vl({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const _l=m("ZodPipe",(e,t)=>{vc.init(e,t),H.init(e,t),e.in=t.in,e.out=t.out});function ao(e,t){return new _l({type:"pipe",in:e,out:t})}const yl=m("ZodReadonly",(e,t)=>{bc.init(e,t),H.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Sl(e){return new yl({type:"readonly",innerType:e})}const co=m("ZodCustom",(e,t)=>{_c.init(e,t),H.init(e,t)});function El(e,t){return uu(co,e??(()=>!0),t)}function $l(e,t={}){return lu(co,e,t)}function Al(e){return pu(e)}var E=(e=>(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))(E||{});const Rl=pe([M("book"),M("bookitem"),M("conference"),M("document"),M("report"),M("proceeding"),M("unknown")]),wl=pe([M("article"),M("conference"),M("issue"),M("journal"),M("preprint"),M("proceeding"),M("unknown")]),fe=I({artnum:p(),atitle:p(),aufirst:p(),aulast:p(),auinit:p(),auinit1:p(),auinitm:p(),ausuffix:p(),au:U(p()),aucorp:p(),bici:p(),btitle:p(),chron:p(),coden:p(),date:p(),edition:p(),eissn:p(),epage:p(),externalDBID:p(),externalDocID:p(),genre:De(E),id:p(),isbn:p(),issn:p(),issue:p(),jtitle:p(),pages:p(),part:p(),place:p(),pub:p(),quarter:p(),rft_id:U(p()),series:p(),sici:p(),spage:p(),ssn:p(),stitle:p(),title:p(),tpages:p(),volume:p()}).partial(),xt=I({bibid:p(),doi:p(),uri:p()}).partial(),Il=fe.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(),kl=fe.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(),Cl=fe.pick({au:!0,date:!0,isbn:!0,pub:!0,title:!0}).partial(),Pl=fe.pick({au:!0,date:!0,pub:!0,title:!0}).partial(),Ol=fe.pick({au:!0,date:!0,pub:!0,title:!0,spage:!0,epage:!0}).partial(),Nl=fe.pick({au:!0,date:!0,title:!0}).partial(),uo=I({...fe.shape,...xt.shape}),Y=(e,t)=>({...t,genre:e}),j=(e,t)=>({...t,genre:e}),de=e=>({...e,genre:E.AudioVisualDocument}),lo=e=>({...e,genre:E.Image}),po=e=>({...e,genre:E.Document}),at=e=>({...e,genre:E.Webpage}),ho=e=>Object.keys(e.shape),fo=ho(fe),Tt=ho(xt),zl=(e,t,r)=>{if(r.length>0&&typeof r[0]=="string"){const n=t.startsWith("rft_")?t:`rft.${t}`;e.append(n,r[0])}},Ll=(e,t,r)=>{e.append(t,r)},xl=(e,t,r)=>{e.append(`rft.${t}`,r)},mo=e=>Tt.includes(e),go=e=>{const t=new URLSearchParams;return Object.entries(e).forEach(([r,n])=>{Array.isArray(n)?zl(t,r,n):typeof n=="string"&&n&&(mo(r)?Ll(t,r,n):xl(t,r,n))}),t},vo=(e,t,r,n)=>{const o=t.getAll(r).filter(s=>!!s).map(s=>s.trim());return o.length===0?e:{...e,[n]:o}},bo=e=>{const t=Tl(e),r=(o,s)=>{if(s==="au")return vo(o,t,"rft.au","au");if(s==="rft_id")return vo(o,t,"rft_id","rft_id");const i=mo(s)?s:`rft.${s}`,a=t.get(i);return a?{...o,[s]:a.trim()}:o},n=[...fo,...Tt].reduce(r,{});return Object.keys(n).length===0?null:n},Tl=e=>URL.canParse(e)?new URL(e).searchParams:new URLSearchParams(e);function ql(e){return typeof e!="string"?!1:Object.values(E).includes(e)}var _e=(e=>(e.CA="CA",e.EUAPAC="EUAPAC",e))(_e||{});const qt=I({id:p(),name:p(),region:De(_e)}),Zl=I({tenants:U(qt)}),_o=9*1024*1024,yo=I({url:xu({error:e=>e.input===void 0?'should have the required string property "url"':'"url" must be a string'}),html:p({error:e=>e.input===void 0?'should have the required string property "html"':void 0}).max(_o,{error:`"html" should be a string with a MAX Length of ${_o}`}),tenantCode:p({error:e=>e.input===void 0?'should have the required string property "tenantCode"':void 0}).min(1,{error:'"tenantCode" must be a string'}),region:De([_e.EUAPAC,_e.CA],{error:e=>e.input===void 0?'should have the required string property "region"':'"region" must be a string of EUAPAC or CA'})});function jl(e){return yo.safeParse(e).success}const Zt=I({name:p(),region:De(_e),apps:no(p(),p())}),So=no(p(),Zt),Eo=e=>Zt.safeParse(e).success,$o=e=>So.safeParse(e).success;function Ao(e){return qt.safeParse(e).success}function Dl(e){return typeof e=="string"&&Object.keys(_e).includes(e)}const Ul=e=>{if(!$o(e))throw new Error("Error: the customer list data is invalid.");return{tenants:Object.entries(e).map(([r,n])=>Bl(r,n))}},Bl=(e,t)=>{if(!Eo(t))throw new Error(`Invalid customer: ${t}`);const{name:r,region:n}=t,o={id:e,name:r,region:n};if(!Ao(o))throw new Error(`Invalid tenant: ${JSON.stringify(o)}`);return o},jt=I({parserType:p(),parserName:p().nullable(),uri:p(),referrer:p()}),Dt=I({parserType:p(),parserName:p().nullable(),referrer:p()}),Ut=I({bookmarkingWorkflowUrl:it(),resource:it()}),Bt=I({bookmarkingWorkflowUrl:p(),resource:it()}),Vt=I({bookmarkingWorkflowUrl:it(),resource:uo}),Ft=I({z3988SearchResult:M(!0)}),Jt=I({summonSearchResult:M(!0)}),ct=pe([Bt,Ut,Vt,Ft,Jt]),Ro=I({meta:jt}).and(ct),wo=I({meta:Dt}).and(ct);function Vl(e){return{bookmarkingWorkflowUrl:e,resource:null}}function q(){return{bookmarkingWorkflowUrl:null,resource:null}}function A(e){return{bookmarkingWorkflowUrl:null,resource:e}}function Io(){return{z3988SearchResult:!0}}function ko(){return{summonSearchResult:!0}}const Fl=e=>{const t=e.getAttribute("title");return t?bo(t):null},Mt=({document:e})=>{const t=Array.from(e.querySelectorAll(".Z3988"));if(t.length===0)return q();const r=t.map(Fl).find(n=>n!==null);return r?A(r):q()},Jl=e=>{const t=Array.from(e.querySelectorAll(".author > a")).map(r=>r.textContent.trim()).filter(Boolean);return t.length?t:void 0},Ml=e=>e.querySelector("#rpi-attribute-book_details-edition > .rpi-attribute-value > span")?.textContent??void 0,Wl=e=>{const t=e.querySelector("#rpi-attribute-book_details-isbn10 > .rpi-attribute-value > span")?.textContent??void 0,r=e.querySelector("#rpi-attribute-book_details-isbn13 > .rpi-attribute-value > span")?.textContent??void 0;if(t&&r)return`${t},${r}`;if(t)return t;if(r)return r},Gl=e=>e.querySelector("#rpi-attribute-book_details-publication_date > .rpi-attribute-value > span")?.textContent??void 0,Xl=e=>e.querySelector("#rpi-attribute-book_details-publisher > .rpi-attribute-value > span")?.textContent??void 0,Hl=e=>e.querySelector("#rpi-attribute-book_details-series > .rpi-attribute-value > a")?.textContent??void 0,Yl=e=>{const 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},Kl=({url:e,document:t})=>{const r=Jl(t),n=Ml(t),o=Wl(t),s=Gl(t),i=Xl(t),a=Hl(t),c=t.getElementById("productTitle")?.textContent.trim()??void 0,u=Yl(t);return{bookmarkingWorkflowUrl:null,resource:Y(E.Book,{au:r,date:s,edition:n,isbn:o,pub:i,series:a,title:c,tpages:u,uri:e})}},me=e=>{if(e)return e.replace(/[^0-9]/g,"")},Co=e=>Array.from(e.querySelectorAll(".author-source-list li a")).filter(t=>t.childNodes.length>0).map(t=>t.childNodes[0].textContent?.trim()).filter(t=>!!t),Po=e=>e.querySelector(".article-header")?.querySelector("h1 span")?.textContent.trim(),Oo=e=>({date:e?.textContent.match(/\d{4}/)?.[0],pub:"Elsevier Inc."}),Ql=e=>{const t=e.querySelector(".article-meta");if(!t)return{};const r=t.querySelector(".issue")?.textContent??void 0,n=t.querySelector(".title")?.textContent.trim()??void 0,[o,s]=(r?.split(",")??[]).map(i=>i.trim());return{volume:me(o),issue:me(s),jtitle:n}},ep=e=>{const t=e.querySelector(".article-header .source")?.textContent,r=t?.match(/\d{4}-\d{2}-\d{2}/)?.[0],n=t?.match(/Pages (\d+-\d+)/),[o,s]=(n?.[1].split("-")??[]).map(u=>u.trim()),{jtitle:i,volume:a,issue:c}=Ql(e);return A(j(E.Article,{au:Co(e),atitle:Po(e),spage:o,epage:s,date:r,jtitle:i,volume:a,issue:c}))},tp=e=>{const[t,r]=e.querySelectorAll(".source"),{date:n,pub:o}=Oo(r),s=e.querySelector(".browse__book-toc"),[i,a]=(s?.querySelector("h1")?.textContent.split(",")??[]).map(c=>c.trim());return A(Y(E.Book,{btitle:i,edition:a,pub:o,au:t.textContent?[t.textContent]:void 0,date:n}))},rp=e=>{const t=e.querySelector(".article-meta");if(!t)return{};const r=t.querySelector(".edition")?.textContent??void 0,n=t.querySelector(".title")?.textContent.trim()??void 0,o=t.querySelector(".copyright"),{date:s,pub:i}=Oo(o);return{edition:r,btitle:n,date:s,pub:i}},np=e=>{const{edition:t,btitle:r,date:n,pub:o}=rp(e),s=e.querySelector(".article-header .source")?.textContent,i=/(\d+-\d+|[IVXLCDM]+-[IVXLCDM]+)/i,a=s?.match(i),[c,u]=(a?.[1].split("-")??[]).map(l=>l.trim());return A(Y(E.Bookitem,{au:Co(e),atitle:Po(e),btitle:r,edition:t,pub:o,date:n,spage:c,epage:u}))},op=/^[0-9X]$/,Wt=e=>{if(!e)return;let t="";for(const r of e)op.test(r)&&(t+=r);if(t)return t},sp=(e,t)=>{const r=e.querySelector(".c-cksc-content-header__title")?.textContent.trim(),n=e.querySelector(".c-cksc-content-nice__button")?.textContent.trim(),o=e.querySelector(".c-cksc-content-nice__date")?.textContent.trim(),s=e.evaluate('//p[contains(text(), "ISBN")]',e,null,XPathResult.ANY_TYPE),i=Wt(s.iterateNext()?.textContent);return A({genre:E.Document,title:r,pub:n,date:o,uri:t,isbn:i})},No=e=>e.querySelector(".browse-toc")??e.querySelector(".browse__journal"),ip=e=>No(e)?.querySelector("h1")?.firstElementChild?.textContent.trim(),ap=e=>{const t=No(e),r=t?.querySelector("figure figcaption.source");if(r){const[a,c,u]=r.textContent.split(",").map(l=>l.trim());return{date:a,volume:me(c),issue:me(u)}}const n=t?.querySelector("p")?.textContent,[o,s]=n?.split(",")??[];return{date:t?.querySelector(".source span")?.textContent??void 0,volume:me(o),issue:me(s)}},cp=e=>{const{date:t,volume:r,issue:n}=ap(e);return A(j(E.Journal,{jtitle:ip(e),date:t,volume:r,issue:n}))};var zo=(e=>(e.Book="Book",e.Chapter="Book Chapter",e.Article="Full Text Article",e.Journal="Journal",e.Guideline="Guideline",e))(zo||{});const up=e=>Object.values(zo).includes(e),lp=(e,t)=>{const r=e.querySelector(".content-type")??e.querySelector(".c-cksc-content-header__content-type");if(!r)return t.includes("journal")?"Journal":void 0;const n=r.textContent;if(n&&up(n))return n},pp=({url:e,document:t})=>{switch(lp(t,e)){case"Book":return tp(t);case"Book Chapter":return np(t);case"Full Text Article":return ep(t);case"Journal":return cp(t);case"Guideline":return sp(t,e);case void 0:return q()}},we=I({"@context":p()}),hp=e=>we.safeParse(e).success,Lo='script[type="application/ld+json"]',xo=e=>Array.from(e.querySelectorAll(Lo)),ut=e=>e.querySelector(Lo),Ue=e=>{const t=e.textContent;if(!t)return null;try{const r=JSON.parse(t);if(hp(r))return r}catch{return null}return null},fp=I({"@id":p(),"@type":p(),author:I({"@id":p()}).optional(),datePublished:p().optional(),dateModified:p().optional(),description:p().optional(),inLanguage:p().optional(),isPartOf:I({"@id":p()}).optional(),name:p().optional(),url:p().optional()}),dp=we.extend({"@graph":U(fp)}),mp=e=>dp.safeParse(e).success,gp=e=>{const t=xo(e);if(t.length===0)return null;const r=t.map(Ue).filter(mp).map(n=>n["@graph"]);return r.length!==1?null:r[0]},vp=(e,t)=>e.find(r=>r["@type"]===t)??null,bp=(e,t)=>e.find(r=>r["@id"]===t)??null,_p=e=>{const t=vp(e,"WebPage");if(!t)return null;const r=t.author?bp(e,t.author["@id"]):void 0;return at({au:r?.name?[r.name]:void 0,date:t.datePublished,title:t.name})},yp=({document:e})=>{const t=gp(e);return t?{bookmarkingWorkflowUrl:null,resource:_p(t)}:q()},To=()=>q(),h=(e,t,r)=>{const n=re(e,t,r);return n.length>0?n[0]:void 0},re=(e,t,r)=>Array.from(e.querySelectorAll(`meta[${t}='${r}']`)).map(n=>n.getAttribute("content")).filter(n=>!!n?.trim()),qo=e=>{const t=new Map,r=e.split(";").filter(n=>!!n);for(const n of r){const[o,s,i]=n.split(":");t.set(o,{type:s,value:i})}return t},Sp=e=>{const{pathname:t}=new URL(e);return t.startsWith("/toc/")?"journal":t.startsWith("/article/")?"article":void 0},Ep=e=>{const t=e.querySelector("header h1 span")?.firstChild?.textContent?.trim(),r=e.querySelector("header p span")?.textContent.trim(),n=/\d{4}-\d{3}[\dX]/g,o=r?.match(n)??[],[s,i]=[o[0],o[1]],a=e.evaluate('//dt[contains(text(), "Publisher")]/following-sibling::dd/a',e,null,XPathResult.STRING_TYPE).stringValue.trim();return A(j(E.Journal,{pub:a,jtitle:t,issn:s,eissn:i}))},$p=e=>{let t,r;const n=re(e,"name","citation_issn");return n.length===2?(t=n[1],r=n[0]):t=n[0],{eissn:t,issn:r}},Ap=e=>{const t=h(e,"name","citation_journal_title"),r=h(e,"name","citation_title"),n=re(e,"name","citation_author"),o=h(e,"name","citation_doi"),{eissn:s,issn:i}=$p(e),a=h(e,"name","citation_publisher"),c=h(e,"name","citation_publication_date"),u=h(e,"name","citation_volume"),l=h(e,"name","citation_issue"),f=h(e,"name","citation_firstpage"),d=h(e,"name","citation_lastpage");return A(j(E.Article,{jtitle:t,atitle:r,au:n,doi:o,eissn:s,issn:i,pub:a,date:c,volume:u,issue:l,spage:f,epage:d}))},Rp=({document:e,url:t})=>{switch(Sp(t)){case"journal":return Ep(e);case"article":return Ap(e);case void 0:return q()}};var S=(e=>(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))(S||{});const wp=e=>{const t=h(e,"name","pbContext");if(!t)return S.None;const r=qo(t);switch(r.has("page")?r.get("page")?.value:null){case"Article/Chapter View":return S.Article;case"Table of Contents":return S.Journal;default:return S.None}},Ip=e=>{const t=e.querySelector('meta[property="article:author"]')?.getAttribute("content")?.split(",").map(r=>r.trim());return t&&t.length>0?t:void 0},Zo=e=>{const t=new Map,r=Array.from(e.querySelectorAll(".rlist>li>span")).map(s=>s.textContent.trim()).join(""),n=/^ISSN:\s(\d{4}-\d{3}(?:\d|X))/.exec(r);n&&t.set("issn",n[1]);const o=/Online ISSN:\s(\d{4}-\d{3}(?:\d|X))/.exec(r);return o&&t.set("eissn",o[1]),t},kp=e=>e.querySelector('span[property="isPartOf"][typeof="PublicationVolume"] > span[property="volumeNumber"]')?.textContent??void 0,Cp=e=>e.querySelector('span[property="isPartOf"][typeof="PublicationIssue"] > span[property="issueNumber"]')?.textContent??void 0,Pp=e=>e.querySelector('meta[name="dc.Identifier"][scheme="doi"]')?.getAttribute("content")??void 0,Op=e=>e.querySelector("h1")?.textContent??void 0,Np=e=>{const t=new Map,r=e.querySelector("h2.heading-m")?.textContent,n=r?.match(/Issue\s+(\d+(?:-\d+)?)/);n&&t.set("issue",n[1]);const o=r?.match(/Volume\s+(\d+)/);o&&t.set("volume",o[1]);const s=r?.match(/(\d{4})$/);return s&&t.set("date",s[1]),t},zp=e=>{const t=Ip(e.document),r=h(e.document,"name","dc.Date"),n=Pp(e.document),o=Zo(e.document),s=o.get("issn"),i=o.get("eissn"),a=Cp(e.document),c=h(e.document,"name","citation_journal_title"),u=h(e.document,"name","dc.Publisher"),l=h(e.document,"name","dc.Title"),f=kp(e.document);return j(E.Article,{au:t,date:r,eissn:i,issn:s,issue:a,jtitle:c,pub:u,title:l,volume:f,doi:n})},Lp=e=>{const t=Zo(e.document),r=t.get("issn"),n=t.get("eissn"),o=Op(e.document),s=Np(e.document),i=s.get("issue"),a=s.get("volume"),c=s.get("date");return j(E.Journal,{eissn:n,issn:r,jtitle:o,title:o,issue:i,volume:a,date:c})},xp=e=>{switch(wp(e.document)){case S.Article:return A(zp(e));case S.Journal:return A(Lp(e));default:return q()}},Tp=e=>{const t=h(e,"name","citation_type"),r=h(e,"name","citation_article_type");return t==="JOUR"&&r?S.Article:t==="CHP"?S.Chapter:e.querySelector(".book-edition-year")?.textContent.includes("Book")?S.Book:e.getElementById("journal-title")?S.Journal:S.None},Gt=e=>h(e,"name","citation_doi")??h(e,"name","dc.identifier")??e.querySelector(".doi .anchor-text")?.textContent??void 0,qp=e=>{const t=Array.from(e.querySelectorAll(".kf-details .kf-detail-item:has(h3)")),r=new Map;for(const n of t){const o=n.querySelector("h3")?.textContent,s=n.querySelector("p")?.textContent;o&&s&&r.set(o,s)}return r},Xt=(e,t)=>{const r=Array.from(e.querySelectorAll(t)).map(n=>n.textContent).filter(n=>!!n);return r.length>0?r:void 0},Zp=e=>{const t=e.querySelector(".js-issn")?.textContent;if(t)return t.replace("Online ISSN: ","")},jp=e=>{const t=e.get("DOI");if(t)return URL.canParse(t)?new URL(t).pathname.substring(1):t},Dp=e=>{const t=qp(e),r=h(e,"property","og:title"),n=h(e,"property","og:book:isbn"),o=t.get("Published"),s=Xt(e,".authors-container .author-detail h3"),i=Gt(e)??jp(t);return Y(E.Book,{au:s,date:o,doi:i,isbn:n,title:r})},Up=e=>{const t=h(e,"property","og:title"),r=h(e,"property","og:book:isbn"),n=h(e,"name","citation_publication_date"),o=Xt(e,".author-group .button-link-text"),s=h(e,"name","citation_firstpage"),i=h(e,"name","citation_lastpage"),a=h(e,"name","citation_publisher"),c=Gt(e),u=h(e,"name","citation_inbook_title")??e.querySelector(".publication-title")?.textContent??void 0;return Y(E.Bookitem,{au:o,btitle:u,date:n,doi:c,epage:i,isbn:r,pub:a,spage:s,title:t})},Bp=e=>{const t=h(e,"property","og:title"),r=h(e,"name","citation_issn"),n=h(e,"name","citation_publication_date"),o=Xt(e,".author-group .button-link-text"),s=h(e,"name","citation_publisher"),i=h(e,"name","citation_firstpage"),a=h(e,"name","citation_issue"),c=h(e,"name","citation_volume"),u=Gt(e),l=h(e,"name","citation_journal_title")??e.querySelector(".publication-title")?.textContent??void 0;return j(E.Article,{au:o,jtitle:l,date:n,doi:u,issn:r,issue:a,pub:s,spage:i,title:t,volume:c})},Vp=e=>{const t=e.getElementById("journal-title")?.textContent??void 0,r=Zp(e);return j(E.Journal,{issn:r,title:t})},Fp=({document:e})=>{switch(Tp(e)){case S.Book:return A(Dp(e));case S.Chapter:return A(Up(e));case S.Article:return A(Bp(e));case S.Journal:return A(Vp(e));default:return q()}},Jp=e=>{const t=h(e,"name","pbContext");return t&&qo(t).has("article")?S.Article:S.Journal},Mp=e=>{const t=e.querySelector(".itemPageRangeHistory");if(!t)return;const n=Array.from(t.childNodes).find(o=>o.textContent?.trim().startsWith("Page"));if(n)return n.textContent?.replace(/Pages?/,"").trim()??void 0},Wp=e=>{const t=e.querySelector(".issue-heading")?.textContent;return t?t.split(",")[0]?.replace("Volume","").trim():void 0},Gp=e=>{const t=e.querySelector(".issue-heading .nav-toc-list")?.textContent;return t?t.replace("Issue","").trim():void 0},Xp=e=>{const t=h(e,"property","og:title"),r=h(e,"name","dc.Publisher"),n=h(e,"name","dc.Date"),o=h(e,"name","publication_doi"),s=h(e,"name","citation_journal_title"),i=re(e,"name","dc.Creator"),a=Wp(e),c=Gp(e),u=Mp(e),l=u?.includes("-")?u.split("-")[0]:u,f=u?.includes("-")?u.split("-")[1]:u;return j(E.Article,{au:i,jtitle:s,date:n,doi:o,issue:c,pub:r,spage:l,epage:f,title:t,volume:a})},Hp=e=>{const t=h(e,"property","og:title"),r=h(e,"name","publication_doi");return j(E.Journal,{doi:r,title:t})},Yp=({document:e})=>{switch(Jp(e)){case S.Article:return A(Xp(e));case S.Journal:return A(Hp(e));default:return q()}},Kp=e=>ct.safeParse(e).success,Qp=e=>Ro.safeParse(e).success,eh=e=>wo.safeParse(e).success,th=e=>jt.safeParse(e).success,rh=e=>Dt.safeParse(e).success;function nh(e){return Bt.safeParse(e).success}function lt(e){return Vt.safeParse(e).success}function jo(e){return Ft.safeParse(e).success}function Do(e){return Jt.safeParse(e).success}function oh(e){return Ut.safeParse(e).success}const sh=e=>Array.from(e.querySelectorAll("tr th")).find(n=>n.textContent.trim()==="DOI:")?.nextElementSibling?.querySelector('span[property="identifier"]')?.textContent??void 0,ih=e=>{const t=/Record\/(\d+)/.exec(e);if(t&&t.length>1)return t[1]},ah=e=>{const{url:t,document:r}=e,n=Mt(e);if(!lt(n))return n;const o=sh(r);return o&&(n.resource.rft_id=[`info:doi/${o}`]),n.resource.bibid=ih(t),n},ch=we.extend({"@type":M("VideoObject"),name:p(),author:p(),genre:p(),description:p(),uploadDate:p(),duration:p(),thumbnailUrl:U(p())}),uh=e=>ch.safeParse(e).success,lh=e=>{const t=xo(e);if(t.length===0)return null;const r=t.map(Ue).filter(uh);return r.length!==1?null:r[0]},ph=({url:e,document:t})=>{const r=lh(t);return r?{bookmarkingWorkflowUrl:null,resource:de({au:[r.author],date:r.uploadDate,title:r.name,uri:e})}:q()},Uo=e=>h(e,"name","doi")??h(e,"name","DOI")??h(e,"name","citation_doi")??h(e,"name","dc.identifier")??h(e,"name","prism.doi")??void 0,Bo=e=>{const t=e.editor?.map(o=>o.name)??[],n=[...e.author?.map(o=>o.name)??[],...t];if(n.length!==0)return n};var Be=(e=>(e.Book="Book",e.Journal="Journal",e.Periodical="Periodical",e.PublicationVolume="PublicationVolume",e.ScholarlyArticle="ScholarlyArticle",e.VideoObject="VideoObject",e.WebPage="WebPage",e))(Be||{}),ye=(e=>(e.Article="article",e.Book="book",e.Paper="Paper",e.Video="video.other",e.Website="website",e))(ye||{}),ce=(e=>(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))(ce||{});const Vo=I({"@type":M(Be.ScholarlyArticle),author:U(I({"@type":p(),name:p()})).optional(),editor:U(I({"@type":p(),name:p()})).optional(),datePublished:p().optional(),headline:p().optional(),issn:U(p()).optional(),pageStart:p().optional(),pageEnd:p().optional(),isPartOf:I({"@type":pe([p(),U(p())]),name:p(),issn:U(p()).optional(),volumeNumber:p().optional(),isbn:U(p()).optional()}),publisher:I({"@type":p(),name:p()}).optional()}),Fo=e=>Vo.safeParse(e).success,hh=we.extend({"@type":M(Be.WebPage),mainEntity:Vo}),fh=e=>hh.safeParse(e).success,dh=I({"@type":U(p()),name:p().optional(),issn:U(p()),volumeNumber:p().optional()}),Jo=e=>dh.safeParse(e).success,mh=(e,t)=>h(e,"name","citation_issn")??h(e,"name","prism.issn")??(Fo(t.isPartOf)?t.isPartOf.issn?.[0]:void 0),Mo=(e,t)=>{const r=Bo(t),n=h(e,"name","citation_online_date"),o=Uo(e),s=h(e,"name","citation_issue"),i=mh(e,t),a=Jo(t.isPartOf)&&t.isPartOf.issn.length>0?t.isPartOf.issn[1]:void 0,c=t.pageStart,u=t.pageEnd,l=t.headline,f=t.isPartOf.name,d=Jo(t.isPartOf)?t.isPartOf.volumeNumber:void 0;return j(E.Article,{au:r,date:n,doi:o,issue:s,eissn:i,issn:a,spage:c,epage:u,atitle:l,jtitle:f,volume:d})},gh=we.extend({"@type":M(Be.Book),copyrightYear:p().optional(),author:U(I({"@type":p(),name:p()})).optional(),editor:U(I({"@type":p(),name:p()})).optional(),isbn:p().optional(),name:p().optional(),numberOfPages:eo().optional(),publisher:I({"@type":p(),name:p()}).optional()}),vh=e=>gh.safeParse(e).success,bh=e=>{const t=e.querySelectorAll(".c-bibliographic-information__list-item"),r=new Map;return t.forEach(n=>{const o=n.querySelector(".u-text-bold")?.textContent.trim(),s=n.querySelector(".c-bibliographic-information__value")?.textContent.trim();o&&s&&r.set(o,s)}),r},_h=(e,t)=>{const r=bh(e),n=Bo(t),o=t.copyrightYear?.toString(),s=Uo(e)??r.get("DOI"),i=t.name??r.get("Book Title"),a=t.isbn??r.get("Softcover ISBN"),c=t.numberOfPages?.toString()??r.get("Number of Pages"),u=t.publisher?.name??r.get("Publisher");return Y(E.Book,{au:n,date:o,doi:s,title:i,isbn:a,tpages:c,pub:u})},yh=I({"@type":M("Periodical"),name:p(),url:p(),issn:U(p()),editor:U(I({givenName:p(),familyName:p()})),publisher:I({name:p()}),description:p()}),Sh=e=>yh.safeParse(e).success,Eh=e=>{const t=e.editor.map(({givenName:i,familyName:a})=>`${i} ${a}`),r=e.name,[n,o]=e.issn,s=e.publisher.name;return j(E.Journal,{au:t,jtitle:r,eissn:n,issn:o,pub:s})},$h=I({"@type":M(Be.VideoObject),name:p().optional(),description:p().optional(),thumbnailUrl:p().optional(),uploadDate:p().optional(),contentUrl:p().optional(),duration:p().optional()}),Ah=e=>$h.safeParse(e).success,Rh=(e,t)=>{const r=Array.from(e.querySelectorAll('dd[data-test="video-segment-author"]')).map(i=>i.textContent.trim()).filter(i=>!!i),n=t?.uploadDate?new Date(t.uploadDate).getFullYear().toString():void 0,o=t?.name??h(e,"property","og:title")??void 0,s=e.querySelector("video-about-doi")?.textContent??void 0;return de({au:r.length>0?r:void 0,date:n,doi:s,title:o})},wh=e=>{const t=h(e,"property","og:title");return at({title:t})},Ih=(e,t)=>{const r=h(t,"property","og:type");return r===ye.Article&&e.includes(ce.Article)?S.Article:r===ye.Book&&(e.includes(ce.Book)||e.includes(ce.ReferenceWork))?S.Book:r===ye.Paper&&e.includes(ce.Chapter)?S.Chapter:r===ye.Paper&&(e.includes(ce.ReferenceWorkEntry)||e.includes(ce.Protocol))?S.Article:r===ye.Video&&e.includes(ce.Video)?S.AudioVisual:r===ye.Website&&(e.includes(ce.Collections)||e.includes(ce.JournalIssue))?S.Webpage:r===ye.Website&&e.includes(ce.Journal)?S.Journal:S.None},kh=(e,t,r)=>e===S.AudioVisual&&Ah(r)?A(Rh(t,r)):e===S.Book&&vh(r)?A(_h(t,r)):(e===S.Chapter||e===S.Article)&&Fo(r)?A(Mo(t,r)):e===S.Article&&fh(r)?A(Mo(t,r.mainEntity)):e===S.Journal&&Sh(r)?A(Eh(r)):q(),Ch=({url:e,document:t})=>{const r=Ih(e,t);if(r===S.Webpage)return A(wh(t));const n=ut(t);if(!n)return q();const o=Ue(n);return o?kh(r,t,o):q()},Ph=new Set(["Print ISBN","Online ISBN","DOI","First published","Online ISSN","Print ISSN"]),Oh=I({content:I({item:I({title:p(),"published-date":p()}),group:I({volume:p(),issue:p()}),series:I({title:p(),type:p(),eissn:p()})}).optional()}),Wo=(e,t)=>{if(!e)return;const r=e.indexOf(t);return r>-1?e.substring(0,r):e},Ht=e=>{const r=/\d+/.exec(e);if(r?.[0])return r[0]},Nh=e=>{const t=e.querySelectorAll("script"),n=Array.from(t).find(o=>o.textContent.includes("adobeDataLayerJson"))?.textContent.match(/var adobeDataLayerJson = (\{.*?});/s);if(!(!n||n.length!==2))try{const o=JSON.parse(n[1]);return Oh.parse(o)}catch{return}},zh=(e,t)=>{const r=h(e,"property","og:type"),n=t.includes("epdf");return r==="Book"||r==="books.book"?S.Book:r==="Chapter"?S.Chapter:r==="Journal"?S.Journal:r==="Article"||n?S.Article:S.None},pt=e=>{const t=re(e,"name","citation_author"),r=Array.from(e.querySelectorAll("#product-details-content .product-authors")).map(o=>o.textContent).filter(o=>!!o),n=new Set([...t,...r]);return n.size>0?[...n]:void 0},Lh=e=>{const t=Array.from(e.querySelectorAll("#product-details-content .text-piped p")).map(r=>r.textContent).find(r=>r.endsWith(" pages"));if(t)return Ht(t)},ht=e=>{const t=new Map,r=Array.from(e.querySelectorAll(".journal-info-container .info-block")).flatMap(n=>Array.from(n.querySelectorAll(".info_label")));for(const n of r){const o=n.nextElementSibling;if(!o?.classList.contains("info_value"))continue;const s=Wo(n.textContent,":"),i=Wo(o.textContent,":");!s||!i||Ph.has(s)&&t.set(s,i)}return t},ft=(e,t)=>h(e,"property","books:release_date")??h(e,"name","citation_online_date")??t.get("First published")??void 0,Yt=(e,t)=>h(e,"name","dc.identifier")??h(e,"name","citation_doi")??h(e,"name","publication_doi")??t.get("DOI")??void 0,Go=(e,t)=>{const r=new Set([h(e,"property","books:isbn"),t.get("Print ISBN"),t.get("Online ISBN")].filter(n=>!!n));return r.size>0?[...r].join(","):void 0},xh=e=>{let t,r;const n=e.querySelector(".cover-image__details div:first-of-type");if(n&&n.childNodes.length===2){const[o,s]=n.childNodes;o.textContent&&(t=Ht(o.textContent)),s.textContent&&(r=Ht(s.textContent))}return{volume:t,issue:r}},Th=e=>{const r=Array.from(e.querySelectorAll(".authors .author")).map(n=>n.textContent.trim().replace(",","")).filter(n=>!!n);return r.length>0?r:void 0},qh=e=>{const t=Array.from(e.querySelectorAll(".details-section .details-entry")),r=t.find(i=>i.querySelector(".details-label")?.textContent.trim()==="ISSN"),n=t.find(i=>i.querySelector(".details-label")?.textContent.trim()==="eISSN");let o,s;return r&&(o=r.querySelector(".details-value")?.textContent.trim()),n&&(s=n.querySelector(".details-value")?.textContent.trim()),{issn:o,eissn:s}},Zh=e=>{if(!e?.content?.group)return{volume:void 0,issue:void 0};const t=e.content.group.volume,r=e.content.group.issue;return r==="0"&&t==="0"?{volume:void 0,issue:void 0}:{volume:t,issue:r}},jh=e=>{const n=Array.from(e.querySelectorAll(".details-section .details-entry")).find(i=>i.querySelector(".details-label")?.textContent.trim()==="Pages")?.querySelector(".details-value")?.textContent.trim(),[o,s]=(n?.split("-")??[void 0,void 0]).map(i=>i?.trim());return o?.toLowerCase()==="n/a"&&s?.toLowerCase()==="n/a"?{spage:void 0,epage:void 0}:{spage:o,epage:s}},Dh=e=>{const t=ht(e),r=pt(e),n=h(e,"property","og:title"),o=ft(e,t),s=Yt(e,t),i=Go(e,t),a=Lh(e);return Y(E.Book,{au:r,date:o,doi:s,isbn:i,pages:a,title:n})},Uh=e=>{const t=ht(e),r=pt(e),n=h(e,"name","citation_book_title"),o=ft(e,t),s=Yt(e,t),i=Go(e,t),a=h(e,"name","citation_publisher"),c=h(e,"property","og:title");return Y(E.Bookitem,{au:r,btitle:n,date:o,doi:s,isbn:i,pub:a,title:c})},Bh=e=>{const t=ht(e),r=pt(e),n=ft(e,t),o=t.get("Online ISSN"),s=t.get("Print ISSN"),i=h(e,"property","og:title"),{volume:a,issue:c}=xh(e);return j(E.Journal,{au:r,date:n,eissn:o,issn:s,issue:c,title:i,volume:a})},Vh=e=>{const t=ht(e),r=Nh(e),n=pt(e)??Th(e),o=ft(e,t)??r?.content?.item["published-date"],s=Yt(e,t),{issn:i,eissn:a}=qh(e),{volume:c,issue:u}=Zh(r),l=h(e,"property","og:title")??r?.content?.item.title,f=h(e,"name","citation_journal_title")??r?.content?.series.title,{spage:d,epage:g}=jh(e);return j(E.Article,{au:n,date:o,doi:s,eissn:a,issn:i??h(e,"name","citation_issn"),issue:u,jtitle:f,title:l,volume:c,spage:d,epage:g})},Fh=({document:e,url:t})=>{switch(zh(e,t)){case S.Book:return A(Dh(e));case S.Chapter:return A(Uh(e));case S.Journal:return A(Bh(e));case S.Article:return A(Vh(e));default:return q()}},Jh=e=>{const t=re(e,"name","citation_author");return t.length>0?t:void 0},Mh=({document:e})=>{const t=Jh(e),r=h(e,"name","citation_publication_date"),n=h(e,"name","citation_doi"),o=h(e,"name","citation_isbn"),s=h(e,"name","citation_publisher"),i=h(e,"name","citation_title")??e.title,a=de({au:t,date:r,doi:n,isbn:o,pub:s,title:i});return A(a)},Wh=({document:e})=>Array.from(e.querySelectorAll(".Z3988")).length<=1?q():Io(),Kt=e=>{if(!(!e||e.length===0))return e[0]};function Qt(e,t){const r=t.map(n=>{const o=e.querySelector(n)?.textContent??null;if(o&&o.trim()!=="")return o}).filter(n=>n);return Kt(r)??null}const Ve=(e,t)=>Qt(e,[t])?.trim(),Gh=e=>{const t=e.querySelector(".content-meta-data__authors")?.textContent;if(t)return t.split(/,\s+|\s+and\s+/).filter(r=>!!r)},Xh=e=>{const t=Array.from(e.querySelectorAll('.tombstone-metadata [data-qa="item-authors"]')).map(r=>r.textContent).filter(r=>!!r);return t.length?t:void 0},Hh=e=>{const t=Array.from(e.querySelectorAll('.item-authors [data-qa="item-contributors"], .item-authors [data-qa="item-creators"]')).map(r=>r.textContent).filter(r=>!!r);return t.length?t:void 0},Yh=e=>{const t=Array.from(e.querySelectorAll(".contrib-type-author .name")).map(r=>r.textContent).filter(r=>!!r);return t.length?t:void 0},Ie=e=>{const t=new Set([...Hh(e)??[],...Gh(e)??[],...Yh(e)??[],...Xh(e)??[]]);return t.size?[...t]:void 0},ke=(e,t)=>e.querySelector('[data-qa="published-date"]')?.textContent??e.querySelector(".summary-image")?.textContent??xe(t?.get("date"))??xe(t?.get("copyright date"))??xe(t?.get("published date")),Xo=e=>{const t=e.find(r=>r.startsWith("https://doi.org/"));if(t)return t.replace("https://doi.org/","")},Ho=e=>{const t=e.get("local identifier");if(t?.length)return Xo(t)},Kh=e=>e.querySelector(".doi")?.getAttribute("href")??void 0,xe=e=>{if(e?.length)return e[0]},Ce=e=>{const t=new Map;return Array.from(e.querySelectorAll(".metadata-element, .metadata")).map(r=>{const o=r.querySelector(".metadata-label")?.textContent.trim().toLowerCase(),s=Array.from(r.querySelectorAll(".metadata-value")).map(i=>i.textContent).filter(i=>!!i);return{name:o,values:s}}).forEach(({name:r,values:n})=>{!r||!n.length||t.set(r,n)}),t},Yo=e=>{const t=Ce(e),r=e.querySelector(".summary-journal"),n=Array.from(r?.childNodes??[]),o=n[0]?.textContent??e.querySelector(".journal-link")?.textContent??void 0,s=n[2]?.textContent?.replace(/Published By:\s+?/i,"")??xe(t.get("publisher"))??e.querySelector(".publisher-link")?.textContent??void 0;return{pub:s&&s.trim()!==""?s:void 0,jtitle:o&&o.trim()!==""?o:void 0}},Qh=e=>{const t=Qt(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},dt=e=>me(e.querySelector('[data-qa="page-count"]')?.textContent),Fe=(e,t)=>e.querySelector(".publisher-link")?.textContent??xe(t?.get("publisher")),Se=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,Ee=e=>{if(!URL.canParse(e))return;const t=new URL(e);return t.origin+t.pathname},ef=e=>{const t=e.querySelector(".ccda-container > :first-child");let r,n;if(t?.textContent.includes("Volume")||t?.textContent.includes("Issue")){const o=t.textContent.trim().split(/,\s+/);for(const s of o)s.startsWith("Volume")?n=me(s):s.startsWith("Issue")&&(r=me(s))}return{issue:r,volume:n}},tf=e=>{const t=e.querySelector('[data-qa="item-src-info"]')?.textContent??h(e,"property","og:description")??h(e,"name","description");if(!t)return{};const r=/Vol\.\s*(\d+)/.exec(t),n=r?r[1]:void 0,o=/No\.\s*(\d+)/.exec(t),s=o?o[1]:void 0,i=/pp\.\s*(\d+)-(\d+)/.exec(t),a=i?i[1]:void 0,c=i?i[2]:void 0,u=/pp\.\s*\d+-\d+\s*\((\d+)\s*pages\)/.exec(t),l=u?u[1]:void 0;return{issue:s,volume:n,spage:a,epage:c,pages:l}},rf=e=>{const t=Qt(e,["mfe-turnaway-pharos-link",'[data-qa="item-src-info"]']);if(!t)return;const n=/\(.+\)/.exec(t)?.map(o=>{const s=/\d{4}/.exec(o);return s?s[0]:void 0});return Kt(n)},nf=(e,t)=>{const r=Se(e),n=Ie(e),o=ke(e)??rf(e),s=Yo(e),i=s.jtitle??Qh(e)??void 0,a=s.pub,c=ef(e),u=tf(e),l=c.issue??u.issue,f=c.volume??u.volume,d=dt(e)??u.pages,g=u.spage,P=u.epage,b=Ee(t),O=Xo(Array.from(e.querySelector(".content-meta-data-stables")?.childNodes??[]).map(Z=>Z.textContent??""))??Kh(e);return j(E.Article,{atitle:r,au:n,date:o,doi:O,epage:P,issue:l,jtitle:i,pages:d,pub:a,spage:g,uri:b,volume:f})},of=(e,t)=>{const r=Ce(e),n=Ie(e),o=ke(e,r),s=Se(e),i=Fe(e,r),a=Ee(t);return de({au:n,date:o,pub:i,title:s,uri:a})},sf=(e,t)=>{const r=Ce(e),n=Ie(e),o=Se(e),s=ke(e),i=dt(e),a=Fe(e,r),c=Ee(t),u=Ho(r);return Y(E.Book,{au:n,date:s,doi:u,pages:i,pub:a,title:o,uri:c})},af=(e,t)=>{const r=Ce(e),n=Ie(e),o=Se(e),s=e.querySelector(".book-title-link")?.textContent??void 0,i=ke(e,r),a=Array.from(e.querySelectorAll('[data-qa="book"] > span')).map(d=>d.textContent),c=dt(e),u=a.find(d=>d.includes("pp."))?.match(/(\d+)-(\d+)/)??void 0,l=Fe(e,r),f=Ee(t);return Y(E.Bookitem,{atitle:o,au:n,btitle:s,date:i,epage:u?.[2],pub:l,pages:c,spage:u?.[1],uri:f})},cf=(e,t)=>{const r=Ce(e),n=Ie(e),o=Se(e),s=ke(e),i=dt(e),a=Fe(e,r),c=Ee(t),u=Ho(r);return Y(E.Document,{au:n,date:s,doi:u,pages:i,pub:a,title:o,uri:c})},uf=(e,t)=>{const r=Ce(e),n=Ie(e),o=ke(e,r),s=Se(e),i=Ee(t);return lo({au:n,date:o,title:s,uri:i})},lf=(e,t)=>{const{pub:r}=Yo(e),n=Se(e),o=e.querySelector(".eissn")?.textContent.replace(/EISSN\s+/,"").trim()??void 0,s=e.querySelector(".issn")?.textContent.replace(/ISSN\s+/,"").trim()??void 0,i=Ee(t);return j(E.Journal,{eissn:o,issn:s,jtitle:n,pub:r,uri:i})};var ie=(e=>(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))(ie||{});const pf=(e,t)=>{const r=Ce(e),n=Ie(e),o=ke(e,r),s=Se(e),i=Fe(e,r),a=Ee(t);return de({au:n,date:o,pub:i,title:s,uri:a})},hf=e=>Object.values(ie).includes(e),ff=e=>{if(e.querySelector(".journal_header-title"))return ie.Journal;if(e.querySelector(".journal-link"))return ie.Article;const n=e.querySelector(".content-type > span")?.textContent.toLowerCase().trim()??e.querySelector(".content-meta-data-label")?.textContent.toLowerCase().trim();return hf(n)?n:null},df=(e,t)=>{switch(ff(e)){case ie.Article:case ie.Serial:return nf(e,t);case ie.Audio:return of(e,t);case ie.Book:return sf(e,t);case ie.Chapter:case ie.ResearchReport:return af(e,t);case ie.Document:return cf(e,t);case ie.Image:return uf(e,t);case ie.Journal:return lf(e,t);case ie.Video:return pf(e,t);default:return null}},mf=({document:e,url:t})=>{const r=df(e,t);return r?A(r):q()},Je=e=>{if(e){if(typeof e=="string")return e;if(e.length>0)return e[0]}else return},Ko=e=>{if(e)return typeof e=="string"?e:Array.isArray(e)?e.length===0?void 0:Je(e[0].name):Je(e.name)},mt=(...e)=>{const t=new Set(e.filter(r=>!!r));if(t.size!==0)return[...t]},gf=e=>{const t=Ko(e.mainEntity.creator);return t?[t]:void 0},Me=({lcn:e,title:t})=>({bibid:e,title:t}),vf=(e,t)=>{const r=mt(...(e&&gf(e))??[],...t.authors??[]),n=mt(...t.eissns??[]),o=mt(e?.mainEntity.isbn?Wt(e.mainEntity.isbn):void 0,...t.isbns??[]),s=mt(...e?.mainEntity.issn??[],...t.issns??[]),[i,a]=e?.mainEntity.pagination?.split("-")??[];return{authors:r,date:t.date,doi:Je(t.dois),edition:e?.mainEntity.edition??t.edition,epage:a,eissn:Je(n),lcn:t.lcn??e?.identifier.value,isbn:o?.join(","),issn:Je(s),issue:e?.mainEntity.issueNumber,jtitle:t.jtitle,publisher:t.publisher??Ko(e?.mainEntity.publisher),spage:i,title:e?.name??t.title,volume:e?.mainEntity.volumeNumber}},bf=e=>j(E.Article,{...Me(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}),_f=e=>de({...Me(e),au:e.authors,date:e.date,pub:e.publisher}),yf=e=>Y(E.Book,{...Me(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}),Sf=e=>j(E.Journal,{...Me(e),date:e.date,doi:e.doi,eissn:e.eissn,issn:e.issn,pub:e.publisher}),Qo=I({"@type":M("Organization"),name:pe([p(),U(p())])}),es=I({"@type":M("Person"),name:pe([p(),U(p())])}),Ef=we.extend({identifier:I({"@type":p(),propertyID:p(),value:p()}),mainEntity:I({"@type":p(),"@id":p(),creator:he(pe([p(),es,U(es)])),edition:he(p()),isbn:he(p()),issn:he(U(p())),issueNumber:he(p()),pagination:he(p()),publisher:he(pe([p(),Qo,U(Qo)])),volumeNumber:he(p())}),name:p()}),$f=e=>{const t=ut(e);if(!t)return null;const r=Ue(t),n=Ef.safeParse(r);return n.success?n.data:null},Af=e=>de({...Me(e),au:e.authors,date:e.date,pub:e.publisher}),Rf=/([0-9]{4}-[0-9]{1,2}-[0-9]{1,2}|[0-9]{4}-[0-9]{1,2}|[0-9]{4})/,ts=/(E?ISBN|E?ISSN|DOI)\s*:\s*/g,er=e=>`*:has([title*="${e}" i]) + .item-details-element-container prm-highlight`,wf=e=>{if(!e)return;const t=Rf.exec(e);if(t)return t.length>1?t[1]:void 0},If=e=>{const t=Array.from(e.querySelectorAll(er("Identifier"))),r={};return t.map(n=>n.textContent).filter(n=>!!n).forEach(n=>{const o=[];let s;for(;(s=ts.exec(n))!==null;)o.push({id:s[1].toLowerCase(),index:s.index,start:ts.lastIndex});o.forEach(({id:i,start:a},c)=>{r[i]??=[],r[i].push(n.substring(a,o[c+1]?.index))})}),r},kf=e=>Array.from(e.querySelectorAll(er("Author"))).filter(t=>!!t.textContent&&t.parentElement!==null&&t.parentElement.getAttribute("aria-hidden")!=="true").map(t=>t.textContent.trim()),$e=(e,t)=>e.querySelector(er(t))?.textContent.trim(),Cf=e=>{const t=$e(e,"Creation Date"),r=$e(e,"Edition"),n=$e(e,"Publication Date"),o=$e(e,"Is Part Of"),s=$e(e,"Publisher"),i=$e(e,"Title"),a=$e(e,"MMS ID")??$e(e,"Record ID"),c=kf(e),u=If(e),[l]=o?.split(",")??[],f=wf(n??t),d=[...u.isbn??[],...u.eisbn??[]].map(g=>Wt(g)).filter(g=>!!g);return{authors:c,date:f,dois:u.doi,edition:r,eissns:u.eissn,isbns:d,issns:u.issn,jtitle:l,lcn:a,publisher:s,title:i}};var rs=(e=>(e.Article="Article",e.Book="Book",e.Periodical="Periodical",e.Journal="Journal",e.AudioCD="Audio CD",e.CreativeWork="CreativeWork",e.Movie="Movie",e.Video="Video",e))(rs||{});const Pf=e=>Object.values(rs).includes(e),Of=(e,t)=>{const r=t?.mainEntity["@type"]??e.querySelector(".media-content-type")?.textContent??void 0;if(Pf(r))return r},Nf=({document:e})=>{const t=$f(e),r=Cf(e),n=vf(t,r);switch(Of(e,t)){case"Article":return A(bf(n));case"Book":return A(yf(n));case"Periodical":case"Journal":return A(Sf(n));case"Audio CD":case"CreativeWork":return A(_f(n));case"Movie":case"Video":return A(Af(n));default:return q()}},zf=e=>{const t=e.querySelectorAll('[id="Info"] > p'),n=Array.from(t).find(s=>s.textContent.includes("Document Type"))?.textContent,o=h(e,"name","DC.identifier");return o?.startsWith("info:doi/")||n?.includes("Article")?S.Article:o?.startsWith("urn:issn:")?S.Journal:void 0},Lf=e=>{const t=h(e,"name","DCTERMS.bibliographicCitation"),[r,n,o,s]=t?.split(",")??[];return{journalTitle:r,volume:n,issue:o,pages:s}},xf=e=>{const t=h(e,"name","DC.identifier");return(t?t.split("info:doi/"):null)?.[1]??void 0},Tf=e=>e.evaluate('//*[@id="altLayoutPublisherLogo"]/p/a[1]',e,null,XPathResult.STRING_TYPE,null).stringValue,qf=e=>{const[t,r]=e?e.trim().split("-"):[void 0,void 0],n=r?.replace(/\(\d+\)/,"").trim();return{spage:t,epage:n}},Zf=e=>{const t=h(e,"name","DCTERMS.issued");if(!t)return;const n=/\d{4}/.exec(t);return n?n[0]:void 0},jf=e=>{const t=h(e,"name","DC.title"),r=h(e,"name","DC.publisher"),n=Zf(e),o=Lf(e),s=o.journalTitle?.trim(),i=o.volume?.trim(),a=o.issue?.trim(),c=o.pages?qf(o.pages):void 0,u=c?.spage,l=c?.epage,f=re(e,"name","DC.creator"),d=xf(e);return j(E.Article,{au:f,jtitle:s,date:n,doi:d,issue:a,pub:r,spage:u,epage:l,atitle:t,volume:i})},Df=e=>{const t=h(e,"name","DC.title"),r=h(e,"name","DC.publisher"),n=Tf(e);return j(E.Journal,{issn:n,title:t,pub:r})},Uf=({document:e})=>{switch(zf(e)){case S.Article:return A(jf(e));case S.Journal:return A(Df(e));default:return q()}},Bf=/^\d{4}-\d{3}[\dX]$/i,Vf=e=>Bf.test(e),ns=e=>{const t=e.filter(Vf);return t.length?t:void 0},tr=e=>{const t=re(e,"name","citation_author");return t.length?t:void 0},rr=e=>h(e,"name","citation_publication_date")?.match(/^\d{4}/)?.[0],Ff=e=>h(e,"name","citation_doi"),os=e=>{const t=re(e,"name","citation_isbn");return t.length?t.join(","):void 0},ss=e=>ns(re(e,"name","citation_issn")),nr=e=>h(e,"name","citation_journal_title"),or=e=>h(e,"name","citation_publisher"),gt=e=>h(e,"name","citation_title"),Jf=e=>h(e,"name","citation_doi"),sr=e=>h(e,"name","citation_firstpage"),ir=e=>h(e,"name","citation_lastpage"),Mf=e=>h(e,"name","citation_issue"),Wf=e=>h(e,"name","citation_volume"),Gf=e=>j(E.Article,{atitle:gt(e),au:tr(e),date:rr(e),doi:Ff(e),issn:ss(e)?.[0],issue:Mf(e),jtitle:nr(e),pub:or(e),volume:Wf(e),spage:sr(e),epage:ir(e)}),Xf=e=>Y(E.Bookitem,{atitle:gt(e),au:tr(e),btitle:nr(e),date:rr(e),isbn:os(e),pub:or(e),spage:sr(e),epage:ir(e)}),Hf=e=>po({title:gt(e),au:tr(e),date:rr(e),pub:or(e),spage:sr(e),epage:ir(e)}),is=e=>!!e.isbn,Yf=e=>!!e.issn||e.type==="Article"&&!!e.journalTitle||!is(e)&&!!e.journalTitle,Kf=e=>!!e.title,Qf=e=>{const t={type:Jf(e),isbn:os(e),issn:ss(e),journalTitle:nr(e),title:gt(e)};return is(t)?Xf(e):Yf(t)?Gf(e):Kf(t)?Hf(e):null},ed=({document:e})=>{const t=Qf(e);return t?A(t):q()},td=I({"@content":p(),datePublished:p().optional(),mainEntity:I({type:p().optional(),name:p().optional(),author:U(I({name:p()})).optional(),publisher:I({type:p(),name:p()}).optional(),isbn:p().optional()})}),rd=e=>td.safeParse(e).success,nd=e=>{const t=e.textContent;if(!t)return null;try{const r=JSON.parse(t);if(rd(r))return r}catch{return null}return null},od=({document:e})=>{const t=ut(e);if(!t)return q();const r=nd(t);if(!r)return q();const n=r.mainEntity.type,o=r.mainEntity.author?.map(u=>u.name),s=r.datePublished?.substring(0,4),i=r.mainEntity.name,a=r.mainEntity.isbn,c=r.mainEntity.publisher?.name;switch(n){case"Book":return A(Y(E.Book,{au:o,date:s,title:i,isbn:a,pub:c}));default:return q()}},sd=we.extend({"@type":p().optional(),name:p().optional(),copyrightYear:eo().optional(),author:U(I({name:p()})).optional(),publisher:U(I({name:p()})).optional()}),id=e=>sd.safeParse(e).success,ad=({document:e,url:t})=>{const r=ut(e);if(!r)return q();const n=Ue(r);if(!n||!id(n))return q();const o=n["@type"],s=n.author?.map(l=>l.name),i=n.copyrightYear?.toString()??h(e,"property","og:book:release_date"),a=n.name,c=Kt(n.publisher?.map(l=>l.name)),u=h(e,"property","og:book:isbn");switch(o){case"Book":return A(Y(E.Book,{au:s,date:i,title:a,isbn:u,pub:c,uri:t}));default:return q()}},cd=e=>{const t=Array.from(e.querySelectorAll("a[rel=author]")).map(r=>r.textContent.trim()).filter(Boolean);return t.length?t:void 0},ud=e=>{const t=Array.from(e.querySelectorAll("strong")).filter(r=>r.textContent.startsWith("ISBN")).map(r=>r.nextElementSibling?.textContent.trim());if(t.length!==0)return t[0]?.replace(/\s+/,",")},ld=({url:e,document:t})=>{const r=t.querySelector("h3.page-title")?.textContent.trim()??void 0,n=cd(t),o=h(t,"property","article:published_time"),s=ud(t),i=Y(E.Book,{au:n,date:o?.substring(0,4),isbn:s,pub:"Milne Open Textbooks",title:r,uri:e});return A(i)},pd=({document:e,url:t})=>{switch(hd(t)){case S.Chapter:return A(vd(e));case S.Book:return A(bd(e));case S.Article:return A(fd(e));case S.Journal:return A(dd(e));default:return q()}},hd=e=>{const{pathname:t}=new URL(e);return t.includes("/books/abs/")?S.Chapter:t.includes("/books/")?S.Book:/\/journals\/.+\/article\//.exec(t)!=null?S.Article:t.includes("/journals/")?S.Journal:S.None},fd=e=>{const t=h(e,"name","citation_title"),r=h(e,"name","citation_journal_title"),n=h(e,"name","citation_doi"),o=h(e,"name","citation_volume"),s=h(e,"name","citation_issue"),i=h(e,"name","citation_firstpage"),a=h(e,"name","citation_lastpage"),c=h(e,"name","citation_publication_date")?.substring(0,4),u=h(e,"name","citation_publisher"),l=as(e),f=ns(re(e,"name","citation_issn"));return j(E.Article,{atitle:t,au:l,jtitle:r,doi:n,volume:o,issue:s,issn:f?.[0],spage:i,epage:a,date:c,pub:u})},dd=e=>{const t=md(e),r=gd(e),n=r.find(a=>a.type==="Print"),o=r.find(a=>a.type==="Online"),s=n?n.value:void 0,i=o?o.value:void 0;return j(E.Journal,{title:t,issn:s,eissn:i})},md=e=>e.querySelector("h1.title")?.textContent.trim()??void 0,gd=e=>{const r=Array.from(e.querySelectorAll("span.bold")).find(s=>s.textContent.trim()==="ISSN:"),n=/^([0-9]{4}-[0-9]{3}[0-9X]) \((Print|Online)\)/,o=[];return r&&r.parentElement?.querySelectorAll("span.value")?.forEach(i=>{const a=i.textContent.trim(),c=n.exec(a);c&&o.push({value:c[1],type:c[2]})}),o},vd=e=>{const t=h(e,"name","citation_title"),r=h(e,"name","citation_inbook_title"),n=h(e,"name","citation_doi"),o=h(e,"name","citation_publication_date")?.substring(0,4),s=h(e,"name","citation_publisher");return Y(E.Bookitem,{atitle:t,btitle:r,doi:n,date:o,pub:s})},bd=e=>{const t=h(e,"name","citation_title"),r=h(e,"name","citation_doi"),n=h(e,"name","citation_isbn"),o=h(e,"name","citation_publication_date")?.substring(0,4),s=h(e,"name","citation_publisher"),i=as(e);return Y(E.Book,{title:t,au:i,doi:r,isbn:n,date:o,pub:s})},as=e=>{const t=re(e,"name","citation_author");return t.length?t:void 0},_d=e=>{switch(h(e,"property","og:type")){case"Article":return"Article";case"Journal":return"Journal";default:return}};function yd(e){const t=h(e,"property","og:title"),r=h(e,"name","dc.Publisher"),n=h(e,"name","publication_doi");return A(j(E.Journal,{jtitle:t,pub:r,doi:n}))}function Sd(e){const t=h(e,"name","dc.Title"),r=re(e,"name","dc.Creator"),n=h(e,"name","dc.Date")?.substring(0,4),o=h(e,"name","publication_doi"),s=h(e,"name","citation_journal_title"),i=h(e,"name","dc.Publisher");return A(j(E.Article,{atitle:t,au:r,date:n,doi:o,jtitle:s,pub:i}))}const Ed=({document:e})=>{switch(_d(e)){case"Journal":return yd(e);case"Article":return Sd(e);default:return q()}},$d=e=>{if(!e)return;const[t,r]=e.trim().split("-");return{spage:t,epage:r}},Ad=e=>{const{pathname:t}=new URL(e);if(t.includes("/article/"))return S.Article},Rd=e=>{const t=h(e,"name","DC.Source"),r=h(e,"name","DC.Title"),n=re(e,"name","DC.Creator.PersonalName"),o=h(e,"name","DC.Source.ISSN"),s=h(e,"name","citation_date")?.substring(0,4),i=h(e,"name","DC.Source.Volume"),a=h(e,"name","DC.Source.Issue"),c=h(e,"name","DC.Identifier.URI"),u=h(e,"name","DC.Identifier.pageNumber"),l=u?$d(u):void 0,f=l?.spage,d=l?.epage;return j(E.Article,{jtitle:t,atitle:r,au:n,issn:o,date:s,spage:f,epage:d,volume:i,issue:a,uri:c})},wd=({document:e,url:t})=>{switch(Ad(t)){case S.Article:return A(Rd(e));default:return q()}},Id=e=>{switch(kd(e)){case"eBook":return"Book";case"Reference":return"Chapter";default:return}},kd=e=>e.querySelector("#vol-contentType a")?.textContent??void 0;function Cd(e,t){const r=cs(e),n=ar(e),o=ls(e),s=ps(e),i=hs(e),a=fs(e),c=ar(e),u=t,{startPage:l,endPage:f}=ds(e)??{};return A(Y(E.Book,{au:r,btitle:n,date:o,doi:s,epage:f,isbn:i,pub:a,spage:l,title:c,uri:u}))}function Pd(e,t){const r=cs(e),n=us(e),o=ar(e),s=ls(e),i=ps(e),a=hs(e),c=fs(e),u=us(e),l=t,{startPage:f,endPage:d}=ds(e)??{};return A(Y(E.Book,{au:r,atitle:n,btitle:o,date:s,doi:i,epage:d,isbn:a,pub:c,spage:f,title:u,uri:l}))}const cs=e=>{const t=e.querySelectorAll("div#article_author p.author-bio b"),r=Array.from(t).map(n=>n.textContent).filter(n=>!!n).map(n=>n.trim());return r.length>0?r:void 0},Te=(e,t)=>e.querySelector(`input#${t}`)?.getAttribute("value")??void 0,Od=e=>h(e,"property","og:title"),ar=e=>Te(e,"titlevalue")??Od(e),us=e=>Te(e,"chapter-title-squid"),ls=e=>Te(e,"pubdate-squid"),ps=e=>Te(e,"doi-squid"),hs=e=>Te(e,"isbn-squid"),fs=e=>Te(e,"pubname-squid"),ds=e=>{const t=e.querySelector("#pageRange")?.textContent??void 0;if(!t)return;const n=/(\d+)–(\d+)/.exec(t);if(n)return{startPage:n[1],endPage:n[2]}},Nd=({document:e,url:t})=>{switch(Id(e)){case"Book":return Cd(e,t);case"Chapter":return Pd(e,t);default:return q()}},zd=(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(),Ld=e=>{switch(zd(e,"Medium")){case"book":case"e-book":return E.Book;case"e-journal":return E.Journal;default:return E.Unknown}},xd=e=>{delete e.rft_id},Td=e=>{const t=Mt(e);if(lt(t)){const r=Ld(e.document);t.resource.genre=r,xd(t.resource)}return t},qd=e=>{const t=h(e,"name","type")?.toLowerCase(),r=h(e,"name","og:type")?.toLowerCase(),n=h(e,"name","citation_article_type")?.toLowerCase();if(t==="article"||n==="article"||r==="article")return S.Article;const o=h(e,"name","twitter:title")?.trim(),s=h(e,"name","description")?.trim();if(o||s)return S.Webpage},Zd=e=>{const t=h(e,"name","DC.Title"),r=h(e,"name","DC.Publisher"),n=h(e,"name","DC.Date"),o=h(e,"name","DC.Identifier"),s=h(e,"name","citation_journal_title"),i=h(e,"name","citation_volume"),a=h(e,"name","citation_issn"),c=re(e,"name","citation_author");return j(E.Article,{au:c,jtitle:s,date:n,doi:o,issn:a,pub:r,title:t,volume:i})},jd=(e,t)=>{const r=h(t,"name","twitter:title");return at({uri:e,title:r})},Dd=({url:e,document:t})=>{switch(qd(t)){case S.Article:return A(Zd(t));case S.Webpage:return A(jd(e,t))}return q()},Ud=({document:e})=>Array.from(e.querySelectorAll(".availability.documentSummaryAvailability.availabilityContent")).length<=1?q():ko(),Bd=/([0-9]{4})\s+at/;function Vd(e){if(!e)return;const t=Bd.exec(e);if(t&&t.length>1)return t[1]}function ms(e,t){const r=e.getElementsByClassName(t);if(r.length!==0)return r[0].textContent}function Fd(e){const t={};return Array.from(e.getElementsByTagName("li")).reduce((r,n)=>{const o=ms(n,"title"),s=ms(n,"content");return o&&s&&(r[o]=s),r},t)}function Jd(e){const t=e.getElementsByClassName("information");if(t.length===0)return{};const r=Fd(t[0]),n=Vd(r.Published),o=r.Show;return{date:n,series:o}}const Md=({url:e,document:t})=>{if(!new URL(e).searchParams.has("i"))return q();const n=E.AudioDocument,o=h(t,"property","og:site_name"),s=h(t,"property","og:title"),i=Jd(t);return A({genre:n,pub:o,title:s,uri:e,...i})},Wd=e=>{const t=h(e,"name","citation_date");return t?t.split("/").find(o=>/^\d{4}/.test(o))??void 0:void 0},Gd=e=>{const t=e.querySelector("#arxiv-doi-link")?.textContent;return t?t.replace("https://doi.org/","").trim():void 0},Xd=({document:e})=>{const t=h(e,"name","citation_title"),r=h(e,"name","citation_pdf_url"),n=re(e,"name","citation_author"),o=Wd(e),s=Gd(e);return!t&&n.length===0&&!o&&!s?q():A(j(E.Article,{au:n,date:o,doi:s,title:t,uri:r}))},Hd=e=>{const t=Ve(e,"div.director-section div.term-info-section-items");if(!t)return;const r=t.split(",").map(n=>n.replace(/\s+/g," ").trim()).filter(n=>n.length>0);return r.length>0?r:void 0},Yd=e=>{const t=new Map;return Array.from(e.querySelectorAll(".info-section-container")).forEach(r=>{const n=r.querySelector(".info-section-header .info-section-title")?.textContent.trim().toLowerCase();if(!n)return;const o=Array.from(r.querySelectorAll(".term-info-section-item")).map(s=>s.textContent.replace(",","").trim()).filter(s=>!!s);o.length&&t.set(n,o)}),t},Kd=({url:e,document:t})=>{const r=Yd(t),n=Hd(t)??r.get("director"),o=Ve(t,"div.product-release-year"),s=Ve(t,"div.studio-section div.term-info-section-item")??xe(r.get("supplier")),i=Ve(t,".product-title")??Ve(t,".movie-title"),a=de({au:n,date:o,pub:s,title:i,uri:e});return A(a)},Qd=e=>{if(h(e,"property","og:type")==="article")return S.Article};function em(e){const t={},r=e.querySelector("[data-id=layout-form]");return r&&Array.from(r.getElementsByTagName("h2")).forEach(o=>{const s=o.textContent.toLowerCase(),a=Array.from(o.parentElement?.getElementsByTagName("span")??[]).map(c=>c.textContent||"");s&&(t[s]=a[0])}),t}function tm(e,t,r){return r.includes("publisher")?t.publisher:r.includes("place of publication, exhibition, or creation")?t["place of publication, exhibition, or creation"]:h(e,"name","DC.publisher")}function rm(e){const t=h(e,"name","citation_publication_date");return t?t.substring(0,4):h(e,"name","citation_online_date")?.substring(0,4)}const nm=e=>{const t=em(e),r=h(e,"name","DataCite.title"),n=re(e,"name","DataCite.contributor"),o=rm(e),s=h(e,"name","DC.identifier.DOI"),i=Object.keys(t),a=tm(e,t,i),c=i.includes("journal")?t.journal:void 0,u=i.includes("volume")?t.volume:void 0,l=i.includes("issue")?t.issue:void 0,f=i.includes("issn")?t.issn:void 0,d=i.includes("electronic location (url)")?t["electronic location (url)"]:void 0;return j(E.Article,{jtitle:c,atitle:r,pub:a,au:n,date:o,doi:s,volume:u,issue:l,issn:f,uri:d})},om=({document:e})=>{switch(Qd(e)){case S.Article:return A(nm(e));default:return q()}};var T=(e=>(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))(T||{});const cr={NoResourceFound:To,Z3988:Mt,Z3988SearchResult:Wh,Amazon:Kl,CupOfJo:yp,Jstor:mf,Youtube:ph,SagePub:xp,SageVideo:Mh,ScienceDirect:Fp,Springer:Ch,TaylorFrancis:Yp,Wiley:Fh,VuFind:ah,ClinicalKey:pp,DOAJ:Rp,Primo:Nf,IngentaConnect:Uf,Ebscohost:ed,OpenStax:od,OpenTextbook:ad,Milne:ld,CambridgeJournalsOnline:pd,AhaJournals:Ed,Ijees:wd,BloomsburyCollections:Nd,HeritageCirqa:Td,BritishMedicalJournal:Dd,SummonSearchResult:Ud,ApplePodcasts:Md,Arxiv:Xd,KanopyVideo:Kd,LaTrobeOpal:om},sm="5.29.0",ur=()=>sm,im=["com.au","com","ca","co.uk","de","fr","nl"].flatMap(e=>[`amazon.${e}`,`www.amazon.${e}`]),am={version:ur(),siteRegistrations:[{matcher:{regexp:"^https://[a-z0-9\\-]+\\.on\\.worldcat\\.org/search"},name:"Worldcat Search Results",parsers:[T.Z3988SearchResult]},{matcher:{regexp:"^https://[a-z0-9\\-]+\\.summon\\.serialssolutions\\.com/"},name:"Summon Search Results",parsers:[T.SummonSearchResult]},{matcher:{regexp:"cupofjo[.-]com"},name:"Cup of Jo",parsers:[T.CupOfJo]},{matcher:{hostnames:["youtube.com","www.youtube.com"]},name:"Youtube",parsers:[T.Youtube]},{matcher:{regexp:"www[-.]sciencedirect[.-]com"},name:"Science Direct",parsers:[T.ScienceDirect]},{matcher:{hostnames:im},name:"Amazon",parsers:[T.Amazon]},{matcher:{regexp:"^https://sk\\.sagepub\\.com/video/"},name:"Sage Video",parsers:[T.SageVideo]},{matcher:{regexp:"[/.-]((www|journals)[.-])?sagepub[.-]com"},name:"Sage Publishing",parsers:[T.SagePub]},{matcher:{regexp:"www[.-]tandfonline[.-]com"},name:"Taylor & Francis",parsers:[T.TaylorFrancis]},{matcher:{regexp:"[/.-]((www|onlinelibrary)[.-])?wiley[.-]com"},name:"Wiley",parsers:[T.Wiley]},{matcher:{regexp:"^https://[a-z0-9\\-]+\\.on\\.worldcat\\.org/"},name:"Worldcat",parsers:[T.Z3988]},{matcher:{hostnames:["catalogue.rau.ac.uk"]},name:"Royal Agricultural University Library",parsers:[T.Z3988]},{matcher:{regexp:"link[.-]springer[.-]com"},name:"Springer",parsers:[T.Springer]},{matcher:{regexp:"^https://vufind\\.lboro\\.ac\\.uk/(Record|PrimoRecord)"},name:"VuFind",parsers:[T.VuFind]},{matcher:{regexp:"www[.-]clinicalkey[.-]com"},name:"ClinicalKey",parsers:[T.ClinicalKey]},{matcher:{regexp:"www[.-]jstor[.-]org"},name:"JSTOR",parsers:[T.Jstor]},{matcher:{regexp:"doaj[.-]org"},name:"DOAJ",parsers:[T.DOAJ]},{matcher:{regexp:"[/.-]ingentaconnect[.-]com"},name:"IngentaConnect",parsers:[T.IngentaConnect]},{matcher:{regexp:"research[.-]ebsco[.-]com"},name:"EBSCOHost",parsers:[T.Ebscohost]},{matcher:{regexp:"openstax[-.]org"},name:"OpenStax",parsers:[T.OpenStax]},{matcher:{regexp:"open[.-]umn[.-]edu"},name:"OpenTextbook",parsers:[T.OpenTextbook]},{matcher:{regexp:"milneopentextbooks[-.]org"},name:"Milne Open Textbooks",parsers:[T.Milne]},{matcher:{regexp:"www[.-]perlego[.-]com"},name:"Perlego",parsers:[T.Z3988]},{matcher:{regexp:"www[.-]ahajournals[.-]org"},name:"AHA Journals",parsers:[T.AhaJournals]},{matcher:{regexp:"www[.-]cambridge[.-]org"},name:"Cambridge Journals Online",parsers:[T.CambridgeJournalsOnline]},{matcher:{regexp:"www[.-]nieindia[.-]org"},name:"International Journal of Ecology and Environmental Sciences",parsers:[T.Ijees]},{matcher:{regexp:"www[.-]bloomsburycollections[.-]com"},name:"Bloomsbury Collections",parsers:[T.BloomsburyCollections]},{matcher:{regexp:"cirqahosting[.-]com"},name:"Heritage Cirqa",parsers:[T.HeritageCirqa]},{matcher:{regexp:"www[.-]bmj[.-]com"},name:"British Medical Journal",parsers:[T.BritishMedicalJournal]},{matcher:{regexp:"podcasts[.-]apple[.-]com"},name:"Apple Podcasts",parsers:[T.ApplePodcasts]},{matcher:{regexp:"arxiv[.-]org"},name:"arxiv",parsers:[T.Arxiv]},{matcher:{regexp:"kanopy[.-]com"},name:"Kanopy Video",parsers:[T.KanopyVideo]},{matcher:{regexp:"opal[.-]latrobe[.-]edu[.-]au"},name:"La Trobe Opal",parsers:[T.LaTrobeOpal]}]},lr=I({hostnames:U(p()).min(1)}),pr=I({regexp:p()}),hr=pe([lr,pr]),fr=I({matcher:hr,name:p(),parsers:U(p()),libraryVersionRange:p().optional()}),gs=I({siteRegistrations:U(fr),version:p()}),cm=e=>gs.safeParse(e).success,um=e=>fr.safeParse(e).success,lm=e=>hr.safeParse(e).success,vs=e=>Object.values(T).includes(e),pm=e=>typeof e=="object"&&e!==null,bs=I({url:p(),document:El(pm)}),hm=e=>bs.safeParse(e).success;var vt={exports:{}},dr,_s;function bt(){if(_s)return dr;_s=1;const e="2.0.0",t=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,o=t-6;return dr={MAX_LENGTH:t,MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:o,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},dr}var mr,ys;function _t(){return ys||(ys=1,mr=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{}),mr}var Ss;function We(){return Ss||(Ss=1,(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:o}=bt(),s=_t();t=e.exports={};const i=t.re=[],a=t.safeRe=[],c=t.src=[],u=t.safeSrc=[],l=t.t={};let f=0;const d="[a-zA-Z0-9-]",g=[["\\s",1],["\\d",o],[d,n]],P=O=>{for(const[Z,K]of g)O=O.split(`${Z}*`).join(`${Z}{0,${K}}`).split(`${Z}+`).join(`${Z}{1,${K}}`);return O},b=(O,Z,K)=>{const L=P(Z),B=f++;s(O,B,Z),l[O]=B,c[B]=Z,u[B]=L,i[B]=new RegExp(Z,K?"g":void 0),a[B]=new RegExp(L,K?"g":void 0)};b("NUMERICIDENTIFIER","0|[1-9]\\d*"),b("NUMERICIDENTIFIERLOOSE","\\d+"),b("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${d}*`),b("MAINVERSION",`(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})`),b("MAINVERSIONLOOSE",`(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})`),b("PRERELEASEIDENTIFIER",`(?:${c[l.NONNUMERICIDENTIFIER]}|${c[l.NUMERICIDENTIFIER]})`),b("PRERELEASEIDENTIFIERLOOSE",`(?:${c[l.NONNUMERICIDENTIFIER]}|${c[l.NUMERICIDENTIFIERLOOSE]})`),b("PRERELEASE",`(?:-(${c[l.PRERELEASEIDENTIFIER]}(?:\\.${c[l.PRERELEASEIDENTIFIER]})*))`),b("PRERELEASELOOSE",`(?:-?(${c[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[l.PRERELEASEIDENTIFIERLOOSE]})*))`),b("BUILDIDENTIFIER",`${d}+`),b("BUILD",`(?:\\+(${c[l.BUILDIDENTIFIER]}(?:\\.${c[l.BUILDIDENTIFIER]})*))`),b("FULLPLAIN",`v?${c[l.MAINVERSION]}${c[l.PRERELEASE]}?${c[l.BUILD]}?`),b("FULL",`^${c[l.FULLPLAIN]}$`),b("LOOSEPLAIN",`[v=\\s]*${c[l.MAINVERSIONLOOSE]}${c[l.PRERELEASELOOSE]}?${c[l.BUILD]}?`),b("LOOSE",`^${c[l.LOOSEPLAIN]}$`),b("GTLT","((?:<|>)?=?)"),b("XRANGEIDENTIFIERLOOSE",`${c[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),b("XRANGEIDENTIFIER",`${c[l.NUMERICIDENTIFIER]}|x|X|\\*`),b("XRANGEPLAIN",`[v=\\s]*(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:${c[l.PRERELEASE]})?${c[l.BUILD]}?)?)?`),b("XRANGEPLAINLOOSE",`[v=\\s]*(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:${c[l.PRERELEASELOOSE]})?${c[l.BUILD]}?)?)?`),b("XRANGE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAIN]}$`),b("XRANGELOOSE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAINLOOSE]}$`),b("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),b("COERCE",`${c[l.COERCEPLAIN]}(?:$|[^\\d])`),b("COERCEFULL",c[l.COERCEPLAIN]+`(?:${c[l.PRERELEASE]})?(?:${c[l.BUILD]})?(?:$|[^\\d])`),b("COERCERTL",c[l.COERCE],!0),b("COERCERTLFULL",c[l.COERCEFULL],!0),b("LONETILDE","(?:~>?)"),b("TILDETRIM",`(\\s*)${c[l.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",b("TILDE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAIN]}$`),b("TILDELOOSE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAINLOOSE]}$`),b("LONECARET","(?:\\^)"),b("CARETTRIM",`(\\s*)${c[l.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",b("CARET",`^${c[l.LONECARET]}${c[l.XRANGEPLAIN]}$`),b("CARETLOOSE",`^${c[l.LONECARET]}${c[l.XRANGEPLAINLOOSE]}$`),b("COMPARATORLOOSE",`^${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]})$|^$`),b("COMPARATOR",`^${c[l.GTLT]}\\s*(${c[l.FULLPLAIN]})$|^$`),b("COMPARATORTRIM",`(\\s*)${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]}|${c[l.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",b("HYPHENRANGE",`^\\s*(${c[l.XRANGEPLAIN]})\\s+-\\s+(${c[l.XRANGEPLAIN]})\\s*$`),b("HYPHENRANGELOOSE",`^\\s*(${c[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[l.XRANGEPLAINLOOSE]})\\s*$`),b("STAR","(<|>)?=?\\s*\\*"),b("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),b("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(vt,vt.exports)),vt.exports}var gr,Es;function vr(){if(Es)return gr;Es=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return gr=n=>n?typeof n!="object"?e:n:t,gr}var br,$s;function As(){if($s)return br;$s=1;const e=/^[0-9]+$/,t=(n,o)=>{if(typeof n=="number"&&typeof o=="number")return n===o?0:n<o?-1:1;const s=e.test(n),i=e.test(o);return s&&i&&(n=+n,o=+o),n===o?0:s&&!i?-1:i&&!s?1:n<o?-1:1};return br={compareIdentifiers:t,rcompareIdentifiers:(n,o)=>t(o,n)},br}var _r,Rs;function ne(){if(Rs)return _r;Rs=1;const e=_t(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=bt(),{safeRe:n,t:o}=We(),s=vr(),{compareIdentifiers:i}=As();class a{constructor(u,l){if(l=s(l),u instanceof a){if(u.loose===!!l.loose&&u.includePrerelease===!!l.includePrerelease)return u;u=u.version}else if(typeof u!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof u}".`);if(u.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",u,l),this.options=l,this.loose=!!l.loose,this.includePrerelease=!!l.includePrerelease;const f=u.trim().match(l.loose?n[o.LOOSE]:n[o.FULL]);if(!f)throw new TypeError(`Invalid Version: ${u}`);if(this.raw=u,this.major=+f[1],this.minor=+f[2],this.patch=+f[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");f[4]?this.prerelease=f[4].split(".").map(d=>{if(/^[0-9]+$/.test(d)){const g=+d;if(g>=0&&g<r)return g}return d}):this.prerelease=[],this.build=f[5]?f[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(u){if(e("SemVer.compare",this.version,this.options,u),!(u instanceof a)){if(typeof u=="string"&&u===this.version)return 0;u=new a(u,this.options)}return u.version===this.version?0:this.compareMain(u)||this.comparePre(u)}compareMain(u){return u instanceof a||(u=new a(u,this.options)),this.major<u.major?-1:this.major>u.major?1:this.minor<u.minor?-1:this.minor>u.minor?1:this.patch<u.patch?-1:this.patch>u.patch?1:0}comparePre(u){if(u instanceof a||(u=new a(u,this.options)),this.prerelease.length&&!u.prerelease.length)return-1;if(!this.prerelease.length&&u.prerelease.length)return 1;if(!this.prerelease.length&&!u.prerelease.length)return 0;let l=0;do{const f=this.prerelease[l],d=u.prerelease[l];if(e("prerelease compare",l,f,d),f===void 0&&d===void 0)return 0;if(d===void 0)return 1;if(f===void 0)return-1;if(f===d)continue;return i(f,d)}while(++l)}compareBuild(u){u instanceof a||(u=new a(u,this.options));let l=0;do{const f=this.build[l],d=u.build[l];if(e("build compare",l,f,d),f===void 0&&d===void 0)return 0;if(d===void 0)return 1;if(f===void 0)return-1;if(f===d)continue;return i(f,d)}while(++l)}inc(u,l,f){if(u.startsWith("pre")){if(!l&&f===!1)throw new Error("invalid increment argument: identifier is empty");if(l){const d=`-${l}`.match(this.options.loose?n[o.PRERELEASELOOSE]:n[o.PRERELEASE]);if(!d||d[1]!==l)throw new Error(`invalid identifier: ${l}`)}}switch(u){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",l,f);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",l,f);break;case"prepatch":this.prerelease.length=0,this.inc("patch",l,f),this.inc("pre",l,f);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",l,f),this.inc("pre",l,f);break;case"release":if(this.prerelease.length===0)throw new 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":{const d=Number(f)?1:0;if(this.prerelease.length===0)this.prerelease=[d];else{let g=this.prerelease.length;for(;--g>=0;)typeof this.prerelease[g]=="number"&&(this.prerelease[g]++,g=-2);if(g===-1){if(l===this.prerelease.join(".")&&f===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(d)}}if(l){let g=[l,d];f===!1&&(g=[l]),i(this.prerelease[0],l)===0?isNaN(this.prerelease[1])&&(this.prerelease=g):this.prerelease=g}break}default:throw new Error(`invalid increment argument: ${u}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return _r=a,_r}var yr,ws;function qe(){if(ws)return yr;ws=1;const e=ne();return yr=(r,n,o=!1)=>{if(r instanceof e)return r;try{return new e(r,n)}catch(s){if(!o)return null;throw s}},yr}var Sr,Is;function fm(){if(Is)return Sr;Is=1;const e=qe();return Sr=(r,n)=>{const o=e(r,n);return o?o.version:null},Sr}var Er,ks;function dm(){if(ks)return Er;ks=1;const e=qe();return Er=(r,n)=>{const o=e(r.trim().replace(/^[=v]+/,""),n);return o?o.version:null},Er}var $r,Cs;function mm(){if(Cs)return $r;Cs=1;const e=ne();return $r=(r,n,o,s,i)=>{typeof o=="string"&&(i=s,s=o,o=void 0);try{return new e(r instanceof e?r.version:r,o).inc(n,s,i).version}catch{return null}},$r}var Ar,Ps;function gm(){if(Ps)return Ar;Ps=1;const e=qe();return Ar=(r,n)=>{const o=e(r,null,!0),s=e(n,null,!0),i=o.compare(s);if(i===0)return null;const a=i>0,c=a?o:s,u=a?s:o,l=!!c.prerelease.length;if(!!u.prerelease.length&&!l){if(!u.patch&&!u.minor)return"major";if(u.compareMain(c)===0)return u.minor&&!u.patch?"minor":"patch"}const d=l?"pre":"";return o.major!==s.major?d+"major":o.minor!==s.minor?d+"minor":o.patch!==s.patch?d+"patch":"prerelease"},Ar}var Rr,Os;function vm(){if(Os)return Rr;Os=1;const e=ne();return Rr=(r,n)=>new e(r,n).major,Rr}var wr,Ns;function bm(){if(Ns)return wr;Ns=1;const e=ne();return wr=(r,n)=>new e(r,n).minor,wr}var Ir,zs;function _m(){if(zs)return Ir;zs=1;const e=ne();return Ir=(r,n)=>new e(r,n).patch,Ir}var kr,Ls;function ym(){if(Ls)return kr;Ls=1;const e=qe();return kr=(r,n)=>{const o=e(r,n);return o&&o.prerelease.length?o.prerelease:null},kr}var Cr,xs;function ue(){if(xs)return Cr;xs=1;const e=ne();return Cr=(r,n,o)=>new e(r,o).compare(new e(n,o)),Cr}var Pr,Ts;function Sm(){if(Ts)return Pr;Ts=1;const e=ue();return Pr=(r,n,o)=>e(n,r,o),Pr}var Or,qs;function Em(){if(qs)return Or;qs=1;const e=ue();return Or=(r,n)=>e(r,n,!0),Or}var Nr,Zs;function zr(){if(Zs)return Nr;Zs=1;const e=ne();return Nr=(r,n,o)=>{const s=new e(r,o),i=new e(n,o);return s.compare(i)||s.compareBuild(i)},Nr}var Lr,js;function $m(){if(js)return Lr;js=1;const e=zr();return Lr=(r,n)=>r.sort((o,s)=>e(o,s,n)),Lr}var xr,Ds;function Am(){if(Ds)return xr;Ds=1;const e=zr();return xr=(r,n)=>r.sort((o,s)=>e(s,o,n)),xr}var Tr,Us;function yt(){if(Us)return Tr;Us=1;const e=ue();return Tr=(r,n,o)=>e(r,n,o)>0,Tr}var qr,Bs;function Zr(){if(Bs)return qr;Bs=1;const e=ue();return qr=(r,n,o)=>e(r,n,o)<0,qr}var jr,Vs;function Fs(){if(Vs)return jr;Vs=1;const e=ue();return jr=(r,n,o)=>e(r,n,o)===0,jr}var Dr,Js;function Ms(){if(Js)return Dr;Js=1;const e=ue();return Dr=(r,n,o)=>e(r,n,o)!==0,Dr}var Ur,Ws;function Br(){if(Ws)return Ur;Ws=1;const e=ue();return Ur=(r,n,o)=>e(r,n,o)>=0,Ur}var Vr,Gs;function Fr(){if(Gs)return Vr;Gs=1;const e=ue();return Vr=(r,n,o)=>e(r,n,o)<=0,Vr}var Jr,Xs;function Hs(){if(Xs)return Jr;Xs=1;const e=Fs(),t=Ms(),r=yt(),n=Br(),o=Zr(),s=Fr();return Jr=(a,c,u,l)=>{switch(c){case"===":return typeof a=="object"&&(a=a.version),typeof u=="object"&&(u=u.version),a===u;case"!==":return typeof a=="object"&&(a=a.version),typeof u=="object"&&(u=u.version),a!==u;case"":case"=":case"==":return e(a,u,l);case"!=":return t(a,u,l);case">":return r(a,u,l);case">=":return n(a,u,l);case"<":return o(a,u,l);case"<=":return s(a,u,l);default:throw new TypeError(`Invalid operator: ${c}`)}},Jr}var Mr,Ys;function Rm(){if(Ys)return Mr;Ys=1;const e=ne(),t=qe(),{safeRe:r,t:n}=We();return Mr=(s,i)=>{if(s instanceof e)return s;if(typeof s=="number"&&(s=String(s)),typeof s!="string")return null;i=i||{};let a=null;if(!i.rtl)a=s.match(i.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);else{const g=i.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let P;for(;(P=g.exec(s))&&(!a||a.index+a[0].length!==s.length);)(!a||P.index+P[0].length!==a.index+a[0].length)&&(a=P),g.lastIndex=P.index+P[1].length+P[2].length;g.lastIndex=-1}if(a===null)return null;const c=a[2],u=a[3]||"0",l=a[4]||"0",f=i.includePrerelease&&a[5]?`-${a[5]}`:"",d=i.includePrerelease&&a[6]?`+${a[6]}`:"";return t(`${c}.${u}.${l}${f}${d}`,i)},Mr}var Wr,Ks;function wm(){if(Ks)return Wr;Ks=1;class e{constructor(){this.max=1e3,this.map=new Map}get(r){const n=this.map.get(r);if(n!==void 0)return this.map.delete(r),this.map.set(r,n),n}delete(r){return this.map.delete(r)}set(r,n){if(!this.delete(r)&&n!==void 0){if(this.map.size>=this.max){const s=this.map.keys().next().value;this.delete(s)}this.map.set(r,n)}return this}}return Wr=e,Wr}var Gr,Qs;function le(){if(Qs)return Gr;Qs=1;const e=/\s+/g;class t{constructor(_,k){if(k=o(k),_ instanceof t)return _.loose===!!k.loose&&_.includePrerelease===!!k.includePrerelease?_:new t(_.raw,k);if(_ instanceof s)return this.raw=_.value,this.set=[[_]],this.formatted=void 0,this;if(this.options=k,this.loose=!!k.loose,this.includePrerelease=!!k.includePrerelease,this.raw=_.trim().replace(e," "),this.set=this.raw.split("||").map(R=>this.parseRange(R.trim())).filter(R=>R.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const R=this.set[0];if(this.set=this.set.filter(C=>!b(C[0])),this.set.length===0)this.set=[R];else if(this.set.length>1){for(const C of this.set)if(C.length===1&&O(C[0])){this.set=[C];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let _=0;_<this.set.length;_++){_>0&&(this.formatted+="||");const k=this.set[_];for(let R=0;R<k.length;R++)R>0&&(this.formatted+=" "),this.formatted+=k[R].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(_){const R=((this.options.includePrerelease&&g)|(this.options.loose&&P))+":"+_,C=n.get(R);if(C)return C;const w=this.options.loose,N=w?c[u.HYPHENRANGELOOSE]:c[u.HYPHENRANGE];_=_.replace(N,fn(this.options.includePrerelease)),i("hyphen replace",_),_=_.replace(c[u.COMPARATORTRIM],l),i("comparator trim",_),_=_.replace(c[u.TILDETRIM],f),i("tilde trim",_),_=_.replace(c[u.CARETTRIM],d),i("caret trim",_);let D=_.split(" ").map(ee=>K(ee,this.options)).join(" ").split(/\s+/).map(ee=>hn(ee,this.options));w&&(D=D.filter(ee=>(i("loose invalid filter",ee,this.options),!!ee.match(c[u.COMPARATORLOOSE])))),i("range list",D);const x=new Map,F=D.map(ee=>new s(ee,this.options));for(const ee of F){if(b(ee))return[ee];x.set(ee.value,ee)}x.size>1&&x.has("")&&x.delete("");const oe=[...x.values()];return n.set(R,oe),oe}intersects(_,k){if(!(_ instanceof t))throw new TypeError("a Range is required");return this.set.some(R=>Z(R,k)&&_.set.some(C=>Z(C,k)&&R.every(w=>C.every(N=>w.intersects(N,k)))))}test(_){if(!_)return!1;if(typeof _=="string")try{_=new a(_,this.options)}catch{return!1}for(let k=0;k<this.set.length;k++)if(dn(this.set[k],_,this.options))return!0;return!1}}Gr=t;const r=wm(),n=new r,o=vr(),s=St(),i=_t(),a=ne(),{safeRe:c,t:u,comparatorTrimReplace:l,tildeTrimReplace:f,caretTrimReplace:d}=We(),{FLAG_INCLUDE_PRERELEASE:g,FLAG_LOOSE:P}=bt(),b=y=>y.value==="<0.0.0-0",O=y=>y.value==="",Z=(y,_)=>{let k=!0;const R=y.slice();let C=R.pop();for(;k&&R.length;)k=R.every(w=>C.intersects(w,_)),C=R.pop();return k},K=(y,_)=>(y=y.replace(c[u.BUILD],""),i("comp",y,_),y=W(y,_),i("caret",y),y=B(y,_),i("tildes",y),y=z(y,_),i("xrange",y),y=pn(y,_),i("stars",y),y),L=y=>!y||y.toLowerCase()==="x"||y==="*",B=(y,_)=>y.trim().split(/\s+/).map(k=>Q(k,_)).join(" "),Q=(y,_)=>{const k=_.loose?c[u.TILDELOOSE]:c[u.TILDE];return y.replace(k,(R,C,w,N,D)=>{i("tilde",y,R,C,w,N,D);let x;return L(C)?x="":L(w)?x=`>=${C}.0.0 <${+C+1}.0.0-0`:L(N)?x=`>=${C}.${w}.0 <${C}.${+w+1}.0-0`:D?(i("replaceTilde pr",D),x=`>=${C}.${w}.${N}-${D} <${C}.${+w+1}.0-0`):x=`>=${C}.${w}.${N} <${C}.${+w+1}.0-0`,i("tilde return",x),x})},W=(y,_)=>y.trim().split(/\s+/).map(k=>te(k,_)).join(" "),te=(y,_)=>{i("caret",y,_);const k=_.loose?c[u.CARETLOOSE]:c[u.CARET],R=_.includePrerelease?"-0":"";return y.replace(k,(C,w,N,D,x)=>{i("caret",y,C,w,N,D,x);let F;return L(w)?F="":L(N)?F=`>=${w}.0.0${R} <${+w+1}.0.0-0`:L(D)?w==="0"?F=`>=${w}.${N}.0${R} <${w}.${+N+1}.0-0`:F=`>=${w}.${N}.0${R} <${+w+1}.0.0-0`:x?(i("replaceCaret pr",x),w==="0"?N==="0"?F=`>=${w}.${N}.${D}-${x} <${w}.${N}.${+D+1}-0`:F=`>=${w}.${N}.${D}-${x} <${w}.${+N+1}.0-0`:F=`>=${w}.${N}.${D}-${x} <${+w+1}.0.0-0`):(i("no pr"),w==="0"?N==="0"?F=`>=${w}.${N}.${D}${R} <${w}.${N}.${+D+1}-0`:F=`>=${w}.${N}.${D}${R} <${w}.${+N+1}.0-0`:F=`>=${w}.${N}.${D} <${+w+1}.0.0-0`),i("caret return",F),F})},z=(y,_)=>(i("replaceXRanges",y,_),y.split(/\s+/).map(k=>Ge(k,_)).join(" ")),Ge=(y,_)=>{y=y.trim();const k=_.loose?c[u.XRANGELOOSE]:c[u.XRANGE];return y.replace(k,(R,C,w,N,D,x)=>{i("xRange",y,R,C,w,N,D,x);const F=L(w),oe=F||L(N),ee=oe||L(D),Xe=ee;return C==="="&&Xe&&(C=""),x=_.includePrerelease?"-0":"",F?C===">"||C==="<"?R="<0.0.0-0":R="*":C&&Xe?(oe&&(N=0),D=0,C===">"?(C=">=",oe?(w=+w+1,N=0,D=0):(N=+N+1,D=0)):C==="<="&&(C="<",oe?w=+w+1:N=+N+1),C==="<"&&(x="-0"),R=`${C+w}.${N}.${D}${x}`):oe?R=`>=${w}.0.0${x} <${+w+1}.0.0-0`:ee&&(R=`>=${w}.${N}.0${x} <${w}.${+N+1}.0-0`),i("xRange return",R),R})},pn=(y,_)=>(i("replaceStars",y,_),y.trim().replace(c[u.STAR],"")),hn=(y,_)=>(i("replaceGTE0",y,_),y.trim().replace(c[_.includePrerelease?u.GTE0PRE:u.GTE0],"")),fn=y=>(_,k,R,C,w,N,D,x,F,oe,ee,Xe)=>(L(R)?k="":L(C)?k=`>=${R}.0.0${y?"-0":""}`:L(w)?k=`>=${R}.${C}.0${y?"-0":""}`:N?k=`>=${k}`:k=`>=${k}${y?"-0":""}`,L(F)?x="":L(oe)?x=`<${+F+1}.0.0-0`:L(ee)?x=`<${F}.${+oe+1}.0-0`:Xe?x=`<=${F}.${oe}.${ee}-${Xe}`:y?x=`<${F}.${oe}.${+ee+1}-0`:x=`<=${x}`,`${k} ${x}`.trim()),dn=(y,_,k)=>{for(let R=0;R<y.length;R++)if(!y[R].test(_))return!1;if(_.prerelease.length&&!k.includePrerelease){for(let R=0;R<y.length;R++)if(i(y[R].semver),y[R].semver!==s.ANY&&y[R].semver.prerelease.length>0){const C=y[R].semver;if(C.major===_.major&&C.minor===_.minor&&C.patch===_.patch)return!0}return!1}return!0};return Gr}var Xr,ei;function St(){if(ei)return Xr;ei=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(l,f){if(f=r(f),l instanceof t){if(l.loose===!!f.loose)return l;l=l.value}l=l.trim().split(/\s+/).join(" "),i("comparator",l,f),this.options=f,this.loose=!!f.loose,this.parse(l),this.semver===e?this.value="":this.value=this.operator+this.semver.version,i("comp",this)}parse(l){const f=this.options.loose?n[o.COMPARATORLOOSE]:n[o.COMPARATOR],d=l.match(f);if(!d)throw new TypeError(`Invalid comparator: ${l}`);this.operator=d[1]!==void 0?d[1]:"",this.operator==="="&&(this.operator=""),d[2]?this.semver=new a(d[2],this.options.loose):this.semver=e}toString(){return this.value}test(l){if(i("Comparator.test",l,this.options.loose),this.semver===e||l===e)return!0;if(typeof l=="string")try{l=new a(l,this.options)}catch{return!1}return s(l,this.operator,this.semver,this.options)}intersects(l,f){if(!(l instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(l.value,f).test(this.value):l.operator===""?l.value===""?!0:new c(this.value,f).test(l.semver):(f=r(f),f.includePrerelease&&(this.value==="<0.0.0-0"||l.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||l.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&l.operator.startsWith(">")||this.operator.startsWith("<")&&l.operator.startsWith("<")||this.semver.version===l.semver.version&&this.operator.includes("=")&&l.operator.includes("=")||s(this.semver,"<",l.semver,f)&&this.operator.startsWith(">")&&l.operator.startsWith("<")||s(this.semver,">",l.semver,f)&&this.operator.startsWith("<")&&l.operator.startsWith(">")))}}Xr=t;const r=vr(),{safeRe:n,t:o}=We(),s=Hs(),i=_t(),a=ne(),c=le();return Xr}var Hr,ti;function Et(){if(ti)return Hr;ti=1;const e=le();return Hr=(r,n,o)=>{try{n=new e(n,o)}catch{return!1}return n.test(r)},Hr}var Yr,ri;function Im(){if(ri)return Yr;ri=1;const e=le();return Yr=(r,n)=>new e(r,n).set.map(o=>o.map(s=>s.value).join(" ").trim().split(" ")),Yr}var Kr,ni;function km(){if(ni)return Kr;ni=1;const e=ne(),t=le();return Kr=(n,o,s)=>{let i=null,a=null,c=null;try{c=new t(o,s)}catch{return null}return n.forEach(u=>{c.test(u)&&(!i||a.compare(u)===-1)&&(i=u,a=new e(i,s))}),i},Kr}var Qr,oi;function Cm(){if(oi)return Qr;oi=1;const e=ne(),t=le();return Qr=(n,o,s)=>{let i=null,a=null,c=null;try{c=new t(o,s)}catch{return null}return n.forEach(u=>{c.test(u)&&(!i||a.compare(u)===1)&&(i=u,a=new e(i,s))}),i},Qr}var en,si;function Pm(){if(si)return en;si=1;const e=ne(),t=le(),r=yt();return en=(o,s)=>{o=new t(o,s);let i=new e("0.0.0");if(o.test(i)||(i=new e("0.0.0-0"),o.test(i)))return i;i=null;for(let a=0;a<o.set.length;++a){const c=o.set[a];let u=null;c.forEach(l=>{const f=new e(l.semver.version);switch(l.operator){case">":f.prerelease.length===0?f.patch++:f.prerelease.push(0),f.raw=f.format();case"":case">=":(!u||r(f,u))&&(u=f);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${l.operator}`)}}),u&&(!i||r(i,u))&&(i=u)}return i&&o.test(i)?i:null},en}var tn,ii;function Om(){if(ii)return tn;ii=1;const e=le();return tn=(r,n)=>{try{return new e(r,n).range||"*"}catch{return null}},tn}var rn,ai;function nn(){if(ai)return rn;ai=1;const e=ne(),t=St(),{ANY:r}=t,n=le(),o=Et(),s=yt(),i=Zr(),a=Fr(),c=Br();return rn=(l,f,d,g)=>{l=new e(l,g),f=new n(f,g);let P,b,O,Z,K;switch(d){case">":P=s,b=a,O=i,Z=">",K=">=";break;case"<":P=i,b=c,O=s,Z="<",K="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(o(l,f,g))return!1;for(let L=0;L<f.set.length;++L){const B=f.set[L];let Q=null,W=null;if(B.forEach(te=>{te.semver===r&&(te=new t(">=0.0.0")),Q=Q||te,W=W||te,P(te.semver,Q.semver,g)?Q=te:O(te.semver,W.semver,g)&&(W=te)}),Q.operator===Z||Q.operator===K||(!W.operator||W.operator===Z)&&b(l,W.semver))return!1;if(W.operator===K&&O(l,W.semver))return!1}return!0},rn}var on,ci;function Nm(){if(ci)return on;ci=1;const e=nn();return on=(r,n,o)=>e(r,n,">",o),on}var sn,ui;function zm(){if(ui)return sn;ui=1;const e=nn();return sn=(r,n,o)=>e(r,n,"<",o),sn}var an,li;function Lm(){if(li)return an;li=1;const e=le();return an=(r,n,o)=>(r=new e(r,o),n=new e(n,o),r.intersects(n,o)),an}var cn,pi;function xm(){if(pi)return cn;pi=1;const e=Et(),t=ue();return cn=(r,n,o)=>{const s=[];let i=null,a=null;const c=r.sort((d,g)=>t(d,g,o));for(const d of c)e(d,n,o)?(a=d,i||(i=d)):(a&&s.push([i,a]),a=null,i=null);i&&s.push([i,null]);const u=[];for(const[d,g]of s)d===g?u.push(d):!g&&d===c[0]?u.push("*"):g?d===c[0]?u.push(`<=${g}`):u.push(`${d} - ${g}`):u.push(`>=${d}`);const l=u.join(" || "),f=typeof n.raw=="string"?n.raw:String(n);return l.length<f.length?l:n},cn}var un,hi;function Tm(){if(hi)return un;hi=1;const e=le(),t=St(),{ANY:r}=t,n=Et(),o=ue(),s=(f,d,g={})=>{if(f===d)return!0;f=new e(f,g),d=new e(d,g);let P=!1;e:for(const b of f.set){for(const O of d.set){const Z=c(b,O,g);if(P=P||Z!==null,Z)continue e}if(P)return!1}return!0},i=[new t(">=0.0.0-0")],a=[new t(">=0.0.0")],c=(f,d,g)=>{if(f===d)return!0;if(f.length===1&&f[0].semver===r){if(d.length===1&&d[0].semver===r)return!0;g.includePrerelease?f=i:f=a}if(d.length===1&&d[0].semver===r){if(g.includePrerelease)return!0;d=a}const P=new Set;let b,O;for(const z of f)z.operator===">"||z.operator===">="?b=u(b,z,g):z.operator==="<"||z.operator==="<="?O=l(O,z,g):P.add(z.semver);if(P.size>1)return null;let Z;if(b&&O){if(Z=o(b.semver,O.semver,g),Z>0)return null;if(Z===0&&(b.operator!==">="||O.operator!=="<="))return null}for(const z of P){if(b&&!n(z,String(b),g)||O&&!n(z,String(O),g))return null;for(const Ge of d)if(!n(z,String(Ge),g))return!1;return!0}let K,L,B,Q,W=O&&!g.includePrerelease&&O.semver.prerelease.length?O.semver:!1,te=b&&!g.includePrerelease&&b.semver.prerelease.length?b.semver:!1;W&&W.prerelease.length===1&&O.operator==="<"&&W.prerelease[0]===0&&(W=!1);for(const z of d){if(Q=Q||z.operator===">"||z.operator===">=",B=B||z.operator==="<"||z.operator==="<=",b){if(te&&z.semver.prerelease&&z.semver.prerelease.length&&z.semver.major===te.major&&z.semver.minor===te.minor&&z.semver.patch===te.patch&&(te=!1),z.operator===">"||z.operator===">="){if(K=u(b,z,g),K===z&&K!==b)return!1}else if(b.operator===">="&&!n(b.semver,String(z),g))return!1}if(O){if(W&&z.semver.prerelease&&z.semver.prerelease.length&&z.semver.major===W.major&&z.semver.minor===W.minor&&z.semver.patch===W.patch&&(W=!1),z.operator==="<"||z.operator==="<="){if(L=l(O,z,g),L===z&&L!==O)return!1}else if(O.operator==="<="&&!n(O.semver,String(z),g))return!1}if(!z.operator&&(O||b)&&Z!==0)return!1}return!(b&&B&&!O&&Z!==0||O&&Q&&!b&&Z!==0||te||W)},u=(f,d,g)=>{if(!f)return d;const P=o(f.semver,d.semver,g);return P>0?f:P<0||d.operator===">"&&f.operator===">="?d:f},l=(f,d,g)=>{if(!f)return d;const P=o(f.semver,d.semver,g);return P<0?f:P>0||d.operator==="<"&&f.operator==="<="?d:f};return un=s,un}var ln,fi;function qm(){if(fi)return ln;fi=1;const e=We(),t=bt(),r=ne(),n=As(),o=qe(),s=fm(),i=dm(),a=mm(),c=gm(),u=vm(),l=bm(),f=_m(),d=ym(),g=ue(),P=Sm(),b=Em(),O=zr(),Z=$m(),K=Am(),L=yt(),B=Zr(),Q=Fs(),W=Ms(),te=Br(),z=Fr(),Ge=Hs(),pn=Rm(),hn=St(),fn=le(),dn=Et(),y=Im(),_=km(),k=Cm(),R=Pm(),C=Om(),w=nn(),N=Nm(),D=zm(),x=Lm(),F=xm(),oe=Tm();return ln={parse:o,valid:s,clean:i,inc:a,diff:c,major:u,minor:l,patch:f,prerelease:d,compare:g,rcompare:P,compareLoose:b,compareBuild:O,sort:Z,rsort:K,gt:L,lt:B,eq:Q,neq:W,gte:te,lte:z,cmp:Ge,coerce:pn,Comparator:hn,Range:fn,satisfies:dn,toComparators:y,maxSatisfying:_,minSatisfying:k,minVersion:R,validRange:C,outside:w,gtr:N,ltr:D,intersects:x,simplifyRange:F,subset:oe,SemVer:r,re:e.re,src:e.src,tokens:e.t,SEMVER_SPEC_VERSION:t.SEMVER_SPEC_VERSION,RELEASE_TYPES:t.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},ln}var Zm=qm();const jm=(e,t)=>Dm(t)?t.hostnames.includes(new URL(e).hostname):Um(t)?!!e.match(t.regexp):!1,Dm=e=>lr.safeParse(e).success,Um=e=>pr.safeParse(e).success,Bm=(e,t)=>t?Zm.satisfies(e,t):!0,Vm=(e,t,r)=>Bm(t,r.libraryVersionRange)&&jm(e,r.matcher),Fm=(e,t)=>e.siteRegistrations.filter(r=>Vm(t,ur(),r)),Jm=(e,t)=>Fm(e,t).flatMap(({parsers:o,name:s})=>o.filter(i=>vs(i)&&i in cr).map(i=>({parser:cr[i],parserType:i,name:s}))),di=(e,t)=>{const r=Jm(e,t.url);for(const{parser:n,parserType:o,name:s}of r){const i=n(t);if(lt(i)||jo(i)||Do(i))return{...i,meta:{parserName:s,parserType:o,uri:t.url,referrer:t.url}}}return{...To(),meta:{parserName:null,parserType:T.NoResourceFound,uri:t.url,referrer:t.url}}},Mm=(e,t)=>{const r=di(e,t),{uri:n,...o}=r.meta;return{...r,meta:o}},Wm=(e,t)=>{switch(t){case _e.CA:return new URL(`https://${e}.rl.ca.talis.com`);default:return new URL(`https://${e}.rl.talis.com`)}},Gm=(e,t)=>{const r=Wm(e,t);return new URL("/ui/forms/bookmarklet.html",r)},Xm=(e,t,r)=>{const n=go(t);n.append("fast","true"),n.append("breakout","true"),r&&(r.parserName&&n.append("targetTitle",r.parserName),n.append("referrer",r.referrer));const o=new URL(e.toString());return o.search=n.toString(),o};v.BookGenresSchema=Rl,v.CustomerListSchema=So,v.CustomerSchema=Zt,v.DirectLinkOnlyResultSchema=Bt,v.Genre=E,v.HostnamesMatcherSchema=lr,v.JournalGenresSchema=wl,v.NON_OPENURL_PROPERTIES=Tt,v.NonOpenUrlPropertiesSchema=xt,v.NothingParsedResultSchema=Ut,v.OPENURL_KEYS=fo,v.OpenUrlAudioVisualResourceSchema=Cl,v.OpenUrlBookResourceSchema=Il,v.OpenUrlDocumentResourceSchema=Ol,v.OpenUrlImageResourceSchema=Pl,v.OpenUrlJournalResourceSchema=kl,v.OpenUrlResourceSchema=fe,v.OpenUrlResultSchema=Vt,v.OpenUrlWebpageResourceSchema=Nl,v.PARSERS=cr,v.ParserRegistrySchema=gs,v.ParserType=T,v.ParsingMetadataSchema=jt,v.ParsingMetadataV2Schema=Dt,v.ParsingRequestSchema=yo,v.ParsingResponseSchema=Ro,v.ParsingResponseV2Schema=wo,v.ParsingResultSchema=ct,v.REGISTRY=am,v.RegExpMatcherSchema=pr,v.ResourceDataSchema=bs,v.ResourceSchema=uo,v.SiteRegistrationSchema=fr,v.SummonSearchResultSchema=Jt,v.TenantRegion=_e,v.TenantRegistrySchema=Zl,v.TenantSchema=qt,v.UrlMatcherSchema=hr,v.Z3988SearchResultSchema=Ft,v.convertCustomerListToTenantRegistry=Ul,v.createAudioVisual=de,v.createBook=Y,v.createDocument=po,v.createImage=lo,v.createJournal=j,v.createWebpage=at,v.directLinkOnly=Vl,v.fromOpenUrl=bo,v.getBaseBookmarkingUrl=Gm,v.getLibraryVersion=ur,v.isCustomer=Eo,v.isCustomerList=$o,v.isDirectLinkOnlyResult=nh,v.isGenre=ql,v.isNothingParsedResult=oh,v.isOpenUrlResult=lt,v.isParserRegistry=cm,v.isParserType=vs,v.isParsingMetadata=th,v.isParsingMetadataV2=rh,v.isParsingRequest=jl,v.isParsingResponse=Qp,v.isParsingResponseV2=eh,v.isParsingResult=Kp,v.isResourceData=hm,v.isSiteRegistration=um,v.isSummonSearchResult=Do,v.isTenant=Ao,v.isTenantRegion=Dl,v.isUrlMatcher=lm,v.isZ3988SearchResult=jo,v.nothingParsed=q,v.openUrlResource=A,v.parseResource=di,v.parseResourceV2=Mm,v.summonSearchResult=ko,v.toBookmarkingWorkflowUrl=Xm,v.toOpenUrl=go,v.z3988SearchResult=Io,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})}));
20
+ `)}g.write("payload.value = newResult;"),g.write("return payload;");const K=g.compile();return(T,U)=>K(m,T,U)};let s;const i=Qe,a=!kn.jitless,u=a&&Ci.value,l=t.catchall;let f;e._zod.parse=(m,g)=>{f??(f=n.value);const C=m.value;return i(C)?a&&u&&g?.async===!1&&g.jitless!==!0?(s||(s=o(t.shape)),m=s(m,g),l?Wn([],C,m,g,f,e):m):r(m,g):(m.issues.push({expected:"object",code:"invalid_type",input:C,inst:e}),m)}});function Gn(e,t,r,n){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Le(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>_e(i,n,ve())))}),t)}const vc=d("$ZodUnion",(e,t)=>{X.init(e,t),V(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),V(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),V(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),V(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Nt(s.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(r)return n(o,s);let i=!1;const a=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(c=>Gn(c,o,e,s)):Gn(a,o,e,s)}}),bc=d("$ZodIntersection",(e,t)=>{X.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Xn(r,c,u)):Xn(r,s,i)}});function qt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ne(e)&&Ne(t)){const r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};for(const s of n){const i=qt(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=e[n],s=t[n],i=qt(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Xn(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),Le(e))return e;const n=qt(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const _c=d("$ZodRecord",(e,t)=>{X.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Ne(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;const s=[];if(t.keyType._zod.values){const i=t.keyType._zod.values;r.value={};for(const c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){const u=t.valueType._zod.run({value:o[c],issues:[]},n);u instanceof Promise?s.push(u.then(l=>{l.issues.length&&r.issues.push(...xe(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(...xe(c,u.issues)),r.value[c]=u.value)}let a;for(const c in o)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{r.value={};for(const i of Reflect.ownKeys(o)){if(i==="__proto__")continue;const a=t.keyType._zod.run({value:i,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(u=>_e(u,n,ve())),input:i,path:[i],inst:e}),r.value[a.value]=a.value;continue}const c=t.valueType._zod.run({value:o[i],issues:[]},n);c instanceof Promise?s.push(c.then(u=>{u.issues.length&&r.issues.push(...xe(i,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...xe(i,c.issues)),r.value[a.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}}),yc=d("$ZodEnum",(e,t)=>{X.init(e,t);const r=Ii(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Pi.has(typeof o)).map(o=>typeof o=="string"?ze(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),Sc=d("$ZodLiteral",(e,t)=>{if(X.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?ze(r):r?ze(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,n)=>{const o=r.value;return e._zod.values.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),Ec=d("$ZodTransform",(e,t)=>{X.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new In(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new Oe;return r.value=o,r}});function Hn(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Ac=d("$ZodOptional",(e,t)=>{X.init(e,t),e._zod.optin="optional",e._zod.optout="optional",V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),V(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Nt(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Hn(s,r.value)):Hn(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),$c=d("$ZodNullable",(e,t)=>{X.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Nt(r.source)}|null)$`):void 0}),V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Rc=d("$ZodDefault",(e,t)=>{X.init(e,t),e._zod.optin="optional",V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Yn(s,t)):Yn(o,t)}});function Yn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const wc=d("$ZodPrefault",(e,t)=>{X.init(e,t),e._zod.optin="optional",V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Ic=d("$ZodNonOptional",(e,t)=>{X.init(e,t),V(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Kn(s,e)):Kn(o,e)}});function Kn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const kc=d("$ZodCatch",(e,t)=>{X.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>_e(i,n,ve()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(s=>_e(s,n,ve()))},input:r.value}),r.issues=[]),r)}}),Cc=d("$ZodPipe",(e,t)=>{X.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>st(i,t.in,n)):st(s,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>st(s,t.out,n)):st(o,t.out,n)}});function st(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Pc=d("$ZodReadonly",(e,t)=>{X.init(e,t),V(e._zod,"propValues",()=>t.innerType._zod.propValues),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Qn):Qn(o)}});function Qn(e){return e.value=Object.freeze(e.value),e}const Oc=d("$ZodCustom",(e,t)=>{se.init(e,t),X.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>eo(s,r,n,e));eo(o,r,n,e)}});function eo(e,t,r,n){if(!e){const o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(De(o))}}class Nc{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function zc(){return new Nc}const it=zc();function Lc(e,t){return new e({type:"string",...$(t)})}function xc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...$(t)})}function to(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...$(t)})}function Tc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...$(t)})}function qc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...$(t)})}function Zc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...$(t)})}function Dc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...$(t)})}function ro(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...$(t)})}function jc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...$(t)})}function Bc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...$(t)})}function Uc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...$(t)})}function Vc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...$(t)})}function Fc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...$(t)})}function Jc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...$(t)})}function Mc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...$(t)})}function Wc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...$(t)})}function Gc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...$(t)})}function Xc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...$(t)})}function Hc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...$(t)})}function Yc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...$(t)})}function Kc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...$(t)})}function Qc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...$(t)})}function eu(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...$(t)})}function tu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...$(t)})}function ru(e,t){return new e({type:"string",format:"date",check:"string_format",...$(t)})}function nu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...$(t)})}function ou(e,t){return new e({type:"string",format:"duration",check:"string_format",...$(t)})}function su(e,t){return new e({type:"number",checks:[],...$(t)})}function iu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...$(t)})}function au(e,t){return new e({type:"null",...$(t)})}function cu(e){return new e({type:"unknown"})}function uu(e,t){return new e({type:"never",...$(t)})}function no(e,t){return new Bn({check:"less_than",...$(t),value:e,inclusive:!1})}function Zt(e,t){return new Bn({check:"less_than",...$(t),value:e,inclusive:!0})}function oo(e,t){return new Un({check:"greater_than",...$(t),value:e,inclusive:!1})}function Dt(e,t){return new Un({check:"greater_than",...$(t),value:e,inclusive:!0})}function so(e,t){return new Ra({check:"multiple_of",...$(t),value:e})}function io(e,t){return new Ia({check:"max_length",...$(t),maximum:e})}function at(e,t){return new ka({check:"min_length",...$(t),minimum:e})}function ao(e,t){return new Ca({check:"length_equals",...$(t),length:e})}function lu(e,t){return new Pa({check:"string_format",format:"regex",...$(t),pattern:e})}function pu(e){return new Oa({check:"string_format",format:"lowercase",...$(e)})}function hu(e){return new Na({check:"string_format",format:"uppercase",...$(e)})}function fu(e,t){return new za({check:"string_format",format:"includes",...$(t),includes:e})}function mu(e,t){return new La({check:"string_format",format:"starts_with",...$(t),prefix:e})}function du(e,t){return new xa({check:"string_format",format:"ends_with",...$(t),suffix:e})}function je(e){return new Ta({check:"overwrite",tx:e})}function gu(e){return je(t=>t.normalize(e))}function vu(){return je(e=>e.trim())}function bu(){return je(e=>e.toLowerCase())}function _u(){return je(e=>e.toUpperCase())}function yu(e,t,r){return new e({type:"array",element:t,...$(r)})}function Su(e,t,r){const n=$(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Eu(e,t,r){return new e({type:"custom",check:"custom",fn:t,...$(r)})}function Au(e){const t=$u(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(De(n,r.value,t._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(De(o))}},e(r.value,r)));return t}function $u(e,t){const r=new se({check:"custom",...$(t)});return r._zod.check=e,r}const Ru=d("ZodISODateTime",(e,t)=>{Ha.init(e,t),H.init(e,t)});function wu(e){return tu(Ru,e)}const Iu=d("ZodISODate",(e,t)=>{Ya.init(e,t),H.init(e,t)});function ku(e){return ru(Iu,e)}const Cu=d("ZodISOTime",(e,t)=>{Ka.init(e,t),H.init(e,t)});function Pu(e){return nu(Cu,e)}const Ou=d("ZodISODuration",(e,t)=>{Qa.init(e,t),H.init(e,t)});function Nu(e){return ou(Ou,e)}const ce=d("ZodError",(e,t)=>{Ln.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Bi(e,r)},flatten:{value:r=>ji(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Ct,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Ct,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),zu=Lt(ce),Lu=xt(ce),xu=tt(ce),Tu=rt(ce),qu=Fi(ce),Zu=Ji(ce),Du=Mi(ce),ju=Wi(ce),Bu=Gi(ce),Uu=Xi(ce),Vu=Hi(ce),Fu=Yi(ce),Y=d("ZodType",(e,t)=>(X.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(we(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>be(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>zu(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>xu(e,r,n),e.parseAsync=async(r,n)=>Lu(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Tu(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>qu(e,r,n),e.decode=(r,n)=>Zu(e,r,n),e.encodeAsync=async(r,n)=>Du(e,r,n),e.decodeAsync=async(r,n)=>ju(e,r,n),e.safeEncode=(r,n)=>Bu(e,r,n),e.safeDecode=(r,n)=>Uu(e,r,n),e.safeEncodeAsync=async(r,n)=>Vu(e,r,n),e.safeDecodeAsync=async(r,n)=>Fu(e,r,n),e.refine=(r,n)=>e.check(xl(r,n)),e.superRefine=r=>e.check(Tl(r)),e.overwrite=r=>e.check(je(r)),e.optional=()=>fe(e),e.nullable=()=>bo(e),e.nullish=()=>fe(bo(e)),e.nonoptional=r=>kl(e,r),e.array=()=>B(e),e.or=r=>he([e,r]),e.and=r=>bl(e,r),e.transform=r=>yo(e,El(r)),e.default=r=>Rl(e,r),e.prefault=r=>Il(e,r),e.catch=r=>Pl(e,r),e.pipe=r=>yo(e,r),e.readonly=()=>zl(e),e.describe=r=>{const n=e.clone();return it.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return it.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return it.get(e);const n=e.clone();return it.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),co=d("_ZodString",(e,t)=>{Tt.init(e,t),Y.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(lu(...n)),e.includes=(...n)=>e.check(fu(...n)),e.startsWith=(...n)=>e.check(mu(...n)),e.endsWith=(...n)=>e.check(du(...n)),e.min=(...n)=>e.check(at(...n)),e.max=(...n)=>e.check(io(...n)),e.length=(...n)=>e.check(ao(...n)),e.nonempty=(...n)=>e.check(at(1,...n)),e.lowercase=n=>e.check(pu(n)),e.uppercase=n=>e.check(hu(n)),e.trim=()=>e.check(vu()),e.normalize=(...n)=>e.check(gu(...n)),e.toLowerCase=()=>e.check(bu()),e.toUpperCase=()=>e.check(_u())}),Ju=d("ZodString",(e,t)=>{Tt.init(e,t),co.init(e,t),e.email=r=>e.check(xc(Mu,r)),e.url=r=>e.check(ro(lo,r)),e.jwt=r=>e.check(eu(cl,r)),e.emoji=r=>e.check(jc(Gu,r)),e.guid=r=>e.check(to(uo,r)),e.uuid=r=>e.check(Tc(ct,r)),e.uuidv4=r=>e.check(qc(ct,r)),e.uuidv6=r=>e.check(Zc(ct,r)),e.uuidv7=r=>e.check(Dc(ct,r)),e.nanoid=r=>e.check(Bc(Xu,r)),e.guid=r=>e.check(to(uo,r)),e.cuid=r=>e.check(Uc(Hu,r)),e.cuid2=r=>e.check(Vc(Yu,r)),e.ulid=r=>e.check(Fc(Ku,r)),e.base64=r=>e.check(Yc(sl,r)),e.base64url=r=>e.check(Kc(il,r)),e.xid=r=>e.check(Jc(Qu,r)),e.ksuid=r=>e.check(Mc(el,r)),e.ipv4=r=>e.check(Wc(tl,r)),e.ipv6=r=>e.check(Gc(rl,r)),e.cidrv4=r=>e.check(Xc(nl,r)),e.cidrv6=r=>e.check(Hc(ol,r)),e.e164=r=>e.check(Qc(al,r)),e.datetime=r=>e.check(wu(r)),e.date=r=>e.check(ku(r)),e.time=r=>e.check(Pu(r)),e.duration=r=>e.check(Nu(r))});function h(e){return Lc(Ju,e)}const H=d("ZodStringFormat",(e,t)=>{M.init(e,t),co.init(e,t)}),Mu=d("ZodEmail",(e,t)=>{Ba.init(e,t),H.init(e,t)}),uo=d("ZodGUID",(e,t)=>{Da.init(e,t),H.init(e,t)}),ct=d("ZodUUID",(e,t)=>{ja.init(e,t),H.init(e,t)}),lo=d("ZodURL",(e,t)=>{Ua.init(e,t),H.init(e,t)});function Wu(e){return ro(lo,e)}const Gu=d("ZodEmoji",(e,t)=>{Va.init(e,t),H.init(e,t)}),Xu=d("ZodNanoID",(e,t)=>{Fa.init(e,t),H.init(e,t)}),Hu=d("ZodCUID",(e,t)=>{Ja.init(e,t),H.init(e,t)}),Yu=d("ZodCUID2",(e,t)=>{Ma.init(e,t),H.init(e,t)}),Ku=d("ZodULID",(e,t)=>{Wa.init(e,t),H.init(e,t)}),Qu=d("ZodXID",(e,t)=>{Ga.init(e,t),H.init(e,t)}),el=d("ZodKSUID",(e,t)=>{Xa.init(e,t),H.init(e,t)}),tl=d("ZodIPv4",(e,t)=>{ec.init(e,t),H.init(e,t)}),rl=d("ZodIPv6",(e,t)=>{tc.init(e,t),H.init(e,t)}),nl=d("ZodCIDRv4",(e,t)=>{rc.init(e,t),H.init(e,t)}),ol=d("ZodCIDRv6",(e,t)=>{nc.init(e,t),H.init(e,t)}),sl=d("ZodBase64",(e,t)=>{oc.init(e,t),H.init(e,t)}),il=d("ZodBase64URL",(e,t)=>{ic.init(e,t),H.init(e,t)}),al=d("ZodE164",(e,t)=>{ac.init(e,t),H.init(e,t)}),cl=d("ZodJWT",(e,t)=>{uc.init(e,t),H.init(e,t)}),po=d("ZodNumber",(e,t)=>{Fn.init(e,t),Y.init(e,t),e.gt=(n,o)=>e.check(oo(n,o)),e.gte=(n,o)=>e.check(Dt(n,o)),e.min=(n,o)=>e.check(Dt(n,o)),e.lt=(n,o)=>e.check(no(n,o)),e.lte=(n,o)=>e.check(Zt(n,o)),e.max=(n,o)=>e.check(Zt(n,o)),e.int=n=>e.check(fo(n)),e.safe=n=>e.check(fo(n)),e.positive=n=>e.check(oo(0,n)),e.nonnegative=n=>e.check(Dt(0,n)),e.negative=n=>e.check(no(0,n)),e.nonpositive=n=>e.check(Zt(0,n)),e.multipleOf=(n,o)=>e.check(so(n,o)),e.step=(n,o)=>e.check(so(n,o)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function ho(e){return su(po,e)}const ul=d("ZodNumberFormat",(e,t)=>{lc.init(e,t),po.init(e,t)});function fo(e){return iu(ul,e)}const ll=d("ZodNull",(e,t)=>{pc.init(e,t),Y.init(e,t)});function ut(e){return au(ll,e)}const pl=d("ZodUnknown",(e,t)=>{hc.init(e,t),Y.init(e,t)});function mo(){return cu(pl)}const hl=d("ZodNever",(e,t)=>{fc.init(e,t),Y.init(e,t)});function fl(e){return uu(hl,e)}const ml=d("ZodArray",(e,t)=>{mc.init(e,t),Y.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(at(r,n)),e.nonempty=r=>e.check(at(1,r)),e.max=(r,n)=>e.check(io(r,n)),e.length=(r,n)=>e.check(ao(r,n)),e.unwrap=()=>e.element});function B(e,t){return yu(ml,e,t)}const dl=d("ZodObject",(e,t)=>{gc.init(e,t),Y.init(e,t),V(e,"shape",()=>t.shape),e.keyof=()=>Be(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:mo()}),e.loose=()=>e.clone({...e._zod.def,catchall:mo()}),e.strict=()=>e.clone({...e._zod.def,catchall:fl()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>xi(e,r),e.safeExtend=r=>Ti(e,r),e.merge=r=>qi(e,r),e.pick=r=>zi(e,r),e.omit=r=>Li(e,r),e.partial=(...r)=>Zi(vo,e,r[0]),e.required=(...r)=>Di(_o,e,r[0])});function I(e,t){const r={type:"object",shape:e??{},...$(t)};return new dl(r)}const gl=d("ZodUnion",(e,t)=>{vc.init(e,t),Y.init(e,t),e.options=t.options});function he(e,t){return new gl({type:"union",options:e,...$(t)})}const vl=d("ZodIntersection",(e,t)=>{bc.init(e,t),Y.init(e,t)});function bl(e,t){return new vl({type:"intersection",left:e,right:t})}const _l=d("ZodRecord",(e,t)=>{_c.init(e,t),Y.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function go(e,t,r){return new _l({type:"record",keyType:e,valueType:t,...$(r)})}const jt=d("ZodEnum",(e,t)=>{yc.init(e,t),Y.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{const s={};for(const i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new jt({...t,checks:[],...$(o),entries:s})},e.exclude=(n,o)=>{const s={...t.entries};for(const i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new jt({...t,checks:[],...$(o),entries:s})}});function Be(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new jt({type:"enum",entries:r,...$(t)})}const yl=d("ZodLiteral",(e,t)=>{Sc.init(e,t),Y.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function W(e,t){return new yl({type:"literal",values:Array.isArray(e)?e:[e],...$(t)})}const Sl=d("ZodTransform",(e,t)=>{Ec.init(e,t),Y.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new In(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(De(s,r.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(De(i))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function El(e){return new Sl({type:"transform",transform:e})}const vo=d("ZodOptional",(e,t)=>{Ac.init(e,t),Y.init(e,t),e.unwrap=()=>e._zod.def.innerType});function fe(e){return new vo({type:"optional",innerType:e})}const Al=d("ZodNullable",(e,t)=>{$c.init(e,t),Y.init(e,t),e.unwrap=()=>e._zod.def.innerType});function bo(e){return new Al({type:"nullable",innerType:e})}const $l=d("ZodDefault",(e,t)=>{Rc.init(e,t),Y.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Rl(e,t){return new $l({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Nn(t)}})}const wl=d("ZodPrefault",(e,t)=>{wc.init(e,t),Y.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Il(e,t){return new wl({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Nn(t)}})}const _o=d("ZodNonOptional",(e,t)=>{Ic.init(e,t),Y.init(e,t),e.unwrap=()=>e._zod.def.innerType});function kl(e,t){return new _o({type:"nonoptional",innerType:e,...$(t)})}const Cl=d("ZodCatch",(e,t)=>{kc.init(e,t),Y.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Pl(e,t){return new Cl({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Ol=d("ZodPipe",(e,t)=>{Cc.init(e,t),Y.init(e,t),e.in=t.in,e.out=t.out});function yo(e,t){return new Ol({type:"pipe",in:e,out:t})}const Nl=d("ZodReadonly",(e,t)=>{Pc.init(e,t),Y.init(e,t),e.unwrap=()=>e._zod.def.innerType});function zl(e){return new Nl({type:"readonly",innerType:e})}const So=d("ZodCustom",(e,t)=>{Oc.init(e,t),Y.init(e,t)});function Ll(e,t){return Su(So,e??(()=>!0),t)}function xl(e,t={}){return Eu(So,e,t)}function Tl(e){return Au(e)}var S=(e=>(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))(S||{});const ql=he([W("book"),W("bookitem"),W("conference"),W("document"),W("report"),W("proceeding"),W("unknown")]),Zl=he([W("article"),W("conference"),W("issue"),W("journal"),W("preprint"),W("proceeding"),W("unknown")]),de=I({artnum:h(),atitle:h(),aufirst:h(),aulast:h(),auinit:h(),auinit1:h(),auinitm:h(),ausuffix:h(),au:B(h()),aucorp:h(),bici:h(),btitle:h(),chron:h(),coden:h(),date:h(),edition:h(),eissn:h(),epage:h(),externalDBID:h(),externalDocID:h(),genre:Be(S),id:h(),isbn:h(),issn:h(),issue:h(),jtitle:h(),pages:h(),part:h(),place:h(),pub:h(),quarter:h(),rft_id:B(h()),series:h(),sici:h(),spage:h(),ssn:h(),stitle:h(),title:h(),tpages:h(),volume:h()}).partial(),Bt=I({bibid:h(),doi:h(),uri:h()}).partial(),Dl=de.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(),jl=de.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(),Bl=de.pick({au:!0,date:!0,isbn:!0,pub:!0,title:!0}).partial(),Ul=de.pick({au:!0,date:!0,pub:!0,title:!0}).partial(),Vl=de.pick({au:!0,date:!0,pub:!0,title:!0,spage:!0,epage:!0}).partial(),Fl=de.pick({au:!0,date:!0,title:!0}).partial(),Eo=I({...de.shape,...Bt.shape}),F=(e,t)=>({...t,genre:e}),Z=(e,t)=>({...t,genre:e}),me=e=>({...e,genre:S.AudioVisualDocument}),Ao=e=>({...e,genre:S.Image}),Ut=e=>({...e,genre:S.Document}),lt=e=>({...e,genre:S.Webpage}),$o=e=>Object.keys(e.shape),Ro=$o(de),Vt=$o(Bt),Jl=(e,t,r)=>{if(r.length>0&&typeof r[0]=="string"){const n=t.startsWith("rft_")?t:`rft.${t}`;e.append(n,r[0])}},Ml=(e,t,r)=>{e.append(t,r)},Wl=(e,t,r)=>{e.append(`rft.${t}`,r)},wo=e=>Vt.includes(e),Io=e=>{const t=new URLSearchParams;return Object.entries(e).forEach(([r,n])=>{Array.isArray(n)?Jl(t,r,n):typeof n=="string"&&n&&(wo(r)?Ml(t,r,n):Wl(t,r,n))}),t},ko=(e,t,r,n)=>{const o=t.getAll(r).filter(s=>!!s).map(s=>s.trim());return o.length===0?e:{...e,[n]:o}},Co=e=>{const t=Gl(e),r=(o,s)=>{if(s==="au")return ko(o,t,"rft.au","au");if(s==="rft_id")return ko(o,t,"rft_id","rft_id");const i=wo(s)?s:`rft.${s}`,a=t.get(i);return a?{...o,[s]:a.trim()}:o},n=[...Ro,...Vt].reduce(r,{});return Object.keys(n).length===0?null:n},Gl=e=>URL.canParse(e)?new URL(e).searchParams:new URLSearchParams(e);function Xl(e){return typeof e!="string"?!1:Object.values(S).includes(e)}var ye=(e=>(e.CA="CA",e.EUAPAC="EUAPAC",e))(ye||{});const Ft=I({id:h(),name:h(),region:Be(ye)}),Hl=I({tenants:B(Ft)}),Po=9*1024*1024,Oo=I({url:Wu({error:e=>e.input===void 0?'should have the required string property "url"':'"url" must be a string'}),html:h({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:h({error:e=>e.input===void 0?'should have the required string property "tenantCode"':void 0}).min(1,{error:'"tenantCode" must be a string'}),region:Be([ye.EUAPAC,ye.CA],{error:e=>e.input===void 0?'should have the required string property "region"':'"region" must be a string of EUAPAC or CA'})});function Yl(e){return Oo.safeParse(e).success}const Jt=I({name:h(),region:Be(ye),apps:go(h(),h())}),No=go(h(),Jt),zo=e=>Jt.safeParse(e).success,Lo=e=>No.safeParse(e).success;function xo(e){return Ft.safeParse(e).success}function Kl(e){return typeof e=="string"&&Object.keys(ye).includes(e)}const Ql=e=>{if(!Lo(e))throw new Error("Error: the customer list data is invalid.");return{tenants:Object.entries(e).map(([r,n])=>ep(r,n))}},ep=(e,t)=>{if(!zo(t))throw new Error(`Invalid customer: ${t}`);const{name:r,region:n}=t,o={id:e,name:r,region:n};if(!xo(o))throw new Error(`Invalid tenant: ${JSON.stringify(o)}`);return o},Mt=I({parserType:h(),parserName:h().nullable(),uri:h(),referrer:h()}),Wt=I({parserType:h(),parserName:h().nullable(),referrer:h()}),Gt=I({bookmarkingWorkflowUrl:ut(),resource:ut()}),Xt=I({bookmarkingWorkflowUrl:h(),resource:ut()}),Ht=I({bookmarkingWorkflowUrl:ut(),resource:Eo}),Yt=I({z3988SearchResult:W(!0)}),Kt=I({summonSearchResult:W(!0)}),pt=he([Xt,Gt,Ht,Yt,Kt]),To=I({meta:Mt}).and(pt),qo=I({meta:Wt}).and(pt);function tp(e){return{bookmarkingWorkflowUrl:e,resource:null}}function x(){return{bookmarkingWorkflowUrl:null,resource:null}}function A(e){return{bookmarkingWorkflowUrl:null,resource:e}}function Zo(){return{z3988SearchResult:!0}}function Do(){return{summonSearchResult:!0}}const rp=e=>{const t=e.getAttribute("title");return t?Co(t):null},Qt=({document:e})=>{const t=Array.from(e.querySelectorAll(".Z3988"));if(t.length===0)return x();const r=t.map(rp).find(n=>n!==null);return r?A(r):x()},np=e=>{const t=Array.from(e.querySelectorAll(".author > a")).map(r=>r.textContent.trim()).filter(Boolean);return t.length?t:void 0},op=e=>e.querySelector("#rpi-attribute-book_details-edition > .rpi-attribute-value > span")?.textContent??void 0,sp=e=>{const t=e.querySelector("#rpi-attribute-book_details-isbn10 > .rpi-attribute-value > span")?.textContent??void 0,r=e.querySelector("#rpi-attribute-book_details-isbn13 > .rpi-attribute-value > span")?.textContent??void 0;if(t&&r)return`${t},${r}`;if(t)return t;if(r)return r},ip=e=>e.querySelector("#rpi-attribute-book_details-publication_date > .rpi-attribute-value > span")?.textContent??void 0,ap=e=>e.querySelector("#rpi-attribute-book_details-publisher > .rpi-attribute-value > span")?.textContent??void 0,cp=e=>e.querySelector("#rpi-attribute-book_details-series > .rpi-attribute-value > a")?.textContent??void 0,up=e=>{const 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},lp=({url:e,document:t})=>{const r=np(t),n=op(t),o=sp(t),s=ip(t),i=ap(t),a=cp(t),c=t.getElementById("productTitle")?.textContent.trim()??void 0,u=up(t);return{bookmarkingWorkflowUrl:null,resource:F(S.Book,{au:r,date:s,edition:n,isbn:o,pub:i,series:a,title:c,tpages:u,uri:e})}},p=(e,t,r)=>{const n=te(e,t,r);return n.length>0?n[0]:void 0},te=(e,t,r)=>Array.from(e.querySelectorAll(`meta[${t}='${r}']`)).map(n=>n.getAttribute("content")).filter(n=>!!n?.trim()),jo=e=>{const t=new Map,r=e.split(";").filter(n=>!!n);for(const n of r){const[o,s,i]=n.split(":");t.set(o,{type:s,value:i})}return t};var v=(e=>(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))(v||{});const pp=e=>{if(!e)return;const t=/\b\d{4}\b/.exec(e);return t?t[0]:void 0},Ue=e=>{const t=e.querySelector("#publication_date p")?.textContent.trim()??p(e,"name","bepress_citation_date");return pp(t)},hp=e=>{const t=p(e,"name","bepress_citation_firstpage"),r=p(e,"name","bepress_citation_lastpage");return{spage:t,epage:r}},er=e=>{const t=/https?:\/\/doi\.org\/(.+)/i,n=e.querySelector("#source p")?.textContent.trim()?.match(t);if(n?.length===2)return n[1];const s=e.querySelector("#recommended_citation p a")?.textContent.trim()?.match(t);if(s?.length===2)return s[1]},fp=e=>{const t=[],r=e.querySelectorAll("tbody td");for(const n of r){const o=n.querySelector("strong");if(o&&!o.querySelector("a")){const s=o.textContent.trim();s&&t.push(s)}}return t},Ve=e=>p(e,"name","bepress_citation_title")??e.querySelector("title")?.textContent.trim(),ht=e=>te(e,"name","author"),ft=e=>p(e,"name","bepress_citation_publisher"),tr=e=>p(e,"name","bepress_citation_pdf_url"),mp=(e,t)=>{if(t.includes("/etd/"))return v.Document;if(t.includes("/sophpm_music/")||t.includes("/streaming/"))return v.AudioVisual;if(t.includes("/vol"))return v.Article;if(t.includes("/facpub")||t.includes("/studentpub/")){const r={"book chapter":v.Book,"conference paper":v.Book,"peer-reviewed article":v.Article,other:v.Document},n=e.querySelector("#document_type p")?.textContent.toLowerCase().trim();return n?r[n]:void 0}return v.Journal},dp=e=>{const t=Ve(e),r=ht(e),n=Ue(e),o=p(e,"name","bepress_citation_journal_title"),s=p(e,"name","bepress_citation_volume"),i=p(e,"name","bepress_citation_issue"),{epage:a,spage:c}=hp(e),u=tr(e),l=er(e);return Z(S.Article,{atitle:t,jtitle:o,au:r,date:n,volume:s,issue:i,epage:a,spage:c,doi:l,uri:u})},gp=(e,t)=>{const r=e.querySelector(".inherit-title a")?.textContent.trim()??Ve(e),n=fp(e),o=Ue(e),s=ft(e),i=er(e);return Z(S.Journal,{jtitle:r,au:n,date:o,pub:s,doi:i,uri:t})},vp=e=>{const t=Ve(e),r=ht(e),n=Ue(e),o=ft(e),s=tr(e),i=e.querySelector("#document_type p")?.textContent.toLowerCase().trim();if(i==="book chapter"){const c=e.querySelector("#source p")?.textContent.trim();return F(S.Bookitem,{pub:o,atitle:t,btitle:c,au:r,date:n,uri:s})}const a=er(e);return i==="conference paper"?F(S.Conference,{pub:o,title:t,au:r,date:n,doi:a,uri:s}):F(S.Document,{pub:o,title:t,au:r,date:n,doi:a,uri:s})},bp=(e,t)=>{const r=Ve(e),n=ht(e),o=Ue(e),s=ft(e);return me({title:r,au:n,date:o,pub:s,uri:t})},_p=e=>{const t=Ve(e),r=ht(e),n=Ue(e),o=ft(e),s=tr(e);return Ut({pub:o,title:t,au:r,date:n,uri:s})},yp=({url:e,document:t})=>{switch(mp(t,e)){case v.Article:return A(dp(t));case v.Journal:return A(gp(t,e));case v.Book:return A(vp(t));case v.AudioVisual:return A(bp(t,e));case v.Document:return A(_p(t));default:return x()}},ge=e=>{if(e)return e.replace(/[^0-9]/g,"")},Bo=e=>Array.from(e.querySelectorAll(".author-source-list li a")).filter(t=>t.childNodes.length>0).map(t=>t.childNodes[0].textContent?.trim()).filter(t=>!!t),Uo=e=>e.querySelector(".article-header")?.querySelector("h1 span")?.textContent.trim(),Vo=e=>({date:e?.textContent.match(/\d{4}/)?.[0],pub:"Elsevier Inc."}),Sp=e=>{const t=e.querySelector(".article-meta");if(!t)return{};const r=t.querySelector(".issue")?.textContent??void 0,n=t.querySelector(".title")?.textContent.trim()??void 0,[o,s]=(r?.split(",")??[]).map(i=>i.trim());return{volume:ge(o),issue:ge(s),jtitle:n}},Ep=e=>{const t=e.querySelector(".article-header .source")?.textContent,r=t?.match(/\d{4}-\d{2}-\d{2}/)?.[0],n=t?.match(/Pages (\d+-\d+)/),[o,s]=(n?.[1].split("-")??[]).map(u=>u.trim()),{jtitle:i,volume:a,issue:c}=Sp(e);return A(Z(S.Article,{au:Bo(e),atitle:Uo(e),spage:o,epage:s,date:r,jtitle:i,volume:a,issue:c}))},Ap=e=>{const[t,r]=e.querySelectorAll(".source"),{date:n,pub:o}=Vo(r),s=e.querySelector(".browse__book-toc"),[i,a]=(s?.querySelector("h1")?.textContent.split(",")??[]).map(c=>c.trim());return A(F(S.Book,{btitle:i,edition:a,pub:o,au:t.textContent?[t.textContent]:void 0,date:n}))},$p=e=>{const t=e.querySelector(".article-meta");if(!t)return{};const r=t.querySelector(".edition")?.textContent??void 0,n=t.querySelector(".title")?.textContent.trim()??void 0,o=t.querySelector(".copyright"),{date:s,pub:i}=Vo(o);return{edition:r,btitle:n,date:s,pub:i}},Rp=e=>{const{edition:t,btitle:r,date:n,pub:o}=$p(e),s=e.querySelector(".article-header .source")?.textContent,i=/(\d+-\d+|[IVXLCDM]+-[IVXLCDM]+)/i,a=s?.match(i),[c,u]=(a?.[1].split("-")??[]).map(l=>l.trim());return A(F(S.Bookitem,{au:Bo(e),atitle:Uo(e),btitle:r,edition:t,pub:o,date:n,spage:c,epage:u}))},wp=/^[0-9X]$/,rr=e=>{if(!e)return;let t="";for(const r of e)wp.test(r)&&(t+=r);if(t)return t},Ip=(e,t)=>{const r=e.querySelector(".c-cksc-content-header__title")?.textContent.trim(),n=e.querySelector(".c-cksc-content-nice__button")?.textContent.trim(),o=e.querySelector(".c-cksc-content-nice__date")?.textContent.trim(),s=e.evaluate('//p[contains(text(), "ISBN")]',e,null,XPathResult.ANY_TYPE),i=rr(s.iterateNext()?.textContent);return A({genre:S.Document,title:r,pub:n,date:o,uri:t,isbn:i})},Fo=e=>e.querySelector(".browse-toc")??e.querySelector(".browse__journal"),kp=e=>Fo(e)?.querySelector("h1")?.firstElementChild?.textContent.trim(),Cp=e=>{const t=Fo(e),r=t?.querySelector("figure figcaption.source");if(r){const[a,c,u]=r.textContent.split(",").map(l=>l.trim());return{date:a,volume:ge(c),issue:ge(u)}}const n=t?.querySelector("p")?.textContent,[o,s]=n?.split(",")??[];return{date:t?.querySelector(".source span")?.textContent??void 0,volume:ge(o),issue:ge(s)}},Pp=e=>{const{date:t,volume:r,issue:n}=Cp(e);return A(Z(S.Journal,{jtitle:kp(e),date:t,volume:r,issue:n}))};var Jo=(e=>(e.Book="Book",e.Chapter="Book Chapter",e.Article="Full Text Article",e.Journal="Journal",e.Guideline="Guideline",e))(Jo||{});const Op=e=>Object.values(Jo).includes(e),Np=(e,t)=>{const r=e.querySelector(".content-type")??e.querySelector(".c-cksc-content-header__content-type");if(!r)return t.includes("journal")?"Journal":void 0;const n=r.textContent;if(n&&Op(n))return n},zp=({url:e,document:t})=>{switch(Np(t,e)){case"Book":return Ap(t);case"Book Chapter":return Rp(t);case"Full Text Article":return Ep(t);case"Journal":return Pp(t);case"Guideline":return Ip(t,e);case void 0:return x()}},Ie=I({"@context":h()}),Lp=e=>Ie.safeParse(e).success,Mo='script[type="application/ld+json"]',Wo=e=>Array.from(e.querySelectorAll(Mo)),mt=e=>e.querySelector(Mo),Fe=e=>{const t=e.textContent;if(!t)return null;try{const r=JSON.parse(t);if(Lp(r))return r}catch{return null}return null},xp=I({"@id":h(),"@type":h(),author:I({"@id":h()}).optional(),datePublished:h().optional(),dateModified:h().optional(),description:h().optional(),inLanguage:h().optional(),isPartOf:I({"@id":h()}).optional(),name:h().optional(),url:h().optional()}),Tp=Ie.extend({"@graph":B(xp)}),qp=e=>Tp.safeParse(e).success,Zp=e=>{const t=Wo(e);if(t.length===0)return null;const r=t.map(Fe).filter(qp).map(n=>n["@graph"]);return r.length!==1?null:r[0]},Dp=(e,t)=>e.find(r=>r["@type"]===t)??null,jp=(e,t)=>e.find(r=>r["@id"]===t)??null,Bp=e=>{const t=Dp(e,"WebPage");if(!t)return null;const r=t.author?jp(e,t.author["@id"]):void 0;return lt({au:r?.name?[r.name]:void 0,date:t.datePublished,title:t.name})},Up=({document:e})=>{const t=Zp(e);return t?{bookmarkingWorkflowUrl:null,resource:Bp(t)}:x()},Go=()=>x(),Vp=e=>{const{pathname:t}=new URL(e);return t.startsWith("/toc/")?"journal":t.startsWith("/article/")?"article":void 0},Fp=e=>{const t=e.querySelector("header h1 span")?.firstChild?.textContent?.trim(),r=e.querySelector("header p span")?.textContent.trim(),n=/\d{4}-\d{3}[\dX]/g,o=r?.match(n)??[],[s,i]=[o[0],o[1]],a=e.evaluate('//dt[contains(text(), "Publisher")]/following-sibling::dd/a',e,null,XPathResult.STRING_TYPE).stringValue.trim();return A(Z(S.Journal,{pub:a,jtitle:t,issn:s,eissn:i}))},Jp=e=>{let t,r;const n=te(e,"name","citation_issn");return n.length===2?(t=n[1],r=n[0]):t=n[0],{eissn:t,issn:r}},Mp=e=>{const t=p(e,"name","citation_journal_title"),r=p(e,"name","citation_title"),n=te(e,"name","citation_author"),o=p(e,"name","citation_doi"),{eissn:s,issn:i}=Jp(e),a=p(e,"name","citation_publisher"),c=p(e,"name","citation_publication_date"),u=p(e,"name","citation_volume"),l=p(e,"name","citation_issue"),f=p(e,"name","citation_firstpage"),m=p(e,"name","citation_lastpage");return A(Z(S.Article,{jtitle:t,atitle:r,au:n,doi:o,eissn:s,issn:i,pub:a,date:c,volume:u,issue:l,spage:f,epage:m}))},Wp=({document:e,url:t})=>{switch(Vp(t)){case"journal":return Fp(e);case"article":return Mp(e);case void 0:return x()}},Gp=e=>{const t=p(e,"name","pbContext");if(!t)return v.None;const r=jo(t);switch(r.has("page")?r.get("page")?.value:null){case"Article/Chapter View":return v.Article;case"Table of Contents":return v.Journal;default:return v.None}},Xp=e=>{const t=e.querySelector('meta[property="article:author"]')?.getAttribute("content")?.split(",").map(r=>r.trim());return t&&t.length>0?t:void 0},Xo=e=>{const t=new Map,r=Array.from(e.querySelectorAll(".rlist>li>span")).map(s=>s.textContent.trim()).join(""),n=/^ISSN:\s(\d{4}-\d{3}(?:\d|X))/.exec(r);n&&t.set("issn",n[1]);const o=/Online ISSN:\s(\d{4}-\d{3}(?:\d|X))/.exec(r);return o&&t.set("eissn",o[1]),t},Hp=e=>e.querySelector('span[property="isPartOf"][typeof="PublicationVolume"] > span[property="volumeNumber"]')?.textContent??void 0,Yp=e=>e.querySelector('span[property="isPartOf"][typeof="PublicationIssue"] > span[property="issueNumber"]')?.textContent??void 0,Kp=e=>e.querySelector('meta[name="dc.Identifier"][scheme="doi"]')?.getAttribute("content")??void 0,Qp=e=>e.querySelector("h1")?.textContent??void 0,eh=e=>{const t=new Map,r=e.querySelector("h2.heading-m")?.textContent,n=r?.match(/Issue\s+(\d+(?:-\d+)?)/);n&&t.set("issue",n[1]);const o=r?.match(/Volume\s+(\d+)/);o&&t.set("volume",o[1]);const s=r?.match(/(\d{4})$/);return s&&t.set("date",s[1]),t},th=e=>{const t=Xp(e.document),r=p(e.document,"name","dc.Date"),n=Kp(e.document),o=Xo(e.document),s=o.get("issn"),i=o.get("eissn"),a=Yp(e.document),c=p(e.document,"name","citation_journal_title"),u=p(e.document,"name","dc.Publisher"),l=p(e.document,"name","dc.Title"),f=Hp(e.document);return Z(S.Article,{au:t,date:r,eissn:i,issn:s,issue:a,jtitle:c,pub:u,title:l,volume:f,doi:n})},rh=e=>{const t=Xo(e.document),r=t.get("issn"),n=t.get("eissn"),o=Qp(e.document),s=eh(e.document),i=s.get("issue"),a=s.get("volume"),c=s.get("date");return Z(S.Journal,{eissn:n,issn:r,jtitle:o,title:o,issue:i,volume:a,date:c})},nh=e=>{switch(Gp(e.document)){case v.Article:return A(th(e));case v.Journal:return A(rh(e));default:return x()}},oh=e=>{const t=p(e,"name","citation_type"),r=p(e,"name","citation_article_type");return t==="JOUR"&&r?v.Article:t==="CHP"?v.Chapter:e.querySelector(".book-edition-year")?.textContent.includes("Book")?v.Book:e.getElementById("journal-title")?v.Journal:v.None},nr=e=>p(e,"name","citation_doi")??p(e,"name","dc.identifier")??e.querySelector(".doi .anchor-text")?.textContent??void 0,sh=e=>{const t=Array.from(e.querySelectorAll(".kf-details .kf-detail-item:has(h3)")),r=new Map;for(const n of t){const o=n.querySelector("h3")?.textContent,s=n.querySelector("p")?.textContent;o&&s&&r.set(o,s)}return r},or=(e,t)=>{const r=Array.from(e.querySelectorAll(t)).map(n=>n.textContent).filter(n=>!!n);return r.length>0?r:void 0},ih=e=>{const t=e.querySelector(".js-issn")?.textContent;if(t)return t.replace("Online ISSN: ","")},ah=e=>{const t=e.get("DOI");if(t)return URL.canParse(t)?new URL(t).pathname.substring(1):t},ch=e=>{const t=sh(e),r=p(e,"property","og:title"),n=p(e,"property","og:book:isbn"),o=t.get("Published"),s=or(e,".authors-container .author-detail h3"),i=nr(e)??ah(t);return F(S.Book,{au:s,date:o,doi:i,isbn:n,title:r})},uh=e=>{const t=p(e,"property","og:title"),r=p(e,"property","og:book:isbn"),n=p(e,"name","citation_publication_date"),o=or(e,".author-group .button-link-text"),s=p(e,"name","citation_firstpage"),i=p(e,"name","citation_lastpage"),a=p(e,"name","citation_publisher"),c=nr(e),u=p(e,"name","citation_inbook_title")??e.querySelector(".publication-title")?.textContent??void 0;return F(S.Bookitem,{au:o,btitle:u,date:n,doi:c,epage:i,isbn:r,pub:a,spage:s,title:t})},lh=e=>{const t=p(e,"property","og:title"),r=p(e,"name","citation_issn"),n=p(e,"name","citation_publication_date"),o=or(e,".author-group .button-link-text"),s=p(e,"name","citation_publisher"),i=p(e,"name","citation_firstpage"),a=p(e,"name","citation_issue"),c=p(e,"name","citation_volume"),u=nr(e),l=p(e,"name","citation_journal_title")??e.querySelector(".publication-title")?.textContent??void 0;return Z(S.Article,{au:o,jtitle:l,date:n,doi:u,issn:r,issue:a,pub:s,spage:i,title:t,volume:c})},ph=e=>{const t=e.getElementById("journal-title")?.textContent??void 0,r=ih(e);return Z(S.Journal,{issn:r,title:t})},hh=({document:e})=>{switch(oh(e)){case v.Book:return A(ch(e));case v.Chapter:return A(uh(e));case v.Article:return A(lh(e));case v.Journal:return A(ph(e));default:return x()}},fh=e=>{const t=p(e,"name","pbContext");return t&&jo(t).has("article")?v.Article:v.Journal},mh=e=>{const t=e.querySelector(".itemPageRangeHistory");if(!t)return;const n=Array.from(t.childNodes).find(o=>o.textContent?.trim().startsWith("Page"));if(n)return n.textContent?.replace(/Pages?/,"").trim()??void 0},dh=e=>{const t=e.querySelector(".issue-heading")?.textContent;return t?t.split(",")[0]?.replace("Volume","").trim():void 0},gh=e=>{const t=e.querySelector(".issue-heading .nav-toc-list")?.textContent;return t?t.replace("Issue","").trim():void 0},vh=e=>{const t=p(e,"property","og:title"),r=p(e,"name","dc.Publisher"),n=p(e,"name","dc.Date"),o=p(e,"name","publication_doi"),s=p(e,"name","citation_journal_title"),i=te(e,"name","dc.Creator"),a=dh(e),c=gh(e),u=mh(e),l=u?.includes("-")?u.split("-")[0]:u,f=u?.includes("-")?u.split("-")[1]:u;return Z(S.Article,{au:i,jtitle:s,date:n,doi:o,issue:c,pub:r,spage:l,epage:f,title:t,volume:a})},bh=e=>{const t=p(e,"property","og:title"),r=p(e,"name","publication_doi");return Z(S.Journal,{doi:r,title:t})},_h=({document:e})=>{switch(fh(e)){case v.Article:return A(vh(e));case v.Journal:return A(bh(e));default:return x()}},yh=e=>pt.safeParse(e).success,Sh=e=>To.safeParse(e).success,Eh=e=>qo.safeParse(e).success,Ah=e=>Mt.safeParse(e).success,$h=e=>Wt.safeParse(e).success;function Rh(e){return Xt.safeParse(e).success}function dt(e){return Ht.safeParse(e).success}function Ho(e){return Yt.safeParse(e).success}function Yo(e){return Kt.safeParse(e).success}function wh(e){return Gt.safeParse(e).success}const Ih=e=>Array.from(e.querySelectorAll("tr th")).find(n=>n.textContent.trim()==="DOI:")?.nextElementSibling?.querySelector('span[property="identifier"]')?.textContent??void 0,kh=e=>{const t=/Record\/(\d+)/.exec(e);if(t&&t.length>1)return t[1]},Ch=e=>{const{url:t,document:r}=e,n=Qt(e);if(!dt(n))return n;const o=Ih(r);return o&&(n.resource.rft_id=[`info:doi/${o}`]),n.resource.bibid=kh(t),n},Ph=Ie.extend({"@type":W("VideoObject"),name:h(),author:h(),genre:h(),description:h(),uploadDate:h(),duration:h(),thumbnailUrl:B(h())}),Oh=e=>Ph.safeParse(e).success,Nh=e=>{const t=Wo(e);if(t.length===0)return null;const r=t.map(Fe).filter(Oh);return r.length!==1?null:r[0]},zh=({url:e,document:t})=>{const r=Nh(t);return r?{bookmarkingWorkflowUrl:null,resource:me({au:[r.author],date:r.uploadDate,title:r.name,uri:e})}:x()},Ko=e=>p(e,"name","doi")??p(e,"name","DOI")??p(e,"name","citation_doi")??p(e,"name","dc.identifier")??p(e,"name","prism.doi")??void 0,Qo=e=>{const t=e.editor?.map(o=>o.name)??[],n=[...e.author?.map(o=>o.name)??[],...t];if(n.length!==0)return n};var Je=(e=>(e.Book="Book",e.Journal="Journal",e.Periodical="Periodical",e.PublicationVolume="PublicationVolume",e.ScholarlyArticle="ScholarlyArticle",e.VideoObject="VideoObject",e.WebPage="WebPage",e))(Je||{}),Se=(e=>(e.Article="article",e.Book="book",e.Paper="Paper",e.Video="video.other",e.Website="website",e))(Se||{}),ue=(e=>(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))(ue||{});const es=I({"@type":W(Je.ScholarlyArticle),author:B(I({"@type":h(),name:h()})).optional(),editor:B(I({"@type":h(),name:h()})).optional(),datePublished:h().optional(),headline:h().optional(),issn:B(h()).optional(),pageStart:h().optional(),pageEnd:h().optional(),isPartOf:I({"@type":he([h(),B(h())]),name:h(),issn:B(h()).optional(),volumeNumber:h().optional(),isbn:B(h()).optional()}),publisher:I({"@type":h(),name:h()}).optional()}),ts=e=>es.safeParse(e).success,Lh=Ie.extend({"@type":W(Je.WebPage),mainEntity:es}),xh=e=>Lh.safeParse(e).success,Th=I({"@type":B(h()),name:h().optional(),issn:B(h()),volumeNumber:h().optional()}),rs=e=>Th.safeParse(e).success,qh=(e,t)=>p(e,"name","citation_issn")??p(e,"name","prism.issn")??(ts(t.isPartOf)?t.isPartOf.issn?.[0]:void 0),ns=(e,t)=>{const r=Qo(t),n=p(e,"name","citation_online_date"),o=Ko(e),s=p(e,"name","citation_issue"),i=qh(e,t),a=rs(t.isPartOf)&&t.isPartOf.issn.length>0?t.isPartOf.issn[1]:void 0,c=t.pageStart,u=t.pageEnd,l=t.headline,f=t.isPartOf.name,m=rs(t.isPartOf)?t.isPartOf.volumeNumber:void 0;return Z(S.Article,{au:r,date:n,doi:o,issue:s,eissn:i,issn:a,spage:c,epage:u,atitle:l,jtitle:f,volume:m})},Zh=Ie.extend({"@type":W(Je.Book),copyrightYear:h().optional(),author:B(I({"@type":h(),name:h()})).optional(),editor:B(I({"@type":h(),name:h()})).optional(),isbn:h().optional(),name:h().optional(),numberOfPages:ho().optional(),publisher:I({"@type":h(),name:h()}).optional()}),Dh=e=>Zh.safeParse(e).success,jh=e=>{const t=e.querySelectorAll(".c-bibliographic-information__list-item"),r=new Map;return t.forEach(n=>{const o=n.querySelector(".u-text-bold")?.textContent.trim(),s=n.querySelector(".c-bibliographic-information__value")?.textContent.trim();o&&s&&r.set(o,s)}),r},Bh=(e,t)=>{const r=jh(e),n=Qo(t),o=t.copyrightYear?.toString(),s=Ko(e)??r.get("DOI"),i=t.name??r.get("Book Title"),a=t.isbn??r.get("Softcover ISBN"),c=t.numberOfPages?.toString()??r.get("Number of Pages"),u=t.publisher?.name??r.get("Publisher");return F(S.Book,{au:n,date:o,doi:s,title:i,isbn:a,tpages:c,pub:u})},Uh=I({"@type":W("Periodical"),name:h(),url:h(),issn:B(h()),editor:B(I({givenName:h(),familyName:h()})),publisher:I({name:h()}),description:h()}),Vh=e=>Uh.safeParse(e).success,Fh=e=>{const t=e.editor.map(({givenName:i,familyName:a})=>`${i} ${a}`),r=e.name,[n,o]=e.issn,s=e.publisher.name;return Z(S.Journal,{au:t,jtitle:r,eissn:n,issn:o,pub:s})},Jh=I({"@type":W(Je.VideoObject),name:h().optional(),description:h().optional(),thumbnailUrl:h().optional(),uploadDate:h().optional(),contentUrl:h().optional(),duration:h().optional()}),Mh=e=>Jh.safeParse(e).success,Wh=(e,t)=>{const r=Array.from(e.querySelectorAll('dd[data-test="video-segment-author"]')).map(i=>i.textContent.trim()).filter(i=>!!i),n=t?.uploadDate?new Date(t.uploadDate).getFullYear().toString():void 0,o=t?.name??p(e,"property","og:title")??void 0,s=e.querySelector("video-about-doi")?.textContent??void 0;return me({au:r.length>0?r:void 0,date:n,doi:s,title:o})},Gh=e=>{const t=p(e,"property","og:title");return lt({title:t})},Xh=(e,t)=>{const r=p(t,"property","og:type");return r===Se.Article&&e.includes(ue.Article)?v.Article:r===Se.Book&&(e.includes(ue.Book)||e.includes(ue.ReferenceWork))?v.Book:r===Se.Paper&&e.includes(ue.Chapter)?v.Chapter:r===Se.Paper&&(e.includes(ue.ReferenceWorkEntry)||e.includes(ue.Protocol))?v.Article:r===Se.Video&&e.includes(ue.Video)?v.AudioVisual:r===Se.Website&&(e.includes(ue.Collections)||e.includes(ue.JournalIssue))?v.Webpage:r===Se.Website&&e.includes(ue.Journal)?v.Journal:v.None},Hh=(e,t,r)=>e===v.AudioVisual&&Mh(r)?A(Wh(t,r)):e===v.Book&&Dh(r)?A(Bh(t,r)):(e===v.Chapter||e===v.Article)&&ts(r)?A(ns(t,r)):e===v.Article&&xh(r)?A(ns(t,r.mainEntity)):e===v.Journal&&Vh(r)?A(Fh(r)):x(),Yh=({url:e,document:t})=>{const r=Xh(e,t);if(r===v.Webpage)return A(Gh(t));const n=mt(t);if(!n)return x();const o=Fe(n);return o?Hh(r,t,o):x()},Kh=new Set(["Print ISBN","Online ISBN","DOI","First published","Online ISSN","Print ISSN"]),Qh=I({content:I({item:I({title:h(),"published-date":h()}),group:I({volume:h(),issue:h()}),series:I({title:h(),type:h(),eissn:h()})}).optional()}),os=(e,t)=>{if(!e)return;const r=e.indexOf(t);return r>-1?e.substring(0,r):e},sr=e=>{const r=/\d+/.exec(e);if(r?.[0])return r[0]},ef=e=>{const t=e.querySelectorAll("script"),n=Array.from(t).find(o=>o.textContent.includes("adobeDataLayerJson"))?.textContent.match(/var adobeDataLayerJson = (\{.*?});/s);if(n?.length===2)try{const o=JSON.parse(n[1]);return Qh.parse(o)}catch{return}},tf=(e,t)=>{const r=p(e,"property","og:type"),n=t.includes("epdf");return r==="Book"||r==="books.book"?v.Book:r==="Chapter"?v.Chapter:r==="Journal"?v.Journal:r==="Article"||n?v.Article:v.None},gt=e=>{const t=te(e,"name","citation_author"),r=Array.from(e.querySelectorAll("#product-details-content .product-authors")).map(o=>o.textContent).filter(o=>!!o),n=new Set([...t,...r]);return n.size>0?[...n]:void 0},rf=e=>{const t=Array.from(e.querySelectorAll("#product-details-content .text-piped p")).map(r=>r.textContent).find(r=>r.endsWith(" pages"));if(t)return sr(t)},vt=e=>{const t=new Map,r=Array.from(e.querySelectorAll(".journal-info-container .info-block")).flatMap(n=>Array.from(n.querySelectorAll(".info_label")));for(const n of r){const o=n.nextElementSibling;if(!o?.classList.contains("info_value"))continue;const s=os(n.textContent,":"),i=os(o.textContent,":");!s||!i||Kh.has(s)&&t.set(s,i)}return t},bt=(e,t)=>p(e,"property","books:release_date")??p(e,"name","citation_online_date")??t.get("First published")??void 0,ir=(e,t)=>p(e,"name","dc.identifier")??p(e,"name","citation_doi")??p(e,"name","publication_doi")??t.get("DOI")??void 0,ss=(e,t)=>{const r=new Set([p(e,"property","books:isbn"),t.get("Print ISBN"),t.get("Online ISBN")].filter(n=>!!n));return r.size>0?[...r].join(","):void 0},nf=e=>{let t,r;const n=e.querySelector(".cover-image__details div:first-of-type");if(n?.childNodes.length===2){const[o,s]=n.childNodes;o.textContent&&(t=sr(o.textContent)),s.textContent&&(r=sr(s.textContent))}return{volume:t,issue:r}},of=e=>{const r=Array.from(e.querySelectorAll(".authors .author")).map(n=>n.textContent.trim().replace(",","")).filter(n=>!!n);return r.length>0?r:void 0},sf=e=>{const t=Array.from(e.querySelectorAll(".details-section .details-entry")),r=t.find(i=>i.querySelector(".details-label")?.textContent.trim()==="ISSN"),n=t.find(i=>i.querySelector(".details-label")?.textContent.trim()==="eISSN");let o,s;return r&&(o=r.querySelector(".details-value")?.textContent.trim()),n&&(s=n.querySelector(".details-value")?.textContent.trim()),{issn:o,eissn:s}},af=e=>{if(!e?.content?.group)return{volume:void 0,issue:void 0};const t=e.content.group.volume,r=e.content.group.issue;return r==="0"&&t==="0"?{volume:void 0,issue:void 0}:{volume:t,issue:r}},cf=e=>{const n=Array.from(e.querySelectorAll(".details-section .details-entry")).find(i=>i.querySelector(".details-label")?.textContent.trim()==="Pages")?.querySelector(".details-value")?.textContent.trim(),[o,s]=(n?.split("-")??[void 0,void 0]).map(i=>i?.trim());return o?.toLowerCase()==="n/a"&&s?.toLowerCase()==="n/a"?{spage:void 0,epage:void 0}:{spage:o,epage:s}},uf=e=>{const t=vt(e),r=gt(e),n=p(e,"property","og:title"),o=bt(e,t),s=ir(e,t),i=ss(e,t),a=rf(e);return F(S.Book,{au:r,date:o,doi:s,isbn:i,pages:a,title:n})},lf=e=>{const t=vt(e),r=gt(e),n=p(e,"name","citation_book_title"),o=bt(e,t),s=ir(e,t),i=ss(e,t),a=p(e,"name","citation_publisher"),c=p(e,"property","og:title");return F(S.Bookitem,{au:r,btitle:n,date:o,doi:s,isbn:i,pub:a,title:c})},pf=e=>{const t=vt(e),r=gt(e),n=bt(e,t),o=t.get("Online ISSN"),s=t.get("Print ISSN"),i=p(e,"property","og:title"),{volume:a,issue:c}=nf(e);return Z(S.Journal,{au:r,date:n,eissn:o,issn:s,issue:c,title:i,volume:a})},hf=e=>{const t=vt(e),r=ef(e),n=gt(e)??of(e),o=bt(e,t)??r?.content?.item["published-date"],s=ir(e,t),{issn:i,eissn:a}=sf(e),{volume:c,issue:u}=af(r),l=p(e,"property","og:title")??r?.content?.item.title,f=p(e,"name","citation_journal_title")??r?.content?.series.title,{spage:m,epage:g}=cf(e);return Z(S.Article,{au:n,date:o,doi:s,eissn:a,issn:i??p(e,"name","citation_issn"),issue:u,jtitle:f,title:l,volume:c,spage:m,epage:g})},ff=({document:e,url:t})=>{switch(tf(e,t)){case v.Book:return A(uf(e));case v.Chapter:return A(lf(e));case v.Journal:return A(pf(e));case v.Article:return A(hf(e));default:return x()}},mf=e=>{const t=te(e,"name","citation_author");return t.length>0?t:void 0},df=({document:e})=>{const t=mf(e),r=p(e,"name","citation_publication_date"),n=p(e,"name","citation_doi"),o=p(e,"name","citation_isbn"),s=p(e,"name","citation_publisher"),i=p(e,"name","citation_title")??e.title,a=me({au:t,date:r,doi:n,isbn:o,pub:s,title:i});return A(a)},gf=({document:e})=>Array.from(e.querySelectorAll(".Z3988")).length<=1?x():Zo(),_t=e=>{if(!(!e||e.length===0))return e[0]};function ar(e,t){const r=t.map(n=>{const o=e.querySelector(n)?.textContent??null;if(o&&o.trim()!=="")return o}).filter(n=>n);return _t(r)??null}function vf(e,t){const r=t.flatMap(n=>Array.from(e.querySelectorAll(n)).flatMap(s=>{const i=s.textContent;return i&&i.trim()!==""?i.split(";").map(a=>a.trim()).filter(a=>a.length>0):[]}));return r.length>0?r:null}const Me=(e,t)=>ar(e,[t])?.trim(),bf=e=>{const t=e.querySelector(".content-meta-data__authors")?.textContent;if(t)return t.split(/,\s+|\s+and\s+/).filter(r=>!!r)},_f=e=>{const t=Array.from(e.querySelectorAll('.tombstone-metadata [data-qa="item-authors"]')).map(r=>r.textContent).filter(r=>!!r);return t.length?t:void 0},yf=e=>{const t=Array.from(e.querySelectorAll('.item-authors [data-qa="item-contributors"], .item-authors [data-qa="item-creators"]')).map(r=>r.textContent).filter(r=>!!r);return t.length?t:void 0},Sf=e=>{const t=Array.from(e.querySelectorAll(".contrib-type-author .name")).map(r=>r.textContent).filter(r=>!!r);return t.length?t:void 0},ke=e=>{const t=new Set([...yf(e)??[],...bf(e)??[],...Sf(e)??[],..._f(e)??[]]);return t.size?[...t]:void 0},Ce=(e,t)=>e.querySelector('[data-qa="published-date"]')?.textContent??e.querySelector(".summary-image")?.textContent??Te(t?.get("date"))??Te(t?.get("copyright date"))??Te(t?.get("published date")),is=e=>{const t=e.find(r=>r.startsWith("https://doi.org/"));if(t)return t.replace("https://doi.org/","")},as=e=>{const t=e.get("local identifier");if(t?.length)return is(t)},Ef=e=>e.querySelector(".doi")?.getAttribute("href")??void 0,Te=e=>{if(e?.length)return e[0]},Pe=e=>{const t=new Map;return Array.from(e.querySelectorAll(".metadata-element, .metadata")).map(r=>{const o=r.querySelector(".metadata-label")?.textContent.trim().toLowerCase(),s=Array.from(r.querySelectorAll(".metadata-value")).map(i=>i.textContent).filter(i=>!!i);return{name:o,values:s}}).forEach(({name:r,values:n})=>{!r||!n.length||t.set(r,n)}),t},cs=e=>{const t=Pe(e),r=e.querySelector(".summary-journal"),n=Array.from(r?.childNodes??[]),o=n[0]?.textContent??e.querySelector(".journal-link")?.textContent??void 0,s=n[2]?.textContent?.replace(/Published By:\s+?/i,"")??Te(t.get("publisher"))??e.querySelector(".publisher-link")?.textContent??void 0;return{pub:s&&s.trim()!==""?s:void 0,jtitle:o&&o.trim()!==""?o:void 0}},Af=e=>{const t=ar(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},yt=e=>ge(e.querySelector('[data-qa="page-count"]')?.textContent),We=(e,t)=>e.querySelector(".publisher-link")?.textContent??Te(t?.get("publisher")),Ee=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,Ae=e=>{if(!URL.canParse(e))return;const t=new URL(e);return t.origin+t.pathname},$f=e=>{const t=e.querySelector(".ccda-container > :first-child");let r,n;if(t?.textContent.includes("Volume")||t?.textContent.includes("Issue")){const o=t.textContent.trim().split(/,\s+/);for(const s of o)s.startsWith("Volume")?n=ge(s):s.startsWith("Issue")&&(r=ge(s))}return{issue:r,volume:n}},Rf=e=>{const t=e.querySelector('[data-qa="item-src-info"]')?.textContent??p(e,"property","og:description")??p(e,"name","description");if(!t)return{};const r=/Vol\.\s*(\d+)/.exec(t),n=r?r[1]:void 0,o=/No\.\s*(\d+)/.exec(t),s=o?o[1]:void 0,i=/pp\.\s*(\d+)-(\d+)/.exec(t),a=i?i[1]:void 0,c=i?i[2]:void 0,u=/pp\.\s*\d+-\d+\s*\((\d+)\s*pages\)/.exec(t),l=u?u[1]:void 0;return{issue:s,volume:n,spage:a,epage:c,pages:l}},wf=e=>{const t=ar(e,["mfe-turnaway-pharos-link",'[data-qa="item-src-info"]']);if(!t)return;const n=/\(.+\)/.exec(t)?.map(o=>{const s=/\d{4}/.exec(o);return s?s[0]:void 0});return _t(n)},If=(e,t)=>{const r=Ee(e),n=ke(e),o=Ce(e)??wf(e),s=cs(e),i=s.jtitle??Af(e)??void 0,a=s.pub,c=$f(e),u=Rf(e),l=c.issue??u.issue,f=c.volume??u.volume,m=yt(e)??u.pages,g=u.spage,C=u.epage,_=Ae(t),O=is(Array.from(e.querySelector(".content-meta-data-stables")?.childNodes??[]).map(D=>D.textContent??""))??Ef(e);return Z(S.Article,{atitle:r,au:n,date:o,doi:O,epage:C,issue:l,jtitle:i,pages:m,pub:a,spage:g,uri:_,volume:f})},kf=(e,t)=>{const r=Pe(e),n=ke(e),o=Ce(e,r),s=Ee(e),i=We(e,r),a=Ae(t);return me({au:n,date:o,pub:i,title:s,uri:a})},Cf=(e,t)=>{const r=Pe(e),n=ke(e),o=Ee(e),s=Ce(e),i=yt(e),a=We(e,r),c=Ae(t),u=as(r);return F(S.Book,{au:n,date:s,doi:u,pages:i,pub:a,title:o,uri:c})},Pf=(e,t)=>{const r=Pe(e),n=ke(e),o=Ee(e),s=e.querySelector(".book-title-link")?.textContent??void 0,i=Ce(e,r),a=Array.from(e.querySelectorAll('[data-qa="book"] > span')).map(m=>m.textContent),c=yt(e),u=a.find(m=>m.includes("pp."))?.match(/(\d+)-(\d+)/)??void 0,l=We(e,r),f=Ae(t);return F(S.Bookitem,{atitle:o,au:n,btitle:s,date:i,epage:u?.[2],pub:l,pages:c,spage:u?.[1],uri:f})},Of=(e,t)=>{const r=Pe(e),n=ke(e),o=Ee(e),s=Ce(e),i=yt(e),a=We(e,r),c=Ae(t),u=as(r);return F(S.Document,{au:n,date:s,doi:u,pages:i,pub:a,title:o,uri:c})},Nf=(e,t)=>{const r=Pe(e),n=ke(e),o=Ce(e,r),s=Ee(e),i=Ae(t);return Ao({au:n,date:o,title:s,uri:i})},zf=(e,t)=>{const{pub:r}=cs(e),n=Ee(e),o=e.querySelector(".eissn")?.textContent.replace(/EISSN\s+/,"").trim()??void 0,s=e.querySelector(".issn")?.textContent.replace(/ISSN\s+/,"").trim()??void 0,i=Ae(t);return Z(S.Journal,{eissn:o,issn:s,jtitle:n,pub:r,uri:i})};var ie=(e=>(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))(ie||{});const Lf=(e,t)=>{const r=Pe(e),n=ke(e),o=Ce(e,r),s=Ee(e),i=We(e,r),a=Ae(t);return me({au:n,date:o,pub:i,title:s,uri:a})},xf=e=>Object.values(ie).includes(e),Tf=e=>{if(e.querySelector(".journal_header-title"))return ie.Journal;if(e.querySelector(".journal-link"))return ie.Article;const n=e.querySelector(".content-type > span")?.textContent.toLowerCase().trim()??e.querySelector(".content-meta-data-label")?.textContent.toLowerCase().trim();return xf(n)?n:null},qf=(e,t)=>{switch(Tf(e)){case ie.Article:case ie.Serial:return If(e,t);case ie.Audio:return kf(e,t);case ie.Book:return Cf(e,t);case ie.Chapter:case ie.ResearchReport:return Pf(e,t);case ie.Document:return Of(e,t);case ie.Image:return Nf(e,t);case ie.Journal:return zf(e,t);case ie.Video:return Lf(e,t);default:return null}},Zf=({document:e,url:t})=>{const r=qf(e,t);return r?A(r):x()},Ge=e=>{if(e){if(typeof e=="string")return e;if(e.length>0)return e[0]}else return},us=e=>{if(e)return typeof e=="string"?e:Array.isArray(e)?e.length===0?void 0:Ge(e[0].name):Ge(e.name)},St=(...e)=>{const t=new Set(e.filter(r=>!!r));if(t.size!==0)return[...t]},Df=e=>{const t=us(e.mainEntity.creator);return t?[t]:void 0},Xe=({lcn:e,title:t})=>({bibid:e,title:t}),jf=(e,t)=>{const r=St(...(e&&Df(e))??[],...t.authors??[]),n=St(...t.eissns??[]),o=St(e?.mainEntity.isbn?rr(e.mainEntity.isbn):void 0,...t.isbns??[]),s=St(...e?.mainEntity.issn??[],...t.issns??[]),[i,a]=e?.mainEntity.pagination?.split("-")??[];return{authors:r,date:t.date,doi:Ge(t.dois),edition:e?.mainEntity.edition??t.edition,epage:a,eissn:Ge(n),lcn:t.lcn??e?.identifier.value,isbn:o?.join(","),issn:Ge(s),issue:e?.mainEntity.issueNumber,jtitle:t.jtitle,publisher:t.publisher??us(e?.mainEntity.publisher),spage:i,title:e?.name??t.title,volume:e?.mainEntity.volumeNumber}},Bf=e=>Z(S.Article,{...Xe(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}),Uf=e=>me({...Xe(e),au:e.authors,date:e.date,pub:e.publisher}),Vf=e=>F(S.Book,{...Xe(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}),Ff=e=>Z(S.Journal,{...Xe(e),date:e.date,doi:e.doi,eissn:e.eissn,issn:e.issn,pub:e.publisher}),ls=I({"@type":W("Organization"),name:he([h(),B(h())])}),ps=I({"@type":W("Person"),name:he([h(),B(h())])}),Jf=Ie.extend({identifier:I({"@type":h(),propertyID:h(),value:h()}),mainEntity:I({"@type":h(),"@id":h(),creator:fe(he([h(),ps,B(ps)])),edition:fe(h()),isbn:fe(h()),issn:fe(B(h())),issueNumber:fe(h()),pagination:fe(h()),publisher:fe(he([h(),ls,B(ls)])),volumeNumber:fe(h())}),name:h()}),Mf=e=>{const t=mt(e);if(!t)return null;const r=Fe(t),n=Jf.safeParse(r);return n.success?n.data:null},Wf=e=>me({...Xe(e),au:e.authors,date:e.date,pub:e.publisher}),Gf=/([0-9]{4}-[0-9]{1,2}-[0-9]{1,2}|[0-9]{4}-[0-9]{1,2}|[0-9]{4})/,hs=/(E?ISBN|E?ISSN|DOI)\s*:\s*/g,cr=e=>`*:has([title*="${e}" i]) + .item-details-element-container prm-highlight`,Xf=e=>{if(!e)return;const t=Gf.exec(e);if(t)return t.length>1?t[1]:void 0},Hf=e=>{const t=Array.from(e.querySelectorAll(cr("Identifier"))),r={};return t.map(n=>n.textContent).filter(n=>!!n).forEach(n=>{const o=[];let s;for(;(s=hs.exec(n))!==null;)o.push({id:s[1].toLowerCase(),index:s.index,start:hs.lastIndex});o.forEach(({id:i,start:a},c)=>{r[i]??=[],r[i].push(n.substring(a,o[c+1]?.index))})}),r},Yf=e=>Array.from(e.querySelectorAll(cr("Author"))).filter(t=>!!t.textContent&&t.parentElement!==null&&t.parentElement.getAttribute("aria-hidden")!=="true").map(t=>t.textContent.trim()),$e=(e,t)=>e.querySelector(cr(t))?.textContent.trim(),Kf=e=>{const t=$e(e,"Creation Date"),r=$e(e,"Edition"),n=$e(e,"Publication Date"),o=$e(e,"Is Part Of"),s=$e(e,"Publisher"),i=$e(e,"Title"),a=$e(e,"MMS ID")??$e(e,"Record ID"),c=Yf(e),u=Hf(e),[l]=o?.split(",")??[],f=Xf(n??t),m=[...u.isbn??[],...u.eisbn??[]].map(g=>rr(g)).filter(g=>!!g);return{authors:c,date:f,dois:u.doi,edition:r,eissns:u.eissn,isbns:m,issns:u.issn,jtitle:l,lcn:a,publisher:s,title:i}};var fs=(e=>(e.Article="Article",e.Book="Book",e.Periodical="Periodical",e.Journal="Journal",e.AudioCD="Audio CD",e.CreativeWork="CreativeWork",e.Movie="Movie",e.Video="Video",e))(fs||{});const Qf=e=>Object.values(fs).includes(e),em=(e,t)=>{const r=t?.mainEntity["@type"]??e.querySelector(".media-content-type")?.textContent??void 0;if(Qf(r))return r},tm=({document:e})=>{const t=Mf(e),r=Kf(e),n=jf(t,r);switch(em(e,t)){case"Article":return A(Bf(n));case"Book":return A(Vf(n));case"Periodical":case"Journal":return A(Ff(n));case"Audio CD":case"CreativeWork":return A(Uf(n));case"Movie":case"Video":return A(Wf(n));default:return x()}},rm=e=>{const t=e.querySelectorAll('[id="Info"] > p'),n=Array.from(t).find(s=>s.textContent.includes("Document Type"))?.textContent,o=p(e,"name","DC.identifier");return o?.startsWith("info:doi/")||n?.includes("Article")?v.Article:o?.startsWith("urn:issn:")?v.Journal:void 0},nm=e=>{const t=p(e,"name","DCTERMS.bibliographicCitation"),[r,n,o,s]=t?.split(",")??[];return{journalTitle:r,volume:n,issue:o,pages:s}},om=e=>{const t=p(e,"name","DC.identifier");return(t?t.split("info:doi/"):null)?.[1]??void 0},sm=e=>e.evaluate('//*[@id="altLayoutPublisherLogo"]/p/a[1]',e,null,XPathResult.STRING_TYPE,null).stringValue,im=e=>{const[t,r]=e?e.trim().split("-"):[void 0,void 0],n=r?.replace(/\(\d+\)/,"").trim();return{spage:t,epage:n}},am=e=>{const t=p(e,"name","DCTERMS.issued");if(!t)return;const n=/\d{4}/.exec(t);return n?n[0]:void 0},cm=e=>{const t=p(e,"name","DC.title"),r=p(e,"name","DC.publisher"),n=am(e),o=nm(e),s=o.journalTitle?.trim(),i=o.volume?.trim(),a=o.issue?.trim(),c=o.pages?im(o.pages):void 0,u=c?.spage,l=c?.epage,f=te(e,"name","DC.creator"),m=om(e);return Z(S.Article,{au:f,jtitle:s,date:n,doi:m,issue:a,pub:r,spage:u,epage:l,atitle:t,volume:i})},um=e=>{const t=p(e,"name","DC.title"),r=p(e,"name","DC.publisher"),n=sm(e);return Z(S.Journal,{issn:n,title:t,pub:r})},lm=({document:e})=>{switch(rm(e)){case v.Article:return A(cm(e));case v.Journal:return A(um(e));default:return x()}},pm=/^\d{4}-\d{3}[\dX]$/i,hm=e=>pm.test(e),ms=e=>{const t=e.filter(hm);return t.length?t:void 0},ur=e=>{const t=te(e,"name","citation_author");return t.length?t:void 0},lr=e=>p(e,"name","citation_publication_date")?.match(/^\d{4}/)?.[0],fm=e=>p(e,"name","citation_doi"),ds=e=>{const t=te(e,"name","citation_isbn");return t.length?t.join(","):void 0},gs=e=>ms(te(e,"name","citation_issn")),pr=e=>p(e,"name","citation_journal_title"),hr=e=>p(e,"name","citation_publisher"),Et=e=>p(e,"name","citation_title"),mm=e=>p(e,"name","citation_doi"),fr=e=>p(e,"name","citation_firstpage"),mr=e=>p(e,"name","citation_lastpage"),dm=e=>p(e,"name","citation_issue"),gm=e=>p(e,"name","citation_volume"),vm=e=>Z(S.Article,{atitle:Et(e),au:ur(e),date:lr(e),doi:fm(e),issn:gs(e)?.[0],issue:dm(e),jtitle:pr(e),pub:hr(e),volume:gm(e),spage:fr(e),epage:mr(e)}),bm=e=>F(S.Bookitem,{atitle:Et(e),au:ur(e),btitle:pr(e),date:lr(e),isbn:ds(e),pub:hr(e),spage:fr(e),epage:mr(e)}),_m=e=>Ut({title:Et(e),au:ur(e),date:lr(e),pub:hr(e),spage:fr(e),epage:mr(e)}),vs=e=>!!e.isbn,ym=e=>!!e.issn||e.type==="Article"&&!!e.journalTitle||!vs(e)&&!!e.journalTitle,Sm=e=>!!e.title,Em=e=>{const t={type:mm(e),isbn:ds(e),issn:gs(e),journalTitle:pr(e),title:Et(e)};return vs(t)?bm(e):ym(t)?vm(e):Sm(t)?_m(e):null},Am=({document:e})=>{const t=Em(e);return t?A(t):x()},$m=I({"@content":h(),datePublished:h().optional(),mainEntity:I({type:h().optional(),name:h().optional(),author:B(I({name:h()})).optional(),publisher:I({type:h(),name:h()}).optional(),isbn:h().optional()})}),Rm=e=>$m.safeParse(e).success,wm=e=>{const t=e.textContent;if(!t)return null;try{const r=JSON.parse(t);if(Rm(r))return r}catch{return null}return null},Im=({document:e})=>{const t=mt(e);if(!t)return x();const r=wm(t);if(!r)return x();const n=r.mainEntity.type,o=r.mainEntity.author?.map(u=>u.name),s=r.datePublished?.substring(0,4),i=r.mainEntity.name,a=r.mainEntity.isbn,c=r.mainEntity.publisher?.name;switch(n){case"Book":return A(F(S.Book,{au:o,date:s,title:i,isbn:a,pub:c}));default:return x()}},km=Ie.extend({"@type":h().optional(),name:h().optional(),copyrightYear:ho().optional(),author:B(I({name:h()})).optional(),publisher:B(I({name:h()})).optional()}),Cm=e=>km.safeParse(e).success,Pm=({document:e,url:t})=>{const r=mt(e);if(!r)return x();const n=Fe(r);if(!n||!Cm(n))return x();const o=n["@type"],s=n.author?.map(l=>l.name),i=n.copyrightYear?.toString()??p(e,"property","og:book:release_date"),a=n.name,c=_t(n.publisher?.map(l=>l.name)),u=p(e,"property","og:book:isbn");switch(o){case"Book":return A(F(S.Book,{au:s,date:i,title:a,isbn:u,pub:c,uri:t}));default:return x()}},Om=e=>{const t=Array.from(e.querySelectorAll("a[rel=author]")).map(r=>r.textContent.trim()).filter(Boolean);return t.length?t:void 0},Nm=e=>{const t=Array.from(e.querySelectorAll("strong")).filter(r=>r.textContent.startsWith("ISBN")).map(r=>r.nextElementSibling?.textContent.trim());if(t.length!==0)return t[0]?.replace(/\s+/,",")},zm=({url:e,document:t})=>{const r=t.querySelector("h3.page-title")?.textContent.trim()??void 0,n=Om(t),o=p(t,"property","article:published_time"),s=Nm(t),i=F(S.Book,{au:n,date:o?.substring(0,4),isbn:s,pub:"Milne Open Textbooks",title:r,uri:e});return A(i)},Lm=({document:e,url:t})=>{switch(xm(t)){case v.Chapter:return A(jm(e));case v.Book:return A(Bm(e));case v.Article:return A(Tm(e));case v.Journal:return A(qm(e));default:return x()}},xm=e=>{const{pathname:t}=new URL(e);return t.includes("/books/abs/")?v.Chapter:t.includes("/books/")?v.Book:/\/journals\/.+\/article\//.exec(t)!=null?v.Article:t.includes("/journals/")?v.Journal:v.None},Tm=e=>{const t=p(e,"name","citation_title"),r=p(e,"name","citation_journal_title"),n=p(e,"name","citation_doi"),o=p(e,"name","citation_volume"),s=p(e,"name","citation_issue"),i=p(e,"name","citation_firstpage"),a=p(e,"name","citation_lastpage"),c=p(e,"name","citation_publication_date")?.substring(0,4),u=p(e,"name","citation_publisher"),l=bs(e),f=ms(te(e,"name","citation_issn"));return Z(S.Article,{atitle:t,au:l,jtitle:r,doi:n,volume:o,issue:s,issn:f?.[0],spage:i,epage:a,date:c,pub:u})},qm=e=>{const t=Zm(e),r=Dm(e),n=r.find(a=>a.type==="Print"),o=r.find(a=>a.type==="Online"),s=n?n.value:void 0,i=o?o.value:void 0;return Z(S.Journal,{title:t,issn:s,eissn:i})},Zm=e=>e.querySelector("h1.title")?.textContent.trim()??void 0,Dm=e=>{const r=Array.from(e.querySelectorAll("span.bold")).find(s=>s.textContent.trim()==="ISSN:"),n=/^([0-9]{4}-[0-9]{3}[0-9X]) \((Print|Online)\)/,o=[];return r&&r.parentElement?.querySelectorAll("span.value")?.forEach(i=>{const a=i.textContent.trim(),c=n.exec(a);c&&o.push({value:c[1],type:c[2]})}),o},jm=e=>{const t=p(e,"name","citation_title"),r=p(e,"name","citation_inbook_title"),n=p(e,"name","citation_doi"),o=p(e,"name","citation_publication_date")?.substring(0,4),s=p(e,"name","citation_publisher");return F(S.Bookitem,{atitle:t,btitle:r,doi:n,date:o,pub:s})},Bm=e=>{const t=p(e,"name","citation_title"),r=p(e,"name","citation_doi"),n=p(e,"name","citation_isbn"),o=p(e,"name","citation_publication_date")?.substring(0,4),s=p(e,"name","citation_publisher"),i=bs(e);return F(S.Book,{title:t,au:i,doi:r,isbn:n,date:o,pub:s})},bs=e=>{const t=te(e,"name","citation_author");return t.length?t:void 0},Um=e=>{switch(p(e,"property","og:type")){case"Article":return"Article";case"Journal":return"Journal";default:return}};function Vm(e){const t=p(e,"property","og:title"),r=p(e,"name","dc.Publisher"),n=p(e,"name","publication_doi");return A(Z(S.Journal,{jtitle:t,pub:r,doi:n}))}function Fm(e){const t=p(e,"name","dc.Title"),r=te(e,"name","dc.Creator"),n=p(e,"name","dc.Date")?.substring(0,4),o=p(e,"name","publication_doi"),s=p(e,"name","citation_journal_title"),i=p(e,"name","dc.Publisher");return A(Z(S.Article,{atitle:t,au:r,date:n,doi:o,jtitle:s,pub:i}))}const Jm=({document:e})=>{switch(Um(e)){case"Journal":return Vm(e);case"Article":return Fm(e);default:return x()}},Mm=e=>{if(!e)return;const[t,r]=e.trim().split("-");return{spage:t,epage:r}},Wm=e=>{const{pathname:t}=new URL(e);if(t.includes("/article/"))return v.Article},Gm=e=>{const t=p(e,"name","DC.Source"),r=p(e,"name","DC.Title"),n=te(e,"name","DC.Creator.PersonalName"),o=p(e,"name","DC.Source.ISSN"),s=p(e,"name","citation_date")?.substring(0,4),i=p(e,"name","DC.Source.Volume"),a=p(e,"name","DC.Source.Issue"),c=p(e,"name","DC.Identifier.URI"),u=p(e,"name","DC.Identifier.pageNumber"),l=u?Mm(u):void 0,f=l?.spage,m=l?.epage;return Z(S.Article,{jtitle:t,atitle:r,au:n,issn:o,date:s,spage:f,epage:m,volume:i,issue:a,uri:c})},Xm=({document:e,url:t})=>{switch(Wm(t)){case v.Article:return A(Gm(e));default:return x()}},Hm=e=>{switch(Ym(e)){case"eBook":return"Book";case"Reference":return"Chapter";default:return}},Ym=e=>e.querySelector("#vol-contentType a")?.textContent??void 0;function Km(e,t){const r=_s(e),n=dr(e),o=Ss(e),s=Es(e),i=As(e),a=$s(e),c=dr(e),u=t,{startPage:l,endPage:f}=Rs(e)??{};return A(F(S.Book,{au:r,btitle:n,date:o,doi:s,epage:f,isbn:i,pub:a,spage:l,title:c,uri:u}))}function Qm(e,t){const r=_s(e),n=ys(e),o=dr(e),s=Ss(e),i=Es(e),a=As(e),c=$s(e),u=ys(e),l=t,{startPage:f,endPage:m}=Rs(e)??{};return A(F(S.Book,{au:r,atitle:n,btitle:o,date:s,doi:i,epage:m,isbn:a,pub:c,spage:f,title:u,uri:l}))}const _s=e=>{const t=e.querySelectorAll("div#article_author p.author-bio b"),r=Array.from(t).map(n=>n.textContent).filter(n=>!!n).map(n=>n.trim());return r.length>0?r:void 0},qe=(e,t)=>e.querySelector(`input#${t}`)?.getAttribute("value")??void 0,ed=e=>p(e,"property","og:title"),dr=e=>qe(e,"titlevalue")??ed(e),ys=e=>qe(e,"chapter-title-squid"),Ss=e=>qe(e,"pubdate-squid"),Es=e=>qe(e,"doi-squid"),As=e=>qe(e,"isbn-squid"),$s=e=>qe(e,"pubname-squid"),Rs=e=>{const t=e.querySelector("#pageRange")?.textContent??void 0;if(!t)return;const n=/(\d+)–(\d+)/.exec(t);if(n)return{startPage:n[1],endPage:n[2]}},td=({document:e,url:t})=>{switch(Hm(e)){case"Book":return Km(e,t);case"Chapter":return Qm(e,t);default:return x()}},rd=(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(),nd=e=>{switch(rd(e,"Medium")){case"book":case"e-book":return S.Book;case"e-journal":return S.Journal;default:return S.Unknown}},od=e=>{delete e.rft_id},sd=e=>{const t=Qt(e);if(dt(t)){const r=nd(e.document);t.resource.genre=r,od(t.resource)}return t},id=e=>{const t=p(e,"name","type")?.toLowerCase(),r=p(e,"name","og:type")?.toLowerCase(),n=p(e,"name","citation_article_type")?.toLowerCase();if(t==="article"||n==="article"||r==="article")return v.Article;const o=p(e,"name","twitter:title")?.trim(),s=p(e,"name","description")?.trim();if(o||s)return v.Webpage},ad=e=>{const t=p(e,"name","DC.Title"),r=p(e,"name","DC.Publisher"),n=p(e,"name","DC.Date"),o=p(e,"name","DC.Identifier"),s=p(e,"name","citation_journal_title"),i=p(e,"name","citation_volume"),a=p(e,"name","citation_issn"),c=te(e,"name","citation_author");return Z(S.Article,{au:c,jtitle:s,date:n,doi:o,issn:a,pub:r,title:t,volume:i})},cd=(e,t)=>{const r=p(t,"name","twitter:title");return lt({uri:e,title:r})},ud=({url:e,document:t})=>{switch(id(t)){case v.Article:return A(ad(t));case v.Webpage:return A(cd(e,t))}return x()},ld=({document:e})=>Array.from(e.querySelectorAll(".availability.documentSummaryAvailability.availabilityContent")).length<=1?x():Do(),pd=/([0-9]{4})\s+at/;function hd(e){if(!e)return;const t=pd.exec(e);if(t&&t.length>1)return t[1]}function ws(e,t){const r=e.getElementsByClassName(t);if(r.length!==0)return r[0].textContent}function fd(e){const t={};return Array.from(e.getElementsByTagName("li")).reduce((r,n)=>{const o=ws(n,"title"),s=ws(n,"content");return o&&s&&(r[o]=s),r},t)}function md(e){const t=e.getElementsByClassName("information");if(t.length===0)return{};const r=fd(t[0]),n=hd(r.Published),o=r.Show;return{date:n,series:o}}const dd=({url:e,document:t})=>{if(!new URL(e).searchParams.has("i"))return x();const n=S.AudioDocument,o=p(t,"property","og:site_name"),s=p(t,"property","og:title"),i=md(t);return A({genre:n,pub:o,title:s,uri:e,...i})},gd=e=>{const t=p(e,"name","citation_date");return t?t.split("/").find(o=>/^\d{4}/.test(o))??void 0:void 0},vd=e=>{const t=e.querySelector("#arxiv-doi-link")?.textContent;return t?t.replace("https://doi.org/","").trim():void 0},bd=({document:e})=>{const t=p(e,"name","citation_title"),r=p(e,"name","citation_pdf_url"),n=te(e,"name","citation_author"),o=gd(e),s=vd(e);return!t&&n.length===0&&!o&&!s?x():A(Z(S.Article,{au:n,date:o,doi:s,title:t,uri:r}))},_d=e=>{const t=Me(e,"div.director-section div.term-info-section-items");if(!t)return;const r=t.split(",").map(n=>n.replace(/\s+/g," ").trim()).filter(n=>n.length>0);return r.length>0?r:void 0},yd=e=>{const t=new Map;return Array.from(e.querySelectorAll(".info-section-container")).forEach(r=>{const n=r.querySelector(".info-section-header .info-section-title")?.textContent.trim().toLowerCase();if(!n)return;const o=Array.from(r.querySelectorAll(".term-info-section-item")).map(s=>s.textContent.replace(",","").trim()).filter(s=>!!s);o.length&&t.set(n,o)}),t},Sd=({url:e,document:t})=>{const r=yd(t),n=_d(t)??r.get("director"),o=Me(t,"div.product-release-year"),s=Me(t,"div.studio-section div.term-info-section-item")??Te(r.get("supplier")),i=Me(t,".product-title")??Me(t,".movie-title"),a=me({au:n,date:o,pub:s,title:i,uri:e});return A(a)},Ed=e=>{if(p(e,"property","og:type")==="article")return v.Article};function Ad(e){const t={},r=e.querySelector("[data-id=layout-form]");return r&&Array.from(r.getElementsByTagName("h2")).forEach(o=>{const s=o.textContent.toLowerCase(),a=Array.from(o.parentElement?.getElementsByTagName("span")??[]).map(c=>c.textContent||"");s&&(t[s]=a[0])}),t}function $d(e,t,r){return r.includes("publisher")?t.publisher:r.includes("place of publication, exhibition, or creation")?t["place of publication, exhibition, or creation"]:p(e,"name","DC.publisher")}function Rd(e){const t=p(e,"name","citation_publication_date");return t?t.substring(0,4):p(e,"name","citation_online_date")?.substring(0,4)}const wd=e=>{const t=Ad(e),r=p(e,"name","DataCite.title"),n=te(e,"name","DataCite.contributor"),o=Rd(e),s=p(e,"name","DC.identifier.DOI"),i=Object.keys(t),a=$d(e,t,i),c=i.includes("journal")?t.journal:void 0,u=i.includes("volume")?t.volume:void 0,l=i.includes("issue")?t.issue:void 0,f=i.includes("issn")?t.issn:void 0,m=i.includes("electronic location (url)")?t["electronic location (url)"]:void 0;return Z(S.Article,{jtitle:c,atitle:r,pub:a,au:n,date:o,doi:s,volume:u,issue:l,issn:f,uri:m})},Id=({document:e})=>{switch(Ed(e)){case v.Article:return A(wd(e));default:return x()}},kd=e=>{const t=ae(e,"resource type");return t?t==="Other Journal Article"||t==="Journal Article"||t==="Journal Item"||t==="Book Review"?v.Article:t==="Book Chapter"||t==="Book Part"||t==="Conference Abstract"||t==="Book ChapterConference Paper"||t==="Conference Paper"||t==="Other Book Part"?v.Document:v.None:v.None},Cd=e=>e.replace(":","").replace(" | ","").trim().toLowerCase(),Pd=e=>{const t=new Map,r=e.querySelector("ul.rlist.publication-details__list");return r&&Array.from(r.querySelectorAll("li")).forEach(n=>{const o=Array.from(n.querySelectorAll("span.label")),s=Array.from(n.querySelectorAll("span.info"));o.forEach((i,a)=>{const c=Cd(i.textContent),u=s[a]?.textContent?.trim();c&&u&&(t.has(c)||t.set(c,[]),t.get(c)?.push(u))})}),t},ae=(e,t)=>{const r=e.get(t);if(r)return _t(r)},Od=e=>te(e,"name","dc.Creator").map(t=>t.trim()),Nd=e=>{const t=vf(e,[".loa-accordion a.author-name"]);return t?t.map(n=>n.replace("Authors:","").trim()):void 0},gr=e=>{const t=Od(e);return t.length>0?t:Nd(e)},vr=e=>p(e,"name","dc.Title")??p(e,"property","og:title"),br=e=>p(e,"name","publication_doi"),_r=(e,t)=>ae(t,"date of publication")??p(e,"name","dc.Date"),Is=e=>{const t=ae(e,"page range");let r,n;return t?.includes("-")&&(r=t?t.split("-")[0].trim():void 0,n=t?t.split("-")[1].trim():void 0),{pages:t,spage:r,epage:n}},zd=(e,t,r)=>{const n=vr(e),o=ae(t,"journal"),s=p(e,"name","citation_journal_title"),i=o??s,a=br(e),c=_r(e,t),u=ae(t,"publisher"),l=gr(e),f=ae(t,"volume"),m=ae(t,"issue"),g=Is(t),C=ae(t,"issn (print)"),_=ae(t,"issn (electronic)");return Z(S.Article,{title:n,jtitle:i,doi:a,date:c,pub:u,au:l,volume:f,issue:m,pages:g.pages,spage:g.spage,epage:g.epage,issn:C,eissn:_,uri:r})},Ld=(e,t,r)=>{const n=vr(e),o=ae(t,"book title"),s=br(e),i=_r(e,t),a=ae(t,"publisher"),c=gr(e),u=Is(t),l=ae(t,"isbn (print)");return F(S.Conference,{title:n,btitle:o,doi:s,date:i,pub:a,au:c,pages:u.pages,spage:u.spage,epage:u.epage,isbn:l,uri:r})},xd=(e,t,r)=>{const n=vr(e),o=br(e),s=_r(e,t),i=ae(t,"publisher"),a=gr(e),c=ae(t,"isbn (print)");return F(S.Document,{title:n,doi:o,date:s,pub:i,au:a,uri:r,isbn:c})},Td=({url:e,document:t})=>{const r=Pd(t);switch(kd(r)){case v.Article:return A(zd(t,r,e));case v.Document:return A(Ld(t,r,e));case v.None:return A(xd(t,r,e));default:return x()}};var L=(e=>(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))(L||{});const yr={NoResourceFound:Go,Z3988:Qt,Z3988SearchResult:gf,Amazon:lp,CupOfJo:Up,Jstor:Zf,Youtube:zh,SagePub:nh,SageVideo:df,ScienceDirect:hh,Springer:Yh,TaylorFrancis:_h,Wiley:ff,VuFind:Ch,ClinicalKey:zp,DOAJ:Wp,Primo:tm,IngentaConnect:lm,Ebscohost:Am,OpenStax:Im,OpenTextbook:Pm,Milne:zm,CambridgeJournalsOnline:Lm,AhaJournals:Jm,Ijees:Xm,BloomsburyCollections:td,HeritageCirqa:sd,BritishMedicalJournal:ud,SummonSearchResult:ld,ApplePodcasts:dd,Arxiv:bd,KanopyVideo:Sd,LaTrobeOpal:Id,BYUScholarsArchive:yp,Informit:Td},qd="5.31.0",Sr=()=>qd,Zd=["com.au","com","ca","co.uk","de","fr","nl"].flatMap(e=>[`amazon.${e}`,`www.amazon.${e}`]),Dd={version:Sr(),siteRegistrations:[{matcher:{regexp:"^https://[a-z0-9\\-]+\\.on\\.worldcat\\.org/search"},name:"Worldcat Search Results",parsers:[L.Z3988SearchResult]},{matcher:{regexp:"^https://[a-z0-9\\-]+\\.summon\\.serialssolutions\\.com/"},name:"Summon Search Results",parsers:[L.SummonSearchResult]},{matcher:{regexp:"cupofjo[.-]com"},name:"Cup of Jo",parsers:[L.CupOfJo]},{matcher:{hostnames:["youtube.com","www.youtube.com"]},name:"Youtube",parsers:[L.Youtube]},{matcher:{regexp:"www[-.]sciencedirect[.-]com"},name:"Science Direct",parsers:[L.ScienceDirect]},{matcher:{hostnames:Zd},name:"Amazon",parsers:[L.Amazon]},{matcher:{regexp:"^https://sk\\.sagepub\\.com/video/"},name:"Sage Video",parsers:[L.SageVideo]},{matcher:{regexp:"[/.-]((www|journals)[.-])?sagepub[.-]com"},name:"Sage Publishing",parsers:[L.SagePub]},{matcher:{regexp:"www[.-]tandfonline[.-]com"},name:"Taylor & Francis",parsers:[L.TaylorFrancis]},{matcher:{regexp:"[/.-]((www|onlinelibrary)[.-])?wiley[.-]com"},name:"Wiley",parsers:[L.Wiley]},{matcher:{regexp:"^https://[a-z0-9\\-]+\\.on\\.worldcat\\.org/"},name:"Worldcat",parsers:[L.Z3988]},{matcher:{hostnames:["catalogue.rau.ac.uk"]},name:"Royal Agricultural University Library",parsers:[L.Z3988]},{matcher:{regexp:"link[.-]springer[.-]com"},name:"Springer",parsers:[L.Springer]},{matcher:{regexp:"^https://vufind\\.lboro\\.ac\\.uk/(Record|PrimoRecord)"},name:"VuFind",parsers:[L.VuFind]},{matcher:{regexp:"www[.-]clinicalkey[.-]com"},name:"ClinicalKey",parsers:[L.ClinicalKey]},{matcher:{regexp:"www[.-]jstor[.-]org"},name:"JSTOR",parsers:[L.Jstor]},{matcher:{regexp:"doaj[.-]org"},name:"DOAJ",parsers:[L.DOAJ]},{matcher:{regexp:"[/.-]ingentaconnect[.-]com"},name:"IngentaConnect",parsers:[L.IngentaConnect]},{matcher:{regexp:"research[.-]ebsco[.-]com"},name:"EBSCOHost",parsers:[L.Ebscohost]},{matcher:{regexp:"openstax[-.]org"},name:"OpenStax",parsers:[L.OpenStax]},{matcher:{regexp:"open[.-]umn[.-]edu"},name:"OpenTextbook",parsers:[L.OpenTextbook]},{matcher:{regexp:"milneopentextbooks[-.]org"},name:"Milne Open Textbooks",parsers:[L.Milne]},{matcher:{regexp:"www[.-]perlego[.-]com"},name:"Perlego",parsers:[L.Z3988]},{matcher:{regexp:"www[.-]ahajournals[.-]org"},name:"AHA Journals",parsers:[L.AhaJournals]},{matcher:{regexp:"www[.-]cambridge[.-]org"},name:"Cambridge Journals Online",parsers:[L.CambridgeJournalsOnline]},{matcher:{regexp:"www[.-]nieindia[.-]org"},name:"International Journal of Ecology and Environmental Sciences",parsers:[L.Ijees]},{matcher:{regexp:"www[.-]bloomsburycollections[.-]com"},name:"Bloomsbury Collections",parsers:[L.BloomsburyCollections]},{matcher:{regexp:"cirqahosting[.-]com"},name:"Heritage Cirqa",parsers:[L.HeritageCirqa]},{matcher:{regexp:"www[.-]bmj[.-]com"},name:"British Medical Journal",parsers:[L.BritishMedicalJournal]},{matcher:{regexp:"podcasts[.-]apple[.-]com"},name:"Apple Podcasts",parsers:[L.ApplePodcasts]},{matcher:{regexp:"arxiv[.-]org"},name:"arxiv",parsers:[L.Arxiv]},{matcher:{regexp:"kanopy[.-]com"},name:"Kanopy Video",parsers:[L.KanopyVideo]},{matcher:{regexp:"opal[.-]latrobe[.-]edu[.-]au"},name:"La Trobe Opal",parsers:[L.LaTrobeOpal]},{matcher:{hostnames:["scholarsarchive.byu.edu"]},name:"BYU Scholars Archive",parsers:[L.BYUScholarsArchive]},{matcher:{regexp:"informit[.-]org"},name:"Informit",parsers:[L.Informit]}]},Er=I({hostnames:B(h()).min(1)}),Ar=I({regexp:h()}),$r=he([Er,Ar]),Rr=I({matcher:$r,name:h(),parsers:B(h()),libraryVersionRange:h().optional()}),ks=I({siteRegistrations:B(Rr),version:h()}),jd=e=>ks.safeParse(e).success,Bd=e=>Rr.safeParse(e).success,Ud=e=>$r.safeParse(e).success,Cs=e=>Object.values(L).includes(e),Vd=e=>typeof e=="object"&&e!==null,Ps=I({url:h(),document:Ll(Vd)}),Fd=e=>Ps.safeParse(e).success;var At={exports:{}},wr,Os;function $t(){if(Os)return wr;Os=1;const e="2.0.0",t=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,o=t-6;return wr={MAX_LENGTH:t,MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:o,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},wr}var Ir,Ns;function Rt(){return Ns||(Ns=1,Ir=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{}),Ir}var zs;function He(){return zs||(zs=1,(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:o}=$t(),s=Rt();t=e.exports={};const i=t.re=[],a=t.safeRe=[],c=t.src=[],u=t.safeSrc=[],l=t.t={};let f=0;const m="[a-zA-Z0-9-]",g=[["\\s",1],["\\d",o],[m,n]],C=O=>{for(const[D,K]of g)O=O.split(`${D}*`).join(`${D}{0,${K}}`).split(`${D}+`).join(`${D}{1,${K}}`);return O},_=(O,D,K)=>{const T=C(D),U=f++;s(O,U,D),l[O]=U,c[U]=D,u[U]=T,i[U]=new RegExp(D,K?"g":void 0),a[U]=new RegExp(T,K?"g":void 0)};_("NUMERICIDENTIFIER","0|[1-9]\\d*"),_("NUMERICIDENTIFIERLOOSE","\\d+"),_("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${m}*`),_("MAINVERSION",`(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})`),_("MAINVERSIONLOOSE",`(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})`),_("PRERELEASEIDENTIFIER",`(?:${c[l.NONNUMERICIDENTIFIER]}|${c[l.NUMERICIDENTIFIER]})`),_("PRERELEASEIDENTIFIERLOOSE",`(?:${c[l.NONNUMERICIDENTIFIER]}|${c[l.NUMERICIDENTIFIERLOOSE]})`),_("PRERELEASE",`(?:-(${c[l.PRERELEASEIDENTIFIER]}(?:\\.${c[l.PRERELEASEIDENTIFIER]})*))`),_("PRERELEASELOOSE",`(?:-?(${c[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[l.PRERELEASEIDENTIFIERLOOSE]})*))`),_("BUILDIDENTIFIER",`${m}+`),_("BUILD",`(?:\\+(${c[l.BUILDIDENTIFIER]}(?:\\.${c[l.BUILDIDENTIFIER]})*))`),_("FULLPLAIN",`v?${c[l.MAINVERSION]}${c[l.PRERELEASE]}?${c[l.BUILD]}?`),_("FULL",`^${c[l.FULLPLAIN]}$`),_("LOOSEPLAIN",`[v=\\s]*${c[l.MAINVERSIONLOOSE]}${c[l.PRERELEASELOOSE]}?${c[l.BUILD]}?`),_("LOOSE",`^${c[l.LOOSEPLAIN]}$`),_("GTLT","((?:<|>)?=?)"),_("XRANGEIDENTIFIERLOOSE",`${c[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),_("XRANGEIDENTIFIER",`${c[l.NUMERICIDENTIFIER]}|x|X|\\*`),_("XRANGEPLAIN",`[v=\\s]*(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:${c[l.PRERELEASE]})?${c[l.BUILD]}?)?)?`),_("XRANGEPLAINLOOSE",`[v=\\s]*(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:${c[l.PRERELEASELOOSE]})?${c[l.BUILD]}?)?)?`),_("XRANGE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAIN]}$`),_("XRANGELOOSE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAINLOOSE]}$`),_("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),_("COERCE",`${c[l.COERCEPLAIN]}(?:$|[^\\d])`),_("COERCEFULL",c[l.COERCEPLAIN]+`(?:${c[l.PRERELEASE]})?(?:${c[l.BUILD]})?(?:$|[^\\d])`),_("COERCERTL",c[l.COERCE],!0),_("COERCERTLFULL",c[l.COERCEFULL],!0),_("LONETILDE","(?:~>?)"),_("TILDETRIM",`(\\s*)${c[l.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",_("TILDE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAIN]}$`),_("TILDELOOSE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAINLOOSE]}$`),_("LONECARET","(?:\\^)"),_("CARETTRIM",`(\\s*)${c[l.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",_("CARET",`^${c[l.LONECARET]}${c[l.XRANGEPLAIN]}$`),_("CARETLOOSE",`^${c[l.LONECARET]}${c[l.XRANGEPLAINLOOSE]}$`),_("COMPARATORLOOSE",`^${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]})$|^$`),_("COMPARATOR",`^${c[l.GTLT]}\\s*(${c[l.FULLPLAIN]})$|^$`),_("COMPARATORTRIM",`(\\s*)${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]}|${c[l.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",_("HYPHENRANGE",`^\\s*(${c[l.XRANGEPLAIN]})\\s+-\\s+(${c[l.XRANGEPLAIN]})\\s*$`),_("HYPHENRANGELOOSE",`^\\s*(${c[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[l.XRANGEPLAINLOOSE]})\\s*$`),_("STAR","(<|>)?=?\\s*\\*"),_("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),_("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(At,At.exports)),At.exports}var kr,Ls;function Cr(){if(Ls)return kr;Ls=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return kr=n=>n?typeof n!="object"?e:n:t,kr}var Pr,xs;function Ts(){if(xs)return Pr;xs=1;const e=/^[0-9]+$/,t=(n,o)=>{if(typeof n=="number"&&typeof o=="number")return n===o?0:n<o?-1:1;const s=e.test(n),i=e.test(o);return s&&i&&(n=+n,o=+o),n===o?0:s&&!i?-1:i&&!s?1:n<o?-1:1};return Pr={compareIdentifiers:t,rcompareIdentifiers:(n,o)=>t(o,n)},Pr}var Or,qs;function ne(){if(qs)return Or;qs=1;const e=Rt(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=$t(),{safeRe:n,t:o}=He(),s=Cr(),{compareIdentifiers:i}=Ts();class a{constructor(u,l){if(l=s(l),u instanceof a){if(u.loose===!!l.loose&&u.includePrerelease===!!l.includePrerelease)return u;u=u.version}else if(typeof u!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof u}".`);if(u.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",u,l),this.options=l,this.loose=!!l.loose,this.includePrerelease=!!l.includePrerelease;const f=u.trim().match(l.loose?n[o.LOOSE]:n[o.FULL]);if(!f)throw new TypeError(`Invalid Version: ${u}`);if(this.raw=u,this.major=+f[1],this.minor=+f[2],this.patch=+f[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");f[4]?this.prerelease=f[4].split(".").map(m=>{if(/^[0-9]+$/.test(m)){const g=+m;if(g>=0&&g<r)return g}return m}):this.prerelease=[],this.build=f[5]?f[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(u){if(e("SemVer.compare",this.version,this.options,u),!(u instanceof a)){if(typeof u=="string"&&u===this.version)return 0;u=new a(u,this.options)}return u.version===this.version?0:this.compareMain(u)||this.comparePre(u)}compareMain(u){return u instanceof a||(u=new a(u,this.options)),this.major<u.major?-1:this.major>u.major?1:this.minor<u.minor?-1:this.minor>u.minor?1:this.patch<u.patch?-1:this.patch>u.patch?1:0}comparePre(u){if(u instanceof a||(u=new a(u,this.options)),this.prerelease.length&&!u.prerelease.length)return-1;if(!this.prerelease.length&&u.prerelease.length)return 1;if(!this.prerelease.length&&!u.prerelease.length)return 0;let l=0;do{const f=this.prerelease[l],m=u.prerelease[l];if(e("prerelease compare",l,f,m),f===void 0&&m===void 0)return 0;if(m===void 0)return 1;if(f===void 0)return-1;if(f===m)continue;return i(f,m)}while(++l)}compareBuild(u){u instanceof a||(u=new a(u,this.options));let l=0;do{const f=this.build[l],m=u.build[l];if(e("build compare",l,f,m),f===void 0&&m===void 0)return 0;if(m===void 0)return 1;if(f===void 0)return-1;if(f===m)continue;return i(f,m)}while(++l)}inc(u,l,f){if(u.startsWith("pre")){if(!l&&f===!1)throw new Error("invalid increment argument: identifier is empty");if(l){const m=`-${l}`.match(this.options.loose?n[o.PRERELEASELOOSE]:n[o.PRERELEASE]);if(!m||m[1]!==l)throw new Error(`invalid identifier: ${l}`)}}switch(u){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",l,f);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",l,f);break;case"prepatch":this.prerelease.length=0,this.inc("patch",l,f),this.inc("pre",l,f);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",l,f),this.inc("pre",l,f);break;case"release":if(this.prerelease.length===0)throw new 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":{const m=Number(f)?1:0;if(this.prerelease.length===0)this.prerelease=[m];else{let g=this.prerelease.length;for(;--g>=0;)typeof this.prerelease[g]=="number"&&(this.prerelease[g]++,g=-2);if(g===-1){if(l===this.prerelease.join(".")&&f===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(m)}}if(l){let g=[l,m];f===!1&&(g=[l]),i(this.prerelease[0],l)===0?isNaN(this.prerelease[1])&&(this.prerelease=g):this.prerelease=g}break}default:throw new Error(`invalid increment argument: ${u}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Or=a,Or}var Nr,Zs;function Ze(){if(Zs)return Nr;Zs=1;const e=ne();return Nr=(r,n,o=!1)=>{if(r instanceof e)return r;try{return new e(r,n)}catch(s){if(!o)return null;throw s}},Nr}var zr,Ds;function Jd(){if(Ds)return zr;Ds=1;const e=Ze();return zr=(r,n)=>{const o=e(r,n);return o?o.version:null},zr}var Lr,js;function Md(){if(js)return Lr;js=1;const e=Ze();return Lr=(r,n)=>{const o=e(r.trim().replace(/^[=v]+/,""),n);return o?o.version:null},Lr}var xr,Bs;function Wd(){if(Bs)return xr;Bs=1;const e=ne();return xr=(r,n,o,s,i)=>{typeof o=="string"&&(i=s,s=o,o=void 0);try{return new e(r instanceof e?r.version:r,o).inc(n,s,i).version}catch{return null}},xr}var Tr,Us;function Gd(){if(Us)return Tr;Us=1;const e=Ze();return Tr=(r,n)=>{const o=e(r,null,!0),s=e(n,null,!0),i=o.compare(s);if(i===0)return null;const a=i>0,c=a?o:s,u=a?s:o,l=!!c.prerelease.length;if(!!u.prerelease.length&&!l){if(!u.patch&&!u.minor)return"major";if(u.compareMain(c)===0)return u.minor&&!u.patch?"minor":"patch"}const m=l?"pre":"";return o.major!==s.major?m+"major":o.minor!==s.minor?m+"minor":o.patch!==s.patch?m+"patch":"prerelease"},Tr}var qr,Vs;function Xd(){if(Vs)return qr;Vs=1;const e=ne();return qr=(r,n)=>new e(r,n).major,qr}var Zr,Fs;function Hd(){if(Fs)return Zr;Fs=1;const e=ne();return Zr=(r,n)=>new e(r,n).minor,Zr}var Dr,Js;function Yd(){if(Js)return Dr;Js=1;const e=ne();return Dr=(r,n)=>new e(r,n).patch,Dr}var jr,Ms;function Kd(){if(Ms)return jr;Ms=1;const e=Ze();return jr=(r,n)=>{const o=e(r,n);return o&&o.prerelease.length?o.prerelease:null},jr}var Br,Ws;function le(){if(Ws)return Br;Ws=1;const e=ne();return Br=(r,n,o)=>new e(r,o).compare(new e(n,o)),Br}var Ur,Gs;function Qd(){if(Gs)return Ur;Gs=1;const e=le();return Ur=(r,n,o)=>e(n,r,o),Ur}var Vr,Xs;function eg(){if(Xs)return Vr;Xs=1;const e=le();return Vr=(r,n)=>e(r,n,!0),Vr}var Fr,Hs;function Jr(){if(Hs)return Fr;Hs=1;const e=ne();return Fr=(r,n,o)=>{const s=new e(r,o),i=new e(n,o);return s.compare(i)||s.compareBuild(i)},Fr}var Mr,Ys;function tg(){if(Ys)return Mr;Ys=1;const e=Jr();return Mr=(r,n)=>r.sort((o,s)=>e(o,s,n)),Mr}var Wr,Ks;function rg(){if(Ks)return Wr;Ks=1;const e=Jr();return Wr=(r,n)=>r.sort((o,s)=>e(s,o,n)),Wr}var Gr,Qs;function wt(){if(Qs)return Gr;Qs=1;const e=le();return Gr=(r,n,o)=>e(r,n,o)>0,Gr}var Xr,ei;function Hr(){if(ei)return Xr;ei=1;const e=le();return Xr=(r,n,o)=>e(r,n,o)<0,Xr}var Yr,ti;function ri(){if(ti)return Yr;ti=1;const e=le();return Yr=(r,n,o)=>e(r,n,o)===0,Yr}var Kr,ni;function oi(){if(ni)return Kr;ni=1;const e=le();return Kr=(r,n,o)=>e(r,n,o)!==0,Kr}var Qr,si;function en(){if(si)return Qr;si=1;const e=le();return Qr=(r,n,o)=>e(r,n,o)>=0,Qr}var tn,ii;function rn(){if(ii)return tn;ii=1;const e=le();return tn=(r,n,o)=>e(r,n,o)<=0,tn}var nn,ai;function ci(){if(ai)return nn;ai=1;const e=ri(),t=oi(),r=wt(),n=en(),o=Hr(),s=rn();return nn=(a,c,u,l)=>{switch(c){case"===":return typeof a=="object"&&(a=a.version),typeof u=="object"&&(u=u.version),a===u;case"!==":return typeof a=="object"&&(a=a.version),typeof u=="object"&&(u=u.version),a!==u;case"":case"=":case"==":return e(a,u,l);case"!=":return t(a,u,l);case">":return r(a,u,l);case">=":return n(a,u,l);case"<":return o(a,u,l);case"<=":return s(a,u,l);default:throw new TypeError(`Invalid operator: ${c}`)}},nn}var on,ui;function ng(){if(ui)return on;ui=1;const e=ne(),t=Ze(),{safeRe:r,t:n}=He();return on=(s,i)=>{if(s instanceof e)return s;if(typeof s=="number"&&(s=String(s)),typeof s!="string")return null;i=i||{};let a=null;if(!i.rtl)a=s.match(i.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);else{const g=i.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let C;for(;(C=g.exec(s))&&(!a||a.index+a[0].length!==s.length);)(!a||C.index+C[0].length!==a.index+a[0].length)&&(a=C),g.lastIndex=C.index+C[1].length+C[2].length;g.lastIndex=-1}if(a===null)return null;const c=a[2],u=a[3]||"0",l=a[4]||"0",f=i.includePrerelease&&a[5]?`-${a[5]}`:"",m=i.includePrerelease&&a[6]?`+${a[6]}`:"";return t(`${c}.${u}.${l}${f}${m}`,i)},on}var sn,li;function og(){if(li)return sn;li=1;class e{constructor(){this.max=1e3,this.map=new Map}get(r){const n=this.map.get(r);if(n!==void 0)return this.map.delete(r),this.map.set(r,n),n}delete(r){return this.map.delete(r)}set(r,n){if(!this.delete(r)&&n!==void 0){if(this.map.size>=this.max){const s=this.map.keys().next().value;this.delete(s)}this.map.set(r,n)}return this}}return sn=e,sn}var an,pi;function pe(){if(pi)return an;pi=1;const e=/\s+/g;class t{constructor(y,k){if(k=o(k),y instanceof t)return y.loose===!!k.loose&&y.includePrerelease===!!k.includePrerelease?y:new t(y.raw,k);if(y instanceof s)return this.raw=y.value,this.set=[[y]],this.formatted=void 0,this;if(this.options=k,this.loose=!!k.loose,this.includePrerelease=!!k.includePrerelease,this.raw=y.trim().replace(e," "),this.set=this.raw.split("||").map(R=>this.parseRange(R.trim())).filter(R=>R.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const R=this.set[0];if(this.set=this.set.filter(P=>!_(P[0])),this.set.length===0)this.set=[R];else if(this.set.length>1){for(const P of this.set)if(P.length===1&&O(P[0])){this.set=[P];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let y=0;y<this.set.length;y++){y>0&&(this.formatted+="||");const k=this.set[y];for(let R=0;R<k.length;R++)R>0&&(this.formatted+=" "),this.formatted+=k[R].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(y){const R=((this.options.includePrerelease&&g)|(this.options.loose&&C))+":"+y,P=n.get(R);if(P)return P;const w=this.options.loose,N=w?c[u.HYPHENRANGELOOSE]:c[u.HYPHENRANGE];y=y.replace(N,Rn(this.options.includePrerelease)),i("hyphen replace",y),y=y.replace(c[u.COMPARATORTRIM],l),i("comparator trim",y),y=y.replace(c[u.TILDETRIM],f),i("tilde trim",y),y=y.replace(c[u.CARETTRIM],m),i("caret trim",y);let j=y.split(" ").map(ee=>K(ee,this.options)).join(" ").split(/\s+/).map(ee=>$n(ee,this.options));w&&(j=j.filter(ee=>(i("loose invalid filter",ee,this.options),!!ee.match(c[u.COMPARATORLOOSE])))),i("range list",j);const q=new Map,J=j.map(ee=>new s(ee,this.options));for(const ee of J){if(_(ee))return[ee];q.set(ee.value,ee)}q.size>1&&q.has("")&&q.delete("");const oe=[...q.values()];return n.set(R,oe),oe}intersects(y,k){if(!(y instanceof t))throw new TypeError("a Range is required");return this.set.some(R=>D(R,k)&&y.set.some(P=>D(P,k)&&R.every(w=>P.every(N=>w.intersects(N,k)))))}test(y){if(!y)return!1;if(typeof y=="string")try{y=new a(y,this.options)}catch{return!1}for(let k=0;k<this.set.length;k++)if(wn(this.set[k],y,this.options))return!0;return!1}}an=t;const r=og(),n=new r,o=Cr(),s=It(),i=Rt(),a=ne(),{safeRe:c,t:u,comparatorTrimReplace:l,tildeTrimReplace:f,caretTrimReplace:m}=He(),{FLAG_INCLUDE_PRERELEASE:g,FLAG_LOOSE:C}=$t(),_=E=>E.value==="<0.0.0-0",O=E=>E.value==="",D=(E,y)=>{let k=!0;const R=E.slice();let P=R.pop();for(;k&&R.length;)k=R.every(w=>P.intersects(w,y)),P=R.pop();return k},K=(E,y)=>(E=E.replace(c[u.BUILD],""),i("comp",E,y),E=G(E,y),i("caret",E),E=U(E,y),i("tildes",E),E=z(E,y),i("xrange",E),E=An(E,y),i("stars",E),E),T=E=>!E||E.toLowerCase()==="x"||E==="*",U=(E,y)=>E.trim().split(/\s+/).map(k=>Q(k,y)).join(" "),Q=(E,y)=>{const k=y.loose?c[u.TILDELOOSE]:c[u.TILDE];return E.replace(k,(R,P,w,N,j)=>{i("tilde",E,R,P,w,N,j);let q;return T(P)?q="":T(w)?q=`>=${P}.0.0 <${+P+1}.0.0-0`:T(N)?q=`>=${P}.${w}.0 <${P}.${+w+1}.0-0`:j?(i("replaceTilde pr",j),q=`>=${P}.${w}.${N}-${j} <${P}.${+w+1}.0-0`):q=`>=${P}.${w}.${N} <${P}.${+w+1}.0-0`,i("tilde return",q),q})},G=(E,y)=>E.trim().split(/\s+/).map(k=>re(k,y)).join(" "),re=(E,y)=>{i("caret",E,y);const k=y.loose?c[u.CARETLOOSE]:c[u.CARET],R=y.includePrerelease?"-0":"";return E.replace(k,(P,w,N,j,q)=>{i("caret",E,P,w,N,j,q);let J;return T(w)?J="":T(N)?J=`>=${w}.0.0${R} <${+w+1}.0.0-0`:T(j)?w==="0"?J=`>=${w}.${N}.0${R} <${w}.${+N+1}.0-0`:J=`>=${w}.${N}.0${R} <${+w+1}.0.0-0`:q?(i("replaceCaret pr",q),w==="0"?N==="0"?J=`>=${w}.${N}.${j}-${q} <${w}.${N}.${+j+1}-0`:J=`>=${w}.${N}.${j}-${q} <${w}.${+N+1}.0-0`:J=`>=${w}.${N}.${j}-${q} <${+w+1}.0.0-0`):(i("no pr"),w==="0"?N==="0"?J=`>=${w}.${N}.${j}${R} <${w}.${N}.${+j+1}-0`:J=`>=${w}.${N}.${j}${R} <${w}.${+N+1}.0-0`:J=`>=${w}.${N}.${j} <${+w+1}.0.0-0`),i("caret return",J),J})},z=(E,y)=>(i("replaceXRanges",E,y),E.split(/\s+/).map(k=>Ye(k,y)).join(" ")),Ye=(E,y)=>{E=E.trim();const k=y.loose?c[u.XRANGELOOSE]:c[u.XRANGE];return E.replace(k,(R,P,w,N,j,q)=>{i("xRange",E,R,P,w,N,j,q);const J=T(w),oe=J||T(N),ee=oe||T(j),Ke=ee;return P==="="&&Ke&&(P=""),q=y.includePrerelease?"-0":"",J?P===">"||P==="<"?R="<0.0.0-0":R="*":P&&Ke?(oe&&(N=0),j=0,P===">"?(P=">=",oe?(w=+w+1,N=0,j=0):(N=+N+1,j=0)):P==="<="&&(P="<",oe?w=+w+1:N=+N+1),P==="<"&&(q="-0"),R=`${P+w}.${N}.${j}${q}`):oe?R=`>=${w}.0.0${q} <${+w+1}.0.0-0`:ee&&(R=`>=${w}.${N}.0${q} <${w}.${+N+1}.0-0`),i("xRange return",R),R})},An=(E,y)=>(i("replaceStars",E,y),E.trim().replace(c[u.STAR],"")),$n=(E,y)=>(i("replaceGTE0",E,y),E.trim().replace(c[y.includePrerelease?u.GTE0PRE:u.GTE0],"")),Rn=E=>(y,k,R,P,w,N,j,q,J,oe,ee,Ke)=>(T(R)?k="":T(P)?k=`>=${R}.0.0${E?"-0":""}`:T(w)?k=`>=${R}.${P}.0${E?"-0":""}`:N?k=`>=${k}`:k=`>=${k}${E?"-0":""}`,T(J)?q="":T(oe)?q=`<${+J+1}.0.0-0`:T(ee)?q=`<${J}.${+oe+1}.0-0`:Ke?q=`<=${J}.${oe}.${ee}-${Ke}`:E?q=`<${J}.${oe}.${+ee+1}-0`:q=`<=${q}`,`${k} ${q}`.trim()),wn=(E,y,k)=>{for(let R=0;R<E.length;R++)if(!E[R].test(y))return!1;if(y.prerelease.length&&!k.includePrerelease){for(let R=0;R<E.length;R++)if(i(E[R].semver),E[R].semver!==s.ANY&&E[R].semver.prerelease.length>0){const P=E[R].semver;if(P.major===y.major&&P.minor===y.minor&&P.patch===y.patch)return!0}return!1}return!0};return an}var cn,hi;function It(){if(hi)return cn;hi=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(l,f){if(f=r(f),l instanceof t){if(l.loose===!!f.loose)return l;l=l.value}l=l.trim().split(/\s+/).join(" "),i("comparator",l,f),this.options=f,this.loose=!!f.loose,this.parse(l),this.semver===e?this.value="":this.value=this.operator+this.semver.version,i("comp",this)}parse(l){const f=this.options.loose?n[o.COMPARATORLOOSE]:n[o.COMPARATOR],m=l.match(f);if(!m)throw new TypeError(`Invalid comparator: ${l}`);this.operator=m[1]!==void 0?m[1]:"",this.operator==="="&&(this.operator=""),m[2]?this.semver=new a(m[2],this.options.loose):this.semver=e}toString(){return this.value}test(l){if(i("Comparator.test",l,this.options.loose),this.semver===e||l===e)return!0;if(typeof l=="string")try{l=new a(l,this.options)}catch{return!1}return s(l,this.operator,this.semver,this.options)}intersects(l,f){if(!(l instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(l.value,f).test(this.value):l.operator===""?l.value===""?!0:new c(this.value,f).test(l.semver):(f=r(f),f.includePrerelease&&(this.value==="<0.0.0-0"||l.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||l.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&l.operator.startsWith(">")||this.operator.startsWith("<")&&l.operator.startsWith("<")||this.semver.version===l.semver.version&&this.operator.includes("=")&&l.operator.includes("=")||s(this.semver,"<",l.semver,f)&&this.operator.startsWith(">")&&l.operator.startsWith("<")||s(this.semver,">",l.semver,f)&&this.operator.startsWith("<")&&l.operator.startsWith(">")))}}cn=t;const r=Cr(),{safeRe:n,t:o}=He(),s=ci(),i=Rt(),a=ne(),c=pe();return cn}var un,fi;function kt(){if(fi)return un;fi=1;const e=pe();return un=(r,n,o)=>{try{n=new e(n,o)}catch{return!1}return n.test(r)},un}var ln,mi;function sg(){if(mi)return ln;mi=1;const e=pe();return ln=(r,n)=>new e(r,n).set.map(o=>o.map(s=>s.value).join(" ").trim().split(" ")),ln}var pn,di;function ig(){if(di)return pn;di=1;const e=ne(),t=pe();return pn=(n,o,s)=>{let i=null,a=null,c=null;try{c=new t(o,s)}catch{return null}return n.forEach(u=>{c.test(u)&&(!i||a.compare(u)===-1)&&(i=u,a=new e(i,s))}),i},pn}var hn,gi;function ag(){if(gi)return hn;gi=1;const e=ne(),t=pe();return hn=(n,o,s)=>{let i=null,a=null,c=null;try{c=new t(o,s)}catch{return null}return n.forEach(u=>{c.test(u)&&(!i||a.compare(u)===1)&&(i=u,a=new e(i,s))}),i},hn}var fn,vi;function cg(){if(vi)return fn;vi=1;const e=ne(),t=pe(),r=wt();return fn=(o,s)=>{o=new t(o,s);let i=new e("0.0.0");if(o.test(i)||(i=new e("0.0.0-0"),o.test(i)))return i;i=null;for(let a=0;a<o.set.length;++a){const c=o.set[a];let u=null;c.forEach(l=>{const f=new e(l.semver.version);switch(l.operator){case">":f.prerelease.length===0?f.patch++:f.prerelease.push(0),f.raw=f.format();case"":case">=":(!u||r(f,u))&&(u=f);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${l.operator}`)}}),u&&(!i||r(i,u))&&(i=u)}return i&&o.test(i)?i:null},fn}var mn,bi;function ug(){if(bi)return mn;bi=1;const e=pe();return mn=(r,n)=>{try{return new e(r,n).range||"*"}catch{return null}},mn}var dn,_i;function gn(){if(_i)return dn;_i=1;const e=ne(),t=It(),{ANY:r}=t,n=pe(),o=kt(),s=wt(),i=Hr(),a=rn(),c=en();return dn=(l,f,m,g)=>{l=new e(l,g),f=new n(f,g);let C,_,O,D,K;switch(m){case">":C=s,_=a,O=i,D=">",K=">=";break;case"<":C=i,_=c,O=s,D="<",K="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(o(l,f,g))return!1;for(let T=0;T<f.set.length;++T){const U=f.set[T];let Q=null,G=null;if(U.forEach(re=>{re.semver===r&&(re=new t(">=0.0.0")),Q=Q||re,G=G||re,C(re.semver,Q.semver,g)?Q=re:O(re.semver,G.semver,g)&&(G=re)}),Q.operator===D||Q.operator===K||(!G.operator||G.operator===D)&&_(l,G.semver))return!1;if(G.operator===K&&O(l,G.semver))return!1}return!0},dn}var vn,yi;function lg(){if(yi)return vn;yi=1;const e=gn();return vn=(r,n,o)=>e(r,n,">",o),vn}var bn,Si;function pg(){if(Si)return bn;Si=1;const e=gn();return bn=(r,n,o)=>e(r,n,"<",o),bn}var _n,Ei;function hg(){if(Ei)return _n;Ei=1;const e=pe();return _n=(r,n,o)=>(r=new e(r,o),n=new e(n,o),r.intersects(n,o)),_n}var yn,Ai;function fg(){if(Ai)return yn;Ai=1;const e=kt(),t=le();return yn=(r,n,o)=>{const s=[];let i=null,a=null;const c=r.sort((m,g)=>t(m,g,o));for(const m of c)e(m,n,o)?(a=m,i||(i=m)):(a&&s.push([i,a]),a=null,i=null);i&&s.push([i,null]);const u=[];for(const[m,g]of s)m===g?u.push(m):!g&&m===c[0]?u.push("*"):g?m===c[0]?u.push(`<=${g}`):u.push(`${m} - ${g}`):u.push(`>=${m}`);const l=u.join(" || "),f=typeof n.raw=="string"?n.raw:String(n);return l.length<f.length?l:n},yn}var Sn,$i;function mg(){if($i)return Sn;$i=1;const e=pe(),t=It(),{ANY:r}=t,n=kt(),o=le(),s=(f,m,g={})=>{if(f===m)return!0;f=new e(f,g),m=new e(m,g);let C=!1;e:for(const _ of f.set){for(const O of m.set){const D=c(_,O,g);if(C=C||D!==null,D)continue e}if(C)return!1}return!0},i=[new t(">=0.0.0-0")],a=[new t(">=0.0.0")],c=(f,m,g)=>{if(f===m)return!0;if(f.length===1&&f[0].semver===r){if(m.length===1&&m[0].semver===r)return!0;g.includePrerelease?f=i:f=a}if(m.length===1&&m[0].semver===r){if(g.includePrerelease)return!0;m=a}const C=new Set;let _,O;for(const z of f)z.operator===">"||z.operator===">="?_=u(_,z,g):z.operator==="<"||z.operator==="<="?O=l(O,z,g):C.add(z.semver);if(C.size>1)return null;let D;if(_&&O){if(D=o(_.semver,O.semver,g),D>0)return null;if(D===0&&(_.operator!==">="||O.operator!=="<="))return null}for(const z of C){if(_&&!n(z,String(_),g)||O&&!n(z,String(O),g))return null;for(const Ye of m)if(!n(z,String(Ye),g))return!1;return!0}let K,T,U,Q,G=O&&!g.includePrerelease&&O.semver.prerelease.length?O.semver:!1,re=_&&!g.includePrerelease&&_.semver.prerelease.length?_.semver:!1;G&&G.prerelease.length===1&&O.operator==="<"&&G.prerelease[0]===0&&(G=!1);for(const z of m){if(Q=Q||z.operator===">"||z.operator===">=",U=U||z.operator==="<"||z.operator==="<=",_){if(re&&z.semver.prerelease&&z.semver.prerelease.length&&z.semver.major===re.major&&z.semver.minor===re.minor&&z.semver.patch===re.patch&&(re=!1),z.operator===">"||z.operator===">="){if(K=u(_,z,g),K===z&&K!==_)return!1}else if(_.operator===">="&&!n(_.semver,String(z),g))return!1}if(O){if(G&&z.semver.prerelease&&z.semver.prerelease.length&&z.semver.major===G.major&&z.semver.minor===G.minor&&z.semver.patch===G.patch&&(G=!1),z.operator==="<"||z.operator==="<="){if(T=l(O,z,g),T===z&&T!==O)return!1}else if(O.operator==="<="&&!n(O.semver,String(z),g))return!1}if(!z.operator&&(O||_)&&D!==0)return!1}return!(_&&U&&!O&&D!==0||O&&Q&&!_&&D!==0||re||G)},u=(f,m,g)=>{if(!f)return m;const C=o(f.semver,m.semver,g);return C>0?f:C<0||m.operator===">"&&f.operator===">="?m:f},l=(f,m,g)=>{if(!f)return m;const C=o(f.semver,m.semver,g);return C<0?f:C>0||m.operator==="<"&&f.operator==="<="?m:f};return Sn=s,Sn}var En,Ri;function dg(){if(Ri)return En;Ri=1;const e=He(),t=$t(),r=ne(),n=Ts(),o=Ze(),s=Jd(),i=Md(),a=Wd(),c=Gd(),u=Xd(),l=Hd(),f=Yd(),m=Kd(),g=le(),C=Qd(),_=eg(),O=Jr(),D=tg(),K=rg(),T=wt(),U=Hr(),Q=ri(),G=oi(),re=en(),z=rn(),Ye=ci(),An=ng(),$n=It(),Rn=pe(),wn=kt(),E=sg(),y=ig(),k=ag(),R=cg(),P=ug(),w=gn(),N=lg(),j=pg(),q=hg(),J=fg(),oe=mg();return En={parse:o,valid:s,clean:i,inc:a,diff:c,major:u,minor:l,patch:f,prerelease:m,compare:g,rcompare:C,compareLoose:_,compareBuild:O,sort:D,rsort:K,gt:T,lt:U,eq:Q,neq:G,gte:re,lte:z,cmp:Ye,coerce:An,Comparator:$n,Range:Rn,satisfies:wn,toComparators:E,maxSatisfying:y,minSatisfying:k,minVersion:R,validRange:P,outside:w,gtr:N,ltr:j,intersects:q,simplifyRange:J,subset:oe,SemVer:r,re:e.re,src:e.src,tokens:e.t,SEMVER_SPEC_VERSION:t.SEMVER_SPEC_VERSION,RELEASE_TYPES:t.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},En}var gg=dg();const vg=(e,t)=>bg(t)?t.hostnames.includes(new URL(e).hostname):_g(t)?!!e.match(t.regexp):!1,bg=e=>Er.safeParse(e).success,_g=e=>Ar.safeParse(e).success,yg=(e,t)=>t?gg.satisfies(e,t):!0,Sg=(e,t,r)=>yg(t,r.libraryVersionRange)&&vg(e,r.matcher),Eg=(e,t)=>e.siteRegistrations.filter(r=>Sg(t,Sr(),r)),Ag=(e,t)=>Eg(e,t).flatMap(({parsers:o,name:s})=>o.filter(i=>Cs(i)&&i in yr).map(i=>({parser:yr[i],parserType:i,name:s}))),wi=(e,t)=>{const r=Ag(e,t.url);for(const{parser:n,parserType:o,name:s}of r){const i=n(t);if(dt(i)||Ho(i)||Yo(i))return{...i,meta:{parserName:s,parserType:o,uri:t.url,referrer:t.url}}}return{...Go(),meta:{parserName:null,parserType:L.NoResourceFound,uri:t.url,referrer:t.url}}},$g=(e,t)=>{const r=wi(e,t),{uri:n,...o}=r.meta;return{...r,meta:o}},Rg=(e,t)=>{switch(t){case ye.CA:return new URL(`https://${e}.rl.ca.talis.com`);default:return new URL(`https://${e}.rl.talis.com`)}},wg=(e,t)=>{const r=Rg(e,t);return new URL("/ui/forms/bookmarklet.html",r)},Ig=(e,t,r)=>{const n=Io(t);n.append("fast","true"),n.append("breakout","true"),r&&(r.parserName&&n.append("targetTitle",r.parserName),n.append("referrer",r.referrer));const o=new URL(e.toString());return o.search=n.toString(),o};b.BookGenresSchema=ql,b.CustomerListSchema=No,b.CustomerSchema=Jt,b.DirectLinkOnlyResultSchema=Xt,b.Genre=S,b.HostnamesMatcherSchema=Er,b.JournalGenresSchema=Zl,b.NON_OPENURL_PROPERTIES=Vt,b.NonOpenUrlPropertiesSchema=Bt,b.NothingParsedResultSchema=Gt,b.OPENURL_KEYS=Ro,b.OpenUrlAudioVisualResourceSchema=Bl,b.OpenUrlBookResourceSchema=Dl,b.OpenUrlDocumentResourceSchema=Vl,b.OpenUrlImageResourceSchema=Ul,b.OpenUrlJournalResourceSchema=jl,b.OpenUrlResourceSchema=de,b.OpenUrlResultSchema=Ht,b.OpenUrlWebpageResourceSchema=Fl,b.PARSERS=yr,b.ParserRegistrySchema=ks,b.ParserType=L,b.ParsingMetadataSchema=Mt,b.ParsingMetadataV2Schema=Wt,b.ParsingRequestSchema=Oo,b.ParsingResponseSchema=To,b.ParsingResponseV2Schema=qo,b.ParsingResultSchema=pt,b.REGISTRY=Dd,b.RegExpMatcherSchema=Ar,b.ResourceDataSchema=Ps,b.ResourceSchema=Eo,b.SiteRegistrationSchema=Rr,b.SummonSearchResultSchema=Kt,b.TenantRegion=ye,b.TenantRegistrySchema=Hl,b.TenantSchema=Ft,b.UrlMatcherSchema=$r,b.Z3988SearchResultSchema=Yt,b.convertCustomerListToTenantRegistry=Ql,b.createAudioVisual=me,b.createBook=F,b.createDocument=Ut,b.createImage=Ao,b.createJournal=Z,b.createWebpage=lt,b.directLinkOnly=tp,b.fromOpenUrl=Co,b.getBaseBookmarkingUrl=wg,b.getLibraryVersion=Sr,b.isCustomer=zo,b.isCustomerList=Lo,b.isDirectLinkOnlyResult=Rh,b.isGenre=Xl,b.isNothingParsedResult=wh,b.isOpenUrlResult=dt,b.isParserRegistry=jd,b.isParserType=Cs,b.isParsingMetadata=Ah,b.isParsingMetadataV2=$h,b.isParsingRequest=Yl,b.isParsingResponse=Sh,b.isParsingResponseV2=Eh,b.isParsingResult=yh,b.isResourceData=Fd,b.isSiteRegistration=Bd,b.isSummonSearchResult=Yo,b.isTenant=xo,b.isTenantRegion=Kl,b.isUrlMatcher=Ud,b.isZ3988SearchResult=Ho,b.nothingParsed=x,b.openUrlResource=A,b.parseResource=wi,b.parseResourceV2=$g,b.summonSearchResult=Do,b.toBookmarkingWorkflowUrl=Ig,b.toOpenUrl=Io,b.z3988SearchResult=Zo,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})}));