@atoms-tech/atoms-mcp 0.3.5 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -14
- package/dist/apps/src/apps/browse/browse-app.html +320 -0
- package/dist/apps/src/apps/coverage/coverage-app.html +3 -3
- package/dist/apps/src/apps/editor/editor-app.html +327 -0
- package/dist/apps/src/apps/import/import-app.html +7 -7
- package/dist/apps/src/apps/mermaid/mermaid-app.html +26 -19
- package/dist/apps/src/apps/summary/summary-app.html +3 -3
- package/dist/apps/src/apps/trace/trace-app.html +86 -36
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>ATOMS Browse</title>
|
|
7
|
+
<script type="module" crossorigin>(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function o(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(r){if(r.ep)return;r.ep=!0;const s=o(r);fetch(r.href,s)}})();function d(e,t,o){function n(u,p){var f;Object.defineProperty(u,"_zod",{value:u._zod??{},enumerable:!1}),(f=u._zod).traits??(f.traits=new Set),u._zod.traits.add(e),t(u,p);for(const g in i.prototype)g in u||Object.defineProperty(u,g,{value:i.prototype[g].bind(u)});u._zod.constr=i,u._zod.def=p}const r=o?.Parent??Object;class s extends r{}Object.defineProperty(s,"name",{value:e});function i(u){var p;const f=o?.Parent?new s:this;n(f,u),(p=f._zod).deferred??(p.deferred=[]);for(const g of f._zod.deferred)g();return f}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:u=>o?.Parent&&u instanceof o.Parent?!0:u?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class de extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Xt={};function Q(e){return Xt}function Xo(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,r])=>t.indexOf(+n)===-1).map(([n,r])=>r)}function en(e,t){return typeof t=="bigint"?t.toString():t}function et(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function tt(e){return e==null}function ot(e){const t=e.startsWith("^")?1:0,o=e.endsWith("$")?e.length-1:e.length;return e.slice(t,o)}function tn(e,t){const o=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,r=o>n?o:n,s=Number.parseInt(e.toFixed(r).replace(".","")),i=Number.parseInt(t.toFixed(r).replace(".",""));return s%i/10**r}function E(e,t,o){Object.defineProperty(e,t,{get(){{const n=o();return e[t]=n,n}},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Le(e,t,o){Object.defineProperty(e,t,{value:o,writable:!0,enumerable:!0,configurable:!0})}function ue(e){return JSON.stringify(e)}const eo=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Ce(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const on=et(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Ne(e){if(Ce(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const o=t.prototype;return!(Ce(o)===!1||Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)}const nn=new Set(["string","number","symbol"]);function fe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ne(e,t,o){const n=new e._zod.constr(t??e._zod.def);return(!t||o?.parent)&&(n._zod.parent=e),n}function h(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function rn(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const sn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function an(e,t){const o={},n=e._zod.def;for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(o[r]=n.shape[r])}return ne(e,{...e._zod.def,shape:o,checks:[]})}function cn(e,t){const o={...e._zod.def.shape},n=e._zod.def;for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&delete o[r]}return ne(e,{...e._zod.def,shape:o,checks:[]})}function un(e,t){if(!Ne(t))throw new Error("Invalid input to extend: expected a plain object");const o={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Le(this,"shape",n),n},checks:[]};return ne(e,o)}function ln(e,t){return ne(e,{...e._zod.def,get shape(){const o={...e._zod.def.shape,...t._zod.def.shape};return Le(this,"shape",o),o},catchall:t._zod.def.catchall,checks:[]})}function dn(e,t,o){const n=t._zod.def.shape,r={...n};if(o)for(const s in o){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);o[s]&&(r[s]=e?new e({type:"optional",innerType:n[s]}):n[s])}else for(const s in n)r[s]=e?new e({type:"optional",innerType:n[s]}):n[s];return ne(t,{...t._zod.def,shape:r,checks:[]})}function pn(e,t,o){const n=t._zod.def.shape,r={...n};if(o)for(const s in o){if(!(s in r))throw new Error(`Unrecognized key: "${s}"`);o[s]&&(r[s]=new e({type:"nonoptional",innerType:n[s]}))}else for(const s in n)r[s]=new e({type:"nonoptional",innerType:n[s]});return ne(t,{...t._zod.def,shape:r,checks:[]})}function le(e,t=0){for(let o=t;o<e.issues.length;o++)if(e.issues[o]?.continue!==!0)return!0;return!1}function oe(e,t){return t.map(o=>{var n;return(n=o).path??(n.path=[]),o.path.unshift(e),o})}function ze(e){return typeof e=="string"?e:e?.message}function Y(e,t,o){const n={...e,path:e.path??[]};if(!e.message){const r=ze(e.inst?._zod.def?.error?.(e))??ze(t?.error?.(e))??ze(o.customError?.(e))??ze(o.localeError?.(e))??"Invalid input";n.message=r}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function nt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function pe(...e){const[t,o,n]=e;return typeof t=="string"?{message:t,code:"custom",input:o,inst:n}:{...t}}const to=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,en,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},oo=d("$ZodError",to),no=d("$ZodError",to,{Parent:Error});function mn(e,t=o=>o.message){const o={},n=[];for(const r of e.issues)r.path.length>0?(o[r.path[0]]=o[r.path[0]]||[],o[r.path[0]].push(t(r))):n.push(t(r));return{formErrors:n,fieldErrors:o}}function hn(e,t){const o=t||function(s){return s.message},n={_errors:[]},r=s=>{for(const i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(u=>r({issues:u}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(o(i));else{let u=n,p=0;for(;p<i.path.length;){const f=i.path[p];p===i.path.length-1?(u[f]=u[f]||{_errors:[]},u[f]._errors.push(o(i))):u[f]=u[f]||{_errors:[]},u=u[f],p++}}};return r(e),n}const fn=e=>(t,o,n,r)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:o,issues:[]},s);if(i instanceof Promise)throw new de;if(i.issues.length){const u=new(r?.Err??e)(i.issues.map(p=>Y(p,s,Q())));throw eo(u,r?.callee),u}return i.value},gn=e=>async(t,o,n,r)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:o,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const u=new(r?.Err??e)(i.issues.map(p=>Y(p,s,Q())));throw eo(u,r?.callee),u}return i.value},ro=e=>(t,o,n)=>{const r=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw new de;return s.issues.length?{success:!1,error:new(e??oo)(s.issues.map(i=>Y(i,r,Q())))}:{success:!0,data:s.value}},so=ro(no),io=e=>async(t,o,n)=>{const r=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:o,issues:[]},r);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>Y(i,r,Q())))}:{success:!0,data:s.value}},vn=io(no),_n=/^[cC][^\s-]{8,}$/,bn=/^[0-9a-z]+$/,wn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,yn=/^[0-9a-vA-V]{20}$/,kn=/^[A-Za-z0-9]{27}$/,Sn=/^[a-zA-Z0-9_-]{21}$/,xn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Tn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Et=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,zn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,$n="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function In(){return new RegExp($n,"u")}const Rn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,En=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Zn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Pn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Cn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ao=/^[A-Za-z0-9_-]*$/,Nn=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,qn=/^\+(?:[0-9]){6,14}[0-9]$/,co="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Mn=new RegExp(`^${co}$`);function uo(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function An(e){return new RegExp(`^${uo(e)}$`)}function On(e){const t=uo({precision:e.precision}),o=["Z"];e.local&&o.push(""),e.offset&&o.push("([+-]\\d{2}:\\d{2})");const n=`${t}(?:${o.join("|")})`;return new RegExp(`^${co}T(?:${n})$`)}const Ln=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Dn=/^\d+$/,jn=/^-?\d+(?:\.\d+)?/i,Un=/true|false/i,Hn=/null/i,Fn=/undefined/i,Bn=/^[^A-Z]*$/,Vn=/^[^a-z]*$/,U=d("$ZodCheck",(e,t)=>{var o;e._zod??(e._zod={}),e._zod.def=t,(o=e._zod).onattach??(o.onattach=[])}),lo={number:"number",bigint:"bigint",object:"date"},po=d("$ZodCheckLessThan",(e,t)=>{U.init(e,t);const o=lo[typeof t.value];e._zod.onattach.push(n=>{const r=n._zod.bag,s=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:o,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),mo=d("$ZodCheckGreaterThan",(e,t)=>{U.init(e,t);const o=lo[typeof t.value];e._zod.onattach.push(n=>{const r=n._zod.bag,s=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:o,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Wn=d("$ZodCheckMultipleOf",(e,t)=>{U.init(e,t),e._zod.onattach.push(o=>{var n;(n=o._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=o=>{if(typeof o.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof o.value=="bigint"?o.value%t.value===BigInt(0):tn(o.value,t.value)===0)||o.issues.push({origin:typeof o.value,code:"not_multiple_of",divisor:t.value,input:o.value,inst:e,continue:!t.abort})}}),Jn=d("$ZodCheckNumberFormat",(e,t)=>{U.init(e,t),t.format=t.format||"float64";const o=t.format?.includes("int"),n=o?"int":"number",[r,s]=sn[t.format];e._zod.onattach.push(i=>{const u=i._zod.bag;u.format=t.format,u.minimum=r,u.maximum=s,o&&(u.pattern=Dn)}),e._zod.check=i=>{const u=i.value;if(o){if(!Number.isInteger(u)){i.issues.push({expected:n,format:t.format,code:"invalid_type",input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?i.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):i.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}u<r&&i.issues.push({origin:"number",input:u,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),u>s&&i.issues.push({origin:"number",input:u,code:"too_big",maximum:s,inst:e})}}),Gn=d("$ZodCheckMaxLength",(e,t)=>{var o;U.init(e,t),(o=e._zod.def).when??(o.when=n=>{const r=n.value;return!tt(r)&&r.length!==void 0}),e._zod.onattach.push(n=>{const r=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const i=nt(r);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Kn=d("$ZodCheckMinLength",(e,t)=>{var o;U.init(e,t),(o=e._zod.def).when??(o.when=n=>{const r=n.value;return!tt(r)&&r.length!==void 0}),e._zod.onattach.push(n=>{const r=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const i=nt(r);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Qn=d("$ZodCheckLengthEquals",(e,t)=>{var o;U.init(e,t),(o=e._zod.def).when??(o.when=n=>{const r=n.value;return!tt(r)&&r.length!==void 0}),e._zod.onattach.push(n=>{const r=n._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=n=>{const r=n.value,s=r.length;if(s===t.length)return;const i=nt(r),u=s>t.length;n.issues.push({origin:i,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),De=d("$ZodCheckStringFormat",(e,t)=>{var o,n;U.init(e,t),e._zod.onattach.push(r=>{const s=r._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(o=e._zod).check??(o.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Yn=d("$ZodCheckRegex",(e,t)=>{De.init(e,t),e._zod.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:"regex",input:o.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Xn=d("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Bn),De.init(e,t)}),er=d("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Vn),De.init(e,t)}),tr=d("$ZodCheckIncludes",(e,t)=>{U.init(e,t);const o=fe(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${o}`:o);t.pattern=n,e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),or=d("$ZodCheckStartsWith",(e,t)=>{U.init(e,t);const o=new RegExp(`^${fe(t.prefix)}.*`);t.pattern??(t.pattern=o),e._zod.onattach.push(n=>{const r=n._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(o)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),nr=d("$ZodCheckEndsWith",(e,t)=>{U.init(e,t);const o=new RegExp(`.*${fe(t.suffix)}$`);t.pattern??(t.pattern=o),e._zod.onattach.push(n=>{const r=n._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(o)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),rr=d("$ZodCheckOverwrite",(e,t)=>{U.init(e,t),e._zod.check=o=>{o.value=t.tx(o.value)}});class sr{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
|
|
8
|
+
`).filter(i=>i),r=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(r)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,o=this?.args,r=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...o,r.join(`
|
|
9
|
+
`))}}const ir={major:4,minor:0,patch:0},R=d("$ZodType",(e,t)=>{var o;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ir;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const r of n)for(const s of r._zod.onattach)s(e);if(n.length===0)(o=e._zod).deferred??(o.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const r=(s,i,u)=>{let p=le(s),f;for(const g of i){if(g._zod.def.when){if(!g._zod.def.when(s))continue}else if(p)continue;const m=s.issues.length,v=g._zod.check(s);if(v instanceof Promise&&u?.async===!1)throw new de;if(f||v instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await v,s.issues.length!==m&&(p||(p=le(s,m)))});else{if(s.issues.length===m)continue;p||(p=le(s,m))}}return f?f.then(()=>s):s};e._zod.run=(s,i)=>{const u=e._zod.parse(s,i);if(u instanceof Promise){if(i.async===!1)throw new de;return u.then(p=>r(p,n,i))}return r(u,n,i)}}e["~standard"]={validate:r=>{try{const s=so(e,r);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return vn(e,r).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),rt=d("$ZodString",(e,t)=>{R.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ln(e._zod.bag),e._zod.parse=(o,n)=>{if(t.coerce)try{o.value=String(o.value)}catch{}return typeof o.value=="string"||o.issues.push({expected:"string",code:"invalid_type",input:o.value,inst:e}),o}}),P=d("$ZodStringFormat",(e,t)=>{De.init(e,t),rt.init(e,t)}),ar=d("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Tn),P.init(e,t)}),cr=d("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Et(n))}else t.pattern??(t.pattern=Et());P.init(e,t)}),ur=d("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=zn),P.init(e,t)}),lr=d("$ZodURL",(e,t)=>{P.init(e,t),e._zod.check=o=>{try{const n=o.value,r=new URL(n),s=r.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||o.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Nn.source,input:o.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||o.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:o.value,inst:e,continue:!t.abort})),!n.endsWith("/")&&s.endsWith("/")?o.value=s.slice(0,-1):o.value=s;return}catch{o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:e,continue:!t.abort})}}}),dr=d("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=In()),P.init(e,t)}),pr=d("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Sn),P.init(e,t)}),mr=d("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=_n),P.init(e,t)}),hr=d("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=bn),P.init(e,t)}),fr=d("$ZodULID",(e,t)=>{t.pattern??(t.pattern=wn),P.init(e,t)}),gr=d("$ZodXID",(e,t)=>{t.pattern??(t.pattern=yn),P.init(e,t)}),vr=d("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=kn),P.init(e,t)}),_r=d("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=On(t)),P.init(e,t)}),br=d("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Mn),P.init(e,t)}),wr=d("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=An(t)),P.init(e,t)}),yr=d("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=xn),P.init(e,t)}),kr=d("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Rn),P.init(e,t),e._zod.onattach.push(o=>{const n=o._zod.bag;n.format="ipv4"})}),Sr=d("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=En),P.init(e,t),e._zod.onattach.push(o=>{const n=o._zod.bag;n.format="ipv6"}),e._zod.check=o=>{try{new URL(`http://[${o.value}]`)}catch{o.issues.push({code:"invalid_format",format:"ipv6",input:o.value,inst:e,continue:!t.abort})}}}),xr=d("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Zn),P.init(e,t)}),Tr=d("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Pn),P.init(e,t),e._zod.check=o=>{const[n,r]=o.value.split("/");try{if(!r)throw new Error;const s=Number(r);if(`${s}`!==r)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${n}]`)}catch{o.issues.push({code:"invalid_format",format:"cidrv6",input:o.value,inst:e,continue:!t.abort})}}});function ho(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const zr=d("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Cn),P.init(e,t),e._zod.onattach.push(o=>{o._zod.bag.contentEncoding="base64"}),e._zod.check=o=>{ho(o.value)||o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:e,continue:!t.abort})}});function $r(e){if(!ao.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),o=t.padEnd(Math.ceil(t.length/4)*4,"=");return ho(o)}const Ir=d("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ao),P.init(e,t),e._zod.onattach.push(o=>{o._zod.bag.contentEncoding="base64url"}),e._zod.check=o=>{$r(o.value)||o.issues.push({code:"invalid_format",format:"base64url",input:o.value,inst:e,continue:!t.abort})}}),Rr=d("$ZodE164",(e,t)=>{t.pattern??(t.pattern=qn),P.init(e,t)});function Er(e,t=null){try{const o=e.split(".");if(o.length!==3)return!1;const[n]=o;if(!n)return!1;const r=JSON.parse(atob(n));return!("typ"in r&&r?.typ!=="JWT"||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}}const Zr=d("$ZodJWT",(e,t)=>{P.init(e,t),e._zod.check=o=>{Er(o.value,t.alg)||o.issues.push({code:"invalid_format",format:"jwt",input:o.value,inst:e,continue:!t.abort})}}),fo=d("$ZodNumber",(e,t)=>{R.init(e,t),e._zod.pattern=e._zod.bag.pattern??jn,e._zod.parse=(o,n)=>{if(t.coerce)try{o.value=Number(o.value)}catch{}const r=o.value;if(typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r))return o;const s=typeof r=="number"?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return o.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...s?{received:s}:{}}),o}}),Pr=d("$ZodNumber",(e,t)=>{Jn.init(e,t),fo.init(e,t)}),Cr=d("$ZodBoolean",(e,t)=>{R.init(e,t),e._zod.pattern=Un,e._zod.parse=(o,n)=>{if(t.coerce)try{o.value=!!o.value}catch{}const r=o.value;return typeof r=="boolean"||o.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),o}}),Nr=d("$ZodUndefined",(e,t)=>{R.init(e,t),e._zod.pattern=Fn,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(o,n)=>{const r=o.value;return typeof r>"u"||o.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),o}}),qr=d("$ZodNull",(e,t)=>{R.init(e,t),e._zod.pattern=Hn,e._zod.values=new Set([null]),e._zod.parse=(o,n)=>{const r=o.value;return r===null||o.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),o}}),Mr=d("$ZodUnknown",(e,t)=>{R.init(e,t),e._zod.parse=o=>o}),Ar=d("$ZodNever",(e,t)=>{R.init(e,t),e._zod.parse=(o,n)=>(o.issues.push({expected:"never",code:"invalid_type",input:o.value,inst:e}),o)});function Zt(e,t,o){e.issues.length&&t.issues.push(...oe(o,e.issues)),t.value[o]=e.value}const Or=d("$ZodArray",(e,t)=>{R.init(e,t),e._zod.parse=(o,n)=>{const r=o.value;if(!Array.isArray(r))return o.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),o;o.value=Array(r.length);const s=[];for(let i=0;i<r.length;i++){const u=r[i],p=t.element._zod.run({value:u,issues:[]},n);p instanceof Promise?s.push(p.then(f=>Zt(f,o,i))):Zt(p,o,i)}return s.length?Promise.all(s).then(()=>o):o}});function $e(e,t,o){e.issues.length&&t.issues.push(...oe(o,e.issues)),t.value[o]=e.value}function Pt(e,t,o,n){e.issues.length?n[o]===void 0?o in n?t.value[o]=void 0:t.value[o]=e.value:t.issues.push(...oe(o,e.issues)):e.value===void 0?o in n&&(t.value[o]=void 0):t.value[o]=e.value}const Lr=d("$ZodObject",(e,t)=>{R.init(e,t);const o=et(()=>{const m=Object.keys(t.shape);for(const w of m)if(!(t.shape[w]instanceof R))throw new Error(`Invalid element at key "${w}": expected a Zod schema`);const v=rn(t.shape);return{shape:t.shape,keys:m,keySet:new Set(m),numKeys:m.length,optionalKeys:new Set(v)}});E(e._zod,"propValues",()=>{const m=t.shape,v={};for(const w in m){const M=m[w]._zod;if(M.values){v[w]??(v[w]=new Set);for(const B of M.values)v[w].add(B)}}return v});const n=m=>{const v=new sr(["shape","payload","ctx"]),w=o.value,M=S=>{const k=ue(S);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};v.write("const input = payload.value;");const B=Object.create(null);let ae=0;for(const S of w.keys)B[S]=`key_${ae++}`;v.write("const newResult = {}");for(const S of w.keys)if(w.optionalKeys.has(S)){const k=B[S];v.write(`const ${k} = ${M(S)};`);const Z=ue(S);v.write(`
|
|
10
|
+
if (${k}.issues.length) {
|
|
11
|
+
if (input[${Z}] === undefined) {
|
|
12
|
+
if (${Z} in input) {
|
|
13
|
+
newResult[${Z}] = undefined;
|
|
14
|
+
}
|
|
15
|
+
} else {
|
|
16
|
+
payload.issues = payload.issues.concat(
|
|
17
|
+
${k}.issues.map((iss) => ({
|
|
18
|
+
...iss,
|
|
19
|
+
path: iss.path ? [${Z}, ...iss.path] : [${Z}],
|
|
20
|
+
}))
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
} else if (${k}.value === undefined) {
|
|
24
|
+
if (${Z} in input) newResult[${Z}] = undefined;
|
|
25
|
+
} else {
|
|
26
|
+
newResult[${Z}] = ${k}.value;
|
|
27
|
+
}
|
|
28
|
+
`)}else{const k=B[S];v.write(`const ${k} = ${M(S)};`),v.write(`
|
|
29
|
+
if (${k}.issues.length) payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
|
|
30
|
+
...iss,
|
|
31
|
+
path: iss.path ? [${ue(S)}, ...iss.path] : [${ue(S)}]
|
|
32
|
+
})));`),v.write(`newResult[${ue(S)}] = ${k}.value`)}v.write("payload.value = newResult;"),v.write("return payload;");const X=v.compile();return(S,k)=>X(m,S,k)};let r;const s=Ce,i=!Xt.jitless,p=i&&on.value,f=t.catchall;let g;e._zod.parse=(m,v)=>{g??(g=o.value);const w=m.value;if(!s(w))return m.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),m;const M=[];if(i&&p&&v?.async===!1&&v.jitless!==!0)r||(r=n(t.shape)),m=r(m,v);else{m.value={};const k=g.shape;for(const Z of g.keys){const ce=k[Z],Te=ce._zod.run({value:w[Z],issues:[]},v),It=ce._zod.optin==="optional"&&ce._zod.optout==="optional";Te instanceof Promise?M.push(Te.then(Rt=>It?Pt(Rt,m,Z,w):$e(Rt,m,Z))):It?Pt(Te,m,Z,w):$e(Te,m,Z)}}if(!f)return M.length?Promise.all(M).then(()=>m):m;const B=[],ae=g.keySet,X=f._zod,S=X.def.type;for(const k of Object.keys(w)){if(ae.has(k))continue;if(S==="never"){B.push(k);continue}const Z=X.run({value:w[k],issues:[]},v);Z instanceof Promise?M.push(Z.then(ce=>$e(ce,m,k))):$e(Z,m,k)}return B.length&&m.issues.push({code:"unrecognized_keys",keys:B,input:w,inst:e}),M.length?Promise.all(M).then(()=>m):m}});function Ct(e,t,o,n){for(const r of e)if(r.issues.length===0)return t.value=r.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:o,errors:e.map(r=>r.issues.map(s=>Y(s,n,Q())))}),t}const go=d("$ZodUnion",(e,t)=>{R.init(e,t),E(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),E(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),E(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),E(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${o.map(n=>ot(n.source)).join("|")})$`)}}),e._zod.parse=(o,n)=>{let r=!1;const s=[];for(const i of t.options){const u=i._zod.run({value:o.value,issues:[]},n);if(u instanceof Promise)s.push(u),r=!0;else{if(u.issues.length===0)return u;s.push(u)}}return r?Promise.all(s).then(i=>Ct(i,o,e,n)):Ct(s,o,e,n)}}),Dr=d("$ZodDiscriminatedUnion",(e,t)=>{go.init(e,t);const o=e._zod.parse;E(e._zod,"propValues",()=>{const r={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[u,p]of Object.entries(i)){r[u]||(r[u]=new Set);for(const f of p)r[u].add(f)}}return r});const n=et(()=>{const r=t.options,s=new Map;for(const i of r){const u=i._zod.propValues[t.discriminator];if(!u||u.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const p of u){if(s.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);s.set(p,i)}}return s});e._zod.parse=(r,s)=>{const i=r.value;if(!Ce(i))return r.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),r;const u=n.value.get(i?.[t.discriminator]);return u?u._zod.run(r,s):t.unionFallback?o(r,s):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[t.discriminator],inst:e}),r)}}),jr=d("$ZodIntersection",(e,t)=>{R.init(e,t),e._zod.parse=(o,n)=>{const r=o.value,s=t.left._zod.run({value:r,issues:[]},n),i=t.right._zod.run({value:r,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([p,f])=>Nt(o,p,f)):Nt(o,s,i)}});function Ke(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ne(e)&&Ne(t)){const o=Object.keys(t),n=Object.keys(e).filter(s=>o.indexOf(s)!==-1),r={...e,...t};for(const s of n){const i=Ke(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};r[s]=i.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const o=[];for(let n=0;n<e.length;n++){const r=e[n],s=t[n],i=Ke(r,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};o.push(i.data)}return{valid:!0,data:o}}return{valid:!1,mergeErrorPath:[]}}function Nt(e,t,o){if(t.issues.length&&e.issues.push(...t.issues),o.issues.length&&e.issues.push(...o.issues),le(e))return e;const n=Ke(t.value,o.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const Ur=d("$ZodRecord",(e,t)=>{R.init(e,t),e._zod.parse=(o,n)=>{const r=o.value;if(!Ne(r))return o.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),o;const s=[];if(t.keyType._zod.values){const i=t.keyType._zod.values;o.value={};for(const p of i)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){const f=t.valueType._zod.run({value:r[p],issues:[]},n);f instanceof Promise?s.push(f.then(g=>{g.issues.length&&o.issues.push(...oe(p,g.issues)),o.value[p]=g.value})):(f.issues.length&&o.issues.push(...oe(p,f.issues)),o.value[p]=f.value)}let u;for(const p in r)i.has(p)||(u=u??[],u.push(p));u&&u.length>0&&o.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:u})}else{o.value={};for(const i of Reflect.ownKeys(r)){if(i==="__proto__")continue;const u=t.keyType._zod.run({value:i,issues:[]},n);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){o.issues.push({origin:"record",code:"invalid_key",issues:u.issues.map(f=>Y(f,n,Q())),input:i,path:[i],inst:e}),o.value[u.value]=u.value;continue}const p=t.valueType._zod.run({value:r[i],issues:[]},n);p instanceof Promise?s.push(p.then(f=>{f.issues.length&&o.issues.push(...oe(i,f.issues)),o.value[u.value]=f.value})):(p.issues.length&&o.issues.push(...oe(i,p.issues)),o.value[u.value]=p.value)}}return s.length?Promise.all(s).then(()=>o):o}}),Hr=d("$ZodEnum",(e,t)=>{R.init(e,t);const o=Xo(t.entries);e._zod.values=new Set(o),e._zod.pattern=new RegExp(`^(${o.filter(n=>nn.has(typeof n)).map(n=>typeof n=="string"?fe(n):n.toString()).join("|")})$`),e._zod.parse=(n,r)=>{const s=n.value;return e._zod.values.has(s)||n.issues.push({code:"invalid_value",values:o,input:s,inst:e}),n}}),Fr=d("$ZodLiteral",(e,t)=>{R.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?fe(o):o?o.toString():String(o)).join("|")})$`),e._zod.parse=(o,n)=>{const r=o.value;return e._zod.values.has(r)||o.issues.push({code:"invalid_value",values:t.values,input:r,inst:e}),o}}),Br=d("$ZodTransform",(e,t)=>{R.init(e,t),e._zod.parse=(o,n)=>{const r=t.transform(o.value,o);if(n.async)return(r instanceof Promise?r:Promise.resolve(r)).then(i=>(o.value=i,o));if(r instanceof Promise)throw new de;return o.value=r,o}}),Vr=d("$ZodOptional",(e,t)=>{R.init(e,t),e._zod.optin="optional",e._zod.optout="optional",E(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),E(e._zod,"pattern",()=>{const o=t.innerType._zod.pattern;return o?new RegExp(`^(${ot(o.source)})?$`):void 0}),e._zod.parse=(o,n)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(o,n):o.value===void 0?o:t.innerType._zod.run(o,n)}),Wr=d("$ZodNullable",(e,t)=>{R.init(e,t),E(e._zod,"optin",()=>t.innerType._zod.optin),E(e._zod,"optout",()=>t.innerType._zod.optout),E(e._zod,"pattern",()=>{const o=t.innerType._zod.pattern;return o?new RegExp(`^(${ot(o.source)}|null)$`):void 0}),E(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(o,n)=>o.value===null?o:t.innerType._zod.run(o,n)}),Jr=d("$ZodDefault",(e,t)=>{R.init(e,t),e._zod.optin="optional",E(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,n)=>{if(o.value===void 0)return o.value=t.defaultValue,o;const r=t.innerType._zod.run(o,n);return r instanceof Promise?r.then(s=>qt(s,t)):qt(r,t)}});function qt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Gr=d("$ZodPrefault",(e,t)=>{R.init(e,t),e._zod.optin="optional",E(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,n)=>(o.value===void 0&&(o.value=t.defaultValue),t.innerType._zod.run(o,n))}),Kr=d("$ZodNonOptional",(e,t)=>{R.init(e,t),E(e._zod,"values",()=>{const o=t.innerType._zod.values;return o?new Set([...o].filter(n=>n!==void 0)):void 0}),e._zod.parse=(o,n)=>{const r=t.innerType._zod.run(o,n);return r instanceof Promise?r.then(s=>Mt(s,e)):Mt(r,e)}});function Mt(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Qr=d("$ZodCatch",(e,t)=>{R.init(e,t),e._zod.optin="optional",E(e._zod,"optout",()=>t.innerType._zod.optout),E(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,n)=>{const r=t.innerType._zod.run(o,n);return r instanceof Promise?r.then(s=>(o.value=s.value,s.issues.length&&(o.value=t.catchValue({...o,error:{issues:s.issues.map(i=>Y(i,n,Q()))},input:o.value}),o.issues=[]),o)):(o.value=r.value,r.issues.length&&(o.value=t.catchValue({...o,error:{issues:r.issues.map(s=>Y(s,n,Q()))},input:o.value}),o.issues=[]),o)}}),Yr=d("$ZodPipe",(e,t)=>{R.init(e,t),E(e._zod,"values",()=>t.in._zod.values),E(e._zod,"optin",()=>t.in._zod.optin),E(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(o,n)=>{const r=t.in._zod.run(o,n);return r instanceof Promise?r.then(s=>At(s,t,n)):At(r,t,n)}});function At(e,t,o){return le(e)?e:t.out._zod.run({value:e.value,issues:e.issues},o)}const Xr=d("$ZodReadonly",(e,t)=>{R.init(e,t),E(e._zod,"propValues",()=>t.innerType._zod.propValues),E(e._zod,"values",()=>t.innerType._zod.values),E(e._zod,"optin",()=>t.innerType._zod.optin),E(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(o,n)=>{const r=t.innerType._zod.run(o,n);return r instanceof Promise?r.then(Ot):Ot(r)}});function Ot(e){return e.value=Object.freeze(e.value),e}const es=d("$ZodCustom",(e,t)=>{U.init(e,t),R.init(e,t),e._zod.parse=(o,n)=>o,e._zod.check=o=>{const n=o.value,r=t.fn(n);if(r instanceof Promise)return r.then(s=>Lt(s,o,n,e));Lt(r,o,n,e)}});function Lt(e,t,o,n){if(!e){const r={code:"custom",input:o,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(r.params=n._zod.def.params),t.issues.push(pe(r))}}class ts{constructor(){this._map=new Map,this._idmap=new Map}add(t,...o){const n=o[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const o=this._map.get(t);return o&&typeof o=="object"&&"id"in o&&this._idmap.delete(o.id),this._map.delete(t),this}get(t){const o=t._zod.parent;if(o){const n={...this.get(o)??{}};return delete n.id,{...n,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function os(){return new ts}const Ie=os();function ns(e,t){return new e({type:"string",...h(t)})}function rs(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...h(t)})}function Dt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...h(t)})}function ss(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...h(t)})}function is(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...h(t)})}function as(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...h(t)})}function cs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...h(t)})}function us(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...h(t)})}function ls(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...h(t)})}function ds(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...h(t)})}function ps(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...h(t)})}function ms(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...h(t)})}function hs(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...h(t)})}function fs(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...h(t)})}function gs(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...h(t)})}function vs(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...h(t)})}function _s(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...h(t)})}function bs(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...h(t)})}function ws(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...h(t)})}function ys(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...h(t)})}function ks(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...h(t)})}function Ss(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...h(t)})}function xs(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...h(t)})}function Ts(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...h(t)})}function zs(e,t){return new e({type:"string",format:"date",check:"string_format",...h(t)})}function $s(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...h(t)})}function Is(e,t){return new e({type:"string",format:"duration",check:"string_format",...h(t)})}function Rs(e,t){return new e({type:"number",checks:[],...h(t)})}function Es(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...h(t)})}function Zs(e,t){return new e({type:"boolean",...h(t)})}function Ps(e,t){return new e({type:"undefined",...h(t)})}function Cs(e,t){return new e({type:"null",...h(t)})}function Ns(e){return new e({type:"unknown"})}function qs(e,t){return new e({type:"never",...h(t)})}function jt(e,t){return new po({check:"less_than",...h(t),value:e,inclusive:!1})}function Ve(e,t){return new po({check:"less_than",...h(t),value:e,inclusive:!0})}function Ut(e,t){return new mo({check:"greater_than",...h(t),value:e,inclusive:!1})}function We(e,t){return new mo({check:"greater_than",...h(t),value:e,inclusive:!0})}function Ht(e,t){return new Wn({check:"multiple_of",...h(t),value:e})}function vo(e,t){return new Gn({check:"max_length",...h(t),maximum:e})}function qe(e,t){return new Kn({check:"min_length",...h(t),minimum:e})}function _o(e,t){return new Qn({check:"length_equals",...h(t),length:e})}function Ms(e,t){return new Yn({check:"string_format",format:"regex",...h(t),pattern:e})}function As(e){return new Xn({check:"string_format",format:"lowercase",...h(e)})}function Os(e){return new er({check:"string_format",format:"uppercase",...h(e)})}function Ls(e,t){return new tr({check:"string_format",format:"includes",...h(t),includes:e})}function Ds(e,t){return new or({check:"string_format",format:"starts_with",...h(t),prefix:e})}function js(e,t){return new nr({check:"string_format",format:"ends_with",...h(t),suffix:e})}function ge(e){return new rr({check:"overwrite",tx:e})}function Us(e){return ge(t=>t.normalize(e))}function Hs(){return ge(e=>e.trim())}function Fs(){return ge(e=>e.toLowerCase())}function Bs(){return ge(e=>e.toUpperCase())}function Vs(e,t,o){return new e({type:"array",element:t,...h(o)})}function Ws(e,t,o){const n=h(o);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Js(e,t,o){return new e({type:"custom",check:"custom",fn:t,...h(o)})}function st(e){return!!e._zod}function bo(e,t){return st(e)?so(e,t):e.safeParse(t)}function Gs(e){if(!e)return;let t;if(st(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Ks(e){if(st(e)){const s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}const o=e._def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}const n=e.value;if(n!==void 0)return n}const Qs=d("ZodISODateTime",(e,t)=>{_r.init(e,t),N.init(e,t)});function wo(e){return Ts(Qs,e)}const Ys=d("ZodISODate",(e,t)=>{br.init(e,t),N.init(e,t)});function Xs(e){return zs(Ys,e)}const ei=d("ZodISOTime",(e,t)=>{wr.init(e,t),N.init(e,t)});function ti(e){return $s(ei,e)}const oi=d("ZodISODuration",(e,t)=>{yr.init(e,t),N.init(e,t)});function ni(e){return Is(oi,e)}const ri=(e,t)=>{oo.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:o=>hn(e,o)},flatten:{value:o=>mn(e,o)},addIssue:{value:o=>e.issues.push(o)},addIssues:{value:o=>e.issues.push(...o)},isEmpty:{get(){return e.issues.length===0}}})},je=d("ZodError",ri,{Parent:Error}),si=fn(je),ii=gn(je),ai=ro(je),ci=io(je),C=d("ZodType",(e,t)=>(R.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...o)=>e.clone({...t,checks:[...t.checks??[],...o.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(o,n)=>ne(e,o,n),e.brand=()=>e,e.register=((o,n)=>(o.add(e,n),e)),e.parse=(o,n)=>si(e,o,n,{callee:e.parse}),e.safeParse=(o,n)=>ai(e,o,n),e.parseAsync=async(o,n)=>ii(e,o,n,{callee:e.parseAsync}),e.safeParseAsync=async(o,n)=>ci(e,o,n),e.spa=e.safeParseAsync,e.refine=(o,n)=>e.check(Xi(o,n)),e.superRefine=o=>e.check(ea(o)),e.overwrite=o=>e.check(ge(o)),e.optional=()=>q(e),e.nullable=()=>Vt(e),e.nullish=()=>q(Vt(e)),e.nonoptional=o=>Bi(e,o),e.array=()=>_(e),e.or=o=>y([e,o]),e.and=o=>it(e,o),e.transform=o=>Xe(e,$o(o)),e.default=o=>Ui(e,o),e.prefault=o=>Fi(e,o),e.catch=o=>Wi(e,o),e.pipe=o=>Xe(e,o),e.readonly=()=>Ki(e),e.describe=o=>{const n=e.clone();return Ie.add(n,{description:o}),n},Object.defineProperty(e,"description",{get(){return Ie.get(e)?.description},configurable:!0}),e.meta=(...o)=>{if(o.length===0)return Ie.get(e);const n=e.clone();return Ie.add(n,o[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),yo=d("_ZodString",(e,t)=>{rt.init(e,t),C.init(e,t);const o=e._zod.bag;e.format=o.format??null,e.minLength=o.minimum??null,e.maxLength=o.maximum??null,e.regex=(...n)=>e.check(Ms(...n)),e.includes=(...n)=>e.check(Ls(...n)),e.startsWith=(...n)=>e.check(Ds(...n)),e.endsWith=(...n)=>e.check(js(...n)),e.min=(...n)=>e.check(qe(...n)),e.max=(...n)=>e.check(vo(...n)),e.length=(...n)=>e.check(_o(...n)),e.nonempty=(...n)=>e.check(qe(1,...n)),e.lowercase=n=>e.check(As(n)),e.uppercase=n=>e.check(Os(n)),e.trim=()=>e.check(Hs()),e.normalize=(...n)=>e.check(Us(...n)),e.toLowerCase=()=>e.check(Fs()),e.toUpperCase=()=>e.check(Bs())}),ui=d("ZodString",(e,t)=>{rt.init(e,t),yo.init(e,t),e.email=o=>e.check(rs(li,o)),e.url=o=>e.check(us(di,o)),e.jwt=o=>e.check(xs(zi,o)),e.emoji=o=>e.check(ls(pi,o)),e.guid=o=>e.check(Dt(Ft,o)),e.uuid=o=>e.check(ss(Re,o)),e.uuidv4=o=>e.check(is(Re,o)),e.uuidv6=o=>e.check(as(Re,o)),e.uuidv7=o=>e.check(cs(Re,o)),e.nanoid=o=>e.check(ds(mi,o)),e.guid=o=>e.check(Dt(Ft,o)),e.cuid=o=>e.check(ps(hi,o)),e.cuid2=o=>e.check(ms(fi,o)),e.ulid=o=>e.check(hs(gi,o)),e.base64=o=>e.check(ys(Si,o)),e.base64url=o=>e.check(ks(xi,o)),e.xid=o=>e.check(fs(vi,o)),e.ksuid=o=>e.check(gs(_i,o)),e.ipv4=o=>e.check(vs(bi,o)),e.ipv6=o=>e.check(_s(wi,o)),e.cidrv4=o=>e.check(bs(yi,o)),e.cidrv6=o=>e.check(ws(ki,o)),e.e164=o=>e.check(Ss(Ti,o)),e.datetime=o=>e.check(wo(o)),e.date=o=>e.check(Xs(o)),e.time=o=>e.check(ti(o)),e.duration=o=>e.check(ni(o))});function c(e){return ns(ui,e)}const N=d("ZodStringFormat",(e,t)=>{P.init(e,t),yo.init(e,t)}),li=d("ZodEmail",(e,t)=>{ur.init(e,t),N.init(e,t)}),Ft=d("ZodGUID",(e,t)=>{ar.init(e,t),N.init(e,t)}),Re=d("ZodUUID",(e,t)=>{cr.init(e,t),N.init(e,t)}),di=d("ZodURL",(e,t)=>{lr.init(e,t),N.init(e,t)}),pi=d("ZodEmoji",(e,t)=>{dr.init(e,t),N.init(e,t)}),mi=d("ZodNanoID",(e,t)=>{pr.init(e,t),N.init(e,t)}),hi=d("ZodCUID",(e,t)=>{mr.init(e,t),N.init(e,t)}),fi=d("ZodCUID2",(e,t)=>{hr.init(e,t),N.init(e,t)}),gi=d("ZodULID",(e,t)=>{fr.init(e,t),N.init(e,t)}),vi=d("ZodXID",(e,t)=>{gr.init(e,t),N.init(e,t)}),_i=d("ZodKSUID",(e,t)=>{vr.init(e,t),N.init(e,t)}),bi=d("ZodIPv4",(e,t)=>{kr.init(e,t),N.init(e,t)}),wi=d("ZodIPv6",(e,t)=>{Sr.init(e,t),N.init(e,t)}),yi=d("ZodCIDRv4",(e,t)=>{xr.init(e,t),N.init(e,t)}),ki=d("ZodCIDRv6",(e,t)=>{Tr.init(e,t),N.init(e,t)}),Si=d("ZodBase64",(e,t)=>{zr.init(e,t),N.init(e,t)}),xi=d("ZodBase64URL",(e,t)=>{Ir.init(e,t),N.init(e,t)}),Ti=d("ZodE164",(e,t)=>{Rr.init(e,t),N.init(e,t)}),zi=d("ZodJWT",(e,t)=>{Zr.init(e,t),N.init(e,t)}),ko=d("ZodNumber",(e,t)=>{fo.init(e,t),C.init(e,t),e.gt=(n,r)=>e.check(Ut(n,r)),e.gte=(n,r)=>e.check(We(n,r)),e.min=(n,r)=>e.check(We(n,r)),e.lt=(n,r)=>e.check(jt(n,r)),e.lte=(n,r)=>e.check(Ve(n,r)),e.max=(n,r)=>e.check(Ve(n,r)),e.int=n=>e.check(Bt(n)),e.safe=n=>e.check(Bt(n)),e.positive=n=>e.check(Ut(0,n)),e.nonnegative=n=>e.check(We(0,n)),e.negative=n=>e.check(jt(0,n)),e.nonpositive=n=>e.check(Ve(0,n)),e.multipleOf=(n,r)=>e.check(Ht(n,r)),e.step=(n,r)=>e.check(Ht(n,r)),e.finite=()=>e;const o=e._zod.bag;e.minValue=Math.max(o.minimum??Number.NEGATIVE_INFINITY,o.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(o.maximum??Number.POSITIVE_INFINITY,o.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(o.format??"").includes("int")||Number.isSafeInteger(o.multipleOf??.5),e.isFinite=!0,e.format=o.format??null});function b(e){return Rs(ko,e)}const $i=d("ZodNumberFormat",(e,t)=>{Pr.init(e,t),ko.init(e,t)});function Bt(e){return Es($i,e)}const Ii=d("ZodBoolean",(e,t)=>{Cr.init(e,t),C.init(e,t)});function I(e){return Zs(Ii,e)}const Ri=d("ZodUndefined",(e,t)=>{Nr.init(e,t),C.init(e,t)});function Qe(e){return Ps(Ri,e)}const Ei=d("ZodNull",(e,t)=>{qr.init(e,t),C.init(e,t)});function So(e){return Cs(Ei,e)}const Zi=d("ZodUnknown",(e,t)=>{Mr.init(e,t),C.init(e,t)});function $(){return Ns(Zi)}const Pi=d("ZodNever",(e,t)=>{Ar.init(e,t),C.init(e,t)});function Ci(e){return qs(Pi,e)}const Ni=d("ZodArray",(e,t)=>{Or.init(e,t),C.init(e,t),e.element=t.element,e.min=(o,n)=>e.check(qe(o,n)),e.nonempty=o=>e.check(qe(1,o)),e.max=(o,n)=>e.check(vo(o,n)),e.length=(o,n)=>e.check(_o(o,n)),e.unwrap=()=>e.element});function _(e,t){return Vs(Ni,e,t)}const xo=d("ZodObject",(e,t)=>{Lr.init(e,t),C.init(e,t),E(e,"shape",()=>t.shape),e.keyof=()=>H(Object.keys(e._zod.def.shape)),e.catchall=o=>e.clone({...e._zod.def,catchall:o}),e.passthrough=()=>e.clone({...e._zod.def,catchall:$()}),e.loose=()=>e.clone({...e._zod.def,catchall:$()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ci()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=o=>un(e,o),e.merge=o=>ln(e,o),e.pick=o=>an(e,o),e.omit=o=>cn(e,o),e.partial=(...o)=>dn(Io,e,o[0]),e.required=(...o)=>pn(Ro,e,o[0])});function l(e,t){const o={type:"object",get shape(){return Le(this,"shape",{...e}),this.shape},...h(t)};return new xo(o)}function j(e,t){return new xo({type:"object",get shape(){return Le(this,"shape",{...e}),this.shape},catchall:$(),...h(t)})}const To=d("ZodUnion",(e,t)=>{go.init(e,t),C.init(e,t),e.options=t.options});function y(e,t){return new To({type:"union",options:e,...h(t)})}const qi=d("ZodDiscriminatedUnion",(e,t)=>{To.init(e,t),Dr.init(e,t)});function zo(e,t,o){return new qi({type:"union",options:t,discriminator:e,...h(o)})}const Mi=d("ZodIntersection",(e,t)=>{jr.init(e,t),C.init(e,t)});function it(e,t){return new Mi({type:"intersection",left:e,right:t})}const Ai=d("ZodRecord",(e,t)=>{Ur.init(e,t),C.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function z(e,t,o){return new Ai({type:"record",keyType:e,valueType:t,...h(o)})}const Ye=d("ZodEnum",(e,t)=>{Hr.init(e,t),C.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const o=new Set(Object.keys(t.entries));e.extract=(n,r)=>{const s={};for(const i of n)if(o.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Ye({...t,checks:[],...h(r),entries:s})},e.exclude=(n,r)=>{const s={...t.entries};for(const i of n)if(o.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Ye({...t,checks:[],...h(r),entries:s})}});function H(e,t){const o=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Ye({type:"enum",entries:o,...h(t)})}const Oi=d("ZodLiteral",(e,t)=>{Fr.init(e,t),C.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function a(e,t){return new Oi({type:"literal",values:Array.isArray(e)?e:[e],...h(t)})}const Li=d("ZodTransform",(e,t)=>{Br.init(e,t),C.init(e,t),e._zod.parse=(o,n)=>{o.addIssue=s=>{if(typeof s=="string")o.issues.push(pe(s,o.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=o.value),i.inst??(i.inst=e),i.continue??(i.continue=!0),o.issues.push(pe(i))}};const r=t.transform(o.value,o);return r instanceof Promise?r.then(s=>(o.value=s,o)):(o.value=r,o)}});function $o(e){return new Li({type:"transform",transform:e})}const Io=d("ZodOptional",(e,t)=>{Vr.init(e,t),C.init(e,t),e.unwrap=()=>e._zod.def.innerType});function q(e){return new Io({type:"optional",innerType:e})}const Di=d("ZodNullable",(e,t)=>{Wr.init(e,t),C.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Vt(e){return new Di({type:"nullable",innerType:e})}const ji=d("ZodDefault",(e,t)=>{Jr.init(e,t),C.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ui(e,t){return new ji({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const Hi=d("ZodPrefault",(e,t)=>{Gr.init(e,t),C.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Fi(e,t){return new Hi({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const Ro=d("ZodNonOptional",(e,t)=>{Kr.init(e,t),C.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Bi(e,t){return new Ro({type:"nonoptional",innerType:e,...h(t)})}const Vi=d("ZodCatch",(e,t)=>{Qr.init(e,t),C.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Wi(e,t){return new Vi({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Ji=d("ZodPipe",(e,t)=>{Yr.init(e,t),C.init(e,t),e.in=t.in,e.out=t.out});function Xe(e,t){return new Ji({type:"pipe",in:e,out:t})}const Gi=d("ZodReadonly",(e,t)=>{Xr.init(e,t),C.init(e,t)});function Ki(e){return new Gi({type:"readonly",innerType:e})}const Eo=d("ZodCustom",(e,t)=>{es.init(e,t),C.init(e,t)});function Qi(e){const t=new U({check:"custom"});return t._zod.check=e,t}function Yi(e,t){return Ws(Eo,e??(()=>!0),t)}function Xi(e,t={}){return Js(Eo,e,t)}function ea(e){const t=Qi(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(pe(n,o.value,t._zod.def));else{const r=n;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=o.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),o.issues.push(pe(r))}},e(o.value,o)));return t}function Zo(e,t){return Xe($o(e),t)}const te="io.modelcontextprotocol/related-task",Ue="2.0",O=Yi(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Po=y([c(),b().int()]),Co=c();j({ttl:y([b(),So()]).optional(),pollInterval:b().optional()});const ta=l({ttl:b().optional()}),oa=l({taskId:c()}),at=j({progressToken:Po.optional(),[te]:oa.optional()}),F=l({_meta:at.optional()}),ve=F.extend({task:ta.optional()}),na=e=>ve.safeParse(e).success,L=l({method:c(),params:F.loose().optional()}),V=l({_meta:at.optional()}),W=l({method:c(),params:V.loose().optional()}),D=j({_meta:at.optional()}),_e=y([c(),b().int()]),No=l({jsonrpc:a(Ue),id:_e,...L.shape}).strict(),Wt=e=>No.safeParse(e).success,qo=l({jsonrpc:a(Ue),...W.shape}).strict(),ra=e=>qo.safeParse(e).success,ct=l({jsonrpc:a(Ue),id:_e,result:D}).strict(),Ee=e=>ct.safeParse(e).success;var T;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(T||(T={}));const ut=l({jsonrpc:a(Ue),id:_e.optional(),error:l({code:b().int(),message:c(),data:$().optional()})}).strict(),sa=e=>ut.safeParse(e).success,ia=y([No,qo,ct,ut]);y([ct,ut]);const lt=D.strict(),aa=V.extend({requestId:_e.optional(),reason:c().optional()}),dt=W.extend({method:a("notifications/cancelled"),params:aa}),ca=l({src:c(),mimeType:c().optional(),sizes:_(c()).optional(),theme:H(["light","dark"]).optional()}),be=l({icons:_(ca).optional()}),se=l({name:c(),title:c().optional()}),He=se.extend({...se.shape,...be.shape,version:c(),websiteUrl:c().optional(),description:c().optional()}),ua=it(l({applyDefaults:I().optional()}),z(c(),$())),la=Zo(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,it(l({form:ua.optional(),url:O.optional()}),z(c(),$()).optional())),da=j({list:O.optional(),cancel:O.optional(),requests:j({sampling:j({createMessage:O.optional()}).optional(),elicitation:j({create:O.optional()}).optional()}).optional()}),pa=j({list:O.optional(),cancel:O.optional(),requests:j({tools:j({call:O.optional()}).optional()}).optional()}),ma=l({experimental:z(c(),O).optional(),sampling:l({context:O.optional(),tools:O.optional()}).optional(),elicitation:la.optional(),roots:l({listChanged:I().optional()}).optional(),tasks:da.optional()}),ha=F.extend({protocolVersion:c(),capabilities:ma,clientInfo:He}),fa=L.extend({method:a("initialize"),params:ha}),ga=l({experimental:z(c(),O).optional(),logging:O.optional(),completions:O.optional(),prompts:l({listChanged:I().optional()}).optional(),resources:l({subscribe:I().optional(),listChanged:I().optional()}).optional(),tools:l({listChanged:I().optional()}).optional(),tasks:pa.optional()}),va=D.extend({protocolVersion:c(),capabilities:ga,serverInfo:He,instructions:c().optional()}),_a=W.extend({method:a("notifications/initialized"),params:V.optional()}),Fe=L.extend({method:a("ping"),params:F.optional()}),ba=l({progress:b(),total:q(b()),message:q(c())}),wa=l({...V.shape,...ba.shape,progressToken:Po}),pt=W.extend({method:a("notifications/progress"),params:wa}),ya=F.extend({cursor:Co.optional()}),we=L.extend({params:ya.optional()}),ye=D.extend({nextCursor:Co.optional()}),ka=H(["working","input_required","completed","failed","cancelled"]),ke=l({taskId:c(),status:ka,ttl:y([b(),So()]),createdAt:c(),lastUpdatedAt:c(),pollInterval:q(b()),statusMessage:q(c())}),mt=D.extend({task:ke}),Sa=V.merge(ke),Me=W.extend({method:a("notifications/tasks/status"),params:Sa}),ht=L.extend({method:a("tasks/get"),params:F.extend({taskId:c()})}),ft=D.merge(ke),gt=L.extend({method:a("tasks/result"),params:F.extend({taskId:c()})});D.loose();const vt=we.extend({method:a("tasks/list")}),_t=ye.extend({tasks:_(ke)}),bt=L.extend({method:a("tasks/cancel"),params:F.extend({taskId:c()})}),xa=D.merge(ke),Mo=l({uri:c(),mimeType:q(c()),_meta:z(c(),$()).optional()}),Ao=Mo.extend({text:c()}),wt=c().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Oo=Mo.extend({blob:wt}),Se=H(["user","assistant"]),ie=l({audience:_(Se).optional(),priority:b().min(0).max(1).optional(),lastModified:wo({offset:!0}).optional()}),Lo=l({...se.shape,...be.shape,uri:c(),description:q(c()),mimeType:q(c()),annotations:ie.optional(),_meta:q(j({}))}),Ta=l({...se.shape,...be.shape,uriTemplate:c(),description:q(c()),mimeType:q(c()),annotations:ie.optional(),_meta:q(j({}))}),za=we.extend({method:a("resources/list")}),Do=ye.extend({resources:_(Lo)}),$a=we.extend({method:a("resources/templates/list")}),Ia=ye.extend({resourceTemplates:_(Ta)}),yt=F.extend({uri:c()}),Ra=yt,Ea=L.extend({method:a("resources/read"),params:Ra}),jo=D.extend({contents:_(y([Ao,Oo]))}),Za=W.extend({method:a("notifications/resources/list_changed"),params:V.optional()}),Pa=yt,Ca=L.extend({method:a("resources/subscribe"),params:Pa}),Na=yt,qa=L.extend({method:a("resources/unsubscribe"),params:Na}),Ma=V.extend({uri:c()}),Aa=W.extend({method:a("notifications/resources/updated"),params:Ma}),Oa=l({name:c(),description:q(c()),required:q(I())}),La=l({...se.shape,...be.shape,description:q(c()),arguments:q(_(Oa)),_meta:q(j({}))}),Da=we.extend({method:a("prompts/list")}),ja=ye.extend({prompts:_(La)}),Ua=F.extend({name:c(),arguments:z(c(),c()).optional()}),Ha=L.extend({method:a("prompts/get"),params:Ua}),kt=l({type:a("text"),text:c(),annotations:ie.optional(),_meta:z(c(),$()).optional()}),St=l({type:a("image"),data:wt,mimeType:c(),annotations:ie.optional(),_meta:z(c(),$()).optional()}),xt=l({type:a("audio"),data:wt,mimeType:c(),annotations:ie.optional(),_meta:z(c(),$()).optional()}),Fa=l({type:a("tool_use"),name:c(),id:c(),input:z(c(),$()),_meta:z(c(),$()).optional()}),Uo=l({type:a("resource"),resource:y([Ao,Oo]),annotations:ie.optional(),_meta:z(c(),$()).optional()}),Ho=Lo.extend({type:a("resource_link")}),xe=y([kt,St,xt,Ho,Uo]),Ba=l({role:Se,content:xe}),Va=D.extend({description:c().optional(),messages:_(Ba)}),Wa=W.extend({method:a("notifications/prompts/list_changed"),params:V.optional()}),Ja=l({title:c().optional(),readOnlyHint:I().optional(),destructiveHint:I().optional(),idempotentHint:I().optional(),openWorldHint:I().optional()}),Ga=l({taskSupport:H(["required","optional","forbidden"]).optional()}),Tt=l({...se.shape,...be.shape,description:c().optional(),inputSchema:l({type:a("object"),properties:z(c(),O).optional(),required:_(c()).optional()}).catchall($()),outputSchema:l({type:a("object"),properties:z(c(),O).optional(),required:_(c()).optional()}).catchall($()).optional(),annotations:Ja.optional(),execution:Ga.optional(),_meta:z(c(),$()).optional()}),Fo=we.extend({method:a("tools/list")}),Ka=ye.extend({tools:_(Tt)}),Be=D.extend({content:_(xe).default([]),structuredContent:z(c(),$()).optional(),isError:I().optional()});Be.or(D.extend({toolResult:$()}));const Qa=ve.extend({name:c(),arguments:z(c(),$()).optional()}),Bo=L.extend({method:a("tools/call"),params:Qa}),Ya=W.extend({method:a("notifications/tools/list_changed"),params:V.optional()});l({autoRefresh:I().default(!0),debounceMs:b().int().nonnegative().default(300)});const Vo=H(["debug","info","notice","warning","error","critical","alert","emergency"]),Xa=F.extend({level:Vo}),ec=L.extend({method:a("logging/setLevel"),params:Xa}),tc=V.extend({level:Vo,logger:c().optional(),data:$()}),oc=W.extend({method:a("notifications/message"),params:tc}),nc=l({name:c().optional()}),rc=l({hints:_(nc).optional(),costPriority:b().min(0).max(1).optional(),speedPriority:b().min(0).max(1).optional(),intelligencePriority:b().min(0).max(1).optional()}),sc=l({mode:H(["auto","required","none"]).optional()}),ic=l({type:a("tool_result"),toolUseId:c().describe("The unique identifier for the corresponding tool call."),content:_(xe).default([]),structuredContent:l({}).loose().optional(),isError:I().optional(),_meta:z(c(),$()).optional()}),ac=zo("type",[kt,St,xt]),Ae=zo("type",[kt,St,xt,Fa,ic]),cc=l({role:Se,content:y([Ae,_(Ae)]),_meta:z(c(),$()).optional()}),uc=ve.extend({messages:_(cc),modelPreferences:rc.optional(),systemPrompt:c().optional(),includeContext:H(["none","thisServer","allServers"]).optional(),temperature:b().optional(),maxTokens:b().int(),stopSequences:_(c()).optional(),metadata:O.optional(),tools:_(Tt).optional(),toolChoice:sc.optional()}),lc=L.extend({method:a("sampling/createMessage"),params:uc}),dc=D.extend({model:c(),stopReason:q(H(["endTurn","stopSequence","maxTokens"]).or(c())),role:Se,content:ac}),pc=D.extend({model:c(),stopReason:q(H(["endTurn","stopSequence","maxTokens","toolUse"]).or(c())),role:Se,content:y([Ae,_(Ae)])}),mc=l({type:a("boolean"),title:c().optional(),description:c().optional(),default:I().optional()}),hc=l({type:a("string"),title:c().optional(),description:c().optional(),minLength:b().optional(),maxLength:b().optional(),format:H(["email","uri","date","date-time"]).optional(),default:c().optional()}),fc=l({type:H(["number","integer"]),title:c().optional(),description:c().optional(),minimum:b().optional(),maximum:b().optional(),default:b().optional()}),gc=l({type:a("string"),title:c().optional(),description:c().optional(),enum:_(c()),default:c().optional()}),vc=l({type:a("string"),title:c().optional(),description:c().optional(),oneOf:_(l({const:c(),title:c()})),default:c().optional()}),_c=l({type:a("string"),title:c().optional(),description:c().optional(),enum:_(c()),enumNames:_(c()).optional(),default:c().optional()}),bc=y([gc,vc]),wc=l({type:a("array"),title:c().optional(),description:c().optional(),minItems:b().optional(),maxItems:b().optional(),items:l({type:a("string"),enum:_(c())}),default:_(c()).optional()}),yc=l({type:a("array"),title:c().optional(),description:c().optional(),minItems:b().optional(),maxItems:b().optional(),items:l({anyOf:_(l({const:c(),title:c()}))}),default:_(c()).optional()}),kc=y([wc,yc]),Sc=y([_c,bc,kc]),xc=y([Sc,mc,hc,fc]),Tc=ve.extend({mode:a("form").optional(),message:c(),requestedSchema:l({type:a("object"),properties:z(c(),xc),required:_(c()).optional()})}),zc=ve.extend({mode:a("url"),message:c(),elicitationId:c(),url:c().url()}),$c=y([Tc,zc]),Ic=L.extend({method:a("elicitation/create"),params:$c}),Rc=V.extend({elicitationId:c()}),Ec=W.extend({method:a("notifications/elicitation/complete"),params:Rc}),Zc=D.extend({action:H(["accept","decline","cancel"]),content:Zo(e=>e===null?void 0:e,z(c(),y([c(),b(),I(),_(c())])).optional())}),Pc=l({type:a("ref/resource"),uri:c()}),Cc=l({type:a("ref/prompt"),name:c()}),Nc=F.extend({ref:y([Cc,Pc]),argument:l({name:c(),value:c()}),context:l({arguments:z(c(),c()).optional()}).optional()}),qc=L.extend({method:a("completion/complete"),params:Nc}),Mc=D.extend({completion:j({values:_(c()).max(100),total:q(b().int()),hasMore:q(I())})}),Ac=l({uri:c().startsWith("file://"),name:c().optional(),_meta:z(c(),$()).optional()}),Oc=L.extend({method:a("roots/list"),params:F.optional()}),Lc=D.extend({roots:_(Ac)}),Dc=W.extend({method:a("notifications/roots/list_changed"),params:V.optional()});y([Fe,fa,qc,ec,Ha,Da,za,$a,Ea,Ca,qa,Bo,Fo,ht,gt,vt,bt]);y([dt,pt,_a,Dc,Me]);y([lt,dc,pc,Zc,Lc,ft,_t,mt]);y([Fe,lc,Ic,Oc,ht,gt,vt,bt]);y([dt,pt,oc,Aa,Za,Ya,Wa,Me,Ec]);y([lt,va,Mc,Va,ja,Do,Ia,jo,Be,Ka,ft,_t,mt]);class x extends Error{constructor(t,o,n){super(`MCP error ${t}: ${o}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,o,n){if(t===T.UrlElicitationRequired&&n){const r=n;if(r.elicitations)return new jc(r.elicitations,o)}return new x(t,o,n)}}class jc extends x{constructor(t,o=`URL elicitation${t.length>1?"s":""} required`){super(T.UrlElicitationRequired,o,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}}function ee(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Jt(e){const o=Gs(e)?.method;if(!o)throw new Error("Schema is missing a method literal");const n=Ks(o);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Gt(e,t){const o=bo(e,t);if(!o.success)throw o.error;return o.data}const Uc=6e4;class Hc{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(dt,o=>{this._oncancel(o)}),this.setNotificationHandler(pt,o=>{this._onprogress(o)}),this.setRequestHandler(Fe,o=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ht,async(o,n)=>{const r=await this._taskStore.getTask(o.params.taskId,n.sessionId);if(!r)throw new x(T.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(gt,async(o,n)=>{const r=async()=>{const s=o.params.taskId;if(this._taskMessageQueue){let u;for(;u=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(u.type==="response"||u.type==="error"){const p=u.message,f=p.id,g=this._requestResolvers.get(f);if(g)if(this._requestResolvers.delete(f),u.type==="response")g(p);else{const m=p,v=new x(m.error.code,m.error.message,m.error.data);g(v)}else{const m=u.type==="response"?"Response":"Error";this._onerror(new Error(`${m} handler missing for request ${f}`))}continue}await this._transport?.send(u.message,{relatedRequestId:n.requestId})}}const i=await this._taskStore.getTask(s,n.sessionId);if(!i)throw new x(T.InvalidParams,`Task not found: ${s}`);if(!ee(i.status))return await this._waitForTaskUpdate(s,n.signal),await r();if(ee(i.status)){const u=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...u,_meta:{...u._meta,[te]:{taskId:s}}}}return await r()};return await r()}),this.setRequestHandler(vt,async(o,n)=>{try{const{tasks:r,nextCursor:s}=await this._taskStore.listTasks(o.params?.cursor,n.sessionId);return{tasks:r,nextCursor:s,_meta:{}}}catch(r){throw new x(T.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(bt,async(o,n)=>{try{const r=await this._taskStore.getTask(o.params.taskId,n.sessionId);if(!r)throw new x(T.InvalidParams,`Task not found: ${o.params.taskId}`);if(ee(r.status))throw new x(T.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(o.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(o.params.taskId);const s=await this._taskStore.getTask(o.params.taskId,n.sessionId);if(!s)throw new x(T.InvalidParams,`Task not found after cancellation: ${o.params.taskId}`);return{_meta:{},...s}}catch(r){throw r instanceof x?r:new x(T.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,o,n,r,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(r,o),startTime:Date.now(),timeout:o,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:r})}_resetTimeout(t){const o=this._timeoutInfo.get(t);if(!o)return!1;const n=Date.now()-o.startTime;if(o.maxTotalTimeout&&n>=o.maxTotalTimeout)throw this._timeoutInfo.delete(t),x.fromError(T.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:o.maxTotalTimeout,totalElapsed:n});return clearTimeout(o.timeoutId),o.timeoutId=setTimeout(o.onTimeout,o.timeout),!0}_cleanupTimeout(t){const o=this._timeoutInfo.get(t);o&&(clearTimeout(o.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;const o=this.transport?.onclose;this._transport.onclose=()=>{o?.(),this._onclose()};const n=this.transport?.onerror;this._transport.onerror=s=>{n?.(s),this._onerror(s)};const r=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{r?.(s,i),Ee(s)||sa(s)?this._onresponse(s):Wt(s)?this._onrequest(s,i):ra(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();const o=x.fromError(T.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const n of t.values())n(o)}_onerror(t){this.onerror?.(t)}_onnotification(t){const o=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;o!==void 0&&Promise.resolve().then(()=>o(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,o){const n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,r=this._transport,s=t.params?._meta?.[te]?.taskId;if(n===void 0){const g={jsonrpc:"2.0",id:t.id,error:{code:T.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:g,timestamp:Date.now()},r?.sessionId).catch(m=>this._onerror(new Error(`Failed to enqueue error response: ${m}`))):r?.send(g).catch(m=>this._onerror(new Error(`Failed to send an error response: ${m}`)));return}const i=new AbortController;this._requestHandlerAbortControllers.set(t.id,i);const u=na(t.params)?t.params.task:void 0,p=this._taskStore?this.requestTaskStore(t,r?.sessionId):void 0,f={signal:i.signal,sessionId:r?.sessionId,_meta:t.params?._meta,sendNotification:async g=>{if(i.signal.aborted)return;const m={relatedRequestId:t.id};s&&(m.relatedTask={taskId:s}),await this.notification(g,m)},sendRequest:async(g,m,v)=>{if(i.signal.aborted)throw new x(T.ConnectionClosed,"Request was cancelled");const w={...v,relatedRequestId:t.id};s&&!w.relatedTask&&(w.relatedTask={taskId:s});const M=w.relatedTask?.taskId??s;return M&&p&&await p.updateTaskStatus(M,"input_required"),await this.request(g,m,w)},authInfo:o?.authInfo,requestId:t.id,requestInfo:o?.requestInfo,taskId:s,taskStore:p,taskRequestedTtl:u?.ttl,closeSSEStream:o?.closeSSEStream,closeStandaloneSSEStream:o?.closeStandaloneSSEStream};Promise.resolve().then(()=>{u&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,f)).then(async g=>{if(i.signal.aborted)return;const m={result:g,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:m,timestamp:Date.now()},r?.sessionId):await r?.send(m)},async g=>{if(i.signal.aborted)return;const m={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(g.code)?g.code:T.InternalError,message:g.message??"Internal error",...g.data!==void 0&&{data:g.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:m,timestamp:Date.now()},r?.sessionId):await r?.send(m)}).catch(g=>this._onerror(new Error(`Failed to send response: ${g}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){const{progressToken:o,...n}=t.params,r=Number(o),s=this._progressHandlers.get(r);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const i=this._responseHandlers.get(r),u=this._timeoutInfo.get(r);if(u&&i&&u.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(p){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),i(p);return}s(n)}_onresponse(t){const o=Number(t.id),n=this._requestResolvers.get(o);if(n){if(this._requestResolvers.delete(o),Ee(t))n(t);else{const i=new x(t.error.code,t.error.message,t.error.data);n(i)}return}const r=this._responseHandlers.get(o);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(o),this._cleanupTimeout(o);let s=!1;if(Ee(t)&&t.result&&typeof t.result=="object"){const i=t.result;if(i.task&&typeof i.task=="object"){const u=i.task;typeof u.taskId=="string"&&(s=!0,this._taskProgressTokens.set(u.taskId,o))}}if(s||this._progressHandlers.delete(o),Ee(t))r(t);else{const i=x.fromError(t.error.code,t.error.message,t.error.data);r(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,o,n){const{task:r}=n??{};if(!r){try{yield{type:"result",result:await this.request(t,o,n)}}catch(i){yield{type:"error",error:i instanceof x?i:new x(T.InternalError,String(i))}}return}let s;try{const i=await this.request(t,mt,n);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new x(T.InternalError,"Task creation did not return a task");for(;;){const u=await this.getTask({taskId:s},n);if(yield{type:"taskStatus",task:u},ee(u.status)){u.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},o,n)}:u.status==="failed"?yield{type:"error",error:new x(T.InternalError,`Task ${s} failed`)}:u.status==="cancelled"&&(yield{type:"error",error:new x(T.InternalError,`Task ${s} was cancelled`)});return}if(u.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},o,n)};return}const p=u.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(f=>setTimeout(f,p)),n?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof x?i:new x(T.InternalError,String(i))}}}request(t,o,n){const{relatedRequestId:r,resumptionToken:s,onresumptiontoken:i,task:u,relatedTask:p}=n??{};return new Promise((f,g)=>{const m=S=>{g(S)};if(!this._transport){m(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),u&&this.assertTaskCapability(t.method)}catch(S){m(S);return}n?.signal?.throwIfAborted();const v=this._requestMessageId++,w={...t,jsonrpc:"2.0",id:v};n?.onprogress&&(this._progressHandlers.set(v,n.onprogress),w.params={...t.params,_meta:{...t.params?._meta||{},progressToken:v}}),u&&(w.params={...w.params,task:u}),p&&(w.params={...w.params,_meta:{...w.params?._meta||{},[te]:p}});const M=S=>{this._responseHandlers.delete(v),this._progressHandlers.delete(v),this._cleanupTimeout(v),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:v,reason:String(S)}},{relatedRequestId:r,resumptionToken:s,onresumptiontoken:i}).catch(Z=>this._onerror(new Error(`Failed to send cancellation: ${Z}`)));const k=S instanceof x?S:new x(T.RequestTimeout,String(S));g(k)};this._responseHandlers.set(v,S=>{if(!n?.signal?.aborted){if(S instanceof Error)return g(S);try{const k=bo(o,S.result);k.success?f(k.data):g(k.error)}catch(k){g(k)}}}),n?.signal?.addEventListener("abort",()=>{M(n?.signal?.reason)});const B=n?.timeout??Uc,ae=()=>M(x.fromError(T.RequestTimeout,"Request timed out",{timeout:B}));this._setupTimeout(v,B,n?.maxTotalTimeout,ae,n?.resetTimeoutOnProgress??!1);const X=p?.taskId;if(X){const S=k=>{const Z=this._responseHandlers.get(v);Z?Z(k):this._onerror(new Error(`Response handler missing for side-channeled request ${v}`))};this._requestResolvers.set(v,S),this._enqueueTaskMessage(X,{type:"request",message:w,timestamp:Date.now()}).catch(k=>{this._cleanupTimeout(v),g(k)})}else this._transport.send(w,{relatedRequestId:r,resumptionToken:s,onresumptiontoken:i}).catch(S=>{this._cleanupTimeout(v),g(S)})})}async getTask(t,o){return this.request({method:"tasks/get",params:t},ft,o)}async getTaskResult(t,o,n){return this.request({method:"tasks/result",params:t},o,n)}async listTasks(t,o){return this.request({method:"tasks/list",params:t},_t,o)}async cancelTask(t,o){return this.request({method:"tasks/cancel",params:t},xa,o)}async notification(t,o){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);const n=o?.relatedTask?.taskId;if(n){const u={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[te]:o.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:u,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!o?.relatedRequestId&&!o?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let u={...t,jsonrpc:"2.0"};o?.relatedTask&&(u={...u,params:{...u.params,_meta:{...u.params?._meta||{},[te]:o.relatedTask}}}),this._transport?.send(u,o).catch(p=>this._onerror(p))});return}let i={...t,jsonrpc:"2.0"};o?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[te]:o.relatedTask}}}),await this._transport.send(i,o)}setRequestHandler(t,o){const n=Jt(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(r,s)=>{const i=Gt(t,r);return Promise.resolve(o(i,s))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,o){const n=Jt(t);this._notificationHandlers.set(n,r=>{const s=Gt(t,r);return Promise.resolve(o(s))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){const o=this._taskProgressTokens.get(t);o!==void 0&&(this._progressHandlers.delete(o),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,o,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,o,n,r)}async _clearTaskQueue(t,o){if(this._taskMessageQueue){const n=await this._taskMessageQueue.dequeueAll(t,o);for(const r of n)if(r.type==="request"&&Wt(r.message)){const s=r.message.id,i=this._requestResolvers.get(s);i?(i(new x(T.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,o){let n=this._options?.defaultTaskPollInterval??1e3;try{const r=await this._taskStore?.getTask(t);r?.pollInterval&&(n=r.pollInterval)}catch{}return new Promise((r,s)=>{if(o.aborted){s(new x(T.InvalidRequest,"Request cancelled"));return}const i=setTimeout(r,n);o.addEventListener("abort",()=>{clearTimeout(i),s(new x(T.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,o){const n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async r=>{if(!t)throw new Error("No request provided");return await n.createTask(r,t.id,{method:t.method,params:t.params},o)},getTask:async r=>{const s=await n.getTask(r,o);if(!s)throw new x(T.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(r,s,i)=>{await n.storeTaskResult(r,s,i,o);const u=await n.getTask(r,o);if(u){const p=Me.parse({method:"notifications/tasks/status",params:u});await this.notification(p),ee(u.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>n.getTaskResult(r,o),updateTaskStatus:async(r,s,i)=>{const u=await n.getTask(r,o);if(!u)throw new x(T.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(ee(u.status))throw new x(T.InvalidParams,`Cannot update task "${r}" from terminal status "${u.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(r,s,i,o);const p=await n.getTask(r,o);if(p){const f=Me.parse({method:"notifications/tasks/status",params:p});await this.notification(f),ee(p.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>n.listTasks(r,o)}}}var Fc="2026-01-26",Bc="ui/notifications/tool-input-partial";class Wo{eventTarget;eventSource;messageListener;constructor(t=window.parent,o){this.eventTarget=t,this.eventSource=o,this.messageListener=n=>{if(o&&n.source!==this.eventSource){console.debug("Ignoring message from unknown source",n);return}let r=ia.safeParse(n.data);r.success?(console.debug("Parsed message",r.data),this.onmessage?.(r.data)):n.data?.jsonrpc!=="2.0"?console.debug("Ignoring non-JSON-RPC message",r.error.message,n):(console.error("Failed to parse message",r.error.message,n),this.onerror?.(Error("Invalid JSON-RPC message received: "+r.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(t,o){t.method!==Bc&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var Vc=y([a("light"),a("dark")]).describe("Color theme preference for the host environment."),me=y([a("inline"),a("fullscreen"),a("pip")]).describe("Display mode for UI presentation."),Wc=y([a("--color-background-primary"),a("--color-background-secondary"),a("--color-background-tertiary"),a("--color-background-inverse"),a("--color-background-ghost"),a("--color-background-info"),a("--color-background-danger"),a("--color-background-success"),a("--color-background-warning"),a("--color-background-disabled"),a("--color-text-primary"),a("--color-text-secondary"),a("--color-text-tertiary"),a("--color-text-inverse"),a("--color-text-ghost"),a("--color-text-info"),a("--color-text-danger"),a("--color-text-success"),a("--color-text-warning"),a("--color-text-disabled"),a("--color-border-primary"),a("--color-border-secondary"),a("--color-border-tertiary"),a("--color-border-inverse"),a("--color-border-ghost"),a("--color-border-info"),a("--color-border-danger"),a("--color-border-success"),a("--color-border-warning"),a("--color-border-disabled"),a("--color-ring-primary"),a("--color-ring-secondary"),a("--color-ring-inverse"),a("--color-ring-info"),a("--color-ring-danger"),a("--color-ring-success"),a("--color-ring-warning"),a("--font-sans"),a("--font-mono"),a("--font-weight-normal"),a("--font-weight-medium"),a("--font-weight-semibold"),a("--font-weight-bold"),a("--font-text-xs-size"),a("--font-text-sm-size"),a("--font-text-md-size"),a("--font-text-lg-size"),a("--font-heading-xs-size"),a("--font-heading-sm-size"),a("--font-heading-md-size"),a("--font-heading-lg-size"),a("--font-heading-xl-size"),a("--font-heading-2xl-size"),a("--font-heading-3xl-size"),a("--font-text-xs-line-height"),a("--font-text-sm-line-height"),a("--font-text-md-line-height"),a("--font-text-lg-line-height"),a("--font-heading-xs-line-height"),a("--font-heading-sm-line-height"),a("--font-heading-md-line-height"),a("--font-heading-lg-line-height"),a("--font-heading-xl-line-height"),a("--font-heading-2xl-line-height"),a("--font-heading-3xl-line-height"),a("--border-radius-xs"),a("--border-radius-sm"),a("--border-radius-md"),a("--border-radius-lg"),a("--border-radius-xl"),a("--border-radius-full"),a("--border-width-regular"),a("--shadow-hairline"),a("--shadow-sm"),a("--shadow-md"),a("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),Jc=z(Wc.describe(`Style variables for theming MCP apps.
|
|
33
|
+
|
|
34
|
+
Individual style keys are optional - hosts may provide any subset of these values.
|
|
35
|
+
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
36
|
+
|
|
37
|
+
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
38
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),y([c(),Qe()]).describe(`Style variables for theming MCP apps.
|
|
39
|
+
|
|
40
|
+
Individual style keys are optional - hosts may provide any subset of these values.
|
|
41
|
+
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
42
|
+
|
|
43
|
+
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
44
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`)).describe(`Style variables for theming MCP apps.
|
|
45
|
+
|
|
46
|
+
Individual style keys are optional - hosts may provide any subset of these values.
|
|
47
|
+
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
48
|
+
|
|
49
|
+
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
50
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);l({method:a("ui/open-link"),params:l({url:c().describe("URL to open in the host's browser")})});var Gc=l({isError:I().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),Kc=l({isError:I().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),Qc=l({isError:I().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough();l({method:a("ui/notifications/sandbox-proxy-ready"),params:l({})});var zt=l({connectDomains:_(c()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
51
|
+
|
|
52
|
+
- Maps to CSP \`connect-src\` directive
|
|
53
|
+
- Empty or omitted → no network connections (secure default)`),resourceDomains:_(c()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:_(c()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:_(c()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),$t=l({camera:l({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:l({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:l({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:l({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")});l({method:a("ui/notifications/size-changed"),params:l({width:b().optional().describe("New width in pixels."),height:b().optional().describe("New height in pixels.")})});var Yc=l({method:a("ui/notifications/tool-input"),params:l({arguments:z(c(),$().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),Xc=l({method:a("ui/notifications/tool-input-partial"),params:l({arguments:z(c(),$().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),eu=l({method:a("ui/notifications/tool-cancelled"),params:l({reason:c().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),tu=l({fonts:c().optional()}),ou=l({variables:Jc.optional().describe("CSS variables for theming the app."),css:tu.optional().describe("CSS blocks that apps can inject.")}),nu=l({method:a("ui/resource-teardown"),params:l({})});z(c(),$());var Kt=l({text:l({}).optional().describe("Host supports text content blocks."),image:l({}).optional().describe("Host supports image content blocks."),audio:l({}).optional().describe("Host supports audio content blocks."),resource:l({}).optional().describe("Host supports resource content blocks."),resourceLink:l({}).optional().describe("Host supports resource link content blocks."),structuredContent:l({}).optional().describe("Host supports structured content.")});l({method:a("ui/notifications/request-teardown"),params:l({}).optional()});var ru=l({experimental:l({}).optional().describe("Experimental features (structure TBD)."),openLinks:l({}).optional().describe("Host supports opening external URLs."),downloadFile:l({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:l({listChanged:I().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:l({listChanged:I().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:l({}).optional().describe("Host accepts log messages."),sandbox:l({permissions:$t.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:zt.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:Kt.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:Kt.optional().describe("Host supports receiving content messages (ui/message) from the view.")}),su=l({experimental:l({}).optional().describe("Experimental features (structure TBD)."),tools:l({listChanged:I().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:_(me).optional().describe("Display modes the app supports.")});l({method:a("ui/notifications/initialized"),params:l({}).optional()});l({csp:zt.optional().describe("Content Security Policy configuration for UI resources."),permissions:$t.optional().describe("Sandbox permissions requested by the UI resource."),domain:c().optional().describe(`Dedicated origin for view sandbox.
|
|
54
|
+
|
|
55
|
+
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
56
|
+
|
|
57
|
+
**Host-dependent:** The format and validation rules for this field are determined by each host. Servers MUST consult host-specific documentation for the expected domain format. Common patterns include:
|
|
58
|
+
- Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
|
|
59
|
+
- URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
|
|
60
|
+
|
|
61
|
+
If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:I().optional().describe(`Visual boundary preference - true if view prefers a visible border.
|
|
62
|
+
|
|
63
|
+
Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
|
|
64
|
+
|
|
65
|
+
- \`true\`: request visible border + background
|
|
66
|
+
- \`false\`: request no visible border + background
|
|
67
|
+
- omitted: host decides border`)});l({method:a("ui/request-display-mode"),params:l({mode:me.describe("The display mode being requested.")})});var iu=l({mode:me.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),au=y([a("model"),a("app")]).describe("Tool visibility scope - who can access the tool.");l({resourceUri:c().optional(),visibility:_(au).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
68
|
+
- "model": Tool visible to and callable by the agent
|
|
69
|
+
- "app": Tool callable by the app from this server only`)});l({mimeTypes:_(c()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});l({method:a("ui/download-file"),params:l({contents:_(y([Uo,Ho])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})});l({method:a("ui/message"),params:l({role:a("user").describe('Message role, currently only "user" is supported.'),content:_(xe).describe("Message content blocks (text, image, etc.).")})});l({method:a("ui/notifications/sandbox-resource-ready"),params:l({html:c().describe("HTML content to load into the inner iframe."),sandbox:c().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:zt.optional().describe("CSP configuration from resource metadata."),permissions:$t.optional().describe("Sandbox permissions from resource metadata.")})});var cu=l({method:a("ui/notifications/tool-result"),params:Be.describe("Standard MCP tool execution result.")}),Jo=l({toolInfo:l({id:_e.optional().describe("JSON-RPC id of the tools/call request."),tool:Tt.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:Vc.optional().describe("Current color theme preference."),styles:ou.optional().describe("Style configuration for theming the app."),displayMode:me.optional().describe("How the UI is currently displayed."),availableDisplayModes:_(me).optional().describe("Display modes the host supports."),containerDimensions:y([l({height:b().describe("Fixed container height in pixels.")}),l({maxHeight:y([b(),Qe()]).optional().describe("Maximum container height in pixels.")})]).and(y([l({width:b().describe("Fixed container width in pixels.")}),l({maxWidth:y([b(),Qe()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
70
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:c().optional().describe("User's language and region preference in BCP 47 format."),timeZone:c().optional().describe("User's timezone in IANA format."),userAgent:c().optional().describe("Host application identifier."),platform:y([a("web"),a("desktop"),a("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:l({touch:I().optional().describe("Whether the device supports touch input."),hover:I().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:l({top:b().describe("Top safe area inset in pixels."),right:b().describe("Right safe area inset in pixels."),bottom:b().describe("Bottom safe area inset in pixels."),left:b().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),uu=l({method:a("ui/notifications/host-context-changed"),params:Jo.describe("Partial context update containing only changed fields.")});l({method:a("ui/update-model-context"),params:l({content:_(xe).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:z(c(),$().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});l({method:a("ui/initialize"),params:l({appInfo:He.describe("App identification (name and version)."),appCapabilities:su.describe("Features and capabilities this app provides."),protocolVersion:c().describe("Protocol version this app supports.")})});var lu=l({protocolVersion:c().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:He.describe("Host application identification and version."),hostCapabilities:ru.describe("Features and capabilities provided by the host."),hostContext:Jo.describe("Rich context about the host environment.")}).passthrough();function du(e,t=document.documentElement){for(let[o,n]of Object.entries(e))n!==void 0&&t.style.setProperty(o,n)}function pu(e){if(document.getElementById("__mcp-host-fonts"))return;let t=document.createElement("style");t.id="__mcp-host-fonts",t.textContent=e,document.head.appendChild(t)}class mu extends Hc{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;constructor(t,o={},n={autoResize:!0}){super(n),this._appInfo=t,this._capabilities=o,this.options=n,this.setRequestHandler(Fe,r=>(console.log("Received ping:",r.params),{})),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(t){this.setNotificationHandler(Yc,o=>t(o.params))}set ontoolinputpartial(t){this.setNotificationHandler(Xc,o=>t(o.params))}set ontoolresult(t){this.setNotificationHandler(cu,o=>t(o.params))}set ontoolcancelled(t){this.setNotificationHandler(eu,o=>t(o.params))}set onhostcontextchanged(t){this.setNotificationHandler(uu,o=>{this._hostContext={...this._hostContext,...o.params},t(o.params)})}set onteardown(t){this.setRequestHandler(nu,(o,n)=>t(o.params,n))}set oncalltool(t){this.setRequestHandler(Bo,(o,n)=>t(o.params,n))}set onlisttools(t){this.setRequestHandler(Fo,(o,n)=>t(o.params,n))}assertCapabilityForMethod(t){}assertRequestHandlerCapability(t){switch(t){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${t})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${t} registered`)}}assertNotificationCapability(t){}assertTaskCapability(t){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(t){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(t,o){if(typeof t=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${t}"). Did you mean: callServerTool({ name: "${t}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:t},Be,o)}async readServerResource(t,o){return await this.request({method:"resources/read",params:t},jo,o)}async listServerResources(t,o){return await this.request({method:"resources/list",params:t},Do,o)}sendMessage(t,o){return this.request({method:"ui/message",params:t},Qc,o)}sendLog(t){return this.notification({method:"notifications/message",params:t})}updateModelContext(t,o){return this.request({method:"ui/update-model-context",params:t},lt,o)}openLink(t,o){return this.request({method:"ui/open-link",params:t},Gc,o)}sendOpenLink=this.openLink;downloadFile(t,o){return this.request({method:"ui/download-file",params:t},Kc,o)}requestTeardown(t={}){return this.notification({method:"ui/notifications/request-teardown",params:t})}requestDisplayMode(t,o){return this.request({method:"ui/request-display-mode",params:t},iu,o)}sendSizeChanged(t){return this.notification({method:"ui/notifications/size-changed",params:t})}setupSizeChangedNotifications(){let t=!1,o=0,n=0,r=()=>{t||(t=!0,requestAnimationFrame(()=>{t=!1;let i=document.documentElement,u=i.style.width,p=i.style.height;i.style.width="fit-content",i.style.height="max-content";let f=i.getBoundingClientRect();i.style.width=u,i.style.height=p;let g=window.innerWidth-i.clientWidth,m=Math.ceil(f.width+g),v=Math.ceil(f.height);(m!==o||v!==n)&&(o=m,n=v,this.sendSizeChanged({width:m,height:v}))}))};r();let s=new ResizeObserver(r);return s.observe(document.documentElement),s.observe(document.body),()=>s.disconnect()}async connect(t=new Wo(window.parent,window.parent),o){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(t);try{let n=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:Fc}},lu,o);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(n){throw this.close(),n}}}async function hu(e){const t=new mu({name:e.name,version:e.version});return t.ontoolresult=o=>{try{const n=o.structuredContent;if(n&&typeof n=="object"&&n.status==="success")e.onData(n.data);else if(n&&typeof n=="object"&&n.status==="error"){const r=n.message;Je(r||"Unknown error"),e.onError?.(r||"Unknown error")}else{const r=o.content?.find(s=>s.type==="text");if(r&&"text"in r){const s=JSON.parse(r.text);s.status==="success"?e.onData(s.data):Je(s.message||"Unknown error")}}}catch(n){const r=n instanceof Error?n.message:String(n);Je(`Failed to parse result: ${r}`),e.onError?.(r)}},t.onhostcontextchanged=o=>{if(o.styles?.variables&&du(o.styles.variables),o.styles?.css?.fonts&&pu(o.styles.css.fonts),o.safeAreaInsets){const{top:n,right:r,bottom:s,left:i}=o.safeAreaInsets;document.body.style.padding=`${n}px ${r}px ${s}px ${i}px`}},t.onteardown=async()=>({}),await t.connect(new Wo),t}function Je(e){const t=document.querySelector(".atoms-error");t&&t.remove();const o=document.createElement("div");o.className="atoms-error",o.textContent=e,document.body.prepend(o)}async function Go(e,t,o){const r=(await e.callServerTool({name:t,arguments:o})).content?.find(s=>s.type==="text");if(r&&"text"in r){const s=JSON.parse(r.text);if(s.status==="success")return s.data;throw new Error(s.message||"Tool call failed")}throw new Error("No text content in tool response")}let he=null,Oe="",A={type:"",domain:"",level:"",query:""},K=0;const J=25;let Pe=null,Ge=null;const fu={requirement:"#a855f7","test-case":"#e4e4e7",note:"#a855f780",table:"#606060"},gu={requirement:"REQ","test-case":"TC",note:"NOTE",table:"TABLE"},Ko=document.createElement("style");Ko.textContent=`
|
|
71
|
+
/* Toolbar controls */
|
|
72
|
+
.browse-toolbar-group {
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
gap: 6px;
|
|
76
|
+
}
|
|
77
|
+
.browse-toolbar-label {
|
|
78
|
+
font-size: 11px;
|
|
79
|
+
font-weight: 500;
|
|
80
|
+
color: var(--text-muted);
|
|
81
|
+
text-transform: uppercase;
|
|
82
|
+
letter-spacing: 0.3px;
|
|
83
|
+
}
|
|
84
|
+
.browse-select {
|
|
85
|
+
background: var(--bg-tertiary);
|
|
86
|
+
border: 1px solid var(--border-color);
|
|
87
|
+
border-radius: 0;
|
|
88
|
+
color: var(--text-primary);
|
|
89
|
+
font-family: var(--font-main);
|
|
90
|
+
font-size: 12px;
|
|
91
|
+
padding: 5px 8px;
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
outline: none;
|
|
94
|
+
}
|
|
95
|
+
.browse-select:focus {
|
|
96
|
+
border-color: var(--atoms-purple);
|
|
97
|
+
}
|
|
98
|
+
.browse-search-input {
|
|
99
|
+
background: var(--bg-tertiary);
|
|
100
|
+
border: 1px solid var(--border-color);
|
|
101
|
+
border-radius: 0;
|
|
102
|
+
color: var(--text-primary);
|
|
103
|
+
font-family: var(--font-main);
|
|
104
|
+
font-size: 12px;
|
|
105
|
+
padding: 5px 8px;
|
|
106
|
+
min-width: 160px;
|
|
107
|
+
outline: none;
|
|
108
|
+
}
|
|
109
|
+
.browse-search-input::placeholder {
|
|
110
|
+
color: var(--text-muted);
|
|
111
|
+
}
|
|
112
|
+
.browse-search-input:focus {
|
|
113
|
+
border-color: var(--atoms-purple);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* Item rows */
|
|
117
|
+
.browse-item-row {
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
gap: 10px;
|
|
121
|
+
padding: 8px 16px;
|
|
122
|
+
border-bottom: 1px solid var(--border-color);
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
font-size: 12px;
|
|
125
|
+
transition: background 0.1s;
|
|
126
|
+
}
|
|
127
|
+
.browse-item-row:hover {
|
|
128
|
+
background: var(--bg-tertiary);
|
|
129
|
+
}
|
|
130
|
+
.browse-item-row.active {
|
|
131
|
+
background: var(--bg-tertiary);
|
|
132
|
+
}
|
|
133
|
+
.browse-item-id {
|
|
134
|
+
font-family: var(--font-code);
|
|
135
|
+
font-weight: 600;
|
|
136
|
+
font-size: 11px;
|
|
137
|
+
flex-shrink: 0;
|
|
138
|
+
}
|
|
139
|
+
.browse-type-badge {
|
|
140
|
+
font-size: 10px;
|
|
141
|
+
padding: 2px 6px;
|
|
142
|
+
font-weight: 500;
|
|
143
|
+
flex-shrink: 0;
|
|
144
|
+
}
|
|
145
|
+
.browse-item-title {
|
|
146
|
+
flex: 1;
|
|
147
|
+
overflow: hidden;
|
|
148
|
+
text-overflow: ellipsis;
|
|
149
|
+
white-space: nowrap;
|
|
150
|
+
font-size: 13px;
|
|
151
|
+
color: var(--text-primary);
|
|
152
|
+
}
|
|
153
|
+
.browse-domain-chip {
|
|
154
|
+
font-size: 10px;
|
|
155
|
+
padding: 2px 6px;
|
|
156
|
+
background: color-mix(in srgb, var(--atoms-purple) 20%, transparent);
|
|
157
|
+
color: var(--atoms-purple-light);
|
|
158
|
+
flex-shrink: 0;
|
|
159
|
+
}
|
|
160
|
+
.browse-level-tag {
|
|
161
|
+
font-size: 10px;
|
|
162
|
+
padding: 2px 6px;
|
|
163
|
+
background: var(--bg-tertiary);
|
|
164
|
+
color: var(--text-muted);
|
|
165
|
+
flex-shrink: 0;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* Detail panel (inline expansion) */
|
|
169
|
+
.browse-detail {
|
|
170
|
+
padding: 16px;
|
|
171
|
+
padding-left: 19px;
|
|
172
|
+
background: var(--bg-secondary);
|
|
173
|
+
border-bottom: 1px solid var(--border-color);
|
|
174
|
+
border-left: 3px solid var(--atoms-purple);
|
|
175
|
+
}
|
|
176
|
+
.browse-detail-section {
|
|
177
|
+
margin-bottom: 12px;
|
|
178
|
+
}
|
|
179
|
+
.browse-detail-section:last-child {
|
|
180
|
+
margin-bottom: 0;
|
|
181
|
+
}
|
|
182
|
+
.browse-detail-label {
|
|
183
|
+
font-size: 11px;
|
|
184
|
+
font-weight: 600;
|
|
185
|
+
text-transform: uppercase;
|
|
186
|
+
letter-spacing: 0.5px;
|
|
187
|
+
color: var(--text-muted);
|
|
188
|
+
margin-bottom: 4px;
|
|
189
|
+
}
|
|
190
|
+
.browse-detail-body {
|
|
191
|
+
font-size: 13px;
|
|
192
|
+
color: var(--text-secondary);
|
|
193
|
+
line-height: 1.6;
|
|
194
|
+
white-space: pre-wrap;
|
|
195
|
+
word-break: break-word;
|
|
196
|
+
}
|
|
197
|
+
.browse-rel-list {
|
|
198
|
+
display: flex;
|
|
199
|
+
flex-wrap: wrap;
|
|
200
|
+
gap: 6px;
|
|
201
|
+
}
|
|
202
|
+
.browse-rel-link {
|
|
203
|
+
font-family: var(--font-code);
|
|
204
|
+
font-size: 11px;
|
|
205
|
+
color: var(--atoms-purple);
|
|
206
|
+
cursor: pointer;
|
|
207
|
+
padding: 2px 6px;
|
|
208
|
+
background: color-mix(in srgb, var(--atoms-purple) 10%, transparent);
|
|
209
|
+
transition: background 0.1s;
|
|
210
|
+
}
|
|
211
|
+
.browse-rel-link:hover {
|
|
212
|
+
background: color-mix(in srgb, var(--atoms-purple) 20%, transparent);
|
|
213
|
+
}
|
|
214
|
+
.browse-detail-meta {
|
|
215
|
+
font-size: 11px;
|
|
216
|
+
color: var(--text-muted);
|
|
217
|
+
display: flex;
|
|
218
|
+
gap: 16px;
|
|
219
|
+
flex-wrap: wrap;
|
|
220
|
+
}
|
|
221
|
+
.browse-detail-loading {
|
|
222
|
+
font-size: 12px;
|
|
223
|
+
color: var(--text-muted);
|
|
224
|
+
padding: 8px 0;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/* Pagination */
|
|
228
|
+
.browse-pagination {
|
|
229
|
+
display: flex;
|
|
230
|
+
align-items: center;
|
|
231
|
+
justify-content: center;
|
|
232
|
+
gap: 12px;
|
|
233
|
+
padding: 12px 16px;
|
|
234
|
+
border-top: 1px solid var(--border-color);
|
|
235
|
+
}
|
|
236
|
+
.browse-page-info {
|
|
237
|
+
font-size: 12px;
|
|
238
|
+
color: var(--text-secondary);
|
|
239
|
+
font-variant-numeric: tabular-nums;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/* Empty state */
|
|
243
|
+
.browse-empty {
|
|
244
|
+
padding: 32px;
|
|
245
|
+
text-align: center;
|
|
246
|
+
color: var(--text-muted);
|
|
247
|
+
font-size: 13px;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/* Inline loading overlay for re-fetches */
|
|
251
|
+
.browse-list-loading {
|
|
252
|
+
padding: 24px;
|
|
253
|
+
text-align: center;
|
|
254
|
+
color: var(--text-muted);
|
|
255
|
+
font-size: 12px;
|
|
256
|
+
}
|
|
257
|
+
`;document.head.appendChild(Ko);function vu(e){const t=document.getElementById("toolbar");t.style.display="",t.innerHTML="";const o=Ze("Type",()=>{const r=document.createElement("select");return r.className="browse-select",r.innerHTML='<option value="">All Types</option>'+e.types.map(s=>`<option value="${s}"${A.type===s?" selected":""}>${wu(s)}</option>`).join(""),r.onchange=()=>{A.type=r.value,K=0,re()},r});if(t.appendChild(o),e.domains.length>0){const r=Ze("Domain",()=>{const s=document.createElement("select");return s.className="browse-select",s.innerHTML='<option value="">All Domains</option>'+e.domains.map(i=>`<option value="${i}"${A.domain===i?" selected":""}>${i}</option>`).join(""),s.onchange=()=>{A.domain=s.value,K=0,re()},s});t.appendChild(r)}if(e.levels.length>0){const r=Ze("Level",()=>{const s=document.createElement("select");return s.className="browse-select",s.innerHTML='<option value="">All Levels</option>'+e.levels.map(i=>`<option value="${i}"${A.level===i?" selected":""}>${i}</option>`).join(""),s.onchange=()=>{A.level=s.value,K=0,re()},s});t.appendChild(r)}const n=Ze("Search",()=>{const r=document.createElement("input");return r.type="text",r.className="browse-search-input",r.placeholder="Search items...",r.value=A.query,r.oninput=()=>{Ge&&clearTimeout(Ge),Ge=setTimeout(()=>{A.query=r.value.trim(),K=0,re()},300)},r});t.appendChild(n)}function Ze(e,t){const o=document.createElement("div");o.className="browse-toolbar-group";const n=document.createElement("span");return n.className="browse-toolbar-label",n.textContent=e,o.appendChild(n),o.appendChild(t()),o}function Qo(e,t){document.getElementById("loading").style.display="none",document.getElementById("content").style.display="block";const o=document.getElementById("stats");if(t.total_count===0)o.textContent="No items";else if(t.total_count<=J)o.textContent=`${t.total_count} item${t.total_count!==1?"s":""}`;else{const r=t.offset+1,s=Math.min(t.offset+e.length,t.total_count);o.textContent=`${r}–${s} of ${t.total_count}`}const n=document.getElementById("item-list");if(Pe=null,e.length===0){n.innerHTML='<div class="browse-empty">No items match the current filters.</div>',Qt(t);return}n.innerHTML=e.map(r=>_u(r)).join(""),n.querySelectorAll(".browse-item-row").forEach(r=>{r.addEventListener("click",()=>{const s=r.dataset.itemId;Yo(s,r)})}),Qt(t)}function _u(e){const t=fu[e.type]??"#606060",o=t.replace(/[0-9a-f]{2}$/i,""),n=`color-mix(in srgb, ${t} 20%, transparent)`;return`
|
|
258
|
+
<div class="browse-item-row" data-item-id="${e.id}">
|
|
259
|
+
<span class="browse-item-id" style="color:${t}">${e.id}</span>
|
|
260
|
+
<span class="browse-type-badge" style="background:${n};color:${t.length>7?o:t}">${gu[e.type]??e.type}</span>
|
|
261
|
+
<span class="browse-item-title" title="${G(e.title)}">${G(e.title)}</span>
|
|
262
|
+
${e.domains.slice(0,2).map(r=>`<span class="browse-domain-chip">${G(r)}</span>`).join("")}
|
|
263
|
+
${e.level?`<span class="browse-level-tag">${G(e.level)}</span>`:""}
|
|
264
|
+
</div>
|
|
265
|
+
`}async function Yo(e,t){const o=t.nextElementSibling;if(o?.classList.contains("browse-detail")){o.remove(),t.classList.remove("active"),Pe=null;return}document.querySelectorAll(".browse-detail").forEach(r=>r.remove()),document.querySelectorAll(".browse-item-row.active").forEach(r=>r.classList.remove("active")),t.classList.add("active"),Pe=e;const n=document.createElement("div");if(n.className="browse-detail",n.innerHTML='<div class="browse-detail-loading">Loading detail...</div>',t.after(n),!he){n.innerHTML='<div class="browse-detail-loading" style="color:var(--atoms-red)">App not connected</div>';return}try{const r=await Go(he,"atoms_get_item",{project_id:Oe,item_id:e});if(Pe!==e){n.remove();return}bu(n,r)}catch(r){n.innerHTML=`<div class="browse-detail-loading" style="color:var(--atoms-red)">${G(r instanceof Error?r.message:String(r))}</div>`}}function bu(e,t){let o="";t.summary&&(o+=`
|
|
266
|
+
<div class="browse-detail-section">
|
|
267
|
+
<div class="browse-detail-label">Summary</div>
|
|
268
|
+
<div class="browse-detail-body">${G(t.summary)}</div>
|
|
269
|
+
</div>
|
|
270
|
+
`),t.body&&(o+=`
|
|
271
|
+
<div class="browse-detail-section">
|
|
272
|
+
<div class="browse-detail-label">Body</div>
|
|
273
|
+
<div class="browse-detail-body">${G(t.body)}</div>
|
|
274
|
+
</div>
|
|
275
|
+
`);const n=t.relationships,r=[{label:"Parents",ids:n.parents},{label:"Children",ids:n.children},{label:"Verifies",ids:n.verifies},{label:"Verified By",ids:n.verified_by},{label:"Related",ids:n.related}].filter(s=>s.ids.length>0);if(r.length>0){o+='<div class="browse-detail-section"><div class="browse-detail-label">Relationships</div>';for(const s of r)o+=`
|
|
276
|
+
<div style="margin-bottom:6px">
|
|
277
|
+
<span style="font-size:11px;color:var(--text-muted)">${s.label}:</span>
|
|
278
|
+
<span class="browse-rel-list">
|
|
279
|
+
${s.ids.map(i=>`<span class="browse-rel-link" data-rel-id="${G(i)}">${G(i)}</span>`).join("")}
|
|
280
|
+
</span>
|
|
281
|
+
</div>
|
|
282
|
+
`;o+="</div>"}if(t.latest_result){const s=t.latest_result==="passed"?"var(--atoms-green)":t.latest_result==="failed"?"var(--atoms-red)":"var(--atoms-amber)";o+=`
|
|
283
|
+
<div class="browse-detail-section">
|
|
284
|
+
<div class="browse-detail-label">Latest Test Result</div>
|
|
285
|
+
<span style="font-size:12px;font-weight:600;color:${s};text-transform:uppercase">${t.latest_result}</span>
|
|
286
|
+
</div>
|
|
287
|
+
`}o+=`
|
|
288
|
+
<div class="browse-detail-section">
|
|
289
|
+
<div class="browse-detail-meta">
|
|
290
|
+
<span>Created: ${Yt(t.metadata.created_at)}</span>
|
|
291
|
+
<span>Updated: ${Yt(t.metadata.updated_at)}</span>
|
|
292
|
+
${t.metadata.created_by?`<span>By: ${G(t.metadata.created_by)}</span>`:""}
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
`,e.innerHTML=o,e.querySelectorAll(".browse-rel-link").forEach(s=>{s.addEventListener("click",i=>{i.stopPropagation();const u=s.dataset.relId,p=document.querySelector(`.browse-item-row[data-item-id="${u}"]`);p&&(p.scrollIntoView({behavior:"smooth",block:"center"}),Yo(u,p))})})}function Qt(e){const t=document.getElementById("pagination");if(e.total_count<=J){t.innerHTML="";return}const o=e.offset>0,n=e.has_more,r=e.offset+1,s=Math.min(e.offset+e.limit,e.total_count);t.innerHTML=`
|
|
296
|
+
<div class="browse-pagination">
|
|
297
|
+
<button class="atoms-btn" id="btn-prev" ${o?"":"disabled"} style="${o?"":"opacity:0.3;cursor:default"}">Previous</button>
|
|
298
|
+
<span class="browse-page-info">${r}–${s} of ${e.total_count}</span>
|
|
299
|
+
<button class="atoms-btn" id="btn-next" ${n?"":"disabled"} style="${n?"":"opacity:0.3;cursor:default"}">Next</button>
|
|
300
|
+
</div>
|
|
301
|
+
`,o&&document.getElementById("btn-prev").addEventListener("click",()=>{K=Math.max(0,K-J),re()}),n&&document.getElementById("btn-next").addEventListener("click",()=>{K+=J,re()})}async function re(){if(!he)return;const e=document.getElementById("item-list");e.innerHTML='<div class="browse-list-loading">Loading...</div>',document.getElementById("pagination").innerHTML="";try{let t,o;A.query.length>0?(t="atoms_search",o={project_id:Oe,query:A.query,...A.type?{type:A.type}:{},limit:J}):(t="atoms_list_items",o={project_id:Oe,...A.type?{type:A.type}:{},...A.domain?{domain:A.domain}:{},...A.level?{level:A.level}:{},limit:J,offset:K});const n=await Go(he,t,o),r=Array.isArray(n)?n:[],s={total_count:r.length<J?K+r.length:K+J+1,limit:J,offset:K,has_more:r.length>=J};Qo(r,s)}catch(t){e.innerHTML=`<div class="browse-empty" style="color:var(--atoms-red)">${G(t instanceof Error?t.message:String(t))}</div>`}}function G(e){const t=document.createElement("span");return t.textContent=e,t.innerHTML}function wu(e){return e.split("-").map(t=>t[0].toUpperCase()+t.slice(1)).join(" ")}function Yt(e){try{return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return e}}hu({name:"ATOMS Browse",version:"1.0.0",onData:e=>{const t=e;Oe=t.project_id,t.filters,vu(t.filters);const o=t.meta??{total_count:t.items.length,limit:J,offset:0,has_more:!1};Qo(t.items,o)}}).then(e=>{he=e});</script>
|
|
302
|
+
<style rel="stylesheet" crossorigin>@import"https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap";:root{--atoms-purple: #a855f7;--atoms-purple-light: #c084fc;--atoms-purple-hover: #b975f9;--atoms-green: #22c55e;--atoms-green-light: #4ade80;--atoms-red: #ef4444;--atoms-red-light: #f87171;--atoms-amber: #f59e0b;--atoms-blue: #58a6ff;--tc-color: #e4e4e7;--note-color: rgba(168, 85, 247, .6);--bg-primary: #0c0c0c;--bg-secondary: #121212;--bg-tertiary: #181818;--text-primary: #fafafa;--text-secondary: #a0a0a0;--text-muted: #606060;--border-color: #252525;--font-main: "IBM Plex Sans", sans-serif;--font-code: "IBM Plex Mono", monospace;color-scheme:dark}*{margin:0;padding:0;box-sizing:border-box}body{font-family:var(--font-main);background:var(--bg-primary);color:var(--text-primary);line-height:1.5;-webkit-font-smoothing:antialiased}.atoms-card{background:var(--bg-secondary);border:1px solid var(--border-color);border-radius:0;padding:16px}.atoms-header{display:flex;align-items:center;gap:10px;padding:12px 16px;border-bottom:1px solid var(--border-color);background:var(--bg-secondary)}.atoms-header .logo{width:20px;height:20px}.atoms-header .title{font-size:14px;font-weight:600;color:var(--text-primary)}.atoms-header .subtitle{font-size:12px;color:var(--text-muted);margin-left:auto}.atoms-btn{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;font-size:12px;font-weight:500;font-family:var(--font-main);border:1px solid var(--border-color);border-radius:0;background:var(--bg-secondary);color:var(--text-primary);cursor:pointer;transition:background .1s ease}.atoms-btn:hover{background:var(--bg-tertiary)}.atoms-btn-primary{background:var(--atoms-purple);color:#fff;border-color:var(--atoms-purple)}.atoms-btn-primary:hover{background:var(--atoms-purple-hover)}.atoms-watermark{position:fixed;bottom:8px;right:12px;display:flex;align-items:center;gap:6px;font-size:10px;color:var(--text-muted);opacity:.5;font-family:var(--font-main);pointer-events:none}.atoms-watermark img{width:14px;height:14px;opacity:.6}.atoms-loading{display:flex;align-items:center;justify-content:center;min-height:200px;color:var(--text-muted);font-size:13px}.atoms-loading:before{content:"";width:16px;height:16px;border:2px solid var(--border-color);border-top-color:var(--atoms-purple);border-radius:50%;margin-right:10px;animation:spin .6s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.atoms-error{padding:16px;background:color-mix(in srgb,var(--atoms-red) 10%,var(--bg-primary));border:1px solid var(--atoms-red);color:var(--text-primary);font-size:13px}.atoms-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:12px;padding:16px}.atoms-metric{background:var(--bg-secondary);border:1px solid var(--border-color);padding:12px;text-align:center}.atoms-metric .value{font-size:24px;font-weight:700;color:var(--atoms-purple);font-variant-numeric:tabular-nums}.atoms-metric .label{font-size:11px;font-weight:500;color:var(--text-secondary);text-transform:uppercase;letter-spacing:.5px;margin-top:4px}.atoms-toolbar{display:flex;align-items:center;gap:8px;padding:8px 16px;border-bottom:1px solid var(--border-color);background:var(--bg-secondary);flex-wrap:wrap}</style>
|
|
303
|
+
</head>
|
|
304
|
+
<body>
|
|
305
|
+
<div id="app">
|
|
306
|
+
<div class="atoms-header">
|
|
307
|
+
<img class="logo" src="data:image/svg+xml,%3csvg%20width='512'%20height='512'%20viewBox='0%200%20512%20512'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20transform='translate(256,%20256)%20scale(-1,1)%20rotate(300)'%3e%3c!--%20Orbit%201:%200°%20--%3e%3cg%3e%3cpath%20d='M%20122.6,33.4%20A%20160,52%200%201,1%20102.8,-39.8'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='1'/%3e%3cpath%20d='M%20118.9,-34.8%20A%20160,52%200%200,1%20141.3,-24.4'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='0.7'/%3e%3cpath%20d='M%20150.4,-17.8%20A%20160,52%200%200,1%20156.5,-10.8'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='0.45'/%3e%3cpath%20d='M%20159.1,-5.4%20A%20160,52%200%200,1%20159.9,-1.8'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='0.2'/%3e%3c/g%3e%3c!--%20Orbit%202:%2060°%20--%3e%3cg%20transform='rotate(60)'%3e%3cpath%20d='M%2080.0,45.0%20A%20160,52%200%201,1%20138.6,-26.0'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='1'/%3e%3cpath%20d='M%20148.3,-19.5%20A%20160,52%200%200,1%20157.6,-9.0'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='0.7'/%3e%3cpath%20d='M%20159.6,-3.6%20A%20160,52%200%200,1%20159.8,2.7'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='0.45'/%3e%3cpath%20d='M%20157.6,9.0%20A%20160,52%200%200,1%20155.2,12.6'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='0.2'/%3e%3c/g%3e%3c!--%20Orbit%203:%20120°%20--%3e%3cg%20transform='rotate(120)'%3e%3cpath%20d='M%20102.8,39.8%20A%20160,52%200%201,1%20122.6,-33.4'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='1'/%3e%3cpath%20d='M%20135.7,-27.6%20A%20160,52%200%200,1%20152.2,-16.1'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='0.7'/%3e%3cpath%20d='M%20157.6,-9.0%20A%20160,52%200%200,1%20159.9,-1.8'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='0.45'/%3e%3cpath%20d='M%20159.4,4.5%20A%20160,52%200%200,1%20158.0,8.1'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='0.2'/%3e%3c/g%3e%3c!--%20Nucleus%20--%3e%3c/g%3e%3c/svg%3e" alt="ATOMS" />
|
|
308
|
+
<span class="title">Browse Items</span>
|
|
309
|
+
<span class="subtitle" id="stats"></span>
|
|
310
|
+
</div>
|
|
311
|
+
<div class="atoms-toolbar" id="toolbar" style="display:none"></div>
|
|
312
|
+
<div class="atoms-loading" id="loading">Loading items...</div>
|
|
313
|
+
<div id="content" style="display:none">
|
|
314
|
+
<div id="item-list"></div>
|
|
315
|
+
<div id="pagination"></div>
|
|
316
|
+
</div>
|
|
317
|
+
<div class="atoms-watermark"><img src="data:image/svg+xml,%3csvg%20width='512'%20height='512'%20viewBox='0%200%20512%20512'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20transform='translate(256,%20256)%20scale(-1,1)%20rotate(300)'%3e%3c!--%20Orbit%201:%200°%20--%3e%3cg%3e%3cpath%20d='M%20122.6,33.4%20A%20160,52%200%201,1%20102.8,-39.8'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='1'/%3e%3cpath%20d='M%20118.9,-34.8%20A%20160,52%200%200,1%20141.3,-24.4'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='0.7'/%3e%3cpath%20d='M%20150.4,-17.8%20A%20160,52%200%200,1%20156.5,-10.8'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='0.45'/%3e%3cpath%20d='M%20159.1,-5.4%20A%20160,52%200%200,1%20159.9,-1.8'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='0.2'/%3e%3c/g%3e%3c!--%20Orbit%202:%2060°%20--%3e%3cg%20transform='rotate(60)'%3e%3cpath%20d='M%2080.0,45.0%20A%20160,52%200%201,1%20138.6,-26.0'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='1'/%3e%3cpath%20d='M%20148.3,-19.5%20A%20160,52%200%200,1%20157.6,-9.0'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='0.7'/%3e%3cpath%20d='M%20159.6,-3.6%20A%20160,52%200%200,1%20159.8,2.7'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='0.45'/%3e%3cpath%20d='M%20157.6,9.0%20A%20160,52%200%200,1%20155.2,12.6'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='0.2'/%3e%3c/g%3e%3c!--%20Orbit%203:%20120°%20--%3e%3cg%20transform='rotate(120)'%3e%3cpath%20d='M%20102.8,39.8%20A%20160,52%200%201,1%20122.6,-33.4'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='1'/%3e%3cpath%20d='M%20135.7,-27.6%20A%20160,52%200%200,1%20152.2,-16.1'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='0.7'/%3e%3cpath%20d='M%20157.6,-9.0%20A%20160,52%200%200,1%20159.9,-1.8'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='0.45'/%3e%3cpath%20d='M%20159.4,4.5%20A%20160,52%200%200,1%20158.0,8.1'%20fill='none'%20stroke='%238B5CF6'%20stroke-width='8'%20stroke-linecap='round'%20opacity='0.2'/%3e%3c/g%3e%3c!--%20Nucleus%20--%3e%3c/g%3e%3c/svg%3e" alt="" />ATOMS.tech</div>
|
|
318
|
+
</div>
|
|
319
|
+
</body>
|
|
320
|
+
</html>
|