@mcpjam/inspector 3.24.0 → 3.24.1
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/dist/client/assets/{app-bootstrap-WlJZYODU.js → app-bootstrap-ClSQQo_e.js} +322 -322
- package/dist/client/assets/{chunk-D32TOXHM-DOJMWdqJ.js → chunk-D32TOXHM-jRtwwVuB.js} +5 -5
- package/dist/client/assets/{dead-clicks-autocapture-xZ8VOqF8.js → dead-clicks-autocapture-BqGJPJYA.js} +2 -2
- package/dist/client/assets/{error-reporting-Cnv0EJ00.js → error-reporting-CMJx3DSN.js} +1 -1
- package/dist/client/assets/error-reporting-CurPZeHi.js +65 -0
- package/dist/client/assets/{exception-autocapture-72pfc-lU.js → exception-autocapture-DDriz7RU.js} +2 -2
- package/dist/client/assets/{first-run-oauth-return-DUQTl-KY.js → first-run-oauth-return-apQ_CEb0.js} +15 -15
- package/dist/client/assets/first-run-oauth-return-ssVP6ljy.css +2 -0
- package/dist/client/assets/{highlighted-body-KQOG7T2V-B2kThXeQ.js → highlighted-body-KQOG7T2V-W9otU88_.js} +2 -2
- package/dist/client/assets/{index-ksLzfLYD.js → index-ByG7bi1F.js} +3 -3
- package/dist/client/assets/{jszip.min-BIV2YZa8.js → jszip.min-BZncoXx3.js} +2 -2
- package/dist/client/assets/{mermaid-MCJ5UELQ-BcUGpcfu.js → mermaid-MCJ5UELQ-CyXXddBc.js} +1 -1
- package/dist/client/assets/{posthog-recorder-CI-imkE8.js → posthog-recorder-yHE4z3QE.js} +2 -2
- package/dist/client/assets/{preload-helper-BFvUZI9f.js → preload-helper-hMqm2cFr.js} +2 -2
- package/dist/client/assets/{project-route-B7kCqybC.js → project-route-DseXxV_W.js} +3 -3
- package/dist/client/assets/{react-dom-BI-goU63.js → react-dom-C0xqZMkb.js} +2 -2
- package/dist/client/assets/{rolldown-runtime-DWUlh9bP.js → rolldown-runtime-BOqoCXSu.js} +1 -1
- package/dist/client/assets/{surveys-BYP0BB0U.js → surveys-DhCSAOVD.js} +2 -2
- package/dist/client/assets/telemetry-files-d99937353b524002.js +1 -0
- package/dist/client/assets/{trace-timeline-oz6gZWxx.js → trace-timeline-BZXpue8Z.js} +1 -1
- package/dist/client/assets/{trace-timeline-C6U_g8zw.js → trace-timeline-CuGCSSeE.js} +2 -2
- package/dist/client/assets/{use-reduced-motion-CV1Zqpv-.js → use-reduced-motion-DXYfL08L.js} +2 -2
- package/dist/client/assets/{web-vitals-BuMia74J.js → web-vitals-BycgZCTB.js} +2 -2
- package/dist/client/index.html +9 -9
- package/dist/server/harness-install-cli.js +13 -3
- package/dist/server/index.js +2 -2
- package/package.json +7 -2
- package/dist/client/assets/error-reporting-BlEnwHvB.js +0 -65
- package/dist/client/assets/first-run-oauth-return-Bhr0xXTj.css +0 -2
- package/dist/client/assets/telemetry-files-14fc11a7a8d7565e.js +0 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import{o as tS}from"./rolldown-runtime-BOqoCXSu.js";import{$t as MC,A as LC,At as NC,B as $C,Bt as rS,D as DC,Dt as Ne,E as UC,F as qC,Gt as ut,H as Vc,I as zC,It as Ue,Kt as It,L as gm,Lt as se,Mt as FC,N as jC,Nt as ye,P as HC,Pt as _t,Qt as sS,Rt as ht,St as nS,Tt as te,Ut as w,V as BC,Vt as Qe,Yt as VC,Z as iS,_ as GC,_t as WC,a as KC,at as Gs,b as vm,bt as ct,ct as JC,et as Mn,g as YC,ht as ic,j as XC,jt as oS,k as ZC,kt as aS,nn as QC,nt as eP,o as tP,ot as rP,qt as cS,rn as sP,st as _m,tn as nP,tt as Hu,u as lS,ut as dn,v as iP,vt as uS,wt as oP,x as dS,yt as aP,z as cP,zt as pS}from"./project-route-DseXxV_W.js";import{n as lP,t as uP}from"./react-dom-C0xqZMkb.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"3.24.1"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8850abed-143d-4729-8d9a-4c79e36338de",e._sentryDebugIdIdentifier="sentry-dbid-8850abed-143d-4729-8d9a-4c79e36338de")}catch{}})();var hS="phc_dTOPniyUNU2kD8Jx8yHMXSqiZHM8I91uWopTMX6EBE9",dP={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"},Uv;Uv||(Uv={});function pP(e){return MC(aP,e)}var Gc=tS(lP(),1);function Sh(e){return Array.isArray(e)?e.map(Sh):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([t],[r])=>t<r?-1:t>r?1:0).map(([t,r])=>[t,Sh(r)])):e}function hP(e){return JSON.stringify(Sh(e))}function G8(e,t){if(t==="openai-apps"){const s=e;return typeof s?.type=="string"?s.type.replace("openai:",""):"unknown"}const r=e;return typeof r?.method=="string"?r.method:r?.result!==void 0?"result":r?.error!==void 0?"error":"unknown"}var qv=e=>{let t;const r=new Set,s=(l,u)=>{const p=typeof l=="function"?l(t):l;if(!Object.is(p,t)){const d=t;t=u??(typeof p!="object"||p===null)?p:Object.assign({},t,p),r.forEach(h=>h(t,d))}},n=()=>t,a={setState:s,getState:n,getInitialState:()=>c,subscribe:l=>(r.add(l),()=>r.delete(l))},c=t=e(s,n,a);return a},ym=(e=>e?qv(e):qv),fP=e=>e;function mP(e,t=fP){const r=Gc.useSyncExternalStore(e.subscribe,Gc.useCallback(()=>t(e.getState()),[e,t]),Gc.useCallback(()=>t(e.getInitialState()),[e,t]));return Gc.useDebugValue(r),r}var zv=e=>{const t=ym(e),r=s=>mP(t,s);return Object.assign(r,t),r},gP=(e=>e?zv(e):zv),W8=Object.freeze({maxObservations:24,maxSummaryChars:400,maxEvidenceRefs:8,maxEvidenceRefChars:200,maxModelIdChars:128,maxVersionChars:64}),K8=Object.freeze({status:"not-requested",reason:"not_requested",detail:"this run did not request model-backed observations, so nothing was charged"}),vP="missingInputMessage";function Fv(e){if(!(!e||typeof e!="object"||!("missingInput"in e)))switch(e.missingInput){case"tasksProbe":case"logProbe":case"inputRequiredProbe":case"toolCallProbe":case"login":case"protocolVersion":return e.missingInput;default:return}}function bm(e){if(e.status!=="skipped"||e.skipReason!=="could-not-run")return;const t=e.details,r=Fv(t)??Fv(t&&typeof t=="object"&&"details"in t?t.details:void 0);if(r)return r;const s=typeof e.id=="string"?e.id:"",n=mS(e.error);if(s.startsWith("tasks-")&&(n.startsWith("no probe tool could be selected automatically:")||n.startsWith("no listed tool advertises `execution.taskSupport`")))return"tasksProbe";if(s==="modern-logs-require-log-level"&&n.startsWith("No logProbe configured"))return"logProbe";if(s==="modern-undeclared-capability-error"&&n.startsWith("No inputRequiredProbe configured"))return"inputRequiredProbe";if(s==="modern-tool-output-schema-conformant"&&/^\d+ tool\(s\) declare an outputSchema, but no tools\/call fixture was configured:/.test(n))return"toolCallProbe"}function fS(e){return bm(e)!==void 0}function _P(e){return e==="login"||e==="protocolVersion"}var yP={tasksProbe:"Select a tool that creates a task in setup, then run again.",logProbe:"Select a tool that emits logs in setup, then run again.",inputRequiredProbe:"Select a tool that asks for input in setup, then run again.",toolCallProbe:"Select a tool to check output in setup, then run again.",login:"This server needs a login. Log in, then run again.",protocolVersion:"This server doesn't support the protocol version this run uses. Run it on a version the server supports."};function jv(e){if(!e||typeof e!="object")return;const t=e[vP];return typeof t=="string"&&t.trim()?t:void 0}function J8(e){const t=bm(e);if(!t)return;const r=e.details;return jv(r)??jv(r&&typeof r=="object"&&"details"in r?r.details:void 0)??yP[t]}var bP=/^(?:the probed tool )?("(?:[^"\\]|\\.)*") returned a normal result/;function Y8(e){if(e.status!=="skipped"||e.skipReason!=="could-not-run"||typeof e.id!="string"||!e.id.startsWith("tasks-"))return;const t=bP.exec(mS(e.error));if(!t)return;let r;try{r=JSON.parse(t[1])}catch{return}if(typeof r=="string")return SP(r)}function SP(e){return`"${e}" did not create a task, so there was nothing to check. Select a tool that creates a task in setup, or change its arguments so it does, then run again.`}function mS(e){return typeof e=="string"?e:e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"?e.message:""}function Bu(e){return e.status==="skipped"&&e.skipReason==="could-not-run"}function gS(e){return e.status==="skipped"&&e.skipReason!=="could-not-run"}function vS(e){if(e.some(s=>s.status==="failed"))return{outcome:"failed"};const t=e.filter(s=>{if(!Bu(s))return!1;const n=bm(s);return n===void 0||_P(n)});if(t.length===0)return e.length===0?{outcome:"incomplete",incompleteReason:"no checks were selected, so this run establishes nothing"}:e.every(fS)?{outcome:"incomplete",incompleteReason:"every selected check needs input from setup, so this run establishes nothing"}:{outcome:"passed"};const r=Array.from(new Set(t.map(s=>s.error?.message??"reason unavailable")));return{outcome:"incomplete",incompleteReason:`${t.length} of ${e.length} selected check(s) could not run, so this run does not establish conformance (${t.map(s=>s.id).join(", ")}): ${r.join(" ")}`}}function _S(e){const t=e.filter(i=>i.status==="passed").length,r=e.filter(i=>i.status==="failed").length,s=e.filter(Bu).length,n=e.filter(gS).length;return`${t}/${e.length} checks passed, ${r} failed, ${s} could not run, ${n} not applicable`}var X8=Object.freeze({toolNameMaxChars:128,maxFeatureClaims:10,maxToolCalls:2}),wP=/^[A-Za-z]:[\\/]/,kP=/[\u0000-\u001f\u007f]/,EP=new TextEncoder;function TP(e){return EP.encode(e).length}function AP(e){let t=e.length;for(;t>0;){const r=e[t-1];if(r!=="."&&r!==" ")break;t-=1}return e.slice(0,t)}function yS(e){if(typeof e!="string"||e.length===0)return{ok:!1,code:"PATH_EMPTY",message:"path is empty"};if(e.includes("\0"))return{ok:!1,code:"PATH_NUL_BYTE",message:"path contains a NUL byte"};if(kP.test(e))return{ok:!1,code:"PATH_INVALID_CHARACTER",message:"path contains control characters"};if(e.startsWith("/")||e.startsWith("\\")||wP.test(e))return{ok:!1,code:"PATH_ABSOLUTE",message:`absolute paths are not allowed: "${e}"`};const t=e.replace(/\\/g,"/").split("/").filter(r=>r!==""&&r!==".");for(const r of t){if(r==="..")return{ok:!1,code:"PATH_TRAVERSAL",message:`path traversal ("..") is not allowed: "${e}"`};if(r.includes(":"))return{ok:!1,code:"PATH_INVALID_CHARACTER",message:`path segments must not contain ":" (drive prefix / alternate data stream): "${e}"`};const s=AP(r);if(s===""||s==="."||s==="..")return{ok:!1,code:"PATH_INVALID_CHARACTER",message:`path segment "${r}" is not portable (empty or dot name after trailing dot/space stripping)`}}return t.length===0?{ok:!1,code:"PATH_EMPTY",message:"path is empty"}:{ok:!0,path:t.join("/").normalize("NFC")}}function IP(e){return e.normalize("NFKC").toLowerCase()}function Wc(e,t){return t===e||t.startsWith(`${e}/`)}function Pi(e,t){const r=yS(t);return r.ok?{ok:!0,path:e===""?r.path:`${e}/${r.path}`}:r.code==="PATH_ABSOLUTE"||r.code==="PATH_TRAVERSAL"?{ok:!1,code:"PATH_ESCAPES_ROOT",message:`referenced path escapes the bundle root: "${t}"`}:r}function RP(e,t,r){e.length>t.maxEntries&&r.error("BUNDLE_TOO_MANY_ENTRIES",`bundle has ${e.length} entries; the limit is ${t.maxEntries}`);const s=new Set,n=new Map,i=[];let o=0,a=!1;for(const c of e){if(c.kind==="symlink"||c.kind==="hardlink"){r.error("PATH_LINK_ENTRY",`${c.kind} entries are not allowed`,{path:c.path});continue}const l=yS(c.path);if(!l.ok){r.error(l.code,l.message,{path:c.path});continue}const u=l.path;if(TP(u)>t.maxPathBytes){r.error("PATH_TOO_LONG",`path exceeds ${t.maxPathBytes} bytes`,{path:u});continue}if(u.split("/").length>t.maxPathDepth){r.error("PATH_TOO_DEEP",`path exceeds nesting depth ${t.maxPathDepth}`,{path:u});continue}if(s.has(u)){r.error("PATH_DUPLICATE",`duplicate normalized path: "${u}"`,{path:c.path});continue}s.add(u);const p=IP(u),d=n.get(p);if(d!==void 0){r.error("PATH_CASE_COLLISION",`"${u}" collides with "${d}" on case-insensitive filesystems`,{path:u});continue}if(n.set(p,u),c.kind!=="directory"){if(!Number.isFinite(c.size)||c.size<0){r.error("FILE_SIZE_MISMATCH","entry declares an invalid size",{path:u});continue}if(c.size>t.maxFileBytes){r.error("FILE_TOO_LARGE",`file exceeds the per-file limit of ${t.maxFileBytes} bytes`,{path:u});continue}o+=c.size,!a&&o>t.maxTotalBytes&&(a=!0,r.error("BUNDLE_TOO_LARGE",`total uncompressed content exceeds ${t.maxTotalBytes} bytes`)),i.push({sourcePath:c.path,path:u,size:c.size,executable:((c.mode??0)&73)!==0})}}return i.sort((c,l)=>c.path<l.path?-1:c.path>l.path?1:0),i}var wh=class extends Error{code;issues;constructor(e){const t=e.find(s=>s.severity==="error"),r=t?.code??"MANIFEST_INVALID_FIELD";super(t?`plugin bundle validation failed: ${t.code}: ${t.message}`:"plugin bundle validation failed"),this.name="PluginBundleError",this.code=r,this.issues=e}},ii=class{all=[];error(e,t,r){this.all.push({code:e,severity:"error",message:t,...r})}warn(e,t,r){this.all.push({code:e,severity:"warning",message:t,...r})}hasErrors(){return this.all.some(e=>e.severity==="error")}issues(){return[...this.all]}warnings(){return this.all.filter(e=>e.severity==="warning")}throwIfErrors(){if(this.hasErrors())throw new wh(this.issues())}absorbDemoted(e){for(const t of e.issues())this.all.push(t.severity==="error"?{...t,severity:"warning"}:t)}firstErrorMessage(){return this.all.find(e=>e.severity==="error")?.message}};var oc=/(secret|token|password|passwd|api[-_]?key|private[-_]?key|credential)/i,bS=/(bearer\s+\S|-----BEGIN|\b(?:sk|pk|rk|xox[a-z])-[A-Za-z0-9]|[a-z][a-z0-9+.-]*:\/\/[^/\s:@]*:[^/\s@]+@|[A-Za-z0-9+/_-]{40,})/i;function Vu(e){return bS.test(e)}var sa=Symbol("drop");function kh(e,t,r,s,n){if(r>32)return n.reportedTooDeep||(n.reportedTooDeep=!0,s.issues.error("VALUE_TOO_DEEP",`${s.label}: field "${t}" nests deeper than 32 levels`,s.context)),sa;if(typeof e=="string")return bS.test(e)?(s.issues.warn(s.secretCode,`${s.label}: value of "${t}" looks secret-bearing and is not stored`,s.context),sa):e;if(typeof e=="number"||typeof e=="boolean"||e===null)return e;if(Array.isArray(e)){const i=[];for(let o=0;o<e.length;o++){const a=kh(e[o],`${t}[${o}]`,r+1,s,n);a!==sa&&i.push(a)}return i}if(typeof e=="object"){const i={};for(const[o,a]of Object.entries(e)){const c=t===""?o:`${t}.${o}`;if(oc.test(o)){s.issues.warn(s.secretCode,`${s.label}: field "${c}" looks secret-bearing and is not stored`,s.context);continue}const l=kh(a,c,r+1,s,n);l!==sa&&(i[o]=l)}return i}return sa}function Gu(e,t){return kh(e,"",0,t,{reportedTooDeep:!1})}function SS(e){return["localhost","[::1]","::1"].includes(e)||/^127(?:\.\d{1,3}){3}$/.test(e)}var Sm=(e,t)=>!/^[^:/?#]+:\/\/[^\\/?#]/.test(e)||/^[^:]*:[\\/]*[^\\/?#]*@|[\\\s]/.test(e)||t?.allowFragment!==!0&&e.includes("#")||[...e].some(r=>r<" "||r===""),CP=/^[a-z]+(?:[-_][a-z]+)+$/i,PP=e=>e.replace(/%(?!2f)([0-7][0-9a-f])/gi,(t,r)=>String.fromCharCode(Number.parseInt(r,16)));function Jd(e){return[e,PP(e)].some(t=>Vu(t)&&!CP.test(t))}function wm(e){if(e.pathname.split("/").some(Jd))return!0;const t=e.hash.slice(1);if(Jd(t))return!0;for(const r of[e.searchParams,new URLSearchParams(t)])for(const[s,n]of r)if(Jd(n)||n!==""&&oc.test(s))return!0;return!1}function xP(e){let t;try{t=new URL(e)}catch{return{ok:!1,code:"MCP_INVALID_SERVER",message:'"url" is not a valid URL'}}return Sm(e)?{ok:!1,code:"MCP_INVALID_SERVER",message:'"url" must be an absolute https:// URL (or a loopback http:// one) without credentials, a fragment, whitespace or backslashes'}:wm(t)?{ok:!1,code:"MCP_INVALID_SERVER",message:'"url" looks like it carries a credential, which a plugin must not ship'}:t.protocol==="https:"?{ok:!0,loopbackHttp:!1}:t.protocol==="http:"&&SS(t.hostname)?{ok:!0,loopbackHttp:!0}:{ok:!1,code:"MCP_INSECURE_URL",message:"remote MCP servers must use HTTPS"}}function OP(e){if(typeof e!="string")return{ok:!1,code:"MCP_INVALID_SERVER",message:'"cwd" must be a string'};const t=/^(\.|\$\{PLUGIN_ROOT\}|\$\{PLUGIN_DATA\})(?:\/(.*))?$/s.exec(e);if(t===null||t[1]==="."&&t[2]===void 0)return{ok:!1,code:"MCP_INVALID_WORKING_DIRECTORY",message:'"cwd" must start with "./", "${PLUGIN_ROOT}", or "${PLUGIN_DATA}"'};const r=t[1]==="."?"${PLUGIN_ROOT}":t[1],s=t[2]??"";if(s.replace(/[/.]/g,"")===""&&!s.includes(".."))return{ok:!0,value:r};const n=Pi("",s);return n.ok?{ok:!0,value:`${r}/${n.path}`}:{ok:!1,code:n.code,message:n.message}}var wS=/^\$\{[A-Za-z_][A-Za-z0-9_]*\}$/,Hv=/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,MP=/^\$\{(?:PLUGIN_ROOT|PLUGIN_DATA)\}[A-Za-z0-9._/-]*$/,Bv=new Set(["PLUGIN_ROOT","PLUGIN_DATA"]),LP=/^[A-Za-z0-9.:/@,+_-]*$/,NP=/[A-Za-z0-9_-]{16,}/,$P=/(authorization|token|secret|api[-_]?key|cookie|password|credential)/i;function kS(e,t){return e.name<t.name?-1:e.name>t.name?1:0}function DP(e,t,r,s){if(r===void 0)return[];if(r===null||typeof r!="object"||Array.isArray(r))return s.error("MCP_INVALID_ENV",`server "${e}": "env" must be an object`,{componentKey:t}),null;const n=new Map,i=new Set;for(const[o,a]of Object.entries(r)){if(Bv.has(o))return s.error("MCP_RESERVED_ENV_KEY",`server "${e}": env may not define "${o}" — it is client-controlled`,{componentKey:t}),null;if(typeof a!="string"){s.error("MCP_INVALID_ENV",`server "${e}": env "${o}" must be a string`,{componentKey:t});continue}if(MP.test(a)){n.set(o,{name:o,required:!1,valueTemplate:a});continue}if(a===""||wS.test(a)){n.set(o,{name:o,required:!0});continue}const c=[...a.matchAll(Hv)].map(l=>l[1]).filter(l=>!Bv.has(l));if(c.length>0){const l=a.replace(Hv,"");if(LP.test(l)&&!NP.test(l)&&!oc.test(o)){n.set(o,{name:o,required:!1,valueTemplate:a});for(const u of c)i.add(u);continue}}else if(!oc.test(o)&&!Vu(a)){n.set(o,{name:o,required:!1,value:a});continue}n.set(o,{name:o,required:!0}),s.warn("MCP_ENV_VALUE_OMITTED",`server "${e}": literal value of env "${o}" is not stored; configure it during setup`,{componentKey:t})}for(const o of i)n.has(o)||n.set(o,{name:o,required:!0});return[...n.values()].sort(kS)}function UP(e,t,r,s){if(r===void 0)return[];if(r===null||typeof r!="object"||Array.isArray(r))return s.error("MCP_INVALID_HEADERS",`server "${e}": "headers" must be an object`,{componentKey:t}),null;const n=[],i=new Set;for(const[o,a]of Object.entries(r)){if(i.has(o.toLowerCase()))return s.error("MCP_INVALID_HEADERS",`server "${e}": header "${o}" is declared more than once`,{componentKey:t}),null;if(i.add(o.toLowerCase()),typeof a!="string"){s.error("MCP_INVALID_HEADERS",`server "${e}": header "${o}" must be a string`,{componentKey:t});continue}const c=$P.test(o);if(a===""||wS.test(a)){n.push({name:o,secret:c});continue}const l=Vu(a);if(!c&&!l){n.push({name:o,secret:!1,value:a});continue}s.warn("MCP_HEADER_VALUE_OMITTED",`server "${e}": literal value of header "${o}" is not stored; configure it during setup`,{componentKey:t}),n.push({name:o,secret:c||l})}return n.sort(kS)}function qP(e,t,r,s){const n={},i=r.authentication;if(typeof i=="string"){const a=i.toLowerCase();a==="on_install"?n.timing="on_install":a==="on_use"&&(n.timing="on_use")}const o=r.oauth??(typeof i=="object"?i:void 0);if(o&&typeof o=="object"&&!Array.isArray(o)){const a=o,c=a.scopes;Array.isArray(c)&&c.every(p=>typeof p=="string")&&(n.scopes=c);const l={};for(const[p,d]of Object.entries(a))p!=="scopes"&&(l[p]=d);const u=Gu(l,{issues:s,secretCode:"MCP_SECRET_FIELD_OMITTED",label:`server "${e}": oauth`,context:{componentKey:t}});Object.keys(u).length>0&&(n.metadata=u)}return n}var zP={url:"https://developers.openai.com/plugins/deploy/submission-errors",capturedOn:"2026-11-13"},ms={plugin_manifest_missing:{table:"Plugin manifest errors",message:"ZIP must contain root `plugin.json` with a supported Agent Plugins schema, `.codex-plugin/plugin.json`, `.agent-plugin/plugin.json`, or `.claude-plugin/plugin.json` at the root or in its single top-level directory."},plugin_root_ambiguous:{table:"Plugin root errors",message:"ZIP must contain exactly one plugin root, either at the archive root or in one top-level directory."},plugin_root_has_siblings:{table:"Plugin root errors",message:"A ZIP with a top-level plugin directory must not contain sibling files."},plugin_name_missing:{table:"Plugin manifest errors",message:"`name` is required."},plugin_name_wrong_type:{table:"Plugin manifest errors",message:"`name` must be a string."},plugin_name_empty:{table:"Plugin manifest errors",message:"`name` must be non-empty."},plugin_name_too_long:{table:"Plugin manifest errors",message:"`name` must be 64 characters or fewer."},plugin_name_format:{table:"Plugin manifest errors",message:"`name` must start with an ASCII letter or digit and contain only ASCII letters, digits, `_`, or `-`."}},FP=/^(?!.*(?:--|\.\.))[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/;var ES=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;function jP(e){if(e===void 0)return["plugin_name_missing"];if(typeof e!="string")return["plugin_name_wrong_type"];if(e.trim()==="")return["plugin_name_empty"];const t=[];return e.length>64&&t.push("plugin_name_too_long"),ES.test(e)||t.push("plugin_name_format"),t}var HP='manifest "name" must be 1-64 lowercase [a-z0-9.-] chars with single separators (no "--" or "..")';function BP(e,t){const[r]=jP(e),s=t==="openai-compatible";return typeof e=="string"&&(e.length<=64&&FP.test(e)||s&&r===void 0)?{ok:!0,name:e}:{ok:!1,message:s&&r!==void 0?ms[r].message:HP}}var Tn="plugin.json",Eh=Object.freeze({"1.0.0":"https://agent-plugins.org/schemas/1.0.0/plugin.schema.json"}),Qn="com.mcpjam",km=/\[TODO:/i,TS=["description","license"],AS=["homepage","repository"],VP=new Set(["command","entrypoint","exec","install","install_script","postinstall","preinstall","run","script","scripts"]),GP=new Set(["$schema","name","version","author","keywords","extensions","interface",...TS,...AS]);function Th(e,t,r,s=0,n={reportedTooDeep:!1}){if(typeof e=="string"){km.test(e)&&r.error("MANIFEST_PLACEHOLDER",`manifest field "${t}" contains an unresolved placeholder`);return}if(s>32){n.reportedTooDeep||(n.reportedTooDeep=!0,r.error("VALUE_TOO_DEEP",`manifest field "${t}" nests deeper than 32 levels`));return}if(Array.isArray(e)){e.forEach((i,o)=>Th(i,`${t}[${o}]`,r,s+1,n));return}if(e&&typeof e=="object")for(const[i,o]of Object.entries(e))Th(o,t===""?i:`${t}.${i}`,r,s+1,n)}function Vv(e,t,r){if(typeof t!="string"){r.error("MANIFEST_INVALID_FIELD",`manifest field "${e}" must be a string URL`);return}let s;try{s=new URL(t)}catch{r.warn("MANIFEST_INVALID_FIELD",`manifest field "${e}" is not a valid URL; ignored`);return}if(s.username!==""||s.password!==""||wm(s)){r.warn("MANIFEST_SECRET_FIELD_OMITTED",`manifest field "${e}" carries a credential; ignored`);return}if(Sm(t,{allowFragment:!0})){r.warn("MANIFEST_INVALID_FIELD",`manifest field "${e}" is not a URL as written; ignored`);return}if(s.protocol!=="https:"){r.warn("MANIFEST_INSECURE_URL",`manifest field "${e}" must use HTTPS; ignored`);return}return t}function WP(e,t,r,s){const n=t[Qn];if(n===void 0)return;if(n===null||typeof n!="object"||Array.isArray(n)){s.warn("MANIFEST_INVALID_FIELD",`extension namespace "${Qn}" must be an object; ignored`);return}const i=n,o=i.displayName??i.display_name;o!==void 0&&(typeof o!="string"?s.warn("MANIFEST_INVALID_FIELD",`"${Qn}.displayName" must be a string; ignored`):e.displayName=o);for(const a of["icon","logo"]){const c=i[a];if(c===void 0)continue;if(typeof c!="string"){s.warn("MANIFEST_INVALID_FIELD",`"${Qn}.${a}" must be a bundle-relative path; ignored`);continue}const l=Pi("",c);if(!l.ok){s.warn(l.code,`"${Qn}.${a}": ${l.message}`);continue}if(!r.has(l.path)){s.warn("MANIFEST_MISSING_FILE",`"${Qn}.${a}" references a file that is not in the bundle: "${l.path}"`,{path:l.path});continue}e[a]=l.path}}var es="com.openai",IS=["logo","logoDark","composerIcon"];function hi(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function KP(e,t,r,s){for(const{label:n,value:i}of t)if(i!==void 0){if(!hi(i)){s.warn("MANIFEST_INVALID_FIELD",`"${n}" must be an object; ignored`);continue}i.displayName!==void 0&&typeof i.displayName!="string"?s.warn("MANIFEST_INVALID_FIELD",`"${n}.displayName" must be a string; ignored`):i.displayName?.trim()&&(km.test(i.displayName)?s.warn("MANIFEST_INVALID_FIELD",`"${n}.displayName" is an unresolved placeholder; ignored`):e.displayName=i.displayName);for(const o of IS){const a=i[o];if(a===void 0)continue;if(typeof a!="string"){s.warn("MANIFEST_INVALID_FIELD",`"${n}.${o}" must be a bundle-relative path; ignored`);continue}const c=Pi("",a);if(!c.ok){s.warn(c.code,`"${n}.${o}": ${c.message}`);continue}if(!r.has(c.path)){s.warn("MANIFEST_MISSING_FILE",`"${n}.${o}" references a file that is not in the bundle: "${c.path}"`,{path:c.path});continue}e[o]=c.path}}}function JP(e,t){if(e.logo===void 0&&e.logoDark===void 0){t.warn("MANIFEST_DIRECTORY_ICON_MISSING",'plugin has no directory icon: OpenAI requires "interface.logo" (light) and "interface.logoDark" (dark), PNG');return}if(e.logo===void 0||e.logoDark===void 0){const r=e.logo===void 0?"logo":"logoDark";t.warn("MANIFEST_DIRECTORY_ICON_VARIANT_MISSING",`plugin directory icon has no ${r==="logo"?"light":"dark"} variant: add "interface.${r}"`)}}function YP(e,t){const{filePaths:r,issues:s}=t;if(e===null||typeof e!="object"||Array.isArray(e))return s.error("MANIFEST_INVALID_JSON","plugin.json must contain a JSON object"),{manifest:null};const n=e,i=n.$schema,o=typeof i=="string"?Object.keys(Eh).find(f=>Eh[f]===i):void 0;if(o===void 0)return s.error("MANIFEST_UNSUPPORTED_SCHEMA",i===void 0?'manifest is missing the required "$schema" field':`manifest "$schema" is not a supported Agent Plugins schema: ${String(i)}`),{manifest:null};const a=BP(n.name,t.profile??"strict");if(!a.ok)return s.error("MANIFEST_INVALID_NAME",a.message),{manifest:null};const c={schemaVersion:o,name:a.name,extensions:{}};n.version!==void 0&&(typeof n.version!="string"||n.version.length===0?s.error("MANIFEST_INVALID_VERSION",'manifest "version" must be a non-empty string when present'):c.version=n.version);for(const f of TS){const m=n[f];if(m!==void 0){if(typeof m!="string"){s.error("MANIFEST_INVALID_FIELD",`manifest field "${f}" must be a string`);continue}c[f]=m}}for(const f of AS){if(n[f]===void 0)continue;const m=Vv(f,n[f],s);m!==void 0&&(c[f]=m)}const l=n.author;if(l!==void 0)if(l&&typeof l=="object"&&!Array.isArray(l)){const f=l,m={};for(const v of Object.keys(f)){if(v==="name"||v==="email"||v==="url"){v!=="url"&&typeof f[v]!="string"&&s.error("MANIFEST_INVALID_FIELD",`manifest field "author.${v}" must be a string`);continue}s.warn("MANIFEST_UNKNOWN_FIELD",`manifest field "author.${v}" is not part of Agent Plugins ${o}; ignored`)}if(typeof f.name=="string"&&(m.name=f.name),typeof f.email=="string"&&(m.email=f.email),f.url!==void 0){const v=Vv("author.url",f.url,s);v!==void 0&&(m.url=v)}c.author=m}else s.error("MANIFEST_INVALID_FIELD",'manifest field "author" must be an object');const u=n.keywords;u!==void 0&&(!Array.isArray(u)||u.some(f=>typeof f!="string")?s.error("MANIFEST_INVALID_FIELD",'manifest field "keywords" must be an array of strings'):c.keywords=u);const p=hi(n.extensions)?n.extensions[es]:void 0,d=n.interface!==void 0||p!==void 0;KP(c,[{label:"interface",value:n.interface},{label:`extensions.${es}.interface`,value:hi(p)?p.interface:void 0}],r,s);const h=n.extensions;h!==void 0&&(h===null||typeof h!="object"||Array.isArray(h)?s.warn("MANIFEST_INVALID_FIELD",'manifest field "extensions" must be an object; ignored'):(c.extensions=Gu(ZP(h),{issues:s,secretCode:"MANIFEST_SECRET_FIELD_OMITTED",label:"manifest extensions"}),WP(c,h,r,s))),d&&JP(c,s);for(const f of Object.keys(n))if(!GP.has(f)){if(VP.has(f)){s.error("MANIFEST_AMBIGUOUS_FIELD",`manifest field "${f}" is not supported and is execution-ambiguous; remove it`);continue}s.warn("MANIFEST_UNKNOWN_FIELD",`manifest field "${f}" is not part of Agent Plugins ${o}; ignored`)}return Th(c,"",s),{manifest:c,onboardingSkill:hi(p)?p.onboardingSkill:void 0}}var XP=new Set(["displayName",...IS]);function ZP(e){const t=e[es];if(!hi(t))return e;const{onboardingSkill:r,...s}=t;return hi(s.interface)&&(s.interface=Object.fromEntries(Object.entries(s.interface).filter(([n,i])=>!XP.has(n)||typeof i!="string"||!km.test(i)))),{...e,[es]:s}}function QP(e,t,r,s){const n=e.extensions[es],i=hi(n)?{...n}:void 0;if(i!==void 0&&(delete i.onboardingSkill,e.extensions[es]=i),t===void 0)return;const o=typeof t=="string"?Pi("",t):null,a=o?.ok?r.find(c=>c.skillFilePath===o.path):void 0;if(a===void 0||i===void 0){s.warn("MANIFEST_MISSING_FILE","the onboarding skill this plugin names is not one of its loaded skills; onboarding is unavailable");return}e.onboarding={skillPath:a.skillFilePath,componentKey:a.componentKey},i.onboardingSkill=t}var ex={maxEntries:1e3,maxTotalBytes:104857600,maxFileBytes:10485760,maxPathBytes:512,maxPathDepth:20,maxSkills:20,maxMcpServers:20},RS=Object.freeze({strict:2,"openai-compatible":1}),ps=".codex-plugin/plugin.json",CS=".agent-plugin/plugin.json",PS=".claude-plugin/plugin.json",tx=".mcp.json",xS=[{path:ps,layout:"codex"},{path:CS,layout:"agent-legacy"},{path:PS,layout:"claude"}],rx=new Set(["skills","mcpServers","apps","interface","onboardingSkill","extensions"]),OS={hooks:"lifecycle hooks",commands:"slash commands",agents:"agents",outputStyles:"output styles",lspServers:"language servers"};function Ws(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function MS(e,t){if(typeof e!="string")return!1;const r=Pi("",e);return r.ok&&r.path===t}function LS(e,t,r){const s=e.extensions,n=Ws(s)?s[es]:void 0,i=Ws(n)?{...n}:{};for(const a of["interface","apps"])e[a]!==void 0&&i[a]===void 0&&(i[a]=e[a]);const o=e.onboardingSkill;return o!==void 0&&i.onboardingSkill===void 0?i.onboardingSkill=o:o!==void 0&&i.onboardingSkill!==o&&(r.warn("MANIFEST_INVALID_FIELD",`${t} declares two different onboarding skills; neither is used`,{path:t}),delete i.onboardingSkill),i}function NS(e,t){const{[es]:r,...s}=e??{};return Object.keys(t).length>0?{...s,[es]:t}:s}function $S(e,t,r){for(const[s,n]of Object.entries(OS))e[s]!==void 0&&r.warn("UNSUPPORTED_COMPONENT",`"${s}" in ${t} declares ${n}, which MCPJam does not run; ignored`,{path:t})}function sx(e,t,{filePaths:r,issues:s}){if(e===void 0)return r.has(".mcp.json")?{legacyMcp:{kind:"file",path:tx}}:{};if(Ws(e))return{legacyMcp:{kind:"inline",path:t,document:e}};const n=typeof e=="string"?Pi("",e):null;if(n===null||!n.ok){const i=`"mcpServers" in ${t}: ${n===null?"must be a path or an object":n.message}`;return s.warn(n?.code??"MCP_INVALID_CONFIG",i,{path:t}),{skipped:{kind:"mcp-config",key:t,reason:i}}}return r.has(n.path)?{legacyMcp:{kind:"file",path:n.path}}:(s.warn("MANIFEST_MISSING_FILE",`"mcpServers" in ${t} names "${n.path}", which is not in the bundle`,{path:n.path}),{})}function nx(e,t,r){const{issues:s}=r,n=t.manifestPath,i={};for(const[c,l]of Object.entries(e))!rx.has(c)&&!(c in OS)&&(i[c]=l);const o=i.$schema;String(o).startsWith("https://agent-plugins.org/schemas/")||(i.$schema=Eh["1.0.0"]);const a=e.extensions;if(a!==void 0&&!Ws(a))i.extensions=a;else{const c=NS(a,LS(e,n,s));Object.keys(c).length>0&&(i.extensions=c)}if(e.skills!==void 0&&!MS(e.skills,"skills")){const c=typeof e.skills=="string"?`"${e.skills}"`:"a non-path value";s.warn("UNSUPPORTED_COMPONENT",`"skills" in ${n} names ${c}; skills are read only from "skills/"`,{path:n})}return $S(e,n,s),{interpretation:t,record:i,...sx(e.mcpServers,n,r)}}function ix(e,t,{readJson:r,issues:s}){const n=l=>(s.warn("MANIFEST_OVERLAY_IGNORED",`"${ps}" is ignored: ${l}`,{path:ps}),{interpretation:t,record:e}),i=e.extensions;if(i!==void 0&&!Ws(i))return n(`"${Tn}" has no usable "extensions"`);if(Ws(i?.["com.openai"]))return n(`"${Tn}" declares extensions["${es}"], which replaces it`);const o=new ii,a=r(ps,o);if(!Ws(a))return n(o.firstErrorMessage()??"it must be a JSON object");for(const[l,u]of[["skills","skills"],["mcpServers","mcp.json"]])a[l]===void 0||MS(a[l],u)||s.warn("MANIFEST_OVERLAY_IGNORED",`"${l}" in ${ps} is ignored: with a root plugin.json it is always "${u}"`,{path:ps});$S(a,ps,s);const c=LS(a,ps,s);return{interpretation:{...t,overlayPath:ps},record:{...e,extensions:NS(i,c)}}}function DS(e,{filePaths:t,issues:r}){for(const{path:s}of xS)s===e||e==="plugin.json"&&s===".codex-plugin/plugin.json"||!t.has(s)||r.warn("MANIFEST_OVERLAY_IGNORED",`"${s}" is ignored: "${e}" is the manifest`,{path:s})}function ox(e){const{profile:t,filePaths:r,readJson:s,issues:n}=e,i={profile:t,revision:RS[t],layout:"agent-plugins",manifestPath:Tn},o=s(Tn,n);return t==="strict"||!Ws(o)?{interpretation:i,record:o}:(DS(Tn,e),r.has(".codex-plugin/plugin.json")?ix(o,i,e):{interpretation:i,record:o})}function ax(e){const{profile:t,location:r,readJson:s,issues:n}=e;if(r.layout==="agent-plugins")return ox(e);DS(r.path,e);const i={profile:t,revision:RS[t],layout:r.layout,manifestPath:r.path},o=s(r.path,n);return Ws(o)?nx(o,i,e):{interpretation:i,record:o}}var Gv="2026-08-19",Wv="https://developers.openai.com/plugins",US=["quickstart","plugin-guidelines","reference","changelog","plan/use-case","plan/tools","concepts/plugins","concepts/skills","concepts/ui-guidelines","build/plugins","build/skills","build/mcp-server","build/chatgpt-ui","build/auth","build/monetization","build/examples","deploy/connect-chatgpt","deploy/submission","deploy/submission-errors","deploy/troubleshooting","guides/optimize-metadata","guides/submit-claude-plugin","guides/product-checkout-conversion-spec"],qS=[{page:"help/plugins-in-chatgpt-and-codex",url:"https://help.openai.com/en/articles/20001256-plugins-in-chatgpt-and-codex"},{page:"help/submitting-apps-to-the-chatgpt-app-directory",url:"https://help.openai.com/en/articles/20001040-submitting-apps-to-the-chatgpt-app-directory"}],zS={"app-guidelines":"plugin-guidelines"};function cx(e){return Object.hasOwn(zS,e)}var Z8=[...US,...qS.map(e=>e.page)],Kv={},lx=[...US.map(e=>({page:e,url:`${Wv}/${e}`,revisionUrl:`${Wv}/${e}.md`,format:"markdown",revision:Kv[e]??null,snapshotDate:Gv})),...qS.map(e=>({page:e.page,url:e.url,revisionUrl:e.url,format:"html",revision:Kv[e.page]??null,snapshotDate:Gv}))],ux=Object.freeze(Object.fromEntries(lx.map(e=>[e.page,e])));function Vr(e,t){const r=ux[cx(e)?zS[e]:e];return{page:r.page,section:t,url:r.url,revision:r.revision,snapshotDate:r.snapshotDate}}var Ml={maxCompressedBytes:104857600,maxUncompressedBytes:536870912,maxEntries:5e3},dx={portable:Tn,canonical:ps,accepted:[CS,PS]},vr={nameMaxLength:100,pluginNameMaxLength:64,displayNameMaxLength:100,shortDescriptionMaxLength:255,descriptionMaxLength:2e3,defaultPromptMaxLength:255,toolNameMaxLength:64,skillNameMaxLength:64},FS=["productivity","education","developer-tools","design","writing","research","data-analysis","marketing","sales","finance","health","travel","entertainment"],Ll={minEdgePx:48,maxEdgePx:4096,mustBeSquare:!0,maxBytes:5242880,acceptedMimeTypes:["image/png","image/jpeg","image/webp","image/svg+xml"]},px={lightBackground:"#FFFFFF",darkBackground:"#212121",minRatio:2},ei={maxSkillMarkdownBytes:262144,maxPageBytes:1048576,maxSkillTotalBytes:5242880,maxImportedTotalBytes:8388608,maxSkills:5,maxPagesPerSkill:10},hx="/.well-known/openai-apps-challenge",fx="text/html;profile=mcp-app",mx="/mcp",gx=["readOnlyHint","destructiveHint","openWorldHint"],oi={successCount:5,failureCount:3},vx={originChangeRequiresNewPlugin:!0,uiContentChangesStayLive:!0,uiContentCacheSeconds:3600},Q8={archiveLimits:Ml,manifestLocations:dx,fieldLimits:vr,listingCategories:FS,imageConstraints:Ll,brandColorContrast:px,mcpSkillLimits:ei,domainVerificationPath:hx,appHtmlMime:fx,expectedMcpPath:mx,requiredToolAnnotations:gx,submissionTestCases:oi,releaseRules:vx,source:Vr("deploy/submission","Host profile constants")},jS={columns:["Resource","Lookup"],keys:["fixture","lookup"],placeholders:[["Sample Project",'get_project {"name": "Sample Project"}']],maxRows:20,grow:!0},_x="Upload new or existing plugin",yx={upload:{title:"Upload your plugin ZIP",intro:"Compress your plugin folder into a .zip file before uploading",layout:{blocks:[{widget:"upload",text:{drop:"Upload new or existing plugin",button:"Upload plugin",checked:"Errors block the upload; warnings require confirmation."}}]}},listing:{title:"Metadata & Skills",intro:"Package details are read-only here; edit them in your source package.",layout:{blocks:[{widget:"plugin-header",fields:["listing.displayName","listing.shortDescription"]},{heading:"Metadata",fields:["listing.description","listing.developer","listing.name","listing.category","listing.capabilities","listing.website","listing.support","listing.privacyPolicy","listing.terms","listing.starterPrompts"],text:{upload:"Upload new version"}},{heading:"Skills",widget:"skills",text:{passed:"Checks passed",attention:"Needs attention"}},{widget:"findings",text:{title:"Findings",all:"All",blocking:"Blocking",copy:"Copy findings"}}]}},mcp:{title:"MCPs",intro:"Your package can declare multiple MCP servers, but only one MCP server can be connected per plugin.",layout:{blocks:[{heading:"Connect MCP server",widget:"connect",fields:["mcp.serverUrl","mcp.verificationToken"],text:{authentication:"Authentication",authorize:"Your MCP server needs OAuth access before we can scan its tools.",settings:"You can define advanced settings in your mcp.json",domain:"Domain verification",verified:"Domain verified",reconnect:"Reconnect",rescan:"Rescan"}},{heading:"Tools",widget:"tools"}]}},reviewer:{title:"Review information",intro:"Read-only fields are managed by your plugin ZIP. To change read-only information, update your plugin ZIP and upload it again.",layout:{blocks:[{heading:"Countries and translations",note:"Its fields were not captured."},{heading:"Reviewer credentials",note:"Test credentials must work immediately with no additional setup required. Logging in must provide immediate access to a demo account.",fields:["reviewer.loginUrl","reviewer.tenant","reviewer.username","reviewer.passwordSecret","reviewer.signInSteps"]},{fields:["reviewer.identityTool","reviewer.identityArgs","reviewer.expectedIdentityPath","reviewer.expectedIdentity","reviewer.expectedOrganizationPath","reviewer.expectedOrganization","reviewer.fixtures"]},{heading:"Test cases",fields:["reviewer.testCases"]},{heading:"Negative test cases",fields:["reviewer.negativeTestCases"]},{heading:"Supporting content",fields:["reviewer.demoRecordingUrl","reviewer.releaseNotes"]},{widget:"drawer-actions",text:{back:"Back",next:"Next",save:"Save details"}}]}},submit:{title:"Submit for review",intro:"Complete the required policy attestations.",layout:{blocks:[{fields:["submit.developerIdentity"]},{fields:["submit.attestations"]},{widget:"non-blocking-findings",text:{title:"Non-blocking findings",body:"These findings do not block submission, but unresolved findings may lead to rejection during review."}},{fields:["submit.additionalContext"]},{widget:"submit",text:{cancel:"Cancel",submit:"Submit"}}]}},publish:{title:"Publish your approved plugin",intro:"Open the approved package version and select Publish plugin.",layout:{blocks:[{widget:"publish",text:{button:"Publish plugin"}}]}}},bx={"listing.displayName":{label:"Display name",packagePath:"plugin.json#/extensions/com.openai/interface/displayName",errors:{required:"Display name is required, non-empty, and single-line.",tooLong:"Display name must be 30 characters or fewer."}},"listing.shortDescription":{label:"Short description",packagePath:"plugin.json#/extensions/com.openai/interface/shortDescription",errors:{required:"Short description is required, non-empty, and single-line.",tooLong:"Short description must be 30 characters or fewer."}},"listing.description":{label:"About",packagePath:"plugin.json#/extensions/com.openai/interface/longDescription",errors:{required:"Long description is required and must be non-empty. Line breaks are allowed.",tooLong:"Long description must be 4,000 characters or fewer."}},"listing.developer":{label:"Developer",packagePath:"plugin.json#/extensions/com.openai/interface/developerName",errors:{required:"Developer name is required.",tooLong:"Developer name must be 80 characters or fewer."}},"listing.name":{label:"Package name",packagePath:"plugin.json#/name"},"listing.category":{label:"Category",packagePath:"plugin.json#/extensions/com.openai/interface/category",options:[{value:"Productivity",label:"Productivity"},{value:"Creativity",label:"Creativity"},{value:"Developer Tools",label:"Developer Tools"},{value:"Business & Operations",label:"Business & Operations"},{value:"Data & Analytics",label:"Data & Analytics"},{value:"Communication",label:"Communication"},{value:"Education & Research",label:"Education & Research"},{value:"Security",label:"Security"},{value:"Finance",label:"Finance"},{value:"Healthcare",label:"Healthcare"},{value:"Travel",label:"Travel"},{value:"Entertainment",label:"Entertainment"},{value:"Other",label:"Other"}]},"listing.capabilities":{label:"Capabilities",packagePath:"plugin.json#/extensions/com.openai/interface/capabilities"},"listing.website":{label:"Website",packagePath:"plugin.json#/extensions/com.openai/interface/websiteURL",errors:{required:"Website URL is required."}},"listing.support":{label:"Support",packagePath:"plugin.json#/extensions/com.openai/interface/supportURL"},"listing.privacyPolicy":{label:"Privacy policy",packagePath:"plugin.json#/extensions/com.openai/interface/privacyPolicyURL"},"listing.terms":{label:"Terms of service",packagePath:"plugin.json#/extensions/com.openai/interface/termsOfServiceURL"},"listing.starterPrompts":{label:"Starter prompts",packagePath:"plugin.json#/extensions/com.openai/interface/defaultPrompt"},"mcp.serverUrl":{label:"MCP Server URL",packagePath:"mcp.json#/mcpServers/*/url"},"mcp.verificationToken":{label:"Domain verification token",helper:"The portal issues this token in its MCP step."},"reviewer.loginUrl":{label:"Login URL"},"reviewer.tenant":{label:"Tenant",placeholder:"Choose an organization"},"reviewer.username":{label:"Username"},"reviewer.passwordSecret":{label:"Password",placeholder:"Demo account password"},"reviewer.signInSteps":{label:"Sign-in steps",placeholder:"Steps for this account"},"reviewer.identityTool":{label:"Identity tool",placeholder:"whoami",helper:"MCPJam's own check, not part of the portal: a read-only tool on your server that returns the signed-in account. MCPJam calls it as the reviewer."},"reviewer.identityArgs":{label:"Identity tool arguments",placeholder:"{}",helper:"Fixed JSON arguments, if the identity tool takes any."},"reviewer.expectedIdentityPath":{label:"Identity path",placeholder:"$.user.email",helper:"Where the tool's result names the account, as a JSON path."},"reviewer.expectedIdentity":{label:"Expected reviewer",placeholder:"review@example.com",helper:"The account reviewers sign in as."},"reviewer.expectedOrganizationPath":{label:"Organization path",placeholder:"$.organization.name",helper:"Where the tool's result names the organization or project, as a JSON path."},"reviewer.expectedOrganization":{label:"Expected organization",placeholder:"Sample Org",helper:"The organization or project reviewers should land in."},"reviewer.fixtures":{label:"Fixtures",helper:"MCPJam's own check: resources your test cases name, each with a read-only tool call that finds it in the reviewer's account."},"reviewer.testCases":{label:"Test cases",packagePath:"plugin.json#/extensions/com.openai/review/test_cases/positive"},"reviewer.negativeTestCases":{label:"Negative test cases",packagePath:"plugin.json#/extensions/com.openai/review/test_cases/negative"},"reviewer.demoRecordingUrl":{label:"Video walkthrough URL",packagePath:"plugin.json#/extensions/com.openai/review/demo_recording_url"},"reviewer.releaseNotes":{label:"Release notes",packagePath:"plugin.json#/extensions/com.openai/publication/release_notes"},"submit.developerIdentity":{label:"Developer identity"},"submit.attestations":{label:"Policy attestations",options:[{value:"terms-and-guidelines",label:"I have reviewed and agree to OpenAI's Terms and Plugin Guidelines. I confirm that my plugin is in compliance with those Terms and Guidelines."},{value:"applicable-laws",label:"I confirm that my plugin complies with all laws and regulations applicable to the industry it operates in. I understand that I am responsible for that compliance."},{value:"no-money-movement",label:"I confirm that my plugin does not initiate or execute money transfers, crypto transfers, or investment trades on behalf of users."},{value:"third-party-rights",label:"I confirm that I have all necessary rights to any third-party content or API endpoints accessed, displayed, or used by my plugin."},{value:"suitable-under-18",label:"I confirm that my plugin is suitable for individuals under 18 and does not include mature or adult content."},{value:"not-targeting-children",label:"I confirm that my plugin does not target children under 13 or share their personal information with OpenAI."}]},"submit.additionalContext":{label:"Additional Submission Context",helper:"Add any additional information that might be useful for the review team, including justification for any findings. This optional note is private to the review."}},Sx=[{step:"upload",needs:["package"],reads:[],checks:["openai.package.archive","openai.package.manifest","openai.package.skills","openai.package.assets","openai.package.exclusions","openai.package.manifest-location","openai.package.observation.*","openai.migration.unsupported-surfaces","openai.migration.user-config","openai.migration.stdio-transport","openai.migration.host-language"]},{step:"listing",needs:["package"],reads:["listing.displayName","listing.shortDescription","listing.description"],checks:["openai.policy.non-promotional-package"]},{step:"listing",needs:[],reads:["listing.displayName","listing.shortDescription","listing.description"],checks:["openai.policy.non-promotional-listing"]},{step:"listing",needs:[],reads:["listing.displayName","listing.shortDescription","listing.description","listing.category"],checks:["openai.submission.listing-fields"]},{step:"listing",field:"listing.privacyPolicy",needs:[],reads:["listing.privacyPolicy","listing.support"],checks:["openai.submission.urls"]},{step:"listing",field:"listing.privacyPolicy",needs:[],reads:["listing.privacyPolicy"],checks:["openai.submission.privacy-disclosure","openai.policy.privacy-consistency"]},{step:"listing",needs:[],reads:[],checks:["openai.policy.originality","openai.policy.no-advertising","openai.policy.commerce","openai.feature.checkout"]},{step:"listing",needs:["server"],reads:["mcp.serverUrl"],checks:["openai.skills.extension","openai.skills.listing-complete","openai.skills.caps","openai.skills.digests","openai.skills.frontmatter","openai.skills.snapshot","openai.feature.imported-skills","openai.ui.screenshots"]},{step:"listing",needs:["server","model"],reads:["mcp.serverUrl"],checks:["openai.experience.listing-copy-placeholder","openai.experience.listing-copy-overpromises","openai.experience.skill-overlap"]},{step:"mcp",field:"mcp.serverUrl",needs:[],reads:["mcp.serverUrl"],checks:["openai.endpoint.https","openai.endpoint.path"]},{step:"mcp",field:"mcp.serverUrl",needs:["server"],reads:["mcp.serverUrl"],checks:["openai.endpoint.redirects-stay-https","openai.endpoint.redirects-terminate"]},{step:"mcp",field:"mcp.verificationToken",needs:["server"],reads:["mcp.serverUrl","mcp.verificationToken"],checks:["openai.domain.challenge-served","openai.domain.challenge-matches"]},{step:"mcp",field:"mcp.verificationToken",needs:[],reads:["mcp.verificationToken"],checks:["openai.submission.domain-token"]},{step:"mcp",needs:["server"],reads:["mcp.serverUrl"],checks:["openai.auth.challenge","openai.auth.prm-discoverable","openai.auth.prm-pointer","openai.auth.issuers-resolve","openai.auth.pkce-s256","openai.auth.rfc9207-iss","openai.auth.client-acquisition","openai.auth.runtime-challenge","openai.auth.unsupported-flows","openai.tools.annotations","openai.tools.descriptions","openai.tools.name-length","openai.tools.schemas","openai.tools.annotation-honesty","openai.tools.security-schemes","openai.profile.declared","openai.profile.input-empty","openai.profile.output-schema","openai.profile.read-only","openai.profile.description-honesty","openai.ui.mime","openai.ui.domain-present","openai.ui.domain-unique","openai.ui.csp-exact","openai.ui.output-schema","openai.ui.useful-without-ui","openai.submission.annotation-justifications","openai.submission.frame-domain-explanations","openai.release.origin","openai.release.contract","openai.release.schema-compatibility","openai.release.live-changes","openai.feature.profile-identification","openai.feature.ui-templates","openai.feature.cimd","openai.feature.lazy-authentication"]},{step:"mcp",needs:[],reads:[],checks:["openai.submission.scan-currency","openai.policy.predictable-side-effects","openai.policy.response-minimization"]},{step:"mcp",needs:["server","model"],reads:["mcp.serverUrl"],checks:["openai.experience.tool-descriptions-uninformative","openai.experience.tool-overlap","openai.experience.naming-inconsistent","openai.experience.destructive-tool-underexplained","openai.experience.auth-story-unclear","both.decision.annotation-matches-behaviour"]},{step:"mcp",needs:["model"],reads:["mcp.serverUrl","listing.displayName","listing.shortDescription","listing.description"],checks:["openai.decision.fair-play","openai.decision.secret-seeking"]},{step:"reviewer",needs:[],reads:["reviewer.demoRecordingUrl","reviewer.loginUrl","reviewer.username","reviewer.passwordSecret"],checks:["openai.submission.demo-access"]},{step:"reviewer",field:"reviewer.identityTool",needs:["server","reviewer"],reads:["mcp.serverUrl","reviewer.identityTool","reviewer.identityArgs","reviewer.expectedIdentityPath","reviewer.expectedIdentity","reviewer.expectedOrganizationPath","reviewer.expectedOrganization"],checks:["both.reviewer.identity"]},{step:"reviewer",field:"reviewer.fixtures",needs:["server","reviewer"],reads:["mcp.serverUrl","reviewer.fixtures","reviewer.testCases","reviewer.negativeTestCases","reviewer.signInSteps","reviewer.identityTool","reviewer.identityArgs","reviewer.expectedIdentityPath","reviewer.expectedIdentity","reviewer.expectedOrganizationPath","reviewer.expectedOrganization"],checks:["both.reviewer.fixtures"]},{step:"mcp",needs:["server"],reads:["mcp.serverUrl"],checks:["both.auth.client-signatures"]},{step:"reviewer",field:"reviewer.testCases",needs:[],reads:["reviewer.testCases","reviewer.negativeTestCases"],checks:["openai.submission.test-cases"]},{step:"reviewer",field:"reviewer.negativeTestCases",needs:[],reads:["reviewer.negativeTestCases"],checks:["openai.submission.test-case-quality"]},{step:"reviewer",field:"reviewer.releaseNotes",needs:[],reads:["reviewer.releaseNotes"],checks:["openai.submission.release-notes"]},{step:"reviewer",needs:[],reads:[],checks:["openai.submission.geography"]},{step:"submit",field:"submit.attestations",needs:[],reads:["submit.attestations"],checks:["openai.submission.attestations","openai.submission.attestation-truth"]},{step:"submit",field:"submit.developerIdentity",needs:[],reads:["submit.developerIdentity"],checks:["openai.submission.account"]},{step:"submit",needs:[],reads:[],checks:["openai.submission.profile-valid"]}],wx={"runtime-compatibility":"mcp","directory-policy":"mcp","plugin-package":"upload","release-contract":"mcp","optional-features":"mcp","submission-artifacts":"reviewer","experience-insights":"mcp"},yo={title:_x,steps:yx,fields:bx,placements:Sx,laneSteps:wx},kx=["server","reviewer","model","package"];function HS(e,t,r){return Object.keys(t).filter(s=>s.startsWith(`${e}.`)).map(s=>({key:s,...r[s],...t[s],errors:r[s].errors??{}}))}function BS(e,t){return t.flatMap(({checks:r,needs:s,...n})=>r.map(i=>({checkId:i,...n,needs:s.map(o=>{const a=kx.find(c=>c===o);if(!a)throw new Error(`${e} names an unknown need: ${o}`);return a})})))}var Ex=yo.fields,Jv=yo.steps,Ni={format:"https-url"},qt={managedBy:"package"};function wt(e,t={}){return{control:e,required:!0,...t}}function or(e,t={}){return{control:e,...t}}var Tx={"listing.displayName":wt("text",{...qt,maxLength:30}),"listing.shortDescription":wt("text",{...qt,maxLength:30}),"listing.description":wt("textarea",{...qt,maxLength:4e3}),"listing.developer":wt("text",{...qt,maxLength:80}),"listing.name":wt("text",{...qt,maxLength:vr.pluginNameMaxLength}),"listing.category":or("select",qt),"listing.capabilities":or("multi-select",{...qt,freeEntry:!0,maxItems:20}),"listing.website":wt("text",{...qt,...Ni}),"listing.support":wt("text",{...qt,...Ni}),"listing.privacyPolicy":wt("text",{...qt,...Ni}),"listing.terms":wt("text",{...qt,...Ni}),"listing.starterPrompts":or("multi-select",{...qt,freeEntry:!0,maxItems:3}),"mcp.serverUrl":wt("server",{...qt,...Ni}),"mcp.verificationToken":or("text"),"reviewer.loginUrl":wt("text",Ni),"reviewer.tenant":or("text"),"reviewer.username":wt("text"),"reviewer.passwordSecret":wt("secret"),"reviewer.signInSteps":or("textarea",{requiredWith:["reviewer.tenant"]}),"reviewer.identityTool":or("text",{requiredWith:["reviewer.expectedIdentity","reviewer.expectedOrganization"]}),"reviewer.identityArgs":or("text"),"reviewer.expectedIdentityPath":or("text",{requiredWith:["reviewer.expectedIdentity"]}),"reviewer.expectedIdentity":or("text",{requiredWith:["reviewer.expectedIdentityPath"]}),"reviewer.expectedOrganizationPath":or("text",{requiredWith:["reviewer.expectedOrganization"]}),"reviewer.expectedOrganization":or("text",{requiredWith:["reviewer.expectedOrganizationPath"]}),"reviewer.fixtures":or("pairs",{pairs:jS}),"reviewer.testCases":wt("rows",{...qt,minItems:oi.successCount,maxItems:oi.successCount}),"reviewer.negativeTestCases":wt("rows",{...qt,minItems:oi.failureCount,maxItems:oi.failureCount}),"reviewer.demoRecordingUrl":wt("text",{...qt,format:"url"}),"reviewer.releaseNotes":wt("textarea",qt),"submit.developerIdentity":wt("text"),"submit.attestations":wt("checkbox-group",{declaration:!0,minItems:yo.fields["submit.attestations"].options.length}),"submit.additionalContext":or("textarea")},eG={id:"chatgpt-plugin",directory:"openai",title:yo.title,version:"2026-11-13",source:{label:"OpenAI plugin submission docs and the ChatGPT plugin portal",url:"https://developers.openai.com/plugins/deploy/submission",capturedAt:"2026-11-13"},submissionUrl:"https://platform.openai.com/plugins",steps:Object.keys(Jv).map(e=>({id:e,...Jv[e],fields:HS(e,Tx,Ex)})),placements:BS("chatgpt-plugin.json",yo.placements),laneSteps:yo.laneSteps},Ax="2026-11-13",Ix="2026-08-19";var Rx=["directory","verification","submission","review-criteria","authentication","lazy-authentication","enterprise-managed-auth","troubleshooting","mcp-apps/cross-compatibility","mcp-apps/external-links","mcp-apps/troubleshooting","mcp-apps/design-guidelines"],Cx=[{page:"directory",url:"https://claude.com/docs/directory/publish"},{page:"verification",url:"https://claude.com/docs/connectors/verification"}],Px=["directory","verification","submission","review-criteria","authentication"],xx={},Ox=Rx.map(e=>{const t=Cx.find(s=>s.page===e),r=Px.includes(e)?Ax:void 0;return{page:e,url:t?.url??`https://claude.com/docs/connectors/building/${e}`,revision:xx[e]??r??null,snapshotDate:r??Ix}}),Mx=Object.freeze(Object.fromEntries(Ox.map(e=>[e.page,e])));function cn(e,t){const r=Mx[e];return{page:r.page,section:t,url:r.url,revision:r.revision,snapshotDate:r.snapshotDate}}var Lx=["https://claude.ai/api/mcp/auth_callback","https://claude.com/api/mcp/auth_callback"];var Nx=".claudemcpcontent.com";var $x="text/html;profile=mcp-app",Dx={toolListingMs:5e3,handshakeMs:3e3,widgetFirstPaintMs:3e3},Ux={minViewportWidthPx:320,minTouchTargetPx:44},Yv=200,cr={nameMaxLength:100,oneLinerMaxLength:Yv,taglineMaxLength:Yv,descriptionMaxLength:2e3,categoriesMin:1,categoriesMax:5,useCasesMax:3,screenshotsMin:3,screenshotsMax:5,screenshotMinWidthPx:1e3,toolNameMaxLength:64},tG={callbackUrls:Lx,loopbackRedirectIgnoresPort:!0,appContentDomainSuffix:Nx,appContentDomainHashLength:32,appHtmlMime:$x,latencyBudgets:Dx,appDesignBudgets:Ux,submissionLimits:cr,source:cn("directory","Host profile constants")},qx="Submit an MCP connector",zx={connection:{title:"Connection",intro:"Connect the server you want listed. We read its tools, resources, and auth from the live connection.",layout:{blocks:[{widget:"connector-picker",fields:["connection.serverUrl"],text:{notice:"This form is for remote MCP servers only.",noticeDetail:"Local MCP servers can be distributed inside plugins, but may not be supported in every Claude product.",add:"Add custom connector",addHelper:"A connector you add here stays in Settings → Connectors until you remove it.",choose:"Or choose a connector you’ve already added:",notConnected:"Not connected"}},{heading:"URL configuration",note:"Optional",fields:["connection.differentUrls"]}]}},tools:{title:"Tools",intro:"Review the tools we found and their annotations. Fix anything flagged on your server, then reconnect.",layout:{blocks:[{widget:"tool-list",text:{empty:"No server selected. Go back to the Connection step and pick a server."}}]}},listing:{title:"Listing",intro:"How your MCP server appears in the directory. You can edit this after you submit.",layout:{blocks:[{fields:["listing.name","listing.slug"]},{fields:["listing.oneLiner"]},{fields:["listing.description"]},{fields:["listing.categories"]},{fields:["listing.authorName","listing.authorUrl"]},{widget:"icon",fields:["listing.iconUrl"],text:{add:"Add custom icon URL"}},{widget:"listing-preview",text:{title:"How it reads in the directory",name:"Your server’s name",oneLiner:"One-liner appears here"}},{heading:"Links",note:"Help users learn more and get support.",fields:["listing.documentationUrl","listing.enterpriseAuthDocsUrl"]},{fields:["listing.support","listing.privacyPolicyUrl"]}]}},useCases:{title:"Use cases",intro:"Up to three things people can do with your MCP server, what they need before connecting, and whether it reads or writes. Shown to reviewers, not on your listing."},company:{title:"Company",intro:"Tell us about the company or organization behind this MCP server.",layout:{blocks:[{fields:["company.name"]},{fields:["company.website"]},{heading:"Primary contact",note:"We’ll use this contact for any questions about your submission.",fields:["company.contactName"]},{fields:["company.contactEmail"]},{fields:["company.role"]},{fields:["company.anthropicContact"]}]}},authentication:{title:"Authentication",intro:"Configure how users authenticate with your server. What you set here is applied to connections exactly as entered.",layout:{blocks:[{fields:["authentication.requirement"]},{heading:"Authentication methods",widget:"oauth-sign-in",fields:["authentication.oauthClient"],text:{title:"OAuth sign-in",headers:"Additional request headers",addHeader:"Add header",headersHelper:"Sent on every MCP request alongside the OAuth bearer token. Installers provide the values when they connect, unless you mark a header as held by Anthropic.",addStaticHeaders:"Add static headers"}}]}},dataHandling:{title:"Data handling",intro:"Tell reviewers what the MCP server reads, writes, and sends off-platform."},testLaunch:{title:"Test & launch",intro:"Give reviewers a way in, and confirm you’ve tested every tool.",layout:{blocks:[{fields:["testLaunch.instructions"]},{heading:"Self-tested",fields:["testLaunch.selfTested"]},{heading:"Reviewer check",note:"MCPJam's own, not part of Claude's form: who the reviewer is signed in as, and whether the resources your instructions name exist for them.",fields:["testLaunch.identityTool","testLaunch.identityArgs"]},{fields:["testLaunch.expectedIdentityPath","testLaunch.expectedIdentity"]},{fields:["testLaunch.expectedOrganizationPath","testLaunch.expectedOrganization"]},{fields:["testLaunch.fixtures"]}]}},compliance:{title:"Compliance",intro:"Confirm that your MCP server meets Anthropic’s directory policies. All items are required."},review:{title:"Review and submit",intro:"Confirm the details, then submit. Review can take a few weeks, and approval isn’t guaranteed.",layout:{blocks:[{widget:"submit",text:{submit:"Submit for review",missing:"Some steps are missing required fields — submit to highlight them."}}],review:[{id:"connection",title:"Connection",edit:"connection",rows:["connection.serverUrl",{label:"Captured tool list",error:"A captured tool list is required to submit. Connect your server on the Connection step, or reconnect it in Settings → Connectors, to capture it.",blank:"connection.serverUrl"}]},{id:"connection-auth",title:"Connection & authentication",edit:"authentication",rows:["authentication.requirement","authentication.oauthClient"]},{id:"listing",title:"Listing",edit:"listing",rows:["listing.name","listing.slug","listing.oneLiner","listing.description","listing.authorName","listing.categories","listing.documentationUrl","listing.support","listing.privacyPolicyUrl"]},{id:"useCases",title:"Use cases",edit:"useCases",rows:["useCases.pairs","useCases.prerequisites","useCases.access"]},{id:"company",title:"Company",edit:"company",rows:["company.name","company.website","company.contactName","company.contactEmail"]},{id:"authentication",title:"Authentication",edit:"authentication",rows:[],flat:!0},{id:"dataHandling",title:"Data handling",edit:"dataHandling",rows:["dataHandling.apiOwnership","dataHandling.healthData","dataHandling.sponsored"]},{id:"testLaunch",title:"Test & launch",edit:"testLaunch",rows:["testLaunch.instructions","testLaunch.selfTested"]},{id:"compliance",title:"Compliance",edit:"compliance",rows:["compliance.acknowledgments","compliance.additionalNotes"]}]}}},Fx=JSON.parse(`{"connection.serverUrl":{"label":"Server URL","helper":"Servers already in the directory aren’t shown.","errors":{"required":"This field is required"}},"connection.differentUrls":{"label":"Users connect to different URLs","helper":"Leave this unchecked if every user connects to the same server URL."},"listing.name":{"label":"Name","placeholder":"My MCP server","errors":{"required":"This field is required"}},"listing.slug":{"label":"Slug","placeholder":"my-mcp-server","helper":"Permanent after submission. Lowercase letters, numbers, and hyphens.","errors":{"required":"Slug is required"}},"listing.oneLiner":{"label":"One-liner","placeholder":"A short tagline for your MCP server","errors":{"required":"This field is required"}},"listing.description":{"label":"Description","placeholder":"Describe what your MCP server does and its key features…","errors":{"required":"This field is required"}},"listing.categories":{"label":"Categories","placeholder":"Select categories","helper":"Categories are used to filter MCP servers in the directory. Select up to 5.","errors":{"required":"Select at least one category"}},"listing.authorName":{"label":"Author name","reviewLabel":"Author","placeholder":"Acme Inc.","helper":"Shown as “by …” on the listing.","errors":{"required":"An author is required to submit — add one on the Listing step, or fill in your company name and an https:// website to use those"}},"listing.authorUrl":{"label":"Author URL","placeholder":"https://example.com","helper":"If left blank, these default to your company name and website."},"listing.iconUrl":{"label":"Icon","helper":"The directory and Claude show the favicon from your server’s URL; we recommend leaving it at that. A custom icon replaces it in the directory listing only."},"listing.documentationUrl":{"label":"Documentation","placeholder":"https://docs.example.com","helper":"Public-facing docs shown to users. IT admins often review these when deciding whether to approve an MCP server.","errors":{"required":"This field is required"}},"listing.enterpriseAuthDocsUrl":{"label":"Enterprise managed auth documentation","placeholder":"https://docs.example.com/setup","helper":"Setup instructions for admins configuring enterprise managed auth for this connector. Linked from the admin setup flow."},"listing.support":{"label":"Support","reviewLabel":"Support URL","placeholder":"support@example.com or https://support.example.com","helper":"A support URL or email address.","errors":{"required":"This field is required"}},"listing.privacyPolicyUrl":{"label":"Privacy policy","placeholder":"https://example.com/privacy","errors":{"required":"This field is required"}},"useCases.pairs":{"label":"Use cases","helper":"Shown to reviewers, not on your public listing.","errors":{"required":"Add at least one use case with an example prompt"}},"useCases.prerequisites":{"label":"Prerequisites","placeholder":"A paid Acme account with admin permissions","helper":"The accounts, permissions or setup a user needs before connecting. Shown to reviewers.","errors":{"required":"This field is required"}},"useCases.access":{"label":"Read/write capabilities","helper":"Based on what your tools do; we check it against their annotations.","options":[{"value":"read-only","label":"Read only","help":"Retrieves data but never modifies it"},{"value":"write-only","label":"Write only","help":"Creates or modifies data but does not read it"},{"value":"read-write","label":"Read and write","help":"Both retrieves and modifies data"}],"errors":{"required":"This field is required"}},"company.name":{"label":"Company name","errors":{"required":"This field is required"}},"company.website":{"label":"Company website","placeholder":"https://example.com","errors":{"required":"This field is required"}},"company.contactName":{"label":"Full name","reviewLabel":"Primary contact","errors":{"required":"This field is required"}},"company.contactEmail":{"label":"Email","reviewLabel":"Contact email","helper":"Prefilled from your Claude account.","errors":{"required":"This field is required"}},"company.role":{"label":"Role","placeholder":"Software Engineer"},"company.anthropicContact":{"label":"Anthropic contact","placeholder":"Name or email (optional)","helper":"If you’ve been working with someone at Anthropic, let us know who."},"authentication.requirement":{"label":"Authentication requirement","options":[{"value":"always","label":"Always required","help":"Users connect and sign in before any tools or resources are available."},{"value":"when-asked","label":"Required when the server asks","help":"Claude connects without credentials first, then prompts to sign in if the server requires it."},{"value":"none","label":"None","help":"Anyone can use this server without signing in or providing credentials."}],"errors":{"required":"This field is required"}},"authentication.oauthClient":{"label":"OAuth client","options":[{"value":"dcr","label":"Dynamic Client Registration","help":"Clients register themselves with the server (RFC 7591)"},{"value":"cimd","label":"Client ID Metadata Document","help":"The server accepts a published client metadata URL"},{"value":"anthropic-held","label":"Anthropic-held client credentials","help":"Anthropic stores one client ID used for every connection"},{"value":"bring-your-own","label":"Installers bring their own OAuth client","help":"Each organization supplies a client ID it registered with the server"}],"errors":{"required":"This field is required"}},"dataHandling.apiOwnership":{"label":"API ownership","options":[{"value":"own","label":"We own the API","help":"The MCP server calls our own production APIs"},{"value":"partner-proxy","label":"We proxy a partner’s API with permission","help":"Calls go to a third-party API we’re authorized to integrate (e.g. Zapier-style)"},{"value":"third-party","label":"Calls a third-party API we don’t control","help":"Typically blocks listing — explain in Additional notes"}],"errors":{"required":"This field is required"}},"dataHandling.healthData":{"label":"Personal health data","helper":"Does this MCP server access, process, or store personal health information?","options":[{"value":"no","label":"No"},{"value":"yes","label":"Yes"},{"value":"depends","label":"Other / depends on configuration"}],"errors":{"required":"This field is required"}},"dataHandling.sponsored":{"label":"Sponsored or promoted content","reviewLabel":"Sponsored content","helper":"Sponsored, promoted, and advertising content is prohibited in the directory. Does this MCP server surface any?","options":[{"value":"no","label":"No"},{"value":"yes","label":"Yes"},{"value":"other","label":"Other"}],"errors":{"required":"This field is required"}},"testLaunch.instructions":{"label":"Test setup instructions","placeholder":"Sign up at example.com/signup with email reviewer@anthropic.com, then connect via OAuth using client_id=...","helper":"We reserve the right to manually review all servers. Provide clear test-account setup and access instructions. We’re working to automate this process to reduce the time it takes to get your server into the directory — write these instructions so they contain every link, credential, and step needed to autonomously access the MCP server. For enterprise accounts or servers that require a fully populated account, provide test credentials that grant access to a fully populated account for review."},"testLaunch.selfTested":{"label":"I have run every tool via MCP Inspector or as a custom connector in Claude","reviewLabel":"Self-tested"},"testLaunch.identityTool":{"label":"Identity tool","placeholder":"whoami","helper":"A read-only tool on your server that returns the signed-in account. MCPJam calls it as the reviewer."},"testLaunch.identityArgs":{"label":"Identity tool arguments","placeholder":"{}","helper":"Fixed JSON arguments, if the identity tool takes any."},"testLaunch.expectedIdentityPath":{"label":"Identity path","placeholder":"$.user.email","helper":"Where the tool's result names the account, as a JSON path."},"testLaunch.expectedIdentity":{"label":"Expected reviewer","placeholder":"review@example.com","helper":"The account reviewers sign in as."},"testLaunch.expectedOrganizationPath":{"label":"Organization path","placeholder":"$.organization.name","helper":"Where the tool's result names the organization or project, as a JSON path."},"testLaunch.expectedOrganization":{"label":"Expected organization","placeholder":"Sample Org","helper":"The organization or project reviewers should land in."},"testLaunch.fixtures":{"label":"Fixtures","helper":"Resources your instructions name, each with a read-only tool call that finds it in the reviewer's account."},"compliance.acknowledgments":{"label":"Policy acknowledgements","reviewLabel":"Policies acknowledged","options":[{"value":"developer-guidelines","label":"I have read and understand the MCP Directory developer guidelines."},{"value":"first-party-apis","label":"My server calls our own first-party APIs (or APIs we legitimately proxy with permission)."},{"value":"no-financial-transfers","label":"My MCP server does not transfer money, cryptocurrency, or other financial assets on a user’s behalf."},{"value":"no-generated-media","label":"My MCP server does not use AI models to generate images, video, or audio."},{"value":"clean-tool-descriptions","label":"Tool descriptions contain no instructions about model behavior, other tools, or external instruction sources, and no hidden or encoded text."},{"value":"minimal-conversation-data","label":"My MCP server does not collect conversation data beyond what is needed for its function."},{"value":"public-docs-by-launch","label":"Public documentation for this MCP server will be live by the publish date."}],"errors":{"required":"All policy items must be acknowledged","tooFew":"All policy items must be acknowledged"}},"compliance.additionalNotes":{"label":"Additional notes","reviewLabel":"Additional information","helper":"Optional. Anything else the review team should know about your MCP server."}}`),jx=[{step:"connection",field:"connection.serverUrl",needs:[],reads:["connection.serverUrl"],checks:["claude.endpoint.https"]},{step:"connection",field:"connection.serverUrl",needs:["server"],reads:["connection.serverUrl"],checks:["claude.endpoint.redirects-stay-https","claude.endpoint.redirects-terminate"]},{step:"tools",needs:["server"],reads:["connection.serverUrl"],checks:["claude.tools.name-length","claude.tools.title-present","claude.tools.behavior-hints-present","claude.tools.behavior-hints-consistent","claude.tools.no-catch-all-read-write","claude.tools.free-string-operation-parameter","claude.apps.resource-uri-modern","claude.apps.html-mime-profile","claude.apps.openai-only-widget","claude.apps.ui-domain-derivation","claude.apps.ui-domain-recommended-for-app-oauth","claude.apps.csp-shape","claude.apps.result-size-budget","claude.apps.instance-supersession","claude.apps.design.doctype","claude.apps.design.responsive-320","claude.apps.design.touch-targets","claude.apps.design.safe-area","claude.apps.design.theming","claude.apps.design.transparent-background","claude.apps.design.nested-scrolling","claude.apps.design.accessibility","claude.apps.design.display-mode"]},{step:"tools",needs:["server","model"],reads:["connection.serverUrl"],checks:["claude.experience.tool-descriptions-uninformative","claude.experience.tool-overlap","claude.experience.connector-purpose-unclear","claude.experience.destructive-tool-underexplained","claude.experience.app-copy-mismatched","both.decision.annotation-matches-behaviour"]},{step:"listing",needs:["server","model"],reads:["connection.serverUrl"],checks:["claude.experience.listing-copy-placeholder"]},{step:"listing",needs:[],reads:["listing.name","listing.slug","listing.oneLiner","listing.description","listing.categories","listing.authorName","company.name","company.website"],checks:["claude.submission.listing-fields"]},{step:"listing",needs:[],reads:["listing.documentationUrl","listing.privacyPolicyUrl","listing.support","listing.authorUrl","listing.iconUrl","listing.enterpriseAuthDocsUrl"],checks:["claude.submission.urls"]},{step:"listing",needs:[],reads:[],checks:["claude.submission.screenshots","claude.submission.screenshot-prompts"]},{step:"useCases",field:"useCases.access",needs:["server"],reads:["useCases.access","connection.serverUrl"],checks:["claude.submission.access-matches-annotations"]},{step:"useCases",field:"useCases.pairs",needs:[],reads:["useCases.pairs","useCases.prerequisites"],checks:["claude.submission.use-cases"]},{step:"company",needs:[],reads:["company.name","company.website","company.contactName","company.contactEmail"],checks:["claude.submission.company"]},{step:"authentication",field:"authentication.requirement",needs:[],reads:["authentication.requirement","authentication.oauthClient"],checks:["claude.submission.authentication"]},{step:"authentication",field:"authentication.requirement",needs:["server"],reads:["connection.serverUrl"],checks:["claude.auth.unauthenticated-challenge","claude.features.lazy-authentication"]},{step:"authentication",needs:["server"],reads:["connection.serverUrl"],checks:["claude.auth.challenge-names-resource-metadata","claude.auth.no-challenge-on-successful-operation","claude.auth.prm-discoverable","claude.auth.prm-resource-matches-entered-url","claude.auth.first-authorization-server-usable","claude.auth.pkce-s256-advertised","claude.auth.cimd-flag-consistent","claude.features.enterprise-managed-auth"]},{step:"authentication",field:"authentication.oauthClient",needs:["server"],reads:["connection.serverUrl","authentication.requirement","authentication.oauthClient"],checks:["claude.auth.client-acquisition-path","claude.submission.declared-auth-mode"]},{step:"authentication",needs:["server","reviewer"],reads:["connection.serverUrl"],checks:["claude.auth.rfc8707-resource-canonical","claude.auth.insufficient-scope-challenge-shape","claude.auth.access-token-audience","claude.intrusive.dynamic-registration","claude.intrusive.refresh-rotation","claude.intrusive.step-up-challenge"]},{step:"authentication",needs:["server","model"],reads:["connection.serverUrl"],checks:["claude.experience.consent-scope-unclear"]},{step:"dataHandling",needs:[],reads:["dataHandling.apiOwnership","dataHandling.healthData","dataHandling.sponsored"],readsConfirmation:!0,checks:["claude.submission.data-handling"]},{step:"testLaunch",field:"testLaunch.instructions",needs:[],reads:["testLaunch.instructions","authentication.requirement"],checks:["claude.submission.test-instructions"]},{step:"testLaunch",field:"testLaunch.identityTool",needs:["server","reviewer"],reads:["connection.serverUrl","testLaunch.identityTool","testLaunch.identityArgs","testLaunch.expectedIdentityPath","testLaunch.expectedIdentity","testLaunch.expectedOrganizationPath","testLaunch.expectedOrganization"],checks:["both.reviewer.identity"]},{step:"testLaunch",field:"testLaunch.fixtures",needs:["server","reviewer"],reads:["connection.serverUrl","testLaunch.fixtures","testLaunch.instructions","useCases.pairs","testLaunch.identityTool","testLaunch.identityArgs","testLaunch.expectedIdentityPath","testLaunch.expectedIdentity","testLaunch.expectedOrganizationPath","testLaunch.expectedOrganization"],checks:["both.reviewer.fixtures"]},{step:"authentication",needs:["server"],reads:["connection.serverUrl"],checks:["both.auth.client-signatures"]},{step:"compliance",field:"compliance.acknowledgments",needs:[],reads:["compliance.acknowledgments"],readsConfirmation:!0,checks:["claude.submission.attestations"]},{step:"compliance",field:"compliance.acknowledgments",needs:["server"],reads:["connection.serverUrl"],checks:["claude.scan.cross-tool-direction-candidates"]},{step:"compliance",field:"compliance.acknowledgments",needs:["server","model"],reads:["connection.serverUrl"],checks:["claude.decision.cross-tool-direction"]},{step:"review",needs:[],reads:["dataHandling.apiOwnership","dataHandling.healthData","dataHandling.sponsored"],checks:["claude.submission.artifact-quality"]},{step:"review",needs:[],reads:["useCases.access","dataHandling.apiOwnership","dataHandling.healthData","dataHandling.sponsored","testLaunch.selfTested","compliance.acknowledgments"],readsConfirmation:!0,checks:["claude.submission.declarations-confirmed"]},{step:"review",needs:[],reads:["connection.serverUrl","connection.differentUrls","useCases.access","company.role","company.anthropicContact","testLaunch.instructions","testLaunch.selfTested","compliance.additionalNotes"],readsConfirmation:!0,checks:["claude.submission.other-answers"]}],Hx={"runtime-compatibility":"connection","directory-policy":"tools","optional-features":"authentication","submission-artifacts":"listing","experience-insights":"tools"},bo={title:qx,steps:zx,fields:Fx,placements:jx,laneSteps:Hx},Bx=bo.fields,Xv=bo.steps,$i={declaration:!0},na={format:"https-url"};function dt(e,t={}){return{control:e,required:!0,...t}}function Ht(e,t={}){return{control:e,...t}}var Vx={"connection.serverUrl":dt("server",{format:"url"}),"connection.differentUrls":Ht("checkbox"),"listing.name":dt("text",{maxLength:cr.nameMaxLength}),"listing.slug":dt("text",{format:"slug"}),"listing.oneLiner":dt("text",{maxLength:cr.oneLinerMaxLength}),"listing.description":dt("textarea",{maxLength:cr.descriptionMaxLength}),"listing.categories":dt("multi-select",{freeEntry:!0,minItems:cr.categoriesMin,maxItems:cr.categoriesMax}),"listing.authorName":dt("text",{requiredOn:"review",satisfiedBy:[{key:"company.name"},{key:"company.website",format:"https-url"}]}),"listing.authorUrl":Ht("text",na),"listing.iconUrl":Ht("text",na),"listing.documentationUrl":dt("text",na),"listing.enterpriseAuthDocsUrl":Ht("text",na),"listing.support":dt("text",{format:"url-or-email"}),"listing.privacyPolicyUrl":dt("text",na),"useCases.pairs":dt("pairs",{pairs:{columns:["Use case","Example prompt"],keys:["useCase","examplePrompt"],placeholders:[["Look up a product","What sizes are in stock at the Portland store?"],["Compare prices","Which fall items are marked down more than 30%?"],["Draft a product listing","Create a draft listing for the canvas tote."]],maxRows:cr.useCasesMax}}),"useCases.prerequisites":dt("textarea"),"useCases.access":dt("radio",{...$i,default:"read-only"}),"company.name":dt("text",{prefill:"organization-name"}),"company.website":dt("text",{format:"url"}),"company.contactName":dt("text",{prefill:"account-name"}),"company.contactEmail":dt("text",{format:"email",prefill:"account-email"}),"company.role":Ht("text"),"company.anthropicContact":Ht("text"),"authentication.requirement":dt("radio",{default:"always"}),"authentication.oauthClient":dt("radio",{default:"dcr"}),"dataHandling.apiOwnership":dt("radio-cards",{...$i,default:"own"}),"dataHandling.healthData":dt("radio",{...$i,default:"no"}),"dataHandling.sponsored":dt("radio",$i),"testLaunch.instructions":Ht("textarea"),"testLaunch.selfTested":Ht("checkbox",$i),"testLaunch.identityTool":Ht("text",{requiredWith:["testLaunch.expectedIdentity","testLaunch.expectedOrganization"]}),"testLaunch.identityArgs":Ht("text"),"testLaunch.expectedIdentityPath":Ht("text",{requiredWith:["testLaunch.expectedIdentity"]}),"testLaunch.expectedIdentity":Ht("text",{requiredWith:["testLaunch.expectedIdentityPath"]}),"testLaunch.expectedOrganizationPath":Ht("text",{requiredWith:["testLaunch.expectedOrganization"]}),"testLaunch.expectedOrganization":Ht("text",{requiredWith:["testLaunch.expectedOrganizationPath"]}),"testLaunch.fixtures":Ht("pairs",{pairs:jS}),"compliance.acknowledgments":dt("checkbox-group",{...$i,minItems:bo.fields["compliance.acknowledgments"].options.length}),"compliance.additionalNotes":Ht("textarea")},rG={id:"claude-connector",directory:"claude",title:bo.title,version:"2026-11-13",source:{label:"Claude directory portal: Submit an MCP connector",url:"https://claude.ai/directory/manage",capturedAt:"2026-11-13"},submissionUrl:"https://claude.ai/directory/manage",steps:Object.keys(Xv).map(e=>({id:e,...Xv[e],fields:HS(e,Vx,Bx)})),placements:BS("claude-connector.json",bo.placements),laneSteps:bo.laneSteps};function Em(e){return e.class==="required"||e.class==="runtime-blocker"}var sG=Object.freeze({maxQuestionsPerRun:24,maxKeyChars:200,maxNameChars:200,maxFieldChars:300,maxTextChars:2e3,maxReferences:10,maxQuoteChars:400}),Gx=String.raw`(?:call|invoke|run|use|execute|trigger|poll|retry|re-?run|chain|pair|combine)`,nG=String.raw`(?:calling|using|running|invoking|executing|polling)`,Wx=String.raw`(?:get|obtain|fetch|retrieve|look\s+up|find|read|take|copy|resolve|discover|check|verify|confirm|inspect|track|monitor|pass|provide|supply|send|feed|forward|hand|give|submit|${Gx})`,Kx=String.raw`(?:^|[,;:(\u2013\u2014]\s*|\s-\s+|\b(?:and|or|then|so|to|first|next|finally|afterwards|always|also|instead|otherwise|please|only|now|immediately)\s+)`,Jx=String.raw`\b(?:must|should|shall|can|may|need\s+to|needs\s+to|have\s+to|has\s+to|be\s+sure\s+to|make\s+sure\s+to|remember\s+to|(?:do\s+not|don't)\s+forget\s+to|want\s+to)\s+(?:not\s+|also\s+|first\s+|always\s+|then\s+|still\s+)?`,iG=String.raw`(?:(?:the|a|an|this|that|it|its|tool|tools|first|also|again|only|then|always|now|before|after|with|together|alongside|along|instead|of|to|right|immediately|once|back)\s+){0,4}`,oG=String.raw`[^.;:!?,]{0,30}?`,aG=String.raw`(?:from|with|using|via|through|to|into|by\s+calling|by\s+running|returned\s+by|produced\s+by|output\s+(?:of|from)|result\s+of|response\s+(?:of|from))`,cG=String.raw`(?:before|after|once|until|prior\s+to|together\s+with|alongside|instead\s+of|in\s+place\s+of|rather\s+than)`,lG=new RegExp(`${Kx}(?:${Wx}|confirm|ask|wait|stop|ensure|tell|show|list|try|avoid|save|create|delete|update|refresh|compare)\\b|${Jx}\\w`,"i"),Wu=e=>new RegExp(`\\b(?:${e})(?:e|es|ed|ing|s)?\\b`,"i"),uG=Wu("creat|add|insert|updat|edit|modif(?:y|ies|ied|ying)|chang|sav|writ|written|send|sent|post|publish|submit|submitt|upload|delet|remov|archiv|mov|renam|cancel|cancell|schedul|purchas|pay|paid|transfer|transferr|deploy|install|trigger|overwrit|overwritten"),dG=Wu("get|list|read|fetch|retriev|search|find|view|show|return|quer(?:y|ies|ied|ying)|inspect|describ|count|lookup"),pG=Wu("delet|remov|overwrit|overwritten|drop|dropp|destroy|eras|purg|wip|truncat|revok|replac|permanently|irreversibl"),hG=Wu("creat|add|insert|append|increment|generat|send|sent|post|submit|submitt"),fG=Object.freeze({maxTools:500,maxCases:1500,maxFixtures:50,maxCleanupSteps:50,maxIdLength:200,maxPlanLength:524288,maxCalls:3e3,maxConcurrency:4,minCallTimeoutMs:1e3,maxCallTimeoutMs:12e4});function Yx(e){const t=[];return Ah(e,r=>{t.push(r)}),t}function Xx(e){if(typeof e!="object"||e===null||Array.isArray(e))return;const{$fixture:t,value:r}=e;if(typeof t=="string")return{fixture:t,value:typeof r=="string"?r:""}}function Ah(e,t){const r=Xx(e);return r?t(r):Array.isArray(e)?e.map(s=>Ah(s,t)):typeof e=="object"&&e!==null?Object.fromEntries(Object.entries(e).map(([s,n])=>[s,Ah(n,t)])):e}function mG(e){const t=new Map(e.tools.map(a=>[a.tool,a])),r=a=>{const c=t.get(a.tool),l=c?.effect??"destructive";return(l==="destructive"?3:a.creates?.length?0:l==="read"?1:2)*2+(c?.openWorld===!1?0:1)},s=new Set(e.cases.flatMap(a=>a.creates??[])),n=e.cases.map((a,c)=>({testCase:a,index:c,rank:r(a),needs:Yx(a.arguments).map(l=>l.fixture).filter(l=>s.has(l)&&!a.creates?.includes(l))})).sort((a,c)=>a.rank-c.rank||a.index-c.index),i=new Set,o=[];for(;n.length>0;){const a=n.findIndex(({needs:l})=>l.every(u=>i.has(u))),[c]=n.splice(Math.max(a,0),1);o.push(c.testCase);for(const l of c.testCase.creates??[])i.add(l)}return o}var Zx=e=>e/2**32|0,Qx=e=>e>>>0;function eO(e,t,r,s){const n=Zx(r),i=Qx(r);e.setUint32(t,s?i:n,s),e.setUint32(t+4,s?n:i,s)}function Zv(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}var Ih=e=>e?`"${e}" `:"";function tO(e,t=""){if(typeof e!="number")throw new TypeError(Ih(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(Ih(t)+"expected integer >= 0, got "+e);return e}function Tm(e,t,r=""){if(Zv(e)&&(t===void 0||e.length===t))return e;t!==void 0&&tO(t,"length");const s=Zv(e),n=t!==void 0?` of length ${t}`:"",i=s?`length=${e.length}`:`type=${typeof e}`,o=Ih(r)+"expected Uint8Array"+n+", got "+i;throw s?new RangeError(o):new TypeError(o)}var rO=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError((t==="object"?"":`"${t}" `)+"expected object, got type="+typeof e)},Qv=(e,t)=>{rO(e,t);const r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==null)throw new TypeError(`"${t}" expected plain object`);if(Object.hasOwn(e,"__proto__"))throw new TypeError(`"${t}.__proto__" is not allowed`)};function e_(e,t=!0){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function sO(e,t){Tm(e,void 0,"output");const r=t.outputLen;if(!(e.length>=r))throw new RangeError('"output" expected length >= '+r)}function Rh(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Yd(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ts(e,t){return e<<32-t|e>>>t}var nO=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",iO=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function oO(e){if(Tm(e),nO)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=iO[e[r]];return t}function aO(e){if(typeof e!="string")throw new TypeError("string expected");const t=new TextEncoder().encode(e);try{return new Uint8Array(t)}finally{Rh(t)}}function cO(e,t,r="opts"){return Qv(e,"defaults"),t!==void 0&&Qv(t,r),Object.assign(Object.create(null),e,t)}function lO(e,t={}){if(typeof e!="function")throw new TypeError('"hashCons" expected function, got type='+typeof e);t=cO({},t,"info");const r=(n,i)=>e(i).update(n).digest(),s=e(void 0);return r.outputLen=s.outputLen,r.blockLen=s.blockLen,r.canXOF=s.canXOF,r.create=n=>e(n),Object.assign(r,t),Object.freeze(r)}var uO=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function dO(e,t,r){return e&t^~e&r}function pO(e,t,r){return e&t^e&r^t&r}var hO=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,r,s){this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(e),this.view=Yd(this.buffer)}update(e){e_(this),Tm(e);const{view:t,buffer:r,blockLen:s}=this,n=e.length;let i=!1;for(let o=0;o<n;){const a=Math.min(s-this.pos,n-o);if(a===s){const c=Yd(e);for(;s<=n-o;o+=s)this.process(c,o);i=!0;continue}r.set(o===0&&a===n?e:e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(t,0),this.pos=0,i=!0)}return this.length+=e.length,i&&this.roundClean(),this}digestInto(e){e_(this),sO(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:s,isLE:n}=this;let{pos:i}=this;t[i++]=128,t.fill(0,i),this.padOffset>s-i&&(this.process(r,0),t.fill(0)),eO(r,s-8,this.length*8,n),this.process(r,0),this.roundClean();const o=e===t?r:Yd(e),a=this.outputLen,c=a/4,l=this.get();if(a%4||c>l.length)throw new Error("invalid outputLen");for(let u=0;u<c;u++)o.setUint32(4*u,l[u],n)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneIntoMeta(e){const{buffer:t,length:r,finished:s,destroyed:n,pos:i}=this;return e.destroyed=n,e.finished=s,e.length=r,e.pos=i,i&&e.buffer.set(t),e}clone(){return this._cloneInto()}},fO=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),mO=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Qs=new Uint32Array(64),gO=class extends hO{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(e,t){super(64,e,8,!1),this.A=t[0]|0,this.B=t[1]|0,this.C=t[2]|0,this.D=t[3]|0,this.E=t[4]|0,this.F=t[5]|0,this.G=t[6]|0,this.H=t[7]|0}get(){const{A:e,B:t,C:r,D:s,E:n,F:i,G:o,H:a}=this;return[e,t,r,s,n,i,o,a]}set(e,t,r,s,n,i,o,a){this.A=e|0,this.B=t|0,this.C=r|0,this.D=s|0,this.E=n|0,this.F=i|0,this.G=o|0,this.H=a|0}_cloneInto(e){return(e||=new this.constructor).set(...this.get()),this._cloneIntoMeta(e)}process(e,t){for(let u=0;u<16;u++,t+=4)Qs[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const p=Qs[u-15],d=Qs[u-2],h=ts(p,7)^ts(p,18)^p>>>3,f=ts(d,17)^ts(d,19)^d>>>10;Qs[u]=f+Qs[u-7]+h+Qs[u-16]|0}let{A:r,B:s,C:n,D:i,E:o,F:a,G:c,H:l}=this;for(let u=0;u<64;u++){const p=ts(o,6)^ts(o,11)^ts(o,25),d=l+p+dO(o,a,c)+mO[u]+Qs[u]|0,h=(ts(r,2)^ts(r,13)^ts(r,22))+pO(r,s,n)|0;l=c,c=a,a=o,o=i+d|0,i=n,n=s,s=r,r=d+h|0}r=r+this.A|0,s=s+this.B|0,n=n+this.C|0,i=i+this.D|0,o=o+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,s,n,i,o,a,c,l)}roundClean(){Rh(Qs)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),Rh(this.buffer)}},vO=class extends gO{constructor(){super(32,fO)}},_O=lO(()=>new vO,uO(1));function yO(e){return Em(e)}var bO=["experience"];var SO=["claude.experience.tool-descriptions-uninformative","claude.experience.tool-overlap","claude.experience.connector-purpose-unclear","claude.experience.consent-scope-unclear","claude.experience.listing-copy-placeholder","claude.experience.destructive-tool-underexplained","claude.experience.app-copy-mismatched"],gG=Object.freeze({readinessKind:"claude-directory-readiness",observationKinds:bO,knownIds:SO,schemaVersion:"1"}),wO=[{id:"claude.experience.tool-descriptions-uninformative",title:"Tool descriptions may not tell Claude when to use the tool",lane:"experience-insights",class:"heuristic",source:cn("review-criteria","§Tool quality"),remediation:"Describe when a tool should be reached for, not only what it does; Claude picks tools from these sentences."},{id:"claude.experience.tool-overlap",title:"Two or more tools may cover the same job",lane:"experience-insights",class:"heuristic",source:cn("review-criteria","§Tool quality"),remediation:"Overlapping tools make selection ambiguous; consider merging them or sharpening what separates them."},{id:"claude.experience.connector-purpose-unclear",title:"What this connector is for may not be clear from its surface",lane:"experience-insights",class:"manual-review",source:cn("review-criteria","§Usefulness"),remediation:"A reviewer should be able to say what the connector is for from the listing and the tool names alone."},{id:"claude.experience.consent-scope-unclear",title:"It may not be clear to a user what they are authorizing",lane:"experience-insights",class:"manual-review",source:cn("authentication","§Consent"),remediation:"State which account is connected and what scope it grants, in the copy the user sees at consent time."},{id:"claude.experience.listing-copy-placeholder",title:"Listing copy may still contain placeholder text",lane:"experience-insights",class:"manual-review",source:cn("submission","§Listing"),remediation:"Review the listing fields for template text before submitting; reviewers reject placeholder copy."},{id:"claude.experience.destructive-tool-underexplained",title:"A destructive tool may not explain its consequences",lane:"experience-insights",class:"manual-review",source:cn("review-criteria","§Safety"),remediation:"Say plainly in the description what a destructive tool changes and whether it can be undone."},{id:"claude.experience.app-copy-mismatched",title:"An app's rendered copy may not match what its tool returns",lane:"experience-insights",class:"heuristic",source:cn("mcp-apps/design-guidelines","§Content"),remediation:"A widget that says something different from the tool's text response leaves the model and the user disagreeing."}],vG=Object.freeze({experienceLane:"experience-insights",engineVersion:"1",mappings:wO}),Di={serverUrl:"serverUrl",pluginBundle:"pluginBundle",submissionProfile:"submissionProfile",draftSnapshot:"draftSnapshot",publishedSnapshot:"publishedSnapshot",toolListing:"toolListing",importedSkills:"importedSkills"},_G=Object.freeze({"skills-only":{hasMcpServer:!1,hasUploadedPackage:!0,hasImportedSkills:!1,requiredInputs:[Di.pluginBundle],summary:"a skills package with no MCP server"},"mcp-only":{hasMcpServer:!0,hasUploadedPackage:!1,hasImportedSkills:!1,requiredInputs:[Di.serverUrl],summary:"an MCP endpoint with no uploaded package"},"mcp-imported-skills":{hasMcpServer:!0,hasUploadedPackage:!1,hasImportedSkills:!0,requiredInputs:[Di.serverUrl,Di.importedSkills],summary:"an MCP endpoint whose skills are imported at scan time"},"mcp-uploaded-skills":{hasMcpServer:!0,hasUploadedPackage:!0,hasImportedSkills:!1,requiredInputs:[Di.serverUrl,Di.pluginBundle],summary:"an MCP endpoint plus an uploaded skills package"}}),yG=Object.freeze({"technical-preflight":["runtime-compatibility","directory-policy","plugin-package"],"submission-ready":["runtime-compatibility","directory-policy","plugin-package","submission-artifacts","release-contract"]});function kO(e){return typeof e=="object"&&e!==null&&e.readinessKind==="openai-directory-readiness"}var EO=["experience"];var TO=["openai.experience.tool-descriptions-uninformative","openai.experience.tool-overlap","openai.experience.naming-inconsistent","openai.experience.listing-copy-placeholder","openai.experience.listing-copy-overpromises","openai.experience.skill-overlap","openai.experience.destructive-tool-underexplained","openai.experience.auth-story-unclear"],bG=Object.freeze({readinessKind:"openai-directory-readiness",observationKinds:EO,knownIds:TO,schemaVersion:"1"}),AO=[{id:"openai.experience.tool-descriptions-uninformative",title:"Tool descriptions may not tell the model when to use the tool",lane:"experience-insights",class:"heuristic",source:Vr("guides/optimize-metadata","§Tool descriptions"),remediation:"Describe when a tool should be reached for, not only what it does; the model picks tools from these sentences."},{id:"openai.experience.tool-overlap",title:"Two or more tools may cover the same job",lane:"experience-insights",class:"heuristic",source:Vr("plan/tools","§Naming"),remediation:"Overlapping tools make selection ambiguous; consider merging them or sharpening the descriptions that separate them."},{id:"openai.experience.naming-inconsistent",title:"Tool names may not follow one convention",lane:"experience-insights",class:"heuristic",source:Vr("plan/tools","§Naming"),remediation:"Pick one naming convention across the whole surface; mixed conventions read as two servers merged."},{id:"openai.experience.listing-copy-placeholder",title:"Listing copy may still contain placeholder text",lane:"experience-insights",class:"manual-review",source:Vr("plugin-guidelines","§Listing quality"),remediation:"Review the listing fields for template text before submitting; reviewers reject placeholder copy."},{id:"openai.experience.listing-copy-overpromises",title:"Listing copy may claim capabilities the tools do not implement",lane:"experience-insights",class:"manual-review",source:Vr("plugin-guidelines","§Listing quality"),remediation:"Check that every capability the listing advertises is reachable through a tool this server actually exposes."},{id:"openai.experience.skill-overlap",title:"Two or more skills may describe the same task",lane:"experience-insights",class:"heuristic",source:Vr("plugin-guidelines","§Listing quality"),remediation:"Skills that overlap compete for the same trigger; separate their scopes or fold them together."},{id:"openai.experience.destructive-tool-underexplained",title:"A destructive tool may not explain its consequences",lane:"experience-insights",class:"manual-review",source:Vr("plugin-guidelines","§Predictable side effects"),remediation:"Say plainly in the description what a destructive tool changes and whether it can be undone."},{id:"openai.experience.auth-story-unclear",title:"It may not be clear to a user what they are authorizing",lane:"experience-insights",class:"manual-review",source:Vr("build/auth","§Consent"),remediation:"State which account is connected and what scope it grants, in the copy the user sees at consent time."}],SG=Object.freeze({experienceLane:"experience-insights",engineVersion:"2",mappings:AO}),IO=["oauth-dcr","oauth-cimd","oauth-preregistered","static-header","authless","custom-connection"],RO=["no-user-data","processes-user-data","stores-user-data","shares-with-third-parties"],CO=["ownsOrIsAuthorizedForService","accurateDataHandlingDisclosure","compliesWithUsagePolicies","noProhibitedContent","maintainsSecurityPractices","respondsToSecurityReports","keepsListingAccurate"],Kc=w().url().refine(e=>e.startsWith("https://"),{message:"must be an https:// URL"}),PO=se({url:w().min(1),mimeType:w().min(1),widthPx:Ue().int().positive(),heightPx:Ue().int().positive(),prompt:w().min(1)}),wG=se({name:w().min(1).max(cr.nameMaxLength),tagline:w().min(1).max(cr.oneLinerMaxLength),description:w().min(1).max(cr.descriptionMaxLength),categories:te(w().min(1)).min(cr.categoriesMin).max(cr.categoriesMax),slug:w().min(1).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/,"must be a lowercase kebab-case slug"),documentationUrl:Kc,privacyPolicyUrl:Kc,supportUrl:Kc,iconUrl:Kc,declaredAuthMode:ct(IO),dataHandling:te(ct(RO)).min(1),screenshots:te(PO).min(cr.screenshotsMin).max(cr.screenshotsMax),attestations:Qe(ct(CO),Ne())}),xO=zP;function ir(e){return e.rows.map(t=>{const r=t.indexOf(": "),s=t.slice(0,r),n=e.targets?.[s];return{code:s,table:e.table,stage:e.stage,severity:e.severity??(e.warnings?.includes(s)?"warning":"error"),message:t.slice(r+2),...n?.field===void 0?{}:{document:e.document},...n,source:xO}})}var Sr={kind:"present"},Ke={kind:"nonEmpty"},ai={kind:"nonEmpty",required:!0},Mr={kind:"text"},oo={kind:"text",singleLine:!0},ac=(...e)=>({kind:"type",types:e}),He=ac("string"),Ks=ac("object"),Ch=ac("boolean"),vt=(e,t)=>t===void 0?{kind:"length",max:e}:{kind:"length",max:e,submissionMax:t},Qt=e=>({kind:"pattern",pattern:e}),VS=e=>({kind:"pattern",pattern:e,forbidden:!0}),OO=e=>({kind:"enum",values:e}),t_=e=>({kind:"count",max:e}),M=(e,...t)=>t.length>0?{field:e,rules:t}:{field:e},qe=e=>({path:e}),ci="interface.displayName",vn="interface.shortDescription",li="interface.longDescription",bn="interface.developerName",xa="interface.capabilities[]",Ph="interface.defaultPrompt",Oa="interface.defaultPrompt[]",Nl="(?:0|[1-9]\\d*)",r_=`(?:${Nl}|\\d*[A-Za-z-][0-9A-Za-z-]*)`,MO=new RegExp(`^${Nl}\\.${Nl}\\.${Nl}(?:-${r_}(?:\\.${r_})*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$`),xh=/^#[0-9A-Fa-f]{6}$/,ia=/^https:\/\/(?!:)[^\s/?#@]+(?:[/?#]\S*)?$/i,LO=ir({table:"ZIP upload errors and warnings",stage:"upload",document:"plugin-manifest",warnings:["plugin_version_unchanged","mcp_configuration_excluded","claude_format_normalized","manifest_normalized","developer_name_defaulted"],rows:["plugin_name_mismatch: The package name in an update must match the existing plugin name.","plugin_version_unchanged: A new release must use a different manifest `version`; reusing the published version requires confirmation.","mcp_configuration_excluded: MCP configuration is excluded unless your organization is approved for local MCP submissions. For a local MCP plugin, ask your OpenAI representative to confirm the submitting organization is allowlisted. Submit remote MCP servers through **With MCP**.","app_configuration_excluded: ZIP uploads must not include `apps` or `.app.json`. Submit remote MCP servers through **With MCP**; for local MCP servers, follow the desktop-only submission instructions.","claude_format_normalized: `.claude-plugin/plugin.json` is converted to `.codex-plugin/plugin.json`, with missing interface defaults and normalized text fields added by the portal.","manifest_normalized: The portal saves the normalized manifest as `.codex-plugin/plugin.json`; changed fields require confirmation.","developer_name_defaulted: The listing’s developer name is set automatically from your selected verified developer identity, regardless of the name in your ZIP."],targets:{plugin_name_mismatch:M("name"),plugin_version_unchanged:M("version"),claude_format_normalized:qe(".claude-plugin/plugin.json"),manifest_normalized:qe(".codex-plugin/plugin.json"),developer_name_defaulted:M(bn)}}),NO=ir({table:"ZIP structure and limit errors",stage:"upload",rows:["archive_empty: Archive must not be empty.","archive_too_large: Compressed ZIP must be 100 MB or less.","archive_format_not_zip: Archive must be a valid, uncorrupted ZIP file.","archive_member_path_empty: Archive entry path must not be empty.","archive_member_path_has_outer_whitespace: Archive entry path must not begin or end with whitespace.","archive_member_path_has_backslash: Archive entry path must use `/`, not backslashes.","archive_member_path_absolute: Archive entry path must be relative to the archive root.","archive_member_path_has_empty_segment: Archive entry path must not contain empty segments.","archive_member_path_has_parent_segment: Archive entry path must not contain `..` segments.","archive_member_path_too_deep: Archive entry path must contain at most 20 segments, including the filename.","archive_member_path_too_long: Archive entry path must be within the supported path-length limit.","archive_member_path_normalization_collision: Archive entry paths must remain unique after case and Unicode normalization.","archive_member_type_unsupported: Archive entries must be regular files or directories.","archive_member_too_large: Archive entry must not exceed 100 MiB.","archive_member_path_duplicate: Archive entry path must be unique.","archive_member_path_type_conflict: A file path cannot also be a directory or contain another archive entry.","archive_too_many_entries: Archive must not contain more than 5,000 entries.","archive_uncompressed_too_large: Extracted archive must not exceed 512 MiB.","archive_member_unreadable: Every archive entry must be readable, must not be encrypted, and must use supported compression."]}),$O=ir({table:"Plugin root errors",stage:"upload",rows:["plugin_root_missing: The selected path must exist and be a directory containing a plugin.","archive_plugin_files_missing: A ZIP must contain a supported plugin manifest and at least one valid skill (or an approved local MCP server).",`plugin_root_ambiguous: ${ms.plugin_root_ambiguous.message}`,`plugin_root_has_siblings: ${ms.plugin_root_has_siblings.message}`]}),Ns="skills/<skill>/SKILL.md",oa="skills/<skill>/agents/openai.yaml",Xd="interface.display_name",Zd="interface.short_description",s_="interface.icon_small",n_="interface.icon_large",Qd="interface.brand_color",i_="interface.default_prompt",DO="policy.allow_implicit_invocation",UO=ir({table:"Skill errors",stage:"upload",document:"skill-frontmatter",rows:["skill_manifest_missing: Skill must contain a `SKILL.md` file.","skill_bundle_too_large: Each compressed skill bundle must be within the MiB limit reported in the error.","skill_directory_hidden: Skill directory names must not begin with `.`.","skill_manifest_nested: Each skill directory must be an immediate child of `skills/`.","skill_manifest_not_regular_file: `SKILL.md` must be a regular file.","skill_manifest_unreadable: `SKILL.md` must be readable.","skill_manifest_invalid_utf8: `SKILL.md` must contain valid UTF-8.","skill_frontmatter_missing: `SKILL.md` must start with YAML front matter between `---` lines.","skill_frontmatter_unclosed: `SKILL.md` YAML front matter must end with `---`.","skill_frontmatter_yaml_malformed: `SKILL.md` front matter must contain valid YAML.","skill_frontmatter_wrong_type: `SKILL.md` front matter must contain a YAML mapping.","skill_name_missing: `name` is required and must not be empty.","skill_name_wrong_type: `name` must be a string.","skill_name_empty: `name` must be non-empty.","skill_name_character_unsupported: Skill front matter `name` must use supported text.","skill_description_missing: `description` is required and must not be empty.","skill_description_wrong_type: `description` must be a string.","skill_description_empty: `description` must be non-empty.","skill_description_too_long: `description` must be 1,024 characters or fewer.","skill_description_character_unsupported: Skill front matter `description` must use supported text.","skill_body_empty: Skill instructions must not be empty.","skill_identity_too_long: The combined plugin and skill name (`plugin-name:skill-name`) must be 64 characters or fewer.","skill_identity_duplicate: Each skill `name` must be unique within the plugin."],targets:{skill_manifest_missing:qe(Ns),skill_manifest_not_regular_file:qe(Ns),skill_manifest_unreadable:qe(Ns),skill_manifest_invalid_utf8:qe(Ns),skill_frontmatter_missing:qe(Ns),skill_frontmatter_unclosed:qe(Ns),skill_frontmatter_yaml_malformed:qe(Ns),skill_frontmatter_wrong_type:qe(Ns),skill_name_missing:M("name",Sr),skill_name_wrong_type:M("name",He),skill_name_empty:M("name",Ke),skill_name_character_unsupported:M("name",Mr),skill_description_missing:M("description",Sr),skill_description_wrong_type:M("description",He),skill_description_empty:M("description",Ke),skill_description_too_long:M("description",vt(1024)),skill_description_character_unsupported:M("description",Mr),skill_identity_duplicate:M("name")}}),qO=ir({table:"Skill agent metadata errors",stage:"upload",document:"skill-agent",rows:["skill_agent_not_regular_file: `agents/openai.yaml` must be a regular file.","skill_agent_unreadable: `agents/openai.yaml` must be readable.","skill_agent_invalid_utf8: `agents/openai.yaml` must contain valid UTF-8.","skill_agent_yaml_malformed: `agents/openai.yaml` must contain valid YAML.","skill_agent_top_level_wrong_type: `agents/openai.yaml` must contain a YAML mapping at the top level.","skill_agent_interface_missing: `interface` is required in `agents/openai.yaml` when that file is included.","skill_agent_interface_wrong_type: `interface` in `agents/openai.yaml` must be a YAML mapping.","skill_agent_display_name_missing: `interface.display_name` is required and must not be empty.","skill_agent_display_name_wrong_type: `interface.display_name` must be a string.","skill_agent_display_name_empty: `interface.display_name` must not be empty.","skill_agent_short_description_missing: `interface.short_description` is required and must not be empty.","skill_agent_short_description_wrong_type: `interface.short_description` must be a string.","skill_agent_short_description_empty: `interface.short_description` must not be empty.","skill_agent_icon_small_wrong_type: `interface.icon_small` must be a non-empty relative file path when provided.","skill_agent_icon_small_empty: `interface.icon_small` must be a non-empty relative file path when provided, such as `assets/icon.png`.","skill_agent_icon_large_wrong_type: `interface.icon_large` must be a non-empty relative file path when provided.","skill_agent_icon_large_empty: `interface.icon_large` must be a non-empty relative file path when provided, such as `assets/icon.png`.","skill_agent_brand_color_wrong_type: `interface.brand_color` must be a string when provided.","skill_agent_brand_color_empty: `interface.brand_color` must be a non-empty six-digit hex color when provided, such as `#1ABCFE`.","skill_agent_brand_color_format: `interface.brand_color` must be a six-digit hex color, such as `#1ABCFE`.","skill_agent_default_prompt_wrong_type: `interface.default_prompt` must be a string when provided.","skill_agent_default_prompt_empty: `interface.default_prompt` must be non-empty when provided.","skill_agent_policy_wrong_type: `policy` must be a YAML mapping when provided.","skill_agent_allow_implicit_invocation_wrong_type: `policy` may contain only `products` and `allow_implicit_invocation`. `products` must contain `CHAT`, `CODEX`, or both, and `allow_implicit_invocation` must be `true` or `false`.","skill_agent_dependencies_wrong_type: `dependencies` must be a YAML mapping; only `tools` is supported.","skill_agent_dependency_unsupported: Only `dependencies.tools` is supported in `agents/openai.yaml`."],targets:{skill_agent_not_regular_file:qe(oa),skill_agent_unreadable:qe(oa),skill_agent_invalid_utf8:qe(oa),skill_agent_yaml_malformed:qe(oa),skill_agent_top_level_wrong_type:qe(oa),skill_agent_interface_missing:M("interface",Sr),skill_agent_interface_wrong_type:M("interface",Ks),skill_agent_display_name_missing:M(Xd,Sr),skill_agent_display_name_wrong_type:M(Xd,He),skill_agent_display_name_empty:M(Xd,Ke),skill_agent_short_description_missing:M(Zd,Sr),skill_agent_short_description_wrong_type:M(Zd,He),skill_agent_short_description_empty:M(Zd,Ke),skill_agent_icon_small_wrong_type:M(s_,He),skill_agent_icon_small_empty:M(s_,Ke),skill_agent_icon_large_wrong_type:M(n_,He),skill_agent_icon_large_empty:M(n_,Ke),skill_agent_brand_color_wrong_type:M(Qd,He),skill_agent_brand_color_empty:M(Qd,Ke),skill_agent_brand_color_format:M(Qd,Qt(xh)),skill_agent_default_prompt_wrong_type:M(i_,He),skill_agent_default_prompt_empty:M(i_,Ke),skill_agent_policy_wrong_type:M("policy",Ks),skill_agent_allow_implicit_invocation_wrong_type:M(DO,Ch),skill_agent_dependencies_wrong_type:M("dependencies",Ks),skill_agent_dependency_unsupported:M("dependencies")}}),zO=ir({table:"Asset path errors",stage:"upload",rows:["declared_asset_path_wrong_type: The named asset field must be a file path string.","declared_asset_path_empty: The named asset field must not be empty.","declared_asset_path_has_outer_whitespace: The named asset field must not begin or end with whitespace.","declared_asset_path_has_control_character: The named asset field must not contain characters U+0000–U+001F or U+007F.","branding_asset_path_missing_root_prefix: The named asset field must start with `./`.","declared_asset_path_unsafe: The named asset field must be a relative path inside the plugin and must not contain an absolute path, drive prefix, or `..` traversal segment.","declared_asset_path_outside_package: The named asset field must reference a file inside the plugin.","declared_asset_file_missing: The named asset field references a file that does not exist.","declared_asset_not_regular_file: The named asset field must reference a file, not a directory or special file."]}),FO=ir({table:"Image errors",stage:"upload",document:"plugin-manifest",rows:["plugin_logo_path_missing: `interface.logo` is required and must reference a square image.","plugin_composer_icon_path_missing: `interface.composerIcon` is required and must reference a square image.","image_file_unreadable: Image file must be readable.","image_file_too_large: Image must not exceed 5 MiB.","image_file_format_unsupported: Image filename must end in `.png`, `.jpg`, `.jpeg`, `.webp`, or `.svg`.","raster_image_decode_failed: Raster image must be a PNG, JPEG, or WebP file that can be decoded safely.","raster_image_extension_content_mismatch: Image filename extension must match the detected image format.","raster_image_not_square: Image must be square.","raster_image_dimensions_too_small: Image dimensions must be at least 48×48 pixels.","raster_image_dimensions_too_large: Image dimensions must not exceed 4,096×4,096 pixels.","svg_xml_malformed: SVG must contain valid UTF-8 XML.","svg_root_element_invalid: SVG root element must be `<svg>`.","svg_dimensions_missing: SVG must define a numeric `viewBox` or numeric `width` and `height`.","svg_dimensions_not_numeric: SVG dimensions must be numeric and omit units and percentages.","svg_dimensions_not_positive: SVG width and height must be positive finite numbers.","svg_dimensions_not_square: SVG dimensions must be square.","svg_dimensions_too_small: SVG dimensions must be at least 48×48 pixels."],targets:{plugin_logo_path_missing:M("interface.logo"),plugin_composer_icon_path_missing:M("interface.composerIcon")}}),jO=ir({table:"Package warnings",stage:"upload",severity:"warning",rows:["duplicate_app_reference: Each server ID in `.app.json` must be referenced once; duplicate references are treated as one server.","undeclared_app_manifest_ignored: A root `.app.json` is imported only when the plugin-manifest `apps` field is set to `./.app.json`.","undeclared_mcp_manifest_ignored: A root `.mcp.json` is imported only when the plugin-manifest `mcpServers` field is set to `./.mcp.json`.","skill_file_ignored: Files directly under `skills/` aren't imported as skills; each skill must be in a directory containing `SKILL.md`.","skill_symlink_ignored: Symbolic links directly under `skills/` aren't imported as skills; each skill must be a real directory containing `SKILL.md`.","skill_frontmatter_adjusted: Skill `name` and `description` are normalized during import by trimming outer whitespace and collapsing internal whitespace.","skill_metadata_ignored: Skill interface settings must use the `interface` mapping in `agents/openai.yaml`; `metadata` in `SKILL.md` doesn't configure the interface."],targets:{duplicate_app_reference:qe(".app.json"),undeclared_app_manifest_ignored:qe(".app.json"),undeclared_mcp_manifest_ignored:qe(".mcp.json"),skill_file_ignored:qe("skills/"),skill_symlink_ignored:qe("skills/"),skill_metadata_ignored:qe(Ns)}}),HO=["Productivity","Creativity","Developer Tools","Business & Operations","Data & Analytics","Communication","Education & Research","Security","Finance","Healthcare","Travel","Entertainment","Other"],Jc="interface.category",BO=OO(HO),o_="interface.capabilities",Yc="interface.websiteURL",Xc="interface.privacyPolicyURL",Zc="interface.termsOfServiceURL",Qc="interface.supportURL",el="interface.brandColor",tl="interface.brandColorDark",rl=vt(2048,1024),VO=ir({table:"Listing and interface errors",stage:"upload",document:"plugin-manifest",rows:["plugin_interface_wrong_type: The plugin manifest's `interface` field must be a JSON object.","plugin_display_name_wrong_type: `interface.displayName` must be a string.","plugin_display_name_empty: `interface.displayName` is required and must be non-empty.","plugin_display_name_too_long: `interface.displayName` must be 80 characters or fewer for package validation and 30 characters or fewer for final directory submission.","plugin_display_name_character_unsupported: `interface.displayName` must use supported text.","plugin_short_description_missing: `interface.shortDescription` is required, must fit on one line, and must be 240 characters or fewer for package validation and 30 characters or fewer for final directory submission.","plugin_short_description_wrong_type: `interface.shortDescription` must be a string.","plugin_short_description_empty: `interface.shortDescription` must be non-empty.","plugin_short_description_too_long: `interface.shortDescription` must be 240 characters or fewer for package validation and 30 characters or fewer for final directory submission.","plugin_short_description_character_unsupported: `interface.shortDescription` must use supported text.","plugin_long_description_wrong_type: `interface.longDescription` must be a string.","plugin_long_description_empty: `interface.longDescription` is required and must be non-empty.","plugin_long_description_too_long: `interface.longDescription` must be 4,000 characters or fewer.","plugin_long_description_character_unsupported: `interface.longDescription` must use supported text. Line breaks are allowed.","plugin_developer_name_wrong_type: `interface.developerName` must be a string.","plugin_developer_name_empty: `interface.developerName` is required and must be non-empty.","plugin_developer_name_too_long: `interface.developerName` must be 120 characters or fewer for package validation and 80 characters or fewer for final directory submission.","plugin_developer_name_character_unsupported: `interface.developerName` must use supported text.","plugin_category_wrong_type: `interface.category` must be a string.","plugin_category_empty: `interface.category` must be non-empty when provided; omit it to use `Other`.","plugin_category_unknown: `interface.category` must be `Productivity`, `Creativity`, `Developer Tools`, `Business & Operations`, `Data & Analytics`, `Communication`, `Education & Research`, `Security`, `Finance`, `Healthcare`, `Travel`, `Entertainment`, or `Other`.","plugin_category_character_unsupported: `interface.category` must use supported text.","plugin_capabilities_wrong_type: `interface.capabilities` must be a list of strings.","plugin_capabilities_too_many: `interface.capabilities` must contain 20 entries or fewer.","plugin_capability_wrong_type: Each `interface.capabilities` entry must be a string.","plugin_capability_empty: Each `interface.capabilities` entry must be non-empty when provided.","plugin_capability_too_long: Each `interface.capabilities` entry must be 120 characters or fewer.","plugin_capability_character_unsupported: Each `interface.capabilities` entry must use supported text.","plugin_website_url_wrong_type: `interface.websiteURL` must be a string when provided.","plugin_website_url_empty: `interface.websiteURL` must be non-empty when provided.","plugin_website_url_format: `interface.websiteURL` must be an HTTPS URL.","plugin_website_url_too_long: `interface.websiteURL` must meet the listing URL length limits.","plugin_privacy_policy_url_wrong_type: `interface.privacyPolicyURL` must be a string when provided.","plugin_privacy_policy_url_empty: `interface.privacyPolicyURL` must be non-empty when provided.","plugin_privacy_policy_url_format: `interface.privacyPolicyURL` must be an HTTPS URL.","plugin_privacy_policy_url_too_long: `interface.privacyPolicyURL` must meet the listing URL length limits.","plugin_terms_of_service_url_wrong_type: `interface.termsOfServiceURL` must be a string when provided.","plugin_terms_of_service_url_empty: `interface.termsOfServiceURL` must be non-empty when provided.","plugin_terms_of_service_url_format: `interface.termsOfServiceURL` must be an HTTPS URL.","plugin_terms_of_service_url_too_long: `interface.termsOfServiceURL` must meet the listing URL length limits.","plugin_support_url_wrong_type: `interface.supportURL` must be a string when provided.","plugin_support_url_empty: `interface.supportURL` must be non-empty when provided.","plugin_support_url_format: `interface.supportURL` must be an HTTPS URL.","plugin_support_url_too_long: `interface.supportURL` must meet the listing URL length limits.","plugin_homepage_wrong_type: `homepage` must be a string when provided.","plugin_homepage_empty: `homepage` must be non-empty when provided.","plugin_homepage_format: `homepage` must be an HTTPS URL.","plugin_homepage_too_long: `homepage` must be 2,048 characters or fewer.","plugin_brand_color_wrong_type: `interface.brandColor` must be a string when provided.","plugin_brand_color_empty: `interface.brandColor` must be non-empty when provided.","plugin_brand_color_format: `interface.brandColor` must be a six-digit hex color, such as `#1ABCFE`.","plugin_brand_color_dark_wrong_type: `interface.brandColorDark` must be a string when provided.","plugin_brand_color_dark_empty: `interface.brandColorDark` must be non-empty when provided.","plugin_brand_color_dark_format: `interface.brandColorDark` must be a six-digit hex color, such as `#1ABCFE`.","plugin_brand_color_contrast: `interface.brandColor` must have at least 2:1 contrast against white.","plugin_brand_color_dark_contrast: `interface.brandColorDark` must have at least 2:1 contrast against `#212121`.","plugin_default_prompt_wrong_type: `interface.defaultPrompt` must be a string or list of strings.","plugin_default_prompt_too_many: `interface.defaultPrompt` must contain at most three prompts.","plugin_default_prompt_entry_wrong_type: Each `interface.defaultPrompt` entry must be a string.","plugin_default_prompt_empty: Each `interface.defaultPrompt` entry must be non-empty when provided.","plugin_default_prompt_too_long: Each `interface.defaultPrompt` entry must be 512 characters or fewer for package validation and 128 characters or fewer for final directory submission.","plugin_default_prompt_character_unsupported: Each `interface.defaultPrompt` entry must use supported text and fit on one line."],targets:{plugin_interface_wrong_type:M("interface",Ks),plugin_display_name_wrong_type:M(ci,He),plugin_display_name_empty:M(ci,ai),plugin_display_name_too_long:M(ci,vt(80)),plugin_display_name_character_unsupported:M(ci,Mr),plugin_short_description_missing:M(vn,Sr),plugin_short_description_wrong_type:M(vn,He),plugin_short_description_empty:M(vn,Ke),plugin_short_description_too_long:M(vn,vt(240)),plugin_short_description_character_unsupported:M(vn,oo),plugin_long_description_wrong_type:M(li,He),plugin_long_description_empty:M(li,ai),plugin_long_description_too_long:M(li,vt(4e3)),plugin_long_description_character_unsupported:M(li,Mr),plugin_developer_name_wrong_type:M(bn,He),plugin_developer_name_empty:M(bn,ai),plugin_developer_name_too_long:M(bn,vt(120)),plugin_developer_name_character_unsupported:M(bn,Mr),plugin_category_wrong_type:M(Jc,He),plugin_category_empty:M(Jc,Ke),plugin_category_unknown:M(Jc,BO),plugin_category_character_unsupported:M(Jc,Mr),plugin_capabilities_wrong_type:M(o_,ac("array")),plugin_capabilities_too_many:M(o_,t_(20)),plugin_capability_wrong_type:M(xa,He),plugin_capability_empty:M(xa,Ke),plugin_capability_too_long:M(xa,vt(120)),plugin_capability_character_unsupported:M(xa,Mr),plugin_website_url_wrong_type:M(Yc,He),plugin_website_url_empty:M(Yc,Ke),plugin_website_url_format:M(Yc,Qt(ia)),plugin_website_url_too_long:M(Yc,rl),plugin_privacy_policy_url_wrong_type:M(Xc,He),plugin_privacy_policy_url_empty:M(Xc,Ke),plugin_privacy_policy_url_format:M(Xc,Qt(ia)),plugin_privacy_policy_url_too_long:M(Xc,rl),plugin_terms_of_service_url_wrong_type:M(Zc,He),plugin_terms_of_service_url_empty:M(Zc,Ke),plugin_terms_of_service_url_format:M(Zc,Qt(ia)),plugin_terms_of_service_url_too_long:M(Zc,rl),plugin_support_url_wrong_type:M(Qc,He),plugin_support_url_empty:M(Qc,Ke),plugin_support_url_format:M(Qc,Qt(ia)),plugin_support_url_too_long:M(Qc,rl),plugin_homepage_wrong_type:M("homepage",He),plugin_homepage_empty:M("homepage",Ke),plugin_homepage_format:M("homepage",Qt(ia)),plugin_homepage_too_long:M("homepage",vt(2048)),plugin_brand_color_wrong_type:M(el,He),plugin_brand_color_empty:M(el,Ke),plugin_brand_color_format:M(el,Qt(xh)),plugin_brand_color_dark_wrong_type:M(tl,He),plugin_brand_color_dark_empty:M(tl,Ke),plugin_brand_color_dark_format:M(tl,Qt(xh)),plugin_brand_color_contrast:M(el),plugin_brand_color_dark_contrast:M(tl),plugin_default_prompt_wrong_type:M(Ph,ac("string","array")),plugin_default_prompt_too_many:M(Ph,t_(3)),plugin_default_prompt_entry_wrong_type:M(Oa,He),plugin_default_prompt_empty:M(Oa,Ke),plugin_default_prompt_too_long:M(Oa,vt(512,128)),plugin_default_prompt_character_unsupported:M(Oa,oo)}}),GO=/^https:\/\/[^\s/?#]+(?:[/?#]\S*)?$/i,WO=VS(/^[a-z][a-z\d+.-]*:\/\/[^\s/?#]*@/i),KO=/^(?:\.\/)?skills\/?$/,JO=/^(?:\.\/)?\.app\.json$/,YO=/^(?:\.\/)?\.mcp\.json$/,XO=/^(?:asdk_app_|connector_|templated_apps_)[A-Za-z0-9][\w-]*$/,ZO=ir({table:"Plugin manifest errors",stage:"upload",document:"plugin-manifest",rows:[`plugin_manifest_missing: ${ms.plugin_manifest_missing.message}`,"plugin_manifest_not_file: Plugin manifest must be a regular JSON file.","plugin_manifest_unreadable: Plugin manifest must be readable UTF-8 text.","plugin_manifest_json_malformed: Plugin manifest must contain valid JSON; malformed syntax is reported with a line number.","plugin_manifest_root_not_object: Plugin manifest must contain a JSON object at the top level.","codex_manifest_parent_not_directory: `.codex-plugin` must be a directory.","codex_manifest_path_not_file: `.codex-plugin/plugin.json` must be a regular JSON file.","plugin_id_wrong_type: `id` must be a string when provided.","plugin_id_empty: `id` must be non-empty when provided.",`plugin_name_missing: ${ms.plugin_name_missing.message}`,`plugin_name_wrong_type: ${ms.plugin_name_wrong_type.message}`,`plugin_name_empty: ${ms.plugin_name_empty.message}`,`plugin_name_too_long: ${ms.plugin_name_too_long.message}`,`plugin_name_format: ${ms.plugin_name_format.message}`,"plugin_version_missing: `version` is required.","plugin_version_wrong_type: `version` must be a string.","plugin_version_empty: `version` must be a non-empty semantic-version string, such as `1.0.0`.","plugin_version_not_semver: `version` must use semantic versioning, such as `1.0.0`.","plugin_version_too_long: `version` must be 64 characters or fewer.","plugin_description_missing: `description` is required.","plugin_description_wrong_type: `description` must be a string.","plugin_description_empty: `description` must be non-empty.","plugin_description_too_long: `description` must be 1,024 characters or fewer.","plugin_description_character_unsupported: `description` must use supported text. Line breaks are allowed.","plugin_developer_missing: `author.name` is required. `interface.developerName` is also required and is reported separately.","plugin_author_wrong_type: `author` must be an object.","plugin_author_name_wrong_type: `author.name` must be a string.","plugin_author_name_empty: `author.name` must be non-empty.","plugin_author_name_too_long: `author.name` must be 120 characters or fewer.","plugin_author_name_character_unsupported: `author.name` must use supported text.","plugin_author_email_wrong_type: `author.email` must be a string when provided.","plugin_author_email_empty: `author.email` must be non-empty when provided.","plugin_author_email_too_long: `author.email` must be 320 characters or fewer.","plugin_author_email_character_unsupported: `author.email` must use supported text.","plugin_author_url_wrong_type: `author.url` must be a string when provided.","plugin_author_url_empty: `author.url` must be non-empty when provided.","plugin_author_url_not_https: `author.url` must be an HTTPS URL.","plugin_author_url_has_credentials: `author.url` must not contain credentials.","plugin_author_url_too_long: `author.url` must be 2,048 characters or fewer.","plugin_author_url_character_unsupported: `author.url` must use supported text."],targets:{codex_manifest_parent_not_directory:qe(".codex-plugin"),codex_manifest_path_not_file:qe(".codex-plugin/plugin.json"),plugin_id_wrong_type:M("id",He),plugin_id_empty:M("id",Ke),plugin_name_missing:M("name",Sr),plugin_name_wrong_type:M("name",He),plugin_name_empty:M("name",Ke),plugin_name_too_long:M("name",vt(64)),plugin_name_format:M("name",Qt(ES)),plugin_version_missing:M("version",Sr),plugin_version_wrong_type:M("version",He),plugin_version_empty:M("version",Ke),plugin_version_not_semver:M("version",Qt(MO)),plugin_version_too_long:M("version",vt(64)),plugin_description_missing:M("description",Sr),plugin_description_wrong_type:M("description",He),plugin_description_empty:M("description",Ke),plugin_description_too_long:M("description",vt(1024)),plugin_description_character_unsupported:M("description",Mr),plugin_developer_missing:M("author.name",Sr),plugin_author_wrong_type:M("author",Ks),plugin_author_name_wrong_type:M("author.name",He),plugin_author_name_empty:M("author.name",Ke),plugin_author_name_too_long:M("author.name",vt(120)),plugin_author_name_character_unsupported:M("author.name",Mr),plugin_author_email_wrong_type:M("author.email",He),plugin_author_email_empty:M("author.email",Ke),plugin_author_email_too_long:M("author.email",vt(320)),plugin_author_email_character_unsupported:M("author.email",Mr),plugin_author_url_wrong_type:M("author.url",He),plugin_author_url_empty:M("author.url",Ke),plugin_author_url_not_https:M("author.url",Qt(GO)),plugin_author_url_has_credentials:M("author.url",WO),plugin_author_url_too_long:M("author.url",vt(2048)),plugin_author_url_character_unsupported:M("author.url",Mr)}}),QO=ir({table:"Plugin content errors",stage:"upload",document:"plugin-manifest",rows:["plugin_skills_path_wrong_type: `skills` must be a string path for the root `skills/` directory.","plugin_skills_path_empty: `skills` must be a non-empty path to the root `skills/` directory when provided.","plugin_skills_path_unsupported: `skills` must resolve to the root `skills/` directory.","plugin_skills_directory_missing: A declared root `skills/` directory must exist.","plugin_skills_path_not_directory: Root `skills/` must be a directory when declared.","plugin_apps_path_wrong_type: `apps` must be a string path for the root `.app.json`.","plugin_apps_path_empty: `apps` must be a non-empty path to the root `.app.json` when provided.","plugin_apps_path_unsupported: `apps` must resolve to the root `.app.json`.","plugin_apps_file_missing: A declared root `.app.json` file must exist.","plugin_apps_path_not_file: Root `.app.json` must be a regular file when declared.","plugin_mcp_path_wrong_type: `mcpServers` must be a string path for the root `.mcp.json`.","plugin_mcp_path_empty: `mcpServers` must be a nonempty path. Set it to `./.mcp.json` or remove the field.","plugin_mcp_path_unsupported: `mcpServers` must resolve to the root `.mcp.json`.","plugin_mcp_file_missing: `mcpServers` declares the root `.mcp.json`, but that file doesn't exist.","plugin_mcp_path_not_file: Root `.mcp.json` must be a regular file.","plugin_runtime_surface_missing: A public submission ZIP must contain at least one valid skill (or an approved local MCP server). Local and workspace packages can also reference an eligible MCP server."],targets:{plugin_skills_path_wrong_type:M("skills",He),plugin_skills_path_empty:M("skills",Ke),plugin_skills_path_unsupported:M("skills",Qt(KO)),plugin_skills_directory_missing:qe("skills/"),plugin_skills_path_not_directory:qe("skills/"),plugin_apps_path_wrong_type:M("apps",He),plugin_apps_path_empty:M("apps",Ke),plugin_apps_path_unsupported:M("apps",Qt(JO)),plugin_apps_file_missing:qe(".app.json"),plugin_apps_path_not_file:qe(".app.json"),plugin_mcp_path_wrong_type:M("mcpServers",He),plugin_mcp_path_empty:M("mcpServers",Ke),plugin_mcp_path_unsupported:M("mcpServers",Qt(YO)),plugin_mcp_file_missing:qe(".mcp.json"),plugin_mcp_path_not_file:qe(".mcp.json")}}),eM=ir({table:"MCP manifest errors",stage:"upload",document:"mcp-config",rows:["mcp_manifest_unreadable: `.mcp.json` must be readable UTF-8 text.","mcp_manifest_json_malformed: `.mcp.json` must contain valid JSON; malformed syntax is reported with a line number.","mcp_manifest_wrong_type: `.mcp.json` must contain a JSON object at the top level.","mcp_servers_missing: `.mcp.json` must contain the top-level `mcpServers` field.","mcp_servers_wrong_type: `mcpServers` must be an object.","mcp_server_name_empty: Every MCP server name must contain at least one non-whitespace character.","mcp_server_wrong_type: Each `mcpServers.<server-name>` value must be an object containing that server's declaration."],targets:{mcp_manifest_unreadable:qe(".mcp.json"),mcp_manifest_json_malformed:qe(".mcp.json"),mcp_manifest_wrong_type:qe(".mcp.json"),mcp_servers_missing:M("mcpServers",Sr),mcp_servers_wrong_type:M("mcpServers",Ks),mcp_server_name_empty:M("mcpServers"),mcp_server_wrong_type:M("mcpServers.*",Ks)}}),tM=ir({table:"MCP server reference errors",stage:"upload",document:"app-config",rows:["app_manifest_unreadable: `.app.json` must be readable UTF-8 text.","app_manifest_json_malformed: `.app.json` contains malformed JSON near the reported line.","app_manifest_wrong_type: `.app.json` must contain a JSON object at the top level.","app_entries_missing: `apps` is required.","app_entries_wrong_type: `apps` must be an object.","app_entry_wrong_type: Each server entry must be an object.","app_id_missing: Each server entry's `id` is required.","app_id_wrong_type: Each server entry's `id` must be a string.","app_id_format: Each server entry's `id` must begin with `asdk_app_`, `connector_`, or `templated_apps_`, followed by a letter or digit and then only letters, digits, `_`, or `-`.","app_entry_optional_wrong_type: Each server entry's `optional` value must be `true` or `false` when provided.","app_entry_required_wrong_type: Each server entry's `required` value must be `true` or `false` when provided.","app_not_eligible: A local or workspace package must reference an eligible, available MCP server. Directory submissions must use **With MCP** and submit the MCP server directly."],targets:{app_manifest_unreadable:qe(".app.json"),app_manifest_json_malformed:qe(".app.json"),app_manifest_wrong_type:qe(".app.json"),app_entries_missing:M("apps",Sr),app_entries_wrong_type:M("apps",Ks),app_entry_wrong_type:M("apps.*",Ks),app_id_missing:M("apps.*.id",Sr),app_id_wrong_type:M("apps.*.id",He),app_id_format:M("apps.*.id",Qt(XO)),app_entry_optional_wrong_type:M("apps.*.optional",Ch),app_entry_required_wrong_type:M("apps.*.required",Ch)}}),rM=VS(/(?:^|\s)@\S/),sM=ir({table:"Final metadata errors",stage:"submission",document:"plugin-manifest",rows:["submission_display_name_required: Display name is required, non-empty, and single-line.","submission_display_name_too_long: Display name must be 30 characters or fewer.","submission_display_name_character_unsupported: Display name must use supported text and fit on one line.","submission_subtitle_required: Short description is required, non-empty, and single-line.","submission_subtitle_too_long: Short description must be 30 characters or fewer.","submission_subtitle_character_unsupported: Short description must use supported text and fit on one line.","submission_description_required: Long description is required and must be non-empty. Line breaks are allowed.","submission_description_too_long: Long description must be 4,000 characters or fewer.","submission_description_character_unsupported: Long description must use supported text. Line breaks are allowed.","submission_developer_name_required: Developer name is required, non-empty, and single-line.","submission_developer_name_too_long: Developer name must be 80 characters or fewer.","submission_developer_name_character_unsupported: Developer name must use supported text and fit on one line.","plugin_capability_invalid: Each capability must be non-empty, use supported text, fit on one line, and be 120 characters or fewer.","plugin_default_prompt_mention: Starter prompts must not contain MCP server `@mentions`.","plugin_default_prompt_duplicate: Starter prompts must be unique after Unicode and whitespace normalization."],targets:{submission_display_name_required:M(ci,ai),submission_display_name_too_long:M(ci,vt(30)),submission_display_name_character_unsupported:M(ci,oo),submission_subtitle_required:M(vn,ai),submission_subtitle_too_long:M(vn,vt(30)),submission_subtitle_character_unsupported:M(vn,oo),submission_description_required:M(li,ai),submission_description_too_long:M(li,vt(4e3)),submission_description_character_unsupported:M(li,Mr),submission_developer_name_required:M(bn,ai),submission_developer_name_too_long:M(bn,vt(80)),submission_developer_name_character_unsupported:M(bn,oo),plugin_capability_invalid:M(xa,Ke,oo,vt(120)),plugin_default_prompt_mention:M(Oa,rM),plugin_default_prompt_duplicate:M(Ph)}}),nM=ir({table:"MCP and review errors",stage:"submission",rows:["annotations_required: Every MCP tool must set `readOnlyHint`, `openWorldHint`, and `destructiveHint` accurately.","justification_required: Every MCP tool annotation must include a justification for its read-only, open-world, or destructive behavior.","scan_required: MCP tools must have a successful, current scan of the production MCP server.","domain_verification_required: The exact verification token must be hosted at the generated `/.well-known/openai-apps-challenge` URL on the MCP host or an allowed parent host, and **Verify Domain** must pass.","frame_domain_explanation_required: Every external frame domain reported by the MCP tool scan must have an explanation of why the UI needs it and what content it provides."]}),GS=[...sM,...nM,...LO,...NO,...$O,...ZO,...VO,...QO,...eM,...UO,...qO,...zO,...FO,...tM,...jO],iM=GS,kG=Object.freeze(Object.fromEntries(GS.map(e=>[e.code,e]))),oM={"Final metadata errors":"listing-fields","MCP and review errors":"mcp-server","ZIP upload errors and warnings":"package-archive","ZIP structure and limit errors":"package-archive","Plugin root errors":"package-archive","Plugin manifest errors":"package-manifest","Listing and interface errors":"package-manifest","Plugin content errors":"package-manifest","MCP manifest errors":"package-manifest","Skill errors":"package-skills","Skill agent metadata errors":"package-skills","Asset path errors":"package-assets","Image errors":"package-assets","MCP server reference errors":"package-manifest","Package warnings":"package-manifest"},aM={mcp_configuration_excluded:"exclusions",app_configuration_excluded:"exclusions",skill_file_ignored:"package-skills",skill_symlink_ignored:"package-skills",skill_frontmatter_adjusted:"package-skills",skill_metadata_ignored:"package-skills"},cM=iM.map(e=>({id:e.code,category:aM[e.code]??oM[e.table],severity:e.severity==="warning"?"advisory":"blocking",message:e.message,...e.code==="plugin_name_too_long"?{limit:{name:"fieldLimits.pluginNameMaxLength",value:vr.pluginNameMaxLength}}:{},source:{...Vr("deploy/submission-errors",`§${e.table}`),snapshotDate:e.source.capturedOn}})),ae=e=>Vr("deploy/submission-errors",e),lM=[{id:"archive-too-large",category:"package-archive",severity:"blocking",message:"The uploaded archive exceeds the maximum compressed size.",limit:{name:"archiveLimits.maxCompressedBytes",value:Ml.maxCompressedBytes},source:ae("§Shared package checks → Archive size")},{id:"archive-expands-too-large",category:"package-archive",severity:"blocking",message:"The archive's contents exceed the maximum uncompressed size when expanded.",limit:{name:"archiveLimits.maxUncompressedBytes",value:Ml.maxUncompressedBytes},source:ae("§Shared package checks → Archive size")},{id:"archive-too-many-entries",category:"package-archive",severity:"blocking",message:"The archive contains more entries than the maximum allowed.",limit:{name:"archiveLimits.maxEntries",value:Ml.maxEntries},source:ae("§Shared package checks → Entry count")},{id:"archive-encrypted-entry",category:"package-archive",severity:"blocking",message:"The archive contains an encrypted entry, which cannot be scanned.",source:ae("§Shared package checks → Archive integrity")},{id:"archive-path-traversal",category:"package-archive",severity:"blocking",message:"An entry path escapes the package root via a `..` segment.",source:ae("§Shared package checks → Entry paths")},{id:"archive-absolute-path",category:"package-archive",severity:"blocking",message:"An entry path is absolute rather than package-relative.",source:ae("§Shared package checks → Entry paths")},{id:"archive-backslash-path",category:"package-archive",severity:"blocking",message:"An entry path uses a backslash separator.",source:ae("§Shared package checks → Entry paths")},{id:"archive-empty-path-segment",category:"package-archive",severity:"blocking",message:"An entry path contains an empty or `.` segment.",source:ae("§Shared package checks → Entry paths")},{id:"archive-path-whitespace",category:"package-archive",severity:"blocking",message:"An entry path has leading or trailing whitespace.",source:ae("§Shared package checks → Entry paths")},{id:"archive-path-control-character",category:"package-archive",severity:"blocking",message:"An entry path contains a control character or NUL byte.",source:ae("§Shared package checks → Entry paths")},{id:"archive-duplicate-path",category:"package-archive",severity:"blocking",message:"Two entries normalize to the same path, including case-insensitive collisions.",source:ae("§Shared package checks → Entry paths")},{id:"archive-symlink-entry",category:"package-archive",severity:"blocking",message:"The archive contains a symlink or hardlink entry.",source:ae("§Shared package checks → Archive integrity")},{id:"manifest-missing",category:"package-manifest",severity:"blocking",message:"The package contains no plugin manifest.",source:ae("§Shared package checks → Manifest")},{id:"manifest-invalid-json",category:"package-manifest",severity:"blocking",message:"The plugin manifest is not valid JSON.",source:ae("§Shared package checks → Manifest")},{id:"manifest-name-missing",category:"package-manifest",severity:"blocking",message:"The manifest declares no plugin name.",source:ae("§Shared package checks → Manifest")},{id:"manifest-name-too-long",category:"package-manifest",severity:"blocking",message:"The manifest's plugin name exceeds the maximum length.",limit:{name:"fieldLimits.nameMaxLength",value:vr.nameMaxLength},source:ae("§Shared package checks → Manifest")},{id:"manifest-version-invalid",category:"package-manifest",severity:"blocking",message:"The manifest's version is not a valid semantic version.",source:ae("§Shared package checks → Manifest")},{id:"interface-display-name-missing",category:"package-manifest",severity:"blocking",message:"The OpenAI interface document declares no display name.",source:ae("§Listing fields → Interface")},{id:"interface-display-name-too-long",category:"package-manifest",severity:"blocking",message:"The interface display name exceeds the maximum length.",limit:{name:"fieldLimits.displayNameMaxLength",value:vr.displayNameMaxLength},source:ae("§Listing fields → Interface")},{id:"interface-short-description-too-long",category:"package-manifest",severity:"blocking",message:"The interface short description exceeds the maximum length.",limit:{name:"fieldLimits.shortDescriptionMaxLength",value:vr.shortDescriptionMaxLength},source:ae("§Listing fields → Interface")},{id:"interface-default-prompt-too-long",category:"package-manifest",severity:"blocking",message:"The interface default prompt exceeds the maximum length.",limit:{name:"fieldLimits.defaultPromptMaxLength",value:vr.defaultPromptMaxLength},source:ae("§Listing fields → Interface")},{id:"interface-brand-color-invalid",category:"package-manifest",severity:"blocking",message:"The brand color is not a six-digit hex value.",source:ae("§Listing fields → Interface")},{id:"interface-brand-color-low-contrast",category:"package-manifest",severity:"blocking",message:"The brand color does not meet the minimum contrast ratio against both the light and dark backgrounds.",source:ae("§Listing fields → Interface")},{id:"interface-yaml-invalid",category:"package-manifest",severity:"blocking",message:"The OpenAI interface document is not valid YAML.",source:ae("§Listing fields → Interface")},{id:"interface-unsupported-text",category:"package-manifest",severity:"blocking",message:"A text field contains control characters or Unicode line/paragraph separators.",source:ae("§Listing fields → Text")},{id:"skill-metadata-missing",category:"package-skills",severity:"blocking",message:"A skill directory contains no SKILL.md.",source:ae("§Skills → Structure")},{id:"skill-frontmatter-invalid",category:"package-skills",severity:"blocking",message:"A skill's SKILL.md frontmatter is missing or malformed.",source:ae("§Skills → Frontmatter")},{id:"skill-name-missing",category:"package-skills",severity:"blocking",message:"A skill's frontmatter declares no name.",source:ae("§Skills → Frontmatter")},{id:"skill-name-too-long",category:"package-skills",severity:"blocking",message:"A skill name exceeds the maximum length.",limit:{name:"fieldLimits.skillNameMaxLength",value:vr.skillNameMaxLength},source:ae("§Skills → Frontmatter")},{id:"skill-description-missing",category:"package-skills",severity:"blocking",message:"A skill's frontmatter declares no description.",source:ae("§Skills → Frontmatter")},{id:"skill-name-collision",category:"package-skills",severity:"blocking",message:"Two skills in the package declare the same name.",source:ae("§Skills → Structure")},{id:"asset-unsupported-type",category:"package-assets",severity:"blocking",message:"An image is not one of the accepted formats.",source:ae("§Images → Format")},{id:"asset-too-large",category:"package-assets",severity:"blocking",message:"An image exceeds the maximum file size.",limit:{name:"imageConstraints.maxBytes",value:Ll.maxBytes},source:ae("§Images → Size")},{id:"asset-too-small",category:"package-assets",severity:"blocking",message:"An image is smaller than the minimum edge length.",limit:{name:"imageConstraints.minEdgePx",value:Ll.minEdgePx},source:ae("§Images → Dimensions")},{id:"asset-too-big-dimensions",category:"package-assets",severity:"blocking",message:"An image exceeds the maximum edge length.",limit:{name:"imageConstraints.maxEdgePx",value:Ll.maxEdgePx},source:ae("§Images → Dimensions")},{id:"asset-not-square",category:"package-assets",severity:"blocking",message:"An image is not square.",source:ae("§Images → Dimensions")},{id:"asset-undecodable",category:"package-assets",severity:"blocking",message:"An image's dimensions could not be read from its bytes.",source:ae("§Images → Format")},{id:"asset-svg-malformed",category:"package-assets",severity:"blocking",message:"An SVG is not well-formed XML or has no `svg` root element.",source:ae("§Images → SVG")},{id:"asset-svg-no-dimensions",category:"package-assets",severity:"blocking",message:"An SVG declares neither a numeric width/height pair nor a numeric viewBox.",source:ae("§Images → SVG")},{id:"asset-missing",category:"package-assets",severity:"blocking",message:"An asset referenced by the manifest is absent from the package.",source:ae("§Images → Format")},{id:"listing-category-unknown",category:"listing-fields",severity:"blocking",message:"The listing names a category outside the supported set.",source:ae("§Listing fields → Categories")},{id:"listing-description-too-long",category:"listing-fields",severity:"blocking",message:"The listing description exceeds the maximum length.",limit:{name:"fieldLimits.descriptionMaxLength",value:vr.descriptionMaxLength},source:ae("§Listing fields → Description")},{id:"listing-promotional-metadata",category:"listing-fields",severity:"blocking",message:"Listing metadata contains promotional language, pricing claims, or ranking claims.",source:ae("§Listing fields → Description")},{id:"listing-privacy-policy-missing",category:"listing-fields",severity:"blocking",message:"The listing declares no privacy policy URL.",source:ae("§Listing fields → Links")},{id:"listing-support-url-missing",category:"listing-fields",severity:"blocking",message:"The listing declares no support URL.",source:ae("§Listing fields → Links")},{id:"mcp-endpoint-not-https",category:"mcp-server",severity:"blocking",message:"The MCP endpoint is not served over HTTPS.",source:ae("§MCP tools → Endpoint")},{id:"mcp-endpoint-unreachable",category:"mcp-server",severity:"blocking",message:"The MCP endpoint could not be reached during the scan.",source:ae("§MCP tools → Endpoint")},{id:"mcp-tool-name-too-long",category:"mcp-server",severity:"blocking",message:"A tool name exceeds the maximum length.",limit:{name:"fieldLimits.toolNameMaxLength",value:vr.toolNameMaxLength},source:ae("§MCP tools → Metadata")},{id:"mcp-tool-description-missing",category:"mcp-server",severity:"blocking",message:"A tool declares no description.",source:ae("§MCP tools → Metadata")},{id:"mcp-tool-annotations-missing",category:"mcp-server",severity:"blocking",message:"A tool is missing one or more of the required annotation hints.",source:ae("§MCP tools → Annotations")},{id:"mcp-tool-schema-invalid",category:"mcp-server",severity:"blocking",message:"A tool's input or output schema is not a valid JSON Schema object.",source:ae("§MCP tools → Schemas")},{id:"mcp-domain-not-verified",category:"mcp-server",severity:"blocking",message:"The MCP server's domain has not completed domain verification.",source:ae("§MCP tools → Domain verification")},{id:"mcp-csp-domain-missing",category:"mcp-server",severity:"blocking",message:"A UI resource loads from a domain absent from the declared content security policy.",source:ae("§MCP tools → Content security policy")},{id:"mcp-ui-domain-missing",category:"mcp-server",severity:"blocking",message:"A UI resource declares no `_meta.ui.domain`.",source:ae("§MCP tools → UI resources")},{id:"mcp-ui-domain-duplicate",category:"mcp-server",severity:"blocking",message:"Two UI resources declare the same `_meta.ui.domain`.",source:ae("§MCP tools → UI resources")},{id:"mcp-ui-mime-invalid",category:"mcp-server",severity:"blocking",message:"A UI resource does not declare the plugin UI MIME profile.",source:ae("§MCP tools → UI resources")},{id:"mcp-skill-too-many",category:"mcp-skills",severity:"blocking",message:"The server advertises more importable skills than the maximum.",limit:{name:"mcpSkillLimits.maxSkills",value:ei.maxSkills},source:ae("§Skills → Imported from MCP")},{id:"mcp-skill-markdown-too-large",category:"mcp-skills",severity:"blocking",message:"An imported skill's markdown exceeds the maximum size.",limit:{name:"mcpSkillLimits.maxSkillMarkdownBytes",value:ei.maxSkillMarkdownBytes},source:ae("§Skills → Imported from MCP")},{id:"mcp-skill-page-too-large",category:"mcp-skills",severity:"blocking",message:"An imported skill's supporting page exceeds the maximum size.",limit:{name:"mcpSkillLimits.maxPageBytes",value:ei.maxPageBytes},source:ae("§Skills → Imported from MCP")},{id:"mcp-skill-too-many-pages",category:"mcp-skills",severity:"blocking",message:"An imported skill has more supporting pages than the maximum.",limit:{name:"mcpSkillLimits.maxPagesPerSkill",value:ei.maxPagesPerSkill},source:ae("§Skills → Imported from MCP")},{id:"mcp-skill-total-too-large",category:"mcp-skills",severity:"blocking",message:"An imported skill's total footprint exceeds the maximum.",limit:{name:"mcpSkillLimits.maxSkillTotalBytes",value:ei.maxSkillTotalBytes},source:ae("§Skills → Imported from MCP")},{id:"mcp-skills-total-too-large",category:"mcp-skills",severity:"blocking",message:"The imported skills exceed the maximum combined size.",limit:{name:"mcpSkillLimits.maxImportedTotalBytes",value:ei.maxImportedTotalBytes},source:ae("§Skills → Imported from MCP")},{id:"mcp-skill-digest-mismatch",category:"mcp-skills",severity:"blocking",message:"An imported skill's declared digest does not match the resource served for it.",source:ae("§Skills → Imported from MCP")},{id:"mcp-skill-frontmatter-mismatch",category:"mcp-skills",severity:"blocking",message:"An imported skill's listing metadata disagrees with its SKILL.md frontmatter.",source:ae("§Skills → Imported from MCP")},{id:"mcp-skill-scan-failed",category:"mcp-skills",severity:"blocking",message:"The skill scan failed, so the draft's imported skills were not updated.",source:ae("§Skills → Imported from MCP")},{id:"review-success-tests-missing",category:"review-materials",severity:"blocking",message:"Fewer successful test cases were supplied than required.",limit:{name:"submissionTestCases.successCount",value:oi.successCount},source:ae("§Review materials → Test cases")},{id:"review-failure-tests-missing",category:"review-materials",severity:"blocking",message:"Fewer graceful-failure test cases were supplied than required.",limit:{name:"submissionTestCases.failureCount",value:oi.failureCount},source:ae("§Review materials → Test cases")},{id:"review-demo-credentials-missing",category:"review-materials",severity:"blocking",message:"The submission authenticates users but supplies no reviewer demo credentials.",source:ae("§Review materials → Demo access")},{id:"review-demo-recording-missing",category:"review-materials",severity:"blocking",message:"No demo recording was supplied.",source:ae("§Review materials → Demo access")},{id:"review-release-notes-missing",category:"review-materials",severity:"blocking",message:"An updated submission supplies no release notes.",source:ae("§Review materials → Release notes")},{id:"review-attestation-missing",category:"review-materials",severity:"blocking",message:"A required policy attestation was not affirmed.",source:ae("§Review materials → Attestations")},{id:"review-identity-not-verified",category:"review-materials",severity:"blocking",message:"The submitting account has not completed identity verification.",source:ae("§Review materials → Account")},{id:"review-write-permission-missing",category:"review-materials",severity:"blocking",message:"The submitting account lacks the app-write permission.",source:ae("§Review materials → Account")},{id:"review-geography-missing",category:"review-materials",severity:"blocking",message:"The submission declares no country availability.",source:ae("§Review materials → Availability")},{id:"review-annotation-justification-missing",category:"review-materials",severity:"advisory",message:"A tool annotated as destructive or open-world carries no justification for review.",source:ae("§Review materials → Test cases")},{id:"review-scan-stale",category:"review-materials",severity:"blocking",message:"The draft's scan predates the current server contract; re-run Scan Tools.",source:ae("§MCP tools → Scan")},{id:"exclusion-mcp-servers-in-skills-only",category:"exclusions",severity:"blocking",message:"A skills-only submission declares MCP servers, which that shape excludes.",source:ae("§Shared package checks → Excluded content")},{id:"exclusion-app-config-in-public-package",category:"exclusions",severity:"blocking",message:"The package contains an `.app.json`, which maps registered connections for local or workspace use and is excluded from a public submission.",source:ae("§Shared package checks → Excluded content")},{id:"exclusion-screenshots-without-ui",category:"exclusions",severity:"blocking",message:"Screenshots were supplied for a submission that renders no UI template.",source:ae("§Images → Screenshots")},{id:"exclusion-bundle-in-mcp-only",category:"exclusions",severity:"blocking",message:"An MCP-only submission supplies a package archive.",source:ae("§Shared package checks → Excluded content")},{id:"exclusion-unsupported-surface",category:"exclusions",severity:"blocking",message:"The package contains a surface the plugin directory does not support.",source:ae("§Shared package checks → Excluded content")},...cM],EG=Object.freeze(Object.fromEntries(lM.map(e=>[e.id,e]))),uM=["ownsOrIsAuthorizedForService","accurateDataDisclosure","compliesWithUsagePolicies","noProhibitedContent","maintainsSecurityPractices","respondsToSecurityReports","keepsListingAccurate"],dM=["none","account-identifiers","user-content","usage-analytics","payment-information","location","health","shared-with-third-parties"],pM=["in-submission-form","shared-out-of-band","not-required-authless"],ep=w().url().refine(e=>e.startsWith("https://"),{message:"must be an https:// URL"}),a_=se({prompt:w().min(1),expectation:w().min(1)}),hM=se({reference:w().min(1),mimeType:w().min(1),widthPx:Ue().int().positive(),heightPx:Ue().int().positive(),prompt:w().min(1)}),TG=se({name:w().min(1).max(vr.nameMaxLength),shortDescription:w().min(1).max(vr.shortDescriptionMaxLength),description:w().min(1).max(vr.descriptionMaxLength),categories:te(ct(FS)).min(1),privacyPolicyUrl:ep,supportUrl:ep,documentationUrl:ep.optional(),testCases:se({successful:te(a_),gracefulFailure:te(a_)}),demoCredentials:se({provided:Ne(),delivery:ct(pM)}),demoRecordingProvided:Ne(),screenshots:te(hM).default([]),releaseNotes:w().min(1).optional(),identityVerified:Ne(),accountPermissions:te(w().min(1)).default([]),availableCountries:te(w().length(2)).default([]),dataResidencyEligible:Ne().optional(),privacyPolicyDataTypes:te(ct(dM)).default([]),annotationJustifications:Qe(w(),w().min(1)).default({}),frameDomainExplanations:Qe(w(),w().min(1)).default({}),domainVerificationToken:w().min(1).optional(),lastScanAt:w().datetime().optional(),hasPublishedVersion:Ne().optional(),attestations:pS(ct(uM),Ne())}),AG=new TextDecoder("utf-8",{fatal:!1}),Am=Symbol.for("yaml.alias"),fM=Symbol.for("yaml.document"),fi=Symbol.for("yaml.map"),WS=Symbol.for("yaml.pair"),Im=Symbol.for("yaml.scalar"),Tc=Symbol.for("yaml.seq"),Is=Symbol.for("yaml.node.type"),Bo=e=>!!e&&typeof e=="object"&&e[Is]===Am,Ac=e=>!!e&&typeof e=="object"&&e[Is]===fM,Rm=e=>!!e&&typeof e=="object"&&e[Is]===fi,Rt=e=>!!e&&typeof e=="object"&&e[Is]===WS,Ct=e=>!!e&&typeof e=="object"&&e[Is]===Im,Ku=e=>!!e&&typeof e=="object"&&e[Is]===Tc;function pr(e){if(e&&typeof e=="object")switch(e[Is]){case fi:case Tc:return!0}return!1}function At(e){if(e&&typeof e=="object")switch(e[Is]){case Am:case fi:case Im:case Tc:return!0}return!1}var KS=e=>(Ct(e)||pr(e))&&!!e.anchor,ur=Symbol("break visit"),JS=Symbol("skip children"),ys=Symbol("remove node");function Ic(e,t){const r=YS(t);Ac(e)?ao(null,e.contents,r,Object.freeze([e]))===ys&&(e.contents=null):ao(null,e,r,Object.freeze([]))}Ic.BREAK=ur;Ic.SKIP=JS;Ic.REMOVE=ys;function ao(e,t,r,s){const n=XS(e,t,r,s);if(At(n)||Rt(n))return ZS(e,s,n),ao(e,n,r,s);if(typeof n!="symbol"){if(pr(t)){s=Object.freeze(s.concat(t));for(let i=0;i<t.items.length;++i){const o=ao(i,t.items[i],r,s);if(typeof o=="number")i=o-1;else{if(o===ur)return ur;o===ys&&(t.items.splice(i,1),i-=1)}}}else if(Rt(t)){s=Object.freeze(s.concat(t));const i=ao("key",t.key,r,s);if(i===ur)return ur;i===ys&&(t.key=null);const o=ao("value",t.value,r,s);if(o===ur)return ur;o===ys&&(t.value=null)}}return n}async function Cm(e,t){const r=YS(t);Ac(e)?await co(null,e.contents,r,Object.freeze([e]))===ys&&(e.contents=null):await co(null,e,r,Object.freeze([]))}Cm.BREAK=ur;Cm.SKIP=JS;Cm.REMOVE=ys;async function co(e,t,r,s){const n=await XS(e,t,r,s);if(At(n)||Rt(n))return ZS(e,s,n),co(e,n,r,s);if(typeof n!="symbol"){if(pr(t)){s=Object.freeze(s.concat(t));for(let i=0;i<t.items.length;++i){const o=await co(i,t.items[i],r,s);if(typeof o=="number")i=o-1;else{if(o===ur)return ur;o===ys&&(t.items.splice(i,1),i-=1)}}}else if(Rt(t)){s=Object.freeze(s.concat(t));const i=await co("key",t.key,r,s);if(i===ur)return ur;i===ys&&(t.key=null);const o=await co("value",t.value,r,s);if(o===ur)return ur;o===ys&&(t.value=null)}}return n}function YS(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function XS(e,t,r,s){if(typeof r=="function")return r(e,t,s);if(Rm(t))return r.Map?.(e,t,s);if(Ku(t))return r.Seq?.(e,t,s);if(Rt(t))return r.Pair?.(e,t,s);if(Ct(t))return r.Scalar?.(e,t,s);if(Bo(t))return r.Alias?.(e,t,s)}function ZS(e,t,r){const s=t[t.length-1];if(pr(s))s.items[e]=r;else if(Rt(s))e==="key"?s.key=r:s.value=r;else if(Ac(s))s.contents=r;else{const n=Bo(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}var mM={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},gM=e=>e.replace(/[!,[\]{}]/g,t=>mM[t]),QS=class $s{constructor(t,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},$s.defaultYaml,t),this.tags=Object.assign({},$s.defaultTags,r)}clone(){const t=new $s(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new $s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:$s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},$s.defaultTags)}return t}add(t,r){this.atNextDocument&&(this.yaml={explicit:$s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},$s.defaultTags),this.atNextDocument=!1);const s=t.trim().split(/[ \t]+/),n=s.shift();switch(n){case"%TAG":{if(s.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;const[i,o]=s;return this.tags[i]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;const[i]=s;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{const o=/^\d+\.\d+$/.test(i);return r(6,`Unsupported YAML version ${i}`,o),!1}}default:return r(0,`Unknown directive ${n}`,!0),!1}}tagName(t,r){if(t==="!")return"!";if(t[0]!=="!")return r(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const o=t.slice(2,-1);return o==="!"||o==="!!"?(r(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&r("Verbatim tags must end with a >"),o)}const[,s,n]=t.match(/^(.*!)([^!]*)$/s);n||r(`The ${t} tag has no suffix`);const i=this.tags[s];if(i)try{return i+decodeURIComponent(n)}catch(o){return r(String(o)),null}return s==="!"?t:(r(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[r,s]of Object.entries(this.tags))if(t.startsWith(s))return r+gM(t.substring(s.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags);let n;if(t&&s.length>0&&At(t.contents)){const i={};Ic(t.contents,(o,a)=>{At(a)&&a.tag&&(i[a.tag]=!0)}),n=Object.keys(i)}else n=[];for(const[i,o]of s)i==="!!"&&o==="tag:yaml.org,2002:"||(!t||n.some(a=>a.startsWith(o)))&&r.push(`%TAG ${i} ${o}`);return r.join(`
|
|
2
|
+
`)}};QS.defaultYaml={explicit:!1,version:"1.2"};QS.defaultTags={"!!":"tag:yaml.org,2002:"};function ew(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(t)}return!0}function Ma(e,t,r,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let n=0,i=s.length;n<i;++n){const o=s[n],a=Ma(e,s,String(n),o);a===void 0?delete s[n]:a!==o&&(s[n]=a)}else if(s instanceof Map)for(const n of Array.from(s.keys())){const i=s.get(n),o=Ma(e,s,n,i);o===void 0?s.delete(n):o!==i&&s.set(n,o)}else if(s instanceof Set)for(const n of Array.from(s)){const i=Ma(e,s,n,n);i===void 0?s.delete(n):i!==n&&(s.delete(n),s.add(i))}else for(const[n,i]of Object.entries(s)){const o=Ma(e,s,n,i);o===void 0?delete s[n]:o!==i&&(s[n]=o)}return e.call(t,r,s)}function Qr(e,t,r){if(Array.isArray(e))return e.map((s,n)=>Qr(s,String(n),r));if(e&&typeof e.toJSON=="function"){if(!r||!KS(e))return e.toJSON(t,r);const s={aliasCount:0,count:1,res:void 0};r.anchors.set(e,s),r.onCreate=i=>{s.res=i,delete r.onCreate};const n=e.toJSON(t,r);return r.onCreate&&r.onCreate(n),n}return typeof e=="bigint"&&!r?.keep?Number(e):e}var Pm=class{constructor(e){Object.defineProperty(this,Is,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:r,onAnchor:s,reviver:n}={}){if(!Ac(e))throw new TypeError("A document argument is required");const i={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},o=Qr(this,"",i);if(typeof s=="function")for(const{count:a,res:c}of i.anchors.values())s(c,a);return typeof n=="function"?Ma(n,{"":o},"",o):o}},vM=class extends Pm{constructor(e){super(Am),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){if(t?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;t?.aliasResolveCache?r=t.aliasResolveCache:(r=[],Ic(e,{Node:(n,i)=>{(Bo(i)||KS(i))&&r.push(i)}}),t&&(t.aliasResolveCache=r));let s;for(const n of r){if(n===this)break;n.anchor===this.source&&(s=n)}if(s&&t){const{anchors:n,doc:i,maxAliasCount:o}=t;let a=n.get(s);if(a||(Qr(s,null,t),a=n.get(s)),a?.res===void 0)throw new ReferenceError("This should not happen: Alias anchor was not resolved?");if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=$l(i,s,n)),a.count*a.aliasCount>o))throw new ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return s}toJSON(e,t){if(!t)return{source:this.source};const r=this.resolve(t.doc,t);if(!r){const s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(s)}return t.anchors.get(r).res}toString(e,t,r){const s=`*${this.source}`;if(e){if(ew(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const n=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(n)}if(e.implicitKey)return`${s} `}return s}};function $l(e,t,r){if(Bo(t)){const s=t.resolve(e),n=r&&s&&r.get(s);return n?n.count*n.aliasCount:0}else if(pr(t)){let s=0;for(const n of t.items){const i=$l(e,n,r);i>s&&(s=i)}return s}else if(Rt(t)){const s=$l(e,t.key,r),n=$l(e,t.value,r);return Math.max(s,n)}return 1}var tw=e=>!e||typeof e!="function"&&typeof e!="object",pt=class extends Pm{constructor(e){super(Im),this.value=e}toJSON(e,t){return t?.keep?this.value:Qr(this.value,e,t)}toString(){return String(this.value)}};pt.BLOCK_FOLDED="BLOCK_FOLDED";pt.BLOCK_LITERAL="BLOCK_LITERAL";pt.PLAIN="PLAIN";pt.QUOTE_DOUBLE="QUOTE_DOUBLE";pt.QUOTE_SINGLE="QUOTE_SINGLE";var _M="tag:yaml.org,2002:";function yM(e,t,r){if(t){const s=r.filter(i=>i.tag===t),n=s.find(i=>!i.format)??s[0];if(!n)throw new Error(`Tag ${t} not found`);return n}return r.find(s=>s.identify?.(e)&&!s.format)}function su(e,t,r){if(Ac(e)&&(e=e.contents),At(e))return e;if(Rt(e)){const p=r.schema[fi].createNode?.(r.schema,null,r);return p.items.push(e),p}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:s,onAnchor:n,onTagObj:i,schema:o,sourceObjects:a}=r;let c;if(s&&e&&typeof e=="object"){if(c=a.get(e),c)return c.anchor??(c.anchor=n(e)),new vM(c.anchor);c={anchor:null,node:null},a.set(e,c)}t?.startsWith("!!")&&(t=_M+t.slice(2));let l=yM(e,t,o.tags);if(!l){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const p=new pt(e);return c&&(c.node=p),p}l=e instanceof Map?o[fi]:Symbol.iterator in Object(e)?o[Tc]:o[fi]}i&&(i(l),delete r.onTagObj);const u=l?.createNode?l.createNode(r.schema,e,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,e,r):new pt(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function c_(e,t,r){let s=r;for(let n=t.length-1;n>=0;--n){const i=t[n];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){const o=[];o[i]=s,s=o}else s=new Map([[i,s]])}return su(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var bM=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,rw=class extends Pm{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(r=>At(r)||Rt(r)?r.clone(e):r),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(bM(e))this.add(t);else{const[r,...s]=e,n=this.get(r,!0);if(pr(n))n.addIn(s,t);else if(n===void 0&&this.schema)this.set(r,c_(this.schema,s,t));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}deleteIn(e){const[t,...r]=e;if(r.length===0)return this.delete(t);const s=this.get(t,!0);if(pr(s))return s.deleteIn(r);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){const[r,...s]=e,n=this.get(r,!0);return s.length===0?!t&&Ct(n)?n.value:n:pr(n)?n.getIn(s,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!Rt(t))return!1;const r=t.value;return r==null||e&&Ct(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){const[t,...r]=e;if(r.length===0)return this.has(t);const s=this.get(t,!0);return pr(s)?s.hasIn(r):!1}setIn(e,t){const[r,...s]=e;if(s.length===0)this.set(r,t);else{const n=this.get(r,!0);if(pr(n))n.setIn(s,t);else if(n===void 0&&this.schema)this.set(r,c_(this.schema,s,t));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}},SM=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function cc(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var lo=(e,t,r)=>e.endsWith(`
|
|
3
|
+
`)?cc(r,t):r.includes(`
|
|
4
|
+
`)?`
|
|
5
|
+
`+cc(r,t):(e.endsWith(" ")?"":" ")+r,sw="flow",wM="block",kM="quoted";function Ju(e,t,r="flow",{indentAtStart:s,lineWidth:n=80,minContentWidth:i=20,onFold:o,onOverflow:a}={}){if(!n||n<0)return e;n<i&&(i=0);const c=Math.max(1+i,1+n-t.length);if(e.length<=c)return e;const l=[],u={};let p=n-t.length;typeof s=="number"&&(s>n-Math.max(2,i)?l.push(0):p=n-s);let d,h,f=!1,m=-1,v=-1,_=-1;r==="block"&&(m=l_(e,m,t.length),m!==-1&&(p=m+c));for(let T;T=e[m+=1];){if(r==="quoted"&&T==="\\"){switch(v=m,e[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}_=m}if(T===`
|
|
6
|
+
`)r==="block"&&(m=l_(e,m,t.length)),p=m+t.length+c,d=void 0;else{if(T===" "&&h&&h!==" "&&h!==`
|
|
7
|
+
`&&h!==" "){const O=e[m+1];O&&O!==" "&&O!==`
|
|
8
|
+
`&&O!==" "&&(d=m)}if(m>=p)if(d)l.push(d),p=d+c,d=void 0;else if(r==="quoted"){for(;h===" "||h===" ";)h=T,T=e[m+=1],f=!0;const O=m>_+1?m-2:v-1;if(u[O])return e;l.push(O),u[O]=!0,p=O+c,d=void 0}else f=!0}h=T}if(f&&a&&a(),l.length===0)return e;o&&o();let b=e.slice(0,l[0]);for(let T=0;T<l.length;++T){const O=l[T],x=l[T+1]||e.length;O===0?b=`
|
|
9
|
+
${t}${e.slice(0,x)}`:(r==="quoted"&&u[O]&&(b+=`${e[O]}\\`),b+=`
|
|
10
|
+
${t}${e.slice(O+1,x)}`)}return b}function l_(e,t,r){let s=t,n=t+1,i=e[n];for(;i===" "||i===" ";)if(t<n+r)i=e[++t];else{do i=e[++t];while(i&&i!==`
|
|
11
|
+
`);s=t,n=t+1,i=e[n]}return s}var Yu=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Xu=e=>/^(%|---|\.\.\.)/m.test(e);function EM(e,t,r){if(!t||t<0)return!1;const s=t-r,n=e.length;if(n<=s)return!1;for(let i=0,o=0;i<n;++i)if(e[i]===`
|
|
12
|
+
`){if(i-o>s)return!0;if(o=i+1,n-o<=s)return!1}return!0}function Ba(e,t){const r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;const{implicitKey:s}=t,n=t.options.doubleQuotedMinMultiLineLength,i=t.indent||(Xu(e)?" ":"");let o="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(o+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{o+=r.slice(a,c);const u=r.substr(c+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(s||r[c+2]==='"'||r.length<n)c+=1;else{for(o+=r.slice(a,c)+`
|
|
13
|
+
|
|
14
|
+
`;r[c+2]==="\\"&&r[c+3]==="n"&&r[c+4]!=='"';)o+=`
|
|
15
|
+
`,c+=2;o+=i,r[c+2]===" "&&(o+="\\"),c+=1,a=c+1}break;default:c+=1}return o=a?o+r.slice(a):r,s?o:Ju(o,i,kM,Yu(t,!1))}function Oh(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
16
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return Ba(e,t);const r=t.indent||(Xu(e)?" ":""),s="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
17
|
+
${r}`)+"'";return t.implicitKey?s:Ju(s,r,sw,Yu(t,!1))}function uo(e,t){const{singleQuote:r}=t.options;let s;if(r===!1)s=Ba;else{const n=e.includes('"'),i=e.includes("'");n&&!i?s=Oh:i&&!n?s=Ba:s=r?Oh:Ba}return s(e,t)}var Mh;try{Mh=new RegExp(`(^|(?<!
|
|
18
|
+
))
|
|
19
|
+
+(?!
|
|
20
|
+
|$)`,"g")}catch{Mh=/\n+(?!\n|$)/g}function Dl({comment:e,type:t,value:r},s,n,i){const{blockQuote:o,commentString:a,lineWidth:c}=s.options;if(!o||/\n[\t ]+$/.test(r))return uo(r,s);const l=s.indent||(s.forceBlockIndent||Xu(r)?" ":""),u=o==="literal"?!0:o==="folded"||t===pt.BLOCK_FOLDED?!1:t===pt.BLOCK_LITERAL?!0:!EM(r,c,l.length);if(!r)return u?`|
|
|
21
|
+
`:`>
|
|
22
|
+
`;let p,d;for(d=r.length;d>0;--d){const O=r[d-1];if(O!==`
|
|
23
|
+
`&&O!==" "&&O!==" ")break}let h=r.substring(d);const f=h.indexOf(`
|
|
24
|
+
`);f===-1?p="-":r===h||f!==h.length-1?(p="+",i&&i()):p="",h&&(r=r.slice(0,-h.length),h[h.length-1]===`
|
|
25
|
+
`&&(h=h.slice(0,-1)),h=h.replace(Mh,`$&${l}`));let m=!1,v,_=-1;for(v=0;v<r.length;++v){const O=r[v];if(O===" ")m=!0;else if(O===`
|
|
26
|
+
`)_=v;else break}let b=r.substring(0,_<v?_+1:v);b&&(r=r.substring(b.length),b=b.replace(/\n+/g,`$&${l}`));let T=(m?l?"2":"1":"")+p;if(e&&(T+=" "+a(e.replace(/ ?[\r\n]+/g," ")),n&&n()),!u){const O=r.replace(/\n+/g,`
|
|
27
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`);let x=!1;const D=Yu(s,!0);o!=="folded"&&t!==pt.BLOCK_FOLDED&&(D.onOverflow=()=>{x=!0});const z=Ju(`${b}${O}${h}`,l,wM,D);if(!x)return`>${T}
|
|
28
|
+
${l}${z}`}return r=r.replace(/\n+/g,`$&${l}`),`|${T}
|
|
29
|
+
${l}${b}${r}${h}`}function TM(e,t,r,s){const{type:n,value:i}=e,{actualString:o,implicitKey:a,indent:c,indentStep:l,inFlow:u}=t;if(a&&i.includes(`
|
|
30
|
+
`)||u&&/[[\]{},]/.test(i))return uo(i,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return a||u||!i.includes(`
|
|
31
|
+
`)?uo(i,t):Dl(e,t,r,s);if(!a&&!u&&n!==pt.PLAIN&&i.includes(`
|
|
32
|
+
`))return Dl(e,t,r,s);if(Xu(i)){if(c==="")return t.forceBlockIndent=!0,Dl(e,t,r,s);if(a&&c===l)return uo(i,t)}const p=i.replace(/\n+/g,`$&
|
|
33
|
+
${c}`);if(o){const d=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(p),{compat:h,tags:f}=t.doc.schema;if(f.some(d)||h?.some(d))return uo(i,t)}return a?p:Ju(p,c,sw,Yu(t,!1))}function AM(e,t,r,s){const{implicitKey:n,inFlow:i}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:a}=e;a!==pt.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=pt.QUOTE_DOUBLE);const c=u=>{switch(u){case pt.BLOCK_FOLDED:case pt.BLOCK_LITERAL:return n||i?uo(o.value,t):Dl(o,t,r,s);case pt.QUOTE_DOUBLE:return Ba(o.value,t);case pt.QUOTE_SINGLE:return Oh(o.value,t);case pt.PLAIN:return TM(o,t,r,s);default:return null}};let l=c(a);if(l===null){const{defaultKeyType:u,defaultStringType:p}=t.options,d=n&&u||p;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}function IM(e,t){const r=Object.assign({blockQuote:!0,commentString:SM,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);let s;switch(r.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:e,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:s,options:r}}function RM(e,t){if(t.tag){const n=e.filter(i=>i.tag===t.tag);if(n.length>0)return n.find(i=>i.format===t.format)??n[0]}let r,s;if(Ct(t)){s=t.value;let n=e.filter(i=>i.identify?.(s));if(n.length>1){const i=n.filter(o=>o.test);i.length>0&&(n=i)}r=n.find(i=>i.format===t.format)??n.find(i=>!i.format)}else s=t,r=e.find(n=>n.nodeClass&&s instanceof n.nodeClass);if(!r){const n=s?.constructor?.name??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${n} value`)}return r}function CM(e,t,{anchors:r,doc:s}){if(!s.directives)return"";const n=[],i=(Ct(e)||pr(e))&&e.anchor;i&&ew(i)&&(r.add(i),n.push(`&${i}`));const o=e.tag??(t.default?null:t.tag);return o&&n.push(s.directives.tagString(o)),n.join(" ")}function nu(e,t,r,s){if(Rt(e))return e.toString(t,r,s);if(Bo(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let n;const i=At(e)?e:t.doc.createNode(e,{onTagObj:c=>n=c});n??(n=RM(t.doc.schema.tags,i));const o=CM(i,n,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);const a=typeof n.stringify=="function"?n.stringify(i,t,r,s):Ct(i)?AM(i,t,r,s):i.toString(t,r,s);return o?Ct(i)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
34
|
+
${t.indent}${a}`:a}function PM({key:e,value:t},r,s,n){const{allNullValues:i,doc:o,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:p}}=r;let d=At(e)&&e.comment||null;if(p){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(pr(e)||!At(e)&&typeof e=="object")throw new Error("With simple keys, collection cannot be used as a key value")}let h=!p&&(!e||d&&t==null&&!r.inFlow||pr(e)||(Ct(e)?e.type===pt.BLOCK_FOLDED||e.type===pt.BLOCK_LITERAL:typeof e=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!h&&(p||!i),indent:a+c});let f=!1,m=!1,v=nu(e,r,()=>f=!0,()=>m=!0);if(!h&&!r.inFlow&&v.length>1024){if(p)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(r.inFlow){if(i||t==null)return f&&s&&s(),v===""?"?":h?`? ${v}`:v}else if(i&&!p||t==null&&h)return v=`? ${v}`,d&&!f?v+=lo(v,r.indent,l(d)):m&&n&&n(),v;f&&(d=null),h?(d&&(v+=lo(v,r.indent,l(d))),v=`? ${v}
|
|
35
|
+
${a}:`):(v=`${v}:`,d&&(v+=lo(v,r.indent,l(d))));let _,b,T;At(t)?(_=!!t.spaceBefore,b=t.commentBefore,T=t.comment):(_=!1,b=null,T=null,t&&typeof t=="object"&&(t=o.createNode(t))),r.implicitKey=!1,!h&&!d&&Ct(t)&&(r.indentAtStart=v.length+1),m=!1,!u&&c.length>=2&&!r.inFlow&&!h&&Ku(t)&&!t.flow&&!t.tag&&!t.anchor&&(r.indent=r.indent.substring(2));let O=!1;const x=nu(t,r,()=>O=!0,()=>m=!0);let D=" ";if(d||_||b){if(D=_?`
|
|
36
|
+
`:"",b){const z=l(b);D+=`
|
|
37
|
+
${cc(z,r.indent)}`}x===""&&!r.inFlow?D===`
|
|
38
|
+
`&&T&&(D=`
|
|
39
|
+
|
|
40
|
+
`):D+=`
|
|
41
|
+
${r.indent}`}else if(!h&&pr(t)){const z=x[0],F=x.indexOf(`
|
|
42
|
+
`),J=F!==-1,ce=r.inFlow??t.flow??t.items.length===0;if(J||!ce){let de=!1;if(J&&(z==="&"||z==="!")){let R=x.indexOf(" ");z==="&"&&R!==-1&&R<F&&x[R+1]==="!"&&(R=x.indexOf(" ",R+1)),(R===-1||F<R)&&(de=!0)}de||(D=`
|
|
43
|
+
${r.indent}`)}}else(x===""||x[0]===`
|
|
44
|
+
`)&&(D="");return v+=D+x,r.inFlow?O&&s&&s():T&&!O?v+=lo(v,r.indent,l(T)):m&&n&&n(),v}function xM(e,t){(e==="debug"||e==="warn")&&console.warn(t)}var sl="<<",tp={identify:e=>e===sl||typeof e=="symbol"&&e.description===sl,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new pt(Symbol(sl)),{addToJSMap:nw}),stringify:()=>sl},OM=(e,t)=>(tp.identify(t)||Ct(t)&&(!t.type||t.type===pt.PLAIN)&&tp.identify(t.value))&&e?.doc.schema.tags.some(r=>r.tag===tp.tag&&r.default);function nw(e,t,r){const s=iw(e,r);if(Ku(s))for(const n of s.items)rp(e,t,n);else if(Array.isArray(s))for(const n of s)rp(e,t,n);else rp(e,t,s)}function rp(e,t,r){const s=iw(e,r);if(!Rm(s))throw new Error("Merge sources must be maps or map aliases");const n=s.toJSON(null,e,Map);for(const[i,o]of n)t instanceof Map?t.has(i)||t.set(i,o):t instanceof Set?t.add(i):Object.prototype.hasOwnProperty.call(t,i)||Object.defineProperty(t,i,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function iw(e,t){return e&&Bo(t)?t.resolve(e.doc,e):t}function ow(e,t,{key:r,value:s}){if(At(r)&&r.addToJSMap)r.addToJSMap(e,t,s);else if(OM(e,r))nw(e,t,s);else{const n=Qr(r,"",e);if(t instanceof Map)t.set(n,Qr(s,n,e));else if(t instanceof Set)t.add(n);else{const i=MM(r,n,e),o=Qr(s,i,e);i in t?Object.defineProperty(t,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[i]=o}}return t}function MM(e,t,r){if(t===null)return"";if(typeof t!="object")return String(t);if(At(e)&&r?.doc){const s=IM(r.doc,{});s.anchors=new Set;for(const i of r.anchors.keys())s.anchors.add(i.anchor);s.inFlow=!0,s.inStringifyKey=!0;const n=e.toString(s);if(!r.mapKeyWarned){let i=JSON.stringify(n);i.length>40&&(i=i.substring(0,36)+'..."'),xM(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return n}return JSON.stringify(t)}function xm(e,t,r){const s=su(e,void 0,r),n=su(t,void 0,r);return new mi(s,n)}var mi=class aw{constructor(t,r=null){Object.defineProperty(this,Is,{value:WS}),this.key=t,this.value=r}clone(t){let{key:r,value:s}=this;return At(r)&&(r=r.clone(t)),At(s)&&(s=s.clone(t)),new aw(r,s)}toJSON(t,r){const s=r?.mapAsMap?new Map:{};return ow(r,s,this)}toString(t,r,s){return t?.doc?PM(this,t,r,s):JSON.stringify(this)}};function cw(e,t,r){return(t.inFlow??e.flow?NM:LM)(e,t,r)}function LM({comment:e,items:t},r,{blockItemPrefix:s,flowChars:n,itemIndent:i,onChompKeep:o,onComment:a}){const{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:i,type:null});let p=!1;const d=[];for(let f=0;f<t.length;++f){const m=t[f];let v=null;if(At(m))!p&&m.spaceBefore&&d.push(""),iu(r,d,m.commentBefore,p),m.comment&&(v=m.comment);else if(Rt(m)){const b=At(m.key)?m.key:null;b&&(!p&&b.spaceBefore&&d.push(""),iu(r,d,b.commentBefore,p))}p=!1;let _=nu(m,u,()=>v=null,()=>p=!0);v&&(_+=lo(_,i,l(v))),p&&v&&(p=!1),d.push(s+_)}let h;if(d.length===0)h=n.start+n.end;else{h=d[0];for(let f=1;f<d.length;++f){const m=d[f];h+=m?`
|
|
45
|
+
${c}${m}`:`
|
|
46
|
+
`}}return e?(h+=`
|
|
47
|
+
`+cc(l(e),c),a&&a()):p&&o&&o(),h}function NM({items:e},t,{flowChars:r,itemIndent:s}){const{indent:n,indentStep:i,flowCollectionPadding:o,options:{commentString:a}}=t;s+=i;const c=Object.assign({},t,{indent:s,inFlow:!0,type:null});let l=!1,u=0;const p=[];for(let f=0;f<e.length;++f){const m=e[f];let v=null;if(At(m))m.spaceBefore&&p.push(""),iu(t,p,m.commentBefore,!1),m.comment&&(v=m.comment);else if(Rt(m)){const b=At(m.key)?m.key:null;b&&(b.spaceBefore&&p.push(""),iu(t,p,b.commentBefore,!1),b.comment&&(l=!0));const T=At(m.value)?m.value:null;T?(T.comment&&(v=T.comment),T.commentBefore&&(l=!0)):m.value==null&&b?.comment&&(v=b.comment)}v&&(l=!0);let _=nu(m,c,()=>v=null);l||(l=p.length>u||_.includes(`
|
|
48
|
+
`)),f<e.length-1?_+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(l||(l=p.reduce((b,T)=>b+T.length+2,2)+(_.length+2)>t.options.lineWidth)),l&&(_+=",")),v&&(_+=lo(_,s,a(v))),p.push(_),u=p.length}const{start:d,end:h}=r;if(p.length===0)return d+h;if(!l){const f=p.reduce((m,v)=>m+v.length+2,2);l=t.options.lineWidth>0&&f>t.options.lineWidth}if(l){let f=d;for(const m of p)f+=m?`
|
|
49
|
+
${i}${n}${m}`:`
|
|
50
|
+
`;return`${f}
|
|
51
|
+
${n}${h}`}else return`${d}${o}${p.join(" ")}${o}${h}`}function iu({indent:e,options:{commentString:t}},r,s,n){if(s&&n&&(s=s.replace(/^\n+/,"")),s){const i=cc(t(s),e);r.push(i.trimStart())}}function ui(e,t){const r=Ct(t)?t.value:t;for(const s of e)if(Rt(s)&&(s.key===t||s.key===r||Ct(s.key)&&s.key.value===r))return s}var _n=class extends rw{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(fi,e),this.items=[]}static from(e,t,r){const{keepUndefined:s,replacer:n}=r,i=new this(e),o=(a,c)=>{if(typeof n=="function")c=n.call(t,a,c);else if(Array.isArray(n)&&!n.includes(a))return;(c!==void 0||s)&&i.items.push(xm(a,c,r))};if(t instanceof Map)for(const[a,c]of t)o(a,c);else if(t&&typeof t=="object")for(const a of Object.keys(t))o(a,t[a]);return typeof e.sortMapEntries=="function"&&i.items.sort(e.sortMapEntries),i}add(e,t){let r;Rt(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new mi(e,e?.value):r=new mi(e.key,e.value);const s=ui(this.items,r.key),n=this.schema?.sortMapEntries;if(s){if(!t)throw new Error(`Key ${r.key} already set`);Ct(s.value)&&tw(r.value)?s.value.value=r.value:s.value=r.value}else if(n){const i=this.items.findIndex(o=>n(r,o)<0);i===-1?this.items.push(r):this.items.splice(i,0,r)}else this.items.push(r)}delete(e){const t=ui(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){const r=ui(this.items,e)?.value;return(!t&&Ct(r)?r.value:r)??void 0}has(e){return!!ui(this.items,e)}set(e,t){this.add(new mi(e,t),!0)}toJSON(e,t,r){const s=r?new r:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(s);for(const n of this.items)ow(t,s,n);return s}toString(e,t,r){if(!e)return JSON.stringify(this);for(const s of this.items)if(!Rt(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),cw(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:t})}},$M={collection:"map",default:!0,nodeClass:_n,tag:"tag:yaml.org,2002:map",resolve(e,t){return Rm(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,r)=>_n.from(e,t,r)},ou=class extends rw{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Tc,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=nl(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){const r=nl(e);if(typeof r!="number")return;const s=this.items[r];return!t&&Ct(s)?s.value:s}has(e){const t=nl(e);return typeof t=="number"&&t<this.items.length}set(e,t){const r=nl(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);const s=this.items[r];Ct(s)&&tw(t)?s.value=t:this.items[r]=t}toJSON(e,t){const r=[];t?.onCreate&&t.onCreate(r);let s=0;for(const n of this.items)r.push(Qr(n,String(s++),t));return r}toString(e,t,r){return e?cw(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:t}):JSON.stringify(this)}static from(e,t,r){const{replacer:s}=r,n=new this(e);if(t&&Symbol.iterator in Object(t)){let i=0;for(let o of t){if(typeof s=="function"){const a=t instanceof Set?o:String(i++);o=s.call(t,a,o)}n.items.push(su(o,void 0,r))}}return n}};function nl(e){let t=Ct(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}var DM={collection:"seq",default:!0,nodeClass:ou,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Ku(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,r)=>ou.from(e,t,r)};function u_(e){return typeof e=="bigint"||Number.isInteger(e)}var il=({value:e})=>JSON.stringify(e),UM=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:il},{identify:e=>e==null,createNode:()=>new pt(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:il},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:il},{identify:u_,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:r})=>r?BigInt(e):parseInt(e,10),stringify:({value:e})=>u_(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:il}],IG=[$M,DM].concat(UM,{default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function qM(e,t,r){const{replacer:s}=r,n=new ou(e);n.tag="tag:yaml.org,2002:pairs";let i=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof s=="function"&&(o=s.call(t,String(i++),o));let a,c;if(Array.isArray(o))if(o.length===2)a=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){const l=Object.keys(o);if(l.length===1)a=l[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=o;n.items.push(xm(a,c,r))}return n}var zM=class lw extends ou{constructor(){super(),this.add=_n.prototype.add.bind(this),this.delete=_n.prototype.delete.bind(this),this.get=_n.prototype.get.bind(this),this.has=_n.prototype.has.bind(this),this.set=_n.prototype.set.bind(this),this.tag=lw.tag}toJSON(t,r){if(!r)return super.toJSON(t);const s=new Map;r?.onCreate&&r.onCreate(s);for(const n of this.items){let i,o;if(Rt(n)?(i=Qr(n.key,"",r),o=Qr(n.value,i,r)):i=Qr(n,"",r),s.has(i))throw new Error("Ordered maps must not include duplicate keys");s.set(i,o)}return s}static from(t,r,s){const n=qM(t,r,s),i=new this;return i.items=n.items,i}};zM.tag="tag:yaml.org,2002:omap";var FM=class uw extends _n{constructor(t){super(t),this.tag=uw.tag}add(t){let r;Rt(t)?r=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?r=new mi(t.key,null):r=new mi(t,null),ui(this.items,r.key)||this.items.push(r)}get(t,r){const s=ui(this.items,t);return!r&&Rt(s)?Ct(s.key)?s.key.value:s.key:s}set(t,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);const s=ui(this.items,t);s&&!r?this.items.splice(this.items.indexOf(s),1):!s&&r&&this.items.push(new mi(t))}toJSON(t,r){return super.toJSON(t,r,Set)}toString(t,r,s){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),r,s);throw new Error("Set items must all have null values")}static from(t,r,s){const{replacer:n}=s,i=new this(t);if(r&&Symbol.iterator in Object(r))for(let o of r)typeof n=="function"&&(o=n.call(r,o,o)),i.items.push(xm(o,null,s));return i}};FM.tag="tag:yaml.org,2002:set";var Lh=Symbol("break visit"),jM=Symbol("skip children"),dw=Symbol("remove item");function Io(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),pw(Object.freeze([]),e,t)}Io.BREAK=Lh;Io.SKIP=jM;Io.REMOVE=dw;Io.itemAtPath=(e,t)=>{let r=e;for(const[s,n]of t){const i=r?.[s];if(i&&"items"in i)r=i.items[n];else return}return r};Io.parentCollection=(e,t)=>{const r=Io.itemAtPath(e,t.slice(0,-1)),s=t[t.length-1][0],n=r?.[s];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function pw(e,t,r){let s=r(t,e);if(typeof s=="symbol")return s;for(const n of["key","value"]){const i=t[n];if(i&&"items"in i){for(let o=0;o<i.items.length;++o){const a=pw(Object.freeze(e.concat([[n,o]])),i.items[o],r);if(typeof a=="number")o=a-1;else{if(a===Lh)return Lh;a===dw&&(i.items.splice(o,1),o-=1)}}typeof s=="function"&&n==="key"&&(s=s(t,e))}}return typeof s=="function"?s(t,e):s}var HM=["hosted","org","local"],Zu=["none","minimal","low","medium","high","xhigh","max"],BM=["none","openrouter"],VM=new Set(["modelId","source","connectionRef","nativeModelId","settings","fallback"]),GM=new Set(["kind","id"]),WM=new Set(["kind","providerKey","customProviderName"]),KM=new Set(["reasoningEffort","temperature"]),JM=new Set(["provider","model"]),YM=new Set(HM),XM=new Set(Zu),ZM=new Set(BM),QM=/^[a-z0-9][a-z0-9._:-]*\/[^\s/]\S*$/;function Ro(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function e2(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function An(e,t){return e===""?t:`${e}.${t}`}function lc(e,t,r,s){for(const n of Object.keys(e))t.has(n)||s.push({path:An(r,n),code:"unknown_key",message:`unknown key "${n}" (a selection never carries credentials)`})}function Va(e,t,r,s,n){const i=An(r,t);if(!e2(e,t)||e[t]===void 0){n&&s.push({path:i,code:"required",message:"is required"});return}const o=e[t];if(typeof o!="string"){s.push({path:i,code:"invalid_type",message:"must be a string"});return}if(o.trim()===""||o.trim()!==o){s.push({path:i,code:"invalid_value",message:"must be a non-empty string without surrounding whitespace"});return}return o}function t2(e,t){const r="connectionRef";if(!Ro(e)){t.push({path:r,code:"invalid_type",message:"must be a plain object"});return}if(e.kind==="orgProvider"){lc(e,GM,r,t);const s=Va(e,"id",r,t,!0);return s===void 0?void 0:{kind:"orgProvider",id:s}}if(e.kind==="localProvider"){lc(e,WM,r,t);const s=Va(e,"providerKey",r,t,!0),n=Va(e,"customProviderName",r,t,!1);return s===void 0?void 0:{kind:"localProvider",providerKey:s,...n!==void 0?{customProviderName:n}:{}}}t.push({path:An(r,"kind"),code:e.kind===void 0?"required":"invalid_value",message:'must be "orgProvider" or "localProvider"'})}function r2(e,t){const r="settings";if(!Ro(e)){t.push({path:r,code:"invalid_type",message:"must be a plain object"});return}lc(e,KM,r,t);const s={};if(e.reasoningEffort!==void 0&&(typeof e.reasoningEffort=="string"&&XM.has(e.reasoningEffort)?s.reasoningEffort=e.reasoningEffort:t.push({path:An(r,"reasoningEffort"),code:"invalid_value",message:`must be one of ${Zu.map(n=>`"${n}"`).join(", ")}`})),e.temperature!==void 0){const n=e.temperature;typeof n!="number"||!Number.isFinite(n)?t.push({path:An(r,"temperature"),code:"invalid_type",message:"must be a finite number"}):n<0||n>2?t.push({path:An(r,"temperature"),code:"out_of_range",message:"must be within [0, 2]"}):s.temperature=n}return s}function s2(e,t){const r="fallback";if(e===void 0){t.push({path:r,code:"required",message:"is required"});return}if(!Ro(e)){t.push({path:r,code:"invalid_type",message:"must be a plain object"});return}lc(e,JM,r,t);let s=!0;if((typeof e.provider!="string"||!ZM.has(e.provider))&&(s=!1,t.push({path:An(r,"provider"),code:e.provider===void 0?"required":"invalid_value",message:'must be "none" or "openrouter"'})),e.model!=="none"&&(s=!1,t.push({path:An(r,"model"),code:e.model===void 0?"required":"invalid_value",message:'must be "none" (no surface substitutes a different model)'})),!!s)return{provider:e.provider,model:"none"}}function n2(e){const t=[];if(!Ro(e))return{ok:!1,issues:[{path:"",code:"invalid_type",message:"must be a plain object"}]};lc(e,VM,"",t);const r=Va(e,"modelId","",t,!0);r!==void 0&&!QM.test(r)&&t.push({path:"modelId",code:"model_id_not_canonical",message:`"${r}" is not a canonical "provider/model" id`});let s;e.source===void 0?t.push({path:"source",code:"required",message:"is required"}):typeof e.source=="string"&&YM.has(e.source)?s=e.source:t.push({path:"source",code:"invalid_value",message:e.source==="legacy"?'"legacy" is read-only: a legacy selection is never saved':'must be "hosted", "org" or "local"'});const n=e.connectionRef===void 0?void 0:t2(e.connectionRef,t);if(s==="hosted"&&e.connectionRef!==void 0)t.push({path:"connectionRef",code:"connection_ref_mismatch",message:'must be absent when source is "hosted"'});else if(s==="org"||s==="local"){const l=s==="org"?"orgProvider":"localProvider";e.connectionRef===void 0?t.push({path:"connectionRef",code:"connection_ref_mismatch",message:`is required when source is "${s}" (kind "${l}")`}):Ro(e.connectionRef)&&(e.connectionRef.kind==="orgProvider"||e.connectionRef.kind==="localProvider")&&e.connectionRef.kind!==l&&t.push({path:"connectionRef.kind",code:"connection_ref_mismatch",message:`must be "${l}" when source is "${s}"`})}const i=Va(e,"nativeModelId","",t,!1),o=e.settings===void 0?void 0:r2(e.settings,t),a=s2(e.fallback,t);if(t.length>0)return{ok:!1,issues:t};const c=o!==void 0&&(o.reasoningEffort!==void 0||o.temperature!==void 0);return{ok:!0,selection:{modelId:r,source:s,...n!==void 0?{connectionRef:n}:{},...i!==void 0?{nativeModelId:i}:{},...c?{settings:{...o.reasoningEffort!==void 0?{reasoningEffort:o.reasoningEffort}:{},...o.temperature!==void 0?{temperature:o.temperature}:{}}}:{},fallback:a}}}function i2(e){return n2(e).ok}function RG(e){return Ro(e)&&e.source==="legacy"&&typeof e.modelId=="string"&&e.modelId.trim()!==""}function CG(e){const t=encodeURIComponent;let r="";if(e.source!=="legacy"&&e.connectionRef){const s=e.connectionRef;r=s.kind==="orgProvider"?t(s.id):s.customProviderName!==void 0?`${t(s.providerKey)}:${t(s.customProviderName)}`:t(s.providerKey)}return`${e.source}:${r}:${t(e.modelId)}`}function PG(e){return{provider:e==="chat"?"openrouter":"none",model:"none"}}var o2=["maxBlocks","turnMaxBytes","updateMaxBytes"],xG=Object.freeze({maxBlocks:64,turnMaxBytes:1048576,updateMaxBytes:262144}),OG=Object.freeze({maxBlocks:1024,turnMaxBytes:8388608,updateMaxBytes:4194304}),Om={displayHints:["openai/ui","ui"],displayStart:["hint-first","inline-then-move"],entrypointVisibility:["ignore","require-model"],entrypointWithoutFullscreen:["refuse","inline"],entrypointNames:["any","no-double-separators"],entrypointQuickActions:["show","hide"]},d_="mcpProfile.apps.pluginExtensions.behavior";function Ul(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function a2(e){return Object.hasOwn(Om,e)}function c2(e,t){const r=Om[e];return typeof t=="string"&&r.includes(t)}function l2(e,t,r){e[t]=r}function u2(e,t){const r={};for(const s of Object.keys(e).sort()){if(!a2(s)){if(t)throw new Error(`hostConfigV2: ${d_} has unknown key "${s}"`);continue}const n=e[s];if(c2(s,n))l2(r,s,n);else if(t){const i=Om[s];throw new Error(`hostConfigV2: ${d_}.${s} must be one of ${i.map(o=>`"${o}"`).join(", ")}`)}}return r}function hw(e){return Ul(e)?u2(e,!1):{}}var fw=Object.freeze({displayHints:"openai/ui",displayStart:"hint-first",entrypointVisibility:"ignore",entrypointWithoutFullscreen:"refuse",entrypointNames:"any",entrypointQuickActions:"show"}),mw=Object.freeze({sidebarApps:!0,conversationPanels:!0,fileViewers:!0,fileResources:!0,localFiles:!0,settings:!0,displayModes:!0,deepLinks:!0,modelContext:!0,messages:!0,mentions:!0,forms:!0,onboarding:!0}),to=Object.freeze({enabled:!0,capabilities:mw,behavior:fw}),Nh=Object.freeze({enabled:!0,capabilities:Object.freeze({sidebarApps:!1,conversationPanels:!1,fileViewers:!1,fileResources:!1,localFiles:!1,settings:!1,displayModes:!0,deepLinks:!1,modelContext:!1,messages:!1,mentions:!1,forms:!1,onboarding:!1}),behavior:Object.freeze({displayHints:"ui",displayStart:"inline-then-move",entrypointVisibility:"require-model",entrypointWithoutFullscreen:"inline",entrypointNames:"no-double-separators",entrypointQuickActions:"hide"})}),d2=Object.freeze({...Nh,capabilities:Object.freeze({...Nh.capabilities,sidebarApps:!0})}),p2=Object.freeze({enabled:!1,capabilities:mw,behavior:fw}),p_=Object.freeze({chatgpt:to,"chatgpt-desktop":to,"chatgpt-work":to,"chatgpt-work-desktop":to,codex:to,claude:d2,"claude-desktop":Nh});function Mm(e){if(e.harness==="codex")return to;const t=e.hostStyle;return(typeof t=="string"&&Object.hasOwn(p_,t)?p_[t]:void 0)??p2}function h2(e){if(!Ul(e)||!Ul(e.apps))return{};const t=e.apps.pluginExtensions;return!Ul(t)||typeof t.enabled!="boolean"?{}:hw(t.behavior)}function MG(e){return{...Mm(e??{}).behavior,...h2(e?.mcpProfile)}}var f2=["inline","fullscreen","pip"],LG=new Set(f2),ql=["mode","originAllowlist"],NG={allow_all:new Set(ql),read_only:new Set(ql),allowlist:new Set([...ql,"toolAllowlist"])},$G=new Set([...ql,"toolAllowlist"]),DG=new Set(gm),UG=new Set(o2),qG=new Set(qC),zG=new Set(zC),FG=new Set(HC),jG=new Set(jC),m2=["clientName","redirectUris","userAgent"],HG=new Set(m2);function g2(e){const t=new Uint8Array(e);let r="";for(let s=0;s<t.length;s++)r+=t[s].toString(16).padStart(2,"0");return r}async function gw(e){const t=new TextEncoder().encode(e);return g2(await crypto.subtle.digest("SHA-256",t))}async function v2(e){const t=await crypto.subtle.digest("SHA-256",e),r=new Uint8Array(t);let s="";for(let n=0;n<r.length;n++)s+=r[n].toString(16).padStart(2,"0");return s}async function vw(e){return gw(hP(e))}async function _w(e){const t=[...e].sort((r,s)=>r.path<s.path?-1:r.path>s.path?1:0);return gw(t.map(r=>`${r.path}\0${r.contentHash}\0`).join(""))}async function _2(e){return vw({digest:"plugin-execution/1",bundleHash:e.bundleHash,executableFiles:[...e.executableFiles].sort(),profile:e.profile,revision:e.revision})}var y2=[{path:Tn,layout:"agent-plugins"},...xS];function sp(e,t,r){const s=e===""?"":`${e}/`;return y2.find(({path:n,layout:i})=>(r==="openai-compatible"||i==="agent-plugins")&&t.has(`${s}${n}`))}function b2(e,t){const r=sp("",e,t);if(r!==void 0)return{directory:"",manifest:r,refusals:[]};const s=[...new Set([...e].map(o=>o.split("/",1)[0]))].sort(),n=t==="strict"?[]:s.filter(o=>sp(o,e,t));if(n.length!==1)return{directory:"",refusals:n.length===0?[{code:"plugin_manifest_missing"}]:n.map(o=>({code:"plugin_root_ambiguous",path:o}))};const[i]=n;return{directory:i,manifest:sp(i,e,t),refusals:s.filter(o=>o!==i).map(o=>({code:"plugin_root_has_siblings",path:o}))}}function S2(e,t){return e===""?t:t.startsWith(`${e}/`)?t.slice(e.length+1):void 0}var w2={plugin_manifest_missing:"MANIFEST_MISSING",plugin_root_ambiguous:"PLUGIN_ROOT_AMBIGUOUS",plugin_root_has_siblings:"PLUGIN_ROOT_HAS_SIBLINGS"};function k2(e,t,r){for(const{code:s,path:n}of e.refusals){const i=t==="strict"?`bundle is missing "${Tn}" at its root`:ms[s].message;r.error(w2[s],i,n?{path:n}:void 0)}}var h_="skills",E2="SKILL.md",yw=64,f_=1024;function T2(e){return e.length<1||e.length>yw||e.includes("--")?!1:/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(e)}var $h=class extends Error{constructor(){super("yaml value nests too deeply"),this.name="YamlValueTooDeepError"}};function Dh(e,t=0){const r=e.trim();if(r.length>=2&&(r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'")))return r.slice(1,-1);if(r==="true")return!0;if(r==="false")return!1;if(r==="null"||r==="~")return null;if(/^-?\d+(\.\d+)?$/.test(r))return Number(r);if(r.startsWith("[")&&r.endsWith("]")){if(t>=32)throw new $h;const s=r.slice(1,-1).trim();return s===""?[]:s.split(",").map(n=>Dh(n,t+1))}return r}function A2(e){const t={},r=[],s=[],n=e.split(/\r?\n/);let i=0;for(;i<n.length;){const o=n[i];if(/^\s*$/.test(o)||/^\s*#/.test(o)){i++;continue}const a=/^([A-Za-z0-9_.-]+):\s*(.*)$/.exec(o);if(!a){r.push(o),i++;continue}const c=a[1],l=a[2];if(l===""){const u=[];let p=i+1;for(;p<n.length;){const d=n[p];if(/^\s*$/.test(d)||/^\s*#/.test(d)){p++;continue}const h=/^\s+-\s*(.*)$/.exec(d);if(h){try{u.push(Dh(h[1]))}catch(f){if(!(f instanceof $h))throw f;s.push(d)}p++;continue}if(/^\s+\S/.test(d)){r.push(d),p++;continue}break}u.length>0?t[c]=u:t[c]="",i=p;continue}if(l==="|"||l==="|-"||l===">"||l===">-"){const u=[];let p=null,d=i+1;for(;d<n.length;){const h=n[d];if(/^\s*$/.test(h)){u.push(""),d++;continue}const f=h.length-h.trimStart().length;if(f===0)break;p===null&&(p=f),u.push(h.slice(Math.min(p,f))),d++}for(;u.length>0&&u[u.length-1]==="";)u.pop();t[c]=l.startsWith("|")?u.join(`
|
|
52
|
+
`):u.map(h=>h||`
|
|
53
|
+
`).join(" "),i=d;continue}try{t[c]=Dh(l)}catch(u){if(!(u instanceof $h))throw u;s.push(o)}i++}return{data:t,unparsed:r,tooDeep:s}}function I2(e){const t=/^---\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/.exec(e);return t?{frontmatter:t[1],body:e.slice(t[0].length)}:null}function R2(e){return!Array.isArray(e)||e.some(t=>typeof t!="string")?null:e}async function C2(e){const{pluginName:t,directory:r,directoryName:s,skillFilePath:n,skillText:i,skillContentHash:o,files:a,issues:c}=e,l=`skill:${s}`,u={path:n,componentKey:l},p=I2(i);if(p===null)return c.error("SKILL_FRONTMATTER_MISSING",`skill "${s}" is missing YAML frontmatter in SKILL.md`,u),null;const{data:d,unparsed:h,tooDeep:f}=A2(p.frontmatter);for(const z of h)c.warn("SKILL_FRONTMATTER_UNPARSED",`skill "${s}": frontmatter line not interpreted: ${z.trim()}`,u);for(const z of f)c.error("VALUE_TOO_DEEP",`skill "${s}": frontmatter value nests deeper than 32 levels: ${z.trim().slice(0,80)}`,u);const m=d.name;if(typeof m!="string"||m.length===0)return c.error("SKILL_MISSING_NAME",`skill "${s}" is missing the required "name" field`,u),null;if(!T2(m))return c.error("SKILL_INVALID_NAME",`skill name "${m}" must be kebab-case ([a-z0-9-], 1-${yw} chars, no "--")`,u),null;m!==s&&c.warn("SKILL_NAME_MISMATCH",`skill name "${m}" does not match its directory "${s}"`,u);const v=d.description;if(typeof v!="string"||v.length===0)return c.error("SKILL_MISSING_DESCRIPTION",`skill "${s}" is missing the required "description" field`,u),null;if(v.length>f_)return c.error("SKILL_DESCRIPTION_TOO_LONG",`skill "${s}" description exceeds ${f_} characters`,u),null;let _;const b=d.allow_implicit_invocation;b!==void 0&&(typeof b!="boolean"?c.warn("SKILL_INVALID_METADATA",`skill "${s}": "allow_implicit_invocation" must be a boolean`,u):_=b);const T=[],O=d.mcp_tools;if(O!==void 0){const z=R2(O);if(z===null)c.warn("SKILL_INVALID_METADATA",`skill "${s}": "mcp_tools" must be a list of strings`,u);else for(const F of z)T.includes(F)||T.push(F)}const x=a.filter(z=>z.path!==n).map(z=>({path:z.path,relativePath:z.path.slice(r.length+1),size:z.size,contentHash:z.contentHash})),D=await _w(a.map(z=>({path:z.path.slice(r.length+1),contentHash:z.contentHash})));return{componentKey:l,directory:r,directoryName:s,skillFilePath:n,name:m,description:v,modelRef:`${t}/${m}`,instructions:p.body.trim(),frontmatter:d,frontmatterRaw:p.frontmatter,..._!==void 0?{allowImplicitInvocation:_}:{},mcpToolDependencies:T,supportingFiles:x,contentHash:o,aggregateHash:D}}var bw=["app_id","appId","id"],P2=["server","mcp_server","mcpServer","serverKey"];function zl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Lm(e){for(const t of bw){const r=e[t];if(typeof r=="string"&&r.length>0)return{appId:r,appIdKey:t}}}function x2(e,{sourcePath:t,serverKeys:r,contentHash:s,issues:n,maxApps:i}){if(!zl(e))return n.error("APP_INVALID_CONFIG",'"apps" must be an object',{path:t}),null;const o=Object.entries(e);if(o.length>i)return n.error("APP_INVALID_CONFIG",`"apps" declares ${o.length} apps; the limit is ${i}`,{path:t}),null;const a=[];for(const[c,l]of o){const u=`app:${t}#${c}`,p=zl(l)?Lm(l):void 0;if(!zl(l)||p===void 0){n.warn("APP_MISSING_ID",`app "${c}" has no app id; ignored`,{path:t,componentKey:u});continue}const{[p.appIdKey]:d,...h}=l,f=r.includes(c);a.push({componentKey:u,appId:p.appId,sourcePath:t,appKey:c,...f?{serverKey:c}:{},binding:"registered",status:f?"bound":"unresolved",contentHash:s,extensions:Gu(h,{issues:n,secretCode:"APP_SECRET_FIELD_OMITTED",label:`app "${c}"`,context:{path:t,componentKey:u}})})}return a}function O2(e){const{sourcePath:t,raw:r,issues:s}=e,n={path:t,componentKey:`app:${t}`};if(!zl(r))return s.error("APP_INVALID_CONFIG","app configuration must be a JSON object",n),null;if(r.apps!==void 0&&Lm(r)===void 0)return x2(r.apps,e);const i=M2(r,e);return i===null?null:[i]}function M2(e,{sourcePath:t,serverKeys:r,contentHash:s,issues:n}){const i=`app:${t}`,o={path:t,componentKey:i},{appId:a,appIdKey:c}=Lm(e)??{};if(a===void 0)return n.error("APP_MISSING_ID",`app configuration is missing an app id (${bw.join(", ")})`,o),null;let l,u;for(const h of P2){const f=e[h];if(typeof f=="string"&&f.length>0){l=f,u=h;break}}const p={};for(const[h,f]of Object.entries(e))h===c||h===u||(p[h]=f);const d=Gu(p,{issues:n,secretCode:"APP_SECRET_FIELD_OMITTED",label:`app "${a}"`,context:o});return l!==void 0?r.includes(l)?{componentKey:i,appId:a,sourcePath:t,serverKey:l,binding:"declared",status:"bound",contentHash:s,extensions:d}:(n.warn("APP_UNKNOWN_SERVER",`app "${a}" references MCP server "${l}" which is not in the bundle`,o),{componentKey:i,appId:a,sourcePath:t,binding:"unbound",status:"needs_server_binding",contentHash:s,extensions:d}):r.length===1?{componentKey:i,appId:a,sourcePath:t,serverKey:r[0],binding:"inferred",status:"bound",contentHash:s,extensions:d}:{componentKey:i,appId:a,sourcePath:t,binding:"unbound",status:"needs_server_binding",contentHash:s,extensions:d}}var L2=["registrationUrl","authorizationUrl","tokenUrl","authorizationServerBase","resource","oidcConfigurationUrl","oidcUserinfoEndpoint"],N2=["baseScopes","defaultScopes","oidcScopesSupported"],$2=["none","client_secret_basic","client_secret_post","private_key_jwt"],Uh=(e,t)=>e.some(r=>r===t),D2=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,wr=class extends Error{};function Fl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var np=3;function uc(e,t){const r=(n,i,o)=>{if(i.length===0)return;const a=i.slice(0,np).map(l=>Vu(l)?"(redacted)":`"${l.slice(0,64)}"`).join(", "),c=i.length>np?` and ${i.length-np} more`:"";t.issues.warn(n,i.length===1?`server "${t.serverKey}": auth field ${a} ${o[0]}`:`server "${t.serverKey}": auth fields ${a}${c} ${o[1]}`,{componentKey:t.componentKey})},s=n=>oc.test(n);r("MCP_SECRET_FIELD_OMITTED",e.filter(s),["looks secret-bearing and is not stored","look secret-bearing and are not stored"]),r("MCP_UNKNOWN_FIELD",e.filter(n=>!s(n)),["is not supported; ignored","are not supported; ignored"])}function U2(e,t,r){let s;try{s=typeof t=="string"?new URL(t):void 0}catch{s=void 0}const n=s?.protocol==="https:"||s?.protocol==="http:"&&SS(s.hostname);if(typeof t!="string"||s===void 0||!n||Sm(t))throw new wr(`auth.${e} must be an absolute https:// URL (or a loopback http:// one) without credentials, a fragment, whitespace or backslashes`);if(wm(s))throw new wr(`auth.${e} looks like it carries a credential, which a plugin must not ship`);return s.protocol==="http:"&&r.issues.warn("MCP_INSECURE_URL_LOCALHOST",`server "${r.serverKey}": auth.${e} is a plain-HTTP loopback URL, which only works in local development`,{componentKey:r.componentKey}),t}function q2(e,t){if(!Fl(e))throw new wr("auth.client must be an object");const{mode:r,clientId:s,tokenEndpointAuthMethod:n,...i}=e;if(r==="dcr"||r==="cimd")return uc([...Object.keys(i),...s!==void 0?["clientId"]:[],...n!==void 0?["tokenEndpointAuthMethod"]:[]],t),{mode:r};if(uc(Object.keys(i),t),r!=="provided")throw new wr('auth.client.mode must be "provided", "dcr" or "cimd"');if(typeof s!="string"||s.length===0)throw new wr('a "provided" client needs auth.client.clientId');if(n===void 0)return{mode:r,clientId:s};if(!Uh($2,n))throw new wr("auth.client.tokenEndpointAuthMethod is not supported");return{mode:r,clientId:s,tokenEndpointAuthMethod:n}}function z2(e,t){const r={},s=[];for(const[n,i]of Object.entries(e))if(n!=="type")if(n==="client")r.client=q2(i,t);else if(Uh(L2,n))r[n]=U2(n,i,t);else if(Uh(N2,n)){if(!Array.isArray(i)||i.some(o=>typeof o!="string"))throw new wr(`auth.${n} must be an array of strings`);r[n]=i.map(String)}else if(n==="oidcEnabled"){if(typeof i!="boolean")throw new wr("auth.oidcEnabled must be a boolean");r.oidcEnabled=i}else s.push(n);return uc(s,t),r}function F2(e,t){const{type:r,headerScheme:s,headerName:n,...i}=e,o=s==="bearer"||s==="basic";if(uc([...Object.keys(i),...o&&n!==void 0?["headerName"]:[]],t),o)return{type:"api_key",headerScheme:s};if(s!=="custom_header")throw new wr('auth.headerScheme must be "bearer", "basic" or "custom_header"');if(typeof n!="string"||!D2.test(n)||n.toLowerCase()==="host")throw new wr("a custom_header API key needs a valid auth.headerName other than Host");return{type:"api_key",headerScheme:s,headerName:n}}function j2(e,t){const r=Fl(e)?e[es]:void 0,s=Fl(r)?r.auth:void 0;if(s===void 0)return{};try{if(!Fl(s))throw new wr("auth must be an object");switch(s.type){case"none":return uc(Object.keys(s).filter(n=>n!=="type"),t),{auth:{type:"none"}};case"oauth":case"mixed":return{auth:{type:s.type,...z2(s,t)}};case"api_key":return{auth:F2(s,t)};default:throw new wr('auth.type must be "none", "oauth", "mixed" or "api_key"')}}catch(n){if(!(n instanceof wr))throw n;return{error:n.message}}}function H2(e){return e.headerScheme==="custom_header"?e.headerName:"Authorization"}function B2(e,t){const r=H2(t);return[...e.filter(s=>s.name.toLowerCase()!==r.toLowerCase()),{name:r,secret:!0,scheme:t.headerScheme}].sort((s,n)=>s.name<n.name?-1:s.name>n.name?1:0)}var qh=Object.freeze({"1.0.0":"https://agent-plugins.org/schemas/1.0.0/mcp.schema.json"}),Sw="${PLUGIN_ROOT}",V2="${PLUGIN_DATA}",G2=[Sw,V2];function W2(e){return G2.some(t=>e.includes(t))}var m_=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,K2=new Set(["type","command","args","env","cwd"]),J2=new Set(["type","url","headers","oauth","authentication"]);function Y2(e,t="server"){if(e===null||typeof e!="object"||Array.isArray(e))return{ok:!1,code:"MCP_INVALID_SERVER",message:`server "${t}": configuration must be an object`};const r=e,s=r.type??r.transport;if(s!==void 0){if(typeof s!="string")return{ok:!1,code:"MCP_UNKNOWN_TRANSPORT",message:`server "${t}": transport must be a string`};const o=s.toLowerCase().replace(/[\s_-]/g,"");return o==="stdio"?{ok:!0,transport:"stdio"}:o==="http"||o==="sse"||o==="streamablehttp"?{ok:!0,transport:"http"}:{ok:!1,code:"MCP_UNKNOWN_TRANSPORT",message:`server "${t}": unknown transport "${s}"`}}const n=r.command!==void 0,i=r.url!==void 0;return n&&i?{ok:!1,code:"MCP_AMBIGUOUS_TRANSPORT",message:`server "${t}": declares both "command" and "url"`}:n?{ok:!0,transport:"stdio"}:i?{ok:!0,transport:"http"}:{ok:!1,code:"MCP_UNKNOWN_TRANSPORT",message:`server "${t}": declares neither "command" nor "url"`}}function X2(e,t,r,s){const n=r.type;return n==="stdio"||n==="streamable-http"||n==="sse"?n:(s.error("MCP_UNKNOWN_TRANSPORT",n===void 0?`server "${e}": missing required "type" (stdio | streamable-http | sse)`:`server "${e}": unknown transport "${String(n)}"`,{componentKey:t}),null)}function Z2(e,t,r,s,n){const i=`server:${e}`;if(r===null||typeof r!="object"||Array.isArray(r))return s.error("MCP_INVALID_SERVER",`server "${e}": configuration must be an object`,{componentKey:i}),null;const o=r,a=X2(e,i,o,s);if(a===null)return null;const c=a==="stdio"?K2:J2;for(const m of Object.keys(o))if(!c.has(m)&&!(n&&m==="extensions"))return s.error("MCP_UNKNOWN_FIELD",`server "${e}": field "${m}" is not part of the Agent Plugins ${a} entry schema`,{componentKey:i}),null;if(a==="stdio"){const m=o.command;if(typeof m!="string"||m.length===0)return s.error("MCP_MISSING_COMMAND",`server "${e}": stdio servers require a non-empty "command"`,{componentKey:i}),null;let v=m;if(W2(v))return s.error("MCP_PLACEHOLDER_IN_COMMAND",`server "${e}": placeholders are not expanded in "command"; use a "./" path or a bare command`,{componentKey:i}),null;if(v.startsWith("./")){const O=Pi("",v);if(!O.ok)return s.error(O.code,`server "${e}": ${O.message}`,{componentKey:i}),null;v=`${Sw}/${O.path}`}let _=[];if(o.args!==void 0){if(!Array.isArray(o.args)||o.args.some(O=>typeof O!="string"))return s.error("MCP_INVALID_SERVER",`server "${e}": "args" must be an array of strings`,{componentKey:i}),null;_=o.args}const b=DP(e,i,o.env,s);if(b===null)return null;let T;if(o.cwd!==void 0){const O=OP(o.cwd);if(!O.ok)return s.error(O.code,`server "${e}": ${O.message}`,{componentKey:i}),null;T=O.value}return{componentKey:i,key:e,sourcePath:t,config:{transport:"stdio",command:v,args:_,envRequirements:b,...T!==void 0?{workingDirectory:T}:{}}}}const l=o.url;if(typeof l!="string"||l.length===0)return s.error("MCP_MISSING_URL",`server "${e}": ${a} servers require a non-empty "url"`,{componentKey:i}),null;const u=xP(l);if(!u.ok)return s.error(u.code,`server "${e}": ${u.message}`,{componentKey:i}),null;u.loopbackHttp&&s.warn("MCP_INSECURE_URL_LOCALHOST",`server "${e}": plain-HTTP loopback URL only works in local development`,{componentKey:i});const p=UP(e,i,o.headers,s);if(p===null)return null;const d=o.oauth!==void 0||o.authentication!==void 0?qP(e,i,o,s):void 0,h=j2(n?o.extensions:void 0,{serverKey:e,componentKey:i,issues:s});if(h.error!==void 0)return s.error("MCP_INVALID_SERVER",`server "${e}": ${h.error}`,{componentKey:i}),null;const f=h.auth;return{componentKey:i,key:e,sourcePath:t,config:{transport:"http",httpVariant:a,url:l,headerRequirements:f?.type==="api_key"?B2(p,f):p,...d!==void 0?{oauth:d}:{},...f!==void 0?{auth:f}:{}}}}function Q2(e){if(e===null||typeof e!="object"||Array.isArray(e))return{ok:!1,code:"MCP_INVALID_CONFIG",reason:"document-not-an-object",message:"MCP configuration must be a JSON object"};const t=e,r=t.mcp_servers!==void 0,s=t.mcpServers!==void 0;if(r&&s)return{ok:!1,code:"MCP_DUPLICATE_WRAPPER",reason:"duplicate-wrapper",message:'configuration declares both "mcp_servers" and "mcpServers"'};let n=null,i=t;if(r)n="mcp_servers",i=t.mcp_servers;else if(s)n="mcpServers",i=t.mcpServers;else if(typeof t.command=="string"||typeof t.url=="string")return{ok:!1,code:"MCP_INVALID_CONFIG",reason:"bare-server-config",message:"expected a map of server name to configuration"};return i===null||typeof i!="object"||Array.isArray(i)?{ok:!1,code:"MCP_INVALID_CONFIG",reason:"server-map-not-an-object",message:"server map must be a JSON object"}:{ok:!0,wrapperKey:n,servers:Object.entries(i).map(([o,a])=>({key:o,config:a}))}}function eL(e,t){const{sourcePath:r,manifestSchemaVersion:s,issues:n,maxServers:i}=t,o=(m,v)=>(n.warn(m,v,{path:r}),n.warn("COMPONENT_SKIPPED",`MCP servers are disabled for this bundle: ${v}`,{path:r}),{servers:[],skipped:[{kind:"mcp-config",key:r,reason:v}],documentVersion:null});if(e===null||typeof e!="object"||Array.isArray(e))return o("MCP_INVALID_CONFIG","mcp.json must be a JSON object");const a=e,c=a.$schema,l=typeof c=="string"?Object.keys(qh).find(m=>qh[m]===c):void 0;if(l===void 0)return o("MCP_UNSUPPORTED_SCHEMA",c===void 0?'mcp.json is missing the required "$schema" field':`mcp.json "$schema" is not a supported Agent Plugins schema: ${String(c)}`);if(l!==s)return o("MCP_UNSUPPORTED_SCHEMA",`mcp.json targets Agent Plugins ${l} but plugin.json targets ${s}; versions must match`);for(const m of Object.keys(a))if(m!=="$schema"&&m!=="mcpServers")return o("MCP_INVALID_CONFIG",`mcp.json field "${m}" is not part of the Agent Plugins schema`);const u=a.mcpServers;if(u==null||typeof u!="object"||Array.isArray(u))return o("MCP_INVALID_CONFIG",'mcp.json requires an "mcpServers" object');const p=Object.keys(u);if(i!==void 0&&p.length>i)return n.error("MCP_TOO_MANY_SERVERS",`mcp.json declares ${p.length} MCP servers; the limit is ${i}`,{path:r}),{servers:[],skipped:[],documentVersion:l};const d=[],h=[],f=(m,v)=>{const _=v.firstErrorMessage()??"invalid server entry";n.absorbDemoted(v),n.warn("COMPONENT_SKIPPED",`server "${m}" was skipped: ${_}`,{path:r,componentKey:`server:${m}`}),h.push({kind:"server",key:m,reason:_})};for(const[m,v]of Object.entries(u)){const _=new ii;if(!m_.test(m)){_.error("MCP_INVALID_SERVER_NAME",`server name "${m}" must match ${m_}`,{path:r}),f(m,_);continue}const b=Z2(m,r,v,_,t.entryExtensions===!0);if(b===null||_.hasErrors()){f(m,_);continue}n.absorbDemoted(_),d.push(b)}return{servers:d,skipped:h,documentVersion:l}}var g_=new Set(["command","args","env","cwd"]),v_=new Set(["url","headers"]),tL=new Set(["oauth","authentication"]),rL=new Set(["type","transport","enabled","disabled"]),sL=[["${CLAUDE_PLUGIN_ROOT}","${PLUGIN_ROOT}"],["${CLAUDE_PLUGIN_DATA}","${PLUGIN_DATA}"]];function Nm(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ol(e){return sL.reduce((t,[r,s])=>t.split(r).join(s),e)}function nL(e){const t=[],r=s=>{for(const n of s)typeof n=="string"&&t.push(n)};for(const s of Object.values(e))typeof s=="string"?t.push(s):Array.isArray(s)?r(s):Nm(s)&&r(Object.values(s));return t}function iL(e){if(typeof e.command=="string"){const t=ol(e.command);e.command=t.startsWith("${PLUGIN_ROOT}/")?`./${t.slice(15)}`:t}if(Array.isArray(e.args)&&(e.args=e.args.map(t=>typeof t=="string"?ol(t):t)),Nm(e.env)&&(e.env=Object.fromEntries(Object.entries(e.env).map(([t,r])=>[t,typeof r=="string"?ol(r):r]))),typeof e.cwd=="string"){const t=ol(e.cwd),r=!/^(?:\.\/|\/|\$\{|~)/.test(t);e.cwd=t==="."?"./":r?`./${t}`:t}}function oL(e,t,r){if(!Nm(t))return{entry:t};if(t.disabled===!0||t.enabled===!1)return{reason:"it is disabled in its configuration"};const s=Y2(t,e);if(!s.ok)return{reason:s.message};const n=String(t.type??t.transport??""),i=s.transport==="stdio"?"stdio":n.toLowerCase()==="sse"?"sse":"streamable-http",o=i==="stdio"?g_:v_,a=i==="stdio"?v_:g_,c={type:i};for(const[l,u]of Object.entries(t))if(!rL.has(l)){if(a.has(l))return{reason:`it declares "${l}", which a ${i} server does not take`};if(o.has(l)||l==="extensions"||i!=="stdio"&&tL.has(l)){c[l]=u;continue}r.warn("MCP_UNKNOWN_FIELD",`server "${e}": field "${l}" is not supported; ignored`,{componentKey:`server:${e}`})}return nL(c).some(l=>l.includes("${user_config."))?{reason:"it uses ${user_config.*} placeholders, which MCPJam does not fill in"}:(i==="stdio"&&iL(c),{entry:c})}function aL(e,t){const{sourcePath:r,issues:s,maxServers:n}=t,i=Q2(e);if(!i.ok)return{ok:!1,code:i.code,reason:i.message};const o=l=>({$schema:qh["1.0.0"],mcpServers:Object.fromEntries(l)});if(i.servers.length>n)return s.error("MCP_TOO_MANY_SERVERS",`${r} declares ${i.servers.length} MCP servers; the limit is ${n}`,{path:r}),{ok:!0,document:o([]),skipped:[]};const a=[],c=[];for(const{key:l,config:u}of i.servers){const p=oL(l,u,s);if("entry"in p){a.push([l,p.entry]);continue}const d=`server "${l}" was skipped: ${p.reason}`;s.warn("COMPONENT_SKIPPED",d,{path:r,componentKey:`server:${l}`}),c.push({kind:"server",key:l,reason:p.reason})}return{ok:!0,document:o(a),skipped:c}}var cL="mcp.json";var lL={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",svg:"image/svg+xml",webp:"image/webp",ico:"image/x-icon",bmp:"image/bmp",pdf:"application/pdf",md:"text/markdown",txt:"text/plain",json:"application/json",yaml:"application/x-yaml",yml:"application/x-yaml"};function ww(e){const t=e.slice(e.lastIndexOf("/")+1),r=t.lastIndexOf(".");return r<=0?"":t.slice(r+1).toLowerCase()}function uL(e){return lL[ww(e)]??"application/octet-stream"}function dL(e){if(e.length>=4&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71)return"png";if(e.length>=3&&e[0]===255&&e[1]===216)return"jpeg";if(e.length>=4&&e[0]===71&&e[1]===73&&e[2]===70&&e[3]===56)return"gif";if(e.length>=12&&e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80)return"webp";try{if(new TextDecoder("utf-8",{fatal:!0}).decode(e.slice(0,512)).includes("<svg"))return"svg"}catch{}return null}var pL={png:"png",jpg:"jpeg",jpeg:"jpeg",gif:"gif",webp:"webp",svg:"svg"};function kw(e,t){try{return new TextDecoder("utf-8",{fatal:!0}).decode(e.bytes)}catch{return t.error("FILE_INVALID_UTF8","file is not valid UTF-8 text",{path:e.path}),null}}function ip(e,t,r){const s=kw(e,t);if(s===null)return null;let n;try{n=JSON.parse(s)}catch{return t.error(r,"file is not valid JSON",{path:e.path}),null}return n===null?(t.error(r,"file must contain a JSON object",{path:e.path}),null):n}function hL(e){const t=e.extensions[Qn];return t!==null&&typeof t=="object"&&!Array.isArray(t)&&typeof t.logo=="string"}async function BG(e,t){const r={...ex,...t?.limits},s=new ii,n=t?.profile??"strict",i=await e.list(),o=RP(i,r,s);s.throwIfErrors(),o.length===0&&(s.error("BUNDLE_EMPTY","bundle contains no files"),s.throwIfErrors());const a=new Set(o.map(({path:I})=>I)),c=b2(a,n);k2(c,n,s);const l=c.manifest;if(l===void 0||s.hasErrors())throw new wh(s.issues());const u=o.flatMap(I=>{const ee=S2(c.directory,I.path);return ee===void 0?[]:[{...I,path:ee}]}),p=[],d=new Map;for(const I of u){let ee;try{ee=await e.readBytes(I.sourcePath,r.maxFileBytes)}catch(he){s.error("FILE_UNREADABLE",`file could not be read: ${he instanceof Error?he.message:String(he)}`,{path:I.path});continue}if(ee.byteLength>r.maxFileBytes){s.error("FILE_TOO_LARGE",`file exceeds the per-file limit of ${r.maxFileBytes} bytes`,{path:I.path});continue}if(ee.byteLength!==I.size){s.error("FILE_SIZE_MISMATCH",`declared size ${I.size} does not match actual size ${ee.byteLength}`,{path:I.path});continue}const oe={...I,bytes:ee,contentHash:await v2(ee)};p.push(oe),d.set(oe.path,oe)}s.throwIfErrors();const h=await _w(p.map(I=>({path:I.path,contentHash:I.contentHash}))),f=p.filter(I=>I.executable).map(I=>I.path),m=new Set(d.keys()),v=ax({profile:n,location:l,filePaths:m,readJson:(I,ee)=>{const oe=d.get(I);return oe===void 0?null:ip(oe,ee,"MANIFEST_INVALID_JSON")},issues:s}),_=c.directory===""?v.interpretation:{...v.interpretation,rootDirectory:c.directory},b=d.get(_.manifestPath),{manifest:T,onboardingSkill:O}=v.record===null||b===void 0?{manifest:null}:YP(v.record,{filePaths:m,issues:s,profile:n});if(T===null||b===void 0)throw new wh(s.issues());const x=b.contentHash;s.throwIfErrors();const D=[],z=[];for(const I of p){if(!I.path.startsWith("skills/"))continue;const ee=I.path.slice(h_.length+1).split("/");ee.length===2&&ee[1]==="SKILL.md"&&!z.includes(ee[0])&&z.push(ee[0])}z.sort(),z.length>r.maxSkills&&(s.error("SKILL_TOO_MANY",`bundle declares ${z.length} skills; the limit is ${r.maxSkills}`),s.throwIfErrors());const F=(I,ee)=>{const oe=ee.firstErrorMessage()??"invalid skill";s.absorbDemoted(ee),s.warn("COMPONENT_SKIPPED",`skill "${I}" was skipped: ${oe}`,{componentKey:`skill:${I}`}),D.push({kind:"skill",key:I,reason:oe})},J=[],ce=new Map;for(const I of z){const ee=`${h_}/${I}`,oe=`${ee}/${E2}`,he=d.get(oe);if(he===void 0)continue;const ue=new ii,Ge=kw(he,ue);if(Ge===null){F(I,ue);continue}const Ve=p.filter(pe=>Wc(ee,pe.path)),Ce=await C2({pluginName:T.name,directory:ee,directoryName:I,skillFilePath:oe,skillText:Ge,skillContentHash:he.contentHash,files:Ve.map(pe=>({path:pe.path,size:pe.size,contentHash:pe.contentHash})),issues:ue});if(Ce===null||ue.hasErrors()){F(I,ue);continue}s.absorbDemoted(ue);const B=ce.get(Ce.name);if(B!==void 0){const pe=new ii;pe.error("SKILL_DUPLICATE_NAME",`skill name "${Ce.name}" is declared by both "${B}" and "${Ce.directory}"`,{path:Ce.skillFilePath,componentKey:Ce.componentKey}),F(I,pe);continue}ce.set(Ce.name,Ce.directory),J.push(Ce)}QP(T,O,J,s);const de=[],R=v.legacyMcp,fe=_.layout==="agent-plugins"?d.get(cL):R?.kind==="file"?d.get(R.path):void 0;v.skipped!==void 0&&D.push(v.skipped);for(const I of p){const ee=`/${I.path}`.endsWith("/mcp.json")&&!Wc("skills",I.path)||_.layout!=="agent-plugins"&&I.path===".mcp.json";I!==fe&&ee&&s.warn("MCP_CONFIG_IGNORED",`"${I.path}" is not this bundle's MCP configuration; ignored`,{path:I.path})}const Y=fe?.path??R?.path;if(Y!==void 0){const I=new ii;let ee=fe!==void 0?ip(fe,I,"MCP_INVALID_CONFIG"):R?.kind==="inline"?R.document:null;if(ee!==null&&R!==void 0){const oe=aL(ee,{sourcePath:Y,issues:s,maxServers:r.maxMcpServers});oe.ok?D.push(...oe.skipped):I.error(oe.code,oe.reason,{path:Y}),ee=oe.ok?oe.document:null}if(ee===null){const oe=I.firstErrorMessage()??"invalid mcp.json";s.absorbDemoted(I),s.warn("COMPONENT_SKIPPED",`MCP servers are disabled for this bundle: ${oe}`,{path:Y}),D.push({kind:"mcp-config",key:Y,reason:oe})}else{const oe=eL(ee,{sourcePath:Y,manifestSchemaVersion:T.schemaVersion,issues:s,maxServers:r.maxMcpServers,entryExtensions:_.profile==="openai-compatible"});D.push(...oe.skipped);for(const he of oe.servers)de.push({...he,configHash:await vw(he.config)})}}const me=[],$=de.map(I=>I.key);for(const I of p){if(!I.path.endsWith(".app.json")||Wc("skills",I.path))continue;const ee=new ii,oe=ip(I,ee,"APP_INVALID_CONFIG"),he=oe===null?null:O2({sourcePath:I.path,raw:oe,serverKeys:$,contentHash:I.contentHash,issues:ee,maxApps:r.maxMcpServers}),ue=ee.firstErrorMessage();if(s.absorbDemoted(ee),he===null||ue!==void 0){s.warn("COMPONENT_SKIPPED",`apps in "${I.path}" were skipped: ${ue??"invalid app configuration"}`,{path:I.path}),D.push({kind:"app",key:I.path,reason:ue??"invalid app configuration"});continue}me.push(...he)}const le=[],y=new Set,Q=(I,ee,oe,he=!0)=>{if(y.has(I.path))return!0;const ue=ww(I.path),Ge=pL[ue];if(oe!==void 0&&Ge===void 0){const Ve=`manifest "${oe}" must reference an image file`;return he?s.error("ASSET_UNSUPPORTED_TYPE",Ve,{path:I.path}):s.warn("ASSET_UNSUPPORTED_TYPE",`${Ve}; ignored`,{path:I.path}),!1}if(Ge!==void 0&&dL(I.bytes)!==Ge){const Ve=`file extension ".${ue}" does not match its content`;if(oe!==void 0)return he?s.error("ASSET_CONTENT_MISMATCH",Ve,{path:I.path}):s.warn("ASSET_CONTENT_MISMATCH",`manifest "${oe}": ${Ve}; ignored`,{path:I.path}),!1;s.warn("ASSET_CONTENT_MISMATCH",Ve,{path:I.path})}return y.add(I.path),le.push({path:I.path,kind:ee,size:I.size,contentHash:I.contentHash,contentType:uL(I.path)}),!0};if(T.icon!==void 0){const I=d.get(T.icon);I!==void 0&&Q(I,"icon","icon")}const ne=hL(T);if(T.logo!==void 0){const I=d.get(T.logo);I!==void 0&&!Q(I,"logo","logo",ne)&&delete T.logo}for(const[I,ee]of[["logoDark","logo"],["composerIcon","icon"]]){const oe=T[I];if(oe===void 0)continue;const he=d.get(oe);he!==void 0&&!Q(he,ee,`interface.${I}`,!1)&&delete T[I]}for(const I of p)Wc("assets",I.path)&&Q(I,I.path.toLowerCase().includes("screenshot")?"screenshot":"other");const H=[];for(const I of de){if(I.config.transport==="stdio"){for(const ue of I.config.envRequirements)ue.valueTemplate!==void 0||ue.value!==void 0||H.push({kind:"env",componentKey:I.componentKey,serverKey:I.key,name:ue.name,required:ue.required});continue}for(const ue of I.config.headerRequirements)ue.value===void 0&&H.push({kind:"header",componentKey:I.componentKey,serverKey:I.key,name:ue.name,secret:ue.secret,...ue.scheme!==void 0?{scheme:ue.scheme}:{}});const{auth:ee,oauth:oe}=I.config,he=ee?.type==="oauth"||ee?.type==="mixed";(he||ee===void 0&&oe!==void 0)&&H.push({kind:"oauth",componentKey:I.componentKey,serverKey:I.key,...oe?.timing!==void 0?{timing:oe.timing}:{},...he?{required:ee.type==="oauth"}:{}})}return s.throwIfErrors(),{manifest:T,interpretation:_,schemaVersion:T.schemaVersion,bundleHash:h,executableFiles:f,executionDigest:await _2({bundleHash:h,executableFiles:f,profile:_.profile,revision:_.revision}),manifestHash:x,skills:J,mcpServers:de,apps:me,assets:le,skipped:D,setupRequirements:H,warnings:s.warnings()}}var VG=new TextDecoder("utf-8",{fatal:!1}),GG=new TextDecoder("utf-8",{fatal:!1}),WG=Object.freeze({"technical-preflight":["runtime-compatibility","tool-policy"],"submission-ready":["runtime-compatibility","tool-policy","submission-artifacts"]});function fL(e){return typeof e=="object"&&e!==null&&e.readinessKind==="muse-directory-readiness"}var mL="2026-10-07",gL="https://muse.ai/platform",vL=["docs","terms"],_L={docs:"60628e5a1c6199b8635a161b7f5a8aaa",terms:"98588b3844410fbd5ff3aca6b0000e23"},yL=vL.map(e=>({page:e,url:`${gL}/${e}`,revision:_L[e]??null,snapshotDate:mL})),KG=Object.freeze(Object.fromEntries(yL.map(e=>[e.page,e]))),bL=["read","write","sensitive-write"],SL=["setup-instructions","inputs-and-outputs","read-write-classifications","sensitive-designations","permissions","side-effects","status-handling","errors","rate-limits"],wL=["oauth","api-key","none","other"],kL=["test","production"],EL=["businessVerificationProvided","brandAssetsAuthorized","maintainerNamed","dataProcessingQuestionnaireCompleted","acceptsDeveloperTerms"],Ot=w(),JG=se({overview:se({intendedUsers:Ot.optional(),supportedTasks:te(Ot).optional(),browserImprovement:Ot.optional(),restrictions:Ot.optional()}).optional(),privacyPolicyUrl:Ot.optional(),termsUrl:Ot.optional(),supportContact:Ot.optional(),securityContact:Ot.optional(),documentationUrl:Ot.optional(),documentationCovers:te(ct(SL)).optional(),authentication:se({method:ct(wL),scopes:te(Ot).optional(),readOnlyScopes:te(Ot).optional(),readOnlyNotPossibleReason:Ot.optional(),credentialsEnvironment:ct(kL).optional()}).optional(),testAccount:se({signInInstructions:Ot.optional(),requiredPermissions:Ot.optional(),representativeTestData:Ot.optional(),limits:Ot.optional(),accessibleThroughoutReview:Ne().optional()}).optional(),transactions:se({hasTransactionTools:Ne(),noChargeTestPath:Ot.optional()}).optional(),toolClassifications:Qe(Ot,ct(bL)).optional(),attestations:pS(ct(EL),Ne()).optional()}),TL=new Set(["access_token","refresh_token","id_token","client_secret","code","code_verifier","authorization_code","authorization","state","cookie","set_cookie","api_key"]),AL=[/^authorization$/i,/^proxy-authorization$/i,/^cookie$/i,/^set-cookie$/i,/^x-api-key$/i,/^api-key$/i,/^apikey$/i,/^x-auth-token$/i,/^x-csrf-token$/i,/^x-session-token$/i,/^x-access-token$/i,/^x-refresh-token$/i,/^x-client-secret$/i,/^x-credential$/i];function $m(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[^a-zA-Z0-9]+/g,"_").toLowerCase()}var IL=["_type","_types","_endpoint","_endpoints","_supported","_method","_methods","_uri","_uris","_url","_urls","_alg","_algs","_values","_in"];function RL(e){return IL.some(t=>e.endsWith(t))}function Dm(e){return TL.has(e)?!0:RL(e)?!1:/(^|_)(token|secret|password|credential|cookie|auth)(_|$)/.test(e)||/(^|_)api_?key(_|$)/.test(e)}function CL(e){return Dm($m(e))}function PL(e){return Dm($m(e))||AL.some(t=>t.test(e))}function xL(e){return Dm($m(e))}function Um(e){return typeof e!="string"||e.length<=8?"[redacted]":`${e.slice(0,4)}...[redacted]...${e.slice(-2)}`}var Ew="client_secret|access_token|refresh_token|id_token|code_verifier|code|assertion|password|api[-_]?key|token|secret|state",Tw=new RegExp(`(^|[^\\w-])((?:[\\w-]*[_-])?(?:${Ew}))=[^&\\s"'<>]+`,"gi"),Aw=`(?:(?:[\\w-]*[_-])?(?:${Ew}))`,OL=new RegExp(`("${Aw}"\\s*:\\s*)"(?:\\\\.|[^"\\\\])*"`,"gi"),ML=new RegExp(`("${Aw}"\\s*:\\s*)"(?:\\\\[\\s\\S]?|[^"\\\\])*$`,"gi");var LL=new RegExp(`\\b((?:[\\w-]*[_-])?(?:client[-_]?secret|access[-_]?token|refresh[-_]?token|id[-_]?token|code[-_]?verifier))(\\s*[:=]\\s*)("(?:\\\\.|[^"\\\\])*"|[^&\\s"'<>,;]+)`,"gi");function Iw(e){const t=e.replace(/[.,;:!?)\]}]+$/,"");return!/^[a-z]{1,20}$/.test(t)}function NL(e,t,r,s){return Iw(s)?`${t}${r}[redacted]`:e}function In(e,t={}){const r=t.maxScanned??4e3,s=t.maxLength??500,n=e.length>r,i=(n?e.slice(0,r):e).replace(/([a-z][a-z0-9+.-]*:\/\/)[^\s/?#]*@/gi,"$1[redacted]@").replace(/(^|[\s(<"'])[^\s/@:]+:[^\s/]+@(?=[\w.-]+)/g,"$1[redacted]@").replace(LL,(o,a,c,l)=>`${a}${c}${l.startsWith('"')?'"[redacted]"':"[redacted]"}`).replace(Tw,"$1$2=[redacted]").replace(/\b((?:proxy-)?authorization\s*[:=]\s*)(bearer|basic)\s+\S+/gi,"$1$2 [redacted]").replace(/\b(bearer|basic)(\s+)(\S+)/gi,NL).replace(OL,'$1"[redacted]"');return(n?i.replace(ML,'$1"[redacted]').replace(/([a-z][a-z0-9+.-]*:\/\/)[^\s/?#]*$/gi,"$1[redacted]"):i).slice(0,s)}function $L(e){if(!e)return;if(typeof e=="string"){const r=e.trim();if(!r)return;if(r.startsWith("{")&&r.endsWith("}")||r.startsWith("[")&&r.endsWith("]"))try{const i=JSON.parse(r);if(typeof i=="object"&&i!==null&&!Array.isArray(i)){const o=Object.entries(i).flatMap(([a,c])=>typeof c=="string"?[[a,c]]:typeof c=="number"||typeof c=="boolean"?[[a,String(c)]]:[]);return o.length>0?Object.fromEntries(o):void 0}}catch{}const s=new URLSearchParams(r),n=Object.fromEntries(s.entries());return Object.keys(n).length>0?n:void 0}if(typeof e!="object"||e===null||Array.isArray(e))return;const t=Object.entries(e).flatMap(([r,s])=>typeof s=="string"?[[r,s]]:typeof s=="number"||typeof s=="boolean"?[[r,String(s)]]:[]);return t.length>0?Object.fromEntries(t):void 0}function DL(e){return Object.keys(e).every(t=>t.length<=64&&/^[A-Za-z0-9_.\-[\]]+$/.test(t))}var UL=3;function qL(e,t){return/^https?:\/\//i.test(e)?t>=UL?"[redacted]":qm(e,t+1):e.replace(Tw,"$1$2=[redacted]")}function qm(e,t=0){try{const r=new URL(e);r.username="",r.password="";let s=!1;const n=new URLSearchParams;for(const[i,o]of r.searchParams.entries()){const a=xL(i)?"[redacted]":qL(o,t);s||=a!==o,n.append(i,a)}return s&&(r.search=n.toString()),r.hash&&(r.hash="#[redacted]"),r.toString()}catch{return In(e)}}function Rw(e){const t=e.trim();if(!t)return e;if(/^https?:\/\//i.test(t))return qm(t);if(t.includes("=")||t.includes("&")||t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]")){const r=$L(t);if(r&&DL(r))return bs(r)}return In(t)}function bs(e){return Array.isArray(e)?e.map(t=>bs(t)):typeof e=="string"?Rw(e):!e||typeof e!="object"?e:Object.fromEntries(Object.entries(e).map(([t,r])=>CL(t)?[t,Um(r)]:[t,bs(r)]))}function zL(e){const t=Rw(e);return typeof t=="string"?t:Um(e)}function __(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>PL(t)?[t,Um(r)]:[t,zL(r)]))}function YG(e){const t=typeof e.callbackState=="string"&&e.callbackState.length>0;return e.issuedState?{statePresent:t,stateMatched:t&&e.callbackState===e.issuedState}:{statePresent:t}}function Cw(e){return zh(e,[])}function zh(e,t){return Array.isArray(e)?e.map(r=>zh(r,t)):!e||typeof e!="object"?typeof e=="string"?FL(e):e:Object.fromEntries(Object.entries(e).map(([r,s])=>[r,HL(r,s,t)?"[REDACTED]":zh(s,[...t,r])]))}function FL(e){return e.replace(/\b(authorization|proxy-authorization|cookie|set-cookie)\s*:\s*[^\r\n]*/giu,(t,r)=>`${r}: [REDACTED]`).replace(/\bBearer(\s+)(\S+)/giu,jL).replace(/\b(access_token|refresh_token|client_secret|id_token|code|code_verifier|accessToken|refreshToken|clientSecret|idToken|codeVerifier)=([^&\s]+)/giu,"$1=[REDACTED]").replace(/(["']?(?:access_token|refresh_token|client_secret|id_token|code|code_verifier|accessToken|refreshToken|clientSecret|idToken|codeVerifier)["']?\s*:\s*["'])[^"']*(["'])/giu,"$1[REDACTED]$2")}function jL(e,t,r){return/^[A-Za-z_][A-Za-z0-9_-]*=/u.test(r)?e:Iw(r)?`Bearer${t}[REDACTED]`:e}function HL(e,t,r){const s=e.toLowerCase().replace(/[^a-z0-9]/gu,"");return s==="code"?VL(t,r):s==="authorization"||s==="proxyauthorization"||s==="cookie"||s==="setcookie"?!0:(s==="codeverifier"||s==="accesstoken"||s.endsWith("accesstoken")||s==="refreshtoken"||s.endsWith("refreshtoken")||s==="clientsecret"||s.endsWith("clientsecret")||s==="idtoken"||s.endsWith("idtoken"))&&BL(t)||s==="apikey"||s==="xapikey"}function BL(e){return typeof e=="string"&&e.length>0}function VL(e,t){return t[t.length-1]==="error"||t[t.length-1]==="snapshotError"||typeof e!="string"||/^[A-Z0-9_:-]+$/u.test(e)?!1:e.length>0}var Ir={ParseError:-32700,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,HeaderMismatch:-32020,MissingRequiredClientCapability:-32021,UnsupportedProtocolVersion:-32022,ResourceNotFound:-32602,ConnectionClosed:-32e3,RequestTimeout:-32001,UrlElicitationRequired:-32042},GL={HeaderMismatch:-32001,MissingRequiredClientCapability:-32003,UnsupportedProtocolVersion:-32004},WL="ERA_NEGOTIATION_FAILED";function KL(e){return!!e&&typeof e=="object"&&e.code===WL}function zm(e){const t=new Set;let r=e;for(;KL(r)&&!t.has(r);){t.add(r);const s=r.data,n=(s&&typeof s=="object"?s.cause:void 0)??r.cause;if(n===void 0||n===r)break;r=n}return r}function Pw(e,t){const r=new Set;let s=e;for(;s&&typeof s=="object"&&!r.has(s);){r.add(s);const n=t(s);if(n!==void 0)return n;s=s.cause}}function xw(e){return e?.constructor?.mcpBrand==="mcp.InsufficientScopeError"||e?.name==="InsufficientScopeError"}function JL(e){return Pw(e,t=>{if(!xw(t))return;const r=typeof t.requiredScope=="string"?t.requiredScope:void 0,s=t.resourceMetadataUrl;return{requiredScope:r,resourceMetadataUrl:typeof s=="string"?s:s instanceof URL||s&&typeof s=="object"&&typeof s.href=="string"?s.href:void 0,errorDescription:typeof t.errorDescription=="string"?t.errorDescription:void 0}})}function YL(e){if(!e||typeof e!="object")return;const{code:t,data:r}=e;if(typeof t=="number")return;const s=iS(r?.authChallenge);if(s?.source!=="http_401")return;const{effectiveAuth:n,...i}=s;return i}function XL(e){return Pw(e,t=>{const r=YL(t);if(r)return r;const s=iS(t?.authChallenge);if(s)return s;if(!xw(t))return;const n=JL(t);return{source:"http_403_insufficient_scope",error:"insufficient_scope",...n?.requiredScope?{requiredScope:n.requiredScope}:{},...n?.resourceMetadataUrl?{resourceMetadataUrl:n.resourceMetadataUrl}:{},...n?.errorDescription?{errorDescription:n.errorDescription}:{},facets:{challengeHeader:"bearer",hasResourceMetadata:n?.resourceMetadataUrl!==void 0,hasScope:n?.requiredScope!==void 0,hasErrorParams:n?.errorDescription!==void 0}}})}var ZL={"org/keys_required":"user_config","org/model_unconfigured":"user_config","org/runtime_unsupported":"user_config","org/scope_unresolved":"user_config","org/provider_auth_failed":"user_config","org/credential_missing":"user_config","org/model_not_allowed":"user_config","org/provider_unavailable":"ambiguous","org/key_policy_unavailable":"mcpjam"};function QL(e){return{"org/keys_required":e("org/keys_required","Organization provider required","This organization requires its own provider keys for AI features, so MCPJam-provided models and personal keys are disabled. Choose a model from an organization provider.",["The selected model is an MCPJam-provided (hosted) model, a personal key, or a local model, and the organization requires its own provider keys."],["Choose a model from an organization provider.","Organization admins can add a provider under Organization → AI providers."],"organization-provider-required","warning"),"org/model_unconfigured":e("org/model_unconfigured","Organization model not configured","This feature runs on the organization's default AI model, and none is set.",["The organization requires its own provider keys, and work nobody picks a model for (insights, findings, generation, simulated users) runs on its default AI model."],["Organization admins can choose one under Organization → AI providers → Default AI model.","Members: ask an organization admin to configure one."],"organization-model-not-configured","warning"),"org/runtime_unsupported":e("org/runtime_unsupported","Unavailable with organization keys","This feature can't run on the organization's providers yet, so it is unavailable while the organization requires its own keys.",["The feature, or the selected provider, has no organization-credential adapter yet (for example, it needs a local runtime or a shared gateway)."],["Choose a model from a directly connected cloud provider (OpenAI, Anthropic, Google, Azure, Bedrock, …).","Organization admins can turn off the organization-keys requirement to use MCPJam-provided models for this feature."],"organization-runtime-unsupported","warning"),"org/scope_unresolved":e("org/scope_unresolved","Organization could not be determined","MCPJam could not tell which organization this AI request belongs to, so it was not run.",["The project or resource is not in an organization, or the organization named by the request disagrees with the one that owns the data."],["Open the request from the organization's project and try again.","Contact support if this keeps happening."],"organization-scope-unresolved"),"org/key_policy_unavailable":e("org/key_policy_unavailable","Organization AI key policy unavailable","MCPJam could not read the organization's AI settings, so it refused the request rather than guess.",["A temporary failure reading the organization's AI-key policy."],["Try again in a moment."],"organization-ai-key-policy-unavailable","warning"),"org/provider_auth_failed":e("org/provider_auth_failed","Organization provider rejected the key","The organization's model provider rejected its API key (401/403).",["The organization's key for this provider is invalid, revoked, or for a different project or region."],["Organization admins can update the key under Organization → AI providers.","Members: ask an organization admin to update it."],"organization-provider-auth-failed"),"org/credential_missing":e("org/credential_missing","Organization provider missing","The organization provider this model is saved to run on is no longer available, or has no key.",["The organization connection was deleted, disabled or moved, or its API key was removed."],["Choose a model from an organization provider that is still connected.","Organization admins can add or reconnect the provider under Organization → AI providers."],"organization-provider-missing"),"org/model_not_allowed":e("org/model_not_allowed","Organization model not allowed","The organization provider this model runs on only allows certain models, and this model is not one of them.",["The organization's OpenRouter provider has a list of selected models that leaves this model out, or its Azure OpenAI provider has no deployment for it."],["Choose a model the organization provider allows.","Organization admins can change the provider's models under Organization → AI providers."],"organization-model-not-allowed"),"org/provider_unavailable":e("org/provider_unavailable","Organization provider unavailable","The organization's model provider is rate-limiting requests or temporarily failing.",["The organization's provider account hit a rate limit or quota.","The provider is having an outage."],["Try again shortly.","Check the provider's status page and the organization's limits on its dashboard."],"organization-provider-unavailable","warning")}}var al="Your own API key covers supported model inference. MCPJam features can still require credits; Swarm generation and persona turns always do, unless your organization uses its own keys for all AI features. Then they run on the organization's default AI model and its providers bill the tokens; MCPJam's fixed product fees still use credits.",e1="/troubleshooting/error-codes",y_={"generation/invalid_output":"ambiguous","jsonrpc/internal_error":"user_server","jsonrpc/invalid_response_format":"user_server","jsonrpc/parse_error":"ambiguous","jsonrpc/method_not_found":"ambiguous","jsonrpc/invalid_params":"ambiguous","jsonrpc/unsupported_protocol_version":"ambiguous","provider/invalid_tool_name":"ambiguous","oauth/well_known_unreachable":"ambiguous","transport/socket_hang_up":"ambiguous","transport/econnrefused":"user_config","transport/enotfound":"user_config","auth/http_401":"user_config","auth/http_403":"user_config","auth/missing_bearer":"user_config","auth/insufficient_scope":"user_config","auth/oauth_refresh_failed":"user_config","auth/consent_required":"user_config","oauth/invalid_client":"user_config","oauth/invalid_grant":"user_config","oauth/redirect_mismatch":"user_config","provider/auth_error":"user_config","provider/quota":"user_config","provider/mcpjam_limit":"user_config","provider/mcpjam_platform_budget":"user_config","account/suspended":"user_config","account/guest_input_too_large":"user_config","provider/mcpjam_limit_daily":"user_config","provider/mcpjam_limit_monthly":"user_config","provider/mcpjam_limit_insufficient":"user_config","provider/model_retired":"user_config","provider/fallback_prohibited":"ambiguous","server/rate_limited":"user_server","server/http_error":"user_server","transport/tls_untrusted":"user_server","jsonrpc/missing_required_client_capability":"user_config","jsonrpc/url_elicitation_required":"user_config","sdk/stateless_requires_http":"user_config","sdk/protocol_version_pin_unsupported":"user_config",...ZL,"sdk/not_yet_supported_in_stateless":"mcpjam","sdk/paginated_tool_header_discovery_unsupported":"mcpjam","provider/not_allowlisted":"mcpjam","oauth/no_bearer_challenge":"ambiguous","oauth/non_compliant_challenge":"user_server","auth/authorization_server_unreachable":"ambiguous","auth/proxy_rejected":"ambiguous","jsonrpc/connection_closed":"ambiguous","jsonrpc/request_timeout":"ambiguous","transport/etimedout":"ambiguous","transport/econnreset":"ambiguous","transport/eai_again":"ambiguous","transport/fetch_failed":"ambiguous","transport/undici":"ambiguous","jsonrpc/invalid_request":"ambiguous","jsonrpc/header_mismatch":"ambiguous","internal/unknown":"ambiguous","provider/empty_response":"ambiguous"};function we(e,t,r,s,n,i,o="error"){return{slug:e,title:t,oneLine:r,likelyCauses:s,nextSteps:n,docsAnchor:`${e1}#${i}`,severity:o,...y_[e]?{origin:y_[e]}:{}}}var Fh={"jsonrpc/parse_error":we("jsonrpc/parse_error","Parse error (-32700)","The MCP wire contained JSON the inspector could not parse as JSON-RPC.",["The server emitted invalid JSON on the response channel.","A proxy or middleware mangled the response body.","Server emitted log output on stdout instead of stderr (STDIO transport).","The inspector sent malformed JSON and the server returned a parse error."],["Check the server's stdout/stderr for unintended log output.","Use the inspector's Traffic Log to inspect the raw response."],"parse-error"),"jsonrpc/invalid_request":we("jsonrpc/invalid_request","Invalid request (-32600)","The server rejected the payload as not a well-formed JSON-RPC request.",["Client sent a request shape the server's MCP runtime does not accept.","Outdated server SDK that disagrees with the protocol version advertised."],["Verify the negotiated MCP protocol version.","Update the server's MCP SDK."],"invalid-request"),"jsonrpc/method_not_found":we("jsonrpc/method_not_found","Method not found (-32601)","The server does not implement the JSON-RPC method that was called.",["The server hasn't implemented the requested MCP method.","Client and server are on incompatible MCP protocol versions.","The capability you expected was not advertised in `initialize`."],["Check the server's advertised capabilities in the connection info.","Confirm the protocol version negotiated at `initialize`."],"method-not-found"),"jsonrpc/invalid_params":we("jsonrpc/invalid_params","Invalid params (-32602)","The server rejected the request parameters.",["Required field is missing from the call.","Field type does not match the tool's input schema.","Server-side validator is stricter than the published schema."],["Re-check the tool's input schema in the Tools tab.","Compare your call payload against the schema in the inspector."],"invalid-params"),"jsonrpc/internal_error":we("jsonrpc/internal_error","Internal error (-32603)","The server hit an unexpected error while handling the request.",["Unhandled exception inside the server's tool/resource/prompt handler.","Downstream dependency (database, API) failed during the call."],["Check the server's logs around the time of the error.","Retry the request once the server is healthy."],"internal-error"),"jsonrpc/invalid_response_format":we("jsonrpc/invalid_response_format","Invalid response format (-32603)","The server replied, but the result was not a valid MCP tool, resource, or prompt payload.",["The handler returned a string or custom object instead of the MCP result shape (usually `{ content: [...] }`)."],["Inspect the result in the Traffic Log and compare it to the MCP result shape.",'Return `{ content: [{ type: "text", text: "..." }] }` from the handler, or the matching resource/prompt result.'],"invalid-response-format"),"jsonrpc/connection_closed":we("jsonrpc/connection_closed","Connection closed (-32000)","The underlying transport closed before the response could be delivered.",["STDIO server process exited or crashed mid-request.","HTTP server dropped the streaming connection.","Network blip between the inspector and the server."],["Restart the server and reconnect.","Check the server logs for a crash or exit message."],"connection-closed"),"jsonrpc/request_timeout":we("jsonrpc/request_timeout","Request timed out (-32001)","The server did not respond within the configured request timeout.",["Server is overloaded or stuck on the operation.","Long-running tool call exceeds the inspector's per-request timeout.","Network latency between client and server."],["Increase the per-server request timeout in the Servers tab.","Use MCP `tasks/*` for operations that legitimately run long."],"request-timeout"),"jsonrpc/header_mismatch":we("jsonrpc/header_mismatch","Protocol header mismatch (-32020)","The server returned an `MCP-Protocol-Version` header that does not match what the client negotiated.",["Server is enforcing a different protocol version than the one negotiated at `initialize`.","A proxy stripped or rewrote the `MCP-Protocol-Version` header."],["Verify the server's protocol-version pinning in the connection settings.","If you set an explicit protocol version per server, ensure it matches what the server advertises."],"header-mismatch"),"jsonrpc/unsupported_protocol_version":we("jsonrpc/unsupported_protocol_version","Unsupported protocol version (-32022)","The server does not support any protocol version this inspector offered.",["Server pinned to a newer MCP draft your inspector build does not understand.","Server pinned to a legacy version this build dropped support for."],["Update the inspector to a newer build.","Check the supported versions list in the server's `server/discover` result (modern) or `initialize` response (legacy)."],"unsupported-protocol-version"),"jsonrpc/missing_required_client_capability":we("jsonrpc/missing_required_client_capability","Missing required client capability (-32021)","The server refused the request because the client did not advertise a capability the operation requires.",["A server-initiated input request (elicitation, sampling) needs a client capability MCPJam did not declare.","The connection advertised a capability set the server considers insufficient for this operation."],["Enable the required client capability in the connection's Client settings.","Check the server's documentation for which client capabilities it requires."],"missing-required-client-capability"),"jsonrpc/url_elicitation_required":we("jsonrpc/url_elicitation_required","URL elicitation required (-32042)","The server needs the user to visit an external URL to complete the operation.",["Server requested a URL elicitation (OAuth, payment, confirmation).","Operation cannot proceed until the user opens the URL in a browser."],["Open the elicited URL and complete the flow.","Re-issue the request after the external step completes."],"url-elicitation-required","warning"),"transport/econnrefused":we("transport/econnrefused","Connection refused","Nothing is listening on the host and port the server URL points at.",["Server isn't running.","Port number is wrong in the server URL.","Server is bound to a different interface (e.g. only `127.0.0.1` but you're connecting via the LAN IP)."],["Start the server.","Double-check the URL's host and port.","For Docker/containers, confirm the port is published to your host."],"econnrefused"),"transport/econnreset":we("transport/econnreset","Connection reset","The remote side closed the TCP connection abruptly.",["Server process crashed mid-request.","Intermediate proxy or load balancer dropped the connection.","Server hit an OS-level resource limit."],["Inspect the server logs for a crash.","Retry the request."],"econnreset"),"transport/etimedout":we("transport/etimedout","Connection timed out","The OS-level TCP connection attempt did not complete in time.",["Wrong host/port in the server URL.","Firewall is silently dropping packets.","Your network allows outbound traffic only through a proxy.","Server is overloaded and never accepted the connection."],["Verify the URL is reachable from your machine (e.g. `curl`).","Check firewall / VPN rules.","From the MCPJam CLI behind a corporate proxy, set `HTTPS_PROXY` to it, and list hosts that must connect directly in `NO_PROXY`."],"etimedout"),"transport/enotfound":we("transport/enotfound","Host not found","DNS lookup failed for the server's hostname.",["Hostname is misspelled in the URL.","DNS resolver is misconfigured.","You're offline."],["Confirm the hostname in the URL is correct.","Try resolving the host with `nslookup` or `dig`."],"enotfound"),"transport/eai_again":we("transport/eai_again","Temporary DNS failure","DNS resolution failed with a transient error.",["Local DNS resolver is overloaded or restarting.","Upstream DNS server is briefly unavailable."],["Wait a few seconds and retry.","Switch to a different DNS resolver if this persists."],"eai-again","warning"),"transport/undici":we("transport/undici","HTTP transport error","The underlying HTTP client (undici / fetch) reported a low-level transport failure.",["Server closed the connection mid-response.","TLS handshake failed.","Socket-level error during streaming."],["Inspect the Traffic Log for the failed request.","Verify the server's TLS certificate is valid."],"undici-transport-error"),"transport/fetch_failed":we("transport/fetch_failed","Fetch failed","The HTTP request never produced a response.",["Server is unreachable (offline, wrong URL, blocked by firewall).","TLS handshake failed (self-signed cert, expired cert).","Mixed-content block (HTTPS page calling HTTP endpoint in browser)."],["Open the URL in a browser to confirm it loads.","If self-signed, install the certificate or switch to a trusted one."],"fetch-failed"),"transport/socket_hang_up":we("transport/socket_hang_up","Socket hang up","The server closed the connection without sending a response.",["Server crashed or restarted during the request.","Reverse proxy timed the request out."],["Retry the request.","Check server-side logs for the crash."],"socket-hang-up"),"transport/tls_untrusted":we("transport/tls_untrusted","TLS certificate not trusted","The server presented a TLS certificate that Node.js could not verify, so no request reached it.",["The certificate comes from a private or corporate CA that Node.js does not trust.","The server does not send its intermediate certificates.","The certificate is self-signed, expired, or issued for a different hostname.","A TLS-inspecting proxy or antivirus replaces the server's certificate."],["Fix the certificate on the server: renew it, send the full chain, and match the hostname.","If the error suggests `--use-system-ca`, start the inspector with `NODE_OPTIONS=--use-system-ca` so Node.js trusts your system's CAs.","Or point Node.js at the CA file with `NODE_EXTRA_CA_CERTS=/path/to/ca.pem`."],"tls-certificate-not-trusted"),"auth/http_401":we("auth/http_401","Unauthorized (401)","The server requires authentication that wasn't provided or is no longer valid.",["Missing or expired bearer token.","OAuth access token expired and refresh failed.","Server changed its required authentication scheme."],["Re-authenticate using the Reconnect button on the server card.","If using OAuth, run through the OAuth flow again from Servers.","From the CLI, sign in with `mcpjam oauth login --url <server-url> --credentials-out <file>`, then retry with `--credentials-file <file>`."],"unauthorized-401"),"auth/http_403":we("auth/http_403","Forbidden (403)","You authenticated successfully but lack permission for the operation.",["OAuth scopes granted don't cover the requested operation.","Server-side ACL blocks this account."],["Re-run OAuth and request the additional scopes if the server allows.","Ask the server admin to grant the necessary permissions."],"forbidden-403"),"auth/oauth_refresh_failed":we("auth/oauth_refresh_failed","OAuth token refresh failed","An expired OAuth access token could not be refreshed.",["Refresh token was revoked.","Refresh token expired.","Server returned `invalid_grant` to the refresh attempt."],["Click Reconnect on the server card to run a fresh OAuth flow."],"oauth-refresh-failed"),"auth/consent_required":we("auth/consent_required","Sign-in required","This server needs your permission before it can connect.",["Reconnect ran without opening the sign-in prompt, so no OAuth token exists for this server yet."],["Click Reconnect and approve the request in the window that opens."],"consent-required","warning"),"auth/missing_bearer":we("auth/missing_bearer","Missing bearer token","The API call did not include the required `Authorization: Bearer ...` header.",["Inspector session expired.","Sign-in token failed to attach to the request."],["Refresh the page and sign in again."],"missing-bearer"),"auth/insufficient_scope":we("auth/insufficient_scope","Insufficient scope (403)","The server reported insufficient_scope: the grant does not cover this operation.",["The authorization did not request the scopes the server now requires.","The server added a scope requirement after the grant was issued."],["Re-authorize and grant the scopes the server names in its challenge."],"insufficient-scope"),"auth/authorization_server_unreachable":we("auth/authorization_server_unreachable","Authorization server unreachable","The stored token could not be refreshed because the authorization server was unreachable or did not return a usable response.",["The authorization server is down or slow.","The refresh request could not leave the network it was made from."],["Retry in a minute; if it persists, check the authorization server's status.","Reconnect the server to obtain a fresh token once the authorization server is reachable."],"authorization-server-unreachable","warning"),"auth/proxy_rejected":we("auth/proxy_rejected","HTML access rejection (403)","The response was HTTP 403 with an HTML content type and no authentication challenge; a proxy or firewall may be involved.",["An IP allowlist or WAF blocks the address the request came from.","A corporate proxy or SSO portal intercepted the request."],["Allow MCPJam's egress addresses (docs.mcpjam.com/hosted/network), or the address you connect from, on the server's firewall.","Open the server URL in a browser from the same network to see what answers."],"proxy-rejected"),"oauth/no_bearer_challenge":we("oauth/no_bearer_challenge","401 without a Bearer challenge","The response was HTTP 401 without a Bearer challenge. This response did not explain how to authorize.",["The server or an intermediary omitted a Bearer challenge.","The server expects a static API key and does not implement OAuth."],["Check OAuth discovery, including the well-known metadata fallback supported by newer MCP versions.","If the server expects an API key, configure it as a header on the server instead of OAuth."],"no-bearer-challenge"),"oauth/non_compliant_challenge":we("oauth/non_compliant_challenge","Bearer challenge on the wrong status","The response reported invalid_token with HTTP 403; MCP requires HTTP 401 for an invalid or expired token.",["The server maps every authorization failure to 403.","A gateway rewrites the server's 401 to 403."],["Re-authorize the server to replace the rejected token.","Report the status mismatch to the server author; invalid-token recovery expects HTTP 401."],"non-compliant-challenge","warning"),"oauth/invalid_grant":we("oauth/invalid_grant","OAuth: invalid grant","The OAuth server rejected the authorization code or refresh token.",["Authorization code was already redeemed.","Refresh token was revoked.","Authorization code expired (typical lifetime ~60s)."],["Start the OAuth flow again from the server card."],"oauth-invalid-grant"),"oauth/invalid_client":we("oauth/invalid_client","OAuth: invalid client","The OAuth server does not recognize the client credentials.",["Client was deleted on the authorization server.","Dynamic registration cache is stale.","`client_id` was rotated server-side."],["Re-register the client (Reconnect from the server card triggers DCR if supported)."],"oauth-invalid-client"),"oauth/redirect_mismatch":we("oauth/redirect_mismatch","OAuth: redirect URI mismatch","The redirect URI in the request does not match the one registered with the OAuth server.",["Authorization server requires the inspector's callback URL to be registered explicitly.","Server's allow-list is wrong."],["Add the inspector's callback URL to the OAuth server's allowed redirects.","Verify the inspector's base URL hasn't changed."],"oauth-redirect-mismatch"),"oauth/well_known_unreachable":we("oauth/well_known_unreachable","OAuth metadata unreachable","The OAuth `.well-known` discovery endpoint could not be fetched.",["Authorization server is down.","Wrong issuer URL.","CORS blocks the discovery request from the browser."],["Confirm the issuer URL in the server config.","Open the `.well-known/openid-configuration` (or `oauth-authorization-server`) URL in a browser."],"oauth-well-known-unreachable"),"sdk/not_yet_supported_in_stateless":we("sdk/not_yet_supported_in_stateless","Operation not supported on stateless transport","The inspector's stateless HTTP transport does not yet implement this MCP operation.",["Operation requires a server-initiated channel (subscriptions, MRTR) the stateless preview transport hasn't wired up yet."],["Switch the server to the legacy stateful transport in its protocol-mode toggle."],"not-yet-supported-in-stateless","warning"),"sdk/stateless_requires_http":we("sdk/stateless_requires_http","Stateless transport requires HTTP","Stateless mode can only be used with an HTTP-transport server, not STDIO.",["You enabled the stateless protocol toggle on a stdio server."],["Disable the stateless toggle for stdio servers."],"stateless-requires-http"),"sdk/protocol_version_pin_unsupported":we("sdk/protocol_version_pin_unsupported","Server doesn't support the pinned protocol version","This connection is pinned to one MCP protocol version, and the server does not offer it.",["The client profile you're emulating pins a protocol version this server hasn't adopted — a host set to the latest revision against a server that still speaks a 2025 one.","A per-server protocol override left pinned to a version the server dropped or never shipped."],["Set the protocol version to Automatic to negotiate whatever the server does support.","Or pick the version the server advertises — `server/discover` (modern) or the `initialize` response (legacy) lists them."],"protocol-version-pin-unsupported"),"sdk/paginated_tool_header_discovery_unsupported":we("sdk/paginated_tool_header_discovery_unsupported","Paginated tool discovery not supported with header overrides","Paginated tools discovery cannot run alongside per-request header overrides on this transport.",["Conflicting combination of progressive tool discovery + per-server header overrides."],["Disable progressive tool discovery for this server, or move headers into the server config."],"paginated-tool-and-header-discovery-unsupported","warning"),"provider/invalid_tool_name":we("provider/invalid_tool_name","Provider rejected the tool name","An LLM provider rejected a tool name (Anthropic's strict tool-name validator is the most common source).",["Tool name contains characters or length the provider does not allow.","Two attached servers expose tools whose namespaced names collide after sanitization."],["Rename the offending tool on the server.","Detach one of the colliding servers from the chat surface."],"provider-invalid-tool-name"),"provider/auth_error":we("provider/auth_error","Provider authentication error","Your LLM provider rejected the API key for this request.",["Key is missing.","Key is invalid or revoked.","Key is for a different environment (project, region)."],["Add or update your API key under Settings → LLM Providers.","Verify the key in the provider's dashboard."],"provider-auth-error"),"provider/not_allowlisted":we("provider/not_allowlisted","Model provider not enabled on MCPJam","This model's provider is not enabled on MCPJam's hosted AI gateway, so MCPJam can't run it. Retrying or changing your API key won't help.",["MCPJam's hosted gateway does not have this model's provider on its provider allowlist."],["Choose a model from a different provider.","Add your own key for this provider under Settings → LLM Providers (BYOK) to run the model on your key instead of MCPJam's gateway."],"provider-not-allowlisted","warning"),"provider/model_retired":we("provider/model_retired","Model retired","This model has been retired and is no longer available on MCPJam. Choose a newer model.",["The model saved on this chat, eval or suite has been retired from MCPJam."],["Choose a newer model, then run again."],"model-retired","warning"),"provider/mcpjam_limit_daily":we("provider/mcpjam_limit_daily","Out of MCPJam credits","Your organization's daily MCPJam credits are used up. They reset tomorrow.",["Chat, evals and swarm generation all draw on one daily bucket, shared across the organization."],["On Free, upgrade for a larger monthly allowance and access to top-ups. On eligible paid plans, buy shared credits to continue testing.","Wait for the daily allowance to reset.",al],"out-of-mcpjam-credits","warning"),"provider/mcpjam_limit_monthly":we("provider/mcpjam_limit_monthly","Out of MCPJam credits","Your organization's available MCPJam credits are used up for this billing period.",["Paid plans include a monthly credit allowance shared across the organization. It renews with the billing period."],["On Free, upgrade for a larger monthly allowance and access to top-ups. On eligible paid plans, buy shared credits to continue testing.","Wait for the billing period to renew.",al],"out-of-mcpjam-credits","warning"),"provider/mcpjam_limit_insufficient":we("provider/mcpjam_limit_insufficient","Not enough MCPJam credits","Your organization has MCPJam credits left, but not enough for this request.",["MCPJam reserves a request's worst-case cost before it runs, so an expensive model or a long conversation can need more than the remaining balance."],["Try a cheaper model or a shorter conversation.","On Free, upgrade for a larger monthly allowance and access to top-ups. On eligible paid plans, buy shared credits to continue testing.",al],"out-of-mcpjam-credits","warning"),"provider/fallback_prohibited":we("provider/fallback_prohibited","Provider failed, fallback not permitted","The model's provider failed and this model selection does not allow a fallback provider, so the request stopped rather than running somewhere other than where it was asked to.",[`The provider serving this model returned an error or was unreachable, and the selection's fallback policy is "none" — the default for evals, swarms and judges, so a result never silently comes from a different provider.`],["Retry — the provider's failure may be temporary.","Pick a different model, or a model on a connection you control."],"provider-failed-fallback-not-permitted","warning"),"provider/mcpjam_platform_budget":we("provider/mcpjam_platform_budget","MCPJam shared free allowance unavailable","The shared free allowance is exhausted or temporarily paused.",["This limit applies across free usage, not just your account."],["Wait until the supplied reset time, if present.","Use purchased credits or your own provider key for chat."],"mcpjam-platform-budget","warning"),"account/suspended":we("account/suspended","Account suspended","This account has been suspended by MCPJam.",["Support has suspended this account."],["Contact founders@mcpjam.com for support."],"account-suspended","warning"),"account/guest_input_too_large":we("account/guest_input_too_large","Request too large for a guest","This request is larger than MCPJam allows for guests. Sign in to remove the limit, or send less.",["Connected servers add their tool definitions to every request, and those count toward the guest limit.","A tool returned a large result, and it is sent back to the model with the next request.","The conversation has grown past the guest limit."],["Sign in to remove the guest limit.","Have the tool return less, or disconnect servers this request doesn't need.","In chat, start a new chat or shorten the conversation."],"request-too-large-for-a-guest","warning"),"provider/mcpjam_limit":we("provider/mcpjam_limit","Out of MCPJam credits","Your organization is out of MCPJam credits, so this request could not continue.",["Chat, evals and swarm generation all draw on the same MCPJam allowance."],["On Free, upgrade for a larger monthly allowance and access to top-ups. On eligible paid plans, buy shared credits to continue testing.","Wait for the allowance to reset.",al],"out-of-mcpjam-credits","warning"),"provider/quota":we("provider/quota","Provider quota / rate limit","Your LLM provider rejected the request because you hit a rate limit or quota.",["Daily/monthly quota exhausted.","Per-minute rate limit exceeded.","Free tier limits hit."],["Wait for the limit window to reset.","Upgrade your provider plan.","Switch to a different provider in Settings."],"provider-quota","warning"),"server/rate_limited":we("server/rate_limited","MCP server rate limit","The MCP server rejected the request with HTTP 429 (too many requests).",["The server enforces its own per-client rate limit.","An upstream API the server calls is throttling it.","A burst of tool calls exceeded what the server allows."],["Wait for the server's limit window to reset, then retry.","Reduce concurrency or the number of tool calls in the run.","Check the server's own rate-limit documentation or logs."],"server-rate-limited","warning"),"server/http_error":we("server/http_error","MCP server returned an HTTP error","The MCP server answered the request with an HTTP error status.",["404: the URL points at the wrong endpoint path (for example, a missing `/mcp`).","405: the endpoint does not accept MCP requests (POST).","5xx: the server hit an error of its own while handling the request."],["Check the server URL, including the MCP endpoint path.","Check the server's logs for the failed request."],"server-http-error"),"provider/empty_response":we("provider/empty_response","Model returned no response","The model returned no response, so the turn could not complete.",["The model request ended without usable content."],["Rerun the affected cases. If this recurs, report it with the run details."],"model-empty-response"),...QL(we),"generation/invalid_output":we("generation/invalid_output","Generation failed","Generation failed. Please try again.",["The generation response did not match the required format."],["Try generation again. If it keeps failing, contact support with the request ID."],"generation-failed"),"internal/unknown":we("internal/unknown","Unknown error","An error occurred that the inspector could not classify.",["Unhandled error path.","New error class the inspector hasn't been taught about yet."],["Open the details panel and copy the raw message.","File an issue with the raw message so we can add it to the catalog."],"unknown-error")};function Ow(e,t=0){if(!e||typeof e!="object"||t>3)return;const r=e.code,s=typeof r=="string"?r:void 0;if(s!==void 0&&t1(s))return s;const n=e.cause;if(n!==void 0&&n!==e){const i=Ow(n,t+1);if(i!==void 0)return i}return s}function t1(e){return r1.has(e)||e.startsWith("UND_ERR_")}var r1=new Set(["ECONNREFUSED","ECONNRESET","EAI_AGAIN","ENETDOWN","ENETUNREACH","ENOTFOUND","EPIPE","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_SOCKET"]),s1="The server's TLS certificate could not be verified",n1="The connection to the server failed";function i1(e){return e.includes(s1)}function XG(e){return e.includes(n1)}var Fm=["org_keys_required","org_model_unconfigured","org_runtime_unsupported","ai_scope_unresolved","ai_key_policy_unavailable","provider_auth_failed","provider_unavailable"],o1=["credential_missing","capability_missing","capability_unknown","invalid_model"],jm=[...Fm,...o1],a1=new Set(Fm),c1=new Set(jm);function l1(e){return c1.has(e)}function u1(e){return typeof e=="string"&&a1.has(e)}function ZG(e){if(typeof e!="string")return;const t=e.trim().toLowerCase();return l1(t)?t:void 0}var d1={org_keys_required:!1,org_model_unconfigured:!1,org_runtime_unsupported:!1,ai_scope_unresolved:!1,ai_key_policy_unavailable:!0,provider_auth_failed:!1,provider_unavailable:!0,credential_missing:!1,capability_missing:!1,capability_unknown:!1,invalid_model:!1};function Mw(e){return d1[e]?"temporary":"configuration"}var QG=new Set(jm.filter(e=>Mw(e)==="temporary")),e9=new Set(jm.filter(e=>Mw(e)==="configuration")),p1={org_keys_required:"org/keys_required",org_model_unconfigured:"org/model_unconfigured",org_runtime_unsupported:"org/runtime_unsupported",ai_scope_unresolved:"org/scope_unresolved",ai_key_policy_unavailable:"org/key_policy_unavailable",provider_auth_failed:"org/provider_auth_failed",provider_unavailable:"org/provider_unavailable"};function b_(e){if(typeof e!="string")return;const t=e.trim().toLowerCase();return u1(t)?p1[t]:void 0}var Lw=["provider_auth_failed","provider_unavailable"],h1=new Set(Lw),f1=Fm.filter(e=>!h1.has(e)),m1=new RegExp(`\\b(${f1.join("|")})\\b`,"i"),op=Lw.join("|"),g1=new RegExp(`"code"\\s*:\\s*"(${op})"|\\((${op})\\b|(?:^|[\\s—-])(${op}):`,"i");function v1(e,t){const r=new Set;let s=e;for(let o=0;o<5&&s&&typeof s=="object"&&!r.has(s);o++){r.add(s);const a=s;for(const c of[a.data?.code,a.body?.code,a.details?.code,a.code,a.failureCode]){if(typeof c!="string")continue;const l=b_(c);if(l)return{slug:l,rawCode:c.trim().toLowerCase()}}s=a.cause}const n=(m1.exec(t)??g1.exec(t))?.slice(1).find(o=>o!==void 0);if(!n)return;const i=b_(n);return i?{slug:i,rawCode:n.toLowerCase()}:void 0}var S_=120;function ap(e){return e=String(Cw(e)),e.length>S_?e.slice(0,S_):e}function cp(e,t){const r=t?.bodyKind;if(e==null||e.trim()==="")return{scheme:"none",...r?{bodyKind:r}:{}};try{const s=rP(e);if(s.length===0)return{scheme:"other",...r?{bodyKind:r}:{}};const n=s.find(o=>o.error==="insufficient_scope")??s.find(o=>o.error)??s.find(o=>o.scope||o.resource_metadata)??s[0]??{},i={scheme:"bearer"};if(typeof n.error=="string"&&n.error.trim()&&(i.error=ap(n.error.trim().toLowerCase())),typeof n.scope=="string"&&n.scope.trim()){const o=Array.from(new Set(n.scope.split(/\s+/).map(a=>a.trim()).filter(Boolean).map(ap)));o.length>0&&(i.scopes=o.slice(0,20))}if(typeof n.resource_metadata=="string"&&n.resource_metadata.trim())try{i.resourceMetadataHost=ap(new URL(n.resource_metadata.trim()).host)}catch{}return r&&(i.bodyKind=r),i}catch{return{scheme:"other",...r?{bodyKind:r}:{}}}}function _1(e){return!!e&&typeof e=="object"&&typeof e.slug=="string"&&typeof e.title=="string"&&typeof e.oneLine=="string"&&typeof e.docsAnchor=="string"&&typeof e.severity=="string"&&typeof e.rawMessage=="string"&&Array.isArray(e.likelyCauses)&&Array.isArray(e.nextSteps)}function Co(e){const t=Cw(e);return typeof t=="string"?t:String(e)}function y1(e){if(!e||typeof e!="object")return;const t=e.name;return typeof t=="string"?t:void 0}function Hm(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;if(e==null)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function Bm(e){if(!e||typeof e!="object")return;const t=e.code;if(typeof t=="number"&&Number.isFinite(t))return t;const r=e.error;if(r&&typeof r=="object"){const s=r.code;if(typeof s=="number"&&Number.isFinite(s))return s}}function b1(e){if(!e||typeof e!="object")return;const t=e.code;return typeof t=="string"?t:void 0}function Nw(e){if(!e||typeof e!="object")return;const t=e.statusCode;if(typeof t=="number")return t;const r=e.status;if(typeof r=="number")return r}function $w(e){return Fh[e]??Fh["internal/unknown"]}var S1=200;function jh(e){const t=e.replace(/\s+/g," ").trim();return t.length<=S1?t:`${t.slice(0,199).trimEnd()}…`}function Dw(e,t,r,s,n){if(t==="server/http_error"&&typeof s=="number")return{...e,oneLine:n!==void 0&&n>=400&&n!==s?`The MCP server answered the request with HTTP ${s}, then with HTTP ${n} to the SSE fallback.`:`The MCP server answered the request with HTTP ${s}.`};if(t==="provider/mcpjam_limit_insufficient"){const i=Gm(r);return i?{...e,oneLine:i}:e}return t!=="internal/unknown"||!r?e:{...e,oneLine:jh(r)}}var w1=["Backend step returned no content (stream error or empty response)","Backend step returned no messages (stream error or empty response)"];function k1(e){if(/NotYetSupportedInStateless/i.test(e))return"sdk/not_yet_supported_in_stateless";if(/StatelessRequiresHttpTransport/i.test(e))return"sdk/stateless_requires_http";if(/PaginatedToolHeaderDiscoveryUnsupported/i.test(e))return"sdk/paginated_tool_header_discovery_unsupported";if(/which this client is pinned to/i.test(e))return"sdk/protocol_version_pin_unsupported";if(/doesn't support an MCP protocol version this client speaks/i.test(e))return"jsonrpc/unsupported_protocol_version";if(i1(e))return"transport/tls_untrusted"}var E1={[Ir.ParseError]:"jsonrpc/parse_error",[Ir.InvalidRequest]:"jsonrpc/invalid_request",[Ir.MethodNotFound]:"jsonrpc/method_not_found",[Ir.InvalidParams]:"jsonrpc/invalid_params",[Ir.InternalError]:"jsonrpc/internal_error",[Ir.ConnectionClosed]:"jsonrpc/connection_closed",[Ir.HeaderMismatch]:"jsonrpc/header_mismatch",[Ir.MissingRequiredClientCapability]:"jsonrpc/missing_required_client_capability",[Ir.UnsupportedProtocolVersion]:"jsonrpc/unsupported_protocol_version",[GL.UnsupportedProtocolVersion]:"jsonrpc/unsupported_protocol_version",[Ir.UrlElicitationRequired]:"jsonrpc/url_elicitation_required"};function T1(e){return/header[^a-z]*mismatch/i.test(e)||/MCP-Protocol-Version/i.test(e)?"jsonrpc/header_mismatch":"jsonrpc/request_timeout"}var A1=/^(?:MCP error -32603:\s*)?invalid response format$/i;function Uw(e){return A1.test(e.trim())}function I1(e){return Uw(e)?"jsonrpc/invalid_response_format":"jsonrpc/internal_error"}function qw(e){const t=e.toUpperCase();switch(t){case"ECONNREFUSED":return"transport/econnrefused";case"ECONNRESET":return"transport/econnreset";case"ETIMEDOUT":return"transport/etimedout";case"ENOTFOUND":return"transport/enotfound";case"EAI_AGAIN":return"transport/eai_again";default:return t.startsWith("UND_ERR_")?"transport/undici":void 0}}function R1(e){const t=e.toLowerCase();if(/\bsocket\s+hang\s+up\b/i.test(e))return"transport/socket_hang_up";for(const r of e.matchAll(/\b(E[A-Z]{2,}(?:_[A-Z]+)*|UND_ERR_[A-Z_]+)\b/g)){const s=qw(r[1]);if(s)return s}if(/\bfetch\s+failed\b/i.test(e))return"transport/fetch_failed";if(/\bgetaddrinfo\b/i.test(e))return"transport/enotfound";if(/\bconnection\s+(?:refused|reset|closed|timed?\s*out|aborted|error|failed)\b/i.test(e)||/\b(?:failed|unable)\s+to\s+connect\b/i.test(e))return t.includes("refused")?"transport/econnrefused":t.includes("reset")?"transport/econnreset":t.includes("timed out")||t.includes("timeout")?"transport/etimedout":t.includes("closed")?"jsonrpc/connection_closed":"transport/fetch_failed";if(/Invalid tool name/i.test(e))return"provider/invalid_tool_name";if(Uw(e))return"jsonrpc/invalid_response_format"}function C1(e){const t=x1(e);if(!t)return;const r=P1(e)??(typeof t.error=="string"?t.error:typeof t.error_code=="string"?t.error_code:void 0);if(r)switch(r.toLowerCase()){case"invalid_grant":return"oauth/invalid_grant";case"invalid_client":return"oauth/invalid_client";case"invalid_redirect_uri":case"redirect_uri_mismatch":return"oauth/redirect_mismatch";default:return}}function P1(e){if(!e||typeof e!="object"||e.name!=="OAuthResponseError")return;const t=e.code;return typeof t=="string"&&t?t:void 0}function x1(e){if(!e||typeof e!="object")return;const t="body"in e?e.body:"data"in e?e.data:e;if(!(!t||typeof t!="object"))return t}function zw(e){if(!(e instanceof Error))return;const t=e.cause;if(!t||typeof t!="object")return;const r=typeof t.name=="string"?t.name:"Error",s=typeof t.message=="string"?Co(t.message):"";if(s)return{name:r,message:s}}var w_={AUTH_ERROR:"auth/http_401",OAUTH_REQUIRED:"auth/http_401"};function O1(e){const t=y1(e);if(t==="MCPAuthError"||t==="UnauthorizedError")return"auth/http_401";const r=b1(e);if(r&&w_[r])return w_[r]}function lp(e){if(e===401)return"auth/http_401";if(e===403)return"auth/http_403";if(e===429)return"provider/quota"}function M1(e){if(/(?:^|[^\w.:])401\b/.test(e))return"auth/http_401";if(/(?:^|[^\w.:])403\b/.test(e))return"auth/http_403";if(/(?:^|[^\w.:])429\b|too many requests/i.test(e))return"provider/quota"}function L1(e){const t=Hm(e),r=e&&typeof e=="object"?e:null,s=r?.data?.code??r?.code;if(s==="GENERATION_FAILED")return{slug:"generation/invalid_output",rawCode:s};if(s==="platform_free_budget_exhausted")return{slug:"provider/mcpjam_platform_budget",rawCode:s};if(s==="account_suspended")return{slug:"account/suspended",rawCode:s};const n=v1(e,t);if(n)return n;if(w1.some(v=>t.startsWith(v)))return{slug:"provider/empty_response"};const i=k1(t);if(i)return{slug:i};const o=O1(e);if(o)return{slug:o};const a=Bm(e);if(a!==void 0){if(a===-32001)return{slug:T1(t),rawCode:a};if(a===Ir.InternalError)return{slug:I1(t),rawCode:a};const v=E1[a];if(v)return{slug:v,rawCode:a};const _=lp(a);if(_)return{slug:_,rawCode:a}}const c=Ow(e);if(c){const v=qw(c);if(v)return{slug:v,rawCode:c}}if(/missing\s+(?:or\s+invalid\s+)?bearer/i.test(t)||/bearer\s+token\s+(?:is\s+)?required/i.test(t))return{slug:"auth/missing_bearer"};if(Gm(t))return{slug:"provider/mcpjam_limit_insufficient"};if(/\bout of MCPJam credits\b/i.test(t))return{slug:"provider/mcpjam_limit"};const l=G1(t);if(l)return{slug:l};const u=Vm(e);if(u!==void 0){const v=lp(u);if(v)return{slug:v,rawCode:u}}const p=Fw(e)?.streamable,d=p!==void 0&&p>=400?p:Hh(e);if(d!==void 0&&d>=400&&lp(d)===void 0)return{slug:"server/http_error",rawCode:d};const h=C1(e);if(h)return{slug:h};const f=M1(t);if(f)return{slug:f};if(/refresh\s+token/i.test(t)&&/(failed|invalid|expired|revoked)/i.test(t))return{slug:"auth/oauth_refresh_failed"};if(/consent\s+is\s+required/i.test(t)||/^\s*reauthenticate\b[\s\S]*\bto\s+continue\b/i.test(t))return{slug:"auth/consent_required"};const m=R1(t);return m?{slug:m}:/well[-_]?known/i.test(t)&&/(unreachable|fail|404)/i.test(t)?{slug:"oauth/well_known_unreachable"}:{slug:"internal/unknown"}}var N1=new Set(["auth/http_401","auth/http_403","auth/missing_bearer","auth/oauth_refresh_failed","auth/authorization_server_unreachable","oauth/invalid_client","oauth/invalid_grant","provider/auth_error","provider/quota"]);function Vm(e){const t=new Set;let r=e;for(let s=0;s<5&&r&&typeof r=="object"&&!t.has(r);s++){t.add(r);const n=Nw(r);if(n!==void 0)return n;const i=Bm(r);if(i!==void 0&&i>=100&&i<=599)return i;if(r.name==="UnauthorizedError")return 401;const o=zm(r);r=o!==r?o:r.cause}}var $1=new Set(["StreamableHTTPError","SseError"]);function D1(e){if(e.name==="SdkHttpError")return!0;const t=e.constructor;return typeof t=="function"&&$1.has(t.name)}function Hh(e){const t=[e],r=new Set;for(;t.length>0&&r.size<8;){const s=t.shift();if(!s||typeof s!="object"||r.has(s))continue;if(r.add(s),D1(s)){const i=Nw(s)??Bm(s);if(i!==void 0&&i>=100&&i<=599)return i}const n=zm(s);t.push(n!==s?n:s.cause,s.streamableCause)}}function Fw(e){let t=e;const r=new Set;for(;t&&typeof t=="object"&&!r.has(t);){r.add(t);const s=t.streamableCause;if(s!==void 0)return{streamable:Hh(s),fallback:Hh(t.cause)};const n=zm(t);t=n!==t?n:t.cause}}function U1(e,t){if(t?.refresh?.outcome==="authorization_server_unreachable")return"auth/authorization_server_unreachable";if(t?.refresh?.outcome==="token_rejected")return"auth/oauth_refresh_failed";const r=t?.challenge??jw(e);if(!r)return;const s=Vm(e);if(s===401&&r.scheme!=="bearer")return"oauth/no_bearer_challenge";if(s===401)return"auth/http_401";if(s===403)return r.scheme==="bearer"&&r.error==="insufficient_scope"?"auth/insufficient_scope":r.scheme==="bearer"&&r.error==="invalid_token"?"oauth/non_compliant_challenge":r.scheme==="none"&&r.bodyKind==="html"?"auth/proxy_rejected":"auth/http_403"}function jw(e){const t=XL(e);if(t)return t.raw?cp(t.raw):t.facets.challengeHeader!=="bearer"?cp(void 0):{...cp("Bearer"),...t.error?{error:t.error}:{},...t.requiredScope?{scopes:t.requiredScope.split(/\s+/).filter(Boolean)}:{}}}function q1(e,t,r){if(t==="auth/insufficient_scope"&&r?.challenge?.scopes?.length)return{...e,oneLine:jh(Co(`${e.oneLine} Required scopes: ${r.challenge.scopes.join(" ")}.`))};const s=r?.challenge?.error;return!s||t!=="auth/http_401"&&t!=="auth/http_403"?e:{...e,oneLine:jh(Co(`${e.oneLine} The server reported \`${s}\`.`))}}var z1=new Set(["user_server","user_config","mcpjam","ambiguous"]);function F1(e){return typeof e=="string"&&z1.has(e)}function j1(e){const t=e?.origin;return F1(t)?t:"ambiguous"}function Hw(e,t,r){return r?.credentialOwner==="mcpjam"&&N1.has(t)?{...e,origin:"mcpjam"}:e}function H1(e,t){return e==="provider/quota"&&t?.surface==="mcpServer"?"server/rate_limited":e}function B1(e,t){try{const r=Co(Hm(e)),s=U1(e,t),n=s?{slug:s}:L1(e),i=H1(n.slug,t),o=n.rawCode??(s?Vm(e):void 0),a=Hw(q1(Dw($w(i),i,r,o,i==="server/http_error"?Fw(e)?.fallback:void 0),i,t?.challenge?t:{...t,challenge:jw(e)}),i,t),c=zw(e);return{...a,rawMessage:r,...o!==void 0?{rawCode:o}:{},...c?{cause:c}:{}}}catch{return Bw(e,"Unknown")}}function t9(e,t,r){try{const s=Hw($w(e),e,r),n=t!==void 0?Co(Hm(t)):"",i=zw(t);return{...s,rawMessage:n,...i?{cause:i}:{}}}catch{return Bw(t,"")}}function Bw(e,t){const r=Fh["internal/unknown"];let s=t;try{s=Co(e instanceof Error?e.message:String(e??t))}catch{s=t}return{...Dw(r,"internal/unknown",s),rawMessage:s}}var V1=/\bThis request needs about (\d+) MCPJam credits; your organization has (\d+) left[^.]{0,40}\./i;function Gm(e){const t=V1.exec(e);if(!t)return;const r=Number(t[1]),s=Number(t[2]);return Number.isSafeInteger(r)&&Number.isSafeInteger(s)&&s>0&&r>s?t[0]:void 0}function G1(e){if(Gm(e))return"provider/mcpjam_limit_insufficient";const t=/\b(daily|monthly)\s+mcpjam[\w\s-]{0,40}model limit/i.exec(e);if(t)return t[1].toLowerCase()==="monthly"?"provider/mcpjam_limit_monthly":"provider/mcpjam_limit_daily";if(/mcpjam[\w\s-]{0,40}model limit/i.test(e))return"provider/mcpjam_limit"}var W1;W1=globalThis.crypto;var K1="Resource server does not implement OAuth 2.0 Protected Resource Metadata.",k_="No response while loading OAuth protected resource metadata.",J1="Failed to request resource metadata";function Qu(e){const t=e instanceof Error?e.message:String(e);return`${J1}: ${t}`}function r9(e){return e==="Resource server does not implement OAuth 2.0 Protected Resource Metadata."||e===Qu(new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata."))}function Y1(e){try{const t=new URL(e);return t.protocol=t.protocol.toLowerCase(),t.hostname=t.hostname.toLowerCase(),t.hash="",t.pathname!=="/"&&t.pathname.endsWith("/")&&(t.pathname=t.pathname.slice(0,-1)),t.toString()}catch{return e}}function X1(e,t){if(e.origin!==t.origin||t.pathname.length<e.pathname.length)return!1;const r=t.pathname.endsWith("/")?t.pathname:`${t.pathname}/`,s=e.pathname.endsWith("/")?e.pathname:`${e.pathname}/`;return r.startsWith(s)}function Z1(e,t,r){const s=c=>({value:e,source:t,status:"invalid",strictClientCompatible:!1,rfc9728Compliant:!1,rfc9728Reason:c,reason:c});let n;try{n=new URL(e)}catch{return s(`Resource indicator "${e}" is not a parseable URI.`)}if(n.hash)return s(`Resource indicator "${e}" must not include a fragment (RFC 8707 §2).`);if(n.protocol!=="https:"&&n.protocol!=="http:")return s(`Resource indicator "${e}" must be an https URL (RFC 9728 §2).`);let i;try{i=new URL(r)}catch{return s(`Server URL "${r}" is not a parseable URI.`)}if(n.origin!==i.origin){const c=`Resource indicator "${e}" is on a different origin than the server URL "${r}" — honoring it would let the server steer tokens to an audience it doesn't own.`;return{value:e,source:t,status:"incompatible",strictClientCompatible:!1,rfc9728Compliant:!1,rfc9728Reason:c,reason:c}}const o=X1(n,i),a=n.protocol!=="https:"?`Resource indicator "${e}" must use the https scheme to comply with RFC 9728.`:o?void 0:`Resource indicator "${e}" does not satisfy the protected-resource binding for server URL "${r}" required for RFC 9728 conformance.`;return{value:e,source:t,status:"valid",strictClientCompatible:o,rfc9728Compliant:a===void 0,...a?{rfc9728Reason:a}:{},...o?{}:{reason:`Resource indicator "${e}" is not a path prefix of the server URL "${r}"; clients that enforce the official MCP SDK's strict binding will refuse it.`}}}function Q1(e){return e.resolved?e.resolved.value:e.serverUrl===void 0?e.prmResource:Bh({serverUrl:e.serverUrl,prmResource:e.prmResource}).value}function Bh(e){const t=[[e.prmResource,"prm"],[e.authorizationUrlResource,"authorization"],[e.configuredResource,"configured"]];for(const[s,n]of t){const i=s?.trim();if(i)return Z1(i,n,e.serverUrl)}try{new URL(e.serverUrl)}catch{return{value:e.serverUrl,source:"server",status:"invalid",strictClientCompatible:!1,rfc9728Compliant:!1,rfc9728Reason:`Server URL "${e.serverUrl}" is not a parseable URI.`,reason:`Server URL "${e.serverUrl}" is not a parseable URI.`}}const r=new URL(e.serverUrl).protocol==="https:"?void 0:`Resource indicator "${e.serverUrl}" must use the https scheme to comply with RFC 9728.`;return{value:Y1(e.serverUrl),source:"server",status:"valid",strictClientCompatible:!0,rfc9728Compliant:r===void 0,...r?{rfc9728Reason:r}:{}}}var eN="oauth-protected-resource";function Vw(e){const t=typeof e=="string"?new URL(e):e;return{origin:t.origin,path:t.pathname.replace(/\/$/,"")}}function tN(e){const{origin:t,path:r}=Vw(e),s=`${t}/.well-known/${eN}`;return[`${s}${r}`,s]}var rN={"oauth-insert":{kind:"oauth",placement:"insert"},"oauth-root":{kind:"oauth",placement:"root"},"oidc-insert":{kind:"oidc",placement:"insert"},"oidc-append":{kind:"oidc",placement:"append"},"oidc-root":{kind:"oidc",placement:"root"}},sN={oauth:"oauth-authorization-server",oidc:"openid-configuration"},Rc={current:["oauth-insert","oidc-insert","oidc-append"],legacy:["oauth-insert","oauth-root"]};function Cc(e,t){const{origin:r,path:s}=Vw(e),n=new Set,i=[];for(const o of t){const{kind:a,placement:c}=rN[o],l=sN[a],u=c==="insert"?`${r}/.well-known/${l}${s}`:c==="append"?`${r}${s}/.well-known/${l}`:`${r}/.well-known/${l}`;n.has(u)||(n.add(u),i.push({url:u,kind:a}))}return i}var Gw="2025-11-25";async function Ww(e,t,r=fetch){try{return await r(e,{headers:t})}catch(s){if(!(s instanceof TypeError))throw s;if(!t)return;try{return await r(e,{})}catch(n){if(!(n instanceof TypeError))throw n;return}}}function nN(e,t="",r={}){const s=t.endsWith("/")?t.slice(0,-1):t;return r.prependPathname?`${s}/.well-known/${e}`:`/.well-known/${e}${s}`}var E_=5,iN=new Set([301,302,303,307,308]);function oN(e,t){if(!iN.has(e.status))return;const r=e.headers.get("location");if(!r)return;let s;try{s=new URL(r,t)}catch{return{kind:"refused",reason:`Refused redirect to ${r}: not a valid URL`}}return s.protocol!=="https:"&&s.protocol!=="http:"?{kind:"refused",reason:`Refused redirect to ${s.protocol} URL: metadata discovery only follows HTTP(S)`}:t.protocol==="https:"&&s.protocol!=="https:"?{kind:"refused",reason:`Refused redirect to ${s.href}: metadata discovery never downgrades HTTPS to HTTP`}:{kind:"follow",url:s}}async function T_(e,t,r=fetch){const s={"MCP-Protocol-Version":t,Accept:"application/json"};let n=e;for(let i=0;;i+=1){const o=await Ww(n,s,r),a=o?oN(o,n):void 0;if(!o||!a)return o;if(await o.text().catch(()=>{}),a.kind==="refused")throw new Error(`HTTP ${o.status}: ${a.reason}`);if(i>=E_)throw new Error(`HTTP ${o.status}: Stopped after ${E_} redirects; last Location was ${a.url.href}`);n=a.url}}function aN(e,t){return e?t==="/"?!1:e.status>=400&&e.status<500&&e.status!==429:!0}async function cN(e,t,r,s){const n=new URL(e),i=s?.protocolVersion??Gw;let o;if(s?.metadataUrl)o=new URL(s.metadataUrl);else{const l=nN(t,n.pathname);o=new URL(l,s?.metadataServerUrl??n),o.search=n.search}let a=await T_(o,i,r),c=!a;return!s?.metadataUrl&&aN(a,n.pathname)&&(a=await T_(new URL(`/.well-known/${t}`,n),i,r),c||=!a),{response:a,sawNoResponse:c}}async function ed(e,t,r=fetch){const{response:s,sawNoResponse:n}=await cN(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!s)throw new Error(k_);if(s.status===404)throw await s.text().catch(()=>{}),new Error(n?k_:K1);if(!s.ok)throw await s.text().catch(()=>{}),new Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);const i=await s.text();try{return JSON.parse(i)}catch{const o=s.headers.get("content-type")?.split(";")[0]?.trim()||"no content type";throw new Error(`Protected resource metadata is not valid JSON (got ${o}).`)}}async function lN(e,{fetchFn:t=fetch,protocolVersion:r=Gw}={}){const s={"MCP-Protocol-Version":r,Accept:"application/json"};for(const{url:n,kind:i}of Cc(e,Rc.current)){const o=await Ww(new URL(n),s,t);if(o){if(!o.ok){if(await o.text().catch(()=>{}),o.status>=400&&o.status<500&&o.status!==429)continue;throw new Error(`HTTP ${o.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${n}`)}return await o.json()}}}function uN(e){if(!("authorization_servers"in e)||!Array.isArray(e.authorization_servers))return;const t=e.authorization_servers[0];if(typeof t=="string")try{const{protocol:r}=new URL(t);return r==="http:"||r==="https:"?t:void 0}catch{return}}function dN(e){const t=e instanceof Error?/^HTTP (\d{3}) /.exec(e.message)?.[1]:void 0;return t!==void 0&&(t==="429"||t.startsWith("5"))}async function s9(e,t){let r,s;try{const i=await ed(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn);typeof i=="object"&&i!==null&&!Array.isArray(i)&&(r=i,s=uN(i))}catch(i){if(i instanceof TypeError||dN(i))throw i}s||(s=String(new URL("/",e)));const n=await lN(s,{fetchFn:t?.fetchFn});return{authorizationServerUrl:String(s),authorizationServerMetadata:n,resourceMetadata:r}}var Kw="https://www.mcpjam.com/mcp_jam_2row.png",n9="https://www.mcpjam.com/.well-known/oauth/client-metadata.json",Jw="https://github.com/MCPJam/inspector",pN={"2025-03-26":"MCP Inspector Debug Client","2025-06-18":"MCPJam Inspector Debug Client","2025-11-25":"MCPJam Inspector Debug Client","2026-07-28":"MCPJam Inspector Debug Client"};function i9(e){return{client_name:pN[e],client_uri:Jw,logo_uri:Kw}}var Wm="urn:ietf:params:oauth:grant-profile:id-jag",Km="urn:ietf:params:oauth:grant-type:token-exchange",Jm="urn:ietf:params:oauth:grant-type:jwt-bearer",A_="urn:ietf:params:oauth:token-type:id-jag",hN="urn:ietf:params:oauth:token-type:id_token",fN="urn:ietf:params:oauth:token-type:saml2";var I_="mcpjam-xaa-debugger";function mN(e){return{client_name:"MCPJam XAA Debugger",client_uri:Jw,logo_uri:Kw,authorization_grant_profiles_supported:[Wm],grant_types:[Km,Jm],token_endpoint_auth_method:e.tokenEndpointAuthMethod,...e.jwks?{jwks:e.jwks}:{}}}function up(e,t){return e==null?"omitted":Array.isArray(e)&&e.includes(t)?"present":"contradicted"}function R_(e){return{profile:up(e.authorization_grant_profiles_supported,Wm),jwtBearerGrant:up(e.grant_types,Jm),tokenExchangeGrant:up(e.grant_types,Km),tokenEndpointAuthMethod:typeof e.token_endpoint_auth_method=="string"?e.token_endpoint_auth_method:void 0}}function gN(e){const t=e?.token_endpoint_auth_methods_supported;if(!Array.isArray(t)||t.length===0)return["client_secret_basic"];const r=t.filter(s=>typeof s=="string");return r.length>0?r:["client_secret_basic"]}function td(e){const t=gN(e.authorizationServerMetadata);return e.hasClientSecret?t.includes("client_secret_basic")?{ok:!0,method:"client_secret_basic",supportedMethods:t}:t.includes("client_secret_post")?{ok:!0,method:"client_secret_post",supportedMethods:t}:t.includes("none")?{ok:!0,method:"none",supportedMethods:t}:{ok:!1,message:`Unsupported OAuth client authentication method: ${t.join(", ")||"none advertised"}.`,supportedMethods:t}:{ok:!0,method:"none",supportedMethods:t}}function C_(e){return new URLSearchParams([["v",e]]).toString().slice(2)}function Ln(e){const{clientId:t,clientSecret:r,tokenEndpointAuthMethod:s}=e;if(r&&s==="client_secret_basic")return{headers:{Authorization:`Basic ${btoa(`${C_(t??"")}:${C_(r)}`)}`},bodyParams:{}};const n={};return t&&(n.client_id=t),r&&s!=="none"&&(n.client_secret=r),{headers:{},bodyParams:n}}function rd(e){const t=e.token_endpoint_auth_method;if(!(e.client_secret&&(!t||t==="none")))return t||"none"}var P_=300,Ym="Authenticated request failed",Yw="Token request failed",vN=[Yw,Ym];function o9(e){return e.startsWith(`${Ym}: `)}function Cs(e){if(typeof e!="string")return;const t=e.trim();return t||void 0}function Vh(e){return e.replace(/\s+/g," ").trim()}function Xm(e){if(typeof e=="string")return Cs(e);if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,r=Cs(t.error_type),s=Cs(t.error_description),n=Cs(t.error_message)??s??Cs(t.message),i=Cs(t.error);if(r&&n)return Cs(`${r}: ${n}`);if(i&&s)return Cs(`${i}: ${s}`);if(i)return i;const o=t.error;if(o&&typeof o=="object"&&!Array.isArray(o)){const a=Cs(o.message);if(a)return a}return n}function Xw(e,t){const r=Vh(In(t.statusText??"",{maxLength:P_})),s=Xm(t.body),n=s?Vh(In(s,{maxLength:P_})):void 0;return`${e}: ${t.status}${r?` ${r}`:""}${n?`: ${n}`:""}`}function sd(e){return Xw(Ym,e)}function nd(e){return Xw(Yw,e)}function _N(e){for(const t of vN){if(!e.startsWith(`${t}: `))continue;const r=e.slice(t.length+2),s=/^\d{3}/.exec(r)?.[0];if(!s)return t;const n=r.indexOf(": ",s.length),i=n===-1?void 0:/^[a-z][a-z0-9_]*(?=:|$)/.exec(r.slice(n+2))?.[0];return i?`${t}: ${s}: ${i}`:`${t}: ${s}`}}function x_(e){try{const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t+"=".repeat((4-t.length%4)%4);let s;if(typeof globalThis.atob=="function")s=globalThis.atob(r);else if(typeof Buffer<"u")s=Buffer.from(r,"base64").toString("utf-8");else return null;return JSON.parse(s)}catch{return null}}function Zw(e){const t=e.split(".");return t.length!==3?null:{header:x_(t[0]),payload:x_(t[1]),signature:t[2]}}function Nn(e){return Zw(e)?.payload??null}function Ye(e){try{return new Date(e*1e3).toLocaleString()}catch{return String(e)}}var a9={isInitiatingAuth:!1,currentStep:"idle",httpHistory:[],infoLogs:[],tokenEndpointAuthMethod:void 0};function id(){return{isInitiatingAuth:!1,currentStep:"idle",serverUrl:void 0,wwwAuthenticateHeader:void 0,challengedScopes:void 0,resourceMetadataUrl:void 0,resourceMetadata:void 0,resourceIndicator:void 0,resourceIndicatorSuppressed:void 0,authorizationServerUrl:void 0,authorizationServerMetadata:void 0,clientId:void 0,clientSecret:void 0,tokenEndpointAuthMethod:void 0,codeVerifier:void 0,codeChallenge:void 0,codeChallengeMethod:void 0,authorizationUrl:void 0,authorizationCode:void 0,state:void 0,recordedIssuer:void 0,authorizationResponseIss:void 0,requestedScopes:void 0,accessToken:void 0,refreshToken:void 0,tokenType:void 0,expiresIn:void 0,lastRequest:void 0,lastResponse:void 0,httpHistory:[],infoLogs:[],error:void 0}}function po(e,t){return`${e.substring(0,t)}...`}function Gh(e){if(typeof e=="string"&&e.trim()!=="")try{return new URL(e).pathname}catch{return`${e} (not an absolute URL)`}return Qw(e)}function Qw(e){let t;try{t=typeof e=="string"||typeof e=="object"&&e!==null?JSON.stringify(e)??String(e):String(e)}catch{t="[unserializable value]"}return`${t} (not an absolute URL)`}function yN(e){const t=e.resourceMetadata?.authorization_servers;if(t==null)return;const r=Array.isArray(t)?t[0]:t;if(r!==void 0)return[{label:"Auth Server",value:(typeof r=="string"&&r.trim()!==""?r:void 0)??Qw(r)}]}function dp(e,t,r){return e.resourceIndicatorSuppressed?"omitted (emulation)":t.resourceValue(e)||r}function bN(e,t){return[{id:"request_without_token",label:"MCP request without token",description:"Client makes initial request without authorization",from:"client",to:"mcpServer",details:e.serverUrl?[{label:"POST",value:e.serverUrl},{label:"method",value:t.initialMcpMethod}]:void 0},{id:"received_401_unauthorized",label:"HTTP 401 Unauthorized with WWW-Authenticate header",description:"Server returns 401 with WWW-Authenticate header",from:"mcpServer",to:"client",details:e.resourceMetadataUrl!==void 0?[{label:"Note",value:"Extract resource_metadata URL"}]:void 0},{id:"request_resource_metadata",label:"Request Protected Resource Metadata",description:"Client requests metadata from well-known URI",from:"client",to:"mcpServer",details:e.resourceMetadataUrl!==void 0?[{label:"GET",value:Gh(e.resourceMetadataUrl)}]:void 0},{id:"received_resource_metadata",label:"Return metadata",description:"Server returns OAuth protected resource metadata",from:"mcpServer",to:"client",details:yN(e)}]}function SN(e){return[{id:"cimd_prepare",label:"Client uses HTTPS URL as client_id",description:"Client prepares to use URL-based client identification",from:"client",to:"client",details:e.clientId?[{label:"client_id (URL)",value:e.clientId.includes("http")?e.clientId:"https://www.mcpjam.com/.well-known/oauth/client-metadata.json"},{label:"Method",value:"Client ID Metadata Document (CIMD)"}]:[{label:"Note",value:"HTTPS URL points to metadata document"}]},{id:"cimd_fetch_request",label:"Fetch metadata from client_id URL",description:"Authorization Server fetches client metadata from the URL",from:"authServer",to:"client",details:[{label:"Action",value:"GET client_id URL"},{label:"Note",value:"Server initiates metadata fetch during authorization"}]},{id:"cimd_metadata_response",label:"JSON metadata document",description:"Client hosting returns metadata with redirect_uris and client info",from:"client",to:"authServer",details:[{label:"Content-Type",value:"application/json"},{label:"Contains",value:"client_id, client_name, redirect_uris, etc."}]},{id:"received_client_credentials",label:"Validate metadata and redirect_uris",description:"Authorization Server validates fetched metadata",from:"authServer",to:"authServer",details:[{label:"Validates",value:"client_id matches URL, redirect_uris are valid"},{label:"Security",value:"SSRF protection, domain trust policies"}]}]}function wN(e,t,r){if(r==="cimd")return SN(e);const s=t.clientCredentialsExtras?.(e)??[];return r==="dcr"?[{id:"request_client_registration",label:`POST /register (${t.protocolVersion})`,description:"Client registers dynamically with Authorization Server",from:"client",to:"authServer",details:[{label:"Note",value:"Dynamic client registration (DCR)"},...t.dcrNotes??[]]},{id:"received_client_credentials",label:"Client Credentials",description:"Authorization Server returns client ID and credentials",from:"authServer",to:"client",details:e.clientId?[{label:"client_id",value:po(e.clientId,20)},...s]:void 0}]:[{id:"received_client_credentials",label:`Use Pre-registered Client (${t.protocolVersion})`,description:"Client uses pre-configured credentials (skipped DCR)",from:"client",to:"client",details:e.clientId?[{label:"client_id",value:po(e.clientId,20)},{label:"Note",value:"Pre-registered (no DCR needed)"},...s]:[{label:"Note",value:"Pre-registered client credentials"}]}]}function od(e,t,r){return[...r.includesProtectedResourceMetadata?bN(e,r):[],{id:"request_authorization_server_metadata",label:r.authorizationServerMetadata.label,description:r.authorizationServerMetadata.description,from:"client",to:"authServer",details:e.authorizationServerUrl?[{label:"URL",value:e.authorizationServerUrl},{label:"Protocol",value:r.protocolVersion}]:void 0},{id:"received_authorization_server_metadata",label:"Authorization server metadata response",description:"Authorization Server returns metadata",from:"authServer",to:"client",details:e.authorizationServerMetadata?[{label:"Token",value:Gh(e.authorizationServerMetadata.token_endpoint)},{label:"Auth",value:Gh(e.authorizationServerMetadata.authorization_endpoint)}]:void 0},...wN(e,r,t),{id:"generate_pkce_parameters",label:r.pkce.label,description:r.pkce.description,from:"client",to:"client",details:e.codeChallenge?[{label:"code_challenge",value:po(e.codeChallenge,15)},{label:"method",value:e.codeChallengeMethod||"S256"},{label:"resource",value:dp(e,r,"—")},{label:"Protocol",value:r.protocolVersion}]:void 0},{id:"authorization_request",label:"Open browser with authorization URL",description:"Client opens browser with authorization URL + code_challenge + resource",from:"client",to:"browser",details:e.authorizationUrl?[{label:"code_challenge",value:e.codeChallenge?.substring(0,12)+"..."||"S256"},{label:"resource",value:dp(e,r,"")},...r.authorizationRequestExtras?.(e)??[]]:void 0},{id:"browser_to_auth_server",label:"Authorization request with resource parameter",description:"Browser navigates to authorization endpoint",from:"browser",to:"authServer",details:e.authorizationUrl?[{label:"Note",value:"User authorizes in browser"}]:void 0},{id:"auth_redirect_to_browser",label:"Redirect to callback with authorization code",description:"Authorization Server redirects browser back to callback URL",from:"authServer",to:"browser",details:e.authorizationCode?[{label:"code",value:po(e.authorizationCode,20)}]:void 0},{id:"received_authorization_code",label:"Authorization code callback",description:"Browser redirects back to client with authorization code",from:"browser",to:"client",details:e.authorizationCode?[{label:"code",value:po(e.authorizationCode,20)}]:void 0},{id:"token_request",label:"Token request + code_verifier + resource",description:"Client exchanges authorization code for access token",from:"client",to:"authServer",details:e.codeVerifier?[{label:"grant_type",value:"authorization_code"},{label:"resource",value:dp(e,r,"")}]:void 0},{id:"received_access_token",label:"Access token (+ refresh token)",description:"Authorization Server returns access token",from:"authServer",to:"client",details:e.accessToken?[{label:"token_type",value:e.tokenType||"Bearer"},{label:"expires_in",value:e.expiresIn?.toString()||"3600"}]:void 0},{id:"authenticated_mcp_request",label:"MCP request with access token",description:"Client makes authenticated request to MCP server",from:"client",to:"mcpServer",details:e.accessToken?[{label:"POST",value:"tools/list"},{label:"Authorization",value:`Bearer ${po(e.accessToken,15)}`}]:void 0},{id:"complete",label:"MCP response",description:"MCP Server returns successful response",from:"mcpServer",to:"client",details:e.accessToken?[{label:"Status",value:"200 OK"},{label:"Content",value:"tools, resources, prompts"}]:void 0}]}function ve(e,t,r,s,n,i={}){const{level:o="info",error:a}=i;return[...e.infoLogs||[],{id:r,step:t,label:s,data:n,timestamp:Date.now(),level:o,error:a}]}function kN(e,t,r,s){return!r||r.source!=="prm"||r.strictClientCompatible&&r.rfc9728Compliant?t:ve({...e,infoLogs:t},"received_resource_metadata","resource-identifier-mismatch","Resource identifier mismatch",{"Advertised resource":r.value,"Server URL":s,Status:r.status,Reason:r.reason,"RFC 9728 compliant":r.rfc9728Compliant,...r.rfc9728Reason?{"RFC 9728 reason":r.rfc9728Reason}:{},Note:r.status==="valid"?"The flow will send this interoperability-safe resource, but it is not RFC 9728 compliant and strict conformance surfaces will reject it.":"The debugger will send the advertised resource as-is so you can observe real behavior, but MCP clients — including MCPJam's Quick OAuth and the official MCP SDK — validate it against the server URL and will refuse to connect."},{level:"warning"})}function ad(e,t,r,s){return ve({...e,infoLogs:t},r,"non-compliant-challenge-status","Non-compliant challenge status",{Received:`${s.status}${s.statusText?` ${s.statusText}`:""}`,Expected:"401 Unauthorized",Note:"The server sent a WWW-Authenticate Bearer challenge, so the debugger continues OAuth discovery from it. MCP requires 401 here — clients that decide to authenticate from the status code alone, including the official MCP SDK, will not start OAuth against this server."},{level:"warning"})}function $r(e){return e instanceof Error?{message:e.message,details:{name:e.name,stack:e.stack}}:typeof e=="string"?{message:e}:{message:"Unexpected error",details:e}}function wi(e,t){if(!e||e.length===0)return e||void 0;const r=[...e],s={...r[r.length-1]};return r[r.length-1]={...s,error:t,duration:s.duration!==void 0?s.duration:Date.now()-s.timestamp},r}function Vt(e,t={}){const r={},s=new Map,n=i=>{if(i)for(const[o,a]of Object.entries(i)){const c=o.toLowerCase(),l=s.get(c);l&&l!==o&&delete r[l],s.set(c,o),r[o]=a}};return n(e),n(t),r}function $t(e,t={}){const r=Vt(e,t);for(const s of Object.keys(r))s.toLowerCase()==="authorization"&&delete r[s];return r}function Zm(e,t,r,s={}){try{const n=new URL(e).origin;return new URL(t,e).origin===n?Vt(r,s):$t(r,s)}catch{return $t(r,s)}}function Rn(e){if(!e)return{};if(e instanceof Headers){const t={};return e.forEach((r,s)=>{t[s]=r}),t}return Array.isArray(e)?Object.fromEntries(e.map(([t,r])=>[t,String(r)])):Object.fromEntries(Object.entries(e).map(([t,r])=>[t,String(r)]))}function EN(e){if(typeof globalThis.btoa=="function"){const t=Array.from(e,r=>String.fromCharCode(r)).join("");return globalThis.btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}if(typeof Buffer<"u")return Buffer.from(e).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"");throw new Error("No base64 encoder available")}function $n(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=new Uint8Array(e);return crypto.getRandomValues(r),Array.from(r,s=>t[s%66]).join("")}async function cd(e){const t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return EN(new Uint8Array(r))}var ld="Authorization server metadata missing required 'issuer' field",TN=new Set(["2025-03-26"]),AN=new Set(["2025-03-26","2025-06-18"]);function IN(e){return!TN.has(e)}function RN(e){return!AN.has(e)}function ek(e,t){if(RN(t)){if(!e||e.length===0)return`PKCE is REQUIRED for ${t} protocol, but authorization server does not advertise code_challenge_methods_supported. Server is not compliant with ${t} spec.`;if(!e.includes("S256"))return`Authorization server advertises PKCE without S256 (advertised: ${e.join(", ")}). MCPJam will not downgrade to a weaker code challenge method, so the ${t} flow stops here. Use the OAuth debugger to observe this server's behavior without connecting.`}}function Qm(e){const t=e.authorizationServers?.find(r=>typeof r=="string"&&r.trim()!=="")?.trim();return t?{authorizationServerUrl:t,substituted:!1}:IN(e.protocolVersion)?{authorizationServerUrl:e.fallbackServerUrl,substituted:!0,error:`Protected resource metadata does not list an authorization server. RFC 9728 \`authorization_servers\` is required by the ${e.protocolVersion} MCP profile; without it there is no server authorized to issue tokens for this resource, and using the MCP server's own URL would invent one.`}:{authorizationServerUrl:e.fallbackServerUrl,substituted:!0}}var CN="io.modelcontextprotocol/oauth-client-credentials",PN="io.modelcontextprotocol/protocolVersion",xN="io.modelcontextprotocol/clientCapabilities",ON="io.modelcontextprotocol/clientInfo";function eg(e){switch(e){case"2025-11-25":return"2025-11-25";case"2026-07-28":return"2026-07-28";case"2025-06-18":case"2025-03-26":return"2024-11-05";default:return e}}function tk(e){return e!=="client_credentials"?{}:{extensions:{[CN]:{}}}}function Xr(e){return{jsonrpc:"2.0",method:"initialize",params:{protocolVersion:e.protocolVersion,capabilities:tk(e.authMode),clientInfo:{name:e.clientName,version:e.clientVersion}},id:e.id}}function cl(e){return{jsonrpc:"2.0",method:"tools/list",params:{_meta:{[PN]:e.protocolVersion,[xN]:tk(e.authMode),[ON]:{name:e.clientName,version:e.clientVersion}}},id:e.id}}var MN="***REDACTED***",LN=new Set(["client_secret","registration_access_token","access_token","refresh_token"]),ud="Authorization server metadata does not include a registration_endpoint. Configure a pre-registered client or use a different registration strategy.",dd="Authorization server metadata does not include a registration_endpoint required for DCR conformance.";function NN(e){const t=r=>{let s;try{s=new URL(r)}catch{return!0}if(s.protocol!=="http:"&&s.protocol!=="https:")return!0;if(s.protocol!=="http:")return!1;const n=s.hostname;return n==="localhost"||n==="127.0.0.1"||n==="[::1]"};return e.some(t)?"native":"web"}function pd(e){const{dynamicRegistrationDefaults:t}=e,r={...t,redirect_uris:t.redirect_uris??[e.redirectUri],grant_types:t.grant_types??["authorization_code","refresh_token"],response_types:t.response_types??["code"],token_endpoint_auth_method:t.token_endpoint_auth_method??"none"};return e.scope&&(r.scope=e.scope),{method:"POST",url:e.registrationEndpoint,headers:$t(e.customHeaders,{"Content-Type":"application/json"}),body:r}}function Wh(e){if(Array.isArray(e))return e.map(Wh);if(e&&typeof e=="object"){const t={};for(const[r,s]of Object.entries(e))t[r]=LN.has(r.toLowerCase())?MN:Wh(s);return t}return e}function $N(e){return{status:e.status,statusText:e.statusText,headers:{...e.headers},body:Wh(e.body)}}function O_(e,t){const r=[...e||[]];if(r.length>0){const s=r[r.length-1];r[r.length-1]={...s,response:t,duration:Date.now()-(s.timestamp||Date.now())}}return r}var jl="Configure a pre-registered client or enable DCR on the authorization server.";function c9(e){return/^Dynamic Client Registration failed \(\d{3}\)\./.test(e)}async function Pc(e){let t;try{t=await e.requestExecutor(e.request)}catch(o){const a=o instanceof Error?o.message:String(o),c={status:0,statusText:"Network Error",headers:{},body:{error:a}},l=`Client registration failed: ${a}`;return{status:"network_error",response:c,httpHistory:O_(e.httpHistory,c),error:l,fallbackNote:"Client registration failed; using pre-registered client credentials.",errorWithFallbackHint:`${l}. ${jl}`}}const r=$N({status:t.status,statusText:t.statusText,headers:t.headers,body:t.body}),s=O_(e.httpHistory,r);if(!t.ok){const o=`Dynamic Client Registration failed (${t.status}).`;return{status:"http_error",response:r,httpHistory:s,error:o,fallbackNote:`Dynamic Client Registration failed (${t.status}); using pre-registered client credentials.`,errorWithFallbackHint:`${o} ${jl}`}}const n=t.body;if(!n||typeof n!="object"||Array.isArray(n)){const o="Client registration failed: the registration response body was not a JSON object";return{status:"invalid_response",response:r,httpHistory:s,error:o,fallbackNote:"Client registration failed; using pre-registered client credentials.",errorWithFallbackHint:`${o}. ${jl}`}}const i={"Client ID":n.client_id,"Client Name":n.client_name,"Token Auth Method":n.token_endpoint_auth_method||"none","Redirect URIs":n.redirect_uris,"Grant Types":n.grant_types,"Response Types":n.response_types};return n.client_secret&&(i["Client Secret Issued"]=!0,i.Note="Server issued client_secret - this will be used in token requests"),{status:"registered",response:r,httpHistory:s,clientInfo:n,credentials:{clientId:typeof n.client_id=="string"?n.client_id:void 0,clientSecret:typeof n.client_secret=="string"?n.client_secret:void 0,tokenEndpointAuthMethod:typeof n.token_endpoint_auth_method=="string"?n.token_endpoint_auth_method:void 0,clientSecretExpiresAt:typeof n.client_secret_expires_at=="number"?n.client_secret_expires_at:void 0},missingClientId:typeof n.client_id!="string",nonCanonicalSuccessStatus:t.status!==201,infoLogData:i}}function hd(e){return e?.sendResourceIndicator!==!1}function Dn(e,t){const r=e?.scopeRequest;if(!r)return JC(t);switch(r.mode){case"omit":return;case"fixed":return r.scopes.join(" ");case"challenge":{const s=t.challengedScopes?.filter(Boolean)??[];return s.length>0?Array.from(new Set(s)).join(" "):void 0}case"all-supported":{const s=t.supportedScopes?.filter(Boolean)??[];return s.length>0?Array.from(new Set(s)).join(" "):void 0}}}function fd(e,t){if(!t)return e;const r={...e};return t.dcrClientName!==void 0&&(r.client_name=t.dcrClientName),t.tokenEndpointAuthMethod!==void 0&&(r.token_endpoint_auth_method=t.tokenEndpointAuthMethod),t.dcrRedirectUris!==void 0&&(r.redirect_uris=[...t.dcrRedirectUris]),r}function Un(e,t){return e?.tokenEndpointAuthMethod??t}function DN(e,t){return t?.userAgent?{...e??{},"User-Agent":t.userAgent}:e}function ki(e,t){return e?.mcpProtocolVersion??t}function UN(e,t){return od(e,t,{protocolVersion:"2025-03-26",includesProtectedResourceMetadata:!1,initialMcpMethod:"initialize",authorizationServerMetadata:{label:"GET /.well-known/oauth-authorization-server from MCP base URL",description:"Direct discovery from MCP server base URL with fallback to /authorize, /token, /register"},pkce:{label:"Generate PKCE parameters",description:"Client generates code verifier and challenge (recommended), includes resource parameter"},resourceValue:r=>r.serverUrl})}function qN(e){return new URL(e).origin}function M_(e){return Cc(e,Rc.legacy).map(({url:t})=>t)}var zN=e=>{const{state:t,getState:r,updateState:s,serverUrl:n,serverName:i,redirectUrl:o,requestExecutor:a,scheduleAutoAdvance:c,loadPreregisteredCredentials:l,dynamicRegistration:u,customScopes:p,customHeaders:d,authMode:h,hasClientSecret:f=!1,strictConformance:m=!1,registrationStrategy:v="dcr",emulation:_}=e,b=o,T=ki(_,"2025-03-26"),O=ki(_,eg("2025-03-26")),x=hd(_),D=fd(u??{},_);if(v==="dcr"&&!D.client_name)throw new Error("Dynamic registration metadata must include client_name");const z=()=>r?r():t,F=(R,fe={})=>a({url:R,method:fe.method||"GET",headers:Rn(fe.headers),body:fe.body}),J=R=>{const fe=td({authorizationServerMetadata:z().authorizationServerMetadata,hasClientSecret:!!(R||f)});if(!fe.ok)throw new Error(fe.message);return fe.method},ce=async R=>{const{clientId:fe,clientSecret:Y}=await l?.({serverName:i,serverUrl:n})??{};if(!fe)return;const me=J(Y),$={"Client ID":fe,"Client Secret":Y||f?"Configured":"Not provided (public client)","Token Auth Method":me,Note:R};return{clientId:fe,clientSecret:Y||void 0,tokenEndpointAuthMethod:me,infoLogs:ve(z(),"received_client_credentials","preregistered-fallback","Pre-registered Client",$)}},de={state:t,updateState:s,proceedToNextStep:async()=>{const R=z();s({isInitiatingAuth:!0});const fe=Y=>{c?.(()=>{de.proceedToNextStep()},Y)};try{switch(R.currentStep){case"idle":s({currentStep:"discovery_start",serverUrl:n,httpHistory:[],isInitiatingAuth:!1}),fe(50);return;case"request_without_token":if(!R.serverUrl)throw new Error("No server URL available");try{const B=await F(R.serverUrl,{method:"POST",headers:Vt(d,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":T}),body:JSON.stringify(Xr({protocolVersion:O,authMode:h,clientName:"MCP Inspector",clientVersion:"1.0.0",id:1}))}),pe={status:B.status,statusText:B.statusText,headers:B.headers,body:B.body},_e=[...R.httpHistory||[]];if(_e.length>0){const je=_e[_e.length-1];je.response=pe,je.duration=Date.now()-(je.timestamp||Date.now())}const ke=Hu({status:B.status,statusText:B.statusText,wwwAuthenticateHeader:B.headers["www-authenticate"],serverMessage:B.body?.error?.message});if(ke.kind==="challenged"||ke.kind==="anonymous_allowed"){let je=ke.kind==="anonymous_allowed"?ve(R,"discovery_start","optional-auth","Optional Authentication",{message:"Server allows anonymous access",note:"Proceeding with OAuth discovery for authenticated features"}):R.infoLogs;ke.kind==="challenged"&&!ke.specCompliant&&(je=ad(R,je,"discovery_start",pe)),s({currentStep:"discovery_start",lastResponse:pe,httpHistory:_e,infoLogs:je,isInitiatingAuth:!1})}else throw s({lastResponse:pe,httpHistory:_e}),new Mn(ke.message,B.status)}catch(B){throw B instanceof Mn?B:new Error(`Failed to request MCP server: ${B instanceof Error?B.message:String(B)}`)}break;case"discovery_start":const Y=R.serverUrl,me={method:"GET",url:M_(Y)[0],headers:$t(d,{})};s({currentStep:"request_authorization_server_metadata",authorizationServerUrl:Y,lastRequest:me,lastResponse:void 0,httpHistory:[...R.httpHistory||[],{step:"request_authorization_server_metadata",timestamp:Date.now(),request:me}],isInitiatingAuth:!1}),fe(50);return;case"request_authorization_server_metadata":if(!R.authorizationServerUrl)throw new Error("No authorization server URL available");const $=M_(R.authorizationServerUrl);let le=null,y=null;for(const B of $)try{const pe=$t(d,{"MCP-Protocol-Version":"2025-03-26"}),_e=[...R.httpHistory||[]];_e.length>0&&(_e[_e.length-1].request={method:"GET",url:B,headers:pe}),s({lastRequest:{method:"GET",url:B,headers:pe},httpHistory:_e});const ke=await F(B,{method:"GET",headers:pe});if(ke.ok){le=ke.body,y=ke;break}else if(ke.status>=400&&ke.status<500)continue}catch{continue}if(!le){const B=qN(R.authorizationServerUrl);le={issuer:B,authorization_endpoint:`${B}/authorize`,token_endpoint:`${B}/token`,registration_endpoint:`${B}/register`,response_types_supported:["code"],grant_types_supported:["authorization_code","refresh_token"],code_challenge_methods_supported:["S256"]};const pe=ve(z(),"received_authorization_server_metadata","fallback-endpoints","Using Fallback Endpoints",{Note:"Metadata discovery failed, using default endpoints per 2025-03-26 spec","Authorization Endpoint":le.authorization_endpoint,"Token Endpoint":le.token_endpoint,"Registration Endpoint":le.registration_endpoint});s({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:le,infoLogs:pe,isInitiatingAuth:!1});break}if(!le.issuer)throw new Error(ld);if(!le.authorization_endpoint)throw new Error("Authorization server metadata missing 'authorization_endpoint'");if(!le.token_endpoint)throw new Error("Authorization server metadata missing 'token_endpoint'");if(!le.response_types_supported?.includes("code"))throw new Error("Authorization server does not support 'code' response type");const Q={status:y.status,statusText:y.statusText,headers:y.headers,body:le},ne=[...R.httpHistory||[]];if(ne.length>0){const B=ne[ne.length-1];B.response=Q,B.duration=Date.now()-(B.timestamp||Date.now())}const H=le.code_challenge_methods_supported||[];(!H||H.length===0||!H.includes("S256"))&&console.warn("Authorization server may not support PKCE S256 (REQUIRED for 2025-03-26 spec)"),s({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:le,lastResponse:Q,httpHistory:ne,isInitiatingAuth:!1});break;case"received_authorization_server_metadata":if(!R.authorizationServerMetadata)throw new Error("No authorization server metadata available");if(v==="preregistered"){const{clientId:B,clientSecret:pe}=await l?.({serverName:i,serverUrl:n})??{};if(!B){s({error:"Pre-registered client ID is required. Please configure OAuth credentials in the server settings.",isInitiatingAuth:!1});return}const _e=J(pe),ke={"Client ID":B,"Client Secret":pe||f?"Configured":"Not provided (public client)","Token Auth Method":_e,Note:"Using pre-registered client credentials (skipped DCR)"},je=ve(z(),"received_client_credentials","dcr","Pre-registered Client",ke);s({currentStep:"received_client_credentials",clientId:B,clientSecret:pe||void 0,tokenEndpointAuthMethod:_e,infoLogs:je,isInitiatingAuth:!1})}else if(R.authorizationServerMetadata.registration_endpoint){const B=R.authorizationServerMetadata.scopes_supported,pe=Dn(_,{customScopes:p,supportedScopes:B}),_e=pd({registrationEndpoint:R.authorizationServerMetadata.registration_endpoint,redirectUri:b,dynamicRegistrationDefaults:D,scope:pe,customHeaders:d});s({currentStep:"request_client_registration",lastRequest:_e,lastResponse:void 0,httpHistory:[...R.httpHistory||[],{step:"request_client_registration",timestamp:Date.now(),request:_e}],isInitiatingAuth:!1}),fe(50);return}else{if(m){s({error:dd,isInitiatingAuth:!1});return}const B=await ce("Authorization server did not advertise registration_endpoint; using pre-registered client credentials.");if(!B){s({error:ud,isInitiatingAuth:!1});return}s({currentStep:"received_client_credentials",clientId:B.clientId,clientSecret:B.clientSecret,tokenEndpointAuthMethod:B.tokenEndpointAuthMethod,infoLogs:B.infoLogs,error:void 0,isInitiatingAuth:!1})}break;case"request_client_registration":if(!R.authorizationServerMetadata?.registration_endpoint)throw new Error("No registration endpoint available");if(!R.lastRequest?.body)throw new Error("No client metadata in request");{const B=await Pc({request:R.lastRequest,requestExecutor:a,httpHistory:R.httpHistory});if(B.status!=="registered"){if(s({lastResponse:B.response,httpHistory:B.httpHistory,error:B.error}),m){B.status==="invalid_response"&&s({isInitiatingAuth:!1});return}const _e=await ce(B.fallbackNote);if(!_e){s({error:B.errorWithFallbackHint,isInitiatingAuth:!1});return}s({currentStep:"received_client_credentials",clientId:_e.clientId,clientSecret:_e.clientSecret,tokenEndpointAuthMethod:_e.tokenEndpointAuthMethod,infoLogs:_e.infoLogs,error:void 0,isInitiatingAuth:!1});break}if(B.missingClientId){s({lastResponse:B.response,httpHistory:B.httpHistory,error:"Dynamic Client Registration response is missing a client_id.",isInitiatingAuth:!1});return}const pe=ve(z(),"received_client_credentials","dcr","Dynamic Client Registration",B.infoLogData);s({currentStep:"received_client_credentials",clientId:B.credentials.clientId,clientSecret:B.credentials.clientSecret,tokenEndpointAuthMethod:rd(B.clientInfo),lastResponse:B.response,httpHistory:B.httpHistory,infoLogs:pe,error:void 0,isInitiatingAuth:!1})}break;case"received_client_credentials":const I=$n(43),ee=await cd(I),oe=ve(z(),"generate_pkce_parameters","pkce-generation","Generate PKCE Parameters (REQUIRED)",{code_challenge:ee,method:"S256",...x?{resource:R.serverUrl||"Unknown"}:{resource:"(omitted — emulated client does not send RFC 8707 resource)"},note:"PKCE is REQUIRED for all clients in 2025-03-26 spec"});s({currentStep:"generate_pkce_parameters",codeVerifier:I,codeChallenge:ee,codeChallengeMethod:"S256",...x?{}:{resourceIndicatorSuppressed:!0},state:$n(16),infoLogs:oe,isInitiatingAuth:!1});break;case"generate_pkce_parameters":if(!R.authorizationServerMetadata?.authorization_endpoint||!R.clientId)throw new Error("Missing authorization endpoint or client ID");const he=new URL(R.authorizationServerMetadata.authorization_endpoint);he.searchParams.set("response_type","code"),he.searchParams.set("client_id",R.clientId),he.searchParams.set("redirect_uri",b),he.searchParams.set("code_challenge",R.codeChallenge||""),he.searchParams.set("code_challenge_method","S256"),he.searchParams.set("state",R.state||""),R.serverUrl&&x&&he.searchParams.set("resource",R.serverUrl);const ue=Dn(_,{customScopes:p,supportedScopes:R.authorizationServerMetadata.scopes_supported});ue&&he.searchParams.set("scope",ue);const Ge=ve(z(),"authorization_request","auth-url","Authorization URL",{url:he.toString()});s({currentStep:"authorization_request",authorizationUrl:he.toString(),authorizationCode:void 0,accessToken:void 0,refreshToken:void 0,tokenType:void 0,expiresIn:void 0,infoLogs:Ge,isInitiatingAuth:!1});break;case"authorization_request":s({currentStep:"received_authorization_code",isInitiatingAuth:!1});break;case"received_authorization_code":{if(!R.authorizationCode||R.authorizationCode.trim()===""){s({error:"Authorization code is required. Please paste the code you received from the authorization server.",isInitiatingAuth:!1});return}if(!R.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");const B=Ln({clientId:R.clientId,clientSecret:R.clientSecret,tokenEndpointAuthMethod:Un(_,R.tokenEndpointAuthMethod)}),pe={grant_type:"authorization_code",code:R.authorizationCode,redirect_uri:b,...B.bodyParams};R.codeVerifier&&(pe.code_verifier=R.codeVerifier),R.serverUrl&&x&&(pe.resource=R.serverUrl);const _e={method:"POST",url:R.authorizationServerMetadata.token_endpoint,headers:{"Content-Type":"application/x-www-form-urlencoded",...B.headers},body:pe};s({currentStep:"token_request",lastRequest:_e,lastResponse:void 0,...x?{}:{resourceIndicatorSuppressed:!0},accessToken:void 0,refreshToken:void 0,httpHistory:[...R.httpHistory||[],{step:"token_request",timestamp:Date.now(),request:_e}],isInitiatingAuth:!1}),fe(50);return}case"token_request":if(!R.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");if(!R.authorizationCode)throw new Error("Missing authorization code");if(!R.codeVerifier)throw new Error("PKCE code_verifier is missing - REQUIRED by 2025-03-26 spec for token exchange");try{const B=Ln({clientId:R.clientId,clientSecret:R.clientSecret,tokenEndpointAuthMethod:Un(_,R.tokenEndpointAuthMethod)}),pe=new URLSearchParams({grant_type:"authorization_code",code:R.authorizationCode,redirect_uri:b,code_verifier:R.codeVerifier||"",...B.bodyParams});R.serverUrl&&x&&pe.set("resource",R.serverUrl);const _e=await F(R.authorizationServerMetadata.token_endpoint,{method:"POST",headers:{...$t(d,{"Content-Type":"application/x-www-form-urlencoded"}),...B.headers},body:pe.toString()}),ke={status:_e.status,statusText:_e.statusText,headers:_e.headers,body:_e.body},je=[...R.httpHistory||[]];if(je.length>0){const Ee=je[je.length-1];Ee.response=ke,Ee.duration=Date.now()-(Ee.timestamp||Date.now())}if(!_e.ok){s({lastResponse:ke,httpHistory:je,authorizationCode:void 0,error:nd(_e),isInitiatingAuth:!1});return}const xe=_e.body;let Oe=(z().infoLogs||[]).filter(Ee=>Ee.id!=="auth-code"&&Ee.id!=="oauth-tokens"&&Ee.id!=="token");if(R.authorizationCode&&(Oe=[...Oe,{id:"auth-code",level:"info",step:"received_authorization_code",label:"Authorization Code",data:{code:R.authorizationCode},timestamp:Date.now()}]),xe.access_token){const Ee={access_token:xe.access_token};xe.refresh_token&&(Ee.refresh_token=xe.refresh_token),Oe=[...Oe,{id:"oauth-tokens",level:"info",step:"received_access_token",label:"OAuth Tokens",data:Ee,timestamp:Date.now()}]}if(xe.access_token){const Ee=Nn(xe.access_token);if(Ee){const Ae={...Ee};Ae.exp&&(Ae.exp=`${Ae.exp} (${Ye(Ae.exp)})`),Ae.iat&&(Ae.iat=`${Ae.iat} (${Ye(Ae.iat)})`),Ae.nbf&&(Ae.nbf=`${Ae.nbf} (${Ye(Ae.nbf)})`);const Me={...Ae};if(Ae.aud){const et=R.serverUrl,K=(Array.isArray(Ae.aud)?Ae.aud:[Ae.aud]).some(ie=>ie===et);Me._validation={expected_audience:et,audience_matches:K,note:K?"✓ Token audience matches MCP server":"⚠ Token audience does not match MCP server (security risk)"}}else Me._validation={note:"⚠ No audience claim found - server should validate token binding"};Oe=[...Oe,{id:"token",step:"received_access_token",level:"info",label:"Access Token (Decoded JWT)",data:Me,timestamp:Date.now()}]}}if(xe.id_token){const Ee=Nn(xe.id_token);if(Ee){const Ae={...Ee};Ae.exp&&(Ae.exp=`${Ae.exp} (${Ye(Ae.exp)})`),Ae.iat&&(Ae.iat=`${Ae.iat} (${Ye(Ae.iat)})`),Ae.nbf&&(Ae.nbf=`${Ae.nbf} (${Ye(Ae.nbf)})`),Ae.auth_time&&(Ae.auth_time=`${Ae.auth_time} (${Ye(Ae.auth_time)})`),Ae._note="OIDC ID Token - Used for user identity verification",Oe=[...Oe,{id:"id-token",step:"received_access_token",level:"info",label:"ID Token (OIDC - Decoded JWT)",data:Ae,timestamp:Date.now()}]}}s({currentStep:"received_access_token",accessToken:xe.access_token,refreshToken:xe.refresh_token,tokenType:xe.token_type||"Bearer",expiresIn:xe.expires_in,lastResponse:ke,httpHistory:je,infoLogs:Oe,error:void 0,isInitiatingAuth:!1})}catch(B){const pe={status:0,statusText:"Network Error",headers:{},body:{error:B instanceof Error?B.message:String(B)}},_e=[...R.httpHistory||[]];if(_e.length>0){const ke=_e[_e.length-1];ke.response=pe,ke.duration=Date.now()-(ke.timestamp||Date.now())}s({lastResponse:pe,httpHistory:_e,error:`Token exchange failed: ${B instanceof Error?B.message:String(B)}`,isInitiatingAuth:!1})}break;case"received_access_token":if(!R.serverUrl||!R.accessToken)throw new Error("Missing server URL or access token");const Ve={method:"POST",url:R.serverUrl,headers:{Authorization:`Bearer ${R.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream"},body:Xr({protocolVersion:O,authMode:h,clientName:"MCP Inspector",clientVersion:"1.0.0",id:2})},Ce=ve(z(),"authenticated_mcp_request","authenticated-init","Authenticated MCP Initialize Request",{Request:"MCP initialize with OAuth bearer token","Protocol Version":"2025-03-26",Client:"MCP Inspector v1.0.0",Endpoint:R.serverUrl});s({currentStep:"authenticated_mcp_request",lastRequest:Ve,lastResponse:void 0,httpHistory:[...R.httpHistory||[],{step:"authenticated_mcp_request",timestamp:Date.now(),request:Ve}],infoLogs:Ce,isInitiatingAuth:!1}),fe(50);return;case"authenticated_mcp_request":if(!R.serverUrl||!R.accessToken)throw new Error("Missing server URL or access token");try{const B=await F(R.serverUrl,{method:"POST",headers:Vt(d,{Authorization:`Bearer ${R.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream"}),body:JSON.stringify(Xr({protocolVersion:O,authMode:h,clientName:"MCP Inspector",clientVersion:"1.0.0",id:2}))}),pe={status:B.status,statusText:B.statusText,headers:B.headers,body:B.body},_e=[...R.httpHistory||[]];if(_e.length>0){const Ee=_e[_e.length-1];Ee.response=pe,Ee.duration=Date.now()-(Ee.timestamp||Date.now())}if(!B.ok){if(B.status>=400&&B.status<500)try{const Ee={method:"GET",url:R.serverUrl,headers:{Authorization:`Bearer ${R.accessToken}`,Accept:"text/event-stream"}},Ae={step:"complete",timestamp:Date.now(),request:Ee};_e.push(Ae);const Me=await F(R.serverUrl,{method:"GET",headers:{Authorization:`Bearer ${R.accessToken}`,Accept:"text/event-stream"}});Ae.response={status:Me.status,statusText:Me.statusText,headers:Me.headers,body:Me.body},Ae.duration=Date.now()-Ae.timestamp;const et=Me.body;if(et&&typeof et=="object"&&et.isOldTransport&&et.endpoint){const K=et.endpoint,ie=new URL(K,R.serverUrl).toString(),A=ve(z(),"authenticated_mcp_request","http-sse-detected","HTTP+SSE Transport Detected (2024-11-05)",{Transport:"HTTP+SSE (2024-11-05 - Deprecated)","SSE Stream URL":R.serverUrl,"POST Endpoint":ie,"First Event":et.events?.[0],"Migration Note":"This transport is deprecated. Please update your server to use the 2025-03-26 Streamable HTTP transport.","How It Works":"Client connected via GET for SSE stream. Subsequent requests use POST to: "+ie});s({currentStep:"complete",lastResponse:{status:Me.status,statusText:"OK - HTTP+SSE Transport",headers:Me.headers,body:{transport:"HTTP+SSE (2024-11-05)",sseStreamUrl:R.serverUrl,postEndpoint:ie,events:et.events}},httpHistory:_e,infoLogs:A,error:void 0,isInitiatingAuth:!1});return}}catch(Ee){console.error("GET fallback failed:",Ee)}s({lastResponse:pe,httpHistory:_e,error:sd(B),isInitiatingAuth:!1});return}let ke=z().infoLogs||[];const je=B.headers["content-type"]||"",xe=je.includes("text/event-stream");let Oe=null;if(xe&&B.body?.transport==="sse"?Oe=B.body.mcpResponse:Oe=B.body,xe&&Oe?.result?.protocolVersion){const Ee={Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Protocol Version":Oe.result.protocolVersion};Oe.result.serverInfo&&(Ee["Server Name"]=Oe.result.serverInfo.name,Ee["Server Version"]=Oe.result.serverInfo.version),Oe.result.capabilities&&(Ee.Capabilities=Oe.result.capabilities),ke=ve(z(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",Ee)}else if(xe)ke=ve(z(),"authenticated_mcp_request","mcp-transport","MCP Transport Detected",{Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Content-Type":je,Note:"Server returned streaming response. Initialize response delivered via SSE stream.",Events:B.body?.events?`${B.body.events.length} events parsed`:"No events parsed"});else if(Oe?.result?.protocolVersion){const Ee={Transport:"Streamable HTTP","Response Format":"JSON","Protocol Version":Oe.result.protocolVersion};Oe.result.serverInfo&&(Ee["Server Name"]=Oe.result.serverInfo.name,Ee["Server Version"]=Oe.result.serverInfo.version),Oe.result.capabilities&&(Ee.Capabilities=Oe.result.capabilities),ke=ve(z(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",Ee)}s({currentStep:"complete",lastResponse:pe,httpHistory:_e,infoLogs:ke,error:void 0,isInitiatingAuth:!1})}catch(B){const pe=$r(B),_e={status:0,statusText:"Network Error",headers:{},body:{error:pe.message,details:pe.details}},ke=[...R.httpHistory||[]];if(ke.length>0){const Oe={...ke[ke.length-1],response:_e,duration:Date.now()-(ke[ke.length-1]?.timestamp||Date.now()),error:pe};ke[ke.length-1]=Oe}const je=z(),xe=ve(je,"authenticated_mcp_request",`error-authenticated_mcp_request-${Date.now()}`,"Authenticated MCP request failed",{request:je.lastRequest,error:pe},{level:"error",error:pe});s({lastResponse:_e,httpHistory:ke,infoLogs:xe,error:`Authenticated MCP request failed: ${pe.message}`,isInitiatingAuth:!1})}break;case"complete":s({isInitiatingAuth:!1});break;default:s({isInitiatingAuth:!1})}}catch(Y){const me=z(),$=$r(Y),le=ve(me,me.currentStep,`error-${me.currentStep}-${Date.now()}`,"Step failed",{step:me.currentStep,request:me.lastRequest,response:me.lastResponse,error:$},{level:"error",error:$}),y=wi(me.httpHistory,$),Q={error:$.message,infoLogs:le,isInitiatingAuth:!1};y&&(Q.httpHistory=y),s(Q)}},startGuidedFlow:async()=>{s({currentStep:"idle",isInitiatingAuth:!1})},resetFlow:()=>{s(id())}};return de};function tg(e){return tN(e)[0]}var L_="Could not discover authorization server metadata.",FN=new Set(["OAuthOutboundUrlBlockedError","OAuthRedactedCredentialError"]);function rg(e){return e instanceof Error&&FN.has(e.name)}function N_(e,t){if(e){for(const[r,s]of Object.entries(e))if(r.toLowerCase()===t)return s}}function jN(e){return e==null?!0:typeof e=="string"?e.trim()==="":typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0}function sg(e,t){const{status:r,body:s}=t;if(r>=200&&r<300){if(jN(s))return{kind:"attempt",attempt:{url:e,status:r}};if(typeof s=="object"&&!Array.isArray(s))return{kind:"document",document:s};const n=N_(t.headers,"content-type")?.split(";")[0]?.trim();return{kind:"attempt",attempt:{url:e,status:r,notJson:n?{contentType:n}:{}}}}if(r>=300&&r<400){const n=N_(t.headers,"location");if(n)return{kind:"attempt",attempt:{url:e,status:r,location:n}}}return{kind:"attempt",attempt:{url:e,status:r}}}function HN(e){if("error"in e){const r=e.error instanceof Error?e.error.message:String(e.error);return`${e.url} failed: ${r}`}const t=`${e.url} returned HTTP ${e.status}`;return e.location?`${t} redirecting to ${e.location}, which discovery does not follow`:e.notJson?`${t} with ${e.notJson.contentType??"a body"} that is not a JSON metadata document`:e.status>=200&&e.status<300?`${t} with no metadata document`:t}function ng(e){return e.length===0?`${L_} No well-known URL was tried.`:`${L_} ${e.map(HN).join("; ")}.`}function Vo(e,t){return Q1({serverUrl:e.serverUrl??t,prmResource:e.resourceMetadata?.resource,resolved:e.resourceIndicator})}function ig(e){const t=e.state.serverUrl??e.fallbackServerUrl,r=e.prmResource?.trim();if(!r){const o='Protected Resource Metadata is missing its required "resource" identifier (RFC 9728 §2).';if(e.enforcement!=="warn")throw new Error(o);return{resourceIndicator:Bh({serverUrl:t}),infoLogs:ve({...e.state,infoLogs:e.infoLogs},"received_resource_metadata","resource-identifier-mismatch","Resource identifier missing",{"Server URL":t,Reason:o,Note:"The debugger will fall back to the server URL as the resource indicator, but strict MCP clients treat this metadata as invalid."},{level:"warning"})}}const s=Bh({serverUrl:t,prmResource:r}),n=e.enforcement!=="warn"&&s.status!=="valid",i=e.enforcement==="reject-rfc9728"&&!s.rfc9728Compliant;if(s.source==="prm"&&(n||i))throw new Error((i?s.rfc9728Reason:void 0)??s.reason??"Protected Resource Metadata advertises an unusable resource identifier.");return{resourceIndicator:s,infoLogs:kN(e.state,e.infoLogs,s,t)}}var BN=e=>Vo(e);function VN(e,t){return od(e,t,{protocolVersion:"2025-06-18",includesProtectedResourceMetadata:!0,initialMcpMethod:"initialize",authorizationServerMetadata:{label:"GET Authorization server metadata endpoint",description:"Try RFC8414 path, then RFC8414 root (no OIDC support)"},pkce:{label:"Generate PKCE parameters",description:"Client generates code verifier and challenge (recommended), includes resource parameter"},resourceValue:BN})}function $_(e){return Cc(e,Rc.legacy).map(({url:t})=>t)}var GN=e=>{const{state:t,getState:r,updateState:s,serverUrl:n,serverName:i,redirectUrl:o,requestExecutor:a,scheduleAutoAdvance:c,loadPreregisteredCredentials:l,dynamicRegistration:u,customScopes:p,customHeaders:d,resourceMetadataUrl:h,authMode:f,hasClientSecret:m=!1,strictConformance:v=!1,resourceIndicatorEnforcement:_="warn",requiredMetadataEnforcement:b="reject",registrationStrategy:T="dcr",emulation:O}=e,x=o,D=ki(O,"2025-06-18"),z=ki(O,eg("2025-06-18")),F=hd(O),J=fd(u??{},O);if(T==="dcr"&&!J.client_name)throw new Error("Dynamic registration metadata must include client_name");const ce=()=>r?r():t,de=()=>Vo(ce(),n),R=($,le={})=>a({url:$,method:le.method||"GET",headers:Rn(le.headers),body:le.body}),fe=$=>{const le=td({authorizationServerMetadata:ce().authorizationServerMetadata,hasClientSecret:!!($||m)});if(!le.ok)throw new Error(le.message);return le.method},Y=async $=>{const{clientId:le,clientSecret:y}=await l?.({serverName:i,serverUrl:n})??{};if(!le)return;const Q=fe(y),ne={"Client ID":le,"Client Secret":y||m?"Configured":"Not provided (public client)","Token Auth Method":Q,Note:$};return{clientId:le,clientSecret:y||void 0,tokenEndpointAuthMethod:Q,infoLogs:ve(ce(),"received_client_credentials","preregistered-fallback","Pre-registered Client",ne)}},me={state:t,updateState:s,proceedToNextStep:async()=>{const $=ce();s({isInitiatingAuth:!0});const le=y=>{c?.(()=>{me.proceedToNextStep()},y)};try{switch($.currentStep){case"idle":{const K=Vt(d,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":D}),ie=Xr({protocolVersion:z,authMode:f,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}),A={method:"POST",url:n,headers:K,body:ie};s({currentStep:"request_without_token",serverUrl:n,lastRequest:A,lastResponse:void 0,httpHistory:[...$.httpHistory||[],{step:"request_without_token",timestamp:Date.now(),request:A}],isInitiatingAuth:!1}),le(50);return}case"request_without_token":if(!$.serverUrl)throw new Error("No server URL available");try{const K=await R($.serverUrl,{method:"POST",headers:Vt(d,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":D}),body:JSON.stringify(Xr({protocolVersion:z,authMode:f,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}))}),ie={status:K.status,statusText:K.statusText,headers:K.headers,body:K.body},A=[...$.httpHistory||[]];if(A.length>0){const E=A[A.length-1];E.response=ie,E.duration=Date.now()-(E.timestamp||Date.now())}const g=Hu({status:K.status,statusText:K.statusText,wwwAuthenticateHeader:K.headers["www-authenticate"],serverMessage:K.body?.error?.message});if(g.kind==="challenged"){const E=K.headers["www-authenticate"],k=Gs(E),C=_m(k.scope);let q=E?ve($,"received_401_unauthorized","www-authenticate","WWW-Authenticate Header",{header:E,...C&&C.length>0?{scope:C.join(" ")}:{},"Received from":$.serverUrl||"Unknown"}):$.infoLogs;g.specCompliant||(q=ad($,q,"received_401_unauthorized",ie)),s({currentStep:"received_401_unauthorized",wwwAuthenticateHeader:E||void 0,challengedScopes:C,lastResponse:ie,httpHistory:A,infoLogs:q,isInitiatingAuth:!1})}else if(g.kind==="anonymous_allowed"){const E=ve($,"received_401_unauthorized","optional-auth","Optional Authentication Detected",{message:"Server allows anonymous access",note:"Proceeding with OAuth discovery for authenticated features"});s({currentStep:"received_401_unauthorized",wwwAuthenticateHeader:void 0,challengedScopes:void 0,lastResponse:ie,httpHistory:A,infoLogs:E,isInitiatingAuth:!1})}else throw s({lastResponse:ie,httpHistory:A}),new Mn(g.message,K.status)}catch(K){throw K instanceof Mn?K:new Error(`Failed to request MCP server: ${K instanceof Error?K.message:String(K)}`)}break;case"received_401_unauthorized":{const K=Gs($.wwwAuthenticateHeader);let ie=h||K.resource_metadata;if(!ie&&$.serverUrl&&(ie=tg($.serverUrl)),!ie)throw new Error("Could not determine resource metadata URL");const A={method:"GET",url:ie,headers:Vt(d,{})};s({currentStep:"request_resource_metadata",resourceMetadataUrl:ie,lastRequest:A,lastResponse:void 0,httpHistory:[...$.httpHistory||[],{step:"request_resource_metadata",timestamp:Date.now(),request:A}],isInitiatingAuth:!1}),le(50);return}case"request_resource_metadata":if(!$.serverUrl)throw new Error("No server URL available");const y=[...$.httpHistory||[]];let Q=y.length>0&&y[y.length-1]?.step==="request_resource_metadata"&&!y[y.length-1]?.response?y.pop():void 0;const ne=[],H=K=>{if(!K)return{};if(K instanceof Headers){const ie={};return K.forEach((A,g)=>{ie[g]=A}),ie}return Array.isArray(K)?Object.fromEntries(K):Object.fromEntries(Object.entries(K).map(([ie,A])=>[ie,String(A)]))},I=async(K,ie={})=>{const A=typeof K=="string"?K:K.toString(),g=Zm(n,A,d,H(ie.headers)),E=Q?{...Q,timestamp:Date.now(),request:{method:ie.method||"GET",url:A,headers:g,body:ie.body}}:{step:"request_resource_metadata",timestamp:Date.now(),request:{method:ie.method||"GET",url:A,headers:g,body:ie.body}};Q=void 0,ne.push(E);try{const k=await R(A,{method:ie.method||"GET",headers:g,body:ie.body});E.response={status:k.status,statusText:k.statusText,headers:k.headers,body:k.body},E.duration=Date.now()-E.timestamp;const C={status:k.status,statusText:k.statusText,headers:k.headers},q=typeof k.body=="string"?k.body:JSON.stringify(k.body??{});return new Response(q,C)}catch(k){throw E.error=$r(k),E.duration=Date.now()-E.timestamp,k}};try{const K=(h||Gs($.wwwAuthenticateHeader).resource_metadata)&&$.resourceMetadataUrl?{resourceMetadataUrl:$.resourceMetadataUrl}:void 0,ie=await ed($.serverUrl,K,I),A=[...y,...ne],g=ne[ne.length-1],E=Qm({authorizationServers:ie.authorization_servers,fallbackServerUrl:n,protocolVersion:"2025-06-18"}),k=E.authorizationServerUrl;if(E.error&&b!=="observe"){s({resourceMetadata:ie,resourceMetadataUrl:g?.request?.url||$.resourceMetadataUrl,lastRequest:g?.request,lastResponse:g?.response,httpHistory:A,error:E.error,isInitiatingAuth:!1});return}let C=$.infoLogs??[];E.error&&(C=ve({...ce(),infoLogs:C},"received_resource_metadata","authorization-server-substituted","Derived: Authorization Server (not advertised)",{Finding:E.error,"Using instead":k}));const{resourceIndicator:q,infoLogs:U}=ig({state:$,fallbackServerUrl:n,prmResource:ie.resource,enforcement:_,infoLogs:C});s({currentStep:"received_resource_metadata",resourceMetadata:ie,resourceIndicator:q,resourceMetadataUrl:g?.request?.url||$.resourceMetadataUrl,authorizationServerUrl:k,lastRequest:g?.request,lastResponse:g?.response,httpHistory:A,infoLogs:U,isInitiatingAuth:!1})}catch(K){const ie=wi([...y,...ne],$r(K));throw s({lastResponse:ne[ne.length-1]?.response,httpHistory:ie}),new Error(Qu(K))}break;case"received_resource_metadata":if(!$.authorizationServerUrl)throw new Error("No authorization server URL available");const ee={method:"GET",url:$_($.authorizationServerUrl)[0],headers:$t(d,{})};s({currentStep:"request_authorization_server_metadata",lastRequest:ee,lastResponse:void 0,httpHistory:[...$.httpHistory||[],{step:"request_authorization_server_metadata",timestamp:Date.now(),request:ee}],isInitiatingAuth:!1}),le(50);return;case"request_authorization_server_metadata":if(!$.authorizationServerUrl)throw new Error("No authorization server URL available");const oe=$_($.authorizationServerUrl);let he=null;const ue=[];let Ge={},Ve=null;for(const K of oe)try{const ie=$t(d,{}),A=[...$.httpHistory||[]];A.length>0&&(A[A.length-1].request={method:"GET",url:K,headers:ie}),s({lastRequest:{method:"GET",url:K,headers:ie},httpHistory:A});const g=await R(K,{method:"GET",headers:$t(d,{})}),E=sg(K,g);if(E.kind==="document"){he=E.document,Ge=g.headers,Ve=g;break}ue.push(E.attempt)}catch(ie){if(rg(ie))throw ie;ue.push({url:K,error:ie});continue}if(!he||!Ve)throw new Error(ng(ue));if(!he.issuer)throw new Error(ld);if(!he.authorization_endpoint)throw new Error("Authorization server metadata missing 'authorization_endpoint'");if(!he.token_endpoint)throw new Error("Authorization server metadata missing 'token_endpoint'");if(!he.response_types_supported?.includes("code"))throw new Error("Authorization server does not support 'code' response type");const Ce={status:Ve.status,statusText:Ve.statusText,headers:Ge,body:he},B=[...$.httpHistory||[]];B.length>0&&(B[B.length-1].response=Ce);const pe=he.code_challenge_methods_supported||[];pe.includes("S256")?s({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:he,lastResponse:Ce,httpHistory:B,isInitiatingAuth:!1}):(console.warn("Authorization server may not support S256 PKCE method. Supported methods:",pe),s({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:he,lastResponse:Ce,httpHistory:B,error:"Warning: Authorization server may not support S256 PKCE method",isInitiatingAuth:!1}));break;case"received_authorization_server_metadata":if(!$.authorizationServerMetadata)throw new Error("No authorization server metadata available");if(T==="preregistered"){const{clientId:K,clientSecret:ie}=await l?.({serverName:i,serverUrl:n})??{};if(!K){s({error:"Pre-registered client ID is required. Please configure OAuth credentials in the server settings.",isInitiatingAuth:!1});return}const A=fe(ie),g={"Client ID":K,"Client Secret":ie||m?"Configured":"Not provided (public client)","Token Auth Method":A,Note:"Using pre-registered client credentials from server config (skipped DCR)"},E=ve(ce(),"received_client_credentials","dcr","Pre-registered Client",g);s({currentStep:"received_client_credentials",clientId:K,clientSecret:ie||void 0,tokenEndpointAuthMethod:A,infoLogs:E,isInitiatingAuth:!1})}else if($.authorizationServerMetadata.registration_endpoint){const K=$.resourceMetadata?.scopes_supported||$.authorizationServerMetadata.scopes_supported,ie=Dn(O,{customScopes:p,challengedScopes:$.challengedScopes,supportedScopes:K}),A=pd({registrationEndpoint:$.authorizationServerMetadata.registration_endpoint,redirectUri:x,dynamicRegistrationDefaults:J,scope:ie,customHeaders:d});s({currentStep:"request_client_registration",lastRequest:A,lastResponse:void 0,httpHistory:[...$.httpHistory||[],{step:"request_client_registration",timestamp:Date.now(),request:A}],isInitiatingAuth:!1}),le(50);return}else{if(v){s({error:dd,isInitiatingAuth:!1});return}const K=await Y("Authorization server did not advertise registration_endpoint; using pre-registered client credentials.");if(!K){s({error:ud,isInitiatingAuth:!1});return}s({currentStep:"received_client_credentials",clientId:K.clientId,clientSecret:K.clientSecret,tokenEndpointAuthMethod:K.tokenEndpointAuthMethod,infoLogs:K.infoLogs,error:void 0,isInitiatingAuth:!1})}break;case"request_client_registration":{if(!$.authorizationServerMetadata?.registration_endpoint)throw new Error("No registration endpoint available");if(!$.lastRequest?.body)throw new Error("No client metadata in request");const K=await Pc({request:$.lastRequest,requestExecutor:a,httpHistory:$.httpHistory});if(K.status!=="registered"){if(s({lastResponse:K.response,httpHistory:K.httpHistory,error:K.error}),v){K.status==="invalid_response"&&s({isInitiatingAuth:!1});return}const A=await Y(K.fallbackNote);if(!A){s({error:K.errorWithFallbackHint,isInitiatingAuth:!1});return}s({currentStep:"received_client_credentials",clientId:A.clientId,clientSecret:A.clientSecret,tokenEndpointAuthMethod:A.tokenEndpointAuthMethod,infoLogs:A.infoLogs,error:void 0,isInitiatingAuth:!1});break}if(K.missingClientId){s({lastResponse:K.response,httpHistory:K.httpHistory,error:"Dynamic Client Registration response is missing a client_id.",isInitiatingAuth:!1});return}const ie=ve(ce(),"received_client_credentials","dcr","Dynamic Client Registration",K.infoLogData);s({currentStep:"received_client_credentials",clientId:K.credentials.clientId,clientSecret:K.credentials.clientSecret,tokenEndpointAuthMethod:rd(K.clientInfo),lastResponse:K.response,httpHistory:K.httpHistory,infoLogs:ie,error:void 0,isInitiatingAuth:!1});break}case"received_client_credentials":const _e=$n(43),ke=await cd(_e),je=ve(ce(),"generate_pkce_parameters","pkce-generation","Generate PKCE Parameters",{code_challenge:ke,method:"S256",...F?{resource:de()||"Unknown"}:{resource:"(omitted — emulated client does not send RFC 8707 resource)"}});s({currentStep:"generate_pkce_parameters",codeVerifier:_e,codeChallenge:ke,codeChallengeMethod:"S256",...F?{}:{resourceIndicatorSuppressed:!0},state:$n(16),infoLogs:je,isInitiatingAuth:!1});break;case"generate_pkce_parameters":if(!$.authorizationServerMetadata?.authorization_endpoint||!$.clientId)throw new Error("Missing authorization endpoint or client ID");const xe=new URL($.authorizationServerMetadata.authorization_endpoint);xe.searchParams.set("response_type","code"),xe.searchParams.set("client_id",$.clientId),xe.searchParams.set("redirect_uri",x),xe.searchParams.set("code_challenge",$.codeChallenge||""),xe.searchParams.set("code_challenge_method","S256"),xe.searchParams.set("state",$.state||"");const Oe=de();Oe&&F&&xe.searchParams.set("resource",Oe);const Ee=Dn(O,{customScopes:p,challengedScopes:$.challengedScopes,supportedScopes:$.resourceMetadata?.scopes_supported||$.authorizationServerMetadata.scopes_supported});Ee&&xe.searchParams.set("scope",Ee);const Ae=ve(ce(),"authorization_request","auth-url","Authorization URL",{url:xe.toString()});s({currentStep:"authorization_request",authorizationUrl:xe.toString(),authorizationCode:void 0,accessToken:void 0,refreshToken:void 0,tokenType:void 0,expiresIn:void 0,infoLogs:Ae,isInitiatingAuth:!1});break;case"authorization_request":s({currentStep:"received_authorization_code",isInitiatingAuth:!1});break;case"received_authorization_code":{if(!$.authorizationCode||$.authorizationCode.trim()===""){s({error:"Authorization code is required. Please paste the code you received from the authorization server.",isInitiatingAuth:!1});return}if(!$.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");const K=Ln({clientId:$.clientId,clientSecret:$.clientSecret,tokenEndpointAuthMethod:Un(O,$.tokenEndpointAuthMethod)}),ie={grant_type:"authorization_code",code:$.authorizationCode,redirect_uri:x,...K.bodyParams};$.codeVerifier&&(ie.code_verifier=$.codeVerifier);const A=de();A&&F&&(ie.resource=A);const g={method:"POST",url:$.authorizationServerMetadata.token_endpoint,headers:{"Content-Type":"application/x-www-form-urlencoded",...K.headers},body:ie};s({currentStep:"token_request",lastRequest:g,lastResponse:void 0,...F?{}:{resourceIndicatorSuppressed:!0},accessToken:void 0,refreshToken:void 0,httpHistory:[...$.httpHistory||[],{step:"token_request",timestamp:Date.now(),request:g}],isInitiatingAuth:!1}),le(50);return}case"token_request":if(!$.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");if(!$.authorizationCode)throw new Error("Missing authorization code");if(!$.codeVerifier)throw new Error("PKCE code_verifier is missing - cannot exchange token");try{const K=Ln({clientId:$.clientId,clientSecret:$.clientSecret,tokenEndpointAuthMethod:Un(O,$.tokenEndpointAuthMethod)}),ie=new URLSearchParams({grant_type:"authorization_code",code:$.authorizationCode,redirect_uri:x,code_verifier:$.codeVerifier||"",...K.bodyParams}),A=de();A&&F&&ie.set("resource",A);const g=await R($.authorizationServerMetadata.token_endpoint,{method:"POST",headers:{...$t(d,{"Content-Type":"application/x-www-form-urlencoded"}),...K.headers},body:ie.toString()}),E={status:g.status,statusText:g.statusText,headers:g.headers,body:g.body},k=[...$.httpHistory||[]];if(k.length>0){const U=k[k.length-1];U.response=E,U.duration=Date.now()-(U.timestamp||Date.now())}if(!g.ok){s({lastResponse:E,httpHistory:k,authorizationCode:void 0,error:nd(g),isInitiatingAuth:!1});return}const C=g.body;let q=(ce().infoLogs||[]).filter(U=>U.id!=="auth-code"&&U.id!=="oauth-tokens"&&U.id!=="token");if($.authorizationCode&&(q=[...q,{id:"auth-code",step:"token_request",level:"info",label:"Authorization Code",data:{code:$.authorizationCode},timestamp:Date.now()}]),C.access_token){const U={access_token:C.access_token};C.refresh_token&&(U.refresh_token=C.refresh_token),q=[...q,{id:"oauth-tokens",step:"token_request",level:"info",label:"OAuth Tokens",data:U,timestamp:Date.now()}]}if(C.access_token){const U=Nn(C.access_token);if(U){const P={...U};P.exp&&(P.exp=`${P.exp} (${Ye(P.exp)})`),P.iat&&(P.iat=`${P.iat} (${Ye(P.iat)})`),P.nbf&&(P.nbf=`${P.nbf} (${Ye(P.nbf)})`);const V={...P};if(P.aud){const G=$.serverUrl,Ie=(Array.isArray(P.aud)?P.aud:[P.aud]).some($e=>$e===G);V._validation={expected_audience:G,audience_matches:Ie,note:Ie?"✓ Token audience matches MCP server":"⚠ Token audience does not match MCP server (security risk)"}}else V._validation={note:"⚠ No audience claim found - server should validate token binding"};q=[...q,{id:"token",step:"token_request",level:"info",label:"Access Token (Decoded JWT)",data:V,timestamp:Date.now()}]}}if(C.id_token){const U=Nn(C.id_token);if(U){const P={...U};P.exp&&(P.exp=`${P.exp} (${Ye(P.exp)})`),P.iat&&(P.iat=`${P.iat} (${Ye(P.iat)})`),P.nbf&&(P.nbf=`${P.nbf} (${Ye(P.nbf)})`),P.auth_time&&(P.auth_time=`${P.auth_time} (${Ye(P.auth_time)})`),P._note="OIDC ID Token - Used for user identity verification",q=[...q,{id:"id-token",step:"token_request",level:"info",label:"ID Token (OIDC - Decoded JWT)",data:P,timestamp:Date.now()}]}}s({currentStep:"received_access_token",accessToken:C.access_token,refreshToken:C.refresh_token,tokenType:C.token_type||"Bearer",expiresIn:C.expires_in,lastResponse:E,httpHistory:k,infoLogs:q,error:void 0,isInitiatingAuth:!1})}catch(K){const ie={status:0,statusText:"Network Error",headers:{},body:{error:K instanceof Error?K.message:String(K)}},A=[...$.httpHistory||[]];if(A.length>0){const g=A[A.length-1];g.response=ie,g.duration=Date.now()-(g.timestamp||Date.now())}s({lastResponse:ie,httpHistory:A,error:`Token exchange failed: ${K instanceof Error?K.message:String(K)}`,isInitiatingAuth:!1})}break;case"received_access_token":if(!$.serverUrl||!$.accessToken)throw new Error("Missing server URL or access token");const Me={method:"POST",url:$.serverUrl,headers:{Authorization:`Bearer ${$.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":D},body:Xr({protocolVersion:z,authMode:f,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2})},et=ve(ce(),"authenticated_mcp_request","authenticated-init","Authenticated MCP Initialize Request",{Request:"MCP initialize with OAuth bearer token","Protocol Version":"2025-06-18",Client:"MCPJam Inspector v1.0.0",Endpoint:$.serverUrl});s({currentStep:"authenticated_mcp_request",lastRequest:Me,lastResponse:void 0,httpHistory:[...$.httpHistory||[],{step:"authenticated_mcp_request",timestamp:Date.now(),request:Me}],infoLogs:et,isInitiatingAuth:!1}),le(50);return;case"authenticated_mcp_request":if(!$.serverUrl||!$.accessToken)throw new Error("Missing server URL or access token");try{const K=await R($.serverUrl,{method:"POST",headers:Vt(d,{Authorization:`Bearer ${$.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":D}),body:JSON.stringify(Xr({protocolVersion:z,authMode:f,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2}))}),ie={status:K.status,statusText:K.statusText,headers:K.headers,body:K.body},A=[...$.httpHistory||[]];if(A.length>0){const q=A[A.length-1];q.response=ie,q.duration=Date.now()-(q.timestamp||Date.now())}if(!K.ok){s({lastResponse:ie,httpHistory:A,error:sd(K),isInitiatingAuth:!1});return}let g=ce().infoLogs||[];const E=K.headers["content-type"]||"",k=E.includes("text/event-stream");let C=null;if(k&&K.body?.transport==="sse"?C=K.body.mcpResponse:C=K.body,k&&C?.result?.protocolVersion){const q={Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Protocol Version":C.result.protocolVersion};C.result.serverInfo&&(q["Server Name"]=C.result.serverInfo.name,q["Server Version"]=C.result.serverInfo.version),C.result.capabilities&&(q.Capabilities=C.result.capabilities),g=ve(ce(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",q)}else if(k)g=ve(ce(),"authenticated_mcp_request","mcp-transport","MCP Transport Detected",{Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Content-Type":E,Note:"Server returned streaming response. Initialize response delivered via SSE stream.",Events:K.body?.events?`${K.body.events.length} events parsed`:"No events parsed"});else if(C?.result?.protocolVersion){const q={Transport:"Streamable HTTP","Response Format":"JSON","Protocol Version":C.result.protocolVersion};C.result.serverInfo&&(q["Server Name"]=C.result.serverInfo.name,q["Server Version"]=C.result.serverInfo.version),C.result.capabilities&&(q.Capabilities=C.result.capabilities),g=ve(ce(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",q)}s({currentStep:"complete",lastResponse:ie,httpHistory:A,infoLogs:g,error:void 0,isInitiatingAuth:!1})}catch(K){const ie=$r(K),A={status:0,statusText:"Network Error",headers:{},body:{error:ie.message,details:ie.details}},g=[...$.httpHistory||[]];if(g.length>0){const C={...g[g.length-1],response:A,duration:Date.now()-(g[g.length-1]?.timestamp||Date.now()),error:ie};g[g.length-1]=C}const E=ce(),k=ve(E,"authenticated_mcp_request",`error-authenticated_mcp_request-${Date.now()}`,"Authenticated MCP request failed",{request:E.lastRequest,error:ie},{level:"error",error:ie});s({lastResponse:A,httpHistory:g,infoLogs:k,error:`Authenticated MCP request failed: ${ie.message}`,isInitiatingAuth:!1})}break;case"complete":s({isInitiatingAuth:!1});break;default:s({isInitiatingAuth:!1})}}catch(y){const Q=ce(),ne=$r(y),H=ve(Q,Q.currentStep,`error-${Q.currentStep}-${Date.now()}`,"Step failed",{step:Q.currentStep,request:Q.lastRequest,response:Q.lastResponse,error:ne},{level:"error",error:ne}),I=wi(Q.httpHistory,ne),ee={error:ne.message,infoLogs:H,isInitiatingAuth:!1};I&&(ee.httpHistory=I),s(ee)}},startGuidedFlow:async()=>{s({currentStep:"idle",isInitiatingAuth:!1})},resetFlow:()=>{s(id())}};return me};function md(e){const t=e.replace(/^\[|\]$/g,"").toLowerCase();return t==="localhost"||t.endsWith(".localhost")||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(t)||t==="::1"}function WN(e){try{const{protocol:t,hostname:r}=new URL(e);return t==="http:"&&md(r)}catch{return!1}}function og(e,t={}){let r;try{r=new URL(e)}catch{throw new Error("Client ID metadata URL must be a valid absolute URL")}const s=t.allowLoopback===!0&&r.protocol==="http:"&&md(r.hostname);if(!s&&(r.protocol!=="https:"||!r.hostname))throw new Error("Client ID metadata URL must be an absolute HTTPS URL");const n=s?/^http:\/\//i:/^https:\/\//i;if(!n.test(e))throw new Error(s?"Client ID metadata URL must use the http:// scheme (with two slashes)":"Client ID metadata URL must use the https:// scheme (with two slashes)");if(/[\u0000-\u0020\u007f\\]/.test(e))throw new Error("Client ID metadata URL must not contain control characters, whitespace, or backslashes");if(r.hash||e.includes("#"))throw new Error("Client ID metadata URL must not contain a fragment component");const i=e.split(/[?#]/,1)[0].replace(n,""),o=i.indexOf("/"),a=o===-1?i:i.slice(0,o),c=o===-1?"":i.slice(o);if(!a)throw new Error("Client ID metadata URL must contain a host immediately after https://");if(r.username||r.password||a.includes("@"))throw new Error("Client ID metadata URL must not contain a userinfo component");if(!c)throw new Error("Client ID metadata URL must contain a path component");const l=u=>{const p=u.replace(/%2e/gi,".");return p==="."||p===".."};if(c.split("/").some(l))throw new Error("Client ID metadata URL must not contain single-dot or double-dot path segments");return e}var KN=e=>Vo(e);function JN(e,t){return od(e,t,{protocolVersion:"2025-11-25",includesProtectedResourceMetadata:!0,initialMcpMethod:"initialize",authorizationServerMetadata:{label:"GET Authorization server metadata endpoint",description:"Try OAuth path insertion, OIDC path insertion, OIDC path appending"},pkce:{label:`Generate PKCE (REQUIRED)
|
|
54
|
+
Include resource parameter`,description:"Client generates code verifier and challenge (REQUIRED), includes resource parameter"},resourceValue:KN})}function D_(e){return Cc(e,Rc.current).map(({url:t})=>t)}var YN=e=>{const{state:t,getState:r,updateState:s,serverUrl:n,serverName:i,redirectUrl:o,requestExecutor:a,scheduleAutoAdvance:c,loadPreregisteredCredentials:l,dynamicRegistration:u,clientIdMetadataUrl:p,customScopes:d,customHeaders:h,resourceMetadataUrl:f,authMode:m,hasClientSecret:v=!1,strictConformance:_=!1,resourceIndicatorEnforcement:b="warn",requiredMetadataEnforcement:T="reject",registrationStrategy:O="cimd",emulation:x}=e,D=o,z=ki(x,"2025-11-25"),F=ki(x,eg("2025-11-25")),J=hd(x),ce=fd(u??{},x);let de=p??"";if(O==="dcr"&&!ce.client_name)throw new Error("Dynamic registration metadata must include client_name");if(O==="cimd"&&!de)throw new Error("Client ID metadata URL is required for CIMD registration");O==="cimd"&&(de=og(de));const R=()=>r?r():t,fe=()=>Vo(R(),n),Y=(y,Q={})=>a({url:y,method:Q.method||"GET",headers:Rn(Q.headers),body:Q.body}),me=y=>{const Q=td({authorizationServerMetadata:R().authorizationServerMetadata,hasClientSecret:!!(y||v)});if(!Q.ok)throw new Error(Q.message);return Q.method},$=async y=>{const{clientId:Q,clientSecret:ne}=await l?.({serverName:i,serverUrl:n})??{};if(!Q)return;const H=me(ne),I={"Client ID":Q,"Client Secret":ne||v?"Configured":"Not provided (public client)","Token Auth Method":H,Note:y};return{clientId:Q,clientSecret:ne||void 0,tokenEndpointAuthMethod:H,infoLogs:ve(R(),"received_client_credentials","preregistered-fallback","Pre-registered Client",I)}},le={state:t,updateState:s,proceedToNextStep:async()=>{const y=R();s({isInitiatingAuth:!0});const Q=ne=>{c?.(()=>{le.proceedToNextStep()},ne)};try{switch(y.currentStep){case"idle":{const g=Vt(h,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":z}),E=Xr({protocolVersion:F,authMode:m,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}),k={method:"POST",url:n,headers:g,body:E};s({currentStep:"request_without_token",serverUrl:n,lastRequest:k,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"request_without_token",timestamp:Date.now(),request:k}],isInitiatingAuth:!1}),Q(50);return}case"request_without_token":if(!y.serverUrl)throw new Error("No server URL available");try{const g=await Y(y.serverUrl,{method:"POST",headers:Vt(h,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":z}),body:JSON.stringify(Xr({protocolVersion:F,authMode:m,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}))}),E={status:g.status,statusText:g.statusText,headers:g.headers,body:g.body},k=[...y.httpHistory||[]];if(k.length>0){const q=k[k.length-1];q.response=E,q.duration=Date.now()-(q.timestamp||Date.now())}const C=Hu({status:g.status,statusText:g.statusText,wwwAuthenticateHeader:g.headers["www-authenticate"],serverMessage:g.body?.error?.message});if(C.kind==="challenged"){const q=g.headers["www-authenticate"],U=Gs(q),P=_m(U.scope);let V=q?ve(y,"received_401_unauthorized","www-authenticate","WWW-Authenticate Header",{header:q,...P&&P.length>0?{scope:P.join(" ")}:{},"Received from":y.serverUrl||"Unknown"}):y.infoLogs;C.specCompliant||(V=ad(y,V,"received_401_unauthorized",E)),s({currentStep:"received_401_unauthorized",wwwAuthenticateHeader:q||void 0,challengedScopes:P,lastResponse:E,httpHistory:k,infoLogs:V,isInitiatingAuth:!1})}else if(C.kind==="anonymous_allowed"){const q=ve(y,"received_401_unauthorized","optional-auth","Optional Authentication Detected",{message:"Server allows anonymous access",note:"Proceeding with OAuth discovery for authenticated features"});s({currentStep:"received_401_unauthorized",wwwAuthenticateHeader:void 0,lastResponse:E,httpHistory:k,infoLogs:q,isInitiatingAuth:!1})}else throw s({lastResponse:E,httpHistory:k}),new Mn(C.message,g.status)}catch(g){throw g instanceof Mn?g:new Error(`Failed to request MCP server: ${g instanceof Error?g.message:String(g)}`)}break;case"received_401_unauthorized":{const g=Gs(y.wwwAuthenticateHeader);let E=f||g.resource_metadata;if(!E&&y.serverUrl&&(E=tg(y.serverUrl)),!E)throw new Error("Could not determine resource metadata URL");const k={method:"GET",url:E,headers:Vt(h,{})};s({currentStep:"request_resource_metadata",resourceMetadataUrl:E,lastRequest:k,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"request_resource_metadata",timestamp:Date.now(),request:k}],isInitiatingAuth:!1}),Q(50);return}case"request_resource_metadata":if(!y.serverUrl)throw new Error("No server URL available");const ne=[...y.httpHistory||[]];let H=ne.length>0&&ne[ne.length-1]?.step==="request_resource_metadata"&&!ne[ne.length-1]?.response?ne.pop():void 0;const I=[],ee=async(g,E={})=>{const k=typeof g=="string"?g:g.toString(),C=Zm(n,k,h,Rn(E.headers)),q=H?{...H,timestamp:Date.now(),request:{method:E.method||"GET",url:k,headers:C,body:E.body}}:{step:"request_resource_metadata",timestamp:Date.now(),request:{method:E.method||"GET",url:k,headers:C,body:E.body}};H=void 0,I.push(q);try{const U=await Y(k,{method:E.method||"GET",headers:C,body:E.body});q.response={status:U.status,statusText:U.statusText,headers:U.headers,body:U.body},q.duration=Date.now()-q.timestamp;const P={status:U.status,statusText:U.statusText,headers:U.headers},V=typeof U.body=="string"?U.body:JSON.stringify(U.body??{});return new Response(V,P)}catch(U){throw q.error=$r(U),q.duration=Date.now()-q.timestamp,U}};try{const g=(f||Gs(y.wwwAuthenticateHeader).resource_metadata)&&y.resourceMetadataUrl?{resourceMetadataUrl:y.resourceMetadataUrl}:void 0,E=await ed(y.serverUrl,g,ee),k=[...ne,...I],C=I[I.length-1],q=Qm({authorizationServers:E.authorization_servers,fallbackServerUrl:n,protocolVersion:"2025-11-25"}),U=q.authorizationServerUrl;if(q.error&&T!=="observe"){s({resourceMetadata:E,resourceMetadataUrl:C?.request?.url||y.resourceMetadataUrl,lastRequest:C?.request,lastResponse:C?.response,httpHistory:k,error:q.error,isInitiatingAuth:!1});return}let P=y.infoLogs??[];q.error&&(P=ve({...R(),infoLogs:P},"received_resource_metadata","authorization-server-substituted","Derived: Authorization Server (not advertised)",{Finding:q.error,"Using instead":U}));const V=ig({state:y,fallbackServerUrl:n,prmResource:E.resource,enforcement:b,infoLogs:P}),G=V.resourceIndicator;P=V.infoLogs,s({currentStep:"received_resource_metadata",resourceMetadata:E,resourceIndicator:G,resourceMetadataUrl:C?.request?.url||y.resourceMetadataUrl,authorizationServerUrl:U,lastRequest:C?.request,lastResponse:C?.response,httpHistory:k,infoLogs:P,isInitiatingAuth:!1})}catch(g){const E=wi([...ne,...I],$r(g));throw s({lastResponse:I[I.length-1]?.response,httpHistory:E}),new Error(Qu(g))}break;case"received_resource_metadata":if(!y.authorizationServerUrl)throw new Error("No authorization server URL available");const oe={method:"GET",url:D_(y.authorizationServerUrl)[0],headers:$t(h,{})};s({currentStep:"request_authorization_server_metadata",lastRequest:oe,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"request_authorization_server_metadata",timestamp:Date.now(),request:oe}],isInitiatingAuth:!1}),Q(50);return;case"request_authorization_server_metadata":if(!y.authorizationServerUrl)throw new Error("No authorization server URL available");const he=D_(y.authorizationServerUrl);let ue=null;const Ge=[];let Ve={},Ce=null;for(const g of he)try{const E=$t(h,{}),k=[...y.httpHistory||[]];k.length>0&&(k[k.length-1].request={method:"GET",url:g,headers:E}),s({lastRequest:{method:"GET",url:g,headers:E},httpHistory:k});const C=await Y(g,{method:"GET",headers:$t(h,{})}),q=sg(g,C);if(q.kind==="document"){ue=q.document,Ve=C.headers,Ce=C;break}Ge.push(q.attempt)}catch(E){if(rg(E))throw E;Ge.push({url:g,error:E});continue}if(!ue||!Ce)throw new Error(ng(Ge));if(!ue.issuer)throw new Error(ld);if(!ue.authorization_endpoint)throw new Error("Authorization server metadata missing 'authorization_endpoint'");if(!ue.token_endpoint)throw new Error("Authorization server metadata missing 'token_endpoint'");if(!ue.response_types_supported?.includes("code"))throw new Error("Authorization server does not support 'code' response type");const B={status:Ce.status,statusText:Ce.statusText,headers:Ve,body:ue},pe=[...y.httpHistory||[]];if(pe.length>0){const g=pe[pe.length-1];g.response=B,g.duration=Date.now()-(g.timestamp||Date.now())}const _e=ue.code_challenge_methods_supported||[],ke=ek(_e,"2025-11-25"),je=typeof ue.client_id_metadata_document_supported=="boolean"?ue.client_id_metadata_document_supported:"false (not advertised, defaults to false per spec)",xe=ve(R(),"received_authorization_server_metadata","cimd-support","Derived: CIMD Support",{"CIMD Supported":je});if(ke){if(_||T!=="observe"){s({lastResponse:B,httpHistory:pe,infoLogs:xe,error:ke,isInitiatingAuth:!1});return}console.warn("Authorization server may not support S256 PKCE method. Supported methods:",_e),s({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:ue,lastResponse:B,httpHistory:pe,infoLogs:xe,error:"Warning: Authorization server may not support S256 PKCE method",isInitiatingAuth:!1})}else s({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:ue,lastResponse:B,httpHistory:pe,infoLogs:xe,isInitiatingAuth:!1});break;case"received_authorization_server_metadata":if(!y.authorizationServerMetadata)throw new Error("No authorization server metadata available");if(O==="cimd"){if(y.authorizationServerMetadata.client_id_metadata_document_supported!==!0){s({error:"The authorization server does not support Client ID Metadata Documents (client_id_metadata_document_supported is not advertised in AS metadata). Try using 'dcr' or 'preregistered' registration strategy instead.",isInitiatingAuth:!1});return}s({currentStep:"cimd_prepare",clientId:de,isInitiatingAuth:!1}),Q(800);return}else if(O==="preregistered"){const{clientId:g,clientSecret:E}=await l?.({serverName:i,serverUrl:n})??{};if(!g){s({error:"Pre-registered client ID is required. Please configure OAuth credentials in the server settings.",isInitiatingAuth:!1});return}const k=me(E),C={"Client ID":g,"Client Secret":E||v?"Configured":"Not provided (public client)","Token Auth Method":k,Note:"Using pre-registered client credentials from server config (skipped DCR)"},q=ve(R(),"received_client_credentials","dcr","Pre-registered Client",C);s({currentStep:"received_client_credentials",clientId:g,clientSecret:E||void 0,tokenEndpointAuthMethod:k,infoLogs:q,isInitiatingAuth:!1})}else if(y.authorizationServerMetadata.registration_endpoint){const g=y.resourceMetadata?.scopes_supported||y.authorizationServerMetadata.scopes_supported,E=Dn(x,{customScopes:d,challengedScopes:y.challengedScopes,supportedScopes:g}),k=pd({registrationEndpoint:y.authorizationServerMetadata.registration_endpoint,redirectUri:D,dynamicRegistrationDefaults:ce,scope:E,customHeaders:h});s({currentStep:"request_client_registration",lastRequest:k,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"request_client_registration",timestamp:Date.now(),request:k}],isInitiatingAuth:!1}),Q(50);return}else{if(_){s({error:dd,isInitiatingAuth:!1});return}const g=await $("Authorization server did not advertise registration_endpoint; using pre-registered client credentials.");if(!g){s({error:ud,isInitiatingAuth:!1});return}s({currentStep:"received_client_credentials",clientId:g.clientId,clientSecret:g.clientSecret,tokenEndpointAuthMethod:g.tokenEndpointAuthMethod,infoLogs:g.infoLogs,error:void 0,isInitiatingAuth:!1})}break;case"request_client_registration":if(!y.authorizationServerMetadata?.registration_endpoint)throw new Error("No registration endpoint available");if(!y.lastRequest?.body)throw new Error("No client metadata in request");{const g=await Pc({request:y.lastRequest,requestExecutor:a,httpHistory:y.httpHistory});if(g.status!=="registered"){if(s({lastResponse:g.response,httpHistory:g.httpHistory,error:g.error,isInitiatingAuth:!1}),_)return;const k=await $(g.fallbackNote);if(!k){s({error:g.errorWithFallbackHint,isInitiatingAuth:!1});return}s({currentStep:"received_client_credentials",clientId:k.clientId,clientSecret:k.clientSecret,tokenEndpointAuthMethod:k.tokenEndpointAuthMethod,infoLogs:k.infoLogs,error:void 0,isInitiatingAuth:!1});break}if(g.missingClientId){s({lastResponse:g.response,httpHistory:g.httpHistory,error:"Dynamic Client Registration response is missing a client_id.",isInitiatingAuth:!1});return}const E=ve(R(),"received_client_credentials","dcr","Dynamic Client Registration",g.infoLogData);s({currentStep:"received_client_credentials",clientId:g.credentials.clientId,clientSecret:g.credentials.clientSecret,tokenEndpointAuthMethod:rd(g.clientInfo),lastResponse:g.response,httpHistory:g.httpHistory,infoLogs:E,error:void 0,isInitiatingAuth:!1})}break;case"cimd_prepare":s({currentStep:"cimd_fetch_request",isInitiatingAuth:!1}),Q(800);return;case"cimd_fetch_request":try{const g={method:"GET",url:de,headers:Rn(void 0)},E=Date.now(),k=await Y(de,{method:"GET"});if(!k.ok)throw new Error(`CIMD endpoint returned HTTP ${k.status}`);const C={status:k.status,statusText:k.statusText,headers:k.headers,body:k.body};s({currentStep:"cimd_metadata_response",lastRequest:g,lastResponse:C,httpHistory:[...y.httpHistory||[],{step:"cimd_fetch_request",timestamp:E,duration:Date.now()-E,request:g,response:C}],isInitiatingAuth:!1}),Q(800);return}catch(g){s({error:`CIMD metadata fetch failed: ${g instanceof Error?g.message:String(g)}. Try using 'dcr' or 'preregistered' registration strategy instead.`,isInitiatingAuth:!1});return}case"cimd_metadata_response":try{const g=y.lastResponse?.body;if(!g||typeof g!="object")throw new Error("CIMD metadata document was not available");if(g.client_id!==de)throw new Error("CIMD client_id mismatch");const E=y.authorizationServerMetadata?.client_id_metadata_document_supported,k={"Client ID":de,"Registration Method":"Client ID Metadata Document (CIMD)","Client Name":g.client_name||"MCPJam","Redirect URIs":g.redirect_uris||[],"Token Auth Method":g.token_endpoint_auth_method||"none",Validation:"✓ Metadata fetched and validated",Note:"Server fetched and validated client metadata from URL"};E?k["Server Support"]="✓ Advertised in metadata (client_id_metadata_document_supported: true)":k["Server Support"]="⚠ Not advertised (attempting anyway)";const C=ve(R(),"received_client_credentials","cimd","Client ID Metadata Document",k);s({currentStep:"received_client_credentials",clientId:de,clientSecret:void 0,tokenEndpointAuthMethod:"none",infoLogs:C,isInitiatingAuth:!1})}catch(g){s({error:`CIMD validation failed: ${g instanceof Error?g.message:String(g)}. Try using 'dcr' or 'preregistered' registration strategy instead.`,isInitiatingAuth:!1});return}break;case"received_client_credentials":const Oe=$n(43),Ee=await cd(Oe),Ae=ve(R(),"generate_pkce_parameters","pkce-generation","Generate PKCE Parameters",{code_challenge:Ee,method:"S256",...J?{resource:fe()}:{resource:"(omitted — emulated client does not send RFC 8707 resource)"}});s({currentStep:"generate_pkce_parameters",codeVerifier:Oe,codeChallenge:Ee,codeChallengeMethod:"S256",...J?{}:{resourceIndicatorSuppressed:!0},state:$n(16),infoLogs:Ae,isInitiatingAuth:!1});break;case"generate_pkce_parameters":if(!y.authorizationServerMetadata?.authorization_endpoint||!y.clientId)throw new Error("Missing authorization endpoint or client ID");const Me=new URL(y.authorizationServerMetadata.authorization_endpoint);Me.searchParams.set("response_type","code"),Me.searchParams.set("client_id",y.clientId),Me.searchParams.set("redirect_uri",D),Me.searchParams.set("code_challenge",y.codeChallenge||""),Me.searchParams.set("code_challenge_method","S256"),Me.searchParams.set("state",y.state||""),J&&Me.searchParams.set("resource",fe());const et=Dn(x,{customScopes:d,challengedScopes:y.challengedScopes,supportedScopes:y.resourceMetadata?.scopes_supported||y.authorizationServerMetadata.scopes_supported});et&&Me.searchParams.set("scope",et);const K=ve(R(),"authorization_request","auth-url","Authorization URL",{url:Me.toString()});s({currentStep:"authorization_request",authorizationUrl:Me.toString(),authorizationCode:void 0,accessToken:void 0,refreshToken:void 0,tokenType:void 0,expiresIn:void 0,infoLogs:K,isInitiatingAuth:!1});break;case"authorization_request":s({currentStep:"received_authorization_code",isInitiatingAuth:!1});break;case"received_authorization_code":{if(!y.authorizationCode||y.authorizationCode.trim()===""){s({error:"Authorization code is required. Please paste the code you received from the authorization server.",isInitiatingAuth:!1});return}if(!y.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");const g=Ln({clientId:y.clientId,clientSecret:y.clientSecret,tokenEndpointAuthMethod:Un(x,y.tokenEndpointAuthMethod)}),E={grant_type:"authorization_code",code:y.authorizationCode,redirect_uri:D,...g.bodyParams};y.codeVerifier&&(E.code_verifier=y.codeVerifier),J&&(E.resource=fe());const k={method:"POST",url:y.authorizationServerMetadata.token_endpoint,headers:{"Content-Type":"application/x-www-form-urlencoded",...g.headers},body:E};s({currentStep:"token_request",lastRequest:k,lastResponse:void 0,...J?{}:{resourceIndicatorSuppressed:!0},accessToken:void 0,refreshToken:void 0,httpHistory:[...y.httpHistory||[],{step:"token_request",timestamp:Date.now(),request:k}],isInitiatingAuth:!1}),Q(50);return}case"token_request":if(!y.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");if(!y.authorizationCode)throw new Error("Missing authorization code");if(!y.codeVerifier)throw new Error("PKCE code_verifier is missing - cannot exchange token");try{const g=Ln({clientId:y.clientId,clientSecret:y.clientSecret,tokenEndpointAuthMethod:Un(x,y.tokenEndpointAuthMethod)}),E=new URLSearchParams({grant_type:"authorization_code",code:y.authorizationCode,redirect_uri:D,code_verifier:y.codeVerifier||"",...g.bodyParams});J&&E.set("resource",fe());const k=await Y(y.authorizationServerMetadata.token_endpoint,{method:"POST",headers:{...$t(h,{"Content-Type":"application/x-www-form-urlencoded"}),...g.headers},body:E.toString()}),C={status:k.status,statusText:k.statusText,headers:k.headers,body:k.body},q=[...y.httpHistory||[]];if(q.length>0){const V=q[q.length-1];V.response=C,V.duration=Date.now()-(V.timestamp||Date.now())}if(!k.ok){s({lastResponse:C,httpHistory:q,authorizationCode:void 0,error:nd(k),isInitiatingAuth:!1});return}const U=k.body;let P=(R().infoLogs||[]).filter(V=>V.id!=="auth-code"&&V.id!=="oauth-tokens"&&V.id!=="token");if(y.authorizationCode&&(P=[...P,{id:"auth-code",level:"info",step:"authorization_request",label:"Authorization Code",data:{code:y.authorizationCode},timestamp:Date.now()}]),U.access_token){const V={access_token:U.access_token};U.refresh_token&&(V.refresh_token=U.refresh_token),P=[...P,{id:"oauth-tokens",level:"info",step:"token_request",label:"OAuth Tokens",data:V,timestamp:Date.now()}]}if(U.access_token){const V=Nn(U.access_token);if(V){const G={...V};G.exp&&(G.exp=`${G.exp} (${Ye(G.exp)})`),G.iat&&(G.iat=`${G.iat} (${Ye(G.iat)})`),G.nbf&&(G.nbf=`${G.nbf} (${Ye(G.nbf)})`);const Ie={...G};if(G.aud){const $e=y.serverUrl,Pt=(Array.isArray(G.aud)?G.aud:[G.aud]).some(jt=>jt===$e);Ie._validation={expected_audience:$e,audience_matches:Pt,note:Pt?"✓ Token audience matches MCP server":"⚠ Token audience does not match MCP server (security risk)"}}else Ie._validation={note:"⚠ No audience claim found - server should validate token binding"};P=[...P,{id:"token",level:"info",step:"token_request",label:"Access Token (Decoded JWT)",data:Ie,timestamp:Date.now()}]}}if(U.id_token){const V=Nn(U.id_token);if(V){const G={...V};G.exp&&(G.exp=`${G.exp} (${Ye(G.exp)})`),G.iat&&(G.iat=`${G.iat} (${Ye(G.iat)})`),G.nbf&&(G.nbf=`${G.nbf} (${Ye(G.nbf)})`),G.auth_time&&(G.auth_time=`${G.auth_time} (${Ye(G.auth_time)})`),G._note="OIDC ID Token - Used for user identity verification",P=[...P,{id:"id-token",level:"info",step:"token_request",label:"ID Token (OIDC - Decoded JWT)",data:G,timestamp:Date.now()}]}}s({currentStep:"received_access_token",accessToken:U.access_token,refreshToken:U.refresh_token,tokenType:U.token_type||"Bearer",expiresIn:U.expires_in,lastResponse:C,httpHistory:q,infoLogs:P,error:void 0,isInitiatingAuth:!1})}catch(g){const E={status:0,statusText:"Network Error",headers:{},body:{error:g instanceof Error?g.message:String(g)}},k=[...y.httpHistory||[]];if(k.length>0){const C=k[k.length-1];C.response=E,C.duration=Date.now()-(C.timestamp||Date.now())}s({lastResponse:E,httpHistory:k,error:`Token exchange failed: ${g instanceof Error?g.message:String(g)}`,isInitiatingAuth:!1})}break;case"received_access_token":if(!y.serverUrl||!y.accessToken)throw new Error("Missing server URL or access token");const ie={method:"POST",url:y.serverUrl,headers:{Authorization:`Bearer ${y.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":z},body:Xr({protocolVersion:F,authMode:m,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2})},A=ve(R(),"authenticated_mcp_request","authenticated-init","Authenticated MCP Initialize Request",{Request:"MCP initialize with OAuth bearer token","Protocol Version":"2025-11-25",Client:"MCPJam Inspector v1.0.0",Endpoint:y.serverUrl});s({currentStep:"authenticated_mcp_request",lastRequest:ie,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"authenticated_mcp_request",timestamp:Date.now(),request:ie}],infoLogs:A,isInitiatingAuth:!1}),Q(50);return;case"authenticated_mcp_request":if(!y.serverUrl||!y.accessToken)throw new Error("Missing server URL or access token");try{const g=await Y(y.serverUrl,{method:"POST",headers:Vt(h,{Authorization:`Bearer ${y.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":z}),body:JSON.stringify(Xr({protocolVersion:F,authMode:m,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2}))}),E={status:g.status,statusText:g.statusText,headers:g.headers,body:g.body},k=[...y.httpHistory||[]];if(k.length>0){const V=k[k.length-1];V.response=E,V.duration=Date.now()-(V.timestamp||Date.now())}if(!g.ok){s({lastResponse:E,httpHistory:k,error:sd(g),isInitiatingAuth:!1});return}let C=R().infoLogs||[];const q=g.headers["content-type"]||"",U=q.includes("text/event-stream");let P=null;if(U&&g.body?.transport==="sse"?P=g.body.mcpResponse:P=g.body,U&&P?.result?.protocolVersion){const V={Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Protocol Version":P.result.protocolVersion};P.result.serverInfo&&(V["Server Name"]=P.result.serverInfo.name,V["Server Version"]=P.result.serverInfo.version),P.result.capabilities&&(V.Capabilities=P.result.capabilities),C=ve(R(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",V)}else if(U)C=ve(R(),"authenticated_mcp_request","mcp-transport","MCP Transport Detected",{Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Content-Type":q,Note:"Server returned streaming response. Initialize response delivered via SSE stream.",Events:g.body?.events?`${g.body.events.length} events parsed`:"No events parsed"});else if(P?.result?.protocolVersion){const V={Transport:"Streamable HTTP","Response Format":"JSON","Protocol Version":P.result.protocolVersion};P.result.serverInfo&&(V["Server Name"]=P.result.serverInfo.name,V["Server Version"]=P.result.serverInfo.version),P.result.capabilities&&(V.Capabilities=P.result.capabilities),C=ve(R(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",V)}s({currentStep:"complete",lastResponse:E,httpHistory:k,infoLogs:C,error:void 0,isInitiatingAuth:!1})}catch(g){const E={status:0,statusText:"Network Error",headers:{},body:{error:g instanceof Error?g.message:String(g)}},k=[...y.httpHistory||[]];if(k.length>0){const C=k[k.length-1];C.response=E,C.duration=Date.now()-(C.timestamp||Date.now())}s({lastResponse:E,httpHistory:k,error:`Authenticated MCP request failed: ${g instanceof Error?g.message:String(g)}`,isInitiatingAuth:!1})}break;case"complete":s({isInitiatingAuth:!1});break;default:s({isInitiatingAuth:!1})}}catch(ne){const H=R(),I=$r(ne),ee=ve(H,H.currentStep,`error-${H.currentStep}-${Date.now()}`,"Step failed",{step:H.currentStep,request:H.lastRequest,response:H.lastResponse,error:I},{level:"error",error:I}),oe=wi(H.httpHistory,I),he={error:I.message,infoLogs:ee,isInitiatingAuth:!1};oe&&(he.httpHistory=oe),s(he)}},startGuidedFlow:async()=>{s({currentStep:"idle",isInitiatingAuth:!1})},resetFlow:()=>{s(id())}};return le},XN=e=>Vo(e);function ZN(e){const t=e.requestedScopes??[],r=e.challengedScopes??[],s=[];if(t.length>0&&s.push({label:"requested scopes",value:t.join(" ")}),r.length>0){const n=eP(t,r);s.push({label:"challenged scopes",value:r.join(" ")}),s.push({label:"scope union",value:n.join(" ")})}return s}function QN(e){const t=e.recordedIssuer??e.authorizationServerMetadata?.issuer;return t?[{label:"bound to issuer",value:t}]:[]}function e$(e,t){return od(e,t,{protocolVersion:"2026-07-28",includesProtectedResourceMetadata:!0,initialMcpMethod:"tools/list",authorizationServerMetadata:{label:"GET Authorization server metadata endpoint",description:"Try OAuth path insertion, OIDC path insertion, OIDC path appending"},pkce:{label:`Generate PKCE (REQUIRED)
|
|
55
|
+
Include resource parameter`,description:"Client generates code verifier and challenge (REQUIRED), includes resource parameter"},resourceValue:XN,dcrNotes:[{label:"Deprecated",value:"DCR is deprecated in 2026-07-28 (PR #2858). Prefer CIMD or a pre-registered client; DCR remains a compatibility fallback for authorization servers without CIMD support."}],clientCredentialsExtras:QN,authorizationRequestExtras:ZN})}function U_(e){return Cc(e,Rc.current).map(({url:t})=>t)}function q_(e){const t=e.replace(/[\u0000-\u001f\u007f\u0085\u2028\u2029]+/g," ").trim();return`\`${t.length>256?`${t.slice(0,256)}…`:t}\``}function t$(e,t){let r,s;try{r=new URL(e),s=new URL(t)}catch{return!1}if(r.origin!==s.origin||r.search||r.hash||s.search||s.hash)return!1;const n=a=>a.endsWith("/")?a.slice(0,-1):a,i=n(r.pathname),o=n(s.pathname);return i===o?!1:i===""||i==="/"?o.length>0:o.startsWith(`${i}/`)}function r$(e,t){try{return new URL(e).origin===new URL(t).origin}catch{return!1}}function z_(e,t){return e==null?!1:typeof e!="string"?!0:!r$(e,t)}function F_(e){return typeof e=="string"?`"${e}"`:"a non-string value"}function s$(e){const{advertisedIssuer:t,discoveryUrl:r,tokenEndpoint:s,registrationEndpoint:n,allowPathScopedIssuer:i}=e,o=t$(t,r),a=i&&o,c=a&&z_(s,t),l=a&&z_(n,t);return a&&!c&&!l?{accepted:!0,hint:""}:{accepted:!1,hint:c?` The path-scoped authorization server's token endpoint (${F_(s)}) is not on the same origin as its issuer ("${t}"); refusing to send credentials off-origin.`:l?` The path-scoped authorization server's registration endpoint (${F_(n)}) is not on the same origin as its issuer ("${t}"); refusing dynamic registration off-origin.`:o?` The advertised issuer is the same-origin root of the discovery URL — a multi-tenant, path-scoped authorization server. Enable "Path-scoped authorization server" in the server's OAuth configuration (Advanced settings) to allow this.`:""}}function n$(e){const{recordedIssuer:t,returnedIss:r,issParameterSupported:s,enforcePresentIssMismatch:n=!0}=e;if(r!=null&&r!==""){if(t!==void 0&&r!==t){const i=`Authorization response \`iss\` does not match the issuer this flow started with. Recorded from authorization-server metadata: ${q_(t)}; returned on the callback: ${q_(r)}.`;return n?{ok:!1,reason:`${i} Refusing to exchange the authorization code; not displaying any server-supplied error parameters (RFC 9207).`}:{ok:!0,warning:`${i} This protocol version does not require RFC 9207 issuer validation, so the flow continues; on 2026-07-28 this stops the flow before the authorization code is redeemed.`}}return{ok:!0}}return s===!0?{ok:!1,reason:"Authorization server advertised `authorization_response_iss_parameter_supported: true` but the callback did not include an `iss` parameter (RFC 9207 requires it)."}:{ok:!0}}var i$=e=>{const{state:t,getState:r,updateState:s,serverUrl:n,serverName:i,redirectUrl:o,requestExecutor:a,scheduleAutoAdvance:c,loadPreregisteredCredentials:l,dynamicRegistration:u,clientIdMetadataUrl:p,customScopes:d,customHeaders:h,resourceMetadataUrl:f,authMode:m,hasClientSecret:v=!1,strictConformance:_=!1,allowPathScopedIssuer:b=!1,resourceIndicatorEnforcement:T="warn",requiredMetadataEnforcement:O="reject",registrationStrategy:x="cimd",emulation:D}=e,z=o,F=ki(D,"2026-07-28"),J=hd(D),ce=fd(u??{},D);let de=p??"";if(x==="dcr"&&!ce.client_name)throw new Error("Dynamic registration metadata must include client_name");if(x==="cimd"&&!de)throw new Error("Client ID metadata URL is required for CIMD registration");x==="cimd"&&(de=og(de));const R=()=>r?r():t,fe=()=>Vo(R(),n),Y=(y,Q={})=>a({url:y,method:Q.method||"GET",headers:Rn(Q.headers),body:Q.body}),me=y=>{const Q=td({authorizationServerMetadata:R().authorizationServerMetadata,hasClientSecret:!!(y||v)});if(!Q.ok)throw new Error(Q.message);return Q.method},$=async y=>{const{clientId:Q,clientSecret:ne}=await l?.({serverName:i,serverUrl:n})??{};if(!Q)return;const H=me(ne),I={"Client ID":Q,"Client Secret":ne||v?"Configured":"Not provided (public client)","Token Auth Method":H,Note:y};return{clientId:Q,clientSecret:ne||void 0,tokenEndpointAuthMethod:H,infoLogs:ve(R(),"received_client_credentials","preregistered-fallback","Pre-registered Client",I)}},le={state:t,updateState:s,proceedToNextStep:async()=>{const y=R();s({isInitiatingAuth:!0});const Q=ne=>{c?.(()=>{le.proceedToNextStep()},ne)};try{switch(y.currentStep){case"idle":{const g=Vt(h,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":F,"Mcp-Method":"tools/list"}),E=cl({protocolVersion:F,authMode:m,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}),k={method:"POST",url:n,headers:g,body:E};s({currentStep:"request_without_token",serverUrl:n,lastRequest:k,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"request_without_token",timestamp:Date.now(),request:k}],isInitiatingAuth:!1}),Q(50);return}case"request_without_token":if(!y.serverUrl)throw new Error("No server URL available");try{const g=await Y(y.serverUrl,{method:"POST",headers:Vt(h,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":F,"Mcp-Method":"tools/list"}),body:JSON.stringify(cl({protocolVersion:F,authMode:m,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}))}),E={status:g.status,statusText:g.statusText,headers:g.headers,body:g.body},k=[...y.httpHistory||[]];if(k.length>0){const q=k[k.length-1];q.response=E,q.duration=Date.now()-(q.timestamp||Date.now())}const C=Hu({status:g.status,statusText:g.statusText,wwwAuthenticateHeader:g.headers["www-authenticate"],serverMessage:g.body?.error?.message});if(C.kind==="challenged"){const q=g.headers["www-authenticate"],U=Gs(q),P=_m(U.scope);let V=q?ve(y,"received_401_unauthorized","www-authenticate","WWW-Authenticate Header",{header:q,...P&&P.length>0?{scope:P.join(" ")}:{},"Received from":y.serverUrl||"Unknown"}):y.infoLogs;C.specCompliant||(V=ad(y,V,"received_401_unauthorized",E)),s({currentStep:"received_401_unauthorized",wwwAuthenticateHeader:q||void 0,challengedScopes:P,lastResponse:E,httpHistory:k,infoLogs:V,isInitiatingAuth:!1})}else if(C.kind==="anonymous_allowed"){const q=ve(y,"received_401_unauthorized","optional-auth","Optional Authentication Detected",{message:"Server allows anonymous access",note:"Proceeding with OAuth discovery for authenticated features"});s({currentStep:"received_401_unauthorized",wwwAuthenticateHeader:void 0,lastResponse:E,httpHistory:k,infoLogs:q,isInitiatingAuth:!1})}else throw s({lastResponse:E,httpHistory:k}),new Mn(C.message,g.status)}catch(g){throw g instanceof Mn?g:new Error(`Failed to request MCP server: ${g instanceof Error?g.message:String(g)}`)}break;case"received_401_unauthorized":{const g=Gs(y.wwwAuthenticateHeader);let E=f||g.resource_metadata;if(!E&&y.serverUrl&&(E=tg(y.serverUrl)),!E)throw new Error("Could not determine resource metadata URL");const k={method:"GET",url:E,headers:Vt(h,{})};s({currentStep:"request_resource_metadata",resourceMetadataUrl:E,lastRequest:k,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"request_resource_metadata",timestamp:Date.now(),request:k}],isInitiatingAuth:!1}),Q(50);return}case"request_resource_metadata":if(!y.serverUrl)throw new Error("No server URL available");const ne=[...y.httpHistory||[]];let H=ne.length>0&&ne[ne.length-1]?.step==="request_resource_metadata"&&!ne[ne.length-1]?.response?ne.pop():void 0;const I=[],ee=async(g,E={})=>{const k=typeof g=="string"?g:g.toString(),C=Zm(n,k,h,Rn(E.headers)),q=H?{...H,timestamp:Date.now(),request:{method:E.method||"GET",url:k,headers:C,body:E.body}}:{step:"request_resource_metadata",timestamp:Date.now(),request:{method:E.method||"GET",url:k,headers:C,body:E.body}};H=void 0,I.push(q);try{const U=await Y(k,{method:E.method||"GET",headers:C,body:E.body});q.response={status:U.status,statusText:U.statusText,headers:U.headers,body:U.body},q.duration=Date.now()-q.timestamp;const P={status:U.status,statusText:U.statusText,headers:U.headers},V=typeof U.body=="string"?U.body:JSON.stringify(U.body??{});return new Response(V,P)}catch(U){throw q.error=$r(U),q.duration=Date.now()-q.timestamp,U}};try{const g=(f||Gs(y.wwwAuthenticateHeader).resource_metadata)&&y.resourceMetadataUrl?{resourceMetadataUrl:y.resourceMetadataUrl}:void 0,E=await ed(y.serverUrl,g,ee),k=[...ne,...I],C=I[I.length-1],q=Qm({authorizationServers:E.authorization_servers,fallbackServerUrl:n,protocolVersion:"2026-07-28"}),U=q.authorizationServerUrl;if(q.error&&O!=="observe"){s({resourceMetadata:E,resourceMetadataUrl:C?.request?.url||y.resourceMetadataUrl,lastRequest:C?.request,lastResponse:C?.response,httpHistory:k,error:q.error,isInitiatingAuth:!1});return}let P=y.infoLogs??[];q.error&&(P=ve({...R(),infoLogs:P},"received_resource_metadata","authorization-server-substituted","Derived: Authorization Server (not advertised)",{Finding:q.error,"Using instead":U}));const V=ig({state:y,fallbackServerUrl:n,prmResource:E.resource,enforcement:T,infoLogs:P}),G=V.resourceIndicator;P=V.infoLogs,s({currentStep:"received_resource_metadata",resourceMetadata:E,resourceIndicator:G,resourceMetadataUrl:C?.request?.url||y.resourceMetadataUrl,authorizationServerUrl:U,lastRequest:C?.request,lastResponse:C?.response,httpHistory:k,infoLogs:P,isInitiatingAuth:!1})}catch(g){const E=wi([...ne,...I],$r(g));throw s({lastResponse:I[I.length-1]?.response,httpHistory:E}),new Error(Qu(g))}break;case"received_resource_metadata":if(!y.authorizationServerUrl)throw new Error("No authorization server URL available");const oe={method:"GET",url:U_(y.authorizationServerUrl)[0],headers:$t(h,{})};s({currentStep:"request_authorization_server_metadata",lastRequest:oe,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"request_authorization_server_metadata",timestamp:Date.now(),request:oe}],isInitiatingAuth:!1}),Q(50);return;case"request_authorization_server_metadata":if(!y.authorizationServerUrl)throw new Error("No authorization server URL available");const he=U_(y.authorizationServerUrl);let ue=null;const Ge=[];let Ve={},Ce=null;for(const g of he)try{const E=$t(h,{}),k=[...y.httpHistory||[]];k.length>0&&(k[k.length-1].request={method:"GET",url:g,headers:E}),s({lastRequest:{method:"GET",url:g,headers:E},httpHistory:k});const C=await Y(g,{method:"GET",headers:$t(h,{})}),q=sg(g,C);if(q.kind==="document"){ue=q.document,Ve=C.headers,Ce=C;break}Ge.push(q.attempt)}catch(E){if(rg(E))throw E;Ge.push({url:g,error:E});continue}if(!ue||!Ce)throw new Error(ng(Ge));if(!ue.issuer)throw new Error(ld);if(ue.issuer!==y.authorizationServerUrl){const g=s$({advertisedIssuer:ue.issuer,discoveryUrl:y.authorizationServerUrl,tokenEndpoint:ue.token_endpoint,registrationEndpoint:ue.registration_endpoint,allowPathScopedIssuer:b});if(!g.accepted)throw new Error(`Authorization server metadata \`issuer\` does not match the authorization server URL it was discovered from (expected "${y.authorizationServerUrl}", got "${ue.issuer}"). RFC 8414 §3.3 requires an exact match; refusing to continue.`+g.hint)}if(!ue.authorization_endpoint)throw new Error("Authorization server metadata missing 'authorization_endpoint'");if(!ue.token_endpoint)throw new Error("Authorization server metadata missing 'token_endpoint'");if(!ue.response_types_supported?.includes("code"))throw new Error("Authorization server does not support 'code' response type");const B={status:Ce.status,statusText:Ce.statusText,headers:Ve,body:ue},pe=[...y.httpHistory||[]];if(pe.length>0){const g=pe[pe.length-1];g.response=B,g.duration=Date.now()-(g.timestamp||Date.now())}const _e=ue.code_challenge_methods_supported||[],ke=ek(_e,"2026-07-28"),je=typeof ue.client_id_metadata_document_supported=="boolean"?ue.client_id_metadata_document_supported:"false (not advertised, defaults to false per spec)";let xe=ve(R(),"received_authorization_server_metadata","cimd-support","Derived: CIMD Support",{"CIMD Supported":je});if(ue.issuer!==y.authorizationServerUrl&&(xe=ve({...R(),infoLogs:xe},"received_authorization_server_metadata","path-scoped-issuer","Path-scoped authorization server",{"Discovery URL":y.authorizationServerUrl,"Advertised issuer":ue.issuer,Note:'The advertised issuer is the same-origin root of the discovery URL. Accepted because "Path-scoped authorization server" is enabled for this server; strict RFC 8414 §3.3 conformance requires an exact issuer match, and strict MCP clients may refuse to connect.'},{level:"warning"})),ke){if(_||O!=="observe"){s({lastResponse:B,httpHistory:pe,infoLogs:xe,error:ke,isInitiatingAuth:!1});return}console.warn("Authorization server may not support S256 PKCE method. Supported methods:",_e),s({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:ue,lastResponse:B,httpHistory:pe,infoLogs:xe,error:"Warning: Authorization server may not support S256 PKCE method",isInitiatingAuth:!1})}else s({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:ue,lastResponse:B,httpHistory:pe,infoLogs:xe,isInitiatingAuth:!1});break;case"received_authorization_server_metadata":if(!y.authorizationServerMetadata)throw new Error("No authorization server metadata available");if(x==="cimd"){if(y.authorizationServerMetadata.client_id_metadata_document_supported!==!0){s({error:"The authorization server does not support Client ID Metadata Documents (client_id_metadata_document_supported is not advertised in AS metadata). Try using 'dcr' or 'preregistered' registration strategy instead.",isInitiatingAuth:!1});return}s({currentStep:"cimd_prepare",clientId:de,isInitiatingAuth:!1}),Q(800);return}else if(x==="preregistered"){const{clientId:g,clientSecret:E}=await l?.({serverName:i,serverUrl:n})??{};if(!g){s({error:"Pre-registered client ID is required. Please configure OAuth credentials in the server settings.",isInitiatingAuth:!1});return}const k=me(E),C={"Client ID":g,"Client Secret":E||v?"Configured":"Not provided (public client)","Token Auth Method":k,Note:"Using pre-registered client credentials from server config (skipped DCR)"},q=ve(R(),"received_client_credentials","dcr","Pre-registered Client",C);s({currentStep:"received_client_credentials",clientId:g,clientSecret:E||void 0,tokenEndpointAuthMethod:k,infoLogs:q,isInitiatingAuth:!1})}else if(y.authorizationServerMetadata.registration_endpoint){const g=y.resourceMetadata?.scopes_supported||y.authorizationServerMetadata.scopes_supported,E=Dn(D,{customScopes:d,challengedScopes:y.challengedScopes,supportedScopes:g}),k=pd({registrationEndpoint:y.authorizationServerMetadata.registration_endpoint,redirectUri:z,dynamicRegistrationDefaults:{...ce,application_type:ce.application_type??NN(ce.redirect_uris??[z])},scope:E,customHeaders:h}),C=ve(R(),"request_client_registration","dcr-deprecated","DCR is deprecated in 2026-07-28",{Note:"Dynamic Client Registration (RFC 7591) is deprecated as a registration mechanism in 2026-07-28 (PR #2858). It remains a compatibility fallback; prefer CIMD or a pre-registered client where the authorization server supports it."},{level:"warning"});s({currentStep:"request_client_registration",lastRequest:k,lastResponse:void 0,infoLogs:C,httpHistory:[...y.httpHistory||[],{step:"request_client_registration",timestamp:Date.now(),request:k}],isInitiatingAuth:!1}),Q(50);return}else{if(_){s({error:dd,isInitiatingAuth:!1});return}const g=await $("Authorization server did not advertise registration_endpoint; using pre-registered client credentials.");if(!g){s({error:ud,isInitiatingAuth:!1});return}s({currentStep:"received_client_credentials",clientId:g.clientId,clientSecret:g.clientSecret,tokenEndpointAuthMethod:g.tokenEndpointAuthMethod,infoLogs:g.infoLogs,error:void 0,isInitiatingAuth:!1})}break;case"request_client_registration":if(!y.authorizationServerMetadata?.registration_endpoint)throw new Error("No registration endpoint available");if(!y.lastRequest?.body)throw new Error("No client metadata in request");{const g=await Pc({request:y.lastRequest,requestExecutor:a,httpHistory:y.httpHistory});if(g.status!=="registered"){if(s({lastResponse:g.response,httpHistory:g.httpHistory,error:g.error,isInitiatingAuth:!1}),_)return;const k=await $(g.fallbackNote);if(!k){s({error:g.errorWithFallbackHint,isInitiatingAuth:!1});return}s({currentStep:"received_client_credentials",clientId:k.clientId,clientSecret:k.clientSecret,tokenEndpointAuthMethod:k.tokenEndpointAuthMethod,infoLogs:k.infoLogs,error:void 0,isInitiatingAuth:!1});break}if(g.missingClientId){s({lastResponse:g.response,httpHistory:g.httpHistory,error:"Dynamic Client Registration response is missing a client_id.",isInitiatingAuth:!1});return}const E=ve(R(),"received_client_credentials","dcr","Dynamic Client Registration",g.infoLogData);s({currentStep:"received_client_credentials",clientId:g.credentials.clientId,clientSecret:g.credentials.clientSecret,tokenEndpointAuthMethod:rd(g.clientInfo),lastResponse:g.response,httpHistory:g.httpHistory,infoLogs:E,error:void 0,isInitiatingAuth:!1})}break;case"cimd_prepare":s({currentStep:"cimd_fetch_request",isInitiatingAuth:!1}),Q(800);return;case"cimd_fetch_request":try{const g={method:"GET",url:de,headers:Rn(void 0)},E=Date.now(),k=await Y(de,{method:"GET"});if(!k.ok)throw new Error(`CIMD endpoint returned HTTP ${k.status}`);const C={status:k.status,statusText:k.statusText,headers:k.headers,body:k.body};s({currentStep:"cimd_metadata_response",lastRequest:g,lastResponse:C,httpHistory:[...y.httpHistory||[],{step:"cimd_fetch_request",timestamp:E,duration:Date.now()-E,request:g,response:C}],isInitiatingAuth:!1}),Q(800);return}catch(g){s({error:`CIMD metadata fetch failed: ${g instanceof Error?g.message:String(g)}. Try using 'dcr' or 'preregistered' registration strategy instead.`,isInitiatingAuth:!1});return}case"cimd_metadata_response":try{const g=y.lastResponse?.body;if(!g||typeof g!="object")throw new Error("CIMD metadata document was not available");if(g.client_id!==de)throw new Error("CIMD client_id mismatch");const E=y.authorizationServerMetadata?.client_id_metadata_document_supported,k={"Client ID":de,"Registration Method":"Client ID Metadata Document (CIMD)","Client Name":g.client_name||"MCPJam","Redirect URIs":g.redirect_uris||[],"Token Auth Method":g.token_endpoint_auth_method||"none",Validation:"✓ Metadata fetched and validated",Note:"Server fetched and validated client metadata from URL"};E?k["Server Support"]="✓ Advertised in metadata (client_id_metadata_document_supported: true)":k["Server Support"]="⚠ Not advertised (attempting anyway)";const C=ve(R(),"received_client_credentials","cimd","Client ID Metadata Document",k);s({currentStep:"received_client_credentials",clientId:de,clientSecret:void 0,tokenEndpointAuthMethod:"none",infoLogs:C,isInitiatingAuth:!1})}catch(g){s({error:`CIMD validation failed: ${g instanceof Error?g.message:String(g)}. Try using 'dcr' or 'preregistered' registration strategy instead.`,isInitiatingAuth:!1});return}break;case"received_client_credentials":const Oe=$n(43),Ee=await cd(Oe),Ae=ve(R(),"generate_pkce_parameters","pkce-generation","Generate PKCE Parameters",{code_challenge:Ee,method:"S256",...J?{resource:fe()}:{resource:"(omitted — emulated client does not send RFC 8707 resource)"}});s({currentStep:"generate_pkce_parameters",codeVerifier:Oe,codeChallenge:Ee,codeChallengeMethod:"S256",...J?{}:{resourceIndicatorSuppressed:!0},state:$n(16),recordedIssuer:R().authorizationServerMetadata?.issuer,infoLogs:Ae,isInitiatingAuth:!1});break;case"generate_pkce_parameters":if(!y.authorizationServerMetadata?.authorization_endpoint||!y.clientId)throw new Error("Missing authorization endpoint or client ID");const Me=new URL(y.authorizationServerMetadata.authorization_endpoint);Me.searchParams.set("response_type","code"),Me.searchParams.set("client_id",y.clientId),Me.searchParams.set("redirect_uri",z),Me.searchParams.set("code_challenge",y.codeChallenge||""),Me.searchParams.set("code_challenge_method","S256"),Me.searchParams.set("state",y.state||""),J&&Me.searchParams.set("resource",fe());const et=Dn(D,{customScopes:d,challengedScopes:y.challengedScopes,supportedScopes:y.resourceMetadata?.scopes_supported||y.authorizationServerMetadata.scopes_supported});et&&Me.searchParams.set("scope",et);const K=ve(R(),"authorization_request","auth-url","Authorization URL",{url:Me.toString()});s({currentStep:"authorization_request",authorizationUrl:Me.toString(),authorizationCode:void 0,accessToken:void 0,refreshToken:void 0,tokenType:void 0,expiresIn:void 0,requestedScopes:et?et.split(/\s+/).filter(Boolean):void 0,infoLogs:K,isInitiatingAuth:!1});break;case"authorization_request":s({currentStep:"received_authorization_code",isInitiatingAuth:!1});break;case"received_authorization_code":{if(!y.authorizationCode||y.authorizationCode.trim()===""){s({error:"Authorization code is required. Please paste the code you received from the authorization server.",isInitiatingAuth:!1});return}if(!y.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");const g=n$({recordedIssuer:y.recordedIssuer,returnedIss:y.authorizationResponseIss,issParameterSupported:void 0,enforcePresentIssMismatch:!0});if(!g.ok){s({error:g.reason,isInitiatingAuth:!1});return}const E=Ln({clientId:y.clientId,clientSecret:y.clientSecret,tokenEndpointAuthMethod:Un(D,y.tokenEndpointAuthMethod)}),k={grant_type:"authorization_code",code:y.authorizationCode,redirect_uri:z,...E.bodyParams};y.codeVerifier&&(k.code_verifier=y.codeVerifier),J&&(k.resource=fe());const C={method:"POST",url:y.authorizationServerMetadata.token_endpoint,headers:{"Content-Type":"application/x-www-form-urlencoded",...E.headers},body:k};s({currentStep:"token_request",lastRequest:C,lastResponse:void 0,...J?{}:{resourceIndicatorSuppressed:!0},accessToken:void 0,refreshToken:void 0,httpHistory:[...y.httpHistory||[],{step:"token_request",timestamp:Date.now(),request:C}],isInitiatingAuth:!1}),Q(50);return}case"token_request":if(!y.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");if(!y.authorizationCode)throw new Error("Missing authorization code");if(!y.codeVerifier)throw new Error("PKCE code_verifier is missing - cannot exchange token");try{const g=Ln({clientId:y.clientId,clientSecret:y.clientSecret,tokenEndpointAuthMethod:Un(D,y.tokenEndpointAuthMethod)}),E=new URLSearchParams({grant_type:"authorization_code",code:y.authorizationCode,redirect_uri:z,code_verifier:y.codeVerifier||"",...g.bodyParams});J&&E.set("resource",fe());const k=await Y(y.authorizationServerMetadata.token_endpoint,{method:"POST",headers:{...$t(h,{"Content-Type":"application/x-www-form-urlencoded"}),...g.headers},body:E.toString()}),C={status:k.status,statusText:k.statusText,headers:k.headers,body:k.body},q=[...y.httpHistory||[]];if(q.length>0){const V=q[q.length-1];V.response=C,V.duration=Date.now()-(V.timestamp||Date.now())}if(!k.ok){s({lastResponse:C,httpHistory:q,authorizationCode:void 0,error:nd(k),isInitiatingAuth:!1});return}const U=k.body;let P=(R().infoLogs||[]).filter(V=>V.id!=="auth-code"&&V.id!=="oauth-tokens"&&V.id!=="token");if(y.authorizationCode&&(P=[...P,{id:"auth-code",level:"info",step:"authorization_request",label:"Authorization Code",data:{code:y.authorizationCode},timestamp:Date.now()}]),U.access_token){const V={access_token:U.access_token};U.refresh_token&&(V.refresh_token=U.refresh_token),P=[...P,{id:"oauth-tokens",level:"info",step:"token_request",label:"OAuth Tokens",data:V,timestamp:Date.now()}]}if(U.access_token){const V=Nn(U.access_token);if(V){const G={...V};G.exp&&(G.exp=`${G.exp} (${Ye(G.exp)})`),G.iat&&(G.iat=`${G.iat} (${Ye(G.iat)})`),G.nbf&&(G.nbf=`${G.nbf} (${Ye(G.nbf)})`);const Ie={...G};if(G.aud){const $e=y.serverUrl,Pt=(Array.isArray(G.aud)?G.aud:[G.aud]).some(jt=>jt===$e);Ie._validation={expected_audience:$e,audience_matches:Pt,note:Pt?"✓ Token audience matches MCP server":"⚠ Token audience does not match MCP server (security risk)"}}else Ie._validation={note:"⚠ No audience claim found - server should validate token binding"};P=[...P,{id:"token",level:"info",step:"token_request",label:"Access Token (Decoded JWT)",data:Ie,timestamp:Date.now()}]}}if(U.id_token){const V=Nn(U.id_token);if(V){const G={...V};G.exp&&(G.exp=`${G.exp} (${Ye(G.exp)})`),G.iat&&(G.iat=`${G.iat} (${Ye(G.iat)})`),G.nbf&&(G.nbf=`${G.nbf} (${Ye(G.nbf)})`),G.auth_time&&(G.auth_time=`${G.auth_time} (${Ye(G.auth_time)})`),G._note="OIDC ID Token - Used for user identity verification",P=[...P,{id:"id-token",level:"info",step:"token_request",label:"ID Token (OIDC - Decoded JWT)",data:G,timestamp:Date.now()}]}}s({currentStep:"received_access_token",accessToken:U.access_token,refreshToken:U.refresh_token,tokenType:U.token_type||"Bearer",expiresIn:U.expires_in,lastResponse:C,httpHistory:q,infoLogs:P,error:void 0,isInitiatingAuth:!1})}catch(g){const E={status:0,statusText:"Network Error",headers:{},body:{error:g instanceof Error?g.message:String(g)}},k=[...y.httpHistory||[]];if(k.length>0){const C=k[k.length-1];C.response=E,C.duration=Date.now()-(C.timestamp||Date.now())}s({lastResponse:E,httpHistory:k,error:`Token exchange failed: ${g instanceof Error?g.message:String(g)}`,isInitiatingAuth:!1})}break;case"received_access_token":if(!y.serverUrl||!y.accessToken)throw new Error("Missing server URL or access token");const ie={method:"POST",url:y.serverUrl,headers:{Authorization:`Bearer ${y.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":F,"Mcp-Method":"tools/list"},body:cl({protocolVersion:F,authMode:m,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2})},A=ve(R(),"authenticated_mcp_request","authenticated-verify","Authenticated MCP Verify Request (tools/list)",{Request:"Stateless tools/list with OAuth bearer token","Protocol Version":"2026-07-28",Client:"MCPJam Inspector v1.0.0",Endpoint:y.serverUrl});s({currentStep:"authenticated_mcp_request",lastRequest:ie,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"authenticated_mcp_request",timestamp:Date.now(),request:ie}],infoLogs:A,isInitiatingAuth:!1}),Q(50);return;case"authenticated_mcp_request":if(!y.serverUrl||!y.accessToken)throw new Error("Missing server URL or access token");try{const g=await Y(y.serverUrl,{method:"POST",headers:Vt(h,{Authorization:`Bearer ${y.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":F,"Mcp-Method":"tools/list"}),body:JSON.stringify(cl({protocolVersion:F,authMode:m,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2}))}),E={status:g.status,statusText:g.statusText,headers:g.headers,body:g.body},k=[...y.httpHistory||[]];if(k.length>0){const V=k[k.length-1];V.response=E,V.duration=Date.now()-(V.timestamp||Date.now())}if(!g.ok){s({lastResponse:E,httpHistory:k,error:sd(g),isInitiatingAuth:!1});return}let C=R().infoLogs||[];const q=g.headers["content-type"]||"",U=q.includes("text/event-stream");let P=null;if(U&&g.body?.transport==="sse"?P=g.body.mcpResponse:P=g.body,U&&P?.result?.protocolVersion){const V={Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Protocol Version":P.result.protocolVersion};P.result.serverInfo&&(V["Server Name"]=P.result.serverInfo.name,V["Server Version"]=P.result.serverInfo.version),P.result.capabilities&&(V.Capabilities=P.result.capabilities),C=ve(R(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",V)}else if(U)C=ve(R(),"authenticated_mcp_request","mcp-transport","MCP Transport Detected",{Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Content-Type":q,Note:"Server returned streaming response. tools/list verify response delivered via SSE stream.",Events:g.body?.events?`${g.body.events.length} events parsed`:"No events parsed"});else if(P?.result?.protocolVersion){const V={Transport:"Streamable HTTP","Response Format":"JSON","Protocol Version":P.result.protocolVersion};P.result.serverInfo&&(V["Server Name"]=P.result.serverInfo.name,V["Server Version"]=P.result.serverInfo.version),P.result.capabilities&&(V.Capabilities=P.result.capabilities),C=ve(R(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",V)}else if(P?.result){const V=Array.isArray(P.result.tools)?P.result.tools.length:void 0;C=ve(R(),"authenticated_mcp_request","mcp-token-verified","Access token verified (tools/list)",{Transport:"Streamable HTTP","Response Format":"JSON",Result:"Bearer token accepted; tools/list succeeded",...V!==void 0?{"Tools listed":V}:{}})}s({currentStep:"complete",lastResponse:E,httpHistory:k,infoLogs:C,error:void 0,isInitiatingAuth:!1})}catch(g){const E={status:0,statusText:"Network Error",headers:{},body:{error:g instanceof Error?g.message:String(g)}},k=[...y.httpHistory||[]];if(k.length>0){const C=k[k.length-1];C.response=E,C.duration=Date.now()-(C.timestamp||Date.now())}s({lastResponse:E,httpHistory:k,error:`Authenticated MCP request failed: ${g instanceof Error?g.message:String(g)}`,isInitiatingAuth:!1})}break;case"complete":s({isInitiatingAuth:!1});break;default:s({isInitiatingAuth:!1})}}catch(ne){const H=R(),I=$r(ne),ee=ve(H,H.currentStep,`error-${H.currentStep}-${Date.now()}`,"Step failed",{step:H.currentStep,request:H.lastRequest,response:H.lastResponse,error:I},{level:"error",error:I}),oe=wi(H.httpHistory,I),he={error:I.message,infoLogs:ee,isInitiatingAuth:!1};oe&&(he.httpHistory=oe),s(he)}},startGuidedFlow:async()=>{s({currentStep:"idle",isInitiatingAuth:!1})},resetFlow:()=>{s(id())}};return le};function l9({protocolVersion:e,registrationStrategy:t,flowState:r}){switch(e){case"2025-03-26":return UN(r,t==="cimd"?"dcr":t);case"2025-06-18":return VN(r,t==="cimd"?"dcr":t);case"2025-11-25":return JN(r,t);case"2026-07-28":return e$(r,t);default:throw new Error(`Unknown protocol version: ${e}`)}}function gd(e){return e.replace(/^\[|\]$/g,"").trim().toLowerCase().replace(/\.+$/,"")}function rk(e){const t=e.split(".").map(i=>parseInt(i,10));if(t.length!==4||t.some(i=>!Number.isInteger(i)||i<0||i>255))return!0;const[r,s,n]=t;return r===0||r===10||r===100&&s>=64&&s<=127||r===127||r===169&&s===254||r===172&&s>=16&&s<=31||r===192&&s===0&&n===0||r===192&&s===0&&n===2||r===192&&s===88&&n===99||r===192&&s===168||r===198&&(s===18||s===19)||r===198&&s===51&&n===100||r===203&&s===0&&n===113||r>=224&&r<=239||r>=240}function sk(e){let t=e.trim().toLowerCase().split("%")[0];t.startsWith("[")&&t.endsWith("]")&&(t=t.slice(1,-1));const r=t.match(/^(.*:)(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);if(r){const o=[r[2],r[3],r[4],r[5]].map(a=>parseInt(a,10));if(o.some(a=>a<0||a>255))return null;t=`${r[1]}${(o[0]<<8|o[1]).toString(16)}:${(o[2]<<8|o[3]).toString(16)}`}const s=o=>{if(o==="")return[];const a=[];for(const c of o.split(":")){if(!/^[0-9a-f]{1,4}$/.test(c))return null;a.push(parseInt(c,16))}return a},n=t.split("::");if(n.length>2)return null;if(n.length===2){const o=s(n[0]),a=s(n[1]);if(!o||!a)return null;const c=8-o.length-a.length;return c<1?null:[...o,...Array(c).fill(0),...a]}const i=s(t);return i&&i.length===8?i:null}function j_(e,t){return rk(`${e>>8}.${e&255}.${t>>8}.${t&255}`)}function o$(e){const t=sk(e);if(!t||t.slice(0,6).every(s=>s===0)&&t[6]===0&&(t[7]===0||t[7]===1))return!0;const r=t[0]>>8;return(r&254)===252||t[0]>=65152&&t[0]<=65215||r===255||t[0]===8193&&t[1]===3512||t[0]===256&&t[1]===0&&t[2]===0&&t[3]===0?!0:t[0]===100&&t[1]===65435?t[2]===1?!0:j_(t[6],t[7]):t[0]===0&&t[1]===0&&t[2]===0&&t[3]===0&&t[4]===0&&(t[5]===65535||t[5]===0)?j_(t[6],t[7]):!1}function a$(e){const t=gd(e);return/^\d+\.\d+\.\d+\.\d+$/.test(t)?rk(t):t.includes(":")?o$(t):!1}function c$(e){const t=gd(e);return t==="localhost"||t.endsWith(".localhost")?!0:a$(t)}function l$(e){const t=gd(e);return/^\d+\.\d+\.\d+\.\d+$/.test(t)?nk(t):t.includes(":")?u$(t):!1}function nk(e){const t=e.split(".").map(o=>parseInt(o,10));if(t.length!==4||t.some(o=>!Number.isInteger(o)||o<0||o>255))return!0;const[r,s,n,i]=t;return r===0||r===169&&s===254||r===100&&s===100&&n===100&&i===200||r>=224&&r<=239||r>=240}function H_(e,t){return nk(`${e>>8}.${e&255}.${t>>8}.${t&255}`)}function u$(e){const t=sk(e);return t?t.slice(0,6).every(r=>r===0)&&t[6]===0&&(t[7]===0||t[7]===1)?t[7]===0:t[0]>=65152&&t[0]<=65215||t[0]>>8===255||t[0]===256&&t[1]===0&&t[2]===0&&t[3]===0||t[0]===64768&&t[1]===3778&&t[2]===0&&t[3]===0&&t[4]===0&&t[5]===0&&t[6]===0&&t[7]===596?!0:t[0]===100&&t[1]===65435||t[0]===0&&t[1]===0&&t[2]===0&&t[3]===0&&t[4]===0&&(t[5]===65535||t[5]===0)?H_(t[6],t[7]):!1:!0}var d$=new Set(["metadata.google.internal","metadata.goog"]);function p$(e){const t=gd(e);return d$.has(t)?!0:l$(t)}function ik(e){const t=e.replace(/^\[|\]$/g,"").toLowerCase(),r=t.match(/^::(?:ffff:)?(\d{1,3})\.\d{1,3}\.\d{1,3}\.\d{1,3}$/);if(r)return parseInt(r[1],10)===127;const s=t.match(/^::(?:ffff:)?([0-9a-f]{1,4}):[0-9a-f]{1,4}$/);return s?parseInt(s[1],16)>>8===127:!1}function u9(e){if(!e)return!1;try{const t=new URL(e).hostname;return md(t)||ik(t)}catch{return!1}}var aa=class extends Error{url;reason;constructor(e,t,r){super(r),this.name="OAuthOutboundUrlBlockedError",this.url=e,this.reason=t}};function h$(e,t={}){let r;try{r=new URL(e)}catch{throw new aa(e,"invalid-url","Outbound OAuth fetch URL is not a valid absolute URL")}if(r.protocol!=="https:"&&r.protocol!=="http:")throw new aa(e,"invalid-scheme",`Outbound OAuth fetch must be http(s); got "${r.protocol}"`);const s=r.hostname;if(p$(s))throw new aa(e,"private-host",`Refusing outbound OAuth fetch to link-local or cloud-metadata host "${s}"`);if(t.allowPrivateNetwork===!0)return r;if(md(s)||ik(s)){if(t.allowLoopback===!0)return r;throw new aa(e,"private-host",`Refusing outbound OAuth fetch to loopback host "${s}" (no loopback opt-in)`)}if(c$(s))throw new aa(e,"private-host",`Refusing outbound OAuth fetch to private/reserved host "${s}"`);return r}var f$=class extends Error{field;constructor(e,t){super(`OAuth response from ${t} carried a redacted \`${e}\`. Trace redaction was applied to data the OAuth flow consumes; a redaction sentinel is a non-empty string, so it would be sent upstream as a credential and rejected as invalid. Redaction belongs to the trace projection layer only.`),this.name="OAuthRedactedCredentialError",this.field=e}},m$=["access_token","refresh_token","id_token","client_secret"],g$=[/^\[redacted\]$/,/^[\s\S]{4}\.\.\.\[redacted\]\.\.\.[\s\S]{2}$/];function v$(e){try{const t=new URL(e.url);return`${t.origin}${t.pathname}`}catch{return"the authorization server"}}function _$(e,t){const r=e?.body;if(!r||typeof r!="object"||Array.isArray(r))return e;const s=r;for(const n of m$){const i=s[n];if(typeof i=="string"&&g$.some(o=>o.test(i)))throw new f$(n,v$(t))}return e}function y$(e){const{protocolVersion:t,allowLoopbackMetadataFetch:r,allowPrivateMetadataFetch:s,...n}=e,i=r??!1,o=s??!1,c={...n,requestExecutor:async l=>(h$(l.url,{allowLoopback:i,allowPrivateNetwork:o}),_$(await n.requestExecutor(l),l)),customHeaders:DN(n.customHeaders,n.emulation)};switch(t){case"2025-03-26":if(e.registrationStrategy==="cimd")throw new Error("CIMD registration is not supported in 2025-03-26 protocol. Use 'dcr' or 'preregistered' instead.");return zN(c);case"2025-06-18":if(e.registrationStrategy==="cimd")throw new Error("CIMD registration is not supported in 2025-06-18 protocol. Use 'dcr' or 'preregistered' instead.");return GN(c);case"2025-11-25":return YN(c);case"2026-07-28":return i$(c);default:throw new Error(`Unknown protocol version: ${t}`)}}function d9(e){switch(e){case"2025-03-26":return"dcr";case"2025-06-18":return"dcr";case"2025-11-25":return"cimd";case"2026-07-28":return"cimd";default:return"dcr"}}function p9(e){switch(e){case"2025-03-26":return["dcr","preregistered"];case"2025-06-18":return["dcr","preregistered"];case"2025-11-25":return["cimd","dcr","preregistered"];case"2026-07-28":return["cimd","dcr","preregistered"];default:return["dcr","preregistered"]}}var h9={"2025-03-26":{label:Vc("2025-03-26"),description:"Original MCP OAuth specification with direct discovery",features:["Dynamic Client Registration (DCR) SHOULD be supported","Direct RFC8414 discovery from MCP server base URL","Fallback to default endpoints (/authorize, /token, /register)","PKCE is REQUIRED for all clients","No Protected Resource Metadata (RFC9728)"]},"2025-06-18":{label:Vc("2025-06-18"),description:"MCP OAuth specification with resource metadata",features:["Dynamic Client Registration (DCR) SHOULD be supported","Protected Resource Metadata (RFC9728) required","RFC8414 discovery ONLY (no OIDC) with root fallback","PKCE recommended but not strictly enforced"]},"2025-11-25":{label:Vc("2025-11-25"),description:"MCP OAuth specification with CIMD support",features:["Client ID Metadata Documents (CIMD) SHOULD be supported","Protected Resource Metadata (RFC9728) required","RFC8414 OR OIDC discovery without root fallback","PKCE strictly required and enforced","Enhanced security with URL-based client IDs"]},"2026-07-28":{label:Vc("2026-07-28"),description:"Newest MCP OAuth specification: 2025-11-25 discovery plus OIDC application_type",features:["Client ID Metadata Documents (CIMD) SHOULD be supported","Protected Resource Metadata (RFC9728) required","RFC8414 OR OIDC discovery without root fallback","PKCE strictly required and enforced","SEP-837: OIDC application_type sent on Dynamic Client Registration"]}},b$=["idle","request_without_token","received_401_unauthorized","discovery_start","request_resource_metadata","received_resource_metadata","request_authorization_server_metadata","received_authorization_server_metadata","cimd_prepare","cimd_fetch_request","cimd_metadata_response","request_client_registration","received_client_credentials","generate_pkce_parameters","authorization_request","received_authorization_code","token_request","received_access_token","authenticated_mcp_request","complete","verify_list_tools","verify_call_tool"],S$={idle:{title:"Idle",summary:"The OAuth flow is ready to start.",teachableMoments:["Review your server selection and OAuth configuration before starting."]},request_without_token:{title:"Initial MCP Request",summary:"The client sends an unauthenticated initialize request to discover whether OAuth is required.",teachableMoments:["OAuth flows usually begin with a protected resource request that deliberately lacks credentials.","The response determines which discovery path the client must follow."]},received_401_unauthorized:{title:"401 Unauthorized Received",summary:"The MCP server indicates OAuth is required and often provides discovery hints in WWW-Authenticate.",teachableMoments:["Look for the resource metadata URL or realm in the header to understand where discovery begins."],tips:["If you get 200 instead, the server may allow optional OAuth or anonymous access."]},discovery_start:{title:"Start Discovery",summary:"The client derives authorization server endpoints from the MCP server URL.",teachableMoments:["Legacy servers rely on RFC8414 discovery directly from the MCP base URL.","Understanding how fallback URLs are constructed helps debug missing metadata issues."]},request_resource_metadata:{title:"Request Resource Metadata",summary:"The client requests RFC9728 resource metadata to learn which authorization server to use.",teachableMoments:["Protected resource metadata links the resource to one or more authorization servers.","If this step fails, check the MCP server's well-known configuration and headers."]},received_resource_metadata:{title:"Resource Metadata Received",summary:"The response describes supported authorization servers, scopes, and bearer method details.",teachableMoments:["Validate that the authorization server URL looks correct for the environment you're targeting."]},request_authorization_server_metadata:{title:"Request Authorization Server Metadata",summary:"The client requests the authorization server's well-known metadata endpoint (RFC8414 or OIDC).",teachableMoments:["Different protocol versions prioritize different discovery strategies (path insertion, appending, etc.).","Failure here often points to misconfigured issuer URLs or CORS/proxy issues."]},received_authorization_server_metadata:{title:"Authorization Server Metadata Received",summary:"Inspector validates the authorization, token, and optional registration endpoints.",teachableMoments:["Confirm PKCE methods include S256 for modern flows.","Check the available scopes and grant types to ensure the server supports what you need."]},cimd_prepare:{title:"Prepare CIMD",summary:"Draft protocol: the client prepares to use a Client ID Metadata Document (CIMD).",teachableMoments:["CIMD replaces static client IDs with an HTTPS URL that hosts client metadata."]},cimd_fetch_request:{title:"Authorization Server Fetches CIMD",summary:"The authorization server fetches the client's metadata document over HTTPS.",teachableMoments:["Monitor this step to diagnose TLS or hosting issues with your metadata document."]},cimd_metadata_response:{title:"CIMD Validated",summary:"The client confirms the authorization server successfully read the client metadata document.",teachableMoments:["Ensure redirect URIs declared in the document match the environment you're testing."]},request_client_registration:{title:"Request Dynamic Client Registration",summary:"The client submits metadata to register a public client with the authorization server.",teachableMoments:["Dynamic registration is optional in draft flows but required in earlier specs unless you pre-register.","Watch for HTTP 4xx responses that indicate validation failures."]},received_client_credentials:{title:"Client Credentials Received",summary:"The client stores client_id (and optionally client_secret) for the remainder of the flow.",teachableMoments:["Keep an eye on whether the server returned a secret; public clients should use PKCE instead."]},generate_pkce_parameters:{title:"Generate PKCE Parameters",summary:"The client creates a code verifier and challenge to protect the authorization code exchange.",teachableMoments:["PKCE S256 is required in draft specs and strongly recommended everywhere else."]},authorization_request:{title:"Authorization Request Ready",summary:"The client composes the authorization URL and waits for the user to approve access.",teachableMoments:["Inspect the URL to ensure scopes and redirect URI are what you expect."]},received_authorization_code:{title:"Authorization Code Received",summary:"The user completed consent and the client captured the returned authorization code.",teachableMoments:["State mismatches here usually indicate multiple concurrent authorizations or stale popups."]},token_request:{title:"Request Tokens with Authorization Code",summary:"The client calls the token endpoint with the authorization code and PKCE verifier.",teachableMoments:["Token endpoint errors often reveal scope or client configuration problems."]},received_access_token:{title:"Tokens Received",summary:"The client stores access and refresh tokens for subsequent authenticated MCP requests.",teachableMoments:["Check the token type and expiry to confirm the server honored offline access or refresh tokens."]},authenticated_mcp_request:{title:"Authenticated MCP Request",summary:"The client retries the MCP initialize call with the freshly issued access token.",teachableMoments:["Use this step to validate that MCP servers accept OAuth tokens and return capabilities."]},complete:{title:"Flow Complete",summary:"The client verified the server with OAuth credentials and recorded the final response.",teachableMoments:["Continue exploring with authenticated requests or reset to run the flow again."]},verify_list_tools:{title:"Verify: List Tools",summary:"Connect to the MCP server with the obtained token and list available tools.",teachableMoments:["This step confirms the OAuth token is actually usable for MCP operations."]},verify_call_tool:{title:"Verify: Call Tool",summary:"Execute a tool on the MCP server to confirm end-to-end functionality.",teachableMoments:["Calling a tool validates not just authentication but also authorization scopes."]}};function B_(e){return S$[e]??{title:e,summary:"No additional information available for this step."}}function pn(e){const t=b$.indexOf(e);return t===-1?Number.MAX_SAFE_INTEGER:t}function w$(e){return JSON.parse(JSON.stringify(e))}function k$(e){return{...e,request:{...e.request,url:qm(e.request.url),headers:__(e.request.headers),body:bs(e.request.body)},...e.response?{response:{...e.response,headers:__(e.response.headers),body:bs(e.response.body)}}:{},...e.error?{error:{...e.error,...e.error.message?{message:In(e.error.message)}:{},details:bs(e.error.details)}}:{}}}function E$(...e){const t=e.filter(r=>r!=null);if(t.length!==0)return Math.max(...t)}function T$(){return{syntheticStepTimestamps:{},lastSyntheticTimestamp:0}}function A$(e,t,r){if(!e)return r;const s=e.syntheticStepTimestamps[t];return typeof s=="number"?s:r}function V_(e,t,r,s){const n=A$(t,r,s),i=e.get(r);if(i)return i.startedAt=Math.min(i.startedAt,n),i.completedAt=Math.max(i.completedAt??n,s),i;const o={step:r,startedAt:n,completedAt:s};return e.set(r,o),o}function Fn(e,t,r,s,n,i){if(!s||e.has(r))return;let o=Date.now();t&&(o=Math.max(o,t.lastSyntheticTimestamp+1),t.syntheticStepTimestamps[r]=o,t.lastSyntheticTimestamp=o);const a=n==null?void 0:i?bs(n):JSON.parse(JSON.stringify(n));e.set(r,{step:r,startedAt:o,completedAt:o,details:a})}function I$(e,t){if(e!==t.currentStep)return!1;switch(e){case"authorization_request":return!!t.authorizationUrl;case"received_authorization_code":return!!t.authorizationCode;case"received_access_token":return!!t.accessToken;case"complete":return t.currentStep==="complete";default:return!1}}function R$(e){if(!(!e||e.status<400))return Xm(e.body)??`HTTP ${e.status} ${e.statusText}`}function C$(e){if(e.error?.message)return e.error.message;if(e.step==="request_client_registration")return R$(e.response)}function G_(e){return!e.error||!e.clientId||pn(e.currentStep)<=pn("request_client_registration")?!1:e.error.startsWith("Dynamic Client Registration failed")||e.error.startsWith("Client registration failed:")}function P$(e){const{state:t,context:r,sanitize:s=!0}=e,n=t.error?s?In(t.error):t.error:void 0,i={version:1,currentStep:t.currentStep,steps:[],httpHistory:(t.httpHistory??[]).map(u=>s?k$(u):w$(u)),...n?{error:n}:{}},o=pn(t.currentStep),a=new Map;for(const u of t.httpHistory??[]){const p=V_(a,r,u.step,u.timestamp);p.details||(p.details={request:s?bs(u.request):u.request,...u.response?{response:s?bs(u.response):u.response}:{}});const d=C$(u);d&&(p.error=Vh(s?In(d):d.slice(0,500)))}for(const u of t.infoLogs??[]){const p=V_(a,r,u.step,u.timestamp);p.message=u.label;const d=s?bs(u.data):u.data;d&&typeof d=="object"&&d!==null&&!Array.isArray(d)&&(p.details=d),u.error?.message&&(p.error=s?In(u.error.message):u.error.message)}const c=Math.max(Date.now(),...(t.httpHistory??[]).map(u=>u.timestamp),...(t.infoLogs??[]).map(u=>u.timestamp),r?.lastSyntheticTimestamp??0);r&&(r.lastSyntheticTimestamp=Math.max(r.lastSyntheticTimestamp,c)),Fn(a,r,"received_client_credentials",!!t.clientId,{clientId:t.clientId},s),Fn(a,r,"generate_pkce_parameters",!!t.codeVerifier,{codeVerifier:t.codeVerifier},s),Fn(a,r,"authorization_request",!!t.authorizationUrl,{authorizationUrl:t.authorizationUrl},s),Fn(a,r,"received_authorization_code",!!t.authorizationCode,t.authorizationCode?{code:t.authorizationCode}:void 0,s),Fn(a,r,"received_access_token",!!t.accessToken,{tokenType:t.tokenType,expiresIn:t.expiresIn},s),Fn(a,r,"complete",t.currentStep==="complete",void 0,s);const l=a.get("request_client_registration");if(l?.error&&pn(t.currentStep)>pn("request_client_registration")&&t.clientId&&(l.recovered=!0,l.recoveredAt=E$(l.recoveredAt,l.completedAt,a.get("received_client_credentials")?.startedAt),l.recoveryMessage="Using pre-registered client credentials after registration failed."),t.error&&!G_(t)&&!a.has(t.currentStep)){Fn(a,r,t.currentStep,!0,void 0,s);const u=a.get(t.currentStep);u&&(u.error=n)}return i.steps=Array.from(a.values()).sort((u,p)=>u.startedAt-p.startedAt||pn(u.step)-pn(p.step)).map(u=>{const p=pn(u.step),d=u.step===t.currentStep&&!!t.error&&!G_(t),h=u.error??(d?n:void 0),f=u.recovered?"success":h?"error":p<o||t.currentStep==="complete"||I$(u.step,t)?"success":u.step===t.currentStep?"pending":"success";return{step:u.step,title:B_(u.step).title,status:f,message:u.message??B_(u.step).summary,...h?{error:h}:{},...u.details?{details:u.details}:{},...u.recovered?{recovered:!0}:{},...u.recoveredAt?{recoveredAt:u.recoveredAt}:{},...u.recoveryMessage?{recoveryMessage:u.recoveryMessage}:{},startedAt:u.startedAt,completedAt:f==="pending"?void 0:u.completedAt}}),i}function ll(e){return{message:e instanceof Error?e.message:String(e)}}async function f9(e){const{maxSteps:t=40,onAuthorizationRequest:r,onTraceUpdate:s,getState:n,sanitizeTrace:i=!0,...o}=e;let a=e.state;const c=T$(),l=n??(()=>a),u=(m,v=l(),_=c)=>{s?.({trace:P$({state:v,context:_,sanitize:i}),state:v,reason:m})},p=m=>{a={...a,...m},e.updateState(m),u("state_update",a)},d=y$({...o,getState:l,updateState:p});let h=0;for(;l().currentStep!=="complete"&&h<t;){h+=1;const m=l();if(m.currentStep==="authorization_request"){if(!m.authorizationUrl)return p({error:"Authorization URL was not generated."}),{completed:!1,redirected:!1,state:l(),error:{message:"Authorization URL was not generated."}};if(!r)return p({error:"Authorization request requires an authorization handler."}),{completed:!1,redirected:!1,authorizationUrl:m.authorizationUrl,state:l(),error:{message:"Authorization request requires an authorization handler."}};try{const b=await r({authorizationUrl:m.authorizationUrl,state:m});if(b.type==="redirect")return u("redirect"),{completed:!1,redirected:!0,authorizationUrl:m.authorizationUrl,state:l()};p({currentStep:"received_authorization_code",authorizationCode:b.authorizationCode,error:void 0});continue}catch(b){return p({error:ll(b).message}),{completed:!1,redirected:!1,authorizationUrl:m.authorizationUrl,state:l(),error:ll(b)}}}const v=m.currentStep;try{await d.proceedToNextStep()}catch(b){return l().error?u("error"):p({error:ll(b).message}),{completed:!1,redirected:!1,state:l(),error:ll(b)}}const _=l();if(_.currentStep===v)return _.error?u("error",_):p({error:`Step ${v} did not advance.`}),{completed:!1,redirected:!1,state:l(),error:{message:l().error||`Step ${v} did not advance.`}}}const f=l();return h>=t&&f.currentStep!=="complete"?(p({error:"OAuth login exceeded its step guard."}),{completed:!1,redirected:!1,state:l(),error:{message:"OAuth login exceeded its step guard."}}):(u(f.currentStep==="complete"?"complete":"state_update"),{completed:f.currentStep==="complete",redirected:!1,authorizationUrl:f.authorizationUrl,state:f,...f.error?{error:{message:f.error}}:{}})}function m9(e){const t=L$(e.endsWith(" Configure a pre-registered client or enable DCR on the authorization server.")?e.slice(0,-(jl.length+1)):e).slice(0,O$);return _N(t)??U$(t)}var x$=160,O$=4e3,M$=46;function L$(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===M$;)t-=1;return t===e.length?e:e.slice(0,t)}var N$=[[/(\bCould not resolve (?:[a-z-]{1,63} ){0,8}?)[^\s"'();]{1,253}(?=[)"',]*(?:;|$))/g,"$1<host>"],[/[^\s"'()]{1,253}(?= resolves to a private or reserved address\b)/g,"<host>"],[/(\bhost \()[^\s)]{1,253}(\))/g,"$1<host>$2"],[/(\bconnection to ")[^\s"]{1,253}(")/g,"$1<host>$2"]],$$=/(?<![\w:.])(?:[0-9a-f]{0,4}:){2,7}[0-9a-f]{0,4}(?![\w:])/gi,D$=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g;function U$(e){return N$.reduce((t,[r,s])=>t.replace(r,s),e.replace(/\bhttps?:\/\/[^\s"'<>)]+/g,"<url>")).replace($$,"<ip>").replace(D$,"<ip>").replace(/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,"<id>").replace(/\b[A-Za-z0-9_-]{16,}\b/g,t=>/\d/.test(t)?"<id>":t).replace(/\s+/g," ").trim().slice(0,x$)}var q$="xaa-idp-1",z$=["none","private_key_jwt"],g9="none";function v9(e){return typeof e=="string"&&z$.includes(e)?e:void 0}var F$=["valid","bad_signature","wrong_audience","expired","missing_claims","invalid_type_header","wrong_issuer","resource_mismatch","client_id_mismatch","unknown_kid","unknown_sub","scope_denial"],j$="valid";function _9(e){return typeof e=="string"&&F$.includes(e)}var H$=["oidc","saml"],B$="oidc";function y9(e){return typeof e=="string"&&H$.includes(e)?e:void 0}var V$="oauth-sub";function b9(e){return e==="unknown_sub"||e==="scope_denial"}var W_={valid:{label:"Valid",description:"Issues a correct ID-JAG. Your server should accept this one and mint an access token.",expectedFailure:"No failure expected."},bad_signature:{label:"Bad Signature",description:"Signs the token with the wrong key. A correct server checks the signature against your published JWKS and rejects it.",expectedFailure:"Authorization server should reject the signature."},wrong_audience:{label:"Wrong Audience",description:"Addresses the token to a different server (the `aud` claim). A correct server only accepts tokens addressed to its own issuer.",expectedFailure:"Authorization server should reject the audience."},expired:{label:"Expired",description:"Backdates the token so it is already expired. A correct server rejects tokens past their `exp` time.",expectedFailure:"Authorization server should reject the expired assertion."},missing_claims:{label:"Missing Claims",description:"Drops required claims (`sub` and `jti`). A correct server rejects a token that is missing required fields.",expectedFailure:"Authorization server should reject missing required claims."},invalid_type_header:{label:"Invalid `typ` Header",description:"Labels the token as a plain `JWT` instead of `oauth-id-jag+jwt`. A correct server checks the header type and rejects the wrong one.",expectedFailure:"Authorization server should reject the JWT type."},wrong_issuer:{label:"Wrong Issuer",description:"Claims the token came from an issuer you don't trust. A correct server only accepts issuers it is configured to trust.",expectedFailure:"Authorization server should reject the issuer."},resource_mismatch:{label:"Resource Mismatch",description:"Points the token at a different resource. A correct server checks the `resource` matches the MCP server it protects.",expectedFailure:"Authorization server should reject the resource claim."},client_id_mismatch:{label:"Client ID Mismatch",description:"Names a different OAuth client than the one making the request. A correct server rejects the `client_id` mismatch.",expectedFailure:"Authorization server should reject the client identity."},unknown_kid:{label:"Unknown `kid`",description:"References a signing key (`kid`) that isn't in your published JWKS. A correct server can't find the key and rejects the token.",expectedFailure:"Authorization server should fail JWKS key lookup."},unknown_sub:{label:"Unknown Subject",description:"Uses a subject (`sub`) outside the configured happy path. The authorization server may reject it, resolve it, or JIT-provision it according to local policy.",expectedFailure:"Observe the authorization server's subject-resolution policy."},scope_denial:{label:"Scope Denial",description:"Requests high-privilege scopes. The authorization server may reject the request or issue a token with a permitted subset according to local policy.",expectedFailure:"Observe whether the authorization server rejects or narrows the requested scopes."}};function ok(e,t,r=!1){let s,n,i;try{const a=new URL(e);s=a.origin,n=a.pathname==="/"?"":a.pathname,i=r?a.search:""}catch{return[`${e.replace(/\/+$/,"")}/.well-known/${t}`]}if(!n)return[`${s}/.well-known/${t}${i}`];const o=n.replace(/\/+$/,"");return[...new Set([`${s}/.well-known/${t}${n}${i}`,`${s}${o}/.well-known/${t}${i}`,`${s}/.well-known/${t}`])]}var G$=["oauth-authorization-server","openid-configuration"];function W$(e){return ok(e,"oauth-protected-resource",!0)}function K$(e){return G$.flatMap(t=>ok(e,t))}function J$(e){return[e.targetKey,e.registrationEndpoint,e.scope??""].map(encodeURIComponent).join("::")}function pp(e,t=Math.floor(Date.now()/1e3)){return!!e.clientSecret&&typeof e.clientSecretExpiresAt=="number"&&e.clientSecretExpiresAt!==0&&e.clientSecretExpiresAt<=t}var Y$={isBusy:!1,currentStep:"idle",registrationStrategy:"preregistered",serverUrl:void 0,resourceUrl:void 0,resourceMetadataUrl:void 0,resourceMetadata:void 0,authzServerIssuer:void 0,authzMetadata:void 0,tokenEndpoint:void 0,negativeTestMode:j$,identityAssertionFormat:B$,subjectIdentifierFormat:V$,identityAssertionSubject:void 0,userId:void 0,email:void 0,clientId:void 0,clientSecret:void 0,scope:void 0,identityAssertion:void 0,idJag:void 0,idJagDecoded:void 0,accessToken:void 0,tokenType:void 0,expiresIn:void 0,grantedScope:void 0,lastRequest:void 0,lastResponse:void 0,httpHistory:[],infoLogs:[],error:void 0,negativeProbe:void 0,compatibilityReport:void 0,idpPolicy:void 0};function K_(e={}){return{...Y$,...e,negativeTestMode:e.negativeTestMode??"valid",identityAssertionFormat:e.identityAssertionFormat??"oidc",subjectIdentifierFormat:e.subjectIdentifierFormat??"oauth-sub",httpHistory:e.httpHistory??[],infoLogs:e.infoLogs??[]}}function X$(e){if(!e)return"unknown";let t;try{t=new URL(e)}catch{return"unknown"}const r=t.hostname.toLowerCase();return r.endsWith(".okta.com")||r.endsWith(".oktapreview.com")||r.endsWith(".okta-emea.com")?"okta":r.endsWith(".auth0.com")?"auth0":r.endsWith(".workos.com")||r.endsWith(".authkit.app")?"workos":r.endsWith(".stytch.com")||r.endsWith(".stytch.dev")?"stytch":t.pathname.includes("/realms/")||r.startsWith("keycloak.")?"keycloak":"unknown"}var Z$={okta:{vendor:"okta",verdict:"native",note:"Okta drove the Cross-App Access spec and supports the jwt-bearer grant natively. In your Okta admin console, register MCPJam as a trusted identity issuer using the JWKS URL from Register Issuer."},auth0:{vendor:"auth0",verdict:"unknown",note:"Auth0 supports the jwt-bearer grant (RFC 7523). You'll need to configure a trusted issuer pointing at MCPJam's JWKS URL and map subjects to Auth0 users."},keycloak:{vendor:"keycloak",verdict:"unknown",note:"Keycloak supports Token Exchange. Configure a brokered IdP that trusts MCPJam's JWKS and maps claims to realm users."},workos:{vendor:"workos",verdict:"unsupported",note:"WorkOS AuthKit doesn't currently advertise the jwt-bearer grant or federated issuer trust. Workaround: run a small bridge service that verifies the ID-JAG against MCPJam's JWKS and mints access tokens via the WorkOS admin API."},stytch:{vendor:"stytch",verdict:"unsupported",note:"Stytch Connected Apps doesn't currently advertise the jwt-bearer grant. A bridge service is the current workaround; ask Stytch support about roadmap plans for XAA."}};function Q$(e){if(!e)return null;const t=Array.isArray(e.grant_types_supported),r=t?e.grant_types_supported:[],s=r.includes("urn:ietf:params:oauth:grant-type:jwt-bearer")?{id:"jwt_bearer_grant",label:"JWT-bearer grant (RFC 7523)",status:"pass",detail:"Advertised in grant_types_supported."}:t?{id:"jwt_bearer_grant",label:"JWT-bearer grant (RFC 7523)",status:"fail",detail:r.length===0?"grant_types_supported is an empty array; the authorization server declares no supported grant types.":`grant_types_supported does not include ${Jm}. The authorization server will reject the ID-JAG exchange at step 11.`}:{id:"jwt_bearer_grant",label:"JWT-bearer grant (RFC 7523)",status:"unknown",detail:"grant_types_supported is missing from discovery metadata. Support can't be verified without calling the token endpoint."},n=e.token_endpoint?{id:"token_endpoint",label:"Token endpoint",status:"pass",detail:e.token_endpoint}:{id:"token_endpoint",label:"Token endpoint",status:"fail",detail:"Missing from discovery metadata."},i=e.authorization_grant_profiles_supported,o=Array.isArray(i)?i.includes("urn:ietf:params:oauth:grant-profile:id-jag")?{id:"id_jag_profile",label:"ID-JAG grant profile (draft -04)",status:"pass",detail:"Advertised in authorization_grant_profiles_supported."}:{id:"id_jag_profile",label:"ID-JAG grant profile (draft -04)",status:"fail",detail:`authorization_grant_profiles_supported is advertised but does not include ${Wm} — an explicit statement that the ID-JAG profile is unsupported.`}:{id:"id_jag_profile",label:"ID-JAG grant profile (draft -04)",status:"warn",detail:"authorization_grant_profiles_supported is not advertised. Draft -04 says SHOULD, so this is a conformance warning, not a failure."},a=e.client_id_metadata_document_supported,c=[s,n,o,a===!0?{id:"cimd_supported",label:"Client ID Metadata Documents",status:"pass",detail:"client_id_metadata_document_supported: true."}:a===!1?{id:"cimd_supported",label:"Client ID Metadata Documents",status:"fail",detail:"client_id_metadata_document_supported is explicitly false — URL-formatted client_ids are not accepted."}:{id:"cimd_supported",label:"Client ID Metadata Documents",status:"unknown",detail:"client_id_metadata_document_supported is not advertised; the CIMD draft directs clients not to attempt the flow."}],l=X$(e.issuer),u=Z$[l],p=[s,n];let d="pass";return p.some(h=>h.status==="fail")||o.status==="fail"?d="fail":p.some(h=>h.status==="warn"||h.status==="unknown")&&(d="warn"),u?.verdict==="unsupported"&&(d="fail"),{overall:d,checks:c,vendor:l,vendorHint:u}}function eD(e,t,r){if(e)return e;if(!t)return"none";if(Array.isArray(r)){if(r.includes("client_secret_basic"))return"client_secret_basic";if(r.includes("client_secret_post"))return"client_secret_post";if(r.includes("none"))return"none"}return"client_secret_post"}var Hl="••••••••",tD=new Set(["authorization","proxyauthorization","clientsecret","clientassertion","identityassertion","assertion","idtoken","idjag","accesstoken","refreshtoken","subjecttoken","actortoken"]);function rD(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function sD(e,t=[]){const r=n=>{let i=n;for(const o of t)o&&o!=="••••••••"&&(i=i.split(o).join(Hl));return i.replace(/(\b(?:proxy-)?authorization\s*[:=]\s*)(?:bearer|basic)\s+[^\s,;"'}]+/gi,`$1${Hl}`)},s=(n,i)=>i&&tD.has(rD(i))?n==="••••••••"||n==="***REDACTED***"||n==="[REDACTED]"?n:Hl:typeof n=="string"?r(n):Array.isArray(n)?n.map(o=>s(o)):!n||typeof n!="object"?n:Object.fromEntries(Object.entries(n).map(([o,a])=>[o,s(a,o)]));return s(e)}var nD=["lastRequest","lastResponse","httpHistory","infoLogs","error"];function iD(e,t){const r=[e.clientSecret,e.identityAssertion,e.idJag,e.accessToken,t.clientSecret,t.identityAssertion,t.idJag,t.accessToken].filter(n=>typeof n=="string"&&!!n),s={...t};for(const n of nD)n in s&&(s[n]=sD(s[n],r));return s}function oD(e,t,r,s,n,i={}){const{level:o="info",error:a}=i;return[...e.infoLogs||[],{id:r,step:t,label:s,data:n,timestamp:Date.now(),level:o,error:a}]}function aD(e){return e instanceof Error?{message:e.message,details:{name:e.name,stack:e.stack}}:typeof e=="string"?{message:e}:{message:"Unexpected error",details:e}}function hp(e,t={}){const r={},s=new Map,n=i=>{if(i)for(const[o,a]of Object.entries(i)){const c=o.toLowerCase(),l=s.get(c);l&&l!==o&&delete r[l],s.set(c,o),r[o]=a}};n(e),n(t);for(const i of Object.keys(r))i.toLowerCase()==="authorization"&&delete r[i];return r}function cD(e){if(!e||e.checks.find(r=>r.id==="jwt_bearer_grant")?.status!=="pass")return 3;const t=e.checks.find(r=>r.id==="id_jag_profile")?.status;return t==="pass"?1:t==="warn"?2:3}function en(e,t){return Xm(e)??t}var lD=["access_denied","invalid_target","invalid_client","invalid_scope","temporarily_unavailable"];function J_(e){return e?e.split(/\s+/).filter(Boolean):[]}function Y_(e){const t=e&&typeof e=="object"?e.error:void 0,r=lD.includes(t)?t:void 0,s=e&&typeof e=="object"&&typeof e.error_description=="string"?e.error_description.slice(0,120):void 0;return{outcome:"denied",...r?{errorCode:r}:{},...s?{reasonCode:s}:{}}}function X_(e,t){const r=typeof e=="string"?e:t,s=new Set(J_(r));return{outcome:J_(t).some(n=>!s.has(n))?"downscoped":"granted",...t?{requestedScope:t}:{},...r!==void 0?{grantedScope:r}:{}}}function jn(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} did not return a JSON object`);return e}function Z_(e){return typeof e=="number"?`${e} (${Ye(e)})`:e===void 0?"(missing)":e===null?"null":typeof e=="object"?JSON.stringify(e):String(e)}function uD(e,t){const r=Zw(e),s=[];if(!r)return{header:null,payload:null,signature:"",issues:[{section:"payload",field:"token",label:"JWT parsing",expected:"A well-formed three-part JWT",actual:"The returned assertion could not be decoded."}]};const n=r.header||{},i=r.payload||{},o=(a,c,l,u,p)=>{s.push({section:a,field:c,label:l,expected:Z_(u),actual:Z_(p)})};return n.typ!=="oauth-id-jag+jwt"&&o("header","typ","JWT type","oauth-id-jag+jwt",n.typ),n.kid!=="xaa-idp-1"&&o("header","kid","Key identifier",q$,n.kid),i.iss!==t.issuer&&o("payload","iss","Issuer",t.issuer,i.iss),i.sub!==void 0&&String(i.sub).trim()===""&&o("payload","sub","Subject","Non-empty subject",i.sub),i.sub===void 0&&o("payload","sub","Subject","Present",i.sub),i.aud!==t.audience&&o("payload","aud","Audience",t.audience,i.aud),i.resource!==t.resource&&o("payload","resource","Resource",t.resource,i.resource),i.client_id!==t.clientId&&o("payload","client_id","Client ID",t.clientId,i.client_id),(typeof i.exp!="number"||i.exp<=Date.now()/1e3)&&o("payload","exp","Expiration","A future timestamp",i.exp),t.scope&&i.scope!==t.scope&&o("payload","scope","Requested scopes",t.scope,i.scope),t.negativeTestMode==="bad_signature"&&o("signature","signature","Signature / JWKS","Signed by the published XAA issuer key","Signed with a throwaway private key"),{header:r.header,payload:r.payload,signature:r.signature,issues:s}}var dD=32;function S9(e){const{state:t,getState:r,updateState:s,serverUrl:n,issuerBaseUrl:i,mintPathPrefix:o="",issuerMode:a,organizationId:c,policyMode:l,testIdentityId:u,resourceAppId:p,issuerKind:d,specTokenEndpointAvailable:h=!0,requestExecutor:f,negativeTestMode:m,identityAssertionFormat:v,subjectIdentifierFormat:_,userId:b,email:T,clientId:O,clientSecret:x,scope:D,authzServerIssuer:z,registrationId:F,serverId:J,projectId:ce,registrationStrategy:de="preregistered",dcrCredentialCache:R,dcrCacheTargetKey:fe,clientIdMetadataUrl:Y,allowLoopbackClientMetadata:me}=e,$=F||J?"preregistered":de,le=a==="hosted"?{issuerMode:a,...c?{organizationId:c}:{},...d==="anonymous"?{issuerKind:"anonymous"}:{}}:{},y=l?{"x-mcpjam-policy-mode":l,...u?{"x-mcpjam-test-identity-id":u}:{},...p?{"x-mcpjam-resource-app-id":p}:{}}:{},Q=l?{policyMode:l,...u?{testIdentityId:u}:{},...p?{resourceAppId:p}:{}}:{},ne=t??{},H={state:K_({...ne,serverUrl:ne.serverUrl||n,resourceUrl:ne.resourceUrl||n,issuerBaseUrl:ne.issuerBaseUrl||i,negativeTestMode:ne.negativeTestMode||m,identityAssertionFormat:ne.identityAssertionFormat||v,subjectIdentifierFormat:ne.subjectIdentifierFormat||_,userId:ne.userId||b,email:ne.email||T,clientId:ne.clientId||O,clientSecret:ne.clientSecret||x,scope:ne.scope||D,authzServerIssuer:ne.authzServerIssuer||z,registrationStrategy:$}),updateState:A=>{const g=iD(H.state,A);H.state={...H.state,...g},s(g)},proceedToNextStep:async()=>{},runAll:async()=>{},resetFlow:()=>{}},I=()=>r?.()??H.state,ee=(A,g,E,k,C)=>{H.updateState({infoLogs:oD(I(),A,g,E,k,C)})},oe=async(A,g,E)=>{H.updateState({currentStep:A,isBusy:!0,error:void 0,negativeProbe:void 0,lastRequest:g,lastResponse:void 0});const k=Date.now();try{const C=await E(),q={status:C.status,statusText:C.statusText,headers:C.headers,body:C.body};return H.updateState({isBusy:!1,lastResponse:q,httpHistory:[...I().httpHistory||[],{step:A,timestamp:k,duration:Date.now()-k,request:g,response:q}]}),C}catch(C){const q=aD(C);throw H.updateState({isBusy:!1,error:q.message,httpHistory:[...I().httpHistory||[],{step:A,timestamp:k,duration:Date.now()-k,request:g,error:q}]}),ee(A,`${A}-error-${k}`,"Request failed",g,{level:"error",error:q}),C}},he=async()=>{const A=I(),g=A.serverUrl||n;if(A.authzServerIssuer){H.updateState({currentStep:"discover_resource_metadata",resourceUrl:A.resourceUrl||g,error:void 0}),ee("discover_resource_metadata","xaa-resource-metadata-skipped-request","Resource metadata discovery skipped",{reason:"Authorization server issuer is already configured; RFC 9728 discovery is not part of the XAA grant and isn't needed.",authz_server_issuer:A.authzServerIssuer});return}const E=W$(g);let k="Failed to discover resource metadata";for(const C of E){const q={method:"GET",url:C,headers:{Accept:"application/json"}};try{const U=await oe("discover_resource_metadata",q,()=>f.externalRequest(C,q));if(!U.ok){k=en(U.body,`Resource metadata request failed with ${U.status}`);continue}const P=jn(U.body,"Resource metadata"),V=g,G=typeof P.resource=="string"?P.resource:void 0;if(!G||G!==V){k=`Protected-resource metadata at ${C} does not identify ${V}.`;continue}const Ie=G,$e=Array.isArray(P.authorization_servers)?P.authorization_servers[0]:void 0;if(!$e)throw new Error("Resource metadata did not include `authorization_servers`, and no Authorization Server issuer was configured manually.");H.updateState({currentStep:"discover_resource_metadata",resourceMetadataUrl:C,resourceMetadata:P,resourceUrl:Ie,authzServerIssuer:$e,error:void 0});return}catch(U){k=U instanceof Error?U.message:"Failed to discover resource metadata"}}H.updateState({currentStep:"discover_resource_metadata",error:k})},ue=()=>{H.updateState({currentStep:"received_resource_metadata",error:void 0});const A=I();if(!A.resourceMetadata){ee("received_resource_metadata","xaa-resource-metadata-skipped","Resource metadata discovery skipped",{reason:"Authorization server issuer is already configured; RFC 9728 discovery is not part of the XAA grant and isn't needed.",authz_server_issuer:A.authzServerIssuer});return}ee("received_resource_metadata","xaa-resource-metadata","Resource metadata",{resource:A.resourceUrl,authorization_servers:A.resourceMetadata?.authorization_servers})},Ge=async()=>{const A=I(),g=A.authzServerIssuer;if(F||J||A.tokenEndpoint){H.updateState({currentStep:"discover_authz_metadata",error:void 0}),ee("discover_authz_metadata","xaa-authz-metadata-skipped-request","Authorization metadata discovery skipped",{reason:F?"The registered resource's token endpoint is resolved server-side; RFC 8414 discovery isn't needed.":"The token endpoint is already configured; RFC 8414 discovery isn't needed.",...A.tokenEndpoint?{token_endpoint:A.tokenEndpoint}:{}});return}if(!g){H.updateState({currentStep:"discover_authz_metadata",error:"Authorization Server issuer is missing. Configure it manually or retry resource metadata discovery."});return}const E=z?[g]:[...new Set([g,...A.resourceMetadata?.authorization_servers??[]].filter(G=>!!G))];let k="Authorization server metadata discovery failed.";const C=(G,Ie,$e)=>{H.updateState({currentStep:"discover_authz_metadata",authzMetadata:G,authzServerIssuer:Ie,tokenEndpoint:G.token_endpoint,...$==="preregistered"?{tokenEndpointAuthMethod:eD(A.tokenEndpointAuthMethod,A.clientSecret,G.token_endpoint_auth_methods_supported)}:{},compatibilityReport:$e??void 0,error:void 0})},q=!A.clientSecret;let U,P;for(const G of E){const Ie=K$(G);for(const $e of Ie){const Pt={method:"GET",url:$e,headers:hp(void 0,{Accept:"application/json"})};try{const jt=await oe("discover_authz_metadata",Pt,()=>f.externalRequest($e,Pt));if(!jt.ok){k=en(jt.body,`Auth server metadata request failed with ${jt.status}`);continue}const Er=jn(jt.body,"Authorization metadata");if(typeof Er.token_endpoint!="string")throw new Error("Authorization metadata did not include a token_endpoint.");if(typeof Er.issuer!="string"||Er.issuer!==G){k=`Authorization metadata at ${$e} advertises issuer "${String(Er.issuer)}", which does not match the requested issuer "${G}".`;continue}const xt=Er.issuer,Bc=Q$({...Er,issuer:xt});if(!q){C(Er,xt,Bc);return}const $v={metadata:Er,issuer:xt,report:Bc},Dv=cD(Bc);if(Dv===1){C(Er,xt,Bc);return}Dv===2&&!P&&(P=$v),U||(U=$v)}catch(jt){k=jt instanceof Error?jt.message:"Metadata request failed"}}}const V=P??U;if(V){C(V.metadata,V.issuer,V.report);return}H.updateState({currentStep:"discover_authz_metadata",error:k})},Ve=()=>{const A=I().authzMetadata?.registration_endpoint,g=$==="dcr"&&A?R?.get(Ce(A)):void 0;H.updateState({currentStep:"received_authz_metadata",...$==="dcr"?{dcrRegistrationReused:!!(g&&!pp(g))}:{},error:void 0});const E=I();if(!E.authzMetadata){ee("received_authz_metadata","xaa-authz-metadata-skipped","Authorization metadata discovery skipped",{reason:F?"The registered resource's token endpoint is resolved server-side; RFC 8414 discovery isn't needed.":"The token endpoint is already configured; RFC 8414 discovery isn't needed.",...E.tokenEndpoint?{token_endpoint:E.tokenEndpoint}:{}});return}ee("received_authz_metadata","xaa-authz-metadata","Authorization metadata",{issuer:E.authzServerIssuer,token_endpoint:E.authzMetadata?.token_endpoint,grant_types_supported:E.authzMetadata?.grant_types_supported,registration_endpoint:E.authzMetadata?.registration_endpoint,client_id_metadata_document_supported:E.authzMetadata?.client_id_metadata_document_supported,authorization_grant_profiles_supported:E.authzMetadata?.authorization_grant_profiles_supported,compatibility:E.compatibilityReport?{overall:E.compatibilityReport.overall,vendor:E.compatibilityReport.vendor}:void 0})},Ce=A=>J$({targetKey:fe??n,registrationEndpoint:A,scope:I().scope}),B=async()=>{const A=I(),g=A.authzMetadata?.registration_endpoint;if(!g){H.updateState({currentStep:"request_client_registration",isBusy:!1,error:"The authorization server metadata does not advertise a registration_endpoint, so open Dynamic Client Registration is not available. That is a readiness finding in itself — switch to pre-registered credentials to continue."});return}const E=Ce(g),k=R?.get(E);if(k&&pp(k)){R?.delete(E),H.updateState({currentStep:"request_client_registration",isBusy:!1,error:`This session's dynamic client secret has expired. Confirm "Register another client" to register a replacement.`,dcrRetryMayCreateDuplicate:!0});return}else if(k){H.updateState({currentStep:"received_client_credentials",clientId:k.clientId,tokenEndpointAuthMethod:k.tokenEndpointAuthMethod,dcrRegistrationReused:!0,error:void 0}),ee("received_client_credentials","xaa-dcr-reused","Reusing this session's dynamic registration",{"Client ID":k.clientId,"Token Auth Method":k.tokenEndpointAuthMethod});return}if(A.dcrRetryMayCreateDuplicate){H.updateState({currentStep:"request_client_registration",isBusy:!1,error:'The previous registration attempt may have created a client at the authorization server. Confirm "Register another client" to register again.'});return}const C={...mN({tokenEndpointAuthMethod:"client_secret_post"}),...A.scope?{scope:A.scope}:{}},q={method:"POST",url:g,headers:hp(void 0,{"Content-Type":"application/json"}),body:C};H.updateState({currentStep:"request_client_registration",isBusy:!0,error:void 0,negativeProbe:void 0,dcrRegistrationReused:!1,lastRequest:q,lastResponse:void 0,httpHistory:[...I().httpHistory||[],{step:"request_client_registration",timestamp:Date.now(),request:q}]});const U=await Pc({request:q,requestExecutor:xt=>f.externalRequest(xt.url,{method:xt.method,headers:xt.headers,body:xt.body}),httpHistory:I().httpHistory}),P=xt=>{H.updateState({currentStep:"request_client_registration",isBusy:!1,lastResponse:U.response,httpHistory:U.httpHistory,error:xt,dcrRetryMayCreateDuplicate:!0})};if(U.status!=="registered"){const xt=U.status==="http_error"?"The authorization server did not accept open Dynamic Client Registration (no initial access token was sent). A protected registration endpoint is a valid deployment choice — this does not prove the server lacks DCR.":U.status==="invalid_response"?"The registration response could not be parsed as a client registration.":"The registration request did not reach the authorization server.";P(`${U.error} ${xt} Switch to pre-registered credentials to continue.`);return}const V=U.credentials.clientId;if(U.missingClientId||!V){P("The registration response is missing a client_id, so the registration is unusable. Switch to pre-registered credentials to continue.");return}const G=[],Ie=R_(U.clientInfo);if(Ie.profile==="contradicted"){P("The authorization server returned authorization_grant_profiles_supported without the ID-JAG profile — it explicitly substituted the requested draft-04 client profile. Switch to pre-registered credentials to continue.");return}if(Ie.profile==="omitted"&&G.push({code:"profile_metadata_not_echoed",message:"The registration response did not echo authorization_grant_profiles_supported. RFC 7591 lets a server ignore unknown metadata, so this is a conformance warning, not a rejection — JWT Bearer redemption is the operational verdict."}),Ie.jwtBearerGrant==="contradicted"){P("The authorization server returned grant_types without the JWT Bearer grant — the registered client cannot redeem an ID-JAG at this server. Switch to pre-registered credentials to continue.");return}Ie.jwtBearerGrant==="omitted"&&Ie.tokenExchangeGrant==="omitted"?G.push({code:"grant_types_not_echoed",message:"The registration response did not echo grant_types. Continuing — JWT Bearer redemption will show whether the grant is actually enabled."}):Ie.jwtBearerGrant==="present"&&Ie.tokenExchangeGrant!=="present"&&G.push({code:"token_exchange_grant_not_echoed",message:"The registration echoed the JWT Bearer grant but not the Token Exchange grant. Token Exchange is the Client-to-IdP leg, so redemption at this server can still proceed; draft-04 expects both to be registered together."});const $e=U.clientInfo.token_endpoint_auth_method;let Pt;if($e===void 0)Pt=U.credentials.clientSecret?"client_secret_post":"none",G.push({code:"auth_method_not_echoed",message:U.credentials.clientSecret?"The registration response omitted token_endpoint_auth_method (RFC 7591 SHOULD echo it); assuming the requested client_secret_post.":"The registration response omitted token_endpoint_auth_method and issued no secret; treating the client as public (none)."});else if($e==="client_secret_post"||$e==="client_secret_basic"||$e==="none")Pt=$e;else if(typeof $e=="string"){P(`Registration succeeded, but this debugger cannot use the returned client-auth method ("${$e}"). This is a debugger limitation, not authorization-server unreadiness.`);return}else{P("The registration returned a non-string token_endpoint_auth_method — a malformed registration response. Switch to pre-registered credentials to continue.");return}const jt=U.credentials.clientSecret;if((Pt==="client_secret_post"||Pt==="client_secret_basic")&&!jt){P(`The registration returned token_endpoint_auth_method "${Pt}" without a client_secret — an inconsistent registration response. Switch to pre-registered credentials to continue.`);return}if(Pt==="none"&&jt){P('The registration returned a client_secret together with token_endpoint_auth_method "none" — an inconsistent registration response. Switch to pre-registered credentials to continue.');return}if(Pt==="none"&&G.push({code:"public_client",message:"The registered client is public (no client authentication). Draft-04 recommends Cross-App Access for confidential clients; the flow can continue, but this does not match the recommended deployment posture."}),jt){const xt=U.credentials.clientSecretExpiresAt;if(typeof xt=="number"&&xt!==0&&xt<=Math.floor(Date.now()/1e3)){P("The issued client_secret is already expired. Switch to pre-registered credentials to continue.");return}typeof xt!="number"&&G.push({code:"missing_secret_expiry",message:"The registration response omitted client_secret_expires_at, which RFC 7591 requires whenever a secret is issued."})}U.nonCanonicalSuccessStatus&&G.push({code:"non_201_success",message:`The registration returned ${U.response.status} instead of the RFC 7591 201 Created.`});const Er=U.response.headers["content-type"]||"";Er.includes("json")||G.push({code:"non_json_content_type",message:`The registration response parsed as JSON but was served as "${Er||"(none)"}".`}),(U.response.headers["cache-control"]||"").includes("no-store")||G.push({code:"missing_no_store",message:"The registration response is missing Cache-Control: no-store, which RFC 7591 requires for responses carrying credentials."}),R?.set(E,{clientId:V,clientSecret:jt,tokenEndpointAuthMethod:Pt,clientSecretExpiresAt:U.credentials.clientSecretExpiresAt,registrationEndpoint:g}),ee("received_client_credentials","xaa-dcr","Dynamic Client Registration",U.infoLogData),H.updateState({currentStep:"request_client_registration",clientId:V,tokenEndpointAuthMethod:Pt,registrationWarnings:G,dcrRegistrationReused:!1,dcrRetryMayCreateDuplicate:!1,lastResponse:U.response,httpHistory:U.httpHistory,isBusy:!1,error:void 0})},pe=()=>{H.updateState({currentStep:"received_client_credentials",error:void 0})},_e=async()=>{const A=I().authzMetadata?.client_id_metadata_document_supported;if(A!==!0){H.updateState({currentStep:"fetch_client_metadata_document",isBusy:!1,error:A===!1?"The authorization server explicitly advertises client_id_metadata_document_supported: false — it does not accept Client ID Metadata Document client_ids. That is the readiness finding; switch to pre-registered credentials to continue.":"The authorization server metadata does not advertise client_id_metadata_document_supported, so the CIMD draft directs clients not to attempt the flow. That is the readiness finding; switch to pre-registered credentials to continue."});return}let g;try{g=og(Y??"https://app.mcpjam.com/.well-known/oauth/xaa-client-metadata.json",{allowLoopback:me===!0})}catch($e){H.updateState({currentStep:"fetch_client_metadata_document",isBusy:!1,error:$e instanceof Error?$e.message:"Invalid client metadata URL"});return}const E={method:"GET",url:g,headers:hp(void 0,{Accept:"application/json"})};let k;try{k=await oe("fetch_client_metadata_document",E,()=>f.externalRequest(g,{method:"GET",headers:E.headers,redirect:"manual"},{enforcePublicHost:!(me===!0&&WN(g))}))}catch{return}const C=$e=>{H.updateState({currentStep:"fetch_client_metadata_document",error:`${$e} This is a document preflight/validation failure; retry freely or switch strategy.`})};if(k.status!==200){C(k.status>=300&&k.status<400?`The client metadata URL answered with a ${k.status} redirect; draft-02 requires a direct 200 and forbids the authorization server from following redirects.`:`The client metadata URL answered ${k.status}; draft-02 requires a direct 200 OK.`);return}const q=k.headers["content-type"]||"",U=q.split(";",1)[0].trim().toLowerCase();if(!(U==="application/json"||/^application\/[a-z0-9][a-z0-9!#$&^_.+-]*\+json$/.test(U))){C(`The client metadata document was served as "${q||"(none)"}", not a JSON media type.`);return}const P=k.body;if(!P||typeof P!="object"||Array.isArray(P)){C("The client metadata document body is not a JSON object.");return}if(P.client_id!==g){C("The document's client_id does not exactly equal the fetched URL — draft-02 compares Client Identifier URLs with simple string comparison, no normalization.");return}const V=R_(P);if(V.profile!=="present"||V.jwtBearerGrant!=="present"||V.tokenExchangeGrant!=="present"){C("The hosted client metadata document does not declare the ID-JAG grant profile plus both required grants — the document is insufficient for XAA. This points at the hosted document, not the authorization server.");return}const G=V.tokenEndpointAuthMethod??"none";if(G.startsWith("client_secret")){C("The client metadata document declares a shared-secret auth method, which CIMD draft-02 forbids — the document is malformed.");return}if(G!=="none"&&G!=="private_key_jwt"){C(`The client metadata document declares an unsupported token_endpoint_auth_method "${G}".`);return}const Ie=G==="private_key_jwt";ee("received_client_metadata","xaa-cimd","Client ID Metadata Document ready",{"Client ID":g,"Client Name":P.client_name,Note:"Debugger preflight only — the RAS performs its own fetch or metadata association; JWT Bearer redemption is the operational verdict."}),H.updateState({currentStep:"fetch_client_metadata_document",clientId:g,tokenEndpointAuthMethod:Ie?"private_key_jwt":"none",registrationWarnings:Ie?[]:[{code:"public_client",message:'Public-client CIMD (token_endpoint_auth_method "none"): interoperability is exercised, but the security posture is NOT recommended — ID-JAG draft-04 §9.1 recommends confidential clients. Anyone can present this URL as their client_id; findings show the RAS accepted the URL identity, not proof of client authentication. Use private_key_jwt (confidential CIMD) for a production posture.'}],error:void 0})},ke=()=>{H.updateState({currentStep:"received_client_metadata",error:void 0})},je=async()=>{const A=I(),g=b??A.userId,E=T??A.email,k=A.identityAssertionFormat,C={method:"POST",url:`${o}/authenticate`,headers:{"Content-Type":"application/json"},body:{userId:g,email:E,audience:I_,resourceClientId:A.clientId,assertionFormat:k,...le}};try{const q=await oe("user_authentication",C,()=>f.internalRequest(`${o}/authenticate`,{method:"POST",headers:C.headers,body:JSON.stringify(C.body)}));if(!q.ok)throw new Error(en(q.body,`Mock authentication failed with ${q.status}`));const U=jn(q.body,"Authentication response");if(k==="saml"){if(typeof U.assertion!="string")throw new Error("Authentication response did not include an `assertion`. The issuer may not support SAML assertions yet.");const P=U.subject;if(!P||typeof P!="object"||typeof P.issuer!="string"||typeof P.nameid!="string")throw new Error("Authentication response did not include the SAML `subject` metadata.");H.updateState({currentStep:"user_authentication",identityAssertion:U.assertion,identityAssertionSubject:{issuer:P.issuer,nameid:P.nameid,...typeof P.nameidFormat=="string"?{nameidFormat:P.nameidFormat}:{},...typeof P.spNameQualifier=="string"?{spNameQualifier:P.spNameQualifier}:{}},userId:g,email:E,error:void 0});return}if(typeof U.id_token!="string")throw new Error("Authentication response did not include an `id_token`.");H.updateState({currentStep:"user_authentication",identityAssertion:U.id_token,userId:g,email:E,error:void 0})}catch(q){H.updateState({currentStep:"user_authentication",error:q instanceof Error?q.message:"Mock authentication failed"})}},xe=()=>{const A=I();if(H.updateState({currentStep:"received_identity_assertion",error:void 0}),A.identityAssertionFormat==="saml"){ee("received_identity_assertion","xaa-identity-assertion","SAML assertion issued",{userId:A.userId,email:A.email,nameid:A.identityAssertionSubject?.nameid,nameid_format:A.identityAssertionSubject?.nameidFormat,sp_name_qualifier:A.identityAssertionSubject?.spNameQualifier});return}ee("received_identity_assertion","xaa-identity-assertion","Identity assertion issued",{userId:A.userId,email:A.email})},Oe=async()=>{const A=I();if(!A.identityAssertion){H.updateState({currentStep:"token_exchange_request",error:"No identity assertion is available. Complete mock authentication first."});return}if(!A.authzServerIssuer){H.updateState({currentStep:"token_exchange_request",error:"No authorization server issuer is available for the ID-JAG audience."});return}if(!A.clientId){H.updateState({currentStep:"token_exchange_request",error:"Client ID is required for the ID-JAG `client_id` claim."});return}const g=A.negativeTestMode==="valid"&&h,E=A.identityAssertionFormat,k=A.subjectIdentifierFormat;try{if(E==="saml"&&A.negativeTestMode==="valid"&&!g)throw new Error("SAML identity assertions require the authorization server's RFC 8693 token endpoint for signed-assertion verification, but it is not available. Use an OIDC assertion or an authorization server that advertises the token endpoint.");if(g){const P={grant_type:Km,requested_token_type:A_,subject_token:A.identityAssertion,subject_token_type:E==="saml"?fN:hN,client_id:I_,audience:A.authzServerIssuer,...A.resourceUrl||A.serverUrl?{resource:A.resourceUrl||A.serverUrl}:{},...A.scope?{scope:A.scope}:{},...k==="saml-nameid"?{subject_id_format:k}:{}},V={method:"POST",url:`${o}/token`,headers:{"Content-Type":"application/x-www-form-urlencoded"},body:P},G=a==="hosted"?{"x-mcpjam-issuer-mode":"hosted",...c?{"x-mcpjam-organization-id":c}:{},...d==="anonymous"?{"x-mcpjam-issuer-kind":"anonymous"}:{}}:{},Ie=await oe("token_exchange_request",V,()=>f.internalRequest(`${o}/token`,{method:"POST",headers:{...V.headers,...G,...y},body:new URLSearchParams(P).toString()}));if(!Ie.ok)throw l&&H.updateState({idpPolicy:Y_(Ie.body)}),new Error(en(Ie.body,`Token exchange failed with ${Ie.status}`));const $e=jn(Ie.body,"Token exchange response");if(typeof $e.access_token!="string")throw new Error("Token exchange response did not include an `access_token`.");ee("received_id_jag","xaa-id-jag","ID-JAG issued",{negativeTestMode:A.negativeTestMode,expectedFailure:W_[A.negativeTestMode].expectedFailure,issued_token_type:$e.issued_token_type,token_type:$e.token_type}),$e.issued_token_type!=="urn:ietf:params:oauth:token-type:id-jag"&&ee("received_id_jag","xaa-id-jag-issued-token-type","Unexpected issued_token_type",{expected:A_,actual:$e.issued_token_type,detail:"The token-exchange response did not declare the minted token as an ID-JAG."},{level:"warning"}),H.updateState({currentStep:"token_exchange_request",idJag:$e.access_token,idJagDecoded:null,...l?{idpPolicy:X_($e.scope,A.scope)}:{},error:void 0});return}const C={method:"POST",url:`${o}/token-exchange`,headers:{"Content-Type":"application/json"},body:{identityAssertion:A.identityAssertion,audience:A.authzServerIssuer,...A.resourceUrl||A.serverUrl?{resource:A.resourceUrl||A.serverUrl}:{},clientId:A.clientId,scope:A.scope,negativeTestMode:A.negativeTestMode,assertionFormat:E,subjectIdFormat:k,...le,...Q}},q=await oe("token_exchange_request",C,()=>f.internalRequest(`${o}/token-exchange`,{method:"POST",headers:C.headers,body:JSON.stringify(C.body)}));if(!q.ok)throw l&&H.updateState({idpPolicy:Y_(q.body)}),new Error(en(q.body,`Token exchange failed with ${q.status}`));const U=jn(q.body,"Token exchange response");if(typeof U.id_jag!="string")throw new Error("Token exchange response did not include an `id_jag`.");H.updateState({currentStep:"token_exchange_request",idJag:U.id_jag,idJagDecoded:null,...l?{idpPolicy:X_(U.scope,A.scope)}:{},error:void 0})}catch(C){H.updateState({currentStep:"token_exchange_request",error:C instanceof Error?C.message:"Token exchange failed"})}},Ee=()=>{H.updateState({currentStep:"received_id_jag",error:void 0});const A=I();A.negativeTestMode==="valid"&&h||ee("received_id_jag","xaa-id-jag","ID-JAG issued",{negativeTestMode:A.negativeTestMode,expectedFailure:W_[A.negativeTestMode].expectedFailure})},Ae=()=>{const A=I();if(!A.idJag||!A.authzServerIssuer||!A.clientId){H.updateState({currentStep:"inspect_id_jag",error:"A complete ID-JAG, authorization server issuer, and client ID are required before inspection."});return}const g=uD(A.idJag,{issuer:i,audience:A.authzServerIssuer,resource:A.resourceUrl||A.serverUrl||n,clientId:A.clientId,scope:A.idpPolicy?.grantedScope??A.scope,negativeTestMode:A.negativeTestMode});H.updateState({currentStep:"inspect_id_jag",idJagDecoded:g,issuerBaseUrl:i,error:void 0}),ee("inspect_id_jag","xaa-id-jag-inspection","ID-JAG inspection",{issues:g.issues,mode:A.negativeTestMode})},Me=async()=>{const A=I();if(!A.idJag||!A.tokenEndpoint&&!F&&!J){H.updateState({currentStep:"jwt_bearer_request",error:"The flow is missing an ID-JAG or token endpoint. Finish discovery and token exchange first."});return}let g=A.clientSecret,E=A.tokenEndpointAuthMethod;if(!F&&!J)if($==="dcr"){const U=A.authzMetadata?.registration_endpoint,P=U?Ce(U):void 0,V=P?R?.get(P):void 0;if(!V||V.clientId!==A.clientId){H.updateState({currentStep:"jwt_bearer_request",error:"This session's dynamic registration credentials are no longer available (the page may have reloaded). Register another client to continue.",dcrRetryMayCreateDuplicate:!0});return}if(pp(V)){P&&R?.delete(P),H.updateState({currentStep:"jwt_bearer_request",error:"This session's dynamic client secret has expired. Register another client to continue.",dcrRetryMayCreateDuplicate:!0});return}g=V.clientSecret,E=V.tokenEndpointAuthMethod}else $==="cimd"&&(g=void 0,E=A.tokenEndpointAuthMethod??"none");const k=A.idpPolicy?.grantedScope??A.scope,C=F?{registrationId:F,assertion:A.idJag,scope:k,resource:A.resourceUrl||A.serverUrl}:J?{serverId:J,...ce?{projectId:ce}:{},assertion:A.idJag,scope:k,resource:A.resourceUrl||A.serverUrl}:{tokenEndpoint:A.tokenEndpoint,assertion:A.idJag,clientId:A.clientId,...g?{clientSecret:g}:{},...E?{tokenEndpointAuthMethod:E}:{},...E==="private_key_jwt"&&c?{organizationId:c}:{},scope:k,resource:A.resourceUrl||A.serverUrl},q={method:"POST",url:"/proxy/token",headers:{"Content-Type":"application/json"},body:"clientSecret"in C?{...C,clientSecret:Hl}:C};try{const U=await oe("jwt_bearer_request",q,()=>f.internalRequest("/proxy/token",{method:"POST",headers:q.headers,body:JSON.stringify(C)}));if(!U.ok)throw new Error(en(U.body,`JWT bearer proxy failed with ${U.status}`));const P=jn(U.body,"JWT bearer response"),V=typeof P.status=="number"?P.status:void 0,G=P.body;if(!V||V<200||V>=300){if(A.negativeTestMode!=="valid"&&typeof V=="number"){H.updateState({currentStep:"jwt_bearer_request",error:void 0,negativeProbe:{outcome:"rejected",status:V}}),ee("jwt_bearer_request","xaa-negative-rejected","Authorization server correctly rejected the broken assertion",{status:V,mode:A.negativeTestMode});return}const $e=en(G,`Authorization server returned ${P.status??"an unknown status"}.`);H.updateState({currentStep:"jwt_bearer_request",error:`${$e} Does the authorization server trust the synthetic issuer JWKS and support \`urn:ietf:params:oauth:grant-type:jwt-bearer\`?`}),ee("jwt_bearer_request","xaa-jwt-bearer-failure","JWT bearer request failed",{status:P.status,body:G},{level:"error"});return}const Ie=jn(G,"JWT bearer token response");if(typeof Ie.access_token!="string")throw new Error("Authorization server response did not include an `access_token`.");if(A.negativeTestMode!=="valid"){H.updateState({currentStep:"jwt_bearer_request",accessToken:Ie.access_token,tokenType:typeof Ie.token_type=="string"?Ie.token_type:"Bearer",expiresIn:typeof Ie.expires_in=="number"?Ie.expires_in:void 0,grantedScope:typeof Ie.scope=="string"?Ie.scope:void 0,error:void 0,negativeProbe:void 0});return}H.updateState({currentStep:"jwt_bearer_request",accessToken:Ie.access_token,tokenType:typeof Ie.token_type=="string"?Ie.token_type:"Bearer",expiresIn:typeof Ie.expires_in=="number"?Ie.expires_in:void 0,grantedScope:typeof Ie.scope=="string"?Ie.scope:void 0,error:void 0})}catch(U){H.updateState({currentStep:"jwt_bearer_request",error:U instanceof Error?U.message:"JWT bearer request failed"})}},et=()=>{const A=I();if(A.negativeTestMode!=="valid"){const g=A.lastResponse?.body,E=g&&typeof g=="object"&&typeof g.status=="number"?g.status:void 0;H.updateState({currentStep:"received_access_token",error:void 0,negativeProbe:{outcome:"accepted",status:E}}),ee("received_access_token","xaa-negative-accepted","Authorization server issued a token for a broken assertion",{status:E,mode:A.negativeTestMode},{level:"error"});return}H.updateState({currentStep:"received_access_token",error:void 0})},K=async()=>{const A=I();if(!A.accessToken||!A.serverUrl){H.updateState({currentStep:"authenticated_mcp_request",error:"An access token and MCP server URL are required before the final authenticated request."});return}const g=ZC(A.accessToken),E={method:"POST",url:A.serverUrl,headers:g.headers,body:g.body};try{const k=await oe("authenticated_mcp_request",E,()=>f.externalRequest(A.serverUrl,{method:"POST",headers:g.headers,body:JSON.stringify(g.body)}));if(!k.ok){H.updateState({currentStep:"authenticated_mcp_request",error:en(k.body,`Authenticated MCP request failed with ${k.status}`)});return}const C=LC(k.body);if(C){H.updateState({currentStep:"authenticated_mcp_request",error:C});return}H.updateState({currentStep:"authenticated_mcp_request",error:void 0})}catch(k){H.updateState({currentStep:"authenticated_mcp_request",error:k instanceof Error?k.message:"Authenticated MCP request failed"})}},ie=()=>{H.updateState({currentStep:"complete",error:void 0});const A=I();ee("complete","xaa-authenticated-mcp","Authenticated MCP response",{status:A.lastResponse?.status,xaa_extension:XC(A.lastResponse?.body),body:A.lastResponse?.body})};return H.proceedToNextStep=async()=>{const A=I().currentStep;if(!I().negativeProbe)switch(A){case"idle":await he();return;case"discover_resource_metadata":I().error?await he():ue();return;case"received_resource_metadata":await Ge();return;case"discover_authz_metadata":I().error?await Ge():Ve();return;case"received_authz_metadata":if($==="dcr"){await B();return}if($==="cimd"){await _e();return}await je();return;case"request_client_registration":I().error||!I().clientId?await B():pe();return;case"fetch_client_metadata_document":I().error||!I().clientId?await _e():ke();return;case"received_client_credentials":case"received_client_metadata":await je();return;case"user_authentication":I().error?await je():xe();return;case"received_identity_assertion":await Oe();return;case"token_exchange_request":I().error?await Oe():Ee();return;case"received_id_jag":Ae();return;case"inspect_id_jag":await Me();return;case"jwt_bearer_request":I().error?await Me():et();return;case"received_access_token":await K();return;case"authenticated_mcp_request":I().error?await K():ie();return;case"complete":return;default:throw new Error(`Unhandled XAA flow step: ${A}`)}},H.runAll=async()=>{const A=dD;for(let g=0;g<A;g+=1){const E=I();if(E.currentStep==="complete"||E.error||E.negativeProbe)return;await H.proceedToNextStep();const k=I();if(k.error||k.currentStep==="complete"||k.negativeProbe||k.currentStep===E.currentStep&&(k.httpHistory?.length??0)===(E.httpHistory?.length??0))return}},H.resetFlow=()=>{H.updateState(K_({serverUrl:I().serverUrl||n,resourceUrl:I().serverUrl||n,issuerBaseUrl:I().issuerBaseUrl||i,negativeTestMode:I().negativeTestMode||m,identityAssertionFormat:I().identityAssertionFormat||v,subjectIdentifierFormat:I().subjectIdentifierFormat||_,userId:I().userId||b,email:I().email||T,clientId:I().clientId||O,scope:I().scope||D,authzServerIssuer:I().authzServerIssuer||z,registrationStrategy:$}))},H}var w9=["server-initialize","ping","logging-set-level","completion-complete","capabilities-consistent","tools-list","tools-input-schemas-valid","tools-x-mcp-header-declarations-valid","prompts-list","resources-list","protocol-invalid-method-error","localhost-host-rebinding-rejected","localhost-host-valid-accepted","server-sse-polling-session","server-accepts-multiple-post-streams","server-sse-streams-functional","notification-post-accepted","get-stream-or-405","session-id-visible-ascii","post-response-content-type","modern-client-handshake","modern-server-discover","modern-result-type-present","modern-cacheable-result-hints","modern-cache-hint-coverage","modern-cache-hint-values-valid","modern-cache-scope-stable-across-pages","modern-protocol-version-header-mismatch","modern-method-header-mismatch","modern-name-header-mismatch","modern-unsupported-version-error","modern-missing-method-header-rejected","modern-header-names-case-insensitive","modern-undeclared-capability-error","modern-no-session-id","modern-removed-methods-not-found","modern-resource-not-found-invalid-params","modern-resource-read-no-empty-contents","modern-tool-output-schema-conformant","modern-logs-require-log-level","modern-subscription-ack-precedes-notifications","modern-subscription-filter-and-tagging","modern-subscription-graceful-close","wire-schema-valid"],Kh={"2025-03-26":"legacy","2025-06-18":"legacy","2025-11-25":"legacy","2026-07-28":"modern"},k9=Object.keys(Kh),E9={"server-initialize":["legacy"],ping:["legacy"],"capabilities-consistent":["legacy","modern"],"server-sse-polling-session":["legacy"],"server-accepts-multiple-post-streams":["legacy"],"server-sse-streams-functional":["legacy"],"notification-post-accepted":["legacy"],"get-stream-or-405":["legacy"],"session-id-visible-ascii":["legacy"],"post-response-content-type":["legacy","modern"],"localhost-host-rebinding-rejected":["legacy"],"localhost-host-valid-accepted":["legacy"],"tools-list":["legacy","modern"],"tools-input-schemas-valid":["legacy","modern"],"tools-x-mcp-header-declarations-valid":["modern"],"prompts-list":["legacy","modern"],"resources-list":["legacy","modern"],"logging-set-level":["legacy"],"completion-complete":["legacy","modern"],"protocol-invalid-method-error":["legacy","modern"],"modern-client-handshake":["modern"],"modern-server-discover":["modern"],"modern-result-type-present":["modern"],"modern-cacheable-result-hints":["modern"],"modern-cache-hint-coverage":["modern"],"modern-cache-hint-values-valid":["modern"],"modern-cache-scope-stable-across-pages":["modern"],"modern-protocol-version-header-mismatch":["modern"],"modern-method-header-mismatch":["modern"],"modern-name-header-mismatch":["modern"],"modern-unsupported-version-error":["modern"],"modern-missing-method-header-rejected":["modern"],"modern-header-names-case-insensitive":["modern"],"modern-undeclared-capability-error":["modern"],"modern-no-session-id":["modern"],"modern-removed-methods-not-found":["modern"],"modern-resource-not-found-invalid-params":["modern"],"modern-resource-read-no-empty-contents":["modern"],"modern-tool-output-schema-conformant":["modern"],"modern-logs-require-log-level":["modern"],"modern-subscription-ack-precedes-notifications":["modern"],"modern-subscription-filter-and-tagging":["modern"],"modern-subscription-graceful-close":["modern"],"wire-schema-valid":["legacy","modern"]},T9=["debug","info","notice","warning","error","critical","alert","emergency"],A9=["readiness-tool-order-deterministic","readiness-deprecated-feature-use","readiness-session-termination","readiness-protocol-version-header-required","readiness-tool-name-conventions","readiness-log-level-filtering"],I9={"readiness-tool-order-deterministic":["modern"],"readiness-deprecated-feature-use":["legacy","modern"],"readiness-session-termination":["legacy","modern"],"readiness-protocol-version-header-required":["modern"],"readiness-tool-name-conventions":["legacy","modern"],"readiness-log-level-filtering":["modern"]},pD=["dispatch","creation","lifecycle"],hD=["tasks-wire-resolvable","tasks-declaration-hygiene","tasks-result-type-discipline","tasks-undeclared-creation-refused","tasks-undeclared-capability-rejected","tasks-ttl-shape","tasks-inline-result","tasks-mcp-name-routing","tasks-invalid-task-id-rejected","tasks-status-payload-shape","tasks-cancel-ack-shape","tasks-update-ack-shape","tasks-ttl-integer-shape","tasks-undeclared-capability-names-requirements"],fD=["tasks-result-type-discipline","tasks-undeclared-creation-refused","tasks-undeclared-capability-rejected","tasks-ttl-shape","tasks-inline-result","tasks-mcp-name-routing","tasks-status-payload-shape","tasks-cancel-ack-shape","tasks-update-ack-shape","tasks-ttl-integer-shape","tasks-undeclared-capability-names-requirements"];function mD(e){return fD.some(t=>t===e)}var R9={"tasks-input-required-update-completes":"tasks-update-ack-shape"},C9=["tasks-readiness-failed-status-message","tasks-readiness-unknown-task-id-mutations"],gD={verify_profile_shape:{title:"Profile response",summary:"Validate the authenticated profile response.",teachableMoments:[]},verify_profile_stable:{title:"Stable profile identity",summary:"Repeat the profile call with the same credentials.",teachableMoments:[]},verify_profile_id_opaque:{title:"Opaque profile ID",summary:"Look for display metadata used as identity (heuristic).",teachableMoments:[]},verify_profile_identity_stable_across_flows:{title:"Profile identity across flows",summary:"Compare flows declared to represent the same account.",teachableMoments:[]},verify_profile_stable_after_refresh:{title:"Profile identity after refresh",summary:"Compare identity before and after token refresh.",teachableMoments:[]},oauth_dcr_http_redirect_uri:{title:"OAuth Check: DCR Redirect URI Policy",summary:"Attempt dynamic client registration with a non-loopback http redirect URI and confirm the authorization server rejects it.",teachableMoments:["MCP authorization requires redirect URIs to use localhost or HTTPS."]},oauth_invalid_client:{title:"OAuth Check: Invalid Client",summary:"Send a token request with an invalid client identifier and confirm the authorization server rejects it.",teachableMoments:["Authorization servers should reject malformed or unknown clients instead of issuing tokens."]},oauth_invalid_authorize_redirect:{title:"OAuth Check: Invalid Redirect URI at Authorization Endpoint",summary:"Send an authorization request with a mismatched redirect URI and confirm the authorization server refuses to redirect back to it.",teachableMoments:["Authorization servers should validate redirect_uri before redirecting user agents to untrusted callback URLs."]},oauth_invalid_token:{title:"OAuth Check: Invalid Access Token",summary:"Send an authenticated MCP initialize request with an obviously invalid bearer token and confirm the MCP server returns HTTP 401.",teachableMoments:["Resource servers must reject invalid bearer tokens with HTTP 401 instead of treating them as authenticated."]},oauth_invalid_redirect:{title:"OAuth Check: Invalid Redirect URI",summary:"Send a token request with a mismatched redirect URI and look for a redirect-specific rejection from the token endpoint.",teachableMoments:["A generic invalid_grant rejection does not prove redirect URI exact-match validation."]},oauth_token_format:{title:"OAuth Check: Token Response Format",summary:"Validate that the successful token response includes the expected access token fields.",teachableMoments:["Token responses should include a usable bearer token, token type, and expiration metadata."]},oauth_unauthenticated_challenge:{title:"OAuth Check: Unauthenticated Request Challenge",summary:"Send an unauthenticated MCP request and confirm the server answers with HTTP 401 and a WWW-Authenticate Bearer challenge, never a 500.",teachableMoments:["A protected resource must reject unauthenticated requests with 401 and a Bearer challenge (RFC 6750 §3), not a server error."]},oauth_resource_metadata_challenge:{title:"OAuth Check: Resource Metadata URL in Challenge",summary:"Confirm the WWW-Authenticate Bearer challenge advertises an absolute resource_metadata URL so clients can discover protected-resource metadata.",teachableMoments:["RFC 9728 §5.1 requires the Bearer challenge to carry an absolute resource_metadata URL; a relative or missing value breaks discovery."]},oauth_stale_session_rejection:{title:"OAuth Check: Stale Session Rejection",summary:"Send an authenticated request carrying an unknown Mcp-Session-Id and confirm the server rejects it with a 4xx, never a 500.",teachableMoments:["The Streamable HTTP transport requires a stale or unknown session id to fail with a clean 4xx (404 preferred), not crash the server with a 500."]}},P9=["readiness-oauth-iss-advertised"],vD="authorizationRequired";function x9(e){return e.details?.[vD]===!0}var _D=DC(),yD={"mcp-protocol":{id:"mcp-protocol",version:"2026-11-02.1",scored:["server-initialize","ping","logging-set-level","completion-complete","capabilities-consistent","tools-list","tools-input-schemas-valid","tools-x-mcp-header-declarations-valid","prompts-list","resources-list","protocol-invalid-method-error","localhost-host-rebinding-rejected","localhost-host-valid-accepted","server-sse-polling-session","server-accepts-multiple-post-streams","server-sse-streams-functional","notification-post-accepted","get-stream-or-405","session-id-visible-ascii","post-response-content-type","modern-client-handshake","modern-server-discover","modern-result-type-present","modern-cacheable-result-hints","modern-protocol-version-header-mismatch","modern-method-header-mismatch","modern-name-header-mismatch","modern-unsupported-version-error","modern-undeclared-capability-error","modern-no-session-id","modern-removed-methods-not-found","modern-resource-not-found-invalid-params","modern-logs-require-log-level","modern-subscription-ack-precedes-notifications","modern-subscription-filter-and-tagging","modern-subscription-graceful-close","wire-schema-valid","modern-cache-hint-coverage","modern-cache-hint-values-valid","modern-cache-scope-stable-across-pages","modern-missing-method-header-rejected","modern-header-names-case-insensitive","modern-resource-read-no-empty-contents","modern-tool-output-schema-conformant"]},"mcp-tasks":{id:"mcp-tasks",version:"2026-11-02.1",scored:["tasks-wire-resolvable","tasks-declaration-hygiene","tasks-result-type-discipline","tasks-undeclared-creation-refused","tasks-undeclared-capability-rejected","tasks-ttl-shape","tasks-inline-result","tasks-mcp-name-routing","tasks-ttl-integer-shape","tasks-update-ack-shape","tasks-invalid-task-id-rejected","tasks-status-payload-shape","tasks-cancel-ack-shape","tasks-undeclared-capability-names-requirements"]}};function bD(e){return yD[e]}function SD(e){const t=JSON.stringify({id:e.id,version:e.version,scored:[...e.scored].sort()});return oO(_O(aO(t)))}var Q_=new WeakMap;function wD(e){const t=Q_.get(e);if(t!==void 0)return t;const r=SD(e);return Q_.set(e,r),r}function ak(e,t){const r=new Set(t.scored),s=[],n=[];for(const i of e)(r.has(i.id)?s:n).push(i);return{scored:s,pending:n}}function ck(e,t){if(!t||t.pendingCheckIds.length===0)return{scored:[...e],pending:[]};const r=new Set(t.pendingCheckIds),s=[],n=[];for(const i of e)(r.has(i.id)?n:s).push(i);return{scored:s,pending:n}}function kD(e){const{pending:t}=ak(e.checks,e.profile);return{profileId:e.profile.id,profileVersion:e.profile.version,manifestDigest:wD(e.profile),checkerVersion:_D,...e.protocolVersion!==void 0?{protocolVersion:e.protocolVersion}:{},...e.extensionVersions!==void 0?{extensionVersions:e.extensionVersions}:{},...e.schemaDigest!==void 0?{schemaDigest:e.schemaDigest}:{},pendingCheckIds:t.map(r=>r.id).sort()}}function ag(e,t,r,s,n=e.passed+e.failed+e.couldNotRun){return{score:n>0?Math.floor(1e3*e.passed/n)/10:null,outcome:r,applicable:n,...e,pending:e.pending??0,advisories:t,advicePointsLost:0,...s!==void 0?{protocolVersion:s}:{}}}function cg(e,t=[],r,s){const{scored:n,pending:i}=ck(e,s),o={passed:n.filter(c=>c.status==="passed").length,failed:n.filter(c=>c.status==="failed").length,couldNotRun:n.filter(Bu).length,notApplicable:n.filter(gS).length,pending:i.length},{outcome:a}=vS(n);return ag(o,t,a,r,o.passed+o.failed+o.couldNotRun-n.filter(fS).length)}function lg(e){const t={passed:Ui(e,a=>a.passed),failed:Ui(e,a=>a.failed),couldNotRun:Ui(e,a=>a.couldNotRun),notApplicable:Ui(e,a=>a.notApplicable),pending:Ui(e,a=>a.pending??0)},r=[...new Map(e.flatMap(a=>a.advisories??[]).map(a=>[a.id,a])).values()],s=e.map(a=>a.outcome),n=s.includes("failed")?"failed":s.includes("incomplete")?"incomplete":"passed",i=e.filter(a=>a.applicable>0),o=new Set(i.map(a=>a.protocolVersion));return ag(t,r,n,i.length>0&&o.size===1?[...o][0]:void 0,Ui(e,a=>a.applicable))}function Ui(e,t){return e.reduce((r,s)=>r+t(s),0)}function ey(e){return cg(e.checks,(e.readiness??[]).filter(t=>t.informational!==!0).map(t=>({id:t.id,tier:t.specStrength==="MAY"?"may":"should"})),e.protocolVersion,e.profile)}function lk(e,t,r,s=[]){const{scored:n}=ck(e,r),i=new Set(n.map(o=>o.id));return cg(e,[...n.flatMap(o=>(o.warnings??[]).map((a,c)=>({id:`${o.id}-warning-${c+1}`,tier:"may"}))),...s.filter(o=>i.has(o.checkId)).map(({id:o,tier:a})=>({id:o,tier:a}))],t,r)}function ty(e){return lk(e.checks,e.protocolVersion,void 0,(e.readiness??[]).filter(t=>t.informational!==!0).map(t=>({id:t.id,checkId:t.checkId,tier:t.specStrength==="MAY"?"may":"should"})))}function ED(e){return lk(e.checks,e.discovery.protocolVersion,e.profile,(e.readiness??[]).filter(t=>t.informational!==!0).map(t=>({id:t.id,checkId:t.checkId,tier:t.specStrength==="MAY"?"may":"should"})))}function uk(e){return(e??[]).filter(t=>Object.prototype.hasOwnProperty.call(gD,t))}function ry(e,t){const r=uk(t?.unscoredCheckIds);if(e.outcome==="not-applicable"){const s=new Set(r),n=e.steps.filter(i=>s.has(i.step)).length;return ag({passed:0,failed:0,couldNotRun:0,notApplicable:e.steps.length-n,pending:n},[],"passed",e.protocolVersion)}return cg(e.steps.map(s=>({id:s.step,status:s.status,...s.skipReason?{skipReason:s.skipReason}:{},...s.error?.message?{error:{message:s.error.message}}:{}})),(e.readiness??[]).filter(s=>s.informational!==!0).map(s=>({id:s.id,tier:s.specStrength==="MAY"?"may":"should"})),e.protocolVersion,r.length>0?{pendingCheckIds:[...r]}:void 0)}var TD=8;function dk(e){return Ds(e,0,new WeakSet)}function Ds(e,t,r){if(e===null)return null;switch(typeof e){case"string":case"boolean":return e;case"number":return Number.isFinite(e)?e:String(e);case"bigint":return e.toString();case"undefined":case"function":case"symbol":return}const s=e;if(r.has(s))return"[circular]";if(t>=TD)return"[max-depth]";if(s instanceof Date)return s.toISOString();if(s instanceof URL)return s.toString();r.add(s);try{if(Array.isArray(s))return s.map(i=>Ds(i,t+1,r)??null);if(s instanceof Map)return[...s.entries()].map(([i,o])=>[Ds(i,t+1,r)??null,Ds(o,t+1,r)??null]);if(s instanceof Set)return[...s].map(i=>Ds(i,t+1,r)??null);const n={};if(s instanceof Error){n.name=s.name,n.message=s.message;const i=s;i.code!==void 0&&(n.code=Ds(i.code,t+1,r)),i.statusCode!==void 0&&(n.statusCode=Ds(i.statusCode,t+1,r)),i.cause!==void 0&&(n.cause=Ds(i.cause,t+1,r))}for(const[i,o]of Object.entries(s)){const a=Ds(o,t+1,r);a!==void 0&&(n[i]=a)}return n}finally{r.delete(s)}}function Ei(e){const t=new Map;for(const{readiness:s,group:n}of e)for(const i of s??[])t.has(i.id)||t.set(i.id,{id:i.id,title:i.title,group:n,kind:"readiness",status:i.specStrength,message:i.message,...i.details!==void 0?{details:dk(i.details)}:{}});const r=new Map;for(const{passedAdvice:s,group:n}of e)for(const i of s??[])t.has(i.id)||r.has(i.id)||r.set(i.id,{id:i.id,title:i.title,group:n,status:i.specStrength});return{...t.size>0?{advisories:[...t.values()]}:{},...r.size>0?{passedAdvisories:[...r.values()]}:{}}}function pk(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function So(e){const t=Object.entries(e).filter(([,r])=>r===void 0?!1:Array.isArray(r)?r.length>0:pk(r)?Object.keys(r).length>0:!0);if(t.length!==0)return dk(Object.fromEntries(t))}function AD(e){if(e.httpAttempts.length!==0)return e.httpAttempts.map(t=>`${`${t.request.method} ${t.request.url}`} → ${t.response?`${t.response.status} ${t.response.statusText}`:"No response"}`).join(`
|
|
56
|
+
`)}function ID(e,t){return{id:e.id,title:e.title,category:e.category,status:e.status,...t?.has(e.id)?{pending:!0}:{},...e.skipReason?{skipReason:e.skipReason}:{},durationMs:e.durationMs,description:e.description,...e.error?.message?{error:e.error.message}:{},...e.details!==void 0||e.error?.details!==void 0?{details:So({details:e.details,errorDetails:e.error?.details})}:{}}}function RD(e,t){return{id:e.id,title:e.title,category:e.category,status:e.status,...t?.has(e.id)?{pending:!0}:{},...e.skipReason?{skipReason:e.skipReason}:{},durationMs:e.durationMs,description:e.description,...e.error?.message?{error:e.error.message}:{},...e.details!==void 0||e.error?.details!==void 0||e.warnings?.length?{details:So({details:e.details,errorDetails:e.error?.details,warnings:e.warnings})}:{}}}function CD(e,t){const r=AD(e);return{id:e.step,title:e.title||e.step,category:"oauth",status:e.status,...t?.has(e.step)?{pending:!0}:{},durationMs:e.durationMs,description:e.summary,...e.error?.message?{error:e.error.message}:{},...e.error?.details!==void 0||e.warnings?.length||e.teachableMoments?.length?{details:So({errorDetails:e.error?.details,warnings:e.warnings,teachableMoments:e.teachableMoments})}:{},...r?{output:r}:{}}}function Po(e){const t=e.outcome;return t!=="passed"&&t!=="failed"&&t!=="incomplete"?{}:{outcome:t,...e.incompleteReason?{incompleteReason:e.incompleteReason}:{}}}function ug(e){const t=e.map(r=>Po(r).outcome??(r.outcome==="not-applicable"||r.passed?"passed":"failed"));if(t.includes("failed"))return{outcome:"failed"};if(t.includes("incomplete")){const r=e.find(s=>Po(s).outcome==="incomplete");return{outcome:"incomplete",...r?.incompleteReason?{incompleteReason:r.incompleteReason}:{}}}return{outcome:"passed"}}function sy(e,t,r){return{id:`mcp-${r+1}`,title:t,target:e.serverUrl,passed:e.passed,durationMs:e.durationMs,summary:e.summary,cases:(()=>{const s=new Set(e.profile?.pendingCheckIds??[]);return e.checks.map(n=>ID(n,s))})()}}function Jh(e,t,r,s="apps"){const n=new Set(e.profile?.pendingCheckIds??[]);return{id:`${s}-${r+1}`,title:t,target:e.target,passed:e.passed,durationMs:e.durationMs,summary:e.summary,cases:e.checks.map(i=>RD(i,n))}}function ny(e,t,r,s,n=e.passed){return{id:`oauth-${r+1}`,title:t,target:e.serverUrl,passed:n,durationMs:e.durationMs,summary:e.summary,cases:e.steps.map(i=>CD(i,s))}}function PD(e){return"checks"in e&&!("results"in e)&&"serverUrl"in e&&!("target"in e)}function xD(e){return"checks"in e&&!("results"in e)&&"target"in e}function OD(e){return"checks"in e&&!("results"in e)&&"discovery"in e&&pk(e.discovery)&&"wire"in e.discovery}function MD(e){return"steps"in e&&!("results"in e)}function LD(e){return"results"in e&&"serverUrl"in e&&!("target"in e)&&e.results.length>0&&"checks"in e.results[0]}function ND(e){return"results"in e&&"target"in e}function $D(e){return"results"in e&&"serverUrl"in e&&!("target"in e)&&e.results.length>0&&"steps"in e.results[0]}function DD(e){const t=e[0]?.profile;return t?e.every(r=>r.profile?.profileId===t.profileId&&r.profile?.profileVersion===t.profileVersion&&r.profile?.manifestDigest===t.manifestDigest)?{profile:t}:{}:{}}function UD(e){return"results"in e?{schemaVersion:1,kind:"protocol-conformance",name:e.name,passed:e.passed,...ug(e.results),score:lg(e.results.map(ey)),...DD(e.results),durationMs:e.durationMs,groups:e.results.map((t,r)=>sy(t,t.label,r)),...Ei(e.results.map((t,r)=>({readiness:t.readiness,passedAdvice:t.passedAdvice,group:`mcp-${r+1}`})))}:{schemaVersion:1,kind:"protocol-conformance",name:"MCP Protocol Conformance",passed:e.passed,...Po(e),score:ey(e),...e.profile?{profile:e.profile}:{},durationMs:e.durationMs,groups:[sy(e,"MCP Protocol Conformance",0)],...Ei([{readiness:e.readiness,passedAdvice:e.passedAdvice,group:"mcp-1"}])}}function qD(e){return"results"in e?{schemaVersion:1,kind:"apps-conformance",name:e.name,passed:e.passed,...ug(e.results),score:lg(e.results.map(ty)),durationMs:e.durationMs,groups:e.results.map((t,r)=>Jh(t,t.label,r)),...Ei(e.results.map((t,r)=>({readiness:t.readiness,passedAdvice:t.passedAdvice,group:`apps-${r+1}`})))}:{schemaVersion:1,kind:"apps-conformance",name:"MCP Apps Conformance",passed:e.passed,...Po(e),score:ty(e),durationMs:e.durationMs,groups:[Jh(e,"MCP Apps Conformance",0)],...Ei([{readiness:e.readiness,passedAdvice:e.passedAdvice,group:"apps-1"}])}}function iy(e,t,r){return!r||e.outcome==="not-applicable"?{passed:e.passed,outcome:e.outcome,...e.incompleteReason?{incompleteReason:e.incompleteReason}:{}}:{passed:t.outcome==="passed",outcome:t.outcome,...t.outcome==="incomplete"&&e.incompleteReason?{incompleteReason:e.incompleteReason}:{}}}function zD(e,t){const r=uk(t?.oauthUnscoredCheckIds),s=new Set(r),n=s.size>0,i={unscoredCheckIds:r};if("results"in e){const c=e.results.map(p=>ry(p,i)),l=e.results.map((p,d)=>iy(p,c[d],n)),u=ug(l);return{schemaVersion:1,kind:"oauth-conformance",name:e.name,passed:n?u.outcome==="passed":e.passed,...u,score:lg(c),durationMs:e.durationMs,groups:e.results.map((p,d)=>ny(p,p.label,d,s,l[d].passed)),...Ei(e.results.map((p,d)=>({readiness:p.readiness,passedAdvice:p.passedAdvice,group:`oauth-${d+1}`})))}}const o=ry(e,i),a=iy(e,o,n);return{schemaVersion:1,kind:"oauth-conformance",name:"OAuth Conformance",passed:a.passed,...Po(a),score:o,durationMs:e.durationMs,groups:[ny(e,`${e.protocolVersion}/${e.registrationStrategy}`,0,s,a.passed)],...Ei([{readiness:e.readiness,passedAdvice:e.passedAdvice,group:"oauth-1"}])}}function FD(e){return"lanes"in e&&"findings"in e&&"badges"in e&&!("readinessKind"in e)}var jD={kind:"claude-directory-readiness",providerName:"Claude Directory Readiness",isResult:FD,isDispositive:e=>yO(e)};function HD(e){return e.status==="violated"?"failed":e.status==="satisfied"?"passed":"skipped"}function BD(e,t){const r=t.isDispositive,s=[],n=new Set,i=e.lanes.map(o=>{const a=e.findings.filter(c=>c.lane===o.lane);for(const c of a)n.add(c),!r(c)&&s.push({id:c.id,title:c.title,group:o.lane,kind:c.class,status:c.status,message:c.remediation??c.notEvaluatedReason,details:So({provenance:c.provenance,source:c.source,derivedFrom:c.derivedFrom,observed:c.details})});return{id:o.lane,title:o.lane,target:e.context.target,passed:o.status==="ready",durationMs:0,summary:o.summary,cases:a.filter(r).map(c=>({id:c.id,title:c.title,category:c.class,status:HD(c),skipReason:c.status==="not-evaluated"?"could-not-run":c.status==="not-applicable"?"not-applicable":void 0,durationMs:0,description:c.remediation,error:c.status==="violated"?c.remediation??"Requirement not satisfied":c.status==="not-evaluated"?c.notEvaluatedReason:void 0,details:So({provenance:c.provenance,intrusiveness:c.intrusiveness,source:c.source,requiresCapabilities:c.requiresCapabilities,derivedFrom:c.derivedFrom,observed:c.details})}))}});for(const o of e.findings)n.has(o)||s.push({id:o.id,title:o.title,group:o.lane,kind:o.class,status:o.status,message:o.remediation??o.notEvaluatedReason??"reported outside any lane in this result",details:So({provenance:o.provenance,source:o.source,orphanedLane:o.lane})});return{schemaVersion:1,kind:t.kind,name:t.providerName,passed:e.status==="ready",outcome:e.status==="ready"?"passed":e.status==="not-ready"?"failed":"incomplete",incompleteReason:e.status==="incomplete"?e.summary:void 0,durationMs:e.durationMs,groups:i,advisories:s}}var VD={kind:"openai-directory-readiness",providerName:"OpenAI Plugin Directory Readiness",isResult:e=>kO(e),isDispositive:e=>Em(e)},GD={kind:"muse-directory-readiness",providerName:"Muse Directory Readiness",isResult:e=>fL(e),isDispositive:e=>Em(e)},WD=[VD,GD,jD];function KD(e){return WD.find(t=>t.isResult(e))}function O9(e,t){const r=KD(e);if(r)return BD(e,r);if(PD(e)||LD(e))return UD(e);if(OD(e))return{schemaVersion:1,kind:"tasks-conformance",name:"MCP Tasks Conformance",passed:e.passed,...Po(e),score:ED(e),...e.profile?{profile:e.profile}:{},durationMs:e.durationMs,groups:[Jh(e,"MCP Tasks Conformance",0,"tasks")],...Ei([{readiness:e.readiness,passedAdvice:e.passedAdvice,group:"tasks-1"}])};if(xD(e)||ND(e))return qD(e);if(MD(e)||$D(e))return zD(e,t);throw new Error("Unsupported conformance result shape")}var JD=new Set(["code","access_token","refresh_token","id_token","token","client_secret","code_verifier","assertion","client_assertion","api_key","apikey","key","password","signature","sig"]);function YD(e){return e.replace(/[^a-z0-9]/gi,"").toLowerCase()}var M9=new Set([...JD].map(YD)),Fs="https://modelcontextprotocol.io/specification/2025-11-25",at="https://modelcontextprotocol.io/specification/2026-07-28",Hn="https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx",ar="https://github.com/modelcontextprotocol/ext-tasks/blob/main/specification/2026-07-28/tasks.md",tn=`${Fs}/basic/utilities/tasks`,ls=`${Fs}/basic/transports`,qi=`${at}/basic/transports/streamable-http`,ca=`${Fs}/basic/authorization`,la=`${at}/basic/authorization`,fp="https://www.rfc-editor.org/rfc/rfc6749";function zi(e){return{legacy:`${Fs}${e}`,modern:`${at}${e}`}}function fs(e){return{legacy:e,modern:e}}var XD={"server-initialize":{legacy:`${Fs}/basic/lifecycle#initialization`},ping:{legacy:`${Fs}/basic/utilities/ping`},"logging-set-level":{legacy:`${Fs}/server/utilities/logging`},"completion-complete":zi("/server/utilities/completion"),"capabilities-consistent":{legacy:`${Fs}/basic/lifecycle#capability-negotiation`,modern:`${at}/server/discover`},"tools-list":zi("/server/tools#listing-tools"),"tools-input-schemas-valid":zi("/server/tools#tool"),"tools-x-mcp-header-declarations-valid":{modern:`${at}/server/tools#x-mcp-header`},"prompts-list":zi("/server/prompts#listing-prompts"),"resources-list":zi("/server/resources#listing-resources"),"protocol-invalid-method-error":{legacy:`${Fs}/basic/index#error-responses`,modern:`${at}/basic/index#error-codes`},"localhost-host-rebinding-rejected":{legacy:`${ls}#security-warning`},"localhost-host-valid-accepted":{legacy:`${ls}#security-warning`},"server-sse-polling-session":{legacy:`${ls}#session-management`},"server-accepts-multiple-post-streams":{legacy:`${ls}#multiple-connections`},"server-sse-streams-functional":{legacy:`${ls}#listening-for-messages-from-the-server`},"notification-post-accepted":{legacy:`${ls}#sending-messages-to-the-server`},"get-stream-or-405":{legacy:`${ls}#listening-for-messages-from-the-server`},"session-id-visible-ascii":{legacy:`${ls}#session-management`},"post-response-content-type":{legacy:`${ls}#sending-messages-to-the-server`,modern:`${qi}#sending-messages`},"modern-client-handshake":{modern:`${at}/basic/versioning#protocol-version-negotiation`},"modern-server-discover":{modern:`${at}/server/discover`},"modern-result-type-present":{modern:`${at}/basic/index#result-responses`},"modern-cacheable-result-hints":{modern:`${at}/server/utilities/caching#cacheable-results`},"modern-cache-hint-coverage":{modern:`${at}/server/utilities/caching#cacheable-results`},"modern-cache-hint-values-valid":{modern:`${at}/server/utilities/caching#cacheable-model`},"modern-cache-scope-stable-across-pages":{modern:`${at}/server/utilities/caching#interaction-with-pagination`},"modern-protocol-version-header-mismatch":{modern:`${qi}#server-validation`},"modern-method-header-mismatch":{modern:`${qi}#server-validation`},"modern-name-header-mismatch":{modern:`${qi}#server-validation`},"modern-unsupported-version-error":{modern:`${at}/basic/versioning#protocol-version-negotiation`},"modern-missing-method-header-rejected":{modern:`${qi}#standard-request-headers`},"modern-header-names-case-insensitive":{modern:`${qi}#case-sensitivity`},"modern-undeclared-capability-error":{modern:`${at}/basic/index#error-codes`},"modern-no-session-id":{modern:`${at}/basic/index#statelessness`},"modern-removed-methods-not-found":{modern:`${at}/deprecated#removed`},"modern-resource-not-found-invalid-params":{modern:`${at}/server/resources#error-handling`},"modern-resource-read-no-empty-contents":{modern:`${at}/server/resources#error-handling`},"modern-tool-output-schema-conformant":{modern:`${at}/server/tools#output-schema`},"modern-logs-require-log-level":{modern:`${at}/server/utilities/logging#per-request-log-level`},"modern-subscription-ack-precedes-notifications":{modern:`${at}/basic/patterns/subscriptions#acknowledgment`},"modern-subscription-filter-and-tagging":{modern:`${at}/basic/patterns/subscriptions#notification-filter`},"modern-subscription-graceful-close":{modern:`${at}/basic/patterns/subscriptions#graceful-closure`},"wire-schema-valid":zi("/schema")},ZD={"ui-tools-present":fs(`${Hn}#resource-discovery`),"ui-tool-metadata-valid":fs(`${Hn}#resource-discovery`),"ui-tool-input-schema-valid":fs(`${Hn}#resource-discovery`),"ui-listed-resources-valid":fs(`${Hn}#ui-resource-format`),"ui-resources-readable":fs(`${Hn}#ui-resource-format`),"ui-resource-contents-valid":fs(`${Hn}#ui-resource-format`),"ui-resource-meta-valid":fs(`${Hn}#ui-resource-format`)},QD={"tasks-wire-resolvable":{legacy:`${tn}#capabilities`,modern:`${ar}#capability-negotiation`},"tasks-declaration-hygiene":{legacy:`${tn}#tool-level-negotiation`,modern:`${ar}#capability-negotiation`},"tasks-result-type-discipline":{legacy:`${tn}#creating-tasks`,modern:`${ar}#polymorphic-results`},"tasks-undeclared-creation-refused":{modern:`${ar}#task-creation`},"tasks-undeclared-capability-rejected":{modern:`${ar}#capability-negotiation`},"tasks-ttl-shape":{legacy:`${tn}#ttl-and-resource-management`,modern:`${ar}#tasks`},"tasks-inline-result":{legacy:`${tn}#result-retrieval`,modern:`${ar}#task-polling`},"tasks-mcp-name-routing":{modern:`${ar}#streamable-http-routing-headers`},"tasks-invalid-task-id-rejected":{legacy:`${tn}#protocol-errors`,modern:`${ar}#protocol-errors`},"tasks-status-payload-shape":{legacy:`${tn}#task-status`,modern:`${ar}#task-status`},"tasks-cancel-ack-shape":{legacy:`${tn}#cancelling-tasks`,modern:`${ar}#task-cancellation`},"tasks-update-ack-shape":{modern:`${ar}#task-update-requests`},"tasks-ttl-integer-shape":{modern:`${ar}#tasks`},"tasks-undeclared-capability-names-requirements":{modern:`${ar}#protocol-errors`}},eU={verify_profile_shape:null,verify_profile_stable:null,verify_profile_id_opaque:null,verify_profile_identity_stable_across_flows:null,verify_profile_stable_after_refresh:null,oauth_dcr_http_redirect_uri:{legacy:`${ca}#communication-security`,modern:`${la}/client-registration#application-type-and-redirect-uri-constraints`},oauth_invalid_client:fs(`${fp}#section-5.2`),oauth_invalid_authorize_redirect:{legacy:`${ca}#open-redirection`,modern:`${la}/security-considerations#open-redirection`},oauth_invalid_token:{legacy:`${ca}#token-handling`,modern:`${la}#token-handling`},oauth_invalid_redirect:fs(`${fp}#section-4.1.3`),oauth_token_format:fs(`${fp}#section-5.1`),oauth_unauthenticated_challenge:{legacy:`${ca}#protected-resource-metadata-discovery-requirements`,modern:`${la}/authorization-server-discovery#protected-resource-metadata-discovery-requirements`},oauth_resource_metadata_challenge:{legacy:`${ca}#protected-resource-metadata-discovery-requirements`,modern:`${la}/authorization-server-discovery#protected-resource-metadata-discovery-requirements`},oauth_stale_session_rejection:{legacy:`${ls}#session-management`}},oy={...XD,...ZD,...QD,...eU};function tU(e){if(e)return Object.prototype.hasOwnProperty.call(Kh,e)?Kh[e]:void 0}function L9(e,t){if(!Object.prototype.hasOwnProperty.call(oy,e))return;const r=oy[e];if(r)return tU(t)==="legacy"?r.legacy??r.modern:r.modern??r.legacy}function N9(e){return Mm(e).enabled}function La(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function rU(e){if(!La(e))return null;const t=e.apps;if(!La(t))return null;const r=t.pluginExtensions;if(!La(r)||typeof r.enabled!="boolean")return null;const s={};if(La(r.capabilities))for(const n of gm){const i=r.capabilities[n];typeof i=="boolean"&&(s[n]=i)}return{enabled:r.enabled,capabilities:s,behavior:hw(r.behavior)}}function $9(e){const t=rU(e?.mcpProfile),r=Mm(e??{}),s=t?t.enabled:r.enabled,n={};for(const i of gm)n[i]=s&&(t?.capabilities[i]??r.capabilities[i]);return{enabled:s,explicit:t!==null,capabilities:n}}var sU=["openai/elicitation","openai/form"];function D9(e,t){const r={...e??{}};if(t.capabilities.forms)return r;for(const s of["extensions","experimental"]){const n=r[s];if(!La(n))continue;const i=Object.fromEntries(Object.entries(n).filter(([o])=>!sU.includes(o)));Object.keys(i).length>0?r[s]=i:delete r[s]}return r}var U9=Object.freeze({chatgpt:!0,"chatgpt-desktop":!0,"chatgpt-work":!0,"chatgpt-work-desktop":!0,copilot:!0,mcpjam:!0,claude:!1,"claude-desktop":!1,"claude-code-desktop":!1,"claude-code-web":!1,cursor:!1,codex:!1,"codex-cli":!1,goose:!1,slack:!1,vscode:!1,notion:!1}),nU=["low","medium","high","xhigh","max"],iU=["minimal","low","medium","high"],hk={"claude-code":[],codex:["low","medium","high","xhigh"],"copilot-cli":[],cursor:[],opencode:[]};function oU(e,t){switch(e){case"openai":{const r=mk(t);return r.length===0?void 0:/^gpt-5\.\d+(?:[.-]|$)/.test(t)&&r.includes("none")?"none":r.includes("medium")?"medium":void 0}case"anthropic":return gk(t).includes("high")?"high":void 0;case"google":return vk(t).includes("high")?"high":void 0;default:return}}function aU(e){const t=e.indexOf("/");return t>0?e.slice(0,t):void 0}function q9(e,t,r){if(t==="org")return;const s=r??aU(e);if(s!==void 0)return oU(s,fk(e))}function fk(e){const t=e.indexOf("/");return t>=0?e.slice(t+1):e}function mk(e){if(/-(?:pro|chat)(?:[.-]|$)/.test(e))return[];if(/^(?:o1|o3|o3-mini|o4-mini)(?:-\d{4}-\d{2}-\d{2})?$/.test(e))return["low","medium","high"];if(/-codex(?:[.-]|$)/.test(e))return/^gpt-5\.1-codex-max$|^gpt-5\.2-codex$/.test(e)?["low","medium","high","xhigh"]:[];const t=/^gpt-5\.(\d+)(?:[.-]|$)/.exec(e);return t?Number(t[1])>=2?["none","low","medium","high","xhigh"]:["none","low","medium","high"]:/^gpt-5(?:-|$)/.test(e)?["minimal","low","medium","high"]:[]}function gk(e){const t=/^claude-(opus|sonnet|haiku|fable)-(\d+)(?:[.-](\d{1,2})(?!\d))?(?:[.-]|$)/.exec(e);if(!t)return[];const r=Number(t[2]),s=t[3]===void 0?0:Number(t[3]),n=nU;return t[1]==="haiku"?[]:r>=5?n:r!==4||s>=10?[]:t[1]==="opus"?s>=7?n:s===6?["low","medium","high","max"]:s===5?["low","medium","high"]:[]:t[1]==="sonnet"&&s>=6?["low","medium","high","max"]:[]}function vk(e){return/^gemini-3\.\d+-pro(?:-preview)?(?:-\d+)?$/.test(e)?["low","medium","high"]:/^gemini-3-pro(?:-preview)?(?:-\d+)?$/.test(e)?["low","high"]:/^gemini-3(?:\.\d+)?-flash(?:-preview)?(?:-\d+)?$/.test(e)?iU:[]}function cU(e,t){const r=fk(t);switch(e){case"openai":return mk(r);case"anthropic":return gk(r);case"google":return vk(r);default:return[]}}var lU=new Set(Zu);function Bl(e){const t=new Set(e.filter(r=>lU.has(r)));return Zu.filter(r=>t.has(r))}function z9(e){return Bl(hk[e]??[])}function uU(e){if(e.harness!==void 0){const t=new Set(uU({...e,harness:void 0}));return Bl((hk[e.harness]??[]).filter(r=>t.has(r)))}switch(e.route){case"hosted":return Bl(e.catalogEfforts??[]);case"org":return[];case"orgCloud":case"direct":return Bl(cU(e.providerKey,e.modelId))}}function _k(e){const t=e.connectionRef,r=e.settings,s=r!==void 0&&(r.reasoningEffort!==void 0||r.temperature!==void 0);return{modelId:e.modelId,source:e.source,...t===void 0?{}:t.kind==="orgProvider"?{connectionRef:{kind:t.kind,id:t.id}}:{connectionRef:{kind:t.kind,providerKey:t.providerKey,...t.customProviderName!==void 0?{customProviderName:t.customProviderName}:{}}},...e.nativeModelId!==void 0?{nativeModelId:e.nativeModelId}:{},...s?{settings:{...r.reasoningEffort!==void 0?{reasoningEffort:r.reasoningEffort}:{},...r.temperature!==void 0?{temperature:r.temperature}:{}}}:{},fallback:{provider:e.fallback.provider,model:e.fallback.model}}}function F9(e){return e.source==="legacy"?JSON.stringify({source:e.source,modelId:e.modelId,...e.provider!==void 0?{provider:e.provider}:{}}):JSON.stringify(_k(e))}function dU(e){if(e.source==="legacy")return!0;if(e.source!=="hosted"||e.nativeModelId!==void 0)return!1;const t=e.settings;return t===void 0||t.reasoningEffort===void 0&&t.temperature===void 0}function ay(e){const t=pU(e);return t===void 0?e.modelId:`${e.modelId}\0${t}`}function pU(e){if(dU(e))return;const{fallback:t,...r}=_k(e);return JSON.stringify(r)}var cy={none:"None",minimal:"Minimal",low:"Low",medium:"Med",high:"High",xhigh:"X-High",max:"Max"};function hU(e){if(e.source==="legacy")return"Your key";if(e.source==="hosted")return"MCPJam";const t=e.connectionRef;return t?.kind==="localProvider"?t.customProviderName??t.providerKey:"Org key"}function ly(e){return e.source==="legacy"?void 0:e.settings}function j9(e,t){const r=t.filter(u=>u.modelId===e.modelId&&ay(u)!==ay(e)),s=u=>ly(u)?.reasoningEffort,n=s(e);if(r.length===0)return n===void 0?[]:[cy[n]];const i=[],o=hU(e),a=e.source==="legacy"?"legacy":uy(e);r.some(u=>(u.source==="legacy"?"legacy":uy(u))!==a)&&i.push(o);const c=u=>u.source==="legacy"?void 0:u.nativeModelId;if(r.some(u=>c(u)!==c(e))){const u=c(e);u!==void 0&&i.push(u)}(n!==void 0||r.some(u=>s(u)!==n))&&i.push(n===void 0?"Default":cy[n]);const l=u=>ly(u)?.temperature;if(r.some(u=>l(u)!==l(e))){const u=l(e);i.push(u===void 0?"Default temp":`Temp ${u}`)}return i}function uy(e){const t=e.connectionRef;return t===void 0?e.source:t.kind==="orgProvider"?`${e.source}:${t.id}`:`${e.source}:${t.providerKey}:${t.customProviderName??""}`}function Wr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function mt(e){return typeof e=="string"&&e.trim().length>0?e:void 0}function au(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function fU(e){if(!Wr(e))return;const{origin:t,ownKeyOnly:r,...s}=e;if(t!==void 0&&t!=="backfill"&&t!=="platform"||r!==void 0&&(r!==!0||e.source!=="legacy"))return;const n={...t?{origin:t}:{},...r?{ownKeyOnly:!0}:{}};if(e.source==="legacy"){const o=mt(e.modelId);return o?{source:"legacy",modelId:o,...n}:void 0}if(!i2(s))return;const i=yk(s.connectionRef);return{...n,modelId:s.modelId,source:s.source,...i?{connectionRef:i}:{},...s.nativeModelId!==void 0?{nativeModelId:s.nativeModelId}:{},...s.settings?{settings:{...s.settings.reasoningEffort!==void 0?{reasoningEffort:s.settings.reasoningEffort}:{},...s.settings.temperature!==void 0?{temperature:s.settings.temperature}:{}}}:{},fallback:{provider:s.fallback.provider,model:s.fallback.model}}}function yk(e){if(Wr(e)){if(e.kind==="orgProvider"){const t=mt(e.id);return t?{kind:"orgProvider",id:t}:void 0}if(e.kind==="localProvider"){const t=mt(e.providerKey);if(!t)return;const r=mt(e.customProviderName);return{kind:"localProvider",providerKey:t,...r?{customProviderName:r}:{}}}}}function mU(e){if(!Wr(e))return;const t=mt(e.rail),r=mt(e.providerKey);if(!t||!r)return;const s=mt(e.connectionLabel),n=au(e.credentialVersion),i=mt(e.nativeModelId);return{rail:t,providerKey:r,...s?{connectionLabel:s}:{},...n!==void 0?{credentialVersion:n}:{},...i?{nativeModelId:i}:{}}}function gU(e){if(!Wr(e))return;const t=mt(e.rail),r=mt(e.wireModelId),s=mt(e.outcome),n=au(e.at);if(!t||!r||!s||n===void 0)return;const i=mt(e.code);return{rail:t,wireModelId:r,outcome:s,...i?{code:i}:{},at:n}}function H9(e){if(!Wr(e))return;const t=fU(e.requested),r=e.resolved;if(!t||!Wr(r))return;const s=mt(r.rail),n=mt(r.wireModelId),i=mU(r.offering);if(!s||!n||!i)return;const o=e.effectiveSettings;if(!Wr(o))return;const a=au(o.maxOutputTokens);if(a===void 0)return;const c=yk(r.connectionRef),l=mt(r.nativeModelId),u=e.harness,p=Wr(u)?mt(u.id):void 0,d=Wr(u)?mt(u.runtimeVersion):void 0,h=mt(o.reasoningEffort),f=au(o.temperature),m=Array.isArray(e.attempts)?e.attempts.flatMap(O=>{const x=gU(O);return x?[x]:[]}):[],v=mt(e.upstreamModel),_=e.deviation,b=Wr(_)?mt(_.kind):void 0,T=Wr(_)&&typeof _.reason=="string"?_.reason:"";return{requested:t,resolved:{rail:s,wireModelId:n,...c?{connectionRef:c}:{},...l?{nativeModelId:l}:{},offering:i},...p&&d?{harness:{id:p,runtimeVersion:d}}:{},effectiveSettings:{...h?{reasoningEffort:h}:{},...f!==void 0?{temperature:f}:{},maxOutputTokens:a},attempts:m,...v?{upstreamModel:v}:{},...b?{deviation:{kind:b,reason:T}}:{}}}var vU="=?base64?";function _U(e){const t=e.toLowerCase();if(t==="mcp-protocol-version")return"protocol-version";if(t==="mcp-method")return"method";if(t==="mcp-name")return"name";if(t==="mcp-session-id")return"session";if(t==="last-event-id")return"resumption";if(t.startsWith("mcp-param-"))return"param"}function yU(e){const t=globalThis;if(typeof t.atob=="function"){const r=t.atob(e),s=new Uint8Array(r.length);for(let n=0;n<r.length;n+=1)s[n]=r.charCodeAt(n);return new TextDecoder("utf-8",{fatal:!0}).decode(s)}if(t.Buffer)return t.Buffer.from(e,"base64").toString("utf8");throw new Error("no base64 decoder available")}function Vl(e){if(!e.startsWith("=?base64?")||!e.endsWith("?=")||e.length<11)return{raw:e,encoded:!1,value:e};const t=e.slice(9,e.length-2);try{return{raw:e,encoded:!0,value:yU(t)}}catch(r){return{raw:e,encoded:!0,value:e,decodeError:r instanceof Error?r.message:String(r)}}}var bU=new Set(["tools/call","resources/read","prompts/get"]),bk=new Set(["tasks/get","tasks/update","tasks/cancel"]);function SU(e){return e===void 0?!1:bU.has(e)||bk.has(e)}var dy=["protocol-version","method","name","param","session","resumption"];function wU(e){return e!==void 0&&bk.has(e)?".params.taskId":e==="resources/read"?".params.uri":".params.name"}function kU(e){const t=e.declarations??[],r=LU(t,e.arguments);return t.map(s=>{const n=`${Sk}${s.headerName}`,i=r[n];return{header:n.toLowerCase(),displayName:n,expected:i===void 0?void 0:Vl(i).value,bodyField:`.params.arguments${s.path.map(o=>`.${o}`).join("")}`}})}function B9(e,t,r){const s=new Map;for(const[d,h]of Object.entries(e))s.set(d.toLowerCase(),{name:d,value:h});const n=s.get("mcp-protocol-version")?.value??t?.protocolVersion,i=!!n&&$C(n)&&BC(n)&&!!t,o=[],a=new Set,c=i&&t?[{header:"mcp-protocol-version",family:"protocol-version",bodyValue:t.protocolVersion,bodyField:"._meta protocolVersion",required:!0},{header:"mcp-method",family:"method",bodyValue:t.method,bodyField:".method",required:!0},{header:"mcp-name",family:"name",bodyValue:t.name,bodyField:wU(t.method),required:SU(t.method)}]:[];for(const d of c){a.add(d.header);const h=s.get(d.header);if(!h){d.required&&d.bodyValue!==void 0?o.push({name:d.header,family:d.family,status:"missing",bodyValue:d.bodyValue,bodyField:d.bodyField}):!d.required&&t?.method!==void 0&&o.push({name:d.header,family:d.family,status:"not-required"});continue}const f=Vl(h.value),m={name:h.name,family:d.family,raw:h.value,decoded:f.encoded&&!f.decodeError?f.value:void 0};f.decodeError?o.push({...m,status:"undecodable"}):d.bodyValue===void 0?o.push({...m,status:"unchecked"}):f.value===d.bodyValue?o.push({...m,status:"match",bodyField:d.bodyField}):o.push({...m,status:"mismatch",bodyValue:d.bodyValue,bodyField:d.bodyField})}const l=r!==void 0&&"arguments"in r,u=i&&r?kU(r):[],p=i&&r?.declarations!==void 0;for(const d of u){a.add(d.header);const h=s.get(d.header);if(!h){if(!l){o.push({name:d.displayName,family:"param",status:"unchecked"});continue}o.push(d.expected===void 0?{name:d.displayName,family:"param",status:"not-required"}:{name:d.displayName,family:"param",status:"missing",bodyValue:d.expected,bodyField:d.bodyField});continue}const f=Vl(h.value),m={name:h.name,family:"param",raw:h.value,decoded:f.encoded&&!f.decodeError?f.value:void 0};f.decodeError?o.push({...m,status:"undecodable"}):l?d.expected===void 0?o.push({...m,status:"mismatch",bodyValue:"(absent from arguments)",bodyField:d.bodyField}):f.value===d.expected?o.push({...m,status:"match",bodyField:d.bodyField}):o.push({...m,status:"mismatch",bodyValue:d.expected,bodyField:d.bodyField}):o.push({...m,status:"unchecked"})}for(const[d,h]of s){if(a.has(d))continue;const f=_U(h.name);if(!f)continue;const m=Vl(h.value),v=i&&f==="param"&&!!m.decodeError,_=p&&f==="param"&&!v;o.push({name:h.name,family:f,raw:h.value,decoded:m.encoded&&!m.decodeError?m.value:void 0,status:v?"undecodable":_?"undeclared":"unchecked"})}return o.sort((d,h)=>dy.indexOf(d.family)-dy.indexOf(h.family)||d.name.localeCompare(h.name))}var py="x-mcp-header",Sk="Mcp-Param-",EU=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,TU=new Set(["string","integer","boolean","number"]),AU=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],IU=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function RU(e){return e.length===0?"<root>":e.join(".")}function V9(e){const t=[],r=new Map,s=(i,o,a)=>{if(i===null||typeof i!="object")return;const c=i;if(py in c){const u=RU(o);if(!a||o.length===0)return`${u}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;const p=c[py];if(typeof p!="string"||p.length===0)return`${u}: x-mcp-header MUST be a non-empty string`;if(!EU.test(p))return`${u}: x-mcp-header '${p}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;const d=typeof c.type=="string"?c.type:void 0;if(d===void 0||!TU.has(d))return`${u}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${d??"<none>"}`;const h=p.toLowerCase(),f=r.get(h);if(f!==void 0)return`x-mcp-header '${p}' is not case-insensitively unique (also declared as '${f}')`;r.set(h,p),t.push({path:o,headerName:p,type:d})}const l=c.properties;if(l!==null&&typeof l=="object")for(const[u,p]of Object.entries(l)){const d=s(p,[...o,u],a);if(d!==void 0)return d}for(const u of AU){const p=c[u];if(p===void 0)continue;const d=p!==null&&typeof p=="object"&&IU.has(u),h=Array.isArray(p)?p:d?Object.values(p):[p];for(const f of h){const m=s(f,[...o,`<${u}>`],!1);if(m!==void 0)return m}}},n=s(e,[],!0);return n===void 0?{valid:!0,declarations:t}:{valid:!1,reason:n}}function CU(e){const t=globalThis,r=new TextEncoder().encode(e);if(typeof t.btoa=="function"){let s="";for(const n of r)s+=String.fromCodePoint(n);return t.btoa(s)}if(t.Buffer)return t.Buffer.from(e,"utf8").toString("base64");throw new Error("no base64 encoder available")}function PU(e){if(e.length===0||e.startsWith("=?base64?")&&e.endsWith("?=")||e!==e.trim())return!0;for(let t=0;t<e.length;t+=1){const r=e.codePointAt(t);if(!(r===9||r>=32&&r<=126))return!0}return!1}function xU(e){if(!PU(e))return e;const t=CU(e);return`${vU}${t}?=`}function OU(e){if(typeof e=="string")return e;if(typeof e=="boolean")return e?"true":"false";if(typeof e=="number")return!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e)?void 0:String(e)}function MU(e,t){let r=e;for(const s of t){if(r===null||typeof r!="object")return;r=r[s]}return r}function LU(e,t){const r={};for(const s of e){const n=MU(t,s.path);if(n==null)continue;const i=OU(n);i!==void 0&&(r[`${Sk}${s.headerName}`]=xU(i))}return r}var NU="tracestate",$U="baggage",DU=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/,UU="0".repeat(32),qU="0".repeat(16);function zU(e){if(typeof e!="string")return;const t=DU.exec(e);if(!t)return;const[,r,s,n,i]=t;if(!(r==="ff"||r!=="00")&&!(s===UU||n===qU))return{version:r,traceId:s,spanId:n,flags:i,sampled:(Number.parseInt(i,16)&1)===1}}function FU(e){return zU(e)!==void 0}var jU=32,HU=/^(?:[a-z][a-z0-9_\-*/]{0,255}|[a-z0-9][a-z0-9_\-*/]{0,240}@[a-z][a-z0-9_\-*/]{0,13})$/,BU=/^[\x20-\x2b\x2d-\x3c\x3e-\x7e]{0,255}[\x21-\x2b\x2d-\x3c\x3e-\x7e]$/;function VU(e){if(typeof e!="string"||e.length===0)return!1;const t=e.split(",");if(t.length>jU)return!1;let r=0;for(const s of t){const n=s.trim();if(n.length===0)continue;r+=1;const i=n.indexOf("=");if(i<=0||!HU.test(n.slice(0,i))||!BU.test(n.slice(i+1)))return!1}return r>0}var GU=180,WU=8192,KU=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,hy=/^[\x21\x23-\x2b\x2d-\x3a\x3c-\x5b\x5d-\x7e]*$/;function JU(e){if(typeof e!="string"||e.length===0||e.length>WU)return!1;const t=e.split(",");if(t.length>GU)return!1;for(const r of t){const s=r.trim();if(s.length===0)return!1;const[n,...i]=s.split(";"),o=n.indexOf("=");if(o<=0||!KU.test(n.slice(0,o).trim())||!hy.test(n.slice(o+1).trim()))return!1;for(const a of i)if(!hy.test(a.replace(/=/g,"").trim()))return!1}return!0}function YU(e){if(!(!e||!FU(e.traceparent)))return{traceparent:e.traceparent,...VU(e.tracestate)?{tracestate:e.tracestate}:{},...JU(e.baggage)?{baggage:e.baggage}:{}}}function G9(e){if(!e||typeof e!="object")return;const t=r=>{const s=e[r];return typeof s=="string"?s:void 0};return YU({traceparent:t("traceparent")??"",tracestate:t(NU),baggage:t($U)})}var wk="SUPPORTED_MODELS row sent verbatim to api.anthropic.com by createLlmModel",Ps=`${wk}; canonical spelling from hosted-model-ids.generated.ts`,XU=Object.freeze([{canonicalId:"anthropic/claude-fable-5",nativeId:"claude-fable-5",evidence:Ps},{canonicalId:"anthropic/claude-opus-5",nativeId:"claude-opus-5",evidence:wk},{canonicalId:"anthropic/claude-sonnet-5",nativeId:"claude-sonnet-5",evidence:Ps},{canonicalId:"anthropic/claude-opus-4.8",nativeId:"claude-opus-4-8",evidence:Ps},{canonicalId:"anthropic/claude-opus-4.7",nativeId:"claude-opus-4-7",evidence:Ps},{canonicalId:"anthropic/claude-opus-4.6",nativeId:"claude-opus-4-6",evidence:Ps},{canonicalId:"anthropic/claude-sonnet-4.6",nativeId:"claude-sonnet-4-6",evidence:Ps},{canonicalId:"anthropic/claude-sonnet-4.5",nativeId:"claude-sonnet-4-5",nativeAliases:["claude-sonnet-4-5-20250929"],evidence:`${Ps}; snapshot id from Anthropic's models overview`},{canonicalId:"anthropic/claude-haiku-5.5",nativeId:"claude-haiku-5-5",evidence:Ps},{canonicalId:"anthropic/claude-haiku-4.5",nativeId:"claude-haiku-4-5",nativeAliases:["claude-haiku-4-5-20251001"],evidence:`${Ps}; snapshot id from Anthropic's models overview`}]),kk="SUPPORTED_MODELS row sent verbatim to api.openai.com by createLlmModel; listed under this id by GET /v1/models",Jt=`${kk}; canonical spelling from hosted-model-ids.generated.ts`,ul="SUPPORTED_MODELS row sent verbatim to api.openai.com by createLlmModel; id from OpenAI's model page (developers.openai.com/api/docs/models), read 2026-10-16, not yet seen in GET /v1/models; canonical spelling from hosted-model-ids.generated.ts",ZU=[{canonicalId:"openai/gpt-6.1-sol",nativeId:"gpt-6.1-sol",evidence:ul},{canonicalId:"openai/gpt-6-luna",nativeId:"gpt-6-luna",evidence:ul},{canonicalId:"openai/gpt-6-sol",nativeId:"gpt-6-sol",evidence:ul},{canonicalId:"openai/gpt-6-astra",nativeId:"gpt-6-astra",evidence:ul},{canonicalId:"openai/gpt-5.6-luna",nativeId:"gpt-5.6-luna",evidence:Jt},{canonicalId:"openai/gpt-5.6-sol",nativeId:"gpt-5.6-sol",evidence:Jt},{canonicalId:"openai/gpt-5.6-terra",nativeId:"gpt-5.6-terra",evidence:Jt},{canonicalId:"openai/gpt-5.1",nativeId:"gpt-5.1",evidence:kk},{canonicalId:"openai/gpt-5.1-codex",nativeId:"gpt-5.1-codex",evidence:Jt},{canonicalId:"openai/gpt-5.1-codex-mini",nativeId:"gpt-5.1-codex-mini",evidence:Jt},{canonicalId:"openai/gpt-5",nativeId:"gpt-5",evidence:Jt},{canonicalId:"openai/gpt-5-mini",nativeId:"gpt-5-mini",evidence:Jt},{canonicalId:"openai/gpt-5-nano",nativeId:"gpt-5-nano",evidence:Jt},{canonicalId:"openai/gpt-5-pro",nativeId:"gpt-5-pro",evidence:Jt},{canonicalId:"openai/gpt-5-codex",nativeId:"gpt-5-codex",evidence:Jt},{canonicalId:"openai/gpt-4.1",nativeId:"gpt-4.1",evidence:Jt},{canonicalId:"openai/gpt-4.1-mini",nativeId:"gpt-4.1-mini",evidence:Jt},{canonicalId:"openai/gpt-4.1-nano",nativeId:"gpt-4.1-nano",evidence:Jt},{canonicalId:"openai/gpt-4o",nativeId:"gpt-4o",evidence:Jt},{canonicalId:"openai/gpt-4o-mini",nativeId:"gpt-4o-mini",evidence:Jt}],Ek="SUPPORTED_MODELS row sent verbatim to the Gemini API by createLlmModel",fy=`${Ek}; canonical spelling from hosted-model-ids.generated.ts`,QU=[{canonicalId:"google/gemini-2.5-pro",nativeId:"gemini-2.5-pro",evidence:fy},{canonicalId:"google/gemini-2.5-flash",nativeId:"gemini-2.5-flash",evidence:fy},{canonicalId:"google/gemini-2.0-flash-exp",nativeId:"gemini-2.0-flash-exp",evidence:Ek}];function Yh(e,t){const r=new Map,s=new Map;for(const n of t){if(!n.evidence.trim())throw new Error(`${e} native model id table: ${n.canonicalId} has no evidence`);if(r.has(n.canonicalId))throw new Error(`${e} native model id table: ${n.canonicalId} listed twice`);r.set(n.canonicalId,n);for(const i of[n.nativeId,...n.nativeAliases??[]]){const o=s.get(i);if(o!==void 0&&o!==n.canonicalId)throw new Error(`${e} native model id table: ${i} claimed by ${o} and ${n.canonicalId}`);s.set(i,n.canonicalId)}}return r}var eq=Yh("Anthropic",XU),W9=new Map([["anthropic",eq],["openai",Yh("OpenAI",ZU)],["google",Yh("Google",QU)]]),K9=Ir.MissingRequiredClientCapability,tq=Object.create,cu=Object.defineProperty,rq=Object.getOwnPropertyDescriptor,sq=Object.getOwnPropertyNames,nq=Object.getPrototypeOf,iq=Object.prototype.hasOwnProperty,oq=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),aq=(e,t)=>{let r={};for(var s in e)cu(r,s,{get:e[s],enumerable:!0});return t&&cu(r,Symbol.toStringTag,{value:"Module"}),r},cq=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(var n=sq(t),i=0,o=n.length,a;i<o;i++)a=n[i],!iq.call(e,a)&&a!==r&&cu(e,a,{get:(c=>t[c]).bind(null,a),enumerable:!(s=rq(t,a))||s.enumerable});return e},lq=(e,t,r)=>(r=e!=null?tq(nq(e)):{},cq(t||!e||!e.__esModule?cu(r,"default",{value:e,enumerable:!0}):r,e)),uq="io.modelcontextprotocol/related-task",dq="io.modelcontextprotocol/serverInfo",pq="io.modelcontextprotocol/subscriptionId";var xo=FC(()=>ut([w(),Ue(),Ne(),nS(),Qe(w(),xo),te(xo)])),yt=Qe(w(),xo),hq=te(xo),dg=ut([w(),Ue().int()]),pg=w(),Tk=se({ttl:Ue().optional()}),Ak=se({taskId:w()}),hg=_t({progressToken:dg.optional(),[uq]:Ak.optional()}),Kt=se({_meta:hg.optional()}),xc=Kt.extend({task:Tk.optional()}),bt=se({method:w(),params:Kt.loose().optional()}),fr=se({_meta:hg.optional()}),mr=se({method:w(),params:fr.loose().optional()}),fg=_t({get[dq](){return vd.optional().catch(void 0)}}),St=_t({_meta:fg.optional()}),Go=ut([w(),Ue().int()]),Ik=se({jsonrpc:ye("2.0"),id:Go,...bt.shape}).strict(),Rk=se({jsonrpc:ye("2.0"),...mr.shape}).strict(),mg=se({jsonrpc:ye("2.0"),id:Go,result:St}).strict(),gg=se({jsonrpc:ye("2.0"),id:Go.optional(),error:se({code:Ue().int(),message:w(),data:It().optional()})}).strict(),fq=ut([Ik,Rk,mg,gg]),mq=ut([mg,gg]),vg=St.strict(),Ck=fr.extend({requestId:Go.optional(),reason:w().optional()}),_g=mr.extend({method:ye("notifications/cancelled"),params:Ck}),Pk=se({src:w(),mimeType:w().optional(),sizes:te(w()).optional(),theme:ct(["light","dark"]).optional()}),Wo=se({icons:te(Pk).optional()}),Ti=se({name:w(),title:w().optional()}),vd=Ti.extend({...Ti.shape,...Wo.shape,version:w(),websiteUrl:w().optional(),description:w().optional()}),gq=oS(se({applyDefaults:Ne().optional()}),yt),vq=rS(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,oS(se({form:gq.optional(),url:yt.optional()}),yt.optional())),xk=_t({list:yt.optional(),cancel:yt.optional(),requests:_t({sampling:_t({createMessage:yt.optional()}).optional(),elicitation:_t({create:yt.optional()}).optional()}).optional()}),Ok=_t({list:yt.optional(),cancel:yt.optional(),requests:_t({tools:_t({call:yt.optional()}).optional()}).optional()}),Mk=se({experimental:Qe(w(),yt).optional(),sampling:se({context:yt.optional(),tools:yt.optional()}).optional(),elicitation:vq.optional(),roots:se({listChanged:Ne().optional()}).optional(),tasks:xk.optional(),extensions:Qe(w(),yt).optional()}),Lk=Kt.extend({protocolVersion:w(),capabilities:Mk,clientInfo:vd}),Nk=bt.extend({method:ye("initialize"),params:Lk}),yg=se({experimental:Qe(w(),yt).optional(),logging:yt.optional(),completions:yt.optional(),prompts:se({listChanged:Ne().optional()}).optional(),resources:se({subscribe:Ne().optional(),listChanged:Ne().optional()}).optional(),tools:se({listChanged:Ne().optional()}).optional(),tasks:Ok.optional(),extensions:Qe(w(),yt).optional()}),$k=St.extend({protocolVersion:w(),capabilities:yg,serverInfo:vd,instructions:w().optional()}),Dk=mr.extend({method:ye("notifications/initialized"),params:fr.optional()}),Uk=bt.extend({method:ye("server/discover"),params:Kt.optional()}),qk=St.extend({supportedVersions:te(w()),capabilities:yg,instructions:w().optional()}),bg=bt.extend({method:ye("ping"),params:Kt.optional()}),zk=se({progress:Ue(),total:ht(Ue()),message:ht(w())}),Fk=se({...fr.shape,...zk.shape,progressToken:dg}),Sg=mr.extend({method:ye("notifications/progress"),params:Fk}),jk=Kt.extend({cursor:pg.optional()}),Ko=bt.extend({params:jk.optional()}),Jo=St.extend({nextCursor:pg.optional()}),wg=se({uri:w(),mimeType:ht(w()),_meta:Qe(w(),It()).optional()}),kg=wg.extend({text:w()}),Eg=w().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Tg=wg.extend({blob:Eg}),Yo=ct(["user","assistant"]),xi=se({audience:te(Yo).optional(),priority:Ue().min(0).max(1).optional(),lastModified:uS({offset:!0}).optional()}),Ag=se({...Ti.shape,...Wo.shape,uri:w(),description:ht(w()),mimeType:ht(w()),size:ht(Ue()),annotations:xi.optional(),_meta:ht(_t({}))}),Hk=se({...Ti.shape,...Wo.shape,uriTemplate:w(),description:ht(w()),mimeType:ht(w()),annotations:xi.optional(),_meta:ht(_t({}))}),Bk=Ko.extend({method:ye("resources/list")}),Vk=Jo.extend({resources:te(Ag)}),Gk=Ko.extend({method:ye("resources/templates/list")}),Wk=Jo.extend({resourceTemplates:te(Hk)}),_d=Kt.extend({uri:w()}),Kk=_d,Jk=bt.extend({method:ye("resources/read"),params:Kk}),Yk=St.extend({contents:te(ut([kg,Tg]))}),Xk=mr.extend({method:ye("notifications/resources/list_changed"),params:fr.optional()}),Zk=_d,Qk=bt.extend({method:ye("resources/subscribe"),params:Zk}),eE=_d,tE=bt.extend({method:ye("resources/unsubscribe"),params:eE}),Ig=se({toolsListChanged:Ne().optional(),promptsListChanged:Ne().optional(),resourcesListChanged:Ne().optional(),resourceSubscriptions:te(w()).optional()}),rE=Kt.extend({notifications:Ig}),sE=bt.extend({method:ye("subscriptions/listen"),params:rE}),nE=fr.extend({notifications:Ig}),iE=mr.extend({method:ye("notifications/subscriptions/acknowledged"),params:nE}),oE=fg.extend({[pq]:Go}),aE=St.extend({_meta:oE}),cE=fr.extend({uri:w()}),lE=mr.extend({method:ye("notifications/resources/updated"),params:cE}),uE=se({name:w(),description:ht(w()),required:ht(Ne())}),dE=se({...Ti.shape,...Wo.shape,description:ht(w()),arguments:ht(te(uE)),_meta:ht(_t({}))}),pE=Ko.extend({method:ye("prompts/list")}),hE=Jo.extend({prompts:te(dE)}),fE=Kt.extend({name:w(),arguments:Qe(w(),w()).optional()}),mE=bt.extend({method:ye("prompts/get"),params:fE}),yd=se({type:ye("text"),text:w(),annotations:xi.optional(),_meta:Qe(w(),It()).optional()}),bd=se({type:ye("image"),data:Eg,mimeType:w(),annotations:xi.optional(),_meta:Qe(w(),It()).optional()}),Sd=se({type:ye("audio"),data:Eg,mimeType:w(),annotations:xi.optional(),_meta:Qe(w(),It()).optional()}),gE=se({type:ye("tool_use"),name:w(),id:w(),input:Qe(w(),It()),_meta:Qe(w(),It()).optional()}),vE=se({type:ye("resource"),resource:ut([kg,Tg]),annotations:xi.optional(),_meta:Qe(w(),It()).optional()}),_E=Ag.extend({type:ye("resource_link")}),wd=ut([yd,bd,Sd,_E,vE]),yE=se({role:Yo,content:wd}),bE=St.extend({description:w().optional(),messages:te(yE)}),SE=mr.extend({method:ye("notifications/prompts/list_changed"),params:fr.optional()}),wE=se({title:w().optional(),readOnlyHint:Ne().optional(),destructiveHint:Ne().optional(),idempotentHint:Ne().optional(),openWorldHint:Ne().optional()}),kE=se({taskSupport:ct(["required","optional","forbidden"]).optional()}),Rg=se({...Ti.shape,...Wo.shape,description:w().optional(),inputSchema:se({type:ye("object"),properties:Qe(w(),xo).optional(),required:te(w()).optional()}).catchall(It()),outputSchema:_t({$schema:w().optional()}).optional(),annotations:wE.optional(),execution:kE.optional(),_meta:Qe(w(),It()).optional()}),EE=Ko.extend({method:ye("tools/list")}),TE=Jo.extend({tools:te(Rg)}),kd=St.extend({content:te(wd).default([]),structuredContent:It().optional(),isError:Ne().optional()}),_q=kd.or(St.extend({toolResult:It()})),AE=xc.extend({name:w(),arguments:Qe(w(),It()).optional()}),IE=bt.extend({method:ye("tools/call"),params:AE}),RE=mr.extend({method:ye("notifications/tools/list_changed"),params:fr.optional()}),yq=se({autoRefresh:Ne().default(!0),debounceMs:Ue().int().nonnegative().default(300)}),Cg=ct(["debug","info","notice","warning","error","critical","alert","emergency"]),CE=Kt.extend({level:Cg}),PE=bt.extend({method:ye("logging/setLevel"),params:CE}),xE=fr.extend({level:Cg,logger:w().optional(),data:It()}),OE=mr.extend({method:ye("notifications/message"),params:xE}),ME=se({name:w().optional()}),LE=se({hints:te(ME).optional(),costPriority:Ue().min(0).max(1).optional(),speedPriority:Ue().min(0).max(1).optional(),intelligencePriority:Ue().min(0).max(1).optional()}),NE=se({mode:ct(["auto","required","none"]).optional()}),$E=se({type:ye("tool_result"),toolUseId:w().describe("The unique identifier for the corresponding tool call."),content:te(wd),structuredContent:It().optional(),isError:Ne().optional(),_meta:Qe(w(),It()).optional()}),DE=aS("type",[yd,bd,Sd]),dc=aS("type",[yd,bd,Sd,gE,$E]),UE=se({role:Yo,content:ut([dc,te(dc)]),_meta:Qe(w(),It()).optional()}),qE=xc.extend({messages:te(UE),modelPreferences:LE.optional(),systemPrompt:w().optional(),includeContext:ct(["none","thisServer","allServers"]).optional(),temperature:Ue().optional(),maxTokens:Ue().int(),stopSequences:te(w()).optional(),metadata:yt.optional(),tools:te(Rg).optional(),toolChoice:NE.optional()}),zE=bt.extend({method:ye("sampling/createMessage"),params:qE}),FE=St.extend({model:w(),stopReason:ht(ct(["endTurn","stopSequence","maxTokens"]).or(w())),role:Yo,content:DE}),jE=St.extend({model:w(),stopReason:ht(ct(["endTurn","stopSequence","maxTokens","toolUse"]).or(w())),role:Yo,content:ut([dc,te(dc)])}),Pg=se({type:ye("boolean"),title:w().optional(),description:w().optional(),default:Ne().optional()}),Ed=se({type:ye("string"),title:w().optional(),description:w().optional(),minLength:Ue().optional(),maxLength:Ue().optional(),format:ct(["email","uri","date","date-time"]).optional(),default:w().optional()}),lu=se({type:ct(["number","integer"]),title:w().optional(),description:w().optional(),minimum:Ue().optional(),maximum:Ue().optional(),default:Ue().optional()}),xg=se({type:ye("string"),title:w().optional(),description:w().optional(),enum:te(w()),default:w().optional()}),Og=se({type:ye("string"),title:w().optional(),description:w().optional(),oneOf:te(se({const:w(),title:w()})),default:w().optional()}),Mg=se({type:ye("string"),title:w().optional(),description:w().optional(),enum:te(w()),enumNames:te(w()).optional(),default:w().optional()}),HE=ut([xg,Og]),Lg=se({type:ye("array"),title:w().optional(),description:w().optional(),minItems:Ue().optional(),maxItems:Ue().optional(),items:se({type:ye("string"),enum:te(w())}),default:te(w()).optional()}),Ng=se({type:ye("array"),title:w().optional(),description:w().optional(),minItems:Ue().optional(),maxItems:Ue().optional(),items:se({anyOf:te(se({const:w(),title:w()}))}),default:te(w()).optional()}),BE=ut([Lg,Ng]),VE=ut([Mg,HE,BE]),$g=ut([VE,Pg,Ed,lu]),Td=xc.extend({mode:ye("form").optional(),message:w(),requestedSchema:se({type:ye("object"),properties:Qe(w(),$g),required:te(w()).optional()}).catchall(It())}),GE=xc.extend({mode:ye("url"),message:w(),elicitationId:w(),url:w().url()}),WE=ut([Td,GE]),KE=bt.extend({method:ye("elicitation/create"),params:WE}),JE=fr.extend({elicitationId:w()}),YE=mr.extend({method:ye("notifications/elicitation/complete"),params:JE}),XE=St.extend({action:ct(["accept","decline","cancel"]),content:rS(e=>e===null?void 0:e,Qe(w(),ut([w(),Ue(),Ne(),te(w())])).optional())}),ZE=se({type:ye("ref/resource"),uri:w()}),QE=se({type:ye("ref/prompt"),name:w()}),eT=Kt.extend({ref:ut([QE,ZE]),argument:se({name:w(),value:w()}),context:se({arguments:Qe(w(),w()).optional()}).optional()}),tT=bt.extend({method:ye("completion/complete"),params:eT}),rT=St.extend({completion:_t({values:te(w()).max(100),total:ht(Ue().int()),hasMore:ht(Ne())})}),sT=se({uri:w().startsWith("file://"),name:w().optional(),_meta:Qe(w(),It()).optional()}),nT=bt.extend({method:ye("roots/list"),params:Kt.optional()}),iT=St.extend({roots:te(sT)}),oT=mr.extend({method:ye("notifications/roots/list_changed"),params:fr.optional()}),bq=_t({ttl:Ue().optional(),pollInterval:Ue().optional()}),aT=ct(["working","input_required","completed","failed","cancelled"]),Xo=se({taskId:w(),status:aT,ttl:ut([Ue(),nS()]),createdAt:w(),lastUpdatedAt:w(),pollInterval:ht(Ue()),statusMessage:ht(w())}),Sq=St.extend({task:Xo}),cT=fr.merge(Xo),wq=mr.extend({method:ye("notifications/tasks/status"),params:cT}),kq=bt.extend({method:ye("tasks/get"),params:Kt.extend({taskId:w()})}),Eq=St.merge(Xo),Tq=bt.extend({method:ye("tasks/result"),params:Kt.extend({taskId:w()})}),Aq=St.loose(),Iq=Ko.extend({method:ye("tasks/list")}),Rq=Jo.extend({tasks:te(Xo)}),Cq=bt.extend({method:ye("tasks/cancel"),params:Kt.extend({taskId:w()})}),Pq=St.merge(Xo),xq=ut([bg,Nk,Uk,tT,PE,mE,pE,Bk,Gk,Jk,Qk,tE,sE,IE,EE]),Oq=ut([_g,Sg,Dk,oT]),Mq=ut([vg,FE,jE,XE,iT]),Lq=ut([bg,zE,KE,nT]),Nq=ut([_g,Sg,OE,lE,Xk,RE,SE,iE,YE]),$q=ut([vg,$k,qk,rT,bE,hE,Vk,Wk,Yk,kd,TE,aE]),zt=cS().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:dP.custom,message:"URL must be parseable",fatal:!0}),nP}).refine(e=>{const t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Dq=_t({resource:w().url(),authorization_servers:te(zt).optional(),jwks_uri:w().url().optional(),scopes_supported:te(w()).optional(),bearer_methods_supported:te(w()).optional(),resource_signing_alg_values_supported:te(w()).optional(),resource_name:w().optional(),resource_documentation:w().optional(),resource_policy_uri:w().url().optional(),resource_tos_uri:w().url().optional(),tls_client_certificate_bound_access_tokens:Ne().optional(),authorization_details_types_supported:te(w()).optional(),dpop_signing_alg_values_supported:te(w()).optional(),dpop_bound_access_tokens_required:Ne().optional()}),lT=_t({issuer:w(),authorization_endpoint:zt,token_endpoint:zt,registration_endpoint:zt.optional(),scopes_supported:te(w()).optional(),response_types_supported:te(w()),response_modes_supported:te(w()).optional(),grant_types_supported:te(w()).optional(),token_endpoint_auth_methods_supported:te(w()).optional(),token_endpoint_auth_signing_alg_values_supported:te(w()).optional(),service_documentation:zt.optional(),revocation_endpoint:zt.optional(),revocation_endpoint_auth_methods_supported:te(w()).optional(),revocation_endpoint_auth_signing_alg_values_supported:te(w()).optional(),introspection_endpoint:w().optional(),introspection_endpoint_auth_methods_supported:te(w()).optional(),introspection_endpoint_auth_signing_alg_values_supported:te(w()).optional(),code_challenge_methods_supported:te(w()).optional(),client_id_metadata_document_supported:Ne().optional(),authorization_response_iss_parameter_supported:Ne().optional().catch(void 0),dpop_signing_alg_values_supported:te(w()).optional()}),uT=_t({issuer:w(),authorization_endpoint:zt,token_endpoint:zt,userinfo_endpoint:zt.optional(),jwks_uri:zt,registration_endpoint:zt.optional(),scopes_supported:te(w()).optional(),response_types_supported:te(w()),response_modes_supported:te(w()).optional(),grant_types_supported:te(w()).optional(),acr_values_supported:te(w()).optional(),subject_types_supported:te(w()),id_token_signing_alg_values_supported:te(w()),id_token_encryption_alg_values_supported:te(w()).optional(),id_token_encryption_enc_values_supported:te(w()).optional(),userinfo_signing_alg_values_supported:te(w()).optional(),userinfo_encryption_alg_values_supported:te(w()).optional(),userinfo_encryption_enc_values_supported:te(w()).optional(),request_object_signing_alg_values_supported:te(w()).optional(),request_object_encryption_alg_values_supported:te(w()).optional(),request_object_encryption_enc_values_supported:te(w()).optional(),token_endpoint_auth_methods_supported:te(w()).optional(),token_endpoint_auth_signing_alg_values_supported:te(w()).optional(),display_values_supported:te(w()).optional(),claim_types_supported:te(w()).optional(),claims_supported:te(w()).optional(),service_documentation:w().optional(),claims_locales_supported:te(w()).optional(),ui_locales_supported:te(w()).optional(),claims_parameter_supported:Ne().optional(),request_parameter_supported:Ne().optional(),request_uri_parameter_supported:Ne().optional(),require_request_uri_registration:Ne().optional(),op_policy_uri:zt.optional(),op_tos_uri:zt.optional(),client_id_metadata_document_supported:Ne().optional(),authorization_response_iss_parameter_supported:Ne().optional().catch(void 0)}),Uq=se({...uT.shape,...lT.pick({code_challenge_methods_supported:!0}).shape}),qq=se({access_token:w(),id_token:w().optional(),token_type:w(),expires_in:pP().optional(),scope:w().optional(),refresh_token:w().optional(),issuer:w().optional().catch(void 0)}).strip(),zq=se({issued_token_type:ye("urn:ietf:params:oauth:token-type:id-jag"),access_token:w(),token_type:w().optional(),expires_in:Ue().optional(),scope:w().optional()}).strip(),Fq=se({error:w(),error_description:w().optional(),error_uri:w().optional()}),my=zt.optional().or(ye("").transform(()=>{})),dT=se({redirect_uris:te(zt),token_endpoint_auth_method:w().optional(),grant_types:te(w()).optional(),response_types:te(w()).optional(),application_type:w().optional(),client_name:w().optional(),client_uri:zt.optional(),logo_uri:my,scope:w().optional(),contacts:te(w()).optional(),tos_uri:my,policy_uri:w().optional(),jwks_uri:zt.optional(),jwks:oP().optional(),software_id:w().optional(),software_version:w().optional(),software_statement:w().optional()}).strip(),pT=se({client_id:w(),client_secret:w().optional(),client_id_issued_at:Ue().optional(),client_secret_expires_at:Ue().optional(),issuer:w().optional().catch(void 0)}).strip(),jq=dT.merge(pT),Hq=se({error:w(),error_description:w().optional()}).strip(),Bq=se({token:w(),token_type_hint:w().optional()}).strip(),Xh=Symbol.for("mcp.sdk.errorBrands");function Zo(e,t){const r=new Set;let s=t;for(;typeof s=="function";){const n=s.mcpBrand;Object.prototype.hasOwnProperty.call(s,"mcpBrand")&&typeof n=="string"&&r.add(n),s=Object.getPrototypeOf(s)}r.size!==0&&Object.defineProperty(e,Xh,{value:r,enumerable:!1,configurable:!0})}function Ur(e,t){try{if(typeof t=="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand=="string"&&Object.prototype.hasOwnProperty.call(t,Xh)){const r=t[Xh];if(r&&typeof r.has=="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var J9=class hT extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return Ur(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Ur(this,t)}constructor(t,r,s){super(r),this.code=t,this.errorUri=s,this.name="OAuthError",Zo(this,new.target)}toResponseObject(){const t={error:this.code,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}static fromResponse(t){return new hT(t.error,t.error_description??t.error,t.error_uri)}},Vq=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return Ur(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Ur(this,e)}constructor(e,t,r,s){super(t,s),this.code=e,this.data=r,this.name="SdkError",Zo(this,new.target)}},Y9=class extends Vq{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r,s){super(e,t,r,s),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}},Gq={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Wq={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null};Object.keys(Gq);Object.keys(Wq);var tt=(function(e){return 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.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e})({}),Ss=class fT extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return Ur(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Ur(this,t)}constructor(t,r,s){super(r),this.code=t,this.data=s,this.name="ProtocolError",Zo(this,new.target)}static fromError(t,r,s){if(t===tt.UrlElicitationRequired&&s){const n=s;if(n.elicitations)return new Jq(n.elicitations,r)}if(t===tt.UnsupportedProtocolVersion&&s){const n=s;if(Array.isArray(n.supported)&&typeof n.requested=="string")return new Yq({supported:n.supported,requested:n.requested},r)}if(t===tt.InvalidParams||t===tt.ResourceNotFound){const n=s;if(typeof n?.uri=="string"&&(t===tt.ResourceNotFound||Object.keys(n).length===1))return new Kq(n.uri,r)}if(t===tt.MissingRequiredClientCapability&&s){const n=s;if(n.requiredCapabilities!==null&&typeof n.requiredCapabilities=="object"&&!Array.isArray(n.requiredCapabilities))return new Xq({requiredCapabilities:n.requiredCapabilities},r)}return new fT(t,r,s)}},Kq=class extends Ss{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(tt.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Jq=class extends Ss{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(tt.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Yq=class extends Ss{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(tt.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Xq=class extends Ss{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(tt.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Zq={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},Qq={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};Object.keys(Zq);Object.keys(Qq);var ez=aq({AnnotationsSchema:()=>xi,AudioContentSchema:()=>Sd,BaseMetadataSchema:()=>Ti,BaseRequestParamsSchema:()=>Kt,BlobResourceContentsSchema:()=>Tg,BooleanSchemaSchema:()=>Pg,CallToolRequestParamsSchema:()=>AE,CallToolRequestSchema:()=>IE,CallToolResultSchema:()=>kd,CancelTaskRequestSchema:()=>Cq,CancelTaskResultSchema:()=>Pq,CancelledNotificationParamsSchema:()=>Ck,CancelledNotificationSchema:()=>_g,ClientCapabilitiesSchema:()=>Mk,ClientNotificationSchema:()=>Oq,ClientRequestSchema:()=>xq,ClientResultSchema:()=>Mq,ClientTasksCapabilitySchema:()=>xk,CompatibilityCallToolResultSchema:()=>_q,CompleteRequestParamsSchema:()=>eT,CompleteRequestSchema:()=>tT,CompleteResultSchema:()=>rT,ContentBlockSchema:()=>wd,CreateMessageRequestParamsSchema:()=>qE,CreateMessageRequestSchema:()=>zE,CreateMessageResultSchema:()=>FE,CreateMessageResultWithToolsSchema:()=>jE,CreateTaskResultSchema:()=>Sq,CursorSchema:()=>pg,DiscoverRequestSchema:()=>Uk,DiscoverResultSchema:()=>qk,ElicitRequestFormParamsSchema:()=>Td,ElicitRequestParamsSchema:()=>WE,ElicitRequestSchema:()=>KE,ElicitRequestURLParamsSchema:()=>GE,ElicitResultSchema:()=>XE,ElicitationCompleteNotificationParamsSchema:()=>JE,ElicitationCompleteNotificationSchema:()=>YE,EmbeddedResourceSchema:()=>vE,EmptyResultSchema:()=>vg,EnumSchemaSchema:()=>VE,GetPromptRequestParamsSchema:()=>fE,GetPromptRequestSchema:()=>mE,GetPromptResultSchema:()=>bE,GetTaskPayloadRequestSchema:()=>Tq,GetTaskPayloadResultSchema:()=>Aq,GetTaskRequestSchema:()=>kq,GetTaskResultSchema:()=>Eq,IconSchema:()=>Pk,IconsSchema:()=>Wo,ImageContentSchema:()=>bd,ImplementationSchema:()=>vd,InitializeRequestParamsSchema:()=>Lk,InitializeRequestSchema:()=>Nk,InitializeResultSchema:()=>$k,InitializedNotificationSchema:()=>Dk,JSONArraySchema:()=>hq,JSONObjectSchema:()=>yt,JSONRPCErrorResponseSchema:()=>gg,JSONRPCMessageSchema:()=>fq,JSONRPCNotificationSchema:()=>Rk,JSONRPCRequestSchema:()=>Ik,JSONRPCResponseSchema:()=>mq,JSONRPCResultResponseSchema:()=>mg,JSONValueSchema:()=>xo,LegacyTitledEnumSchemaSchema:()=>Mg,ListChangedOptionsBaseSchema:()=>yq,ListPromptsRequestSchema:()=>pE,ListPromptsResultSchema:()=>hE,ListResourceTemplatesRequestSchema:()=>Gk,ListResourceTemplatesResultSchema:()=>Wk,ListResourcesRequestSchema:()=>Bk,ListResourcesResultSchema:()=>Vk,ListRootsRequestSchema:()=>nT,ListRootsResultSchema:()=>iT,ListTasksRequestSchema:()=>Iq,ListTasksResultSchema:()=>Rq,ListToolsRequestSchema:()=>EE,ListToolsResultSchema:()=>TE,LoggingLevelSchema:()=>Cg,LoggingMessageNotificationParamsSchema:()=>xE,LoggingMessageNotificationSchema:()=>OE,ModelHintSchema:()=>ME,ModelPreferencesSchema:()=>LE,MultiSelectEnumSchemaSchema:()=>BE,NotificationSchema:()=>mr,NotificationsParamsSchema:()=>fr,NumberSchemaSchema:()=>lu,PaginatedRequestParamsSchema:()=>jk,PaginatedRequestSchema:()=>Ko,PaginatedResultSchema:()=>Jo,PingRequestSchema:()=>bg,PrimitiveSchemaDefinitionSchema:()=>$g,ProgressNotificationParamsSchema:()=>Fk,ProgressNotificationSchema:()=>Sg,ProgressSchema:()=>zk,ProgressTokenSchema:()=>dg,PromptArgumentSchema:()=>uE,PromptListChangedNotificationSchema:()=>SE,PromptMessageSchema:()=>yE,PromptReferenceSchema:()=>QE,PromptSchema:()=>dE,ReadResourceRequestParamsSchema:()=>Kk,ReadResourceRequestSchema:()=>Jk,ReadResourceResultSchema:()=>Yk,RelatedTaskMetadataSchema:()=>Ak,RequestIdSchema:()=>Go,RequestMetaSchema:()=>hg,RequestSchema:()=>bt,ResourceContentsSchema:()=>wg,ResourceLinkSchema:()=>_E,ResourceListChangedNotificationSchema:()=>Xk,ResourceRequestParamsSchema:()=>_d,ResourceSchema:()=>Ag,ResourceTemplateReferenceSchema:()=>ZE,ResourceTemplateSchema:()=>Hk,ResourceUpdatedNotificationParamsSchema:()=>cE,ResourceUpdatedNotificationSchema:()=>lE,ResultMetaObjectSchema:()=>fg,ResultSchema:()=>St,RoleSchema:()=>Yo,RootSchema:()=>sT,RootsListChangedNotificationSchema:()=>oT,SamplingContentSchema:()=>DE,SamplingMessageContentBlockSchema:()=>dc,SamplingMessageSchema:()=>UE,ServerCapabilitiesSchema:()=>yg,ServerNotificationSchema:()=>Nq,ServerRequestSchema:()=>Lq,ServerResultSchema:()=>$q,ServerTasksCapabilitySchema:()=>Ok,SetLevelRequestParamsSchema:()=>CE,SetLevelRequestSchema:()=>PE,SingleSelectEnumSchemaSchema:()=>HE,StringSchemaSchema:()=>Ed,SubscribeRequestParamsSchema:()=>Zk,SubscribeRequestSchema:()=>Qk,SubscriptionFilterSchema:()=>Ig,SubscriptionsAcknowledgedNotificationParamsSchema:()=>nE,SubscriptionsAcknowledgedNotificationSchema:()=>iE,SubscriptionsListenRequestParamsSchema:()=>rE,SubscriptionsListenRequestSchema:()=>sE,SubscriptionsListenResultMetaSchema:()=>oE,SubscriptionsListenResultSchema:()=>aE,TaskAugmentedRequestParamsSchema:()=>xc,TaskCreationParamsSchema:()=>bq,TaskMetadataSchema:()=>Tk,TaskSchema:()=>Xo,TaskStatusNotificationParamsSchema:()=>cT,TaskStatusNotificationSchema:()=>wq,TaskStatusSchema:()=>aT,TextContentSchema:()=>yd,TextResourceContentsSchema:()=>kg,TitledMultiSelectEnumSchemaSchema:()=>Ng,TitledSingleSelectEnumSchemaSchema:()=>Og,ToolAnnotationsSchema:()=>wE,ToolChoiceSchema:()=>NE,ToolExecutionSchema:()=>kE,ToolListChangedNotificationSchema:()=>RE,ToolResultContentSchema:()=>$E,ToolSchema:()=>Rg,ToolUseContentSchema:()=>gE,UnsubscribeRequestParamsSchema:()=>eE,UnsubscribeRequestSchema:()=>tE,UntitledMultiSelectEnumSchemaSchema:()=>Lg,UntitledSingleSelectEnumSchemaSchema:()=>xg}),X9=e=>typeof e!="object"||e===null||e.content===void 0?!1:kd.safeParse(e).success;tt.InvalidRequest,tt.UnsupportedProtocolVersion,tt.InvalidParams,tt.MethodNotFound,tt.InvalidParams,tt.MissingRequiredClientCapability;tt.ParseError,tt.InvalidRequest,tt.MethodNotFound,tt.UnsupportedProtocolVersion,tt.MissingRequiredClientCapability;function mT(e,t){return VC(e,t)}function ua(e){return new Set(e.flatMap(t=>Object.keys(t.shape)))}function tz(e){if(e==null)return!1;const t=typeof e;return t!=="object"&&t!=="function"||!("~standard"in e)?!1:typeof e["~standard"]?.validate=="function"}var gy=!1,Zh="draft-2020-12";function rz(e,t="input"){const r=e["~standard"];let s;if(r.jsonSchema)s=r.jsonSchema[t]({target:Zh});else if(r.vendor==="zod"){if(!("_zod"in e))throw new Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");gy||(gy=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),s=sS(e,{target:Zh,io:t})}else throw new Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output")return s.type!==void 0?s:gT(s)?{type:"object",...s}:s;if(s.type!==void 0&&s.type!=="object")throw new Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(s.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...s}}function gT(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(const t of["oneOf","anyOf","allOf"]){const r=e[t];if(Array.isArray(r)&&r.length>0)return r.every(s=>s!==null&&typeof s=="object"&&(s.type==="object"||gT(s)))}return!1}function sz(e){const t=sS(e,{target:Zh,io:"input"});return typeof t.pattern=="string"?t.pattern:void 0}var nz=/\\\.\\d\{(\d+)\}/;function iz(e){const t=nz.exec(e),r=[void 0,-1,0];return t&&r.push(Number(t[1])),[!1,!0].flatMap(s=>[!1,!0].flatMap(n=>r.map(i=>uS({local:s,offset:n,precision:i}))))}function oz(e,t){let r;switch(e){case"email":r=[NC()];break;case"uri":r=[cS()];break;case"date":r=[WC()];break;case"date-time":r=iz(t)}return new Set(r.map(s=>sz(s)).filter(s=>s!==void 0))}function az(e,t,r){return r!=="zod"?!0:oz(e,t).has(t)}function pc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function cz(e){try{return rz(e,"input")}catch(t){const r=t instanceof Error?t.message:String(t);throw new Ss(tt.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var lz=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Dg(e){return lz.has(e)||e.startsWith("x-")}var uz=new Set(["$schema",...Object.keys(Td.shape.requestedSchema.shape)]),vy={string:ua([Ed,xg,Og,Mg]),number:ua([lu]),integer:ua([lu]),boolean:ua([Pg]),array:ua([Lg,Ng])},dz=new Set(Ed.shape.format.unwrap().options);function pz(e,t,r,s){if(!pc(e))return e;const n=typeof e.type=="string"&&Object.hasOwn(vy,e.type)?vy[e.type]:void 0;if(n===void 0)return e;const i={};for(const[o,a]of Object.entries(e))n.has(o)||Dg(o)?i[o]=a:o==="pattern"&&e.type==="string"&&typeof e.format=="string"?dz.has(e.format)?(typeof a!="string"||!az(e.format,a,r))&&s.push(`${t}.${o}`):i[o]=a:s.push(`${t}.${o}`);return i}function hz(e,t){const r={},s=[];for(const[n,i]of Object.entries(e))n==="properties"&&pc(i)?r[n]=Object.fromEntries(Object.entries(i).map(([o,a])=>[o,pz(a,`properties.${o}`,t,s)])):uz.has(n)?r[n]=i:Dg(n)||s.push(n);if(s.length>0)throw new Ss(tt.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${s.join(", ")}`);return r}function fz(e,t){if(!pc(e.properties))return t;const r=Object.entries(e.properties).filter(([,s])=>!mT($g,s).success).map(([s])=>`properties.${s}`);return r.length>0?r.join(", "):t}function Qh(e,t,r=""){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((s,n)=>Qh(s,t[n],`${r}[${n}]`)):!pc(e)||!pc(t)?[]:Object.entries(e).flatMap(([s,n])=>{const i=r?`${r}.${s}`:s;return Object.prototype.hasOwnProperty.call(t,s)?Qh(n,t[s],i):Dg(s)?[]:[i]})}function mz(e){if(!tz(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};const t=e.requestedSchema["~standard"].vendor,r=hz(cz(e.requestedSchema),t),s=mT(Td.shape.requestedSchema,r);if(!s.success)throw new Ss(tt.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${fz(r,s.error.message)}`);const n=Qh(r,s.data);if(n.length>0)throw new Ss(tt.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);const i=(s.data.required??[]).filter(o=>!Object.prototype.hasOwnProperty.call(s.data.properties,o));if(i.length>0)throw new Ss(tt.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${i.join(", ")}`);return{...e,mode:"form",requestedSchema:s.data}}function gz(e){const t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState=="string";if(!t&&!r)throw new TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(gz,{elicit(e){try{return{method:"elicitation/create",params:mz(e)}}catch(t){throw t instanceof Ss?new TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var vz=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],_z={IdJagTokenExchangeResponseSchema:zq,OAuthClientInformationFullSchema:jq,OAuthClientInformationSchema:pT,OAuthClientMetadataSchema:dT,OAuthClientRegistrationErrorSchema:Hq,OAuthErrorResponseSchema:Fq,OAuthMetadataSchema:lT,OAuthProtectedResourceMetadataSchema:Dq,OAuthTokenRevocationRequestSchema:Bq,OAuthTokensSchema:qq,OpenIdProviderDiscoveryMetadataSchema:Uq,OpenIdProviderMetadataSchema:uT},vT={},_T={};function yT(e,t){const r=e.slice(0,-6);vT[r]=t,_T[r]=s=>t.safeParse(s).success}for(const e of vz)yT(e,ez[e]);for(const[e,t]of Object.entries(_z))yT(e,t);var di=Object.freeze(vT),Z9=Object.freeze(_T);function yz(e){return()=>e}var Q9=yz(void 0),e7=lq(oq((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,s=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=n;function n(a){if(!a)throw new TypeError("argument string is required");var c=typeof a=="object"?i(a):a;if(typeof c!="string")throw new TypeError("argument string is required to be a string");var l=c.indexOf(";"),u=l!==-1?c.slice(0,l).trim():c.trim();if(!s.test(u))throw new TypeError("invalid media type");var p=new o(u.toLowerCase());if(l!==-1){var d,h,f;for(t.lastIndex=l;h=t.exec(c);){if(h.index!==l)throw new TypeError("invalid parameter format");l+=h[0].length,d=h[1].toLowerCase(),f=h[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf("\\")!==-1&&(f=f.replace(r,"$1"))),p.parameters[d]=f}if(l!==c.length)throw new TypeError("invalid parameter format")}return p}function i(a){var c;if(typeof a.getHeader=="function"?c=a.getHeader("content-type"):typeof a.headers=="object"&&(c=a.headers&&a.headers["content-type"]),typeof c!="string")throw new TypeError("content-type header is missing from object");return c}function o(a){this.parameters=Object.create(null),this.type=a}}))(),1),t7=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker"),bz=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Sz=[0,31,28,31,30,31,30,31,31,30,31,30,31],wz=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,kz=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,Ez=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Tz=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Az=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,Iz=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Rz=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Cz=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Pz=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,xz=e=>{if(e[0]==='"')return!1;const[t,r,...s]=e.split("@");return!t||!r||s.length!==0||t.length>64||r.length>253||t[0]==="."||t.endsWith(".")||t.includes("..")||!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:r.split(".").every(n=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(n))},Oz=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Mz=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,Lz=e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function rs(e){return e.test.bind(e)}var r7={date:bT,time:ST.bind(void 0,!1),"date-time":Dz,duration:Lz,uri:zz,"uri-reference":rs(Ez),"uri-template":rs(Tz),url:rs(Az),email:xz,hostname:rs(kz),ipv4:rs(Oz),ipv6:rs(Mz),regex:jz,uuid:rs(Iz),"json-pointer":rs(Rz),"json-pointer-uri-fragment":rs(Cz),"relative-json-pointer":rs(Pz)};function Nz(e){return e%4===0&&(e%100!==0||e%400===0)}function bT(e){const t=e.match(bz);if(!t)return!1;const r=+t[1],s=+t[2],n=+t[3];return s>=1&&s<=12&&n>=1&&n<=(s==2&&Nz(r)?29:Sz[s])}function ST(e,t){const r=t.match(wz);if(!r)return!1;const s=+r[1],n=+r[2],i=+r[3],o=!!r[5];return(s<=23&&n<=59&&i<=59||s==23&&n==59&&i==60)&&(!e||o)}var $z=/t|\s/i;function Dz(e){const t=e.split($z);return t.length==2&&bT(t[0])&&ST(!0,t[1])}var Uz=/\/|:/,qz=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function zz(e){return Uz.test(e)&&qz.test(e)}var Fz=/[^\\]\\Z/;function jz(e){if(Fz.test(e))return!1;try{return new RegExp(e,"u"),!0}catch{return!1}}var Oc=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return Ur(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Ur(this,e)}constructor(e){super(e),this.name=new.target.name,Zo(this,new.target)}},s7=class extends Oc{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(e,t,r){super(`Issuer mismatch in ${e==="metadata"?"authorization server metadata (RFC 8414 §3.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(t)}, received ${JSON.stringify(r)}`),this.kind=e,this.expected=t,this.received=r}},n7=class extends Oc{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`),this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},i7=class extends Oc{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / *.localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},o7=class extends Oc{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`),this.recordedIssuer=e,this.currentIssuer=t}},a7=class extends Oc{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:""}`),this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}},c7=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return Ur(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Ur(this,e)}constructor(e){super(e??"Unauthorized"),this.name="UnauthorizedError",Zo(this,new.target)}},l7=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return Ur(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Ur(this,e)}constructor(e,t,r){super(`SSE error: ${t}`),this.code=e,this.event=r,Zo(this,new.target)}};function Hz(e,t){const r=e["~standard"].validate(t);if(r instanceof Promise)return{ok:!1,detail:"schema validated asynchronously"};const s=r.issues;if(!s||s.length===0)return{ok:!0};const n=s[0],i=n?.path?.length?` at ${n.path.map(o=>typeof o=="object"&&o!==null&&"key"in o?String(o.key):String(o)).join(".")}`:"";return{ok:!1,detail:`${n?.message??"invalid"}${i}`}}var Bz={"elicitation/create":di.ElicitRequest,"roots/list":di.ListRootsRequest,"sampling/createMessage":di.CreateMessageRequest},Vz=se({mode:ye("url"),message:w(),url:w().url(),elicitationId:w().optional()});function u7(e,t){if(e==="elicitation/create"&&typeof t=="object"&&t!==null&&"mode"in t&&t.mode==="url"){const r=Vz.safeParse(t);return r.success?{ok:!0}:{ok:!1,detail:r.error.issues[0]?.message??"invalid URL request"}}return Hz(Bz[e],{method:e,params:t})}var d7={"elicitation/create":[di.ElicitResult],"roots/list":[di.ListRootsResult],"sampling/createMessage":[di.CreateMessageResult,di.CreateMessageResultWithTools]},wT={"tasks-wire-resolvable":{id:"tasks-wire-resolvable",category:"dispatch",title:"Tasks Wire Resolvable",description:"The negotiated protocol version and advertised capabilities resolve to exactly one tasks wire."},"tasks-declaration-hygiene":{id:"tasks-declaration-hygiene",category:"dispatch",title:"Per-Version Declaration Hygiene",description:"Outgoing requests carry `params.task` only on the legacy wire and the tasks extension declaration only on the extension wire; a connection with no tasks wire sends neither."},"tasks-result-type-discipline":{id:"tasks-result-type-discipline",category:"creation",title:"Result Type Discipline",description:'A task-eligible tools/call returns either a normal tool result or a flat CreateTaskResult with resultType "task" and a server-generated taskId.'},"tasks-undeclared-creation-refused":{id:"tasks-undeclared-creation-refused",category:"creation",title:"Undeclared Task Creation Refused",description:"On the extension wire, a tools/call that did not carry the extension declaration must not come back as a CreateTaskResult: the server either answers normally or rejects with -32021."},"tasks-undeclared-capability-rejected":{id:"tasks-undeclared-capability-rejected",category:"lifecycle",title:"Undeclared Capability Rejected",description:"tasks/get, tasks/update, tasks/cancel and a task-filtered subscriptions/listen sent WITHOUT the extension declaration must each be rejected with -32021 (Missing Required Client Capability)."},"tasks-ttl-shape":{id:"tasks-ttl-shape",category:"lifecycle",title:"TTL And Poll Interval Shapes",description:"Task TTL and poll interval use the era-native shapes: `ttlMs: number|null` / `pollIntervalMs` on the extension, `ttl` / `pollInterval` on the legacy wire."},"tasks-inline-result":{id:"tasks-inline-result",category:"lifecycle",title:"Completed Task Carries Its Result",description:"A completed task exposes its result the era-native way: inline on the extension's tasks/get, via tasks/result on the legacy wire."},"tasks-mcp-name-routing":{id:"tasks-mcp-name-routing",category:"lifecycle",title:"Mcp-Name Task Routing",description:"Over HTTP, tasks/get is sent with Mcp-Name set to the task id (captured off the fetch seam) and accepted by the server."},"tasks-invalid-task-id-rejected":{id:"tasks-invalid-task-id-rejected",category:"lifecycle",title:"Invalid Task Id Rejected",description:"tasks/get for a task id the server never issued is rejected with -32602 (Invalid params); the same rejection on tasks/update and tasks/cancel is a SHOULD and is reported as advice."},"tasks-status-payload-shape":{id:"tasks-status-payload-shape",category:"lifecycle",title:"Status Payload Shape",description:"Each observed task status carries the payload its status requires: `result` on completed, `error` on failed, `inputRequests` on input_required."},"tasks-cancel-ack-shape":{id:"tasks-cancel-ack-shape",category:"lifecycle",title:"Cancel Acknowledged With An Empty Result",description:"tasks/cancel is acknowledged with an empty result rather than a task state, and the task's observable status is allowed to remain non-terminal afterwards."},"tasks-update-ack-shape":{id:"tasks-update-ack-shape",category:"lifecycle",title:"Update Acknowledged With An Empty Result",description:`tasks/update answering a task's input_required is acknowledged with an empty result carrying resultType "complete"; the task is not required to reach a terminal status afterwards.`},"tasks-ttl-integer-shape":{id:"tasks-ttl-integer-shape",category:"lifecycle",title:"TTL And Poll Interval Are Integers",description:"ttlMs and pollIntervalMs are integer milliseconds, as the extension's Task interface states."},"tasks-undeclared-capability-names-requirements":{id:"tasks-undeclared-capability-names-requirements",category:"lifecycle",title:"Undeclared Capability Error Names What Is Missing",description:"A -32021 rejection carries error.data.requiredCapabilities naming the capability the client failed to declare."}};function kT(e){return Object.fromEntries(pD.map(t=>{const r=e.filter(s=>s.category===t);return[t,{total:r.length,passed:r.filter(s=>s.status==="passed").length,failed:r.filter(s=>s.status==="failed").length,skipped:r.filter(s=>s.status==="skipped").length,couldNotRun:r.filter(Bu).length}]}))}function p7(e,t,r,s){const n=e.map(i=>({...wT[i],status:"skipped",skipReason:"could-not-run",durationMs:0,error:{message:t},...s&&mD(i)?{details:{toolName:s}}:{}}));return{passed:!1,outcome:"incomplete",target:r,checks:n,summary:_S(n),durationMs:0,categorySummary:kT(n),discovery:{wire:"none",toolCount:0,taskCapableToolCount:0,...s?{probedTool:s}:{}}}}function h7(e,t=hD,r){const s=[...new Set(t)].map(b=>{const T=e.flatMap(x=>x.checks.filter(D=>D.id===b));if(!T.length)return{...wT[b],status:"skipped",skipReason:"could-not-run",durationMs:0,error:{message:"The selected check produced no result."}};const O=T.find(x=>x.status==="failed")??T.find(x=>x.skipReason==="could-not-run")??T.find(x=>x.status==="passed")??T[0];return b!=="tasks-declaration-hygiene"?O:{...O,durationMs:T.reduce((x,D)=>x+D.durationMs,0),details:{...O.details,inspectedRequests:T.reduce((x,D)=>x+Number(D.details?.inspectedRequests??0),0)}}}),n=bD("mcp-tasks"),{scored:i,pending:o}=ak(s,n),a=i.length===0&&o.length>0?{outcome:"incomplete",incompleteReason:`all ${o.length} selected check(s) ran but are unscored by profile ${n.id}@${n.version}, so this run establishes no conformance verdict`}:vS(i),c=e.flatMap(b=>b.readiness??[]).filter((b,T,O)=>O.findIndex(x=>x.id===b.id)===T),l=e.flatMap(b=>b.uncheckedAdvice??[]).filter((b,T,O)=>!c.some(x=>x.id===b.id)&&O.findIndex(x=>x.id===b.id)===T),u=e.flatMap(b=>b.passedAdvice??[]).filter((b,T,O)=>!c.some(x=>x.id===b.id)&&!l.some(x=>x.id===b.id)&&O.findIndex(x=>x.id===b.id)===T),p=e.find(b=>b.discovery.protocolVersion)??e[0],d=p?.discovery??{wire:"none",toolCount:0,taskCapableToolCount:0},h=new Set(e.map(b=>b.discovery.probedTool).filter(Boolean)),f=new Set(e.map(b=>b.discovery.createdTaskId).filter(Boolean)),{probedTool:m,createdTaskId:v,..._}=d;return{...a,passed:a.outcome==="passed",target:p?.target??"",checks:s,summary:_S(i)+(o.length?`, ${o.length} pending (unscored by profile ${n.id}@${n.version})`:""),durationMs:r??e.reduce((b,T)=>b+T.durationMs,0),categorySummary:kT(s),profile:kD({profile:n,checks:s,...d.protocolVersion?{protocolVersion:d.protocolVersion}:{}}),discovery:{..._,toolCount:Math.max(0,...e.map(b=>b.discovery.toolCount)),taskCapableToolCount:Math.max(0,...e.map(b=>b.discovery.taskCapableToolCount)),...h.size===1?{probedTool:[...h][0]}:{},...f.size===1?{createdTaskId:[...f][0]}:{}},...c.length?{readiness:c}:{},...l.length?{uncheckedAdvice:l}:{},...u.length?{passedAdvice:u}:{}}}var ET=["server-info","base-protocol","server-features","server-utilities","client-features","authorization","extensions","third-party"],Gz=["server-information","lifecycle-discovery","transports","transport-behavior","mrtr","subscriptions","tools-discovery","tool-annotations-schemas","tool-results","resources","resource-templates","prompts","completion","pagination-caching","request-control","client-features","core-authorization","authorization-extensions","mcp-apps","tasks","skills","events","server-cards","third-party-experimental"],f7=["serverInfo","capabilities","instructions","tools","toolMeta","toolSchemas","resources","resourceTemplates","prompts","skills","listHints"],m7=["http-transport","authorization","server-card","apps-ui-resources","skills","events-list"],Wz=["check-failed","supported","needs-newer","could-add","not-checked","not-applicable"],Kz={"server-info":"Server info","base-protocol":"Base Protocol","server-features":"Server Features","server-utilities":"Server Utilities","client-features":"Client Features",authorization:"Authorization",extensions:"Extensions","third-party":"Third-party and experimental"},ef={"server-information":{card:"server-info",name:"Server information",summary:"Name, version, title, icons and instructions the server reports."},"lifecycle-discovery":{card:"base-protocol",name:"Lifecycle and Discovery",summary:"How client and server agree on a protocol version and exchange capabilities."},transports:{card:"base-protocol",name:"Transports",summary:"How messages travel: stdio, Streamable HTTP or the older HTTP+SSE."},"transport-behavior":{card:"base-protocol",name:"Transport behavior",summary:"Sessions, headers, streams and response modes on the HTTP transport."},mrtr:{card:"base-protocol",name:"Multi Round-Trip Requests",summary:"Requests that pause with input_required so the client can ask the user."},subscriptions:{card:"base-protocol",name:"Subscriptions",summary:"Change notifications for lists and resources."},"tools-discovery":{card:"server-features",name:"Tools",summary:"Listing tools and describing them to clients and models."},"tool-annotations-schemas":{card:"server-features",name:"Tool annotations and schemas",summary:"Behavior hints and the input and output schemas of each tool."},"tool-results":{card:"server-features",name:"Tool results and content",summary:"Content types, structured content and errors in tool results."},resources:{card:"server-features",name:"Resources",summary:"Data the server exposes for clients to read."},"resource-templates":{card:"server-features",name:"Resource templates and changes",summary:"Parameterized resource URIs and resource change notifications."},prompts:{card:"server-features",name:"Prompts",summary:"Reusable prompt templates users can pick."},completion:{card:"server-utilities",name:"Completion",summary:"Argument suggestions for prompts and resource templates."},"pagination-caching":{card:"server-utilities",name:"Pagination and caching",summary:"Cursors for long lists and cache hints on results."},"request-control":{card:"server-utilities",name:"Progress, cancellation and logging",summary:"Progress updates, cancellation, ping and log messages."},"client-features":{card:"client-features",name:"Roots, sampling and elicitation",summary:"Requests a server makes back to the client."},"core-authorization":{card:"authorization",name:"Authorization",summary:"OAuth for HTTP servers: metadata, registration, tokens."},"authorization-extensions":{card:"authorization",name:"Authorization extensions",summary:"OAuth Client Credentials and Enterprise-Managed Authorization (XAA)."},"mcp-apps":{card:"extensions",name:"MCP Apps",summary:"Interactive HTML views that tools render inside the host."},tasks:{card:"extensions",name:"Tasks",summary:"Long-running requests the client polls or cancels."},skills:{card:"extensions",name:"Skills",summary:"Agent skills served as MCP resources."},events:{card:"extensions",name:"Events",summary:"Event streams and webhooks a client can subscribe to."},"server-cards":{card:"extensions",name:"Server Cards",summary:"A published card that describes the server before connecting."},"third-party-experimental":{card:"third-party",name:"Third-party and experimental",summary:"OpenAI extensions, Apps SDK metadata, experimental proposals and unrecognized capabilities."}},Jz=Object.keys(ef).map(e=>({id:e,...ef[e]}));function Yz(e){return{id:e,...ef[e]}}function g7(e){return Jz.filter(t=>t.card===e)}var v7=ET.map(e=>({id:e,name:Kz[e]})),Xz=new Set(["2026-07-28"]),Zz=new Set(["2024-10-07","2024-11-05","2025-03-26","2025-06-18","2025-11-25"]);function ks(e){return e?Xz.has(e)?"modern":Zz.has(e)?"legacy":"unknown":"unknown"}function _7(e){return e==="stdio"||e==="sse"?e:e==="streamable-http"||e==="http"?"streamable-http":"unknown"}function Qz(e){if(!(!e||e.length===0))return[...new Set(e)].sort()}function eF(e){const t=e.era??ks(e.protocolVersion),r=Qz(e.clientExtensions),s={transport:e.transport,era:t};return e.protocolVersion&&(s.protocolVersion=e.protocolVersion),e.clientCapabilitiesHash&&(s.clientCapabilitiesHash=e.clientCapabilitiesHash),r&&(s.clientExtensions=r),e.hostProfile&&(s.hostProfile=e.hostProfile),e.environmentId&&(s.environmentId=e.environmentId),e.accountBinding&&(s.accountBinding=e.accountBinding),e.configRevision&&(s.configRevision=e.configRevision),s}function tf(e){if(Array.isArray(e))return`[${e.map(t=>tf(t)).join(",")}]`;if(e&&typeof e=="object"){const t=e;return`{${Object.keys(t).filter(r=>t[r]!==void 0).sort().map(r=>`${JSON.stringify(r)}:${tf(t[r])}`).join(",")}}`}return JSON.stringify(e??null)}function _y(e,t){let r=t>>>0;for(let s=0;s<e.length;s+=1)r^=e.charCodeAt(s),r=Math.imul(r,16777619);return(r>>>0).toString(16).padStart(8,"0")}function tF(e){const t=tf(e);return`${_y(t,2166136261)}${_y(t,16777619)}`}function rF(e){return`ctx_${tF(eF(e))}`}var Ug="2026-11-16",qg={core:"modelcontextprotocol@5ea99602","ext-apps":"ext-apps@ea3e9d0e","ext-tasks":"ext-tasks@cc9aaac","ext-skills":"ext-skills@649f7aee8","ext-events":"ext-events@47d95c979","ext-auth":"ext-auth@15ca394e0","ext-server-card":"ext-server-card@526201bbc","openai-mcp-extensions":"openai/mcp-extensions@39f91ad","openai-apps-sdk":"openai-apps-sdk-docs@2026-11-16",experimental:"modelcontextprotocol@5ea99602"},TT="https://modelcontextprotocol.io";function N(e,t,r){return{url:`${TT}/specification/${e}/${t}${r?`#${r}`:""}`,source:"core",pin:qg.core,checkedAt:Ug}}function sF(e,t,r){return{url:`${TT}/extensions/${t}${r?`#${r}`:""}`,source:e,pin:qg[e],checkedAt:Ug}}function Na(e,t){return{url:t,source:e,pin:qg[e],checkedAt:Ug}}function Re(e,t={}){return{kind:"present",via:e,...t}}function nr(e,t){return t?{kind:"absent",basis:e,detail:t}:{kind:"absent",basis:e}}function Et(e){return{kind:"unknown",reason:e}}function yr(e){return{kind:"not-applicable",reason:e}}function Z(e){return{...e}}function Dt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function lr(e){return typeof e=="string"&&e.trim().length>0}function Ad(e){return Dt(e)&&Object.keys(e).length>0}function Oo(e,t=4){const r=e.slice(0,t).join(", "),s=e.length-t;return s>0?`${r} and ${s} more`:r}function Mc(e,t){return t.every(r=>e.coverage[r]==="complete")}function Lc(e,t,r){return Mc(e,t)?yr(r):nr(t)}function gi(e){return ks(e.protocolVersion)}function Id(e,t){return e.capabilities?.[t]}function Nc(e){return t=>Dt(Id(t,e))?Re("advertised"):nr(["capabilities"])}function Rd(e,t,r){return s=>{const n=Id(s,e);return Dt(n)?n[t]===!0?Et(`Declared. MCPJam has not seen ${r} yet.`):nr(["capabilities"]):Lc(s,["capabilities"],`The server does not declare the ${e} capability.`)}}var zg={tools:"tools",resources:"resources",resourceTemplates:"resource templates",prompts:"prompts"};function Fg(e,t){return Lc(e,[t],`The server lists no ${zg[t]}.`)}var AT="Saved before MCPJam stored this field. Reconnect to capture it.";function jg(e,t){return r=>{const s=r[e];return s.length>0?Re("detected",{count:s.length,detail:`${s.length} ${zg[e]}`}):Dt(Id(r,t))?Mc(r,[e])?Re("advertised",{count:0,detail:"The list is empty."}):nr([e]):nr(["capabilities",e])}}function rr(e,t,r,s={}){return n=>{const i=n[e];if(i.length===0)return Fg(n,e);if(s.droppedByOldSnapshots&&n.envelopeVersion<3)return Et(AT);const o=i.filter(t).length;return o===0?nr(r):Re("detected",{count:o,detail:`${o} of ${i.length} ${zg[e]}`})}}function da(e,t={}){return r=>{if(t.droppedByOldSnapshots&&r.envelopeVersion<3)return Et(AT);const s=r.serverInfo;return Dt(s)&&e(s)?Re("advertised"):nr(["serverInfo"])}}function rf(e,t){const r=e.annotations;return Dt(r)?r[t]:void 0}var nF=32;function uu(e,t,r=0){return r>nF?!1:Array.isArray(e)?e.some(s=>uu(s,t,r+1)):Dt(e)?t(e)?!0:Object.values(e).some(s=>uu(s,t,r+1)):!1}function iF(e,t){const r=[];return uu(e,s=>{const n=s[t];return typeof n=="string"&&r.push(n),!1}),r}function IT(e){return[e.inputSchema,e.outputSchema]}var RT="Applies to HTTP servers. This server runs over stdio.",Mt=e=>e.transport==="stdio"?yr(RT):null,oF={"http-transport":RT,authorization:"This server does not use OAuth.","server-card":"Server Cards apply to HTTP servers.","apps-ui-resources":"The server has no UI resources to read.",skills:"The server does not offer skills.","events-list":"The server does not offer events."},aF={"http-transport":"HTTP transport",authorization:"authorization","server-card":"Server Card","apps-ui-resources":"UI resource",skills:"skills","events-list":"events"};function Js(e,t){return r=>{const s=r[e];return s?s.status==="not-applicable"?yr(oF[e]):s.status!=="ok"?Et(`The ${aF[e]} probe did not finish. Refresh to try again.`):t(s):null}}function xr(e,t){return e.coverage==="complete"?nr([],t):Et("The probe could not read everything it needed.")}function Nt(e){return typeof e=="boolean"?e:void 0}function vi(e){return typeof e=="string"&&e.length>0?e:void 0}function sf(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function dl(e){if(!(typeof e!="object"||e===null))return e.filter(t=>typeof t=="string")}function hn(e){return Js("authorization",t=>{const r=Nt(t.values.oauthRequired),s=Nt(t.values.oauthOptional);return r===!1&&s!==!0?yr("This server accepts requests without authorization."):e?e(t):null})}var We=e=>e.transport==="stdio"?yr("Stdio servers take credentials from their environment, not OAuth."):null;function pl(e){return hn(t=>Nt(t.values.asMetadataFound)===!0?e(t):null)}var Bn="basic/authorization",Fi="basic/authorization/authorization-server-discovery",pa="basic/authorization/client-registration",yy="basic/authorization/security-considerations",cF="protected-resource-metadata-discovery-requirements",ha=Z({introduced:"2026-07-28"}),ss=hn(),lF=[{id:"auth.oauth",family:"core-authorization",name:"Authorization for HTTP servers",summary:"HTTP servers protect requests with OAuth. Stdio servers take credentials from their environment instead.",howTo:"Return 401 with a WWW-Authenticate challenge for requests without a valid token, and publish protected resource metadata.",owner:"server",spec:N("2026-07-28",Bn,"protocol-requirements"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:{primary:"probed",declared:We,probed:hn(e=>Nt(e.values.oauthRequired)===!0?Re("probed",{detail:"Requires OAuth."}):Nt(e.values.oauthOptional)===!0?Re("probed",{detail:"Accepts OAuth when offered."}):null),oauthFlow:()=>Re("oauth-flow")}},{id:"auth.resource-metadata-challenge",family:"core-authorization",parent:"auth.oauth",name:"401 challenge with resource_metadata",summary:"The 401 response's WWW-Authenticate header points clients at the protected resource metadata.",howTo:"Add resource_metadata with an absolute URL to the Bearer challenge on every 401.",owner:"server",spec:N("2026-07-28",Fi,cF),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:{primary:"probed",declared:We,probed:hn(e=>{if(sf(e.values.nonCompliantChallengeStatus)!==void 0)return Et("The server sent its challenge with the wrong status code.");const t=Nt(e.values.challengeHasResourceMetadata);return t===!0?Re("probed"):t===!1?xr(e):null})}},{id:"auth.prm",family:"core-authorization",parent:"auth.oauth",name:"Protected resource metadata (RFC 9728)",summary:"A metadata document that names the server's authorization servers and the scopes it supports.",howTo:"Serve protected resource metadata with resource, authorization_servers and scopes_supported.",owner:"server",spec:N("2026-07-28",Fi,"authorization-server-location"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!1,assessment:{primary:"probed",declared:We,probed:hn(e=>{const t=Nt(e.values.prmFound);if(t===!0){const r=dl(e.values.prmAuthorizationServers)??[];return Re("probed",{count:r.length})}return t===!1?xr(e):null})}},{id:"auth.prm-well-known",family:"core-authorization",parent:"auth.oauth",name:"Metadata at the well-known path",summary:"Clients find the metadata at /.well-known/oauth-protected-resource, path first and then root, when the challenge does not name it.",howTo:"Serve the metadata at /.well-known/oauth-protected-resource plus your MCP path, and at the root as a fallback.",owner:"server",spec:N("2026-07-28",Fi,"authorization-server-location"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"probed",declared:We,probed:hn(e=>{const t=Nt(e.values.prmFound);return t===!1?xr(e):t!==!0?null:Nt(e.values.challengeHasResourceMetadata)===!0?Et("The challenge named the metadata URL, so the well-known path was not needed."):Re("probed",{detail:"Found at the well-known path."})})}},{id:"auth.multiple-authorization-servers",family:"core-authorization",parent:"auth.oauth",name:"Multiple authorization servers",summary:"The metadata lists more than one authorization server, and the client picks one.",howTo:"List every authorization server that issues tokens for this server in authorization_servers.",owner:"server",spec:N("2026-07-28",Fi,"authorization-server-location"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:{primary:"probed",declared:We,probed:hn(e=>{if(Nt(e.values.prmFound)!==!0)return null;const t=dl(e.values.prmAuthorizationServers)??[];return t.length>1?Re("advertised",{count:t.length}):t.length===1?yr("The server names one authorization server."):null})}},{id:"auth.as-metadata",family:"core-authorization",parent:"auth.oauth",name:"Authorization server metadata",summary:"OAuth (RFC 8414) or OpenID Connect discovery metadata that lists the authorization server's endpoints.",howTo:"Publish /.well-known/oauth-authorization-server or /.well-known/openid-configuration on your authorization server.",owner:"authorization-server",spec:N("2026-07-28",Fi,"authorization-server-metadata-discovery"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!1,assessment:{primary:"probed",declared:We,probed:hn(e=>{const t=Nt(e.values.asMetadataFound);if(t===!0){const r=vi(e.values.asMetadataKind);return Re("probed",{detail:r==="oidc"?"OpenID Connect discovery.":"OAuth metadata."})}return t===!1?xr(e):null})}},{id:"auth.fallback-endpoints",family:"core-authorization",parent:"auth.oauth",name:"Default endpoints without metadata",summary:"On 2025-03-26, clients fall back to /authorize, /token and /register when there is no metadata.",howTo:"Publish authorization server metadata instead. Later revisions removed the fallback.",owner:"server",spec:N("2025-03-26",Bn),stage:"stable",lifecycle:Z({introduced:"2025-03-26",removed:"2025-06-18"}),optional:!0,assessment:{primary:"probed",declared:We,probed:ss}},{id:"auth.issuer-validation",family:"core-authorization",parent:"auth.oauth",name:"Issuer matches the metadata",summary:"The metadata's issuer equals the authorization server URL the resource metadata names, so clients accept it.",howTo:"Set issuer in your authorization server metadata to exactly the URL listed in authorization_servers.",owner:"authorization-server",spec:N("2026-07-28",Fi,"authorization-server-metadata-discovery"),stage:"stable",lifecycle:ha,optional:!1,assessment:{primary:"probed",declared:We,probed:pl(e=>{const t=vi(e.values.issuer),r=dl(e.values.prmAuthorizationServers);return!t||!r||r.length===0?null:r.includes(t)?Re("probed"):xr(e,"The issuer differs from the listed authorization server.")})}},{id:"auth.pkce",family:"core-authorization",parent:"auth.oauth",name:"PKCE (S256)",summary:"The authorization server advertises S256 code challenges, which protect the code exchange.",howTo:"Support PKCE with S256 and list it in code_challenge_methods_supported.",owner:"authorization-server",spec:N("2026-07-28",yy,"authorization-code-protection"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!1,assessment:{primary:"probed",declared:We,probed:pl(e=>(dl(e.values.codeChallengeMethods)??[]).includes("S256")?Re("advertised"):xr(e))}},{id:"auth.cimd",family:"core-authorization",parent:"auth.oauth",name:"Client ID Metadata Documents",summary:"Clients use an HTTPS URL that describes them as their client_id, with no registration step.",howTo:"Accept URL client_ids and set client_id_metadata_document_supported to true in your metadata.",owner:"authorization-server",spec:N("2026-07-28",pa,"advertising-cimd-support"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"probed",declared:We,probed:pl(e=>Nt(e.values.cimdSupported)===!0?Re("advertised"):xr(e))}},{id:"auth.dcr",family:"core-authorization",parent:"auth.oauth",name:"Dynamic Client Registration",summary:"Clients register themselves at a registration endpoint before signing in.",howTo:"Prefer Client ID Metadata Documents. If you keep registration, list registration_endpoint in your metadata.",owner:"authorization-server",spec:N("2026-07-28",pa,"dynamic-client-registration"),stage:"stable",lifecycle:Z({introduced:"2025-03-26",deprecated:"2026-07-28"}),optional:!0,assessment:{primary:"probed",declared:We,probed:pl(e=>Nt(e.values.registrationEndpoint)===!0?Re("advertised"):xr(e))}},{id:"auth.dcr-application-type",family:"core-authorization",parent:"auth.oauth",name:"Registration redirect URI rules",summary:"Registration checks application_type and accepts only localhost or HTTPS redirect URIs.",howTo:"Reject registrations whose redirect URIs are plain HTTP on a non-local host. Run the OAuth checks to test it.",owner:"authorization-server",spec:N("2026-07-28",pa,"application-type-and-redirect-uri-constraints"),stage:"stable",lifecycle:ha,optional:!1,assessment:{primary:"checked",declared:We,probed:ss}},{id:"auth.pre-registration",family:"core-authorization",parent:"auth.oauth",name:"Pre-registered clients",summary:"The operator registers a client ahead of time and gives the user its client ID and secret.",howTo:"Add the client ID and secret from your authorization server to the server's OAuth settings in MCPJam, then reconnect the account from the server's Auth tab.",owner:"authorization-server",spec:N("2026-07-28",pa,"pre-registration"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:{primary:"configured",setup:"pre-registered-client",declared:We,probed:ss,oauthFlow:e=>e.registrationStrategy==="preregistered"?Re("oauth-flow"):null}},{id:"auth.resource-indicators",family:"core-authorization",parent:"auth.oauth",name:"Resource indicators (RFC 8707)",summary:"The client names this server's canonical URI as the resource, so tokens are bound to it.",howTo:"Accept the resource parameter on authorization and token requests and issue tokens for that audience.",owner:"client",spec:N("2026-07-28",Bn,"resource-parameter-implementation"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!1,assessment:{primary:"oauth-flow",declared:We,probed:ss,oauthFlow:e=>e.resourceIndicatorSent?Re("oauth-flow"):Et("MCPJam did not send a resource parameter in this sign-in.")}},{id:"auth.scope-selection",family:"core-authorization",parent:"auth.oauth",name:"Scope selection",summary:"The client asks for the scopes in the challenge, or else the scopes the metadata lists.",howTo:"Put the scopes a request needs in the challenge's scope parameter and list all of them in scopes_supported.",owner:"client",spec:N("2026-07-28",Bn,"scope-selection-strategy"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"oauth-flow",declared:We,probed:ss,oauthFlow:e=>e.scopesRequested.length>0?Re("oauth-flow",{count:e.scopesRequested.length}):Et("The sign-in requested no scopes.")}},{id:"auth.step-up",family:"core-authorization",parent:"auth.oauth",name:"Step-up authorization",summary:"A request that needs more scopes gets 403 insufficient_scope, and the client signs in again for them.",howTo:"Return 403 with error insufficient_scope and the scopes needed in the WWW-Authenticate header.",owner:"server",spec:N("2026-07-28",Bn,"step-up-authorization-flow"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"observed",declared:We,probed:ss}},{id:"auth.iss-parameter",family:"core-authorization",parent:"auth.oauth",name:"iss in the authorization response (RFC 9207)",summary:"The authorization server names itself in the redirect, which stops mix-up attacks.",howTo:"Return iss on the authorization response and advertise authorization_response_iss_parameter_supported.",owner:"authorization-server",spec:N("2026-07-28",Bn,"authorization-response-validation"),stage:"stable",lifecycle:ha,optional:!0,assessment:{primary:"oauth-flow",declared:We,probed:ss,oauthFlow:e=>e.issReturned?Re("oauth-flow",{detail:e.issValidated?"Returned and validated.":"Returned."}):nr([])}},{id:"auth.issuer-binding",family:"core-authorization",parent:"auth.oauth",name:"Credentials bound to the issuer",summary:"The client keeps its registration and tokens per authorization server, so one issuer's credentials never reach another.",howTo:"Sign in through MCPJam. It records which issuer each set of credentials belongs to.",owner:"client",spec:N("2026-07-28",pa,"authorization-server-binding"),stage:"stable",lifecycle:ha,optional:!0,assessment:{primary:"oauth-flow",declared:We,probed:ss,oauthFlow:e=>e.issuer?Re("oauth-flow"):Et("The sign-in did not record an issuer.")}},{id:"auth.refresh-tokens",family:"core-authorization",parent:"auth.oauth",name:"Refresh tokens",summary:"The authorization server issues a refresh token, so the client stays signed in without asking the user again.",howTo:"Issue refresh tokens when the client asks for offline_access, and list offline_access in scopes_supported.",owner:"authorization-server",spec:N("2026-07-28",Bn,"refresh-tokens"),stage:"stable",lifecycle:ha,optional:!0,assessment:{primary:"oauth-flow",declared:We,probed:ss,oauthFlow:e=>e.refreshTokenIssued?Re("oauth-flow"):e.scopesRequested.includes("offline_access")?nr([],"MCPJam asked for offline_access and got no refresh token."):Et("MCPJam did not ask for offline_access in this sign-in.")}},{id:"auth.token-validation",family:"core-authorization",parent:"auth.oauth",name:"Token audience validation",summary:"The server accepts only tokens issued for it and never passes a client's token on to other services.",howTo:"Check each token's audience against your canonical URI and reject others with 401. Run the OAuth checks to test it.",owner:"server",spec:N("2026-07-28",yy,"token-audience-binding-and-validation"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!1,assessment:{primary:"checked",declared:We,probed:ss}}],fa="client/elicitation",ns={primary:"observed",observable:!0},uF=[{id:"client.roots",family:"client-features",name:"Roots (roots/list)",summary:"The server asks which directories or files the client allows it to work in.",howTo:"Send roots/list when you need the user's workspace, and handle a client that declines.",owner:"client",spec:N("2026-07-28","client/roots"),stage:"stable",lifecycle:Z({deprecated:"2026-07-28"}),optional:!0,assessment:ns},{id:"client.roots-list-changed",family:"client-features",name:"notifications/roots/list_changed",summary:"The client tells the server that its roots changed.",howTo:"List roots again when you receive notifications/roots/list_changed.",owner:"client",spec:N("2025-11-25","client/roots","root-list-changes"),stage:"stable",lifecycle:Z({removed:"2026-07-28"}),optional:!0,assessment:ns},{id:"client.sampling",family:"client-features",name:"Sampling (sampling/createMessage)",summary:"The server asks the client's model for a completion, with the user able to review it.",howTo:"Send sampling/createMessage with messages, maxTokens and model preferences. Use the server in Playground to see the request.",owner:"client",spec:N("2026-07-28","client/sampling"),stage:"stable",lifecycle:Z({deprecated:"2026-07-28"}),optional:!0,assessment:ns},{id:"client.sampling-tools",family:"client-features",name:"Sampling with tools",summary:"A sampling request offers tools and a toolChoice, so the client's model can call them.",howTo:"Add tools and toolChoice to sampling/createMessage when the client declares sampling.tools.",owner:"client",spec:N("2026-07-28","client/sampling","sampling-with-tools"),stage:"stable",lifecycle:Z({introduced:"2025-11-25",deprecated:"2026-07-28"}),optional:!0,assessment:ns},{id:"client.include-context",family:"client-features",name:"includeContext (thisServer, allServers)",summary:"A sampling request asks the client to add context from this server or every connected server.",howTo:"Leave includeContext out or set it to none. The thisServer and allServers values are deprecated.",owner:"server",spec:N("2026-07-28","deprecated"),stage:"stable",lifecycle:Z({deprecated:"2025-11-25"}),optional:!0,assessment:ns},{id:"client.elicitation",family:"client-features",name:"Elicitation",summary:"The server asks the user for information through the client, in a form or on a web page.",howTo:"Send elicitation/create when a tool needs the user's input. Use the server in Playground to answer it.",owner:"client",spec:N("2026-07-28",fa),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:{primary:"observed"}},{id:"client.elicitation-form",family:"client-features",parent:"client.elicitation",name:"Form elicitation",summary:"A form described by a flat JSON Schema the client renders for the user.",howTo:"Send elicitation/create with a message and a requestedSchema of primitive fields.",owner:"client",spec:N("2026-07-28",fa,"form-mode-elicitation-requests"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:ns},{id:"client.elicitation-url",family:"client-features",parent:"client.elicitation",name:"URL elicitation",summary:"The client opens a URL so the user can sign in or enter sensitive data outside the chat.",howTo:"Send elicitation/create with mode url when the user must act on a web page, such as a third-party sign-in.",owner:"client",spec:N("2026-07-28",fa,"url-mode-elicitation-requests"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:ns},{id:"client.url-elicitation-required-error",family:"client-features",parent:"client.elicitation",name:"URL elicitation required error (-32042)",summary:"A request fails with -32042 and a URL the user must visit before retrying.",howTo:"Return -32042 with the elicitation URL when a request cannot continue until the user visits it.",owner:"server",spec:N("2025-11-25","basic/index","error-codes"),stage:"stable",lifecycle:Z({introduced:"2025-11-25",removed:"2026-07-28"}),optional:!0,assessment:ns},{id:"client.elicitation-complete",family:"client-features",parent:"client.elicitation",name:"notifications/elicitation/complete",summary:"The server tells the client that the user finished a URL elicitation, by its elicitationId.",howTo:"Send notifications/elicitation/complete with the elicitationId when the out-of-band step is done.",owner:"server",spec:N("2025-11-25",fa),stage:"stable",lifecycle:Z({introduced:"2025-11-25",removed:"2026-07-28"}),optional:!0,assessment:ns},{id:"client.elicitation-schemas",family:"client-features",parent:"client.elicitation",name:"Enum and default values in forms",summary:"Form fields offer single or multiple choice enums with titles, and default values.",howTo:"Use enum or oneOf with titles for choices and set default on fields the user can accept as is.",owner:"server",spec:N("2026-07-28",fa,"requested-schema"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:ns}],hl="basic/versioning",mp="backward-compatibility-with-initialization-based-versions",by=e=>{const t=gi(e);return t==="legacy"?Re("advertised",{detail:`Negotiated ${e.protocolVersion}.`}):t==="unknown"&&e.protocolVersion?Et("MCPJam does not know this protocol version yet."):null},dF=e=>(e.supportedVersions??[]).filter(t=>typeof t=="string"&&t.length>0),gp="This server is configured for stdio.",pF=[{id:"lifecycle.initialize",family:"lifecycle-discovery",name:"initialize handshake",summary:"Client and server exchange versions, capabilities and identity before any other request.",howTo:"MCP SDKs answer initialize for you on 2025 revisions. Use Run checks to test the handshake.",owner:"server",spec:N("2025-11-25","basic/lifecycle","initialization"),stage:"stable",lifecycle:Z({removed:"2026-07-28"}),optional:!1,assessment:{primary:"declared",declared:by}},{id:"lifecycle.version-negotiation",family:"lifecycle-discovery",name:"Protocol version negotiation",summary:"The server answers with the version the client asked for, or the newest one it supports.",howTo:"Pin a protocol version in the server's connection settings and reconnect to test each one.",owner:"server",spec:N("2025-11-25","basic/lifecycle","version-negotiation"),stage:"stable",lifecycle:Z({removed:"2026-07-28"}),optional:!1,assessment:{primary:"declared",declared:by}},{id:"lifecycle.server-discover",family:"lifecycle-discovery",name:"server/discover",summary:"Lets a client read supported versions, capabilities and identity in one stateless request.",howTo:"Implement server/discover. SDKs that support 2026-07-28 add it when you enable that revision.",owner:"server",spec:N("2026-07-28","server/discover"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!1,assessment:{primary:"declared",declared:e=>gi(e)!=="modern"?null:e.supportedVersions!==void 0||Dt(e.capabilities)&&Mc(e,["capabilities"])?Re("advertised"):Et("The discovery result was not captured. Reconnect to capture it.")}},{id:"lifecycle.supported-versions",family:"lifecycle-discovery",name:"supportedVersions",summary:"Lists every revision the server speaks, so a client can pick one without trial and error.",howTo:"Return supportedVersions from server/discover with each revision you support.",owner:"server",spec:N("2026-07-28","server/discover"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!1,assessment:{primary:"declared",declared:e=>{const t=dF(e);return t.length>0?Re("advertised",{count:t.length,detail:Oo(t)}):gi(e)==="modern"?Et("The saved discovery result has no supportedVersions list."):null}}},{id:"lifecycle.extensions",family:"lifecycle-discovery",name:"Extension negotiation",summary:"Declares the official or vendor extensions the server supports, keyed by extension id.",howTo:"Declare each extension you support under capabilities.extensions, for example io.modelcontextprotocol/ui.",owner:"server",spec:N("2026-07-28",hl,"extension-negotiation"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!0,assessment:{primary:"declared",declared:e=>{const t=e.capabilities?.extensions;if(Dt(t)&&Ad(t)){const s=Object.keys(t);return Re("advertised",{count:s.length,detail:Oo(s)})}const r=gi(e);return r==="legacy"?Et("Servers on 2025 revisions are not required to list extensions, so a missing list proves nothing."):r==="unknown"?e.protocolVersion?Et("MCPJam does not know this protocol version yet."):null:Lc(e,["capabilities"],"The server declares no extensions.")}}},{id:"lifecycle.unsupported-version-error",family:"lifecycle-discovery",name:"Unsupported protocol version error (-32022)",summary:"A request on a revision the server does not speak gets -32022 with the versions it does speak.",howTo:"Return -32022 with data.supported for unknown protocol versions. Use Run checks to test it.",owner:"server",spec:N("2026-07-28","basic/index","error-codes"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!1,assessment:{primary:"checked"}},{id:"lifecycle.era-detection",family:"lifecycle-discovery",name:"Era detection",summary:"Lets a client tell a 2026-07-28 server from an initialize-based one by how it answers the first request.",howTo:"Answer a request for a revision you do not speak with an error the client can read. Use Run checks to test the handshake.",owner:"server",spec:N("2026-07-28",hl,mp),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!1,assessment:{primary:"checked"}},{id:"lifecycle.dual-era",family:"lifecycle-discovery",name:"Dual-era support",summary:"One server answers both initialize and 2026-07-28 requests, so old and new clients can connect.",howTo:"Keep initialize next to server/discover while your clients migrate.",owner:"server",spec:N("2026-07-28",hl,mp),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!0,assessment:{primary:"checked"}},{id:"lifecycle.modern-only-version-error",family:"lifecycle-discovery",name:"Supported versions in the initialize error",summary:"A server without initialize names the revisions it speaks when an older client tries to initialize.",howTo:"Answer initialize with an error that lists the protocol versions you support.",owner:"server",spec:N("2026-07-28",hl,mp),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!0,assessment:{primary:"checked"}},{id:"lifecycle.missing-client-capability-error",family:"lifecycle-discovery",name:"Missing client capability error (-32021)",summary:"A server that needs a capability the client did not declare says so up front with -32021.",howTo:"Return -32021 naming the missing capability when a request needs one the client did not send.",owner:"server",spec:N("2026-07-28","basic/index","error-codes"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!1,assessment:{primary:"observed",observable:!0}},{id:"lifecycle.no-capability-inference",family:"lifecycle-discovery",name:"Per-request client capabilities",summary:"The server reads client capabilities from each request instead of remembering earlier ones.",howTo:"Read io.modelcontextprotocol/clientCapabilities from each request's _meta and never carry it across requests.",owner:"server",spec:N("2026-07-28","schema","requestmetaobject"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!1,assessment:{primary:"observed"}}],hF=[{id:"transport.stdio",family:"transports",name:"stdio",summary:"The client starts the server as a subprocess and talks over standard input and output.",howTo:"Read JSON-RPC messages from stdin and write them to stdout, one per line. Add the command to MCPJam to connect.",owner:"server",spec:N("2026-07-28","basic/transports/stdio"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:e=>e.transport==="stdio"?Re("detected",{detail:"Connected over stdio."}):e.transport==="unknown"?null:yr("This server is configured for HTTP.")}},{id:"transport.streamable-http",family:"transports",name:"Streamable HTTP (2025)",summary:"One HTTP endpoint for POST and GET, with optional sessions and server-sent event streams.",howTo:"Serve the MCP endpoint with your SDK's Streamable HTTP transport.",owner:"server",spec:N("2025-11-25","basic/transports","streamable-http"),stage:"stable",lifecycle:Z({introduced:"2025-03-26",removed:"2026-07-28"}),optional:!0,assessment:{primary:"declared",declared:e=>e.transport==="stdio"?yr(gp):e.transport==="streamable-http"&&gi(e)==="legacy"?Re("detected",{detail:"Connected over Streamable HTTP."}):null,probed:Js("http-transport",e=>{const t=Nt(e.values.streamableHttp);if(t===!1)return xr(e);const r=ks(vi(e.values.protocolVersion));return t===!0&&r==="legacy"?Re("probed"):null})}},{id:"transport.streamable-http-stateless",family:"transports",name:"Streamable HTTP (stateless)",summary:"Each POST carries its own version and capabilities, with no sessions and no standalone GET stream.",howTo:"Serve 2026-07-28 with an SDK that supports it. Stateless requests can land on any instance behind a load balancer.",owner:"server",spec:N("2026-07-28","basic/transports/streamable-http"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!0,assessment:{primary:"probed",declared:e=>e.transport==="stdio"?yr(gp):e.transport==="streamable-http"&&gi(e)==="modern"?Re("detected",{detail:"Connected on 2026-07-28."}):null,probed:Js("http-transport",e=>{const t=ks(vi(e.values.protocolVersion));return Nt(e.values.streamableHttp)===!0&&t==="modern"?Re("probed"):null})}},{id:"transport.http-sse",family:"transports",name:"HTTP+SSE (deprecated)",summary:"The 2024-11-05 transport: a GET event stream plus a separate POST endpoint.",howTo:"Move to Streamable HTTP. Keep the old endpoints only for clients that still need them.",owner:"server",spec:N("2026-07-28","deprecated"),stage:"stable",lifecycle:Z({deprecated:"2025-03-26"}),optional:!0,assessment:{primary:"probed",declared:e=>e.transport==="stdio"?yr(gp):e.transport==="sse"?Re("detected",{detail:"Connected over HTTP+SSE."}):null,probed:Js("http-transport",e=>{const t=Nt(e.values.legacySse);return t===!0?Re("probed"):t===!1?xr(e):null})}},{id:"transport.custom",family:"transports",name:"Custom transports",summary:"Any other channel that carries MCP's JSON-RPC messages and keeps its lifecycle.",howTo:"MCPJam connects over stdio and HTTP. Test a custom transport with a client built for it.",owner:"server",spec:N("2026-07-28","basic/transports","custom-transports"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:e=>e.transport==="unknown"?null:yr("MCPJam connects over stdio and HTTP only.")}}],ji="basic/patterns/mrtr",vp="server-requirements-basic-workflow",fl="basic/patterns/subscriptions",Or=Z({introduced:"2026-07-28"}),fF=[{id:"mrtr.input-required",family:"mrtr",name:"InputRequiredResult (input_required)",summary:"A request pauses with resultType input_required so the client can collect input and retry.",howTo:"Return input_required with inputRequests from tools/call, resources/read or prompts/get when you need the user. Use the server in Playground to see it.",owner:"server",spec:N("2026-07-28",ji),stage:"stable",lifecycle:Or,optional:!0,assessment:{primary:"observed",observable:!0}},{id:"mrtr.supported-requests",family:"mrtr",name:"Only on tools/call, resources/read and prompts/get",summary:"Input requests are allowed on these three methods and nowhere else.",howTo:"Return input_required only from tools/call, resources/read or prompts/get.",owner:"server",spec:N("2026-07-28",ji,"supported-requests"),stage:"stable",lifecycle:Or,optional:!1,assessment:{primary:"observed"}},{id:"mrtr.input-request-types",family:"mrtr",name:"Input request types",summary:"The server asks for elicitation, sampling or roots inside inputRequests instead of sending its own requests.",howTo:"Put elicitation/create, sampling/createMessage or roots/list entries in inputRequests.",owner:"server",spec:N("2026-07-28",ji,vp),stage:"stable",lifecycle:Or,optional:!0,assessment:{primary:"observed",observable:!0}},{id:"mrtr.request-state",family:"mrtr",name:"requestState",summary:"Opaque state the client sends back on retry, so the server can resume without storing anything.",howTo:"Return requestState with input_required and protect it with a MAC or encryption so clients cannot change it.",owner:"server",spec:N("2026-07-28",ji,vp),stage:"stable",lifecycle:Or,optional:!0,assessment:{primary:"observed",observable:!0}},{id:"mrtr.load-shedding",family:"mrtr",name:"Load shedding with requestState",summary:"A busy server returns only requestState, and the client retries later with it.",howTo:"Return input_required with requestState and no inputRequests when you want the client to retry later.",owner:"server",spec:N("2026-07-28","schema","inputrequiredresult"),stage:"stable",lifecycle:Or,optional:!0,assessment:{primary:"observed",observable:!0}},{id:"mrtr.declared-capabilities-only",family:"mrtr",name:"Input requests match client capabilities",summary:"The server asks only for input the client declared it can provide.",howTo:"Check the request's clientCapabilities before adding an input request, and return -32021 when one is missing.",owner:"server",spec:N("2026-07-28",ji,vp),stage:"stable",lifecycle:Or,optional:!1,assessment:{primary:"checked"}},{id:"mrtr.input-meta",family:"mrtr",name:"_meta on input requests and responses",summary:"Input requests and responses carry their own _meta. Only the draft revision after 2026-07-28 allows it.",howTo:"Add _meta to sampling, elicitation and roots input requests when you need to pass metadata through.",owner:"server",spec:N("draft",ji),stage:"experimental",lifecycle:Or,optional:!0,assessment:{primary:"observed",observable:!0}}],mF=[{id:"subscriptions.resources-subscribe",family:"subscriptions",name:"resources.subscribe capability",summary:"The server can tell the client when a specific resource changes.",howTo:"Declare resources.subscribe and send notifications/resources/updated when a subscribed resource changes.",owner:"server",spec:N("2026-07-28","server/resources","capabilities"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",observable:!0,declared:Rd("resources","subscribe","a resource update")}},{id:"subscriptions.legacy-subscribe",family:"subscriptions",name:"resources/subscribe and resources/unsubscribe",summary:"The client subscribes to one resource URI and later stops.",howTo:"Handle resources/subscribe and resources/unsubscribe and remember each URI per session.",owner:"server",spec:N("2025-11-25","server/resources","subscriptions"),stage:"stable",lifecycle:Z({removed:"2026-07-28"}),optional:!0,assessment:{primary:"checked",observable:!0}},{id:"subscriptions.resource-updated",family:"subscriptions",name:"notifications/resources/updated",summary:"Tells a subscribed client that a resource changed so it can read it again.",howTo:"Send notifications/resources/updated with the resource URI after it changes.",owner:"server",spec:N("2026-07-28","server/resources","subscriptions"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"observed",observable:!0}},{id:"subscriptions.listen",family:"subscriptions",name:"subscriptions/listen",summary:"Opens one stream the client keeps open for list changes and resource updates.",howTo:"Implement subscriptions/listen and keep the stream open until the client cancels it. Use Run checks to test it.",owner:"server",spec:N("2026-07-28",fl,"opening-a-stream"),stage:"stable",lifecycle:Or,optional:!0,assessment:{primary:"checked",observable:!0}},{id:"subscriptions.acknowledged",family:"subscriptions",name:"Subscription acknowledgment",summary:"The server confirms which requested notifications it will send before it sends any.",howTo:"Send notifications/subscriptions/acknowledged with the subset you honor before any other notification.",owner:"server",spec:N("2026-07-28",fl,"acknowledgment"),stage:"stable",lifecycle:Or,optional:!0,assessment:{primary:"checked",observable:!0}},{id:"subscriptions.subscription-id",family:"subscriptions",name:"Subscription ID tagging",summary:"Every notification on a listen stream carries the subscription's id, so the client can route it.",howTo:"Add io.modelcontextprotocol/subscriptionId to the _meta of each notification you send on the stream.",owner:"server",spec:N("2026-07-28","schema","notificationmetaobject"),stage:"stable",lifecycle:Or,optional:!0,assessment:{primary:"checked",observable:!0}},{id:"subscriptions.list-changed-on-stream",family:"subscriptions",name:"list_changed on the listen stream",summary:"Tool, prompt and resource list changes arrive on the subscription stream.",howTo:"Send list_changed notifications on each open listen stream that asked for them.",owner:"server",spec:N("2026-07-28",fl,"receiving-notifications"),stage:"stable",lifecycle:Or,optional:!0,assessment:{primary:"observed",observable:!0}},{id:"subscriptions.stream-end",family:"subscriptions",name:"Stream end",summary:"The server closes a subscription gracefully, or sends cancelled on stdio, when it stops.",howTo:"Return the subscriptions/listen result when you end a stream, and send notifications/cancelled on stdio.",owner:"server",spec:N("2026-07-28",fl,"graceful-closure"),stage:"stable",lifecycle:Or,optional:!0,assessment:{primary:"observed",observable:!0}},{id:"subscriptions.legacy-delivery",family:"subscriptions",name:"Notifications on open streams (2025)",summary:"On 2025 revisions the server sends list changes and updates on the GET stream or any open stream.",howTo:"Send notifications on the standalone GET stream or on a request stream that is still open.",owner:"server",spec:N("2025-11-25","basic/transports","listening-for-messages-from-the-server"),stage:"stable",lifecycle:Z({introduced:"2025-03-26",removed:"2026-07-28"}),optional:!0,assessment:{primary:"observed",observable:!0}}],Kr="server/resources",Hi="server/prompts",Sy=Z({introduced:"2026-07-28"});function gF(e){if(typeof e=="string")return/^([A-Za-z][A-Za-z0-9+.-]*):/.exec(e)?.[1]?.toLowerCase()}var vF=e=>{if(e.resources.length===0)return Fg(e,"resources");const t=[...new Set(e.resources.map(r=>gF(r.uri)).filter(r=>r!==void 0))].sort();return t.length>0?Re("detected",{count:t.length,detail:Oo(t)}):null},_F=e=>{const t=e.resourceTemplates.length;return t>0?Re("detected",{count:t,detail:`${t} resource templates`}):Dt(Id(e,"resources"))?nr(["resourceTemplates"]):nr(["capabilities","resourceTemplates"])},yF=e=>{const t=Js("apps-ui-resources",s=>{const n=sf(s.values.readCount)??0;return n>0?Re("probed",{count:n,detail:"Read UI resources."}):null})(e);if(t?.kind==="present")return t;const r=Js("skills",s=>{const n=sf(s.values.verified)??0;return n>0?Re("probed",{count:n,detail:"Read skill files."}):null})(e);return r?.kind==="present"?r:null},bF=[{id:"resources.capability",family:"resources",name:"resources capability",summary:"Declares that the server exposes data clients can list and read.",howTo:"Register at least one resource or resource template. MCP SDKs declare the capability for you.",owner:"server",spec:N("2026-07-28",Kr,"capabilities"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:Nc("resources")}},{id:"resources.list",family:"resources",parent:"resources.capability",name:"resources/list",summary:"Lists resources with uri, name and optional title, description, MIME type, size, icons and annotations.",howTo:"Register resources with your SDK and it answers resources/list. Add a title and mimeType to each.",owner:"server",spec:N("2026-07-28",Kr,"listing-resources"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:jg("resources","resources")}},{id:"resources.read",family:"resources",parent:"resources.capability",name:"resources/read",summary:"Returns a resource's contents as text or base64 blob.",howTo:"Handle resources/read for each URI you list. Read a resource in MCPJam to test it.",owner:"server",spec:N("2026-07-28",Kr,"reading-resources"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"probed",observable:!0,probed:yF}},{id:"resources.not-found-error",family:"resources",parent:"resources.capability",name:"Resource not found error",summary:"Reading an unknown URI gets a protocol error: -32002 up to 2025-11-25, -32602 on 2026-07-28.",howTo:"Return the error code for your revision when a URI does not exist, never an empty contents list. Use Run checks to test it.",owner:"server",spec:N("2026-07-28",Kr,"error-handling"),stage:"stable",lifecycle:{},optional:!1,assessment:{primary:"checked"}},{id:"resources.uri-schemes",family:"resources",parent:"resources.capability",name:"Resource URI schemes",summary:"The schemes resource URIs use, such as https, file, git or a custom one.",howTo:"Use https:// for web content, file:// for files and your own scheme for everything else.",owner:"server",spec:N("2026-07-28",Kr,"common-uri-schemes"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:vF}},{id:"resources.list-changed",family:"resources",parent:"resources.capability",name:"resources.listChanged",summary:"The server tells clients when its resource list changes so they can list again.",howTo:"Declare resources.listChanged and send notifications/resources/list_changed when the list changes.",owner:"server",spec:N("2026-07-28",Kr,"list-changed-notification"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",observable:!0,declared:Rd("resources","listChanged","a list change notification")}},{id:"resources.stable-list",family:"resources",parent:"resources.capability",name:"Same resource list on every connection",summary:"The resource list does not change from one connection to the next, except by authorization.",howTo:"Return the same resources to every client that has the same credentials.",owner:"server",spec:N("2026-07-28",Kr,"capabilities"),stage:"stable",lifecycle:Sy,optional:!1,assessment:{primary:"checked"}},{id:"resources.read-input-required",family:"resources",parent:"resources.capability",name:"resources/read asks for input",summary:"A resource read can pause with input_required to ask the user before it returns contents.",howTo:"Return input_required from resources/read when reading needs the user's input. Read the resource in MCPJam to see it.",owner:"server",spec:N("2026-07-28","basic/patterns/mrtr","supported-requests"),stage:"stable",lifecycle:Sy,optional:!0,assessment:{primary:"observed",observable:!0}}],SF=[{id:"resource-templates.list",family:"resource-templates",name:"resources/templates/list",summary:"Lists URI templates clients fill in to read parameterized resources.",howTo:"Register resource templates with RFC 6570 URI templates, for example file:///{path}.",owner:"server",spec:N("2026-07-28",Kr,"resource-templates"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:_F}},{id:"resource-templates.fields",family:"resource-templates",name:"Resource template fields",summary:"Each template's uriTemplate, name, title, description, MIME type, annotations and icons.",howTo:"Give each template a uriTemplate, a name, and a description that says what its variables mean.",owner:"server",spec:N("2026-07-28","schema","resourcetemplate"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:rr("resourceTemplates",e=>lr(e.uriTemplate)&&lr(e.description),["resourceTemplates"])}},{id:"resource-templates.expanded-read",family:"resource-templates",name:"Read through a template",summary:"Reading a URI built from a template returns that resource's contents.",howTo:"Handle resources/read for every URI your templates can produce. Fill in a template in MCPJam to test it.",owner:"server",spec:N("2026-07-28",Kr,"resource-templates"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"checked"}},{id:"resource-templates.list-changed-coverage",family:"resource-templates",name:"Template list changes",summary:"Whether resources/list_changed also signals template changes. The specification does not say.",howTo:"Send notifications/resources/list_changed when templates change too, so clients list both again.",owner:"server",spec:N("2026-07-28",Kr,"list-changed-notification"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"observed"}},{id:"resource-templates.updated",family:"resource-templates",name:"Resource change notifications",summary:"notifications/resources/updated tells a client that a resource it read has changed.",howTo:"Send notifications/resources/updated with the URI whenever a subscribed resource changes.",owner:"server",spec:N("2026-07-28",Kr,"subscriptions"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"observed",observable:!0}}],wF=[{id:"prompts.capability",family:"prompts",name:"prompts capability",summary:"Declares that the server offers prompt templates users can pick.",howTo:"Register at least one prompt. MCP SDKs declare the prompts capability for you.",owner:"server",spec:N("2026-07-28",Hi,"capabilities"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:Nc("prompts")}},{id:"prompts.list",family:"prompts",parent:"prompts.capability",name:"prompts/list",summary:"Lists prompts with name and optional title, description and icons.",howTo:"Register prompts with your SDK and it answers prompts/list. Give each a title and description.",owner:"server",spec:N("2026-07-28",Hi,"listing-prompts"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:jg("prompts","prompts")}},{id:"prompts.arguments",family:"prompts",parent:"prompts.capability",name:"Prompt arguments",summary:"Named arguments a user fills in, each with a description and a required flag.",howTo:"Add arguments to a prompt and mark the ones it cannot work without as required.",owner:"server",spec:N("2026-07-28","schema","promptargument"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:rr("prompts",e=>Array.isArray(e.arguments)&&e.arguments.length>0,["prompts"])}},{id:"prompts.get",family:"prompts",parent:"prompts.capability",name:"prompts/get",summary:"Returns a prompt's messages with the user's arguments filled in.",howTo:"Handle prompts/get for each prompt you list. Run a prompt in MCPJam to test it.",owner:"server",spec:N("2026-07-28",Hi,"getting-a-prompt"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"checked",observable:!0}},{id:"prompts.message-content",family:"prompts",parent:"prompts.capability",name:"Prompt messages",summary:"User and assistant messages with text, image, audio, resource link or embedded resource content.",howTo:"Return messages with a role and content from prompts/get. Run the prompt in MCPJam to see them.",owner:"server",spec:N("2026-07-28",Hi,"promptmessage"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"observed",observable:!0}},{id:"prompts.errors",family:"prompts",parent:"prompts.capability",name:"Prompt errors (-32602)",summary:"An unknown prompt name or a missing required argument gets a -32602 protocol error.",howTo:"Return -32602 for unknown prompt names and missing required arguments.",owner:"server",spec:N("2026-07-28",Hi,"error-handling"),stage:"stable",lifecycle:{},optional:!1,assessment:{primary:"checked"}},{id:"prompts.list-changed",family:"prompts",parent:"prompts.capability",name:"prompts.listChanged",summary:"The server tells clients when its prompt list changes so they can list again.",howTo:"Declare prompts.listChanged and send notifications/prompts/list_changed when the list changes.",owner:"server",spec:N("2026-07-28",Hi,"list-changed-notification"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",observable:!0,declared:Rd("prompts","listChanged","a list change notification")}}],ma="server/discover",kF=[{id:"server-info.name-version",family:"server-information",name:"Server name and version",summary:"Identifies the server implementation to clients and in logs.",howTo:"Set name and version in your server's implementation info. Every MCP SDK asks for them when you create the server.",owner:"server",spec:N("2026-07-28",ma),stage:"stable",lifecycle:{},optional:!1,assessment:{primary:"declared",declared:da(e=>lr(e.name)&&lr(e.version))}},{id:"server-info.title",family:"server-information",name:"Server title",summary:"A display name clients show instead of the programmatic server name.",howTo:"Set title in your server's implementation info.",owner:"server",spec:N("2026-07-28",ma),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:{primary:"declared",declared:da(e=>lr(e.title),{droppedByOldSnapshots:!0})}},{id:"server-info.description",family:"server-information",name:"Server description",summary:"A short description of what the server does, shown to users.",howTo:"Set description in your server's implementation info.",owner:"server",spec:N("2026-07-28",ma),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"declared",declared:da(e=>lr(e.description),{droppedByOldSnapshots:!0})}},{id:"server-info.website-url",family:"server-information",name:"Website URL",summary:"Links users to the server's homepage or documentation.",howTo:"Set websiteUrl in your server's implementation info.",owner:"server",spec:N("2026-07-28",ma),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"declared",declared:da(e=>lr(e.websiteUrl),{droppedByOldSnapshots:!0})}},{id:"server-info.icons",family:"server-information",name:"Server icons",summary:"Icons clients show next to the server, with sizes, MIME types and light or dark themes.",howTo:"Add icons with src, mimeType and sizes to your server's implementation info. Serve them over HTTPS or as data URIs.",owner:"server",spec:N("2026-07-28","basic/index","icons"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"declared",declared:da(e=>Array.isArray(e.icons)&&e.icons.some(t=>Dt(t)&&lr(t.src)),{droppedByOldSnapshots:!0})}},{id:"server-info.instructions",family:"server-information",name:"Instructions",summary:"Guidance a client can give the model about how and when to use the server.",howTo:"Return an instructions string from initialize, or from server/discover on 2026-07-28.",owner:"server",spec:N("2026-07-28",ma),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:e=>lr(e.instructions)?Re("advertised"):nr(["instructions"])}},{id:"server-info.experimental",family:"server-information",name:"Experimental capabilities",summary:"Non-standard capabilities the server declares under capabilities.experimental.",howTo:"Declare a non-standard feature under capabilities.experimental with a namespaced key.",owner:"server",spec:N("2026-07-28","schema","servercapabilities"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:e=>{const t=e.capabilities?.experimental;if(Dt(t)&&Ad(t)){const r=Object.keys(t);return Re("advertised",{count:r.length,detail:Oo(r)})}return Lc(e,["capabilities"],"The server declares no experimental capabilities.")}}},{id:"server-info.result-server-info",family:"server-information",name:"serverInfo on every result",summary:"Each result names the server in its _meta, so a stateless client always knows who answered.",howTo:"Add io.modelcontextprotocol/serverInfo to the _meta of every result. Use the server in Playground to see it on live traffic.",owner:"server",spec:N("2026-07-28","schema","resultmetaobject"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!0,assessment:{primary:"observed",observable:!0,declared:e=>Dt(e.discoveryMeta)&&Dt(e.discoveryMeta["io.modelcontextprotocol/serverInfo"])?Re("detected",{detail:"Seen on server/discover."}):null}}],ga="server/utilities/completion",wy="server/utilities/pagination",ml="server/utilities/caching",gl="server/utilities/logging",$a=Z({introduced:"2026-07-28"}),EF={tools:"tools/list",resources:"resources/list",resourceTemplates:"resources/templates/list",prompts:"prompts/list"},TF=["tools","resources","resourceTemplates","prompts"];function CT(e,t){return TF.filter(r=>{const s=e[r];return s!==void 0&&t(s)}).map(r=>EF[r])}function ky(e){return t=>{const r=CT(t.listHints,e);return r.length>0?Re("advertised",{count:r.length,detail:`On ${Oo(r)}.`}):nr(["listHints"])}}var AF=e=>{const t=CT(e.listHints,r=>typeof r.pages=="number"&&r.pages>1);return t.length>0?Re("detected",{count:t.length,detail:`Paged ${Oo(t)}.`}):Mc(e,["listHints"])?Et("Every list fit on one page, so pagination did not come up."):null},IF=[{id:"completion.capability",family:"completion",name:"completions capability",summary:"Declares that the server suggests values for prompt and resource template arguments.",howTo:"Declare completions and answer completion/complete. MCP SDKs do this when you register a completer.",owner:"server",spec:N("2026-07-28",ga,"capabilities"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:{primary:"declared",declared:Nc("completions")}},{id:"completion.prompt-ref",family:"completion",parent:"completion.capability",name:"Prompt argument completion (ref/prompt)",summary:"Suggests values for a prompt argument as the user types.",howTo:"Answer completion/complete for ref/prompt with matching values.",owner:"server",spec:N("2026-07-28",ga,"requesting-completions"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"checked",observable:!0}},{id:"completion.resource-ref",family:"completion",parent:"completion.capability",name:"Template argument completion (ref/resource)",summary:"Suggests values for a resource template variable.",howTo:"Answer completion/complete for ref/resource with values for the template variable.",owner:"server",spec:N("2026-07-28",ga,"reference-types"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"checked",observable:!0}},{id:"completion.context-arguments",family:"completion",parent:"completion.capability",name:"Completion context",summary:"Values the user already entered arrive in context.arguments, so suggestions can depend on them.",howTo:"Read context.arguments in your completer to narrow its suggestions.",owner:"server",spec:N("2026-07-28",ga,"requesting-completions"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:{primary:"checked"}},{id:"completion.result-shape",family:"completion",parent:"completion.capability",name:"Completion results",summary:"Up to 100 values, with total and hasMore when more matches exist.",howTo:"Return at most 100 values, and set total and hasMore when you cut the list short.",owner:"server",spec:N("2026-07-28",ga,"completion-results"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"checked"}}],RF=[{id:"pagination.cursor",family:"pagination-caching",name:"Pagination (cursor and nextCursor)",summary:"Long lists come back in pages, and the client follows nextCursor for the rest.",howTo:"Return nextCursor when a list has more items, and accept it as cursor on the next call.",owner:"server",spec:N("2026-07-28",wy),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",observable:!0,declared:AF}},{id:"pagination.invalid-cursor",family:"pagination-caching",name:"Invalid cursor error (-32602)",summary:"A cursor the server did not issue gets a -32602 error instead of a wrong page.",howTo:"Validate cursors and return -32602 for any you did not issue.",owner:"server",spec:N("2026-07-28",wy,"error-handling"),stage:"stable",lifecycle:{},optional:!1,assessment:{primary:"checked"}},{id:"caching.ttl-ms",family:"pagination-caching",name:"Cache lifetime (ttlMs)",summary:"Tells clients how long a list or read result stays fresh, so they can skip repeat requests.",howTo:"Return ttlMs on server/discover, list results and resources/read. 0 means do not reuse the result.",owner:"server",spec:N("2026-07-28",ml,"cacheable-results"),stage:"stable",lifecycle:$a,optional:!1,assessment:{primary:"declared",declared:ky(e=>typeof e.ttlMs=="number"&&Number.isFinite(e.ttlMs)&&e.ttlMs>=0)}},{id:"caching.cache-scope",family:"pagination-caching",name:"Cache scope (cacheScope)",summary:"Says whether a cached result can be shared across users (public) or reused for one caller (private).",howTo:"Return cacheScope private when a result depends on the caller's authorization, and public otherwise.",owner:"server",spec:N("2026-07-28",ml,"cacheable-results"),stage:"stable",lifecycle:$a,optional:!1,assessment:{primary:"declared",declared:ky(e=>e.cacheScope==="public"||e.cacheScope==="private")}},{id:"caching.scope-correctness",family:"pagination-caching",name:"Private scope for per-user results",summary:"Results that vary by user or authorization are marked private, so shared caches never mix them up.",howTo:"Mark every list or read that depends on the caller as private.",owner:"server",spec:N("2026-07-28",ml,"cacheable-model"),stage:"stable",lifecycle:$a,optional:!1,assessment:{primary:"observed"}},{id:"caching.no-hints-on-input-required",family:"pagination-caching",name:"No cache hints on input_required",summary:"Results that pause for input carry no ttlMs or cacheScope, and their retries are never cached.",howTo:"Leave ttlMs and cacheScope off input_required results.",owner:"server",spec:N("2026-07-28",ml,"cache-key"),stage:"stable",lifecycle:$a,optional:!1,assessment:{primary:"observed",observable:!0}}],CF=[{id:"request-control.progress",family:"request-control",name:"Progress notifications",summary:"Long requests report progress, with a total and a message, against the client's progressToken.",howTo:"Send notifications/progress with the request's progressToken while a long tool runs. Call the tool in Playground to see it.",owner:"server",spec:N("2026-07-28","basic/patterns/progress"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"observed",observable:!0}},{id:"request-control.cancellation",family:"request-control",name:"Cancellation",summary:"The client cancels a request in flight and the server stops the work. Before 2026-07-28 a server could also cancel its own requests.",howTo:"Stop work when you receive notifications/cancelled, or on 2026-07-28 HTTP when the request's stream closes. On 2026-07-28, send notifications/cancelled only to end a subscriptions/listen stream.",owner:"server",spec:N("2026-07-28","basic/patterns/cancellation"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"observed",observable:!0,observableEra:"legacy"}},{id:"request-control.ping",family:"request-control",name:"ping",summary:"Either side checks that the connection is alive with a request that returns an empty result.",howTo:"Answer ping with an empty result. SDKs do this for you on 2025 revisions.",owner:"server",spec:N("2025-11-25","basic/utilities/ping"),stage:"stable",lifecycle:Z({removed:"2026-07-28"}),optional:!1,assessment:{primary:"checked",observable:!0}},{id:"request-control.logging",family:"request-control",name:"logging capability",summary:"Declares that the server sends log messages to the client.",howTo:"Declare logging and send notifications/message. Logging is deprecated on 2026-07-28, so prefer your own telemetry.",owner:"server",spec:N("2026-07-28",gl),stage:"stable",lifecycle:Z({deprecated:"2026-07-28"}),optional:!0,assessment:{primary:"declared",declared:Nc("logging")}},{id:"request-control.logging-set-level",family:"request-control",parent:"request-control.logging",name:"logging/setLevel",summary:"The client picks the lowest log level it wants for the session.",howTo:"Handle logging/setLevel and drop messages below that level.",owner:"server",spec:N("2025-11-25",gl,"setting-log-level"),stage:"stable",lifecycle:Z({removed:"2026-07-28"}),optional:!0,assessment:{primary:"checked",observable:!0}},{id:"request-control.log-messages",family:"request-control",parent:"request-control.logging",name:"Log messages (notifications/message)",summary:"Structured log messages with a level, a logger name and data.",howTo:"Send notifications/message at or above the requested level. On 2026-07-28 send them only when the request asks for a log level.",owner:"server",spec:N("2026-07-28",gl),stage:"stable",lifecycle:Z({deprecated:"2026-07-28"}),optional:!0,assessment:{primary:"observed",observable:!0}},{id:"request-control.per-request-log-level",family:"request-control",parent:"request-control.logging",name:"Per-request log level",summary:"Each 2026-07-28 request names the log level it wants in its _meta.",howTo:"Read io.modelcontextprotocol/logLevel from the request's _meta and send logs only at or above it.",owner:"server",spec:N("2026-07-28",gl,"per-request-log-level"),stage:"stable",lifecycle:Z({introduced:"2026-07-28",deprecated:"2026-07-28"}),optional:!0,assessment:{primary:"checked"}},{id:"request-control.trace-context",family:"request-control",name:"Trace context",summary:"traceparent, tracestate and baggage in _meta tie a request to your distributed traces.",howTo:"Read traceparent and tracestate from the request's _meta and pass them to your tracing library.",owner:"server",spec:N("2026-07-28","basic/index","meta"),stage:"stable",lifecycle:$a,optional:!0,assessment:{primary:"observed"}}],is="server/tools",PF=Z({introduced:"2026-07-28"}),qr={primary:"observed",observable:!0},xF=[{id:"tool-results.content",family:"tool-results",name:"Tool result content",summary:"The content array a tool returns for the model and the user.",howTo:"Return content items from your tool handler. Call the tool in Playground to see them.",owner:"server",spec:N("2026-07-28",is,"tool-result"),stage:"stable",lifecycle:{},optional:!0,assessment:qr},{id:"tool-results.text",family:"tool-results",name:"Text content",summary:"Plain text in a tool result.",howTo:"Return a content item with type text.",owner:"server",spec:N("2026-07-28",is,"text-content"),stage:"stable",lifecycle:{},optional:!0,assessment:qr},{id:"tool-results.image",family:"tool-results",name:"Image content",summary:"Base64 image data with a MIME type.",howTo:"Return a content item with type image, base64 data and a mimeType.",owner:"server",spec:N("2026-07-28",is,"image-content"),stage:"stable",lifecycle:{},optional:!0,assessment:qr},{id:"tool-results.audio",family:"tool-results",name:"Audio content",summary:"Base64 audio data with a MIME type.",howTo:"Return a content item with type audio, base64 data and a mimeType.",owner:"server",spec:N("2026-07-28",is,"audio-content"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:qr},{id:"tool-results.resource-link",family:"tool-results",name:"Resource links",summary:"A link to a resource the client can read later.",howTo:"Return a content item with type resource_link and the resource's uri and name.",owner:"server",spec:N("2026-07-28",is,"resource-links"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:qr},{id:"tool-results.embedded-resource",family:"tool-results",name:"Embedded resources",summary:"A resource's contents included inline in the result.",howTo:"Return a content item with type resource that holds the resource's uri and its text or blob.",owner:"server",spec:N("2026-07-28",is,"embedded-resources"),stage:"stable",lifecycle:{},optional:!0,assessment:qr},{id:"tool-results.content-annotations",family:"tool-results",name:"Content annotations",summary:"Audience, priority and lastModified hints on content items.",howTo:"Add annotations with audience and priority to the content items that matter most.",owner:"server",spec:N("2026-07-28","schema","annotations"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:qr},{id:"tool-results.structured-content",family:"tool-results",name:"Structured content",summary:"Machine-readable JSON next to the text content. On 2026-07-28 it can be any JSON value.",howTo:"Return structuredContent from the tool and declare an outputSchema for it.",owner:"server",spec:N("2026-07-28",is,"structured-content"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:qr},{id:"tool-results.output-schema-conformance",family:"tool-results",name:"Results match outputSchema",summary:"structuredContent validates against the tool's declared outputSchema.",howTo:"Validate structuredContent against your outputSchema before you return it. Run checks with a fixture call to test it.",owner:"server",spec:N("2026-07-28",is,"output-schema"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!1,assessment:{primary:"checked"}},{id:"tool-results.is-error",family:"tool-results",name:"Tool errors (isError)",summary:"A failed call returns isError: true with a message the model can read.",howTo:"Return isError: true with an explanation when a tool fails, instead of throwing.",owner:"server",spec:N("2026-07-28",is,"error-handling"),stage:"stable",lifecycle:{},optional:!0,assessment:qr},{id:"tool-results.unknown-tool-error",family:"tool-results",name:"Unknown tool error (-32602)",summary:"Calling a tool that does not exist gets a -32602 protocol error.",howTo:"Return -32602 when a client calls a tool name you do not have.",owner:"server",spec:N("2026-07-28",is,"error-handling"),stage:"stable",lifecycle:{},optional:!1,assessment:{primary:"checked"}},{id:"tool-results.result-type",family:"tool-results",name:"resultType",summary:"Every 2026-07-28 result says whether it is complete or needs input.",howTo:"Set resultType to complete on every result. SDKs for 2026-07-28 set it for you.",owner:"server",spec:N("2026-07-28","basic/index","resulttype"),stage:"stable",lifecycle:PF,optional:!1,assessment:qr},{id:"tool-results.result-meta",family:"tool-results",name:"Result _meta",summary:"Metadata on a result for clients and extensions.",howTo:"Put namespaced keys in a result's _meta when a client or extension reads them.",owner:"server",spec:N("2026-07-28","basic/index","meta"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:qr}],Rr="server/tools",nf=Z({introduced:"2026-07-28"}),OF=/^[A-Za-z0-9_.-]{1,128}$/,MF=e=>{const t=rr("tools",s=>lr(s.name),["tools"])(e);if(t?.kind!=="present")return t;const r=e.tools.filter(s=>typeof s.name=="string"&&!OF.test(s.name)).length;return r>0?{...t,detail:`${r} of ${e.tools.length} names fall outside the naming guidance.`}:t};function vl(e){return t=>{const r=rr("tools",n=>typeof rf(n,e)=="boolean",["tools"])(t);if(r?.kind!=="present"||r.count===void 0)return r;const s=t.tools.filter(n=>rf(n,e)===!0).length;return{...r,detail:`Set on ${r.count} of ${t.tools.length} tools: ${s} true, ${r.count-s} false.`}}}function _p(e){return Dt(e.execution)?e.execution.taskSupport:void 0}var LF=e=>{const t=rr("tools",r=>_p(r)==="optional"||_p(r)==="required",["tools"])(e);return t?.kind!=="absent"?t:e.tools.some(r=>_p(r)==="forbidden")?nr(t.basis,"Every tool that sets taskSupport sets it to forbidden."):t},NF=e=>{const t=rr("tools",r=>IT(r).some(s=>Dt(s)&&lr(s.$schema)),["tools","toolSchemas"])(e);return t?.kind!=="absent"?t:Lc(e,["tools","toolSchemas"],"Every tool schema uses the default dialect, JSON Schema 2020-12.")},$F=e=>{if(e.tools.length===0)return Fg(e,"tools");if(!Mc(e,["toolSchemas"]))return Et("The saved tool schemas may have lost their $ref keys. Reconnect to capture them in full.");const t=e.tools.flatMap(s=>IT(s).flatMap(n=>iF(n,"$ref")));if(t.length===0)return yr("No tool schema uses $ref.");const r=t.filter(s=>!s.startsWith("#")).length;return r===0?Re("detected",{count:t.length,detail:"Every $ref is local."}):Et(`${r} $ref pointers lead outside the schema.`)},DF=[{id:"tools.capability",family:"tools-discovery",name:"tools capability",summary:"Declares that the server offers tools the model can call.",howTo:"Register at least one tool. MCP SDKs declare the tools capability for you.",owner:"server",spec:N("2026-07-28",Rr,"capabilities"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:Nc("tools")}},{id:"tools.list",family:"tools-discovery",parent:"tools.capability",name:"tools/list",summary:"Returns every tool with its name, description and input schema.",howTo:"Register tools with your SDK and it answers tools/list. Page long lists with cursors.",owner:"server",spec:N("2026-07-28",Rr,"listing-tools"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:jg("tools","tools")}},{id:"tools.name",family:"tools-discovery",parent:"tools.capability",name:"Tool name",summary:"A unique name the model calls the tool by: 1 to 128 letters, digits, underscores, hyphens or dots.",howTo:"Give each tool a short unique name that uses only letters, digits, _, - and dots.",owner:"server",spec:N("2026-07-28",Rr,"tool-names"),stage:"stable",lifecycle:{},optional:!1,assessment:{primary:"declared",declared:MF}},{id:"tools.title",family:"tools-discovery",parent:"tools.capability",name:"Tool title",summary:"A display name clients show instead of the tool's programmatic name.",howTo:"Set title on each tool, for example Search issues for search_issues.",owner:"server",spec:N("2026-07-28",Rr,"tool"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:{primary:"declared",declared:rr("tools",e=>lr(e.title),["tools"],{droppedByOldSnapshots:!0})}},{id:"tools.description",family:"tools-discovery",parent:"tools.capability",name:"Tool description",summary:"Tells the model what the tool does and when to call it.",howTo:"Write a description for each tool that says what it does, what it returns and when to use it.",owner:"server",spec:N("2026-07-28",Rr,"tool"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:rr("tools",e=>lr(e.description),["tools"])}},{id:"tools.icons",family:"tools-discovery",parent:"tools.capability",name:"Tool icons",summary:"Icons clients show next to each tool.",howTo:"Add icons with src, mimeType and sizes to each tool.",owner:"server",spec:N("2026-07-28",Rr,"tool"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"declared",declared:rr("tools",e=>Array.isArray(e.icons)&&e.icons.length>0,["tools"],{droppedByOldSnapshots:!0})}},{id:"tools.meta",family:"tools-discovery",parent:"tools.capability",name:"Tool _meta",summary:"Extension metadata on a tool, such as the MCP Apps UI link.",howTo:"Put namespaced keys in the tool's _meta when an extension or client needs them.",owner:"server",spec:N("2026-07-28","basic/index","meta"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:{primary:"declared",declared:rr("tools",e=>Ad(e._meta),["tools","toolMeta"])}},{id:"tools.list-changed",family:"tools-discovery",parent:"tools.capability",name:"tools.listChanged",summary:"The server tells clients when its tool list changes so they can list again.",howTo:"Declare tools.listChanged and send notifications/tools/list_changed after you add or remove tools.",owner:"server",spec:N("2026-07-28",Rr,"list-changed-notification"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",observable:!0,declared:Rd("tools","listChanged","a list change notification")}},{id:"tools.deterministic-order",family:"tools-discovery",parent:"tools.capability",name:"Deterministic tool order",summary:"tools/list returns tools in the same order every time, which keeps model prompts cacheable.",howTo:"Sort your tools in a fixed order before you return them.",owner:"server",spec:N("2026-07-28",Rr,"capabilities"),stage:"stable",lifecycle:nf,optional:!0,assessment:{primary:"checked"}},{id:"tools.stable-list",family:"tools-discovery",parent:"tools.capability",name:"Same tool list on every connection",summary:"The tool list does not change from one connection to the next, except by authorization.",howTo:"Return the same tools to every client that has the same credentials.",owner:"server",spec:N("2026-07-28",Rr,"capabilities"),stage:"stable",lifecycle:nf,optional:!1,assessment:{primary:"checked"}}],UF=[{id:"tools.annotations",family:"tool-annotations-schemas",name:"Tool annotations",summary:"Hints that describe how a tool behaves, such as whether it changes anything.",howTo:"Set annotations on each tool. Clients treat them as hints, not guarantees.",owner:"server",spec:N("2026-07-28","schema","toolannotations"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:{primary:"declared",declared:rr("tools",e=>Ad(e.annotations),["tools"])}},{id:"tools.annotations.title",family:"tool-annotations-schemas",parent:"tools.annotations",name:"annotations.title",summary:"A display title inside the annotations, used when the tool has no top-level title.",howTo:"Set annotations.title, or the tool's own title field on 2025-06-18 and later.",owner:"server",spec:N("2026-07-28","schema","toolannotations"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:{primary:"declared",declared:rr("tools",e=>lr(rf(e,"title")),["tools"],{droppedByOldSnapshots:!0})}},{id:"tools.annotations.read-only-hint",family:"tool-annotations-schemas",parent:"tools.annotations",name:"readOnlyHint",summary:"Says the tool does not change its environment, so clients can ask for less confirmation.",howTo:"Set readOnlyHint to true on tools that only read data.",owner:"server",spec:N("2026-07-28","schema","toolannotations"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:{primary:"declared",declared:vl("readOnlyHint")}},{id:"tools.annotations.destructive-hint",family:"tool-annotations-schemas",parent:"tools.annotations",name:"destructiveHint",summary:"Says whether a tool that changes things can destroy data. Without it, clients assume it can.",howTo:"Set destructiveHint to false on tools that only add data, so clients can relax confirmations.",owner:"server",spec:N("2026-07-28","schema","toolannotations"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:{primary:"declared",declared:vl("destructiveHint")}},{id:"tools.annotations.idempotent-hint",family:"tool-annotations-schemas",parent:"tools.annotations",name:"idempotentHint",summary:"Says that calling the tool again with the same arguments has no further effect.",howTo:"Set idempotentHint to true on tools that are safe to retry.",owner:"server",spec:N("2026-07-28","schema","toolannotations"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:{primary:"declared",declared:vl("idempotentHint")}},{id:"tools.annotations.open-world-hint",family:"tool-annotations-schemas",parent:"tools.annotations",name:"openWorldHint",summary:"Says whether the tool reaches outside systems such as the web. Without it, clients assume it does.",howTo:"Set openWorldHint to false on tools that only touch your own data.",owner:"server",spec:N("2026-07-28","schema","toolannotations"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:{primary:"declared",declared:vl("openWorldHint")}},{id:"tools.input-schema",family:"tool-annotations-schemas",name:"inputSchema",summary:"A JSON Schema object that describes the tool's arguments.",howTo:"Give every tool an inputSchema with type object, even when it takes no arguments.",owner:"server",spec:N("2026-07-28",Rr,"tool"),stage:"stable",lifecycle:{},optional:!1,assessment:{primary:"declared",declared:rr("tools",e=>Dt(e.inputSchema),["tools","toolSchemas"])}},{id:"tools.output-schema",family:"tool-annotations-schemas",name:"outputSchema",summary:"A JSON Schema for the tool's structured result, so clients can validate and use it.",howTo:"Add an outputSchema and return matching structuredContent. On 2026-07-28 it can describe any JSON value, such as an array.",owner:"server",spec:N("2026-07-28",Rr,"output-schema"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:{primary:"declared",declared:rr("tools",e=>Dt(e.outputSchema),["tools","toolSchemas"])}},{id:"tools.schema-dialect",family:"tool-annotations-schemas",name:"$schema dialect",summary:"Names the JSON Schema dialect a tool schema uses. Without it, clients assume 2020-12.",howTo:"Set $schema on a tool schema when it uses a dialect other than JSON Schema 2020-12.",owner:"server",spec:N("2026-07-28","basic/index","schema-dialect"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"declared",declared:NF}},{id:"tools.schema-ref-bounds",family:"tool-annotations-schemas",name:"$ref resolution",summary:"Tool schemas keep $ref pointers inside the schema, so clients resolve them without fetching anything.",howTo:"Use $defs with local $ref pointers that start with #. Do not point $ref at other URLs.",owner:"server",spec:N("2026-07-28","basic/index","ref-resolution"),stage:"stable",lifecycle:nf,optional:!0,assessment:{primary:"declared",declared:$F}},{id:"tools.execution.task-support",family:"tool-annotations-schemas",name:"execution.taskSupport",summary:"Says whether a tool can run as a task on 2025-11-25: forbidden, optional or required.",howTo:"Set execution.taskSupport to optional or required on long-running tools and declare the tasks capability.",owner:"server",spec:N("2025-11-25","basic/utilities/tasks","tool-level-negotiation"),stage:"stable",lifecycle:Z({introduced:"2025-11-25",removed:"2026-07-28"}),optional:!0,assessment:{primary:"declared",declared:LF}},{id:"tools.invalid-arguments-is-error",family:"tool-annotations-schemas",name:"Invalid arguments as tool errors",summary:"A call with bad arguments returns a result with isError, so the model can fix the call and retry.",howTo:"Validate arguments in the tool and return isError: true with a message instead of a protocol error.",owner:"server",spec:N("2026-07-28",Rr,"error-handling"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"observed"}}],Vn="basic/transports",xs="basic/transports/streamable-http",Ey="earlier-streamable-http-revisions";function qF(e){if(e==="application/json")return"Answers with a JSON body.";if(e==="text/event-stream")return"Answers with an event stream."}var zF=[{id:"transport-behavior.session-id",family:"transport-behavior",name:"Session ID (Mcp-Session-Id)",summary:"The server assigns a session at initialize so later requests and streams belong together.",howTo:"Return an Mcp-Session-Id header on the initialize response. Use visible ASCII and a value no one can guess.",owner:"server",spec:N("2025-11-25",Vn,"session-management"),stage:"stable",lifecycle:Z({introduced:"2025-03-26",removed:"2026-07-28"}),optional:!0,assessment:{primary:"probed",declared:Mt,probed:Js("http-transport",e=>{const t=Nt(e.values.sessionIdIssued);if(t===!0)return Re("probed");const r=ks(vi(e.values.protocolVersion));return t===!1&&r==="legacy"?xr(e):null})}},{id:"transport-behavior.session-delete",family:"transport-behavior",name:"Session termination (DELETE)",summary:"A client ends its session with an HTTP DELETE, and the server frees it or refuses the method.",howTo:"Handle DELETE on the MCP endpoint by ending the session named in its header, or answer 405.",owner:"server",spec:N("2025-11-25",Vn,"session-management"),stage:"stable",lifecycle:Z({introduced:"2025-03-26",removed:"2026-07-28"}),optional:!0,assessment:{primary:"checked",declared:Mt}},{id:"transport-behavior.session-expiry",family:"transport-behavior",name:"Expired session handling",summary:"A request on an expired or unknown session is refused, so the client starts a new session.",howTo:"Answer requests with an unknown Mcp-Session-Id with 404 so clients initialize again. Run the OAuth checks to test it.",owner:"server",spec:N("2025-11-25",Vn,"session-management"),stage:"stable",lifecycle:Z({introduced:"2025-03-26",removed:"2026-07-28"}),optional:!1,assessment:{primary:"checked",declared:Mt}},{id:"transport-behavior.get-stream",family:"transport-behavior",name:"Standalone GET stream",summary:"A GET opens an event stream the server uses for messages outside any request.",howTo:"Answer GET on the MCP endpoint with text/event-stream, or with 405 if you do not offer the stream.",owner:"server",spec:N("2025-11-25",Vn,"listening-for-messages-from-the-server"),stage:"stable",lifecycle:Z({introduced:"2025-03-26",removed:"2026-07-28"}),optional:!0,assessment:{primary:"checked",declared:Mt}},{id:"transport-behavior.resumability",family:"transport-behavior",name:"Resumable streams (Last-Event-ID)",summary:"Event IDs let a client reconnect and replay messages it missed after a dropped stream.",howTo:"Put an id on each SSE event and replay from Last-Event-ID when a client reconnects.",owner:"server",spec:N("2025-11-25",Vn,"resumability-and-redelivery"),stage:"stable",lifecycle:Z({introduced:"2025-03-26",removed:"2026-07-28"}),optional:!0,assessment:{primary:"observed",declared:Mt}},{id:"transport-behavior.sse-polling",family:"transport-behavior",name:"SSE polling",summary:"The server can close a stream when it wants to and sets retry, so the client reconnects to collect the rest.",howTo:"Close long streams when you need to and send a retry value so clients come back.",owner:"server",spec:N("2025-11-25",Vn,"resumability-and-redelivery"),stage:"stable",lifecycle:Z({introduced:"2025-11-25",removed:"2026-07-28"}),optional:!0,assessment:{primary:"observed",declared:Mt}},{id:"transport-behavior.server-requests-on-sse",family:"transport-behavior",name:"Server requests on event streams",summary:"The server sends sampling, elicitation or roots requests to the client over an open stream.",howTo:"Send server requests on the request's event stream or the GET stream. Use the server in Playground to see them.",owner:"server",spec:N("2025-11-25",Vn,"streamable-http"),stage:"stable",lifecycle:Z({introduced:"2025-03-26",removed:"2026-07-28"}),optional:!0,assessment:{primary:"observed",observable:!0,declared:Mt}},{id:"transport-behavior.batching",family:"transport-behavior",name:"JSON-RPC batching",summary:"Several requests or notifications travel in one JSON array.",howTo:"Accept JSON arrays of messages on 2025-03-26 only. Later revisions removed batching.",owner:"server",spec:N("2025-03-26","basic/index","batching"),stage:"stable",lifecycle:Z({introduced:"2025-03-26",removed:"2025-06-18"}),optional:!0,assessment:{primary:"checked",declared:Mt}},{id:"transport-behavior.protocol-version-header",family:"transport-behavior",name:"MCP-Protocol-Version header",summary:"Every HTTP request names its protocol version in a header the server checks.",howTo:"Read MCP-Protocol-Version on each request and answer 400 when it is invalid or disagrees with the request.",owner:"server",spec:N("2026-07-28",xs,"protocol-version-header"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!1,assessment:{primary:"checked",declared:Mt}},{id:"transport-behavior.origin-validation",family:"transport-behavior",name:"Origin validation",summary:"The server refuses requests from untrusted origins, which blocks DNS rebinding attacks on local servers.",howTo:"Check the Origin header and answer 403 when you do not trust it. Bind local servers to localhost.",owner:"server",spec:N("2026-07-28",xs),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!1,assessment:{primary:"checked",declared:Mt}},{id:"transport-behavior.response-mode",family:"transport-behavior",name:"Response mode (JSON or SSE)",summary:"The server answers each POST with one JSON body or an event stream, whichever suits the request.",howTo:"Return application/json for quick answers and text/event-stream when you send progress or logs first.",owner:"server",spec:N("2026-07-28",xs,"sending-messages"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!1,assessment:{primary:"probed",declared:Mt,probed:Js("http-transport",e=>{const t=qF(vi(e.values.responseContentType));return t?Re("probed",{detail:t}):null})}},{id:"transport-behavior.method-name-headers",family:"transport-behavior",name:"Mcp-Method and Mcp-Name headers",summary:"Each request names its method and target in headers, so gateways can route without reading the body.",howTo:"Require Mcp-Method and Mcp-Name, and answer 400 with -32020 when they are missing or disagree with the body.",owner:"server",spec:N("2026-07-28",xs,"standard-request-headers"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!1,assessment:{primary:"checked",declared:Mt}},{id:"transport-behavior.base64-headers",family:"transport-behavior",name:"Base64 header values",summary:"Header values that are not plain ASCII travel base64 encoded behind a sentinel prefix.",howTo:"Decode Mcp-Name and Mcp-Param values that carry the base64 sentinel before you compare them.",owner:"server",spec:N("2026-07-28",xs,"value-encoding"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!1,assessment:{primary:"checked",declared:Mt}},{id:"transport-behavior.x-mcp-header",family:"transport-behavior",name:"x-mcp-header parameters",summary:"A tool marks input properties that the client copies into Mcp-Param headers for routing.",howTo:"Add x-mcp-header to a tool input property to expose it as an Mcp-Param header.",owner:"server",spec:N("2026-07-28","server/tools","x-mcp-header"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!0,assessment:{primary:"declared",declared:e=>Mt(e)??rr("tools",t=>uu(t.inputSchema,r=>r["x-mcp-header"]!==void 0),["tools","toolSchemas"])(e)}},{id:"transport-behavior.get-delete-405",family:"transport-behavior",name:"GET and DELETE refused",summary:"A stateless server refuses the old GET stream and DELETE calls, so older clients fall back cleanly.",howTo:"Answer GET and DELETE on the MCP endpoint with 405 Method Not Allowed.",owner:"server",spec:N("2026-07-28",xs,Ey),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!0,assessment:{primary:"checked",declared:Mt}},{id:"transport-behavior.stateless-sessions",family:"transport-behavior",name:"No sessions",summary:"The server never mints Mcp-Session-Id and ignores session and Last-Event-ID headers.",howTo:"Drop session handling on 2026-07-28 and keep any state in requestState or your own storage.",owner:"server",spec:N("2026-07-28",xs,Ey),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!1,assessment:{primary:"probed",declared:Mt,probed:Js("http-transport",e=>{if(ks(vi(e.values.protocolVersion))!=="modern")return null;const t=Nt(e.values.sessionIdIssued);return t===!1?Re("probed"):t===!0?xr(e,"The server minted a session id."):null})}},{id:"transport-behavior.stream-close-cancellation",family:"transport-behavior",name:"Cancel by closing the stream",summary:"Closing a request's response stream cancels that request on the server.",howTo:"Stop the work when the client closes a request's response stream.",owner:"server",spec:N("2026-07-28",xs,"cancellation"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!1,assessment:{primary:"observed",declared:Mt}},{id:"transport-behavior.request-scoped-sse",family:"transport-behavior",name:"Request-scoped event streams",summary:"A request's event stream carries its progress and log notifications, then the response.",howTo:"Send progress and log notifications on the request's own stream before the final response.",owner:"server",spec:N("2026-07-28",xs,"sending-messages"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!0,assessment:{primary:"observed",declared:Mt}},{id:"transport-behavior.stdio-discover-shutdown",family:"transport-behavior",name:"stdio discovery and shutdown",summary:"A stdio server answers the client's discover probe and exits cleanly when its input closes.",howTo:"Answer server/discover over stdio, and exit when stdin closes or the process gets SIGTERM.",owner:"server",spec:N("2026-07-28","basic/transports/stdio","backward-compatibility"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!1,assessment:{primary:"declared",declared:e=>e.transport==="stdio"?gi(e)==="modern"?Re("detected",{detail:"Answered on 2026-07-28 over stdio."}):null:e.transport==="unknown"?null:yr("Applies to stdio servers. This server runs over HTTP.")}}],FF=[...kF,...pF,...hF,...zF,...fF,...mF,...DF,...UF,...xF,...bF,...SF,...wF,...IF,...RF,...CF,...uF,...lF],pi="https://github.com",Ty=`${pi}/modelcontextprotocol/ext-apps/blob/ea3e9d0e624a20bc1c51310292f09d9b8ed17161/specification`,Ay=`${pi}/modelcontextprotocol/ext-auth/blob/15ca394e00a66434520b9ade26294999295a43ae/specification/stable`,Iy=`${pi}/modelcontextprotocol/ext-server-card/blob/526201bbc80231daa40ffcdecfc9da4e54e5dc93`,jF={apps:`${Ty}/2026-01-26/apps.mdx`,"apps-draft":`${Ty}/draft/apps.mdx`,tasks:`${pi}/modelcontextprotocol/ext-tasks/blob/cc9aaac1047a9440b07486e38f37060bbebeef4c/specification/2026-07-28/tasks.md`,skills:`${pi}/modelcontextprotocol/ext-skills/blob/649f7aee87d631ac4d1fdd3b12eef0c6264fdb3a/specification/beta/skills.mdx`,events:`${pi}/modelcontextprotocol/ext-events/blob/47d95c979faa73427e1f6e0ac0c1347559d8ea37/docs/design-sketch-proposal.md`,"client-credentials":`${Ay}/oauth-client-credentials/2026-07-28/oauth-client-credentials.mdx`,"enterprise-managed-authorization":`${Ay}/enterprise-managed-authorization/2026-07-28/enterprise-managed-authorization.mdx`,"server-card-discovery":`${Iy}/docs/discovery.md`,"server-card-schema":`${Iy}/schema.ts`,openai:`${pi}/openai/mcp-extensions/blob/39f91ad0bdf1435aadb879172ab2467d0e97cead/docs/spec.md`},HF={apps:"ext-apps","apps-draft":"ext-apps",tasks:"ext-tasks",skills:"ext-skills",events:"ext-events","client-credentials":"ext-auth","enterprise-managed-authorization":"ext-auth","server-card-discovery":"ext-server-card","server-card-schema":"ext-server-card",openai:"openai-mcp-extensions"};function re(e,t){const r=`${jF[e]}${t?`#${t}`:""}`;return Na(HF[e],r)}function Rs(e,t){return r=>({family:e,owner:"server",stage:t,lifecycle:{},optional:!0,...r})}function Ys(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ut(e,t){if(!Ys(e))return;const r=e[t];return Ys(r)?r:void 0}function Es(e,t){if(!Ys(e))return;const r=e[t];return typeof r=="string"?r:void 0}function vs(e){return Ut(e,"_meta")}function Ai(e){return Ys(e.capabilities)?e.capabilities:void 0}function Lr(e,t){return t.every(r=>e.coverage[r]==="complete")}function Cd(e,t,r){return`${e} of ${t} ${r}`}function Xs(e,t,r=["extensions"]){const s=Ai(e);if(!s)return{state:"not-captured"};for(const n of r){const i=Ut(s,n);if(!i||!Object.prototype.hasOwnProperty.call(i,t))continue;const o=`${n}["${t}"]`,a=i[t];return Ys(a)?{state:"declared",settings:a,location:o}:{state:"malformed",location:o}}return{state:"not-declared"}}function PT(e,t,r,s){const n=Xs(e,t,s);switch(n.state){case"declared":return{kind:"present",via:"advertised",detail:n.location};case"malformed":return{kind:"unknown",reason:`${r} is declared with a value that is not an object, so clients ignore it.`};case"not-captured":return{kind:"unknown",reason:"The server's capabilities were not captured."};case"not-declared":return BF(e)}}function BF(e){const t=ks(e.protocolVersion);return t==="modern"?{kind:"absent",basis:["capabilities"]}:t==="legacy"?{kind:"unknown",reason:`Version ${e.protocolVersion} has no official extensions field, so a missing declaration proves nothing.`}:{kind:"unknown",reason:"The protocol version of this capture is unknown, so a missing declaration proves nothing."}}function Pd(e,t,r){return t?.kind==="absent"&&Lr(e,t.basis)?{kind:"not-applicable",reason:r}:null}function Bt(e){return typeof e=="boolean"?e:void 0}function Dr(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function VF(e){return typeof e=="string"?e:void 0}function du(e){if(Array.isArray(e))return e.filter(t=>typeof t=="string")}var GF={failed:"did not finish. Refresh to try again.",skipped:"was skipped for this connection.",abandoned:"stopped because the server asked for input."};function Qo(e,t){if(!e)return null;if(e.status!=="ok")return e.status==="not-applicable"?{kind:"not-applicable",reason:`The ${t} check does not apply to this server.`}:{kind:"unknown",reason:`The ${t} check ${GF[e.status]}`}}var Xt=Rs("mcp-apps","stable"),Hg="ui://",WF="ui/resourceUri";function xT(e){return Ut(vs(e),"ui")}function of(e){return Es(xT(e),"resourceUri")}function OT(e){return Es(vs(e),WF)}function MT(e){const t=Es(e,"uri");return t!==void 0&&t.startsWith(Hg)&&Es(e,"mimeType")==="text/html;profile=mcp-app"}var LT=["tools","toolMeta"];function KF(e){return e.tools.map(t=>of(t)??OT(t)).filter(t=>t!==void 0&&t.startsWith(Hg))}function JF(e){if(!(e.tools.length>0||!Lr(e,["tools"])))return{kind:"not-applicable",reason:"This server lists no tools."}}function Ry(e,t){const r=JF(e);if(r)return r;const s=e.tools.filter(t).length;return s>0?{kind:"present",via:"detected",count:s,detail:Cd(s,e.tools.length,"tools")}:{kind:"absent",basis:LT}}function Cy(e){const t=e.resources.filter(MT).length;if(t>0)return{kind:"present",via:"detected",count:t,detail:`${t} listed UI resources`};const r=new Set(KF(e)).size;return r>0?{kind:"present",via:"detected",count:r,detail:"Linked from tool metadata and not listed in resources/list"}:{kind:"absent",basis:["resources","tools","toolMeta"]}}function YF(e){return t=>{const r=t.resources.filter(s=>{if(!MT(s))return!1;const n=Ut(vs(s),"ui");return n!==void 0&&n[e]!==void 0}).length;return r>0?{kind:"present",via:"detected",count:r,detail:`${r} listed UI resources`}:null}}function NT(e){const t=e["apps-ui-resources"],r=Qo(t,"UI resource");return r!==void 0||!t?{outcome:r??null}:Dr(t.values.uiResourceCount)===0?{outcome:{kind:"not-applicable",reason:"This server has no UI resources to read."}}:(Dr(t.values.readCount)??0)===0?{outcome:{kind:"unknown",reason:(Dr(t.values.abandonedInputRequired)??0)>0?"Reading the UI resources stopped because the server asked for input.":"No UI resource could be read."}}:{probe:t}}function XF(e){return t=>{const r=NT(t);if("outcome"in r)return r.outcome;const{probe:s}=r,n=Bt(s.values[e]),i=Dr(s.values.readCount)??0;return n===!0?{kind:"present",via:"detected",count:i}:n===!1&&s.coverage==="complete"&&(Dr(s.values.readFailures)??0)===0?{kind:"absent",basis:[]}:{kind:"unknown",reason:"Some UI resources could not be read."}}}function _l(e,t,r,s,n,i){return Xt({id:e,parent:"apps.resource-content",name:t,summary:n,howTo:i,spec:re("apps-draft","metadata-location"),assessment:{primary:"probed",declared:YF(r),probed:XF(s),requiresClientExtension:dn}})}function rn(e){return Xt({parent:"apps.bridge",owner:"host",...e,assessment:{primary:"observed",observable:!0}})}var zr="Open the server in the Playground and call a tool that renders a view.",ZF=[Xt({id:"apps.client-ui-capability",name:"Client declares MCP Apps support (mimeTypes)",summary:"The host tells the server it can render views of type text/html;profile=mcp-app.",howTo:"Hosts declare io.modelcontextprotocol/ui with mimeTypes in their client capabilities. MCPJam sends it when the selected client renders MCP Apps, and the capture context shows what was sent.",owner:"client",spec:re("apps","clientserver-capability-negotiation"),assessment:{primary:"declared"}}),Xt({id:"apps.views",name:"Views and tool links",summary:"Tools that open an interactive HTML view in the host.",howTo:"Register a ui:// resource with text/html;profile=mcp-app and point a tool's _meta.ui.resourceUri at it.",spec:re("apps","resource-discovery"),assessment:{primary:"declared",declared:Cy,requiresClientExtension:dn}}),Xt({id:"apps.ui-resource",parent:"apps.views",name:"UI resource (ui:// with text/html;profile=mcp-app)",summary:"An HTML view the host renders in a sandbox next to the conversation.",howTo:"Serve the view as a resource with a ui:// URI and mimeType text/html;profile=mcp-app. Listing it in resources/list is optional.",spec:re("apps","ui-resource-format"),assessment:{primary:"declared",declared:Cy,probed:e=>{const t=e["apps-ui-resources"];if(t?.status!=="ok")return null;const r=Dr(t.values.uiResourceCount)??0;return r>0?{kind:"present",via:"detected",count:r}:null},requiresClientExtension:dn}}),Xt({id:"apps.tool-resource-uri",parent:"apps.views",name:"Tool _meta.ui.resourceUri",summary:"Links a tool to the view the host shows when the tool runs.",howTo:'Set _meta: { ui: { resourceUri: "ui://..." } } on the tool.',spec:re("apps","resource-discovery"),assessment:{primary:"declared",declared:e=>Ry(e,t=>(of(t)??"").startsWith(Hg)),requiresClientExtension:dn}}),Xt({id:"apps.legacy-resource-uri",parent:"apps.views",name:'Tool _meta["ui/resourceUri"] (deprecated)',summary:"The older flat key for a tool's view, due to be removed before GA.",howTo:"Move the value to _meta.ui.resourceUri. The ext-apps SDK writes both keys, which is fine.",spec:re("apps","resource-discovery"),assessment:{primary:"declared",declared:e=>{const t=e.tools.filter(s=>OT(s)!==void 0),r=t.filter(s=>of(s)===void 0).length;return r>0?{kind:"present",via:"detected",count:r,detail:`${Cd(r,e.tools.length,"tools")} use only the deprecated key`}:t.length>0?{kind:"not-applicable",reason:"The deprecated key only mirrors _meta.ui.resourceUri, as the ext-apps SDK writes both."}:Lr(e,LT)?{kind:"not-applicable",reason:"Not used. Servers should use _meta.ui.resourceUri."}:null}}}),Xt({id:"apps.visibility",parent:"apps.views",name:"Tool _meta.ui.visibility (model, app)",summary:"Chooses whether the model, the view, or both can call a tool.",howTo:'Set _meta.ui.visibility to ["app"] for tools only the view should call. The default is ["model", "app"].',spec:re("apps","visibility"),assessment:{primary:"declared",declared:e=>Ry(e,t=>Array.isArray(xT(t)?.visibility)),requiresClientExtension:dn}}),Xt({id:"apps.resource-content",name:"UI resource content and policy",summary:"The view's HTML and the security and rendering metadata the host applies to it.",howTo:"Return the HTML from resources/read and put csp, permissions, domain and prefersBorder under the content item's _meta.ui.",spec:re("apps-draft","metadata-location"),assessment:{primary:"probed",requiresClientExtension:dn}}),_l("apps.csp","CSP domains (connect, resource, frame, baseUri)","csp","cspDeclared","Lets the view load data and assets from the domains the server names.","Set _meta.ui.csp with connectDomains, resourceDomains, frameDomains or baseUriDomains on the UI resource content."),_l("apps.permissions","Permissions (camera, microphone, geolocation, clipboardWrite)","permissions","permissionsDeclared","Asks the host for device permissions the view needs.","Set _meta.ui.permissions on the UI resource content with the permissions the view uses."),_l("apps.domain","Dedicated domain","domain","domainDeclared","Gives the view a stable origin, for example for OAuth redirects or API keys.","Set _meta.ui.domain on the UI resource content."),_l("apps.prefers-border","prefersBorder","prefersBorder","prefersBorderDeclared","Tells the host whether to draw a border around the view.","Set _meta.ui.prefersBorder to true or false on the UI resource content."),Xt({id:"apps.html-content",parent:"apps.resource-content",name:"HTML content (text or blob)",summary:"The UI resource returns one HTML document the host can render.",howTo:"Return exactly one content item with mimeType text/html;profile=mcp-app and the HTML in text or blob.",spec:re("apps-draft","content-requirements"),assessment:{primary:"probed",probed:e=>{const t=NT(e);if("outcome"in t)return t.outcome;const r=Bt(t.probe.values.htmlProfileOk);return r===!0?{kind:"present",via:"probed",count:Dr(t.probe.values.readCount)??0}:{kind:"unknown",reason:r===!1?"A UI resource did not return text/html;profile=mcp-app content. Run checks for details.":"The HTML content was not checked."}},requiresClientExtension:dn}}),Xt({id:"apps.server-behavior",name:"Server behavior with Apps hosts",summary:"How the server adapts its tools and results to hosts that render views.",howTo:zr,spec:re("apps","server-behavior"),assessment:{primary:"observed"}}),Xt({id:"apps.ui-conditional-tools",parent:"apps.server-behavior",name:"Tool set conditional on the UI capability",summary:"The server offers UI tools only to hosts that declare MCP Apps support.",howTo:"Read the client's io.modelcontextprotocol/ui capability and register UI tools only when it is present.",spec:re("apps","server-behavior"),assessment:{primary:"probed"}}),Xt({id:"apps.text-fallback",parent:"apps.server-behavior",name:"Text fallback content on UI tools",summary:"UI tools also return text, so hosts without views still show a useful result.",howTo:"Return text content alongside structuredContent from tools that link a view.",spec:re("apps","server-behavior"),assessment:{primary:"observed",observable:!0}}),Xt({id:"apps.bridge",name:"View and host messages",summary:"The messages a view and its host exchange while the view is open.",howTo:zr,owner:"host",spec:re("apps","standard-mcp-messages"),assessment:{primary:"observed"}}),rn({id:"apps.app-tools-call",name:"View-originated tools/call",summary:"The view calls the server's tools through the host, which enforces visibility.",howTo:`${zr} Use a control in the view that calls a tool.`,spec:re("apps","standard-mcp-messages")}),rn({id:"apps.app-resources-read",name:"View-originated resources/read",summary:"The view reads the server's resources through the host.",howTo:zr,spec:re("apps","standard-mcp-messages")}),rn({id:"apps.view-requests",name:"View requests (ui/open-link, ui/message, ui/update-model-context, ui/request-display-mode)",summary:"The view asks the host to open links, send messages, update model context or change display mode.",howTo:zr,owner:"app",spec:re("apps","requests-view--host")}),rn({id:"apps.view-notifications",name:"View logging and ping",summary:"The view sends notifications/message logs and ping to the host.",howTo:zr,owner:"app",spec:re("apps","standard-mcp-messages")}),rn({id:"apps.host-notifications",name:"Host notifications to the view",summary:"The host sends tool input, partial input, results, cancellation, context and size changes, and teardown to the view.",howTo:zr,spec:re("apps","notifications-host--view")}),rn({id:"apps.display-modes",name:"Display modes (inline, fullscreen, pip)",summary:"The view lists the display modes it supports in ui/initialize.",howTo:`${zr} Switch the view between inline, fullscreen and picture in picture.`,owner:"app",spec:re("apps","app-capabilities-in-uiinitialize")}),Xt({id:"apps.draft",name:"Draft additions",summary:"View features in the Apps draft that are not in the stable specification yet.",howTo:zr,owner:"app",stage:"experimental",spec:re("apps-draft"),assessment:{primary:"observed"}}),rn({id:"apps.download-file-teardown",parent:"apps.draft",name:"ui/download-file and ui/notifications/request-teardown",summary:"The view asks the host to download a file or to close the view.",howTo:zr,owner:"app",stage:"experimental",spec:re("apps-draft")}),rn({id:"apps.app-provided-tools",parent:"apps.draft",name:"App-provided tools",summary:"The view offers its own tools to the host through tools/list and tools/call, separate from the server's tools.",howTo:zr,owner:"app",stage:"experimental",spec:re("apps-draft","app-provided-tools")})],$T="io.modelcontextprotocol/oauth-client-credentials",DT="io.modelcontextprotocol/enterprise-managed-authorization",QF="urn:ietf:params:oauth:grant-profile:id-jag",Fr=Rs("authorization-extensions","stable");function ej(e,t,r){const s=e.authorization,n=Qo(s,"authorization metadata");if(n!==void 0||!s)return{outcome:n??null};const i=s.values;if(Bt(i.oauthRequired)===!1&&Bt(i.oauthOptional)===!1)return{outcome:{kind:"not-applicable",reason:"This server does not use OAuth."}};if(Bt(i.asMetadataFound)!==!0)return{outcome:{kind:"unknown",reason:"No authorization server metadata was found."}};const o=du(i[t]);return!o||o.length===0?{outcome:{kind:"unknown",reason:`The authorization server metadata has no ${r}.`}}:{list:o}}function yp(e,t,r,s){const n=ej(e,t,r);if("outcome"in n)return n.outcome;const{list:i}=n,o=s.filter(a=>i.includes(a));return o.length>0?{kind:"present",via:"advertised",detail:`${r} lists ${o.join(", ")}`}:e.authorization?.coverage!=="complete"?{kind:"unknown",reason:"The authorization metadata was read only in part."}:{kind:"absent",basis:[],detail:`${r} lists ${i.join(", ")}`}}var tj=[Fr({id:"auth-ext.client-credentials",name:"OAuth Client Credentials",summary:"Lets a machine client get tokens for the server without a user.",howTo:"Enable the client_credentials grant on your authorization server for MCP clients. The MCPJam app cannot run this grant yet; test it with mcpjam oauth login --url <server-url> --auth-mode client_credentials.",owner:"authorization-server",spec:re("client-credentials"),assessment:{primary:"configured",declared:We,setup:"client-credentials"}}),Fr({id:"auth-ext.client-credentials.grant",parent:"auth-ext.client-credentials",name:"client_credentials grant",summary:"The authorization server issues tokens to a client acting on its own behalf.",howTo:"List client_credentials in grant_types_supported and issue tokens for the MCP resource. The MCPJam app cannot run this grant yet; test it with mcpjam oauth login --url <server-url> --auth-mode client_credentials.",owner:"authorization-server",spec:re("client-credentials","server-metadata-requirements"),assessment:{primary:"configured",declared:We,setup:"client-credentials",probed:e=>yp(e,"grantTypesSupported","grant_types_supported",["client_credentials"])}}),Fr({id:"auth-ext.client-credentials.token-auth-methods",parent:"auth-ext.client-credentials",name:"token_endpoint_auth_methods_supported",summary:"Tells clients they can authenticate at the token endpoint with private_key_jwt or client_secret_basic.",howTo:"List private_key_jwt or client_secret_basic in token_endpoint_auth_methods_supported in your authorization server metadata.",owner:"authorization-server",spec:re("client-credentials","server-metadata-requirements"),assessment:{primary:"probed",declared:We,probed:e=>yp(e,"tokenEndpointAuthMethods","token_endpoint_auth_methods_supported",["private_key_jwt","client_secret_basic"])}}),Fr({id:"auth-ext.client-credentials.token-request",parent:"auth-ext.client-credentials",name:"Client credentials token request",summary:"The client requests a token with its own credentials and calls the server with it.",howTo:"Issue the client a client id and secret. The MCPJam app cannot run this grant yet; test it with mcpjam oauth login --url <server-url> --auth-mode client_credentials, adding --registration preregistered --client-id <id> --client-secret <secret> for a pre-registered client.",owner:"client",spec:re("client-credentials","flow-steps"),assessment:{primary:"configured",declared:We,setup:"client-credentials"}}),Fr({id:"auth-ext.xaa",name:"Enterprise-Managed Authorization (XAA)",summary:"Lets an enterprise identity provider grant access to the server through single sign-on.",howTo:"Accept ID-JAG assertions at your authorization server. MCPJam cannot record an XAA connect on this page yet.",owner:"authorization-server",spec:re("enterprise-managed-authorization"),assessment:{primary:"configured",declared:We,setup:"enterprise-managed-authorization"}}),Fr({id:"auth-ext.xaa.access",parent:"auth-ext.xaa",name:"Enterprise-managed access",summary:"A user signed in to the enterprise identity provider reaches the server without a separate consent screen.",howTo:"Accept access tokens for users the enterprise identity provider signs in. MCPJam cannot record an XAA connect on this page yet.",owner:"authorization-server",spec:re("enterprise-managed-authorization"),assessment:{primary:"configured",declared:We,setup:"enterprise-managed-authorization"}}),Fr({id:"auth-ext.xaa.id-jag-profile",parent:"auth-ext.xaa",name:"ID-JAG grant profile",summary:"The authorization server advertises that it accepts Identity Assertion JWT Authorization Grants.",howTo:"List urn:ietf:params:oauth:grant-profile:id-jag in authorization_grant_profiles_supported in your authorization server metadata.",owner:"authorization-server",spec:re("enterprise-managed-authorization","6-discovery"),assessment:{primary:"probed",declared:We,probed:e=>yp(e,"authorizationGrantProfiles","authorization_grant_profiles_supported",[QF])}}),Fr({id:"auth-ext.xaa.token-exchange",parent:"auth-ext.xaa",name:"Identity provider token exchange",summary:"The identity provider exchanges the user's ID token for an ID-JAG (RFC 8693).",howTo:"Configure token exchange for ID-JAG on your identity provider.",owner:"identity-provider",spec:re("enterprise-managed-authorization","4-token-exchange"),assessment:{primary:"configured",declared:We,setup:"enterprise-managed-authorization"}}),Fr({id:"auth-ext.xaa.jwt-bearer",parent:"auth-ext.xaa",name:"JWT bearer access token request",summary:"The resource authorization server trades an ID-JAG for an access token with the JWT bearer grant.",howTo:"Accept the urn:ietf:params:oauth:grant-type:jwt-bearer grant with ID-JAG assertions at your authorization server.",owner:"authorization-server",spec:re("enterprise-managed-authorization","5-access-token-request"),assessment:{primary:"configured",declared:We,setup:"enterprise-managed-authorization"}}),Fr({id:"auth-ext.xaa.saml",parent:"auth-ext.xaa",name:"SAML assertion to ID-JAG",summary:"An identity provider that uses SAML issues a refresh token, then an ID-JAG, for the user.",howTo:"Configure the SAML exchange on your identity provider.",owner:"identity-provider",spec:re("enterprise-managed-authorization","4-token-exchange"),assessment:{primary:"configured",declared:We,setup:"enterprise-managed-authorization"}}),Fr({id:"auth-ext.discover-extension-ids",name:"Authorization extension ids in server/discover",summary:"The server names the authorization extensions it accepts in its extensions map.",howTo:"Add io.modelcontextprotocol/oauth-client-credentials or io.modelcontextprotocol/enterprise-managed-authorization to the extensions your server declares.",spec:sF("ext-auth","auth/overview"),lifecycle:{introduced:"2026-07-28"},assessment:{primary:"declared",declared:e=>{const t=We(e);if(t)return t;const r=[$T,DT].filter(s=>Xs(e,s).state==="declared");return r.length>0?{kind:"present",via:"advertised",detail:r.join(", ")}:{kind:"unknown",reason:"The authorization extensions define no server capability, so a missing id proves nothing."}}}})],Py="beta@c77b843",Bg="draft@28ec35e",UT="chatgpt@2026-11-05",qT="chatgpt@2026-09-30",rj="https://github.com/modelcontextprotocol/experimental-ext-triggers-events/blob/28ec35e905daa241f019981e2836b4a02f1c0368/docs/design-sketch-proposal.md",sj="https://developers.openai.com/plugins/build/mcp-events",Gn=e=>({kind:"documented",source:rj,section:e}),Hr=e=>({kind:"documented",source:sj,section:e}),Cr=e=>({kind:"policy",note:e}),bp="sdk/scripts/chatgpt-events-probe.ts",xy={id:Bg,title:"MCP Events draft (working group, pinned 28ec35e)",capabilityPlacement:{value:"capabilities.events",provenance:Gn("Capability Declaration")},protocolVersions:{value:["2025-11-25","2026-07-28"],provenance:Cr("The draft is version-agnostic; MCPJam exercises it on both eras it speaks.")},transports:{value:["stdio","sse","streamable-http"],provenance:Cr("The draft is transport-agnostic.")},deliveryModes:{value:["poll","push","webhook"],provenance:Gn("Subscribing and Event Delivery")},controlEnvelopes:{value:["gap","terminated","verification"],provenance:Gn("Non-event webhook bodies")},maxBodyBytes:{value:{bytes:262144,strength:"SHOULD"},provenance:Gn("Delivery profile")},nonRetryableStatuses:{value:[410,413],provenance:Gn("Webhook Event Delivery; Delivery profile")},consentMethods:{value:["challenge","allowlist","out-of-band","well-known"],provenance:Gn("Endpoint verification")},requestedTtlMs:{value:36e5,provenance:Cr("MCPJam requests one hour; servers may clamp.")},secretBytes:{value:32,provenance:Cr("CSPRNG, middle of the draft's 24–64 byte window.")},refreshLead:{value:"max(60 s, 10% of the remaining grant) before refreshBefore",provenance:Cr("MCPJam keeper schedule.")},unsubscribesOnEnd:{value:!0,provenance:Cr("Removing a subscription in MCPJam always unsubscribes.")},batching:{value:"off",provenance:Cr("One event, one turn, unless a host profile opts in.")},retention:{value:"UI history 7 days / 5,000 entries per inbox; pending work 72 h; dedupe 7 days (proposed)",provenance:Cr("MCPJam inbox policy — open question 1 in the plan.")},prompting:{value:"Event data is passed as an untrusted, clearly delimited context block; the trigger's instructions are the only instructions.",provenance:Cr("MCPJam event-job executor.")},pollFloorMs:{value:1e3,provenance:Gn("Poll-Based Delivery (nextPollMs floor, default 1000 ms)")}},zT={id:UT,title:"ChatGPT (as of 2026-11-05)",capabilityPlacement:{value:"capabilities.events",provenance:Hr("Advertise event support")},protocolVersions:{value:[...cP],provenance:Hr("Before you start")},transports:{value:["streamable-http"],provenance:Hr("Before you start")},deliveryModes:{value:["webhook"],provenance:Hr("Before you start")},controlEnvelopes:{value:["verification"],provenance:Hr("Before you start (gap and terminated are not supported); Verify the callback")},maxBodyBytes:{value:{bytes:262144,strength:"MUST"},provenance:Hr("Handle delivery responses")},nonRetryableStatuses:{value:[410,413],provenance:Hr("Handle delivery responses")},consentMethods:{value:["challenge"],provenance:Hr("Verify the callback")},requestedTtlMs:{value:"unknown",provenance:{kind:"unobserved",probe:bp}},secretBytes:{value:"unknown",provenance:{kind:"unobserved",probe:bp}},refreshLead:{value:"before refreshBefore (exact lead unknown)",provenance:{kind:"unobserved",probe:bp}},unsubscribesOnEnd:{value:!0,provenance:Hr("Test in ChatGPT, step 9 (stop monitoring → events/unsubscribe)")},batching:{value:"host-setting",provenance:Hr("Handle delivery responses (task batching settings)")},retention:{value:"Not observable. MCPJam emulation applies its own inbox policy (7 days / 5,000 entries; pending 72 h).",provenance:Cr("ChatGPT's retention is internal; this is MCPJam's stated policy, not ChatGPT's.")},prompting:{value:"Not observable. MCPJam emulation presents the event as untrusted data under the user's standing instruction.",provenance:Cr("ChatGPT's internal prompting is not observable; this is MCPJam's own.")},pollFloorMs:{value:1e3,provenance:Cr("Poll is unsupported by ChatGPT; the draft floor applies.")}},nj={...zT,id:qT,title:"ChatGPT (as of 2026-09-30, historical)",protocolVersions:{value:["2026-07-28"],provenance:Hr("Before you start")}},Sp={kind:"documented",source:"https://github.com/modelcontextprotocol/ext-events/blob/c77b84395eff0ae32f53b0516c2214fe276ed050/specification/beta/events/events.mdx"},y7={[Py]:{...xy,id:Py,title:"MCP Events beta (SEP-3415)",capabilityPlacement:{value:"capabilities.extensions['io.modelcontextprotocol/events']",provenance:Sp},protocolVersions:{value:["2026-07-28"],provenance:Sp},transports:{value:["stdio","streamable-http"],provenance:Sp}},[Bg]:xy,[UT]:zT,[qT]:nj},zs=Rs("events","sketch"),ij="The server does not declare capabilities.events.";function af(e){const t=Ai(e);if(!t)return{kind:"unknown",reason:"The server's capabilities were not captured."};const r=t.events;return r===void 0?{kind:"absent",basis:["capabilities"]}:Ys(r)?{kind:"present",via:"advertised",detail:r.listChanged===!0?"listChanged: true":"capabilities.events"}:{kind:"unknown",reason:"capabilities.events is not an object, so clients ignore it."}}function fn(e){return Pd(e,af(e),ij)}function yl(e){return t=>{const r=t["events-list"],s=Qo(r,"events/list");if(s!==void 0||!r)return s??null;if(Bt(r.values.listed)!==!0)return null;const n=du(r.values.deliveryModes)??[];return n.includes(e)?{kind:"present",via:"advertised",detail:`events/list offers ${n.join(", ")}`}:n.length===0||r.coverage!=="complete"?null:{kind:"absent",basis:[],detail:`events/list offers ${n.join(", ")}`}}}function wp(e){return zs({...e,assessment:{primary:"observed",observable:!0,declared:fn}})}function kp(e){return zs({parent:"events.webhooks",...e,assessment:{primary:"configured",setup:"event-webhook",declared:fn}})}var bl="Subscribe to one of the server's events in MCPJam and watch Tracing.",va="Accept webhook subscriptions and deliver events to the subscriber's URL. You can subscribe a webhook from the Events tab; this page does not record deliveries yet.",oj=[zs({id:"events.capability",name:"capabilities.events (listChanged)",summary:"Tells clients the server has events they can poll, stream or receive by webhook.",howTo:"Declare a top-level capabilities.events object, with listChanged: true if your event list can change.",spec:re("events","capability-declaration"),assessment:{primary:"declared",declared:af}}),zs({id:"events.list",name:"events/list",summary:"Lists each event with its description, input and payload schemas, and delivery modes.",howTo:"Answer events/list with name, description, delivery, inputSchema and payloadSchema per event.",spec:re("events","listing-available-events"),assessment:{primary:"probed",declared:fn,probed:e=>{const t=e["events-list"],r=Qo(t,"events/list");return r!==void 0||!t?r??null:Bt(t.values.listed)!==!0?{kind:"unknown",reason:"events/list did not answer."}:{kind:"present",via:"probed",count:Dr(t.values.eventCount)??0}}}}),zs({id:"events.list-changed",name:"notifications/events/list_changed",summary:"Tells clients when the server's event list changes.",howTo:"Send notifications/events/list_changed after the event list changes.",spec:re("events","dynamic-event-types"),assessment:{primary:"observed",observable:!0,declared:e=>af(e)?.kind!=="present"?fn(e):Ut(Ai(e),"events")?.listChanged===!0?{kind:"unknown",reason:"The server promises list change notifications. None has been seen yet."}:{kind:"absent",basis:["capabilities"]}}}),zs({id:"events.poll",name:"events/poll",summary:"Clients fetch new occurrences with a cursor at their own pace.",howTo:"Offer poll delivery in events/list and answer events/poll.",spec:re("events","poll-based-delivery"),assessment:{primary:"checked",observable:!0,declared:fn,probed:yl("poll")}}),zs({id:"events.stream",name:"events/stream with event and heartbeat notifications",summary:"The server pushes occurrences and heartbeats on an open stream.",howTo:`Offer push delivery in events/list and answer events/stream. ${bl}`,spec:re("events","push-based-delivery"),assessment:{primary:"observed",observable:!0,declared:fn,probed:yl("push")}}),zs({id:"events.webhooks",name:"Webhook delivery",summary:"The server delivers occurrences to a webhook the client registers.",howTo:va,spec:re("events","webhook-based-delivery"),assessment:{primary:"configured",setup:"event-webhook",declared:fn,probed:yl("webhook")}}),zs({id:"events.webhook-subscribe",parent:"events.webhooks",name:"events/subscribe (Standard Webhooks, TTL and refreshBefore)",summary:"Registers a signed webhook subscription that the client refreshes before it expires.",howTo:va,spec:re("events","webhook-based-delivery"),assessment:{primary:"configured",setup:"event-webhook",declared:fn,probed:yl("webhook")}}),kp({id:"events.endpoint-verification",name:"Webhook endpoint verification",summary:"The server confirms the receiver consents before delivering, by challenge, allowlist or well-known file.",howTo:va,spec:re("events","webhook-security")}),kp({id:"events.unsubscribe",name:"events/unsubscribe",summary:"Ends a webhook subscription.",howTo:va,spec:re("events","unsubscribing")}),kp({id:"events.delivery-status",name:"deliveryStatus",summary:"Reports whether recent webhook deliveries succeeded.",howTo:va,spec:re("events","webhook-delivery-status")}),wp({id:"events.terminated",name:"notifications/events/terminated",summary:"Tells the client a subscription or stream has ended and why.",howTo:bl,spec:re("events","authorization")}),wp({id:"events.cursor-replay",name:"Cursor replay, maxAgeMs and truncation",summary:"Clients resume from a cursor and learn when old occurrences were dropped.",howTo:bl,spec:re("events","cursor-lifecycle")}),wp({id:"events.error-codes",name:"Events error codes",summary:`Events errors use -32011 to -32015 in MCPJam's pinned ${Bg} profile or -32023 to -32027 in the current provisional sketch, and either is accepted.`,howTo:bl,spec:re("events","error-codes")})],aj=Rs("server-cards","beta"),cj="Server Card",lj="/server-card",cf="No Server Card was found.";function ro(e){const t=e["server-card"],r=Qo(t,cj);return r!==void 0||!t?{outcome:r??null}:{probe:t}}function lf(e,t){return e.coverage!=="complete"?{kind:"unknown",reason:"The Server Card check finished only in part."}:t===void 0?{kind:"absent",basis:[]}:{kind:"absent",basis:[],detail:t}}function Os(e,t){return r=>{const s=ro(r);if("outcome"in s)return s.outcome;const{probe:n}=s;if(t.needsCard&&Bt(n.values.serverCardFound)!==!0)return{kind:"not-applicable",reason:cf};const i=Bt(n.values[e]);return i===!0?{kind:"present",via:t.via??"probed"}:i===void 0?{kind:"unknown",reason:"This part of the card was not checked."}:t.whenFalse==="absent"?lf(n):{kind:"unknown",reason:t.whenFalse}}}function Tr(e,t){return aj({...e,assessment:{primary:"probed",probed:t}})}var uj=[Tr({id:"server-cards.ai-catalog",name:"AI Catalog (/.well-known/ai-catalog.json)",summary:"A domain-level catalog that points clients to the server's card before they connect.",howTo:"Publish /.well-known/ai-catalog.json on your domain with the media type application/ai-catalog+json.",spec:re("server-card-discovery","well-known-uri")},Os("aiCatalogFound",{needsCard:!1,whenFalse:"absent"})),Tr({id:"server-cards.catalog-entry",name:"Server Card entry in the AI Catalog",summary:"The catalog lists this server's card by URL or inline data.",howTo:"Add an entry with type application/mcp-server-card+json and the card's url or data to your AI Catalog.",spec:re("server-card-discovery","server-card-entries")},e=>{const t=ro(e);return"outcome"in t?t.outcome:Bt(t.probe.values.aiCatalogFound)!==!0?{kind:"not-applicable",reason:"No AI Catalog was found."}:Os("catalogEntryFound",{needsCard:!1,whenFalse:"absent"})(e)}),Tr({id:"server-cards.hosted-card",name:"Hosted card at <server URL>/server-card",summary:"Clients that know the server URL can fetch its card without an AI Catalog.",howTo:"Serve the card with GET at your Streamable HTTP URL followed by /server-card.",spec:re("server-card-discovery","hosted-server-card-location")},e=>{const t=ro(e);if("outcome"in t)return t.outcome;const r=VF(t.probe.values.serverCardUrl);return Bt(t.probe.values.serverCardFound)===!0&&r?.endsWith(lj)?{kind:"present",via:"probed"}:lf(t.probe)}),Tr({id:"server-cards.media-type",name:"Media type application/mcp-server-card+json",summary:"Clients recognize the response as a Server Card.",howTo:"Serve the card with Content-Type application/mcp-server-card+json.",optional:!1,spec:re("server-card-discovery","hosted-server-card-location")},Os("mediaTypeOk",{needsCard:!0,whenFalse:"The card was served with a different media type."})),Tr({id:"server-cards.required-fields",name:"Required fields ($schema, name, version, description)",summary:"The card identifies the server with a schema URL, reverse-DNS name, version and short description.",howTo:"Include $schema, a reverse-DNS name, version and a description of at most 100 characters.",optional:!1,spec:re("server-card-schema")},e=>{const t=ro(e);if("outcome"in t)return t.outcome;const r=du(t.probe.values.missingFields)??[];return Os("requiredFieldsOk",{needsCard:!0,whenFalse:r.length>0?`The card is missing ${r.join(", ")}.`:"The card is missing required fields."})(e)}),Tr({id:"server-cards.optional-fields",name:"title, websiteUrl, repository and icons",summary:"Optional fields that help people recognize the server in a directory.",howTo:"Add title, websiteUrl, repository and icons to the card.",spec:re("server-card-schema")},e=>{const t=ro(e);if("outcome"in t)return t.outcome;if(Bt(t.probe.values.serverCardFound)!==!0)return{kind:"not-applicable",reason:cf};const r=du(t.probe.values.optionalFields);return r===void 0?{kind:"unknown",reason:"Optional fields were not checked."}:r.length>0?{kind:"present",via:"advertised",count:r.length,detail:r.join(", ")}:lf(t.probe)}),Tr({id:"server-cards.remotes",name:"remotes",summary:"Lists the server's endpoints with transport type, URL, headers, variables and supported protocol versions.",howTo:"Add a remotes entry for each endpoint, with type streamable-http or sse and its url.",spec:re("server-card-schema")},Os("remotesListed",{needsCard:!0,whenFalse:"absent",via:"advertised"})),Tr({id:"server-cards.meta",name:"Card _meta",summary:"Carries vendor metadata alongside the card's standard fields.",howTo:"Add a _meta object to the card for metadata outside the standard fields.",spec:re("server-card-schema")},Os("hasMeta",{needsCard:!0,whenFalse:"absent",via:"advertised"})),Tr({id:"server-cards.runtime-consistency",name:"Consistent with runtime serverInfo",summary:"The card's name, version and remotes do not contradict what the server reports when connected.",howTo:"Generate the card from the same name and version the server reports in serverInfo.",spec:re("server-card-discovery","consistency-with-runtime-behavior")},e=>{const t=ro(e);if("outcome"in t)return t.outcome;if(Bt(t.probe.values.serverCardFound)!==!0)return{kind:"not-applicable",reason:cf};const r=Bt(t.probe.values.consistentWithRuntime);return r===!0?{kind:"present",via:"probed"}:{kind:"unknown",reason:r===!1?"The card contradicts what the server reports at runtime. The card is advisory, so the runtime values apply.":"The card was not compared with the running server yet."}}),Tr({id:"server-cards.cors",name:"CORS headers",summary:"Browser-based clients can fetch the card from another origin.",howTo:"Send Access-Control-Allow-Origin on the card and catalog responses.",optional:!1,spec:re("server-card-discovery","cors-requirements")},Os("corsAllowed",{needsCard:!0,whenFalse:"The card response has no CORS headers, so browser clients cannot read it."})),Tr({id:"server-cards.caching",name:"Cache-Control, ETag and 304",summary:"Clients can cache the card and revalidate it cheaply.",howTo:"Send Cache-Control and an ETag with the card, and answer If-None-Match with 304.",spec:re("server-card-discovery","caching")},Os("cacheControl",{needsCard:!0,whenFalse:"absent"})),Tr({id:"server-cards.https",name:"HTTPS",summary:"The card is served over HTTPS so clients can trust what it says.",howTo:"Serve the AI Catalog and the card over HTTPS.",optional:!1,spec:re("server-card-discovery","transport-security")},Os("https",{needsCard:!0,whenFalse:"The card is served over plain HTTP."}))],dj="io.modelcontextprotocol.skills/",Oy="skill://",pj="Applies only when the server declares the Skills extension.",gr=Rs("skills","beta");function FT(e){return PT(e,ic,"The Skills extension")}function hj(e){return Xs(e,ic).state==="declared"}function sn(e){if(hj(e))return;const t=FT(e);return t?.kind==="absent"&&Lr(e,t.basis)?{kind:"not-applicable",reason:pj}:null}function jT(e){const t=e.skills,r=Qo(t,"skills");return r!==void 0||!t?{outcome:r??null}:Bt(t.values.listed)!==!0?{outcome:{kind:"unknown",reason:"skills/list did not answer."}}:{probe:t}}function My(e,t,r){const s=jT(e);if("outcome"in s)return s.outcome;const n=s.probe.values;if(Dr(n.count)===0)return{kind:"not-applicable",reason:"The server lists no skills."};const i=Dr(n[t])??0;if(i>0)return{kind:"unknown",reason:r(i)};const o=Dr(n.verified)??0;return o>0?{kind:"present",via:"probed",count:o}:{kind:"unknown",reason:"No skill was read and verified."}}function fj(e){return e.skills.map(t=>Es(t,"uri")).filter(t=>t!==void 0)}var mj=[gr({id:"skills.declaration",name:"io.modelcontextprotocol/skills declaration (directoryRead)",summary:"Tells hosts the server serves agent skills over MCP.",howTo:'Declare extensions["io.modelcontextprotocol/skills"] = {}, with directoryRead: true if you answer resources/directory/read.',spec:re("skills","capability-negotiation"),assessment:{primary:"declared",declared:e=>{const t=Xs(e,ic);return t.state==="declared"&&t.settings.directoryRead===!0?{kind:"present",via:"advertised",detail:"directoryRead: true"}:FT(e)}}}),gr({id:"skills.resources-capability",name:"resources capability declared alongside",summary:"Skills are read as resources, so the server must also declare resources.",howTo:"Declare the resources capability whenever you declare the Skills extension.",optional:!1,spec:re("skills","capability-negotiation"),assessment:{primary:"declared",declared:e=>{const t=sn(e);return t!==void 0?t:Ut(Ai(e),"resources")?{kind:"present",via:"advertised"}:{kind:"absent",basis:["capabilities"]}}}}),gr({id:"skills.list",name:"skills/list",summary:"Lists the skills a host can offer, with pagination and cache hints.",howTo:"Answer skills/list with each skill's uri, frontmatter and resources manifest.",spec:re("skills","listing-skills"),assessment:{primary:"probed",declared:e=>e.skills.length>0?{kind:"present",via:"detected",count:e.skills.length}:sn(e)??null,probed:e=>{const t=jT(e);return"outcome"in t?t.outcome:{kind:"present",via:"probed",count:Dr(t.probe.values.count)??0}}}}),gr({id:"skills.get",name:"skills/get (including unlisted skills)",summary:"Returns one skill by uri, including skills skills/list does not show.",howTo:"Answer skills/get for every skill you serve, listed or not. Open the server's skills in MCPJam to call it.",spec:re("skills","getting-a-skill"),assessment:{primary:"observed",observable:!0,declared:e=>sn(e)??null}}),gr({id:"skills.uri-mapping",name:"skill:// URI mapping",summary:"Each skill lives at skill://<path>/SKILL.md, and its last path segment is its name.",howTo:"Serve each SKILL.md at skill://<path>/SKILL.md, where the last segment of <path> is the skill name.",optional:!1,spec:re("skills","resource-mapping"),assessment:{primary:"probed",declared:e=>{const t=fj(e);if(t.length===0)return sn(e)??null;const r=t.filter(s=>s.startsWith(Oy)&&s.endsWith("/SKILL.md")).length;return r===t.length?{kind:"present",via:"detected",count:r}:{kind:"unknown",reason:`${t.length-r} of ${t.length} listed skills do not use skill://<path>/SKILL.md.`}}}}),gr({id:"skills.digest",name:"Digest and size verification on read",summary:"Each file a skill lists matches the size and digest in its manifest.",howTo:"Publish the sha256 digest and byte size of every file in the skill's resources manifest.",optional:!1,spec:re("skills","verification-on-read"),assessment:{primary:"probed",probed:e=>My(e,"digestFailures",t=>`${t} skill files did not match their manifest digest or size.`)}}),gr({id:"skills.frontmatter",name:"Frontmatter matches the listing",summary:"The fetched SKILL.md frontmatter matches what skills/list advertised.",howTo:"Generate the skills/list entry from the same frontmatter the SKILL.md file carries.",optional:!1,spec:re("skills","frontmatter-verification"),assessment:{primary:"probed",probed:e=>My(e,"frontmatterFailures",t=>`${t} skills have frontmatter that differs from their listing.`)}}),gr({id:"skills.dynamic",name:'Dynamic skills (resources: "dynamic")',summary:"A skill whose files are generated per request instead of listed in a manifest.",howTo:'Set resources to "dynamic" for generated skills. MCPJam lists them but declines to load content it cannot verify.',spec:re("skills","resources"),assessment:{primary:"declared",declared:e=>{const t=e.skills.filter(r=>r.resources==="dynamic").length;return t>0?{kind:"present",via:"detected",count:t}:null}}}),gr({id:"skills.directory-read",name:"resources/directory/read",summary:"Lets a host list the files in a skill's directory.",howTo:"Set directoryRead: true in the Skills extension settings and answer resources/directory/read.",spec:re("skills","reading-directories"),assessment:{primary:"declared",declared:e=>{const t=Xs(e,ic);return t.state!=="declared"?sn(e)??null:t.settings.directoryRead===!0?{kind:"present",via:"advertised"}:{kind:"absent",basis:["capabilities"]}},probed:e=>{const t=e.skills;return t?.status!=="ok"?null:Bt(t.values.directoryRead)===!0?{kind:"present",via:"probed"}:null}}}),gr({id:"skills.instructions-pointer",name:"Pointer from server instructions",summary:"The server's instructions tell the model that skills are available.",howTo:"Mention your skills and how to load them in the server instructions.",spec:re("skills","pointer-from-server-instructions"),assessment:{primary:"declared",declared:e=>{const t=sn(e);if(t!==void 0)return t;const r=e.instructions??"";return/skill/i.test(r)?{kind:"present",via:"detected"}:{kind:"absent",basis:["instructions","capabilities"]}}}}),gr({id:"skills.resource-meta",name:"Resource _meta prefix io.modelcontextprotocol.skills/",summary:"Skill metadata uses keys under the extension's own _meta prefix.",howTo:"Put skill metadata under _meta keys that start with io.modelcontextprotocol.skills/.",spec:re("skills","resource-metadata"),assessment:{primary:"declared",declared:e=>{const t=sn(e);if(t!==void 0)return t;const r=[...e.skills,...e.resources.filter(s=>(Es(s,"uri")??"").startsWith(Oy))].filter(s=>Object.keys(vs(s)??{}).some(n=>n.startsWith(dj))).length;return r>0?{kind:"present",via:"detected",count:r}:{kind:"absent",basis:["skills","resources"]}}}}),gr({id:"skills.errors",name:"Errors use -32602",summary:"Unknown skills and bad parameters fail with Invalid params.",howTo:"Return -32602 from skills/get and resources/read for skills that do not exist.",spec:re("skills","error-handling"),assessment:{primary:"checked",declared:e=>sn(e)??null}}),gr({id:"skills.host-consent",name:"Host consent before using a skill",summary:"The host asks before loading a skill and ties approval to the digests it verified.",howTo:"Hosts should ask the user before they load a server's skill.",owner:"host",spec:re("skills","security-considerations"),assessment:{primary:"observed"}})],b7=_t({}),HT="io.modelcontextprotocol/tasks";function gj(e){const t=ks(e);return t==="modern"?"extension":t==="legacy"?e==="2025-11-25"?"core":"none":"unknown"}var vj={kind:"unknown",reason:"The protocol version of this capture is unknown, so the Tasks form cannot be chosen."};function yn(e,t){return r=>{const s=gj(r.protocolVersion);return s==="unknown"?vj:s===e?t(r):null}}function BT(e){const t=Ai(e);return Ut(t,"tasks")??Ut(Ut(t,"experimental"),"tasks")}function pu(e){const t=BT(e);if(!t)return{kind:"absent",basis:["capabilities"]};const r=[t.list!==void 0?"list":void 0,t.cancel!==void 0?"cancel":void 0,Ut(Ut(t,"requests"),"tools")?.call!==void 0?"requests.tools.call":void 0].filter(s=>s!==void 0);return{kind:"present",via:"advertised",detail:r.length>0?r.join(", "):"empty tasks capability"}}var VT="The server does not declare the Tasks capability.",_j="The server does not declare the Tasks extension.";function Ly(e){return yn("core",t=>{const r=BT(t);return r?e(r)!==void 0?{kind:"present",via:"advertised"}:{kind:"absent",basis:["capabilities"]}:Pd(t,pu(t),VT)})}var yj=yn("core",e=>Pd(e,pu(e),VT));function uf(e){return PT(e,HT,"The Tasks extension")}var df=yn("extension",e=>Pd(e,uf(e),_j)),bj=new Set(["optional","required"]),so=Rs("tasks","experimental"),Da=Rs("tasks","beta"),no={introduced:"2025-11-25",removed:"2026-07-28"},Ua={introduced:"2026-07-28"},os=e=>N("2025-11-25","basic/utilities/tasks",e),as="Call a tool that runs as a task in the Playground, then watch Tracing.";function _a(e){return so({parent:"tasks.core",lifecycle:no,...e,assessment:{primary:"observed",observable:!0,declared:yj}})}function Bi(e){return Da({parent:"tasks.ext",lifecycle:Ua,...e,assessment:{primary:"observed",observable:!0,declared:df}})}var Sj=[so({id:"tasks.core",name:"Tasks utility (2025-11-25)",summary:"The experimental core Tasks utility that 2025-11-25 servers use for long-running calls.",howTo:"Declare capabilities.tasks and set execution.taskSupport on tools that can run as tasks.",lifecycle:no,spec:os(),assessment:{primary:"declared",declared:yn("core",pu)}}),so({id:"tasks.core.capability",parent:"tasks.core",name:"tasks capability (list, cancel, requests.tools.call)",summary:"Tells clients which task operations and task-augmented requests the server accepts.",howTo:"Declare capabilities.tasks with list, cancel and requests.tools.call for the operations you support.",lifecycle:no,spec:os("server-capabilities"),assessment:{primary:"declared",declared:yn("core",pu)}}),so({id:"tasks.core.tool-task-support",parent:"tasks.core",name:"execution.taskSupport",summary:"Marks each tool as forbidden, optional or required to run as a task.",howTo:'Set execution.taskSupport to "optional" or "required" on tools that can run as tasks. "forbidden" is the default.',lifecycle:no,spec:os("tool-level-negotiation"),assessment:{primary:"declared",declared:yn("core",e=>{if(e.tools.length===0&&Lr(e,["tools"]))return{kind:"not-applicable",reason:"This server lists no tools."};const t=e.tools.filter(r=>{const s=Es(Ut(r,"execution"),"taskSupport");return s!==void 0&&bj.has(s)}).length;return t>0?{kind:"present",via:"detected",count:t,detail:Cd(t,e.tools.length,"tools")}:{kind:"absent",basis:["tools"]}})}}),_a({id:"tasks.core.augmented-call",name:"Task-augmented tools/call",summary:"A tools/call with params.task returns a CreateTaskResult instead of waiting.",howTo:as,spec:os("creating-tasks")}),_a({id:"tasks.core.get",name:"tasks/get",summary:"Returns a task's current status.",howTo:as,spec:os("getting-tasks")}),_a({id:"tasks.core.result",name:"tasks/result",summary:"Waits for a task to finish and returns its result.",howTo:as,spec:os("retrieving-task-results")}),so({id:"tasks.core.list",parent:"tasks.core",name:"tasks/list",summary:"Lists the tasks the server is tracking for this client.",howTo:"Declare capabilities.tasks.list and answer tasks/list.",lifecycle:no,spec:os("listing-tasks"),assessment:{primary:"declared",declared:Ly(e=>e.list),observable:!0}}),so({id:"tasks.core.cancel",parent:"tasks.core",name:"tasks/cancel",summary:"Stops a running task.",howTo:"Declare capabilities.tasks.cancel and answer tasks/cancel.",lifecycle:no,spec:os("cancelling-tasks"),assessment:{primary:"observed",declared:Ly(e=>e.cancel),observable:!0}}),_a({id:"tasks.core.status-notification",name:"notifications/tasks/status",summary:"The server pushes task status changes instead of waiting to be polled.",howTo:as,spec:os("task-status-notification")}),_a({id:"tasks.core.input-required",name:"input_required status with related-task _meta",summary:"A task pauses to ask the client for input, tagged with the task it belongs to.",howTo:`${as} Use a tool that asks for input while it runs.`,spec:os("input-required-status")}),Da({id:"tasks.ext",name:"Tasks extension",summary:"The io.modelcontextprotocol/tasks extension for long-running tool calls on 2026-07-28.",howTo:'Declare extensions["io.modelcontextprotocol/tasks"] = {} and return tasks from slow tool calls.',lifecycle:Ua,spec:re("tasks"),assessment:{primary:"declared",declared:yn("extension",uf)}}),Da({id:"tasks.ext.declaration",parent:"tasks.ext",name:"io.modelcontextprotocol/tasks declaration",summary:"Tells clients the server may answer tools/call with a task. It does not say which tools do.",howTo:'Declare extensions["io.modelcontextprotocol/tasks"] = {}. Which tools return tasks shows only when they run.',lifecycle:Ua,spec:re("tasks","capability-negotiation"),assessment:{primary:"declared",declared:yn("extension",uf)}}),Bi({id:"tasks.ext.create-task-result",name:'CreateTaskResult (resultType "task")',summary:"The server answers a tools/call with a task the client can poll.",howTo:`${as} An ordinary result does not mean tasks are unsupported.`,spec:re("tasks","polymorphic-results")}),Bi({id:"tasks.ext.polling",name:"tasks/get polling (pollIntervalMs, ttlMs)",summary:"The client polls the task at the interval the server suggests until it finishes.",howTo:as,spec:re("tasks","task-polling")}),Bi({id:"tasks.ext.update",name:"tasks/update (inputResponses)",summary:"The client answers a task's input requests without restarting the call.",howTo:`${as} Use a tool that asks for input while it runs.`,spec:re("tasks","task-update-requests")}),Bi({id:"tasks.ext.cancel",name:"tasks/cancel",summary:"The client asks the server to stop a task.",howTo:`${as} Cancel the task while it runs.`,spec:re("tasks","task-cancellation")}),Bi({id:"tasks.ext.notifications",name:"notifications/tasks on subscriptions/listen",summary:"The server pushes task status to clients that subscribe by task id.",howTo:as,spec:re("tasks","task-status-notifications")}),Bi({id:"tasks.ext.missing-capability-error",name:"-32021 when the client did not declare the extension",summary:"The server rejects task requests from clients that did not declare the Tasks extension.",howTo:"Run checks to send task requests without the extension declaration.",spec:re("tasks","capability-negotiation")}),Da({id:"tasks.ext.mcp-name-routing",parent:"tasks.ext",name:"Mcp-Name carries the task id",summary:"Over HTTP, task requests name the task in the Mcp-Name header so gateways can route them.",howTo:"Run checks. The Tasks suite sends tasks/get with Mcp-Name set to the task id.",owner:"client",lifecycle:Ua,spec:re("tasks","streamable-http-routing-headers"),assessment:{primary:"checked",declared:df}}),Da({id:"tasks.ext.unknown-task-id",parent:"tasks.ext",name:"Unknown task id rejected with -32602",summary:"tasks/get for a task id the server never issued fails with Invalid params.",howTo:"Run checks. The Tasks suite asks for a task id the server never issued.",lifecycle:Ua,spec:re("tasks","protocol-errors"),assessment:{primary:"checked",declared:df}})],xd="openai/settings",hc="openai/mentions",Vg="io.modelcontextprotocol/files",wj={tools:["listChanged"],resources:["subscribe","listChanged"],prompts:["listChanged"],completions:[],logging:[],experimental:null,extensions:null,tasks:["list","cancel","requests"],events:["listChanged"]},kj={[dn]:null,[HT]:[],[ic]:["directoryRead"],[$T]:null,[DT]:null,[xd]:["readTool","updateTool"],[hc]:["searchTool"],[Vg]:null},Ej={tasks:["list","cancel","requests"],[xd]:["readTool","updateTool"],[hc]:["searchTool"],[Vg]:null},Ny=64;function $y(e){return e.length>Ny?`${e.slice(0,Ny)}…`:e}function Ep(e,t,r,s){for(const[n,i]of Object.entries(e)){if(!Object.prototype.hasOwnProperty.call(t,n)){s.push(r($y(n)));continue}const o=t[n];if(!(o==null||!Ys(i)))for(const a of Object.keys(i))o.includes(a)||s.push(`${r(n)}.${$y(a)}`)}}function Tj(e){const t=[];Ep(e,wj,n=>`capabilities.${n}`,t);const r=e.extensions;Ys(r)&&Ep(r,kj,n=>`extensions["${n}"]`,t);const s=e.experimental;return Ys(s)&&Ep(s,Ej,n=>`experimental["${n}"]`,t),t}var us=Rs("third-party-experimental","early-access"),Tp=Rs("third-party-experimental","stable"),Dy=Rs("third-party-experimental","experimental"),hu=["extensions","experimental"],Aj=[xd,hc],Ap="https://developers.openai.com/apps-sdk/reference",pf=["tools","toolMeta"],Ij=["openai/outputTemplate","openai/widgetAccessible","openai/visibility","openai/toolInvocation/invoking","openai/toolInvocation/invoked","openai/fileParams"],Rj=["openai/widgetDescription","openai/widgetPrefersBorder","openai/widgetCSP","openai/widgetDomain"],Cj="text/html+skybridge";function GT(e,t){const r=Xs(e,t,hu);return r.state==="declared"?{kind:"present",via:"advertised",detail:r.location}:r.state==="malformed"?{kind:"unknown",reason:`${t} is declared with a value that is not an object, so clients ignore it.`}:r.state==="not-captured"?{kind:"unknown",reason:"The server's capabilities were not captured."}:{kind:"absent",basis:["capabilities"]}}function Pj(e,t){return e.tools.find(r=>Es(r,"name")===t)}function Uy(e,t){if(e.tools.length===0&&Lr(e,["tools"]))return{kind:"not-applicable",reason:"This server lists no tools."};const r=e.tools.filter(s=>{const n=vs(s);return n!==void 0&&t(n)}).length;return r>0?{kind:"present",via:"detected",count:r,detail:Cd(r,e.tools.length,"tools")}:{kind:"absent",basis:pf}}function xj(e){const t=Xs(e,hc,hu);if(t.state!=="declared")return GT(e,hc);const r=Es(t.settings,"searchTool"),s=r?Pj(e,r):void 0;if(!s)return Lr(e,["tools"])?{kind:"unknown",reason:"openai/mentions names a search tool the server does not list."}:{kind:"present",via:"advertised",detail:t.location};const n=Ut(s,"annotations")?.readOnlyHint===!0,i=Ut(vs(s),"ui")?.visibility,o=!Array.isArray(i)||i.includes("app");return!n||!o?{kind:"unknown",reason:"The mentions search tool must set readOnlyHint and stay visible to the app."}:{kind:"present",via:"advertised",detail:`${t.location}, searchTool ${r}`}}var Oj="Open the server in the Playground with the ChatGPT or Codex client and use one of its views.";function ya(e){return us({parent:"openai.extensions",owner:"host",howTo:Oj,...e,assessment:{primary:"observed",observable:!0}})}var Mj=[us({id:"openai.extensions",name:"OpenAI extensions",summary:"OpenAI's extensions for MCP servers and apps in ChatGPT and Codex.",howTo:"Use @openai/mcp-extensions on your server and in your views.",spec:re("openai"),assessment:{primary:"declared"}}),us({id:"openai.capability-location",parent:"openai.extensions",name:"Capability location (extensions or experimental)",summary:"OpenAI capabilities sit under extensions, or under experimental for clients older than 2026-07-28.",howTo:"Declare OpenAI capabilities under extensions, and also under experimental for older clients.",spec:re("openai","server-capabilities"),assessment:{primary:"declared",declared:e=>{const t=Aj.flatMap(r=>{const s=Xs(e,r,hu);return s.state==="declared"||s.state==="malformed"?[s.location]:[]});return t.length===0?Lr(e,["capabilities"])?{kind:"not-applicable",reason:"The server declares no OpenAI capability."}:null:!t.some(r=>r.startsWith("extensions"))&&ks(e.protocolVersion)==="modern"?{kind:"unknown",reason:"OpenAI capabilities are only under experimental, which 2026-07-28 clients do not read."}:{kind:"present",via:"advertised",detail:t.join(", ")}}}}),us({id:"openai.settings",parent:"openai.extensions",name:"openai/settings (readTool, updateTool)",summary:"Lets the host show and change the server's settings through two tools.",howTo:"Register settings with @openai/mcp-extensions, which declares openai/settings with readTool and updateTool.",spec:re("openai","structured-settings"),assessment:{primary:"declared",declared:e=>GT(e,xd)}}),us({id:"openai.mentions",parent:"openai.extensions",name:"openai/mentions (searchTool)",summary:"Lets users @-mention the server's resources from the composer.",howTo:"Declare openai/mentions with a searchTool that sets readOnlyHint: true and stays visible to the app.",spec:re("openai","composer-at-mentions"),assessment:{primary:"declared",declared:xj}}),us({id:"openai.mentions-legacy-key",parent:"openai.extensions",name:'_meta["openai/extensions"]["mentions/search"] (deprecated)',summary:"The older way to mark the mentions search tool.",howTo:"Declare the openai/mentions capability instead. @openai/mcp-extensions still writes this key too.",spec:re("openai","composer-at-mentions"),assessment:{primary:"declared",declared:e=>{const t=Uy(e,r=>Ut(r,"openai/extensions")?.["mentions/search"]!==void 0);return t?.kind==="absent"?Lr(e,pf)?{kind:"not-applicable",reason:"Not used. Servers should declare openai/mentions."}:null:t}}}),us({id:"openai.entrypoints",parent:"openai.extensions",name:'Entrypoints (_meta["openai/ui"].entrypoints)',summary:"Opens the server's views from the sidebar, a conversation or a file type.",howTo:'Add global, thread or file entrypoints under _meta["openai/ui"] on a tool that links a view.',spec:re("openai","mcp-app-entrypoints"),assessment:{primary:"declared",declared:e=>Uy(e,t=>{const r=Ut(t,"openai/ui")?.entrypoints;return Array.isArray(r)&&r.length>0})}}),us({id:"openai.deep-links",parent:"openai.extensions",name:"Deep links",summary:"The host opens a view at a specific URL inside the app.",howTo:"Read the openai/deepLink host state in your view and navigate to its url.",owner:"app",spec:re("openai","deep-links"),assessment:{primary:"observed"}}),us({id:"openai.display-modes",parent:"openai.extensions",name:'Display modes (_meta["openai/ui"] on the UI resource)',summary:"Tells the host which display modes the view supports and which it prefers.",howTo:'Set availableDisplayModes and preferredDisplayMode under _meta["openai/ui"] on the UI resource content.',spec:re("openai","display-modes"),assessment:{primary:"probed",declared:e=>{const t=e.resources.filter(r=>{const s=Ut(vs(r),"openai/ui");return s?.availableDisplayModes!==void 0||s?.preferredDisplayMode!==void 0}).length;return t>0?{kind:"present",via:"detected",count:t}:null}}}),ya({id:"openai.file-resources",name:"File resources (openai/resource, openai/resources/write)",summary:"The view reads, watches and writes files the user shared with the host.",spec:re("openai","filesystem-access")}),ya({id:"openai.model-context",name:"openai/modelContext",summary:"The view adds titled, grouped context with thumbnails for the model.",spec:re("openai","uiupdate-model-context-extensions")}),ya({id:"openai.message",name:"openai/message",summary:"The view sends a message with a title, target and send behavior.",spec:re("openai","uimessage-extensions")}),ya({id:"openai.files",name:"openai/files (open local files)",summary:"The view asks the host to open a local file.",spec:re("openai","opening-local-files")}),ya({id:"openai.elicitation",name:"openai/elicitation forms",summary:"The server asks for input with OpenAI's richer forms, through MRTR on 2026-07-28 and openai/elicitation/create before.",owner:"server",howTo:"Call a tool that requests an OpenAI form in the Playground.",spec:re("openai","openai-form-elicitation")}),us({id:"openai.onboarding",parent:"openai.extensions",name:"Plugin onboarding skill",summary:'A plugin manifest names a skill to run when a user installs the app (extensions["com.openai"].onboardingSkill).',howTo:"Set onboardingSkill in the plugin manifest. Adding the plugin in MCPJam offers to run it.",spec:re("openai","plugin-onboarding"),assessment:{primary:"configured",setup:"openai-onboarding"}}),Tp({id:"openai.apps-sdk",name:"OpenAI Apps SDK metadata (legacy)",summary:"Older ChatGPT app metadata that MCP Apps metadata replaces.",howTo:"Move to _meta.ui and text/html;profile=mcp-app. MCPJam renders both.",spec:Na("openai-apps-sdk",Ap),assessment:{primary:"declared"}}),Tp({id:"openai.apps-sdk-meta",parent:"openai.apps-sdk",name:"Legacy Apps SDK _meta (openai/outputTemplate, widgetCSP and related keys)",summary:"Links tools to widgets and sets widget policy with openai/* keys and text/html+skybridge.",howTo:"Keep these keys for older ChatGPT clients and add the MCP Apps equivalents under _meta.ui.",spec:Na("openai-apps-sdk",Ap),assessment:{primary:"declared",declared:e=>{const t=new Set;for(const r of e.tools){const s=vs(r)??{};for(const n of Ij)s[n]!==void 0&&t.add(n)}for(const r of e.resources){const s=vs(r)??{};for(const n of Rj)s[n]!==void 0&&t.add(n);Es(r,"mimeType")==="text/html+skybridge"&&t.add(Cj)}return t.size>0?{kind:"present",via:"detected",count:t.size,detail:[...t].join(", ")}:Lr(e,["tools","toolMeta","resources"])?{kind:"not-applicable",reason:"Not used. MCP Apps metadata replaces these keys."}:null}}}),Tp({id:"openai.profile",parent:"openai.apps-sdk",name:'_meta["openai/profile"] profile tool',summary:"Marks the one tool that returns the signed-in account's profile.",howTo:'Set _meta["openai/profile"] = true on exactly one tool that returns { id, name, email }.',spec:Na("openai-apps-sdk",Ap),assessment:{primary:"declared",declared:e=>{const t=e.tools.filter(r=>vs(r)?.["openai/profile"]===!0).length;return t===1?{kind:"present",via:"detected",count:1}:t>1?{kind:"unknown",reason:`${t} tools set openai/profile. Hosts use it only when exactly one does.`}:Lr(e,pf)?{kind:"not-applicable",reason:"Optional. Hosts that connect several accounts use it."}:null}}}),Dy({id:"experimental.extensions",name:"Experimental extensions (experimental-ext-*)",summary:"Proposals such as File Uploads and Downloads that are not official extensions yet.",howTo:"Declare the proposal's id under extensions, or under experimental on older revisions, as its repository describes.",spec:Na("experimental","https://modelcontextprotocol.io/extensions/overview#experimental-extensions"),assessment:{primary:"declared",declared:e=>{const t=Ai(e);if(!t)return null;const r=new Set;Xs(e,"io.modelcontextprotocol/files",hu).state==="declared"&&r.add(Vg);const s=Ut(t,"experimental")??{};for(const n of Object.keys(s))n.startsWith("io.modelcontextprotocol/")&&r.add(n);return r.size>0?{kind:"present",via:"advertised",count:r.size,detail:[...r].join(", ")}:{kind:"absent",basis:["capabilities"]}}}}),Dy({id:"third-party.unrecognized-capabilities",name:"Unrecognized capabilities",summary:"Capabilities, extension ids and settings the server declares that this catalog does not know.",howTo:"Nothing to add. The row lists each key so you can look it up in the server's documentation.",spec:N("2026-07-28","basic/versioning","extension-negotiation"),assessment:{primary:"declared",declared:e=>{const t=Ai(e);if(!t)return null;const r=Tj(t);return r.length>0?{kind:"present",via:"advertised",count:r.length,detail:r.slice(0,20).join(", ")}:Lr(e,["capabilities"])?{kind:"not-applicable",reason:"Every declared capability is in the catalog."}:null}}})],Lj=[...tj,...ZF,...Sj,...mj,...oj,...uj,...Mj],WT=[...FF,...Lj],Nj={"ui-tools-present":["apps.tool-resource-uri"],"ui-tool-metadata-valid":["apps.tool-resource-uri","apps.visibility"],"ui-tool-input-schema-valid":["apps.tool-resource-uri"],"ui-listed-resources-valid":["apps.ui-resource"],"ui-resources-readable":["apps.html-content"],"ui-resource-contents-valid":["apps.html-content"],"ui-resource-meta-valid":["apps.csp","apps.permissions","apps.domain","apps.prefers-border"]},$j={"events-capability-declared":["events.capability"],"events-list-shape":["events.list"],"events-poll-null-cursor":["events.poll"],"events-subscribe-rejects-http-callback":["events.webhook-subscribe"],"events-subscribe-rejects-invalid-secret":["events.webhook-subscribe"],"events-subscribe-result-shape":["events.webhook-subscribe"],"events-subscribe-idempotent":["events.webhook-subscribe"],"events-granted-lifetime":["events.webhook-subscribe"],"events-no-expiry-only-when-requested":["events.webhook-subscribe"],"events-receiver-consent":["events.endpoint-verification"],"events-consent-failure-blocks-delivery":["events.endpoint-verification"],"events-no-redirect-follow":["events.endpoint-verification"],"events-private-callback-rejected":["events.endpoint-verification"],"events-delivery-signature":["events.webhook-subscribe"],"events-webhook-id-equals-event-id":["events.webhook-subscribe"],"events-webhook-message-id":["events.webhook-subscribe"],"events-subscription-id-header":["events.webhook-subscribe"],"events-delivery-content-type":["events.webhook-subscribe"],"events-delivery-body-size":["events.webhook-subscribe"],"events-unsubscribe-twice":["events.unsubscribe"],"events-push-heartbeat":["events.stream"],"chatgpt-readiness-webhook-listed":"excluded","chatgpt-readiness-protocol-version":"excluded","chatgpt-readiness-transport":"excluded"},Dj={verify_profile_shape:"excluded",verify_profile_stable:"excluded",verify_profile_id_opaque:"excluded",verify_profile_identity_stable_across_flows:"excluded",verify_profile_stable_after_refresh:"excluded",oauth_dcr_http_redirect_uri:["auth.dcr","auth.dcr-application-type"],oauth_invalid_client:"excluded",oauth_invalid_authorize_redirect:"excluded",oauth_invalid_token:["auth.token-validation"],oauth_invalid_redirect:"excluded",oauth_token_format:"excluded",oauth_unauthenticated_challenge:["auth.oauth"],oauth_resource_metadata_challenge:["auth.resource-metadata-challenge"],oauth_stale_session_rejection:["transport-behavior.session-expiry"]},Uj={"server-initialize":["lifecycle.initialize","lifecycle.version-negotiation","server-info.name-version"],ping:["request-control.ping"],"logging-set-level":["request-control.logging-set-level"],"completion-complete":["completion.result-shape"],"capabilities-consistent":["lifecycle.initialize","lifecycle.server-discover"],"tools-list":["tools.list"],"tools-input-schemas-valid":["tools.input-schema"],"tools-x-mcp-header-declarations-valid":["transport-behavior.x-mcp-header"],"prompts-list":["prompts.list"],"resources-list":["resources.list"],"protocol-invalid-method-error":"excluded","localhost-host-rebinding-rejected":["transport-behavior.origin-validation"],"localhost-host-valid-accepted":["transport-behavior.origin-validation"],"server-sse-polling-session":["transport-behavior.session-id"],"server-accepts-multiple-post-streams":["transport.streamable-http"],"server-sse-streams-functional":["transport.streamable-http"],"notification-post-accepted":["transport.streamable-http"],"get-stream-or-405":["transport.streamable-http"],"session-id-visible-ascii":["transport-behavior.session-id"],"post-response-content-type":["transport-behavior.response-mode"],"modern-client-handshake":["lifecycle.era-detection","server-info.name-version"],"modern-server-discover":["lifecycle.server-discover","lifecycle.supported-versions"],"modern-result-type-present":["tool-results.result-type"],"modern-cacheable-result-hints":["caching.ttl-ms","caching.cache-scope"],"modern-cache-hint-coverage":["caching.ttl-ms","caching.cache-scope"],"modern-cache-hint-values-valid":["caching.ttl-ms","caching.cache-scope"],"modern-cache-scope-stable-across-pages":["caching.cache-scope"],"modern-protocol-version-header-mismatch":["transport-behavior.protocol-version-header"],"modern-method-header-mismatch":["transport-behavior.method-name-headers"],"modern-name-header-mismatch":["transport-behavior.method-name-headers"],"modern-unsupported-version-error":["lifecycle.unsupported-version-error"],"modern-missing-method-header-rejected":["transport-behavior.method-name-headers"],"modern-header-names-case-insensitive":["transport-behavior.method-name-headers"],"modern-undeclared-capability-error":["lifecycle.missing-client-capability-error","mrtr.declared-capabilities-only"],"modern-no-session-id":["transport-behavior.stateless-sessions"],"modern-removed-methods-not-found":"excluded","modern-resource-not-found-invalid-params":["resources.not-found-error"],"modern-resource-read-no-empty-contents":["resources.not-found-error"],"modern-tool-output-schema-conformant":["tool-results.output-schema-conformance"],"modern-logs-require-log-level":["request-control.log-messages","request-control.per-request-log-level"],"modern-subscription-ack-precedes-notifications":["subscriptions.listen","subscriptions.acknowledged"],"modern-subscription-filter-and-tagging":["subscriptions.subscription-id"],"modern-subscription-graceful-close":["subscriptions.stream-end"],"wire-schema-valid":"excluded"},qj={"tasks-wire-resolvable":["tasks.core.capability","tasks.ext.declaration"],"tasks-declaration-hygiene":"excluded","tasks-result-type-discipline":["tasks.core.augmented-call","tasks.ext.create-task-result"],"tasks-undeclared-creation-refused":["tasks.ext.create-task-result"],"tasks-undeclared-capability-rejected":["tasks.ext.missing-capability-error"],"tasks-ttl-shape":["tasks.core.get","tasks.ext.polling"],"tasks-inline-result":["tasks.core.result","tasks.ext.polling"],"tasks-mcp-name-routing":["tasks.ext.mcp-name-routing"],"tasks-invalid-task-id-rejected":["tasks.ext.unknown-task-id"],"tasks-status-payload-shape":["tasks.core.get","tasks.ext.polling"],"tasks-cancel-ack-shape":["tasks.ext.cancel"],"tasks-update-ack-shape":["tasks.ext.update"],"tasks-ttl-integer-shape":["tasks.ext.polling"],"tasks-undeclared-capability-names-requirements":["tasks.ext.missing-capability-error"]},KT={protocol:Uj,apps:Nj,tasks:qj,events:$j,oauth:Dj};function zj(e,t){return`${e}:${t}`}function qy(e){const t=e.indexOf(":"),r=e.slice(0,t),s=KT[r]?.[e.slice(t+1)];return Array.isArray(s)?s:[]}function JT(e){const t=[];for(const[r,s]of Object.entries(KT))for(const[n,i]of Object.entries(s))Array.isArray(i)&&i.includes(e)&&t.push(zj(r,n));return t}var Fj={"server-initialize":"read-only",ping:"read-only","logging-set-level":"side-effecting","completion-complete":"side-effecting","capabilities-consistent":"read-only","tools-list":"read-only","tools-input-schemas-valid":"read-only","tools-x-mcp-header-declarations-valid":"passive","prompts-list":"read-only","resources-list":"read-only","protocol-invalid-method-error":"side-effecting","localhost-host-rebinding-rejected":"side-effecting","localhost-host-valid-accepted":"side-effecting","server-sse-polling-session":"side-effecting","server-accepts-multiple-post-streams":"side-effecting","server-sse-streams-functional":"side-effecting","notification-post-accepted":"side-effecting","get-stream-or-405":"side-effecting","session-id-visible-ascii":"side-effecting","post-response-content-type":"side-effecting","modern-client-handshake":"read-only","modern-server-discover":"read-only","modern-result-type-present":"read-only","modern-cacheable-result-hints":"read-only","modern-cache-hint-coverage":"side-effecting","modern-cache-hint-values-valid":"side-effecting","modern-cache-scope-stable-across-pages":"read-only","modern-protocol-version-header-mismatch":"side-effecting","modern-method-header-mismatch":"side-effecting","modern-name-header-mismatch":"side-effecting","modern-unsupported-version-error":"side-effecting","modern-missing-method-header-rejected":"side-effecting","modern-header-names-case-insensitive":"side-effecting","modern-undeclared-capability-error":"side-effecting","modern-no-session-id":"read-only","modern-removed-methods-not-found":"side-effecting","modern-resource-not-found-invalid-params":"read-only","modern-resource-read-no-empty-contents":"read-only","modern-tool-output-schema-conformant":"side-effecting","modern-logs-require-log-level":"side-effecting","modern-subscription-ack-precedes-notifications":"side-effecting","modern-subscription-filter-and-tagging":"side-effecting","modern-subscription-graceful-close":"side-effecting","wire-schema-valid":"passive"},jj={"ui-tools-present":"read-only","ui-tool-metadata-valid":"passive","ui-tool-input-schema-valid":"passive","ui-listed-resources-valid":"read-only","ui-resources-readable":"read-only","ui-resource-contents-valid":"passive","ui-resource-meta-valid":"passive"},Hj={"tasks-wire-resolvable":"passive","tasks-declaration-hygiene":"passive","tasks-result-type-discipline":"side-effecting","tasks-undeclared-creation-refused":"side-effecting","tasks-undeclared-capability-rejected":"side-effecting","tasks-ttl-shape":"side-effecting","tasks-inline-result":"side-effecting","tasks-mcp-name-routing":"side-effecting","tasks-invalid-task-id-rejected":"side-effecting","tasks-status-payload-shape":"side-effecting","tasks-cancel-ack-shape":"side-effecting","tasks-update-ack-shape":"side-effecting","tasks-ttl-integer-shape":"side-effecting","tasks-undeclared-capability-names-requirements":"side-effecting"},Bj={"events-capability-declared":"passive","events-list-shape":"read-only","events-poll-null-cursor":"side-effecting","events-subscribe-rejects-http-callback":"side-effecting","events-subscribe-rejects-invalid-secret":"side-effecting","events-subscribe-result-shape":"side-effecting","events-subscribe-idempotent":"side-effecting","events-granted-lifetime":"side-effecting","events-no-expiry-only-when-requested":"side-effecting","events-receiver-consent":"side-effecting","events-consent-failure-blocks-delivery":"side-effecting","events-no-redirect-follow":"side-effecting","events-private-callback-rejected":"side-effecting","events-delivery-signature":"side-effecting","events-webhook-id-equals-event-id":"side-effecting","events-webhook-message-id":"side-effecting","events-subscription-id-header":"side-effecting","events-delivery-content-type":"side-effecting","events-delivery-body-size":"side-effecting","events-unsubscribe-twice":"side-effecting","events-push-heartbeat":"side-effecting","chatgpt-readiness-webhook-listed":"passive","chatgpt-readiness-protocol-version":"passive","chatgpt-readiness-transport":"passive"},Vj={verify_profile_shape:"side-effecting",verify_profile_stable:"side-effecting",verify_profile_id_opaque:"side-effecting",verify_profile_identity_stable_across_flows:"side-effecting",verify_profile_stable_after_refresh:"side-effecting",oauth_dcr_http_redirect_uri:"side-effecting",oauth_invalid_client:"side-effecting",oauth_invalid_authorize_redirect:"side-effecting",oauth_invalid_token:"side-effecting",oauth_invalid_redirect:"side-effecting",oauth_token_format:"side-effecting",oauth_unauthenticated_challenge:"read-only",oauth_resource_metadata_challenge:"read-only",oauth_stale_session_rejection:"side-effecting"},zy={protocol:Fj,apps:jj,tasks:Hj,events:Bj,oauth:Vj};function Gj(e){const t=e.indexOf(":"),r=e.slice(0,t),s=e.slice(t+1);if(!Object.hasOwn(zy,r))return;const n=zy[r];return Object.hasOwn(n,s)?n[s]:void 0}function Wj(e){const t=Gj(e);return t==="passive"||t==="read-only"}var Kj=["events:events-capability-declared","events:events-list-shape"];function Jj(e){return Wj(e)?e.startsWith("apps:")||Kj.includes(e):!1}function Yj(e,t){return JT(e).some(r=>{if(!t)return!0;const s=r.slice(0,r.indexOf(":"));return t.includes(s)})}function Xj(e,t,r){const s=t.assessment;switch(e){case"declared":return s.declared&&!r.declared?{reason:"Nothing was captured for this yet. Reconnect to capture it.",nextAction:"reconnect"}:null;case"probed":{const n=s.probed!==void 0||JT(t.id).some(Jj),i=Object.keys(r.probes??{}).length>0;return n&&!i?{reason:"Background checks have not run for this connection. Refresh to run them.",nextAction:"refresh"}:null}case"checked":return Yj(t.id,r.checksOffered)?{reason:"Only a conformance run can show this. Run checks to test it.",nextAction:"run-checks"}:null;case"observed":return s.observable&&Zj(t,r)?{reason:"Seen only when it is used. Try it in the Playground.",nextAction:"use-in-playground"}:null;case"oauth-flow":return s.oauthFlow&&!r.oauthFlow?{reason:"Recorded the next time you sign in to this server with OAuth."}:null}}function Zj(e,t){const r=e.assessment.observableEra;if(!r)return!0;const s=ks(t.context?.protocolVersion??t.declared?.surface.protocolVersion);return s==="unknown"||s===r}var Fy=["checked","probed","declared","observed","oauth-flow"];function YT(e,t){const r=e.assessment.primary,s=(r==="configured"?Fy:[r,...Fy.filter(n=>n!==r)]).map(n=>Xj(n,e,t)).filter(n=>n!==null);return s.find(n=>n.nextAction)??s[0]??{reason:"MCPJam cannot check this yet."}}var Qj=["2024-11-05","2025-03-26","2025-06-18","2025-11-25","2026-07-28"];function hf(e){return e?Qj.indexOf(e):-1}function Gg(e){return hf(e)>=0}function ff(e,t){return hf(e)>=hf(t)}function XT(e,t){const{introduced:r,removed:s}=e.lifecycle;if(!r&&!s)return"applies";if(!Gg(t))return"unknown-version";const n=t;return s&&ff(n,s)?"removed":r&&!ff(n,r)?"not-yet":"applies"}function ZT(e,t){const{deprecated:r}=e.lifecycle;return!r||!Gg(t)?!1:ff(t,r)}function eH(e,t){const r=[];return XT(e,t)==="removed"?r.push("removed"):ZT(e,t)&&r.push("deprecated"),e.stage!=="stable"&&r.push(e.stage),r}var tH=["protocol","apps","tasks","events","oauth"];function QT(e){return typeof e=="string"&&tH.includes(e)}function rH(e){const t=e.indexOf(":");return t>0&&t<e.length-1&&QT(e.slice(0,t))}function sH(e){if(e==="passed"||e==="failed")return e;if(e==="could_not_run"||e==="not_applicable")return"skipped"}function S7(e){const t=[];for(const r of e.suites)if(QT(r.suiteKind))for(const s of r.cases){const n=sH(s.status);n&&t.push({ref:`${r.suiteKind}:${s.id}`,status:n,runId:e.runId,runAt:e.runAt,protocolVersion:e.protocolVersion})}return t}var nH=new Set(["server","authorization-server"]),eA=["checked","observed","probed","oauth-flow","declared","detected"];function iH(e,t){return t==="detected"?"detected":t==="advertised"?"declared":e}function Sl(){return Object.fromEntries(Wz.map(e=>[e,0]))}function oH(e,t){if(!e)return"not-captured";let r="complete";for(const s of t){const n=e.coverage[s];if(n==="not-captured")return"not-captured";n==="partial"&&(r="partial")}return r}function Ip(e,t){if(!e||t===void 0)return null;try{return e(t)}catch(r){return{kind:"unknown",reason:`This feature's rule failed: ${r instanceof Error?r.message:String(r)}`}}}function aH(e){let t;for(const r of Object.values(e??{}))r&&(t===void 0||r.at>t)&&(t=r.at);return t}function Rp(e){const{outcome:t,feature:r}=e;if(!t)return null;const s={featureId:r.id,provenance:e.source==="declared"?"declared":"wire",intrusiveness:e.source==="probed"?"read-only":"passive",capturedAt:e.capturedAt,contextHash:e.contextHash};switch(t.kind){case"present":return{...s,source:iH(e.source,t.via),outcome:"present",coverage:"complete",detail:t.detail,count:t.count};case"absent":return{...s,source:e.source,outcome:"absent",coverage:e.source==="declared"?oH(e.surface,t.basis):"complete",detail:t.detail};case"unknown":return{...s,source:e.source,outcome:"unknown",coverage:"partial",detail:t.reason};case"not-applicable":return{...s,source:e.source,outcome:"not-applicable",coverage:"complete",detail:t.reason}}}function cH(e,t,r){const s=[],n=a=>{a&&s.push(a)},i=e.assessment,o=t.declared?.surface;n(Rp({feature:e,outcome:Ip(i.declared,o),source:"declared",capturedAt:t.declared?.capturedAt,contextHash:r,surface:o})),n(Rp({feature:e,outcome:Ip(i.probed,t.probes),source:"probed",capturedAt:aH(t.probes),contextHash:r})),n(Rp({feature:e,outcome:Ip(i.oauthFlow,t.oauthFlow),source:"oauth-flow",capturedAt:t.oauthFlow?.completedAt,contextHash:r}));for(const a of Object.values(t.probes??{}))for(const[c,l]of Object.entries(a?.checks??{}))!a||!rH(c)||qy(c).includes(e.id)&&(l===void 0||l==="skipped"||s.push({featureId:e.id,source:"probed",outcome:l==="failed"?"failed":"present",provenance:"wire",intrusiveness:"read-only",coverage:"complete",capturedAt:a.at,contextHash:r,detail:l==="warned"?"Passed with warnings.":void 0,ref:{probeId:a.probeId,check:c}}));for(const a of t.observations??[])a.featureId===e.id&&s.push({featureId:e.id,source:"observed",outcome:"present",provenance:a.lastSource==="apps-bridge"?"browser":"wire",intrusiveness:"passive",coverage:"complete",capturedAt:a.lastSeenAt,contextHash:r,count:a.count});for(const a of t.checks??[]){if(!qy(a.ref).includes(e.id)||a.status==="skipped")continue;const c=!a.protocolVersion||!t.context?.protocolVersion||a.protocolVersion===t.context.protocolVersion;s.push({featureId:e.id,source:"checked",outcome:c?a.status==="failed"?"failed":"present":"unknown",provenance:"wire",intrusiveness:"side-effecting",coverage:"complete",capturedAt:a.runAt,detail:c?a.status==="warned"?"Passed with warnings.":void 0:`The last run used ${a.protocolVersion}, not ${t.context?.protocolVersion}.`,ref:{runId:a.runId,check:a.ref}})}return s}function lH(e){let t;for(const r of e)r.capturedAt!==void 0&&(t===void 0||r.capturedAt>t)&&(t=r.capturedAt);return t}function uH(e,t,r){const s=t.context?.protocolVersion??t.declared?.surface.protocolVersion,n=cH(e,t,r),i=eH(e,s);let o=XT(e,s);const a={featureId:e.id,markers:i,evidence:n,seenAt:lH(n)},c=(m,v={})=>({...a,applicability:o,state:m,sources:[],...v}),l=n.find(m=>m.outcome==="not-applicable"),u=n.filter(m=>m.outcome==="present"),p=n.find(m=>m.outcome==="failed");if(l&&u.length===0&&!p)return o="not-applicable",c("not-applicable",{reason:l.detail});if(p)return c("check-failed",{sources:[p.source],reason:p.detail??"A conformance check for this feature failed.",nextAction:"run-checks"});if(u.length>0)return c("supported",{sources:eA.filter(m=>u.some(v=>v.source===m))});if(o==="removed")return c("not-applicable",{reason:`Removed in ${e.lifecycle.removed}.`});if(o==="not-yet")return c("needs-newer",{reason:`Added in ${e.lifecycle.introduced}; this connection uses ${s}.`,nextAction:"upgrade-version"});if(!nH.has(e.owner))return c("needs-newer",{reason:n.find(m=>m.outcome==="unknown")?.detail??`Depends on the ${e.owner==="identity-provider"?"identity provider":e.owner}, not only the server.`});const d=n.find(m=>m.outcome==="absent");if(d&&d.coverage==="complete"){if(o==="unknown-version"||!Gg(s))return c("not-checked",{reason:s?`MCPJam has no rules for protocol version ${s} yet.`:"The protocol version is unknown.",nextAction:"reconnect"});const m=e.assessment.requiresClientExtension,v=t.context?.clientExtensions;return m&&!v?c("not-checked",{reason:"MCPJam did not record which extensions this client advertised. Reconnect to capture them.",nextAction:"reconnect"}):m&&!v?.includes(m)?c("needs-newer",{reason:`This client did not advertise ${m}, and servers may hide this feature from such clients.`}):ZT(e,s)?c("not-applicable",{reason:`Deprecated in ${e.lifecycle.deprecated}; not needed for new servers.`}):c("could-add",{sources:[d.source],reason:e.optional?d.detail:d.detail??"The specification requires this."})}if(d)return c("not-checked",{reason:"The captured data was incomplete, so its absence proves nothing. Reconnect to capture it again.",nextAction:"reconnect"});const h=n.find(m=>m.outcome==="unknown");if(e.assessment.primary==="configured")return dH(e,t,h,c);if(!t.connected&&n.length===0)return c("not-checked",{reason:"Connect this server to check it.",nextAction:"connect"});const f=YT(e,t);return c("not-checked",{reason:h?.detail??f.reason,...f.nextAction?{nextAction:f.nextAction}:{}})}function dH(e,t,r,s){const n=e.assessment.setup;if(!n||!t.setupOffered?.includes(n)){const o=YT(e,t);return s("not-checked",{reason:r?.detail??o.reason,...o.nextAction?{nextAction:o.nextAction}:{}})}if(!t.configured?.includes(n))return s("not-checked",{reason:r?.detail??"Needs setup in MCPJam before it can be checked.",nextAction:"set-up"});if(!t.connected)return s("not-checked",{reason:r?.detail??"Set up in MCPJam. Connect this server to check it.",nextAction:"connect"});const i="Set up in MCPJam. Reconnect the account from the Auth tab to record the result.";return s("not-checked",{reason:r?.detail?`${r.detail} ${i}`:i})}var pH=["check-failed","supported","could-add","needs-newer","not-checked","not-applicable"];function hH(e,t){if(t.length===0||e.evidence.length>0)return e;const r=pH.find(i=>t.some(o=>o.state===i))??e.state;if(r===e.state)return e;const s={...e,state:r,reason:void 0,nextAction:void 0};if(r!=="supported")return s;const n=eA.filter(i=>t.some(o=>o.state==="supported"&&o.sources.includes(i)));return{...s,sources:n}}function w7(e,t){const r=t.context?rF(t.context):void 0,s={},n=new Map;for(const p of e)if(s[p.id]=uH(p,t,r),p.parent){const d=n.get(p.parent)??[];d.push(p.id),n.set(p.parent,d)}for(const p of[...e].reverse()){const d=n.get(p.id);d&&(s[p.id]=hH(s[p.id],d.map(h=>s[h])))}const i=Sl(),o=new Map,a=new Map,c=new Map,l=new Map;for(const p of e){if(n.has(p.id))continue;const d=s[p.id].state,h=Yz(p.family).card;i[d]+=1;const f=o.get(h)??Sl();f[d]+=1,o.set(h,f);const m=a.get(p.family)??Sl();m[d]+=1,a.set(p.family,m),c.set(h,(c.get(h)??0)+1),l.set(p.family,(l.get(p.family)??0)+1)}const u=(p,d,h)=>({id:p,counts:d??Sl(),leafCount:h??0});return{context:t.context,contextHash:r,assessments:s,cards:ET.map(p=>u(p,o.get(p),c.get(p))),families:Gz.map(p=>u(p,a.get(p),l.get(p))),totals:i}}var k7=new Set(WT.filter(e=>e.assessment.observable).map(e=>e.id)),fH=new Set(WT.filter(e=>e.assessment.observable&&(e.family==="mcp-apps"||e.family==="third-party-experimental"&&e.owner==="host")).map(e=>e.id));function fc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function tA(e,t){if(!fc(e))return;const r=e[t];return fc(r)?r:void 0}function mf(e,t){const r=tA(e,"_meta");return r!==void 0&&r[t]!==void 0}var mH=new Set(["ui/open-link","ui/message","ui/update-model-context","ui/request-display-mode"]),gH=new Set(["ui/notifications/tool-input","ui/notifications/tool-input-partial","ui/notifications/tool-result","ui/notifications/tool-cancelled","ui/notifications/host-context-changed","ui/notifications/size-changed","ui/resource-teardown"]),jy=new Set(["tools/call","tools/list"]);function vH(e){const t=fc(e)?e.content:void 0;return Array.isArray(t)&&t.some(r=>fc(r)&&r.type==="text")}function _H(e,t,r){if(e==="tools/call"&&r.add("apps.app-tools-call"),e==="resources/read"&&(r.add("apps.app-resources-read"),mf(t,"openai/resource")&&r.add("openai.file-resources")),mH.has(e)&&r.add("apps.view-requests"),e==="ui/message"&&mf(t,"openai/message")&&r.add("openai.message"),(e==="notifications/message"||e==="ping")&&r.add("apps.view-notifications"),(e==="ui/download-file"||e==="ui/notifications/request-teardown")&&r.add("apps.download-file-teardown"),e==="notifications/tools/list_changed"&&r.add("apps.app-provided-tools"),e==="openai/resources/write"&&r.add("openai.file-resources"),e==="openai/files/open"&&r.add("openai.files"),e==="ui/initialize"){const s=tA(t,"appCapabilities"),n=s?.availableDisplayModes;Array.isArray(n)&&n.length>0&&r.add("apps.display-modes"),s?.tools!==void 0&&r.add("apps.app-provided-tools")}}function E7(e,t){const r=new Set,s=fc(e.message)?e.message:void 0,n=typeof s?.method=="string"?s.method:void 0,i=n===void 0&&s?.id!==void 0&&(s.result!==void 0||s.error!==void 0);if(e.direction==="ui-to-host")n?_H(n,s?.params,r):i&&jy.has(e.method)&&r.add("apps.app-provided-tools");else if(i)t==="ui/update-model-context"&&mf(s?.result,"openai/modelContext")&&r.add("openai.model-context");else{const o=n??e.method;gH.has(o)&&r.add("apps.host-notifications"),o==="ui/notifications/tool-result"&&vH(s?.params)&&r.add("apps.text-fallback"),jy.has(o)&&r.add("apps.app-provided-tools")}return[...r].filter(o=>fH.has(o))}function gf(){try{if(typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`}var ws=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,hr=globalThis,rA="10.75.0";function $c(){return Wg(hr),hr}function Wg(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||"10.75.0",t[rA]=t["10.75.0"]||{}}function Od(e,t,r=hr){const s=r.__SENTRY__=r.__SENTRY__||{},n=s[rA]=s["10.75.0"]||{};return n[e]||(n[e]=t())}var T7=["debug","info","warn","error","log","assert","trace"],yH="Sentry Logger ",Hy={};function Kg(e){if(!("console"in hr))return e();const t=hr.console,r={},s=Object.keys(Hy);s.forEach(n=>{const i=Hy[n];r[n]=t[n],t[n]=i});try{return e()}finally{s.forEach(n=>{t[n]=r[n]})}}function bH(){Yg().enabled=!0}function SH(){Yg().enabled=!1}function sA(){return Yg().enabled}function wH(...e){Jg("log",...e)}function kH(...e){Jg("warn",...e)}function EH(...e){Jg("error",...e)}function Jg(e,...t){ws&&sA()&&Kg(()=>{hr.console[e](`${yH}[${e}]:`,...t)})}function Yg(){return ws?Od("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var Zr={enable:bH,disable:SH,isEnabled:sA,log:wH,warn:kH,error:EH},nA=50;var By=/\(error: (.*)\)/,Vy=/captureMessage|captureException/;function TH(...e){const t=e.sort((r,s)=>r[0]-s[0]).map(r=>r[1]);return(r,s=0,n=0)=>{const i=[],o=r.split(`
|
|
57
|
+
`);for(let a=s;a<o.length;a++){let c=o[a];c.length>1024&&(c=c.slice(0,1024));const l=By.test(c)?c.replace(By,"$1"):c;if(!l.includes("Error: ")){for(const u of t){const p=u(l);if(p){i.push(p);break}}if(i.length>=nA+n)break}}return AH(i.slice(n))}}function A7(e){return Array.isArray(e)?TH(...e):e}function AH(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(wl(t).function||"")&&t.pop(),t.reverse(),Vy.test(wl(t).function||"")&&(t.pop(),Vy.test(wl(t).function||"")&&t.pop()),t.slice(0,nA).map(r=>({...r,filename:r.filename||wl(t).filename,function:r.function||"?"}))}function wl(e){return e[e.length-1]||{}}var Cp="<anonymous>";function IH(e){try{return!e||typeof e!="function"?Cp:e.name||Cp}catch{return Cp}}function I7(e){const t=e.exception;if(t){const r=[];try{return t.values.forEach(s=>{s.stacktrace.frames&&r.push(...s.stacktrace.frames)}),r}catch{return}}}var iA=Object.prototype.toString;function RH(e){switch(iA.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Xg(e,Error)}}function ea(e,t){return iA.call(e)===`[object ${t}]`}function R7(e){return ea(e,"ErrorEvent")}function C7(e){return ea(e,"DOMError")}function P7(e){return ea(e,"DOMException")}function vf(e){return ea(e,"String")}function CH(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function PH(e){return e===null||CH(e)||typeof e!="object"&&typeof e!="function"}function xH(e){return ea(e,"Object")}function OH(e){return typeof e=="object"&&e!==null}function MH(e){return typeof Event<"u"&&Xg(e,Event)}function LH(e){return ea(e,"RegExp")}function Md(e){return!!(e?.then&&typeof e.then=="function")}function Xg(e,t){try{return e instanceof t}catch{return!1}}function x7(e){return typeof Request<"u"&&Xg(e,Request)}function O7(e,t,r){if(!(t in e))return;const s=e[t];if(typeof s!="function")return;const n=r(s);typeof n=="function"&&NH(n,s);try{e[t]=n}catch{ws&&Zr.log(`Failed to replace method "${t}" in object`,e)}}function Ts(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch{ws&&Zr.log(`Failed to add non-enumerable property "${String(t)}" to object`,e)}}function NH(e,t){try{e.prototype=t.prototype=t.prototype||{},Ts(e,"__sentry_original__",t)}catch{}}function M7(e){return e.__sentry_original__}function oA(e){if(RH(e))return{message:e.message,name:e.name,stack:e.stack,...Gy(e)};if(MH(e)){const{type:t,target:r,currentTarget:s,detail:n}=e;return{type:t,target:r,currentTarget:s,...n?{detail:n}:{},...Gy(e)}}return e}function Gy(e){return OH(e)?Object.fromEntries(Object.entries(e)):{}}function L7(e){const t=Object.keys(oA(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}var Vi;function Dc(e){if(Vi!==void 0)return Vi?Vi(e):e();const t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),r=hr;return t in r&&typeof r[t]=="function"?(Vi=r[t],Vi(e)):(Vi=null,e())}function _i(){return Dc(()=>Math.random())}function aA(){return Dc(()=>Date.now())}var $H=Symbol.for("sentry.skipNormalization"),DH=Symbol.for("sentry.overrideNormalizationDepth");function UH(e){return!!e[$H]}function qH(e){const t=e[DH];return typeof t=="number"?t:void 0}var _f;function N7(e){_f=e}function ln(e,t=100,r=1/0){try{return yf("",e,t,r)}catch(s){return{ERROR:`**non-serializable** (${s})`}}}function zH(e,t=3,r=102400){const s=ln(e,t);return HH(s)>r?zH(e,t-1,r):s}function yf(e,t,r=1/0,s=1/0,n=BH()){const[i,o]=n;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;const a=cA(e,t);if(!a.startsWith("[object "))return a;if(UH(t))return t;const c=qH(t),l=c!==void 0?c:r;if(l===0)return a.replace("object ","");if(i(t))return"[Circular ~]";const u=t;if(u&&typeof u.toJSON=="function")try{return yf("",u.toJSON(),l-1,s,n)}catch{}const p=Array.isArray(t)?[]:{};let d=0;const h=oA(t);for(const f in h){if(!Object.prototype.hasOwnProperty.call(h,f))continue;if(d>=s){p[f]="[MaxProperties ~]";break}const m=h[f];p[f]=yf(f,m,l-1,s,n),d++}return o(t),p}function cA(e,t){try{if(_f){const r=_f(t);if(r)return r}return typeof global<"u"&&t===global?"[Global]":typeof t=="number"&&!Number.isFinite(t)?`[${t}]`:typeof t=="function"?`[Function: ${IH(t)}]`:typeof t=="symbol"?`[${String(t)}]`:typeof t=="bigint"?`[BigInt: ${String(t)}]`:`[object ${FH(t)}]`}catch(r){return`**non-serializable** (${r})`}}function FH(e){const t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}function jH(e){return~-encodeURI(e).split(/%..|./).length}function HH(e){return jH(JSON.stringify(e))}function BH(){const e=new WeakSet;function t(s){return e.has(s)?!0:(e.add(s),!1)}function r(s){e.delete(s)}return[t,r]}function bf(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function $7(e,t){if(!Array.isArray(e))return"";const r=[];for(let s=0;s<e.length;s++){const n=e[s];PH(n)?r.push(String(n)):n instanceof Error?r.push(n.message?`${n.name}: ${n.message}`:n.name):r.push(cA(void 0,n))}return r.join(t)}function VH(e,t,r=!1){return vf(e)?LH(t)?t.test(e):vf(t)?r?e===t:e.includes(t):typeof t=="function"?t(e):!1:!1}function D7(e,t=[],r=!1){for(const s of t)if(VH(e,s,r))return!0;return!1}function GH(){const e=hr;return e.crypto||e.msCrypto}var Pp;function WH(){return _i()*16}function Cn(e=GH()){try{if(e?.randomUUID)return Dc(()=>e.randomUUID()).replace(/-/g,"")}catch{}return Pp||(Pp="10000000100040008000100000000000"),Pp.replace(/[018]/g,t=>(t^(WH()&15)>>t/4).toString(16))}function lA(e){return e.exception?.values?.[0]}function U7(e){const{message:t,event_id:r}=e;if(t)return t;const s=lA(e);return s?s.type&&s.value?`${s.type}: ${s.value}`:s.type||s.value||r||"<unknown>":r||"<unknown>"}function q7(e,t,r){const s=e.exception=e.exception||{},n=s.values=s.values||[],i=n[0]=n[0]||{};i.value||(i.value=t||""),i.type||(i.type=r||"Error")}function KH(e,t){const r=lA(e);if(!r)return;const s={type:"generic",handled:!0},n=r.mechanism;if(r.mechanism={...s,...n,...t},t&&"data"in t){const i={...n?.data,...t.data};r.mechanism.data=i}}function z7(e){if(JH(e))return!0;try{Ts(e,"__sentry_captured__",!0)}catch{}return!1}function JH(e){try{return e.__sentry_captured__}catch{}}var uA=1e3;function Zg(){return aA()/uA}function YH(){const{performance:e}=hr;if(!e?.now||!e.timeOrigin)return Zg;const t=e.timeOrigin;return()=>(t+Dc(()=>e.now()))/uA}var Wy;function Qg(){return(Wy??(Wy=YH()))()}var xp=null;function XH(){const{performance:e}=hr;if(!e?.now)return;const t=3e5,r=Dc(()=>e.now()),s=aA(),n=e.timeOrigin;if(typeof n=="number"&&Math.abs(n+r-s)<t)return n;const i=e.timing?.navigationStart;return typeof i=="number"&&Math.abs(i+r-s)<t?i:s-r}function F7(){return xp===null&&(xp=XH()),xp}function ZH(e){const t=Qg(),r={sid:Cn(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>e5(r)};return e&&Ld(r,e),r}function Ld(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||Qg(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:Cn()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{const r=e.timestamp-e.started;e.duration=r>=0?r:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}function QH(e,t){let r={};t?r={status:t}:e.status==="ok"&&(r={status:"exited"}),Ld(e,r)}function e5(e){return{sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did=="number"||typeof e.did=="string"?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}function Nd(e,t,r=2){if(!t||typeof t!="object"||r<=0)return t;if(e&&Object.keys(t).length===0)return e;const s={...e};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(s[n]=Nd(s[n],t[n],r-1));return s}function Mo(){return Cn()}function Uc(){return Cn().substring(16)}function dA(e){try{const t=hr.WeakRef;if(typeof t=="function")return new t(e)}catch{}return e}function pA(e){if(e){if(typeof e=="object"&&"deref"in e&&typeof e.deref=="function")try{return e.deref()}catch{return}return e}}var Sf="_sentrySpan";function Ky(e,t){t?Ts(e,Sf,dA(t)):delete e[Sf]}function wf(e){return pA(e[Sf])}var t5=100,Ii=class kf{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Mo(),sampleRand:_i()}}clone(){const t=new kf;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._attributes={...this._attributes},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,t._conversationId=this._conversationId,Ky(t,wf(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Ld(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(t){return this._conversationId=t||void 0,this._notifyScopeListeners(),this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,r){return this.setTags({[t]:r})}setAttributes(t){return this._attributes={...this._attributes,...t},this._notifyScopeListeners(),this}setAttribute(t,r){return this.setAttributes({[t]:r})}removeAttribute(t){return t in this._attributes&&(delete this._attributes[t],this._notifyScopeListeners()),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,r){return this._extra={...this._extra,[t]:r},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,r){return r===null?delete this._contexts[t]:this._contexts[t]=r,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const r=typeof t=="function"?t(this):t,{tags:s,attributes:n,extra:i,user:o,contexts:a,level:c,fingerprint:l=[],propagationContext:u,conversationId:p}=(r instanceof kf?r.getScopeData():xH(r)?t:void 0)||{};return this._tags={...this._tags,...s},this._attributes={...this._attributes,...n},this._extra={...this._extra,...i},this._contexts={...this._contexts,...a},o&&Object.keys(o).length&&(this._user=o),c&&(this._level=c),l.length&&(this._fingerprint=l),u&&(this._propagationContext=u),p&&(this._conversationId=p),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,Ky(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Mo(),sampleRand:_i()}),this._notifyScopeListeners(),this}addBreadcrumb(t,r){const s=typeof r=="number"?r:t5;if(s<=0)return this;const n={timestamp:Zg(),...t,message:t.message?bf(t.message,2048):t.message};return this._breadcrumbs.push(n),this._breadcrumbs.length>s&&(this._breadcrumbs=this._breadcrumbs.slice(-s),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:wf(this),conversationId:this._conversationId}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Nd(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,r){const s=r?.event_id||Cn();if(!this._client)return ws&&Zr.warn("No client configured on scope - will not capture exception!"),s;const n=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:n,...r,event_id:s},this),s}captureMessage(t,r,s){const n=s?.event_id||Cn();if(!this._client)return ws&&Zr.warn("No client configured on scope - will not capture message!"),n;const i=s?.syntheticException??new Error(t);return this._client.captureMessage(t,r,{originalException:t,syntheticException:i,...s,event_id:n},this),n}captureEvent(t,r){const s=t.event_id||r?.event_id||Cn();return this._client?(this._client.captureEvent(t,{...r,event_id:s},this),s):(ws&&Zr.warn("No client configured on scope - will not capture event!"),s)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}};function r5(){return Od("defaultCurrentScope",()=>new Ii)}function s5(){return Od("defaultIsolationScope",()=>new Ii)}var Jy=e=>e instanceof Promise&&!e[hA],hA=Symbol("chained PromiseLike"),n5=(e,t,r)=>{const s=e.then(n=>(t(n),n),n=>{throw r(n),n});return Jy(s)&&Jy(e)?s:i5(e,s)},i5=(e,t)=>{if(!t)return e;let r=!1;for(const s in e){if(s in t)continue;r=!0;const n=e[s];typeof n=="function"?Object.defineProperty(t,s,{value:(...i)=>n.apply(e,i),enumerable:!0,configurable:!0,writable:!0}):t[s]=n}return r&&Object.assign(t,{[hA]:!0}),t},o5=class{constructor(e,t){let r;e?r=e:r=new Ii;let s;t?s=t:s=new Ii,this._stack=[{scope:r}],this._isolationScope=s}withScope(e){const t=this._pushScope();let r;try{r=e(t)}catch(s){throw this._popScope(),s}return Md(r)?n5(r,()=>this._popScope(),()=>this._popScope()):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Lo(){const e=$c(),t=Wg(e);return t.stack=t.stack||new o5(r5(),s5())}function a5(e){return Lo().withScope(e)}function c5(e,t){const r=Lo();return r.withScope(()=>(r.getStackTop().scope=e,t(e)))}function Yy(e){return Lo().withScope(()=>e(Lo().getIsolationScope()))}function l5(){return{withIsolationScope:Yy,withScope:a5,withSetScope:c5,withSetIsolationScope:(e,t)=>Yy(t),getCurrentScope:()=>Lo().getScope(),getIsolationScope:()=>Lo().getIsolationScope()}}function $d(e){const t=Wg(e);return t.acs?t.acs:l5()}function u5(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)&&Object.keys(e).includes("value")}function d5(e,t){const{value:r,unit:s}=u5(e)?e:{value:e,unit:void 0},n=p5(r),i=s&&typeof s=="string"?{unit:s}:{};if(n)return{...n,...i};if(!t||t==="skip-undefined"&&r===void 0)return;let o="";try{o=JSON.stringify(r)??""}catch{}return{value:o,type:"string",...i}}function Xy(e,t=!1){const r={};for(const[s,n]of Object.entries(e??{})){const i=d5(n,t);i&&(r[s]=i)}return r}function p5(e){if(Array.isArray(e))return{value:e,type:"array"};const t=typeof e=="string"?"string":typeof e=="boolean"?"boolean":typeof e=="number"&&!Number.isNaN(e)?Number.isInteger(e)?"integer":"double":null;if(t)return{value:e,type:t}}var fA;function h5(){return fA?.()}function j7(){return fA!==void 0}function Oi(){const e=$c();return $d(e).getCurrentScope()}function Mi(){const e=$c();return $d(e).getIsolationScope()}function f5(){return Od("globalScope",()=>new Ii)}function H7(...e){const t=$c(),r=$d(t);if(e.length===2){const[s,n]=e;return s?r.withSetScope(s,n):r.withScope(n)}return r.withScope(e[0])}function Dd(){return Oi().getClient()}function B7(e){const t=h5();if(t)return{trace_id:t.traceId,span_id:t.spanId};const{traceId:r,parentSpanId:s,propagationSpanId:n}=e.getPropagationContext(),i={trace_id:r,span_id:n||Uc()};return s&&(i.parent_span_id=s),i}var V7="sentry.source",G7="sentry.sample_rate",W7="sentry.previous_trace_sample_rate",m5="sentry.op",g5="sentry.origin";var K7="sentry.idle_span_finish_reason",J7="sentry.measurement_unit",Y7="sentry.measurement_value",X7="sentry.custom_span_name",Z7="sentry.profile_id",Q7="sentry.exclusive_time",eW="sentry.link.type",tW="gen_ai.conversation.id";function v5(e){if(e<400&&e>=100)return{code:1};if(e>=400&&e<500)switch(e){case 401:return{code:2,message:"unauthenticated"};case 403:return{code:2,message:"permission_denied"};case 404:return{code:2,message:"not_found"};case 409:return{code:2,message:"already_exists"};case 413:return{code:2,message:"failed_precondition"};case 429:return{code:2,message:"resource_exhausted"};case 499:return{code:2,message:"cancelled"};default:return{code:2,message:"invalid_argument"}}if(e>=500&&e<600)switch(e){case 501:return{code:2,message:"unimplemented"};case 503:return{code:2,message:"unavailable"};case 504:return{code:2,message:"deadline_exceeded"};default:return{code:2,message:"internal_error"}}return{code:2,message:"internal_error"}}function rW(e,t){e.setAttribute("http.response.status_code",t);const r=v5(t);r.message!=="unknown_error"&&e.setStatus(r)}var mA="_sentryScope",gA="_sentryIsolationScope",_5=Symbol.for("sentry.otelSourceInference"),y5=Symbol.for("sentry.otelSourceExplicitlySet"),b5=Symbol.for("sentry.tracerProviderSpan");function sW(e,t,r){e&&(Ts(e,gA,dA(r)),Ts(e,mA,t))}function Ef(e){const t=e;return{scope:t[mA],isolationScope:pA(t[gA])}}function nW(e){return e[_5]===!0}function iW(e){Ts(e,y5,!0)}function oW(e){return e[b5]===!0}var S5="sentry-";function vA(e){const t=w5(e);if(!t)return;const r=Object.entries(t).reduce((s,[n,i])=>{if(n.startsWith("sentry-")){const o=n.slice(7);s[o]=i}return s},{});if(Object.keys(r).length>0)return r}function aW(e){if(e)return k5(Object.entries(e).reduce((t,[r,s])=>(s&&(t[`${S5}${r}`]=s),t),{}))}function w5(e){if(!(!e||!vf(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,r)=>{const s=Zy(r);return Object.entries(s).forEach(([n,i])=>{t[n]=i}),t},{}):Zy(e)}function Zy(e){return e.split(",").map(t=>{const r=t.indexOf("=");return r===-1?[]:[t.slice(0,r),t.slice(r+1)].map(s=>{try{return decodeURIComponent(s.trim())}catch{return}})}).reduce((t,[r,s])=>(r&&s&&(t[r]=s),t),{})}function k5(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((t,[r,s],n)=>{const i=`${encodeURIComponent(r)}=${encodeURIComponent(s)}`,o=n===0?i:`${t},${i}`;return o.length>8192?(ws&&Zr.warn(`Not adding key: ${r} with val: ${s} to baggage header due to exceeding baggage size limits.`),t):o},"")}var E5=/^o(\d+)\./,T5=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function A5(e){return e==="http"||e==="https"}function cW(e,t=!1){const{host:r,path:s,pass:n,port:i,projectId:o,protocol:a,publicKey:c}=e;return`${a}://${c}${t&&n?`:${n}`:""}@${r}${i?`:${i}`:""}/${s&&`${s}/`}${o}`}function I5(e){const t=T5.exec(e);if(!t){Kg(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}const[r,s,n="",i="",o="",a=""]=t.slice(1);let c="",l=a;const u=l.split("/");if(u.length>1&&(c=u.slice(0,-1).join("/"),l=u.pop()),l){const p=l.match(/^\d+/);p&&(l=p[0])}return _A({host:i,pass:n,path:c,projectId:l,port:o,protocol:r,publicKey:s})}function _A(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function R5(e){if(!ws)return!0;const{port:t,projectId:r,protocol:s}=e;return["protocol","publicKey","host","projectId"].find(n=>e[n]?!1:(Zr.error(`Invalid Sentry Dsn: ${n} missing`),!0))?!1:r.match(/^\d+$/)?A5(s)?t&&isNaN(parseInt(t,10))?(Zr.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(Zr.error(`Invalid Sentry Dsn: Invalid protocol ${s}`),!1):(Zr.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function C5(e){return e.match(E5)?.[1]}function P5(e){const t=e.getOptions(),{host:r}=e.getDsn()||{};let s;return t.orgId?s=String(t.orgId):r&&(s=C5(r)),s}function lW(e){const t=typeof e=="string"?I5(e):_A(e);if(!(!t||!R5(t)))return t}function Qy(e){if(typeof e=="boolean")return Number(e);const t=typeof e=="string"?parseFloat(e):e;if(!(typeof t!="number"||isNaN(t)||t<0||t>1))return t}var x5=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function O5(e){if(!e)return;const t=e.match(x5);if(!t)return;let r;return t[3]==="1"?r=!0:t[3]==="0"&&(r=!1),{traceId:t[1],parentSampled:r,parentSpanId:t[2]}}function uW(e,t){const r=O5(e),s=vA(t);if(!r?.traceId)return{traceId:Mo(),sampleRand:_i()};const n=N5(r,s);s&&(s.sample_rand=n.toString());const{traceId:i,parentSpanId:o,parentSampled:a}=r;return{traceId:i,parentSpanId:o,sampled:a,dsc:s||{},sampleRand:n}}function M5(e=Mo(),t=Uc(),r){let s="";return r!==void 0&&(s=r?"-1":"-0"),`${e}-${t}${s}`}function L5(e=Mo(),t=Uc(),r){return`00-${e}-${t}-${r?"01":"00"}`}function N5(e,t){const r=Qy(t?.sample_rand);if(r!==void 0)return r;const s=Qy(t?.sample_rate);return s&&e?.parentSampled!==void 0?e.parentSampled?_i()*s:s+_i()*(1-s):_i()}var eb=!1;function dW(e){const{spanId:t,traceId:r}=e.spanContext(),{data:s,op:n,parent_span_id:i,status:o,origin:a,links:c}=Ud(e);return{parent_span_id:i,span_id:t,trace_id:r,data:s,op:n,status:o,origin:a,links:c}}function $5(e){const{spanId:t,traceId:r,isRemote:s}=e.spanContext(),n=s?t:Ud(e).parent_span_id,i=Ef(e).scope;return{parent_span_id:n,span_id:s?i?.getPropagationContext().propagationSpanId||Uc():t,trace_id:r}}function pW(e){const{traceId:t,spanId:r}=e.spanContext(),s=qc(e);return M5(t,r,s)}function hW(e){const{traceId:t,spanId:r}=e.spanContext(),s=qc(e);return L5(t,r,s)}function D5(e){if(e&&e.length>0)return e.map(({context:{spanId:t,traceId:r,traceFlags:s,...n},attributes:i})=>({span_id:t,trace_id:r,sampled:s===1,attributes:i,...n}))}function U5(e){if(e?.length)return e.map(({context:{spanId:t,traceId:r,traceFlags:s},attributes:n})=>({span_id:t,trace_id:r,sampled:s===1,attributes:n}))}function fu(e){return typeof e=="number"?tb(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?tb(e.getTime()):Qg()}function tb(e){return e>9999999999?e/1e3:e}function Ud(e){if(SA(e))return e.getSpanJSON();const{spanId:t,traceId:r}=e.spanContext();if(bA(e)){const{attributes:s,startTime:n,name:i,endTime:o,status:a,links:c}=e;return{span_id:t,trace_id:r,data:s,description:i,parent_span_id:yA(e),start_timestamp:fu(n),timestamp:fu(o)||void 0,status:q5(a),op:s[m5],origin:s[g5],links:D5(c)}}return{span_id:t,trace_id:r,start_timestamp:0,data:{}}}function fW(e){if(SA(e))return e.getStreamedSpanJSON();const{spanId:t,traceId:r}=e.spanContext();if(bA(e)){const{attributes:s,startTime:n,name:i,endTime:o,status:a,links:c}=e;return{name:i,span_id:t,trace_id:r,parent_span_id:yA(e),start_timestamp:fu(n),end_timestamp:fu(o),is_segment:e===Af(e),status:wA(a),attributes:z5(s,a),links:U5(c)}}return{span_id:t,trace_id:r,start_timestamp:0,name:"",end_timestamp:0,status:"ok",is_segment:e===Af(e)}}function yA(e){return"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0}function mW(e){return{...e,attributes:Xy(e.attributes),links:e.links?.map(t=>({...t,attributes:Xy(t.attributes)}))}}function bA(e){const t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function SA(e){return typeof e.getSpanJSON=="function"}function qc(e){const{traceFlags:t}=e.spanContext();return t===1}function q5(e){if(!(!e||e.code===0))return e.code===1?"ok":e.message||"internal_error"}function wA(e){return!e||e.code===1||e.code===0||e.message==="cancelled"?"ok":"error"}function z5(e,t){const r=wA(t)==="error"?t?.message:void 0;return{...r&&{"sentry.status.message":r},...e}}var yi="_sentryChildSpans",Tf="_sentryRootSpan";function gW(e,t){const r=e[Tf]||e;Ts(t,Tf,r),qc(e)&&(!e.isRecording()&&!r.isRecording()||(e[yi]?e[yi].add(t):Ts(e,yi,new Set([t]))))}function vW(e,t){e[yi]&&e[yi].delete(t)}function _W(e){const t=new Set;function r(s){if(!t.has(s)&&qc(s)){t.add(s);const n=s[yi]?Array.from(s[yi]):[];for(const i of n)r(i)}}return r(e),Array.from(t)}var kA=Af;function Af(e){return e[Tf]||e}function yW(){const e=$c(),t=$d(e);return t.getActiveSpan?t.getActiveSpan():wf(Oi())}function bW(){eb||(Kg(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),eb=!0)}function rb(e){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const t=e||Dd()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}var EA=Symbol.for("sentry.nonRecordingSpan"),SW=class{constructor(e={}){this._traceId=e.traceId||Mo(),this._spanId=e.spanId||Uc(),this.dropReason=e.dropReason,Ts(this,EA,!0)}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:0}}end(e){}setAttribute(e,t){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,t,r){return this}addLink(e){return this}addLinks(e){return this}recordException(e,t){}};function F5(e){return!!e&&e[EA]===!0}var wW="production",TA="_frozenDsc";function kW(e,t){Ts(e,TA,t)}function AA(e,t){const r=t.getOptions(),{publicKey:s}=t.getDsn()||{},n={environment:r.environment||"production",release:r.release,public_key:s,trace_id:e,org_id:P5(t)};return t.emit("createDsc",n),n}function j5(e,t){const r=t.getPropagationContext();return r.dsc||AA(r.traceId,e)}function H5(e){const t=Dd();if(!t)return{};const r=kA(e),s=Ud(r),n=s.data,i=r.spanContext().traceState,o=i?.get("sentry.sample_rate")??n["sentry.sample_rate"]??n["sentry.previous_trace_sample_rate"];function a(v){return(typeof o=="number"||typeof o=="string")&&(v.sample_rate=`${o}`),v}const c=r[TA];if(c)return a(c);const l=F5(r),u=l&&r.dropReason==="ignored";if(l&&(!rb(t.getOptions())||u)){const v=Ef(r).scope;if(v){const _={...j5(t,v)};return u&&(_.sampled="false"),a(_)}}const p=i?.get("sentry.dsc"),d=p&&vA(p);if(d)return a(d);const h=AA(e.spanContext().traceId,t),f=n["sentry.source"]??n["sentry.segment.name.source"],m=s.description;return f!=="url"&&m&&(h.transaction=m),rb()&&(h.sampled=String(qc(r)),h.sample_rand=i?.get("sentry.sample_rand")??Ef(r).scope?.getPropagationContext().sampleRand.toString()),a(h),t.emit("createDsc",h,r),h}function B5(e,t){const{fingerprint:r,span:s,breadcrumbs:n,sdkProcessingMetadata:i}=t;V5(e,t),s&&K5(e,s),J5(e,r),G5(e,n),W5(e,i)}function sb(e,t){const{extra:r,tags:s,attributes:n,user:i,contexts:o,level:a,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:u,eventProcessors:p,attachments:d,propagationContext:h,transactionName:f,span:m}=t;ba(e,"extra",r),ba(e,"tags",s),ba(e,"attributes",n),ba(e,"user",i),ba(e,"contexts",o),e.sdkProcessingMetadata=Nd(e.sdkProcessingMetadata,c,2),a&&(e.level=a),f&&(e.transactionName=f),m&&(e.span=m),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),u.length&&(e.fingerprint=[...e.fingerprint,...u]),p.length&&(e.eventProcessors=[...e.eventProcessors,...p]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...h}}function ba(e,t,r){e[t]=Nd(e[t],r,1)}function IA(e,t){const r=f5().getScopeData();return e&&sb(r,e.getScopeData()),t&&sb(r,t.getScopeData()),r}function V5(e,t){const{extra:r,tags:s,user:n,contexts:i,level:o,transactionName:a}=t;Object.keys(r).length&&(e.extra={...r,...e.extra}),Object.keys(s).length&&(e.tags={...s,...e.tags}),Object.keys(n).length&&(e.user={...n,...e.user}),Object.keys(i).length&&(e.contexts={...i,...e.contexts}),o&&(e.level=o),a&&e.type!=="transaction"&&(e.transaction=a)}function G5(e,t){const r=[...e.breadcrumbs||[],...t];e.breadcrumbs=r.length?r:void 0}function W5(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function K5(e,t){e.contexts={trace:$5(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:H5(t),...e.sdkProcessingMetadata};const r=kA(t),s=Ud(r).description;s&&!e.transaction&&e.type==="transaction"&&(e.transaction=s)}function J5(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}var Op=0,nb=1,ib=2;function RA(e){return new CA(t=>{t(e)})}function Y5(e){return new CA((t,r)=>{r(e)})}var CA=class If{constructor(t){this._state=Op,this._handlers=[],this._runExecutor(t)}then(t,r){return new If((s,n)=>{this._handlers.push([!1,i=>{if(!t)s(i);else try{s(t(i))}catch(o){n(o)}},i=>{if(!r)n(i);else try{s(r(i))}catch(o){n(o)}}]),this._executeHandlers()})}catch(t){return this.then(r=>r,t)}finally(t){return new If((r,s)=>{let n,i;return this.then(o=>{i=!1,n=o,t&&t()},o=>{i=!0,n=o,t&&t()}).then(()=>{if(i){s(n);return}r(n)})})}_executeHandlers(){if(this._state===Op)return;const t=this._handlers.slice();this._handlers=[],t.forEach(r=>{r[0]||(this._state===nb&&r[1](this._value),this._state===ib&&r[2](this._value),r[0]=!0)})}_runExecutor(t){const r=(i,o)=>{if(this._state===Op){if(Md(o)){o.then(s,n);return}this._state=i,this._value=o,this._executeHandlers()}},s=i=>{r(nb,i)},n=i=>{r(ib,i)};try{t(s,n)}catch(i){n(i)}}};function X5(e,t,r,s=0){try{const n=Rf(t,r,e,s);return Md(n)?n:RA(n)}catch(n){return Y5(n)}}function Rf(e,t,r,s){const n=r[s];if(!e||!n)return e;const i=n({...e},t);return ws&&i===null&&Zr.log(`Event processor "${n.id||"?"}" dropped event`),Md(i)?i.then(o=>Rf(o,t,r,s+1)):Rf(i,t,r,s+1)}var Wn,ob,ab,nn;function Z5(e){const t=hr._sentryDebugIds,r=hr._debugIds;if(!t&&!r)return{};const s=t?Object.keys(t):[],n=r?Object.keys(r):[];if(nn&&s.length===ob&&n.length===ab)return nn;ob=s.length,ab=n.length,nn={},Wn||(Wn={});const i=(o,a)=>{for(const c of o){const l=a[c],u=Wn?.[c];if(u&&nn&&l)nn[u[0]]=l,Wn&&(Wn[c]=[u[0],l]);else if(l){const p=e(c);for(let d=p.length-1;d>=0;d--){const h=p[d]?.filename;if(h&&nn&&Wn){nn[h]=l,Wn[c]=[h,l];break}}}}};return t&&i(s,t),r&&i(n,r),nn}function EW(e,t,r,s,n,i){const{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=e,c={...t,event_id:t.event_id||r.event_id||Cn(),timestamp:t.timestamp||Zg()},l=r.integrations||e.integrations.map(m=>m.name);Q5(c,e),r6(c,l),n&&n.emit("applyFrameMetadata",t),t.type===void 0&&e6(c,e.stackParser);const u=n6(s,r.captureContext);r.mechanism&&KH(c,r.mechanism);const p=n?n.getEventProcessors():[],d=IA(i,u),h=[...r.attachments||[],...d.attachments];h.length&&(r.attachments=h),B5(c,d);const f=[...p,...d.eventProcessors];return(r.data&&r.data.__sentry__===!0?RA(c):X5(f,c,r)).then(m=>(m&&t6(m),typeof o=="number"&&o>0?s6(m,o,a):m))}function Q5(e,t){const{environment:r,release:s,dist:n,maxValueLength:i}=t;e.environment=e.environment||r||"production",!e.release&&s&&(e.release=s),!e.dist&&n&&(e.dist=n);const o=e.request;o?.url&&i&&(o.url=bf(o.url,i)),i&&e.exception?.values?.forEach(a=>{a.value&&(a.value=bf(a.value,i))})}function e6(e,t){const r=Z5(t);e.exception?.values?.forEach(s=>{s.stacktrace?.frames?.forEach(n=>{n.filename&&(n.debug_id=r[n.filename])})})}function t6(e){const t={};if(e.exception?.values?.forEach(s=>{s.stacktrace?.frames?.forEach(n=>{n.debug_id&&(n.abs_path?t[n.abs_path]=n.debug_id:n.filename&&(t[n.filename]=n.debug_id),delete n.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const r=e.debug_meta.images;Object.entries(t).forEach(([s,n])=>{r.push({type:"sourcemap",code_file:s,debug_id:n})})}function r6(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function s6(e,t,r){if(!e)return null;const s={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(n=>({...n,...n.data&&{data:ln(n.data,t,r)}}))},...e.user&&{user:ln(e.user,t,r)},...e.contexts&&{contexts:ln(e.contexts,t,r)},...e.extra&&{extra:ln(e.extra,t,r)}};return e.contexts?.trace&&s.contexts&&(s.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(s.contexts.trace.data=ln(e.contexts.trace.data,t,r))),e.spans&&(s.spans=e.spans.map(n=>({...n,...n.data&&{data:ln(n.data,t,r)}}))),e.contexts?.flags&&s.contexts&&(s.contexts.flags=ln(e.contexts.flags,3,r)),s}function n6(e,t){if(!t)return e;const r=e?e.clone():new Ii;return r.update(t),r}function i6(e){if(e)return o6(e)?{captureContext:e}:c6(e)?{captureContext:e}:e}function o6(e){return e instanceof Ii||typeof e=="function"}var a6=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function c6(e){return Object.keys(e).some(t=>a6.includes(t))}function l6(e,t){return Oi().captureException(e,i6(t))}function TW(e,t){const r=typeof t=="string"?t:void 0,s=typeof t!="string"?{captureContext:t}:void 0;return Oi().captureMessage(e,r,s)}function AW(e,t){return Oi().captureEvent(e,t)}function IW(e,t){Mi().setContext(e,t)}function RW(e,t){Mi().setTag(e,t)}function CW(e){Mi().setUser(e)}function PW(){const e=Dd();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function xW(e){Mi().addEventProcessor(e)}function OW(e){const t=Mi(),{user:r}=IA(t,Oi()),{userAgent:s}=hr.navigator||{},n=ZH({user:r,...s&&{userAgent:s},...e}),i=t.getSession();return i?.status==="ok"&&Ld(i,{status:"exited"}),PA(),t.setSession(n),n}function PA(){const e=Mi(),t=Oi().getSession()||e.getSession();t&&QH(t),xA(),e.setSession()}function xA(){const e=Mi(),t=Dd(),r=e.getSession();r&&t&&t.captureSession(r)}function MW(e=!1){if(e){PA();return}xA()}var gs=[],Pr=[],u6=Uint8Array,Mp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Gi=0,d6=Mp.length;Gi<d6;++Gi)gs[Gi]=Mp[Gi],Pr[Mp.charCodeAt(Gi)]=Gi;Pr[45]=62;Pr[95]=63;function p6(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var s=r===t?0:4-r%4;return[r,s]}function h6(e,t,r){return(t+r)*3/4-r}function mu(e){for(var t,r=p6(e),s=r[0],n=r[1],i=new u6(h6(e,s,n)),o=0,a=n>0?s-4:s,c=0;c<a;c+=4)t=Pr[e.charCodeAt(c)]<<18|Pr[e.charCodeAt(c+1)]<<12|Pr[e.charCodeAt(c+2)]<<6|Pr[e.charCodeAt(c+3)],i[o++]=t>>16&255,i[o++]=t>>8&255,i[o++]=t&255;return n===2&&(t=Pr[e.charCodeAt(c)]<<2|Pr[e.charCodeAt(c+1)]>>4,i[o++]=t&255),n===1&&(t=Pr[e.charCodeAt(c)]<<10|Pr[e.charCodeAt(c+1)]<<4|Pr[e.charCodeAt(c+2)]>>2,i[o++]=t>>8&255,i[o++]=t&255),i}function f6(e){return gs[e>>18&63]+gs[e>>12&63]+gs[e>>6&63]+gs[e&63]}function m6(e,t,r){for(var s,n=[],i=t;i<r;i+=3)s=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(e[i+2]&255),n.push(f6(s));return n.join("")}function gu(e){for(var t,r=e.length,s=r%3,n=[],i=16383,o=0,a=r-s;o<a;o+=i)n.push(m6(e,o,o+i>a?a:o+i));return s===1?(t=e[r-1],n.push(gs[t>>2]+gs[t<<4&63]+"==")):s===2&&(t=(e[r-2]<<8)+e[r-1],n.push(gs[t>>10]+gs[t>>4&63]+gs[t<<2&63]+"=")),n.join("")}function LW(e){if(e===void 0)return{};if(!OA(e))throw new Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}function NW(e){if(typeof e>"u")throw new Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof e!="string")throw new Error(`Invalid deployment address: found ${e}".`);if(!(e.startsWith("http:")||e.startsWith("https:")))throw new Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);try{new URL(e)}catch{throw new Error(`Invalid deployment address: "${e}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(e.endsWith(".convex.site"))throw new Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}function OA(e){const t=typeof e=="object",r=Object.getPrototypeOf(e),s=r===null||r===Object.prototype||r?.constructor?.name==="Object";return t&&s}var MA=!0,No=BigInt("-9223372036854775808"),ev=BigInt("9223372036854775807"),Cf=BigInt("0"),g6=BigInt("8"),v6=BigInt("256"),Lp="This commit timestamp is unresolved: its value is assigned when the mutation commits. Read the document after the mutation completes to get its value.",LA=class{[Symbol.toPrimitive](e){if(e==="string")return this.toString();throw new Error(Lp)}valueOf(){throw new Error(Lp)}toJSON(){throw new Error(Lp)}toString(){return"[unresolved commit timestamp]"}},_6=new LA;function NA(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}function y6(e){e<Cf&&(e-=No+No);let t=e.toString(16);t.length%2===1&&(t="0"+t);const r=new Uint8Array(new ArrayBuffer(8));let s=0;for(const n of t.match(/.{2}/g).reverse())r.set([parseInt(n,16)],s++),e>>=g6;return gu(r)}function b6(e){const t=mu(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let r=Cf,s=Cf;for(const n of t)r+=BigInt(n)*v6**s,s++;return r>ev&&(r+=No+No),r}function S6(e){if(e<No||ev<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);const t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),gu(new Uint8Array(t))}function w6(e){const t=mu(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);return new DataView(t.buffer).getBigInt64(0,!0)}var k6=DataView.prototype.setBigInt64?S6:y6,E6=DataView.prototype.getBigInt64?w6:b6,cb=1024;function Pf(e){if(e.length>cb)throw new Error(`Field name ${e} exceeds maximum field name length ${cb}.`);if(e.startsWith("$"))throw new Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){const r=e.charCodeAt(t);if(r<32||r>=127)throw new Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}function lb(e){if(e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(Array.isArray(e))return e.map(s=>lb(s));if(typeof e!="object")throw new Error(`Unexpected type of ${e}`);const t=Object.entries(e);if(t.length===1){const s=t[0][0];if(s==="$bytes"){if(typeof e.$bytes!="string")throw new Error(`Malformed $bytes field on ${e}`);return mu(e.$bytes).buffer}if(s==="$integer"){if(typeof e.$integer!="string")throw new Error(`Malformed $integer field on ${e}`);return E6(e.$integer)}if(s==="$float"){if(typeof e.$float!="string")throw new Error(`Malformed $float field on ${e}`);const n=mu(e.$float);if(n.byteLength!==8)throw new Error(`Received ${n.byteLength} bytes, expected 8 for $float`);const i=new DataView(n.buffer).getFloat64(0,MA);if(!NA(i))throw new Error(`Float ${i} should be encoded as a number`);return i}if(s==="$commitTs"){if(e.$commitTs!==null)throw new Error(`Malformed $commitTs field on ${e}`);return _6}if(s==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(s==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}const r={};for(const[s,n]of Object.entries(e))Pf(s),r[s]=lb(n);return r}var T6=16384;function wo(e){const t=JSON.stringify(e,(r,s)=>s===void 0?"undefined":typeof s=="bigint"?`${s.toString()}n`:s);if(t.length>T6){const r="[...truncated]";let s=16370;const n=t.codePointAt(s-1);return n!==void 0&&n>65535&&(s-=1),t.substring(0,s)+r}return t}function vu(e,t,r,s){if(e===void 0){const o=r&&` (present at path ${r} in original object ${wo(t)})`;throw new Error(`undefined is not a valid Convex value${o}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e=="bigint"){if(e<No||ev<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:k6(e)}}if(typeof e=="number")if(NA(e)){const o=new ArrayBuffer(8);return new DataView(o).setFloat64(0,e,MA),{$float:gu(new Uint8Array(o))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:gu(new Uint8Array(e))};if(e instanceof LA)return{$commitTs:null};if(Array.isArray(e))return e.map((o,a)=>vu(o,t,r+`[${a}]`,!1));if(e instanceof Set)throw new Error(Np(r,"Set",[...e],t));if(e instanceof Map)throw new Error(Np(r,"Map",[...e],t));if(!OA(e)){const o=e?.constructor?.name,a=o?`${o} `:"";throw new Error(Np(r,a,e,t))}const n={},i=Object.entries(e);i.sort(([o,a],[c,l])=>o===c?0:o<c?-1:1);for(const[o,a]of i)a!==void 0?(Pf(o),n[o]=vu(a,t,r+`.${o}`,!1)):s&&(Pf(o),n[o]=A6(a,t,r+`.${o}`));return n}function Np(e,t,r,s){return e?`${t}${wo(r)} is not a supported Convex type (present at path ${e} in original object ${wo(s)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${wo(r)} is not a supported Convex type.`}function A6(e,t,r){if(e===void 0)return{$undefined:null};if(t===void 0)throw new Error(`Programming error. Current value is ${wo(e)} but original value is undefined`);return vu(e,t,r,!1)}function $W(e){return vu(e,e,"",!1)}var I6=Object.defineProperty,R6=(e,t,r)=>t in e?I6(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$p=(e,t,r)=>R6(e,typeof t!="symbol"?t+"":t,r),ub,db,C6=Symbol.for("ConvexError"),P6=class extends(db=Error,ub=C6,db){constructor(e){super(typeof e=="string"?e:wo(e)),$p(this,"name","ConvexError"),$p(this,"data"),$p(this,ub,!0),this.data=e}};function tv(e){return nv(e,"forbidden")}function rv(e){return nv(e,"session_revoked")}function sv(e){return nv(e,"unauthenticated")}function nv(e,t){if(!(e instanceof P6))return!1;const r=e.data;return typeof r=="object"&&r!==null&&r.kind===t}var _u;function DW(e){try{_u=new URL(e).hostname}catch{_u=void 0}}function xf(e){try{const t=new URL(e);if(!/^https?:$/.test(t.protocol))return;const r=t.pathname.replace(/(\/(?:results|conformance\/shared|evals\/shared|organizations)\/)[^/]+/g,"$1[redacted]").replace(/(\/(?:user-testing|chatbox)\/[^/]+\/)[^/]+/g,"$1[redacted]");return`${t.origin}${r}`}catch{return}}function Ga(e){const t=/^\[CONVEX Q\(([\w/.-]+:[\w.-]+)\)\]/.exec(e);if(!t)return;const r=/\[Request ID: ([a-f\d]+)\]/i.exec(e)?.[1],s=`${t[0]}${r?` [Request ID: ${r}]`:""} ${/\bServer Error\b/.test(e)?"Server Error":"Query failed"}`;return{functionName:t[1],requestId:r,safeMessage:s}}function $A(e){const t=Ga(e);if(t)return{convex_function:t.functionName,...t.requestId?{request_id:t.requestId}:{},..._u?{convex_backend:_u}:{}}}function x6(e){const t=Ga(e.message);if(!t)return e;const r=new Error(t.safeMessage);if(r.name=e.name,e.stack){const s=e.stack.split(`
|
|
58
|
+
`).filter(n=>/^(\s+at |[^@]*@(?:https?|file|webpack|vite):)/.test(n));r.stack=`${r.name}: ${r.message}
|
|
59
|
+
${s.join(`
|
|
60
|
+
`)}`}return r}function DA(e=500){const t=new Set;return(r,s)=>{if(!r||!s)return!1;const n=`${r}:${s}`;return t.has(n)?!0:(t.add(n),t.size>e&&t.delete(t.values().next().value),!1)}}function UW(e=500){const t=DA(e);return(r,s={})=>{try{if(r.tags?.source==="convex_auth_refusal")return{type:r.type,event_id:r.event_id,timestamp:r.timestamp,platform:r.platform,release:r.release,dist:r.dist,environment:r.environment,message:"Convex auth refusal diagnostic",level:"info",tags:{source:"convex_auth_refusal",auth_refusal_id:r.tags.auth_refusal_id,request_id:r.tags.request_id,convex_backend:r.tags.convex_backend},contexts:{auth_refusal:r.contexts?.auth_refusal}};const n=r.exception?.values,i=n?.find(u=>Ga(u.value??"")),o=Ga(i?.value??"");if(!o)return r;if(tv(s.originalException)||rv(s.originalException)||sv(s.originalException))return null;const a=$A(i.value),c=typeof r.tags?.convex_backend=="string"?r.tags.convex_backend:a.convex_backend;if(t(c,o.requestId))return null;i.value=o.safeMessage,r.message&&(r.message=o.safeMessage),r.tags={...r.tags,...a,...c?{convex_backend:c}:{}};const l=xf((typeof r.extra?.page_location=="string"?r.extra.page_location:void 0)??r.request?.url??(typeof window<"u"?window.location.href:""));r.request=l?{url:l}:void 0,r.breadcrumbs=void 0,r.extra={...typeof r.extra?.boundary=="string"?{boundary:r.extra.boundary}:{},...typeof r.extra?.componentStack=="string"?{componentStack:r.extra.componentStack}:{},...l?{page_location:l}:{}};for(const u of n??[])if(u!==i&&u.value&&(u.value=Ga(u.value)?.safeMessage??"Query failure cause"),u.stacktrace)for(const p of u.stacktrace.frames??[])delete p.vars;return r.transaction?.includes("/")&&(r.transaction=xf(`https://route.invalid${r.transaction}`)?.replace("https://route.invalid","")),r}catch{return null}}}var iv=tS(uP(),1);function pb(e){if(typeof e!="string"||e.trim().length===0)return null;try{const t=new URL(e.trim());return t.protocol!=="http:"&&t.protocol!=="https:"?null:t.origin}catch{return null}}function Li(){if(typeof window>"u")return null;const e=window.__MCP_RUNTIME_CONFIG__;return!e||typeof e!="object"?null:e}function zc(e){return typeof e=="string"&&e.trim()?e:void 0}function qW(){return zc(Li()?.convexUrl)}function zW(){return zc(Li()?.convexSiteUrl)}function FW(){return zc(Li()?.workosClientId)}function jW(){return zc(Li()?.workosApiHostname)}function O6(){return zc(Li()?.sandboxOrigin)}function ov(){return Li()?.doNotTrack===!0}function HW(){return Li()?.platformAgentDisabled!==!0}var BW=pb(O6())??pb(void 0),VW="write",hb=null,M6=String(101376);function GW(){return hb?`https://discord.com/oauth2/authorize?${new URLSearchParams({client_id:hb,scope:"bot applications.commands",permissions:M6}).toString()}`:null}var kl="mcpjam.project-transition.v1",WW=18e5;function El(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.sourceActor=="string"&&/^(guest|workos):.{1,200}$/.test(t.sourceActor)&&typeof t.path=="string"&&KC(t.path)&&typeof t.requestedProjectId=="string"&&tP(t.requestedProjectId)&&lS(t.path)===t.requestedProjectId&&typeof t.attempt=="string"&&/^[a-zA-Z0-9-]{1,80}$/.test(t.attempt)&&Number.isFinite(t.storedAt)&&t.storedAt<=Date.now()+1e3&&Date.now()-t.storedAt<18e5}function L6(e=()=>sessionStorage){let t=null;try{const o=JSON.parse(e().getItem(kl)??"null");El(o)?t=o:e().removeItem(kl)}catch{}const r=ym(()=>({marker:t}));let s=null;const n=o=>{if(!(o&&r.getState().marker?.attempt!==o)){r.setState({marker:null});try{e().removeItem(kl)}catch{}}},i=(o,a=gf())=>{if(!s||s.path!==o)return;const c=r.getState().marker;if(c?.path===o&&El(c))return;const l={path:o,requestedProjectId:lS(o),attempt:a,storedAt:Date.now(),sourceActor:s.actor};if(El(l)){s=null;try{e().setItem(kl,JSON.stringify(l))}catch{}r.setState({marker:l})}};return{store:r,clear:n,arm:i,isValid:El,remember(o,a){s={path:o,actor:a}},observeActor(o,a){s&&s.actor!==o&&(o.startsWith("workos:")&&i(a),s=null)}}}var N6=L6();function $6(){return window.location.pathname+window.location.search+window.location.hash}var $o="mcpjam.guest-transition.v1",fb=`${$o}.reloaded`,mb=`${$o}.handled`,Dp=15e3,yu=6e4;function D6(e){if(!e||typeof e!="object")return null;const t=e;return typeof t.guestId!="string"||!t.guestId||t.guestId.length>200||typeof t.attempt!="string"||!/^[a-zA-Z0-9-]{1,80}$/.test(t.attempt)||!Number.isFinite(t.startedAt)||t.startedAt>Date.now()+1e3||Date.now()-t.startedAt>yu||!["started","completed","failed"].includes(t.phase)?null:{guestId:t.guestId,attempt:t.attempt,startedAt:t.startedAt,phase:t.phase}}function U6(e){const t=ym(()=>({status:"idle",attempt:null})),r=new Map;try{const d=JSON.parse(sessionStorage.getItem(mb)??"[]");if(Array.isArray(d))for(const h of d)Array.isArray(h)&&typeof h[0]=="string"&&/^[a-zA-Z0-9-]{1,80}$/.test(h[0])&&Number.isFinite(h[1])&&h[1]<=Date.now()+1e3&&Date.now()-h[1]<=yu&&r.set(h[0],h[1])}catch{}const s=d=>{for(const[h,f]of r)Date.now()-f>yu&&r.delete(h);r.set(d.attempt,d.startedAt);try{sessionStorage.setItem(mb,JSON.stringify([...r]))}catch{}};let n=null,i=null,o;const a=new Map,c=()=>{clearTimeout(o),i=null,t.setState({status:"idle",attempt:null})},l=()=>{clearTimeout(o),t.setState({status:"failed"})},u=d=>{if(d&&!e.allowAutomaticReload()){l();return}t.setState({status:"waiting"}),clearTimeout(o),o=setTimeout(l,Dp);try{e.reload()}catch{l()}},p=d=>{const h=D6(d);!h||!n||h.guestId!==n||r.has(h.attempt)||i&&(h.startedAt<i.startedAt||h.startedAt===i.startedAt&&h.attempt!==i.attempt)||i?.attempt===h.attempt&&i.phase!=="started"||(e.beforeTransition?.(h),i=h,clearTimeout(o),t.setState({status:"waiting",attempt:h.attempt}),h.phase==="failed"?(l(),s(h)):h.phase==="completed"?(s(h),u(!0)):o=setTimeout(()=>{l(),s(h)},Math.max(0,Dp-(Date.now()-h.startedAt))))};return{store:t,setGuest(d,h=!0){if(d!==n){n=d;const f=t.getState().status!=="idle";clearTimeout(o),i=null,f&&!h?(t.setState({status:"waiting",attempt:null}),o=setTimeout(l,Dp)):c()}else!i&&h&&t.getState().status!=="idle"&&c()},getGuest:()=>n,receive:p,begin(d){let h=a.get(d);if(!h){h={message:{guestId:d,attempt:gf(),startedAt:Date.now(),phase:"started"},count:0,failed:!1},a.set(d,h);try{e.publish(h.message)}catch{}}h.count++;let f=!1;return m=>{if(!f&&(f=!0,h.failed||=!m,!--h.count)){a.delete(d);try{e.publish({...h.message,phase:h.failed?"failed":"completed"})}catch{}}}},revoked(d){return d&&d!==n?!0:n?(t.getState().status!=="idle"||p({guestId:n,attempt:gf(),startedAt:Date.now(),phase:"completed"}),!0):!1},retry:()=>u(!1),dispose:c}}var qa,Pn=U6({beforeTransition:e=>N6.arm($6(),e.attempt),publish(e){try{qa?.postMessage(e)}catch{}try{localStorage.setItem($o,JSON.stringify(e))}catch{}},reload:()=>{const e=Pn.getGuest();queueMicrotask(()=>{Pn.getGuest()===e&&window.location.reload()})},allowAutomaticReload(){try{const e=Number(sessionStorage.getItem(fb));return e&&Date.now()-e<yu?!1:(sessionStorage.setItem(fb,String(Date.now())),!0)}catch{return!1}}});function KW(){try{qa=new BroadcastChannel($o),qa.onmessage=r=>(0,iv.flushSync)(()=>Pn.receive(r.data))}catch{}const e=q6,t=r=>{r.key===$o&&e()};return window.addEventListener("storage",t),window.addEventListener("pageshow",e),window.addEventListener("focus",e),document.addEventListener("visibilitychange",e),e(),()=>{qa?.close(),qa=void 0,window.removeEventListener("storage",t),window.removeEventListener("pageshow",e),window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}}function JW(e){const t=Pn.getGuest();return e&&e!==t?!0:t?(queueMicrotask(()=>{Pn.getGuest()===t&&(0,iv.flushSync)(()=>Pn.revoked(t))}),!0):!1}function q6(){queueMicrotask(()=>{try{(0,iv.flushSync)(()=>Pn.receive(JSON.parse(localStorage.getItem($o)??"null")))}catch{}})}var z6=["timeout","network","upstream_status","bad_json","bad_payload","configuration"];var F6=["guest_session/exhausted","guest_session/unreachable","guest_session/bad_response","guest_session/http_4xx","guest_session/http_5xx","guest_session/timeout","guest_session/network","guest_session/upstream_status","guest_session/bad_json","guest_session/bad_payload","guest_session/configuration","guest_session/network/SELF_SIGNED_CERT_IN_CHAIN","guest_session/network/UNABLE_TO_GET_ISSUER_CERT_LOCALLY","guest_session/network/UNABLE_TO_VERIFY_LEAF_SIGNATURE","guest_session/network/DEPTH_ZERO_SELF_SIGNED_CERT","guest_session/network/CERT_HAS_EXPIRED","guest_session/network/ERR_TLS_CERT_ALTNAME_INVALID","guest_session/network/ECONNREFUSED","guest_session/network/ECONNRESET","guest_session/network/ENOTFOUND","guest_session/network/EAI_AGAIN","guest_session/network/ETIMEDOUT","guest_session/network/EHOSTUNREACH","guest_session/network/ENETUNREACH","guest_session/network/UND_ERR_CONNECT_TIMEOUT","guest_session/network/UND_ERR_SOCKET"];function j6(e){return F6.includes(e)}function YW(e){if(!e)return"guest_session/exhausted";const{httpStatus:t,details:r}=e;if(r){const s=`guest_session/network/${r.networkCode}`;return r.reason==="network"&&j6(s)?s:`guest_session/${r.reason}`}return t===void 0?"guest_session/unreachable":t<400?"guest_session/bad_response":t<500?"guest_session/http_4xx":"guest_session/http_5xx"}var H6=/^[A-Z][A-Z0-9_]{1,63}$/;function B6(e){return typeof e=="string"&&z6.includes(e)}function V6(e){if(!e||typeof e!="object")return;const{reason:t,upstreamStatus:r,networkCode:s}=e;if(!B6(t))return;const n={reason:t};return typeof r=="number"&&Number.isInteger(r)&&r>=100&&r<=599&&(n.upstreamStatus=r),typeof s=="string"&&H6.test(s)&&(n.networkCode=s),n}var ho=class extends Error{status;upstreamFailure;constructor(e,t,r,s){super(e,s===void 0?void 0:{cause:s}),this.name="GuestSessionRequestError",this.status=t,this.upstreamFailure=r}},UA=class extends ho{},ko=class extends ho{retryAfterMs;reason;constructor(e,t){super("Couldn't start a guest session. Sign in to continue."),this.name="GuestSessionRefusedError",this.retryAfterMs=e,this.reason=t}};function G6(e){return e instanceof UA||e instanceof ko&&e.reason==="guest_access_disabled"}var qA="mcpjam_guest_session_v1",Do="mcpjam_guest_activated",qd=3e5,Gt=null,mn=null,gn=null,ti=null,zA=!1,xn=0,Of=new Set,Mf=6e5,fo=null,Sa=null;function FA(){for(const e of Of)e()}function av(e){Sa!==null&&(clearTimeout(Sa),Sa=null),fo=e,e&&(Sa=setTimeout(()=>{Sa=null,fo===e&&av(null)},Math.max(0,e.until-Date.now()))),FA()}function jA(){return fo&&fo.until<=Date.now()&&(fo=null),fo}function zd(e){const t=Gt?.guestId??null,r=Gt?.token??null;Gt=e,(t!==(Gt?.guestId??null)||r!==(e?.token??null))&&FA()}function XW(e){return Of.add(e),()=>{Of.delete(e)}}function ZW(e){if(e)try{localStorage.getItem(Do)!==e&&localStorage.setItem(Do,e)}catch{}}function QW(e){if(!e)return!1;try{return localStorage.getItem(Do)===e}catch{return!1}}function eK(e){try{localStorage.getItem(Do)===e&&localStorage.removeItem(Do)}catch{}}function tK(){try{return localStorage.getItem(Do)}catch{return null}}function W6(){if(typeof window>"u")return;const e=window.__MCP_GUEST_BOOTSTRAP__;try{delete window.__MCP_GUEST_BOOTSTRAP__}catch{window.__MCP_GUEST_BOOTSTRAP__=void 0}e&&(typeof e.token!="string"||e.token.length===0||typeof e.expiresAt!="number"||typeof e.guestId!="string"||e.guestId.length===0||e.expiresAt-qd<=Date.now()||(Gt={guestId:e.guestId,token:e.token,expiresAt:e.expiresAt}))}W6();function cv(){if(zA)return null;try{const e=localStorage.getItem(qA);if(!e)return null;const t=JSON.parse(e);return typeof t.token=="string"&&t.token.length>0?t.token:null}catch{return null}}function gb(){try{localStorage.removeItem(qA)}catch{}zA=!0}var K6=1e3;async function J6(e){if(typeof e.json!="function")return;let t;try{const r=await Promise.race([e.json(),new Promise(s=>{t=setTimeout(()=>s(void 0),K6)})]);return r&&typeof r=="object"?r:void 0}catch{return}finally{t!==void 0&&clearTimeout(t)}}function Y6(e){if(!e)return"";const t=e.networkCode??(e.upstreamStatus!==void 0?String(e.upstreamStatus):void 0);return` (${e.reason}${t?` ${t}`:""})`}function X6(e){const t=e?Number.parseInt(e,10):NaN;return Number.isFinite(t)&&t>0?t*1e3:Mf}async function lv(e,t){const r={mode:e};t&&(r.legacyToken=t);let s;try{s=await fetch("/api/web/guest-session",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}catch(i){throw new ho(i instanceof Error?i.message:"network error",void 0,void 0,i)}if(s.status===204)return t&&gb(),null;if(s.status===429)throw new ko(X6(s.headers?.get?.("retry-after")),"rate_limited");if(s.status===403&&s.headers?.get?.("x-mcpjam-guest-refusal")==="GUEST_ACCESS_DISABLED")throw new ko(Mf,"guest_access_disabled");if(!s.ok){const i=await J6(s);if(s.status===403&&i?.code==="GUEST_ACCESS_DISABLED")throw new ko(Mf,"guest_access_disabled");const o=V6(i?.details);throw new(s.status===403&&s.headers?.get?.("x-mcpjam-guest-refusal")==="GUEST_SESSION_REVOKED"?UA:ho)(`guest-session request failed: ${s.status} ${s.statusText}${Y6(o)}`,s.status,o)}let n;try{n=await s.json()}catch(i){throw new ho(`guest-session response was not valid JSON: ${i instanceof Error?i.message:String(i)}`,s.status)}if(typeof n?.token!="string"||typeof n?.expiresAt!="number")throw new ho("guest-session response missing token or expiresAt",s.status);return t&&gb(),n}async function Z6(){if(Gt&&Gt.expiresAt-qd>Date.now())return Gt;if(jA())return null;if(mn)return mn;const e=cv(),t=xn;let r=Promise.resolve(null);return r=(async()=>{try{const s=await lv("lookup_or_create",e);return s&&t===xn&&zd(s),s}catch(s){if(s instanceof ko)return av({until:Date.now()+s.retryAfterMs,reason:s.reason}),null;throw console.error("Failed to create guest session:",s),s}finally{mn===r&&(mn=null)}})(),mn=r,r.catch(()=>{}),mn}async function Q6(){try{return await Z6()}catch{return null}}async function rK(){return(await Q6())?.token??null}function Lf(){return Gt&&Gt.expiresAt-qd>Date.now()?Gt:null}async function eB(){if(Gt&&Gt.expiresAt-qd>Date.now())return Gt.token;if(gn)return(await gn)?.token??null;const e=cv(),t=xn;let r=Promise.resolve(null);return r=(async()=>{try{const s=await lv("lookup_only",e);return s&&t===xn&&zd(s),s}finally{gn===r&&(gn=null)}})(),gn=r,(await gn)?.token??null}async function sK(){const e=Lf();if(e?.guestId)return e.guestId;if(await eB().catch(r=>{if(G6(r))return null;throw r})===null)return null;const t=Lf()?.guestId;if(!t)throw new Error("guest session cleared during lookup");return t}function tB(){xn+=1,zd(null),mn=null,gn=null,ti=null}async function nK(){const e=Gt?.guestId,t=e?Pn.begin(e):void 0;let r=!1;try{r=(await fetch("/api/web/guest-session/revoke",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok}catch(s){console.error("Failed to revoke guest session:",s)}finally{tB(),t?.(r)}return r}async function iK(){try{const e=await fetch("/api/web/guest-session/promotion-proof",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}});if(e.status===204||!e.ok)return null;const t=await e.json();return typeof t.token=="string"&&t.token.length>0?t.token:null}catch(e){return console.error("Failed to fetch guest promotion proof:",e),null}}async function rB(){if(ti)return(await ti)?.token??null;if(jA())return null;xn+=1;const e=xn;Gt=null,mn=null,gn=null,ti=(async()=>{try{const t=await lv("lookup_or_create",cv());return t&&e===xn&&zd(t),t}catch(t){if(t instanceof ko)return av({until:Date.now()+t.retryAfterMs,reason:t.reason}),null;throw console.error("Failed to refresh guest session:",t),t}})(),ti.catch(()=>{});try{return(await ti)?.token??null}finally{ti=null}}async function oK(){try{return await rB()}catch{return null}}var L="u">typeof window?window:void 0,Wt="u">typeof globalThis?globalThis:L,Tt=Wt?.navigator,W=Wt?.document,st=Wt?.location,mc=Wt?.fetch,uv=Wt?.XMLHttpRequest&&"withCredentials"in new Wt.XMLHttpRequest?Wt.XMLHttpRequest:void 0,vb=Wt?.AbortController,sB=Wt?.CompressionStream,Zt=Tt?.userAgent;function HA(){return!(!L||L.navigator.onLine===!1)}var wa=typeof globalThis<"u"?globalThis:L;wa&&typeof self>"u"&&(wa.self=wa),wa&&typeof File>"u"&&(wa.File=function(){});var ge=L??{},_b="0.9.0",Bs={DEBUG:!1,LIB_VERSION:_b,LIB_NAME:"browser-common",JS_SDK_VERSION:_b},hs=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysInProgress="surveys_in_progress",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),Nf=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),nB=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],iB=["token"];function be(e,t){return e.indexOf(t)!==-1}var Fd=function(e){return e.trim()},$f=function(e){return e.replace(/^\$/,"")};function BA(e){var t;const r=[];return(t=JSON.stringify(e,function(s,n){if(typeof n=="bigint")return n.toString();if(typeof n!="function"&&typeof n!="symbol"){if(n instanceof Error)return{name:n.name,message:n.message,stack:n.stack};if(n&&typeof n=="object"){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(n))return"[Circular]";r.push(n)}return n}}))!==null&&t!==void 0?t:"null"}var VA=Object.prototype,dv=VA.hasOwnProperty,jd=VA.toString,Se=Array.isArray||function(e){return jd.call(e)==="[object Array]"},kt=e=>typeof e=="function",Le=e=>e===Object(e)&&!Se(e),dr=e=>{if(Le(e)){for(const t in e)if(dv.call(e,t))return!1;return!0}return!1},j=e=>e===void 0,Pe=e=>jd.call(e)=="[object String]",Wa=e=>Pe(e)&&e.trim().length===0,nt=e=>e===null,Te=e=>j(e)||nt(e),lt=e=>jd.call(e)=="[object Number]"&&e==e,Us=e=>lt(e)&&e>0,tr=e=>jd.call(e)==="[object Boolean]",oB=e=>be(nB,e),aB=e=>be(iB,e);function GA(e){return e===null||typeof e!="object"}function bu(e,t){return{}.toString.call(e)===`[object ${t}]`}function ta(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return WA(e,Error)}}function pv(e){return"u">typeof Event&&WA(e,Event)}function WA(e,t){try{return e instanceof t}catch{return!1}}var cB=[!0,"true",1,"1","yes"],Up=e=>be(cB,e),lB=[!1,"false",0,"0","no"];function yb(e,t,r,s,n,i,o){try{var a=e[i](o),c=a.value}catch(l){r(l);return}a.done?t(c):Promise.resolve(c).then(s,n)}function Ze(e){return function(){var t=this,r=arguments;return new Promise(function(s,n){var i=e.apply(t,r);function o(c){yb(i,s,n,o,a,"next",c)}function a(c){yb(i,s,n,o,a,"throw",c)}o(void 0)})}}var uB=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],bb=function(e,t=[]){if(!e)return!1;const r=e.toLowerCase();return uB.concat(t).some(s=>{const n=s.toLowerCase();return r.indexOf(n)!==-1})};function _s(e,t,r,s,n){return t>r&&(s.warn("min cannot be greater than max."),t=r),lt(e)?e>r?(s.warn(" cannot be greater than max: "+r+". Using max value instead."),r):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+n),_s(n??r,t,r,s))}var dB=class{constructor(e){this.C={},this.I=e.I,this.R=_s(e.bucketSize,0,100,e.A),this.$=_s(e.refillRate,0,this.R,e.A),this.O=_s(e.refillInterval,0,864e5,e.A)}F(e,t){const r=Math.floor((t-e.lastAccess)/this.O);r>0&&(e.tokens=Math.min(e.tokens+r*this.$,this.R),e.lastAccess=e.lastAccess+r*this.O)}consumeRateLimit(e){var t;const r=Date.now(),s=String(e);let n=this.C[s];return n?this.F(n,r):(n={tokens:this.R,lastAccess:r},this.C[s]=n),n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.I)===null||t===void 0||t.call(this,e)),n.tokens===0)}stop(){this.C={}}},Uo="Mobile",gc="Android",Su="Tablet",KA="Android Tablet",JA="iPad",YA="Apple Watch",Gl="Safari",Hd="BlackBerry",XA="Samsung Internet",Wl="Chrome",ZA="Chrome iOS",QA="Internet Explorer",eI="Internet Explorer Mobile",tI="Opera",rI="Microsoft Edge",Kl="Firefox",sI="Firefox iOS",wu="Nintendo",ku="PlayStation",Bd="Xbox",nI="Android Mobile",iI="Mobile Safari",qp="Windows",oI="Windows Phone",Sb="Nokia",Df="Ouya",pB="Generic "+Uo.toLowerCase(),aI="Generic "+Su.toLowerCase(),Uf="Konqueror",cI="Oculus Browser",lI="Vivaldi",uI="Yandex",dI="Whale",pI="DuckDuckGo",hI="Pale Moon",fI="Waterfox",qf="Brave",mI="Claude",gI="Codex",vI="ChatGPT",_I="Google Search App",zp=new RegExp("Version/(\\d+(\\.\\d+)?)"),Fp=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),hB=new RegExp(Bd,"i"),fB=new RegExp("PlayStation \\w+","i"),mB=new RegExp("Nintendo \\w+","i"),hv=new RegExp("BlackBerry|PlayBook|BB10","i"),gB={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},yI=function(e,t,r,s){return t=t||"",(function(n){return n?.brave?qf:null})(r)||(s?.detectGoogleSearchApp&&be(e,"GSA/")?_I:be(e," OPR/")&&be(e,"Mini")?"Opera Mini":be(e," OPR/")?tI:hv.test(e)?Hd:be(e,"IEMobile")||be(e,"WPDesktop")?eI:be(e,"OculusBrowser")?cI:be(e,"SamsungBrowser")?XA:be(e,"Edge")||be(e,"Edg/")?rI:be(e,"Vivaldi/")?lI:be(e,"YaBrowser/")?uI:be(e,"Whale/")?dI:be(e,"DuckDuckGo/")||be(e,"Ddg/")?pI:be(e,"Claude/")?mI:be(e,"Codex/")?gI:be(e,"ChatGPT/")?vI:be(e,"FBIOS")?"Facebook Mobile":be(e,"UCWEB")||be(e,"UCBrowser")?"UC Browser":be(e,"CriOS")?ZA:be(e,"CrMo")||be(e,Wl)?Wl:be(e,gc)&&be(e,Gl)?nI:be(e,"FxiOS")?sI:be(e.toLowerCase(),Uf.toLowerCase())?Uf:be(e,"Brave/")?qf:((n,i)=>i&&be(i,"Apple")||(function(o){return be(o,Gl)&&!be(o,Wl)&&!be(o,gc)})(n))(e,t)?be(e,Uo)?iI:Gl:be(e,"PaleMoon/")?hI:be(e,"Waterfox/")?fI:be(e,Kl)?Kl:be(e,"MSIE")||be(e,"Trident/")?QA:be(e,"Gecko")?Kl:"")},vB={[eI]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[rI]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Wl]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[ZA]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Gl]:[zp],[iI]:[zp],[tI]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[Kl]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[sI]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Uf]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Hd]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),zp],[nI]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[XA]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[cI]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[lI]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[uI]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[dI]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[qf]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[mI]:[Fp],[gI]:[Fp],[vI]:[Fp],[pI]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[hI]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[fI]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[_I]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[QA]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},_B=function(e,t,r,s){const n=yI(e,t,r,s),i=vB[n];if(j(i))return null;for(let o=0;i.length>o;o++){const a=e.match(i[o]);if(a)return parseFloat(a[a.length-2])}return null},wb=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[Bd,e&&e[1]||""]],[new RegExp(wu,"i"),[wu,""]],[new RegExp(ku,"i"),[ku,""]],[hv,[Hd,""]],[new RegExp(qp,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[oI,""];if(new RegExp(Uo).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){let s=gB[r[1]]||"";return/arm/i.test(t)&&(s="RT"),[qp,s]}return[qp,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=j(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[gc,[e[2],e[3],e[4]||"0"].join(".")]:[gc,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],bI=function(e){for(let t=0;wb.length>t;t++){const[r,s]=wb[t],n=r.exec(e),i=n&&(kt(s)?s(n,e):s);if(i)return i}return["",""]},SI=function(e){return mB.test(e)?wu:fB.test(e)?ku:hB.test(e)?Bd:new RegExp(Df,"i").test(e)?Df:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?oI:/iPad/.test(e)?JA:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?YA:hv.test(e)?Hd:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Sb,"i").test(e)?Sb:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Uo).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?gc:KA:new RegExp("(pda|Mobile)","i").test(e)?pB:new RegExp(Su,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?aI:""},yB=function(e,t){var r;const s=SI(e);return s===JA||s===KA||s==="Kobo"||s==="Kindle Fire"||s===aI?Su:s===wu||s===Bd||s===ku||s===Df?"Console":s===YA?"Wearable":s?Uo:t?.userAgentDataPlatform==="Android"&&((r=t?.maxTouchPoints)!==null&&r!==void 0?r:0)>0?600>Math.min((n=t?.screenWidth)!==null&&n!==void 0?n:0,(i=t?.screenHeight)!==null&&i!==void 0?i:0)/((o=t?.devicePixelRatio)!==null&&o!==void 0?o:1)?Uo:Su:"Desktop";var n,i,o},jp=/\bFBAV\/(\d+(?:\.\d+)*)/i,kb=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",jp],[/\bFBAN\/EMA\b/i,"Facebook Lite",jp],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",jp],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],zf="[Truncated]",Fc="[Unserializable]";function Eo(e){let t="";for(let r=0;e.length>r;r++){const s=e.charCodeAt(r);if(55296>s||s>56319)t+=56320>s||s>57343?e[r]:"�";else{const n=e.charCodeAt(r+1);56320>n||n>57343?t+="�":(t+=e[r]+e[r+1],r++)}}return t}function wI(e,t){if(!t)return e;let r=[];try{r=Object.keys(t)}catch{r=[]}for(const s of r){let n;try{n=t[s]}catch{n=Fc}Object.defineProperty(e,s,{value:n,enumerable:!0,writable:!0,configurable:!0})}return e}var Jl=3e5,kI=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;const t=this.isOpen(),r=Date.now(),s=Math.min(e.retryAfterMs,Jl);if(!t)return this.ts=r,void(this.es=r+s);this.es=Math.max(this.es,Math.min(r+s,this.ts+Jl))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const t=Math.min(Jl,Math.max(0,this.es-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}},bB=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Eb(e,t){return typeof(r=e)=="string"&&bB.test(r)?e:t();var r}function EI(e,t){const r=new Error(t);try{Object.defineProperty(r,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return r}function qn(e){return e&&e.split("#")[0]}function Tb(e){try{return e()}catch{return}}function TI(e,t){const r=setTimeout(e,t);return r!=null&&r.unref&&r?.unref(),r}function Ab(e,t,r){return AI.apply(this,arguments)}function AI(){return(AI=Ze(function*(e,t,r){let s;try{return yield Promise.race([e,new Promise((n,i)=>{s=TI(()=>{try{r?.(),n()}catch(o){i(o)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}var Tl,Ib,Hp;function SB(e){const t=globalThis._posthogChunkIds;if(!t)return;const r=Object.keys(t);return Hp&&r.length===Ib||(Ib=r.length,Hp=r.reduce((s,n)=>{Tl||(Tl={});const i=Tl[n];if(i)s[i[0]]=i[1];else{const o=e(n);for(let a=o.length-1;a>=0;a--){const c=o[a],l=c?.filename,u=t[n];if(l&&u){s[l]=u,Tl[n]=[l,u];break}}}return s},{})),Hp}function Ka(e){return Ka=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ka(e)}function wB(e,t,r){return(t=(function(s){var n=(function(i){if(Ka(i)!="object"||!i)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var a=o.call(i,"string");if(Ka(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)})(s);return Ka(n)=="symbol"?n:n+""})(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,s)}return r}function S(e){for(var t=1;arguments.length>t;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Rb(Object(r),!0).forEach(function(s){wB(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rb(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}var kB=class{constructor(e,t,r=[]){this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t={}){const r=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(r,t,0).apply(e),n=this.buildParsingContext(t),i=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(i,r),$exception_level:"error"}}modifyFrames(e){var t=this;return Ze(function*(){for(const r of e)r.stacktrace&&r.stacktrace.frames&&Se(r.stacktrace.frames)&&(r.stacktrace.frames=yield t.applyModifiers(r.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)===null||t===void 0?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var r;let s,n;if(e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null)try{n=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)}catch{}return S(S({},e),{},{cause:s,stack:n,errors:(r=e.errors)===null||r===void 0?void 0:r.map(i=>this.parseStacktrace(i,t))})}applyChunkIds(e,t){return e.map(r=>(r.filename&&t&&(r.chunk_id=t[r.filename]),r))}applyCoercers(e,t){for(const r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Ze(function*(){let r=e;for(const s of t.modifiers)r=yield s(r);return r})()}convertToExceptionList(e,t){const r=[],s=(n,i,o)=>{var a;const c=r.length,l=i===void 0?S(S({type:typeof t.type=="string"&&t.type.length>0?t.type:"generic"},typeof t.handled=="boolean"?{handled:t.handled}:t.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof t.synthetic=="boolean"?t.synthetic:n.synthetic,exception_id:c}):{type:"chained",source:o,synthetic:n.synthetic,exception_id:c,parent_id:i},u={type:n.type,value:n.value,mechanism:l};n.stack&&(u.stacktrace={type:"raw",frames:n.stack}),r.push(u),n.cause&&s(n.cause,c,"cause");for(const p of(a=n.errors)!==null&&a!==void 0?a:[])s(p,c,"member")};return s(e),r}buildParsingContext(e){var t;return{chunkIdMap:SB(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}getAggregateErrors(e){try{if(ta(e)){let r=Object.getPrototypeOf(e);for(let s=0;r&&100>s;s++){var t;const n=(t=Object.getOwnPropertyDescriptor(r,"constructor"))===null||t===void 0?void 0:t.value;if(typeof n=="function"&&n.name==="AggregateError"){const i=e.errors;return Se(i)?i:void 0}r=Object.getPrototypeOf(r)}}}catch{}}buildCoercingContext(e,t,r=0){let s=0,n=0,i=!1;const o=new Set,a=[],c={},l=(d,h,f=0)=>{const m=u(h,f),v=m.apply;if(m.apply=D=>{a.push(d);try{return v(D)}finally{a.pop()}},f>4||f>0&&a.indexOf(d)!==-1)return this.coerceFallback(m);const _=typeof d=="object"&&d!==null||typeof d=="function";if(f===0&&s>=50||_&&o.has(d))return;_&&o.add(d),f===0&&s++;const b=this.getAggregateErrors(d);let T,O;i||(i=!!b);try{if(T=this.applyCoercers(d,m),!T)throw c}catch(D){if(D===c)return void(f===0&&s--);if(!i)throw D;T=this.coerceFallback(m)}if(!b||s>=50)return T;try{O=b.length}catch{return T}if(!Number.isInteger(O)||0>O||O>4294967295)return T;const x=[];for(let D=0;50>s&&1e3>n&&O>D;D++){let z;n++;try{z=m.next(b[D])}catch{s++,z=this.coerceFallback(u(h+1))}z&&x.push(z)}return S(S({},T),{},{errors:x})},u=(d,h=0)=>S(S({},t),{},{syntheticException:d==0?t.syntheticException:void 0,mechanism:d==0?e:{},apply(f){const m=l(f,d,h+1);if(!m)throw c;return m},next:f=>l(f,d+1)}),p=u(r);return S(S({},p),{},{apply:d=>{var h;return(h=l(d,r))!==null&&h!==void 0?h:this.coerceFallback(p)}})}},EB=/^([a-z][a-z0-9.+-]+):/i,TB=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function AB(e){if(!e||e==="<anonymous>")return!1;const t=EB.exec(e);return!t||TB.includes(t[1].toLowerCase())}function Ff(e,t,r,s,n){const i={platform:e,filename:t,function:r==="<anonymous>"?"?":r,in_app:AB(t)};return j(s)||(i.lineno=s),j(n)||(i.colno=n),i}var II=(e,t)=>{const r=e.indexOf("safari-extension")!==-1,s=e.indexOf("safari-web-extension")!==-1;return r||s?[e.indexOf("@")!==-1?e.split("@")[0]:"?",r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},IB=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,RB=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,CB=/\((\S*)(?::(\d+))(?::(\d+))\)/,PB=(e,t)=>{const r=IB.exec(e);if(r){const[,n,i,o]=r;return Ff(t,n,"?",+i,+o)}const s=RB.exec(e);if(s){if(s[2]&&s[2].indexOf("eval")===0){const o=CB.exec(s[2]);o&&(s[2]=o[1],s[3]=o[2],s[4]=o[3])}const[n,i]=II(s[1]||"?",s[2]);return Ff(t,i,n,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},xB=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,OB=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,MB=(e,t)=>{const r=xB.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){const i=OB.exec(r[3]);i&&(r[1]=r[1]||"eval",r[3]=i[1],r[4]=i[2],r[5]="")}let s=r[3],n=r[1]||"?";return[n,s]=II(n,s),Ff(t,s,n,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},Cb=/\(error: (.*)\)/;function fv(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function LB(e){for(let t=1;10>=t;t++){const r=e.length-2*t;if(0>r)break;let s=!0;for(let n=0;t>n;n++)if(!fv(e[r+n],e[r+t+n])){s=!1;break}if(s){for(let n=0;t>n;n++)e[r+n]=e[r+t+n];return e.length=r+t,{start:r,length:t}}}}function NB(e,t){const r=t.start+t.length,s=CI(e,t);s&&e.splice(r+s===e.length?r:t.start,s)}function RI(e,t){let r=t.start;for(;r>0&&fv(e[r-1],e[r-1+t.length]);)r--;return t.start-r}function CI(e,t){const r=t.start+t.length;let s=r;for(;e.length>s&&fv(e[s],e[s-t.length]);)s++;return s-r}function $B(e,t){const r=t[0];let s=e.length-(r?RI(e,r):0);for(const n of t)s-=CI(e,n);return s}function DB(e,t,r){for(let s=0;e.length>s;s++){const n=e[(t+s)%e.length],i=e[(r+s)%e.length];if(n!==i)return i>n}return!1}var UB=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const r=Pe(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return bu(e,"DOMException")}isDOMError(e){return bu(e,"DOMError")}},qB=class{match(e){return ta(e)}coerce(e,t){var r;const s=this.getStack(e),n=s===void 0?(r=t.syntheticException)===null||r===void 0?void 0:r.stack:void 0,i=!!n;return{type:this.getType(e),value:this.getMessage(e,t),stack:s??n,cause:e.cause?t.next(e.cause):void 0,synthetic:i}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const r=e.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(e){try{const t=e.stacktrace;if(typeof t=="string"&&t.length>0)return t;const r=e.stack;return typeof r=="string"&&r.length>0?r:void 0}catch{return}}},zB=class{match(e){return!!bu(e,"ErrorEvent")&&(e.error!=null||this.ar(e))}coerce(e,t){var r;if(e.error!=null)return t.apply(e.error);const s=t.apply(e.message);return S(S({},s),{},{stack:(r=this.lr(e))!==null&&r!==void 0?r:s.stack,synthetic:!0})}ar(e){return Pe(e.message)&&e.message.length>0}lr(e){var t,r;const s=e,n=(t=s.lineno)!==null&&t!==void 0?t:0,i=(r=s.colno)!==null&&r!==void 0?r:0;if(Pe(s.filename)&&s.filename.length!==0&&n!==0)return`Error
|
|
61
|
+
at ${s.filename}:${n}:${i}`}},FB=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,jB=class{match(e){return typeof e=="string"}coerce(e,t){var r;const[s,n]=this.getInfos(e);return{type:s??"Error",value:n??e,stack:(r=t.syntheticException)===null||r===void 0?void 0:r.stack,synthetic:!0}}getInfos(e){let t="Error",r=e;const s=e.match(FB);return s&&(t=s[1],r=s[2]),[t,r]}},HB=["fatal","error","warning","log","info","debug"];function PI(e,t=40){const r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(let s=r.length;s>0;s--){const n=r.slice(0,s).join(", ");if(t>=n.length)return s===r.length?n:n.length>t?`${n.slice(0,t)}...`:n}return""}var BB=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var r,s;const n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:(r=this.getStack(e))!==null&&r!==void 0?r:(s=t.syntheticException)===null||s===void 0?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(pv(e))return e.constructor.name;const t="name"in e?e.name:void 0;return Pe(t)&&!Wa(t)?t:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let r=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(r+=` with message: '${e.message}'`),r}if("message"in e&&typeof e.message=="string")return e.message;const t=this.getObjectClassName(e);return`${t&&t!=="Object"?`'${t}'`:"Object"} captured as exception with keys: ${PI(e)}`}isSeverityLevel(e){return Pe(e)&&!Wa(e)&&HB.indexOf(e)>=0}getStack(e){try{return Pe(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:Pe(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const r=e[t];if(ta(r))return r}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},VB=class{match(e){return pv(e)}coerce(e,t){var r;const s=e.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${PI(e)}`,stack:(r=t.syntheticException)===null||r===void 0?void 0:r.stack,synthetic:!0}}},GB=class{match(e){return GA(e)}coerce(e,t){var r;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(r=t.syntheticException)===null||r===void 0?void 0:r.stack,synthetic:!0}}},WB=class{match(e){return bu(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!pv(e))return!1;try{const t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var r;const s=this.getUnhandledRejectionReason(e);return GA(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:(r=t.syntheticException)===null||r===void 0?void 0:r.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}},Eu="$message",Tu="$timestamp",KB=new Set([Eu,Tu]),Bp={enabled:!0,max_bytes:32768};function Au(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Bp.enabled,max_bytes:YB(e.max_bytes,Bp.max_bytes)}:S({},Bp)}var JB=class{constructor(e){this.ns=[],this.ss=0,this.Ir=Au(e)}setConfig(e){this.Ir=Au(e),this.rs()}add(e){const t=(function(s){let n;try{n=BA(s)}catch{return}try{const i=JSON.parse(n);if(!Le(i))return;const o=i,a=o[Eu],c=o[Tu];return!Pe(a)||a.trim().length===0||!Pe(c)&&!lt(c)?void 0:{step:o,json:n}}catch{return}})(e);if(!t)return;const r=(function(s){if("u">typeof TextEncoder)return new TextEncoder().encode(s).length;const n=encodeURIComponent(s);let i=0;for(let o=0;n.length>o;o++)n[o]==="%"?(i+=1,o+=2):i+=1;return i})(t.json);r>this.Ir.max_bytes||(this.ns.push({step:t.step,bytes:r}),this.ss+=r,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Ir.max_bytes&&this.ns.length>0;){const e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function YB(e,t){if(!lt(e)||e===1/0||e===-1/0)return t;const r=Math.floor(e);return 0>r?t:r}var Pb=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function xb(e){return typeof e=="string"||e}function Ob(e){return typeof e=="string"?e:void 0}var XB=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],xI="NativeGzipValidationError",jf=e=>e.length>=2&&e[0]===31&&e[1]===139,Mb=(e,t)=>e===Nf.GZipJS||t===Nf.GZipJS||t==="gzip",Lb=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",ka,Al=e=>{throw EI(xI,`Native gzip produced invalid output: ${e}`)},ZB=(Nb=Ze(function*(e,t){18>e.size&&Al("too-short");const r=new Uint8Array(yield e.slice(0,10).arrayBuffer());jf(r)&&r[2]===8||Al("invalid-header");const s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(i=>{const o=(()=>{if(ka)return ka;ka=[];for(let c=0;256>c;c++){let l=c;for(let u=0;8>u;u++)l=1&l?3988292384^l>>>1:l>>>1;ka[c]=l>>>0}return ka})();let a=4294967295;for(let c=0;i.length>c;c++)a=o[255&(a^i[c])]^a>>>8;return(4294967295^a)>>>0})(t)&&Al("invalid-crc");const n=t.length>>>0;s.getUint32(4,!0)!==n&&Al("invalid-size")}),function(e,t){return Nb.apply(this,arguments)}),Nb;function Hf(){return Hf=Ze(function*(e,t=!0,r){try{const n=new TextEncoder().encode(e),i=new globalThis.CompressionStream("gzip"),o=i.writable.getWriter(),a=o.write(n).then(()=>o.close()).catch((s=Ze(function*(u){try{yield o.abort(u)}catch{}throw u}),function(u){return s.apply(this,arguments)})),c=new Response(i.readable).blob(),[l]=yield Promise.all([c,a]);return yield ZB(l,n),l}catch(n){if(r?.rethrow)throw n;return t&&console.error("Failed to gzip compress data",n),null}var s}),Hf.apply(this,arguments)}function OI(e,t){if(e==null)return{};var r,s,n=(function(o,a){if(o==null)return{};var c={};for(var l in o)if({}.hasOwnProperty.call(o,l)){if(a.includes(l))continue;c[l]=o[l]}return c})(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;i.length>s;s++)t.includes(r=i[s])||{}.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var QB={}.propertyIsEnumerable;function Iu(e,t){try{return MI(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function mv(e,t,r,s){if(0>=r.remainingNodes)return{stringValue:zf};if(r.remainingNodes--,tr(e))return{boolValue:e};if(typeof e=="bigint")return(function(n,i){const o=n.toString(),a=BigInt("9223372036854775808");return n>=a||-a>n?(i?.debug(`Attribute ${o} is outside the int64 range; encoding it as a string`),{stringValue:o}):{intValue:o}})(e,t);if(typeof e=="number"){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};const n=BigInt(e).toString();return e>=9223372036854776e3||-9223372036854776e3>e?(t?.debug(`Attribute ${n} is outside the int64 range; encoding it as a string`),{stringValue:n}):{intValue:n}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:Eo(e)};if(typeof e=="function")return{stringValue:"[Function]"};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(r.ancestors.has(e))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:zf};if(e instanceof Date){const n=e.getTime(),i=Number.isFinite(n)?e.toISOString():String(e);return{stringValue:typeof i=="string"?Eo(i):String(i)}}r.ancestors.add(e);try{try{const n=e.toJSON;if(typeof n=="function")return mv(n.call(e),t,r,s+1)}catch{}return Se(e)?{arrayValue:{values:eV(e,t,r,s+1)}}:{kvlistValue:{values:MI(e,t,r,s+1)}}}finally{r.ancestors.delete(e)}}return{stringValue:Eo(String(e))}}function eV(e,t,r,s){const n=[],i=Math.min(e.length,1e3);let o=0;for(;i>o&&r.remainingNodes>0;o++)try{const a=o in e?e[o]:void 0;if(Te(a))continue;n.push(mv(a,t,r,s))}catch{n.push({stringValue:Fc})}return e.length>o&&n.push({stringValue:zf}),n}function MI(e,t,r,s){const n=[];for(const i in e)if(QB.call(e,i)){if(!i){t?.debug("Dropping an attribute with an empty key");continue}if(n.length>=1e3||0>=r.remainingNodes){t?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=e[i];if(nt(o)||j(o))continue;n.push({key:Eo(i),value:mv(o,t,r,s)})}catch{n.push({key:Eo(i),value:{stringValue:Fc}})}}return n}function LI(e,t,r){return S(S(S(S({},wI({},e.resourceAttributes)),{},{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":r})}var tV=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function NI(e,t){const r=wI({},e),s={};for(const n of tV)({}).hasOwnProperty.call(r,n)&&(s[n]=r[n],delete r[n]);return[...Iu(r,t),...Iu(s,t)]}var $b={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"},$I={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},rV=$I.info;function sV(e){try{return Eo(String(e))}catch{return Fc}}function nV(e,t,r,s){const n=e.level||"info",{text:i,number:o}=$I[n]||rV,a=(function(d=Date.now()){return String(d)+"000000"})(lt(s)?s:void 0),c={};t.distinctId&&(c.posthogDistinctId=t.distinctId),t.sessionId&&(c.sessionId=t.sessionId),t.windowId&&(c["window.id"]=t.windowId),Te(t.sessionStartTimestamp)||(c.sessionStartTimestamp=String(t.sessionStartTimestamp)),Te(t.lastActivityTimestamp)||(c.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(c["url.full"]=t.currentUrl),t.screenName&&(c["screen.name"]=t.screenName),t.appState&&(c["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(c.feature_flags=t.activeFeatureFlags);const l=S({},c),u=e.attributes;if(u){let d=[];try{d=Object.keys(u)}catch{d=[]}for(const h of d){let f;try{f=u[h]}catch{f=Fc}Object.defineProperty(l,h,{value:f,enumerable:!0,writable:!0,configurable:!0})}}const p={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:i,body:{stringValue:sV(e.body)},attributes:Iu(l,r)};return e.trace_id&&(p.traceId=e.trace_id),e.span_id&&(p.spanId=e.span_id),j(e.trace_flags)||(p.flags=e.trace_flags),p}function DI(e,t,r){return LI(e,t,r)}function UI(e,t,r,s){return{resourceLogs:[{resource:{attributes:NI(t)},scopeLogs:[{scope:{name:r,version:s},logRecords:e}]}]}}var qI=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.hs}arm(e){this.clear(),this.us=Date.now()+e,this.hs=TI(()=>{this.hs=void 0,this.ls()},e)}armNoEarlierThan(e){this.hs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function zI(){return .75+.5*Math.random()}function FI(e,t,r,s){const n=Math.min(Math.max(0,t-1),6),i=e*Math.pow(2,n);return Math.round((s===void 0?i:Math.min(i,Math.max(s,e)))*r)}var iV=class{constructor(e,t,r,s,n,i=()=>Promise.resolve(),o){var a;this._instance=e,this.Ir=t,this.A=r,this.cs=s,this.ds=n,this.vs=i,this.fs=o,this.ps=new qI(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new kI,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=t.maxBufferSize,this.Is=Math.max((a=t.maxQueueSize)!==null&&a!==void 0?a:t.maxBufferSize,t.maxBufferSize),this.Ms=t.flushIntervalMs,this.Es=t.maxBatchRecordsPerPost,this.Ps=t.rateCapWindowMs,this.Rs=t.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(hs.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Ir.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,t){var r;if(this._instance.isDisabled||this._instance.optedOut||!e?.body)return;const s=this.Os(e);if(s===null)return;if(!s.body)return void this.A.info("Log was rejected in beforeSend function");if(!this.Ds())return;const n={record:nV(s,(r=t?.context)!==null&&r!==void 0?r:this.cs(),this.A,t?.occurredAtMs)};this.ds(()=>this.Ls(n))}Os(e){const t=this.Ir.beforeSend;if(!t)return e;const r=Se(t)?t:[t];let s=e;for(const n of r)try{const i=n(s);if(!i)return this.A.info("Log was rejected in beforeSend function"),null;s=i}catch(i){return this.A.error("Error in beforeSend function for log:",i),null}return s}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.A.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var e=this;return Ze(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return Ze(function*(){var t;e.ps.clear();let r=(t=e._instance.getPersistedProperty(hs.LogsQueue))!==null&&t!==void 0?t:[];if(r.length===0)return;const s=r.length;let n=0;for(;r.length>0&&s>n;){var i,o;const a=e._s;e.bs=0;const c=Math.min(r.length,e.Es),l=r.slice(0,c),u=UI(l.map(d=>d.record),e.qs(),(i=e.fs)!==null&&i!==void 0?i:e._instance.getLibraryId(),e._instance.getLibraryVersion()),p=yield e._instance.js(u);if(e._s!==a)return;if(p.kind==="too-large"&&l.length>1)e.Es=Math.max(1,Math.floor(l.length/2)),e.A.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(p),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),p.kind==="retry-later"||(p.kind==="too-large"?e.A.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):p.kind==="ok"&&e.Ir.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Ir.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(l.length),r=(o=e._instance.getPersistedProperty(hs.LogsQueue))!==null&&o!==void 0?o:[],n+=l.length,p.kind==="fatal"))throw p.error}})()}Bs(e){var t=this;return Ze(function*(){var r;const s=Math.max(0,e-t.bs),n=(r=t._instance.getPersistedProperty(hs.LogsQueue))!==null&&r!==void 0?r:[];t._instance.setPersistedProperty(hs.LogsQueue,n.slice(s)),yield t.vs()})()}qs(){return DI(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;const r=(t=this._instance.getPersistedProperty(hs.LogsQueue))!==null&&t!==void 0?t:[];this.Is>r.length||(r.shift(),this.bs++,this.A.info("Logs queue is full, dropping oldest record.")),r.push(e),this._instance.setPersistedProperty(hs.LogsQueue,r),this.Ts>r.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(FI(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(hs.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return Ze(function*(){t.ps.clear();const r=t.flush().catch(()=>{});e!==void 0?yield Ab(r,e):yield r})()}flushWithTimeout(e){var t=this;return Ze(function*(){const r=t.flush();yield Ab(r,e,()=>{r.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=zI(),this.A.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}},Vp=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Db(e){return String(e)+"000000"}function Ub(e,t,r,s){let n="";return s&&(n=Object.keys(s).sort().map(i=>`${JSON.stringify(i)}:${JSON.stringify(s[i])}`).join(",")),`${e}\0${t}\0${r??""}\0${n}`}var oV=class{constructor(e,t,r){this._instance=e,this.Ir=t,this.A=r,this.zs=new Map,this.ps=new qI(()=>this.flush().catch(s=>{this.A.error("Metrics flush failed:",s)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new kI,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,r){this.Zs({name:e,type:"count",value:t,unit:r?.unit,attributes:r?.attributes})}gauge(e,t,r){this.Zs({name:e,type:"gauge",value:t,unit:r?.unit,attributes:r?.attributes})}histogram(e,t,r){this.Zs({name:e,type:"histogram",value:t,unit:r?.unit,attributes:r?.attributes})}flush(){var e=this;const t=this.ys,r=(function(){var s=Ze(function*(){t&&(yield t.catch(()=>{})),yield e.Qs()});return function(){return s.apply(this,arguments)}})()().finally(()=>{this.ys===r&&(this.ys=null)});return this.ys=r,r}drainWindow(){if(this.zs.size===0)return null;const e=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(e){if(this._instance.isDisabled||this._instance.optedOut)return;const t=this.Os(e);if(t===null)return;if(!t.name||typeof t.name!="string")return void this.A.warn("Dropping metric with empty name");if(typeof t.value!="number"||!Number.isFinite(t.value))return void this.A.warn(`Dropping metric '${t.name}': value must be a finite number`);if(t.type==="count"&&0>t.value)return void this.A.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let r,s;try{r=t.attributes?S({},t.attributes):void 0,s=Ub(t.type,t.name,t.unit,r)}catch(o){this.A.warn(`Dropping metric '${t.name}': attributes could not be serialized`,o);return}let n=this.zs.get(s);if(!n){if(!this.Ks())return;n={name:t.name,type:t.type,unit:t.unit,attributes:r,windowStartMs:Date.now()},this.zs.set(s,n)}const i=this.Ws.get(t.name);i===void 0?this.Ws.set(t.name,t.type):i===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.A.warn(`Metric name '${t.name}' is already used as a ${i}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(n,t.value),this.Fs()}Ks(){return this.Ir.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.A.warn(`Metric series cap reached (${this.Ir.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,t){switch(e.type){case"count":var r;e.total=((r=e.total)!==null&&r!==void 0?r:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Vp.length+1).fill(0)});const s=e.hist;s.count+=1,s.sum+=t,s.min=Math.min(s.min,t),s.max=Math.max(s.max,t),s.bucketCounts[(function(n,i){for(let o=0;i.length>o;o++)if(i[o]>=n)return o;return i.length})(t,Vp)]+=1;break}}}Os(e){const t=this.Ir.beforeSend;if(!t)return e;const r=Se(t)?t:[t];let s=e;for(const n of r)try{const i=n(s);if(!i)return this.A.info("Metric was rejected in beforeSend function"),null;s=i}catch(i){return this.A.error("Error in beforeSend function for metric:",i),null}return s}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(FI(this.Ir.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return Ze(function*(){if(e.ps.clear(),e.zs.size===0)return;const t=e.zs;e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const r=e.Gs,s=yield e._instance.Ys(e.Js(t));if(r===e.Gs)switch(e.ws.record(s),s.kind==="retry-later"?(e.ks++,e.Ss=zI()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),s.kind){case"ok":return;case"retry-later":e.ho(t),e.ps.armNoEarlierThan(e.Hs());return;case"too-large":e.A.warn("Metrics batch exceeded the server size limit and was dropped");return;case"fatal":e.A.error("Failed to send metrics batch:",s.error);return}})()}Js(e){return t=this.co(e),r=(function(i,o,a){return LI(i,o,a)})(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:NI(r)},scopeMetrics:[{scope:{name:s,version:n},metrics:t}]}]};var t,r,s,n}co(e){const t=Db(Date.now()),r=new Map;for(const o of e.values()){var s;const a=Ub(o.type,o.name,o.unit,void 0);let c=r.get(a);c||(c=S({name:o.name},o.unit&&{unit:o.unit}),o.type==="count"?c.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:o.type==="gauge"?c.gauge={dataPoints:[]}:c.histogram={aggregationTemporality:1,dataPoints:[]},r.set(a,c));const l=Iu((s=o.attributes)!==null&&s!==void 0?s:{},this.A),u=Db(o.windowStartMs);if(o.type==="count"){var n;const p={attributes:l,startTimeUnixNano:u,timeUnixNano:t,asDouble:(n=o.total)!==null&&n!==void 0?n:0};c.sum.dataPoints.push(p)}else if(o.type==="gauge"){var i;const p={attributes:l,timeUnixNano:t,asDouble:(i=o.last)!==null&&i!==void 0?i:0};c.gauge.dataPoints.push(p)}else o.hist&&c.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:Vp})}return Array.from(r.values())}ho(e){for(const[s,n]of e){const i=this.zs.get(s);if(i)switch(i.windowStartMs=Math.min(i.windowStartMs,n.windowStartMs),i.type){case"count":var t,r;i.total=((t=i.total)!==null&&t!==void 0?t:0)+((r=n.total)!==null&&r!==void 0?r:0);break;case"gauge":break;case"histogram":if(n.hist)if(i.hist){i.hist.count+=n.hist.count,i.hist.sum+=n.hist.sum,i.hist.min=Math.min(i.hist.min,n.hist.min),i.hist.max=Math.max(i.hist.max,n.hist.max);for(let o=0;i.hist.bucketCounts.length>o;o++)i.hist.bucketCounts[o]+=n.hist.bucketCounts[o]}else i.hist=n.hist}else this.Ks()&&this.zs.set(s,n)}}},jI=(e,{debugEnabled:t}={})=>{const r={N(s,...n){L&&(Bs.DEBUG||L.POSTHOG_DEBUG||t)&&!j(L.console)&&L.console&&("__rrweb_original__"in L.console[s]?L.console[s].__rrweb_original__:L.console[s])(e,...n)},debug(...s){r.N("debug",...s)},info(...s){r.N("log",...s)},warn(...s){r.N("warn",...s)},error(...s){r.N("error",...s)},critical(...s){console.error(e,...s)},uninitializedWarning(s){r.error(`You must initialize PostHog before calling ${s}`)},createLogger:(s,n)=>jI(`${e} ${s}`,n)};return r},X=jI("[PostHog.js]"),ot=X.createLogger,aV=ot("[ExternalScriptsLoader]"),Ru=e=>{const t=W?.querySelectorAll("script");if(t){for(let r=0;t.length>r;r++)if(t[r].src===e||t[r].getAttribute("src")===e)return t[r]}},ri=(e,t,r)=>{if(e.config.disable_external_dependency_loading)return aV.warn(`${t} was requested but loading of external scripts is disabled.`),r("Loading of external scripts is disabled");const s=Ru(t);if(s){if(s.__posthog_loading_callback_fired)return r();const i=s.__posthog_loading_error;return i?r(i):(s.addEventListener("load",o=>{s.__posthog_loading_callback_fired=!0,r(void 0,o)}),void s.addEventListener("error",o=>{s.__posthog_loading_error=o,r(o)}))}const n=()=>{if(!W)return r("document not found");if(Ru(t))return ri(e,t,r);let i=W.createElement("script");if(i.type="text/javascript",i.crossOrigin="anonymous",i.src=t,i.onload=a=>{i.__posthog_loading_callback_fired=!0,r(void 0,a)},i.onerror=a=>{i.__posthog_loading_error=a,r(a)},e.config.prepare_external_dependency_script&&(i=e.config.prepare_external_dependency_script(i)),!i)return r("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")W.head.appendChild(i);else{const a=W.querySelectorAll("body > script");var o;a.length>0?(o=a[0].parentNode)===null||o===void 0||o.insertBefore(i,a[0]):W.body.appendChild(i)}};W?.body?n():W?.addEventListener("DOMContentLoaded",n)},Gp={},qb=(e,t)=>{let r=`/static/${t}.js?v=${e.version}`;return t==="toolbar"&&(r=`${r}&t=${Math.floor(Date.now()/3e5)*3e5}`),e.requestRouter.endpointFor("assets",r)};ge.__PosthogExtensions__=ge.__PosthogExtensions__||{},ge.__PosthogExtensions__.loadExternalDependency=(e,t,r)=>{if(t==="remote-config"){const n=e.requestRouter.endpointFor("assets",`/array/${e.config.token}/config.js`);ri(e,n,r);return}const s=e.config.strict_script_versioning;if(s){const n=e.requestRouter.endpointFor("assets",`/static/${e.version}/${t}.js`),i=Gp[n];if(s==="fallback"&&i){if(Ru(i))return void ri(e,i,r);delete Gp[n]}ri(e,n,s==="fallback"?(o,a)=>{if(o)if(typeof o=="string")r(o);else{var c;const l=qb(e,t);Gp[n]=l;const u=Ru(n);u==null||(c=u.parentNode)===null||c===void 0||c.removeChild(u),ri(e,l,r)}else r(void 0,a)}:r);return}ri(e,qb(e,t),r)},ge.__PosthogExtensions__.loadSiteApp=(e,t,r)=>{const s=e.requestRouter.endpointFor("api",t);ri(e,s,r)},Bs.DEBUG=!1,Bs.LIB_VERSION="1.435.3",Bs.LIB_NAME="web";var gt=Bs,cV="$people_distinct_id",Br="distinct_id",gv="$device_id",Wp="$device_model",Cu="__alias",lV="__cmpns",zb="$fbc",To="$fbc_persistence",Fb="$fbp",Ja="$fbp_persistence",Bf="__timers",HI="$autocapture_disabled_server_side",Vf="$heatmaps_enabled_server_side",Gf="$exception_capture_enabled_server_side",BI="$error_tracking_suppression_rules",Wf="$error_tracking_capture_extension_exceptions",Kf="$web_vitals_enabled_server_side",vv="$dead_clicks_enabled_server_side",_v="$product_tours_enabled_server_side",VI="$logs_capture_enabled_server_side",GI="$web_vitals_allowed_metrics",Ya="$session_recording_remote_config",uV="$session_recording_enabled_server_side",dV="$replay_sample_rate",pV="$replay_override_sampling",hV="$replay_override_linked_flag",fV="$replay_override_url_trigger",mV="$replay_override_event_trigger",mo="$sesid",WI="$session_is_sampled",gV="$session_past_minimum_duration",vV="$session_recording_url_trigger_activated_session",_V="$session_recording_event_trigger_activated_session",yV="$debug_first_full_snapshot_timestamp",bV="$sess_rec_flush_size",Jr="$enabled_feature_flags",js="$active_feature_flags",Jf="$early_access_features",bi="$feature_flag_details",Sn="$feature_flag_payloads",Si="$feature_flag_request_id",Xa="$minimal_flag_called_events",ds="$override_feature_flags",si="$override_feature_flag_payloads",wn="$stored_person_properties",kn="$stored_group_properties",KI="$groups",za="$surveys",Pu="$surveys_loaded_at",JI="$surveys_activated",YI="$surveys_activated_session",XI="$surveys_activated_timestamps",Yf="ph_product_tours",SV="$product_tours_activated",wV="$product_tours_activated_session",kV="$conversations_widget_session_id",EV="$conversations_ticket_id",TV="$conversations_widget_state",AV="$conversations_user_traits",En="$flag_call_reported",Fa="$flag_call_reported_session_id",vc="$feature_flag_errors",On="$feature_flag_evaluated_at",er="$user_state",Xf="$client_session_props",IV="$capture_rate_limit",ZI="$initial_campaign_params",QI="$initial_referrer_info",go="$initial_person_info",yv="$epp",Kp="$posthog_cookieless",eR="$cookieless_mode",tR="$sdk_debug_extensions_init_method",rR="$sdk_debug_extensions_init_time_ms",bv="$sdk_debug_recording_script_not_loaded",Sv="$sdk_debug_replay_stale_config",sR="$sdk_debug_replay_event_trigger_status",nR="$sdk_debug_replay_linked_flag_trigger_status",iR="$sdk_debug_replay_matched_recording_trigger_groups",oR="$sdk_debug_replay_pending_trigger_conditions",aR="$sdk_debug_replay_remote_trigger_matching_config",cR="$sdk_debug_replay_trigger_groups_count",lR="$sdk_debug_replay_url_trigger_status",RV="$session_recording_start_reason",wv="PostHog loadExternalDependency extension not found.",Hs="anonymous",Yl="identified",uR="identified_only",_c="visibilitychange",xu="beforeunload",kv="$pageview",jb="$pageleave",dR="$identify",Hb="$groupidentify";function vo(e,t){Se(e)&&e.forEach(t)}function Be(e,t){if(!Te(e))if(Se(e))e.forEach(t);else if((r=>r instanceof FormData)(e))e.forEach((r,s)=>t(r,s));else for(const r in e)dv.call(e,r)&&t(e[r],r)}var Xe=function(e,...t){for(const r of t)for(const s in r)r[s]!==void 0&&(e[s]=r[s]);return e};function Xl(e){const t=Object.keys(e);let r=t.length;const s=new Array(r);for(;r--;)s[r]=[t[r],e[t[r]]];return s}var CV=function(e){return function(...t){try{return e.apply(this,t)}catch(r){X.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),X.critical(r)}}},Ev=function(e){const t={};return Be(e,function(r,s){(Pe(r)&&r.length>0||lt(r))&&(t[s]=r)}),t};function pR(e){const t=S({},e);for(const r of["name","message","stack","cause","errors"])try{r in e&&(t[r]=e[r])}catch{}return t}var PV=["herokuapp.com","vercel.app","netlify.app"];function xV(e){const t=e?.hostname;if(!Pe(t))return!1;const r=t.split(".").slice(-2).join(".");for(const s of PV)if(r===s)return!1;return!0}function ze(e,t,r,s){const{capture:n=!1,passive:i=!0}=s??{};e?.addEventListener(t,r,{capture:n,passive:i})}function Zf(e){return e.name==="ph_toolbar_internal"}var Za=e=>{if(W){try{const t=e+"=",r=W.cookie.split(";").filter(s=>s.length);for(let s=0;r.length>s;s++){let n=r[s];for(;n.charAt(0)==" ";)n=n.substring(1,n.length);if(n.indexOf(t)===0)return decodeURIComponent(n.substring(t.length,n.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return lt(e)&&isFinite(e)&&Math.floor(e)===e});var OV=class Qf{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,r,s,n){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(s)||!Number.isInteger(n)||0>t||0>r||0>s||0>n||t>0xffffffffffff||r>4095||s>1073741823||n>4294967295)throw new RangeError("invalid field value");const i=new Uint8Array(16);return i[0]=t/Math.pow(2,40),i[1]=t/Math.pow(2,32),i[2]=t/Math.pow(2,24),i[3]=t/Math.pow(2,16),i[4]=t/256,i[5]=t,i[6]=112|r>>>8,i[7]=r,i[8]=128|s>>>24,i[9]=s>>>16,i[10]=s>>>8,i[11]=s,i[12]=n>>>24,i[13]=n>>>16,i[14]=n>>>8,i[15]=n,new Qf(i)}toString(){let t="";for(let r=0;this.bytes.length>r;r++)t=t+(this.bytes[r]>>>4).toString(16)+(15&this.bytes[r]).toString(16),r!==3&&r!==5&&r!==7&&r!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Qf(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let r=0;16>r;r++){const s=this.bytes[r]-t.bytes[r];if(s!==0)return Math.sign(s)}return 0}},MV=class{generate(){const e=this.generateOrAbort();if(!j(e))return e;{this.Ct=0;const t=this.generateOrAbort();if(j(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const e=(()=>{const t=Date.now();return lt(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return OV.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new LV}},hR=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};L&&!j(L.crypto)&&crypto.getRandomValues&&(hR=e=>crypto.getRandomValues(e));var LV=class{nextUint32(){return this.Rt.length>this.At||(hR(this.Rt),this.At=0),this.Rt[this.At++]}constructor(){this.Rt=new Uint32Array(8),this.At=1/0}},Bb,Yr=()=>NV().toString(),NV=()=>(Bb||(Bb=new MV)).generate(),Ea="",$V=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Wi=null,rt={Et(){if(!nt(Wi))return Wi;if(Wi=!1,W)try{const e=`__ph_cookie_support_${Yr()}`;rt.$t(e,"xyz"),Wi=Za(e)==='"xyz"',rt.Lt(e)}catch{Wi=!1}return Wi},Pt(e){X.error("cookieStore error: "+e)},Ot:Za,Dt(e){let t;try{t=JSON.parse(rt.Ot(e))||{}}catch{}return t},$t(e,t,r,s,n){if(!W)return!1;try{let i="",o="";const a=(function(l,u){if(u){let p=(function(d,h=W){if(Ea)return Ea;if(!h||["localhost","127.0.0.1"].includes(d))return"";const f=d.split(".");let m=Math.min(f.length,8);const v="dmn_chk_"+Yr();for(;!Ea&&m--;){const _=f.slice(m).join("."),b=v+"=1;domain=."+_+";path=/";h.cookie=b+";max-age=3",h.cookie.includes(v)&&(h.cookie=b+";max-age=0",Ea=_)}return Ea})(l);if(!p){const d=(h=>{const f=h.match($V);return f?f[0]:""})(l);d!==p&&X.info("Warning: cookie subdomain discovery mismatch",d,p),p=d}return p?"; domain=."+p:""}return""})(W.location.hostname,s);if(r){const l=new Date;l.setTime(l.getTime()+864e5*r),i="; expires="+l.toUTCString()}n&&(o="; secure");const c=e+"="+encodeURIComponent(JSON.stringify(t))+i+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&X.warn("cookieStore warning: large cookie, len="+c.length),W.cookie=c,!0}catch{return!1}},Lt(e,t){if(W?.cookie&&(!t||!nt(Za(e))))try{rt.$t(e,"",-1,t)}catch{return}}},Jp=null,De={Et(){if(!nt(Jp))return Jp;let e=!0;if(j(L))e=!1;else try{const t="__mplssupport__";De.$t(t,"xyz"),De.Ot(t)!=='"xyz"'&&(e=!1),De.Lt(t)}catch{e=!1}return e||X.error("localStorage unsupported; falling back to cookie store"),Jp=e,e},Pt(e){X.error("localStorage error: "+e)},Ot(e){try{return L?.localStorage.getItem(e)}catch(t){De.Pt(t)}return null},Dt(e){try{return JSON.parse(De.Ot(e))||{}}catch{}return null},$t(e,t){try{return L?.localStorage.setItem(e,JSON.stringify(t)),!0}catch(r){De.Pt(r)}return!1},Lt(e){try{L?.localStorage.removeItem(e)}catch(t){De.Pt(t)}}},Yp=[wn,js,Jr,bi,Sn,Si,On,vc,En],ni=[gv,Br,mo,WI,yv,go,To,er],Ou=e=>e+"_cpm",DV=["__proto__","constructor","prototype"],Xp=e=>{if(!Le(e))return{};const t={};return Object.keys(e).forEach(r=>{DV.indexOf(r)===-1&&(t[r]=e[r])}),t},Zp=(e,t=[])=>{const r={};return[...ni,...t].forEach(s=>{const n=e[s];j(n)||nt(n)||n===""||(r[s]=n)}),r},fR=e=>{let t=5381,r=2166136261;for(let s=0;e.length>s;s++){const n=e.charCodeAt(s);t=33*t^n,r=Math.imul(r^n,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(r>>>0).toString(36)},Vb=(e,t)=>({p:t,f:fR(JSON.stringify(e))}),Gb=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const r=rt.Dt(Ou(e)),s=r?.f===fR(t)&&Se(r.p);return{properties:s?r.p:[],isValid:s}}catch{return{properties:[],isValid:!1}}},Qp=(e,t)=>t+"|"+(rt.Ot(Ou(e))||""),Ki={},em={Et:()=>!0,Pt(e){X.error("memoryStorage error: "+e)},Ot:e=>e in Ki?Ki[e]:null,Dt:e=>e in Ki?Ki[e]:null,$t:(e,t)=>(Ki[e]=t,!0),Lt(e){delete Ki[e]}},Kn=null,Je={Et(){if(!nt(Kn))return Kn;if(Kn=!0,j(L))Kn=!1;else try{const e="__support__";Je.$t(e,"xyz"),Je.Ot(e)!=='"xyz"'&&(Kn=!1),Je.Lt(e)}catch{Kn=!1}return Kn},Pt(e){X.error("sessionStorage error: ",e)},Ot(e){try{return L?.sessionStorage.getItem(e)}catch(t){Je.Pt(t)}return null},Dt(e){try{return JSON.parse(Je.Ot(e))||null}catch{}return null},$t(e,t){try{return L?.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(r){Je.Pt(r)}return!1},Lt(e){try{L?.sessionStorage.removeItem(e)}catch(t){Je.Pt(t)}}},UV=class{constructor(e){this._instance=e}get Ir(){return this._instance.config}get consent(){return this.Do()?0:this.Lo}isOptedOut(){return this.Ir.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Ir.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Ir.opt_out_capturing_by_default}optInOut(e){this.No.$t(this.qo,e?1:0,this.Ir.cookie_expiration,this.Ir.cross_subdomain_cookie,this.Ir.secure_cookie)}reset(){this.No.Lt(this.qo,this.Ir.cross_subdomain_cookie)}get qo(){const{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:r}=this._instance.config;return r||(t?t+e:"__ph_opt_in_out_"+e)}get Lo(){const e=this.No.Ot(this.qo);return Up(e)?1:be(lB,e)?0:-1}get No(){const e=this.Ir.opt_out_capturing_persistence_type,t=e==="localStorage"?De:rt,r=t.Et()?t:em;if(!this.jo||this.jo!==r){this.jo=r;const s=e==="localStorage"?rt:De;s.Ot(this.qo)&&(this.jo.Ot(this.qo)||this.optInOut(Up(s.Ot(this.qo))),s.Lt(this.qo,this.Ir.cross_subdomain_cookie))}return this.jo}Do(){return!!this.Ir.respect_dnt&&[Tt?.doNotTrack,Tt?.msDoNotTrack,ge.doNotTrack,Tt?.globalPrivacyControl].some(e=>Up(e))}};function mR(e,t){var r;const s=e==null||(r=e.config)===null||r===void 0?void 0:r.get_current_url;if(!kt(s))return t;try{const n=s(t);return Pe(n)&&n?n:t}catch(n){return X.error("Error in get_current_url, falling back to window.location.href",n),t}}function Wb(e){var t;return e instanceof Element&&(e.id==="__POSTHOG_TOOLBAR__"||!!(!((t=e.closest)===null||t===void 0)&&t.call(e,".toolbar-global-fade-container")))}function As(e){return!!e&&e.nodeType===1}function Ft(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function gR(e){return!!e&&e.nodeType===3}function Tv(e){return!!e&&e.nodeType===11&&As(e.host)}function Av(e){return e?Fd(e).split(/\s+/):[]}function Kb(e,t){const r=(function(s){var n;const i=L==null||(n=L.location)===null||n===void 0?void 0:n.href;return j(i)?void 0:mR(s,i)})(t);return!!(r&&e&&e.some(s=>r.match(s)))}function qo(e){let t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Av(t)}function vR(e){return Te(e)?null:Fd(e).split(/(\s+)/).filter(t=>ec(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function yc(e){let t="";return Ao(e)&&!bc(e)&&e.childNodes&&e.childNodes.length&&Be(e.childNodes,function(r){var s;gR(r)&&r.textContent&&(t+=(s=vR(r.textContent))!==null&&s!==void 0?s:"")}),Fd(t)}function Qa(e){var t;return j(e.target)?e.srcElement||null:!((t=e.target)===null||t===void 0)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var Iv=["a","button","form","input","select","textarea","label"];function tm(e,t){const r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!r&&r.call(e,t)}catch{return!1}}function rm(e,t){if(j(t))return!0;for(const r of e)if(t.some(s=>tm(r,s)))return!0;return!1}function _R(e){const t=e.parentNode;return!(!t||!As(t))&&t}var eh=[".ph-no-autocapture","[data-ph-no-autocapture]"],yR=["next","previous","prev",">","<"],qV=[...yR,"+","-","−","–"],Jb=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Yb=[".ph-no-rageclick",".ph-no-capture"],zV=["","text","search","email","password","url","tel","number"];function bR(e,t){if(!L||Rv(e))return!1;let r,s,n;var i,o;if(tr(t)?(r=!!t&&Yb,s=void 0,n=!1):(r=(i=t?.css_selector_ignorelist)!==null&&i!==void 0?i:Yb,s=t?.content_ignorelist,n=(o=t?.ignore_text_selection)!==null&&o!==void 0&&o),r===!1||n&&(function(c){return!(!c||!As(c))&&(!!Ft(c,"textarea")||(Ft(c,"input")?be(zV,(c.getAttribute("type")||"").toLowerCase()):(function(l){var u;if(l.isContentEditable)return!0;const p=(u=l.getAttribute)===null||u===void 0?void 0:u.call(l,"contenteditable");return p==="true"||p===""})(c)))})(e))return!1;const{targetElementList:a}=SR(e,!1);return!(function(c,l){if(c===!1||j(c))return!1;let u;if(c===!0)u=yR;else{if(!Se(c))return!1;if(c.length>10)return X.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;u=c.map(p=>p.toLowerCase())}return l.some(({safeText:p,ariaLabel:d})=>u.some(h=>Jb(p,h)||Jb(d,h)))})(s,a.map(c=>{var l;return{safeText:yc(c).toLowerCase(),ariaLabel:((l=c.getAttribute("aria-label"))===null||l===void 0?void 0:l.toLowerCase().trim())||""}}))&&!rm(a,r)}var Rv=e=>!e||Ft(e,"html")||!As(e),SR=(e,t)=>{if(!L||Rv(e))return{parentIsUsefulElement:!1,targetElementList:[]};let r=!1;const s=[e];let n=e;for(;n.parentNode&&!Ft(n,"body");){if(Tv(n.parentNode)){s.push(n.parentNode.host),n=n.parentNode.host;continue}const i=_R(n);if(!i)break;if(t||Iv.indexOf(i.tagName.toLowerCase())>-1)r=!0;else try{const o=L.getComputedStyle(i);o&&o.getPropertyValue("cursor")==="pointer"&&(r=!0)}catch{}s.push(i),n=i}return{parentIsUsefulElement:r,targetElementList:s}};function Ao(e){const t=new Set;let r=0;for(let i=e;i.parentNode&&!Ft(i,"body");i=i.parentNode){if(r++>=1e3||t.has(i))return!1;t.add(i);const o=qo(i);if(be(o,"ph-sensitive")||be(o,"ph-no-capture"))return!1}if(be(qo(e),"ph-include"))return!0;const s=e.type||"";if(Pe(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}const n=e.name||e.id||"";return!Pe(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function bc(e){return!!(Ft(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Ft(e,"select")||Ft(e,"textarea")||e.getAttribute("contenteditable")==="true")}var Xb=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),Zb=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,FV=[16,15,14,13],jV=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Qb=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),e0=/[0-9A-Za-z_]/;function HV(e){let t=0,r=!1;for(let s=e.length-1;s>=0;s--){let n=e.charCodeAt(s)-48;r&&(n*=2,n>9&&(n-=9)),t+=n,r=!r}return t%10==0}function ec(e,t=!0){return!(Te(e)||Pe(e)&&(e=Fd(e),(t?Xb.test((e||"").replace(/[- ]/g,"")):(function(r){let s;for(Zb.lastIndex=0;s=Zb.exec(r);){const n=s[2];if(!n)continue;const i=n.replace(/[- ]/g,"");for(let o=0;i.length>o;o++)for(const a of FV){const c=o+a;if(i.length>=c){const l=i.slice(o,c);if(Xb.test(l)&&HV(l))return!0}}}return!1})(e))||(t?jV.test(e):(function(r){let s;for(Qb.lastIndex=0;s=Qb.exec(r);){const n=s[1],i=s[3];if(!(n&&i&&e0.test(n)&&e0.test(i)))return!0}return!1})(e))))}function t0(e){let t=yc(e);return t=`${t} ${wR(e)}`.trim(),ec(t)?t:""}function wR(e){let t="";return e&&e.childNodes&&e.childNodes.length&&Be(e.childNodes,function(r){var s;if(r&&((s=r.tagName)===null||s===void 0?void 0:s.toLowerCase())==="span")try{const n=yc(r);t=`${t} ${n}`.trim(),r.childNodes&&r.childNodes.length&&(t=`${t} ${wR(r)}`.trim())}catch(n){X.error("[AutoCapture]",n)}}),t}function r0(e){return e.replace(/"|\\"/g,'\\"')}function BV(e){const t=e.attr__class;if(t)return Se(t)?t:Av(t)}var Il=ot("[Dead Clicks]"),VV=()=>!0,GV=e=>{var t;const r=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(vv)),s=e.instance.config.capture_dead_clicks;return tr(s)?s:!!Le(s)||r},s0=class{get lazyLoadedDeadClicksAutocapture(){return this.Bo}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[vv]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Ho(()=>{this.zo()}):this.stop()}Ho(e){var t,r,s;!((t=ge.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture?e():(r=ge.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this.instance,"dead-clicks-autocapture",n=>{n?Il.error("failed to load script",n):e()})}zo(){var e;if(W){if(!this.Bo&&(!((e=ge.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const t=Le(this.instance.config.capture_dead_clicks)?S({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Bo=ge.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Bo.start(W),Il.info("starting...")}}else Il.error("`document` not found. Cannot start.")}stop(){this.Bo&&(this.Bo.stop(),this.Bo=void 0,Il.info("stopping..."))}},Ta=ot("[SegmentIntegration]");function n0(e,t,r=!0){const s=e.config.segment;if(!s)return t();const{analytics:n,filterProperties:i}=(a=>kt(a.register))(o=s)?{analytics:o}:o;var o;(function(a,c,l,u){const p=h=>{const f=()=>h.anonymousId()||Yr();a.config.get_device_id=f,u&&h.id()&&(a.register({distinct_id:h.id(),$device_id:f()}),a.persistence.set_property(er,Yl)),l(u?void 0:h.anonymousId()||void 0)},d=c.user();"then"in d&&kt(d.then)?d.then(p):p(d)})(e,n,a=>{n.register(((c,l,{filterProperties:u}={})=>{typeof Promise<"u"&&Promise.resolve||Ta.warn("This browser does not have Promise support, and can not use the segment integration");const p=(d,h)=>{if(!h)return d;const f=!!l&&d.event.anonymousId===l&&!d.event.userId;f||d.event.userId||d.event.anonymousId===c.get_distinct_id()||(Ta.info("No userId set, resetting PostHog"),c.reset()),f||(l=void 0),d.event.userId&&d.event.userId!==c.get_distinct_id()&&(Ta.info("UserId set, identifying with PostHog"),c.identify(d.event.userId));let m=c.calculateEventProperties(h,d.event.properties);if(!Te(u)){const v=d.event.properties||{},_={};for(const T of Object.keys(m))dv.call(v,T)||(_[T]=m[T]);const b=((T,O)=>{const x=Se(T)?T:[T];let D=S({},O);for(const z of x)try{if(D=z(D),Te(D))return null}catch(F){return Ta.error("Error in Segment filterProperties:",F),null}return D})(u,_);if(Te(b))return d;m=b}return d.event.properties=Object.assign({},m,d.event.properties),d};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(d){return p(d,d.event.event)},page(d){return p(d,kv)},identify(d){return p(d,dR)},screen(d){return p(d,"$screen")}}})(e,a,{filterProperties:i})).then(()=>{t()},c=>{Ta.error("Failed to register the Segment integration",c),t()})},r)}var kR="posthog-js";function ER(e,{organization:t,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:i=!0}={}){return o=>{var a,c,l,u,p;if(n!=="*"&&!n.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});const d=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const h=((a=o.exception)===null||a===void 0?void 0:a.values)||[],f=h.map(_=>S(S({},_),{},{stacktrace:_.stacktrace?S(S({},_.stacktrace),{},{type:"raw",frames:(_.stacktrace.frames||[]).map(b=>S(S({},b),{},{platform:"web:javascript"}))}):void 0})),m={$exception_message:((c=h[0])===null||c===void 0?void 0:c.value)||o.message,$exception_type:(l=h[0])===null||l===void 0?void 0:l.type,$exception_level:o.level,$exception_list:f,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((u=h[0])===null||u===void 0?void 0:u.value)||o.message,$sentry_exception_type:(p=h[0])===null||p===void 0?void 0:p.type,$sentry_tags:o.tags};var v;return t&&r&&(m.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+o.event_id),i&&((v=e.exceptions)===null||v===void 0||v.sendExceptionEvent(m)),o}}var WV=class{constructor(e,t,r,s,n,i){this.name=kR,this.setupOnce=function(o){o(ER(e,{organization:t,projectId:r,prefix:s,severityAllowList:n,sendExceptionsToPostHog:i==null||i}))}}},i0=class{constructor(e){this.Uo=(t,r,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength||s.crossTabAdoption)&&(X.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:s}),this.Wo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Vo()}Vo(){var e;this.Go=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Uo)}destroy(){var e;(e=this.Go)===null||e===void 0||e.call(this),this.Go=void 0}doPageView(e,t){var r;const s=this.Zo(e,t);return this.Wo={pathname:(r=L?.location.pathname)!==null&&r!==void 0?r:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.Zo(e,(t=this.Wo)===null||t===void 0?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Wo)===null||e===void 0?void 0:e.pageViewId}}Zo(e,t){const r=this.Wo;if(!r)return{$pageview_id:t};let s={$pageview_id:t,$prev_pageview_id:r.pageViewId};const n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:i,lastScrollY:o,maxScrollY:a,maxContentHeight:c,lastContentY:l,maxContentY:u}=n;if(!(j(i)||j(o)||j(a)||j(c)||j(l)||j(u))){i=Math.ceil(i),o=Math.ceil(o),a=Math.ceil(a),c=Math.ceil(c),l=Math.ceil(l),u=Math.ceil(u);const p=i>1?_s(o/i,0,1,X):1,d=i>1?_s(a/i,0,1,X):1,h=c>1?_s(l/c,0,1,X):1,f=c>1?_s(u/c,0,1,X):1;s=Xe(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return r.pathname&&(s.$prev_pageview_pathname=r.pathname),r.timestamp&&(s.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),s}},Aa=["flags","surveys"],KV={[cV]:{exposure:"hidden"},[Cu]:{exposure:"hidden"},[lV]:{exposure:"hidden"},[Bf]:{exposure:"hidden"},[To]:{exposure:"hidden"},[Ja]:{exposure:"hidden"},[HI]:{exposure:"event"},[Vf]:{exposure:"hidden"},[VI]:{exposure:"hidden"},[Gf]:{exposure:"event"},[BI]:{exposure:"hidden"},[Wf]:{exposure:"event"},[Kf]:{exposure:"event"},[vv]:{exposure:"event"},[_v]:{exposure:"hidden"},[GI]:{exposure:"event"},[Ya]:{exposure:"hidden"},[uV]:{exposure:"hidden"},[mo]:{exposure:"hidden"},[WI]:{exposure:"event"},[dV]:{exposure:"event",shouldSkipFromEventProperties:e=>nt(e)},[gV]:{exposure:"event"},[vV]:{exposure:"event"},[_V]:{exposure:"event"},[yV]:{exposure:"event"},[bV]:{exposure:"hidden"},[Jr]:{exposure:"hidden",storageGroup:"flags"},[js]:{exposure:"hidden",storageGroup:"flags"},[Jf]:{exposure:"hidden"},[bi]:{exposure:"hidden",storageGroup:"flags"},[Sn]:{exposure:"hidden",storageGroup:"flags"},[Si]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Xa]:{exposure:"hidden",storageGroup:"flags"},[ds]:{exposure:"hidden"},[si]:{exposure:"hidden"},[wn]:{exposure:"hidden"},[kn]:{exposure:"hidden"},[za]:{exposure:"hidden",storageGroup:"surveys"},[Pu]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[JI]:{exposure:"event"},[YI]:{exposure:"hidden"},[XI]:{exposure:"hidden"},[Yf]:{exposure:"hidden"},[SV]:{exposure:"hidden"},[wV]:{exposure:"hidden"},[kV]:{exposure:"event"},[EV]:{exposure:"event"},[TV]:{exposure:"event"},[AV]:{exposure:"event"},[En]:{exposure:"hidden"},[Fa]:{exposure:"hidden"},[KI]:{exposure:"event"},[vc]:{exposure:"hidden"},[On]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[er]:{exposure:"hidden"},[Xf]:{exposure:"hidden"},[IV]:{exposure:"hidden"},[ZI]:{exposure:"hidden"},[QI]:{exposure:"hidden"},[go]:{exposure:"hidden"},[yv]:{exposure:"hidden"},[pV]:{exposure:"event"},[hV]:{exposure:"event"},[fV]:{exposure:"event"},[mV]:{exposure:"event"},[tR]:{exposure:"event"},[rR]:{exposure:"event"},[bv]:{exposure:"hidden"},[Sv]:{exposure:"hidden"},[sR]:{exposure:"hidden"},[nR]:{exposure:"hidden"},[iR]:{exposure:"hidden"},[oR]:{exposure:"hidden"},[aR]:{exposure:"hidden"},[cR]:{exposure:"hidden"},[lR]:{exposure:"hidden"},[RV]:{exposure:"event"}},JV=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Lt=e=>{const t=KV[e];if(t)return t;for(const[r,s]of JV)if(e.indexOf(r)===0)return s},_o=(e,t)=>{try{let r;return JSON.stringify(e,(s,n)=>{var i;return ta(n)?((i=r)!==null&&i!==void 0||(r=new WeakMap),r.has(n)||r.set(n,pR(n)),r.get(n)):typeof n=="bigint"?n.toString():n},t)}catch{return BA(e)}},Zs=e=>{const t=W?.createElement("a");return j(t)?null:(t.href=e,t)},zo=function(e,t){const r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let s;for(let n=0;r.length>n;n++){const i=r[n].split("=");if(i[0]===t){s=i;break}}if(!Se(s)||2>s.length)return"";{let n=s[1];try{n=decodeURIComponent(n)}catch{X.error("Skipping decoding for malformed query param: "+n)}return n.replace(/\+/g," ")}},Sc=function(e,t,r){if(!e||!t||!t.length)return e;const s=e.split("#"),n=s[1],i=(s[0]||"").split("?"),o=i[1],a=i[0],c=(o||"").split("&"),l=[];for(let p=0;c.length>p;p++){const d=c[p].split("=");Se(d)&&(t.includes(d[0])?l.push(d[0]+"="+r):l.push(c[p]))}let u=a;return o!=null&&(u+="?"+l.join("&")),n!=null&&(u+="#"+n),u},Mu=function(e,t){const r=e.match(new RegExp(t+"=([^&]*)"));return r?r[1]:null},TR=(e,t)=>e>=t&&HA(),AR=(e,t,r,s)=>{if(e===0){if(HA()){const n=t+1;return n===r&&s(),n}return t}return 0},Fo=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],YV=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Fo],wc="<masked>",XV=["li_fat_id"];function IR(e,t,r){if(!W)return{};const s=t?[...Fo,...r||[]]:[],n=RR(Sc(W.URL,s,wc),e),i=(function(){const o={};return Be(XV,function(a){const c=Za(a);o[a]=c||null}),o})();return Xe(i,n)}function RR(e,t){const r=YV.concat(t||[]),s={};return Be(r,function(n){const i=zo(e,n);s[n]=i||null}),s}function CR(e){const t=(function(n){return n?n.search("https?://(.*)google.([^/?]*)")===0?"google":n.search("https?://(.*)bing.com")===0?"bing":n.search("https?://(.*)yahoo.com")===0?"yahoo":n.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(e),r=t!="yahoo"?"q":"p",s={};if(!nt(t)){s.$search_engine=t;const n=W?zo(W.referrer,r):"";n.length&&(s.ph_keyword=n)}return s}function PR(){return navigator.language||navigator.userLanguage}function ZV(){const e=PR();return typeof e=="string"?e.split("-")[0]:void 0}var Lu="$direct";function xR(){return W?.referrer||Lu}function OR(e,t,r=!1){const s=e?[...Fo,...t||[]]:[],n=r?qn(st?.href):st?.href,i=n?.substring(0,1e3);return{r:xR().substring(0,1e3),u:i?Sc(i,s,wc):void 0}}function MR(e,t=!1){var r;const{r:s,u:n}=e,i=t?qn(n):n,o={$referrer:s,$referring_domain:s==null?void 0:s==Lu?Lu:(r=Zs(s))===null||r===void 0?void 0:r.host};if(i){o.$current_url=i;const a=Zs(i);o.$host=a?.host,o.$pathname=a?.pathname;const c=RR(i);Xe(o,c)}if(s){const a=CR(s);Xe(o,a)}return o}function LR(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function QV(){try{return new Date().getTimezoneOffset()}catch{return}}var e3={flags:On,surveys:Pu},t3=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Rl=e=>`${e}_cookie_identity_change_pending`,Cl=e=>{let t="",r=0;for(const s of e){const n=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(r+n>1e3)break;t+=s,r+=n}return t},ft="main",qs=[Jr,js,bi,Sn,Si,On,Xa,wn],th=e=>qs.indexOf(e)!==-1,NR=[To,Ja],o0=e=>NR.indexOf(e)!==-1,on=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},Ji=e=>{if(!e)return{};const t=JSON.parse(e);return Le(t)?t:{}},a0=(e,t)=>{Be(e,(r,s)=>{const n=Lt(s);n&&n.exposure!=="event"||{}.hasOwnProperty.call(t,s)||delete e[s]})},rh=class{constructor(e,t,r=!0){if(this.Qo={},this.Jo=!1,this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=new Map,this.ia=!1,this.na=!1,this.sa=!1,this.ra=new Set,this.oa=new Set,this.Ir=e,this.aa=r,this.props={},this.la=void 0,this.ua=(s=>{let n="";return s.token&&(n=s.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),s.persistence_name?"ph_"+s.persistence_name:"ph_"+n+"_posthog"})(e),this.hi=e.disable_persistence||!!t,this.No=this.ha(e),this.Xo=this.ca(e),this.load(),this.da(),e.debug&&X.info("Persistence loaded",e.persistence,S({},this.props)),this.update_config(e,e,t),this.save(),L){const s=()=>this.flush();ze(L,"beforeunload",s,{capture:!1}),ze(L,"pagehide",s,{capture:!1}),this.va=n=>{if(this.Jo&&(!n.storageArea||n.storageArea===L?.localStorage)&&n.key)if(n.key!==this.ua){if(this.Xo){const i=Aa.find(o=>n.key===this.fa(o));i&&this.pa(n.key,i)}}else this.pa(n.key,ft)},ze(L,"storage",this.va)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,r])=>{const s=this.ea.get(t);if(!th(t)||s===!0)return;if(r===!0)return void this.ga(t,!0);const n=new Set(s||[]);r.forEach(i=>n.add(i)),n.size&&this.ga(t,n)})}onCrossTabFeatureFlagChange(e){return this.oa.add(e),()=>this.oa.delete(e)}destroy(){this.va&&L&&(L.removeEventListener("storage",this.va),this.va=void 0),this.oa.clear()}pa(e,t,r=!0){if(this.hi)return!1;let s,n;try{if(n=De.Ot(e),nt(n)){const a=this.ma(t);return a.storageValue=null,t!==ft&&(a.persisted=!1),!1}s=Ji(n)}catch{return!1}const i=t===ft?s:De.Dt(this.ua);if(i&&this.ya(i))return!1;const o=this.ba(s,t,r);return t===ft&&this.Xo&&!on(this._a().main,s)||this.wa(s,t,!0,n),o}ya(e){const t=this.props[Br],r=e[Br];return!j(t)&&!j(r)&&t!==r}wa(e,t,r,s){const n=this.ma(t);n.storageValue=s,t!==ft&&(n.persisted=r);try{n.fingerprint=this.ka(e,t)}catch{n.fingerprint=void 0}}ba(e,t,r){let s=!1;return qs.forEach(n=>{var i;const o=(i=Lt(n))===null||i===void 0?void 0:i.storageGroup;if(t===ft&&this.Xo&&o||t!==ft&&o!==t)return;const a=n in e,c=this.Sa(n,a?e[n]:void 0),l=this.ea.has(n)?n in this.props:a;l===n in this.props&&on(c,this.props[n])||(l?this.xa(n,c,!1):this.Ca(n,!1),s=!0)}),s&&r&&this.oa.forEach(n=>n()),s}$a(){if(!this.Jo)return!1;try{this.sa=!1;const e=De.Ot(this.ua),t=this.ma(ft);let r,s=!1,n=!1;if(e!==t.storageValue)if(nt(e))t.storageValue=null;else{if(r=Ji(e),this.sa=!this.na&&this.ya(r),this.sa)return!1;n=this.ba(r,ft,!1),!this.Xo||on(this._a().main,r)?this.wa(r,ft,!0,e):t.storageValue=e,s=!0}return this.Xo&&Aa.forEach(i=>{const o=De.Ot(this.fa(i)),a=this.ma(i),c=r||{},l=s&&qs.some(p=>{var d;return((d=Lt(p))===null||d===void 0?void 0:d.storageGroup)===i&&p in c});if(o===a.storageValue&&!l)return;if(nt(o))return a.storageValue=null,a.persisted=!1,void(l&&(n=this.ba(c,i,!1)||n));const u=Ji(o);n=this.ba(u,i,!1)||n,this.wa(u,i,!0,o)}),n}catch{return!1}}ga(e,t){this.ea.set(e,t);const r=Lt(e);r!=null&&r.volatile||(this.ma((this.Xo?r?.storageGroup:void 0)||ft).fingerprint=void 0,this.Ta(e))}Ia(){qs.forEach(e=>this.ea.set(e,!0))}da(){if(this.Jo)try{const e=De.Ot(this.ua),t=Ji(e);this.ma(ft).storageValue=e,qs.forEach(r=>{var s;const n=this.Xo?(s=Lt(r))===null||s===void 0?void 0:s.storageGroup:void 0,i=n?De.Ot(this.fa(n)):null;if(n){const a=this.ma(n);a.storageValue=i,a.persisted=!nt(i)}const o=n&&!nt(i)?Ji(i):t;r in this.props?this.Ma(r,o[r],this.props[r]):r in o&&this.ga(r,!0)})}catch{}}Sa(e,t){const r=this.ea.get(e);if(!r)return t;if(r===!0)return this.props[e];if(e==="$active_feature_flags"){const i=new Set(Se(t)?t:[]),o=new Set(Se(this.props[e])?this.props[e]:[]);return r.forEach(a=>o.has(a)?i.add(a):i.delete(a)),Array.from(i)}const s=Le(t)?S({},t):{},n=Le(this.props[e])?this.props[e]:{};return r.forEach(i=>{i in n?s[i]=n[i]:delete s[i]}),s}Ma(e,t,r){if(!th(e))return;const s=this.ea.get(e);if(s===!0)return;let n=t;if(this.Jo)try{var i;const a=this.Xo?(i=Lt(e))===null||i===void 0?void 0:i.storageGroup:void 0,c=a?this.fa(a):this.ua;n=Ji(De.Ot(c))[e]}catch{}const o=new Set(s||[]);if(e==="$active_feature_flags"){if(!j(t)&&!Se(t)||!j(n)&&!Se(n)||!Se(r))return void this.ga(e,!0);const a=new Set(t||[]),c=new Set(n||[]),l=new Set(r);new Set([...a,...l]).forEach(u=>{a.has(u)!==l.has(u)&&o.add(u)}),o.forEach(u=>{c.has(u)===l.has(u)&&o.delete(u)})}else{if(!Le(r))return void(on(n,r)?this.ea.delete(e):this.ga(e,!0));{if(!j(t)&&!Le(t)||j(t)&&dr(r)&&j(n))return void this.ga(e,!0);const a=Le(t)?t:{},c=Le(n)?n:{};new Set([...Object.keys(a),...Object.keys(r)]).forEach(l=>{l in a==l in r&&on(a[l],r[l])||o.add(l)}),o.forEach(l=>{l in c==l in r&&on(c[l],r[l])&&o.delete(l)})}}o.size?this.ga(e,o):this.ea.delete(e)}Ea(){var e;const t=(e=this.Ir)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return lt(t)&&t>0?t:0}Pa(e){if(this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const t=Zp(e,this.Ir.cookie_persisted_properties||[]),r=Vb(t,this.Ir.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(r),n=rt.Ot(this.ua)||void 0;n&&Qp(this.ua,n)===s&&(this.Ra=s,this.Aa=n)}catch{}else try{const t=rt.Ot(this.ua)||void 0;this.Ra=t?Qp(this.ua,t):void 0,this.Aa=t}catch{}}syncCookieProperties(){return this.Fa(this.Ir)}Fa(e,t=!1){if(this.hi&&!t||this.ta||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let r;try{r=rt.Ot(this.ua)||void 0}catch{}if(!r||r===this.Aa)return!1;const s=Qp(this.ua,r);let n;try{n=Xp(JSON.parse(r))}catch{return!1}if((rt.Ot(this.ua)||void 0)!==r)return!1;this.Ra=s,this.Aa=r;const i=Gb(this.ua,r),o=[...ni,...i.properties],a={};if(Object.keys(n).forEach(m=>{const v=n[m];(j(v)||nt(v)||v===""||m==="$user_state"&&v!=="anonymous"&&v!=="identified")&&(a[m]=!0,delete n[m])}),dr(n))return!1;const c="distinct_id"in n||n.$user_state==="anonymous"||n.$user_state==="identified",l=this.props,u=l[Br],p=l[er],d=Xe({},l);[...ni,...e.cookie_persisted_properties||[]].forEach(m=>{if(o.indexOf(m)!==-1&&!(m in n)&&!a[m]&&(c||m!=="distinct_id"&&m!=="$user_state")){const v=d[m];(i.isValid||ni.indexOf(m)===-1||v!==!1&&v!==0)&&delete d[m]}}),this.props=Xe(d,n),qs.forEach(m=>{const v=m in this.props;m in l===v&&on(l[m],this.props[m])||(v?this.Ma(m,l[m],this.props[m]):this.ga(m,!0))}),!c||"$user_state"in n||"$user_state"in this.props||this.xa(er,Hs);const h=this.props[Br],f=this.props[er];return!c||h===u&&f===p||(this.na=!0,this.Yo=!0,Je.$t(Rl(this.ua),!0),this.Ca(wn),this.Ca(js),this.Ca(Jr),this.Ca(bi),this.Ca(Sn),this.Ca(Si),this.Ca(On),this.Ca(vc),this.Ca(En),f!=="anonymous"||p!=="identified"&&n.$user_state!=="anonymous"&&(j(u)||h===u)||(a0(this.props,n),this.Ca(kn)),f==="identified"?this.props.$user_id=h:delete this.props.$user_id,this.Ca(Cu)),!0}consumeCookieIdentityChange(){const e=Rl(this.ua),t=this.Yo||!!Je.Ot(e);return this.Yo=!1,t&&Je.Lt(e),t}Oa(e=!1){return!(this.ta||this.hi&&!e||!this.Ir.cookieWinsOnConflict||this.Ir.persistence.toLowerCase()!=="localstorage+cookie"||(this.ta=!0,0))}Da(){this.ta&&(j(this.La)||(clearTimeout(this.La),this.La=void 0),delete this.Qo[ft],this.Na(!0))}qa(e=!0){if(this.ta)try{e?this.Da():j(this.La)||(clearTimeout(this.La),this.La=void 0)}finally{this.ta=!1}}isDisabled(){return!!this.hi}ha(e){t3.indexOf(e.persistence.toLowerCase())===-1&&(X.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const t=((o=[],a=!1)=>{const c=[...ni,...o];return S(S({},De),{},{Dt(l){try{let p,d={};try{p=rt.Ot(l)||void 0,d=p?Xp(JSON.parse(p)):{}}catch{}const h=JSON.parse(De.Ot(l)||"{}");let f;if(a){const m=Gb(l,p),v=[...ni,...m.properties],_={};Object.keys(d).forEach(T=>{const O=d[T];nt(O)||O===""||T==="$user_state"&&O!=="anonymous"&&O!=="identified"||(_[T]=O)});const b="distinct_id"in _||_.$user_state==="anonymous"||_.$user_state==="identified";if(Object.keys(_).length>0){var u;const T=h[Br],O=(u=h.$user_state)!==null&&u!==void 0?u:Hs;c.forEach(x=>{if(v.indexOf(x)!==-1&&!(x in d)&&(b||x!=="distinct_id"&&x!=="$user_state")){const D=h[x];(m.isValid||ni.indexOf(x)===-1||D!==!1&&D!==0)&&delete h[x]}}),!b||"$user_state"in d||"$user_state"in h||(h[er]=Hs),!b||("distinct_id"in _?_[Br]:h[Br])===T&&("$user_state"in _?_[er]:h[er])===O||(Yp.forEach(x=>delete h[x]),_.$user_state==="identified"&&"distinct_id"in _?h.$user_id=_[Br]:delete h.$user_id,_.$user_state!=="identified"&&(delete h[KI],delete h[kn]),delete h.__alias)}f=Xe(h,_)}else f=Xe(d,h);return De.$t(l,f),f}catch{}return null},$t(l,u,p,d,h,f){const m=De.$t(l,u,void 0,void 0,f);try{const v=Zp(u,o);if(Object.keys(v).length){if(a){const _=Ou(l),b=Vb(v,o);if(rt.$t(_,b,p,d,h,f),rt.Ot(_)!==JSON.stringify(b)){rt.Lt(_,d);const T=Zp(u);return rt.$t(l,T,p,d,h,f),m}}rt.$t(l,v,p,d,h,f)}}catch(v){De.Pt(v)}return m},Lt(l,u){try{L?.localStorage.removeItem(l),rt.Lt(l,u),rt.Lt(Ou(l),u)}catch(p){De.Pt(p)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let r,s=!1,n=!1;const i=e.persistence.toLowerCase();return i==="localstorage"&&De.Et()?(r=De,n=!0):i==="localstorage+cookie"&&t.Et()?(r=t,n=!0,s=!0):i==="sessionstorage"&&Je.Et()?r=Je:i==="memory"?r=em:i==="cookie"&&rt.Et()?(r=rt,s=!0):t.Et()?(r=t,n=!0,s=!0):rt.Et()?(r=rt,s=!0):r=em,this.Jo=n,this.Ko=s,r}fa(e){return`${this.ua}__${e}`}ca(e){return this.Jo&&!!e.split_storage}properties(){const e={};return Be(this.props,(t,r)=>{const s=Lt(r);if(!s||s.exposure==="event"){var n;if(!(s==null||(n=s.shouldSkipFromEventProperties)===null||n===void 0)&&n.call(s,t))return;e[r]=t}}),e}load(e=!1){if(this.hi&&!e)return;const t=this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie",r=t?De.Dt(this.ua):null;let s={};if(t)try{s=Xp(rt.Dt(this.ua)),Be(s,(a,c)=>{(j(a)||nt(a)||a==="")&&delete s[c]})}catch{}const n=this.No.Dt(this.ua);if(n&&(this.props=Xe({},n)),this.Xo&&this.ja(),t&&n){var i,o;const a=r?.[Br],c=(i=r?.$user_state)!==null&&i!==void 0?i:Hs,l=n[Br],u=(o=n.$user_state)!==null&&o!==void 0?o:Hs;if(l!==a||u!==c){this.Yo=!0,Je.$t(Rl(this.ua),!0);const p=Xe({},this.props);Yp.forEach(h=>delete p[h]),u!=="anonymous"||c!=="identified"&&s.$user_state!=="anonymous"&&(j(a)||l===a)||(a0(p,s),delete p[kn]),this.props=p;const d=new Set;Yp.forEach(h=>{var f;const m=(f=Lt(h))===null||f===void 0?void 0:f.storageGroup;m&&d.add(m)}),d.forEach(h=>{const f={};Be(this.props,(m,v)=>{var _;((_=Lt(v))===null||_===void 0?void 0:_.storageGroup)===h&&(f[v]=m)}),dr(f)?(De.Lt(this.fa(h)),this.Qo[h]={}):De.$t(this.fa(h),f)&&(this.Qo[h]={persisted:!0,fingerprint:this.ka(f,h)})})}}Je.Ot(Rl(this.ua))&&(this.Yo=!0)}ja(){for(const e of Aa){const t=De.Dt(this.fa(e));if(t&&!dr(t)){const r=this.ma(e);r.persisted=!0,this.Ba(e)||(r.fingerprint=this.ka(t,e)),this.Ha(e,t)||Xe(this.props,t)}}}Ba(e){return Object.keys(this.props).some(t=>{var r;return((r=Lt(t))===null||r===void 0?void 0:r.storageGroup)===e})}Ha(e,t){const r=e3[e];if(!r)return!1;const s=t[r],n=this.props[r];return lt(s)&<(n)&&n>s}refreshKey(e){var t;if(this.hi||this.ra.has(e))return;const r=this.Xo?(t=Lt(e))===null||t===void 0?void 0:t.storageGroup:void 0,s=r?De.Dt(this.fa(r)):this.No.Dt(this.ua);if(s&&e in s)this.xa(e,s[e],!1);else{if(r){const n=this.No.Dt(this.ua);if(n&&e in n)return void this.xa(e,n[e],!1)}this.Ca(e,!1)}}save(){if(this.hi)return;const e=this.Ea();e>0?j(this.La)&&(this.La=setTimeout(()=>{this.La=void 0,this.Na()},e)):this.Na()}flush(){j(this.La)||(clearTimeout(this.La),this.La=void 0,this.Na())}Na(e=!1){if(this.hi||this.ta&&!e)return;e||(this.syncCookieProperties(),this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie"||NR.forEach(n=>this.refreshKey(n)));const t=!e&&!this.ia;t||(this.sa=!1);const r=!!t&&this.$a();if(this.sa)return void(this.Ir.debug&&X.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Xo)return this.za(),void(r&&this.oa.forEach(n=>n()));const s=this.Ua(this.No,this.ua,this.props,ft);s==="written"&&this.Pa(this.props),s!=="failed"&&(this.ea.clear(),this.na=!1,this.ra.clear()),r&&this.oa.forEach(n=>n())}za(){const{main:e,groups:t}=this._a(),r=this.Ua(this.No,this.ua,e,ft);r==="written"&&this.Pa(e),r!=="failed"&&(this.na=!1,this.ra.clear(),qs.forEach(n=>{var i;(i=Lt(n))!==null&&i!==void 0&&i.storageGroup||this.ea.delete(n)}));for(const n of Aa){var s;const i=t[n];if(dr(i)&&!(!((s=this.Qo[n])===null||s===void 0)&&s.persisted)){qs.forEach(a=>{var c;((c=Lt(a))===null||c===void 0?void 0:c.storageGroup)===n&&this.ea.delete(a)});continue}const o=this.Ua(De,this.fa(n),i,n);o!=="failed"&&qs.forEach(a=>{const c=Lt(a);c?.storageGroup!==n||o!=="written"&&c.volatile||this.ea.delete(a)})}}_a(){const e={},t={flags:{},surveys:{}};return Be(this.props,(r,s)=>{var n;const i=(n=Lt(s))===null||n===void 0?void 0:n.storageGroup;i?t[i][s]=r:e[s]=r}),{main:e,groups:t}}ka(e,t){if(t===ft)return JSON.stringify(e)+"|"+this.Wa+"|"+this.Va+"|"+this.Ga;const r={};return Be(e,(s,n)=>{var i;r[n]=!((i=Lt(n))===null||i===void 0)&&i.volatile?"__volatile__":s}),JSON.stringify(r)}Ua(e,t,r,s){const n=this.ma(s);if(s!==ft&&!n.dirty&&!j(n.fingerprint))return"skipped";let i;try{if(i=this.ka(r,s),i===n.fingerprint)return n.dirty=!1,"skipped"}catch{i=void 0}return e.$t(t,r,this.Wa,this.Va,this.Ga,this.Ir.debug)?(n.dirty=!1,s!==ft&&(n.persisted=!0),j(i)||(n.fingerprint=i),this.Jo&&(n.storageValue=De.Ot(t)),"written"):(this.Ir.debug&&X.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ia(),j(this.La)||(clearTimeout(this.La),this.La=void 0),this.No.Lt(this.ua,!1),this.No.Lt(this.ua,!0),!e&&this.aa)for(const t of Aa)De.Lt(this.fa(t));e?delete this.Qo[ft]:this.Qo={},this.Ra=void 0,this.Aa=void 0}clear(){this.remove(),this.props={}}register_once(e,t,r){if(Le(e)){this.syncCookieProperties(),j(t)&&(t="None"),this.Wa=j(r)?this.Za:r;let s=!1;if(Be(e,(n,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.xa(i,n),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(Le(e)){this.syncCookieProperties(),this.Wa=j(t)?this.Za:t;let r=!1;if(Be(e,(s,n)=>{e.hasOwnProperty(n)&&(this.props[n]!==s||Le(s)||Se(s))&&(this.xa(n,s),r=!0)}),r)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t=typeof e=="string"?[e]:e;let r=!1;for(const s of t)s in this.props&&(this.Ca(s),r=!0);r&&this.save()}update_campaign_params(){const e=W?.URL;if(e===this.la)return;const t=IR(this.Ir.custom_campaign_params,this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties),r=!dr(Ev(t));return r&&this.register(t),this.la=e,r?t:void 0}update_search_keyword(){this.register((function(){const e=W?.referrer;return e?CR(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:xR(),$referring_domain:W?.referrer&&((e=Zs(W.referrer))===null||e===void 0?void 0:e.host)||Lu},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=OR(this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties,this.Ir.disable_capture_url_hashes);this.register_once({[go]:this.Ko?{r:Cl(e.r),u:e.u?Cl(e.u):void 0}:e},void 0)}get_initial_props(){const e={};Be([QI,ZI],r=>{const s=this.props[r];s&&Be(s,function(n,i){e["$initial_"+$f(i)]=n})});const t=this.props[go];if(t){const r=(function(s,n=!1){const i=MR(s,n),o={};return Be(i,function(a,c){o[`$initial_${$f(c)}`]=a}),o})(t,this.Ir.disable_capture_url_hashes);Xe(e,r)}return e}safe_merge(e){return Be(this.props,function(t,r){r in e||(e[r]=t)}),e}update_config(e,t,r){const s=e.persistence!==t.persistence,n=!((h,f)=>{if(h.length!==f.length)return!1;const m=[...h].sort(),v=[...f].sort();return m.every((_,b)=>_===v[b])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),i=s||n,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!r,c=!!this.hi&&!a;a||this.Fa(t,c),this.Ir=e,!a&&(s||n||o)&&(this.Ra=void 0,this.Aa=void 0,this.Fa(S(S({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),c));const l=i||o?this.ha(e):this.No;this.Qa();const u=this.ca(e),p=i||u!==this.Xo,d=!a&&(p||e.cross_subdomain_cookie!==this.Va||e.secure_cookie!==this.Ga)&&this.Oa(c);this.ia=p;try{if(this.Za=this.Wa=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),p){const h=this.props;this.clear(),this.No=l,this.Xo=u,this.props=h,this.save()}else o&&(this.No=l,a||(delete this.Qo[ft],this.Na()))}finally{this.ia=!1,d&&this.qa()}}Qa(){const e=this.props[go];if(!this.Ko||!Le(e)||typeof e.r!="string")return;const t=Cl(e.r),r=typeof e.u=="string"?Cl(e.u):e.u;t===e.r&&r===e.u||this.xa(go,S(S({},e),{},{r:t,u:r}))}set_disabled(e){this.hi=e,this.hi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Va&&(this.Va=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const r=this.props.__timers||{};r[e]=t,this.xa(Bf,r),this.save()}remove_event_timer(e){const t=this.props.__timers||{},r=t[e];return j(r)||(delete t[e],this.xa(Bf,t),this.save()),r}get_property(e){return this.props[e]}set_property(e,t){this.xa(e,t),this.save()}xa(e,t,r=!0){var s;const n=this.props[e];this.props[e]=t,r&&(e!=="distinct_id"&&e!=="$user_state"||n===t||(this.na=!0),o0(e)&&!on(n,t)&&this.ra.add(e),this.Ma(e,n,t),(s=Lt(e))!==null&&s!==void 0&&s.volatile||this.Ta(e))}Ca(e,t=!0){delete this.props[e],t&&(th(e)&&this.ga(e,!0),o0(e)&&this.ra.add(e),this.Ta(e))}Ta(e){var t;const r=(t=Lt(e))===null||t===void 0?void 0:t.storageGroup;r&&(this.ma(r).dirty=!0)}ma(e){return this.Qo[e]||(this.Qo[e]={})}},br={GZipJS:"gzip-js",Base64:"base64"},Ia={Activation:"events",Cancellation:"cancelEvents"},sh={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},_r={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},nh={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},sm={Popover:"popover",Inline:"inline"};function Pl(e){let t=!0;return{dispose(){if(t){t=!1;const r=e();r&&kt(r.then)&&r.then(void 0,()=>{})}}}}var r3={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},c0={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},l0=ot("[RateLimiter]"),s3=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const r=t.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach(s=>{l0.info(`${s||"events"} is quota limited.`),this.serverLimits[s]=new Date().getTime()+6e4})}catch(s){l0.warn(`could not rate limit - continuing. Error: "${s?.message}"`,{text:r});return}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,r,s;const{captureEventsBurstLimit:n,captureEventsPerSecond:i}=this,o=new Date().getTime(),a=(t=(r=this.instance.persistence)===null||r===void 0?void 0:r.get_property("$capture_rate_limit"))!==null&&t!==void 0?t:{tokens:n,last:o};a.tokens+=(o-a.last)/1e3*i,a.last=o,a.tokens>n&&(a.tokens=n);const c=1>a.tokens;if(c||e||(a.tokens=Math.max(0,a.tokens-1)),c&&!e){const l=(lt(a.dropped)?a.dropped:0)+1;a.dropped=l,!this.lastEventRateLimited&&this.Ja(l)&&(a.dropped=0)}return this.lastEventRateLimited=c,(s=this.instance.persistence)===null||s===void 0||s.set_property("$capture_rate_limit",a),{isRateLimited:c,remainingTokens:a.tokens}}Ka(e){const t=this.instance.config.property_denylist;return!Se(t)||!t.includes(e)}Xa(){var e;if(this.Ka("$current_url")&&this.Ka("$pathname")&&st?.pathname)return`${(e=st.origin)!==null&&e!==void 0?e:""}${st.pathname}`}Ja(e){var t,r;const{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,i=this.Xa(),o=this.Ka("$session_id")?(t=(r=this.instance).get_session_id)===null||t===void 0?void 0:t.call(r):void 0,a=[`${e} event(s) dropped since the last warning`,i?`triggered on ${i}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${a}. Config is set to ${n} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},an=ot("[RemoteConfig]"),$R=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=ge._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}Ya(e){var t,r,s;!((t=ge.__PosthogExtensions__)===null||t===void 0)&&t.loadExternalDependency?(r=ge.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}tl(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return an.info("Using preloaded remote config",this.remoteConfig),void this.el(this.remoteConfig);if(this._instance.il())return void an.warn("Remote config is disabled. Falling back to local config.");this.Ya(e=>{if(!e)return an.info("No config found after loading remote JS config. Falling back to JSON."),void this.tl(t=>{this.el(t.json,t)});this.el(e)})}catch(e){an.error("Error loading remote config",e),this.el()}}el(e,t){!e&&t&&(t.statusCode===0?t.error||an.warn("Failed to fetch remote config from PostHog."):an.error("Failed to fetch remote config from PostHog."));try{this._instance.el(e?{ok:!0,config:e}:{ok:!1})}catch(s){an.error("Error applying remote config",s)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var r;(r=this._instance.featureFlags)===null||r===void 0||r.ensureFlagsLoaded()}catch(s){an.error("Error loading feature flags",s)}}},kr=Uint8Array,sr=Uint16Array,jo=Uint32Array,Cv=new kr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Pv=new kr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),u0=new kr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),DR=function(e,t){for(var r=new sr(31),s=0;31>s;++s)r[s]=t+=1<<e[s-1];var n=new jo(r[30]);for(s=1;30>s;++s)for(var i=r[s];r[s+1]>i;++i)n[i]=i-r[s]<<5|s;return[r,n]},UR=DR(Cv,2),nm=UR[1];UR[0][28]=258,nm[258]=28;for(var d0=DR(Pv,0)[1],im=new sr(32768),it=0;32768>it;++it){var Yi=(43690&it)>>>1|(21845&it)<<1;im[it]=((65280&(Yi=(61680&(Yi=(52428&Yi)>>>2|(13107&Yi)<<2))>>>4|(3855&Yi)<<4))>>>8|(255&Yi)<<8)>>>1}var tc=function(e,t,r){for(var s=e.length,n=0,i=new sr(t);s>n;++n)++i[e[n]-1];var o,a=new sr(t);for(n=0;t>n;++n)a[n]=a[n-1]+i[n-1]<<1;if(r){o=new sr(1<<t);var c=15-t;for(n=0;s>n;++n)if(e[n])for(var l=n<<4|e[n],u=t-e[n],p=a[e[n]-1]++<<u,d=p|(1<<u)-1;d>=p;++p)o[im[p]>>>c]=l}else for(o=new sr(s),n=0;s>n;++n)o[n]=im[a[e[n]-1]++]>>>15-e[n];return o},Ri=new kr(288);for(it=0;144>it;++it)Ri[it]=8;for(it=144;256>it;++it)Ri[it]=9;for(it=256;280>it;++it)Ri[it]=7;for(it=280;288>it;++it)Ri[it]=8;var Nu=new kr(32);for(it=0;32>it;++it)Nu[it]=5;var n3=tc(Ri,9,0),i3=tc(Nu,5,0),qR=function(e){return(e/8|0)+(7&e&&1)},zR=function(e,t,r){(t==null||0>t)&&(t=0),(r==null||r>e.length)&&(r=e.length);var s=new(e instanceof sr?sr:e instanceof jo?jo:kr)(r-t);return s.set(e.subarray(t,r)),s},Ms=function(e,t,r){var s=t/8|0;e[s]|=r<<=7&t,e[s+1]|=r>>>8},Ra=function(e,t,r){var s=t/8|0;e[s]|=r<<=7&t,e[s+1]|=r>>>8,e[s+2]|=r>>>16},ih=function(e,t){for(var r=[],s=0;e.length>s;++s)e[s]&&r.push({s,f:e[s]});var n=r.length,i=r.slice();if(!n)return[new kr(0),0];if(n==1){var o=new kr(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort(function(x,D){return x.f-D.f}),r.push({s:-1,f:25001});var a=r[0],c=r[1],l=0,u=1,p=2;for(r[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=n-1;)a=r[r[p].f>r[l].f?l++:p++],c=r[l!=u&&r[p].f>r[l].f?l++:p++],r[u++]={s:-1,f:a.f+c.f,l:a,r:c};var d=i[0].s;for(s=1;n>s;++s)i[s].s>d&&(d=i[s].s);var h=new sr(d+1),f=om(r[u-1],h,0);if(f>t){s=0;var m=0,v=f-t,_=1<<v;for(i.sort(function(x,D){return h[D.s]-h[x.s]||x.f-D.f});n>s;++s){var b=i[s].s;if(t>=h[b])break;m+=_-(1<<f-h[b]),h[b]=t}for(m>>>=v;m>0;){var T=i[s].s;t>h[T]?m-=1<<t-h[T]++-1:++s}for(;s>=0&&m;--s){var O=i[s].s;h[O]==t&&(--h[O],++m)}f=t}return[new kr(h),f]},om=function(e,t,r){return e.s==-1?Math.max(om(e.l,t,r+1),om(e.r,t,r+1)):t[e.s]=r},p0=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new sr(++t),s=0,n=e[0],i=1,o=function(c){r[s++]=c},a=1;t>=a;++a)if(e[a]==n&&a!=t)++i;else{if(!n&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(n),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(n);i=1,n=e[a]}return[r.subarray(0,s),t]},Ca=function(e,t){for(var r=0,s=0;t.length>s;++s)r+=e[s]*t[s];return r},Zl=function(e,t,r){var s=r.length,n=qR(t+2);e[n]=255&s,e[n+1]=s>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var i=0;s>i;++i)e[n+i+4]=r[i];return 8*(n+4+s)},h0=function(e,t,r,s,n,i,o,a,c,l,u){Ms(t,u++,r),++n[256];for(var p=ih(n,15),d=p[0],h=p[1],f=ih(i,15),m=f[0],v=f[1],_=p0(d),b=_[0],T=_[1],O=p0(m),x=O[0],D=O[1],z=new sr(19),F=0;b.length>F;++F)z[31&b[F]]++;for(F=0;x.length>F;++F)z[31&x[F]]++;for(var J=ih(z,7),ce=J[0],de=J[1],R=19;R>4&&!ce[u0[R-1]];--R);var fe,Y,me,$,le=l+5<<3,y=Ca(n,Ri)+Ca(i,Nu)+o,Q=Ca(n,d)+Ca(i,m)+o+14+3*R+Ca(z,ce)+(2*z[16]+3*z[17]+7*z[18]);if(y>=le&&Q>=le)return Zl(t,u,e.subarray(c,c+l));if(Ms(t,u,1+(y>Q)),u+=2,y>Q){fe=tc(d,h,0),Y=d,me=tc(m,v,0),$=m;var ne=tc(ce,de,0);for(Ms(t,u,T-257),Ms(t,u+5,D-1),Ms(t,u+10,R-4),u+=14,F=0;R>F;++F)Ms(t,u+3*F,ce[u0[F]]);u+=3*R;for(var H=[b,x],I=0;2>I;++I){var ee=H[I];for(F=0;ee.length>F;++F)Ms(t,u,ne[oe=31&ee[F]]),u+=ce[oe],oe>15&&(Ms(t,u,ee[F]>>>5&127),u+=ee[F]>>>12)}}else fe=n3,Y=Ri,me=i3,$=Nu;for(F=0;a>F;++F)if(s[F]>255){var oe;Ra(t,u,fe[257+(oe=s[F]>>>18&31)]),u+=Y[oe+257],oe>7&&(Ms(t,u,s[F]>>>23&31),u+=Cv[oe]);var he=31&s[F];Ra(t,u,me[he]),u+=$[he],he>3&&(Ra(t,u,s[F]>>>5&8191),u+=Pv[he])}else Ra(t,u,fe[s[F]]),u+=Y[s[F]];return Ra(t,u,fe[256]),u+Y[256]},o3=new jo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),a3=new kr(0),c3=(function(){for(var e=new jo(256),t=0;256>t;++t){for(var r=t,s=9;--s;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e})(),oh=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8};function l3(e,t){t===void 0&&(t={});var r=(function(){var d=4294967295;return{p(h){for(var f=d,m=0;h.length>m;++m)f=c3[255&f^h[m]]^f>>>8;d=f},d(){return 4294967295^d}}})(),s=e.length;r.p(e);var n,i,o,a,c,l,u=(a=10+((n=t).filename&&n.filename.length+1||0),c=8,(function(d,h,f,m,v,_){var b=d.length,T=new kr(m+b+5*(1+Math.floor(b/7e3))+v),O=T.subarray(m,T.length-v),x=0;if(!h||8>b)for(var D=0;b>=D;D+=65535){var z=D+65535;b>z?x=Zl(O,x,d.subarray(D,z)):(O[D]=_,x=Zl(O,x,d.subarray(D,b)))}else{for(var F=o3[h-1],J=F>>>13,ce=8191&F,de=(1<<f)-1,R=new sr(32768),fe=new sr(de+1),Y=Math.ceil(f/3),me=2*Y,$=function(g){return(d[g]^d[g+1]<<Y^d[g+2]<<me)&de},le=new jo(25e3),y=new sr(288),Q=new sr(32),ne=0,H=0,I=(D=0,0),ee=0,oe=0;b>D;++D){var he=$(D),ue=32767&D,Ge=fe[he];if(R[ue]=Ge,fe[he]=ue,D>=ee){var Ve=b-D;if((ne>7e3||I>24576)&&Ve>423){x=h0(d,O,0,le,y,Q,H,I,oe,D-oe,x),I=ne=H=0,oe=D;for(var Ce=0;286>Ce;++Ce)y[Ce]=0;for(Ce=0;30>Ce;++Ce)Q[Ce]=0}var B=2,pe=0,_e=ce,ke=ue-Ge&32767;if(Ve>2&&he==$(D-ke))for(var je=Math.min(J,Ve)-1,xe=Math.min(32767,D),Oe=Math.min(258,Ve);xe>=ke&&--_e&&ue!=Ge;){if(d[D+B]==d[D+B-ke]){for(var Ee=0;Oe>Ee&&d[D+Ee]==d[D+Ee-ke];++Ee);if(Ee>B){if(B=Ee,pe=ke,Ee>je)break;var Ae=Math.min(ke,Ee-2),Me=0;for(Ce=0;Ae>Ce;++Ce){var et=D-ke+Ce+32768&32767,K=et-R[et]+32768&32767;K>Me&&(Me=K,Ge=et)}}}ke+=(ue=Ge)-(Ge=R[ue])+32768&32767}if(pe){le[I++]=268435456|nm[B]<<18|d0[pe];var ie=31&nm[B],A=31&d0[pe];H+=Cv[ie]+Pv[A],++y[257+ie],++Q[A],ee=D+B,++ne}else le[I++]=d[D],++y[d[D]]}}x=h0(d,O,_,le,y,Q,H,I,oe,D-oe,x),_||(x=Zl(O,x,a3))}return zR(T,0,m+qR(x)+v)})(i=e,(o=t).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+o.mem,a,c,!l)),p=u.length;return(function(d,h){var f=h.filename;if(d[0]=31,d[1]=139,d[2]=8,d[8]=2>h.level?4:h.level==9?2:0,d[9]=3,h.mtime!=0&&oh(d,4,Math.floor(new Date(h.mtime||Date.now())/1e3)),f){d[3]=8;for(var m=0;f.length>=m;++m)d[m+10]=f.charCodeAt(m)}})(u,t),oh(u,p-8,r.d()),oh(u,p-4,s),u}var u3=!!uv||!!mc,FR=new WeakMap,jR="text/plain",ah=0,Ql=!1,HR=(e,t)=>{const[r,s]=e.split("#"),[n,i]=r.split("?");if(!i)return e;const o=i.split("&").filter(a=>a.split("=")[0]!==t).join("&");return`${n}${o?`?${o}`:""}${s?`#${s}`:""}`},jc=(e,t,r=!0)=>{var s;const[n,i]=e.split("?"),o=S({},t),a=(s=i?.split("&").map(l=>{var u;const[p,d]=l.split("="),h=r&&(u=o[p])!==null&&u!==void 0?u:d;return delete o[p],`${p}=${h}`}))!==null&&s!==void 0?s:[],c=(function(l,u="&"){let p,d;const h=[];return Be(l,function(f,m){j(f)||j(m)||m==="undefined"||(p=encodeURIComponent((v=>v instanceof File)(f)?f.name:f.toString()),d=encodeURIComponent(m),h[h.length]=d+"="+p)}),h.join(u)})(o);return c&&a.push(c),a.length>0?`${n}?${a.join("&")}`:n},ch=e=>{if(e.nl)return e.nl;const{data:t,compression:r}=e;if(!t)return;if(r===br.GZipJS){const n=l3((function(i){var o=i.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(i);for(var a=new kr(i.length+(i.length>>>1)),c=0,l=function(h){a[c++]=h},u=0;o>u;++u){if(c+5>a.length){var p=new kr(c+8+(o-u<<1));p.set(a),a=p}var d=i.charCodeAt(u);128>d?l(d):2048>d?(l(192|d>>>6),l(128|63&d)):d>55295&&57344>d?(l(240|(d=65536+(1047552&d)|1023&i.charCodeAt(++u))>>>18),l(128|d>>>12&63),l(128|d>>>6&63),l(128|63&d)):(l(224|d>>>12),l(128|d>>>6&63),l(128|63&d))}return zR(a,0,c)})(_o(t)),{mtime:0});return{contentType:jR,body:n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength),estimatedSize:n.byteLength}}if(r===br.Base64){const n=(i=>"data="+encodeURIComponent(typeof i=="string"?i:_o(i)))((function(i){return i&&btoa(encodeURIComponent(i).replace(/%([0-9A-F]{2})/g,(o,a)=>String.fromCharCode(parseInt(a,16))))})(_o(t)));return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}const s=_o(t);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},BR=e=>{const t=()=>e.transport==="sendBeacon"?{url:jc(e.url,{compression:br.Base64}),encodedBody:ch(S(S({},e),{},{compression:br.Base64,nl:void 0}))}:{url:HR(e.url,"compression"),encodedBody:ch(S(S({},e),{},{compression:void 0,nl:void 0}))};let r;try{r=ch(e)}catch(n){if(Mb(e.compression,zo(e.url,"compression")))return X.error("Failed to gzip request body, sending uncompressed payload",n),t();throw n}return r&&Mb(e.compression,zo(e.url,"compression"))&&!((s=r.body)instanceof ArrayBuffer?jf(new Uint8Array(s)):ArrayBuffer.isView(s)&&jf(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Ql=!0,t()):{url:e.url,encodedBody:r};var s},VR=e=>{try{return BR(e)}catch(r){var t;X.error(r),(t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:r});return}},d3=(function(){var e=Ze(function*(t){const r=yield(function(n){return Hf.apply(this,arguments)})(_o(t.data),gt.DEBUG,{rethrow:!0});if(!r)return t;const s=yield r.arrayBuffer();return S(S({},t),{},{nl:{contentType:jR,body:s,estimatedSize:s.byteLength}})});return function(t){return e.apply(this,arguments)}})(),p3=/Failed to fetch|NetworkError|Load failed/i,GR=e=>e?.name==="TypeError"&&p3.test(e?.message||""),WR=e=>{try{const t=(function(r,s=Date.now()){if(typeof r!="string"||!r)return;const n=r.trim(),i=/^\d+\s*,/.test(n)?n.slice(0,n.indexOf(",")).trim():n;if(/^\d+$/.test(i)){const c=1e3*Math.min(Number(i),300);return c>0?c:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(i))return;const o=/^\w{3} \w{3} /.test(i)?i+" GMT":i,a=Date.parse(o)-s;return Number.isFinite(a)&&a>0?Math.min(a,Jl):void 0})(e());return j(t)?void 0:Math.min(t,3e4)}catch{return}},KR=e=>{const t=VR(e);if(!t)return;const r=new uv;FR.set(r,!0);const{url:s,encodedBody:n}=t;r.open(e.method||"GET",s,!0);const{contentType:i,body:o}=n??{};Be(e.headers,function(a,c){r.setRequestHeader(c,a)}),i&&r.setRequestHeader("Content-Type",i),e.timeout&&(r.timeout=e.timeout),r.onreadystatechange=()=>{if(r.readyState===4){var a;const c={statusCode:r.status,text:r.responseText};if(r.status===200)try{c.json=JSON.parse(r.responseText)}catch{}(a=e.callback)===null||a===void 0||a.call(e,c,WR(()=>r.getResponseHeader("Retry-After")))}},r.send(o)},JR=e=>{const t=VR(e);if(!t)return;const{url:r,encodedBody:s}=t,{contentType:n,body:i,estimatedSize:o}=s??{},a=new Headers;Be(e.headers,function(f,m){a.append(m,f)}),n&&a.append("Content-Type",n);let c=null,l=!1;if(vb){const f=new vb;c={signal:f.signal,timeout:setTimeout(()=>{l=!0;try{f.abort(EI("AbortError","PostHog request timed out"+((m=e.timeout)?` after ${m}ms`:"")))}catch(v){p(v)}var m},e.timeout)}}let u=!1;const p=f=>{var m;u||(u=!0,l&&f?.name==="AbortError"||GR(f)?X.warn(f):X.error(f),(m=e.callback)===null||m===void 0||m.call(e,{statusCode:0,error:f}))};let d=0;const h=()=>{ah-=d,d=0,c&&clearTimeout(c.timeout)};try{const f=S({method:e?.method||"GET",headers:a,referrerPolicy:"strict-origin",body:i,signal:c?.signal},e.fetchOptions),m=o??(j(i)?0:void 0);f.keepalive=f.method==="POST"&&!e.sl&&f.keepalive!==!1&&f.body===i&&!j(m)&&m>=0&&52428.8>ah+m,f.keepalive&&(d=m,ah+=d),mc(r,f).then(v=>v.text().then(_=>{var b;if(u)return;const T={statusCode:v.status,text:_};if(v.status===200)try{T.json=JSON.parse(_)}catch(O){X.error(O)}u=!0,h(),(b=e.callback)===null||b===void 0||b.call(e,T,WR(()=>v.headers.get("Retry-After")))})).catch(v=>{h(),p(v)}).finally(h)}catch(f){h(),p(f)}},am=e=>{try{var t;const{url:r,encodedBody:s}=BR(e),{contentType:n,body:i,estimatedSize:o}=s??{};if(!i)return;const a=i instanceof Blob?i:new Blob([i],{type:n});if(Tt.sendBeacon(r,a))return;const c=Se(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(Se(c)&&c.length>1&&(o??0)>16384){const l=Math.ceil(c.length/2),u=p=>Se(e.data)?p:S(S({},e.data),{},{batch:p});am(S(S({},e),{},{data:u(c.slice(0,l))})),am(S(S({},e),{},{data:u(c.slice(l))}));return}X.warn(`Beacon of ~${o??0} bytes was rejected by the browser, falling back to ${mc?"fetch":"XHR"}`),mc?JR(S(S({},e),{},{sl:!0})):KR(e)}catch(r){X.warn("Beacon send failed",r)}},f0=(e,t,r,s)=>{const n=s==="query"?t==="POST"?"sent_at":"_":void 0;return jc(r===br.GZipJS?HR(e,"compression"):e,S(S({},n?{[n]:Date.now().toString()}:{}),r===br.GZipJS?{}:{compression:r}))},h3=(()=>{const e=[];return mc&&e.push({transport:"fetch",method:JR}),uv&&e.push({transport:"XHR",method:KR}),Tt!=null&&Tt.sendBeacon&&e.push({transport:"sendBeacon",method:am}),e})(),YR=!u3&&Zt?.indexOf("MSIE")===-1&&Zt?.indexOf("Mozilla")===-1;function XR(e,t,r){var s,n,i;r&&(t=S(S({},t),{},{callback:o=>r(o)})),e.__loaded?YR?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((n=t.callback)===null||n===void 0||n.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=S(S({},e.config.request_headers),t.headers),t.compression=t.compression==="best-available"?(s=e.compression)!==null&&s!==void 0?s:t.compressionFallback:t.compression,(j(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,((o,a)=>{var c,l,u;const p=S(S({},o),{},{callback:a??(v=>{var _;return(_=o.callback)===null||_===void 0?void 0:_.call(o,v)})});p.timeout=p.timeout||6e4;const d=(c=p.transport)!==null&&c!==void 0?c:"fetch";d==="sendBeacon"&&j(p.compression)&&p.data&&(p.compression=br.Base64),p.method==="POST"&&p.data&&(p.timestampMode==="capture-body"?p.data=(v=>{var _,b;const T=(Se(v)?v:[v]).map(x=>S(S({},x),x.timestamp instanceof Date&&!isNaN(x.timestamp.getTime())?{timestamp:x.timestamp.toISOString()}:{})),O=T[0];return{api_key:(_=O==null||(b=O.properties)===null||b===void 0?void 0:b.token)!==null&&_!==void 0?_:O?.token,batch:T,sent_at:new Date().toISOString()}})(p.data):p.timestampMode==="body"&&(p.data=((v,_=new Date().toISOString())=>Se(v)?v.map(b=>S(S({},b),{},{sent_at:_})):S(S({},v),{},{sent_at:_}))(p.data))),p.url=f0(p.url,p.method,p.compression,p.timestampMode);const h=h3.filter(v=>!p.disableTransport||!v.transport||!p.disableTransport.includes(v.transport)),f=(l=(u=(function(v,_){for(let b=0;v.length>b;b++)if(_(v[b]))return v[b]})(h,v=>v.transport===d))===null||u===void 0?void 0:u.method)!==null&&l!==void 0?l:h[0].method;if(!f)throw new Error("No available transport method");const m=v=>{try{f(v)}catch(b){var _;GR(b)?X.warn(b):X.error(b),(_=p.callback)===null||_===void 0||_.call(p,{statusCode:0,error:b})}};d!=="sendBeacon"&&!p.preferSyncCompression&&p.data&&p.compression===br.GZipJS&&sB&&typeof Promise<"u"&&!Ql?d3(p).then(v=>{m(v)}).catch(v=>{if(Lb(v))return Ql=!0,void m(S(S({},p),{},{compression:void 0,url:f0(o.url,o.method,void 0,o.timestampMode)}));(_=>{if(!_||typeof _!="object")return!1;const b="name"in _?String(_.name):"";return Lb(_)||b===xI})(v)&&(Ql=!0),m(p)}):m(p)})(t,(o,a)=>{var c,l,u;e.rateLimiter.checkForLimiting(o),400>o.statusCode||(c=(l=e.config).on_request_error)===null||c===void 0||c.call(l,o),r?r(o,a):(u=t.callback)===null||u===void 0||u.call(t,o)})):t.fireCallbackOnDrop&&((i=t.callback)===null||i===void 0||i.call(t,{statusCode:0}))}var f3=class{constructor(e,t){this.rl=!0,this.ol=[],this.al=_s(t?.flush_interval_ms||3e3,250,5e3,X.createLogger("flush interval"),3e3),this.ll=e}enqueue(e){this.ol.push(e),this.ul||this.hl()}unload(){this.cl();const e=this.ol.length>0?this.dl():{},t=Object.values(e);[...t.filter(r=>r.url.indexOf("/e")===0),...t.filter(r=>r.url.indexOf("/e")!==0)].map(r=>{this.vl(r,"sendBeacon")})}enable(){this.rl=!1,this.hl()}hl(){this.rl||(this.ul=setTimeout(()=>{if(this.cl(),this.ol.length>0){const e=this.dl();for(const t in e)this.vl(e[t])}},this.al))}vl(e,t){try{this.ll(e,t)}catch(r){X.error(r)}}cl(){clearTimeout(this.ul),this.ul=void 0}dl(){const e={};return Be(this.ol,t=>{var r;const s=t,n=((s?s.batchKey:null)||s.url)+(s.batchGroup?`:${s.batchGroup}`:"");j(e[n])&&(e[n]=S(S({},s),{},{data:[]})),(r=e[n].data)===null||r===void 0||r.push(s.data)}),this.ol=[],e}},m3=["retriesPerformedSoFar"],g3=class{constructor(e){this._instance=e,this.fl=!1,this.pl=3e3,this.ol=[],this.ol=[],this.gl=!0,this.resume()}resume(){if(!j(L)&&"onLine"in L.navigator){if(this.gl=L.navigator.onLine,this.ml)return;this.ml=()=>{this.gl=!0,this.yl()},this.bl=()=>{this.gl=!1},ze(L,"online",this.ml),ze(L,"offline",this.bl)}}get length(){return this.ol.length}retriableRequest(e,t){let{retriesPerformedSoFar:r}=e,s=OI(e,m3);Us(r)&&(s.url=jc(s.url,{retry_count:r})),XR(this._instance,t?S(S({},s),{},{transport:t}):s,(n,i)=>{var o;if(n.statusCode!==200&&(400>n.statusCode||n.statusCode>=500)){if((n.statusCode===0?3:10)>(r??0))return void this.Ls(S({retriesPerformedSoFar:r},s),i);n.statusCode===0&&X.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${r??0} retries.`)}(o=s.callback)===null||o===void 0||o.call(s,n)})}Ls(e,t){const r=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=r+1;const s=Math.max((function(o){const a=3e3*Math.pow(2,o),c=a/2,l=Math.min(18e5,a),u=(Math.random()-.5)*(l-c);return Math.ceil(l+u)})(r),t??0),n=Date.now()+s;this.ol.push({retryAt:n,requestOptions:e});let i=`Enqueued failed request for retry in ${s}`;navigator.onLine||(i+=" (Browser is offline)"),X.warn(i),this.fl||(this.fl=!0,this._l())}_l(){if(this.wl&&clearTimeout(this.wl),this.ol.length===0)return this.fl=!1,void(this.wl=void 0);this.wl=setTimeout(()=>{this.gl&&this.ol.length>0&&this.yl(),this._l()},this.pl)}yl(){const e=Date.now(),t=[],r=this.ol.filter(s=>e>s.retryAt||(t.push(s),!1));if(this.ol=t,r.length>0)for(const{requestOptions:s}of r)this.retriableRequest(s)}unload(){this.wl&&(clearTimeout(this.wl),this.wl=void 0),this.fl=!1,j(L)||(this.ml&&(L.removeEventListener("online",this.ml),this.ml=void 0),this.bl&&(L.removeEventListener("offline",this.bl),this.bl=void 0));for(const{requestOptions:e}of this.ol)try{this._instance._send_request(S(S({},e),{},{transport:"sendBeacon"}))}catch(t){X.error(t)}this.ol=[]}},v3=class{constructor(e){this._instance=e,this.kl=()=>{var t,r,s,n;this.Sl||(this.Sl={});const i=this.scrollElement(),o=this.scrollY(),a=i?Math.max(0,i.scrollHeight-i.clientHeight):0,c=o+(i?.clientHeight||0),l=i?.scrollHeight||0;this.Sl.lastScrollY=Math.ceil(o),this.Sl.maxScrollY=Math.max(o,(t=this.Sl.maxScrollY)!==null&&t!==void 0?t:0),this.Sl.maxScrollHeight=Math.max(a,(r=this.Sl.maxScrollHeight)!==null&&r!==void 0?r:0),this.Sl.lastContentY=c,this.Sl.maxContentY=Math.max(c,(s=this.Sl.maxContentY)!==null&&s!==void 0?s:0),this.Sl.maxContentHeight=Math.max(l,(n=this.Sl.maxContentHeight)!==null&&n!==void 0?n:0)}}get xl(){return this._instance.config.scroll_root_selector}getContext(){return this.Sl}resetContext(){const e=this.Sl;return this.Sl=void 0,setTimeout(this.kl,0),e}startMeasuringScrollPosition(){ze(L,"scroll",this.kl,{capture:!0}),ze(L,"scrollend",this.kl,{capture:!0}),ze(L,"resize",this.kl)}scrollElement(){if(this.xl){const r=Se(this.xl)?this.xl:[this.xl];for(const s of r){var e;const n=L==null||(e=L.document)===null||e===void 0?void 0:e.querySelector(s);if(n)return n}return}var t;return L==null||(t=L.document)===null||t===void 0?void 0:t.documentElement}Cl(e){var t,r;const s=e==="y"?"scrollTop":"scrollLeft";if(this.xl){const n=this.scrollElement();return n&&n[s]||0}return L?e==="y"?L.scrollY||L.pageYOffset||((t=L.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.scrollTop)||0:L.scrollX||L.pageXOffset||((r=L.document)===null||r===void 0||(r=r.documentElement)===null||r===void 0?void 0:r.scrollLeft)||0:0}scrollY(){return this.Cl("y")}scrollX(){return this.Cl("x")}},_3=e=>OR(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties,e?.config.disable_capture_url_hashes),m0=class{constructor(e,t,r,s){this.qe=n=>{const i=this.$l();if(i&&i.sessionId===n)return;const o={sessionId:n,props:this.Tl(this._instance)};this.Il.register({[Xf]:o})},this._instance=e,this.Ml=t,this.Il=r,this.Tl=s||_3,this.Ml.onSessionId(this.qe)}$l(){return this.Il.props[Xf]}getSetOnceProps(){var e;const t=(e=this.$l())===null||e===void 0?void 0:e.props;return t?"r"in t?MR(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){const e={};return Be(Ev(this.getSetOnceProps()),(t,r)=>{r==="$current_url"&&(r="url"),e[`$session_entry_${$f(r)}`]=t}),e}},$u=class{on(e,t){return this.El[e]||(this.El[e]=[]),this.El[e].push(t),()=>{this.El[e]=this.El[e].filter(r=>r!==t)}}emit(e,t){for(const r of this.El[e]||[])r(t);for(const r of this.El["*"]||[])r(e,t)}constructor(){this.El={}}},Xi=ot("[SessionId]"),g0=864e5,v0=class{on(e,t){return this.Pl.on(e,t)}constructor(e,t,r){var s;if(this.Rl=null,this.Al=null,this.Fl=[],this.Ol=void 0,this.Dl=!1,this.Pl=new $u,this.Ll=(i,o)=>!(!Us(i)||!Us(o))&&Math.abs(i-o)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Ir=e.config,this.Il=e.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Nl=void 0,this._sessionActivityTimestamp=null,this.ql=t||Yr,this.jl=r||Yr;const n=this.Ir.persistence_name||this.Ir.token;if(this._sessionTimeoutMs=1e3*_s(this.Ir.session_idle_timeout_seconds||1800,60,36e3,Xi.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Bl(),this.Hl="ph_"+n+"_window_id",this.zl="ph_"+n+"_primary_window_exists",this.Ul()){const i=Je.Dt(this.Hl),o=Je.Dt(this.zl);i&&!o?this.je=i:Je.Lt(this.Hl),Je.$t(this.zl,!0)}(s=this.Ir.bootstrap)!==null&&s!==void 0&&s.sessionID&&this.setBootstrapSessionId(this.Ir.bootstrap.sessionID),this.Wl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return j(this.Fl)&&(this.Fl=[]),this.Fl.push(e),this.Xt&&e(this.Xt,this.je),()=>{this.Fl=this.Fl.filter(t=>t!==e)}}Ul(){return this.Ir.persistence!=="memory"&&!this.Il.hi&&Je.Et()}Vl(e){e!==this.je&&(this.je=e,this.Ul()&&Je.$t(this.Hl,e))}Gl(){return this.je?this.je:this.Ul()?Je.Dt(this.Hl):null}Zl(e){const t=this.Rl;return!nt(t)&&!nt(e)&&5e3>Math.abs(e-t)}Ql(e,t,r){const s=t!==this._sessionActivityTimestamp,n=!(e!==this.Xt||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this.Xt=e,n&&!s||n&&this.Zl(t)||(this.Rl=t,this.Il.register({[mo]:[t,e,r]}))}Jl(){var e;const t=(e=this.Ir)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return Us(t)&&t>0}Kl(){this.Jl()?this.Il.refreshKey(mo):(this.Il.flush(),this.Il.load())}Xl(){var e;if(nt(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Rl)return;this.Kl();const[,t,r]=this.Yl();t===this.Xt&&r===this._sessionStartTimestamp&&(this.Rl=this._sessionActivityTimestamp,this.Il.register({[mo]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Il.flush())}tu(){const[e]=this.Yl(),t=Us(e)?e:0,r=Us(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,r)}eu(e){return this.Kl(),this.Ll(e,this.tu())}Yl(){const e=this.Il.props[mo];return Se(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Rl=null,this.Nl=void 0,clearTimeout(this.iu),this.iu=void 0,this.Ql(null,null,null)}setBootstrapSessionId(e,t=!1){const r=((s,n=new Date().getTime())=>{try{const i=(o=>{const a=o.replace(/-/g,"");if(a.length!==32)throw new Error("Not a valid UUID");if(a[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(a.substring(0,12),16)})(s);return i>n+6e4?void Xi.error("Bootstrap sessionID cannot be in the future"):i}catch(i){Xi.error("Invalid sessionID in bootstrap",i);return}})(e);return!j(r)&&(t?this.Nl={sessionId:e,sessionStartTimestamp:r}:this.Ql(e,new Date().getTime(),r),!0)}destroy(){this.Dl=!0,this.Xl(),clearTimeout(this.iu),this.iu=void 0,this.Ol&&L&&(L.removeEventListener(xu,this.Ol,{capture:!1}),this.Ol=void 0),this.Fl=[]}Wl(){this.Ol=()=>{this.Xl(),this.Ul()&&Je.Lt(this.zl)},ze(L,xu,this.Ol,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,r=!1){if(this.Ir.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const s=t||new Date().getTime(),n=this.Xt;if(r)this.Al=s;else if(nt(this.Al)||this.Al>s||s-this.Al>=1e3){var i,o;(i=(o=this.Il).syncCookieProperties)===null||i===void 0||i.call(o),this.Al=s}let[,a,c]=this.Yl();const l=!j(n)&&a!==n,u=this.tu();let p=this.Gl();const d=this.Nl,h=!!d&&(d.sessionStartTimestamp>s+6e4||s-d.sessionStartTimestamp>g0),f=d?h:Us(c)&&Math.abs(s-c)>g0;let m=!1,v=l,_=!a||!!d;const b=a;let T=!_&&!e&&this.Ll(s,u);if(T&&(T=this.eu(s),T||Xi.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,c]=this.Yl(),T||(_=!a||!!d)),_||T||f){v=!1;const z=d&&!h;a=z?d.sessionId:this.ql(),p=this.jl(),Xi.info("new session ID assigned",{sessionId:a,windowId:p,bootstrapped:!!z,changeReason:{noSessionId:_,activityTimeout:T,sessionPastMaximumLength:f}}),c=z?d.sessionStartTimestamp:s,this.Nl=void 0,m=!0}else p||(p=this.jl(),m=!0),v=v||a!==b,v&&(Xi.info("adopted cross-tab session id",{sessionId:a,windowId:p}),m=!0);const O=Us(u)&&e&&!f?u:s,x=Us(c)?c:new Date().getTime();this.Vl(p),this.Ql(a,O,x),e||this.Bl();const D={noSessionId:_,activityTimeout:T,sessionPastMaximumLength:f,crossTabAdoption:v};return m&&this.Fl.forEach(z=>z(a,p,D)),{sessionId:a,windowId:p,sessionStartTimestamp:x,changeReason:m?D:void 0,lastActivityTimestamp:u}}Bl(){this.Dl||(clearTimeout(this.iu),this.iu=setTimeout(()=>{if(!this.Dl)if(this.eu(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Pl.emit("forcedIdleReset",{idleSessionId:e})}else this.Bl()},1.1*this.sessionTimeoutMs))}},ZR=function(e,t){if(!e)return!1;const r=e.userAgent;if(r&&bb(r,t))return!0;try{const s=e?.userAgentData;if(s?.brands&&s.brands.some(n=>bb(n?.brand,t)))return!0}catch{}return!!e.webdriver};function QR(){return(QR=Ze(function*(){const e=Tt?.userAgentData;if(e?.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),r=t?.model;return Pe(r)&&r.length>0?r:void 0}catch(t){X.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t);return}})).apply(this,arguments)}function y3(e,t){let r=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(r=`$survey_${t}/${e.id}/${e.current_iteration}`),r}function eC(e){var t;return!!(!((t=e.conditions)===null||t===void 0||(t=t.events)===null||t===void 0||(t=t.values)===null||t===void 0)&&t.length)}var Du=(e,t)=>{if(!(r=>{try{new RegExp(r)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},xl=e=>e.toLowerCase(),tC={exact:(e,t)=>t.some(r=>e.some(s=>r===s)),is_not:(e,t)=>t.every(r=>e.every(s=>r!==s)),regex:(e,t)=>t.some(r=>e.some(s=>Du(r,s))),not_regex:(e,t)=>t.every(r=>e.every(s=>!Du(r,s))),icontains:(e,t)=>t.map(xl).some(r=>e.map(xl).some(s=>r.includes(s))),not_icontains:(e,t)=>t.map(xl).every(r=>e.map(xl).every(s=>!r.includes(s))),gt:(e,t)=>t.some(r=>{const s=parseFloat(r);return!isNaN(s)&&e.some(n=>s>parseFloat(n))}),lt:(e,t)=>t.some(r=>{const s=parseFloat(r);return!isNaN(s)&&e.some(n=>s<parseFloat(n))})};function rC(e,t){return!e||Object.entries(e).every(([r,s])=>{const n=t?.[r];if(n==null)return!1;const i=tC[s.operator];return!!i&&i(s.values.map(String),[String(n)])})}function lh(e,t,r){return _o({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:r})}var cm="custom",_0="i.posthog.com",b3=/^\/static\//,S3=["/s/","/e/","/i/"],w3=class{constructor(e){this.nu={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${_0}`,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.nu[this.apiHost]||(this.nu[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":cm),this.nu[this.apiHost]}su(e){if(!b3.test(e))return;const t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}ru(e){const t=Zs(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}ou(e,t,r){if(e==="ui")return r;let s=r;const n=this.instance.config.rewriteRequestPath;if(n){var i;const o=((i=Zs(r))===null||i===void 0?void 0:i.href)||r;s=n(new URL(o)).toString()}if(n&&e==="api"&&S3.some(o=>t.indexOf(o)===0)){const o=this.ru(s);if(o){const a=this.apiHost;let c=this.au;c?.apiHost===a&&c.rewriteRequestPath===n||(c={apiHost:a,rewriteRequestPath:n,urls:new Set},this.au=c),c.urls.add(o)}}return s}isIngestionEndpoint(e){const t=this.au,r=this.ru(e);return t?.apiHost===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!r&&t.urls.has(r)}endpointFor(e,t=""){if(t&&(t=t[0]==="/"?t:`/${t}`),e==="ui")return this.ou(e,t,this.uiHost+t);if(e==="flags")return this.ou(e,t,this.flagsApiHost+t);if(e==="assets"){const s=this.su(t);if(s)return this.ou(e,t,`${s}${t}`)}if(this.region===cm)return this.ou(e,t,this.apiHost+t);const r=_0+t;switch(e){case"assets":return this.ou(e,t,`https://${this.region}-assets.${r}`);case"api":return this.ou(e,t,`https://${this.region}.${r}`)}}},Fe=ot("[Surveys]"),sC=e=>{try{const t=(r=>((s,n)=>`seenSurvey_${(function(i){return i.current_iteration&&i.current_iteration>0?`${i.id}_${i.current_iteration}`:i.id})(n)}`)(0,r))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(t){Fe.error("Failed to persist survey seen state",t)}},k3=[sh.Popover,sh.Widget,sh.API],E3={ignoreConditions:!1,ignoreDelay:!1,displayType:sm.Popover},T3=ot("[PostHog ExternalIntegrations]"),A3={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},I3=class{constructor(e){this._instance=e}Ho(e,t){var r,s;(r=ge.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this._instance,e,n=>{if(n)return T3.error("failed to load script",n);t()})}startIfEnabledOrStop(){var e;for(const[n,i]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var t,r,s;i&&!((t=ge.__PosthogExtensions__)!==null&&t!==void 0&&(t=t.integrations)!==null&&t!==void 0&&t[n])&&this.Ho(A3[n],()=>{var o;(o=ge.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0||(o=o[n])===null||o===void 0||o.start(this._instance)}),!i&&(r=ge.__PosthogExtensions__)!==null&&r!==void 0&&(r=r.integrations)!==null&&r!==void 0&&r[n]&&((s=ge.__PosthogExtensions__)===null||s===void 0||(s=s.integrations)===null||s===void 0||(s=s[n])===null||s===void 0||s.stop())}}},R3=class{constructor(e,t){this.A=e,this.bo=t,this.lu=new Map,this.To=!1}add(e){var t=this;return Ze(function*(){if(t.To)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.lu.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t.lu.set(e.name,e);try{const r=e.setup(t.bo);r&&(yield r)}catch(r){const s=t.lu.get(e.name)===e;s&&t.lu.delete(e.name),t.A.error(`Failed to set up browser extension "${e.name}"`,r),s&&t.uu(e)}})()}getExtension(e){return this.lu.get(e)}dispose(){if(this.To)return;this.To=!0;const e=Array.from(this.lu.values()).reverse();this.lu.clear();for(const t of e)this.uu(t)}uu(e){try{var t;const r=(t=e.dispose)===null||t===void 0?void 0:t.call(e);r&&kt(r.then)&&r.then(void 0,s=>{this.A.error(`Failed to dispose browser extension "${e.name}"`,s)})}catch(r){this.A.error(`Failed to dispose browser extension "${e.name}"`,r)}}},C3=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if(typeof e=="string")return t?.get_property(e);const r={};for(const s of e){const n=t?.get_property(s);j(n)||(r[s]=n)}return r}set(e,t){var r;(r=this._instance.persistence)===null||r===void 0||r.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)===null||t===void 0||t.unregister(e)}},y0="extensionsRemoteConfig",P3=class{constructor(e){this.instance=e,this.To=!1,this.A=X,this.hu=e.cu,this.kv=new C3(e),this.onEvent=t=>Pl(this.instance.on("eventCaptured",r=>{try{t({event:r.event,properties:r.properties})}catch(s){this.A.error("Browser extension event listener failed",s)}})),this.onRemoteConfig=t=>{if(this.To)return Pl(()=>{});const r=n=>{try{t(n)}catch(i){this.A.error("Browser extension remote config listener failed",i)}},s=this.instance.du.on(y0,r);return this.hu&&r(this.hu),Pl(s)},this.vu=new R3(X.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){const e=this.instance.get_property(gv);return typeof e=="string"?e:void 0}get library(){return{name:gt.LIB_NAME,version:gt.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)===null||t===void 0?void 0:t.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,r,s;const n=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=n?.sessionId)!==null&&t!==void 0?t:"",windowId:(r=n?.windowId)!==null&&r!==void 0?r:"",sessionStartTimestamp:(s=n?.sessionStartTimestamp)!==null&&s!==void 0?s:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.vu.add(e)}getExtension(e){return this.vu.getExtension(e)}capture(e,t,r){r?this.instance.capture(e,t,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):this.instance.capture(e,t)}registerDynamicEventProperties(e){return Pl(this.instance.fu(e))}handleRemoteConfig(e){this.To||(this.hu=e,this.instance.du.emit(y0,e))}sendRequest(e){var t=this;return Ze(function*(r,s={}){var n;const i=t.instance.requestRouter.endpointFor((n=s.target)!==null&&n!==void 0?n:"api",r),o={method:s.method,url:s.query?jc(i,s.query):i,data:s.body,headers:s.headers,timeout:s.timeoutMs,fireCallbackOnDrop:!0,transport:s.transport,compression:s.compression,compressionFallback:s.target==="flags"&&s.compression==="best-available"?Nf.Base64:void 0,timestampMode:s.sentAt};return s.transport==="sendBeacon"?(t.instance._send_request(o),{statusCode:202}):new Promise(a=>{o.callback=a,t.instance._send_request(o)})}).apply(this,arguments)}dispose(){this.To||(this.To=!0,this.vu.dispose())}},rc={},uh=0,sc=()=>{},b0='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Zi="Surveys module not available",S0="sanitize_properties is deprecated. Use before_send instead",nC="Invalid value for property_denylist config: ",x3=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],O3=["$feature_flag_called","$$heatmap","$snapshot"],w0=e=>e.charAt(0)==="$"&&!be(O3,e),M3=/^[A-Za-z0-9_-]{1,400}$/,k0=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,E0=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,L3=["token","distinct_id",eR],ja="posthog",N3=e=>{const t={};return e&&e!=="unset"&&("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0)),t},dh=e=>{var t;return S({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:xV(W?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:sc,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:st&&Pe(st?.search)&&st.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(L==null||(t=L.location)===null||t===void 0?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(r){X.error("Bad HTTP status: "+r.statusCode+" "+r.text)},get_device_id:r=>r,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:uR,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:sc},(r=>({rageclick:r&&r>="2026-05-30"?{content_ignorelist:qV,ignore_text_selection:!0}:!r||"2025-11-30">r||{content_ignorelist:!0},capture_pageview:!r||"2025-05-24">r||"history_change",session_recording:N3(r),external_scripts_inject_target:r&&r>="2026-01-30"?"head":"body",internal_or_test_user_hostname:r&&r>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:r&&r>="2026-05-30"?250:0,split_storage:!(!r||"2026-05-30">r),detect_google_search_app:!(!r||"2026-05-30">r),disable_capture_url_hashes:!(!r||"2026-06-25">r),cookieWinsOnConflict:!(!r||r==="unset"||"2026-08-29">r)}))(e))},$3=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],T0=e=>{const t={};for(const[n,i]of $3)j(e[n])||(t[i]=e[n]);const r=Xe({},t,e),s=e.__preview_external_dependency_versioned_paths;return j(s)||(j(e.strict_script_versioning)&&(r.strict_script_versioning=!!s),Pe(s)&&j(e.asset_host)&&(r.asset_host=s)),Se(e.property_blacklist)&&(j(e.property_denylist)?r.property_denylist=e.property_blacklist:Se(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:X.error(nC+e.property_denylist)),r},D3=class{constructor(){this.__forceAllowLocalhost=!1}get pu(){return this.__forceAllowLocalhost}set pu(e){X.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},nc=class un{gu(t){if(!t)return;const r=this.lu.indexOf(t);r!==-1&&this.lu.splice(r,1)}mu(t,r){var s;return this.gu(t),this.lu.push(r),(s=r.initialize)===null||s===void 0||s.call(r),r}yu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}bu(){if(this._u||this.config.reuseAnonymousId||this.config.segment||this.yu())return;const t=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!t&&!this.config.disable_persistence||this.wu)return;let r,s,n;t?(r=`persistence is set to '${this.config.persistence}'`,s=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",n="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(r="persistence is disabled (disable_persistence is true)",s="on every page load",n="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._u=!0,console.warn("[PostHog.js]",`${r} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${s}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${n}`)}ku(){if(this.yu()||this.get_distinct_id()!=="$posthog_cookieless")return;const t=this.persistence;if(!t)return;this.Su()||t.load(!0);const r=this.get_distinct_id();if(!r||r==="$posthog_cookieless"){const s=this.config.get_device_id(Yr());this.register({distinct_id:s,$device_id:s}),t.set_property(er,Hs)}this.xu()}get decideEndpointWasHit(){var t,r;return(t=(r=this.featureFlags)===null||r===void 0?void 0:r.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,r;return(t=(r=this.featureFlags)===null||r===void 0?void 0:r.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.Cu=!1,this.$u=!1,this.webPerformance=new D3,this.Tu=!1,this.version=gt.LIB_VERSION,this.Iu=new Set,this.Mu="",this.du=new $u,this.lu=[],this.Eu=[],this.Pu=!1,this.wu=!1,this._u=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=dh(),this.SentryIntegration=WV,this.sentryIntegration=s=>(function(n,i){const o=ER(n,i);return{name:kR,processEvent:a=>o(a)}})(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ru=!1,this.Au=null,this.Fu=null,this.Ou=null,this.scrollManager=new v3(this),this.pageViewManager=new i0(this),this.rateLimiter=new s3(this),this.requestRouter=new w3(this),this.consent=new UV(this),this.externalIntegrations=new I3(this);const r=(t=un.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=r.featureFlags&&new r.featureFlags(this),this.toolbar=r.toolbar&&new r.toolbar(this),this.surveys=r.surveys&&new r.surveys(this),this.conversations=r.conversations&&new r.conversations(this),this.logs=r.logs&&new r.logs(this),this.metrics=r.metrics&&new r.metrics(this),this.experiments=r.experiments&&new r.experiments(this),this.exceptions=r.exceptions&&new r.exceptions(this),this.people={set:(s,n,i)=>{const o=Pe(s)?{[s]:n}:s;this.setPersonProperties(o),i?.({})},set_once:(s,n,i)=>{const o=Pe(s)?{[s]:n}:s;this.setPersonProperties(void 0,o),i?.({})}},this.on("eventCaptured",s=>X.info(`send "${s?.event}"`,s))}init(t,r,s){if(s&&s!==ja){var n;const i=(n=rc[s])!==null&&n!==void 0?n:new un;return i._init(t,r,s),rc[s]=i,rc[ja][s]=i,i}return this._init(t,r,s)}_init(t,r={},s){var n,i,o;const a=Pe(t)?t.trim():"";if(!a)return X.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var c;if(this.__loaded)return a!==((c=this.config)===null||c===void 0?void 0:c.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=dh(r.defaults),r.debug=this.Du(r.debug),this.Lu=r,this.Nu=[],r.person_profiles?this.Fu=r.person_profiles:r.process_person&&(this.Fu=r.process_person);const l=dh(r.defaults),u=T0(r),p=Xe({},l,u,{name:s,token:a});Le(l.rageclick)&&Le(u.rageclick)&&(p.rageclick=Xe({},l.rageclick,u.rageclick)),Le(l.session_recording)&&Le(u.session_recording)&&(p.session_recording=Xe({},l.session_recording,u.session_recording)),this.set_config(p),this.config.on_xhr_error&&X.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:br.GZipJS;const d=this.Su();if(this.persistence=new rh(this.config,d),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new rh(S(S({},this.config),{},{persistence:"sessionStorage"}),d,!1),this.Mu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!d&&Je.Et()){const _=Je.Dt(this.Mu);Se(_)&&_.forEach(b=>{Pe(b)&&this.Iu.add(b)})}else Je.Lt(this.Mu);const h=S({},this.persistence.props),f=S({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qu=new f3((_,b)=>this.ju(_,b),this.config.request_queue_config),this.Bu=new g3(this),this.__request_queue=[];const m=this.yu();m||(this.sessionManager=new v0(this),this.sessionPropsManager=new m0(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((_,b,T)=>{(T!=null&&T.activityTimeout||T!=null&&T.sessionPastMaximumLength||T!=null&&T.crossTabAdoption)&&this.Hu()})),this.zu(),this.config.__preview_deferred_init_extensions?(X.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Uu(m)},0)):(X.info("Initializing extensions synchronously"),this.Uu(m)),gt.DEBUG=gt.DEBUG||this.config.debug,gt.DEBUG&&X.info("Starting in debug mode",{this:this,config:r,thisC:S({},this.config),p:h,s:f}),this.config.identity_distinct_id&&!((n=r.bootstrap)!==null&&n!==void 0&&n.distinctID)&&(r.bootstrap=S(S({},r.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const v=(i=r.bootstrap)===null||i===void 0?void 0:i.distinctID;if(this.wu=!!v&&!Wa(v),(o=r.bootstrap)===null||o===void 0?void 0:o.distinctID){const _=r.bootstrap.distinctID,b=this.get_distinct_id(),T=this.persistence.get_property(er);if(r.bootstrap.isIdentifiedID&&b!=null&&b!==_&&T==="anonymous")this.identify(_);else if(r.bootstrap.isIdentifiedID&&b!=null&&b!==_&&T==="identified")X.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const O=this.config.get_device_id(Yr()),x=r.bootstrap.isIdentifiedID?O:_;this.persistence.set_property(er,r.bootstrap.isIdentifiedID?Yl:Hs),this.register({distinct_id:_,$device_id:x})}}if(m)this.register_once({distinct_id:Kp,$device_id:null},"");else if(!this.get_distinct_id()){const _=this.config.get_device_id(Yr());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(er,Hs)}return ze(L,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),ze(L,"pageshow",()=>{var _;this.Cu=!1,this.$u||(_=this.Bu)===null||_===void 0||_.resume()}),r.segment?n0(this,()=>this.Wu()):this.Wu(),kt(this.config._onCapture)&&this.config._onCapture!==sc&&(X.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",_=>this.config._onCapture(_.event,_))),this.config.ip&&X.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return QR.apply(this,arguments)})().then(_=>{_&&this.register({[Wp]:_})}).catch(sc),this}Vu(t){const r=t;return Pe(r.name)&&kt(r.setup)}Gu(t,r){this.Vu(t)?r.push(()=>{this.Zu().add(t).catch(()=>{var s;return(s=t.dispose)===null||s===void 0?void 0:s.call(t)}).catch(s=>{X.error(`Failed to dispose browser extension "${t.name}"`,s)})}):this.lu.push(t)}zu(){var t,r,s;const n=(t=(r=this.config.__extensionClasses)===null||r===void 0?void 0:r.featureFlags)!==null&&t!==void 0?t:(s=un.__defaultExtensionClasses)===null||s===void 0?void 0:s.featureFlags;var i,o,a;n&&(this.featureFlags&&this.featureFlags instanceof n||((i=this.Qu)===null||i===void 0||i.call(this),this.Qu=void 0,this.featureFlags=new n(this)),kt(this.featureFlags.onReloading)&&kt(this.featureFlags.setup)?this.Qu||(this.Qu=this.featureFlags.onReloading(()=>{this.du.emit("featureFlagsReloading",!0)}),this.Zu().add(this.featureFlags)):(o=(a=this.featureFlags).initialize)===null||o===void 0||o.call(a))}Uu(t){const r=performance.now(),s=S(S({},un.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var i,o,a,c,l,u,p;s.exceptions&&this.lu.push(this.exceptions=(i=this.exceptions)!==null&&i!==void 0?i:new s.exceptions(this)),s.historyAutocapture&&this.lu.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this.lu.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this.lu.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!t&&this.lu.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this.Gu(this.autocapture=new s.autocapture(this),n),s.surveys&&this.Gu(this.surveys=(o=this.surveys)!==null&&o!==void 0?o:new s.surveys(this),n),s.logs&&this.Gu(this.logs=(a=this.logs)!==null&&a!==void 0?a:new s.logs(this),n),s.metrics&&this.lu.push(this.metrics=(c=this.metrics)!==null&&c!==void 0?c:new s.metrics(this)),s.conversations&&this.lu.push(this.conversations=(l=this.conversations)!==null&&l!==void 0?l:new s.conversations(this)),s.productTours&&this.lu.push(this.productTours=new s.productTours(this)),s.heatmaps&&this.lu.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this.lu.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this.lu.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this.lu.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,GV)),s.toolbar&&this.lu.push(this.toolbar=(u=this.toolbar)!==null&&u!==void 0?u:new s.toolbar(this)),s.experiments&&this.lu.push(this.experiments=(p=this.experiments)!==null&&p!==void 0?p:new s.experiments(this)),this.lu.forEach(d=>{d.initialize&&n.push(()=>{var h;(h=d.initialize)===null||h===void 0||h.call(d)})}),n.push(()=>{if(this.Ju){const d=this.Ju;this.Ju=void 0,this.lu.forEach(h=>{var f;return(f=h.onRemoteConfig)===null||f===void 0?void 0:f.call(h,d)})}}),this.Ku(n,r)}Ku(t,r){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-r>=30&&t.length>0)return void setTimeout(()=>{this.Ku(t,r)},0);const n=t.shift();if(n)try{n()}catch(i){X.error("Error initializing extension:",i)}}const s=Math.round(performance.now()-r);this.register_for_session({[tR]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[rR]:s}),this.config.__preview_deferred_init_extensions&&X.info(`PostHog extensions initialized (${s}ms)`)}el(t){var r;if(!W||!W.body)return X.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.el(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=t),this.cu=t,this.compression=void 0,t.ok){var s;const n=t.config;n.supportedCompression&&!this.config.disable_compression&&(this.compression=be(n.supportedCompression,br.GZipJS)?br.GZipJS:be(n.supportedCompression,br.Base64)?br.Base64:void 0),(s=n.analytics)!==null&&s!==void 0&&s.endpoint&&(this.analyticsDefaultEndpoint=n.analytics.endpoint)}this.set_config({person_profiles:this.Fu?this.Fu:uR}),(r=this.Xu)===null||r===void 0||r.handleRemoteConfig(t),this.lu.forEach(n=>{var i;return(i=n.onRemoteConfig)===null||i===void 0?void 0:i.call(n,t)})}Wu(){try{this.config.loaded(this)}catch(t){X.critical("`loaded` function failed",t)}if(this.Yu(),this.config.internal_or_test_user_hostname&&st?.hostname){const t=st.hostname,r=this.config.internal_or_test_user_hostname;(typeof r=="string"?t===r:r.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.yu())&&this.th()},1),this.eh=new $R(this),this.eh.load()}Yu(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.qu)===null||t===void 0||t.enable())}_dom_loaded(){this.is_capturing()&&vo(this.__request_queue,t=>this.ju(t)),this.__request_queue=[],this.Yu()}_handle_unload(){var t,r,s,n,i,o;this.Cu=!0,(t=this.surveys)===null||t===void 0||(r=t.handlePageUnload)===null||r===void 0||r.call(t),(s=this.metrics)===null||s===void 0||s.flush("sendBeacon"),this.config.request_batching?(this.ih()&&this.capture(jb),(n=this.logs)===null||n===void 0||n.flushLogs("sendBeacon"),(i=this.qu)===null||i===void 0||i.unload(),(o=this.Bu)===null||o===void 0||o.unload()):this.ih()&&this.capture(jb,null,{transport:"sendBeacon"})}_send_request(t){XR(this,t)}ju(t,r){this.Bu?this.Bu.retriableRequest(t,r):this._send_request(r?S(S({},t),{},{transport:r}):t)}_execute_array(t){uh++;try{let r;const s=[],n=[],i=[];vo(t,a=>{if(a)if(r=a[0],Se(r))i.push(a);else if(kt(a))try{a.call(this)}catch(c){X.error("Error executing queued PostHog call",a,c)}else Se(a)&&r==="alias"?s.push(a):Se(a)&&r.indexOf("capture")!==-1&&kt(this[r])?i.push(a):n.push(a)});const o=function(a,c){vo(a,function(l){try{if(Se(l[0])){let u=c;Be(l,function(p){u=u[p[0]].apply(u,p.slice(1))})}else c[l[0]].apply(c,l.slice(1))}catch(u){X.error("Error executing queued PostHog call",l,u)}})};o(s,this),o(n,this),o(i,this)}finally{uh--}}push(t){if(uh>0&&Se(t)&&Pe(t[0])){const r=un.prototype[t[0]];kt(r)&&r.apply(this,t.slice(1));return}this._execute_array([t])}get nh(){return{property:zb,persistenceKey:To,cookieName:"_fbc",pattern:k0,register:(t,r)=>{var s;return(s=this.persistence)===null||s===void 0?void 0:s.register({[To]:{value:t,delivered:r}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(To)}}}get sh(){return{property:Fb,persistenceKey:Ja,cookieName:"_fbp",pattern:E0,register:(t,r)=>{var s;return(s=this.persistence)===null||s===void 0?void 0:s.register({[Ja]:{value:t,delivered:r}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(Ja)}}}rh(t){var r;const s=(r=this.persistence)===null||r===void 0?void 0:r.get_property(t.persistenceKey);return Pe(s)&&t.pattern.test(s)?{value:s,delivered:!1}:Le(s)&&Pe(s.value)&&t.pattern.test(s.value)?{value:s.value,delivered:s.delivered===!0}:void 0}oh(t,r,s){return r===s?.value?{value:r,pending:!s.delivered}:(t.register(r,!1),{value:r,pending:!0})}ah(t){if(!this.config.save_campaign_params||this.yu())return;const r=Za(t.cookieName);return Pe(r)&&t.pattern.test(r)?r:void 0}uh(t,r,s,n){if(!this.persistence)return;const i=this.nh;this.persistence.refreshKey(i.persistenceKey);const o=this.rh(i);if(n)return void i.unregister();if(s)return Pe(r)&&k0.test(r)?this.oh(i,r,o):void i.unregister();const a=Pe(t)&&M3.test(t)?t:void 0,c=this.ah(i);return c&&((l,u,p)=>{const d=l.split(".");if(u)return d[3]===u;if(!p)return!0;const h=p.value.split(".");return d[3]===h[3]||Number(d[2])>Number(h[2])})(c,a,o)?this.oh(i,c,o):a?o?.value.split(".")[3]===a?{value:o.value,pending:!o.delivered}:this.oh(i,`fb.1.${Date.now()}.${a}`,o):o?{value:o.value,pending:!o.delivered}:void 0}hh(t,r,s){if(!this.persistence)return;const n=this.sh;this.persistence.refreshKey(n.persistenceKey);const i=this.rh(n);if(s)return void n.unregister();if(r)return Pe(t)&&E0.test(t)?this.oh(n,t,i):void n.unregister();const o=this.ah(n);return o?this.oh(n,o,i):i?{value:i.value,pending:!i.delivered}:void 0}dh(t,r){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);const s=this.rh(t);s?.value!==r||s.delivered||t.register(r,!0)}capture(t,r,s){var n,i;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qu))return void X.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(j(t)||!Pe(t))return void X.error("No event name provided to posthog.capture");this.ku();const o=!this.config.opt_out_useragent_filter&&this._is_bot();if(o&&!this.config.__preview_capture_bot_pageviews)return;const a=s?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a?.isRateLimited)return void X.critical("This capture call is ignored due to client rate limiting.");let c;r!=null&&r.$current_url&&!Pe(r?.$current_url)&&(X.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),r==null||delete r.$current_url),t!=="$exception"||s!=null&&s.fh||X.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(c=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const l=new Date,u=s?.timestamp||l,p=Eb(s?.uuid,Yr);let d={uuid:p,event:t,properties:this.calculateEventProperties(t,r||{},u,p)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&o&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),a&&(d.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens);const h=t==="$feature_flag_called"&&d.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;s!=null&&s.$set&&!h&&(d.$set=s?.$set);const f=Le(r?.$set)?r.$set:void 0,m=Se(r?.$unset)?r.$unset:[],v=s?.$unset||[],_=Y=>{var me;const $=!!s?.$set&&Y in s.$set;return{hasProvided:$||!!f&&Y in f,provided:$?s==null||(me=s.$set)===null||me===void 0?void 0:me[Y]:f?.[Y],unset:m.indexOf(Y)!==-1||v.indexOf(Y)!==-1}},b=_(zb),T=_(Fb),O=[{channel:this.nh,hasProvided:b.hasProvided,update:this.uh(c?.fbclid,b.provided,b.hasProvided,b.unset)},{channel:this.sh,hasProvided:T.hasProvided,update:this.hh(T.provided,T.hasProvided,T.unset)}];for(const{channel:Y,hasProvided:me,update:$}of O)$&&d.properties.$process_person_profile===!0&&$.pending&&!me&&!h&&(d.$set=S({[Y.property]:$.value},d.$set));const x=s?.$unset;x&&(d.$unset=x);const D=h?void 0:this.ph(s?.$set_once,t!==Hb,t===dR);if(D&&(d.$set_once=D),s!=null&&s._noTruncate||(z=this.config.properties_string_max_length,d=(function(Y,me){const $=new Set;return(function le(y,Q){if(y!==Object(y))return me?me(y):y;if($.has(y))return;let ne;if($.add(y),Se(y))ne=[],vo(y,H=>{ne.push(le(H))});else{const H={};Be(ta(y)?pR(y):y,(I,ee)=>{$.has(I)||(H[ee]=le(I,ee))}),ne=H}return ne})(Y)})(d,Y=>Pe(Y)?Y.slice(0,z):Y)),d.timestamp=u,j(s?.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=l),h&&(d.properties=((Y,me=[])=>{const $={},le=y=>{Y[y]!==void 0&&($[y]=Y[y])};return XB.forEach(le),me.forEach(le),$})(d.properties,L3)),t===_r.DISMISSED||t===_r.SENT){const Y=r?.[nh.SURVEY_ID],me=r?.[nh.SURVEY_ITERATION];sC({id:Y,current_iteration:me}),d.$set=S(S({},d.$set),{},{[y3({id:Y,current_iteration:me},t===_r.SENT?"responded":"dismissed")]:!0})}else t===_r.SHOWN&&(d.$set=S(S({},d.$set),{},{[nh.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var z;if(t===r3.SHOWN){const Y=r?.[c0.TOUR_TYPE];Y&&(d.$set=S(S({},d.$set),{},{[`${c0.TOUR_LAST_SEEN_DATE}/${Y}`]:new Date().toISOString()}))}const F=S(S({},d.properties.$set),d.$set);if(dr(F)||this.setPersonPropertiesForFlags(F),!Te(this.config.before_send)){const Y=this.Os(d);if(!Y)return;d=Y,d.uuid=Eb(d.uuid,Yr)}this.sessionRecording&&!this.Pu&&w0(t)&&(this.Pu=!0,setTimeout(()=>this.Pu=!1,3e4));const J=O.filter(({channel:Y,update:me})=>{var $,le,y;const Q=($=(le=d.$set)===null||le===void 0?void 0:le[Y.property])!==null&&$!==void 0?$:Le((y=d.properties)===null||y===void 0?void 0:y.$set)?d.properties.$set[Y.property]:void 0;return me?.pending&&Q===me.value});this.du.emit("eventCaptured",d);const ce=(n=s?._url)!==null&&n!==void 0?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),de=s?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(ce),R=S(S(S({method:"POST",url:ce,data:d,compression:"best-available",preferSyncCompression:s?.send_instantly,timestampMode:de?"body":"capture-body",batchKey:s?._batchKey},de&&(!((i=d.properties)===null||i===void 0)&&i.$session_id)?{batchGroup:d.properties.$session_id+(d.properties.$window_id?`-${d.properties.$window_id}`:"")}:{}),s?.transport?{transport:s.transport}:{}),J.length?{fireCallbackOnDrop:!0,callback:Y=>{if(Y.statusCode>=200&&300>Y.statusCode)for(const{channel:me,update:$}of J)this.dh(me,$.value)}}:{});if(!this.config.request_batching||s&&!s?._batchKey||s?.send_instantly||J.length){var fe;let Y;!R.transport&&!R.callback&&dr((fe=this.config.request_headers)!==null&&fe!==void 0?fe:{})&&this.Cu&&(Y="sendBeacon"),this.ju(R,Y)}else this.qu.enqueue(R);return d}_addCaptureHook(t){return this.on("eventCaptured",r=>t(r.event,r))}getExtension(t){var r;return(r=this.Xu)===null||r===void 0?void 0:r.getExtension(t)}Zu(){var t;return(t=this.Xu)!==null&&t!==void 0?t:this.Xu=new P3(this)}fu(t){this.Eu.push(t);let r=!0;return()=>{if(!r)return;r=!1;const s=this.Eu.indexOf(t);s!==-1&&this.Eu.splice(s,1)}}gh(t=!0){var r,s,n;return!!(!((r=this.persistence)===null||r===void 0)&&r.consumeCookieIdentityChange())&&(this.Ou=null,this.persistence.get_property("$user_state")==="anonymous"&&((n=this.sessionPersistence)===null||n===void 0||n.clear(),this.Iu.clear(),this.mh()),(s=this.featureFlags)===null||s===void 0||s.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,r,s,n,i){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return r;this.persistence.syncCookieProperties(),this.gh();const o=i?void 0:this.persistence.remove_event_timer(t);let a=S({},r);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.yu()&&(a[eR]=!0),t==="$snapshot"){const b=S(S({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=b.distinct_id,(!Pe(a.distinct_id)&&!lt(a.distinct_id)||Wa(a.distinct_id))&&X.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}const c=(function(b,T,O,x=!1){var D,z,F,J;if(!Zt)return{};const ce=b?[...Fo,...T||[]]:[],[de,R]=bI(Zt),[fe,Y]=(function(oe){for(let he=0;kb.length>he;he++){const[ue,Ge,Ve]=kb[he],Ce=oe.match(ue);if(Ce){const B=Ve&&oe.match(Ve)||Ce;return[Ge,B?.[1]||""]}}return["",""]})(Zt),me=(function(){const oe="u">typeof navigator?navigator:void 0;return oe?.brave?{brave:!0}:{}})(),$={};j(O)||($.detectGoogleSearchApp=O);const le={},y=(D=navigator)===null||D===void 0||(D=D.userAgentData)===null||D===void 0?void 0:D.platform,Q=(z=navigator)===null||z===void 0?void 0:z.maxTouchPoints,ne=L==null||(F=L.screen)===null||F===void 0?void 0:F.width,H=L==null||(J=L.screen)===null||J===void 0?void 0:J.height,I=L?.devicePixelRatio;j(y)||(le.userAgentDataPlatform=y),j(Q)||(le.maxTouchPoints=Q),j(ne)||(le.screenWidth=ne),j(H)||(le.screenHeight=H),j(I)||(le.devicePixelRatio=I);const ee=Xe(Ev({$os:de,$os_version:R,$browser:yI(Zt,navigator.vendor,me,$),$webview_app:fe,$webview_app_version:Y,$device:SI(Zt),$device_type:yB(Zt,le),$timezone:LR(),$timezone_offset:QV()}),{$current_url:Sc(x?qn(st?.href):st?.href,ce,wc),$host:st?.host,$pathname:st?.pathname,$raw_user_agent:Zt.length>1e3?Zt.substring(0,997)+"...":Zt,$browser_version:_B(Zt,navigator.vendor,me,$),$browser_language:PR(),$browser_language_prefix:ZV(),$screen_height:L?.screen.height,$screen_width:L?.screen.width,$viewport_height:L?.innerHeight,$viewport_width:L?.innerWidth,$lib:Bs.LIB_NAME,$lib_version:Bs.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Bs.SDK_DIST_CHANNEL&&(ee.$sdk_dist_channel=Bs.SDK_DIST_CHANNEL),ee})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:b,windowId:T}=this.sessionManager.checkAndGetSessionAndWindowId(i,s.getTime(),!0);a.$session_id=b,a.$window_id=T}this.sessionPropsManager&&Xe(a,this.sessionPropsManager.getSessionProps());try{var l;if(this.sessionRecording){const b=this.sessionRecording.sdkDebugProperties,T=!this.Pu&&w0(t);for(const O in b)(T||be(x3,O))&&(a[O]=b[O])}a.$sdk_debug_retry_queue_size=(l=this.Bu)===null||l===void 0?void 0:l.length}catch(b){a.$sdk_debug_error_capturing_properties=String(b)}let u;if(this.requestRouter.region===cm&&(a.$lib_custom_api_host=this.config.api_host),u=t!=="$pageview"||i?t!=="$pageleave"||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,n),a=Xe(a,u),t==="$pageview"&&W&&(a.title=W.title),!j(o)){const b=s.getTime()-o;a.$duration=parseFloat((b/1e3).toFixed(3))}Zt&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");const p=this.persistence.properties(),d=this.sessionPersistence.properties(),h=a.$groups,f=p.$groups;Le(h)&&!dr(h)&&(a.$groups=S(S({},Le(f)?f:{}),h)),Be(["$referrer","$referring_domain"],b=>{b in p&&delete d[b]});const m={};if(this.Eu.length>0)for(const b of this.Eu.slice())try{Xe(m,b())}catch(T){X.error("Failed to produce browser extension event properties",T)}a=Xe({},c,p,d,S(S({},m),a)),a.$is_identified=this._isIdentified(),Se(this.config.property_denylist)?Be(this.config.property_denylist,function(b){delete a[b]}):X.error(nC+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const v=this.config.sanitize_properties;v&&(X.error(S0),a=v(a,t));const _=this.yh();return a.$process_person_profile=_,_&&!i&&this.bh("_calculate_event_properties"),a}ph(t,r=!0,s=!1){var n;if(!this.persistence||!this.yh()||this.Tu&&!s)return t;const i=this.persistence.get_initial_props(),o=(n=this.sessionPropsManager)===null||n===void 0?void 0:n.getSetOnceProps();let a=Xe({},i,o||{},t||{});const c=this.config.sanitize_properties;return c&&(X.error(S0),a=c(a,"$set_once")),r&&(this.Tu=!0),dr(a)?void 0:a}register(t,r){var s;(s=this.persistence)===null||s===void 0||s.register(t,r)}register_once(t,r,s){var n;(n=this.persistence)===null||n===void 0||n.register_once(t,r,s)}register_for_session(t){var r,s;(r=this.persistence)===null||r===void 0||r.syncCookieProperties(),this.gh(),(s=this.sessionPersistence)===null||s===void 0||s.register(t),Object.keys(t).forEach(n=>this.Iu.add(n)),this.mh()}unregister(t){var r;(r=this.persistence)===null||r===void 0||r.unregister(t)}unregister_for_session(t){var r;(r=this.sessionPersistence)===null||r===void 0||r.unregister(t),this.Iu.delete(t),this.mh()}_h(t,r){this.register({[t]:r})}Hu(){this.Iu.forEach(t=>{var r;(r=this.sessionPersistence)===null||r===void 0||r.unregister(t)}),this.Iu.clear(),this.mh()}mh(){var t;if(!this.Mu)return;if(this.config.persistence==="memory"||!((t=this.sessionPersistence)===null||t===void 0)&&t.hi||!Je.Et())return void Je.Lt(this.Mu);const r=[];this.Iu.forEach(s=>r.push(s)),r.length>0?Je.$t(this.Mu,r):Je.Lt(this.Mu)}getFeatureFlag(t,r){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getFeatureFlag(t,r)}getFeatureFlagPayload(t){var r;return(r=this.featureFlags)===null||r===void 0?void 0:r.getFeatureFlagPayload(t)}getFeatureFlagResult(t,r){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getFeatureFlagResult(t,r)}getAllFeatureFlags(){var t,r;return(t=(r=this.featureFlags)===null||r===void 0?void 0:r.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,r){var s,n;return(s=(n=this.featureFlags)===null||n===void 0?void 0:n.isFeatureEnabled(t,r))!==null&&s!==void 0?s:r?.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)===null||t===void 0||t.reloadFeatureFlags()}updateFlags(t,r,s){var n;(n=this.featureFlags)===null||n===void 0||n.updateFlags(t,r,s)}updateEarlyAccessFeatureEnrollment(t,r,s){var n;(n=this.featureFlags)===null||n===void 0||n.updateEarlyAccessFeatureEnrollment(t,r,s)}getEarlyAccessFeatures(t,r=!1,s){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getEarlyAccessFeatures(t,r,s)}on(t,r){return this.du.on(t,r)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Zi}),()=>{})}onSessionId(t){var r,s;return(r=(s=this.sessionManager)===null||s===void 0?void 0:s.onSessionId(t))!==null&&r!==void 0?r:()=>{}}getSurveys(t,r=!1){this.surveys?this.surveys.getSurveys(t,r):t([],{isLoaded:!1,error:Zi})}getActiveMatchingSurveys(t,r=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,r):t([],{isLoaded:!1,error:Zi})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:Zi}),()=>{})}renderSurvey(t,r){var s;(s=this.surveys)===null||s===void 0||s.renderSurvey(t,r)}displaySurvey(t,r=E3){var s;(s=this.surveys)===null||s===void 0||s.displaySurvey(t,r)}cancelPendingSurvey(t){var r;(r=this.surveys)===null||r===void 0||r.cancelPendingSurvey(t)}canRenderSurvey(t){var r,s;return(r=(s=this.surveys)===null||s===void 0?void 0:s.canRenderSurvey(t))!==null&&r!==void 0?r:{visible:!1,disabledReason:Zi}}canRenderSurveyAsync(t,r=!1){var s,n;return(s=(n=this.surveys)===null||n===void 0?void 0:n.canRenderSurveyAsync(t,r))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:Zi})}wh(t){return!t||Wa(t)?(X.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?(X.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(X.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(t,r,s){if(!this.__loaded||!this.persistence)return X.uninitializedWarning("posthog.identify");if(lt(t)&&(t=t.toString(),X.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.wh(t)||!this.bh("posthog.identify"))return;this.ku();const n=this.get_distinct_id(),i=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,o=this.gh(!1),a=this.persistence.Oa();let c=!1;try{const u=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),t!==u&&t!==this.get_property("__alias")&&(this.unregister(Cu),this.register({distinct_id:t}));const p=(this.persistence.get_property("$user_state")||"anonymous")===Hs,d=t!==u,h=!d&&p;if(d&&p){var l;const f=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:u};this.persistence.set_property(er,Yl),this.setPersonPropertiesForFlags({$set:r||{},$set_once:s||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$identify",f,{$set:r||{},$set_once:s||{}})&&(this.Ou=lh(t,r,s)),(l=this.featureFlags)===null||l===void 0||l.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:u)}else if(h){this.persistence.set_property(er,Yl);const f=r||{},m=s||{};this.setPersonPropertiesForFlags({$set:f,$set_once:m},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$set",{$set:f,$set_once:m})&&(this.Ou=lh(t,r,s))}else(r||s)&&this.setPersonProperties(r,s);d||i||o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(En)):h&&(r||s)&&this.reloadFeatureFlags(),c=!0}finally{a&&this.persistence.qa(c)}}setPersonProperties(t,r){if(!t&&!r||!this.bh("posthog.setPersonProperties"))return;const s=lh(this.get_distinct_id(),t,r);this.Ou!==s?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:r||{}},!0),this.capture("$set",{$set:t||{},$set_once:r||{}})&&(this.Ou=s)):X.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var r;const s=(Se(t)?t:[t]).filter(n=>Pe(n)&&n.length>0);s.length!==0&&this.bh("posthog.unsetPersonProperties")&&((r=this.featureFlags)===null||r===void 0||r.unsetPersonPropertiesForFlags(s,!0),this.capture("$set",{$unset:s}),this.Ou=null)}group(t,r,s){var n;if(!t||!r)return void X.error("posthog.group requires a group type and group key");(n=this.persistence)===null||n===void 0||n.syncCookieProperties(),this.gh();const i=this.getGroups(),o=i[t]!==r;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:S(S({},i),{},{[t]:r})}),(o||s)&&this.yh()){const a={$group_type:t,$group_key:r};s&&(a.$group_set=s),this.capture(Hb,a)}s&&this.setGroupPropertiesForFlags({[t]:s}),o&&!s&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,r=!0){var s;(s=this.featureFlags)===null||s===void 0||s.setPersonPropertiesForFlags(t,r)}resetPersonPropertiesForFlags(t=!0){var r;(r=this.featureFlags)===null||r===void 0||r.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,r=!0){var s;this.bh("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)===null||s===void 0||s.setGroupPropertiesForFlags(t,r))}resetGroupPropertiesForFlags(t){var r;(r=this.featureFlags)===null||r===void 0||r.resetGroupPropertiesForFlags(t)}reset(t){const r=tr(t)?t:t?.resetDeviceID,s=tr(t)||t==null?void 0:t.bootstrap;this.kh(r,!1,s)}kh(t,r=!1,s){var n,i,o,a,c,l;if(X.info("reset"),!this.__loaded)return X.uninitializedWarning("posthog.reset");const u=s?.sessionID;this.config.bootstrap=s||((n=this.Lu)===null||n===void 0?void 0:n.bootstrap)||{},(i=this.featureFlags)===null||i===void 0||(o=i.updateConfig)===null||o===void 0||o.call(i,this.config,this.il());const p=this.get_property(gv),d=this.get_property(Wp),h=this.get_property(Ya);(a=this.sessionRecording)===null||a===void 0||a.flushBeforeIdentityReset();const f=this.is_capturing();this.consent.reset(),r||!f||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const m=(c=this.persistence)===null||c===void 0||(l=c.Oa)===null||l===void 0?void 0:l.call(c);let v=!1;try{var _,b,T,O,x,D,z,F,J,ce,de,R,fe;if((_=this.persistence)===null||_===void 0||_.clear(),(b=this.sessionPersistence)===null||b===void 0||b.clear(),this.Iu.clear(),this.mh(),j(h)||(ce=this.persistence)===null||ce===void 0||ce.register({$session_recording_remote_config:h}),(T=this.surveys)===null||T===void 0||T.reset(),(O=this.featureFlags)===null||O===void 0||O.reset(),(x=this.conversations)===null||x===void 0||x.reset(),(D=this.logs)===null||D===void 0||D.reset(),(z=this.metrics)===null||z===void 0||z.reset(),(F=this.persistence)===null||F===void 0||F.set_property("$user_state","anonymous"),(J=this.sessionManager)===null||J===void 0||J.resetSessionId(),this.Ou=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Kp,$device_id:null},"");else{const $=this.config.get_device_id(Yr());this.register_once({distinct_id:$,$device_id:t?$:p},""),t||j(d)||this.register({[Wp]:d})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),s&&(s.distinctID&&!this.yu()&&((fe=this.persistence)===null||fe===void 0||fe.set_property("$user_state",s.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:s.distinctID})),(de=this.featureFlags)===null||de===void 0||de.initialize(),!Te(u)&&!(!((R=this.sessionManager)===null||R===void 0)&&R.setBootstrapSessionId(u,!0)))){const $=S({},s);delete $.sessionID,this.config.bootstrap=$}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,v=!0}finally{var Y,me;m&&((Y=this.persistence)===null||Y===void 0||(me=Y.qa)===null||me===void 0||me.call(Y,v))}this.reloadFeatureFlags()}shutdown(t){var r=this;return Ze(function*(){var s,n,i,o,a,c,l,u;if(r.__loaded){r.$u=!0,r.Zu().dispose(),(s=r.sessionRecording)===null||s===void 0||s.dispose(),(n=r.logs)===null||n===void 0||n.flushLogs("sendBeacon"),(i=r.metrics)===null||i===void 0||i.flush("sendBeacon"),(o=r.metrics)===null||o===void 0||o.dispose(),(a=r.qu)===null||a===void 0||a.unload(),(c=r.Bu)===null||c===void 0||c.unload();try{var p;(p=r.featureFlags)===null||p===void 0||p.destroy()}catch(d){X.error("Error while destroying feature flags",d)}(l=r.persistence)===null||l===void 0||l.destroy(),(u=r.sessionPersistence)===null||u===void 0||u.destroy()}else X.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,r){var s;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=r,this.alias(t),(s=this.conversations)===null||s===void 0||s.Sh()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(t=this.conversations)===null||t===void 0||t.xh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,r;return(t=(r=this.sessionManager)===null||r===void 0?void 0:r.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:r,sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let n=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${r}`);if(t?.withTimestamp&&s){var i;const o=(i=t.timestampLookBack)!==null&&i!==void 0?i:10;if(!s)return n;n+=`?t=${Math.max(Math.floor((new Date().getTime()-s)/1e3)-o,0)}`}return n}alias(t,r){return t===this.get_property("$people_distinct_id")?(X.critical("Attempting to create alias for existing People user - aborting."),-2):this.bh("posthog.alias")?(j(r)&&(r=this.get_distinct_id()),t!==r?(this._h(Cu,t),this.capture("$create_alias",{alias:t,distinct_id:r})):(X.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const r=S({},this.config);if(Le(t)){var s,n,i,o,a,c,l,u,p,d,h,f,m,v;Xe(this.config,T0(t));const b=this.Su();(s=this.persistence)===null||s===void 0||s.update_config(this.config,r,b),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new rh(S(S({},this.config),{},{persistence:"sessionStorage"}),b,!1);const T=this.Du(this.config.debug);var _;tr(T)&&(this.config.debug=T),tr(this.config.debug)&&(this.config.debug?(gt.DEBUG=!0,De.Et()&&De.$t("ph_debug",!0),X.info("set_config",{config:t,oldConfig:r,newConfig:S({},this.config)})):(gt.DEBUG=!1,De.Et()&&De.Lt("ph_debug"))),(n=this.featureFlags)===null||n===void 0||(i=n.updateConfig)===null||i===void 0||i.call(n,this.config,this.il()),(o=this.exceptionObserver)===null||o===void 0||o.onConfigChange(),(a=this.exceptions)===null||a===void 0||a.onConfigChange(),(c=this.metrics)===null||c===void 0||c.onConfigChange(),(l=this.sessionRecording)===null||l===void 0||l.startIfEnabledOrStop(),(u=this.tracingHeaders)===null||u===void 0||u.startIfEnabledOrStop(),(p=this.autocapture)===null||p===void 0||p.startIfEnabled(),(d=this.heatmaps)===null||d===void 0||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((_=this.historyAutocapture)===null||_===void 0||_.startIfEnabledOrStop()),(h=this.exceptionObserver)===null||h===void 0||h.startIfEnabledOrStop(),(f=this.deadClicksAutocapture)===null||f===void 0||f.startIfEnabledOrStop(),(m=this.surveys)===null||m===void 0||m.loadIfEnabled(),this.xu(),(v=this.externalIntegrations)===null||v===void 0||v.startIfEnabledOrStop(),!r.segment&&this.config.segment&&this.persistence&&n0(this,sc,!1)}}_overrideSDKInfo(t,r){gt.LIB_NAME=t,gt.LIB_VERSION=r}startSessionRecording(t){const r=t===!0,s={sampling:r||!!t?.sampling,linked_flag:r||!!t?.linked_flag,url_trigger:r||!!t?.url_trigger,event_trigger:r||!!t?.event_trigger};var n,i,o,a,c;Object.values(s).some(Boolean)&&((n=this.sessionManager)===null||n===void 0||n.checkAndGetSessionAndWindowId(),s.sampling&&((i=this.sessionRecording)===null||i===void 0||i.overrideSampling()),s.linked_flag&&((o=this.sessionRecording)===null||o===void 0||o.overrideLinkedFlag()),s.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),s.event_trigger&&((c=this.sessionRecording)===null||c===void 0||c.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!!(!((t=this.sessionRecording)===null||t===void 0)&&t.started)}captureException(t,r){try{if(!this.exceptions)return;const s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(S(S({},s),r))}catch{return}}addExceptionStep(t,r){var s;(s=this.exceptions)===null||s===void 0||s.addExceptionStep(t,r)}captureLog(t){var r;(r=this.logs)===null||r===void 0||r.captureLog(t)}get logger(){var t,r;return(t=(r=this.logs)===null||r===void 0?void 0:r.logger)!==null&&t!==void 0?t:un.Ch}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var r,s;return(r=(s=this.toolbar)===null||s===void 0?void 0:s.loadToolbar(t))!==null&&r!==void 0&&r}get_property(t){var r;return(r=this.persistence)===null||r===void 0?void 0:r.props[t]}getSessionProperty(t){var r;return(r=this.sessionPersistence)===null||r===void 0?void 0:r.props[t]}toString(){var t;let r=(t=this.config.name)!==null&&t!==void 0?t:ja;return r!==ja&&(r="posthog."+r),r}_isIdentified(){var t,r;return((t=this.persistence)===null||t===void 0?void 0:t.get_property("$user_state"))==="identified"||((r=this.sessionPersistence)===null||r===void 0?void 0:r.get_property("$user_state"))==="identified"}yh(){var t,r;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&dr(this.getGroups())&&!(!((t=this.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t.__alias)&&!(!((r=this.persistence)===null||r===void 0||(r=r.props)===null||r===void 0)&&r.$epp))}ih(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.yh()||this.bh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bh(t){return this.config.person_profiles==="never"?(X.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.bu(),this._h(yv,!0),!0)}Su(){if(this.config.cookieless_mode==="always")return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}xu(){var t,r;const s=this.Su();var n,i,o;return this.is_capturing()||(n=this.logs)===null||n===void 0||n.$h(),((t=this.persistence)===null||t===void 0?void 0:t.hi)!==s&&((i=this.persistence)===null||i===void 0||i.set_disabled(s)),((r=this.sessionPersistence)===null||r===void 0?void 0:r.hi)!==s&&((o=this.sessionPersistence)===null||o===void 0||o.set_disabled(s)),s&&(this.Iu.clear(),this.mh()),s}opt_in_capturing(t){var r;if(this.config.cookieless_mode!=="always"){if(this.yu()){var s,n,i,o,a,c;(s=this.sessionRecording)===null||s===void 0||s.dispose({discardBufferedEvents:!0}),this.kh(!0,!0),(n=this.sessionManager)===null||n===void 0||n.destroy(),(i=this.pageViewManager)===null||i===void 0||i.destroy(),this.sessionManager=new v0(this),this.pageViewManager=new i0(this),this.persistence&&(this.sessionPropsManager=new m0(this,this.sessionManager,this.persistence));const h=(o=(a=this.config.__extensionClasses)===null||a===void 0?void 0:a.sessionRecording)!==null&&o!==void 0?o:(c=un.__defaultExtensionClasses)===null||c===void 0?void 0:c.sessionRecording;var l,u;h&&(this.sessionRecording=this.mu(this.sessionRecording,new h(this)),this.cu&&((l=this.sessionRecording)===null||l===void 0||(u=l.onRemoteConfig)===null||u===void 0||u.call(l,this.cu)))}var p,d;this.consent.optInOut(!0),this.xu(),this.Yu(),(r=this.sessionRecording)===null||r===void 0||r.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((p=this.surveys)===null||p===void 0||p.loadIfEnabled()),(j(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture((d=t?.captureEventName)!==null&&d!==void 0?d:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.th()}else X.warn(b0)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void X.warn(b0);const t=this.config.cookieless_mode==="on_reject"?this.sessionRecording:void 0;var r,s;t?.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.kh(!0,!0),this.consent.optInOut(!1),this.xu(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:Kp,$device_id:null}),this.gu(t),this.sessionRecording=void 0,(r=this.sessionManager)===null||r===void 0||r.destroy(),(s=this.pageViewManager)===null||s===void 0||s.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.th(),this.Yu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.xu()}_is_bot(){return Tt?ZR(Tt,this.config.custom_blocked_useragents):void 0}th(){W&&(W.visibilityState==="visible"?this.Ru||(this.Ru=!0,this.capture(kv,{title:W.title},{send_instantly:!0}),this.Au&&(W.removeEventListener(_c,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),ze(W,_c,this.Au)))}debug(t){t===!1?(L?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(L?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}il(){const t=this.Lu||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(X.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(r,s,n,i,o){const a=s in r&&!Te(r[s]),c=n in r&&!Te(r[n]);return a?r[s]:!!c&&(o&&o.warn(`Config field '${n}' is deprecated. Please use '${s}' instead. The old field will be removed in a future major version.`),r[n])})(t,"advanced_disable_flags","advanced_disable_decide",0,X)}Os(t){var r;if(Te(this.config.before_send))return t;const s=Object.keys((r=t.properties)!==null&&r!==void 0?r:{}).filter(aB),n=Se(this.config.before_send)?this.config.before_send:[this.config.before_send];let i=t;for(const o of n)try{if(i=o(i),Te(i)){const a=`Event '${t.event}' was rejected in beforeSend function`;return oB(t.event)?X.warn(`${a}. This can cause unexpected behavior.`):X.info(a),null}i.properties&&!dr(i.properties)||X.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return X.error(`Error in beforeSend function for event '${t.event}':`,a),null}for(const o of s)if(i.properties&&Te(i.properties[o]))return X.warn(`Event '${t.event}' had its '${o}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return i}getPageViewId(){var t;return(t=this.pageViewManager.Wo)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,r){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:r})}captureTraceMetric(t,r,s){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:r,$ai_metric_value:String(s)})}Du(t){const r=tr(t)&&!t,s=De.Et()&&De.Ot("ph_debug")==="true";return!r&&(!!s||t)}};nc.__defaultExtensionClasses={},nc.Ch=(()=>{const e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(let r=0;t.length>r;r++)e.prototype[t[r]]=CV(e.prototype[t[r]])})(nc,["identify"]);var iC=class{constructor(e){this.disabled=e===!1;const t=Le(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,r){if(this.disabled)return!1;const s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>r-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}},ph="$copy_autocapture",hh=ot("[AutoCapture]");function fh(e,t){return t.length>e?t.slice(0,e)+"...":t}function U3(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!As(t));return t}function q3(e,{e:t,maskAllElementAttributes:r,maskAllText:s,elementAttributeIgnoreList:n,elementsChainAsString:i,disableCaptureUrlHashes:o}){var a,c;if(!As(e))return{props:{}};const l=[e],u=new Set([e]);let p=e;for(;p.parentNode&&!Ft(p,"body")&&1e3>l.length;){if(Tv(p.parentNode)){const D=p.parentNode.host;if(u.has(D))break;u.add(D),l.push(D),p=D;continue}if(!As(p.parentNode)||u.has(p.parentNode))break;u.add(p.parentNode),l.push(p.parentNode),p=p.parentNode}const d=t.type==="click"&&e.namespaceURI==="http://www.w3.org/2000/svg"?l.findIndex(D=>Ft(D,"button")||Ft(D,"a")):-1;d>0&&(s=s||l.slice(0,d+1).some(D=>!Ao(D)||bc(D)));const h=[],f={};let m,v=!1,_=!1;if(Be(l,D=>{const z=Ao(D);if(Ft(D,"a")&&!r&&!n?.includes("href")){const F=D.getAttribute("href");v=!!(z&&F&&ec(F))&&(o?qn(F):F)}be(qo(D),"ph-no-capture")&&(_=!0),h.push((function(F,J,ce,de,R=!1){const fe=F.tagName.toLowerCase(),Y={tag_name:fe};Iv.indexOf(fe)>-1&&!ce&&(Y.$el_text=fe.toLowerCase()==="a"||fe.toLowerCase()==="button"?fh(1024,t0(F)):fh(1024,yc(F)));const me=qo(F);J||de!=null&&de.includes("class")||0>=me.length||(Y.classes=me.filter(function(Q){return Q!==""})),Be(F.attributes,function(Q){var ne;if((!bc(F)||["name","id","class","aria-label"].indexOf(Q.name)!==-1)&&!de?.includes(Q.name)&&!J&&ec(Q.value)&&(!Pe(ne=Q.name)||ne.substring(0,10)!=="_ngcontent"&&ne.substring(0,7)!=="_nghost")){let H=Q.value;Q.name==="class"&&(H=Av(H).join(" ")),Y["attr__"+Q.name]=fh(1024,Q.name==="href"&&R?qn(H):H)}});let $=1,le=1,y=F;for(;y=U3(y);)$++,y.tagName===F.tagName&&le++;return Y.nth_child=$,Y.nth_of_type=le,Y})(D,r,s,n,o)),Be((function(F){if(!Ao(F))return{};const J={};return Be(F.attributes,function(ce){if(ce.name&&ce.name.indexOf("data-ph-capture-attribute")===0){const de=ce.name.replace("data-ph-capture-attribute-",""),R=ce.value;de&&R&&ec(R)&&(J[de]=R)}}),J})(D),(F,J)=>{({}).hasOwnProperty.call(f,J)||(f[J]=F)})}),_)return{props:{},explicitNoCapture:_};if(d>0&&(e=l[d],h.splice(0,d)),s||(h[0].$el_text=Ft(e,"a")||Ft(e,"button")?t0(e):yc(e)),v){var b,T;h[0].attr__href=v;const D=(b=Zs(v))===null||b===void 0?void 0:b.host,z=L==null||(T=L.location)===null||T===void 0?void 0:T.host;D&&z&&D!==z&&(m=v)}return{props:Xe((x=t.type,{$event_type:x,$ce_version:1}),i?{}:{$elements:h},{$elements_chain:(O=h,Se(O)?(function(D){return D.map(z=>{var F,J;let ce="";if(z.tag_name&&(ce+=z.tag_name),z.attr_class){z.attr_class.sort();for(const fe of z.attr_class)ce+=`.${fe.replace(/"/g,"")}`}const de=S(S(S(S({},z.text?{text:z.text}:{}),{},{"nth-child":(F=z.nth_child)!==null&&F!==void 0?F:0,"nth-of-type":(J=z.nth_of_type)!==null&&J!==void 0?J:0},z.href?{href:z.href}:{}),z.attr_id?{attr_id:z.attr_id}:{}),z.attributes),R={};return Xl(de).sort(([fe],[Y])=>(function(me,$){return $>me?-1:me>$?1:0})(fe,Y)).forEach(([fe,Y])=>R[r0(fe.toString())]=r0(Y.toString())),ce+=":",ce+=Xl(R).map(([fe,Y])=>`${fe}="${Y}"`).join(""),ce}).join(";")})((function(D){return D.map(z=>{var F,J;const ce={text:(F=z.$el_text)===null||F===void 0?void 0:F.slice(0,400),tag_name:z.tag_name,href:(J=z.attr__href)===null||J===void 0?void 0:J.slice(0,2048),attr_class:BV(z),attr_id:z.attr__id,nth_child:z.nth_child,nth_of_type:z.nth_of_type,attributes:{}};return Xl(z).filter(([de])=>de.indexOf("attr__")===0).forEach(([de,R])=>ce.attributes[de]=R),ce})})(O)):"")},!((a=h[0])===null||a===void 0)&&a.$el_text?{$el_text:(c=h[0])===null||c===void 0?void 0:c.$el_text}:{},m&&t.type==="click"?{$external_click_url:m}:{},f),target:e};var O,x}var z3=class{do(){this.vo=void 0,clearTimeout(this.fo),this.fo=void 0}po(e){var t;if(!Ao(e))return!0;const r=(t=this.mo().css_selector_ignorelist)!==null&&t!==void 0?t:eh,s=new Set;let n=e;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);const i=n,o=qo(i);if(be(o,"ph-no-capture")||be(o,"ph-sensitive")||bc(i)||r.some(c=>tm(i,c)))return!0;const a=n.parentNode;n=Tv(a)?a.host:a&&As(a)?a:null}return!1}yo(e){if(!this.isEnabled||e.type==="pointercancel")return void this.do();if(e.type==="pointerdown"){this.do();const s=Qa(e);var t;e.isPrimary&&e.button===0&&!e.ctrlKey&&s&&As(s)&&(this.vo={target:s,excluded:this.po(s),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(t=this.bo)===null||t===void 0?void 0:t.distinctId});return}const r=this.vo;r&&(e.pointerId!==r.id||Math.abs(e.clientX-r.x)>5||Math.abs(e.clientY-r.y)>5?this.do():e.type==="pointerup"&&(r.released=!0,this.fo=setTimeout(()=>this.do(),0)))}_o(e){var t;const r=this.vo;this.do();const s=Qa(e);if(r?.released&&r.target.isConnected&&r.distinctId===((t=this.bo)===null||t===void 0?void 0:t.distinctId)&&e.pointerId===r.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-r.x)&&5>=Math.abs(e.clientY-r.y)&&s&&(Ft(s,"html")||Ft(s,"body"))){var n;if(r.excluded)return null;const i=(n=this.mo().css_selector_ignorelist)!==null&&n!==void 0?n:eh;return[s,W?.documentElement,W?.body].some(o=>{if(!o)return!1;const a=qo(o);return be(a,"ph-no-capture")||be(a,"ph-sensitive")||!Ao(o)||bc(o)||i.some(c=>tm(o,c))})?null:r.target}}constructor(e){this.wo=e,this.name="autocapture",this.ko=!1,this.So=null,this.xo=!1,this.Co=new Map,this.$o=!1,this.Ir={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.To=!1,this.wo.refresh(this.Ir),this.rageclicks=new iC(this.Ir.rageclick),this.Io=null}setup(e){this.Mo(),this.bo=e;const t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.To?t.dispose():(this.Eo=t,this.startIfEnabled())}dispose(){var e;this.To||(this.To=!0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,this.Co.clear(),this.Io=null,this.Po())}mo(){return this.wo.refresh(this.Ir),this.Ir}Mo(){var e,t;return this.mo(),this.Ir.url_allowlist=(e=this.Ir.url_allowlist)===null||e===void 0?void 0:e.map(r=>new RegExp(r)),this.Ir.url_ignorelist=(t=this.Ir.url_ignorelist)===null||t===void 0?void 0:t.map(r=>new RegExp(r)),this.Ir}Ro(){if(!this.isBrowserSupported())return void hh.info("Disabling Automatic Event Collection because this browser is not supported");if(!L||!W)return;const e=this.Ao=t=>{t=t||L?.event;try{if(t.type==="blur")return void this.do();if(t.type.indexOf("pointer")===0)return void this.yo(t);const r=t.type==="click"?this._o(t):void 0;if(nt(r))return;this.Fo(t,"$autocapture",r)}catch(r){hh.error("Failed to capture event",r)}};if(ze(L,"blur",e),ze(W,"submit",e,{capture:!0}),ze(W,"change",e,{capture:!0}),ze(W,"click",e,{capture:!0}),Be(["pointerdown","pointermove","pointerup","pointercancel"],t=>{ze(W,t,e,{capture:!0})}),this.mo().capture_copied_text){const t=this.Oo=r=>{r=r||L?.event;try{this.Fo(r,ph)}catch(s){hh.error("Failed to capture clipboard event",s)}};ze(W,"copy",t,{capture:!0}),ze(W,"cut",t,{capture:!0}),ze(W,"paste",t,{capture:!0})}}Po(){this.do(),this.Ao&&(L?.removeEventListener("blur",this.Ao),Be(["pointerdown","pointermove","pointerup","pointercancel"],e=>{W?.removeEventListener(e,this.Ao,!0)}),W?.removeEventListener("submit",this.Ao,!0),W?.removeEventListener("change",this.Ao,!0),W?.removeEventListener("click",this.Ao,!0),this.Ao=void 0),this.Oo&&(W?.removeEventListener("copy",this.Oo,!0),W?.removeEventListener("cut",this.Oo,!0),W?.removeEventListener("paste",this.Oo,!0),this.Oo=void 0),this.ko=!1}startIfEnabled(){this.isEnabled||this.do(),!this.To&&this.bo&&this.isEnabled&&!this.ko&&(this.Ro(),this.ko=!0)}onRemoteConfig(e){if(this.To)return;if(this.xo=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this.$o=t.elementsChainAsString);const r=t.autocapture_opt_out;var s;tr(r)&&((s=this.bo)===null||s===void 0||s.kv.set("$autocapture_disabled_server_side",r),this.So=r),this.startIfEnabled()}setElementSelectors(e,t=this){if(this.To)return;e.size?this.Co.set(t,new Set(e)):this.Co.delete(t);const r=new Set;this.Co.forEach(s=>{s.forEach(n=>r.add(n))}),this.Io=r}getElementSelectors(e,t){var r;const s=[];return(r=this.Io)===null||r===void 0||r.forEach(n=>{W?.querySelectorAll(n)?.forEach(i=>{e!==i&&t!==i||be(s,n)||s.push(n)})}),s}get isEnabled(){var e,t;if(this.To)return!1;const r=(e=this.bo)===null||e===void 0?void 0:e.kv.get(HI),s=this.So,n=this.mo();if(!n.remoteRequestsDisabled&&!this.xo)return!1;const i=n.remoteRequestsDisabled&&!this.xo;if(nt(s)&&!tr(r)&&!i)return!1;const o=(t=this.So)!==null&&t!==void 0?t:!!r;return!!n.enabled&&!o}Fo(e,t="$autocapture",r){if(!this.isEnabled)return void this.do();let s=r||Qa(e);gR(s)&&(s=s.parentNode||null);const n=this.Mo();var i;t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&n.rageclick&&(i=this.rageclicks)!==null&&i!==void 0&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&bR(s,n.rageclick)&&this.Fo(e,"$rageclick",r);const o=t===ph,a=o?S(S({},n),{},{dom_event_allowlist:void 0}):n;if(s&&(function(p,d,h,f,m,v){var _;if(!L||Rv(p)||h?.url_allowlist&&!Kb(h.url_allowlist,v)||h?.url_ignorelist&&Kb(h.url_ignorelist,v))return!1;if(h?.dom_event_allowlist){const x=h.dom_event_allowlist;if(x&&!x.some(D=>d.type===D))return!1}const{parentIsUsefulElement:b,targetElementList:T}=SR(p,f);if(!(function(x,D){const z=D?.element_allowlist;if(j(z))return!0;for(const F of x)if(z.some(J=>F.tagName.toLowerCase()===J))return!0;return!1})(T,h)||!rm(T,h?.css_selector_allowlist)||rm(T,(_=h?.css_selector_ignorelist)!==null&&_!==void 0?_:eh))return!1;try{const x=L.getComputedStyle(p);if(x&&x.getPropertyValue("cursor")==="pointer"&&d.type==="click")return!0}catch{}const O=p.tagName.toLowerCase();switch(O){case"html":return!1;case"form":return(m||["submit"]).indexOf(d.type)>=0;case"input":case"select":case"textarea":return(m||["change","click"]).indexOf(d.type)>=0;default:return b?(m||["click"]).indexOf(d.type)>=0:(m||["click"]).indexOf(d.type)>=0&&(Iv.indexOf(O)>-1||p.getAttribute("contenteditable")==="true")}})(s,e,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var c;const{props:p,explicitNoCapture:d,target:h}=q3(s,{e,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.$o,disableCaptureUrlHashes:n.disableCaptureUrlHashes});if(d)return!1;const f=this.getElementSelectors(s,h);if(f&&f.length>0&&(p.$element_selectors=f),t===ph){const m=e.type||"clipboard";if(m!=="paste"){var l,u;const v=L==null||(l=L.getSelection())===null||l===void 0?void 0:l.toString(),_=vR(v);if(!_)return!1;p.$selected_content=_,p.$clipboard_text_length=(u=v?.length)!==null&&u!==void 0?u:0}p.$copy_type=m}return(c=this.bo)===null||c===void 0||c.capture(t,p),!0}}isBrowserSupported(){return kt(W?.querySelectorAll)}},F3=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,r=Le(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.il(),e.url_allowlist=r?.url_allowlist,e.url_ignorelist=r?.url_ignorelist,e.dom_event_allowlist=r?.dom_event_allowlist,e.element_allowlist=r?.element_allowlist,e.css_selector_allowlist=r?.css_selector_allowlist,e.css_selector_ignorelist=r?.css_selector_ignorelist,e.element_attribute_ignorelist=r?.element_attribute_ignorelist,e.capture_copied_text=r?.capture_copied_text}},Pa=ot("[ExceptionAutocapture]"),A0=()=>{},I0=e=>{var t;if(kt(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function kc(e,t,r){try{if(!(t in e))return A0;const s={next:e[t]},n=r(function(...i){return s.next.apply(this,i)});return kt(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),e[t]=n,()=>{if(e[t]===n)return void(e[t]=s.next);let i=e[t],o=I0(i);for(;o;){if(o.next===n)return void(o.next=s.next);i=o.next,o=I0(i)}}}catch{return A0}}var j3=ot("[TracingHeaders]"),Jn=ot("[Web Vitals]"),R0=9e5,C0=["CLS","FCP","INP","LCP"],H3=["INP","LCP"],B3=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],mh="disabled",P0="lazy_loading",Ls=ot("[SessionRecording]"),V3=[bv,Sv,sR,nR,iR,oR,aR,cR,lR],G3=ot("[Heatmaps]");function gh(e){return Le(e)&&"clientX"in e&&"clientY"in e&<(e.clientX)&<(e.clientY)}var Ol=ot("[Product Tours]"),vh=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(_v))},W3=["$set_once","$set"],cs=ot("[SiteApps]"),x0="Error while initializing PostHog app with config id ",oC=(e,t)=>e?.then?e.then(t):t(e),Qi="SDK is not enabled or survey functionality is not yet loaded",O0="Disabled. Not loading surveys.",K3=class{constructor(e,t){this.wo=e,this.Th=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ih=!1,this.Mh=!1,this.Eh=[],this.Ph=[],this.Rh=null,this.Ah=null,this.To=!1,this.Fh=new Set,this.onRemoteConfig=r=>{if(this.To||this.Ir.disableSurveys)return;if(!r.ok)return this.Mh=!0,this.Oh({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),Fe.warn("Remote config unavailable. Not loading surveys.");const s=r.config.surveys;if(Te(s))return Fe.warn("Flags not loaded yet. Not loading surveys.");this.Dh=tr(s)?s:s.length>0,Fe.info(`flags response received, isSurveysEnabled: ${this.Dh}`),this.loadIfEnabled()},this.Oh=r=>{this.Ph.slice().forEach(s=>this.Lh(s,r))}}setup(e){if(!this.To)return this.Nh=e,oC(e.kv.initialize(),()=>{if(this.Nh!==e||this.To)return;this.Nh=void 0,this.bo=e;const t=e.onRemoteConfig(this.onRemoteConfig);this.To?t.dispose():(this.Eo=t,this.loadIfEnabled())})}dispose(){var e,t,r,s,n;this.To||(this.To=!0,this.Nh=void 0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,(t=this._surveyEventReceiver)===null||t===void 0||t.dispose(),this._surveyEventReceiver=null,(r=this._surveyManager)===null||r===void 0||(s=r.dispose)===null||s===void 0||s.call(r),this._surveyManager=null,this.Eh=[],this.Ph.forEach(i=>{i.active=!1}),this.Ph=[],(n=this.qh)===null||n===void 0||n.call(this),this.qh=void 0,this.Rh=null,this.Fh.forEach(i=>clearTimeout(i)),this.Fh.clear())}get Ir(){return this.wo.get()}initialize(){this.loadIfEnabled()}reset(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.clearInMemoryInProgressSurveyState)===null||t===void 0||t.call(e);try{var r;(r=this._surveyEventReceiver)===null||r===void 0||r.reset(),localStorage.removeItem("lastSeenSurveyDate");const s=[];for(let n=0;n<localStorage.length;n++){const i=localStorage.key(n);(i!=null&&i.startsWith("seenSurvey_")||i!=null&&i.startsWith("inProgressSurvey_"))&&s.push(i)}s.forEach(n=>localStorage.removeItem(n))}catch{}this.Oh()}loadIfEnabled(){if(this.To||!this.bo)return;const e=this.Ir;if(this._surveyManager)return;if(this.Ih)return void Fe.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void Fe.info(O0);if(e.cookielessMode&&this.wo.isOptedOut())return void Fe.info("Not loading surveys in cookieless mode without consent.");const t=this.wo.getExtensions();if(!t)return void this.jh("PostHog Extensions not found.");if(j(this.Dh)&&!e.advancedEnableSurveys)return;const r=this.Dh||e.advancedEnableSurveys;this.Ih=!0,this.Mh=!1;try{const s=t.generateSurveys;if(s)return this.Bh(s,r),void(this.Ih=!1);const n=t.loadExternalDependency;if(!n)return this.jh(wv),void(this.Ih=!1);n(i=>{try{if(this.To)return;const o=this.wo.getExtensions();i||!o?.generateSurveys?this.jh("Could not load surveys script",i):this.Bh(o.generateSurveys,r)}finally{this.Ih=!1}})}catch(s){throw this.Ih=!1,this.jh("Error initializing surveys",s),s}}Bh(e,t){var r,s;if(this.To)return;this._surveyManager=e(t),this._surveyEventReceiver=this.wo.createEventReceiver(this.Oh);const n=(r=(s=this.bo)!==null&&s!==void 0?s:this.Th)===null||r===void 0?void 0:r.kv.get(za);n&&this.Hh(n),Fe.info("Surveys loaded successfully"),this.zh(),this.Oh(),this.Uh({isLoaded:!0})}jh(e,t){this.Mh=!0,Fe.error(e,t),this.Oh({isLoaded:!1,error:e}),this.Uh({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Eh.push(e),this._surveyManager&&this.Uh({isLoaded:!0}),()=>{this.Eh=this.Eh.filter(t=>t!==e)}}getSurveys(e,t=!1){var r;const s=(r=this.bo)!==null&&r!==void 0?r:this.Th;if(!s||this.To)return;if(this.Ir.disableSurveys)return Fe.info(O0),e([]);const n=s.kv.get(za);if(n&&!t)return e(n,{isLoaded:!0}),void(this.Wh()&&this.getSurveys(()=>{},!0));if(this.Rh)return void this.Rh.then(({surveys:a,context:c})=>{this.To||e(a,c)}).catch(a=>Fe.error("Error in survey callback",a));const i=this.Vh("/api/surveys/",{method:"GET",query:{token:s.projectToken},sentAt:"query",timeoutMs:this.Ir.requestTimeoutMs}).then(a=>{try{return this.Gh(s,a)}catch(c){return Fe.error("Error processing surveys response",c),this.Gh(s,{statusCode:0,error:c})}},a=>this.Gh(s,{statusCode:0,error:a}));this.Rh=i;const o=()=>{this.Rh===i&&(this.Rh=null)};i.then(a=>{o(),this.To||(this.Oh(a.context),e(a.surveys,a.context))},o).catch(a=>Fe.error("Error in survey callback",a))}Vh(e,t){const r=this.bo;return r?r.sendRequest(e,t):new Promise(s=>s({statusCode:0,error:new Error(Qi)}))}Gh(e,t){if(this.To)return{surveys:[],context:{isLoaded:!1,error:Qi}};const r=t.statusCode;if(r!==200||!t.json){const n=`Surveys API could not be loaded, status: ${r}`;return r!==0?Fe.error(n):t.error||Fe.warn(n),this.Ah=Date.now(),{surveys:[],context:{isLoaded:!1,error:n}}}this.Ah=null;const s=t.json.surveys||[];return e.kv.set({[za]:s,[Pu]:Date.now()}),this.Hh(s),{surveys:s,context:{isLoaded:!0}}}Hh(e){var t;const r=e.filter(s=>(function(n){return!(!n.start_date||n.end_date)})(s)&&(eC(s)||(function(n){var i;return!!(!((i=n.conditions)===null||i===void 0||(i=i.actions)===null||i===void 0||(i=i.values)===null||i===void 0)&&i.length)})(s)));(t=this._surveyEventReceiver)===null||t===void 0||t.replace(r)}Wh(){return this.Zh()&&!this.Rh&&!this.Qh()}Zh(){var e,t;const r=(e=(t=this.bo)!==null&&t!==void 0?t:this.Th)===null||e===void 0?void 0:e.kv.get(Pu);return lt(r)&&Date.now()-r>3e5}Qh(){return lt(this.Ah)&&3e5>Date.now()-this.Ah}markSurveyAsSeen(e,t){var r;const s={id:e,current_iteration:(r=t?.iteration)!==null&&r!==void 0?r:null};sC(s);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}this.Oh()}Uh(e){for(const t of this.Eh)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(r){Fe.error("Error in survey callback",r)}}getActiveMatchingSurveys(e,t=!1){if(!Te(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Fe.warn("init was not called")}onActiveMatchingSurveysChanged(e){var t,r;if(this.To)return()=>{};const s={callback:e,active:!0,revision:0};this.Ph.push(s),this.zh();const n=(t=(r=this.bo)!==null&&r!==void 0?r:this.Th)===null||t===void 0?void 0:t.kv.get(za);return this.Ir.disableSurveys||!this._surveyManager&&this.Mh&&!this.Ih||!n&&!Te(this.Ah)&&!this.Rh?this.Lh(s,{isLoaded:!1}):this._surveyManager&&this.Lh(s),()=>{var i;s.active=!1,this.Ph=this.Ph.filter(o=>o!==s),this.Ph.length===0&&((i=this.qh)===null||i===void 0||i.call(this),this.qh=void 0)}}zh(){var e,t,r;this._surveyManager&&this.Ph.length>0&&((e=this.qh)!==null&&e!==void 0||(this.qh=(t=(r=this.wo).onMatchingConditionsChanged)===null||t===void 0?void 0:t.call(r,this.Oh)))}Lh(e,t){if(this.To||!e.active)return;const r=++e.revision,s=n=>{if(!this.To&&e.active&&r===e.revision)try{const i=t??{isLoaded:!0},o=JSON.stringify([n,i]);if(o===e.lastResult)return;e.lastResult=o,e.callback(n,i)}catch(i){Fe.error("Error in active matching surveys callback",i)}};try{t&&!t.isLoaded?s([]):this.getActiveMatchingSurveys(s)}catch(n){Fe.error("Error in active matching surveys callback",n)}}Jh(e){let t=null;return this.getSurveys(r=>{var s;t=(s=r.find(n=>n.id===e))!==null&&s!==void 0?s:null}),t}Kh(e){if(Te(this._surveyManager))return{eligible:!1,reason:Qi};const t=typeof e=="string"?this.Jh(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Xh(e){if(!this.wo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(Te(this._surveyManager))return{eligible:!1,reason:Qi};const t=typeof e=="string"?this.Jh(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Te(this._surveyManager))return Fe.warn("init was not called"),{visible:!1,disabledReason:Qi};const t=this.Xh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Te(this._surveyManager)?(Fe.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Qi})):new Promise(r=>{this.getSurveys(s=>{var n;const i=(n=s.find(o=>o.id===e))!==null&&n!==void 0?n:null;if(i){const o=this.Xh(i);r({visible:o.eligible,disabledReason:o.reason})}else r({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,r){var s;if(!this.wo.isCapturing())return;if(Te(this._surveyManager))return void Fe.warn("init was not called");const n=typeof e=="string"?this.Jh(e):e;if(!n?.id)return void Fe.warn("Survey not found");if(!k3.includes(n.type))return void Fe.warn(`Surveys of type ${n.type} cannot be rendered in the app`);const i=W?.querySelector(t);if(i){if(!((s=n.appearance)===null||s===void 0)&&s.surveyPopupDelaySeconds){Fe.info(`Rendering survey ${n.id} with delay of ${n.appearance.surveyPopupDelaySeconds} seconds`);const o=setTimeout(()=>{var a,c;this.Fh.delete(o),!this.To&&this.wo.isCapturing()&&(Fe.info(`Rendering survey ${n.id} with delay of ${(a=n.appearance)===null||a===void 0?void 0:a.surveyPopupDelaySeconds} seconds`),(c=this._surveyManager)===null||c===void 0||c.renderSurvey(n,i,r),Fe.info(`Survey ${n.id} rendered`))},1e3*n.appearance.surveyPopupDelaySeconds);this.Fh.add(o);return}this._surveyManager.renderSurvey(n,i,r)}else Fe.warn("Survey element not found")}displaySurvey(e,t){var r;if(!this.wo.isCapturing())return;if(Te(this._surveyManager))return void Fe.warn("init was not called");const s=this.Jh(e);if(!s)return void Fe.warn("Survey not found");let n=s;if((r=s.appearance)!==null&&r!==void 0&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=S(S({},s),{},{appearance:S(S({},s.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==sm.Popover&&t.initialResponses&&Fe.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){const i=this.Kh(s);if(!i.eligible)return void Fe.warn("Survey is not eligible to be displayed: ",i.reason)}t.displayType!==sm.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}cancelPendingSurvey(e){Te(this._surveyManager)?Fe.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.handlePageUnload)===null||t===void 0||t.call(e)}};function eo(e,t,r){if(Te(e))return!1;switch(r){case"exact":return e===t;case"contains":{const s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var J3=class{constructor(e){this._instance=e,this.Yh=new Set,this.tc=new Set,this.ec=new $u,this.nc=(t,r)=>this.sc(t,r)&&this.rc(t,r)&&this.oc(t,r)&&this.ac(t,r),this.sc=(t,r)=>!r?.event||t?.event===r?.event}init(){var e,t;j((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.lc=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook((r,s)=>{this.on(r,s)}))}dispose(){var e,t;(e=this.lc)===null||e===void 0||e.call(this),this.lc=void 0,(t=this._instance)===null||t===void 0||(t=t.autocapture)===null||t===void 0||t.setElementSelectors(new Set,this),this.ec=new $u}register(e){var t,r;if(!j((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(s=>{var n;this.Yh.add(s),(n=s.steps)===null||n===void 0||n.forEach(i=>{this.tc.add(i?.event||"")})}),(r=this._instance)===null||r===void 0?void 0:r.autocapture)){const s=new Set;this.Yh.forEach(n=>{var i;(i=n.steps)===null||i===void 0||i.forEach(o=>{o!=null&&o.selector&&s.add(o.selector)})}),this._instance.autocapture.setElementSelectors(s,this)}}replace(e){this.Yh.clear(),this.tc.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.tc.has(e)||this.tc.has(t.event))&&this.Yh.forEach(r=>{this.uc(t,r)&&this.ec.emit("actionCaptured",r.name)})}hc(e){this.onAction("actionCaptured",t=>e(t))}uc(e,t){if(t?.steps==null)return!1;for(const r of t.steps)if(this.nc(e,r))return!0;return!1}onAction(e,t){return this.ec.on(e,t)}rc(e,t){if(t?.url){var r;const s=e==null||(r=e.properties)===null||r===void 0?void 0:r.$current_url;if(!s||typeof s!="string"||!eo(s,t.url,t.url_matching||"contains"))return!1}return!0}oc(e,t){return!!this.cc(e,t)&&!!this.dc(e,t)&&!!this.vc(e,t)}cc(e,t){var r;if(!t?.href)return!0;const s=this.fc(e);if(s.length>0)return s.some(i=>eo(i.href,t.href,t.href_matching||"exact"));const n=(e==null||(r=e.properties)===null||r===void 0?void 0:r.$elements_chain)||"";return!!n&&eo((function(i){const o=i.match(/(?::|")href="(.*?)"/);return o?o[1]:""})(n),t.href,t.href_matching||"exact")}dc(e,t){var r;if(!t?.text)return!0;const s=this.fc(e);if(s.length>0)return s.some(c=>eo(c.text,t.text,t.text_matching||"exact")||eo(c.$el_text,t.text,t.text_matching||"exact"));const n=(e==null||(r=e.properties)===null||r===void 0?void 0:r.$elements_chain)||"";return!!n&&(i=(function(c){const l=[],u=/(?::|")text="(.*?)"/g;let p;for(;!Te(p=u.exec(c));)l.includes(p[1])||l.push(p[1]);return l})(n),o=t.text,a=t.text_matching||"exact",i.some(c=>eo(c,o,a)));var i,o,a}vc(e,t){var r,s;if(!t?.selector)return!0;const n=e==null||(r=e.properties)===null||r===void 0?void 0:r.$element_selectors;if(n?.includes(t.selector))return!0;const i=(e==null||(s=e.properties)===null||s===void 0?void 0:s.$elements_chain)||"";if(t.selector_regex&&i)try{return new RegExp(t.selector_regex).test(i)}catch{return!1}return!1}fc(e){var t;return(e==null||(t=e.properties)===null||t===void 0?void 0:t.$elements)==null?[]:e?.properties.$elements}ac(e,t){return!t?.properties||t.properties.length===0||rC(t.properties.reduce((r,s)=>{const n=Se(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return r[s.key]={values:n,operator:s.operator||"exact"},r},{}),e?.properties)}},Y3=class{constructor(e,t){var r,s;this.gc=[],this._instance=e,this.mc=t,this.yc=new Map,this.bc=new Map,this._c=new Map,this.wc=(r=this._instance)===null||r===void 0||(s=r.onSessionId)===null||s===void 0?void 0:s.call(r,n=>this.kc(n))}Sc(e){return!1}xc(){return null}Cc(e){}$c(){}Tc(e,t){return!!e&&rC(e.propertyFilters,t?.properties)}Ic(e,t){const r=new Map;return e.forEach(s=>{var n;(n=s.conditions)===null||n===void 0||(n=n[t])===null||n===void 0||(n=n.values)===null||n===void 0||n.forEach(i=>{if(i?.name){const o=r.get(i.name)||[];o.push(s.id),r.set(i.name,o)}})}),r}Mc(e,t,r){const s=(r===Ia.Activation?this.yc:this.bc).get(e);let n=[];return this.Ec(i=>{n=i.filter(o=>s?.includes(o.id))}),n.filter(i=>{var o;const a=(o=i.conditions)===null||o===void 0||(o=o[r])===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.find(c=>c.name===e);return this.Tc(a,t)})}register(e){this.Pc(e,!1)}replace(e){this.Pc(e,!0)}Pc(e,t){var r;j((r=this._instance)===null||r===void 0?void 0:r._addCaptureHook)||(this.Rc(e,t),this.Ac(e,t))}Ac(e,t){const r=e.filter(i=>{var o;return(o=i.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.length});var s;if(t&&this._c.clear(),r.length===0)return void(t&&((s=this.Fc)===null||s===void 0||s.replace([])));this.Fc||(this.Fc=new J3(this._instance),this.Fc.init(),this.Fc.hc(i=>this.onAction(i)));const n=[];r.forEach(i=>{var o;(o=i.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||o.values.forEach(a=>{if(n.push(a),a.name){var c;const l=(c=this._c.get(a.name))!==null&&c!==void 0?c:[];l.includes(i.id)||l.push(i.id),this._c.set(a.name,l)}})}),t?this.Fc.replace(n):this.Fc.register(n)}Oc(e,t){t.forEach((r,s)=>{var n;const i=(n=e.get(s))!==null&&n!==void 0?n:[];r.forEach(o=>{i.includes(o)||i.push(o)}),e.set(s,i)})}Rc(e,t){var r,s;const n=e.filter(c=>{var l,u;return((l=c.conditions)===null||l===void 0?void 0:l.events)&&((u=c.conditions)===null||u===void 0||(u=u.events)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length)>0}),i=e.filter(c=>{var l,u;return((l=c.conditions)===null||l===void 0?void 0:l.cancelEvents)&&((u=c.conditions)===null||u===void 0||(u=u.cancelEvents)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length)>0}),o=this.Ic(e,Ia.Activation),a=this.Ic(e,Ia.Cancellation);t?(this.yc=o,this.bc=a):(this.Oc(this.yc,o),this.Oc(this.bc,a)),(n.length!==0||i.length!==0||e.some(c=>{var l;return(l=c.conditions)===null||l===void 0||(l=l.actions)===null||l===void 0||(l=l.values)===null||l===void 0?void 0:l.length}))&&((r=this.lc)!==null&&r!==void 0||(this.lc=(s=this._instance)===null||s===void 0?void 0:s._addCaptureHook((c,l)=>{this.onEvent(c,l)})))}onEvent(e,t){var r,s;const n=this.Dc(),i=(t==null||(r=t.properties)===null||r===void 0?void 0:r.$survey_id)||(t==null||(s=t.properties)===null||s===void 0?void 0:s.$product_tour_id);if(i&&this.getActivatedIds().includes(i)){const a=this.Lc(e,i,t);if(a==="consume")return n.info("event consumed activated item, removing it",{event:e,itemId:i}),void this.Nc([i]);if(a==="persist")return n.info("shown item promoted to persisted activation",{event:e,itemId:i}),this.qc(i),void this.jc([i])}if(this.bc.has(e)){const a=this.Mc(e,t,Ia.Cancellation);a.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map(c=>c.id)}),this.Nc(a.map(c=>c.id)),a.forEach(c=>this.Bc(c.id)))}if(!this.yc.has(e))return;n.info("event name matched",{event:e,eventPayload:t,items:this.yc.get(e)});const o=this.Mc(e,t,Ia.Activation);this.Hc(o.map(a=>a.id))}onAction(e){this._c.has(e)&&this.Hc(this._c.get(e)||[])}Hc(e){var t,r;if(e.length===0)return;const s=!!(!((t=this._instance)===null||t===void 0||(r=t.get_session_id)===null||r===void 0)&&r.call(t)),n=[];for(const i of e)s&&this.Sc(i)?this.qc(i)&&this.zc(i):n.push(i);n.length>0&&(this.gc=[...new Set([...this.gc,...n])]),this.Dc().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.Uc()}qc(e){this.gc=this.gc.filter(r=>r!==e);const t=this.Wc();return!t.includes(e)&&(this.Vc([...t,e]),this.Gc(),!0)}Nc(e){const t=new Set(e);this.gc=this.gc.filter(n=>!t.has(n));const r=this.Zc(),s=r.filter(n=>!t.has(n));s.length!==r.length&&(this.Vc(s),s.length===0&&this.Qc()),this.jc(e),this.Uc()}Uc(){try{var e;(e=this.mc)===null||e===void 0||e.call(this)}catch(t){this.Dc().error("Error while handling activated items change",t)}}Jc(){var e;const t=this.xc();if(!t)return{};const r=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t];return r&&typeof r=="object"?r:{}}zc(e){if(!this.xc())return;const t=this.Jc();this.Cc(S(S({},t),{},{[e]:Date.now()}))}jc(e){if(!this.xc())return;const t=this.Jc(),r={};let s=!1;for(const[n,i]of Object.entries(t))e.includes(n)?s=!0:r[n]=i;s&&(dr(r)?this.$c():this.Cc(r))}Kc(){this.xc()&&this.$c()}getActivationTimestamp(e){if(!this.Wc().includes(e))return;const t=this.Jc()[e];return lt(t)?t:void 0}Zc(){var e;const t=this.Xc();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t])||[]}Wc(){var e,t,r;const s=this.Zc();if(s.length===0)return[];const n=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.Yc()],i=(t=this._instance)===null||t===void 0||(r=t.get_session_id)===null||r===void 0?void 0:r.call(t);return i&&n===i?s:[]}Gc(){var e,t;const r=(e=this._instance)===null||e===void 0||(t=e.get_session_id)===null||t===void 0?void 0:t.call(e);r&&this.td(r)}Qc(){this.ed()}kc(e){var t;const r=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this.Yc()];if(r&&r!==e){const s=this.Zc(),n=this.Jc();s.length>0&&(this.Vc([]),s.filter(i=>lt(n[i])).forEach(i=>this.Bc(i))),this.Qc(),this.Kc(),s.length>0&&this.Uc()}}getActivatedIds(){return[...new Set([...this.Wc(),...this.gc])].filter(e=>!this.nd(e))}dispose(){var e,t,r;(e=this.wc)===null||e===void 0||e.call(this),this.wc=void 0,(t=this.lc)===null||t===void 0||t.call(this),this.lc=void 0,(r=this.Fc)===null||r===void 0||r.dispose(),this.Fc=void 0}reset(){this.gc=[],this.Zc().length>0&&this.Vc([]),this.Qc(),this.Kc(),this.Uc()}getEventToItemsMap(){return this.yc}sd(){return this.Fc}},X3=class extends Y3{constructor(e,t){super(e,t)}Xc(){return JI}Yc(){return YI}xc(){return XI}Cc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_timestamps:e})}$c(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}Sc(e){var t;let r;this.Ec(n=>{r=n.find(i=>i.id===e)});const s=r==null||(t=r.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return lt(s)&&s>0}rd(){return _r.SHOWN}Ec(e){var t;(t=this._instance)===null||t===void 0||t.getSurveys(e)}Bc(e){var t;(t=this._instance)===null||t===void 0||t.cancelPendingSurvey(e)}Dc(){return Fe}Vc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated:e})}td(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_session:e})}ed(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}nd(){return!1}Lc(e,t,r){var s;if(e===_r.SENT&&(r==null||(s=r.properties)===null||s===void 0?void 0:s.$survey_completed)===!1)return"ignore";let n;return this.Ec(i=>{n=i.find(o=>o.id===t)}),!n||(function(i){var o;return eC(i)&&!!(!((o=i.conditions)===null||o===void 0||(o=o.events)===null||o===void 0)&&o.repeatedActivation)||i.schedule==="always"})(n)?e===_r.SHOWN?"consume":"ignore":e===_r.SHOWN?"persist":e===_r.DISMISSED||e===_r.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Z3=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);const t={};for(const r of e){const s=this._instance.get_property(r);j(s)||(t[r]=s)}return t}set(e,t){this._instance.register(typeof e=="string"?{[e]:t}:e)}remove(e){typeof e!="string"?e.forEach(t=>this._instance.unregister(t)):this._instance.unregister(e)}},Q3=class{constructor(e){this._instance=e}get(){const e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=ge?.__PosthogExtensions__;if(!e)return;const{generateSurveys:t,loadExternalDependency:r}=e;return{generateSurveys:t?s=>t(this._instance,s):void 0,loadExternalDependency:r?s=>r(this._instance,"surveys",s):void 0}}createEventReceiver(e){return new X3(this._instance,e)}onMatchingConditionsChanged(e){const t=this._instance._addCaptureHook(i=>{i!=="$pageview"&&i!==_r.SHOWN&&i!==_r.DISMISSED&&i!==_r.SENT||e()}),r=()=>e();ze(L,"PHSurveyShown",r);let s=!1;const n=this._instance.onFeatureFlags(()=>{s&&e()});return s=!0,()=>{s=!1,t(),n(),L?.removeEventListener("PHSurveyShown",r)}}},e4=L?.location?Mu(L.location.hash,"__posthog")||Mu(location.hash,"state"):null,M0="_postHogToolbarParams",L0=ot("[Toolbar]"),N0=ot("[FeatureFlags]"),t4=class{constructor(e,t=!1){this.od=!1,this.update(e,t)}update(e,t){this.ad=((r,s)=>{var n,i,o,a,c,l,u,p;return{bootstrap:{featureFlags:(n=(i=r.bootstrap)===null||i===void 0?void 0:i.featureFlags)!==null&&n!==void 0?n:void 0,featureFlagPayloads:(o=(a=r.bootstrap)===null||a===void 0?void 0:a.featureFlagPayloads)!==null&&o!==void 0?o:void 0},remoteRequestsDisabled:s,featureFlagsDisabled:!!r.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!r.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!r.advanced_feature_flags_dedup_per_session,cacheTtlMs:r.feature_flag_cache_ttl_ms,refreshIntervalMs:(c=r.remote_config_refresh_interval_ms)!==null&&c!==void 0?c:3e5,idleRefreshBackoff:j(r.remote_config_refresh_interval_ms),requestTimeoutMs:r.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(l=r.feature_flag_request_max_retries)!==null&&l!==void 0?l:1),compression:r.disable_compression?void 0:"best-available",evaluationContexts:(u=(p=r.evaluation_contexts)!==null&&p!==void 0?p:r.evaluation_environments)!==null&&u!==void 0?u:[],flagKeys:Se(r.flag_keys)?r.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.od||(N0.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.od=!0),j(e.flag_keys)||Se(e.flag_keys)||N0.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.ad}},$0=ot("[FeatureFlags]"),Yn=ot("[FeatureFlags]",{debugEnabled:!0}),_h=`" failed. Feature flags didn't load in time.`,r4=[502,504],D0=["click","keydown","wheel","touchstart","pointerdown"],U0="connection_error",q0=e=>{const t={};for(let r=0;e.length>r;r++)t[e[r]]=!0;return t},z0=e=>{const t={};for(const[r,s]of Xl(e||{}))s&&(t[r]=s);return t},F0=e=>ta(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),jr=ot("[Error tracking]"),lm="webkit-masked-url:",s4=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],n4=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",lm],i4=["__firefox__","__gCrWeb"],j0="Refusing to render web experiment since the viewer is a likely bot",o4={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Du(t,e),not_regex:(e,t)=>!Du(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},Ar=ot("[Conversations]"),Xn="Conversations not available yet.";function H0(e,t){var r,s,n,i,o,a,c;const l=(r=e?.flushIntervalMs)!==null&&r!==void 0?r:3e3,u=(s=e?.maxBufferSize)!==null&&s!==void 0?s:100,p=t?.consoleCapture?void 0:(n=e?.maxLogsPerInterval)!==null&&n!==void 0?n:1e3,d=j(p)?Math.max(u,2048):Math.max(u,p),h=S(S({},(function(){let f="",m="";try{const v=Tt?.userAgent;v&&([f,m]=bI(v))}catch{}return(function(v,_){const b=(function(T){if(T)return{}.hasOwnProperty.call($b,T)?$b[T]:T})(v);return S(S({},b?{"os.name":b}:{}),_?{"os.version":_}:{})})(f,m)})()),e?.resourceAttributes);return{serviceName:(i=(o=h?.["service.name"])!==null&&o!==void 0?o:e?.serviceName)!==null&&i!==void 0?i:t?.serviceNameDefault,serviceVersion:(a=h?.["service.version"])!==null&&a!==void 0?a:e?.serviceVersion,environment:(c=h?.["deployment.environment"])!==null&&c!==void 0?c:e?.environment,resourceAttributes:h,beforeSend:e?.beforeSend,flushIntervalMs:l,maxBufferSize:u,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:l,maxLogsPerInterval:p,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var a4=["debug","log","warn","error","info"],c4=e=>{for(;e?.__rrweb_original__;)e=e.__rrweb_original__;return e},B0="console",aC="__posthogHandledLogsRequestError",yh=(e,t)=>{const r=e instanceof Error?e:new Error(t);return r[aC]=!0,r},V0=e=>!!e&&typeof e=="object"&&e[aC]===!0,Uu=ot("[NetworkMetrics]"),xv=()=>{var e;return!(L==null||(e=L.performance)===null||e===void 0)&&e.now?L.performance.now():Date.now()},l4={"http:":80,"https:":443},u4=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),cC=(e,t)=>{var r;const s=String(t);return{method:String(e).toUpperCase(),url:((r=Zs(s))===null||r===void 0?void 0:r.href)||s}},um=(e,t,r,s,n,i,o=!1)=>{try{var a,c;const l=n();if(!l)return;const u=r||void 0,p=xv()-s,d=Zs(t.url);if(d&&d.protocol!=="http:"&&d.protocol!=="https:")return;const h={url:d?.href||t.url,method:t.method},f=kt(l.name)?l.name(h):Pe(l.name)?l.name:"http.client.request.duration";if(!f)return;const m=o&&!u?void 0:((_,b)=>_?400>_?void 0:String(_):b?.name||"_OTHER")(u,i),v=S(S(S(S(S({},(_=>{const b=u4.has(_)?_:"_OTHER";return S({"http.request.method":b},b==="_OTHER"&&_!==b?{"http.request.method_original":_}:{})})(h.method)),d?(_=>{return{"server.address":_.hostname.startsWith("[")&&_.hostname.endsWith("]")?_.hostname.slice(1,-1):_.hostname,"server.port":Number(_.port)||l4[_.protocol],"url.scheme":_.protocol.slice(0,-1),"url.template":(b=_.pathname,b.split("/").map(T=>(O=>/^\d+$/.test(O)||O.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(O))(T)?":id":T).join("/"))};var b})(d):{}),u?{"http.response.status_code":u}:{}),m?{"error.type":m}:{}),(a=l.attributes)===null||a===void 0?void 0:a.call(l,h,{status:u,durationMs:p}));(c=e.metrics)===null||c===void 0||c.histogram(f,p,{unit:"ms",attributes:v})}catch(l){Uu.error("Failed to record network metric",l)}},lC=()=>{},d4=(e,t)=>kt(L?.fetch)?kc(L,"fetch",r=>function(...s){const n=xv(),i=r.apply(this,s);if(!t())return i;try{var o,a,c;const[l,u]=s,p=cC((o=(a=u?.method)!==null&&a!==void 0?a:l?.method)!==null&&o!==void 0?o:"GET",(c=l?.url)!==null&&c!==void 0?c:l);return i.then(d=>(um(e,p,d?.status,n,t,void 0,!0),d),d=>{throw um(e,p,void 0,n,t,d),d})}catch(l){return Uu.error("Failed to observe fetch",l),i}}):lC,p4=(e,t)=>{var r;const s=L==null||(r=L.XMLHttpRequest)===null||r===void 0?void 0:r.prototype;if(!s)return lC;const n=new WeakMap,i=kc(s,"open",a=>function(...c){try{FR.has(this)||n.set(this,cC(c[0],c[1]))}catch(l){Uu.error("Failed to observe XHR open",l)}return a.apply(this,c)}),o=kc(s,"send",a=>function(...c){let l;try{const u=n.get(this);if(u&&t()){const p=xv();l=()=>{this.removeEventListener("loadend",l),um(e,u,this.status,p,t)},ze(this,"loadend",l)}}catch(u){Uu.error("Failed to observe XHR send",u)}try{return a.apply(this,c)}catch(u){throw l&&this.removeEventListener("loadend",l),u}});return()=>{i(),o()}},Vd={featureFlags:class{constructor(e){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=$0,this.ud={},this.hd={},this.dd=[],this.vd=!1,this.fd=!1,this.pd=0,this.gd=!1,this.md=!1,this.yd=!1,this.bd=!1,this._d=0,this.wd=!1,this.rn=()=>{const t=this.kd();this._d=0,t&&this.reloadFeatureFlags()},this.Sd=()=>{var t,r;const s=this.xd,n=(t=this.Cd)!==null&&t!==void 0?t:s;j(s)||j(n)||this.Ir.remoteRequestsDisabled||!W||W.visibilityState==="hidden"||Date.now()-((r=this.$d)!==null&&r!==void 0?r:0)<n||(this.Cd=this.wd||!this.Ir.idleRefreshBackoff?s:Math.min(2*n,36e5),this.wd=!1,this.reloadFeatureFlags(),this.Td())},this.Id=()=>{this.wd&&this.Cd===this.xd||this.Md()},this.sn=()=>{W?.visibilityState==="visible"&&this.Md()},"get"in e?this.wo=e:(this._instance=e,this.Ed=new t4(e.config,e.il()),this.wo=this.Ed)}updateConfig(e,t){var r;(r=this.Ed)===null||r===void 0||r.update(e,t),this.bo&&this.Pd()}setup(e){return this.Nh=e,this.A=e.logger.createLogger("[FeatureFlags]"),oC(e.kv.initialize(),()=>{this.Nh===e&&(this.Nh=void 0,this.bo=e,this.Rd(e))})}Rd(e){var t;if(this.bo===e)return L&&ze(L,"online",this.rn),this.Pd(),this.Ad=e.registerDynamicEventProperties(()=>this.Fd()?this.ud:this.hd),this.Od=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this.Dd(),this.Ld(),this.Nd()}),this.Ld(),this.initialize()}Md(){this.wd=!0,this.Cd=this.xd,this.Sd()}Pd(){const e=this.Ir.refreshIntervalMs,t=!this.Ir.remoteRequestsDisabled&&W&&!j(e)&&e>0?e:void 0;this.Ir.idleRefreshBackoff||(this.Cd=t),t!==this.xd&&(this.qd(),j(t)||(this.xd=t,this.Cd=t,this.Td(),W!=null&&W.addEventListener&&(ze(W,_c,this.sn),vo(D0,r=>{ze(W,r,this.Id,{capture:!0})}))))}Td(){j(this.xd)||(j(this.jd)||clearInterval(this.jd),this.$d=Date.now(),this.jd=setInterval(this.Sd,this.xd))}qd(){var e;j(this.jd)||(clearInterval(this.jd),this.jd=void 0,W==null||(e=W.removeEventListener)===null||e===void 0||e.call(W,"visibilitychange",this.sn),vo(D0,t=>{var r;W==null||(r=W.removeEventListener)===null||r===void 0||r.call(W,t,this.Id,{capture:!0})})),this.xd=void 0,this.Cd=void 0,this.wd=!1,this.$d=void 0}destroy(){this.Bd()}dispose(){this.Bd()}Bd(){var e,t;this.qd(),this.pd++,this.md=!1,this.Nh=void 0,this.bo&&(this.Hd(),(e=this.Ad)===null||e===void 0||e.dispose(),this.Ad=void 0,(t=this.Od)===null||t===void 0||t.call(this),this.Od=void 0,this.dd=[],L?.removeEventListener("online",this.rn),this.bo=void 0)}get Ir(){return this.wo.get()}zd(e){var t;return this.Ud&&e in this.Ud?this.Ud[e]:(t=this.bo)===null||t===void 0?void 0:t.kv.get(e)}Dd(){return!!this.Ud&&(this.Ud=void 0,!0)}Wd(){var e;return!j((e=this.bo)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.Dd()}$t(e){this.Vd(()=>{var t;return(t=this.bo)===null||t===void 0?void 0:t.kv.set(e)})}Gd(e,t,r){var s;if(!(!((s=this._instance)===null||s===void 0)&&s.persistence)||!e.$enabled_feature_flags)return;const n=this.zd("$enabled_feature_flags")||{},i=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(([,_])=>!_?.failed).map(([_])=>_):[],c=!!t.errorsWhileComputingFlags&&!!t.flags,l=c?a:r&&!Se(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(n),...Object.keys(i)])),u=this.zd("$feature_flag_payloads")||{},p=e.$feature_flag_payloads||{},d=c||r?l:Array.from(new Set([...Object.keys(u),...Object.keys(p)])),h=!c&&!r,f=!!h||l,m=!!h||d,v={[js]:f,[Jr]:f,[Sn]:m};e.$feature_flag_details&&(v[bi]=f);for(const _ of[Si,On,Xa])j(e[_])||(v[_]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(v)}Lt(e){this.Vd(()=>{var t;return(t=this.bo)===null||t===void 0?void 0:t.kv.remove(e)})}Vd(e){try{e()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}Ld(){const e={};for(const s of[js,Sn,Si,ds]){const n=this.zd(s);j(n)||(e[s]=n)}this.ud=e;const t=S({},e),r=this.zd(Jr);if(r)for(const[s,n]of Object.entries(r))t[`$feature/${s}`]=n;this.hd=t}Fd(){const e=this.Ir.cacheTtlMs;if(!e||0>=e)return!1;const t=this.zd(On);return typeof t!="number"||Date.now()-t>e}Zd(){return!!this.Fd()&&(this.bd||this.fd||(this.bd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Qd(){const e=this.Ir.evaluationContexts;return e?.length?e.filter(t=>{const r=t&&typeof t=="string"&&t.trim().length>0;return r||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),r}):[]}Jd(){const e=this.Ir.flagKeys;if(!j(e))return e.filter(t=>{const r=t&&typeof t=="string"&&t.trim().length>0;return r||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),r})}initialize(){var e,t;const r=this.Ir,s=(e=(t=r.bootstrap)===null||t===void 0?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(s).length){var n,i;const o=(n=(i=r.bootstrap)===null||i===void 0?void 0:i.featureFlagPayloads)!==null&&n!==void 0?n:{},a=Object.keys(s).filter(l=>!j(s[l])).reduce((l,u)=>(l[u]=s[u],l),{}),c=Object.keys(o).filter(l=>a[l]).reduce((l,u)=>(l[u]=o[u],l),{});return this.Kd({featureFlags:a,featureFlagPayloads:c},void 0,{persist:!1})}}updateFlags(e,t,r){var s,n;const i=r?.merge&&(s=this.zd("$enabled_feature_flags"))!==null&&s!==void 0?s:{},o=r?.merge&&(n=this.zd("$feature_flag_payloads"))!==null&&n!==void 0?n:{},a=S(S({},i),e),c=S(S({},o),t),l={};for(const[u,p]of Object.entries(a))l[u]={key:u,enabled:xb(p),variant:Ob(p),reason:void 0,metadata:j(c?.[u])?void 0:{id:0,version:void 0,description:void 0,payload:c[u]}};this.Kd({flags:l})}get hasLoadedFlags(){return this.vd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this.zd(bi),t=this.zd(ds),r=this.zd(si);if(!r&&!t)return e||{};const s=Xe({},e||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])];for(const a of n){var i;const c=s[a],l=t?.[a],u=j(l)?(i=c?.enabled)!==null&&i!==void 0&&i:!!l,p=j(l)?c?.variant:typeof l=="string"?l:void 0,d=r?.[a],h=S(S({},c),{},{enabled:u,variant:u?p??c?.variant:void 0});var o;u!==c?.enabled&&(h.original_enabled=c?.enabled),p!==c?.variant&&(h.original_variant=c?.variant),d&&(h.metadata=S(S({},c?.metadata),{},{payload:d,original_payload:c==null||(o=c.metadata)===null||o===void 0?void 0:o.payload})),s[a]=h}return this.ld||(this.A.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:s}),this.ld=!0),s}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(r=>{const s=e[r];return{key:r,enabled:xb(s),variant:Ob(s),payload:Pb(t[r])}})}getFlagVariants(){const e=this.zd(Jr),t=this.zd(ds);if(!t)return e||{};const r=Xe({},e||{}),s=Object.keys(t);for(let n=0;s.length>n;n++)r[s[n]]=t[s[n]];return this.ld||(this.A.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this.ld=!0),r}getFlagPayloads(){const e=this.zd(Sn),t=this.zd(si);if(!t)return e||{};const r=Xe({},e||{}),s=Object.keys(t);for(let n=0;s.length>n;n++)r[s[n]]=t[s[n]];return this.ld||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:r}),this.ld=!0),r}reloadFeatureFlags(){this.gd||this.Ir.featureFlagsDisabled||this.kd()||(this.fd&&(this.md=!0),this.Xd||(this.dd.slice().forEach(e=>{try{e()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}}),this.Xd=setTimeout(()=>{this.Yd()},5)))}Hd(){clearTimeout(this.Xd),this.Xd=void 0}onReloading(e){return this.dd.push(e),()=>{this.dd=this.dd.filter(t=>t!==e)}}ensureFlagsLoaded(){this.vd||this.fd||this.Xd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.gd=e}resetFlagCallReported(){this.Lt(En)}Yd(e){this.Hd();const t=this.bo;if(!t||this.Ir.remoteRequestsDisabled||this.kd())return;if(this.fd)return void(this.md=!0);const r={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:S(S(S({},t.initialPersonProperties),this.zd("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.zd(kn),timezone:LR()};j(t.deviceId)||(r.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.Ir.featureFlagsDisabled)&&(r.disable_flags=!0);const s=this.Qd();s.length&&(r.evaluation_contexts=s);const n=this.Jd();j(n)||(r.flag_keys=n);const i=this.Ir.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(i?"&only_evaluate_survey_feature_flags=true":""),a=this.pd;this.fd=!0;const c=()=>{this.md&&(this.md=!1,this.Yd())},l=f=>{var m,v;const _=(m=f.json)!==null&&m!==void 0?m:{},b=f.statusCode!==200;if(this.fd=!1,a!==this.pd)return void c();if(this.tv(f.statusCode),b||this.md||(this.$anon_distinct_id=void 0),r.disable_flags&&!this.md)return;this.yd=!b;const T=[];f.error?T.push(f.error instanceof Error&&f.error.name==="AbortError"?"timeout":f.error instanceof Error?U0:"unknown_error"):f.statusCode!==200&&T.push(`api_error_${f.statusCode}`),_.errorsWhileComputingFlags&&T.push("errors_while_computing_flags");const O=!!(!((v=_.quotaLimited)===null||v===void 0)&&v.includes("feature_flags"));O&&T.push("quota_limited"),this.$t({[vc]:T}),O?this.A.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):r.disable_flags||this.Kd(_,b,{partialResponse:i}),c()},u=f=>{this.fd=!1,a===this.pd&&(this.$t({[vc]:[U0]}),this.A.error("Feature flag request failed",f),this.Wd()&&this.Nd(!0)),c()};let p=this.Ir.requestMaxRetries;const d=()=>p>0&&a===this.pd,h=()=>{if(a!==this.pd||!this.bo||this.Ir.remoteRequestsDisabled)return this.fd=!1,void c();try{t.sendRequest(o,{target:"flags",method:"POST",body:r,compression:this.Ir.compression,sentAt:"body",timeoutMs:this.Ir.requestTimeoutMs}).then(f=>{if((m=>r4.includes(m.statusCode)||(v=>v.statusCode===0&&v.error instanceof Error&&v.error.name==="AbortError")(m))(f)&&d())return p--,void setTimeout(h,500);l(f)}).catch(u)}catch(f){u(f)}};h()}kd(){return TR(this._d,3)}tv(e){this._d=AR(e,this._d,3,()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t={}){var r;if(t.fresh&&!this.yd)return;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlag for key "'+e+_h);if(this.Zd())return;const s=this.getFeatureFlagResult(e,t);return(r=s?.variant)!==null&&r!==void 0?r:s?.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this.yd)return;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlagResult for key "'+e+_h);if(this.Zd())return;const r=this.getFlagVariants(),s=e in r,n=r[e],i=this.getFlagPayloads()[e],o=String(n),a=this.zd("$feature_flag_request_id")||void 0,c=this.zd("$feature_flag_evaluated_at")||void 0;let l,u=this.zd("$flag_call_reported")||{};if(this.Ir.deduplicateCallsPerSession){var p;const J=(p=this.bo)===null||p===void 0?void 0:p.session.sessionId,ce=this.zd(Fa);J&&J!==ce&&(u={},l=J)}if(t.send_event||!("send_event"in t))if(e in u&&u[e].includes(o))l&&this.$t({[En]:u,[Fa]:l});else{var d,h,f,m,v,_,b,T,O,x,D,z;Se(u[e])?u[e].push(o):u[e]=[o],this.$t(S({[En]:u},l?{[Fa]:l}:{}));const J=this.getFeatureFlagDetails(e),ce=[...(d=this.zd("$feature_flag_errors"))!==null&&d!==void 0?d:[]];j(n)&&ce.push("flag_missing");const de={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:i??null,$feature_flag_request_id:a,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:(h=(f=this.Ir.bootstrap)===null||f===void 0||(f=f.featureFlags)===null||f===void 0?void 0:f[e])!==null&&h!==void 0?h:null,$feature_flag_bootstrapped_payload:(m=(v=this.Ir.bootstrap)===null||v===void 0||(v=v.featureFlagPayloads)===null||v===void 0?void 0:v[e])!==null&&m!==void 0?m:null,$used_bootstrap_value:!this.yd};j(J==null||(_=J.metadata)===null||_===void 0?void 0:_.has_experiment)||(de.$feature_flag_has_experiment=J.metadata.has_experiment),j(J==null||(b=J.metadata)===null||b===void 0?void 0:b.version)||(de.$feature_flag_version=J.metadata.version);const R=(T=J==null||(O=J.reason)===null||O===void 0?void 0:O.description)!==null&&T!==void 0?T:J==null||(x=J.reason)===null||x===void 0?void 0:x.code;var F;R&&(de.$feature_flag_reason=R),J!=null&&(D=J.metadata)!==null&&D!==void 0&&D.id&&(de.$feature_flag_id=J.metadata.id),j(J?.original_variant)&&j(J?.original_enabled)||(de.$feature_flag_original_response=j(J.original_variant)?J.original_enabled:J.original_variant),J!=null&&(z=J.metadata)!==null&&z!==void 0&&z.original_payload&&(de.$feature_flag_original_payload=J==null||(F=J.metadata)===null||F===void 0?void 0:F.original_payload),ce.length&&(de.$feature_flag_error=ce.join(",")),this.ev(de)}else l&&this.$t({[En]:u,[Fa]:l});return s?{key:e,enabled:!!n,variant:typeof n=="string"?n:void 0,payload:Pb(i)}:void 0}ev(e){try{var t;(t=this.bo)===null||t===void 0||t.capture("$feature_flag_called",e)}catch(r){this.A.error("Failed to capture feature flag call",r)}}getRemoteConfigPayload(e,t){this.iv(e,t)}iv(e,t){var r=this;return Ze(function*(){const s=r.bo;if(!s)return;const n={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},i=r.Qd();i.length&&(n.evaluation_contexts=i);const o=r.Jd();let a;j(o)||(n.flag_keys=o);try{var c;const l=(c=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:r.Ir.compression,sentAt:"body",timeoutMs:r.Ir.requestTimeoutMs})).json)===null||c===void 0?void 0:c.featureFlagPayloads;a=l?.[e]||void 0}catch(l){r.A.error("Remote config feature flag request failed",l);return}try{t(a)}catch(l){r.A.error("Remote config feature flag callback failed",l)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this.yd)return t.defaultValue;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+e+_h),t.defaultValue;const r=this.getFeatureFlag(e,t);return j(r)?t.defaultValue:!!r}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,r){this.Kd(e,t,r)}Kd(e,t,r){if(!this.bo)return;this.vd=!0;const s=((n,i={},o={},a={},c,l=$0)=>{const u=((T,O)=>{const x=T.flags;if(x){const D=Object.fromEntries(Object.keys(x).map(F=>{var J;return[F,(J=x[F].variant)!==null&&J!==void 0?J:x[F].enabled]})),z=Object.fromEntries(Object.keys(x).filter(F=>x[F].enabled).filter(F=>{var J;return!j((J=x[F].metadata)===null||J===void 0?void 0:J.payload)}).map(F=>{var J;return[F,(J=x[F].metadata)===null||J===void 0?void 0:J.payload]}));return S(S({},T),{},{featureFlags:D,featureFlagPayloads:z})}return T.featureFlags&&O.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),T})(n,l),p=u.flags,d=u.featureFlags,h=u.featureFlagPayloads;if(!d)return;const f=n.requestId,m=n.evaluatedAt;if(Se(d)){l.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const T={};if(d)for(let O=0;d.length>O;O++)T[d[O]]=!0;return{[js]:d,[Jr]:T,[Xa]:!1}}let v=d,_=h,b=p;if(c?.partialResponse){const T=Object.keys(v),O=_||{};v=S(S({},i),v),_=S(S({},o),O),T.forEach(x=>{x in O||_==null||delete _[x]}),b=S(S({},a),b)}else if(n.errorsWhileComputingFlags)if(p){const T=new Set(Object.keys(p).filter(x=>{var D;return!(!((D=p[x])===null||D===void 0)&&D.failed)}));v=S(S({},i),Object.fromEntries(Object.entries(v).filter(([x])=>T.has(x))));const O=Object.fromEntries(Object.entries(_||{}).filter(([x])=>T.has(x)));_=S(S({},o),O),T.forEach(x=>{x in O||_==null||delete _[x]}),b=S(S({},a),Object.fromEntries(Object.entries(b||{}).filter(([x])=>T.has(x))))}else v=S(S({},i),v),_=S(S({},o),_),b=S(S({},a),b);return S(S({[js]:Object.keys(z0(v)),[Jr]:v||{},[Sn]:_||{},[bi]:b||{},[Xa]:n.minimalFlagCalledEvents===!0},f?{[Si]:f}:{}),m?{[On]:m}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this.A);if(s)if(r?.persist===!1){const n=!j(this.bo.kv.get(Jr));this.Ud=s,n||this.$t(s)}else this.Dd(),this.Gd(s,e,!!r?.partialResponse),this.$t(s);else t&&this.Wd();t||(this.bd=!1),this.Nd(t)}override(e,t=!1){this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.nv(e)}nv(e){if(this.bo){if(e===!1)return this.Lt([ds,si]),this.Nd(),void Yn.info("All overrides cleared");if(Se(e))return this.$t({[ds]:q0(e)}),this.Nd(),void Yn.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t;const r=e;this.ld=!!((t=r.suppressWarning)!==null&&t!==void 0&&t);const s={},n=r.flags,i=r.payloads;n&&(s[ds]=Se(n)?q0(n):n),i&&(s[si]=i),Object.keys(s).length&&this.$t(s),n===!1&&i===!1?this.Lt([ds,si]):n===!1?this.Lt(ds):i===!1&&this.Lt(si),this.Nd(),n===!1?Yn.info("Flag overrides cleared"):n&&Yn.info("Flag overrides set",{flags:n}),i===!1?Yn.info("Payload overrides cleared"):i&&Yn.info("Payload overrides set",{payloads:i});return}if(e&&typeof e=="object")return this.$t({[ds]:e}),this.Nd(),void Yn.info("Flag overrides set",{flags:e});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.vd){const{flags:t,flagVariants:r}=this.sv();try{e(t,r)}catch(s){this.A.error("Error while running feature flags callback",s)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,r){var s;const n=(this.zd("$early_access_features")||[]).find(l=>l.flagKey===e),i={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:i};n&&(o.$early_access_feature_name=n.name),r&&(o.$feature_enrollment_stage=r);const a=S(S({},this.getFlagVariants()),{},{[e]:t});(s=this._instance)===null||s===void 0||(s=s.persistence)===null||s===void 0||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(i)}),this.$t({[js]:Object.keys(z0(a)),[Jr]:a,[wn]:S(S({},this.zd("$stored_person_properties")||{}),i)}),this.Nd();try{var c;(c=this.bo)===null||c===void 0||c.capture("$feature_enrollment_update",o)}catch(l){this.A.error("Failed to capture early access feature enrollment",l)}}getEarlyAccessFeatures(e,t=!1,r){const s=this.zd(Jf);!s||t?this.rv(e,r):e(s)}rv(e,t){var r=this;return Ze(function*(){const s=r.bo;if(!s)return;const n=t?`&${t.map(o=>`stage=${o}`).join("&")}`:"";let i;try{const o=yield s.sendRequest(`/api/early_access_features/?token=${s.projectToken}${n}`,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;i=o.json.earlyAccessFeatures,r.$t({[Jf]:i})}catch(o){r.A.error("Early access feature request failed",o);return}try{e(i)}catch(o){r.A.error("Early access feature callback failed",o)}})()}sv(){const e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(r=>t[r]),flagVariants:Object.keys(t).filter(r=>t[r]).reduce((r,s)=>(r[s]=t[s],r),{})}}Nd(e){this.Ld();const{flags:t,flagVariants:r}=this.sv();this.featureFlagEventHandlers.forEach(s=>{try{s(t,r,{errorsLoading:e})}catch(n){this.A.error("Error while running feature flags callback",n)}})}setPersonPropertiesForFlags(e,t=!0){this.ov(e,t)}ov(e,t=!0){const r=this.zd("$stored_person_properties")||{},s=e?.$set||(e?.$set_once?{}:e),n=e?.$set_once,i={};if(n)for(const o in n)({}).hasOwnProperty.call(n,o)&&(o in r||(i[o]=n[o]));this.$t({[wn]:S(S(S({},r),i),s)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const r=S({},this.zd("$stored_person_properties")||{});e.forEach(s=>{delete r[s]}),this.$t({[wn]:r}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(wn),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const r=this.zd("$stored_group_properties")||{},s=S({},r);for(const n of Object.keys(e))s[n]=S(S({},r[n]),e[n]);this.$t({[kn]:s}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this.zd("$stored_group_properties")||{};this.$t({[kn]:S(S({},t),{},{[e]:{}})})}else this.Lt(kn)}reset(){this.pd++,this.md=!1,this.ud={},this.hd={},this.Ud=void 0,this.vd=!1,this.gd=!1,this.yd=!1,this.$anon_distinct_id=void 0,this.Hd(),this.ld=!1,this._d=0}}},h4={sessionRecording:class{get Ir(){return this._instance.config}get Il(){return this._instance.persistence}get started(){var e;return!!(!((e=this.av)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this.lv==="awaiting_config"||this.lv==="missing_config"?this.lv:(e=(t=this.av)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this.lv}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.lv=mh,this.uv=void 0,this.hv=!1,this.Je=(()=>{var t,r;if(!W?.visibilityState||W.visibilityState==="visible")return!0;const s=L==null||(t=L.performance)===null||t===void 0||(r=t.getEntriesByType)===null||r===void 0?void 0:r.call(t,"visibility-state");return!s?.length||s.some(n=>n.name==="visible")})(),this.sn=()=>{var t,r;W?.visibilityState==="visible"&&(this.Je=!0,(t=this.av)===null||t===void 0||(r=t.setDocumentWasEverVisible)===null||r===void 0||r.call(t,!0))},!this._instance.sessionManager)throw Ls.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Ir.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');W!=null&&W.addEventListener&&ze(W,"visibilitychange",this.sn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.hv=!0,W==null||(t=W.removeEventListener)===null||t===void 0||t.call(W,"visibilitychange",this.sn),e?this.dv(!0):this.stopRecording()}get vv(){var e;const t=!!(!((e=this._instance.get_property("$session_recording_remote_config"))===null||e===void 0)&&e.enabled),r=!this.Ir.disable_session_recording,s=this.Ir.disable_session_recording||this._instance.consent.isOptedOut();return L&&t&&r&&!s}startIfEnabledOrStop(e){var t;if(this.hv||this.vv&&(!((t=this.av)===null||t===void 0)&&t.isStarted))return;const r=!j(Object.assign)&&!j(Array.from);this.vv&&r?(this.fv(e),Ls.info("starting")):(this.lv=mh,this.stopRecording())}fv(e){var t,r;if(this.vv)if(this.lv!=="awaiting_config"&&this.lv!=="missing_config"&&(this.lv=P0),(ge==null||(t=ge.__PosthogExtensions__)===null||t===void 0||(t=t.rrweb)===null||t===void 0?void 0:t.record)&&((r=ge.__PosthogExtensions__)===null||r===void 0?void 0:r.initSessionRecording))this.pv(e);else{var s,n;const i=this._instance.sessionManager;(s=ge.__PosthogExtensions__)===null||s===void 0||(n=s.loadExternalDependency)===null||n===void 0||n.call(s,this._instance,this.gv,o=>{if(!this.hv&&this.vv&&this._instance.sessionManager===i)return o?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Ls.error("could not load recorder",o)):void this.pv(e);this.lv="disabled"})}}stopRecording(){var e,t;(e=this.uv)===null||e===void 0||e.call(this),this.uv=void 0,(t=this.av)===null||t===void 0||t.stop()}dv(e=!1){var t,r;(t=this.uv)===null||t===void 0||t.call(this),this.uv=void 0,(r=this.av)===null||r===void 0||r.discard({discardProducerEvents:e})}mv(){var e,t;(e=this.Il)===null||e===void 0||e.unregister("$session_is_sampled"),(t=this.Il)===null||t===void 0||t.unregister("$replay_sample_rate")}yv(e,t){if(Te(e))return null;const r=lt(e)?e:parseFloat(e);return typeof(s=r)!="number"||!Number.isFinite(s)||0>s||s>1?(Ls.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):r;var s}bv(e){if(this.Il){var t,r;const s=this.Il,n=()=>{var i;const o=e.sessionRecording===!1?void 0:e.sessionRecording,a=this.yv((i=this.Ir.session_recording)===null||i===void 0?void 0:i.sampleRate,"session_recording.sampleRate"),c=this.yv(o?.sampleRate,"remote config sampleRate"),l=a??c;Te(l)&&this.mv();const u=o?.minimumDurationMilliseconds;s.register({[Ya]:S(S({cache_timestamp:Date.now(),enabled:!!o},o),{},{networkPayloadCapture:S({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:j(u)?null:u,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};n(),(t=this.uv)===null||t===void 0||t.call(this),this.uv=(r=this._instance.sessionManager)===null||r===void 0?void 0:r.onSessionId(n)}}onRemoteConfig(e){const t=e.ok?e.config:void 0;t&&"sessionRecording"in t?t.sessionRecording===!1?(this.bv(t),this.dv()):(this.bv(t),this.startIfEnabledOrStop()):(this.lv==="awaiting_config"&&(this.lv="missing_config",this._instance.register_for_session({[Sv]:!0}),Ls.warn("config refresh failed, recording will not start until page reload")),this.startIfEnabledOrStop())}log(e,t="log"){var r;!((r=this.av)===null||r===void 0)&&r.log?this.av.log(e,t):Ls.warn("log called before recorder was ready")}get gv(){var e,t;const r=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.get_property(Ya);return(r==null||(t=r.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}_v(){const e=this._instance.get_property(Ya);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(r){return Ls.warn("persisted remote config for session recording is invalid and will be ignored",r),!1}return!Te(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}pv(e){var t,r,s;if(!this.hv&&this.vv&&this._instance.sessionManager){if(!(!((t=ge.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return Ls.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[bv]:!0});var n;if(this.av||(this.av=(n=ge.__PosthogExtensions__)===null||n===void 0?void 0:n.initSessionRecording(this._instance,this.Je),this.av._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._v()){if(this.lv==="missing_config"||this.lv==="awaiting_config")return;this.lv="awaiting_config",Ls.info("persisted remote config is stale, requesting fresh config before starting"),new $R(this._instance).load();return}this.lv=P0,(r=(s=this.av).setDocumentWasEverVisible)===null||r===void 0||r.call(s,this.Je),this.av.start(e)}else this.lv=mh}onRRwebEmit(e){var t,r;(t=this.av)===null||t===void 0||(r=t.onRRwebEmit)===null||r===void 0||r.call(t,e)}overrideLinkedFlag(){var e,t;this.av||(t=this.Il)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this.av)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.av||(t=this.Il)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this.av)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,r;this.av||(r=this.Il)===null||r===void 0||r.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.av)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;const t={};for(const s of V3){var r;const n=(r=this._instance.sessionPersistence)===null||r===void 0?void 0:r.get_property(s);j(n)||(t[s]=n)}return S(S({},t),((e=this.av)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(e,t){var r;return!!(!((r=this.av)===null||r===void 0)&&r.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this.av)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},f4={autocapture:class extends z3{constructor(e){super(new F3(e)),this.instance=e}},historyAutocapture:class{constructor(e){this.wv=!1,this._instance=e,this.Sv=this.xv()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this.Cv();return!!(e.path||e.search||this.$v(e))}startIfEnabled(){this.isEnabled&&(X.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Sv=this.xv(),this.startIfEnabled()}stop(){this.Tv&&this.Tv(),this.Tv=void 0,this.Iv&&this.Iv(),this.Iv=void 0,X.info("History API monitoring stopped")}monitorHistoryChanges(){L&&L.history&&(this.Mv("pushState"),this.Mv("replaceState"),this.Ev(),this.$v()&&this.Pv())}Mv(e){var t;if(!L||!((t=L.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;const r=this;kc(L.history,e,s=>function(n,i,o){var a;r.Rv(o)&&r.Av(),s.call(this,n,i,o),r.Fv(e,!r.wv&&(L==null||(a=L.event)===null||a===void 0?void 0:a.type)!=="popstate")})}xv(){const e=L?.location;if(e?.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}Cv(){const e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:Le(e)?e:{}}$v(e=this.Cv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}Ov(e){const t=this.Cv(),r=this.Sv;return!(!r||!(t.path&&e.pathname!==r.pathname||t.search&&e.search!==r.search||this.$v(t)&&e.hash!==r.hash))}Fv(e,t=!1){try{t||this.Av();const r=this.xv();if(!r)return;if(this.Ov(r)){const s=()=>this._instance.capture(kv,{navigation_type:e});t?(this.Dv=s,Promise.resolve().then(()=>this.Av())):s()}this.Sv=r}catch(r){X.error(`Error capturing ${e} pageview`,r)}}Rv(e){var t,r;return!(Te(e)||!L)&&((t=Zs(String(e)))===null||t===void 0?void 0:t.href)!==((r=L.location)===null||r===void 0?void 0:r.href)}Av(){const e=this.Dv;if(e){this.Dv=void 0,this.wv=!0;try{e()}catch(t){X.error("Error capturing deferred pageview",t)}finally{this.wv=!1}this.Sv=this.xv()}}Ev(){if(this.Tv)return;const e=()=>{this.Fv("popstate")};ze(L,"popstate",e),this.Tv=()=>{L&&L.removeEventListener("popstate",e)}}Pv(){if(this.Iv)return;const e=()=>{this.Fv("hashchange")};ze(L,"hashchange",e),this.Iv=()=>{L&&L.removeEventListener("hashchange",e)}}},heatmaps:class{get Ir(){return this.instance.config}constructor(e){var t;this.Lv=!1,this.ko=!1,this.Nv=null,this.instance=e,this.Lv=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[Vf]),this.rageclicks=new iC(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return Le(this.Ir.capture_heatmaps)&&this.Ir.capture_heatmaps.flush_interval_milliseconds&&(e=this.Ir.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Te(this.Ir.capture_heatmaps)?Te(this.Ir.enable_heatmaps)?this.Lv:this.Ir.enable_heatmaps:this.Ir.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ko)return;G3.info("starting..."),this.qv(),this.sn()}else{var e;clearInterval((e=this.Nv)!==null&&e!==void 0?e:void 0),this.jv(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("heatmaps"in t))return;const r=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Vf]:r}),this.Lv=r,this.startIfEnabled()}getAndClearBuffer(){const e=this.Rt;return this.Rt=void 0,e}Bv(e){gh(e.originalEvent)&&this.Mr(e.originalEvent,"deadclick")}sn(){this.Nv&&clearInterval(this.Nv),this.Nv=W?.visibilityState==="visible"?setInterval(this.yl.bind(this),this.flushIntervalMilliseconds):null}qv(){L&&W&&(this.Hv=this.yl.bind(this),ze(L,xu,this.Hv),this.zv=e=>this.Mr(e||L?.event),ze(W,"click",this.zv,{capture:!0}),this.Uv=e=>this.Wv(e||L?.event),ze(W,"mousemove",this.Uv,{capture:!0}),this.Vv=new s0(this.instance,VV,this.Bv.bind(this)),this.Vv.startIfEnabledOrStop(),this.Gv=this.sn.bind(this),ze(W,_c,this.Gv),this.ko=!0)}jv(){var e;L&&W&&(this.Hv&&L.removeEventListener(xu,this.Hv),this.zv&&W.removeEventListener("click",this.zv,{capture:!0}),this.Uv&&W.removeEventListener("mousemove",this.Uv,{capture:!0}),this.Gv&&W.removeEventListener(_c,this.Gv),clearTimeout(this.Zv),(e=this.Vv)===null||e===void 0||e.stop(),this.ko=!1)}Qv(e,t){const r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),i=(function(o,a,c){let l=o;for(;l&&As(l)&&!Ft(l,"body");){if(l===c)return!1;let h;try{var u,p,d;h=(u=(p=(d=l.ownerDocument)===null||d===void 0?void 0:d.defaultView)!==null&&p!==void 0?p:L)===null||u===void 0?void 0:u.getComputedStyle(l).position}catch{return!1}if(be(a,h))return!0;l=_R(l)}return!1})(Qa(e),["fixed","sticky"],n);return{x:e.clientX+(i?0:s),y:e.clientY+(i?0:r),target_fixed:i,type:t}}Mr(e,t="click"){var r;if(Wb(e.target)||!gh(e))return;const s=this.Qv(e,t);(r=this.rageclicks)!==null&&r!==void 0&&r.isRageClick(e.clientX,e.clientY,new Date().getTime())&&bR(Qa(e),this.instance.config.rageclick)&&this.Zs(S(S({},s),{},{type:"rageclick"})),this.Zs(s)}Wv(e){!Wb(e.target)&&gh(e)&&(clearTimeout(this.Zv),this.Zv=setTimeout(()=>{this.Zs(this.Qv(e,"mousemove"))},500))}Zs(e){if(!L)return;const t=this.Ir.disable_capture_url_hashes?qn(L.location.href):L.location.href,r=this.Ir.custom_personal_data_properties,s=this.Ir.mask_personal_data_properties?[...Fo,...r||[]]:[],n=Sc(t,s,wc);this.Rt=this.Rt||{},this.Rt[n]||(this.Rt[n]=[]),this.Rt[n].push(e)}yl(){this.Rt&&!dr(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:s0,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.Lv=!1,this.ko=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Jv=()=>{clearTimeout(this.Kv),this.Kv=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",S({$current_url:this.Rt.url},this.Rt.metrics.reduce((r,s)=>S(S({},r),{},{[`$web_vitals_${s.name}_event`]:S({},s),[`$web_vitals_${s.name}_value`]:s.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Xv=r=>{var s;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Te(r?.name)||Te(r?.value))return void Jn.error("Invalid metric received",r);const n=typeof r.navigationURL=="string"?r.navigationURL:void 0,i=this.Yv(n);if(j(i))return;const o=lt(r.navigationId)||typeof r.navigationId=="string"?`navigation:${r.navigationId}`:`url:${i}`;if(this.tf&&r.value>=this.tf)return void Jn.error("Ignoring metric with value >= "+this.tf,r);this.Rt.navigationKey!==o&&(this.Jv(),this.Kv=setTimeout(this.Jv,this.flushToCaptureTimeoutMs)),j(this.Rt.navigationKey)&&(this.Rt.navigationKey=o,this.Rt.url=i),this.Rt.firstMetricTimestamp=j(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const a=(s=this._instance.sessionManager)===null||s===void 0?void 0:s.checkAndGetSessionAndWindowId(!0),c=S(S(S({},r),n?{navigationURL:i}:{}),{},{$current_url:i,timestamp:Date.now()});if(delete c.entries,Le(r.attribution)&&this.attributionMetrics.indexOf(r.name)>-1){const l={};for(const u of B3){const p=u==="url"&&typeof r.attribution[u]=="string"?this.Yv(r.attribution[u]):r.attribution[u];j(p)||(l[u]=p)}c.attribution=l}else delete c.attribution;j(a)||(c.$session_id=a.sessionId,c.$window_id=a.windowId),this.Rt.metrics.push(c),this.Rt.metrics.length===this.allowedMetrics.length&&this.Jv()},this.ef=()=>{if(this.ko)return;let r,s,n,i,o=!1;const a=ge.__PosthogExtensions__,c=a?.postHogWebVitalsCallbacksByFlavor,l=c?.[this.if]||(this.if==="web-vitals"&&j(c)?a?.postHogWebVitalsCallbacks:void 0);if(!j(l)){const d=l.withoutAttribution,h=this.attributionMetrics;o=!j(d),r=h.indexOf("LCP")>-1?l.onLCP:d?.onLCP||l.onLCP,s=h.indexOf("CLS")>-1?l.onCLS:d?.onCLS||l.onCLS,n=h.indexOf("FCP")>-1?l.onFCP:d?.onFCP||l.onFCP,i=h.indexOf("INP")>-1?l.onINP:d?.onINP||l.onINP}if(!(r&&s&&n&&i))return void Jn.error("web vitals callbacks not loaded - not starting");const u={reportSoftNavs:this.useSoftNavs},p=o&&this.attributionMetrics.indexOf("INP")>-1?S(S({},u),{},{includeProcessedEventEntries:!1}):u;this.allowedMetrics.indexOf("LCP")>-1&&r(this.Xv.bind(this),u),this.allowedMetrics.indexOf("CLS")>-1&&s(this.Xv.bind(this),u),this.allowedMetrics.indexOf("FCP")>-1&&n(this.Xv.bind(this),u),this.allowedMetrics.indexOf("INP")>-1&&i(this.Xv.bind(this),p),this.ko=!0},this.Lv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[Kf]),this.startIfEnabled()}get nf(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const r=Le(this.nf)?(e=this.nf)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return Te(r)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props.$web_vitals_allowed_metrics)||C0:r}get flushToCaptureTimeoutMs(){return(Le(this.nf)?this.nf.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=Le(this.nf)?this.nf.web_vitals_attribution:void 0;return tr(e)?e?C0:[]:Se(e)?e:H3}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=Le(this.nf)?this.nf.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get tf(){const e=Le(this.nf)&<(this.nf.__web_vitals_max_value)?this.nf.__web_vitals_max_value:R0;return e>0&&6e4>=e?R0:e}get isEnabled(){const e=st?.protocol;if(e!=="http:"&&e!=="https:")return Jn.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=Le(this.nf)?this.nf.web_vitals:tr(this.nf)?this.nf:void 0;return tr(t)?t:this.Lv}startIfEnabled(){this.isEnabled&&!this.ko&&(Jn.info("enabled, starting..."),this.Ho(this.ef))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const r=Le(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=Le(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Kf]:r}),this._instance.persistence.register({[GI]:s})),this.Lv=r,this.startIfEnabled()}get if(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ho(e){var t;const r=ge.__PosthogExtensions__,s=this.if,n=r?.postHogWebVitalsCallbacksByFlavor;n?.[s]||s==="web-vitals"&&j(n)&&r?.postHogWebVitalsCallbacks?e():r==null||(t=r.loadExternalDependency)===null||t===void 0||t.call(r,this._instance,s,i=>{i?Jn.error("failed to load script",i):e()})}Yv(e){const t=e||L?.location.href;if(!t)return void Jn.error("Could not determine current URL");const r=this._instance.config.disable_capture_url_hashes?qn(t):t,s=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Fo,...s||[]]:[];return Sc(r,n,wc)}}},m4={exceptionObserver:class{constructor(e){var t;this.ef=()=>{var r;if(!L||!this.isEnabled||!(!((r=ge.__PosthogExtensions__)===null||r===void 0)&&r.errorWrappingFunctions))return;const s=ge.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=ge.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=ge.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.sf&&this.Ir.capture_unhandled_errors&&(this.sf=s(this.captureException.bind(this))),!this.rf&&this.Ir.capture_unhandled_rejections&&(this.rf=n(this.captureException.bind(this))),!this.af&&this.Ir.capture_console_errors&&(this.af=i(this.captureException.bind(this)))}catch(o){Pa.error("failed to start",o),this.lf()}},this._instance=e,this.uf=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[Gf]),this.wt=new dB(S(S({},(function(r={}){var s,n,i,o;return{refillRate:(s=(n=r.exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:r.__exceptionRateLimiterRefillRate)!==null&&s!==void 0?s:1,bucketSize:(i=(o=r.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:r.__exceptionRateLimiterBucketSize)!==null&&i!==void 0?i:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,A:Pa})),this.Ir=this.hf(),this.startIfEnabledOrStop()}hf(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Le(e)?t=S(S({},t),e):(j(e)?this.uf:e)&&(t=S(S({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Ir.capture_console_errors||this.Ir.capture_unhandled_errors||this.Ir.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Pa.info("enabled"),this.lf(),this.Ho(this.ef)):this.lf()}Ho(e){var t,r,s;!((t=ge.__PosthogExtensions__)===null||t===void 0)&&t.errorWrappingFunctions?e():(r=ge.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this._instance,"exception-autocapture",n=>{if(n)return Pa.error("failed to load script",n);e()})}lf(){var e,t,r;(e=this.sf)===null||e===void 0||e.call(this),this.sf=void 0,(t=this.rf)===null||t===void 0||t.call(this),this.rf=void 0,(r=this.af)===null||r===void 0||r.call(this),this.af=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this.uf=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Gf]:this.uf}),this.Ir=this.hf(),this.startIfEnabledOrStop())}onConfigChange(){this.Ir=this.hf()}captureException(e){try{var t,r,s;const n=(t=e==null||(r=e.$exception_list)===null||r===void 0||(r=r[0])===null||r===void 0?void 0:r.type)!==null&&t!==void 0?t:"Exception";if(this.wt.consumeRateLimit(n))return void Pa.info("Skipping exception capture because of client rate limiting.",{exception:n});(s=this._instance.exceptions)===null||s===void 0||s.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){var t,r;this.cf=[],this.df=new kB([new UB,new WB,new zB,new qB,new VB,new BB,new jB,new GB],(function(s,...n){return(i,o=0)=>{const a=[],c=i.split(`
|
|
62
|
+
`),l=Math.min(c.length,o+1e3),u=[];for(let h=o;l>h;h++){const f=c[h];if(f.length>1024)continue;const m=Cb.test(f)?f.replace(Cb,"$1"):f;if(!m.match(/\S*Error: /)){for(const v of n){const _=v(m,s);if(_){a.push(_);const b=LB(a);if(b){for(let T=u.length-1;T>=0;T--){const O=u[T];if(b.start>=O.start+O.length)break;u.pop()}u.push(b)}break}}if($B(a,u)>=50)break}}const p=[...u].sort((h,f)=>f.start-h.start),d=p[p.length-1];if(d){const h=RI(a,d);a.splice(d.start-h,h);for(const f of p)f.start-=h}for(const h of p)NB(a,h);return u.some(h=>h.start===0&&a.length===h.length)&&(function(h){const f=h.map(v=>`${v.function}|${v.filename}|${v.lineno}|${v.colno}|${v.module}`);let m=0;for(let v=1;f.length>v;v++)DB(f,v,m)&&(m=v);h.push(...h.splice(0,m))})(a),(function(h){if(!h.length)return[];const f=Array.from(h);return f.reverse(),f.slice(0,50).map(m=>{return S(S({},m),{},{filename:m.filename||(v=f,v[v.length-1]||{}).filename,function:m.function||"?"});var v})})(a)}})("web:javascript",PB,MB)),this._instance=e,this.cf=(t=(r=this._instance.persistence)===null||r===void 0?void 0:r.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.vf=Au(this.ff()),this.pf=new JB(this.vf)}onConfigChange(){this.vf=Au(this.ff()),this.pf.setConfig(this.vf)}onRemoteConfig(e){var t,r,s;if(!e.ok)return;const n=e.config;if(!("errorTracking"in n))return;const i=(t=(r=n.errorTracking)===null||r===void 0?void 0:r.suppressionRules)!==null&&t!==void 0?t:[],o=(s=n.errorTracking)===null||s===void 0?void 0:s.captureExtensionExceptions;this.cf=i,this._instance.persistence&&this._instance.persistence.register({[BI]:this.cf,[Wf]:o})}get gf(){var e;const t=!!this._instance.get_property(Wf),r=this._instance.config.error_tracking.captureExtensionExceptions;return(e=r??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.df.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}addExceptionStep(e,t){if(this.vf.enabled)try{if(!Pe(e)||e.trim().length===0)return void jr.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:r,droppedKeys:s}=(function(n){if(!n)return{sanitizedProperties:{},droppedKeys:[]};const i=[];return{sanitizedProperties:Object.keys(n).reduce((o,a)=>KB.has(a)?(i.push(a),o):(o[a]=n[a],o),{}),droppedKeys:i}})(this.mf(t));s.length>0&&jr.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.pf.add(S({[Eu]:e,[Tu]:new Date().toISOString()},r))}catch(r){jr.error("Failed to add exception step. Ignoring breadcrumb.",r)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this.yf(t)){if(this.bf(t))return this._f("Exception dropped: matched a suppression rule"),void jr.info("Skipping exception capture because a suppression rule matched");if(!this.gf&&this.wf(t))return this._f("Exception dropped: thrown by a browser extension"),void jr.info("Skipping exception capture because it was thrown by an extension");if(!this.gf&&this.kf(t))return this._f("Exception dropped: thrown by an injected browser script"),void jr.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Sf(t))return this._f("Exception dropped: thrown by the PostHog SDK"),void jr.info("Skipping exception capture because it was thrown by the PostHog SDK")}const r=this.vf.enabled&&Te(e.$exception_steps)?this.xf(e):e,s=(function(){const n=globalThis._posthogReleaseId;return typeof n=="string"&&n.length>0?n:void 0})();s&&(r.$release_id=s);try{const n=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",fh:!0});return n&&this.pf.clear(),n}catch(n){F0(n)||jr.error("Failed to capture exception event. Dropping this exception.",n),this.pf.clear();return}}catch(t){F0(t)||jr.error("Failed to process exception event. Ignoring this exception.",t);return}}xf(e){try{const t=this.pf.getAttachable();return t.length===0?e:S(S({},e),{},{$exception_steps:t})}catch(t){return jr.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_f(e){this.vf.enabled&&this.pf.add({[Eu]:e,[Tu]:new Date().toISOString()})}mf(e){return Le(e)?S({},e):{}}ff(){var e,t;return(e=(t=this._instance.config.error_tracking)===null||t===void 0?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}bf(e){if(e.length===0)return!1;try{const t=e.reduce((r,{type:s,value:n})=>(Pe(s)&&s.length>0&&r.$exception_types.push(s),Pe(n)&&n.length>0&&r.$exception_values.push(n),r),{$exception_types:[],$exception_values:[]});return this.cf.some(r=>{const s=r.values.map(n=>{const i=tC[n.operator],o=t[n.key];if(!i||!o)return!1;const a=Se(n.value)?n.value:[n.value];return a.length>0&&i(a,o)});return r.type==="OR"?s.some(Boolean):s.every(Boolean)})}catch(t){return jr.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}wf(e){const t=e.flatMap(s=>{var n,i;return(n=(i=s.stacktrace)===null||i===void 0?void 0:i.frames)!==null&&n!==void 0?n:[]}),r=t.filter(({filename:s})=>!!s&&n4.some(n=>s.startsWith(n)));return r.length!==0&&(!r.every(({filename:s})=>!!s&&s.startsWith(lm))||e.some(({type:s,value:n})=>s==="NoResponse"||Pe(n)&&s4.some(({value:i,exact:o})=>o?n===i:n.includes(i)))&&!t.some(({in_app:s,filename:n})=>s&&!n?.startsWith(lm)))}kf(e){return e.some(({value:t})=>Pe(t)&&i4.some(r=>t.includes(r)))}Sf(e){if(e.length>0){var t,r,s,n;const i=(t=(r=e[0].stacktrace)===null||r===void 0?void 0:r.frames)!==null&&t!==void 0?t:[],o=i[i.length-1];return(s=o==null||(n=o.filename)===null||n===void 0?void 0:n.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}yf(e){return!Te(e)&&Se(e)}}},g4=S({productTours:class{get Il(){return this._instance.persistence}constructor(e){this.Cf=null,this.$f=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if("productTours"in t){var r,s;if(this.Il&&this.Il.register({[_v]:!!t.productTours}),!vh(this._instance))return!this.Cf&&Te((r=this.Il)===null||r===void 0?void 0:r.props.ph_product_tours)||Ol.info("product tours disabled; stopping and clearing cached tours"),(s=this.Cf)===null||s===void 0||s.stop(),this.Cf=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Cf&&vh(this._instance)&&this.Ho(()=>this.Tf())}Ho(e){var t,r,s;!((t=ge.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(r=ge.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this._instance,"product-tours",n=>{n?Ol.error("Could not load product tours script",n):e()})}Tf(){var e;!this.Cf&&(e=ge.__PosthogExtensions__)!==null&&e!==void 0&&e.generateProductTours&&(this.Cf=ge.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(Se(this.$f)&&!t)return void e(this.$f,{isLoaded:!0});const r=this.Il;if(r){const s=r.props[Yf];if(Se(s)&&!t)return this.$f=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:s=>{if(!vh(this._instance))return void e([],{isLoaded:!0});const n=s.statusCode;if(n!==200||!s.json){const o=`Product Tours API could not be loaded, status: ${n}`;n===0?s.error||Ol.warn(o):Ol.error(o),e([],{isLoaded:!1,error:o});return}const i=Se(s.json.product_tours)?s.json.product_tours:[];this.$f=i,r&&r.register({[Yf]:i}),e(i,{isLoaded:!0})}})}getActiveProductTours(e){Te(this.Cf)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Cf.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Cf)===null||t===void 0||t.showTourById(e)}previewTour(e){this.Cf?this.Cf.previewTour(e):this.Ho(()=>{var t;this.Tf(),(t=this.Cf)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.Cf)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Cf)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.Cf)===null||e===void 0||e.previousStep()}clearCache(){var e;this.$f=null,(e=this.Il)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.Cf)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.Cf)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Cf)===null||t===void 0||t.cancelPendingTour(e)}}},Vd),v4={siteApps:class{constructor(e){this._instance=e,this.If=0,this.Mf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ef(e,t){if(!t)return;const r=this.globalsForEvent(t);this.Mf.push(r),this.Mf.length>1e3&&(this.Mf=this.Mf.slice(10))}get siteAppLoaders(){var e;return(e=ge._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.siteApps}initialize(){if(this.isEnabled){const e=this._instance._addCaptureHook(this.Ef.bind(this));this.Pf=()=>{e(),this.Mf=[],this.Pf=void 0}}}globalsForEvent(e){var t,r,s,n,i,o,a;if(!e)throw new Error("Event payload is required");const c={},l=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(const[h,f]of Object.entries(u))c[h]={id:l[h],type:h,properties:f};const{$set_once:p,$set:d}=e;return{event:S(S({},OI(e,W3)),{},{properties:S(S(S({},e.properties),d?{$set:S(S({},(t=(r=e.properties)===null||r===void 0?void 0:r.$set)!==null&&t!==void 0?t:{}),d)}:{}),p?{$set_once:S(S({},(s=(n=e.properties)===null||n===void 0?void 0:n.$set_once)!==null&&s!==void 0?s:{}),p)}:{}),elements_chain:(i=(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)!==null&&i!==void 0?i:"",distinct_id:(a=e.properties)===null||a===void 0?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}Rf(e){var t;const r=(t=e.tagName)===null||t===void 0?void 0:t.toLowerCase();return r==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(cs.error("prepare_external_dependency_stylesheet returned null"),null):r==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(cs.error("prepare_external_dependency_script returned null"),null):e}Af(){var e,t,r,s,n,i,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const c=W?.defaultView,l=c==null||(e=c.Node)===null||e===void 0?void 0:e.prototype;if(!c||!l)return()=>{};if(this.If++,this.Ff)return this.Of();const u=[],p=this,d=new WeakSet,h=(v,_,b)=>{if(!v?.[_])return;const T=v[_];v[_]=b(T),u.push(()=>{v[_]=T})},f=v=>{if(d.has(v))return v;const _=p.Rf(v);return _&&d.add(_),_},m=v=>v.map(_=>typeof _=="string"?_:f(_)).filter(_=>!nt(_));return h(l,"appendChild",v=>function(_){const b=f(_);return b?v.call(this,b):_}),h(l,"insertBefore",v=>function(_,b){const T=f(_);return T?v.call(this,T,b):_}),h(l,"replaceChild",v=>function(_,b){const T=f(_);return T?v.call(this,T,b):b}),[(t=c.Element)===null||t===void 0?void 0:t.prototype,(r=c.Document)===null||r===void 0?void 0:r.prototype,(s=c.DocumentFragment)===null||s===void 0?void 0:s.prototype].forEach(v=>{h(v,"append",_=>function(...b){return _.apply(this,m(b))}),h(v,"prepend",_=>function(...b){return _.apply(this,m(b))})}),[(n=c.Element)===null||n===void 0?void 0:n.prototype,(i=c.CharacterData)===null||i===void 0?void 0:i.prototype,(o=c.DocumentType)===null||o===void 0?void 0:o.prototype].forEach(v=>{h(v,"before",_=>function(...b){return _.apply(this,m(b))}),h(v,"after",_=>function(...b){return _.apply(this,m(b))}),h(v,"replaceWith",_=>function(...b){const T=m(b);return b.length&&!T.length?void 0:_.apply(this,T)})}),h((a=c.Element)===null||a===void 0?void 0:a.prototype,"insertAdjacentElement",v=>function(_,b){const T=f(b);return T?v.call(this,_,T):null}),this.Ff=()=>{u.forEach(v=>v()),this.Ff=void 0},this.Of()}Of(){let e=!1;return()=>{var t;e||(e=!0,this.If--,this.If===0&&((t=this.Ff)===null||t===void 0||t.call(this)))}}Df(e,t=!0){const r=this.Af();try{const s=e(r);return t&&r(),s}catch(s){throw r(),s}}setupSiteApp(e){const t=this.apps[e.id],r=()=>{var i;!t.errored&&this.Mf.length&&(cs.info(`Processing ${this.Mf.length} events for site app with id ${e.id}`),this.Mf.forEach(o=>this.Df(()=>{var a;return(a=t.processEvent)===null||a===void 0?void 0:a.call(t,o)})),t.processedBuffer=!0),Object.values(this.apps).every(o=>o.processedBuffer||o.errored)&&((i=this.Pf)===null||i===void 0||i.call(this))};let s=!1;const n=i=>{t.errored=!i,t.loaded=!0,cs.info(`Site app with id ${e.id} ${i?"loaded":"errored"}`),s&&r()};try{const{processEvent:i}=this.Df(o=>e.init({posthog:this._instance,callback(a){o(),n(a)}}),!1);i&&(t.processEvent=i),s=!0}catch(i){cs.error(x0+e.id,i),n(!1)}if(s&&t.loaded)try{r()}catch(i){cs.error(`Error while processing buffered events PostHog app with config id ${e.id}`,i),t.errored=!0}}Lf(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}Nf(e){if(Object.keys(this.apps).length===0)return;const t=this.globalsForEvent(e);for(const r of Object.values(this.apps))try{this.Df(()=>{var s;return(s=r.processEvent)===null||s===void 0?void 0:s.call(r,t)})}catch(s){cs.error(`Error while processing event ${e.event} for site app ${r.id}`,s)}}onRemoteConfig(e){var t,r,s;if(!((t=this.siteAppLoaders)===null||t===void 0)&&t.length)return this.isEnabled?(this.Lf(),void this._instance.on("eventCaptured",a=>this.Nf(a))):void cs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.Pf)===null||r===void 0||r.call(this),!e.ok)return;const n=e.config;if(!((s=n.siteApps)===null||s===void 0)&&s.length)if(this.isEnabled)for(const{id:a,url:c}of n.siteApps){var i,o;ge[`__$$ph_site_app_${a}`]=this._instance,(i=ge.__PosthogExtensions__)===null||i===void 0||(o=i.loadSiteApp)===null||o===void 0||o.call(i,this._instance,c,l=>{if(l)return cs.error(x0+a,l)})}else cs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},_4={tracingHeaders:class{constructor(e){this._instance=e,this.qf=void 0,this.jf=void 0,this.Bf=void 0,this.ef=()=>{const t=this.Hf();var r,s;t?(j(this.qf)&&(this.qf=(r=ge.__PosthogExtensions__)===null||r===void 0||(r=r.tracingHeadersPatchFns)===null||r===void 0?void 0:r._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),j(this.jf)&&(this.jf=(s=ge.__PosthogExtensions__)===null||s===void 0||(s=s.tracingHeadersPatchFns)===null||s===void 0?void 0:s._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.lf()}}initialize(){this.startIfEnabledOrStop()}Ho(e){var t,r,s;!((t=ge.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(r=ge.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this._instance,"tracing-headers",n=>{if(n)return j3.error("failed to load script",n);e()})}zf(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}Hf(){const e=this.zf();return Se(e)?(Se(this.Bf)?this.Bf.splice(0,this.Bf.length,...e):this.Bf=[...e],e.length>0?this.Bf:void 0):(Se(this.Bf)&&this.Bf.splice(0),this.Bf=e||void 0,this.Bf)}lf(){var e,t;(e=this.qf)===null||e===void 0||e.call(this),(t=this.jf)===null||t===void 0||t.call(this),this.qf=void 0,this.jf=void 0}startIfEnabledOrStop(){this.Hf()?this.Ho(this.ef):this.lf()}}},y4=S({surveys:class extends K3{constructor(e){var t;super(new Q3(e),(t=e,{get projectToken(){return t.config.token},kv:new Z3(t)})),this._instance=e}Vh(e,t){const r=t.query?jc(e,t.query):e;return new Promise(s=>{var n;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor((n=t.target)!==null&&n!==void 0?n:"api",r),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:s})})}}},Vd),b4={toolbar:class{constructor(e){this.instance=e}Uf(e){ge.ph_toolbar_state=e}Wf(){var e;return(e=ge.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,r=void 0){var s,n;if(Zf(this.instance.config)||!L||!W)return!1;e=(s=e)!==null&&s!==void 0?s:L.location,r=(n=r)!==null&&n!==void 0?n:L.history;try{if(!t){try{L.localStorage.setItem("test","test"),L.localStorage.removeItem("test")}catch{return!1}t=L?.localStorage}const i=e4||Mu(e.hash,"__posthog")||Mu(e.hash,"state");let o;const a=i?Tb(()=>JSON.parse(atob(decodeURIComponent(i))))||Tb(()=>JSON.parse(decodeURIComponent(i))):null;return a&&a.action==="ph_authorize"?(o=a,o.source="url",o&&Object.keys(o).length>0&&(a.desiredHash?e.hash=a.desiredHash:r?r.replaceState(r.state,"",e.pathname+e.search):e.hash="")):(o=JSON.parse(t.getItem(M0)||"{}"),o.source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token||(this.loadToolbar(o),0))}catch{return!1}}Vf(e){const t=ge.ph_load_toolbar||ge.ph_load_editor;!Te(t)&&kt(t)?t(e,this.instance):L0.warn("No toolbar load function found")}loadToolbar(e){const t=!!W?.getElementById("__POSTHOG_TOOLBAR__");if(!L||t)return!1;const r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=S(S({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(L.localStorage.setItem(M0,JSON.stringify(S(S({},s),{},{source:void 0}))),this.Wf()===2)this.Vf(s);else if(this.Wf()===0){var n,i;this.Uf(1),(n=ge.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this.instance,"toolbar",o=>{if(o)return L0.error("[Toolbar] Failed to load",o),void this.Uf(0);this.Uf(2),this.Vf(s)}),ze(L,"turbolinks:load",()=>{this.Uf(0),this.loadToolbar(s)})}return!0}Gf(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,r=void 0){return this.maybeLoadToolbar(e,t,r)}}},S4=S({experiments:class Yt{get Ir(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(r=!1)=>{this.getWebExperiments(s=>{Yt.Zf("retrieved web experiments from the server"),this.Qf=new Map,s.forEach(n=>{if(n.feature_flag_key){var i;this.Qf&&(Yt.Zf("setting flag key ",n.feature_flag_key," to web experiment ",n),(i=this.Qf)===null||i===void 0||i.set(n.feature_flag_key,n));const o=this._instance.getFeatureFlag(n.feature_flag_key);Pe(o)&&n.variants[o]&&this.Jf(n.name,o,n.variants[o].transforms)}else if(n.variants)for(const o in n.variants){const a=n.variants[o];Yt.Kf(a,this._instance)&&this.Jf(n.name,o,a.transforms)}})},r)},this._instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}initialize(){}onFeatureFlags(t){if(this._is_bot())Yt.Zf(j0);else if(!this.Ir.disable_web_experiments){if(Te(this.Qf))return this.Qf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Yt.Zf("applying feature flags",t),t.forEach(r=>{var s;if(this.Qf&&(!((s=this.Qf)===null||s===void 0)&&s.has(r))){var n;const i=this._instance.getFeatureFlag(r),o=(n=this.Qf)===null||n===void 0?void 0:n.get(r);i&&o!=null&&o.variants[i]&&this.Jf(o.name,i,o.variants[i].transforms)}})}}previewWebExperiment(){const t=Yt.getWindowLocation();if(t?.search){const r=zo(t?.search,"__experiment_id"),s=zo(t?.search,"__experiment_variant");r&&s&&(Yt.Zf(`previewing web experiments ${r} && ${s}`),this.getWebExperiments(n=>{this.Xf(parseInt(r),s,n)},!1,!0))}}loadIfEnabled(){this.Ir.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,r,s){if(this.Ir.disable_web_experiments&&!s)return t([]);const n=this._instance.get_property("$web_experiments");if(n&&!r)return t(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Ir.token}`),method:"GET",timestampMode:"query",callback:i=>t(i.statusCode===200&&i.json&&i.json.experiments||[])})}Xf(t,r,s){const n=s.filter(i=>i.id===t);n&&n.length>0&&(Yt.Zf(`Previewing web experiment [${n[0].name}] with variant [${r}]`),this.Jf(n[0].name,r,n[0].variants[r].transforms))}static Kf(t,r){return!Te(t.conditions)&&Yt.Yf(t,r)&&Yt.tp(t)}static Yf(t,r){var s;if(Te(t.conditions)||Te((s=t.conditions)===null||s===void 0?void 0:s.url))return!0;const n=Yt.getWindowLocation();if(n){var i,o,a;const c=mR(r,n.href);return!(!((i=t.conditions)===null||i===void 0)&&i.url)||o4[(o=(a=t.conditions)===null||a===void 0?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](t.conditions.url,c)}return!1}static getWindowLocation(){return L?.location}static tp(t){var r;if(Te(t.conditions)||Te((r=t.conditions)===null||r===void 0?void 0:r.utm))return!0;const s=IR();if(s.utm_source){var n,i,o,a,c,l,u,p;const d=!(!((n=t.conditions)===null||n===void 0||(n=n.utm)===null||n===void 0)&&n.utm_campaign)||((i=t.conditions)===null||i===void 0||(i=i.utm)===null||i===void 0?void 0:i.utm_campaign)==s.utm_campaign,h=!(!((o=t.conditions)===null||o===void 0||(o=o.utm)===null||o===void 0)&&o.utm_source)||((a=t.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0?void 0:a.utm_source)==s.utm_source,f=!(!((c=t.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0)&&c.utm_medium)||((l=t.conditions)===null||l===void 0||(l=l.utm)===null||l===void 0?void 0:l.utm_medium)==s.utm_medium,m=!(!((u=t.conditions)===null||u===void 0||(u=u.utm)===null||u===void 0)&&u.utm_term)||((p=t.conditions)===null||p===void 0||(p=p.utm)===null||p===void 0?void 0:p.utm_term)==s.utm_term;return d&&f&&m&&h}return!1}static Zf(t,...r){X.info(`[WebExperiments] ${t}`,r)}Jf(t,r,s){this._is_bot()?Yt.Zf(j0):r!=="control"?s.forEach(n=>{if(n.selector){var i;Yt.Zf(`applying transform of variant ${r} for experiment ${t} `,n),((i=document)===null||i===void 0?void 0:i.querySelectorAll(n.selector))?.forEach(o=>{const a=o;n.html&&(a.innerHTML=n.html),n.css&&a.setAttribute("style",n.css)})}}):Yt.Zf("Control variants leave the page unmodified.")}_is_bot(){return Tt&&this._instance?ZR(Tt,this.Ir.custom_blocked_useragents):void 0}}},Vd),w4={conversations:class{constructor(e){this._instance=e,this.ep=void 0,this._conversationsManager=null,this.np=!1,this.ne=null,this.sp=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.rp=e.ok,!e.ok))return;const t=e.config.conversations;Te(t)||(tr(t)?this.ep=t:(this.ep=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.ep=void 0,this.ne=null,this.rp=void 0,this.sp=!1}loadIfEnabled(){if(this._conversationsManager||this.np||this._instance.config.disable_conversations||Zf(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=ge?.__PosthogExtensions__;if(e&&!j(this.ep)&&this.ep)if(this.ne&&this.ne.token){this.np=!0;try{const t=e.initConversations;if(t)return this.op(t),void(this.np=!1);const r=e.loadExternalDependency;if(!r)return void this.ap(wv);r(this._instance,"conversations",s=>{s||!e.initConversations?this.ap("Could not load conversations script",s):this.op(e.initConversations),this.np=!1})}catch(t){this.ap("Error initializing conversations",t),this.np=!1}}else Ar.error("Conversations enabled but missing token in remote config.")}op(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.sp=!1,Ar.info("Conversations loaded successfully")}catch(t){this.ap("Error completing conversations initialization",t)}else Ar.error("Cannot complete initialization: remote config is null")}ap(e,t){Ar.error(e,t),this._conversationsManager=null,this.np=!1,this.sp=!0}show(){this._conversationsManager?this._conversationsManager.show():Ar.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.ep===!0&&!nt(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Zf(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.rp===!1?"remote_config_failed":j(this.ep)?this.rp?"disabled_in_project":"remote_config_pending":this.ep?Te(this.ne)||!this.ne.token?"missing_token":ge?.__PosthogExtensions__?this.np?"initializing":this.sp?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,r){var s=this;return Ze(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,r):(Ar.warn(Xn),null)})()}getMessages(e,t){var r=this;return Ze(function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(Ar.warn(Xn),null)})()}markAsRead(e){var t=this;return Ze(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Ar.warn(Xn),null)})()}getTickets(e){var t=this;return Ze(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Ar.warn(Xn),null)})()}requestRestoreLink(e){var t=this;return Ze(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Ar.warn(Xn),null)})()}restoreFromToken(e){var t=this;return Ze(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Ar.warn(Xn),null)})()}restoreFromUrlToken(){var e=this;return Ze(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Ar.warn(Xn),null)})()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}Sh(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}xh(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},k4={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.lp=!1,this.up=!1,this.hp=!1,this.A=ot("[logs]"),this.cp=S(S({},this.A),{},{error:(...r)=>{r.some(V0)||this.A.error(...r)}}),this.ol=[],this.dp=[],this._d=0,this.To=!1,this.vp=[],this.fp=[],this.pp=!1,this.gp=!1,this.mp=()=>{var r,s;this.To||(this._d=0,(r=this.yp)===null||r===void 0||r.onReconnect(),(s=this.bp)===null||s===void 0||s.onReconnect())},this._instance&&(t=this._instance.config.logs)!==null&&t!==void 0&&t.captureConsoleLogs&&(this.lp=!0),L&&ze(L,"online",this.mp)}_p(e,t,r,s){var n;const i=H0((n=this._instance)===null||n===void 0||(n=n.config)===null||n===void 0?void 0:n.logs,r);return[new iV(this.wp(e,t),i,this.cp,()=>this.kp(),o=>o(),void 0,s),i]}Sp(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var r;return this.yp&&this.xp===t||((r=this.yp)===null||r===void 0||r.reset(),this.xp=t,[this.yp,this.Cp]=this._p(()=>this.ol,s=>{this.ol=s})),this.yp}$p(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var r;return this.bp&&this.Tp===t||((r=this.bp)===null||r===void 0||r.reset(),this.Tp=t,[this.bp,this.Ip]=this._p(()=>this.dp,s=>{this.dp=s},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},B0)),this.bp}setup(e){var t;if(this.To)return;this.bo=e,(t=this._instance)!==null&&t!==void 0&&(t=t.config)!==null&&t!==void 0&&(t=t.logs)!==null&&t!==void 0&&t.captureConsoleLogs&&(this.lp=!0),(this.lp||this.Mp()&&this.Ep())&&this.Pp();let r=!1;const s=e.onRemoteConfig(n=>{var i;r=n.ok&&((i=n.config.logs)===null||i===void 0?void 0:i.captureConsoleLogs)===!0,this.onRemoteConfig(n)});this.To?s.dispose():(this.Eo=s,r||this.loadIfEnabled())}dispose(){var e,t,r,s;this.To||(this.To=!0,this.Rp(),(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,this.bo=void 0,this.hp=!1,L?.removeEventListener("online",this.mp),(t=this.Ap)===null||t===void 0||t.call(this),this.Ap=void 0,(r=this.yp)===null||r===void 0||r.reset(),(s=this.bp)===null||s===void 0||s.reset())}onRemoteConfig(e){var t,r;if(this.To)return;const s=e.ok?(t=e.config.logs)===null||t===void 0?void 0:t.captureConsoleLogs:void 0;Te(s)?this.Fp():((r=this._instance)===null||r===void 0||(r=r.persistence)===null||r===void 0||r.register({$logs_capture_enabled_server_side:!!s}),s?(this.lp=!0,this.up||this.Pp(),this.loadIfEnabled()):this.Fp())}reset(){var e,t,r,s;this.Rp(),(e=this.yp)===null||e===void 0||e.clearQueue(),this.ol=[],(t=this.yp)===null||t===void 0||t.reset(),(r=this.bp)===null||r===void 0||r.clearQueue(),this.dp=[],(s=this.bp)===null||s===void 0||s.reset(),this._d=0}captureLog(e){this.To||this.Sp().captureLog(e)}captureConsoleLog(e){this.To||this.$p().captureLog(e)}captureBufferedConsoleLog(e,t,r){this.To||this.$p().captureLog(e,{context:t,occurredAtMs:r})}Ep(){var e;return!!(!((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e[VI])}Mp(){var e,t,r;return!(!((e=this._instance)===null||e===void 0||(t=e.il)===null||t===void 0)&&t.call(e))||!!(!((r=ge._POSTHOG_REMOTE_CONFIG)===null||r===void 0||(r=r[this._instance.config.token])===null||r===void 0)&&r.config)}$h(){var e;this.Rp(),(e=this.bp)===null||e===void 0||e.clearQueue(),this.dp=[]}Fp(){this.lp||this.Rp()}Pp(){var e;if(this.pp||!ge?.console)return;const t=H0((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs).maxBufferSize;let r=!0;this.fp.push(()=>{r=!1});for(const s of a4){let n;try{n=c4(ge.console[s])}catch{continue}n&&this.fp.push(kc(ge.console,s,i=>{const o=(...a)=>{try{r&&this.Op(s,a,t)}catch{}return i.apply(ge.console,a)};return o.__rrweb_original__=n,o}))}this.pp=!0,this.Dp=setTimeout(()=>{this.Rp()},3e4)}Op(e,t,r){var s;if(this.pp&&!this.gp&&t.length!==0)if(!((s=this._instance)===null||s===void 0)&&s.is_capturing()){if(r>this.vp.length){this.gp=!0;try{this.vp.push({level:e,args:t,occurredAtMs:Date.now(),context:this.kp()})}finally{this.gp=!1}}}else this.Rp()}Rp(){if(this.vp=[],this.pp){this.pp=!1,this.Dp&&(clearTimeout(this.Dp),this.Dp=void 0);for(const e of this.fp)e();this.fp=[]}}Lp(){const e=this.vp;return this.Rp(),e}get logger(){return this.Np||(this.Np={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Np}flushLogs(e){e?this.qp(e):(this.yp&&this.yp.flush().catch(t=>this.jp(t)),this.bp&&this.bp.flush().catch(t=>this.jp(t)))}jp(e){V0(e)||this.A.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.To||!this.lp||this.up||this.hp)return;const e=ge?.__PosthogExtensions__;if(!e)return this.A.error("PostHog Extensions not found."),void this.Rp();const t=e.loadExternalDependency;if(!t)return this.A.error(wv),void this.Rp();this.hp=!0;try{t(this._instance,"logs",r=>{if(this.hp=!1,this.To||!this.lp)return;const s=e.logs;if(r||!s?.initializeLogs)this.A.error("Could not load logs script",r),this.Rp();else{var n;const a=this.Lp();var i,o;this.Ap=s.initializeLogs((n=this.bo)!==null&&n!==void 0?n:this._instance),this.up=!0,a.length>0&&((i=s.replayConsoleBuffer)===null||i===void 0||i.call(s,(o=this.bo)!==null&&o!==void 0?o:this._instance,a))}})}catch(r){throw this.hp=!1,r}}wp(e,t){const r=this._instance;return{get isDisabled(){return!1},get optedOut(){return!r.is_capturing()},getPersistedProperty:s=>s===hs.LogsQueue?e():void 0,setPersistedProperty(s,n){var i;s===hs.LogsQueue&&t((i=n)!==null&&i!==void 0?i:[])},js:s=>this.js(s),getLibraryId:()=>gt.LIB_NAME,getLibraryVersion:()=>gt.LIB_VERSION}}js(e){return new Promise(t=>{if(TR(this._d,3))return void t({kind:"fatal",error:yh(void 0,"logs endpoint is unreachable, dropping batch")});let r=!1;const s=i=>{r||(r=!0,clearTimeout(n),t(i))},n=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:yh(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Bp(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:i=>{const o=i.statusCode;if(this.Hp(o),o>=200&&300>o)s({kind:"ok"});else if(o===413)s({kind:"too-large"});else if(o!==0&&o!==408&&o!==429&&500>o)s({kind:"fatal",error:new Error(`logs request failed with status ${o}`)});else{var a;o===0?(i.error||this.A.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:yh(i.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:(a=i.error)!==null&&a!==void 0?a:new Error(`logs request failed with status ${o}`)})}}})})}Hp(e){(e!==0||this._instance.__loaded)&&(this._d=AR(e,this._d,3,()=>this.A.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}qp(e){this.ol.length>0&&this.zp(e,this.ol,this.Cp,gt.LIB_NAME,t=>{this.ol=t}),this.dp.length>0&&this.zp(e,this.dp,this.Ip,B0,t=>{this.dp=t})}zp(e,t,r,s,n){if(t.length===0)return;const i=t.map(a=>a.record);n([]);const o=UI(i,DI(r,gt.LIB_NAME,gt.LIB_VERSION),s,gt.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Bp(),data:o,compression:"best-available",batchKey:"logs",transport:e})}Bp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}kp(){var e;const t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:r,windowId:s,sessionStartTimestamp:n,lastActivityTimestamp:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=r,t.windowId=s,Te(n)||(t.sessionStartTimestamp=n),Te(i)||(t.lastActivityTimestamp=i)}if(ge!=null&&(e=ge.location)!==null&&e!==void 0&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?qn(ge.location.href):ge.location.href),this._instance.featureFlags){const r=this._instance.featureFlags.getFlags();r&&r.length>0&&(t.activeFeatureFlags=r)}return t}}},E4={metrics:class{constructor(e){this._instance=e,this.A=ot("[metrics]"),this.To=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this.To)return;const t=!!(!((e=this._instance.config.metrics)===null||e===void 0)&&e.network);t&&!this.Up?this.Up=(r=>{let s=!0;const n=()=>s?(a=>{var c;const l=(c=a.config.metrics)===null||c===void 0?void 0:c.network;return l===!0?{}:l||void 0})(r):void 0,i=d4(r,n),o=p4(r,n);return()=>{s=!1,i(),o()}})(this._instance):!t&&this.Up&&(this.Up(),this.Up=void 0)}Sp(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.metrics;var r;return this.yp&&this.xp===t||((r=this.yp)===null||r===void 0||r.reset(),this.xp=t,this.yp=new oV(this.wp(),(function(s){var n,i,o,a,c;const l=s?.resourceAttributes;return{serviceName:(n=l?.["service.name"])!==null&&n!==void 0?n:s?.serviceName,serviceVersion:(i=l?.["service.version"])!==null&&i!==void 0?i:s?.serviceVersion,environment:(o=l?.["deployment.environment"])!==null&&o!==void 0?o:s?.environment,resourceAttributes:l,beforeSend:s?.beforeSend,flushIntervalMs:(a=s?.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(c=s?.maxSeriesPerFlush)!==null&&c!==void 0?c:1e3}})(t),this.A)),this.yp}count(e,t=1,r){this.Sp().count(e,t,r)}gauge(e,t,r){this.Sp().gauge(e,t,r)}histogram(e,t,r){this.Sp().histogram(e,t,r)}flush(e){if(!this.yp)return Promise.resolve();if(e){const t=this.yp.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.yp.flush().catch(t=>this.A.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.yp)===null||e===void 0||e.reset()}dispose(){var e,t;this.To=!0,(e=this.Up)===null||e===void 0||e.call(this),this.Up=void 0,(t=this.yp)===null||t===void 0||t.reset()}wp(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:r=>t.Ys(r),getLibraryId:()=>gt.LIB_NAME,getLibraryVersion:()=>gt.LIB_VERSION}}Ys(e,t){return new Promise(r=>{let s=!1;const n=o=>{s||(s=!0,clearTimeout(i),r(o))},i=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(S(S({method:"POST",url:this.Wp(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(o){const a=o.statusCode;if(a>=200&&300>a)n({kind:"ok"});else if(a===413)n({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)n({kind:"fatal",error:new Error(`metrics request failed with status ${a}`)});else{var c;n({kind:"retry-later",error:(c=o.error)!==null&&c!==void 0?c:new Error(`metrics request failed with status ${a}`)})}}}))})}Wp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};nc.__defaultExtensionClasses=S({},S(S(S(S(S(S(S(S(S(S(S(S(S({},Vd),h4),f4),m4),g4),v4),y4),_4),b4),S4),w4),k4),E4));var T4=(function(){gt.SDK_DIST_CHANNEL="npm";const e=rc[ja]=new nc;return(function(){function t(){t.done||(t.done=!0,YR=!1,Be(rc,function(r){r._dom_loaded()}))}W?.addEventListener?W.readyState==="complete"?t():ze(W,"DOMContentLoaded",t,{capture:!1}):L&&X.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})(),A4=T4,aK=UC.flatMap(e=>{if(e.secretIn!=="path"||e.scope!=="page")return[];const t=`:${e.secretParam}`;if(!e.pattern.endsWith(t))return[];const r=e.pattern.slice(0,-t.length);return r.includes(":")?[]:[r]});function G0(e){return vm(e).replace(/(\/organizations\/)[^/?#]+/g,"$1[redacted]")}var I4=Object.freeze({recording:"off",identity:"id_only",content:"strict"}),cK=Object.freeze({recording:"full",identity:"full",content:"full"});function lK(e){if(typeof e!="object"||e===null)return!1;const{recording:t,identity:r,content:s}=e;return(t==="full"||t==="masked"||t==="off")&&(r==="full"||r==="id_only")&&(s==="full"||s==="strict")}var R4="$mcpjam_telemetry_context";var C4=64;function qu(e){return[...new Set(e.filter(t=>typeof t=="string"&&t.length>0&&t.length<=C4))].sort().slice(0,8)}function P4(e){return{v:2,p:qu(e.projectIds),o:qu(e.organizationIds),r:e.policy.recording,i:e.policy.identity,c:e.policy.content}}function zu(e){return`${qu(e.projectIds).join(",")}|${qu(e.organizationIds).join(",")}`}var x4=new Set(["class","style","_csstext","rr_width","rr_height","rr_left","rr_top","rr_position","rr_transform","rr_display","rr_scrollleft","rr_scrolltop","rr_open_mode","role","type","dir","lang","rel","tabindex","width","height","colspan","rowspan","disabled","checked","selected","hidden","open","viewbox","xmlns","d","fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","points","cx","cy","r","rx","ry","x","y","x1","x2","y1","y2","transform","opacity","aria-hidden","aria-expanded","aria-selected","aria-checked","aria-disabled","aria-pressed","aria-current","aria-orientation","data-state","data-side","data-align","data-orientation","data-disabled","data-highlighted","data-selected","data-active","data-open","data-slot","data-variant","data-size"]);function uC(e,t){const r=e.toLowerCase();return x4.has(r)?r==="style"?V4(t):dS(t):"***"}function Gd(e){return e.replace(/\S/g,"*")}var O4=new Set(["img","picture","video","audio","canvas","iframe","object","embed","image"]),Ci="[name]",dC="[redacted]",M4=new Set(["p","api","web","v1","mcp","about","api-keys","appearance","audit-log","bench","billing","budget","byok","callback","capabilities","cases","chat","ci-evals","client-config","clients","commit","compare","compatibility","computer","conformance","create","data-management","discord","edit","embed","environments","eval-server","evals","evaluate","evaluators","events","github","github-checks","home","host-compare","hosts","integrations","iterations","learning","login","members","models","new","oauth","oauth-flow","observability","organizations","plans","playground","plugins","profile","project-settings","prompts","readiness","redeem","registry","resources","results","runs","scenarios","score","secrets","security","servers","sessions","settings","shared","sharing","skills","slack","suite","support","swarms","tasks","test","tools","tracing","triggers","usage","user-testing","webmcp","xaa-flow"]),L4="[host]",W0="host.scrub.invalid",N4=["mcpjam.com","caniuse.dev"],$4=new Set(["localhost","127.0.0.1","[::1]","::1"]);function D4(e){const t=e.toLowerCase();if($4.has(t)||N4.some(s=>t===s||t.endsWith(`.${s}`)))return!0;const r=globalThis.location?.hostname;return typeof r=="string"&&r.toLowerCase()===t}var U4=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function pC(e){return/^\d+$/.test(e)||U4.test(e)||/^[0-9a-z]{25,40}$/.test(e)&&/\d/.test(e)}function q4(e){return!e||e===Ci||e===dC||M4.has(e)||pC(e)?e:Ci}var z4="[key]",F4=new Set(["code","state","token","t","_token","access_token","id_token","refresh_token","key","api_key","apikey","secret","client_secret","password","sig","signature","auth","authorization","code_verifier","code_challenge","ticket","otp","nonce","jwt"]),j4=new Set(["tab","view","page","limit","cursor","before","after","sort","order","filter","status","plan","interval","surface","flow","mode","step","project","projectId","organizationId","org","session","sessionId","chatSessionId","tabId","sel","compose","host","v","ver","version","ip","compression","_","error","error_description","redirect_uri","resource","code_challenge_method","iss","browser","wire","codec","sharp","installation_id","accessVersion","distinct_id","q","search","privacy","server","run","case","suite","target","persona","iteration","checks","compare","compareTo","insights","replay","importJob","fromCommit","fromEvalServer","cwd","dir","_t"]);function H4(e,t){return F4.has(e.toLowerCase())?`${encodeURIComponent(e)}=${dC}`:j4.has(e)?`${encodeURIComponent(e)}=${pC(t)?encodeURIComponent(t):Ci}`:`${z4}=${Ci}`}function Ec(e){const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e);if(!t&&!e.startsWith("/"))return G0(e);const r=G0(e);try{const s=new URL(t?r.replace(/^([a-z][a-z0-9+.-]*:\/\/)\[host\]/i,`$1${W0}`):r,"http://scrub.invalid"),n=s.pathname.split("/").map(o=>q4(decodeURIComponent(o))).join("/"),i=[...s.searchParams].map(([o,a])=>H4(o,a)).join("&");return`${t?`${s.protocol}//${s.hostname!==W0&&D4(s.hostname)?s.host:L4}`:""}${n}${i?`?${i}`:""}`}catch{return Ci}}function K0(e){return typeof e!="string"||!/^[a-z][a-z0-9+.-]*:\/\//i.test(e)&&!e.startsWith("/")?Ci:Ec(e)}var J0=/url\(\s*("(?:[^"\\\n]|\\[\s\S])*"|'(?:[^'\\\n]|\\[\s\S])*'|(?:[^"'()\s\\]|\\[\s\S])*)\s*\)|"(?:[^"\\\n]|\\[\s\S])*"|'(?:[^'\\\n]|\\[\s\S])*'/gi,B4=/[/:.]/;function Y0(e){return(e.startsWith('"')||e.startsWith("'")?e.slice(1,-1):e).replace(/\\([\s\S])/g,"$1")}function V4(e){if(!/url\(|["'\\]/i.test(e))return e;const t=e.replace(J0,(s,n)=>{if(n!==void 0){const o=K0(Y0(n));return`url(${JSON.stringify(o)})`}const i=Y0(s);return JSON.stringify(B4.test(i)?K0(i):Gd(i))}),r=t.replace(J0,"");return/url\(|["'\\]/i.test(r)?"***":t}function Hc(){return G4()}function G4(){return typeof window<"u"&&window.isElectron===!0}function Ov(e=W4()){return e?iP(typeof e=="string"?{pathname:e}:e):!1}function W4(){if(typeof window>"u"||!window.location)return;const{pathname:e,search:t,hash:r}=window.location;return{pathname:e,search:t,hash:r}}function hC(){return!Hc()||ov()?"off":"desktop"}function uK(e){return e.surface!=="hosted"||e.sharedLink?"off":e.recording===void 0?"pending":e.recording==="off"?"off":e.recording==="full"?"full":"masked"}var dm="mcpjam.telemetry.replayOffActor",io;function fC(){if(io!==void 0)return io;try{io=window.localStorage.getItem(dm)}catch{io=null}return io}function dK(e,t){if(e===null)return;const r=fC(),s=t?e:r===e?null:r;if(s!==r){io=s;try{s===null?window.localStorage.removeItem(dm):window.localStorage.setItem(dm,s)}catch{}}}function pK(e){const t=fC();return t===null?!1:e===void 0||e===t}var mC;function Mv(){return mC??(hC()==="off"?"off":"pending")}function hK(e){mC=e}function Gr(){return QC()!=="full"}var X0="https://redacted.invalid/",K4=["entryType","initiatorType","method","status","responseStatus","isInitial","startTime","endTime","duration","timeOrigin","timestamp","fetchStart","domainLookupStart","domainLookupEnd","connectStart","secureConnectionStart","connectEnd","requestStart","responseStart","responseEnd","redirectStart","redirectEnd","workerStart","transferSize","encodedBodySize","decodedBodySize","nextHopProtocol","renderBlockingStatus","deliveryType"];function gC(e){const t=r=>e==="masked"?Ec(r):vm(r);return function(s){const n=s.entryType===void 0&&!s.isInitial;try{const i={};for(const o of K4)s[o]!==void 0&&(i[o]=s[o]);return typeof s.name=="string"&&(i.name=t(s.name)),typeof s.url=="string"&&(i.url=t(s.url)),n&&!i.name&&(i.name=X0),i}catch{return n?{name:X0}:null}}}var J4=gC("full"),Y4=gC("masked"),X4="data-ph-no-capture",vC=[...O4].map(e=>e==="image"?"svg image":e).join(", "),Z4={maskAllInputs:!0,maskInputOptions:{password:!0},maskTextSelector:"*",maskTextFn:Gd,blockSelector:vC,maskAttributeFn:uC,recordHeaders:!1,recordBody:!1,maskCapturedNetworkRequestFn:J4,compress_events:!1},_C={maskAllInputs:!0,maskInputOptions:{password:!0},maskTextSelector:"*",maskTextFn:Gd,blockSelector:vC,maskAttributeFn:uC,recordHeaders:!1,recordBody:!1,captureCanvas:{recordCanvas:!1},captureJsonLd:!1,recordCrossOriginIframes:!1,maskCapturedNetworkRequestFn:Y4,compress_events:!1};function Q4(e){return e==="masked"?{session_recording:_C,disable_session_recording:!0,autocapture:!1,capture_dead_clicks:!1,rageclick:!1,capture_exceptions:!1,disable_surveys:!0,enable_heatmaps:!1,capture_performance:!1,enable_recording_console_log:!1,mask_all_text:!0,mask_all_element_attributes:!0}:{session_recording:Z4,disable_session_recording:!0,autocapture:!0,capture_dead_clicks:!0,rageclick:!0,capture_exceptions:Hc(),disable_surveys:!1,enable_heatmaps:!0,enable_recording_console_log:!1,mask_all_text:!1,mask_all_element_attributes:!1}}var bh=null,Zn=!1,eu=null;function fK(){return eu}var Ha=!1,pm=null;function e8(e){if(Ha||Mv()!=="full"||!Array.isArray(e))return null;if(pm===null)return e;const t=pm,r=e.filter(s=>{const n=s?.timestamp;return typeof n=="number"&&n>=t});return r.length>0?r:null}function mK(e,t){if(eu!==e){Ha=!0;try{eu?.stopSessionRecording?.()}finally{Ha=!1}bh=null,Zn=!1}eu=e;try{const r=Mv(),s=Gr()||r==="masked"?"masked":"full";if(s!==bh){if(Zn){Ha=s==="masked";try{e.stopSessionRecording?.()}finally{Ha=!1}Zn=!1}e.set_config?.(Q4(s)),bh=s}const n=hC()==="hosted"&&r==="full"&&!Gr()&&!Ov(t);n&&!Zn?(pm=Date.now(),e.startSessionRecording?.(),Zn=!0):!n&&Zn&&(e.stopSessionRecording?.(),Zn=!1)}catch{}}var t8=/\[[\w:.-]+(?:="[^"]*")?\]/g,r8=/#[^\s.#[>:]+/g;function s8(e){const t=e.replace(t8,"").replace(r8,""),r=t.search(/[["]/);return r===-1?t:t.slice(0,r)}var n8=new Set(["class","role","disabled","aria-disabled","data-sentry-component"]);function i8(e){const t={...e};typeof e.message=="string"&&(t.message=s8(e.message));const r=e.data;if(r&&typeof r=="object"){const s={...r};typeof r.url=="string"&&(s.url=Ec(r.url)),typeof r.route=="string"&&(s.route=Ec(r.route));const n=r.node;if(n&&typeof n=="object"){const i=n.attributes&&typeof n.attributes=="object"?Object.fromEntries(Object.entries(n.attributes).map(([o,a])=>[o,n8.has(o)?a:"***"])):n.attributes;s.node={...n,attributes:i,...typeof n.textContent=="string"?{textContent:Gd(n.textContent)}:{}}}t.data=s}return t}function o8(e){const t=Gr(),r=t?Ec:vm,s=e?.data,n=s?.payload;if(!s||!n)return e;if(t&&s.tag==="breadcrumb"&&n.category==="console")return null;if(t&&s.tag==="breadcrumb"&&typeof n.category=="string"&&n.category.startsWith("ui."))return{...e,data:{...s,payload:i8(n)}};if(s.tag==="breadcrumb"&&n.category==="navigation"){const i=n.data??{};return(typeof i.from!="string"||r(i.from)===i.from)&&(typeof i.to!="string"||r(i.to)===i.to)?e:{...e,data:{...s,payload:{...n,data:{...i,...typeof i.from=="string"?{from:r(i.from)}:{},...typeof i.to=="string"?{to:r(i.to)}:{}}}}}}if(s.tag==="performanceSpan"&&typeof n.description=="string")return r(n.description)===n.description?e:{...e,data:{...s,payload:{...n,description:r(n.description)}}};if(s.tag==="breadcrumb"&&typeof n.message=="string"){const i=dS(n.message);return i===n.message?e:{...e,data:{...s,payload:{...n,message:i}}}}return e}var a8=["a[href]","area[href]","iframe","frame[src]","embed[src]","source","track","input[src]","[srcset]","object[data]","table[background]","td[background]","th[background]",'[style*="url(" i]','[style*="image-set(" i]'],gK={maskAllText:!0,maskAllInputs:!0,blockAllMedia:!0,maskAttributes:["title","placeholder","aria-label","aria-description","alt","action","formaction","poster","href","src","srcset","data","value"],block:[".rr-block",`[${X4}]`,...a8,`[style*='"']`,`[style*="'"]`,...GC()],networkDetailAllowUrls:[],networkCaptureBodies:!1,beforeAddRecordingEvent:o8},zn=null,Ho,Vs,hm=new Set,tu=0,fm=!1,Wd=0,Z0=!1,yC=!1,bC=0;function SC(){const e=Kd();return Z0&&!e&&(Wd+=1),Z0=e,e}function ra(){if(tu>0){fm=!0;return}yC=SC(),bC=Wd;for(const e of hm)try{e()}catch{}}function vK(){return zn}function _K(e){e!==zn&&(zn=e,Ho=void 0,Vs=void 0,ra())}function yK(e,t){if(e!==zn)return;const r=e===null?void 0:t;r!==Ho&&(Ho=r,ra())}function bK(){Ho!==void 0&&(Ho=void 0,ra())}function c8(e){return e!==null&&e===zn?Ho:void 0}function l8(e=zn){return c8(e)==="full"&&Kd()}function SK(){return Wd}function wK(e){return hm.add(e),()=>hm.delete(e)}var Nr={projectIds:[],organizationIds:[]};function u8(e){const t=zu(Nr),r=!!Nr.sharedLink;Nr={sharedLink:e.sharedLink,projectIds:e.projectIds.filter(s=>!!s),organizationIds:e.organizationIds.filter(s=>!!s)},(t!==zu(Nr)||r!==!!Nr.sharedLink)&&(Vs=void 0,ra())}function d8(e,t){const r=e&&e===zn&&t?{actor:e,context:zu(Nr),content:t}:void 0;r?.actor===Vs?.actor&&r?.context===Vs?.context&&r?.content===Vs?.content||(Vs=r,ra())}function kK(e,t,r){tu+=1;try{u8(e),d8(t,r)}finally{tu-=1,tu===0&&(fm||Kd()!==yC||Wd!==bC)&&(fm=!1,ra())}}function Kd(){return Vs?.actor===zn&&Vs?.content==="full"&&Vs.context===zu(Nr)&&typeof window<"u"&&!window.isElectron&&!Nr.sharedLink&&!Ov()&&Nr.projectIds.length+Nr.organizationIds.length>0}function p8(){const e=Kd(),t=Mv();return{projectIds:[...Nr.projectIds],organizationIds:[...Nr.organizationIds],policy:e?{recording:t==="full"||t==="masked"?t:"off",identity:l8()?"full":"id_only",content:"full"}:{...I4}}}function wC(e){if(!e)return e;try{const t=p8(),r={...e.properties??{},[R4]:P4(t)};if(e.event==="$snapshot"&&"$snapshot_data"in r){const s=e8(r.$snapshot_data);if(s===null)return null;r.$snapshot_data=s}return{...e,properties:r}}catch{return null}}sP(()=>SC()?"full":"strict");var h8=/\.[cm]?[jt]sx?$/,f8=/^(?:[a-z][a-z0-9+.-]*:\/\/|\/)/i;function m8(e,t){if(typeof e!="string"||!f8.test(e))return!1;let r;try{r=new URL(e,t)}catch{return!1}return r.origin!==t?!1:!h8.test(r.pathname)}function g8(e,t){return e.length===0?!1:e.every(r=>m8(r,t))}function v8(e,t){return e.length===0?!1:e.every(r=>g8(r,t))}var kC=`${hS}_tab`,_8=`ph_${kC}`;function y8(){let e="memory";try{const t=`${_8}_probe`;window.sessionStorage.setItem(t,"1");const r=window.sessionStorage.getItem(t)==="1";window.sessionStorage.removeItem(t),r&&(e="sessionStorage")}catch{}return{persistence:e,persistence_name:kC}}var EC=new Set(["caniuse.dev","www.caniuse.dev"]),b8=new Set(["score.mcpjam.com","www.score.mcpjam.com"]),S8=new Set([...EC,...b8]),EK="https://app.mcpjam.com";function w8(e){return EC.has(e.toLowerCase())}function TK(e=typeof window>"u"?void 0:window.location.hostname,t=typeof window>"u"?"":window.location.pathname){return t.replace(/\/+$/,"")==="/redeem"?!0:!!e&&w8(e)}function Lv(){return typeof window<"u"&&window.location?.origin?.startsWith("http")?`${window.location.origin}/tlm`:"/tlm"}function Nv(e){const t=Lf()?.guestId,r=e&&Object.keys(e).length>0?e:void 0;return!t&&!r?{}:{bootstrap:{...t?{distinctID:t,isIdentifiedID:!1}:{},...r?{featureFlags:r}:{}}}}var TC={...y8(),advanced_disable_feature_flags:!0,advanced_disable_feature_flags_on_first_load:!0},AC=null;function mm(e=AC){if(e)for(const t of[e.persistence,e.sessionPersistence]){const r=t?.props;if(!(!t||!r)){try{const s=YC(r);if(s===r)continue;for(const n of Object.keys(r))n in s||delete r[n];Object.assign(r,s)}catch{delete r.$initial_person_info}try{t.save?.()}catch{}}}}function IC(e){if(e?.event!=="$exception"||typeof window>"u")return e;const t=e.properties?.$exception_list;if(!Array.isArray(t))return e;const r=t.map(s=>{const n=s?.stacktrace?.frames;return Array.isArray(n)?n.map(i=>i?.filename):[]});return v8(r,window.location.origin)?null:e}var k8=S8,E8=Lv()==="/tlm"||ov(),T8={advanced_disable_flags:!0,disable_surveys:!0,disable_external_dependency_loading:!0};function RC(e=typeof window>"u"?void 0:window.location?.hostname){const t=!!e&&k8.has(e.toLowerCase());return{capture_pageview:t?"history_change":!1,capture_pageleave:t}}var Q0={api_host:Lv(),ui_host:"https://us.posthog.com",...Nv(),...RC(),...TC,person_profiles:"always",disable_beacon:!0,before_send:[IC,wC,e=>(mm(),e)],disable_capture_url_hashes:!0,get capture_dead_clicks(){return!Gr()},get autocapture(){return!Gr()},get rageclick(){return!Gr()},get disable_surveys(){return Gr()},get enable_heatmaps(){return!Gr()},get capture_exceptions(){return Hc()&&!Gr()},disable_session_recording:!0,session_recording:_C,enable_recording_console_log:!1,get mask_all_text(){return Gr()},get mask_all_element_attributes(){return Gr()},loaded:e=>{AC=e,mm(e),e.register({environment:"production",platform:Fu(),version:"3.24.1",deployment:"self_hosted",source:"client"}),e.setPersonPropertiesForFlags?.({deployment:"self_hosted",platform:Fu()})}};function A8(e){const t=Nv(e);return"bootstrap"in t?Object.defineProperties({},{...Object.getOwnPropertyDescriptors(Q0),bootstrap:{value:t.bootstrap,enumerable:!0,configurable:!0,writable:!0}}):Q0}var AK=()=>hS,IK=e=>E8?{api_host:Lv(),ui_host:"https://us.posthog.com",...Nv(e),...RC(),...TC,person_profiles:"always",disable_beacon:!0,disable_session_recording:!0,capture_exceptions:!1,...ov()?T8:{},opt_out_capturing_by_default:!0,before_send:[IC,wC,t=>(mm(),t)],disable_capture_url_hashes:!0,loaded:t=>{t.setPersonPropertiesForFlags?.({deployment:"self_hosted",platform:Fu()})}}:A8(e);function Fu(){if(window?.isElectron){const e=navigator.userAgent.toLowerCase();return e.includes("mac")||e.includes("darwin")?"mac":e.includes("win")?"win":"electron"}return"npm"}function I8(){return"production"}function RK(e){const t=I8();return{location:e,platform:Fu(),...t!==void 0?{environment:t}:{}}}var CK=5e3,ru=null;function PK(e=Date.now()){ru=e}function R8(e=Date.now()){if(ru===null)return!1;const t=e-ru;return t<0||t>1e4?(ru=null,!1):!0}var C8=gP((e,t)=>({status:"idle",kind:null,retryNonce:0,queriesPaused:!1,authConfirmed:!1,authEpoch:0,recoveryId:null,recoveryAt:0,pauseQueries:()=>e({queriesPaused:!0}),resumeQueries:()=>{t().authConfirmed&&e({queriesPaused:!1})},notifyFailure:r=>{if(R8()){e({status:"idle",kind:null});return}if(t().kind==="signed_out"){e({status:"failed"});return}e({status:"failed",kind:r})},retry:()=>e(r=>({status:"retrying",retryNonce:r.retryNonce+1})),clear:()=>e({status:"idle",kind:null})})),P8=/\(ref ([0-9a-f]{16})\)\s*$/,x8=/^(?:\[CONVEX [A-Z]+\([^)]*\)\]\s*)?\[Request ID: ([0-9a-f]+)\]\s*([\s\S]*)$/,O8=/\[Request ID: ([0-9a-f]+)\]/,M8=/^\[[^\]]*\]\s*/,CC="Server Error",L8="Something went wrong",ju=400;function PC(e){if(typeof e=="string")return e;try{if(e instanceof Error)return typeof e.message=="string"?e.message:null}catch{return null}return null}function eS(e){for(const t of e.split(`
|
|
63
|
+
`)){const r=t.trim();if(r!==""){if(/^at\s/.test(r)||r==="Called by client")break;return r}}return""}function N8(e){try{if(!e||typeof e!="object"||!("data"in e))return null;const t=e.data;if(typeof t=="string"&&t.trim())return t.slice(0,ju);if(t&&typeof t=="object"&&"message"in t){const r=t.message;if(typeof r=="string"&&r.trim())return r.slice(0,ju)}}catch{return null}return null}function xC(e){const t=PC(e);return t?O8.exec(t)?.[1]??null:null}function $8(e){return`(ref ${e})`}function xK(e){const t=P8.exec(e);return t?{text:e.slice(0,t.index).trim(),requestId:t[1]}:{text:e,requestId:null}}function D8(e,t){const r=xC(e),s=N8(e);if(s)return{message:s,requestId:r,redacted:!1,refusal:!0};const n=PC(e);if(!n||!n.trim())return{message:t,requestId:r,redacted:!1,refusal:!1};const i=x8.exec(n);if(i){const o=i[2],a=eS(o.startsWith(CC)?o.slice(12):o);return a?{message:a.slice(0,ju),requestId:r,redacted:!1,refusal:!1}:{message:L8,requestId:r,redacted:!0,refusal:!1}}return{message:eS(n.replace(M8,"")).slice(0,ju)||t,requestId:r,redacted:!1,refusal:!1}}function OK(e,t){const{message:r,requestId:s,refusal:n}=D8(e,t);return!s||n?r:`${r} ${$8(s)}`}function U8(e){const t=typeof e?.message=="string"?e.message:"";return t.includes("Could not find public function")||t.includes("Could not find Convex client")}function MK(e,t){const r=typeof e?.message=="string"?e.message:"";return r.includes(`Q(${t})`)?U8(e)||r.includes(CC):!1}function q8(e){try{if(typeof e!="object"||e===null)return;const t=e.normalized;return _1(t)?t:void 0}catch{return}}function LK(e,t){try{if(!Hc()||tv(e)||rv(e)||sv(e))return!1;const r=q8(e)??B1(e),s=j1(r);return s!=="mcpjam"?!1:(OC(e,{...t,extra:{...t.extra??{},slug:r.slug,origin:s}}),!0)}catch{return!1}}var z8=DA();function F8(e){if(e instanceof Error)return e;try{return new Error(typeof e=="string"?e:JSON.stringify(e))}catch{return new Error(String(e))}}function OC(e,t){if(tv(e)||rv(e)||sv(e))return;const r=x6(F8(e)),s=$A(r.message);if(s&&t.queryBackend&&(s.convex_backend=t.queryBackend),s&&z8(s.convex_backend,s.request_id))return;const n=s&&typeof window<"u"?xf(window.location.href):void 0,i=xC(e),o=i?{convex_request_id:i}:{},a=C8.getState(),c=a.recoveryId&&Date.now()-a.recoveryAt<3e5?{auth_recovery_id:a.recoveryId}:{};try{l6(r,{level:t.level??"error",tags:{...t.tags??{},source:t.source,...o,...s,...c},...t.fingerprint?{fingerprint:t.fingerprint}:{},...s?{extra:{boundary:t.extra?.boundary,componentStack:t.extra?.componentStack,page_location:n}}:t.extra?{extra:t.extra}:{}})}catch{}try{Hc()&&!Ov()&&A4.captureException(r,{source:t.source,level:t.level??"error",...o,...s?{...s,page_location:n}:t.extra??{}})}catch{}}function NK(e,t,r){OC(e,{source:r?`react_boundary:${r}`:"react_boundary",extra:{componentStack:t?.componentStack??void 0,boundary:r??"unnamed"}})}export{tB as $,l9 as $a,z9 as $i,K7 as $n,oO as $o,vf as $r,MW as $t,yK as A,J$ as Aa,u7 as Ai,pW as An,Iw as Ao,$7 as Ar,jW as At,hC as B,y9 as Ba,Og as Bi,lW as Bn,hw as Bo,M7 as Br,rv as Bt,v8 as C,E9 as Ca,Kz as Ci,U5 as Cn,QG as Co,Qg as Cr,N6 as Ct,bK as D,Kh as Da,m7 as Di,fu as Dn,XG as Do,U7 as Dr,zW as Dt,SK as E,A9 as Ea,f7 as Ei,qc as En,i1 as Eo,z7 as Er,GW as Et,fK as F,B$ as Fa,lu as Fi,M5 as Fn,In as Fo,aA as Fr,DA as Ft,I4 as G,pn as Ga,bk as Gi,sW as Gn,Zu as Go,R7 as Gr,LW as Gt,pK as H,m9 as Ha,XU as Hi,aW as Hn,OG as Ho,C7 as Hr,P6 as Ht,mK as I,j$ as Ia,_E as Ii,L5 as In,BG as Io,_i as Ir,Ga as It,V4 as J,d9 as Ja,V9 as Ji,rW as Jn,i2 as Jo,OH as Jr,mu as Jt,lK as K,B_ as Ka,_U as Ki,oW as Kn,PG as Ko,MH as Kr,NW as Kt,Mv as L,g9 as La,Ag as Li,uW as Ln,Y2 as Lo,Ts as Lr,$A as Lt,c8 as M,pp as Ma,Pg as Mi,dW as Mn,__ as Mo,ln as Mr,HW as Mt,l8 as N,W_ as Na,Pk as Ni,mW as Nn,bs as No,zH as Nr,DW as Nt,_K as O,I9 as Oa,h7 as Oi,Ud as On,Cw as Oo,Cn as Or,qW as Ot,gK as P,b9 as Pa,Mg as Pi,x5 as Pn,qm as Po,N7 as Pr,UW as Pt,eK as Q,c$ as Qa,q9 as Qi,X7 as Qn,_O as Qo,x7 as Qr,TW as Qt,Ov as R,H$ as Ra,Ed as Ri,Qy as Rn,Q2 as Ro,L7 as Rr,x6 as Rt,_8 as S,mD as Sa,v7 as Si,q5 as Sn,Fm as So,Zg as Sr,$6 as St,p8 as T,T9 as Ta,g7 as Ti,bW as Tn,ZG as To,q7 as Tr,VW as Tt,uK as U,f9 as Ua,G9 as Ui,Ef as Un,xG as Uo,P7 as Ur,$W as Ut,dK as V,v9 as Va,Lg as Vi,S5 as Vn,MG as Vo,NH as Vr,sv as Vt,hK as W,P$ as Wa,zU as Wi,iW as Wn,o2 as Wo,RH as Wr,lb as Wt,G0 as X,u9 as Xa,hk as Xi,Q7 as Xn,n2 as Xo,xH as Xr,AW as Xt,Ec as Y,p9 as Ya,H9 as Yi,tW as Yn,CG as Yo,CH as Yr,xW as Yt,A4 as Z,p$ as Za,ay as Zi,Z7 as Zn,kO as Zo,PH as Zr,l6 as Zt,IK as _,P9 as _a,w7 as _i,D5 as _n,t9 as _o,Uc as _r,Pn as _t,D8 as a,rU as aa,T7 as ai,EW as an,ld as ao,G7 as ar,wh as as,sK as at,EK as b,fD as ba,WT as bi,wA as bn,G1 as bo,Ld as br,JW as bt,MK as c,O9 as ca,Hy as ci,kW as cn,o9 as co,Dd as cr,Y8 as cs,jA as ct,C8 as d,ty as da,Wg as di,wW as dn,fN as do,B7 as dr,ym as ds,QW as dt,F9 as ea,Md as ei,PW as en,n$ as eo,J7 as er,aO as es,oK as et,CK as f,ry as fa,rA as fi,SW as fn,i9 as fo,j7 as fr,G8 as fs,ZW as ft,AK as g,gD as ga,E7 as gi,z5 as gn,r9 as go,Ky as gr,V6 as gt,Fu as h,x9 as ha,gf as hi,gW as hn,Bh as ho,wf as hr,YW as ht,OK as i,N9 as ia,A7 as ii,OW as in,c9 as io,W7 as ir,ex as is,eB as it,wK as j,K_ as ja,X9 as ji,hW as jn,$L as jo,D7 as jr,FW as jt,kK as k,S9 as ka,p7 as ki,fW as kn,YG as ko,VH as kr,ov as kt,U8 as l,lg as la,Od as li,j5 as ln,td as lo,Oi as lr,gP as ls,Q6 as lt,PK as m,ED as ma,ws as mi,rb as mn,Y1 as mo,$d as mr,dP as ms,XW as mt,OC as n,uU as na,I7 as ni,RW as nn,ud as no,m5 as nr,fG as ns,tK as nt,$8 as o,$9 as oa,Kg as oi,Y5 as on,a9 as oo,V7 as or,fS as os,rK as ot,R8 as p,ey as pa,hr as pi,F5 as pn,s9 as po,H7 as pr,hP as ps,nK as pt,uC as q,y$ as qa,B9 as qi,nW as qn,RG as qo,Xg as qr,gu as qt,LK as r,D9 as ra,IH as ri,CW as rn,dd as ro,g5 as rr,Em as rs,Lf as rt,xC as s,L9 as sa,Zr as si,RA as sn,Nn as so,eW as sr,J8 as ss,iK as st,NK as t,j9 as ta,TH as ti,IW as tn,WN as to,Y7 as tr,mG as ts,rB as tt,xK as u,uk as ua,$c as ui,H5 as un,n9 as uo,Mi as ur,mP as us,Z6 as ut,E8 as v,hD as va,S7 as vi,yW as vn,B1 as vo,Mo as vr,KW as vt,vK as w,w9 as wa,Jz as wi,vW as wn,u1 as wo,KH as wr,BW as wt,TK as x,R9 as xa,_7 as xi,_W as xn,j1 as xo,F7 as xr,WW as xt,RK as y,C9 as ya,rH as yi,kA as yn,_1 as yo,Nd as yr,q6 as yt,Hc as z,_9 as za,Ng as zi,cW as zn,Mm as zo,O7 as zr,tv as zt};
|
|
64
|
+
|
|
65
|
+
//# sourceMappingURL=error-reporting-CurPZeHi.js.map
|