@kyun.si/codex-hongguo 0.0.21 → 0.0.23
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.
- package/.codex-plugin/plugin.json +1 -1
- package/README.en.md +35 -54
- package/README.md +35 -54
- package/dist/cli/main.mjs +15 -4
- package/dist/server/index.mjs +61 -53
- package/dist/setup/check.mjs +19 -9
- package/dist/ui/player.html +2 -2
- package/licenses/fflate-LICENSE +21 -0
- package/licenses/ffmpeg/COPYING.GPLv3 +674 -0
- package/licenses/ffmpeg/NOTICE.md +24 -0
- package/licenses/ffmpeg/ffmpeg-artifacts.json +46 -0
- package/package.json +5 -1
- package/skills/hongguo-setup/SKILL.md +1 -1
package/dist/ui/player.html
CHANGED
|
@@ -1979,7 +1979,7 @@ ${l}`:l:"",u=Function,d=`return (input) => {
|
|
|
1979
1979
|
${l}
|
|
1980
1980
|
}`,f;try{f=new u(...o,d)(...a)}catch(h){throw new $e(`this schema (generated code failed to evaluate: ${h.message})`)}return e?.debug&&(f.code=c),f.definite=i.definite,f}function pe(n,e){for(let[i,r]of n.constants)if(r===e)return i;let t=`c${n.constantCounter++}`;return n.constants.set(t,e),t}function Si(n,e){return n.definite=!1,pe(n,e)}function ce(n){return`v${n.varCounter++}`}function Z1(n,e){let t=n._zod.run({value:e,issues:[]},{});if(t&&typeof t.then=="function")return Ut;let i=t;return i.issues.length===0?i.value:Ut}function Mt(n,e,t,i,r=!0){let s=n.content.length,o=e.constants.size,a=e.constantCounter,l=e.varCounter;try{return tt(n,e,t,i,r)}catch(c){if(!(c instanceof $e)||!c.islandable)throw c;if(n.content.length=s,e.constants.size>o){let u=Array.from(e.constants.keys()).slice(o);for(let d of u)e.constants.delete(d)}return e.constantCounter=a,e.varCounter=l,q1(n,e,t,i)}}function q1(n,e,t,i){e.definite=!1;let r=pe(e,t),s=pe(e,Z1),o=ce(e);return n.write(`const ${o} = ${s}(${r}, ${i});`),n.write(`if (${o} === INVALID) return INVALID;`),o}function Y1(n,e,t,i){let r=t._zod.def.checks;if(!r||r.length===0)return i;let s=i;for(let o of r){let a=o._zod.def;if(a.when&&!W1.has(a.check))throw new $e('check with a custom "when" condition');switch(a.check){case"greater_than":J1(n,e,a,s);break;case"less_than":X1(n,e,a,s);break;case"multiple_of":Q1(n,e,a,s);break;case"number_format":y$(n,a,s);break;case"min_length":{let l=Or(a.minimum,"min_length"),c=ey(n,e,s,`${s}.length >= ${l} && ${s}.length < ${a.minimum*2}`);n.write(`if (${c} < ${l}) return INVALID;`);break}case"max_length":{let l=Or(a.maximum,"max_length"),c=ey(n,e,s,`${s}.length > ${l}`);n.write(`if (${c} > ${l}) return INVALID;`);break}case"length_equals":{let l=Or(a.length,"length_equals"),c=ey(n,e,s,`${s}.length >= ${l} && ${s}.length <= ${a.length*2}`);n.write(`if (${c} !== ${l}) return INVALID;`);break}case"min_size":n.write(`if (${s}.size < ${Or(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":n.write(`if (${s}.size > ${Or(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":n.write(`if (${s}.size !== ${Or(a.size,"size_equals")}) return INVALID;`);break;case"string_format":s=b$(n,e,a,s);break;case"custom":s=sN(n,e,o,s);break;case"bigint_format":eN(n,a,s);break;case"mime_type":tN(n,e,a,s);break;case"property":rN(n,e,a,s);break;case"properties":nN(n,e,a,s);break;case"overwrite":{let l=ce(e);iN(n,e,o,s,l),s=l;break}default:throw new $e(`check type ${a.check}`)}}return s}function ey(n,e,t,i){let r=pe(e,fi),s=ce(e);return n.write(`const ${s} = typeof ${t} === "string" && ${i} ? ${r}(${t}) : ${t}.length;`),s}function Or(n,e){if(typeof n!="number"||!Number.isFinite(n))throw new $e(`${e} bound of type ${typeof n}`);return`${n}`}function v$(n,e){if(typeof e=="bigint")return`${e}n`;if(typeof e=="number"){if(Number.isNaN(e))throw new $e("comparison check with NaN bound");return`${e}`}if(e instanceof Date){if(Number.isNaN(e.getTime()))throw new $e("comparison check with Invalid Date bound");return pe(n,e)}throw new $e(`comparison check bound of type ${typeof e}`)}function J1(n,e,t,i){let r=t.inclusive?"<":"<=";n.write(`if (${i} ${r} ${v$(e,t.value)}) return INVALID;`)}function X1(n,e,t,i){let r=t.inclusive?">":">=";n.write(`if (${i} ${r} ${v$(e,t.value)}) return INVALID;`)}function Q1(n,e,t,i){if(typeof t.value=="bigint"){if(t.value===BigInt(0))throw new $e("multiple_of check with a zero divisor");n.write(`if (${i} % ${t.value}n !== 0n) return INVALID;`)}else{let r=pe(e,Co);n.write(`if (${r}(${i}, ${Or(t.value,"multiple_of")}) !== 0) return INVALID;`)}}function y$(n,e,t){let i=e.format;switch(i){case"safeint":n.write(`if (!Number.isSafeInteger(${t})) return INVALID;`);break;case"int32":n.write(`if (!Number.isInteger(${t}) || ${t} < -2147483648 || ${t} > 2147483647) return INVALID;`);break;case"uint32":n.write(`if (!Number.isInteger(${t}) || ${t} < 0 || ${t} > 4294967295) return INVALID;`);break;case"float32":n.write(`if (!Number.isFinite(${t}) || ${t} < -3.4028234663852886e38 || ${t} > 3.4028234663852886e38) return INVALID;`);break;case"float64":n.write(`if (!Number.isFinite(${t})) return INVALID;`);break;default:throw new $e(`number format ${i}`)}}function eN(n,e,t){let i=e.format;if(i)switch(i){case"int64":n.write(`if (${t} < -9223372036854775808n || ${t} > 9223372036854775807n) return INVALID;`);break;case"uint64":n.write(`if (${t} < 0n || ${t} > 18446744073709551615n) return INVALID;`);break;default:throw new $e(`bigint format ${i}`)}}function tN(n,e,t,i){let r=t.mime;if(r&&r.length>0){let s=pe(e,new Set(r));n.write(`if (!${s}.has(${i}.type)) return INVALID;`)}}function nN(n,e,t,i){if(t.when)throw new $e('check with a custom "when" condition');n.write(`if (${i} == null) return INVALID;`);let r=t.shape;for(let s of Reflect.ownKeys(r)){let o=typeof s=="symbol"?pe(e,s):Vt(s),a=ce(e);n.write(`const ${a} = ${i}[${o}];`),Mt(n,e,r[s],a,!1)}}function rN(n,e,t,i){let r=`${i}[${JSON.stringify(t.property)}]`;tt(n,e,t.schema,r)}function iN(n,e,t,i,r){let s=t._zod.def.tx;if(!s)throw new $e("overwrite check without a transform function");if(xi(s))throw new _n("z.compile: async overwrite transforms are not supported");let o=pe(e,s);n.write(`const ${r} = ${o}(${i});`)}function ty(){throw new sn}function ry(n){this.issues.push(n)}function sN(n,e,t,i){let r=t._zod.def;if(r.fn){if(xi(r.fn))throw new _n("z.compile: async .refine() predicates are not supported");let s=Si(e,r.fn),o=pe(e,ty),a=ce(e);return n.write(`const ${a} = ${s}(${i});`),n.write(`if (${a} instanceof Promise) ${o}();`),n.write(`if (!${a}) return INVALID;`),i}if(t._zod.check){if(xi(t._zod.check))throw new _n("z.compile: async .superRefine() / check functions are not supported");let s=t._zod.check,a=Si(e,c=>{let u={value:c,issues:[],addIssue:ry};return s(u)instanceof Promise&&ty(),u.issues.length===0?u.value:Ut}),l=ce(e);return n.write(`const ${l} = ${a}(${i});`),n.write(`if (${l} === INVALID) return INVALID;`),l}throw new $e("custom check without a predicate or check function")}function b$(n,e,t,i,r=!0){let s=t.format;if(s==="base64"){let c=pe(e,Xo);return n.write(`if (!${c}(${i})) return INVALID;`),i}if(s==="base64url"){let c=pe(e,lu);return n.write(`if (!${c}(${i})) return INVALID;`),i}if(s==="jwt"){let c=pe(e,du),u=pe(e,t.alg??null);return n.write(`if (!${c}(${i}, ${u})) return INVALID;`),i}if(s==="ipv6"){let c=pe(e,Jo);return n.write(`if (!${c}(${i})) return INVALID;`),i}if(s==="cidrv6"){let c=pe(e,ou);return n.write(`if (!${c}(${i})) return INVALID;`),i}if(s==="credit_card"){let c=pe(e,cu);return n.write(`if (!${c}(${i})) return INVALID;`),i}if(s==="iban"){let c=pe(e,uu);return n.write(`if (!${c}(${i})) return INVALID;`),i}let o=t;if(s==="url"||s==="httpurl"||o.normalize||o.hostname!==void 0||o.protocol!==void 0){let c=pe(e,ru),u=pe(e,t),d=ce(e),f=ce(e);if(n.write(`const ${d} = ${i}.trim();`),n.write(`const ${f} = ${c}(${d}, ${u});`),n.write(`if (typeof ${f} === "number") return INVALID;`),o.hostname!==void 0){let p=pe(e,iu);n.write(`if (!${p}(${f}, ${u}.hostname)) return INVALID;`)}if(o.protocol!==void 0){let p=pe(e,su);n.write(`if (!${p}(${f}, ${u}.protocol)) return INVALID;`)}if(!r)return null;let h=ce(e),m=o.normalize?`${f}.href`:`${pe(e,Yo)}(${d})`;return n.write(`const ${h} = ${m};`),h}let a=t.fn;if(a){if(xi(a))throw new $e(`async string format ${s}`);let c=pe(e,a);return n.write(`if (!${c}(${i})) return INVALID;`),i}if(oN.has(s)&&t.pattern){let c=pe(e,t.pattern);return n.write(`${c}.lastIndex = 0;`),n.write(`if (!${c}.test(${i})) return INVALID;`),i}let l=t.format;switch(l){case"regex":throw new $e("regex format without a pattern");case"lowercase":n.write(`if (${i} !== ${i}.toLowerCase()) return INVALID;`);break;case"uppercase":n.write(`if (${i} !== ${i}.toUpperCase()) return INVALID;`);break;case"includes":n.write(`if (!${i}.includes(${Vt(t.includes)})) return INVALID;`);break;case"starts_with":{let c=t.prefix;n.write(`if (${i}.slice(0, ${c.length}) !== ${Vt(c)}) return INVALID;`);break}case"ends_with":{let c=t.suffix;n.write(`if (${i}.slice(-${c.length}) !== ${Vt(c)}) return INVALID;`);break}default:throw new $e(`string format ${l}`)}return i}function tt(n,e,t,i,r=!0){let s=t._zod.def,o=s.type;if(s.coerce)throw new $e(`coercion (z.coerce.${o}())`);let a=r||!!s.checks?.length,l;switch(o){case"string":l=aN(n,e,t,i,a);break;case"number":l=lN(n,t,i);break;case"boolean":l=cN(n,i);break;case"bigint":l=uN(n,t,i);break;case"symbol":l=dN(n,i);break;case"undefined":l=fN(n,i);break;case"null":l=hN(n,i);break;case"any":case"unknown":l=i;break;case"never":n.write("return INVALID;"),l=i;break;case"void":l=mN(n,i);break;case"nan":l=pN(n,i);break;case"date":l=gN(n,i);break;case"object":l=vN(n,e,t,i,a);break;case"optional":l=yN(n,e,t,i,a);break;case"nullable":l=xN(n,e,t,i,a);break;case"array":l=_N(n,e,t,i,a);break;case"literal":l=EN(n,e,t,i);break;case"enum":l=IN(n,e,t,i);break;case"readonly":{let c=m$(n,e,t,i),u=ce(e);n.write(`const ${u} = Object.freeze(${c});`),l=u;break}case"success":m$(n,e,t,i),l="true";break;case"default":case"prefault":l=TN(n,e,t,i);break;case"nonoptional":l=kN(n,e,t,i);break;case"tuple":l=$N(n,e,t,i);break;case"union":l=AN(n,e,t,i);break;case"intersection":l=RN(n,e,t,i);break;case"record":l=LN(n,e,t,i);break;case"map":l=CN(n,e,t,i);break;case"set":l=ON(n,e,t,i);break;case"file":l=NN(n,i);break;case"template_literal":l=MN(n,e,t,i);break;case"lazy":l=UN(n,e,t,i);break;case"pipe":l=FN(n,e,t,i);break;case"custom":l=zN(n,e,t,i);break;case"transform":l=VN(n,e,t,i);break;case"catch":l=jN(n,e,t,i);break;default:throw new $e(`schema type ${o}`)}return l===null?null:Y1(n,e,t,l)}function aN(n,e,t,i,r=!0){n.write(`if (typeof ${i} !== "string") return INVALID;`);let s=t._zod.def;return s.format===void 0?i:b$(n,e,s,i,r)}function lN(n,e,t){n.write(`if (typeof ${t} !== "number" || !Number.isFinite(${t})) return INVALID;`);let i=e._zod.def;return i.check==="number_format"&&i.format&&y$(n,{format:i.format},t),t}function cN(n,e){return n.write(`if (typeof ${e} !== "boolean") return INVALID;`),e}function uN(n,e,t){n.write(`if (typeof ${t} !== "bigint") return INVALID;`);let i=e._zod.def;if(i.format)switch(i.format){case"int64":n.write(`if (${t} < -9223372036854775808n || ${t} > 9223372036854775807n) return INVALID;`);break;case"uint64":n.write(`if (${t} < 0n || ${t} > 18446744073709551615n) return INVALID;`);break}return t}function dN(n,e){return n.write(`if (typeof ${e} !== "symbol") return INVALID;`),e}function fN(n,e){return n.write(`if (${e} !== undefined) return INVALID;`),e}function hN(n,e){return n.write(`if (${e} !== null) return INVALID;`),e}function mN(n,e){return n.write(`if (${e} !== undefined) return INVALID;`),e}function pN(n,e){return n.write(`if (typeof ${e} !== "number" || !Number.isNaN(${e})) return INVALID;`),e}function gN(n,e){return n.write(`if (!(${e} instanceof Date) || Number.isNaN(${e}.getTime())) return INVALID;`),e}function vN(n,e,t,i,r=!0){let s=t._zod.def;n.write(`if (typeof ${i} !== "object" || ${i} === null || Array.isArray(${i})) return INVALID;`);let o=s.shape,a=Object.keys(o),l=Object.getOwnPropertySymbols(o),c=l.length?[...a,...l]:a,u=b=>typeof b=="symbol"?pe(e,b):Vt(b),d=b=>typeof b=="symbol"?`[${u(b)}]`:Vt(b),f=o;if(a.includes("__proto__"))throw new $e('object shape key "__proto__"');let h=new Map;for(let b of c){let S=f[b],x=u(b),_=ce(e);if(n.write(`const ${_} = ${i}[${x}];`),S._zod.optin!==void 0){let I=ce(e);n.write(`let ${I} = (() => {`),n.indented(T=>{let $=Mt(T,e,S,_);T.write(`return ${$};`)}),n.write("})();"),S._zod.optout==="optional"?(n.write(`if (${I} === INVALID) {`),n.indented(T=>{T.write(`if (${x} in ${i}) return INVALID;`),T.write(`${I} = undefined;`)}),n.write("}")):n.write(`if (${I} === INVALID) return INVALID;`),h.set(b,I)}else{SN(S)&&n.write(`if (!(${x} in ${i})) return INVALID;`);let I=Mt(n,e,S,_,r);I!==null&&h.set(b,I)}}let m=s.catchall,p="none";if(m){let b=m._zod.def.type;if(b==="never"){let S=a.map(x=>`k !== ${Vt(x)}`).join(" && ")||"true";n.write(`for (const k in ${i}) {`),n.indented(x=>{x.write(`if (${S}) return INVALID;`)}),n.write("}")}else(b==="unknown"||b==="any")&&!m._zod.def.checks?.length?p="passthrough":p="schema"}let g=ce(e),y=c.some(b=>h$(f[b])||ny(f[b]));if(!r){if(p==="schema"){let b=a.length>0?pe(e,new Set(a)):null;n.write(`for (const k in ${i}) {`),n.indented(S=>{S.write('if (k === "__proto__") continue;'),b&&S.write(`if (${b}.has(k)) continue;`);let x=ce(e);S.write(`const ${x} = ${i}[k];`),Mt(S,e,m,x,!1)}),n.write("}")}return null}if(y){n.write(`const ${g} = {};`);for(let b of c){let S=u(b),x=h.get(b);ny(f[b])?n.write(`if (${S} in ${i}) ${g}[${S}] = ${x};`):h$(f[b])?n.write(`if (${x} !== undefined || ${S} in ${i}) ${g}[${S}] = ${x};`):n.write(`${g}[${S}] = ${x};`)}}else{let b=c.map(S=>`${d(S)}: ${h.get(S)}`).join(", ");n.write(`const ${g} = { ${b} };`)}if(p!=="none"){let b=a.length>0?pe(e,new Set(a)):null;n.write(`for (const k in ${i}) {`),n.indented(S=>{if(S.write('if (k === "__proto__") continue;'),b&&S.write(`if (${b}.has(k)) continue;`),p==="passthrough")S.write(`${g}[k] = ${i}[k];`);else{let x=ce(e);S.write(`const ${x} = ${i}[k];`);let _=Mt(S,e,m,x);S.write(`${g}[k] = ${_};`)}}),n.write("}")}return g}function yN(n,e,t,i,r=!0){let s=t._zod.def;if(bN(t))return tt(n,e,s.innerType,i,r);if(s.innerType._zod.optin==="defaulted"){let a=ce(e),l=ce(e);return n.write(`let ${a};`),n.write(`if (${i} === undefined) {`),n.indented(c=>{c.write(`const ${l} = (() => {`),c.indented(u=>{let d=tt(u,e,s.innerType,i);u.write(`return ${d};`)}),c.write("})();"),c.write(`if (${l} !== INVALID) ${a} = ${l};`)}),n.write("} else {"),n.indented(c=>{let u=tt(c,e,s.innerType,i);c.write(`${a} = ${u};`)}),n.write("}"),a}let o=r?ce(e):null;return o&&n.write(`let ${o};`),n.write(`if (${i} !== undefined) {`),n.indented(a=>{let l=tt(a,e,s.innerType,i,r);o&&l!==null&&a.write(`${o} = ${l};`)}),n.write("}"),o}function bN(n){return n._zod.traits?.has("$ZodExactOptional")===!0}function SN(n){return n._zod.optin===void 0&&bi(n)}function bi(n){if(n._zod.def.coerce)return!0;let e=n._zod.def;switch(e.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return e.innerType?bi(e.innerType):!1;case"literal":return!!e.values?.includes(void 0);case"enum":return!!n._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return e.innerType?bi(e.innerType):!0;case"catch":return!0;case"union":return e.options?e.options.some(bi):!0;case"intersection":return!e.left||!e.right?!0:bi(e.left)&&bi(e.right);case"pipe":return e.in?bi(e.in):!0;default:return!0}}function ny(n){return n._zod.optin==="optional"&&n._zod.optout==="optional"}function h$(n){return(n._zod.optin!=="defaulted"||n._zod.optout==="optional")&&Ps(n)}function Ps(n){let e=n._zod.def;switch(e.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!e.values?.includes(void 0);case"enum":return!!n._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return e.innerType?Ps(e.innerType):!0;case"union":return e.options?e.options.some(Ps):!0;case"intersection":return!e.left||!e.right||Ps(e.left)||Ps(e.right);case"pipe":return e.out?Ps(e.out):!0;default:return!0}}function xN(n,e,t,i,r=!0){let s=t._zod.def,o=r?ce(e):null;return o&&n.write(`let ${o} = null;`),n.write(`if (${i} !== null) {`),n.indented(a=>{let l=tt(a,e,s.innerType,i,r);o&&l!==null&&a.write(`${o} = ${l};`)}),n.write("}"),o}function iy(n,e,t){for(let[i,r]of ps(e._zod.def.checks))n.write(`if (${t} > ${Or(i,r._zod.def.check)}) return INVALID;`)}function _N(n,e,t,i,r=!0){let s=t._zod.def;n.write(`if (!Array.isArray(${i})) return INVALID;`),iy(n,t,`${i}.length`);let o=r?ce(e):null,a=ce(e),l=ce(e);return o&&n.write(`const ${o} = new Array(${i}.length);`),n.write(`for (let ${a} = 0; ${a} < ${i}.length; ${a}++) {`),n.indented(c=>{c.write(`const ${l} = ${i}[${a}];`);let u=Mt(c,e,s.element,l,r);o&&u!==null&&c.write(`${o}[${a}] = ${u};`)}),n.write("}"),o}function EN(n,e,t,i){let s=t._zod.def.values;if(s.length!==1){let a=pe(e,new Set(s));return n.write(`if (!${a}.has(${i})) return INVALID;`),i}let o=s[0];if(typeof o=="number"&&Number.isNaN(o)){let a=pe(e,new Set(s));return n.write(`if (!${a}.has(${i})) return INVALID;`),i}if(typeof o=="string")n.write(`if (${i} !== ${Vt(o)}) return INVALID;`);else if(typeof o=="number"||typeof o=="boolean")n.write(`if (${i} !== ${o}) return INVALID;`);else if(o===null)n.write(`if (${i} !== null) return INVALID;`);else if(o===void 0)n.write(`if (${i} !== undefined) return INVALID;`);else if(typeof o=="bigint")n.write(`if (${i} !== ${o}n) return INVALID;`);else throw new $e(`literal type ${typeof o}`);return i}function IN(n,e,t,i){let r=t._zod.values;if(!r)throw new $e("enum schema without enumerated values");let s=pe(e,r);return n.write(`if (!${s}.has(${i})) return INVALID;`),i}function m$(n,e,t,i){let r=t._zod.def;return tt(n,e,r.innerType,i)}function TN(n,e,t,i){let r=t._zod.def,o=Object.getOwnPropertyDescriptor(t._zod.def,"defaultValue")?()=>t._zod.def.defaultValue:void 0;if(t._zod.def.type==="prefault"){if(!o)return tt(n,e,r.innerType,i);let l=pe(e,o),c=ce(e);return n.write(`let ${c} = ${i};`),n.write(`if (${i} === undefined) ${c} = ${l}();`),tt(n,e,r.innerType,c)}let a=ce(e);if(o){let l=pe(e,o),c=pe(e,Oo);n.write(`let ${a};`),n.write(`if (${i} === undefined) {`),n.indented(u=>{u.write(`${a} = ${c}(${l}());`)}),n.write("} else {"),n.indented(u=>{let d=tt(u,e,r.innerType,i);u.write(`${a} = ${d} === undefined ? ${c}(${l}()) : ${d};`)}),n.write("}")}else n.write(`let ${a};`),n.write(`if (${i} !== undefined) {`),n.indented(l=>{let c=tt(l,e,r.innerType,i);l.write(`${a} = ${c};`)}),n.write("}");return a}function kN(n,e,t,i){let r=t._zod.def,s=tt(n,e,r.innerType,i),o=ce(e);return n.write(`const ${o} = ${s};`),n.write(`if (${o} === undefined) return INVALID;`),o}function $N(n,e,t,i){let r=t._zod.def,s=r.items,o=r.rest;n.write(`if (!Array.isArray(${i})) return INVALID;`);let a=p$(s,"optin"),l=p$(s,"optout");o?n.write(`if (${i}.length < ${a}) return INVALID;`):n.write(`if (${i}.length < ${a} || ${i}.length > ${s.length}) return INVALID;`);let c=ce(e);n.write(`const ${c} = [];`);for(let u=0;u<s.length;u++){let d=s[u];if(u>=l)n.write(`if (${c}.length === ${u}) {`),n.indented(f=>{f.write(`if (${u} < ${i}.length) {`),f.indented(h=>{let m=ce(e);h.write(`const ${m} = ${i}[${u}];`);let p=Mt(h,e,d,m);h.write(`${c}[${u}] = ${p};`)}),f.write("} else {"),f.indented(h=>{if(ny(d)){h.write(`${c}.length = ${u};`);return}let m=ce(e),p=ce(e);h.write(`const ${m} = undefined;`),h.write(`const ${p} = (() => {`),h.indented(g=>{let y=Mt(g,e,d,m);g.write(`return ${y};`)}),h.write("})();"),h.write(`if (${p} === INVALID || ${p} === undefined) ${c}.length = ${u};`),h.write(`else ${c}[${u}] = ${p};`)}),f.write("}")}),n.write("}");else{let f=ce(e);n.write(`const ${f} = ${i}[${u}];`);let h=Mt(n,e,d,f);n.write(`${c}[${u}] = ${h};`)}}if(o){let u=ce(e),d=ce(e);n.write(`for (let ${u} = ${s.length}; ${u} < ${i}.length; ${u}++) {`),n.indented(f=>{f.write(`const ${d} = ${i}[${u}];`);let h=Mt(f,e,o,d);f.write(`${c}[${u}] = ${h};`)}),n.write("}")}return c}function p$(n,e){for(let t=n.length-1;t>=0;t--)if(!(e==="optin"?n[t]._zod.optin!==void 0:n[t]._zod.optout==="optional"))return t+1;return 0}function AN(n,e,t,i){let r=t._zod.def,s=r.options;if(r.discriminator)return wN(n,e,r,i);if(r.inclusive===!1)throw new $e("exclusive unions (z.xor)");if(s.length===0)return n.write("return INVALID;"),i;if(s.length===1)return tt(n,e,s[0],i);if(s.every(l=>l._zod.def.type==="literal"&&!l._zod.def.checks?.length)){let l=new Set(s.flatMap(u=>u._zod.def.values)),c=pe(e,l);return n.write(`if (!${c}.has(${i})) return INVALID;`),i}let a=ce(e);n.write(`let ${a};`);for(let l=0;l<s.length;l++){let c=s[l];l===0?n.write(`${a} = (() => {`):n.write(`if (${a} === INVALID) ${a} = (() => {`),n.indented(u=>{let d=tt(u,e,c,i);u.write(`return ${d};`)}),n.write("})();")}return n.write(`if (${a} === INVALID) return INVALID;`),a}function wN(n,e,t,i){if(t.unionFallback)throw new $e("discriminated union with unionFallback");if(t.options.length===0)return n.write("return INVALID;"),i;let r=ce(e),s=ce(e);n.write(`const ${r} = ${i}?.[${Vt(t.discriminator)}];`),n.write(`let ${s};`);let o=!0,a=new Set;for(let l of t.options){let c=l._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new $e("discriminated union option without static discriminator values");for(let f of c){if(a.has(f))throw new $e(`duplicate discriminator value ${String(f)}`);a.add(f)}let u=Array.from(c,f=>PN(e,r,f)),d=o?"if":"else if";n.write(`${d} (${u.join(" || ")}) {`),n.indented(f=>{let h=tt(f,e,l,i);f.write(`${s} = ${h};`)}),n.write("}"),o=!1}return n.write("else { return INVALID; }"),s}function PN(n,e,t){if(typeof t=="string")return`${e} === ${Vt(t)}`;if(typeof t=="number")return Number.isNaN(t)?`Number.isNaN(${e})`:`${e} === ${t}`;if(typeof t=="boolean")return`${e} === ${t}`;if(t===null)return`${e} === null`;if(t===void 0)return`${e} === undefined`;if(typeof t=="bigint")return`${e} === ${t}n`;if(typeof t=="symbol"){let i=pe(n,t);return`${e} === ${i}`}throw new $e(`literal discriminator value ${String(t)}`)}function RN(n,e,t,i){let r=t._zod.def;e.definite=!1;let s=Mt(n,e,r.left,i),o=Mt(n,e,r.right,i),a=pe(e,Is),l=ce(e);return n.write(`const ${l} = ${a}(${s}, ${o});`),n.write(`if (!${l}.valid) return INVALID;`),`${l}.data`}function LN(n,e,t,i){let r=t._zod.def,s=pe(e,Sn);n.write(`if (!${s}(${i})) return INVALID;`);let o=ce(e),a=ce(e),l=ce(e);n.write(`const ${o} = {};`);let c=r,u=c.partial?void 0:r.keyType._zod.values;if(u){let h=[];for(let p of u){if(!(typeof p=="string"||typeof p=="number"||typeof p=="symbol"))throw new $e(`record key value ${String(p)}`);let g=typeof p=="number"?p.toString():p;if(g==="__proto__")throw new $e('record key "__proto__"');h.push(g);let y=pe(e,p),b=tt(n,e,r.keyType,y),S=ce(e);n.write(`const ${S} = ${i}[${DN(e,g)}];`);let x=Mt(n,e,r.valueType,S);n.write(`${o}[${b}] = ${x};`)}let m=pe(e,new Set(h));return n.write(`for (const ${a} in ${i}) {`),n.indented(p=>{p.write(`if (${m}.has(${a})) continue;`),c.mode==="loose"?p.write(`if (${a} !== "__proto__") ${o}[${a}] = ${i}[${a}];`):p.write("return INVALID;")}),n.write("}"),o}let d=r.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){let h=r.mode==="loose",m=Ru(r.keyType);m.definite===!1&&(e.definite=!1);let p=pe(e,m),g=pe(e,lr),y=ce(e);return g$(n,e,i,a,b=>{b.write(`let ${y} = ${p}(${a});`),b.write(`if (${y} === INVALID && typeof ${a} === "string" && ${g}.test(${a})) ${y} = ${p}(Number(${a}));`),h?b.write(`if (${y} === INVALID) { ${o}[${a}] = ${i}[${a}]; continue; }`):b.write(`if (${y} === INVALID) return INVALID;`),b.write(`if (${y} === "__proto__") continue;`);let S=ce(e);b.write(`const ${S} = ${i}[${a}];`);let x=Mt(b,e,r.valueType,S);b.write(`${o}[${y}] = ${x};`)}),o}return g$(n,e,i,a,h=>{h.write(`const ${l} = ${i}[${a}];`);let m=Mt(h,e,r.valueType,l);h.write(`${o}[${a}] = ${m};`)},"return INVALID;"),o}function g$(n,e,t,i,r,s){let o=pe(e,Object.prototype.propertyIsEnumerable),a=ce(e),l=ce(e),c=ce(e);n.write(`const ${a} = Object.getOwnPropertySymbols(${t});`),n.write(`const ${l} = Object.getOwnPropertyNames(${t});`),n.write(`for (let ${c} = 0; ${c} < ${l}.length; ${c}++) {`),n.indented(u=>{u.write(`const ${i} = ${l}[${c}];`),u.write(`if (${i} === "__proto__" || !${o}.call(${t}, ${i})) continue;`),r(u)}),n.write("}"),n.write(`for (let ${c} = 0; ${c} < ${a}.length; ${c}++) {`),n.indented(u=>{u.write(`const ${i} = ${a}[${c}];`),u.write(`if (!${o}.call(${t}, ${i})) continue;`),s?u.write(s):r(u)}),n.write("}")}function DN(n,e){return typeof e=="string"?Vt(e):pe(n,e)}function CN(n,e,t,i){let r=t._zod.def;n.write(`if (!(${i} instanceof Map)) return INVALID;`),iy(n,t,`${i}.size`);let s=ce(e),o=ce(e),a=ce(e);return n.write(`const ${s} = new Map();`),n.write(`for (const [${o}, ${a}] of ${i}) {`),n.indented(l=>{let c=tt(l,e,r.keyType,o),u=tt(l,e,r.valueType,a);l.write(`${s}.set(${c}, ${u});`)}),n.write("}"),s}function ON(n,e,t,i){let r=t._zod.def;n.write(`if (!(${i} instanceof Set)) return INVALID;`),iy(n,t,`${i}.size`);let s=ce(e),o=ce(e);return n.write(`const ${s} = new Set();`),n.write(`for (const ${o} of ${i}) {`),n.indented(a=>{let l=tt(a,e,r.valueType,o);a.write(`${s}.add(${l});`)}),n.write("}"),s}function NN(n,e){return n.write(`if (!(${e} instanceof File)) return INVALID;`),e}function MN(n,e,t,i){n.write(`if (typeof ${i} !== "string") return INVALID;`);let r=t._zod.pattern;if(r){let s=pe(e,r);n.write(`${s}.lastIndex = 0;`),n.write(`if (!${s}.test(${i})) return INVALID;`)}return i}function UN(n,e,t,i){let r=t._zod.def,s=Si(e,r.getter),o=pe(e,{parser:null});n.write(`if (!${o}.parser) {`),n.indented(l=>{l.write(`const inner = ${s}();`),l.write(`${o}.parser = function(input) {`),l.indented(c=>{c.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),c.write("return result.issues.length === 0 ? result.value : INVALID;")}),l.write("};")}),n.write("}");let a=ce(e);return n.write(`const ${a} = ${o}.parser(${i});`),n.write(`if (${a} === INVALID) return INVALID;`),a}function FN(n,e,t,i){let r=t._zod.def,s=tt(n,e,r.in,i);if(r.transform){if(xi(r.transform))throw new _n("z.compile: async transforms in pipes are not supported");let o=r.transform,l=Si(e,u=>{let d={value:u,issues:[],addIssue:ry},f=o(u,d);return f instanceof Promise?Ut:d.issues.length===0?f:Ut}),c=ce(e);return n.write(`const ${c} = ${l}(${s});`),n.write(`if (${c} === INVALID) return INVALID;`),tt(n,e,r.out,c)}else return tt(n,e,r.out,s)}function xi(n){return typeof n=="function"&&(n.constructor.name==="AsyncFunction"||n[Symbol.toStringTag]==="AsyncFunction")}function zN(n,e,t,i){let r=t._zod.def;if(r.fn){if(xi(r.fn))throw new _n("z.compile: async custom predicates are not supported");let s=Si(e,r.fn),o=pe(e,ty),a=ce(e);n.write(`const ${a} = ${s}(${i});`),n.write(`if (${a} instanceof Promise) ${o}();`),n.write(`if (!${a}) return INVALID;`)}else throw new $e("custom schema without a predicate function");return i}function BN(n,e,t){let i=n._zod.run({value:t,issues:[]},{});if(i&&typeof i.then=="function")return Ut;let r=i;return r.issues.length===0?r.value:e()}function jN(n,e,t,i){let r=t._zod.def;if(!r.catchValue[wc])throw new $e("catch with a callback (only a constant catch value compiles)",!1);let s=ce(e);n.write(`let ${s} = (() => {`),n.indented(c=>{let u=Mt(c,e,r.innerType,i);c.write(`return ${u};`)}),n.write("})();");let o=pe(e,r.innerType),a=Si(e,r.catchValue),l=pe(e,BN);return n.write(`if (${s} === INVALID) {`),n.indented(c=>{c.write(`${s} = ${l}(${o}, ${a}, ${i});`),c.write(`if (${s} === INVALID) return INVALID;`)}),n.write("}"),s}function VN(n,e,t,i){let r=t._zod.def;if(r.transform){if(xi(r.transform))throw new _n("z.compile: async transforms are not supported");let s=r.transform,a=Si(e,c=>{let u={value:c,issues:[],addIssue:ry},d=s(c,u);return d instanceof Promise?Ut:u.issues.length===0?d:Ut}),l=ce(e);return n.write(`const ${l} = ${a}(${i});`),n.write(`if (${l} === INVALID) return INVALID;`),l}return i}var Ut,f$,_n,$e,W1,oN,S$=G(()=>{Dr();Jc();Wv();gi();Ts();J();Ut=Symbol.for("zod.compile.invalid"),f$=Symbol.for("zod.compile.fallback"),_n=class extends Error{constructor(e="z.compile does not support async refinements, transforms, or checks"){super(e),this.name="ZodCompileAsyncError"}},$e=class extends Error{constructor(e,t=!0){super(`z.compile does not support ${e}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=t}};W1=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);oN=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"])});function Lu(n){return n.checks&&(n.checks=[...n.checks]),n}function sy(n,e){return new n(Lu({type:"string",...H(e)}))}function oy(n,e){return new n(Lu({type:"string",coerce:!0,...H(e)}))}function Du(n,e){return new n({type:"string",format:"email",check:"string_format",abort:!1,...H(e)})}function Cu(n,e){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...H(e)})}function Ou(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...H(e)})}function Nu(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...H(e)})}function Mu(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...H(e)})}function Uu(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...H(e)})}function ua(n,e){return new n({type:"string",format:"url",check:"string_format",abort:!1,...H(e)})}function Fu(n,e){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...H(e)})}function zu(n,e){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...H(e)})}function Bu(n,e){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...H(e)})}function ju(n,e){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...H(e)})}function Vu(n,e){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...H(e)})}function Gu(n,e){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...H(e)})}function Ku(n,e){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...H(e)})}function Hu(n,e){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...H(e)})}function Zu(n,e){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...H(e)})}function ay(n,e){return new n({type:"string",format:"mac",check:"string_format",abort:!1,...H(e)})}function qu(n,e){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...H(e)})}function Wu(n,e){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...H(e)})}function Yu(n,e){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...H(e)})}function Ju(n,e){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...H(e)})}function Xu(n,e){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...H(e)})}function ly(n,e){return new n({type:"string",format:"credit_card",check:"string_format",abort:!1,...H(e)})}function cy(n,e){return new n({type:"string",format:"iban",check:"string_format",abort:!1,...H(e)})}function Qu(n,e){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...H(e)})}function da(n,e){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...H(e)})}function fa(n,e){return new n({type:"string",format:"date",check:"string_format",...H(e)})}function ha(n,e){return new n({type:"string",format:"time",check:"string_format",precision:null,...H(e)})}function ma(n,e){return new n({type:"string",format:"duration",check:"string_format",...H(e)})}function uy(n,e){return new n(Lu({type:"number",checks:[],...H(e)}))}function dy(n,e){return new n(Lu({type:"number",coerce:!0,checks:[],...H(e)}))}function fy(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...H(e)})}function hy(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"float32",...H(e)})}function my(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"float64",...H(e)})}function py(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"int32",...H(e)})}function gy(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"uint32",...H(e)})}function vy(n,e){return new n({type:"boolean",...H(e)})}function yy(n,e){return new n({type:"boolean",coerce:!0,...H(e)})}function by(n,e){return new n({type:"bigint",...H(e)})}function Sy(n,e){return new n({type:"bigint",coerce:!0,...H(e)})}function xy(n,e){return new n({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...H(e)})}function _y(n,e){return new n({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...H(e)})}function Ey(n,e){return new n({type:"symbol",...H(e)})}function Iy(n,e){return new n({type:"undefined",...H(e)})}function Ty(n,e){return new n({type:"null",...H(e)})}function ky(n){return new n({type:"any"})}function $y(n){return new n({type:"unknown"})}function Ay(n,e){return new n({type:"never",...H(e)})}function wy(n,e){return new n({type:"void",...H(e)})}function Py(n,e){return new n({type:"date",...H(e)})}function Ry(n,e){return new n({type:"date",coerce:!0,...H(e)})}function Ly(n,e){return new n({type:"nan",...H(e)})}function Nn(n,e){return new qc({check:"less_than",...H(e),value:n,inclusive:!1})}function an(n,e){return new qc({check:"less_than",...H(e),value:n,inclusive:!0})}function Mn(n,e){return new Wc({check:"greater_than",...H(e),value:n,inclusive:!1})}function ln(n,e){return new Wc({check:"greater_than",...H(e),value:n,inclusive:!0})}function pa(n){return Mn(0,n)}function ga(n){return Nn(0,n)}function va(n){return an(0,n)}function ya(n){return ln(0,n)}function cr(n,e){return new hg({check:"multiple_of",...H(e),value:n})}function ur(n,e){return new gg({check:"max_size",...H(e),maximum:n})}function Un(n,e){return new vg({check:"min_size",...H(e),minimum:n})}function Nr(n,e){return new yg({check:"size_equals",...H(e),size:n})}function Mr(n,e){return new bg({check:"max_length",...H(e),maximum:n})}function Wn(n,e){return new Sg({check:"min_length",...H(e),minimum:n})}function Ur(n,e){return new xg({check:"length_equals",...H(e),length:n})}function _i(n,e){return new _g({check:"string_format",format:"regex",...H(e),pattern:n})}function Ei(n){return new Eg({check:"string_format",format:"lowercase",...H(n)})}function Ii(n){return new Ig({check:"string_format",format:"uppercase",...H(n)})}function Ti(n,e){return new Tg({check:"string_format",format:"includes",...H(e),includes:n})}function ki(n,e){return new kg({check:"string_format",format:"starts_with",...H(e),prefix:n})}function $i(n,e){return new $g({check:"string_format",format:"ends_with",...H(e),suffix:n})}function ba(n,e,t){return new Ag({check:"property",property:n,schema:e,...H(t)})}function Ai(n,e){return new wg({check:"properties",shape:n,...H(e)})}function wi(n,e){return new Pg({check:"mime_type",mime:n,...H(e)})}function En(n){return new Rg({check:"overwrite",tx:n})}function Pi(n){return En(e=>e.normalize(n))}function Ri(){return En(n=>n.trim())}function Li(){return En(n=>n.toLowerCase())}function Di(){return En(n=>n.toUpperCase())}function Ci(){return En(n=>gp(n))}function Dy(n,e,t){return new n({type:"array",element:e,...H(t)})}function GN(n,e,t){return new n({type:"union",options:e,...H(t)})}function KN(n,e,t){return new n({type:"union",options:e,inclusive:!1,...H(t)})}function HN(n,e,t,i){return new n({type:"union",options:t,discriminator:e,...H(i)})}function ZN(n,e,t){return new n({type:"intersection",left:e,right:t})}function qN(n,e,t,i){let r=t instanceof ye,s=r?i:t,o=r?t:null;return new n({type:"tuple",items:e,rest:o,...H(s)})}function WN(n,e,t,i){return new n({type:"record",keyType:e,valueType:t,...H(i)})}function YN(n,e,t,i){return new n({type:"map",keyType:e,valueType:t,...H(i)})}function JN(n,e,t){return new n({type:"set",valueType:e,...H(t)})}function XN(n,e,t){let i=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new n({type:"enum",entries:i,...H(t)})}function QN(n,e,t){return new n({type:"enum",entries:e,...H(t)})}function eM(n,e,t){return new n({type:"literal",values:Array.isArray(e)?e:[e],...H(t)})}function Cy(n,e){return new n({type:"file",...H(e)})}function tM(n,e){return new n({type:"transform",transform:e})}function nM(n,e){return new n({type:"optional",innerType:e})}function rM(n,e){return new n({type:"nullable",innerType:e})}function iM(n,e,t){return new n({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Oo(t)}})}function sM(n,e,t){return new n({type:"nonoptional",innerType:e,...H(t)})}function oM(n,e){return new n({type:"success",innerType:e})}function aM(n,e,t){return new n({type:"catch",innerType:e,catchValue:typeof t=="function"?t:_p(t)})}function lM(n,e,t){return new n({type:"pipe",in:e,out:t})}function cM(n,e){return new n({type:"readonly",innerType:e})}function uM(n,e,t){return new n({type:"template_literal",parts:e,...H(t)})}function dM(n,e){return new n({type:"lazy",getter:e})}function fM(n,e){return new n({type:"promise",innerType:e})}function Oy(n,e,t){let i=H(t);return i.abort??(i.abort=!0),new n({type:"custom",check:"custom",fn:e,...i})}function Ny(n,e,t){return new n({type:"custom",check:"custom",fn:e,...H(t)})}function My(n,e){let t=x$(i=>(i.addIssue=r=>{if(typeof r=="string")i.issues.push(gs(r,i.value,t._zod.def));else{let s=r;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=i.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),i.issues.push(gs(s))}},n(i.value,i)),e);return t}function x$(n,e){let t=new Ze({check:"custom",...H(e)});return t._zod.check=n,t}function Uy(n){let e=new Ze({check:"describe"});return e._zod.onattach=[t=>{let i=Et.get(t)??{};Et.add(t,{...i,description:n})}],e._zod.check=()=>{},e}function Fy(n){let e=new Ze({check:"meta"});return e._zod.onattach=[t=>{let i=Et.get(t)??{};Et.add(t,{...i,...n})}],e._zod.check=()=>{},e}function zy(n,e){let t=H(e),i=t.truthy??["true","1","yes","on","y","enabled"],r=t.falsy??["false","0","no","off","n","disabled"];t.case!=="sensitive"&&(i=i.map(h=>typeof h=="string"?h.toLowerCase():h),r=r.map(h=>typeof h=="string"?h.toLowerCase():h));let s=new Set(i),o=new Set(r),a=n.Codec??na,l=n.Boolean??ea,c=n.String??yi,u=new c({type:"string",error:t.error}),d=new l({type:"boolean",error:t.error}),f=new a({type:"pipe",in:u,out:d,transform:((h,m)=>{let p=h;return t.case!=="sensitive"&&(p=p.toLowerCase()),s.has(p)?!0:o.has(p)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...s,...o],input:m.value,inst:f,continue:!1}),{})}),reverseTransform:((h,m)=>h===!0?i[0]||"true":r[0]||"false"),error:t.error});return f._zod.bag.truthy=i,f._zod.bag.falsy=r,f._zod.bag.case=t.case??"insensitive",f}function Oi(n,e,t,i={}){let r=H(i),s={check:"string_format",type:"string",format:e,fn:typeof t=="function"?t:a=>t.test(a),...r};return t instanceof RegExp&&(s.pattern=t),new n(s)}var ed,_$=G(()=>{Yc();la();Ts();J();ed={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6}});function Sa(n,...e){for(let t of e)for(let i of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,i)&&Rt(n,i,t[i]);return n}function Fr(n){let e=n?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:n.processors??{},metadataRegistry:n?.metadata??Et,target:e,unrepresentable:n?.unrepresentable??"throw",override:n?.override??(()=>{}),io:n?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:n?.cycles??"ref",reused:n?.reused??"inline",intersections:[],deferred:[],external:n?.external??void 0}}function pt(n,e,t,i,r){let s=typeof e.unrepresentable=="function"?e.unrepresentable({zodSchema:n,path:i.path,message:r}):e.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(r);return Object.assign(t,s),!0}function Be(n,e,t={path:[],schemaPath:[]}){var i;let r=n._zod.def,s=e.seen.get(n);if(s)return s.count++,t.schemaPath.includes(n)&&(s.cycle=t.path),s.schema;let o={schema:{},count:1,cycle:void 0,path:t.path};e.seen.set(n,o),e.sharedDefsExtractedFor=void 0,e.sharedEmitDoneFor=void 0;let a=n._zod.toJSONSchema?.();if(a)o.schema=a;else{let u={...t,schemaPath:[...t.schemaPath,n],path:t.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(e,o.schema,u);else{let f=o.schema,h=e.processors[r.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);h(n,e,f,u)}let d=n._zod.parent;d&&(o.ref||(o.ref=d),Be(d,e,u),e.seen.get(d).isParent=!0)}let l=e.metadataRegistry.get(n);return l&&Sa(o.schema,l),e.io==="input"&&Kt(n)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&"_prefault"in o.schema&&((i=o.schema).default??(i.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(n).schema}function E$(n){return n.replace(/~/g,"~0").replace(/\//g,"~1")}function zr(n,e){let t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");if(n.external&&n.sharedDefsExtractedFor===n.external)return;let i=new Map;for(let o of n.seen.entries()){let a=n.metadataRegistry.get(o[0])?.id;if(a){let l=i.get(a);if(l&&l!==o[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,o[0])}}let r=o=>{let a=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let d=n.external.registry.get(o[0])?.id,f=n.external.uri??(m=>m);if(d)return{ref:f(d)};let h=o[1].defId??o[1].schema.id??`schema${n.counter++}`;return o[1].defId=h,{defId:h,ref:`${f("__shared")}#/${a}/${E$(h)}`}}let l="#",c=`${l}/${a}/`;if(o[1]===t&&!o[1].schema.id)return{ref:l};let u=o[1].schema.id??`__schema${n.counter++}`;return{defId:u,ref:c+E$(u)}},s=o=>{if(o[1].schema.$ref)return;let a=o[1],{ref:l,defId:c}=r(o);a.def={...a.schema},c&&(a.defId=c);let u=a.schema;for(let d in u)delete u[d];u.$ref=l};if(n.cycles==="throw")for(let o of n.seen.entries()){let a=o[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
1981
1981
|
|
|
1982
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of n.seen.entries()){let a=o[1];if(e===o[0]){s(o);continue}if(n.external){let c=n.external.registry.get(o[0])?.id;if(e!==o[0]&&c){s(o);continue}}if(n.metadataRegistry.get(o[0])?.id){s(o);continue}if(a.cycle){s(o);continue}a.count>1&&n.reused==="ref"&&s(o)}n.external&&(n.sharedDefsExtractedFor=n.external)}function k$(n){let e=n.anyOf;if(!Array.isArray(e)||e.length===0||n.type!==void 0)return;let t=[];for(let i of e){if(!i||typeof i!="object")return;k$(i);let r=Object.keys(i);if(r.length!==1||r[0]!=="type")return;let s=i.type;for(let o of Array.isArray(s)?s:[s]){if(typeof o!="string")return;t.includes(o)||t.push(o)}}delete n.anyOf,n.type=t.length===1?t[0]:t}function T$(n){let e=n.additionalProperties;return e===void 0||e===!1||typeof e!="object"||e===null?null:Object.keys(e).length?e:null}function By(n){let e=[];for(let s of n){if(typeof s!="object"||s.type!=="object")return null;for(let o in s)if(!$$.has(o))return null;e.push(s)}let t={},i=new Set;for(let s of e){for(let o in s.properties){if(Object.prototype.hasOwnProperty.call(t,o))continue;let a=[];for(let c of e){let u=c.properties?.[o]??T$(c);u!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(u))||a.push(u))}let l=a.length===1?a[0]:By(a)??{allOf:a};Rt(t,o,l)}for(let o of s.required??[])i.add(o)}let r={type:"object",properties:t};if(i.size&&(r.required=[...i]),e.every(s=>s.additionalProperties===!1))r.additionalProperties=!1;else{let s=[];for(let o of e){let a=T$(o);a&&!s.some(l=>JSON.stringify(l)===JSON.stringify(a))&&s.push(a)}s.length===1?r.additionalProperties=s[0]:s.length>1&&(r.additionalProperties={allOf:s})}return r}function hM(n){let e=n.allOf;if(!Array.isArray(e)||e.length<2)return;for(let r of $$)if(r in n)return;let t=e.filter(r=>I$.some(s=>Array.isArray(r[s]))),i=null;if(!t.length)i=By(e);else{let r=t[0],s=I$.find(l=>Array.isArray(r[l]));if(Object.keys(r).length!==1)return;let o=e.filter(l=>l!==r),a=r[s].map(l=>By([...o,l]));if(a.some(l=>!l))return;i={[s]:a}}i&&(delete n.allOf,Sa(n,i))}function Br(n,e){let t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=a=>{let l=n.seen.get(a);if(l.ref===null)return;let c=l.def??l.schema,u={...c},d=l.ref;if(l.ref=null,d){i(d);let h=n.seen.get(d),m=h.schema;if(m.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(m)):Sa(c,m),Sa(c,u),a._zod.parent===d)for(let g in c)g==="$ref"||g==="allOf"||g in u||delete c[g];if(m.$ref&&h.def)for(let g in c)g==="$ref"||g==="allOf"||g in h.def&&JSON.stringify(c[g])===JSON.stringify(h.def[g])&&delete c[g]}let f=a._zod.parent;if(f&&f!==d){i(f);let h=n.seen.get(f);if(h?.schema.$ref&&(c.$ref=h.schema.$ref,h.def))for(let m in c)m==="$ref"||m==="allOf"||m in h.def&&JSON.stringify(c[m])===JSON.stringify(h.def[m])&&delete c[m]}n.override({zodSchema:a,jsonSchema:c,path:l.path??[]})};if(!n.external||n.sharedEmitDoneFor!==n.external){for(let a of[...n.seen.entries()].reverse())i(a[0]);if(n.target!=="openapi-3.0")for(let a of n.seen.entries())k$(a[1].def??a[1].schema);for(let a of n.deferred)a();if(n.intersections.length){let a=new Map;for(let l of n.seen.values())for(let c of[l.schema,l.def]){let u=c?.allOf;if(!Array.isArray(u))continue;let d=a.get(u);d?d.push(c):a.set(u,[c])}for(let l of n.intersections)for(let c of a.get(l)??[])hM(c)}}let r={};if(n.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":n.target,n.external?.uri){let a=n.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");r.$id=n.external.uri(a)}Sa(r,t.defId?t.schema:t.def??t.schema);let s=n.metadataRegistry.get(e)?.id;s!==void 0&&r.id===s&&delete r.id;let o=n.external?.defs??{};if(!n.external||n.sharedEmitDoneFor!==n.external)for(let a of n.seen.entries()){let l=a[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,Rt(o,l.defId,l.def))}n.external&&(n.sharedEmitDoneFor=n.external),n.external||Object.keys(o).length>0&&(n.target==="draft-2020-12"?r.$defs=o:r.definitions=o);try{let a=JSON.parse(JSON.stringify(r));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:Rs(e,"input",n.processors),output:Rs(e,"output",n.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Kt(n,e){let t=e??{seen:new Set};if(t.seen.has(n))return!1;t.seen.add(n);let i=n._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Kt(i.element,t);if(i.type==="set")return Kt(i.valueType,t);if(i.type==="lazy")return Kt(i.getter(),t);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return Kt(i.innerType,t);if(i.type==="intersection")return Kt(i.left,t)||Kt(i.right,t);if(i.type==="record"||i.type==="map")return Kt(i.keyType,t)||Kt(i.valueType,t);if(i.type==="pipe")return n._zod.traits.has("$ZodCodec")?!0:Kt(i.in,t)||Kt(i.out,t);if(i.type==="object"){for(let r in i.shape)if(Kt(i.shape[r],t))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(Kt(r,t))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(Kt(r,t))return!0;return!!(i.rest&&Kt(i.rest,t))}return!1}var $$,I$,jy,Rs,xa=G(()=>{la();J();$$=new Set(["type","properties","required","additionalProperties"]),I$=["oneOf","anyOf"];jy=(n,e={})=>t=>{let i=Fr({...t,processors:e});return Be(n,i),zr(i,n),Br(i,n)},Rs=(n,e,t={})=>i=>{let{libraryOptions:r,target:s}=i??{},o=Fr({...r??{},target:s,io:e,processors:t});return Be(n,o),zr(o,n),Br(o,n)}});function gt(n){let e={},t=n._zod.def,i=n._zod.traits.has("$ZodCheck")?[n,...t.checks??[]]:t.checks??[];for(let s of i)mM[s._zod.def.check]?.(e,s._zod.def);let r=n._zod.bag;r.minimum!==void 0&&Ls(e,"minimum",r.minimum),r.exclusiveMinimum!==void 0&&Ls(e,"exclusiveMinimum",r.exclusiveMinimum),r.maximum!==void 0&&Ds(e,"maximum",r.maximum),r.exclusiveMaximum!==void 0&&Ds(e,"exclusiveMaximum",r.exclusiveMaximum),r.multipleOf!==void 0&&L$(e,r.multipleOf),r.format!==void 0&&(e.format??(e.format=r.format),r.format.includes("int")&&(e.isInt=!0)),r.mime&&C$(e,r.mime);for(let s of r.patterns??[])D$(e,s);return e}function _a(n){let e=n._zod.def;return e.type==="pipe"&&e.in._zod.traits.has("$ZodTransform")?_a(e.out):e.type==="catch"?_a(e.innerType):n._zod.optin}function Vy(n,e,t){if(e.$ref){if(t.has(e))return e;t.add(e);let m=n.get(e)?.def;if(!m)return e;let p=Vy(n,m,t);return p===m?e:p}for(let m of["anyOf","oneOf"]){let p=e[m];if(!Array.isArray(p))continue;let g=p.map(y=>Vy(n,y,t));g.some((y,b)=>y!==p[b])&&(e={...e,[m]:g})}let i=Array.isArray(e.type)?e.type:[e.type],r=!i.includes("string")&&i.some(m=>m==="number"||m==="integer"),s=e.enum??(e.const!==void 0?[e.const]:void 0);if(!r&&!s?.some(m=>typeof m=="number"))return e;let{minimum:o,maximum:a,exclusiveMinimum:l,exclusiveMaximum:c,multipleOf:u,format:d,id:f,...h}=e;return h.enum?h.enum=h.enum.map(m=>typeof m=="number"?String(m):m):typeof h.const=="number"&&(h.const=String(h.const)),r&&(h.type="string",s||(h.pattern=(i.includes("number")?lr:Ho).source)),h}function vM(n){let e=new Map;for(let i of n.seen.values())i.def&&!e.has(i.schema)&&e.set(i.schema,i);let t=new Map;for(let i of Gy.get(n)??[]){let r=n.seen.get(i),s=(r?.def??r?.schema)?.propertyNames;if(!s||s===!0||t.has(s))continue;let o=Vy(e,s,new Set);o!==s&&t.set(s,o)}if(t.size)for(let i of n.seen.values())for(let r of[i.schema,i.def]){let s=r&&t.get(r.propertyNames);s&&(r.propertyNames=s)}}function M$(n,e,t,i,r){let s=!1,o=JSON.stringify(n,(a,l)=>typeof l!="bigint"?l:(s=!0,null));return s?(pt(e,t,i,r,"BigInt defaults cannot be represented in JSON Schema"),x0):JSON.parse(o)}function Ea(n,e){if("_idmap"in n){let i=n,r=Fr({...e,processors:td}),s={};for(let l of i._idmap.entries()){let[c,u]=l;Be(u,r)}let o={},a={registry:i,uri:e?.uri,defs:s};r.external=a;for(let l of i._idmap.entries()){let[c,u]=l;zr(r,u),Rt(o,c,Br(r,u))}if(Object.keys(s).length>0){let l=r.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[l]:s}}return{schemas:o}}let t=Fr({...e,processors:td});return Be(n,t),zr(t,n),Br(t,n)}var Ls,Ds,A$,L$,D$,C$,O$,w$,P$,R$,mM,pM,gM,N$,Ky,Hy,Zy,qy,Wy,Yy,Jy,Xy,Qy,e0,t0,n0,r0,i0,s0,o0,a0,l0,c0,u0,d0,f0,h0,m0,p0,nd,g0,v0,Gy,y0,b0,S0,x0,_0,E0,I0,T0,k0,$0,rd,A0,td,Ia=G(()=>{gi();Ts();xa();J();Ls=(n,e,t)=>{(n[e]===void 0||t>n[e])&&(n[e]=t)},Ds=(n,e,t)=>{(n[e]===void 0||t<n[e])&&(n[e]=t)},A$=(n,e)=>{Ls(n,"minimum",e),Ds(n,"maximum",e)},L$=(n,e)=>{n.multipleOf??(n.multipleOf=[]),n.multipleOf.includes(e)||n.multipleOf.push(e)},D$=(n,e)=>{n.patterns??(n.patterns=new Set),n.patterns.add(e)},C$=(n,e)=>{n.mime=n.mime?n.mime.filter(t=>e.includes(t)):[...e]},O$=(n,e)=>{n.format=e,e.includes("int")&&(n.isInt=!0)},w$=(n,e)=>Ls(n,"minimum",e.minimum),P$=(n,e)=>Ds(n,"maximum",e.maximum),R$=n=>(e,t)=>{O$(e,t.format);let[i,r]=n[t.format];Ls(e,"minimum",i),Ds(e,"maximum",r)},mM={greater_than:(n,e)=>Ls(n,e.inclusive?"minimum":"exclusiveMinimum",e.value),less_than:(n,e)=>Ds(n,e.inclusive?"maximum":"exclusiveMaximum",e.value),multiple_of:(n,e)=>L$(n,e.value),number_format:R$(Mo),bigint_format:R$(Uo),min_length:w$,max_length:P$,length_equals:(n,e)=>A$(n,e.length),min_size:w$,max_size:P$,size_equals:(n,e)=>A$(n,e.size),string_format:(n,e)=>{O$(n,e.format),e.pattern&&D$(n,e.pattern),(e.format==="base64"||e.format==="base64url")&&(n.contentEncoding=e.format),(e.local||e.precision===-1)&&(n.laxFormat=!0)},mime_type:(n,e)=>C$(n,e.mime)};pM={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gM=new Map([[au,Zp],[Qo,qp]]),N$=n=>gM.get(n)??n,Ky=(n,e,t,i)=>{let r=t;r.type="string";let{minimum:s,maximum:o,format:a,patterns:l,contentEncoding:c,laxFormat:u}=gt(n);if(typeof s=="number"&&(r.minLength=s),typeof o=="number"&&(r.maxLength=o),a&&(r.format=pM[a]??a,r.format===""&&delete r.format,(a==="time"||u)&&delete r.format),c&&(r.contentEncoding=c),l&&l.size>0){let d=[...l].map(N$);d.length===1?r.pattern=d[0].source:d.length>1&&(r.allOf=[...d.map(f=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},Hy=(n,e,t,i)=>{let r=t,{minimum:s,maximum:o,multipleOf:a,exclusiveMaximum:l,exclusiveMinimum:c,isInt:u}=gt(n);r.type=u?"integer":"number";let d=typeof c=="number"&&c>=(s??Number.NEGATIVE_INFINITY),f=typeof l=="number"&&l<=(o??Number.POSITIVE_INFINITY),h=e.target==="draft-04"||e.target==="openapi-3.0";if(d?h?(r.minimum=c,r.exclusiveMinimum=!0):r.exclusiveMinimum=c:typeof s=="number"&&(r.minimum=s),f?h?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l:typeof o=="number"&&(r.maximum=o),a){let m=new Set;for(let y of a)Number.isFinite(y)&&y!==0?m.add(Math.abs(y)):pt(n,e,r,i,`A multipleOf divisor of ${y} cannot be represented in JSON Schema`);let[p,...g]=m;p!==void 0&&(r.multipleOf=p),g.length&&(r.allOf=[...r.allOf??[],...g.map(y=>({multipleOf:y}))])}},Zy=(n,e,t,i)=>{t.type="boolean"},qy=(n,e,t,i)=>{pt(n,e,t,i,"BigInt cannot be represented in JSON Schema")},Wy=(n,e,t,i)=>{pt(n,e,t,i,"Symbols cannot be represented in JSON Schema")},Yy=(n,e,t,i)=>{e.target==="openapi-3.0"?(t.type="string",t.nullable=!0,t.enum=[null]):t.type="null"},Jy=(n,e,t,i)=>{pt(n,e,t,i,"Undefined cannot be represented in JSON Schema")},Xy=(n,e,t,i)=>{pt(n,e,t,i,"Void cannot be represented in JSON Schema")},Qy=(n,e,t,i)=>{t.not={}},e0=(n,e,t,i)=>{},t0=(n,e,t,i)=>{},n0=(n,e,t,i)=>{pt(n,e,t,i,"Date cannot be represented in JSON Schema")},r0=(n,e,t,i)=>{let r=n._zod.def,s=ds(r.entries);if(s.length===0){t.not={};return}s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),t.enum=s},i0=(n,e,t,i)=>{let r=n._zod.def;if(r.values.length===0){t.not={};return}let s=[];for(let o of r.values)if(o===void 0){if(pt(n,e,t,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o=="bigint"){if(pt(n,e,t,i,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){let o=s[0];t.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?t.enum=[o]:t.const=o}else s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),s.every(o=>typeof o=="boolean")&&(t.type="boolean"),s.every(o=>o===null)&&(t.type="null"),t.enum=s},s0=(n,e,t,i)=>{pt(n,e,t,i,"NaN cannot be represented in JSON Schema")},o0=(n,e,t,i)=>{let r=t,s=n._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=s.source},a0=(n,e,t,i)=>{let r=t;r.type="string",r.format="binary",r.contentEncoding="binary";let{minimum:s,maximum:o,mime:a}=gt(n);s!==void 0&&(r.minLength=s),o!==void 0&&(r.maxLength=o),a&&(a.length===0?r.not={}:a.length===1?r.contentMediaType=a[0]:r.anyOf=a.map(l=>({contentMediaType:l})))},l0=(n,e,t,i)=>{t.type="boolean"},c0=(n,e,t,i)=>{pt(n,e,t,i,"Custom types cannot be represented in JSON Schema")},u0=(n,e,t,i)=>{pt(n,e,t,i,"Function types cannot be represented in JSON Schema")},d0=(n,e,t,i)=>{pt(n,e,t,i,"Transforms cannot be represented in JSON Schema")},f0=(n,e,t,i)=>{pt(n,e,t,i,"Map cannot be represented in JSON Schema")},h0=(n,e,t,i)=>{pt(n,e,t,i,"Set cannot be represented in JSON Schema")},m0=(n,e,t,i)=>{let r=t,s=n._zod.def,{minimum:o,maximum:a}=gt(n);typeof o=="number"&&(r.minItems=o),typeof a=="number"&&(r.maxItems=a),r.type="array",r.items=Be(s.element,e,{...i,path:[...i.path,"items"]})};p0=(n,e,t,i)=>{let r=t,s=n._zod.def,o=s.shape;if(Object.getOwnPropertySymbols(o).length&&pt(n,e,r,i,"Symbol keys cannot be represented in JSON Schema"))return;r.type="object",r.properties={};for(let c in o)Rt(r.properties,c,Be(o[c],e,{...i,path:[...i.path,"properties",c]}));let l=[];for(let c of Object.keys(o)){let u=s.shape[c];(e.io==="input"?_a(u)===void 0:u._zod.optout===void 0)&&l.push(c)}l.length>0&&(r.required=l),s.catchall?._zod.def.type==="never"?r.additionalProperties=!1:s.catchall?s.catchall&&(r.additionalProperties=Be(s.catchall,e,{...i,path:[...i.path,"additionalProperties"]})):e.io==="output"&&(r.additionalProperties=!1)},nd=(n,e,t,i)=>{let r=n._zod.def,s=r.inclusive===!1,o=r.options.map((a,l)=>Be(a,e,{...i,path:[...i.path,s?"oneOf":"anyOf",l]}));s?t.oneOf=o:t.anyOf=o},g0=(n,e,t,i)=>{let r=n._zod.def,s=Be(r.left,e,{...i,path:[...i.path,"allOf",0]}),o=Be(r.right,e,{...i,path:[...i.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,l=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];t.allOf=l,e.intersections.push(l)},v0=(n,e,t,i)=>{let r=t,s=n._zod.def;r.type="array";let o=e.target==="draft-2020-12"?"prefixItems":"items",a=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",l=s.items.map((p,g)=>Be(p,e,{...i,path:[...i.path,o,g]})),c=s.rest?Be(s.rest,e,{...i,path:[...i.path,a,...e.target==="openapi-3.0"?[s.items.length]:[]]}):null,u=s.items.length;for(;u>0;){let p=s.items[u-1];if(!(e.io==="input"?_a(p)!==void 0:p._zod.optout==="optional"))break;u--}let d=s.items.length,f=!s.rest;e.target==="draft-2020-12"?(r.prefixItems=l,f?r.items=!1:c&&(r.items=c),u>0&&(r.minItems=u),f&&(r.maxItems=d)):e.target==="openapi-3.0"?(r.items={anyOf:l},c&&r.items.anyOf.push(c),u>0&&(r.minItems=u),f&&(r.maxItems=d)):(r.items=l,f?r.additionalItems=!1:c&&(r.additionalItems=c),u>0&&(r.minItems=u),f&&(r.maxItems=d));let{minimum:h,maximum:m}=gt(n);typeof h=="number"&&(r.minItems=h),typeof m=="number"&&(r.maxItems=m)};Gy=new WeakMap;y0=(n,e,t,i)=>{let r=t,s=n._zod.def;r.type="object";let o=s.keyType,a=gt(o).patterns;if(s.mode==="loose"&&a&&a.size>0){let u=Be(s.valueType,e,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let d of a)Rt(r.patternProperties,N$(d).source,u)}else{if(e.target==="draft-07"||e.target==="draft-2020-12"){r.propertyNames=Be(s.keyType,e,{...i,path:[...i.path,"propertyNames"]});let u=Gy.get(e);u||(u=[],Gy.set(e,u),e.deferred.push(()=>vM(e))),u.push(n)}r.additionalProperties=Be(s.valueType,e,{...i,path:[...i.path,"additionalProperties"]})}let l=o._zod.values,c=e.io==="input"&&_a(s.valueType)!==void 0;if(l&&!s.partial&&!c){let u=[...l].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(r.required=u.map(String))}},b0=(n,e,t,i)=>{let r=n._zod.def,s=Be(r.innerType,e,i),o=e.seen.get(n);e.target==="openapi-3.0"?(o.ref=r.innerType,t.nullable=!0):t.anyOf=[s,{type:"null"}]},S0=(n,e,t,i)=>{let r=n._zod.def;Be(r.innerType,e,i);let s=e.seen.get(n);s.ref=r.innerType},x0=Symbol();_0=(n,e,t,i)=>{let r=n._zod.def;Be(r.innerType,e,i);let s=e.seen.get(n);s.ref=r.innerType;let o=M$(r.defaultValue,n,e,t,i);o!==x0&&(t.default=o)},E0=(n,e,t,i)=>{let r=n._zod.def;Be(r.innerType,e,i);let s=e.seen.get(n);if(s.ref=r.innerType,e.io!=="input")return;let o=M$(r.defaultValue,n,e,t,i);o!==x0&&(t._prefault=o)},I0=(n,e,t,i)=>{let r=n._zod.def;Be(r.innerType,e,i);let s=e.seen.get(n);s.ref=r.innerType;let o;try{o=r.catchValue(void 0)}catch{pt(n,e,t,i,"Dynamic catch values are not supported in JSON Schema");return}t.default=o},T0=(n,e,t,i)=>{let r=n._zod.def,s=r.in._zod.traits.has("$ZodTransform"),o=e.io==="input"?s?r.out:r.in:r.out;Be(o,e,i);let a=e.seen.get(n);a.ref=o},k0=(n,e,t,i)=>{let r=n._zod.def;Be(r.innerType,e,i);let s=e.seen.get(n);s.ref=r.innerType,t.readOnly=!0},$0=(n,e,t,i)=>{let r=n._zod.def;Be(r.innerType,e,i);let s=e.seen.get(n);s.ref=r.innerType},rd=(n,e,t,i)=>{let r=n._zod.def;Be(r.innerType,e,i);let s=e.seen.get(n);s.ref=r.innerType},A0=(n,e,t,i)=>{let r=n._zod.innerType;Be(r,e,i);let s=e.seen.get(n);s.ref=r},td={string:Ky,number:Hy,boolean:Zy,bigint:qy,symbol:Wy,null:Yy,undefined:Jy,void:Xy,never:Qy,any:e0,unknown:t0,date:n0,enum:r0,literal:i0,nan:s0,template_literal:o0,file:a0,success:l0,custom:c0,function:u0,transform:d0,map:f0,set:h0,array:m0,object:p0,union:nd,intersection:g0,tuple:v0,record:y0,nullable:b0,nonoptional:S0,default:_0,prefault:E0,catch:I0,pipe:T0,readonly:k0,promise:$0,optional:rd,lazy:A0}});var id,U$=G(()=>{Ia();xa();id=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??"draft-2020-12";t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),this.ctx=Fr({processors:td,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return Be(e,this.ctx,t)}emit(e,t){t&&(t.cycles&&(this.ctx.cycles=t.cycles),t.reused&&(this.ctx.reused=t.reused),t.external&&(this.ctx.external=t.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,zr(this.ctx,e);let i=Br(this.ctx,e),{"~standard":r,...s}=i;return s}}});var F$={};var z$=G(()=>{});var Yn={};jn(Yn,{$ZodAny:()=>pv,$ZodArray:()=>xv,$ZodAsyncError:()=>sn,$ZodBase64:()=>rv,$ZodBase64URL:()=>iv,$ZodBigInt:()=>hu,$ZodBigIntFormat:()=>dv,$ZodBoolean:()=>ea,$ZodCIDRv4:()=>tv,$ZodCIDRv6:()=>nv,$ZodCUID:()=>Vg,$ZodCUID2:()=>Gg,$ZodCatch:()=>Fv,$ZodCheck:()=>Ze,$ZodCheckBigIntFormat:()=>pg,$ZodCheckEndsWith:()=>$g,$ZodCheckGreaterThan:()=>Wc,$ZodCheckIncludes:()=>Tg,$ZodCheckLengthEquals:()=>xg,$ZodCheckLessThan:()=>qc,$ZodCheckLowerCase:()=>Eg,$ZodCheckMaxLength:()=>bg,$ZodCheckMaxSize:()=>gg,$ZodCheckMimeType:()=>Pg,$ZodCheckMinLength:()=>Sg,$ZodCheckMinSize:()=>vg,$ZodCheckMultipleOf:()=>hg,$ZodCheckNumberFormat:()=>mg,$ZodCheckOverwrite:()=>Rg,$ZodCheckProperties:()=>wg,$ZodCheckProperty:()=>Ag,$ZodCheckRegex:()=>_g,$ZodCheckSizeEquals:()=>yg,$ZodCheckStartsWith:()=>kg,$ZodCheckStringFormat:()=>Es,$ZodCheckUpperCase:()=>Ig,$ZodCodec:()=>na,$ZodCreditCard:()=>ov,$ZodCustom:()=>Hv,$ZodCustomStringFormat:()=>cv,$ZodCyclicError:()=>xu,$ZodDate:()=>bv,$ZodDefault:()=>Ov,$ZodDiscriminatedUnion:()=>Iv,$ZodE164:()=>sv,$ZodEmail:()=>Mg,$ZodEmoji:()=>Bg,$ZodEncodeError:()=>Cr,$ZodEnum:()=>wv,$ZodError:()=>kp,$ZodExactOptional:()=>Dv,$ZodFile:()=>Rv,$ZodFunction:()=>Gv,$ZodGUID:()=>Og,$ZodIBAN:()=>av,$ZodIPv4:()=>Xg,$ZodIPv6:()=>Qg,$ZodISODate:()=>Wg,$ZodISODateTime:()=>qg,$ZodISODuration:()=>Jg,$ZodISOTime:()=>Yg,$ZodIntersection:()=>Tv,$ZodJWT:()=>lv,$ZodKSUID:()=>Zg,$ZodLazy:()=>ra,$ZodLiteral:()=>Pv,$ZodMAC:()=>ev,$ZodMap:()=>$v,$ZodNaN:()=>zv,$ZodNanoID:()=>jg,$ZodNever:()=>vv,$ZodNonOptional:()=>Mv,$ZodNull:()=>mv,$ZodNullable:()=>Cv,$ZodNumber:()=>fu,$ZodNumberFormat:()=>uv,$ZodObject:()=>VI,$ZodObjectJIT:()=>_v,$ZodOptional:()=>gu,$ZodPipe:()=>vu,$ZodPrefault:()=>Nv,$ZodPreprocess:()=>Bv,$ZodPromise:()=>Kv,$ZodReadonly:()=>jv,$ZodRealError:()=>on,$ZodRecord:()=>kv,$ZodRegistry:()=>$u,$ZodSet:()=>Av,$ZodString:()=>yi,$ZodStringFormat:()=>ze,$ZodSuccess:()=>Uv,$ZodSymbol:()=>fv,$ZodTemplateLiteral:()=>Vv,$ZodTransform:()=>Lv,$ZodTuple:()=>pu,$ZodType:()=>ye,$ZodULID:()=>Kg,$ZodURL:()=>zg,$ZodUUID:()=>Ng,$ZodUndefined:()=>hv,$ZodUnion:()=>ta,$ZodUnknown:()=>gv,$ZodVoid:()=>yv,$ZodXID:()=>Hg,$ZodXor:()=>Ev,$brand:()=>Rc,$constructor:()=>w,$input:()=>wu,$output:()=>Au,Doc:()=>vi,INVALID:()=>Ut,JSONSchema:()=>F$,JSONSchemaGenerator:()=>id,NEVER:()=>Pc,TimePrecision:()=>ed,URL_BAD_FORMAT:()=>Ug,URL_UNPARSEABLE:()=>Wo,ZodCompileAsyncError:()=>_n,ZodCompileUnsupportedError:()=>$e,_any:()=>ky,_array:()=>Dy,_base64:()=>Yu,_base64url:()=>Ju,_bigint:()=>by,_boolean:()=>vy,_catch:()=>aM,_check:()=>x$,_cidrv4:()=>qu,_cidrv6:()=>Wu,_coercedBigint:()=>Sy,_coercedBoolean:()=>yy,_coercedDate:()=>Ry,_coercedNumber:()=>dy,_coercedString:()=>oy,_creditCard:()=>ly,_cuid:()=>Bu,_cuid2:()=>ju,_custom:()=>Oy,_date:()=>Py,_decode:()=>Mc,_decodeAsync:()=>Fc,_default:()=>iM,_discriminatedUnion:()=>HN,_e164:()=>Xu,_email:()=>Du,_emoji:()=>Fu,_encode:()=>Nc,_encodeAsync:()=>Uc,_endsWith:()=>$i,_enum:()=>XN,_file:()=>Cy,_float32:()=>hy,_float64:()=>my,_gt:()=>Mn,_gte:()=>ln,_guid:()=>Cu,_iban:()=>cy,_includes:()=>Ti,_int:()=>fy,_int32:()=>py,_int64:()=>xy,_intersection:()=>ZN,_ipv4:()=>Hu,_ipv6:()=>Zu,_isoDate:()=>fa,_isoDateTime:()=>da,_isoDuration:()=>ma,_isoTime:()=>ha,_jwt:()=>Qu,_ksuid:()=>Ku,_lazy:()=>dM,_length:()=>Ur,_literal:()=>eM,_lowercase:()=>Ei,_lt:()=>Nn,_lte:()=>an,_mac:()=>ay,_map:()=>YN,_max:()=>an,_maxLength:()=>Mr,_maxSize:()=>ur,_mime:()=>wi,_min:()=>ln,_minLength:()=>Wn,_minSize:()=>Un,_multipleOf:()=>cr,_nan:()=>Ly,_nanoid:()=>zu,_nativeEnum:()=>QN,_negative:()=>ga,_never:()=>Ay,_nonnegative:()=>ya,_nonoptional:()=>sM,_nonpositive:()=>va,_normalize:()=>Pi,_null:()=>Ty,_nullable:()=>rM,_number:()=>uy,_optional:()=>nM,_overwrite:()=>En,_parse:()=>bs,_parseAsync:()=>Ss,_pipe:()=>lM,_positive:()=>pa,_promise:()=>fM,_properties:()=>Ai,_property:()=>ba,_readonly:()=>cM,_record:()=>WN,_refine:()=>Ny,_regex:()=>_i,_safeDecode:()=>Bc,_safeDecodeAsync:()=>Vc,_safeEncode:()=>zc,_safeEncodeAsync:()=>jc,_safeParse:()=>xs,_safeParseAsync:()=>_s,_set:()=>JN,_size:()=>Nr,_slugify:()=>Ci,_startsWith:()=>ki,_string:()=>sy,_stringFormat:()=>Oi,_stringbool:()=>zy,_success:()=>oM,_superRefine:()=>My,_symbol:()=>Ey,_templateLiteral:()=>uM,_toLowerCase:()=>Li,_toUpperCase:()=>Di,_transform:()=>tM,_trim:()=>Ri,_tuple:()=>qN,_uint32:()=>gy,_uint64:()=>_y,_ulid:()=>Vu,_undefined:()=>Iy,_union:()=>GN,_unknown:()=>$y,_uppercase:()=>Ii,_url:()=>ua,_uuid:()=>Ou,_uuidv4:()=>Nu,_uuidv6:()=>Mu,_uuidv7:()=>Uu,_void:()=>wy,_xid:()=>Gu,_xor:()=>KN,base64Charset:()=>au,base64urlCharset:()=>Qo,canParseURL:()=>Fg,clone:()=>Me,compile:()=>Pu,compileFn:()=>Ru,config:()=>it,createStandardJSONSchemaMethod:()=>Rs,createToJSONSchemaMethod:()=>jy,decode:()=>mI,decodeAsync:()=>gI,describe:()=>Uy,encode:()=>hI,encodeAsync:()=>pI,extractDefs:()=>zr,finalize:()=>Br,flattenError:()=>vs,formatError:()=>ys,getDiscriminatedOption:()=>mu,globalConfig:()=>_t,globalRegistry:()=>Et,handleUnrepresentable:()=>pt,initializeContext:()=>Fr,isBackEdge:()=>Eu,isRecursiveSchema:()=>_u,isValidBase64:()=>Xo,isValidBase64URL:()=>lu,isValidCIDRv6:()=>ou,isValidCreditCard:()=>cu,isValidIBAN:()=>uu,isValidIPv6:()=>Jo,isValidJWT:()=>du,locales:()=>ws,memoizer:()=>$s,mergeValues:()=>Is,meta:()=>Fy,parse:()=>Vo,parseAsync:()=>Go,parseURLObject:()=>zI,prettifyError:()=>Dc,process:()=>Be,processSchema:()=>Be,regexes:()=>gn,registry:()=>aa,safeDecode:()=>yI,safeDecodeAsync:()=>SI,safeEncode:()=>vI,safeEncodeAsync:()=>bI,safeParse:()=>Oc,safeParseAsync:()=>Ap,standardProps:()=>nu,stripTabAndNewline:()=>Yo,toDotPath:()=>dI,toJSONSchema:()=>Ea,toZod:()=>us,treeifyError:()=>Lc,urlHostnameOk:()=>iu,urlProtocolOk:()=>su,util:()=>O,validate:()=>hi,validateAsync:()=>mi,validateURL:()=>ru,version:()=>Lg,withParser:()=>ca});var cn=G(()=>{Dr();wp();$p();Ts();Wv();Yc();Dg();J();J();gi();Qv();la();Jc();S$();_$();xa();Ia();U$();z$()});function Ta(n,e){let t=typeof e=="function"?e:(o,a)=>{let l=e[o._zod.def.type];return l?l(o,a):o},i=new Map;function r(o){let a=i.get(o);if(a===B$)return new ra({type:"lazy",getter:()=>i.get(o)});if(a!==void 0)return a;i.set(o,B$);let l=s(o),c=t(l,l!==o);return i.set(o,c),c}function s(o){let a=o._zod.def,l=a.type;switch(l){case"object":{let c=a.shape,u=Object.keys(c),d=!1,f={};for(let m of u){let p=r(c[m]);p!==c[m]&&(d=!0),f[m]=p}let h=a.catchall;return a.catchall&&(h=r(a.catchall),h!==a.catchall&&(d=!0)),d?Me(o,{...a,shape:f,catchall:h}):o}case"array":{let c=r(a.element);return c===a.element?o:Me(o,{...a,element:c})}case"tuple":{let c=a.items,u=!1,d=[];for(let h of c){let m=r(h);m!==h&&(u=!0),d.push(m)}let f=a.rest;return a.rest&&(f=r(a.rest),f!==a.rest&&(u=!0)),u?Me(o,{...a,items:d,rest:f}):o}case"record":case"map":{let c=r(a.keyType),u=r(a.valueType);return c===a.keyType&&u===a.valueType?o:Me(o,{...a,keyType:c,valueType:u})}case"set":{let c=r(a.valueType);return c===a.valueType?o:Me(o,{...a,valueType:c})}case"union":{let c=a.options,u=!1,d=[];for(let f of c){let h=r(f);h!==f&&(u=!0),d.push(h)}return u?Me(o,{...a,options:d}):o}case"intersection":{let c=r(a.left),u=r(a.right);return c===a.left&&u===a.right?o:Me(o,{...a,left:c,right:u})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let c=r(a.innerType);return c===a.innerType?o:Me(o,{...a,innerType:c})}case"pipe":{let c=r(a.in),u=r(a.out);return c===a.in&&u===a.out?o:Me(o,{...a,in:c,out:u})}case"function":{let c=r(a.input),u=r(a.output);return c===a.input&&u===a.output?o:Me(o,{...a,input:c,output:u})}case"lazy":{let c=a.getter,{_cachedInner:u,...d}=a;return Me(o,{...d,getter:()=>r(c())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return o;default:return o}}return r(n)}var B$,w0=G(()=>{Ts();J();B$=Symbol("z.visit/resolving")});var ad={};jn(ad,{endsWith:()=>$i,gt:()=>Mn,gte:()=>ln,includes:()=>Ti,length:()=>Ur,lowercase:()=>Ei,lt:()=>Nn,lte:()=>an,maxLength:()=>Mr,maxSize:()=>ur,mime:()=>wi,minLength:()=>Wn,minSize:()=>Un,multipleOf:()=>cr,negative:()=>ga,nonnegative:()=>ya,nonpositive:()=>va,normalize:()=>Pi,overwrite:()=>En,positive:()=>pa,properties:()=>Ai,property:()=>ba,regex:()=>_i,size:()=>Nr,slugify:()=>Ci,startsWith:()=>ki,toLowerCase:()=>Li,toUpperCase:()=>Di,trim:()=>Ri,uppercase:()=>Ii});var ld=G(()=>{cn()});function cd(n,e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!1,get(){let i=t(this);return Object.defineProperty(this,e,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,e,{value:i,configurable:!0,writable:!0})}})}var G$,K$,H$,Ht,P0=G(()=>{cn();cn();J();G$=new WeakSet([Object.prototype,Error.prototype]);K$=(n,e)=>{kp.init(n,e),n.name="ZodError";let t=Object.getPrototypeOf(n);G$.has(t)||(G$.add(t),cd(t,"format",i=>r=>ys(i,r)),cd(t,"flatten",i=>r=>vs(i,r)),cd(t,"addIssue",i=>r=>{i.issues.push(r),i.message=JSON.stringify(i.issues,fs,2)}),cd(t,"addIssues",i=>r=>{i.issues.push(...r),i.message=JSON.stringify(i.issues,fs,2)}),Object.defineProperty(t,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},H$=w("ZodError",K$),Ht=w("ZodError",K$,void 0,{Parent:Error})});var ud,dd,fd,hd,md,pd,gd,vd,yd,bd,Sd,xd,R0=G(()=>{cn();P0();cn();ud=bs(Ht),dd=Ss(Ht),fd=xs(Ht),hd=_s(Ht),md=Nc(Ht),pd=Mc(Ht),gd=Uc(Ht),vd=Fc(Ht),yd=zc(Ht),bd=Bc(Ht),Sd=jc(Ht),xd=Vc(Ht)});var Hs={};jn(Hs,{ZodAny:()=>Ad,ZodArray:()=>Ld,ZodBase64:()=>ja,ZodBase64URL:()=>Va,ZodBigInt:()=>ji,ZodBigIntFormat:()=>Ha,ZodBoolean:()=>Bi,ZodCIDRv4:()=>za,ZodCIDRv6:()=>Ba,ZodCUID:()=>Da,ZodCUID2:()=>Ca,ZodCatch:()=>Jd,ZodCodec:()=>Vs,ZodCreditCard:()=>Ed,ZodCustom:()=>Gs,ZodCustomStringFormat:()=>jr,ZodDate:()=>Ms,ZodDefault:()=>Kd,ZodDiscriminatedUnion:()=>Cd,ZodE164:()=>Ga,ZodEmail:()=>wa,ZodEmoji:()=>Ra,ZodEnum:()=>Mi,ZodExactOptional:()=>Wa,ZodFile:()=>Bd,ZodFunction:()=>lf,ZodGUID:()=>Pa,ZodIBAN:()=>Id,ZodIPv4:()=>Ua,ZodIPv6:()=>Fa,ZodISODate:()=>fr,ZodISODateTime:()=>dr,ZodISODuration:()=>mr,ZodISOTime:()=>hr,ZodInstanceOf:()=>df,ZodIntersection:()=>Od,ZodJWT:()=>Ka,ZodKSUID:()=>Ma,ZodLazy:()=>sf,ZodLiteral:()=>zd,ZodMAC:()=>_d,ZodMap:()=>Ud,ZodNaN:()=>Qd,ZodNanoID:()=>La,ZodNever:()=>Pd,ZodNonOptional:()=>Ya,ZodNull:()=>$d,ZodNullable:()=>Gd,ZodNumber:()=>zi,ZodNumberFormat:()=>Vr,ZodObject:()=>Us,ZodOptional:()=>Bs,ZodPipe:()=>js,ZodPrefault:()=>Zd,ZodPreprocess:()=>ef,ZodPromise:()=>af,ZodReadonly:()=>tf,ZodRecord:()=>Ni,ZodSet:()=>Fd,ZodString:()=>Fi,ZodStringFormat:()=>Ve,ZodSuccess:()=>Yd,ZodSymbol:()=>Td,ZodTemplateLiteral:()=>rf,ZodTransform:()=>jd,ZodTuple:()=>Nd,ZodType:()=>xe,ZodULID:()=>Oa,ZodURL:()=>Os,ZodUUID:()=>Fn,ZodUndefined:()=>kd,ZodUnion:()=>Fs,ZodUnknown:()=>wd,ZodVoid:()=>Rd,ZodXID:()=>Na,ZodXor:()=>Dd,_ZodString:()=>Aa,_default:()=>Hd,_function:()=>Mb,any:()=>yb,array:()=>ke,base64:()=>X0,base64url:()=>Q0,bigint:()=>hb,boolean:()=>ot,catch:()=>Xd,check:()=>Ub,cidrv4:()=>Y0,cidrv6:()=>J0,codec:()=>Db,creditCard:()=>tb,cuid:()=>j0,cuid2:()=>V0,currencyCode:()=>ab,custom:()=>Ja,date:()=>Sb,describe:()=>Fb,discriminatedUnion:()=>zs,e164:()=>eb,email:()=>L0,emoji:()=>z0,enum:()=>Tt,exactOptional:()=>Vd,file:()=>wb,float32:()=>cb,float64:()=>ub,function:()=>Mb,guid:()=>D0,hash:()=>lb,hex:()=>ob,hostname:()=>sb,httpUrl:()=>F0,iban:()=>nb,instanceof:()=>Bb,int:()=>ka,int32:()=>db,int64:()=>mb,intersection:()=>Vi,invertCodec:()=>Cb,ipv4:()=>Z0,ipv6:()=>W0,json:()=>Vb,jwt:()=>rb,keyof:()=>xb,ksuid:()=>H0,lazy:()=>of,literal:()=>ae,looseObject:()=>It,looseRecord:()=>Tb,mac:()=>q0,map:()=>kb,meta:()=>zb,nan:()=>Lb,nanoid:()=>B0,nativeEnum:()=>Ab,never:()=>Za,nonoptional:()=>Wd,null:()=>Ns,nullable:()=>Cs,nullish:()=>Pb,number:()=>Re,object:()=>re,optional:()=>je,partialRecord:()=>Ib,pipe:()=>$a,prefault:()=>qd,preprocess:()=>Ks,promise:()=>Nb,readonly:()=>nf,record:()=>Ge,refine:()=>cf,set:()=>$b,strictObject:()=>_b,string:()=>L,stringFormat:()=>ib,stringbool:()=>jb,success:()=>Rb,superRefine:()=>uf,symbol:()=>gb,templateLiteral:()=>Ob,transform:()=>qa,tuple:()=>Md,uint32:()=>fb,uint64:()=>pb,ulid:()=>G0,undefined:()=>vb,union:()=>Ue,unknown:()=>Ke,url:()=>U0,uuid:()=>C0,uuidv4:()=>O0,uuidv6:()=>N0,uuidv7:()=>M0,void:()=>bb,xid:()=>K0,xor:()=>Eb});function SM(){_t.localeError||it(Iu())}function Ui(){_t.memoizer||it({memoizer:$s()})}function L(n){return sy(Fi,n)}function L0(n){return Du(wa,n)}function D0(n){return Cu(Pa,n)}function C0(n){return Ou(Fn,n)}function O0(n){return Nu(Fn,n)}function N0(n){return Mu(Fn,n)}function M0(n){return Uu(Fn,n)}function U0(n){return ua(Os,n)}function F0(n){return ua(Os,{protocol:Ko,hostname:Yp,...O.normalizeParams(n)})}function z0(n){return Fu(Ra,n)}function B0(n){return zu(La,n)}function j0(n){return Bu(Da,n)}function V0(n){return ju(Ca,n)}function G0(n){return Vu(Oa,n)}function K0(n){return Gu(Na,n)}function H0(n){return Ku(Ma,n)}function Z0(n){return Hu(Ua,n)}function q0(n){return ay(_d,n)}function W0(n){return Zu(Fa,n)}function Y0(n){return qu(za,n)}function J0(n){return Wu(Ba,n)}function X0(n){return Yu(ja,n)}function Q0(n){return Ju(Va,n)}function eb(n){return Xu(Ga,n)}function tb(n){return ly(Ed,n)}function nb(n){return cy(Id,n)}function rb(n){return Qu(Ka,n)}function ib(n,e,t={}){return Oi(jr,n,e,t)}function sb(n){return Oi(jr,"hostname",Wp,n)}function ob(n){return Oi(jr,"hex",ug,n)}function ab(n){return Oi(jr,"currency_code",Xp,n)}function lb(n,e){let t=e?.enc??"hex",i=`${n}_${t}`,r=gn[i];if(!r)throw new Error(`Unrecognized hash format: ${i}`);return Oi(jr,i,r,e)}function Re(n){return uy(zi,n)}function ka(n){return fy(Vr,n)}function cb(n){return hy(Vr,n)}function ub(n){return my(Vr,n)}function db(n){return py(Vr,n)}function fb(n){return gy(Vr,n)}function ot(n){return vy(Bi,n)}function hb(n){return by(ji,n)}function mb(n){return xy(Ha,n)}function pb(n){return _y(Ha,n)}function gb(n){return Ey(Td,n)}function vb(n){return Iy(kd,n)}function Ns(n){return Ty($d,n)}function yb(){return ky(Ad)}function Ke(){return $y(wd)}function Za(n){return Ay(Pd,n)}function bb(n){return wy(Rd,n)}function Sb(n){return Py(Ms,n)}function ke(n,e){return Dy(Ld,n,e)}function xb(n){let e=n._zod.def.shape;return Tt(Object.keys(e))}function re(n,e){let t={type:"object",shape:n??{},...O.normalizeParams(e)};return new Us(t)}function _b(n,e){return new Us({type:"object",shape:n,catchall:Za(),...O.normalizeParams(e)})}function It(n,e){return new Us({type:"object",shape:n,catchall:Ke(),...O.normalizeParams(e)})}function Ue(n,e){return new Fs({type:"union",options:n,...O.normalizeParams(e)})}function Eb(n,e){return new Dd({type:"union",options:n,inclusive:!1,...O.normalizeParams(e)})}function zs(n,e,t){return new Cd({type:"union",options:e,discriminator:n,...O.normalizeParams(t)})}function Vi(n,e){return new Od({type:"intersection",left:n,right:e})}function Md(n,e,t){let i=e instanceof ye,r=i?t:e,s=i?e:null;return new Nd({type:"tuple",items:n,rest:s,...O.normalizeParams(r)})}function Ge(n,e,t){return!e||!e._zod?new Ni({type:"record",keyType:L(),valueType:n,...O.normalizeParams(e)}):new Ni({type:"record",keyType:n,valueType:e,...O.normalizeParams(t)})}function Ib(n,e,t){return new Ni({type:"record",keyType:n,valueType:e,...O.normalizeParams(t),partial:!0})}function Tb(n,e,t){return new Ni({type:"record",keyType:n,valueType:e,mode:"loose",...O.normalizeParams(t)})}function kb(n,e,t){return new Ud({type:"map",keyType:n,valueType:e,...O.normalizeParams(t)})}function $b(n,e){return new Fd({type:"set",valueType:n,...O.normalizeParams(e)})}function Tt(n,e){let t=Array.isArray(n)?Object.fromEntries(n.map(i=>[i,i])):n;return new Mi({type:"enum",entries:t,...O.normalizeParams(e)})}function Ab(n,e){return new Mi({type:"enum",entries:n,...O.normalizeParams(e)})}function ae(n,e){return new zd({type:"literal",values:Array.isArray(n)?n:[n],...O.normalizeParams(e)})}function wb(n){return Cy(Bd,n)}function qa(n){return new jd({type:"transform",transform:n})}function je(n){return new Bs({type:"optional",innerType:n})}function Vd(n){return new Wa({type:"optional",innerType:n})}function Cs(n){return new Gd({type:"nullable",innerType:n})}function Pb(n){return je(Cs(n))}function Hd(n,e){return new Kd({type:"default",innerType:n,get defaultValue(){return typeof e=="function"?e():O.shallowClone(e)}})}function qd(n,e){return new Zd({type:"prefault",innerType:n,get defaultValue(){return typeof e=="function"?e():O.shallowClone(e)}})}function Wd(n,e){return new Ya({type:"nonoptional",innerType:n,...O.normalizeParams(e)})}function Rb(n){return new Yd({type:"success",innerType:n})}function Xd(n,e){return new Jd({type:"catch",innerType:n,catchValue:typeof e=="function"?e:O.constantCatch(e)})}function Lb(n){return Ly(Qd,n)}function $a(n,e){return new js({type:"pipe",in:n,out:e})}function Db(n,e,t){return new Vs({type:"pipe",in:n,out:e,transform:t.decode,reverseTransform:t.encode})}function Cb(n){let e=n._zod.def;return new Vs({type:"pipe",in:e.out,out:e.in,transform:e.reverseTransform,reverseTransform:e.transform})}function nf(n){return new tf({type:"readonly",innerType:n})}function Ob(n,e){return new rf({type:"template_literal",parts:n,...O.normalizeParams(e)})}function of(n){return new sf({type:"lazy",getter:n})}function Nb(n){return new af({type:"promise",innerType:n})}function Mb(n){return new lf({type:"function",input:Array.isArray(n?.input)?Md(n?.input):n?.input??ke(Ke()),output:n?.output??Ke()})}function Ub(n){let e=new Ze({check:"custom"});return e._zod.check=n,e}function Ja(n,e){return Oy(Gs,n??(()=>!0),e)}function cf(n,e={}){return Ny(Gs,n,e)}function uf(n,e){return My(n,e)}function Bb(n,e={}){let t=new df({type:"custom",check:"custom",fn:i=>i instanceof n,abort:!0,...O.normalizeParams(e)});return t._zod.bag.Class=n,t._zod.check=i=>{i.value instanceof n||i.issues.push({code:"invalid_type",expected:n.name,input:i.value,inst:t,path:[...t._zod.def.path??[]]})},t}function Vb(n){let e=of(()=>Ue([L(n),Re(),ot(),Ns(),ke(e),Ge(L(),e)]));return e}function Ks(n,e){return new ef({type:"pipe",in:qa(n),out:e})}var xe,Aa,Fi,Ve,dr,fr,hr,mr,wa,Pa,Fn,Os,Ra,La,Da,Ca,Oa,Na,Ma,Ua,_d,Fa,za,Ba,ja,Va,Ga,Ed,Id,Ka,jr,zi,Vr,Bi,ji,Ha,Td,kd,$d,Ad,wd,Pd,Rd,Ms,Ld,Us,Fs,Dd,Cd,Od,Nd,Ni,Ud,Fd,Mi,zd,Bd,jd,Bs,Wa,Gd,Kd,Zd,Ya,Yd,Jd,Qd,js,Vs,ef,tf,rf,sf,af,lf,Gs,Fb,zb,df,jb,Gr=G(()=>{cn();cn();Ia();gi();xa();Yv();ld();R0();xe=w("ZodType",(n,e)=>(SM(),ye.init(n,e),n.def=e,n.type=e.type,n),{check(...n){let e=this.def;return this.clone(O.mergeDefs(e,{checks:[...e.checks??[],...n.map(t=>typeof t=="function"?{_zod:{check:t,def:{check:"custom"},onattach:[]}}:t)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,e){return Me(this,n,e)},brand(){return this},register(n,e){return n.add(this,e),this},refine(n,e){return this.check(cf(n,e))},superRefine(n,e){return this.check(uf(n,e))},overwrite(n){return this.check(En(n))},optional(){return je(this)},exactOptional(){return Vd(this)},nullable(){return Cs(this)},nullish(){return je(Cs(this))},nonoptional(n){return Wd(this,n)},array(){return ke(this)},or(n){return Ue([this,n])},and(n){return Vi(this,n)},transform(n){return $a(this,qa(n))},default(n){return Hd(this,n)},prefault(n){return qd(this,n)},catch(n){return Xd(this,n)},pipe(n){return $a(this,n)},readonly(){return nf(this)},describe(n){let e=this.clone();return Et.add(e,{description:n}),e},meta(...n){if(n.length===0)return Et.get(this);let e=this.clone();return Et.add(e,n[0]),e},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n,...e){return e.length===0?n(this):n(this,...e)},get"~standard"(){return O.hide(this,"~standard",{...nu(this),jsonSchema:{input:Rs(this,"input"),output:Rs(this,"output")}})},set"~standard"(n){O.own(this,"~standard",n)},parse:function n(e,t){return ud(this,e,t,{callee:n})},parseAsync:async function n(e,t){return await dd(this,e,t,{callee:n})},safeParse(n,e){return fd(this,n,e)},async safeParseAsync(n,e){return hd(this,n,e)},get spa(){return this?.safeParseAsync},set spa(n){O.own(this,"spa",n)},validate(n,e){return hi(this,n,e)},validateAsync(n,e){return mi(this,n,e)},encode:function n(e,t){return md(this,e,t,{callee:n})},decode:function n(e,t){return pd(this,e,t,{callee:n})},encodeAsync:async function n(e,t){return await gd(this,e,t,{callee:n})},decodeAsync:async function n(e,t){return await vd(this,e,t,{callee:n})},safeEncode(n,e){return yd(this,n,e)},safeDecode(n,e){return bd(this,n,e)},async safeEncodeAsync(n,e){return Sd(this,n,e)},async safeDecodeAsync(n,e){return xd(this,n,e)},toJSONSchema(n){return jy(this,{})(n)},get description(){return Et.get(this)?.description},get _def(){return this._zod.def}}),Aa=w("_ZodString",(n,e)=>{yi.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Ky(n,t,i,r)},O.derived({format:n=>gt(n).format??null,minLength:n=>gt(n).minimum??null,maxLength:n=>gt(n).maximum??null},{regex(...n){return this.check(_i(...n))},includes(...n){return this.check(Ti(...n))},startsWith(...n){return this.check(ki(...n))},endsWith(...n){return this.check($i(...n))},min(...n){return this.check(Wn(...n))},max(...n){return this.check(Mr(...n))},length(...n){return this.check(Ur(...n))},nonempty(...n){return this.check(Wn(1,...n))},lowercase(n){return this.check(Ei(n))},uppercase(n){return this.check(Ii(n))},trim(){return this.check(Ri())},normalize(...n){return this.check(Pi(...n))},toLowerCase(){return this.check(Li())},toUpperCase(){return this.check(Di())},slugify(){return this.check(Ci())}})),Fi=w("ZodString",(n,e)=>{yi.init(n,e),Aa.init(n,e)},{email(n){return this.check(Du(wa,n))},url(n){return this.check(ua(Os,n))},jwt(n){return this.check(Qu(Ka,n))},emoji(n){return this.check(Fu(Ra,n))},guid(n){return this.check(Cu(Pa,n))},uuid(n){return this.check(Ou(Fn,n))},uuidv4(n){return this.check(Nu(Fn,n))},uuidv6(n){return this.check(Mu(Fn,n))},uuidv7(n){return this.check(Uu(Fn,n))},nanoid(n){return this.check(zu(La,n))},cuid(n){return this.check(Bu(Da,n))},cuid2(n){return this.check(ju(Ca,n))},ulid(n){return this.check(Vu(Oa,n))},base64(n){return this.check(Yu(ja,n))},base64url(n){return this.check(Ju(Va,n))},xid(n){return this.check(Gu(Na,n))},ksuid(n){return this.check(Ku(Ma,n))},ipv4(n){return this.check(Hu(Ua,n))},ipv6(n){return this.check(Zu(Fa,n))},cidrv4(n){return this.check(qu(za,n))},cidrv6(n){return this.check(Wu(Ba,n))},e164(n){return this.check(Xu(Ga,n))},datetime(n){return this.check(da(dr,n))},date(n){return this.check(fa(fr,n))},time(n){return this.check(ha(hr,n))},duration(n){return this.check(ma(mr,n))}});Ve=w("ZodStringFormat",(n,e)=>{ze.init(n,e),Aa.init(n,e)}),dr=w("ZodISODateTime",(n,e)=>{qg.init(n,e),Ve.init(n,e)}),fr=w("ZodISODate",(n,e)=>{Wg.init(n,e),Ve.init(n,e)}),hr=w("ZodISOTime",(n,e)=>{Yg.init(n,e),Ve.init(n,e)}),mr=w("ZodISODuration",(n,e)=>{Jg.init(n,e),Ve.init(n,e)}),wa=w("ZodEmail",(n,e)=>{Mg.init(n,e),Ve.init(n,e)});Pa=w("ZodGUID",(n,e)=>{Og.init(n,e),Ve.init(n,e)});Fn=w("ZodUUID",(n,e)=>{Ng.init(n,e),Ve.init(n,e)});Os=w("ZodURL",(n,e)=>{zg.init(n,e),Ve.init(n,e)});Ra=w("ZodEmoji",(n,e)=>{Bg.init(n,e),Ve.init(n,e)});La=w("ZodNanoID",(n,e)=>{jg.init(n,e),Ve.init(n,e)});Da=w("ZodCUID",(n,e)=>{Vg.init(n,e),Ve.init(n,e)});Ca=w("ZodCUID2",(n,e)=>{Gg.init(n,e),Ve.init(n,e)});Oa=w("ZodULID",(n,e)=>{Kg.init(n,e),Ve.init(n,e)});Na=w("ZodXID",(n,e)=>{Hg.init(n,e),Ve.init(n,e)});Ma=w("ZodKSUID",(n,e)=>{Zg.init(n,e),Ve.init(n,e)});Ua=w("ZodIPv4",(n,e)=>{Xg.init(n,e),Ve.init(n,e)});_d=w("ZodMAC",(n,e)=>{ev.init(n,e),Ve.init(n,e)});Fa=w("ZodIPv6",(n,e)=>{Qg.init(n,e),Ve.init(n,e)});za=w("ZodCIDRv4",(n,e)=>{tv.init(n,e),Ve.init(n,e)});Ba=w("ZodCIDRv6",(n,e)=>{nv.init(n,e),Ve.init(n,e)});ja=w("ZodBase64",(n,e)=>{rv.init(n,e),Ve.init(n,e)});Va=w("ZodBase64URL",(n,e)=>{iv.init(n,e),Ve.init(n,e)});Ga=w("ZodE164",(n,e)=>{sv.init(n,e),Ve.init(n,e)});Ed=w("ZodCreditCard",(n,e)=>{ov.init(n,e),Ve.init(n,e)});Id=w("ZodIBAN",(n,e)=>{av.init(n,e),Ve.init(n,e)});Ka=w("ZodJWT",(n,e)=>{lv.init(n,e),Ve.init(n,e)});jr=w("ZodCustomStringFormat",(n,e)=>{cv.init(n,e),Ve.init(n,e)});zi=w("ZodNumber",(n,e)=>{fu.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Hy(n,t,i,r),n.isFinite=!0},O.derived({minValue:n=>{let{minimum:e,exclusiveMinimum:t}=gt(n);return Math.max(e??Number.NEGATIVE_INFINITY,t??Number.NEGATIVE_INFINITY)},maxValue:n=>{let{maximum:e,exclusiveMaximum:t}=gt(n);return Math.min(e??Number.POSITIVE_INFINITY,t??Number.POSITIVE_INFINITY)},isInt:n=>{let{isInt:e,multipleOf:t}=gt(n);return!!e||!!t?.some(Number.isSafeInteger)},format:n=>gt(n).format??null},{gt(n,e){return this.check(Mn(n,e))},gte(n,e){return this.check(ln(n,e))},min(n,e){return this.check(ln(n,e))},lt(n,e){return this.check(Nn(n,e))},lte(n,e){return this.check(an(n,e))},max(n,e){return this.check(an(n,e))},int(n){return this.check(ka(n))},safe(n){return this.check(ka(n))},positive(n){return this.check(Mn(0,n))},nonnegative(n){return this.check(ln(0,n))},negative(n){return this.check(Nn(0,n))},nonpositive(n){return this.check(an(0,n))},multipleOf(n,e){return this.check(cr(n,e))},step(n,e){return this.check(cr(n,e))},finite(){return this}}));Vr=w("ZodNumberFormat",(n,e)=>{uv.init(n,e),zi.init(n,e)});Bi=w("ZodBoolean",(n,e)=>{ea.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Zy(n,t,i,r)});ji=w("ZodBigInt",(n,e)=>{hu.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>qy(n,t,i,r)},O.derived({minValue:n=>gt(n).minimum??null,maxValue:n=>gt(n).maximum??null,format:n=>gt(n).format??null},{gte(n,e){return this.check(ln(n,e))},min(n,e){return this.check(ln(n,e))},gt(n,e){return this.check(Mn(n,e))},lt(n,e){return this.check(Nn(n,e))},lte(n,e){return this.check(an(n,e))},max(n,e){return this.check(an(n,e))},positive(n){return this.check(Mn(BigInt(0),n))},negative(n){return this.check(Nn(BigInt(0),n))},nonpositive(n){return this.check(an(BigInt(0),n))},nonnegative(n){return this.check(ln(BigInt(0),n))},multipleOf(n,e){return this.check(cr(n,e))}}));Ha=w("ZodBigIntFormat",(n,e)=>{dv.init(n,e),ji.init(n,e)});Td=w("ZodSymbol",(n,e)=>{fv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Wy(n,t,i,r)});kd=w("ZodUndefined",(n,e)=>{hv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Jy(n,t,i,r)});$d=w("ZodNull",(n,e)=>{mv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Yy(n,t,i,r)});Ad=w("ZodAny",(n,e)=>{pv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>e0(n,t,i,r)});wd=w("ZodUnknown",(n,e)=>{gv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>t0(n,t,i,r)});Pd=w("ZodNever",(n,e)=>{vv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Qy(n,t,i,r)});Rd=w("ZodVoid",(n,e)=>{yv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Xy(n,t,i,r)});Ms=w("ZodDate",(n,e)=>{bv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>n0(n,t,i,r),n.min=(t,i)=>n.check(ln(t,i)),n.max=(t,i)=>n.check(an(t,i))},O.derived({minDate:n=>{let{minimum:e}=gt(n);return e?new Date(e):null},maxDate:n=>{let{maximum:e}=gt(n);return e?new Date(e):null}},{}));Ld=w("ZodArray",(n,e)=>{Ui(),xv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>m0(n,t,i,r),n.element=e.element},{min(n,e){return this.check(Wn(n,e))},nonempty(n){return this.check(Wn(1,n))},max(n,e){return this.check(Mr(n,e))},length(n,e){return this.check(Ur(n,e))},unwrap(){return this.element}});Us=w("ZodObject",(n,e)=>{Ui(),_v.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>p0(n,t,i,r),O.installLazyProp(n,"shape",t=>t._zod.def.shape,!1)},{keyof(){return Tt(Object.keys(this._zod.def.shape))},catchall(n){return this.clone(O.mergeDefs(this._zod.def,{catchall:n}))},passthrough(){return this.clone(O.mergeDefs(this._zod.def,{catchall:Ke()}))},loose(){return this.clone(O.mergeDefs(this._zod.def,{catchall:Ke()}))},strict(){return this.clone(O.mergeDefs(this._zod.def,{catchall:Za()}))},strip(){return this.clone(O.mergeDefs(this._zod.def,{catchall:void 0}))},extend(n){return O.extend(this,n)},safeExtend(n){return O.safeExtend(this,n)},merge(n){return O.merge(this,n)},pick(n){return O.pick(this,n)},omit(n){return O.omit(this,n)},partial(...n){return O.partial(Bs,this,n[0])},exactPartial(...n){return O.partial(Wa,this,n[0],"exactPartial")},required(...n){return O.required(Ya,this,n[0])}});Fs=w("ZodUnion",(n,e)=>{ta.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>nd(n,t,i,r),n.options=e.options});Dd=w("ZodXor",(n,e)=>{Fs.init(n,e),Ev.init(n,e),n._zod.processJSONSchema=(t,i,r)=>nd(n,t,i,r),n.options=e.options});Cd=w("ZodDiscriminatedUnion",(n,e)=>{Fs.init(n,e),Iv.init(n,e)});Od=w("ZodIntersection",(n,e)=>{Tv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>g0(n,t,i,r)});Nd=w("ZodTuple",(n,e)=>{Ui(),pu.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>v0(n,t,i,r)},{rest(n){return this.clone({...this._zod.def,rest:n})},partial(){let n=this._zod.def;if(n.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...n,items:n.items.map(e=>new Bs({type:"optional",innerType:e}))})}});Ni=w("ZodRecord",(n,e)=>{Ui(),kv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>y0(n,t,i,r),n.keyType=e.keyType,n.valueType=e.valueType});Ud=w("ZodMap",(n,e)=>{Ui(),$v.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>f0(n,t,i,r),n.keyType=e.keyType,n.valueType=e.valueType,n.min=(...t)=>n.check(Un(...t)),n.nonempty=t=>n.check(Un(1,t)),n.max=(...t)=>n.check(ur(...t)),n.size=(...t)=>n.check(Nr(...t))});Fd=w("ZodSet",(n,e)=>{Ui(),Av.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>h0(n,t,i,r),n.min=(...t)=>n.check(Un(...t)),n.nonempty=t=>n.check(Un(1,t)),n.max=(...t)=>n.check(ur(...t)),n.size=(...t)=>n.check(Nr(...t))});Mi=w("ZodEnum",(n,e)=>{wv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(i,r,s)=>r0(n,i,r,s),n.enum=e.entries,n.options=[...n._zod.values];let t=new Set(Object.keys(e.entries));n.extract=(i,r)=>{let s={};for(let o of i)if(t.has(o))s[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Mi({...e,checks:[],...O.normalizeParams(r),entries:s})},n.exclude=(i,r)=>{let s={...e.entries};for(let o of i)if(t.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new Mi({...e,checks:[],...O.normalizeParams(r),entries:s})}});zd=w("ZodLiteral",(n,e)=>{Pv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>i0(n,t,i,r),n.values=new Set(e.values),Object.defineProperty(n,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});Bd=w("ZodFile",(n,e)=>{Rv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>a0(n,t,i,r),n.min=(t,i)=>n.check(Un(t,i)),n.max=(t,i)=>n.check(ur(t,i)),n.mime=(t,i)=>n.check(wi(Array.isArray(t)?t:[t],i))});jd=w("ZodTransform",(n,e)=>{Ui(),Lv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>d0(n,t,i,r),n._zod.parse=(t,i)=>{if(i.direction==="backward")throw new Cr(n.constructor.name);t.addIssue=s=>{if(typeof s=="string")t.issues.push(O.issue(s,t.value,e));else{let o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=t.value),o.inst??(o.inst=n),t.issues.push(O.issue(o))}};let r=e.transform(t.value,t);return r instanceof Promise?r.then(s=>(t.value=s,t)):(t.value=r,t)}});Bs=w("ZodOptional",(n,e)=>{gu.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>rd(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});Wa=w("ZodExactOptional",(n,e)=>{Dv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>rd(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});Gd=w("ZodNullable",(n,e)=>{Cv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>b0(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});Kd=w("ZodDefault",(n,e)=>{Ov.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>_0(n,t,i,r),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});Zd=w("ZodPrefault",(n,e)=>{Nv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>E0(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});Ya=w("ZodNonOptional",(n,e)=>{Mv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>S0(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});Yd=w("ZodSuccess",(n,e)=>{Uv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>l0(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});Jd=w("ZodCatch",(n,e)=>{Fv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>I0(n,t,i,r),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});Qd=w("ZodNaN",(n,e)=>{zv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>s0(n,t,i,r)});js=w("ZodPipe",(n,e)=>{vu.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>T0(n,t,i,r),n.in=e.in,n.out=e.out});Vs=w("ZodCodec",(n,e)=>{js.init(n,e),na.init(n,e)});ef=w("ZodPreprocess",(n,e)=>{js.init(n,e),Bv.init(n,e)}),tf=w("ZodReadonly",(n,e)=>{jv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>k0(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});rf=w("ZodTemplateLiteral",(n,e)=>{Vv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>o0(n,t,i,r)});sf=w("ZodLazy",(n,e)=>{ra.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>A0(n,t,i,r),n.unwrap=()=>n._zod.def.getter()});af=w("ZodPromise",(n,e)=>{Kv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>$0(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});lf=w("ZodFunction",(n,e)=>{Gv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>u0(n,t,i,r)});Gs=w("ZodCustom",(n,e)=>{Hv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>c0(n,t,i,r)});Fb=Uy,zb=Fy,df=w("ZodInstanceOf",(n,e)=>{Gs.init(n,e)},{properties(n,e){return this.check(Ai(n,e))}});jb=(...n)=>zy({Codec:Vs,Boolean:Bi,String:Fi},...n)});function q$(n){it({customError:n})}function W$(){return it().customError}var Z$,ff,Y$=G(()=>{cn();Z$={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};ff||(ff={})});var Kr={};jn(Kr,{ZodISODate:()=>fr,ZodISODateTime:()=>dr,ZodISODuration:()=>mr,ZodISOTime:()=>hr,date:()=>_M,datetime:()=>xM,duration:()=>IM,time:()=>EM});function xM(n){return da(dr,n)}function _M(n){return fa(fr,n)}function EM(n){return ha(hr,n)}function IM(n){return ma(mr,n)}var hf=G(()=>{cn();Gr();Gr()});function kM(n,e){let t=n.$schema;return t==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":t==="http://json-schema.org/draft-07/schema#"?"draft-7":t==="http://json-schema.org/draft-04/schema#"?"draft-4":e??"draft-2020-12"}function J$(n,e){return n.map((t,i)=>i<e?t:t.optional())}function $M(n){return n.replace(/~1/g,"/").replace(/~0/g,"~")}function AM(n,e){if(!n.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let t=n.slice(1).split("/").filter(Boolean);if(t.length===0)return e.rootSchema;let i=e.version==="draft-2020-12"?"$defs":"definitions";if(t[0]===i){let r=t[1]===void 0?void 0:$M(t[1]);if(!r||!e.defs[r])throw new Error(`Reference not found: ${n}`);return e.defs[r]}throw new Error(`Reference not found: ${n}`)}function wM(n,e){return Q.transform(i=>i).check(i=>{let r=i.value;if(typeof r!="object"||r===null||Array.isArray(r))return;let s=Object.getOwnPropertyNames(r);if(e.minProperties!==void 0&&s.length<e.minProperties&&i.issues.push({origin:"object",code:"too_small",minimum:e.minProperties,inclusive:!0,message:`Too small: expected object to have >=${e.minProperties} properties`,input:r,inst:n,continue:!0}),e.maxProperties!==void 0&&s.length>e.maxProperties&&i.issues.push({origin:"object",code:"too_big",maximum:e.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${e.maxProperties} properties`,input:r,inst:n,continue:!0}),e.keySchema)for(let o of s){let a=e.keySchema.safeParse(o);a.success||i.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:o,path:[o],continue:!0})}}).pipe(n)}function Gb(n,e){if(n===null)return"z";let t=typeof n;if(t!=="object"){if(t==="number"&&Number.isNaN(n))return null;let i=String(n);return`${t[0]}${i.length}:${i}`}if(e.has(n))return null;e.add(n);try{if(Array.isArray(n)){let s=[];for(let o of n){let a=Gb(o,e);if(a===null)return null;s.push(a)}return`a${s.length}:[${s.join(",")}]`}let i=Object.keys(n).sort(),r=[];for(let s of i){let o=Gb(n[s],e);if(o===null)return null;r.push(`${s.length}:${s}=${o}`)}return`o${r.length}:{${r.join(",")}}`}finally{e.delete(n)}}function Xa(n){return typeof n!="object"||n===null?!1:Array.isArray(n)?n.some(Xa):typeof n.$ref=="string"?!0:Object.entries(n).some(([e,t])=>PM.has(e)?Xa(t):!RM.has(e)||typeof t!="object"||t===null?!1:Object.values(t).some(Xa))}function X$(n){return n===1?"element":"elements"}function LM(n,e){return Q.transform(i=>i).check(i=>{let r=i.value;if(Array.isArray(r)){if(e.uniqueItems===!0){let s=new Map;for(let o=0;o<r.length;o++){let a=Gb(r[o],new Set);if(a===null)continue;let l=s.get(a);if(l===void 0){s.set(a,o);continue}i.issues.push({code:"custom",message:`Array items must be unique: element at index ${o} duplicates the one at index ${l}`,input:r,path:[o],continue:!0})}}if(e.containsSchema){let s=e.minContains??1,o=e.maxContains!==void 0?e.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let l of r)if(e.containsSchema.safeParse(l).success&&++a>=o)break;a<s&&i.issues.push({code:"custom",message:`Array must contain at least ${s} matching ${X$(s)}; found ${a}`,input:r,continue:!0}),e.maxContains!==void 0&&a>e.maxContains&&i.issues.push({code:"custom",message:`Array must contain at most ${e.maxContains} matching ${X$(e.maxContains)}`,input:r,continue:!0})}}}).pipe(n)}function Q$(n,e){if(n!==!1)return n===void 0||n===!0?Q.any():Zt(n,e)}function eA(n,e){if(n.not!==void 0){if(typeof n.not=="object"&&Object.keys(n.not).length===0)return Q.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(n.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(n.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(n.if!==void 0||n.then!==void 0||n.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(n.dependentSchemas!==void 0||n.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(n.$ref){let r=n.$ref;if(e.refs.has(r))return e.refs.get(r);if(e.processing.has(r))return Q.lazy(()=>{if(!e.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return e.refs.get(r)});e.processing.add(r);let s=AM(r,e),o=Zt(s,e);return e.refs.set(r,o),e.processing.delete(r),o}if(n.enum!==void 0){let r=n.enum;if(e.version==="openapi-3.0"&&n.nullable===!0&&r.length===1&&r[0]===null)return Q.null();if(r.length===0)return Q.never();if(r.length===1)return Q.literal(r[0]);if(r.every(o=>typeof o=="string"))return Q.enum(r);let s=r.map(o=>Q.literal(o));return s.length<2?s[0]:Q.union([s[0],s[1],...s.slice(2)])}if(n.const!==void 0)return Q.literal(n.const);let t=n.type;if(Array.isArray(t)){let r=t.map(s=>{let o={...n,type:s};return eA(o,e)});return r.length===0?Q.never():r.length===1?r[0]:Q.union(r)}if(!t)return Q.any();let i;switch(t){case"string":{let r=Q.string();if(n.format){let s=n.format;s==="email"?r=r.check(Q.email()):s==="uri"||s==="uri-reference"?r=r.check(Q.url()):s==="uuid"||s==="guid"?r=r.check(Q.uuid()):s==="date-time"?r=r.check(Q.iso.datetime({offset:!0})):s==="date"?r=r.check(Q.iso.date()):s==="time"?r=r.check(Q.regex(DM)):s==="duration"?r=r.check(Q.iso.duration()):s==="hostname"?r=r.check(Q.hostname()):s==="ipv4"?r=r.check(Q.ipv4()):s==="ipv6"?r=r.check(Q.ipv6()):s==="mac"?r=r.check(Q.mac()):s==="cidr"?r=r.check(Q.cidrv4()):s==="cidr-v6"?r=r.check(Q.cidrv6()):s==="base64"?r=r.check(Q.base64()):s==="base64url"?r=r.check(Q.base64url()):s==="e164"?r=r.check(Q.e164()):s==="credit_card"?r=r.check(Q.creditCard()):s==="iban"?r=r.check(Q.iban()):s==="jwt"?r=r.check(Q.jwt()):s==="emoji"?r=r.check(Q.emoji()):s==="nanoid"?r=r.check(Q.nanoid()):s==="cuid"?r=r.check(Q.cuid()):s==="cuid2"?r=r.check(Q.cuid2()):s==="ulid"?r=r.check(Q.ulid()):s==="xid"?r=r.check(Q.xid()):s==="ksuid"&&(r=r.check(Q.ksuid()))}typeof n.minLength=="number"&&(r=r.min(n.minLength)),typeof n.maxLength=="number"&&(r=r.max(n.maxLength)),n.pattern&&(r=r.regex(new RegExp(n.pattern))),i=r;break}case"number":case"integer":{let r=t==="integer"?Q.number().int():Q.number();typeof n.minimum=="number"&&n.exclusiveMinimum!==!0&&(r=r.min(n.minimum)),typeof n.maximum=="number"&&n.exclusiveMaximum!==!0&&(r=r.max(n.maximum)),typeof n.exclusiveMinimum=="number"?r=r.gt(n.exclusiveMinimum):n.exclusiveMinimum===!0&&typeof n.minimum=="number"&&(r=r.gt(n.minimum)),typeof n.exclusiveMaximum=="number"?r=r.lt(n.exclusiveMaximum):n.exclusiveMaximum===!0&&typeof n.maximum=="number"&&(r=r.lt(n.maximum)),typeof n.multipleOf=="number"&&(r=r.multipleOf(n.multipleOf)),i=r;break}case"boolean":{i=Q.boolean();break}case"null":{i=Q.null();break}case"object":{let r={},s=n.properties||{},o=new Set(n.required||[]),a=typeof n.additionalProperties=="object"?Zt(n.additionalProperties,e):void 0;for(let[d,f]of Object.entries(s)){let h=Zt(f,e);Rt(r,d,o.has(d)?h:h.optional())}if(n.patternProperties){let d=n.patternProperties,f=Object.keys(d),h=[];for(let p of f){let g=Zt(d[p],e),y=Q.string().regex(new RegExp(p));h.push(Q.looseRecord(y,g))}let m=[];if(Object.keys(r).length>0&&m.push(Q.object(r).passthrough()),m.push(...h),m.length===0)i=Q.object({}).passthrough();else if(m.length===1)i=m[0];else{let p=Q.intersection(m[0],m[1]);for(let g=2;g<m.length;g++)p=Q.intersection(p,m[g]);i=p}if(n.additionalProperties===!1){let p=Object.keys(r),g=f.map(b=>new RegExp(b)),y=i;i=i.check(b=>{if(!Sn(b.value))return;let S=[];for(let x of Object.keys(b.value))p.includes(x)||g.some(_=>_.test(x))||S.push(x);S.length&&b.issues.push({code:"unrecognized_keys",keys:S,input:b.value,inst:y})})}}else{let d=Q.object(r);n.additionalProperties===!1?i=d.strict():a?i=d.catchall(a):i=d.passthrough()}let l=n.propertyNames!==void 0&&n.propertyNames!==!0,c=typeof n.minProperties=="number"?n.minProperties:void 0,u=typeof n.maxProperties=="number"?n.maxProperties:void 0;if(l||c!==void 0||u!==void 0){let d;if(l){let f=typeof n.propertyNames=="object"&&n.propertyNames.type===void 0?{type:"string",...n.propertyNames}:n.propertyNames;d=Zt(f,e)}i=wM(i,{keySchema:d,minProperties:c,maxProperties:u})}break}case"array":{let r=n.prefixItems,s=n.items;if(r&&Array.isArray(r)){let o=typeof n.minItems=="number"?n.minItems:0,a=r.map(d=>Zt(d,e)),l=J$(a,o),c=Array.isArray(s)?void 0:Q$(s,e),u=Q.tuple(l);i=c?u.rest(c):u,typeof n.minItems=="number"&&(i=i.check(Q.minLength(n.minItems))),typeof n.maxItems=="number"&&(i=i.check(Q.maxLength(n.maxItems)))}else if(Array.isArray(s)){let o=typeof n.minItems=="number"?n.minItems:0,a=s.map(d=>Zt(d,e)),l=J$(a,o),c=Q$(n.additionalItems,e),u=Q.tuple(l);i=c?u.rest(c):u,typeof n.minItems=="number"&&(i=i.check(Q.minLength(n.minItems))),typeof n.maxItems=="number"&&(i=i.check(Q.maxLength(n.maxItems)))}else if(s!==void 0){let o=Zt(s,e),a=Q.array(o);typeof n.minItems=="number"&&(a=a.min(n.minItems)),typeof n.maxItems=="number"&&(a=a.max(n.maxItems)),i=a}else i=Q.array(Q.any());(n.uniqueItems===!0||n.contains!==void 0)&&(i=LM(i,{uniqueItems:n.uniqueItems===!0,containsSchema:n.contains!==void 0?Zt(n.contains,e):void 0,minContains:typeof n.minContains=="number"?n.minContains:void 0,maxContains:typeof n.maxContains=="number"?n.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${t}`)}return i}function Zt(n,e){if(typeof n=="boolean")return n?Q.any():Q.never();let t=eA(n,e),i=n.type||n.enum!==void 0||n.const!==void 0;if(n.anyOf&&Array.isArray(n.anyOf)){let a=n.anyOf.map(c=>Zt(c,e)),l=Q.union(a);t=i?Q.intersection(t,l):l}if(n.oneOf&&Array.isArray(n.oneOf)){let a=n.oneOf.map(c=>Zt(c,e)),l=Q.xor(a);t=i?Q.intersection(t,l):l}if(n.allOf&&Array.isArray(n.allOf))if(n.allOf.length===0)t=i?t:Q.any();else{let a=i?t:Zt(n.allOf[0],e),l=i?0:1;for(let c=l;c<n.allOf.length;c++)a=Q.intersection(a,Zt(n.allOf[c],e));t=a}n.nullable===!0&&e.version==="openapi-3.0"&&(t=Q.nullable(t)),n.readOnly===!0&&(t=Q.readonly(t)),n.default!==void 0&&(t=t.default(n.default));let r={},s=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of s)a in n&&(r[a]=n[a]);let o=["contentEncoding","contentMediaType","contentSchema"];for(let a of o)a in n&&(r[a]=n[a]);if(n.type==="object"&&n.$ref===void 0){n.propertyNames!==void 0&&!Xa(n.propertyNames)&&(r.propertyNames=n.propertyNames);for(let a of["minProperties","maxProperties"])n[a]!==void 0&&(r[a]=n[a])}if(n.type==="array"&&n.$ref===void 0){n.contains!==void 0&&!Xa(n.contains)&&(r.contains=n.contains);for(let a of["uniqueItems","minContains","maxContains"])n[a]!==void 0&&(r[a]=n[a])}for(let a of Object.keys(n))TM.has(a)||Rt(r,a,n[a]);return Object.keys(r).length>0&&e.registry.add(t,r),n.description&&(t=t.describe(n.description)),t}function Kb(n,e){if(typeof n=="boolean")return n?Q.any():Q.never();let t;try{t=JSON.parse(JSON.stringify(n))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=kM(t,e?.defaultTarget),r=t.$defs||t.definitions||{},s={version:i,defs:r,refs:new Map,processing:new Set,rootSchema:t,registry:e?.registry??Et};return Zt(t,s)}var Q,TM,PM,RM,DM,tA=G(()=>{la();J();ld();hf();Gr();Q={...Hs,...ad,iso:Kr},TM=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);PM=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),RM=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);DM=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/});function Hb(n){return Ta(n,{object:e=>e.partial(),union:e=>{let t=e._zod.def;return t.discriminator===void 0?e:Ue(t.options)}})}var nA=G(()=>{w0();Gr()});function CM(n,e){if(!e?.length)return n;let t=n._zod.def;return Me(n,On(t,{checks:[...t.checks??[],...e]}),{parent:!0})}function rA(n){return CM(n.out,n.checks)}function OM(n){return n.in._zod.traits.has("$ZodTransform")?rA(n):n.in}function Zb(n){return Ta(n,{pipe:e=>OM(e._zod.def),default:(e,t)=>t?je(e._zod.def.innerType):e,catch:(e,t)=>t?e._zod.def.innerType:e})}function qb(n){return Ta(n,{pipe:e=>rA(e._zod.def),prefault:(e,t)=>t?e._zod.def.innerType:e})}var iA=G(()=>{J();w0();Gr()});var mf={};jn(mf,{bigint:()=>FM,boolean:()=>UM,date:()=>zM,number:()=>MM,string:()=>NM});function NM(n){return oy(Fi,n)}function MM(n){return dy(zi,n)}function UM(n){return yy(Bi,n)}function FM(n){return Sy(ji,n)}function zM(n){return Ry(Ms,n)}var sA=G(()=>{cn();Gr()});var E={};jn(E,{$brand:()=>Rc,$input:()=>wu,$output:()=>Au,INVALID:()=>Ut,NEVER:()=>Pc,TimePrecision:()=>ed,ZodAny:()=>Ad,ZodArray:()=>Ld,ZodBase64:()=>ja,ZodBase64URL:()=>Va,ZodBigInt:()=>ji,ZodBigIntFormat:()=>Ha,ZodBoolean:()=>Bi,ZodCIDRv4:()=>za,ZodCIDRv6:()=>Ba,ZodCUID:()=>Da,ZodCUID2:()=>Ca,ZodCatch:()=>Jd,ZodCodec:()=>Vs,ZodCompileAsyncError:()=>_n,ZodCompileUnsupportedError:()=>$e,ZodCreditCard:()=>Ed,ZodCustom:()=>Gs,ZodCustomStringFormat:()=>jr,ZodDate:()=>Ms,ZodDefault:()=>Kd,ZodDiscriminatedUnion:()=>Cd,ZodE164:()=>Ga,ZodEmail:()=>wa,ZodEmoji:()=>Ra,ZodEnum:()=>Mi,ZodError:()=>H$,ZodExactOptional:()=>Wa,ZodFile:()=>Bd,ZodFirstPartyTypeKind:()=>ff,ZodFunction:()=>lf,ZodGUID:()=>Pa,ZodIBAN:()=>Id,ZodIPv4:()=>Ua,ZodIPv6:()=>Fa,ZodISODate:()=>fr,ZodISODateTime:()=>dr,ZodISODuration:()=>mr,ZodISOTime:()=>hr,ZodInstanceOf:()=>df,ZodIntersection:()=>Od,ZodIssueCode:()=>Z$,ZodJWT:()=>Ka,ZodKSUID:()=>Ma,ZodLazy:()=>sf,ZodLiteral:()=>zd,ZodMAC:()=>_d,ZodMap:()=>Ud,ZodNaN:()=>Qd,ZodNanoID:()=>La,ZodNever:()=>Pd,ZodNonOptional:()=>Ya,ZodNull:()=>$d,ZodNullable:()=>Gd,ZodNumber:()=>zi,ZodNumberFormat:()=>Vr,ZodObject:()=>Us,ZodOptional:()=>Bs,ZodPipe:()=>js,ZodPrefault:()=>Zd,ZodPreprocess:()=>ef,ZodPromise:()=>af,ZodReadonly:()=>tf,ZodRealError:()=>Ht,ZodRecord:()=>Ni,ZodSet:()=>Fd,ZodString:()=>Fi,ZodStringFormat:()=>Ve,ZodSuccess:()=>Yd,ZodSymbol:()=>Td,ZodTemplateLiteral:()=>rf,ZodTransform:()=>jd,ZodTuple:()=>Nd,ZodType:()=>xe,ZodULID:()=>Oa,ZodURL:()=>Os,ZodUUID:()=>Fn,ZodUndefined:()=>kd,ZodUnion:()=>Fs,ZodUnknown:()=>wd,ZodVoid:()=>Rd,ZodXID:()=>Na,ZodXor:()=>Dd,_ZodString:()=>Aa,_default:()=>Hd,_function:()=>Mb,any:()=>yb,array:()=>ke,base64:()=>X0,base64url:()=>Q0,bigint:()=>hb,boolean:()=>ot,catch:()=>Xd,check:()=>Ub,cidrv4:()=>Y0,cidrv6:()=>J0,clone:()=>Me,codec:()=>Db,coerce:()=>mf,compile:()=>Pu,config:()=>it,core:()=>Yn,creditCard:()=>tb,cuid:()=>j0,cuid2:()=>V0,currencyCode:()=>ab,custom:()=>Ja,date:()=>Sb,decode:()=>pd,decodeAsync:()=>vd,deepPartial:()=>Hb,describe:()=>Fb,discriminatedUnion:()=>zs,e164:()=>eb,email:()=>L0,emoji:()=>z0,encode:()=>md,encodeAsync:()=>gd,endsWith:()=>$i,enum:()=>Tt,exactOptional:()=>Vd,file:()=>wb,flattenError:()=>vs,float32:()=>cb,float64:()=>ub,formatError:()=>ys,fromJSONSchema:()=>Kb,function:()=>Mb,getDiscriminatedOption:()=>mu,getErrorMap:()=>W$,globalRegistry:()=>Et,gt:()=>Mn,gte:()=>ln,guid:()=>D0,hash:()=>lb,hex:()=>ob,hostname:()=>sb,httpUrl:()=>F0,iban:()=>nb,includes:()=>Ti,input:()=>Zb,instanceof:()=>Bb,int:()=>ka,int32:()=>db,int64:()=>mb,intersection:()=>Vi,invertCodec:()=>Cb,ipv4:()=>Z0,ipv6:()=>W0,iso:()=>Kr,json:()=>Vb,jwt:()=>rb,keyof:()=>xb,ksuid:()=>H0,lazy:()=>of,length:()=>Ur,literal:()=>ae,locales:()=>ws,looseObject:()=>It,looseRecord:()=>Tb,lowercase:()=>Ei,lt:()=>Nn,lte:()=>an,mac:()=>q0,map:()=>kb,maxLength:()=>Mr,maxSize:()=>ur,memoizer:()=>$s,meta:()=>zb,mime:()=>wi,minLength:()=>Wn,minSize:()=>Un,multipleOf:()=>cr,nan:()=>Lb,nanoid:()=>B0,nativeEnum:()=>Ab,negative:()=>ga,never:()=>Za,nonnegative:()=>ya,nonoptional:()=>Wd,nonpositive:()=>va,normalize:()=>Pi,null:()=>Ns,nullable:()=>Cs,nullish:()=>Pb,number:()=>Re,object:()=>re,optional:()=>je,output:()=>qb,overwrite:()=>En,parse:()=>ud,parseAsync:()=>dd,partialRecord:()=>Ib,pipe:()=>$a,positive:()=>pa,prefault:()=>qd,preprocess:()=>Ks,prettifyError:()=>Dc,promise:()=>Nb,properties:()=>Ai,property:()=>ba,readonly:()=>nf,record:()=>Ge,refine:()=>cf,regex:()=>_i,regexes:()=>gn,registry:()=>aa,safeDecode:()=>bd,safeDecodeAsync:()=>xd,safeEncode:()=>yd,safeEncodeAsync:()=>Sd,safeParse:()=>fd,safeParseAsync:()=>hd,set:()=>$b,setErrorMap:()=>q$,size:()=>Nr,slugify:()=>Ci,startsWith:()=>ki,strictObject:()=>_b,string:()=>L,stringFormat:()=>ib,stringbool:()=>jb,success:()=>Rb,superRefine:()=>uf,symbol:()=>gb,templateLiteral:()=>Ob,toJSONSchema:()=>Ea,toLowerCase:()=>Li,toUpperCase:()=>Di,toZod:()=>us,transform:()=>qa,treeifyError:()=>Lc,trim:()=>Ri,tuple:()=>Md,uint32:()=>fb,uint64:()=>pb,ulid:()=>G0,undefined:()=>vb,union:()=>Ue,unknown:()=>Ke,uppercase:()=>Ii,url:()=>U0,util:()=>O,uuid:()=>C0,uuidv4:()=>O0,uuidv6:()=>N0,uuidv7:()=>M0,validate:()=>hi,validateAsync:()=>mi,void:()=>bb,withParser:()=>ca,xid:()=>K0,xor:()=>Eb});var pf=G(()=>{cn();Gr();ld();P0();R0();Y$();cn();Ia();tA();nA();iA();Qv();hf();hf();sA()});var oA=G(()=>{pf();pf()});var Wb={};jn(Wb,{$brand:()=>Rc,$input:()=>wu,$output:()=>Au,INVALID:()=>Ut,NEVER:()=>Pc,TimePrecision:()=>ed,ZodAny:()=>Ad,ZodArray:()=>Ld,ZodBase64:()=>ja,ZodBase64URL:()=>Va,ZodBigInt:()=>ji,ZodBigIntFormat:()=>Ha,ZodBoolean:()=>Bi,ZodCIDRv4:()=>za,ZodCIDRv6:()=>Ba,ZodCUID:()=>Da,ZodCUID2:()=>Ca,ZodCatch:()=>Jd,ZodCodec:()=>Vs,ZodCompileAsyncError:()=>_n,ZodCompileUnsupportedError:()=>$e,ZodCreditCard:()=>Ed,ZodCustom:()=>Gs,ZodCustomStringFormat:()=>jr,ZodDate:()=>Ms,ZodDefault:()=>Kd,ZodDiscriminatedUnion:()=>Cd,ZodE164:()=>Ga,ZodEmail:()=>wa,ZodEmoji:()=>Ra,ZodEnum:()=>Mi,ZodError:()=>H$,ZodExactOptional:()=>Wa,ZodFile:()=>Bd,ZodFirstPartyTypeKind:()=>ff,ZodFunction:()=>lf,ZodGUID:()=>Pa,ZodIBAN:()=>Id,ZodIPv4:()=>Ua,ZodIPv6:()=>Fa,ZodISODate:()=>fr,ZodISODateTime:()=>dr,ZodISODuration:()=>mr,ZodISOTime:()=>hr,ZodInstanceOf:()=>df,ZodIntersection:()=>Od,ZodIssueCode:()=>Z$,ZodJWT:()=>Ka,ZodKSUID:()=>Ma,ZodLazy:()=>sf,ZodLiteral:()=>zd,ZodMAC:()=>_d,ZodMap:()=>Ud,ZodNaN:()=>Qd,ZodNanoID:()=>La,ZodNever:()=>Pd,ZodNonOptional:()=>Ya,ZodNull:()=>$d,ZodNullable:()=>Gd,ZodNumber:()=>zi,ZodNumberFormat:()=>Vr,ZodObject:()=>Us,ZodOptional:()=>Bs,ZodPipe:()=>js,ZodPrefault:()=>Zd,ZodPreprocess:()=>ef,ZodPromise:()=>af,ZodReadonly:()=>tf,ZodRealError:()=>Ht,ZodRecord:()=>Ni,ZodSet:()=>Fd,ZodString:()=>Fi,ZodStringFormat:()=>Ve,ZodSuccess:()=>Yd,ZodSymbol:()=>Td,ZodTemplateLiteral:()=>rf,ZodTransform:()=>jd,ZodTuple:()=>Nd,ZodType:()=>xe,ZodULID:()=>Oa,ZodURL:()=>Os,ZodUUID:()=>Fn,ZodUndefined:()=>kd,ZodUnion:()=>Fs,ZodUnknown:()=>wd,ZodVoid:()=>Rd,ZodXID:()=>Na,ZodXor:()=>Dd,_ZodString:()=>Aa,_default:()=>Hd,_function:()=>Mb,any:()=>yb,array:()=>ke,base64:()=>X0,base64url:()=>Q0,bigint:()=>hb,boolean:()=>ot,catch:()=>Xd,check:()=>Ub,cidrv4:()=>Y0,cidrv6:()=>J0,clone:()=>Me,codec:()=>Db,coerce:()=>mf,compile:()=>Pu,config:()=>it,core:()=>Yn,creditCard:()=>tb,cuid:()=>j0,cuid2:()=>V0,currencyCode:()=>ab,custom:()=>Ja,date:()=>Sb,decode:()=>pd,decodeAsync:()=>vd,deepPartial:()=>Hb,default:()=>E,describe:()=>Fb,discriminatedUnion:()=>zs,e164:()=>eb,email:()=>L0,emoji:()=>z0,encode:()=>md,encodeAsync:()=>gd,endsWith:()=>$i,enum:()=>Tt,exactOptional:()=>Vd,file:()=>wb,flattenError:()=>vs,float32:()=>cb,float64:()=>ub,formatError:()=>ys,fromJSONSchema:()=>Kb,function:()=>Mb,getDiscriminatedOption:()=>mu,getErrorMap:()=>W$,globalRegistry:()=>Et,gt:()=>Mn,gte:()=>ln,guid:()=>D0,hash:()=>lb,hex:()=>ob,hostname:()=>sb,httpUrl:()=>F0,iban:()=>nb,includes:()=>Ti,input:()=>Zb,instanceof:()=>Bb,int:()=>ka,int32:()=>db,int64:()=>mb,intersection:()=>Vi,invertCodec:()=>Cb,ipv4:()=>Z0,ipv6:()=>W0,iso:()=>Kr,json:()=>Vb,jwt:()=>rb,keyof:()=>xb,ksuid:()=>H0,lazy:()=>of,length:()=>Ur,literal:()=>ae,locales:()=>ws,looseObject:()=>It,looseRecord:()=>Tb,lowercase:()=>Ei,lt:()=>Nn,lte:()=>an,mac:()=>q0,map:()=>kb,maxLength:()=>Mr,maxSize:()=>ur,memoizer:()=>$s,meta:()=>zb,mime:()=>wi,minLength:()=>Wn,minSize:()=>Un,multipleOf:()=>cr,nan:()=>Lb,nanoid:()=>B0,nativeEnum:()=>Ab,negative:()=>ga,never:()=>Za,nonnegative:()=>ya,nonoptional:()=>Wd,nonpositive:()=>va,normalize:()=>Pi,null:()=>Ns,nullable:()=>Cs,nullish:()=>Pb,number:()=>Re,object:()=>re,optional:()=>je,output:()=>qb,overwrite:()=>En,parse:()=>ud,parseAsync:()=>dd,partialRecord:()=>Ib,pipe:()=>$a,positive:()=>pa,prefault:()=>qd,preprocess:()=>Ks,prettifyError:()=>Dc,promise:()=>Nb,properties:()=>Ai,property:()=>ba,readonly:()=>nf,record:()=>Ge,refine:()=>cf,regex:()=>_i,regexes:()=>gn,registry:()=>aa,safeDecode:()=>bd,safeDecodeAsync:()=>xd,safeEncode:()=>yd,safeEncodeAsync:()=>Sd,safeParse:()=>fd,safeParseAsync:()=>hd,set:()=>$b,setErrorMap:()=>q$,size:()=>Nr,slugify:()=>Ci,startsWith:()=>ki,strictObject:()=>_b,string:()=>L,stringFormat:()=>ib,stringbool:()=>jb,success:()=>Rb,superRefine:()=>uf,symbol:()=>gb,templateLiteral:()=>Ob,toJSONSchema:()=>Ea,toLowerCase:()=>Li,toUpperCase:()=>Di,toZod:()=>us,transform:()=>qa,treeifyError:()=>Lc,trim:()=>Ri,tuple:()=>Md,uint32:()=>fb,uint64:()=>pb,ulid:()=>G0,undefined:()=>vb,union:()=>Ue,unknown:()=>Ke,uppercase:()=>Ii,url:()=>U0,util:()=>O,uuid:()=>C0,uuidv4:()=>O0,uuidv6:()=>N0,uuidv7:()=>M0,validate:()=>hi,validateAsync:()=>mi,void:()=>bb,withParser:()=>ca,xid:()=>K0,xor:()=>Eb,z:()=>E});var Qa=G(()=>{pf();oA()});var hw={"\u8BF7\u5BA1\u67E5\u7EA2\u679C\u7684\u56DE\u5408 Hooks":"Review Hongguo\u2019s task hooks",\u4F7F\u7528\u6307\u5357:"Getting started",\u5F00\u59CB\u4F7F\u7528\u7EA2\u679C:"Welcome to Hongguo",\u91CD\u65B0\u68C0\u67E5:"Check again","\u70B9\u5267\u540D\u5373\u53EF\u64AD\u653E\uFF0C\u9ED8\u8BA4\u9759\u97F3\uFF1B\u6253\u5F00\u626C\u58F0\u5668\u51FA\u58F0\u3002":"Choose a show to play. Playback starts muted; use the speaker to turn on sound.","\u56DE\u5408\u8054\u52A8\u9700\u8981\u5728 Codex \u8BBE\u7F6E \u2192 Hooks \u5BA1\u67E5\u5E76\u4FE1\u4EFB\u7EA2\u679C\u7684 UserPromptSubmit\u3001Stop\u3001Interrupt\u3002":"For automatic pausing, review and trust Hongguo\u2019s UserPromptSubmit, Stop and Interrupt in Codex Settings \u2192 Hooks.",\u5F00\u59CB\u9009\u5267:"Browse shows",\u5DF2\u914D\u7F6E:"Configured",\u5F85\u786E\u8BA4:"Unverified",\u5F85\u914D\u7F6E:"Needs setup","\u8FDB\u5EA6\u6682\u65F6\u65E0\u6CD5\u4FDD\u5B58\uFF0C\u8BF7\u68C0\u67E5\u7EA2\u679C\u7684\u6570\u636E\u76EE\u5F55\u6743\u9650\u3002":"Progress cannot be saved. Check permissions for Hongguo\u2019s data folder.","\u5C1A\u672A\u627E\u5230 FFmpeg\u3002\u5B89\u88C5\u540E\u91CD\u542F Codex\uFF0C\u518D\u4ECE\u300C\u8BBE\u7F6E \u2192 \u4F7F\u7528\u6307\u5357\u300D\u91CD\u65B0\u68C0\u67E5\u3002":"FFmpeg is missing. Install it, restart Codex, then check again in Settings \u2192 Getting started.","\u56DE\u5408\u8054\u52A8\u5DF2\u5C31\u7EEA\u3002\u53EF\u5728\u8BBE\u7F6E\u4E2D\u914D\u7F6E\u4EFB\u52A1\u5F00\u59CB\u81EA\u52A8\u64AD\u653E\u548C\u4EFB\u52A1\u7ED3\u675F\u81EA\u52A8\u6682\u505C\u3002":"Task hooks are ready. Configure automatic play and pause in Settings.","\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6 Hooks \u72B6\u6001\uFF0C\u8BF7\u5728\u5BBF\u4E3B\u8BBE\u7F6E\u4E2D\u6838\u5BF9\u3002\u73B0\u5728\u53EF\u4EE5\u5148\u624B\u52A8\u89C2\u770B\u3002":"Hook status is unavailable. Check the host settings; you can watch manually for now.","\u5C1A\u672A\u53D1\u73B0\u5B8C\u6574\u7684\u56DE\u5408\u4E8B\u4EF6\u3002\u8BF7\u68C0\u67E5\u63D2\u4EF6\u5DF2\u542F\u7528\uFF0C\u5E76\u5728\u65B0\u7684\u672C\u5730\u5BF9\u8BDD\u4E2D\u91CD\u8BD5\u3002":"Some hooks were not found. Check that the plugin is enabled, then retry in a new local conversation.","\u56DE\u5408\u8054\u52A8\u5C1A\u672A\u914D\u7F6E\u3002\u5B8C\u6210\u4E0B\u65B9\u64CD\u4F5C\u540E\u91CD\u65B0\u68C0\u67E5\uFF0C\u4E5F\u53EF\u4EE5\u5148\u624B\u52A8\u89C2\u770B\u3002":"Automatic pausing needs setup. Follow the instructions below and check again, or watch manually.","\u68C0\u67E5\u672A\u5B8C\u6210\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u6216\u5728 Codex \u8BBE\u7F6E \u2192 Hooks \u6838\u5BF9\u56DE\u5408\u8054\u52A8\u3002":"The check could not finish. Retry or review automatic pausing in Codex Settings \u2192 Hooks.","\u672C\u6B21\u5DF2\u6536\u8D77\u6307\u5357\uFF0C\u6682\u65F6\u65E0\u6CD5\u4FDD\u5B58\u6B64\u8BBE\u7F6E\u3002":"Guide hidden for now. This preference could not be saved.",\u81EA\u68C0:"Diagnostics",\u8BBE\u7F6E:"Settings",\u4EE5\u4E0B\u8BBE\u7F6E\u5BF9\u6240\u6709\u804A\u5929\u751F\u6548:"These settings apply to all chats",\u4EFB\u52A1\u7ED3\u675F\u81EA\u52A8\u6682\u505C:"Pause automatically when a task ends",\u4EFB\u52A1\u5F00\u59CB\u81EA\u52A8\u64AD\u653E:"Play automatically when a task starts","\u81EA\u52A8\u64AD\u653E\u5DF2\u9009\u4E2D\u7684\u5267\u96C6\uFF0C\u4ECE\u4E0A\u6B21\u4F4D\u7F6E\u7EE7\u7EED":"Play the selected episode from its saved position",\u5F53\u524D\u56DE\u5408\u8FDB\u884C\u65F6\u663E\u793A\u63A8\u8350:"Suggest shows during a turn",\u63A8\u8350\u8865\u5145\u5173\u952E\u8BCD:"Additional recommendation keywords",\u7528\u9017\u53F7\u5206\u9694:"Separate with commas",\u4FDD\u5B58\u8BBE\u7F6E:"Save settings",\u6B63\u5728\u8FDE\u63A5:"Connecting\u2026",\u56DE\u5408\u8054\u52A8:"Automatic pausing",\u672A\u5173\u8054\u5BF9\u8BDD:"No chat connected","\u5728\u540C\u7A97\u5206\u5C4F\u64AD\u653E \u2197":"Open in split view \u2197",\u786E\u8BA4\u4F1A\u8BDD:"Choose conversation","\u5728 Codex \u5185\u7F6E\u6D4F\u89C8\u5668\u6253\u5F00\u6B64\u94FE\u63A5\uFF0860 \u79D2\u5185\u6709\u6548\uFF09":"Open this link in the Codex browser within 60 seconds",\u590D\u5236\u94FE\u63A5:"Copy link",\u7B49\u5F85\u65F6\u770B\u4E00\u96C6:"Watch while you wait",\u8FD9\u6761\u63A8\u8350\u5DF2\u7ED3\u675F:"This suggestion has expired.","\u5F53\u524D Codex \u65E0\u6CD5\u5728\u4F1A\u8BDD\u4E2D\u6253\u5F00\u64AD\u653E\u5668":"This version of Codex could not open the player in this chat.",\u6536\u8D77\u672C\u8F6E\u63A8\u8350:"Hide suggestions for this turn","\u66F4\u591A\u2026":"More\u2026",\u9009\u5267:"Browse shows",\u641C\u7D22\u5267\u540D:"Search shows",\u641C\u7D22:"Search",\u89C2\u770B\u5386\u53F2:"Watch history",\u6362\u4E00\u6279:"Next batch",\u7EE7\u7EED\u89C2\u770B:"Continue watching",\u770B\u4E0B\u4E00\u96C6:"Watch next episode","\u63A8\u8350 \xB7 \u70B9\u51FB\u64AD\u653E":"Recommended \xB7 Play",\u64AD\u653E\u5668:"Player","\u2039 \u8FD4\u56DE\u9009\u5267":"\u2039 Browse shows",\u64AD\u653E\u5F53\u524D\u96C6:"Play this episode",\u77ED\u5267\u89C6\u9891:"Drama video",\u64AD\u653E:"Play",\u6682\u505C:"Pause",\u4E0B\u4E00\u96C6:"Next episode",\u4E0A\u4E00\u96C6:"Previous episode",\u7EE7\u7EED\u64AD\u653E:"Resume playback",\u64AD\u653E\u8FDB\u5EA6:"Playback position",\u64AD\u653E\u901F\u5EA6:"Playback speed",\u9759\u97F3:"Mute",\u53D6\u6D88\u9759\u97F3:"Unmute",\u5168\u5C4F:"Fullscreen",\u9000\u51FA\u5168\u5C4F:"Exit fullscreen",\u9009\u62E9\u4E00\u90E8\u77ED\u5267:"Choose a show",\u97F3\u91CF:"Volume",\u8FDE\u64AD:"Autoplay next",\u968F\u673A\u4E00\u96C6:"Pick an episode",\u5206\u96C6\u8303\u56F4:"Episode groups",\u9009\u96C6:"Episodes",\u66F4\u591A\u5206\u96C6:"Load more episodes","\u6B63\u5728\u8BFB\u53D6\u5206\u96C6\u2026":"Loading episodes\u2026",\u6682\u65E0\u53EF\u7528\u5206\u96C6:"No episodes available",\u53D6\u6D88\u51C6\u5907:"Cancel loading",\u4ECE\u5934\u64AD\u653E:"Start over",\u79FB\u9664:"Remove","\u6B63\u5728\u8BFB\u53D6\u7247\u5E93\u2026":"Loading shows\u2026",\u6CA1\u6709\u627E\u5230\u76F8\u7B26\u7684\u5267\u76EE:"No matching shows",\u7EA2\u679C\u6682\u65F6\u6CA1\u6709\u8FD4\u56DE\u63A8\u8350\u5267\u76EE:"Hongguo returned no recommendations.",\u7B49\u5F85\u56DE\u5408\u5F00\u59CB:"Waiting for a turn",\u5F53\u524D\u56DE\u5408\u8FDB\u884C\u4E2D:"Turn in progress",\u56DE\u5408\u5DF2\u505C\u6B62:"Turn stopped",\u56DE\u5408\u5DF2\u4E2D\u65AD:"Turn interrupted","\u6B63\u5728\u51C6\u5907\u64AD\u653E\u2026":"Preparing playback\u2026",\u6B63\u5728\u64AD\u653E:"Playing","\u6B63\u5728\u672C\u673A\u51C6\u5907\u6574\u96C6\u2026":"Preparing the episode on this device\u2026","\u672C\u8F6E\u5DF2\u505C\u6B62\uFF0C\u5DF2\u4E3A\u4F60\u6682\u505C":"Turn stopped. Playback paused.","\u672C\u8F6E\u5DF2\u4E2D\u65AD\uFF0C\u5DF2\u4E3A\u4F60\u6682\u505C":"Turn interrupted. Playback paused.",\u5DF2\u624B\u52A8\u6682\u505C:"Paused",\u672C\u96C6\u5DF2\u64AD\u5B8C:"Episode finished",\u672C\u673A\u72B6\u6001\u4E0D\u53EF\u8FBE:"Local status unavailable","\u5DF2\u6682\u505C\uFF0C\u70B9\u51FB\u64AD\u653E\u7EE7\u7EED":"Paused. Press Play to resume.","\u8FD8\u6CA1\u6709\u672C\u673A\u56DE\u5408\u8BB0\u5F55\uFF0C\u53EF\u5148\u624B\u52A8\u89C2\u770B":"No local turns yet. Choose a show to watch.","\u51C6\u5907\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5":"Media preparation timed out. Try again.","\u89C2\u770B\u8FDB\u5EA6\u6682\u672A\u5199\u5165\uFF0C\u8BF7\u68C0\u67E5\u672C\u673A\u670D\u52A1":"Could not save progress. Check the local service.","\u8BE5\u96C6\u5F53\u524D\u4E0D\u53EF\u64AD\u653E\uFF0C\u8BF7\u68C0\u67E5\u7247\u6E90\u8BB8\u53EF\u6216 FFmpeg \u81EA\u68C0\u7ED3\u679C":"This episode is unavailable. Check the source and FFmpeg diagnostics.","\u4E0A\u6E38\u6682\u65F6\u9650\u5236\u533F\u540D\u64AD\u653E\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5":"The provider temporarily limited anonymous playback. Try again later.","\u7EA2\u679C\u7247\u6E90\u6682\u65F6\u4E0D\u53EF\u8FBE\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5":"The provider is temporarily unavailable. Try again later.",\u684C\u9762\u5B89\u5168\u7B56\u7565\u963B\u6B62\u4E86\u4FA7\u680F\u8F7D\u5165\u672C\u5730\u89C6\u9891:"The desktop security policy blocked the panel from loading local video.","\u4FA7\u680F\u5206\u6BB5\u8BFB\u53D6\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u70B9\u64AD":"The panel could not read a video segment. Try playing the episode again.","\u4FA7\u680F\u65E0\u6CD5\u5904\u7406\u89C6\u9891\u5206\u6BB5\uFF0C\u53EF\u4F7F\u7528\u540C\u7A97\u5206\u5C4F":"The panel could not process a video segment. Open in split view.","\u7B49\u5F85\u89C6\u9891\u5143\u6570\u636E\u8D85\u65F6\uFF0C\u8BF7\u91CD\u65B0\u70B9\u64AD":"Timed out waiting for video metadata. Try playing the episode again.","\u89C6\u9891\u52A0\u8F7D\u5DF2\u4E2D\u6B62\uFF0C\u53EF\u4EE5\u91CD\u65B0\u70B9\u64AD":"Video loading was interrupted. Try playing the episode again.","\u8BFB\u53D6\u89C6\u9891\u6570\u636E\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u70B9\u64AD":"The player could not read the video data. Try playing the episode again.","\u64AD\u653E\u5668\u89E3\u7801\u89C6\u9891\u6570\u636E\u5931\u8D25\uFF0C\u53EF\u4F7F\u7528\u540C\u7A97\u5206\u5C4F":"The player could not decode the video data. Open in split view.","\u64AD\u653E\u5668\u65E0\u6CD5\u6253\u5F00\u89C6\u9891\u6765\u6E90\uFF0C\u53EF\u91CD\u65B0\u70B9\u64AD\u6216\u4F7F\u7528\u540C\u7A97\u5206\u5C4F":"The player could not open the media source. Try again or open in split view.","\u89C6\u9891\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u70B9\u64AD":"Video loading failed. Try playing the episode again.","\u5F53\u524D\u9762\u677F\u4E0D\u652F\u6301\u5206\u6BB5\u89E3\u7801\uFF0C\u53EF\u4F7F\u7528\u540C\u7A97\u5206\u5C4F":"Segmented playback is unavailable here. Open in split view.","\u5DF2\u590D\u5236\uFF0C\u8BF7\u5728 Codex \u5185\u7F6E\u6D4F\u89C8\u5668\u6253\u5F00":"Link copied. Open it in the Codex browser.","\u94FE\u63A5\u5DF2\u9009\u4E2D\uFF0C\u8BF7\u590D\u5236\u5E76\u5728 Codex \u5185\u7F6E\u6D4F\u89C8\u5668\u6253\u5F00":"Copy the selected link and open it in the Codex browser.","\u672C\u96C6\u64AD\u653E\u5730\u5740\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u8BD5":"Playback for this episode expired. Try again.",\u7B49\u5F85\u4F1A\u8BDD\u9762\u677F\u8FDE\u63A5:"Waiting for the conversation panel",\u8BF7\u6C42\u53C2\u6570\u65E0\u6548:"Invalid settings or request",\u8FD4\u56DE\u9009\u5267:"Back to shows",\u5728\u540C\u7A97\u5206\u5C4F\u64AD\u653E:"Open in split view",\u5206\u5C4F:"Split view",\u63A8\u8350:"Featured",\u770B\u8FC7:"Watched",\u91CD\u8BD5:"Retry",\u6E05\u9664\u641C\u7D22:"Clear search",\u53D6\u6D88:"Cancel","\u6B63\u5728\u68C0\u67E5\u2026":"Checking\u2026",\u8FDB\u5EA6\u5E93:"Progress store",\u53EF\u5199:"Writable",\u4E0D\u53EF\u7528:"Unavailable",\u5C31\u7EEA:"Ready",\u7F3A\u5931:"Missing"},Vf=!1;function Ce(n){if(!Vf)return n;let e=n.trim(),t=hw[e];return t?n.replace(e,t):n.replace(/^继续观看 · /,"Continue watching \xB7 ").replace(/^已从 ([\d:]+) 继续$/,"Resumed at $1").replace(/^移除 (.+) 的观看历史$/,"Remove $1 from history").replace(/^第 (\d+) 集(?= · |$)/,"Episode $1").replace(/^(\d+) 集 · /,"$1 episodes \xB7 ").replace(/ · 可点击搜索重试$/," \xB7 Search again to retry").replace(/^(\d+\+?) 集$/,"$1 eps")}function MS(n){if(Vf=n.toLowerCase().startsWith("en"),!Vf)return;document.documentElement.lang="en";let e=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT);for(let t=e.nextNode();t;t=e.nextNode())t.parentElement?.tagName!=="SCRIPT"&&t.nodeValue?.trim()&&(t.nodeValue=Ce(t.nodeValue));for(let t of document.querySelectorAll("[aria-label],[placeholder],[title]"))for(let i of["aria-label","placeholder","title"]){let r=t.getAttribute(i);r&&t.setAttribute(i,Ce(r))}}var US="http://www.w3.org/2000/svg";function tr(n){let e=document.createElementNS(US,"svg"),t=document.createElementNS(US,"use");return e.setAttribute("class","i"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),t.setAttribute("href","#i-"+n),e.append(t),e}function io(n,e,t){let i=n.querySelector("svg.i");i||(i=tr(e),n.prepend(i)),i.querySelector("use")?.setAttribute("href","#i-"+e),n.setAttribute("aria-label",t),n.title=t}function Yi(n){let e=Number(n.min)||0,t=Number(n.max)||100,i=(Number(n.value)-e)/(t-e||1)*100;n.style.setProperty("--p",Math.min(100,Math.max(0,i)).toFixed(2)+"%")}function mw(n){let e=7;for(let t of n)e=(e*31+(t.codePointAt(0)||0))%360;return e}function bl(n,e=""){let t=document.createElement("span"),i=document.createElement("span");if(t.className="cover",t.style.setProperty("--h",String(mw(n))),i.className="ph",i.setAttribute("aria-hidden","true"),i.textContent=n,t.append(i),e){let r=document.createElement("span");r.className="badge",r.textContent=e,t.append(r)}return t}var Gf=new WeakMap;function FS(n,e){if(Gf.get(n)===e)return;Gf.set(n,e);let t=document.createElement("img");t.alt="",t.decoding="async",t.className="fg",t.onload=()=>{if(Gf.get(n)!==e)return;let i=t.naturalWidth>t.naturalHeight*.9;if(n.querySelectorAll("img").forEach(r=>r.remove()),i){let r=document.createElement("img");r.alt="",r.className="bg",r.src=e,n.prepend(r,t)}else n.prepend(t);n.dataset.shape=i?"wide":"tall",n.classList.add("loaded")},t.src=e}var W=Number.isFinite||function(n){return typeof n=="number"&&isFinite(n)},pw=Number.isSafeInteger||function(n){return typeof n=="number"&&Math.abs(n)<=gw},gw=Number.MAX_SAFE_INTEGER||9007199254740991,oe=(function(n){return n.NETWORK_ERROR="networkError",n.MEDIA_ERROR="mediaError",n.KEY_SYSTEM_ERROR="keySystemError",n.MUX_ERROR="muxError",n.OTHER_ERROR="otherError",n})({}),A=(function(n){return n.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",n.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",n.KEY_SYSTEM_NO_SESSION="keySystemNoSession",n.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",n.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",n.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",n.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",n.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",n.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",n.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",n.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",n.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",n.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",n.MANIFEST_LOAD_ERROR="manifestLoadError",n.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",n.MANIFEST_PARSING_ERROR="manifestParsingError",n.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",n.LEVEL_EMPTY_ERROR="levelEmptyError",n.PLAYLIST_UNCHANGED_ERROR="playlistUnchangedError",n.LEVEL_LOAD_ERROR="levelLoadError",n.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",n.LEVEL_PARSING_ERROR="levelParsingError",n.LEVEL_SWITCH_ERROR="levelSwitchError",n.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",n.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",n.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",n.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",n.FRAG_LOAD_ERROR="fragLoadError",n.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",n.FRAG_DECRYPT_ERROR="fragDecryptError",n.FRAG_PARSING_ERROR="fragParsingError",n.FRAG_GAP="fragGap",n.REMUX_ALLOC_ERROR="remuxAllocError",n.KEY_LOAD_ERROR="keyLoadError",n.KEY_LOAD_TIMEOUT="keyLoadTimeOut",n.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",n.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",n.BUFFER_APPEND_ERROR="bufferAppendError",n.BUFFER_APPENDING_ERROR="bufferAppendingError",n.BUFFER_APPEND_NO_PROGRESS="bufferAppendNoProgress",n.BUFFER_STALLED_ERROR="bufferStalledError",n.BUFFER_FULL_ERROR="bufferFullError",n.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",n.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",n.ASSET_LIST_LOAD_ERROR="assetListLoadError",n.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",n.ASSET_LIST_PARSING_ERROR="assetListParsingError",n.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",n.INTERNAL_EXCEPTION="internalException",n.INTERNAL_ABORTED="aborted",n.ATTACH_MEDIA_ERROR="attachMediaError",n.MEDIA_SOURCE_REQUIRES_RESET="mediaSourceRequiresReset",n.UNKNOWN="unknown",n})({}),v=(function(n){return n.MEDIA_ATTACHING="hlsMediaAttaching",n.MEDIA_ATTACHED="hlsMediaAttached",n.MEDIA_DETACHING="hlsMediaDetaching",n.MEDIA_DETACHED="hlsMediaDetached",n.MEDIA_ENDED="hlsMediaEnded",n.STALL_RESOLVED="hlsStallResolved",n.BUFFER_RESET="hlsBufferReset",n.BUFFER_CODECS="hlsBufferCodecs",n.BUFFER_CREATED="hlsBufferCreated",n.BUFFER_APPENDING="hlsBufferAppending",n.BUFFER_APPENDED="hlsBufferAppended",n.BUFFER_EOS="hlsBufferEos",n.BUFFERED_TO_END="hlsBufferedToEnd",n.BUFFER_FLUSHING="hlsBufferFlushing",n.BUFFER_FLUSHED="hlsBufferFlushed",n.MANIFEST_LOADING="hlsManifestLoading",n.MANIFEST_LOADED="hlsManifestLoaded",n.MANIFEST_PARSED="hlsManifestParsed",n.LEVEL_SWITCHING="hlsLevelSwitching",n.LEVEL_SWITCHED="hlsLevelSwitched",n.LEVEL_LOADING="hlsLevelLoading",n.LEVEL_LOADED="hlsLevelLoaded",n.LEVEL_UPDATED="hlsLevelUpdated",n.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",n.LEVELS_UPDATED="hlsLevelsUpdated",n.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",n.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",n.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",n.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",n.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",n.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",n.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",n.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",n.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",n.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",n.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",n.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",n.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",n.CUES_PARSED="hlsCuesParsed",n.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",n.INIT_PTS_FOUND="hlsInitPtsFound",n.FRAG_LOADING="hlsFragLoading",n.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",n.FRAG_LOADED="hlsFragLoaded",n.FRAG_DECRYPTED="hlsFragDecrypted",n.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",n.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",n.FRAG_PARSING_METADATA="hlsFragParsingMetadata",n.FRAG_PARSED="hlsFragParsed",n.FRAG_BUFFERED="hlsFragBuffered",n.FRAG_CHANGED="hlsFragChanged",n.FPS_DROP="hlsFpsDrop",n.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",n.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",n.ERROR="hlsError",n.DESTROYING="hlsDestroying",n.KEY_LOADING="hlsKeyLoading",n.KEY_LOADED="hlsKeyLoaded",n.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",n.BACK_BUFFER_REACHED="hlsBackBufferReached",n.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",n.ASSET_LIST_LOADING="hlsAssetListLoading",n.ASSET_LIST_LOADED="hlsAssetListLoaded",n.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",n.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",n.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",n.INTERSTITIAL_STARTED="hlsInterstitialStarted",n.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",n.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",n.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",n.INTERSTITIAL_ENDED="hlsInterstitialEnded",n.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",n.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",n.EVENT_CUE_ENTER="hlsEventCueEnter",n})({});function vw(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Kf={exports:{}},zS;function yw(){return zS||(zS=1,(function(n,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(l,c,u){if(u=u||{},l=l.trim(),c=c.trim(),!c){if(!u.alwaysNormalize)return l;var d=a.parseURL(l);if(!d)throw new Error("Error trying to parse base URL.");return d.path=a.normalizePath(d.path),a.buildURLFromParts(d)}var f=a.parseURL(c);if(!f)throw new Error("Error trying to parse relative URL.");if(f.scheme)return u.alwaysNormalize?(f.path=a.normalizePath(f.path),a.buildURLFromParts(f)):c;var h=a.parseURL(l);if(!h)throw new Error("Error trying to parse base URL.");if(!h.netLoc&&h.path&&h.path[0]!=="/"){var m=r.exec(h.path);h.netLoc=m[1],h.path=m[2]}h.netLoc&&!h.path&&(h.path="/");var p={scheme:h.scheme,netLoc:f.netLoc,path:null,params:f.params,query:f.query,fragment:f.fragment};if(!f.netLoc&&(p.netLoc=h.netLoc,f.path[0]!=="/"))if(!f.path)p.path=h.path,f.params||(p.params=h.params,f.query||(p.query=h.query));else{var g=h.path,y=g.substring(0,g.lastIndexOf("/")+1)+f.path;p.path=a.normalizePath(y)}return p.path===null&&(p.path=u.alwaysNormalize?a.normalizePath(f.path):f.path),a.buildURLFromParts(p)},parseURL:function(l){var c=i.exec(l);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(s,"");l.length!==(l=l.replace(o,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};n.exports=a})()})(Kf)),Kf.exports}var Vm=yw(),ai=class{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},Se=(function(n){return n.MANIFEST="manifest",n.LEVEL="level",n.AUDIO_TRACK="audioTrack",n.SUBTITLE_TRACK="subtitleTrack",n.MEDIA_FRAGMENT="media-fragment",n.KEY="key",n.STEERING_MANIFEST="steering-manifest",n.SERVER_CERTIFICATE="server-certificate",n.INTERSTITIAL_ASSET_LIST="interstitial-asset-list",n})({}),ne=(function(n){return n.MAIN="main",n.AUDIO="audio",n.SUBTITLE="subtitle",n})({}),He={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"},jl=class{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,bw(this,"stats")}setByteRange(e,t){let i=e.split("@",2),r;i.length===1?r=t?.byteRangeEndOffset||0:r=parseInt(i[1]),this._byteRange=[r,parseInt(i[0])+r]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[He.AUDIO]:null,[He.VIDEO]:null,[He.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new ai),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.relurl&&(this._url=Vm.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){let{elementaryStreams:e}=this;e[He.AUDIO]=null,e[He.VIDEO]=null,e[He.AUDIOVIDEO]=null,this.url=null}};function et(n){return n.sn!=="initSegment"}function co(n,e){return n.sn===e?.sn&&n.level===e.level}function yh(n,e){return n.sn===e?.sn&&n.level===e.level&&n.cc===e.cc}var ts=class extends jl{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){let e=this.stats.total;if(e)return e}if(this.byteRange.length){let e=this.byteRange[0],t=this.byteRange[1];if(W(e)&&W(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;let{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){let i=Object.keys(t);if(i.length===1){let r=this._decryptdata=t[i[0]]||null;r&&(this._decryptdata=r.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;let e=W(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t;let i=Object.keys(this.levelkeys),r=i.length;if(r>1||r===1&&(t=this.levelkeys[i[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!W(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return et(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){let t=this.levelkeys;if(t){var i;let r=t[e];r&&!((i=this._decryptdata)!=null&&i.keyId)&&(this._decryptdata=r.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,r,s,o=!1){let{elementaryStreams:a}=this,l=a[e];if(!l){a[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:s,partial:o};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,i),l.startDTS=Math.min(l.startDTS,r),l.endDTS=Math.max(l.endDTS,s)}},bh=class extends jl{constructor(e,t,i,r,s){super(i),this.fragOffset=0,this.duration=0,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.gap=!1,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=r;let o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,s),s&&(this.fragOffset=s.fragOffset+s.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){let{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo||this.fragment.type===ne.SUBTITLE&&this.stats.loading.end>0)}};function d_(n,e){let t=Object.getPrototypeOf(n);if(t){let i=Object.getOwnPropertyDescriptor(t,e);return i||d_(t,e)}}function bw(n,e){let t=d_(n,e);t&&(t.enumerable=!0,Object.defineProperty(n,e,t))}function Sw(n,e,t){return(e=Ew(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fe(){return Fe=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},Fe.apply(null,arguments)}function BS(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function se(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?BS(Object(t),!0).forEach(function(i){Sw(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):BS(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}function _c(n,e){if(n==null)return{};var t,i,r=xw(n,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)t=s[i],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(r[t]=n[t])}return r}function xw(n,e){if(n==null)return{};var t={};for(var i in n)if({}.hasOwnProperty.call(n,i)){if(e.indexOf(i)!==-1)continue;t[i]=n[i]}return t}function _w(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Ew(n){var e=_w(n,"string");return typeof e=="symbol"?e:e+""}function Vl(n){switch(n.details){case A.FRAG_LOAD_TIMEOUT:case A.KEY_LOAD_TIMEOUT:case A.LEVEL_LOAD_TIMEOUT:case A.MANIFEST_LOAD_TIMEOUT:case A.AUDIO_TRACK_LOAD_TIMEOUT:case A.SUBTITLE_TRACK_LOAD_TIMEOUT:case A.ASSET_LIST_LOAD_TIMEOUT:return!0}return!1}function f_(n){return n.details.startsWith("key")}function h_(n){return f_(n)&&!!n.frag&&!n.frag.decryptdata}function jS(n,e){let t=Vl(e);return n.default[`${t?"timeout":"error"}Retry`]}function Gm(n,e){let t=n.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*n.retryDelayMs,n.maxRetryDelayMs)}function VS(n){return se(se({},n),{errorRetry:null,timeoutRetry:null})}function vo(n,e,t,i){if(!n)return!1;let r=i?.code,s=e<n.maxNumRetry&&(Iw(r)||!!t);return n.shouldRetry?n.shouldRetry(n,e,t,i,s):s}function Iw(n){return yo(n)||!!n&&(n<400||n>499)}function yo(n){return n===0&&navigator.onLine===!1}function m_(n,e){return e>0&&n.loadError>0&&n.loadErrorTime!==0&&self.performance.now()-n.loadErrorTime>e}var Er=class{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){let i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){let e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}},Sh=class{constructor(e,t,i,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Er(e),this.fast_=new Er(t),this.defaultTTFB_=r,this.ttfb_=new Er(e)}update(e,t){let{slow_:i,fast_:r,ttfb_:s}=this;i.halfLife!==e&&(this.slow_=new Er(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new Er(t,r.getEstimate(),r.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new Er(e,s.getEstimate(),s.getTotalWeight()))}sample(e,t){if(t<=0)return;let i=Math.min(this.minDelayMs_,t/1e5),r=8*t,s=Math.max(e,i)/1e3,o=r/s;this.fast_.sample(s,o),this.slow_.sample(s,o)}sampleTTFB(e){let t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}},jt=class{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;let i=`[${e}]:`;this.trace=Ir,this.debug=t.debug.bind(null,i),this.log=t.log.bind(null,i),this.warn=t.warn.bind(null,i),this.info=t.info.bind(null,i),this.error=t.error.bind(null,i)}},Ir=function(){},Tw={trace:Ir,debug:Ir,log:Ir,warn:Ir,info:Ir,error:Ir};function xh(){return Fe({},Tw)}function kw(n,e){let t=self.console[n];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${n}] >`):Ir}function GS(n,e,t){return e[n]?e[n].bind(e):kw(n,t)}var _h=xh();function $w(n,e,t){let i=xh();if(typeof console=="object"&&n===!0||typeof n=="object"){let r=["debug","log","info","warn","error"];r.forEach(s=>{i[s]=GS(s,n,t)});try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.7.4`)}catch{return xh()}r.forEach(s=>{_h[s]=GS(s,n)})}else Fe(_h,i);return i}var Le=_h;function wr(n=!0){return typeof self>"u"?void 0:(n||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Aw(n){return typeof self<"u"&&n===self.ManagedMediaSource}function p_(n,e){let t=Object.keys(n),i=Object.keys(e),r=t.length,s=i.length;return!r||!s||r===s&&!t.some(o=>i.indexOf(o)===-1)}function ww(n){return btoa(String.fromCharCode(...n))}function Ec(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}var Pw="utf-16",Hf="utf-16be",KS="utf-16le",Ol="utf-8";function Rw(n,e={}){let t;Ec(n)?t=new DataView(n):t=new DataView(n.buffer,n.byteOffset,n.byteLength);let i=0,{encoding:r}=e;if(!r){let c=t.getUint8(0),u=t.getUint8(1);c==239&&u==187&&t.getUint8(2)==191?(r=Ol,i=3):c==254&&u==255?(r=Hf,i=2):c==255&&u==254?(r=KS,i=2):r=Ol}if(typeof TextDecoder<"u")return new TextDecoder(r).decode(t);let{byteLength:s}=t,o=r!==Hf,a="",l;for(;i<s;){switch(r){case Ol:if(l=t.getUint8(i),l<128)i++;else if(l>=194&&l<=223)if(i+1<s){let c=t.getUint8(i+1);c>=128&&c<=191?(l=(l&31)<<6|c&63,i+=2):i++}else i++;else if(l>=224&&l<=239)if(i+2<=s-1){let c=t.getUint8(i+1),u=t.getUint8(i+2);c>=128&&c<=191&&u>=128&&u<=191?(l=(l&15)<<12|(c&63)<<6|u&63,i+=3):i++}else i++;else if(l>=240&&l<=244)if(i+3<=s-1){let c=t.getUint8(i+1),u=t.getUint8(i+2),d=t.getUint8(i+3);c>=128&&c<=191&&u>=128&&u<=191&&d>=128&&d<=191?(l=(l&7)<<18|(c&63)<<12|(u&63)<<6|d&63,i+=4):i++}else i++;else i++;break;case Hf:case Pw:case KS:l=t.getUint16(i,o),i+=2;break}a+=String.fromCodePoint(l)}return a}function Lw(n){let e=typeof n=="string"?new URL(n):n;return e.origin+e.pathname.substring(0,e.pathname.lastIndexOf("/")+1)}function g_(n,e){if(n<0)return-g_(-n,e);let t=Math.pow(10,e);if(Math.abs(n*t%1-.5)<Number.EPSILON){let i=Math.floor(n*t);return(i%2===0?i:i+1)/t}else return Math.round(n*t)/t}function Dw(n,e){let t;try{t=new URL(n)}catch{return n}let i=new URL(e);if(t.origin!==i.origin)return n;let r=t.pathname.split("/").slice(1),s=i.pathname.split("/").slice(1,-1),o=Math.min(r.length,s.length);for(let a=0;a<o&&r[a]===s[a];a++)r.shift(),s.shift();for(;s.length;)s.shift(),r.unshift("..");return r.join("/")+t.search+t.hash}function v_(){try{return crypto.randomUUID()}catch{try{let e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{let r=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(i=="x"?r:r&3|8).toString(16)})}}}function Km(n,e){return e+10<=n.length&&n[e]===73&&n[e+1]===68&&n[e+2]===51&&n[e+3]<255&&n[e+4]<255&&n[e+6]<128&&n[e+7]<128&&n[e+8]<128&&n[e+9]<128}function Ic(n,e){let t=0;return t=(n[e]&127)<<21,t|=(n[e+1]&127)<<14,t|=(n[e+2]&127)<<7,t|=n[e+3]&127,t}function Cw(n,e){return Km(n,e)&&Ic(n,e+6)+10<=n.length-e}function y_(n,e){return e+10<=n.length&&n[e]===51&&n[e+1]===68&&n[e+2]===73&&n[e+3]<255&&n[e+4]<255&&n[e+6]<128&&n[e+7]<128&&n[e+8]<128&&n[e+9]<128}function bo(n,e){let t=e,i=0;for(;Km(n,e);){i+=10;let r=Ic(n,e+6);i+=r,y_(n,e+10)&&(i+=10),e+=i}if(i>0)return n.subarray(t,t+i)}function Ow(n){return Ec(n)?n:n.byteOffset==0&&n.byteLength==n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer}function Zf(n,e=0,t=1/0){return Nw(n,e,t,Uint8Array)}function Nw(n,e,t,i){let r=Mw(n),s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);let o=Uw(n)?n.byteOffset:0,a=(o+n.byteLength)/s,l=(o+e)/s,c=Math.floor(Math.max(0,Math.min(l,a)));return new i(r,c,Math.floor(Math.min(c+Math.max(t,0),a))-c)}function Mw(n){return Ec(n)?n:n.buffer}function Uw(n){return n&&Ec(n.buffer)&&n.byteLength!==void 0&&n.byteOffset!==void 0}function pn(n,e=!1){let t=e?n.indexOf(0):n.length,i=Rw(new DataView(n.buffer,n.byteOffset,t),{encoding:Ol});return e?i:i.replace(/\0/g,"")}function Fw(n){let e={key:n.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(n.size<2)return;if(n.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}let i=n.data.subarray(1).indexOf(0);if(i===-1)return;let r=pn(Zf(n.data,1,i)),s=n.data[2+i],o=n.data.subarray(3+i).indexOf(0);if(o===-1)return;let a=pn(Zf(n.data,3+i,o)),l;return r==="-->"?l=pn(Zf(n.data,4+i+o)):l=Ow(n.data.subarray(4+i+o)),e.mimeType=r,e.pictureType=s,e.description=a,e.data=l,e}function zw(n){if(n.size<2)return;let e=pn(n.data,!0),t=new Uint8Array(n.data.subarray(e.length+1));return{key:n.type,info:e,data:t.buffer}}function Bw(n){if(n.size<2)return;if(n.type==="TXXX"){let t=1,{data:i}=n,r=pn(i.subarray(t),!0);t+=r.length+1;let s=pn(i.subarray(t));return{key:n.type,info:r,data:s}}let e=pn(n.data.subarray(1));return{key:n.type,info:"",data:e}}function jw(n){if(n.type==="WXXX"){if(n.size<2)return;let t=1,i=pn(n.data.subarray(t),!0);t+=i.length+1;let r=pn(n.data.subarray(t));return{key:n.type,info:i,data:r}}let e=pn(n.data);return{key:n.type,info:"",data:e}}function Vw(n){return n.type==="PRIV"?zw(n):n.type[0]==="W"?jw(n):n.type==="APIC"?Fw(n):Bw(n)}function Gw(n){let e=String.fromCharCode(n[0],n[1],n[2],n[3]),t=Ic(n,4),i=10;return{type:e,size:t,data:n.subarray(i,i+t)}}var Sl=10,Kw=10;function b_(n){let e=0,t=[];for(;Km(n,e);){let i=Ic(n,e+6);n[e+5]>>6&1&&(e+=Sl),e+=Sl;let r=e+i;for(;e+Kw<r;){let s=Gw(n.subarray(e)),o=Vw(s);o&&t.push(o),e+=s.size+Sl}y_(n,e)&&(e+=Sl)}return t}function S_(n){return n&&n.key==="PRIV"&&n.info==="com.apple.streaming.transportStreamTimestamp"}function Hw(n){if(n.data.byteLength===8){let e=new Uint8Array(n.data),t=e[3]&1,i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,t&&(i+=4772185884e-2),Math.round(i)}}function Hm(n){let e=b_(n);for(let t of e)if(S_(t))return Hw(t)}function ht(n){let e="";for(let t=0;t<n.length;t++){let i=n[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}function x_(n){return Uint8Array.from(n.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function Zm(n){return Uint8Array.from(atob(n),e=>e.charCodeAt(0))}function Cn(n){return String.fromCharCode.apply(null,n)}var Gn=Math.pow(2,32)-1,de={avc1:1635148593,avcC:1635148611,hvc1:1752589105,hvcC:1752589123,btrt:1651798644,dinf:1684631142,dref:1685218662,esds:1702061171,free:1718773093,ftyp:1718909296,hdlr:1751411826,mdat:1835295092,mdhd:1835296868,mdia:1835297121,mfhd:1835427940,minf:1835626086,moof:1836019558,moov:1836019574,mp4a:1836069985,".mp3":778924083,dac3:1684103987,"ac-3":1633889587,mvex:1836475768,mvhd:1836476516,pasp:1885434736,sdtp:1935963248,stbl:1937007212,stco:1937007471,stsc:1937011555,stsd:1937011556,stsz:1937011578,stts:1937011827,tfdt:1952867444,tfhd:1952868452,traf:1953653094,trak:1953653099,trun:1953658222,trex:1953654136,tkhd:1953196132,vmhd:1986881636,smhd:1936549988},__={video:1,audio:2,id3:3,text:4};function E_(n,e){let t=n[e]<<8|n[e+1];return t<0?65536+t:t}function te(n,e){let t=n[e]<<24|n[e+1]<<16|n[e+2]<<8|n[e+3];return t<0?4294967296+t:t}function HS(n,e){let t=te(n,e);return t*=Math.pow(2,32),t+=te(n,e+4),t}function xl(n,e){let t="";for(let i=e;i<n.length;i++)if(t+=String.fromCharCode(n[i]),n[i]===0)return t;return null}function Eh(n,e){return n[e]<<24|n[e+1]<<16|n[e+2]<<8|n[e+3]}function at(n,e,t){n[e]=t>>24,n[e+1]=t>>16&255,n[e+2]=t>>8&255,n[e+3]=t&255}function ZS(n,e,t){let i=e.byteOffset-n.byteOffset-8,r=8+t,s=e.byteLength+8-r;s<8||(at(n,i,r),at(n,i+r,s),at(n,i+r+4,de.free))}function Ih(n,e){return[n.byteOffset-e-8,n.byteOffset-e+n.byteLength]}function I_(n,e){e.sort((a,l)=>a[0]-l[0]);let t=e.reduce((a,[l,c])=>a+c-l,0),i=new Uint8Array(n.byteLength-t),r=0,s=0;for(let a=0;a<e.length;a++){let[l,c]=e[a];i.set(n.subarray(r,l),s),s+=l-r,r=c}return i.set(n.subarray(r),s),{result:i,dropped:t,droppedBefore:a=>e.reduce((l,[c,u])=>u<=a?l+u-c:l,0)}}function Zw(n){let e=he(n,["moov"]);if(e.length!==1||he(n,["moof"]).length)return null;let t=n.byteOffset,i=[],r=[],s=!1,o=he(e[0],["trak"]);for(let h=0;h<o.length;h++){let m=o[h],p=he(m,["mdia","hdlr"])[0];if((p?Cn(p.subarray(8,12)):"")==="vide"){s=!0;continue}let y=he(m,["tkhd"])[0];if(!y)return null;let b=y[0];r.push(te(y,b===0?12:20)),i.push(Ih(m,t))}if(!s||!i.length)return null;let a=he(e[0],["mvex"])[0],l=0;if(a){let h=he(a,["trex"]);for(let m=0;m<h.length;m++){let p=h[m];r.indexOf(te(p,4))!==-1&&(i.push(Ih(p,t)),l+=p.byteLength+8)}}let{result:c,dropped:u,droppedBefore:d}=I_(n,i),f=e[0].byteOffset-t-8;if(at(c,f,e[0].byteLength+8-u),a&&l){let h=a.byteOffset-t-8;at(c,h-d(h),a.byteLength+8-l)}return c}function qw(n,e,t,i,r){if(t<1)return null;let s=he(n,["moof"]);if(s.length!==1)return null;let o=s[0],a=n.byteOffset,l=[],c=[],u=he(o,["traf"]),d=!0;for(let p=0;p<u.length;p++){let g=u[p],y=he(g,["tfhd"])[0];if(!y)return null;te(y,4)===e?(l.push(g),te(y,0)&131072||(d=!1)):c.push(Ih(g,a))}if(!l.length||c.length&&!d)return null;if(i!==void 0){let p=t;for(let y=0;y<l.length;y++){let b=l[y],S=0,x=he(b,["trun"]);for(let T=0;T<x.length;T++){let $=x[T],P=Math.min(p,te($,4));if(P){at(n,$.byteOffset-a+4,P);let k=te($,0)&16777215,D=(k&256?4:0)+(k&512?4:0)+(k&1024?4:0)+(k&2048?4:0);ZS(n,$,8+(k&1?4:0)+(k&4?4:0)+P*D)}else at(n,$.byteOffset-a-4,de.free);p-=P,S+=P}let _=he(b,["senc"])[0];_&&at(n,_.byteOffset-a+4,S);let I=he(b,["saiz"])[0];if(I){let T=I[1]<<16|I[2]<<8|I[3],$=4;T&1&&($+=8);let P=I[$];$+=1,at(n,I.byteOffset-a+$,S),ZS(n,I,$+4+(P===0?S:0))}}let g=he(n,["mdat"]);if(g.length===1){let y=g[0].byteOffset-a-8;at(n,y,i-y)}}let f=n,h=0,m=()=>0;if(c.length){({result:f,dropped:h,droppedBefore:m}=I_(n,c)),at(f,o.byteOffset-a-8,o.byteLength+8-h);for(let p=0;p<l.length;p++){let g=l[p],y=m(g.byteOffset-a),b=he(g,["trun"]);for(let S=0;S<b.length;S++){let x=b[S];te(x,0)&1&&at(f,x.byteOffset-a-y+8,te(x,8)-h)}if(y){let S=he(g,["saio"]);for(let x=0;x<S.length;x++){let _=S[x],I=_[0]===0?4:8,T=te(_,0)&1?12:4,$=te(_,T);for(T+=4;$--;T+=I){let P=T+I-4;at(f,_.byteOffset-a-y+P,te(_,P)-y)}}}}}if(r){let{durationOffset:p,value:g}=r;at(f,p-m(p),g)}return i!==void 0?f.subarray(0,i-h):f}function Ww(n,e){let t=n.byteLength;for(let i=0;i<t;){let r=te(n,i);if(r>8&&te(n,i+4)===de[e])return!0;i=r>1?i+r:t}return!1}function he(n,e){let t=[];return e.length&&T_(n,e,0,0,n.byteLength,t),t}function T_(n,e,t,i,r,s){let o=e[t];if(o?.length!==4)return;let a=o.charCodeAt(0),l=o.charCodeAt(1),c=o.charCodeAt(2),u=o.charCodeAt(3),d=e.length-1;for(let f=i;f<r;){let h=f+8<=r,m=f+4<=r?n[f]*16777216+(n[f+1]<<16|n[f+2]<<8|n[f+3]):te(n,f),p=m>1?f+m:r;if(h&&n[f+4]===a&&n[f+5]===l&&n[f+6]===c&&n[f+7]===u){let g=Math.min(p,r);t===d?s.push(n.subarray(f+8,g)):T_(n,e,t+1,f+8,g,s)}f=p}}function Yw(n){let e=[],t=n[0],i=8,r=te(n,i);i+=4;let s=0,o=0;t===0?(s=te(n,i),o=te(n,i+4),i+=8):(s=HS(n,i),o=HS(n,i+8),i+=16),i+=2;let a=n.length+o,l=E_(n,i);i+=2;for(let c=0;c<l;c++){let u=i,d=te(n,u);u+=4;let f=d&2147483647;if((d&2147483648)>>>31===1)return Le.warn("SIDX has hierarchical references (not supported)"),null;let m=te(n,u);u+=4,e.push({referenceSize:f,subsegmentDuration:m,info:{duration:m/r,start:a,end:a+f-1}}),a+=f,u+=4,i=u}return{earliestPresentationTime:s,timescale:r,version:t,referencesCount:l,references:e}}function k_(n){let e=[],t=he(n,["moov","trak"]);for(let r=0;r<t.length;r++){let s=t[r],o=he(s,["tkhd"])[0];if(o){let a=o[0],l=te(o,a===0?12:20),c=he(s,["mdia","mdhd"])[0];if(c){a=c[0];let u=te(c,a===0?12:20),d=he(s,["mdia","hdlr"])[0];if(d){let f=Cn(d.subarray(8,12)),h={soun:He.AUDIO,vide:He.VIDEO}[f],m=he(s,["mdia","minf","stbl","stsd"])[0],p=Jw(m);h?(e[l]={timescale:u,type:h,stsd:p},e[h]=se({timescale:u,id:l},p)):e[l]={timescale:u,type:f,stsd:p}}}}}return he(n,["moov","mvex","trex"]).forEach(r=>{let s=te(r,4),o=e[s];o&&(o.default={duration:te(r,12),sampleSize:te(r,16),flags:te(r,20)})}),e}function Jw(n){let e=n.subarray(8),t=e.subarray(86),i=Cn(e.subarray(4,8)),r=i,s,o=i==="enca"||i==="encv";if(o){let c=he(e,[i])[0].subarray(i==="enca"?28:78);he(c,["sinf"]).forEach(d=>{let f=he(d,["schm"])[0];if(f){let h=Cn(f.subarray(4,8));if(h==="cbcs"||h==="cenc"){let m=he(d,["frma"])[0];m&&(r=Cn(m))}}})}let a=r;switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{let l=he(t,["avcC"])[0];l&&l.length>3&&(r+="."+El(l[1])+El(l[2])+El(l[3]),s=_l(a==="avc1"?"dva1":"dvav",t));break}case"mp4a":{let l=he(e,[i])[0],c=he(l.subarray(28),["esds"])[0];if(c&&c.length>7){let u=4;if(c[u++]!==3)break;u=qf(c,u),u+=2;let d=c[u++];if(d&128&&(u+=2),d&64&&(u+=c[u++]),c[u++]!==4)break;u=qf(c,u);let f=c[u++];if(f===64)r+="."+El(f);else break;if(u+=12,c[u++]!==5)break;u=qf(c,u);let h=c[u++],m=(h&248)>>3;m===31&&(m+=1+((h&7)<<3)+((c[u]&224)>>5)),r+="."+m}break}case"hvc1":case"hev1":{let l=he(t,["hvcC"])[0];if(l&&l.length>12){let c=l[1],u=["","A","B","C"][c>>6],d=c&31,f=te(l,2),h=(c&32)>>5?"H":"L",m=l[12],p=l.subarray(6,12);r+="."+u+d,r+="."+Xw(f).toString(16).toUpperCase(),r+="."+h+m;let g="";for(let y=p.length;y--;){let b=p[y];(b||g)&&(g="."+b.toString(16).toUpperCase()+g)}r+=g}s=_l(a=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{r=_l(r,t)||r;break}case"vp09":{let l=he(t,["vpcC"])[0];if(l&&l.length>6){let c=l[4],u=l[5],d=l[6]>>4&15;r+="."+Kn(c)+"."+Kn(u)+"."+Kn(d)}break}case"av01":{let l=he(t,["av1C"])[0];if(l&&l.length>2){let c=l[1]>>>5,u=l[1]&31,d=l[2]>>>7?"H":"M",f=(l[2]&64)>>6,h=(l[2]&32)>>5,m=c===2&&f?h?12:10:f?10:8,p=(l[2]&16)>>4,g=(l[2]&8)>>3,y=(l[2]&4)>>2,b=l[2]&3;r+="."+c+"."+Kn(u)+d+"."+Kn(m)+"."+p+"."+g+y+b+"."+Kn(1)+"."+Kn(1)+"."+Kn(1)+"."+0,s=_l("dav1",t)}break}}return{codec:r,encrypted:o,supplemental:s}}function _l(n,e){let t=he(e,["dvvC"]),i=t.length?t[0]:he(e,["dvcC"])[0];if(i){let r=i[2]>>1&127,s=i[2]<<5&32|i[3]>>3&31;return n+"."+Kn(r)+"."+Kn(s)}}function Xw(n){let e=0;for(let t=0;t<32;t++)e|=(n>>t&1)<<31-t;return e>>>0}function qf(n,e){let t=e+5;for(;n[e++]&128&&e<t;);return e}function El(n){return("0"+n.toString(16).toUpperCase()).slice(-2)}function Kn(n){return(n<10?"0":"")+n}function Qw(n,e){if(!n||!e)return;let t=e.keyId;t?.byteLength===16&&e.isCommonEncryption&&$_(n,(i,r)=>{let s=i.subarray(8,24);s.some(o=>o!==0)||(Le.log(`[eme] Patching keyId in 'enc${r?"a":"v"}>sinf>>tenc' box: ${ht(s)} -> ${ht(t)}`),i.set(t,8))})}function eP(n){let e=[];return $_(n,t=>e.push(t.subarray(8,24))),e}function $_(n,e){he(n,["moov","trak"]).forEach(i=>{let r=he(i,["mdia","minf","stbl","stsd"])[0];if(!r)return;let s=r.subarray(8),o=he(s,["enca"]),a=o.length>0;a||(o=he(s,["encv"])),o.forEach(l=>{let c=a?l.subarray(28):l.subarray(78);he(c,["sinf"]).forEach(d=>{let f=A_(d);f&&e(f,a)})})})}function A_(n){let e=he(n,["schm"])[0];if(e){let t=Cn(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){let i=he(n,["schi","tenc"])[0];if(i)return i}}}var qS;function tP(n){return typeof TextDecoder>"u"?pn(n):(qS||(qS=new TextDecoder("utf-8"))).decode(n).replace(/\0/g,"")}function nP(n){let e=n.byteLength,t=[];for(let i=0;i<e;){let r=i+8<=e,s=i+4<=e?n[i]*16777216+(n[i+1]<<16|n[i+2]<<8|n[i+3]):te(n,i),o=s>1?i+s:e;if(r&&n[i+4]===109&&n[i+5]===111&&n[i+6]===111&&n[i+7]===102){let a=Math.min(o,e);for(let l=i+8;l<a;){let c=l+8<=a,u=l+4<=a?n[l]*16777216+(n[l+1]<<16|n[l+2]<<8|n[l+3]):te(n,l),d=u>1?l+u:a;if(c&&n[l+4]===116&&n[l+5]===114&&n[l+6]===97&&n[l+7]===102){let f=Math.min(d,a),h,m,p=[];for(let g=l+8;g<f;){let y=g+8<=f,b=g+4<=f?n[g]*16777216+(n[g+1]<<16|n[g+2]<<8|n[g+3]):te(n,g),S=b>1?g+b:f;if(y&&n[g+4]===116){let x=Math.min(S,f);n[g+5]===102&&n[g+6]===104&&n[g+7]===100?m||(m=n.subarray(g+8,x)):n[g+5]===102&&n[g+6]===100&&n[g+7]===116?h||(h=n.subarray(g+8,x)):n[g+5]===114&&n[g+6]===117&&n[g+7]===110&&p.push(n.subarray(g+8,x))}g=S}t.push({moofOffset:n.byteOffset+i,tfdt:h,tfhd:m,truns:p})}l=d}}i=o}return t}function rP(n,e,t,i,r=!0){return w_(n,e,i,r)}function iP(n,e,t,i,r=!1){let s=[],o=e.samples,a=w_(o,t,i,r,{isHEVCFlavor:Do(e.codec),samples:s,timeOffset:n,timescale:e.timescale,trackId:e.id});return{samples:s,sampleData:{includeSampleDetails:r,tracks:a}}}function w_(n,e,t,i,r){let s={},o=!1,a=nP(n),l=n.byteLength;for(let d=0;d<a.length;d++){let{moofOffset:f,tfdt:h,tfhd:m,truns:p}=a[d],g=te(m,4),y=e[g];if(!y)continue;let b=s[g]||(s[g]={start:NaN,duration:0,sampleCount:0,trun:[],timescale:y.timescale,type:y.type}),S;if(h){let B=h[0];S=te(h,4),B===1&&(S===Gn?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(S*=Gn+1,S+=te(h,8))),W(S)&&(!W(b.start)||S<b.start)&&(b.start=S),r&&W(S)&&(r.timeOffset=S/r.timescale)}let x=r?.trackId===g&&y.type===He.VIDEO,_=y.default,I=te(m,0)&16777215,T=_?.duration||0,$,P=_?.sampleSize||0,k=8;I&1&&(k+=8),I&2&&(k+=4),I&8&&(T=te(m,k),$=m.byteOffset-n.byteOffset+k,k+=4),I&16&&(P=te(m,k));let D=0,U=(I&1)!==0,V=!U&&(I&131072)!==0;U?(D=te(m,8),D*=Math.pow(2,32),D+=te(m,12)):V&&(D=f);let X=S||0,q=0,z=T;for(let B=0;B<p.length;B++){let j=p[B],Z=te(j,4),ie=b.sampleCount;b.sampleCount+=Z;let K=j[3]&1,Y=0,me=j[3]&4,le=j[2]&1,_e=j[2]&2,ue=j[2]&4,Ae=j[2]&8,Ee=8;K&&(Y=Eh(j,Ee),Ee+=4),me&&(!(j[Ee+1]&1)&&b.keyFrameIndex===void 0&&(b.keyFrameIndex=ie),Ee+=4);let Pe=D+Y;if(!i&&j[1]===0&&j[2]===6&&j[3]===1){var c,u;let At=X,ut=Pe,yr=Ee,ve=-1,ge=0,be=0,dt=(c=r?.timeOffset)!=null?c:0,rt=T/((u=r?.timescale)!=null?u:1),Ft=r?.isHEVCFlavor===!0,Jt=Ft?2:1;for(let Nt=0;Nt<Z;Nt++){let zt=j[Ee]===0?j[Ee+1]<<16|j[Ee+2]<<8|j[Ee+3]:te(j,Ee),Xt=ve===-1&&b.keyFrameIndex===void 0&&(j[Ee+5]&1)===0;Ee+=8;let br=Pe+zt;if(x){if(zt>0){let mt=Pe;do{let Sr=n[mt]===0?n[mt+1]<<16|n[mt+2]<<8|n[mt+3]:te(n,mt);mt+=4;let xr=n[mt],fn=Ft?xr>>1&63:xr&31;(Ft?fn===39||fn===40:fn===6)&&So(n.subarray(mt,mt+Sr),Jt,dt,r.samples),mt+=Sr}while(mt<br)}dt+=rt}Pe=br,Xt&&(ve=Nt,ge=Pe)}if(Pe<=l)be=Z;else{let Nt=ut,zt=yr;for(let Xt=0;Xt<Z;Xt++){let br=j[zt]===0?j[zt+1]<<16|j[zt+2]<<8|j[zt+3]:te(j,zt);if(Nt+=br,Nt>l)break;be=Xt+1,zt+=8}}if(x&&(r.timeOffset=dt),ve!==-1&&ge<=l&&b.keyFrameIndex===void 0&&(b.keyFrameIndex=ve,b.keyFrameStart=At+ve*T),be){(!W(b.ptsMin)||At<b.ptsMin)&&(b.ptsMin=At);let Nt=At+be*T;(!W(b.ptsMax)||Nt>b.ptsMax)&&(b.ptsMax=Nt)}let Qr=T*Z;X=At+Qr,q+=Qr;continue}let st,Yt;i&&(st=[],Yt={sampleOffset:Pe,samples:st,defaultSampleDurationOffset:$},Pe<=l&&b.trun.push(Yt));let er;for(let At=0;At<Z;At++){let ut;le?(i&&(ut=j.byteOffset-n.byteOffset+Ee),z=te(j,Ee),Ee+=4):z=T,_e?(er=te(j,Ee),Ee+=4):er=P;let yr,ve;ue&&(ve=j[Ee+1]&1?1:0,i&&(yr={isNonSync:ve,dependsOn:(j[Ee]&3)===1?1:2}),Ee+=4);let ge=0;if(Ae&&(ge=j[0]===0?te(j,Ee):Eh(j,Ee),Ee+=4),x){let be=Pe,dt=0;for(;dt<er;){let rt=te(n,be);be+=4,P_(r.isHEVCFlavor,n[be])&&So(n.subarray(be,be+rt),r.isHEVCFlavor?2:1,r.timeOffset+ge/r.timescale,r.samples),be+=rt,dt+=rt+4}r.timeOffset+=z/r.timescale}if(Pe+=er,Pe<=l){Yt&&ut!==void 0&&(Yt.lastSampleDurationOffset=ut),ve===0&&b.keyFrameIndex===void 0&&(b.keyFrameIndex=At,b.keyFrameStart=X);let be=X+ge;(!W(b.ptsMin)||be<b.ptsMin)&&(b.ptsMin=be),(!W(b.ptsMax)||be+z>b.ptsMax)&&(b.ptsMax=be+z),st&&(st[At]={cts:ge,duration:z,flags:yr,size:er})}X+=z,q+=z}!q&&T&&(q+=T*Z)}b.duration+=q,b.duration&&(o=!0)}if(!o){let d=1/0,f=0,h=he(n,["sidx"]);for(let m=0;m<h.length;m++){let p=Yw(h[m]);if(p!=null&&p.references){d=Math.min(d,p.earliestPresentationTime/p.timescale);let g=p.references.reduce((y,b)=>y+b.info.duration||0,0);f=Math.max(f,g+p.earliestPresentationTime/p.timescale)}}f&&W(f)&&Object.keys(s).forEach(m=>{s[m].duration||(s[m].duration=f*s[m].timescale-s[m].start)})}return s}function sP(n){let e={valid:null,remainder:null},t=he(n,["moof"]);if(t.length<2)return e.remainder=n,e;let i=t[t.length-1];return e.valid=n.slice(0,i.byteOffset-8),e.remainder=n.slice(i.byteOffset-8),e}function bn(n,e){let t=new Uint8Array(n.length+e.length);return t.set(n),t.set(e,n.length),t}function oP(n,e){let t=[],i=e.samples,r=e.timescale,s=e.id,o=!1;return he(i,["moof"]).map(l=>{let c=l.byteOffset-8;he(l,["traf"]).map(d=>{let f=he(d,["tfdt"]).map(h=>{let m=h[0],p=te(h,4);return m===1&&(p*=Math.pow(2,32),p+=te(h,8)),p/r})[0];return f!==void 0&&(n=f),he(d,["tfhd"]).map(h=>{let m=te(h,4),p=te(h,0)&16777215,g=(p&1)!==0,y=0,b=(p&2)!==0,S=(p&8)!==0,x=0,_=(p&16)!==0,I=0,T=(p&32)!==0,$=!g&&(p&131072)!==0,P=8;m===s&&(g?(y=te(h,P),P+=4,y*=Math.pow(2,32),y+=te(h,P),P+=4):$&&(y=c),b&&(P+=4),S&&(x=te(h,P),P+=4),_&&(I=te(h,P),P+=4),T&&(P+=4),e.type==="video"&&(o=Do(e.codec)),he(d,["trun"]).map(k=>{let D=k[0],U=te(k,0)&16777215,V=(U&1)!==0,X=0,q=(U&4)!==0,z=(U&256)!==0,B=0,j=(U&512)!==0,Z=0,ie=(U&1024)!==0,K=(U&2048)!==0,Y=0,me=te(k,4),le=8;V&&(X=te(k,le),le+=4),q&&(le+=4);let _e=y+X;for(let ue=0;ue<me;ue++){if(z?(B=te(k,le),le+=4):B=x,j?(Z=te(k,le),le+=4):Z=I,ie&&(le+=4),K&&(D===0?Y=te(k,le):Y=Eh(k,le),le+=4),e.type===He.VIDEO){let Ae=0;for(;Ae<Z;){let Ee=te(i,_e);if(_e+=4,P_(o,i[_e])){let Pe=i.subarray(_e,_e+Ee);So(Pe,o?2:1,n+Y/r,t)}_e+=Ee,Ae+=Ee+4}}n+=B/r}}))})})}),t}function Do(n){if(!n)return!1;let e=n.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function P_(n,e){if(n){let t=e>>1&63;return t===39||t===40}else return(e&31)===6}function So(n,e,t,i){let r=R_(n),s=0;s+=e;let o=0,a=0,l=0;for(;s<r.length;){o=0;do{if(s>=r.length)break;l=r[s++],o+=l}while(l===255);a=0;do{if(s>=r.length)break;l=r[s++],a+=l}while(l===255);let c=r.length-s,u=s;if(a<c)s+=a;else if(a>c){Le.error(`Malformed SEI payload. ${a} is too small, only ${c} bytes left to parse.`);break}if(o===4){if(r[u++]===181){let f=E_(r,u);if(u+=2,f===49){let h=te(r,u);if(u+=4,h===1195456820){let m=r[u++];if(m===3){let p=r[u++],g=31&p,y=64&p,b=y?2+g*3:0,S=new Uint8Array(b);if(y){S[0]=p;for(let x=1;x<b;x++)S[x]=r[u++]}i.push({type:m,payloadType:o,pts:t,bytes:S})}}}}}else if(o===5&&a>16){let d=[];for(let m=0;m<16;m++){let p=r[u++].toString(16);d.push(p.length==1?"0"+p:p),(m===3||m===5||m===7||m===9)&&d.push("-")}let f=a-16,h=new Uint8Array(f);for(let m=0;m<f;m++)h[m]=r[u++];i.push({payloadType:o,pts:t,uuid:d.join(""),userData:tP(h),userDataBytes:h})}}}function R_(n){let e=n.byteLength,t,i=n.indexOf(3,3);for(;i!==-1;)n[i-1]===0&&n[i-2]===0&&(t||(t=[])).push(i),i=n.indexOf(3,i+1);if(!t)return n;let r=e-t.length,s=new Uint8Array(r),o=0,a=0;for(let l=0;l<r;a++,l++)a===t[o]&&(a++,o++),s[l]=n[a];return s}function aP(n){let e=n[0],t="",i="",r=0,s=0,o,a=0,l=0,c=4;if(e===0){let d=xl(n,c),f=d!==null?xl(n,c+d.length):null;d!==null&&f!==null?(t=d,i=f,c+=d.length+f.length,r=te(n,c),c+=4,s=te(n,c),c+=4,a=te(n,c),c+=4,l=te(n,c),c+=4):(Le.warn(`Unterminated ${d===null?"scheme_id_uri":"value"} in parsing emsg box: version 0 box ends inside a string, dropping all of its fields`),c=n.length)}else if(e===1){r=te(n,c),c+=4;let d=te(n,c);c+=4;let f=te(n,c);c+=4,o=2**32*d+f,pw(o)||(o=Number.MAX_SAFE_INTEGER,Le.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),a=te(n,c),c+=4,l=te(n,c),c+=4;let h=xl(n,c),m=h!==null?xl(n,c+h.length):null;h!==null&&(t=h,c+=h.length),m!==null?(i=m,c+=m.length):(Le.warn(`Unterminated ${h===null?"scheme_id_uri":"value"} in parsing emsg box: version 1 box ends inside a string, dropping its ${h===null?"strings and payload":"value and payload"}`),c=n.length)}let u=n.subarray(c,n.byteLength);return{schemeIdUri:t,value:i,timeScale:r,presentationTime:o,presentationTimeDelta:s,eventDuration:a,id:l,payload:u}}function lP(n,...e){let t=e.length,i=8,r=t;for(;r--;)i+=e[r].byteLength;let s=new Uint8Array(i);for(s[0]=i>>24&255,s[1]=i>>16&255,s[2]=i>>8&255,s[3]=i&255,s.set(n,4),r=0,i=8;r<t;r++)s.set(e[r],i),i+=e[r].byteLength;return s}function cP(n,e,t){if(n.byteLength!==16)throw new RangeError("Invalid system id");let i,r;i=0,r=new Uint8Array;let s;i>0?(s=new Uint8Array(4),e.length>0&&new DataView(s.buffer).setUint32(0,e.length,!1)):s=new Uint8Array;let o=new Uint8Array(4);return t.byteLength>0&&new DataView(o.buffer).setUint32(0,t.byteLength,!1),lP([112,115,115,104],new Uint8Array([i,0,0,0]),n,s,r,o,t)}function L_(n){let e=[];if(n instanceof ArrayBuffer){let t=n.byteLength,i=0;for(;i+32<t;){let r=new DataView(n,i),s=dP(r);e.push(s),i+=s.size}}return e}function uP(n){let e=[];for(let t=0;t<n.length;){let i=n[t++],r=i&7;if(r===0){for(;n[t++]&128;);continue}if(r!==2){t+=r===1?8:4;continue}let s=0;for(let o=0,a=128;a&128;o+=7)s|=((a=n[t++])&127)<<o;if(i>>3===2)if(s===32){let o=new Uint8Array(16);for(let a=0;a<16;a++)o[a]=parseInt(String.fromCharCode(n[t+a*2],n[t+a*2+1]),16);e.push(o)}else s===16&&e.push(n.subarray(t,t+16));t+=s}return e}function dP(n){let e=n.getUint32(0),t=n.byteOffset,i=n.byteLength;if(i<e)return{offset:t,size:i};if(n.getUint32(4)!==1886614376)return{offset:t,size:e};let s=n.getUint32(8)>>>24;if(s!==0&&s!==1)return{offset:t,size:e};let o=n.buffer,a=ht(new Uint8Array(o,t+12,16)),l=null,c=null,u=0;if(s===0)u=28;else{let f=n.getUint32(28);if(!f||i<32+f*16)return{offset:t,size:e};l=[];for(let h=0;h<f;h++)l.push(new Uint8Array(o,t+32+h*16,16));u=32+f*16}if(!u)return{offset:t,size:e};let d=n.getUint32(u);return e-32<d?{offset:t,size:e}:(c=new Uint8Array(o,t+u+4,d),s===0&&(l=uP(c)),{version:s,systemId:a,kids:l,data:c,offset:t,size:e})}var ls=D_("userAgent"),fP=D_("vendor"),Wf,Yf,Jf;function D_(n){try{return navigator[n]||""}catch{}return""}function hP(){if(Jf===void 0){let n=ls.match(/Safari\/(\d+)/i);Jf=n?parseInt(n[1]):0}return Jf}function fo(){if(Wf===void 0){let n=ls.match(/Chrome\/(\d+)/i);Wf=n?parseInt(n[1]):0}return Wf}function mP(){if(Yf===void 0){let n=ls.match(/Firefox\/(\d+)/i);Yf=n?parseInt(n[1]):0}return Yf}function C_(){return/\(Windows.+Firefox\//i.test(ls)}function pP(){return fP.indexOf("Apple")>-1||/iPhone|iPad|iPod/.test(ls)}function gP(){return/Android/.test(ls)}var ss={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1},image:{mjpg:1}};function qm(n,e){let t=ss[e];return!!t&&!!t[n.slice(0,4)]}function xo(n,e,t=!0){return!n.split(",").some(i=>!Wm(i,e,t))}function Wm(n,e,t=!0){var i;let r=wr(t);return(i=r?.isTypeSupported(_o(n,e)))!=null?i:!1}function _o(n,e){return`${e}/mp4;codecs=${n}`}function WS(n){if(n){let e=n.substring(0,4);return ss.video[e]}return 2}function Gl(n){let e=C_();return n.split(",").reduce((t,i)=>{let s=e&&Do(i)?9:ss.video[i];return s?(s*2+t)/(t?3:2):(ss.audio[i]+t)/(t?2:1)},0)}var Xf={};function vP(n,e=!0){if(Xf[n])return Xf[n];let t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[n];for(let r=0;r<t.length;r++){var i;if(Wm(t[r],"audio",e))return Xf[n]=t[r],t[r];if(t[r]==="mp3"&&(i=wr(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return n}var yP=/flac|opus|mp4a\.40\.34/i;function Kl(n,e=!0){return n.replace(yP,t=>vP(t.toLowerCase(),e))}function bP(n,e){let t=[];if(n){let i=n.split(",");for(let r=0;r<i.length;r++)qm(i[r],"video")||t.push(i[r])}return e&&t.push(e),t.join(",")}function Nl(n,e){if(n&&(n.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(n)!==-1)&&(YS(n,"audio")||YS(n,"video")))return n;if(e){let t=e.split(",");if(t.length>1){if(n){for(let i=t.length;i--;)if(t[i].substring(0,4)===n.substring(0,4))return t[i]}return t[0]}}return e||n}function YS(n,e){return qm(n,e)&&Wm(n,e)}function SP(n){let e=n.split(",");for(let t=0;t<e.length;t++){let i=e[t].split(".");i.length>2&&i[0]==="avc1"&&(e[t]=`avc1.${parseInt(i[1]).toString(16)}${("000"+parseInt(i[2]).toString(16)).slice(-4)}`)}return e.join(",")}function xP(n){if(n.startsWith("av01.")){let e=n.split("."),t=["0","111","01","01","01","0"];for(let i=e.length;i>4&&i<10;i++)e[i]=t[i-4];return e.join(".")}return n}function JS(n){let e=wr(n)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function Th(n){return n.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}var _P={supported:!0,powerEfficient:!0,smooth:!0},EP={supported:!1,smooth:!1,powerEfficient:!1},O_={supported:!0,configurations:[],decodingInfoResults:[_P]};function N_(n,e){return{supported:!1,configurations:e,decodingInfoResults:[EP],error:n}}function IP(n,e,t,i,r,s){let o=n.videoCodec,a=n.audioCodec?n.audioGroups:null,l=s?.audioCodec,c=s?.channels,u=c?parseInt(c):l?1/0:2,d=null;if(a!=null&&a.length)try{a.length===1&&a[0]?d=e.groups[a[0]].channels:d=a.reduce((f,h)=>{if(h){let m=e.groups[h];if(!m)throw new Error(`Audio track group ${h} not found`);Object.keys(m.channels).forEach(p=>{f[p]=(f[p]||0)+m.channels[p]})}return f},{2:0})}catch{return!0}return o!==void 0&&(o.split(",").some(f=>Do(f))||n.width>1920&&n.height>1088||n.height>1920&&n.width>1088||n.frameRate>Math.max(i,30)||n.videoRange!=="SDR"&&n.videoRange!==t||n.bitrate>Math.max(r,8e6))||!!d&&W(u)&&Object.keys(d).some(f=>parseInt(f)>u)}function M_(n,e,t,i={}){let r=n.videoCodec;if(!r&&!n.audioCodec||!t)return Promise.resolve(O_);let s=[],o=TP(n),a=o.length,l=kP(n,e,a>0),c=l.length;for(let u=a||1*c||1;u--;){let d={type:"media-source"};if(a&&(d.video=o[u%a]),c){d.audio=l[u%c];let f=d.audio.bitrate;d.video&&f&&(d.video.bitrate-=f)}s.push(d)}if(r){let u=navigator.userAgent;if(r.split(",").some(d=>Do(d))&&C_())return Promise.resolve(N_(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${u})`),s))}return Promise.all(s.map(u=>{let d=$P(u);return i[d]||(i[d]=t.decodingInfo(u))})).then(u=>({supported:!u.some(d=>!d.supported),configurations:s,decodingInfoResults:u})).catch(u=>({supported:!1,configurations:s,decodingInfoResults:[],error:u}))}function TP(n){var e;let t=(e=n.videoCodec)==null?void 0:e.split(","),i=F_(n),r=n.width||640,s=n.height||480,o=n.frameRate||30,a=n.videoRange.toLowerCase();return t?t.map(l=>{let c={contentType:_o(xP(l),"video"),width:r,height:s,bitrate:i,framerate:o};return a!=="sdr"&&(c.transferFunction=a),c}):[]}function kP(n,e,t){var i;let r=(i=n.audioCodec)==null?void 0:i.split(","),s=F_(n);return r&&n.audioGroups?n.audioGroups.reduce((o,a)=>{var l;let c=a?(l=e.groups[a])==null?void 0:l.tracks:null;return c?c.reduce((u,d)=>{if(d.groupId===a){let f=parseFloat(d.channels||"");r.forEach(h=>{let m={contentType:_o(h,"audio"),bitrate:t?U_(h,s):s};f&&(m.channels=""+f),u.push(m)})}return u},o):o},[]):[]}function U_(n,e){if(e<=1)return 1;let t=128e3;return n==="ec-3"?t=768e3:n==="ac-3"&&(t=64e4),Math.min(e/2,t)}function F_(n){return Math.ceil(Math.max(n.bitrate*.9,n.averageBitrate)/1e3)*1e3||1}function $P(n){let e="",{audio:t,video:i}=n;if(i){let r=Th(i.contentType);e+=`${r}_r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${Math.ceil(i.bitrate/1e5)}`}if(t){let r=Th(t.contentType);e+=`${i?"_":""}${r}_c${t.channels}`}return e}function $r(n,e,t){let i=encodeURIComponent(e),r=`${i}=${encodeURIComponent(t)}`,s=!1,o=[];n.search.substring(1).split("&").forEach(a=>{a===i||a.startsWith(i+"=")?s||(o.push(r),s=!0):a&&o.push(a)}),s||o.push(r),n.search=o.join("&")}var kh=["NONE","TYPE-0","TYPE-1",null];function AP(n){return kh.indexOf(n)>-1}var Hl=["SDR","PQ","HLG"];function wP(n){return!!n&&Hl.indexOf(n)>-1}var Ml={No:"",Yes:"YES",v2:"v2"};function XS(n){let{canSkipUntil:e,canSkipDateRanges:t,age:i}=n,r=i<e/2;return e&&r?t?Ml.v2:Ml.Yes:Ml.No}var Zl=class{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}addDirectives(e){let t=new self.URL(e);return this.msn!==void 0&&$r(t,"_HLS_msn",this.msn.toString()),this.part!==void 0&&$r(t,"_HLS_part",this.part.toString()),this.skip&&$r(t,"_HLS_skip",this.skip),t.href}},li=class{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.imageCodec=void 0,this.iframes=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loadErrorTime=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,"imageCodec"in e&&(this.imageCodec=e.imageCodec),this.codecSet=[e.videoCodec,e.audioCodec].filter(i=>!!i).map(i=>i.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;let i=(t=e.supplemental)==null?void 0:t.videoCodec;i&&i!==e.videoCodec&&(this.codecSet+=`,${i.substring(0,4)}`)}"iframes"in e&&e.iframes?this.iframes=!0:(this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES))}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return QS(this._audioGroups,e)}hasSubtitleGroup(e){return QS(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let i=this._audioGroups;i||(i=this._audioGroups=[]),i.indexOf(t)===-1&&i.push(t)}else if(e==="text"){let i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),i.indexOf(t)===-1&&i.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}};function QS(n,e){return!e||!n?!1:n.indexOf(e)!==-1}function PP(){if(typeof matchMedia=="function"){let n=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(n.media!==e.media)return n.matches===!0}return!1}function RP(n,e){let t=!1,i=[];if(n&&(t=n!=="SDR",i=[n]),e){i=e.allowedVideoRanges||Hl.slice(0);let r=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:r&&PP(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}var LP=n=>{let e=new WeakSet;return(t,i)=>{if(n&&(i=n(t,i)),typeof i=="object"&&i!==null){if(e.has(i))return;e.add(i)}return i}},We=(n,e)=>JSON.stringify(n,LP(e));function DP(n,e,t,i,r){let s=Object.keys(n),o=i?.channels,a=i?.audioCodec,l=r?.videoCodec,c=o&&parseInt(o)===2,u=!1,d=!1,f=1/0,h=1/0,m=1/0,p=1/0,g=0,y=[],{preferHDR:b,allowedVideoRanges:S}=RP(e,r);for(let $=s.length;$--;){let P=n[s[$]];u||(u=P.channels[2]>0),f=Math.min(f,P.minHeight),h=Math.min(h,P.minFramerate),m=Math.min(m,P.minBitrate),S.filter(D=>P.videoRanges[D]>0).length>0&&(d=!0)}f=W(f)?f:0,h=W(h)?h:0;let x=Math.max(1080,f),_=Math.max(30,h);m=W(m)?m:t,t=Math.max(m,t),d||(e=void 0);let I=s.length>1;return{codecSet:s.reduce(($,P)=>{let k=n[P];if(P===$)return $;if(y=d?S.filter(D=>k.videoRanges[D]>0):[],I){if(k.minBitrate>t)return Vn(P,`min bitrate of ${k.minBitrate} > current estimate of ${t}`),$;if(!k.hasDefaultAudio)return Vn(P,"no renditions with default or auto-select sound found"),$;if(a&&P.indexOf(a.substring(0,4))%5!==0)return Vn(P,`audio codec preference "${a}" not found`),$;if(o&&!c){if(!k.channels[o])return Vn(P,`no renditions with ${o} channel sound found (channels options: ${Object.keys(k.channels)})`),$}else if((!a||c)&&u&&k.channels[2]===0)return Vn(P,"no renditions with stereo sound found"),$;if(k.minHeight>x)return Vn(P,`min resolution of ${k.minHeight} > maximum of ${x}`),$;if(k.minFramerate>_)return Vn(P,`min framerate of ${k.minFramerate} > maximum of ${_}`),$;if(!y.some(D=>k.videoRanges[D]>0))return Vn(P,`no variants with VIDEO-RANGE of ${We(y)} found`),$;if(l&&P.indexOf(l.substring(0,4))%5!==0)return Vn(P,`video codec preference "${l}" not found`),$;if(k.maxScore<g)return Vn(P,`max score of ${k.maxScore} < selected max of ${g}`),$}return $&&(Gl(P)>=Gl($)||k.fragmentError>n[$].fragmentError)?$:(p=k.minIndex,g=k.maxScore,P)},void 0),videoRanges:y,preferHDR:b,minFramerate:h,minBitrate:m,minIndex:p}}function Vn(n,e){Le.log(`[abr] start candidates with "${n}" ignored because ${e}`)}function z_(n){return n.reduce((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);let r=t.channels||"2";return i.channels[r]=(i.channels[r]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function CP(n,e,t,i){return n.slice(t,i+1).reduce((r,s,o)=>{if(!s.codecSet)return r;let a=s.audioGroups,l=r[s.codecSet];l||(r[s.codecSet]=l={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:o,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!a,fragmentError:0}),l.minBitrate=Math.min(l.minBitrate,s.bitrate);let c=Math.min(s.height,s.width);return l.minHeight=Math.min(l.minHeight,c),l.minFramerate=Math.min(l.minFramerate,s.frameRate),l.minIndex=Math.min(l.minIndex,o),l.maxScore=Math.max(l.maxScore,s.score),l.fragmentError+=s.fragmentError,l.videoRanges[s.videoRange]=(l.videoRanges[s.videoRange]||0)+1,a&&a.forEach(u=>{if(!u)return;let d=e.groups[u];d&&(l.hasDefaultAudio=l.hasDefaultAudio||e.hasDefaultAudio?d.hasDefault:d.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(d.channels).forEach(f=>{l.channels[f]=(l.channels[f]||0)+d.channels[f]}))}),r},{})}function ex(n){if(!n)return n;let{lang:e,assocLang:t,characteristics:i,channels:r,audioCodec:s}=n;return{lang:e,assocLang:t,characteristics:i,channels:r,audioCodec:s}}function Zn(n,e,t){if("attrs"in n){let i=e.indexOf(n);if(i!==-1)return i}for(let i=0;i<e.length;i++){let r=e[i];if(si(n,r,t))return i}return-1}function si(n,e,t){let{groupId:i,name:r,lang:s,assocLang:o,default:a}=n,l=n.forced;return(i===void 0||e.groupId===i)&&(r===void 0||e.name===r)&&(s===void 0||OP(s,e.lang))&&(o===void 0||e.assocLang===o)&&(a===void 0||e.default===a)&&(l===void 0||e.forced===l)&&(!("characteristics"in n)||NP(n.characteristics||"",e.characteristics))&&(t===void 0||t(n,e))}function OP(n,e="--"){return n.length===e.length?n===e:n.startsWith(e)||e.startsWith(n)}function NP(n,e=""){let t=n.split(","),i=e.split(",");return t.length===i.length&&!t.some(r=>i.indexOf(r)===-1)}function ii(n,e){let{audioCodec:t,channels:i}=n;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}function MP(n,e,t,i,r){let s=e[i],a=e.reduce((f,h,m)=>{let p=h.uri;return(f[p]||(f[p]=[])).push(m),f},{})[s.uri];a.length>1&&(i=Math.max.apply(Math,a));let l=s.videoRange,c=s.frameRate,u=s.codecSet.substring(0,4),d=tx(e,i,f=>{if(f.videoRange!==l||f.frameRate!==c||f.codecSet.substring(0,4)!==u)return!1;let h=f.audioGroups,m=t.filter(p=>Eo(p.groupId,h));return Zn(n,m,r)>-1});return d>-1?d:tx(e,i,f=>{let h=f.audioGroups,m=t.filter(p=>Eo(p.groupId,h));return Zn(n,m,r)>-1})}function tx(n,e,t){for(let i=e;i>-1;i--)if(t(n[i]))return i;for(let i=e+1;i<n.length;i++)if(t(n[i]))return i;return-1}function ql(n,e){var t;return!!n&&n!==((t=e.loadLevelObj)==null?void 0:t.uri)}function Eo(n,e){return e?e.indexOf(n)!==-1:!0}function B_(n,e){if(e||n){let t=Fe({},e);return n&&(n.videoCodec&&(t.videoCodec=n.videoCodec),n.videoRange&&(t.allowedVideoRanges=[n.videoRange])),t}}var $h=class extends jt{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.firstAutoFloor=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var i;let{fragCurrent:r,partCurrent:s,hls:o}=this;if(!o)return;let{autoLevelEnabled:a,media:l}=o;if(!r||!l)return;let c=performance.now(),u=s?s.stats:r.stats,d=s?s.duration:r.duration,f=c-u.loading.start,h=o.minAutoLevel,m=r.level,p=this._nextAutoLevel;if(u.aborted||u.loaded&&u.loaded===u.total||m<=h){this.clearTimer(),this._nextAutoLevel=-1;return}if(!a)return;let g=p>-1&&p!==m,y=!!t||g;if(!y&&(l.paused||!l.playbackRate||!l.readyState))return;let b=o.mainForwardBufferInfo;if(!y&&b===null)return;let S=this.bwEstimator.getEstimateTTFB(),x=Math.abs(l.playbackRate);if(f<=Math.max(S,1e3*(d/(x*2))))return;let _=b?b.len/x:0,I=u.loading.first?u.loading.first-u.loading.start:-1,T=u.loaded&&I>-1,$=this.getBwEstimate(),P=o.levels,k=P[m],D=Math.max(u.loaded,Math.round(d*(r.bitrate||k.averageBitrate)/8)),U=T?f-I:f;U<1&&T&&(U=Math.min(f,u.loaded*8/$));let V=T?u.loaded*1e3/U:0,X=S/1e3,q=V?(D-u.loaded)/V:D*8/$+X;if(q<=_)return;let z=V?V*8:$,B=((i=t?.details||o.latestLevelDetails)==null?void 0:i.live)===!0,j=o.config.abrBandWidthUpFactor,Z=Number.POSITIVE_INFINITY,ie;for(ie=m-1;ie>h;ie--){let le=P[ie].maxBitrate,_e=!P[ie].details||B;if(Z=this.getTimeToLoadFrag(X,z,d*le,_e),Z<Math.min(_,d+X))break}if(Z>=q||Z>d*10)return;T?this.bwEstimator.sample(f-Math.min(S,I),u.loaded):this.bwEstimator.sampleTTFB(f);let K=P[ie].maxBitrate;this.getBwEstimate()*j>K&&(this.firstAutoFloor=Math.min(ie,o.firstLevel),this.resetEstimator(K));let Y=this.findBestLevel(K,h,ie,0,_,1,1);Y>-1&&(ie=Y),this.warn(`Fragment ${r.sn}${s?" part "+s.index:""} of level ${m} is loading too slowly;
|
|
1982
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of n.seen.entries()){let a=o[1];if(e===o[0]){s(o);continue}if(n.external){let c=n.external.registry.get(o[0])?.id;if(e!==o[0]&&c){s(o);continue}}if(n.metadataRegistry.get(o[0])?.id){s(o);continue}if(a.cycle){s(o);continue}a.count>1&&n.reused==="ref"&&s(o)}n.external&&(n.sharedDefsExtractedFor=n.external)}function k$(n){let e=n.anyOf;if(!Array.isArray(e)||e.length===0||n.type!==void 0)return;let t=[];for(let i of e){if(!i||typeof i!="object")return;k$(i);let r=Object.keys(i);if(r.length!==1||r[0]!=="type")return;let s=i.type;for(let o of Array.isArray(s)?s:[s]){if(typeof o!="string")return;t.includes(o)||t.push(o)}}delete n.anyOf,n.type=t.length===1?t[0]:t}function T$(n){let e=n.additionalProperties;return e===void 0||e===!1||typeof e!="object"||e===null?null:Object.keys(e).length?e:null}function By(n){let e=[];for(let s of n){if(typeof s!="object"||s.type!=="object")return null;for(let o in s)if(!$$.has(o))return null;e.push(s)}let t={},i=new Set;for(let s of e){for(let o in s.properties){if(Object.prototype.hasOwnProperty.call(t,o))continue;let a=[];for(let c of e){let u=c.properties?.[o]??T$(c);u!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(u))||a.push(u))}let l=a.length===1?a[0]:By(a)??{allOf:a};Rt(t,o,l)}for(let o of s.required??[])i.add(o)}let r={type:"object",properties:t};if(i.size&&(r.required=[...i]),e.every(s=>s.additionalProperties===!1))r.additionalProperties=!1;else{let s=[];for(let o of e){let a=T$(o);a&&!s.some(l=>JSON.stringify(l)===JSON.stringify(a))&&s.push(a)}s.length===1?r.additionalProperties=s[0]:s.length>1&&(r.additionalProperties={allOf:s})}return r}function hM(n){let e=n.allOf;if(!Array.isArray(e)||e.length<2)return;for(let r of $$)if(r in n)return;let t=e.filter(r=>I$.some(s=>Array.isArray(r[s]))),i=null;if(!t.length)i=By(e);else{let r=t[0],s=I$.find(l=>Array.isArray(r[l]));if(Object.keys(r).length!==1)return;let o=e.filter(l=>l!==r),a=r[s].map(l=>By([...o,l]));if(a.some(l=>!l))return;i={[s]:a}}i&&(delete n.allOf,Sa(n,i))}function Br(n,e){let t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=a=>{let l=n.seen.get(a);if(l.ref===null)return;let c=l.def??l.schema,u={...c},d=l.ref;if(l.ref=null,d){i(d);let h=n.seen.get(d),m=h.schema;if(m.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(m)):Sa(c,m),Sa(c,u),a._zod.parent===d)for(let g in c)g==="$ref"||g==="allOf"||g in u||delete c[g];if(m.$ref&&h.def)for(let g in c)g==="$ref"||g==="allOf"||g in h.def&&JSON.stringify(c[g])===JSON.stringify(h.def[g])&&delete c[g]}let f=a._zod.parent;if(f&&f!==d){i(f);let h=n.seen.get(f);if(h?.schema.$ref&&(c.$ref=h.schema.$ref,h.def))for(let m in c)m==="$ref"||m==="allOf"||m in h.def&&JSON.stringify(c[m])===JSON.stringify(h.def[m])&&delete c[m]}n.override({zodSchema:a,jsonSchema:c,path:l.path??[]})};if(!n.external||n.sharedEmitDoneFor!==n.external){for(let a of[...n.seen.entries()].reverse())i(a[0]);if(n.target!=="openapi-3.0")for(let a of n.seen.entries())k$(a[1].def??a[1].schema);for(let a of n.deferred)a();if(n.intersections.length){let a=new Map;for(let l of n.seen.values())for(let c of[l.schema,l.def]){let u=c?.allOf;if(!Array.isArray(u))continue;let d=a.get(u);d?d.push(c):a.set(u,[c])}for(let l of n.intersections)for(let c of a.get(l)??[])hM(c)}}let r={};if(n.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":n.target,n.external?.uri){let a=n.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");r.$id=n.external.uri(a)}Sa(r,t.defId?t.schema:t.def??t.schema);let s=n.metadataRegistry.get(e)?.id;s!==void 0&&r.id===s&&delete r.id;let o=n.external?.defs??{};if(!n.external||n.sharedEmitDoneFor!==n.external)for(let a of n.seen.entries()){let l=a[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,Rt(o,l.defId,l.def))}n.external&&(n.sharedEmitDoneFor=n.external),n.external||Object.keys(o).length>0&&(n.target==="draft-2020-12"?r.$defs=o:r.definitions=o);try{let a=JSON.parse(JSON.stringify(r));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:Rs(e,"input",n.processors),output:Rs(e,"output",n.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Kt(n,e){let t=e??{seen:new Set};if(t.seen.has(n))return!1;t.seen.add(n);let i=n._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Kt(i.element,t);if(i.type==="set")return Kt(i.valueType,t);if(i.type==="lazy")return Kt(i.getter(),t);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return Kt(i.innerType,t);if(i.type==="intersection")return Kt(i.left,t)||Kt(i.right,t);if(i.type==="record"||i.type==="map")return Kt(i.keyType,t)||Kt(i.valueType,t);if(i.type==="pipe")return n._zod.traits.has("$ZodCodec")?!0:Kt(i.in,t)||Kt(i.out,t);if(i.type==="object"){for(let r in i.shape)if(Kt(i.shape[r],t))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(Kt(r,t))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(Kt(r,t))return!0;return!!(i.rest&&Kt(i.rest,t))}return!1}var $$,I$,jy,Rs,xa=G(()=>{la();J();$$=new Set(["type","properties","required","additionalProperties"]),I$=["oneOf","anyOf"];jy=(n,e={})=>t=>{let i=Fr({...t,processors:e});return Be(n,i),zr(i,n),Br(i,n)},Rs=(n,e,t={})=>i=>{let{libraryOptions:r,target:s}=i??{},o=Fr({...r??{},target:s,io:e,processors:t});return Be(n,o),zr(o,n),Br(o,n)}});function gt(n){let e={},t=n._zod.def,i=n._zod.traits.has("$ZodCheck")?[n,...t.checks??[]]:t.checks??[];for(let s of i)mM[s._zod.def.check]?.(e,s._zod.def);let r=n._zod.bag;r.minimum!==void 0&&Ls(e,"minimum",r.minimum),r.exclusiveMinimum!==void 0&&Ls(e,"exclusiveMinimum",r.exclusiveMinimum),r.maximum!==void 0&&Ds(e,"maximum",r.maximum),r.exclusiveMaximum!==void 0&&Ds(e,"exclusiveMaximum",r.exclusiveMaximum),r.multipleOf!==void 0&&L$(e,r.multipleOf),r.format!==void 0&&(e.format??(e.format=r.format),r.format.includes("int")&&(e.isInt=!0)),r.mime&&C$(e,r.mime);for(let s of r.patterns??[])D$(e,s);return e}function _a(n){let e=n._zod.def;return e.type==="pipe"&&e.in._zod.traits.has("$ZodTransform")?_a(e.out):e.type==="catch"?_a(e.innerType):n._zod.optin}function Vy(n,e,t){if(e.$ref){if(t.has(e))return e;t.add(e);let m=n.get(e)?.def;if(!m)return e;let p=Vy(n,m,t);return p===m?e:p}for(let m of["anyOf","oneOf"]){let p=e[m];if(!Array.isArray(p))continue;let g=p.map(y=>Vy(n,y,t));g.some((y,b)=>y!==p[b])&&(e={...e,[m]:g})}let i=Array.isArray(e.type)?e.type:[e.type],r=!i.includes("string")&&i.some(m=>m==="number"||m==="integer"),s=e.enum??(e.const!==void 0?[e.const]:void 0);if(!r&&!s?.some(m=>typeof m=="number"))return e;let{minimum:o,maximum:a,exclusiveMinimum:l,exclusiveMaximum:c,multipleOf:u,format:d,id:f,...h}=e;return h.enum?h.enum=h.enum.map(m=>typeof m=="number"?String(m):m):typeof h.const=="number"&&(h.const=String(h.const)),r&&(h.type="string",s||(h.pattern=(i.includes("number")?lr:Ho).source)),h}function vM(n){let e=new Map;for(let i of n.seen.values())i.def&&!e.has(i.schema)&&e.set(i.schema,i);let t=new Map;for(let i of Gy.get(n)??[]){let r=n.seen.get(i),s=(r?.def??r?.schema)?.propertyNames;if(!s||s===!0||t.has(s))continue;let o=Vy(e,s,new Set);o!==s&&t.set(s,o)}if(t.size)for(let i of n.seen.values())for(let r of[i.schema,i.def]){let s=r&&t.get(r.propertyNames);s&&(r.propertyNames=s)}}function M$(n,e,t,i,r){let s=!1,o=JSON.stringify(n,(a,l)=>typeof l!="bigint"?l:(s=!0,null));return s?(pt(e,t,i,r,"BigInt defaults cannot be represented in JSON Schema"),x0):JSON.parse(o)}function Ea(n,e){if("_idmap"in n){let i=n,r=Fr({...e,processors:td}),s={};for(let l of i._idmap.entries()){let[c,u]=l;Be(u,r)}let o={},a={registry:i,uri:e?.uri,defs:s};r.external=a;for(let l of i._idmap.entries()){let[c,u]=l;zr(r,u),Rt(o,c,Br(r,u))}if(Object.keys(s).length>0){let l=r.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[l]:s}}return{schemas:o}}let t=Fr({...e,processors:td});return Be(n,t),zr(t,n),Br(t,n)}var Ls,Ds,A$,L$,D$,C$,O$,w$,P$,R$,mM,pM,gM,N$,Ky,Hy,Zy,qy,Wy,Yy,Jy,Xy,Qy,e0,t0,n0,r0,i0,s0,o0,a0,l0,c0,u0,d0,f0,h0,m0,p0,nd,g0,v0,Gy,y0,b0,S0,x0,_0,E0,I0,T0,k0,$0,rd,A0,td,Ia=G(()=>{gi();Ts();xa();J();Ls=(n,e,t)=>{(n[e]===void 0||t>n[e])&&(n[e]=t)},Ds=(n,e,t)=>{(n[e]===void 0||t<n[e])&&(n[e]=t)},A$=(n,e)=>{Ls(n,"minimum",e),Ds(n,"maximum",e)},L$=(n,e)=>{n.multipleOf??(n.multipleOf=[]),n.multipleOf.includes(e)||n.multipleOf.push(e)},D$=(n,e)=>{n.patterns??(n.patterns=new Set),n.patterns.add(e)},C$=(n,e)=>{n.mime=n.mime?n.mime.filter(t=>e.includes(t)):[...e]},O$=(n,e)=>{n.format=e,e.includes("int")&&(n.isInt=!0)},w$=(n,e)=>Ls(n,"minimum",e.minimum),P$=(n,e)=>Ds(n,"maximum",e.maximum),R$=n=>(e,t)=>{O$(e,t.format);let[i,r]=n[t.format];Ls(e,"minimum",i),Ds(e,"maximum",r)},mM={greater_than:(n,e)=>Ls(n,e.inclusive?"minimum":"exclusiveMinimum",e.value),less_than:(n,e)=>Ds(n,e.inclusive?"maximum":"exclusiveMaximum",e.value),multiple_of:(n,e)=>L$(n,e.value),number_format:R$(Mo),bigint_format:R$(Uo),min_length:w$,max_length:P$,length_equals:(n,e)=>A$(n,e.length),min_size:w$,max_size:P$,size_equals:(n,e)=>A$(n,e.size),string_format:(n,e)=>{O$(n,e.format),e.pattern&&D$(n,e.pattern),(e.format==="base64"||e.format==="base64url")&&(n.contentEncoding=e.format),(e.local||e.precision===-1)&&(n.laxFormat=!0)},mime_type:(n,e)=>C$(n,e.mime)};pM={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gM=new Map([[au,Zp],[Qo,qp]]),N$=n=>gM.get(n)??n,Ky=(n,e,t,i)=>{let r=t;r.type="string";let{minimum:s,maximum:o,format:a,patterns:l,contentEncoding:c,laxFormat:u}=gt(n);if(typeof s=="number"&&(r.minLength=s),typeof o=="number"&&(r.maxLength=o),a&&(r.format=pM[a]??a,r.format===""&&delete r.format,(a==="time"||u)&&delete r.format),c&&(r.contentEncoding=c),l&&l.size>0){let d=[...l].map(N$);d.length===1?r.pattern=d[0].source:d.length>1&&(r.allOf=[...d.map(f=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},Hy=(n,e,t,i)=>{let r=t,{minimum:s,maximum:o,multipleOf:a,exclusiveMaximum:l,exclusiveMinimum:c,isInt:u}=gt(n);r.type=u?"integer":"number";let d=typeof c=="number"&&c>=(s??Number.NEGATIVE_INFINITY),f=typeof l=="number"&&l<=(o??Number.POSITIVE_INFINITY),h=e.target==="draft-04"||e.target==="openapi-3.0";if(d?h?(r.minimum=c,r.exclusiveMinimum=!0):r.exclusiveMinimum=c:typeof s=="number"&&(r.minimum=s),f?h?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l:typeof o=="number"&&(r.maximum=o),a){let m=new Set;for(let y of a)Number.isFinite(y)&&y!==0?m.add(Math.abs(y)):pt(n,e,r,i,`A multipleOf divisor of ${y} cannot be represented in JSON Schema`);let[p,...g]=m;p!==void 0&&(r.multipleOf=p),g.length&&(r.allOf=[...r.allOf??[],...g.map(y=>({multipleOf:y}))])}},Zy=(n,e,t,i)=>{t.type="boolean"},qy=(n,e,t,i)=>{pt(n,e,t,i,"BigInt cannot be represented in JSON Schema")},Wy=(n,e,t,i)=>{pt(n,e,t,i,"Symbols cannot be represented in JSON Schema")},Yy=(n,e,t,i)=>{e.target==="openapi-3.0"?(t.type="string",t.nullable=!0,t.enum=[null]):t.type="null"},Jy=(n,e,t,i)=>{pt(n,e,t,i,"Undefined cannot be represented in JSON Schema")},Xy=(n,e,t,i)=>{pt(n,e,t,i,"Void cannot be represented in JSON Schema")},Qy=(n,e,t,i)=>{t.not={}},e0=(n,e,t,i)=>{},t0=(n,e,t,i)=>{},n0=(n,e,t,i)=>{pt(n,e,t,i,"Date cannot be represented in JSON Schema")},r0=(n,e,t,i)=>{let r=n._zod.def,s=ds(r.entries);if(s.length===0){t.not={};return}s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),t.enum=s},i0=(n,e,t,i)=>{let r=n._zod.def;if(r.values.length===0){t.not={};return}let s=[];for(let o of r.values)if(o===void 0){if(pt(n,e,t,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o=="bigint"){if(pt(n,e,t,i,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){let o=s[0];t.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?t.enum=[o]:t.const=o}else s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),s.every(o=>typeof o=="boolean")&&(t.type="boolean"),s.every(o=>o===null)&&(t.type="null"),t.enum=s},s0=(n,e,t,i)=>{pt(n,e,t,i,"NaN cannot be represented in JSON Schema")},o0=(n,e,t,i)=>{let r=t,s=n._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=s.source},a0=(n,e,t,i)=>{let r=t;r.type="string",r.format="binary",r.contentEncoding="binary";let{minimum:s,maximum:o,mime:a}=gt(n);s!==void 0&&(r.minLength=s),o!==void 0&&(r.maxLength=o),a&&(a.length===0?r.not={}:a.length===1?r.contentMediaType=a[0]:r.anyOf=a.map(l=>({contentMediaType:l})))},l0=(n,e,t,i)=>{t.type="boolean"},c0=(n,e,t,i)=>{pt(n,e,t,i,"Custom types cannot be represented in JSON Schema")},u0=(n,e,t,i)=>{pt(n,e,t,i,"Function types cannot be represented in JSON Schema")},d0=(n,e,t,i)=>{pt(n,e,t,i,"Transforms cannot be represented in JSON Schema")},f0=(n,e,t,i)=>{pt(n,e,t,i,"Map cannot be represented in JSON Schema")},h0=(n,e,t,i)=>{pt(n,e,t,i,"Set cannot be represented in JSON Schema")},m0=(n,e,t,i)=>{let r=t,s=n._zod.def,{minimum:o,maximum:a}=gt(n);typeof o=="number"&&(r.minItems=o),typeof a=="number"&&(r.maxItems=a),r.type="array",r.items=Be(s.element,e,{...i,path:[...i.path,"items"]})};p0=(n,e,t,i)=>{let r=t,s=n._zod.def,o=s.shape;if(Object.getOwnPropertySymbols(o).length&&pt(n,e,r,i,"Symbol keys cannot be represented in JSON Schema"))return;r.type="object",r.properties={};for(let c in o)Rt(r.properties,c,Be(o[c],e,{...i,path:[...i.path,"properties",c]}));let l=[];for(let c of Object.keys(o)){let u=s.shape[c];(e.io==="input"?_a(u)===void 0:u._zod.optout===void 0)&&l.push(c)}l.length>0&&(r.required=l),s.catchall?._zod.def.type==="never"?r.additionalProperties=!1:s.catchall?s.catchall&&(r.additionalProperties=Be(s.catchall,e,{...i,path:[...i.path,"additionalProperties"]})):e.io==="output"&&(r.additionalProperties=!1)},nd=(n,e,t,i)=>{let r=n._zod.def,s=r.inclusive===!1,o=r.options.map((a,l)=>Be(a,e,{...i,path:[...i.path,s?"oneOf":"anyOf",l]}));s?t.oneOf=o:t.anyOf=o},g0=(n,e,t,i)=>{let r=n._zod.def,s=Be(r.left,e,{...i,path:[...i.path,"allOf",0]}),o=Be(r.right,e,{...i,path:[...i.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,l=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];t.allOf=l,e.intersections.push(l)},v0=(n,e,t,i)=>{let r=t,s=n._zod.def;r.type="array";let o=e.target==="draft-2020-12"?"prefixItems":"items",a=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",l=s.items.map((p,g)=>Be(p,e,{...i,path:[...i.path,o,g]})),c=s.rest?Be(s.rest,e,{...i,path:[...i.path,a,...e.target==="openapi-3.0"?[s.items.length]:[]]}):null,u=s.items.length;for(;u>0;){let p=s.items[u-1];if(!(e.io==="input"?_a(p)!==void 0:p._zod.optout==="optional"))break;u--}let d=s.items.length,f=!s.rest;e.target==="draft-2020-12"?(r.prefixItems=l,f?r.items=!1:c&&(r.items=c),u>0&&(r.minItems=u),f&&(r.maxItems=d)):e.target==="openapi-3.0"?(r.items={anyOf:l},c&&r.items.anyOf.push(c),u>0&&(r.minItems=u),f&&(r.maxItems=d)):(r.items=l,f?r.additionalItems=!1:c&&(r.additionalItems=c),u>0&&(r.minItems=u),f&&(r.maxItems=d));let{minimum:h,maximum:m}=gt(n);typeof h=="number"&&(r.minItems=h),typeof m=="number"&&(r.maxItems=m)};Gy=new WeakMap;y0=(n,e,t,i)=>{let r=t,s=n._zod.def;r.type="object";let o=s.keyType,a=gt(o).patterns;if(s.mode==="loose"&&a&&a.size>0){let u=Be(s.valueType,e,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let d of a)Rt(r.patternProperties,N$(d).source,u)}else{if(e.target==="draft-07"||e.target==="draft-2020-12"){r.propertyNames=Be(s.keyType,e,{...i,path:[...i.path,"propertyNames"]});let u=Gy.get(e);u||(u=[],Gy.set(e,u),e.deferred.push(()=>vM(e))),u.push(n)}r.additionalProperties=Be(s.valueType,e,{...i,path:[...i.path,"additionalProperties"]})}let l=o._zod.values,c=e.io==="input"&&_a(s.valueType)!==void 0;if(l&&!s.partial&&!c){let u=[...l].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(r.required=u.map(String))}},b0=(n,e,t,i)=>{let r=n._zod.def,s=Be(r.innerType,e,i),o=e.seen.get(n);e.target==="openapi-3.0"?(o.ref=r.innerType,t.nullable=!0):t.anyOf=[s,{type:"null"}]},S0=(n,e,t,i)=>{let r=n._zod.def;Be(r.innerType,e,i);let s=e.seen.get(n);s.ref=r.innerType},x0=Symbol();_0=(n,e,t,i)=>{let r=n._zod.def;Be(r.innerType,e,i);let s=e.seen.get(n);s.ref=r.innerType;let o=M$(r.defaultValue,n,e,t,i);o!==x0&&(t.default=o)},E0=(n,e,t,i)=>{let r=n._zod.def;Be(r.innerType,e,i);let s=e.seen.get(n);if(s.ref=r.innerType,e.io!=="input")return;let o=M$(r.defaultValue,n,e,t,i);o!==x0&&(t._prefault=o)},I0=(n,e,t,i)=>{let r=n._zod.def;Be(r.innerType,e,i);let s=e.seen.get(n);s.ref=r.innerType;let o;try{o=r.catchValue(void 0)}catch{pt(n,e,t,i,"Dynamic catch values are not supported in JSON Schema");return}t.default=o},T0=(n,e,t,i)=>{let r=n._zod.def,s=r.in._zod.traits.has("$ZodTransform"),o=e.io==="input"?s?r.out:r.in:r.out;Be(o,e,i);let a=e.seen.get(n);a.ref=o},k0=(n,e,t,i)=>{let r=n._zod.def;Be(r.innerType,e,i);let s=e.seen.get(n);s.ref=r.innerType,t.readOnly=!0},$0=(n,e,t,i)=>{let r=n._zod.def;Be(r.innerType,e,i);let s=e.seen.get(n);s.ref=r.innerType},rd=(n,e,t,i)=>{let r=n._zod.def;Be(r.innerType,e,i);let s=e.seen.get(n);s.ref=r.innerType},A0=(n,e,t,i)=>{let r=n._zod.innerType;Be(r,e,i);let s=e.seen.get(n);s.ref=r},td={string:Ky,number:Hy,boolean:Zy,bigint:qy,symbol:Wy,null:Yy,undefined:Jy,void:Xy,never:Qy,any:e0,unknown:t0,date:n0,enum:r0,literal:i0,nan:s0,template_literal:o0,file:a0,success:l0,custom:c0,function:u0,transform:d0,map:f0,set:h0,array:m0,object:p0,union:nd,intersection:g0,tuple:v0,record:y0,nullable:b0,nonoptional:S0,default:_0,prefault:E0,catch:I0,pipe:T0,readonly:k0,promise:$0,optional:rd,lazy:A0}});var id,U$=G(()=>{Ia();xa();id=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??"draft-2020-12";t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),this.ctx=Fr({processors:td,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return Be(e,this.ctx,t)}emit(e,t){t&&(t.cycles&&(this.ctx.cycles=t.cycles),t.reused&&(this.ctx.reused=t.reused),t.external&&(this.ctx.external=t.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,zr(this.ctx,e);let i=Br(this.ctx,e),{"~standard":r,...s}=i;return s}}});var F$={};var z$=G(()=>{});var Yn={};jn(Yn,{$ZodAny:()=>pv,$ZodArray:()=>xv,$ZodAsyncError:()=>sn,$ZodBase64:()=>rv,$ZodBase64URL:()=>iv,$ZodBigInt:()=>hu,$ZodBigIntFormat:()=>dv,$ZodBoolean:()=>ea,$ZodCIDRv4:()=>tv,$ZodCIDRv6:()=>nv,$ZodCUID:()=>Vg,$ZodCUID2:()=>Gg,$ZodCatch:()=>Fv,$ZodCheck:()=>Ze,$ZodCheckBigIntFormat:()=>pg,$ZodCheckEndsWith:()=>$g,$ZodCheckGreaterThan:()=>Wc,$ZodCheckIncludes:()=>Tg,$ZodCheckLengthEquals:()=>xg,$ZodCheckLessThan:()=>qc,$ZodCheckLowerCase:()=>Eg,$ZodCheckMaxLength:()=>bg,$ZodCheckMaxSize:()=>gg,$ZodCheckMimeType:()=>Pg,$ZodCheckMinLength:()=>Sg,$ZodCheckMinSize:()=>vg,$ZodCheckMultipleOf:()=>hg,$ZodCheckNumberFormat:()=>mg,$ZodCheckOverwrite:()=>Rg,$ZodCheckProperties:()=>wg,$ZodCheckProperty:()=>Ag,$ZodCheckRegex:()=>_g,$ZodCheckSizeEquals:()=>yg,$ZodCheckStartsWith:()=>kg,$ZodCheckStringFormat:()=>Es,$ZodCheckUpperCase:()=>Ig,$ZodCodec:()=>na,$ZodCreditCard:()=>ov,$ZodCustom:()=>Hv,$ZodCustomStringFormat:()=>cv,$ZodCyclicError:()=>xu,$ZodDate:()=>bv,$ZodDefault:()=>Ov,$ZodDiscriminatedUnion:()=>Iv,$ZodE164:()=>sv,$ZodEmail:()=>Mg,$ZodEmoji:()=>Bg,$ZodEncodeError:()=>Cr,$ZodEnum:()=>wv,$ZodError:()=>kp,$ZodExactOptional:()=>Dv,$ZodFile:()=>Rv,$ZodFunction:()=>Gv,$ZodGUID:()=>Og,$ZodIBAN:()=>av,$ZodIPv4:()=>Xg,$ZodIPv6:()=>Qg,$ZodISODate:()=>Wg,$ZodISODateTime:()=>qg,$ZodISODuration:()=>Jg,$ZodISOTime:()=>Yg,$ZodIntersection:()=>Tv,$ZodJWT:()=>lv,$ZodKSUID:()=>Zg,$ZodLazy:()=>ra,$ZodLiteral:()=>Pv,$ZodMAC:()=>ev,$ZodMap:()=>$v,$ZodNaN:()=>zv,$ZodNanoID:()=>jg,$ZodNever:()=>vv,$ZodNonOptional:()=>Mv,$ZodNull:()=>mv,$ZodNullable:()=>Cv,$ZodNumber:()=>fu,$ZodNumberFormat:()=>uv,$ZodObject:()=>VI,$ZodObjectJIT:()=>_v,$ZodOptional:()=>gu,$ZodPipe:()=>vu,$ZodPrefault:()=>Nv,$ZodPreprocess:()=>Bv,$ZodPromise:()=>Kv,$ZodReadonly:()=>jv,$ZodRealError:()=>on,$ZodRecord:()=>kv,$ZodRegistry:()=>$u,$ZodSet:()=>Av,$ZodString:()=>yi,$ZodStringFormat:()=>ze,$ZodSuccess:()=>Uv,$ZodSymbol:()=>fv,$ZodTemplateLiteral:()=>Vv,$ZodTransform:()=>Lv,$ZodTuple:()=>pu,$ZodType:()=>ye,$ZodULID:()=>Kg,$ZodURL:()=>zg,$ZodUUID:()=>Ng,$ZodUndefined:()=>hv,$ZodUnion:()=>ta,$ZodUnknown:()=>gv,$ZodVoid:()=>yv,$ZodXID:()=>Hg,$ZodXor:()=>Ev,$brand:()=>Rc,$constructor:()=>w,$input:()=>wu,$output:()=>Au,Doc:()=>vi,INVALID:()=>Ut,JSONSchema:()=>F$,JSONSchemaGenerator:()=>id,NEVER:()=>Pc,TimePrecision:()=>ed,URL_BAD_FORMAT:()=>Ug,URL_UNPARSEABLE:()=>Wo,ZodCompileAsyncError:()=>_n,ZodCompileUnsupportedError:()=>$e,_any:()=>ky,_array:()=>Dy,_base64:()=>Yu,_base64url:()=>Ju,_bigint:()=>by,_boolean:()=>vy,_catch:()=>aM,_check:()=>x$,_cidrv4:()=>qu,_cidrv6:()=>Wu,_coercedBigint:()=>Sy,_coercedBoolean:()=>yy,_coercedDate:()=>Ry,_coercedNumber:()=>dy,_coercedString:()=>oy,_creditCard:()=>ly,_cuid:()=>Bu,_cuid2:()=>ju,_custom:()=>Oy,_date:()=>Py,_decode:()=>Mc,_decodeAsync:()=>Fc,_default:()=>iM,_discriminatedUnion:()=>HN,_e164:()=>Xu,_email:()=>Du,_emoji:()=>Fu,_encode:()=>Nc,_encodeAsync:()=>Uc,_endsWith:()=>$i,_enum:()=>XN,_file:()=>Cy,_float32:()=>hy,_float64:()=>my,_gt:()=>Mn,_gte:()=>ln,_guid:()=>Cu,_iban:()=>cy,_includes:()=>Ti,_int:()=>fy,_int32:()=>py,_int64:()=>xy,_intersection:()=>ZN,_ipv4:()=>Hu,_ipv6:()=>Zu,_isoDate:()=>fa,_isoDateTime:()=>da,_isoDuration:()=>ma,_isoTime:()=>ha,_jwt:()=>Qu,_ksuid:()=>Ku,_lazy:()=>dM,_length:()=>Ur,_literal:()=>eM,_lowercase:()=>Ei,_lt:()=>Nn,_lte:()=>an,_mac:()=>ay,_map:()=>YN,_max:()=>an,_maxLength:()=>Mr,_maxSize:()=>ur,_mime:()=>wi,_min:()=>ln,_minLength:()=>Wn,_minSize:()=>Un,_multipleOf:()=>cr,_nan:()=>Ly,_nanoid:()=>zu,_nativeEnum:()=>QN,_negative:()=>ga,_never:()=>Ay,_nonnegative:()=>ya,_nonoptional:()=>sM,_nonpositive:()=>va,_normalize:()=>Pi,_null:()=>Ty,_nullable:()=>rM,_number:()=>uy,_optional:()=>nM,_overwrite:()=>En,_parse:()=>bs,_parseAsync:()=>Ss,_pipe:()=>lM,_positive:()=>pa,_promise:()=>fM,_properties:()=>Ai,_property:()=>ba,_readonly:()=>cM,_record:()=>WN,_refine:()=>Ny,_regex:()=>_i,_safeDecode:()=>Bc,_safeDecodeAsync:()=>Vc,_safeEncode:()=>zc,_safeEncodeAsync:()=>jc,_safeParse:()=>xs,_safeParseAsync:()=>_s,_set:()=>JN,_size:()=>Nr,_slugify:()=>Ci,_startsWith:()=>ki,_string:()=>sy,_stringFormat:()=>Oi,_stringbool:()=>zy,_success:()=>oM,_superRefine:()=>My,_symbol:()=>Ey,_templateLiteral:()=>uM,_toLowerCase:()=>Li,_toUpperCase:()=>Di,_transform:()=>tM,_trim:()=>Ri,_tuple:()=>qN,_uint32:()=>gy,_uint64:()=>_y,_ulid:()=>Vu,_undefined:()=>Iy,_union:()=>GN,_unknown:()=>$y,_uppercase:()=>Ii,_url:()=>ua,_uuid:()=>Ou,_uuidv4:()=>Nu,_uuidv6:()=>Mu,_uuidv7:()=>Uu,_void:()=>wy,_xid:()=>Gu,_xor:()=>KN,base64Charset:()=>au,base64urlCharset:()=>Qo,canParseURL:()=>Fg,clone:()=>Me,compile:()=>Pu,compileFn:()=>Ru,config:()=>it,createStandardJSONSchemaMethod:()=>Rs,createToJSONSchemaMethod:()=>jy,decode:()=>mI,decodeAsync:()=>gI,describe:()=>Uy,encode:()=>hI,encodeAsync:()=>pI,extractDefs:()=>zr,finalize:()=>Br,flattenError:()=>vs,formatError:()=>ys,getDiscriminatedOption:()=>mu,globalConfig:()=>_t,globalRegistry:()=>Et,handleUnrepresentable:()=>pt,initializeContext:()=>Fr,isBackEdge:()=>Eu,isRecursiveSchema:()=>_u,isValidBase64:()=>Xo,isValidBase64URL:()=>lu,isValidCIDRv6:()=>ou,isValidCreditCard:()=>cu,isValidIBAN:()=>uu,isValidIPv6:()=>Jo,isValidJWT:()=>du,locales:()=>ws,memoizer:()=>$s,mergeValues:()=>Is,meta:()=>Fy,parse:()=>Vo,parseAsync:()=>Go,parseURLObject:()=>zI,prettifyError:()=>Dc,process:()=>Be,processSchema:()=>Be,regexes:()=>gn,registry:()=>aa,safeDecode:()=>yI,safeDecodeAsync:()=>SI,safeEncode:()=>vI,safeEncodeAsync:()=>bI,safeParse:()=>Oc,safeParseAsync:()=>Ap,standardProps:()=>nu,stripTabAndNewline:()=>Yo,toDotPath:()=>dI,toJSONSchema:()=>Ea,toZod:()=>us,treeifyError:()=>Lc,urlHostnameOk:()=>iu,urlProtocolOk:()=>su,util:()=>O,validate:()=>hi,validateAsync:()=>mi,validateURL:()=>ru,version:()=>Lg,withParser:()=>ca});var cn=G(()=>{Dr();wp();$p();Ts();Wv();Yc();Dg();J();J();gi();Qv();la();Jc();S$();_$();xa();Ia();U$();z$()});function Ta(n,e){let t=typeof e=="function"?e:(o,a)=>{let l=e[o._zod.def.type];return l?l(o,a):o},i=new Map;function r(o){let a=i.get(o);if(a===B$)return new ra({type:"lazy",getter:()=>i.get(o)});if(a!==void 0)return a;i.set(o,B$);let l=s(o),c=t(l,l!==o);return i.set(o,c),c}function s(o){let a=o._zod.def,l=a.type;switch(l){case"object":{let c=a.shape,u=Object.keys(c),d=!1,f={};for(let m of u){let p=r(c[m]);p!==c[m]&&(d=!0),f[m]=p}let h=a.catchall;return a.catchall&&(h=r(a.catchall),h!==a.catchall&&(d=!0)),d?Me(o,{...a,shape:f,catchall:h}):o}case"array":{let c=r(a.element);return c===a.element?o:Me(o,{...a,element:c})}case"tuple":{let c=a.items,u=!1,d=[];for(let h of c){let m=r(h);m!==h&&(u=!0),d.push(m)}let f=a.rest;return a.rest&&(f=r(a.rest),f!==a.rest&&(u=!0)),u?Me(o,{...a,items:d,rest:f}):o}case"record":case"map":{let c=r(a.keyType),u=r(a.valueType);return c===a.keyType&&u===a.valueType?o:Me(o,{...a,keyType:c,valueType:u})}case"set":{let c=r(a.valueType);return c===a.valueType?o:Me(o,{...a,valueType:c})}case"union":{let c=a.options,u=!1,d=[];for(let f of c){let h=r(f);h!==f&&(u=!0),d.push(h)}return u?Me(o,{...a,options:d}):o}case"intersection":{let c=r(a.left),u=r(a.right);return c===a.left&&u===a.right?o:Me(o,{...a,left:c,right:u})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let c=r(a.innerType);return c===a.innerType?o:Me(o,{...a,innerType:c})}case"pipe":{let c=r(a.in),u=r(a.out);return c===a.in&&u===a.out?o:Me(o,{...a,in:c,out:u})}case"function":{let c=r(a.input),u=r(a.output);return c===a.input&&u===a.output?o:Me(o,{...a,input:c,output:u})}case"lazy":{let c=a.getter,{_cachedInner:u,...d}=a;return Me(o,{...d,getter:()=>r(c())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return o;default:return o}}return r(n)}var B$,w0=G(()=>{Ts();J();B$=Symbol("z.visit/resolving")});var ad={};jn(ad,{endsWith:()=>$i,gt:()=>Mn,gte:()=>ln,includes:()=>Ti,length:()=>Ur,lowercase:()=>Ei,lt:()=>Nn,lte:()=>an,maxLength:()=>Mr,maxSize:()=>ur,mime:()=>wi,minLength:()=>Wn,minSize:()=>Un,multipleOf:()=>cr,negative:()=>ga,nonnegative:()=>ya,nonpositive:()=>va,normalize:()=>Pi,overwrite:()=>En,positive:()=>pa,properties:()=>Ai,property:()=>ba,regex:()=>_i,size:()=>Nr,slugify:()=>Ci,startsWith:()=>ki,toLowerCase:()=>Li,toUpperCase:()=>Di,trim:()=>Ri,uppercase:()=>Ii});var ld=G(()=>{cn()});function cd(n,e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!1,get(){let i=t(this);return Object.defineProperty(this,e,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,e,{value:i,configurable:!0,writable:!0})}})}var G$,K$,H$,Ht,P0=G(()=>{cn();cn();J();G$=new WeakSet([Object.prototype,Error.prototype]);K$=(n,e)=>{kp.init(n,e),n.name="ZodError";let t=Object.getPrototypeOf(n);G$.has(t)||(G$.add(t),cd(t,"format",i=>r=>ys(i,r)),cd(t,"flatten",i=>r=>vs(i,r)),cd(t,"addIssue",i=>r=>{i.issues.push(r),i.message=JSON.stringify(i.issues,fs,2)}),cd(t,"addIssues",i=>r=>{i.issues.push(...r),i.message=JSON.stringify(i.issues,fs,2)}),Object.defineProperty(t,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},H$=w("ZodError",K$),Ht=w("ZodError",K$,void 0,{Parent:Error})});var ud,dd,fd,hd,md,pd,gd,vd,yd,bd,Sd,xd,R0=G(()=>{cn();P0();cn();ud=bs(Ht),dd=Ss(Ht),fd=xs(Ht),hd=_s(Ht),md=Nc(Ht),pd=Mc(Ht),gd=Uc(Ht),vd=Fc(Ht),yd=zc(Ht),bd=Bc(Ht),Sd=jc(Ht),xd=Vc(Ht)});var Hs={};jn(Hs,{ZodAny:()=>Ad,ZodArray:()=>Ld,ZodBase64:()=>ja,ZodBase64URL:()=>Va,ZodBigInt:()=>ji,ZodBigIntFormat:()=>Ha,ZodBoolean:()=>Bi,ZodCIDRv4:()=>za,ZodCIDRv6:()=>Ba,ZodCUID:()=>Da,ZodCUID2:()=>Ca,ZodCatch:()=>Jd,ZodCodec:()=>Vs,ZodCreditCard:()=>Ed,ZodCustom:()=>Gs,ZodCustomStringFormat:()=>jr,ZodDate:()=>Ms,ZodDefault:()=>Kd,ZodDiscriminatedUnion:()=>Cd,ZodE164:()=>Ga,ZodEmail:()=>wa,ZodEmoji:()=>Ra,ZodEnum:()=>Mi,ZodExactOptional:()=>Wa,ZodFile:()=>Bd,ZodFunction:()=>lf,ZodGUID:()=>Pa,ZodIBAN:()=>Id,ZodIPv4:()=>Ua,ZodIPv6:()=>Fa,ZodISODate:()=>fr,ZodISODateTime:()=>dr,ZodISODuration:()=>mr,ZodISOTime:()=>hr,ZodInstanceOf:()=>df,ZodIntersection:()=>Od,ZodJWT:()=>Ka,ZodKSUID:()=>Ma,ZodLazy:()=>sf,ZodLiteral:()=>zd,ZodMAC:()=>_d,ZodMap:()=>Ud,ZodNaN:()=>Qd,ZodNanoID:()=>La,ZodNever:()=>Pd,ZodNonOptional:()=>Ya,ZodNull:()=>$d,ZodNullable:()=>Gd,ZodNumber:()=>zi,ZodNumberFormat:()=>Vr,ZodObject:()=>Us,ZodOptional:()=>Bs,ZodPipe:()=>js,ZodPrefault:()=>Zd,ZodPreprocess:()=>ef,ZodPromise:()=>af,ZodReadonly:()=>tf,ZodRecord:()=>Ni,ZodSet:()=>Fd,ZodString:()=>Fi,ZodStringFormat:()=>Ve,ZodSuccess:()=>Yd,ZodSymbol:()=>Td,ZodTemplateLiteral:()=>rf,ZodTransform:()=>jd,ZodTuple:()=>Nd,ZodType:()=>xe,ZodULID:()=>Oa,ZodURL:()=>Os,ZodUUID:()=>Fn,ZodUndefined:()=>kd,ZodUnion:()=>Fs,ZodUnknown:()=>wd,ZodVoid:()=>Rd,ZodXID:()=>Na,ZodXor:()=>Dd,_ZodString:()=>Aa,_default:()=>Hd,_function:()=>Mb,any:()=>yb,array:()=>ke,base64:()=>X0,base64url:()=>Q0,bigint:()=>hb,boolean:()=>ot,catch:()=>Xd,check:()=>Ub,cidrv4:()=>Y0,cidrv6:()=>J0,codec:()=>Db,creditCard:()=>tb,cuid:()=>j0,cuid2:()=>V0,currencyCode:()=>ab,custom:()=>Ja,date:()=>Sb,describe:()=>Fb,discriminatedUnion:()=>zs,e164:()=>eb,email:()=>L0,emoji:()=>z0,enum:()=>Tt,exactOptional:()=>Vd,file:()=>wb,float32:()=>cb,float64:()=>ub,function:()=>Mb,guid:()=>D0,hash:()=>lb,hex:()=>ob,hostname:()=>sb,httpUrl:()=>F0,iban:()=>nb,instanceof:()=>Bb,int:()=>ka,int32:()=>db,int64:()=>mb,intersection:()=>Vi,invertCodec:()=>Cb,ipv4:()=>Z0,ipv6:()=>W0,json:()=>Vb,jwt:()=>rb,keyof:()=>xb,ksuid:()=>H0,lazy:()=>of,literal:()=>ae,looseObject:()=>It,looseRecord:()=>Tb,mac:()=>q0,map:()=>kb,meta:()=>zb,nan:()=>Lb,nanoid:()=>B0,nativeEnum:()=>Ab,never:()=>Za,nonoptional:()=>Wd,null:()=>Ns,nullable:()=>Cs,nullish:()=>Pb,number:()=>Re,object:()=>re,optional:()=>je,partialRecord:()=>Ib,pipe:()=>$a,prefault:()=>qd,preprocess:()=>Ks,promise:()=>Nb,readonly:()=>nf,record:()=>Ge,refine:()=>cf,set:()=>$b,strictObject:()=>_b,string:()=>L,stringFormat:()=>ib,stringbool:()=>jb,success:()=>Rb,superRefine:()=>uf,symbol:()=>gb,templateLiteral:()=>Ob,transform:()=>qa,tuple:()=>Md,uint32:()=>fb,uint64:()=>pb,ulid:()=>G0,undefined:()=>vb,union:()=>Ue,unknown:()=>Ke,url:()=>U0,uuid:()=>C0,uuidv4:()=>O0,uuidv6:()=>N0,uuidv7:()=>M0,void:()=>bb,xid:()=>K0,xor:()=>Eb});function SM(){_t.localeError||it(Iu())}function Ui(){_t.memoizer||it({memoizer:$s()})}function L(n){return sy(Fi,n)}function L0(n){return Du(wa,n)}function D0(n){return Cu(Pa,n)}function C0(n){return Ou(Fn,n)}function O0(n){return Nu(Fn,n)}function N0(n){return Mu(Fn,n)}function M0(n){return Uu(Fn,n)}function U0(n){return ua(Os,n)}function F0(n){return ua(Os,{protocol:Ko,hostname:Yp,...O.normalizeParams(n)})}function z0(n){return Fu(Ra,n)}function B0(n){return zu(La,n)}function j0(n){return Bu(Da,n)}function V0(n){return ju(Ca,n)}function G0(n){return Vu(Oa,n)}function K0(n){return Gu(Na,n)}function H0(n){return Ku(Ma,n)}function Z0(n){return Hu(Ua,n)}function q0(n){return ay(_d,n)}function W0(n){return Zu(Fa,n)}function Y0(n){return qu(za,n)}function J0(n){return Wu(Ba,n)}function X0(n){return Yu(ja,n)}function Q0(n){return Ju(Va,n)}function eb(n){return Xu(Ga,n)}function tb(n){return ly(Ed,n)}function nb(n){return cy(Id,n)}function rb(n){return Qu(Ka,n)}function ib(n,e,t={}){return Oi(jr,n,e,t)}function sb(n){return Oi(jr,"hostname",Wp,n)}function ob(n){return Oi(jr,"hex",ug,n)}function ab(n){return Oi(jr,"currency_code",Xp,n)}function lb(n,e){let t=e?.enc??"hex",i=`${n}_${t}`,r=gn[i];if(!r)throw new Error(`Unrecognized hash format: ${i}`);return Oi(jr,i,r,e)}function Re(n){return uy(zi,n)}function ka(n){return fy(Vr,n)}function cb(n){return hy(Vr,n)}function ub(n){return my(Vr,n)}function db(n){return py(Vr,n)}function fb(n){return gy(Vr,n)}function ot(n){return vy(Bi,n)}function hb(n){return by(ji,n)}function mb(n){return xy(Ha,n)}function pb(n){return _y(Ha,n)}function gb(n){return Ey(Td,n)}function vb(n){return Iy(kd,n)}function Ns(n){return Ty($d,n)}function yb(){return ky(Ad)}function Ke(){return $y(wd)}function Za(n){return Ay(Pd,n)}function bb(n){return wy(Rd,n)}function Sb(n){return Py(Ms,n)}function ke(n,e){return Dy(Ld,n,e)}function xb(n){let e=n._zod.def.shape;return Tt(Object.keys(e))}function re(n,e){let t={type:"object",shape:n??{},...O.normalizeParams(e)};return new Us(t)}function _b(n,e){return new Us({type:"object",shape:n,catchall:Za(),...O.normalizeParams(e)})}function It(n,e){return new Us({type:"object",shape:n,catchall:Ke(),...O.normalizeParams(e)})}function Ue(n,e){return new Fs({type:"union",options:n,...O.normalizeParams(e)})}function Eb(n,e){return new Dd({type:"union",options:n,inclusive:!1,...O.normalizeParams(e)})}function zs(n,e,t){return new Cd({type:"union",options:e,discriminator:n,...O.normalizeParams(t)})}function Vi(n,e){return new Od({type:"intersection",left:n,right:e})}function Md(n,e,t){let i=e instanceof ye,r=i?t:e,s=i?e:null;return new Nd({type:"tuple",items:n,rest:s,...O.normalizeParams(r)})}function Ge(n,e,t){return!e||!e._zod?new Ni({type:"record",keyType:L(),valueType:n,...O.normalizeParams(e)}):new Ni({type:"record",keyType:n,valueType:e,...O.normalizeParams(t)})}function Ib(n,e,t){return new Ni({type:"record",keyType:n,valueType:e,...O.normalizeParams(t),partial:!0})}function Tb(n,e,t){return new Ni({type:"record",keyType:n,valueType:e,mode:"loose",...O.normalizeParams(t)})}function kb(n,e,t){return new Ud({type:"map",keyType:n,valueType:e,...O.normalizeParams(t)})}function $b(n,e){return new Fd({type:"set",valueType:n,...O.normalizeParams(e)})}function Tt(n,e){let t=Array.isArray(n)?Object.fromEntries(n.map(i=>[i,i])):n;return new Mi({type:"enum",entries:t,...O.normalizeParams(e)})}function Ab(n,e){return new Mi({type:"enum",entries:n,...O.normalizeParams(e)})}function ae(n,e){return new zd({type:"literal",values:Array.isArray(n)?n:[n],...O.normalizeParams(e)})}function wb(n){return Cy(Bd,n)}function qa(n){return new jd({type:"transform",transform:n})}function je(n){return new Bs({type:"optional",innerType:n})}function Vd(n){return new Wa({type:"optional",innerType:n})}function Cs(n){return new Gd({type:"nullable",innerType:n})}function Pb(n){return je(Cs(n))}function Hd(n,e){return new Kd({type:"default",innerType:n,get defaultValue(){return typeof e=="function"?e():O.shallowClone(e)}})}function qd(n,e){return new Zd({type:"prefault",innerType:n,get defaultValue(){return typeof e=="function"?e():O.shallowClone(e)}})}function Wd(n,e){return new Ya({type:"nonoptional",innerType:n,...O.normalizeParams(e)})}function Rb(n){return new Yd({type:"success",innerType:n})}function Xd(n,e){return new Jd({type:"catch",innerType:n,catchValue:typeof e=="function"?e:O.constantCatch(e)})}function Lb(n){return Ly(Qd,n)}function $a(n,e){return new js({type:"pipe",in:n,out:e})}function Db(n,e,t){return new Vs({type:"pipe",in:n,out:e,transform:t.decode,reverseTransform:t.encode})}function Cb(n){let e=n._zod.def;return new Vs({type:"pipe",in:e.out,out:e.in,transform:e.reverseTransform,reverseTransform:e.transform})}function nf(n){return new tf({type:"readonly",innerType:n})}function Ob(n,e){return new rf({type:"template_literal",parts:n,...O.normalizeParams(e)})}function of(n){return new sf({type:"lazy",getter:n})}function Nb(n){return new af({type:"promise",innerType:n})}function Mb(n){return new lf({type:"function",input:Array.isArray(n?.input)?Md(n?.input):n?.input??ke(Ke()),output:n?.output??Ke()})}function Ub(n){let e=new Ze({check:"custom"});return e._zod.check=n,e}function Ja(n,e){return Oy(Gs,n??(()=>!0),e)}function cf(n,e={}){return Ny(Gs,n,e)}function uf(n,e){return My(n,e)}function Bb(n,e={}){let t=new df({type:"custom",check:"custom",fn:i=>i instanceof n,abort:!0,...O.normalizeParams(e)});return t._zod.bag.Class=n,t._zod.check=i=>{i.value instanceof n||i.issues.push({code:"invalid_type",expected:n.name,input:i.value,inst:t,path:[...t._zod.def.path??[]]})},t}function Vb(n){let e=of(()=>Ue([L(n),Re(),ot(),Ns(),ke(e),Ge(L(),e)]));return e}function Ks(n,e){return new ef({type:"pipe",in:qa(n),out:e})}var xe,Aa,Fi,Ve,dr,fr,hr,mr,wa,Pa,Fn,Os,Ra,La,Da,Ca,Oa,Na,Ma,Ua,_d,Fa,za,Ba,ja,Va,Ga,Ed,Id,Ka,jr,zi,Vr,Bi,ji,Ha,Td,kd,$d,Ad,wd,Pd,Rd,Ms,Ld,Us,Fs,Dd,Cd,Od,Nd,Ni,Ud,Fd,Mi,zd,Bd,jd,Bs,Wa,Gd,Kd,Zd,Ya,Yd,Jd,Qd,js,Vs,ef,tf,rf,sf,af,lf,Gs,Fb,zb,df,jb,Gr=G(()=>{cn();cn();Ia();gi();xa();Yv();ld();R0();xe=w("ZodType",(n,e)=>(SM(),ye.init(n,e),n.def=e,n.type=e.type,n),{check(...n){let e=this.def;return this.clone(O.mergeDefs(e,{checks:[...e.checks??[],...n.map(t=>typeof t=="function"?{_zod:{check:t,def:{check:"custom"},onattach:[]}}:t)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,e){return Me(this,n,e)},brand(){return this},register(n,e){return n.add(this,e),this},refine(n,e){return this.check(cf(n,e))},superRefine(n,e){return this.check(uf(n,e))},overwrite(n){return this.check(En(n))},optional(){return je(this)},exactOptional(){return Vd(this)},nullable(){return Cs(this)},nullish(){return je(Cs(this))},nonoptional(n){return Wd(this,n)},array(){return ke(this)},or(n){return Ue([this,n])},and(n){return Vi(this,n)},transform(n){return $a(this,qa(n))},default(n){return Hd(this,n)},prefault(n){return qd(this,n)},catch(n){return Xd(this,n)},pipe(n){return $a(this,n)},readonly(){return nf(this)},describe(n){let e=this.clone();return Et.add(e,{description:n}),e},meta(...n){if(n.length===0)return Et.get(this);let e=this.clone();return Et.add(e,n[0]),e},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n,...e){return e.length===0?n(this):n(this,...e)},get"~standard"(){return O.hide(this,"~standard",{...nu(this),jsonSchema:{input:Rs(this,"input"),output:Rs(this,"output")}})},set"~standard"(n){O.own(this,"~standard",n)},parse:function n(e,t){return ud(this,e,t,{callee:n})},parseAsync:async function n(e,t){return await dd(this,e,t,{callee:n})},safeParse(n,e){return fd(this,n,e)},async safeParseAsync(n,e){return hd(this,n,e)},get spa(){return this?.safeParseAsync},set spa(n){O.own(this,"spa",n)},validate(n,e){return hi(this,n,e)},validateAsync(n,e){return mi(this,n,e)},encode:function n(e,t){return md(this,e,t,{callee:n})},decode:function n(e,t){return pd(this,e,t,{callee:n})},encodeAsync:async function n(e,t){return await gd(this,e,t,{callee:n})},decodeAsync:async function n(e,t){return await vd(this,e,t,{callee:n})},safeEncode(n,e){return yd(this,n,e)},safeDecode(n,e){return bd(this,n,e)},async safeEncodeAsync(n,e){return Sd(this,n,e)},async safeDecodeAsync(n,e){return xd(this,n,e)},toJSONSchema(n){return jy(this,{})(n)},get description(){return Et.get(this)?.description},get _def(){return this._zod.def}}),Aa=w("_ZodString",(n,e)=>{yi.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Ky(n,t,i,r)},O.derived({format:n=>gt(n).format??null,minLength:n=>gt(n).minimum??null,maxLength:n=>gt(n).maximum??null},{regex(...n){return this.check(_i(...n))},includes(...n){return this.check(Ti(...n))},startsWith(...n){return this.check(ki(...n))},endsWith(...n){return this.check($i(...n))},min(...n){return this.check(Wn(...n))},max(...n){return this.check(Mr(...n))},length(...n){return this.check(Ur(...n))},nonempty(...n){return this.check(Wn(1,...n))},lowercase(n){return this.check(Ei(n))},uppercase(n){return this.check(Ii(n))},trim(){return this.check(Ri())},normalize(...n){return this.check(Pi(...n))},toLowerCase(){return this.check(Li())},toUpperCase(){return this.check(Di())},slugify(){return this.check(Ci())}})),Fi=w("ZodString",(n,e)=>{yi.init(n,e),Aa.init(n,e)},{email(n){return this.check(Du(wa,n))},url(n){return this.check(ua(Os,n))},jwt(n){return this.check(Qu(Ka,n))},emoji(n){return this.check(Fu(Ra,n))},guid(n){return this.check(Cu(Pa,n))},uuid(n){return this.check(Ou(Fn,n))},uuidv4(n){return this.check(Nu(Fn,n))},uuidv6(n){return this.check(Mu(Fn,n))},uuidv7(n){return this.check(Uu(Fn,n))},nanoid(n){return this.check(zu(La,n))},cuid(n){return this.check(Bu(Da,n))},cuid2(n){return this.check(ju(Ca,n))},ulid(n){return this.check(Vu(Oa,n))},base64(n){return this.check(Yu(ja,n))},base64url(n){return this.check(Ju(Va,n))},xid(n){return this.check(Gu(Na,n))},ksuid(n){return this.check(Ku(Ma,n))},ipv4(n){return this.check(Hu(Ua,n))},ipv6(n){return this.check(Zu(Fa,n))},cidrv4(n){return this.check(qu(za,n))},cidrv6(n){return this.check(Wu(Ba,n))},e164(n){return this.check(Xu(Ga,n))},datetime(n){return this.check(da(dr,n))},date(n){return this.check(fa(fr,n))},time(n){return this.check(ha(hr,n))},duration(n){return this.check(ma(mr,n))}});Ve=w("ZodStringFormat",(n,e)=>{ze.init(n,e),Aa.init(n,e)}),dr=w("ZodISODateTime",(n,e)=>{qg.init(n,e),Ve.init(n,e)}),fr=w("ZodISODate",(n,e)=>{Wg.init(n,e),Ve.init(n,e)}),hr=w("ZodISOTime",(n,e)=>{Yg.init(n,e),Ve.init(n,e)}),mr=w("ZodISODuration",(n,e)=>{Jg.init(n,e),Ve.init(n,e)}),wa=w("ZodEmail",(n,e)=>{Mg.init(n,e),Ve.init(n,e)});Pa=w("ZodGUID",(n,e)=>{Og.init(n,e),Ve.init(n,e)});Fn=w("ZodUUID",(n,e)=>{Ng.init(n,e),Ve.init(n,e)});Os=w("ZodURL",(n,e)=>{zg.init(n,e),Ve.init(n,e)});Ra=w("ZodEmoji",(n,e)=>{Bg.init(n,e),Ve.init(n,e)});La=w("ZodNanoID",(n,e)=>{jg.init(n,e),Ve.init(n,e)});Da=w("ZodCUID",(n,e)=>{Vg.init(n,e),Ve.init(n,e)});Ca=w("ZodCUID2",(n,e)=>{Gg.init(n,e),Ve.init(n,e)});Oa=w("ZodULID",(n,e)=>{Kg.init(n,e),Ve.init(n,e)});Na=w("ZodXID",(n,e)=>{Hg.init(n,e),Ve.init(n,e)});Ma=w("ZodKSUID",(n,e)=>{Zg.init(n,e),Ve.init(n,e)});Ua=w("ZodIPv4",(n,e)=>{Xg.init(n,e),Ve.init(n,e)});_d=w("ZodMAC",(n,e)=>{ev.init(n,e),Ve.init(n,e)});Fa=w("ZodIPv6",(n,e)=>{Qg.init(n,e),Ve.init(n,e)});za=w("ZodCIDRv4",(n,e)=>{tv.init(n,e),Ve.init(n,e)});Ba=w("ZodCIDRv6",(n,e)=>{nv.init(n,e),Ve.init(n,e)});ja=w("ZodBase64",(n,e)=>{rv.init(n,e),Ve.init(n,e)});Va=w("ZodBase64URL",(n,e)=>{iv.init(n,e),Ve.init(n,e)});Ga=w("ZodE164",(n,e)=>{sv.init(n,e),Ve.init(n,e)});Ed=w("ZodCreditCard",(n,e)=>{ov.init(n,e),Ve.init(n,e)});Id=w("ZodIBAN",(n,e)=>{av.init(n,e),Ve.init(n,e)});Ka=w("ZodJWT",(n,e)=>{lv.init(n,e),Ve.init(n,e)});jr=w("ZodCustomStringFormat",(n,e)=>{cv.init(n,e),Ve.init(n,e)});zi=w("ZodNumber",(n,e)=>{fu.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Hy(n,t,i,r),n.isFinite=!0},O.derived({minValue:n=>{let{minimum:e,exclusiveMinimum:t}=gt(n);return Math.max(e??Number.NEGATIVE_INFINITY,t??Number.NEGATIVE_INFINITY)},maxValue:n=>{let{maximum:e,exclusiveMaximum:t}=gt(n);return Math.min(e??Number.POSITIVE_INFINITY,t??Number.POSITIVE_INFINITY)},isInt:n=>{let{isInt:e,multipleOf:t}=gt(n);return!!e||!!t?.some(Number.isSafeInteger)},format:n=>gt(n).format??null},{gt(n,e){return this.check(Mn(n,e))},gte(n,e){return this.check(ln(n,e))},min(n,e){return this.check(ln(n,e))},lt(n,e){return this.check(Nn(n,e))},lte(n,e){return this.check(an(n,e))},max(n,e){return this.check(an(n,e))},int(n){return this.check(ka(n))},safe(n){return this.check(ka(n))},positive(n){return this.check(Mn(0,n))},nonnegative(n){return this.check(ln(0,n))},negative(n){return this.check(Nn(0,n))},nonpositive(n){return this.check(an(0,n))},multipleOf(n,e){return this.check(cr(n,e))},step(n,e){return this.check(cr(n,e))},finite(){return this}}));Vr=w("ZodNumberFormat",(n,e)=>{uv.init(n,e),zi.init(n,e)});Bi=w("ZodBoolean",(n,e)=>{ea.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Zy(n,t,i,r)});ji=w("ZodBigInt",(n,e)=>{hu.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>qy(n,t,i,r)},O.derived({minValue:n=>gt(n).minimum??null,maxValue:n=>gt(n).maximum??null,format:n=>gt(n).format??null},{gte(n,e){return this.check(ln(n,e))},min(n,e){return this.check(ln(n,e))},gt(n,e){return this.check(Mn(n,e))},lt(n,e){return this.check(Nn(n,e))},lte(n,e){return this.check(an(n,e))},max(n,e){return this.check(an(n,e))},positive(n){return this.check(Mn(BigInt(0),n))},negative(n){return this.check(Nn(BigInt(0),n))},nonpositive(n){return this.check(an(BigInt(0),n))},nonnegative(n){return this.check(ln(BigInt(0),n))},multipleOf(n,e){return this.check(cr(n,e))}}));Ha=w("ZodBigIntFormat",(n,e)=>{dv.init(n,e),ji.init(n,e)});Td=w("ZodSymbol",(n,e)=>{fv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Wy(n,t,i,r)});kd=w("ZodUndefined",(n,e)=>{hv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Jy(n,t,i,r)});$d=w("ZodNull",(n,e)=>{mv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Yy(n,t,i,r)});Ad=w("ZodAny",(n,e)=>{pv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>e0(n,t,i,r)});wd=w("ZodUnknown",(n,e)=>{gv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>t0(n,t,i,r)});Pd=w("ZodNever",(n,e)=>{vv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Qy(n,t,i,r)});Rd=w("ZodVoid",(n,e)=>{yv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Xy(n,t,i,r)});Ms=w("ZodDate",(n,e)=>{bv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>n0(n,t,i,r),n.min=(t,i)=>n.check(ln(t,i)),n.max=(t,i)=>n.check(an(t,i))},O.derived({minDate:n=>{let{minimum:e}=gt(n);return e?new Date(e):null},maxDate:n=>{let{maximum:e}=gt(n);return e?new Date(e):null}},{}));Ld=w("ZodArray",(n,e)=>{Ui(),xv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>m0(n,t,i,r),n.element=e.element},{min(n,e){return this.check(Wn(n,e))},nonempty(n){return this.check(Wn(1,n))},max(n,e){return this.check(Mr(n,e))},length(n,e){return this.check(Ur(n,e))},unwrap(){return this.element}});Us=w("ZodObject",(n,e)=>{Ui(),_v.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>p0(n,t,i,r),O.installLazyProp(n,"shape",t=>t._zod.def.shape,!1)},{keyof(){return Tt(Object.keys(this._zod.def.shape))},catchall(n){return this.clone(O.mergeDefs(this._zod.def,{catchall:n}))},passthrough(){return this.clone(O.mergeDefs(this._zod.def,{catchall:Ke()}))},loose(){return this.clone(O.mergeDefs(this._zod.def,{catchall:Ke()}))},strict(){return this.clone(O.mergeDefs(this._zod.def,{catchall:Za()}))},strip(){return this.clone(O.mergeDefs(this._zod.def,{catchall:void 0}))},extend(n){return O.extend(this,n)},safeExtend(n){return O.safeExtend(this,n)},merge(n){return O.merge(this,n)},pick(n){return O.pick(this,n)},omit(n){return O.omit(this,n)},partial(...n){return O.partial(Bs,this,n[0])},exactPartial(...n){return O.partial(Wa,this,n[0],"exactPartial")},required(...n){return O.required(Ya,this,n[0])}});Fs=w("ZodUnion",(n,e)=>{ta.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>nd(n,t,i,r),n.options=e.options});Dd=w("ZodXor",(n,e)=>{Fs.init(n,e),Ev.init(n,e),n._zod.processJSONSchema=(t,i,r)=>nd(n,t,i,r),n.options=e.options});Cd=w("ZodDiscriminatedUnion",(n,e)=>{Fs.init(n,e),Iv.init(n,e)});Od=w("ZodIntersection",(n,e)=>{Tv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>g0(n,t,i,r)});Nd=w("ZodTuple",(n,e)=>{Ui(),pu.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>v0(n,t,i,r)},{rest(n){return this.clone({...this._zod.def,rest:n})},partial(){let n=this._zod.def;if(n.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...n,items:n.items.map(e=>new Bs({type:"optional",innerType:e}))})}});Ni=w("ZodRecord",(n,e)=>{Ui(),kv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>y0(n,t,i,r),n.keyType=e.keyType,n.valueType=e.valueType});Ud=w("ZodMap",(n,e)=>{Ui(),$v.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>f0(n,t,i,r),n.keyType=e.keyType,n.valueType=e.valueType,n.min=(...t)=>n.check(Un(...t)),n.nonempty=t=>n.check(Un(1,t)),n.max=(...t)=>n.check(ur(...t)),n.size=(...t)=>n.check(Nr(...t))});Fd=w("ZodSet",(n,e)=>{Ui(),Av.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>h0(n,t,i,r),n.min=(...t)=>n.check(Un(...t)),n.nonempty=t=>n.check(Un(1,t)),n.max=(...t)=>n.check(ur(...t)),n.size=(...t)=>n.check(Nr(...t))});Mi=w("ZodEnum",(n,e)=>{wv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(i,r,s)=>r0(n,i,r,s),n.enum=e.entries,n.options=[...n._zod.values];let t=new Set(Object.keys(e.entries));n.extract=(i,r)=>{let s={};for(let o of i)if(t.has(o))s[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Mi({...e,checks:[],...O.normalizeParams(r),entries:s})},n.exclude=(i,r)=>{let s={...e.entries};for(let o of i)if(t.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new Mi({...e,checks:[],...O.normalizeParams(r),entries:s})}});zd=w("ZodLiteral",(n,e)=>{Pv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>i0(n,t,i,r),n.values=new Set(e.values),Object.defineProperty(n,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});Bd=w("ZodFile",(n,e)=>{Rv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>a0(n,t,i,r),n.min=(t,i)=>n.check(Un(t,i)),n.max=(t,i)=>n.check(ur(t,i)),n.mime=(t,i)=>n.check(wi(Array.isArray(t)?t:[t],i))});jd=w("ZodTransform",(n,e)=>{Ui(),Lv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>d0(n,t,i,r),n._zod.parse=(t,i)=>{if(i.direction==="backward")throw new Cr(n.constructor.name);t.addIssue=s=>{if(typeof s=="string")t.issues.push(O.issue(s,t.value,e));else{let o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=t.value),o.inst??(o.inst=n),t.issues.push(O.issue(o))}};let r=e.transform(t.value,t);return r instanceof Promise?r.then(s=>(t.value=s,t)):(t.value=r,t)}});Bs=w("ZodOptional",(n,e)=>{gu.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>rd(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});Wa=w("ZodExactOptional",(n,e)=>{Dv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>rd(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});Gd=w("ZodNullable",(n,e)=>{Cv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>b0(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});Kd=w("ZodDefault",(n,e)=>{Ov.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>_0(n,t,i,r),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});Zd=w("ZodPrefault",(n,e)=>{Nv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>E0(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});Ya=w("ZodNonOptional",(n,e)=>{Mv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>S0(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});Yd=w("ZodSuccess",(n,e)=>{Uv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>l0(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});Jd=w("ZodCatch",(n,e)=>{Fv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>I0(n,t,i,r),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});Qd=w("ZodNaN",(n,e)=>{zv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>s0(n,t,i,r)});js=w("ZodPipe",(n,e)=>{vu.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>T0(n,t,i,r),n.in=e.in,n.out=e.out});Vs=w("ZodCodec",(n,e)=>{js.init(n,e),na.init(n,e)});ef=w("ZodPreprocess",(n,e)=>{js.init(n,e),Bv.init(n,e)}),tf=w("ZodReadonly",(n,e)=>{jv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>k0(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});rf=w("ZodTemplateLiteral",(n,e)=>{Vv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>o0(n,t,i,r)});sf=w("ZodLazy",(n,e)=>{ra.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>A0(n,t,i,r),n.unwrap=()=>n._zod.def.getter()});af=w("ZodPromise",(n,e)=>{Kv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>$0(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});lf=w("ZodFunction",(n,e)=>{Gv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>u0(n,t,i,r)});Gs=w("ZodCustom",(n,e)=>{Hv.init(n,e),xe.init(n,e),n._zod.processJSONSchema=(t,i,r)=>c0(n,t,i,r)});Fb=Uy,zb=Fy,df=w("ZodInstanceOf",(n,e)=>{Gs.init(n,e)},{properties(n,e){return this.check(Ai(n,e))}});jb=(...n)=>zy({Codec:Vs,Boolean:Bi,String:Fi},...n)});function q$(n){it({customError:n})}function W$(){return it().customError}var Z$,ff,Y$=G(()=>{cn();Z$={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};ff||(ff={})});var Kr={};jn(Kr,{ZodISODate:()=>fr,ZodISODateTime:()=>dr,ZodISODuration:()=>mr,ZodISOTime:()=>hr,date:()=>_M,datetime:()=>xM,duration:()=>IM,time:()=>EM});function xM(n){return da(dr,n)}function _M(n){return fa(fr,n)}function EM(n){return ha(hr,n)}function IM(n){return ma(mr,n)}var hf=G(()=>{cn();Gr();Gr()});function kM(n,e){let t=n.$schema;return t==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":t==="http://json-schema.org/draft-07/schema#"?"draft-7":t==="http://json-schema.org/draft-04/schema#"?"draft-4":e??"draft-2020-12"}function J$(n,e){return n.map((t,i)=>i<e?t:t.optional())}function $M(n){return n.replace(/~1/g,"/").replace(/~0/g,"~")}function AM(n,e){if(!n.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let t=n.slice(1).split("/").filter(Boolean);if(t.length===0)return e.rootSchema;let i=e.version==="draft-2020-12"?"$defs":"definitions";if(t[0]===i){let r=t[1]===void 0?void 0:$M(t[1]);if(!r||!e.defs[r])throw new Error(`Reference not found: ${n}`);return e.defs[r]}throw new Error(`Reference not found: ${n}`)}function wM(n,e){return Q.transform(i=>i).check(i=>{let r=i.value;if(typeof r!="object"||r===null||Array.isArray(r))return;let s=Object.getOwnPropertyNames(r);if(e.minProperties!==void 0&&s.length<e.minProperties&&i.issues.push({origin:"object",code:"too_small",minimum:e.minProperties,inclusive:!0,message:`Too small: expected object to have >=${e.minProperties} properties`,input:r,inst:n,continue:!0}),e.maxProperties!==void 0&&s.length>e.maxProperties&&i.issues.push({origin:"object",code:"too_big",maximum:e.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${e.maxProperties} properties`,input:r,inst:n,continue:!0}),e.keySchema)for(let o of s){let a=e.keySchema.safeParse(o);a.success||i.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:o,path:[o],continue:!0})}}).pipe(n)}function Gb(n,e){if(n===null)return"z";let t=typeof n;if(t!=="object"){if(t==="number"&&Number.isNaN(n))return null;let i=String(n);return`${t[0]}${i.length}:${i}`}if(e.has(n))return null;e.add(n);try{if(Array.isArray(n)){let s=[];for(let o of n){let a=Gb(o,e);if(a===null)return null;s.push(a)}return`a${s.length}:[${s.join(",")}]`}let i=Object.keys(n).sort(),r=[];for(let s of i){let o=Gb(n[s],e);if(o===null)return null;r.push(`${s.length}:${s}=${o}`)}return`o${r.length}:{${r.join(",")}}`}finally{e.delete(n)}}function Xa(n){return typeof n!="object"||n===null?!1:Array.isArray(n)?n.some(Xa):typeof n.$ref=="string"?!0:Object.entries(n).some(([e,t])=>PM.has(e)?Xa(t):!RM.has(e)||typeof t!="object"||t===null?!1:Object.values(t).some(Xa))}function X$(n){return n===1?"element":"elements"}function LM(n,e){return Q.transform(i=>i).check(i=>{let r=i.value;if(Array.isArray(r)){if(e.uniqueItems===!0){let s=new Map;for(let o=0;o<r.length;o++){let a=Gb(r[o],new Set);if(a===null)continue;let l=s.get(a);if(l===void 0){s.set(a,o);continue}i.issues.push({code:"custom",message:`Array items must be unique: element at index ${o} duplicates the one at index ${l}`,input:r,path:[o],continue:!0})}}if(e.containsSchema){let s=e.minContains??1,o=e.maxContains!==void 0?e.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let l of r)if(e.containsSchema.safeParse(l).success&&++a>=o)break;a<s&&i.issues.push({code:"custom",message:`Array must contain at least ${s} matching ${X$(s)}; found ${a}`,input:r,continue:!0}),e.maxContains!==void 0&&a>e.maxContains&&i.issues.push({code:"custom",message:`Array must contain at most ${e.maxContains} matching ${X$(e.maxContains)}`,input:r,continue:!0})}}}).pipe(n)}function Q$(n,e){if(n!==!1)return n===void 0||n===!0?Q.any():Zt(n,e)}function eA(n,e){if(n.not!==void 0){if(typeof n.not=="object"&&Object.keys(n.not).length===0)return Q.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(n.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(n.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(n.if!==void 0||n.then!==void 0||n.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(n.dependentSchemas!==void 0||n.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(n.$ref){let r=n.$ref;if(e.refs.has(r))return e.refs.get(r);if(e.processing.has(r))return Q.lazy(()=>{if(!e.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return e.refs.get(r)});e.processing.add(r);let s=AM(r,e),o=Zt(s,e);return e.refs.set(r,o),e.processing.delete(r),o}if(n.enum!==void 0){let r=n.enum;if(e.version==="openapi-3.0"&&n.nullable===!0&&r.length===1&&r[0]===null)return Q.null();if(r.length===0)return Q.never();if(r.length===1)return Q.literal(r[0]);if(r.every(o=>typeof o=="string"))return Q.enum(r);let s=r.map(o=>Q.literal(o));return s.length<2?s[0]:Q.union([s[0],s[1],...s.slice(2)])}if(n.const!==void 0)return Q.literal(n.const);let t=n.type;if(Array.isArray(t)){let r=t.map(s=>{let o={...n,type:s};return eA(o,e)});return r.length===0?Q.never():r.length===1?r[0]:Q.union(r)}if(!t)return Q.any();let i;switch(t){case"string":{let r=Q.string();if(n.format){let s=n.format;s==="email"?r=r.check(Q.email()):s==="uri"||s==="uri-reference"?r=r.check(Q.url()):s==="uuid"||s==="guid"?r=r.check(Q.uuid()):s==="date-time"?r=r.check(Q.iso.datetime({offset:!0})):s==="date"?r=r.check(Q.iso.date()):s==="time"?r=r.check(Q.regex(DM)):s==="duration"?r=r.check(Q.iso.duration()):s==="hostname"?r=r.check(Q.hostname()):s==="ipv4"?r=r.check(Q.ipv4()):s==="ipv6"?r=r.check(Q.ipv6()):s==="mac"?r=r.check(Q.mac()):s==="cidr"?r=r.check(Q.cidrv4()):s==="cidr-v6"?r=r.check(Q.cidrv6()):s==="base64"?r=r.check(Q.base64()):s==="base64url"?r=r.check(Q.base64url()):s==="e164"?r=r.check(Q.e164()):s==="credit_card"?r=r.check(Q.creditCard()):s==="iban"?r=r.check(Q.iban()):s==="jwt"?r=r.check(Q.jwt()):s==="emoji"?r=r.check(Q.emoji()):s==="nanoid"?r=r.check(Q.nanoid()):s==="cuid"?r=r.check(Q.cuid()):s==="cuid2"?r=r.check(Q.cuid2()):s==="ulid"?r=r.check(Q.ulid()):s==="xid"?r=r.check(Q.xid()):s==="ksuid"&&(r=r.check(Q.ksuid()))}typeof n.minLength=="number"&&(r=r.min(n.minLength)),typeof n.maxLength=="number"&&(r=r.max(n.maxLength)),n.pattern&&(r=r.regex(new RegExp(n.pattern))),i=r;break}case"number":case"integer":{let r=t==="integer"?Q.number().int():Q.number();typeof n.minimum=="number"&&n.exclusiveMinimum!==!0&&(r=r.min(n.minimum)),typeof n.maximum=="number"&&n.exclusiveMaximum!==!0&&(r=r.max(n.maximum)),typeof n.exclusiveMinimum=="number"?r=r.gt(n.exclusiveMinimum):n.exclusiveMinimum===!0&&typeof n.minimum=="number"&&(r=r.gt(n.minimum)),typeof n.exclusiveMaximum=="number"?r=r.lt(n.exclusiveMaximum):n.exclusiveMaximum===!0&&typeof n.maximum=="number"&&(r=r.lt(n.maximum)),typeof n.multipleOf=="number"&&(r=r.multipleOf(n.multipleOf)),i=r;break}case"boolean":{i=Q.boolean();break}case"null":{i=Q.null();break}case"object":{let r={},s=n.properties||{},o=new Set(n.required||[]),a=typeof n.additionalProperties=="object"?Zt(n.additionalProperties,e):void 0;for(let[d,f]of Object.entries(s)){let h=Zt(f,e);Rt(r,d,o.has(d)?h:h.optional())}if(n.patternProperties){let d=n.patternProperties,f=Object.keys(d),h=[];for(let p of f){let g=Zt(d[p],e),y=Q.string().regex(new RegExp(p));h.push(Q.looseRecord(y,g))}let m=[];if(Object.keys(r).length>0&&m.push(Q.object(r).passthrough()),m.push(...h),m.length===0)i=Q.object({}).passthrough();else if(m.length===1)i=m[0];else{let p=Q.intersection(m[0],m[1]);for(let g=2;g<m.length;g++)p=Q.intersection(p,m[g]);i=p}if(n.additionalProperties===!1){let p=Object.keys(r),g=f.map(b=>new RegExp(b)),y=i;i=i.check(b=>{if(!Sn(b.value))return;let S=[];for(let x of Object.keys(b.value))p.includes(x)||g.some(_=>_.test(x))||S.push(x);S.length&&b.issues.push({code:"unrecognized_keys",keys:S,input:b.value,inst:y})})}}else{let d=Q.object(r);n.additionalProperties===!1?i=d.strict():a?i=d.catchall(a):i=d.passthrough()}let l=n.propertyNames!==void 0&&n.propertyNames!==!0,c=typeof n.minProperties=="number"?n.minProperties:void 0,u=typeof n.maxProperties=="number"?n.maxProperties:void 0;if(l||c!==void 0||u!==void 0){let d;if(l){let f=typeof n.propertyNames=="object"&&n.propertyNames.type===void 0?{type:"string",...n.propertyNames}:n.propertyNames;d=Zt(f,e)}i=wM(i,{keySchema:d,minProperties:c,maxProperties:u})}break}case"array":{let r=n.prefixItems,s=n.items;if(r&&Array.isArray(r)){let o=typeof n.minItems=="number"?n.minItems:0,a=r.map(d=>Zt(d,e)),l=J$(a,o),c=Array.isArray(s)?void 0:Q$(s,e),u=Q.tuple(l);i=c?u.rest(c):u,typeof n.minItems=="number"&&(i=i.check(Q.minLength(n.minItems))),typeof n.maxItems=="number"&&(i=i.check(Q.maxLength(n.maxItems)))}else if(Array.isArray(s)){let o=typeof n.minItems=="number"?n.minItems:0,a=s.map(d=>Zt(d,e)),l=J$(a,o),c=Q$(n.additionalItems,e),u=Q.tuple(l);i=c?u.rest(c):u,typeof n.minItems=="number"&&(i=i.check(Q.minLength(n.minItems))),typeof n.maxItems=="number"&&(i=i.check(Q.maxLength(n.maxItems)))}else if(s!==void 0){let o=Zt(s,e),a=Q.array(o);typeof n.minItems=="number"&&(a=a.min(n.minItems)),typeof n.maxItems=="number"&&(a=a.max(n.maxItems)),i=a}else i=Q.array(Q.any());(n.uniqueItems===!0||n.contains!==void 0)&&(i=LM(i,{uniqueItems:n.uniqueItems===!0,containsSchema:n.contains!==void 0?Zt(n.contains,e):void 0,minContains:typeof n.minContains=="number"?n.minContains:void 0,maxContains:typeof n.maxContains=="number"?n.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${t}`)}return i}function Zt(n,e){if(typeof n=="boolean")return n?Q.any():Q.never();let t=eA(n,e),i=n.type||n.enum!==void 0||n.const!==void 0;if(n.anyOf&&Array.isArray(n.anyOf)){let a=n.anyOf.map(c=>Zt(c,e)),l=Q.union(a);t=i?Q.intersection(t,l):l}if(n.oneOf&&Array.isArray(n.oneOf)){let a=n.oneOf.map(c=>Zt(c,e)),l=Q.xor(a);t=i?Q.intersection(t,l):l}if(n.allOf&&Array.isArray(n.allOf))if(n.allOf.length===0)t=i?t:Q.any();else{let a=i?t:Zt(n.allOf[0],e),l=i?0:1;for(let c=l;c<n.allOf.length;c++)a=Q.intersection(a,Zt(n.allOf[c],e));t=a}n.nullable===!0&&e.version==="openapi-3.0"&&(t=Q.nullable(t)),n.readOnly===!0&&(t=Q.readonly(t)),n.default!==void 0&&(t=t.default(n.default));let r={},s=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of s)a in n&&(r[a]=n[a]);let o=["contentEncoding","contentMediaType","contentSchema"];for(let a of o)a in n&&(r[a]=n[a]);if(n.type==="object"&&n.$ref===void 0){n.propertyNames!==void 0&&!Xa(n.propertyNames)&&(r.propertyNames=n.propertyNames);for(let a of["minProperties","maxProperties"])n[a]!==void 0&&(r[a]=n[a])}if(n.type==="array"&&n.$ref===void 0){n.contains!==void 0&&!Xa(n.contains)&&(r.contains=n.contains);for(let a of["uniqueItems","minContains","maxContains"])n[a]!==void 0&&(r[a]=n[a])}for(let a of Object.keys(n))TM.has(a)||Rt(r,a,n[a]);return Object.keys(r).length>0&&e.registry.add(t,r),n.description&&(t=t.describe(n.description)),t}function Kb(n,e){if(typeof n=="boolean")return n?Q.any():Q.never();let t;try{t=JSON.parse(JSON.stringify(n))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=kM(t,e?.defaultTarget),r=t.$defs||t.definitions||{},s={version:i,defs:r,refs:new Map,processing:new Set,rootSchema:t,registry:e?.registry??Et};return Zt(t,s)}var Q,TM,PM,RM,DM,tA=G(()=>{la();J();ld();hf();Gr();Q={...Hs,...ad,iso:Kr},TM=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);PM=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),RM=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);DM=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/});function Hb(n){return Ta(n,{object:e=>e.partial(),union:e=>{let t=e._zod.def;return t.discriminator===void 0?e:Ue(t.options)}})}var nA=G(()=>{w0();Gr()});function CM(n,e){if(!e?.length)return n;let t=n._zod.def;return Me(n,On(t,{checks:[...t.checks??[],...e]}),{parent:!0})}function rA(n){return CM(n.out,n.checks)}function OM(n){return n.in._zod.traits.has("$ZodTransform")?rA(n):n.in}function Zb(n){return Ta(n,{pipe:e=>OM(e._zod.def),default:(e,t)=>t?je(e._zod.def.innerType):e,catch:(e,t)=>t?e._zod.def.innerType:e})}function qb(n){return Ta(n,{pipe:e=>rA(e._zod.def),prefault:(e,t)=>t?e._zod.def.innerType:e})}var iA=G(()=>{J();w0();Gr()});var mf={};jn(mf,{bigint:()=>FM,boolean:()=>UM,date:()=>zM,number:()=>MM,string:()=>NM});function NM(n){return oy(Fi,n)}function MM(n){return dy(zi,n)}function UM(n){return yy(Bi,n)}function FM(n){return Sy(ji,n)}function zM(n){return Ry(Ms,n)}var sA=G(()=>{cn();Gr()});var E={};jn(E,{$brand:()=>Rc,$input:()=>wu,$output:()=>Au,INVALID:()=>Ut,NEVER:()=>Pc,TimePrecision:()=>ed,ZodAny:()=>Ad,ZodArray:()=>Ld,ZodBase64:()=>ja,ZodBase64URL:()=>Va,ZodBigInt:()=>ji,ZodBigIntFormat:()=>Ha,ZodBoolean:()=>Bi,ZodCIDRv4:()=>za,ZodCIDRv6:()=>Ba,ZodCUID:()=>Da,ZodCUID2:()=>Ca,ZodCatch:()=>Jd,ZodCodec:()=>Vs,ZodCompileAsyncError:()=>_n,ZodCompileUnsupportedError:()=>$e,ZodCreditCard:()=>Ed,ZodCustom:()=>Gs,ZodCustomStringFormat:()=>jr,ZodDate:()=>Ms,ZodDefault:()=>Kd,ZodDiscriminatedUnion:()=>Cd,ZodE164:()=>Ga,ZodEmail:()=>wa,ZodEmoji:()=>Ra,ZodEnum:()=>Mi,ZodError:()=>H$,ZodExactOptional:()=>Wa,ZodFile:()=>Bd,ZodFirstPartyTypeKind:()=>ff,ZodFunction:()=>lf,ZodGUID:()=>Pa,ZodIBAN:()=>Id,ZodIPv4:()=>Ua,ZodIPv6:()=>Fa,ZodISODate:()=>fr,ZodISODateTime:()=>dr,ZodISODuration:()=>mr,ZodISOTime:()=>hr,ZodInstanceOf:()=>df,ZodIntersection:()=>Od,ZodIssueCode:()=>Z$,ZodJWT:()=>Ka,ZodKSUID:()=>Ma,ZodLazy:()=>sf,ZodLiteral:()=>zd,ZodMAC:()=>_d,ZodMap:()=>Ud,ZodNaN:()=>Qd,ZodNanoID:()=>La,ZodNever:()=>Pd,ZodNonOptional:()=>Ya,ZodNull:()=>$d,ZodNullable:()=>Gd,ZodNumber:()=>zi,ZodNumberFormat:()=>Vr,ZodObject:()=>Us,ZodOptional:()=>Bs,ZodPipe:()=>js,ZodPrefault:()=>Zd,ZodPreprocess:()=>ef,ZodPromise:()=>af,ZodReadonly:()=>tf,ZodRealError:()=>Ht,ZodRecord:()=>Ni,ZodSet:()=>Fd,ZodString:()=>Fi,ZodStringFormat:()=>Ve,ZodSuccess:()=>Yd,ZodSymbol:()=>Td,ZodTemplateLiteral:()=>rf,ZodTransform:()=>jd,ZodTuple:()=>Nd,ZodType:()=>xe,ZodULID:()=>Oa,ZodURL:()=>Os,ZodUUID:()=>Fn,ZodUndefined:()=>kd,ZodUnion:()=>Fs,ZodUnknown:()=>wd,ZodVoid:()=>Rd,ZodXID:()=>Na,ZodXor:()=>Dd,_ZodString:()=>Aa,_default:()=>Hd,_function:()=>Mb,any:()=>yb,array:()=>ke,base64:()=>X0,base64url:()=>Q0,bigint:()=>hb,boolean:()=>ot,catch:()=>Xd,check:()=>Ub,cidrv4:()=>Y0,cidrv6:()=>J0,clone:()=>Me,codec:()=>Db,coerce:()=>mf,compile:()=>Pu,config:()=>it,core:()=>Yn,creditCard:()=>tb,cuid:()=>j0,cuid2:()=>V0,currencyCode:()=>ab,custom:()=>Ja,date:()=>Sb,decode:()=>pd,decodeAsync:()=>vd,deepPartial:()=>Hb,describe:()=>Fb,discriminatedUnion:()=>zs,e164:()=>eb,email:()=>L0,emoji:()=>z0,encode:()=>md,encodeAsync:()=>gd,endsWith:()=>$i,enum:()=>Tt,exactOptional:()=>Vd,file:()=>wb,flattenError:()=>vs,float32:()=>cb,float64:()=>ub,formatError:()=>ys,fromJSONSchema:()=>Kb,function:()=>Mb,getDiscriminatedOption:()=>mu,getErrorMap:()=>W$,globalRegistry:()=>Et,gt:()=>Mn,gte:()=>ln,guid:()=>D0,hash:()=>lb,hex:()=>ob,hostname:()=>sb,httpUrl:()=>F0,iban:()=>nb,includes:()=>Ti,input:()=>Zb,instanceof:()=>Bb,int:()=>ka,int32:()=>db,int64:()=>mb,intersection:()=>Vi,invertCodec:()=>Cb,ipv4:()=>Z0,ipv6:()=>W0,iso:()=>Kr,json:()=>Vb,jwt:()=>rb,keyof:()=>xb,ksuid:()=>H0,lazy:()=>of,length:()=>Ur,literal:()=>ae,locales:()=>ws,looseObject:()=>It,looseRecord:()=>Tb,lowercase:()=>Ei,lt:()=>Nn,lte:()=>an,mac:()=>q0,map:()=>kb,maxLength:()=>Mr,maxSize:()=>ur,memoizer:()=>$s,meta:()=>zb,mime:()=>wi,minLength:()=>Wn,minSize:()=>Un,multipleOf:()=>cr,nan:()=>Lb,nanoid:()=>B0,nativeEnum:()=>Ab,negative:()=>ga,never:()=>Za,nonnegative:()=>ya,nonoptional:()=>Wd,nonpositive:()=>va,normalize:()=>Pi,null:()=>Ns,nullable:()=>Cs,nullish:()=>Pb,number:()=>Re,object:()=>re,optional:()=>je,output:()=>qb,overwrite:()=>En,parse:()=>ud,parseAsync:()=>dd,partialRecord:()=>Ib,pipe:()=>$a,positive:()=>pa,prefault:()=>qd,preprocess:()=>Ks,prettifyError:()=>Dc,promise:()=>Nb,properties:()=>Ai,property:()=>ba,readonly:()=>nf,record:()=>Ge,refine:()=>cf,regex:()=>_i,regexes:()=>gn,registry:()=>aa,safeDecode:()=>bd,safeDecodeAsync:()=>xd,safeEncode:()=>yd,safeEncodeAsync:()=>Sd,safeParse:()=>fd,safeParseAsync:()=>hd,set:()=>$b,setErrorMap:()=>q$,size:()=>Nr,slugify:()=>Ci,startsWith:()=>ki,strictObject:()=>_b,string:()=>L,stringFormat:()=>ib,stringbool:()=>jb,success:()=>Rb,superRefine:()=>uf,symbol:()=>gb,templateLiteral:()=>Ob,toJSONSchema:()=>Ea,toLowerCase:()=>Li,toUpperCase:()=>Di,toZod:()=>us,transform:()=>qa,treeifyError:()=>Lc,trim:()=>Ri,tuple:()=>Md,uint32:()=>fb,uint64:()=>pb,ulid:()=>G0,undefined:()=>vb,union:()=>Ue,unknown:()=>Ke,uppercase:()=>Ii,url:()=>U0,util:()=>O,uuid:()=>C0,uuidv4:()=>O0,uuidv6:()=>N0,uuidv7:()=>M0,validate:()=>hi,validateAsync:()=>mi,void:()=>bb,withParser:()=>ca,xid:()=>K0,xor:()=>Eb});var pf=G(()=>{cn();Gr();ld();P0();R0();Y$();cn();Ia();tA();nA();iA();Qv();hf();hf();sA()});var oA=G(()=>{pf();pf()});var Wb={};jn(Wb,{$brand:()=>Rc,$input:()=>wu,$output:()=>Au,INVALID:()=>Ut,NEVER:()=>Pc,TimePrecision:()=>ed,ZodAny:()=>Ad,ZodArray:()=>Ld,ZodBase64:()=>ja,ZodBase64URL:()=>Va,ZodBigInt:()=>ji,ZodBigIntFormat:()=>Ha,ZodBoolean:()=>Bi,ZodCIDRv4:()=>za,ZodCIDRv6:()=>Ba,ZodCUID:()=>Da,ZodCUID2:()=>Ca,ZodCatch:()=>Jd,ZodCodec:()=>Vs,ZodCompileAsyncError:()=>_n,ZodCompileUnsupportedError:()=>$e,ZodCreditCard:()=>Ed,ZodCustom:()=>Gs,ZodCustomStringFormat:()=>jr,ZodDate:()=>Ms,ZodDefault:()=>Kd,ZodDiscriminatedUnion:()=>Cd,ZodE164:()=>Ga,ZodEmail:()=>wa,ZodEmoji:()=>Ra,ZodEnum:()=>Mi,ZodError:()=>H$,ZodExactOptional:()=>Wa,ZodFile:()=>Bd,ZodFirstPartyTypeKind:()=>ff,ZodFunction:()=>lf,ZodGUID:()=>Pa,ZodIBAN:()=>Id,ZodIPv4:()=>Ua,ZodIPv6:()=>Fa,ZodISODate:()=>fr,ZodISODateTime:()=>dr,ZodISODuration:()=>mr,ZodISOTime:()=>hr,ZodInstanceOf:()=>df,ZodIntersection:()=>Od,ZodIssueCode:()=>Z$,ZodJWT:()=>Ka,ZodKSUID:()=>Ma,ZodLazy:()=>sf,ZodLiteral:()=>zd,ZodMAC:()=>_d,ZodMap:()=>Ud,ZodNaN:()=>Qd,ZodNanoID:()=>La,ZodNever:()=>Pd,ZodNonOptional:()=>Ya,ZodNull:()=>$d,ZodNullable:()=>Gd,ZodNumber:()=>zi,ZodNumberFormat:()=>Vr,ZodObject:()=>Us,ZodOptional:()=>Bs,ZodPipe:()=>js,ZodPrefault:()=>Zd,ZodPreprocess:()=>ef,ZodPromise:()=>af,ZodReadonly:()=>tf,ZodRealError:()=>Ht,ZodRecord:()=>Ni,ZodSet:()=>Fd,ZodString:()=>Fi,ZodStringFormat:()=>Ve,ZodSuccess:()=>Yd,ZodSymbol:()=>Td,ZodTemplateLiteral:()=>rf,ZodTransform:()=>jd,ZodTuple:()=>Nd,ZodType:()=>xe,ZodULID:()=>Oa,ZodURL:()=>Os,ZodUUID:()=>Fn,ZodUndefined:()=>kd,ZodUnion:()=>Fs,ZodUnknown:()=>wd,ZodVoid:()=>Rd,ZodXID:()=>Na,ZodXor:()=>Dd,_ZodString:()=>Aa,_default:()=>Hd,_function:()=>Mb,any:()=>yb,array:()=>ke,base64:()=>X0,base64url:()=>Q0,bigint:()=>hb,boolean:()=>ot,catch:()=>Xd,check:()=>Ub,cidrv4:()=>Y0,cidrv6:()=>J0,clone:()=>Me,codec:()=>Db,coerce:()=>mf,compile:()=>Pu,config:()=>it,core:()=>Yn,creditCard:()=>tb,cuid:()=>j0,cuid2:()=>V0,currencyCode:()=>ab,custom:()=>Ja,date:()=>Sb,decode:()=>pd,decodeAsync:()=>vd,deepPartial:()=>Hb,default:()=>E,describe:()=>Fb,discriminatedUnion:()=>zs,e164:()=>eb,email:()=>L0,emoji:()=>z0,encode:()=>md,encodeAsync:()=>gd,endsWith:()=>$i,enum:()=>Tt,exactOptional:()=>Vd,file:()=>wb,flattenError:()=>vs,float32:()=>cb,float64:()=>ub,formatError:()=>ys,fromJSONSchema:()=>Kb,function:()=>Mb,getDiscriminatedOption:()=>mu,getErrorMap:()=>W$,globalRegistry:()=>Et,gt:()=>Mn,gte:()=>ln,guid:()=>D0,hash:()=>lb,hex:()=>ob,hostname:()=>sb,httpUrl:()=>F0,iban:()=>nb,includes:()=>Ti,input:()=>Zb,instanceof:()=>Bb,int:()=>ka,int32:()=>db,int64:()=>mb,intersection:()=>Vi,invertCodec:()=>Cb,ipv4:()=>Z0,ipv6:()=>W0,iso:()=>Kr,json:()=>Vb,jwt:()=>rb,keyof:()=>xb,ksuid:()=>H0,lazy:()=>of,length:()=>Ur,literal:()=>ae,locales:()=>ws,looseObject:()=>It,looseRecord:()=>Tb,lowercase:()=>Ei,lt:()=>Nn,lte:()=>an,mac:()=>q0,map:()=>kb,maxLength:()=>Mr,maxSize:()=>ur,memoizer:()=>$s,meta:()=>zb,mime:()=>wi,minLength:()=>Wn,minSize:()=>Un,multipleOf:()=>cr,nan:()=>Lb,nanoid:()=>B0,nativeEnum:()=>Ab,negative:()=>ga,never:()=>Za,nonnegative:()=>ya,nonoptional:()=>Wd,nonpositive:()=>va,normalize:()=>Pi,null:()=>Ns,nullable:()=>Cs,nullish:()=>Pb,number:()=>Re,object:()=>re,optional:()=>je,output:()=>qb,overwrite:()=>En,parse:()=>ud,parseAsync:()=>dd,partialRecord:()=>Ib,pipe:()=>$a,positive:()=>pa,prefault:()=>qd,preprocess:()=>Ks,prettifyError:()=>Dc,promise:()=>Nb,properties:()=>Ai,property:()=>ba,readonly:()=>nf,record:()=>Ge,refine:()=>cf,regex:()=>_i,regexes:()=>gn,registry:()=>aa,safeDecode:()=>bd,safeDecodeAsync:()=>xd,safeEncode:()=>yd,safeEncodeAsync:()=>Sd,safeParse:()=>fd,safeParseAsync:()=>hd,set:()=>$b,setErrorMap:()=>q$,size:()=>Nr,slugify:()=>Ci,startsWith:()=>ki,strictObject:()=>_b,string:()=>L,stringFormat:()=>ib,stringbool:()=>jb,success:()=>Rb,superRefine:()=>uf,symbol:()=>gb,templateLiteral:()=>Ob,toJSONSchema:()=>Ea,toLowerCase:()=>Li,toUpperCase:()=>Di,toZod:()=>us,transform:()=>qa,treeifyError:()=>Lc,trim:()=>Ri,tuple:()=>Md,uint32:()=>fb,uint64:()=>pb,ulid:()=>G0,undefined:()=>vb,union:()=>Ue,unknown:()=>Ke,uppercase:()=>Ii,url:()=>U0,util:()=>O,uuid:()=>C0,uuidv4:()=>O0,uuidv6:()=>N0,uuidv7:()=>M0,validate:()=>hi,validateAsync:()=>mi,void:()=>bb,withParser:()=>ca,xid:()=>K0,xor:()=>Eb,z:()=>E});var Qa=G(()=>{pf();oA()});var hw={"\u8BF7\u5BA1\u67E5\u7EA2\u679C\u7684\u56DE\u5408 Hooks":"Review Hongguo\u2019s task hooks",\u4F7F\u7528\u6307\u5357:"Getting started",\u5F00\u59CB\u4F7F\u7528\u7EA2\u679C:"Welcome to Hongguo",\u91CD\u65B0\u68C0\u67E5:"Check again","\u70B9\u5267\u540D\u5373\u53EF\u64AD\u653E\uFF0C\u9ED8\u8BA4\u9759\u97F3\uFF1B\u6253\u5F00\u626C\u58F0\u5668\u51FA\u58F0\u3002":"Choose a show to play. Playback starts muted; use the speaker to turn on sound.","\u56DE\u5408\u8054\u52A8\u9700\u8981\u5728 Codex \u8BBE\u7F6E \u2192 Hooks \u5BA1\u67E5\u5E76\u4FE1\u4EFB\u7EA2\u679C\u7684 UserPromptSubmit\u3001Stop\u3001Interrupt\u3002":"For automatic pausing, review and trust Hongguo\u2019s UserPromptSubmit, Stop and Interrupt in Codex Settings \u2192 Hooks.",\u5F00\u59CB\u9009\u5267:"Browse shows",\u5DF2\u914D\u7F6E:"Configured",\u5F85\u786E\u8BA4:"Unverified",\u5F85\u914D\u7F6E:"Needs setup","\u8FDB\u5EA6\u6682\u65F6\u65E0\u6CD5\u4FDD\u5B58\uFF0C\u8BF7\u68C0\u67E5\u7EA2\u679C\u7684\u6570\u636E\u76EE\u5F55\u6743\u9650\u3002":"Progress cannot be saved. Check permissions for Hongguo\u2019s data folder.",\u64AD\u653E\u7EC4\u4EF6:"Playback component",\u51C6\u5907\u4E2D:"Preparing","\u64AD\u653E\u7EC4\u4EF6\u5C1A\u672A\u5C31\u7EEA\u3002\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u70B9\u51FB\u300C\u91CD\u65B0\u68C0\u67E5\u300D\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u51C6\u5907\u3002":"The playback component is not ready. Check your connection and click Check again to prepare it automatically.","\u56DE\u5408\u8054\u52A8\u5DF2\u5C31\u7EEA\u3002\u53EF\u5728\u8BBE\u7F6E\u4E2D\u914D\u7F6E\u4EFB\u52A1\u5F00\u59CB\u81EA\u52A8\u64AD\u653E\u548C\u4EFB\u52A1\u7ED3\u675F\u81EA\u52A8\u6682\u505C\u3002":"Task hooks are ready. Configure automatic play and pause in Settings.","\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6 Hooks \u72B6\u6001\uFF0C\u8BF7\u5728\u5BBF\u4E3B\u8BBE\u7F6E\u4E2D\u6838\u5BF9\u3002\u73B0\u5728\u53EF\u4EE5\u5148\u624B\u52A8\u89C2\u770B\u3002":"Hook status is unavailable. Check the host settings; you can watch manually for now.","\u5C1A\u672A\u53D1\u73B0\u5B8C\u6574\u7684\u56DE\u5408\u4E8B\u4EF6\u3002\u8BF7\u68C0\u67E5\u63D2\u4EF6\u5DF2\u542F\u7528\uFF0C\u5E76\u5728\u65B0\u7684\u672C\u5730\u5BF9\u8BDD\u4E2D\u91CD\u8BD5\u3002":"Some hooks were not found. Check that the plugin is enabled, then retry in a new local conversation.","\u56DE\u5408\u8054\u52A8\u5C1A\u672A\u914D\u7F6E\u3002\u5B8C\u6210\u4E0B\u65B9\u64CD\u4F5C\u540E\u91CD\u65B0\u68C0\u67E5\uFF0C\u4E5F\u53EF\u4EE5\u5148\u624B\u52A8\u89C2\u770B\u3002":"Automatic pausing needs setup. Follow the instructions below and check again, or watch manually.","\u68C0\u67E5\u672A\u5B8C\u6210\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u6216\u5728 Codex \u8BBE\u7F6E \u2192 Hooks \u6838\u5BF9\u56DE\u5408\u8054\u52A8\u3002":"The check could not finish. Retry or review automatic pausing in Codex Settings \u2192 Hooks.","\u672C\u6B21\u5DF2\u6536\u8D77\u6307\u5357\uFF0C\u6682\u65F6\u65E0\u6CD5\u4FDD\u5B58\u6B64\u8BBE\u7F6E\u3002":"Guide hidden for now. This preference could not be saved.",\u81EA\u68C0:"Diagnostics",\u8BBE\u7F6E:"Settings",\u4EE5\u4E0B\u8BBE\u7F6E\u5BF9\u6240\u6709\u804A\u5929\u751F\u6548:"These settings apply to all chats",\u4EFB\u52A1\u7ED3\u675F\u81EA\u52A8\u6682\u505C:"Pause automatically when a task ends",\u4EFB\u52A1\u5F00\u59CB\u81EA\u52A8\u64AD\u653E:"Play automatically when a task starts","\u81EA\u52A8\u64AD\u653E\u5DF2\u9009\u4E2D\u7684\u5267\u96C6\uFF0C\u4ECE\u4E0A\u6B21\u4F4D\u7F6E\u7EE7\u7EED":"Play the selected episode from its saved position",\u5F53\u524D\u56DE\u5408\u8FDB\u884C\u65F6\u663E\u793A\u63A8\u8350:"Suggest shows during a turn",\u63A8\u8350\u8865\u5145\u5173\u952E\u8BCD:"Additional recommendation keywords",\u7528\u9017\u53F7\u5206\u9694:"Separate with commas",\u4FDD\u5B58\u8BBE\u7F6E:"Save settings",\u6B63\u5728\u8FDE\u63A5:"Connecting\u2026",\u56DE\u5408\u8054\u52A8:"Automatic pausing",\u672A\u5173\u8054\u5BF9\u8BDD:"No chat connected","\u5728\u540C\u7A97\u5206\u5C4F\u64AD\u653E \u2197":"Open in split view \u2197",\u786E\u8BA4\u4F1A\u8BDD:"Choose conversation","\u5728 Codex \u5185\u7F6E\u6D4F\u89C8\u5668\u6253\u5F00\u6B64\u94FE\u63A5\uFF0860 \u79D2\u5185\u6709\u6548\uFF09":"Open this link in the Codex browser within 60 seconds",\u590D\u5236\u94FE\u63A5:"Copy link",\u7B49\u5F85\u65F6\u770B\u4E00\u96C6:"Watch while you wait",\u8FD9\u6761\u63A8\u8350\u5DF2\u7ED3\u675F:"This suggestion has expired.","\u5F53\u524D Codex \u65E0\u6CD5\u5728\u4F1A\u8BDD\u4E2D\u6253\u5F00\u64AD\u653E\u5668":"This version of Codex could not open the player in this chat.",\u6536\u8D77\u672C\u8F6E\u63A8\u8350:"Hide suggestions for this turn","\u66F4\u591A\u2026":"More\u2026",\u9009\u5267:"Browse shows",\u641C\u7D22\u5267\u540D:"Search shows",\u641C\u7D22:"Search",\u89C2\u770B\u5386\u53F2:"Watch history",\u6362\u4E00\u6279:"Next batch",\u7EE7\u7EED\u89C2\u770B:"Continue watching",\u770B\u4E0B\u4E00\u96C6:"Watch next episode","\u63A8\u8350 \xB7 \u70B9\u51FB\u64AD\u653E":"Recommended \xB7 Play",\u64AD\u653E\u5668:"Player","\u2039 \u8FD4\u56DE\u9009\u5267":"\u2039 Browse shows",\u64AD\u653E\u5F53\u524D\u96C6:"Play this episode",\u77ED\u5267\u89C6\u9891:"Drama video",\u64AD\u653E:"Play",\u6682\u505C:"Pause",\u4E0B\u4E00\u96C6:"Next episode",\u4E0A\u4E00\u96C6:"Previous episode",\u7EE7\u7EED\u64AD\u653E:"Resume playback",\u64AD\u653E\u8FDB\u5EA6:"Playback position",\u64AD\u653E\u901F\u5EA6:"Playback speed",\u9759\u97F3:"Mute",\u53D6\u6D88\u9759\u97F3:"Unmute",\u5168\u5C4F:"Fullscreen",\u9000\u51FA\u5168\u5C4F:"Exit fullscreen",\u9009\u62E9\u4E00\u90E8\u77ED\u5267:"Choose a show",\u97F3\u91CF:"Volume",\u8FDE\u64AD:"Autoplay next",\u968F\u673A\u4E00\u96C6:"Pick an episode",\u5206\u96C6\u8303\u56F4:"Episode groups",\u9009\u96C6:"Episodes",\u66F4\u591A\u5206\u96C6:"Load more episodes","\u6B63\u5728\u8BFB\u53D6\u5206\u96C6\u2026":"Loading episodes\u2026",\u6682\u65E0\u53EF\u7528\u5206\u96C6:"No episodes available",\u53D6\u6D88\u51C6\u5907:"Cancel loading",\u4ECE\u5934\u64AD\u653E:"Start over",\u79FB\u9664:"Remove","\u6B63\u5728\u8BFB\u53D6\u7247\u5E93\u2026":"Loading shows\u2026",\u6CA1\u6709\u627E\u5230\u76F8\u7B26\u7684\u5267\u76EE:"No matching shows",\u7EA2\u679C\u6682\u65F6\u6CA1\u6709\u8FD4\u56DE\u63A8\u8350\u5267\u76EE:"Hongguo returned no recommendations.",\u7B49\u5F85\u56DE\u5408\u5F00\u59CB:"Waiting for a turn",\u5F53\u524D\u56DE\u5408\u8FDB\u884C\u4E2D:"Turn in progress",\u56DE\u5408\u5DF2\u505C\u6B62:"Turn stopped",\u56DE\u5408\u5DF2\u4E2D\u65AD:"Turn interrupted","\u6B63\u5728\u51C6\u5907\u64AD\u653E\u2026":"Preparing playback\u2026",\u6B63\u5728\u64AD\u653E:"Playing","\u6B63\u5728\u672C\u673A\u51C6\u5907\u6574\u96C6\u2026":"Preparing the episode on this device\u2026","\u672C\u8F6E\u5DF2\u505C\u6B62\uFF0C\u5DF2\u4E3A\u4F60\u6682\u505C":"Turn stopped. Playback paused.","\u672C\u8F6E\u5DF2\u4E2D\u65AD\uFF0C\u5DF2\u4E3A\u4F60\u6682\u505C":"Turn interrupted. Playback paused.",\u5DF2\u624B\u52A8\u6682\u505C:"Paused",\u672C\u96C6\u5DF2\u64AD\u5B8C:"Episode finished",\u672C\u673A\u72B6\u6001\u4E0D\u53EF\u8FBE:"Local status unavailable","\u5DF2\u6682\u505C\uFF0C\u70B9\u51FB\u64AD\u653E\u7EE7\u7EED":"Paused. Press Play to resume.","\u8FD8\u6CA1\u6709\u672C\u673A\u56DE\u5408\u8BB0\u5F55\uFF0C\u53EF\u5148\u624B\u52A8\u89C2\u770B":"No local turns yet. Choose a show to watch.","\u51C6\u5907\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5":"Media preparation timed out. Try again.","\u89C2\u770B\u8FDB\u5EA6\u6682\u672A\u5199\u5165\uFF0C\u8BF7\u68C0\u67E5\u672C\u673A\u670D\u52A1":"Could not save progress. Check the local service.","\u8BE5\u96C6\u5F53\u524D\u4E0D\u53EF\u64AD\u653E\uFF0C\u8BF7\u68C0\u67E5\u7247\u6E90\u8BB8\u53EF\u6216 FFmpeg \u81EA\u68C0\u7ED3\u679C":"This episode is unavailable. Check the source and FFmpeg diagnostics.","\u4E0A\u6E38\u6682\u65F6\u9650\u5236\u533F\u540D\u64AD\u653E\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5":"The provider temporarily limited anonymous playback. Try again later.","\u7EA2\u679C\u7247\u6E90\u6682\u65F6\u4E0D\u53EF\u8FBE\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5":"The provider is temporarily unavailable. Try again later.",\u684C\u9762\u5B89\u5168\u7B56\u7565\u963B\u6B62\u4E86\u4FA7\u680F\u8F7D\u5165\u672C\u5730\u89C6\u9891:"The desktop security policy blocked the panel from loading local video.","\u4FA7\u680F\u5206\u6BB5\u8BFB\u53D6\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u70B9\u64AD":"The panel could not read a video segment. Try playing the episode again.","\u4FA7\u680F\u65E0\u6CD5\u5904\u7406\u89C6\u9891\u5206\u6BB5\uFF0C\u53EF\u4F7F\u7528\u540C\u7A97\u5206\u5C4F":"The panel could not process a video segment. Open in split view.","\u7B49\u5F85\u89C6\u9891\u5143\u6570\u636E\u8D85\u65F6\uFF0C\u8BF7\u91CD\u65B0\u70B9\u64AD":"Timed out waiting for video metadata. Try playing the episode again.","\u89C6\u9891\u52A0\u8F7D\u5DF2\u4E2D\u6B62\uFF0C\u53EF\u4EE5\u91CD\u65B0\u70B9\u64AD":"Video loading was interrupted. Try playing the episode again.","\u8BFB\u53D6\u89C6\u9891\u6570\u636E\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u70B9\u64AD":"The player could not read the video data. Try playing the episode again.","\u64AD\u653E\u5668\u89E3\u7801\u89C6\u9891\u6570\u636E\u5931\u8D25\uFF0C\u53EF\u4F7F\u7528\u540C\u7A97\u5206\u5C4F":"The player could not decode the video data. Open in split view.","\u64AD\u653E\u5668\u65E0\u6CD5\u6253\u5F00\u89C6\u9891\u6765\u6E90\uFF0C\u53EF\u91CD\u65B0\u70B9\u64AD\u6216\u4F7F\u7528\u540C\u7A97\u5206\u5C4F":"The player could not open the media source. Try again or open in split view.","\u89C6\u9891\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u70B9\u64AD":"Video loading failed. Try playing the episode again.","\u5F53\u524D\u9762\u677F\u4E0D\u652F\u6301\u5206\u6BB5\u89E3\u7801\uFF0C\u53EF\u4F7F\u7528\u540C\u7A97\u5206\u5C4F":"Segmented playback is unavailable here. Open in split view.","\u5DF2\u590D\u5236\uFF0C\u8BF7\u5728 Codex \u5185\u7F6E\u6D4F\u89C8\u5668\u6253\u5F00":"Link copied. Open it in the Codex browser.","\u94FE\u63A5\u5DF2\u9009\u4E2D\uFF0C\u8BF7\u590D\u5236\u5E76\u5728 Codex \u5185\u7F6E\u6D4F\u89C8\u5668\u6253\u5F00":"Copy the selected link and open it in the Codex browser.","\u672C\u96C6\u64AD\u653E\u5730\u5740\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u8BD5":"Playback for this episode expired. Try again.",\u7B49\u5F85\u4F1A\u8BDD\u9762\u677F\u8FDE\u63A5:"Waiting for the conversation panel",\u8BF7\u6C42\u53C2\u6570\u65E0\u6548:"Invalid settings or request",\u8FD4\u56DE\u9009\u5267:"Back to shows",\u5728\u540C\u7A97\u5206\u5C4F\u64AD\u653E:"Open in split view",\u5206\u5C4F:"Split view",\u63A8\u8350:"Featured",\u770B\u8FC7:"Watched",\u91CD\u8BD5:"Retry",\u6E05\u9664\u641C\u7D22:"Clear search",\u53D6\u6D88:"Cancel","\u6B63\u5728\u68C0\u67E5\u2026":"Checking\u2026",\u8FDB\u5EA6\u5E93:"Progress store",\u53EF\u5199:"Writable",\u4E0D\u53EF\u7528:"Unavailable",\u5C31\u7EEA:"Ready",\u7F3A\u5931:"Missing"},Vf=!1;function Ce(n){if(!Vf)return n;let e=n.trim(),t=hw[e];return t?n.replace(e,t):n.replace(/^继续观看 · /,"Continue watching \xB7 ").replace(/^已从 ([\d:]+) 继续$/,"Resumed at $1").replace(/^移除 (.+) 的观看历史$/,"Remove $1 from history").replace(/^第 (\d+) 集(?= · |$)/,"Episode $1").replace(/^(\d+) 集 · /,"$1 episodes \xB7 ").replace(/ · 可点击搜索重试$/," \xB7 Search again to retry").replace(/^(\d+\+?) 集$/,"$1 eps")}function MS(n){if(Vf=n.toLowerCase().startsWith("en"),!Vf)return;document.documentElement.lang="en";let e=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT);for(let t=e.nextNode();t;t=e.nextNode())t.parentElement?.tagName!=="SCRIPT"&&t.nodeValue?.trim()&&(t.nodeValue=Ce(t.nodeValue));for(let t of document.querySelectorAll("[aria-label],[placeholder],[title]"))for(let i of["aria-label","placeholder","title"]){let r=t.getAttribute(i);r&&t.setAttribute(i,Ce(r))}}var US="http://www.w3.org/2000/svg";function tr(n){let e=document.createElementNS(US,"svg"),t=document.createElementNS(US,"use");return e.setAttribute("class","i"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),t.setAttribute("href","#i-"+n),e.append(t),e}function io(n,e,t){let i=n.querySelector("svg.i");i||(i=tr(e),n.prepend(i)),i.querySelector("use")?.setAttribute("href","#i-"+e),n.setAttribute("aria-label",t),n.title=t}function Yi(n){let e=Number(n.min)||0,t=Number(n.max)||100,i=(Number(n.value)-e)/(t-e||1)*100;n.style.setProperty("--p",Math.min(100,Math.max(0,i)).toFixed(2)+"%")}function mw(n){let e=7;for(let t of n)e=(e*31+(t.codePointAt(0)||0))%360;return e}function bl(n,e=""){let t=document.createElement("span"),i=document.createElement("span");if(t.className="cover",t.style.setProperty("--h",String(mw(n))),i.className="ph",i.setAttribute("aria-hidden","true"),i.textContent=n,t.append(i),e){let r=document.createElement("span");r.className="badge",r.textContent=e,t.append(r)}return t}var Gf=new WeakMap;function FS(n,e){if(Gf.get(n)===e)return;Gf.set(n,e);let t=document.createElement("img");t.alt="",t.decoding="async",t.className="fg",t.onload=()=>{if(Gf.get(n)!==e)return;let i=t.naturalWidth>t.naturalHeight*.9;if(n.querySelectorAll("img").forEach(r=>r.remove()),i){let r=document.createElement("img");r.alt="",r.className="bg",r.src=e,n.prepend(r,t)}else n.prepend(t);n.dataset.shape=i?"wide":"tall",n.classList.add("loaded")},t.src=e}var W=Number.isFinite||function(n){return typeof n=="number"&&isFinite(n)},pw=Number.isSafeInteger||function(n){return typeof n=="number"&&Math.abs(n)<=gw},gw=Number.MAX_SAFE_INTEGER||9007199254740991,oe=(function(n){return n.NETWORK_ERROR="networkError",n.MEDIA_ERROR="mediaError",n.KEY_SYSTEM_ERROR="keySystemError",n.MUX_ERROR="muxError",n.OTHER_ERROR="otherError",n})({}),A=(function(n){return n.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",n.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",n.KEY_SYSTEM_NO_SESSION="keySystemNoSession",n.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",n.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",n.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",n.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",n.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",n.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",n.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",n.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",n.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",n.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",n.MANIFEST_LOAD_ERROR="manifestLoadError",n.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",n.MANIFEST_PARSING_ERROR="manifestParsingError",n.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",n.LEVEL_EMPTY_ERROR="levelEmptyError",n.PLAYLIST_UNCHANGED_ERROR="playlistUnchangedError",n.LEVEL_LOAD_ERROR="levelLoadError",n.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",n.LEVEL_PARSING_ERROR="levelParsingError",n.LEVEL_SWITCH_ERROR="levelSwitchError",n.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",n.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",n.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",n.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",n.FRAG_LOAD_ERROR="fragLoadError",n.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",n.FRAG_DECRYPT_ERROR="fragDecryptError",n.FRAG_PARSING_ERROR="fragParsingError",n.FRAG_GAP="fragGap",n.REMUX_ALLOC_ERROR="remuxAllocError",n.KEY_LOAD_ERROR="keyLoadError",n.KEY_LOAD_TIMEOUT="keyLoadTimeOut",n.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",n.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",n.BUFFER_APPEND_ERROR="bufferAppendError",n.BUFFER_APPENDING_ERROR="bufferAppendingError",n.BUFFER_APPEND_NO_PROGRESS="bufferAppendNoProgress",n.BUFFER_STALLED_ERROR="bufferStalledError",n.BUFFER_FULL_ERROR="bufferFullError",n.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",n.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",n.ASSET_LIST_LOAD_ERROR="assetListLoadError",n.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",n.ASSET_LIST_PARSING_ERROR="assetListParsingError",n.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",n.INTERNAL_EXCEPTION="internalException",n.INTERNAL_ABORTED="aborted",n.ATTACH_MEDIA_ERROR="attachMediaError",n.MEDIA_SOURCE_REQUIRES_RESET="mediaSourceRequiresReset",n.UNKNOWN="unknown",n})({}),v=(function(n){return n.MEDIA_ATTACHING="hlsMediaAttaching",n.MEDIA_ATTACHED="hlsMediaAttached",n.MEDIA_DETACHING="hlsMediaDetaching",n.MEDIA_DETACHED="hlsMediaDetached",n.MEDIA_ENDED="hlsMediaEnded",n.STALL_RESOLVED="hlsStallResolved",n.BUFFER_RESET="hlsBufferReset",n.BUFFER_CODECS="hlsBufferCodecs",n.BUFFER_CREATED="hlsBufferCreated",n.BUFFER_APPENDING="hlsBufferAppending",n.BUFFER_APPENDED="hlsBufferAppended",n.BUFFER_EOS="hlsBufferEos",n.BUFFERED_TO_END="hlsBufferedToEnd",n.BUFFER_FLUSHING="hlsBufferFlushing",n.BUFFER_FLUSHED="hlsBufferFlushed",n.MANIFEST_LOADING="hlsManifestLoading",n.MANIFEST_LOADED="hlsManifestLoaded",n.MANIFEST_PARSED="hlsManifestParsed",n.LEVEL_SWITCHING="hlsLevelSwitching",n.LEVEL_SWITCHED="hlsLevelSwitched",n.LEVEL_LOADING="hlsLevelLoading",n.LEVEL_LOADED="hlsLevelLoaded",n.LEVEL_UPDATED="hlsLevelUpdated",n.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",n.LEVELS_UPDATED="hlsLevelsUpdated",n.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",n.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",n.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",n.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",n.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",n.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",n.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",n.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",n.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",n.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",n.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",n.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",n.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",n.CUES_PARSED="hlsCuesParsed",n.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",n.INIT_PTS_FOUND="hlsInitPtsFound",n.FRAG_LOADING="hlsFragLoading",n.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",n.FRAG_LOADED="hlsFragLoaded",n.FRAG_DECRYPTED="hlsFragDecrypted",n.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",n.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",n.FRAG_PARSING_METADATA="hlsFragParsingMetadata",n.FRAG_PARSED="hlsFragParsed",n.FRAG_BUFFERED="hlsFragBuffered",n.FRAG_CHANGED="hlsFragChanged",n.FPS_DROP="hlsFpsDrop",n.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",n.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",n.ERROR="hlsError",n.DESTROYING="hlsDestroying",n.KEY_LOADING="hlsKeyLoading",n.KEY_LOADED="hlsKeyLoaded",n.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",n.BACK_BUFFER_REACHED="hlsBackBufferReached",n.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",n.ASSET_LIST_LOADING="hlsAssetListLoading",n.ASSET_LIST_LOADED="hlsAssetListLoaded",n.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",n.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",n.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",n.INTERSTITIAL_STARTED="hlsInterstitialStarted",n.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",n.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",n.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",n.INTERSTITIAL_ENDED="hlsInterstitialEnded",n.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",n.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",n.EVENT_CUE_ENTER="hlsEventCueEnter",n})({});function vw(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Kf={exports:{}},zS;function yw(){return zS||(zS=1,(function(n,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(l,c,u){if(u=u||{},l=l.trim(),c=c.trim(),!c){if(!u.alwaysNormalize)return l;var d=a.parseURL(l);if(!d)throw new Error("Error trying to parse base URL.");return d.path=a.normalizePath(d.path),a.buildURLFromParts(d)}var f=a.parseURL(c);if(!f)throw new Error("Error trying to parse relative URL.");if(f.scheme)return u.alwaysNormalize?(f.path=a.normalizePath(f.path),a.buildURLFromParts(f)):c;var h=a.parseURL(l);if(!h)throw new Error("Error trying to parse base URL.");if(!h.netLoc&&h.path&&h.path[0]!=="/"){var m=r.exec(h.path);h.netLoc=m[1],h.path=m[2]}h.netLoc&&!h.path&&(h.path="/");var p={scheme:h.scheme,netLoc:f.netLoc,path:null,params:f.params,query:f.query,fragment:f.fragment};if(!f.netLoc&&(p.netLoc=h.netLoc,f.path[0]!=="/"))if(!f.path)p.path=h.path,f.params||(p.params=h.params,f.query||(p.query=h.query));else{var g=h.path,y=g.substring(0,g.lastIndexOf("/")+1)+f.path;p.path=a.normalizePath(y)}return p.path===null&&(p.path=u.alwaysNormalize?a.normalizePath(f.path):f.path),a.buildURLFromParts(p)},parseURL:function(l){var c=i.exec(l);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(s,"");l.length!==(l=l.replace(o,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};n.exports=a})()})(Kf)),Kf.exports}var Vm=yw(),ai=class{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},Se=(function(n){return n.MANIFEST="manifest",n.LEVEL="level",n.AUDIO_TRACK="audioTrack",n.SUBTITLE_TRACK="subtitleTrack",n.MEDIA_FRAGMENT="media-fragment",n.KEY="key",n.STEERING_MANIFEST="steering-manifest",n.SERVER_CERTIFICATE="server-certificate",n.INTERSTITIAL_ASSET_LIST="interstitial-asset-list",n})({}),ne=(function(n){return n.MAIN="main",n.AUDIO="audio",n.SUBTITLE="subtitle",n})({}),He={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"},jl=class{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,bw(this,"stats")}setByteRange(e,t){let i=e.split("@",2),r;i.length===1?r=t?.byteRangeEndOffset||0:r=parseInt(i[1]),this._byteRange=[r,parseInt(i[0])+r]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[He.AUDIO]:null,[He.VIDEO]:null,[He.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new ai),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.relurl&&(this._url=Vm.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){let{elementaryStreams:e}=this;e[He.AUDIO]=null,e[He.VIDEO]=null,e[He.AUDIOVIDEO]=null,this.url=null}};function et(n){return n.sn!=="initSegment"}function co(n,e){return n.sn===e?.sn&&n.level===e.level}function yh(n,e){return n.sn===e?.sn&&n.level===e.level&&n.cc===e.cc}var ts=class extends jl{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){let e=this.stats.total;if(e)return e}if(this.byteRange.length){let e=this.byteRange[0],t=this.byteRange[1];if(W(e)&&W(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;let{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){let i=Object.keys(t);if(i.length===1){let r=this._decryptdata=t[i[0]]||null;r&&(this._decryptdata=r.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;let e=W(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t;let i=Object.keys(this.levelkeys),r=i.length;if(r>1||r===1&&(t=this.levelkeys[i[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!W(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return et(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){let t=this.levelkeys;if(t){var i;let r=t[e];r&&!((i=this._decryptdata)!=null&&i.keyId)&&(this._decryptdata=r.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,r,s,o=!1){let{elementaryStreams:a}=this,l=a[e];if(!l){a[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:s,partial:o};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,i),l.startDTS=Math.min(l.startDTS,r),l.endDTS=Math.max(l.endDTS,s)}},bh=class extends jl{constructor(e,t,i,r,s){super(i),this.fragOffset=0,this.duration=0,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.gap=!1,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=r;let o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,s),s&&(this.fragOffset=s.fragOffset+s.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){let{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo||this.fragment.type===ne.SUBTITLE&&this.stats.loading.end>0)}};function d_(n,e){let t=Object.getPrototypeOf(n);if(t){let i=Object.getOwnPropertyDescriptor(t,e);return i||d_(t,e)}}function bw(n,e){let t=d_(n,e);t&&(t.enumerable=!0,Object.defineProperty(n,e,t))}function Sw(n,e,t){return(e=Ew(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fe(){return Fe=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},Fe.apply(null,arguments)}function BS(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function se(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?BS(Object(t),!0).forEach(function(i){Sw(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):BS(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}function _c(n,e){if(n==null)return{};var t,i,r=xw(n,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)t=s[i],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(r[t]=n[t])}return r}function xw(n,e){if(n==null)return{};var t={};for(var i in n)if({}.hasOwnProperty.call(n,i)){if(e.indexOf(i)!==-1)continue;t[i]=n[i]}return t}function _w(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Ew(n){var e=_w(n,"string");return typeof e=="symbol"?e:e+""}function Vl(n){switch(n.details){case A.FRAG_LOAD_TIMEOUT:case A.KEY_LOAD_TIMEOUT:case A.LEVEL_LOAD_TIMEOUT:case A.MANIFEST_LOAD_TIMEOUT:case A.AUDIO_TRACK_LOAD_TIMEOUT:case A.SUBTITLE_TRACK_LOAD_TIMEOUT:case A.ASSET_LIST_LOAD_TIMEOUT:return!0}return!1}function f_(n){return n.details.startsWith("key")}function h_(n){return f_(n)&&!!n.frag&&!n.frag.decryptdata}function jS(n,e){let t=Vl(e);return n.default[`${t?"timeout":"error"}Retry`]}function Gm(n,e){let t=n.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*n.retryDelayMs,n.maxRetryDelayMs)}function VS(n){return se(se({},n),{errorRetry:null,timeoutRetry:null})}function vo(n,e,t,i){if(!n)return!1;let r=i?.code,s=e<n.maxNumRetry&&(Iw(r)||!!t);return n.shouldRetry?n.shouldRetry(n,e,t,i,s):s}function Iw(n){return yo(n)||!!n&&(n<400||n>499)}function yo(n){return n===0&&navigator.onLine===!1}function m_(n,e){return e>0&&n.loadError>0&&n.loadErrorTime!==0&&self.performance.now()-n.loadErrorTime>e}var Er=class{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){let i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){let e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}},Sh=class{constructor(e,t,i,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Er(e),this.fast_=new Er(t),this.defaultTTFB_=r,this.ttfb_=new Er(e)}update(e,t){let{slow_:i,fast_:r,ttfb_:s}=this;i.halfLife!==e&&(this.slow_=new Er(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new Er(t,r.getEstimate(),r.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new Er(e,s.getEstimate(),s.getTotalWeight()))}sample(e,t){if(t<=0)return;let i=Math.min(this.minDelayMs_,t/1e5),r=8*t,s=Math.max(e,i)/1e3,o=r/s;this.fast_.sample(s,o),this.slow_.sample(s,o)}sampleTTFB(e){let t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}},jt=class{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;let i=`[${e}]:`;this.trace=Ir,this.debug=t.debug.bind(null,i),this.log=t.log.bind(null,i),this.warn=t.warn.bind(null,i),this.info=t.info.bind(null,i),this.error=t.error.bind(null,i)}},Ir=function(){},Tw={trace:Ir,debug:Ir,log:Ir,warn:Ir,info:Ir,error:Ir};function xh(){return Fe({},Tw)}function kw(n,e){let t=self.console[n];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${n}] >`):Ir}function GS(n,e,t){return e[n]?e[n].bind(e):kw(n,t)}var _h=xh();function $w(n,e,t){let i=xh();if(typeof console=="object"&&n===!0||typeof n=="object"){let r=["debug","log","info","warn","error"];r.forEach(s=>{i[s]=GS(s,n,t)});try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.7.4`)}catch{return xh()}r.forEach(s=>{_h[s]=GS(s,n)})}else Fe(_h,i);return i}var Le=_h;function wr(n=!0){return typeof self>"u"?void 0:(n||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Aw(n){return typeof self<"u"&&n===self.ManagedMediaSource}function p_(n,e){let t=Object.keys(n),i=Object.keys(e),r=t.length,s=i.length;return!r||!s||r===s&&!t.some(o=>i.indexOf(o)===-1)}function ww(n){return btoa(String.fromCharCode(...n))}function Ec(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}var Pw="utf-16",Hf="utf-16be",KS="utf-16le",Ol="utf-8";function Rw(n,e={}){let t;Ec(n)?t=new DataView(n):t=new DataView(n.buffer,n.byteOffset,n.byteLength);let i=0,{encoding:r}=e;if(!r){let c=t.getUint8(0),u=t.getUint8(1);c==239&&u==187&&t.getUint8(2)==191?(r=Ol,i=3):c==254&&u==255?(r=Hf,i=2):c==255&&u==254?(r=KS,i=2):r=Ol}if(typeof TextDecoder<"u")return new TextDecoder(r).decode(t);let{byteLength:s}=t,o=r!==Hf,a="",l;for(;i<s;){switch(r){case Ol:if(l=t.getUint8(i),l<128)i++;else if(l>=194&&l<=223)if(i+1<s){let c=t.getUint8(i+1);c>=128&&c<=191?(l=(l&31)<<6|c&63,i+=2):i++}else i++;else if(l>=224&&l<=239)if(i+2<=s-1){let c=t.getUint8(i+1),u=t.getUint8(i+2);c>=128&&c<=191&&u>=128&&u<=191?(l=(l&15)<<12|(c&63)<<6|u&63,i+=3):i++}else i++;else if(l>=240&&l<=244)if(i+3<=s-1){let c=t.getUint8(i+1),u=t.getUint8(i+2),d=t.getUint8(i+3);c>=128&&c<=191&&u>=128&&u<=191&&d>=128&&d<=191?(l=(l&7)<<18|(c&63)<<12|(u&63)<<6|d&63,i+=4):i++}else i++;else i++;break;case Hf:case Pw:case KS:l=t.getUint16(i,o),i+=2;break}a+=String.fromCodePoint(l)}return a}function Lw(n){let e=typeof n=="string"?new URL(n):n;return e.origin+e.pathname.substring(0,e.pathname.lastIndexOf("/")+1)}function g_(n,e){if(n<0)return-g_(-n,e);let t=Math.pow(10,e);if(Math.abs(n*t%1-.5)<Number.EPSILON){let i=Math.floor(n*t);return(i%2===0?i:i+1)/t}else return Math.round(n*t)/t}function Dw(n,e){let t;try{t=new URL(n)}catch{return n}let i=new URL(e);if(t.origin!==i.origin)return n;let r=t.pathname.split("/").slice(1),s=i.pathname.split("/").slice(1,-1),o=Math.min(r.length,s.length);for(let a=0;a<o&&r[a]===s[a];a++)r.shift(),s.shift();for(;s.length;)s.shift(),r.unshift("..");return r.join("/")+t.search+t.hash}function v_(){try{return crypto.randomUUID()}catch{try{let e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{let r=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(i=="x"?r:r&3|8).toString(16)})}}}function Km(n,e){return e+10<=n.length&&n[e]===73&&n[e+1]===68&&n[e+2]===51&&n[e+3]<255&&n[e+4]<255&&n[e+6]<128&&n[e+7]<128&&n[e+8]<128&&n[e+9]<128}function Ic(n,e){let t=0;return t=(n[e]&127)<<21,t|=(n[e+1]&127)<<14,t|=(n[e+2]&127)<<7,t|=n[e+3]&127,t}function Cw(n,e){return Km(n,e)&&Ic(n,e+6)+10<=n.length-e}function y_(n,e){return e+10<=n.length&&n[e]===51&&n[e+1]===68&&n[e+2]===73&&n[e+3]<255&&n[e+4]<255&&n[e+6]<128&&n[e+7]<128&&n[e+8]<128&&n[e+9]<128}function bo(n,e){let t=e,i=0;for(;Km(n,e);){i+=10;let r=Ic(n,e+6);i+=r,y_(n,e+10)&&(i+=10),e+=i}if(i>0)return n.subarray(t,t+i)}function Ow(n){return Ec(n)?n:n.byteOffset==0&&n.byteLength==n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer}function Zf(n,e=0,t=1/0){return Nw(n,e,t,Uint8Array)}function Nw(n,e,t,i){let r=Mw(n),s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);let o=Uw(n)?n.byteOffset:0,a=(o+n.byteLength)/s,l=(o+e)/s,c=Math.floor(Math.max(0,Math.min(l,a)));return new i(r,c,Math.floor(Math.min(c+Math.max(t,0),a))-c)}function Mw(n){return Ec(n)?n:n.buffer}function Uw(n){return n&&Ec(n.buffer)&&n.byteLength!==void 0&&n.byteOffset!==void 0}function pn(n,e=!1){let t=e?n.indexOf(0):n.length,i=Rw(new DataView(n.buffer,n.byteOffset,t),{encoding:Ol});return e?i:i.replace(/\0/g,"")}function Fw(n){let e={key:n.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(n.size<2)return;if(n.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}let i=n.data.subarray(1).indexOf(0);if(i===-1)return;let r=pn(Zf(n.data,1,i)),s=n.data[2+i],o=n.data.subarray(3+i).indexOf(0);if(o===-1)return;let a=pn(Zf(n.data,3+i,o)),l;return r==="-->"?l=pn(Zf(n.data,4+i+o)):l=Ow(n.data.subarray(4+i+o)),e.mimeType=r,e.pictureType=s,e.description=a,e.data=l,e}function zw(n){if(n.size<2)return;let e=pn(n.data,!0),t=new Uint8Array(n.data.subarray(e.length+1));return{key:n.type,info:e,data:t.buffer}}function Bw(n){if(n.size<2)return;if(n.type==="TXXX"){let t=1,{data:i}=n,r=pn(i.subarray(t),!0);t+=r.length+1;let s=pn(i.subarray(t));return{key:n.type,info:r,data:s}}let e=pn(n.data.subarray(1));return{key:n.type,info:"",data:e}}function jw(n){if(n.type==="WXXX"){if(n.size<2)return;let t=1,i=pn(n.data.subarray(t),!0);t+=i.length+1;let r=pn(n.data.subarray(t));return{key:n.type,info:i,data:r}}let e=pn(n.data);return{key:n.type,info:"",data:e}}function Vw(n){return n.type==="PRIV"?zw(n):n.type[0]==="W"?jw(n):n.type==="APIC"?Fw(n):Bw(n)}function Gw(n){let e=String.fromCharCode(n[0],n[1],n[2],n[3]),t=Ic(n,4),i=10;return{type:e,size:t,data:n.subarray(i,i+t)}}var Sl=10,Kw=10;function b_(n){let e=0,t=[];for(;Km(n,e);){let i=Ic(n,e+6);n[e+5]>>6&1&&(e+=Sl),e+=Sl;let r=e+i;for(;e+Kw<r;){let s=Gw(n.subarray(e)),o=Vw(s);o&&t.push(o),e+=s.size+Sl}y_(n,e)&&(e+=Sl)}return t}function S_(n){return n&&n.key==="PRIV"&&n.info==="com.apple.streaming.transportStreamTimestamp"}function Hw(n){if(n.data.byteLength===8){let e=new Uint8Array(n.data),t=e[3]&1,i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,t&&(i+=4772185884e-2),Math.round(i)}}function Hm(n){let e=b_(n);for(let t of e)if(S_(t))return Hw(t)}function ht(n){let e="";for(let t=0;t<n.length;t++){let i=n[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}function x_(n){return Uint8Array.from(n.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function Zm(n){return Uint8Array.from(atob(n),e=>e.charCodeAt(0))}function Cn(n){return String.fromCharCode.apply(null,n)}var Gn=Math.pow(2,32)-1,de={avc1:1635148593,avcC:1635148611,hvc1:1752589105,hvcC:1752589123,btrt:1651798644,dinf:1684631142,dref:1685218662,esds:1702061171,free:1718773093,ftyp:1718909296,hdlr:1751411826,mdat:1835295092,mdhd:1835296868,mdia:1835297121,mfhd:1835427940,minf:1835626086,moof:1836019558,moov:1836019574,mp4a:1836069985,".mp3":778924083,dac3:1684103987,"ac-3":1633889587,mvex:1836475768,mvhd:1836476516,pasp:1885434736,sdtp:1935963248,stbl:1937007212,stco:1937007471,stsc:1937011555,stsd:1937011556,stsz:1937011578,stts:1937011827,tfdt:1952867444,tfhd:1952868452,traf:1953653094,trak:1953653099,trun:1953658222,trex:1953654136,tkhd:1953196132,vmhd:1986881636,smhd:1936549988},__={video:1,audio:2,id3:3,text:4};function E_(n,e){let t=n[e]<<8|n[e+1];return t<0?65536+t:t}function te(n,e){let t=n[e]<<24|n[e+1]<<16|n[e+2]<<8|n[e+3];return t<0?4294967296+t:t}function HS(n,e){let t=te(n,e);return t*=Math.pow(2,32),t+=te(n,e+4),t}function xl(n,e){let t="";for(let i=e;i<n.length;i++)if(t+=String.fromCharCode(n[i]),n[i]===0)return t;return null}function Eh(n,e){return n[e]<<24|n[e+1]<<16|n[e+2]<<8|n[e+3]}function at(n,e,t){n[e]=t>>24,n[e+1]=t>>16&255,n[e+2]=t>>8&255,n[e+3]=t&255}function ZS(n,e,t){let i=e.byteOffset-n.byteOffset-8,r=8+t,s=e.byteLength+8-r;s<8||(at(n,i,r),at(n,i+r,s),at(n,i+r+4,de.free))}function Ih(n,e){return[n.byteOffset-e-8,n.byteOffset-e+n.byteLength]}function I_(n,e){e.sort((a,l)=>a[0]-l[0]);let t=e.reduce((a,[l,c])=>a+c-l,0),i=new Uint8Array(n.byteLength-t),r=0,s=0;for(let a=0;a<e.length;a++){let[l,c]=e[a];i.set(n.subarray(r,l),s),s+=l-r,r=c}return i.set(n.subarray(r),s),{result:i,dropped:t,droppedBefore:a=>e.reduce((l,[c,u])=>u<=a?l+u-c:l,0)}}function Zw(n){let e=he(n,["moov"]);if(e.length!==1||he(n,["moof"]).length)return null;let t=n.byteOffset,i=[],r=[],s=!1,o=he(e[0],["trak"]);for(let h=0;h<o.length;h++){let m=o[h],p=he(m,["mdia","hdlr"])[0];if((p?Cn(p.subarray(8,12)):"")==="vide"){s=!0;continue}let y=he(m,["tkhd"])[0];if(!y)return null;let b=y[0];r.push(te(y,b===0?12:20)),i.push(Ih(m,t))}if(!s||!i.length)return null;let a=he(e[0],["mvex"])[0],l=0;if(a){let h=he(a,["trex"]);for(let m=0;m<h.length;m++){let p=h[m];r.indexOf(te(p,4))!==-1&&(i.push(Ih(p,t)),l+=p.byteLength+8)}}let{result:c,dropped:u,droppedBefore:d}=I_(n,i),f=e[0].byteOffset-t-8;if(at(c,f,e[0].byteLength+8-u),a&&l){let h=a.byteOffset-t-8;at(c,h-d(h),a.byteLength+8-l)}return c}function qw(n,e,t,i,r){if(t<1)return null;let s=he(n,["moof"]);if(s.length!==1)return null;let o=s[0],a=n.byteOffset,l=[],c=[],u=he(o,["traf"]),d=!0;for(let p=0;p<u.length;p++){let g=u[p],y=he(g,["tfhd"])[0];if(!y)return null;te(y,4)===e?(l.push(g),te(y,0)&131072||(d=!1)):c.push(Ih(g,a))}if(!l.length||c.length&&!d)return null;if(i!==void 0){let p=t;for(let y=0;y<l.length;y++){let b=l[y],S=0,x=he(b,["trun"]);for(let T=0;T<x.length;T++){let $=x[T],P=Math.min(p,te($,4));if(P){at(n,$.byteOffset-a+4,P);let k=te($,0)&16777215,D=(k&256?4:0)+(k&512?4:0)+(k&1024?4:0)+(k&2048?4:0);ZS(n,$,8+(k&1?4:0)+(k&4?4:0)+P*D)}else at(n,$.byteOffset-a-4,de.free);p-=P,S+=P}let _=he(b,["senc"])[0];_&&at(n,_.byteOffset-a+4,S);let I=he(b,["saiz"])[0];if(I){let T=I[1]<<16|I[2]<<8|I[3],$=4;T&1&&($+=8);let P=I[$];$+=1,at(n,I.byteOffset-a+$,S),ZS(n,I,$+4+(P===0?S:0))}}let g=he(n,["mdat"]);if(g.length===1){let y=g[0].byteOffset-a-8;at(n,y,i-y)}}let f=n,h=0,m=()=>0;if(c.length){({result:f,dropped:h,droppedBefore:m}=I_(n,c)),at(f,o.byteOffset-a-8,o.byteLength+8-h);for(let p=0;p<l.length;p++){let g=l[p],y=m(g.byteOffset-a),b=he(g,["trun"]);for(let S=0;S<b.length;S++){let x=b[S];te(x,0)&1&&at(f,x.byteOffset-a-y+8,te(x,8)-h)}if(y){let S=he(g,["saio"]);for(let x=0;x<S.length;x++){let _=S[x],I=_[0]===0?4:8,T=te(_,0)&1?12:4,$=te(_,T);for(T+=4;$--;T+=I){let P=T+I-4;at(f,_.byteOffset-a-y+P,te(_,P)-y)}}}}}if(r){let{durationOffset:p,value:g}=r;at(f,p-m(p),g)}return i!==void 0?f.subarray(0,i-h):f}function Ww(n,e){let t=n.byteLength;for(let i=0;i<t;){let r=te(n,i);if(r>8&&te(n,i+4)===de[e])return!0;i=r>1?i+r:t}return!1}function he(n,e){let t=[];return e.length&&T_(n,e,0,0,n.byteLength,t),t}function T_(n,e,t,i,r,s){let o=e[t];if(o?.length!==4)return;let a=o.charCodeAt(0),l=o.charCodeAt(1),c=o.charCodeAt(2),u=o.charCodeAt(3),d=e.length-1;for(let f=i;f<r;){let h=f+8<=r,m=f+4<=r?n[f]*16777216+(n[f+1]<<16|n[f+2]<<8|n[f+3]):te(n,f),p=m>1?f+m:r;if(h&&n[f+4]===a&&n[f+5]===l&&n[f+6]===c&&n[f+7]===u){let g=Math.min(p,r);t===d?s.push(n.subarray(f+8,g)):T_(n,e,t+1,f+8,g,s)}f=p}}function Yw(n){let e=[],t=n[0],i=8,r=te(n,i);i+=4;let s=0,o=0;t===0?(s=te(n,i),o=te(n,i+4),i+=8):(s=HS(n,i),o=HS(n,i+8),i+=16),i+=2;let a=n.length+o,l=E_(n,i);i+=2;for(let c=0;c<l;c++){let u=i,d=te(n,u);u+=4;let f=d&2147483647;if((d&2147483648)>>>31===1)return Le.warn("SIDX has hierarchical references (not supported)"),null;let m=te(n,u);u+=4,e.push({referenceSize:f,subsegmentDuration:m,info:{duration:m/r,start:a,end:a+f-1}}),a+=f,u+=4,i=u}return{earliestPresentationTime:s,timescale:r,version:t,referencesCount:l,references:e}}function k_(n){let e=[],t=he(n,["moov","trak"]);for(let r=0;r<t.length;r++){let s=t[r],o=he(s,["tkhd"])[0];if(o){let a=o[0],l=te(o,a===0?12:20),c=he(s,["mdia","mdhd"])[0];if(c){a=c[0];let u=te(c,a===0?12:20),d=he(s,["mdia","hdlr"])[0];if(d){let f=Cn(d.subarray(8,12)),h={soun:He.AUDIO,vide:He.VIDEO}[f],m=he(s,["mdia","minf","stbl","stsd"])[0],p=Jw(m);h?(e[l]={timescale:u,type:h,stsd:p},e[h]=se({timescale:u,id:l},p)):e[l]={timescale:u,type:f,stsd:p}}}}}return he(n,["moov","mvex","trex"]).forEach(r=>{let s=te(r,4),o=e[s];o&&(o.default={duration:te(r,12),sampleSize:te(r,16),flags:te(r,20)})}),e}function Jw(n){let e=n.subarray(8),t=e.subarray(86),i=Cn(e.subarray(4,8)),r=i,s,o=i==="enca"||i==="encv";if(o){let c=he(e,[i])[0].subarray(i==="enca"?28:78);he(c,["sinf"]).forEach(d=>{let f=he(d,["schm"])[0];if(f){let h=Cn(f.subarray(4,8));if(h==="cbcs"||h==="cenc"){let m=he(d,["frma"])[0];m&&(r=Cn(m))}}})}let a=r;switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{let l=he(t,["avcC"])[0];l&&l.length>3&&(r+="."+El(l[1])+El(l[2])+El(l[3]),s=_l(a==="avc1"?"dva1":"dvav",t));break}case"mp4a":{let l=he(e,[i])[0],c=he(l.subarray(28),["esds"])[0];if(c&&c.length>7){let u=4;if(c[u++]!==3)break;u=qf(c,u),u+=2;let d=c[u++];if(d&128&&(u+=2),d&64&&(u+=c[u++]),c[u++]!==4)break;u=qf(c,u);let f=c[u++];if(f===64)r+="."+El(f);else break;if(u+=12,c[u++]!==5)break;u=qf(c,u);let h=c[u++],m=(h&248)>>3;m===31&&(m+=1+((h&7)<<3)+((c[u]&224)>>5)),r+="."+m}break}case"hvc1":case"hev1":{let l=he(t,["hvcC"])[0];if(l&&l.length>12){let c=l[1],u=["","A","B","C"][c>>6],d=c&31,f=te(l,2),h=(c&32)>>5?"H":"L",m=l[12],p=l.subarray(6,12);r+="."+u+d,r+="."+Xw(f).toString(16).toUpperCase(),r+="."+h+m;let g="";for(let y=p.length;y--;){let b=p[y];(b||g)&&(g="."+b.toString(16).toUpperCase()+g)}r+=g}s=_l(a=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{r=_l(r,t)||r;break}case"vp09":{let l=he(t,["vpcC"])[0];if(l&&l.length>6){let c=l[4],u=l[5],d=l[6]>>4&15;r+="."+Kn(c)+"."+Kn(u)+"."+Kn(d)}break}case"av01":{let l=he(t,["av1C"])[0];if(l&&l.length>2){let c=l[1]>>>5,u=l[1]&31,d=l[2]>>>7?"H":"M",f=(l[2]&64)>>6,h=(l[2]&32)>>5,m=c===2&&f?h?12:10:f?10:8,p=(l[2]&16)>>4,g=(l[2]&8)>>3,y=(l[2]&4)>>2,b=l[2]&3;r+="."+c+"."+Kn(u)+d+"."+Kn(m)+"."+p+"."+g+y+b+"."+Kn(1)+"."+Kn(1)+"."+Kn(1)+"."+0,s=_l("dav1",t)}break}}return{codec:r,encrypted:o,supplemental:s}}function _l(n,e){let t=he(e,["dvvC"]),i=t.length?t[0]:he(e,["dvcC"])[0];if(i){let r=i[2]>>1&127,s=i[2]<<5&32|i[3]>>3&31;return n+"."+Kn(r)+"."+Kn(s)}}function Xw(n){let e=0;for(let t=0;t<32;t++)e|=(n>>t&1)<<31-t;return e>>>0}function qf(n,e){let t=e+5;for(;n[e++]&128&&e<t;);return e}function El(n){return("0"+n.toString(16).toUpperCase()).slice(-2)}function Kn(n){return(n<10?"0":"")+n}function Qw(n,e){if(!n||!e)return;let t=e.keyId;t?.byteLength===16&&e.isCommonEncryption&&$_(n,(i,r)=>{let s=i.subarray(8,24);s.some(o=>o!==0)||(Le.log(`[eme] Patching keyId in 'enc${r?"a":"v"}>sinf>>tenc' box: ${ht(s)} -> ${ht(t)}`),i.set(t,8))})}function eP(n){let e=[];return $_(n,t=>e.push(t.subarray(8,24))),e}function $_(n,e){he(n,["moov","trak"]).forEach(i=>{let r=he(i,["mdia","minf","stbl","stsd"])[0];if(!r)return;let s=r.subarray(8),o=he(s,["enca"]),a=o.length>0;a||(o=he(s,["encv"])),o.forEach(l=>{let c=a?l.subarray(28):l.subarray(78);he(c,["sinf"]).forEach(d=>{let f=A_(d);f&&e(f,a)})})})}function A_(n){let e=he(n,["schm"])[0];if(e){let t=Cn(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){let i=he(n,["schi","tenc"])[0];if(i)return i}}}var qS;function tP(n){return typeof TextDecoder>"u"?pn(n):(qS||(qS=new TextDecoder("utf-8"))).decode(n).replace(/\0/g,"")}function nP(n){let e=n.byteLength,t=[];for(let i=0;i<e;){let r=i+8<=e,s=i+4<=e?n[i]*16777216+(n[i+1]<<16|n[i+2]<<8|n[i+3]):te(n,i),o=s>1?i+s:e;if(r&&n[i+4]===109&&n[i+5]===111&&n[i+6]===111&&n[i+7]===102){let a=Math.min(o,e);for(let l=i+8;l<a;){let c=l+8<=a,u=l+4<=a?n[l]*16777216+(n[l+1]<<16|n[l+2]<<8|n[l+3]):te(n,l),d=u>1?l+u:a;if(c&&n[l+4]===116&&n[l+5]===114&&n[l+6]===97&&n[l+7]===102){let f=Math.min(d,a),h,m,p=[];for(let g=l+8;g<f;){let y=g+8<=f,b=g+4<=f?n[g]*16777216+(n[g+1]<<16|n[g+2]<<8|n[g+3]):te(n,g),S=b>1?g+b:f;if(y&&n[g+4]===116){let x=Math.min(S,f);n[g+5]===102&&n[g+6]===104&&n[g+7]===100?m||(m=n.subarray(g+8,x)):n[g+5]===102&&n[g+6]===100&&n[g+7]===116?h||(h=n.subarray(g+8,x)):n[g+5]===114&&n[g+6]===117&&n[g+7]===110&&p.push(n.subarray(g+8,x))}g=S}t.push({moofOffset:n.byteOffset+i,tfdt:h,tfhd:m,truns:p})}l=d}}i=o}return t}function rP(n,e,t,i,r=!0){return w_(n,e,i,r)}function iP(n,e,t,i,r=!1){let s=[],o=e.samples,a=w_(o,t,i,r,{isHEVCFlavor:Do(e.codec),samples:s,timeOffset:n,timescale:e.timescale,trackId:e.id});return{samples:s,sampleData:{includeSampleDetails:r,tracks:a}}}function w_(n,e,t,i,r){let s={},o=!1,a=nP(n),l=n.byteLength;for(let d=0;d<a.length;d++){let{moofOffset:f,tfdt:h,tfhd:m,truns:p}=a[d],g=te(m,4),y=e[g];if(!y)continue;let b=s[g]||(s[g]={start:NaN,duration:0,sampleCount:0,trun:[],timescale:y.timescale,type:y.type}),S;if(h){let B=h[0];S=te(h,4),B===1&&(S===Gn?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(S*=Gn+1,S+=te(h,8))),W(S)&&(!W(b.start)||S<b.start)&&(b.start=S),r&&W(S)&&(r.timeOffset=S/r.timescale)}let x=r?.trackId===g&&y.type===He.VIDEO,_=y.default,I=te(m,0)&16777215,T=_?.duration||0,$,P=_?.sampleSize||0,k=8;I&1&&(k+=8),I&2&&(k+=4),I&8&&(T=te(m,k),$=m.byteOffset-n.byteOffset+k,k+=4),I&16&&(P=te(m,k));let D=0,U=(I&1)!==0,V=!U&&(I&131072)!==0;U?(D=te(m,8),D*=Math.pow(2,32),D+=te(m,12)):V&&(D=f);let X=S||0,q=0,z=T;for(let B=0;B<p.length;B++){let j=p[B],Z=te(j,4),ie=b.sampleCount;b.sampleCount+=Z;let K=j[3]&1,Y=0,me=j[3]&4,le=j[2]&1,_e=j[2]&2,ue=j[2]&4,Ae=j[2]&8,Ee=8;K&&(Y=Eh(j,Ee),Ee+=4),me&&(!(j[Ee+1]&1)&&b.keyFrameIndex===void 0&&(b.keyFrameIndex=ie),Ee+=4);let Pe=D+Y;if(!i&&j[1]===0&&j[2]===6&&j[3]===1){var c,u;let At=X,ut=Pe,yr=Ee,ve=-1,ge=0,be=0,dt=(c=r?.timeOffset)!=null?c:0,rt=T/((u=r?.timescale)!=null?u:1),Ft=r?.isHEVCFlavor===!0,Jt=Ft?2:1;for(let Nt=0;Nt<Z;Nt++){let zt=j[Ee]===0?j[Ee+1]<<16|j[Ee+2]<<8|j[Ee+3]:te(j,Ee),Xt=ve===-1&&b.keyFrameIndex===void 0&&(j[Ee+5]&1)===0;Ee+=8;let br=Pe+zt;if(x){if(zt>0){let mt=Pe;do{let Sr=n[mt]===0?n[mt+1]<<16|n[mt+2]<<8|n[mt+3]:te(n,mt);mt+=4;let xr=n[mt],fn=Ft?xr>>1&63:xr&31;(Ft?fn===39||fn===40:fn===6)&&So(n.subarray(mt,mt+Sr),Jt,dt,r.samples),mt+=Sr}while(mt<br)}dt+=rt}Pe=br,Xt&&(ve=Nt,ge=Pe)}if(Pe<=l)be=Z;else{let Nt=ut,zt=yr;for(let Xt=0;Xt<Z;Xt++){let br=j[zt]===0?j[zt+1]<<16|j[zt+2]<<8|j[zt+3]:te(j,zt);if(Nt+=br,Nt>l)break;be=Xt+1,zt+=8}}if(x&&(r.timeOffset=dt),ve!==-1&&ge<=l&&b.keyFrameIndex===void 0&&(b.keyFrameIndex=ve,b.keyFrameStart=At+ve*T),be){(!W(b.ptsMin)||At<b.ptsMin)&&(b.ptsMin=At);let Nt=At+be*T;(!W(b.ptsMax)||Nt>b.ptsMax)&&(b.ptsMax=Nt)}let Qr=T*Z;X=At+Qr,q+=Qr;continue}let st,Yt;i&&(st=[],Yt={sampleOffset:Pe,samples:st,defaultSampleDurationOffset:$},Pe<=l&&b.trun.push(Yt));let er;for(let At=0;At<Z;At++){let ut;le?(i&&(ut=j.byteOffset-n.byteOffset+Ee),z=te(j,Ee),Ee+=4):z=T,_e?(er=te(j,Ee),Ee+=4):er=P;let yr,ve;ue&&(ve=j[Ee+1]&1?1:0,i&&(yr={isNonSync:ve,dependsOn:(j[Ee]&3)===1?1:2}),Ee+=4);let ge=0;if(Ae&&(ge=j[0]===0?te(j,Ee):Eh(j,Ee),Ee+=4),x){let be=Pe,dt=0;for(;dt<er;){let rt=te(n,be);be+=4,P_(r.isHEVCFlavor,n[be])&&So(n.subarray(be,be+rt),r.isHEVCFlavor?2:1,r.timeOffset+ge/r.timescale,r.samples),be+=rt,dt+=rt+4}r.timeOffset+=z/r.timescale}if(Pe+=er,Pe<=l){Yt&&ut!==void 0&&(Yt.lastSampleDurationOffset=ut),ve===0&&b.keyFrameIndex===void 0&&(b.keyFrameIndex=At,b.keyFrameStart=X);let be=X+ge;(!W(b.ptsMin)||be<b.ptsMin)&&(b.ptsMin=be),(!W(b.ptsMax)||be+z>b.ptsMax)&&(b.ptsMax=be+z),st&&(st[At]={cts:ge,duration:z,flags:yr,size:er})}X+=z,q+=z}!q&&T&&(q+=T*Z)}b.duration+=q,b.duration&&(o=!0)}if(!o){let d=1/0,f=0,h=he(n,["sidx"]);for(let m=0;m<h.length;m++){let p=Yw(h[m]);if(p!=null&&p.references){d=Math.min(d,p.earliestPresentationTime/p.timescale);let g=p.references.reduce((y,b)=>y+b.info.duration||0,0);f=Math.max(f,g+p.earliestPresentationTime/p.timescale)}}f&&W(f)&&Object.keys(s).forEach(m=>{s[m].duration||(s[m].duration=f*s[m].timescale-s[m].start)})}return s}function sP(n){let e={valid:null,remainder:null},t=he(n,["moof"]);if(t.length<2)return e.remainder=n,e;let i=t[t.length-1];return e.valid=n.slice(0,i.byteOffset-8),e.remainder=n.slice(i.byteOffset-8),e}function bn(n,e){let t=new Uint8Array(n.length+e.length);return t.set(n),t.set(e,n.length),t}function oP(n,e){let t=[],i=e.samples,r=e.timescale,s=e.id,o=!1;return he(i,["moof"]).map(l=>{let c=l.byteOffset-8;he(l,["traf"]).map(d=>{let f=he(d,["tfdt"]).map(h=>{let m=h[0],p=te(h,4);return m===1&&(p*=Math.pow(2,32),p+=te(h,8)),p/r})[0];return f!==void 0&&(n=f),he(d,["tfhd"]).map(h=>{let m=te(h,4),p=te(h,0)&16777215,g=(p&1)!==0,y=0,b=(p&2)!==0,S=(p&8)!==0,x=0,_=(p&16)!==0,I=0,T=(p&32)!==0,$=!g&&(p&131072)!==0,P=8;m===s&&(g?(y=te(h,P),P+=4,y*=Math.pow(2,32),y+=te(h,P),P+=4):$&&(y=c),b&&(P+=4),S&&(x=te(h,P),P+=4),_&&(I=te(h,P),P+=4),T&&(P+=4),e.type==="video"&&(o=Do(e.codec)),he(d,["trun"]).map(k=>{let D=k[0],U=te(k,0)&16777215,V=(U&1)!==0,X=0,q=(U&4)!==0,z=(U&256)!==0,B=0,j=(U&512)!==0,Z=0,ie=(U&1024)!==0,K=(U&2048)!==0,Y=0,me=te(k,4),le=8;V&&(X=te(k,le),le+=4),q&&(le+=4);let _e=y+X;for(let ue=0;ue<me;ue++){if(z?(B=te(k,le),le+=4):B=x,j?(Z=te(k,le),le+=4):Z=I,ie&&(le+=4),K&&(D===0?Y=te(k,le):Y=Eh(k,le),le+=4),e.type===He.VIDEO){let Ae=0;for(;Ae<Z;){let Ee=te(i,_e);if(_e+=4,P_(o,i[_e])){let Pe=i.subarray(_e,_e+Ee);So(Pe,o?2:1,n+Y/r,t)}_e+=Ee,Ae+=Ee+4}}n+=B/r}}))})})}),t}function Do(n){if(!n)return!1;let e=n.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function P_(n,e){if(n){let t=e>>1&63;return t===39||t===40}else return(e&31)===6}function So(n,e,t,i){let r=R_(n),s=0;s+=e;let o=0,a=0,l=0;for(;s<r.length;){o=0;do{if(s>=r.length)break;l=r[s++],o+=l}while(l===255);a=0;do{if(s>=r.length)break;l=r[s++],a+=l}while(l===255);let c=r.length-s,u=s;if(a<c)s+=a;else if(a>c){Le.error(`Malformed SEI payload. ${a} is too small, only ${c} bytes left to parse.`);break}if(o===4){if(r[u++]===181){let f=E_(r,u);if(u+=2,f===49){let h=te(r,u);if(u+=4,h===1195456820){let m=r[u++];if(m===3){let p=r[u++],g=31&p,y=64&p,b=y?2+g*3:0,S=new Uint8Array(b);if(y){S[0]=p;for(let x=1;x<b;x++)S[x]=r[u++]}i.push({type:m,payloadType:o,pts:t,bytes:S})}}}}}else if(o===5&&a>16){let d=[];for(let m=0;m<16;m++){let p=r[u++].toString(16);d.push(p.length==1?"0"+p:p),(m===3||m===5||m===7||m===9)&&d.push("-")}let f=a-16,h=new Uint8Array(f);for(let m=0;m<f;m++)h[m]=r[u++];i.push({payloadType:o,pts:t,uuid:d.join(""),userData:tP(h),userDataBytes:h})}}}function R_(n){let e=n.byteLength,t,i=n.indexOf(3,3);for(;i!==-1;)n[i-1]===0&&n[i-2]===0&&(t||(t=[])).push(i),i=n.indexOf(3,i+1);if(!t)return n;let r=e-t.length,s=new Uint8Array(r),o=0,a=0;for(let l=0;l<r;a++,l++)a===t[o]&&(a++,o++),s[l]=n[a];return s}function aP(n){let e=n[0],t="",i="",r=0,s=0,o,a=0,l=0,c=4;if(e===0){let d=xl(n,c),f=d!==null?xl(n,c+d.length):null;d!==null&&f!==null?(t=d,i=f,c+=d.length+f.length,r=te(n,c),c+=4,s=te(n,c),c+=4,a=te(n,c),c+=4,l=te(n,c),c+=4):(Le.warn(`Unterminated ${d===null?"scheme_id_uri":"value"} in parsing emsg box: version 0 box ends inside a string, dropping all of its fields`),c=n.length)}else if(e===1){r=te(n,c),c+=4;let d=te(n,c);c+=4;let f=te(n,c);c+=4,o=2**32*d+f,pw(o)||(o=Number.MAX_SAFE_INTEGER,Le.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),a=te(n,c),c+=4,l=te(n,c),c+=4;let h=xl(n,c),m=h!==null?xl(n,c+h.length):null;h!==null&&(t=h,c+=h.length),m!==null?(i=m,c+=m.length):(Le.warn(`Unterminated ${h===null?"scheme_id_uri":"value"} in parsing emsg box: version 1 box ends inside a string, dropping its ${h===null?"strings and payload":"value and payload"}`),c=n.length)}let u=n.subarray(c,n.byteLength);return{schemeIdUri:t,value:i,timeScale:r,presentationTime:o,presentationTimeDelta:s,eventDuration:a,id:l,payload:u}}function lP(n,...e){let t=e.length,i=8,r=t;for(;r--;)i+=e[r].byteLength;let s=new Uint8Array(i);for(s[0]=i>>24&255,s[1]=i>>16&255,s[2]=i>>8&255,s[3]=i&255,s.set(n,4),r=0,i=8;r<t;r++)s.set(e[r],i),i+=e[r].byteLength;return s}function cP(n,e,t){if(n.byteLength!==16)throw new RangeError("Invalid system id");let i,r;i=0,r=new Uint8Array;let s;i>0?(s=new Uint8Array(4),e.length>0&&new DataView(s.buffer).setUint32(0,e.length,!1)):s=new Uint8Array;let o=new Uint8Array(4);return t.byteLength>0&&new DataView(o.buffer).setUint32(0,t.byteLength,!1),lP([112,115,115,104],new Uint8Array([i,0,0,0]),n,s,r,o,t)}function L_(n){let e=[];if(n instanceof ArrayBuffer){let t=n.byteLength,i=0;for(;i+32<t;){let r=new DataView(n,i),s=dP(r);e.push(s),i+=s.size}}return e}function uP(n){let e=[];for(let t=0;t<n.length;){let i=n[t++],r=i&7;if(r===0){for(;n[t++]&128;);continue}if(r!==2){t+=r===1?8:4;continue}let s=0;for(let o=0,a=128;a&128;o+=7)s|=((a=n[t++])&127)<<o;if(i>>3===2)if(s===32){let o=new Uint8Array(16);for(let a=0;a<16;a++)o[a]=parseInt(String.fromCharCode(n[t+a*2],n[t+a*2+1]),16);e.push(o)}else s===16&&e.push(n.subarray(t,t+16));t+=s}return e}function dP(n){let e=n.getUint32(0),t=n.byteOffset,i=n.byteLength;if(i<e)return{offset:t,size:i};if(n.getUint32(4)!==1886614376)return{offset:t,size:e};let s=n.getUint32(8)>>>24;if(s!==0&&s!==1)return{offset:t,size:e};let o=n.buffer,a=ht(new Uint8Array(o,t+12,16)),l=null,c=null,u=0;if(s===0)u=28;else{let f=n.getUint32(28);if(!f||i<32+f*16)return{offset:t,size:e};l=[];for(let h=0;h<f;h++)l.push(new Uint8Array(o,t+32+h*16,16));u=32+f*16}if(!u)return{offset:t,size:e};let d=n.getUint32(u);return e-32<d?{offset:t,size:e}:(c=new Uint8Array(o,t+u+4,d),s===0&&(l=uP(c)),{version:s,systemId:a,kids:l,data:c,offset:t,size:e})}var ls=D_("userAgent"),fP=D_("vendor"),Wf,Yf,Jf;function D_(n){try{return navigator[n]||""}catch{}return""}function hP(){if(Jf===void 0){let n=ls.match(/Safari\/(\d+)/i);Jf=n?parseInt(n[1]):0}return Jf}function fo(){if(Wf===void 0){let n=ls.match(/Chrome\/(\d+)/i);Wf=n?parseInt(n[1]):0}return Wf}function mP(){if(Yf===void 0){let n=ls.match(/Firefox\/(\d+)/i);Yf=n?parseInt(n[1]):0}return Yf}function C_(){return/\(Windows.+Firefox\//i.test(ls)}function pP(){return fP.indexOf("Apple")>-1||/iPhone|iPad|iPod/.test(ls)}function gP(){return/Android/.test(ls)}var ss={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1},image:{mjpg:1}};function qm(n,e){let t=ss[e];return!!t&&!!t[n.slice(0,4)]}function xo(n,e,t=!0){return!n.split(",").some(i=>!Wm(i,e,t))}function Wm(n,e,t=!0){var i;let r=wr(t);return(i=r?.isTypeSupported(_o(n,e)))!=null?i:!1}function _o(n,e){return`${e}/mp4;codecs=${n}`}function WS(n){if(n){let e=n.substring(0,4);return ss.video[e]}return 2}function Gl(n){let e=C_();return n.split(",").reduce((t,i)=>{let s=e&&Do(i)?9:ss.video[i];return s?(s*2+t)/(t?3:2):(ss.audio[i]+t)/(t?2:1)},0)}var Xf={};function vP(n,e=!0){if(Xf[n])return Xf[n];let t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[n];for(let r=0;r<t.length;r++){var i;if(Wm(t[r],"audio",e))return Xf[n]=t[r],t[r];if(t[r]==="mp3"&&(i=wr(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return n}var yP=/flac|opus|mp4a\.40\.34/i;function Kl(n,e=!0){return n.replace(yP,t=>vP(t.toLowerCase(),e))}function bP(n,e){let t=[];if(n){let i=n.split(",");for(let r=0;r<i.length;r++)qm(i[r],"video")||t.push(i[r])}return e&&t.push(e),t.join(",")}function Nl(n,e){if(n&&(n.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(n)!==-1)&&(YS(n,"audio")||YS(n,"video")))return n;if(e){let t=e.split(",");if(t.length>1){if(n){for(let i=t.length;i--;)if(t[i].substring(0,4)===n.substring(0,4))return t[i]}return t[0]}}return e||n}function YS(n,e){return qm(n,e)&&Wm(n,e)}function SP(n){let e=n.split(",");for(let t=0;t<e.length;t++){let i=e[t].split(".");i.length>2&&i[0]==="avc1"&&(e[t]=`avc1.${parseInt(i[1]).toString(16)}${("000"+parseInt(i[2]).toString(16)).slice(-4)}`)}return e.join(",")}function xP(n){if(n.startsWith("av01.")){let e=n.split("."),t=["0","111","01","01","01","0"];for(let i=e.length;i>4&&i<10;i++)e[i]=t[i-4];return e.join(".")}return n}function JS(n){let e=wr(n)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function Th(n){return n.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}var _P={supported:!0,powerEfficient:!0,smooth:!0},EP={supported:!1,smooth:!1,powerEfficient:!1},O_={supported:!0,configurations:[],decodingInfoResults:[_P]};function N_(n,e){return{supported:!1,configurations:e,decodingInfoResults:[EP],error:n}}function IP(n,e,t,i,r,s){let o=n.videoCodec,a=n.audioCodec?n.audioGroups:null,l=s?.audioCodec,c=s?.channels,u=c?parseInt(c):l?1/0:2,d=null;if(a!=null&&a.length)try{a.length===1&&a[0]?d=e.groups[a[0]].channels:d=a.reduce((f,h)=>{if(h){let m=e.groups[h];if(!m)throw new Error(`Audio track group ${h} not found`);Object.keys(m.channels).forEach(p=>{f[p]=(f[p]||0)+m.channels[p]})}return f},{2:0})}catch{return!0}return o!==void 0&&(o.split(",").some(f=>Do(f))||n.width>1920&&n.height>1088||n.height>1920&&n.width>1088||n.frameRate>Math.max(i,30)||n.videoRange!=="SDR"&&n.videoRange!==t||n.bitrate>Math.max(r,8e6))||!!d&&W(u)&&Object.keys(d).some(f=>parseInt(f)>u)}function M_(n,e,t,i={}){let r=n.videoCodec;if(!r&&!n.audioCodec||!t)return Promise.resolve(O_);let s=[],o=TP(n),a=o.length,l=kP(n,e,a>0),c=l.length;for(let u=a||1*c||1;u--;){let d={type:"media-source"};if(a&&(d.video=o[u%a]),c){d.audio=l[u%c];let f=d.audio.bitrate;d.video&&f&&(d.video.bitrate-=f)}s.push(d)}if(r){let u=navigator.userAgent;if(r.split(",").some(d=>Do(d))&&C_())return Promise.resolve(N_(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${u})`),s))}return Promise.all(s.map(u=>{let d=$P(u);return i[d]||(i[d]=t.decodingInfo(u))})).then(u=>({supported:!u.some(d=>!d.supported),configurations:s,decodingInfoResults:u})).catch(u=>({supported:!1,configurations:s,decodingInfoResults:[],error:u}))}function TP(n){var e;let t=(e=n.videoCodec)==null?void 0:e.split(","),i=F_(n),r=n.width||640,s=n.height||480,o=n.frameRate||30,a=n.videoRange.toLowerCase();return t?t.map(l=>{let c={contentType:_o(xP(l),"video"),width:r,height:s,bitrate:i,framerate:o};return a!=="sdr"&&(c.transferFunction=a),c}):[]}function kP(n,e,t){var i;let r=(i=n.audioCodec)==null?void 0:i.split(","),s=F_(n);return r&&n.audioGroups?n.audioGroups.reduce((o,a)=>{var l;let c=a?(l=e.groups[a])==null?void 0:l.tracks:null;return c?c.reduce((u,d)=>{if(d.groupId===a){let f=parseFloat(d.channels||"");r.forEach(h=>{let m={contentType:_o(h,"audio"),bitrate:t?U_(h,s):s};f&&(m.channels=""+f),u.push(m)})}return u},o):o},[]):[]}function U_(n,e){if(e<=1)return 1;let t=128e3;return n==="ec-3"?t=768e3:n==="ac-3"&&(t=64e4),Math.min(e/2,t)}function F_(n){return Math.ceil(Math.max(n.bitrate*.9,n.averageBitrate)/1e3)*1e3||1}function $P(n){let e="",{audio:t,video:i}=n;if(i){let r=Th(i.contentType);e+=`${r}_r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${Math.ceil(i.bitrate/1e5)}`}if(t){let r=Th(t.contentType);e+=`${i?"_":""}${r}_c${t.channels}`}return e}function $r(n,e,t){let i=encodeURIComponent(e),r=`${i}=${encodeURIComponent(t)}`,s=!1,o=[];n.search.substring(1).split("&").forEach(a=>{a===i||a.startsWith(i+"=")?s||(o.push(r),s=!0):a&&o.push(a)}),s||o.push(r),n.search=o.join("&")}var kh=["NONE","TYPE-0","TYPE-1",null];function AP(n){return kh.indexOf(n)>-1}var Hl=["SDR","PQ","HLG"];function wP(n){return!!n&&Hl.indexOf(n)>-1}var Ml={No:"",Yes:"YES",v2:"v2"};function XS(n){let{canSkipUntil:e,canSkipDateRanges:t,age:i}=n,r=i<e/2;return e&&r?t?Ml.v2:Ml.Yes:Ml.No}var Zl=class{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}addDirectives(e){let t=new self.URL(e);return this.msn!==void 0&&$r(t,"_HLS_msn",this.msn.toString()),this.part!==void 0&&$r(t,"_HLS_part",this.part.toString()),this.skip&&$r(t,"_HLS_skip",this.skip),t.href}},li=class{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.imageCodec=void 0,this.iframes=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loadErrorTime=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,"imageCodec"in e&&(this.imageCodec=e.imageCodec),this.codecSet=[e.videoCodec,e.audioCodec].filter(i=>!!i).map(i=>i.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;let i=(t=e.supplemental)==null?void 0:t.videoCodec;i&&i!==e.videoCodec&&(this.codecSet+=`,${i.substring(0,4)}`)}"iframes"in e&&e.iframes?this.iframes=!0:(this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES))}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return QS(this._audioGroups,e)}hasSubtitleGroup(e){return QS(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let i=this._audioGroups;i||(i=this._audioGroups=[]),i.indexOf(t)===-1&&i.push(t)}else if(e==="text"){let i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),i.indexOf(t)===-1&&i.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}};function QS(n,e){return!e||!n?!1:n.indexOf(e)!==-1}function PP(){if(typeof matchMedia=="function"){let n=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(n.media!==e.media)return n.matches===!0}return!1}function RP(n,e){let t=!1,i=[];if(n&&(t=n!=="SDR",i=[n]),e){i=e.allowedVideoRanges||Hl.slice(0);let r=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:r&&PP(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}var LP=n=>{let e=new WeakSet;return(t,i)=>{if(n&&(i=n(t,i)),typeof i=="object"&&i!==null){if(e.has(i))return;e.add(i)}return i}},We=(n,e)=>JSON.stringify(n,LP(e));function DP(n,e,t,i,r){let s=Object.keys(n),o=i?.channels,a=i?.audioCodec,l=r?.videoCodec,c=o&&parseInt(o)===2,u=!1,d=!1,f=1/0,h=1/0,m=1/0,p=1/0,g=0,y=[],{preferHDR:b,allowedVideoRanges:S}=RP(e,r);for(let $=s.length;$--;){let P=n[s[$]];u||(u=P.channels[2]>0),f=Math.min(f,P.minHeight),h=Math.min(h,P.minFramerate),m=Math.min(m,P.minBitrate),S.filter(D=>P.videoRanges[D]>0).length>0&&(d=!0)}f=W(f)?f:0,h=W(h)?h:0;let x=Math.max(1080,f),_=Math.max(30,h);m=W(m)?m:t,t=Math.max(m,t),d||(e=void 0);let I=s.length>1;return{codecSet:s.reduce(($,P)=>{let k=n[P];if(P===$)return $;if(y=d?S.filter(D=>k.videoRanges[D]>0):[],I){if(k.minBitrate>t)return Vn(P,`min bitrate of ${k.minBitrate} > current estimate of ${t}`),$;if(!k.hasDefaultAudio)return Vn(P,"no renditions with default or auto-select sound found"),$;if(a&&P.indexOf(a.substring(0,4))%5!==0)return Vn(P,`audio codec preference "${a}" not found`),$;if(o&&!c){if(!k.channels[o])return Vn(P,`no renditions with ${o} channel sound found (channels options: ${Object.keys(k.channels)})`),$}else if((!a||c)&&u&&k.channels[2]===0)return Vn(P,"no renditions with stereo sound found"),$;if(k.minHeight>x)return Vn(P,`min resolution of ${k.minHeight} > maximum of ${x}`),$;if(k.minFramerate>_)return Vn(P,`min framerate of ${k.minFramerate} > maximum of ${_}`),$;if(!y.some(D=>k.videoRanges[D]>0))return Vn(P,`no variants with VIDEO-RANGE of ${We(y)} found`),$;if(l&&P.indexOf(l.substring(0,4))%5!==0)return Vn(P,`video codec preference "${l}" not found`),$;if(k.maxScore<g)return Vn(P,`max score of ${k.maxScore} < selected max of ${g}`),$}return $&&(Gl(P)>=Gl($)||k.fragmentError>n[$].fragmentError)?$:(p=k.minIndex,g=k.maxScore,P)},void 0),videoRanges:y,preferHDR:b,minFramerate:h,minBitrate:m,minIndex:p}}function Vn(n,e){Le.log(`[abr] start candidates with "${n}" ignored because ${e}`)}function z_(n){return n.reduce((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);let r=t.channels||"2";return i.channels[r]=(i.channels[r]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function CP(n,e,t,i){return n.slice(t,i+1).reduce((r,s,o)=>{if(!s.codecSet)return r;let a=s.audioGroups,l=r[s.codecSet];l||(r[s.codecSet]=l={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:o,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!a,fragmentError:0}),l.minBitrate=Math.min(l.minBitrate,s.bitrate);let c=Math.min(s.height,s.width);return l.minHeight=Math.min(l.minHeight,c),l.minFramerate=Math.min(l.minFramerate,s.frameRate),l.minIndex=Math.min(l.minIndex,o),l.maxScore=Math.max(l.maxScore,s.score),l.fragmentError+=s.fragmentError,l.videoRanges[s.videoRange]=(l.videoRanges[s.videoRange]||0)+1,a&&a.forEach(u=>{if(!u)return;let d=e.groups[u];d&&(l.hasDefaultAudio=l.hasDefaultAudio||e.hasDefaultAudio?d.hasDefault:d.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(d.channels).forEach(f=>{l.channels[f]=(l.channels[f]||0)+d.channels[f]}))}),r},{})}function ex(n){if(!n)return n;let{lang:e,assocLang:t,characteristics:i,channels:r,audioCodec:s}=n;return{lang:e,assocLang:t,characteristics:i,channels:r,audioCodec:s}}function Zn(n,e,t){if("attrs"in n){let i=e.indexOf(n);if(i!==-1)return i}for(let i=0;i<e.length;i++){let r=e[i];if(si(n,r,t))return i}return-1}function si(n,e,t){let{groupId:i,name:r,lang:s,assocLang:o,default:a}=n,l=n.forced;return(i===void 0||e.groupId===i)&&(r===void 0||e.name===r)&&(s===void 0||OP(s,e.lang))&&(o===void 0||e.assocLang===o)&&(a===void 0||e.default===a)&&(l===void 0||e.forced===l)&&(!("characteristics"in n)||NP(n.characteristics||"",e.characteristics))&&(t===void 0||t(n,e))}function OP(n,e="--"){return n.length===e.length?n===e:n.startsWith(e)||e.startsWith(n)}function NP(n,e=""){let t=n.split(","),i=e.split(",");return t.length===i.length&&!t.some(r=>i.indexOf(r)===-1)}function ii(n,e){let{audioCodec:t,channels:i}=n;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}function MP(n,e,t,i,r){let s=e[i],a=e.reduce((f,h,m)=>{let p=h.uri;return(f[p]||(f[p]=[])).push(m),f},{})[s.uri];a.length>1&&(i=Math.max.apply(Math,a));let l=s.videoRange,c=s.frameRate,u=s.codecSet.substring(0,4),d=tx(e,i,f=>{if(f.videoRange!==l||f.frameRate!==c||f.codecSet.substring(0,4)!==u)return!1;let h=f.audioGroups,m=t.filter(p=>Eo(p.groupId,h));return Zn(n,m,r)>-1});return d>-1?d:tx(e,i,f=>{let h=f.audioGroups,m=t.filter(p=>Eo(p.groupId,h));return Zn(n,m,r)>-1})}function tx(n,e,t){for(let i=e;i>-1;i--)if(t(n[i]))return i;for(let i=e+1;i<n.length;i++)if(t(n[i]))return i;return-1}function ql(n,e){var t;return!!n&&n!==((t=e.loadLevelObj)==null?void 0:t.uri)}function Eo(n,e){return e?e.indexOf(n)!==-1:!0}function B_(n,e){if(e||n){let t=Fe({},e);return n&&(n.videoCodec&&(t.videoCodec=n.videoCodec),n.videoRange&&(t.allowedVideoRanges=[n.videoRange])),t}}var $h=class extends jt{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.firstAutoFloor=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var i;let{fragCurrent:r,partCurrent:s,hls:o}=this;if(!o)return;let{autoLevelEnabled:a,media:l}=o;if(!r||!l)return;let c=performance.now(),u=s?s.stats:r.stats,d=s?s.duration:r.duration,f=c-u.loading.start,h=o.minAutoLevel,m=r.level,p=this._nextAutoLevel;if(u.aborted||u.loaded&&u.loaded===u.total||m<=h){this.clearTimer(),this._nextAutoLevel=-1;return}if(!a)return;let g=p>-1&&p!==m,y=!!t||g;if(!y&&(l.paused||!l.playbackRate||!l.readyState))return;let b=o.mainForwardBufferInfo;if(!y&&b===null)return;let S=this.bwEstimator.getEstimateTTFB(),x=Math.abs(l.playbackRate);if(f<=Math.max(S,1e3*(d/(x*2))))return;let _=b?b.len/x:0,I=u.loading.first?u.loading.first-u.loading.start:-1,T=u.loaded&&I>-1,$=this.getBwEstimate(),P=o.levels,k=P[m],D=Math.max(u.loaded,Math.round(d*(r.bitrate||k.averageBitrate)/8)),U=T?f-I:f;U<1&&T&&(U=Math.min(f,u.loaded*8/$));let V=T?u.loaded*1e3/U:0,X=S/1e3,q=V?(D-u.loaded)/V:D*8/$+X;if(q<=_)return;let z=V?V*8:$,B=((i=t?.details||o.latestLevelDetails)==null?void 0:i.live)===!0,j=o.config.abrBandWidthUpFactor,Z=Number.POSITIVE_INFINITY,ie;for(ie=m-1;ie>h;ie--){let le=P[ie].maxBitrate,_e=!P[ie].details||B;if(Z=this.getTimeToLoadFrag(X,z,d*le,_e),Z<Math.min(_,d+X))break}if(Z>=q||Z>d*10)return;T?this.bwEstimator.sample(f-Math.min(S,I),u.loaded):this.bwEstimator.sampleTTFB(f);let K=P[ie].maxBitrate;this.getBwEstimate()*j>K&&(this.firstAutoFloor=Math.min(ie,o.firstLevel),this.resetEstimator(K));let Y=this.findBestLevel(K,h,ie,0,_,1,1);Y>-1&&(ie=Y),this.warn(`Fragment ${r.sn}${s?" part "+s.index:""} of level ${m} is loading too slowly;
|
|
1983
1983
|
Fragment duration: ${r.duration.toFixed(3)}
|
|
1984
1984
|
Time to underbuffer: ${_.toFixed(3)} s
|
|
1985
1985
|
Estimated load time for current fragment: ${q.toFixed(3)} s
|
|
@@ -2060,7 +2060,7 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
2060
2060
|
- omitted: host decides border`)}),a3=E.object({method:E.literal("ui/request-display-mode"),params:E.object({mode:ul.describe("The display mode being requested.")})}),jF=E.object({mode:ul.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),VF=E.union([E.literal("model"),E.literal("app")]).describe("Tool visibility scope - who can access the tool."),l3=E.object({resourceUri:E.string().optional(),visibility:E.array(VF).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
2061
2061
|
- "model": Tool visible to and callable by the agent
|
|
2062
2062
|
- "app": Tool callable by the app from this server only`),csp:E.never().optional(),permissions:E.never().optional()}),c3=E.object({mimeTypes:E.array(E.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),u3=E.object({method:E.literal("ui/download-file"),params:E.object({contents:E.array(E.union([lS,cS])).describe("Resource contents to download \u2014 embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),d3=E.object({method:E.literal("ui/message"),params:E.object({role:E.literal("user").describe('Message role, currently only "user" is supported.'),content:E.array(Js).describe("Message content blocks (text, image, etc.).")})}),f3=E.object({method:E.literal("ui/notifications/sandbox-resource-ready"),params:E.object({html:E.string().describe("HTML content to load into the inner iframe."),sandbox:E.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:yS.optional().describe("CSP configuration from resource metadata."),permissions:bS.optional().describe("Sandbox permissions from resource metadata.")})}),GF=E.object({method:E.literal("ui/notifications/tool-result"),params:Xs.describe("Standard MCP tool execution result.")}),kA=E.object({toolInfo:E.object({id:qs.optional().describe("JSON-RPC id of the tools/call request."),tool:Af.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:AF.optional().describe("Current color theme preference."),styles:UF.optional().describe("Style configuration for theming the app."),displayMode:ul.optional().describe("How the UI is currently displayed."),availableDisplayModes:E.array(ul).optional().describe("Display modes the host supports."),containerDimensions:E.union([E.object({height:E.number().describe("Fixed container height in pixels.")}),E.object({maxHeight:E.union([E.number(),E.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(E.union([E.object({width:E.number().describe("Fixed container width in pixels.")}),E.object({maxWidth:E.union([E.number(),E.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
2063
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:E.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:E.string().optional().describe("User's timezone in IANA format."),userAgent:E.string().optional().describe("Host application identifier."),platform:E.union([E.literal("web"),E.literal("desktop"),E.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:E.object({touch:E.boolean().optional().describe("Whether the device supports touch input."),hover:E.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:E.object({top:E.number().describe("Top safe area inset in pixels."),right:E.number().describe("Right safe area inset in pixels."),bottom:E.number().describe("Bottom safe area inset in pixels."),left:E.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),KF=E.object({method:E.literal("ui/notifications/host-context-changed"),params:kA.describe("Partial context update containing only changed fields.")}),h3=E.object({method:E.literal("ui/update-model-context"),params:E.object({content:E.array(Js).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:E.record(E.string(),E.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),m3=E.object({method:E.literal("ui/initialize"),params:E.object({appInfo:rl.describe("App identification (name and version)."),appCapabilities:BF.describe("Features and capabilities this app provides."),protocolVersion:E.string().describe("Protocol version this app supports.")})}),HF=E.object({protocolVersion:E.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:rl.describe("Host application identification and version."),hostCapabilities:zF.describe("Features and capabilities provided by the host."),hostContext:kA.describe("Rich context about the host environment.")}).passthrough(),ZF={target:"draft-2020-12"};async function IA(n,e){let t=n["~standard"];if(t.jsonSchema)return t.jsonSchema[e](ZF);if(t.vendor==="zod"){let{z:i}=await Promise.resolve().then(()=>(Qa(),Wb));return i.toJSONSchema(n,{io:e})}throw Error(`Schema (vendor: ${t.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function TA(n,e,t=""){let i=await n["~standard"].validate(e);if(i.issues){let r=i.issues.map(s=>{let o=s.path?.map(a=>typeof a=="object"?a.key:a).join(".");return o?`${o}: ${s.message}`:s.message}).join("; ");throw Error(t+r)}return i.value}function $A(n){let e=document.documentElement;e.setAttribute("data-theme",n),e.style.colorScheme=n}function AA(n,e=document.documentElement){for(let[t,i]of Object.entries(n))i!==void 0&&e.style.setProperty(t,i)}var Pf=class n extends gS{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:CF,toolinputpartial:OF,toolresult:GF,toolcancelled:NF,hostcontextchanged:KF};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(e){if(!n.ONE_SHOT_EVENTS.has(e)||this._everHadListener.has(e)||(this._everHadListener.add(e),!this._initializedSent))return;let t=`[ext-apps] "${String(e)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(t);console.warn(t)}setEventHandler(e,t){t&&this._assertHandlerTiming(e),super.setEventHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),super.addEventListener(e,t)}onEventDispatch(e,t){e==="hostcontextchanged"&&(this._hostContext={...this._hostContext,...t})}constructor(e,t={},i={autoResize:!0}){super(i),this._appInfo=e,this._capabilities=t,this.options=i,i.allowUnsafeEval||E.config({jitless:!0}),this.setRequestHandler(Ws,r=>(console.log("Received ping:",r.params),{})),this.setEventHandler("hostcontextchanged",void 0)}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._capabilities=_A(this._capabilities,e)}registerTool(e,t,i){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,s=()=>{r._initializedSent&&r._capabilities.tools?.listChanged&&r.sendToolListChanged()},o=t.inputSchema!==void 0,a={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,s()},disable(){this.enabled=!1,s()},update(l){Object.assign(this,l),s()},remove(){r._registeredTools[e]===a&&(delete r._registeredTools[e],s())},handler:async(l,c)=>{if(!a.enabled)throw Error(`Tool ${e} is disabled`);let u;if(o){let d=a.inputSchema,f=d?await TA(d,l??{},`Invalid input for tool ${e}: `):l??{};u=await i(f,c)}else u=await i(c);return a.outputSchema&&!u.isError&&(u.structuredContent=await TA(a.outputSchema,u.structuredContent,`Invalid output for tool ${e}: `)),u}};return this._registeredTools[e]=a,!this._capabilities.tools&&!this.transport&&this.registerCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),s(),a}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let i=this._registeredTools[e.name];if(!i)throw Error(`Tool ${e.name} not found`);return i.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([i,r])=>r.enabled).map(async([i,r])=>{let s={name:i,title:r.title,description:r.description,inputSchema:r.inputSchema?await IA(r.inputSchema,"input"):{type:"object",properties:{}}};return r.outputSchema&&(s.outputSchema=await IA(r.outputSchema,"output")),r.annotations&&(s.annotations=r.annotations),r._meta&&(s._meta=r._meta),s}))}))}async sendToolListChanged(e={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(e){this.setEventHandler("toolinput",e)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(e){this.setEventHandler("toolinputpartial",e)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(e){this.setEventHandler("toolresult",e)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(e){this.setEventHandler("toolcancelled",e)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(e){this.setEventHandler("hostcontextchanged",e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,e),this._onteardown=e,this.replaceRequestHandler(FF,(t,i)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(t.params,i)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(dS,(t,i)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(t.params,i)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler(uS,(t,i)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(t.params,i)})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${e} registered`)}}assertNotificationCapability(e){}assertTaskCapability(e){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(e){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(e,t){if(this._assertInitialized("callServerTool"),typeof e=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:e},Xs,{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:e},iS,t)}async listServerResources(e,t){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:e},nS,t)}async createSamplingMessage(e,t){this._assertInitialized("createSamplingMessage");let i=e.tools?hS:fS;return await this.request({method:"sampling/createMessage",params:e},i,t)}sendMessage(e,t){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:e},DF,t)}sendLog(e){return this.notification({method:"notifications/message",params:e})}updateModelContext(e,t){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:e},yf,t)}openLink(e,t){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:e},RF,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:e},LF,t)}requestTeardown(e={}){return this.notification({method:"ui/notifications/request-teardown",params:e})}requestDisplayMode(e,t){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:e},jF,t)}sendSizeChanged(e){return this.notification({method:"ui/notifications/size-changed",params:e})}setupSizeChangedNotifications(){let e=!1,t=0,i=0,r=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;let o=document.documentElement,a=o.style.height;o.style.height="max-content";let l=Math.ceil(o.getBoundingClientRect().height);o.style.height=a;let c=Math.ceil(window.innerWidth);(c!==t||l!==i)&&(t=c,i=l,this.sendSizeChanged({width:c,height:l}))}))};r();let s=new ResizeObserver(r);return s.observe(document.documentElement),s.observe(document.body),()=>s.disconnect()}async connect(e=new vS(window.parent,window.parent),t){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1,await super.connect(e);try{let i=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:kF}},HF,t);if(i===void 0)throw Error(`Server sent invalid initialize result: ${i}`);this._hostCapabilities=i.hostCapabilities,this._hostInfo=i.hostInfo,this._hostContext=i.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(i){throw this.close(),i}}};function wA(n,e,t){let i,r=!1,s=()=>{r||i!==void 0||(i=requestAnimationFrame(()=>{i=void 0,!(r||!e())&&t(n.hidden?1:Math.max(1,Math.ceil(n.getBoundingClientRect().height)))}))},o=new ResizeObserver(s);return o.observe(n),s(),{refresh:s,dispose(){r=!0,o.disconnect(),i!==void 0&&cancelAnimationFrame(i)}}}var PA={name:"@kyun.si/codex-hongguo",version:"0.0.21",private:!0,license:"MIT",type:"module",engines:{node:">=22.16"},scripts:{"version:patch":"npm version patch --no-git-tag-version",preversion:"node scripts/version.mjs --next",version:"node scripts/version.mjs --sync",prebuild:"node scripts/version.mjs",build:"node scripts/build.mjs",test:"npm run build && node --test test/*.test.mjs",package:"npm run build && node scripts/package.mjs","verify:install":"node scripts/verify-install.mjs","release:publish":"node scripts/publish.mjs"},dependencies:{"@modelcontextprotocol/ext-apps":"1.7.5","@modelcontextprotocol/sdk":"1.32.2","cross-spawn":"7.0.6","hls.js":"1.7.4","m3u8-parser":"7.2.1","mpd-parser":"1.4.1",openhongguo:"0.2.0",zod:"4.6.7"},devDependencies:{"@types/node":"22.20.5",esbuild:"0.28.2",fflate:"0.8.3",typescript:"5.9.3"}};var zn=document.documentElement.dataset.host==="browser",LA=document.documentElement.dataset.surface==="waiting",xS="",Jn=zn?null:new Pf({name:"\u7EA2\u679C\u77ED\u5267",version:PA.version},{},{autoResize:!LA}),SS,DA=()=>Jn?.getHostContext()?.locale||navigator.language,Rf=()=>Jn?.getHostContext()?.displayMode;async function CA(){if((await Jn?.requestDisplayMode({mode:"fullscreen"},{timeout:5e3}))?.mode!=="fullscreen")throw Error("\u5F53\u524D Codex \u65E0\u6CD5\u5728\u4F1A\u8BDD\u4E2D\u6253\u5F00\u64AD\u653E\u5668")}function RA(n){n&&(n.theme&&$A(n.theme),n.styles?.variables&&AA(n.styles.variables))}async function OA(n,e,t){if(zn){let i=await fetch("context",{signal:AbortSignal.timeout(4e3)});if(!i.ok)throw Error("\u5206\u5C4F\u5DF2\u5931\u6548\uFF0C\u8BF7\u4ECE\u9762\u677F\u91CD\u65B0\u6253\u5F00");n(await i.json());return}Jn.ontoolresult=i=>{if(typeof i._meta?.panel!="string")return;xS=i._meta.panel;let r=typeof i._meta.waitingTurn=="string"?i._meta.waitingTurn:void 0;n({identified:!!i.structuredContent?.identified||!!r,waitingTurn:r})},Jn.onteardown=async()=>(SS?.dispose(),await e(),{}),Jn.onhostcontextchanged=i=>{RA(i),i.displayMode!==void 0&&(t(),SS?.refresh())},await Jn.connect(),RA(Jn.getHostContext()),LA&&(SS=wA(document.getElementById("waitingCard"),()=>(Rf()||"inline")==="inline",i=>{Jn.sendSizeChanged({height:i}).catch(()=>{})})),t()}async function Ie(n,e={},t=15e3){if(zn){let r=await fetch("api/"+n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),keepalive:n==="save_progress",signal:AbortSignal.timeout(t)}),s=await r.json();if(!r.ok)throw Error(s.error||"\u5206\u5C4F\u8FDE\u63A5\u5DF2\u4E2D\u65AD");return s}if(!xS)throw Error("\u7B49\u5F85\u4F1A\u8BDD\u9762\u677F\u8FDE\u63A5");let i=await Jn.callServerTool({name:n,arguments:{...e,panel:xS}},{timeout:t});if(i.isError)throw Error(i.content?.[0]?.type==="text"?i.content[0].text:"\u672C\u673A\u670D\u52A1\u4E0D\u53EF\u8FBE");return i._meta?.data}var _S="https://hongguo.invalid/";function NA(n,e,t,i,r,s){if(!sr.isSupported())throw Error("\u5F53\u524D\u9762\u677F\u4E0D\u652F\u6301\u5206\u6BB5\u89E3\u7801\uFF0C\u53EF\u4F7F\u7528\u540C\u7A97\u5206\u5C4F");class o{context=null;stats=new ai;abort(){this.stats.aborted=!0}destroy(){this.abort()}load(d,f,h){this.context=d,this.stats.loading.start=performance.now(),(async()=>{let p=d.url.slice(_S.length);if(!d.url.startsWith(_S))throw Error("\u65E0\u6548\u5A92\u4F53\u6765\u6E90");if(p==="index.m3u8")return i;let g=0,y;do{let b=await Ie("read_panel_chunk",{episodeId:e,stream:t,asset:p,offset:g},8e3);if(this.stats.aborted)return;if(!Number.isSafeInteger(b.size)||b.size<1||b.size>32*1024*1024)throw Error("\u5206\u6BB5\u957F\u5EA6\u65E0\u6548");y??=new Uint8Array(b.size);let S=atob(b.bytes);if(b.size!==y.length||!S.length||g+S.length>b.size)throw Error("\u5206\u6BB5\u4E0D\u5B8C\u6574");for(let x=0;x<S.length;x++)y[g+x]=S.charCodeAt(x);g+=S.length}while(g<y.length);return y.buffer})().then(p=>{this.stats.aborted||p===void 0||(this.stats.loading.first=this.stats.loading.end=performance.now(),this.stats.loaded=this.stats.total=typeof p=="string"?p.length:p.byteLength,h.onSuccess({url:d.url,data:p},this.stats,d,null))}).catch(()=>{this.stats.aborted||h.onError({code:0,text:"\u4FA7\u680F\u5206\u6BB5\u8BFB\u53D6\u5931\u8D25"},d,null,this.stats)})}}let a=new sr({loader:o,enableWorker:!1,maxBufferLength:16,maxMaxBufferLength:24,backBufferLength:12});a.on(sr.Events.MEDIA_ENDED,s),a.on(sr.Events.ERROR,(u,d)=>{d.fatal&&(d.type===sr.ErrorTypes.NETWORK_ERROR?r("\u4FA7\u680F\u5206\u6BB5\u8BFB\u53D6\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u70B9\u64AD"):r("\u4FA7\u680F\u65E0\u6CD5\u5904\u7406\u89C6\u9891\u5206\u6BB5\uFF0C\u53EF\u4F7F\u7528\u540C\u7A97\u5206\u5C4F"))});let l=u=>{u.disposition==="enforce"&&u.effectiveDirective==="media-src"&&(u.blockedURI==="blob"||u.blockedURI.startsWith("blob:"))&&r("\u684C\u9762\u5B89\u5168\u7B56\u7565\u963B\u6B62\u4E86\u4FA7\u680F\u8F7D\u5165\u672C\u5730\u89C6\u9891")},c=()=>{document.removeEventListener("securitypolicyviolation",l),a.destroy()};document.addEventListener("securitypolicyviolation",l);try{a.loadSource(_S+"index.m3u8"),a.attachMedia(n)}catch(u){throw c(),u}return c}function ES(n){switch(n){case 1:return"\u89C6\u9891\u52A0\u8F7D\u5DF2\u4E2D\u6B62\uFF0C\u53EF\u4EE5\u91CD\u65B0\u70B9\u64AD";case 2:return"\u8BFB\u53D6\u89C6\u9891\u6570\u636E\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u70B9\u64AD";case 3:return"\u64AD\u653E\u5668\u89E3\u7801\u89C6\u9891\u6570\u636E\u5931\u8D25\uFF0C\u53EF\u4F7F\u7528\u540C\u7A97\u5206\u5C4F";case 4:return"\u64AD\u653E\u5668\u65E0\u6CD5\u6253\u5F00\u89C6\u9891\u6765\u6E90\uFF0C\u53EF\u91CD\u65B0\u70B9\u64AD\u6216\u4F7F\u7528\u540C\u7A97\u5206\u5C4F";default:return"\u89C6\u9891\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u70B9\u64AD"}}function MA(n,e){return new Promise((t,i)=>{let r=()=>l(),s=()=>l(Error(ES(n.error?.code))),o=()=>l(e.reason),a=setTimeout(()=>l(Error("\u7B49\u5F85\u89C6\u9891\u5143\u6570\u636E\u8D85\u65F6\uFF0C\u8BF7\u91CD\u65B0\u70B9\u64AD")),3e4);function l(c){clearTimeout(a),n.removeEventListener("loadedmetadata",r),n.removeEventListener("error",s),e.removeEventListener("abort",o),c!==void 0?i(c):t()}n.addEventListener("loadedmetadata",r),n.addEventListener("error",s),e.addEventListener("abort",o),e.aborted&&o()})}function UA(n,e){return!!n&&!!e.turnId&&e.state==="submitted"&&n.turnId!==e.turnId}function FA(n,e){return!n||!e.turnId||e.state!=="stopped"&&e.state!=="interrupted"||n.turnId===e.turnId&&n.state!=="submitted"?null:e.state==="interrupted"?"\u672C\u8F6E\u5DF2\u4E2D\u65AD\uFF0C\u5DF2\u4E3A\u4F60\u6682\u505C":"\u672C\u8F6E\u5DF2\u505C\u6B62\uFF0C\u5DF2\u4E3A\u4F60\u6682\u505C"}var yt=n=>document.getElementById(n),dl=0;function WF(n){let e=n.hooks.status==="ready",t=n.hooks.events.some(s=>s.status==="needs_review");yt("setupTitle").textContent=Ce(t?"\u8BF7\u5BA1\u67E5\u7EA2\u679C\u7684\u56DE\u5408 Hooks":"\u5F00\u59CB\u4F7F\u7528\u7EA2\u679C");let i=[["Node",n.runtime,!0],["\u8FDB\u5EA6\u5E93",n.database?"\u53EF\u5199":"\u4E0D\u53EF\u7528",n.database],["FFmpeg",n.ffmpeg?"\u5C31\u7EEA":"\u7F3A\u5931",n.ffmpeg],["\u56DE\u5408\u8054\u52A8",e?"\u5DF2\u914D\u7F6E":n.hooks.status==="unknown"?"\u5F85\u786E\u8BA4":"\u5F85\u914D\u7F6E",e]];yt("setupRows").replaceChildren(...i.map(([s,o,a])=>{let l=document.createElement("div"),c=document.createElement("span"),u=document.createElement("span");return l.className="healthRow "+(a?"ok":"bad"),c.textContent=Ce(s),u.textContent=Ce(o),l.append(tr(a?"check":"alert"),c,u),l}));let r=n.database?n.ffmpeg?e?"\u56DE\u5408\u8054\u52A8\u5DF2\u5C31\u7EEA\u3002\u53EF\u5728\u8BBE\u7F6E\u4E2D\u914D\u7F6E\u4EFB\u52A1\u5F00\u59CB\u81EA\u52A8\u64AD\u653E\u548C\u4EFB\u52A1\u7ED3\u675F\u81EA\u52A8\u6682\u505C\u3002":n.hooks.status==="unknown"?"\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6 Hooks \u72B6\u6001\uFF0C\u8BF7\u5728\u5BBF\u4E3B\u8BBE\u7F6E\u4E2D\u6838\u5BF9\u3002\u73B0\u5728\u53EF\u4EE5\u5148\u624B\u52A8\u89C2\u770B\u3002":n.hooks.events.some(s=>s.status==="missing")?"\u5C1A\u672A\u53D1\u73B0\u5B8C\u6574\u7684\u56DE\u5408\u4E8B\u4EF6\u3002\u8BF7\u68C0\u67E5\u63D2\u4EF6\u5DF2\u542F\u7528\uFF0C\u5E76\u5728\u65B0\u7684\u672C\u5730\u5BF9\u8BDD\u4E2D\u91CD\u8BD5\u3002":"\u56DE\u5408\u8054\u52A8\u5C1A\u672A\u914D\u7F6E\u3002\u5B8C\u6210\u4E0B\u65B9\u64CD\u4F5C\u540E\u91CD\u65B0\u68C0\u67E5\uFF0C\u4E5F\u53EF\u4EE5\u5148\u624B\u52A8\u89C2\u770B\u3002":"\u5C1A\u672A\u627E\u5230 FFmpeg\u3002\u5B89\u88C5\u540E\u91CD\u542F Codex\uFF0C\u518D\u4ECE\u300C\u8BBE\u7F6E \u2192 \u4F7F\u7528\u6307\u5357\u300D\u91CD\u65B0\u68C0\u67E5\u3002":"\u8FDB\u5EA6\u6682\u65F6\u65E0\u6CD5\u4FDD\u5B58\uFF0C\u8BF7\u68C0\u67E5\u7EA2\u679C\u7684\u6570\u636E\u76EE\u5F55\u6743\u9650\u3002";yt("setupHelp").textContent=Ce(r),yt("setupGuide").querySelector(".setupHooks").hidden=e}async function Lf(n=!0){if(zn)return;let e=++dl,t=yt("setupCheck");t.disabled=!0,n&&(yt("setupGuide").hidden=!1,yt("setupRows").replaceChildren(),yt("setupHelp").textContent=Ce("\u6B63\u5728\u68C0\u67E5\u2026"));try{let i=await Ie("get_setup_status");if(e!==dl)return;WF(i);let r=!i.database||!i.ffmpeg||i.hooks.status==="needs_attention";yt("setupGuide").hidden=!(n||r)}catch{if(e!==dl)return;yt("setupGuide").hidden=!n,yt("setupRows").replaceChildren(),yt("setupHelp").textContent=Ce("\u68C0\u67E5\u672A\u5B8C\u6210\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u6216\u5728 Codex \u8BBE\u7F6E \u2192 Hooks \u6838\u5BF9\u56DE\u5408\u8054\u52A8\u3002"),yt("setupGuide").querySelector(".setupHooks").hidden=!1}finally{e===dl&&(t.disabled=!1)}}function zA(n){yt("setupOpen").hidden=zn,yt("setupCheck").onclick=()=>{Lf()},yt("setupDone").onclick=async()=>{++dl;let e=yt("setupDone");e.disabled=!0;try{await Ie("set_setup_dismissed",{dismissed:!0})}catch{n("\u672C\u6B21\u5DF2\u6536\u8D77\u6307\u5357\uFF0C\u6682\u65F6\u65E0\u6CD5\u4FDD\u5B58\u6B64\u8BBE\u7F6E\u3002")}finally{yt("setupGuide").hidden=!0,e.disabled=!1,yt("setupCheck").disabled=!1}},Lf(!1)}function TS(n){return n.episodeId?Ce(n.kind==="next"?"\u770B\u4E0B\u4E00\u96C6":"\u7EE7\u7EED\u89C2\u770B")+" \xB7 "+n.title:n.title}function IS(n,e){return e.aborted?Promise.resolve(!1):new Promise(t=>{let i=new IntersectionObserver(a=>{let l=a[a.length-1];!document.hidden&&l.isIntersecting&&l.intersectionRect.width>0&&l.intersectionRect.height>0&&r(!0)},{threshold:[0,.01]}),r=a=>{i.disconnect(),document.removeEventListener("visibilitychange",o),e.removeEventListener("abort",s),t(a)},s=()=>r(!1),o=()=>{document.hidden||(i.unobserve(n),i.observe(n))};e.addEventListener("abort",s),document.addEventListener("visibilitychange",o),i.observe(n)})}async function kS(n,e,t,i,r,s=!1){let o=i?{turnId:i}:{};if(e.replaceChildren(),n.hidden=!1,!await IS(n,t))return;let{items:a}=await Ie("get_waiting_picks",{...o,inView:!0},9e4);if(!t.aborted){if(!a.length){s?r([]):n.hidden=!0;return}if(r(a),!!await IS(e,t))try{await Ie("mark_waiting_picks_shown",o)}catch{await IS(e,t)&&await Ie("mark_waiting_picks_shown",o).catch(()=>{})}}}function BA(n,e){let t=document.getElementById("waitingCard"),i=document.getElementById("waitingTitles"),r=document.getElementById("waitingMessage"),s=document.getElementById("waitingDismiss"),o=!1,a=!1,l=!1,c=!1,u=!0,d=!1,f=0,h,m,p,g;function y(){++f,m?.abort(),m=void 0,t.hidden=!0,i.replaceChildren(),r.textContent=""}s.onclick=()=>{c=!0,y(),Ie("dismiss_waiting_picks").catch(()=>{})};function b($){!o||c||!u||a||(r.textContent=Ce($ instanceof Error?$.message:"\u5F53\u524D Codex \u65E0\u6CD5\u5728\u4F1A\u8BDD\u4E2D\u6253\u5F00\u64AD\u653E\u5668"),t.hidden=!1)}async function S($=!1){if(!o)return;let P=Rf()||"inline";if(!$&&P===h)return;h=P;let k=++f;m?.abort();let D=m=new AbortController;if(P==="fullscreen"){if(a)return;let V=await(p??=Ie("activate_waiting_player"));if(k!==f)return;a=!0,t.hidden=!0,document.documentElement.dataset.surface="player",n(V);return}else p=void 0,a&&(a=!1,e(),document.documentElement.dataset.surface="waiting");if(c){y();return}let U=await Ie("get_waiting_status");if(k===f){if(u=U.visible,!u){y();return}r.textContent="",await kS(t,i,D.signal,void 0,V=>{let X=V.map(z=>{let B=document.createElement("button");return B.type="button",B.textContent=TS(z),B.onclick=()=>{x(z)},B}),q=document.createElement("button");q.type="button",q.textContent=Ce("\u66F4\u591A\u2026"),q.onclick=()=>{x()},i.replaceChildren(...X,q)},!0).catch(V=>{D.signal.aborted||b(V)})}}async function x($){if(!l){l=!0,r.textContent="";try{$?await Ie("select_waiting_pick",{seriesId:$.id}):await Ie("browse_waiting_catalog"),Rf()==="fullscreen"?await S(!0):(await CA(),t.hidden=!0)}catch(P){b(P),P instanceof Error&&P.message==="\u8FD9\u6761\u63A8\u8350\u5DF2\u7ED3\u675F"&&y()}finally{l=!1}}}async function _(){if(!(!o||a||l||c||document.hidden||d)){d=!0;try{let $=await Ie("get_waiting_status");if(!o||a||l||c)return;$.visible!==u&&(u=$.visible,u?await S(!0):y())}catch{!a&&!l&&(u=!1,y())}finally{d=!1}}}let I=()=>{S().catch(b)},T=()=>{!document.hidden&&o&&!a&&!c&&S(!0).catch(b)};return{connected(){o||(o=!0,g=setInterval(()=>{_()},1e3),document.addEventListener("visibilitychange",T),I())},modeChanged:I,dispose(){o=!1,clearInterval(g),document.removeEventListener("visibilitychange",T),y()}}}var F=n=>document.getElementById(n),ee=document.querySelector("video"),Wr=F("seek"),AS=F("play"),Cf=F("center"),Hi=F("autonext"),Bn=(n,e)=>{F(n).textContent=n==="title"?e:Ce(e)},Ye=n=>Bn("notice",n),$t=n=>n instanceof Error?n.message:"\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5",to=n=>Math.floor(n/60)+":"+String(Math.floor(n%60)).padStart(2,"0"),YF=n=>new Promise(e=>setTimeout(e,n));function An(n,e){let t=document.createElement("button");return t.textContent=Ce(n),t.onclick=()=>{Promise.resolve(e()).catch(i=>Ye($t(i)))},t}var gr={identified:!1},qt=null,ct=null,nt=null,qe=[],kt,pl="",kn,bt=[],$n=!1,lt=0,Xn=0,Gi=0,Qn=!1,Ot=!1,$S,wS=0,qr=Promise.resolve(),Wt={autoPrompt:!0,autoplayNext:!0,autoPauseOnFinish:!0,autoPlayOnStart:!0,searchTerms:["\u603B\u88C1","\u91CD\u751F","\u9006\u88AD"]},dn="idle",Yr,PS,fl,eo=0,hl=0,vr=[],Of=null,KA=document.documentElement.dataset.surface==="waiting",HA=Array.from(crypto.getRandomValues(new Uint32Array(4)),n=>n.toString(16).padStart(8,"0")).join(""),ml=!1,ZA,jA=null,VA,RS;function Mf(){let n=RS;RS=void 0,n&&Ie("confirm_waiting_playback",{playbackId:n},1800).catch(()=>{})}function Zi(){AS.disabled=Cf.disabled=!nt?.playable,F("pair").disabled=!nt;let n=Ce(Qn?"\u53D6\u6D88\u51C6\u5907":ee.paused?"\u64AD\u653E":"\u6682\u505C"),e=Qn?"x":ee.paused?"play":"pause";io(AS,e,n),io(Cf,e,n),F("stage").classList.toggle("playing",!ee.paused),F("stage").classList.toggle("busy",Qn),F("prev").disabled=!nt||!qe.slice(0,qe.indexOf(nt)).some(t=>t.playable),F("next").disabled=!nt||!kt&&!qe.slice(qe.indexOf(nt)+1).some(t=>t.playable),Cf.hidden=Qn,document.querySelectorAll("#episodes button").forEach(t=>t.setAttribute("aria-pressed",String(t.dataset.id===nt?.id)))}function Wi(n=!1){if(!$n||!ct||!nt||!Number.isFinite(ee.duration)||!ee.duration||!ee.currentTime&&!n)return qr;let e={seriesId:ct.id,episodeId:nt.id,title:ct.title,label:nt.label,positionMs:Math.round((dn==="finished"||ee.ended?ee.duration:ee.currentTime)*1e3),durationMs:Math.round(ee.duration*1e3)};return qr=qr.then(()=>Ie("save_progress",{...e,...n&&e.positionMs===0?{reset:!0}:{}},1800)).then(()=>{}).catch(()=>Ye("\u89C2\u770B\u8FDB\u5EA6\u6682\u672A\u5199\u5165\uFF0C\u8BF7\u68C0\u67E5\u672C\u673A\u670D\u52A1")),qr}function un(n=""){n==="\u5DF2\u624B\u52A8\u6682\u505C"&&Mf(),lt++,Yr=void 0,Qn=!1,dn!=="finished"&&(dn="idle"),ee.pause(),Zi();let e=!!ct&&/本轮已停止|本轮已中断/.test(n);return n&&Ye(e?"":n),F("stopped").hidden=!e,e&&Bn("whyStopped",n),Wi()}function Jr(){$n=!1,dn="idle",fl?.abort(),fl=void 0,F("stopped").hidden=!0,F("resumed").hidden=!0,PS?.(),PS=void 0,ee.removeAttribute("src"),ee.load()}function qA(n){un(),Jr(),F("link").hidden=!0,F("linkValue").value="",nt=n,eo=Math.floor(Math.max(0,qe.indexOf(n))/50),Ye("");let e="\u7B2C "+n.number+" \u96C6",t=n.label.replace(/\s/g,"")!=="\u7B2C"+n.number+"\u96C6";Bn("subtitle",[e,t?n.label:"",n.codec].filter(Boolean).join(" \xB7 ")),Bn("time","0:00"),Wr.value="0",Yi(Wr),Zi(),n.playable||Ye("\u8BE5\u96C6\u5F53\u524D\u4E0D\u53EF\u64AD\u653E\uFF0C\u8BF7\u68C0\u67E5\u7247\u6E90\u8BB8\u53EF\u6216 FFmpeg \u81EA\u68C0\u7ED3\u679C")}function gl(){let n=Math.ceil(qe.length/50);F("groups").replaceChildren(...Array.from({length:n>1?n:0},(e,t)=>{let i=An(qe[t*50].number+"\u2013"+qe[Math.min(qe.length,(t+1)*50)-1].number,()=>{eo=t,gl()});return i.setAttribute("aria-pressed",String(t===eo)),i})),F("episodes").replaceChildren(...qe.slice(eo*50,(eo+1)*50).map(e=>{let t=An(String(e.number),()=>Uf(e));return t.disabled=!e.playable,t.title=e.label,t.dataset.id=e.id,t})),F("moreEpisodes").hidden=!kt,F("episodeCount").textContent=qe.length?Ce(qe.length+(kt?"+":"")+" \u96C6"):"",Zi()}async function no(n,e,t=!1,i){let r=i&&e;F("home").hidden=!0,F("watch").hidden=!1,F("back").focus({preventScroll:!0}),window.scrollTo(0,0),eo=0;let s=++Xn;un();let o=lt;Jr(),nt=null,qe=[],kt=void 0,ct=n,qi(),ee.poster=n.cover||"",Bn("title",n.title),Bn("subtitle","\u6B63\u5728\u8BFB\u53D6\u5206\u96C6\u2026"),gl(),JA(),await qr;let[a,l]=await Promise.all([Ie("get_episodes",{seriesId:n.id}),Ie("get_history",{seriesId:n.id})]);e??=l.items[0]?.episodeId;let c=a;if(s!==Xn)return;qe=c.items||[],kt=c.cursor;let u=new Set;for(;e&&!qe.some(h=>h.id===e)&&kt&&!u.has(kt);){if(u.add(kt),c=await Ie("get_episodes",{seriesId:n.id,cursor:kt}),s!==Xn)return;qe.push(...c.items),kt=c.cursor}let d=e&&qe.find(h=>h.id===e&&(!t||h.playable))||!r&&(t&&qe.find(h=>h.playable)||qe[0]),f=t&<===o&&Ot;d?qA(d):Bn("subtitle","\u6682\u65E0\u53EF\u7528\u5206\u96C6"),gl(),f&&d&&s===Xn&&await vl(i)}async function Uf(n){qA(n),gl(),await vl()}async function WA(){if(!ct||!kt)return;let n=Xn,e=kt;try{let t=await Ie("get_episodes",{seriesId:ct.id,cursor:e});if(n!==Xn||e!==kt)return;qe.push(...t.items),kt=t.cursor===e?void 0:t.cursor,gl()}catch(t){Ye($t(t))}}F("moreEpisodes").onclick=WA;async function YA(n=!1){if(!nt)return;let e=nt.id,t=Xn,i=lt,r=qe.slice(qe.indexOf(nt)+1).find(o=>o.playable),s=new Set;for(;!r&&kt&&!s.has(kt);){if(s.add(kt),await WA(),Xn!==t||nt?.id!==e||lt!==i)return;r=qe.slice(qe.indexOf(nt)+1).find(o=>o.playable)}!Ot||n&&!Hi.checked||(r?await Uf(r):n&&un("\u672C\u96C6\u5DF2\u64AD\u5B8C"))}F("prev").onclick=()=>{let n=qe.slice(0,qe.indexOf(nt)).reverse().find(e=>e.playable);n&&Uf(n)};F("next").onclick=()=>{YA()};F("random").onclick=()=>{let n=qe.filter(r=>r.playable),e=vr.find(r=>r.seriesId===ct?.id),t=e?n.findIndex(r=>r.id===e.episodeId):-1,i=t<0?n.slice(0,1):n.slice(Math.min(t+1,n.length-1));i.length&&Uf(i[Math.floor(Math.random()*i.length)])};async function JF(){Mf(),document.fullscreenElement&&await document.exitFullscreen(),F("stage").classList.remove("expanded"),Nf(),Ye(""),++Xn;let n=un();Jr(),nt=null,ct=null,qe=[],kt=void 0,F("home").hidden=!1,F("watch").hidden=!0,F("link").hidden=!0,bt.length?Ki():Xr(),await n,await Ff(),!ct&&bt.length&&Ki()}F("back").onclick=()=>{JF().catch(n=>Ye($t(n)))};function JA(){document.querySelectorAll(".card").forEach(n=>n.setAttribute("aria-pressed",String(n.dataset.id===ct?.id)))}function Ki(){let n=[],e=new Set(vr.map(o=>o.seriesId)),t=pl?void 0:bt.find(o=>!e.has(o.id))||bt[0],i=bt.filter(o=>o!==t),r=ew();if(r&&n.push(r),F("featured").replaceChildren(),t){let o=An("",()=>no(t,void 0,!0)),a=bl(t.title,t.episodes?Ce(t.episodes+" \u96C6"):""),l=document.createElement("span"),c=document.createElement("small"),u=document.createElement("strong"),d=document.createElement("span");if(o.className="feature",o.dataset.id=t.id,o.setAttribute("aria-label",Ce("\u64AD\u653E")+" \xB7 "+t.title),l.className="featureText",c.className="eyebrow",c.textContent=Ce(e.has(t.id)?"\u770B\u8FC7":"\u63A8\u8350"),u.textContent=t.title,l.append(c,u),t.description){let f=document.createElement("span");f.className="desc",f.textContent=t.description,l.append(f)}d.className="playPill",d.append(tr("play"),Ce("\u64AD\u653E")),l.append(d),o.append(a,l),F("featured").append(o),n.push({span:a,s:t})}qi(),F("cards").replaceChildren(...i.slice(hl*12,(hl+1)*12).map(o=>{let a=An("",()=>no(o,void 0,!0));a.className="card",a.dataset.id=o.id,a.title=o.title;let l=bl(o.title,o.episodes?Ce(o.episodes+" \u96C6"):""),c=document.createElement("span");return c.className="cardTitle",c.textContent=o.title,a.append(l,c),n.push({span:l,s:o}),a})),JA();let s=Gi;(async()=>{for(let{span:o,s:a}of n){if(s!==Gi)return;if(!a.cover&&(a.hasCover||a.lookupCover))try{a.cover=(await Ie("get_cover",{seriesId:a.id},9e3)).cover}catch{}a.cover&&(FS(o,a.cover),ct?.id===a.id&&(ee.poster=a.cover))}})()}function qi(){let e=Wt.autoPrompt&&!!qt?.turnId&&qt.state==="submitted"&&!ct&&!pl&&bt.length>0&&Of!==qt.turnId?qt.turnId:null;if(e===jA)return;jA=e,VA?.abort();let t=F("prompt"),i=F("picks");if(!e){t.hidden=!0;return}let r=VA=new AbortController;kS(t,i,r.signal,e,s=>{i.replaceChildren(...s.map(o=>An(TS(o),()=>(Ie("mark_waiting_picks_shown",{turnId:e}).catch(()=>{}),no(bt.find(a=>a.id===o.id)??o,o.episodeId,!0,e)))),An("\u66F4\u591A\u2026",()=>{XA(),F("query").focus()}))}).catch(()=>{r.signal.aborted||(t.hidden=!0)})}function XA(){Of=qt?.turnId||null,Of&&Ie("dismiss_waiting_picks",{turnId:Of}).catch(()=>{}),qi()}F("dismiss").onclick=XA;function Qs(n,e=""){let t=F("catalogStatus"),i=F("cards"),r=F("query");if(t.dataset.state=n==="loading"&&bt.length?"busy":n,t.replaceChildren(),e){let s=document.createElement("span");s.textContent=Ce(e),t.append(s)}t.dataset.state==="busy"&&t.prepend(tr("spin")),n==="error"&&t.append(An("\u91CD\u8BD5",()=>Xr())),n==="empty"&&pl&&t.append(An("\u6E05\u9664\u641C\u7D22",()=>(r.value="",Xr(!1,"")))),t.querySelectorAll("button").forEach(s=>s.className="btn"),n==="loading"&&!bt.length?i.replaceChildren(...Array.from({length:6},()=>{let s=document.createElement("div"),o=document.createElement("span"),a=document.createElement("span");return s.className="skel",s.setAttribute("aria-hidden","true"),o.className="skelArt",a.className="skelLine",s.append(o,a),s})):i.querySelector(".skel")&&i.replaceChildren()}async function Xr(n=!1,e=pl){let t=++Gi;n||(pl=e,bt=[],kn=void 0,hl=0,Ki());let i=n?hl+1:0;F("more").hidden=!0,Qs("loading","\u6B63\u5728\u8BFB\u53D6\u7247\u5E93\u2026");let r=n?[...bt]:[],s=!1;!n&&!e&&Ie("list_series",{preview:!0},9e4).then(o=>{t!==Gi||s||!o.items.length||(bt=o.items,Ki(),F("catalogStatus").dataset.state!=="error"&&Qs(""),F("more").hidden=bt.length<=13)}).catch(()=>{});try{let o=new Set,a=(i+1)*12+(e?0:1),l=!n;for(;l||r.length<a&&kn&&!o.has(kn);){l=!1,kn&&o.add(kn);let u=await Ie("list_series",{query:e,cursor:kn},9e4);if(t!==Gi)return;let d=new Set(r.map(f=>f.id));for(let f of u.items)d.has(f.id)||(d.add(f.id),r.push(f));kn=u.cursor,kn&&o.has(kn)&&(kn=void 0)}s=r.length>0,s&&(bt=r);let c=Math.max(1,Math.ceil((bt.length-(e?0:1))/12));if(n&&i>=c&&!kn&&!e){await Xr();return}hl=i%c,Ki(),bt.length?Qs(""):e?Qs("empty","\u6CA1\u6709\u627E\u5230\u76F8\u7B26\u7684\u5267\u76EE"):Qs("error","\u7EA2\u679C\u6682\u65F6\u6CA1\u6709\u8FD4\u56DE\u63A8\u8350\u5267\u76EE"),F("more").hidden=c<=1&&!kn}catch(o){t===Gi&&(Qs("error",$t(o)),F("more").hidden=!n)}}async function Ff(){vr=(await Ie("get_history")).items,ew(),F("history").replaceChildren(...vr.map(n=>{let e=document.createElement("div"),t=document.createElement("strong"),i=document.createElement("small");e.className="historyRow";let r=An("",()=>QA(n));r.className="historyItem",t.textContent=n.title,i.textContent=n.label+" \xB7 "+to(n.positionMs/1e3),r.append(t,i);let s=An("",async()=>{await qr,await Ie("remove_history",{seriesId:n.seriesId}),await Ff(),Ki()}),o=Ce("\u79FB\u9664 "+n.title+" \u7684\u89C2\u770B\u5386\u53F2");return s.className="icon sm",s.setAttribute("aria-label",o),s.title=o,s.append(tr("x")),e.append(r,s),e})),F("historyCount").textContent=vr.length?String(vr.length):"",F("resume").hidden=!vr.length}function QA(n){return no(bt.find(e=>e.id===n.seriesId)||{id:n.seriesId,title:n.title},n.episodeId,!0)}function ew(){let n=vr[0];if(!n){F("continue").replaceChildren();return}let e=bt.find(f=>f.id===n.seriesId)||{id:n.seriesId,title:n.title},t=An("",()=>QA(n)),i=bl(n.title),r=document.createElement("span"),s=document.createElement("small"),o=document.createElement("strong"),a=document.createElement("span"),l=document.createElement("span"),c=document.createElement("i"),u=document.createElement("span"),d=n.durationMs?Math.min(1,n.positionMs/n.durationMs):0;return t.className="resumeCard",t.setAttribute("aria-label",Ce("\u7EE7\u7EED\u89C2\u770B \xB7 "+n.title+" \xB7 "+n.label)),r.className="resumeText",s.className="eyebrow",s.textContent=Ce("\u7EE7\u7EED\u89C2\u770B"),o.textContent=n.title,a.className="meta",a.textContent=n.label+" \xB7 "+to(n.positionMs/1e3)+(n.durationMs?" / "+to(n.durationMs/1e3):""),l.className="bar",c.style.setProperty("--p",(d*100).toFixed(1)+"%"),l.append(c),r.append(s,o,a,l),u.className="resumePlay",u.append(tr("play")),t.append(i,r,u),F("continue").replaceChildren(t),{span:i,s:e}}function tw(){let n=qt?.state==="submitted";F("lamp").classList.toggle("on",n),Bn("state",!gr.identified&&zn?"\u672A\u5173\u8054\u5BF9\u8BDD":!qt||qt.state==="unknown"?"\u7B49\u5F85\u56DE\u5408\u5F00\u59CB":n?"\u5F53\u524D\u56DE\u5408\u8FDB\u884C\u4E2D":qt.state==="interrupted"?"\u56DE\u5408\u5DF2\u4E2D\u65AD":"\u56DE\u5408\u5DF2\u505C\u6B62")}function zf(){return Ot?($S??=XF().finally(()=>{$S=void 0}),$S):Promise.resolve()}async function XF(){try{let n=await Ie("get_run_state",{observeSession:!0,playerInstance:document.hidden?void 0:HA},1800);if(!Ot)return;if(n.preferences){let r=Wt.autoPrompt!==n.preferences.autoPrompt;Wt=n.preferences,Hi.checked=Wt.autoplayNext,r&&qi()}let e=FA(qt,n),t=UA(qt,n),i=qt?.state!==n.state||qt?.turnId!==n.turnId;qt=n,i&&qi(),tw(),e&&ct&&Wt.autoPauseOnFinish?un(e):t&&Wt.autoPlayOnStart&&ct&&nt?.playable&&ee.paused&&!Qn&&vl(n.turnId,!0)}catch{if(!Ot)return;F("lamp").classList.remove("on"),Bn("state","\u672C\u673A\u72B6\u6001\u4E0D\u53EF\u8FBE")}}function QF(){let n=ee.duration;!Number.isFinite(n)||!$n||(Wr.value=String(Math.round(ee.currentTime/n*1e3)),Yi(Wr),Bn("time",to(ee.currentTime)+" / "+to(n)))}async function vl(n,e=!1){if(!nt?.playable||!ct||!Ot)return;let t=++lt,i=nt,r=ct;Qn=!0,Zi(),F("stopped").hidden=!0;try{if(!$n){Ye("\u6B63\u5728\u51C6\u5907\u64AD\u653E\u2026");let s=await Ie("prepare_playback",{episodeId:i.id,retry:!0}),o=Date.now()+24e4;for(;s.status==="preparing"&&t===lt&&Date.now()<o;){if(Ye("\u6B63\u5728\u672C\u673A\u51C6\u5907\u6574\u96C6\u2026"),await YF(700),t!==lt)return;s=await Ie("prepare_playback",{episodeId:i.id})}if(t!==lt)return;if(s.status!=="ready")throw Error(s.reason||"\u51C6\u5907\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5");let a=s;if(zn!=="src"in a)throw Error("\u672C\u96C6\u64AD\u653E\u5730\u5740\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u8BD5");await qr;let l=await Ie("get_history",{seriesId:r.id,episodeId:i.id});if(t!==lt)return;Jr();let c=new AbortController;fl=c;let u=MA(ee,c.signal),d=m=>{fl===c&&(c.abort(Error(m)),$n&&(un(m),Jr()))};try{"stream"in a?PS=NA(ee,i.id,a.stream,a.manifest,d,()=>{fl===c&&nw()}):(ee.src=a.src,ee.load())}catch(m){d($t(m))}if(await u,t!==lt)return;let f=l.items[0],h=f&&f.positionMs<f.durationMs?f.positionMs/1e3:0;ee.currentTime=h>0&&h<ee.duration-5?h:0,ee.currentTime>0&&(Bn("resumeTime","\u5DF2\u4ECE "+to(h)+" \u7EE7\u7EED"),F("resumed").hidden=!1),$n=!0}if(n){let s=await Ie("get_run_state",{observeSession:!0},1800);if(t!==lt)return;if(s.turnId!==n||s.state!=="submitted"||e&&!s.preferences?.autoPlayOnStart){un(e?"":"\u8FD9\u6761\u63A8\u8350\u5DF2\u7ED3\u675F");return}}if(t!==lt||!Ot)return;Qn=!1,dn==="finished"&&(ee.currentTime=0),dn="playing",ee.playbackRate=parseFloat(F("speed").value);try{await ee.play()}catch(s){if(t!==lt||!Ot)return;if(!(s instanceof DOMException&&["AbortError","NotAllowedError"].includes(s.name))||!document.hidden&&document.hasFocus()&&Yr?.action!==t)throw s;jf();return}t===lt&&(Mf(),Ye("\u6B63\u5728\u64AD\u653E"),wS=Date.now(),Zi())}catch(s){t===lt&&($n||Jr(),un($t(s)))}}function ez(){!ee.paused||Qn?un("\u5DF2\u624B\u52A8\u6682\u505C"):vl()}for(let n of[ee,Cf,AS,F("resumePlayback")])n.addEventListener("click",ez);function nw(){!$n||dn!=="playing"||!Number.isFinite(ee.duration)||ee.currentTime<ee.duration-1||(dn="finished",Wi(),Hi.checked&&Ot?YA(!0).catch(n=>Ye($t(n))):un("\u672C\u96C6\u5DF2\u64AD\u5B8C"),qr.then(Ff).catch(()=>{}))}ee.onended=nw;Hi.onchange=()=>{Ie("set_preferences",{autoplayNext:Hi.checked}).then(n=>{Wt=n}).catch(n=>Ye($t(n)))};ee.ontimeupdate=()=>{QF(),!ee.paused&&Date.now()-wS>=5e3&&(wS=Date.now(),Wi())};ee.onpause=()=>{Zi(),$n&&Wi(),(document.hidden||!document.hasFocus()||Yr?.action===lt)&&jf()};ee.onplay=Zi;ee.onplaying=Mf;ee.onerror=()=>{$n&&(un(ES(ee.error?.code)),Jr())};Wr.oninput=()=>{Yi(Wr),$n&&Number.isFinite(ee.duration)&&(dn==="finished"&&(dn="idle"),ee.currentTime=Number(Wr.value)*ee.duration/1e3)};Wr.onchange=()=>{Wi(ee.currentTime===0)};ee.onloadedmetadata=()=>{ee.videoWidth&&ee.videoHeight&&(F("stage").style.aspectRatio=ee.videoWidth+"/"+ee.videoHeight)};F("restart").onclick=()=>{dn==="finished"&&(dn="idle"),ee.currentTime=0,F("resumed").hidden=!0,Wi(!0)};F("mute").onclick=()=>{ee.volume===0?(ee.volume=.7,ee.muted=!1):ee.muted=!ee.muted};async function rw(){let n=F("stage");if(document.fullscreenElement){await document.exitFullscreen();return}if(n.classList.contains("expanded")){n.classList.remove("expanded"),Nf();return}try{await n.requestFullscreen()}catch{n.classList.add("expanded"),Nf()}}F("fullscreen").onclick=()=>{rw().catch(n=>Ye($t(n)))};document.addEventListener("fullscreenchange",Nf);function Nf(){let n=F("stage"),e=!!document.fullscreenElement||n.classList.contains("expanded");n.classList.toggle("isFull",e),io(F("fullscreen"),e?"collapse":"expand",Ce(e?"\u9000\u51FA\u5168\u5C4F":"\u5168\u5C4F"))}var GA;F("stage").addEventListener("pointermove",()=>{let n=F("stage");n.classList.add("awake"),clearTimeout(GA),GA=setTimeout(()=>n.classList.remove("awake"),2400)});F("stage").addEventListener("pointerleave",()=>F("stage").classList.remove("awake"));document.addEventListener("keydown",n=>{n.key==="Escape"&&F("stage").classList.contains("expanded")&&rw()});var ro=F("volume");ee.onvolumechange=()=>{let n=ee.muted||ee.volume===0;io(F("mute"),n?"mute":"volume",Ce(n?"\u53D6\u6D88\u9759\u97F3":"\u9759\u97F3")),F("mute").setAttribute("aria-pressed",String(n)),ro.value=String(Math.round(ee.volume*100)),Yi(ro)};ee.volume=Number(ro.value)/100;Yi(ro);ro.oninput=()=>{ee.volume=Number(ro.value)/100,ee.muted=ee.volume===0};F("speed").onchange=n=>ee.playbackRate=parseFloat(n.target.value);var yl=F("query"),LS,Bf=!1;function DS(){clearTimeout(LS),Bf||Xr(!1,yl.value.trim())}function CS(){clearTimeout(LS),++Gi,!Bf&&(yl.value.trim()?LS=setTimeout(DS,400):DS())}yl.addEventListener("input",CS);yl.addEventListener("compositionstart",()=>{Bf=!0,CS()});yl.addEventListener("compositionend",()=>{Bf=!1,CS()});F("search").onsubmit=n=>{n.preventDefault(),DS()};F("more").onclick=()=>{Xr(!0)};async function tz(){let n=ct,e=nt;if(!(!n||!e))try{await un();let t=await Ie("create_browser_pairing",{seriesId:n.id,episodeId:e.id,title:n.title});if(ct!==n||nt!==e)return;F("linkValue").value=t.url,F("link").hidden=!1,F("link").scrollIntoView({block:"nearest"}),setTimeout(()=>{F("linkValue").value===t.url&&(F("link").hidden=!0,F("linkValue").value="")},6e4)}catch(t){Ye($t(t))}}F("pair").onclick=tz;F("copy").onclick=async()=>{let n=F("linkValue");try{await navigator.clipboard.writeText(n.value),Ye("\u5DF2\u590D\u5236\uFF0C\u8BF7\u5728 Codex \u5185\u7F6E\u6D4F\u89C8\u5668\u6253\u5F00")}catch{n.select(),Ye("\u94FE\u63A5\u5DF2\u9009\u4E2D\uFF0C\u8BF7\u590D\u5236\u5E76\u5728 Codex \u5185\u7F6E\u6D4F\u89C8\u5668\u6253\u5F00")}};F("settingsCancel").onclick=()=>F("prefs").click();F("setupOpen").onclick=()=>{F("settings").hidden=!0,F("prefs").setAttribute("aria-expanded","false"),Lf()};F("prefs").onclick=()=>{F("settings").hidden=!F("settings").hidden,F("prefs").setAttribute("aria-expanded",String(!F("settings").hidden)),F("autoPrompt").checked=Wt.autoPrompt,F("autoPauseOnFinish").checked=Wt.autoPauseOnFinish,F("autoPlayOnStart").checked=Wt.autoPlayOnStart,F("terms").value=Wt.searchTerms.join("\uFF0C")};F("settings").onsubmit=n=>{n.preventDefault();let e=F("terms").value.split(/[,,]/).map(t=>t.trim()).filter(Boolean);Ie("set_preferences",{autoPrompt:F("autoPrompt").checked,autoPauseOnFinish:F("autoPauseOnFinish").checked,autoPlayOnStart:F("autoPlayOnStart").checked,searchTerms:e}).then(async t=>{Wt=t,Hi.checked=Wt.autoplayNext,F("settings").hidden=!0,F("prefs").setAttribute("aria-expanded","false"),qi(),ct||await Xr()}).catch(t=>Ye($t(t)))};F("health").onclick=async()=>{let n=F("healthInfo");if(n.hidden=!n.hidden,F("health").setAttribute("aria-expanded",String(!n.hidden)),!n.hidden){n.textContent=Ce("\u6B63\u5728\u68C0\u67E5\u2026");try{let e=await Ie("get_health"),t=[["Node",e.runtime,!0],["\u8FDB\u5EA6\u5E93",e.database?"\u53EF\u5199":"\u4E0D\u53EF\u7528",e.database],["FFmpeg",e.ffmpeg?"\u5C31\u7EEA":"\u7F3A\u5931",e.ffmpeg]];n.replaceChildren(...t.map(([i,r,s])=>{let o=document.createElement("div"),a=document.createElement("span"),l=document.createElement("span");return o.className="healthRow "+(s?"ok":"bad"),a.textContent=Ce(i),l.textContent=Ce(r),o.append(tr(s?"check":"alert"),a,l),o}))}catch(e){n.textContent=$t(e)}}};F("choose").onclick=async()=>{try{let n=await Ie("list_sessions");F("choices").replaceChildren(...n.items.map(e=>An("\u2026"+e.suffix+" \xB7 "+new Date(e.at).toLocaleString(),async()=>{await Ie("select_session",{choice:e.choice}),gr.identified=!0,OS(Ot&&!document.hidden),F("choose").hidden=!0,F("choices").replaceChildren(),await zf()}))),n.items.length||Ye("\u8FD8\u6CA1\u6709\u672C\u673A\u56DE\u5408\u8BB0\u5F55\uFF0C\u53EF\u5148\u624B\u52A8\u89C2\u770B")}catch(n){Ye($t(n))}};function OS(n){return gr.identified?Ie("set_player_visible",{instance:HA,visible:n},1800).catch(()=>{}):Promise.resolve()}async function iw(){Ot&&(Ot=!1,await Promise.all([un("\u5DF2\u6682\u505C\uFF0C\u70B9\u51FB\u64AD\u653E\u7EE7\u7EED"),OS(!1)]))}function sw(n){if(n.action!==lt||!Ot||!$n||dn!=="playing"||!ee.paused||ee.ended||ee.error)return;let e=ee.currentTime;n.lastPosition!==void 0&&Math.abs(e-n.lastPosition)<.25||(n.lastPosition=e,ee.play().then(()=>{n.action===lt&&!ee.paused&&Ye("\u6B63\u5728\u64AD\u653E")}).catch(()=>{}))}function jf(){!Ot||dn!=="playing"||(Yr?.action!==lt&&(Yr={action:lt}),sw(Yr))}function ow(){let n=Yr;n&&(Yr=void 0,zf().then(()=>sw({action:n.action})))}function aw(){Ot&&(OS(!document.hidden),document.hidden?(jf(),Wi()):ow(),zf())}function lw(){!ml||Ot||(Ot=!0,aw())}document.addEventListener("visibilitychange",aw);window.addEventListener("blur",jf);window.addEventListener("focus",ow);window.addEventListener("pagehide",()=>{iw()});window.addEventListener("pageshow",lw);async function cw(n){if(ml)return;if(ml=!0,RS=n?.play?n.playbackId:void 0,navigator.mediaSession&&(navigator.mediaSession.setActionHandler("pause",()=>{un("\u5DF2\u624B\u52A8\u6682\u505C")}),navigator.mediaSession.setActionHandler("play",()=>{ee.paused&&!Qn&&vl()})),ZA=window.setInterval(()=>{zf()},1e3),F("pair").hidden=zn||KA,F("choose").hidden=zn||gr.identified,qt=null,tw(),lw(),zA(Ye),Ie("get_preferences").then(t=>{ml&&(Wt=t,Hi.checked=Wt.autoplayNext??!0,qi())}).catch(t=>Ye($t(t))),n?.pick){let t=n.pick;await no(t,t.episodeId,n.play,n.turnId);return}F("home").hidden=!1,F("watch").hidden=!0;let e=Xr();Ff().then(()=>{!ct&&vr.length&&bt.length&&Ki()}).catch(t=>Ye($t(t))),gr.selection&&await no({id:gr.selection.seriesId,title:gr.selection.title||"\u7EA2\u679C\u77ED\u5267"},gr.selection.episodeId),await e}function uw(){let n=iw();return ml=!1,navigator.mediaSession&&(navigator.mediaSession.setActionHandler("pause",null),navigator.mediaSession.setActionHandler("play",null)),window.clearInterval(ZA),++Xn,Jr(),n}var Df=KA?BA(n=>{cw(n).catch(e=>Ye($t(e)))},uw):null;OA(n=>{MS(DA()),gr=n,Df?n.waitingTurn&&Df.connected():cw().catch(e=>Ye($t(e)))},async()=>{Df?.dispose(),await uw()},()=>Df?.modeChanged()).catch(n=>Ye($t(n)));})();
|
|
2063
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:E.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:E.string().optional().describe("User's timezone in IANA format."),userAgent:E.string().optional().describe("Host application identifier."),platform:E.union([E.literal("web"),E.literal("desktop"),E.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:E.object({touch:E.boolean().optional().describe("Whether the device supports touch input."),hover:E.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:E.object({top:E.number().describe("Top safe area inset in pixels."),right:E.number().describe("Right safe area inset in pixels."),bottom:E.number().describe("Bottom safe area inset in pixels."),left:E.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),KF=E.object({method:E.literal("ui/notifications/host-context-changed"),params:kA.describe("Partial context update containing only changed fields.")}),h3=E.object({method:E.literal("ui/update-model-context"),params:E.object({content:E.array(Js).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:E.record(E.string(),E.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),m3=E.object({method:E.literal("ui/initialize"),params:E.object({appInfo:rl.describe("App identification (name and version)."),appCapabilities:BF.describe("Features and capabilities this app provides."),protocolVersion:E.string().describe("Protocol version this app supports.")})}),HF=E.object({protocolVersion:E.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:rl.describe("Host application identification and version."),hostCapabilities:zF.describe("Features and capabilities provided by the host."),hostContext:kA.describe("Rich context about the host environment.")}).passthrough(),ZF={target:"draft-2020-12"};async function IA(n,e){let t=n["~standard"];if(t.jsonSchema)return t.jsonSchema[e](ZF);if(t.vendor==="zod"){let{z:i}=await Promise.resolve().then(()=>(Qa(),Wb));return i.toJSONSchema(n,{io:e})}throw Error(`Schema (vendor: ${t.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function TA(n,e,t=""){let i=await n["~standard"].validate(e);if(i.issues){let r=i.issues.map(s=>{let o=s.path?.map(a=>typeof a=="object"?a.key:a).join(".");return o?`${o}: ${s.message}`:s.message}).join("; ");throw Error(t+r)}return i.value}function $A(n){let e=document.documentElement;e.setAttribute("data-theme",n),e.style.colorScheme=n}function AA(n,e=document.documentElement){for(let[t,i]of Object.entries(n))i!==void 0&&e.style.setProperty(t,i)}var Pf=class n extends gS{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:CF,toolinputpartial:OF,toolresult:GF,toolcancelled:NF,hostcontextchanged:KF};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(e){if(!n.ONE_SHOT_EVENTS.has(e)||this._everHadListener.has(e)||(this._everHadListener.add(e),!this._initializedSent))return;let t=`[ext-apps] "${String(e)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(t);console.warn(t)}setEventHandler(e,t){t&&this._assertHandlerTiming(e),super.setEventHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),super.addEventListener(e,t)}onEventDispatch(e,t){e==="hostcontextchanged"&&(this._hostContext={...this._hostContext,...t})}constructor(e,t={},i={autoResize:!0}){super(i),this._appInfo=e,this._capabilities=t,this.options=i,i.allowUnsafeEval||E.config({jitless:!0}),this.setRequestHandler(Ws,r=>(console.log("Received ping:",r.params),{})),this.setEventHandler("hostcontextchanged",void 0)}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._capabilities=_A(this._capabilities,e)}registerTool(e,t,i){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,s=()=>{r._initializedSent&&r._capabilities.tools?.listChanged&&r.sendToolListChanged()},o=t.inputSchema!==void 0,a={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,s()},disable(){this.enabled=!1,s()},update(l){Object.assign(this,l),s()},remove(){r._registeredTools[e]===a&&(delete r._registeredTools[e],s())},handler:async(l,c)=>{if(!a.enabled)throw Error(`Tool ${e} is disabled`);let u;if(o){let d=a.inputSchema,f=d?await TA(d,l??{},`Invalid input for tool ${e}: `):l??{};u=await i(f,c)}else u=await i(c);return a.outputSchema&&!u.isError&&(u.structuredContent=await TA(a.outputSchema,u.structuredContent,`Invalid output for tool ${e}: `)),u}};return this._registeredTools[e]=a,!this._capabilities.tools&&!this.transport&&this.registerCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),s(),a}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let i=this._registeredTools[e.name];if(!i)throw Error(`Tool ${e.name} not found`);return i.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([i,r])=>r.enabled).map(async([i,r])=>{let s={name:i,title:r.title,description:r.description,inputSchema:r.inputSchema?await IA(r.inputSchema,"input"):{type:"object",properties:{}}};return r.outputSchema&&(s.outputSchema=await IA(r.outputSchema,"output")),r.annotations&&(s.annotations=r.annotations),r._meta&&(s._meta=r._meta),s}))}))}async sendToolListChanged(e={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(e){this.setEventHandler("toolinput",e)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(e){this.setEventHandler("toolinputpartial",e)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(e){this.setEventHandler("toolresult",e)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(e){this.setEventHandler("toolcancelled",e)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(e){this.setEventHandler("hostcontextchanged",e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,e),this._onteardown=e,this.replaceRequestHandler(FF,(t,i)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(t.params,i)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(dS,(t,i)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(t.params,i)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler(uS,(t,i)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(t.params,i)})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${e} registered`)}}assertNotificationCapability(e){}assertTaskCapability(e){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(e){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(e,t){if(this._assertInitialized("callServerTool"),typeof e=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:e},Xs,{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:e},iS,t)}async listServerResources(e,t){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:e},nS,t)}async createSamplingMessage(e,t){this._assertInitialized("createSamplingMessage");let i=e.tools?hS:fS;return await this.request({method:"sampling/createMessage",params:e},i,t)}sendMessage(e,t){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:e},DF,t)}sendLog(e){return this.notification({method:"notifications/message",params:e})}updateModelContext(e,t){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:e},yf,t)}openLink(e,t){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:e},RF,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:e},LF,t)}requestTeardown(e={}){return this.notification({method:"ui/notifications/request-teardown",params:e})}requestDisplayMode(e,t){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:e},jF,t)}sendSizeChanged(e){return this.notification({method:"ui/notifications/size-changed",params:e})}setupSizeChangedNotifications(){let e=!1,t=0,i=0,r=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;let o=document.documentElement,a=o.style.height;o.style.height="max-content";let l=Math.ceil(o.getBoundingClientRect().height);o.style.height=a;let c=Math.ceil(window.innerWidth);(c!==t||l!==i)&&(t=c,i=l,this.sendSizeChanged({width:c,height:l}))}))};r();let s=new ResizeObserver(r);return s.observe(document.documentElement),s.observe(document.body),()=>s.disconnect()}async connect(e=new vS(window.parent,window.parent),t){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1,await super.connect(e);try{let i=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:kF}},HF,t);if(i===void 0)throw Error(`Server sent invalid initialize result: ${i}`);this._hostCapabilities=i.hostCapabilities,this._hostInfo=i.hostInfo,this._hostContext=i.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(i){throw this.close(),i}}};function wA(n,e,t){let i,r=!1,s=()=>{r||i!==void 0||(i=requestAnimationFrame(()=>{i=void 0,!(r||!e())&&t(n.hidden?1:Math.max(1,Math.ceil(n.getBoundingClientRect().height)))}))},o=new ResizeObserver(s);return o.observe(n),s(),{refresh:s,dispose(){r=!0,o.disconnect(),i!==void 0&&cancelAnimationFrame(i)}}}var PA={name:"@kyun.si/codex-hongguo",version:"0.0.23",private:!0,license:"MIT",type:"module",engines:{node:">=22.16"},scripts:{"version:patch":"npm version patch --no-git-tag-version",preversion:"node scripts/version.mjs --next",version:"node scripts/version.mjs --sync",prebuild:"node scripts/version.mjs",build:"node scripts/build.mjs",test:"npm run build && node scripts/prepare-media.mjs && node --test test/*.test.mjs",package:"npm run build && node scripts/package.mjs","verify:install":"node scripts/verify-install.mjs","release:publish":"node scripts/publish.mjs"},dependencies:{"@modelcontextprotocol/ext-apps":"1.7.5","@modelcontextprotocol/sdk":"1.32.2","cross-spawn":"7.0.6",fflate:"0.8.3","hls.js":"1.7.4","m3u8-parser":"7.2.1","mpd-parser":"1.4.1",openhongguo:"0.2.0","xz-decompress":"0.2.3",zod:"4.6.7"},devDependencies:{"@types/node":"22.20.5",esbuild:"0.28.2",typescript:"5.9.3"}};var zn=document.documentElement.dataset.host==="browser",LA=document.documentElement.dataset.surface==="waiting",xS="",Jn=zn?null:new Pf({name:"\u7EA2\u679C\u77ED\u5267",version:PA.version},{},{autoResize:!LA}),SS,DA=()=>Jn?.getHostContext()?.locale||navigator.language,Rf=()=>Jn?.getHostContext()?.displayMode;async function CA(){if((await Jn?.requestDisplayMode({mode:"fullscreen"},{timeout:5e3}))?.mode!=="fullscreen")throw Error("\u5F53\u524D Codex \u65E0\u6CD5\u5728\u4F1A\u8BDD\u4E2D\u6253\u5F00\u64AD\u653E\u5668")}function RA(n){n&&(n.theme&&$A(n.theme),n.styles?.variables&&AA(n.styles.variables))}async function OA(n,e,t){if(zn){let i=await fetch("context",{signal:AbortSignal.timeout(4e3)});if(!i.ok)throw Error("\u5206\u5C4F\u5DF2\u5931\u6548\uFF0C\u8BF7\u4ECE\u9762\u677F\u91CD\u65B0\u6253\u5F00");n(await i.json());return}Jn.ontoolresult=i=>{if(typeof i._meta?.panel!="string")return;xS=i._meta.panel;let r=typeof i._meta.waitingTurn=="string"?i._meta.waitingTurn:void 0;n({identified:!!i.structuredContent?.identified||!!r,waitingTurn:r})},Jn.onteardown=async()=>(SS?.dispose(),await e(),{}),Jn.onhostcontextchanged=i=>{RA(i),i.displayMode!==void 0&&(t(),SS?.refresh())},await Jn.connect(),RA(Jn.getHostContext()),LA&&(SS=wA(document.getElementById("waitingCard"),()=>(Rf()||"inline")==="inline",i=>{Jn.sendSizeChanged({height:i}).catch(()=>{})})),t()}async function Ie(n,e={},t=15e3){if(zn){let r=await fetch("api/"+n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),keepalive:n==="save_progress",signal:AbortSignal.timeout(t)}),s=await r.json();if(!r.ok)throw Error(s.error||"\u5206\u5C4F\u8FDE\u63A5\u5DF2\u4E2D\u65AD");return s}if(!xS)throw Error("\u7B49\u5F85\u4F1A\u8BDD\u9762\u677F\u8FDE\u63A5");let i=await Jn.callServerTool({name:n,arguments:{...e,panel:xS}},{timeout:t});if(i.isError)throw Error(i.content?.[0]?.type==="text"?i.content[0].text:"\u672C\u673A\u670D\u52A1\u4E0D\u53EF\u8FBE");return i._meta?.data}var _S="https://hongguo.invalid/";function NA(n,e,t,i,r,s){if(!sr.isSupported())throw Error("\u5F53\u524D\u9762\u677F\u4E0D\u652F\u6301\u5206\u6BB5\u89E3\u7801\uFF0C\u53EF\u4F7F\u7528\u540C\u7A97\u5206\u5C4F");class o{context=null;stats=new ai;abort(){this.stats.aborted=!0}destroy(){this.abort()}load(d,f,h){this.context=d,this.stats.loading.start=performance.now(),(async()=>{let p=d.url.slice(_S.length);if(!d.url.startsWith(_S))throw Error("\u65E0\u6548\u5A92\u4F53\u6765\u6E90");if(p==="index.m3u8")return i;let g=0,y;do{let b=await Ie("read_panel_chunk",{episodeId:e,stream:t,asset:p,offset:g},8e3);if(this.stats.aborted)return;if(!Number.isSafeInteger(b.size)||b.size<1||b.size>32*1024*1024)throw Error("\u5206\u6BB5\u957F\u5EA6\u65E0\u6548");y??=new Uint8Array(b.size);let S=atob(b.bytes);if(b.size!==y.length||!S.length||g+S.length>b.size)throw Error("\u5206\u6BB5\u4E0D\u5B8C\u6574");for(let x=0;x<S.length;x++)y[g+x]=S.charCodeAt(x);g+=S.length}while(g<y.length);return y.buffer})().then(p=>{this.stats.aborted||p===void 0||(this.stats.loading.first=this.stats.loading.end=performance.now(),this.stats.loaded=this.stats.total=typeof p=="string"?p.length:p.byteLength,h.onSuccess({url:d.url,data:p},this.stats,d,null))}).catch(()=>{this.stats.aborted||h.onError({code:0,text:"\u4FA7\u680F\u5206\u6BB5\u8BFB\u53D6\u5931\u8D25"},d,null,this.stats)})}}let a=new sr({loader:o,enableWorker:!1,maxBufferLength:16,maxMaxBufferLength:24,backBufferLength:12});a.on(sr.Events.MEDIA_ENDED,s),a.on(sr.Events.ERROR,(u,d)=>{d.fatal&&(d.type===sr.ErrorTypes.NETWORK_ERROR?r("\u4FA7\u680F\u5206\u6BB5\u8BFB\u53D6\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u70B9\u64AD"):r("\u4FA7\u680F\u65E0\u6CD5\u5904\u7406\u89C6\u9891\u5206\u6BB5\uFF0C\u53EF\u4F7F\u7528\u540C\u7A97\u5206\u5C4F"))});let l=u=>{u.disposition==="enforce"&&u.effectiveDirective==="media-src"&&(u.blockedURI==="blob"||u.blockedURI.startsWith("blob:"))&&r("\u684C\u9762\u5B89\u5168\u7B56\u7565\u963B\u6B62\u4E86\u4FA7\u680F\u8F7D\u5165\u672C\u5730\u89C6\u9891")},c=()=>{document.removeEventListener("securitypolicyviolation",l),a.destroy()};document.addEventListener("securitypolicyviolation",l);try{a.loadSource(_S+"index.m3u8"),a.attachMedia(n)}catch(u){throw c(),u}return c}function ES(n){switch(n){case 1:return"\u89C6\u9891\u52A0\u8F7D\u5DF2\u4E2D\u6B62\uFF0C\u53EF\u4EE5\u91CD\u65B0\u70B9\u64AD";case 2:return"\u8BFB\u53D6\u89C6\u9891\u6570\u636E\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u70B9\u64AD";case 3:return"\u64AD\u653E\u5668\u89E3\u7801\u89C6\u9891\u6570\u636E\u5931\u8D25\uFF0C\u53EF\u4F7F\u7528\u540C\u7A97\u5206\u5C4F";case 4:return"\u64AD\u653E\u5668\u65E0\u6CD5\u6253\u5F00\u89C6\u9891\u6765\u6E90\uFF0C\u53EF\u91CD\u65B0\u70B9\u64AD\u6216\u4F7F\u7528\u540C\u7A97\u5206\u5C4F";default:return"\u89C6\u9891\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u70B9\u64AD"}}function MA(n,e){return new Promise((t,i)=>{let r=()=>l(),s=()=>l(Error(ES(n.error?.code))),o=()=>l(e.reason),a=setTimeout(()=>l(Error("\u7B49\u5F85\u89C6\u9891\u5143\u6570\u636E\u8D85\u65F6\uFF0C\u8BF7\u91CD\u65B0\u70B9\u64AD")),3e4);function l(c){clearTimeout(a),n.removeEventListener("loadedmetadata",r),n.removeEventListener("error",s),e.removeEventListener("abort",o),c!==void 0?i(c):t()}n.addEventListener("loadedmetadata",r),n.addEventListener("error",s),e.addEventListener("abort",o),e.aborted&&o()})}function UA(n,e){return!!n&&!!e.turnId&&e.state==="submitted"&&n.turnId!==e.turnId}function FA(n,e){return!n||!e.turnId||e.state!=="stopped"&&e.state!=="interrupted"||n.turnId===e.turnId&&n.state!=="submitted"?null:e.state==="interrupted"?"\u672C\u8F6E\u5DF2\u4E2D\u65AD\uFF0C\u5DF2\u4E3A\u4F60\u6682\u505C":"\u672C\u8F6E\u5DF2\u505C\u6B62\uFF0C\u5DF2\u4E3A\u4F60\u6682\u505C"}var yt=n=>document.getElementById(n),dl=0;function WF(n){let e=n.hooks.status==="ready",t=n.hooks.events.some(s=>s.status==="needs_review");yt("setupTitle").textContent=Ce(t?"\u8BF7\u5BA1\u67E5\u7EA2\u679C\u7684\u56DE\u5408 Hooks":"\u5F00\u59CB\u4F7F\u7528\u7EA2\u679C");let i=[["Node",n.runtime,!0],["\u8FDB\u5EA6\u5E93",n.database?"\u53EF\u5199":"\u4E0D\u53EF\u7528",n.database],["\u64AD\u653E\u7EC4\u4EF6",n.ffmpeg?"\u5C31\u7EEA":"\u51C6\u5907\u4E2D",n.ffmpeg],["\u56DE\u5408\u8054\u52A8",e?"\u5DF2\u914D\u7F6E":n.hooks.status==="unknown"?"\u5F85\u786E\u8BA4":"\u5F85\u914D\u7F6E",e]];yt("setupRows").replaceChildren(...i.map(([s,o,a])=>{let l=document.createElement("div"),c=document.createElement("span"),u=document.createElement("span");return l.className="healthRow "+(a?"ok":"bad"),c.textContent=Ce(s),u.textContent=Ce(o),l.append(tr(a?"check":"alert"),c,u),l}));let r=n.database?n.ffmpeg?e?"\u56DE\u5408\u8054\u52A8\u5DF2\u5C31\u7EEA\u3002\u53EF\u5728\u8BBE\u7F6E\u4E2D\u914D\u7F6E\u4EFB\u52A1\u5F00\u59CB\u81EA\u52A8\u64AD\u653E\u548C\u4EFB\u52A1\u7ED3\u675F\u81EA\u52A8\u6682\u505C\u3002":n.hooks.status==="unknown"?"\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6 Hooks \u72B6\u6001\uFF0C\u8BF7\u5728\u5BBF\u4E3B\u8BBE\u7F6E\u4E2D\u6838\u5BF9\u3002\u73B0\u5728\u53EF\u4EE5\u5148\u624B\u52A8\u89C2\u770B\u3002":n.hooks.events.some(s=>s.status==="missing")?"\u5C1A\u672A\u53D1\u73B0\u5B8C\u6574\u7684\u56DE\u5408\u4E8B\u4EF6\u3002\u8BF7\u68C0\u67E5\u63D2\u4EF6\u5DF2\u542F\u7528\uFF0C\u5E76\u5728\u65B0\u7684\u672C\u5730\u5BF9\u8BDD\u4E2D\u91CD\u8BD5\u3002":"\u56DE\u5408\u8054\u52A8\u5C1A\u672A\u914D\u7F6E\u3002\u5B8C\u6210\u4E0B\u65B9\u64CD\u4F5C\u540E\u91CD\u65B0\u68C0\u67E5\uFF0C\u4E5F\u53EF\u4EE5\u5148\u624B\u52A8\u89C2\u770B\u3002":"\u64AD\u653E\u7EC4\u4EF6\u5C1A\u672A\u5C31\u7EEA\u3002\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u70B9\u51FB\u300C\u91CD\u65B0\u68C0\u67E5\u300D\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u51C6\u5907\u3002":"\u8FDB\u5EA6\u6682\u65F6\u65E0\u6CD5\u4FDD\u5B58\uFF0C\u8BF7\u68C0\u67E5\u7EA2\u679C\u7684\u6570\u636E\u76EE\u5F55\u6743\u9650\u3002";yt("setupHelp").textContent=Ce(r),yt("setupGuide").querySelector(".setupHooks").hidden=e}async function Lf(n=!0){if(zn)return;let e=++dl,t=yt("setupCheck");t.disabled=!0,n&&(yt("setupGuide").hidden=!1,yt("setupRows").replaceChildren(),yt("setupHelp").textContent=Ce("\u6B63\u5728\u68C0\u67E5\u2026"));try{let i=await Ie("get_setup_status");if(e!==dl)return;WF(i);let r=!i.database||!i.ffmpeg||i.hooks.status==="needs_attention";yt("setupGuide").hidden=!(n||r)}catch{if(e!==dl)return;yt("setupGuide").hidden=!n,yt("setupRows").replaceChildren(),yt("setupHelp").textContent=Ce("\u68C0\u67E5\u672A\u5B8C\u6210\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u6216\u5728 Codex \u8BBE\u7F6E \u2192 Hooks \u6838\u5BF9\u56DE\u5408\u8054\u52A8\u3002"),yt("setupGuide").querySelector(".setupHooks").hidden=!1}finally{e===dl&&(t.disabled=!1)}}function zA(n){yt("setupOpen").hidden=zn,yt("setupCheck").onclick=()=>{Lf()},yt("setupDone").onclick=async()=>{++dl;let e=yt("setupDone");e.disabled=!0;try{await Ie("set_setup_dismissed",{dismissed:!0})}catch{n("\u672C\u6B21\u5DF2\u6536\u8D77\u6307\u5357\uFF0C\u6682\u65F6\u65E0\u6CD5\u4FDD\u5B58\u6B64\u8BBE\u7F6E\u3002")}finally{yt("setupGuide").hidden=!0,e.disabled=!1,yt("setupCheck").disabled=!1}},Lf(!1)}function TS(n){return n.episodeId?Ce(n.kind==="next"?"\u770B\u4E0B\u4E00\u96C6":"\u7EE7\u7EED\u89C2\u770B")+" \xB7 "+n.title:n.title}function IS(n,e){return e.aborted?Promise.resolve(!1):new Promise(t=>{let i=new IntersectionObserver(a=>{let l=a[a.length-1];!document.hidden&&l.isIntersecting&&l.intersectionRect.width>0&&l.intersectionRect.height>0&&r(!0)},{threshold:[0,.01]}),r=a=>{i.disconnect(),document.removeEventListener("visibilitychange",o),e.removeEventListener("abort",s),t(a)},s=()=>r(!1),o=()=>{document.hidden||(i.unobserve(n),i.observe(n))};e.addEventListener("abort",s),document.addEventListener("visibilitychange",o),i.observe(n)})}async function kS(n,e,t,i,r,s=!1){let o=i?{turnId:i}:{};if(e.replaceChildren(),n.hidden=!1,!await IS(n,t))return;let{items:a}=await Ie("get_waiting_picks",{...o,inView:!0},9e4);if(!t.aborted){if(!a.length){s?r([]):n.hidden=!0;return}if(r(a),!!await IS(e,t))try{await Ie("mark_waiting_picks_shown",o)}catch{await IS(e,t)&&await Ie("mark_waiting_picks_shown",o).catch(()=>{})}}}function BA(n,e){let t=document.getElementById("waitingCard"),i=document.getElementById("waitingTitles"),r=document.getElementById("waitingMessage"),s=document.getElementById("waitingDismiss"),o=!1,a=!1,l=!1,c=!1,u=!0,d=!1,f=0,h,m,p,g;function y(){++f,m?.abort(),m=void 0,t.hidden=!0,i.replaceChildren(),r.textContent=""}s.onclick=()=>{c=!0,y(),Ie("dismiss_waiting_picks").catch(()=>{})};function b($){!o||c||!u||a||(r.textContent=Ce($ instanceof Error?$.message:"\u5F53\u524D Codex \u65E0\u6CD5\u5728\u4F1A\u8BDD\u4E2D\u6253\u5F00\u64AD\u653E\u5668"),t.hidden=!1)}async function S($=!1){if(!o)return;let P=Rf()||"inline";if(!$&&P===h)return;h=P;let k=++f;m?.abort();let D=m=new AbortController;if(P==="fullscreen"){if(a)return;let V=await(p??=Ie("activate_waiting_player"));if(k!==f)return;a=!0,t.hidden=!0,document.documentElement.dataset.surface="player",n(V);return}else p=void 0,a&&(a=!1,e(),document.documentElement.dataset.surface="waiting");if(c){y();return}let U=await Ie("get_waiting_status");if(k===f){if(u=U.visible,!u){y();return}r.textContent="",await kS(t,i,D.signal,void 0,V=>{let X=V.map(z=>{let B=document.createElement("button");return B.type="button",B.textContent=TS(z),B.onclick=()=>{x(z)},B}),q=document.createElement("button");q.type="button",q.textContent=Ce("\u66F4\u591A\u2026"),q.onclick=()=>{x()},i.replaceChildren(...X,q)},!0).catch(V=>{D.signal.aborted||b(V)})}}async function x($){if(!l){l=!0,r.textContent="";try{$?await Ie("select_waiting_pick",{seriesId:$.id}):await Ie("browse_waiting_catalog"),Rf()==="fullscreen"?await S(!0):(await CA(),t.hidden=!0)}catch(P){b(P),P instanceof Error&&P.message==="\u8FD9\u6761\u63A8\u8350\u5DF2\u7ED3\u675F"&&y()}finally{l=!1}}}async function _(){if(!(!o||a||l||c||document.hidden||d)){d=!0;try{let $=await Ie("get_waiting_status");if(!o||a||l||c)return;$.visible!==u&&(u=$.visible,u?await S(!0):y())}catch{!a&&!l&&(u=!1,y())}finally{d=!1}}}let I=()=>{S().catch(b)},T=()=>{!document.hidden&&o&&!a&&!c&&S(!0).catch(b)};return{connected(){o||(o=!0,g=setInterval(()=>{_()},1e3),document.addEventListener("visibilitychange",T),I())},modeChanged:I,dispose(){o=!1,clearInterval(g),document.removeEventListener("visibilitychange",T),y()}}}var F=n=>document.getElementById(n),ee=document.querySelector("video"),Wr=F("seek"),AS=F("play"),Cf=F("center"),Hi=F("autonext"),Bn=(n,e)=>{F(n).textContent=n==="title"?e:Ce(e)},Ye=n=>Bn("notice",n),$t=n=>n instanceof Error?n.message:"\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5",to=n=>Math.floor(n/60)+":"+String(Math.floor(n%60)).padStart(2,"0"),YF=n=>new Promise(e=>setTimeout(e,n));function An(n,e){let t=document.createElement("button");return t.textContent=Ce(n),t.onclick=()=>{Promise.resolve(e()).catch(i=>Ye($t(i)))},t}var gr={identified:!1},qt=null,ct=null,nt=null,qe=[],kt,pl="",kn,bt=[],$n=!1,lt=0,Xn=0,Gi=0,Qn=!1,Ot=!1,$S,wS=0,qr=Promise.resolve(),Wt={autoPrompt:!0,autoplayNext:!0,autoPauseOnFinish:!0,autoPlayOnStart:!0,searchTerms:["\u603B\u88C1","\u91CD\u751F","\u9006\u88AD"]},dn="idle",Yr,PS,fl,eo=0,hl=0,vr=[],Of=null,KA=document.documentElement.dataset.surface==="waiting",HA=Array.from(crypto.getRandomValues(new Uint32Array(4)),n=>n.toString(16).padStart(8,"0")).join(""),ml=!1,ZA,jA=null,VA,RS;function Mf(){let n=RS;RS=void 0,n&&Ie("confirm_waiting_playback",{playbackId:n},1800).catch(()=>{})}function Zi(){AS.disabled=Cf.disabled=!nt?.playable,F("pair").disabled=!nt;let n=Ce(Qn?"\u53D6\u6D88\u51C6\u5907":ee.paused?"\u64AD\u653E":"\u6682\u505C"),e=Qn?"x":ee.paused?"play":"pause";io(AS,e,n),io(Cf,e,n),F("stage").classList.toggle("playing",!ee.paused),F("stage").classList.toggle("busy",Qn),F("prev").disabled=!nt||!qe.slice(0,qe.indexOf(nt)).some(t=>t.playable),F("next").disabled=!nt||!kt&&!qe.slice(qe.indexOf(nt)+1).some(t=>t.playable),Cf.hidden=Qn,document.querySelectorAll("#episodes button").forEach(t=>t.setAttribute("aria-pressed",String(t.dataset.id===nt?.id)))}function Wi(n=!1){if(!$n||!ct||!nt||!Number.isFinite(ee.duration)||!ee.duration||!ee.currentTime&&!n)return qr;let e={seriesId:ct.id,episodeId:nt.id,title:ct.title,label:nt.label,positionMs:Math.round((dn==="finished"||ee.ended?ee.duration:ee.currentTime)*1e3),durationMs:Math.round(ee.duration*1e3)};return qr=qr.then(()=>Ie("save_progress",{...e,...n&&e.positionMs===0?{reset:!0}:{}},1800)).then(()=>{}).catch(()=>Ye("\u89C2\u770B\u8FDB\u5EA6\u6682\u672A\u5199\u5165\uFF0C\u8BF7\u68C0\u67E5\u672C\u673A\u670D\u52A1")),qr}function un(n=""){n==="\u5DF2\u624B\u52A8\u6682\u505C"&&Mf(),lt++,Yr=void 0,Qn=!1,dn!=="finished"&&(dn="idle"),ee.pause(),Zi();let e=!!ct&&/本轮已停止|本轮已中断/.test(n);return n&&Ye(e?"":n),F("stopped").hidden=!e,e&&Bn("whyStopped",n),Wi()}function Jr(){$n=!1,dn="idle",fl?.abort(),fl=void 0,F("stopped").hidden=!0,F("resumed").hidden=!0,PS?.(),PS=void 0,ee.removeAttribute("src"),ee.load()}function qA(n){un(),Jr(),F("link").hidden=!0,F("linkValue").value="",nt=n,eo=Math.floor(Math.max(0,qe.indexOf(n))/50),Ye("");let e="\u7B2C "+n.number+" \u96C6",t=n.label.replace(/\s/g,"")!=="\u7B2C"+n.number+"\u96C6";Bn("subtitle",[e,t?n.label:"",n.codec].filter(Boolean).join(" \xB7 ")),Bn("time","0:00"),Wr.value="0",Yi(Wr),Zi(),n.playable||Ye("\u8BE5\u96C6\u5F53\u524D\u4E0D\u53EF\u64AD\u653E\uFF0C\u8BF7\u68C0\u67E5\u7247\u6E90\u8BB8\u53EF\u6216 FFmpeg \u81EA\u68C0\u7ED3\u679C")}function gl(){let n=Math.ceil(qe.length/50);F("groups").replaceChildren(...Array.from({length:n>1?n:0},(e,t)=>{let i=An(qe[t*50].number+"\u2013"+qe[Math.min(qe.length,(t+1)*50)-1].number,()=>{eo=t,gl()});return i.setAttribute("aria-pressed",String(t===eo)),i})),F("episodes").replaceChildren(...qe.slice(eo*50,(eo+1)*50).map(e=>{let t=An(String(e.number),()=>Uf(e));return t.disabled=!e.playable,t.title=e.label,t.dataset.id=e.id,t})),F("moreEpisodes").hidden=!kt,F("episodeCount").textContent=qe.length?Ce(qe.length+(kt?"+":"")+" \u96C6"):"",Zi()}async function no(n,e,t=!1,i){let r=i&&e;F("home").hidden=!0,F("watch").hidden=!1,F("back").focus({preventScroll:!0}),window.scrollTo(0,0),eo=0;let s=++Xn;un();let o=lt;Jr(),nt=null,qe=[],kt=void 0,ct=n,qi(),ee.poster=n.cover||"",Bn("title",n.title),Bn("subtitle","\u6B63\u5728\u8BFB\u53D6\u5206\u96C6\u2026"),gl(),JA(),await qr;let[a,l]=await Promise.all([Ie("get_episodes",{seriesId:n.id}),Ie("get_history",{seriesId:n.id})]);e??=l.items[0]?.episodeId;let c=a;if(s!==Xn)return;qe=c.items||[],kt=c.cursor;let u=new Set;for(;e&&!qe.some(h=>h.id===e)&&kt&&!u.has(kt);){if(u.add(kt),c=await Ie("get_episodes",{seriesId:n.id,cursor:kt}),s!==Xn)return;qe.push(...c.items),kt=c.cursor}let d=e&&qe.find(h=>h.id===e&&(!t||h.playable))||!r&&(t&&qe.find(h=>h.playable)||qe[0]),f=t&<===o&&Ot;d?qA(d):Bn("subtitle","\u6682\u65E0\u53EF\u7528\u5206\u96C6"),gl(),f&&d&&s===Xn&&await vl(i)}async function Uf(n){qA(n),gl(),await vl()}async function WA(){if(!ct||!kt)return;let n=Xn,e=kt;try{let t=await Ie("get_episodes",{seriesId:ct.id,cursor:e});if(n!==Xn||e!==kt)return;qe.push(...t.items),kt=t.cursor===e?void 0:t.cursor,gl()}catch(t){Ye($t(t))}}F("moreEpisodes").onclick=WA;async function YA(n=!1){if(!nt)return;let e=nt.id,t=Xn,i=lt,r=qe.slice(qe.indexOf(nt)+1).find(o=>o.playable),s=new Set;for(;!r&&kt&&!s.has(kt);){if(s.add(kt),await WA(),Xn!==t||nt?.id!==e||lt!==i)return;r=qe.slice(qe.indexOf(nt)+1).find(o=>o.playable)}!Ot||n&&!Hi.checked||(r?await Uf(r):n&&un("\u672C\u96C6\u5DF2\u64AD\u5B8C"))}F("prev").onclick=()=>{let n=qe.slice(0,qe.indexOf(nt)).reverse().find(e=>e.playable);n&&Uf(n)};F("next").onclick=()=>{YA()};F("random").onclick=()=>{let n=qe.filter(r=>r.playable),e=vr.find(r=>r.seriesId===ct?.id),t=e?n.findIndex(r=>r.id===e.episodeId):-1,i=t<0?n.slice(0,1):n.slice(Math.min(t+1,n.length-1));i.length&&Uf(i[Math.floor(Math.random()*i.length)])};async function JF(){Mf(),document.fullscreenElement&&await document.exitFullscreen(),F("stage").classList.remove("expanded"),Nf(),Ye(""),++Xn;let n=un();Jr(),nt=null,ct=null,qe=[],kt=void 0,F("home").hidden=!1,F("watch").hidden=!0,F("link").hidden=!0,bt.length?Ki():Xr(),await n,await Ff(),!ct&&bt.length&&Ki()}F("back").onclick=()=>{JF().catch(n=>Ye($t(n)))};function JA(){document.querySelectorAll(".card").forEach(n=>n.setAttribute("aria-pressed",String(n.dataset.id===ct?.id)))}function Ki(){let n=[],e=new Set(vr.map(o=>o.seriesId)),t=pl?void 0:bt.find(o=>!e.has(o.id))||bt[0],i=bt.filter(o=>o!==t),r=ew();if(r&&n.push(r),F("featured").replaceChildren(),t){let o=An("",()=>no(t,void 0,!0)),a=bl(t.title,t.episodes?Ce(t.episodes+" \u96C6"):""),l=document.createElement("span"),c=document.createElement("small"),u=document.createElement("strong"),d=document.createElement("span");if(o.className="feature",o.dataset.id=t.id,o.setAttribute("aria-label",Ce("\u64AD\u653E")+" \xB7 "+t.title),l.className="featureText",c.className="eyebrow",c.textContent=Ce(e.has(t.id)?"\u770B\u8FC7":"\u63A8\u8350"),u.textContent=t.title,l.append(c,u),t.description){let f=document.createElement("span");f.className="desc",f.textContent=t.description,l.append(f)}d.className="playPill",d.append(tr("play"),Ce("\u64AD\u653E")),l.append(d),o.append(a,l),F("featured").append(o),n.push({span:a,s:t})}qi(),F("cards").replaceChildren(...i.slice(hl*12,(hl+1)*12).map(o=>{let a=An("",()=>no(o,void 0,!0));a.className="card",a.dataset.id=o.id,a.title=o.title;let l=bl(o.title,o.episodes?Ce(o.episodes+" \u96C6"):""),c=document.createElement("span");return c.className="cardTitle",c.textContent=o.title,a.append(l,c),n.push({span:l,s:o}),a})),JA();let s=Gi;(async()=>{for(let{span:o,s:a}of n){if(s!==Gi)return;if(!a.cover&&(a.hasCover||a.lookupCover))try{a.cover=(await Ie("get_cover",{seriesId:a.id},9e3)).cover}catch{}a.cover&&(FS(o,a.cover),ct?.id===a.id&&(ee.poster=a.cover))}})()}function qi(){let e=Wt.autoPrompt&&!!qt?.turnId&&qt.state==="submitted"&&!ct&&!pl&&bt.length>0&&Of!==qt.turnId?qt.turnId:null;if(e===jA)return;jA=e,VA?.abort();let t=F("prompt"),i=F("picks");if(!e){t.hidden=!0;return}let r=VA=new AbortController;kS(t,i,r.signal,e,s=>{i.replaceChildren(...s.map(o=>An(TS(o),()=>(Ie("mark_waiting_picks_shown",{turnId:e}).catch(()=>{}),no(bt.find(a=>a.id===o.id)??o,o.episodeId,!0,e)))),An("\u66F4\u591A\u2026",()=>{XA(),F("query").focus()}))}).catch(()=>{r.signal.aborted||(t.hidden=!0)})}function XA(){Of=qt?.turnId||null,Of&&Ie("dismiss_waiting_picks",{turnId:Of}).catch(()=>{}),qi()}F("dismiss").onclick=XA;function Qs(n,e=""){let t=F("catalogStatus"),i=F("cards"),r=F("query");if(t.dataset.state=n==="loading"&&bt.length?"busy":n,t.replaceChildren(),e){let s=document.createElement("span");s.textContent=Ce(e),t.append(s)}t.dataset.state==="busy"&&t.prepend(tr("spin")),n==="error"&&t.append(An("\u91CD\u8BD5",()=>Xr())),n==="empty"&&pl&&t.append(An("\u6E05\u9664\u641C\u7D22",()=>(r.value="",Xr(!1,"")))),t.querySelectorAll("button").forEach(s=>s.className="btn"),n==="loading"&&!bt.length?i.replaceChildren(...Array.from({length:6},()=>{let s=document.createElement("div"),o=document.createElement("span"),a=document.createElement("span");return s.className="skel",s.setAttribute("aria-hidden","true"),o.className="skelArt",a.className="skelLine",s.append(o,a),s})):i.querySelector(".skel")&&i.replaceChildren()}async function Xr(n=!1,e=pl){let t=++Gi;n||(pl=e,bt=[],kn=void 0,hl=0,Ki());let i=n?hl+1:0;F("more").hidden=!0,Qs("loading","\u6B63\u5728\u8BFB\u53D6\u7247\u5E93\u2026");let r=n?[...bt]:[],s=!1;!n&&!e&&Ie("list_series",{preview:!0},9e4).then(o=>{t!==Gi||s||!o.items.length||(bt=o.items,Ki(),F("catalogStatus").dataset.state!=="error"&&Qs(""),F("more").hidden=bt.length<=13)}).catch(()=>{});try{let o=new Set,a=(i+1)*12+(e?0:1),l=!n;for(;l||r.length<a&&kn&&!o.has(kn);){l=!1,kn&&o.add(kn);let u=await Ie("list_series",{query:e,cursor:kn},9e4);if(t!==Gi)return;let d=new Set(r.map(f=>f.id));for(let f of u.items)d.has(f.id)||(d.add(f.id),r.push(f));kn=u.cursor,kn&&o.has(kn)&&(kn=void 0)}s=r.length>0,s&&(bt=r);let c=Math.max(1,Math.ceil((bt.length-(e?0:1))/12));if(n&&i>=c&&!kn&&!e){await Xr();return}hl=i%c,Ki(),bt.length?Qs(""):e?Qs("empty","\u6CA1\u6709\u627E\u5230\u76F8\u7B26\u7684\u5267\u76EE"):Qs("error","\u7EA2\u679C\u6682\u65F6\u6CA1\u6709\u8FD4\u56DE\u63A8\u8350\u5267\u76EE"),F("more").hidden=c<=1&&!kn}catch(o){t===Gi&&(Qs("error",$t(o)),F("more").hidden=!n)}}async function Ff(){vr=(await Ie("get_history")).items,ew(),F("history").replaceChildren(...vr.map(n=>{let e=document.createElement("div"),t=document.createElement("strong"),i=document.createElement("small");e.className="historyRow";let r=An("",()=>QA(n));r.className="historyItem",t.textContent=n.title,i.textContent=n.label+" \xB7 "+to(n.positionMs/1e3),r.append(t,i);let s=An("",async()=>{await qr,await Ie("remove_history",{seriesId:n.seriesId}),await Ff(),Ki()}),o=Ce("\u79FB\u9664 "+n.title+" \u7684\u89C2\u770B\u5386\u53F2");return s.className="icon sm",s.setAttribute("aria-label",o),s.title=o,s.append(tr("x")),e.append(r,s),e})),F("historyCount").textContent=vr.length?String(vr.length):"",F("resume").hidden=!vr.length}function QA(n){return no(bt.find(e=>e.id===n.seriesId)||{id:n.seriesId,title:n.title},n.episodeId,!0)}function ew(){let n=vr[0];if(!n){F("continue").replaceChildren();return}let e=bt.find(f=>f.id===n.seriesId)||{id:n.seriesId,title:n.title},t=An("",()=>QA(n)),i=bl(n.title),r=document.createElement("span"),s=document.createElement("small"),o=document.createElement("strong"),a=document.createElement("span"),l=document.createElement("span"),c=document.createElement("i"),u=document.createElement("span"),d=n.durationMs?Math.min(1,n.positionMs/n.durationMs):0;return t.className="resumeCard",t.setAttribute("aria-label",Ce("\u7EE7\u7EED\u89C2\u770B \xB7 "+n.title+" \xB7 "+n.label)),r.className="resumeText",s.className="eyebrow",s.textContent=Ce("\u7EE7\u7EED\u89C2\u770B"),o.textContent=n.title,a.className="meta",a.textContent=n.label+" \xB7 "+to(n.positionMs/1e3)+(n.durationMs?" / "+to(n.durationMs/1e3):""),l.className="bar",c.style.setProperty("--p",(d*100).toFixed(1)+"%"),l.append(c),r.append(s,o,a,l),u.className="resumePlay",u.append(tr("play")),t.append(i,r,u),F("continue").replaceChildren(t),{span:i,s:e}}function tw(){let n=qt?.state==="submitted";F("lamp").classList.toggle("on",n),Bn("state",!gr.identified&&zn?"\u672A\u5173\u8054\u5BF9\u8BDD":!qt||qt.state==="unknown"?"\u7B49\u5F85\u56DE\u5408\u5F00\u59CB":n?"\u5F53\u524D\u56DE\u5408\u8FDB\u884C\u4E2D":qt.state==="interrupted"?"\u56DE\u5408\u5DF2\u4E2D\u65AD":"\u56DE\u5408\u5DF2\u505C\u6B62")}function zf(){return Ot?($S??=XF().finally(()=>{$S=void 0}),$S):Promise.resolve()}async function XF(){try{let n=await Ie("get_run_state",{observeSession:!0,playerInstance:document.hidden?void 0:HA},1800);if(!Ot)return;if(n.preferences){let r=Wt.autoPrompt!==n.preferences.autoPrompt;Wt=n.preferences,Hi.checked=Wt.autoplayNext,r&&qi()}let e=FA(qt,n),t=UA(qt,n),i=qt?.state!==n.state||qt?.turnId!==n.turnId;qt=n,i&&qi(),tw(),e&&ct&&Wt.autoPauseOnFinish?un(e):t&&Wt.autoPlayOnStart&&ct&&nt?.playable&&ee.paused&&!Qn&&vl(n.turnId,!0)}catch{if(!Ot)return;F("lamp").classList.remove("on"),Bn("state","\u672C\u673A\u72B6\u6001\u4E0D\u53EF\u8FBE")}}function QF(){let n=ee.duration;!Number.isFinite(n)||!$n||(Wr.value=String(Math.round(ee.currentTime/n*1e3)),Yi(Wr),Bn("time",to(ee.currentTime)+" / "+to(n)))}async function vl(n,e=!1){if(!nt?.playable||!ct||!Ot)return;let t=++lt,i=nt,r=ct;Qn=!0,Zi(),F("stopped").hidden=!0;try{if(!$n){Ye("\u6B63\u5728\u51C6\u5907\u64AD\u653E\u2026");let s=await Ie("prepare_playback",{episodeId:i.id,retry:!0}),o=Date.now()+24e4;for(;s.status==="preparing"&&t===lt&&Date.now()<o;){if(Ye("\u6B63\u5728\u672C\u673A\u51C6\u5907\u6574\u96C6\u2026"),await YF(700),t!==lt)return;s=await Ie("prepare_playback",{episodeId:i.id})}if(t!==lt)return;if(s.status!=="ready")throw Error(s.reason||"\u51C6\u5907\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5");let a=s;if(zn!=="src"in a)throw Error("\u672C\u96C6\u64AD\u653E\u5730\u5740\u5DF2\u5931\u6548\uFF0C\u8BF7\u91CD\u8BD5");await qr;let l=await Ie("get_history",{seriesId:r.id,episodeId:i.id});if(t!==lt)return;Jr();let c=new AbortController;fl=c;let u=MA(ee,c.signal),d=m=>{fl===c&&(c.abort(Error(m)),$n&&(un(m),Jr()))};try{"stream"in a?PS=NA(ee,i.id,a.stream,a.manifest,d,()=>{fl===c&&nw()}):(ee.src=a.src,ee.load())}catch(m){d($t(m))}if(await u,t!==lt)return;let f=l.items[0],h=f&&f.positionMs<f.durationMs?f.positionMs/1e3:0;ee.currentTime=h>0&&h<ee.duration-5?h:0,ee.currentTime>0&&(Bn("resumeTime","\u5DF2\u4ECE "+to(h)+" \u7EE7\u7EED"),F("resumed").hidden=!1),$n=!0}if(n){let s=await Ie("get_run_state",{observeSession:!0},1800);if(t!==lt)return;if(s.turnId!==n||s.state!=="submitted"||e&&!s.preferences?.autoPlayOnStart){un(e?"":"\u8FD9\u6761\u63A8\u8350\u5DF2\u7ED3\u675F");return}}if(t!==lt||!Ot)return;Qn=!1,dn==="finished"&&(ee.currentTime=0),dn="playing",ee.playbackRate=parseFloat(F("speed").value);try{await ee.play()}catch(s){if(t!==lt||!Ot)return;if(!(s instanceof DOMException&&["AbortError","NotAllowedError"].includes(s.name))||!document.hidden&&document.hasFocus()&&Yr?.action!==t)throw s;jf();return}t===lt&&(Mf(),Ye("\u6B63\u5728\u64AD\u653E"),wS=Date.now(),Zi())}catch(s){t===lt&&($n||Jr(),un($t(s)))}}function ez(){!ee.paused||Qn?un("\u5DF2\u624B\u52A8\u6682\u505C"):vl()}for(let n of[ee,Cf,AS,F("resumePlayback")])n.addEventListener("click",ez);function nw(){!$n||dn!=="playing"||!Number.isFinite(ee.duration)||ee.currentTime<ee.duration-1||(dn="finished",Wi(),Hi.checked&&Ot?YA(!0).catch(n=>Ye($t(n))):un("\u672C\u96C6\u5DF2\u64AD\u5B8C"),qr.then(Ff).catch(()=>{}))}ee.onended=nw;Hi.onchange=()=>{Ie("set_preferences",{autoplayNext:Hi.checked}).then(n=>{Wt=n}).catch(n=>Ye($t(n)))};ee.ontimeupdate=()=>{QF(),!ee.paused&&Date.now()-wS>=5e3&&(wS=Date.now(),Wi())};ee.onpause=()=>{Zi(),$n&&Wi(),(document.hidden||!document.hasFocus()||Yr?.action===lt)&&jf()};ee.onplay=Zi;ee.onplaying=Mf;ee.onerror=()=>{$n&&(un(ES(ee.error?.code)),Jr())};Wr.oninput=()=>{Yi(Wr),$n&&Number.isFinite(ee.duration)&&(dn==="finished"&&(dn="idle"),ee.currentTime=Number(Wr.value)*ee.duration/1e3)};Wr.onchange=()=>{Wi(ee.currentTime===0)};ee.onloadedmetadata=()=>{ee.videoWidth&&ee.videoHeight&&(F("stage").style.aspectRatio=ee.videoWidth+"/"+ee.videoHeight)};F("restart").onclick=()=>{dn==="finished"&&(dn="idle"),ee.currentTime=0,F("resumed").hidden=!0,Wi(!0)};F("mute").onclick=()=>{ee.volume===0?(ee.volume=.7,ee.muted=!1):ee.muted=!ee.muted};async function rw(){let n=F("stage");if(document.fullscreenElement){await document.exitFullscreen();return}if(n.classList.contains("expanded")){n.classList.remove("expanded"),Nf();return}try{await n.requestFullscreen()}catch{n.classList.add("expanded"),Nf()}}F("fullscreen").onclick=()=>{rw().catch(n=>Ye($t(n)))};document.addEventListener("fullscreenchange",Nf);function Nf(){let n=F("stage"),e=!!document.fullscreenElement||n.classList.contains("expanded");n.classList.toggle("isFull",e),io(F("fullscreen"),e?"collapse":"expand",Ce(e?"\u9000\u51FA\u5168\u5C4F":"\u5168\u5C4F"))}var GA;F("stage").addEventListener("pointermove",()=>{let n=F("stage");n.classList.add("awake"),clearTimeout(GA),GA=setTimeout(()=>n.classList.remove("awake"),2400)});F("stage").addEventListener("pointerleave",()=>F("stage").classList.remove("awake"));document.addEventListener("keydown",n=>{n.key==="Escape"&&F("stage").classList.contains("expanded")&&rw()});var ro=F("volume");ee.onvolumechange=()=>{let n=ee.muted||ee.volume===0;io(F("mute"),n?"mute":"volume",Ce(n?"\u53D6\u6D88\u9759\u97F3":"\u9759\u97F3")),F("mute").setAttribute("aria-pressed",String(n)),ro.value=String(Math.round(ee.volume*100)),Yi(ro)};ee.volume=Number(ro.value)/100;Yi(ro);ro.oninput=()=>{ee.volume=Number(ro.value)/100,ee.muted=ee.volume===0};F("speed").onchange=n=>ee.playbackRate=parseFloat(n.target.value);var yl=F("query"),LS,Bf=!1;function DS(){clearTimeout(LS),Bf||Xr(!1,yl.value.trim())}function CS(){clearTimeout(LS),++Gi,!Bf&&(yl.value.trim()?LS=setTimeout(DS,400):DS())}yl.addEventListener("input",CS);yl.addEventListener("compositionstart",()=>{Bf=!0,CS()});yl.addEventListener("compositionend",()=>{Bf=!1,CS()});F("search").onsubmit=n=>{n.preventDefault(),DS()};F("more").onclick=()=>{Xr(!0)};async function tz(){let n=ct,e=nt;if(!(!n||!e))try{await un();let t=await Ie("create_browser_pairing",{seriesId:n.id,episodeId:e.id,title:n.title});if(ct!==n||nt!==e)return;F("linkValue").value=t.url,F("link").hidden=!1,F("link").scrollIntoView({block:"nearest"}),setTimeout(()=>{F("linkValue").value===t.url&&(F("link").hidden=!0,F("linkValue").value="")},6e4)}catch(t){Ye($t(t))}}F("pair").onclick=tz;F("copy").onclick=async()=>{let n=F("linkValue");try{await navigator.clipboard.writeText(n.value),Ye("\u5DF2\u590D\u5236\uFF0C\u8BF7\u5728 Codex \u5185\u7F6E\u6D4F\u89C8\u5668\u6253\u5F00")}catch{n.select(),Ye("\u94FE\u63A5\u5DF2\u9009\u4E2D\uFF0C\u8BF7\u590D\u5236\u5E76\u5728 Codex \u5185\u7F6E\u6D4F\u89C8\u5668\u6253\u5F00")}};F("settingsCancel").onclick=()=>F("prefs").click();F("setupOpen").onclick=()=>{F("settings").hidden=!0,F("prefs").setAttribute("aria-expanded","false"),Lf()};F("prefs").onclick=()=>{F("settings").hidden=!F("settings").hidden,F("prefs").setAttribute("aria-expanded",String(!F("settings").hidden)),F("autoPrompt").checked=Wt.autoPrompt,F("autoPauseOnFinish").checked=Wt.autoPauseOnFinish,F("autoPlayOnStart").checked=Wt.autoPlayOnStart,F("terms").value=Wt.searchTerms.join("\uFF0C")};F("settings").onsubmit=n=>{n.preventDefault();let e=F("terms").value.split(/[,,]/).map(t=>t.trim()).filter(Boolean);Ie("set_preferences",{autoPrompt:F("autoPrompt").checked,autoPauseOnFinish:F("autoPauseOnFinish").checked,autoPlayOnStart:F("autoPlayOnStart").checked,searchTerms:e}).then(async t=>{Wt=t,Hi.checked=Wt.autoplayNext,F("settings").hidden=!0,F("prefs").setAttribute("aria-expanded","false"),qi(),ct||await Xr()}).catch(t=>Ye($t(t)))};F("health").onclick=async()=>{let n=F("healthInfo");if(n.hidden=!n.hidden,F("health").setAttribute("aria-expanded",String(!n.hidden)),!n.hidden){n.textContent=Ce("\u6B63\u5728\u68C0\u67E5\u2026");try{let e=await Ie("get_health"),t=[["Node",e.runtime,!0],["\u8FDB\u5EA6\u5E93",e.database?"\u53EF\u5199":"\u4E0D\u53EF\u7528",e.database],["\u64AD\u653E\u7EC4\u4EF6",e.ffmpeg?"\u5C31\u7EEA":"\u51C6\u5907\u4E2D",e.ffmpeg]];n.replaceChildren(...t.map(([i,r,s])=>{let o=document.createElement("div"),a=document.createElement("span"),l=document.createElement("span");return o.className="healthRow "+(s?"ok":"bad"),a.textContent=Ce(i),l.textContent=Ce(r),o.append(tr(s?"check":"alert"),a,l),o}))}catch(e){n.textContent=$t(e)}}};F("choose").onclick=async()=>{try{let n=await Ie("list_sessions");F("choices").replaceChildren(...n.items.map(e=>An("\u2026"+e.suffix+" \xB7 "+new Date(e.at).toLocaleString(),async()=>{await Ie("select_session",{choice:e.choice}),gr.identified=!0,OS(Ot&&!document.hidden),F("choose").hidden=!0,F("choices").replaceChildren(),await zf()}))),n.items.length||Ye("\u8FD8\u6CA1\u6709\u672C\u673A\u56DE\u5408\u8BB0\u5F55\uFF0C\u53EF\u5148\u624B\u52A8\u89C2\u770B")}catch(n){Ye($t(n))}};function OS(n){return gr.identified?Ie("set_player_visible",{instance:HA,visible:n},1800).catch(()=>{}):Promise.resolve()}async function iw(){Ot&&(Ot=!1,await Promise.all([un("\u5DF2\u6682\u505C\uFF0C\u70B9\u51FB\u64AD\u653E\u7EE7\u7EED"),OS(!1)]))}function sw(n){if(n.action!==lt||!Ot||!$n||dn!=="playing"||!ee.paused||ee.ended||ee.error)return;let e=ee.currentTime;n.lastPosition!==void 0&&Math.abs(e-n.lastPosition)<.25||(n.lastPosition=e,ee.play().then(()=>{n.action===lt&&!ee.paused&&Ye("\u6B63\u5728\u64AD\u653E")}).catch(()=>{}))}function jf(){!Ot||dn!=="playing"||(Yr?.action!==lt&&(Yr={action:lt}),sw(Yr))}function ow(){let n=Yr;n&&(Yr=void 0,zf().then(()=>sw({action:n.action})))}function aw(){Ot&&(OS(!document.hidden),document.hidden?(jf(),Wi()):ow(),zf())}function lw(){!ml||Ot||(Ot=!0,aw())}document.addEventListener("visibilitychange",aw);window.addEventListener("blur",jf);window.addEventListener("focus",ow);window.addEventListener("pagehide",()=>{iw()});window.addEventListener("pageshow",lw);async function cw(n){if(ml)return;if(ml=!0,RS=n?.play?n.playbackId:void 0,navigator.mediaSession&&(navigator.mediaSession.setActionHandler("pause",()=>{un("\u5DF2\u624B\u52A8\u6682\u505C")}),navigator.mediaSession.setActionHandler("play",()=>{ee.paused&&!Qn&&vl()})),ZA=window.setInterval(()=>{zf()},1e3),F("pair").hidden=zn||KA,F("choose").hidden=zn||gr.identified,qt=null,tw(),lw(),zA(Ye),Ie("get_preferences").then(t=>{ml&&(Wt=t,Hi.checked=Wt.autoplayNext??!0,qi())}).catch(t=>Ye($t(t))),n?.pick){let t=n.pick;await no(t,t.episodeId,n.play,n.turnId);return}F("home").hidden=!1,F("watch").hidden=!0;let e=Xr();Ff().then(()=>{!ct&&vr.length&&bt.length&&Ki()}).catch(t=>Ye($t(t))),gr.selection&&await no({id:gr.selection.seriesId,title:gr.selection.title||"\u7EA2\u679C\u77ED\u5267"},gr.selection.episodeId),await e}function uw(){let n=iw();return ml=!1,navigator.mediaSession&&(navigator.mediaSession.setActionHandler("pause",null),navigator.mediaSession.setActionHandler("play",null)),window.clearInterval(ZA),++Xn,Jr(),n}var Df=KA?BA(n=>{cw(n).catch(e=>Ye($t(e)))},uw):null;OA(n=>{MS(DA()),gr=n,Df?n.waitingTurn&&Df.connected():cw().catch(e=>Ye($t(e)))},async()=>{Df?.dispose(),await uw()},()=>Df?.modeChanged()).catch(n=>Ye($t(n)));})();
|
|
2064
2064
|
|
|
2065
2065
|
</script>
|
|
2066
2066
|
</body>
|