@talisdev/bibliographic-resource-parsers-lib 5.23.4

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.
@@ -0,0 +1,20 @@
1
+ (function(v,d){typeof exports=="object"&&typeof module<"u"?d(exports):typeof define=="function"&&define.amd?define(["exports"],d):(v=typeof globalThis<"u"?globalThis:v||self,d(v.BibliographicResourceParsersLib={}))})(this,(function(v){"use strict";function d(e,t,r){function n(a,u){var c;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(c=a._zod).traits??(c.traits=new Set),a._zod.traits.add(e),t(a,u);for(const l in s.prototype)l in a||Object.defineProperty(a,l,{value:s.prototype[l].bind(a)});a._zod.constr=s,a._zod.def=u}const o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var u;const c=r?.Parent?new i:this;n(c,a),(u=c._zod).deferred??(u.deferred=[]);for(const l of c._zod.deferred)l();return c}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class Pe extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class fn extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const mn={};function de(e){return mn}function fi(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 yt(e,t){return typeof t=="bigint"?t.toString():t}function $t(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Rt(e){return e==null}function At(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function mi(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 u=n.match(/\d?e-(\d?)/);u?.[1]&&(o=Number.parseInt(u[1]))}const i=r>o?r:o,s=Number.parseInt(e.toFixed(i).replace(".","")),a=Number.parseInt(t.toFixed(i).replace(".",""));return s%a/10**i}const dn=Symbol("evaluating");function V(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==dn)return n===void 0&&(n=dn,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 Ae(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function gn(e){return JSON.stringify(e)}const vn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Xe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const di=$t(()=>{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(Xe(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(Xe(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function bn(e){return Oe(e)?{...e}:Array.isArray(e)?[...e]:e}const gi=new Set(["string","number","symbol"]);function Ne(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ge(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 vi(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const bi={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 _i(e,t){const r=e._zod.def,n=Ae(e._zod.def,{get shape(){const o={};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(o[i]=r.shape[i])}return Re(this,"shape",o),o},checks:[]});return ge(e,n)}function Si(e,t){const r=e._zod.def,n=Ae(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete o[i]}return Re(this,"shape",o),o},checks:[]});return ge(e,n)}function Ei(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=Ae(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Re(this,"shape",i),i},checks:[]});return ge(e,o)}function yi(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 Re(this,"shape",n),n},checks:e._zod.def.checks};return ge(e,r)}function $i(e,t){const r=Ae(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 ge(e,r)}function Ri(e,t,r){const n=Ae(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(r)for(const s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=e?new e({type:"optional",innerType:o[s]}):o[s])}else for(const s in o)i[s]=e?new e({type:"optional",innerType:o[s]}):o[s];return Re(this,"shape",i),i},checks:[]});return ge(t,n)}function Ai(e,t,r){const n=Ae(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(r)for(const s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new e({type:"nonoptional",innerType:o[s]}))}else for(const s in o)i[s]=new e({type:"nonoptional",innerType:o[s]});return Re(this,"shape",i),i},checks:[]});return ge(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 He(e){return typeof e=="string"?e:e?.message}function ve(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=He(e.inst?._zod.def?.error?.(e))??He(t?.error?.(e))??He(r.customError?.(e))??He(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function wt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function xe(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const _n=(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,yt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Sn=d("$ZodError",_n),En=d("$ZodError",_n,{Parent:Error});function wi(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 Ii(e,t){const r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>o({issues:a}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)n._errors.push(r(s));else{let a=n,u=0;for(;u<s.path.length;){const c=s.path[u];u===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(s))):a[c]=a[c]||{_errors:[]},a=a[c],u++}}};return o(e),n}const It=e=>(t,r,n,o)=>{const i=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new Pe;if(s.issues.length){const a=new(o?.Err??e)(s.issues.map(u=>ve(u,i,de())));throw vn(a,o?.callee),a}return s.value},kt=e=>async(t,r,n,o)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new(o?.Err??e)(s.issues.map(u=>ve(u,i,de())));throw vn(a,o?.callee),a}return s.value},Ye=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Pe;return i.issues.length?{success:!1,error:new(e??Sn)(i.issues.map(s=>ve(s,o,de())))}:{success:!0,data:i.value}},ki=Ye(En),Ke=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>ve(s,o,de())))}:{success:!0,data:i.value}},Ci=Ke(En),Pi=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return It(e)(t,r,o)},Oi=e=>(t,r,n)=>It(e)(t,r,n),Ni=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return kt(e)(t,r,o)},zi=e=>async(t,r,n)=>kt(e)(t,r,n),Li=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ye(e)(t,r,o)},Ti=e=>(t,r,n)=>Ye(e)(t,r,n),Zi=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ke(e)(t,r,o)},xi=e=>async(t,r,n)=>Ke(e)(t,r,n),qi=/^[cC][^\s-]{8,}$/,ji=/^[0-9a-z]+$/,Di=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ui=/^[0-9a-vA-V]{20}$/,Bi=/^[A-Za-z0-9]{27}$/,Vi=/^[a-zA-Z0-9_-]{21}$/,Fi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ji=/^([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})$/,yn=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)$/,Mi=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Wi="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Gi(){return new RegExp(Wi,"u")}const Xi=/^(?:(?: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])$/,Hi=/^(([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}|:))$/,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])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ki=/^(([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])$/,Qi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$n=/^[A-Za-z0-9_-]*$/,ea=/^(?=.{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])?)*\.?$/,ta=/^\+(?:[0-9]){6,14}[0-9]$/,Rn="(?:(?:\\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])))",ra=new RegExp(`^${Rn}$`);function An(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 na(e){return new RegExp(`^${An(e)}$`)}function oa(e){const t=An({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(`^${Rn}T(?:${n})$`)}const sa=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ia=/^-?\d+$/,aa=/^-?\d+(?:\.\d+)?/,ca=/^null$/i,ua=/^[^A-Z]*$/,la=/^[^a-z]*$/,se=d("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),wn={number:"number",bigint:"bigint",object:"date"},In=d("$ZodCheckLessThan",(e,t)=>{se.init(e,t);const r=wn[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(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})}}),kn=d("$ZodCheckGreaterThan",(e,t)=>{se.init(e,t);const r=wn[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(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})}}),pa=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):mi(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})}}),ha=d("$ZodCheckNumberFormat",(e,t)=>{se.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,i]=bi[t.format];e._zod.onattach.push(s=>{const a=s._zod.bag;a.format=t.format,a.minimum=o,a.maximum=i,r&&(a.pattern=ia)}),e._zod.check=s=>{const a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.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}):s.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&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inst:e})}}),fa=d("$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 s=wt(o);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ma=d("$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 s=wt(o);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),da=d("$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,i=o.length;if(i===t.length)return;const s=wt(o),a=i>t.length;n.issues.push({origin:s,...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})}}),Qe=d("$ZodCheckStringFormat",(e,t)=>{var r,n;se.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.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=()=>{})}),ga=d("$ZodCheckRegex",(e,t)=>{Qe.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})}}),va=d("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ua),Qe.init(e,t)}),ba=d("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=la),Qe.init(e,t)}),_a=d("$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 i=o._zod.bag;i.patterns??(i.patterns=new Set),i.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})}}),Sa=d("$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})}}),Ea=d("$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})}}),ya=d("$ZodCheckOverwrite",(e,t)=>{se.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class $a{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
+ `).filter(s=>s),o=Math.min(...n.map(s=>s.length-s.trimStart().length)),i=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,o.join(`
3
+ `))}}const Ra={major:4,minor:1,patch:11},G=d("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ra;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(s,a,u)=>{let c=ze(s),l;for(const f of a){if(f._zod.def.when){if(!f._zod.def.when(s))continue}else if(c)continue;const m=s.issues.length,g=f._zod.check(s);if(g instanceof Promise&&u?.async===!1)throw new Pe;if(l||g instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await g,s.issues.length!==m&&(c||(c=ze(s,m)))});else{if(s.issues.length===m)continue;c||(c=ze(s,m))}}return l?l.then(()=>s):s},i=(s,a,u)=>{if(ze(s))return s.aborted=!0,s;const c=o(a,n,u);if(c instanceof Promise){if(u.async===!1)throw new Pe;return c.then(l=>e._zod.parse(l,u))}return e._zod.parse(c,u)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){const c=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return c instanceof Promise?c.then(l=>i(l,s,a)):i(c,s,a)}const u=e._zod.parse(s,a);if(u instanceof Promise){if(a.async===!1)throw new Pe;return u.then(c=>o(c,n,a))}return o(u,n,a)}}e["~standard"]={validate:o=>{try{const i=ki(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Ci(e,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),Ct=d("$ZodString",(e,t)=>{G.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??sa(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=d("$ZodStringFormat",(e,t)=>{Qe.init(e,t),Ct.init(e,t)}),Aa=d("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ji),J.init(e,t)}),wa=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=yn(n))}else t.pattern??(t.pattern=yn());J.init(e,t)}),Ia=d("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Mi),J.init(e,t)}),ka=d("$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:ea.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})}}}),Ca=d("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Gi()),J.init(e,t)}),Pa=d("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Vi),J.init(e,t)}),Oa=d("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=qi),J.init(e,t)}),Na=d("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ji),J.init(e,t)}),za=d("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Di),J.init(e,t)}),La=d("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ui),J.init(e,t)}),Ta=d("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Bi),J.init(e,t)}),Za=d("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=oa(t)),J.init(e,t)}),xa=d("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ra),J.init(e,t)}),qa=d("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=na(t)),J.init(e,t)}),ja=d("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Fi),J.init(e,t)}),Da=d("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Xi),J.init(e,t),e._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv4"})}),Ua=d("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Hi),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})}}}),Ba=d("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Yi),J.init(e,t)}),Va=d("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ki),J.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[o,i]=n;if(!i)throw new Error;const s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>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 Cn(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Fa=d("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Qi),J.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{Cn(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Ja(e){if(!$n.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Cn(r)}const Ma=d("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=$n),J.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{Ja(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Wa=d("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ta),J.init(e,t)});function Ga(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 Xa=d("$ZodJWT",(e,t)=>{J.init(e,t),e._zod.check=r=>{Ga(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Pn=d("$ZodNumber",(e,t)=>{G.init(e,t),e._zod.pattern=e._zod.bag.pattern??aa,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 i=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,...i?{received:i}:{}}),r}}),Ha=d("$ZodNumber",(e,t)=>{ha.init(e,t),Pn.init(e,t)}),Ya=d("$ZodNull",(e,t)=>{G.init(e,t),e._zod.pattern=ca,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}}),Ka=d("$ZodUnknown",(e,t)=>{G.init(e,t),e._zod.parse=r=>r}),Qa=d("$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 On(e,t,r){e.issues.length&&t.issues.push(...Le(r,e.issues)),t.value[r]=e.value}const ec=d("$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 i=[];for(let s=0;s<o.length;s++){const a=o[s],u=t.element._zod.run({value:a,issues:[]},n);u instanceof Promise?i.push(u.then(c=>On(c,r,s))):On(u,r,s)}return i.length?Promise.all(i).then(()=>r):r}});function et(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 Nn(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=vi(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function zn(e,t,r,n,o,i){const s=[],a=o.keySet,u=o.catchall._zod,c=u.def.type;for(const l of Object.keys(t)){if(a.has(l))continue;if(c==="never"){s.push(l);continue}const f=u.run({value:t[l],issues:[]},n);f instanceof Promise?e.push(f.then(m=>et(m,r,l,t))):et(f,r,l,t)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}const tc=d("$ZodObject",(e,t)=>{if(G.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...a};return Object.defineProperty(t,"shape",{value:u}),u}})}const n=$t(()=>Nn(t));V(e._zod,"propValues",()=>{const a=t.shape,u={};for(const c in a){const l=a[c]._zod;if(l.values){u[c]??(u[c]=new Set);for(const f of l.values)u[c].add(f)}}return u});const o=Xe,i=t.catchall;let s;e._zod.parse=(a,u)=>{s??(s=n.value);const c=a.value;if(!o(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),a;a.value={};const l=[],f=s.shape;for(const m of s.keys){const P=f[m]._zod.run({value:c[m],issues:[]},u);P instanceof Promise?l.push(P.then(b=>et(b,a,m,c))):et(P,a,m,c)}return i?zn(l,c,a,u,n.value,e):l.length?Promise.all(l).then(()=>a):a}}),rc=d("$ZodObjectJIT",(e,t)=>{tc.init(e,t);const r=e._zod.parse,n=$t(()=>Nn(t)),o=m=>{const g=new $a(["shape","payload","ctx"]),P=n.value,b=L=>{const B=gn(L);return`shape[${B}]._zod.run({ value: input[${B}], issues: [] }, ctx)`};g.write("const input = payload.value;");const O=Object.create(null);let q=0;for(const L of P.keys)O[L]=`key_${q++}`;g.write("const newResult = {};");for(const L of P.keys){const B=O[L],Q=gn(L);g.write(`const ${B} = ${b(L)};`),g.write(`
4
+ if (${B}.issues.length) {
5
+ payload.issues = payload.issues.concat(${B}.issues.map(iss => ({
6
+ ...iss,
7
+ path: iss.path ? [${Q}, ...iss.path] : [${Q}]
8
+ })));
9
+ }
10
+
11
+
12
+ if (${B}.value === undefined) {
13
+ if (${Q} in input) {
14
+ newResult[${Q}] = undefined;
15
+ }
16
+ } else {
17
+ newResult[${Q}] = ${B}.value;
18
+ }
19
+
20
+ `)}g.write("payload.value = newResult;"),g.write("return payload;");const K=g.compile();return(L,B)=>K(m,L,B)};let i;const s=Xe,a=!mn.jitless,c=a&&di.value,l=t.catchall;let f;e._zod.parse=(m,g)=>{f??(f=n.value);const P=m.value;return s(P)?a&&c&&g?.async===!1&&g.jitless!==!0?(i||(i=o(t.shape)),m=i(m,g),l?zn([],P,m,g,f,e):m):r(m,g):(m.issues.push({expected:"object",code:"invalid_type",input:P,inst:e}),m)}});function Ln(e,t,r,n){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!ze(i));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(i=>i.issues.map(s=>ve(s,n,de())))}),t)}const nc=d("$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(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>At(i.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let s=!1;const a=[];for(const u of t.options){const c=u._zod.run({value:o.value,issues:[]},i);if(c instanceof Promise)a.push(c),s=!0;else{if(c.issues.length===0)return c;a.push(c)}}return s?Promise.all(a).then(u=>Ln(u,o,e,i)):Ln(a,o,e,i)}}),oc=d("$ZodIntersection",(e,t)=>{G.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([u,c])=>Tn(r,u,c)):Tn(r,i,s)}});function Pt(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(i=>r.indexOf(i)!==-1),o={...e,...t};for(const i of n){const s=Pt(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.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],i=t[n],s=Pt(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Tn(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=Pt(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 sc=d("$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 i=[];if(t.keyType._zod.values){const s=t.keyType._zod.values;r.value={};for(const u of s)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){const c=t.valueType._zod.run({value:o[u],issues:[]},n);c instanceof Promise?i.push(c.then(l=>{l.issues.length&&r.issues.push(...Le(u,l.issues)),r.value[u]=l.value})):(c.issues.length&&r.issues.push(...Le(u,c.issues)),r.value[u]=c.value)}let a;for(const u in o)s.has(u)||(a=a??[],a.push(u));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{r.value={};for(const s of Reflect.ownKeys(o)){if(s==="__proto__")continue;const a=t.keyType._zod.run({value:s,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(c=>ve(c,n,de())),input:s,path:[s],inst:e}),r.value[a.value]=a.value;continue}const u=t.valueType._zod.run({value:o[s],issues:[]},n);u instanceof Promise?i.push(u.then(c=>{c.issues.length&&r.issues.push(...Le(s,c.issues)),r.value[a.value]=c.value})):(u.issues.length&&r.issues.push(...Le(s,u.issues)),r.value[a.value]=u.value)}}return i.length?Promise.all(i).then(()=>r):r}}),ic=d("$ZodEnum",(e,t)=>{G.init(e,t);const r=fi(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>gi.has(typeof o)).map(o=>typeof o=="string"?Ne(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),ac=d("$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}}),cc=d("$ZodTransform",(e,t)=>{G.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new fn(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,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 uc=d("$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(`^(${At(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(i=>Zn(i,r.value)):Zn(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),lc=d("$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(`^(${At(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)}),pc=d("$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(i=>xn(i,t)):xn(o,t)}});function xn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const hc=d("$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))}),fc=d("$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(i=>qn(i,e)):qn(o,e)}});function qn(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 mc=d("$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(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(s=>ve(s,n,de()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>ve(i,n,de()))},input:r.value}),r.issues=[]),r)}}),dc=d("$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 i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>tt(s,t.in,n)):tt(i,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>tt(i,t.out,n)):tt(o,t.out,n)}});function tt(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const gc=d("$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(jn):jn(o)}});function jn(e){return e.value=Object.freeze(e.value),e}const vc=d("$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(i=>Dn(i,r,n,e));Dn(o,r,n,e)}});function Dn(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(xe(o))}}class bc{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 _c(){return new bc}const rt=_c();function Sc(e,t){return new e({type:"string",...$(t)})}function Ec(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...$(t)})}function Un(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...$(t)})}function yc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...$(t)})}function $c(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...$(t)})}function Rc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...$(t)})}function Ac(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...$(t)})}function Bn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...$(t)})}function wc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...$(t)})}function Ic(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...$(t)})}function kc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...$(t)})}function Cc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...$(t)})}function Pc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...$(t)})}function Oc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...$(t)})}function Nc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...$(t)})}function zc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...$(t)})}function Lc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...$(t)})}function Tc(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 xc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...$(t)})}function qc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...$(t)})}function jc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...$(t)})}function Dc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...$(t)})}function Uc(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...$(t)})}function Bc(e,t){return new e({type:"string",format:"date",check:"string_format",...$(t)})}function Vc(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...$(t)})}function Fc(e,t){return new e({type:"string",format:"duration",check:"string_format",...$(t)})}function Jc(e,t){return new e({type:"number",checks:[],...$(t)})}function Mc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...$(t)})}function Wc(e,t){return new e({type:"null",...$(t)})}function Gc(e){return new e({type:"unknown"})}function Xc(e,t){return new e({type:"never",...$(t)})}function Vn(e,t){return new In({check:"less_than",...$(t),value:e,inclusive:!1})}function Ot(e,t){return new In({check:"less_than",...$(t),value:e,inclusive:!0})}function Fn(e,t){return new kn({check:"greater_than",...$(t),value:e,inclusive:!1})}function Nt(e,t){return new kn({check:"greater_than",...$(t),value:e,inclusive:!0})}function Jn(e,t){return new pa({check:"multiple_of",...$(t),value:e})}function Mn(e,t){return new fa({check:"max_length",...$(t),maximum:e})}function nt(e,t){return new ma({check:"min_length",...$(t),minimum:e})}function Wn(e,t){return new da({check:"length_equals",...$(t),length:e})}function Hc(e,t){return new ga({check:"string_format",format:"regex",...$(t),pattern:e})}function Yc(e){return new va({check:"string_format",format:"lowercase",...$(e)})}function Kc(e){return new ba({check:"string_format",format:"uppercase",...$(e)})}function Qc(e,t){return new _a({check:"string_format",format:"includes",...$(t),includes:e})}function eu(e,t){return new Sa({check:"string_format",format:"starts_with",...$(t),prefix:e})}function tu(e,t){return new Ea({check:"string_format",format:"ends_with",...$(t),suffix:e})}function qe(e){return new ya({check:"overwrite",tx:e})}function ru(e){return qe(t=>t.normalize(e))}function nu(){return qe(e=>e.trim())}function ou(){return qe(e=>e.toLowerCase())}function su(){return qe(e=>e.toUpperCase())}function iu(e,t,r){return new e({type:"array",element:t,...$(r)})}function au(e,t,r){const n=$(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function cu(e,t,r){return new e({type:"custom",check:"custom",fn:t,...$(r)})}function uu(e){const t=lu(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(xe(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(xe(o))}},e(r.value,r)));return t}function lu(e,t){const r=new se({check:"custom",...$(t)});return r._zod.check=e,r}const pu=d("ZodISODateTime",(e,t)=>{Za.init(e,t),X.init(e,t)});function hu(e){return Uc(pu,e)}const fu=d("ZodISODate",(e,t)=>{xa.init(e,t),X.init(e,t)});function mu(e){return Bc(fu,e)}const du=d("ZodISOTime",(e,t)=>{qa.init(e,t),X.init(e,t)});function gu(e){return Vc(du,e)}const vu=d("ZodISODuration",(e,t)=>{ja.init(e,t),X.init(e,t)});function bu(e){return Fc(vu,e)}const ae=d("ZodError",(e,t)=>{Sn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Ii(e,r)},flatten:{value:r=>wi(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,yt,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,yt,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),_u=It(ae),Su=kt(ae),Eu=Ye(ae),yu=Ke(ae),$u=Pi(ae),Ru=Oi(ae),Au=Ni(ae),wu=zi(ae),Iu=Li(ae),ku=Ti(ae),Cu=Zi(ae),Pu=xi(ae),H=d("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(Ae(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>ge(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>_u(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Eu(e,r,n),e.parseAsync=async(r,n)=>Su(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>yu(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>$u(e,r,n),e.decode=(r,n)=>Ru(e,r,n),e.encodeAsync=async(r,n)=>Au(e,r,n),e.decodeAsync=async(r,n)=>wu(e,r,n),e.safeEncode=(r,n)=>Iu(e,r,n),e.safeDecode=(r,n)=>ku(e,r,n),e.safeEncodeAsync=async(r,n)=>Cu(e,r,n),e.safeDecodeAsync=async(r,n)=>Pu(e,r,n),e.refine=(r,n)=>e.check(El(r,n)),e.superRefine=r=>e.check(yl(r)),e.overwrite=r=>e.check(qe(r)),e.optional=()=>he(e),e.nullable=()=>no(e),e.nullish=()=>he(no(e)),e.nonoptional=r=>ml(e,r),e.array=()=>D(e),e.or=r=>pe([e,r]),e.and=r=>ol(e,r),e.transform=r=>so(e,cl(r)),e.default=r=>pl(e,r),e.prefault=r=>fl(e,r),e.catch=r=>gl(e,r),e.pipe=r=>so(e,r),e.readonly=()=>_l(e),e.describe=r=>{const n=e.clone();return rt.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return rt.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return rt.get(e);const n=e.clone();return rt.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Gn=d("_ZodString",(e,t)=>{Ct.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(Hc(...n)),e.includes=(...n)=>e.check(Qc(...n)),e.startsWith=(...n)=>e.check(eu(...n)),e.endsWith=(...n)=>e.check(tu(...n)),e.min=(...n)=>e.check(nt(...n)),e.max=(...n)=>e.check(Mn(...n)),e.length=(...n)=>e.check(Wn(...n)),e.nonempty=(...n)=>e.check(nt(1,...n)),e.lowercase=n=>e.check(Yc(n)),e.uppercase=n=>e.check(Kc(n)),e.trim=()=>e.check(nu()),e.normalize=(...n)=>e.check(ru(...n)),e.toLowerCase=()=>e.check(ou()),e.toUpperCase=()=>e.check(su())}),Ou=d("ZodString",(e,t)=>{Ct.init(e,t),Gn.init(e,t),e.email=r=>e.check(Ec(Nu,r)),e.url=r=>e.check(Bn(Hn,r)),e.jwt=r=>e.check(Dc(Gu,r)),e.emoji=r=>e.check(wc(Lu,r)),e.guid=r=>e.check(Un(Xn,r)),e.uuid=r=>e.check(yc(ot,r)),e.uuidv4=r=>e.check($c(ot,r)),e.uuidv6=r=>e.check(Rc(ot,r)),e.uuidv7=r=>e.check(Ac(ot,r)),e.nanoid=r=>e.check(Ic(Tu,r)),e.guid=r=>e.check(Un(Xn,r)),e.cuid=r=>e.check(kc(Zu,r)),e.cuid2=r=>e.check(Cc(xu,r)),e.ulid=r=>e.check(Pc(qu,r)),e.base64=r=>e.check(xc(Ju,r)),e.base64url=r=>e.check(qc(Mu,r)),e.xid=r=>e.check(Oc(ju,r)),e.ksuid=r=>e.check(Nc(Du,r)),e.ipv4=r=>e.check(zc(Uu,r)),e.ipv6=r=>e.check(Lc(Bu,r)),e.cidrv4=r=>e.check(Tc(Vu,r)),e.cidrv6=r=>e.check(Zc(Fu,r)),e.e164=r=>e.check(jc(Wu,r)),e.datetime=r=>e.check(hu(r)),e.date=r=>e.check(mu(r)),e.time=r=>e.check(gu(r)),e.duration=r=>e.check(bu(r))});function p(e){return Sc(Ou,e)}const X=d("ZodStringFormat",(e,t)=>{J.init(e,t),Gn.init(e,t)}),Nu=d("ZodEmail",(e,t)=>{Ia.init(e,t),X.init(e,t)}),Xn=d("ZodGUID",(e,t)=>{Aa.init(e,t),X.init(e,t)}),ot=d("ZodUUID",(e,t)=>{wa.init(e,t),X.init(e,t)}),Hn=d("ZodURL",(e,t)=>{ka.init(e,t),X.init(e,t)});function zu(e){return Bn(Hn,e)}const Lu=d("ZodEmoji",(e,t)=>{Ca.init(e,t),X.init(e,t)}),Tu=d("ZodNanoID",(e,t)=>{Pa.init(e,t),X.init(e,t)}),Zu=d("ZodCUID",(e,t)=>{Oa.init(e,t),X.init(e,t)}),xu=d("ZodCUID2",(e,t)=>{Na.init(e,t),X.init(e,t)}),qu=d("ZodULID",(e,t)=>{za.init(e,t),X.init(e,t)}),ju=d("ZodXID",(e,t)=>{La.init(e,t),X.init(e,t)}),Du=d("ZodKSUID",(e,t)=>{Ta.init(e,t),X.init(e,t)}),Uu=d("ZodIPv4",(e,t)=>{Da.init(e,t),X.init(e,t)}),Bu=d("ZodIPv6",(e,t)=>{Ua.init(e,t),X.init(e,t)}),Vu=d("ZodCIDRv4",(e,t)=>{Ba.init(e,t),X.init(e,t)}),Fu=d("ZodCIDRv6",(e,t)=>{Va.init(e,t),X.init(e,t)}),Ju=d("ZodBase64",(e,t)=>{Fa.init(e,t),X.init(e,t)}),Mu=d("ZodBase64URL",(e,t)=>{Ma.init(e,t),X.init(e,t)}),Wu=d("ZodE164",(e,t)=>{Wa.init(e,t),X.init(e,t)}),Gu=d("ZodJWT",(e,t)=>{Xa.init(e,t),X.init(e,t)}),Yn=d("ZodNumber",(e,t)=>{Pn.init(e,t),H.init(e,t),e.gt=(n,o)=>e.check(Fn(n,o)),e.gte=(n,o)=>e.check(Nt(n,o)),e.min=(n,o)=>e.check(Nt(n,o)),e.lt=(n,o)=>e.check(Vn(n,o)),e.lte=(n,o)=>e.check(Ot(n,o)),e.max=(n,o)=>e.check(Ot(n,o)),e.int=n=>e.check(Qn(n)),e.safe=n=>e.check(Qn(n)),e.positive=n=>e.check(Fn(0,n)),e.nonnegative=n=>e.check(Nt(0,n)),e.negative=n=>e.check(Vn(0,n)),e.nonpositive=n=>e.check(Ot(0,n)),e.multipleOf=(n,o)=>e.check(Jn(n,o)),e.step=(n,o)=>e.check(Jn(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 Kn(e){return Jc(Yn,e)}const Xu=d("ZodNumberFormat",(e,t)=>{Ha.init(e,t),Yn.init(e,t)});function Qn(e){return Mc(Xu,e)}const Hu=d("ZodNull",(e,t)=>{Ya.init(e,t),H.init(e,t)});function st(e){return Wc(Hu,e)}const Yu=d("ZodUnknown",(e,t)=>{Ka.init(e,t),H.init(e,t)});function eo(){return Gc(Yu)}const Ku=d("ZodNever",(e,t)=>{Qa.init(e,t),H.init(e,t)});function Qu(e){return Xc(Ku,e)}const el=d("ZodArray",(e,t)=>{ec.init(e,t),H.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(nt(r,n)),e.nonempty=r=>e.check(nt(1,r)),e.max=(r,n)=>e.check(Mn(r,n)),e.length=(r,n)=>e.check(Wn(r,n)),e.unwrap=()=>e.element});function D(e,t){return iu(el,e,t)}const tl=d("ZodObject",(e,t)=>{rc.init(e,t),H.init(e,t),V(e,"shape",()=>t.shape),e.keyof=()=>je(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:eo()}),e.loose=()=>e.clone({...e._zod.def,catchall:eo()}),e.strict=()=>e.clone({...e._zod.def,catchall:Qu()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Ei(e,r),e.safeExtend=r=>yi(e,r),e.merge=r=>$i(e,r),e.pick=r=>_i(e,r),e.omit=r=>Si(e,r),e.partial=(...r)=>Ri(ro,e,r[0]),e.required=(...r)=>Ai(oo,e,r[0])});function C(e,t){const r={type:"object",shape:e??{},...$(t)};return new tl(r)}const rl=d("ZodUnion",(e,t)=>{nc.init(e,t),H.init(e,t),e.options=t.options});function pe(e,t){return new rl({type:"union",options:e,...$(t)})}const nl=d("ZodIntersection",(e,t)=>{oc.init(e,t),H.init(e,t)});function ol(e,t){return new nl({type:"intersection",left:e,right:t})}const sl=d("ZodRecord",(e,t)=>{sc.init(e,t),H.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function to(e,t,r){return new sl({type:"record",keyType:e,valueType:t,...$(r)})}const zt=d("ZodEnum",(e,t)=>{ic.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 i={};for(const s of n)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new zt({...t,checks:[],...$(o),entries:i})},e.exclude=(n,o)=>{const i={...t.entries};for(const s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new zt({...t,checks:[],...$(o),entries:i})}});function je(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new zt({type:"enum",entries:r,...$(t)})}const il=d("ZodLiteral",(e,t)=>{ac.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 il({type:"literal",values:Array.isArray(e)?e:[e],...$(t)})}const al=d("ZodTransform",(e,t)=>{cc.init(e,t),H.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new fn(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(xe(i,r.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(xe(s))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function cl(e){return new al({type:"transform",transform:e})}const ro=d("ZodOptional",(e,t)=>{uc.init(e,t),H.init(e,t),e.unwrap=()=>e._zod.def.innerType});function he(e){return new ro({type:"optional",innerType:e})}const ul=d("ZodNullable",(e,t)=>{lc.init(e,t),H.init(e,t),e.unwrap=()=>e._zod.def.innerType});function no(e){return new ul({type:"nullable",innerType:e})}const ll=d("ZodDefault",(e,t)=>{pc.init(e,t),H.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pl(e,t){return new ll({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():bn(t)}})}const hl=d("ZodPrefault",(e,t)=>{hc.init(e,t),H.init(e,t),e.unwrap=()=>e._zod.def.innerType});function fl(e,t){return new hl({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():bn(t)}})}const oo=d("ZodNonOptional",(e,t)=>{fc.init(e,t),H.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ml(e,t){return new oo({type:"nonoptional",innerType:e,...$(t)})}const dl=d("ZodCatch",(e,t)=>{mc.init(e,t),H.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function gl(e,t){return new dl({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const vl=d("ZodPipe",(e,t)=>{dc.init(e,t),H.init(e,t),e.in=t.in,e.out=t.out});function so(e,t){return new vl({type:"pipe",in:e,out:t})}const bl=d("ZodReadonly",(e,t)=>{gc.init(e,t),H.init(e,t),e.unwrap=()=>e._zod.def.innerType});function _l(e){return new bl({type:"readonly",innerType:e})}const io=d("ZodCustom",(e,t)=>{vc.init(e,t),H.init(e,t)});function Sl(e,t){return au(io,e??(()=>!0),t)}function El(e,t={}){return cu(io,e,t)}function yl(e){return uu(e)}var y=(e=>(e.Article="article",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))(y||{});const $l=pe([M("book"),M("bookitem"),M("conference"),M("document"),M("report"),M("proceeding"),M("unknown")]),Rl=pe([M("article"),M("conference"),M("issue"),M("journal"),M("preprint"),M("proceeding"),M("unknown")]),fe=C({artnum:p(),atitle:p(),aufirst:p(),aulast:p(),auinit:p(),auinit1:p(),auinitm:p(),ausuffix:p(),au:D(p()),aucorp:p(),bici:p(),btitle:p(),chron:p(),coden:p(),date:p(),edition:p(),eissn:p(),epage:p(),externalDBID:p(),externalDocID:p(),genre:je(y),id:p(),isbn:p(),issn:p(),issue:p(),jtitle:p(),pages:p(),part:p(),place:p(),pub:p(),quarter:p(),rft_id:D(p()),series:p(),sici:p(),spage:p(),ssn:p(),stitle:p(),title:p(),tpages:p(),volume:p()}).partial(),Lt=C({bibid:p(),doi:p(),uri:p()}).partial(),Al=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(),wl=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(),Il=fe.pick({au:!0,date:!0,isbn:!0,pub:!0,title:!0}).partial(),kl=fe.pick({au:!0,date:!0,pub:!0,title:!0}).partial(),Cl=fe.pick({au:!0,date:!0,pub:!0,title:!0,spage:!0,epage:!0}).partial(),Pl=fe.pick({au:!0,date:!0,title:!0}).partial(),ao=C({...fe.shape,...Lt.shape}),Y=(e,t)=>({...t,genre:e}),U=(e,t)=>({...t,genre:e}),be=e=>({...e,genre:y.AudioVisualDocument}),co=e=>({...e,genre:y.Image}),uo=e=>({...e,genre:y.Document}),it=e=>({...e,genre:y.Webpage}),lo=e=>Object.keys(e.shape),po=lo(fe),Tt=lo(Lt),Ol=(e,t,r)=>{if(r.length>0&&typeof r[0]=="string"){const n=t.startsWith("rft_")?t:`rft.${t}`;e.append(n,r[0])}},Nl=(e,t,r)=>{e.append(t,r)},zl=(e,t,r)=>{e.append(`rft.${t}`,r)},ho=e=>Tt.includes(e),fo=e=>{const t=new URLSearchParams;return Object.entries(e).forEach(([r,n])=>{Array.isArray(n)?Ol(t,r,n):typeof n=="string"&&n&&(ho(r)?Nl(t,r,n):zl(t,r,n))}),t},mo=(e,t,r,n)=>{const o=t.getAll(r).filter(i=>!!i).map(i=>i.trim());return o.length===0?e:{...e,[n]:o}},go=e=>{const t=Ll(e),r=(o,i)=>{if(i==="au")return mo(o,t,"rft.au","au");if(i==="rft_id")return mo(o,t,"rft_id","rft_id");const s=ho(i)?i:`rft.${i}`,a=t.get(s);return a?{...o,[i]:a.trim()}:o},n=[...po,...Tt].reduce(r,{});return Object.keys(n).length===0?null:n},Ll=e=>URL.canParse(e)?new URL(e).searchParams:new URLSearchParams(e);function Tl(e){return typeof e!="string"?!1:Object.values(y).includes(e)}var _e=(e=>(e.CA="CA",e.EUAPAC="EUAPAC",e))(_e||{});const Zt=C({id:p(),name:p(),region:je(_e)}),Zl=C({tenants:D(Zt)}),vo=9*1024*1024,bo=C({url:zu({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(vo,{error:`"html" should be a string with a MAX Length of ${vo}`}),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:je([_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 xl(e){return bo.safeParse(e).success}const xt=C({name:p(),region:je(_e),apps:to(p(),p())}),_o=to(p(),xt),So=e=>xt.safeParse(e).success,Eo=e=>_o.safeParse(e).success;function yo(e){return Zt.safeParse(e).success}function ql(e){return typeof e=="string"&&Object.keys(_e).includes(e)}const jl=e=>{if(!Eo(e))throw new Error("Error: the customer list data is invalid.");return{tenants:Object.entries(e).map(([r,n])=>Dl(r,n))}},Dl=(e,t)=>{if(!So(t))throw new Error(`Invalid customer: ${t}`);const{name:r,region:n}=t,o={id:e,name:r,region:n};if(!yo(o))throw new Error(`Invalid tenant: ${JSON.stringify(o)}`);return o},qt=C({parserType:p(),parserName:p().nullable(),uri:p(),referrer:p()}),jt=C({parserType:p(),parserName:p().nullable(),referrer:p()}),Dt=C({bookmarkingWorkflowUrl:st(),resource:st()}),Ut=C({bookmarkingWorkflowUrl:p(),resource:st()}),Bt=C({bookmarkingWorkflowUrl:st(),resource:ao}),Vt=C({z3988SearchResult:M(!0)}),Ft=C({summonSearchResult:M(!0)}),at=pe([Ut,Dt,Bt,Vt,Ft]),$o=C({meta:qt}).and(at),Ro=C({meta:jt}).and(at);function Ul(e){return{bookmarkingWorkflowUrl:e,resource:null}}function Z(){return{bookmarkingWorkflowUrl:null,resource:null}}function w(e){return{bookmarkingWorkflowUrl:null,resource:e}}function Ao(){return{z3988SearchResult:!0}}function wo(){return{summonSearchResult:!0}}const Bl=e=>{const t=e.getAttribute("title");return t?go(t):null},Jt=({document:e})=>{const t=Array.from(e.querySelectorAll(".Z3988"));if(t.length===0)return Z();const r=t.map(Bl).find(n=>n!==null);return r?w(r):Z()},Vl=e=>{const t=Array.from(e.querySelectorAll(".author > a")).map(r=>r.textContent.trim()).filter(Boolean);return t.length?t:void 0},Fl=e=>e.querySelector("#rpi-attribute-book_details-edition > .rpi-attribute-value > span")?.textContent??void 0,Jl=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},Ml=e=>e.querySelector("#rpi-attribute-book_details-publication_date > .rpi-attribute-value > span")?.textContent??void 0,Wl=e=>e.querySelector("#rpi-attribute-book_details-publisher > .rpi-attribute-value > span")?.textContent??void 0,Gl=e=>e.querySelector("#rpi-attribute-book_details-series > .rpi-attribute-value > a")?.textContent??void 0,Xl=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},Hl=({url:e,document:t})=>{const r=Vl(t),n=Fl(t),o=Jl(t),i=Ml(t),s=Wl(t),a=Gl(t),u=t.getElementById("productTitle")?.textContent.trim()??void 0,c=Xl(t);return{bookmarkingWorkflowUrl:null,resource:Y(y.Book,{au:r,date:i,edition:n,isbn:o,pub:s,series:a,title:u,tpages:c,uri:e})}},me=e=>{if(e)return e.replace(/[^0-9]/g,"")},Io=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),ko=e=>e.querySelector(".article-header")?.querySelector("h1 span")?.textContent.trim(),Co=e=>({date:e?.textContent.match(/\d{4}/)?.[0],pub:"Elsevier Inc."}),Yl=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,i]=(r?.split(",")??[]).map(s=>s.trim());return{volume:me(o),issue:me(i),jtitle:n}},Kl=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,i]=(n?.[1].split("-")??[]).map(c=>c.trim()),{jtitle:s,volume:a,issue:u}=Yl(e);return w(U(y.Article,{au:Io(e),atitle:ko(e),spage:o,epage:i,date:r,jtitle:s,volume:a,issue:u}))},Ql=e=>{const[t,r]=e.querySelectorAll(".source"),{date:n,pub:o}=Co(r),i=e.querySelector(".browse__book-toc"),[s,a]=(i?.querySelector("h1")?.textContent.split(",")??[]).map(u=>u.trim());return w(Y(y.Book,{btitle:s,edition:a,pub:o,au:t.textContent?[t.textContent]:void 0,date:n}))},ep=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:i,pub:s}=Co(o);return{edition:r,btitle:n,date:i,pub:s}},tp=e=>{const{edition:t,btitle:r,date:n,pub:o}=ep(e),i=e.querySelector(".article-header .source")?.textContent,s=/(\d+-\d+|[IVXLCDM]+-[IVXLCDM]+)/i,a=i?.match(s),[u,c]=(a?.[1].split("-")??[]).map(l=>l.trim());return w(Y(y.Bookitem,{au:Io(e),atitle:ko(e),btitle:r,edition:t,pub:o,date:n,spage:u,epage:c}))},rp=/^[0-9X]$/,Mt=e=>{if(!e)return;let t="";for(const r of e)rp.test(r)&&(t+=r);if(t)return t},np=(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(),i=e.evaluate('//p[contains(text(), "ISBN")]',e,null,XPathResult.ANY_TYPE),s=Mt(i.iterateNext()?.textContent);return w({genre:y.Document,title:r,pub:n,date:o,uri:t,isbn:s})},Po=e=>e.querySelector(".browse-toc")??e.querySelector(".browse__journal"),op=e=>Po(e)?.querySelector("h1")?.firstElementChild?.textContent.trim(),sp=e=>{const t=Po(e),r=t?.querySelector("figure figcaption.source");if(r){const[a,u,c]=r.textContent.split(",").map(l=>l.trim());return{date:a,volume:me(u),issue:me(c)}}const n=t?.querySelector("p")?.textContent,[o,i]=n?.split(",")??[];return{date:t?.querySelector(".source span")?.textContent??void 0,volume:me(o),issue:me(i)}},ip=e=>{const{date:t,volume:r,issue:n}=sp(e);return w(U(y.Journal,{jtitle:op(e),date:t,volume:r,issue:n}))};var Oo=(e=>(e.Book="Book",e.Chapter="Book Chapter",e.Article="Full Text Article",e.Journal="Journal",e.Guideline="Guideline",e))(Oo||{});const ap=e=>Object.values(Oo).includes(e),cp=(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&&ap(n))return n},up=({url:e,document:t})=>{switch(cp(t,e)){case"Book":return Ql(t);case"Book Chapter":return tp(t);case"Full Text Article":return Kl(t);case"Journal":return ip(t);case"Guideline":return np(t,e);case void 0:return Z()}},we=C({"@context":p()}),lp=e=>we.safeParse(e).success,No='script[type="application/ld+json"]',zo=e=>Array.from(e.querySelectorAll(No)),ct=e=>e.querySelector(No),De=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},pp=C({"@id":p(),"@type":p(),author:C({"@id":p()}).optional(),datePublished:p().optional(),dateModified:p().optional(),description:p().optional(),inLanguage:p().optional(),isPartOf:C({"@id":p()}).optional(),name:p().optional(),url:p().optional()}),hp=we.extend({"@graph":D(pp)}),fp=e=>hp.safeParse(e).success,mp=e=>{const t=zo(e);if(t.length===0)return null;const r=t.map(De).filter(fp).map(n=>n["@graph"]);return r.length!==1?null:r[0]},dp=(e,t)=>e.find(r=>r["@type"]===t)??null,gp=(e,t)=>e.find(r=>r["@id"]===t)??null,vp=e=>{const t=dp(e,"WebPage");if(!t)return null;const r=t.author?gp(e,t.author["@id"]):void 0;return it({au:r?.name?[r.name]:void 0,date:t.datePublished,title:t.name})},bp=({document:e})=>{const t=mp(e);return t?{bookmarkingWorkflowUrl:null,resource:vp(t)}:Z()},Lo=()=>Z(),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()),To=e=>{const t=new Map,r=e.split(";").filter(n=>!!n);for(const n of r){const[o,i,s]=n.split(":");t.set(o,{type:i,value:s})}return t},_p=e=>{const{pathname:t}=new URL(e);return t.startsWith("/toc/")?"journal":t.startsWith("/article/")?"article":void 0},Sp=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)??[],[i,s]=[o[0],o[1]],a=e.evaluate('//dt[contains(text(), "Publisher")]/following-sibling::dd/a',e,null,XPathResult.STRING_TYPE).stringValue.trim();return w(U(y.Journal,{pub:a,jtitle:t,issn:i,eissn:s}))},Ep=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}},yp=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:i,issn:s}=Ep(e),a=h(e,"name","citation_publisher"),u=h(e,"name","citation_publication_date"),c=h(e,"name","citation_volume"),l=h(e,"name","citation_issue"),f=h(e,"name","citation_firstpage"),m=h(e,"name","citation_lastpage");return w(U(y.Article,{jtitle:t,atitle:r,au:n,doi:o,eissn:i,issn:s,pub:a,date:u,volume:c,issue:l,spage:f,epage:m}))},$p=({document:e,url:t})=>{switch(_p(t)){case"journal":return Sp(e);case"article":return yp(e);case void 0:return Z()}};var E=(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||{});const Rp=e=>{const t=h(e,"name","pbContext");if(!t)return E.None;const r=To(t);switch(r.has("page")?r.get("page")?.value:null){case"Article/Chapter View":return E.Article;case"Table of Contents":return E.Journal;default:return E.None}},Ap=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(i=>i.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},wp=e=>e.querySelector('span[property="isPartOf"][typeof="PublicationVolume"] > span[property="volumeNumber"]')?.textContent??void 0,Ip=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,Cp=e=>e.querySelector("h1")?.textContent??void 0,Pp=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 i=r?.match(/(\d{4})$/);return i&&t.set("date",i[1]),t},Op=e=>{const t=Ap(e.document),r=h(e.document,"name","dc.Date"),n=kp(e.document),o=Zo(e.document),i=o.get("issn"),s=o.get("eissn"),a=Ip(e.document),u=h(e.document,"name","citation_journal_title"),c=h(e.document,"name","dc.Publisher"),l=h(e.document,"name","dc.Title"),f=wp(e.document);return U(y.Article,{au:t,date:r,eissn:s,issn:i,issue:a,jtitle:u,pub:c,title:l,volume:f,doi:n})},Np=e=>{const t=Zo(e.document),r=t.get("issn"),n=t.get("eissn"),o=Cp(e.document),i=Pp(e.document),s=i.get("issue"),a=i.get("volume"),u=i.get("date");return U(y.Journal,{eissn:n,issn:r,jtitle:o,title:o,issue:s,volume:a,date:u})},zp=e=>{switch(Rp(e.document)){case E.Article:return w(Op(e));case E.Journal:return w(Np(e));default:return Z()}},Lp=e=>{const t=h(e,"name","citation_type"),r=h(e,"name","citation_article_type");return t==="JOUR"&&r?E.Article:t==="CHP"?E.Chapter:e.querySelector(".book-edition-year")?.textContent.includes("Book")?E.Book:e.getElementById("journal-title")?E.Journal:E.None},Wt=e=>h(e,"name","citation_doi")??h(e,"name","dc.identifier")??e.querySelector(".doi .anchor-text")?.textContent??void 0,Tp=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,i=n.querySelector("p")?.textContent;o&&i&&r.set(o,i)}return r},Gt=(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: ","")},xp=e=>{const t=e.get("DOI");if(t)return URL.canParse(t)?new URL(t).pathname.substring(1):t},qp=e=>{const t=Tp(e),r=h(e,"property","og:title"),n=h(e,"property","og:book:isbn"),o=t.get("Published"),i=Gt(e,".authors-container .author-detail h3"),s=Wt(e)??xp(t);return Y(y.Book,{au:i,date:o,doi:s,isbn:n,title:r})},jp=e=>{const t=h(e,"property","og:title"),r=h(e,"property","og:book:isbn"),n=h(e,"name","citation_publication_date"),o=Gt(e,".author-group .button-link-text"),i=h(e,"name","citation_firstpage"),s=h(e,"name","citation_lastpage"),a=h(e,"name","citation_publisher"),u=Wt(e),c=h(e,"name","citation_inbook_title")??e.querySelector(".publication-title")?.textContent??void 0;return Y(y.Bookitem,{au:o,btitle:c,date:n,doi:u,epage:s,isbn:r,pub:a,spage:i,title:t})},Dp=e=>{const t=h(e,"property","og:title"),r=h(e,"name","citation_issn"),n=h(e,"name","citation_publication_date"),o=Gt(e,".author-group .button-link-text"),i=h(e,"name","citation_publisher"),s=h(e,"name","citation_firstpage"),a=h(e,"name","citation_issue"),u=h(e,"name","citation_volume"),c=Wt(e),l=h(e,"name","citation_journal_title")??e.querySelector(".publication-title")?.textContent??void 0;return U(y.Article,{au:o,jtitle:l,date:n,doi:c,issn:r,issue:a,pub:i,spage:s,title:t,volume:u})},Up=e=>{const t=e.getElementById("journal-title")?.textContent??void 0,r=Zp(e);return U(y.Journal,{issn:r,title:t})},Bp=({document:e})=>{switch(Lp(e)){case E.Book:return w(qp(e));case E.Chapter:return w(jp(e));case E.Article:return w(Dp(e));case E.Journal:return w(Up(e));default:return Z()}},Vp=e=>{const t=h(e,"name","pbContext");return t&&To(t).has("article")?E.Article:E.Journal},Fp=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},Jp=e=>{const t=e.querySelector(".issue-heading")?.textContent;return t?t.split(",")[0]?.replace("Volume","").trim():void 0},Mp=e=>{const t=e.querySelector(".issue-heading .nav-toc-list")?.textContent;return t?t.replace("Issue","").trim():void 0},Wp=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"),i=h(e,"name","citation_journal_title"),s=re(e,"name","dc.Creator"),a=Jp(e),u=Mp(e),c=Fp(e),l=c?.includes("-")?c.split("-")[0]:c,f=c?.includes("-")?c.split("-")[1]:c;return U(y.Article,{au:s,jtitle:i,date:n,doi:o,issue:u,pub:r,spage:l,epage:f,title:t,volume:a})},Gp=e=>{const t=h(e,"property","og:title"),r=h(e,"name","publication_doi");return U(y.Journal,{doi:r,title:t})},Xp=({document:e})=>{switch(Vp(e)){case E.Article:return w(Wp(e));case E.Journal:return w(Gp(e));default:return Z()}},Hp=e=>at.safeParse(e).success,Yp=e=>$o.safeParse(e).success,Kp=e=>Ro.safeParse(e).success,Qp=e=>qt.safeParse(e).success,eh=e=>jt.safeParse(e).success;function th(e){return Ut.safeParse(e).success}function ut(e){return Bt.safeParse(e).success}function xo(e){return Vt.safeParse(e).success}function qo(e){return Ft.safeParse(e).success}function rh(e){return Dt.safeParse(e).success}const nh=e=>Array.from(e.querySelectorAll("tr th")).find(n=>n.textContent.trim()==="DOI:")?.nextElementSibling?.querySelector('span[property="identifier"]')?.textContent??void 0,oh=e=>{const t=/Record\/(\d+)/.exec(e);if(t&&t.length>1)return t[1]},sh=e=>{const{url:t,document:r}=e,n=Jt(e);if(!ut(n))return n;const o=nh(r);return o&&(n.resource.rft_id=[`info:doi/${o}`]),n.resource.bibid=oh(t),n},ih=we.extend({"@type":M("VideoObject"),name:p(),author:p(),genre:p(),description:p(),uploadDate:p(),duration:p(),thumbnailUrl:D(p())}),ah=e=>ih.safeParse(e).success,ch=e=>{const t=zo(e);if(t.length===0)return null;const r=t.map(De).filter(ah);return r.length!==1?null:r[0]},uh=({url:e,document:t})=>{const r=ch(t);return r?{bookmarkingWorkflowUrl:null,resource:be({au:[r.author],date:r.uploadDate,title:r.name,uri:e})}:Z()},jo=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,Do=e=>{const t=e.editor?.map(o=>o.name)??[],n=[...e.author?.map(o=>o.name)??[],...t];if(n.length!==0)return n};var Ue=(e=>(e.Book="Book",e.Journal="Journal",e.Periodical="Periodical",e.PublicationVolume="PublicationVolume",e.ScholarlyArticle="ScholarlyArticle",e.VideoObject="VideoObject",e.WebPage="WebPage",e))(Ue||{}),Se=(e=>(e.Article="article",e.Book="book",e.Paper="Paper",e.Video="video.other",e.Website="website",e))(Se||{}),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 Uo=C({"@type":M(Ue.ScholarlyArticle),author:D(C({"@type":p(),name:p()})).optional(),editor:D(C({"@type":p(),name:p()})).optional(),datePublished:p().optional(),headline:p().optional(),issn:D(p()).optional(),pageStart:p().optional(),pageEnd:p().optional(),isPartOf:C({"@type":pe([p(),D(p())]),name:p(),issn:D(p()).optional(),volumeNumber:p().optional(),isbn:D(p()).optional()}),publisher:C({"@type":p(),name:p()}).optional()}),Bo=e=>Uo.safeParse(e).success,lh=we.extend({"@type":M(Ue.WebPage),mainEntity:Uo}),ph=e=>lh.safeParse(e).success,hh=C({"@type":D(p()),name:p().optional(),issn:D(p()),volumeNumber:p().optional()}),Vo=e=>hh.safeParse(e).success,fh=(e,t)=>h(e,"name","citation_issn")??h(e,"name","prism.issn")??(Bo(t.isPartOf)?t.isPartOf.issn?.[0]:void 0),Fo=(e,t)=>{const r=Do(t),n=h(e,"name","citation_online_date"),o=jo(e),i=h(e,"name","citation_issue"),s=fh(e,t),a=Vo(t.isPartOf)&&t.isPartOf.issn.length>0?t.isPartOf.issn[1]:void 0,u=t.pageStart,c=t.pageEnd,l=t.headline,f=t.isPartOf.name,m=Vo(t.isPartOf)?t.isPartOf.volumeNumber:void 0;return U(y.Article,{au:r,date:n,doi:o,issue:i,eissn:s,issn:a,spage:u,epage:c,atitle:l,jtitle:f,volume:m})},mh=we.extend({"@type":M(Ue.Book),copyrightYear:p().optional(),author:D(C({"@type":p(),name:p()})).optional(),editor:D(C({"@type":p(),name:p()})).optional(),isbn:p().optional(),name:p().optional(),numberOfPages:Kn().optional(),publisher:C({"@type":p(),name:p()}).optional()}),dh=e=>mh.safeParse(e).success,gh=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(),i=n.querySelector(".c-bibliographic-information__value")?.textContent.trim();o&&i&&r.set(o,i)}),r},vh=(e,t)=>{const r=gh(e),n=Do(t),o=t.copyrightYear?.toString(),i=jo(e)??r.get("DOI"),s=t.name??r.get("Book Title"),a=t.isbn??r.get("Softcover ISBN"),u=t.numberOfPages?.toString()??r.get("Number of Pages"),c=t.publisher?.name??r.get("Publisher");return Y(y.Book,{au:n,date:o,doi:i,title:s,isbn:a,tpages:u,pub:c})},bh=C({"@type":M("Periodical"),name:p(),url:p(),issn:D(p()),editor:D(C({givenName:p(),familyName:p()})),publisher:C({name:p()}),description:p()}),_h=e=>bh.safeParse(e).success,Sh=e=>{const t=e.editor.map(({givenName:s,familyName:a})=>`${s} ${a}`),r=e.name,[n,o]=e.issn,i=e.publisher.name;return U(y.Journal,{au:t,jtitle:r,eissn:n,issn:o,pub:i})},Eh=C({"@type":M(Ue.VideoObject),name:p().optional(),description:p().optional(),thumbnailUrl:p().optional(),uploadDate:p().optional(),contentUrl:p().optional(),duration:p().optional()}),yh=e=>Eh.safeParse(e).success,$h=(e,t)=>{const r=Array.from(e.querySelectorAll('dd[data-test="video-segment-author"]')).map(s=>s.textContent.trim()).filter(s=>!!s),n=t?.uploadDate?new Date(t.uploadDate).getFullYear().toString():void 0,o=t?.name??h(e,"property","og:title")??void 0,i=e.querySelector("video-about-doi")?.textContent??void 0;return be({au:r.length>0?r:void 0,date:n,doi:i,title:o})},Rh=e=>{const t=h(e,"property","og:title");return it({title:t})},Ah=(e,t)=>{const r=h(t,"property","og:type");return r===Se.Article&&e.includes(ce.Article)?E.Article:r===Se.Book&&(e.includes(ce.Book)||e.includes(ce.ReferenceWork))?E.Book:r===Se.Paper&&e.includes(ce.Chapter)?E.Chapter:r===Se.Paper&&(e.includes(ce.ReferenceWorkEntry)||e.includes(ce.Protocol))?E.Article:r===Se.Video&&e.includes(ce.Video)?E.AudioVisual:r===Se.Website&&(e.includes(ce.Collections)||e.includes(ce.JournalIssue))?E.Webpage:r===Se.Website&&e.includes(ce.Journal)?E.Journal:E.None},wh=(e,t,r)=>e===E.AudioVisual&&yh(r)?w($h(t,r)):e===E.Book&&dh(r)?w(vh(t,r)):(e===E.Chapter||e===E.Article)&&Bo(r)?w(Fo(t,r)):e===E.Article&&ph(r)?w(Fo(t,r.mainEntity)):e===E.Journal&&_h(r)?w(Sh(r)):Z(),Ih=({url:e,document:t})=>{const r=Ah(e,t);if(r===E.Webpage)return w(Rh(t));const n=ct(t);if(!n)return Z();const o=De(n);return o?wh(r,t,o):Z()},kh=new Set(["Print ISBN","Online ISBN","DOI","First published","Online ISSN","Print ISSN"]),Jo=(e,t)=>{if(!e)return;const r=e.indexOf(t);return r>-1?e.substring(0,r):e},Xt=e=>{const r=/\d+/.exec(e);if(r?.[0])return r[0]},Ch=e=>{const t=h(e,"property","og:type");return t==="Book"||t==="books.book"?E.Book:t==="Chapter"?E.Chapter:t==="Journal"?E.Journal:t==="Article"?E.Article:E.None},lt=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},Ph=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 Xt(t)},pt=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 i=Jo(n.textContent,":"),s=Jo(o.textContent,":");!i||!s||kh.has(i)&&t.set(i,s)}return t},ht=(e,t)=>h(e,"property","books:release_date")??h(e,"name","citation_online_date")??t.get("First published")??void 0,Ht=(e,t)=>h(e,"name","dc.identifier")??h(e,"name","citation_doi")??h(e,"name","publication_doi")??t.get("DOI")??void 0,Mo=(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},Oh=e=>{let t,r;const n=e.querySelector(".cover-image__details div:first-of-type");if(n&&n.childNodes.length===2){const[o,i]=n.childNodes;o.textContent&&(t=Xt(o.textContent)),i.textContent&&(r=Xt(i.textContent))}return{volume:t,issue:r}},Nh=e=>{const t=pt(e),r=lt(e),n=h(e,"property","og:title"),o=ht(e,t),i=Ht(e,t),s=Mo(e,t),a=Ph(e);return Y(y.Book,{au:r,date:o,doi:i,isbn:s,pages:a,title:n})},zh=e=>{const t=pt(e),r=lt(e),n=h(e,"name","citation_book_title"),o=ht(e,t),i=Ht(e,t),s=Mo(e,t),a=h(e,"name","citation_publisher"),u=h(e,"property","og:title");return Y(y.Bookitem,{au:r,btitle:n,date:o,doi:i,isbn:s,pub:a,title:u})},Lh=e=>{const t=pt(e),r=lt(e),n=ht(e,t),o=t.get("Online ISSN"),i=t.get("Print ISSN"),s=h(e,"property","og:title"),{volume:a,issue:u}=Oh(e);return U(y.Journal,{au:r,date:n,eissn:o,issn:i,issue:u,title:s,volume:a})},Th=e=>{const t=pt(e),r=lt(e),n=ht(e,t),o=Ht(e,t),i=h(e,"name","citation_issn"),s=h(e,"name","citation_journal_title"),a=h(e,"property","og:title");return U(y.Article,{au:r,date:n,doi:o,issn:i,jtitle:s,title:a})},Zh=({document:e})=>{switch(Ch(e)){case E.Book:return w(Nh(e));case E.Chapter:return w(zh(e));case E.Journal:return w(Lh(e));case E.Article:return w(Th(e));default:return Z()}},xh=e=>{const t=re(e,"name","citation_author");return t.length>0?t:void 0},qh=({document:e})=>{const t=xh(e),r=h(e,"name","citation_publication_date"),n=h(e,"name","citation_doi"),o=h(e,"name","citation_isbn"),i=h(e,"name","citation_publisher"),s=h(e,"name","citation_title")??e.title,a=be({au:t,date:r,doi:n,isbn:o,pub:i,title:s});return w(a)},jh=({document:e})=>Array.from(e.querySelectorAll(".Z3988")).length<=1?Z():Ao(),Yt=e=>{if(!(!e||e.length===0))return e[0]};function Wo(e,t){const r=t.map(n=>{const o=e.querySelector(n)?.textContent??null;if(o&&o.trim()!=="")return o}).filter(n=>n);return Yt(r)??null}const Dh=e=>{const t=e.querySelector(".content-meta-data__authors")?.textContent;if(t)return t.split(/,\s+|\s+and\s+/).filter(r=>!!r)},Uh=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},Bh=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},Vh=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([...Bh(e)??[],...Dh(e)??[],...Vh(e)??[],...Uh(e)??[]]);return t.size?[...t]:void 0},ke=(e,t)=>e.querySelector('[data-qa="published-date"]')?.textContent??e.querySelector(".summary-image")?.textContent??Be(t?.get("date"))??Be(t?.get("copyright date"))??Be(t?.get("published date")),Go=e=>{const t=e.find(r=>r.startsWith("https://doi.org/"));if(t)return t.replace("https://doi.org/","")},Xo=e=>{const t=e.get("local identifier");if(t?.length)return Go(t)},Be=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(),i=Array.from(r.querySelectorAll(".metadata-value")).map(s=>s.textContent).filter(s=>!!s);return{name:o,values:i}}).forEach(({name:r,values:n})=>{!r||!n.length||t.set(r,n)}),t},Ho=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,i=n[2]?.textContent?.replace(/Published By:\s+?/i,"")??Be(t.get("publisher"))??e.querySelector(".publisher-link")?.textContent??void 0;return{pub:i&&i.trim()!==""?i:void 0,jtitle:o&&o.trim()!==""?o:void 0}},Fh=e=>{const t=Wo(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},ft=e=>me(e.querySelector('[data-qa="page-count"]')?.textContent),Ve=(e,t)=>e.querySelector(".publisher-link")?.textContent??Be(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,ye=e=>{if(!URL.canParse(e))return;const t=new URL(e);return t.origin+t.pathname},Jh=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 i of o)i.startsWith("Volume")?n=me(i):i.startsWith("Issue")&&(r=me(i))}return{issue:r,volume:n}},Mh=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),i=o?o[1]:void 0,s=/pp\.\s*(\d+)-(\d+)/.exec(t),a=s?s[1]:void 0,u=s?s[2]:void 0,c=/pp\.\s*\d+-\d+\s*\((\d+)\s*pages\)/.exec(t),l=c?c[1]:void 0;return{issue:i,volume:n,spage:a,epage:u,pages:l}},Wh=e=>{const t=Wo(e,["mfe-turnaway-pharos-link",'[data-qa="item-src-info"]']);if(!t)return;const n=/\(.+\)/.exec(t)?.map(o=>{const i=/\d{4}/.exec(o);return i?i[0]:void 0});return Yt(n)},Gh=(e,t)=>{const r=Ee(e),n=Ie(e),o=ke(e)??Wh(e),i=Ho(e),s=i.jtitle??Fh(e)??void 0,a=i.pub,u=Jh(e),c=Mh(e),l=u.issue??c.issue,f=u.volume??c.volume,m=ft(e)??c.pages,g=c.spage,P=c.epage,b=ye(t),O=Go(Array.from(e.querySelector(".content-meta-data-stables")?.childNodes??[]).map(q=>q.textContent??""));return U(y.Article,{atitle:r,au:n,date:o,doi:O,epage:P,issue:l,jtitle:s,pages:m,pub:a,spage:g,uri:b,volume:f})},Xh=(e,t)=>{const r=Ce(e),n=Ie(e),o=ke(e,r),i=Ee(e),s=Ve(e,r),a=ye(t);return be({au:n,date:o,pub:s,title:i,uri:a})},Hh=(e,t)=>{const r=Ce(e),n=Ie(e),o=Ee(e),i=ke(e),s=ft(e),a=Ve(e,r),u=ye(t),c=Xo(r);return Y(y.Book,{au:n,date:i,doi:c,pages:s,pub:a,title:o,uri:u})},Yh=(e,t)=>{const r=Ce(e),n=Ie(e),o=Ee(e),i=e.querySelector(".book-title-link")?.textContent??void 0,s=ke(e,r),a=Array.from(e.querySelectorAll('[data-qa="book"] > span')).map(m=>m.textContent),u=ft(e),c=a.find(m=>m.includes("pp."))?.match(/(\d+)-(\d+)/)??void 0,l=Ve(e,r),f=ye(t);return Y(y.Bookitem,{atitle:o,au:n,btitle:i,date:s,epage:c?.[2],pub:l,pages:u,spage:c?.[1],uri:f})},Kh=(e,t)=>{const r=Ce(e),n=Ie(e),o=Ee(e),i=ke(e),s=ft(e),a=Ve(e,r),u=ye(t),c=Xo(r);return Y(y.Document,{au:n,date:i,doi:c,pages:s,pub:a,title:o,uri:u})},Qh=(e,t)=>{const r=Ce(e),n=Ie(e),o=ke(e,r),i=Ee(e),s=ye(t);return co({au:n,date:o,title:i,uri:s})},ef=(e,t)=>{const{pub:r}=Ho(e),n=Ee(e),o=e.querySelector(".eissn")?.textContent.replace(/EISSN\s+/,"").trim()??void 0,i=e.querySelector(".issn")?.textContent.replace(/ISSN\s+/,"").trim()??void 0,s=ye(t);return U(y.Journal,{eissn:o,issn:i,jtitle:n,pub:r,uri:s})};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 tf=(e,t)=>{const r=Ce(e),n=Ie(e),o=ke(e,r),i=Ee(e),s=Ve(e,r),a=ye(t);return be({au:n,date:o,pub:s,title:i,uri:a})},rf=e=>Object.values(ie).includes(e),nf=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 rf(n)?n:null},of=(e,t)=>{switch(nf(e)){case ie.Article:case ie.Serial:return Gh(e,t);case ie.Audio:return Xh(e,t);case ie.Book:return Hh(e,t);case ie.Chapter:case ie.ResearchReport:return Yh(e,t);case ie.Document:return Kh(e,t);case ie.Image:return Qh(e,t);case ie.Journal:return ef(e,t);case ie.Video:return tf(e,t);default:return null}},sf=({document:e,url:t})=>{const r=of(e,t);return r?w(r):Z()},Fe=e=>{if(e){if(typeof e=="string")return e;if(e.length>0)return e[0]}else return},Yo=e=>{if(e)return typeof e=="string"?e:Array.isArray(e)?e.length===0?void 0:Fe(e[0].name):Fe(e.name)},mt=(...e)=>{const t=new Set(e.filter(r=>!!r));if(t.size!==0)return[...t]},af=e=>{const t=Yo(e.mainEntity.creator);return t?[t]:void 0},Je=({lcn:e,title:t})=>({bibid:e,title:t}),cf=(e,t)=>{const r=mt(...(e&&af(e))??[],...t.authors??[]),n=mt(...t.eissns??[]),o=mt(e?.mainEntity.isbn?Mt(e.mainEntity.isbn):void 0,...t.isbns??[]),i=mt(...e?.mainEntity.issn??[],...t.issns??[]),[s,a]=e?.mainEntity.pagination?.split("-")??[];return{authors:r,date:t.date,doi:Fe(t.dois),edition:e?.mainEntity.edition??t.edition,epage:a,eissn:Fe(n),lcn:t.lcn??e?.identifier.value,isbn:o?.join(","),issn:Fe(i),issue:e?.mainEntity.issueNumber,jtitle:t.jtitle,publisher:t.publisher??Yo(e?.mainEntity.publisher),spage:s,title:e?.name??t.title,volume:e?.mainEntity.volumeNumber}},uf=e=>U(y.Article,{...Je(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}),lf=e=>be({...Je(e),au:e.authors,date:e.date,pub:e.publisher}),pf=e=>Y(y.Book,{...Je(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}),hf=e=>U(y.Journal,{...Je(e),date:e.date,doi:e.doi,eissn:e.eissn,issn:e.issn,pub:e.publisher}),Ko=C({"@type":M("Organization"),name:pe([p(),D(p())])}),Qo=C({"@type":M("Person"),name:pe([p(),D(p())])}),ff=we.extend({identifier:C({"@type":p(),propertyID:p(),value:p()}),mainEntity:C({"@type":p(),"@id":p(),creator:he(pe([p(),Qo,D(Qo)])),edition:he(p()),isbn:he(p()),issn:he(D(p())),issueNumber:he(p()),pagination:he(p()),publisher:he(pe([p(),Ko,D(Ko)])),volumeNumber:he(p())}),name:p()}),mf=e=>{const t=ct(e);if(!t)return null;const r=De(t),n=ff.safeParse(r);return n.success?n.data:null},df=e=>be({...Je(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})/,es=/(E?ISBN|E?ISSN|DOI)\s*:\s*/g,Kt=e=>`*:has([title*="${e}" i]) + .item-details-element-container prm-highlight`,vf=e=>{if(!e)return;const t=gf.exec(e);if(t)return t.length>1?t[1]:void 0},bf=e=>{const t=Array.from(e.querySelectorAll(Kt("Identifier"))),r={};return t.map(n=>n.textContent).filter(n=>!!n).forEach(n=>{const o=[];let i;for(;(i=es.exec(n))!==null;)o.push({id:i[1].toLowerCase(),index:i.index,start:es.lastIndex});o.forEach(({id:s,start:a},u)=>{r[s]??=[],r[s].push(n.substring(a,o[u+1]?.index))})}),r},_f=e=>Array.from(e.querySelectorAll(Kt("Author"))).filter(t=>!!t.textContent&&t.parentElement!==null&&t.parentElement.getAttribute("aria-hidden")!=="true").map(t=>t.textContent.trim()),$e=(e,t)=>e.querySelector(Kt(t))?.textContent.trim(),Sf=e=>{const t=$e(e,"Creation Date"),r=$e(e,"Edition"),n=$e(e,"Publication Date"),o=$e(e,"Is Part Of"),i=$e(e,"Publisher"),s=$e(e,"Title"),a=$e(e,"MMS ID")??$e(e,"Record ID"),u=_f(e),c=bf(e),[l]=o?.split(",")??[],f=vf(n??t),m=[...c.isbn??[],...c.eisbn??[]].map(g=>Mt(g)).filter(g=>!!g);return{authors:u,date:f,dois:c.doi,edition:r,eissns:c.eissn,isbns:m,issns:c.issn,jtitle:l,lcn:a,publisher:i,title:s}};var ts=(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))(ts||{});const Ef=e=>Object.values(ts).includes(e),yf=(e,t)=>{const r=t?.mainEntity["@type"]??e.querySelector(".media-content-type")?.textContent??void 0;if(Ef(r))return r},$f=({document:e})=>{const t=mf(e),r=Sf(e),n=cf(t,r);switch(yf(e,t)){case"Article":return w(uf(n));case"Book":return w(pf(n));case"Periodical":case"Journal":return w(hf(n));case"Audio CD":case"CreativeWork":return w(lf(n));case"Movie":case"Video":return w(df(n));default:return Z()}},Rf=e=>{const t=e.querySelectorAll('[id="Info"] > p'),n=Array.from(t).find(i=>i.textContent.includes("Document Type"))?.textContent,o=h(e,"name","DC.identifier");return o?.startsWith("info:doi/")||n?.includes("Article")?E.Article:o?.startsWith("urn:issn:")?E.Journal:void 0},Af=e=>{const t=h(e,"name","DCTERMS.bibliographicCitation"),[r,n,o,i]=t?.split(",")??[];return{journalTitle:r,volume:n,issue:o,pages:i}},wf=e=>{const t=h(e,"name","DC.identifier");return(t?t.split("info:doi/"):null)?.[1]??void 0},If=e=>e.evaluate('//*[@id="altLayoutPublisherLogo"]/p/a[1]',e,null,XPathResult.STRING_TYPE,null).stringValue,kf=e=>{const[t,r]=e?e.trim().split("-"):[void 0,void 0],n=r?.replace(/\(\d+\)/,"").trim();return{spage:t,epage:n}},Cf=e=>{const t=h(e,"name","DCTERMS.issued");if(!t)return;const n=/\d{4}/.exec(t);return n?n[0]:void 0},Pf=e=>{const t=h(e,"name","DC.title"),r=h(e,"name","DC.publisher"),n=Cf(e),o=Af(e),i=o.journalTitle?.trim(),s=o.volume?.trim(),a=o.issue?.trim(),u=o.pages?kf(o.pages):void 0,c=u?.spage,l=u?.epage,f=re(e,"name","DC.creator"),m=wf(e);return U(y.Article,{au:f,jtitle:i,date:n,doi:m,issue:a,pub:r,spage:c,epage:l,atitle:t,volume:s})},Of=e=>{const t=h(e,"name","DC.title"),r=h(e,"name","DC.publisher"),n=If(e);return U(y.Journal,{issn:n,title:t,pub:r})},Nf=({document:e})=>{switch(Rf(e)){case E.Article:return w(Pf(e));case E.Journal:return w(Of(e));default:return Z()}},zf=/^\d{4}-\d{3}[\dX]$/i,Lf=e=>zf.test(e),rs=e=>{const t=e.filter(Lf);return t.length?t:void 0},Qt=e=>{const t=re(e,"name","citation_author");return t.length?t:void 0},er=e=>h(e,"name","citation_publication_date")?.match(/^\d{4}/)?.[0],Tf=e=>h(e,"name","citation_doi"),ns=e=>{const t=re(e,"name","citation_isbn");return t.length?t.join(","):void 0},os=e=>rs(re(e,"name","citation_issn")),tr=e=>h(e,"name","citation_journal_title"),rr=e=>h(e,"name","citation_publisher"),dt=e=>h(e,"name","citation_title"),Zf=e=>h(e,"name","citation_doi"),nr=e=>h(e,"name","citation_firstpage"),or=e=>h(e,"name","citation_lastpage"),xf=e=>h(e,"name","citation_issue"),qf=e=>h(e,"name","citation_volume"),jf=e=>U(y.Article,{atitle:dt(e),au:Qt(e),date:er(e),doi:Tf(e),issn:os(e)?.[0],issue:xf(e),jtitle:tr(e),pub:rr(e),volume:qf(e),spage:nr(e),epage:or(e)}),Df=e=>Y(y.Bookitem,{atitle:dt(e),au:Qt(e),btitle:tr(e),date:er(e),isbn:ns(e),pub:rr(e),spage:nr(e),epage:or(e)}),Uf=e=>uo({title:dt(e),au:Qt(e),date:er(e),pub:rr(e),spage:nr(e),epage:or(e)}),ss=e=>!!e.isbn,Bf=e=>!!e.issn||e.type==="Article"&&!!e.journalTitle||!ss(e)&&!!e.journalTitle,Vf=e=>!!e.title,Ff=e=>{const t={type:Zf(e),isbn:ns(e),issn:os(e),journalTitle:tr(e),title:dt(e)};return ss(t)?Df(e):Bf(t)?jf(e):Vf(t)?Uf(e):null},Jf=({document:e})=>{const t=Ff(e);return t?w(t):Z()},Mf=C({"@content":p(),datePublished:p().optional(),mainEntity:C({type:p().optional(),name:p().optional(),author:D(C({name:p()})).optional(),publisher:C({type:p(),name:p()}).optional(),isbn:p().optional()})}),Wf=e=>Mf.safeParse(e).success,Gf=e=>{const t=e.textContent;if(!t)return null;try{const r=JSON.parse(t);if(Wf(r))return r}catch{return null}return null},Xf=({document:e})=>{const t=ct(e);if(!t)return Z();const r=Gf(t);if(!r)return Z();const n=r.mainEntity.type,o=r.mainEntity.author?.map(c=>c.name),i=r.datePublished?.substring(0,4),s=r.mainEntity.name,a=r.mainEntity.isbn,u=r.mainEntity.publisher?.name;switch(n){case"Book":return w(Y(y.Book,{au:o,date:i,title:s,isbn:a,pub:u}));default:return Z()}},Hf=we.extend({"@type":p().optional(),name:p().optional(),copyrightYear:Kn().optional(),author:D(C({name:p()})).optional(),publisher:D(C({name:p()})).optional()}),Yf=e=>Hf.safeParse(e).success,Kf=({document:e,url:t})=>{const r=ct(e);if(!r)return Z();const n=De(r);if(!n||!Yf(n))return Z();const o=n["@type"],i=n.author?.map(l=>l.name),s=n.copyrightYear?.toString()??h(e,"property","og:book:release_date"),a=n.name,u=Yt(n.publisher?.map(l=>l.name)),c=h(e,"property","og:book:isbn");switch(o){case"Book":return w(Y(y.Book,{au:i,date:s,title:a,isbn:c,pub:u,uri:t}));default:return Z()}},Qf=e=>{const t=Array.from(e.querySelectorAll("a[rel=author]")).map(r=>r.textContent.trim()).filter(Boolean);return t.length?t:void 0},em=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+/,",")},tm=({url:e,document:t})=>{const r=t.querySelector("h3.page-title")?.textContent.trim()??void 0,n=Qf(t),o=h(t,"property","article:published_time"),i=em(t),s=Y(y.Book,{au:n,date:o?.substring(0,4),isbn:i,pub:"Milne Open Textbooks",title:r,uri:e});return w(s)},rm=({document:e,url:t})=>{switch(nm(t)){case E.Chapter:return w(cm(e));case E.Book:return w(um(e));case E.Article:return w(om(e));case E.Journal:return w(sm(e));default:return Z()}},nm=e=>{const{pathname:t}=new URL(e);return t.includes("/books/abs/")?E.Chapter:t.includes("/books/")?E.Book:/\/journals\/.+\/article\//.exec(t)!=null?E.Article:t.includes("/journals/")?E.Journal:E.None},om=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"),i=h(e,"name","citation_issue"),s=h(e,"name","citation_firstpage"),a=h(e,"name","citation_lastpage"),u=h(e,"name","citation_publication_date")?.substring(0,4),c=h(e,"name","citation_publisher"),l=is(e),f=rs(re(e,"name","citation_issn"));return U(y.Article,{atitle:t,au:l,jtitle:r,doi:n,volume:o,issue:i,issn:f?.[0],spage:s,epage:a,date:u,pub:c})},sm=e=>{const t=im(e),r=am(e),n=r.find(a=>a.type==="Print"),o=r.find(a=>a.type==="Online"),i=n?n.value:void 0,s=o?o.value:void 0;return U(y.Journal,{title:t,issn:i,eissn:s})},im=e=>e.querySelector("h1.title")?.textContent.trim()??void 0,am=e=>{const r=Array.from(e.querySelectorAll("span.bold")).find(i=>i.textContent.trim()==="ISSN:"),n=/^([0-9]{4}-[0-9]{3}[0-9X]) \((Print|Online)\)/,o=[];return r&&r.parentElement?.querySelectorAll("span.value")?.forEach(s=>{const a=s.textContent.trim(),u=n.exec(a);u&&o.push({value:u[1],type:u[2]})}),o},cm=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),i=h(e,"name","citation_publisher");return Y(y.Bookitem,{atitle:t,btitle:r,doi:n,date:o,pub:i})},um=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),i=h(e,"name","citation_publisher"),s=is(e);return Y(y.Book,{title:t,au:s,doi:r,isbn:n,date:o,pub:i})},is=e=>{const t=re(e,"name","citation_author");return t.length?t:void 0},lm=e=>{switch(h(e,"property","og:type")){case"Article":return"Article";case"Journal":return"Journal";default:return}};function pm(e){const t=h(e,"property","og:title"),r=h(e,"name","dc.Publisher"),n=h(e,"name","publication_doi");return w(U(y.Journal,{jtitle:t,pub:r,doi:n}))}function hm(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"),i=h(e,"name","citation_journal_title"),s=h(e,"name","dc.Publisher");return w(U(y.Article,{atitle:t,au:r,date:n,doi:o,jtitle:i,pub:s}))}const fm=({document:e})=>{switch(lm(e)){case"Journal":return pm(e);case"Article":return hm(e);default:return Z()}},mm=e=>{if(!e)return;const[t,r]=e.trim().split("-");return{spage:t,epage:r}},dm=e=>{const{pathname:t}=new URL(e);if(t.includes("/article/"))return E.Article},gm=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"),i=h(e,"name","citation_date")?.substring(0,4),s=h(e,"name","DC.Source.Volume"),a=h(e,"name","DC.Source.Issue"),u=h(e,"name","DC.Identifier.URI"),c=h(e,"name","DC.Identifier.pageNumber"),l=c?mm(c):void 0,f=l?.spage,m=l?.epage;return U(y.Article,{jtitle:t,atitle:r,au:n,issn:o,date:i,spage:f,epage:m,volume:s,issue:a,uri:u})},vm=({document:e,url:t})=>{switch(dm(t)){case E.Article:return w(gm(e));default:return Z()}},bm=e=>{switch(_m(e)){case"eBook":return"Book";case"Reference":return"Chapter";default:return}},_m=e=>e.querySelector("#vol-contentType a")?.textContent??void 0;function Sm(e,t){const r=as(e),n=sr(e),o=us(e),i=ls(e),s=ps(e),a=hs(e),u=sr(e),c=t,{startPage:l,endPage:f}=fs(e)??{};return w(Y(y.Book,{au:r,btitle:n,date:o,doi:i,epage:f,isbn:s,pub:a,spage:l,title:u,uri:c}))}function Em(e,t){const r=as(e),n=cs(e),o=sr(e),i=us(e),s=ls(e),a=ps(e),u=hs(e),c=cs(e),l=t,{startPage:f,endPage:m}=fs(e)??{};return w(Y(y.Book,{au:r,atitle:n,btitle:o,date:i,doi:s,epage:m,isbn:a,pub:u,spage:f,title:c,uri:l}))}const as=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,ym=e=>h(e,"property","og:title"),sr=e=>Te(e,"titlevalue")??ym(e),cs=e=>Te(e,"chapter-title-squid"),us=e=>Te(e,"pubdate-squid"),ls=e=>Te(e,"doi-squid"),ps=e=>Te(e,"isbn-squid"),hs=e=>Te(e,"pubname-squid"),fs=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]}},$m=({document:e,url:t})=>{switch(bm(e)){case"Book":return Sm(e,t);case"Chapter":return Em(e,t);default:return Z()}},Rm=(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(),Am=e=>{switch(Rm(e,"Medium")){case"book":case"e-book":return y.Book;case"e-journal":return y.Journal;default:return y.Unknown}},wm=e=>{delete e.rft_id},Im=e=>{const t=Jt(e);if(ut(t)){const r=Am(e.document);t.resource.genre=r,wm(t.resource)}return t},km=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 E.Article;const o=h(e,"name","twitter:title")?.trim(),i=h(e,"name","description")?.trim();if(o||i)return E.Webpage},Cm=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"),i=h(e,"name","citation_journal_title"),s=h(e,"name","citation_volume"),a=h(e,"name","citation_issn"),u=re(e,"name","citation_author");return U(y.Article,{au:u,jtitle:i,date:n,doi:o,issn:a,pub:r,title:t,volume:s})},Pm=(e,t)=>{const r=h(t,"name","twitter:title");return it({uri:e,title:r})},Om=({url:e,document:t})=>{switch(km(t)){case E.Article:return w(Cm(t));case E.Webpage:return w(Pm(e,t))}return Z()},Nm=({document:e})=>Array.from(e.querySelectorAll(".availability.documentSummaryAvailability.availabilityContent")).length<=1?Z():wo();var x=(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))(x||{});const ir={NoResourceFound:Lo,Z3988:Jt,Z3988SearchResult:jh,Amazon:Hl,CupOfJo:bp,Jstor:sf,Youtube:uh,SagePub:zp,SageVideo:qh,ScienceDirect:Bp,Springer:Ih,TaylorFrancis:Xp,Wiley:Zh,VuFind:sh,ClinicalKey:up,DOAJ:$p,Primo:$f,IngentaConnect:Nf,Ebscohost:Jf,OpenStax:Xf,OpenTextbook:Kf,Milne:tm,CambridgeJournalsOnline:rm,AhaJournals:fm,Ijees:vm,BloomsburyCollections:$m,HeritageCirqa:Im,BritishMedicalJournal:Om,SummonSearchResult:Nm},zm="5.23.4",ar=()=>zm,Lm=["com.au","com","ca","co.uk","de","fr","nl"].flatMap(e=>[`amazon.${e}`,`www.amazon.${e}`]),Tm={version:ar(),siteRegistrations:[{matcher:{regexp:"^https://[a-z0-9\\-]+\\.on\\.worldcat\\.org/search"},name:"Worldcat Search Results",parsers:[x.Z3988SearchResult]},{matcher:{regexp:"^https://[a-z0-9\\-]+\\.summon\\.serialssolutions\\.com/"},name:"Summon Search Results",parsers:[x.SummonSearchResult]},{matcher:{hostnames:["cupofjo.com"]},name:"Cup of Jo",parsers:[x.CupOfJo]},{matcher:{hostnames:["youtube.com","www.youtube.com"]},name:"Youtube",parsers:[x.Youtube]},{matcher:{hostnames:["www.sciencedirect.com"]},name:"Science Direct",parsers:[x.ScienceDirect]},{matcher:{hostnames:Lm},name:"Amazon",parsers:[x.Amazon]},{matcher:{hostnames:["sagepub.com","www.sagepub.com","journals.sagepub.com"]},name:"Sage Publishing",parsers:[x.SagePub]},{matcher:{hostnames:["www.tandfonline.com"]},name:"Taylor & Francis",parsers:[x.TaylorFrancis]},{matcher:{hostnames:["wiley.com","www.wiley.com","onlinelibrary.wiley.com"]},name:"Wiley",parsers:[x.Wiley]},{matcher:{regexp:"^https://[a-z0-9\\-]+\\.on\\.worldcat\\.org/"},name:"Worldcat",parsers:[x.Z3988]},{matcher:{hostnames:["catalogue.rau.ac.uk"]},name:"Royal Agricultural University Library",parsers:[x.Z3988]},{matcher:{hostnames:["link.springer.com"]},name:"Springer",parsers:[x.Springer]},{matcher:{regexp:"^https://sk\\.sagepub\\.com/video/"},name:"Sage Video",parsers:[x.SageVideo]},{matcher:{regexp:"^https://vufind\\.lboro\\.ac\\.uk/(Record|PrimoRecord)"},name:"VuFind",parsers:[x.VuFind]},{matcher:{hostnames:["www.clinicalkey.com","www.clinicalkey.com.au"]},name:"ClinicalKey",parsers:[x.ClinicalKey]},{matcher:{hostnames:["www.jstor.org"]},name:"JSTOR",parsers:[x.Jstor]},{matcher:{hostnames:["doaj.org"]},name:"DOAJ",parsers:[x.DOAJ]},{matcher:{regexp:"/.*ingentaconnect.com/"},name:"IngentaConnect",parsers:[x.IngentaConnect]},{matcher:{hostnames:["research.ebsco.com"]},name:"EBSCOHost",parsers:[x.Ebscohost]},{matcher:{hostnames:["openstax.org"]},name:"OpenStax",parsers:[x.OpenStax]},{matcher:{hostnames:["open.umn.edu"]},name:"OpenTextbook",parsers:[x.OpenTextbook]},{matcher:{hostnames:["milneopentextbooks.org"]},name:"Milne Open Textbooks",parsers:[x.Milne]},{matcher:{hostnames:["www.perlego.com"]},name:"Perlego",parsers:[x.Z3988]},{matcher:{hostnames:["www.ahajournals.org"]},name:"AHA Journals",parsers:[x.AhaJournals]},{matcher:{hostnames:["www.cambridge.org"]},name:"Cambridge Journals Online",parsers:[x.CambridgeJournalsOnline]},{matcher:{hostnames:["www.nieindia.org"]},name:"International Journal of Ecology and Environmental Sciences",parsers:[x.Ijees]},{matcher:{hostnames:["www.bloomsburycollections.com"]},name:"Bloomsbury Collections",parsers:[x.BloomsburyCollections]},{matcher:{hostnames:["regwem.cirqahosting.com","buddy.cirqahosting.com"]},name:"Heritage Cirqa",parsers:[x.HeritageCirqa]},{matcher:{hostnames:["www.bmj.com"]},name:"British Medical Journal",parsers:[x.BritishMedicalJournal]}]},cr=C({hostnames:D(p()).min(1)}),ur=C({regexp:p()}),lr=pe([cr,ur]),pr=C({matcher:lr,name:p(),parsers:D(p()),libraryVersionRange:p().optional()}),ms=C({siteRegistrations:D(pr),version:p()}),Zm=e=>ms.safeParse(e).success,xm=e=>pr.safeParse(e).success,qm=e=>lr.safeParse(e).success,ds=e=>Object.values(x).includes(e),jm=e=>typeof e=="object"&&e!==null,gs=C({url:p(),document:Sl(jm)}),Dm=e=>gs.safeParse(e).success;var gt={exports:{}},hr,vs;function vt(){if(vs)return hr;vs=1;const e="2.0.0",t=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,o=t-6;return hr={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},hr}var fr,bs;function bt(){return bs||(bs=1,fr=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{}),fr}var _s;function Me(){return _s||(_s=1,(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:o}=vt(),i=bt();t=e.exports={};const s=t.re=[],a=t.safeRe=[],u=t.src=[],c=t.safeSrc=[],l=t.t={};let f=0;const m="[a-zA-Z0-9-]",g=[["\\s",1],["\\d",o],[m,n]],P=O=>{for(const[q,K]of g)O=O.split(`${q}*`).join(`${q}{0,${K}}`).split(`${q}+`).join(`${q}{1,${K}}`);return O},b=(O,q,K)=>{const L=P(q),B=f++;i(O,B,q),l[O]=B,u[B]=q,c[B]=L,s[B]=new RegExp(q,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-]${m}*`),b("MAINVERSION",`(${u[l.NUMERICIDENTIFIER]})\\.(${u[l.NUMERICIDENTIFIER]})\\.(${u[l.NUMERICIDENTIFIER]})`),b("MAINVERSIONLOOSE",`(${u[l.NUMERICIDENTIFIERLOOSE]})\\.(${u[l.NUMERICIDENTIFIERLOOSE]})\\.(${u[l.NUMERICIDENTIFIERLOOSE]})`),b("PRERELEASEIDENTIFIER",`(?:${u[l.NONNUMERICIDENTIFIER]}|${u[l.NUMERICIDENTIFIER]})`),b("PRERELEASEIDENTIFIERLOOSE",`(?:${u[l.NONNUMERICIDENTIFIER]}|${u[l.NUMERICIDENTIFIERLOOSE]})`),b("PRERELEASE",`(?:-(${u[l.PRERELEASEIDENTIFIER]}(?:\\.${u[l.PRERELEASEIDENTIFIER]})*))`),b("PRERELEASELOOSE",`(?:-?(${u[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[l.PRERELEASEIDENTIFIERLOOSE]})*))`),b("BUILDIDENTIFIER",`${m}+`),b("BUILD",`(?:\\+(${u[l.BUILDIDENTIFIER]}(?:\\.${u[l.BUILDIDENTIFIER]})*))`),b("FULLPLAIN",`v?${u[l.MAINVERSION]}${u[l.PRERELEASE]}?${u[l.BUILD]}?`),b("FULL",`^${u[l.FULLPLAIN]}$`),b("LOOSEPLAIN",`[v=\\s]*${u[l.MAINVERSIONLOOSE]}${u[l.PRERELEASELOOSE]}?${u[l.BUILD]}?`),b("LOOSE",`^${u[l.LOOSEPLAIN]}$`),b("GTLT","((?:<|>)?=?)"),b("XRANGEIDENTIFIERLOOSE",`${u[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),b("XRANGEIDENTIFIER",`${u[l.NUMERICIDENTIFIER]}|x|X|\\*`),b("XRANGEPLAIN",`[v=\\s]*(${u[l.XRANGEIDENTIFIER]})(?:\\.(${u[l.XRANGEIDENTIFIER]})(?:\\.(${u[l.XRANGEIDENTIFIER]})(?:${u[l.PRERELEASE]})?${u[l.BUILD]}?)?)?`),b("XRANGEPLAINLOOSE",`[v=\\s]*(${u[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[l.XRANGEIDENTIFIERLOOSE]})(?:${u[l.PRERELEASELOOSE]})?${u[l.BUILD]}?)?)?`),b("XRANGE",`^${u[l.GTLT]}\\s*${u[l.XRANGEPLAIN]}$`),b("XRANGELOOSE",`^${u[l.GTLT]}\\s*${u[l.XRANGEPLAINLOOSE]}$`),b("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),b("COERCE",`${u[l.COERCEPLAIN]}(?:$|[^\\d])`),b("COERCEFULL",u[l.COERCEPLAIN]+`(?:${u[l.PRERELEASE]})?(?:${u[l.BUILD]})?(?:$|[^\\d])`),b("COERCERTL",u[l.COERCE],!0),b("COERCERTLFULL",u[l.COERCEFULL],!0),b("LONETILDE","(?:~>?)"),b("TILDETRIM",`(\\s*)${u[l.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",b("TILDE",`^${u[l.LONETILDE]}${u[l.XRANGEPLAIN]}$`),b("TILDELOOSE",`^${u[l.LONETILDE]}${u[l.XRANGEPLAINLOOSE]}$`),b("LONECARET","(?:\\^)"),b("CARETTRIM",`(\\s*)${u[l.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",b("CARET",`^${u[l.LONECARET]}${u[l.XRANGEPLAIN]}$`),b("CARETLOOSE",`^${u[l.LONECARET]}${u[l.XRANGEPLAINLOOSE]}$`),b("COMPARATORLOOSE",`^${u[l.GTLT]}\\s*(${u[l.LOOSEPLAIN]})$|^$`),b("COMPARATOR",`^${u[l.GTLT]}\\s*(${u[l.FULLPLAIN]})$|^$`),b("COMPARATORTRIM",`(\\s*)${u[l.GTLT]}\\s*(${u[l.LOOSEPLAIN]}|${u[l.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",b("HYPHENRANGE",`^\\s*(${u[l.XRANGEPLAIN]})\\s+-\\s+(${u[l.XRANGEPLAIN]})\\s*$`),b("HYPHENRANGELOOSE",`^\\s*(${u[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[l.XRANGEPLAINLOOSE]})\\s*$`),b("STAR","(<|>)?=?\\s*\\*"),b("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),b("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(gt,gt.exports)),gt.exports}var mr,Ss;function dr(){if(Ss)return mr;Ss=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return mr=n=>n?typeof n!="object"?e:n:t,mr}var gr,Es;function ys(){if(Es)return gr;Es=1;const e=/^[0-9]+$/,t=(n,o)=>{const i=e.test(n),s=e.test(o);return i&&s&&(n=+n,o=+o),n===o?0:i&&!s?-1:s&&!i?1:n<o?-1:1};return gr={compareIdentifiers:t,rcompareIdentifiers:(n,o)=>t(o,n)},gr}var vr,$s;function ne(){if($s)return vr;$s=1;const e=bt(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=vt(),{safeRe:n,t:o}=Me(),i=dr(),{compareIdentifiers:s}=ys();class a{constructor(c,l){if(l=i(l),c instanceof a){if(c.loose===!!l.loose&&c.includePrerelease===!!l.includePrerelease)return c;c=c.version}else if(typeof c!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof c}".`);if(c.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",c,l),this.options=l,this.loose=!!l.loose,this.includePrerelease=!!l.includePrerelease;const f=c.trim().match(l.loose?n[o.LOOSE]:n[o.FULL]);if(!f)throw new TypeError(`Invalid Version: ${c}`);if(this.raw=c,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(c){if(e("SemVer.compare",this.version,this.options,c),!(c instanceof a)){if(typeof c=="string"&&c===this.version)return 0;c=new a(c,this.options)}return c.version===this.version?0:this.compareMain(c)||this.comparePre(c)}compareMain(c){return c instanceof a||(c=new a(c,this.options)),s(this.major,c.major)||s(this.minor,c.minor)||s(this.patch,c.patch)}comparePre(c){if(c instanceof a||(c=new a(c,this.options)),this.prerelease.length&&!c.prerelease.length)return-1;if(!this.prerelease.length&&c.prerelease.length)return 1;if(!this.prerelease.length&&!c.prerelease.length)return 0;let l=0;do{const f=this.prerelease[l],m=c.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 s(f,m)}while(++l)}compareBuild(c){c instanceof a||(c=new a(c,this.options));let l=0;do{const f=this.build[l],m=c.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 s(f,m)}while(++l)}inc(c,l,f){if(c.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(c){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]),s(this.prerelease[0],l)===0?isNaN(this.prerelease[1])&&(this.prerelease=g):this.prerelease=g}break}default:throw new Error(`invalid increment argument: ${c}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return vr=a,vr}var br,Rs;function Ze(){if(Rs)return br;Rs=1;const e=ne();return br=(r,n,o=!1)=>{if(r instanceof e)return r;try{return new e(r,n)}catch(i){if(!o)return null;throw i}},br}var _r,As;function Um(){if(As)return _r;As=1;const e=Ze();return _r=(r,n)=>{const o=e(r,n);return o?o.version:null},_r}var Sr,ws;function Bm(){if(ws)return Sr;ws=1;const e=Ze();return Sr=(r,n)=>{const o=e(r.trim().replace(/^[=v]+/,""),n);return o?o.version:null},Sr}var Er,Is;function Vm(){if(Is)return Er;Is=1;const e=ne();return Er=(r,n,o,i,s)=>{typeof o=="string"&&(s=i,i=o,o=void 0);try{return new e(r instanceof e?r.version:r,o).inc(n,i,s).version}catch{return null}},Er}var yr,ks;function Fm(){if(ks)return yr;ks=1;const e=Ze();return yr=(r,n)=>{const o=e(r,null,!0),i=e(n,null,!0),s=o.compare(i);if(s===0)return null;const a=s>0,u=a?o:i,c=a?i:o,l=!!u.prerelease.length;if(!!c.prerelease.length&&!l){if(!c.patch&&!c.minor)return"major";if(c.compareMain(u)===0)return c.minor&&!c.patch?"minor":"patch"}const m=l?"pre":"";return o.major!==i.major?m+"major":o.minor!==i.minor?m+"minor":o.patch!==i.patch?m+"patch":"prerelease"},yr}var $r,Cs;function Jm(){if(Cs)return $r;Cs=1;const e=ne();return $r=(r,n)=>new e(r,n).major,$r}var Rr,Ps;function Mm(){if(Ps)return Rr;Ps=1;const e=ne();return Rr=(r,n)=>new e(r,n).minor,Rr}var Ar,Os;function Wm(){if(Os)return Ar;Os=1;const e=ne();return Ar=(r,n)=>new e(r,n).patch,Ar}var wr,Ns;function Gm(){if(Ns)return wr;Ns=1;const e=Ze();return wr=(r,n)=>{const o=e(r,n);return o&&o.prerelease.length?o.prerelease:null},wr}var Ir,zs;function ue(){if(zs)return Ir;zs=1;const e=ne();return Ir=(r,n,o)=>new e(r,o).compare(new e(n,o)),Ir}var kr,Ls;function Xm(){if(Ls)return kr;Ls=1;const e=ue();return kr=(r,n,o)=>e(n,r,o),kr}var Cr,Ts;function Hm(){if(Ts)return Cr;Ts=1;const e=ue();return Cr=(r,n)=>e(r,n,!0),Cr}var Pr,Zs;function Or(){if(Zs)return Pr;Zs=1;const e=ne();return Pr=(r,n,o)=>{const i=new e(r,o),s=new e(n,o);return i.compare(s)||i.compareBuild(s)},Pr}var Nr,xs;function Ym(){if(xs)return Nr;xs=1;const e=Or();return Nr=(r,n)=>r.sort((o,i)=>e(o,i,n)),Nr}var zr,qs;function Km(){if(qs)return zr;qs=1;const e=Or();return zr=(r,n)=>r.sort((o,i)=>e(i,o,n)),zr}var Lr,js;function _t(){if(js)return Lr;js=1;const e=ue();return Lr=(r,n,o)=>e(r,n,o)>0,Lr}var Tr,Ds;function Zr(){if(Ds)return Tr;Ds=1;const e=ue();return Tr=(r,n,o)=>e(r,n,o)<0,Tr}var xr,Us;function Bs(){if(Us)return xr;Us=1;const e=ue();return xr=(r,n,o)=>e(r,n,o)===0,xr}var qr,Vs;function Fs(){if(Vs)return qr;Vs=1;const e=ue();return qr=(r,n,o)=>e(r,n,o)!==0,qr}var jr,Js;function Dr(){if(Js)return jr;Js=1;const e=ue();return jr=(r,n,o)=>e(r,n,o)>=0,jr}var Ur,Ms;function Br(){if(Ms)return Ur;Ms=1;const e=ue();return Ur=(r,n,o)=>e(r,n,o)<=0,Ur}var Vr,Ws;function Gs(){if(Ws)return Vr;Ws=1;const e=Bs(),t=Fs(),r=_t(),n=Dr(),o=Zr(),i=Br();return Vr=(a,u,c,l)=>{switch(u){case"===":return typeof a=="object"&&(a=a.version),typeof c=="object"&&(c=c.version),a===c;case"!==":return typeof a=="object"&&(a=a.version),typeof c=="object"&&(c=c.version),a!==c;case"":case"=":case"==":return e(a,c,l);case"!=":return t(a,c,l);case">":return r(a,c,l);case">=":return n(a,c,l);case"<":return o(a,c,l);case"<=":return i(a,c,l);default:throw new TypeError(`Invalid operator: ${u}`)}},Vr}var Fr,Xs;function Qm(){if(Xs)return Fr;Xs=1;const e=ne(),t=Ze(),{safeRe:r,t:n}=Me();return Fr=(i,s)=>{if(i instanceof e)return i;if(typeof i=="number"&&(i=String(i)),typeof i!="string")return null;s=s||{};let a=null;if(!s.rtl)a=i.match(s.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);else{const g=s.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let P;for(;(P=g.exec(i))&&(!a||a.index+a[0].length!==i.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 u=a[2],c=a[3]||"0",l=a[4]||"0",f=s.includePrerelease&&a[5]?`-${a[5]}`:"",m=s.includePrerelease&&a[6]?`+${a[6]}`:"";return t(`${u}.${c}.${l}${f}${m}`,s)},Fr}var Jr,Hs;function ed(){if(Hs)return Jr;Hs=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 i=this.map.keys().next().value;this.delete(i)}this.map.set(r,n)}return this}}return Jr=e,Jr}var Mr,Ys;function le(){if(Ys)return Mr;Ys=1;const e=/\s+/g;class t{constructor(_,I){if(I=o(I),_ instanceof t)return _.loose===!!I.loose&&_.includePrerelease===!!I.includePrerelease?_:new t(_.raw,I);if(_ instanceof i)return this.raw=_.value,this.set=[[_]],this.formatted=void 0,this;if(this.options=I,this.loose=!!I.loose,this.includePrerelease=!!I.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(k=>!b(k[0])),this.set.length===0)this.set=[R];else if(this.set.length>1){for(const k of this.set)if(k.length===1&&O(k[0])){this.set=[k];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let _=0;_<this.set.length;_++){_>0&&(this.formatted+="||");const I=this.set[_];for(let R=0;R<I.length;R++)R>0&&(this.formatted+=" "),this.formatted+=I[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))+":"+_,k=n.get(R);if(k)return k;const A=this.options.loose,N=A?u[c.HYPHENRANGELOOSE]:u[c.HYPHENRANGE];_=_.replace(N,pn(this.options.includePrerelease)),s("hyphen replace",_),_=_.replace(u[c.COMPARATORTRIM],l),s("comparator trim",_),_=_.replace(u[c.TILDETRIM],f),s("tilde trim",_),_=_.replace(u[c.CARETTRIM],m),s("caret trim",_);let j=_.split(" ").map(ee=>K(ee,this.options)).join(" ").split(/\s+/).map(ee=>ln(ee,this.options));A&&(j=j.filter(ee=>(s("loose invalid filter",ee,this.options),!!ee.match(u[c.COMPARATORLOOSE])))),s("range list",j);const T=new Map,F=j.map(ee=>new i(ee,this.options));for(const ee of F){if(b(ee))return[ee];T.set(ee.value,ee)}T.size>1&&T.has("")&&T.delete("");const oe=[...T.values()];return n.set(R,oe),oe}intersects(_,I){if(!(_ instanceof t))throw new TypeError("a Range is required");return this.set.some(R=>q(R,I)&&_.set.some(k=>q(k,I)&&R.every(A=>k.every(N=>A.intersects(N,I)))))}test(_){if(!_)return!1;if(typeof _=="string")try{_=new a(_,this.options)}catch{return!1}for(let I=0;I<this.set.length;I++)if(hn(this.set[I],_,this.options))return!0;return!1}}Mr=t;const r=ed(),n=new r,o=dr(),i=St(),s=bt(),a=ne(),{safeRe:u,t:c,comparatorTrimReplace:l,tildeTrimReplace:f,caretTrimReplace:m}=Me(),{FLAG_INCLUDE_PRERELEASE:g,FLAG_LOOSE:P}=vt(),b=S=>S.value==="<0.0.0-0",O=S=>S.value==="",q=(S,_)=>{let I=!0;const R=S.slice();let k=R.pop();for(;I&&R.length;)I=R.every(A=>k.intersects(A,_)),k=R.pop();return I},K=(S,_)=>(s("comp",S,_),S=W(S,_),s("caret",S),S=B(S,_),s("tildes",S),S=z(S,_),s("xrange",S),S=un(S,_),s("stars",S),S),L=S=>!S||S.toLowerCase()==="x"||S==="*",B=(S,_)=>S.trim().split(/\s+/).map(I=>Q(I,_)).join(" "),Q=(S,_)=>{const I=_.loose?u[c.TILDELOOSE]:u[c.TILDE];return S.replace(I,(R,k,A,N,j)=>{s("tilde",S,R,k,A,N,j);let T;return L(k)?T="":L(A)?T=`>=${k}.0.0 <${+k+1}.0.0-0`:L(N)?T=`>=${k}.${A}.0 <${k}.${+A+1}.0-0`:j?(s("replaceTilde pr",j),T=`>=${k}.${A}.${N}-${j} <${k}.${+A+1}.0-0`):T=`>=${k}.${A}.${N} <${k}.${+A+1}.0-0`,s("tilde return",T),T})},W=(S,_)=>S.trim().split(/\s+/).map(I=>te(I,_)).join(" "),te=(S,_)=>{s("caret",S,_);const I=_.loose?u[c.CARETLOOSE]:u[c.CARET],R=_.includePrerelease?"-0":"";return S.replace(I,(k,A,N,j,T)=>{s("caret",S,k,A,N,j,T);let F;return L(A)?F="":L(N)?F=`>=${A}.0.0${R} <${+A+1}.0.0-0`:L(j)?A==="0"?F=`>=${A}.${N}.0${R} <${A}.${+N+1}.0-0`:F=`>=${A}.${N}.0${R} <${+A+1}.0.0-0`:T?(s("replaceCaret pr",T),A==="0"?N==="0"?F=`>=${A}.${N}.${j}-${T} <${A}.${N}.${+j+1}-0`:F=`>=${A}.${N}.${j}-${T} <${A}.${+N+1}.0-0`:F=`>=${A}.${N}.${j}-${T} <${+A+1}.0.0-0`):(s("no pr"),A==="0"?N==="0"?F=`>=${A}.${N}.${j}${R} <${A}.${N}.${+j+1}-0`:F=`>=${A}.${N}.${j}${R} <${A}.${+N+1}.0-0`:F=`>=${A}.${N}.${j} <${+A+1}.0.0-0`),s("caret return",F),F})},z=(S,_)=>(s("replaceXRanges",S,_),S.split(/\s+/).map(I=>We(I,_)).join(" ")),We=(S,_)=>{S=S.trim();const I=_.loose?u[c.XRANGELOOSE]:u[c.XRANGE];return S.replace(I,(R,k,A,N,j,T)=>{s("xRange",S,R,k,A,N,j,T);const F=L(A),oe=F||L(N),ee=oe||L(j),Ge=ee;return k==="="&&Ge&&(k=""),T=_.includePrerelease?"-0":"",F?k===">"||k==="<"?R="<0.0.0-0":R="*":k&&Ge?(oe&&(N=0),j=0,k===">"?(k=">=",oe?(A=+A+1,N=0,j=0):(N=+N+1,j=0)):k==="<="&&(k="<",oe?A=+A+1:N=+N+1),k==="<"&&(T="-0"),R=`${k+A}.${N}.${j}${T}`):oe?R=`>=${A}.0.0${T} <${+A+1}.0.0-0`:ee&&(R=`>=${A}.${N}.0${T} <${A}.${+N+1}.0-0`),s("xRange return",R),R})},un=(S,_)=>(s("replaceStars",S,_),S.trim().replace(u[c.STAR],"")),ln=(S,_)=>(s("replaceGTE0",S,_),S.trim().replace(u[_.includePrerelease?c.GTE0PRE:c.GTE0],"")),pn=S=>(_,I,R,k,A,N,j,T,F,oe,ee,Ge)=>(L(R)?I="":L(k)?I=`>=${R}.0.0${S?"-0":""}`:L(A)?I=`>=${R}.${k}.0${S?"-0":""}`:N?I=`>=${I}`:I=`>=${I}${S?"-0":""}`,L(F)?T="":L(oe)?T=`<${+F+1}.0.0-0`:L(ee)?T=`<${F}.${+oe+1}.0-0`:Ge?T=`<=${F}.${oe}.${ee}-${Ge}`:S?T=`<${F}.${oe}.${+ee+1}-0`:T=`<=${T}`,`${I} ${T}`.trim()),hn=(S,_,I)=>{for(let R=0;R<S.length;R++)if(!S[R].test(_))return!1;if(_.prerelease.length&&!I.includePrerelease){for(let R=0;R<S.length;R++)if(s(S[R].semver),S[R].semver!==i.ANY&&S[R].semver.prerelease.length>0){const k=S[R].semver;if(k.major===_.major&&k.minor===_.minor&&k.patch===_.patch)return!0}return!1}return!0};return Mr}var Wr,Ks;function St(){if(Ks)return Wr;Ks=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(" "),s("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,s("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(s("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 i(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 u(l.value,f).test(this.value):l.operator===""?l.value===""?!0:new u(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("=")||i(this.semver,"<",l.semver,f)&&this.operator.startsWith(">")&&l.operator.startsWith("<")||i(this.semver,">",l.semver,f)&&this.operator.startsWith("<")&&l.operator.startsWith(">")))}}Wr=t;const r=dr(),{safeRe:n,t:o}=Me(),i=Gs(),s=bt(),a=ne(),u=le();return Wr}var Gr,Qs;function Et(){if(Qs)return Gr;Qs=1;const e=le();return Gr=(r,n,o)=>{try{n=new e(n,o)}catch{return!1}return n.test(r)},Gr}var Xr,ei;function td(){if(ei)return Xr;ei=1;const e=le();return Xr=(r,n)=>new e(r,n).set.map(o=>o.map(i=>i.value).join(" ").trim().split(" ")),Xr}var Hr,ti;function rd(){if(ti)return Hr;ti=1;const e=ne(),t=le();return Hr=(n,o,i)=>{let s=null,a=null,u=null;try{u=new t(o,i)}catch{return null}return n.forEach(c=>{u.test(c)&&(!s||a.compare(c)===-1)&&(s=c,a=new e(s,i))}),s},Hr}var Yr,ri;function nd(){if(ri)return Yr;ri=1;const e=ne(),t=le();return Yr=(n,o,i)=>{let s=null,a=null,u=null;try{u=new t(o,i)}catch{return null}return n.forEach(c=>{u.test(c)&&(!s||a.compare(c)===1)&&(s=c,a=new e(s,i))}),s},Yr}var Kr,ni;function od(){if(ni)return Kr;ni=1;const e=ne(),t=le(),r=_t();return Kr=(o,i)=>{o=new t(o,i);let s=new e("0.0.0");if(o.test(s)||(s=new e("0.0.0-0"),o.test(s)))return s;s=null;for(let a=0;a<o.set.length;++a){const u=o.set[a];let c=null;u.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">=":(!c||r(f,c))&&(c=f);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${l.operator}`)}}),c&&(!s||r(s,c))&&(s=c)}return s&&o.test(s)?s:null},Kr}var Qr,oi;function sd(){if(oi)return Qr;oi=1;const e=le();return Qr=(r,n)=>{try{return new e(r,n).range||"*"}catch{return null}},Qr}var en,si;function tn(){if(si)return en;si=1;const e=ne(),t=St(),{ANY:r}=t,n=le(),o=Et(),i=_t(),s=Zr(),a=Br(),u=Dr();return en=(l,f,m,g)=>{l=new e(l,g),f=new n(f,g);let P,b,O,q,K;switch(m){case">":P=i,b=a,O=s,q=">",K=">=";break;case"<":P=s,b=u,O=i,q="<",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===q||Q.operator===K||(!W.operator||W.operator===q)&&b(l,W.semver))return!1;if(W.operator===K&&O(l,W.semver))return!1}return!0},en}var rn,ii;function id(){if(ii)return rn;ii=1;const e=tn();return rn=(r,n,o)=>e(r,n,">",o),rn}var nn,ai;function ad(){if(ai)return nn;ai=1;const e=tn();return nn=(r,n,o)=>e(r,n,"<",o),nn}var on,ci;function cd(){if(ci)return on;ci=1;const e=le();return on=(r,n,o)=>(r=new e(r,o),n=new e(n,o),r.intersects(n,o)),on}var sn,ui;function ud(){if(ui)return sn;ui=1;const e=Et(),t=ue();return sn=(r,n,o)=>{const i=[];let s=null,a=null;const u=r.sort((m,g)=>t(m,g,o));for(const m of u)e(m,n,o)?(a=m,s||(s=m)):(a&&i.push([s,a]),a=null,s=null);s&&i.push([s,null]);const c=[];for(const[m,g]of i)m===g?c.push(m):!g&&m===u[0]?c.push("*"):g?m===u[0]?c.push(`<=${g}`):c.push(`${m} - ${g}`):c.push(`>=${m}`);const l=c.join(" || "),f=typeof n.raw=="string"?n.raw:String(n);return l.length<f.length?l:n},sn}var an,li;function ld(){if(li)return an;li=1;const e=le(),t=St(),{ANY:r}=t,n=Et(),o=ue(),i=(f,m,g={})=>{if(f===m)return!0;f=new e(f,g),m=new e(m,g);let P=!1;e:for(const b of f.set){for(const O of m.set){const q=u(b,O,g);if(P=P||q!==null,q)continue e}if(P)return!1}return!0},s=[new t(">=0.0.0-0")],a=[new t(">=0.0.0")],u=(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=s:f=a}if(m.length===1&&m[0].semver===r){if(g.includePrerelease)return!0;m=a}const P=new Set;let b,O;for(const z of f)z.operator===">"||z.operator===">="?b=c(b,z,g):z.operator==="<"||z.operator==="<="?O=l(O,z,g):P.add(z.semver);if(P.size>1)return null;let q;if(b&&O){if(q=o(b.semver,O.semver,g),q>0)return null;if(q===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 We of m)if(!n(z,String(We),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 m){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=c(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)&&q!==0)return!1}return!(b&&B&&!O&&q!==0||O&&Q&&!b&&q!==0||te||W)},c=(f,m,g)=>{if(!f)return m;const P=o(f.semver,m.semver,g);return P>0?f:P<0||m.operator===">"&&f.operator===">="?m:f},l=(f,m,g)=>{if(!f)return m;const P=o(f.semver,m.semver,g);return P<0?f:P>0||m.operator==="<"&&f.operator==="<="?m:f};return an=i,an}var cn,pi;function pd(){if(pi)return cn;pi=1;const e=Me(),t=vt(),r=ne(),n=ys(),o=Ze(),i=Um(),s=Bm(),a=Vm(),u=Fm(),c=Jm(),l=Mm(),f=Wm(),m=Gm(),g=ue(),P=Xm(),b=Hm(),O=Or(),q=Ym(),K=Km(),L=_t(),B=Zr(),Q=Bs(),W=Fs(),te=Dr(),z=Br(),We=Gs(),un=Qm(),ln=St(),pn=le(),hn=Et(),S=td(),_=rd(),I=nd(),R=od(),k=sd(),A=tn(),N=id(),j=ad(),T=cd(),F=ud(),oe=ld();return cn={parse:o,valid:i,clean:s,inc:a,diff:u,major:c,minor:l,patch:f,prerelease:m,compare:g,rcompare:P,compareLoose:b,compareBuild:O,sort:q,rsort:K,gt:L,lt:B,eq:Q,neq:W,gte:te,lte:z,cmp:We,coerce:un,Comparator:ln,Range:pn,satisfies:hn,toComparators:S,maxSatisfying:_,minSatisfying:I,minVersion:R,validRange:k,outside:A,gtr:N,ltr:j,intersects:T,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},cn}var hd=pd();const fd=(e,t)=>md(t)?t.hostnames.includes(new URL(e).hostname):dd(t)?!!e.match(t.regexp):!1,md=e=>cr.safeParse(e).success,dd=e=>ur.safeParse(e).success,gd=(e,t)=>t?hd.satisfies(e,t):!0,vd=(e,t,r)=>gd(t,r.libraryVersionRange)&&fd(e,r.matcher),bd=(e,t)=>e.siteRegistrations.filter(r=>vd(t,ar(),r)),_d=(e,t)=>bd(e,t).flatMap(({parsers:o,name:i})=>o.filter(s=>ds(s)&&s in ir).map(s=>({parser:ir[s],parserType:s,name:i}))),hi=(e,t)=>{const r=_d(e,t.url);for(const{parser:n,parserType:o,name:i}of r){const s=n(t);if(ut(s)||xo(s)||qo(s))return{...s,meta:{parserName:i,parserType:o,uri:t.url,referrer:t.url}}}return{...Lo(),meta:{parserName:null,parserType:x.NoResourceFound,uri:t.url,referrer:t.url}}},Sd=(e,t)=>{const r=hi(e,t),{uri:n,...o}=r.meta;return{...r,meta:o}},Ed=(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`)}},yd=(e,t)=>{const r=Ed(e,t);return new URL("/ui/forms/bookmarklet.html",r)},$d=(e,t,r)=>{const n=fo(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=$l,v.CustomerListSchema=_o,v.CustomerSchema=xt,v.DirectLinkOnlyResultSchema=Ut,v.Genre=y,v.HostnamesMatcherSchema=cr,v.JournalGenresSchema=Rl,v.NON_OPENURL_PROPERTIES=Tt,v.NonOpenUrlPropertiesSchema=Lt,v.NothingParsedResultSchema=Dt,v.OPENURL_KEYS=po,v.OpenUrlAudioVisualResourceSchema=Il,v.OpenUrlBookResourceSchema=Al,v.OpenUrlDocumentResourceSchema=Cl,v.OpenUrlImageResourceSchema=kl,v.OpenUrlJournalResourceSchema=wl,v.OpenUrlResourceSchema=fe,v.OpenUrlResultSchema=Bt,v.OpenUrlWebpageResourceSchema=Pl,v.PARSERS=ir,v.ParserRegistrySchema=ms,v.ParserType=x,v.ParsingMetadataSchema=qt,v.ParsingMetadataV2Schema=jt,v.ParsingRequestSchema=bo,v.ParsingResponseSchema=$o,v.ParsingResponseV2Schema=Ro,v.ParsingResultSchema=at,v.REGISTRY=Tm,v.RegExpMatcherSchema=ur,v.ResourceDataSchema=gs,v.ResourceSchema=ao,v.SiteRegistrationSchema=pr,v.SummonSearchResultSchema=Ft,v.TenantRegion=_e,v.TenantRegistrySchema=Zl,v.TenantSchema=Zt,v.UrlMatcherSchema=lr,v.Z3988SearchResultSchema=Vt,v.convertCustomerListToTenantRegistry=jl,v.createAudioVisual=be,v.createBook=Y,v.createDocument=uo,v.createImage=co,v.createJournal=U,v.createWebpage=it,v.directLinkOnly=Ul,v.fromOpenUrl=go,v.getBaseBookmarkingUrl=yd,v.getLibraryVersion=ar,v.isCustomer=So,v.isCustomerList=Eo,v.isDirectLinkOnlyResult=th,v.isGenre=Tl,v.isNothingParsedResult=rh,v.isOpenUrlResult=ut,v.isParserRegistry=Zm,v.isParserType=ds,v.isParsingMetadata=Qp,v.isParsingMetadataV2=eh,v.isParsingRequest=xl,v.isParsingResponse=Yp,v.isParsingResponseV2=Kp,v.isParsingResult=Hp,v.isResourceData=Dm,v.isSiteRegistration=xm,v.isSummonSearchResult=qo,v.isTenant=yo,v.isTenantRegion=ql,v.isUrlMatcher=qm,v.isZ3988SearchResult=xo,v.nothingParsed=Z,v.openUrlResource=w,v.parseResource=hi,v.parseResourceV2=Sd,v.summonSearchResult=wo,v.toBookmarkingWorkflowUrl=$d,v.toOpenUrl=fo,v.z3988SearchResult=Ao,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})}));
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@talisdev/bibliographic-resource-parsers-lib",
3
+ "repository": {
4
+ "type": "git",
5
+ "url": "git+https://github.com/talis/bibliographic-resource-parsers-lib.git"
6
+ },
7
+ "publishConfig": {
8
+ "registry": "https://registry.npmjs.org/"
9
+ },
10
+ "private": false,
11
+ "version": "5.23.4",
12
+ "type": "module",
13
+ "exports": {
14
+ ".": {
15
+ "import": "./dist/bibliographic-resource-parsers-lib.js",
16
+ "require": "./dist/bibliographic-resource-parsers-lib.umd.cjs"
17
+ }
18
+ },
19
+ "main": "./dist/bibliographic-resource-parsers-lib.umd.cjs",
20
+ "module": "./dist/bibliographic-resource-parsers-lib.js",
21
+ "types": "./dist/bibliographic-resource-parsers-lib.d.ts",
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "scripts": {
26
+ "build": "vite build",
27
+ "format": "npm run format:eslint && npm run format:prettier",
28
+ "format:eslint": "eslint . --fix",
29
+ "format:prettier": "prettier . --write",
30
+ "lint": "npm run lint:eslint && npm run lint:prettier",
31
+ "lint:eslint": "eslint .",
32
+ "lint:prettier": "prettier . --check",
33
+ "test": "vitest",
34
+ "test:ci": "vitest run",
35
+ "typecheck": "tsc --noEmit",
36
+ "save-fixture": "tsx scripts/save-fixture.ts"
37
+ },
38
+ "devDependencies": {
39
+ "@commitlint/cli": "19.8.1",
40
+ "@commitlint/config-conventional": "19.8.1",
41
+ "@eslint/js": "9.35.0",
42
+ "@types/eslint": "9.6.1",
43
+ "@types/node": "22.18.6",
44
+ "@types/semver": "7.7.1",
45
+ "@vitest/coverage-v8": "3.2.4",
46
+ "camelcase": "8.0.0",
47
+ "eslint": "9.35.0",
48
+ "eslint-config-prettier": "10.1.8",
49
+ "@vitest/eslint-plugin": "1.3.12",
50
+ "jsdom": "27.0.0",
51
+ "prettier": "3.6.2",
52
+ "puppeteer": "24.22.0",
53
+ "tsx": "4.20.5",
54
+ "typescript": "5.9.2",
55
+ "typescript-eslint": "8.44.0",
56
+ "vite": "7.1.6",
57
+ "vite-plugin-dts": "4.5.4",
58
+ "vitest": "3.2.4"
59
+ },
60
+ "dependencies": {
61
+ "semver": "^7.6.3",
62
+ "zod": "^4.0.0"
63
+ }
64
+ }