@mcpjam/inspector 3.24.1 → 3.25.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-ClSQQo_e.js → app-bootstrap-NUHAuQhV.js} +353 -346
- package/dist/client/assets/{chunk-D32TOXHM-jRtwwVuB.js → chunk-D32TOXHM-DD721INw.js} +5 -5
- package/dist/client/assets/{dead-clicks-autocapture-BqGJPJYA.js → dead-clicks-autocapture-0g7bn_r2.js} +2 -2
- package/dist/client/assets/error-reporting-RuZxlzDb.js +143 -0
- package/dist/client/assets/{error-reporting-CMJx3DSN.js → error-reporting-e2IXoekl.js} +1 -1
- package/dist/client/assets/{exception-autocapture-DDriz7RU.js → exception-autocapture-CSedHhr8.js} +2 -2
- package/dist/client/assets/first-run-oauth-return-B6apLua6.css +2 -0
- package/dist/client/assets/first-run-oauth-return-C9z1PZdO.js +1872 -0
- package/dist/client/assets/{highlighted-body-KQOG7T2V-W9otU88_.js → highlighted-body-KQOG7T2V-D8pWcF_9.js} +2 -2
- package/dist/client/assets/index-Cn2mh3Wt.js +4 -0
- package/dist/client/assets/{jszip.min-BZncoXx3.js → jszip.min-615s08Jt.js} +2 -2
- package/dist/client/assets/{mermaid-MCJ5UELQ-CyXXddBc.js → mermaid-MCJ5UELQ-CP2WL7Jq.js} +1 -1
- package/dist/client/assets/{posthog-recorder-yHE4z3QE.js → posthog-recorder-Dfj32i9J.js} +2 -2
- package/dist/client/assets/{preload-helper-hMqm2cFr.js → preload-helper-Cx1qaWZi.js} +2 -2
- package/dist/client/assets/{project-route-DseXxV_W.js → project-route-eSY9Jjxk.js} +5 -5
- package/dist/client/assets/{react-dom-C0xqZMkb.js → react-dom-8jLMvrQh.js} +2 -2
- package/dist/client/assets/{rolldown-runtime-BOqoCXSu.js → rolldown-runtime-C4BN53g5.js} +1 -1
- package/dist/client/assets/{surveys-DhCSAOVD.js → surveys-C0qbQIlK.js} +2 -2
- package/dist/client/assets/telemetry-files-da4238acc777adba.js +1 -0
- package/dist/client/assets/{trace-timeline-BZXpue8Z.js → trace-timeline-BKiCE1_P.js} +1 -1
- package/dist/client/assets/{trace-timeline-CuGCSSeE.js → trace-timeline-CJIm22zK.js} +21 -21
- package/dist/client/assets/{use-reduced-motion-DXYfL08L.js → use-reduced-motion-BxwRjxNg.js} +2 -2
- package/dist/client/assets/{web-vitals-BycgZCTB.js → web-vitals-CHmGmjBw.js} +2 -2
- package/dist/client/index.html +9 -9
- package/dist/server/harness-install-cli.js +410 -11
- package/dist/server/index.js +2 -2
- package/package.json +2 -2
- package/dist/client/assets/error-reporting-CurPZeHi.js +0 -65
- package/dist/client/assets/first-run-oauth-return-apQ_CEb0.js +0 -1872
- package/dist/client/assets/first-run-oauth-return-ssVP6ljy.css +0 -2
- package/dist/client/assets/index-ByG7bi1F.js +0 -4
- package/dist/client/assets/telemetry-files-d99937353b524002.js +0 -1
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import{o as tS}from"./rolldown-runtime-C4BN53g5.js";import{$ as jn,$t as cx,A as lx,At as ux,B as dx,Bt as rS,Dt as Ce,E as px,F as hx,Gt as it,I as eg,It as De,Kt as _t,Lt as Y,M as fx,Mt as mx,N as gx,Nt as ge,O as vx,P as _x,Pt as st,Qt as sS,R as yx,Rt as yt,St as nS,Tt as re,Ut as w,V as gl,Vt as Qe,X as iS,Yt as bx,_ as wx,_t as Sx,a as kx,at as Ex,b as tg,bt as pt,et as vd,g as Tx,ht as Ic,it as Zs,jt as oS,k as Ax,kt as aS,lt as Ix,nn as Rx,o as Cx,ot as rg,qt as cS,rn as Px,st as xx,tn as Ox,tt as Mx,u as lS,ut as yn,v as Lx,vt as uS,wt as Nx,x as dS,yt as $x,z as Dx,zt as pS}from"./project-route-eSY9Jjxk.js";import{n as Ux,t as qx}from"./react-dom-8jLMvrQh.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.25.1"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a511c11d-3c0d-42ee-9a48-904557358250",e._sentryDebugIdIdentifier="sentry-dbid-a511c11d-3c0d-42ee-9a48-904557358250")}catch{}})();var hS="phc_dTOPniyUNU2kD8Jx8yHMXSqiZHM8I91uWopTMX6EBE9",zx={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"},x_;x_||(x_={});function Fx(e){return cx($x,e)}var vl=tS(Ux(),1);function sf(e){return Array.isArray(e)?e.map(sf):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([t],[r])=>t<r?-1:t>r?1:0).map(([t,r])=>[t,sf(r)])):e}function jx(e){return JSON.stringify(sf(e))}function d9(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 O_=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},sg=(e=>e?O_(e):O_),Hx=e=>e;function Bx(e,t=Hx){const r=vl.useSyncExternalStore(e.subscribe,vl.useCallback(()=>t(e.getState()),[e,t]),vl.useCallback(()=>t(e.getInitialState()),[e,t]));return vl.useDebugValue(r),r}var M_=e=>{const t=sg(e),r=s=>Bx(t,s);return Object.assign(r,t),r},Vx=(e=>e?M_(e):M_),p9=Object.freeze({maxObservations:24,maxSummaryChars:400,maxEvidenceRefs:8,maxEvidenceRefChars:200,maxModelIdChars:128,maxVersionChars:64}),h9=Object.freeze({status:"not-requested",reason:"not_requested",detail:"this run did not request model-backed observations, so nothing was charged"}),Gx="missingInputMessage";function L_(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 ng(e){if(e.status!=="skipped"||e.skipReason!=="could-not-run")return;const t=e.details,r=L_(t)??L_(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 ng(e)!==void 0}function Kx(e){return e==="login"||e==="protocolVersion"}var Wx={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 N_(e){if(!e||typeof e!="object")return;const t=e[Gx];return typeof t=="string"&&t.trim()?t:void 0}function f9(e){const t=ng(e);if(!t)return;const r=e.details;return N_(r)??N_(r&&typeof r=="object"&&"details"in r?r.details:void 0)??Wx[t]}var Jx=/^(?:the probed tool )?("(?:[^"\\]|\\.)*") returned a normal result/;function m9(e){if(e.status!=="skipped"||e.skipReason!=="could-not-run"||typeof e.id!="string"||!e.id.startsWith("tasks-"))return;const t=Jx.exec(mS(e.error));if(!t)return;let r;try{r=JSON.parse(t[1])}catch{return}if(typeof r=="string")return Yx(r)}function Yx(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 _d(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(!_d(s))return!1;const n=ng(s);return n===void 0||Kx(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(_d).length,n=e.filter(gS).length;return`${t}/${e.length} checks passed, ${r} failed, ${s} could not run, ${n} not applicable`}var g9=Object.freeze({toolNameMaxChars:128,maxFeatureClaims:10,maxToolCalls:2}),Xx=/^[A-Za-z]:[\\/]/,Qx=/[\u0000-\u001f\u007f]/,Zx=new TextEncoder;function eO(e){return Zx.encode(e).length}function tO(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(Qx.test(e))return{ok:!1,code:"PATH_INVALID_CHARACTER",message:"path contains control characters"};if(e.startsWith("/")||e.startsWith("\\")||Xx.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=tO(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 rO(e){return e.normalize("NFKC").toLowerCase()}function _l(e,t){return t===e||t.startsWith(`${e}/`)}function zi(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 sO(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(eO(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=rO(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 nf=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}},mi=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 nf(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 Rc=/(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 yd(e){return bS.test(e)}var ka=Symbol("drop");function of(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)),ka;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),ka):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=of(e[o],`${t}[${o}]`,r+1,s,n);a!==ka&&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(Rc.test(o)){s.issues.warn(s.secretCode,`${s.label}: field "${c}" looks secret-bearing and is not stored`,s.context);continue}const l=of(a,c,r+1,s,n);l!==ka&&(i[o]=l)}return i}return ka}function bd(e,t){return of(e,"",0,t,{reportedTooDeep:!1})}function wS(e){return["localhost","[::1]","::1"].includes(e)||/^127(?:\.\d{1,3}){3}$/.test(e)}var ig=(e,t)=>!/^[^:/?#]+:\/\/[^\\/?#]/.test(e)||/^[^:]*:[\\/]*[^\\/?#]*@|[\\\s]/.test(e)||t?.allowFragment!==!0&&e.includes("#")||[...e].some(r=>r<" "||r===""),nO=/^[a-z]+(?:[-_][a-z]+)+$/i,iO=e=>e.replace(/%(?!2f)([0-7][0-9a-f])/gi,(t,r)=>String.fromCharCode(Number.parseInt(r,16)));function Rp(e){return[e,iO(e)].some(t=>yd(t)&&!nO.test(t))}function og(e){if(e.pathname.split("/").some(Rp))return!0;const t=e.hash.slice(1);if(Rp(t))return!0;for(const r of[e.searchParams,new URLSearchParams(t)])for(const[s,n]of r)if(Rp(n)||n!==""&&Rc.test(s))return!0;return!1}function oO(e){let t;try{t=new URL(e)}catch{return{ok:!1,code:"MCP_INVALID_SERVER",message:'"url" is not a valid URL'}}return ig(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'}:og(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:"&&wS(t.hostname)?{ok:!0,loopbackHttp:!0}:{ok:!1,code:"MCP_INSECURE_URL",message:"remote MCP servers must use HTTPS"}}function aO(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=zi("",s);return n.ok?{ok:!0,value:`${r}/${n.path}`}:{ok:!1,code:n.code,message:n.message}}var SS=/^\$\{[A-Za-z_][A-Za-z0-9_]*\}$/,$_=/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,cO=/^\$\{(?:PLUGIN_ROOT|PLUGIN_DATA)\}[A-Za-z0-9._/-]*$/,D_=new Set(["PLUGIN_ROOT","PLUGIN_DATA"]),lO=/^[A-Za-z0-9.:/@,+_-]*$/,uO=/[A-Za-z0-9_-]{16,}/,dO=/(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 pO(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(D_.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(cO.test(a)){n.set(o,{name:o,required:!1,valueTemplate:a});continue}if(a===""||SS.test(a)){n.set(o,{name:o,required:!0});continue}const c=[...a.matchAll($_)].map(l=>l[1]).filter(l=>!D_.has(l));if(c.length>0){const l=a.replace($_,"");if(lO.test(l)&&!uO.test(l)&&!Rc.test(o)){n.set(o,{name:o,required:!1,valueTemplate:a});for(const u of c)i.add(u);continue}}else if(!Rc.test(o)&&!yd(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 hO(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=dO.test(o);if(a===""||SS.test(a)){n.push({name:o,secret:c});continue}const l=yd(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 fO(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=bd(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 mO={url:"https://developers.openai.com/plugins/deploy/submission-errors",capturedOn:"2026-11-13"},bs={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 `-`."}},gO=/^(?!.*(?:--|\.\.))[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/;var ES=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;function vO(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 _O='manifest "name" must be 1-64 lowercase [a-z0-9.-] chars with single separators (no "--" or "..")';function yO(e,t){const[r]=vO(e),s=t==="openai-compatible";return typeof e=="string"&&(e.length<=64&&gO.test(e)||s&&r===void 0)?{ok:!0,name:e}:{ok:!1,message:s&&r!==void 0?bs[r].message:_O}}var Mn="plugin.json",af=Object.freeze({"1.0.0":"https://agent-plugins.org/schemas/1.0.0/plugin.schema.json"}),li="com.mcpjam",ag=/\[TODO:/i,TS=["description","license"],AS=["homepage","repository"],bO=new Set(["command","entrypoint","exec","install","install_script","postinstall","preinstall","run","script","scripts"]),wO=new Set(["$schema","name","version","author","keywords","extensions","interface",...TS,...AS]);function cf(e,t,r,s=0,n={reportedTooDeep:!1}){if(typeof e=="string"){ag.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)=>cf(i,`${t}[${o}]`,r,s+1,n));return}if(e&&typeof e=="object")for(const[i,o]of Object.entries(e))cf(o,t===""?i:`${t}.${i}`,r,s+1,n)}function U_(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!==""||og(s)){r.warn("MANIFEST_SECRET_FIELD_OMITTED",`manifest field "${e}" carries a credential; ignored`);return}if(ig(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 SO(e,t,r,s){const n=t[li];if(n===void 0)return;if(n===null||typeof n!="object"||Array.isArray(n)){s.warn("MANIFEST_INVALID_FIELD",`extension namespace "${li}" 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",`"${li}.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",`"${li}.${a}" must be a bundle-relative path; ignored`);continue}const l=zi("",c);if(!l.ok){s.warn(l.code,`"${li}.${a}": ${l.message}`);continue}if(!r.has(l.path)){s.warn("MANIFEST_MISSING_FILE",`"${li}.${a}" references a file that is not in the bundle: "${l.path}"`,{path:l.path});continue}e[a]=l.path}}var ns="com.openai",IS=["logo","logoDark","composerIcon"];function Ei(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function kO(e,t,r,s){for(const{label:n,value:i}of t)if(i!==void 0){if(!Ei(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()&&(ag.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=zi("",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 EO(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 TO(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(af).find(m=>af[m]===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=yO(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 m of TS){const f=n[m];if(f!==void 0){if(typeof f!="string"){s.error("MANIFEST_INVALID_FIELD",`manifest field "${m}" must be a string`);continue}c[m]=f}}for(const m of AS){if(n[m]===void 0)continue;const f=U_(m,n[m],s);f!==void 0&&(c[m]=f)}const l=n.author;if(l!==void 0)if(l&&typeof l=="object"&&!Array.isArray(l)){const m=l,f={};for(const g of Object.keys(m)){if(g==="name"||g==="email"||g==="url"){g!=="url"&&typeof m[g]!="string"&&s.error("MANIFEST_INVALID_FIELD",`manifest field "author.${g}" must be a string`);continue}s.warn("MANIFEST_UNKNOWN_FIELD",`manifest field "author.${g}" is not part of Agent Plugins ${o}; ignored`)}if(typeof m.name=="string"&&(f.name=m.name),typeof m.email=="string"&&(f.email=m.email),m.url!==void 0){const g=U_("author.url",m.url,s);g!==void 0&&(f.url=g)}c.author=f}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(m=>typeof m!="string")?s.error("MANIFEST_INVALID_FIELD",'manifest field "keywords" must be an array of strings'):c.keywords=u);const p=Ei(n.extensions)?n.extensions[ns]:void 0,d=n.interface!==void 0||p!==void 0;kO(c,[{label:"interface",value:n.interface},{label:`extensions.${ns}.interface`,value:Ei(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=bd(IO(h),{issues:s,secretCode:"MANIFEST_SECRET_FIELD_OMITTED",label:"manifest extensions"}),SO(c,h,r,s))),d&&EO(c,s);for(const m of Object.keys(n))if(!wO.has(m)){if(bO.has(m)){s.error("MANIFEST_AMBIGUOUS_FIELD",`manifest field "${m}" is not supported and is execution-ambiguous; remove it`);continue}s.warn("MANIFEST_UNKNOWN_FIELD",`manifest field "${m}" is not part of Agent Plugins ${o}; ignored`)}return cf(c,"",s),{manifest:c,onboardingSkill:Ei(p)?p.onboardingSkill:void 0}}var AO=new Set(["displayName",...IS]);function IO(e){const t=e[ns];if(!Ei(t))return e;const{onboardingSkill:r,...s}=t;return Ei(s.interface)&&(s.interface=Object.fromEntries(Object.entries(s.interface).filter(([n,i])=>!AO.has(n)||typeof i!="string"||!ag.test(i)))),{...e,[ns]:s}}function RO(e,t,r,s){const n=e.extensions[ns],i=Ei(n)?{...n}:void 0;if(i!==void 0&&(delete i.onboardingSkill,e.extensions[ns]=i),t===void 0)return;const o=typeof t=="string"?zi("",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 CO={maxEntries:1e3,maxTotalBytes:104857600,maxFileBytes:10485760,maxPathBytes:512,maxPathDepth:20,maxSkills:20,maxMcpServers:20},RS=Object.freeze({strict:2,"openai-compatible":1}),vs=".codex-plugin/plugin.json",CS=".agent-plugin/plugin.json",PS=".claude-plugin/plugin.json",PO=".mcp.json",xS=[{path:vs,layout:"codex"},{path:CS,layout:"agent-legacy"},{path:PS,layout:"claude"}],xO=new Set(["skills","mcpServers","apps","interface","onboardingSkill","extensions"]),OS={hooks:"lifecycle hooks",commands:"slash commands",agents:"agents",outputStyles:"output styles",lspServers:"language servers"};function en(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function MS(e,t){if(typeof e!="string")return!1;const r=zi("",e);return r.ok&&r.path===t}function LS(e,t,r){const s=e.extensions,n=en(s)?s[ns]:void 0,i=en(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{[ns]:r,...s}=e??{};return Object.keys(t).length>0?{...s,[ns]: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 OO(e,t,{filePaths:r,issues:s}){if(e===void 0)return r.has(".mcp.json")?{legacyMcp:{kind:"file",path:PO}}:{};if(en(e))return{legacyMcp:{kind:"inline",path:t,document:e}};const n=typeof e=="string"?zi("",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 MO(e,t,r){const{issues:s}=r,n=t.manifestPath,i={};for(const[c,l]of Object.entries(e))!xO.has(c)&&!(c in OS)&&(i[c]=l);const o=i.$schema;String(o).startsWith("https://agent-plugins.org/schemas/")||(i.$schema=af["1.0.0"]);const a=e.extensions;if(a!==void 0&&!en(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,...OO(e.mcpServers,n,r)}}function LO(e,t,{readJson:r,issues:s}){const n=l=>(s.warn("MANIFEST_OVERLAY_IGNORED",`"${vs}" is ignored: ${l}`,{path:vs}),{interpretation:t,record:e}),i=e.extensions;if(i!==void 0&&!en(i))return n(`"${Mn}" has no usable "extensions"`);if(en(i?.["com.openai"]))return n(`"${Mn}" declares extensions["${ns}"], which replaces it`);const o=new mi,a=r(vs,o);if(!en(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 ${vs} is ignored: with a root plugin.json it is always "${u}"`,{path:vs});$S(a,vs,s);const c=LS(a,vs,s);return{interpretation:{...t,overlayPath:vs},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 NO(e){const{profile:t,filePaths:r,readJson:s,issues:n}=e,i={profile:t,revision:RS[t],layout:"agent-plugins",manifestPath:Mn},o=s(Mn,n);return t==="strict"||!en(o)?{interpretation:i,record:o}:(DS(Mn,e),r.has(".codex-plugin/plugin.json")?LO(o,i,e):{interpretation:i,record:o})}function $O(e){const{profile:t,location:r,readJson:s,issues:n}=e;if(r.layout==="agent-plugins")return NO(e);DS(r.path,e);const i={profile:t,revision:RS[t],layout:r.layout,manifestPath:r.path},o=s(r.path,n);return en(o)?MO(o,i,e):{interpretation:i,record:o}}var q_="2026-08-19",z_="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 DO(e){return Object.hasOwn(zS,e)}var v9=[...US,...qS.map(e=>e.page)],F_={},UO=[...US.map(e=>({page:e,url:`${z_}/${e}`,revisionUrl:`${z_}/${e}.md`,format:"markdown",revision:F_[e]??null,snapshotDate:q_})),...qS.map(e=>({page:e.page,url:e.url,revisionUrl:e.url,format:"html",revision:F_[e.page]??null,snapshotDate:q_}))],qO=Object.freeze(Object.fromEntries(UO.map(e=>[e.page,e])));function Yr(e,t){const r=qO[DO(e)?zS[e]:e];return{page:r.page,section:t,url:r.url,revision:r.revision,snapshotDate:r.snapshotDate}}var ou={maxCompressedBytes:104857600,maxUncompressedBytes:536870912,maxEntries:5e3},zO={portable:Mn,canonical:vs,accepted:[CS,PS]},_r={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"],au={minEdgePx:48,maxEdgePx:4096,mustBeSquare:!0,maxBytes:5242880,acceptedMimeTypes:["image/png","image/jpeg","image/webp","image/svg+xml"]},FO={lightBackground:"#FFFFFF",darkBackground:"#212121",minRatio:2},ui={maxSkillMarkdownBytes:262144,maxPageBytes:1048576,maxSkillTotalBytes:5242880,maxImportedTotalBytes:8388608,maxSkills:5,maxPagesPerSkill:10},jO="/.well-known/openai-apps-challenge",HO="text/html;profile=mcp-app",BO="/mcp",VO=["readOnlyHint","destructiveHint","openWorldHint"],gi={successCount:5,failureCount:3},GO={originChangeRequiresNewPlugin:!0,uiContentChangesStayLive:!0,uiContentCacheSeconds:3600},_9={archiveLimits:ou,manifestLocations:zO,fieldLimits:_r,listingCategories:FS,imageConstraints:au,brandColorContrast:FO,mcpSkillLimits:ui,domainVerificationPath:jO,appHtmlMime:HO,expectedMcpPath:BO,requiredToolAnnotations:VO,submissionTestCases:gi,releaseRules:GO,source:Yr("deploy/submission","Host profile constants")},jS={columns:["Resource","Lookup"],keys:["fixture","lookup"],placeholders:[["Sample Project",'get_project {"name": "Sample Project"}']],maxRows:20,grow:!0},KO="Upload new or existing plugin",WO={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"}}]}}},JO={"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."}},YO=[{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"]}],XO={"runtime-compatibility":"mcp","directory-policy":"mcp","plugin-package":"upload","release-contract":"mcp","optional-features":"mcp","submission-artifacts":"reviewer","experience-insights":"mcp"},xo={title:KO,steps:WO,fields:JO,placements:YO,laneSteps:XO},QO=["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=QO.find(c=>c===o);if(!a)throw new Error(`${e} names an unknown need: ${o}`);return a})})))}var ZO=xo.fields,j_=xo.steps,Vi={format:"https-url"},zt={managedBy:"package"};function It(e,t={}){return{control:e,required:!0,...t}}function ar(e,t={}){return{control:e,...t}}var eM={"listing.displayName":It("text",{...zt,maxLength:30}),"listing.shortDescription":It("text",{...zt,maxLength:30}),"listing.description":It("textarea",{...zt,maxLength:4e3}),"listing.developer":It("text",{...zt,maxLength:80}),"listing.name":It("text",{...zt,maxLength:_r.pluginNameMaxLength}),"listing.category":ar("select",zt),"listing.capabilities":ar("multi-select",{...zt,freeEntry:!0,maxItems:20}),"listing.website":It("text",{...zt,...Vi}),"listing.support":It("text",{...zt,...Vi}),"listing.privacyPolicy":It("text",{...zt,...Vi}),"listing.terms":It("text",{...zt,...Vi}),"listing.starterPrompts":ar("multi-select",{...zt,freeEntry:!0,maxItems:3}),"mcp.serverUrl":It("server",{...zt,...Vi}),"mcp.verificationToken":ar("text"),"reviewer.loginUrl":It("text",Vi),"reviewer.tenant":ar("text"),"reviewer.username":It("text"),"reviewer.passwordSecret":It("secret"),"reviewer.signInSteps":ar("textarea",{requiredWith:["reviewer.tenant"]}),"reviewer.identityTool":ar("text",{requiredWith:["reviewer.expectedIdentity","reviewer.expectedOrganization"]}),"reviewer.identityArgs":ar("text"),"reviewer.expectedIdentityPath":ar("text",{requiredWith:["reviewer.expectedIdentity"]}),"reviewer.expectedIdentity":ar("text",{requiredWith:["reviewer.expectedIdentityPath"]}),"reviewer.expectedOrganizationPath":ar("text",{requiredWith:["reviewer.expectedOrganization"]}),"reviewer.expectedOrganization":ar("text",{requiredWith:["reviewer.expectedOrganizationPath"]}),"reviewer.fixtures":ar("pairs",{pairs:jS}),"reviewer.testCases":It("rows",{...zt,minItems:gi.successCount,maxItems:gi.successCount}),"reviewer.negativeTestCases":It("rows",{...zt,minItems:gi.failureCount,maxItems:gi.failureCount}),"reviewer.demoRecordingUrl":It("text",{...zt,format:"url"}),"reviewer.releaseNotes":It("textarea",zt),"submit.developerIdentity":It("text"),"submit.attestations":It("checkbox-group",{declaration:!0,minItems:xo.fields["submit.attestations"].options.length}),"submit.additionalContext":ar("textarea")},y9={id:"chatgpt-plugin",directory:"openai",title:xo.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(j_).map(e=>({id:e,...j_[e],fields:HS(e,eM,ZO)})),placements:BS("chatgpt-plugin.json",xo.placements),laneSteps:xo.laneSteps},tM="2026-11-13",rM="2026-08-19";var sM=["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"],nM=[{page:"directory",url:"https://claude.com/docs/directory/publish"},{page:"verification",url:"https://claude.com/docs/connectors/verification"}],iM=["directory","verification","submission","review-criteria","authentication"],oM={},aM=sM.map(e=>{const t=nM.find(s=>s.page===e),r=iM.includes(e)?tM:void 0;return{page:e,url:t?.url??`https://claude.com/docs/connectors/building/${e}`,revision:oM[e]??r??null,snapshotDate:r??rM}}),cM=Object.freeze(Object.fromEntries(aM.map(e=>[e.page,e])));function gn(e,t){const r=cM[e];return{page:r.page,section:t,url:r.url,revision:r.revision,snapshotDate:r.snapshotDate}}var lM=["https://claude.ai/api/mcp/auth_callback","https://claude.com/api/mcp/auth_callback"];var uM=".claudemcpcontent.com";var dM="text/html;profile=mcp-app",pM={toolListingMs:5e3,handshakeMs:3e3,widgetFirstPaintMs:3e3},hM={minViewportWidthPx:320,minTouchTargetPx:44},H_=200,lr={nameMaxLength:100,oneLinerMaxLength:H_,taglineMaxLength:H_,descriptionMaxLength:2e3,categoriesMin:1,categoriesMax:5,useCasesMax:3,screenshotsMin:3,screenshotsMax:5,screenshotMinWidthPx:1e3,toolNameMaxLength:64},b9={callbackUrls:lM,loopbackRedirectIgnoresPort:!0,appContentDomainSuffix:uM,appContentDomainHashLength:32,appHtmlMime:dM,latencyBudgets:pM,appDesignBudgets:hM,submissionLimits:lr,source:gn("directory","Host profile constants")},fM="Submit an MCP connector",mM={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"]}]}}},gM=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."}}`),vM=[{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"]}],_M={"runtime-compatibility":"connection","directory-policy":"tools","optional-features":"authentication","submission-artifacts":"listing","experience-insights":"tools"},Oo={title:fM,steps:mM,fields:gM,placements:vM,laneSteps:_M},yM=Oo.fields,B_=Oo.steps,Gi={declaration:!0},Ea={format:"https-url"};function ft(e,t={}){return{control:e,required:!0,...t}}function Bt(e,t={}){return{control:e,...t}}var bM={"connection.serverUrl":ft("server",{format:"url"}),"connection.differentUrls":Bt("checkbox"),"listing.name":ft("text",{maxLength:lr.nameMaxLength}),"listing.slug":ft("text",{format:"slug"}),"listing.oneLiner":ft("text",{maxLength:lr.oneLinerMaxLength}),"listing.description":ft("textarea",{maxLength:lr.descriptionMaxLength}),"listing.categories":ft("multi-select",{freeEntry:!0,minItems:lr.categoriesMin,maxItems:lr.categoriesMax}),"listing.authorName":ft("text",{requiredOn:"review",satisfiedBy:[{key:"company.name"},{key:"company.website",format:"https-url"}]}),"listing.authorUrl":Bt("text",Ea),"listing.iconUrl":Bt("text",Ea),"listing.documentationUrl":ft("text",Ea),"listing.enterpriseAuthDocsUrl":Bt("text",Ea),"listing.support":ft("text",{format:"url-or-email"}),"listing.privacyPolicyUrl":ft("text",Ea),"useCases.pairs":ft("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:lr.useCasesMax}}),"useCases.prerequisites":ft("textarea"),"useCases.access":ft("radio",{...Gi,default:"read-only"}),"company.name":ft("text",{prefill:"organization-name"}),"company.website":ft("text",{format:"url"}),"company.contactName":ft("text",{prefill:"account-name"}),"company.contactEmail":ft("text",{format:"email",prefill:"account-email"}),"company.role":Bt("text"),"company.anthropicContact":Bt("text"),"authentication.requirement":ft("radio",{default:"always"}),"authentication.oauthClient":ft("radio",{default:"dcr"}),"dataHandling.apiOwnership":ft("radio-cards",{...Gi,default:"own"}),"dataHandling.healthData":ft("radio",{...Gi,default:"no"}),"dataHandling.sponsored":ft("radio",Gi),"testLaunch.instructions":Bt("textarea"),"testLaunch.selfTested":Bt("checkbox",Gi),"testLaunch.identityTool":Bt("text",{requiredWith:["testLaunch.expectedIdentity","testLaunch.expectedOrganization"]}),"testLaunch.identityArgs":Bt("text"),"testLaunch.expectedIdentityPath":Bt("text",{requiredWith:["testLaunch.expectedIdentity"]}),"testLaunch.expectedIdentity":Bt("text",{requiredWith:["testLaunch.expectedIdentityPath"]}),"testLaunch.expectedOrganizationPath":Bt("text",{requiredWith:["testLaunch.expectedOrganization"]}),"testLaunch.expectedOrganization":Bt("text",{requiredWith:["testLaunch.expectedOrganizationPath"]}),"testLaunch.fixtures":Bt("pairs",{pairs:jS}),"compliance.acknowledgments":ft("checkbox-group",{...Gi,minItems:Oo.fields["compliance.acknowledgments"].options.length}),"compliance.additionalNotes":Bt("textarea")},w9={id:"claude-connector",directory:"claude",title:Oo.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(B_).map(e=>({id:e,...B_[e],fields:HS(e,bM,yM)})),placements:BS("claude-connector.json",Oo.placements),laneSteps:Oo.laneSteps};function cg(e){return e.class==="required"||e.class==="runtime-blocker"}var S9=Object.freeze({maxQuestionsPerRun:24,maxKeyChars:200,maxNameChars:200,maxFieldChars:300,maxTextChars:2e3,maxReferences:10,maxQuoteChars:400}),wM=String.raw`(?:call|invoke|run|use|execute|trigger|poll|retry|re-?run|chain|pair|combine)`,k9=String.raw`(?:calling|using|running|invoking|executing|polling)`,SM=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|${wM})`,kM=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+)`,EM=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+)?`,E9=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}`,T9=String.raw`[^.;:!?,]{0,30}?`,A9=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))`,I9=String.raw`(?:before|after|once|until|prior\s+to|together\s+with|alongside|instead\s+of|in\s+place\s+of|rather\s+than)`,R9=new RegExp(`${kM}(?:${SM}|confirm|ask|wait|stop|ensure|tell|show|list|try|avoid|save|create|delete|update|refresh|compare)\\b|${EM}\\w`,"i"),wd=e=>new RegExp(`\\b(?:${e})(?:e|es|ed|ing|s)?\\b`,"i"),C9=wd("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"),P9=wd("get|list|read|fetch|retriev|search|find|view|show|return|quer(?:y|ies|ied|ying)|inspect|describ|count|lookup"),x9=wd("delet|remov|overwrit|overwritten|drop|dropp|destroy|eras|purg|wip|truncat|revok|replac|permanently|irreversibl"),O9=wd("creat|add|insert|append|increment|generat|send|sent|post|submit|submitt"),M9=Object.freeze({maxTools:500,maxCases:1500,maxFixtures:50,maxCleanupSteps:50,maxIdLength:200,maxPlanLength:524288,maxCalls:3e3,maxConcurrency:4,minCallTimeoutMs:1e3,maxCallTimeoutMs:12e4});function TM(e){const t=[];return lf(e,r=>{t.push(r)}),t}function AM(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 lf(e,t){const r=AM(e);return r?t(r):Array.isArray(e)?e.map(s=>lf(s,t)):typeof e=="object"&&e!==null?Object.fromEntries(Object.entries(e).map(([s,n])=>[s,lf(n,t)])):e}function L9(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:TM(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 IM=e=>e/2**32|0,RM=e=>e>>>0;function CM(e,t,r,s){const n=IM(r),i=RM(r);e.setUint32(t,s?i:n,s),e.setUint32(t+4,s?n:i,s)}function V_(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}var uf=e=>e?`"${e}" `:"";function PM(e,t=""){if(typeof e!="number")throw new TypeError(uf(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(uf(t)+"expected integer >= 0, got "+e);return e}function lg(e,t,r=""){if(V_(e)&&(t===void 0||e.length===t))return e;t!==void 0&&PM(t,"length");const s=V_(e),n=t!==void 0?` of length ${t}`:"",i=s?`length=${e.length}`:`type=${typeof e}`,o=uf(r)+"expected Uint8Array"+n+", got "+i;throw s?new RangeError(o):new TypeError(o)}var xM=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError((t==="object"?"":`"${t}" `)+"expected object, got type="+typeof e)},G_=(e,t)=>{xM(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 K_(e,t=!0){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function OM(e,t){lg(e,void 0,"output");const r=t.outputLen;if(!(e.length>=r))throw new RangeError('"output" expected length >= '+r)}function df(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Cp(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function os(e,t){return e<<32-t|e>>>t}var MM=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",LM=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function NM(e){if(lg(e),MM)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=LM[e[r]];return t}function $M(e){if(typeof e!="string")throw new TypeError("string expected");const t=new TextEncoder().encode(e);try{return new Uint8Array(t)}finally{df(t)}}function DM(e,t,r="opts"){return G_(e,"defaults"),t!==void 0&&G_(t,r),Object.assign(Object.create(null),e,t)}function UM(e,t={}){if(typeof e!="function")throw new TypeError('"hashCons" expected function, got type='+typeof e);t=DM({},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 qM=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function zM(e,t,r){return e&t^~e&r}function FM(e,t,r){return e&t^e&r^t&r}var jM=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=Cp(this.buffer)}update(e){K_(this),lg(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=Cp(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){K_(this),OM(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)),CM(r,s-8,this.length*8,n),this.process(r,0),this.roundClean();const o=e===t?r:Cp(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()}},HM=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),BM=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]),cn=new Uint32Array(64),VM=class extends jM{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)cn[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const p=cn[u-15],d=cn[u-2],h=os(p,7)^os(p,18)^p>>>3,m=os(d,17)^os(d,19)^d>>>10;cn[u]=m+cn[u-7]+h+cn[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=os(o,6)^os(o,11)^os(o,25),d=l+p+zM(o,a,c)+BM[u]+cn[u]|0,h=(os(r,2)^os(r,13)^os(r,22))+FM(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(){df(cn)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),df(this.buffer)}},GM=class extends VM{constructor(){super(32,HM)}},KM=UM(()=>new GM,qM(1));function WM(e){return cg(e)}var JM=["experience"];var YM=["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"],N9=Object.freeze({readinessKind:"claude-directory-readiness",observationKinds:JM,knownIds:YM,schemaVersion:"1"}),XM=[{id:"claude.experience.tool-descriptions-uninformative",title:"Tool descriptions may not tell Claude when to use the tool",lane:"experience-insights",class:"heuristic",source:gn("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:gn("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:gn("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:gn("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:gn("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:gn("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:gn("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."}],$9=Object.freeze({experienceLane:"experience-insights",engineVersion:"1",mappings:XM}),Ki={serverUrl:"serverUrl",pluginBundle:"pluginBundle",submissionProfile:"submissionProfile",draftSnapshot:"draftSnapshot",publishedSnapshot:"publishedSnapshot",toolListing:"toolListing",importedSkills:"importedSkills"},D9=Object.freeze({"skills-only":{hasMcpServer:!1,hasUploadedPackage:!0,hasImportedSkills:!1,requiredInputs:[Ki.pluginBundle],summary:"a skills package with no MCP server"},"mcp-only":{hasMcpServer:!0,hasUploadedPackage:!1,hasImportedSkills:!1,requiredInputs:[Ki.serverUrl],summary:"an MCP endpoint with no uploaded package"},"mcp-imported-skills":{hasMcpServer:!0,hasUploadedPackage:!1,hasImportedSkills:!0,requiredInputs:[Ki.serverUrl,Ki.importedSkills],summary:"an MCP endpoint whose skills are imported at scan time"},"mcp-uploaded-skills":{hasMcpServer:!0,hasUploadedPackage:!0,hasImportedSkills:!1,requiredInputs:[Ki.serverUrl,Ki.pluginBundle],summary:"an MCP endpoint plus an uploaded skills package"}}),U9=Object.freeze({"technical-preflight":["runtime-compatibility","directory-policy","plugin-package"],"submission-ready":["runtime-compatibility","directory-policy","plugin-package","submission-artifacts","release-contract"]});function QM(e){return typeof e=="object"&&e!==null&&e.readinessKind==="openai-directory-readiness"}var ZM=["experience"];var e1=["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"],q9=Object.freeze({readinessKind:"openai-directory-readiness",observationKinds:ZM,knownIds:e1,schemaVersion:"1"}),t1=[{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:Yr("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:Yr("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:Yr("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:Yr("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:Yr("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:Yr("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:Yr("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:Yr("build/auth","§Consent"),remediation:"State which account is connected and what scope it grants, in the copy the user sees at consent time."}],z9=Object.freeze({experienceLane:"experience-insights",engineVersion:"2",mappings:t1}),r1=["oauth-dcr","oauth-cimd","oauth-preregistered","static-header","authless","custom-connection"],s1=["no-user-data","processes-user-data","stores-user-data","shares-with-third-parties"],n1=["ownsOrIsAuthorizedForService","accurateDataHandlingDisclosure","compliesWithUsagePolicies","noProhibitedContent","maintainsSecurityPractices","respondsToSecurityReports","keepsListingAccurate"],yl=w().url().refine(e=>e.startsWith("https://"),{message:"must be an https:// URL"}),i1=Y({url:w().min(1),mimeType:w().min(1),widthPx:De().int().positive(),heightPx:De().int().positive(),prompt:w().min(1)}),F9=Y({name:w().min(1).max(lr.nameMaxLength),tagline:w().min(1).max(lr.oneLinerMaxLength),description:w().min(1).max(lr.descriptionMaxLength),categories:re(w().min(1)).min(lr.categoriesMin).max(lr.categoriesMax),slug:w().min(1).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/,"must be a lowercase kebab-case slug"),documentationUrl:yl,privacyPolicyUrl:yl,supportUrl:yl,iconUrl:yl,declaredAuthMode:pt(r1),dataHandling:re(pt(s1)).min(1),screenshots:re(i1).min(lr.screenshotsMin).max(lr.screenshotsMax),attestations:Qe(pt(n1),Ce())}),o1=mO;function or(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:o1}})}var Sr={kind:"present"},Je={kind:"nonEmpty"},vi={kind:"nonEmpty",required:!0},Lr={kind:"text"},yo={kind:"text",singleLine:!0},Cc=(...e)=>({kind:"type",types:e}),Be=Cc("string"),tn=Cc("object"),pf=Cc("boolean"),kt=(e,t)=>t===void 0?{kind:"length",max:e}:{kind:"length",max:e,submissionMax:t},er=e=>({kind:"pattern",pattern:e}),VS=e=>({kind:"pattern",pattern:e,forbidden:!0}),a1=e=>({kind:"enum",values:e}),W_=e=>({kind:"count",max:e}),N=(e,...t)=>t.length>0?{field:e,rules:t}:{field:e},ze=e=>({path:e}),_i="interface.displayName",An="interface.shortDescription",yi="interface.longDescription",Rn="interface.developerName",Qa="interface.capabilities[]",hf="interface.defaultPrompt",Za="interface.defaultPrompt[]",cu="(?:0|[1-9]\\d*)",J_=`(?:${cu}|\\d*[A-Za-z-][0-9A-Za-z-]*)`,c1=new RegExp(`^${cu}\\.${cu}\\.${cu}(?:-${J_}(?:\\.${J_})*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$`),ff=/^#[0-9A-Fa-f]{6}$/,Ta=/^https:\/\/(?!:)[^\s/?#@]+(?:[/?#]\S*)?$/i,l1=or({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:N("name"),plugin_version_unchanged:N("version"),claude_format_normalized:ze(".claude-plugin/plugin.json"),manifest_normalized:ze(".codex-plugin/plugin.json"),developer_name_defaulted:N(Rn)}}),u1=or({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."]}),d1=or({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: ${bs.plugin_root_ambiguous.message}`,`plugin_root_has_siblings: ${bs.plugin_root_has_siblings.message}`]}),Fs="skills/<skill>/SKILL.md",Aa="skills/<skill>/agents/openai.yaml",Pp="interface.display_name",xp="interface.short_description",Y_="interface.icon_small",X_="interface.icon_large",Op="interface.brand_color",Q_="interface.default_prompt",p1="policy.allow_implicit_invocation",h1=or({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:ze(Fs),skill_manifest_not_regular_file:ze(Fs),skill_manifest_unreadable:ze(Fs),skill_manifest_invalid_utf8:ze(Fs),skill_frontmatter_missing:ze(Fs),skill_frontmatter_unclosed:ze(Fs),skill_frontmatter_yaml_malformed:ze(Fs),skill_frontmatter_wrong_type:ze(Fs),skill_name_missing:N("name",Sr),skill_name_wrong_type:N("name",Be),skill_name_empty:N("name",Je),skill_name_character_unsupported:N("name",Lr),skill_description_missing:N("description",Sr),skill_description_wrong_type:N("description",Be),skill_description_empty:N("description",Je),skill_description_too_long:N("description",kt(1024)),skill_description_character_unsupported:N("description",Lr),skill_identity_duplicate:N("name")}}),f1=or({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:ze(Aa),skill_agent_unreadable:ze(Aa),skill_agent_invalid_utf8:ze(Aa),skill_agent_yaml_malformed:ze(Aa),skill_agent_top_level_wrong_type:ze(Aa),skill_agent_interface_missing:N("interface",Sr),skill_agent_interface_wrong_type:N("interface",tn),skill_agent_display_name_missing:N(Pp,Sr),skill_agent_display_name_wrong_type:N(Pp,Be),skill_agent_display_name_empty:N(Pp,Je),skill_agent_short_description_missing:N(xp,Sr),skill_agent_short_description_wrong_type:N(xp,Be),skill_agent_short_description_empty:N(xp,Je),skill_agent_icon_small_wrong_type:N(Y_,Be),skill_agent_icon_small_empty:N(Y_,Je),skill_agent_icon_large_wrong_type:N(X_,Be),skill_agent_icon_large_empty:N(X_,Je),skill_agent_brand_color_wrong_type:N(Op,Be),skill_agent_brand_color_empty:N(Op,Je),skill_agent_brand_color_format:N(Op,er(ff)),skill_agent_default_prompt_wrong_type:N(Q_,Be),skill_agent_default_prompt_empty:N(Q_,Je),skill_agent_policy_wrong_type:N("policy",tn),skill_agent_allow_implicit_invocation_wrong_type:N(p1,pf),skill_agent_dependencies_wrong_type:N("dependencies",tn),skill_agent_dependency_unsupported:N("dependencies")}}),m1=or({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."]}),g1=or({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:N("interface.logo"),plugin_composer_icon_path_missing:N("interface.composerIcon")}}),v1=or({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:ze(".app.json"),undeclared_app_manifest_ignored:ze(".app.json"),undeclared_mcp_manifest_ignored:ze(".mcp.json"),skill_file_ignored:ze("skills/"),skill_symlink_ignored:ze("skills/"),skill_metadata_ignored:ze(Fs)}}),_1=["Productivity","Creativity","Developer Tools","Business & Operations","Data & Analytics","Communication","Education & Research","Security","Finance","Healthcare","Travel","Entertainment","Other"],bl="interface.category",y1=a1(_1),Z_="interface.capabilities",wl="interface.websiteURL",Sl="interface.privacyPolicyURL",kl="interface.termsOfServiceURL",El="interface.supportURL",Tl="interface.brandColor",Al="interface.brandColorDark",Il=kt(2048,1024),b1=or({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:N("interface",tn),plugin_display_name_wrong_type:N(_i,Be),plugin_display_name_empty:N(_i,vi),plugin_display_name_too_long:N(_i,kt(80)),plugin_display_name_character_unsupported:N(_i,Lr),plugin_short_description_missing:N(An,Sr),plugin_short_description_wrong_type:N(An,Be),plugin_short_description_empty:N(An,Je),plugin_short_description_too_long:N(An,kt(240)),plugin_short_description_character_unsupported:N(An,yo),plugin_long_description_wrong_type:N(yi,Be),plugin_long_description_empty:N(yi,vi),plugin_long_description_too_long:N(yi,kt(4e3)),plugin_long_description_character_unsupported:N(yi,Lr),plugin_developer_name_wrong_type:N(Rn,Be),plugin_developer_name_empty:N(Rn,vi),plugin_developer_name_too_long:N(Rn,kt(120)),plugin_developer_name_character_unsupported:N(Rn,Lr),plugin_category_wrong_type:N(bl,Be),plugin_category_empty:N(bl,Je),plugin_category_unknown:N(bl,y1),plugin_category_character_unsupported:N(bl,Lr),plugin_capabilities_wrong_type:N(Z_,Cc("array")),plugin_capabilities_too_many:N(Z_,W_(20)),plugin_capability_wrong_type:N(Qa,Be),plugin_capability_empty:N(Qa,Je),plugin_capability_too_long:N(Qa,kt(120)),plugin_capability_character_unsupported:N(Qa,Lr),plugin_website_url_wrong_type:N(wl,Be),plugin_website_url_empty:N(wl,Je),plugin_website_url_format:N(wl,er(Ta)),plugin_website_url_too_long:N(wl,Il),plugin_privacy_policy_url_wrong_type:N(Sl,Be),plugin_privacy_policy_url_empty:N(Sl,Je),plugin_privacy_policy_url_format:N(Sl,er(Ta)),plugin_privacy_policy_url_too_long:N(Sl,Il),plugin_terms_of_service_url_wrong_type:N(kl,Be),plugin_terms_of_service_url_empty:N(kl,Je),plugin_terms_of_service_url_format:N(kl,er(Ta)),plugin_terms_of_service_url_too_long:N(kl,Il),plugin_support_url_wrong_type:N(El,Be),plugin_support_url_empty:N(El,Je),plugin_support_url_format:N(El,er(Ta)),plugin_support_url_too_long:N(El,Il),plugin_homepage_wrong_type:N("homepage",Be),plugin_homepage_empty:N("homepage",Je),plugin_homepage_format:N("homepage",er(Ta)),plugin_homepage_too_long:N("homepage",kt(2048)),plugin_brand_color_wrong_type:N(Tl,Be),plugin_brand_color_empty:N(Tl,Je),plugin_brand_color_format:N(Tl,er(ff)),plugin_brand_color_dark_wrong_type:N(Al,Be),plugin_brand_color_dark_empty:N(Al,Je),plugin_brand_color_dark_format:N(Al,er(ff)),plugin_brand_color_contrast:N(Tl),plugin_brand_color_dark_contrast:N(Al),plugin_default_prompt_wrong_type:N(hf,Cc("string","array")),plugin_default_prompt_too_many:N(hf,W_(3)),plugin_default_prompt_entry_wrong_type:N(Za,Be),plugin_default_prompt_empty:N(Za,Je),plugin_default_prompt_too_long:N(Za,kt(512,128)),plugin_default_prompt_character_unsupported:N(Za,yo)}}),w1=/^https:\/\/[^\s/?#]+(?:[/?#]\S*)?$/i,S1=VS(/^[a-z][a-z\d+.-]*:\/\/[^\s/?#]*@/i),k1=/^(?:\.\/)?skills\/?$/,E1=/^(?:\.\/)?\.app\.json$/,T1=/^(?:\.\/)?\.mcp\.json$/,A1=/^(?:asdk_app_|connector_|templated_apps_)[A-Za-z0-9][\w-]*$/,I1=or({table:"Plugin manifest errors",stage:"upload",document:"plugin-manifest",rows:[`plugin_manifest_missing: ${bs.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: ${bs.plugin_name_missing.message}`,`plugin_name_wrong_type: ${bs.plugin_name_wrong_type.message}`,`plugin_name_empty: ${bs.plugin_name_empty.message}`,`plugin_name_too_long: ${bs.plugin_name_too_long.message}`,`plugin_name_format: ${bs.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:ze(".codex-plugin"),codex_manifest_path_not_file:ze(".codex-plugin/plugin.json"),plugin_id_wrong_type:N("id",Be),plugin_id_empty:N("id",Je),plugin_name_missing:N("name",Sr),plugin_name_wrong_type:N("name",Be),plugin_name_empty:N("name",Je),plugin_name_too_long:N("name",kt(64)),plugin_name_format:N("name",er(ES)),plugin_version_missing:N("version",Sr),plugin_version_wrong_type:N("version",Be),plugin_version_empty:N("version",Je),plugin_version_not_semver:N("version",er(c1)),plugin_version_too_long:N("version",kt(64)),plugin_description_missing:N("description",Sr),plugin_description_wrong_type:N("description",Be),plugin_description_empty:N("description",Je),plugin_description_too_long:N("description",kt(1024)),plugin_description_character_unsupported:N("description",Lr),plugin_developer_missing:N("author.name",Sr),plugin_author_wrong_type:N("author",tn),plugin_author_name_wrong_type:N("author.name",Be),plugin_author_name_empty:N("author.name",Je),plugin_author_name_too_long:N("author.name",kt(120)),plugin_author_name_character_unsupported:N("author.name",Lr),plugin_author_email_wrong_type:N("author.email",Be),plugin_author_email_empty:N("author.email",Je),plugin_author_email_too_long:N("author.email",kt(320)),plugin_author_email_character_unsupported:N("author.email",Lr),plugin_author_url_wrong_type:N("author.url",Be),plugin_author_url_empty:N("author.url",Je),plugin_author_url_not_https:N("author.url",er(w1)),plugin_author_url_has_credentials:N("author.url",S1),plugin_author_url_too_long:N("author.url",kt(2048)),plugin_author_url_character_unsupported:N("author.url",Lr)}}),R1=or({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:N("skills",Be),plugin_skills_path_empty:N("skills",Je),plugin_skills_path_unsupported:N("skills",er(k1)),plugin_skills_directory_missing:ze("skills/"),plugin_skills_path_not_directory:ze("skills/"),plugin_apps_path_wrong_type:N("apps",Be),plugin_apps_path_empty:N("apps",Je),plugin_apps_path_unsupported:N("apps",er(E1)),plugin_apps_file_missing:ze(".app.json"),plugin_apps_path_not_file:ze(".app.json"),plugin_mcp_path_wrong_type:N("mcpServers",Be),plugin_mcp_path_empty:N("mcpServers",Je),plugin_mcp_path_unsupported:N("mcpServers",er(T1)),plugin_mcp_file_missing:ze(".mcp.json"),plugin_mcp_path_not_file:ze(".mcp.json")}}),C1=or({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:ze(".mcp.json"),mcp_manifest_json_malformed:ze(".mcp.json"),mcp_manifest_wrong_type:ze(".mcp.json"),mcp_servers_missing:N("mcpServers",Sr),mcp_servers_wrong_type:N("mcpServers",tn),mcp_server_name_empty:N("mcpServers"),mcp_server_wrong_type:N("mcpServers.*",tn)}}),P1=or({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:ze(".app.json"),app_manifest_json_malformed:ze(".app.json"),app_manifest_wrong_type:ze(".app.json"),app_entries_missing:N("apps",Sr),app_entries_wrong_type:N("apps",tn),app_entry_wrong_type:N("apps.*",tn),app_id_missing:N("apps.*.id",Sr),app_id_wrong_type:N("apps.*.id",Be),app_id_format:N("apps.*.id",er(A1)),app_entry_optional_wrong_type:N("apps.*.optional",pf),app_entry_required_wrong_type:N("apps.*.required",pf)}}),x1=VS(/(?:^|\s)@\S/),O1=or({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:N(_i,vi),submission_display_name_too_long:N(_i,kt(30)),submission_display_name_character_unsupported:N(_i,yo),submission_subtitle_required:N(An,vi),submission_subtitle_too_long:N(An,kt(30)),submission_subtitle_character_unsupported:N(An,yo),submission_description_required:N(yi,vi),submission_description_too_long:N(yi,kt(4e3)),submission_description_character_unsupported:N(yi,Lr),submission_developer_name_required:N(Rn,vi),submission_developer_name_too_long:N(Rn,kt(80)),submission_developer_name_character_unsupported:N(Rn,yo),plugin_capability_invalid:N(Qa,Je,yo,kt(120)),plugin_default_prompt_mention:N(Za,x1),plugin_default_prompt_duplicate:N(hf)}}),M1=or({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=[...O1,...M1,...l1,...u1,...d1,...I1,...b1,...R1,...C1,...h1,...f1,...m1,...g1,...P1,...v1],L1=GS,j9=Object.freeze(Object.fromEntries(GS.map(e=>[e.code,e]))),N1={"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"},$1={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"},D1=L1.map(e=>({id:e.code,category:$1[e.code]??N1[e.table],severity:e.severity==="warning"?"advisory":"blocking",message:e.message,...e.code==="plugin_name_too_long"?{limit:{name:"fieldLimits.pluginNameMaxLength",value:_r.pluginNameMaxLength}}:{},source:{...Yr("deploy/submission-errors",`§${e.table}`),snapshotDate:e.source.capturedOn}})),ce=e=>Yr("deploy/submission-errors",e),U1=[{id:"archive-too-large",category:"package-archive",severity:"blocking",message:"The uploaded archive exceeds the maximum compressed size.",limit:{name:"archiveLimits.maxCompressedBytes",value:ou.maxCompressedBytes},source:ce("§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:ou.maxUncompressedBytes},source:ce("§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:ou.maxEntries},source:ce("§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:ce("§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:ce("§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:ce("§Shared package checks → Entry paths")},{id:"archive-backslash-path",category:"package-archive",severity:"blocking",message:"An entry path uses a backslash separator.",source:ce("§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:ce("§Shared package checks → Entry paths")},{id:"archive-path-whitespace",category:"package-archive",severity:"blocking",message:"An entry path has leading or trailing whitespace.",source:ce("§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:ce("§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:ce("§Shared package checks → Entry paths")},{id:"archive-symlink-entry",category:"package-archive",severity:"blocking",message:"The archive contains a symlink or hardlink entry.",source:ce("§Shared package checks → Archive integrity")},{id:"manifest-missing",category:"package-manifest",severity:"blocking",message:"The package contains no plugin manifest.",source:ce("§Shared package checks → Manifest")},{id:"manifest-invalid-json",category:"package-manifest",severity:"blocking",message:"The plugin manifest is not valid JSON.",source:ce("§Shared package checks → Manifest")},{id:"manifest-name-missing",category:"package-manifest",severity:"blocking",message:"The manifest declares no plugin name.",source:ce("§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:_r.nameMaxLength},source:ce("§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:ce("§Shared package checks → Manifest")},{id:"interface-display-name-missing",category:"package-manifest",severity:"blocking",message:"The OpenAI interface document declares no display name.",source:ce("§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:_r.displayNameMaxLength},source:ce("§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:_r.shortDescriptionMaxLength},source:ce("§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:_r.defaultPromptMaxLength},source:ce("§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:ce("§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:ce("§Listing fields → Interface")},{id:"interface-yaml-invalid",category:"package-manifest",severity:"blocking",message:"The OpenAI interface document is not valid YAML.",source:ce("§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:ce("§Listing fields → Text")},{id:"skill-metadata-missing",category:"package-skills",severity:"blocking",message:"A skill directory contains no SKILL.md.",source:ce("§Skills → Structure")},{id:"skill-frontmatter-invalid",category:"package-skills",severity:"blocking",message:"A skill's SKILL.md frontmatter is missing or malformed.",source:ce("§Skills → Frontmatter")},{id:"skill-name-missing",category:"package-skills",severity:"blocking",message:"A skill's frontmatter declares no name.",source:ce("§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:_r.skillNameMaxLength},source:ce("§Skills → Frontmatter")},{id:"skill-description-missing",category:"package-skills",severity:"blocking",message:"A skill's frontmatter declares no description.",source:ce("§Skills → Frontmatter")},{id:"skill-name-collision",category:"package-skills",severity:"blocking",message:"Two skills in the package declare the same name.",source:ce("§Skills → Structure")},{id:"asset-unsupported-type",category:"package-assets",severity:"blocking",message:"An image is not one of the accepted formats.",source:ce("§Images → Format")},{id:"asset-too-large",category:"package-assets",severity:"blocking",message:"An image exceeds the maximum file size.",limit:{name:"imageConstraints.maxBytes",value:au.maxBytes},source:ce("§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:au.minEdgePx},source:ce("§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:au.maxEdgePx},source:ce("§Images → Dimensions")},{id:"asset-not-square",category:"package-assets",severity:"blocking",message:"An image is not square.",source:ce("§Images → Dimensions")},{id:"asset-undecodable",category:"package-assets",severity:"blocking",message:"An image's dimensions could not be read from its bytes.",source:ce("§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:ce("§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:ce("§Images → SVG")},{id:"asset-missing",category:"package-assets",severity:"blocking",message:"An asset referenced by the manifest is absent from the package.",source:ce("§Images → Format")},{id:"listing-category-unknown",category:"listing-fields",severity:"blocking",message:"The listing names a category outside the supported set.",source:ce("§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:_r.descriptionMaxLength},source:ce("§Listing fields → Description")},{id:"listing-promotional-metadata",category:"listing-fields",severity:"blocking",message:"Listing metadata contains promotional language, pricing claims, or ranking claims.",source:ce("§Listing fields → Description")},{id:"listing-privacy-policy-missing",category:"listing-fields",severity:"blocking",message:"The listing declares no privacy policy URL.",source:ce("§Listing fields → Links")},{id:"listing-support-url-missing",category:"listing-fields",severity:"blocking",message:"The listing declares no support URL.",source:ce("§Listing fields → Links")},{id:"mcp-endpoint-not-https",category:"mcp-server",severity:"blocking",message:"The MCP endpoint is not served over HTTPS.",source:ce("§MCP tools → Endpoint")},{id:"mcp-endpoint-unreachable",category:"mcp-server",severity:"blocking",message:"The MCP endpoint could not be reached during the scan.",source:ce("§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:_r.toolNameMaxLength},source:ce("§MCP tools → Metadata")},{id:"mcp-tool-description-missing",category:"mcp-server",severity:"blocking",message:"A tool declares no description.",source:ce("§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:ce("§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:ce("§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:ce("§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:ce("§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:ce("§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:ce("§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:ce("§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:ui.maxSkills},source:ce("§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:ui.maxSkillMarkdownBytes},source:ce("§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:ui.maxPageBytes},source:ce("§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:ui.maxPagesPerSkill},source:ce("§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:ui.maxSkillTotalBytes},source:ce("§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:ui.maxImportedTotalBytes},source:ce("§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:ce("§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:ce("§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:ce("§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:gi.successCount},source:ce("§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:gi.failureCount},source:ce("§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:ce("§Review materials → Demo access")},{id:"review-demo-recording-missing",category:"review-materials",severity:"blocking",message:"No demo recording was supplied.",source:ce("§Review materials → Demo access")},{id:"review-release-notes-missing",category:"review-materials",severity:"blocking",message:"An updated submission supplies no release notes.",source:ce("§Review materials → Release notes")},{id:"review-attestation-missing",category:"review-materials",severity:"blocking",message:"A required policy attestation was not affirmed.",source:ce("§Review materials → Attestations")},{id:"review-identity-not-verified",category:"review-materials",severity:"blocking",message:"The submitting account has not completed identity verification.",source:ce("§Review materials → Account")},{id:"review-write-permission-missing",category:"review-materials",severity:"blocking",message:"The submitting account lacks the app-write permission.",source:ce("§Review materials → Account")},{id:"review-geography-missing",category:"review-materials",severity:"blocking",message:"The submission declares no country availability.",source:ce("§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:ce("§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:ce("§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:ce("§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:ce("§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:ce("§Images → Screenshots")},{id:"exclusion-bundle-in-mcp-only",category:"exclusions",severity:"blocking",message:"An MCP-only submission supplies a package archive.",source:ce("§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:ce("§Shared package checks → Excluded content")},...D1],H9=Object.freeze(Object.fromEntries(U1.map(e=>[e.id,e]))),q1=["ownsOrIsAuthorizedForService","accurateDataDisclosure","compliesWithUsagePolicies","noProhibitedContent","maintainsSecurityPractices","respondsToSecurityReports","keepsListingAccurate"],z1=["none","account-identifiers","user-content","usage-analytics","payment-information","location","health","shared-with-third-parties"],F1=["in-submission-form","shared-out-of-band","not-required-authless"],Mp=w().url().refine(e=>e.startsWith("https://"),{message:"must be an https:// URL"}),ey=Y({prompt:w().min(1),expectation:w().min(1)}),j1=Y({reference:w().min(1),mimeType:w().min(1),widthPx:De().int().positive(),heightPx:De().int().positive(),prompt:w().min(1)}),B9=Y({name:w().min(1).max(_r.nameMaxLength),shortDescription:w().min(1).max(_r.shortDescriptionMaxLength),description:w().min(1).max(_r.descriptionMaxLength),categories:re(pt(FS)).min(1),privacyPolicyUrl:Mp,supportUrl:Mp,documentationUrl:Mp.optional(),testCases:Y({successful:re(ey),gracefulFailure:re(ey)}),demoCredentials:Y({provided:Ce(),delivery:pt(F1)}),demoRecordingProvided:Ce(),screenshots:re(j1).default([]),releaseNotes:w().min(1).optional(),identityVerified:Ce(),accountPermissions:re(w().min(1)).default([]),availableCountries:re(w().length(2)).default([]),dataResidencyEligible:Ce().optional(),privacyPolicyDataTypes:re(pt(z1)).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:Ce().optional(),attestations:pS(pt(q1),Ce())}),V9=new TextDecoder("utf-8",{fatal:!1}),ug=Symbol.for("yaml.alias"),mf=Symbol.for("yaml.document"),Ln=Symbol.for("yaml.map"),KS=Symbol.for("yaml.pair"),Rs=Symbol.for("yaml.scalar"),ia=Symbol.for("yaml.seq"),Fr=Symbol.for("yaml.node.type"),oa=e=>!!e&&typeof e=="object"&&e[Fr]===ug,Wc=e=>!!e&&typeof e=="object"&&e[Fr]===mf,Jc=e=>!!e&&typeof e=="object"&&e[Fr]===Ln,mt=e=>!!e&&typeof e=="object"&&e[Fr]===KS,nt=e=>!!e&&typeof e=="object"&&e[Fr]===Rs,Yc=e=>!!e&&typeof e=="object"&&e[Fr]===ia;function gt(e){if(e&&typeof e=="object")switch(e[Fr]){case Ln:case ia:return!0}return!1}function vt(e){if(e&&typeof e=="object")switch(e[Fr]){case ug:case Ln:case Rs:case ia:return!0}return!1}var WS=e=>(nt(e)||gt(e))&&!!e.anchor,dr=Symbol("break visit"),JS=Symbol("skip children"),Es=Symbol("remove node");function aa(e,t){const r=YS(t);Wc(e)?bo(null,e.contents,r,Object.freeze([e]))===Es&&(e.contents=null):bo(null,e,r,Object.freeze([]))}aa.BREAK=dr;aa.SKIP=JS;aa.REMOVE=Es;function bo(e,t,r,s){const n=XS(e,t,r,s);if(vt(n)||mt(n))return QS(e,s,n),bo(e,n,r,s);if(typeof n!="symbol"){if(gt(t)){s=Object.freeze(s.concat(t));for(let i=0;i<t.items.length;++i){const o=bo(i,t.items[i],r,s);if(typeof o=="number")i=o-1;else{if(o===dr)return dr;o===Es&&(t.items.splice(i,1),i-=1)}}}else if(mt(t)){s=Object.freeze(s.concat(t));const i=bo("key",t.key,r,s);if(i===dr)return dr;i===Es&&(t.key=null);const o=bo("value",t.value,r,s);if(o===dr)return dr;o===Es&&(t.value=null)}}return n}async function dg(e,t){const r=YS(t);Wc(e)?await wo(null,e.contents,r,Object.freeze([e]))===Es&&(e.contents=null):await wo(null,e,r,Object.freeze([]))}dg.BREAK=dr;dg.SKIP=JS;dg.REMOVE=Es;async function wo(e,t,r,s){const n=await XS(e,t,r,s);if(vt(n)||mt(n))return QS(e,s,n),wo(e,n,r,s);if(typeof n!="symbol"){if(gt(t)){s=Object.freeze(s.concat(t));for(let i=0;i<t.items.length;++i){const o=await wo(i,t.items[i],r,s);if(typeof o=="number")i=o-1;else{if(o===dr)return dr;o===Es&&(t.items.splice(i,1),i-=1)}}}else if(mt(t)){s=Object.freeze(s.concat(t));const i=await wo("key",t.key,r,s);if(i===dr)return dr;i===Es&&(t.key=null);const o=await wo("value",t.value,r,s);if(o===dr)return dr;o===Es&&(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(Jc(t))return r.Map?.(e,t,s);if(Yc(t))return r.Seq?.(e,t,s);if(mt(t))return r.Pair?.(e,t,s);if(nt(t))return r.Scalar?.(e,t,s);if(oa(t))return r.Alias?.(e,t,s)}function QS(e,t,r){const s=t[t.length-1];if(gt(s))s.items[e]=r;else if(mt(s))e==="key"?s.key=r:s.value=r;else if(Wc(s))s.contents=r;else{const n=oa(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}var H1={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},B1=e=>e.replace(/[!,[\]{}]/g,t=>H1[t]),Mo=class js{constructor(t,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},js.defaultYaml,t),this.tags=Object.assign({},js.defaultTags,r)}clone(){const t=new js(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new js(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:js.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},js.defaultTags)}return t}add(t,r){this.atNextDocument&&(this.yaml={explicit:js.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},js.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+B1(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&&vt(t.contents)){const i={};aa(t.contents,(o,a)=>{vt(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
|
+
`)}};Mo.defaultYaml={explicit:!1,version:"1.2"};Mo.defaultTags={"!!":"tag:yaml.org,2002:"};function ZS(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 ek(e){const t=new Set;return aa(e,{Value(r,s){s.anchor&&t.add(s.anchor)}}),t}function tk(e,t){for(let r=1;;++r){const s=`${e}${r}`;if(!t.has(s))return s}}function V1(e,t){const r=[],s=new Map;let n=null;return{onAnchor:i=>{r.push(i),n??(n=ek(e));const o=tk(t,n);return n.add(o),o},setAnchors:()=>{for(const i of r){const o=s.get(i);if(typeof o=="object"&&o.anchor&&(nt(o.node)||gt(o.node)))o.node.anchor=o.anchor;else{const a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=i,a}}},sourceObjects:s}}function So(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=So(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=So(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=So(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=So(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||!WS(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 pg=class{constructor(e){Object.defineProperty(this,Fr,{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(!Wc(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"?So(n,{"":o},"",o):o}},hg=class extends pg{constructor(e){super(ug),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=[],aa(e,{Node:(n,i)=>{(oa(i)||WS(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=lu(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(ZS(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 lu(e,t,r){if(oa(t)){const s=t.resolve(e),n=r&&s&&r.get(s);return n?n.count*n.aliasCount:0}else if(gt(t)){let s=0;for(const n of t.items){const i=lu(e,n,r);i>s&&(s=i)}return s}else if(mt(t)){const s=lu(e,t.key,r),n=lu(e,t.value,r);return Math.max(s,n)}return 1}var rk=e=>!e||typeof e!="function"&&typeof e!="object",Me=class extends pg{constructor(e){super(Rs),this.value=e}toJSON(e,t){return t?.keep?this.value:qr(this.value,e,t)}toString(){return String(this.value)}};Me.BLOCK_FOLDED="BLOCK_FOLDED";Me.BLOCK_LITERAL="BLOCK_LITERAL";Me.PLAIN="PLAIN";Me.QUOTE_DOUBLE="QUOTE_DOUBLE";Me.QUOTE_SINGLE="QUOTE_SINGLE";var G1="tag:yaml.org,2002:";function K1(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 Pc(e,t,r){if(Wc(e)&&(e=e.contents),vt(e))return e;if(mt(e)){const p=r.schema[Ln].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 hg(c.anchor);c={anchor:null,node:null},a.set(e,c)}t?.startsWith("!!")&&(t=G1+t.slice(2));let l=K1(e,t,o.tags);if(!l){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const p=new Me(e);return c&&(c.node=p),p}l=e instanceof Map?o[Ln]:Symbol.iterator in Object(e)?o[ia]:o[Ln]}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 Me(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function Ou(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 Pc(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 ec=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,sk=class extends pg{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=>vt(r)||mt(r)?r.clone(e):r),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(ec(e))this.add(t);else{const[r,...s]=e,n=this.get(r,!0);if(gt(n))n.addIn(s,t);else if(n===void 0&&this.schema)this.set(r,Ou(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(gt(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&&nt(n)?n.value:n:gt(n)?n.getIn(s,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!mt(t))return!1;const r=t.value;return r==null||e&&nt(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 gt(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(gt(n))n.setIn(s,t);else if(n===void 0&&this.schema)this.set(r,Ou(this.schema,s,t));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}},W1=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Ys(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var bi=(e,t,r)=>e.endsWith(`
|
|
3
|
+
`)?Ys(r,t):r.includes(`
|
|
4
|
+
`)?`
|
|
5
|
+
`+Ys(r,t):(e.endsWith(" ")?"":" ")+r,nk="flow",J1="block",Y1="quoted";function Sd(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,m=!1,f=-1,g=-1,_=-1;r==="block"&&(f=ty(e,f,t.length),f!==-1&&(p=f+c));for(let E;E=e[f+=1];){if(r==="quoted"&&E==="\\"){switch(g=f,e[f+1]){case"x":f+=3;break;case"u":f+=5;break;case"U":f+=9;break;default:f+=1}_=f}if(E===`
|
|
6
|
+
`)r==="block"&&(f=ty(e,f,t.length)),p=f+t.length+c,d=void 0;else{if(E===" "&&h&&h!==" "&&h!==`
|
|
7
|
+
`&&h!==" "){const P=e[f+1];P&&P!==" "&&P!==`
|
|
8
|
+
`&&P!==" "&&(d=f)}if(f>=p)if(d)l.push(d),p=d+c,d=void 0;else if(r==="quoted"){for(;h===" "||h===" ";)h=E,E=e[f+=1],m=!0;const P=f>_+1?f-2:g-1;if(u[P])return e;l.push(P),u[P]=!0,p=P+c,d=void 0}else m=!0}h=E}if(m&&a&&a(),l.length===0)return e;o&&o();let y=e.slice(0,l[0]);for(let E=0;E<l.length;++E){const P=l[E],I=l[E+1]||e.length;P===0?y=`
|
|
9
|
+
${t}${e.slice(0,I)}`:(r==="quoted"&&u[P]&&(y+=`${e[P]}\\`),y+=`
|
|
10
|
+
${t}${e.slice(P+1,I)}`)}return y}function ty(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 kd=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Ed=e=>/^(%|---|\.\.\.)/m.test(e);function X1(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 pc(e,t){const r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;const{implicitKey:s}=t,n=t.options.doubleQuotedMinMultiLineLength,i=t.indent||(Ed(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:Sd(o,i,Y1,kd(t,!1))}function gf(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
16
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return pc(e,t);const r=t.indent||(Ed(e)?" ":""),s="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
17
|
+
${r}`)+"'";return t.implicitKey?s:Sd(s,r,nk,kd(t,!1))}function ko(e,t){const{singleQuote:r}=t.options;let s;if(r===!1)s=pc;else{const n=e.includes('"'),i=e.includes("'");n&&!i?s=gf:i&&!n?s=pc:s=r?gf:pc}return s(e,t)}var vf;try{vf=new RegExp(`(^|(?<!
|
|
18
|
+
))
|
|
19
|
+
+(?!
|
|
20
|
+
|$)`,"g")}catch{vf=/\n+(?!\n|$)/g}function uu({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 ko(r,s);const l=s.indent||(s.forceBlockIndent||Ed(r)?" ":""),u=o==="literal"?!0:o==="folded"||t===Me.BLOCK_FOLDED?!1:t===Me.BLOCK_LITERAL?!0:!X1(r,c,l.length);if(!r)return u?`|
|
|
21
|
+
`:`>
|
|
22
|
+
`;let p,d;for(d=r.length;d>0;--d){const P=r[d-1];if(P!==`
|
|
23
|
+
`&&P!==" "&&P!==" ")break}let h=r.substring(d);const m=h.indexOf(`
|
|
24
|
+
`);m===-1?p="-":r===h||m!==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(vf,`$&${l}`));let f=!1,g,_=-1;for(g=0;g<r.length;++g){const P=r[g];if(P===" ")f=!0;else if(P===`
|
|
26
|
+
`)_=g;else break}let y=r.substring(0,_<g?_+1:g);y&&(r=r.substring(y.length),y=y.replace(/\n+/g,`$&${l}`));let E=(f?l?"2":"1":"")+p;if(e&&(E+=" "+a(e.replace(/ ?[\r\n]+/g," ")),n&&n()),!u){const P=r.replace(/\n+/g,`
|
|
27
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`);let I=!1;const M=kd(s,!0);o!=="folded"&&t!==Me.BLOCK_FOLDED&&(M.onOverflow=()=>{I=!0});const $=Sd(`${y}${P}${h}`,l,J1,M);if(!I)return`>${E}
|
|
28
|
+
${l}${$}`}return r=r.replace(/\n+/g,`$&${l}`),`|${E}
|
|
29
|
+
${l}${y}${r}${h}`}function Q1(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 ko(i,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return a||u||!i.includes(`
|
|
31
|
+
`)?ko(i,t):uu(e,t,r,s);if(!a&&!u&&n!==Me.PLAIN&&i.includes(`
|
|
32
|
+
`))return uu(e,t,r,s);if(Ed(i)){if(c==="")return t.forceBlockIndent=!0,uu(e,t,r,s);if(a&&c===l)return ko(i,t)}const p=i.replace(/\n+/g,`$&
|
|
33
|
+
${c}`);if(o){const d=f=>f.default&&f.tag!=="tag:yaml.org,2002:str"&&f.test?.test(p),{compat:h,tags:m}=t.doc.schema;if(m.some(d)||h?.some(d))return ko(i,t)}return a?p:Sd(p,c,nk,kd(t,!1))}function fg(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!==Me.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=Me.QUOTE_DOUBLE);const c=u=>{switch(u){case Me.BLOCK_FOLDED:case Me.BLOCK_LITERAL:return n||i?ko(o.value,t):uu(o,t,r,s);case Me.QUOTE_DOUBLE:return pc(o.value,t);case Me.QUOTE_SINGLE:return gf(o.value,t);case Me.PLAIN:return Q1(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 ik(e,t){const r=Object.assign({blockQuote:!0,commentString:W1,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 Z1(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(nt(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 e2(e,t,{anchors:r,doc:s}){if(!s.directives)return"";const n=[],i=(nt(e)||gt(e))&&e.anchor;i&&ZS(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 zo(e,t,r,s){if(mt(e))return e.toString(t,r,s);if(oa(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=vt(e)?e:t.doc.createNode(e,{onTagObj:c=>n=c});n??(n=Z1(t.doc.schema.tags,i));const o=e2(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):nt(i)?fg(i,t,r,s):i.toString(t,r,s);return o?nt(i)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
34
|
+
${t.indent}${a}`:a}function t2({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=vt(e)&&e.comment||null;if(p){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(gt(e)||!vt(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||gt(e)||(nt(e)?e.type===Me.BLOCK_FOLDED||e.type===Me.BLOCK_LITERAL:typeof e=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!h&&(p||!i),indent:a+c});let m=!1,f=!1,g=zo(e,r,()=>m=!0,()=>f=!0);if(!h&&!r.inFlow&&g.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 m&&s&&s(),g===""?"?":h?`? ${g}`:g}else if(i&&!p||t==null&&h)return g=`? ${g}`,d&&!m?g+=bi(g,r.indent,l(d)):f&&n&&n(),g;m&&(d=null),h?(d&&(g+=bi(g,r.indent,l(d))),g=`? ${g}
|
|
35
|
+
${a}:`):(g=`${g}:`,d&&(g+=bi(g,r.indent,l(d))));let _,y,E;vt(t)?(_=!!t.spaceBefore,y=t.commentBefore,E=t.comment):(_=!1,y=null,E=null,t&&typeof t=="object"&&(t=o.createNode(t))),r.implicitKey=!1,!h&&!d&&nt(t)&&(r.indentAtStart=g.length+1),f=!1,!u&&c.length>=2&&!r.inFlow&&!h&&Yc(t)&&!t.flow&&!t.tag&&!t.anchor&&(r.indent=r.indent.substring(2));let P=!1;const I=zo(t,r,()=>P=!0,()=>f=!0);let M=" ";if(d||_||y){if(M=_?`
|
|
36
|
+
`:"",y){const $=l(y);M+=`
|
|
37
|
+
${Ys($,r.indent)}`}I===""&&!r.inFlow?M===`
|
|
38
|
+
`&&E&&(M=`
|
|
39
|
+
|
|
40
|
+
`):M+=`
|
|
41
|
+
${r.indent}`}else if(!h&>(t)){const $=I[0],O=I.indexOf(`
|
|
42
|
+
`),B=O!==-1,le=r.inFlow??t.flow??t.items.length===0;if(B||!le){let ie=!1;if(B&&($==="&"||$==="!")){let C=I.indexOf(" ");$==="&"&&C!==-1&&C<O&&I[C+1]==="!"&&(C=I.indexOf(" ",C+1)),(C===-1||O<C)&&(ie=!0)}ie||(M=`
|
|
43
|
+
${r.indent}`)}}else(I===""||I[0]===`
|
|
44
|
+
`)&&(M="");return g+=M+I,r.inFlow?P&&s&&s():E&&!P?g+=bi(g,r.indent,l(E)):f&&n&&n(),g}function r2(e,t){(e==="debug"||e==="warn")&&console.warn(t)}var Rl="<<",rn={identify:e=>e===Rl||typeof e=="symbol"&&e.description===Rl,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Me(Symbol(Rl)),{addToJSMap:ok}),stringify:()=>Rl},s2=(e,t)=>(rn.identify(t)||nt(t)&&(!t.type||t.type===Me.PLAIN)&&rn.identify(t.value))&&e?.doc.schema.tags.some(r=>r.tag===rn.tag&&r.default);function ok(e,t,r){const s=ak(e,r);if(Yc(s))for(const n of s.items)Lp(e,t,n);else if(Array.isArray(s))for(const n of s)Lp(e,t,n);else Lp(e,t,s)}function Lp(e,t,r){const s=ak(e,r);if(!Jc(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 ak(e,t){return e&&oa(t)?t.resolve(e.doc,e):t}function ck(e,t,{key:r,value:s}){if(vt(r)&&r.addToJSMap)r.addToJSMap(e,t,s);else if(s2(e,r))ok(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=n2(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 n2(e,t,r){if(t===null)return"";if(typeof t!="object")return String(t);if(vt(e)&&r?.doc){const s=ik(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)+'..."'),r2(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 mg(e,t,r){const s=Pc(e,void 0,r),n=Pc(t,void 0,r);return new Er(s,n)}var Er=class lk{constructor(t,r=null){Object.defineProperty(this,Fr,{value:KS}),this.key=t,this.value=r}clone(t){let{key:r,value:s}=this;return vt(r)&&(r=r.clone(t)),vt(s)&&(s=s.clone(t)),new lk(r,s)}toJSON(t,r){const s=r?.mapAsMap?new Map:{};return ck(r,s,this)}toString(t,r,s){return t?.doc?t2(this,t,r,s):JSON.stringify(this)}};function uk(e,t,r){return(t.inFlow??e.flow?o2:i2)(e,t,r)}function i2({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 m=0;m<t.length;++m){const f=t[m];let g=null;if(vt(f))!p&&f.spaceBefore&&d.push(""),Mu(r,d,f.commentBefore,p),f.comment&&(g=f.comment);else if(mt(f)){const y=vt(f.key)?f.key:null;y&&(!p&&y.spaceBefore&&d.push(""),Mu(r,d,y.commentBefore,p))}p=!1;let _=zo(f,u,()=>g=null,()=>p=!0);g&&(_+=bi(_,i,l(g))),p&&g&&(p=!1),d.push(s+_)}let h;if(d.length===0)h=n.start+n.end;else{h=d[0];for(let m=1;m<d.length;++m){const f=d[m];h+=f?`
|
|
45
|
+
${c}${f}`:`
|
|
46
|
+
`}}return e?(h+=`
|
|
47
|
+
`+Ys(l(e),c),a&&a()):p&&o&&o(),h}function o2({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 m=0;m<e.length;++m){const f=e[m];let g=null;if(vt(f))f.spaceBefore&&p.push(""),Mu(t,p,f.commentBefore,!1),f.comment&&(g=f.comment);else if(mt(f)){const y=vt(f.key)?f.key:null;y&&(y.spaceBefore&&p.push(""),Mu(t,p,y.commentBefore,!1),y.comment&&(l=!0));const E=vt(f.value)?f.value:null;E?(E.comment&&(g=E.comment),E.commentBefore&&(l=!0)):f.value==null&&y?.comment&&(g=y.comment)}g&&(l=!0);let _=zo(f,c,()=>g=null);l||(l=p.length>u||_.includes(`
|
|
48
|
+
`)),m<e.length-1?_+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(l||(l=p.reduce((y,E)=>y+E.length+2,2)+(_.length+2)>t.options.lineWidth)),l&&(_+=",")),g&&(_+=bi(_,s,a(g))),p.push(_),u=p.length}const{start:d,end:h}=r;if(p.length===0)return d+h;if(!l){const m=p.reduce((f,g)=>f+g.length+2,2);l=t.options.lineWidth>0&&m>t.options.lineWidth}if(l){let m=d;for(const f of p)m+=f?`
|
|
49
|
+
${i}${n}${f}`:`
|
|
50
|
+
`;return`${m}
|
|
51
|
+
${n}${h}`}else return`${d}${o}${p.join(" ")}${o}${h}`}function Mu({indent:e,options:{commentString:t}},r,s,n){if(s&&n&&(s=s.replace(/^\n+/,"")),s){const i=Ys(t(s),e);r.push(i.trimStart())}}function wi(e,t){const r=nt(t)?t.value:t;for(const s of e)if(mt(s)&&(s.key===t||s.key===r||nt(s.key)&&s.key.value===r))return s}var Nr=class extends sk{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Ln,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(mg(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;mt(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new Er(e,e?.value):r=new Er(e.key,e.value);const s=wi(this.items,r.key),n=this.schema?.sortMapEntries;if(s){if(!t)throw new Error(`Key ${r.key} already set`);nt(s.value)&&rk(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=wi(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){const r=wi(this.items,e)?.value;return(!t&&nt(r)?r.value:r)??void 0}has(e){return!!wi(this.items,e)}set(e,t){this.add(new Er(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)ck(t,s,n);return s}toString(e,t,r){if(!e)return JSON.stringify(this);for(const s of this.items)if(!mt(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})),uk(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:t})}},ca={collection:"map",default:!0,nodeClass:Nr,tag:"tag:yaml.org,2002:map",resolve(e,t){return Jc(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,r)=>Nr.from(e,t,r)},xi=class extends sk{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(ia,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=Cl(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){const r=Cl(e);if(typeof r!="number")return;const s=this.items[r];return!t&&nt(s)?s.value:s}has(e){const t=Cl(e);return typeof t=="number"&&t<this.items.length}set(e,t){const r=Cl(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);const s=this.items[r];nt(s)&&rk(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?uk(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(Pc(o,void 0,r))}}return n}};function Cl(e){let t=nt(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}var la={collection:"seq",default:!0,nodeClass:xi,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Yc(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,r)=>xi.from(e,t,r)},Td={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,r,s){return t=Object.assign({actualString:!0},t),fg(e,t,r,s)}},Ad={identify:e=>e==null,createNode:()=>new Me(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Me(null),stringify:({source:e},t)=>typeof e=="string"&&Ad.test.test(e)?e:t.options.nullStr},gg={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Me(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},r){return e&&gg.test.test(e)&&t===(e[0]==="t"||e[0]==="T")?e:t?r.options.trueStr:r.options.falseStr}};function is({format:e,minFractionDigits:t,tag:r,value:s}){if(typeof s=="bigint")return String(s);const n=typeof s=="number"?s:Number(s);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let i=Object.is(s,-0)?"-0":JSON.stringify(s);if(!e&&t&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(i)&&!i.includes("e")){let o=i.indexOf(".");o<0&&(o=i.length,i+=".");let a=t-(i.length-o-1);for(;a-- >0;)i+="0"}return i}var dk={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:is},pk={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():is(e)}},hk={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new Me(parseFloat(e)),r=e.indexOf(".");return r!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-r-1),t},stringify:is},Id=e=>typeof e=="bigint"||Number.isInteger(e),vg=(e,t,r,{intAsBigInt:s})=>s?BigInt(e):parseInt(e.substring(t),r);function fk(e,t,r){const{value:s}=e;return Id(s)&&s>=0?r+s.toString(t):is(e)}var mk={identify:e=>Id(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,r)=>vg(e,2,8,r),stringify:e=>fk(e,8,"0o")},gk={identify:Id,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,r)=>vg(e,0,10,r),stringify:is},vk={identify:e=>Id(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,r)=>vg(e,2,16,r),stringify:e=>fk(e,16,"0x")},a2=[ca,la,Td,Ad,gg,mk,gk,vk,dk,pk,hk];function ry(e){return typeof e=="bigint"||Number.isInteger(e)}var Pl=({value:e})=>JSON.stringify(e),c2=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Pl},{identify:e=>e==null,createNode:()=>new Me(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Pl},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:Pl},{identify:ry,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})=>ry(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:Pl}],l2=[ca,la].concat(c2,{default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),_g={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){const r=atob(e.replace(/[\n\r]/g,"")),s=new Uint8Array(r.length);for(let n=0;n<r.length;++n)s[n]=r.charCodeAt(n);return s}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:r},s,n,i){if(!r)return"";const o=r;let a;if(typeof btoa=="function"){let c="";for(let l=0;l<o.length;++l)c+=String.fromCharCode(o[l]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=Me.BLOCK_LITERAL),t!==Me.QUOTE_DOUBLE){const c=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),l=Math.ceil(a.length/c),u=new Array(l);for(let p=0,d=0;p<l;++p,d+=c)u[p]=a.substr(d,c);a=u.join(t===Me.BLOCK_LITERAL?`
|
|
52
|
+
`:" ")}return fg({comment:e,type:t,value:a},s,n,i)}};function _k(e,t){if(Yc(e))for(let r=0;r<e.items.length;++r){let s=e.items[r];if(!mt(s)){if(Jc(s)){s.items.length>1&&t("Each pair must have its own sequence indicator");const n=s.items[0]||new Er(new Me(null));if(s.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${s.commentBefore}
|
|
53
|
+
${n.key.commentBefore}`:s.commentBefore),s.comment){const i=n.value??n.key;i.comment=i.comment?`${s.comment}
|
|
54
|
+
${i.comment}`:s.comment}s=n}e.items[r]=mt(s)?s:new Er(s)}}else t("Expected a sequence for this tag");return e}function yk(e,t,r){const{replacer:s}=r,n=new xi(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(mg(a,c,r))}return n}var yg={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:_k,createNode:yk},du=class bk extends xi{constructor(){super(),this.add=Nr.prototype.add.bind(this),this.delete=Nr.prototype.delete.bind(this),this.get=Nr.prototype.get.bind(this),this.has=Nr.prototype.has.bind(this),this.set=Nr.prototype.set.bind(this),this.tag=bk.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(mt(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=yk(t,r,s),i=new this;return i.items=n.items,i}};du.tag="tag:yaml.org,2002:omap";var bg={collection:"seq",identify:e=>e instanceof Map,nodeClass:du,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const r=_k(e,t),s=[];for(const{key:n}of r.items)nt(n)&&(s.includes(n.value)?t(`Ordered maps must not include duplicate keys: ${n.value}`):s.push(n.value));return Object.assign(new du,r)},createNode:(e,t,r)=>du.from(e,t,r)};function wk({value:e,source:t},r){return t&&(e?Sk:kk).test.test(t)?t:e?r.options.trueStr:r.options.falseStr}var Sk={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Me(!0),stringify:wk},kk={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Me(!1),stringify:wk},u2={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:is},d2={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():is(e)}},p2={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new Me(parseFloat(e.replace(/_/g,""))),r=e.indexOf(".");if(r!==-1){const s=e.substring(r+1).replace(/_/g,"");s[s.length-1]==="0"&&(t.minFractionDigits=s.length)}return t},stringify:is},Xc=e=>typeof e=="bigint"||Number.isInteger(e);function Rd(e,t,r,{intAsBigInt:s}){const n=e[0];if((n==="-"||n==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),s){switch(r){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}const o=BigInt(e);return n==="-"?BigInt(-1)*o:o}const i=parseInt(e,r);return n==="-"?-1*i:i}function wg(e,t,r){const{value:s}=e;if(Xc(s)){const n=s.toString(t);return s<0?"-"+r+n.substr(1):r+n}return is(e)}var h2={identify:Xc,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,r)=>Rd(e,2,2,r),stringify:e=>wg(e,2,"0b")},f2={identify:Xc,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,r)=>Rd(e,1,8,r),stringify:e=>wg(e,8,"0")},m2={identify:Xc,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,r)=>Rd(e,0,10,r),stringify:is},g2={identify:Xc,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,r)=>Rd(e,2,16,r),stringify:e=>wg(e,16,"0x")},pu=class Ek extends Nr{constructor(t){super(t),this.tag=Ek.tag}add(t){let r;mt(t)?r=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?r=new Er(t.key,null):r=new Er(t,null),wi(this.items,r.key)||this.items.push(r)}get(t,r){const s=wi(this.items,t);return!r&&mt(s)?nt(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=wi(this.items,t);s&&!r?this.items.splice(this.items.indexOf(s),1):!s&&r&&this.items.push(new Er(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(mg(o,null,s));return i}};pu.tag="tag:yaml.org,2002:set";var Sg={collection:"map",identify:e=>e instanceof Set,nodeClass:pu,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,r)=>pu.from(e,t,r),resolve(e,t){if(Jc(e)){if(e.hasAllNullValues(!0))return Object.assign(new pu,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function kg(e,t){const r=e[0],s=r==="-"||r==="+"?e.substring(1):e,n=o=>t?BigInt(o):Number(o),i=s.replace(/_/g,"").split(":").reduce((o,a)=>o*n(60)+n(a),n(0));return r==="-"?n(-1)*i:i}function Tk(e){let{value:t}=e,r=o=>o;if(typeof t=="bigint")r=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return is(e);let s="";t<0&&(s="-",t*=r(-1));const n=r(60),i=[t%n];return t<60?i.unshift(0):(t=(t-i[0])/n,i.unshift(t%n),t>=60&&(t=(t-i[0])/n,i.unshift(t))),s+i.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Ak={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:r})=>kg(e,r),stringify:Tk},Ik={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>kg(e,!1),stringify:Tk},Cd={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match(Cd.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,r,s,n,i,o,a]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0;let l=Date.UTC(r,s-1,n,i||0,o||0,a||0,c);const u=t[8];if(u&&u!=="Z"){let p=kg(u,!1);Math.abs(p)<30&&(p*=60),l-=6e4*p}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""},sy=[ca,la,Td,Ad,Sk,kk,h2,f2,m2,g2,u2,d2,p2,_g,rn,bg,yg,Sg,Ak,Ik,Cd],ny=new Map([["core",a2],["failsafe",[ca,la,Td]],["json",l2],["yaml11",sy],["yaml-1.1",sy]]),iy={binary:_g,bool:gg,float:hk,floatExp:pk,floatNaN:dk,floatTime:Ik,int:gk,intHex:vk,intOct:mk,intTime:Ak,map:ca,merge:rn,null:Ad,omap:bg,pairs:yg,seq:la,set:Sg,timestamp:Cd},v2={"tag:yaml.org,2002:binary":_g,"tag:yaml.org,2002:merge":rn,"tag:yaml.org,2002:omap":bg,"tag:yaml.org,2002:pairs":yg,"tag:yaml.org,2002:set":Sg,"tag:yaml.org,2002:timestamp":Cd};function Np(e,t,r){const s=ny.get(t);if(s&&!e)return r&&!s.includes(rn)?s.concat(rn):s.slice();let n=s;if(!n)if(Array.isArray(e))n=[];else{const i=Array.from(ny.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${i} or define customTags array`)}if(Array.isArray(e))for(const i of e)n=n.concat(i);else typeof e=="function"&&(n=e(n.slice()));return r&&(n=n.concat(rn)),n.reduce((i,o)=>{const a=typeof o=="string"?iy[o]:o;if(!a){const c=JSON.stringify(o),l=Object.keys(iy).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return i.includes(a)||i.push(a),i},[])}var _2=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,y2=class Rk{constructor({compat:t,customTags:r,merge:s,resolveKnownTags:n,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(t)?Np(t,"compat"):t?Np(null,t):null,this.name=typeof i=="string"&&i||"core",this.knownTags=n?v2:{},this.tags=Np(r,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,Ln,{value:ca}),Object.defineProperty(this,Rs,{value:Td}),Object.defineProperty(this,ia,{value:la}),this.sortMapEntries=typeof o=="function"?o:o===!0?_2:null}clone(){const t=Object.create(Rk.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function b2(e,t){const r=[];let s=t.directives===!0;if(t.directives!==!1&&e.directives){const c=e.directives.toString(e);c?(r.push(c),s=!0):e.directives.docStart&&(s=!0)}s&&r.push("---");const n=ik(e,t),{commentString:i}=n.options;if(e.commentBefore){r.length!==1&&r.unshift("");const c=i(e.commentBefore);r.unshift(Ys(c,""))}let o=!1,a=null;if(e.contents){if(vt(e.contents)){if(e.contents.spaceBefore&&s&&r.push(""),e.contents.commentBefore){const u=i(e.contents.commentBefore);r.push(Ys(u,""))}n.forceBlockIndent=!!e.comment,a=e.contents.comment}const c=a?void 0:()=>o=!0;let l=zo(e.contents,n,()=>a=null,c);a&&(l+=bi(l,"",i(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(zo(e.contents,n));if(e.directives?.docEnd)if(e.comment){const c=i(e.comment);c.includes(`
|
|
55
|
+
`)?(r.push("..."),r.push(Ys(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=e.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||a)&&r[r.length-1]!==""&&r.push(""),r.push(Ys(i(c),"")))}return r.join(`
|
|
56
|
+
`)+`
|
|
57
|
+
`}var Ck=class Pk{constructor(t,r,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Fr,{value:mf});let n=null;typeof r=="function"||Array.isArray(r)?n=r:s===void 0&&r&&(s=r,r=void 0);const i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=i;let{version:o}=i;s?._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Mo({version:o}),this.setSchema(o,s),this.contents=t===void 0?null:this.createNode(t,n,s)}clone(){const t=Object.create(Pk.prototype,{[Fr]:{value:mf}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=vt(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Wi(this.contents)&&this.contents.add(t)}addIn(t,r){Wi(this.contents)&&this.contents.addIn(t,r)}createAlias(t,r){if(!t.anchor){const s=ek(this);t.anchor=!r||s.has(r)?tk(r||"a",s):r}return new hg(t.anchor)}createNode(t,r,s){let n;if(typeof r=="function")t=r.call({"":t},"",t),n=r;else if(Array.isArray(r)){const g=y=>typeof y=="number"||y instanceof String||y instanceof Number,_=r.filter(g).map(String);_.length>0&&(r=r.concat(_)),n=r}else s===void 0&&r&&(s=r,r=void 0);const{aliasDuplicateObjects:i,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:l,tag:u}=s??{},{onAnchor:p,setAnchors:d,sourceObjects:h}=V1(this,o||"a"),m={aliasDuplicateObjects:i??!0,keepUndefined:c??!1,onAnchor:p,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:h},f=Pc(t,u,m);return a&>(f)&&(f.flow=!0),d(),f}createPair(t,r,s={}){const n=this.createNode(t,null,s),i=this.createNode(r,null,s);return new Er(n,i)}delete(t){return Wi(this.contents)?this.contents.delete(t):!1}deleteIn(t){return ec(t)?this.contents==null?!1:(this.contents=null,!0):Wi(this.contents)?this.contents.deleteIn(t):!1}get(t,r){return gt(this.contents)?this.contents.get(t,r):void 0}getIn(t,r){return ec(t)?!r&&nt(this.contents)?this.contents.value:this.contents:gt(this.contents)?this.contents.getIn(t,r):void 0}has(t){return gt(this.contents)?this.contents.has(t):!1}hasIn(t){return ec(t)?this.contents!==void 0:gt(this.contents)?this.contents.hasIn(t):!1}set(t,r){this.contents==null?this.contents=Ou(this.schema,[t],r):Wi(this.contents)&&this.contents.set(t,r)}setIn(t,r){ec(t)?this.contents=r:this.contents==null?this.contents=Ou(this.schema,Array.from(t),r):Wi(this.contents)&&this.contents.setIn(t,r)}setSchema(t,r={}){typeof t=="number"&&(t=String(t));let s;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Mo({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new Mo({version:t}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{const n=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(s)this.schema=new y2(Object.assign(s,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:r,mapAsMap:s,maxAliasCount:n,onAnchor:i,reviver:o}={}){const a={anchors:new Map,doc:this,keep:!t,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},c=qr(this.contents,r??"",a);if(typeof i=="function")for(const{count:l,res:u}of a.anchors.values())i(u,l);return typeof o=="function"?So(o,{"":c},"",c):c}toJSON(t,r){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:r})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){const r=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return b2(this,t)}};function Wi(e){if(gt(e))return!0;throw new Error("Expected a YAML collection as document contents")}var xk=class extends Error{constructor(e,t,r,s){super(),this.name=e,this.code=r,this.message=s,this.pos=t}},tc=class extends xk{constructor(e,t,r){super("YAMLParseError",e,t,r)}},w2=class extends xk{constructor(e,t,r){super("YAMLWarning",e,t,r)}},oy=(e,t)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>t.linePos(a));const{line:s,col:n}=r.linePos[0];r.message+=` at line ${s}, column ${n}`;let i=n-1,o=e.substring(t.lineStarts[s-1],t.lineStarts[s]).replace(/[\n\r]+$/,"");if(i>=60&&o.length>80){const a=Math.min(i-39,o.length-79);o="…"+o.substring(a),i-=a-1}if(o.length>80&&(o=o.substring(0,79)+"…"),s>1&&/^ *$/.test(o.substring(0,i))){let a=e.substring(t.lineStarts[s-2],t.lineStarts[s-1]);a.length>80&&(a=a.substring(0,79)+`…
|
|
58
|
+
`),o=a+o}if(/[^ ]/.test(o)){let a=1;const c=r.linePos[1];c?.line===s&&c.col>n&&(a=Math.max(1,Math.min(c.col-n,80-i)));const l=" ".repeat(i)+"^".repeat(a);r.message+=`:
|
|
59
|
+
|
|
60
|
+
${o}
|
|
61
|
+
${l}
|
|
62
|
+
`}};function Fo(e,{flow:t,indicator:r,next:s,offset:n,onError:i,parentIndent:o,startOnNewline:a}){let c=!1,l=a,u=a,p="",d="",h=!1,m=!1,f=null,g=null,_=null,y=null,E=null,P=null,I=null;for(const O of e)switch(m&&(O.type!=="space"&&O.type!=="newline"&&O.type!=="comma"&&i(O.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),f&&(l&&O.type!=="comment"&&O.type!=="newline"&&i(f,"TAB_AS_INDENT","Tabs are not allowed as indentation"),f=null),O.type){case"space":!t&&(r!=="doc-start"||s?.type!=="flow-collection")&&O.source.includes(" ")&&(f=O),u=!0;break;case"comment":{u||i(O,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const B=O.source.substring(1)||" ";p?p+=d+B:p=B,d="",l=!1;break}case"newline":l?p?p+=O.source:(!P||r!=="seq-item-ind")&&(c=!0):d+=O.source,l=!0,h=!0,(g||_)&&(y=O),u=!0;break;case"anchor":g&&i(O,"MULTIPLE_ANCHORS","A node can have at most one anchor"),O.source.endsWith(":")&&i(O.offset+O.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=O,I??(I=O.offset),l=!1,u=!1,m=!0;break;case"tag":_&&i(O,"MULTIPLE_TAGS","A node can have at most one tag"),_=O,I??(I=O.offset),l=!1,u=!1,m=!0;break;case r:(g||_)&&i(O,"BAD_PROP_ORDER",`Anchors and tags must be after the ${O.source} indicator`),P&&i(O,"UNEXPECTED_TOKEN",`Unexpected ${O.source} in ${t??"collection"}`),P=O,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(t){E&&i(O,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),E=O,l=!1,u=!1;break}default:i(O,"UNEXPECTED_TOKEN",`Unexpected ${O.type} token`),l=!1,u=!1}const M=e[e.length-1],$=M?M.offset+M.source.length:n;return m&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&i(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),f&&(l&&f.indent<=o||s?.type==="block-map"||s?.type==="block-seq")&&i(f,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:E,found:P,spaceBefore:c,comment:p,hasNewline:h,anchor:g,tag:_,newlineAfterProp:y,end:$,start:I??$}}function xc(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
|
|
63
|
+
`))return!0;if(e.end){for(const t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(const t of e.items){for(const r of t.start)if(r.type==="newline")return!0;if(t.sep){for(const r of t.sep)if(r.type==="newline")return!0}if(xc(t.key)||xc(t.value))return!0}return!1;default:return!0}}function _f(e,t,r){if(t?.type==="flow-collection"){const s=t.end[0];s.indent===e&&(s.source==="]"||s.source==="}")&&xc(t)&&r(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function Ok(e,t,r){const{uniqueKeys:s}=e.options;if(s===!1)return!1;const n=typeof s=="function"?s:(i,o)=>i===o||nt(i)&&nt(o)&&i.value===o.value;return t.some(i=>n(i.key,r))}var ay="All mapping items must start at the same column";function S2({composeNode:e,composeEmptyNode:t},r,s,n,i){const o=new(i?.nodeClass??Nr)(r.schema);r.atRoot&&(r.atRoot=!1);let a=s.offset,c=null;for(const l of s.items){const{start:u,key:p,sep:d,value:h}=l,m=Fo(u,{indicator:"explicit-key-ind",next:p??d?.[0],offset:a,onError:n,parentIndent:s.indent,startOnNewline:!0}),f=!m.found;if(f){if(p&&(p.type==="block-seq"?n(a,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==s.indent&&n(a,"BAD_INDENT",ay)),!m.anchor&&!m.tag&&!d){c=m.end,m.comment&&(o.comment?o.comment+=`
|
|
64
|
+
`+m.comment:o.comment=m.comment);continue}(m.newlineAfterProp||xc(p))&&n(p??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==s.indent&&n(a,"BAD_INDENT",ay);r.atKey=!0;const g=m.end,_=p?e(r,p,m,n):t(r,g,u,null,m,n);r.schema.compat&&_f(s.indent,p,n),r.atKey=!1,Ok(r,o.items,_)&&n(g,"DUPLICATE_KEY","Map keys must be unique");const y=Fo(d??[],{indicator:"map-value-ind",next:h,offset:_.range[2],onError:n,parentIndent:s.indent,startOnNewline:!p||p.type==="block-scalar"});if(a=y.end,y.found){f&&(h?.type==="block-map"&&!y.hasNewline&&n(a,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&m.start<y.found.offset-1024&&n(_.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const E=h?e(r,h,y,n):t(r,a,d,null,y,n);r.schema.compat&&_f(s.indent,h,n),a=E.range[2];const P=new Er(_,E);r.options.keepSourceTokens&&(P.srcToken=l),o.items.push(P)}else{f&&n(_.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),y.comment&&(_.comment?_.comment+=`
|
|
65
|
+
`+y.comment:_.comment=y.comment);const E=new Er(_);r.options.keepSourceTokens&&(E.srcToken=l),o.items.push(E)}}return c&&c<a&&n(c,"IMPOSSIBLE","Map comment with trailing content"),o.range=[s.offset,a,c??a],o}function k2({composeNode:e,composeEmptyNode:t},r,s,n,i){const o=new(i?.nodeClass??xi)(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let a=s.offset,c=null;for(const{start:l,value:u}of s.items){const p=Fo(l,{indicator:"seq-item-ind",next:u,offset:a,onError:n,parentIndent:s.indent,startOnNewline:!0});if(!p.found)if(p.anchor||p.tag||u)u?.type==="block-seq"?n(p.end,"BAD_INDENT","All sequence items must start at the same column"):n(a,"MISSING_CHAR","Sequence item without - indicator");else{c=p.end,p.comment&&(o.comment=p.comment);continue}const d=u?e(r,u,p,n):t(r,p.end,l,null,p,n);r.schema.compat&&_f(s.indent,u,n),a=d.range[2],o.items.push(d)}return o.range=[s.offset,a,c??a],o}function Qc(e,t,r,s){let n="";if(e){let i=!1,o="";for(const a of e){const{source:c,type:l}=a;switch(l){case"space":i=!0;break;case"comment":{r&&!i&&s(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const u=c.substring(1)||" ";n?n+=o+u:n=u,o="";break}case"newline":n&&(o+=c),i=!0;break;default:s(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=c.length}}return{comment:n,offset:t}}var $p="Block collections are not allowed within flow collections",Dp=e=>e&&(e.type==="block-map"||e.type==="block-seq");function E2({composeNode:e,composeEmptyNode:t},r,s,n,i){const o=s.start.source==="{",a=o?"flow map":"flow sequence",c=new(i?.nodeClass??(o?Nr:xi))(r.schema);c.flow=!0;const l=r.atRoot;l&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let u=s.offset+s.start.source.length;for(let f=0;f<s.items.length;++f){const g=s.items[f],{start:_,key:y,sep:E,value:P}=g,I=Fo(_,{flow:a,indicator:"explicit-key-ind",next:y??E?.[0],offset:u,onError:n,parentIndent:s.indent,startOnNewline:!1});if(!I.found){if(!I.anchor&&!I.tag&&!E&&!P){f===0&&I.comma?n(I.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):f<s.items.length-1&&n(I.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),I.comment&&(c.comment?c.comment+=`
|
|
66
|
+
`+I.comment:c.comment=I.comment),u=I.end;continue}!o&&r.options.strict&&xc(y)&&n(y,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(f===0)I.comma&&n(I.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(I.comma||n(I.start,"MISSING_CHAR",`Missing , between ${a} items`),I.comment){let M="";e:for(const $ of _)switch($.type){case"comma":case"space":break;case"comment":M=$.source.substring(1);break e;default:break e}if(M){let $=c.items[c.items.length-1];mt($)&&($=$.value??$.key),$.comment?$.comment+=`
|
|
67
|
+
`+M:$.comment=M,I.comment=I.comment.substring(M.length+1)}}if(!o&&!E&&!I.found){const M=P?e(r,P,I,n):t(r,I.end,E,null,I,n);c.items.push(M),u=M.range[2],Dp(P)&&n(M.range,"BLOCK_IN_FLOW",$p)}else{r.atKey=!0;const M=I.end,$=y?e(r,y,I,n):t(r,M,_,null,I,n);Dp(y)&&n($.range,"BLOCK_IN_FLOW",$p),r.atKey=!1;const O=Fo(E??[],{flow:a,indicator:"map-value-ind",next:P,offset:$.range[2],onError:n,parentIndent:s.indent,startOnNewline:!1});if(O.found){if(!o&&!I.found&&r.options.strict){if(E)for(const ie of E){if(ie===O.found)break;if(ie.type==="newline"){n(ie,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}I.start<O.found.offset-1024&&n(O.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else P&&("source"in P&&P.source?.[0]===":"?n(P,"MISSING_CHAR",`Missing space after : in ${a}`):n(O.start,"MISSING_CHAR",`Missing , or : between ${a} items`));const B=P?e(r,P,O,n):O.found?t(r,O.end,E,null,O,n):null;B?Dp(P)&&n(B.range,"BLOCK_IN_FLOW",$p):O.comment&&($.comment?$.comment+=`
|
|
68
|
+
`+O.comment:$.comment=O.comment);const le=new Er($,B);if(r.options.keepSourceTokens&&(le.srcToken=g),o){const ie=c;Ok(r,ie.items,$)&&n(M,"DUPLICATE_KEY","Map keys must be unique"),ie.items.push(le)}else{const ie=new Nr(r.schema);ie.flow=!0,ie.items.push(le);const C=(B??$).range;ie.range=[$.range[0],C[1],C[2]],c.items.push(ie)}u=B?B.range[2]:O.end}}const p=o?"}":"]",[d,...h]=s.end;let m=u;if(d?.source===p)m=d.offset+d.source.length;else{const f=a[0].toUpperCase()+a.substring(1),g=l?`${f} must end with a ${p}`:`${f} in block collection must be sufficiently indented and end with a ${p}`;n(u,l?"MISSING_CHAR":"BAD_INDENT",g),d&&d.source.length!==1&&h.unshift(d)}if(h.length>0){const f=Qc(h,m,r.options.strict,n);f.comment&&(c.comment?c.comment+=`
|
|
69
|
+
`+f.comment:c.comment=f.comment),c.range=[s.offset,m,f.offset]}else c.range=[s.offset,m,m];return c}function Up(e,t,r,s,n,i){const o=r.type==="block-map"?S2(e,t,r,s,i):r.type==="block-seq"?k2(e,t,r,s,i):E2(e,t,r,s,i),a=o.constructor;return n==="!"||n===a.tagName?(o.tag=a.tagName,o):(n&&(o.tag=n),o)}function T2(e,t,r,s,n){const i=s.tag,o=i?t.directives.tagName(i.source,d=>n(i,"TAG_RESOLVE_FAILED",d)):null;if(r.type==="block-seq"){const{anchor:d,newlineAfterProp:h}=s,m=d&&i?d.offset>i.offset?d:i:d??i;m&&(!h||h.offset<m.offset)&&n(m,"MISSING_CHAR","Missing newline after block sequence props")}const a=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!i||!o||o==="!"||o===Nr.tagName&&a==="map"||o===xi.tagName&&a==="seq")return Up(e,t,r,n,o);let c=t.schema.tags.find(d=>d.tag===o&&d.collection===a);if(!c){const d=t.schema.knownTags[o];if(d?.collection===a)t.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?n(i,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):n(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Up(e,t,r,n,o)}const l=Up(e,t,r,n,o,c),u=c.resolve?.(l,d=>n(i,"TAG_RESOLVE_FAILED",d),t.options)??l,p=vt(u)?u:new Me(u);return p.range=l.range,p.tag=o,c?.format&&(p.format=c.format),p}function A2(e,t,r){const s=t.offset,n=I2(t,e.options.strict,r);if(!n)return{value:"",type:null,comment:"",range:[s,s,s]};const i=n.mode===">"?Me.BLOCK_FOLDED:Me.BLOCK_LITERAL,o=t.source?R2(t.source):[];let a=o.length;for(let f=o.length-1;f>=0;--f){const g=o[f][1];if(g===""||g==="\r")a=f;else break}if(a===0){const f=n.chomp==="+"&&o.length>0?`
|
|
70
|
+
`.repeat(Math.max(1,o.length-1)):"";let g=s+n.length;return t.source&&(g+=t.source.length),{value:f,type:i,comment:n.comment,range:[s,g,g]}}let c=t.indent+n.indent,l=t.offset+n.length,u=0;for(let f=0;f<a;++f){const[g,_]=o[f];if(_===""||_==="\r")n.indent===0&&g.length>c&&(c=g.length);else{g.length<c&&r(l+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),n.indent===0&&(c=g.length),u=f,c===0&&!e.atRoot&&r(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=g.length+_.length+1}for(let f=o.length-1;f>=a;--f)o[f][0].length>c&&(a=f+1);let p="",d="",h=!1;for(let f=0;f<u;++f)p+=o[f][0].slice(c)+`
|
|
71
|
+
`;for(let f=u;f<a;++f){let[g,_]=o[f];l+=g.length+_.length+1;const y=_[_.length-1]==="\r";if(y&&(_=_.slice(0,-1)),_&&g.length<c){const E=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;r(l-_.length-(y?2:1),"BAD_INDENT",E),g=""}i===Me.BLOCK_LITERAL?(p+=d+g.slice(c)+_,d=`
|
|
72
|
+
`):g.length>c||_[0]===" "?(d===" "?d=`
|
|
73
|
+
`:!h&&d===`
|
|
74
|
+
`&&(d=`
|
|
75
|
+
|
|
76
|
+
`),p+=d+g.slice(c)+_,d=`
|
|
77
|
+
`,h=!0):_===""?d===`
|
|
78
|
+
`?p+=`
|
|
79
|
+
`:d=`
|
|
80
|
+
`:(p+=d+_,d=" ",h=!1)}switch(n.chomp){case"-":break;case"+":for(let f=a;f<o.length;++f)p+=`
|
|
81
|
+
`+o[f][0].slice(c);p[p.length-1]!==`
|
|
82
|
+
`&&(p+=`
|
|
83
|
+
`);break;default:p+=`
|
|
84
|
+
`}const m=s+n.length+t.source.length;return{value:p,type:i,comment:n.comment,range:[s,m,m]}}function I2({offset:e,props:t},r,s){if(t[0].type!=="block-scalar-header")return s(t[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:n}=t[0],i=n[0];let o=0,a="",c=-1;for(let d=1;d<n.length;++d){const h=n[d];if(!a&&(h==="-"||h==="+"))a=h;else{const m=Number(h);!o&&m?o=m:c===-1&&(c=e+d)}}c!==-1&&s(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let l=!1,u="",p=n.length;for(let d=1;d<t.length;++d){const h=t[d];switch(h.type){case"space":l=!0;case"newline":p+=h.source.length;break;case"comment":r&&!l&&s(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),p+=h.source.length,u=h.source.substring(1);break;case"error":s(h,"UNEXPECTED_TOKEN",h.message),p+=h.source.length;break;default:{s(h,"UNEXPECTED_TOKEN",`Unexpected token in block scalar header: ${h.type}`);const m=h.source;m&&typeof m=="string"&&(p+=m.length)}}}return{mode:i,indent:o,chomp:a,comment:u,length:p}}function R2(e){const t=e.split(/\n( *)/),r=t[0],s=r.match(/^( *)/),n=[s?.[1]?[s[1],r.slice(s[1].length)]:["",r]];for(let i=1;i<t.length;i+=2)n.push([t[i],t[i+1]]);return n}function C2(e,t,r){const{offset:s,type:n,source:i,end:o}=e;let a,c;const l=(d,h,m)=>r(s+d,h,m);switch(n){case"scalar":a=Me.PLAIN,c=P2(i,l);break;case"single-quoted-scalar":a=Me.QUOTE_SINGLE,c=x2(i,l);break;case"double-quoted-scalar":a=Me.QUOTE_DOUBLE,c=O2(i,l);break;default:return r(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[s,s+i.length,s+i.length]}}const u=s+i.length,p=Qc(o,u,t,r);return{value:c,type:a,comment:p.comment,range:[s,u,p.offset]}}function P2(e,t){let r="";switch(e[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":r=`block scalar indicator ${e[0]}`;break;case"@":case"`":r=`reserved character ${e[0]}`}return r&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),Mk(e)}function x2(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Mk(e.slice(1,-1)).replace(/''/g,"'")}function Mk(e){const t=/(.*?)\r?\n/sy;let r=t.exec(e);if(!r)return e;let s,n;try{s=new RegExp("(?<![ ])[ ]+$"),n=new RegExp("^[ ]+|(?<![ ])[ ]+$","g")}catch{s=/[ \t]+$/,n=/^[ \t]+|[ \t]+$/g}let i=r[1].replace(s,""),o=" ",a=t.lastIndex;for(;r=t.exec(e);){const l=r[1].replace(n,"");l===""?o===`
|
|
85
|
+
`?i+=o:o=`
|
|
86
|
+
`:(i+=o+l,o=" "),a=t.lastIndex}const c=/[ \t]*(.*)/sy;return c.lastIndex=a,r=c.exec(e),i+o+(r?.[1]??"")}function O2(e,t){let r="";for(let s=1;s<e.length-1;++s){const n=e[s];if(!(n==="\r"&&e[s+1]===`
|
|
87
|
+
`))if(n===`
|
|
88
|
+
`){const{fold:i,offset:o}=M2(e,s);r+=i,s=o}else if(n==="\\"){let i=e[++s];const o=L2[i];if(o)r+=o;else if(i===`
|
|
89
|
+
`)for(i=e[s+1];i===" "||i===" ";)i=e[++s+1];else if(i==="\r"&&e[s+1]===`
|
|
90
|
+
`)for(i=e[++s+1];i===" "||i===" ";)i=e[++s+1];else if(i==="x"||i==="u"||i==="U"){const a=i==="x"?2:i==="u"?4:8;r+=N2(e,s+1,a,t),s+=a}else{const a=e.substr(s-1,2);t(s-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),r+=a}}else if(n===" "||n===" "){const i=s;let o=e[s+1];for(;o===" "||o===" ";)o=e[++s+1];o!==`
|
|
91
|
+
`&&!(o==="\r"&&e[s+2]===`
|
|
92
|
+
`)&&(r+=s>i?e.slice(i,s+1):n)}else r+=n}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),r}function M2(e,t){let r="",s=e[t+1];for(;(s===" "||s===" "||s===`
|
|
93
|
+
`||s==="\r")&&!(s==="\r"&&e[t+2]!==`
|
|
94
|
+
`);)s===`
|
|
95
|
+
`&&(r+=`
|
|
96
|
+
`),t+=1,s=e[t+1];return r||(r=" "),{fold:r,offset:t}}var L2={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
97
|
+
`,r:"\r",t:" ",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function N2(e,t,r,s){const n=e.substr(t,r),i=n.length===r&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;try{return String.fromCodePoint(i)}catch{const o=e.substr(t-2,r+2);return s(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${o}`),o}}function Lk(e,t,r,s){const{value:n,type:i,comment:o,range:a}=t.type==="block-scalar"?A2(e,t,s):C2(t,e.options.strict,s),c=r?e.directives.tagName(r.source,p=>s(r,"TAG_RESOLVE_FAILED",p)):null;let l;e.options.stringKeys&&e.atKey?l=e.schema[Rs]:c?l=$2(e.schema,n,c,r,s):t.type==="scalar"?l=D2(e,n,t,s):l=e.schema[Rs];let u;try{const p=l.resolve(n,d=>s(r??t,"TAG_RESOLVE_FAILED",d),e.options);u=nt(p)?p:new Me(p)}catch(p){const d=p instanceof Error?p.message:String(p);s(r??t,"TAG_RESOLVE_FAILED",d),u=new Me(n)}return u.range=a,u.source=n,i&&(u.type=i),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function $2(e,t,r,s,n){if(r==="!")return e[Rs];const i=[];for(const a of e.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)i.push(a);else return a;for(const a of i)if(a.test?.test(t))return a;const o=e.knownTags[r];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),e[Rs])}function D2({atKey:e,directives:t,schema:r},s,n,i){const o=r.tags.find(a=>(a.default===!0||e&&a.default==="key")&&a.test?.test(s))||r[Rs];if(r.compat){const a=r.compat.find(c=>c.default&&c.test?.test(s))??r[Rs];o.tag!==a.tag&&i(n,"TAG_RESOLVE_FAILED",`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(a.tag)}`,!0)}return o}function U2(e,t,r){if(t){r??(r=t.length);for(let s=r-1;s>=0;--s){let n=t[s];switch(n.type){case"space":case"comment":case"newline":e-=n.source.length;continue}for(n=t[++s];n?.type==="space";)e+=n.source.length,n=t[++s];break}}return e}var q2={composeNode:Nk,composeEmptyNode:Eg};function Nk(e,t,r,s){const n=e.atKey,{spaceBefore:i,comment:o,anchor:a,tag:c}=r;let l,u=!0;switch(t.type){case"alias":l=z2(e,t,s),(a||c)&&s(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Lk(e,t,c,s),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=T2(q2,e,t,r,s),a&&(l.anchor=a.source.substring(1))}catch(p){s(t,"RESOURCE_EXHAUSTION",p instanceof Error?p.message:String(p))}break;default:s(t,"UNEXPECTED_TOKEN",t.type==="error"?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??(l=Eg(e,t.offset,void 0,null,r,s)),a&&l.anchor===""&&s(a,"BAD_ALIAS","Anchor cannot be an empty string"),n&&e.options.stringKeys&&(!nt(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&s(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(l.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function Eg(e,t,r,s,{spaceBefore:n,comment:i,anchor:o,tag:a,end:c},l){const u={type:"scalar",offset:U2(t,r,s),indent:-1,source:""},p=Lk(e,u,a,l);return o&&(p.anchor=o.source.substring(1),p.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(p.spaceBefore=!0),i&&(p.comment=i,p.range[2]=c),p}function z2({options:e},{offset:t,source:r,end:s},n){const i=new hg(r.substring(1));i.source===""&&n(t,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&n(t+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const o=t+r.length,a=Qc(s,o,e.strict,n);return i.range=[t,o,a.offset],a.comment&&(i.comment=a.comment),i}function F2(e,t,{offset:r,start:s,value:n,end:i},o){const a=Object.assign({_directives:t},e),c=new Ck(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Fo(s,{indicator:"doc-start",next:n??i?.[0],offset:r,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=n?Nk(l,n,u,o):Eg(l,u.end,s,null,u,o);const p=c.contents.range[2],d=Qc(i,p,!1,o);return d.comment&&(c.comment=d.comment),c.range=[r,p,d.offset],c}function Ia(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];const{offset:t,source:r}=e;return[t,t+(typeof r=="string"?r.length:1)]}function cy(e){let t="",r=!1,s=!1;for(let n=0;n<e.length;++n){const i=e[n];switch(i[0]){case"#":t+=(t===""?"":s?`
|
|
98
|
+
|
|
99
|
+
`:`
|
|
100
|
+
`)+(i.substring(1)||" "),r=!0,s=!1;break;case"%":e[n+1]?.[0]!=="#"&&(n+=1),r=!1;break;default:r||(s=!0),r=!1}}return{comment:t,afterEmptyLine:s}}var j2=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,r,s,n)=>{const i=Ia(t);n?this.warnings.push(new w2(i,r,s)):this.errors.push(new tc(i,r,s))},this.directives=new Mo({version:e.version||"1.2"}),this.options=e}decorate(e,t){const{comment:r,afterEmptyLine:s}=cy(this.prelude);if(r){const n=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
|
101
|
+
${r}`:r;else if(s||e.directives.docStart||!n)e.commentBefore=r;else if(gt(n)&&!n.flow&&n.items.length>0){let i=n.items[0];mt(i)&&(i=i.key);const o=i.commentBefore;i.commentBefore=o?`${r}
|
|
102
|
+
${o}`:r}else{const i=n.commentBefore;n.commentBefore=i?`${r}
|
|
103
|
+
${i}`:r}}if(t){for(let n=0;n<this.errors.length;++n)e.errors.push(this.errors[n]);for(let n=0;n<this.warnings.length;++n)e.warnings.push(this.warnings[n])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:cy(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,r=-1){for(const s of e)yield*this.next(s);yield*this.end(t,r)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,r,s)=>{const n=Ia(e);n[0]+=t,this.onError(n,"BAD_DIRECTIVE",r,s)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{const t=F2(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{const t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new tc(Ia(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){this.errors.push(new tc(Ia(e),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;const t=Qc(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){const r=this.doc.comment;this.doc.comment=r?`${r}
|
|
104
|
+
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new tc(Ia(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){const r=Object.assign({_directives:this.directives},this.options),s=new Ck(void 0,r);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,t,t],this.decorate(s,!1),yield s}}},yf=Symbol("break visit"),H2=Symbol("skip children"),$k=Symbol("remove item");function jo(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),Dk(Object.freeze([]),e,t)}jo.BREAK=yf;jo.SKIP=H2;jo.REMOVE=$k;jo.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};jo.parentCollection=(e,t)=>{const r=jo.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 Dk(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=Dk(Object.freeze(e.concat([[n,o]])),i.items[o],r);if(typeof a=="number")o=a-1;else{if(a===yf)return yf;a===$k&&(i.items.splice(o,1),o-=1)}}typeof s=="function"&&n==="key"&&(s=s(t,e))}}return typeof s=="function"?s(t,e):s}function B2(e){switch(e){case"\uFEFF":return"byte-order-mark";case"":return"doc-mode";case"":return"flow-error-end";case"":return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
105
|
+
`:case`\r
|
|
106
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function Hr(e){switch(e){case void 0:case" ":case`
|
|
107
|
+
`:case"\r":case" ":return!0;default:return!1}}var ly=new Set("0123456789ABCDEFabcdef"),V2=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),xl=new Set(",[]{}"),G2=new Set(` ,[]{}
|
|
108
|
+
\r `),qp=e=>!e||G2.has(e),K2=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let r=this.next??"stream";for(;r&&(t||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
|
|
109
|
+
`?!0:t==="\r"?this.buffer[e+1]===`
|
|
110
|
+
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let r=0;for(;t===" ";)t=this.buffer[++r+e];if(t==="\r"){const s=this.buffer[r+e+1];if(s===`
|
|
111
|
+
`||!s&&!this.atEnd)return e+r+1}return t===`
|
|
112
|
+
`||r>=this.indentNext||!t&&!this.atEnd?e+r:-1}if(t==="-"||t==="."){const r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&Hr(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
113
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]==="\uFEFF"&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,r=e.indexOf("#");for(;r!==-1;){const n=e[r-1];if(n===" "||n===" "){t=r-1;break}else r=e.indexOf("#",r+1)}for(;;){const n=e[t-1];if(n===" "||n===" ")t-=1;else break}const s=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-s),this.pushNewline(),"stream"}if(this.atLineEnd()){const t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield"",yield*this.parseLineStart()}*parseLineStart(){const e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");const t=this.peek(3);if((t==="---"||t==="...")&&Hr(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Hr(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Hr(t)){const r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(qp),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,r=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=r=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);const s=this.getLine();if(s===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&s[0]!=="#"||r===0&&(s.startsWith("---")||s.startsWith("..."))&&Hr(s[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(s[0]==="]"||s[0]==="}")))return this.flowLevel=0,yield"",yield*this.parseLineStart();let n=0;for(;s[n]===",";)n+=yield*this.pushCount(1),n+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(n+=yield*this.pushIndicators(),s[n]){case void 0:return"flow";case"#":return yield*this.pushCount(s.length-n),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(qp),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const i=this.charAt(1);if(this.flowKey||Hr(i)||i===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){const e=this.charAt(0);let t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let n=0;for(;this.buffer[t-1-n]==="\\";)n+=1;if(n%2===0)break;t=this.buffer.indexOf('"',t+1)}const r=this.buffer.substring(0,t);let s=r.indexOf(`
|
|
114
|
+
`,this.pos);if(s!==-1){for(;s!==-1;){const n=this.continueScalar(s+1);if(n===-1)break;s=r.indexOf(`
|
|
115
|
+
`,n)}s!==-1&&(t=s-(r[s-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){const t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>Hr(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,r;e:for(let n=this.pos;r=this.buffer[n];++n)switch(r){case" ":t+=1;break;case`
|
|
116
|
+
`:e=n,t=0;break;case"\r":{const i=this.buffer[n+1];if(!i&&!this.atEnd)return this.setNext("block-scalar");if(i===`
|
|
117
|
+
`)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{const n=this.continueScalar(e+1);if(n===-1)break;e=this.buffer.indexOf(`
|
|
118
|
+
`,n)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let s=e+1;for(r=this.buffer[s];r===" ";)r=this.buffer[++s];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
|
|
119
|
+
`;)r=this.buffer[++s];e=s-1}else if(!this.blockScalarKeep)do{let n=e-1,i=this.buffer[n];i==="\r"&&(i=this.buffer[--n]);const o=n;for(;i===" ";)i=this.buffer[--n];if(i===`
|
|
120
|
+
`&&n>=this.pos&&n+1+t>o)e=n;else break}while(!0);return yield"",yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const e=this.flowLevel>0;let t=this.pos-1,r=this.pos-1,s;for(;s=this.buffer[++r];)if(s===":"){const n=this.buffer[r+1];if(Hr(n)||e&&xl.has(n))break;t=r}else if(Hr(s)){let n=this.buffer[r+1];if(s==="\r"&&(n===`
|
|
121
|
+
`?(r+=1,s=`
|
|
122
|
+
`,n=this.buffer[r+1]):t=r),n==="#"||e&&xl.has(n))break;if(s===`
|
|
123
|
+
`){const i=this.continueScalar(r+1);if(i===-1)break;r=Math.max(r,i-2)}}else{if(e&&xl.has(s))break;t=r}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield"",yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){const r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(t&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(qp),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const t=this.flowLevel>0,r=this.charAt(1);if(Hr(r)||t&&xl.has(r)){t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!Hr(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(V2.has(t))t=this.buffer[++e];else if(t==="%"&&ly.has(this.buffer[e+1])&&ly.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){const e=this.buffer[this.pos];return e===`
|
|
124
|
+
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
125
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,r;do r=this.buffer[++t];while(r===" "||e&&r===" ");const s=t-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=t),s}*pushUntil(e){let t=this.pos,r=this.buffer[t];for(;!e(r);)r=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},W2=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,r=this.lineStarts.length;for(;t<r;){const n=t+r>>1;this.lineStarts[n]<e?t=n+1:r=n}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};const s=this.lineStarts[t-1];return{line:t,col:e-s+1}}}};function bn(e,t){for(let r=0;r<e.length;++r)if(e[r].type===t)return!0;return!1}function uy(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function Uk(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Ol(e){switch(e.type){case"document":return e.start;case"block-map":{const t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function Ji(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Lu(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let r=0;r<t.length;++r)e.push(t[r])}function dy(e){if(e.start.type==="flow-seq-start")for(const t of e.items)t.sep&&!t.value&&!bn(t.start,"explicit-key-ind")&&!bn(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,Uk(t.value)?t.value.end?Lu(t.value.end,t.sep):t.value.end=t.sep:Lu(t.start,t.sep),delete t.sep)}var J2=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new K2,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const r of this.lexer.lex(e,t))yield*this.next(r);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}const t=B2(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{const r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){const t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{const r=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in r?r.indent:0:t.type==="flow-collection"&&r.type==="document"&&(t.indent=0),t.type==="flow-collection"&&dy(t),r.type){case"document":r.value=t;break;case"block-scalar":r.props.push(t);break;case"block-map":{const s=r.items[r.items.length-1];if(s.value){r.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=t;else{Object.assign(s,{key:t,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{const s=r.items[r.items.length-1];s.value?r.items.push({start:[],value:t}):s.value=t;break}case"flow-collection":{const s=r.items[r.items.length-1];!s||s.value?r.items.push({start:[],key:t,sep:[]}):s.sep?s.value=t:Object.assign(s,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){const s=t.items[t.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&uy(s.start)===-1&&(t.indent===0||s.start.every(n=>n.type!=="comment"||n.indent<t.indent))&&(r.type==="document"?r.end=s.start:r.items.push({start:s.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{const e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":uy(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return;case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}const t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){const t=Ji(Ol(this.peek(2)));let r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];const s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:t,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
|
|
126
|
+
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
127
|
+
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){const t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){const r="end"in t.value?t.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){const r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Lu(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const r=!this.onKeyLine&&this.indent===e.indent,s=r&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind";let n=[];if(s&&t.sep&&!t.value){const i=[];for(let o=0;o<t.sep.length;++o){const a=t.sep[o];switch(a.type){case"newline":i.push(o);break;case"space":break;case"comment":a.indent>e.indent&&(i.length=0);break;default:i.length=0}}i.length>=2&&(n=t.sep.splice(i[1]))}switch(this.type){case"anchor":case"tag":s||t.value?(n.push(this.sourceToken),e.items.push({start:n}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):s||t.value?(n.push(this.sourceToken),e.items.push({start:n,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(bn(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]});else if(Uk(t.key)&&!bn(t.sep,"newline")){const i=Ji(t.start),o=t.key,a=t.sep;a.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:o,sep:a}]})}else n.length>0?t.sep=t.sep.concat(n,this.sourceToken):t.sep.push(this.sourceToken);else if(bn(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{const i=Ji(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||s?e.items.push({start:n,key:null,sep:[this.sourceToken]}):bn(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);s||t.value?(e.items.push({start:n,key:i,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(i):(Object.assign(t,{key:i,sep:[]}),this.onKeyLine=!0);return}default:{const i=this.startBlockValue(e);if(i){if(i.type==="block-seq"){if(!t.explicitKey&&t.sep&&!bn(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:n});this.stack.push(i);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){const t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){const r="end"in t.value?t.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){const r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Lu(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||bn(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){const r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const s=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:s,sep:[]}):t.sep?this.stack.push(s):Object.assign(t,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{const r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){const s=Ji(Ol(r));dy(e);const n=e.end.splice(1,e.end.length);n.push(this.sourceToken);const i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
|
|
128
|
+
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
129
|
+
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const t=Ji(Ol(e));return t.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const t=Ji(Ol(e));return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function Y2(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new W2||null,prettyErrors:t}}function X2(e,t={}){const{lineCounter:r,prettyErrors:s}=Y2(t),n=new J2(r?.addNewLine),i=new j2(t);let o=null;for(const a of i.compose(n.parse(e),!0,e.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new tc(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&r&&(o.errors.forEach(oy(e,r)),o.warnings.forEach(oy(e,r))),o}var Q2=["hosted","org","local"],Pd=["none","minimal","low","medium","high","xhigh","max"],Z2=["none","openrouter"],eL=new Set(["modelId","source","connectionRef","nativeModelId","settings","fallback"]),tL=new Set(["kind","id"]),rL=new Set(["kind","providerKey","customProviderName"]),sL=new Set(["reasoningEffort","temperature"]),nL=new Set(["provider","model"]),iL=new Set(Q2),oL=new Set(Pd),aL=new Set(Z2),cL=/^[a-z0-9][a-z0-9._:-]*\/[^\s/]\S*$/;function Ho(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function lL(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Nn(e,t){return e===""?t:`${e}.${t}`}function Oc(e,t,r,s){for(const n of Object.keys(e))t.has(n)||s.push({path:Nn(r,n),code:"unknown_key",message:`unknown key "${n}" (a selection never carries credentials)`})}function hc(e,t,r,s,n){const i=Nn(r,t);if(!lL(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 uL(e,t){const r="connectionRef";if(!Ho(e)){t.push({path:r,code:"invalid_type",message:"must be a plain object"});return}if(e.kind==="orgProvider"){Oc(e,tL,r,t);const s=hc(e,"id",r,t,!0);return s===void 0?void 0:{kind:"orgProvider",id:s}}if(e.kind==="localProvider"){Oc(e,rL,r,t);const s=hc(e,"providerKey",r,t,!0),n=hc(e,"customProviderName",r,t,!1);return s===void 0?void 0:{kind:"localProvider",providerKey:s,...n!==void 0?{customProviderName:n}:{}}}t.push({path:Nn(r,"kind"),code:e.kind===void 0?"required":"invalid_value",message:'must be "orgProvider" or "localProvider"'})}function dL(e,t){const r="settings";if(!Ho(e)){t.push({path:r,code:"invalid_type",message:"must be a plain object"});return}Oc(e,sL,r,t);const s={};if(e.reasoningEffort!==void 0&&(typeof e.reasoningEffort=="string"&&oL.has(e.reasoningEffort)?s.reasoningEffort=e.reasoningEffort:t.push({path:Nn(r,"reasoningEffort"),code:"invalid_value",message:`must be one of ${Pd.map(n=>`"${n}"`).join(", ")}`})),e.temperature!==void 0){const n=e.temperature;typeof n!="number"||!Number.isFinite(n)?t.push({path:Nn(r,"temperature"),code:"invalid_type",message:"must be a finite number"}):n<0||n>2?t.push({path:Nn(r,"temperature"),code:"out_of_range",message:"must be within [0, 2]"}):s.temperature=n}return s}function pL(e,t){const r="fallback";if(e===void 0){t.push({path:r,code:"required",message:"is required"});return}if(!Ho(e)){t.push({path:r,code:"invalid_type",message:"must be a plain object"});return}Oc(e,nL,r,t);let s=!0;if((typeof e.provider!="string"||!aL.has(e.provider))&&(s=!1,t.push({path:Nn(r,"provider"),code:e.provider===void 0?"required":"invalid_value",message:'must be "none" or "openrouter"'})),e.model!=="none"&&(s=!1,t.push({path:Nn(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 hL(e){const t=[];if(!Ho(e))return{ok:!1,issues:[{path:"",code:"invalid_type",message:"must be a plain object"}]};Oc(e,eL,"",t);const r=hc(e,"modelId","",t,!0);r!==void 0&&!cL.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"&&iL.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:uL(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}")`}):Ho(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=hc(e,"nativeModelId","",t,!1),o=e.settings===void 0?void 0:dL(e.settings,t),a=pL(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 fL(e){return hL(e).ok}function G9(e){return Ho(e)&&e.source==="legacy"&&typeof e.modelId=="string"&&e.modelId.trim()!==""}function K9(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 W9(e){return{provider:e==="chat"?"openrouter":"none",model:"none"}}var mL=["maxBlocks","turnMaxBytes","updateMaxBytes"],J9=Object.freeze({maxBlocks:64,turnMaxBytes:1048576,updateMaxBytes:262144}),Y9=Object.freeze({maxBlocks:1024,turnMaxBytes:8388608,updateMaxBytes:4194304}),Tg={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"]},py="mcpProfile.apps.pluginExtensions.behavior";function hu(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function gL(e){return Object.hasOwn(Tg,e)}function vL(e,t){const r=Tg[e];return typeof t=="string"&&r.includes(t)}function _L(e,t,r){e[t]=r}function yL(e,t){const r={};for(const s of Object.keys(e).sort()){if(!gL(s)){if(t)throw new Error(`hostConfigV2: ${py} has unknown key "${s}"`);continue}const n=e[s];if(vL(s,n))_L(r,s,n);else if(t){const i=Tg[s];throw new Error(`hostConfigV2: ${py}.${s} must be one of ${i.map(o=>`"${o}"`).join(", ")}`)}}return r}function qk(e){return hu(e)?yL(e,!1):{}}var zk=Object.freeze({displayHints:"openai/ui",displayStart:"hint-first",entrypointVisibility:"ignore",entrypointWithoutFullscreen:"refuse",entrypointNames:"any",entrypointQuickActions:"show"}),Fk=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}),fo=Object.freeze({enabled:!0,capabilities:Fk,behavior:zk}),bf=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"})}),bL=Object.freeze({...bf,capabilities:Object.freeze({...bf.capabilities,sidebarApps:!0})}),wL=Object.freeze({enabled:!1,capabilities:Fk,behavior:zk}),hy=Object.freeze({chatgpt:fo,"chatgpt-desktop":fo,"chatgpt-work":fo,"chatgpt-work-desktop":fo,codex:fo,claude:bL,"claude-desktop":bf});function Ag(e){if(e.harness==="codex")return fo;const t=e.hostStyle;return(typeof t=="string"&&Object.hasOwn(hy,t)?hy[t]:void 0)??wL}function SL(e){if(!hu(e)||!hu(e.apps))return{};const t=e.apps.pluginExtensions;return!hu(t)||typeof t.enabled!="boolean"?{}:qk(t.behavior)}function X9(e){return{...Ag(e??{}).behavior,...SL(e?.mcpProfile)}}var kL=["inline","fullscreen","pip"],Q9=new Set(kL),fu=["mode","originAllowlist"],Z9={allow_all:new Set(fu),read_only:new Set(fu),allowlist:new Set([...fu,"toolAllowlist"])},e7=new Set([...fu,"toolAllowlist"]),t7=new Set(eg),r7=new Set(mL),s7=new Set(_x),n7=new Set(hx),i7=new Set(gx),o7=new Set(fx),EL=["clientName","redirectUris","userAgent"],a7=new Set(EL);function TL(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 jk(e){const t=new TextEncoder().encode(e);return TL(await crypto.subtle.digest("SHA-256",t))}async function AL(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 Hk(e){return jk(jx(e))}async function Bk(e){const t=[...e].sort((r,s)=>r.path<s.path?-1:r.path>s.path?1:0);return jk(t.map(r=>`${r.path}\0${r.contentHash}\0`).join(""))}async function IL(e){return Hk({digest:"plugin-execution/1",bundleHash:e.bundleHash,executableFiles:[...e.executableFiles].sort(),profile:e.profile,revision:e.revision})}var RL=[{path:Mn,layout:"agent-plugins"},...xS];function zp(e,t,r){const s=e===""?"":`${e}/`;return RL.find(({path:n,layout:i})=>(r==="openai-compatible"||i==="agent-plugins")&&t.has(`${s}${n}`))}function CL(e,t){const r=zp("",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=>zp(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:zp(i,e,t),refusals:s.filter(o=>o!==i).map(o=>({code:"plugin_root_has_siblings",path:o}))}}function PL(e,t){return e===""?t:t.startsWith(`${e}/`)?t.slice(e.length+1):void 0}var xL={plugin_manifest_missing:"MANIFEST_MISSING",plugin_root_ambiguous:"PLUGIN_ROOT_AMBIGUOUS",plugin_root_has_siblings:"PLUGIN_ROOT_HAS_SIBLINGS"};function OL(e,t,r){for(const{code:s,path:n}of e.refusals){const i=t==="strict"?`bundle is missing "${Mn}" at its root`:bs[s].message;r.error(xL[s],i,n?{path:n}:void 0)}}var fy="skills",ML="SKILL.md",Vk=64,my=1024;function LL(e){return e.length<1||e.length>Vk||e.includes("--")?!1:/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(e)}var wf=class extends Error{constructor(){super("yaml value nests too deeply"),this.name="YamlValueTooDeepError"}};function Sf(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 wf;const s=r.slice(1,-1).trim();return s===""?[]:s.split(",").map(n=>Sf(n,t+1))}return r}function NL(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(Sf(h[1]))}catch(m){if(!(m instanceof wf))throw m;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 m=h.length-h.trimStart().length;if(m===0)break;p===null&&(p=m),u.push(h.slice(Math.min(p,m))),d++}for(;u.length>0&&u[u.length-1]==="";)u.pop();t[c]=l.startsWith("|")?u.join(`
|
|
130
|
+
`):u.map(h=>h||`
|
|
131
|
+
`).join(" "),i=d;continue}try{t[c]=Sf(l)}catch(u){if(!(u instanceof wf))throw u;s.push(o)}i++}return{data:t,unparsed:r,tooDeep:s}}function $L(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 DL(e){return!Array.isArray(e)||e.some(t=>typeof t!="string")?null:e}async function UL(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=$L(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:m}=NL(p.frontmatter);for(const $ of h)c.warn("SKILL_FRONTMATTER_UNPARSED",`skill "${s}": frontmatter line not interpreted: ${$.trim()}`,u);for(const $ of m)c.error("VALUE_TOO_DEEP",`skill "${s}": frontmatter value nests deeper than 32 levels: ${$.trim().slice(0,80)}`,u);const f=d.name;if(typeof f!="string"||f.length===0)return c.error("SKILL_MISSING_NAME",`skill "${s}" is missing the required "name" field`,u),null;if(!LL(f))return c.error("SKILL_INVALID_NAME",`skill name "${f}" must be kebab-case ([a-z0-9-], 1-${Vk} chars, no "--")`,u),null;f!==s&&c.warn("SKILL_NAME_MISMATCH",`skill name "${f}" does not match its directory "${s}"`,u);const g=d.description;if(typeof g!="string"||g.length===0)return c.error("SKILL_MISSING_DESCRIPTION",`skill "${s}" is missing the required "description" field`,u),null;if(g.length>my)return c.error("SKILL_DESCRIPTION_TOO_LONG",`skill "${s}" description exceeds ${my} characters`,u),null;let _;const y=d.allow_implicit_invocation;y!==void 0&&(typeof y!="boolean"?c.warn("SKILL_INVALID_METADATA",`skill "${s}": "allow_implicit_invocation" must be a boolean`,u):_=y);const E=[],P=d.mcp_tools;if(P!==void 0){const $=DL(P);if($===null)c.warn("SKILL_INVALID_METADATA",`skill "${s}": "mcp_tools" must be a list of strings`,u);else for(const O of $)E.includes(O)||E.push(O)}const I=a.filter($=>$.path!==n).map($=>({path:$.path,relativePath:$.path.slice(r.length+1),size:$.size,contentHash:$.contentHash})),M=await Bk(a.map($=>({path:$.path.slice(r.length+1),contentHash:$.contentHash})));return{componentKey:l,directory:r,directoryName:s,skillFilePath:n,name:f,description:g,modelRef:`${t}/${f}`,instructions:p.body.trim(),frontmatter:d,frontmatterRaw:p.frontmatter,..._!==void 0?{allowImplicitInvocation:_}:{},mcpToolDependencies:E,supportingFiles:I,contentHash:o,aggregateHash:M}}var Gk=["app_id","appId","id"],qL=["server","mcp_server","mcpServer","serverKey"];function mu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ig(e){for(const t of Gk){const r=e[t];if(typeof r=="string"&&r.length>0)return{appId:r,appIdKey:t}}}function zL(e,{sourcePath:t,serverKeys:r,contentHash:s,issues:n,maxApps:i}){if(!mu(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=mu(l)?Ig(l):void 0;if(!mu(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,m=r.includes(c);a.push({componentKey:u,appId:p.appId,sourcePath:t,appKey:c,...m?{serverKey:c}:{},binding:"registered",status:m?"bound":"unresolved",contentHash:s,extensions:bd(h,{issues:n,secretCode:"APP_SECRET_FIELD_OMITTED",label:`app "${c}"`,context:{path:t,componentKey:u}})})}return a}function FL(e){const{sourcePath:t,raw:r,issues:s}=e,n={path:t,componentKey:`app:${t}`};if(!mu(r))return s.error("APP_INVALID_CONFIG","app configuration must be a JSON object",n),null;if(r.apps!==void 0&&Ig(r)===void 0)return zL(r.apps,e);const i=jL(r,e);return i===null?null:[i]}function jL(e,{sourcePath:t,serverKeys:r,contentHash:s,issues:n}){const i=`app:${t}`,o={path:t,componentKey:i},{appId:a,appIdKey:c}=Ig(e)??{};if(a===void 0)return n.error("APP_MISSING_ID",`app configuration is missing an app id (${Gk.join(", ")})`,o),null;let l,u;for(const h of qL){const m=e[h];if(typeof m=="string"&&m.length>0){l=m,u=h;break}}const p={};for(const[h,m]of Object.entries(e))h===c||h===u||(p[h]=m);const d=bd(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 HL=["registrationUrl","authorizationUrl","tokenUrl","authorizationServerBase","resource","oidcConfigurationUrl","oidcUserinfoEndpoint"],BL=["baseScopes","defaultScopes","oidcScopesSupported"],VL=["none","client_secret_basic","client_secret_post","private_key_jwt"],kf=(e,t)=>e.some(r=>r===t),GL=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,kr=class extends Error{};function gu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Fp=3;function Mc(e,t){const r=(n,i,o)=>{if(i.length===0)return;const a=i.slice(0,Fp).map(l=>yd(l)?"(redacted)":`"${l.slice(0,64)}"`).join(", "),c=i.length>Fp?` and ${i.length-Fp} 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=>Rc.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 KL(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:"&&wS(s.hostname);if(typeof t!="string"||s===void 0||!n||ig(t))throw new kr(`auth.${e} must be an absolute https:// URL (or a loopback http:// one) without credentials, a fragment, whitespace or backslashes`);if(og(s))throw new kr(`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 WL(e,t){if(!gu(e))throw new kr("auth.client must be an object");const{mode:r,clientId:s,tokenEndpointAuthMethod:n,...i}=e;if(r==="dcr"||r==="cimd")return Mc([...Object.keys(i),...s!==void 0?["clientId"]:[],...n!==void 0?["tokenEndpointAuthMethod"]:[]],t),{mode:r};if(Mc(Object.keys(i),t),r!=="provided")throw new kr('auth.client.mode must be "provided", "dcr" or "cimd"');if(typeof s!="string"||s.length===0)throw new kr('a "provided" client needs auth.client.clientId');if(n===void 0)return{mode:r,clientId:s};if(!kf(VL,n))throw new kr("auth.client.tokenEndpointAuthMethod is not supported");return{mode:r,clientId:s,tokenEndpointAuthMethod:n}}function JL(e,t){const r={},s=[];for(const[n,i]of Object.entries(e))if(n!=="type")if(n==="client")r.client=WL(i,t);else if(kf(HL,n))r[n]=KL(n,i,t);else if(kf(BL,n)){if(!Array.isArray(i)||i.some(o=>typeof o!="string"))throw new kr(`auth.${n} must be an array of strings`);r[n]=i.map(String)}else if(n==="oidcEnabled"){if(typeof i!="boolean")throw new kr("auth.oidcEnabled must be a boolean");r.oidcEnabled=i}else s.push(n);return Mc(s,t),r}function YL(e,t){const{type:r,headerScheme:s,headerName:n,...i}=e,o=s==="bearer"||s==="basic";if(Mc([...Object.keys(i),...o&&n!==void 0?["headerName"]:[]],t),o)return{type:"api_key",headerScheme:s};if(s!=="custom_header")throw new kr('auth.headerScheme must be "bearer", "basic" or "custom_header"');if(typeof n!="string"||!GL.test(n)||n.toLowerCase()==="host")throw new kr("a custom_header API key needs a valid auth.headerName other than Host");return{type:"api_key",headerScheme:s,headerName:n}}function XL(e,t){const r=gu(e)?e[ns]:void 0,s=gu(r)?r.auth:void 0;if(s===void 0)return{};try{if(!gu(s))throw new kr("auth must be an object");switch(s.type){case"none":return Mc(Object.keys(s).filter(n=>n!=="type"),t),{auth:{type:"none"}};case"oauth":case"mixed":return{auth:{type:s.type,...JL(s,t)}};case"api_key":return{auth:YL(s,t)};default:throw new kr('auth.type must be "none", "oauth", "mixed" or "api_key"')}}catch(n){if(!(n instanceof kr))throw n;return{error:n.message}}}function QL(e){return e.headerScheme==="custom_header"?e.headerName:"Authorization"}function ZL(e,t){const r=QL(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 Ef=Object.freeze({"1.0.0":"https://agent-plugins.org/schemas/1.0.0/mcp.schema.json"}),Kk="${PLUGIN_ROOT}",eN="${PLUGIN_DATA}",tN=[Kk,eN];function rN(e){return tN.some(t=>e.includes(t))}var gy=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,sN=new Set(["type","command","args","env","cwd"]),nN=new Set(["type","url","headers","oauth","authentication"]);function iN(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 oN(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 aN(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=oN(e,i,o,s);if(a===null)return null;const c=a==="stdio"?sN:nN;for(const f of Object.keys(o))if(!c.has(f)&&!(n&&f==="extensions"))return s.error("MCP_UNKNOWN_FIELD",`server "${e}": field "${f}" is not part of the Agent Plugins ${a} entry schema`,{componentKey:i}),null;if(a==="stdio"){const f=o.command;if(typeof f!="string"||f.length===0)return s.error("MCP_MISSING_COMMAND",`server "${e}": stdio servers require a non-empty "command"`,{componentKey:i}),null;let g=f;if(rN(g))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(g.startsWith("./")){const P=zi("",g);if(!P.ok)return s.error(P.code,`server "${e}": ${P.message}`,{componentKey:i}),null;g=`${Kk}/${P.path}`}let _=[];if(o.args!==void 0){if(!Array.isArray(o.args)||o.args.some(P=>typeof P!="string"))return s.error("MCP_INVALID_SERVER",`server "${e}": "args" must be an array of strings`,{componentKey:i}),null;_=o.args}const y=pO(e,i,o.env,s);if(y===null)return null;let E;if(o.cwd!==void 0){const P=aO(o.cwd);if(!P.ok)return s.error(P.code,`server "${e}": ${P.message}`,{componentKey:i}),null;E=P.value}return{componentKey:i,key:e,sourcePath:t,config:{transport:"stdio",command:g,args:_,envRequirements:y,...E!==void 0?{workingDirectory:E}:{}}}}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=oO(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=hO(e,i,o.headers,s);if(p===null)return null;const d=o.oauth!==void 0||o.authentication!==void 0?fO(e,i,o,s):void 0,h=XL(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 m=h.auth;return{componentKey:i,key:e,sourcePath:t,config:{transport:"http",httpVariant:a,url:l,headerRequirements:m?.type==="api_key"?ZL(p,m):p,...d!==void 0?{oauth:d}:{},...m!==void 0?{auth:m}:{}}}}function cN(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 lN(e,t){const{sourcePath:r,manifestSchemaVersion:s,issues:n,maxServers:i}=t,o=(f,g)=>(n.warn(f,g,{path:r}),n.warn("COMPONENT_SKIPPED",`MCP servers are disabled for this bundle: ${g}`,{path:r}),{servers:[],skipped:[{kind:"mcp-config",key:r,reason:g}],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(Ef).find(f=>Ef[f]===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 f of Object.keys(a))if(f!=="$schema"&&f!=="mcpServers")return o("MCP_INVALID_CONFIG",`mcp.json field "${f}" 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=[],m=(f,g)=>{const _=g.firstErrorMessage()??"invalid server entry";n.absorbDemoted(g),n.warn("COMPONENT_SKIPPED",`server "${f}" was skipped: ${_}`,{path:r,componentKey:`server:${f}`}),h.push({kind:"server",key:f,reason:_})};for(const[f,g]of Object.entries(u)){const _=new mi;if(!gy.test(f)){_.error("MCP_INVALID_SERVER_NAME",`server name "${f}" must match ${gy}`,{path:r}),m(f,_);continue}const y=aN(f,r,g,_,t.entryExtensions===!0);if(y===null||_.hasErrors()){m(f,_);continue}n.absorbDemoted(_),d.push(y)}return{servers:d,skipped:h,documentVersion:l}}var vy=new Set(["command","args","env","cwd"]),_y=new Set(["url","headers"]),uN=new Set(["oauth","authentication"]),dN=new Set(["type","transport","enabled","disabled"]),pN=[["${CLAUDE_PLUGIN_ROOT}","${PLUGIN_ROOT}"],["${CLAUDE_PLUGIN_DATA}","${PLUGIN_DATA}"]];function Rg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ml(e){return pN.reduce((t,[r,s])=>t.split(r).join(s),e)}function hN(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):Rg(s)&&r(Object.values(s));return t}function fN(e){if(typeof e.command=="string"){const t=Ml(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"?Ml(t):t)),Rg(e.env)&&(e.env=Object.fromEntries(Object.entries(e.env).map(([t,r])=>[t,typeof r=="string"?Ml(r):r]))),typeof e.cwd=="string"){const t=Ml(e.cwd),r=!/^(?:\.\/|\/|\$\{|~)/.test(t);e.cwd=t==="."?"./":r?`./${t}`:t}}function mN(e,t,r){if(!Rg(t))return{entry:t};if(t.disabled===!0||t.enabled===!1)return{reason:"it is disabled in its configuration"};const s=iN(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"?vy:_y,a=i==="stdio"?_y:vy,c={type:i};for(const[l,u]of Object.entries(t))if(!dN.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"&&uN.has(l)){c[l]=u;continue}r.warn("MCP_UNKNOWN_FIELD",`server "${e}": field "${l}" is not supported; ignored`,{componentKey:`server:${e}`})}return hN(c).some(l=>l.includes("${user_config."))?{reason:"it uses ${user_config.*} placeholders, which MCPJam does not fill in"}:(i==="stdio"&&fN(c),{entry:c})}function gN(e,t){const{sourcePath:r,issues:s,maxServers:n}=t,i=cN(e);if(!i.ok)return{ok:!1,code:i.code,reason:i.message};const o=l=>({$schema:Ef["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=mN(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 vN="mcp.json";var _N={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 Wk(e){const t=e.slice(e.lastIndexOf("/")+1),r=t.lastIndexOf(".");return r<=0?"":t.slice(r+1).toLowerCase()}function yN(e){return _N[Wk(e)]??"application/octet-stream"}function bN(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 wN={png:"png",jpg:"jpeg",jpeg:"jpeg",gif:"gif",webp:"webp",svg:"svg"};function Jk(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 jp(e,t,r){const s=Jk(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 SN(e){const t=e.extensions[li];return t!==null&&typeof t=="object"&&!Array.isArray(t)&&typeof t.logo=="string"}async function c7(e,t){const r={...CO,...t?.limits},s=new mi,n=t?.profile??"strict",i=await e.list(),o=sO(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:R})=>R)),c=CL(a,n);OL(c,n,s);const l=c.manifest;if(l===void 0||s.hasErrors())throw new nf(s.issues());const u=o.flatMap(R=>{const te=PL(c.directory,R.path);return te===void 0?[]:[{...R,path:te}]}),p=[],d=new Map;for(const R of u){let te;try{te=await e.readBytes(R.sourcePath,r.maxFileBytes)}catch(he){s.error("FILE_UNREADABLE",`file could not be read: ${he instanceof Error?he.message:String(he)}`,{path:R.path});continue}if(te.byteLength>r.maxFileBytes){s.error("FILE_TOO_LARGE",`file exceeds the per-file limit of ${r.maxFileBytes} bytes`,{path:R.path});continue}if(te.byteLength!==R.size){s.error("FILE_SIZE_MISMATCH",`declared size ${R.size} does not match actual size ${te.byteLength}`,{path:R.path});continue}const ae={...R,bytes:te,contentHash:await AL(te)};p.push(ae),d.set(ae.path,ae)}s.throwIfErrors();const h=await Bk(p.map(R=>({path:R.path,contentHash:R.contentHash}))),m=p.filter(R=>R.executable).map(R=>R.path),f=new Set(d.keys()),g=$O({profile:n,location:l,filePaths:f,readJson:(R,te)=>{const ae=d.get(R);return ae===void 0?null:jp(ae,te,"MANIFEST_INVALID_JSON")},issues:s}),_=c.directory===""?g.interpretation:{...g.interpretation,rootDirectory:c.directory},y=d.get(_.manifestPath),{manifest:E,onboardingSkill:P}=g.record===null||y===void 0?{manifest:null}:TO(g.record,{filePaths:f,issues:s,profile:n});if(E===null||y===void 0)throw new nf(s.issues());const I=y.contentHash;s.throwIfErrors();const M=[],$=[];for(const R of p){if(!R.path.startsWith("skills/"))continue;const te=R.path.slice(fy.length+1).split("/");te.length===2&&te[1]==="SKILL.md"&&!$.includes(te[0])&&$.push(te[0])}$.sort(),$.length>r.maxSkills&&(s.error("SKILL_TOO_MANY",`bundle declares ${$.length} skills; the limit is ${r.maxSkills}`),s.throwIfErrors());const O=(R,te)=>{const ae=te.firstErrorMessage()??"invalid skill";s.absorbDemoted(te),s.warn("COMPONENT_SKIPPED",`skill "${R}" was skipped: ${ae}`,{componentKey:`skill:${R}`}),M.push({kind:"skill",key:R,reason:ae})},B=[],le=new Map;for(const R of $){const te=`${fy}/${R}`,ae=`${te}/${ML}`,he=d.get(ae);if(he===void 0)continue;const de=new mi,Ke=Jk(he,de);if(Ke===null){O(R,de);continue}const Ge=p.filter(pe=>_l(te,pe.path)),Pe=await UL({pluginName:E.name,directory:te,directoryName:R,skillFilePath:ae,skillText:Ke,skillContentHash:he.contentHash,files:Ge.map(pe=>({path:pe.path,size:pe.size,contentHash:pe.contentHash})),issues:de});if(Pe===null||de.hasErrors()){O(R,de);continue}s.absorbDemoted(de);const V=le.get(Pe.name);if(V!==void 0){const pe=new mi;pe.error("SKILL_DUPLICATE_NAME",`skill name "${Pe.name}" is declared by both "${V}" and "${Pe.directory}"`,{path:Pe.skillFilePath,componentKey:Pe.componentKey}),O(R,pe);continue}le.set(Pe.name,Pe.directory),B.push(Pe)}RO(E,P,B,s);const ie=[],C=g.legacyMcp,fe=_.layout==="agent-plugins"?d.get(vN):C?.kind==="file"?d.get(C.path):void 0;g.skipped!==void 0&&M.push(g.skipped);for(const R of p){const te=`/${R.path}`.endsWith("/mcp.json")&&!_l("skills",R.path)||_.layout!=="agent-plugins"&&R.path===".mcp.json";R!==fe&&te&&s.warn("MCP_CONFIG_IGNORED",`"${R.path}" is not this bundle's MCP configuration; ignored`,{path:R.path})}const X=fe?.path??C?.path;if(X!==void 0){const R=new mi;let te=fe!==void 0?jp(fe,R,"MCP_INVALID_CONFIG"):C?.kind==="inline"?C.document:null;if(te!==null&&C!==void 0){const ae=gN(te,{sourcePath:X,issues:s,maxServers:r.maxMcpServers});ae.ok?M.push(...ae.skipped):R.error(ae.code,ae.reason,{path:X}),te=ae.ok?ae.document:null}if(te===null){const ae=R.firstErrorMessage()??"invalid mcp.json";s.absorbDemoted(R),s.warn("COMPONENT_SKIPPED",`MCP servers are disabled for this bundle: ${ae}`,{path:X}),M.push({kind:"mcp-config",key:X,reason:ae})}else{const ae=lN(te,{sourcePath:X,manifestSchemaVersion:E.schemaVersion,issues:s,maxServers:r.maxMcpServers,entryExtensions:_.profile==="openai-compatible"});M.push(...ae.skipped);for(const he of ae.servers)ie.push({...he,configHash:await Hk(he.config)})}}const me=[],q=ie.map(R=>R.key);for(const R of p){if(!R.path.endsWith(".app.json")||_l("skills",R.path))continue;const te=new mi,ae=jp(R,te,"APP_INVALID_CONFIG"),he=ae===null?null:FL({sourcePath:R.path,raw:ae,serverKeys:q,contentHash:R.contentHash,issues:te,maxApps:r.maxMcpServers}),de=te.firstErrorMessage();if(s.absorbDemoted(te),he===null||de!==void 0){s.warn("COMPONENT_SKIPPED",`apps in "${R.path}" were skipped: ${de??"invalid app configuration"}`,{path:R.path}),M.push({kind:"app",key:R.path,reason:de??"invalid app configuration"});continue}me.push(...he)}const ue=[],b=new Set,ee=(R,te,ae,he=!0)=>{if(b.has(R.path))return!0;const de=Wk(R.path),Ke=wN[de];if(ae!==void 0&&Ke===void 0){const Ge=`manifest "${ae}" must reference an image file`;return he?s.error("ASSET_UNSUPPORTED_TYPE",Ge,{path:R.path}):s.warn("ASSET_UNSUPPORTED_TYPE",`${Ge}; ignored`,{path:R.path}),!1}if(Ke!==void 0&&bN(R.bytes)!==Ke){const Ge=`file extension ".${de}" does not match its content`;if(ae!==void 0)return he?s.error("ASSET_CONTENT_MISMATCH",Ge,{path:R.path}):s.warn("ASSET_CONTENT_MISMATCH",`manifest "${ae}": ${Ge}; ignored`,{path:R.path}),!1;s.warn("ASSET_CONTENT_MISMATCH",Ge,{path:R.path})}return b.add(R.path),ue.push({path:R.path,kind:te,size:R.size,contentHash:R.contentHash,contentType:yN(R.path)}),!0};if(E.icon!==void 0){const R=d.get(E.icon);R!==void 0&&ee(R,"icon","icon")}const ne=SN(E);if(E.logo!==void 0){const R=d.get(E.logo);R!==void 0&&!ee(R,"logo","logo",ne)&&delete E.logo}for(const[R,te]of[["logoDark","logo"],["composerIcon","icon"]]){const ae=E[R];if(ae===void 0)continue;const he=d.get(ae);he!==void 0&&!ee(he,te,`interface.${R}`,!1)&&delete E[R]}for(const R of p)_l("assets",R.path)&&ee(R,R.path.toLowerCase().includes("screenshot")?"screenshot":"other");const H=[];for(const R of ie){if(R.config.transport==="stdio"){for(const de of R.config.envRequirements)de.valueTemplate!==void 0||de.value!==void 0||H.push({kind:"env",componentKey:R.componentKey,serverKey:R.key,name:de.name,required:de.required});continue}for(const de of R.config.headerRequirements)de.value===void 0&&H.push({kind:"header",componentKey:R.componentKey,serverKey:R.key,name:de.name,secret:de.secret,...de.scheme!==void 0?{scheme:de.scheme}:{}});const{auth:te,oauth:ae}=R.config,he=te?.type==="oauth"||te?.type==="mixed";(he||te===void 0&&ae!==void 0)&&H.push({kind:"oauth",componentKey:R.componentKey,serverKey:R.key,...ae?.timing!==void 0?{timing:ae.timing}:{},...he?{required:te.type==="oauth"}:{}})}return s.throwIfErrors(),{manifest:E,interpretation:_,schemaVersion:E.schemaVersion,bundleHash:h,executableFiles:m,executionDigest:await IL({bundleHash:h,executableFiles:m,profile:_.profile,revision:_.revision}),manifestHash:I,skills:B,mcpServers:ie,apps:me,assets:ue,skipped:M,setupRequirements:H,warnings:s.warnings()}}var l7=new TextDecoder("utf-8",{fatal:!1}),u7=new TextDecoder("utf-8",{fatal:!1}),d7=Object.freeze({"technical-preflight":["runtime-compatibility","tool-policy"],"submission-ready":["runtime-compatibility","tool-policy","submission-artifacts"]});function kN(e){return typeof e=="object"&&e!==null&&e.readinessKind==="muse-directory-readiness"}var EN="2026-10-07",TN="https://muse.ai/platform",AN=["docs","terms"],IN={docs:"60628e5a1c6199b8635a161b7f5a8aaa",terms:"98588b3844410fbd5ff3aca6b0000e23"},RN=AN.map(e=>({page:e,url:`${TN}/${e}`,revision:IN[e]??null,snapshotDate:EN})),p7=Object.freeze(Object.fromEntries(RN.map(e=>[e.page,e]))),CN=["read","write","sensitive-write"],PN=["setup-instructions","inputs-and-outputs","read-write-classifications","sensitive-designations","permissions","side-effects","status-handling","errors","rate-limits"],xN=["oauth","api-key","none","other"],ON=["test","production"],MN=["businessVerificationProvided","brandAssetsAuthorized","maintainerNamed","dataProcessingQuestionnaireCompleted","acceptsDeveloperTerms"],Mt=w(),h7=Y({overview:Y({intendedUsers:Mt.optional(),supportedTasks:re(Mt).optional(),browserImprovement:Mt.optional(),restrictions:Mt.optional()}).optional(),privacyPolicyUrl:Mt.optional(),termsUrl:Mt.optional(),supportContact:Mt.optional(),securityContact:Mt.optional(),documentationUrl:Mt.optional(),documentationCovers:re(pt(PN)).optional(),authentication:Y({method:pt(xN),scopes:re(Mt).optional(),readOnlyScopes:re(Mt).optional(),readOnlyNotPossibleReason:Mt.optional(),credentialsEnvironment:pt(ON).optional()}).optional(),testAccount:Y({signInInstructions:Mt.optional(),requiredPermissions:Mt.optional(),representativeTestData:Mt.optional(),limits:Mt.optional(),accessibleThroughoutReview:Ce().optional()}).optional(),transactions:Y({hasTransactionTools:Ce(),noChargeTestPath:Mt.optional()}).optional(),toolClassifications:Qe(Mt,pt(CN)).optional(),attestations:pS(pt(MN),Ce()).optional()}),LN=new Set(["access_token","refresh_token","id_token","client_secret","code","code_verifier","authorization_code","authorization","state","cookie","set_cookie","api_key"]),NN=[/^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 Cg(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[^a-zA-Z0-9]+/g,"_").toLowerCase()}var $N=["_type","_types","_endpoint","_endpoints","_supported","_method","_methods","_uri","_uris","_url","_urls","_alg","_algs","_values","_in"];function DN(e){return $N.some(t=>e.endsWith(t))}function Pg(e){return LN.has(e)?!0:DN(e)?!1:/(^|_)(token|secret|password|credential|cookie|auth)(_|$)/.test(e)||/(^|_)api_?key(_|$)/.test(e)}function UN(e){return Pg(Cg(e))}function qN(e){return Pg(Cg(e))||NN.some(t=>t.test(e))}function zN(e){return Pg(Cg(e))}function xg(e){return typeof e!="string"||e.length<=8?"[redacted]":`${e.slice(0,4)}...[redacted]...${e.slice(-2)}`}var Yk="client_secret|access_token|refresh_token|id_token|code_verifier|code|assertion|password|api[-_]?key|token|secret|state",Xk=new RegExp(`(^|[^\\w-])((?:[\\w-]*[_-])?(?:${Yk}))=[^&\\s"'<>]+`,"gi"),Qk=`(?:(?:[\\w-]*[_-])?(?:${Yk}))`,FN=new RegExp(`("${Qk}"\\s*:\\s*)"(?:\\\\.|[^"\\\\])*"`,"gi"),jN=new RegExp(`("${Qk}"\\s*:\\s*)"(?:\\\\[\\s\\S]?|[^"\\\\])*$`,"gi");var HN=new RegExp(`\\b((?:[\\w-]*[_-])?(?:client[-_]?secret|access[-_]?token|refresh[-_]?token|id[-_]?token|code[-_]?verifier))(\\s*[:=]\\s*)("(?:\\\\.|[^"\\\\])*"|[^&\\s"'<>,;]+)`,"gi");function Zk(e){const t=e.replace(/[.,;:!?)\]}]+$/,"");return!/^[a-z]{1,20}$/.test(t)}function BN(e,t,r,s){return Zk(s)?`${t}${r}[redacted]`:e}function $n(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(HN,(o,a,c,l)=>`${a}${c}${l.startsWith('"')?'"[redacted]"':"[redacted]"}`).replace(Xk,"$1$2=[redacted]").replace(/\b((?:proxy-)?authorization\s*[:=]\s*)(bearer|basic)\s+\S+/gi,"$1$2 [redacted]").replace(/\b(bearer|basic)(\s+)(\S+)/gi,BN).replace(FN,'$1"[redacted]"');return(n?i.replace(jN,'$1"[redacted]').replace(/([a-z][a-z0-9+.-]*:\/\/)[^\s/?#]*$/gi,"$1[redacted]"):i).slice(0,s)}function VN(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 GN(e){return Object.keys(e).every(t=>t.length<=64&&/^[A-Za-z0-9_.\-[\]]+$/.test(t))}var KN=3;function WN(e,t){return/^https?:\/\//i.test(e)?t>=KN?"[redacted]":Og(e,t+1):e.replace(Xk,"$1$2=[redacted]")}function Og(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=zN(i)?"[redacted]":WN(o,t);s||=a!==o,n.append(i,a)}return s&&(r.search=n.toString()),r.hash&&(r.hash="#[redacted]"),r.toString()}catch{return $n(e)}}function eE(e){const t=e.trim();if(!t)return e;if(/^https?:\/\//i.test(t))return Og(t);if(t.includes("=")||t.includes("&")||t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]")){const r=VN(t);if(r&&GN(r))return Ts(r)}return $n(t)}function Ts(e){return Array.isArray(e)?e.map(t=>Ts(t)):typeof e=="string"?eE(e):!e||typeof e!="object"?e:Object.fromEntries(Object.entries(e).map(([t,r])=>UN(t)?[t,xg(r)]:[t,Ts(r)]))}function JN(e){const t=eE(e);return typeof t=="string"?t:xg(e)}function yy(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>qN(t)?[t,xg(r)]:[t,JN(r)]))}function f7(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 tE(e){return Tf(e,[])}function Tf(e,t){return Array.isArray(e)?e.map(r=>Tf(r,t)):!e||typeof e!="object"?typeof e=="string"?YN(e):e:Object.fromEntries(Object.entries(e).map(([r,s])=>[r,QN(r,s,t)?"[REDACTED]":Tf(s,[...t,r])]))}function YN(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,XN).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 XN(e,t,r){return/^[A-Za-z_][A-Za-z0-9_-]*=/u.test(r)?e:Zk(r)?`Bearer${t}[REDACTED]`:e}function QN(e,t,r){const s=e.toLowerCase().replace(/[^a-z0-9]/gu,"");return s==="code"?e$(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"))&&ZN(t)||s==="apikey"||s==="xapikey"}function ZN(e){return typeof e=="string"&&e.length>0}function e$(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 Cr={ParseError:-32700,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,HeaderMismatch:-32020,MissingRequiredClientCapability:-32021,UnsupportedProtocolVersion:-32022,ResourceNotFound:-32602,ConnectionClosed:-32e3,RequestTimeout:-32001,UrlElicitationRequired:-32042},t$={HeaderMismatch:-32001,MissingRequiredClientCapability:-32003,UnsupportedProtocolVersion:-32004},r$="ERA_NEGOTIATION_FAILED";function s$(e){return!!e&&typeof e=="object"&&e.code===r$}function Mg(e){const t=new Set;let r=e;for(;s$(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 rE(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 sE(e){return e?.constructor?.mcpBrand==="mcp.InsufficientScopeError"||e?.name==="InsufficientScopeError"}function n$(e){return rE(e,t=>{if(!sE(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 i$(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 o$(e){return rE(e,t=>{const r=i$(t);if(r)return r;const s=iS(t?.authChallenge);if(s)return s;if(!sE(t))return;const n=n$(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 a$={"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 c$(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 Ll="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.",l$="/troubleshooting/error-codes",by={"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",...a$,"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 Se(e,t,r,s,n,i,o="error"){return{slug:e,title:t,oneLine:r,likelyCauses:s,nextSteps:n,docsAnchor:`${l$}#${i}`,severity:o,...by[e]?{origin:by[e]}:{}}}var Af={"jsonrpc/parse_error":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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":Se("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.",Ll],"out-of-mcpjam-credits","warning"),"provider/mcpjam_limit_monthly":Se("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.",Ll],"out-of-mcpjam-credits","warning"),"provider/mcpjam_limit_insufficient":Se("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.",Ll],"out-of-mcpjam-credits","warning"),"provider/fallback_prohibited":Se("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":Se("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":Se("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":Se("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":Se("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.",Ll],"out-of-mcpjam-credits","warning"),"provider/quota":Se("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":Se("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":Se("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":Se("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"),...c$(Se),"generation/invalid_output":Se("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":Se("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 nE(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&&u$(s))return s;const n=e.cause;if(n!==void 0&&n!==e){const i=nE(n,t+1);if(i!==void 0)return i}return s}function u$(e){return d$.has(e)||e.startsWith("UND_ERR_")}var d$=new Set(["ECONNREFUSED","ECONNRESET","EAI_AGAIN","ENETDOWN","ENETUNREACH","ENOTFOUND","EPIPE","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_SOCKET"]),p$="The server's TLS certificate could not be verified",h$="The connection to the server failed";function f$(e){return e.includes(p$)}function m7(e){return e.includes(h$)}var Lg=["org_keys_required","org_model_unconfigured","org_runtime_unsupported","ai_scope_unresolved","ai_key_policy_unavailable","provider_auth_failed","provider_unavailable"],m$=["credential_missing","capability_missing","capability_unknown","invalid_model"],Ng=[...Lg,...m$],g$=new Set(Lg),v$=new Set(Ng);function _$(e){return v$.has(e)}function y$(e){return typeof e=="string"&&g$.has(e)}function g7(e){if(typeof e!="string")return;const t=e.trim().toLowerCase();return _$(t)?t:void 0}var b$={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 iE(e){return b$[e]?"temporary":"configuration"}var v7=new Set(Ng.filter(e=>iE(e)==="temporary")),_7=new Set(Ng.filter(e=>iE(e)==="configuration")),w$={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 wy(e){if(typeof e!="string")return;const t=e.trim().toLowerCase();return y$(t)?w$[t]:void 0}var oE=["provider_auth_failed","provider_unavailable"],S$=new Set(oE),k$=Lg.filter(e=>!S$.has(e)),E$=new RegExp(`\\b(${k$.join("|")})\\b`,"i"),Hp=oE.join("|"),T$=new RegExp(`"code"\\s*:\\s*"(${Hp})"|\\((${Hp})\\b|(?:^|[\\s—-])(${Hp}):`,"i");function A$(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=wy(c);if(l)return{slug:l,rawCode:c.trim().toLowerCase()}}s=a.cause}const n=(E$.exec(t)??T$.exec(t))?.slice(1).find(o=>o!==void 0);if(!n)return;const i=wy(n);return i?{slug:i,rawCode:n.toLowerCase()}:void 0}var Sy=120;function Bp(e){return e=String(tE(e)),e.length>Sy?e.slice(0,Sy):e}function Vp(e,t){const r=t?.bodyKind;if(e==null||e.trim()==="")return{scheme:"none",...r?{bodyKind:r}:{}};try{const s=Ex(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=Bp(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(Bp)));o.length>0&&(i.scopes=o.slice(0,20))}if(typeof n.resource_metadata=="string"&&n.resource_metadata.trim())try{i.resourceMetadataHost=Bp(new URL(n.resource_metadata.trim()).host)}catch{}return r&&(i.bodyKind=r),i}catch{return{scheme:"other",...r?{bodyKind:r}:{}}}}function I$(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 Bo(e){const t=tE(e);return typeof t=="string"?t:String(e)}function R$(e){if(!e||typeof e!="object")return;const t=e.name;return typeof t=="string"?t:void 0}function $g(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 Dg(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 C$(e){if(!e||typeof e!="object")return;const t=e.code;return typeof t=="string"?t:void 0}function aE(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 cE(e){return Af[e]??Af["internal/unknown"]}var P$=200;function If(e){const t=e.replace(/\s+/g," ").trim();return t.length<=P$?t:`${t.slice(0,199).trimEnd()}…`}function lE(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=qg(r);return i?{...e,oneLine:i}:e}return t!=="internal/unknown"||!r?e:{...e,oneLine:If(r)}}var x$=["Backend step returned no content (stream error or empty response)","Backend step returned no messages (stream error or empty response)"];function O$(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(f$(e))return"transport/tls_untrusted"}var M$={[Cr.ParseError]:"jsonrpc/parse_error",[Cr.InvalidRequest]:"jsonrpc/invalid_request",[Cr.MethodNotFound]:"jsonrpc/method_not_found",[Cr.InvalidParams]:"jsonrpc/invalid_params",[Cr.InternalError]:"jsonrpc/internal_error",[Cr.ConnectionClosed]:"jsonrpc/connection_closed",[Cr.HeaderMismatch]:"jsonrpc/header_mismatch",[Cr.MissingRequiredClientCapability]:"jsonrpc/missing_required_client_capability",[Cr.UnsupportedProtocolVersion]:"jsonrpc/unsupported_protocol_version",[t$.UnsupportedProtocolVersion]:"jsonrpc/unsupported_protocol_version",[Cr.UrlElicitationRequired]:"jsonrpc/url_elicitation_required"};function L$(e){return/header[^a-z]*mismatch/i.test(e)||/MCP-Protocol-Version/i.test(e)?"jsonrpc/header_mismatch":"jsonrpc/request_timeout"}var N$=/^(?:MCP error -32603:\s*)?invalid response format$/i;function uE(e){return N$.test(e.trim())}function $$(e){return uE(e)?"jsonrpc/invalid_response_format":"jsonrpc/internal_error"}function dE(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 D$(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=dE(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(uE(e))return"jsonrpc/invalid_response_format"}function U$(e){const t=z$(e);if(!t)return;const r=q$(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 q$(e){if(!e||typeof e!="object"||e.name!=="OAuthResponseError")return;const t=e.code;return typeof t=="string"&&t?t:void 0}function z$(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 pE(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"?Bo(t.message):"";if(s)return{name:r,message:s}}var ky={AUTH_ERROR:"auth/http_401",OAUTH_REQUIRED:"auth/http_401"};function F$(e){const t=R$(e);if(t==="MCPAuthError"||t==="UnauthorizedError")return"auth/http_401";const r=C$(e);if(r&&ky[r])return ky[r]}function Gp(e){if(e===401)return"auth/http_401";if(e===403)return"auth/http_403";if(e===429)return"provider/quota"}function j$(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 H$(e){const t=$g(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=A$(e,t);if(n)return n;if(x$.some(g=>t.startsWith(g)))return{slug:"provider/empty_response"};const i=O$(t);if(i)return{slug:i};const o=F$(e);if(o)return{slug:o};const a=Dg(e);if(a!==void 0){if(a===-32001)return{slug:L$(t),rawCode:a};if(a===Cr.InternalError)return{slug:$$(t),rawCode:a};const g=M$[a];if(g)return{slug:g,rawCode:a};const _=Gp(a);if(_)return{slug:_,rawCode:a}}const c=nE(e);if(c){const g=dE(c);if(g)return{slug:g,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(qg(t))return{slug:"provider/mcpjam_limit_insufficient"};if(/\bout of MCPJam credits\b/i.test(t))return{slug:"provider/mcpjam_limit"};const l=tD(t);if(l)return{slug:l};const u=Ug(e);if(u!==void 0){const g=Gp(u);if(g)return{slug:g,rawCode:u}}const p=hE(e)?.streamable,d=p!==void 0&&p>=400?p:Rf(e);if(d!==void 0&&d>=400&&Gp(d)===void 0)return{slug:"server/http_error",rawCode:d};const h=U$(e);if(h)return{slug:h};const m=j$(t);if(m)return{slug:m};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 f=D$(t);return f?{slug:f}:/well[-_]?known/i.test(t)&&/(unreachable|fail|404)/i.test(t)?{slug:"oauth/well_known_unreachable"}:{slug:"internal/unknown"}}var B$=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 Ug(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=aE(r);if(n!==void 0)return n;const i=Dg(r);if(i!==void 0&&i>=100&&i<=599)return i;if(r.name==="UnauthorizedError")return 401;const o=Mg(r);r=o!==r?o:r.cause}}var V$=new Set(["StreamableHTTPError","SseError"]);function G$(e){if(e.name==="SdkHttpError")return!0;const t=e.constructor;return typeof t=="function"&&V$.has(t.name)}function Rf(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),G$(s)){const i=aE(s)??Dg(s);if(i!==void 0&&i>=100&&i<=599)return i}const n=Mg(s);t.push(n!==s?n:s.cause,s.streamableCause)}}function hE(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:Rf(s),fallback:Rf(t.cause)};const n=Mg(t);t=n!==t?n:t.cause}}function K$(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??fE(e);if(!r)return;const s=Ug(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 fE(e){const t=o$(e);if(t)return t.raw?Vp(t.raw):t.facets.challengeHeader!=="bearer"?Vp(void 0):{...Vp("Bearer"),...t.error?{error:t.error}:{},...t.requiredScope?{scopes:t.requiredScope.split(/\s+/).filter(Boolean)}:{}}}function W$(e,t,r){if(t==="auth/insufficient_scope"&&r?.challenge?.scopes?.length)return{...e,oneLine:If(Bo(`${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:If(Bo(`${e.oneLine} The server reported \`${s}\`.`))}}var J$=new Set(["user_server","user_config","mcpjam","ambiguous"]);function Y$(e){return typeof e=="string"&&J$.has(e)}function X$(e){const t=e?.origin;return Y$(t)?t:"ambiguous"}function mE(e,t,r){return r?.credentialOwner==="mcpjam"&&B$.has(t)?{...e,origin:"mcpjam"}:e}function Q$(e,t){return e==="provider/quota"&&t?.surface==="mcpServer"?"server/rate_limited":e}function Z$(e,t){try{const r=Bo($g(e)),s=K$(e,t),n=s?{slug:s}:H$(e),i=Q$(n.slug,t),o=n.rawCode??(s?Ug(e):void 0),a=mE(W$(lE(cE(i),i,r,o,i==="server/http_error"?hE(e)?.fallback:void 0),i,t?.challenge?t:{...t,challenge:fE(e)}),i,t),c=pE(e);return{...a,rawMessage:r,...o!==void 0?{rawCode:o}:{},...c?{cause:c}:{}}}catch{return gE(e,"Unknown")}}function y7(e,t,r){try{const s=mE(cE(e),e,r),n=t!==void 0?Bo($g(t)):"",i=pE(t);return{...s,rawMessage:n,...i?{cause:i}:{}}}catch{return gE(t,"")}}function gE(e,t){const r=Af["internal/unknown"];let s=t;try{s=Bo(e instanceof Error?e.message:String(e??t))}catch{s=t}return{...lE(r,"internal/unknown",s),rawMessage:s}}var eD=/\bThis request needs about (\d+) MCPJam credits; your organization has (\d+) left[^.]{0,40}\./i;function qg(e){const t=eD.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 tD(e){if(qg(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 rD;rD=globalThis.crypto;var sD="Resource server does not implement OAuth 2.0 Protected Resource Metadata.",Ey="No response while loading OAuth protected resource metadata.",nD="Failed to request resource metadata";function xd(e){const t=e instanceof Error?e.message:String(e);return`${nD}: ${t}`}function b7(e){return e==="Resource server does not implement OAuth 2.0 Protected Resource Metadata."||e===xd(new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata."))}function iD(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 oD(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 aD(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=oD(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 cD(e){return e.resolved?e.resolved.value:e.serverUrl===void 0?e.prmResource:Cf({serverUrl:e.serverUrl,prmResource:e.prmResource}).value}function Cf(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 aD(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:iD(e.serverUrl),source:"server",status:"valid",strictClientCompatible:!0,rfc9728Compliant:r===void 0,...r?{rfc9728Reason:r}:{}}}var lD="oauth-protected-resource";function vE(e){const t=typeof e=="string"?new URL(e):e;return{origin:t.origin,path:t.pathname.replace(/\/$/,"")}}function uD(e){const{origin:t,path:r}=vE(e),s=`${t}/.well-known/${lD}`;return[`${s}${r}`,s]}var dD={"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"}},pD={oauth:"oauth-authorization-server",oidc:"openid-configuration"},Zc={current:["oauth-insert","oidc-insert","oidc-append"],legacy:["oauth-insert","oauth-root"]};function el(e,t){const{origin:r,path:s}=vE(e),n=new Set,i=[];for(const o of t){const{kind:a,placement:c}=dD[o],l=pD[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 _E="2025-11-25";async function yE(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 hD(e,t="",r={}){const s=t.endsWith("/")?t.slice(0,-1):t;return r.prependPathname?`${s}/.well-known/${e}`:`/.well-known/${e}${s}`}var Ty=5,fD=new Set([301,302,303,307,308]);function mD(e,t){if(!fD.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 Ay(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 yE(n,s,r),a=o?mD(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>=Ty)throw new Error(`HTTP ${o.status}: Stopped after ${Ty} redirects; last Location was ${a.url.href}`);n=a.url}}function gD(e,t){return e?t==="/"?!1:e.status>=400&&e.status<500&&e.status!==429:!0}async function vD(e,t,r,s){const n=new URL(e),i=s?.protocolVersion??_E;let o;if(s?.metadataUrl)o=new URL(s.metadataUrl);else{const l=hD(t,n.pathname);o=new URL(l,s?.metadataServerUrl??n),o.search=n.search}let a=await Ay(o,i,r),c=!a;return!s?.metadataUrl&&gD(a,n.pathname)&&(a=await Ay(new URL(`/.well-known/${t}`,n),i,r),c||=!a),{response:a,sawNoResponse:c}}async function Od(e,t,r=fetch){const{response:s,sawNoResponse:n}=await vD(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!s)throw new Error(Ey);if(s.status===404)throw await s.text().catch(()=>{}),new Error(n?Ey:sD);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 _D(e,{fetchFn:t=fetch,protocolVersion:r=_E}={}){const s={"MCP-Protocol-Version":r,Accept:"application/json"};for(const{url:n,kind:i}of el(e,Zc.current)){const o=await yE(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 yD(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 bD(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 w7(e,t){let r,s;try{const i=await Od(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn);typeof i=="object"&&i!==null&&!Array.isArray(i)&&(r=i,s=yD(i))}catch(i){if(i instanceof TypeError||bD(i))throw i}s||(s=String(new URL("/",e)));const n=await _D(s,{fetchFn:t?.fetchFn});return{authorizationServerUrl:String(s),authorizationServerMetadata:n,resourceMetadata:r}}var bE="https://www.mcpjam.com/mcp_jam_2row.png",S7="https://www.mcpjam.com/.well-known/oauth/client-metadata.json",wE="https://github.com/MCPJam/inspector",wD={"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 k7(e){return{client_name:wD[e],client_uri:wE,logo_uri:bE}}var zg="urn:ietf:params:oauth:grant-profile:id-jag",Fg="urn:ietf:params:oauth:grant-type:token-exchange",jg="urn:ietf:params:oauth:grant-type:jwt-bearer",Iy="urn:ietf:params:oauth:token-type:id-jag",SD="urn:ietf:params:oauth:token-type:id_token",kD="urn:ietf:params:oauth:token-type:saml2";var Ry="mcpjam-xaa-debugger";function ED(e){return{client_name:"MCPJam XAA Debugger",client_uri:wE,logo_uri:bE,authorization_grant_profiles_supported:[zg],grant_types:[Fg,jg],token_endpoint_auth_method:e.tokenEndpointAuthMethod,...e.jwks?{jwks:e.jwks}:{}}}function Kp(e,t){return e==null?"omitted":Array.isArray(e)&&e.includes(t)?"present":"contradicted"}function Cy(e){return{profile:Kp(e.authorization_grant_profiles_supported,zg),jwtBearerGrant:Kp(e.grant_types,jg),tokenExchangeGrant:Kp(e.grant_types,Fg),tokenEndpointAuthMethod:typeof e.token_endpoint_auth_method=="string"?e.token_endpoint_auth_method:void 0}}function TD(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 Md(e){const t=TD(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 Py(e){return new URLSearchParams([["v",e]]).toString().slice(2)}function Hn(e){const{clientId:t,clientSecret:r,tokenEndpointAuthMethod:s}=e;if(r&&s==="client_secret_basic")return{headers:{Authorization:`Basic ${btoa(`${Py(t??"")}:${Py(r)}`)}`},bodyParams:{}};const n={};return t&&(n.client_id=t),r&&s!=="none"&&(n.client_secret=r),{headers:{},bodyParams:n}}function Ld(e){const t=e.token_endpoint_auth_method;if(!(e.client_secret&&(!t||t==="none")))return t||"none"}var xy=300,Hg="Authenticated request failed",SE="Token request failed",AD=[SE,Hg];function E7(e){return e.startsWith(`${Hg}: `)}function Ls(e){if(typeof e!="string")return;const t=e.trim();return t||void 0}function Pf(e){return e.replace(/\s+/g," ").trim()}function Bg(e){if(typeof e=="string")return Ls(e);if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,r=Ls(t.error_type),s=Ls(t.error_description),n=Ls(t.error_message)??s??Ls(t.message),i=Ls(t.error);if(r&&n)return Ls(`${r}: ${n}`);if(i&&s)return Ls(`${i}: ${s}`);if(i)return i;const o=t.error;if(o&&typeof o=="object"&&!Array.isArray(o)){const a=Ls(o.message);if(a)return a}return n}function kE(e,t){const r=Pf($n(t.statusText??"",{maxLength:xy})),s=Bg(t.body),n=s?Pf($n(s,{maxLength:xy})):void 0;return`${e}: ${t.status}${r?` ${r}`:""}${n?`: ${n}`:""}`}function Nd(e){return kE(Hg,e)}function $d(e){return kE(SE,e)}function ID(e){for(const t of AD){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 Oy(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 EE(e){const t=e.split(".");return t.length!==3?null:{header:Oy(t[0]),payload:Oy(t[1]),signature:t[2]}}function Bn(e){return EE(e)?.payload??null}function Xe(e){try{return new Date(e*1e3).toLocaleString()}catch{return String(e)}}var T7={isInitiatingAuth:!1,currentStep:"idle",httpHistory:[],infoLogs:[],tokenEndpointAuthMethod:void 0};function Dd(){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 Eo(e,t){return`${e.substring(0,t)}...`}function xf(e){if(typeof e=="string"&&e.trim()!=="")try{return new URL(e).pathname}catch{return`${e} (not an absolute URL)`}return TE(e)}function TE(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 RD(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)??TE(r)}]}function Wp(e,t,r){return e.resourceIndicatorSuppressed?"omitted (emulation)":t.resourceValue(e)||r}function CD(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:xf(e.resourceMetadataUrl)}]:void 0},{id:"received_resource_metadata",label:"Return metadata",description:"Server returns OAuth protected resource metadata",from:"mcpServer",to:"client",details:RD(e)}]}function PD(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 xD(e,t,r){if(r==="cimd")return PD(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:Eo(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:Eo(e.clientId,20)},{label:"Note",value:"Pre-registered (no DCR needed)"},...s]:[{label:"Note",value:"Pre-registered client credentials"}]}]}function Ud(e,t,r){return[...r.includesProtectedResourceMetadata?CD(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:xf(e.authorizationServerMetadata.token_endpoint)},{label:"Auth",value:xf(e.authorizationServerMetadata.authorization_endpoint)}]:void 0},...xD(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:Eo(e.codeChallenge,15)},{label:"method",value:e.codeChallengeMethod||"S256"},{label:"resource",value:Wp(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:Wp(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:Eo(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:Eo(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:Wp(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 ${Eo(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 _e(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 OD(e,t,r,s){return!r||r.source!=="prm"||r.strictClientCompatible&&r.rfc9728Compliant?t:_e({...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 qd(e,t,r,s){return _e({...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 Ur(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 Oi(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 Gt(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 Dt(e,t={}){const r=Gt(e,t);for(const s of Object.keys(r))s.toLowerCase()==="authorization"&&delete r[s];return r}function Vg(e,t,r,s={}){try{const n=new URL(e).origin;return new URL(t,e).origin===n?Gt(r,s):Dt(r,s)}catch{return Dt(r,s)}}function Dn(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 MD(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 Vn(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=new Uint8Array(e);return crypto.getRandomValues(r),Array.from(r,s=>t[s%66]).join("")}async function zd(e){const t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return MD(new Uint8Array(r))}var Fd="Authorization server metadata missing required 'issuer' field",LD=new Set(["2025-03-26"]),ND=new Set(["2025-03-26","2025-06-18"]);function $D(e){return!LD.has(e)}function DD(e){return!ND.has(e)}function AE(e,t){if(DD(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 Gg(e){const t=e.authorizationServers?.find(r=>typeof r=="string"&&r.trim()!=="")?.trim();return t?{authorizationServerUrl:t,substituted:!1}:$D(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 UD="io.modelcontextprotocol/oauth-client-credentials",qD="io.modelcontextprotocol/protocolVersion",zD="io.modelcontextprotocol/clientCapabilities",FD="io.modelcontextprotocol/clientInfo";function Kg(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 IE(e){return e!=="client_credentials"?{}:{extensions:{[UD]:{}}}}function rs(e){return{jsonrpc:"2.0",method:"initialize",params:{protocolVersion:e.protocolVersion,capabilities:IE(e.authMode),clientInfo:{name:e.clientName,version:e.clientVersion}},id:e.id}}function Nl(e){return{jsonrpc:"2.0",method:"tools/list",params:{_meta:{[qD]:e.protocolVersion,[zD]:IE(e.authMode),[FD]:{name:e.clientName,version:e.clientVersion}}},id:e.id}}var jD="***REDACTED***",HD=new Set(["client_secret","registration_access_token","access_token","refresh_token"]),jd="Authorization server metadata does not include a registration_endpoint. Configure a pre-registered client or use a different registration strategy.",Hd="Authorization server metadata does not include a registration_endpoint required for DCR conformance.";function BD(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 Bd(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:Dt(e.customHeaders,{"Content-Type":"application/json"}),body:r}}function Of(e){if(Array.isArray(e))return e.map(Of);if(e&&typeof e=="object"){const t={};for(const[r,s]of Object.entries(e))t[r]=HD.has(r.toLowerCase())?jD:Of(s);return t}return e}function VD(e){return{status:e.status,statusText:e.statusText,headers:{...e.headers},body:Of(e.body)}}function My(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 vu="Configure a pre-registered client or enable DCR on the authorization server.";function A7(e){return/^Dynamic Client Registration failed \(\d{3}\)\./.test(e)}async function tl(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:My(e.httpHistory,c),error:l,fallbackNote:"Client registration failed; using pre-registered client credentials.",errorWithFallbackHint:`${l}. ${vu}`}}const r=VD({status:t.status,statusText:t.statusText,headers:t.headers,body:t.body}),s=My(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} ${vu}`}}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}. ${vu}`}}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 Vd(e){return e?.sendResourceIndicator!==!1}function Gn(e,t){const r=e?.scopeRequest;if(!r)return xx(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 Gd(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 Kn(e,t){return e?.tokenEndpointAuthMethod??t}function GD(e,t){return t?.userAgent?{...e??{},"User-Agent":t.userAgent}:e}function Mi(e,t){return e?.mcpProtocolVersion??t}function KD(e,t){return Ud(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 WD(e){return new URL(e).origin}function Ly(e){return el(e,Zc.legacy).map(({url:t})=>t)}var JD=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:m=!1,strictConformance:f=!1,registrationStrategy:g="dcr",emulation:_}=e,y=o,E=Mi(_,"2025-03-26"),P=Mi(_,Kg("2025-03-26")),I=Vd(_),M=Gd(u??{},_);if(g==="dcr"&&!M.client_name)throw new Error("Dynamic registration metadata must include client_name");const $=()=>r?r():t,O=(C,fe={})=>a({url:C,method:fe.method||"GET",headers:Dn(fe.headers),body:fe.body}),B=C=>{const fe=Md({authorizationServerMetadata:$().authorizationServerMetadata,hasClientSecret:!!(C||m)});if(!fe.ok)throw new Error(fe.message);return fe.method},le=async C=>{const{clientId:fe,clientSecret:X}=await l?.({serverName:i,serverUrl:n})??{};if(!fe)return;const me=B(X),q={"Client ID":fe,"Client Secret":X||m?"Configured":"Not provided (public client)","Token Auth Method":me,Note:C};return{clientId:fe,clientSecret:X||void 0,tokenEndpointAuthMethod:me,infoLogs:_e($(),"received_client_credentials","preregistered-fallback","Pre-registered Client",q)}},ie={state:t,updateState:s,proceedToNextStep:async()=>{const C=$();s({isInitiatingAuth:!0});const fe=X=>{c?.(()=>{ie.proceedToNextStep()},X)};try{switch(C.currentStep){case"idle":s({currentStep:"discovery_start",serverUrl:n,httpHistory:[],isInitiatingAuth:!1}),fe(50);return;case"request_without_token":if(!C.serverUrl)throw new Error("No server URL available");try{const V=await O(C.serverUrl,{method:"POST",headers:Gt(d,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":E}),body:JSON.stringify(rs({protocolVersion:P,authMode:h,clientName:"MCP Inspector",clientVersion:"1.0.0",id:1}))}),pe={status:V.status,statusText:V.statusText,headers:V.headers,body:V.body},ye=[...C.httpHistory||[]];if(ye.length>0){const He=ye[ye.length-1];He.response=pe,He.duration=Date.now()-(He.timestamp||Date.now())}const ke=vd({status:V.status,statusText:V.statusText,wwwAuthenticateHeader:V.headers["www-authenticate"],serverMessage:V.body?.error?.message});if(ke.kind==="challenged"||ke.kind==="anonymous_allowed"){let He=ke.kind==="anonymous_allowed"?_e(C,"discovery_start","optional-auth","Optional Authentication",{message:"Server allows anonymous access",note:"Proceeding with OAuth discovery for authenticated features"}):C.infoLogs;ke.kind==="challenged"&&!ke.specCompliant&&(He=qd(C,He,"discovery_start",pe)),s({currentStep:"discovery_start",lastResponse:pe,httpHistory:ye,infoLogs:He,isInitiatingAuth:!1})}else throw s({lastResponse:pe,httpHistory:ye}),new jn(ke.message,V.status)}catch(V){throw V instanceof jn?V:new Error(`Failed to request MCP server: ${V instanceof Error?V.message:String(V)}`)}break;case"discovery_start":const X=C.serverUrl,me={method:"GET",url:Ly(X)[0],headers:Dt(d,{})};s({currentStep:"request_authorization_server_metadata",authorizationServerUrl:X,lastRequest:me,lastResponse:void 0,httpHistory:[...C.httpHistory||[],{step:"request_authorization_server_metadata",timestamp:Date.now(),request:me}],isInitiatingAuth:!1}),fe(50);return;case"request_authorization_server_metadata":if(!C.authorizationServerUrl)throw new Error("No authorization server URL available");const q=Ly(C.authorizationServerUrl);let ue=null,b=null;for(const V of q)try{const pe=Dt(d,{"MCP-Protocol-Version":"2025-03-26"}),ye=[...C.httpHistory||[]];ye.length>0&&(ye[ye.length-1].request={method:"GET",url:V,headers:pe}),s({lastRequest:{method:"GET",url:V,headers:pe},httpHistory:ye});const ke=await O(V,{method:"GET",headers:pe});if(ke.ok){ue=ke.body,b=ke;break}else if(ke.status>=400&&ke.status<500)continue}catch{continue}if(!ue){const V=WD(C.authorizationServerUrl);ue={issuer:V,authorization_endpoint:`${V}/authorize`,token_endpoint:`${V}/token`,registration_endpoint:`${V}/register`,response_types_supported:["code"],grant_types_supported:["authorization_code","refresh_token"],code_challenge_methods_supported:["S256"]};const pe=_e($(),"received_authorization_server_metadata","fallback-endpoints","Using Fallback Endpoints",{Note:"Metadata discovery failed, using default endpoints per 2025-03-26 spec","Authorization Endpoint":ue.authorization_endpoint,"Token Endpoint":ue.token_endpoint,"Registration Endpoint":ue.registration_endpoint});s({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:ue,infoLogs:pe,isInitiatingAuth:!1});break}if(!ue.issuer)throw new Error(Fd);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 ee={status:b.status,statusText:b.statusText,headers:b.headers,body:ue},ne=[...C.httpHistory||[]];if(ne.length>0){const V=ne[ne.length-1];V.response=ee,V.duration=Date.now()-(V.timestamp||Date.now())}const H=ue.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:ue,lastResponse:ee,httpHistory:ne,isInitiatingAuth:!1});break;case"received_authorization_server_metadata":if(!C.authorizationServerMetadata)throw new Error("No authorization server metadata available");if(g==="preregistered"){const{clientId:V,clientSecret:pe}=await l?.({serverName:i,serverUrl:n})??{};if(!V){s({error:"Pre-registered client ID is required. Please configure OAuth credentials in the server settings.",isInitiatingAuth:!1});return}const ye=B(pe),ke={"Client ID":V,"Client Secret":pe||m?"Configured":"Not provided (public client)","Token Auth Method":ye,Note:"Using pre-registered client credentials (skipped DCR)"},He=_e($(),"received_client_credentials","dcr","Pre-registered Client",ke);s({currentStep:"received_client_credentials",clientId:V,clientSecret:pe||void 0,tokenEndpointAuthMethod:ye,infoLogs:He,isInitiatingAuth:!1})}else if(C.authorizationServerMetadata.registration_endpoint){const V=C.authorizationServerMetadata.scopes_supported,pe=Gn(_,{customScopes:p,supportedScopes:V}),ye=Bd({registrationEndpoint:C.authorizationServerMetadata.registration_endpoint,redirectUri:y,dynamicRegistrationDefaults:M,scope:pe,customHeaders:d});s({currentStep:"request_client_registration",lastRequest:ye,lastResponse:void 0,httpHistory:[...C.httpHistory||[],{step:"request_client_registration",timestamp:Date.now(),request:ye}],isInitiatingAuth:!1}),fe(50);return}else{if(f){s({error:Hd,isInitiatingAuth:!1});return}const V=await le("Authorization server did not advertise registration_endpoint; using pre-registered client credentials.");if(!V){s({error:jd,isInitiatingAuth:!1});return}s({currentStep:"received_client_credentials",clientId:V.clientId,clientSecret:V.clientSecret,tokenEndpointAuthMethod:V.tokenEndpointAuthMethod,infoLogs:V.infoLogs,error:void 0,isInitiatingAuth:!1})}break;case"request_client_registration":if(!C.authorizationServerMetadata?.registration_endpoint)throw new Error("No registration endpoint available");if(!C.lastRequest?.body)throw new Error("No client metadata in request");{const V=await tl({request:C.lastRequest,requestExecutor:a,httpHistory:C.httpHistory});if(V.status!=="registered"){if(s({lastResponse:V.response,httpHistory:V.httpHistory,error:V.error}),f){V.status==="invalid_response"&&s({isInitiatingAuth:!1});return}const ye=await le(V.fallbackNote);if(!ye){s({error:V.errorWithFallbackHint,isInitiatingAuth:!1});return}s({currentStep:"received_client_credentials",clientId:ye.clientId,clientSecret:ye.clientSecret,tokenEndpointAuthMethod:ye.tokenEndpointAuthMethod,infoLogs:ye.infoLogs,error:void 0,isInitiatingAuth:!1});break}if(V.missingClientId){s({lastResponse:V.response,httpHistory:V.httpHistory,error:"Dynamic Client Registration response is missing a client_id.",isInitiatingAuth:!1});return}const pe=_e($(),"received_client_credentials","dcr","Dynamic Client Registration",V.infoLogData);s({currentStep:"received_client_credentials",clientId:V.credentials.clientId,clientSecret:V.credentials.clientSecret,tokenEndpointAuthMethod:Ld(V.clientInfo),lastResponse:V.response,httpHistory:V.httpHistory,infoLogs:pe,error:void 0,isInitiatingAuth:!1})}break;case"received_client_credentials":const R=Vn(43),te=await zd(R),ae=_e($(),"generate_pkce_parameters","pkce-generation","Generate PKCE Parameters (REQUIRED)",{code_challenge:te,method:"S256",...I?{resource:C.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:R,codeChallenge:te,codeChallengeMethod:"S256",...I?{}:{resourceIndicatorSuppressed:!0},state:Vn(16),infoLogs:ae,isInitiatingAuth:!1});break;case"generate_pkce_parameters":if(!C.authorizationServerMetadata?.authorization_endpoint||!C.clientId)throw new Error("Missing authorization endpoint or client ID");const he=new URL(C.authorizationServerMetadata.authorization_endpoint);he.searchParams.set("response_type","code"),he.searchParams.set("client_id",C.clientId),he.searchParams.set("redirect_uri",y),he.searchParams.set("code_challenge",C.codeChallenge||""),he.searchParams.set("code_challenge_method","S256"),he.searchParams.set("state",C.state||""),C.serverUrl&&I&&he.searchParams.set("resource",C.serverUrl);const de=Gn(_,{customScopes:p,supportedScopes:C.authorizationServerMetadata.scopes_supported});de&&he.searchParams.set("scope",de);const Ke=_e($(),"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:Ke,isInitiatingAuth:!1});break;case"authorization_request":s({currentStep:"received_authorization_code",isInitiatingAuth:!1});break;case"received_authorization_code":{if(!C.authorizationCode||C.authorizationCode.trim()===""){s({error:"Authorization code is required. Please paste the code you received from the authorization server.",isInitiatingAuth:!1});return}if(!C.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");const V=Hn({clientId:C.clientId,clientSecret:C.clientSecret,tokenEndpointAuthMethod:Kn(_,C.tokenEndpointAuthMethod)}),pe={grant_type:"authorization_code",code:C.authorizationCode,redirect_uri:y,...V.bodyParams};C.codeVerifier&&(pe.code_verifier=C.codeVerifier),C.serverUrl&&I&&(pe.resource=C.serverUrl);const ye={method:"POST",url:C.authorizationServerMetadata.token_endpoint,headers:{"Content-Type":"application/x-www-form-urlencoded",...V.headers},body:pe};s({currentStep:"token_request",lastRequest:ye,lastResponse:void 0,...I?{}:{resourceIndicatorSuppressed:!0},accessToken:void 0,refreshToken:void 0,httpHistory:[...C.httpHistory||[],{step:"token_request",timestamp:Date.now(),request:ye}],isInitiatingAuth:!1}),fe(50);return}case"token_request":if(!C.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");if(!C.authorizationCode)throw new Error("Missing authorization code");if(!C.codeVerifier)throw new Error("PKCE code_verifier is missing - REQUIRED by 2025-03-26 spec for token exchange");try{const V=Hn({clientId:C.clientId,clientSecret:C.clientSecret,tokenEndpointAuthMethod:Kn(_,C.tokenEndpointAuthMethod)}),pe=new URLSearchParams({grant_type:"authorization_code",code:C.authorizationCode,redirect_uri:y,code_verifier:C.codeVerifier||"",...V.bodyParams});C.serverUrl&&I&&pe.set("resource",C.serverUrl);const ye=await O(C.authorizationServerMetadata.token_endpoint,{method:"POST",headers:{...Dt(d,{"Content-Type":"application/x-www-form-urlencoded"}),...V.headers},body:pe.toString()}),ke={status:ye.status,statusText:ye.statusText,headers:ye.headers,body:ye.body},He=[...C.httpHistory||[]];if(He.length>0){const Ee=He[He.length-1];Ee.response=ke,Ee.duration=Date.now()-(Ee.timestamp||Date.now())}if(!ye.ok){s({lastResponse:ke,httpHistory:He,authorizationCode:void 0,error:$d(ye),isInitiatingAuth:!1});return}const Oe=ye.body;let Le=($().infoLogs||[]).filter(Ee=>Ee.id!=="auth-code"&&Ee.id!=="oauth-tokens"&&Ee.id!=="token");if(C.authorizationCode&&(Le=[...Le,{id:"auth-code",level:"info",step:"received_authorization_code",label:"Authorization Code",data:{code:C.authorizationCode},timestamp:Date.now()}]),Oe.access_token){const Ee={access_token:Oe.access_token};Oe.refresh_token&&(Ee.refresh_token=Oe.refresh_token),Le=[...Le,{id:"oauth-tokens",level:"info",step:"received_access_token",label:"OAuth Tokens",data:Ee,timestamp:Date.now()}]}if(Oe.access_token){const Ee=Bn(Oe.access_token);if(Ee){const Ae={...Ee};Ae.exp&&(Ae.exp=`${Ae.exp} (${Xe(Ae.exp)})`),Ae.iat&&(Ae.iat=`${Ae.iat} (${Xe(Ae.iat)})`),Ae.nbf&&(Ae.nbf=`${Ae.nbf} (${Xe(Ae.nbf)})`);const Ne={...Ae};if(Ae.aud){const tt=C.serverUrl,J=(Array.isArray(Ae.aud)?Ae.aud:[Ae.aud]).some(oe=>oe===tt);Ne._validation={expected_audience:tt,audience_matches:J,note:J?"✓ Token audience matches MCP server":"⚠ Token audience does not match MCP server (security risk)"}}else Ne._validation={note:"⚠ No audience claim found - server should validate token binding"};Le=[...Le,{id:"token",step:"received_access_token",level:"info",label:"Access Token (Decoded JWT)",data:Ne,timestamp:Date.now()}]}}if(Oe.id_token){const Ee=Bn(Oe.id_token);if(Ee){const Ae={...Ee};Ae.exp&&(Ae.exp=`${Ae.exp} (${Xe(Ae.exp)})`),Ae.iat&&(Ae.iat=`${Ae.iat} (${Xe(Ae.iat)})`),Ae.nbf&&(Ae.nbf=`${Ae.nbf} (${Xe(Ae.nbf)})`),Ae.auth_time&&(Ae.auth_time=`${Ae.auth_time} (${Xe(Ae.auth_time)})`),Ae._note="OIDC ID Token - Used for user identity verification",Le=[...Le,{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:Oe.access_token,refreshToken:Oe.refresh_token,tokenType:Oe.token_type||"Bearer",expiresIn:Oe.expires_in,lastResponse:ke,httpHistory:He,infoLogs:Le,error:void 0,isInitiatingAuth:!1})}catch(V){const pe={status:0,statusText:"Network Error",headers:{},body:{error:V instanceof Error?V.message:String(V)}},ye=[...C.httpHistory||[]];if(ye.length>0){const ke=ye[ye.length-1];ke.response=pe,ke.duration=Date.now()-(ke.timestamp||Date.now())}s({lastResponse:pe,httpHistory:ye,error:`Token exchange failed: ${V instanceof Error?V.message:String(V)}`,isInitiatingAuth:!1})}break;case"received_access_token":if(!C.serverUrl||!C.accessToken)throw new Error("Missing server URL or access token");const Ge={method:"POST",url:C.serverUrl,headers:{Authorization:`Bearer ${C.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream"},body:rs({protocolVersion:P,authMode:h,clientName:"MCP Inspector",clientVersion:"1.0.0",id:2})},Pe=_e($(),"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:C.serverUrl});s({currentStep:"authenticated_mcp_request",lastRequest:Ge,lastResponse:void 0,httpHistory:[...C.httpHistory||[],{step:"authenticated_mcp_request",timestamp:Date.now(),request:Ge}],infoLogs:Pe,isInitiatingAuth:!1}),fe(50);return;case"authenticated_mcp_request":if(!C.serverUrl||!C.accessToken)throw new Error("Missing server URL or access token");try{const V=await O(C.serverUrl,{method:"POST",headers:Gt(d,{Authorization:`Bearer ${C.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream"}),body:JSON.stringify(rs({protocolVersion:P,authMode:h,clientName:"MCP Inspector",clientVersion:"1.0.0",id:2}))}),pe={status:V.status,statusText:V.statusText,headers:V.headers,body:V.body},ye=[...C.httpHistory||[]];if(ye.length>0){const Ee=ye[ye.length-1];Ee.response=pe,Ee.duration=Date.now()-(Ee.timestamp||Date.now())}if(!V.ok){if(V.status>=400&&V.status<500)try{const Ee={method:"GET",url:C.serverUrl,headers:{Authorization:`Bearer ${C.accessToken}`,Accept:"text/event-stream"}},Ae={step:"complete",timestamp:Date.now(),request:Ee};ye.push(Ae);const Ne=await O(C.serverUrl,{method:"GET",headers:{Authorization:`Bearer ${C.accessToken}`,Accept:"text/event-stream"}});Ae.response={status:Ne.status,statusText:Ne.statusText,headers:Ne.headers,body:Ne.body},Ae.duration=Date.now()-Ae.timestamp;const tt=Ne.body;if(tt&&typeof tt=="object"&&tt.isOldTransport&&tt.endpoint){const J=tt.endpoint,oe=new URL(J,C.serverUrl).toString(),A=_e($(),"authenticated_mcp_request","http-sse-detected","HTTP+SSE Transport Detected (2024-11-05)",{Transport:"HTTP+SSE (2024-11-05 - Deprecated)","SSE Stream URL":C.serverUrl,"POST Endpoint":oe,"First Event":tt.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: "+oe});s({currentStep:"complete",lastResponse:{status:Ne.status,statusText:"OK - HTTP+SSE Transport",headers:Ne.headers,body:{transport:"HTTP+SSE (2024-11-05)",sseStreamUrl:C.serverUrl,postEndpoint:oe,events:tt.events}},httpHistory:ye,infoLogs:A,error:void 0,isInitiatingAuth:!1});return}}catch(Ee){console.error("GET fallback failed:",Ee)}s({lastResponse:pe,httpHistory:ye,error:Nd(V),isInitiatingAuth:!1});return}let ke=$().infoLogs||[];const He=V.headers["content-type"]||"",Oe=He.includes("text/event-stream");let Le=null;if(Oe&&V.body?.transport==="sse"?Le=V.body.mcpResponse:Le=V.body,Oe&&Le?.result?.protocolVersion){const Ee={Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Protocol Version":Le.result.protocolVersion};Le.result.serverInfo&&(Ee["Server Name"]=Le.result.serverInfo.name,Ee["Server Version"]=Le.result.serverInfo.version),Le.result.capabilities&&(Ee.Capabilities=Le.result.capabilities),ke=_e($(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",Ee)}else if(Oe)ke=_e($(),"authenticated_mcp_request","mcp-transport","MCP Transport Detected",{Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Content-Type":He,Note:"Server returned streaming response. Initialize response delivered via SSE stream.",Events:V.body?.events?`${V.body.events.length} events parsed`:"No events parsed"});else if(Le?.result?.protocolVersion){const Ee={Transport:"Streamable HTTP","Response Format":"JSON","Protocol Version":Le.result.protocolVersion};Le.result.serverInfo&&(Ee["Server Name"]=Le.result.serverInfo.name,Ee["Server Version"]=Le.result.serverInfo.version),Le.result.capabilities&&(Ee.Capabilities=Le.result.capabilities),ke=_e($(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",Ee)}s({currentStep:"complete",lastResponse:pe,httpHistory:ye,infoLogs:ke,error:void 0,isInitiatingAuth:!1})}catch(V){const pe=Ur(V),ye={status:0,statusText:"Network Error",headers:{},body:{error:pe.message,details:pe.details}},ke=[...C.httpHistory||[]];if(ke.length>0){const Le={...ke[ke.length-1],response:ye,duration:Date.now()-(ke[ke.length-1]?.timestamp||Date.now()),error:pe};ke[ke.length-1]=Le}const He=$(),Oe=_e(He,"authenticated_mcp_request",`error-authenticated_mcp_request-${Date.now()}`,"Authenticated MCP request failed",{request:He.lastRequest,error:pe},{level:"error",error:pe});s({lastResponse:ye,httpHistory:ke,infoLogs:Oe,error:`Authenticated MCP request failed: ${pe.message}`,isInitiatingAuth:!1})}break;case"complete":s({isInitiatingAuth:!1});break;default:s({isInitiatingAuth:!1})}}catch(X){const me=$(),q=Ur(X),ue=_e(me,me.currentStep,`error-${me.currentStep}-${Date.now()}`,"Step failed",{step:me.currentStep,request:me.lastRequest,response:me.lastResponse,error:q},{level:"error",error:q}),b=Oi(me.httpHistory,q),ee={error:q.message,infoLogs:ue,isInitiatingAuth:!1};b&&(ee.httpHistory=b),s(ee)}},startGuidedFlow:async()=>{s({currentStep:"idle",isInitiatingAuth:!1})},resetFlow:()=>{s(Dd())}};return ie};function Wg(e){return uD(e)[0]}var Ny="Could not discover authorization server metadata.",YD=new Set(["OAuthOutboundUrlBlockedError","OAuthRedactedCredentialError"]);function Jg(e){return e instanceof Error&&YD.has(e.name)}function $y(e,t){if(e){for(const[r,s]of Object.entries(e))if(r.toLowerCase()===t)return s}}function XD(e){return e==null?!0:typeof e=="string"?e.trim()==="":typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0}function Yg(e,t){const{status:r,body:s}=t;if(r>=200&&r<300){if(XD(s))return{kind:"attempt",attempt:{url:e,status:r}};if(typeof s=="object"&&!Array.isArray(s))return{kind:"document",document:s};const n=$y(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=$y(t.headers,"location");if(n)return{kind:"attempt",attempt:{url:e,status:r,location:n}}}return{kind:"attempt",attempt:{url:e,status:r}}}function QD(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 Xg(e){return e.length===0?`${Ny} No well-known URL was tried.`:`${Ny} ${e.map(QD).join("; ")}.`}function ua(e,t){return cD({serverUrl:e.serverUrl??t,prmResource:e.resourceMetadata?.resource,resolved:e.resourceIndicator})}function Qg(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:Cf({serverUrl:t}),infoLogs:_e({...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=Cf({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:OD(e.state,e.infoLogs,s,t)}}var ZD=e=>ua(e);function eU(e,t){return Ud(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:ZD})}function Dy(e){return el(e,Zc.legacy).map(({url:t})=>t)}var tU=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:m,hasClientSecret:f=!1,strictConformance:g=!1,resourceIndicatorEnforcement:_="warn",requiredMetadataEnforcement:y="reject",registrationStrategy:E="dcr",emulation:P}=e,I=o,M=Mi(P,"2025-06-18"),$=Mi(P,Kg("2025-06-18")),O=Vd(P),B=Gd(u??{},P);if(E==="dcr"&&!B.client_name)throw new Error("Dynamic registration metadata must include client_name");const le=()=>r?r():t,ie=()=>ua(le(),n),C=(q,ue={})=>a({url:q,method:ue.method||"GET",headers:Dn(ue.headers),body:ue.body}),fe=q=>{const ue=Md({authorizationServerMetadata:le().authorizationServerMetadata,hasClientSecret:!!(q||f)});if(!ue.ok)throw new Error(ue.message);return ue.method},X=async q=>{const{clientId:ue,clientSecret:b}=await l?.({serverName:i,serverUrl:n})??{};if(!ue)return;const ee=fe(b),ne={"Client ID":ue,"Client Secret":b||f?"Configured":"Not provided (public client)","Token Auth Method":ee,Note:q};return{clientId:ue,clientSecret:b||void 0,tokenEndpointAuthMethod:ee,infoLogs:_e(le(),"received_client_credentials","preregistered-fallback","Pre-registered Client",ne)}},me={state:t,updateState:s,proceedToNextStep:async()=>{const q=le();s({isInitiatingAuth:!0});const ue=b=>{c?.(()=>{me.proceedToNextStep()},b)};try{switch(q.currentStep){case"idle":{const J=Gt(d,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":M}),oe=rs({protocolVersion:$,authMode:m,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}),A={method:"POST",url:n,headers:J,body:oe};s({currentStep:"request_without_token",serverUrl:n,lastRequest:A,lastResponse:void 0,httpHistory:[...q.httpHistory||[],{step:"request_without_token",timestamp:Date.now(),request:A}],isInitiatingAuth:!1}),ue(50);return}case"request_without_token":if(!q.serverUrl)throw new Error("No server URL available");try{const J=await C(q.serverUrl,{method:"POST",headers:Gt(d,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":M}),body:JSON.stringify(rs({protocolVersion:$,authMode:m,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}))}),oe={status:J.status,statusText:J.statusText,headers:J.headers,body:J.body},A=[...q.httpHistory||[]];if(A.length>0){const T=A[A.length-1];T.response=oe,T.duration=Date.now()-(T.timestamp||Date.now())}const v=vd({status:J.status,statusText:J.statusText,wwwAuthenticateHeader:J.headers["www-authenticate"],serverMessage:J.body?.error?.message});if(v.kind==="challenged"){const T=J.headers["www-authenticate"],k=Zs(T),x=rg(k.scope);let F=T?_e(q,"received_401_unauthorized","www-authenticate","WWW-Authenticate Header",{header:T,...x&&x.length>0?{scope:x.join(" ")}:{},"Received from":q.serverUrl||"Unknown"}):q.infoLogs;v.specCompliant||(F=qd(q,F,"received_401_unauthorized",oe)),s({currentStep:"received_401_unauthorized",wwwAuthenticateHeader:T||void 0,challengedScopes:x,lastResponse:oe,httpHistory:A,infoLogs:F,isInitiatingAuth:!1})}else if(v.kind==="anonymous_allowed"){const T=_e(q,"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:oe,httpHistory:A,infoLogs:T,isInitiatingAuth:!1})}else throw s({lastResponse:oe,httpHistory:A}),new jn(v.message,J.status)}catch(J){throw J instanceof jn?J:new Error(`Failed to request MCP server: ${J instanceof Error?J.message:String(J)}`)}break;case"received_401_unauthorized":{const J=Zs(q.wwwAuthenticateHeader);let oe=h||J.resource_metadata;if(!oe&&q.serverUrl&&(oe=Wg(q.serverUrl)),!oe)throw new Error("Could not determine resource metadata URL");const A={method:"GET",url:oe,headers:Gt(d,{})};s({currentStep:"request_resource_metadata",resourceMetadataUrl:oe,lastRequest:A,lastResponse:void 0,httpHistory:[...q.httpHistory||[],{step:"request_resource_metadata",timestamp:Date.now(),request:A}],isInitiatingAuth:!1}),ue(50);return}case"request_resource_metadata":if(!q.serverUrl)throw new Error("No server URL available");const b=[...q.httpHistory||[]];let ee=b.length>0&&b[b.length-1]?.step==="request_resource_metadata"&&!b[b.length-1]?.response?b.pop():void 0;const ne=[],H=J=>{if(!J)return{};if(J instanceof Headers){const oe={};return J.forEach((A,v)=>{oe[v]=A}),oe}return Array.isArray(J)?Object.fromEntries(J):Object.fromEntries(Object.entries(J).map(([oe,A])=>[oe,String(A)]))},R=async(J,oe={})=>{const A=typeof J=="string"?J:J.toString(),v=Vg(n,A,d,H(oe.headers)),T=ee?{...ee,timestamp:Date.now(),request:{method:oe.method||"GET",url:A,headers:v,body:oe.body}}:{step:"request_resource_metadata",timestamp:Date.now(),request:{method:oe.method||"GET",url:A,headers:v,body:oe.body}};ee=void 0,ne.push(T);try{const k=await C(A,{method:oe.method||"GET",headers:v,body:oe.body});T.response={status:k.status,statusText:k.statusText,headers:k.headers,body:k.body},T.duration=Date.now()-T.timestamp;const x={status:k.status,statusText:k.statusText,headers:k.headers},F=typeof k.body=="string"?k.body:JSON.stringify(k.body??{});return new Response(F,x)}catch(k){throw T.error=Ur(k),T.duration=Date.now()-T.timestamp,k}};try{const J=(h||Zs(q.wwwAuthenticateHeader).resource_metadata)&&q.resourceMetadataUrl?{resourceMetadataUrl:q.resourceMetadataUrl}:void 0,oe=await Od(q.serverUrl,J,R),A=[...b,...ne],v=ne[ne.length-1],T=Gg({authorizationServers:oe.authorization_servers,fallbackServerUrl:n,protocolVersion:"2025-06-18"}),k=T.authorizationServerUrl;if(T.error&&y!=="observe"){s({resourceMetadata:oe,resourceMetadataUrl:v?.request?.url||q.resourceMetadataUrl,lastRequest:v?.request,lastResponse:v?.response,httpHistory:A,error:T.error,isInitiatingAuth:!1});return}let x=q.infoLogs??[];T.error&&(x=_e({...le(),infoLogs:x},"received_resource_metadata","authorization-server-substituted","Derived: Authorization Server (not advertised)",{Finding:T.error,"Using instead":k}));const{resourceIndicator:F,infoLogs:z}=Qg({state:q,fallbackServerUrl:n,prmResource:oe.resource,enforcement:_,infoLogs:x});s({currentStep:"received_resource_metadata",resourceMetadata:oe,resourceIndicator:F,resourceMetadataUrl:v?.request?.url||q.resourceMetadataUrl,authorizationServerUrl:k,lastRequest:v?.request,lastResponse:v?.response,httpHistory:A,infoLogs:z,isInitiatingAuth:!1})}catch(J){const oe=Oi([...b,...ne],Ur(J));throw s({lastResponse:ne[ne.length-1]?.response,httpHistory:oe}),new Error(xd(J))}break;case"received_resource_metadata":if(!q.authorizationServerUrl)throw new Error("No authorization server URL available");const te={method:"GET",url:Dy(q.authorizationServerUrl)[0],headers:Dt(d,{})};s({currentStep:"request_authorization_server_metadata",lastRequest:te,lastResponse:void 0,httpHistory:[...q.httpHistory||[],{step:"request_authorization_server_metadata",timestamp:Date.now(),request:te}],isInitiatingAuth:!1}),ue(50);return;case"request_authorization_server_metadata":if(!q.authorizationServerUrl)throw new Error("No authorization server URL available");const ae=Dy(q.authorizationServerUrl);let he=null;const de=[];let Ke={},Ge=null;for(const J of ae)try{const oe=Dt(d,{}),A=[...q.httpHistory||[]];A.length>0&&(A[A.length-1].request={method:"GET",url:J,headers:oe}),s({lastRequest:{method:"GET",url:J,headers:oe},httpHistory:A});const v=await C(J,{method:"GET",headers:Dt(d,{})}),T=Yg(J,v);if(T.kind==="document"){he=T.document,Ke=v.headers,Ge=v;break}de.push(T.attempt)}catch(oe){if(Jg(oe))throw oe;de.push({url:J,error:oe});continue}if(!he||!Ge)throw new Error(Xg(de));if(!he.issuer)throw new Error(Fd);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 Pe={status:Ge.status,statusText:Ge.statusText,headers:Ke,body:he},V=[...q.httpHistory||[]];V.length>0&&(V[V.length-1].response=Pe);const pe=he.code_challenge_methods_supported||[];pe.includes("S256")?s({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:he,lastResponse:Pe,httpHistory:V,isInitiatingAuth:!1}):(console.warn("Authorization server may not support S256 PKCE method. Supported methods:",pe),s({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:he,lastResponse:Pe,httpHistory:V,error:"Warning: Authorization server may not support S256 PKCE method",isInitiatingAuth:!1}));break;case"received_authorization_server_metadata":if(!q.authorizationServerMetadata)throw new Error("No authorization server metadata available");if(E==="preregistered"){const{clientId:J,clientSecret:oe}=await l?.({serverName:i,serverUrl:n})??{};if(!J){s({error:"Pre-registered client ID is required. Please configure OAuth credentials in the server settings.",isInitiatingAuth:!1});return}const A=fe(oe),v={"Client ID":J,"Client Secret":oe||f?"Configured":"Not provided (public client)","Token Auth Method":A,Note:"Using pre-registered client credentials from server config (skipped DCR)"},T=_e(le(),"received_client_credentials","dcr","Pre-registered Client",v);s({currentStep:"received_client_credentials",clientId:J,clientSecret:oe||void 0,tokenEndpointAuthMethod:A,infoLogs:T,isInitiatingAuth:!1})}else if(q.authorizationServerMetadata.registration_endpoint){const J=q.resourceMetadata?.scopes_supported||q.authorizationServerMetadata.scopes_supported,oe=Gn(P,{customScopes:p,challengedScopes:q.challengedScopes,supportedScopes:J}),A=Bd({registrationEndpoint:q.authorizationServerMetadata.registration_endpoint,redirectUri:I,dynamicRegistrationDefaults:B,scope:oe,customHeaders:d});s({currentStep:"request_client_registration",lastRequest:A,lastResponse:void 0,httpHistory:[...q.httpHistory||[],{step:"request_client_registration",timestamp:Date.now(),request:A}],isInitiatingAuth:!1}),ue(50);return}else{if(g){s({error:Hd,isInitiatingAuth:!1});return}const J=await X("Authorization server did not advertise registration_endpoint; using pre-registered client credentials.");if(!J){s({error:jd,isInitiatingAuth:!1});return}s({currentStep:"received_client_credentials",clientId:J.clientId,clientSecret:J.clientSecret,tokenEndpointAuthMethod:J.tokenEndpointAuthMethod,infoLogs:J.infoLogs,error:void 0,isInitiatingAuth:!1})}break;case"request_client_registration":{if(!q.authorizationServerMetadata?.registration_endpoint)throw new Error("No registration endpoint available");if(!q.lastRequest?.body)throw new Error("No client metadata in request");const J=await tl({request:q.lastRequest,requestExecutor:a,httpHistory:q.httpHistory});if(J.status!=="registered"){if(s({lastResponse:J.response,httpHistory:J.httpHistory,error:J.error}),g){J.status==="invalid_response"&&s({isInitiatingAuth:!1});return}const A=await X(J.fallbackNote);if(!A){s({error:J.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(J.missingClientId){s({lastResponse:J.response,httpHistory:J.httpHistory,error:"Dynamic Client Registration response is missing a client_id.",isInitiatingAuth:!1});return}const oe=_e(le(),"received_client_credentials","dcr","Dynamic Client Registration",J.infoLogData);s({currentStep:"received_client_credentials",clientId:J.credentials.clientId,clientSecret:J.credentials.clientSecret,tokenEndpointAuthMethod:Ld(J.clientInfo),lastResponse:J.response,httpHistory:J.httpHistory,infoLogs:oe,error:void 0,isInitiatingAuth:!1});break}case"received_client_credentials":const ye=Vn(43),ke=await zd(ye),He=_e(le(),"generate_pkce_parameters","pkce-generation","Generate PKCE Parameters",{code_challenge:ke,method:"S256",...O?{resource:ie()||"Unknown"}:{resource:"(omitted — emulated client does not send RFC 8707 resource)"}});s({currentStep:"generate_pkce_parameters",codeVerifier:ye,codeChallenge:ke,codeChallengeMethod:"S256",...O?{}:{resourceIndicatorSuppressed:!0},state:Vn(16),infoLogs:He,isInitiatingAuth:!1});break;case"generate_pkce_parameters":if(!q.authorizationServerMetadata?.authorization_endpoint||!q.clientId)throw new Error("Missing authorization endpoint or client ID");const Oe=new URL(q.authorizationServerMetadata.authorization_endpoint);Oe.searchParams.set("response_type","code"),Oe.searchParams.set("client_id",q.clientId),Oe.searchParams.set("redirect_uri",I),Oe.searchParams.set("code_challenge",q.codeChallenge||""),Oe.searchParams.set("code_challenge_method","S256"),Oe.searchParams.set("state",q.state||"");const Le=ie();Le&&O&&Oe.searchParams.set("resource",Le);const Ee=Gn(P,{customScopes:p,challengedScopes:q.challengedScopes,supportedScopes:q.resourceMetadata?.scopes_supported||q.authorizationServerMetadata.scopes_supported});Ee&&Oe.searchParams.set("scope",Ee);const Ae=_e(le(),"authorization_request","auth-url","Authorization URL",{url:Oe.toString()});s({currentStep:"authorization_request",authorizationUrl:Oe.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(!q.authorizationCode||q.authorizationCode.trim()===""){s({error:"Authorization code is required. Please paste the code you received from the authorization server.",isInitiatingAuth:!1});return}if(!q.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");const J=Hn({clientId:q.clientId,clientSecret:q.clientSecret,tokenEndpointAuthMethod:Kn(P,q.tokenEndpointAuthMethod)}),oe={grant_type:"authorization_code",code:q.authorizationCode,redirect_uri:I,...J.bodyParams};q.codeVerifier&&(oe.code_verifier=q.codeVerifier);const A=ie();A&&O&&(oe.resource=A);const v={method:"POST",url:q.authorizationServerMetadata.token_endpoint,headers:{"Content-Type":"application/x-www-form-urlencoded",...J.headers},body:oe};s({currentStep:"token_request",lastRequest:v,lastResponse:void 0,...O?{}:{resourceIndicatorSuppressed:!0},accessToken:void 0,refreshToken:void 0,httpHistory:[...q.httpHistory||[],{step:"token_request",timestamp:Date.now(),request:v}],isInitiatingAuth:!1}),ue(50);return}case"token_request":if(!q.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");if(!q.authorizationCode)throw new Error("Missing authorization code");if(!q.codeVerifier)throw new Error("PKCE code_verifier is missing - cannot exchange token");try{const J=Hn({clientId:q.clientId,clientSecret:q.clientSecret,tokenEndpointAuthMethod:Kn(P,q.tokenEndpointAuthMethod)}),oe=new URLSearchParams({grant_type:"authorization_code",code:q.authorizationCode,redirect_uri:I,code_verifier:q.codeVerifier||"",...J.bodyParams}),A=ie();A&&O&&oe.set("resource",A);const v=await C(q.authorizationServerMetadata.token_endpoint,{method:"POST",headers:{...Dt(d,{"Content-Type":"application/x-www-form-urlencoded"}),...J.headers},body:oe.toString()}),T={status:v.status,statusText:v.statusText,headers:v.headers,body:v.body},k=[...q.httpHistory||[]];if(k.length>0){const z=k[k.length-1];z.response=T,z.duration=Date.now()-(z.timestamp||Date.now())}if(!v.ok){s({lastResponse:T,httpHistory:k,authorizationCode:void 0,error:$d(v),isInitiatingAuth:!1});return}const x=v.body;let F=(le().infoLogs||[]).filter(z=>z.id!=="auth-code"&&z.id!=="oauth-tokens"&&z.id!=="token");if(q.authorizationCode&&(F=[...F,{id:"auth-code",step:"token_request",level:"info",label:"Authorization Code",data:{code:q.authorizationCode},timestamp:Date.now()}]),x.access_token){const z={access_token:x.access_token};x.refresh_token&&(z.refresh_token=x.refresh_token),F=[...F,{id:"oauth-tokens",step:"token_request",level:"info",label:"OAuth Tokens",data:z,timestamp:Date.now()}]}if(x.access_token){const z=Bn(x.access_token);if(z){const L={...z};L.exp&&(L.exp=`${L.exp} (${Xe(L.exp)})`),L.iat&&(L.iat=`${L.iat} (${Xe(L.iat)})`),L.nbf&&(L.nbf=`${L.nbf} (${Xe(L.nbf)})`);const G={...L};if(L.aud){const K=q.serverUrl,Ie=(Array.isArray(L.aud)?L.aud:[L.aud]).some(Ue=>Ue===K);G._validation={expected_audience:K,audience_matches:Ie,note:Ie?"✓ Token audience matches MCP server":"⚠ Token audience does not match MCP server (security risk)"}}else G._validation={note:"⚠ No audience claim found - server should validate token binding"};F=[...F,{id:"token",step:"token_request",level:"info",label:"Access Token (Decoded JWT)",data:G,timestamp:Date.now()}]}}if(x.id_token){const z=Bn(x.id_token);if(z){const L={...z};L.exp&&(L.exp=`${L.exp} (${Xe(L.exp)})`),L.iat&&(L.iat=`${L.iat} (${Xe(L.iat)})`),L.nbf&&(L.nbf=`${L.nbf} (${Xe(L.nbf)})`),L.auth_time&&(L.auth_time=`${L.auth_time} (${Xe(L.auth_time)})`),L._note="OIDC ID Token - Used for user identity verification",F=[...F,{id:"id-token",step:"token_request",level:"info",label:"ID Token (OIDC - Decoded JWT)",data:L,timestamp:Date.now()}]}}s({currentStep:"received_access_token",accessToken:x.access_token,refreshToken:x.refresh_token,tokenType:x.token_type||"Bearer",expiresIn:x.expires_in,lastResponse:T,httpHistory:k,infoLogs:F,error:void 0,isInitiatingAuth:!1})}catch(J){const oe={status:0,statusText:"Network Error",headers:{},body:{error:J instanceof Error?J.message:String(J)}},A=[...q.httpHistory||[]];if(A.length>0){const v=A[A.length-1];v.response=oe,v.duration=Date.now()-(v.timestamp||Date.now())}s({lastResponse:oe,httpHistory:A,error:`Token exchange failed: ${J instanceof Error?J.message:String(J)}`,isInitiatingAuth:!1})}break;case"received_access_token":if(!q.serverUrl||!q.accessToken)throw new Error("Missing server URL or access token");const Ne={method:"POST",url:q.serverUrl,headers:{Authorization:`Bearer ${q.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":M},body:rs({protocolVersion:$,authMode:m,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2})},tt=_e(le(),"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:q.serverUrl});s({currentStep:"authenticated_mcp_request",lastRequest:Ne,lastResponse:void 0,httpHistory:[...q.httpHistory||[],{step:"authenticated_mcp_request",timestamp:Date.now(),request:Ne}],infoLogs:tt,isInitiatingAuth:!1}),ue(50);return;case"authenticated_mcp_request":if(!q.serverUrl||!q.accessToken)throw new Error("Missing server URL or access token");try{const J=await C(q.serverUrl,{method:"POST",headers:Gt(d,{Authorization:`Bearer ${q.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":M}),body:JSON.stringify(rs({protocolVersion:$,authMode:m,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2}))}),oe={status:J.status,statusText:J.statusText,headers:J.headers,body:J.body},A=[...q.httpHistory||[]];if(A.length>0){const F=A[A.length-1];F.response=oe,F.duration=Date.now()-(F.timestamp||Date.now())}if(!J.ok){s({lastResponse:oe,httpHistory:A,error:Nd(J),isInitiatingAuth:!1});return}let v=le().infoLogs||[];const T=J.headers["content-type"]||"",k=T.includes("text/event-stream");let x=null;if(k&&J.body?.transport==="sse"?x=J.body.mcpResponse:x=J.body,k&&x?.result?.protocolVersion){const F={Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Protocol Version":x.result.protocolVersion};x.result.serverInfo&&(F["Server Name"]=x.result.serverInfo.name,F["Server Version"]=x.result.serverInfo.version),x.result.capabilities&&(F.Capabilities=x.result.capabilities),v=_e(le(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",F)}else if(k)v=_e(le(),"authenticated_mcp_request","mcp-transport","MCP Transport Detected",{Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Content-Type":T,Note:"Server returned streaming response. Initialize response delivered via SSE stream.",Events:J.body?.events?`${J.body.events.length} events parsed`:"No events parsed"});else if(x?.result?.protocolVersion){const F={Transport:"Streamable HTTP","Response Format":"JSON","Protocol Version":x.result.protocolVersion};x.result.serverInfo&&(F["Server Name"]=x.result.serverInfo.name,F["Server Version"]=x.result.serverInfo.version),x.result.capabilities&&(F.Capabilities=x.result.capabilities),v=_e(le(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",F)}s({currentStep:"complete",lastResponse:oe,httpHistory:A,infoLogs:v,error:void 0,isInitiatingAuth:!1})}catch(J){const oe=Ur(J),A={status:0,statusText:"Network Error",headers:{},body:{error:oe.message,details:oe.details}},v=[...q.httpHistory||[]];if(v.length>0){const x={...v[v.length-1],response:A,duration:Date.now()-(v[v.length-1]?.timestamp||Date.now()),error:oe};v[v.length-1]=x}const T=le(),k=_e(T,"authenticated_mcp_request",`error-authenticated_mcp_request-${Date.now()}`,"Authenticated MCP request failed",{request:T.lastRequest,error:oe},{level:"error",error:oe});s({lastResponse:A,httpHistory:v,infoLogs:k,error:`Authenticated MCP request failed: ${oe.message}`,isInitiatingAuth:!1})}break;case"complete":s({isInitiatingAuth:!1});break;default:s({isInitiatingAuth:!1})}}catch(b){const ee=le(),ne=Ur(b),H=_e(ee,ee.currentStep,`error-${ee.currentStep}-${Date.now()}`,"Step failed",{step:ee.currentStep,request:ee.lastRequest,response:ee.lastResponse,error:ne},{level:"error",error:ne}),R=Oi(ee.httpHistory,ne),te={error:ne.message,infoLogs:H,isInitiatingAuth:!1};R&&(te.httpHistory=R),s(te)}},startGuidedFlow:async()=>{s({currentStep:"idle",isInitiatingAuth:!1})},resetFlow:()=>{s(Dd())}};return me};function Kd(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 rU(e){try{const{protocol:t,hostname:r}=new URL(e);return t==="http:"&&Kd(r)}catch{return!1}}function Zg(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:"&&Kd(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 sU=e=>ua(e);function nU(e,t){return Ud(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)
|
|
132
|
+
Include resource parameter`,description:"Client generates code verifier and challenge (REQUIRED), includes resource parameter"},resourceValue:sU})}function Uy(e){return el(e,Zc.current).map(({url:t})=>t)}var iU=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:m,authMode:f,hasClientSecret:g=!1,strictConformance:_=!1,resourceIndicatorEnforcement:y="warn",requiredMetadataEnforcement:E="reject",registrationStrategy:P="cimd",emulation:I}=e,M=o,$=Mi(I,"2025-11-25"),O=Mi(I,Kg("2025-11-25")),B=Vd(I),le=Gd(u??{},I);let ie=p??"";if(P==="dcr"&&!le.client_name)throw new Error("Dynamic registration metadata must include client_name");if(P==="cimd"&&!ie)throw new Error("Client ID metadata URL is required for CIMD registration");P==="cimd"&&(ie=Zg(ie));const C=()=>r?r():t,fe=()=>ua(C(),n),X=(b,ee={})=>a({url:b,method:ee.method||"GET",headers:Dn(ee.headers),body:ee.body}),me=b=>{const ee=Md({authorizationServerMetadata:C().authorizationServerMetadata,hasClientSecret:!!(b||g)});if(!ee.ok)throw new Error(ee.message);return ee.method},q=async b=>{const{clientId:ee,clientSecret:ne}=await l?.({serverName:i,serverUrl:n})??{};if(!ee)return;const H=me(ne),R={"Client ID":ee,"Client Secret":ne||g?"Configured":"Not provided (public client)","Token Auth Method":H,Note:b};return{clientId:ee,clientSecret:ne||void 0,tokenEndpointAuthMethod:H,infoLogs:_e(C(),"received_client_credentials","preregistered-fallback","Pre-registered Client",R)}},ue={state:t,updateState:s,proceedToNextStep:async()=>{const b=C();s({isInitiatingAuth:!0});const ee=ne=>{c?.(()=>{ue.proceedToNextStep()},ne)};try{switch(b.currentStep){case"idle":{const v=Gt(h,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":$}),T=rs({protocolVersion:O,authMode:f,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}),k={method:"POST",url:n,headers:v,body:T};s({currentStep:"request_without_token",serverUrl:n,lastRequest:k,lastResponse:void 0,httpHistory:[...b.httpHistory||[],{step:"request_without_token",timestamp:Date.now(),request:k}],isInitiatingAuth:!1}),ee(50);return}case"request_without_token":if(!b.serverUrl)throw new Error("No server URL available");try{const v=await X(b.serverUrl,{method:"POST",headers:Gt(h,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":$}),body:JSON.stringify(rs({protocolVersion:O,authMode:f,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}))}),T={status:v.status,statusText:v.statusText,headers:v.headers,body:v.body},k=[...b.httpHistory||[]];if(k.length>0){const F=k[k.length-1];F.response=T,F.duration=Date.now()-(F.timestamp||Date.now())}const x=vd({status:v.status,statusText:v.statusText,wwwAuthenticateHeader:v.headers["www-authenticate"],serverMessage:v.body?.error?.message});if(x.kind==="challenged"){const F=v.headers["www-authenticate"],z=Zs(F),L=rg(z.scope);let G=F?_e(b,"received_401_unauthorized","www-authenticate","WWW-Authenticate Header",{header:F,...L&&L.length>0?{scope:L.join(" ")}:{},"Received from":b.serverUrl||"Unknown"}):b.infoLogs;x.specCompliant||(G=qd(b,G,"received_401_unauthorized",T)),s({currentStep:"received_401_unauthorized",wwwAuthenticateHeader:F||void 0,challengedScopes:L,lastResponse:T,httpHistory:k,infoLogs:G,isInitiatingAuth:!1})}else if(x.kind==="anonymous_allowed"){const F=_e(b,"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:T,httpHistory:k,infoLogs:F,isInitiatingAuth:!1})}else throw s({lastResponse:T,httpHistory:k}),new jn(x.message,v.status)}catch(v){throw v instanceof jn?v:new Error(`Failed to request MCP server: ${v instanceof Error?v.message:String(v)}`)}break;case"received_401_unauthorized":{const v=Zs(b.wwwAuthenticateHeader);let T=m||v.resource_metadata;if(!T&&b.serverUrl&&(T=Wg(b.serverUrl)),!T)throw new Error("Could not determine resource metadata URL");const k={method:"GET",url:T,headers:Gt(h,{})};s({currentStep:"request_resource_metadata",resourceMetadataUrl:T,lastRequest:k,lastResponse:void 0,httpHistory:[...b.httpHistory||[],{step:"request_resource_metadata",timestamp:Date.now(),request:k}],isInitiatingAuth:!1}),ee(50);return}case"request_resource_metadata":if(!b.serverUrl)throw new Error("No server URL available");const ne=[...b.httpHistory||[]];let H=ne.length>0&&ne[ne.length-1]?.step==="request_resource_metadata"&&!ne[ne.length-1]?.response?ne.pop():void 0;const R=[],te=async(v,T={})=>{const k=typeof v=="string"?v:v.toString(),x=Vg(n,k,h,Dn(T.headers)),F=H?{...H,timestamp:Date.now(),request:{method:T.method||"GET",url:k,headers:x,body:T.body}}:{step:"request_resource_metadata",timestamp:Date.now(),request:{method:T.method||"GET",url:k,headers:x,body:T.body}};H=void 0,R.push(F);try{const z=await X(k,{method:T.method||"GET",headers:x,body:T.body});F.response={status:z.status,statusText:z.statusText,headers:z.headers,body:z.body},F.duration=Date.now()-F.timestamp;const L={status:z.status,statusText:z.statusText,headers:z.headers},G=typeof z.body=="string"?z.body:JSON.stringify(z.body??{});return new Response(G,L)}catch(z){throw F.error=Ur(z),F.duration=Date.now()-F.timestamp,z}};try{const v=(m||Zs(b.wwwAuthenticateHeader).resource_metadata)&&b.resourceMetadataUrl?{resourceMetadataUrl:b.resourceMetadataUrl}:void 0,T=await Od(b.serverUrl,v,te),k=[...ne,...R],x=R[R.length-1],F=Gg({authorizationServers:T.authorization_servers,fallbackServerUrl:n,protocolVersion:"2025-11-25"}),z=F.authorizationServerUrl;if(F.error&&E!=="observe"){s({resourceMetadata:T,resourceMetadataUrl:x?.request?.url||b.resourceMetadataUrl,lastRequest:x?.request,lastResponse:x?.response,httpHistory:k,error:F.error,isInitiatingAuth:!1});return}let L=b.infoLogs??[];F.error&&(L=_e({...C(),infoLogs:L},"received_resource_metadata","authorization-server-substituted","Derived: Authorization Server (not advertised)",{Finding:F.error,"Using instead":z}));const G=Qg({state:b,fallbackServerUrl:n,prmResource:T.resource,enforcement:y,infoLogs:L}),K=G.resourceIndicator;L=G.infoLogs,s({currentStep:"received_resource_metadata",resourceMetadata:T,resourceIndicator:K,resourceMetadataUrl:x?.request?.url||b.resourceMetadataUrl,authorizationServerUrl:z,lastRequest:x?.request,lastResponse:x?.response,httpHistory:k,infoLogs:L,isInitiatingAuth:!1})}catch(v){const T=Oi([...ne,...R],Ur(v));throw s({lastResponse:R[R.length-1]?.response,httpHistory:T}),new Error(xd(v))}break;case"received_resource_metadata":if(!b.authorizationServerUrl)throw new Error("No authorization server URL available");const ae={method:"GET",url:Uy(b.authorizationServerUrl)[0],headers:Dt(h,{})};s({currentStep:"request_authorization_server_metadata",lastRequest:ae,lastResponse:void 0,httpHistory:[...b.httpHistory||[],{step:"request_authorization_server_metadata",timestamp:Date.now(),request:ae}],isInitiatingAuth:!1}),ee(50);return;case"request_authorization_server_metadata":if(!b.authorizationServerUrl)throw new Error("No authorization server URL available");const he=Uy(b.authorizationServerUrl);let de=null;const Ke=[];let Ge={},Pe=null;for(const v of he)try{const T=Dt(h,{}),k=[...b.httpHistory||[]];k.length>0&&(k[k.length-1].request={method:"GET",url:v,headers:T}),s({lastRequest:{method:"GET",url:v,headers:T},httpHistory:k});const x=await X(v,{method:"GET",headers:Dt(h,{})}),F=Yg(v,x);if(F.kind==="document"){de=F.document,Ge=x.headers,Pe=x;break}Ke.push(F.attempt)}catch(T){if(Jg(T))throw T;Ke.push({url:v,error:T});continue}if(!de||!Pe)throw new Error(Xg(Ke));if(!de.issuer)throw new Error(Fd);if(!de.authorization_endpoint)throw new Error("Authorization server metadata missing 'authorization_endpoint'");if(!de.token_endpoint)throw new Error("Authorization server metadata missing 'token_endpoint'");if(!de.response_types_supported?.includes("code"))throw new Error("Authorization server does not support 'code' response type");const V={status:Pe.status,statusText:Pe.statusText,headers:Ge,body:de},pe=[...b.httpHistory||[]];if(pe.length>0){const v=pe[pe.length-1];v.response=V,v.duration=Date.now()-(v.timestamp||Date.now())}const ye=de.code_challenge_methods_supported||[],ke=AE(ye,"2025-11-25"),He=typeof de.client_id_metadata_document_supported=="boolean"?de.client_id_metadata_document_supported:"false (not advertised, defaults to false per spec)",Oe=_e(C(),"received_authorization_server_metadata","cimd-support","Derived: CIMD Support",{"CIMD Supported":He});if(ke){if(_||E!=="observe"){s({lastResponse:V,httpHistory:pe,infoLogs:Oe,error:ke,isInitiatingAuth:!1});return}console.warn("Authorization server may not support S256 PKCE method. Supported methods:",ye),s({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:de,lastResponse:V,httpHistory:pe,infoLogs:Oe,error:"Warning: Authorization server may not support S256 PKCE method",isInitiatingAuth:!1})}else s({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:de,lastResponse:V,httpHistory:pe,infoLogs:Oe,isInitiatingAuth:!1});break;case"received_authorization_server_metadata":if(!b.authorizationServerMetadata)throw new Error("No authorization server metadata available");if(P==="cimd"){if(b.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:ie,isInitiatingAuth:!1}),ee(800);return}else if(P==="preregistered"){const{clientId:v,clientSecret:T}=await l?.({serverName:i,serverUrl:n})??{};if(!v){s({error:"Pre-registered client ID is required. Please configure OAuth credentials in the server settings.",isInitiatingAuth:!1});return}const k=me(T),x={"Client ID":v,"Client Secret":T||g?"Configured":"Not provided (public client)","Token Auth Method":k,Note:"Using pre-registered client credentials from server config (skipped DCR)"},F=_e(C(),"received_client_credentials","dcr","Pre-registered Client",x);s({currentStep:"received_client_credentials",clientId:v,clientSecret:T||void 0,tokenEndpointAuthMethod:k,infoLogs:F,isInitiatingAuth:!1})}else if(b.authorizationServerMetadata.registration_endpoint){const v=b.resourceMetadata?.scopes_supported||b.authorizationServerMetadata.scopes_supported,T=Gn(I,{customScopes:d,challengedScopes:b.challengedScopes,supportedScopes:v}),k=Bd({registrationEndpoint:b.authorizationServerMetadata.registration_endpoint,redirectUri:M,dynamicRegistrationDefaults:le,scope:T,customHeaders:h});s({currentStep:"request_client_registration",lastRequest:k,lastResponse:void 0,httpHistory:[...b.httpHistory||[],{step:"request_client_registration",timestamp:Date.now(),request:k}],isInitiatingAuth:!1}),ee(50);return}else{if(_){s({error:Hd,isInitiatingAuth:!1});return}const v=await q("Authorization server did not advertise registration_endpoint; using pre-registered client credentials.");if(!v){s({error:jd,isInitiatingAuth:!1});return}s({currentStep:"received_client_credentials",clientId:v.clientId,clientSecret:v.clientSecret,tokenEndpointAuthMethod:v.tokenEndpointAuthMethod,infoLogs:v.infoLogs,error:void 0,isInitiatingAuth:!1})}break;case"request_client_registration":if(!b.authorizationServerMetadata?.registration_endpoint)throw new Error("No registration endpoint available");if(!b.lastRequest?.body)throw new Error("No client metadata in request");{const v=await tl({request:b.lastRequest,requestExecutor:a,httpHistory:b.httpHistory});if(v.status!=="registered"){if(s({lastResponse:v.response,httpHistory:v.httpHistory,error:v.error,isInitiatingAuth:!1}),_)return;const k=await q(v.fallbackNote);if(!k){s({error:v.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(v.missingClientId){s({lastResponse:v.response,httpHistory:v.httpHistory,error:"Dynamic Client Registration response is missing a client_id.",isInitiatingAuth:!1});return}const T=_e(C(),"received_client_credentials","dcr","Dynamic Client Registration",v.infoLogData);s({currentStep:"received_client_credentials",clientId:v.credentials.clientId,clientSecret:v.credentials.clientSecret,tokenEndpointAuthMethod:Ld(v.clientInfo),lastResponse:v.response,httpHistory:v.httpHistory,infoLogs:T,error:void 0,isInitiatingAuth:!1})}break;case"cimd_prepare":s({currentStep:"cimd_fetch_request",isInitiatingAuth:!1}),ee(800);return;case"cimd_fetch_request":try{const v={method:"GET",url:ie,headers:Dn(void 0)},T=Date.now(),k=await X(ie,{method:"GET"});if(!k.ok)throw new Error(`CIMD endpoint returned HTTP ${k.status}`);const x={status:k.status,statusText:k.statusText,headers:k.headers,body:k.body};s({currentStep:"cimd_metadata_response",lastRequest:v,lastResponse:x,httpHistory:[...b.httpHistory||[],{step:"cimd_fetch_request",timestamp:T,duration:Date.now()-T,request:v,response:x}],isInitiatingAuth:!1}),ee(800);return}catch(v){s({error:`CIMD metadata fetch failed: ${v instanceof Error?v.message:String(v)}. Try using 'dcr' or 'preregistered' registration strategy instead.`,isInitiatingAuth:!1});return}case"cimd_metadata_response":try{const v=b.lastResponse?.body;if(!v||typeof v!="object")throw new Error("CIMD metadata document was not available");if(v.client_id!==ie)throw new Error("CIMD client_id mismatch");const T=b.authorizationServerMetadata?.client_id_metadata_document_supported,k={"Client ID":ie,"Registration Method":"Client ID Metadata Document (CIMD)","Client Name":v.client_name||"MCPJam","Redirect URIs":v.redirect_uris||[],"Token Auth Method":v.token_endpoint_auth_method||"none",Validation:"✓ Metadata fetched and validated",Note:"Server fetched and validated client metadata from URL"};T?k["Server Support"]="✓ Advertised in metadata (client_id_metadata_document_supported: true)":k["Server Support"]="⚠ Not advertised (attempting anyway)";const x=_e(C(),"received_client_credentials","cimd","Client ID Metadata Document",k);s({currentStep:"received_client_credentials",clientId:ie,clientSecret:void 0,tokenEndpointAuthMethod:"none",infoLogs:x,isInitiatingAuth:!1})}catch(v){s({error:`CIMD validation failed: ${v instanceof Error?v.message:String(v)}. Try using 'dcr' or 'preregistered' registration strategy instead.`,isInitiatingAuth:!1});return}break;case"received_client_credentials":const Le=Vn(43),Ee=await zd(Le),Ae=_e(C(),"generate_pkce_parameters","pkce-generation","Generate PKCE Parameters",{code_challenge:Ee,method:"S256",...B?{resource:fe()}:{resource:"(omitted — emulated client does not send RFC 8707 resource)"}});s({currentStep:"generate_pkce_parameters",codeVerifier:Le,codeChallenge:Ee,codeChallengeMethod:"S256",...B?{}:{resourceIndicatorSuppressed:!0},state:Vn(16),infoLogs:Ae,isInitiatingAuth:!1});break;case"generate_pkce_parameters":if(!b.authorizationServerMetadata?.authorization_endpoint||!b.clientId)throw new Error("Missing authorization endpoint or client ID");const Ne=new URL(b.authorizationServerMetadata.authorization_endpoint);Ne.searchParams.set("response_type","code"),Ne.searchParams.set("client_id",b.clientId),Ne.searchParams.set("redirect_uri",M),Ne.searchParams.set("code_challenge",b.codeChallenge||""),Ne.searchParams.set("code_challenge_method","S256"),Ne.searchParams.set("state",b.state||""),B&&Ne.searchParams.set("resource",fe());const tt=Gn(I,{customScopes:d,challengedScopes:b.challengedScopes,supportedScopes:b.resourceMetadata?.scopes_supported||b.authorizationServerMetadata.scopes_supported});tt&&Ne.searchParams.set("scope",tt);const J=_e(C(),"authorization_request","auth-url","Authorization URL",{url:Ne.toString()});s({currentStep:"authorization_request",authorizationUrl:Ne.toString(),authorizationCode:void 0,accessToken:void 0,refreshToken:void 0,tokenType:void 0,expiresIn:void 0,infoLogs:J,isInitiatingAuth:!1});break;case"authorization_request":s({currentStep:"received_authorization_code",isInitiatingAuth:!1});break;case"received_authorization_code":{if(!b.authorizationCode||b.authorizationCode.trim()===""){s({error:"Authorization code is required. Please paste the code you received from the authorization server.",isInitiatingAuth:!1});return}if(!b.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");const v=Hn({clientId:b.clientId,clientSecret:b.clientSecret,tokenEndpointAuthMethod:Kn(I,b.tokenEndpointAuthMethod)}),T={grant_type:"authorization_code",code:b.authorizationCode,redirect_uri:M,...v.bodyParams};b.codeVerifier&&(T.code_verifier=b.codeVerifier),B&&(T.resource=fe());const k={method:"POST",url:b.authorizationServerMetadata.token_endpoint,headers:{"Content-Type":"application/x-www-form-urlencoded",...v.headers},body:T};s({currentStep:"token_request",lastRequest:k,lastResponse:void 0,...B?{}:{resourceIndicatorSuppressed:!0},accessToken:void 0,refreshToken:void 0,httpHistory:[...b.httpHistory||[],{step:"token_request",timestamp:Date.now(),request:k}],isInitiatingAuth:!1}),ee(50);return}case"token_request":if(!b.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");if(!b.authorizationCode)throw new Error("Missing authorization code");if(!b.codeVerifier)throw new Error("PKCE code_verifier is missing - cannot exchange token");try{const v=Hn({clientId:b.clientId,clientSecret:b.clientSecret,tokenEndpointAuthMethod:Kn(I,b.tokenEndpointAuthMethod)}),T=new URLSearchParams({grant_type:"authorization_code",code:b.authorizationCode,redirect_uri:M,code_verifier:b.codeVerifier||"",...v.bodyParams});B&&T.set("resource",fe());const k=await X(b.authorizationServerMetadata.token_endpoint,{method:"POST",headers:{...Dt(h,{"Content-Type":"application/x-www-form-urlencoded"}),...v.headers},body:T.toString()}),x={status:k.status,statusText:k.statusText,headers:k.headers,body:k.body},F=[...b.httpHistory||[]];if(F.length>0){const G=F[F.length-1];G.response=x,G.duration=Date.now()-(G.timestamp||Date.now())}if(!k.ok){s({lastResponse:x,httpHistory:F,authorizationCode:void 0,error:$d(k),isInitiatingAuth:!1});return}const z=k.body;let L=(C().infoLogs||[]).filter(G=>G.id!=="auth-code"&&G.id!=="oauth-tokens"&&G.id!=="token");if(b.authorizationCode&&(L=[...L,{id:"auth-code",level:"info",step:"authorization_request",label:"Authorization Code",data:{code:b.authorizationCode},timestamp:Date.now()}]),z.access_token){const G={access_token:z.access_token};z.refresh_token&&(G.refresh_token=z.refresh_token),L=[...L,{id:"oauth-tokens",level:"info",step:"token_request",label:"OAuth Tokens",data:G,timestamp:Date.now()}]}if(z.access_token){const G=Bn(z.access_token);if(G){const K={...G};K.exp&&(K.exp=`${K.exp} (${Xe(K.exp)})`),K.iat&&(K.iat=`${K.iat} (${Xe(K.iat)})`),K.nbf&&(K.nbf=`${K.nbf} (${Xe(K.nbf)})`);const Ie={...K};if(K.aud){const Ue=b.serverUrl,xt=(Array.isArray(K.aud)?K.aud:[K.aud]).some(Ht=>Ht===Ue);Ie._validation={expected_audience:Ue,audience_matches:xt,note:xt?"✓ 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"};L=[...L,{id:"token",level:"info",step:"token_request",label:"Access Token (Decoded JWT)",data:Ie,timestamp:Date.now()}]}}if(z.id_token){const G=Bn(z.id_token);if(G){const K={...G};K.exp&&(K.exp=`${K.exp} (${Xe(K.exp)})`),K.iat&&(K.iat=`${K.iat} (${Xe(K.iat)})`),K.nbf&&(K.nbf=`${K.nbf} (${Xe(K.nbf)})`),K.auth_time&&(K.auth_time=`${K.auth_time} (${Xe(K.auth_time)})`),K._note="OIDC ID Token - Used for user identity verification",L=[...L,{id:"id-token",level:"info",step:"token_request",label:"ID Token (OIDC - Decoded JWT)",data:K,timestamp:Date.now()}]}}s({currentStep:"received_access_token",accessToken:z.access_token,refreshToken:z.refresh_token,tokenType:z.token_type||"Bearer",expiresIn:z.expires_in,lastResponse:x,httpHistory:F,infoLogs:L,error:void 0,isInitiatingAuth:!1})}catch(v){const T={status:0,statusText:"Network Error",headers:{},body:{error:v instanceof Error?v.message:String(v)}},k=[...b.httpHistory||[]];if(k.length>0){const x=k[k.length-1];x.response=T,x.duration=Date.now()-(x.timestamp||Date.now())}s({lastResponse:T,httpHistory:k,error:`Token exchange failed: ${v instanceof Error?v.message:String(v)}`,isInitiatingAuth:!1})}break;case"received_access_token":if(!b.serverUrl||!b.accessToken)throw new Error("Missing server URL or access token");const oe={method:"POST",url:b.serverUrl,headers:{Authorization:`Bearer ${b.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":$},body:rs({protocolVersion:O,authMode:f,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2})},A=_e(C(),"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:b.serverUrl});s({currentStep:"authenticated_mcp_request",lastRequest:oe,lastResponse:void 0,httpHistory:[...b.httpHistory||[],{step:"authenticated_mcp_request",timestamp:Date.now(),request:oe}],infoLogs:A,isInitiatingAuth:!1}),ee(50);return;case"authenticated_mcp_request":if(!b.serverUrl||!b.accessToken)throw new Error("Missing server URL or access token");try{const v=await X(b.serverUrl,{method:"POST",headers:Gt(h,{Authorization:`Bearer ${b.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":$}),body:JSON.stringify(rs({protocolVersion:O,authMode:f,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2}))}),T={status:v.status,statusText:v.statusText,headers:v.headers,body:v.body},k=[...b.httpHistory||[]];if(k.length>0){const G=k[k.length-1];G.response=T,G.duration=Date.now()-(G.timestamp||Date.now())}if(!v.ok){s({lastResponse:T,httpHistory:k,error:Nd(v),isInitiatingAuth:!1});return}let x=C().infoLogs||[];const F=v.headers["content-type"]||"",z=F.includes("text/event-stream");let L=null;if(z&&v.body?.transport==="sse"?L=v.body.mcpResponse:L=v.body,z&&L?.result?.protocolVersion){const G={Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Protocol Version":L.result.protocolVersion};L.result.serverInfo&&(G["Server Name"]=L.result.serverInfo.name,G["Server Version"]=L.result.serverInfo.version),L.result.capabilities&&(G.Capabilities=L.result.capabilities),x=_e(C(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",G)}else if(z)x=_e(C(),"authenticated_mcp_request","mcp-transport","MCP Transport Detected",{Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Content-Type":F,Note:"Server returned streaming response. Initialize response delivered via SSE stream.",Events:v.body?.events?`${v.body.events.length} events parsed`:"No events parsed"});else if(L?.result?.protocolVersion){const G={Transport:"Streamable HTTP","Response Format":"JSON","Protocol Version":L.result.protocolVersion};L.result.serverInfo&&(G["Server Name"]=L.result.serverInfo.name,G["Server Version"]=L.result.serverInfo.version),L.result.capabilities&&(G.Capabilities=L.result.capabilities),x=_e(C(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",G)}s({currentStep:"complete",lastResponse:T,httpHistory:k,infoLogs:x,error:void 0,isInitiatingAuth:!1})}catch(v){const T={status:0,statusText:"Network Error",headers:{},body:{error:v instanceof Error?v.message:String(v)}},k=[...b.httpHistory||[]];if(k.length>0){const x=k[k.length-1];x.response=T,x.duration=Date.now()-(x.timestamp||Date.now())}s({lastResponse:T,httpHistory:k,error:`Authenticated MCP request failed: ${v instanceof Error?v.message:String(v)}`,isInitiatingAuth:!1})}break;case"complete":s({isInitiatingAuth:!1});break;default:s({isInitiatingAuth:!1})}}catch(ne){const H=C(),R=Ur(ne),te=_e(H,H.currentStep,`error-${H.currentStep}-${Date.now()}`,"Step failed",{step:H.currentStep,request:H.lastRequest,response:H.lastResponse,error:R},{level:"error",error:R}),ae=Oi(H.httpHistory,R),he={error:R.message,infoLogs:te,isInitiatingAuth:!1};ae&&(he.httpHistory=ae),s(he)}},startGuidedFlow:async()=>{s({currentStep:"idle",isInitiatingAuth:!1})},resetFlow:()=>{s(Dd())}};return ue},oU=e=>ua(e);function aU(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=Mx(t,r);s.push({label:"challenged scopes",value:r.join(" ")}),s.push({label:"scope union",value:n.join(" ")})}return s}function cU(e){const t=e.recordedIssuer??e.authorizationServerMetadata?.issuer;return t?[{label:"bound to issuer",value:t}]:[]}function lU(e,t){return Ud(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)
|
|
133
|
+
Include resource parameter`,description:"Client generates code verifier and challenge (REQUIRED), includes resource parameter"},resourceValue:oU,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:cU,authorizationRequestExtras:aU})}function qy(e){return el(e,Zc.current).map(({url:t})=>t)}function zy(e){const t=e.replace(/[\u0000-\u001f\u007f\u0085\u2028\u2029]+/g," ").trim();return`\`${t.length>256?`${t.slice(0,256)}…`:t}\``}function uU(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 dU(e,t){try{return new URL(e).origin===new URL(t).origin}catch{return!1}}function Fy(e,t){return e==null?!1:typeof e!="string"?!0:!dU(e,t)}function jy(e){return typeof e=="string"?`"${e}"`:"a non-string value"}function pU(e){const{advertisedIssuer:t,discoveryUrl:r,tokenEndpoint:s,registrationEndpoint:n,allowPathScopedIssuer:i}=e,o=uU(t,r),a=i&&o,c=a&&Fy(s,t),l=a&&Fy(n,t);return a&&!c&&!l?{accepted:!0,hint:""}:{accepted:!1,hint:c?` The path-scoped authorization server's token endpoint (${jy(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 (${jy(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 hU(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: ${zy(t)}; returned on the callback: ${zy(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 fU=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:m,authMode:f,hasClientSecret:g=!1,strictConformance:_=!1,allowPathScopedIssuer:y=!1,resourceIndicatorEnforcement:E="warn",requiredMetadataEnforcement:P="reject",registrationStrategy:I="cimd",emulation:M}=e,$=o,O=Mi(M,"2026-07-28"),B=Vd(M),le=Gd(u??{},M);let ie=p??"";if(I==="dcr"&&!le.client_name)throw new Error("Dynamic registration metadata must include client_name");if(I==="cimd"&&!ie)throw new Error("Client ID metadata URL is required for CIMD registration");I==="cimd"&&(ie=Zg(ie));const C=()=>r?r():t,fe=()=>ua(C(),n),X=(b,ee={})=>a({url:b,method:ee.method||"GET",headers:Dn(ee.headers),body:ee.body}),me=b=>{const ee=Md({authorizationServerMetadata:C().authorizationServerMetadata,hasClientSecret:!!(b||g)});if(!ee.ok)throw new Error(ee.message);return ee.method},q=async b=>{const{clientId:ee,clientSecret:ne}=await l?.({serverName:i,serverUrl:n})??{};if(!ee)return;const H=me(ne),R={"Client ID":ee,"Client Secret":ne||g?"Configured":"Not provided (public client)","Token Auth Method":H,Note:b};return{clientId:ee,clientSecret:ne||void 0,tokenEndpointAuthMethod:H,infoLogs:_e(C(),"received_client_credentials","preregistered-fallback","Pre-registered Client",R)}},ue={state:t,updateState:s,proceedToNextStep:async()=>{const b=C();s({isInitiatingAuth:!0});const ee=ne=>{c?.(()=>{ue.proceedToNextStep()},ne)};try{switch(b.currentStep){case"idle":{const v=Gt(h,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":O,"Mcp-Method":"tools/list"}),T=Nl({protocolVersion:O,authMode:f,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}),k={method:"POST",url:n,headers:v,body:T};s({currentStep:"request_without_token",serverUrl:n,lastRequest:k,lastResponse:void 0,httpHistory:[...b.httpHistory||[],{step:"request_without_token",timestamp:Date.now(),request:k}],isInitiatingAuth:!1}),ee(50);return}case"request_without_token":if(!b.serverUrl)throw new Error("No server URL available");try{const v=await X(b.serverUrl,{method:"POST",headers:Gt(h,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":O,"Mcp-Method":"tools/list"}),body:JSON.stringify(Nl({protocolVersion:O,authMode:f,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}))}),T={status:v.status,statusText:v.statusText,headers:v.headers,body:v.body},k=[...b.httpHistory||[]];if(k.length>0){const F=k[k.length-1];F.response=T,F.duration=Date.now()-(F.timestamp||Date.now())}const x=vd({status:v.status,statusText:v.statusText,wwwAuthenticateHeader:v.headers["www-authenticate"],serverMessage:v.body?.error?.message});if(x.kind==="challenged"){const F=v.headers["www-authenticate"],z=Zs(F),L=rg(z.scope);let G=F?_e(b,"received_401_unauthorized","www-authenticate","WWW-Authenticate Header",{header:F,...L&&L.length>0?{scope:L.join(" ")}:{},"Received from":b.serverUrl||"Unknown"}):b.infoLogs;x.specCompliant||(G=qd(b,G,"received_401_unauthorized",T)),s({currentStep:"received_401_unauthorized",wwwAuthenticateHeader:F||void 0,challengedScopes:L,lastResponse:T,httpHistory:k,infoLogs:G,isInitiatingAuth:!1})}else if(x.kind==="anonymous_allowed"){const F=_e(b,"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:T,httpHistory:k,infoLogs:F,isInitiatingAuth:!1})}else throw s({lastResponse:T,httpHistory:k}),new jn(x.message,v.status)}catch(v){throw v instanceof jn?v:new Error(`Failed to request MCP server: ${v instanceof Error?v.message:String(v)}`)}break;case"received_401_unauthorized":{const v=Zs(b.wwwAuthenticateHeader);let T=m||v.resource_metadata;if(!T&&b.serverUrl&&(T=Wg(b.serverUrl)),!T)throw new Error("Could not determine resource metadata URL");const k={method:"GET",url:T,headers:Gt(h,{})};s({currentStep:"request_resource_metadata",resourceMetadataUrl:T,lastRequest:k,lastResponse:void 0,httpHistory:[...b.httpHistory||[],{step:"request_resource_metadata",timestamp:Date.now(),request:k}],isInitiatingAuth:!1}),ee(50);return}case"request_resource_metadata":if(!b.serverUrl)throw new Error("No server URL available");const ne=[...b.httpHistory||[]];let H=ne.length>0&&ne[ne.length-1]?.step==="request_resource_metadata"&&!ne[ne.length-1]?.response?ne.pop():void 0;const R=[],te=async(v,T={})=>{const k=typeof v=="string"?v:v.toString(),x=Vg(n,k,h,Dn(T.headers)),F=H?{...H,timestamp:Date.now(),request:{method:T.method||"GET",url:k,headers:x,body:T.body}}:{step:"request_resource_metadata",timestamp:Date.now(),request:{method:T.method||"GET",url:k,headers:x,body:T.body}};H=void 0,R.push(F);try{const z=await X(k,{method:T.method||"GET",headers:x,body:T.body});F.response={status:z.status,statusText:z.statusText,headers:z.headers,body:z.body},F.duration=Date.now()-F.timestamp;const L={status:z.status,statusText:z.statusText,headers:z.headers},G=typeof z.body=="string"?z.body:JSON.stringify(z.body??{});return new Response(G,L)}catch(z){throw F.error=Ur(z),F.duration=Date.now()-F.timestamp,z}};try{const v=(m||Zs(b.wwwAuthenticateHeader).resource_metadata)&&b.resourceMetadataUrl?{resourceMetadataUrl:b.resourceMetadataUrl}:void 0,T=await Od(b.serverUrl,v,te),k=[...ne,...R],x=R[R.length-1],F=Gg({authorizationServers:T.authorization_servers,fallbackServerUrl:n,protocolVersion:"2026-07-28"}),z=F.authorizationServerUrl;if(F.error&&P!=="observe"){s({resourceMetadata:T,resourceMetadataUrl:x?.request?.url||b.resourceMetadataUrl,lastRequest:x?.request,lastResponse:x?.response,httpHistory:k,error:F.error,isInitiatingAuth:!1});return}let L=b.infoLogs??[];F.error&&(L=_e({...C(),infoLogs:L},"received_resource_metadata","authorization-server-substituted","Derived: Authorization Server (not advertised)",{Finding:F.error,"Using instead":z}));const G=Qg({state:b,fallbackServerUrl:n,prmResource:T.resource,enforcement:E,infoLogs:L}),K=G.resourceIndicator;L=G.infoLogs,s({currentStep:"received_resource_metadata",resourceMetadata:T,resourceIndicator:K,resourceMetadataUrl:x?.request?.url||b.resourceMetadataUrl,authorizationServerUrl:z,lastRequest:x?.request,lastResponse:x?.response,httpHistory:k,infoLogs:L,isInitiatingAuth:!1})}catch(v){const T=Oi([...ne,...R],Ur(v));throw s({lastResponse:R[R.length-1]?.response,httpHistory:T}),new Error(xd(v))}break;case"received_resource_metadata":if(!b.authorizationServerUrl)throw new Error("No authorization server URL available");const ae={method:"GET",url:qy(b.authorizationServerUrl)[0],headers:Dt(h,{})};s({currentStep:"request_authorization_server_metadata",lastRequest:ae,lastResponse:void 0,httpHistory:[...b.httpHistory||[],{step:"request_authorization_server_metadata",timestamp:Date.now(),request:ae}],isInitiatingAuth:!1}),ee(50);return;case"request_authorization_server_metadata":if(!b.authorizationServerUrl)throw new Error("No authorization server URL available");const he=qy(b.authorizationServerUrl);let de=null;const Ke=[];let Ge={},Pe=null;for(const v of he)try{const T=Dt(h,{}),k=[...b.httpHistory||[]];k.length>0&&(k[k.length-1].request={method:"GET",url:v,headers:T}),s({lastRequest:{method:"GET",url:v,headers:T},httpHistory:k});const x=await X(v,{method:"GET",headers:Dt(h,{})}),F=Yg(v,x);if(F.kind==="document"){de=F.document,Ge=x.headers,Pe=x;break}Ke.push(F.attempt)}catch(T){if(Jg(T))throw T;Ke.push({url:v,error:T});continue}if(!de||!Pe)throw new Error(Xg(Ke));if(!de.issuer)throw new Error(Fd);if(de.issuer!==b.authorizationServerUrl){const v=pU({advertisedIssuer:de.issuer,discoveryUrl:b.authorizationServerUrl,tokenEndpoint:de.token_endpoint,registrationEndpoint:de.registration_endpoint,allowPathScopedIssuer:y});if(!v.accepted)throw new Error(`Authorization server metadata \`issuer\` does not match the authorization server URL it was discovered from (expected "${b.authorizationServerUrl}", got "${de.issuer}"). RFC 8414 §3.3 requires an exact match; refusing to continue.`+v.hint)}if(!de.authorization_endpoint)throw new Error("Authorization server metadata missing 'authorization_endpoint'");if(!de.token_endpoint)throw new Error("Authorization server metadata missing 'token_endpoint'");if(!de.response_types_supported?.includes("code"))throw new Error("Authorization server does not support 'code' response type");const V={status:Pe.status,statusText:Pe.statusText,headers:Ge,body:de},pe=[...b.httpHistory||[]];if(pe.length>0){const v=pe[pe.length-1];v.response=V,v.duration=Date.now()-(v.timestamp||Date.now())}const ye=de.code_challenge_methods_supported||[],ke=AE(ye,"2026-07-28"),He=typeof de.client_id_metadata_document_supported=="boolean"?de.client_id_metadata_document_supported:"false (not advertised, defaults to false per spec)";let Oe=_e(C(),"received_authorization_server_metadata","cimd-support","Derived: CIMD Support",{"CIMD Supported":He});if(de.issuer!==b.authorizationServerUrl&&(Oe=_e({...C(),infoLogs:Oe},"received_authorization_server_metadata","path-scoped-issuer","Path-scoped authorization server",{"Discovery URL":b.authorizationServerUrl,"Advertised issuer":de.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(_||P!=="observe"){s({lastResponse:V,httpHistory:pe,infoLogs:Oe,error:ke,isInitiatingAuth:!1});return}console.warn("Authorization server may not support S256 PKCE method. Supported methods:",ye),s({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:de,lastResponse:V,httpHistory:pe,infoLogs:Oe,error:"Warning: Authorization server may not support S256 PKCE method",isInitiatingAuth:!1})}else s({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:de,lastResponse:V,httpHistory:pe,infoLogs:Oe,isInitiatingAuth:!1});break;case"received_authorization_server_metadata":if(!b.authorizationServerMetadata)throw new Error("No authorization server metadata available");if(I==="cimd"){if(b.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:ie,isInitiatingAuth:!1}),ee(800);return}else if(I==="preregistered"){const{clientId:v,clientSecret:T}=await l?.({serverName:i,serverUrl:n})??{};if(!v){s({error:"Pre-registered client ID is required. Please configure OAuth credentials in the server settings.",isInitiatingAuth:!1});return}const k=me(T),x={"Client ID":v,"Client Secret":T||g?"Configured":"Not provided (public client)","Token Auth Method":k,Note:"Using pre-registered client credentials from server config (skipped DCR)"},F=_e(C(),"received_client_credentials","dcr","Pre-registered Client",x);s({currentStep:"received_client_credentials",clientId:v,clientSecret:T||void 0,tokenEndpointAuthMethod:k,infoLogs:F,isInitiatingAuth:!1})}else if(b.authorizationServerMetadata.registration_endpoint){const v=b.resourceMetadata?.scopes_supported||b.authorizationServerMetadata.scopes_supported,T=Gn(M,{customScopes:d,challengedScopes:b.challengedScopes,supportedScopes:v}),k=Bd({registrationEndpoint:b.authorizationServerMetadata.registration_endpoint,redirectUri:$,dynamicRegistrationDefaults:{...le,application_type:le.application_type??BD(le.redirect_uris??[$])},scope:T,customHeaders:h}),x=_e(C(),"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:x,httpHistory:[...b.httpHistory||[],{step:"request_client_registration",timestamp:Date.now(),request:k}],isInitiatingAuth:!1}),ee(50);return}else{if(_){s({error:Hd,isInitiatingAuth:!1});return}const v=await q("Authorization server did not advertise registration_endpoint; using pre-registered client credentials.");if(!v){s({error:jd,isInitiatingAuth:!1});return}s({currentStep:"received_client_credentials",clientId:v.clientId,clientSecret:v.clientSecret,tokenEndpointAuthMethod:v.tokenEndpointAuthMethod,infoLogs:v.infoLogs,error:void 0,isInitiatingAuth:!1})}break;case"request_client_registration":if(!b.authorizationServerMetadata?.registration_endpoint)throw new Error("No registration endpoint available");if(!b.lastRequest?.body)throw new Error("No client metadata in request");{const v=await tl({request:b.lastRequest,requestExecutor:a,httpHistory:b.httpHistory});if(v.status!=="registered"){if(s({lastResponse:v.response,httpHistory:v.httpHistory,error:v.error,isInitiatingAuth:!1}),_)return;const k=await q(v.fallbackNote);if(!k){s({error:v.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(v.missingClientId){s({lastResponse:v.response,httpHistory:v.httpHistory,error:"Dynamic Client Registration response is missing a client_id.",isInitiatingAuth:!1});return}const T=_e(C(),"received_client_credentials","dcr","Dynamic Client Registration",v.infoLogData);s({currentStep:"received_client_credentials",clientId:v.credentials.clientId,clientSecret:v.credentials.clientSecret,tokenEndpointAuthMethod:Ld(v.clientInfo),lastResponse:v.response,httpHistory:v.httpHistory,infoLogs:T,error:void 0,isInitiatingAuth:!1})}break;case"cimd_prepare":s({currentStep:"cimd_fetch_request",isInitiatingAuth:!1}),ee(800);return;case"cimd_fetch_request":try{const v={method:"GET",url:ie,headers:Dn(void 0)},T=Date.now(),k=await X(ie,{method:"GET"});if(!k.ok)throw new Error(`CIMD endpoint returned HTTP ${k.status}`);const x={status:k.status,statusText:k.statusText,headers:k.headers,body:k.body};s({currentStep:"cimd_metadata_response",lastRequest:v,lastResponse:x,httpHistory:[...b.httpHistory||[],{step:"cimd_fetch_request",timestamp:T,duration:Date.now()-T,request:v,response:x}],isInitiatingAuth:!1}),ee(800);return}catch(v){s({error:`CIMD metadata fetch failed: ${v instanceof Error?v.message:String(v)}. Try using 'dcr' or 'preregistered' registration strategy instead.`,isInitiatingAuth:!1});return}case"cimd_metadata_response":try{const v=b.lastResponse?.body;if(!v||typeof v!="object")throw new Error("CIMD metadata document was not available");if(v.client_id!==ie)throw new Error("CIMD client_id mismatch");const T=b.authorizationServerMetadata?.client_id_metadata_document_supported,k={"Client ID":ie,"Registration Method":"Client ID Metadata Document (CIMD)","Client Name":v.client_name||"MCPJam","Redirect URIs":v.redirect_uris||[],"Token Auth Method":v.token_endpoint_auth_method||"none",Validation:"✓ Metadata fetched and validated",Note:"Server fetched and validated client metadata from URL"};T?k["Server Support"]="✓ Advertised in metadata (client_id_metadata_document_supported: true)":k["Server Support"]="⚠ Not advertised (attempting anyway)";const x=_e(C(),"received_client_credentials","cimd","Client ID Metadata Document",k);s({currentStep:"received_client_credentials",clientId:ie,clientSecret:void 0,tokenEndpointAuthMethod:"none",infoLogs:x,isInitiatingAuth:!1})}catch(v){s({error:`CIMD validation failed: ${v instanceof Error?v.message:String(v)}. Try using 'dcr' or 'preregistered' registration strategy instead.`,isInitiatingAuth:!1});return}break;case"received_client_credentials":const Le=Vn(43),Ee=await zd(Le),Ae=_e(C(),"generate_pkce_parameters","pkce-generation","Generate PKCE Parameters",{code_challenge:Ee,method:"S256",...B?{resource:fe()}:{resource:"(omitted — emulated client does not send RFC 8707 resource)"}});s({currentStep:"generate_pkce_parameters",codeVerifier:Le,codeChallenge:Ee,codeChallengeMethod:"S256",...B?{}:{resourceIndicatorSuppressed:!0},state:Vn(16),recordedIssuer:C().authorizationServerMetadata?.issuer,infoLogs:Ae,isInitiatingAuth:!1});break;case"generate_pkce_parameters":if(!b.authorizationServerMetadata?.authorization_endpoint||!b.clientId)throw new Error("Missing authorization endpoint or client ID");const Ne=new URL(b.authorizationServerMetadata.authorization_endpoint);Ne.searchParams.set("response_type","code"),Ne.searchParams.set("client_id",b.clientId),Ne.searchParams.set("redirect_uri",$),Ne.searchParams.set("code_challenge",b.codeChallenge||""),Ne.searchParams.set("code_challenge_method","S256"),Ne.searchParams.set("state",b.state||""),B&&Ne.searchParams.set("resource",fe());const tt=Gn(M,{customScopes:d,challengedScopes:b.challengedScopes,supportedScopes:b.resourceMetadata?.scopes_supported||b.authorizationServerMetadata.scopes_supported});tt&&Ne.searchParams.set("scope",tt);const J=_e(C(),"authorization_request","auth-url","Authorization URL",{url:Ne.toString()});s({currentStep:"authorization_request",authorizationUrl:Ne.toString(),authorizationCode:void 0,accessToken:void 0,refreshToken:void 0,tokenType:void 0,expiresIn:void 0,requestedScopes:tt?tt.split(/\s+/).filter(Boolean):void 0,infoLogs:J,isInitiatingAuth:!1});break;case"authorization_request":s({currentStep:"received_authorization_code",isInitiatingAuth:!1});break;case"received_authorization_code":{if(!b.authorizationCode||b.authorizationCode.trim()===""){s({error:"Authorization code is required. Please paste the code you received from the authorization server.",isInitiatingAuth:!1});return}if(!b.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");const v=hU({recordedIssuer:b.recordedIssuer,returnedIss:b.authorizationResponseIss,issParameterSupported:void 0,enforcePresentIssMismatch:!0});if(!v.ok){s({error:v.reason,isInitiatingAuth:!1});return}const T=Hn({clientId:b.clientId,clientSecret:b.clientSecret,tokenEndpointAuthMethod:Kn(M,b.tokenEndpointAuthMethod)}),k={grant_type:"authorization_code",code:b.authorizationCode,redirect_uri:$,...T.bodyParams};b.codeVerifier&&(k.code_verifier=b.codeVerifier),B&&(k.resource=fe());const x={method:"POST",url:b.authorizationServerMetadata.token_endpoint,headers:{"Content-Type":"application/x-www-form-urlencoded",...T.headers},body:k};s({currentStep:"token_request",lastRequest:x,lastResponse:void 0,...B?{}:{resourceIndicatorSuppressed:!0},accessToken:void 0,refreshToken:void 0,httpHistory:[...b.httpHistory||[],{step:"token_request",timestamp:Date.now(),request:x}],isInitiatingAuth:!1}),ee(50);return}case"token_request":if(!b.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");if(!b.authorizationCode)throw new Error("Missing authorization code");if(!b.codeVerifier)throw new Error("PKCE code_verifier is missing - cannot exchange token");try{const v=Hn({clientId:b.clientId,clientSecret:b.clientSecret,tokenEndpointAuthMethod:Kn(M,b.tokenEndpointAuthMethod)}),T=new URLSearchParams({grant_type:"authorization_code",code:b.authorizationCode,redirect_uri:$,code_verifier:b.codeVerifier||"",...v.bodyParams});B&&T.set("resource",fe());const k=await X(b.authorizationServerMetadata.token_endpoint,{method:"POST",headers:{...Dt(h,{"Content-Type":"application/x-www-form-urlencoded"}),...v.headers},body:T.toString()}),x={status:k.status,statusText:k.statusText,headers:k.headers,body:k.body},F=[...b.httpHistory||[]];if(F.length>0){const G=F[F.length-1];G.response=x,G.duration=Date.now()-(G.timestamp||Date.now())}if(!k.ok){s({lastResponse:x,httpHistory:F,authorizationCode:void 0,error:$d(k),isInitiatingAuth:!1});return}const z=k.body;let L=(C().infoLogs||[]).filter(G=>G.id!=="auth-code"&&G.id!=="oauth-tokens"&&G.id!=="token");if(b.authorizationCode&&(L=[...L,{id:"auth-code",level:"info",step:"authorization_request",label:"Authorization Code",data:{code:b.authorizationCode},timestamp:Date.now()}]),z.access_token){const G={access_token:z.access_token};z.refresh_token&&(G.refresh_token=z.refresh_token),L=[...L,{id:"oauth-tokens",level:"info",step:"token_request",label:"OAuth Tokens",data:G,timestamp:Date.now()}]}if(z.access_token){const G=Bn(z.access_token);if(G){const K={...G};K.exp&&(K.exp=`${K.exp} (${Xe(K.exp)})`),K.iat&&(K.iat=`${K.iat} (${Xe(K.iat)})`),K.nbf&&(K.nbf=`${K.nbf} (${Xe(K.nbf)})`);const Ie={...K};if(K.aud){const Ue=b.serverUrl,xt=(Array.isArray(K.aud)?K.aud:[K.aud]).some(Ht=>Ht===Ue);Ie._validation={expected_audience:Ue,audience_matches:xt,note:xt?"✓ 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"};L=[...L,{id:"token",level:"info",step:"token_request",label:"Access Token (Decoded JWT)",data:Ie,timestamp:Date.now()}]}}if(z.id_token){const G=Bn(z.id_token);if(G){const K={...G};K.exp&&(K.exp=`${K.exp} (${Xe(K.exp)})`),K.iat&&(K.iat=`${K.iat} (${Xe(K.iat)})`),K.nbf&&(K.nbf=`${K.nbf} (${Xe(K.nbf)})`),K.auth_time&&(K.auth_time=`${K.auth_time} (${Xe(K.auth_time)})`),K._note="OIDC ID Token - Used for user identity verification",L=[...L,{id:"id-token",level:"info",step:"token_request",label:"ID Token (OIDC - Decoded JWT)",data:K,timestamp:Date.now()}]}}s({currentStep:"received_access_token",accessToken:z.access_token,refreshToken:z.refresh_token,tokenType:z.token_type||"Bearer",expiresIn:z.expires_in,lastResponse:x,httpHistory:F,infoLogs:L,error:void 0,isInitiatingAuth:!1})}catch(v){const T={status:0,statusText:"Network Error",headers:{},body:{error:v instanceof Error?v.message:String(v)}},k=[...b.httpHistory||[]];if(k.length>0){const x=k[k.length-1];x.response=T,x.duration=Date.now()-(x.timestamp||Date.now())}s({lastResponse:T,httpHistory:k,error:`Token exchange failed: ${v instanceof Error?v.message:String(v)}`,isInitiatingAuth:!1})}break;case"received_access_token":if(!b.serverUrl||!b.accessToken)throw new Error("Missing server URL or access token");const oe={method:"POST",url:b.serverUrl,headers:{Authorization:`Bearer ${b.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":O,"Mcp-Method":"tools/list"},body:Nl({protocolVersion:O,authMode:f,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2})},A=_e(C(),"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:b.serverUrl});s({currentStep:"authenticated_mcp_request",lastRequest:oe,lastResponse:void 0,httpHistory:[...b.httpHistory||[],{step:"authenticated_mcp_request",timestamp:Date.now(),request:oe}],infoLogs:A,isInitiatingAuth:!1}),ee(50);return;case"authenticated_mcp_request":if(!b.serverUrl||!b.accessToken)throw new Error("Missing server URL or access token");try{const v=await X(b.serverUrl,{method:"POST",headers:Gt(h,{Authorization:`Bearer ${b.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":O,"Mcp-Method":"tools/list"}),body:JSON.stringify(Nl({protocolVersion:O,authMode:f,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2}))}),T={status:v.status,statusText:v.statusText,headers:v.headers,body:v.body},k=[...b.httpHistory||[]];if(k.length>0){const G=k[k.length-1];G.response=T,G.duration=Date.now()-(G.timestamp||Date.now())}if(!v.ok){s({lastResponse:T,httpHistory:k,error:Nd(v),isInitiatingAuth:!1});return}let x=C().infoLogs||[];const F=v.headers["content-type"]||"",z=F.includes("text/event-stream");let L=null;if(z&&v.body?.transport==="sse"?L=v.body.mcpResponse:L=v.body,z&&L?.result?.protocolVersion){const G={Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Protocol Version":L.result.protocolVersion};L.result.serverInfo&&(G["Server Name"]=L.result.serverInfo.name,G["Server Version"]=L.result.serverInfo.version),L.result.capabilities&&(G.Capabilities=L.result.capabilities),x=_e(C(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",G)}else if(z)x=_e(C(),"authenticated_mcp_request","mcp-transport","MCP Transport Detected",{Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Content-Type":F,Note:"Server returned streaming response. tools/list verify response delivered via SSE stream.",Events:v.body?.events?`${v.body.events.length} events parsed`:"No events parsed"});else if(L?.result?.protocolVersion){const G={Transport:"Streamable HTTP","Response Format":"JSON","Protocol Version":L.result.protocolVersion};L.result.serverInfo&&(G["Server Name"]=L.result.serverInfo.name,G["Server Version"]=L.result.serverInfo.version),L.result.capabilities&&(G.Capabilities=L.result.capabilities),x=_e(C(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",G)}else if(L?.result){const G=Array.isArray(L.result.tools)?L.result.tools.length:void 0;x=_e(C(),"authenticated_mcp_request","mcp-token-verified","Access token verified (tools/list)",{Transport:"Streamable HTTP","Response Format":"JSON",Result:"Bearer token accepted; tools/list succeeded",...G!==void 0?{"Tools listed":G}:{}})}s({currentStep:"complete",lastResponse:T,httpHistory:k,infoLogs:x,error:void 0,isInitiatingAuth:!1})}catch(v){const T={status:0,statusText:"Network Error",headers:{},body:{error:v instanceof Error?v.message:String(v)}},k=[...b.httpHistory||[]];if(k.length>0){const x=k[k.length-1];x.response=T,x.duration=Date.now()-(x.timestamp||Date.now())}s({lastResponse:T,httpHistory:k,error:`Authenticated MCP request failed: ${v instanceof Error?v.message:String(v)}`,isInitiatingAuth:!1})}break;case"complete":s({isInitiatingAuth:!1});break;default:s({isInitiatingAuth:!1})}}catch(ne){const H=C(),R=Ur(ne),te=_e(H,H.currentStep,`error-${H.currentStep}-${Date.now()}`,"Step failed",{step:H.currentStep,request:H.lastRequest,response:H.lastResponse,error:R},{level:"error",error:R}),ae=Oi(H.httpHistory,R),he={error:R.message,infoLogs:te,isInitiatingAuth:!1};ae&&(he.httpHistory=ae),s(he)}},startGuidedFlow:async()=>{s({currentStep:"idle",isInitiatingAuth:!1})},resetFlow:()=>{s(Dd())}};return ue};function I7({protocolVersion:e,registrationStrategy:t,flowState:r}){switch(e){case"2025-03-26":return KD(r,t==="cimd"?"dcr":t);case"2025-06-18":return eU(r,t==="cimd"?"dcr":t);case"2025-11-25":return nU(r,t);case"2026-07-28":return lU(r,t);default:throw new Error(`Unknown protocol version: ${e}`)}}function Wd(e){return e.replace(/^\[|\]$/g,"").trim().toLowerCase().replace(/\.+$/,"")}function RE(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 CE(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 Hy(e,t){return RE(`${e>>8}.${e&255}.${t>>8}.${t&255}`)}function mU(e){const t=CE(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:Hy(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)?Hy(t[6],t[7]):!1}function gU(e){const t=Wd(e);return/^\d+\.\d+\.\d+\.\d+$/.test(t)?RE(t):t.includes(":")?mU(t):!1}function vU(e){const t=Wd(e);return t==="localhost"||t.endsWith(".localhost")?!0:gU(t)}function _U(e){const t=Wd(e);return/^\d+\.\d+\.\d+\.\d+$/.test(t)?PE(t):t.includes(":")?yU(t):!1}function PE(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 By(e,t){return PE(`${e>>8}.${e&255}.${t>>8}.${t&255}`)}function yU(e){const t=CE(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)?By(t[6],t[7]):!1:!0}var bU=new Set(["metadata.google.internal","metadata.goog"]);function wU(e){const t=Wd(e);return bU.has(t)?!0:_U(t)}function xE(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 R7(e){if(!e)return!1;try{const t=new URL(e).hostname;return Kd(t)||xE(t)}catch{return!1}}var Ra=class extends Error{url;reason;constructor(e,t,r){super(r),this.name="OAuthOutboundUrlBlockedError",this.url=e,this.reason=t}};function SU(e,t={}){let r;try{r=new URL(e)}catch{throw new Ra(e,"invalid-url","Outbound OAuth fetch URL is not a valid absolute URL")}if(r.protocol!=="https:"&&r.protocol!=="http:")throw new Ra(e,"invalid-scheme",`Outbound OAuth fetch must be http(s); got "${r.protocol}"`);const s=r.hostname;if(wU(s))throw new Ra(e,"private-host",`Refusing outbound OAuth fetch to link-local or cloud-metadata host "${s}"`);if(t.allowPrivateNetwork===!0)return r;if(Kd(s)||xE(s)){if(t.allowLoopback===!0)return r;throw new Ra(e,"private-host",`Refusing outbound OAuth fetch to loopback host "${s}" (no loopback opt-in)`)}if(vU(s))throw new Ra(e,"private-host",`Refusing outbound OAuth fetch to private/reserved host "${s}"`);return r}var kU=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}},EU=["access_token","refresh_token","id_token","client_secret"],TU=[/^\[redacted\]$/,/^[\s\S]{4}\.\.\.\[redacted\]\.\.\.[\s\S]{2}$/];function AU(e){try{const t=new URL(e.url);return`${t.origin}${t.pathname}`}catch{return"the authorization server"}}function IU(e,t){const r=e?.body;if(!r||typeof r!="object"||Array.isArray(r))return e;const s=r;for(const n of EU){const i=s[n];if(typeof i=="string"&&TU.some(o=>o.test(i)))throw new kU(n,AU(t))}return e}function RU(e){const{protocolVersion:t,allowLoopbackMetadataFetch:r,allowPrivateMetadataFetch:s,...n}=e,i=r??!1,o=s??!1,c={...n,requestExecutor:async l=>(SU(l.url,{allowLoopback:i,allowPrivateNetwork:o}),IU(await n.requestExecutor(l),l)),customHeaders:GD(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 JD(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 tU(c);case"2025-11-25":return iU(c);case"2026-07-28":return fU(c);default:throw new Error(`Unknown protocol version: ${t}`)}}function C7(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 P7(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 x7={"2025-03-26":{label:gl("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:gl("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:gl("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:gl("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"]}},CU=["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"],PU={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 Vy(e){return PU[e]??{title:e,summary:"No additional information available for this step."}}function wn(e){const t=CU.indexOf(e);return t===-1?Number.MAX_SAFE_INTEGER:t}function xU(e){return JSON.parse(JSON.stringify(e))}function OU(e){return{...e,request:{...e.request,url:Og(e.request.url),headers:yy(e.request.headers),body:Ts(e.request.body)},...e.response?{response:{...e.response,headers:yy(e.response.headers),body:Ts(e.response.body)}}:{},...e.error?{error:{...e.error,...e.error.message?{message:$n(e.error.message)}:{},details:Ts(e.error.details)}}:{}}}function MU(...e){const t=e.filter(r=>r!=null);if(t.length!==0)return Math.max(...t)}function LU(){return{syntheticStepTimestamps:{},lastSyntheticTimestamp:0}}function NU(e,t,r){if(!e)return r;const s=e.syntheticStepTimestamps[t];return typeof s=="number"?s:r}function Gy(e,t,r,s){const n=NU(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 Yn(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?Ts(n):JSON.parse(JSON.stringify(n));e.set(r,{step:r,startedAt:o,completedAt:o,details:a})}function $U(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 DU(e){if(!(!e||e.status<400))return Bg(e.body)??`HTTP ${e.status} ${e.statusText}`}function UU(e){if(e.error?.message)return e.error.message;if(e.step==="request_client_registration")return DU(e.response)}function Ky(e){return!e.error||!e.clientId||wn(e.currentStep)<=wn("request_client_registration")?!1:e.error.startsWith("Dynamic Client Registration failed")||e.error.startsWith("Client registration failed:")}function qU(e){const{state:t,context:r,sanitize:s=!0}=e,n=t.error?s?$n(t.error):t.error:void 0,i={version:1,currentStep:t.currentStep,steps:[],httpHistory:(t.httpHistory??[]).map(u=>s?OU(u):xU(u)),...n?{error:n}:{}},o=wn(t.currentStep),a=new Map;for(const u of t.httpHistory??[]){const p=Gy(a,r,u.step,u.timestamp);p.details||(p.details={request:s?Ts(u.request):u.request,...u.response?{response:s?Ts(u.response):u.response}:{}});const d=UU(u);d&&(p.error=Pf(s?$n(d):d.slice(0,500)))}for(const u of t.infoLogs??[]){const p=Gy(a,r,u.step,u.timestamp);p.message=u.label;const d=s?Ts(u.data):u.data;d&&typeof d=="object"&&d!==null&&!Array.isArray(d)&&(p.details=d),u.error?.message&&(p.error=s?$n(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)),Yn(a,r,"received_client_credentials",!!t.clientId,{clientId:t.clientId},s),Yn(a,r,"generate_pkce_parameters",!!t.codeVerifier,{codeVerifier:t.codeVerifier},s),Yn(a,r,"authorization_request",!!t.authorizationUrl,{authorizationUrl:t.authorizationUrl},s),Yn(a,r,"received_authorization_code",!!t.authorizationCode,t.authorizationCode?{code:t.authorizationCode}:void 0,s),Yn(a,r,"received_access_token",!!t.accessToken,{tokenType:t.tokenType,expiresIn:t.expiresIn},s),Yn(a,r,"complete",t.currentStep==="complete",void 0,s);const l=a.get("request_client_registration");if(l?.error&&wn(t.currentStep)>wn("request_client_registration")&&t.clientId&&(l.recovered=!0,l.recoveredAt=MU(l.recoveredAt,l.completedAt,a.get("received_client_credentials")?.startedAt),l.recoveryMessage="Using pre-registered client credentials after registration failed."),t.error&&!Ky(t)&&!a.has(t.currentStep)){Yn(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||wn(u.step)-wn(p.step)).map(u=>{const p=wn(u.step),d=u.step===t.currentStep&&!!t.error&&!Ky(t),h=u.error??(d?n:void 0),m=u.recovered?"success":h?"error":p<o||t.currentStep==="complete"||$U(u.step,t)?"success":u.step===t.currentStep?"pending":"success";return{step:u.step,title:Vy(u.step).title,status:m,message:u.message??Vy(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:m==="pending"?void 0:u.completedAt}}),i}function $l(e){return{message:e instanceof Error?e.message:String(e)}}async function O7(e){const{maxSteps:t=40,onAuthorizationRequest:r,onTraceUpdate:s,getState:n,sanitizeTrace:i=!0,...o}=e;let a=e.state;const c=LU(),l=n??(()=>a),u=(f,g=l(),_=c)=>{s?.({trace:qU({state:g,context:_,sanitize:i}),state:g,reason:f})},p=f=>{a={...a,...f},e.updateState(f),u("state_update",a)},d=RU({...o,getState:l,updateState:p});let h=0;for(;l().currentStep!=="complete"&&h<t;){h+=1;const f=l();if(f.currentStep==="authorization_request"){if(!f.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:f.authorizationUrl,state:l(),error:{message:"Authorization request requires an authorization handler."}};try{const y=await r({authorizationUrl:f.authorizationUrl,state:f});if(y.type==="redirect")return u("redirect"),{completed:!1,redirected:!0,authorizationUrl:f.authorizationUrl,state:l()};p({currentStep:"received_authorization_code",authorizationCode:y.authorizationCode,error:void 0});continue}catch(y){return p({error:$l(y).message}),{completed:!1,redirected:!1,authorizationUrl:f.authorizationUrl,state:l(),error:$l(y)}}}const g=f.currentStep;try{await d.proceedToNextStep()}catch(y){return l().error?u("error"):p({error:$l(y).message}),{completed:!1,redirected:!1,state:l(),error:$l(y)}}const _=l();if(_.currentStep===g)return _.error?u("error",_):p({error:`Step ${g} did not advance.`}),{completed:!1,redirected:!1,state:l(),error:{message:l().error||`Step ${g} did not advance.`}}}const m=l();return h>=t&&m.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(m.currentStep==="complete"?"complete":"state_update"),{completed:m.currentStep==="complete",redirected:!1,authorizationUrl:m.authorizationUrl,state:m,...m.error?{error:{message:m.error}}:{}})}function M7(e){const t=HU(e.endsWith(" Configure a pre-registered client or enable DCR on the authorization server.")?e.slice(0,-(vu.length+1)):e).slice(0,FU);return ID(t)??KU(t)}var zU=160,FU=4e3,jU=46;function HU(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===jU;)t-=1;return t===e.length?e:e.slice(0,t)}var BU=[[/(\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"]],VU=/(?<![\w:.])(?:[0-9a-f]{0,4}:){2,7}[0-9a-f]{0,4}(?![\w:])/gi,GU=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g;function KU(e){return BU.reduce((t,[r,s])=>t.replace(r,s),e.replace(/\bhttps?:\/\/[^\s"'<>)]+/g,"<url>")).replace(VU,"<ip>").replace(GU,"<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,zU)}var WU="xaa-idp-1",JU=["none","private_key_jwt"],L7="none";function N7(e){return typeof e=="string"&&JU.includes(e)?e:void 0}var YU=["valid","bad_signature","wrong_audience","expired","missing_claims","invalid_type_header","wrong_issuer","resource_mismatch","client_id_mismatch","unknown_kid","unknown_sub","scope_denial"],XU="valid";function $7(e){return typeof e=="string"&&YU.includes(e)}var QU=["oidc","saml"],ZU="oidc";function D7(e){return typeof e=="string"&&QU.includes(e)?e:void 0}var eq="oauth-sub";function U7(e){return e==="unknown_sub"||e==="scope_denial"}var Wy={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 OE(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 tq=["oauth-authorization-server","openid-configuration"];function rq(e){return OE(e,"oauth-protected-resource",!0)}function sq(e){return tq.flatMap(t=>OE(e,t))}function nq(e){return[e.targetKey,e.registrationEndpoint,e.scope??""].map(encodeURIComponent).join("::")}function Jp(e,t=Math.floor(Date.now()/1e3)){return!!e.clientSecret&&typeof e.clientSecretExpiresAt=="number"&&e.clientSecretExpiresAt!==0&&e.clientSecretExpiresAt<=t}var iq={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:XU,identityAssertionFormat:ZU,subjectIdentifierFormat:eq,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 Jy(e={}){return{...iq,...e,negativeTestMode:e.negativeTestMode??"valid",identityAssertionFormat:e.identityAssertionFormat??"oidc",subjectIdentifierFormat:e.subjectIdentifierFormat??"oauth-sub",httpHistory:e.httpHistory??[],infoLogs:e.infoLogs??[]}}function oq(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 aq={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 cq(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 ${jg}. 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 ${zg} — 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=oq(e.issuer),u=aq[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 lq(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 _u="••••••••",uq=new Set(["authorization","proxyauthorization","clientsecret","clientassertion","identityassertion","assertion","idtoken","idjag","accesstoken","refreshtoken","subjecttoken","actortoken"]);function dq(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function pq(e,t=[]){const r=n=>{let i=n;for(const o of t)o&&o!=="••••••••"&&(i=i.split(o).join(_u));return i.replace(/(\b(?:proxy-)?authorization\s*[:=]\s*)(?:bearer|basic)\s+[^\s,;"'}]+/gi,`$1${_u}`)},s=(n,i)=>i&&uq.has(dq(i))?n==="••••••••"||n==="***REDACTED***"||n==="[REDACTED]"?n:_u: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 hq=["lastRequest","lastResponse","httpHistory","infoLogs","error"];function fq(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 hq)n in s&&(s[n]=pq(s[n],r));return s}function mq(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 gq(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 Yp(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 vq(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 ln(e,t){return Bg(e)??t}var _q=["access_denied","invalid_target","invalid_client","invalid_scope","temporarily_unavailable"];function Yy(e){return e?e.split(/\s+/).filter(Boolean):[]}function Xy(e){const t=e&&typeof e=="object"?e.error:void 0,r=_q.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 Qy(e,t){const r=typeof e=="string"?e:t,s=new Set(Yy(r));return{outcome:Yy(t).some(n=>!s.has(n))?"downscoped":"granted",...t?{requestedScope:t}:{},...r!==void 0?{grantedScope:r}:{}}}function Xn(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} did not return a JSON object`);return e}function Zy(e){return typeof e=="number"?`${e} (${Xe(e)})`:e===void 0?"(missing)":e===null?"null":typeof e=="object"?JSON.stringify(e):String(e)}function yq(e,t){const r=EE(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:Zy(u),actual:Zy(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",WU,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 bq=32;function q7(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:m,negativeTestMode:f,identityAssertionFormat:g,subjectIdentifierFormat:_,userId:y,email:E,clientId:P,clientSecret:I,scope:M,authzServerIssuer:$,registrationId:O,serverId:B,projectId:le,registrationStrategy:ie="preregistered",dcrCredentialCache:C,dcrCacheTargetKey:fe,clientIdMetadataUrl:X,allowLoopbackClientMetadata:me}=e,q=O||B?"preregistered":ie,ue=a==="hosted"?{issuerMode:a,...c?{organizationId:c}:{},...d==="anonymous"?{issuerKind:"anonymous"}:{}}:{},b=l?{"x-mcpjam-policy-mode":l,...u?{"x-mcpjam-test-identity-id":u}:{},...p?{"x-mcpjam-resource-app-id":p}:{}}:{},ee=l?{policyMode:l,...u?{testIdentityId:u}:{},...p?{resourceAppId:p}:{}}:{},ne=t??{},H={state:Jy({...ne,serverUrl:ne.serverUrl||n,resourceUrl:ne.resourceUrl||n,issuerBaseUrl:ne.issuerBaseUrl||i,negativeTestMode:ne.negativeTestMode||f,identityAssertionFormat:ne.identityAssertionFormat||g,subjectIdentifierFormat:ne.subjectIdentifierFormat||_,userId:ne.userId||y,email:ne.email||E,clientId:ne.clientId||P,clientSecret:ne.clientSecret||I,scope:ne.scope||M,authzServerIssuer:ne.authzServerIssuer||$,registrationStrategy:q}),updateState:A=>{const v=fq(H.state,A);H.state={...H.state,...v},s(v)},proceedToNextStep:async()=>{},runAll:async()=>{},resetFlow:()=>{}},R=()=>r?.()??H.state,te=(A,v,T,k,x)=>{H.updateState({infoLogs:mq(R(),A,v,T,k,x)})},ae=async(A,v,T)=>{H.updateState({currentStep:A,isBusy:!0,error:void 0,negativeProbe:void 0,lastRequest:v,lastResponse:void 0});const k=Date.now();try{const x=await T(),F={status:x.status,statusText:x.statusText,headers:x.headers,body:x.body};return H.updateState({isBusy:!1,lastResponse:F,httpHistory:[...R().httpHistory||[],{step:A,timestamp:k,duration:Date.now()-k,request:v,response:F}]}),x}catch(x){const F=gq(x);throw H.updateState({isBusy:!1,error:F.message,httpHistory:[...R().httpHistory||[],{step:A,timestamp:k,duration:Date.now()-k,request:v,error:F}]}),te(A,`${A}-error-${k}`,"Request failed",v,{level:"error",error:F}),x}},he=async()=>{const A=R(),v=A.serverUrl||n;if(A.authzServerIssuer){H.updateState({currentStep:"discover_resource_metadata",resourceUrl:A.resourceUrl||v,error:void 0}),te("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 T=rq(v);let k="Failed to discover resource metadata";for(const x of T){const F={method:"GET",url:x,headers:{Accept:"application/json"}};try{const z=await ae("discover_resource_metadata",F,()=>m.externalRequest(x,F));if(!z.ok){k=ln(z.body,`Resource metadata request failed with ${z.status}`);continue}const L=Xn(z.body,"Resource metadata"),G=v,K=typeof L.resource=="string"?L.resource:void 0;if(!K||K!==G){k=`Protected-resource metadata at ${x} does not identify ${G}.`;continue}const Ie=K,Ue=Array.isArray(L.authorization_servers)?L.authorization_servers[0]:void 0;if(!Ue)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:x,resourceMetadata:L,resourceUrl:Ie,authzServerIssuer:Ue,error:void 0});return}catch(z){k=z instanceof Error?z.message:"Failed to discover resource metadata"}}H.updateState({currentStep:"discover_resource_metadata",error:k})},de=()=>{H.updateState({currentStep:"received_resource_metadata",error:void 0});const A=R();if(!A.resourceMetadata){te("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}te("received_resource_metadata","xaa-resource-metadata","Resource metadata",{resource:A.resourceUrl,authorization_servers:A.resourceMetadata?.authorization_servers})},Ke=async()=>{const A=R(),v=A.authzServerIssuer;if(O||B||A.tokenEndpoint){H.updateState({currentStep:"discover_authz_metadata",error:void 0}),te("discover_authz_metadata","xaa-authz-metadata-skipped-request","Authorization metadata discovery skipped",{reason:O?"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(!v){H.updateState({currentStep:"discover_authz_metadata",error:"Authorization Server issuer is missing. Configure it manually or retry resource metadata discovery."});return}const T=$?[v]:[...new Set([v,...A.resourceMetadata?.authorization_servers??[]].filter(K=>!!K))];let k="Authorization server metadata discovery failed.";const x=(K,Ie,Ue)=>{H.updateState({currentStep:"discover_authz_metadata",authzMetadata:K,authzServerIssuer:Ie,tokenEndpoint:K.token_endpoint,...q==="preregistered"?{tokenEndpointAuthMethod:lq(A.tokenEndpointAuthMethod,A.clientSecret,K.token_endpoint_auth_methods_supported)}:{},compatibilityReport:Ue??void 0,error:void 0})},F=!A.clientSecret;let z,L;for(const K of T){const Ie=sq(K);for(const Ue of Ie){const xt={method:"GET",url:Ue,headers:Yp(void 0,{Accept:"application/json"})};try{const Ht=await ae("discover_authz_metadata",xt,()=>m.externalRequest(Ue,xt));if(!Ht.ok){k=ln(Ht.body,`Auth server metadata request failed with ${Ht.status}`);continue}const Ar=Xn(Ht.body,"Authorization metadata");if(typeof Ar.token_endpoint!="string")throw new Error("Authorization metadata did not include a token_endpoint.");if(typeof Ar.issuer!="string"||Ar.issuer!==K){k=`Authorization metadata at ${Ue} advertises issuer "${String(Ar.issuer)}", which does not match the requested issuer "${K}".`;continue}const Ot=Ar.issuer,ml=cq({...Ar,issuer:Ot});if(!F){x(Ar,Ot,ml);return}const C_={metadata:Ar,issuer:Ot,report:ml},P_=vq(ml);if(P_===1){x(Ar,Ot,ml);return}P_===2&&!L&&(L=C_),z||(z=C_)}catch(Ht){k=Ht instanceof Error?Ht.message:"Metadata request failed"}}}const G=L??z;if(G){x(G.metadata,G.issuer,G.report);return}H.updateState({currentStep:"discover_authz_metadata",error:k})},Ge=()=>{const A=R().authzMetadata?.registration_endpoint,v=q==="dcr"&&A?C?.get(Pe(A)):void 0;H.updateState({currentStep:"received_authz_metadata",...q==="dcr"?{dcrRegistrationReused:!!(v&&!Jp(v))}:{},error:void 0});const T=R();if(!T.authzMetadata){te("received_authz_metadata","xaa-authz-metadata-skipped","Authorization metadata discovery skipped",{reason:O?"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.",...T.tokenEndpoint?{token_endpoint:T.tokenEndpoint}:{}});return}te("received_authz_metadata","xaa-authz-metadata","Authorization metadata",{issuer:T.authzServerIssuer,token_endpoint:T.authzMetadata?.token_endpoint,grant_types_supported:T.authzMetadata?.grant_types_supported,registration_endpoint:T.authzMetadata?.registration_endpoint,client_id_metadata_document_supported:T.authzMetadata?.client_id_metadata_document_supported,authorization_grant_profiles_supported:T.authzMetadata?.authorization_grant_profiles_supported,compatibility:T.compatibilityReport?{overall:T.compatibilityReport.overall,vendor:T.compatibilityReport.vendor}:void 0})},Pe=A=>nq({targetKey:fe??n,registrationEndpoint:A,scope:R().scope}),V=async()=>{const A=R(),v=A.authzMetadata?.registration_endpoint;if(!v){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 T=Pe(v),k=C?.get(T);if(k&&Jp(k)){C?.delete(T),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}),te("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 x={...ED({tokenEndpointAuthMethod:"client_secret_post"}),...A.scope?{scope:A.scope}:{}},F={method:"POST",url:v,headers:Yp(void 0,{"Content-Type":"application/json"}),body:x};H.updateState({currentStep:"request_client_registration",isBusy:!0,error:void 0,negativeProbe:void 0,dcrRegistrationReused:!1,lastRequest:F,lastResponse:void 0,httpHistory:[...R().httpHistory||[],{step:"request_client_registration",timestamp:Date.now(),request:F}]});const z=await tl({request:F,requestExecutor:Ot=>m.externalRequest(Ot.url,{method:Ot.method,headers:Ot.headers,body:Ot.body}),httpHistory:R().httpHistory}),L=Ot=>{H.updateState({currentStep:"request_client_registration",isBusy:!1,lastResponse:z.response,httpHistory:z.httpHistory,error:Ot,dcrRetryMayCreateDuplicate:!0})};if(z.status!=="registered"){const Ot=z.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.":z.status==="invalid_response"?"The registration response could not be parsed as a client registration.":"The registration request did not reach the authorization server.";L(`${z.error} ${Ot} Switch to pre-registered credentials to continue.`);return}const G=z.credentials.clientId;if(z.missingClientId||!G){L("The registration response is missing a client_id, so the registration is unusable. Switch to pre-registered credentials to continue.");return}const K=[],Ie=Cy(z.clientInfo);if(Ie.profile==="contradicted"){L("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"&&K.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"){L("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"?K.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"&&K.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 Ue=z.clientInfo.token_endpoint_auth_method;let xt;if(Ue===void 0)xt=z.credentials.clientSecret?"client_secret_post":"none",K.push({code:"auth_method_not_echoed",message:z.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(Ue==="client_secret_post"||Ue==="client_secret_basic"||Ue==="none")xt=Ue;else if(typeof Ue=="string"){L(`Registration succeeded, but this debugger cannot use the returned client-auth method ("${Ue}"). This is a debugger limitation, not authorization-server unreadiness.`);return}else{L("The registration returned a non-string token_endpoint_auth_method — a malformed registration response. Switch to pre-registered credentials to continue.");return}const Ht=z.credentials.clientSecret;if((xt==="client_secret_post"||xt==="client_secret_basic")&&!Ht){L(`The registration returned token_endpoint_auth_method "${xt}" without a client_secret — an inconsistent registration response. Switch to pre-registered credentials to continue.`);return}if(xt==="none"&&Ht){L('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(xt==="none"&&K.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."}),Ht){const Ot=z.credentials.clientSecretExpiresAt;if(typeof Ot=="number"&&Ot!==0&&Ot<=Math.floor(Date.now()/1e3)){L("The issued client_secret is already expired. Switch to pre-registered credentials to continue.");return}typeof Ot!="number"&&K.push({code:"missing_secret_expiry",message:"The registration response omitted client_secret_expires_at, which RFC 7591 requires whenever a secret is issued."})}z.nonCanonicalSuccessStatus&&K.push({code:"non_201_success",message:`The registration returned ${z.response.status} instead of the RFC 7591 201 Created.`});const Ar=z.response.headers["content-type"]||"";Ar.includes("json")||K.push({code:"non_json_content_type",message:`The registration response parsed as JSON but was served as "${Ar||"(none)"}".`}),(z.response.headers["cache-control"]||"").includes("no-store")||K.push({code:"missing_no_store",message:"The registration response is missing Cache-Control: no-store, which RFC 7591 requires for responses carrying credentials."}),C?.set(T,{clientId:G,clientSecret:Ht,tokenEndpointAuthMethod:xt,clientSecretExpiresAt:z.credentials.clientSecretExpiresAt,registrationEndpoint:v}),te("received_client_credentials","xaa-dcr","Dynamic Client Registration",z.infoLogData),H.updateState({currentStep:"request_client_registration",clientId:G,tokenEndpointAuthMethod:xt,registrationWarnings:K,dcrRegistrationReused:!1,dcrRetryMayCreateDuplicate:!1,lastResponse:z.response,httpHistory:z.httpHistory,isBusy:!1,error:void 0})},pe=()=>{H.updateState({currentStep:"received_client_credentials",error:void 0})},ye=async()=>{const A=R().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 v;try{v=Zg(X??"https://app.mcpjam.com/.well-known/oauth/xaa-client-metadata.json",{allowLoopback:me===!0})}catch(Ue){H.updateState({currentStep:"fetch_client_metadata_document",isBusy:!1,error:Ue instanceof Error?Ue.message:"Invalid client metadata URL"});return}const T={method:"GET",url:v,headers:Yp(void 0,{Accept:"application/json"})};let k;try{k=await ae("fetch_client_metadata_document",T,()=>m.externalRequest(v,{method:"GET",headers:T.headers,redirect:"manual"},{enforcePublicHost:!(me===!0&&rU(v))}))}catch{return}const x=Ue=>{H.updateState({currentStep:"fetch_client_metadata_document",error:`${Ue} This is a document preflight/validation failure; retry freely or switch strategy.`})};if(k.status!==200){x(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 F=k.headers["content-type"]||"",z=F.split(";",1)[0].trim().toLowerCase();if(!(z==="application/json"||/^application\/[a-z0-9][a-z0-9!#$&^_.+-]*\+json$/.test(z))){x(`The client metadata document was served as "${F||"(none)"}", not a JSON media type.`);return}const L=k.body;if(!L||typeof L!="object"||Array.isArray(L)){x("The client metadata document body is not a JSON object.");return}if(L.client_id!==v){x("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 G=Cy(L);if(G.profile!=="present"||G.jwtBearerGrant!=="present"||G.tokenExchangeGrant!=="present"){x("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 K=G.tokenEndpointAuthMethod??"none";if(K.startsWith("client_secret")){x("The client metadata document declares a shared-secret auth method, which CIMD draft-02 forbids — the document is malformed.");return}if(K!=="none"&&K!=="private_key_jwt"){x(`The client metadata document declares an unsupported token_endpoint_auth_method "${K}".`);return}const Ie=K==="private_key_jwt";te("received_client_metadata","xaa-cimd","Client ID Metadata Document ready",{"Client ID":v,"Client Name":L.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:v,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})},He=async()=>{const A=R(),v=y??A.userId,T=E??A.email,k=A.identityAssertionFormat,x={method:"POST",url:`${o}/authenticate`,headers:{"Content-Type":"application/json"},body:{userId:v,email:T,audience:Ry,resourceClientId:A.clientId,assertionFormat:k,...ue}};try{const F=await ae("user_authentication",x,()=>m.internalRequest(`${o}/authenticate`,{method:"POST",headers:x.headers,body:JSON.stringify(x.body)}));if(!F.ok)throw new Error(ln(F.body,`Mock authentication failed with ${F.status}`));const z=Xn(F.body,"Authentication response");if(k==="saml"){if(typeof z.assertion!="string")throw new Error("Authentication response did not include an `assertion`. The issuer may not support SAML assertions yet.");const L=z.subject;if(!L||typeof L!="object"||typeof L.issuer!="string"||typeof L.nameid!="string")throw new Error("Authentication response did not include the SAML `subject` metadata.");H.updateState({currentStep:"user_authentication",identityAssertion:z.assertion,identityAssertionSubject:{issuer:L.issuer,nameid:L.nameid,...typeof L.nameidFormat=="string"?{nameidFormat:L.nameidFormat}:{},...typeof L.spNameQualifier=="string"?{spNameQualifier:L.spNameQualifier}:{}},userId:v,email:T,error:void 0});return}if(typeof z.id_token!="string")throw new Error("Authentication response did not include an `id_token`.");H.updateState({currentStep:"user_authentication",identityAssertion:z.id_token,userId:v,email:T,error:void 0})}catch(F){H.updateState({currentStep:"user_authentication",error:F instanceof Error?F.message:"Mock authentication failed"})}},Oe=()=>{const A=R();if(H.updateState({currentStep:"received_identity_assertion",error:void 0}),A.identityAssertionFormat==="saml"){te("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}te("received_identity_assertion","xaa-identity-assertion","Identity assertion issued",{userId:A.userId,email:A.email})},Le=async()=>{const A=R();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 v=A.negativeTestMode==="valid"&&h,T=A.identityAssertionFormat,k=A.subjectIdentifierFormat;try{if(T==="saml"&&A.negativeTestMode==="valid"&&!v)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(v){const L={grant_type:Fg,requested_token_type:Iy,subject_token:A.identityAssertion,subject_token_type:T==="saml"?kD:SD,client_id:Ry,audience:A.authzServerIssuer,...A.resourceUrl||A.serverUrl?{resource:A.resourceUrl||A.serverUrl}:{},...A.scope?{scope:A.scope}:{},...k==="saml-nameid"?{subject_id_format:k}:{}},G={method:"POST",url:`${o}/token`,headers:{"Content-Type":"application/x-www-form-urlencoded"},body:L},K=a==="hosted"?{"x-mcpjam-issuer-mode":"hosted",...c?{"x-mcpjam-organization-id":c}:{},...d==="anonymous"?{"x-mcpjam-issuer-kind":"anonymous"}:{}}:{},Ie=await ae("token_exchange_request",G,()=>m.internalRequest(`${o}/token`,{method:"POST",headers:{...G.headers,...K,...b},body:new URLSearchParams(L).toString()}));if(!Ie.ok)throw l&&H.updateState({idpPolicy:Xy(Ie.body)}),new Error(ln(Ie.body,`Token exchange failed with ${Ie.status}`));const Ue=Xn(Ie.body,"Token exchange response");if(typeof Ue.access_token!="string")throw new Error("Token exchange response did not include an `access_token`.");te("received_id_jag","xaa-id-jag","ID-JAG issued",{negativeTestMode:A.negativeTestMode,expectedFailure:Wy[A.negativeTestMode].expectedFailure,issued_token_type:Ue.issued_token_type,token_type:Ue.token_type}),Ue.issued_token_type!=="urn:ietf:params:oauth:token-type:id-jag"&&te("received_id_jag","xaa-id-jag-issued-token-type","Unexpected issued_token_type",{expected:Iy,actual:Ue.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:Ue.access_token,idJagDecoded:null,...l?{idpPolicy:Qy(Ue.scope,A.scope)}:{},error:void 0});return}const x={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:T,subjectIdFormat:k,...ue,...ee}},F=await ae("token_exchange_request",x,()=>m.internalRequest(`${o}/token-exchange`,{method:"POST",headers:x.headers,body:JSON.stringify(x.body)}));if(!F.ok)throw l&&H.updateState({idpPolicy:Xy(F.body)}),new Error(ln(F.body,`Token exchange failed with ${F.status}`));const z=Xn(F.body,"Token exchange response");if(typeof z.id_jag!="string")throw new Error("Token exchange response did not include an `id_jag`.");H.updateState({currentStep:"token_exchange_request",idJag:z.id_jag,idJagDecoded:null,...l?{idpPolicy:Qy(z.scope,A.scope)}:{},error:void 0})}catch(x){H.updateState({currentStep:"token_exchange_request",error:x instanceof Error?x.message:"Token exchange failed"})}},Ee=()=>{H.updateState({currentStep:"received_id_jag",error:void 0});const A=R();A.negativeTestMode==="valid"&&h||te("received_id_jag","xaa-id-jag","ID-JAG issued",{negativeTestMode:A.negativeTestMode,expectedFailure:Wy[A.negativeTestMode].expectedFailure})},Ae=()=>{const A=R();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 v=yq(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:v,issuerBaseUrl:i,error:void 0}),te("inspect_id_jag","xaa-id-jag-inspection","ID-JAG inspection",{issues:v.issues,mode:A.negativeTestMode})},Ne=async()=>{const A=R();if(!A.idJag||!A.tokenEndpoint&&!O&&!B){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 v=A.clientSecret,T=A.tokenEndpointAuthMethod;if(!O&&!B)if(q==="dcr"){const z=A.authzMetadata?.registration_endpoint,L=z?Pe(z):void 0,G=L?C?.get(L):void 0;if(!G||G.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(Jp(G)){L&&C?.delete(L),H.updateState({currentStep:"jwt_bearer_request",error:"This session's dynamic client secret has expired. Register another client to continue.",dcrRetryMayCreateDuplicate:!0});return}v=G.clientSecret,T=G.tokenEndpointAuthMethod}else q==="cimd"&&(v=void 0,T=A.tokenEndpointAuthMethod??"none");const k=A.idpPolicy?.grantedScope??A.scope,x=O?{registrationId:O,assertion:A.idJag,scope:k,resource:A.resourceUrl||A.serverUrl}:B?{serverId:B,...le?{projectId:le}:{},assertion:A.idJag,scope:k,resource:A.resourceUrl||A.serverUrl}:{tokenEndpoint:A.tokenEndpoint,assertion:A.idJag,clientId:A.clientId,...v?{clientSecret:v}:{},...T?{tokenEndpointAuthMethod:T}:{},...T==="private_key_jwt"&&c?{organizationId:c}:{},scope:k,resource:A.resourceUrl||A.serverUrl},F={method:"POST",url:"/proxy/token",headers:{"Content-Type":"application/json"},body:"clientSecret"in x?{...x,clientSecret:_u}:x};try{const z=await ae("jwt_bearer_request",F,()=>m.internalRequest("/proxy/token",{method:"POST",headers:F.headers,body:JSON.stringify(x)}));if(!z.ok)throw new Error(ln(z.body,`JWT bearer proxy failed with ${z.status}`));const L=Xn(z.body,"JWT bearer response"),G=typeof L.status=="number"?L.status:void 0,K=L.body;if(!G||G<200||G>=300){if(A.negativeTestMode!=="valid"&&typeof G=="number"){H.updateState({currentStep:"jwt_bearer_request",error:void 0,negativeProbe:{outcome:"rejected",status:G}}),te("jwt_bearer_request","xaa-negative-rejected","Authorization server correctly rejected the broken assertion",{status:G,mode:A.negativeTestMode});return}const Ue=ln(K,`Authorization server returned ${L.status??"an unknown status"}.`);H.updateState({currentStep:"jwt_bearer_request",error:`${Ue} Does the authorization server trust the synthetic issuer JWKS and support \`urn:ietf:params:oauth:grant-type:jwt-bearer\`?`}),te("jwt_bearer_request","xaa-jwt-bearer-failure","JWT bearer request failed",{status:L.status,body:K},{level:"error"});return}const Ie=Xn(K,"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(z){H.updateState({currentStep:"jwt_bearer_request",error:z instanceof Error?z.message:"JWT bearer request failed"})}},tt=()=>{const A=R();if(A.negativeTestMode!=="valid"){const v=A.lastResponse?.body,T=v&&typeof v=="object"&&typeof v.status=="number"?v.status:void 0;H.updateState({currentStep:"received_access_token",error:void 0,negativeProbe:{outcome:"accepted",status:T}}),te("received_access_token","xaa-negative-accepted","Authorization server issued a token for a broken assertion",{status:T,mode:A.negativeTestMode},{level:"error"});return}H.updateState({currentStep:"received_access_token",error:void 0})},J=async()=>{const A=R();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 v=vx(A.accessToken),T={method:"POST",url:A.serverUrl,headers:v.headers,body:v.body};try{const k=await ae("authenticated_mcp_request",T,()=>m.externalRequest(A.serverUrl,{method:"POST",headers:v.headers,body:JSON.stringify(v.body)}));if(!k.ok){H.updateState({currentStep:"authenticated_mcp_request",error:ln(k.body,`Authenticated MCP request failed with ${k.status}`)});return}const x=Ax(k.body);if(x){H.updateState({currentStep:"authenticated_mcp_request",error:x});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"})}},oe=()=>{H.updateState({currentStep:"complete",error:void 0});const A=R();te("complete","xaa-authenticated-mcp","Authenticated MCP response",{status:A.lastResponse?.status,xaa_extension:lx(A.lastResponse?.body),body:A.lastResponse?.body})};return H.proceedToNextStep=async()=>{const A=R().currentStep;if(!R().negativeProbe)switch(A){case"idle":await he();return;case"discover_resource_metadata":R().error?await he():de();return;case"received_resource_metadata":await Ke();return;case"discover_authz_metadata":R().error?await Ke():Ge();return;case"received_authz_metadata":if(q==="dcr"){await V();return}if(q==="cimd"){await ye();return}await He();return;case"request_client_registration":R().error||!R().clientId?await V():pe();return;case"fetch_client_metadata_document":R().error||!R().clientId?await ye():ke();return;case"received_client_credentials":case"received_client_metadata":await He();return;case"user_authentication":R().error?await He():Oe();return;case"received_identity_assertion":await Le();return;case"token_exchange_request":R().error?await Le():Ee();return;case"received_id_jag":Ae();return;case"inspect_id_jag":await Ne();return;case"jwt_bearer_request":R().error?await Ne():tt();return;case"received_access_token":await J();return;case"authenticated_mcp_request":R().error?await J():oe();return;case"complete":return;default:throw new Error(`Unhandled XAA flow step: ${A}`)}},H.runAll=async()=>{const A=bq;for(let v=0;v<A;v+=1){const T=R();if(T.currentStep==="complete"||T.error||T.negativeProbe)return;await H.proceedToNextStep();const k=R();if(k.error||k.currentStep==="complete"||k.negativeProbe||k.currentStep===T.currentStep&&(k.httpHistory?.length??0)===(T.httpHistory?.length??0))return}},H.resetFlow=()=>{H.updateState(Jy({serverUrl:R().serverUrl||n,resourceUrl:R().serverUrl||n,issuerBaseUrl:R().issuerBaseUrl||i,negativeTestMode:R().negativeTestMode||f,identityAssertionFormat:R().identityAssertionFormat||g,subjectIdentifierFormat:R().subjectIdentifierFormat||_,userId:R().userId||y,email:R().email||E,clientId:R().clientId||P,scope:R().scope||M,authzServerIssuer:R().authzServerIssuer||$,registrationStrategy:q}))},H}var z7=["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"],Mf={"2025-03-26":"legacy","2025-06-18":"legacy","2025-11-25":"legacy","2026-07-28":"modern"},F7=Object.keys(Mf),j7={"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"]},H7=["debug","info","notice","warning","error","critical","alert","emergency"],B7=["readiness-tool-order-deterministic","readiness-deprecated-feature-use","readiness-session-termination","readiness-protocol-version-header-required","readiness-tool-name-conventions","readiness-log-level-filtering"],V7={"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"]},wq=["dispatch","creation","lifecycle"],Sq=["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"],kq=["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 Eq(e){return kq.some(t=>t===e)}var G7={"tasks-input-required-update-completes":"tasks-update-ack-shape"},K7=["tasks-readiness-failed-status-message","tasks-readiness-unknown-task-id-mutations"],Tq={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."]}},W7=["readiness-oauth-iss-advertised"],Aq="authorizationRequired";function J7(e){return e.details?.[Aq]===!0}var Iq=Ix(),Rq={"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 Cq(e){return Rq[e]}function Pq(e){const t=JSON.stringify({id:e.id,version:e.version,scored:[...e.scored].sort()});return NM(KM($M(t)))}var eb=new WeakMap;function xq(e){const t=eb.get(e);if(t!==void 0)return t;const r=Pq(e);return eb.set(e,r),r}function ME(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 LE(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 Oq(e){const{pending:t}=ME(e.checks,e.profile);return{profileId:e.profile.id,profileVersion:e.profile.version,manifestDigest:xq(e.profile),checkerVersion:Iq,...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 ev(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 tv(e,t=[],r,s){const{scored:n,pending:i}=LE(e,s),o={passed:n.filter(c=>c.status==="passed").length,failed:n.filter(c=>c.status==="failed").length,couldNotRun:n.filter(_d).length,notApplicable:n.filter(gS).length,pending:i.length},{outcome:a}=vS(n);return ev(o,t,a,r,o.passed+o.failed+o.couldNotRun-n.filter(fS).length)}function rv(e){const t={passed:Yi(e,a=>a.passed),failed:Yi(e,a=>a.failed),couldNotRun:Yi(e,a=>a.couldNotRun),notApplicable:Yi(e,a=>a.notApplicable),pending:Yi(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 ev(t,r,n,i.length>0&&o.size===1?[...o][0]:void 0,Yi(e,a=>a.applicable))}function Yi(e,t){return e.reduce((r,s)=>r+t(s),0)}function tb(e){return tv(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 NE(e,t,r,s=[]){const{scored:n}=LE(e,r),i=new Set(n.map(o=>o.id));return tv(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 rb(e){return NE(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 Mq(e){return NE(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 $E(e){return(e??[]).filter(t=>Object.prototype.hasOwnProperty.call(Tq,t))}function sb(e,t){const r=$E(t?.unscoredCheckIds);if(e.outcome==="not-applicable"){const s=new Set(r),n=e.steps.filter(i=>s.has(i.step)).length;return ev({passed:0,failed:0,couldNotRun:0,notApplicable:e.steps.length-n,pending:n},[],"passed",e.protocolVersion)}return tv(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 Lq=8;function DE(e){return Hs(e,0,new WeakSet)}function Hs(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>=Lq)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=>Hs(i,t+1,r)??null);if(s instanceof Map)return[...s.entries()].map(([i,o])=>[Hs(i,t+1,r)??null,Hs(o,t+1,r)??null]);if(s instanceof Set)return[...s].map(i=>Hs(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=Hs(i.code,t+1,r)),i.statusCode!==void 0&&(n.statusCode=Hs(i.statusCode,t+1,r)),i.cause!==void 0&&(n.cause=Hs(i.cause,t+1,r))}for(const[i,o]of Object.entries(s)){const a=Hs(o,t+1,r);a!==void 0&&(n[i]=a)}return n}finally{r.delete(s)}}function Li(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:DE(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 UE(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Lo(e){const t=Object.entries(e).filter(([,r])=>r===void 0?!1:Array.isArray(r)?r.length>0:UE(r)?Object.keys(r).length>0:!0);if(t.length!==0)return DE(Object.fromEntries(t))}function Nq(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(`
|
|
134
|
+
`)}function $q(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:Lo({details:e.details,errorDetails:e.error?.details})}:{}}}function Dq(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:Lo({details:e.details,errorDetails:e.error?.details,warnings:e.warnings})}:{}}}function Uq(e,t){const r=Nq(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:Lo({errorDetails:e.error?.details,warnings:e.warnings,teachableMoments:e.teachableMoments})}:{},...r?{output:r}:{}}}function Vo(e){const t=e.outcome;return t!=="passed"&&t!=="failed"&&t!=="incomplete"?{}:{outcome:t,...e.incompleteReason?{incompleteReason:e.incompleteReason}:{}}}function sv(e){const t=e.map(r=>Vo(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=>Vo(s).outcome==="incomplete");return{outcome:"incomplete",...r?.incompleteReason?{incompleteReason:r.incompleteReason}:{}}}return{outcome:"passed"}}function nb(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=>$q(n,s))})()}}function Lf(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=>Dq(i,n))}}function ib(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=>Uq(i,s))}}function qq(e){return"checks"in e&&!("results"in e)&&"serverUrl"in e&&!("target"in e)}function zq(e){return"checks"in e&&!("results"in e)&&"target"in e}function Fq(e){return"checks"in e&&!("results"in e)&&"discovery"in e&&UE(e.discovery)&&"wire"in e.discovery}function jq(e){return"steps"in e&&!("results"in e)}function Hq(e){return"results"in e&&"serverUrl"in e&&!("target"in e)&&e.results.length>0&&"checks"in e.results[0]}function Bq(e){return"results"in e&&"target"in e}function Vq(e){return"results"in e&&"serverUrl"in e&&!("target"in e)&&e.results.length>0&&"steps"in e.results[0]}function Gq(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 Kq(e){return"results"in e?{schemaVersion:1,kind:"protocol-conformance",name:e.name,passed:e.passed,...sv(e.results),score:rv(e.results.map(tb)),...Gq(e.results),durationMs:e.durationMs,groups:e.results.map((t,r)=>nb(t,t.label,r)),...Li(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,...Vo(e),score:tb(e),...e.profile?{profile:e.profile}:{},durationMs:e.durationMs,groups:[nb(e,"MCP Protocol Conformance",0)],...Li([{readiness:e.readiness,passedAdvice:e.passedAdvice,group:"mcp-1"}])}}function Wq(e){return"results"in e?{schemaVersion:1,kind:"apps-conformance",name:e.name,passed:e.passed,...sv(e.results),score:rv(e.results.map(rb)),durationMs:e.durationMs,groups:e.results.map((t,r)=>Lf(t,t.label,r)),...Li(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,...Vo(e),score:rb(e),durationMs:e.durationMs,groups:[Lf(e,"MCP Apps Conformance",0)],...Li([{readiness:e.readiness,passedAdvice:e.passedAdvice,group:"apps-1"}])}}function ob(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 Jq(e,t){const r=$E(t?.oauthUnscoredCheckIds),s=new Set(r),n=s.size>0,i={unscoredCheckIds:r};if("results"in e){const c=e.results.map(p=>sb(p,i)),l=e.results.map((p,d)=>ob(p,c[d],n)),u=sv(l);return{schemaVersion:1,kind:"oauth-conformance",name:e.name,passed:n?u.outcome==="passed":e.passed,...u,score:rv(c),durationMs:e.durationMs,groups:e.results.map((p,d)=>ib(p,p.label,d,s,l[d].passed)),...Li(e.results.map((p,d)=>({readiness:p.readiness,passedAdvice:p.passedAdvice,group:`oauth-${d+1}`})))}}const o=sb(e,i),a=ob(e,o,n);return{schemaVersion:1,kind:"oauth-conformance",name:"OAuth Conformance",passed:a.passed,...Vo(a),score:o,durationMs:e.durationMs,groups:[ib(e,`${e.protocolVersion}/${e.registrationStrategy}`,0,s,a.passed)],...Li([{readiness:e.readiness,passedAdvice:e.passedAdvice,group:"oauth-1"}])}}function Yq(e){return"lanes"in e&&"findings"in e&&"badges"in e&&!("readinessKind"in e)}var Xq={kind:"claude-directory-readiness",providerName:"Claude Directory Readiness",isResult:Yq,isDispositive:e=>WM(e)};function Qq(e){return e.status==="violated"?"failed":e.status==="satisfied"?"passed":"skipped"}function Zq(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:Lo({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:Qq(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:Lo({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:Lo({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 ez={kind:"openai-directory-readiness",providerName:"OpenAI Plugin Directory Readiness",isResult:e=>QM(e),isDispositive:e=>cg(e)},tz={kind:"muse-directory-readiness",providerName:"Muse Directory Readiness",isResult:e=>kN(e),isDispositive:e=>cg(e)},rz=[ez,tz,Xq];function sz(e){return rz.find(t=>t.isResult(e))}function Y7(e,t){const r=sz(e);if(r)return Zq(e,r);if(qq(e)||Hq(e))return Kq(e);if(Fq(e))return{schemaVersion:1,kind:"tasks-conformance",name:"MCP Tasks Conformance",passed:e.passed,...Vo(e),score:Mq(e),...e.profile?{profile:e.profile}:{},durationMs:e.durationMs,groups:[Lf(e,"MCP Tasks Conformance",0,"tasks")],...Li([{readiness:e.readiness,passedAdvice:e.passedAdvice,group:"tasks-1"}])};if(zq(e)||Bq(e))return Wq(e);if(jq(e)||Vq(e))return Jq(e,t);throw new Error("Unsupported conformance result shape")}var nz=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 iz(e){return e.replace(/[^a-z0-9]/gi,"").toLowerCase()}var X7=new Set([...nz].map(iz)),Ks="https://modelcontextprotocol.io/specification/2025-11-25",dt="https://modelcontextprotocol.io/specification/2026-07-28",Qn="https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx",cr="https://github.com/modelcontextprotocol/ext-tasks/blob/main/specification/2026-07-28/tasks.md",un=`${Ks}/basic/utilities/tasks`,fs=`${Ks}/basic/transports`,Xi=`${dt}/basic/transports/streamable-http`,Ca=`${Ks}/basic/authorization`,Pa=`${dt}/basic/authorization`,Xp="https://www.rfc-editor.org/rfc/rfc6749";function Qi(e){return{legacy:`${Ks}${e}`,modern:`${dt}${e}`}}function ys(e){return{legacy:e,modern:e}}var oz={"server-initialize":{legacy:`${Ks}/basic/lifecycle#initialization`},ping:{legacy:`${Ks}/basic/utilities/ping`},"logging-set-level":{legacy:`${Ks}/server/utilities/logging`},"completion-complete":Qi("/server/utilities/completion"),"capabilities-consistent":{legacy:`${Ks}/basic/lifecycle#capability-negotiation`,modern:`${dt}/server/discover`},"tools-list":Qi("/server/tools#listing-tools"),"tools-input-schemas-valid":Qi("/server/tools#tool"),"tools-x-mcp-header-declarations-valid":{modern:`${dt}/server/tools#x-mcp-header`},"prompts-list":Qi("/server/prompts#listing-prompts"),"resources-list":Qi("/server/resources#listing-resources"),"protocol-invalid-method-error":{legacy:`${Ks}/basic/index#error-responses`,modern:`${dt}/basic/index#error-codes`},"localhost-host-rebinding-rejected":{legacy:`${fs}#security-warning`},"localhost-host-valid-accepted":{legacy:`${fs}#security-warning`},"server-sse-polling-session":{legacy:`${fs}#session-management`},"server-accepts-multiple-post-streams":{legacy:`${fs}#multiple-connections`},"server-sse-streams-functional":{legacy:`${fs}#listening-for-messages-from-the-server`},"notification-post-accepted":{legacy:`${fs}#sending-messages-to-the-server`},"get-stream-or-405":{legacy:`${fs}#listening-for-messages-from-the-server`},"session-id-visible-ascii":{legacy:`${fs}#session-management`},"post-response-content-type":{legacy:`${fs}#sending-messages-to-the-server`,modern:`${Xi}#sending-messages`},"modern-client-handshake":{modern:`${dt}/basic/versioning#protocol-version-negotiation`},"modern-server-discover":{modern:`${dt}/server/discover`},"modern-result-type-present":{modern:`${dt}/basic/index#result-responses`},"modern-cacheable-result-hints":{modern:`${dt}/server/utilities/caching#cacheable-results`},"modern-cache-hint-coverage":{modern:`${dt}/server/utilities/caching#cacheable-results`},"modern-cache-hint-values-valid":{modern:`${dt}/server/utilities/caching#cacheable-model`},"modern-cache-scope-stable-across-pages":{modern:`${dt}/server/utilities/caching#interaction-with-pagination`},"modern-protocol-version-header-mismatch":{modern:`${Xi}#server-validation`},"modern-method-header-mismatch":{modern:`${Xi}#server-validation`},"modern-name-header-mismatch":{modern:`${Xi}#server-validation`},"modern-unsupported-version-error":{modern:`${dt}/basic/versioning#protocol-version-negotiation`},"modern-missing-method-header-rejected":{modern:`${Xi}#standard-request-headers`},"modern-header-names-case-insensitive":{modern:`${Xi}#case-sensitivity`},"modern-undeclared-capability-error":{modern:`${dt}/basic/index#error-codes`},"modern-no-session-id":{modern:`${dt}/basic/index#statelessness`},"modern-removed-methods-not-found":{modern:`${dt}/deprecated#removed`},"modern-resource-not-found-invalid-params":{modern:`${dt}/server/resources#error-handling`},"modern-resource-read-no-empty-contents":{modern:`${dt}/server/resources#error-handling`},"modern-tool-output-schema-conformant":{modern:`${dt}/server/tools#output-schema`},"modern-logs-require-log-level":{modern:`${dt}/server/utilities/logging#per-request-log-level`},"modern-subscription-ack-precedes-notifications":{modern:`${dt}/basic/patterns/subscriptions#acknowledgment`},"modern-subscription-filter-and-tagging":{modern:`${dt}/basic/patterns/subscriptions#notification-filter`},"modern-subscription-graceful-close":{modern:`${dt}/basic/patterns/subscriptions#graceful-closure`},"wire-schema-valid":Qi("/schema")},az={"ui-tools-present":ys(`${Qn}#resource-discovery`),"ui-tool-metadata-valid":ys(`${Qn}#resource-discovery`),"ui-tool-input-schema-valid":ys(`${Qn}#resource-discovery`),"ui-listed-resources-valid":ys(`${Qn}#ui-resource-format`),"ui-resources-readable":ys(`${Qn}#ui-resource-format`),"ui-resource-contents-valid":ys(`${Qn}#ui-resource-format`),"ui-resource-meta-valid":ys(`${Qn}#ui-resource-format`)},cz={"tasks-wire-resolvable":{legacy:`${un}#capabilities`,modern:`${cr}#capability-negotiation`},"tasks-declaration-hygiene":{legacy:`${un}#tool-level-negotiation`,modern:`${cr}#capability-negotiation`},"tasks-result-type-discipline":{legacy:`${un}#creating-tasks`,modern:`${cr}#polymorphic-results`},"tasks-undeclared-creation-refused":{modern:`${cr}#task-creation`},"tasks-undeclared-capability-rejected":{modern:`${cr}#capability-negotiation`},"tasks-ttl-shape":{legacy:`${un}#ttl-and-resource-management`,modern:`${cr}#tasks`},"tasks-inline-result":{legacy:`${un}#result-retrieval`,modern:`${cr}#task-polling`},"tasks-mcp-name-routing":{modern:`${cr}#streamable-http-routing-headers`},"tasks-invalid-task-id-rejected":{legacy:`${un}#protocol-errors`,modern:`${cr}#protocol-errors`},"tasks-status-payload-shape":{legacy:`${un}#task-status`,modern:`${cr}#task-status`},"tasks-cancel-ack-shape":{legacy:`${un}#cancelling-tasks`,modern:`${cr}#task-cancellation`},"tasks-update-ack-shape":{modern:`${cr}#task-update-requests`},"tasks-ttl-integer-shape":{modern:`${cr}#tasks`},"tasks-undeclared-capability-names-requirements":{modern:`${cr}#protocol-errors`}},lz={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:`${Pa}/client-registration#application-type-and-redirect-uri-constraints`},oauth_invalid_client:ys(`${Xp}#section-5.2`),oauth_invalid_authorize_redirect:{legacy:`${Ca}#open-redirection`,modern:`${Pa}/security-considerations#open-redirection`},oauth_invalid_token:{legacy:`${Ca}#token-handling`,modern:`${Pa}#token-handling`},oauth_invalid_redirect:ys(`${Xp}#section-4.1.3`),oauth_token_format:ys(`${Xp}#section-5.1`),oauth_unauthenticated_challenge:{legacy:`${Ca}#protected-resource-metadata-discovery-requirements`,modern:`${Pa}/authorization-server-discovery#protected-resource-metadata-discovery-requirements`},oauth_resource_metadata_challenge:{legacy:`${Ca}#protected-resource-metadata-discovery-requirements`,modern:`${Pa}/authorization-server-discovery#protected-resource-metadata-discovery-requirements`},oauth_stale_session_rejection:{legacy:`${fs}#session-management`}},ab={...oz,...az,...cz,...lz};function uz(e){if(e)return Object.prototype.hasOwnProperty.call(Mf,e)?Mf[e]:void 0}function Q7(e,t){if(!Object.prototype.hasOwnProperty.call(ab,e))return;const r=ab[e];if(r)return uz(t)==="legacy"?r.legacy??r.modern:r.modern??r.legacy}function Z7(e){return Ag(e).enabled}function rc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function dz(e){if(!rc(e))return null;const t=e.apps;if(!rc(t))return null;const r=t.pluginExtensions;if(!rc(r)||typeof r.enabled!="boolean")return null;const s={};if(rc(r.capabilities))for(const n of eg){const i=r.capabilities[n];typeof i=="boolean"&&(s[n]=i)}return{enabled:r.enabled,capabilities:s,behavior:qk(r.behavior)}}function eW(e){const t=dz(e?.mcpProfile),r=Ag(e??{}),s=t?t.enabled:r.enabled,n={};for(const i of eg)n[i]=s&&(t?.capabilities[i]??r.capabilities[i]);return{enabled:s,explicit:t!==null,capabilities:n}}var pz=["openai/elicitation","openai/form"];function tW(e,t){const r={...e??{}};if(t.capabilities.forms)return r;for(const s of["extensions","experimental"]){const n=r[s];if(!rc(n))continue;const i=Object.fromEntries(Object.entries(n).filter(([o])=>!pz.includes(o)));Object.keys(i).length>0?r[s]=i:delete r[s]}return r}var rW=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}),hz=["low","medium","high","xhigh","max"],fz=["minimal","low","medium","high"],qE={"claude-code":[],codex:["low","medium","high","xhigh"],"copilot-cli":[],cursor:[],opencode:[],"claude-web":[],"chatgpt-web":[]};function mz(e,t){switch(e){case"openai":{const r=FE(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 jE(t).includes("high")?"high":void 0;case"google":return HE(t).includes("high")?"high":void 0;default:return}}function gz(e){const t=e.indexOf("/");return t>0?e.slice(0,t):void 0}function sW(e,t,r){if(t==="org")return;const s=r??gz(e);if(s!==void 0)return mz(s,zE(e))}function zE(e){const t=e.indexOf("/");return t>=0?e.slice(t+1):e}function FE(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 jE(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=hz;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 HE(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)?fz:[]}function vz(e,t){const r=zE(t);switch(e){case"openai":return FE(r);case"anthropic":return jE(r);case"google":return HE(r);default:return[]}}var _z=new Set(Pd);function yu(e){const t=new Set(e.filter(r=>_z.has(r)));return Pd.filter(r=>t.has(r))}function nW(e){return yu(qE[e]??[])}function yz(e){if(e.harness!==void 0){const t=new Set(yz({...e,harness:void 0}));return yu((qE[e.harness]??[]).filter(r=>t.has(r)))}switch(e.route){case"hosted":return yu(e.catalogEfforts??[]);case"org":return[];case"orgCloud":case"direct":return yu(vz(e.providerKey,e.modelId))}}function BE(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 iW(e){return e.source==="legacy"?JSON.stringify({source:e.source,modelId:e.modelId,...e.provider!==void 0?{provider:e.provider}:{}}):JSON.stringify(BE(e))}function bz(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 cb(e){const t=wz(e);return t===void 0?e.modelId:`${e.modelId}\0${t}`}function wz(e){if(bz(e))return;const{fallback:t,...r}=BE(e);return JSON.stringify(r)}var lb={none:"None",minimal:"Minimal",low:"Low",medium:"Med",high:"High",xhigh:"X-High",max:"Max"};function Sz(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 ub(e){return e.source==="legacy"?void 0:e.settings}function oW(e,t){const r=t.filter(u=>u.modelId===e.modelId&&cb(u)!==cb(e)),s=u=>ub(u)?.reasoningEffort,n=s(e);if(r.length===0)return n===void 0?[]:[lb[n]];const i=[],o=Sz(e),a=e.source==="legacy"?"legacy":db(e);r.some(u=>(u.source==="legacy"?"legacy":db(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":lb[n]);const l=u=>ub(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 db(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 Qr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function wt(e){return typeof e=="string"&&e.trim().length>0?e:void 0}function Nu(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function kz(e){if(!Qr(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=wt(e.modelId);return o?{source:"legacy",modelId:o,...n}:void 0}if(!fL(s))return;const i=VE(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 VE(e){if(Qr(e)){if(e.kind==="orgProvider"){const t=wt(e.id);return t?{kind:"orgProvider",id:t}:void 0}if(e.kind==="localProvider"){const t=wt(e.providerKey);if(!t)return;const r=wt(e.customProviderName);return{kind:"localProvider",providerKey:t,...r?{customProviderName:r}:{}}}}}function Ez(e){if(!Qr(e))return;const t=wt(e.rail),r=wt(e.providerKey);if(!t||!r)return;const s=wt(e.connectionLabel),n=Nu(e.credentialVersion),i=wt(e.nativeModelId);return{rail:t,providerKey:r,...s?{connectionLabel:s}:{},...n!==void 0?{credentialVersion:n}:{},...i?{nativeModelId:i}:{}}}function Tz(e){if(!Qr(e))return;const t=wt(e.rail),r=wt(e.wireModelId),s=wt(e.outcome),n=Nu(e.at);if(!t||!r||!s||n===void 0)return;const i=wt(e.code);return{rail:t,wireModelId:r,outcome:s,...i?{code:i}:{},at:n}}function aW(e){if(!Qr(e))return;const t=kz(e.requested),r=e.resolved;if(!t||!Qr(r))return;const s=wt(r.rail),n=wt(r.wireModelId),i=Ez(r.offering);if(!s||!n||!i)return;const o=e.effectiveSettings;if(!Qr(o))return;const a=Nu(o.maxOutputTokens);if(a===void 0)return;const c=VE(r.connectionRef),l=wt(r.nativeModelId),u=e.harness,p=Qr(u)?wt(u.id):void 0,d=Qr(u)?wt(u.runtimeVersion):void 0,h=wt(o.reasoningEffort),m=Nu(o.temperature),f=Array.isArray(e.attempts)?e.attempts.flatMap(P=>{const I=Tz(P);return I?[I]:[]}):[],g=wt(e.upstreamModel),_=e.deviation,y=Qr(_)?wt(_.kind):void 0,E=Qr(_)&&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}:{},...m!==void 0?{temperature:m}:{},maxOutputTokens:a},attempts:f,...g?{upstreamModel:g}:{},...y?{deviation:{kind:y,reason:E}}:{}}}var Az="=?base64?";function Iz(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 Rz(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 bu(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:Rz(t)}}catch(r){return{raw:e,encoded:!0,value:e,decodeError:r instanceof Error?r.message:String(r)}}}var Cz=new Set(["tools/call","resources/read","prompts/get"]),GE=new Set(["tasks/get","tasks/update","tasks/cancel"]),Pz=new Set(["events/poll","events/stream","events/subscribe","events/unsubscribe"]);function xz(e,t=!1){return e===void 0?!1:Cz.has(e)||GE.has(e)||t&&Pz.has(e)}var pb=["protocol-version","method","name","param","session","resumption"];function Oz(e){return e!==void 0&&GE.has(e)?".params.taskId":e==="resources/read"?".params.uri":".params.name"}function Mz(e){const t=e.declarations??[],r=Bz(t,e.arguments);return t.map(s=>{const n=`${KE}${s.headerName}`,i=r[n];return{header:n.toLowerCase(),displayName:n,expected:i===void 0?void 0:bu(i).value,bodyField:`.params.arguments${s.path.map(o=>`.${o}`).join("")}`}})}function cW(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&&Dx(n)&&dx(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:Oz(t.method),required:xz(t.method,t.eventsBeta)}]:[];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 m=bu(h.value),f={name:h.name,family:d.family,raw:h.value,decoded:m.encoded&&!m.decodeError?m.value:void 0};m.decodeError?o.push({...f,status:"undecodable"}):d.bodyValue===void 0?o.push({...f,status:"unchecked"}):m.value===d.bodyValue?o.push({...f,status:"match",bodyField:d.bodyField}):o.push({...f,status:"mismatch",bodyValue:d.bodyValue,bodyField:d.bodyField})}const l=r!==void 0&&"arguments"in r,u=i&&r?Mz(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 m=bu(h.value),f={name:h.name,family:"param",raw:h.value,decoded:m.encoded&&!m.decodeError?m.value:void 0};m.decodeError?o.push({...f,status:"undecodable"}):l?d.expected===void 0?o.push({...f,status:"mismatch",bodyValue:"(absent from arguments)",bodyField:d.bodyField}):m.value===d.expected?o.push({...f,status:"match",bodyField:d.bodyField}):o.push({...f,status:"mismatch",bodyValue:d.expected,bodyField:d.bodyField}):o.push({...f,status:"unchecked"})}for(const[d,h]of s){if(a.has(d))continue;const m=Iz(h.name);if(!m)continue;const f=bu(h.value),g=i&&m==="param"&&!!f.decodeError,_=p&&m==="param"&&!g;o.push({name:h.name,family:m,raw:h.value,decoded:f.encoded&&!f.decodeError?f.value:void 0,status:g?"undecodable":_?"undeclared":"unchecked"})}return o.sort((d,h)=>pb.indexOf(d.family)-pb.indexOf(h.family)||d.name.localeCompare(h.name))}var hb="x-mcp-header",KE="Mcp-Param-",Lz=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Nz=new Set(["string","integer","boolean","number"]),$z=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],Dz=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function Uz(e){return e.length===0?"<root>":e.join(".")}function lW(e){const t=[],r=new Map,s=(i,o,a)=>{if(i===null||typeof i!="object")return;const c=i;if(hb in c){const u=Uz(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[hb];if(typeof p!="string"||p.length===0)return`${u}: x-mcp-header MUST be a non-empty string`;if(!Lz.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||!Nz.has(d))return`${u}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${d??"<none>"}`;const h=p.toLowerCase(),m=r.get(h);if(m!==void 0)return`x-mcp-header '${p}' is not case-insensitively unique (also declared as '${m}')`;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 $z){const p=c[u];if(p===void 0)continue;const d=p!==null&&typeof p=="object"&&Dz.has(u),h=Array.isArray(p)?p:d?Object.values(p):[p];for(const m of h){const f=s(m,[...o,`<${u}>`],!1);if(f!==void 0)return f}}},n=s(e,[],!0);return n===void 0?{valid:!0,declarations:t}:{valid:!1,reason:n}}function qz(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 zz(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 Fz(e){if(!zz(e))return e;const t=qz(e);return`${Az}${t}?=`}function jz(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 Hz(e,t){let r=e;for(const s of t){if(r===null||typeof r!="object")return;r=r[s]}return r}function Bz(e,t){const r={};for(const s of e){const n=Hz(t,s.path);if(n==null)continue;const i=jz(n);i!==void 0&&(r[`${KE}${s.headerName}`]=Fz(i))}return r}var Vz="tracestate",Gz="baggage",Kz=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/,Wz="0".repeat(32),Jz="0".repeat(16);function Yz(e){if(typeof e!="string")return;const t=Kz.exec(e);if(!t)return;const[,r,s,n,i]=t;if(!(r==="ff"||r!=="00")&&!(s===Wz||n===Jz))return{version:r,traceId:s,spanId:n,flags:i,sampled:(Number.parseInt(i,16)&1)===1}}function Xz(e){return Yz(e)!==void 0}var Qz=32,Zz=/^(?:[a-z][a-z0-9_\-*/]{0,255}|[a-z0-9][a-z0-9_\-*/]{0,240}@[a-z][a-z0-9_\-*/]{0,13})$/,eF=/^[\x20-\x2b\x2d-\x3c\x3e-\x7e]{0,255}[\x21-\x2b\x2d-\x3c\x3e-\x7e]$/;function tF(e){if(typeof e!="string"||e.length===0)return!1;const t=e.split(",");if(t.length>Qz)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||!Zz.test(n.slice(0,i))||!eF.test(n.slice(i+1)))return!1}return r>0}var rF=180,sF=8192,nF=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,fb=/^[\x21\x23-\x2b\x2d-\x3a\x3c-\x5b\x5d-\x7e]*$/;function iF(e){if(typeof e!="string"||e.length===0||e.length>sF)return!1;const t=e.split(",");if(t.length>rF)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||!nF.test(n.slice(0,o).trim())||!fb.test(n.slice(o+1).trim()))return!1;for(const a of i)if(!fb.test(a.replace(/=/g,"").trim()))return!1}return!0}function oF(e){if(!(!e||!Xz(e.traceparent)))return{traceparent:e.traceparent,...tF(e.tracestate)?{tracestate:e.tracestate}:{},...iF(e.baggage)?{baggage:e.baggage}:{}}}function uW(e){if(!e||typeof e!="object")return;const t=r=>{const s=e[r];return typeof s=="string"?s:void 0};return oF({traceparent:t("traceparent")??"",tracestate:t(Vz),baggage:t(Gz)})}var WE="SUPPORTED_MODELS row sent verbatim to api.anthropic.com by createLlmModel",Ns=`${WE}; canonical spelling from hosted-model-ids.generated.ts`,aF=Object.freeze([{canonicalId:"anthropic/claude-fable-5",nativeId:"claude-fable-5",evidence:Ns},{canonicalId:"anthropic/claude-opus-5",nativeId:"claude-opus-5",evidence:WE},{canonicalId:"anthropic/claude-sonnet-5",nativeId:"claude-sonnet-5",evidence:Ns},{canonicalId:"anthropic/claude-opus-4.8",nativeId:"claude-opus-4-8",evidence:Ns},{canonicalId:"anthropic/claude-opus-4.7",nativeId:"claude-opus-4-7",evidence:Ns},{canonicalId:"anthropic/claude-opus-4.6",nativeId:"claude-opus-4-6",evidence:Ns},{canonicalId:"anthropic/claude-sonnet-4.6",nativeId:"claude-sonnet-4-6",evidence:Ns},{canonicalId:"anthropic/claude-sonnet-4.5",nativeId:"claude-sonnet-4-5",nativeAliases:["claude-sonnet-4-5-20250929"],evidence:`${Ns}; snapshot id from Anthropic's models overview`},{canonicalId:"anthropic/claude-haiku-5.5",nativeId:"claude-haiku-5-5",evidence:Ns},{canonicalId:"anthropic/claude-haiku-4.5",nativeId:"claude-haiku-4-5",nativeAliases:["claude-haiku-4-5-20251001"],evidence:`${Ns}; snapshot id from Anthropic's models overview`}]),JE="SUPPORTED_MODELS row sent verbatim to api.openai.com by createLlmModel; listed under this id by GET /v1/models",Yt=`${JE}; canonical spelling from hosted-model-ids.generated.ts`,Dl="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",cF=[{canonicalId:"openai/gpt-6.1-sol",nativeId:"gpt-6.1-sol",evidence:Dl},{canonicalId:"openai/gpt-6-luna",nativeId:"gpt-6-luna",evidence:Dl},{canonicalId:"openai/gpt-6-sol",nativeId:"gpt-6-sol",evidence:Dl},{canonicalId:"openai/gpt-6-astra",nativeId:"gpt-6-astra",evidence:Dl},{canonicalId:"openai/gpt-5.6-luna",nativeId:"gpt-5.6-luna",evidence:Yt},{canonicalId:"openai/gpt-5.6-sol",nativeId:"gpt-5.6-sol",evidence:Yt},{canonicalId:"openai/gpt-5.6-terra",nativeId:"gpt-5.6-terra",evidence:Yt},{canonicalId:"openai/gpt-5.1",nativeId:"gpt-5.1",evidence:JE},{canonicalId:"openai/gpt-5.1-codex",nativeId:"gpt-5.1-codex",evidence:Yt},{canonicalId:"openai/gpt-5.1-codex-mini",nativeId:"gpt-5.1-codex-mini",evidence:Yt},{canonicalId:"openai/gpt-5",nativeId:"gpt-5",evidence:Yt},{canonicalId:"openai/gpt-5-mini",nativeId:"gpt-5-mini",evidence:Yt},{canonicalId:"openai/gpt-5-nano",nativeId:"gpt-5-nano",evidence:Yt},{canonicalId:"openai/gpt-5-pro",nativeId:"gpt-5-pro",evidence:Yt},{canonicalId:"openai/gpt-5-codex",nativeId:"gpt-5-codex",evidence:Yt},{canonicalId:"openai/gpt-4.1",nativeId:"gpt-4.1",evidence:Yt},{canonicalId:"openai/gpt-4.1-mini",nativeId:"gpt-4.1-mini",evidence:Yt},{canonicalId:"openai/gpt-4.1-nano",nativeId:"gpt-4.1-nano",evidence:Yt},{canonicalId:"openai/gpt-4o",nativeId:"gpt-4o",evidence:Yt},{canonicalId:"openai/gpt-4o-mini",nativeId:"gpt-4o-mini",evidence:Yt}],YE="SUPPORTED_MODELS row sent verbatim to the Gemini API by createLlmModel",mb=`${YE}; canonical spelling from hosted-model-ids.generated.ts`,lF=[{canonicalId:"google/gemini-2.5-pro",nativeId:"gemini-2.5-pro",evidence:mb},{canonicalId:"google/gemini-2.5-flash",nativeId:"gemini-2.5-flash",evidence:mb},{canonicalId:"google/gemini-2.0-flash-exp",nativeId:"gemini-2.0-flash-exp",evidence:YE}];function Nf(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 uF=Nf("Anthropic",aF),dW=new Map([["anthropic",uF],["openai",Nf("OpenAI",cF)],["google",Nf("Google",lF)]]),pW=Cr.MissingRequiredClientCapability,da=w().nullable().optional(),dF=Y({name:w().min(1),description:w().optional(),delivery:re(w().min(1)).min(1),inputSchema:st({}).optional(),payloadSchema:st({}).optional(),_meta:Qe(w(),_t()).optional()}).loose(),hW=Y({events:re(dF),nextCursor:w().optional()}).loose(),XE=Y({eventId:w().min(1),name:w().min(1),timestamp:w().refine(e=>!Number.isNaN(Date.parse(e)),{message:"timestamp must be an ISO 8601 date-time"}),data:st({}),cursor:da,_meta:Qe(w(),_t()).optional()}).loose(),fW=Y({events:re(XE),cursor:da,truncated:Ce().optional(),hasMore:Ce().optional(),nextPollMs:De().nonnegative().optional()}).loose(),pF=Y({active:Ce(),lastDeliveryAt:w().nullable().optional(),lastError:w().nullable().optional(),failedSince:w().nullable().optional(),throttled:Ce().optional(),retryAfterMs:De().int().nonnegative().optional()}).loose(),mW=Y({id:w().min(1),refreshBefore:w().refine(e=>!Number.isNaN(Date.parse(e)),{message:"refreshBefore must be an ISO 8601 date-time or null"}).nullable().optional(),cursor:da,truncated:Ce().optional(),deliveryStatus:pF.optional()}).loose(),gW=st({}),hF=st({resultType:ge("complete").optional()}),QE=Y({code:De().int(),message:w(),data:_t().optional()}).loose(),vW=Y({type:ge("gap"),cursor:da}).loose(),_W=Y({type:ge("terminated"),error:QE}).loose(),yW=Y({type:ge("verification"),challenge:w().min(1)}).loose(),ZE="io.modelcontextprotocol/subscriptionId",bW=hF.extend({_meta:st({[ZE]:it([w(),De()])})}),Jd=Y({[ZE]:it([w(),De()])}).loose(),wW=Y({cursor:da,truncated:Ce().optional(),_meta:Jd}).loose(),SW=XE.extend({_meta:Jd}),kW=Y({cursor:da,_meta:Jd}).loose(),EW=Y({error:QE,_meta:Jd}).loose(),fF=new Map([[-32602,"InvalidParams"],[-32023,"NotFound"],[-32024,"Forbidden"],[-32025,"ResourceExhausted"],[-32026,"Unsupported"],[-32027,"CallbackEndpointError"]]),mF=new Map([[-32602,"InvalidParams"],[-32011,"NotFound"],[-32012,"Forbidden"],[-32013,"ResourceExhausted"],[-32014,"Unsupported"],[-32015,"CallbackEndpointError"]]),gF=new WeakMap;function vF(e){const t=e;if(typeof t?.code=="number")return{code:t.code,message:typeof t.message=="string"?t.message:"",data:t.data};const r=e?.error;if(typeof r?.code=="number")return{code:r.code,message:typeof r.message=="string"?r.message:"",data:r.data}}var _F=new Set(["connection_refused","timeout","tls_error","http_5xx"]);function TW(e,t,r){if(!e.startsWith("events/"))return;const s=vF(t);if(!s)return;const n=typeof t=="object"&&t!==null?gF.get(t):void 0,i=((r??n??"legacy")==="beta"?fF:mF).get(s.code);if(!i)return;const o=typeof s.data?.reason=="string"?s.data.reason:void 0,a=i==="ResourceExhausted"||i==="CallbackEndpointError"&&o!==void 0&&_F.has(o);return{kind:i,code:s.code,message:s.message,...s.data!==void 0?{data:s.data}:{},retryable:a}}function yF(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function AW(e){const t=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(e);if(!t)return{frontmatter:void 0,body:e};const r=t[1]??"",s=e.slice(t[0].length),n=X2(r,{schema:"core",uniqueKeys:!0});if(n.errors.length>0)return{frontmatter:void 0,body:s};const i=n.toJS();return{frontmatter:yF(i)?i:void 0,body:s}}var bF=Object.create,$u=Object.defineProperty,wF=Object.getOwnPropertyDescriptor,SF=Object.getOwnPropertyNames,kF=Object.getPrototypeOf,EF=Object.prototype.hasOwnProperty,TF=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),AF=(e,t)=>{let r={};for(var s in e)$u(r,s,{get:e[s],enumerable:!0});return t&&$u(r,Symbol.toStringTag,{value:"Module"}),r},IF=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(var n=SF(t),i=0,o=n.length,a;i<o;i++)a=n[i],!EF.call(e,a)&&a!==r&&$u(e,a,{get:(c=>t[c]).bind(null,a),enumerable:!(s=wF(t,a))||s.enumerable});return e},RF=(e,t,r)=>(r=e!=null?bF(kF(e)):{},IF(t||!e||!e.__esModule?$u(r,"default",{value:e,enumerable:!0}):r,e)),CF="io.modelcontextprotocol/related-task",PF="io.modelcontextprotocol/serverInfo",xF="io.modelcontextprotocol/subscriptionId";var Go=mx(()=>it([w(),De(),Ce(),nS(),Qe(w(),Go),re(Go)])),Et=Qe(w(),Go),OF=re(Go),nv=it([w(),De().int()]),iv=w(),eT=Y({ttl:De().optional()}),tT=Y({taskId:w()}),ov=st({progressToken:nv.optional(),[CF]:tT.optional()}),Jt=Y({_meta:ov.optional()}),rl=Jt.extend({task:eT.optional()}),Tt=Y({method:w(),params:Jt.loose().optional()}),fr=Y({_meta:ov.optional()}),mr=Y({method:w(),params:fr.loose().optional()}),av=st({get[PF](){return Yd.optional().catch(void 0)}}),At=st({_meta:av.optional()}),pa=it([w(),De().int()]),rT=Y({jsonrpc:ge("2.0"),id:pa,...Tt.shape}).strict(),sT=Y({jsonrpc:ge("2.0"),...mr.shape}).strict(),cv=Y({jsonrpc:ge("2.0"),id:pa,result:At}).strict(),lv=Y({jsonrpc:ge("2.0"),id:pa.optional(),error:Y({code:De().int(),message:w(),data:_t().optional()})}).strict(),MF=it([rT,sT,cv,lv]),LF=it([cv,lv]),uv=At.strict(),nT=fr.extend({requestId:pa.optional(),reason:w().optional()}),dv=mr.extend({method:ge("notifications/cancelled"),params:nT}),iT=Y({src:w(),mimeType:w().optional(),sizes:re(w()).optional(),theme:pt(["light","dark"]).optional()}),ha=Y({icons:re(iT).optional()}),Ni=Y({name:w(),title:w().optional()}),Yd=Ni.extend({...Ni.shape,...ha.shape,version:w(),websiteUrl:w().optional(),description:w().optional()}),NF=oS(Y({applyDefaults:Ce().optional()}),Et),$F=rS(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,oS(Y({form:NF.optional(),url:Et.optional()}),Et.optional())),oT=st({list:Et.optional(),cancel:Et.optional(),requests:st({sampling:st({createMessage:Et.optional()}).optional(),elicitation:st({create:Et.optional()}).optional()}).optional()}),aT=st({list:Et.optional(),cancel:Et.optional(),requests:st({tools:st({call:Et.optional()}).optional()}).optional()}),cT=Y({experimental:Qe(w(),Et).optional(),sampling:Y({context:Et.optional(),tools:Et.optional()}).optional(),elicitation:$F.optional(),roots:Y({listChanged:Ce().optional()}).optional(),tasks:oT.optional(),extensions:Qe(w(),Et).optional()}),lT=Jt.extend({protocolVersion:w(),capabilities:cT,clientInfo:Yd}),uT=Tt.extend({method:ge("initialize"),params:lT}),pv=Y({experimental:Qe(w(),Et).optional(),logging:Et.optional(),completions:Et.optional(),prompts:Y({listChanged:Ce().optional()}).optional(),resources:Y({subscribe:Ce().optional(),listChanged:Ce().optional()}).optional(),tools:Y({listChanged:Ce().optional()}).optional(),tasks:aT.optional(),extensions:Qe(w(),Et).optional()}),dT=At.extend({protocolVersion:w(),capabilities:pv,serverInfo:Yd,instructions:w().optional()}),pT=mr.extend({method:ge("notifications/initialized"),params:fr.optional()}),hT=Tt.extend({method:ge("server/discover"),params:Jt.optional()}),fT=At.extend({supportedVersions:re(w()),capabilities:pv,instructions:w().optional()}),hv=Tt.extend({method:ge("ping"),params:Jt.optional()}),mT=Y({progress:De(),total:yt(De()),message:yt(w())}),gT=Y({...fr.shape,...mT.shape,progressToken:nv}),fv=mr.extend({method:ge("notifications/progress"),params:gT}),vT=Jt.extend({cursor:iv.optional()}),fa=Tt.extend({params:vT.optional()}),ma=At.extend({nextCursor:iv.optional()}),mv=Y({uri:w(),mimeType:yt(w()),_meta:Qe(w(),_t()).optional()}),gv=mv.extend({text:w()}),vv=w().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),_v=mv.extend({blob:vv}),ga=pt(["user","assistant"]),Fi=Y({audience:re(ga).optional(),priority:De().min(0).max(1).optional(),lastModified:uS({offset:!0}).optional()}),yv=Y({...Ni.shape,...ha.shape,uri:w(),description:yt(w()),mimeType:yt(w()),size:yt(De()),annotations:Fi.optional(),_meta:yt(st({}))}),_T=Y({...Ni.shape,...ha.shape,uriTemplate:w(),description:yt(w()),mimeType:yt(w()),annotations:Fi.optional(),_meta:yt(st({}))}),yT=fa.extend({method:ge("resources/list")}),bT=ma.extend({resources:re(yv)}),wT=fa.extend({method:ge("resources/templates/list")}),ST=ma.extend({resourceTemplates:re(_T)}),Xd=Jt.extend({uri:w()}),kT=Xd,ET=Tt.extend({method:ge("resources/read"),params:kT}),TT=At.extend({contents:re(it([gv,_v]))}),AT=mr.extend({method:ge("notifications/resources/list_changed"),params:fr.optional()}),IT=Xd,RT=Tt.extend({method:ge("resources/subscribe"),params:IT}),CT=Xd,PT=Tt.extend({method:ge("resources/unsubscribe"),params:CT}),bv=Y({toolsListChanged:Ce().optional(),promptsListChanged:Ce().optional(),resourcesListChanged:Ce().optional(),resourceSubscriptions:re(w()).optional()}),xT=Jt.extend({notifications:bv}),OT=Tt.extend({method:ge("subscriptions/listen"),params:xT}),MT=fr.extend({notifications:bv}),LT=mr.extend({method:ge("notifications/subscriptions/acknowledged"),params:MT}),NT=av.extend({[xF]:pa}),$T=At.extend({_meta:NT}),DT=fr.extend({uri:w()}),UT=mr.extend({method:ge("notifications/resources/updated"),params:DT}),qT=Y({name:w(),description:yt(w()),required:yt(Ce())}),zT=Y({...Ni.shape,...ha.shape,description:yt(w()),arguments:yt(re(qT)),_meta:yt(st({}))}),FT=fa.extend({method:ge("prompts/list")}),jT=ma.extend({prompts:re(zT)}),HT=Jt.extend({name:w(),arguments:Qe(w(),w()).optional()}),BT=Tt.extend({method:ge("prompts/get"),params:HT}),Qd=Y({type:ge("text"),text:w(),annotations:Fi.optional(),_meta:Qe(w(),_t()).optional()}),Zd=Y({type:ge("image"),data:vv,mimeType:w(),annotations:Fi.optional(),_meta:Qe(w(),_t()).optional()}),ep=Y({type:ge("audio"),data:vv,mimeType:w(),annotations:Fi.optional(),_meta:Qe(w(),_t()).optional()}),VT=Y({type:ge("tool_use"),name:w(),id:w(),input:Qe(w(),_t()),_meta:Qe(w(),_t()).optional()}),GT=Y({type:ge("resource"),resource:it([gv,_v]),annotations:Fi.optional(),_meta:Qe(w(),_t()).optional()}),KT=yv.extend({type:ge("resource_link")}),tp=it([Qd,Zd,ep,KT,GT]),WT=Y({role:ga,content:tp}),JT=At.extend({description:w().optional(),messages:re(WT)}),YT=mr.extend({method:ge("notifications/prompts/list_changed"),params:fr.optional()}),XT=Y({title:w().optional(),readOnlyHint:Ce().optional(),destructiveHint:Ce().optional(),idempotentHint:Ce().optional(),openWorldHint:Ce().optional()}),QT=Y({taskSupport:pt(["required","optional","forbidden"]).optional()}),wv=Y({...Ni.shape,...ha.shape,description:w().optional(),inputSchema:Y({type:ge("object"),properties:Qe(w(),Go).optional(),required:re(w()).optional()}).catchall(_t()),outputSchema:st({$schema:w().optional()}).optional(),annotations:XT.optional(),execution:QT.optional(),_meta:Qe(w(),_t()).optional()}),ZT=fa.extend({method:ge("tools/list")}),eA=ma.extend({tools:re(wv)}),rp=At.extend({content:re(tp).default([]),structuredContent:_t().optional(),isError:Ce().optional()}),DF=rp.or(At.extend({toolResult:_t()})),tA=rl.extend({name:w(),arguments:Qe(w(),_t()).optional()}),rA=Tt.extend({method:ge("tools/call"),params:tA}),sA=mr.extend({method:ge("notifications/tools/list_changed"),params:fr.optional()}),UF=Y({autoRefresh:Ce().default(!0),debounceMs:De().int().nonnegative().default(300)}),Sv=pt(["debug","info","notice","warning","error","critical","alert","emergency"]),nA=Jt.extend({level:Sv}),iA=Tt.extend({method:ge("logging/setLevel"),params:nA}),oA=fr.extend({level:Sv,logger:w().optional(),data:_t()}),aA=mr.extend({method:ge("notifications/message"),params:oA}),cA=Y({name:w().optional()}),lA=Y({hints:re(cA).optional(),costPriority:De().min(0).max(1).optional(),speedPriority:De().min(0).max(1).optional(),intelligencePriority:De().min(0).max(1).optional()}),uA=Y({mode:pt(["auto","required","none"]).optional()}),dA=Y({type:ge("tool_result"),toolUseId:w().describe("The unique identifier for the corresponding tool call."),content:re(tp),structuredContent:_t().optional(),isError:Ce().optional(),_meta:Qe(w(),_t()).optional()}),pA=aS("type",[Qd,Zd,ep]),Lc=aS("type",[Qd,Zd,ep,VT,dA]),hA=Y({role:ga,content:it([Lc,re(Lc)]),_meta:Qe(w(),_t()).optional()}),fA=rl.extend({messages:re(hA),modelPreferences:lA.optional(),systemPrompt:w().optional(),includeContext:pt(["none","thisServer","allServers"]).optional(),temperature:De().optional(),maxTokens:De().int(),stopSequences:re(w()).optional(),metadata:Et.optional(),tools:re(wv).optional(),toolChoice:uA.optional()}),mA=Tt.extend({method:ge("sampling/createMessage"),params:fA}),gA=At.extend({model:w(),stopReason:yt(pt(["endTurn","stopSequence","maxTokens"]).or(w())),role:ga,content:pA}),vA=At.extend({model:w(),stopReason:yt(pt(["endTurn","stopSequence","maxTokens","toolUse"]).or(w())),role:ga,content:it([Lc,re(Lc)])}),kv=Y({type:ge("boolean"),title:w().optional(),description:w().optional(),default:Ce().optional()}),sp=Y({type:ge("string"),title:w().optional(),description:w().optional(),minLength:De().optional(),maxLength:De().optional(),format:pt(["email","uri","date","date-time"]).optional(),default:w().optional()}),Du=Y({type:pt(["number","integer"]),title:w().optional(),description:w().optional(),minimum:De().optional(),maximum:De().optional(),default:De().optional()}),Ev=Y({type:ge("string"),title:w().optional(),description:w().optional(),enum:re(w()),default:w().optional()}),Tv=Y({type:ge("string"),title:w().optional(),description:w().optional(),oneOf:re(Y({const:w(),title:w()})),default:w().optional()}),Av=Y({type:ge("string"),title:w().optional(),description:w().optional(),enum:re(w()),enumNames:re(w()).optional(),default:w().optional()}),_A=it([Ev,Tv]),Iv=Y({type:ge("array"),title:w().optional(),description:w().optional(),minItems:De().optional(),maxItems:De().optional(),items:Y({type:ge("string"),enum:re(w())}),default:re(w()).optional()}),Rv=Y({type:ge("array"),title:w().optional(),description:w().optional(),minItems:De().optional(),maxItems:De().optional(),items:Y({anyOf:re(Y({const:w(),title:w()}))}),default:re(w()).optional()}),yA=it([Iv,Rv]),bA=it([Av,_A,yA]),Cv=it([bA,kv,sp,Du]),np=rl.extend({mode:ge("form").optional(),message:w(),requestedSchema:Y({type:ge("object"),properties:Qe(w(),Cv),required:re(w()).optional()}).catchall(_t())}),wA=rl.extend({mode:ge("url"),message:w(),elicitationId:w(),url:w().url()}),SA=it([np,wA]),kA=Tt.extend({method:ge("elicitation/create"),params:SA}),EA=fr.extend({elicitationId:w()}),TA=mr.extend({method:ge("notifications/elicitation/complete"),params:EA}),AA=At.extend({action:pt(["accept","decline","cancel"]),content:rS(e=>e===null?void 0:e,Qe(w(),it([w(),De(),Ce(),re(w())])).optional())}),IA=Y({type:ge("ref/resource"),uri:w()}),RA=Y({type:ge("ref/prompt"),name:w()}),CA=Jt.extend({ref:it([RA,IA]),argument:Y({name:w(),value:w()}),context:Y({arguments:Qe(w(),w()).optional()}).optional()}),PA=Tt.extend({method:ge("completion/complete"),params:CA}),xA=At.extend({completion:st({values:re(w()).max(100),total:yt(De().int()),hasMore:yt(Ce())})}),OA=Y({uri:w().startsWith("file://"),name:w().optional(),_meta:Qe(w(),_t()).optional()}),MA=Tt.extend({method:ge("roots/list"),params:Jt.optional()}),LA=At.extend({roots:re(OA)}),NA=mr.extend({method:ge("notifications/roots/list_changed"),params:fr.optional()}),qF=st({ttl:De().optional(),pollInterval:De().optional()}),$A=pt(["working","input_required","completed","failed","cancelled"]),va=Y({taskId:w(),status:$A,ttl:it([De(),nS()]),createdAt:w(),lastUpdatedAt:w(),pollInterval:yt(De()),statusMessage:yt(w())}),zF=At.extend({task:va}),DA=fr.merge(va),FF=mr.extend({method:ge("notifications/tasks/status"),params:DA}),jF=Tt.extend({method:ge("tasks/get"),params:Jt.extend({taskId:w()})}),HF=At.merge(va),BF=Tt.extend({method:ge("tasks/result"),params:Jt.extend({taskId:w()})}),VF=At.loose(),GF=fa.extend({method:ge("tasks/list")}),KF=ma.extend({tasks:re(va)}),WF=Tt.extend({method:ge("tasks/cancel"),params:Jt.extend({taskId:w()})}),JF=At.merge(va),YF=it([hv,uT,hT,PA,iA,BT,FT,yT,wT,ET,RT,PT,OT,rA,ZT]),XF=it([dv,fv,pT,NA]),QF=it([uv,gA,vA,AA,LA]),ZF=it([hv,mA,kA,MA]),ej=it([dv,fv,aA,UT,AT,sA,YT,LT,TA]),tj=it([uv,dT,fT,xA,JT,jT,bT,ST,TT,rp,eA,$T]),Ft=cS().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:zx.custom,message:"URL must be parseable",fatal:!0}),Ox}).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"}),rj=st({resource:w().url(),authorization_servers:re(Ft).optional(),jwks_uri:w().url().optional(),scopes_supported:re(w()).optional(),bearer_methods_supported:re(w()).optional(),resource_signing_alg_values_supported:re(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:Ce().optional(),authorization_details_types_supported:re(w()).optional(),dpop_signing_alg_values_supported:re(w()).optional(),dpop_bound_access_tokens_required:Ce().optional()}),UA=st({issuer:w(),authorization_endpoint:Ft,token_endpoint:Ft,registration_endpoint:Ft.optional(),scopes_supported:re(w()).optional(),response_types_supported:re(w()),response_modes_supported:re(w()).optional(),grant_types_supported:re(w()).optional(),token_endpoint_auth_methods_supported:re(w()).optional(),token_endpoint_auth_signing_alg_values_supported:re(w()).optional(),service_documentation:Ft.optional(),revocation_endpoint:Ft.optional(),revocation_endpoint_auth_methods_supported:re(w()).optional(),revocation_endpoint_auth_signing_alg_values_supported:re(w()).optional(),introspection_endpoint:w().optional(),introspection_endpoint_auth_methods_supported:re(w()).optional(),introspection_endpoint_auth_signing_alg_values_supported:re(w()).optional(),code_challenge_methods_supported:re(w()).optional(),client_id_metadata_document_supported:Ce().optional(),authorization_response_iss_parameter_supported:Ce().optional().catch(void 0),dpop_signing_alg_values_supported:re(w()).optional()}),qA=st({issuer:w(),authorization_endpoint:Ft,token_endpoint:Ft,userinfo_endpoint:Ft.optional(),jwks_uri:Ft,registration_endpoint:Ft.optional(),scopes_supported:re(w()).optional(),response_types_supported:re(w()),response_modes_supported:re(w()).optional(),grant_types_supported:re(w()).optional(),acr_values_supported:re(w()).optional(),subject_types_supported:re(w()),id_token_signing_alg_values_supported:re(w()),id_token_encryption_alg_values_supported:re(w()).optional(),id_token_encryption_enc_values_supported:re(w()).optional(),userinfo_signing_alg_values_supported:re(w()).optional(),userinfo_encryption_alg_values_supported:re(w()).optional(),userinfo_encryption_enc_values_supported:re(w()).optional(),request_object_signing_alg_values_supported:re(w()).optional(),request_object_encryption_alg_values_supported:re(w()).optional(),request_object_encryption_enc_values_supported:re(w()).optional(),token_endpoint_auth_methods_supported:re(w()).optional(),token_endpoint_auth_signing_alg_values_supported:re(w()).optional(),display_values_supported:re(w()).optional(),claim_types_supported:re(w()).optional(),claims_supported:re(w()).optional(),service_documentation:w().optional(),claims_locales_supported:re(w()).optional(),ui_locales_supported:re(w()).optional(),claims_parameter_supported:Ce().optional(),request_parameter_supported:Ce().optional(),request_uri_parameter_supported:Ce().optional(),require_request_uri_registration:Ce().optional(),op_policy_uri:Ft.optional(),op_tos_uri:Ft.optional(),client_id_metadata_document_supported:Ce().optional(),authorization_response_iss_parameter_supported:Ce().optional().catch(void 0)}),sj=Y({...qA.shape,...UA.pick({code_challenge_methods_supported:!0}).shape}),nj=Y({access_token:w(),id_token:w().optional(),token_type:w(),expires_in:Fx().optional(),scope:w().optional(),refresh_token:w().optional(),issuer:w().optional().catch(void 0)}).strip(),ij=Y({issued_token_type:ge("urn:ietf:params:oauth:token-type:id-jag"),access_token:w(),token_type:w().optional(),expires_in:De().optional(),scope:w().optional()}).strip(),oj=Y({error:w(),error_description:w().optional(),error_uri:w().optional()}),gb=Ft.optional().or(ge("").transform(()=>{})),zA=Y({redirect_uris:re(Ft),token_endpoint_auth_method:w().optional(),grant_types:re(w()).optional(),response_types:re(w()).optional(),application_type:w().optional(),client_name:w().optional(),client_uri:Ft.optional(),logo_uri:gb,scope:w().optional(),contacts:re(w()).optional(),tos_uri:gb,policy_uri:w().optional(),jwks_uri:Ft.optional(),jwks:Nx().optional(),software_id:w().optional(),software_version:w().optional(),software_statement:w().optional()}).strip(),FA=Y({client_id:w(),client_secret:w().optional(),client_id_issued_at:De().optional(),client_secret_expires_at:De().optional(),issuer:w().optional().catch(void 0)}).strip(),aj=zA.merge(FA),cj=Y({error:w(),error_description:w().optional()}).strip(),lj=Y({token:w(),token_type_hint:w().optional()}).strip(),$f=Symbol.for("mcp.sdk.errorBrands");function _a(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,$f,{value:r,enumerable:!1,configurable:!0})}function jr(e,t){try{if(typeof t=="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand=="string"&&Object.prototype.hasOwnProperty.call(t,$f)){const r=t[$f];if(r&&typeof r.has=="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var IW=class jA extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return jr(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 jr(this,t)}constructor(t,r,s){super(r),this.code=t,this.errorUri=s,this.name="OAuthError",_a(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 jA(t.error,t.error_description??t.error,t.error_uri)}},uj=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return jr(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 jr(this,e)}constructor(e,t,r,s){super(t,s),this.code=e,this.data=r,this.name="SdkError",_a(this,new.target)}},RW=class extends uj{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}},dj={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},pj={"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(dj);Object.keys(pj);var rt=(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})({}),As=class HA extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return jr(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 jr(this,t)}constructor(t,r,s){super(r),this.code=t,this.data=s,this.name="ProtocolError",_a(this,new.target)}static fromError(t,r,s){if(t===rt.UrlElicitationRequired&&s){const n=s;if(n.elicitations)return new fj(n.elicitations,r)}if(t===rt.UnsupportedProtocolVersion&&s){const n=s;if(Array.isArray(n.supported)&&typeof n.requested=="string")return new mj({supported:n.supported,requested:n.requested},r)}if(t===rt.InvalidParams||t===rt.ResourceNotFound){const n=s;if(typeof n?.uri=="string"&&(t===rt.ResourceNotFound||Object.keys(n).length===1))return new hj(n.uri,r)}if(t===rt.MissingRequiredClientCapability&&s){const n=s;if(n.requiredCapabilities!==null&&typeof n.requiredCapabilities=="object"&&!Array.isArray(n.requiredCapabilities))return new gj({requiredCapabilities:n.requiredCapabilities},r)}return new HA(t,r,s)}},hj=class extends As{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(rt.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},fj=class extends As{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(rt.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},mj=class extends As{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(rt.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},gj=class extends As{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(rt.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},vj={"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},_j={"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(vj);Object.keys(_j);var yj=AF({AnnotationsSchema:()=>Fi,AudioContentSchema:()=>ep,BaseMetadataSchema:()=>Ni,BaseRequestParamsSchema:()=>Jt,BlobResourceContentsSchema:()=>_v,BooleanSchemaSchema:()=>kv,CallToolRequestParamsSchema:()=>tA,CallToolRequestSchema:()=>rA,CallToolResultSchema:()=>rp,CancelTaskRequestSchema:()=>WF,CancelTaskResultSchema:()=>JF,CancelledNotificationParamsSchema:()=>nT,CancelledNotificationSchema:()=>dv,ClientCapabilitiesSchema:()=>cT,ClientNotificationSchema:()=>XF,ClientRequestSchema:()=>YF,ClientResultSchema:()=>QF,ClientTasksCapabilitySchema:()=>oT,CompatibilityCallToolResultSchema:()=>DF,CompleteRequestParamsSchema:()=>CA,CompleteRequestSchema:()=>PA,CompleteResultSchema:()=>xA,ContentBlockSchema:()=>tp,CreateMessageRequestParamsSchema:()=>fA,CreateMessageRequestSchema:()=>mA,CreateMessageResultSchema:()=>gA,CreateMessageResultWithToolsSchema:()=>vA,CreateTaskResultSchema:()=>zF,CursorSchema:()=>iv,DiscoverRequestSchema:()=>hT,DiscoverResultSchema:()=>fT,ElicitRequestFormParamsSchema:()=>np,ElicitRequestParamsSchema:()=>SA,ElicitRequestSchema:()=>kA,ElicitRequestURLParamsSchema:()=>wA,ElicitResultSchema:()=>AA,ElicitationCompleteNotificationParamsSchema:()=>EA,ElicitationCompleteNotificationSchema:()=>TA,EmbeddedResourceSchema:()=>GT,EmptyResultSchema:()=>uv,EnumSchemaSchema:()=>bA,GetPromptRequestParamsSchema:()=>HT,GetPromptRequestSchema:()=>BT,GetPromptResultSchema:()=>JT,GetTaskPayloadRequestSchema:()=>BF,GetTaskPayloadResultSchema:()=>VF,GetTaskRequestSchema:()=>jF,GetTaskResultSchema:()=>HF,IconSchema:()=>iT,IconsSchema:()=>ha,ImageContentSchema:()=>Zd,ImplementationSchema:()=>Yd,InitializeRequestParamsSchema:()=>lT,InitializeRequestSchema:()=>uT,InitializeResultSchema:()=>dT,InitializedNotificationSchema:()=>pT,JSONArraySchema:()=>OF,JSONObjectSchema:()=>Et,JSONRPCErrorResponseSchema:()=>lv,JSONRPCMessageSchema:()=>MF,JSONRPCNotificationSchema:()=>sT,JSONRPCRequestSchema:()=>rT,JSONRPCResponseSchema:()=>LF,JSONRPCResultResponseSchema:()=>cv,JSONValueSchema:()=>Go,LegacyTitledEnumSchemaSchema:()=>Av,ListChangedOptionsBaseSchema:()=>UF,ListPromptsRequestSchema:()=>FT,ListPromptsResultSchema:()=>jT,ListResourceTemplatesRequestSchema:()=>wT,ListResourceTemplatesResultSchema:()=>ST,ListResourcesRequestSchema:()=>yT,ListResourcesResultSchema:()=>bT,ListRootsRequestSchema:()=>MA,ListRootsResultSchema:()=>LA,ListTasksRequestSchema:()=>GF,ListTasksResultSchema:()=>KF,ListToolsRequestSchema:()=>ZT,ListToolsResultSchema:()=>eA,LoggingLevelSchema:()=>Sv,LoggingMessageNotificationParamsSchema:()=>oA,LoggingMessageNotificationSchema:()=>aA,ModelHintSchema:()=>cA,ModelPreferencesSchema:()=>lA,MultiSelectEnumSchemaSchema:()=>yA,NotificationSchema:()=>mr,NotificationsParamsSchema:()=>fr,NumberSchemaSchema:()=>Du,PaginatedRequestParamsSchema:()=>vT,PaginatedRequestSchema:()=>fa,PaginatedResultSchema:()=>ma,PingRequestSchema:()=>hv,PrimitiveSchemaDefinitionSchema:()=>Cv,ProgressNotificationParamsSchema:()=>gT,ProgressNotificationSchema:()=>fv,ProgressSchema:()=>mT,ProgressTokenSchema:()=>nv,PromptArgumentSchema:()=>qT,PromptListChangedNotificationSchema:()=>YT,PromptMessageSchema:()=>WT,PromptReferenceSchema:()=>RA,PromptSchema:()=>zT,ReadResourceRequestParamsSchema:()=>kT,ReadResourceRequestSchema:()=>ET,ReadResourceResultSchema:()=>TT,RelatedTaskMetadataSchema:()=>tT,RequestIdSchema:()=>pa,RequestMetaSchema:()=>ov,RequestSchema:()=>Tt,ResourceContentsSchema:()=>mv,ResourceLinkSchema:()=>KT,ResourceListChangedNotificationSchema:()=>AT,ResourceRequestParamsSchema:()=>Xd,ResourceSchema:()=>yv,ResourceTemplateReferenceSchema:()=>IA,ResourceTemplateSchema:()=>_T,ResourceUpdatedNotificationParamsSchema:()=>DT,ResourceUpdatedNotificationSchema:()=>UT,ResultMetaObjectSchema:()=>av,ResultSchema:()=>At,RoleSchema:()=>ga,RootSchema:()=>OA,RootsListChangedNotificationSchema:()=>NA,SamplingContentSchema:()=>pA,SamplingMessageContentBlockSchema:()=>Lc,SamplingMessageSchema:()=>hA,ServerCapabilitiesSchema:()=>pv,ServerNotificationSchema:()=>ej,ServerRequestSchema:()=>ZF,ServerResultSchema:()=>tj,ServerTasksCapabilitySchema:()=>aT,SetLevelRequestParamsSchema:()=>nA,SetLevelRequestSchema:()=>iA,SingleSelectEnumSchemaSchema:()=>_A,StringSchemaSchema:()=>sp,SubscribeRequestParamsSchema:()=>IT,SubscribeRequestSchema:()=>RT,SubscriptionFilterSchema:()=>bv,SubscriptionsAcknowledgedNotificationParamsSchema:()=>MT,SubscriptionsAcknowledgedNotificationSchema:()=>LT,SubscriptionsListenRequestParamsSchema:()=>xT,SubscriptionsListenRequestSchema:()=>OT,SubscriptionsListenResultMetaSchema:()=>NT,SubscriptionsListenResultSchema:()=>$T,TaskAugmentedRequestParamsSchema:()=>rl,TaskCreationParamsSchema:()=>qF,TaskMetadataSchema:()=>eT,TaskSchema:()=>va,TaskStatusNotificationParamsSchema:()=>DA,TaskStatusNotificationSchema:()=>FF,TaskStatusSchema:()=>$A,TextContentSchema:()=>Qd,TextResourceContentsSchema:()=>gv,TitledMultiSelectEnumSchemaSchema:()=>Rv,TitledSingleSelectEnumSchemaSchema:()=>Tv,ToolAnnotationsSchema:()=>XT,ToolChoiceSchema:()=>uA,ToolExecutionSchema:()=>QT,ToolListChangedNotificationSchema:()=>sA,ToolResultContentSchema:()=>dA,ToolSchema:()=>wv,ToolUseContentSchema:()=>VT,UnsubscribeRequestParamsSchema:()=>CT,UnsubscribeRequestSchema:()=>PT,UntitledMultiSelectEnumSchemaSchema:()=>Iv,UntitledSingleSelectEnumSchemaSchema:()=>Ev}),CW=e=>typeof e!="object"||e===null||e.content===void 0?!1:rp.safeParse(e).success;rt.InvalidRequest,rt.UnsupportedProtocolVersion,rt.InvalidParams,rt.MethodNotFound,rt.InvalidParams,rt.MissingRequiredClientCapability;rt.ParseError,rt.InvalidRequest,rt.MethodNotFound,rt.UnsupportedProtocolVersion,rt.MissingRequiredClientCapability;function BA(e,t){return bx(e,t)}function xa(e){return new Set(e.flatMap(t=>Object.keys(t.shape)))}function bj(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 vb=!1,Df="draft-2020-12";function wj(e,t="input"){const r=e["~standard"];let s;if(r.jsonSchema)s=r.jsonSchema[t]({target:Df});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().");vb||(vb=!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:Df,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:VA(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 VA(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"||VA(s)))}return!1}function Sj(e){const t=sS(e,{target:Df,io:"input"});return typeof t.pattern=="string"?t.pattern:void 0}var kj=/\\\.\\d\{(\d+)\}/;function Ej(e){const t=kj.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 Tj(e,t){let r;switch(e){case"email":r=[ux()];break;case"uri":r=[cS()];break;case"date":r=[Sx()];break;case"date-time":r=Ej(t)}return new Set(r.map(s=>Sj(s)).filter(s=>s!==void 0))}function Aj(e,t,r){return r!=="zod"?!0:Tj(e,t).has(t)}function Nc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ij(e){try{return wj(e,"input")}catch(t){const r=t instanceof Error?t.message:String(t);throw new As(rt.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var Rj=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Pv(e){return Rj.has(e)||e.startsWith("x-")}var Cj=new Set(["$schema",...Object.keys(np.shape.requestedSchema.shape)]),_b={string:xa([sp,Ev,Tv,Av]),number:xa([Du]),integer:xa([Du]),boolean:xa([kv]),array:xa([Iv,Rv])},Pj=new Set(sp.shape.format.unwrap().options);function xj(e,t,r,s){if(!Nc(e))return e;const n=typeof e.type=="string"&&Object.hasOwn(_b,e.type)?_b[e.type]:void 0;if(n===void 0)return e;const i={};for(const[o,a]of Object.entries(e))n.has(o)||Pv(o)?i[o]=a:o==="pattern"&&e.type==="string"&&typeof e.format=="string"?Pj.has(e.format)?(typeof a!="string"||!Aj(e.format,a,r))&&s.push(`${t}.${o}`):i[o]=a:s.push(`${t}.${o}`);return i}function Oj(e,t){const r={},s=[];for(const[n,i]of Object.entries(e))n==="properties"&&Nc(i)?r[n]=Object.fromEntries(Object.entries(i).map(([o,a])=>[o,xj(a,`properties.${o}`,t,s)])):Cj.has(n)?r[n]=i:Pv(n)||s.push(n);if(s.length>0)throw new As(rt.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${s.join(", ")}`);return r}function Mj(e,t){if(!Nc(e.properties))return t;const r=Object.entries(e.properties).filter(([,s])=>!BA(Cv,s).success).map(([s])=>`properties.${s}`);return r.length>0?r.join(", "):t}function Uf(e,t,r=""){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((s,n)=>Uf(s,t[n],`${r}[${n}]`)):!Nc(e)||!Nc(t)?[]:Object.entries(e).flatMap(([s,n])=>{const i=r?`${r}.${s}`:s;return Object.prototype.hasOwnProperty.call(t,s)?Uf(n,t[s],i):Pv(s)?[]:[i]})}function Lj(e){if(!bj(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};const t=e.requestedSchema["~standard"].vendor,r=Oj(Ij(e.requestedSchema),t),s=BA(np.shape.requestedSchema,r);if(!s.success)throw new As(rt.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Mj(r,s.error.message)}`);const n=Uf(r,s.data);if(n.length>0)throw new As(rt.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 As(rt.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${i.join(", ")}`);return{...e,mode:"form",requestedSchema:s.data}}function Nj(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(Nj,{elicit(e){try{return{method:"elicitation/create",params:Lj(e)}}catch(t){throw t instanceof As?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 $j=["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"],Dj={IdJagTokenExchangeResponseSchema:ij,OAuthClientInformationFullSchema:aj,OAuthClientInformationSchema:FA,OAuthClientMetadataSchema:zA,OAuthClientRegistrationErrorSchema:cj,OAuthErrorResponseSchema:oj,OAuthMetadataSchema:UA,OAuthProtectedResourceMetadataSchema:rj,OAuthTokenRevocationRequestSchema:lj,OAuthTokensSchema:nj,OpenIdProviderDiscoveryMetadataSchema:sj,OpenIdProviderMetadataSchema:qA},GA={},KA={};function WA(e,t){const r=e.slice(0,-6);GA[r]=t,KA[r]=s=>t.safeParse(s).success}for(const e of $j)WA(e,yj[e]);for(const[e,t]of Object.entries(Dj))WA(e,t);var Si=Object.freeze(GA),PW=Object.freeze(KA);function Uj(e){return()=>e}var xW=Uj(void 0),OW=RF(TF((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,m;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(),m=h[2],m.charCodeAt(0)===34&&(m=m.slice(1,-1),m.indexOf("\\")!==-1&&(m=m.replace(r,"$1"))),p.parameters[d]=m}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),MW=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"),qj=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,zj=[0,31,28,31,30,31,30,31,31,30,31,30,31],Fj=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,jj=/^(?=.{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,Hj=/^(?:[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,Bj=/^(?:(?:[^\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,Vj=/^(?:(?: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,Gj=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Kj=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Wj=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Jj=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Yj=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))},Xj=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Qj=/^((([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,Zj=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 as(e){return e.test.bind(e)}var LW={date:JA,time:YA.bind(void 0,!1),"date-time":rH,duration:Zj,uri:iH,"uri-reference":as(Hj),"uri-template":as(Bj),url:as(Vj),email:Yj,hostname:as(jj),ipv4:as(Xj),ipv6:as(Qj),regex:aH,uuid:as(Gj),"json-pointer":as(Kj),"json-pointer-uri-fragment":as(Wj),"relative-json-pointer":as(Jj)};function eH(e){return e%4===0&&(e%100!==0||e%400===0)}function JA(e){const t=e.match(qj);if(!t)return!1;const r=+t[1],s=+t[2],n=+t[3];return s>=1&&s<=12&&n>=1&&n<=(s==2&&eH(r)?29:zj[s])}function YA(e,t){const r=t.match(Fj);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 tH=/t|\s/i;function rH(e){const t=e.split(tH);return t.length==2&&JA(t[0])&&YA(!0,t[1])}var sH=/\/|:/,nH=/^(?:[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 iH(e){return sH.test(e)&&nH.test(e)}var oH=/[^\\]\\Z/;function aH(e){if(oH.test(e))return!1;try{return new RegExp(e,"u"),!0}catch{return!1}}var sl=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return jr(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 jr(this,e)}constructor(e){super(e),this.name=new.target.name,_a(this,new.target)}},NW=class extends sl{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}},$W=class extends sl{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}},DW=class extends sl{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}},UW=class extends sl{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}},qW=class extends sl{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}},zW=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return jr(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 jr(this,e)}constructor(e){super(e??"Unauthorized"),this.name="UnauthorizedError",_a(this,new.target)}},FW=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return jr(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 jr(this,e)}constructor(e,t,r){super(`SSE error: ${t}`),this.code=e,this.event=r,_a(this,new.target)}};function cH(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 lH={"elicitation/create":Si.ElicitRequest,"roots/list":Si.ListRootsRequest,"sampling/createMessage":Si.CreateMessageRequest},uH=Y({mode:ge("url"),message:w(),url:w().url(),elicitationId:w().optional()});function jW(e,t){if(e==="elicitation/create"&&typeof t=="object"&&t!==null&&"mode"in t&&t.mode==="url"){const r=uH.safeParse(t);return r.success?{ok:!0}:{ok:!1,detail:r.error.issues[0]?.message??"invalid URL request"}}return cH(lH[e],{method:e,params:t})}var HW={"elicitation/create":[Si.ElicitResult],"roots/list":[Si.ListRootsResult],"sampling/createMessage":[Si.CreateMessageResult,Si.CreateMessageResultWithTools]},XA={"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 QA(e){return Object.fromEntries(wq.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(_d).length}]}))}function BW(e,t,r,s){const n=e.map(i=>({...XA[i],status:"skipped",skipReason:"could-not-run",durationMs:0,error:{message:t},...s&&Eq(i)?{details:{toolName:s}}:{}}));return{passed:!1,outcome:"incomplete",target:r,checks:n,summary:_S(n),durationMs:0,categorySummary:QA(n),discovery:{wire:"none",toolCount:0,taskCapableToolCount:0,...s?{probedTool:s}:{}}}}function VW(e,t=Sq,r){const s=[...new Set(t)].map(y=>{const E=e.flatMap(I=>I.checks.filter(M=>M.id===y));if(!E.length)return{...XA[y],status:"skipped",skipReason:"could-not-run",durationMs:0,error:{message:"The selected check produced no result."}};const P=E.find(I=>I.status==="failed")??E.find(I=>I.skipReason==="could-not-run")??E.find(I=>I.status==="passed")??E[0];return y!=="tasks-declaration-hygiene"?P:{...P,durationMs:E.reduce((I,M)=>I+M.durationMs,0),details:{...P.details,inspectedRequests:E.reduce((I,M)=>I+Number(M.details?.inspectedRequests??0),0)}}}),n=Cq("mcp-tasks"),{scored:i,pending:o}=ME(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(y=>y.readiness??[]).filter((y,E,P)=>P.findIndex(I=>I.id===y.id)===E),l=e.flatMap(y=>y.uncheckedAdvice??[]).filter((y,E,P)=>!c.some(I=>I.id===y.id)&&P.findIndex(I=>I.id===y.id)===E),u=e.flatMap(y=>y.passedAdvice??[]).filter((y,E,P)=>!c.some(I=>I.id===y.id)&&!l.some(I=>I.id===y.id)&&P.findIndex(I=>I.id===y.id)===E),p=e.find(y=>y.discovery.protocolVersion)??e[0],d=p?.discovery??{wire:"none",toolCount:0,taskCapableToolCount:0},h=new Set(e.map(y=>y.discovery.probedTool).filter(Boolean)),m=new Set(e.map(y=>y.discovery.createdTaskId).filter(Boolean)),{probedTool:f,createdTaskId:g,..._}=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((y,E)=>y+E.durationMs,0),categorySummary:QA(s),profile:Oq({profile:n,checks:s,...d.protocolVersion?{protocolVersion:d.protocolVersion}:{}}),discovery:{..._,toolCount:Math.max(0,...e.map(y=>y.discovery.toolCount)),taskCapableToolCount:Math.max(0,...e.map(y=>y.discovery.taskCapableToolCount)),...h.size===1?{probedTool:[...h][0]}:{},...m.size===1?{createdTaskId:[...m][0]}:{}},...c.length?{readiness:c}:{},...l.length?{uncheckedAdvice:l}:{},...u.length?{passedAdvice:u}:{}}}var ZA=["server-info","base-protocol","server-features","server-utilities","client-features","authorization","extensions","third-party"],dH=["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"],GW=["serverInfo","capabilities","instructions","tools","toolMeta","toolSchemas","resources","resourceTemplates","prompts","skills","listHints"],KW=["http-transport","authorization","server-card","apps-ui-resources","skills","events-list"],pH=["check-failed","supported","needs-newer","could-add","not-checked","not-applicable"],hH={"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"},qf={"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."}},fH=Object.keys(qf).map(e=>({id:e,...qf[e]}));function mH(e){return{id:e,...qf[e]}}function WW(e){return fH.filter(t=>t.card===e)}var JW=ZA.map(e=>({id:e,name:hH[e]})),gH=new Set(["2026-07-28"]),vH=new Set(["2024-10-07","2024-11-05","2025-03-26","2025-06-18","2025-11-25"]);function Cs(e){return e?gH.has(e)?"modern":vH.has(e)?"legacy":"unknown":"unknown"}function YW(e){return e==="stdio"||e==="sse"?e:e==="streamable-http"||e==="http"?"streamable-http":"unknown"}function _H(e){if(!(!e||e.length===0))return[...new Set(e)].sort()}function yH(e){const t=e.era??Cs(e.protocolVersion),r=_H(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 zf(e){if(Array.isArray(e))return`[${e.map(t=>zf(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)}:${zf(t[r])}`).join(",")}}`}return JSON.stringify(e??null)}function yb(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 bH(e){const t=zf(e);return`${yb(t,2166136261)}${yb(t,16777619)}`}function wH(e){return`ctx_${bH(yH(e))}`}var xv="2026-11-16",Ov={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"},eI="https://modelcontextprotocol.io";function U(e,t,r){return{url:`${eI}/specification/${e}/${t}${r?`#${r}`:""}`,source:"core",pin:Ov.core,checkedAt:xv}}function SH(e,t,r){return{url:`${eI}/extensions/${t}${r?`#${r}`:""}`,source:e,pin:Ov[e],checkedAt:xv}}function sc(e,t){return{url:t,source:e,pin:Ov[e],checkedAt:xv}}function Re(e,t={}){return{kind:"present",via:e,...t}}function ir(e,t){return t?{kind:"absent",basis:e,detail:t}:{kind:"absent",basis:e}}function Ct(e){return{kind:"unknown",reason:e}}function br(e){return{kind:"not-applicable",reason:e}}function Z(e){return{...e}}function Ut(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ur(e){return typeof e=="string"&&e.trim().length>0}function ip(e){return Ut(e)&&Object.keys(e).length>0}function Ko(e,t=4){const r=e.slice(0,t).join(", "),s=e.length-t;return s>0?`${r} and ${s} more`:r}function nl(e,t){return t.every(r=>e.coverage[r]==="complete")}function il(e,t,r){return nl(e,t)?br(r):ir(t)}function Ti(e){return Cs(e.protocolVersion)}function op(e,t){return e.capabilities?.[t]}function ol(e){return t=>Ut(op(t,e))?Re("advertised"):ir(["capabilities"])}function ap(e,t,r){return s=>{const n=op(s,e);return Ut(n)?n[t]===!0?Ct(`Declared. MCPJam has not seen ${r} yet.`):ir(["capabilities"]):il(s,["capabilities"],`The server does not declare the ${e} capability.`)}}var Mv={tools:"tools",resources:"resources",resourceTemplates:"resource templates",prompts:"prompts"};function Lv(e,t){return il(e,[t],`The server lists no ${Mv[t]}.`)}var tI="Saved before MCPJam stored this field. Reconnect to capture it.";function Nv(e,t){return r=>{const s=r[e];return s.length>0?Re("detected",{count:s.length,detail:`${s.length} ${Mv[e]}`}):Ut(op(r,t))?nl(r,[e])?Re("advertised",{count:0,detail:"The list is empty."}):ir([e]):ir(["capabilities",e])}}function sr(e,t,r,s={}){return n=>{const i=n[e];if(i.length===0)return Lv(n,e);if(s.droppedByOldSnapshots&&n.envelopeVersion<3)return Ct(tI);const o=i.filter(t).length;return o===0?ir(r):Re("detected",{count:o,detail:`${o} of ${i.length} ${Mv[e]}`})}}function Oa(e,t={}){return r=>{if(t.droppedByOldSnapshots&&r.envelopeVersion<3)return Ct(tI);const s=r.serverInfo;return Ut(s)&&e(s)?Re("advertised"):ir(["serverInfo"])}}function Ff(e,t){const r=e.annotations;return Ut(r)?r[t]:void 0}var kH=32;function Uu(e,t,r=0){return r>kH?!1:Array.isArray(e)?e.some(s=>Uu(s,t,r+1)):Ut(e)?t(e)?!0:Object.values(e).some(s=>Uu(s,t,r+1)):!1}function EH(e,t){const r=[];return Uu(e,s=>{const n=s[t];return typeof n=="string"&&r.push(n),!1}),r}function rI(e){return[e.inputSchema,e.outputSchema]}var sI="Applies to HTTP servers. This server runs over stdio.",Lt=e=>e.transport==="stdio"?br(sI):null,TH={"http-transport":sI,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."},AH={"http-transport":"HTTP transport",authorization:"authorization","server-card":"Server Card","apps-ui-resources":"UI resource",skills:"skills","events-list":"events"};function sn(e,t){return r=>{const s=r[e];return s?s.status==="not-applicable"?br(TH[e]):s.status!=="ok"?Ct(`The ${AH[e]} probe did not finish. Refresh to try again.`):t(s):null}}function Or(e,t){return e.coverage==="complete"?ir([],t):Ct("The probe could not read everything it needed.")}function $t(e){return typeof e=="boolean"?e:void 0}function Ai(e){return typeof e=="string"&&e.length>0?e:void 0}function jf(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function Ul(e){if(!(typeof e!="object"||e===null))return e.filter(t=>typeof t=="string")}function Sn(e){return sn("authorization",t=>{const r=$t(t.values.oauthRequired),s=$t(t.values.oauthOptional);return r===!1&&s!==!0?br("This server accepts requests without authorization."):e?e(t):null})}var We=e=>e.transport==="stdio"?br("Stdio servers take credentials from their environment, not OAuth."):null;function ql(e){return Sn(t=>$t(t.values.asMetadataFound)===!0?e(t):null)}var Zn="basic/authorization",Zi="basic/authorization/authorization-server-discovery",Ma="basic/authorization/client-registration",bb="basic/authorization/security-considerations",IH="protected-resource-metadata-discovery-requirements",La=Z({introduced:"2026-07-28"}),cs=Sn(),RH=[{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:U("2026-07-28",Zn,"protocol-requirements"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:{primary:"probed",declared:We,probed:Sn(e=>$t(e.values.oauthRequired)===!0?Re("probed",{detail:"Requires OAuth."}):$t(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:U("2026-07-28",Zi,IH),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:{primary:"probed",declared:We,probed:Sn(e=>{if(jf(e.values.nonCompliantChallengeStatus)!==void 0)return Ct("The server sent its challenge with the wrong status code.");const t=$t(e.values.challengeHasResourceMetadata);return t===!0?Re("probed"):t===!1?Or(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:U("2026-07-28",Zi,"authorization-server-location"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!1,assessment:{primary:"probed",declared:We,probed:Sn(e=>{const t=$t(e.values.prmFound);if(t===!0){const r=Ul(e.values.prmAuthorizationServers)??[];return Re("probed",{count:r.length})}return t===!1?Or(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:U("2026-07-28",Zi,"authorization-server-location"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"probed",declared:We,probed:Sn(e=>{const t=$t(e.values.prmFound);return t===!1?Or(e):t!==!0?null:$t(e.values.challengeHasResourceMetadata)===!0?Ct("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:U("2026-07-28",Zi,"authorization-server-location"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:{primary:"probed",declared:We,probed:Sn(e=>{if($t(e.values.prmFound)!==!0)return null;const t=Ul(e.values.prmAuthorizationServers)??[];return t.length>1?Re("advertised",{count:t.length}):t.length===1?br("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:U("2026-07-28",Zi,"authorization-server-metadata-discovery"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!1,assessment:{primary:"probed",declared:We,probed:Sn(e=>{const t=$t(e.values.asMetadataFound);if(t===!0){const r=Ai(e.values.asMetadataKind);return Re("probed",{detail:r==="oidc"?"OpenID Connect discovery.":"OAuth metadata."})}return t===!1?Or(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:U("2025-03-26",Zn),stage:"stable",lifecycle:Z({introduced:"2025-03-26",removed:"2025-06-18"}),optional:!0,assessment:{primary:"probed",declared:We,probed:cs}},{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:U("2026-07-28",Zi,"authorization-server-metadata-discovery"),stage:"stable",lifecycle:La,optional:!1,assessment:{primary:"probed",declared:We,probed:ql(e=>{const t=Ai(e.values.issuer),r=Ul(e.values.prmAuthorizationServers);return!t||!r||r.length===0?null:r.includes(t)?Re("probed"):Or(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:U("2026-07-28",bb,"authorization-code-protection"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!1,assessment:{primary:"probed",declared:We,probed:ql(e=>(Ul(e.values.codeChallengeMethods)??[]).includes("S256")?Re("advertised"):Or(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:U("2026-07-28",Ma,"advertising-cimd-support"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"probed",declared:We,probed:ql(e=>$t(e.values.cimdSupported)===!0?Re("advertised"):Or(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:U("2026-07-28",Ma,"dynamic-client-registration"),stage:"stable",lifecycle:Z({introduced:"2025-03-26",deprecated:"2026-07-28"}),optional:!0,assessment:{primary:"probed",declared:We,probed:ql(e=>$t(e.values.registrationEndpoint)===!0?Re("advertised"):Or(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:U("2026-07-28",Ma,"application-type-and-redirect-uri-constraints"),stage:"stable",lifecycle:La,optional:!1,assessment:{primary:"checked",declared:We,probed:cs}},{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:U("2026-07-28",Ma,"pre-registration"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:{primary:"configured",setup:"pre-registered-client",declared:We,probed:cs,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:U("2026-07-28",Zn,"resource-parameter-implementation"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!1,assessment:{primary:"oauth-flow",declared:We,probed:cs,oauthFlow:e=>e.resourceIndicatorSent?Re("oauth-flow"):Ct("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:U("2026-07-28",Zn,"scope-selection-strategy"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"oauth-flow",declared:We,probed:cs,oauthFlow:e=>e.scopesRequested.length>0?Re("oauth-flow",{count:e.scopesRequested.length}):Ct("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:U("2026-07-28",Zn,"step-up-authorization-flow"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"observed",declared:We,probed:cs}},{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:U("2026-07-28",Zn,"authorization-response-validation"),stage:"stable",lifecycle:La,optional:!0,assessment:{primary:"oauth-flow",declared:We,probed:cs,oauthFlow:e=>e.issReturned?Re("oauth-flow",{detail:e.issValidated?"Returned and validated.":"Returned."}):ir([])}},{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:U("2026-07-28",Ma,"authorization-server-binding"),stage:"stable",lifecycle:La,optional:!0,assessment:{primary:"oauth-flow",declared:We,probed:cs,oauthFlow:e=>e.issuer?Re("oauth-flow"):Ct("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:U("2026-07-28",Zn,"refresh-tokens"),stage:"stable",lifecycle:La,optional:!0,assessment:{primary:"oauth-flow",declared:We,probed:cs,oauthFlow:e=>e.refreshTokenIssued?Re("oauth-flow"):e.scopesRequested.includes("offline_access")?ir([],"MCPJam asked for offline_access and got no refresh token."):Ct("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:U("2026-07-28",bb,"token-audience-binding-and-validation"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!1,assessment:{primary:"checked",declared:We,probed:cs}}],Na="client/elicitation",ls={primary:"observed",observable:!0},CH=[{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:U("2026-07-28","client/roots"),stage:"stable",lifecycle:Z({deprecated:"2026-07-28"}),optional:!0,assessment:ls},{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:U("2025-11-25","client/roots","root-list-changes"),stage:"stable",lifecycle:Z({removed:"2026-07-28"}),optional:!0,assessment:ls},{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:U("2026-07-28","client/sampling"),stage:"stable",lifecycle:Z({deprecated:"2026-07-28"}),optional:!0,assessment:ls},{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:U("2026-07-28","client/sampling","sampling-with-tools"),stage:"stable",lifecycle:Z({introduced:"2025-11-25",deprecated:"2026-07-28"}),optional:!0,assessment:ls},{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:U("2026-07-28","deprecated"),stage:"stable",lifecycle:Z({deprecated:"2025-11-25"}),optional:!0,assessment:ls},{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:U("2026-07-28",Na),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:U("2026-07-28",Na,"form-mode-elicitation-requests"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:ls},{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:U("2026-07-28",Na,"url-mode-elicitation-requests"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:ls},{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:U("2025-11-25","basic/index","error-codes"),stage:"stable",lifecycle:Z({introduced:"2025-11-25",removed:"2026-07-28"}),optional:!0,assessment:ls},{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:U("2025-11-25",Na),stage:"stable",lifecycle:Z({introduced:"2025-11-25",removed:"2026-07-28"}),optional:!0,assessment:ls},{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:U("2026-07-28",Na,"requested-schema"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:ls}],zl="basic/versioning",Qp="backward-compatibility-with-initialization-based-versions",wb=e=>{const t=Ti(e);return t==="legacy"?Re("advertised",{detail:`Negotiated ${e.protocolVersion}.`}):t==="unknown"&&e.protocolVersion?Ct("MCPJam does not know this protocol version yet."):null},PH=e=>(e.supportedVersions??[]).filter(t=>typeof t=="string"&&t.length>0),Zp="This server is configured for stdio.",xH=[{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:U("2025-11-25","basic/lifecycle","initialization"),stage:"stable",lifecycle:Z({removed:"2026-07-28"}),optional:!1,assessment:{primary:"declared",declared:wb}},{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:U("2025-11-25","basic/lifecycle","version-negotiation"),stage:"stable",lifecycle:Z({removed:"2026-07-28"}),optional:!1,assessment:{primary:"declared",declared:wb}},{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:U("2026-07-28","server/discover"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!1,assessment:{primary:"declared",declared:e=>Ti(e)!=="modern"?null:e.supportedVersions!==void 0||Ut(e.capabilities)&&nl(e,["capabilities"])?Re("advertised"):Ct("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:U("2026-07-28","server/discover"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!1,assessment:{primary:"declared",declared:e=>{const t=PH(e);return t.length>0?Re("advertised",{count:t.length,detail:Ko(t)}):Ti(e)==="modern"?Ct("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:U("2026-07-28",zl,"extension-negotiation"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!0,assessment:{primary:"declared",declared:e=>{const t=e.capabilities?.extensions;if(Ut(t)&&ip(t)){const s=Object.keys(t);return Re("advertised",{count:s.length,detail:Ko(s)})}const r=Ti(e);return r==="legacy"?Ct("Servers on 2025 revisions are not required to list extensions, so a missing list proves nothing."):r==="unknown"?e.protocolVersion?Ct("MCPJam does not know this protocol version yet."):null:il(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:U("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:U("2026-07-28",zl,Qp),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:U("2026-07-28",zl,Qp),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:U("2026-07-28",zl,Qp),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:U("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:U("2026-07-28","schema","requestmetaobject"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!1,assessment:{primary:"observed"}}],OH=[{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:U("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:br("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:U("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"?br(Zp):e.transport==="streamable-http"&&Ti(e)==="legacy"?Re("detected",{detail:"Connected over Streamable HTTP."}):null,probed:sn("http-transport",e=>{const t=$t(e.values.streamableHttp);if(t===!1)return Or(e);const r=Cs(Ai(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:U("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"?br(Zp):e.transport==="streamable-http"&&Ti(e)==="modern"?Re("detected",{detail:"Connected on 2026-07-28."}):null,probed:sn("http-transport",e=>{const t=Cs(Ai(e.values.protocolVersion));return $t(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:U("2026-07-28","deprecated"),stage:"stable",lifecycle:Z({deprecated:"2025-03-26"}),optional:!0,assessment:{primary:"probed",declared:e=>e.transport==="stdio"?br(Zp):e.transport==="sse"?Re("detected",{detail:"Connected over HTTP+SSE."}):null,probed:sn("http-transport",e=>{const t=$t(e.values.legacySse);return t===!0?Re("probed"):t===!1?Or(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:U("2026-07-28","basic/transports","custom-transports"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:e=>e.transport==="unknown"?null:br("MCPJam connects over stdio and HTTP only.")}}],eo="basic/patterns/mrtr",eh="server-requirements-basic-workflow",Fl="basic/patterns/subscriptions",Mr=Z({introduced:"2026-07-28"}),MH=[{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:U("2026-07-28",eo),stage:"stable",lifecycle:Mr,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:U("2026-07-28",eo,"supported-requests"),stage:"stable",lifecycle:Mr,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:U("2026-07-28",eo,eh),stage:"stable",lifecycle:Mr,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:U("2026-07-28",eo,eh),stage:"stable",lifecycle:Mr,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:U("2026-07-28","schema","inputrequiredresult"),stage:"stable",lifecycle:Mr,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:U("2026-07-28",eo,eh),stage:"stable",lifecycle:Mr,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:U("draft",eo),stage:"experimental",lifecycle:Mr,optional:!0,assessment:{primary:"observed",observable:!0}}],LH=[{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:U("2026-07-28","server/resources","capabilities"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",observable:!0,declared:ap("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:U("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:U("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:U("2026-07-28",Fl,"opening-a-stream"),stage:"stable",lifecycle:Mr,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:U("2026-07-28",Fl,"acknowledgment"),stage:"stable",lifecycle:Mr,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:U("2026-07-28","schema","notificationmetaobject"),stage:"stable",lifecycle:Mr,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:U("2026-07-28",Fl,"receiving-notifications"),stage:"stable",lifecycle:Mr,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:U("2026-07-28",Fl,"graceful-closure"),stage:"stable",lifecycle:Mr,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:U("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}}],Zr="server/resources",to="server/prompts",Sb=Z({introduced:"2026-07-28"});function NH(e){if(typeof e=="string")return/^([A-Za-z][A-Za-z0-9+.-]*):/.exec(e)?.[1]?.toLowerCase()}var $H=e=>{if(e.resources.length===0)return Lv(e,"resources");const t=[...new Set(e.resources.map(r=>NH(r.uri)).filter(r=>r!==void 0))].sort();return t.length>0?Re("detected",{count:t.length,detail:Ko(t)}):null},DH=e=>{const t=e.resourceTemplates.length;return t>0?Re("detected",{count:t,detail:`${t} resource templates`}):Ut(op(e,"resources"))?ir(["resourceTemplates"]):ir(["capabilities","resourceTemplates"])},UH=e=>{const t=sn("apps-ui-resources",s=>{const n=jf(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=sn("skills",s=>{const n=jf(s.values.verified)??0;return n>0?Re("probed",{count:n,detail:"Read skill files."}):null})(e);return r?.kind==="present"?r:null},qH=[{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:U("2026-07-28",Zr,"capabilities"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:ol("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:U("2026-07-28",Zr,"listing-resources"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:Nv("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:U("2026-07-28",Zr,"reading-resources"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"probed",observable:!0,probed:UH}},{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:U("2026-07-28",Zr,"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:U("2026-07-28",Zr,"common-uri-schemes"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:$H}},{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:U("2026-07-28",Zr,"list-changed-notification"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",observable:!0,declared:ap("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:U("2026-07-28",Zr,"capabilities"),stage:"stable",lifecycle:Sb,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:U("2026-07-28","basic/patterns/mrtr","supported-requests"),stage:"stable",lifecycle:Sb,optional:!0,assessment:{primary:"observed",observable:!0}}],zH=[{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:U("2026-07-28",Zr,"resource-templates"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:DH}},{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:U("2026-07-28","schema","resourcetemplate"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:sr("resourceTemplates",e=>ur(e.uriTemplate)&&ur(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:U("2026-07-28",Zr,"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:U("2026-07-28",Zr,"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:U("2026-07-28",Zr,"subscriptions"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"observed",observable:!0}}],FH=[{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:U("2026-07-28",to,"capabilities"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:ol("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:U("2026-07-28",to,"listing-prompts"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:Nv("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:U("2026-07-28","schema","promptargument"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:sr("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:U("2026-07-28",to,"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:U("2026-07-28",to,"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:U("2026-07-28",to,"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:U("2026-07-28",to,"list-changed-notification"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",observable:!0,declared:ap("prompts","listChanged","a list change notification")}}],$a="server/discover",jH=[{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:U("2026-07-28",$a),stage:"stable",lifecycle:{},optional:!1,assessment:{primary:"declared",declared:Oa(e=>ur(e.name)&&ur(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:U("2026-07-28",$a),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:{primary:"declared",declared:Oa(e=>ur(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:U("2026-07-28",$a),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"declared",declared:Oa(e=>ur(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:U("2026-07-28",$a),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"declared",declared:Oa(e=>ur(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:U("2026-07-28","basic/index","icons"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"declared",declared:Oa(e=>Array.isArray(e.icons)&&e.icons.some(t=>Ut(t)&&ur(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:U("2026-07-28",$a),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:e=>ur(e.instructions)?Re("advertised"):ir(["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:U("2026-07-28","schema","servercapabilities"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:e=>{const t=e.capabilities?.experimental;if(Ut(t)&&ip(t)){const r=Object.keys(t);return Re("advertised",{count:r.length,detail:Ko(r)})}return il(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:U("2026-07-28","schema","resultmetaobject"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!0,assessment:{primary:"observed",observable:!0,declared:e=>Ut(e.discoveryMeta)&&Ut(e.discoveryMeta["io.modelcontextprotocol/serverInfo"])?Re("detected",{detail:"Seen on server/discover."}):null}}],Da="server/utilities/completion",kb="server/utilities/pagination",jl="server/utilities/caching",Hl="server/utilities/logging",nc=Z({introduced:"2026-07-28"}),HH={tools:"tools/list",resources:"resources/list",resourceTemplates:"resources/templates/list",prompts:"prompts/list"},BH=["tools","resources","resourceTemplates","prompts"];function nI(e,t){return BH.filter(r=>{const s=e[r];return s!==void 0&&t(s)}).map(r=>HH[r])}function Eb(e){return t=>{const r=nI(t.listHints,e);return r.length>0?Re("advertised",{count:r.length,detail:`On ${Ko(r)}.`}):ir(["listHints"])}}var VH=e=>{const t=nI(e.listHints,r=>typeof r.pages=="number"&&r.pages>1);return t.length>0?Re("detected",{count:t.length,detail:`Paged ${Ko(t)}.`}):nl(e,["listHints"])?Ct("Every list fit on one page, so pagination did not come up."):null},GH=[{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:U("2026-07-28",Da,"capabilities"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:{primary:"declared",declared:ol("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:U("2026-07-28",Da,"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:U("2026-07-28",Da,"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:U("2026-07-28",Da,"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:U("2026-07-28",Da,"completion-results"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"checked"}}],KH=[{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:U("2026-07-28",kb),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",observable:!0,declared:VH}},{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:U("2026-07-28",kb,"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:U("2026-07-28",jl,"cacheable-results"),stage:"stable",lifecycle:nc,optional:!1,assessment:{primary:"declared",declared:Eb(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:U("2026-07-28",jl,"cacheable-results"),stage:"stable",lifecycle:nc,optional:!1,assessment:{primary:"declared",declared:Eb(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:U("2026-07-28",jl,"cacheable-model"),stage:"stable",lifecycle:nc,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:U("2026-07-28",jl,"cache-key"),stage:"stable",lifecycle:nc,optional:!1,assessment:{primary:"observed",observable:!0}}],WH=[{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:U("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:U("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:U("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:U("2026-07-28",Hl),stage:"stable",lifecycle:Z({deprecated:"2026-07-28"}),optional:!0,assessment:{primary:"declared",declared:ol("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:U("2025-11-25",Hl,"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:U("2026-07-28",Hl),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:U("2026-07-28",Hl,"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:U("2026-07-28","basic/index","meta"),stage:"stable",lifecycle:nc,optional:!0,assessment:{primary:"observed"}}],us="server/tools",JH=Z({introduced:"2026-07-28"}),Br={primary:"observed",observable:!0},YH=[{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:U("2026-07-28",us,"tool-result"),stage:"stable",lifecycle:{},optional:!0,assessment:Br},{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:U("2026-07-28",us,"text-content"),stage:"stable",lifecycle:{},optional:!0,assessment:Br},{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:U("2026-07-28",us,"image-content"),stage:"stable",lifecycle:{},optional:!0,assessment:Br},{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:U("2026-07-28",us,"audio-content"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:Br},{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:U("2026-07-28",us,"resource-links"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:Br},{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:U("2026-07-28",us,"embedded-resources"),stage:"stable",lifecycle:{},optional:!0,assessment:Br},{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:U("2026-07-28","schema","annotations"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:Br},{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:U("2026-07-28",us,"structured-content"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:Br},{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:U("2026-07-28",us,"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:U("2026-07-28",us,"error-handling"),stage:"stable",lifecycle:{},optional:!0,assessment:Br},{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:U("2026-07-28",us,"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:U("2026-07-28","basic/index","resulttype"),stage:"stable",lifecycle:JH,optional:!1,assessment:Br},{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:U("2026-07-28","basic/index","meta"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:Br}],Pr="server/tools",Hf=Z({introduced:"2026-07-28"}),XH=/^[A-Za-z0-9_.-]{1,128}$/,QH=e=>{const t=sr("tools",s=>ur(s.name),["tools"])(e);if(t?.kind!=="present")return t;const r=e.tools.filter(s=>typeof s.name=="string"&&!XH.test(s.name)).length;return r>0?{...t,detail:`${r} of ${e.tools.length} names fall outside the naming guidance.`}:t};function Bl(e){return t=>{const r=sr("tools",n=>typeof Ff(n,e)=="boolean",["tools"])(t);if(r?.kind!=="present"||r.count===void 0)return r;const s=t.tools.filter(n=>Ff(n,e)===!0).length;return{...r,detail:`Set on ${r.count} of ${t.tools.length} tools: ${s} true, ${r.count-s} false.`}}}function th(e){return Ut(e.execution)?e.execution.taskSupport:void 0}var ZH=e=>{const t=sr("tools",r=>th(r)==="optional"||th(r)==="required",["tools"])(e);return t?.kind!=="absent"?t:e.tools.some(r=>th(r)==="forbidden")?ir(t.basis,"Every tool that sets taskSupport sets it to forbidden."):t},eB=e=>{const t=sr("tools",r=>rI(r).some(s=>Ut(s)&&ur(s.$schema)),["tools","toolSchemas"])(e);return t?.kind!=="absent"?t:il(e,["tools","toolSchemas"],"Every tool schema uses the default dialect, JSON Schema 2020-12.")},tB=e=>{if(e.tools.length===0)return Lv(e,"tools");if(!nl(e,["toolSchemas"]))return Ct("The saved tool schemas may have lost their $ref keys. Reconnect to capture them in full.");const t=e.tools.flatMap(s=>rI(s).flatMap(n=>EH(n,"$ref")));if(t.length===0)return br("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."}):Ct(`${r} $ref pointers lead outside the schema.`)},rB=[{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:U("2026-07-28",Pr,"capabilities"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:ol("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:U("2026-07-28",Pr,"listing-tools"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:Nv("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:U("2026-07-28",Pr,"tool-names"),stage:"stable",lifecycle:{},optional:!1,assessment:{primary:"declared",declared:QH}},{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:U("2026-07-28",Pr,"tool"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:{primary:"declared",declared:sr("tools",e=>ur(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:U("2026-07-28",Pr,"tool"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",declared:sr("tools",e=>ur(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:U("2026-07-28",Pr,"tool"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"declared",declared:sr("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:U("2026-07-28","basic/index","meta"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:{primary:"declared",declared:sr("tools",e=>ip(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:U("2026-07-28",Pr,"list-changed-notification"),stage:"stable",lifecycle:{},optional:!0,assessment:{primary:"declared",observable:!0,declared:ap("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:U("2026-07-28",Pr,"capabilities"),stage:"stable",lifecycle:Hf,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:U("2026-07-28",Pr,"capabilities"),stage:"stable",lifecycle:Hf,optional:!1,assessment:{primary:"checked"}}],sB=[{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:U("2026-07-28","schema","toolannotations"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:{primary:"declared",declared:sr("tools",e=>ip(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:U("2026-07-28","schema","toolannotations"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:{primary:"declared",declared:sr("tools",e=>ur(Ff(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:U("2026-07-28","schema","toolannotations"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:{primary:"declared",declared:Bl("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:U("2026-07-28","schema","toolannotations"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:{primary:"declared",declared:Bl("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:U("2026-07-28","schema","toolannotations"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:{primary:"declared",declared:Bl("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:U("2026-07-28","schema","toolannotations"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!0,assessment:{primary:"declared",declared:Bl("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:U("2026-07-28",Pr,"tool"),stage:"stable",lifecycle:{},optional:!1,assessment:{primary:"declared",declared:sr("tools",e=>Ut(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:U("2026-07-28",Pr,"output-schema"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!0,assessment:{primary:"declared",declared:sr("tools",e=>Ut(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:U("2026-07-28","basic/index","schema-dialect"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"declared",declared:eB}},{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:U("2026-07-28","basic/index","ref-resolution"),stage:"stable",lifecycle:Hf,optional:!0,assessment:{primary:"declared",declared:tB}},{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:U("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:ZH}},{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:U("2026-07-28",Pr,"error-handling"),stage:"stable",lifecycle:Z({introduced:"2025-11-25"}),optional:!0,assessment:{primary:"observed"}}],ei="basic/transports",$s="basic/transports/streamable-http",Tb="earlier-streamable-http-revisions";function nB(e){if(e==="application/json")return"Answers with a JSON body.";if(e==="text/event-stream")return"Answers with an event stream."}var iB=[{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:U("2025-11-25",ei,"session-management"),stage:"stable",lifecycle:Z({introduced:"2025-03-26",removed:"2026-07-28"}),optional:!0,assessment:{primary:"probed",declared:Lt,probed:sn("http-transport",e=>{const t=$t(e.values.sessionIdIssued);if(t===!0)return Re("probed");const r=Cs(Ai(e.values.protocolVersion));return t===!1&&r==="legacy"?Or(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:U("2025-11-25",ei,"session-management"),stage:"stable",lifecycle:Z({introduced:"2025-03-26",removed:"2026-07-28"}),optional:!0,assessment:{primary:"checked",declared:Lt}},{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:U("2025-11-25",ei,"session-management"),stage:"stable",lifecycle:Z({introduced:"2025-03-26",removed:"2026-07-28"}),optional:!1,assessment:{primary:"checked",declared:Lt}},{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:U("2025-11-25",ei,"listening-for-messages-from-the-server"),stage:"stable",lifecycle:Z({introduced:"2025-03-26",removed:"2026-07-28"}),optional:!0,assessment:{primary:"checked",declared:Lt}},{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:U("2025-11-25",ei,"resumability-and-redelivery"),stage:"stable",lifecycle:Z({introduced:"2025-03-26",removed:"2026-07-28"}),optional:!0,assessment:{primary:"observed",declared:Lt}},{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:U("2025-11-25",ei,"resumability-and-redelivery"),stage:"stable",lifecycle:Z({introduced:"2025-11-25",removed:"2026-07-28"}),optional:!0,assessment:{primary:"observed",declared:Lt}},{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:U("2025-11-25",ei,"streamable-http"),stage:"stable",lifecycle:Z({introduced:"2025-03-26",removed:"2026-07-28"}),optional:!0,assessment:{primary:"observed",observable:!0,declared:Lt}},{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:U("2025-03-26","basic/index","batching"),stage:"stable",lifecycle:Z({introduced:"2025-03-26",removed:"2025-06-18"}),optional:!0,assessment:{primary:"checked",declared:Lt}},{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:U("2026-07-28",$s,"protocol-version-header"),stage:"stable",lifecycle:Z({introduced:"2025-06-18"}),optional:!1,assessment:{primary:"checked",declared:Lt}},{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:U("2026-07-28",$s),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!1,assessment:{primary:"checked",declared:Lt}},{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:U("2026-07-28",$s,"sending-messages"),stage:"stable",lifecycle:Z({introduced:"2025-03-26"}),optional:!1,assessment:{primary:"probed",declared:Lt,probed:sn("http-transport",e=>{const t=nB(Ai(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:U("2026-07-28",$s,"standard-request-headers"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!1,assessment:{primary:"checked",declared:Lt}},{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:U("2026-07-28",$s,"value-encoding"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!1,assessment:{primary:"checked",declared:Lt}},{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:U("2026-07-28","server/tools","x-mcp-header"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!0,assessment:{primary:"declared",declared:e=>Lt(e)??sr("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:U("2026-07-28",$s,Tb),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!0,assessment:{primary:"checked",declared:Lt}},{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:U("2026-07-28",$s,Tb),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!1,assessment:{primary:"probed",declared:Lt,probed:sn("http-transport",e=>{if(Cs(Ai(e.values.protocolVersion))!=="modern")return null;const t=$t(e.values.sessionIdIssued);return t===!1?Re("probed"):t===!0?Or(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:U("2026-07-28",$s,"cancellation"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!1,assessment:{primary:"observed",declared:Lt}},{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:U("2026-07-28",$s,"sending-messages"),stage:"stable",lifecycle:Z({introduced:"2026-07-28"}),optional:!0,assessment:{primary:"observed",declared:Lt}},{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:U("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"?Ti(e)==="modern"?Re("detected",{detail:"Answered on 2026-07-28 over stdio."}):null:e.transport==="unknown"?null:br("Applies to stdio servers. This server runs over HTTP.")}}],oB=[...jH,...xH,...OH,...iB,...MH,...LH,...rB,...sB,...YH,...qH,...zH,...FH,...GH,...KH,...WH,...CH,...RH],ki="https://github.com",Ab=`${ki}/modelcontextprotocol/ext-apps/blob/ea3e9d0e624a20bc1c51310292f09d9b8ed17161/specification`,Ib=`${ki}/modelcontextprotocol/ext-auth/blob/15ca394e00a66434520b9ade26294999295a43ae/specification/stable`,Rb=`${ki}/modelcontextprotocol/ext-server-card/blob/526201bbc80231daa40ffcdecfc9da4e54e5dc93`,aB={apps:`${Ab}/2026-01-26/apps.mdx`,"apps-draft":`${Ab}/draft/apps.mdx`,tasks:`${ki}/modelcontextprotocol/ext-tasks/blob/cc9aaac1047a9440b07486e38f37060bbebeef4c/specification/2026-07-28/tasks.md`,skills:`${ki}/modelcontextprotocol/ext-skills/blob/649f7aee87d631ac4d1fdd3b12eef0c6264fdb3a/specification/beta/skills.mdx`,events:`${ki}/modelcontextprotocol/ext-events/blob/47d95c979faa73427e1f6e0ac0c1347559d8ea37/docs/design-sketch-proposal.md`,"client-credentials":`${Ib}/oauth-client-credentials/2026-07-28/oauth-client-credentials.mdx`,"enterprise-managed-authorization":`${Ib}/enterprise-managed-authorization/2026-07-28/enterprise-managed-authorization.mdx`,"server-card-discovery":`${Rb}/docs/discovery.md`,"server-card-schema":`${Rb}/schema.ts`,openai:`${ki}/openai/mcp-extensions/blob/39f91ad0bdf1435aadb879172ab2467d0e97cead/docs/spec.md`},cB={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 se(e,t){const r=`${aB[e]}${t?`#${t}`:""}`;return sc(cB[e],r)}function Ms(e,t){return r=>({family:e,owner:"server",stage:t,lifecycle:{},optional:!0,...r})}function nn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qt(e,t){if(!nn(e))return;const r=e[t];return nn(r)?r:void 0}function Ps(e,t){if(!nn(e))return;const r=e[t];return typeof r=="string"?r:void 0}function Ss(e){return qt(e,"_meta")}function $i(e){return nn(e.capabilities)?e.capabilities:void 0}function $r(e,t){return t.every(r=>e.coverage[r]==="complete")}function cp(e,t,r){return`${e} of ${t} ${r}`}function on(e,t,r=["extensions"]){const s=$i(e);if(!s)return{state:"not-captured"};for(const n of r){const i=qt(s,n);if(!i||!Object.prototype.hasOwnProperty.call(i,t))continue;const o=`${n}["${t}"]`,a=i[t];return nn(a)?{state:"declared",settings:a,location:o}:{state:"malformed",location:o}}return{state:"not-declared"}}function iI(e,t,r,s){const n=on(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 lB(e)}}function lB(e){const t=Cs(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 lp(e,t,r){return t?.kind==="absent"&&$r(e,t.basis)?{kind:"not-applicable",reason:r}:null}function Vt(e){return typeof e=="boolean"?e:void 0}function zr(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function uB(e){return typeof e=="string"?e:void 0}function qu(e){if(Array.isArray(e))return e.filter(t=>typeof t=="string")}var dB={failed:"did not finish. Refresh to try again.",skipped:"was skipped for this connection.",abandoned:"stopped because the server asked for input."};function ya(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 ${dB[e.status]}`}}var Qt=Ms("mcp-apps","stable"),$v="ui://",pB="ui/resourceUri";function oI(e){return qt(Ss(e),"ui")}function Bf(e){return Ps(oI(e),"resourceUri")}function aI(e){return Ps(Ss(e),pB)}function cI(e){const t=Ps(e,"uri");return t!==void 0&&t.startsWith($v)&&Ps(e,"mimeType")==="text/html;profile=mcp-app"}var lI=["tools","toolMeta"];function hB(e){return e.tools.map(t=>Bf(t)??aI(t)).filter(t=>t!==void 0&&t.startsWith($v))}function fB(e){if(!(e.tools.length>0||!$r(e,["tools"])))return{kind:"not-applicable",reason:"This server lists no tools."}}function Cb(e,t){const r=fB(e);if(r)return r;const s=e.tools.filter(t).length;return s>0?{kind:"present",via:"detected",count:s,detail:cp(s,e.tools.length,"tools")}:{kind:"absent",basis:lI}}function Pb(e){const t=e.resources.filter(cI).length;if(t>0)return{kind:"present",via:"detected",count:t,detail:`${t} listed UI resources`};const r=new Set(hB(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 mB(e){return t=>{const r=t.resources.filter(s=>{if(!cI(s))return!1;const n=qt(Ss(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 uI(e){const t=e["apps-ui-resources"],r=ya(t,"UI resource");return r!==void 0||!t?{outcome:r??null}:zr(t.values.uiResourceCount)===0?{outcome:{kind:"not-applicable",reason:"This server has no UI resources to read."}}:(zr(t.values.readCount)??0)===0?{outcome:{kind:"unknown",reason:(zr(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 gB(e){return t=>{const r=uI(t);if("outcome"in r)return r.outcome;const{probe:s}=r,n=Vt(s.values[e]),i=zr(s.values.readCount)??0;return n===!0?{kind:"present",via:"detected",count:i}:n===!1&&s.coverage==="complete"&&(zr(s.values.readFailures)??0)===0?{kind:"absent",basis:[]}:{kind:"unknown",reason:"Some UI resources could not be read."}}}function Vl(e,t,r,s,n,i){return Qt({id:e,parent:"apps.resource-content",name:t,summary:n,howTo:i,spec:se("apps-draft","metadata-location"),assessment:{primary:"probed",declared:mB(r),probed:gB(s),requiresClientExtension:yn}})}function dn(e){return Qt({parent:"apps.bridge",owner:"host",...e,assessment:{primary:"observed",observable:!0}})}var Vr="Open the server in the Playground and call a tool that renders a view.",vB=[Qt({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:se("apps","clientserver-capability-negotiation"),assessment:{primary:"declared"}}),Qt({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:se("apps","resource-discovery"),assessment:{primary:"declared",declared:Pb,requiresClientExtension:yn}}),Qt({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:se("apps","ui-resource-format"),assessment:{primary:"declared",declared:Pb,probed:e=>{const t=e["apps-ui-resources"];if(t?.status!=="ok")return null;const r=zr(t.values.uiResourceCount)??0;return r>0?{kind:"present",via:"detected",count:r}:null},requiresClientExtension:yn}}),Qt({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:se("apps","resource-discovery"),assessment:{primary:"declared",declared:e=>Cb(e,t=>(Bf(t)??"").startsWith($v)),requiresClientExtension:yn}}),Qt({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:se("apps","resource-discovery"),assessment:{primary:"declared",declared:e=>{const t=e.tools.filter(s=>aI(s)!==void 0),r=t.filter(s=>Bf(s)===void 0).length;return r>0?{kind:"present",via:"detected",count:r,detail:`${cp(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."}:$r(e,lI)?{kind:"not-applicable",reason:"Not used. Servers should use _meta.ui.resourceUri."}:null}}}),Qt({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:se("apps","visibility"),assessment:{primary:"declared",declared:e=>Cb(e,t=>Array.isArray(oI(t)?.visibility)),requiresClientExtension:yn}}),Qt({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:se("apps-draft","metadata-location"),assessment:{primary:"probed",requiresClientExtension:yn}}),Vl("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."),Vl("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."),Vl("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."),Vl("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."),Qt({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:se("apps-draft","content-requirements"),assessment:{primary:"probed",probed:e=>{const t=uI(e);if("outcome"in t)return t.outcome;const r=Vt(t.probe.values.htmlProfileOk);return r===!0?{kind:"present",via:"probed",count:zr(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:yn}}),Qt({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:Vr,spec:se("apps","server-behavior"),assessment:{primary:"observed"}}),Qt({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:se("apps","server-behavior"),assessment:{primary:"probed"}}),Qt({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:se("apps","server-behavior"),assessment:{primary:"observed",observable:!0}}),Qt({id:"apps.bridge",name:"View and host messages",summary:"The messages a view and its host exchange while the view is open.",howTo:Vr,owner:"host",spec:se("apps","standard-mcp-messages"),assessment:{primary:"observed"}}),dn({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:`${Vr} Use a control in the view that calls a tool.`,spec:se("apps","standard-mcp-messages")}),dn({id:"apps.app-resources-read",name:"View-originated resources/read",summary:"The view reads the server's resources through the host.",howTo:Vr,spec:se("apps","standard-mcp-messages")}),dn({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:Vr,owner:"app",spec:se("apps","requests-view--host")}),dn({id:"apps.view-notifications",name:"View logging and ping",summary:"The view sends notifications/message logs and ping to the host.",howTo:Vr,owner:"app",spec:se("apps","standard-mcp-messages")}),dn({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:Vr,spec:se("apps","notifications-host--view")}),dn({id:"apps.display-modes",name:"Display modes (inline, fullscreen, pip)",summary:"The view lists the display modes it supports in ui/initialize.",howTo:`${Vr} Switch the view between inline, fullscreen and picture in picture.`,owner:"app",spec:se("apps","app-capabilities-in-uiinitialize")}),Qt({id:"apps.draft",name:"Draft additions",summary:"View features in the Apps draft that are not in the stable specification yet.",howTo:Vr,owner:"app",stage:"experimental",spec:se("apps-draft"),assessment:{primary:"observed"}}),dn({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:Vr,owner:"app",stage:"experimental",spec:se("apps-draft")}),dn({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:Vr,owner:"app",stage:"experimental",spec:se("apps-draft","app-provided-tools")})],dI="io.modelcontextprotocol/oauth-client-credentials",pI="io.modelcontextprotocol/enterprise-managed-authorization",_B="urn:ietf:params:oauth:grant-profile:id-jag",Gr=Ms("authorization-extensions","stable");function yB(e,t,r){const s=e.authorization,n=ya(s,"authorization metadata");if(n!==void 0||!s)return{outcome:n??null};const i=s.values;if(Vt(i.oauthRequired)===!1&&Vt(i.oauthOptional)===!1)return{outcome:{kind:"not-applicable",reason:"This server does not use OAuth."}};if(Vt(i.asMetadataFound)!==!0)return{outcome:{kind:"unknown",reason:"No authorization server metadata was found."}};const o=qu(i[t]);return!o||o.length===0?{outcome:{kind:"unknown",reason:`The authorization server metadata has no ${r}.`}}:{list:o}}function rh(e,t,r,s){const n=yB(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 bB=[Gr({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:se("client-credentials"),assessment:{primary:"configured",declared:We,setup:"client-credentials"}}),Gr({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:se("client-credentials","server-metadata-requirements"),assessment:{primary:"configured",declared:We,setup:"client-credentials",probed:e=>rh(e,"grantTypesSupported","grant_types_supported",["client_credentials"])}}),Gr({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:se("client-credentials","server-metadata-requirements"),assessment:{primary:"probed",declared:We,probed:e=>rh(e,"tokenEndpointAuthMethods","token_endpoint_auth_methods_supported",["private_key_jwt","client_secret_basic"])}}),Gr({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:se("client-credentials","flow-steps"),assessment:{primary:"configured",declared:We,setup:"client-credentials"}}),Gr({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:se("enterprise-managed-authorization"),assessment:{primary:"configured",declared:We,setup:"enterprise-managed-authorization"}}),Gr({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:se("enterprise-managed-authorization"),assessment:{primary:"configured",declared:We,setup:"enterprise-managed-authorization"}}),Gr({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:se("enterprise-managed-authorization","6-discovery"),assessment:{primary:"probed",declared:We,probed:e=>rh(e,"authorizationGrantProfiles","authorization_grant_profiles_supported",[_B])}}),Gr({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:se("enterprise-managed-authorization","4-token-exchange"),assessment:{primary:"configured",declared:We,setup:"enterprise-managed-authorization"}}),Gr({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:se("enterprise-managed-authorization","5-access-token-request"),assessment:{primary:"configured",declared:We,setup:"enterprise-managed-authorization"}}),Gr({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:se("enterprise-managed-authorization","4-token-exchange"),assessment:{primary:"configured",declared:We,setup:"enterprise-managed-authorization"}}),Gr({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:SH("ext-auth","auth/overview"),lifecycle:{introduced:"2026-07-28"},assessment:{primary:"declared",declared:e=>{const t=We(e);if(t)return t;const r=[dI,pI].filter(s=>on(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."}}}})],xb="beta@c77b843",Dv="draft@28ec35e",hI="chatgpt@2026-11-05",fI="chatgpt@2026-09-30",wB="https://github.com/modelcontextprotocol/experimental-ext-triggers-events/blob/28ec35e905daa241f019981e2836b4a02f1c0368/docs/design-sketch-proposal.md",SB="https://developers.openai.com/plugins/build/mcp-events",ti=e=>({kind:"documented",source:wB,section:e}),Wr=e=>({kind:"documented",source:SB,section:e}),vr=e=>({kind:"policy",note:e}),sh="sdk/scripts/chatgpt-events-probe.ts",ri={id:Dv,title:"MCP Events draft (working group, pinned 28ec35e)",capabilityPlacement:{value:"capabilities.events",provenance:ti("Capability Declaration")},protocolVersions:{value:["2025-11-25","2026-07-28"],provenance:vr("The draft is version-agnostic; MCPJam exercises it on both eras it speaks.")},transports:{value:["stdio","sse","streamable-http"],provenance:vr("The draft is transport-agnostic.")},deliveryModes:{value:["poll","push","webhook"],provenance:ti("Subscribing and Event Delivery")},controlEnvelopes:{value:["gap","terminated","verification"],provenance:ti("Non-event webhook bodies")},maxBodyBytes:{value:{bytes:262144,strength:"SHOULD"},provenance:ti("Delivery profile")},nonRetryableStatuses:{value:[410,413],provenance:ti("Webhook Event Delivery; Delivery profile")},consentMethods:{value:["challenge","allowlist","out-of-band","well-known"],provenance:ti("Endpoint verification")},requestedTtlMs:{value:36e5,provenance:vr("MCPJam requests one hour; servers may clamp.")},secretBytes:{value:32,provenance:vr("CSPRNG, middle of the draft's 24–64 byte window.")},refreshLead:{value:"max(60 s, 10% of the remaining grant), at most half of it, before refreshBefore",provenance:vr("MCPJam keeper schedule.")},unsubscribesOnEnd:{value:!0,provenance:vr("Removing a subscription in MCPJam always unsubscribes.")},batching:{value:"off",provenance:vr("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:vr("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:vr("MCPJam event-job executor.")},pollFloorMs:{value:1e3,provenance:ti("Poll-Based Delivery (nextPollMs floor, default 1000 ms)")}},mI={id:hI,title:"ChatGPT (as of 2026-11-05)",capabilityPlacement:{value:"capabilities.events",provenance:Wr("Advertise event support")},protocolVersions:{value:[...yx],provenance:Wr("Before you start")},transports:{value:["streamable-http"],provenance:Wr("Before you start")},deliveryModes:{value:["webhook"],provenance:Wr("Before you start")},controlEnvelopes:{value:["verification"],provenance:Wr("Before you start (gap and terminated are not supported); Verify the callback")},maxBodyBytes:{value:{bytes:262144,strength:"MUST"},provenance:Wr("Handle delivery responses")},nonRetryableStatuses:{value:[410,413],provenance:Wr("Handle delivery responses")},consentMethods:{value:["challenge"],provenance:Wr("Verify the callback")},requestedTtlMs:{value:"unknown",provenance:{kind:"unobserved",probe:sh}},secretBytes:{value:"unknown",provenance:{kind:"unobserved",probe:sh}},refreshLead:{value:"before refreshBefore (exact lead unknown)",provenance:{kind:"unobserved",probe:sh}},unsubscribesOnEnd:{value:!0,provenance:Wr("Test in ChatGPT, step 9 (stop monitoring → events/unsubscribe)")},batching:{value:"host-setting",provenance:Wr("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:vr("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:vr("ChatGPT's internal prompting is not observable; this is MCPJam's own.")},pollFloorMs:{value:1e3,provenance:vr("Poll is unsupported by ChatGPT; the draft floor applies.")}},kB={...mI,id:fI,title:"ChatGPT (as of 2026-09-30, historical)",protocolVersions:{value:["2026-07-28"],provenance:Wr("Before you start")}},Ds=e=>({kind:"documented",source:"https://github.com/modelcontextprotocol/ext-events/blob/c77b84395eff0ae32f53b0516c2214fe276ed050/specification/beta/events/events.mdx",section:e}),XW={[xb]:{...ri,id:xb,title:"MCP Events Beta (SEP-3415)",capabilityPlacement:{value:"capabilities.extensions['io.modelcontextprotocol/events']",provenance:Ds("Capability Negotiation")},protocolVersions:{value:["2026-07-28"],provenance:Ds("Specification")},transports:{value:["stdio","streamable-http"],provenance:Ds("Push-Based Delivery")},deliveryModes:{value:ri.deliveryModes.value,provenance:Ds("Delivery Modes")},controlEnvelopes:{value:ri.controlEnvelopes.value,provenance:Ds("Non-event webhook bodies")},maxBodyBytes:{value:ri.maxBodyBytes.value,provenance:Ds("Webhook security")},nonRetryableStatuses:{value:ri.nonRetryableStatuses.value,provenance:Ds("Webhook event delivery; Webhook security")},consentMethods:{value:ri.consentMethods.value,provenance:Ds("Webhook security")},secretBytes:{value:32,provenance:vr("CSPRNG, within the 24 to 64 byte window in the Beta specification.")},pollFloorMs:{value:1e3,provenance:Ds("Poll-Based Delivery")}},[Dv]:ri,[hI]:mI,[fI]:kB},Gs=Ms("events","sketch"),EB="The server does not declare capabilities.events.";function Vf(e){const t=$i(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"]}:nn(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 kn(e){return lp(e,Vf(e),EB)}function Gl(e){return t=>{const r=t["events-list"],s=ya(r,"events/list");if(s!==void 0||!r)return s??null;if(Vt(r.values.listed)!==!0)return null;const n=qu(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 nh(e){return Gs({...e,assessment:{primary:"observed",observable:!0,declared:kn}})}function ih(e){return Gs({parent:"events.webhooks",...e,assessment:{primary:"configured",setup:"event-webhook",declared:kn}})}var Kl="Subscribe to one of the server's events in MCPJam and watch Tracing.",Ua="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.",TB=[Gs({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:se("events","capability-declaration"),assessment:{primary:"declared",declared:Vf}}),Gs({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:se("events","listing-available-events"),assessment:{primary:"probed",declared:kn,probed:e=>{const t=e["events-list"],r=ya(t,"events/list");return r!==void 0||!t?r??null:Vt(t.values.listed)!==!0?{kind:"unknown",reason:"events/list did not answer."}:{kind:"present",via:"probed",count:zr(t.values.eventCount)??0}}}}),Gs({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:se("events","dynamic-event-types"),assessment:{primary:"observed",observable:!0,declared:e=>Vf(e)?.kind!=="present"?kn(e):qt($i(e),"events")?.listChanged===!0?{kind:"unknown",reason:"The server promises list change notifications. None has been seen yet."}:{kind:"absent",basis:["capabilities"]}}}),Gs({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:se("events","poll-based-delivery"),assessment:{primary:"checked",observable:!0,declared:kn,probed:Gl("poll")}}),Gs({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. ${Kl}`,spec:se("events","push-based-delivery"),assessment:{primary:"observed",observable:!0,declared:kn,probed:Gl("push")}}),Gs({id:"events.webhooks",name:"Webhook delivery",summary:"The server delivers occurrences to a webhook the client registers.",howTo:Ua,spec:se("events","webhook-based-delivery"),assessment:{primary:"configured",setup:"event-webhook",declared:kn,probed:Gl("webhook")}}),Gs({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:Ua,spec:se("events","webhook-based-delivery"),assessment:{primary:"configured",setup:"event-webhook",declared:kn,probed:Gl("webhook")}}),ih({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:Ua,spec:se("events","webhook-security")}),ih({id:"events.unsubscribe",name:"events/unsubscribe",summary:"Ends a webhook subscription.",howTo:Ua,spec:se("events","unsubscribing")}),ih({id:"events.delivery-status",name:"deliveryStatus",summary:"Reports whether recent webhook deliveries succeeded.",howTo:Ua,spec:se("events","webhook-delivery-status")}),nh({id:"events.terminated",name:"notifications/events/terminated",summary:"Tells the client a subscription or stream has ended and why.",howTo:Kl,spec:se("events","authorization")}),nh({id:"events.cursor-replay",name:"Cursor replay, maxAgeMs and truncation",summary:"Clients resume from a cursor and learn when old occurrences were dropped.",howTo:Kl,spec:se("events","cursor-lifecycle")}),nh({id:"events.error-codes",name:"Events error codes",summary:`Events errors use -32011 to -32015 in MCPJam's pinned ${Dv} profile or -32023 to -32027 in the current provisional sketch, and either is accepted.`,howTo:Kl,spec:se("events","error-codes")})],AB=Ms("server-cards","beta"),IB="Server Card",RB="/server-card",Gf="No Server Card was found.";function mo(e){const t=e["server-card"],r=ya(t,IB);return r!==void 0||!t?{outcome:r??null}:{probe:t}}function Kf(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 Us(e,t){return r=>{const s=mo(r);if("outcome"in s)return s.outcome;const{probe:n}=s;if(t.needsCard&&Vt(n.values.serverCardFound)!==!0)return{kind:"not-applicable",reason:Gf};const i=Vt(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"?Kf(n):{kind:"unknown",reason:t.whenFalse}}}function Ir(e,t){return AB({...e,assessment:{primary:"probed",probed:t}})}var CB=[Ir({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:se("server-card-discovery","well-known-uri")},Us("aiCatalogFound",{needsCard:!1,whenFalse:"absent"})),Ir({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:se("server-card-discovery","server-card-entries")},e=>{const t=mo(e);return"outcome"in t?t.outcome:Vt(t.probe.values.aiCatalogFound)!==!0?{kind:"not-applicable",reason:"No AI Catalog was found."}:Us("catalogEntryFound",{needsCard:!1,whenFalse:"absent"})(e)}),Ir({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:se("server-card-discovery","hosted-server-card-location")},e=>{const t=mo(e);if("outcome"in t)return t.outcome;const r=uB(t.probe.values.serverCardUrl);return Vt(t.probe.values.serverCardFound)===!0&&r?.endsWith(RB)?{kind:"present",via:"probed"}:Kf(t.probe)}),Ir({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:se("server-card-discovery","hosted-server-card-location")},Us("mediaTypeOk",{needsCard:!0,whenFalse:"The card was served with a different media type."})),Ir({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:se("server-card-schema")},e=>{const t=mo(e);if("outcome"in t)return t.outcome;const r=qu(t.probe.values.missingFields)??[];return Us("requiredFieldsOk",{needsCard:!0,whenFalse:r.length>0?`The card is missing ${r.join(", ")}.`:"The card is missing required fields."})(e)}),Ir({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:se("server-card-schema")},e=>{const t=mo(e);if("outcome"in t)return t.outcome;if(Vt(t.probe.values.serverCardFound)!==!0)return{kind:"not-applicable",reason:Gf};const r=qu(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(", ")}:Kf(t.probe)}),Ir({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:se("server-card-schema")},Us("remotesListed",{needsCard:!0,whenFalse:"absent",via:"advertised"})),Ir({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:se("server-card-schema")},Us("hasMeta",{needsCard:!0,whenFalse:"absent",via:"advertised"})),Ir({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:se("server-card-discovery","consistency-with-runtime-behavior")},e=>{const t=mo(e);if("outcome"in t)return t.outcome;if(Vt(t.probe.values.serverCardFound)!==!0)return{kind:"not-applicable",reason:Gf};const r=Vt(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."}}),Ir({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:se("server-card-discovery","cors-requirements")},Us("corsAllowed",{needsCard:!0,whenFalse:"The card response has no CORS headers, so browser clients cannot read it."})),Ir({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:se("server-card-discovery","caching")},Us("cacheControl",{needsCard:!0,whenFalse:"absent"})),Ir({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:se("server-card-discovery","transport-security")},Us("https",{needsCard:!0,whenFalse:"The card is served over plain HTTP."}))],PB="io.modelcontextprotocol.skills/",Ob="skill://",xB="Applies only when the server declares the Skills extension.",gr=Ms("skills","beta");function gI(e){return iI(e,Ic,"The Skills extension")}function OB(e){return on(e,Ic).state==="declared"}function pn(e){if(OB(e))return;const t=gI(e);return t?.kind==="absent"&&$r(e,t.basis)?{kind:"not-applicable",reason:xB}:null}function vI(e){const t=e.skills,r=ya(t,"skills");return r!==void 0||!t?{outcome:r??null}:Vt(t.values.listed)!==!0?{outcome:{kind:"unknown",reason:"skills/list did not answer."}}:{probe:t}}function Mb(e,t,r){const s=vI(e);if("outcome"in s)return s.outcome;const n=s.probe.values;if(zr(n.count)===0)return{kind:"not-applicable",reason:"The server lists no skills."};const i=zr(n[t])??0;if(i>0)return{kind:"unknown",reason:r(i)};const o=zr(n.verified)??0;return o>0?{kind:"present",via:"probed",count:o}:{kind:"unknown",reason:"No skill was read and verified."}}function MB(e){return e.skills.map(t=>Ps(t,"uri")).filter(t=>t!==void 0)}var LB=[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:se("skills","capability-negotiation"),assessment:{primary:"declared",declared:e=>{const t=on(e,Ic);return t.state==="declared"&&t.settings.directoryRead===!0?{kind:"present",via:"advertised",detail:"directoryRead: true"}:gI(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:se("skills","capability-negotiation"),assessment:{primary:"declared",declared:e=>{const t=pn(e);return t!==void 0?t:qt($i(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:se("skills","listing-skills"),assessment:{primary:"probed",declared:e=>e.skills.length>0?{kind:"present",via:"detected",count:e.skills.length}:pn(e)??null,probed:e=>{const t=vI(e);return"outcome"in t?t.outcome:{kind:"present",via:"probed",count:zr(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:se("skills","getting-a-skill"),assessment:{primary:"observed",observable:!0,declared:e=>pn(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:se("skills","resource-mapping"),assessment:{primary:"probed",declared:e=>{const t=MB(e);if(t.length===0)return pn(e)??null;const r=t.filter(s=>s.startsWith(Ob)&&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:se("skills","verification-on-read"),assessment:{primary:"probed",probed:e=>Mb(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:se("skills","frontmatter-verification"),assessment:{primary:"probed",probed:e=>Mb(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:se("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:se("skills","reading-directories"),assessment:{primary:"declared",declared:e=>{const t=on(e,Ic);return t.state!=="declared"?pn(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:Vt(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:se("skills","pointer-from-server-instructions"),assessment:{primary:"declared",declared:e=>{const t=pn(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:se("skills","resource-metadata"),assessment:{primary:"declared",declared:e=>{const t=pn(e);if(t!==void 0)return t;const r=[...e.skills,...e.resources.filter(s=>(Ps(s,"uri")??"").startsWith(Ob))].filter(s=>Object.keys(Ss(s)??{}).some(n=>n.startsWith(PB))).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:se("skills","error-handling"),assessment:{primary:"checked",declared:e=>pn(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:se("skills","security-considerations"),assessment:{primary:"observed"}})],QW=st({}),_I="io.modelcontextprotocol/tasks";function NB(e){const t=Cs(e);return t==="modern"?"extension":t==="legacy"?e==="2025-11-25"?"core":"none":"unknown"}var $B={kind:"unknown",reason:"The protocol version of this capture is unknown, so the Tasks form cannot be chosen."};function In(e,t){return r=>{const s=NB(r.protocolVersion);return s==="unknown"?$B:s===e?t(r):null}}function yI(e){const t=$i(e);return qt(t,"tasks")??qt(qt(t,"experimental"),"tasks")}function zu(e){const t=yI(e);if(!t)return{kind:"absent",basis:["capabilities"]};const r=[t.list!==void 0?"list":void 0,t.cancel!==void 0?"cancel":void 0,qt(qt(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 bI="The server does not declare the Tasks capability.",DB="The server does not declare the Tasks extension.";function Lb(e){return In("core",t=>{const r=yI(t);return r?e(r)!==void 0?{kind:"present",via:"advertised"}:{kind:"absent",basis:["capabilities"]}:lp(t,zu(t),bI)})}var UB=In("core",e=>lp(e,zu(e),bI));function Wf(e){return iI(e,_I,"The Tasks extension")}var Jf=In("extension",e=>lp(e,Wf(e),DB)),qB=new Set(["optional","required"]),go=Ms("tasks","experimental"),ic=Ms("tasks","beta"),vo={introduced:"2025-11-25",removed:"2026-07-28"},oc={introduced:"2026-07-28"},ds=e=>U("2025-11-25","basic/utilities/tasks",e),ps="Call a tool that runs as a task in the Playground, then watch Tracing.";function qa(e){return go({parent:"tasks.core",lifecycle:vo,...e,assessment:{primary:"observed",observable:!0,declared:UB}})}function ro(e){return ic({parent:"tasks.ext",lifecycle:oc,...e,assessment:{primary:"observed",observable:!0,declared:Jf}})}var zB=[go({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:vo,spec:ds(),assessment:{primary:"declared",declared:In("core",zu)}}),go({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:vo,spec:ds("server-capabilities"),assessment:{primary:"declared",declared:In("core",zu)}}),go({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:vo,spec:ds("tool-level-negotiation"),assessment:{primary:"declared",declared:In("core",e=>{if(e.tools.length===0&&$r(e,["tools"]))return{kind:"not-applicable",reason:"This server lists no tools."};const t=e.tools.filter(r=>{const s=Ps(qt(r,"execution"),"taskSupport");return s!==void 0&&qB.has(s)}).length;return t>0?{kind:"present",via:"detected",count:t,detail:cp(t,e.tools.length,"tools")}:{kind:"absent",basis:["tools"]}})}}),qa({id:"tasks.core.augmented-call",name:"Task-augmented tools/call",summary:"A tools/call with params.task returns a CreateTaskResult instead of waiting.",howTo:ps,spec:ds("creating-tasks")}),qa({id:"tasks.core.get",name:"tasks/get",summary:"Returns a task's current status.",howTo:ps,spec:ds("getting-tasks")}),qa({id:"tasks.core.result",name:"tasks/result",summary:"Waits for a task to finish and returns its result.",howTo:ps,spec:ds("retrieving-task-results")}),go({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:vo,spec:ds("listing-tasks"),assessment:{primary:"declared",declared:Lb(e=>e.list),observable:!0}}),go({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:vo,spec:ds("cancelling-tasks"),assessment:{primary:"observed",declared:Lb(e=>e.cancel),observable:!0}}),qa({id:"tasks.core.status-notification",name:"notifications/tasks/status",summary:"The server pushes task status changes instead of waiting to be polled.",howTo:ps,spec:ds("task-status-notification")}),qa({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:`${ps} Use a tool that asks for input while it runs.`,spec:ds("input-required-status")}),ic({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:oc,spec:se("tasks"),assessment:{primary:"declared",declared:In("extension",Wf)}}),ic({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:oc,spec:se("tasks","capability-negotiation"),assessment:{primary:"declared",declared:In("extension",Wf)}}),ro({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:`${ps} An ordinary result does not mean tasks are unsupported.`,spec:se("tasks","polymorphic-results")}),ro({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:ps,spec:se("tasks","task-polling")}),ro({id:"tasks.ext.update",name:"tasks/update (inputResponses)",summary:"The client answers a task's input requests without restarting the call.",howTo:`${ps} Use a tool that asks for input while it runs.`,spec:se("tasks","task-update-requests")}),ro({id:"tasks.ext.cancel",name:"tasks/cancel",summary:"The client asks the server to stop a task.",howTo:`${ps} Cancel the task while it runs.`,spec:se("tasks","task-cancellation")}),ro({id:"tasks.ext.notifications",name:"notifications/tasks on subscriptions/listen",summary:"The server pushes task status to clients that subscribe by task id.",howTo:ps,spec:se("tasks","task-status-notifications")}),ro({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:se("tasks","capability-negotiation")}),ic({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:oc,spec:se("tasks","streamable-http-routing-headers"),assessment:{primary:"checked",declared:Jf}}),ic({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:oc,spec:se("tasks","protocol-errors"),assessment:{primary:"checked",declared:Jf}})],up="openai/settings",$c="openai/mentions",Uv="io.modelcontextprotocol/files",FB={tools:["listChanged"],resources:["subscribe","listChanged"],prompts:["listChanged"],completions:[],logging:[],experimental:null,extensions:null,tasks:["list","cancel","requests"],events:["listChanged"]},jB={[yn]:null,[_I]:[],[Ic]:["directoryRead"],[dI]:null,[pI]:null,[up]:["readTool","updateTool"],[$c]:["searchTool"],[Uv]:null},HB={tasks:["list","cancel","requests"],[up]:["readTool","updateTool"],[$c]:["searchTool"],[Uv]:null},Nb=64;function $b(e){return e.length>Nb?`${e.slice(0,Nb)}…`:e}function oh(e,t,r,s){for(const[n,i]of Object.entries(e)){if(!Object.prototype.hasOwnProperty.call(t,n)){s.push(r($b(n)));continue}const o=t[n];if(!(o==null||!nn(i)))for(const a of Object.keys(i))o.includes(a)||s.push(`${r(n)}.${$b(a)}`)}}function BB(e){const t=[];oh(e,FB,n=>`capabilities.${n}`,t);const r=e.extensions;nn(r)&&oh(r,jB,n=>`extensions["${n}"]`,t);const s=e.experimental;return nn(s)&&oh(s,HB,n=>`experimental["${n}"]`,t),t}var ms=Ms("third-party-experimental","early-access"),ah=Ms("third-party-experimental","stable"),Db=Ms("third-party-experimental","experimental"),Fu=["extensions","experimental"],VB=[up,$c],ch="https://developers.openai.com/apps-sdk/reference",Yf=["tools","toolMeta"],GB=["openai/outputTemplate","openai/widgetAccessible","openai/visibility","openai/toolInvocation/invoking","openai/toolInvocation/invoked","openai/fileParams"],KB=["openai/widgetDescription","openai/widgetPrefersBorder","openai/widgetCSP","openai/widgetDomain"],WB="text/html+skybridge";function wI(e,t){const r=on(e,t,Fu);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 JB(e,t){return e.tools.find(r=>Ps(r,"name")===t)}function Ub(e,t){if(e.tools.length===0&&$r(e,["tools"]))return{kind:"not-applicable",reason:"This server lists no tools."};const r=e.tools.filter(s=>{const n=Ss(s);return n!==void 0&&t(n)}).length;return r>0?{kind:"present",via:"detected",count:r,detail:cp(r,e.tools.length,"tools")}:{kind:"absent",basis:Yf}}function YB(e){const t=on(e,$c,Fu);if(t.state!=="declared")return wI(e,$c);const r=Ps(t.settings,"searchTool"),s=r?JB(e,r):void 0;if(!s)return $r(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=qt(s,"annotations")?.readOnlyHint===!0,i=qt(Ss(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 XB="Open the server in the Playground with the ChatGPT or Codex client and use one of its views.";function za(e){return ms({parent:"openai.extensions",owner:"host",howTo:XB,...e,assessment:{primary:"observed",observable:!0}})}var QB=[ms({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:se("openai"),assessment:{primary:"declared"}}),ms({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:se("openai","server-capabilities"),assessment:{primary:"declared",declared:e=>{const t=VB.flatMap(r=>{const s=on(e,r,Fu);return s.state==="declared"||s.state==="malformed"?[s.location]:[]});return t.length===0?$r(e,["capabilities"])?{kind:"not-applicable",reason:"The server declares no OpenAI capability."}:null:!t.some(r=>r.startsWith("extensions"))&&Cs(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(", ")}}}}),ms({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:se("openai","structured-settings"),assessment:{primary:"declared",declared:e=>wI(e,up)}}),ms({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:se("openai","composer-at-mentions"),assessment:{primary:"declared",declared:YB}}),ms({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:se("openai","composer-at-mentions"),assessment:{primary:"declared",declared:e=>{const t=Ub(e,r=>qt(r,"openai/extensions")?.["mentions/search"]!==void 0);return t?.kind==="absent"?$r(e,Yf)?{kind:"not-applicable",reason:"Not used. Servers should declare openai/mentions."}:null:t}}}),ms({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:se("openai","mcp-app-entrypoints"),assessment:{primary:"declared",declared:e=>Ub(e,t=>{const r=qt(t,"openai/ui")?.entrypoints;return Array.isArray(r)&&r.length>0})}}),ms({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:se("openai","deep-links"),assessment:{primary:"observed"}}),ms({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:se("openai","display-modes"),assessment:{primary:"probed",declared:e=>{const t=e.resources.filter(r=>{const s=qt(Ss(r),"openai/ui");return s?.availableDisplayModes!==void 0||s?.preferredDisplayMode!==void 0}).length;return t>0?{kind:"present",via:"detected",count:t}:null}}}),za({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:se("openai","filesystem-access")}),za({id:"openai.model-context",name:"openai/modelContext",summary:"The view adds titled, grouped context with thumbnails for the model.",spec:se("openai","uiupdate-model-context-extensions")}),za({id:"openai.message",name:"openai/message",summary:"The view sends a message with a title, target and send behavior.",spec:se("openai","uimessage-extensions")}),za({id:"openai.files",name:"openai/files (open local files)",summary:"The view asks the host to open a local file.",spec:se("openai","opening-local-files")}),za({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:se("openai","openai-form-elicitation")}),ms({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:se("openai","plugin-onboarding"),assessment:{primary:"configured",setup:"openai-onboarding"}}),ah({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:sc("openai-apps-sdk",ch),assessment:{primary:"declared"}}),ah({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:sc("openai-apps-sdk",ch),assessment:{primary:"declared",declared:e=>{const t=new Set;for(const r of e.tools){const s=Ss(r)??{};for(const n of GB)s[n]!==void 0&&t.add(n)}for(const r of e.resources){const s=Ss(r)??{};for(const n of KB)s[n]!==void 0&&t.add(n);Ps(r,"mimeType")==="text/html+skybridge"&&t.add(WB)}return t.size>0?{kind:"present",via:"detected",count:t.size,detail:[...t].join(", ")}:$r(e,["tools","toolMeta","resources"])?{kind:"not-applicable",reason:"Not used. MCP Apps metadata replaces these keys."}:null}}}),ah({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:sc("openai-apps-sdk",ch),assessment:{primary:"declared",declared:e=>{const t=e.tools.filter(r=>Ss(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.`}:$r(e,Yf)?{kind:"not-applicable",reason:"Optional. Hosts that connect several accounts use it."}:null}}}),Db({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:sc("experimental","https://modelcontextprotocol.io/extensions/overview#experimental-extensions"),assessment:{primary:"declared",declared:e=>{const t=$i(e);if(!t)return null;const r=new Set;on(e,"io.modelcontextprotocol/files",Fu).state==="declared"&&r.add(Uv);const s=qt(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"]}}}}),Db({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:U("2026-07-28","basic/versioning","extension-negotiation"),assessment:{primary:"declared",declared:e=>{const t=$i(e);if(!t)return null;const r=BB(t);return r.length>0?{kind:"present",via:"advertised",count:r.length,detail:r.slice(0,20).join(", ")}:$r(e,["capabilities"])?{kind:"not-applicable",reason:"Every declared capability is in the catalog."}:null}}})],ZB=[...bB,...vB,...zB,...LB,...TB,...CB,...QB],SI=[...oB,...ZB],e5={"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"]},t5={"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"},r5={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"]},s5={"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"},n5={"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"]},kI={protocol:s5,apps:e5,tasks:n5,events:t5,oauth:r5};function i5(e,t){return`${e}:${t}`}function qb(e){const t=e.indexOf(":"),r=e.slice(0,t),s=kI[r]?.[e.slice(t+1)];return Array.isArray(s)?s:[]}function EI(e){const t=[];for(const[r,s]of Object.entries(kI))for(const[n,i]of Object.entries(s))Array.isArray(i)&&i.includes(e)&&t.push(i5(r,n));return t}var o5={"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"},a5={"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"},c5={"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"},l5={"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"},u5={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"},zb={protocol:o5,apps:a5,tasks:c5,events:l5,oauth:u5};function d5(e){const t=e.indexOf(":"),r=e.slice(0,t),s=e.slice(t+1);if(!Object.hasOwn(zb,r))return;const n=zb[r];return Object.hasOwn(n,s)?n[s]:void 0}function p5(e){const t=d5(e);return t==="passive"||t==="read-only"}var h5=["events:events-capability-declared","events:events-list-shape"];function f5(e){return p5(e)?e.startsWith("apps:")||h5.includes(e):!1}function m5(e,t){return EI(e).some(r=>{if(!t)return!0;const s=r.slice(0,r.indexOf(":"));return t.includes(s)})}function g5(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||EI(t.id).some(f5),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 m5(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&&v5(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 v5(e,t){const r=e.assessment.observableEra;if(!r)return!0;const s=Cs(t.context?.protocolVersion??t.declared?.surface.protocolVersion);return s==="unknown"||s===r}var Fb=["checked","probed","declared","observed","oauth-flow"];function TI(e,t){const r=e.assessment.primary,s=(r==="configured"?Fb:[r,...Fb.filter(n=>n!==r)]).map(n=>g5(n,e,t)).filter(n=>n!==null);return s.find(n=>n.nextAction)??s[0]??{reason:"MCPJam cannot check this yet."}}var _5=["2024-11-05","2025-03-26","2025-06-18","2025-11-25","2026-07-28"];function Xf(e){return e?_5.indexOf(e):-1}function qv(e){return Xf(e)>=0}function Qf(e,t){return Xf(e)>=Xf(t)}function AI(e,t){const{introduced:r,removed:s}=e.lifecycle;if(!r&&!s)return"applies";if(!qv(t))return"unknown-version";const n=t;return s&&Qf(n,s)?"removed":r&&!Qf(n,r)?"not-yet":"applies"}function II(e,t){const{deprecated:r}=e.lifecycle;return!r||!qv(t)?!1:Qf(t,r)}function y5(e,t){const r=[];return AI(e,t)==="removed"?r.push("removed"):II(e,t)&&r.push("deprecated"),e.stage!=="stable"&&r.push(e.stage),r}var b5=["protocol","apps","tasks","events","oauth"];function RI(e){return typeof e=="string"&&b5.includes(e)}function w5(e){const t=e.indexOf(":");return t>0&&t<e.length-1&&RI(e.slice(0,t))}function S5(e){if(e==="passed"||e==="failed")return e;if(e==="could_not_run"||e==="not_applicable")return"skipped"}function ZW(e){const t=[];for(const r of e.suites)if(RI(r.suiteKind))for(const s of r.cases){const n=S5(s.status);n&&t.push({ref:`${r.suiteKind}:${s.id}`,status:n,runId:e.runId,runAt:e.runAt,protocolVersion:e.protocolVersion})}return t}var k5=new Set(["server","authorization-server"]),CI=["checked","observed","probed","oauth-flow","declared","detected"];function E5(e,t){return t==="detected"?"detected":t==="advertised"?"declared":e}function Wl(){return Object.fromEntries(pH.map(e=>[e,0]))}function T5(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 lh(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 A5(e){let t;for(const r of Object.values(e??{}))r&&(t===void 0||r.at>t)&&(t=r.at);return t}function uh(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:E5(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"?T5(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 I5(e,t,r){const s=[],n=a=>{a&&s.push(a)},i=e.assessment,o=t.declared?.surface;n(uh({feature:e,outcome:lh(i.declared,o),source:"declared",capturedAt:t.declared?.capturedAt,contextHash:r,surface:o})),n(uh({feature:e,outcome:lh(i.probed,t.probes),source:"probed",capturedAt:A5(t.probes),contextHash:r})),n(uh({feature:e,outcome:lh(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||!w5(c)||qb(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(!qb(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 R5(e){let t;for(const r of e)r.capturedAt!==void 0&&(t===void 0||r.capturedAt>t)&&(t=r.capturedAt);return t}function C5(e,t,r){const s=t.context?.protocolVersion??t.declared?.surface.protocolVersion,n=I5(e,t,r),i=y5(e,s);let o=AI(e,s);const a={featureId:e.id,markers:i,evidence:n,seenAt:R5(n)},c=(f,g={})=>({...a,applicability:o,state:f,sources:[],...g}),l=n.find(f=>f.outcome==="not-applicable"),u=n.filter(f=>f.outcome==="present"),p=n.find(f=>f.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:CI.filter(f=>u.some(g=>g.source===f))});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(!k5.has(e.owner))return c("needs-newer",{reason:n.find(f=>f.outcome==="unknown")?.detail??`Depends on the ${e.owner==="identity-provider"?"identity provider":e.owner}, not only the server.`});const d=n.find(f=>f.outcome==="absent");if(d&&d.coverage==="complete"){if(o==="unknown-version"||!qv(s))return c("not-checked",{reason:s?`MCPJam has no rules for protocol version ${s} yet.`:"The protocol version is unknown.",nextAction:"reconnect"});const f=e.assessment.requiresClientExtension,g=t.context?.clientExtensions;return f&&!g?c("not-checked",{reason:"MCPJam did not record which extensions this client advertised. Reconnect to capture them.",nextAction:"reconnect"}):f&&!g?.includes(f)?c("needs-newer",{reason:`This client did not advertise ${f}, and servers may hide this feature from such clients.`}):II(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(f=>f.outcome==="unknown");if(e.assessment.primary==="configured")return P5(e,t,h,c);if(!t.connected&&n.length===0)return c("not-checked",{reason:"Connect this server to check it.",nextAction:"connect"});const m=TI(e,t);return c("not-checked",{reason:h?.detail??m.reason,...m.nextAction?{nextAction:m.nextAction}:{}})}function P5(e,t,r,s){const n=e.assessment.setup;if(!n||!t.setupOffered?.includes(n)){const o=TI(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 x5=["check-failed","supported","could-add","needs-newer","not-checked","not-applicable"];function O5(e,t){if(t.length===0||e.evidence.length>0)return e;const r=x5.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=CI.filter(i=>t.some(o=>o.state==="supported"&&o.sources.includes(i)));return{...s,sources:n}}function eJ(e,t){const r=t.context?wH(t.context):void 0,s={},n=new Map;for(const p of e)if(s[p.id]=C5(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]=O5(s[p.id],d.map(h=>s[h])))}const i=Wl(),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=mH(p.family).card;i[d]+=1;const m=o.get(h)??Wl();m[d]+=1,o.set(h,m);const f=a.get(p.family)??Wl();f[d]+=1,a.set(p.family,f),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??Wl(),leafCount:h??0});return{context:t.context,contextHash:r,assessments:s,cards:ZA.map(p=>u(p,o.get(p),c.get(p))),families:dH.map(p=>u(p,a.get(p),l.get(p))),totals:i}}var tJ=new Set(SI.filter(e=>e.assessment.observable).map(e=>e.id)),M5=new Set(SI.filter(e=>e.assessment.observable&&(e.family==="mcp-apps"||e.family==="third-party-experimental"&&e.owner==="host")).map(e=>e.id));function Dc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function PI(e,t){if(!Dc(e))return;const r=e[t];return Dc(r)?r:void 0}function Zf(e,t){const r=PI(e,"_meta");return r!==void 0&&r[t]!==void 0}var L5=new Set(["ui/open-link","ui/message","ui/update-model-context","ui/request-display-mode"]),N5=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"]),jb=new Set(["tools/call","tools/list"]);function $5(e){const t=Dc(e)?e.content:void 0;return Array.isArray(t)&&t.some(r=>Dc(r)&&r.type==="text")}function D5(e,t,r){if(e==="tools/call"&&r.add("apps.app-tools-call"),e==="resources/read"&&(r.add("apps.app-resources-read"),Zf(t,"openai/resource")&&r.add("openai.file-resources")),L5.has(e)&&r.add("apps.view-requests"),e==="ui/message"&&Zf(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=PI(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 rJ(e,t){const r=new Set,s=Dc(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?D5(n,s?.params,r):i&&jb.has(e.method)&&r.add("apps.app-provided-tools");else if(i)t==="ui/update-model-context"&&Zf(s?.result,"openai/modelContext")&&r.add("openai.model-context");else{const o=n??e.method;N5.has(o)&&r.add("apps.host-notifications"),o==="ui/notifications/tool-result"&&$5(s?.params)&&r.add("apps.text-fallback"),jb.has(o)&&r.add("apps.app-provided-tools")}return[...r].filter(o=>M5.has(o))}function em(){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 Is=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,hr=globalThis,xI="10.75.0";function al(){return zv(hr),hr}function zv(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||"10.75.0",t[xI]=t["10.75.0"]||{}}function dp(e,t,r=hr){const s=r.__SENTRY__=r.__SENTRY__||{},n=s[xI]=s["10.75.0"]||{};return n[e]||(n[e]=t())}var sJ=["debug","info","warn","error","log","assert","trace"],U5="Sentry Logger ",Hb={};function Fv(e){if(!("console"in hr))return e();const t=hr.console,r={},s=Object.keys(Hb);s.forEach(n=>{const i=Hb[n];r[n]=t[n],t[n]=i});try{return e()}finally{s.forEach(n=>{t[n]=r[n]})}}function q5(){Hv().enabled=!0}function z5(){Hv().enabled=!1}function OI(){return Hv().enabled}function F5(...e){jv("log",...e)}function j5(...e){jv("warn",...e)}function H5(...e){jv("error",...e)}function jv(e,...t){Is&&OI()&&Fv(()=>{hr.console[e](`${U5}[${e}]:`,...t)})}function Hv(){return Is?dp("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var ss={enable:q5,disable:z5,isEnabled:OI,log:F5,warn:j5,error:H5},MI=50;var Bb=/\(error: (.*)\)/,Vb=/captureMessage|captureException/;function B5(...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(`
|
|
135
|
+
`);for(let a=s;a<o.length;a++){let c=o[a];c.length>1024&&(c=c.slice(0,1024));const l=Bb.test(c)?c.replace(Bb,"$1"):c;if(!l.includes("Error: ")){for(const u of t){const p=u(l);if(p){i.push(p);break}}if(i.length>=MI+n)break}}return V5(i.slice(n))}}function nJ(e){return Array.isArray(e)?B5(...e):e}function V5(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(Jl(t).function||"")&&t.pop(),t.reverse(),Vb.test(Jl(t).function||"")&&(t.pop(),Vb.test(Jl(t).function||"")&&t.pop()),t.slice(0,MI).map(r=>({...r,filename:r.filename||Jl(t).filename,function:r.function||"?"}))}function Jl(e){return e[e.length-1]||{}}var dh="<anonymous>";function G5(e){try{return!e||typeof e!="function"?dh:e.name||dh}catch{return dh}}function iJ(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 LI=Object.prototype.toString;function K5(e){switch(LI.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Bv(e,Error)}}function ba(e,t){return LI.call(e)===`[object ${t}]`}function oJ(e){return ba(e,"ErrorEvent")}function aJ(e){return ba(e,"DOMError")}function cJ(e){return ba(e,"DOMException")}function tm(e){return ba(e,"String")}function W5(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function J5(e){return e===null||W5(e)||typeof e!="object"&&typeof e!="function"}function Y5(e){return ba(e,"Object")}function X5(e){return typeof e=="object"&&e!==null}function Q5(e){return typeof Event<"u"&&Bv(e,Event)}function Z5(e){return ba(e,"RegExp")}function pp(e){return!!(e?.then&&typeof e.then=="function")}function Bv(e,t){try{return e instanceof t}catch{return!1}}function lJ(e){return typeof Request<"u"&&Bv(e,Request)}function uJ(e,t,r){if(!(t in e))return;const s=e[t];if(typeof s!="function")return;const n=r(s);typeof n=="function"&&e6(n,s);try{e[t]=n}catch{Is&&ss.log(`Failed to replace method "${t}" in object`,e)}}function xs(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch{Is&&ss.log(`Failed to add non-enumerable property "${String(t)}" to object`,e)}}function e6(e,t){try{e.prototype=t.prototype=t.prototype||{},xs(e,"__sentry_original__",t)}catch{}}function dJ(e){return e.__sentry_original__}function NI(e){if(K5(e))return{message:e.message,name:e.name,stack:e.stack,...Gb(e)};if(Q5(e)){const{type:t,target:r,currentTarget:s,detail:n}=e;return{type:t,target:r,currentTarget:s,...n?{detail:n}:{},...Gb(e)}}return e}function Gb(e){return X5(e)?Object.fromEntries(Object.entries(e)):{}}function pJ(e){const t=Object.keys(NI(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}var so;function cl(e){if(so!==void 0)return so?so(e):e();const t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),r=hr;return t in r&&typeof r[t]=="function"?(so=r[t],so(e)):(so=null,e())}function Ii(){return cl(()=>Math.random())}function $I(){return cl(()=>Date.now())}var t6=Symbol.for("sentry.skipNormalization"),r6=Symbol.for("sentry.overrideNormalizationDepth");function s6(e){return!!e[t6]}function n6(e){const t=e[r6];return typeof t=="number"?t:void 0}var rm;function hJ(e){rm=e}function vn(e,t=100,r=1/0){try{return sm("",e,t,r)}catch(s){return{ERROR:`**non-serializable** (${s})`}}}function i6(e,t=3,r=102400){const s=vn(e,t);return c6(s)>r?i6(e,t-1,r):s}function sm(e,t,r=1/0,s=1/0,n=l6()){const[i,o]=n;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;const a=DI(e,t);if(!a.startsWith("[object "))return a;if(s6(t))return t;const c=n6(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 sm("",u.toJSON(),l-1,s,n)}catch{}const p=Array.isArray(t)?[]:{};let d=0;const h=NI(t);for(const m in h){if(!Object.prototype.hasOwnProperty.call(h,m))continue;if(d>=s){p[m]="[MaxProperties ~]";break}const f=h[m];p[m]=sm(m,f,l-1,s,n),d++}return o(t),p}function DI(e,t){try{if(rm){const r=rm(t);if(r)return r}return typeof global<"u"&&t===global?"[Global]":typeof t=="number"&&!Number.isFinite(t)?`[${t}]`:typeof t=="function"?`[Function: ${G5(t)}]`:typeof t=="symbol"?`[${String(t)}]`:typeof t=="bigint"?`[BigInt: ${String(t)}]`:`[object ${o6(t)}]`}catch(r){return`**non-serializable** (${r})`}}function o6(e){const t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}function a6(e){return~-encodeURI(e).split(/%..|./).length}function c6(e){return a6(JSON.stringify(e))}function l6(){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 nm(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function fJ(e,t){if(!Array.isArray(e))return"";const r=[];for(let s=0;s<e.length;s++){const n=e[s];J5(n)?r.push(String(n)):n instanceof Error?r.push(n.message?`${n.name}: ${n.message}`:n.name):r.push(DI(void 0,n))}return r.join(t)}function u6(e,t,r=!1){return tm(e)?Z5(t)?t.test(e):tm(t)?r?e===t:e.includes(t):typeof t=="function"?t(e):!1:!1}function mJ(e,t=[],r=!1){for(const s of t)if(u6(e,s,r))return!0;return!1}function d6(){const e=hr;return e.crypto||e.msCrypto}var ph;function p6(){return Ii()*16}function Un(e=d6()){try{if(e?.randomUUID)return cl(()=>e.randomUUID()).replace(/-/g,"")}catch{}return ph||(ph="10000000100040008000100000000000"),ph.replace(/[018]/g,t=>(t^(p6()&15)>>t/4).toString(16))}function UI(e){return e.exception?.values?.[0]}function gJ(e){const{message:t,event_id:r}=e;if(t)return t;const s=UI(e);return s?s.type&&s.value?`${s.type}: ${s.value}`:s.type||s.value||r||"<unknown>":r||"<unknown>"}function vJ(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 h6(e,t){const r=UI(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 _J(e){if(f6(e))return!0;try{xs(e,"__sentry_captured__",!0)}catch{}return!1}function f6(e){try{return e.__sentry_captured__}catch{}}var qI=1e3;function Vv(){return $I()/qI}function m6(){const{performance:e}=hr;if(!e?.now||!e.timeOrigin)return Vv;const t=e.timeOrigin;return()=>(t+cl(()=>e.now()))/qI}var Kb;function Gv(){return(Kb??(Kb=m6()))()}var hh=null;function g6(){const{performance:e}=hr;if(!e?.now)return;const t=3e5,r=cl(()=>e.now()),s=$I(),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 yJ(){return hh===null&&(hh=g6()),hh}function v6(e){const t=Gv(),r={sid:Un(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>y6(r)};return e&&hp(r,e),r}function hp(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||Gv(),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:Un()),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 _6(e,t){let r={};t?r={status:t}:e.status==="ok"&&(r={status:"exited"}),hp(e,r)}function y6(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 fp(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]=fp(s[n],t[n],r-1));return s}function Wo(){return Un()}function ll(){return Un().substring(16)}function zI(e){try{const t=hr.WeakRef;if(typeof t=="function")return new t(e)}catch{}return e}function FI(e){if(e){if(typeof e=="object"&&"deref"in e&&typeof e.deref=="function")try{return e.deref()}catch{return}return e}}var im="_sentrySpan";function Wb(e,t){t?xs(e,im,zI(t)):delete e[im]}function om(e){return FI(e[im])}var b6=100,Di=class am{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:Wo(),sampleRand:Ii()}}clone(){const t=new am;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,Wb(t,om(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&&hp(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 am?r.getScopeData():Y5(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,Wb(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Wo(),sampleRand:Ii()}),this._notifyScopeListeners(),this}addBreadcrumb(t,r){const s=typeof r=="number"?r:b6;if(s<=0)return this;const n={timestamp:Vv(),...t,message:t.message?nm(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:om(this),conversationId:this._conversationId}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=fp(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,r){const s=r?.event_id||Un();if(!this._client)return Is&&ss.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||Un();if(!this._client)return Is&&ss.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||Un();return this._client?(this._client.captureEvent(t,{...r,event_id:s},this),s):(Is&&ss.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 w6(){return dp("defaultCurrentScope",()=>new Di)}function S6(){return dp("defaultIsolationScope",()=>new Di)}var Jb=e=>e instanceof Promise&&!e[jI],jI=Symbol("chained PromiseLike"),k6=(e,t,r)=>{const s=e.then(n=>(t(n),n),n=>{throw r(n),n});return Jb(s)&&Jb(e)?s:E6(e,s)},E6=(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,{[jI]:!0}),t},T6=class{constructor(e,t){let r;e?r=e:r=new Di;let s;t?s=t:s=new Di,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 pp(r)?k6(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 Jo(){const e=al(),t=zv(e);return t.stack=t.stack||new T6(w6(),S6())}function A6(e){return Jo().withScope(e)}function I6(e,t){const r=Jo();return r.withScope(()=>(r.getStackTop().scope=e,t(e)))}function Yb(e){return Jo().withScope(()=>e(Jo().getIsolationScope()))}function R6(){return{withIsolationScope:Yb,withScope:A6,withSetScope:I6,withSetIsolationScope:(e,t)=>Yb(t),getCurrentScope:()=>Jo().getScope(),getIsolationScope:()=>Jo().getIsolationScope()}}function mp(e){const t=zv(e);return t.acs?t.acs:R6()}function C6(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)&&Object.keys(e).includes("value")}function P6(e,t){const{value:r,unit:s}=C6(e)?e:{value:e,unit:void 0},n=x6(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 Xb(e,t=!1){const r={};for(const[s,n]of Object.entries(e??{})){const i=P6(n,t);i&&(r[s]=i)}return r}function x6(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 HI;function O6(){return HI?.()}function bJ(){return HI!==void 0}function ji(){const e=al();return mp(e).getCurrentScope()}function Hi(){const e=al();return mp(e).getIsolationScope()}function M6(){return dp("globalScope",()=>new Di)}function wJ(...e){const t=al(),r=mp(t);if(e.length===2){const[s,n]=e;return s?r.withSetScope(s,n):r.withScope(n)}return r.withScope(e[0])}function gp(){return ji().getClient()}function SJ(e){const t=O6();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||ll()};return s&&(i.parent_span_id=s),i}var kJ="sentry.source",EJ="sentry.sample_rate",TJ="sentry.previous_trace_sample_rate",L6="sentry.op",N6="sentry.origin";var AJ="sentry.idle_span_finish_reason",IJ="sentry.measurement_unit",RJ="sentry.measurement_value",CJ="sentry.custom_span_name",PJ="sentry.profile_id",xJ="sentry.exclusive_time",OJ="sentry.link.type",MJ="gen_ai.conversation.id";function $6(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 LJ(e,t){e.setAttribute("http.response.status_code",t);const r=$6(t);r.message!=="unknown_error"&&e.setStatus(r)}var BI="_sentryScope",VI="_sentryIsolationScope",D6=Symbol.for("sentry.otelSourceInference"),U6=Symbol.for("sentry.otelSourceExplicitlySet"),q6=Symbol.for("sentry.tracerProviderSpan");function NJ(e,t,r){e&&(xs(e,VI,zI(r)),xs(e,BI,t))}function cm(e){const t=e;return{scope:t[BI],isolationScope:FI(t[VI])}}function $J(e){return e[D6]===!0}function DJ(e){xs(e,U6,!0)}function UJ(e){return e[q6]===!0}var z6="sentry-";function GI(e){const t=F6(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 qJ(e){if(e)return j6(Object.entries(e).reduce((t,[r,s])=>(s&&(t[`${z6}${r}`]=s),t),{}))}function F6(e){if(!(!e||!tm(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,r)=>{const s=Qb(r);return Object.entries(s).forEach(([n,i])=>{t[n]=i}),t},{}):Qb(e)}function Qb(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 j6(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?(Is&&ss.warn(`Not adding key: ${r} with val: ${s} to baggage header due to exceeding baggage size limits.`),t):o},"")}var H6=/^o(\d+)\./,B6=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function V6(e){return e==="http"||e==="https"}function zJ(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 G6(e){const t=B6.exec(e);if(!t){Fv(()=>{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 KI({host:i,pass:n,path:c,projectId:l,port:o,protocol:r,publicKey:s})}function KI(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function K6(e){if(!Is)return!0;const{port:t,projectId:r,protocol:s}=e;return["protocol","publicKey","host","projectId"].find(n=>e[n]?!1:(ss.error(`Invalid Sentry Dsn: ${n} missing`),!0))?!1:r.match(/^\d+$/)?V6(s)?t&&isNaN(parseInt(t,10))?(ss.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(ss.error(`Invalid Sentry Dsn: Invalid protocol ${s}`),!1):(ss.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function W6(e){return e.match(H6)?.[1]}function J6(e){const t=e.getOptions(),{host:r}=e.getDsn()||{};let s;return t.orgId?s=String(t.orgId):r&&(s=W6(r)),s}function FJ(e){const t=typeof e=="string"?G6(e):KI(e);if(!(!t||!K6(t)))return t}function Zb(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 Y6=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function X6(e){if(!e)return;const t=e.match(Y6);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 jJ(e,t){const r=X6(e),s=GI(t);if(!r?.traceId)return{traceId:Wo(),sampleRand:Ii()};const n=eV(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 Q6(e=Wo(),t=ll(),r){let s="";return r!==void 0&&(s=r?"-1":"-0"),`${e}-${t}${s}`}function Z6(e=Wo(),t=ll(),r){return`00-${e}-${t}-${r?"01":"00"}`}function eV(e,t){const r=Zb(t?.sample_rand);if(r!==void 0)return r;const s=Zb(t?.sample_rate);return s&&e?.parentSampled!==void 0?e.parentSampled?Ii()*s:s+Ii()*(1-s):Ii()}var e0=!1;function HJ(e){const{spanId:t,traceId:r}=e.spanContext(),{data:s,op:n,parent_span_id:i,status:o,origin:a,links:c}=vp(e);return{parent_span_id:i,span_id:t,trace_id:r,data:s,op:n,status:o,origin:a,links:c}}function tV(e){const{spanId:t,traceId:r,isRemote:s}=e.spanContext(),n=s?t:vp(e).parent_span_id,i=cm(e).scope;return{parent_span_id:n,span_id:s?i?.getPropagationContext().propagationSpanId||ll():t,trace_id:r}}function BJ(e){const{traceId:t,spanId:r}=e.spanContext(),s=ul(e);return Q6(t,r,s)}function VJ(e){const{traceId:t,spanId:r}=e.spanContext(),s=ul(e);return Z6(t,r,s)}function rV(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 sV(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 ju(e){return typeof e=="number"?t0(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?t0(e.getTime()):Gv()}function t0(e){return e>9999999999?e/1e3:e}function vp(e){if(YI(e))return e.getSpanJSON();const{spanId:t,traceId:r}=e.spanContext();if(JI(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:WI(e),start_timestamp:ju(n),timestamp:ju(o)||void 0,status:nV(a),op:s[L6],origin:s[N6],links:rV(c)}}return{span_id:t,trace_id:r,start_timestamp:0,data:{}}}function GJ(e){if(YI(e))return e.getStreamedSpanJSON();const{spanId:t,traceId:r}=e.spanContext();if(JI(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:WI(e),start_timestamp:ju(n),end_timestamp:ju(o),is_segment:e===um(e),status:XI(a),attributes:iV(s,a),links:sV(c)}}return{span_id:t,trace_id:r,start_timestamp:0,name:"",end_timestamp:0,status:"ok",is_segment:e===um(e)}}function WI(e){return"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0}function KJ(e){return{...e,attributes:Xb(e.attributes),links:e.links?.map(t=>({...t,attributes:Xb(t.attributes)}))}}function JI(e){const t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function YI(e){return typeof e.getSpanJSON=="function"}function ul(e){const{traceFlags:t}=e.spanContext();return t===1}function nV(e){if(!(!e||e.code===0))return e.code===1?"ok":e.message||"internal_error"}function XI(e){return!e||e.code===1||e.code===0||e.message==="cancelled"?"ok":"error"}function iV(e,t){const r=XI(t)==="error"?t?.message:void 0;return{...r&&{"sentry.status.message":r},...e}}var Ri="_sentryChildSpans",lm="_sentryRootSpan";function WJ(e,t){const r=e[lm]||e;xs(t,lm,r),ul(e)&&(!e.isRecording()&&!r.isRecording()||(e[Ri]?e[Ri].add(t):xs(e,Ri,new Set([t]))))}function JJ(e,t){e[Ri]&&e[Ri].delete(t)}function YJ(e){const t=new Set;function r(s){if(!t.has(s)&&ul(s)){t.add(s);const n=s[Ri]?Array.from(s[Ri]):[];for(const i of n)r(i)}}return r(e),Array.from(t)}var QI=um;function um(e){return e[lm]||e}function XJ(){const e=al(),t=mp(e);return t.getActiveSpan?t.getActiveSpan():om(ji())}function QJ(){e0||(Fv(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),e0=!0)}function r0(e){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const t=e||gp()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}var ZI=Symbol.for("sentry.nonRecordingSpan"),ZJ=class{constructor(e={}){this._traceId=e.traceId||Wo(),this._spanId=e.spanId||ll(),this.dropReason=e.dropReason,xs(this,ZI,!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 oV(e){return!!e&&e[ZI]===!0}var eY="production",eR="_frozenDsc";function tY(e,t){xs(e,eR,t)}function tR(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:J6(t)};return t.emit("createDsc",n),n}function aV(e,t){const r=t.getPropagationContext();return r.dsc||tR(r.traceId,e)}function cV(e){const t=gp();if(!t)return{};const r=QI(e),s=vp(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(g){return(typeof o=="number"||typeof o=="string")&&(g.sample_rate=`${o}`),g}const c=r[eR];if(c)return a(c);const l=oV(r),u=l&&r.dropReason==="ignored";if(l&&(!r0(t.getOptions())||u)){const g=cm(r).scope;if(g){const _={...aV(t,g)};return u&&(_.sampled="false"),a(_)}}const p=i?.get("sentry.dsc"),d=p&&GI(p);if(d)return a(d);const h=tR(e.spanContext().traceId,t),m=n["sentry.source"]??n["sentry.segment.name.source"],f=s.description;return m!=="url"&&f&&(h.transaction=f),r0()&&(h.sampled=String(ul(r)),h.sample_rand=i?.get("sentry.sample_rand")??cm(r).scope?.getPropagationContext().sampleRand.toString()),a(h),t.emit("createDsc",h,r),h}function lV(e,t){const{fingerprint:r,span:s,breadcrumbs:n,sdkProcessingMetadata:i}=t;uV(e,t),s&&hV(e,s),fV(e,r),dV(e,n),pV(e,i)}function s0(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:m,span:f}=t;Fa(e,"extra",r),Fa(e,"tags",s),Fa(e,"attributes",n),Fa(e,"user",i),Fa(e,"contexts",o),e.sdkProcessingMetadata=fp(e.sdkProcessingMetadata,c,2),a&&(e.level=a),m&&(e.transactionName=m),f&&(e.span=f),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 Fa(e,t,r){e[t]=fp(e[t],r,1)}function rR(e,t){const r=M6().getScopeData();return e&&s0(r,e.getScopeData()),t&&s0(r,t.getScopeData()),r}function uV(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 dV(e,t){const r=[...e.breadcrumbs||[],...t];e.breadcrumbs=r.length?r:void 0}function pV(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function hV(e,t){e.contexts={trace:tV(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:cV(t),...e.sdkProcessingMetadata};const r=QI(t),s=vp(r).description;s&&!e.transaction&&e.type==="transaction"&&(e.transaction=s)}function fV(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 fh=0,n0=1,i0=2;function sR(e){return new nR(t=>{t(e)})}function mV(e){return new nR((t,r)=>{r(e)})}var nR=class dm{constructor(t){this._state=fh,this._handlers=[],this._runExecutor(t)}then(t,r){return new dm((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 dm((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===fh)return;const t=this._handlers.slice();this._handlers=[],t.forEach(r=>{r[0]||(this._state===n0&&r[1](this._value),this._state===i0&&r[2](this._value),r[0]=!0)})}_runExecutor(t){const r=(i,o)=>{if(this._state===fh){if(pp(o)){o.then(s,n);return}this._state=i,this._value=o,this._executeHandlers()}},s=i=>{r(n0,i)},n=i=>{r(i0,i)};try{t(s,n)}catch(i){n(i)}}};function gV(e,t,r,s=0){try{const n=pm(t,r,e,s);return pp(n)?n:sR(n)}catch(n){return mV(n)}}function pm(e,t,r,s){const n=r[s];if(!e||!n)return e;const i=n({...e},t);return Is&&i===null&&ss.log(`Event processor "${n.id||"?"}" dropped event`),pp(i)?i.then(o=>pm(o,t,r,s+1)):pm(i,t,r,s+1)}var si,o0,a0,hn;function vV(e){const t=hr._sentryDebugIds,r=hr._debugIds;if(!t&&!r)return{};const s=t?Object.keys(t):[],n=r?Object.keys(r):[];if(hn&&s.length===o0&&n.length===a0)return hn;o0=s.length,a0=n.length,hn={},si||(si={});const i=(o,a)=>{for(const c of o){const l=a[c],u=si?.[c];if(u&&hn&&l)hn[u[0]]=l,si&&(si[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&&hn&&si){hn[h]=l,si[c]=[h,l];break}}}}};return t&&i(s,t),r&&i(n,r),hn}function rY(e,t,r,s,n,i){const{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=e,c={...t,event_id:t.event_id||r.event_id||Un(),timestamp:t.timestamp||Vv()},l=r.integrations||e.integrations.map(f=>f.name);_V(c,e),wV(c,l),n&&n.emit("applyFrameMetadata",t),t.type===void 0&&yV(c,e.stackParser);const u=kV(s,r.captureContext);r.mechanism&&h6(c,r.mechanism);const p=n?n.getEventProcessors():[],d=rR(i,u),h=[...r.attachments||[],...d.attachments];h.length&&(r.attachments=h),lV(c,d);const m=[...p,...d.eventProcessors];return(r.data&&r.data.__sentry__===!0?sR(c):gV(m,c,r)).then(f=>(f&&bV(f),typeof o=="number"&&o>0?SV(f,o,a):f))}function _V(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=nm(o.url,i)),i&&e.exception?.values?.forEach(a=>{a.value&&(a.value=nm(a.value,i))})}function yV(e,t){const r=vV(t);e.exception?.values?.forEach(s=>{s.stacktrace?.frames?.forEach(n=>{n.filename&&(n.debug_id=r[n.filename])})})}function bV(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 wV(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function SV(e,t,r){if(!e)return null;const s={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(n=>({...n,...n.data&&{data:vn(n.data,t,r)}}))},...e.user&&{user:vn(e.user,t,r)},...e.contexts&&{contexts:vn(e.contexts,t,r)},...e.extra&&{extra:vn(e.extra,t,r)}};return e.contexts?.trace&&s.contexts&&(s.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(s.contexts.trace.data=vn(e.contexts.trace.data,t,r))),e.spans&&(s.spans=e.spans.map(n=>({...n,...n.data&&{data:vn(n.data,t,r)}}))),e.contexts?.flags&&s.contexts&&(s.contexts.flags=vn(e.contexts.flags,3,r)),s}function kV(e,t){if(!t)return e;const r=e?e.clone():new Di;return r.update(t),r}function EV(e){if(e)return TV(e)?{captureContext:e}:IV(e)?{captureContext:e}:e}function TV(e){return e instanceof Di||typeof e=="function"}var AV=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function IV(e){return Object.keys(e).some(t=>AV.includes(t))}function RV(e,t){return ji().captureException(e,EV(t))}function sY(e,t){const r=typeof t=="string"?t:void 0,s=typeof t!="string"?{captureContext:t}:void 0;return ji().captureMessage(e,r,s)}function nY(e,t){return ji().captureEvent(e,t)}function iY(e,t){Hi().setContext(e,t)}function oY(e,t){Hi().setTag(e,t)}function aY(e){Hi().setUser(e)}function cY(){const e=gp();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function lY(e){Hi().addEventProcessor(e)}function uY(e){const t=Hi(),{user:r}=rR(t,ji()),{userAgent:s}=hr.navigator||{},n=v6({user:r,...s&&{userAgent:s},...e}),i=t.getSession();return i?.status==="ok"&&hp(i,{status:"exited"}),iR(),t.setSession(n),n}function iR(){const e=Hi(),t=ji().getSession()||e.getSession();t&&_6(t),oR(),e.setSession()}function oR(){const e=Hi(),t=gp(),r=e.getSession();r&&t&&t.captureSession(r)}function dY(e=!1){if(e){iR();return}oR()}var ws=[],xr=[],CV=Uint8Array,mh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var no=0,PV=mh.length;no<PV;++no)ws[no]=mh[no],xr[mh.charCodeAt(no)]=no;xr[45]=62;xr[95]=63;function xV(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 OV(e,t,r){return(t+r)*3/4-r}function Hu(e){for(var t,r=xV(e),s=r[0],n=r[1],i=new CV(OV(e,s,n)),o=0,a=n>0?s-4:s,c=0;c<a;c+=4)t=xr[e.charCodeAt(c)]<<18|xr[e.charCodeAt(c+1)]<<12|xr[e.charCodeAt(c+2)]<<6|xr[e.charCodeAt(c+3)],i[o++]=t>>16&255,i[o++]=t>>8&255,i[o++]=t&255;return n===2&&(t=xr[e.charCodeAt(c)]<<2|xr[e.charCodeAt(c+1)]>>4,i[o++]=t&255),n===1&&(t=xr[e.charCodeAt(c)]<<10|xr[e.charCodeAt(c+1)]<<4|xr[e.charCodeAt(c+2)]>>2,i[o++]=t>>8&255,i[o++]=t&255),i}function MV(e){return ws[e>>18&63]+ws[e>>12&63]+ws[e>>6&63]+ws[e&63]}function LV(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(MV(s));return n.join("")}function Bu(e){for(var t,r=e.length,s=r%3,n=[],i=16383,o=0,a=r-s;o<a;o+=i)n.push(LV(e,o,o+i>a?a:o+i));return s===1?(t=e[r-1],n.push(ws[t>>2]+ws[t<<4&63]+"==")):s===2&&(t=(e[r-2]<<8)+e[r-1],n.push(ws[t>>10]+ws[t>>4&63]+ws[t<<2&63]+"=")),n.join("")}function pY(e){if(e===void 0)return{};if(!aR(e))throw new Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}function hY(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 aR(e){const t=typeof e=="object",r=Object.getPrototypeOf(e),s=r===null||r===Object.prototype||r?.constructor?.name==="Object";return t&&s}var cR=!0,Yo=BigInt("-9223372036854775808"),Kv=BigInt("9223372036854775807"),hm=BigInt("0"),NV=BigInt("8"),$V=BigInt("256"),gh="This commit timestamp is unresolved: its value is assigned when the mutation commits. Read the document after the mutation completes to get its value.",lR=class{[Symbol.toPrimitive](e){if(e==="string")return this.toString();throw new Error(gh)}valueOf(){throw new Error(gh)}toJSON(){throw new Error(gh)}toString(){return"[unresolved commit timestamp]"}},DV=new lR;function uR(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}function UV(e){e<hm&&(e-=Yo+Yo);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>>=NV;return Bu(r)}function qV(e){const t=Hu(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let r=hm,s=hm;for(const n of t)r+=BigInt(n)*$V**s,s++;return r>Kv&&(r+=Yo+Yo),r}function zV(e){if(e<Yo||Kv<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),Bu(new Uint8Array(t))}function FV(e){const t=Hu(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 jV=DataView.prototype.setBigInt64?zV:UV,HV=DataView.prototype.getBigInt64?FV:qV,c0=1024;function fm(e){if(e.length>c0)throw new Error(`Field name ${e} exceeds maximum field name length ${c0}.`);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 l0(e){if(e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(Array.isArray(e))return e.map(s=>l0(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 Hu(e.$bytes).buffer}if(s==="$integer"){if(typeof e.$integer!="string")throw new Error(`Malformed $integer field on ${e}`);return HV(e.$integer)}if(s==="$float"){if(typeof e.$float!="string")throw new Error(`Malformed $float field on ${e}`);const n=Hu(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,cR);if(!uR(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 DV}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))fm(s),r[s]=l0(n);return r}var BV=16384;function No(e){const t=JSON.stringify(e,(r,s)=>s===void 0?"undefined":typeof s=="bigint"?`${s.toString()}n`:s);if(t.length>BV){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 ${No(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<Yo||Kv<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:jV(e)}}if(typeof e=="number")if(uR(e)){const o=new ArrayBuffer(8);return new DataView(o).setFloat64(0,e,cR),{$float:Bu(new Uint8Array(o))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:Bu(new Uint8Array(e))};if(e instanceof lR)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(vh(r,"Set",[...e],t));if(e instanceof Map)throw new Error(vh(r,"Map",[...e],t));if(!aR(e)){const o=e?.constructor?.name,a=o?`${o} `:"";throw new Error(vh(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?(fm(o),n[o]=Vu(a,t,r+`.${o}`,!1)):s&&(fm(o),n[o]=VV(a,t,r+`.${o}`));return n}function vh(e,t,r,s){return e?`${t}${No(r)} is not a supported Convex type (present at path ${e} in original object ${No(s)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${No(r)} is not a supported Convex type.`}function VV(e,t,r){if(e===void 0)return{$undefined:null};if(t===void 0)throw new Error(`Programming error. Current value is ${No(e)} but original value is undefined`);return Vu(e,t,r,!1)}function fY(e){return Vu(e,e,"",!1)}var GV=Object.defineProperty,KV=(e,t,r)=>t in e?GV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_h=(e,t,r)=>KV(e,typeof t!="symbol"?t+"":t,r),u0,d0,WV=Symbol.for("ConvexError"),JV=class extends(d0=Error,u0=WV,d0){constructor(e){super(typeof e=="string"?e:No(e)),_h(this,"name","ConvexError"),_h(this,"data"),_h(this,u0,!0),this.data=e}};function Wv(e){return Xv(e,"forbidden")}function Jv(e){return Xv(e,"session_revoked")}function Yv(e){return Xv(e,"unauthenticated")}function Xv(e,t){if(!(e instanceof JV))return!1;const r=e.data;return typeof r=="object"&&r!==null&&r.kind===t}var Gu;function mY(e){try{Gu=new URL(e).hostname}catch{Gu=void 0}}function mm(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 fc(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 dR(e){const t=fc(e);if(t)return{convex_function:t.functionName,...t.requestId?{request_id:t.requestId}:{},...Gu?{convex_backend:Gu}:{}}}function YV(e){const t=fc(e.message);if(!t)return e;const r=new Error(t.safeMessage);if(r.name=e.name,e.stack){const s=e.stack.split(`
|
|
136
|
+
`).filter(n=>/^(\s+at |[^@]*@(?:https?|file|webpack|vite):)/.test(n));r.stack=`${r.name}: ${r.message}
|
|
137
|
+
${s.join(`
|
|
138
|
+
`)}`}return r}function pR(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 gY(e=500){const t=pR(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=>fc(u.value??"")),o=fc(i?.value??"");if(!o)return r;if(Wv(s.originalException)||Jv(s.originalException)||Yv(s.originalException))return null;const a=dR(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=mm((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=fc(u.value)?.safeMessage??"Query failure cause"),u.stacktrace)for(const p of u.stacktrace.frames??[])delete p.vars;return r.transaction?.includes("/")&&(r.transaction=mm(`https://route.invalid${r.transaction}`)?.replace("https://route.invalid","")),r}catch{return null}}}var Qv=tS(qx(),1);function p0(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 Bi(){if(typeof window>"u")return null;const e=window.__MCP_RUNTIME_CONFIG__;return!e||typeof e!="object"?null:e}function dl(e){return typeof e=="string"&&e.trim()?e:void 0}function vY(){return dl(Bi()?.convexUrl)}function _Y(){return dl(Bi()?.convexSiteUrl)}function yY(){return dl(Bi()?.workosClientId)}function bY(){return dl(Bi()?.workosApiHostname)}function XV(){return dl(Bi()?.sandboxOrigin)}function Zv(){return Bi()?.doNotTrack===!0}function wY(){return Bi()?.platformAgentDisabled!==!0}var SY=p0(XV())??p0(void 0),kY="write",h0=null,QV=String(101376);function EY(){return h0?`https://discord.com/oauth2/authorize?${new URLSearchParams({client_id:h0,scope:"bot applications.commands",permissions:QV}).toString()}`:null}var Yl="mcpjam.project-transition.v1",TY=18e5;function Xl(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"&&kx(t.path)&&typeof t.requestedProjectId=="string"&&Cx(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 ZV(e=()=>sessionStorage){let t=null;try{const o=JSON.parse(e().getItem(Yl)??"null");Xl(o)?t=o:e().removeItem(Yl)}catch{}const r=sg(()=>({marker:t}));let s=null;const n=o=>{if(!(o&&r.getState().marker?.attempt!==o)){r.setState({marker:null});try{e().removeItem(Yl)}catch{}}},i=(o,a=em())=>{if(!s||s.path!==o)return;const c=r.getState().marker;if(c?.path===o&&Xl(c))return;const l={path:o,requestedProjectId:lS(o),attempt:a,storedAt:Date.now(),sourceActor:s.actor};if(Xl(l)){s=null;try{e().setItem(Yl,JSON.stringify(l))}catch{}r.setState({marker:l})}};return{store:r,clear:n,arm:i,isValid:Xl,remember(o,a){s={path:o,actor:a}},observeActor(o,a){s&&s.actor!==o&&(o.startsWith("workos:")&&i(a),s=null)}}}var e3=ZV();function t3(){return window.location.pathname+window.location.search+window.location.hash}var Xo="mcpjam.guest-transition.v1",f0=`${Xo}.reloaded`,m0=`${Xo}.handled`,yh=15e3,Ku=6e4;function r3(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>Ku||!["started","completed","failed"].includes(t.phase)?null:{guestId:t.guestId,attempt:t.attempt,startedAt:t.startedAt,phase:t.phase}}function s3(e){const t=sg(()=>({status:"idle",attempt:null})),r=new Map;try{const d=JSON.parse(sessionStorage.getItem(m0)??"[]");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]<=Ku&&r.set(h[0],h[1])}catch{}const s=d=>{for(const[h,m]of r)Date.now()-m>Ku&&r.delete(h);r.set(d.attempt,d.startedAt);try{sessionStorage.setItem(m0,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,yh);try{e.reload()}catch{l()}},p=d=>{const h=r3(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,yh-(Date.now()-h.startedAt))))};return{store:t,setGuest(d,h=!0){if(d!==n){n=d;const m=t.getState().status!=="idle";clearTimeout(o),i=null,m&&!h?(t.setState({status:"waiting",attempt:null}),o=setTimeout(l,yh)):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:em(),startedAt:Date.now(),phase:"started"},count:0,failed:!1},a.set(d,h);try{e.publish(h.message)}catch{}}h.count++;let m=!1;return f=>{if(!m&&(m=!0,h.failed||=!f,!--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:em(),startedAt:Date.now(),phase:"completed"}),!0):!1},retry:()=>u(!1),dispose:c}}var ac,qn=s3({beforeTransition:e=>e3.arm(t3(),e.attempt),publish(e){try{ac?.postMessage(e)}catch{}try{localStorage.setItem(Xo,JSON.stringify(e))}catch{}},reload:()=>{const e=qn.getGuest();queueMicrotask(()=>{qn.getGuest()===e&&window.location.reload()})},allowAutomaticReload(){try{const e=Number(sessionStorage.getItem(f0));return e&&Date.now()-e<Ku?!1:(sessionStorage.setItem(f0,String(Date.now())),!0)}catch{return!1}}});function AY(){try{ac=new BroadcastChannel(Xo),ac.onmessage=r=>(0,Qv.flushSync)(()=>qn.receive(r.data))}catch{}const e=n3,t=r=>{r.key===Xo&&e()};return window.addEventListener("storage",t),window.addEventListener("pageshow",e),window.addEventListener("focus",e),document.addEventListener("visibilitychange",e),e(),()=>{ac?.close(),ac=void 0,window.removeEventListener("storage",t),window.removeEventListener("pageshow",e),window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}}function IY(e){const t=qn.getGuest();return e&&e!==t?!0:t?(queueMicrotask(()=>{qn.getGuest()===t&&(0,Qv.flushSync)(()=>qn.revoked(t))}),!0):!1}function n3(){queueMicrotask(()=>{try{(0,Qv.flushSync)(()=>qn.receive(JSON.parse(localStorage.getItem(Xo)??"null")))}catch{}})}var i3=["timeout","network","upstream_status","bad_json","bad_payload","configuration"];var o3=["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 a3(e){return o3.includes(e)}function RY(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"&&a3(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 c3=/^[A-Z][A-Z0-9_]{1,63}$/;function l3(e){return typeof e=="string"&&i3.includes(e)}function u3(e){if(!e||typeof e!="object")return;const{reason:t,upstreamStatus:r,networkCode:s}=e;if(!l3(t))return;const n={reason:t};return typeof r=="number"&&Number.isInteger(r)&&r>=100&&r<=599&&(n.upstreamStatus=r),typeof s=="string"&&c3.test(s)&&(n.networkCode=s),n}var To=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}},hR=class extends To{},$o=class extends To{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 d3(e){return e instanceof hR||e instanceof $o&&e.reason==="guest_access_disabled"}var fR="mcpjam_guest_session_v1",Qo="mcpjam_guest_activated",_p=3e5,Kt=null,En=null,Tn=null,di=null,mR=!1,zn=0,gm=new Set,vm=6e5,Ao=null,ja=null;function gR(){for(const e of gm)e()}function e_(e){ja!==null&&(clearTimeout(ja),ja=null),Ao=e,e&&(ja=setTimeout(()=>{ja=null,Ao===e&&e_(null)},Math.max(0,e.until-Date.now()))),gR()}function vR(){return Ao&&Ao.until<=Date.now()&&(Ao=null),Ao}function yp(e){const t=Kt?.guestId??null,r=Kt?.token??null;Kt=e,(t!==(Kt?.guestId??null)||r!==(e?.token??null))&&gR()}function CY(e){return gm.add(e),()=>{gm.delete(e)}}function PY(e){if(e)try{localStorage.getItem(Qo)!==e&&localStorage.setItem(Qo,e)}catch{}}function xY(e){if(!e)return!1;try{return localStorage.getItem(Qo)===e}catch{return!1}}function OY(e){try{localStorage.getItem(Qo)===e&&localStorage.removeItem(Qo)}catch{}}function MY(){try{return localStorage.getItem(Qo)}catch{return null}}function p3(){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-_p<=Date.now()||(Kt={guestId:e.guestId,token:e.token,expiresAt:e.expiresAt}))}p3();function t_(){if(mR)return null;try{const e=localStorage.getItem(fR);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 g0(){try{localStorage.removeItem(fR)}catch{}mR=!0}var h3=1e3;async function f3(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),h3)})]);return r&&typeof r=="object"?r:void 0}catch{return}finally{t!==void 0&&clearTimeout(t)}}function m3(e){if(!e)return"";const t=e.networkCode??(e.upstreamStatus!==void 0?String(e.upstreamStatus):void 0);return` (${e.reason}${t?` ${t}`:""})`}function g3(e){const t=e?Number.parseInt(e,10):NaN;return Number.isFinite(t)&&t>0?t*1e3:vm}async function r_(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 To(i instanceof Error?i.message:"network error",void 0,void 0,i)}if(s.status===204)return t&&g0(),null;if(s.status===429)throw new $o(g3(s.headers?.get?.("retry-after")),"rate_limited");if(s.status===403&&s.headers?.get?.("x-mcpjam-guest-refusal")==="GUEST_ACCESS_DISABLED")throw new $o(vm,"guest_access_disabled");if(!s.ok){const i=await f3(s);if(s.status===403&&i?.code==="GUEST_ACCESS_DISABLED")throw new $o(vm,"guest_access_disabled");const o=u3(i?.details);throw new(s.status===403&&s.headers?.get?.("x-mcpjam-guest-refusal")==="GUEST_SESSION_REVOKED"?hR:To)(`guest-session request failed: ${s.status} ${s.statusText}${m3(o)}`,s.status,o)}let n;try{n=await s.json()}catch(i){throw new To(`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 To("guest-session response missing token or expiresAt",s.status);return t&&g0(),n}async function v3(){if(Kt&&Kt.expiresAt-_p>Date.now())return Kt;if(vR())return null;if(En)return En;const e=t_(),t=zn;let r=Promise.resolve(null);return r=(async()=>{try{const s=await r_("lookup_or_create",e);return s&&t===zn&&yp(s),s}catch(s){if(s instanceof $o)return e_({until:Date.now()+s.retryAfterMs,reason:s.reason}),null;throw console.error("Failed to create guest session:",s),s}finally{En===r&&(En=null)}})(),En=r,r.catch(()=>{}),En}async function _3(){try{return await v3()}catch{return null}}async function LY(){return(await _3())?.token??null}function _m(){return Kt&&Kt.expiresAt-_p>Date.now()?Kt:null}async function y3(){if(Kt&&Kt.expiresAt-_p>Date.now())return Kt.token;if(Tn)return(await Tn)?.token??null;const e=t_(),t=zn;let r=Promise.resolve(null);return r=(async()=>{try{const s=await r_("lookup_only",e);return s&&t===zn&&yp(s),s}finally{Tn===r&&(Tn=null)}})(),Tn=r,(await Tn)?.token??null}async function NY(){const e=_m();if(e?.guestId)return e.guestId;if(await y3().catch(r=>{if(d3(r))return null;throw r})===null)return null;const t=_m()?.guestId;if(!t)throw new Error("guest session cleared during lookup");return t}function b3(){zn+=1,yp(null),En=null,Tn=null,di=null}async function $Y(){const e=Kt?.guestId,t=e?qn.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{b3(),t?.(r)}return r}async function DY(){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 w3(){if(di)return(await di)?.token??null;if(vR())return null;zn+=1;const e=zn;Kt=null,En=null,Tn=null,di=(async()=>{try{const t=await r_("lookup_or_create",t_());return t&&e===zn&&yp(t),t}catch(t){if(t instanceof $o)return e_({until:Date.now()+t.retryAfterMs,reason:t.reason}),null;throw console.error("Failed to refresh guest session:",t),t}})(),di.catch(()=>{});try{return(await di)?.token??null}finally{di=null}}async function UY(){try{return await w3()}catch{return null}}var D="u">typeof window?window:void 0,Wt="u">typeof globalThis?globalThis:D,Pt=Wt?.navigator,W=Wt?.document,at=Wt?.location,Uc=Wt?.fetch,s_=Wt?.XMLHttpRequest&&"withCredentials"in new Wt.XMLHttpRequest?Wt.XMLHttpRequest:void 0,v0=Wt?.AbortController,S3=Wt?.CompressionStream,Zt=Pt?.userAgent;function _R(){return!(!D||D.navigator.onLine===!1)}var Ha=typeof globalThis<"u"?globalThis:D;Ha&&typeof self>"u"&&(Ha.self=Ha),Ha&&typeof File>"u"&&(Ha.File=function(){});var ve=D??{},_0="0.9.0",Xs={DEBUG:!1,LIB_VERSION:_0,LIB_NAME:"browser-common",JS_SDK_VERSION:_0},_s=(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})({}),ym=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),k3=["$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"],E3=["token"];function be(e,t){return e.indexOf(t)!==-1}var bp=function(e){return e.trim()},bm=function(e){return e.replace(/^\$/,"")};function yR(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 bR=Object.prototype,n_=bR.hasOwnProperty,wp=bR.toString,we=Array.isArray||function(e){return wp.call(e)==="[object Array]"},Rt=e=>typeof e=="function",$e=e=>e===Object(e)&&!we(e),pr=e=>{if($e(e)){for(const t in e)if(n_.call(e,t))return!1;return!0}return!1},j=e=>e===void 0,xe=e=>wp.call(e)=="[object String]",mc=e=>xe(e)&&e.trim().length===0,ct=e=>e===null,Te=e=>j(e)||ct(e),ht=e=>wp.call(e)=="[object Number]"&&e==e,Bs=e=>ht(e)&&e>0,rr=e=>wp.call(e)==="[object Boolean]",T3=e=>be(k3,e),A3=e=>be(E3,e);function wR(e){return e===null||typeof e!="object"}function Wu(e,t){return{}.toString.call(e)===`[object ${t}]`}function wa(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 SR(e,Error)}}function i_(e){return"u">typeof Event&&SR(e,Event)}function SR(e,t){try{return e instanceof t}catch{return!1}}var I3=[!0,"true",1,"1","yes"],bh=e=>be(I3,e),R3=[!1,"false",0,"0","no"];function y0(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 et(e){return function(){var t=this,r=arguments;return new Promise(function(s,n){var i=e.apply(t,r);function o(c){y0(i,s,n,o,a,"next",c)}function a(c){y0(i,s,n,o,a,"throw",c)}o(void 0)})}}var C3=["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"],b0=function(e,t=[]){if(!e)return!1;const r=e.toLowerCase();return C3.concat(t).some(s=>{const n=s.toLowerCase();return r.indexOf(n)!==-1})};function ks(e,t,r,s,n){return t>r&&(s.warn("min cannot be greater than max."),t=r),ht(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),ks(n??r,t,r,s))}var P3=class{constructor(e){this.C={},this.I=e.I,this.R=ks(e.bucketSize,0,100,e.A),this.$=ks(e.refillRate,0,this.R,e.A),this.O=ks(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={}}},Zo="Mobile",qc="Android",Ju="Tablet",kR="Android Tablet",ER="iPad",TR="Apple Watch",wu="Safari",Sp="BlackBerry",AR="Samsung Internet",Su="Chrome",IR="Chrome iOS",RR="Internet Explorer",CR="Internet Explorer Mobile",PR="Opera",xR="Microsoft Edge",ku="Firefox",OR="Firefox iOS",Yu="Nintendo",Xu="PlayStation",kp="Xbox",MR="Android Mobile",LR="Mobile Safari",wh="Windows",NR="Windows Phone",w0="Nokia",wm="Ouya",x3="Generic "+Zo.toLowerCase(),$R="Generic "+Ju.toLowerCase(),Sm="Konqueror",DR="Oculus Browser",UR="Vivaldi",qR="Yandex",zR="Whale",FR="DuckDuckGo",jR="Pale Moon",HR="Waterfox",km="Brave",BR="Claude",VR="Codex",GR="ChatGPT",KR="Google Search App",Sh=new RegExp("Version/(\\d+(\\.\\d+)?)"),kh=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),O3=new RegExp(kp,"i"),M3=new RegExp("PlayStation \\w+","i"),L3=new RegExp("Nintendo \\w+","i"),o_=new RegExp("BlackBerry|PlayBook|BB10","i"),N3={"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"},WR=function(e,t,r,s){return t=t||"",(function(n){return n?.brave?km:null})(r)||(s?.detectGoogleSearchApp&&be(e,"GSA/")?KR:be(e," OPR/")&&be(e,"Mini")?"Opera Mini":be(e," OPR/")?PR:o_.test(e)?Sp:be(e,"IEMobile")||be(e,"WPDesktop")?CR:be(e,"OculusBrowser")?DR:be(e,"SamsungBrowser")?AR:be(e,"Edge")||be(e,"Edg/")?xR:be(e,"Vivaldi/")?UR:be(e,"YaBrowser/")?qR:be(e,"Whale/")?zR:be(e,"DuckDuckGo/")||be(e,"Ddg/")?FR:be(e,"Claude/")?BR:be(e,"Codex/")?VR:be(e,"ChatGPT/")?GR:be(e,"FBIOS")?"Facebook Mobile":be(e,"UCWEB")||be(e,"UCBrowser")?"UC Browser":be(e,"CriOS")?IR:be(e,"CrMo")||be(e,Su)?Su:be(e,qc)&&be(e,wu)?MR:be(e,"FxiOS")?OR:be(e.toLowerCase(),Sm.toLowerCase())?Sm:be(e,"Brave/")?km:((n,i)=>i&&be(i,"Apple")||(function(o){return be(o,wu)&&!be(o,Su)&&!be(o,qc)})(n))(e,t)?be(e,Zo)?LR:wu:be(e,"PaleMoon/")?jR:be(e,"Waterfox/")?HR:be(e,ku)?ku:be(e,"MSIE")||be(e,"Trident/")?RR:be(e,"Gecko")?ku:"")},$3={[CR]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[xR]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Su]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[IR]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[wu]:[Sh],[LR]:[Sh],[PR]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[ku]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[OR]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Sm]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Sp]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Sh],[MR]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[AR]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[DR]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[UR]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[qR]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[zR]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[km]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[BR]:[kh],[VR]:[kh],[GR]:[kh],[FR]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[jR]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[HR]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[KR]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[RR]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},D3=function(e,t,r,s){const n=WR(e,t,r,s),i=$3[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},S0=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[kp,e&&e[1]||""]],[new RegExp(Yu,"i"),[Yu,""]],[new RegExp(Xu,"i"),[Xu,""]],[o_,[Sp,""]],[new RegExp(wh,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[NR,""];if(new RegExp(Zo).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){let s=N3[r[1]]||"";return/arm/i.test(t)&&(s="RT"),[wh,s]}return[wh,""]}],[/((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]?[qc,[e[2],e[3],e[4]||"0"].join(".")]:[qc,""]],[/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",""]]],JR=function(e){for(let t=0;S0.length>t;t++){const[r,s]=S0[t],n=r.exec(e),i=n&&(Rt(s)?s(n,e):s);if(i)return i}return["",""]},YR=function(e){return L3.test(e)?Yu:M3.test(e)?Xu:O3.test(e)?kp:new RegExp(wm,"i").test(e)?wm:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?NR:/iPad/.test(e)?ER:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?TR:o_.test(e)?Sp:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(w0,"i").test(e)?w0:/(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(Zo).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)?qc:kR:new RegExp("(pda|Mobile)","i").test(e)?x3:new RegExp(Ju,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?$R:""},U3=function(e,t){var r;const s=YR(e);return s===ER||s===kR||s==="Kobo"||s==="Kindle Fire"||s===$R?Ju:s===Yu||s===kp||s===Xu||s===wm?"Console":s===TR?"Wearable":s?Zo: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)?Zo:Ju:"Desktop";var n,i,o},Eh=/\bFBAV\/(\d+(?:\.\d+)*)/i,k0=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Eh],[/\bFBAN\/EMA\b/i,"Facebook Lite",Eh],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Eh],[/\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"]],Em="[Truncated]",pl="[Unserializable]";function Do(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 XR(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=pl}Object.defineProperty(e,s,{value:n,enumerable:!0,writable:!0,configurable:!0})}return e}var Eu=3e5,QR=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,Eu);if(!t)return this.ts=r,void(this.es=r+s);this.es=Math.max(this.es,Math.min(r+s,this.ts+Eu))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const t=Math.min(Eu,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}},q3=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function E0(e,t){return typeof(r=e)=="string"&&q3.test(r)?e:t();var r}function ZR(e,t){const r=new Error(t);try{Object.defineProperty(r,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return r}function Wn(e){return e&&e.split("#")[0]}function T0(e){try{return e()}catch{return}}function eC(e,t){const r=setTimeout(e,t);return r!=null&&r.unref&&r?.unref(),r}function A0(e,t,r){return tC.apply(this,arguments)}function tC(){return(tC=et(function*(e,t,r){let s;try{return yield Promise.race([e,new Promise((n,i)=>{s=eC(()=>{try{r?.(),n()}catch(o){i(o)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}var Ql,I0,Th;function z3(e){const t=globalThis._posthogChunkIds;if(!t)return;const r=Object.keys(t);return Th&&r.length===I0||(I0=r.length,Th=r.reduce((s,n)=>{Ql||(Ql={});const i=Ql[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,Ql[n]=[l,u];break}}}return s},{})),Th}function gc(e){return gc=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},gc(e)}function F3(e,t,r){return(t=(function(s){var n=(function(i){if(gc(i)!="object"||!i)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var a=o.call(i,"string");if(gc(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)})(s);return gc(n)=="symbol"?n:n+""})(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R0(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?R0(Object(r),!0).forEach(function(s){F3(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R0(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}var j3=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 et(function*(){for(const r of e)r.stacktrace&&r.stacktrace.frames&&we(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 et(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:z3(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}getAggregateErrors(e){try{if(wa(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 we(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,m=0)=>{const f=u(h,m),g=f.apply;if(f.apply=M=>{a.push(d);try{return g(M)}finally{a.pop()}},m>4||m>0&&a.indexOf(d)!==-1)return this.coerceFallback(f);const _=typeof d=="object"&&d!==null||typeof d=="function";if(m===0&&s>=50||_&&o.has(d))return;_&&o.add(d),m===0&&s++;const y=this.getAggregateErrors(d);let E,P;i||(i=!!y);try{if(E=this.applyCoercers(d,f),!E)throw c}catch(M){if(M===c)return void(m===0&&s--);if(!i)throw M;E=this.coerceFallback(f)}if(!y||s>=50)return E;try{P=y.length}catch{return E}if(!Number.isInteger(P)||0>P||P>4294967295)return E;const I=[];for(let M=0;50>s&&1e3>n&&P>M;M++){let $;n++;try{$=f.next(y[M])}catch{s++,$=this.coerceFallback(u(h+1))}$&&I.push($)}return S(S({},E),{},{errors:I})},u=(d,h=0)=>S(S({},t),{},{syntheticException:d==0?t.syntheticException:void 0,mechanism:d==0?e:{},apply(m){const f=l(m,d,h+1);if(!f)throw c;return f},next:m=>l(m,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)}})}},H3=/^([a-z][a-z0-9.+-]+):/i,B3=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function V3(e){if(!e||e==="<anonymous>")return!1;const t=H3.exec(e);return!t||B3.includes(t[1].toLowerCase())}function Tm(e,t,r,s,n){const i={platform:e,filename:t,function:r==="<anonymous>"?"?":r,in_app:V3(t)};return j(s)||(i.lineno=s),j(n)||(i.colno=n),i}var rC=(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]},G3=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,K3=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,W3=/\((\S*)(?::(\d+))(?::(\d+))\)/,J3=(e,t)=>{const r=G3.exec(e);if(r){const[,n,i,o]=r;return Tm(t,n,"?",+i,+o)}const s=K3.exec(e);if(s){if(s[2]&&s[2].indexOf("eval")===0){const o=W3.exec(s[2]);o&&(s[2]=o[1],s[3]=o[2],s[4]=o[3])}const[n,i]=rC(s[1]||"?",s[2]);return Tm(t,i,n,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},Y3=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,X3=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Q3=(e,t)=>{const r=Y3.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){const i=X3.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]=rC(n,s),Tm(t,s,n,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},C0=/\(error: (.*)\)/;function a_(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function Z3(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(!a_(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 e4(e,t){const r=t.start+t.length,s=nC(e,t);s&&e.splice(r+s===e.length?r:t.start,s)}function sC(e,t){let r=t.start;for(;r>0&&a_(e[r-1],e[r-1+t.length]);)r--;return t.start-r}function nC(e,t){const r=t.start+t.length;let s=r;for(;e.length>s&&a_(e[s],e[s-t.length]);)s++;return s-r}function t4(e,t){const r=t[0];let s=e.length-(r?sC(e,r):0);for(const n of t)s-=nC(e,n);return s}function r4(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 s4=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const r=xe(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 Wu(e,"DOMException")}isDOMError(e){return Wu(e,"DOMError")}},n4=class{match(e){return wa(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}}},i4=class{match(e){return!!Wu(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 xe(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(xe(s.filename)&&s.filename.length!==0&&n!==0)return`Error
|
|
139
|
+
at ${s.filename}:${n}:${i}`}},o4=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,a4=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(o4);return s&&(t=s[1],r=s[2]),[t,r]}},c4=["fatal","error","warning","log","info","debug"];function iC(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 l4=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(i_(e))return e.constructor.name;const t="name"in e?e.name:void 0;return xe(t)&&!mc(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: ${iC(e)}`}isSeverityLevel(e){return xe(e)&&!mc(e)&&c4.indexOf(e)>=0}getStack(e){try{return xe(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:xe(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(wa(r))return r}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},u4=class{match(e){return i_(e)}coerce(e,t){var r;const s=e.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${iC(e)}`,stack:(r=t.syntheticException)===null||r===void 0?void 0:r.stack,synthetic:!0}}},d4=class{match(e){return wR(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}}},p4=class{match(e){return Wu(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!i_(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 wR(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}},Qu="$message",Zu="$timestamp",h4=new Set([Qu,Zu]),Ah={enabled:!0,max_bytes:32768};function ed(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Ah.enabled,max_bytes:m4(e.max_bytes,Ah.max_bytes)}:S({},Ah)}var f4=class{constructor(e){this.ns=[],this.ss=0,this.Ir=ed(e)}setConfig(e){this.Ir=ed(e),this.rs()}add(e){const t=(function(s){let n;try{n=yR(s)}catch{return}try{const i=JSON.parse(n);if(!$e(i))return;const o=i,a=o[Qu],c=o[Zu];return!xe(a)||a.trim().length===0||!xe(c)&&!ht(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 m4(e,t){if(!ht(e)||e===1/0||e===-1/0)return t;const r=Math.floor(e);return 0>r?t:r}var P0=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function x0(e){return typeof e=="string"||e}function O0(e){return typeof e=="string"?e:void 0}var g4=["$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"],oC="NativeGzipValidationError",Am=e=>e.length>=2&&e[0]===31&&e[1]===139,M0=(e,t)=>e===ym.GZipJS||t===ym.GZipJS||t==="gzip",L0=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",Ba,Zl=e=>{throw ZR(oC,`Native gzip produced invalid output: ${e}`)},v4=(N0=et(function*(e,t){18>e.size&&Zl("too-short");const r=new Uint8Array(yield e.slice(0,10).arrayBuffer());Am(r)&&r[2]===8||Zl("invalid-header");const s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(i=>{const o=(()=>{if(Ba)return Ba;Ba=[];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;Ba[c]=l>>>0}return Ba})();let a=4294967295;for(let c=0;i.length>c;c++)a=o[255&(a^i[c])]^a>>>8;return(4294967295^a)>>>0})(t)&&Zl("invalid-crc");const n=t.length>>>0;s.getUint32(4,!0)!==n&&Zl("invalid-size")}),function(e,t){return N0.apply(this,arguments)}),N0;function Im(){return Im=et(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=et(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 v4(l,n),l}catch(n){if(r?.rethrow)throw n;return t&&console.error("Failed to gzip compress data",n),null}var s}),Im.apply(this,arguments)}function aC(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 _4={}.propertyIsEnumerable;function td(e,t){try{return cC(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function c_(e,t,r,s){if(0>=r.remainingNodes)return{stringValue:Em};if(r.remainingNodes--,rr(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:Do(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:Em};if(e instanceof Date){const n=e.getTime(),i=Number.isFinite(n)?e.toISOString():String(e);return{stringValue:typeof i=="string"?Do(i):String(i)}}r.ancestors.add(e);try{try{const n=e.toJSON;if(typeof n=="function")return c_(n.call(e),t,r,s+1)}catch{}return we(e)?{arrayValue:{values:y4(e,t,r,s+1)}}:{kvlistValue:{values:cC(e,t,r,s+1)}}}finally{r.ancestors.delete(e)}}return{stringValue:Do(String(e))}}function y4(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(c_(a,t,r,s))}catch{n.push({stringValue:pl})}return e.length>o&&n.push({stringValue:Em}),n}function cC(e,t,r,s){const n=[];for(const i in e)if(_4.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(ct(o)||j(o))continue;n.push({key:Do(i),value:c_(o,t,r,s)})}catch{n.push({key:Do(i),value:{stringValue:pl}})}}return n}function lC(e,t,r){return S(S(S(S({},XR({},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 b4=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function uC(e,t){const r=XR({},e),s={};for(const n of b4)({}).hasOwnProperty.call(r,n)&&(s[n]=r[n],delete r[n]);return[...td(r,t),...td(s,t)]}var $0={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"},dC={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}},w4=dC.info;function S4(e){try{return Do(String(e))}catch{return pl}}function k4(e,t,r,s){const n=e.level||"info",{text:i,number:o}=dC[n]||w4,a=(function(d=Date.now()){return String(d)+"000000"})(ht(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 m;try{m=u[h]}catch{m=pl}Object.defineProperty(l,h,{value:m,enumerable:!0,writable:!0,configurable:!0})}}const p={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:i,body:{stringValue:S4(e.body)},attributes:td(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 pC(e,t,r){return lC(e,t,r)}function hC(e,t,r,s){return{resourceLogs:[{resource:{attributes:uC(t)},scopeLogs:[{scope:{name:r,version:s},logRecords:e}]}]}}var fC=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=eC(()=>{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 mC(){return .75+.5*Math.random()}function gC(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 E4=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 fC(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new QR,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(_s.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:k4(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=we(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 et(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return et(function*(){var t;e.ps.clear();let r=(t=e._instance.getPersistedProperty(_s.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=hC(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(_s.LogsQueue))!==null&&o!==void 0?o:[],n+=l.length,p.kind==="fatal"))throw p.error}})()}Bs(e){var t=this;return et(function*(){var r;const s=Math.max(0,e-t.bs),n=(r=t._instance.getPersistedProperty(_s.LogsQueue))!==null&&r!==void 0?r:[];t._instance.setPersistedProperty(_s.LogsQueue,n.slice(s)),yield t.vs()})()}qs(){return pC(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;const r=(t=this._instance.getPersistedProperty(_s.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(_s.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(gC(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(_s.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return et(function*(){t.ps.clear();const r=t.flush().catch(()=>{});e!==void 0?yield A0(r,e):yield r})()}flushWithTimeout(e){var t=this;return et(function*(){const r=t.flush();yield A0(r,e,()=>{r.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=mC(),this.A.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}},Ih=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function D0(e){return String(e)+"000000"}function U0(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 T4=class{constructor(e,t,r){this._instance=e,this.Ir=t,this.A=r,this.zs=new Map,this.ps=new fC(()=>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 QR,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=et(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=U0(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(Ih.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,Ih)]+=1;break}}}Os(e){const t=this.Ir.beforeSend;if(!t)return e;const r=we(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(gC(this.Ir.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return et(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=mC()):(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 lC(i,o,a)})(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:uC(r)},scopeMetrics:[{scope:{name:s,version:n},metrics:t}]}]};var t,r,s,n}co(e){const t=D0(Date.now()),r=new Map;for(const o of e.values()){var s;const a=U0(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=td((s=o.attributes)!==null&&s!==void 0?s:{},this.A),u=D0(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:Ih})}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)}}},vC=(e,{debugEnabled:t}={})=>{const r={N(s,...n){D&&(Xs.DEBUG||D.POSTHOG_DEBUG||t)&&!j(D.console)&&D.console&&("__rrweb_original__"in D.console[s]?D.console[s].__rrweb_original__:D.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)=>vC(`${e} ${s}`,n)};return r},Q=vC("[PostHog.js]"),ut=Q.createLogger,A4=ut("[ExternalScriptsLoader]"),rd=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]}},pi=(e,t,r)=>{if(e.config.disable_external_dependency_loading)return A4.warn(`${t} was requested but loading of external scripts is disabled.`),r("Loading of external scripts is disabled");const s=rd(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(rd(t))return pi(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)},Rh={},q0=(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)};ve.__PosthogExtensions__=ve.__PosthogExtensions__||{},ve.__PosthogExtensions__.loadExternalDependency=(e,t,r)=>{if(t==="remote-config"){const n=e.requestRouter.endpointFor("assets",`/array/${e.config.token}/config.js`);pi(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=Rh[n];if(s==="fallback"&&i){if(rd(i))return void pi(e,i,r);delete Rh[n]}pi(e,n,s==="fallback"?(o,a)=>{if(o)if(typeof o=="string")r(o);else{var c;const l=q0(e,t);Rh[n]=l;const u=rd(n);u==null||(c=u.parentNode)===null||c===void 0||c.removeChild(u),pi(e,l,r)}else r(void 0,a)}:r);return}pi(e,q0(e,t),r)},ve.__PosthogExtensions__.loadSiteApp=(e,t,r)=>{const s=e.requestRouter.endpointFor("api",t);pi(e,s,r)},Xs.DEBUG=!1,Xs.LIB_VERSION="1.435.3",Xs.LIB_NAME="web";var St=Xs,I4="$people_distinct_id",Jr="distinct_id",l_="$device_id",Ch="$device_model",sd="__alias",R4="__cmpns",z0="$fbc",Uo="$fbc_persistence",F0="$fbp",vc="$fbp_persistence",Rm="__timers",_C="$autocapture_disabled_server_side",Cm="$heatmaps_enabled_server_side",Pm="$exception_capture_enabled_server_side",yC="$error_tracking_suppression_rules",xm="$error_tracking_capture_extension_exceptions",Om="$web_vitals_enabled_server_side",u_="$dead_clicks_enabled_server_side",d_="$product_tours_enabled_server_side",bC="$logs_capture_enabled_server_side",wC="$web_vitals_allowed_metrics",_c="$session_recording_remote_config",C4="$session_recording_enabled_server_side",P4="$replay_sample_rate",x4="$replay_override_sampling",O4="$replay_override_linked_flag",M4="$replay_override_url_trigger",L4="$replay_override_event_trigger",Io="$sesid",SC="$session_is_sampled",N4="$session_past_minimum_duration",$4="$session_recording_url_trigger_activated_session",D4="$session_recording_event_trigger_activated_session",U4="$debug_first_full_snapshot_timestamp",q4="$sess_rec_flush_size",es="$enabled_feature_flags",Ws="$active_feature_flags",Mm="$early_access_features",Ci="$feature_flag_details",Cn="$feature_flag_payloads",Pi="$feature_flag_request_id",yc="$minimal_flag_called_events",gs="$override_feature_flags",hi="$override_feature_flag_payloads",Pn="$stored_person_properties",xn="$stored_group_properties",kC="$groups",cc="$surveys",nd="$surveys_loaded_at",EC="$surveys_activated",TC="$surveys_activated_session",AC="$surveys_activated_timestamps",Lm="ph_product_tours",z4="$product_tours_activated",F4="$product_tours_activated_session",j4="$conversations_widget_session_id",H4="$conversations_ticket_id",B4="$conversations_widget_state",V4="$conversations_user_traits",On="$flag_call_reported",lc="$flag_call_reported_session_id",zc="$feature_flag_errors",Fn="$feature_flag_evaluated_at",tr="$user_state",Nm="$client_session_props",G4="$capture_rate_limit",IC="$initial_campaign_params",RC="$initial_referrer_info",Ro="$initial_person_info",p_="$epp",Ph="$posthog_cookieless",CC="$cookieless_mode",PC="$sdk_debug_extensions_init_method",xC="$sdk_debug_extensions_init_time_ms",h_="$sdk_debug_recording_script_not_loaded",f_="$sdk_debug_replay_stale_config",OC="$sdk_debug_replay_event_trigger_status",MC="$sdk_debug_replay_linked_flag_trigger_status",LC="$sdk_debug_replay_matched_recording_trigger_groups",NC="$sdk_debug_replay_pending_trigger_conditions",$C="$sdk_debug_replay_remote_trigger_matching_config",DC="$sdk_debug_replay_trigger_groups_count",UC="$sdk_debug_replay_url_trigger_status",K4="$session_recording_start_reason",m_="PostHog loadExternalDependency extension not found.",Js="anonymous",Tu="identified",qC="identified_only",Fc="visibilitychange",id="beforeunload",g_="$pageview",j0="$pageleave",zC="$identify",H0="$groupidentify";function Co(e,t){we(e)&&e.forEach(t)}function Ve(e,t){if(!Te(e))if(we(e))e.forEach(t);else if((r=>r instanceof FormData)(e))e.forEach((r,s)=>t(r,s));else for(const r in e)n_.call(e,r)&&t(e[r],r)}var Ze=function(e,...t){for(const r of t)for(const s in r)r[s]!==void 0&&(e[s]=r[s]);return e};function Au(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 W4=function(e){return function(...t){try{return e.apply(this,t)}catch(r){Q.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Q.critical(r)}}},v_=function(e){const t={};return Ve(e,function(r,s){(xe(r)&&r.length>0||ht(r))&&(t[s]=r)}),t};function FC(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 J4=["herokuapp.com","vercel.app","netlify.app"];function Y4(e){const t=e?.hostname;if(!xe(t))return!1;const r=t.split(".").slice(-2).join(".");for(const s of J4)if(r===s)return!1;return!0}function Fe(e,t,r,s){const{capture:n=!1,passive:i=!0}=s??{};e?.addEventListener(t,r,{capture:n,passive:i})}function $m(e){return e.name==="ph_toolbar_internal"}var bc=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 ht(e)&&isFinite(e)&&Math.floor(e)===e});var X4=class Dm{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 Dm(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 Dm(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}},Q4=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 ht(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 X4.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 Z4}},jC=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};D&&!j(D.crypto)&&crypto.getRandomValues&&(jC=e=>crypto.getRandomValues(e));var Z4=class{nextUint32(){return this.Rt.length>this.At||(jC(this.Rt),this.At=0),this.Rt[this.At++]}constructor(){this.Rt=new Uint32Array(8),this.At=1/0}},B0,ts=()=>eG().toString(),eG=()=>(B0||(B0=new Q4)).generate(),Va="",tG=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,io=null,ot={Et(){if(!ct(io))return io;if(io=!1,W)try{const e=`__ph_cookie_support_${ts()}`;ot.$t(e,"xyz"),io=bc(e)==='"xyz"',ot.Lt(e)}catch{io=!1}return io},Pt(e){Q.error("cookieStore error: "+e)},Ot:bc,Dt(e){let t;try{t=JSON.parse(ot.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(Va)return Va;if(!h||["localhost","127.0.0.1"].includes(d))return"";const m=d.split(".");let f=Math.min(m.length,8);const g="dmn_chk_"+ts();for(;!Va&&f--;){const _=m.slice(f).join("."),y=g+"=1;domain=."+_+";path=/";h.cookie=y+";max-age=3",h.cookie.includes(g)&&(h.cookie=y+";max-age=0",Va=_)}return Va})(l);if(!p){const d=(h=>{const m=h.match(tG);return m?m[0]:""})(l);d!==p&&Q.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&&Q.warn("cookieStore warning: large cookie, len="+c.length),W.cookie=c,!0}catch{return!1}},Lt(e,t){if(W?.cookie&&(!t||!ct(bc(e))))try{ot.$t(e,"",-1,t)}catch{return}}},xh=null,qe={Et(){if(!ct(xh))return xh;let e=!0;if(j(D))e=!1;else try{const t="__mplssupport__";qe.$t(t,"xyz"),qe.Ot(t)!=='"xyz"'&&(e=!1),qe.Lt(t)}catch{e=!1}return e||Q.error("localStorage unsupported; falling back to cookie store"),xh=e,e},Pt(e){Q.error("localStorage error: "+e)},Ot(e){try{return D?.localStorage.getItem(e)}catch(t){qe.Pt(t)}return null},Dt(e){try{return JSON.parse(qe.Ot(e))||{}}catch{}return null},$t(e,t){try{return D?.localStorage.setItem(e,JSON.stringify(t)),!0}catch(r){qe.Pt(r)}return!1},Lt(e){try{D?.localStorage.removeItem(e)}catch(t){qe.Pt(t)}}},Oh=[Pn,Ws,es,Ci,Cn,Pi,Fn,zc,On],fi=[l_,Jr,Io,SC,p_,Ro,Uo,tr],od=e=>e+"_cpm",rG=["__proto__","constructor","prototype"],Mh=e=>{if(!$e(e))return{};const t={};return Object.keys(e).forEach(r=>{rG.indexOf(r)===-1&&(t[r]=e[r])}),t},Lh=(e,t=[])=>{const r={};return[...fi,...t].forEach(s=>{const n=e[s];j(n)||ct(n)||n===""||(r[s]=n)}),r},HC=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)},V0=(e,t)=>({p:t,f:HC(JSON.stringify(e))}),G0=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const r=ot.Dt(od(e)),s=r?.f===HC(t)&&we(r.p);return{properties:s?r.p:[],isValid:s}}catch{return{properties:[],isValid:!1}}},Nh=(e,t)=>t+"|"+(ot.Ot(od(e))||""),oo={},Um={Et:()=>!0,Pt(e){Q.error("memoryStorage error: "+e)},Ot:e=>e in oo?oo[e]:null,Dt:e=>e in oo?oo[e]:null,$t:(e,t)=>(oo[e]=t,!0),Lt(e){delete oo[e]}},ni=null,Ye={Et(){if(!ct(ni))return ni;if(ni=!0,j(D))ni=!1;else try{const e="__support__";Ye.$t(e,"xyz"),Ye.Ot(e)!=='"xyz"'&&(ni=!1),Ye.Lt(e)}catch{ni=!1}return ni},Pt(e){Q.error("sessionStorage error: ",e)},Ot(e){try{return D?.sessionStorage.getItem(e)}catch(t){Ye.Pt(t)}return null},Dt(e){try{return JSON.parse(Ye.Ot(e))||null}catch{}return null},$t(e,t){try{return D?.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(r){Ye.Pt(r)}return!1},Lt(e){try{D?.sessionStorage.removeItem(e)}catch(t){Ye.Pt(t)}}},sG=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 bh(e)?1:be(R3,e)?0:-1}get No(){const e=this.Ir.opt_out_capturing_persistence_type,t=e==="localStorage"?qe:ot,r=t.Et()?t:Um;if(!this.jo||this.jo!==r){this.jo=r;const s=e==="localStorage"?ot:qe;s.Ot(this.qo)&&(this.jo.Ot(this.qo)||this.optInOut(bh(s.Ot(this.qo))),s.Lt(this.qo,this.Ir.cross_subdomain_cookie))}return this.jo}Do(){return!!this.Ir.respect_dnt&&[Pt?.doNotTrack,Pt?.msDoNotTrack,ve.doNotTrack,Pt?.globalPrivacyControl].some(e=>bh(e))}};function BC(e,t){var r;const s=e==null||(r=e.config)===null||r===void 0?void 0:r.get_current_url;if(!Rt(s))return t;try{const n=s(t);return xe(n)&&n?n:t}catch(n){return Q.error("Error in get_current_url, falling back to window.location.href",n),t}}function K0(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 Os(e){return!!e&&e.nodeType===1}function jt(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function VC(e){return!!e&&e.nodeType===3}function __(e){return!!e&&e.nodeType===11&&Os(e.host)}function y_(e){return e?bp(e).split(/\s+/):[]}function W0(e,t){const r=(function(s){var n;const i=D==null||(n=D.location)===null||n===void 0?void 0:n.href;return j(i)?void 0:BC(s,i)})(t);return!!(r&&e&&e.some(s=>r.match(s)))}function ea(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 y_(t)}function GC(e){return Te(e)?null:bp(e).split(/(\s+)/).filter(t=>Sc(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function jc(e){let t="";return qo(e)&&!Hc(e)&&e.childNodes&&e.childNodes.length&&Ve(e.childNodes,function(r){var s;VC(r)&&r.textContent&&(t+=(s=GC(r.textContent))!==null&&s!==void 0?s:"")}),bp(t)}function wc(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 b_=["a","button","form","input","select","textarea","label"];function qm(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 zm(e,t){if(j(t))return!0;for(const r of e)if(t.some(s=>qm(r,s)))return!0;return!1}function KC(e){const t=e.parentNode;return!(!t||!Os(t))&&t}var $h=[".ph-no-autocapture","[data-ph-no-autocapture]"],WC=["next","previous","prev",">","<"],nG=[...WC,"+","-","−","–"],J0=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Y0=[".ph-no-rageclick",".ph-no-capture"],iG=["","text","search","email","password","url","tel","number"];function JC(e,t){if(!D||w_(e))return!1;let r,s,n;var i,o;if(rr(t)?(r=!!t&&Y0,s=void 0,n=!1):(r=(i=t?.css_selector_ignorelist)!==null&&i!==void 0?i:Y0,s=t?.content_ignorelist,n=(o=t?.ignore_text_selection)!==null&&o!==void 0&&o),r===!1||n&&(function(c){return!(!c||!Os(c))&&(!!jt(c,"textarea")||(jt(c,"input")?be(iG,(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}=YC(e,!1);return!(function(c,l){if(c===!1||j(c))return!1;let u;if(c===!0)u=WC;else{if(!we(c))return!1;if(c.length>10)return Q.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=>J0(p,h)||J0(d,h)))})(s,a.map(c=>{var l;return{safeText:jc(c).toLowerCase(),ariaLabel:((l=c.getAttribute("aria-label"))===null||l===void 0?void 0:l.toLowerCase().trim())||""}}))&&!zm(a,r)}var w_=e=>!e||jt(e,"html")||!Os(e),YC=(e,t)=>{if(!D||w_(e))return{parentIsUsefulElement:!1,targetElementList:[]};let r=!1;const s=[e];let n=e;for(;n.parentNode&&!jt(n,"body");){if(__(n.parentNode)){s.push(n.parentNode.host),n=n.parentNode.host;continue}const i=KC(n);if(!i)break;if(t||b_.indexOf(i.tagName.toLowerCase())>-1)r=!0;else try{const o=D.getComputedStyle(i);o&&o.getPropertyValue("cursor")==="pointer"&&(r=!0)}catch{}s.push(i),n=i}return{parentIsUsefulElement:r,targetElementList:s}};function qo(e){const t=new Set;let r=0;for(let i=e;i.parentNode&&!jt(i,"body");i=i.parentNode){if(r++>=1e3||t.has(i))return!1;t.add(i);const o=ea(i);if(be(o,"ph-sensitive")||be(o,"ph-no-capture"))return!1}if(be(ea(e),"ph-include"))return!0;const s=e.type||"";if(xe(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}const n=e.name||e.id||"";return!xe(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 Hc(e){return!!(jt(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||jt(e,"select")||jt(e,"textarea")||e.getAttribute("contenteditable")==="true")}var X0=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}))$"),Q0=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,oG=[16,15,14,13],aG=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Z0=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),ew=/[0-9A-Za-z_]/;function cG(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 Sc(e,t=!0){return!(Te(e)||xe(e)&&(e=bp(e),(t?X0.test((e||"").replace(/[- ]/g,"")):(function(r){let s;for(Q0.lastIndex=0;s=Q0.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 oG){const c=o+a;if(i.length>=c){const l=i.slice(o,c);if(X0.test(l)&&cG(l))return!0}}}return!1})(e))||(t?aG.test(e):(function(r){let s;for(Z0.lastIndex=0;s=Z0.exec(r);){const n=s[1],i=s[3];if(!(n&&i&&ew.test(n)&&ew.test(i)))return!0}return!1})(e))))}function tw(e){let t=jc(e);return t=`${t} ${XC(e)}`.trim(),Sc(t)?t:""}function XC(e){let t="";return e&&e.childNodes&&e.childNodes.length&&Ve(e.childNodes,function(r){var s;if(r&&((s=r.tagName)===null||s===void 0?void 0:s.toLowerCase())==="span")try{const n=jc(r);t=`${t} ${n}`.trim(),r.childNodes&&r.childNodes.length&&(t=`${t} ${XC(r)}`.trim())}catch(n){Q.error("[AutoCapture]",n)}}),t}function rw(e){return e.replace(/"|\\"/g,'\\"')}function lG(e){const t=e.attr__class;if(t)return we(t)?t:y_(t)}var eu=ut("[Dead Clicks]"),uG=()=>!0,dG=e=>{var t;const r=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(u_)),s=e.instance.config.capture_dead_clicks;return rr(s)?s:!!$e(s)||r},sw=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({[u_]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Ho(()=>{this.zo()}):this.stop()}Ho(e){var t,r,s;!((t=ve.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture?e():(r=ve.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this.instance,"dead-clicks-autocapture",n=>{n?eu.error("failed to load script",n):e()})}zo(){var e;if(W){if(!this.Bo&&(!((e=ve.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const t=$e(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=ve.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Bo.start(W),eu.info("starting...")}}else eu.error("`document` not found. Cannot start.")}stop(){this.Bo&&(this.Bo.stop(),this.Bo=void 0,eu.info("stopping..."))}},Ga=ut("[SegmentIntegration]");function nw(e,t,r=!0){const s=e.config.segment;if(!s)return t();const{analytics:n,filterProperties:i}=(a=>Rt(a.register))(o=s)?{analytics:o}:o;var o;(function(a,c,l,u){const p=h=>{const m=()=>h.anonymousId()||ts();a.config.get_device_id=m,u&&h.id()&&(a.register({distinct_id:h.id(),$device_id:m()}),a.persistence.set_property(tr,Tu)),l(u?void 0:h.anonymousId()||void 0)},d=c.user();"then"in d&&Rt(d.then)?d.then(p):p(d)})(e,n,a=>{n.register(((c,l,{filterProperties:u}={})=>{typeof Promise<"u"&&Promise.resolve||Ga.warn("This browser does not have Promise support, and can not use the segment integration");const p=(d,h)=>{if(!h)return d;const m=!!l&&d.event.anonymousId===l&&!d.event.userId;m||d.event.userId||d.event.anonymousId===c.get_distinct_id()||(Ga.info("No userId set, resetting PostHog"),c.reset()),m||(l=void 0),d.event.userId&&d.event.userId!==c.get_distinct_id()&&(Ga.info("UserId set, identifying with PostHog"),c.identify(d.event.userId));let f=c.calculateEventProperties(h,d.event.properties);if(!Te(u)){const g=d.event.properties||{},_={};for(const E of Object.keys(f))n_.call(g,E)||(_[E]=f[E]);const y=((E,P)=>{const I=we(E)?E:[E];let M=S({},P);for(const $ of I)try{if(M=$(M),Te(M))return null}catch(O){return Ga.error("Error in Segment filterProperties:",O),null}return M})(u,_);if(Te(y))return d;f=y}return d.event.properties=Object.assign({},f,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,g_)},identify(d){return p(d,zC)},screen(d){return p(d,"$screen")}}})(e,a,{filterProperties:i})).then(()=>{t()},c=>{Ga.error("Failed to register the Segment integration",c),t()})},r)}var QC="posthog-js";function ZC(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)||[],m=h.map(_=>S(S({},_),{},{stacktrace:_.stacktrace?S(S({},_.stacktrace),{},{type:"raw",frames:(_.stacktrace.frames||[]).map(y=>S(S({},y),{},{platform:"web:javascript"}))}):void 0})),f={$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:m,$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 g;return t&&r&&(f.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+o.event_id),i&&((g=e.exceptions)===null||g===void 0||g.sendExceptionEvent(f)),o}}var pG=class{constructor(e,t,r,s,n,i){this.name=QC,this.setupOnce=function(o){o(ZC(e,{organization:t,projectId:r,prefix:s,severityAllowList:n,sendExceptionsToPostHog:i==null||i}))}}},iw=class{constructor(e){this.Uo=(t,r,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength||s.crossTabAdoption)&&(Q.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=D?.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?ks(o/i,0,1,Q):1,d=i>1?ks(a/i,0,1,Q):1,h=c>1?ks(l/c,0,1,Q):1,m=c>1?ks(u/c,0,1,Q):1;s=Ze(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:m})}}return r.pathname&&(s.$prev_pageview_pathname=r.pathname),r.timestamp&&(s.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),s}},Ka=["flags","surveys"],hG={[I4]:{exposure:"hidden"},[sd]:{exposure:"hidden"},[R4]:{exposure:"hidden"},[Rm]:{exposure:"hidden"},[Uo]:{exposure:"hidden"},[vc]:{exposure:"hidden"},[_C]:{exposure:"event"},[Cm]:{exposure:"hidden"},[bC]:{exposure:"hidden"},[Pm]:{exposure:"event"},[yC]:{exposure:"hidden"},[xm]:{exposure:"event"},[Om]:{exposure:"event"},[u_]:{exposure:"event"},[d_]:{exposure:"hidden"},[wC]:{exposure:"event"},[_c]:{exposure:"hidden"},[C4]:{exposure:"hidden"},[Io]:{exposure:"hidden"},[SC]:{exposure:"event"},[P4]:{exposure:"event",shouldSkipFromEventProperties:e=>ct(e)},[N4]:{exposure:"event"},[$4]:{exposure:"event"},[D4]:{exposure:"event"},[U4]:{exposure:"event"},[q4]:{exposure:"hidden"},[es]:{exposure:"hidden",storageGroup:"flags"},[Ws]:{exposure:"hidden",storageGroup:"flags"},[Mm]:{exposure:"hidden"},[Ci]:{exposure:"hidden",storageGroup:"flags"},[Cn]:{exposure:"hidden",storageGroup:"flags"},[Pi]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[yc]:{exposure:"hidden",storageGroup:"flags"},[gs]:{exposure:"hidden"},[hi]:{exposure:"hidden"},[Pn]:{exposure:"hidden"},[xn]:{exposure:"hidden"},[cc]:{exposure:"hidden",storageGroup:"surveys"},[nd]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[EC]:{exposure:"event"},[TC]:{exposure:"hidden"},[AC]:{exposure:"hidden"},[Lm]:{exposure:"hidden"},[z4]:{exposure:"hidden"},[F4]:{exposure:"hidden"},[j4]:{exposure:"event"},[H4]:{exposure:"event"},[B4]:{exposure:"event"},[V4]:{exposure:"event"},[On]:{exposure:"hidden"},[lc]:{exposure:"hidden"},[kC]:{exposure:"event"},[zc]:{exposure:"hidden"},[Fn]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[tr]:{exposure:"hidden"},[Nm]:{exposure:"hidden"},[G4]:{exposure:"hidden"},[IC]:{exposure:"hidden"},[RC]:{exposure:"hidden"},[Ro]:{exposure:"hidden"},[p_]:{exposure:"hidden"},[x4]:{exposure:"event"},[O4]:{exposure:"event"},[M4]:{exposure:"event"},[L4]:{exposure:"event"},[PC]:{exposure:"event"},[xC]:{exposure:"event"},[h_]:{exposure:"hidden"},[f_]:{exposure:"hidden"},[OC]:{exposure:"hidden"},[MC]:{exposure:"hidden"},[LC]:{exposure:"hidden"},[NC]:{exposure:"hidden"},[$C]:{exposure:"hidden"},[DC]:{exposure:"hidden"},[UC]:{exposure:"hidden"},[K4]:{exposure:"event"}},fG=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Nt=e=>{const t=hG[e];if(t)return t;for(const[r,s]of fG)if(e.indexOf(r)===0)return s},Po=(e,t)=>{try{let r;return JSON.stringify(e,(s,n)=>{var i;return wa(n)?((i=r)!==null&&i!==void 0||(r=new WeakMap),r.has(n)||r.set(n,FC(n)),r.get(n)):typeof n=="bigint"?n.toString():n},t)}catch{return yR(e)}},an=e=>{const t=W?.createElement("a");return j(t)?null:(t.href=e,t)},ta=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(!we(s)||2>s.length)return"";{let n=s[1];try{n=decodeURIComponent(n)}catch{Q.error("Skipping decoding for malformed query param: "+n)}return n.replace(/\+/g," ")}},Bc=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("=");we(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},ad=function(e,t){const r=e.match(new RegExp(t+"=([^&]*)"));return r?r[1]:null},eP=(e,t)=>e>=t&&_R(),tP=(e,t,r,s)=>{if(e===0){if(_R()){const n=t+1;return n===r&&s(),n}return t}return 0},ra=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],mG=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ra],Vc="<masked>",gG=["li_fat_id"];function rP(e,t,r){if(!W)return{};const s=t?[...ra,...r||[]]:[],n=sP(Bc(W.URL,s,Vc),e),i=(function(){const o={};return Ve(gG,function(a){const c=bc(a);o[a]=c||null}),o})();return Ze(i,n)}function sP(e,t){const r=mG.concat(t||[]),s={};return Ve(r,function(n){const i=ta(e,n);s[n]=i||null}),s}function nP(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(!ct(t)){s.$search_engine=t;const n=W?ta(W.referrer,r):"";n.length&&(s.ph_keyword=n)}return s}function iP(){return navigator.language||navigator.userLanguage}function vG(){const e=iP();return typeof e=="string"?e.split("-")[0]:void 0}var cd="$direct";function oP(){return W?.referrer||cd}function aP(e,t,r=!1){const s=e?[...ra,...t||[]]:[],n=r?Wn(at?.href):at?.href,i=n?.substring(0,1e3);return{r:oP().substring(0,1e3),u:i?Bc(i,s,Vc):void 0}}function cP(e,t=!1){var r;const{r:s,u:n}=e,i=t?Wn(n):n,o={$referrer:s,$referring_domain:s==null?void 0:s==cd?cd:(r=an(s))===null||r===void 0?void 0:r.host};if(i){o.$current_url=i;const a=an(i);o.$host=a?.host,o.$pathname=a?.pathname;const c=sP(i);Ze(o,c)}if(s){const a=nP(s);Ze(o,a)}return o}function lP(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function _G(){try{return new Date().getTimezoneOffset()}catch{return}}var yG={flags:Fn,surveys:nd},bG=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],tu=e=>`${e}_cookie_identity_change_pending`,ru=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},bt="main",Vs=[es,Ws,Ci,Cn,Pi,Fn,yc,Pn],Dh=e=>Vs.indexOf(e)!==-1,uP=[Uo,vc],ow=e=>uP.indexOf(e)!==-1,fn=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},ao=e=>{if(!e)return{};const t=JSON.parse(e);return $e(t)?t:{}},aw=(e,t)=>{Ve(e,(r,s)=>{const n=Nt(s);n&&n.exposure!=="event"||{}.hasOwnProperty.call(t,s)||delete e[s]})},Uh=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&&Q.info("Persistence loaded",e.persistence,S({},this.props)),this.update_config(e,e,t),this.save(),D){const s=()=>this.flush();Fe(D,"beforeunload",s,{capture:!1}),Fe(D,"pagehide",s,{capture:!1}),this.va=n=>{if(this.Jo&&(!n.storageArea||n.storageArea===D?.localStorage)&&n.key)if(n.key!==this.ua){if(this.Xo){const i=Ka.find(o=>n.key===this.fa(o));i&&this.pa(n.key,i)}}else this.pa(n.key,bt)},Fe(D,"storage",this.va)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,r])=>{const s=this.ea.get(t);if(!Dh(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&&D&&(D.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=qe.Ot(e),ct(n)){const a=this.ma(t);return a.storageValue=null,t!==bt&&(a.persisted=!1),!1}s=ao(n)}catch{return!1}const i=t===bt?s:qe.Dt(this.ua);if(i&&this.ya(i))return!1;const o=this.ba(s,t,r);return t===bt&&this.Xo&&!fn(this._a().main,s)||this.wa(s,t,!0,n),o}ya(e){const t=this.props[Jr],r=e[Jr];return!j(t)&&!j(r)&&t!==r}wa(e,t,r,s){const n=this.ma(t);n.storageValue=s,t!==bt&&(n.persisted=r);try{n.fingerprint=this.ka(e,t)}catch{n.fingerprint=void 0}}ba(e,t,r){let s=!1;return Vs.forEach(n=>{var i;const o=(i=Nt(n))===null||i===void 0?void 0:i.storageGroup;if(t===bt&&this.Xo&&o||t!==bt&&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&&fn(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=qe.Ot(this.ua),t=this.ma(bt);let r,s=!1,n=!1;if(e!==t.storageValue)if(ct(e))t.storageValue=null;else{if(r=ao(e),this.sa=!this.na&&this.ya(r),this.sa)return!1;n=this.ba(r,bt,!1),!this.Xo||fn(this._a().main,r)?this.wa(r,bt,!0,e):t.storageValue=e,s=!0}return this.Xo&&Ka.forEach(i=>{const o=qe.Ot(this.fa(i)),a=this.ma(i),c=r||{},l=s&&Vs.some(p=>{var d;return((d=Nt(p))===null||d===void 0?void 0:d.storageGroup)===i&&p in c});if(o===a.storageValue&&!l)return;if(ct(o))return a.storageValue=null,a.persisted=!1,void(l&&(n=this.ba(c,i,!1)||n));const u=ao(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=Nt(e);r!=null&&r.volatile||(this.ma((this.Xo?r?.storageGroup:void 0)||bt).fingerprint=void 0,this.Ta(e))}Ia(){Vs.forEach(e=>this.ea.set(e,!0))}da(){if(this.Jo)try{const e=qe.Ot(this.ua),t=ao(e);this.ma(bt).storageValue=e,Vs.forEach(r=>{var s;const n=this.Xo?(s=Nt(r))===null||s===void 0?void 0:s.storageGroup:void 0,i=n?qe.Ot(this.fa(n)):null;if(n){const a=this.ma(n);a.storageValue=i,a.persisted=!ct(i)}const o=n&&!ct(i)?ao(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(we(t)?t:[]),o=new Set(we(this.props[e])?this.props[e]:[]);return r.forEach(a=>o.has(a)?i.add(a):i.delete(a)),Array.from(i)}const s=$e(t)?S({},t):{},n=$e(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(!Dh(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=Nt(e))===null||i===void 0?void 0:i.storageGroup:void 0,c=a?this.fa(a):this.ua;n=ao(qe.Ot(c))[e]}catch{}const o=new Set(s||[]);if(e==="$active_feature_flags"){if(!j(t)&&!we(t)||!j(n)&&!we(n)||!we(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(!$e(r))return void(fn(n,r)?this.ea.delete(e):this.ga(e,!0));{if(!j(t)&&!$e(t)||j(t)&&pr(r)&&j(n))return void this.ga(e,!0);const a=$e(t)?t:{},c=$e(n)?n:{};new Set([...Object.keys(a),...Object.keys(r)]).forEach(l=>{l in a==l in r&&fn(a[l],r[l])||o.add(l)}),o.forEach(l=>{l in c==l in r&&fn(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 ht(t)&&t>0?t:0}Pa(e){if(this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const t=Lh(e,this.Ir.cookie_persisted_properties||[]),r=V0(t,this.Ir.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(r),n=ot.Ot(this.ua)||void 0;n&&Nh(this.ua,n)===s&&(this.Ra=s,this.Aa=n)}catch{}else try{const t=ot.Ot(this.ua)||void 0;this.Ra=t?Nh(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=ot.Ot(this.ua)||void 0}catch{}if(!r||r===this.Aa)return!1;const s=Nh(this.ua,r);let n;try{n=Mh(JSON.parse(r))}catch{return!1}if((ot.Ot(this.ua)||void 0)!==r)return!1;this.Ra=s,this.Aa=r;const i=G0(this.ua,r),o=[...fi,...i.properties],a={};if(Object.keys(n).forEach(f=>{const g=n[f];(j(g)||ct(g)||g===""||f==="$user_state"&&g!=="anonymous"&&g!=="identified")&&(a[f]=!0,delete n[f])}),pr(n))return!1;const c="distinct_id"in n||n.$user_state==="anonymous"||n.$user_state==="identified",l=this.props,u=l[Jr],p=l[tr],d=Ze({},l);[...fi,...e.cookie_persisted_properties||[]].forEach(f=>{if(o.indexOf(f)!==-1&&!(f in n)&&!a[f]&&(c||f!=="distinct_id"&&f!=="$user_state")){const g=d[f];(i.isValid||fi.indexOf(f)===-1||g!==!1&&g!==0)&&delete d[f]}}),this.props=Ze(d,n),Vs.forEach(f=>{const g=f in this.props;f in l===g&&fn(l[f],this.props[f])||(g?this.Ma(f,l[f],this.props[f]):this.ga(f,!0))}),!c||"$user_state"in n||"$user_state"in this.props||this.xa(tr,Js);const h=this.props[Jr],m=this.props[tr];return!c||h===u&&m===p||(this.na=!0,this.Yo=!0,Ye.$t(tu(this.ua),!0),this.Ca(Pn),this.Ca(Ws),this.Ca(es),this.Ca(Ci),this.Ca(Cn),this.Ca(Pi),this.Ca(Fn),this.Ca(zc),this.Ca(On),m!=="anonymous"||p!=="identified"&&n.$user_state!=="anonymous"&&(j(u)||h===u)||(aw(this.props,n),this.Ca(xn)),m==="identified"?this.props.$user_id=h:delete this.props.$user_id,this.Ca(sd)),!0}consumeCookieIdentityChange(){const e=tu(this.ua),t=this.Yo||!!Ye.Ot(e);return this.Yo=!1,t&&Ye.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[bt],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){bG.indexOf(e.persistence.toLowerCase())===-1&&(Q.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const t=((o=[],a=!1)=>{const c=[...fi,...o];return S(S({},qe),{},{Dt(l){try{let p,d={};try{p=ot.Ot(l)||void 0,d=p?Mh(JSON.parse(p)):{}}catch{}const h=JSON.parse(qe.Ot(l)||"{}");let m;if(a){const f=G0(l,p),g=[...fi,...f.properties],_={};Object.keys(d).forEach(E=>{const P=d[E];ct(P)||P===""||E==="$user_state"&&P!=="anonymous"&&P!=="identified"||(_[E]=P)});const y="distinct_id"in _||_.$user_state==="anonymous"||_.$user_state==="identified";if(Object.keys(_).length>0){var u;const E=h[Jr],P=(u=h.$user_state)!==null&&u!==void 0?u:Js;c.forEach(I=>{if(g.indexOf(I)!==-1&&!(I in d)&&(y||I!=="distinct_id"&&I!=="$user_state")){const M=h[I];(f.isValid||fi.indexOf(I)===-1||M!==!1&&M!==0)&&delete h[I]}}),!y||"$user_state"in d||"$user_state"in h||(h[tr]=Js),!y||("distinct_id"in _?_[Jr]:h[Jr])===E&&("$user_state"in _?_[tr]:h[tr])===P||(Oh.forEach(I=>delete h[I]),_.$user_state==="identified"&&"distinct_id"in _?h.$user_id=_[Jr]:delete h.$user_id,_.$user_state!=="identified"&&(delete h[kC],delete h[xn]),delete h.__alias)}m=Ze(h,_)}else m=Ze(d,h);return qe.$t(l,m),m}catch{}return null},$t(l,u,p,d,h,m){const f=qe.$t(l,u,void 0,void 0,m);try{const g=Lh(u,o);if(Object.keys(g).length){if(a){const _=od(l),y=V0(g,o);if(ot.$t(_,y,p,d,h,m),ot.Ot(_)!==JSON.stringify(y)){ot.Lt(_,d);const E=Lh(u);return ot.$t(l,E,p,d,h,m),f}}ot.$t(l,g,p,d,h,m)}}catch(g){qe.Pt(g)}return f},Lt(l,u){try{D?.localStorage.removeItem(l),ot.Lt(l,u),ot.Lt(od(l),u)}catch(p){qe.Pt(p)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let r,s=!1,n=!1;const i=e.persistence.toLowerCase();return i==="localstorage"&&qe.Et()?(r=qe,n=!0):i==="localstorage+cookie"&&t.Et()?(r=t,n=!0,s=!0):i==="sessionstorage"&&Ye.Et()?r=Ye:i==="memory"?r=Um:i==="cookie"&&ot.Et()?(r=ot,s=!0):t.Et()?(r=t,n=!0,s=!0):ot.Et()?(r=ot,s=!0):r=Um,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 Ve(this.props,(t,r)=>{const s=Nt(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?qe.Dt(this.ua):null;let s={};if(t)try{s=Mh(ot.Dt(this.ua)),Ve(s,(a,c)=>{(j(a)||ct(a)||a==="")&&delete s[c]})}catch{}const n=this.No.Dt(this.ua);if(n&&(this.props=Ze({},n)),this.Xo&&this.ja(),t&&n){var i,o;const a=r?.[Jr],c=(i=r?.$user_state)!==null&&i!==void 0?i:Js,l=n[Jr],u=(o=n.$user_state)!==null&&o!==void 0?o:Js;if(l!==a||u!==c){this.Yo=!0,Ye.$t(tu(this.ua),!0);const p=Ze({},this.props);Oh.forEach(h=>delete p[h]),u!=="anonymous"||c!=="identified"&&s.$user_state!=="anonymous"&&(j(a)||l===a)||(aw(p,s),delete p[xn]),this.props=p;const d=new Set;Oh.forEach(h=>{var m;const f=(m=Nt(h))===null||m===void 0?void 0:m.storageGroup;f&&d.add(f)}),d.forEach(h=>{const m={};Ve(this.props,(f,g)=>{var _;((_=Nt(g))===null||_===void 0?void 0:_.storageGroup)===h&&(m[g]=f)}),pr(m)?(qe.Lt(this.fa(h)),this.Qo[h]={}):qe.$t(this.fa(h),m)&&(this.Qo[h]={persisted:!0,fingerprint:this.ka(m,h)})})}}Ye.Ot(tu(this.ua))&&(this.Yo=!0)}ja(){for(const e of Ka){const t=qe.Dt(this.fa(e));if(t&&!pr(t)){const r=this.ma(e);r.persisted=!0,this.Ba(e)||(r.fingerprint=this.ka(t,e)),this.Ha(e,t)||Ze(this.props,t)}}}Ba(e){return Object.keys(this.props).some(t=>{var r;return((r=Nt(t))===null||r===void 0?void 0:r.storageGroup)===e})}Ha(e,t){const r=yG[e];if(!r)return!1;const s=t[r],n=this.props[r];return ht(s)&&ht(n)&&n>s}refreshKey(e){var t;if(this.hi||this.ra.has(e))return;const r=this.Xo?(t=Nt(e))===null||t===void 0?void 0:t.storageGroup:void 0,s=r?qe.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"||uP.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&&Q.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,bt);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,bt);r==="written"&&this.Pa(e),r!=="failed"&&(this.na=!1,this.ra.clear(),Vs.forEach(n=>{var i;(i=Nt(n))!==null&&i!==void 0&&i.storageGroup||this.ea.delete(n)}));for(const n of Ka){var s;const i=t[n];if(pr(i)&&!(!((s=this.Qo[n])===null||s===void 0)&&s.persisted)){Vs.forEach(a=>{var c;((c=Nt(a))===null||c===void 0?void 0:c.storageGroup)===n&&this.ea.delete(a)});continue}const o=this.Ua(qe,this.fa(n),i,n);o!=="failed"&&Vs.forEach(a=>{const c=Nt(a);c?.storageGroup!==n||o!=="written"&&c.volatile||this.ea.delete(a)})}}_a(){const e={},t={flags:{},surveys:{}};return Ve(this.props,(r,s)=>{var n;const i=(n=Nt(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===bt)return JSON.stringify(e)+"|"+this.Wa+"|"+this.Va+"|"+this.Ga;const r={};return Ve(e,(s,n)=>{var i;r[n]=!((i=Nt(n))===null||i===void 0)&&i.volatile?"__volatile__":s}),JSON.stringify(r)}Ua(e,t,r,s){const n=this.ma(s);if(s!==bt&&!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!==bt&&(n.persisted=!0),j(i)||(n.fingerprint=i),this.Jo&&(n.storageValue=qe.Ot(t)),"written"):(this.Ir.debug&&Q.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 Ka)qe.Lt(this.fa(t));e?delete this.Qo[bt]:this.Qo={},this.Ra=void 0,this.Aa=void 0}clear(){this.remove(),this.props={}}register_once(e,t,r){if($e(e)){this.syncCookieProperties(),j(t)&&(t="None"),this.Wa=j(r)?this.Za:r;let s=!1;if(Ve(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($e(e)){this.syncCookieProperties(),this.Wa=j(t)?this.Za:t;let r=!1;if(Ve(e,(s,n)=>{e.hasOwnProperty(n)&&(this.props[n]!==s||$e(s)||we(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=rP(this.Ir.custom_campaign_params,this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties),r=!pr(v_(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?nP(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:oP(),$referring_domain:W?.referrer&&((e=an(W.referrer))===null||e===void 0?void 0:e.host)||cd},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=aP(this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties,this.Ir.disable_capture_url_hashes);this.register_once({[Ro]:this.Ko?{r:ru(e.r),u:e.u?ru(e.u):void 0}:e},void 0)}get_initial_props(){const e={};Ve([RC,IC],r=>{const s=this.props[r];s&&Ve(s,function(n,i){e["$initial_"+bm(i)]=n})});const t=this.props[Ro];if(t){const r=(function(s,n=!1){const i=cP(s,n),o={};return Ve(i,function(a,c){o[`$initial_${bm(c)}`]=a}),o})(t,this.Ir.disable_capture_url_hashes);Ze(e,r)}return e}safe_merge(e){return Ve(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,m)=>{if(h.length!==m.length)return!1;const f=[...h].sort(),g=[...m].sort();return f.every((_,y)=>_===g[y])})(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[bt],this.Na()))}finally{this.ia=!1,d&&this.qa()}}Qa(){const e=this.props[Ro];if(!this.Ko||!$e(e)||typeof e.r!="string")return;const t=ru(e.r),r=typeof e.u=="string"?ru(e.u):e.u;t===e.r&&r===e.u||this.xa(Ro,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(Rm,r),this.save()}remove_event_timer(e){const t=this.props.__timers||{},r=t[e];return j(r)||(delete t[e],this.xa(Rm,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),ow(e)&&!fn(n,t)&&this.ra.add(e),this.Ma(e,n,t),(s=Nt(e))!==null&&s!==void 0&&s.volatile||this.Ta(e))}Ca(e,t=!0){delete this.props[e],t&&(Dh(e)&&this.ga(e,!0),ow(e)&&this.ra.add(e),this.Ta(e))}Ta(e){var t;const r=(t=Nt(e))===null||t===void 0?void 0:t.storageGroup;r&&(this.ma(r).dirty=!0)}ma(e){return this.Qo[e]||(this.Qo[e]={})}},wr={GZipJS:"gzip-js",Base64:"base64"},Wa={Activation:"events",Cancellation:"cancelEvents"},qh={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},yr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},zh={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"},Fm={Popover:"popover",Inline:"inline"};function su(e){let t=!0;return{dispose(){if(t){t=!1;const r=e();r&&Rt(r.then)&&r.then(void 0,()=>{})}}}}var wG={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"},cw={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"},lw=ut("[RateLimiter]"),SG=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=>{lw.info(`${s||"events"} is quota limited.`),this.serverLimits[s]=new Date().getTime()+6e4})}catch(s){lw.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=(ht(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!we(t)||!t.includes(e)}Xa(){var e;if(this.Ka("$current_url")&&this.Ka("$pathname")&&at?.pathname)return`${(e=at.origin)!==null&&e!==void 0?e:""}${at.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}},mn=ut("[RemoteConfig]"),dP=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=ve._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=ve.__PosthogExtensions__)===null||t===void 0)&&t.loadExternalDependency?(r=ve.__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 mn.info("Using preloaded remote config",this.remoteConfig),void this.el(this.remoteConfig);if(this._instance.il())return void mn.warn("Remote config is disabled. Falling back to local config.");this.Ya(e=>{if(!e)return mn.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){mn.error("Error loading remote config",e),this.el()}}el(e,t){!e&&t&&(t.statusCode===0?t.error||mn.warn("Failed to fetch remote config from PostHog."):mn.error("Failed to fetch remote config from PostHog."));try{this._instance.el(e?{ok:!0,config:e}:{ok:!1})}catch(s){mn.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){mn.error("Error loading feature flags",s)}}},Tr=Uint8Array,nr=Uint16Array,sa=Uint32Array,S_=new Tr([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]),k_=new Tr([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]),uw=new Tr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pP=function(e,t){for(var r=new nr(31),s=0;31>s;++s)r[s]=t+=1<<e[s-1];var n=new sa(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]},hP=pP(S_,2),jm=hP[1];hP[0][28]=258,jm[258]=28;for(var dw=pP(k_,0)[1],Hm=new nr(32768),lt=0;32768>lt;++lt){var co=(43690<)>>>1|(21845<)<<1;Hm[lt]=((65280&(co=(61680&(co=(52428&co)>>>2|(13107&co)<<2))>>>4|(3855&co)<<4))>>>8|(255&co)<<8)>>>1}var kc=function(e,t,r){for(var s=e.length,n=0,i=new nr(t);s>n;++n)++i[e[n]-1];var o,a=new nr(t);for(n=0;t>n;++n)a[n]=a[n-1]+i[n-1]<<1;if(r){o=new nr(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[Hm[p]>>>c]=l}else for(o=new nr(s),n=0;s>n;++n)o[n]=Hm[a[e[n]-1]++]>>>15-e[n];return o},Ui=new Tr(288);for(lt=0;144>lt;++lt)Ui[lt]=8;for(lt=144;256>lt;++lt)Ui[lt]=9;for(lt=256;280>lt;++lt)Ui[lt]=7;for(lt=280;288>lt;++lt)Ui[lt]=8;var ld=new Tr(32);for(lt=0;32>lt;++lt)ld[lt]=5;var kG=kc(Ui,9,0),EG=kc(ld,5,0),fP=function(e){return(e/8|0)+(7&e&&1)},mP=function(e,t,r){(t==null||0>t)&&(t=0),(r==null||r>e.length)&&(r=e.length);var s=new(e instanceof nr?nr:e instanceof sa?sa:Tr)(r-t);return s.set(e.subarray(t,r)),s},qs=function(e,t,r){var s=t/8|0;e[s]|=r<<=7&t,e[s+1]|=r>>>8},Ja=function(e,t,r){var s=t/8|0;e[s]|=r<<=7&t,e[s+1]|=r>>>8,e[s+2]|=r>>>16},Fh=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 Tr(0),0];if(n==1){var o=new Tr(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort(function(I,M){return I.f-M.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 nr(d+1),m=Bm(r[u-1],h,0);if(m>t){s=0;var f=0,g=m-t,_=1<<g;for(i.sort(function(I,M){return h[M.s]-h[I.s]||I.f-M.f});n>s;++s){var y=i[s].s;if(t>=h[y])break;f+=_-(1<<m-h[y]),h[y]=t}for(f>>>=g;f>0;){var E=i[s].s;t>h[E]?f-=1<<t-h[E]++-1:++s}for(;s>=0&&f;--s){var P=i[s].s;h[P]==t&&(--h[P],++f)}m=t}return[new Tr(h),m]},Bm=function(e,t,r){return e.s==-1?Math.max(Bm(e.l,t,r+1),Bm(e.r,t,r+1)):t[e.s]=r},pw=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new nr(++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]},Ya=function(e,t){for(var r=0,s=0;t.length>s;++s)r+=e[s]*t[s];return r},Iu=function(e,t,r){var s=r.length,n=fP(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)},hw=function(e,t,r,s,n,i,o,a,c,l,u){qs(t,u++,r),++n[256];for(var p=Fh(n,15),d=p[0],h=p[1],m=Fh(i,15),f=m[0],g=m[1],_=pw(d),y=_[0],E=_[1],P=pw(f),I=P[0],M=P[1],$=new nr(19),O=0;y.length>O;++O)$[31&y[O]]++;for(O=0;I.length>O;++O)$[31&I[O]]++;for(var B=Fh($,7),le=B[0],ie=B[1],C=19;C>4&&!le[uw[C-1]];--C);var fe,X,me,q,ue=l+5<<3,b=Ya(n,Ui)+Ya(i,ld)+o,ee=Ya(n,d)+Ya(i,f)+o+14+3*C+Ya($,le)+(2*$[16]+3*$[17]+7*$[18]);if(b>=ue&&ee>=ue)return Iu(t,u,e.subarray(c,c+l));if(qs(t,u,1+(b>ee)),u+=2,b>ee){fe=kc(d,h,0),X=d,me=kc(f,g,0),q=f;var ne=kc(le,ie,0);for(qs(t,u,E-257),qs(t,u+5,M-1),qs(t,u+10,C-4),u+=14,O=0;C>O;++O)qs(t,u+3*O,le[uw[O]]);u+=3*C;for(var H=[y,I],R=0;2>R;++R){var te=H[R];for(O=0;te.length>O;++O)qs(t,u,ne[ae=31&te[O]]),u+=le[ae],ae>15&&(qs(t,u,te[O]>>>5&127),u+=te[O]>>>12)}}else fe=kG,X=Ui,me=EG,q=ld;for(O=0;a>O;++O)if(s[O]>255){var ae;Ja(t,u,fe[257+(ae=s[O]>>>18&31)]),u+=X[ae+257],ae>7&&(qs(t,u,s[O]>>>23&31),u+=S_[ae]);var he=31&s[O];Ja(t,u,me[he]),u+=q[he],he>3&&(Ja(t,u,s[O]>>>5&8191),u+=k_[he])}else Ja(t,u,fe[s[O]]),u+=X[s[O]];return Ja(t,u,fe[256]),u+X[256]},TG=new sa([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),AG=new Tr(0),IG=(function(){for(var e=new sa(256),t=0;256>t;++t){for(var r=t,s=9;--s;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e})(),jh=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8};function RG(e,t){t===void 0&&(t={});var r=(function(){var d=4294967295;return{p(h){for(var m=d,f=0;h.length>f;++f)m=IG[255&m^h[f]]^m>>>8;d=m},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,m,f,g,_){var y=d.length,E=new Tr(f+y+5*(1+Math.floor(y/7e3))+g),P=E.subarray(f,E.length-g),I=0;if(!h||8>y)for(var M=0;y>=M;M+=65535){var $=M+65535;y>$?I=Iu(P,I,d.subarray(M,$)):(P[M]=_,I=Iu(P,I,d.subarray(M,y)))}else{for(var O=TG[h-1],B=O>>>13,le=8191&O,ie=(1<<m)-1,C=new nr(32768),fe=new nr(ie+1),X=Math.ceil(m/3),me=2*X,q=function(v){return(d[v]^d[v+1]<<X^d[v+2]<<me)&ie},ue=new sa(25e3),b=new nr(288),ee=new nr(32),ne=0,H=0,R=(M=0,0),te=0,ae=0;y>M;++M){var he=q(M),de=32767&M,Ke=fe[he];if(C[de]=Ke,fe[he]=de,M>=te){var Ge=y-M;if((ne>7e3||R>24576)&&Ge>423){I=hw(d,P,0,ue,b,ee,H,R,ae,M-ae,I),R=ne=H=0,ae=M;for(var Pe=0;286>Pe;++Pe)b[Pe]=0;for(Pe=0;30>Pe;++Pe)ee[Pe]=0}var V=2,pe=0,ye=le,ke=de-Ke&32767;if(Ge>2&&he==q(M-ke))for(var He=Math.min(B,Ge)-1,Oe=Math.min(32767,M),Le=Math.min(258,Ge);Oe>=ke&&--ye&&de!=Ke;){if(d[M+V]==d[M+V-ke]){for(var Ee=0;Le>Ee&&d[M+Ee]==d[M+Ee-ke];++Ee);if(Ee>V){if(V=Ee,pe=ke,Ee>He)break;var Ae=Math.min(ke,Ee-2),Ne=0;for(Pe=0;Ae>Pe;++Pe){var tt=M-ke+Pe+32768&32767,J=tt-C[tt]+32768&32767;J>Ne&&(Ne=J,Ke=tt)}}}ke+=(de=Ke)-(Ke=C[de])+32768&32767}if(pe){ue[R++]=268435456|jm[V]<<18|dw[pe];var oe=31&jm[V],A=31&dw[pe];H+=S_[oe]+k_[A],++b[257+oe],++ee[A],te=M+V,++ne}else ue[R++]=d[M],++b[d[M]]}}I=hw(d,P,_,ue,b,ee,H,R,ae,M-ae,I),_||(I=Iu(P,I,AG))}return mP(E,0,f+fP(I)+g)})(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 m=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&&jh(d,4,Math.floor(new Date(h.mtime||Date.now())/1e3)),m){d[3]=8;for(var f=0;m.length>=f;++f)d[f+10]=m.charCodeAt(f)}})(u,t),jh(u,p-8,r.d()),jh(u,p-4,s),u}var CG=!!s_||!!Uc,gP=new WeakMap,vP="text/plain",Hh=0,Ru=!1,_P=(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}`:""}`},hl=(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 Ve(l,function(m,f){j(m)||j(f)||f==="undefined"||(p=encodeURIComponent((g=>g instanceof File)(m)?m.name:m.toString()),d=encodeURIComponent(f),h[h.length]=d+"="+p)}),h.join(u)})(o);return c&&a.push(c),a.length>0?`${n}?${a.join("&")}`:n},Bh=e=>{if(e.nl)return e.nl;const{data:t,compression:r}=e;if(!t)return;if(r===wr.GZipJS){const n=RG((function(i){var o=i.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(i);for(var a=new Tr(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 Tr(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 mP(a,0,c)})(Po(t)),{mtime:0});return{contentType:vP,body:n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength),estimatedSize:n.byteLength}}if(r===wr.Base64){const n=(i=>"data="+encodeURIComponent(typeof i=="string"?i:Po(i)))((function(i){return i&&btoa(encodeURIComponent(i).replace(/%([0-9A-F]{2})/g,(o,a)=>String.fromCharCode(parseInt(a,16))))})(Po(t)));return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}const s=Po(t);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},yP=e=>{const t=()=>e.transport==="sendBeacon"?{url:hl(e.url,{compression:wr.Base64}),encodedBody:Bh(S(S({},e),{},{compression:wr.Base64,nl:void 0}))}:{url:_P(e.url,"compression"),encodedBody:Bh(S(S({},e),{},{compression:void 0,nl:void 0}))};let r;try{r=Bh(e)}catch(n){if(M0(e.compression,ta(e.url,"compression")))return Q.error("Failed to gzip request body, sending uncompressed payload",n),t();throw n}return r&&M0(e.compression,ta(e.url,"compression"))&&!((s=r.body)instanceof ArrayBuffer?Am(new Uint8Array(s)):ArrayBuffer.isView(s)&&Am(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Ru=!0,t()):{url:e.url,encodedBody:r};var s},bP=e=>{try{return yP(e)}catch(r){var t;Q.error(r),(t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:r});return}},PG=(function(){var e=et(function*(t){const r=yield(function(n){return Im.apply(this,arguments)})(Po(t.data),St.DEBUG,{rethrow:!0});if(!r)return t;const s=yield r.arrayBuffer();return S(S({},t),{},{nl:{contentType:vP,body:s,estimatedSize:s.byteLength}})});return function(t){return e.apply(this,arguments)}})(),xG=/Failed to fetch|NetworkError|Load failed/i,wP=e=>e?.name==="TypeError"&&xG.test(e?.message||""),SP=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,Eu):void 0})(e());return j(t)?void 0:Math.min(t,3e4)}catch{return}},kP=e=>{const t=bP(e);if(!t)return;const r=new s_;gP.set(r,!0);const{url:s,encodedBody:n}=t;r.open(e.method||"GET",s,!0);const{contentType:i,body:o}=n??{};Ve(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,SP(()=>r.getResponseHeader("Retry-After")))}},r.send(o)},EP=e=>{const t=bP(e);if(!t)return;const{url:r,encodedBody:s}=t,{contentType:n,body:i,estimatedSize:o}=s??{},a=new Headers;Ve(e.headers,function(m,f){a.append(f,m)}),n&&a.append("Content-Type",n);let c=null,l=!1;if(v0){const m=new v0;c={signal:m.signal,timeout:setTimeout(()=>{l=!0;try{m.abort(ZR("AbortError","PostHog request timed out"+((f=e.timeout)?` after ${f}ms`:"")))}catch(g){p(g)}var f},e.timeout)}}let u=!1;const p=m=>{var f;u||(u=!0,l&&m?.name==="AbortError"||wP(m)?Q.warn(m):Q.error(m),(f=e.callback)===null||f===void 0||f.call(e,{statusCode:0,error:m}))};let d=0;const h=()=>{Hh-=d,d=0,c&&clearTimeout(c.timeout)};try{const m=S({method:e?.method||"GET",headers:a,referrerPolicy:"strict-origin",body:i,signal:c?.signal},e.fetchOptions),f=o??(j(i)?0:void 0);m.keepalive=m.method==="POST"&&!e.sl&&m.keepalive!==!1&&m.body===i&&!j(f)&&f>=0&&52428.8>Hh+f,m.keepalive&&(d=f,Hh+=d),Uc(r,m).then(g=>g.text().then(_=>{var y;if(u)return;const E={statusCode:g.status,text:_};if(g.status===200)try{E.json=JSON.parse(_)}catch(P){Q.error(P)}u=!0,h(),(y=e.callback)===null||y===void 0||y.call(e,E,SP(()=>g.headers.get("Retry-After")))})).catch(g=>{h(),p(g)}).finally(h)}catch(m){h(),p(m)}},Vm=e=>{try{var t;const{url:r,encodedBody:s}=yP(e),{contentType:n,body:i,estimatedSize:o}=s??{};if(!i)return;const a=i instanceof Blob?i:new Blob([i],{type:n});if(Pt.sendBeacon(r,a))return;const c=we(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(we(c)&&c.length>1&&(o??0)>16384){const l=Math.ceil(c.length/2),u=p=>we(e.data)?p:S(S({},e.data),{},{batch:p});Vm(S(S({},e),{},{data:u(c.slice(0,l))})),Vm(S(S({},e),{},{data:u(c.slice(l))}));return}Q.warn(`Beacon of ~${o??0} bytes was rejected by the browser, falling back to ${Uc?"fetch":"XHR"}`),Uc?EP(S(S({},e),{},{sl:!0})):kP(e)}catch(r){Q.warn("Beacon send failed",r)}},fw=(e,t,r,s)=>{const n=s==="query"?t==="POST"?"sent_at":"_":void 0;return hl(r===wr.GZipJS?_P(e,"compression"):e,S(S({},n?{[n]:Date.now().toString()}:{}),r===wr.GZipJS?{}:{compression:r}))},OG=(()=>{const e=[];return Uc&&e.push({transport:"fetch",method:EP}),s_&&e.push({transport:"XHR",method:kP}),Pt!=null&&Pt.sendBeacon&&e.push({transport:"sendBeacon",method:Vm}),e})(),TP=!CG&&Zt?.indexOf("MSIE")===-1&&Zt?.indexOf("Mozilla")===-1;function AP(e,t,r){var s,n,i;r&&(t=S(S({},t),{},{callback:o=>r(o)})),e.__loaded?TP?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??(g=>{var _;return(_=o.callback)===null||_===void 0?void 0:_.call(o,g)})});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=wr.Base64),p.method==="POST"&&p.data&&(p.timestampMode==="capture-body"?p.data=(g=>{var _,y;const E=(we(g)?g:[g]).map(I=>S(S({},I),I.timestamp instanceof Date&&!isNaN(I.timestamp.getTime())?{timestamp:I.timestamp.toISOString()}:{})),P=E[0];return{api_key:(_=P==null||(y=P.properties)===null||y===void 0?void 0:y.token)!==null&&_!==void 0?_:P?.token,batch:E,sent_at:new Date().toISOString()}})(p.data):p.timestampMode==="body"&&(p.data=((g,_=new Date().toISOString())=>we(g)?g.map(y=>S(S({},y),{},{sent_at:_})):S(S({},g),{},{sent_at:_}))(p.data))),p.url=fw(p.url,p.method,p.compression,p.timestampMode);const h=OG.filter(g=>!p.disableTransport||!g.transport||!p.disableTransport.includes(g.transport)),m=(l=(u=(function(g,_){for(let y=0;g.length>y;y++)if(_(g[y]))return g[y]})(h,g=>g.transport===d))===null||u===void 0?void 0:u.method)!==null&&l!==void 0?l:h[0].method;if(!m)throw new Error("No available transport method");const f=g=>{try{m(g)}catch(y){var _;wP(y)?Q.warn(y):Q.error(y),(_=p.callback)===null||_===void 0||_.call(p,{statusCode:0,error:y})}};d!=="sendBeacon"&&!p.preferSyncCompression&&p.data&&p.compression===wr.GZipJS&&S3&&typeof Promise<"u"&&!Ru?PG(p).then(g=>{f(g)}).catch(g=>{if(L0(g))return Ru=!0,void f(S(S({},p),{},{compression:void 0,url:fw(o.url,o.method,void 0,o.timestampMode)}));(_=>{if(!_||typeof _!="object")return!1;const y="name"in _?String(_.name):"";return L0(_)||y===oC})(g)&&(Ru=!0),f(p)}):f(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 MG=class{constructor(e,t){this.rl=!0,this.ol=[],this.al=ks(t?.flush_interval_ms||3e3,250,5e3,Q.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){Q.error(r)}}cl(){clearTimeout(this.ul),this.ul=void 0}dl(){const e={};return Ve(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}},LG=["retriesPerformedSoFar"],NG=class{constructor(e){this._instance=e,this.fl=!1,this.pl=3e3,this.ol=[],this.ol=[],this.gl=!0,this.resume()}resume(){if(!j(D)&&"onLine"in D.navigator){if(this.gl=D.navigator.onLine,this.ml)return;this.ml=()=>{this.gl=!0,this.yl()},this.bl=()=>{this.gl=!1},Fe(D,"online",this.ml),Fe(D,"offline",this.bl)}}get length(){return this.ol.length}retriableRequest(e,t){let{retriesPerformedSoFar:r}=e,s=aC(e,LG);Bs(r)&&(s.url=hl(s.url,{retry_count:r})),AP(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&&Q.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)"),Q.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(D)||(this.ml&&(D.removeEventListener("online",this.ml),this.ml=void 0),this.bl&&(D.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){Q.error(t)}this.ol=[]}},$G=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(){Fe(D,"scroll",this.kl,{capture:!0}),Fe(D,"scrollend",this.kl,{capture:!0}),Fe(D,"resize",this.kl)}scrollElement(){if(this.xl){const r=we(this.xl)?this.xl:[this.xl];for(const s of r){var e;const n=D==null||(e=D.document)===null||e===void 0?void 0:e.querySelector(s);if(n)return n}return}var t;return D==null||(t=D.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 D?e==="y"?D.scrollY||D.pageYOffset||((t=D.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.scrollTop)||0:D.scrollX||D.pageXOffset||((r=D.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")}},DG=e=>aP(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties,e?.config.disable_capture_url_hashes),mw=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({[Nm]:o})},this._instance=e,this.Ml=t,this.Il=r,this.Tl=s||DG,this.Ml.onSessionId(this.qe)}$l(){return this.Il.props[Nm]}getSetOnceProps(){var e;const t=(e=this.$l())===null||e===void 0?void 0:e.props;return t?"r"in t?cP(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 Ve(v_(this.getSetOnceProps()),(t,r)=>{r==="$current_url"&&(r="url"),e[`$session_entry_${bm(r)}`]=t}),e}},ud=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={}}},lo=ut("[SessionId]"),gw=864e5,vw=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 ud,this.Ll=(i,o)=>!(!Bs(i)||!Bs(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||ts,this.jl=r||ts;const n=this.Ir.persistence_name||this.Ir.token;if(this._sessionTimeoutMs=1e3*ks(this.Ir.session_idle_timeout_seconds||1800,60,36e3,lo.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=Ye.Dt(this.Hl),o=Ye.Dt(this.zl);i&&!o?this.je=i:Ye.Lt(this.Hl),Ye.$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&&Ye.Et()}Vl(e){e!==this.je&&(this.je=e,this.Ul()&&Ye.$t(this.Hl,e))}Gl(){return this.je?this.je:this.Ul()?Ye.Dt(this.Hl):null}Zl(e){const t=this.Rl;return!ct(t)&&!ct(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({[Io]:[t,e,r]}))}Jl(){var e;const t=(e=this.Ir)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return Bs(t)&&t>0}Kl(){this.Jl()?this.Il.refreshKey(Io):(this.Il.flush(),this.Il.load())}Xl(){var e;if(ct(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({[Io]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Il.flush())}tu(){const[e]=this.Yl(),t=Bs(e)?e:0,r=Bs(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[Io];return we(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 lo.error("Bootstrap sessionID cannot be in the future"):i}catch(i){lo.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&&D&&(D.removeEventListener(id,this.Ol,{capture:!1}),this.Ol=void 0),this.Fl=[]}Wl(){this.Ol=()=>{this.Xl(),this.Ul()&&Ye.Lt(this.zl)},Fe(D,id,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(ct(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>gw),m=d?h:Bs(c)&&Math.abs(s-c)>gw;let f=!1,g=l,_=!a||!!d;const y=a;let E=!_&&!e&&this.Ll(s,u);if(E&&(E=this.eu(s),E||lo.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,c]=this.Yl(),E||(_=!a||!!d)),_||E||m){g=!1;const $=d&&!h;a=$?d.sessionId:this.ql(),p=this.jl(),lo.info("new session ID assigned",{sessionId:a,windowId:p,bootstrapped:!!$,changeReason:{noSessionId:_,activityTimeout:E,sessionPastMaximumLength:m}}),c=$?d.sessionStartTimestamp:s,this.Nl=void 0,f=!0}else p||(p=this.jl(),f=!0),g=g||a!==y,g&&(lo.info("adopted cross-tab session id",{sessionId:a,windowId:p}),f=!0);const P=Bs(u)&&e&&!m?u:s,I=Bs(c)?c:new Date().getTime();this.Vl(p),this.Ql(a,P,I),e||this.Bl();const M={noSessionId:_,activityTimeout:E,sessionPastMaximumLength:m,crossTabAdoption:g};return f&&this.Fl.forEach($=>$(a,p,M)),{sessionId:a,windowId:p,sessionStartTimestamp:I,changeReason:f?M: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))}},IP=function(e,t){if(!e)return!1;const r=e.userAgent;if(r&&b0(r,t))return!0;try{const s=e?.userAgentData;if(s?.brands&&s.brands.some(n=>b0(n?.brand,t)))return!0}catch{}return!!e.webdriver};function RP(){return(RP=et(function*(){const e=Pt?.userAgentData;if(e?.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),r=t?.model;return xe(r)&&r.length>0?r:void 0}catch(t){Q.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t);return}})).apply(this,arguments)}function UG(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 CP(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 dd=(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}},nu=e=>e.toLowerCase(),PP={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=>dd(r,s))),not_regex:(e,t)=>t.every(r=>e.every(s=>!dd(r,s))),icontains:(e,t)=>t.map(nu).some(r=>e.map(nu).some(s=>r.includes(s))),not_icontains:(e,t)=>t.map(nu).every(r=>e.map(nu).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 xP(e,t){return!e||Object.entries(e).every(([r,s])=>{const n=t?.[r];if(n==null)return!1;const i=PP[s.operator];return!!i&&i(s.values.map(String),[String(n)])})}function Vh(e,t,r){return Po({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:r})}var Gm="custom",_w="i.posthog.com",qG=/^\/static\//,zG=["/s/","/e/","/i/"],FG=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(`.${_w}`,".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":Gm),this.nu[this.apiHost]}su(e){if(!qG.test(e))return;const t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}ru(e){const t=an(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=an(r))===null||i===void 0?void 0:i.href)||r;s=n(new URL(o)).toString()}if(n&&e==="api"&&zG.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===Gm)return this.ou(e,t,this.apiHost+t);const r=_w+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}`)}}},je=ut("[Surveys]"),OP=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){je.error("Failed to persist survey seen state",t)}},jG=[qh.Popover,qh.Widget,qh.API],HG={ignoreConditions:!1,ignoreDelay:!1,displayType:Fm.Popover},BG=ut("[PostHog ExternalIntegrations]"),VG={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},GG=class{constructor(e){this._instance=e}Ho(e,t){var r,s;(r=ve.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this._instance,e,n=>{if(n)return BG.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=ve.__PosthogExtensions__)!==null&&t!==void 0&&(t=t.integrations)!==null&&t!==void 0&&t[n])&&this.Ho(VG[n],()=>{var o;(o=ve.__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=ve.__PosthogExtensions__)!==null&&r!==void 0&&(r=r.integrations)!==null&&r!==void 0&&r[n]&&((s=ve.__PosthogExtensions__)===null||s===void 0||(s=s.integrations)===null||s===void 0||(s=s[n])===null||s===void 0||s.stop())}}},KG=class{constructor(e,t){this.A=e,this.bo=t,this.lu=new Map,this.To=!1}add(e){var t=this;return et(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&&Rt(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)}}},WG=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)}},yw="extensionsRemoteConfig",JG=class{constructor(e){this.instance=e,this.To=!1,this.A=Q,this.hu=e.cu,this.kv=new WG(e),this.onEvent=t=>su(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 su(()=>{});const r=n=>{try{t(n)}catch(i){this.A.error("Browser extension remote config listener failed",i)}},s=this.instance.du.on(yw,r);return this.hu&&r(this.hu),su(s)},this.vu=new KG(Q.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(l_);return typeof e=="string"?e:void 0}get library(){return{name:St.LIB_NAME,version:St.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 su(this.instance.fu(e))}handleRemoteConfig(e){this.To||(this.hu=e,this.instance.du.emit(yw,e))}sendRequest(e){var t=this;return et(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?hl(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"?ym.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())}},Ec={},Gh=0,Tc=()=>{},bw='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',uo="Surveys module not available",ww="sanitize_properties is deprecated. Use before_send instead",MP="Invalid value for property_denylist config: ",YG=["$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"],XG=["$feature_flag_called","$$heatmap","$snapshot"],Sw=e=>e.charAt(0)==="$"&&!be(XG,e),QG=/^[A-Za-z0-9_-]{1,400}$/,kw=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Ew=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,ZG=["token","distinct_id",CC],uc="posthog",e8=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},Kh=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:Y4(W?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Tc,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:at&&xe(at?.search)&&at.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:(D==null||(t=D.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){Q.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:qC,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Tc},(r=>({rageclick:r&&r>="2026-05-30"?{content_ignorelist:nG,ignore_text_selection:!0}:!r||"2025-11-30">r||{content_ignorelist:!0},capture_pageview:!r||"2025-05-24">r||"history_change",session_recording:e8(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))},t8=[["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"]],Tw=e=>{const t={};for(const[n,i]of t8)j(e[n])||(t[i]=e[n]);const r=Ze({},t,e),s=e.__preview_external_dependency_versioned_paths;return j(s)||(j(e.strict_script_versioning)&&(r.strict_script_versioning=!!s),xe(s)&&j(e.asset_host)&&(r.asset_host=s)),we(e.property_blacklist)&&(j(e.property_denylist)?r.property_denylist=e.property_blacklist:we(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:Q.error(MP+e.property_denylist)),r},r8=class{constructor(){this.__forceAllowLocalhost=!1}get pu(){return this.__forceAllowLocalhost}set pu(e){Q.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Ac=class _n{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(ts());this.register({distinct_id:s,$device_id:s}),t.set_property(tr,Js)}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 r8,this.Tu=!1,this.version=St.LIB_VERSION,this.Iu=new Set,this.Mu="",this.du=new ud,this.lu=[],this.Eu=[],this.Pu=!1,this.wu=!1,this._u=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Kh(),this.SentryIntegration=pG,this.sentryIntegration=s=>(function(n,i){const o=ZC(n,i);return{name:QC,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 $G(this),this.pageViewManager=new iw(this),this.rateLimiter=new SG(this),this.requestRouter=new FG(this),this.consent=new sG(this),this.externalIntegrations=new GG(this);const r=(t=_n.__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=xe(s)?{[s]:n}:s;this.setPersonProperties(o),i?.({})},set_once:(s,n,i)=>{const o=xe(s)?{[s]:n}:s;this.setPersonProperties(void 0,o),i?.({})}},this.on("eventCaptured",s=>Q.info(`send "${s?.event}"`,s))}init(t,r,s){if(s&&s!==uc){var n;const i=(n=Ec[s])!==null&&n!==void 0?n:new _n;return i._init(t,r,s),Ec[s]=i,Ec[uc][s]=i,i}return this._init(t,r,s)}_init(t,r={},s){var n,i,o;const a=xe(t)?t.trim():"";if(!a)return Q.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=Kh(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=Kh(r.defaults),u=Tw(r),p=Ze({},l,u,{name:s,token:a});$e(l.rageclick)&&$e(u.rageclick)&&(p.rageclick=Ze({},l.rageclick,u.rageclick)),$e(l.session_recording)&&$e(u.session_recording)&&(p.session_recording=Ze({},l.session_recording,u.session_recording)),this.set_config(p),this.config.on_xhr_error&&Q.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:wr.GZipJS;const d=this.Su();if(this.persistence=new Uh(this.config,d),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Uh(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&&Ye.Et()){const _=Ye.Dt(this.Mu);we(_)&&_.forEach(y=>{xe(y)&&this.Iu.add(y)})}else Ye.Lt(this.Mu);const h=S({},this.persistence.props),m=S({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qu=new MG((_,y)=>this.ju(_,y),this.config.request_queue_config),this.Bu=new NG(this),this.__request_queue=[];const f=this.yu();f||(this.sessionManager=new vw(this),this.sessionPropsManager=new mw(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((_,y,E)=>{(E!=null&&E.activityTimeout||E!=null&&E.sessionPastMaximumLength||E!=null&&E.crossTabAdoption)&&this.Hu()})),this.zu(),this.config.__preview_deferred_init_extensions?(Q.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Uu(f)},0)):(Q.info("Initializing extensions synchronously"),this.Uu(f)),St.DEBUG=St.DEBUG||this.config.debug,St.DEBUG&&Q.info("Starting in debug mode",{this:this,config:r,thisC:S({},this.config),p:h,s:m}),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 g=(i=r.bootstrap)===null||i===void 0?void 0:i.distinctID;if(this.wu=!!g&&!mc(g),(o=r.bootstrap)===null||o===void 0?void 0:o.distinctID){const _=r.bootstrap.distinctID,y=this.get_distinct_id(),E=this.persistence.get_property(tr);if(r.bootstrap.isIdentifiedID&&y!=null&&y!==_&&E==="anonymous")this.identify(_);else if(r.bootstrap.isIdentifiedID&&y!=null&&y!==_&&E==="identified")Q.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 P=this.config.get_device_id(ts()),I=r.bootstrap.isIdentifiedID?P:_;this.persistence.set_property(tr,r.bootstrap.isIdentifiedID?Tu:Js),this.register({distinct_id:_,$device_id:I})}}if(f)this.register_once({distinct_id:Ph,$device_id:null},"");else if(!this.get_distinct_id()){const _=this.config.get_device_id(ts());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(tr,Js)}return Fe(D,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Fe(D,"pageshow",()=>{var _;this.Cu=!1,this.$u||(_=this.Bu)===null||_===void 0||_.resume()}),r.segment?nw(this,()=>this.Wu()):this.Wu(),Rt(this.config._onCapture)&&this.config._onCapture!==Tc&&(Q.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",_=>this.config._onCapture(_.event,_))),this.config.ip&&Q.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 RP.apply(this,arguments)})().then(_=>{_&&this.register({[Ch]:_})}).catch(Tc),this}Vu(t){const r=t;return xe(r.name)&&Rt(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=>{Q.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=_n.__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)),Rt(this.featureFlags.onReloading)&&Rt(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({},_n.__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,dG)),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 m;return(m=h.onRemoteConfig)===null||m===void 0?void 0:m.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){Q.error("Error initializing extension:",i)}}const s=Math.round(performance.now()-r);this.register_for_session({[PC]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[xC]:s}),this.config.__preview_deferred_init_extensions&&Q.info(`PostHog extensions initialized (${s}ms)`)}el(t){var r;if(!W||!W.body)return Q.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,wr.GZipJS)?wr.GZipJS:be(n.supportedCompression,wr.Base64)?wr.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:qC}),(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){Q.critical("`loaded` function failed",t)}if(this.Yu(),this.config.internal_or_test_user_hostname&&at?.hostname){const t=at.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 dP(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()&&Co(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(j0),(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(j0,null,{transport:"sendBeacon"})}_send_request(t){AP(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){Gh++;try{let r;const s=[],n=[],i=[];Co(t,a=>{if(a)if(r=a[0],we(r))i.push(a);else if(Rt(a))try{a.call(this)}catch(c){Q.error("Error executing queued PostHog call",a,c)}else we(a)&&r==="alias"?s.push(a):we(a)&&r.indexOf("capture")!==-1&&Rt(this[r])?i.push(a):n.push(a)});const o=function(a,c){Co(a,function(l){try{if(we(l[0])){let u=c;Ve(l,function(p){u=u[p[0]].apply(u,p.slice(1))})}else c[l[0]].apply(c,l.slice(1))}catch(u){Q.error("Error executing queued PostHog call",l,u)}})};o(s,this),o(n,this),o(i,this)}finally{Gh--}}push(t){if(Gh>0&&we(t)&&xe(t[0])){const r=_n.prototype[t[0]];Rt(r)&&r.apply(this,t.slice(1));return}this._execute_array([t])}get nh(){return{property:z0,persistenceKey:Uo,cookieName:"_fbc",pattern:kw,register:(t,r)=>{var s;return(s=this.persistence)===null||s===void 0?void 0:s.register({[Uo]:{value:t,delivered:r}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(Uo)}}}get sh(){return{property:F0,persistenceKey:vc,cookieName:"_fbp",pattern:Ew,register:(t,r)=>{var s;return(s=this.persistence)===null||s===void 0?void 0:s.register({[vc]:{value:t,delivered:r}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(vc)}}}rh(t){var r;const s=(r=this.persistence)===null||r===void 0?void 0:r.get_property(t.persistenceKey);return xe(s)&&t.pattern.test(s)?{value:s,delivered:!1}:$e(s)&&xe(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=bc(t.cookieName);return xe(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 xe(r)&&kw.test(r)?this.oh(i,r,o):void i.unregister();const a=xe(t)&&QG.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 xe(t)&&Ew.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 Q.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(j(t)||!xe(t))return void Q.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 Q.critical("This capture call is ignored due to client rate limiting.");let c;r!=null&&r.$current_url&&!xe(r?.$current_url)&&(Q.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||Q.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=E0(s?.uuid,ts);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 m=$e(r?.$set)?r.$set:void 0,f=we(r?.$unset)?r.$unset:[],g=s?.$unset||[],_=X=>{var me;const q=!!s?.$set&&X in s.$set;return{hasProvided:q||!!m&&X in m,provided:q?s==null||(me=s.$set)===null||me===void 0?void 0:me[X]:m?.[X],unset:f.indexOf(X)!==-1||g.indexOf(X)!==-1}},y=_(z0),E=_(F0),P=[{channel:this.nh,hasProvided:y.hasProvided,update:this.uh(c?.fbclid,y.provided,y.hasProvided,y.unset)},{channel:this.sh,hasProvided:E.hasProvided,update:this.hh(E.provided,E.hasProvided,E.unset)}];for(const{channel:X,hasProvided:me,update:q}of P)q&&d.properties.$process_person_profile===!0&&q.pending&&!me&&!h&&(d.$set=S({[X.property]:q.value},d.$set));const I=s?.$unset;I&&(d.$unset=I);const M=h?void 0:this.ph(s?.$set_once,t!==H0,t===zC);if(M&&(d.$set_once=M),s!=null&&s._noTruncate||($=this.config.properties_string_max_length,d=(function(X,me){const q=new Set;return(function ue(b,ee){if(b!==Object(b))return me?me(b):b;if(q.has(b))return;let ne;if(q.add(b),we(b))ne=[],Co(b,H=>{ne.push(ue(H))});else{const H={};Ve(wa(b)?FC(b):b,(R,te)=>{q.has(R)||(H[te]=ue(R,te))}),ne=H}return ne})(X)})(d,X=>xe(X)?X.slice(0,$):X)),d.timestamp=u,j(s?.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=l),h&&(d.properties=((X,me=[])=>{const q={},ue=b=>{X[b]!==void 0&&(q[b]=X[b])};return g4.forEach(ue),me.forEach(ue),q})(d.properties,ZG)),t===yr.DISMISSED||t===yr.SENT){const X=r?.[zh.SURVEY_ID],me=r?.[zh.SURVEY_ITERATION];OP({id:X,current_iteration:me}),d.$set=S(S({},d.$set),{},{[UG({id:X,current_iteration:me},t===yr.SENT?"responded":"dismissed")]:!0})}else t===yr.SHOWN&&(d.$set=S(S({},d.$set),{},{[zh.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var $;if(t===wG.SHOWN){const X=r?.[cw.TOUR_TYPE];X&&(d.$set=S(S({},d.$set),{},{[`${cw.TOUR_LAST_SEEN_DATE}/${X}`]:new Date().toISOString()}))}const O=S(S({},d.properties.$set),d.$set);if(pr(O)||this.setPersonPropertiesForFlags(O),!Te(this.config.before_send)){const X=this.Os(d);if(!X)return;d=X,d.uuid=E0(d.uuid,ts)}this.sessionRecording&&!this.Pu&&Sw(t)&&(this.Pu=!0,setTimeout(()=>this.Pu=!1,3e4));const B=P.filter(({channel:X,update:me})=>{var q,ue,b;const ee=(q=(ue=d.$set)===null||ue===void 0?void 0:ue[X.property])!==null&&q!==void 0?q:$e((b=d.properties)===null||b===void 0?void 0:b.$set)?d.properties.$set[X.property]:void 0;return me?.pending&&ee===me.value});this.du.emit("eventCaptured",d);const le=(n=s?._url)!==null&&n!==void 0?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),ie=s?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(le),C=S(S(S({method:"POST",url:le,data:d,compression:"best-available",preferSyncCompression:s?.send_instantly,timestampMode:ie?"body":"capture-body",batchKey:s?._batchKey},ie&&(!((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}:{}),B.length?{fireCallbackOnDrop:!0,callback:X=>{if(X.statusCode>=200&&300>X.statusCode)for(const{channel:me,update:q}of B)this.dh(me,q.value)}}:{});if(!this.config.request_batching||s&&!s?._batchKey||s?.send_instantly||B.length){var fe;let X;!C.transport&&!C.callback&&pr((fe=this.config.request_headers)!==null&&fe!==void 0?fe:{})&&this.Cu&&(X="sendBeacon"),this.ju(C,X)}else this.qu.enqueue(C);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 JG(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[CC]=!0),t==="$snapshot"){const y=S(S({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=y.distinct_id,(!xe(a.distinct_id)&&!ht(a.distinct_id)||mc(a.distinct_id))&&Q.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}const c=(function(y,E,P,I=!1){var M,$,O,B;if(!Zt)return{};const le=y?[...ra,...E||[]]:[],[ie,C]=JR(Zt),[fe,X]=(function(ae){for(let he=0;k0.length>he;he++){const[de,Ke,Ge]=k0[he],Pe=ae.match(de);if(Pe){const V=Ge&&ae.match(Ge)||Pe;return[Ke,V?.[1]||""]}}return["",""]})(Zt),me=(function(){const ae="u">typeof navigator?navigator:void 0;return ae?.brave?{brave:!0}:{}})(),q={};j(P)||(q.detectGoogleSearchApp=P);const ue={},b=(M=navigator)===null||M===void 0||(M=M.userAgentData)===null||M===void 0?void 0:M.platform,ee=($=navigator)===null||$===void 0?void 0:$.maxTouchPoints,ne=D==null||(O=D.screen)===null||O===void 0?void 0:O.width,H=D==null||(B=D.screen)===null||B===void 0?void 0:B.height,R=D?.devicePixelRatio;j(b)||(ue.userAgentDataPlatform=b),j(ee)||(ue.maxTouchPoints=ee),j(ne)||(ue.screenWidth=ne),j(H)||(ue.screenHeight=H),j(R)||(ue.devicePixelRatio=R);const te=Ze(v_({$os:ie,$os_version:C,$browser:WR(Zt,navigator.vendor,me,q),$webview_app:fe,$webview_app_version:X,$device:YR(Zt),$device_type:U3(Zt,ue),$timezone:lP(),$timezone_offset:_G()}),{$current_url:Bc(I?Wn(at?.href):at?.href,le,Vc),$host:at?.host,$pathname:at?.pathname,$raw_user_agent:Zt.length>1e3?Zt.substring(0,997)+"...":Zt,$browser_version:D3(Zt,navigator.vendor,me,q),$browser_language:iP(),$browser_language_prefix:vG(),$screen_height:D?.screen.height,$screen_width:D?.screen.width,$viewport_height:D?.innerHeight,$viewport_width:D?.innerWidth,$lib:Xs.LIB_NAME,$lib_version:Xs.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Xs.SDK_DIST_CHANNEL&&(te.$sdk_dist_channel=Xs.SDK_DIST_CHANNEL),te})(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:y,windowId:E}=this.sessionManager.checkAndGetSessionAndWindowId(i,s.getTime(),!0);a.$session_id=y,a.$window_id=E}this.sessionPropsManager&&Ze(a,this.sessionPropsManager.getSessionProps());try{var l;if(this.sessionRecording){const y=this.sessionRecording.sdkDebugProperties,E=!this.Pu&&Sw(t);for(const P in y)(E||be(YG,P))&&(a[P]=y[P])}a.$sdk_debug_retry_queue_size=(l=this.Bu)===null||l===void 0?void 0:l.length}catch(y){a.$sdk_debug_error_capturing_properties=String(y)}let u;if(this.requestRouter.region===Gm&&(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=Ze(a,u),t==="$pageview"&&W&&(a.title=W.title),!j(o)){const y=s.getTime()-o;a.$duration=parseFloat((y/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,m=p.$groups;$e(h)&&!pr(h)&&(a.$groups=S(S({},$e(m)?m:{}),h)),Ve(["$referrer","$referring_domain"],y=>{y in p&&delete d[y]});const f={};if(this.Eu.length>0)for(const y of this.Eu.slice())try{Ze(f,y())}catch(E){Q.error("Failed to produce browser extension event properties",E)}a=Ze({},c,p,d,S(S({},f),a)),a.$is_identified=this._isIdentified(),we(this.config.property_denylist)?Ve(this.config.property_denylist,function(y){delete a[y]}):Q.error(MP+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const g=this.config.sanitize_properties;g&&(Q.error(ww),a=g(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=Ze({},i,o||{},t||{});const c=this.config.sanitize_properties;return c&&(Q.error(ww),a=c(a,"$set_once")),r&&(this.Tu=!0),pr(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||!Ye.Et())return void Ye.Lt(this.Mu);const r=[];this.Iu.forEach(s=>r.push(s)),r.length>0?Ye.$t(this.Mu,r):Ye.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:uo}),()=>{})}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:uo})}getActiveMatchingSurveys(t,r=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,r):t([],{isLoaded:!1,error:uo})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:uo}),()=>{})}renderSurvey(t,r){var s;(s=this.surveys)===null||s===void 0||s.renderSurvey(t,r)}displaySurvey(t,r=HG){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:uo}}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:uo})}wh(t){return!t||mc(t)?(Q.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?(Q.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())||(Q.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 Q.uninitializedWarning("posthog.identify");if(ht(t)&&(t=t.toString(),Q.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(sd),this.register({distinct_id:t}));const p=(this.persistence.get_property("$user_state")||"anonymous")===Js,d=t!==u,h=!d&&p;if(d&&p){var l;const m=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:u};this.persistence.set_property(tr,Tu),this.setPersonPropertiesForFlags({$set:r||{},$set_once:s||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$identify",m,{$set:r||{},$set_once:s||{}})&&(this.Ou=Vh(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(tr,Tu);const m=r||{},f=s||{};this.setPersonPropertiesForFlags({$set:m,$set_once:f},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$set",{$set:m,$set_once:f})&&(this.Ou=Vh(t,r,s))}else(r||s)&&this.setPersonProperties(r,s);d||i||o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(On)):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=Vh(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)):Q.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var r;const s=(we(t)?t:[t]).filter(n=>xe(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 Q.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(H0,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=rr(t)?t:t?.resetDeviceID,s=rr(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(Q.info("reset"),!this.__loaded)return Q.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(l_),d=this.get_property(Ch),h=this.get_property(_c);(a=this.sessionRecording)===null||a===void 0||a.flushBeforeIdentityReset();const m=this.is_capturing();this.consent.reset(),r||!m||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 f=(c=this.persistence)===null||c===void 0||(l=c.Oa)===null||l===void 0?void 0:l.call(c);let g=!1;try{var _,y,E,P,I,M,$,O,B,le,ie,C,fe;if((_=this.persistence)===null||_===void 0||_.clear(),(y=this.sessionPersistence)===null||y===void 0||y.clear(),this.Iu.clear(),this.mh(),j(h)||(le=this.persistence)===null||le===void 0||le.register({$session_recording_remote_config:h}),(E=this.surveys)===null||E===void 0||E.reset(),(P=this.featureFlags)===null||P===void 0||P.reset(),(I=this.conversations)===null||I===void 0||I.reset(),(M=this.logs)===null||M===void 0||M.reset(),($=this.metrics)===null||$===void 0||$.reset(),(O=this.persistence)===null||O===void 0||O.set_property("$user_state","anonymous"),(B=this.sessionManager)===null||B===void 0||B.resetSessionId(),this.Ou=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Ph,$device_id:null},"");else{const q=this.config.get_device_id(ts());this.register_once({distinct_id:q,$device_id:t?q:p},""),t||j(d)||this.register({[Ch]: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})),(ie=this.featureFlags)===null||ie===void 0||ie.initialize(),!Te(u)&&!(!((C=this.sessionManager)===null||C===void 0)&&C.setBootstrapSessionId(u,!0)))){const q=S({},s);delete q.sessionID,this.config.bootstrap=q}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,g=!0}finally{var X,me;f&&((X=this.persistence)===null||X===void 0||(me=X.qa)===null||me===void 0||me.call(X,g))}this.reloadFeatureFlags()}shutdown(t){var r=this;return et(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){Q.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 Q.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")?(Q.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(sd,t),this.capture("$create_alias",{alias:t,distinct_id:r})):(Q.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const r=S({},this.config);if($e(t)){var s,n,i,o,a,c,l,u,p,d,h,m,f,g;Ze(this.config,Tw(t));const y=this.Su();(s=this.persistence)===null||s===void 0||s.update_config(this.config,r,y),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Uh(S(S({},this.config),{},{persistence:"sessionStorage"}),y,!1);const E=this.Du(this.config.debug);var _;rr(E)&&(this.config.debug=E),rr(this.config.debug)&&(this.config.debug?(St.DEBUG=!0,qe.Et()&&qe.$t("ph_debug",!0),Q.info("set_config",{config:t,oldConfig:r,newConfig:S({},this.config)})):(St.DEBUG=!1,qe.Et()&&qe.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(),(m=this.deadClicksAutocapture)===null||m===void 0||m.startIfEnabledOrStop(),(f=this.surveys)===null||f===void 0||f.loadIfEnabled(),this.xu(),(g=this.externalIntegrations)===null||g===void 0||g.startIfEnabledOrStop(),!r.segment&&this.config.segment&&this.persistence&&nw(this,Tc,!1)}}_overrideSDKInfo(t,r){St.LIB_NAME=t,St.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:_n.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:uc;return r!==uc&&(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()&&pr(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"?(Q.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.bu(),this._h(p_,!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 vw(this),this.pageViewManager=new iw(this),this.persistence&&(this.sessionPropsManager=new mw(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=_n.__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 Q.warn(bw)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void Q.warn(bw);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:Ph,$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 Pt?IP(Pt,this.config.custom_blocked_useragents):void 0}th(){W&&(W.visibilityState==="visible"?this.Ru||(this.Ru=!0,this.capture(g_,{title:W.title},{send_instantly:!0}),this.Au&&(W.removeEventListener(Fc,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),Fe(W,Fc,this.Au)))}debug(t){t===!1?(D?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(D?.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?(Q.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,Q)}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(A3),n=we(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 T3(t.event)?Q.warn(`${a}. This can cause unexpected behavior.`):Q.info(a),null}i.properties&&!pr(i.properties)||Q.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return Q.error(`Error in beforeSend function for event '${t.event}':`,a),null}for(const o of s)if(i.properties&&Te(i.properties[o]))return Q.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=rr(t)&&!t,s=qe.Et()&&qe.Ot("ph_debug")==="true";return!r&&(!!s||t)}};Ac.__defaultExtensionClasses={},Ac.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]]=W4(e.prototype[t[r]])})(Ac,["identify"]);var LP=class{constructor(e){this.disabled=e===!1;const t=$e(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}},Wh="$copy_autocapture",Jh=ut("[AutoCapture]");function Yh(e,t){return t.length>e?t.slice(0,e)+"...":t}function s8(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!Os(t));return t}function n8(e,{e:t,maskAllElementAttributes:r,maskAllText:s,elementAttributeIgnoreList:n,elementsChainAsString:i,disableCaptureUrlHashes:o}){var a,c;if(!Os(e))return{props:{}};const l=[e],u=new Set([e]);let p=e;for(;p.parentNode&&!jt(p,"body")&&1e3>l.length;){if(__(p.parentNode)){const M=p.parentNode.host;if(u.has(M))break;u.add(M),l.push(M),p=M;continue}if(!Os(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(M=>jt(M,"button")||jt(M,"a")):-1;d>0&&(s=s||l.slice(0,d+1).some(M=>!qo(M)||Hc(M)));const h=[],m={};let f,g=!1,_=!1;if(Ve(l,M=>{const $=qo(M);if(jt(M,"a")&&!r&&!n?.includes("href")){const O=M.getAttribute("href");g=!!($&&O&&Sc(O))&&(o?Wn(O):O)}be(ea(M),"ph-no-capture")&&(_=!0),h.push((function(O,B,le,ie,C=!1){const fe=O.tagName.toLowerCase(),X={tag_name:fe};b_.indexOf(fe)>-1&&!le&&(X.$el_text=fe.toLowerCase()==="a"||fe.toLowerCase()==="button"?Yh(1024,tw(O)):Yh(1024,jc(O)));const me=ea(O);B||ie!=null&&ie.includes("class")||0>=me.length||(X.classes=me.filter(function(ee){return ee!==""})),Ve(O.attributes,function(ee){var ne;if((!Hc(O)||["name","id","class","aria-label"].indexOf(ee.name)!==-1)&&!ie?.includes(ee.name)&&!B&&Sc(ee.value)&&(!xe(ne=ee.name)||ne.substring(0,10)!=="_ngcontent"&&ne.substring(0,7)!=="_nghost")){let H=ee.value;ee.name==="class"&&(H=y_(H).join(" ")),X["attr__"+ee.name]=Yh(1024,ee.name==="href"&&C?Wn(H):H)}});let q=1,ue=1,b=O;for(;b=s8(b);)q++,b.tagName===O.tagName&&ue++;return X.nth_child=q,X.nth_of_type=ue,X})(M,r,s,n,o)),Ve((function(O){if(!qo(O))return{};const B={};return Ve(O.attributes,function(le){if(le.name&&le.name.indexOf("data-ph-capture-attribute")===0){const ie=le.name.replace("data-ph-capture-attribute-",""),C=le.value;ie&&C&&Sc(C)&&(B[ie]=C)}}),B})(M),(O,B)=>{({}).hasOwnProperty.call(m,B)||(m[B]=O)})}),_)return{props:{},explicitNoCapture:_};if(d>0&&(e=l[d],h.splice(0,d)),s||(h[0].$el_text=jt(e,"a")||jt(e,"button")?tw(e):jc(e)),g){var y,E;h[0].attr__href=g;const M=(y=an(g))===null||y===void 0?void 0:y.host,$=D==null||(E=D.location)===null||E===void 0?void 0:E.host;M&&$&&M!==$&&(f=g)}return{props:Ze((I=t.type,{$event_type:I,$ce_version:1}),i?{}:{$elements:h},{$elements_chain:(P=h,we(P)?(function(M){return M.map($=>{var O,B;let le="";if($.tag_name&&(le+=$.tag_name),$.attr_class){$.attr_class.sort();for(const fe of $.attr_class)le+=`.${fe.replace(/"/g,"")}`}const ie=S(S(S(S({},$.text?{text:$.text}:{}),{},{"nth-child":(O=$.nth_child)!==null&&O!==void 0?O:0,"nth-of-type":(B=$.nth_of_type)!==null&&B!==void 0?B:0},$.href?{href:$.href}:{}),$.attr_id?{attr_id:$.attr_id}:{}),$.attributes),C={};return Au(ie).sort(([fe],[X])=>(function(me,q){return q>me?-1:me>q?1:0})(fe,X)).forEach(([fe,X])=>C[rw(fe.toString())]=rw(X.toString())),le+=":",le+=Au(C).map(([fe,X])=>`${fe}="${X}"`).join(""),le}).join(";")})((function(M){return M.map($=>{var O,B;const le={text:(O=$.$el_text)===null||O===void 0?void 0:O.slice(0,400),tag_name:$.tag_name,href:(B=$.attr__href)===null||B===void 0?void 0:B.slice(0,2048),attr_class:lG($),attr_id:$.attr__id,nth_child:$.nth_child,nth_of_type:$.nth_of_type,attributes:{}};return Au($).filter(([ie])=>ie.indexOf("attr__")===0).forEach(([ie,C])=>le.attributes[ie]=C),le})})(P)):"")},!((a=h[0])===null||a===void 0)&&a.$el_text?{$el_text:(c=h[0])===null||c===void 0?void 0:c.$el_text}:{},f&&t.type==="click"?{$external_click_url:f}:{},m),target:e};var P,I}var i8=class{do(){this.vo=void 0,clearTimeout(this.fo),this.fo=void 0}po(e){var t;if(!qo(e))return!0;const r=(t=this.mo().css_selector_ignorelist)!==null&&t!==void 0?t:$h,s=new Set;let n=e;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);const i=n,o=ea(i);if(be(o,"ph-no-capture")||be(o,"ph-sensitive")||Hc(i)||r.some(c=>qm(i,c)))return!0;const a=n.parentNode;n=__(a)?a.host:a&&Os(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=wc(e);var t;e.isPrimary&&e.button===0&&!e.ctrlKey&&s&&Os(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=wc(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&&(jt(s,"html")||jt(s,"body"))){var n;if(r.excluded)return null;const i=(n=this.mo().css_selector_ignorelist)!==null&&n!==void 0?n:$h;return[s,W?.documentElement,W?.body].some(o=>{if(!o)return!1;const a=ea(o);return be(a,"ph-no-capture")||be(a,"ph-sensitive")||!qo(o)||Hc(o)||i.some(c=>qm(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 LP(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 Jh.info("Disabling Automatic Event Collection because this browser is not supported");if(!D||!W)return;const e=this.Ao=t=>{t=t||D?.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(ct(r))return;this.Fo(t,"$autocapture",r)}catch(r){Jh.error("Failed to capture event",r)}};if(Fe(D,"blur",e),Fe(W,"submit",e,{capture:!0}),Fe(W,"change",e,{capture:!0}),Fe(W,"click",e,{capture:!0}),Ve(["pointerdown","pointermove","pointerup","pointercancel"],t=>{Fe(W,t,e,{capture:!0})}),this.mo().capture_copied_text){const t=this.Oo=r=>{r=r||D?.event;try{this.Fo(r,Wh)}catch(s){Jh.error("Failed to capture clipboard event",s)}};Fe(W,"copy",t,{capture:!0}),Fe(W,"cut",t,{capture:!0}),Fe(W,"paste",t,{capture:!0})}}Po(){this.do(),this.Ao&&(D?.removeEventListener("blur",this.Ao),Ve(["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;rr(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(_C),s=this.So,n=this.mo();if(!n.remoteRequestsDisabled&&!this.xo)return!1;const i=n.remoteRequestsDisabled&&!this.xo;if(ct(s)&&!rr(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||wc(e);VC(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())&&JC(s,n.rageclick)&&this.Fo(e,"$rageclick",r);const o=t===Wh,a=o?S(S({},n),{},{dom_event_allowlist:void 0}):n;if(s&&(function(p,d,h,m,f,g){var _;if(!D||w_(p)||h?.url_allowlist&&!W0(h.url_allowlist,g)||h?.url_ignorelist&&W0(h.url_ignorelist,g))return!1;if(h?.dom_event_allowlist){const I=h.dom_event_allowlist;if(I&&!I.some(M=>d.type===M))return!1}const{parentIsUsefulElement:y,targetElementList:E}=YC(p,m);if(!(function(I,M){const $=M?.element_allowlist;if(j($))return!0;for(const O of I)if($.some(B=>O.tagName.toLowerCase()===B))return!0;return!1})(E,h)||!zm(E,h?.css_selector_allowlist)||zm(E,(_=h?.css_selector_ignorelist)!==null&&_!==void 0?_:$h))return!1;try{const I=D.getComputedStyle(p);if(I&&I.getPropertyValue("cursor")==="pointer"&&d.type==="click")return!0}catch{}const P=p.tagName.toLowerCase();switch(P){case"html":return!1;case"form":return(f||["submit"]).indexOf(d.type)>=0;case"input":case"select":case"textarea":return(f||["change","click"]).indexOf(d.type)>=0;default:return y?(f||["click"]).indexOf(d.type)>=0:(f||["click"]).indexOf(d.type)>=0&&(b_.indexOf(P)>-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}=n8(s,{e,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.$o,disableCaptureUrlHashes:n.disableCaptureUrlHashes});if(d)return!1;const m=this.getElementSelectors(s,h);if(m&&m.length>0&&(p.$element_selectors=m),t===Wh){const f=e.type||"clipboard";if(f!=="paste"){var l,u;const g=D==null||(l=D.getSelection())===null||l===void 0?void 0:l.toString(),_=GC(g);if(!_)return!1;p.$selected_content=_,p.$clipboard_text_length=(u=g?.length)!==null&&u!==void 0?u:0}p.$copy_type=f}return(c=this.bo)===null||c===void 0||c.capture(t,p),!0}}isBrowserSupported(){return Rt(W?.querySelectorAll)}},o8=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,r=$e(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}},Xa=ut("[ExceptionAutocapture]"),Aw=()=>{},Iw=e=>{var t;if(Rt(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function Gc(e,t,r){try{if(!(t in e))return Aw;const s={next:e[t]},n=r(function(...i){return s.next.apply(this,i)});return Rt(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=Iw(i);for(;o;){if(o.next===n)return void(o.next=s.next);i=o.next,o=Iw(i)}}}catch{return Aw}}var a8=ut("[TracingHeaders]"),ii=ut("[Web Vitals]"),Rw=9e5,Cw=["CLS","FCP","INP","LCP"],c8=["INP","LCP"],l8=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Xh="disabled",Pw="lazy_loading",zs=ut("[SessionRecording]"),u8=[h_,f_,OC,MC,LC,NC,$C,DC,UC],d8=ut("[Heatmaps]");function Qh(e){return $e(e)&&"clientX"in e&&"clientY"in e&&ht(e.clientX)&&ht(e.clientY)}var iu=ut("[Product Tours]"),Zh=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(d_))},p8=["$set_once","$set"],hs=ut("[SiteApps]"),xw="Error while initializing PostHog app with config id ",NP=(e,t)=>e?.then?e.then(t):t(e),po="SDK is not enabled or survey functionality is not yet loaded",Ow="Disabled. Not loading surveys.",h8=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."}),je.warn("Remote config unavailable. Not loading surveys.");const s=r.config.surveys;if(Te(s))return je.warn("Flags not loaded yet. Not loading surveys.");this.Dh=rr(s)?s:s.length>0,je.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,NP(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 je.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void je.info(Ow);if(e.cookielessMode&&this.wo.isOptedOut())return void je.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(m_),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(cc);n&&this.Hh(n),je.info("Surveys loaded successfully"),this.zh(),this.Oh(),this.Uh({isLoaded:!0})}jh(e,t){this.Mh=!0,je.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 je.info(Ow),e([]);const n=s.kv.get(cc);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=>je.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 je.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=>je.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(po)}))}Gh(e,t){if(this.To)return{surveys:[],context:{isLoaded:!1,error:po}};const r=t.statusCode;if(r!==200||!t.json){const n=`Surveys API could not be loaded, status: ${r}`;return r!==0?je.error(n):t.error||je.warn(n),this.Ah=Date.now(),{surveys:[],context:{isLoaded:!1,error:n}}}this.Ah=null;const s=t.json.surveys||[];return e.kv.set({[cc]:s,[nd]: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)&&(CP(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(nd);return ht(r)&&Date.now()-r>3e5}Qh(){return ht(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};OP(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){je.error("Error in survey callback",r)}}getActiveMatchingSurveys(e,t=!1){if(!Te(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);je.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(cc);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){je.error("Error in active matching surveys callback",i)}};try{t&&!t.isLoaded?s([]):this.getActiveMatchingSurveys(s)}catch(n){je.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:po};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:po};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 je.warn("init was not called"),{visible:!1,disabledReason:po};const t=this.Xh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Te(this._surveyManager)?(je.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:po})):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 je.warn("init was not called");const n=typeof e=="string"?this.Jh(e):e;if(!n?.id)return void je.warn("Survey not found");if(!jG.includes(n.type))return void je.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){je.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()&&(je.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),je.info(`Survey ${n.id} rendered`))},1e3*n.appearance.surveyPopupDelaySeconds);this.Fh.add(o);return}this._surveyManager.renderSurvey(n,i,r)}else je.warn("Survey element not found")}displaySurvey(e,t){var r;if(!this.wo.isCapturing())return;if(Te(this._surveyManager))return void je.warn("init was not called");const s=this.Jh(e);if(!s)return void je.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!==Fm.Popover&&t.initialResponses&&je.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 je.warn("Survey is not eligible to be displayed: ",i.reason)}t.displayType!==Fm.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}cancelPendingSurvey(e){Te(this._surveyManager)?je.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 ho(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 f8=class{constructor(e){this._instance=e,this.Yh=new Set,this.tc=new Set,this.ec=new ud,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 ud}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"||!ho(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=>ho(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&&ho((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=>ho(c.text,t.text,t.text_matching||"exact")||ho(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=>ho(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||xP(t.properties.reduce((r,s)=>{const n=we(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)}},m8=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&&xP(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===Wa.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 f8(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,Wa.Activation),a=this.Ic(e,Wa.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,Wa.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,Wa.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&&(pr(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 ht(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=>ht(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}},g8=class extends m8{constructor(e,t){super(e,t)}Xc(){return EC}Yc(){return TC}xc(){return AC}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 ht(s)&&s>0}rd(){return yr.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 je}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===yr.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 CP(i)&&!!(!((o=i.conditions)===null||o===void 0||(o=o.events)===null||o===void 0)&&o.repeatedActivation)||i.schedule==="always"})(n)?e===yr.SHOWN?"consume":"ignore":e===yr.SHOWN?"persist":e===yr.DISMISSED||e===yr.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},v8=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)}},_8=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=ve?.__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 g8(this._instance,e)}onMatchingConditionsChanged(e){const t=this._instance._addCaptureHook(i=>{i!=="$pageview"&&i!==yr.SHOWN&&i!==yr.DISMISSED&&i!==yr.SENT||e()}),r=()=>e();Fe(D,"PHSurveyShown",r);let s=!1;const n=this._instance.onFeatureFlags(()=>{s&&e()});return s=!0,()=>{s=!1,t(),n(),D?.removeEventListener("PHSurveyShown",r)}}},y8=D?.location?ad(D.location.hash,"__posthog")||ad(location.hash,"state"):null,Mw="_postHogToolbarParams",Lw=ut("[Toolbar]"),Nw=ut("[FeatureFlags]"),b8=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:we(r.flag_keys)?r.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.od||(Nw.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)||we(e.flag_keys)||Nw.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.ad}},$w=ut("[FeatureFlags]"),oi=ut("[FeatureFlags]",{debugEnabled:!0}),ef=`" failed. Feature flags didn't load in time.`,w8=[502,504],Dw=["click","keydown","wheel","touchstart","pointerdown"],Uw="connection_error",qw=e=>{const t={};for(let r=0;e.length>r;r++)t[e[r]]=!0;return t},zw=e=>{const t={};for(const[r,s]of Au(e||{}))s&&(t[r]=s);return t},Fw=e=>wa(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),Kr=ut("[Error tracking]"),Km="webkit-masked-url:",S8=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],k8=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Km],E8=["__firefox__","__gCrWeb"],jw="Refusing to render web experiment since the viewer is a likely bot",T8={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>dd(t,e),not_regex:(e,t)=>!dd(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},Rr=ut("[Conversations]"),ai="Conversations not available yet.";function Hw(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 m="",f="";try{const g=Pt?.userAgent;g&&([m,f]=JR(g))}catch{}return(function(g,_){const y=(function(E){if(E)return{}.hasOwnProperty.call($0,E)?$0[E]:E})(g);return S(S({},y?{"os.name":y}:{}),_?{"os.version":_}:{})})(m,f)})()),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 A8=["debug","log","warn","error","info"],I8=e=>{for(;e?.__rrweb_original__;)e=e.__rrweb_original__;return e},Bw="console",$P="__posthogHandledLogsRequestError",tf=(e,t)=>{const r=e instanceof Error?e:new Error(t);return r[$P]=!0,r},Vw=e=>!!e&&typeof e=="object"&&e[$P]===!0,pd=ut("[NetworkMetrics]"),E_=()=>{var e;return!(D==null||(e=D.performance)===null||e===void 0)&&e.now?D.performance.now():Date.now()},R8={"http:":80,"https:":443},C8=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),DP=(e,t)=>{var r;const s=String(t);return{method:String(e).toUpperCase(),url:((r=an(s))===null||r===void 0?void 0:r.href)||s}},Wm=(e,t,r,s,n,i,o=!1)=>{try{var a,c;const l=n();if(!l)return;const u=r||void 0,p=E_()-s,d=an(t.url);if(d&&d.protocol!=="http:"&&d.protocol!=="https:")return;const h={url:d?.href||t.url,method:t.method},m=Rt(l.name)?l.name(h):xe(l.name)?l.name:"http.client.request.duration";if(!m)return;const f=o&&!u?void 0:((_,y)=>_?400>_?void 0:String(_):y?.name||"_OTHER")(u,i),g=S(S(S(S(S({},(_=>{const y=C8.has(_)?_:"_OTHER";return S({"http.request.method":y},y==="_OTHER"&&_!==y?{"http.request.method_original":_}:{})})(h.method)),d?(_=>{return{"server.address":_.hostname.startsWith("[")&&_.hostname.endsWith("]")?_.hostname.slice(1,-1):_.hostname,"server.port":Number(_.port)||R8[_.protocol],"url.scheme":_.protocol.slice(0,-1),"url.template":(y=_.pathname,y.split("/").map(E=>(P=>/^\d+$/.test(P)||P.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(P))(E)?":id":E).join("/"))};var y})(d):{}),u?{"http.response.status_code":u}:{}),f?{"error.type":f}:{}),(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(m,p,{unit:"ms",attributes:g})}catch(l){pd.error("Failed to record network metric",l)}},UP=()=>{},P8=(e,t)=>Rt(D?.fetch)?Gc(D,"fetch",r=>function(...s){const n=E_(),i=r.apply(this,s);if(!t())return i;try{var o,a,c;const[l,u]=s,p=DP((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=>(Wm(e,p,d?.status,n,t,void 0,!0),d),d=>{throw Wm(e,p,void 0,n,t,d),d})}catch(l){return pd.error("Failed to observe fetch",l),i}}):UP,x8=(e,t)=>{var r;const s=D==null||(r=D.XMLHttpRequest)===null||r===void 0?void 0:r.prototype;if(!s)return UP;const n=new WeakMap,i=Gc(s,"open",a=>function(...c){try{gP.has(this)||n.set(this,DP(c[0],c[1]))}catch(l){pd.error("Failed to observe XHR open",l)}return a.apply(this,c)}),o=Gc(s,"send",a=>function(...c){let l;try{const u=n.get(this);if(u&&t()){const p=E_();l=()=>{this.removeEventListener("loadend",l),Wm(e,u,this.status,p,t)},Fe(this,"loadend",l)}}catch(u){pd.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()}},Ep={featureFlags:class{constructor(e){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=$w,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 b8(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]"),NP(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 D&&Fe(D,"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&&(Fe(W,Fc,this.sn),Co(Dw,r=>{Fe(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),Co(Dw,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=[],D?.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&&!we(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,m=!!h||l,f=!!h||d,g={[Ws]:m,[es]:m,[Cn]:f};e.$feature_flag_details&&(g[Ci]=m);for(const _ of[Pi,Fn,yc])j(e[_])||(g[_]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(g)}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[Ws,Cn,Pi,gs]){const n=this.zd(s);j(n)||(e[s]=n)}this.ud=e;const t=S({},e),r=this.zd(es);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(Fn);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:x0(p),variant:O0(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(Ci),t=this.zd(gs),r=this.zd(hi);if(!r&&!t)return e||{};const s=Ze({},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:x0(s),variant:O0(s),payload:P0(t[r])}})}getFlagVariants(){const e=this.zd(es),t=this.zd(gs);if(!t)return e||{};const r=Ze({},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(Cn),t=this.zd(hi);if(!t)return e||{};const r=Ze({},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(On)}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(xn),timezone:lP()};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=m=>{var f,g;const _=(f=m.json)!==null&&f!==void 0?f:{},y=m.statusCode!==200;if(this.fd=!1,a!==this.pd)return void c();if(this.tv(m.statusCode),y||this.md||(this.$anon_distinct_id=void 0),r.disable_flags&&!this.md)return;this.yd=!y;const E=[];m.error?E.push(m.error instanceof Error&&m.error.name==="AbortError"?"timeout":m.error instanceof Error?Uw:"unknown_error"):m.statusCode!==200&&E.push(`api_error_${m.statusCode}`),_.errorsWhileComputingFlags&&E.push("errors_while_computing_flags");const P=!!(!((g=_.quotaLimited)===null||g===void 0)&&g.includes("feature_flags"));P&&E.push("quota_limited"),this.$t({[zc]:E}),P?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(_,y,{partialResponse:i}),c()},u=m=>{this.fd=!1,a===this.pd&&(this.$t({[zc]:[Uw]}),this.A.error("Feature flag request failed",m),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(m=>{if((f=>w8.includes(f.statusCode)||(g=>g.statusCode===0&&g.error instanceof Error&&g.error.name==="AbortError")(f))(m)&&d())return p--,void setTimeout(h,500);l(m)}).catch(u)}catch(m){u(m)}};h()}kd(){return eP(this._d,3)}tv(e){this._d=tP(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+ef);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+ef);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 B=(p=this.bo)===null||p===void 0?void 0:p.session.sessionId,le=this.zd(lc);B&&B!==le&&(u={},l=B)}if(t.send_event||!("send_event"in t))if(e in u&&u[e].includes(o))l&&this.$t({[On]:u,[lc]:l});else{var d,h,m,f,g,_,y,E,P,I,M,$;we(u[e])?u[e].push(o):u[e]=[o],this.$t(S({[On]:u},l?{[lc]:l}:{}));const B=this.getFeatureFlagDetails(e),le=[...(d=this.zd("$feature_flag_errors"))!==null&&d!==void 0?d:[]];j(n)&&le.push("flag_missing");const ie={$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=(m=this.Ir.bootstrap)===null||m===void 0||(m=m.featureFlags)===null||m===void 0?void 0:m[e])!==null&&h!==void 0?h:null,$feature_flag_bootstrapped_payload:(f=(g=this.Ir.bootstrap)===null||g===void 0||(g=g.featureFlagPayloads)===null||g===void 0?void 0:g[e])!==null&&f!==void 0?f:null,$used_bootstrap_value:!this.yd};j(B==null||(_=B.metadata)===null||_===void 0?void 0:_.has_experiment)||(ie.$feature_flag_has_experiment=B.metadata.has_experiment),j(B==null||(y=B.metadata)===null||y===void 0?void 0:y.version)||(ie.$feature_flag_version=B.metadata.version);const C=(E=B==null||(P=B.reason)===null||P===void 0?void 0:P.description)!==null&&E!==void 0?E:B==null||(I=B.reason)===null||I===void 0?void 0:I.code;var O;C&&(ie.$feature_flag_reason=C),B!=null&&(M=B.metadata)!==null&&M!==void 0&&M.id&&(ie.$feature_flag_id=B.metadata.id),j(B?.original_variant)&&j(B?.original_enabled)||(ie.$feature_flag_original_response=j(B.original_variant)?B.original_enabled:B.original_variant),B!=null&&($=B.metadata)!==null&&$!==void 0&&$.original_payload&&(ie.$feature_flag_original_payload=B==null||(O=B.metadata)===null||O===void 0?void 0:O.original_payload),le.length&&(ie.$feature_flag_error=le.join(",")),this.ev(ie)}else l&&this.$t({[On]:u,[lc]:l});return s?{key:e,enabled:!!n,variant:typeof n=="string"?n:void 0,payload:P0(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 et(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+ef),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=$w)=>{const u=((E,P)=>{const I=E.flags;if(I){const M=Object.fromEntries(Object.keys(I).map(O=>{var B;return[O,(B=I[O].variant)!==null&&B!==void 0?B:I[O].enabled]})),$=Object.fromEntries(Object.keys(I).filter(O=>I[O].enabled).filter(O=>{var B;return!j((B=I[O].metadata)===null||B===void 0?void 0:B.payload)}).map(O=>{var B;return[O,(B=I[O].metadata)===null||B===void 0?void 0:B.payload]}));return S(S({},E),{},{featureFlags:M,featureFlagPayloads:$})}return E.featureFlags&&P.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),E})(n,l),p=u.flags,d=u.featureFlags,h=u.featureFlagPayloads;if(!d)return;const m=n.requestId,f=n.evaluatedAt;if(we(d)){l.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const E={};if(d)for(let P=0;d.length>P;P++)E[d[P]]=!0;return{[Ws]:d,[es]:E,[yc]:!1}}let g=d,_=h,y=p;if(c?.partialResponse){const E=Object.keys(g),P=_||{};g=S(S({},i),g),_=S(S({},o),P),E.forEach(I=>{I in P||_==null||delete _[I]}),y=S(S({},a),y)}else if(n.errorsWhileComputingFlags)if(p){const E=new Set(Object.keys(p).filter(I=>{var M;return!(!((M=p[I])===null||M===void 0)&&M.failed)}));g=S(S({},i),Object.fromEntries(Object.entries(g).filter(([I])=>E.has(I))));const P=Object.fromEntries(Object.entries(_||{}).filter(([I])=>E.has(I)));_=S(S({},o),P),E.forEach(I=>{I in P||_==null||delete _[I]}),y=S(S({},a),Object.fromEntries(Object.entries(y||{}).filter(([I])=>E.has(I))))}else g=S(S({},i),g),_=S(S({},o),_),y=S(S({},a),y);return S(S({[Ws]:Object.keys(zw(g)),[es]:g||{},[Cn]:_||{},[Ci]:y||{},[yc]:n.minimalFlagCalledEvents===!0},m?{[Pi]:m}:{}),f?{[Fn]:f}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this.A);if(s)if(r?.persist===!1){const n=!j(this.bo.kv.get(es));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([gs,hi]),this.Nd(),void oi.info("All overrides cleared");if(we(e))return this.$t({[gs]:qw(e)}),this.Nd(),void oi.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[gs]=we(n)?qw(n):n),i&&(s[hi]=i),Object.keys(s).length&&this.$t(s),n===!1&&i===!1?this.Lt([gs,hi]):n===!1?this.Lt(gs):i===!1&&this.Lt(hi),this.Nd(),n===!1?oi.info("Flag overrides cleared"):n&&oi.info("Flag overrides set",{flags:n}),i===!1?oi.info("Payload overrides cleared"):i&&oi.info("Payload overrides set",{payloads:i});return}if(e&&typeof e=="object")return this.$t({[gs]:e}),this.Nd(),void oi.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({[Ws]:Object.keys(zw(a)),[es]:a,[Pn]: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(Mm);!s||t?this.rv(e,r):e(s)}rv(e,t){var r=this;return et(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({[Mm]: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({[Pn]: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({[Pn]:r}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(Pn),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({[xn]:s}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this.zd("$stored_group_properties")||{};this.$t({[xn]:S(S({},t),{},{[e]:{}})})}else this.Lt(xn)}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}}},O8={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=Xh,this.uv=void 0,this.hv=!1,this.Je=(()=>{var t,r;if(!W?.visibilityState||W.visibilityState==="visible")return!0;const s=D==null||(t=D.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 zs.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&&Fe(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 D&&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),zs.info("starting")):(this.lv=Xh,this.stopRecording())}fv(e){var t,r;if(this.vv)if(this.lv!=="awaiting_config"&&this.lv!=="missing_config"&&(this.lv=Pw),(ve==null||(t=ve.__PosthogExtensions__)===null||t===void 0||(t=t.rrweb)===null||t===void 0?void 0:t.record)&&((r=ve.__PosthogExtensions__)===null||r===void 0?void 0:r.initSessionRecording))this.pv(e);else{var s,n;const i=this._instance.sessionManager;(s=ve.__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}),zs.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=ht(e)?e:parseFloat(e);return typeof(s=r)!="number"||!Number.isFinite(s)||0>s||s>1?(zs.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({[_c]: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({[f_]:!0}),zs.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):zs.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(_c);return(r==null||(t=r.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}_v(){const e=this._instance.get_property(_c);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(r){return zs.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=ve.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return zs.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[h_]:!0});var n;if(this.av||(this.av=(n=ve.__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",zs.info("persisted remote config is stale, requesting fresh config before starting"),new dP(this._instance).load();return}this.lv=Pw,(r=(s=this.av).setDocumentWasEverVisible)===null||r===void 0||r.call(s,this.Je),this.av.start(e)}else this.lv=Xh}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 u8){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)}}},M8={autocapture:class extends i8{constructor(e){super(new o8(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&&(Q.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,Q.info("History API monitoring stopped")}monitorHistoryChanges(){D&&D.history&&(this.Mv("pushState"),this.Mv("replaceState"),this.Ev(),this.$v()&&this.Pv())}Mv(e){var t;if(!D||!((t=D.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;const r=this;Gc(D.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&&(D==null||(a=D.event)===null||a===void 0?void 0:a.type)!=="popstate")})}xv(){const e=D?.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}:$e(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(g_,{navigation_type:e});t?(this.Dv=s,Promise.resolve().then(()=>this.Av())):s()}this.Sv=r}catch(r){Q.error(`Error capturing ${e} pageview`,r)}}Rv(e){var t,r;return!(Te(e)||!D)&&((t=an(String(e)))===null||t===void 0?void 0:t.href)!==((r=D.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){Q.error("Error capturing deferred pageview",t)}finally{this.wv=!1}this.Sv=this.xv()}}Ev(){if(this.Tv)return;const e=()=>{this.Fv("popstate")};Fe(D,"popstate",e),this.Tv=()=>{D&&D.removeEventListener("popstate",e)}}Pv(){if(this.Iv)return;const e=()=>{this.Fv("hashchange")};Fe(D,"hashchange",e),this.Iv=()=>{D&&D.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[Cm]),this.rageclicks=new LP(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return $e(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;d8.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({[Cm]:r}),this.Lv=r,this.startIfEnabled()}getAndClearBuffer(){const e=this.Rt;return this.Rt=void 0,e}Bv(e){Qh(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(){D&&W&&(this.Hv=this.yl.bind(this),Fe(D,id,this.Hv),this.zv=e=>this.Mr(e||D?.event),Fe(W,"click",this.zv,{capture:!0}),this.Uv=e=>this.Wv(e||D?.event),Fe(W,"mousemove",this.Uv,{capture:!0}),this.Vv=new sw(this.instance,uG,this.Bv.bind(this)),this.Vv.startIfEnabledOrStop(),this.Gv=this.sn.bind(this),Fe(W,Fc,this.Gv),this.ko=!0)}jv(){var e;D&&W&&(this.Hv&&D.removeEventListener(id,this.Hv),this.zv&&W.removeEventListener("click",this.zv,{capture:!0}),this.Uv&&W.removeEventListener("mousemove",this.Uv,{capture:!0}),this.Gv&&W.removeEventListener(Fc,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&&Os(l)&&!jt(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:D)===null||u===void 0?void 0:u.getComputedStyle(l).position}catch{return!1}if(be(a,h))return!0;l=KC(l)}return!1})(wc(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(K0(e.target)||!Qh(e))return;const s=this.Qv(e,t);(r=this.rageclicks)!==null&&r!==void 0&&r.isRageClick(e.clientX,e.clientY,new Date().getTime())&&JC(wc(e),this.instance.config.rageclick)&&this.Zs(S(S({},s),{},{type:"rageclick"})),this.Zs(s)}Wv(e){!K0(e.target)&&Qh(e)&&(clearTimeout(this.Zv),this.Zv=setTimeout(()=>{this.Zs(this.Qv(e,"mousemove"))},500))}Zs(e){if(!D)return;const t=this.Ir.disable_capture_url_hashes?Wn(D.location.href):D.location.href,r=this.Ir.custom_personal_data_properties,s=this.Ir.mask_personal_data_properties?[...ra,...r||[]]:[],n=Bc(t,s,Vc);this.Rt=this.Rt||{},this.Rt[n]||(this.Rt[n]=[]),this.Rt[n].push(e)}yl(){this.Rt&&!pr(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:sw,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 ii.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=ht(r.navigationId)||typeof r.navigationId=="string"?`navigation:${r.navigationId}`:`url:${i}`;if(this.tf&&r.value>=this.tf)return void ii.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,$e(r.attribution)&&this.attributionMetrics.indexOf(r.name)>-1){const l={};for(const u of l8){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=ve.__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 ii.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[Om]),this.startIfEnabled()}get nf(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const r=$e(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)||Cw:r}get flushToCaptureTimeoutMs(){return($e(this.nf)?this.nf.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=$e(this.nf)?this.nf.web_vitals_attribution:void 0;return rr(e)?e?Cw:[]:we(e)?e:c8}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=$e(this.nf)?this.nf.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get tf(){const e=$e(this.nf)&&ht(this.nf.__web_vitals_max_value)?this.nf.__web_vitals_max_value:Rw;return e>0&&6e4>=e?Rw:e}get isEnabled(){const e=at?.protocol;if(e!=="http:"&&e!=="https:")return ii.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=$e(this.nf)?this.nf.web_vitals:rr(this.nf)?this.nf:void 0;return rr(t)?t:this.Lv}startIfEnabled(){this.isEnabled&&!this.ko&&(ii.info("enabled, starting..."),this.Ho(this.ef))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const r=$e(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=$e(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Om]:r}),this._instance.persistence.register({[wC]: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=ve.__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?ii.error("failed to load script",i):e()})}Yv(e){const t=e||D?.location.href;if(!t)return void ii.error("Could not determine current URL");const r=this._instance.config.disable_capture_url_hashes?Wn(t):t,s=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...ra,...s||[]]:[];return Bc(r,n,Vc)}}},L8={exceptionObserver:class{constructor(e){var t;this.ef=()=>{var r;if(!D||!this.isEnabled||!(!((r=ve.__PosthogExtensions__)===null||r===void 0)&&r.errorWrappingFunctions))return;const s=ve.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=ve.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=ve.__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){Xa.error("failed to start",o),this.lf()}},this._instance=e,this.uf=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[Pm]),this.wt=new P3(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:Xa})),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 $e(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?(Xa.info("enabled"),this.lf(),this.Ho(this.ef)):this.lf()}Ho(e){var t,r,s;!((t=ve.__PosthogExtensions__)===null||t===void 0)&&t.errorWrappingFunctions?e():(r=ve.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this._instance,"exception-autocapture",n=>{if(n)return Xa.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({[Pm]: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 Xa.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 j3([new s4,new p4,new i4,new n4,new u4,new l4,new a4,new d4],(function(s,...n){return(i,o=0)=>{const a=[],c=i.split(`
|
|
140
|
+
`),l=Math.min(c.length,o+1e3),u=[];for(let h=o;l>h;h++){const m=c[h];if(m.length>1024)continue;const f=C0.test(m)?m.replace(C0,"$1"):m;if(!f.match(/\S*Error: /)){for(const g of n){const _=g(f,s);if(_){a.push(_);const y=Z3(a);if(y){for(let E=u.length-1;E>=0;E--){const P=u[E];if(y.start>=P.start+P.length)break;u.pop()}u.push(y)}break}}if(t4(a,u)>=50)break}}const p=[...u].sort((h,m)=>m.start-h.start),d=p[p.length-1];if(d){const h=sC(a,d);a.splice(d.start-h,h);for(const m of p)m.start-=h}for(const h of p)e4(a,h);return u.some(h=>h.start===0&&a.length===h.length)&&(function(h){const m=h.map(g=>`${g.function}|${g.filename}|${g.lineno}|${g.colno}|${g.module}`);let f=0;for(let g=1;m.length>g;g++)r4(m,g,f)&&(f=g);h.push(...h.splice(0,f))})(a),(function(h){if(!h.length)return[];const m=Array.from(h);return m.reverse(),m.slice(0,50).map(f=>{return S(S({},f),{},{filename:f.filename||(g=m,g[g.length-1]||{}).filename,function:f.function||"?"});var g})})(a)}})("web:javascript",J3,Q3)),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=ed(this.ff()),this.pf=new f4(this.vf)}onConfigChange(){this.vf=ed(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({[yC]:this.cf,[xm]:o})}get gf(){var e;const t=!!this._instance.get_property(xm),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(!xe(e)||e.trim().length===0)return void Kr.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)=>h4.has(a)?(i.push(a),o):(o[a]=n[a],o),{}),droppedKeys:i}})(this.mf(t));s.length>0&&Kr.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.pf.add(S({[Qu]:e,[Zu]:new Date().toISOString()},r))}catch(r){Kr.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 Kr.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 Kr.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 Kr.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 Kr.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){Fw(n)||Kr.error("Failed to capture exception event. Dropping this exception.",n),this.pf.clear();return}}catch(t){Fw(t)||Kr.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 Kr.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_f(e){this.vf.enabled&&this.pf.add({[Qu]:e,[Zu]:new Date().toISOString()})}mf(e){return $e(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})=>(xe(s)&&s.length>0&&r.$exception_types.push(s),xe(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=PP[n.operator],o=t[n.key];if(!i||!o)return!1;const a=we(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 Kr.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&&k8.some(n=>s.startsWith(n)));return r.length!==0&&(!r.every(({filename:s})=>!!s&&s.startsWith(Km))||e.some(({type:s,value:n})=>s==="NoResponse"||xe(n)&&S8.some(({value:i,exact:o})=>o?n===i:n.includes(i)))&&!t.some(({in_app:s,filename:n})=>s&&!n?.startsWith(Km)))}kf(e){return e.some(({value:t})=>xe(t)&&E8.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)&&we(e)}}},N8=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({[d_]:!!t.productTours}),!Zh(this._instance))return!this.Cf&&Te((r=this.Il)===null||r===void 0?void 0:r.props.ph_product_tours)||iu.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&&Zh(this._instance)&&this.Ho(()=>this.Tf())}Ho(e){var t,r,s;!((t=ve.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(r=ve.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this._instance,"product-tours",n=>{n?iu.error("Could not load product tours script",n):e()})}Tf(){var e;!this.Cf&&(e=ve.__PosthogExtensions__)!==null&&e!==void 0&&e.generateProductTours&&(this.Cf=ve.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(we(this.$f)&&!t)return void e(this.$f,{isLoaded:!0});const r=this.Il;if(r){const s=r.props[Lm];if(we(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(!Zh(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||iu.warn(o):iu.error(o),e([],{isLoaded:!1,error:o});return}const i=we(s.json.product_tours)?s.json.product_tours:[];this.$f=i,r&&r.register({[Lm]: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)}}},Ep),$8={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=ve._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,m]of Object.entries(u))c[h]={id:l[h],type:h,properties:m};const{$set_once:p,$set:d}=e;return{event:S(S({},aC(e,p8)),{},{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)||(hs.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)||(hs.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=(g,_,y)=>{if(!g?.[_])return;const E=g[_];g[_]=y(E),u.push(()=>{g[_]=E})},m=g=>{if(d.has(g))return g;const _=p.Rf(g);return _&&d.add(_),_},f=g=>g.map(_=>typeof _=="string"?_:m(_)).filter(_=>!ct(_));return h(l,"appendChild",g=>function(_){const y=m(_);return y?g.call(this,y):_}),h(l,"insertBefore",g=>function(_,y){const E=m(_);return E?g.call(this,E,y):_}),h(l,"replaceChild",g=>function(_,y){const E=m(_);return E?g.call(this,E,y):y}),[(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(g=>{h(g,"append",_=>function(...y){return _.apply(this,f(y))}),h(g,"prepend",_=>function(...y){return _.apply(this,f(y))})}),[(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(g=>{h(g,"before",_=>function(...y){return _.apply(this,f(y))}),h(g,"after",_=>function(...y){return _.apply(this,f(y))}),h(g,"replaceWith",_=>function(...y){const E=f(y);return y.length&&!E.length?void 0:_.apply(this,E)})}),h((a=c.Element)===null||a===void 0?void 0:a.prototype,"insertAdjacentElement",g=>function(_,y){const E=m(y);return E?g.call(this,_,E):null}),this.Ff=()=>{u.forEach(g=>g()),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&&(hs.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,hs.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){hs.error(xw+e.id,i),n(!1)}if(s&&t.loaded)try{r()}catch(i){hs.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){hs.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 hs.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;ve[`__$$ph_site_app_${a}`]=this._instance,(i=ve.__PosthogExtensions__)===null||i===void 0||(o=i.loadSiteApp)===null||o===void 0||o.call(i,this._instance,c,l=>{if(l)return hs.error(xw+a,l)})}else hs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},D8={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=ve.__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=ve.__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=ve.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(r=ve.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this._instance,"tracing-headers",n=>{if(n)return a8.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 we(e)?(we(this.Bf)?this.Bf.splice(0,this.Bf.length,...e):this.Bf=[...e],e.length>0?this.Bf:void 0):(we(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()}}},U8=S({surveys:class extends h8{constructor(e){var t;super(new _8(e),(t=e,{get projectToken(){return t.config.token},kv:new v8(t)})),this._instance=e}Vh(e,t){const r=t.query?hl(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})})}}},Ep),q8={toolbar:class{constructor(e){this.instance=e}Uf(e){ve.ph_toolbar_state=e}Wf(){var e;return(e=ve.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($m(this.instance.config)||!D||!W)return!1;e=(s=e)!==null&&s!==void 0?s:D.location,r=(n=r)!==null&&n!==void 0?n:D.history;try{if(!t){try{D.localStorage.setItem("test","test"),D.localStorage.removeItem("test")}catch{return!1}t=D?.localStorage}const i=y8||ad(e.hash,"__posthog")||ad(e.hash,"state");let o;const a=i?T0(()=>JSON.parse(atob(decodeURIComponent(i))))||T0(()=>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(Mw)||"{}"),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=ve.ph_load_toolbar||ve.ph_load_editor;!Te(t)&&Rt(t)?t(e,this.instance):Lw.warn("No toolbar load function found")}loadToolbar(e){const t=!!W?.getElementById("__POSTHOG_TOOLBAR__");if(!D||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(D.localStorage.setItem(Mw,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=ve.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this.instance,"toolbar",o=>{if(o)return Lw.error("[Toolbar] Failed to load",o),void this.Uf(0);this.Uf(2),this.Vf(s)}),Fe(D,"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)}}},z8=S({experiments:class Xt{get Ir(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(r=!1)=>{this.getWebExperiments(s=>{Xt.Zf("retrieved web experiments from the server"),this.Qf=new Map,s.forEach(n=>{if(n.feature_flag_key){var i;this.Qf&&(Xt.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);xe(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];Xt.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())Xt.Zf(jw);else if(!this.Ir.disable_web_experiments){if(Te(this.Qf))return this.Qf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Xt.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=Xt.getWindowLocation();if(t?.search){const r=ta(t?.search,"__experiment_id"),s=ta(t?.search,"__experiment_variant");r&&s&&(Xt.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&&(Xt.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)&&Xt.Yf(t,r)&&Xt.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=Xt.getWindowLocation();if(n){var i,o,a;const c=BC(r,n.href);return!(!((i=t.conditions)===null||i===void 0)&&i.url)||T8[(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 D?.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=rP();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,m=!(!((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,f=!(!((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&&m&&f&&h}return!1}static Zf(t,...r){Q.info(`[WebExperiments] ${t}`,r)}Jf(t,r,s){this._is_bot()?Xt.Zf(jw):r!=="control"?s.forEach(n=>{if(n.selector){var i;Xt.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)})}}):Xt.Zf("Control variants leave the page unmodified.")}_is_bot(){return Pt&&this._instance?IP(Pt,this.Ir.custom_blocked_useragents):void 0}}},Ep),F8={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)||(rr(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||$m(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=ve?.__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(m_);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 Rr.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,Rr.info("Conversations loaded successfully")}catch(t){this.ap("Error completing conversations initialization",t)}else Rr.error("Cannot complete initialization: remote config is null")}ap(e,t){Rr.error(e,t),this._conversationsManager=null,this.np=!1,this.sp=!0}show(){this._conversationsManager?this._conversationsManager.show():Rr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.ep===!0&&!ct(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":$m(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":ve?.__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 et(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,r):(Rr.warn(ai),null)})()}getMessages(e,t){var r=this;return et(function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(Rr.warn(ai),null)})()}markAsRead(e){var t=this;return et(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Rr.warn(ai),null)})()}getTickets(e){var t=this;return et(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Rr.warn(ai),null)})()}requestRestoreLink(e){var t=this;return et(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Rr.warn(ai),null)})()}restoreFromToken(e){var t=this;return et(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Rr.warn(ai),null)})()}restoreFromUrlToken(){var e=this;return et(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Rr.warn(ai),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()}}},j8={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.lp=!1,this.up=!1,this.hp=!1,this.A=ut("[logs]"),this.cp=S(S({},this.A),{},{error:(...r)=>{r.some(Vw)||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),D&&Fe(D,"online",this.mp)}_p(e,t,r,s){var n;const i=Hw((n=this._instance)===null||n===void 0||(n=n.config)===null||n===void 0?void 0:n.logs,r);return[new E4(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},Bw)),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,D?.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[bC])}Mp(){var e,t,r;return!(!((e=this._instance)===null||e===void 0||(t=e.il)===null||t===void 0)&&t.call(e))||!!(!((r=ve._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||!ve?.console)return;const t=Hw((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 A8){let n;try{n=I8(ve.console[s])}catch{continue}n&&this.fp.push(Gc(ve.console,s,i=>{const o=(...a)=>{try{r&&this.Op(s,a,t)}catch{}return i.apply(ve.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){Vw(e)||this.A.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.To||!this.lp||this.up||this.hp)return;const e=ve?.__PosthogExtensions__;if(!e)return this.A.error("PostHog Extensions not found."),void this.Rp();const t=e.loadExternalDependency;if(!t)return this.A.error(m_),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===_s.LogsQueue?e():void 0,setPersistedProperty(s,n){var i;s===_s.LogsQueue&&t((i=n)!==null&&i!==void 0?i:[])},js:s=>this.js(s),getLibraryId:()=>St.LIB_NAME,getLibraryVersion:()=>St.LIB_VERSION}}js(e){return new Promise(t=>{if(eP(this._d,3))return void t({kind:"fatal",error:tf(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:tf(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:tf(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=tP(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,St.LIB_NAME,t=>{this.ol=t}),this.dp.length>0&&this.zp(e,this.dp,this.Ip,Bw,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=hC(i,pC(r,St.LIB_NAME,St.LIB_VERSION),s,St.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(ve!=null&&(e=ve.location)!==null&&e!==void 0&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Wn(ve.location.href):ve.location.href),this._instance.featureFlags){const r=this._instance.featureFlags.getFlags();r&&r.length>0&&(t.activeFeatureFlags=r)}return t}}},H8={metrics:class{constructor(e){this._instance=e,this.A=ut("[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=P8(r,n),o=x8(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 T4(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:()=>St.LIB_NAME,getLibraryVersion:()=>St.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)}}};Ac.__defaultExtensionClasses=S({},S(S(S(S(S(S(S(S(S(S(S(S(S({},Ep),O8),M8),L8),N8),$8),U8),D8),q8),z8),F8),j8),H8));var B8=(function(){St.SDK_DIST_CHANNEL="npm";const e=Ec[uc]=new Ac;return(function(){function t(){t.done||(t.done=!0,TP=!1,Ve(Ec,function(r){r._dom_loaded()}))}W?.addEventListener?W.readyState==="complete"?t():Fe(W,"DOMContentLoaded",t,{capture:!1}):D&&Q.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})(),V8=B8,qY=px.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 Gw(e){return tg(e).replace(/(\/organizations\/)[^/?#]+/g,"$1[redacted]")}var G8=Object.freeze({recording:"off",identity:"id_only",content:"strict"}),zY=Object.freeze({recording:"full",identity:"full",content:"full"});function FY(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 K8="$mcpjam_telemetry_context";var W8=64;function hd(e){return[...new Set(e.filter(t=>typeof t=="string"&&t.length>0&&t.length<=W8))].sort().slice(0,8)}function J8(e){return{v:2,p:hd(e.projectIds),o:hd(e.organizationIds),r:e.policy.recording,i:e.policy.identity,c:e.policy.content}}function fd(e){return`${hd(e.projectIds).join(",")}|${hd(e.organizationIds).join(",")}`}var Y8=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 qP(e,t){const r=e.toLowerCase();return Y8.has(r)?r==="style"?uK(t):dS(t):"***"}function Tp(e){return e.replace(/\S/g,"*")}var X8=new Set(["img","picture","video","audio","canvas","iframe","object","embed","image"]),qi="[name]",zP="[redacted]",Q8=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","reconnect","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","web-accounts","webmcp","xaa-flow"]),Z8="[host]",Kw="host.scrub.invalid",eK=["mcpjam.com","caniuse.dev"],tK=new Set(["localhost","127.0.0.1","[::1]","::1"]);function rK(e){const t=e.toLowerCase();if(tK.has(t)||eK.some(s=>t===s||t.endsWith(`.${s}`)))return!0;const r=globalThis.location?.hostname;return typeof r=="string"&&r.toLowerCase()===t}var sK=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function FP(e){return/^\d+$/.test(e)||sK.test(e)||/^[0-9a-z]{25,40}$/.test(e)&&/\d/.test(e)}function nK(e){return!e||e===qi||e===zP||Q8.has(e)||FP(e)?e:qi}var iK="[key]",oK=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"]),aK=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 cK(e,t){return oK.has(e.toLowerCase())?`${encodeURIComponent(e)}=${zP}`:aK.has(e)?`${encodeURIComponent(e)}=${FP(t)?encodeURIComponent(t):qi}`:`${iK}=${qi}`}function Kc(e){const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e);if(!t&&!e.startsWith("/"))return Gw(e);const r=Gw(e);try{const s=new URL(t?r.replace(/^([a-z][a-z0-9+.-]*:\/\/)\[host\]/i,`$1${Kw}`):r,"http://scrub.invalid"),n=s.pathname.split("/").map(o=>nK(decodeURIComponent(o))).join("/"),i=[...s.searchParams].map(([o,a])=>cK(o,a)).join("&");return`${t?`${s.protocol}//${s.hostname!==Kw&&rK(s.hostname)?s.host:Z8}`:""}${n}${i?`?${i}`:""}`}catch{return qi}}function Ww(e){return typeof e!="string"||!/^[a-z][a-z0-9+.-]*:\/\//i.test(e)&&!e.startsWith("/")?qi:Kc(e)}var Jw=/url\(\s*("(?:[^"\\\n]|\\[\s\S])*"|'(?:[^'\\\n]|\\[\s\S])*'|(?:[^"'()\s\\]|\\[\s\S])*)\s*\)|"(?:[^"\\\n]|\\[\s\S])*"|'(?:[^'\\\n]|\\[\s\S])*'/gi,lK=/[/:.]/;function Yw(e){return(e.startsWith('"')||e.startsWith("'")?e.slice(1,-1):e).replace(/\\([\s\S])/g,"$1")}function uK(e){if(!/url\(|["'\\]/i.test(e))return e;const t=e.replace(Jw,(s,n)=>{if(n!==void 0){const o=Ww(Yw(n));return`url(${JSON.stringify(o)})`}const i=Yw(s);return JSON.stringify(lK.test(i)?Ww(i):Tp(i))}),r=t.replace(Jw,"");return/url\(|["'\\]/i.test(r)?"***":t}function fl(){return dK()}function dK(){return typeof window<"u"&&window.isElectron===!0}function T_(e=pK()){return e?Lx(typeof e=="string"?{pathname:e}:e):!1}function pK(){if(typeof window>"u"||!window.location)return;const{pathname:e,search:t,hash:r}=window.location;return{pathname:e,search:t,hash:r}}function jP(){return!fl()||Zv()?"off":"desktop"}function jY(e){return e.surface!=="hosted"||e.sharedLink?"off":e.recording===void 0?"pending":e.recording==="off"?"off":e.recording==="full"?"full":"masked"}var Jm="mcpjam.telemetry.replayOffActor",_o;function HP(){if(_o!==void 0)return _o;try{_o=window.localStorage.getItem(Jm)}catch{_o=null}return _o}function HY(e,t){if(e===null)return;const r=HP(),s=t?e:r===e?null:r;if(s!==r){_o=s;try{s===null?window.localStorage.removeItem(Jm):window.localStorage.setItem(Jm,s)}catch{}}}function BY(e){const t=HP();return t===null?!1:e===void 0||e===t}var BP;function A_(){return BP??(jP()==="off"?"off":"pending")}function VY(e){BP=e}function Xr(){return Rx()!=="full"}var Xw="https://redacted.invalid/",hK=["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 VP(e){const t=r=>e==="masked"?Kc(r):tg(r);return function(s){const n=s.entryType===void 0&&!s.isInitial;try{const i={};for(const o of hK)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=Xw),i}catch{return n?{name:Xw}:null}}}var fK=VP("full"),mK=VP("masked"),gK="data-ph-no-capture",GP=[...X8].map(e=>e==="image"?"svg image":e).join(", "),vK={maskAllInputs:!0,maskInputOptions:{password:!0},maskTextSelector:"*",maskTextFn:Tp,blockSelector:GP,maskAttributeFn:qP,recordHeaders:!1,recordBody:!1,maskCapturedNetworkRequestFn:fK,compress_events:!1},KP={maskAllInputs:!0,maskInputOptions:{password:!0},maskTextSelector:"*",maskTextFn:Tp,blockSelector:GP,maskAttributeFn:qP,recordHeaders:!1,recordBody:!1,captureCanvas:{recordCanvas:!1},captureJsonLd:!1,recordCrossOriginIframes:!1,maskCapturedNetworkRequestFn:mK,compress_events:!1};function _K(e){return e==="masked"?{session_recording:KP,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:vK,disable_session_recording:!0,autocapture:!0,capture_dead_clicks:!0,rageclick:!0,capture_exceptions:fl(),disable_surveys:!1,enable_heatmaps:!0,enable_recording_console_log:!1,mask_all_text:!1,mask_all_element_attributes:!1}}var rf=null,ci=!1,Cu=null;function GY(){return Cu}var dc=!1,Ym=null;function yK(e){if(dc||A_()!=="full"||!Array.isArray(e))return null;if(Ym===null)return e;const t=Ym,r=e.filter(s=>{const n=s?.timestamp;return typeof n=="number"&&n>=t});return r.length>0?r:null}function KY(e,t){if(Cu!==e){dc=!0;try{Cu?.stopSessionRecording?.()}finally{dc=!1}rf=null,ci=!1}Cu=e;try{const r=A_(),s=Xr()||r==="masked"?"masked":"full";if(s!==rf){if(ci){dc=s==="masked";try{e.stopSessionRecording?.()}finally{dc=!1}ci=!1}e.set_config?.(_K(s)),rf=s}const n=jP()==="hosted"&&r==="full"&&!Xr()&&!T_(t);n&&!ci?(Ym=Date.now(),e.startSessionRecording?.(),ci=!0):!n&&ci&&(e.stopSessionRecording?.(),ci=!1)}catch{}}var bK=/\[[\w:.-]+(?:="[^"]*")?\]/g,wK=/#[^\s.#[>:]+/g;function SK(e){const t=e.replace(bK,"").replace(wK,""),r=t.search(/[["]/);return r===-1?t:t.slice(0,r)}var kK=new Set(["class","role","disabled","aria-disabled","data-sentry-component"]);function EK(e){const t={...e};typeof e.message=="string"&&(t.message=SK(e.message));const r=e.data;if(r&&typeof r=="object"){const s={...r};typeof r.url=="string"&&(s.url=Kc(r.url)),typeof r.route=="string"&&(s.route=Kc(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,kK.has(o)?a:"***"])):n.attributes;s.node={...n,attributes:i,...typeof n.textContent=="string"?{textContent:Tp(n.textContent)}:{}}}t.data=s}return t}function TK(e){const t=Xr(),r=t?Kc:tg,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:EK(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 AK=["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]'],WY={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",`[${gK}]`,...AK,`[style*='"']`,`[style*="'"]`,...wx()],networkDetailAllowUrls:[],networkCaptureBodies:!1,beforeAddRecordingEvent:TK},Jn=null,na,Qs,Xm=new Set,Pu=0,Qm=!1,Ap=0,Qw=!1,WP=!1,JP=0;function YP(){const e=Ip();return Qw&&!e&&(Ap+=1),Qw=e,e}function Sa(){if(Pu>0){Qm=!0;return}WP=YP(),JP=Ap;for(const e of Xm)try{e()}catch{}}function JY(){return Jn}function YY(e){e!==Jn&&(Jn=e,na=void 0,Qs=void 0,Sa())}function XY(e,t){if(e!==Jn)return;const r=e===null?void 0:t;r!==na&&(na=r,Sa())}function QY(){na!==void 0&&(na=void 0,Sa())}function IK(e){return e!==null&&e===Jn?na:void 0}function RK(e=Jn){return IK(e)==="full"&&Ip()}function ZY(){return Ap}function eX(e){return Xm.add(e),()=>Xm.delete(e)}var Dr={projectIds:[],organizationIds:[]};function CK(e){const t=fd(Dr),r=!!Dr.sharedLink;Dr={sharedLink:e.sharedLink,projectIds:e.projectIds.filter(s=>!!s),organizationIds:e.organizationIds.filter(s=>!!s)},(t!==fd(Dr)||r!==!!Dr.sharedLink)&&(Qs=void 0,Sa())}function PK(e,t){const r=e&&e===Jn&&t?{actor:e,context:fd(Dr),content:t}:void 0;r?.actor===Qs?.actor&&r?.context===Qs?.context&&r?.content===Qs?.content||(Qs=r,Sa())}function tX(e,t,r){Pu+=1;try{CK(e),PK(t,r)}finally{Pu-=1,Pu===0&&(Qm||Ip()!==WP||Ap!==JP)&&(Qm=!1,Sa())}}function Ip(){return Qs?.actor===Jn&&Qs?.content==="full"&&Qs.context===fd(Dr)&&typeof window<"u"&&!window.isElectron&&!Dr.sharedLink&&!T_()&&Dr.projectIds.length+Dr.organizationIds.length>0}function xK(){const e=Ip(),t=A_();return{projectIds:[...Dr.projectIds],organizationIds:[...Dr.organizationIds],policy:e?{recording:t==="full"||t==="masked"?t:"off",identity:RK()?"full":"id_only",content:"full"}:{...G8}}}function XP(e){if(!e)return e;try{const t=xK(),r={...e.properties??{},[K8]:J8(t)};if(e.event==="$snapshot"&&"$snapshot_data"in r){const s=yK(r.$snapshot_data);if(s===null)return null;r.$snapshot_data=s}return{...e,properties:r}}catch{return null}}Px(()=>YP()?"full":"strict");var OK=/\.[cm]?[jt]sx?$/,MK=/^(?:[a-z][a-z0-9+.-]*:\/\/|\/)/i;function LK(e,t){if(typeof e!="string"||!MK.test(e))return!1;let r;try{r=new URL(e,t)}catch{return!1}return r.origin!==t?!1:!OK.test(r.pathname)}function NK(e,t){return e.length===0?!1:e.every(r=>LK(r,t))}function $K(e,t){return e.length===0?!1:e.every(r=>NK(r,t))}var QP=`${hS}_tab`,DK=`ph_${QP}`;function UK(){let e="memory";try{const t=`${DK}_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:QP}}var ZP=new Set(["caniuse.dev","www.caniuse.dev"]),qK=new Set(["score.mcpjam.com","www.score.mcpjam.com"]),zK=new Set([...ZP,...qK]),rX="https://app.mcpjam.com";function FK(e){return ZP.has(e.toLowerCase())}function sX(e=typeof window>"u"?void 0:window.location.hostname,t=typeof window>"u"?"":window.location.pathname){return t.replace(/\/+$/,"")==="/redeem"?!0:!!e&&FK(e)}function I_(){return typeof window<"u"&&window.location?.origin?.startsWith("http")?`${window.location.origin}/tlm`:"/tlm"}function R_(e){const t=_m()?.guestId,r=e&&Object.keys(e).length>0?e:void 0;return!t&&!r?{}:{bootstrap:{...t?{distinctID:t,isIdentifiedID:!1}:{},...r?{featureFlags:r}:{}}}}var ex={...UK(),advanced_disable_feature_flags:!0,advanced_disable_feature_flags_on_first_load:!0},tx=null;function Zm(e=tx){if(e)for(const t of[e.persistence,e.sessionPersistence]){const r=t?.props;if(!(!t||!r)){try{const s=Tx(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 rx(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 $K(r,window.location.origin)?null:e}var jK=zK,HK=I_()==="/tlm"||Zv(),BK={advanced_disable_flags:!0,disable_surveys:!0,disable_external_dependency_loading:!0};function sx(e=typeof window>"u"?void 0:window.location?.hostname){const t=!!e&&jK.has(e.toLowerCase());return{capture_pageview:t?"history_change":!1,capture_pageleave:t}}var Zw={api_host:I_(),ui_host:"https://us.posthog.com",...R_(),...sx(),...ex,person_profiles:"always",disable_beacon:!0,before_send:[rx,XP,e=>(Zm(),e)],disable_capture_url_hashes:!0,get capture_dead_clicks(){return!Xr()},get autocapture(){return!Xr()},get rageclick(){return!Xr()},get disable_surveys(){return Xr()},get enable_heatmaps(){return!Xr()},get capture_exceptions(){return fl()&&!Xr()},disable_session_recording:!0,session_recording:KP,enable_recording_console_log:!1,get mask_all_text(){return Xr()},get mask_all_element_attributes(){return Xr()},loaded:e=>{tx=e,Zm(e),e.register({environment:"production",platform:md(),version:"3.25.1",deployment:"self_hosted",source:"client"}),e.setPersonPropertiesForFlags?.({deployment:"self_hosted",platform:md()})}};function VK(e){const t=R_(e);return"bootstrap"in t?Object.defineProperties({},{...Object.getOwnPropertyDescriptors(Zw),bootstrap:{value:t.bootstrap,enumerable:!0,configurable:!0,writable:!0}}):Zw}var nX=()=>hS,iX=e=>HK?{api_host:I_(),ui_host:"https://us.posthog.com",...R_(e),...sx(),...ex,person_profiles:"always",disable_beacon:!0,disable_session_recording:!0,capture_exceptions:!1,...Zv()?BK:{},opt_out_capturing_by_default:!0,before_send:[rx,XP,t=>(Zm(),t)],disable_capture_url_hashes:!0,loaded:t=>{t.setPersonPropertiesForFlags?.({deployment:"self_hosted",platform:md()})}}:VK(e);function md(){if(window?.isElectron){const e=navigator.userAgent.toLowerCase();return e.includes("mac")||e.includes("darwin")?"mac":e.includes("win")?"win":"electron"}return"npm"}function GK(){return"production"}function oX(e){const t=GK();return{location:e,platform:md(),...t!==void 0?{environment:t}:{}}}var aX=5e3,xu=null;function cX(e=Date.now()){xu=e}function KK(e=Date.now()){if(xu===null)return!1;const t=e-xu;return t<0||t>1e4?(xu=null,!1):!0}var WK=Vx((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(KK()){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})})),JK=/\(ref ([0-9a-f]{16})\)\s*$/,YK=/^(?:\[CONVEX [A-Z]+\([^)]*\)\]\s*)?\[Request ID: ([0-9a-f]+)\]\s*([\s\S]*)$/,XK=/\[Request ID: ([0-9a-f]+)\]/,QK=/^\[[^\]]*\]\s*/,nx="Server Error",ZK="Something went wrong",gd=400;function ix(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(`
|
|
141
|
+
`)){const r=t.trim();if(r!==""){if(/^at\s/.test(r)||r==="Called by client")break;return r}}return""}function e9(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,gd);if(t&&typeof t=="object"&&"message"in t){const r=t.message;if(typeof r=="string"&&r.trim())return r.slice(0,gd)}}catch{return null}return null}function ox(e){const t=ix(e);return t?XK.exec(t)?.[1]??null:null}function t9(e){return`(ref ${e})`}function lX(e){const t=JK.exec(e);return t?{text:e.slice(0,t.index).trim(),requestId:t[1]}:{text:e,requestId:null}}function r9(e,t){const r=ox(e),s=e9(e);if(s)return{message:s,requestId:r,redacted:!1,refusal:!0};const n=ix(e);if(!n||!n.trim())return{message:t,requestId:r,redacted:!1,refusal:!1};const i=YK.exec(n);if(i){const o=i[2],a=eS(o.startsWith(nx)?o.slice(12):o);return a?{message:a.slice(0,gd),requestId:r,redacted:!1,refusal:!1}:{message:ZK,requestId:r,redacted:!0,refusal:!1}}return{message:eS(n.replace(QK,"")).slice(0,gd)||t,requestId:r,redacted:!1,refusal:!1}}function uX(e,t){const{message:r,requestId:s,refusal:n}=r9(e,t);return!s||n?r:`${r} ${t9(s)}`}function s9(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 dX(e,t){const r=typeof e?.message=="string"?e.message:"";return r.includes(`Q(${t})`)?s9(e)||r.includes(nx):!1}function n9(e){try{if(typeof e!="object"||e===null)return;const t=e.normalized;return I$(t)?t:void 0}catch{return}}function pX(e,t){try{if(!fl()||Wv(e)||Jv(e)||Yv(e))return!1;const r=n9(e)??Z$(e),s=X$(r);return s!=="mcpjam"?!1:(ax(e,{...t,extra:{...t.extra??{},slug:r.slug,origin:s}}),!0)}catch{return!1}}var i9=pR();function o9(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 ax(e,t){if(Wv(e)||Jv(e)||Yv(e))return;const r=YV(o9(e)),s=dR(r.message);if(s&&t.queryBackend&&(s.convex_backend=t.queryBackend),s&&i9(s.convex_backend,s.request_id))return;const n=s&&typeof window<"u"?mm(window.location.href):void 0,i=ox(e),o=i?{convex_request_id:i}:{},a=WK.getState(),c=a.recoveryId&&Date.now()-a.recoveryAt<3e5?{auth_recovery_id:a.recoveryId}:{};try{RV(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{fl()&&!T_()&&V8.captureException(r,{source:t.source,level:t.level??"error",...o,...s?{...s,page_location:n}:t.extra??{}})}catch{}}function hX(e,t,r){ax(e,{source:r?`react_boundary:${r}`:"react_boundary",extra:{componentStack:t?.componentStack??void 0,boundary:r??"unnamed"}})}export{b3 as $,wU as $a,cb as $i,AJ as $n,QM as $o,tm as $r,dY as $t,XY as A,V7 as Aa,jW as Ai,BJ as An,tE as Ao,fJ as Ar,bY as At,jP as B,QU as Ba,Tv as Bi,FJ as Bn,cN as Bo,dJ as Br,Jv as Bt,$K as C,G7 as Ca,hH as Ci,sV as Cn,X$ as Co,Gv as Cr,e3 as Ct,QY as D,H7 as Da,KW as Di,ju as Dn,g7 as Do,gJ as Dr,_Y as Dt,ZY as E,z7 as Ea,GW as Ei,ul as En,y$ as Eo,_J as Er,EY as Et,GY as F,Wy as Fa,Du as Fi,Q6 as Fn,Ts as Fo,$I as Fr,pR as Ft,G8 as G,O7 as Ga,uW as Gi,NJ as Gn,J9 as Go,oJ as Gr,pY as Gt,BY as H,D7 as Ha,AW as Hi,qJ as Hn,qk as Ho,aJ as Hr,JV as Ht,KY as I,U7 as Ia,KT as Ii,Z6 as In,Og as Io,Ii as Ir,fc as It,uK as J,Vy as Ja,Iz as Ji,LJ as Jn,W9 as Jo,X5 as Jr,Hu as Jt,FY as K,qU as Ka,Yz as Ki,UJ as Kn,mL as Ko,Q5 as Kr,hY as Kt,A_ as L,ZU as La,yv as Li,jJ as Ln,$n as Lo,xs as Lr,dR as Lt,IK as M,nq as Ma,kv as Mi,HJ as Mn,Zk as Mo,vn as Mr,wY as Mt,RK as N,Jy as Na,iT as Ni,KJ as Nn,VN as No,i6 as Nr,mY as Nt,YY as O,B7 as Oa,VW as Oi,vp as On,f$ as Oo,Un as Or,vY as Ot,WY as P,Jp as Pa,Av as Pi,Y6 as Pn,yy as Po,hJ as Pr,gY as Pt,OY as Q,R7 as Qa,qE as Qi,CJ as Qn,hL as Qo,lJ as Qr,sY as Qt,T_ as R,XU as Ra,sp as Ri,Zb as Rn,c7 as Ro,pJ as Rr,YV as Rt,DK as S,kq as Sa,JW as Si,nV as Sn,tD as So,Vv as Sr,t3 as St,xK as T,j7 as Ta,WW as Ti,QJ as Tn,v7 as To,vJ as Tr,kY as Tt,jY as U,N7 as Ua,TW as Ui,cm as Un,X9 as Uo,cJ as Ur,fY as Ut,HY as V,$7 as Va,Iv as Vi,z6 as Vn,Ag as Vo,e6 as Vr,Yv as Vt,VY as W,M7 as Wa,aF as Wi,DJ as Wn,Y9 as Wo,K5 as Wr,l0 as Wt,Gw as X,C7 as Xa,lW as Xi,xJ as Xn,fL as Xo,Y5 as Xr,nY as Xt,Kc as Y,RU as Ya,cW as Yi,MJ as Yn,G9 as Yo,W5 as Yr,lY as Yt,V8 as Z,P7 as Za,aW as Zi,PJ as Zn,K9 as Zo,J5 as Zr,RV as Zt,iX as _,J7 as _a,eJ as _i,rV as _n,Cf as _o,ll as _r,qn as _t,r9 as a,tW as aa,sJ as ai,rY as an,Hd as ao,EJ as ar,cg as as,NY as at,rX as b,Sq as ba,SI as bi,XI as bn,Z$ as bo,hp as br,IY as bt,dX as c,eW as ca,Hb as ci,tY as cn,T7 as co,gp as cr,fS as cs,vR as ct,WK as d,rv as da,zv as di,eY as dn,Md as do,SJ as dr,Vx as ds,xY as dt,sW as ea,pp as ei,cY as en,vU as eo,IJ as er,KM as es,UY as et,aX as f,$E as fa,xI as fi,ZJ as fn,S7 as fo,bJ as fr,Bx as fs,PY as ft,nX as g,Mq as ga,rJ as gi,iV as gn,iD as go,Wb as gr,zx as gs,u3 as gt,md as h,tb as ha,em as hi,WJ as hn,w7 as ho,om as hr,jx as hs,RY as ht,uX as i,yz as ia,nJ as ii,uY as in,jd as io,TJ as ir,M9 as is,y3 as it,eX as j,q7 as ja,CW as ji,VJ as jn,f7 as jo,mJ as jr,yY as jt,tX as k,Mf as ka,BW as ki,GJ as kn,m7 as ko,u6 as kr,Zv as kt,s9 as l,Q7 as la,dp as li,aV as ln,Bn as lo,ji as lr,f9 as ls,_3 as lt,cX as m,sb as ma,Is as mi,r0 as mn,k7 as mo,mp as mr,d9 as ms,CY as mt,ax as n,iW as na,iJ as ni,oY as nn,hU as no,L6 as nr,$M as ns,MY as nt,t9 as o,Z7 as oa,Fv as oi,mV as on,A7 as oo,kJ as or,CO as os,LY as ot,KK as p,rb as pa,hr as pi,oV as pn,kD as po,wJ as pr,sg as ps,$Y as pt,qP as q,wn as qa,GE as qi,$J as qn,Pd as qo,Bv as qr,Bu as qt,pX as r,oW as ra,G5 as ri,aY as rn,rU as ro,N6 as rr,L9 as rs,_m as rt,ox as s,dz as sa,ss as si,sR as sn,Fd as so,OJ as sr,nf as ss,DY as st,hX as t,nW as ta,B5 as ti,iY as tn,I7 as to,RJ as tr,NM as ts,w3 as tt,lX as u,Y7 as ua,al as ui,cV as un,E7 as uo,Hi as ur,m9 as us,v3 as ut,HK as v,Tq as va,ZW as vi,XJ as vn,b7 as vo,Wo as vr,AY as vt,JY as w,Eq as wa,fH as wi,JJ as wn,Lg as wo,h6 as wr,SY as wt,sX as x,K7 as xa,YW as xi,YJ as xn,I$ as xo,yJ as xr,TY as xt,oX as y,W7 as ya,w5 as yi,QI as yn,y7 as yo,fp as yr,n3 as yt,fl as z,L7 as za,Rv as zi,zJ as zn,iN as zo,uJ as zr,Wv as zt};
|
|
142
|
+
|
|
143
|
+
//# sourceMappingURL=error-reporting-RuZxlzDb.js.map
|