@deepailab/dal-remote-daemon 0.1.0 → 0.1.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.
Files changed (59) hide show
  1. package/NOTICE +21 -1
  2. package/THIRD-PARTY-NOTICES.md +192 -0
  3. package/node_modules/@deepailab/dal-remote-server/NOTICE +21 -1
  4. package/node_modules/@deepailab/dal-remote-server/dist/server/server/agent/providers/acp-agent.js +9 -5
  5. package/node_modules/@deepailab/dal-remote-server/dist/server/server/agent/providers/claude/query.js +3 -2
  6. package/node_modules/@deepailab/dal-remote-server/dist/server/server/agent/providers/claude/rewind.js +2 -2
  7. package/node_modules/@deepailab/dal-remote-server/dist/server/server/agent/providers/cursor-acp-agent.js +13 -9
  8. package/node_modules/@deepailab/dal-remote-server/dist/server/server/agent/providers/opencode/event-consumer.js +2 -2
  9. package/node_modules/@deepailab/dal-remote-server/dist/server/server/agent/providers/opencode/v2/runtime.js +2 -1
  10. package/node_modules/@deepailab/dal-remote-server/dist/server/server/agent/providers/opencode-agent.js +2 -2
  11. package/node_modules/@deepailab/dal-remote-server/dist/server/server/agent/providers/provider-sdk.js +46 -0
  12. package/node_modules/@deepailab/dal-remote-server/package.json +2 -5
  13. package/node_modules/@getpaseo/client/NOTICE +21 -1
  14. package/node_modules/@getpaseo/client/package.json +2 -1
  15. package/node_modules/@getpaseo/highlight/NOTICE +21 -1
  16. package/node_modules/@getpaseo/highlight/package.json +2 -1
  17. package/node_modules/@getpaseo/plugin/NOTICE +21 -1
  18. package/node_modules/@getpaseo/plugin/package.json +2 -1
  19. package/node_modules/@getpaseo/protocol/NOTICE +21 -1
  20. package/node_modules/@getpaseo/protocol/package.json +2 -1
  21. package/node_modules/@getpaseo/relay/NOTICE +21 -1
  22. package/node_modules/@getpaseo/relay/package.json +2 -1
  23. package/package.json +3 -8
  24. package/node_modules/@agentclientprotocol/sdk/LICENSE +0 -191
  25. package/node_modules/@agentclientprotocol/sdk/dist/acp.js +0 -1001
  26. package/node_modules/@agentclientprotocol/sdk/dist/schema/index.js +0 -32
  27. package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js +0 -2054
  28. package/node_modules/@agentclientprotocol/sdk/dist/stream.js +0 -64
  29. package/node_modules/@agentclientprotocol/sdk/package.json +0 -33
  30. package/node_modules/@anthropic-ai/claude-agent-sdk/LICENSE.md +0 -1
  31. package/node_modules/@anthropic-ai/claude-agent-sdk/package.json +0 -74
  32. package/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +0 -165
  33. package/node_modules/@deepailab/dal-remote-server/node_modules/@opencode-ai/sdk/dist/error-interceptor.js +0 -43
  34. package/node_modules/@deepailab/dal-remote-server/node_modules/@opencode-ai/sdk/dist/v2/client.js +0 -78
  35. package/node_modules/@deepailab/dal-remote-server/node_modules/@opencode-ai/sdk/dist/v2/gen/client/client.gen.js +0 -232
  36. package/node_modules/@deepailab/dal-remote-server/node_modules/@opencode-ai/sdk/dist/v2/gen/client/index.js +0 -6
  37. package/node_modules/@deepailab/dal-remote-server/node_modules/@opencode-ai/sdk/dist/v2/gen/client/utils.gen.js +0 -226
  38. package/node_modules/@deepailab/dal-remote-server/node_modules/@opencode-ai/sdk/dist/v2/gen/client.gen.js +0 -3
  39. package/node_modules/@deepailab/dal-remote-server/node_modules/@opencode-ai/sdk/dist/v2/gen/core/auth.gen.js +0 -14
  40. package/node_modules/@deepailab/dal-remote-server/node_modules/@opencode-ai/sdk/dist/v2/gen/core/bodySerializer.gen.js +0 -57
  41. package/node_modules/@deepailab/dal-remote-server/node_modules/@opencode-ai/sdk/dist/v2/gen/core/params.gen.js +0 -102
  42. package/node_modules/@deepailab/dal-remote-server/node_modules/@opencode-ai/sdk/dist/v2/gen/core/pathSerializer.gen.js +0 -106
  43. package/node_modules/@deepailab/dal-remote-server/node_modules/@opencode-ai/sdk/dist/v2/gen/core/queryKeySerializer.gen.js +0 -93
  44. package/node_modules/@deepailab/dal-remote-server/node_modules/@opencode-ai/sdk/dist/v2/gen/core/serverSentEvents.gen.js +0 -139
  45. package/node_modules/@deepailab/dal-remote-server/node_modules/@opencode-ai/sdk/dist/v2/gen/core/utils.gen.js +0 -87
  46. package/node_modules/@deepailab/dal-remote-server/node_modules/@opencode-ai/sdk/dist/v2/gen/sdk.gen.js +0 -3176
  47. package/node_modules/@deepailab/dal-remote-server/node_modules/@opencode-ai/sdk/dist/v2/gen/types.gen.js +0 -2
  48. package/node_modules/@deepailab/dal-remote-server/node_modules/@opencode-ai/sdk/package.json +0 -43
  49. package/node_modules/@opencode/client/dist/chunks/service-contender-1tbj6z39.js +0 -81
  50. package/node_modules/@opencode/client/dist/chunks/service-contender-4tveyqeh.js +0 -34
  51. package/node_modules/@opencode/client/dist/chunks/service-contender-7p1wryha.js +0 -30
  52. package/node_modules/@opencode/client/dist/chunks/service-contender-9rqn6x4v.js +0 -16
  53. package/node_modules/@opencode/client/dist/chunks/service-contender-frbwqjmf.js +0 -145
  54. package/node_modules/@opencode/client/dist/chunks/service-contender-m2eywc8w.js +0 -0
  55. package/node_modules/@opencode/client/dist/chunks/service-contender-n3c99vt5.js +0 -11
  56. package/node_modules/@opencode/client/dist/chunks/service-contender-radw39tv.js +0 -1402
  57. package/node_modules/@opencode/client/dist/chunks/service-contender-vyas3vgt.js +0 -0
  58. package/node_modules/@opencode/client/dist/promise/index.js +0 -79
  59. package/node_modules/@opencode/client/package.json +0 -54
@@ -1,165 +0,0 @@
1
- #!/usr/bin/env node
2
- // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
3
-
4
- // Version: 0.3.246
5
-
6
- // Want to see the unminified source? We're hiring!
7
- // https://job-boards.greenhouse.io/anthropic/jobs/4816199008
8
- import{createRequire as $Q}from"node:module";var PQ=Object.create;var{getPrototypeOf:IQ,defineProperty:QS,getOwnPropertyNames:DQ}=Object;var LQ=Object.prototype.hasOwnProperty;function MQ(e){return this[e]}var NQ,UQ,Hn=(e,t,n)=>{var r=e!=null&&typeof e==="object";if(r){var o=t?NQ??=new WeakMap:UQ??=new WeakMap,s=o.get(e);if(s)return s}n=e!=null?PQ(IQ(e)):{};let i=t||!e||!e.__esModule?QS(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let a of DQ(e))if(!LQ.call(i,a))QS(i,a,{get:MQ.bind(e,a),enumerable:!0})}if(r)o.set(e,i);return i};var T=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var FQ=(e)=>e;function jQ(e,t){this[e]=FQ.bind(null,t)}var rn=(e,t)=>{for(var n in t)QS(e,n,{get:t[n],enumerable:!0,configurable:!0,set:jQ.bind(t,n)})};var O=(e,t)=>()=>(e&&(t=e(e=0)),t);var ue=$Q(import.meta.url),zQ=Symbol.dispose||Symbol.for("Symbol.dispose"),HQ=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),Ft=(e,t,n)=>{if(t!=null){if(typeof t!=="object"&&typeof t!=="function")throw TypeError('Object expected to be assigned to "using" declaration');var r;if(n)r=t[HQ];if(r===void 0)r=t[zQ];if(typeof r!=="function")throw TypeError("Object not disposable");e.push([n,r,t])}else if(n)e.push([n]);return t},jt=(e,t,n)=>{var r=typeof SuppressedError==="function"?SuppressedError:function(i,a,c,l){return l=Error(c),l.name="SuppressedError",l.error=i,l.suppressed=a,l},o=(i)=>t=n?new r(i,t,"An error was suppressed during disposal"):(n=!0,i),s=(i)=>{while(i=e.pop())try{var a=i[1]&&i[1].call(i[2]);if(i[0])return Promise.resolve(a).then(s,(c)=>(o(c),s()))}catch(c){o(c)}if(n)throw t};return s()};var fL,AE;var TE=O(()=>{fL=globalThis.process?.getBuiltinModule?.("async_hooks"),AE=fL?(e)=>fL.AsyncResource.bind(e):(e)=>e});function Ie(e){if(!e)return!1;if(typeof e==="boolean")return e;let t=String(e).toLowerCase().trim();return["1","true","yes","on"].includes(t)}function wh(e){if(e===void 0)return!1;if(typeof e==="boolean")return!e;let t=String(e).toLowerCase().trim();return["0","false","no","off"].includes(t)}function $t(){let e=new Set;return{subscribe(t){let n=AE(t);return e.add(n),()=>{e.delete(n)}},emit(...t){let n;for(let r of e)try{r(...t)}catch(o){(n??=[]).push(o)}if(n)throw n.length===1?n[0]:AggregateError(n,"Signal listener(s) threw")},clear(){e.clear()}}}var mL=O(()=>{TE()});var hL=()=>{};var bd=O(()=>{TE();mL();hL()});function L(e,t,n,r,o){if(r==="m")throw TypeError("Private method is not writable");if(r==="a"&&!o)throw TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!o:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?o.call(e,n):o?o.value=n:t.set(e,n),n}function E(e,t,n,r){if(n==="a"&&!r)throw TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!r:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)}var Kn=()=>{};var Tc=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return Tc=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(r)=>(+r^n()&15>>+r/4).toString(16))};function Pr(e){return typeof e==="object"&&e!==null&&(("name"in e)&&e.name==="AbortError"||("message"in e)&&String(e.message).includes("FetchRequestCanceledException"))}var Yi=(e)=>{if(e instanceof Error)return e;if(typeof e==="object"&&e!==null){try{if(Object.prototype.toString.call(e)==="[object Error]"){let t=Error(e.message,e.cause?{cause:e.cause}:{});if(e.stack)t.stack=e.stack;if(e.cause&&!t.cause)t.cause=e.cause;if(e.name)t.name=e.name;return t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)};var z,Dt,fn,ps,wd,kh,Ad,Td,Cd,kd,Rd,Od,Pd,Id;var pt=O(()=>{z=class z extends Error{};Dt=class Dt extends z{constructor(e,t,n,r,o){super(`${Dt.makeMessage(e,t,n)}`);this.status=e,this.headers=r,this.requestID=r?.get("request-id"),this.error=t,this.type=o??null}static makeMessage(e,t,n){let r=t?.message?typeof t.message==="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;if(e&&r)return`${e} ${r}`;if(e)return`${e} status code (no body)`;if(r)return r;return"(no status code or body)"}static generate(e,t,n,r){if(!e||!r)return new ps({message:n,cause:Yi(t)});let o=t,s=o?.error?.type;if(e===400)return new Ad(e,o,n,r,s);if(e===401)return new Td(e,o,n,r,s);if(e===403)return new Cd(e,o,n,r,s);if(e===404)return new kd(e,o,n,r,s);if(e===409)return new Rd(e,o,n,r,s);if(e===422)return new Od(e,o,n,r,s);if(e===429)return new Pd(e,o,n,r,s);if(e>=500)return new Id(e,o,n,r,s);return new Dt(e,o,n,r,s)}};fn=class fn extends Dt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}};ps=class ps extends Dt{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0);if(t)this.cause=t}};wd=class wd extends ps{constructor({message:e}={}){super({message:e??"Request timed out."})}};kh=class kh extends z{constructor(e,{cause:t}={}){super(e??"Retryable error.");if(t!==void 0)this.cause=t}};Ad=class Ad extends Dt{};Td=class Td extends Dt{};Cd=class Cd extends Dt{};kd=class kd extends Dt{};Rd=class Rd extends Dt{};Od=class Od extends Dt{};Pd=class Pd extends Dt{};Id=class Id extends Dt{}});function Dd(e){if(typeof e!=="object")return{};return e??{}}function DE(e){if(!e)return!0;for(let t in e)return!1;return!0}function ZL(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Cne,VL=(e)=>Cne.test(e),vn=(e)=>(vn=Array.isArray,vn(e)),IE,YL=(e,t)=>{if(typeof t!=="number"||!Number.isInteger(t))throw new z(`${e} must be an integer`);if(t<0)throw new z(`${e} must be a positive integer`);return t},Ld=(e)=>{try{return JSON.parse(e)}catch(t){return}};var no=O(()=>{pt();Cne=/^[a-z][a-z0-9+.-]*:/i,IE=vn});var ro=(e,t)=>new Promise((n)=>{if(t?.aborted)return n();let r=()=>{clearTimeout(o),n()},o=setTimeout(()=>{t?.removeEventListener("abort",r),n()},e);t?.addEventListener("abort",r,{once:!0})});var Ir="0.112.1";function kne(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}function One(){if(typeof navigator>"u"||!navigator)return null;let e=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:t,pattern:n}of e){let r=n.exec(navigator.userAgent);if(r){let o=r[1]||0,s=r[2]||0,i=r[3]||0;return{browser:t,version:`${o}.${s}.${i}`}}}return null}var e0=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",Rne=()=>{let e=kne();if(e==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ir,"X-Stainless-OS":XL(Deno.build.os),"X-Stainless-Arch":JL(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ir,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(e==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ir,"X-Stainless-OS":XL(globalThis.process.platform??"unknown"),"X-Stainless-Arch":JL(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let t=One();if(t)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ir,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ir,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},JL=(e)=>{if(e==="x32")return"x32";if(e==="x86_64"||e==="x64")return"x64";if(e==="arm")return"arm";if(e==="aarch64"||e==="arm64")return"arm64";if(e)return`other:${e}`;return"unknown"},XL=(e)=>{if(e=e.toLowerCase(),e.includes("ios"))return"iOS";if(e==="android")return"Android";if(e==="darwin")return"MacOS";if(e==="win32")return"Windows";if(e==="freebsd")return"FreeBSD";if(e==="openbsd")return"OpenBSD";if(e==="linux")return"Linux";if(e)return`Other:${e}`;return"Unknown"},QL,Md=()=>QL??(QL=Rne());var Rh=()=>{};function t0(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function LE(...e){let t=globalThis.ReadableStream;if(typeof t>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function Oh(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return LE({start(){},async pull(n){let{done:r,value:o}=await t.next();if(r)n.close();else n.enqueue(o)},async cancel(){await t.return?.()}})}function Nd(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let n=await t.read();if(n?.done)t.releaseLock();return n}catch(n){throw t.releaseLock(),n}},async return(){let n=t.cancel();return t.releaseLock(),await n,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function n0(e){if(e===null||typeof e!=="object")return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}var r0=({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});var ME="RFC3986",NE=(e)=>String(e),UE,o0="RFC1738";var FE=O(()=>{UE={RFC1738:(e)=>String(e).replace(/%20/g,"+"),RFC3986:NE}});function i0(e){if(!e||typeof e!=="object")return!1;return!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function $E(e,t){if(vn(e)){let n=[];for(let r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)}var Ph=(e,t)=>(Ph=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Ph(e,t)),No,jE=1024,s0=(e,t,n,r,o)=>{if(e.length===0)return e;let s=e;if(typeof e==="symbol")s=Symbol.prototype.toString.call(e);else if(typeof e!=="string")s=String(e);if(n==="iso-8859-1")return escape(s).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let i="";for(let a=0;a<s.length;a+=jE){let c=s.length>=jE?s.slice(a,a+jE):s,l=[];for(let u=0;u<c.length;++u){let p=c.charCodeAt(u);if(p===45||p===46||p===95||p===126||p>=48&&p<=57||p>=65&&p<=90||p>=97&&p<=122||o===o0&&(p===40||p===41)){l[l.length]=c.charAt(u);continue}if(p<128){l[l.length]=No[p];continue}if(p<2048){l[l.length]=No[192|p>>6]+No[128|p&63];continue}if(p<55296||p>=57344){l[l.length]=No[224|p>>12]+No[128|p>>6&63]+No[128|p&63];continue}u+=1,p=65536+((p&1023)<<10|c.charCodeAt(u)&1023),l[l.length]=No[240|p>>18]+No[128|p>>12&63]+No[128|p>>6&63]+No[128|p&63]}i+=l.join("")}return i};var a0=O(()=>{FE();no();No=(()=>{let e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})()});function Dne(e){return typeof e==="string"||typeof e==="number"||typeof e==="boolean"||typeof e==="symbol"||typeof e==="bigint"}function d0(e,t,n,r,o,s,i,a,c,l,u,p,f,m,h,g,y,S){let b=e,x=S,v=0,A=!1;while((x=x.get(zE))!==void 0&&!A){let V=x.get(e);if(v+=1,typeof V<"u")if(V===v)throw RangeError("Cyclic object value");else A=!0;if(typeof x.get(zE)>"u")v=0}if(typeof l==="function")b=l(t,b);else if(b instanceof Date)b=f?.(b);else if(n==="comma"&&vn(b))b=$E(b,function(V){if(V instanceof Date)return f?.(V);return V});if(b===null){if(s)return c&&!g?c(t,Vt.encoder,y,"key",m):t;b=""}if(Dne(b)||i0(b)){if(c){let V=g?t:c(t,Vt.encoder,y,"key",m);return[h?.(V)+"="+h?.(c(b,Vt.encoder,y,"value",m))]}return[h?.(t)+"="+h?.(String(b))]}let U=[];if(typeof b>"u")return U;let D;if(n==="comma"&&vn(b)){if(g&&c)b=$E(b,c);D=[{value:b.length>0?b.join(",")||null:void 0}]}else if(vn(l))D=l;else{let V=Object.keys(b);D=u?V.sort(u):V}let F=a?String(t).replace(/\./g,"%2E"):String(t),K=r&&vn(b)&&b.length===1?F+"[]":F;if(o&&vn(b)&&b.length===0)return K+"[]";for(let V=0;V<D.length;++V){let ne=D[V],oe=typeof ne==="object"&&typeof ne.value<"u"?ne.value:b[ne];if(i&&oe===null)continue;let _e=p&&a?ne.replace(/\./g,"%2E"):ne,ke=vn(b)?typeof n==="function"?n(K,_e):K:K+(p?"."+_e:"["+_e+"]");S.set(e,v);let vt=new WeakMap;vt.set(zE,S),u0(U,d0(oe,ke,n,r,o,s,i,a,n==="comma"&&g&&vn(b)?null:c,l,u,p,f,m,h,g,y,vt))}return U}function Lne(e=Vt){if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!=="boolean")throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!=="boolean")throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!=="function")throw TypeError("Encoder has to be a function.");let t=e.charset||Vt.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=ME;if(typeof e.format<"u"){if(!Ph(UE,e.format))throw TypeError("Unknown format option provided.");n=e.format}let r=UE[n],o=Vt.filter;if(typeof e.filter==="function"||vn(e.filter))o=e.filter;let s;if(e.arrayFormat&&e.arrayFormat in l0)s=e.arrayFormat;else if("indices"in e)s=e.indices?"indices":"repeat";else s=Vt.arrayFormat;if("commaRoundTrip"in e&&typeof e.commaRoundTrip!=="boolean")throw TypeError("`commaRoundTrip` must be a boolean, or absent");let i=typeof e.allowDots>"u"?!!e.encodeDotInKeys===!0?!0:Vt.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix==="boolean"?e.addQueryPrefix:Vt.addQueryPrefix,allowDots:i,allowEmptyArrays:typeof e.allowEmptyArrays==="boolean"?!!e.allowEmptyArrays:Vt.allowEmptyArrays,arrayFormat:s,charset:t,charsetSentinel:typeof e.charsetSentinel==="boolean"?e.charsetSentinel:Vt.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?Vt.delimiter:e.delimiter,encode:typeof e.encode==="boolean"?e.encode:Vt.encode,encodeDotInKeys:typeof e.encodeDotInKeys==="boolean"?e.encodeDotInKeys:Vt.encodeDotInKeys,encoder:typeof e.encoder==="function"?e.encoder:Vt.encoder,encodeValuesOnly:typeof e.encodeValuesOnly==="boolean"?e.encodeValuesOnly:Vt.encodeValuesOnly,filter:o,format:n,formatter:r,serializeDate:typeof e.serializeDate==="function"?e.serializeDate:Vt.serializeDate,skipNulls:typeof e.skipNulls==="boolean"?e.skipNulls:Vt.skipNulls,sort:typeof e.sort==="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling==="boolean"?e.strictNullHandling:Vt.strictNullHandling}}function p0(e,t={}){let n=e,r=Lne(t),o,s;if(typeof r.filter==="function")s=r.filter,n=s("",n);else if(vn(r.filter))s=r.filter,o=s;let i=[];if(typeof n!=="object"||n===null)return"";let a=l0[r.arrayFormat],c=a==="comma"&&r.commaRoundTrip;if(!o)o=Object.keys(n);if(r.sort)o.sort(r.sort);let l=new WeakMap;for(let f=0;f<o.length;++f){let m=o[f];if(r.skipNulls&&n[m]===null)continue;u0(i,d0(n[m],m,a,c,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}let u=i.join(r.delimiter),p=r.addQueryPrefix===!0?"?":"";if(r.charsetSentinel)if(r.charset==="iso-8859-1")p+="utf8=%26%2310003%3B&";else p+="utf8=%E2%9C%93&";return u.length>0?p+u:""}var l0,u0=function(e,t){Array.prototype.push.apply(e,vn(t)?t:[t])},c0,Vt,zE;var f0=O(()=>{a0();FE();no();l0={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,t){return String(e)+"["+t+"]"},repeat(e){return String(e)}},Vt={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:s0,encodeValuesOnly:!1,format:ME,formatter:NE,indices:!1,serializeDate(e){return(c0??(c0=Function.prototype.call.bind(Date.prototype.toISOString)))(e)},skipNulls:!1,strictNullHandling:!1};zE={}});function m0(e){return p0(e,{arrayFormat:"brackets"})}var HE=O(()=>{f0()});function Dh(e){if(!e)return;let t;try{t=new URL(e)}catch(r){throw new et(`Invalid token endpoint base URL "${e}": ${r}`)}if(t.protocol==="https:")return;let n=t.hostname.toLowerCase().replace(/^\[|\]$/g,"");if(t.protocol==="http:"&&(n==="localhost"||n==="127.0.0.1"||n==="::1"))return;throw new et(`Refusing to send credential over non-https token endpoint "${e}"`)}async function Lh(e,t){let n=await Une(e),r;try{r=JSON.parse(n)}catch{throw new et(`Token endpoint returned non-JSON response (status ${e.status})`,e.status,Gn(n),t)}if(!r.access_token)throw new et(`Token endpoint response missing access_token: ${JSON.stringify(Gn(r))}`,e.status,Gn(r),t);if(r.token_type&&r.token_type.toLowerCase()!=="bearer")throw new et(`Token endpoint response: unsupported token_type "${r.token_type}" (want Bearer)`,e.status,Gn(r),t);return r}function Gn(e){if(e==null)return e;if(typeof e==="string"){let t;try{t=JSON.parse(e)}catch{if(e.length<=BE)return e;return e.slice(0,BE)+`... <${e.length-BE} more chars>`}return JSON.stringify(Gn(t))}if(typeof e==="object"&&!Array.isArray(e)){let t={};for(let[n,r]of Object.entries(e))if(Nne.has(n))t[n]=r;return t}return null}async function Mh(e,t=(n)=>console.warn(`anthropic-sdk: ${n}`)){if(typeof process>"u"||process.platform==="win32")return;let n=await import("node:fs"),r=e,o;try{r=await n.promises.realpath(e),o=await n.promises.stat(r)}catch{return}let s=o.mode&511;if(s&18)throw new et(`Credentials file at ${r} is group/world-writable (mode 0o${s.toString(8)}); this allows other local users to plant tokens. Run \`chmod 600 ${r}\`.`);if(s&36)throw new et(`Credentials file at ${r} is group/world-readable (mode 0o${s.toString(8)}); run \`chmod 600 ${r}\` before retrying.`);if(typeof process.getuid==="function"&&o.uid!==process.getuid())t(`credentials file at ${r} is owned by uid ${o.uid} (current process uid ${process.getuid()}); verify this is intentional.`)}async function Nh(e,t){let n=await import("node:fs"),o=(await import("node:path")).dirname(e);await n.promises.mkdir(o,{recursive:!0,mode:448});let s=`${e}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{let i=await n.promises.open(s,"w",384);try{await i.writeFile(JSON.stringify(t,null,2)),await i.sync()}finally{await i.close()}await n.promises.rename(s,e)}catch(i){throw await n.promises.unlink(s).catch(()=>{}),i}try{let i=await n.promises.open(o,"r");try{await i.sync()}finally{await i.close()}}catch{}}async function Une(e){if(!e.body)return"";let t=e.body.getReader(),n=[],r=0;for(;;){let{done:s,value:i}=await t.read();if(s)break;if(r+i.length>h0){let a=h0-r;if(a>0)n.push(i.subarray(0,a));await t.cancel();break}n.push(i),r+=i.length}let o;if(n.length===1)o=n[0];else{o=new Uint8Array(n.reduce((i,a)=>i+a.length,0));let s=0;for(let i of n)o.set(i,s),s+=i.length}return new TextDecoder("utf-8").decode(o)}var g0="urn:ietf:params:oauth:grant-type:jwt-bearer",_0="refresh_token",Ih="/v1/oauth/token",Ji="oauth-2025-04-20",y0="oidc-federation-2026-04-01",b0=120,Cc=30,S0=5,h0=1048576,BE=2000,Nne,et;var kc=O(()=>{pt();Nne=new Set(["error","error_description","error_uri"]);et=class et extends z{constructor(e,t=null,n=null,r=null){super(e);this.statusCode=t,this.body=n,this.requestId=r}}});function oo(){return Math.floor(Date.now()/1000)}class KE{constructor(e,t){this.cached=null,this.pendingRefresh=null,this.nextForce=!1,this.lastAdvisoryError=0,this.provider=e,this.onAdvisoryRefreshError=t}async getToken(){let e=this.nextForce;this.nextForce=!1;let t=this.cached;if(e||t==null)return(await this.refresh(e)).token;if(t.expiresAt==null)return t.token;let n=t.expiresAt-oo();if(n>b0)return t.token;if(n>Cc)return this.backgroundRefresh(),t.token;return(await this.refresh()).token}invalidate(){this.cached=null,this.nextForce=!0}refresh(e=!1){if(this.pendingRefresh&&!e)return this.pendingRefresh;return this.doRefresh(e)}backgroundRefresh(){if(this.pendingRefresh)return;if(oo()-this.lastAdvisoryError<S0)return;this.doRefresh().catch((e)=>{this.lastAdvisoryError=oo(),this.onAdvisoryRefreshError?.(e)})}doRefresh(e=!1){return this.pendingRefresh=this.provider(e?{forceRefresh:!0}:void 0).then((t)=>(this.cached=t,this.pendingRefresh=null,t),(t)=>{throw this.pendingRefresh=null,t}),this.pendingRefresh}}var E0=O(()=>{kc()});var Le=(e)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[e]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(e)?.trim()||void 0;return};function w0(e){let t=0;for(let o of e)t+=o.length;let n=new Uint8Array(t),r=0;for(let o of e)n.set(o,r),r+=o.length;return n}function Rc(e){let t;return(x0??(t=new globalThis.TextEncoder,x0=t.encode.bind(t)))(e)}function GE(e){let t;return(v0??(t=new globalThis.TextDecoder,v0=t.decode.bind(t)))(e)}var x0,v0;var A0=O(()=>{pt()});function Ud(){}function Uh(e,t,n){if(!t||Fh[e]>Fh[n])return Ud;else return t[e].bind(t)}function qE(e,t){let n=T0.get(e);if(n&&n[0]===t)return n[1];let r={error:Uh("error",e,t),warn:Uh("warn",e,t),info:Uh("info",e,t),debug:Uh("debug",e,t)};return T0.set(e,[t,r]),r}function Be(e){let t=e.logger,n=e.logLevel??"off";if(!t)return Fne;return qE(t,n)}function k0(){let e=Le("ANTHROPIC_LOG");if(!WE||e!==C0)C0=e,WE=qE(console,jh(e,"process.env['ANTHROPIC_LOG']",qE(console,Fd))??Fd);return WE}var Fd="warn",Fh,jh=(e,t,n)=>{if(!e)return;if(ZL(Fh,e))return e;n.warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Fh))}`);return},Fne,T0,C0,WE,Uo=(e)=>{if(e.options)e.options={...e.options},delete e.options.headers;if(e.headers)e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([t,n])=>[t,t.toLowerCase()==="authorization"||t.toLowerCase()==="api-key"||t.toLowerCase()==="x-api-key"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":n]));if("retryOfRequestLogID"in e){if(e.retryOfRequestLogID)e.retryOf=e.retryOfRequestLogID;delete e.retryOfRequestLogID}return e};var Fo=O(()=>{no();Fh={off:0,error:200,warn:300,info:400,debug:500};Fne={error:Ud,warn:Ud,info:Ud,debug:Ud},T0=new WeakMap});var VE=O(()=>{no();A0();Fo();HE()});function R0(e){if(!e)throw Error("profile name is empty");if(e==="."||e==="..")throw Error(`profile name "${e}" is not allowed`);if(e.includes("/")||e.includes("\\"))throw Error(`profile name "${e}" must not contain path separators`);if(!jne.test(e))throw Error(`profile name "${e}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`)}var $h="1.0",jne,O0=async(e)=>{var t,n;let r=await ZE();if(r===null)return null;let o=e??await I0();if(o===null)return null;R0(o);let s=await import("node:fs"),a=(await import("node:path")).join(r,"configs",`${o}.json`),c;try{c=await s.promises.readFile(a,"utf-8")}catch(p){if(p?.code!=="ENOENT")throw Error(`failed to read config file ${a}: ${p}`);c=null}if(c===null){let p=Le("ANTHROPIC_ORGANIZATION_ID"),f=Le("ANTHROPIC_IDENTITY_TOKEN_FILE"),m=Le("ANTHROPIC_FEDERATION_RULE_ID");if(m&&p)return{fromFile:!1,config:{organization_id:p,workspace_id:Le("ANTHROPIC_WORKSPACE_ID"),base_url:Le("ANTHROPIC_BASE_URL"),authentication:{type:"oidc_federation",federation_rule_id:m,service_account_id:Le("ANTHROPIC_SERVICE_ACCOUNT_ID"),identity_token:f?{source:"file",path:f}:void 0,scope:Le("ANTHROPIC_SCOPE")}}};return null}let l;try{l=JSON.parse(c)}catch(p){throw Error(`failed to parse config file ${a}: ${p}`)}if(!l.authentication)throw Error(`config file ${a} is missing "authentication"`);let u=l.authentication.type;if(u!=="oidc_federation"&&u!=="user_oauth")throw Error(`authentication.type "${u}" is not a known authentication type`);if(l.organization_id??(l.organization_id=Le("ANTHROPIC_ORGANIZATION_ID")),l.workspace_id??(l.workspace_id=Le("ANTHROPIC_WORKSPACE_ID")),l.base_url??(l.base_url=Le("ANTHROPIC_BASE_URL")),(t=l.authentication).scope??(t.scope=Le("ANTHROPIC_SCOPE")),l.authentication.type==="oidc_federation"){if(!l.authentication.identity_token){let p=Le("ANTHROPIC_IDENTITY_TOKEN_FILE");if(p)l.authentication.identity_token={source:"file",path:p}}if(!l.authentication.federation_rule_id)l.authentication.federation_rule_id=Le("ANTHROPIC_FEDERATION_RULE_ID")??"";(n=l.authentication).service_account_id??(n.service_account_id=Le("ANTHROPIC_SERVICE_ACCOUNT_ID"))}return{config:l,fromFile:!0}},P0=async(e,t)=>{if(e?.authentication.credentials_path)return e.authentication.credentials_path;let n=await ZE();if(!n)return null;let r=t??await I0();if(!r)return null;return R0(r),(await import("node:path")).join(n,"credentials",`${r}.json`)},ZE=async()=>{if(!$ne())return null;let e=await import("node:path"),t=Le("ANTHROPIC_CONFIG_DIR");if(t)return t;if(Md()["X-Stainless-OS"]==="Windows"){let s=Le("APPDATA");if(s)return e.join(s,"Anthropic");let i=Le("USERPROFILE");if(i)return e.join(i,"AppData","Roaming","Anthropic");return null}let r=Le("XDG_CONFIG_HOME");if(r)return e.join(r,"anthropic");let o=Le("HOME");if(o)return e.join(o,".config","anthropic");return null},$ne=()=>{let e=Md()["X-Stainless-Runtime"];return e==="node"||e==="deno"},I0=async()=>{let e=await ZE();if(!e)return null;let t=Le("ANTHROPIC_PROFILE");if(t)return t;let n=await import("node:fs"),o=(await import("node:path")).join(e,"active_config");try{return(await n.promises.readFile(o,"utf-8")).trim()||"default"}catch(s){if(s?.code!=="ENOENT")throw Error(`failed to read ${o}: ${s}`);return"default"}};var YE=O(()=>{Rh();VE();jne=/^[A-Za-z0-9_.-]+$/});function JE(e){if(!e)throw new z("Identity token file path is empty");return async()=>{let t=await import("node:fs"),n;try{n=await t.promises.readFile(e,"utf-8")}catch(o){throw new z(`Failed to read identity token file at ${e}: ${o}`)}let r=n.trim();if(!r)throw new z(`Identity token file at ${e} is empty`);return r}}function D0(e){if(!e)throw new z("Identity token value is empty");return()=>e}var L0=O(()=>{pt()});function M0(e){return async()=>{Dh(e.baseURL);let t=await e.identityTokenProvider();if(t.length>16384)throw new et(`Identity token is ${Math.ceil(t.length/1024)} KiB, exceeds the 16 KiB assertion limit`);let n={grant_type:g0,assertion:t,federation_rule_id:e.federationRuleId,organization_id:e.organizationId};if(e.serviceAccountId)n.service_account_id=e.serviceAccountId;if(e.workspaceId)n.workspace_id=e.workspaceId;let r=`${e.baseURL}${Ih}`,o;try{o=await e.fetch(r,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":`${Ji},${y0}`,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${Ir} oidcFederationProvider`},body:JSON.stringify(n)})}catch(c){throw new et(`Failed to reach token endpoint ${r}: ${c}`)}let s=o.headers.get("Request-Id");if(!o.ok){let c=await o.text().catch(()=>""),l=Gn(c),u="";if(o.status===401)u=` Ensure your federation rule matches your identity token. ${e.workspaceId?"":"If your federation rule is scoped to multiple workspaces, set the ANTHROPIC_WORKSPACE_ID environment variable, the 'workspace_id' config key, or the `workspaceId` option. "}View your authentication events in the Workload identity page of Claude Console for more details.`;throw new et(`Token exchange failed with status ${o.status}${s?` (request-id ${s})`:""}: ${l}${u}`,o.status,l,s)}let i=await Lh(o,s),a=Number(i.expires_in);if(!Number.isFinite(a))throw new et(`Token endpoint response missing required fields: ${JSON.stringify(Gn(i))}`,o.status,Gn(i),s);return{token:i.access_token,expiresAt:oo()+a}}}var N0=O(()=>{kc()});function U0(e){return async(t)=>{let n=await import("node:fs");await Mh(e.credentialsPath,e.onSafetyWarning);let r;try{r=await n.promises.readFile(e.credentialsPath,"utf-8")}catch(y){throw new et(`Credentials file not found at ${e.credentialsPath}: ${y}`)}let o;try{o=JSON.parse(r)}catch(y){throw new et(`Credentials file at ${e.credentialsPath} is not valid JSON: ${y}`)}let s=o.access_token;if(!s)throw new et(`Credentials file at ${e.credentialsPath} must include 'access_token'`);let i=o.expires_at;if(!t?.forceRefresh&&(i==null||oo()<i-Cc))return{token:s,expiresAt:i??null};let a=o.refresh_token;if(!e.clientId||!a)throw new et(`Access token at ${e.credentialsPath} has expired and no refresh is available (client_id ${e.clientId?"set":"empty"}, refresh_token ${a?"set":"empty"})`);Dh(e.baseURL);let c={grant_type:_0,refresh_token:a,client_id:e.clientId},l=`${e.baseURL}${Ih}`,u;try{u=await e.fetch(l,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":Ji,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${Ir} userOAuthProvider`},body:JSON.stringify(c)})}catch(y){throw new et(`User OAuth refresh failed to reach token endpoint: ${y}`)}let p=u.headers.get("Request-Id");if(!u.ok){let y=await u.text().catch(()=>"");throw new et(`User OAuth refresh failed (HTTP ${u.status}): ${Gn(y)}`,u.status,Gn(y),p)}let f=await Lh(u,p),m=Number(f.expires_in);if(!Number.isFinite(m))throw new et(`User OAuth refresh response missing or invalid expires_in: ${JSON.stringify(Gn(f))}`,u.status,Gn(f),p);let h=oo()+m,g=f.refresh_token||a;return await Nh(e.credentialsPath,{...o,version:$h,type:"oauth_token",access_token:f.access_token,expires_at:h,refresh_token:g}),{token:f.access_token,expiresAt:h}}}var F0=O(()=>{YE();kc()});function XE(e,t){let n=e.authentication.credentials_path??null,r=(e.base_url||t.baseURL).replace(/\/+$/,""),o=zne(e,n,r,t),s={};if(e.workspace_id&&e.authentication.type==="user_oauth")s["anthropic-workspace-id"]=e.workspace_id;return{provider:o,extraHeaders:s,baseURL:e.base_url||void 0}}async function j0(e,t){let n=await O0(t);if(!n)return null;let{config:r,fromFile:o}=n,s=r.authentication.credentials_path||!o?r:{...r,authentication:{...r.authentication,credentials_path:await P0(r,t)??void 0}};return XE(s,e)}function zne(e,t,n,r){switch(e.authentication.type){case"oidc_federation":{let o=e.authentication,s=Hne(o);if(!s)throw new et("oidc_federation config requires an identity token (set authentication.identity_token, ANTHROPIC_IDENTITY_TOKEN_FILE, or ANTHROPIC_IDENTITY_TOKEN)");if(!o.federation_rule_id)throw new et("oidc_federation config requires 'federation_rule_id'. Set it in authentication.federation_rule_id in your profile, or via ANTHROPIC_FEDERATION_RULE_ID (profile takes precedence).");if(!e.organization_id)throw new et("oidc_federation config requires organization_id (set ANTHROPIC_ORGANIZATION_ID or config.organization_id)");let i=M0({identityTokenProvider:s,federationRuleId:o.federation_rule_id,organizationId:e.organization_id,serviceAccountId:o.service_account_id,workspaceId:e.workspace_id,baseURL:n,fetch:r.fetch,userAgent:r.userAgent});if(t)return Bne(i,t,r.onCacheWriteError,r.onSafetyWarning);return i}case"user_oauth":{if(!t)throw new et("user_oauth config requires authentication.credentials_path (or load via a profile so it defaults to <config_dir>/credentials/<profile>.json)");return U0({credentialsPath:t,clientId:e.authentication.client_id,baseURL:n,fetch:r.fetch,userAgent:r.userAgent,onSafetyWarning:r.onSafetyWarning})}default:{let o=e.authentication.type;throw new et(`authentication.type "${o}" is not a known authentication type`)}}}function Hne(e){if(e.identity_token){let r=e.identity_token.source;if(r!=="file")throw new et(`identity_token.source "${r}" is not supported by this SDK version (only "file")`);if(!e.identity_token.path)throw new et('identity_token.source "file" requires a non-empty path');return JE(e.identity_token.path)}let t=Le("ANTHROPIC_IDENTITY_TOKEN_FILE");if(t)return JE(t);let n=Le("ANTHROPIC_IDENTITY_TOKEN");if(n)return D0(n);return null}function Bne(e,t,n,r){return async(o)=>{let s=await import("node:fs");await Mh(t,r);let i;try{let c=await s.promises.readFile(t,"utf-8");i=JSON.parse(c);let l=i?.access_token;if(l&&!o?.forceRefresh){let u=i?.expires_at;if(u==null||oo()<u-Cc)return{token:l,expiresAt:u??null}}}catch(c){if(c?.code!=="ENOENT"&&!(c instanceof SyntaxError))n?.(c)}let a=await e(o);try{await Nh(t,{...i??{},version:$h,type:"oauth_token",access_token:a.token,expires_at:a.expiresAt})}catch(c){n?.(c)}return a}}var $0=O(()=>{YE();kc();L0();N0();F0()});class Ws{constructor(){fr.set(this,void 0),mr.set(this,void 0),L(this,fr,new Uint8Array,"f"),L(this,mr,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==="string"?Rc(e):e;L(this,fr,w0([E(this,fr,"f"),t]),"f");let n=[],r;while((r=Kne(E(this,fr,"f"),E(this,mr,"f")))!=null){if(r.carriage&&E(this,mr,"f")==null){L(this,mr,r.index,"f");continue}if(E(this,mr,"f")!=null&&(r.index!==E(this,mr,"f")+1||r.carriage)){n.push(GE(E(this,fr,"f").subarray(0,E(this,mr,"f")-1))),L(this,fr,E(this,fr,"f").subarray(E(this,mr,"f")),"f"),L(this,mr,null,"f");continue}let o=E(this,mr,"f")!==null?r.preceding-1:r.preceding,s=GE(E(this,fr,"f").subarray(0,o));n.push(s),L(this,fr,E(this,fr,"f").subarray(r.index),"f"),L(this,mr,null,"f")}return n}flush(){if(!E(this,fr,"f").length)return[];return this.decode(`
9
- `)}}function Kne(e,t){for(let o=t??0;o<e.length;o++){if(e[o]===10)return{preceding:o,index:o+1,carriage:!1};if(e[o]===13)return{preceding:o,index:o+1,carriage:!0}}return null}function z0(e){for(let r=0;r<e.length-1;r++){if(e[r]===10&&e[r+1]===10)return r+2;if(e[r]===13&&e[r+1]===13)return r+2;if(e[r]===13&&e[r+1]===10&&r+3<e.length&&e[r+2]===13&&e[r+3]===10)return r+4}return-1}var fr,mr;var QE=O(()=>{Kn();fr=new WeakMap,mr=new WeakMap;Ws.NEWLINE_CHARS=new Set([`
10
- `,"\r"]);Ws.NEWLINE_REGEXP=/\r\n|[\n\r]/g});async function*H0(e,t){if(!e.body){if(t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new z("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new z("Attempted to iterate over a response with no body")}let n=new B0,r=new Ws,o=Nd(e.body);for await(let s of Gne(o))for(let i of r.decode(s)){let a=n.decode(i);if(a)yield a}for(let s of r.flush()){let i=n.decode(s);if(i)yield i}}async function*Gne(e){let t=new Uint8Array;for await(let n of e){if(n==null)continue;let r=n instanceof ArrayBuffer?new Uint8Array(n):typeof n==="string"?Rc(n):n,o=new Uint8Array(t.length+r.length);o.set(t),o.set(r,t.length),t=o;let s;while((s=z0(t))!==-1)yield t.slice(0,s),t=t.slice(s)}if(t.length>0)yield t}class B0{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r"))e=e.substring(0,e.length-1);if(!e){if(!this.event&&!this.data.length)return null;let o={event:this.event,data:this.data.join(`
11
- `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],o}if(this.chunks.push(e),e.startsWith(":"))return null;let[t,n,r]=Wne(e,":");if(r.startsWith(" "))r=r.substring(1);if(t==="event")this.event=r;else if(t==="data")this.data.push(r);return null}}function Wne(e,t){let n=e.indexOf(t);if(n!==-1)return[e.substring(0,n),t,e.substring(n+t.length)];return[e,"",""]}var jd,wn;var $d=O(()=>{Kn();pt();QE();no();Fo();pt();wn=class wn{constructor(e,t,n){this.iterator=e,jd.set(this,void 0),this.controller=t,L(this,jd,n,"f")}static rawEvents(e,t=new AbortController){return H0(e,t)}static fromSSEResponse(e,t,n){let r=!1,o=n?Be(n):console;async function*s(){if(r)throw new z("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let i=!1;try{for await(let a of H0(e,t)){if(a.event==="completion")try{yield JSON.parse(a.data)}catch(c){throw o.error("Could not parse message into JSON:",a.data),o.error("From chunk:",a.raw),c}if(a.event==="message_start"||a.event==="message_delta"||a.event==="message_stop"||a.event==="content_block_start"||a.event==="content_block_delta"||a.event==="content_block_stop"||a.event==="message"||a.event==="user.message"||a.event==="user.interrupt"||a.event==="user.tool_confirmation"||a.event==="user.custom_tool_result"||a.event==="user.tool_result"||a.event==="agent.message"||a.event==="agent.thinking"||a.event==="agent.tool_use"||a.event==="agent.tool_result"||a.event==="agent.mcp_tool_use"||a.event==="agent.mcp_tool_result"||a.event==="agent.custom_tool_use"||a.event==="agent.thread_context_compacted"||a.event==="session.status_running"||a.event==="session.status_idle"||a.event==="session.status_rescheduled"||a.event==="session.status_terminated"||a.event==="session.error"||a.event==="session.deleted"||a.event==="session.updated"||a.event==="span.model_request_start"||a.event==="span.model_request_end"||a.event==="span.outcome_evaluation_start"||a.event==="span.outcome_evaluation_ongoing"||a.event==="span.outcome_evaluation_end"||a.event==="user.define_outcome"||a.event==="agent.thread_message_received"||a.event==="agent.thread_message_sent"||a.event==="agent.session_thread_message_received"||a.event==="agent.session_thread_message_sent"||a.event==="session.thread_created"||a.event==="session.thread_status_created"||a.event==="session.thread_status_running"||a.event==="session.thread_status_idle"||a.event==="session.thread_status_rescheduled"||a.event==="session.thread_status_terminated"||a.event==="event_start"||a.event==="event_delta"||a.event==="system.message")try{yield JSON.parse(a.data)}catch(c){throw o.error("Could not parse message into JSON:",a.data),o.error("From chunk:",a.raw),c}if(a.event==="ping")continue;if(a.event==="error"){let c=Ld(a.data)??a.data,l=c?.error?.type;throw new Dt(void 0,c,void 0,e.headers,l)}}i=!0}catch(a){if(Pr(a))return;throw a}finally{if(!i)t.abort()}}return new wn(s,t,n)}static fromReadableStream(e,t,n){let r=!1;async function*o(){let i=new Ws,a=Nd(e);for await(let c of a)for(let l of i.decode(c))yield l;for(let c of i.flush())yield c}async function*s(){if(r)throw new z("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let i=!1;try{for await(let a of o()){if(i)continue;if(a)yield JSON.parse(a)}i=!0}catch(a){if(Pr(a))return;throw a}finally{if(!i)t.abort()}}return new wn(s,t,n)}[(jd=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],t=[],n=this.iterator(),r=(o)=>({next:()=>{if(o.length===0){let s=n.next();e.push(s),t.push(s)}return o.shift()}});return[new wn(()=>r(e),this.controller,E(this,jd,"f")),new wn(()=>r(t),this.controller,E(this,jd,"f"))]}toReadableStream(){let e=this,t;return LE({async start(){t=e[Symbol.asyncIterator]()},async pull(n){try{let{value:r,done:o}=await t.next();if(o)return n.close();let s=Rc(JSON.stringify(r)+`
12
- `);n.enqueue(s)}catch(r){n.error(r)}},async cancel(){await t.return?.()}})}}});async function zh(e,t){let{response:n,requestLogID:r,retryOfRequestLogID:o,startTime:s}=t,i=await(async()=>{if(t.options.stream)return Be(e).debug("response",n.status,n.url,n.headers,n.body),wn.fromSSEResponse(n,t.controller);if(n.status===204)return null;if(t.options.__binaryResponse)return n;let c=n.headers.get("content-type")?.split(";")[0]?.trim();if(c?.includes("application/json")||c?.endsWith("+json")){if(n.headers.get("content-length")==="0")return;let f=await n.json();return zd(f,n)}return await n.text()})();return Be(e).debug(`[${r}] response parsed`,Uo({retryOfRequestLogID:o,url:n.url,status:n.status,body:i,durationMs:Date.now()-s})),i}function zd(e,t){if(!e||typeof e!=="object"||Array.isArray(e))return e;return Object.defineProperty(e,"_request_id",{value:t.headers.get("request-id"),enumerable:!1})}var Hh=O(()=>{$d();Fo()});function ex(e){return typeof e==="object"&&e!==null&&G0.has(e)}function W0(e){let t=new Set;while(typeof e==="object"&&e!==null&&!t.has(e)){if(t.add(e),ex(e)||Pr(e)||e instanceof ps||e instanceof kh)return!0;e=e.cause}return!1}function tx(e,t,n,r){return async(o,s={})=>{if(t.length===0)return e.call(void 0,o,s);let i=s.headers instanceof Headers?s.headers:new Headers(s.headers),a=await Vne(e,t,n,r)({...s,headers:i,url:typeof o==="string"?o:o instanceof URL?o.href:o.url});if(a.bodyUsed||a.body?.locked)throw new z("middleware consumed the response body; use response.clone() to inspect it, or return new Response(body, response) to consume and replace it");return a}}function qne(e,t){let n=new WeakMap;return{options:e,logger:t?Be(t):k0(),parse(r){if(e?.stream&&r.ok)return K0(r,e);let o=n.get(r);if(!o)o=K0(r,e),n.set(r,o);return o}}}async function K0(e,t){if(e.bodyUsed||e.body?.locked)throw new z("cannot ctx.parse() a response whose body was already consumed; call ctx.parse() instead of reading the body, or read via response.clone()");if(t?.stream&&e.ok)return wn.fromSSEResponse(e.clone(),new AbortController);if(e.status===204)return null;if(t?.__binaryResponse)return e;let r=e.headers.get("content-type")?.split(";")[0]?.trim();if(r?.includes("application/json")||r?.endsWith("+json")){if(e.headers.get("content-length")==="0")return;return zd(await e.clone().json(),e)}return await e.clone().text()}function Vne(e,t,n,r){let o=async({url:i,...a})=>{try{return await e.call(void 0,i,a)}catch(c){let l=Yi(c);throw G0.add(l),l}},s=qne(n,r);for(let i=t.length-1;i>=0;i--){let a=t[i],c=o;o=async(l)=>a(l,c,s)}return o}var G0;var q0=O(()=>{Hh();Fo();pt();$d();G0=new WeakSet});var Hd,Xi;var Bh=O(()=>{Kn();Hh();Xi=class Xi extends Promise{constructor(e,t,n=zh){super((r)=>{r(null)});this.responsePromise=t,this.parseResponse=n,Hd.set(this,void 0),L(this,Hd,e,"f")}_thenUnwrap(e){return new Xi(E(this,Hd,"f"),this.responsePromise,async(t,n)=>zd(e(await this.parseResponse(t,n),n),n.response))}asResponse(){return this.responsePromise.then((e)=>e.response)}async withResponse(){let[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t,request_id:t.headers.get("request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then((e)=>this.parseResponse(E(this,Hd,"f"),e));return this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};Hd=new WeakMap});var Kh,Gh,Wh,so,ve,nx;var Xe=O(()=>{Kn();pt();Hh();Bh();no();Gh=class Gh{constructor(e,t,n,r){Kh.set(this,void 0),L(this,Kh,e,"f"),this.options=r,this.response=t,this.body=n}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new z("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await E(this,Kh,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;yield e;while(e.hasNextPage())e=await e.getNextPage(),yield e}async*[(Kh=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let t of e.getPaginatedItems())yield t}};Wh=class Wh extends Xi{constructor(e,t,n){super(e,t,async(r,o)=>new n(r,o.response,await zh(r,o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let t of e)yield t}};so=class so extends Gh{constructor(e,t,n,r){super(e,t,n,r);this.data=n.data||[],this.has_more=n.has_more||!1,this.first_id=n.first_id||null,this.last_id=n.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let t=this.first_id;if(!t)return null;return{...this.options,query:{...Dd(this.options.query),before_id:t}}}let e=this.last_id;if(!e)return null;return{...this.options,query:{...Dd(this.options.query),after_id:e}}}};ve=class ve extends Gh{constructor(e,t,n,r){super(e,t,n,r);this.data=n.data||[],this.next_page=n.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let e=this.next_page;if(!e)return null;return{...this.options,query:{...Dd(this.options.query),page:e}}}};nx=class nx extends Gh{constructor(e,t,n,r){super(e,t,n,r);this.data=n.data||[],this.next_page=n.next_page||null,this.prev_page=n.prev_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let e=this.next_page;if(!e)return null;return{...this.options,query:{...Dd(this.options.query),page:e}}}}});function Qi(e,t,n){return ox(),new File(e,t??"unknown_file",n)}function Bd(e,t){let n=typeof e==="object"&&e!==null&&(("name"in e)&&e.name&&String(e.name)||("url"in e)&&e.url&&String(e.url)||("filename"in e)&&e.filename&&String(e.filename)||("path"in e)&&e.path&&String(e.path))||"";return t?n.split(/[\\/]/).pop()||void 0:n}function Yne(e){let t=typeof e==="function"?e:e.fetch,n=V0.get(t);if(n)return n;let r=(async()=>{try{let o="Response"in t?t.Response:(await t("data:,")).constructor,s=new FormData;if(s.toString()===await new o(s).text())return!1;return!0}catch{return!0}})();return V0.set(t,r),r}var ox=()=>{if(typeof File>"u"){let{process:e}=globalThis,t=typeof e?.versions?.node==="string"&&parseInt(e.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(t?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}},sx=(e)=>e!=null&&typeof e==="object"&&typeof e[Symbol.asyncIterator]==="function",Oc=async(e,t,n=!0)=>({...e,body:await Jne(e.body,t,n)}),V0,Jne=async(e,t,n=!0)=>{if(!await Yne(t))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(e||{}).map(([o,s])=>rx(r,o,s,n))),r},Xne=(e)=>e instanceof Blob&&("name"in e),rx=async(e,t,n,r)=>{if(n===void 0)return;if(n==null)throw TypeError(`Received null for "${t}"; to pass null in FormData, you must use the string 'null'`);if(typeof n==="string"||typeof n==="number"||typeof n==="boolean")e.append(t,String(n));else if(n instanceof Response){let o={},s=n.headers.get("Content-Type");if(s)o={type:s};e.append(t,Qi([await n.blob()],Bd(n,r),o))}else if(sx(n))e.append(t,Qi([await new Response(Oh(n)).blob()],Bd(n,r)));else if(Xne(n))e.append(t,Qi([n],Bd(n,r),{type:n.type}));else if(Array.isArray(n))await Promise.all(n.map((o)=>rx(e,t+"[]",o,r)));else if(typeof n==="object")await Promise.all(Object.entries(n).map(([o,s])=>rx(e,`${t}[${o}]`,s,r)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${n} instead`)};var Pc=O(()=>{V0=new WeakMap});async function qh(e,t,n){if(ox(),e=await e,t||(t=Bd(e,!0)),Qne(e)){if(e instanceof File&&t==null&&n==null)return e;return Qi([await e.arrayBuffer()],t??e.name,{type:e.type,lastModified:e.lastModified,...n})}if(ere(e)){let o=await e.blob();return t||(t=new URL(e.url).pathname.split(/[\\/]/).pop()),Qi(await ix(o),t,n)}let r=await ix(e);if(!n?.type){let o=r.find((s)=>typeof s==="object"&&("type"in s)&&s.type);if(typeof o==="string")n={...n,type:o}}return Qi(r,t,n)}async function ix(e){let t=[];if(typeof e==="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(Z0(e))t.push(e instanceof Blob?e:await e.arrayBuffer());else if(sx(e))for await(let n of e)t.push(...await ix(n));else{let n=e?.constructor?.name;throw Error(`Unexpected data type: ${typeof e}${n?`; constructor: ${n}`:""}${tre(e)}`)}return t}function tre(e){if(typeof e!=="object"||e===null)return"";return`; props: [${Object.getOwnPropertyNames(e).map((n)=>`"${n}"`).join(", ")}]`}var Z0=(e)=>e!=null&&typeof e==="object"&&typeof e.size==="number"&&typeof e.type==="string"&&typeof e.text==="function"&&typeof e.slice==="function"&&typeof e.arrayBuffer==="function",Qne=(e)=>e!=null&&typeof e==="object"&&typeof e.name==="string"&&typeof e.lastModified==="number"&&Z0(e),ere=(e)=>e!=null&&typeof e==="object"&&typeof e.url==="string"&&typeof e.blob==="function";var Y0=O(()=>{Pc();Pc()});var ax=O(()=>{Y0()});var J0=()=>{};class re{constructor(e){this._client=e}}function*rre(e){if(!e)return;if(X0 in e){let{values:r,nulls:o}=e;yield*r.entries();for(let s of o)yield[s,null];return}let t=!1,n;if(e instanceof Headers)n=e.entries();else if(IE(e))n=e;else t=!0,n=Object.entries(e??{});for(let r of n){let o=r[0];if(typeof o!=="string")throw TypeError("expected header name to be a string");let s=IE(r[1])?r[1]:[r[1]],i=!1;for(let a of s){if(a===void 0)continue;if(t&&!i)i=!0,yield[o,Vh];yield[o,a]}}}var X0,Vh,ore,Q0=(e,t)=>{let n=e?e.split(",").map((r)=>r.trim()).filter(Boolean):[];for(let r of t.split(",").map((o)=>o.trim()))if(r&&!n.includes(r))n.push(r);return n.join(", ")},k=(e)=>{let t=new Headers,n=new Set;for(let r of e){let o=new Set;for(let[s,i]of rre(r)){let a=s.toLowerCase();if(ore.has(a)){if(i===Vh)continue;if(i===null)t.delete(s),n.add(a);else t.set(s,Q0(t.get(s),i)),n.delete(a);continue}if(i===Vh||!o.has(a)){if(t.delete(s),o.add(a),i===Vh)continue}if(i===null)t.delete(s),n.add(a);else t.append(s,i),n.delete(a)}}return{[X0]:!0,values:t,nulls:n}};var Me=O(()=>{no();X0=Symbol.for("brand.privateNullableHeaders");Vh=Symbol("clear"),ore=new Set(["x-stainless-helper"])});function tM(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var eM,sre=(e=tM)=>function(n,...r){if(n.length===1)return n[0];let o=!1,s=[],i=n.reduce((u,p,f)=>{if(/[?#]/.test(p))o=!0;let m=r[f],h=(o?encodeURIComponent:e)(""+m);if(f!==r.length&&(m==null||typeof m==="object"&&m.toString===Object.getPrototypeOf(Object.getPrototypeOf(m.hasOwnProperty??eM)??eM)?.toString))h=m+"",s.push({start:u.length+p.length,length:h.length,error:`Value of type ${Object.prototype.toString.call(m).slice(8,-1)} is not a valid path parameter`});return u+p+(f===r.length?"":h)},""),a=i.split(/[?#]/,1)[0],c=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,l;while((l=c.exec(a))!==null)s.push({start:l.index,length:l[0].length,error:`Value "${l[0]}" can't be safely passed as a path parameter`});if(s.sort((u,p)=>u.start-p.start),s.length>0){let u=0,p=s.reduce((f,m)=>{let h=" ".repeat(m.start-u),g="^".repeat(m.length);return u=m.start+m.length,f+h+g},"");throw new z(`Path parameters result in path with invalid segments:
13
- ${s.map((f)=>f.error).join(`
14
- `)}
15
- ${i}
16
- ${p}`)}return i},N;var ot=O(()=>{pt();eM=Object.freeze(Object.create(null)),N=sre(tM)});var Kd;var cx=O(()=>{Xe();Me();ot();Kd=class Kd extends re{retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(N`/v1/deployment_runs/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/deployment_runs?beta=true",ve,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}}});var Gd;var lx=O(()=>{Xe();Me();ot();Gd=class Gd extends re{create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/deployments?beta=true",{body:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(N`/v1/deployments/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}update(e,t,n){let{betas:r,...o}=t;return this._client.post(N`/v1/deployments/${e}?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/deployments?beta=true",ve,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(N`/v1/deployments/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}pause(e,t={},n){let{betas:r}=t??{};return this._client.post(N`/v1/deployments/${e}/pause?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}run(e,t={},n){let{betas:r}=t??{};return this._client.post(N`/v1/deployments/${e}/run?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}unpause(e,t={},n){let{betas:r}=t??{};return this._client.post(N`/v1/deployments/${e}/unpause?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}}});var Wd;var ux=O(()=>{Xe();Me();ot();Wd=class Wd extends re{create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/dreams?beta=true",{body:r,...t,headers:k([{"anthropic-beta":[...n??[],"dreaming-2026-04-21"].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(N`/v1/dreams/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"dreaming-2026-04-21"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/dreams?beta=true",ve,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"dreaming-2026-04-21"].toString()},t?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(N`/v1/dreams/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"dreaming-2026-04-21"].toString()},n?.headers])})}cancel(e,t={},n){let{betas:r}=t??{};return this._client.post(N`/v1/dreams/${e}/cancel?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"dreaming-2026-04-21"].toString()},n?.headers])})}}});function Zd(e){return{["x-stainless-helper"]:e}}function Zh(e){return typeof e==="object"&&e!==null&&qd in e}function dx(e,t){let n=new Set;if(e){for(let r of e)if(Zh(r))n.add(r[qd])}if(t)for(let r of t){if(Zh(r))n.add(r[qd]);let o=r.content;if(Array.isArray(o)){for(let s of o)if(Zh(s))n.add(s[qd])}}return Array.from(n)}function Jh(e,t){let n=dx(e,t);if(n.length===0)return{};return{["x-stainless-helper"]:n.join(", ")}}function nM(e){if(Zh(e))return{["x-stainless-helper"]:e[qd]};return{}}var Vd="x-stainless-helper",Yh="x-stainless-helper-method",qd;var jo=O(()=>{qd=Symbol("anthropic.sdk.stainlessHelper")});var Yd;var px=O(()=>{Xe();Me();jo();Pc();ot();Yd=class Yd extends re{list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/files?beta=true",so,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(N`/v1/files/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString()},n?.headers])})}download(e,t={},n){let{betas:r}=t??{};return this._client.get(N`/v1/files/${e}/content?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}retrieveMetadata(e,t={},n){let{betas:r}=t??{};return this._client.get(N`/v1/files/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString()},n?.headers])})}upload(e,t){let{betas:n,...r}=e;return this._client.post("/v1/files?beta=true",Oc({body:r,...t,headers:k([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},nM(r.file),t?.headers])},this._client))}}});var Jd;var fx=O(()=>{Xe();Me();ot();Jd=class Jd extends re{retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(N`/v1/models/${e}?beta=true`,{...n,headers:k([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/models?beta=true",so,{query:r,...t,headers:k([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},t?.headers])})}}});var Xd;var mx=O(()=>{Xe();Me();ot();Xd=class Xd extends re{create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/user_profiles?beta=true",{body:r,...t,headers:k([{"anthropic-beta":[...n??[],"user-profiles-2026-03-24"].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(N`/v1/user_profiles/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"user-profiles-2026-03-24"].toString()},n?.headers])})}update(e,t,n){let{betas:r,...o}=t;return this._client.post(N`/v1/user_profiles/${e}?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"user-profiles-2026-03-24"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/user_profiles?beta=true",ve,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"user-profiles-2026-03-24"].toString()},t?.headers])})}createEnrollmentURL(e,t={},n){let{betas:r}=t??{};return this._client.post(N`/v1/user_profiles/${e}/enrollment_url?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"user-profiles-2026-03-24"].toString()},n?.headers])})}}});var iM=T(function(oM){Object.defineProperty(oM,"__esModule",{value:!0});oM.timingSafeEqual=void 0;function rM(e,t=""){if(!e)throw Error(t)}function pre(e,t){if(e.byteLength!==t.byteLength)return!1;if(!(e instanceof DataView))e=new DataView(ArrayBuffer.isView(e)?e.buffer:e);if(!(t instanceof DataView))t=new DataView(ArrayBuffer.isView(t)?t.buffer:t);rM(e instanceof DataView),rM(t instanceof DataView);let n=e.byteLength,r=0,o=-1;while(++o<n)r|=e.getUint8(o)^t.getUint8(o);return r===0}oM.timingSafeEqual=pre});var lM=T(function(hr){var fre=hr&&hr.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(o.hasOwnProperty(s))r[s]=o[s]},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(hr,"__esModule",{value:!0});var Wt=256,hx=function(){function e(t){if(t===void 0)t="=";this._paddingCharacter=t}return e.prototype.encodedLength=function(t){if(!this._paddingCharacter)return(t*8+5)/6|0;return(t+2)/3*4|0},e.prototype.encode=function(t){var n="",r=0;for(;r<t.length-2;r+=3){var o=t[r]<<16|t[r+1]<<8|t[r+2];n+=this._encodeByte(o>>>18&63),n+=this._encodeByte(o>>>12&63),n+=this._encodeByte(o>>>6&63),n+=this._encodeByte(o>>>0&63)}var s=t.length-r;if(s>0){var o=t[r]<<16|(s===2?t[r+1]<<8:0);if(n+=this._encodeByte(o>>>18&63),n+=this._encodeByte(o>>>12&63),s===2)n+=this._encodeByte(o>>>6&63);else n+=this._paddingCharacter||"";n+=this._paddingCharacter||""}return n},e.prototype.maxDecodedLength=function(t){if(!this._paddingCharacter)return(t*6+7)/8|0;return t/4*3|0},e.prototype.decodedLength=function(t){return this.maxDecodedLength(t.length-this._getPaddingLength(t))},e.prototype.decode=function(t){if(t.length===0)return new Uint8Array(0);var n=this._getPaddingLength(t),r=t.length-n,o=new Uint8Array(this.maxDecodedLength(r)),s=0,i=0,a=0,c=0,l=0,u=0,p=0;for(;i<r-4;i+=4)c=this._decodeChar(t.charCodeAt(i+0)),l=this._decodeChar(t.charCodeAt(i+1)),u=this._decodeChar(t.charCodeAt(i+2)),p=this._decodeChar(t.charCodeAt(i+3)),o[s++]=c<<2|l>>>4,o[s++]=l<<4|u>>>2,o[s++]=u<<6|p,a|=c&Wt,a|=l&Wt,a|=u&Wt,a|=p&Wt;if(i<r-1)c=this._decodeChar(t.charCodeAt(i)),l=this._decodeChar(t.charCodeAt(i+1)),o[s++]=c<<2|l>>>4,a|=c&Wt,a|=l&Wt;if(i<r-2)u=this._decodeChar(t.charCodeAt(i+2)),o[s++]=l<<4|u>>>2,a|=u&Wt;if(i<r-3)p=this._decodeChar(t.charCodeAt(i+3)),o[s++]=u<<6|p,a|=p&Wt;if(a!==0)throw Error("Base64Coder: incorrect characters for decoding");return o},e.prototype._encodeByte=function(t){var n=t;return n+=65,n+=25-t>>>8&6,n+=51-t>>>8&-75,n+=61-t>>>8&-15,n+=62-t>>>8&3,String.fromCharCode(n)},e.prototype._decodeChar=function(t){var n=Wt;return n+=(42-t&t-44)>>>8&-Wt+t-43+62,n+=(46-t&t-48)>>>8&-Wt+t-47+63,n+=(47-t&t-58)>>>8&-Wt+t-48+52,n+=(64-t&t-91)>>>8&-Wt+t-65+0,n+=(96-t&t-123)>>>8&-Wt+t-97+26,n},e.prototype._getPaddingLength=function(t){var n=0;if(this._paddingCharacter){for(var r=t.length-1;r>=0;r--){if(t[r]!==this._paddingCharacter)break;n++}if(t.length<4||n>2)throw Error("Base64Coder: incorrect padding")}return n},e}();hr.Coder=hx;var Qd=new hx;function mre(e){return Qd.encode(e)}hr.encode=mre;function hre(e){return Qd.decode(e)}hr.decode=hre;var aM=function(e){fre(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype._encodeByte=function(n){var r=n;return r+=65,r+=25-n>>>8&6,r+=51-n>>>8&-75,r+=61-n>>>8&-13,r+=62-n>>>8&49,String.fromCharCode(r)},t.prototype._decodeChar=function(n){var r=Wt;return r+=(44-n&n-46)>>>8&-Wt+n-45+62,r+=(94-n&n-96)>>>8&-Wt+n-95+63,r+=(47-n&n-58)>>>8&-Wt+n-48+52,r+=(64-n&n-91)>>>8&-Wt+n-65+0,r+=(96-n&n-123)>>>8&-Wt+n-97+26,r},t}(hx);hr.URLSafeCoder=aM;var cM=new aM;function gre(e){return cM.encode(e)}hr.encodeURLSafe=gre;function _re(e){return cM.decode(e)}hr.decodeURLSafe=_re;hr.encodedLength=function(e){return Qd.encodedLength(e)};hr.maxDecodedLength=function(e){return Qd.maxDecodedLength(e)};hr.decodedLength=function(e){return Qd.decodedLength(e)}});var dM=T(function(uM,Xh){(function(e,t){var n={};t(n);var r=n.default;for(var o in n)r[o]=n[o];if(typeof Xh==="object"&&typeof Xh.exports==="object")Xh.exports=r;else if(typeof define==="function"&&define.amd)define(function(){return r});else e.sha256=r})(uM,function(e){e.__esModule=!0,e.digestLength=32,e.blockSize=64;var t=new Uint32Array([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]);function n(p,f,m,h,g){var y,S,b,x,v,A,U,D,F,K,V,ne,oe;while(g>=64){y=f[0],S=f[1],b=f[2],x=f[3],v=f[4],A=f[5],U=f[6],D=f[7];for(K=0;K<16;K++)V=h+K*4,p[K]=(m[V]&255)<<24|(m[V+1]&255)<<16|(m[V+2]&255)<<8|m[V+3]&255;for(K=16;K<64;K++)F=p[K-2],ne=(F>>>17|F<<15)^(F>>>19|F<<13)^F>>>10,F=p[K-15],oe=(F>>>7|F<<25)^(F>>>18|F<<14)^F>>>3,p[K]=(ne+p[K-7]|0)+(oe+p[K-16]|0);for(K=0;K<64;K++)ne=(((v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7))+(v&A^~v&U)|0)+(D+(t[K]+p[K]|0)|0)|0,oe=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&S^y&b^S&b)|0,D=U,U=A,A=v,v=x+ne|0,x=b,b=S,S=y,y=ne+oe|0;f[0]+=y,f[1]+=S,f[2]+=b,f[3]+=x,f[4]+=v,f[5]+=A,f[6]+=U,f[7]+=D,h+=64,g-=64}return h}var r=function(){function p(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return p.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},p.prototype.clean=function(){for(var f=0;f<this.buffer.length;f++)this.buffer[f]=0;for(var f=0;f<this.temp.length;f++)this.temp[f]=0;this.reset()},p.prototype.update=function(f,m){if(m===void 0)m=f.length;if(this.finished)throw Error("SHA256: can't update because hash was finished.");var h=0;if(this.bytesHashed+=m,this.bufferLength>0){while(this.bufferLength<64&&m>0)this.buffer[this.bufferLength++]=f[h++],m--;if(this.bufferLength===64)n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0}if(m>=64)h=n(this.temp,this.state,f,h,m),m%=64;while(m>0)this.buffer[this.bufferLength++]=f[h++],m--;return this},p.prototype.finish=function(f){if(!this.finished){var m=this.bytesHashed,h=this.bufferLength,g=m/536870912|0,y=m<<3,S=m%64<56?64:128;this.buffer[h]=128;for(var b=h+1;b<S-8;b++)this.buffer[b]=0;this.buffer[S-8]=g>>>24&255,this.buffer[S-7]=g>>>16&255,this.buffer[S-6]=g>>>8&255,this.buffer[S-5]=g>>>0&255,this.buffer[S-4]=y>>>24&255,this.buffer[S-3]=y>>>16&255,this.buffer[S-2]=y>>>8&255,this.buffer[S-1]=y>>>0&255,n(this.temp,this.state,this.buffer,0,S),this.finished=!0}for(var b=0;b<8;b++)f[b*4+0]=this.state[b]>>>24&255,f[b*4+1]=this.state[b]>>>16&255,f[b*4+2]=this.state[b]>>>8&255,f[b*4+3]=this.state[b]>>>0&255;return this},p.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},p.prototype._saveState=function(f){for(var m=0;m<this.state.length;m++)f[m]=this.state[m]},p.prototype._restoreState=function(f,m){for(var h=0;h<this.state.length;h++)this.state[h]=f[h];this.bytesHashed=m,this.finished=!1,this.bufferLength=0},p}();e.Hash=r;var o=function(){function p(f){this.inner=new r,this.outer=new r,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var m=new Uint8Array(this.blockSize);if(f.length>this.blockSize)new r().update(f).finish(m).clean();else for(var h=0;h<f.length;h++)m[h]=f[h];for(var h=0;h<m.length;h++)m[h]^=54;this.inner.update(m);for(var h=0;h<m.length;h++)m[h]^=106;this.outer.update(m),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var h=0;h<m.length;h++)m[h]=0}return p.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},p.prototype.clean=function(){for(var f=0;f<this.istate.length;f++)this.ostate[f]=this.istate[f]=0;this.inner.clean(),this.outer.clean()},p.prototype.update=function(f){return this.inner.update(f),this},p.prototype.finish=function(f){if(this.outer.finished)this.outer.finish(f);else this.inner.finish(f),this.outer.update(f,this.digestLength).finish(f);return this},p.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},p}();e.HMAC=o;function s(p){var f=new r().update(p),m=f.digest();return f.clean(),m}e.hash=s,e.default=s;function i(p,f){var m=new o(p).update(f),h=m.digest();return m.clean(),h}e.hmac=i;function a(p,f,m,h){var g=h[0];if(g===0)throw Error("hkdf: cannot expand more");if(f.reset(),g>1)f.update(p);if(m)f.update(m);f.update(h),f.finish(p),h[0]++}var c=new Uint8Array(e.digestLength);function l(p,f,m,h){if(f===void 0)f=c;if(h===void 0)h=32;var g=new Uint8Array([1]),y=i(f,p),S=new o(y),b=new Uint8Array(S.digestLength),x=b.length,v=new Uint8Array(h);for(var A=0;A<h;A++){if(x===b.length)a(b,S,m,g),x=0;v[A]=b[x++]}return S.clean(),b.fill(0),g.fill(0),v}e.hkdf=l;function u(p,f,m,h){var g=new o(p),y=g.digestLength,S=new Uint8Array(4),b=new Uint8Array(y),x=new Uint8Array(y),v=new Uint8Array(h);for(var A=0;A*y<h;A++){var U=A+1;S[0]=U>>>24&255,S[1]=U>>>16&255,S[2]=U>>>8&255,S[3]=U>>>0&255,g.reset(),g.update(f),g.update(S),g.finish(x);for(var D=0;D<y;D++)b[D]=x[D];for(var D=2;D<=m;D++){g.reset(),g.update(x).finish(x);for(var F=0;F<y;F++)b[F]^=x[F]}for(var D=0;D<y&&A*y+D<h;D++)v[A*y+D]=b[D]}for(var A=0;A<y;A++)b[A]=x[A]=0;for(var A=0;A<4;A++)S[A]=0;return g.clean(),v}e.pbkdf2=u})});var gM=T(function(mM){Object.defineProperty(mM,"__esModule",{value:!0});mM.Webhook=mM.WebhookVerificationError=void 0;var yre=iM(),pM=lM(),bre=dM(),fM=300;class gx extends Error{constructor(e){super(e);Object.setPrototypeOf(this,gx.prototype),this.name="ExtendableError",this.stack=Error(e).stack}}class qs extends gx{constructor(e){super(e);Object.setPrototypeOf(this,qs.prototype),this.name="WebhookVerificationError"}}mM.WebhookVerificationError=qs;class ep{constructor(e,t){if(!e)throw Error("Secret can't be empty.");if((t===null||t===void 0?void 0:t.format)==="raw")if(e instanceof Uint8Array)this.key=e;else this.key=Uint8Array.from(e,(n)=>n.charCodeAt(0));else{if(typeof e!=="string")throw Error("Expected secret to be of type string");if(e.startsWith(ep.prefix))e=e.substring(ep.prefix.length);this.key=pM.decode(e)}}verify(e,t){let n={};for(let p of Object.keys(t))n[p.toLowerCase()]=t[p];let r=n["webhook-id"],o=n["webhook-signature"],s=n["webhook-timestamp"];if(!o||!r||!s)throw new qs("Missing required headers");let i=this.verifyTimestamp(s),c=this.sign(r,i,e).split(",")[1],l=o.split(" "),u=new globalThis.TextEncoder;for(let p of l){let[f,m]=p.split(",");if(f!=="v1")continue;if((0,yre.timingSafeEqual)(u.encode(m),u.encode(c)))return JSON.parse(e.toString())}throw new qs("No matching signature found")}sign(e,t,n){if(typeof n==="string");else if(n.constructor.name==="Buffer")n=n.toString();else throw Error("Expected payload to be of type string or Buffer.");let r=new TextEncoder,o=Math.floor(t.getTime()/1000),s=r.encode(`${e}.${o}.${n}`);return`v1,${pM.encode(bre.hmac(this.key,s))}`}verifyTimestamp(e){let t=Math.floor(Date.now()/1000),n=parseInt(e,10);if(isNaN(n))throw new qs("Invalid Signature Headers");if(t-n>fM)throw new qs("Message timestamp too old");if(n>t+fM)throw new qs("Message timestamp too new");return new Date(n*1000)}}mM.Webhook=ep;ep.prefix="whsec_"});var _M,tp;var _x=O(()=>{_M=Hn(gM(),1);tp=class tp extends re{unwrap(e,{headers:t,key:n}){if(t!==void 0){let r=n===void 0?this._client.webhookKey:n;if(r===null)throw Error("Webhook key must not be null in order to unwrap");new _M.Webhook(r).verify(e,t)}return JSON.parse(e)}}});var np;var yx=O(()=>{Xe();Me();ot();np=class np extends re{list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(N`/v1/agents/${e}/versions?beta=true`,ve,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}}});var Ic;var bx=O(()=>{yx();yx();Xe();Me();ot();Ic=class Ic extends re{constructor(){super(...arguments);this.versions=new np(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/agents?beta=true",{body:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r,...o}=t??{};return this._client.get(N`/v1/agents/${e}?beta=true`,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}update(e,t,n){let{betas:r,...o}=t;return this._client.post(N`/v1/agents/${e}?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/agents?beta=true",ve,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(N`/v1/agents/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}};Ic.Versions=np});function ea(e,t){if(!e)return()=>{};if(e.aborted)return t.abort(),()=>{};let n=()=>t.abort();return e.addEventListener("abort",n),()=>e.removeEventListener("abort",n)}function Vs(e,t){return e instanceof Dt&&e.status===t}function yM(e){return e instanceof Dt&&typeof e.status==="number"&&e.status>=400&&e.status<500}function Zs(e){return yM(e)&&!Vs(e,408)&&!Vs(e,409)&&!Vs(e,429)}function bM(e,t,n){return Math.min(t*2**e,n)}function Sx(e,t){return e+Math.random()*(t-e)}function SM(e){return e*(1-Math.random()*0.25)}var rp=O(()=>{pt()});function Qh(e,{authToken:t,helper:n}){if(!t)throw new z(`copyClientForHelper: expected a non-empty authToken but received ${JSON.stringify(t)}`);let r=e,o=r._options.defaultHeaders,s=r._authState?.extraHeaders,i=s?Object.fromEntries(Object.entries(s).filter(([c])=>{let l=c.toLowerCase();return l!=="authorization"&&l!=="x-api-key"})):void 0,a=k([i,o,{[Vd]:n}]);return e.withOptions({apiKey:null,authToken:t,baseURL:e.baseURL,credentials:void 0,defaultHeaders:a})}var Ex=O(()=>{pt();Me();jo()});function Cre(e){return bM(e,Are,Tre)}function kre(){let t=globalThis.process?.env?.HOSTNAME;return t?`${t}-${Tc()}`:Tc()}var Dc,eg,Dr,tg,ng,rg,op,sp,Lc,wre=999,Are=1000,Tre=60000,ta;var og=O(()=>{Kn();pt();Fo();Me();rp();Ex();rp();ta=class ta{constructor(e){Dc.set(this,void 0),eg.set(this,!1),Dr.set(this,void 0),tg.set(this,void 0),ng.set(this,void 0),rg.set(this,void 0),op.set(this,void 0),sp.set(this,void 0),Lc.set(this,void 0),this.client=e.client,this.environmentId=e.environmentId,this.environmentKey=e.environmentKey,this.workerId=e.workerId??kre(),L(this,Dc,Qh(e.client,{authToken:e.environmentKey,helper:"environments-work-poller"}),"f"),L(this,ng,e.autoStop??!0,"f"),L(this,rg,e.drain??!1,"f"),L(this,op,e.blockMs===void 0?wre:e.blockMs,"f"),L(this,sp,e.reclaimOlderThanMs??null,"f"),L(this,Lc,e.requestOptions,"f"),L(this,Dr,new AbortController,"f"),L(this,tg,ea(e.signal,E(this,Dr,"f")),"f")}get signal(){return E(this,Dr,"f").signal}abort(){E(this,Dr,"f").abort()}async*[(Dc=new WeakMap,eg=new WeakMap,Dr=new WeakMap,tg=new WeakMap,ng=new WeakMap,rg=new WeakMap,op=new WeakMap,sp=new WeakMap,Lc=new WeakMap,Symbol.asyncIterator)](){if(E(this,eg,"f"))throw new z("Cannot iterate over a consumed WorkPoller");L(this,eg,!0,"f");let e=Be(this.client);e.info("poller starting",{component:"work-poller",environment_id:this.environmentId});try{let t=0;while(!E(this,Dr,"f").signal.aborted){let n;try{n=await E(this,Dc,"f").beta.environments.work.poll(this.environmentId,{"Anthropic-Worker-ID":this.workerId,...E(this,op,"f")!==null?{block_ms:E(this,op,"f")}:{},...E(this,sp,"f")!==null?{reclaim_older_than_ms:E(this,sp,"f")}:{}},{headers:k([E(this,Lc,"f")?.headers]),signal:E(this,Dr,"f").signal})}catch(r){if(E(this,Dr,"f").signal.aborted)return;if(Zs(r))throw e.error("poll failed permanently, stopping poller",{error:String(r)}),r;let o=SM(Cre(t));e.warn("poll failed, backing off",{error:String(r),backoff_ms:o}),t++,await ro(o,E(this,Dr,"f").signal);continue}if(t=0,n==null){if(E(this,rg,"f"))return;await ro(Sx(1000,3000),E(this,Dr,"f").signal);continue}e.info("claimed work",{component:"work-poller",environment_id:this.environmentId,work_id:n.id,work_type:n.data.type});try{await E(this,Dc,"f").beta.environments.work.ack(n.id,{environment_id:n.environment_id},{headers:k([E(this,Lc,"f")?.headers]),signal:E(this,Dr,"f").signal})}catch(r){e.error("ack failed",{work_id:n.id,error:String(r)});continue}try{yield n}finally{if(E(this,ng,"f"))try{await E(this,Dc,"f").beta.environments.work.stop(n.id,{environment_id:n.environment_id},{headers:k([E(this,Lc,"f")?.headers])})}catch(r){if(!Vs(r,409))e.warn("stop failed",{work_id:n.id,error:String(r)})}}}}finally{E(this,tg,"f").call(this)}}}});class xx{constructor(){Mc.set(this,[]),Ys.set(this,[]),Nc.set(this,!1)}push(e){if(E(this,Nc,"f"))return!1;let t=E(this,Ys,"f").shift();if(t)t({done:!1,value:e});else E(this,Mc,"f").push(e);return!0}close(){if(E(this,Nc,"f"))return;L(this,Nc,!0,"f");while(E(this,Ys,"f").length>0)E(this,Ys,"f").shift()({done:!0,value:void 0})}next(e){if(E(this,Mc,"f").length>0)return Promise.resolve({done:!1,value:E(this,Mc,"f").shift()});if(E(this,Nc,"f")||e?.aborted)return Promise.resolve({done:!0,value:void 0});return new Promise((t)=>{let n=(o)=>{e?.removeEventListener("abort",r),t(o)},r=()=>{let o=E(this,Ys,"f").indexOf(n);if(o>=0)E(this,Ys,"f").splice(o,1);t({done:!0,value:void 0})};E(this,Ys,"f").push(n),e?.addEventListener("abort",r,{once:!0})})}tryShift(){return E(this,Mc,"f").shift()}}var Mc,Ys,Nc;var EM=O(()=>{Kn();Mc=new WeakMap,Ys=new WeakMap,Nc=new WeakMap});var Ee;var na=O(()=>{Ee=class Ee extends Error{constructor(e){let t=typeof e==="string"?e:e.map((n)=>{if(n.type==="text")return n.text;return`[${n.type}]`}).join(" ");super(t);this.name="ToolError",this.content=e}}});function vx(e){return"name"in e?e.name:e.mcp_server_name}function Rre(e){return e instanceof Ee?e.content:`Error: ${e instanceof Error?e.message:String(e)}`}async function xM(e,t,n){try{let r=e.parse?e.parse(t):t;return{content:await e.run(r,n),isError:!1}}catch(r){return{content:Rre(r),isError:!0}}}var vM=O(()=>{na()});function DM(e){return e.type==="session.status_idle"&&e.stop_reason?.type==="end_turn"}class LM{constructor(e,t){ip.set(this,void 0),ug.set(this,void 0),Uc.set(this,new Set),ra.set(this,!1),io.set(this,void 0),L(this,ip,e,"f"),L(this,ug,t,"f")}noteEvent(e){if(e.type==="user.tool_confirmation")return;if(DM(e))this.arm();else this.disarm()}block(e){if(E(this,Uc,"f").add(e),E(this,io,"f")!==void 0)L(this,ra,!0,"f"),clearTimeout(E(this,io,"f")),L(this,io,void 0,"f")}unblock(e){if(E(this,Uc,"f").delete(e),E(this,Uc,"f").size===0&&E(this,ra,"f"))this.arm()}arm(){if(E(this,ip,"f")<=0)return;if(E(this,Uc,"f").size>0){L(this,ra,!0,"f");return}if(L(this,ra,!1,"f"),E(this,io,"f")!==void 0)clearTimeout(E(this,io,"f"));L(this,io,setTimeout(E(this,ug,"f"),E(this,ip,"f")),"f")}disarm(){if(L(this,ra,!1,"f"),E(this,io,"f")!==void 0)clearTimeout(E(this,io,"f")),L(this,io,void 0,"f")}}function Lre(e,t,n){if(e.type==="agent.custom_tool_use")return{type:"user.custom_tool_result",custom_tool_use_id:e.id,is_error:t,content:n};return{type:"user.tool_result",tool_use_id:e.id,is_error:t,content:n}}function Mre(e){if(typeof e==="string")return[{type:"text",text:e||"(no output)"}];let t=e.map((n)=>{if(n.type==="text")return{type:"text",text:n.text||"(no output)"};if(n.type==="image"||n.type==="document")return n;if(n.type==="search_result")return{type:"search_result",source:n.source,title:n.title,content:n.content.map((r)=>({type:"text",text:r.text})),citations:{enabled:n.citations?.enabled??!1}};return{type:"text",text:JSON.stringify(n)}});return t.length>0?t:[{type:"text",text:"(no output)"}]}var ip,ug,Uc,ra,io,Lt,sg,mn,ig,ap,dg,Zt,jc,gr,$c,Js,Fc,fs,cp,Lr,ag,PM,wM,AM,TM,wx,CM,cg,lg,Ax,kM,IM,RM=500,Ore=1e4,Pre=120000,Ire=30000,OM=3,Dre=60000,oa;var pg=O(()=>{Kn();pt();Fo();rp();EM();Me();jo();vM();ip=new WeakMap,ug=new WeakMap,Uc=new WeakMap,ra=new WeakMap,io=new WeakMap;oa=class oa{constructor(e,t){Lt.add(this),sg.set(this,!1),mn.set(this,void 0),ig.set(this,void 0),ap.set(this,void 0),dg.set(this,void 0),Zt.set(this,void 0),jc.set(this,new Set),gr.set(this,new Set),$c.set(this,new Map),Js.set(this,new Map),Fc.set(this,new xx),fs.set(this,0),cp.set(this,null),Lr.set(this,void 0),this.client=t.client,this.sessionId=e,this.tools=t.tools,this.maxIdleMs=t.maxIdleMs??Dre,L(this,Zt,Be(t.client),"f"),L(this,dg,new Map(t.tools.map((n)=>[vx(n),n])),"f"),L(this,mn,new AbortController,"f"),L(this,ig,ea(t.signal,E(this,mn,"f")),"f"),L(this,ap,t.requestOptions,"f"),L(this,Lr,new LM(this.maxIdleMs,()=>{E(this,Zt,"f").info("session idle after end_turn; stopping",{component:"session-tool-runner",session_id:this.sessionId,max_idle_ms:this.maxIdleMs}),E(this,mn,"f").abort()}),"f")}get signal(){return E(this,mn,"f").signal}abort(){E(this,mn,"f").abort()}async*[(sg=new WeakMap,mn=new WeakMap,ig=new WeakMap,ap=new WeakMap,dg=new WeakMap,Zt=new WeakMap,jc=new WeakMap,gr=new WeakMap,$c=new WeakMap,Js=new WeakMap,Fc=new WeakMap,fs=new WeakMap,cp=new WeakMap,Lr=new WeakMap,Lt=new WeakSet,Symbol.asyncIterator)](){if(E(this,sg,"f"))throw new z("Cannot iterate over a consumed SessionToolRunner");L(this,sg,!0,"f"),E(this,Zt,"f").info("session tool runner starting",{component:"session-tool-runner",session_id:this.sessionId});let e=E(this,Lt,"m",PM).call(this).catch((t)=>{if(!E(this,mn,"f").signal.aborted)E(this,Zt,"f").error("stream loop failed",{error:String(t)});E(this,mn,"f").abort()});try{while(!0){let n=await E(this,Fc,"f").next(E(this,mn,"f").signal);if(n.done)break;yield n.value}await e;let t;while((t=E(this,Fc,"f").tryShift())!==void 0)yield t}finally{E(this,mn,"f").abort(),E(this,Lr,"f").disarm(),await e;try{await E(this,Lt,"m",IM).call(this)}catch(t){E(this,Zt,"f").warn("drain failed",{error:String(t)})}E(this,Fc,"f").close();for(let t of this.tools)try{await t.close?.()}catch(n){E(this,Zt,"f").warn("tool.close failed",{tool:vx(t),error:String(n)})}E(this,ig,"f").call(this)}}};ag=function(){return{...E(this,ap,"f"),headers:k([Zd("session-tool-runner"),E(this,ap,"f")?.headers]),signal:E(this,mn,"f").signal}},PM=async function(){let t=E(this,mn,"f"),n=RM;while(!t.signal.aborted){try{let r=await this.client.beta.sessions.events.stream(this.sessionId,{},E(this,Lt,"m",ag).call(this));await E(this,Lt,"m",wM).call(this);for await(let o of r)if(n=RM,await E(this,Lt,"m",TM).call(this,o))return}catch(r){if(t.signal.throwIfAborted(),Zs(r))throw E(this,Zt,"f").error("permanent stream failure, shutting down",{error:String(r)}),t.abort(),r;E(this,Zt,"f").warn("stream disconnected, reconnecting",{error:String(r),backoff_ms:n})}t.signal.throwIfAborted(),await ro(n,t.signal),n=Math.min(n*2,Ore)}},wM=async function(){let t=E(this,mn,"f"),n=[],r=!1;try{for await(let i of this.client.beta.sessions.events.list(this.sessionId,{limit:1000},E(this,Lt,"m",ag).call(this)))E(this,Lt,"m",AM).call(this,i,n),r=DM(i)}catch(i){t.signal.throwIfAborted(),E(this,Zt,"f").warn("reconcile list failed",{error:String(i)});for(let a of n)E(this,jc,"f").delete(a.id);return}let o=n.filter((i)=>!E(this,gr,"f").has(i.id));E(this,Lr,"f").disarm();for(let i of o)await E(this,Lt,"m",wx).call(this,i);for(let i of[...E(this,Js,"f").values()]){let a=E(this,$c,"f").get(i.id);if(a!==void 0)await E(this,Lt,"m",cg).call(this,i,a)}let s=o.filter((i)=>!E(this,gr,"f").has(i.id)&&!E(this,Js,"f").has(i.id));if(r&&s.length===0)E(this,Lr,"f").arm();else E(this,Lr,"f").disarm()},AM=function(t,n){if(t.type==="agent.tool_use"||t.type==="agent.custom_tool_use"){if(E(this,jc,"f").add(t.id),!E(this,gr,"f").has(t.id))n.push(t)}else if(t.type==="user.tool_result")E(this,gr,"f").add(t.tool_use_id);else if(t.type==="user.custom_tool_result")E(this,gr,"f").add(t.custom_tool_use_id);else if(t.type==="user.tool_confirmation"){if(!E(this,gr,"f").has(t.tool_use_id))E(this,$c,"f").set(t.tool_use_id,t.result)}},TM=async function(t){switch(E(this,Lr,"f").noteEvent(t),t.type){case"agent.tool_use":case"agent.custom_tool_use":if(!E(this,jc,"f").has(t.id))E(this,jc,"f").add(t.id),await E(this,Lt,"m",wx).call(this,t);return!1;case"user.tool_confirmation":return await E(this,Lt,"m",CM).call(this,t),!1;case"user.tool_result":return E(this,gr,"f").add(t.tool_use_id),!1;case"user.custom_tool_result":return E(this,gr,"f").add(t.custom_tool_use_id),!1;case"session.status_terminated":case"session.deleted":return E(this,Zt,"f").info("session terminated",{component:"session-tool-runner",session_id:this.sessionId}),E(this,mn,"f").abort(),!0;default:return!1}},wx=async function(t){let n=t.evaluated_permission,r=n==="deny"?"deny":E(this,$c,"f").get(t.id);if(r===void 0){if(n===void 0||n==="allow")await E(this,Lt,"m",Ax).call(this,t,void 0);else if(!E(this,Js,"f").has(t.id))E(this,Zt,"f").info("tool call awaiting confirmation; holding",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),E(this,Js,"f").set(t.id,t),E(this,Lr,"f").block(t.id);return}await E(this,Lt,"m",cg).call(this,t,r)},CM=async function(t){E(this,$c,"f").set(t.tool_use_id,t.result);let n=E(this,Js,"f").get(t.tool_use_id);if(n===void 0)return;await E(this,Lt,"m",cg).call(this,n,t.result)},cg=async function(t,n){let r=E(this,Js,"f").delete(t.id);if(n==="allow"){if(E(this,Zt,"f").info("tool call confirmed",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),!r)E(this,Lr,"f").block(t.id);try{await E(this,Lt,"m",Ax).call(this,t,"allow")}finally{E(this,Lr,"f").unblock(t.id)}return}if(r)E(this,Lr,"f").unblock(t.id);E(this,gr,"f").add(t.id),E(this,Zt,"f").info("tool call denied; not executing",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),E(this,Lt,"m",lg).call(this,{event:t,toolUseId:t.id,name:t.name,isError:!1,posted:!1,confirmation:"deny"})},lg=function(t){E(this,Fc,"f").push(t)},Ax=async function(t,n){var r,o;if(E(this,gr,"f").has(t.id))return;E(this,Zt,"f").info("executing tool",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),L(this,fs,(r=E(this,fs,"f"),r++,r),"f");try{let s=E(this,dg,"f").get(t.name);if(!s){E(this,Zt,"f").info("tool not owned by this runner; leaving the tool_use_id pending for its owner",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),E(this,Lt,"m",lg).call(this,{event:t,toolUseId:t.id,name:t.name,isError:!1,posted:!1,confirmation:n});return}let i,a,c=new AbortController,l=ea(E(this,mn,"f").signal,c),u=setTimeout(()=>c.abort(),Pre);try{let m=await xM(s,t.input,{toolUse:t,toolUseBlock:t,signal:c.signal});i=m.content,a=m.isError}finally{clearTimeout(u),l()}let p=Lre(t,a,Mre(i)),f=await E(this,Lt,"m",kM).call(this,p,t.id);E(this,Lt,"m",lg).call(this,{event:t,result:p,toolUseId:t.id,name:t.name,isError:a,posted:f,confirmation:n})}finally{if(L(this,fs,(o=E(this,fs,"f"),o--,o),"f"),E(this,fs,"f")===0)E(this,cp,"f")?.call(this)}},kM=async function(t,n){let r=E(this,mn,"f"),o;for(let s=0;s<OM;s++){r.signal.throwIfAborted();try{return await this.client.beta.sessions.events.send(this.sessionId,{events:[t]},E(this,Lt,"m",ag).call(this)),E(this,gr,"f").add(n),!0}catch(i){if(o=i,Zs(i))break;if(s<OM-1)await ro((s+1)*1000,r.signal)}}return E(this,Zt,"f").error("failed to send tool result",{tool_use_id:n,error:String(o)}),!1},IM=async function(){if(E(this,fs,"f")===0)return;if(await Promise.race([new Promise((t)=>L(this,cp,t,"f")),ro(Ire)]),L(this,cp,null,"f"),E(this,fs,"f")>0)E(this,Zt,"f").warn("drain timeout exceeded")}});var MM=O(()=>{VE()});function sa(e){if(e.inputSchema.type!=="object")throw Error(`JSON schema for tool "${e.name}" must be an object, but got ${e.inputSchema.type}`);return{type:"custom",name:e.name,input_schema:e.inputSchema,description:e.description,run:e.run,parse:(t)=>t,...e.close?{close:e.close}:{}}}var NM=O(()=>{Tx();MM()});function zc(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}import*as _r from"node:fs/promises";import*as In from"node:path";import{randomUUID as Nre}from"node:crypto";async function Fre(e){try{return await _r.realpath(e)}catch{return e}}async function jre(e){let t=[],n=e,r=0;for(;;){let o;try{o=await _r.realpath(n)}catch{let s=!1;try{s=(await _r.lstat(n)).isSymbolicLink()}catch{}if(s){if(++r>40)throw new Ee(`path ${JSON.stringify(e)} has too many levels of symbolic links`);n=In.resolve(In.dirname(n),await _r.readlink(n));continue}let i=In.dirname(n);if(i===n)return e;t.push(In.basename(n)),n=i;continue}return t.length?In.join(o,...t.reverse()):o}}async function UM(e,t,n){let r=n?.allowOutside??!1,o=await Fre(In.resolve(e)),s=In.resolve(o,t);if(r)return s;let i=await jre(s);if(i!==o&&!i.startsWith(o+In.sep))throw new Ee(`path ${JSON.stringify(t)} escapes workdir`);return i}async function Cx(e,t){let n=In.dirname(e),r=In.join(n,`.tmp-${process.pid}-${Nre()}`),o;try{o=await _r.open(r,"wx",Ure),await o.writeFile(t,"utf-8"),await o.sync(),await o.close(),o=void 0,await _r.rename(r,e)}catch(s){if(o)await o.close().catch(()=>{});throw await _r.unlink(r).catch(()=>{}),s}}function up(e,t){switch(e?.code){case"ENOENT":return`${t}: no such file or directory`;case"EACCES":case"EPERM":return`${t}: permission denied`;case"ENOTDIR":return`${t}: not a directory`;case"EISDIR":return`${t}: is a directory`;case"ELOOP":return`${t}: too many levels of symbolic links`;case"ENAMETOOLONG":return`${t}: file name too long`;case"ENOSPC":return`${t}: no space left on device`;case"EMFILE":case"ENFILE":return`${t}: too many open files`;default:return`${t}: ${e instanceof Error?e.message:String(e)}`}}var lp=493,Ure=420;var kx=O(()=>{na()});import*as Wn from"node:fs/promises";import*as FM from"node:fs";import*as hn from"node:path";import{execFile as $re}from"node:child_process";import{promisify as zre}from"node:util";import{Readable as Hre}from"node:stream";import{pipeline as Bre}from"node:stream/promises";async function jM(e){let{client:t,sessionId:n}=e;if(!t||!n)return async()=>{};let r=Be(t),o=await t.beta.sessions.retrieve(n),s=hn.resolve(e.workdir,"skills"),i=[];for(let a of o.agent.skills)try{let c=await Ox(t,a.skill_id,a.version),l=await t.beta.skills.versions.retrieve(c,{skill_id:a.skill_id}),u=hn.basename(l.name.trim());if(u===""||u==="."||u==="..")u=a.skill_id;let p=hn.resolve(s,u);if(p!==s&&!p.startsWith(s+hn.sep)){r.warn("skill name escapes the skills dir; skipping",{component:"agent-tool-context",name:l.name});continue}let f=await t.beta.skills.versions.download(c,{skill_id:a.skill_id});await Wn.rm(p,{recursive:!0,force:!0}),await Wn.mkdir(p,{recursive:!0,mode:lp}),i.push(p),await Px(f,p),r.info("downloaded skill",{component:"agent-tool-context",skill_id:a.skill_id,version:c,dest:p})}catch(c){r.warn("failed to download skill",{component:"agent-tool-context",skill_id:a.skill_id,error:String(c)})}return async()=>{for(let a of i)await Wn.rm(a,{recursive:!0,force:!0}).catch((c)=>{r.warn("failed to clean up skill",{component:"agent-tool-context",dest:a,error:String(c)})})}}async function Ox(e,t,n){if(/^\d+$/.test(n))return n;let r;for await(let o of e.beta.skills.versions.list(t))if(/^\d+$/.test(o.version)&&(r===void 0||BigInt(o.version)>BigInt(r)))r=o.version;if(r===void 0)throw new z(`skill ${JSON.stringify(t)} has no concrete version to resolve ${JSON.stringify(n)} against`);return r}function Gre(e){for(let t of e.split(`
17
- `)){let n=t.trim();if(!n)continue;if(hn.isAbsolute(n)||n.split(/[\\/]/).includes(".."))throw new z(`refusing to extract unsafe archive member: ${n}`)}}function Wre(e){for(let t of e.split(`
18
- `)){let n=t.trimStart()[0];if(n==="l"||n==="h"||n==="b"||n==="c"||n==="p"||n==="s")throw new z("refusing to extract archive with symlink/hardlink/device member")}}async function Rx(e,t){try{let{stdout:n}=await Kre(e,t);return n}catch(n){if(n!=null&&typeof n==="object"&&n.code==="ENOENT")throw new z(`skill extraction requires the \`${e}\` command, but it was not found on PATH`);throw n}}function qre(e){let t,n=!1;for(let r of e.split(`
19
- `)){let o=r.trim().split("/").filter((i)=>i!==""&&i!==".");if(o.length===0)continue;let s=o[0];if(t===void 0)t=s;else if(s!==t)return"";if(o.length>1)n=!0}return t!==void 0&&n?t:""}async function Px(e,t){let n=hn.join(t,`.skill-archive-${process.pid}-${Date.now()}`);if(!e.body)throw new z("skill download response had no body");await Bre(Hre.fromWeb(e.body),FM.createWriteStream(n));let r=hn.join(hn.dirname(t),`.skill-stage-${process.pid}-${Date.now()}`);try{let o=await Vre(n,4),s=o.length>=4&&o[0]===80&&o[1]===75&&o[2]===3&&o[3]===4,i=s?"unzip":"tar",a=await Rx(i,s?["-Z1",n]:["-tf",n]);Gre(a),Wre(await Rx(i,s?["-Z",n]:["-tvf",n]));let c=qre(a);await Wn.mkdir(r,{recursive:!0,mode:lp}),await Rx(i,s?["-oq",n,"-d",r]:["-xf",n,"-C",r]);let l=c?hn.join(r,c):r;for(let u of await Wn.readdir(l))await Wn.rename(hn.join(l,u),hn.join(t,u))}finally{await Wn.rm(n,{force:!0}),await Wn.rm(r,{recursive:!0,force:!0})}}async function Vre(e,t){let n=await Wn.open(e,"r");try{let r=Buffer.alloc(t),{bytesRead:o}=await n.read(r,0,t,0);return r.subarray(0,o)}finally{await n.close()}}var Kre;var $M=O(()=>{pt();Fo();kx();Kre=zre($re)});var QM={};rn(QM,{BashSession:()=>Lx,betaAgentToolset20260401:()=>eoe,betaBashTool:()=>qM,betaEditTool:()=>YM,betaGlobTool:()=>JM,betaGrepTool:()=>XM,betaReadTool:()=>VM,betaWriteTool:()=>ZM,extractSkillArchive:()=>Px,resolvePath:()=>Hc,resolveSkillVersion:()=>Ox,setupSkills:()=>jM});import*as Yt from"node:fs/promises";import*as mg from"node:fs";import*as At from"node:path";import*as Dx from"node:child_process";import*as BM from"node:crypto";import*as KM from"node:readline";function WM(e){return e===void 0?Zre:e}function eoe(e){return[qM(e),VM(e),ZM(e),YM(e),JM(e),XM(e)]}function Hc(e,t){return UM(e.workdir,t,{allowOutside:e.unrestrictedPaths??!1})}function toe(){let e={};for(let[t,n]of Object.entries(process.env)){if(t.startsWith("ANTHROPIC_"))continue;e[t]=n}return e}class Lx{constructor(e,t=toe()){fg.add(this),Dn.set(this,void 0),qn.set(this,""),dp.set(this,!1),ia.set(this,!1),Mr.set(this,null),L(this,Dn,Dx.spawn("/bin/bash",["--noprofile","--norc"],{cwd:e,env:{...t,PS1:"",PS2:"",TERM:"dumb"},stdio:["pipe","pipe","pipe"],detached:!0}),"f"),E(this,Dn,"f").stdout.setEncoding("utf8"),E(this,Dn,"f").stderr.setEncoding("utf8"),E(this,Dn,"f").stdout.on("data",(n)=>E(this,fg,"m",Ix).call(this,n)),E(this,Dn,"f").stderr.on("data",(n)=>E(this,fg,"m",Ix).call(this,n)),E(this,Dn,"f").once("close",()=>{L(this,ia,!0,"f");let n=E(this,Mr,"f");L(this,Mr,null,"f"),n?.resolve()})}get closed(){return E(this,ia,"f")}async exec(e,t={}){if(E(this,ia,"f"))throw new z("bash session terminated");let n=t.timeoutMs??GM,r=t.signal;if(r?.aborted)throw new z("bash command aborted");L(this,qn,"","f"),L(this,dp,!1,"f");let o=`__ANT_CMD_${BM.randomUUID()}_DONE__`,s=`${o.slice(0,8)}''${o.slice(8)}`,i=`{ ${e}
20
- } </dev/null 2>&1; printf '\\n${s}%d\\n' $?
21
- `;if(E(this,Dn,"f").stdin.write(i),E(this,qn,"f").indexOf(o)<0){let{promise:f,resolve:m}=zc();L(this,Mr,{sentinel:o,resolve:m},"f");let h,g;try{await Promise.race([f,new Promise((y,S)=>{h=setTimeout(()=>S(new z(`bash command timed out after ${n}ms`)),n)}),new Promise((y,S)=>{if(!r)return;g=()=>S(new z("bash command aborted")),r.addEventListener("abort",g,{once:!0})})])}finally{if(h)clearTimeout(h);if(g&&r)r.removeEventListener("abort",g);L(this,Mr,null,"f")}}let a=E(this,qn,"f").indexOf(o);if(a<0)throw new z("bash session terminated");let l=E(this,qn,"f").slice(a+o.length).match(/^(-?\d+)/),u=l?parseInt(l[1],10):-1,p=E(this,qn,"f").slice(0,a).replace(Xre,"").replace(/\n+$/,"");if(E(this,dp,"f"))p=`[output truncated]
22
- ${p}`;return{output:p,exitCode:u}}close(){if(E(this,ia,"f"))return;L(this,ia,!0,"f");let e=E(this,Mr,"f");L(this,Mr,null,"f"),e?.resolve(),E(this,Dn,"f").stdout.destroy(),E(this,Dn,"f").stderr.destroy(),E(this,Dn,"f").stdin.destroy();try{process.kill(-E(this,Dn,"f").pid,"SIGKILL")}catch{E(this,Dn,"f").kill("SIGKILL")}E(this,Dn,"f").unref()}}function qM(e){let t,n=Promise.resolve();return sa({name:"bash",description:"Run a bash command in a persistent shell. State (cwd, env vars) persists across calls.",inputSchema:{type:"object",properties:{command:{type:"string",description:"The command to run"},restart:{type:"boolean",description:"Restart the persistent shell before running"},timeout_ms:{type:"integer",description:"Per-call timeout in milliseconds"}}},run:async({command:r,restart:o,timeout_ms:s},i)=>{let a=n,c=zc();n=c.promise;try{await a}catch{}try{if(o)t?.close(),t=void 0;if(!r){if(o)return"bash session restarted";throw new Ee("bash: command is required")}t??(t=new Lx(e.workdir,e.env));try{let{output:l,exitCode:u}=await t.exec(r,{timeoutMs:s??GM,signal:i?.signal});if(u!==0)throw new Ee(l||`exit ${u}`);return l}catch(l){if(l instanceof Ee)throw l;throw t.close(),t=void 0,new Ee(`bash: ${l instanceof Error?l.message:String(l)}`)}}finally{c.resolve()}},close:()=>{t?.close(),t=void 0}})}function VM(e){return sa({name:"read",description:"Read a UTF-8 text file relative to the workdir.",inputSchema:{type:"object",properties:{file_path:{type:"string"},view_range:{type:"array",items:{type:"integer"},description:"[start_line, end_line] 1-indexed inclusive"}},required:["file_path"]},run:async({file_path:t,view_range:n})=>{if(!t)throw new Ee("read: file_path is required");let r=await Hc(e,t),o;try{let u=await Yt.stat(r);if(!u.isFile())throw new Ee(`read: ${t} is not a regular file`);let p=WM(e.maxFileBytes);if(p!==null&&u.size>p)throw new Ee(`read: ${t} is ${u.size} bytes, exceeds ${p}-byte limit. Use bash (head/tail/sed) to read a slice.`);o=await Yt.readFile(r,"utf8")}catch(u){if(u instanceof Ee)throw u;throw new Ee(`read: ${up(u,t)}`)}if(!n)return o;if(n.length!==2)throw new Ee("read: view_range must be [start_line, end_line]");let[s,i]=n,a=o.split(`
23
- `),c=Math.max(0,s-1),l=i>0?i:a.length;return a.slice(c,l).join(`
24
- `)}})}function ZM(e){return sa({name:"write",description:"Write a UTF-8 text file relative to the workdir, creating parent directories as needed.",inputSchema:{type:"object",properties:{file_path:{type:"string"},content:{type:"string"}},required:["file_path","content"]},run:async({file_path:t,content:n})=>{if(!t)throw new Ee("write: file_path is required");let r=await Hc(e,t);try{await Yt.mkdir(At.dirname(r),{recursive:!0,mode:lp}),await Cx(r,n??"")}catch(o){throw new Ee(`write: ${up(o,t)}`)}return`wrote ${Buffer.byteLength(n??"")} bytes to ${t}`}})}function YM(e){return sa({name:"edit",description:"Replace old_string with new_string in a file. old_string must be unique unless replace_all.",inputSchema:{type:"object",properties:{file_path:{type:"string"},old_string:{type:"string"},new_string:{type:"string"},replace_all:{type:"boolean"}},required:["file_path","old_string","new_string"]},run:async({file_path:t,old_string:n,new_string:r,replace_all:o})=>{if(!t)throw new Ee("edit: file_path is required");if(!n)throw new Ee("edit: old_string is required");let s=await Hc(e,t),i;try{let l=await Yt.stat(s);if(!l.isFile())throw new Ee(`edit: ${t} is not a regular file`);let u=WM(e.maxFileBytes);if(u!==null&&l.size>u)throw new Ee(`edit: ${t} is ${l.size} bytes, exceeds ${u}-byte limit. Use bash (sed/awk) to edit a large file.`);i=await Yt.readFile(s,"utf8")}catch(l){if(l instanceof Ee)throw l;throw new Ee(`edit: ${up(l,t)}`)}let a=i.split(n).length-1;if(a===0)throw new Ee(`edit: old_string not found in ${t}`);let c;if(o)c=i.split(n).join(r);else{if(a>1)throw new Ee(`edit: old_string appears ${a} times in ${t} (must be unique)`);c=i.replace(n,()=>r)}try{await Cx(s,c)}catch(l){throw new Ee(`edit: write: ${up(l,t)}`)}return`edited ${t} (${o?a:1} replacement(s))`}})}function JM(e){return sa({name:"glob",description:"Match files under the workdir against a glob pattern. Results are mtime-sorted, newest first.",inputSchema:{type:"object",properties:{pattern:{type:"string"},path:{type:"string",description:"Directory to search in. Defaults to the workdir."}},required:["pattern"]},run:async({pattern:t,path:n})=>{if(!t)throw new Ee("glob: pattern is required");let r=At.resolve(e.workdir),o=t;if(At.isAbsolute(t)){if(!e.unrestrictedPaths)throw new Ee("glob: absolute pattern not permitted");r=At.parse(t).root,o=At.relative(r,t)}else if(n)r=await Hc(e,n);if(!e.unrestrictedPaths&&o.split(/[\\/]/).includes(".."))throw new Ee('glob: ".." is not permitted in the pattern');let s=e.unrestrictedPaths?r:await Yt.realpath(r).catch(()=>r),i=[];try{for await(let a of Qre(o,{cwd:r,withFileTypes:!0,exclude:(c)=>c.name===".git"||c.name==="node_modules"})){if(!a.isFile())continue;let c=At.join(a.parentPath,a.name);if(!e.unrestrictedPaths){let u;try{u=await Yt.realpath(c)}catch{continue}if(!ooe(s,u))continue}let l=0;try{l=(await Yt.stat(c)).mtimeMs}catch{}i.push({path:c,mtime:l})}}catch(a){throw new Ee(`glob: ${a instanceof Error?a.message:String(a)}`)}if(i.length===0)return"no matches";return i.sort((a,c)=>c.mtime-a.mtime),i.slice(0,Jre).map((a)=>a.path).join(`
25
- `)}})}function XM(e){return sa({name:"grep",description:"Search file contents for a regex. Uses ripgrep if available, otherwise a built-in walker.",inputSchema:{type:"object",properties:{pattern:{type:"string"},path:{type:"string"}},required:["pattern"]},run:async({pattern:t,path:n},r)=>{if(!t)throw new Ee("grep: pattern is required");let o=At.resolve(e.workdir);if(n)o=await Hc(e,n);let s=await coe();return s?noe(s,t,o,r?.signal):roe(t,o,r?.signal)}})}function noe(e,t,n,r){return new Promise((o,s)=>{let i=Dx.spawn(e,["-n","--no-heading","-e",t,"--",n],{...r?{signal:r}:{}}),a="",c="",l=!1;i.stdout.on("data",(u)=>{if(l)return;if(a+=u,a.length>pp)l=!0,a=a.slice(0,pp),i.kill("SIGKILL")}),i.stderr.on("data",(u)=>c+=u),i.on("close",(u)=>{if(r?.aborted)return s(new Ee("grep: aborted"));if(l)return o(a+`
26
- [output truncated at ${pp} bytes]`);if(u===0)return o(a);if(u===1)return o("no matches");s(new Ee(`grep: rg failed: ${c||`exit ${u}`}`))}),i.on("error",(u)=>{if(r?.aborted)return s(new Ee("grep: aborted"));s(new Ee(`grep: rg failed: ${u.message}`))})})}async function roe(e,t,n){let r;try{r=new RegExp(e)}catch(c){throw new Ee(`grep: invalid regex: ${c instanceof Error?c.message:String(c)}`)}let o=[],s=pp,i=(c)=>{if(s-=c.length+1,s<0)return o.push(`[output truncated at ${pp} bytes]`),!1;return o.push(c),!0};if((await Yt.stat(t).catch(()=>null))?.isFile())await HM(t,r,i);else await aoe(t,"",(c)=>HM(At.join(t,c),r,i),n);if(n?.aborted)throw new Ee("grep: aborted");if(o.length===0)return"no matches";return o.join(`
27
- `)}async function HM(e,t,n){let r=mg.createReadStream(e,{encoding:"utf8"}),o=KM.createInterface({input:r,crlfDelay:1/0}),s=0;try{for await(let i of o){if(s++,i.length>Yre)continue;if(t.test(i)&&!n(`${e}:${s}:${i}`))return!1}}catch{}finally{r.destroy()}return!0}function ooe(e,t){let n=At.relative(e,t);return n===""||!n.startsWith(".."+At.sep)&&n!==".."&&!At.isAbsolute(n)}async function aoe(e,t,n,r){let o=ioe;async function s(i,a){if(a>soe)return!0;if(r?.aborted)return!1;let c;try{c=await Yt.readdir(At.join(e,i),{withFileTypes:!0})}catch{return!0}for(let l of c){if(l.name===".git"||l.name==="node_modules")continue;if(o--<=0)return!1;if(r?.aborted)return!1;let u=i?At.join(i,l.name):l.name;if(l.isDirectory()){if(!await s(u,a+1))return!1}else if(l.isFile()){if(await n(u)===!1)return!1}}return!0}await s(t,0)}async function coe(){let e=(process.env.PATH??"").split(At.delimiter);for(let t of e){let n=At.join(t,"rg");try{return await Yt.access(n,mg.constants.X_OK),n}catch{}}return null}var fg,Dn,qn,dp,ia,Mr,Ix,zM=102400,GM=120000,Zre=262144,pp=102400,Yre=2000,Jre=200,Xre,Qre,soe=40,ioe=50000;var eN=O(()=>{Kn();pt();na();NM();kx();$M();Xre=/\x1b\[[0-9;?]*[ -/]*[@-~]/g,Qre=Yt.glob;Dn=new WeakMap,qn=new WeakMap,dp=new WeakMap,ia=new WeakMap,Mr=new WeakMap,fg=new WeakSet,Ix=function(t){if(L(this,qn,E(this,qn,"f")+t,"f"),E(this,qn,"f").length>zM)L(this,qn,E(this,qn,"f").slice(E(this,qn,"f").length-zM),"f"),L(this,dp,!0,"f");if(E(this,Mr,"f")&&E(this,qn,"f").indexOf(E(this,Mr,"f").sentinel)>=0){let n=E(this,Mr,"f");L(this,Mr,null,"f"),n.resolve()}}});class mp{constructor(e){hg.add(this),fp.set(this,void 0),this.client=e.client,this.environmentId=e.environmentId,this.environmentKey=e.environmentKey,this.tools=e.tools,this.workdir=e.workdir??process.cwd(),this.unrestrictedPaths=e.unrestrictedPaths,this.maxFileBytes=e.maxFileBytes,this.maxIdleMs=e.maxIdleMs,this.workerId=e.workerId,this.requestOptions=e.requestOptions,L(this,fp,e.signal,"f")}async run(e){let{environmentId:t,environmentKey:n}=this;if(t===void 0||n===void 0)throw new z("EnvironmentWorker.run: environmentId and environmentKey are required to poll for work");let r=e??E(this,fp,"f"),o=new ta({client:this.client,environmentId:t,environmentKey:n,...this.workerId!==void 0?{workerId:this.workerId}:{},...r?{signal:r}:{},...this.requestOptions!==void 0?{requestOptions:this.requestOptions}:{},autoStop:!1});for await(let s of o)await E(this,hg,"m",Mx).call(this,s,n,o.signal)}async handleItem(e){let t=e?.workId??Le("ANTHROPIC_WORK_ID"),n=e?.environmentId??Le("ANTHROPIC_ENVIRONMENT_ID"),r=e?.sessionId??Le("ANTHROPIC_SESSION_ID"),o=e?.environmentKey??this.environmentKey??Le("ANTHROPIC_ENVIRONMENT_KEY");if(!t)throw new z("handleItem: workId is required — pass it or set ANTHROPIC_WORK_ID");if(!n)throw new z("handleItem: environmentId is required — pass it or set ANTHROPIC_ENVIRONMENT_ID");if(!r)throw new z("handleItem: sessionId is required — pass it or set ANTHROPIC_SESSION_ID");if(!o)throw new z("handleItem: environmentKey is required — pass it, construct the worker with it, or set ANTHROPIC_ENVIRONMENT_KEY");let s={id:t,environment_id:n,data:{type:"session",id:r}};await E(this,hg,"m",Mx).call(this,s,o,e?.signal??E(this,fp,"f"))}}async function uoe(e,t,n,r){try{await e.beta.environments.work.stop(t.id,{environment_id:t.environment_id,force:!0},{...r,headers:k([r?.headers])})}catch(o){if(!Vs(o,409))n.error("force-stop on exit failed",{work_id:t.id,error:String(o)})}}async function doe(e,t,n,r,o){let s=tN,i=loe,a=async()=>{try{let c=await e.beta.environments.work.heartbeat(t.id,{environment_id:t.environment_id,expected_last_heartbeat:i},{...o,headers:k([o?.headers]),signal:n.signal});if(i=c.last_heartbeat,c.ttl_seconds>0)s=Math.max(1000,Math.min(c.ttl_seconds*1000/2,tN));if(c.state==="stopping"||c.state==="stopped")r.info("heartbeat signals shutdown",{work_id:t.id,state:c.state}),n.abort();if(!c.lease_extended)r.warn("lease not extended, shutting down",{work_id:t.id}),n.abort()}catch(c){if(n.signal.throwIfAborted(),Zs(c))throw r.error("permanent heartbeat failure",{work_id:t.id,error:String(c)}),n.abort(),c;r.warn("transient heartbeat failure",{work_id:t.id,error:String(c)})}};await a();while(!n.signal.aborted)await ro(s,n.signal),n.signal.throwIfAborted(),await a()}var hg,fp,Mx,tN=30000,loe="NO_HEARTBEAT";var Nx=O(()=>{Kn();pt();Fo();rp();Me();pg();og();Ex();fp=new WeakMap,hg=new WeakSet,Mx=async function(t,n,r){let o=Be(this.client),s=Qh(this.client,{authToken:n,helper:"environments-worker"}),i=t.data.id,a={workdir:this.workdir,client:this.client,sessionId:i,...this.unrestrictedPaths!==void 0?{unrestrictedPaths:this.unrestrictedPaths}:{},...this.maxFileBytes!==void 0?{maxFileBytes:this.maxFileBytes}:{}},c=await Promise.resolve().then(() => (eN(),QM)),l=async()=>{};try{l=await c.setupSkills(a)}catch(h){o.warn("skill setup failed",{session_id:i,work_id:t.id,error:String(h)})}let u=typeof this.tools==="function"?this.tools(a):this.tools??c.betaAgentToolset20260401(a),p=new AbortController,f=ea(r,p),m=doe(s,t,p,o,this.requestOptions).catch((h)=>{if(!p.signal.aborted)o.error("heartbeat loop failed",{work_id:t.id,error:String(h)});p.abort()});try{let h=new oa(i,{client:s,tools:u,...this.maxIdleMs!==void 0?{maxIdleMs:this.maxIdleMs}:{},...this.requestOptions!==void 0?{requestOptions:this.requestOptions}:{},signal:p.signal});for await(let g of h);}finally{p.abort(),f(),await m,await l().catch((h)=>{o.warn("skill cleanup failed",{session_id:i,work_id:t.id,error:String(h)})}),await uoe(s,t,o,this.requestOptions)}}});var aa;var Ux=O(()=>{Xe();Me();ot();og();Nx();og();Nx();aa=class aa extends re{retrieve(e,t,n){let{environment_id:r,betas:o}=t;return this._client.get(N`/v1/environments/${r}/work/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}update(e,t,n){let{environment_id:r,betas:o,...s}=t;return this._client.post(N`/v1/environments/${r}/work/${e}?beta=true`,{body:s,...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(N`/v1/environments/${e}/work?beta=true`,ve,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}ack(e,t,n){let{environment_id:r,betas:o}=t;return this._client.post(N`/v1/environments/${r}/work/${e}/ack?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}heartbeat(e,t,n){let{environment_id:r,desired_ttl_seconds:o,expected_last_heartbeat:s,betas:i}=t;return this._client.post(N`/v1/environments/${r}/work/${e}/heartbeat?beta=true`,{query:{desired_ttl_seconds:o,expected_last_heartbeat:s},...n,headers:k([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}poll(e,t={},n){let{betas:r,"Anthropic-Worker-ID":o,...s}=t??{};return this._client.get(N`/v1/environments/${e}/work/poll?beta=true`,{query:s,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...o!=null?{"Anthropic-Worker-ID":o}:void 0},n?.headers])})}stats(e,t={},n){let{betas:r}=t??{};return this._client.get(N`/v1/environments/${e}/work/stats?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}stop(e,t,n){let{environment_id:r,betas:o,...s}=t;return this._client.post(N`/v1/environments/${r}/work/${e}/stop?beta=true`,{body:s,...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}poller(e){return new ta({...e,client:this._client})}worker(e){return new mp({...e,client:this._client})}};aa.WorkPoller=ta;aa.EnvironmentWorker=mp});var Bc;var Fx=O(()=>{Ux();Ux();Xe();Me();ot();Bc=class Bc extends re{constructor(){super(...arguments);this.work=new aa(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/environments?beta=true",{body:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(N`/v1/environments/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}update(e,t,n){let{betas:r,...o}=t;return this._client.post(N`/v1/environments/${e}?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/environments?beta=true",ve,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(N`/v1/environments/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(N`/v1/environments/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}};Bc.Work=aa});var hp;var jx=O(()=>{Xe();Me();ot();hp=class hp extends re{create(e,t,n){let{view:r,betas:o,...s}=t;return this._client.post(N`/v1/memory_stores/${e}/memories?beta=true`,{query:{view:r},body:s,...n,headers:k([{"anthropic-beta":[...o??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}retrieve(e,t,n){let{memory_store_id:r,betas:o,...s}=t;return this._client.get(N`/v1/memory_stores/${r}/memories/${e}?beta=true`,{query:s,...n,headers:k([{"anthropic-beta":[...o??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}update(e,t,n){let{memory_store_id:r,view:o,betas:s,...i}=t;return this._client.post(N`/v1/memory_stores/${r}/memories/${e}?beta=true`,{query:{view:o},body:i,...n,headers:k([{"anthropic-beta":[...s??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(N`/v1/memory_stores/${e}/memories?beta=true`,ve,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}delete(e,t,n){let{memory_store_id:r,expected_content_sha256:o,betas:s}=t;return this._client.delete(N`/v1/memory_stores/${r}/memories/${e}?beta=true`,{query:{expected_content_sha256:o},...n,headers:k([{"anthropic-beta":[...s??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}}});var gp;var $x=O(()=>{Xe();Me();ot();gp=class gp extends re{retrieve(e,t,n){let{memory_store_id:r,betas:o,...s}=t;return this._client.get(N`/v1/memory_stores/${r}/memory_versions/${e}?beta=true`,{query:s,...n,headers:k([{"anthropic-beta":[...o??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(N`/v1/memory_stores/${e}/memory_versions?beta=true`,ve,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}redact(e,t,n){let{memory_store_id:r,betas:o}=t;return this._client.post(N`/v1/memory_stores/${r}/memory_versions/${e}/redact?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}}});var ca;var zx=O(()=>{jx();jx();$x();$x();Xe();Me();ot();ca=class ca extends re{constructor(){super(...arguments);this.memories=new hp(this._client),this.memoryVersions=new gp(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/memory_stores?beta=true",{body:r,...t,headers:k([{"anthropic-beta":[...n??[],"agent-memory-2026-07-22"].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(N`/v1/memory_stores/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}update(e,t,n){let{betas:r,...o}=t;return this._client.post(N`/v1/memory_stores/${e}?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/memory_stores?beta=true",ve,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"agent-memory-2026-07-22"].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(N`/v1/memory_stores/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(N`/v1/memory_stores/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"agent-memory-2026-07-22"].toString()},n?.headers])})}};ca.Memories=hp;ca.MemoryVersions=gp});var Kc=O(()=>{pt()});var Gc;var Hx=O(()=>{pt();QE();Gc=class Gc{constructor(e,t){this.iterator=e,this.controller=t}async*decoder(){let e=new Ws;for await(let t of this.iterator)for(let n of e.decode(t))yield JSON.parse(n);for(let t of e.flush())yield JSON.parse(t)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(e,t){if(!e.body){if(t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new z("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new z("Attempted to iterate over a response with no body")}return new Gc(Nd(e.body),t)}}});var _p;var Bx=O(()=>{Xe();Me();Hx();Kc();ot();_p=class _p extends re{create(e,t){let{betas:n,user_profile_id:r,...o}=e;return this._client.post("/v1/messages/batches?beta=true",{body:o,...t,headers:k([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString(),...r!=null?{"anthropic-user-profile-id":r}:void 0},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(N`/v1/messages/batches/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/messages/batches?beta=true",so,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(N`/v1/messages/batches/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},n?.headers])})}cancel(e,t={},n){let{betas:r}=t??{};return this._client.post(N`/v1/messages/batches/${e}/cancel?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},n?.headers])})}async results(e,t={},n){let r=await this.retrieve(e);if(!r.results_url)throw new z(`No batch \`results_url\`; Has it finished processing? ${r.processing_status} - ${r.id}`);let{betas:o}=t??{};return this._client.get(r.results_url,{...n,headers:k([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},n?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((s,i)=>Gc.fromResponse(i.response,i.controller))}}});var gg;var Kx=O(()=>{gg={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192}});function nN(e){return e?.output_format??e?.output_config?.format}function Gx(e,t,n){let r=nN(t);if(!t||!("parse"in(r??{})))return{...e,content:e.content.map((o)=>{if(o.type==="text"){let s=Object.defineProperty({...o},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(s,"parsed",{get(){return n.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return o}),parsed_output:null};return Wx(e,t,n)}function Wx(e,t,n){let r=null,o=e.content.map((s)=>{if(s.type==="text"){let i=yoe(t,s.text);if(r===null)r=i;let a=Object.defineProperty({...s},"parsed_output",{value:i,enumerable:!1});return Object.defineProperty(a,"parsed",{get(){return n.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),i},enumerable:!1})}return s});return{...e,content:o,parsed_output:r}}function yoe(e,t){let n=nN(e);if(n?.type!=="json_schema")return null;try{if("parse"in n)return n.parse(t);return JSON.parse(t)}catch(r){throw new z(`Failed to parse structured output: ${r}`)}}var qx=O(()=>{pt()});var Vx=O(()=>{$d()});var boe=(e)=>{let t=0,n=[];while(t<e.length){let r=e[t];if(r==="\\"){t++;continue}if(r==="{"){n.push({type:"brace",value:"{"}),t++;continue}if(r==="}"){n.push({type:"brace",value:"}"}),t++;continue}if(r==="["){n.push({type:"paren",value:"["}),t++;continue}if(r==="]"){n.push({type:"paren",value:"]"}),t++;continue}if(r===":"){n.push({type:"separator",value:":"}),t++;continue}if(r===","){n.push({type:"delimiter",value:","}),t++;continue}if(r==='"'){let a="",c=!1;r=e[++t];while(r!=='"'){if(t===e.length){c=!0;break}if(r==="\\"){if(t++,t===e.length){c=!0;break}a+=r+e[t],r=e[++t]}else a+=r,r=e[++t]}if(r=e[++t],!c)n.push({type:"string",value:a});continue}if(r&&/\s/.test(r)){t++;continue}let s=/[0-9]/;if(r&&s.test(r)||r==="-"||r==="."){let a="";if(r==="-")a+=r,r=e[++t];while(r&&(s.test(r)||r==="."||r==="e"||r==="E"||(r==="-"||r==="+")&&(a[a.length-1]==="e"||a[a.length-1]==="E")))a+=r,r=e[++t];n.push({type:"number",value:a});continue}let i=/[a-z]/i;if(r&&i.test(r)){let a="";while(r&&i.test(r)){if(t===e.length)break;a+=r,r=e[++t]}if(a=="true"||a=="false"||a==="null")n.push({type:"name",value:a});else{t++;continue}continue}t++}return n},Wc=(e)=>{if(e.length===0)return e;let t=e[e.length-1];switch(t.type){case"separator":return e=e.slice(0,e.length-1),Wc(e);break;case"number":let n=t.value[t.value.length-1];if(n==="."||n==="-"||n==="+"||n==="e"||n==="E")return e=e.slice(0,e.length-1),Wc(e);case"string":let r=e[e.length-2];if(r?.type==="delimiter")return e=e.slice(0,e.length-1),Wc(e);else if(r?.type==="brace"&&r.value==="{")return e=e.slice(0,e.length-1),Wc(e);break;case"delimiter":return e=e.slice(0,e.length-1),Wc(e);break}return e},Soe=(e)=>{let t=[];if(e.map((n)=>{if(n.type==="brace")if(n.value==="{")t.push("}");else t.splice(t.lastIndexOf("}"),1);if(n.type==="paren")if(n.value==="[")t.push("]");else t.splice(t.lastIndexOf("]"),1)}),t.length>0)t.reverse().map((n)=>{if(n==="}")e.push({type:"brace",value:"}"});else if(n==="]")e.push({type:"paren",value:"]"})});return e},Eoe=(e)=>{let t="";return e.map((n)=>{switch(n.type){case"string":t+='"'+n.value+'"';break;default:t+=n.value;break}}),t},rN=(e)=>JSON.parse(Eoe(Soe(Wc(boe(e)))));var oN=()=>{};function _g(e,t){let n={};for(let s of Object.keys(e))if(s!=="input")n[s]=e[s];Object.defineProperty(n,Xs,{value:t,enumerable:!1,writable:!0});let r,o=!1;return Object.defineProperty(n,"input",{enumerable:!0,configurable:!0,get(){if(!o)r=t?rN(t):{},o=!0;return r}}),n}var Xs="__json_buf";var Zx=O(()=>{oN()});function tv(e){return e.type==="tool_use"||e.type==="server_tool_use"||e.type==="mcp_tool_use"}function aN(e){}var Vn,Qs,qc,yp,yg,bp,Sp,bg,Ep,$o,xp,Sg,Eg,la,xg,vg,vp,Yx,sN,wp,Jx,Xx,Qx,iN,ev,Ap;var cN=O(()=>{Kn();jo();Kc();Vx();qx();Zx();Ap=class Ap{constructor(e,t){Vn.add(this),this.messages=[],this.receivedMessages=[],Qs.set(this,void 0),qc.set(this,null),this.controller=new AbortController,yp.set(this,void 0),yg.set(this,()=>{}),bp.set(this,()=>{}),Sp.set(this,void 0),bg.set(this,()=>{}),Ep.set(this,()=>{}),$o.set(this,{}),xp.set(this,!1),Sg.set(this,!1),Eg.set(this,!1),la.set(this,!1),xg.set(this,void 0),vg.set(this,void 0),vp.set(this,void 0),wp.set(this,(n)=>{if(L(this,Sg,!0,"f"),Pr(n))n=new fn;if(n instanceof fn)return L(this,Eg,!0,"f"),this._emit("abort",n);if(n instanceof z)return this._emit("error",n);if(n instanceof Error){let r=new z(n.message);return r.cause=n,this._emit("error",r)}return this._emit("error",new z(String(n)))}),L(this,yp,new Promise((n,r)=>{L(this,yg,n,"f"),L(this,bp,r,"f")}),"f"),L(this,Sp,new Promise((n,r)=>{L(this,bg,n,"f"),L(this,Ep,r,"f")}),"f"),E(this,yp,"f").catch(()=>{}),E(this,Sp,"f").catch(()=>{}),L(this,qc,e,"f"),L(this,vp,t?.logger??console,"f")}get response(){return E(this,xg,"f")}get request_id(){return E(this,vg,"f")}async withResponse(){L(this,la,!0,"f");let e=await E(this,yp,"f");if(!e)throw Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let t=new Ap(null);return t._run(()=>t._fromReadableStream(e)),t}static createMessage(e,t,n,{logger:r}={}){let o=new Ap(t,{logger:r});for(let s of t.messages)o._addMessageParam(s);return L(o,qc,{...t,stream:!0},"f"),o._run(()=>o._createMessage(e,{...t,stream:!0},{...n,headers:{...n?.headers,[Yh]:"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},E(this,wp,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){if(this.receivedMessages.push(e),t)this._emit("message",e)}async _createMessage(e,t,n){let r=n?.signal,o;if(r){if(r.aborted)this.controller.abort();o=this.controller.abort.bind(this.controller),r.addEventListener("abort",o)}try{E(this,Vn,"m",Jx).call(this);let{response:s,data:i}=await e.create({...t,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(s);for await(let a of i)E(this,Vn,"m",Xx).call(this,a);if(i.controller.signal?.aborted)throw new fn;E(this,Vn,"m",Qx).call(this)}finally{if(r&&o)r.removeEventListener("abort",o)}}_connected(e){if(this.ended)return;L(this,xg,e,"f"),L(this,vg,e?.headers.get("request-id"),"f"),E(this,yg,"f").call(this,e),this._emit("connect")}get ended(){return E(this,xp,"f")}get errored(){return E(this,Sg,"f")}get aborted(){return E(this,Eg,"f")}abort(){this.controller.abort()}on(e,t){return(E(this,$o,"f")[e]||(E(this,$o,"f")[e]=[])).push({listener:t}),this}off(e,t){let n=E(this,$o,"f")[e];if(!n)return this;let r=n.findIndex((o)=>o.listener===t);if(r>=0)n.splice(r,1);return this}once(e,t){return(E(this,$o,"f")[e]||(E(this,$o,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,n)=>{if(L(this,la,!0,"f"),e!=="error")this.once("error",n);this.once(e,t)})}async done(){L(this,la,!0,"f"),await E(this,Sp,"f")}get currentMessage(){return E(this,Qs,"f")}async finalMessage(){return await this.done(),E(this,Vn,"m",Yx).call(this)}async finalText(){return await this.done(),E(this,Vn,"m",sN).call(this)}_emit(e,...t){if(E(this,xp,"f"))return;if(e==="end")L(this,xp,!0,"f"),E(this,bg,"f").call(this);let n=E(this,$o,"f")[e];if(n)E(this,$o,"f")[e]=n.filter((r)=>!r.once),n.forEach(({listener:r})=>r(...t));if(e==="abort"){let r=t[0];if(!E(this,la,"f")&&!n?.length)Promise.reject(r);E(this,bp,"f").call(this,r),E(this,Ep,"f").call(this,r),this._emit("end");return}if(e==="error"){let r=t[0];if(!E(this,la,"f")&&!n?.length)Promise.reject(r);E(this,bp,"f").call(this,r),E(this,Ep,"f").call(this,r),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",E(this,Vn,"m",Yx).call(this))}async _fromReadableStream(e,t){let n=t?.signal,r;if(n){if(n.aborted)this.controller.abort();r=this.controller.abort.bind(this.controller),n.addEventListener("abort",r)}try{E(this,Vn,"m",Jx).call(this),this._connected(null);let o=wn.fromReadableStream(e,this.controller);for await(let s of o)E(this,Vn,"m",Xx).call(this,s);if(o.controller.signal?.aborted)throw new fn;E(this,Vn,"m",Qx).call(this)}finally{if(n&&r)n.removeEventListener("abort",r)}}[(Qs=new WeakMap,qc=new WeakMap,yp=new WeakMap,yg=new WeakMap,bp=new WeakMap,Sp=new WeakMap,bg=new WeakMap,Ep=new WeakMap,$o=new WeakMap,xp=new WeakMap,Sg=new WeakMap,Eg=new WeakMap,la=new WeakMap,xg=new WeakMap,vg=new WeakMap,vp=new WeakMap,wp=new WeakMap,Vn=new WeakSet,Yx=function(){if(this.receivedMessages.length===0)throw new z("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},sN=function(){if(this.receivedMessages.length===0)throw new z("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter((n)=>n.type==="text").map((n)=>n.text);if(t.length===0)throw new z("stream ended without producing a content block with type=text");return t.join(" ")},Jx=function(){if(this.ended)return;L(this,Qs,void 0,"f")},Xx=function(t){if(this.ended)return;let n=E(this,Vn,"m",iN).call(this,t);switch(this._emit("streamEvent",t,n),t.type){case"content_block_delta":{let r=n.content.at(-1);switch(t.delta.type){case"text_delta":{if(r.type==="text")this._emit("text",t.delta.text,r.text||"");break}case"citations_delta":{if(r.type==="text")this._emit("citation",t.delta.citation,r.citations??[]);break}case"input_json_delta":{if(tv(r)&&E(this,$o,"f").inputJson?.length){let o;try{o=r.input}catch(s){E(this,wp,"f").call(this,E(this,Vn,"m",ev).call(this,r,s));break}this._emit("inputJson",t.delta.partial_json,o)}break}case"thinking_delta":{if(r.type==="thinking")this._emit("thinking",t.delta.thinking,r.thinking);break}case"signature_delta":{if(r.type==="thinking")this._emit("signature",r.signature);break}case"compaction_delta":{if(r.type==="compaction"&&r.content)this._emit("compaction",r.content);break}default:aN(t.delta)}break}case"message_stop":{this._addMessageParam(n),this._addMessage(Gx(n,E(this,qc,"f"),{logger:E(this,vp,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{L(this,Qs,n,"f");break}case"content_block_start":case"message_delta":break}},Qx=function(){if(this.ended)throw new z("stream has ended, this shouldn't happen");let t=E(this,Qs,"f");if(!t)throw new z("request ended without sending any chunks");return L(this,Qs,void 0,"f"),Gx(t,E(this,qc,"f"),{logger:E(this,vp,"f")})},iN=function(t){let n=E(this,Qs,"f");if(t.type==="message_start"){if(n)throw new z(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!n)throw new z(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return n;case"message_delta":if(n.container=t.delta.container,n.stop_reason=t.delta.stop_reason,n.stop_sequence=t.delta.stop_sequence,t.delta.stop_details!=null)n.stop_details=t.delta.stop_details;if(n.usage.output_tokens=t.usage.output_tokens,n.context_management=t.context_management,t.usage.input_tokens!=null)n.usage.input_tokens=t.usage.input_tokens;if(t.usage.cache_creation_input_tokens!=null)n.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens;if(t.usage.cache_read_input_tokens!=null)n.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens;if(t.usage.server_tool_use!=null)n.usage.server_tool_use=t.usage.server_tool_use;if(t.usage.iterations!=null)n.usage.iterations=t.usage.iterations;return n;case"content_block_start":if(n.content.push(t.content_block),t.content_block.type==="fallback")n.model=t.content_block.to.model;return n;case"content_block_delta":{let r=n.content.at(t.index);switch(t.delta.type){case"text_delta":{if(r?.type==="text")n.content[t.index]={...r,text:(r.text||"")+t.delta.text};break}case"citations_delta":{if(r?.type==="text")n.content[t.index]={...r,citations:[...r.citations??[],t.delta.citation]};break}case"input_json_delta":{if(r&&tv(r)){let o=(r[Xs]||"")+t.delta.partial_json;n.content[t.index]=_g(r,o)}break}case"thinking_delta":{if(r?.type==="thinking")n.content[t.index]={...r,thinking:r.thinking+t.delta.thinking};break}case"signature_delta":{if(r?.type==="thinking")n.content[t.index]={...r,signature:t.delta.signature};break}case"compaction_delta":{if(r?.type==="compaction")n.content[t.index]={...r,content:(r.content||"")+t.delta.content,encrypted_content:t.delta.encrypted_content};break}default:aN(t.delta)}return n}case"content_block_stop":{let r=n.content.at(t.index);if(r&&tv(r)&&Xs in r){let o;try{o=r.input}catch(s){o={},E(this,wp,"f").call(this,E(this,Vn,"m",ev).call(this,r,s))}Object.defineProperty(r,"input",{value:o,enumerable:!0,configurable:!0,writable:!0})}return n}}},ev=function(t,n){let r=t[Xs];return new z(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${n}. JSON: ${r}`)},Symbol.asyncIterator)](){let e=[],t=[],n=!1;return this.on("streamEvent",(r)=>{let o=t.shift();if(o)o.resolve(r);else e.push(r)}),this.on("end",()=>{n=!0;for(let r of t)r.resolve(void 0);t.length=0}),this.on("abort",(r)=>{n=!0;for(let o of t)o.reject(r);t.length=0}),this.on("error",(r)=>{n=!0;for(let o of t)o.reject(r);t.length=0}),{next:async()=>{if(!e.length){if(n)return{value:void 0,done:!0};return new Promise((o,s)=>t.push({resolve:o,reject:s})).then((o)=>o?{value:o,done:!1}:{value:void 0,done:!0})}return{value:e.shift(),done:!1}},return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new wn(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var lN=1e5,uN=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
28
- 1. Task Overview
29
- The user's core request and success criteria
30
- Any clarifications or constraints they specified
31
- 2. Current State
32
- What has been completed so far
33
- Files created, modified, or analyzed (with paths if relevant)
34
- Key outputs or artifacts produced
35
- 3. Important Discoveries
36
- Technical constraints or requirements uncovered
37
- Decisions made and their rationale
38
- Errors encountered and how they were resolved
39
- What approaches were tried that didn't work (and why)
40
- 4. Next Steps
41
- Specific actions needed to complete the task
42
- Any blockers or open questions to resolve
43
- Priority order if multiple steps remain
44
- 5. Context to Preserve
45
- User preferences or style requirements
46
- Domain-specific details that aren't obvious
47
- Any promises made to the user
48
- Be concise but complete—err on the side of including information that would prevent duplicate work or repeated mistakes. Write in a way that enables immediate resumption of the task.
49
- Wrap your summary in <summary></summary> tags.`;async function xoe(e,t=e.messages.at(-1),n){if(!t||t.role!=="assistant"||!t.content||typeof t.content==="string")return null;let r=t.content.filter((s)=>s.type==="tool_use");if(r.length===0)return null;return{role:"user",content:await Promise.all(r.map(async(s)=>{let i=e.tools.find((a)=>("name"in a?a.name:a.mcp_server_name)===s.name);if(!i||!("run"in i))return{type:"tool_result",tool_use_id:s.id,content:`Error: Tool '${s.name}' not found`,is_error:!0};try{let a=s.input;if("parse"in i&&i.parse)a=i.parse(a);let c=await i.run(a,{toolUse:s,toolUseBlock:s,signal:n?.signal});return{type:"tool_result",tool_use_id:s.id,content:c}}catch(a){return{type:"tool_result",tool_use_id:s.id,content:a instanceof Ee?a.content:`Error: ${a instanceof Error?a.message:String(a)}`,is_error:!0}}}))}}var Tp,Vc,ua,Jt,Zn,yr,ms,ei,Cp,dN,nv,kp;var rv=O(()=>{Kn();na();pt();Me();jo();kp=class kp{constructor(e,t,n){Tp.add(this),this.client=e,Vc.set(this,!1),ua.set(this,!1),Jt.set(this,void 0),Zn.set(this,void 0),yr.set(this,void 0),ms.set(this,void 0),ei.set(this,void 0),Cp.set(this,0),L(this,Jt,{params:{...t,messages:structuredClone(t.messages)}},"f");let r=dx(t.tools,t.messages);if(L(this,Zn,{...n,headers:k([Zd("BetaToolRunner"),r.length?{[Vd]:r.join(", ")}:void 0,n?.headers])},"f"),L(this,ei,zc(),"f"),t.compactionControl?.enabled)console.warn('Anthropic: The `compactionControl` parameter is deprecated and will be removed in a future version. Use server-side compaction instead by passing `edits: [{ type: "compact_20260112" }]` in the params passed to `toolRunner()`. See https://platform.claude.com/docs/en/build-with-claude/compaction')}async*[(Vc=new WeakMap,ua=new WeakMap,Jt=new WeakMap,Zn=new WeakMap,yr=new WeakMap,ms=new WeakMap,ei=new WeakMap,Cp=new WeakMap,Tp=new WeakSet,dN=async function(){let t=E(this,Jt,"f").params.compactionControl;if(!t||!t.enabled)return!1;let n=0;if(E(this,yr,"f")!==void 0)try{let c=await E(this,yr,"f");n=c.usage.input_tokens+(c.usage.cache_creation_input_tokens??0)+(c.usage.cache_read_input_tokens??0)+c.usage.output_tokens}catch{return!1}let r=t.contextTokenThreshold??lN;if(n<r)return!1;let o=t.model??E(this,Jt,"f").params.model,s=t.summaryPrompt??uN,i=E(this,Jt,"f").params.messages;if(i[i.length-1].role==="assistant"){let c=i[i.length-1];if(Array.isArray(c.content)){let l=c.content.filter((u)=>u.type!=="tool_use");if(l.length===0)i.pop();else c.content=l}}let a=await this.client.beta.messages.create({model:o,messages:[...i,{role:"user",content:[{type:"text",text:s}]}],max_tokens:E(this,Jt,"f").params.max_tokens},{signal:E(this,Zn,"f").signal,headers:k([E(this,Zn,"f").headers,Zd("compaction")])});if(a.content[0]?.type!=="text")throw new z("Expected text response for compaction");return E(this,Jt,"f").params.messages=[{role:"user",content:a.content}],!0},Symbol.asyncIterator)](){var e;if(E(this,Vc,"f"))throw new z("Cannot iterate over a consumed stream");L(this,Vc,!0,"f"),L(this,ua,!0,"f"),L(this,ms,void 0,"f");try{while(!0){let t;try{if(E(this,Jt,"f").params.max_iterations&&E(this,Cp,"f")>=E(this,Jt,"f").params.max_iterations)break;L(this,ua,!1,"f"),L(this,ms,void 0,"f"),L(this,Cp,(e=E(this,Cp,"f"),e++,e),"f"),L(this,yr,void 0,"f");let{max_iterations:n,compactionControl:r,...o}=E(this,Jt,"f").params;if(o.stream)t=this.client.beta.messages.stream({...o},E(this,Zn,"f")),L(this,yr,t.finalMessage(),"f"),E(this,yr,"f").catch(()=>{}),yield t;else L(this,yr,this.client.beta.messages.create({...o,stream:!1},E(this,Zn,"f")),"f"),yield E(this,yr,"f");if(!await E(this,Tp,"m",dN).call(this)){if(!E(this,ua,"f")){let a=await E(this,yr,"f");if(E(this,Jt,"f").params.messages.push({role:a.role,content:a.content}),a.stop_reason==="refusal")break}let i=await E(this,Tp,"m",nv).call(this,E(this,Jt,"f").params.messages.at(-1));if(i)E(this,Jt,"f").params.messages.push(i);else if(!E(this,ua,"f"))break}}finally{if(t)t.abort()}}if(!E(this,yr,"f"))throw new z("ToolRunner concluded without a message from the server");E(this,ei,"f").resolve(await E(this,yr,"f"))}catch(t){throw L(this,Vc,!1,"f"),E(this,ei,"f").promise.catch(()=>{}),E(this,ei,"f").reject(t),L(this,ei,zc(),"f"),t}}setMessagesParams(e){if(typeof e==="function")E(this,Jt,"f").params=e(E(this,Jt,"f").params);else E(this,Jt,"f").params=e;L(this,ua,!0,"f"),L(this,ms,void 0,"f")}setRequestOptions(e){if(typeof e==="function")L(this,Zn,e(E(this,Zn,"f")),"f");else L(this,Zn,{...E(this,Zn,"f"),...e},"f")}async generateToolResponse(e=E(this,Zn,"f").signal){let t=await E(this,yr,"f")??this.params.messages.at(-1);if(!t)return null;return E(this,Tp,"m",nv).call(this,t,e)}done(){return E(this,ei,"f").promise}async runUntilDone(){if(!E(this,Vc,"f"))for await(let e of this);return this.done()}get params(){return E(this,Jt,"f").params}pushMessages(...e){this.setMessagesParams((t)=>({...t,messages:[...t.messages,...e]}))}then(e,t){return this.runUntilDone().then(e,t)}};nv=async function(t,n=E(this,Zn,"f").signal){if(E(this,ms,"f")!==void 0)return E(this,ms,"f");return L(this,ms,xoe(E(this,Jt,"f").params,t,{...E(this,Zn,"f"),signal:n}),"f"),E(this,ms,"f")}});function fN(e){if(!e.output_format)return e;if(e.output_config?.format)throw new z("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:t,...n}=e;return{...n,output_config:{...e.output_config,format:t}}}var pN,voe,ti;var ov=O(()=>{Kc();Bx();Kx();Me();jo();qx();cN();rv();na();Bx();rv();na();pN={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","claude-3-5-haiku-latest":"February 19th, 2026","claude-3-5-haiku-20241022":"February 19th, 2026","claude-opus-4-0":"June 15th, 2026","claude-opus-4-20250514":"June 15th, 2026","claude-sonnet-4-0":"June 15th, 2026","claude-sonnet-4-20250514":"June 15th, 2026","claude-opus-4-1":"August 5th, 2026","claude-opus-4-1-20250805":"August 5th, 2026","claude-mythos-preview":"June 30th, 2026"},voe=["claude-mythos-preview","claude-opus-4-6"];ti=class ti extends re{constructor(){super(...arguments);this.batches=new _p(this._client)}create(e,t){let n=fN(e),{betas:r,user_profile_id:o,...s}=n;if(s.model in pN)console.warn(`The model '${s.model}' is deprecated and will reach end-of-life on ${pN[s.model]}
50
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(voe.includes(s.model)&&s.thinking&&s.thinking.type==="enabled")console.warn(`Using Claude with ${s.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let i=this._client._options.timeout;if(!s.stream&&i==null){let c=gg[s.model]??void 0;i=this._client.calculateNonstreamingTimeout(s.max_tokens,c)}let a=Jh(s.tools,s.messages);return this._client.post("/v1/messages?beta=true",{body:s,timeout:i??600000,...t,headers:k([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0,...o!=null?{"anthropic-user-profile-id":o}:void 0},a,t?.headers]),stream:n.stream??!1})}parse(e,t){return t={...t,headers:k([{"anthropic-beta":[...e.betas??[],"structured-outputs-2025-12-15"].toString()},t?.headers])},this.create(e,t).then((n)=>Wx(n,e,{logger:this._client.logger??console}))}stream(e,t){return Ap.createMessage(this,e,t)}countTokens(e,t){let n=fN(e),{betas:r,user_profile_id:o,...s}=n;return this._client.post("/v1/messages/count_tokens?beta=true",{body:s,...t,headers:k([{"anthropic-beta":[...r??[],"token-counting-2024-11-01"].toString(),...o!=null?{"anthropic-user-profile-id":o}:void 0},t?.headers])})}toolRunner(e,t){return new kp(this._client,e,t)}};ti.Batches=_p;ti.BetaToolRunner=kp;ti.ToolError=Ee});var Zc;var sv=O(()=>{Xe();Me();ot();pg();pg();Zc=class Zc extends re{list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(N`/v1/sessions/${e}/events?beta=true`,ve,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}send(e,t,n){let{betas:r,...o}=t;return this._client.post(N`/v1/sessions/${e}/events?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}stream(e,t={},n){let{betas:r,...o}=t??{};return this._client.get(N`/v1/sessions/${e}/events/stream?beta=true`,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers]),stream:!0})}toolRunner(e,t){return new oa(e,{...t,client:this._client})}};Zc.SessionToolRunner=oa});var Rp;var iv=O(()=>{Xe();Me();ot();Rp=class Rp extends re{retrieve(e,t,n){let{session_id:r,betas:o}=t;return this._client.get(N`/v1/sessions/${r}/resources/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}update(e,t,n){let{session_id:r,betas:o,...s}=t;return this._client.post(N`/v1/sessions/${r}/resources/${e}?beta=true`,{body:s,...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(N`/v1/sessions/${e}/resources?beta=true`,ve,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}delete(e,t,n){let{session_id:r,betas:o}=t;return this._client.delete(N`/v1/sessions/${r}/resources/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}add(e,t,n){let{betas:r,...o}=t;return this._client.post(N`/v1/sessions/${e}/resources?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}}});var Op;var av=O(()=>{Xe();Me();ot();Op=class Op extends re{list(e,t,n){let{session_id:r,betas:o,...s}=t;return this._client.getAPIList(N`/v1/sessions/${r}/threads/${e}/events?beta=true`,ve,{query:s,...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}stream(e,t,n){let{session_id:r,betas:o}=t;return this._client.get(N`/v1/sessions/${r}/threads/${e}/stream?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers]),stream:!0})}}});var Yc;var cv=O(()=>{av();av();Xe();Me();ot();Yc=class Yc extends re{constructor(){super(...arguments);this.events=new Op(this._client)}retrieve(e,t,n){let{session_id:r,betas:o}=t;return this._client.get(N`/v1/sessions/${r}/threads/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(N`/v1/sessions/${e}/threads?beta=true`,ve,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}archive(e,t,n){let{session_id:r,betas:o}=t;return this._client.post(N`/v1/sessions/${r}/threads/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}};Yc.Events=Op});var ni;var lv=O(()=>{sv();sv();iv();iv();cv();cv();Xe();Me();ot();ni=class ni extends re{constructor(){super(...arguments);this.events=new Zc(this._client),this.resources=new Rp(this._client),this.threads=new Yc(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/sessions?beta=true",{body:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(N`/v1/sessions/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}update(e,t,n){let{betas:r,...o}=t;return this._client.post(N`/v1/sessions/${e}?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/sessions?beta=true",nx,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(N`/v1/sessions/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(N`/v1/sessions/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}};ni.Events=Zc;ni.Resources=Rp;ni.Threads=Yc});var Pp;var uv=O(()=>{Xe();Me();Pc();ot();Pp=class Pp extends re{create(e,t,n){let{betas:r,...o}=t;return this._client.post(N`/v1/skills/${e}/versions?beta=true`,Oc({body:o,...n,headers:k([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},n?.headers])},this._client,!1))}retrieve(e,t,n){let{skill_id:r,betas:o}=t;return this._client.get(N`/v1/skills/${r}/versions/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(N`/v1/skills/${e}/versions?beta=true`,ve,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},n?.headers])})}delete(e,t,n){let{skill_id:r,betas:o}=t;return this._client.delete(N`/v1/skills/${r}/versions/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},n?.headers])})}download(e,t,n){let{skill_id:r,betas:o}=t;return this._client.get(N`/v1/skills/${r}/versions/${e}/content?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString(),Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}}});var Jc;var dv=O(()=>{uv();uv();Xe();Me();Pc();ot();Jc=class Jc extends re{constructor(){super(...arguments);this.versions=new Pp(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/skills?beta=true",Oc({body:r,...t,headers:k([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},t?.headers])},this._client,!1))}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(N`/v1/skills/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/skills?beta=true",ve,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(N`/v1/skills/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},n?.headers])})}};Jc.Versions=Pp});var Ip;var pv=O(()=>{Xe();Me();ot();Ip=class Ip extends re{create(e,t,n){let{betas:r,...o}=t;return this._client.post(N`/v1/tunnels/${e}/certificates?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"mcp-tunnels-2026-06-22"].toString()},n?.headers])})}retrieve(e,t,n){let{tunnel_id:r,betas:o}=t;return this._client.get(N`/v1/tunnels/${r}/certificates/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"mcp-tunnels-2026-06-22"].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(N`/v1/tunnels/${e}/certificates?beta=true`,ve,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"mcp-tunnels-2026-06-22"].toString()},n?.headers])})}archive(e,t,n){let{tunnel_id:r,betas:o}=t;return this._client.post(N`/v1/tunnels/${r}/certificates/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"mcp-tunnels-2026-06-22"].toString()},n?.headers])})}}});var Xc;var fv=O(()=>{pv();pv();Xe();Me();ot();Xc=class Xc extends re{constructor(){super(...arguments);this.certificates=new Ip(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/tunnels?beta=true",{body:r,...t,headers:k([{"anthropic-beta":[...n??[],"mcp-tunnels-2026-06-22"].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(N`/v1/tunnels/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"mcp-tunnels-2026-06-22"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/tunnels?beta=true",ve,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"mcp-tunnels-2026-06-22"].toString()},t?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(N`/v1/tunnels/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"mcp-tunnels-2026-06-22"].toString()},n?.headers])})}revealToken(e,t={},n){let{betas:r}=t??{};return this._client.post(N`/v1/tunnels/${e}/reveal_token?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"mcp-tunnels-2026-06-22"].toString()},n?.headers])})}rotateToken(e,t,n){let{betas:r,...o}=t;return this._client.post(N`/v1/tunnels/${e}/rotate_token?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"mcp-tunnels-2026-06-22"].toString()},n?.headers])})}};Xc.Certificates=Ip});var Dp;var mv=O(()=>{Xe();Me();ot();Dp=class Dp extends re{create(e,t,n){let{betas:r,...o}=t;return this._client.post(N`/v1/vaults/${e}/credentials?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}retrieve(e,t,n){let{vault_id:r,betas:o}=t;return this._client.get(N`/v1/vaults/${r}/credentials/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}update(e,t,n){let{vault_id:r,betas:o,...s}=t;return this._client.post(N`/v1/vaults/${r}/credentials/${e}?beta=true`,{body:s,...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e,t={},n){let{betas:r,...o}=t??{};return this._client.getAPIList(N`/v1/vaults/${e}/credentials?beta=true`,ve,{query:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}delete(e,t,n){let{vault_id:r,betas:o}=t;return this._client.delete(N`/v1/vaults/${r}/credentials/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}archive(e,t,n){let{vault_id:r,betas:o}=t;return this._client.post(N`/v1/vaults/${r}/credentials/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}mcpOAuthValidate(e,t,n){let{vault_id:r,betas:o}=t;return this._client.post(N`/v1/vaults/${r}/credentials/${e}/mcp_oauth_validate?beta=true`,{...n,headers:k([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}}});var Qc;var hv=O(()=>{mv();mv();Xe();Me();ot();Qc=class Qc extends re{constructor(){super(...arguments);this.credentials=new Dp(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/vaults?beta=true",{body:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(N`/v1/vaults/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}update(e,t,n){let{betas:r,...o}=t;return this._client.post(N`/v1/vaults/${e}?beta=true`,{body:o,...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/vaults?beta=true",ve,{query:r,...t,headers:k([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}delete(e,t={},n){let{betas:r}=t??{};return this._client.delete(N`/v1/vaults/${e}?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(N`/v1/vaults/${e}/archive?beta=true`,{...n,headers:k([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},n?.headers])})}};Qc.Credentials=Dp});var Ht;var gv=O(()=>{cx();cx();lx();lx();ux();ux();px();px();fx();fx();mx();mx();_x();_x();bx();bx();Fx();Fx();zx();zx();ov();ov();lv();lv();dv();dv();fv();fv();hv();hv();Ht=class Ht extends re{constructor(){super(...arguments);this.models=new Jd(this._client),this.messages=new ti(this._client),this.agents=new Ic(this._client),this.environments=new Bc(this._client),this.sessions=new ni(this._client),this.deployments=new Gd(this._client),this.deploymentRuns=new Kd(this._client),this.vaults=new Qc(this._client),this.memoryStores=new ca(this._client),this.files=new Yd(this._client),this.skills=new Jc(this._client),this.webhooks=new tp(this._client),this.userProfiles=new Xd(this._client),this.dreams=new Wd(this._client),this.tunnels=new Xc(this._client)}};Ht.Models=Jd;Ht.Messages=ti;Ht.Agents=Ic;Ht.Environments=Bc;Ht.Sessions=ni;Ht.Deployments=Gd;Ht.DeploymentRuns=Kd;Ht.Vaults=Qc;Ht.MemoryStores=ca;Ht.Files=Yd;Ht.Skills=Jc;Ht.Webhooks=tp;Ht.UserProfiles=Xd;Ht.Dreams=Wd;Ht.Tunnels=Xc});var el;var _v=O(()=>{Me();el=class el extends re{create(e,t){let{betas:n,...r}=e;return this._client.post("/v1/complete",{body:r,timeout:this._client._options.timeout??600000,...t,headers:k([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},t?.headers]),stream:e.stream??!1})}}});function mN(e){return e?.output_config?.format}function yv(e,t,n){let r=mN(t);if(!t||!("parse"in(r??{})))return{...e,content:e.content.map((o)=>{if(o.type==="text")return Object.defineProperty({...o},"parsed_output",{value:null,enumerable:!1});return o}),parsed_output:null};return bv(e,t,n)}function bv(e,t,n){let r=null,o=e.content.map((s)=>{if(s.type==="text"){let i=Noe(t,s.text);if(r===null)r=i;return Object.defineProperty({...s},"parsed_output",{value:i,enumerable:!1})}return s});return{...e,content:o,parsed_output:r}}function Noe(e,t){let n=mN(e);if(n?.type!=="json_schema")return null;try{if("parse"in n)return n.parse(t);return JSON.parse(t)}catch(r){throw new z(`Failed to parse structured output: ${r}`)}}var Sv=O(()=>{pt()});function Tv(e){return e.type==="tool_use"||e.type==="server_tool_use"}function _N(e){}var Nr,ri,tl,Lp,wg,Mp,Np,Ag,Up,zo,Fp,Tg,Cg,da,kg,Rg,jp,Ev,hN,xv,vv,wv,Av,gN,$p;var yN=O(()=>{Kn();jo();Kc();Vx();Sv();Zx();$p=class $p{constructor(e,t){Nr.add(this),this.messages=[],this.receivedMessages=[],ri.set(this,void 0),tl.set(this,null),this.controller=new AbortController,Lp.set(this,void 0),wg.set(this,()=>{}),Mp.set(this,()=>{}),Np.set(this,void 0),Ag.set(this,()=>{}),Up.set(this,()=>{}),zo.set(this,{}),Fp.set(this,!1),Tg.set(this,!1),Cg.set(this,!1),da.set(this,!1),kg.set(this,void 0),Rg.set(this,void 0),jp.set(this,void 0),xv.set(this,(n)=>{if(L(this,Tg,!0,"f"),Pr(n))n=new fn;if(n instanceof fn)return L(this,Cg,!0,"f"),this._emit("abort",n);if(n instanceof z)return this._emit("error",n);if(n instanceof Error){let r=new z(n.message);return r.cause=n,this._emit("error",r)}return this._emit("error",new z(String(n)))}),L(this,Lp,new Promise((n,r)=>{L(this,wg,n,"f"),L(this,Mp,r,"f")}),"f"),L(this,Np,new Promise((n,r)=>{L(this,Ag,n,"f"),L(this,Up,r,"f")}),"f"),E(this,Lp,"f").catch(()=>{}),E(this,Np,"f").catch(()=>{}),L(this,tl,e,"f"),L(this,jp,t?.logger??console,"f")}get response(){return E(this,kg,"f")}get request_id(){return E(this,Rg,"f")}async withResponse(){L(this,da,!0,"f");let e=await E(this,Lp,"f");if(!e)throw Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let t=new $p(null);return t._run(()=>t._fromReadableStream(e)),t}static createMessage(e,t,n,{logger:r}={}){let o=new $p(t,{logger:r});for(let s of t.messages)o._addMessageParam(s);return L(o,tl,{...t,stream:!0},"f"),o._run(()=>o._createMessage(e,{...t,stream:!0},{...n,headers:{...n?.headers,[Yh]:"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},E(this,xv,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){if(this.receivedMessages.push(e),t)this._emit("message",e)}async _createMessage(e,t,n){let r=n?.signal,o;if(r){if(r.aborted)this.controller.abort();o=this.controller.abort.bind(this.controller),r.addEventListener("abort",o)}try{E(this,Nr,"m",vv).call(this);let{response:s,data:i}=await e.create({...t,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(s);for await(let a of i)E(this,Nr,"m",wv).call(this,a);if(i.controller.signal?.aborted)throw new fn;E(this,Nr,"m",Av).call(this)}finally{if(r&&o)r.removeEventListener("abort",o)}}_connected(e){if(this.ended)return;L(this,kg,e,"f"),L(this,Rg,e?.headers.get("request-id"),"f"),E(this,wg,"f").call(this,e),this._emit("connect")}get ended(){return E(this,Fp,"f")}get errored(){return E(this,Tg,"f")}get aborted(){return E(this,Cg,"f")}abort(){this.controller.abort()}on(e,t){return(E(this,zo,"f")[e]||(E(this,zo,"f")[e]=[])).push({listener:t}),this}off(e,t){let n=E(this,zo,"f")[e];if(!n)return this;let r=n.findIndex((o)=>o.listener===t);if(r>=0)n.splice(r,1);return this}once(e,t){return(E(this,zo,"f")[e]||(E(this,zo,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,n)=>{if(L(this,da,!0,"f"),e!=="error")this.once("error",n);this.once(e,t)})}async done(){L(this,da,!0,"f"),await E(this,Np,"f")}get currentMessage(){return E(this,ri,"f")}async finalMessage(){return await this.done(),E(this,Nr,"m",Ev).call(this)}async finalText(){return await this.done(),E(this,Nr,"m",hN).call(this)}_emit(e,...t){if(E(this,Fp,"f"))return;if(e==="end")L(this,Fp,!0,"f"),E(this,Ag,"f").call(this);let n=E(this,zo,"f")[e];if(n)E(this,zo,"f")[e]=n.filter((r)=>!r.once),n.forEach(({listener:r})=>r(...t));if(e==="abort"){let r=t[0];if(!E(this,da,"f")&&!n?.length)Promise.reject(r);E(this,Mp,"f").call(this,r),E(this,Up,"f").call(this,r),this._emit("end");return}if(e==="error"){let r=t[0];if(!E(this,da,"f")&&!n?.length)Promise.reject(r);E(this,Mp,"f").call(this,r),E(this,Up,"f").call(this,r),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",E(this,Nr,"m",Ev).call(this))}async _fromReadableStream(e,t){let n=t?.signal,r;if(n){if(n.aborted)this.controller.abort();r=this.controller.abort.bind(this.controller),n.addEventListener("abort",r)}try{E(this,Nr,"m",vv).call(this),this._connected(null);let o=wn.fromReadableStream(e,this.controller);for await(let s of o)E(this,Nr,"m",wv).call(this,s);if(o.controller.signal?.aborted)throw new fn;E(this,Nr,"m",Av).call(this)}finally{if(n&&r)n.removeEventListener("abort",r)}}[(ri=new WeakMap,tl=new WeakMap,Lp=new WeakMap,wg=new WeakMap,Mp=new WeakMap,Np=new WeakMap,Ag=new WeakMap,Up=new WeakMap,zo=new WeakMap,Fp=new WeakMap,Tg=new WeakMap,Cg=new WeakMap,da=new WeakMap,kg=new WeakMap,Rg=new WeakMap,jp=new WeakMap,xv=new WeakMap,Nr=new WeakSet,Ev=function(){if(this.receivedMessages.length===0)throw new z("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},hN=function(){if(this.receivedMessages.length===0)throw new z("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter((n)=>n.type==="text").map((n)=>n.text);if(t.length===0)throw new z("stream ended without producing a content block with type=text");return t.join(" ")},vv=function(){if(this.ended)return;L(this,ri,void 0,"f")},wv=function(t){if(this.ended)return;let n=E(this,Nr,"m",gN).call(this,t);switch(this._emit("streamEvent",t,n),t.type){case"content_block_delta":{let r=n.content.at(-1);switch(t.delta.type){case"text_delta":{if(r.type==="text")this._emit("text",t.delta.text,r.text||"");break}case"citations_delta":{if(r.type==="text")this._emit("citation",t.delta.citation,r.citations??[]);break}case"input_json_delta":{if(Tv(r)&&E(this,zo,"f").inputJson?.length)this._emit("inputJson",t.delta.partial_json,r.input);break}case"thinking_delta":{if(r.type==="thinking")this._emit("thinking",t.delta.thinking,r.thinking);break}case"signature_delta":{if(r.type==="thinking")this._emit("signature",r.signature);break}default:_N(t.delta)}break}case"message_stop":{this._addMessageParam(n),this._addMessage(yv(n,E(this,tl,"f"),{logger:E(this,jp,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{L(this,ri,n,"f");break}case"content_block_start":case"message_delta":break}},Av=function(){if(this.ended)throw new z("stream has ended, this shouldn't happen");let t=E(this,ri,"f");if(!t)throw new z("request ended without sending any chunks");return L(this,ri,void 0,"f"),yv(t,E(this,tl,"f"),{logger:E(this,jp,"f")})},gN=function(t){let n=E(this,ri,"f");if(t.type==="message_start"){if(n)throw new z(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!n)throw new z(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return n;case"message_delta":if(n.stop_reason=t.delta.stop_reason,n.stop_sequence=t.delta.stop_sequence,t.delta.stop_details!=null)n.stop_details=t.delta.stop_details;if(n.usage.output_tokens=t.usage.output_tokens,t.usage.input_tokens!=null)n.usage.input_tokens=t.usage.input_tokens;if(t.usage.cache_creation_input_tokens!=null)n.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens;if(t.usage.cache_read_input_tokens!=null)n.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens;if(t.usage.server_tool_use!=null)n.usage.server_tool_use=t.usage.server_tool_use;return n;case"content_block_start":return n.content.push({...t.content_block}),n;case"content_block_delta":{let r=n.content.at(t.index);switch(t.delta.type){case"text_delta":{if(r?.type==="text")n.content[t.index]={...r,text:(r.text||"")+t.delta.text};break}case"citations_delta":{if(r?.type==="text")n.content[t.index]={...r,citations:[...r.citations??[],t.delta.citation]};break}case"input_json_delta":{if(r&&Tv(r)){let o=(r[Xs]||"")+t.delta.partial_json;n.content[t.index]=_g(r,o)}break}case"thinking_delta":{if(r?.type==="thinking")n.content[t.index]={...r,thinking:r.thinking+t.delta.thinking};break}case"signature_delta":{if(r?.type==="thinking")n.content[t.index]={...r,signature:t.delta.signature};break}default:_N(t.delta)}return n}case"content_block_stop":{let r=n.content.at(t.index);if(r&&Tv(r)&&Xs in r)Object.defineProperty(r,"input",{value:r.input,enumerable:!0,configurable:!0,writable:!0});return n}}},Symbol.asyncIterator)](){let e=[],t=[],n=!1;return this.on("streamEvent",(r)=>{let o=t.shift();if(o)o.resolve(r);else e.push(r)}),this.on("end",()=>{n=!0;for(let r of t)r.resolve(void 0);t.length=0}),this.on("abort",(r)=>{n=!0;for(let o of t)o.reject(r);t.length=0}),this.on("error",(r)=>{n=!0;for(let o of t)o.reject(r);t.length=0}),{next:async()=>{if(!e.length){if(n)return{value:void 0,done:!0};return new Promise((o,s)=>t.push({resolve:o,reject:s})).then((o)=>o?{value:o,done:!1}:{value:void 0,done:!0})}return{value:e.shift(),done:!1}},return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new wn(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var zp;var Cv=O(()=>{Xe();Me();Hx();Kc();ot();zp=class zp extends re{create(e,t){let{user_profile_id:n,...r}=e;return this._client.post("/v1/messages/batches",{body:r,...t,headers:k([{...n!=null?{"anthropic-user-profile-id":n}:void 0},t?.headers])})}retrieve(e,t){return this._client.get(N`/v1/messages/batches/${e}`,t)}list(e={},t){return this._client.getAPIList("/v1/messages/batches",so,{query:e,...t})}delete(e,t){return this._client.delete(N`/v1/messages/batches/${e}`,t)}cancel(e,t){return this._client.post(N`/v1/messages/batches/${e}/cancel`,t)}async results(e,t){let n=await this.retrieve(e);if(!n.results_url)throw new z(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);return this._client.get(n.results_url,{...t,headers:k([{Accept:"application/binary"},t?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((r,o)=>Gc.fromResponse(o.response,o.controller))}}});var pa,bN,Foe;var kv=O(()=>{Me();jo();yN();Sv();Cv();Cv();Kx();pa=class pa extends re{constructor(){super(...arguments);this.batches=new zp(this._client)}create(e,t){let{user_profile_id:n,...r}=e;if(r.model in bN)console.warn(`The model '${r.model}' is deprecated and will reach end-of-life on ${bN[r.model]}
51
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(Foe.includes(r.model)&&r.thinking&&r.thinking.type==="enabled")console.warn(`Using Claude with ${r.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let o=this._client._options.timeout;if(!r.stream&&o==null){let i=gg[r.model]??void 0;o=this._client.calculateNonstreamingTimeout(r.max_tokens,i)}let s=Jh(r.tools,r.messages);return this._client.post("/v1/messages",{body:r,timeout:o??600000,...t,headers:k([{...n!=null?{"anthropic-user-profile-id":n}:void 0},s,t?.headers]),stream:e.stream??!1})}parse(e,t){return this.create(e,t).then((n)=>bv(n,e,{logger:this._client.logger??console}))}stream(e,t){return $p.createMessage(this,e,t,{logger:this._client.logger??console})}countTokens(e,t){let{user_profile_id:n,...r}=e;return this._client.post("/v1/messages/count_tokens",{body:r,...t,headers:k([{...n!=null?{"anthropic-user-profile-id":n}:void 0},t?.headers])})}};bN={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","claude-3-5-haiku-latest":"February 19th, 2026","claude-3-5-haiku-20241022":"February 19th, 2026","claude-opus-4-0":"June 15th, 2026","claude-opus-4-20250514":"June 15th, 2026","claude-sonnet-4-0":"June 15th, 2026","claude-sonnet-4-20250514":"June 15th, 2026","claude-opus-4-1":"August 5th, 2026","claude-opus-4-1-20250805":"August 5th, 2026","claude-mythos-preview":"June 30th, 2026"},Foe=["claude-mythos-preview","claude-opus-4-6"];pa.Batches=zp});var nl;var Rv=O(()=>{Xe();Me();ot();nl=class nl extends re{retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(N`/v1/models/${e}`,{...n,headers:k([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList("/v1/models",so,{query:r,...t,headers:k([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},t?.headers])})}}});var SN=O(()=>{gv();_v();kv();Rv();J0()});class Mt{get credentials(){return this._authState.provider}constructor({baseURL:e=Le("ANTHROPIC_BASE_URL"),apiKey:t,authToken:n,webhookKey:r=Le("ANTHROPIC_WEBHOOK_SIGNING_KEY")??null,...o}={}){if(Ov.add(this),this._requestAuthFlags=new WeakMap,Og.set(this,void 0),t===void 0)t=o.profile!=null?null:Le("ANTHROPIC_API_KEY")??null;if(n===void 0)n=o.profile!=null?null:Le("ANTHROPIC_AUTH_TOKEN")??null;if(o.profile!=null&&(o.credentials!=null||o.config!=null))throw TypeError("Pass at most one of `profile`, `credentials`, or `config`.");let s={apiKey:t,authToken:n,webhookKey:r,...o,baseURL:e||"https://api.anthropic.com"};if(!s.dangerouslyAllowBrowser&&e0())throw new z(`It looks like you're running in a browser-like environment.
52
-
53
- This is disabled by default, as it risks exposing your secret API credentials to attackers.
54
- If you understand the risks and have appropriate mitigations in place,
55
- you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
56
-
57
- new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
58
- `);this.baseURL=s.baseURL,this._baseURLIsExplicit=o.__baseURLIsExplicit??!!e,this.timeout=s.timeout??Pv.DEFAULT_TIMEOUT,this.logger=s.logger??console,this.logLevel=Fd,this.logLevel=jh(s.logLevel,"ClientOptions.logLevel",Be(this))??jh(Le("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",Be(this))??Fd,this.fetchOptions=s.fetchOptions,this.maxRetries=s.maxRetries??2,this.fetch=s.fetch??t0(),L(this,Og,r0,"f"),this.middleware=[...s.middleware??[]];let i=Le("ANTHROPIC_CUSTOM_HEADERS");if(i){let c={};for(let l of i.split(`
59
- `)){let u=l.indexOf(":");if(u>=0)c[l.substring(0,u).trim()]=l.substring(u+1).trim()}s.defaultHeaders={...c,...s.defaultHeaders}}let a=o.__auth;if(delete s.__auth,delete s.__baseURLIsExplicit,this._options=s,this.apiKey=typeof t==="string"?t:null,this.authToken=n,this.webhookKey=r,a){if(this._authState=a,!this._baseURLIsExplicit&&a.baseURL)this.baseURL=a.baseURL}else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let c=s.credentials??null;if(c)this._authState.provider=c,this._authState.tokenCache=this._makeTokenCache(c);else if(s.config!=null){let l=XE(s.config,this._credentialResolverOptions());this._authState.provider=l.provider,this._authState.tokenCache=this._makeTokenCache(l.provider),this._authState.extraHeaders=l.extraHeaders,this._applyCredentialBaseURL(l.baseURL)}else if(s.profile!=null)this._authState.resolution=this._resolveDefaultCredentials(s.profile);else this._authState.resolution=this._resolveDefaultCredentials()}}_applyCredentialBaseURL(e){if(!e)return;let t=e.replace(/\/+$/,"");if(this._authState.baseURL=t,!this._baseURLIsExplicit)this.baseURL=t}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this._credentialsFetch(),userAgent:this.getUserAgent(),onCacheWriteError:(e)=>{Be(this).debug("credential cache write failed (best-effort)",e)},onSafetyWarning:(e)=>{Be(this).warn(e)}}}_credentialsFetch(){return tx(this.fetch,this.middleware,void 0,this)}_makeTokenCache(e){return new KE(e,(t)=>{Be(this).debug("advisory token refresh failed; serving cached token",t)})}withOptions(e){let t="credentials"in e||"config"in e||"profile"in e,n="apiKey"in e||"authToken"in e||t,r={...this._options,...this._baseURLIsExplicit?{baseURL:this.baseURL}:{},maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,middleware:this.middleware,apiKey:this.apiKey,authToken:this.authToken,webhookKey:this.webhookKey,credentials:this.credentials,...t?{credentials:void 0,config:void 0,profile:void 0}:{},...e,__auth:n?void 0:this._authState,__baseURLIsExplicit:"baseURL"in e?!0:this._baseURLIsExplicit};return new this.constructor(r)}async _resolveDefaultCredentials(e){try{let t=await j0(this._credentialResolverOptions(),e);if(t)this._authState.provider=t.provider,this._authState.tokenCache=this._makeTokenCache(t.provider),this._authState.extraHeaders=t.extraHeaders,this._applyCredentialBaseURL(t.baseURL);else if(e!=null)throw new z(`Profile "${e}" could not be resolved (no <config_dir>/configs/${e}.json found).`)}catch(t){this._authState.error=t}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(e.get("x-api-key")||e.get("authorization"))return;if(this._authState.error)throw this._authState.error;if(this._authState.tokenCache||this._authState.resolution)return;if(this.apiKey&&e.get("x-api-key"))return;if(t.has("x-api-key"))return;if(this.authToken&&e.get("authorization"))return;if(t.has("authorization"))return;throw Error('Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}_authFlags(e){let t=this._requestAuthFlags.get(e);if(!t)t={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(e,t);return t}async authHeaders(e){if(this._authState.resolution)await this._authState.resolution;if(this._authState.error)return;if(this._authState.tokenCache&&this.apiKey==null){let t=await this._authState.tokenCache.getToken();return this._authFlags(e).usedTokenCache=!0,k([{Authorization:`Bearer ${t}`}])}return k([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey==null)return;return k([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken==null)return;return k([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return m0(e)}getUserAgent(){return`${this.constructor.name}/JS ${Ir}`}defaultIdempotencyKey(){return`stainless-node-retry-${Tc()}`}makeStatusError(e,t,n,r){return Dt.generate(e,t,n,r)}buildURL(e,t,n){let r=!E(this,Ov,"m",EN).call(this)&&n||this.baseURL,o=VL(e)?new URL(e):new URL(r+(r.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),s=this.defaultQuery(),i=Object.fromEntries(o.searchParams);if(!DE(s)||!DE(i))t={...i,...s,...t};if(typeof t==="object"&&t&&!Array.isArray(t))o.search=this.stringifyQuery(t);return o.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128000>600)throw new z("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions(e){}async prepareRequest(e,{url:t,options:n}){if(this._authState.tokenCache&&this.apiKey==null){let r=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[s,i]of Object.entries(this._authState.extraHeaders))if(!r.has(s))r.set(s,i);if(!r.get("anthropic-beta")?.split(",").map((s)=>s.trim())?.includes(Ji))r.append("anthropic-beta",Ji);e.headers=r}}backendMiddleware(){return[]}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,n){return this.request(Promise.resolve(n).then((r)=>({method:e,path:t,...r})))}request(e,t=null){return new Xi(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,n){let r=await e,o=r.maxRetries??this.maxRetries;if(t==null)t=o,this._requestAuthFlags.delete(r);await this.prepareOptions(r);let{req:s,url:i,timeout:a}=await this.buildRequest(r,{retryCount:o-t}),c="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),l=n===void 0?"":`, retryOf: ${n}`,u=Date.now();if(r.signal?.aborted)throw new fn;let p=new AbortController,f=await this.fetchWithTimeout(i,s,a,p,r,{requestLogID:c,retryOfRequestLogID:n}).catch(Yi),m=Date.now();if(f instanceof globalThis.Error){let y=`retrying, ${t} attempts remaining`;if(r.signal?.aborted)throw new fn;let S=Pr(f)||/timed? ?out/i.test(String(f)+("cause"in f?String(f.cause):"")),b=this.middleware.length>0||!!r.middleware?.length||this.backendMiddleware().length>0;if(b&&!S&&!W0(f))throw Be(this).info(`[${c}] middleware error (not retryable)`),Be(this).debug(`[${c}] middleware error (not retryable)`,Uo({retryOfRequestLogID:n,url:i,durationMs:m-u,message:f.message})),f;if(t)return Be(this).info(`[${c}] connection ${S?"timed out":"failed"} - ${y}`),Be(this).debug(`[${c}] connection ${S?"timed out":"failed"} (${y})`,Uo({retryOfRequestLogID:n,url:i,durationMs:m-u,message:f.message})),this.retryRequest(r,t,n??c);if(Be(this).info(`[${c}] connection ${S?"timed out":"failed"} - error; no more retries left`),Be(this).debug(`[${c}] connection ${S?"timed out":"failed"} (error; no more retries left)`,Uo({retryOfRequestLogID:n,url:i,durationMs:m-u,message:f.message})),S)throw new wd;if(b&&!ex(f))throw f;throw new ps({cause:f})}let h=[...f.headers.entries()].filter(([y])=>y==="request-id").map(([y,S])=>", "+y+": "+JSON.stringify(S)).join(""),g=`[${c}${l}${h}] ${s.method} ${i} ${f.ok?"succeeded":"failed"} with status ${f.status} in ${m-u}ms`;if(!f.ok){let y=await this.shouldRetry(f,r);if(t&&y){let U=`retrying, ${t} attempts remaining`;return await n0(f.body),Be(this).info(`${g} - ${U}`),Be(this).debug(`[${c}] response error (${U})`,Uo({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,durationMs:m-u})),this.retryRequest(r,t,n??c,f.headers)}let S=y?"error; no more retries left":"error; not retryable";Be(this).info(`${g} - ${S}`);let b=await f.text().catch((U)=>Yi(U).message),x=Ld(b),v=x?void 0:b;throw Be(this).debug(`[${c}] response error (${S})`,Uo({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,message:v,durationMs:Date.now()-u})),this.makeStatusError(f.status,x,v,f.headers)}return Be(this).info(g),Be(this).debug(`[${c}] response start`,Uo({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,durationMs:m-u})),{response:f,options:r,controller:p,requestLogID:c,retryOfRequestLogID:n,startTime:u}}getAPIList(e,t,n){return this.requestAPIList(t,n&&"then"in n?n.then((r)=>({method:"get",path:e,...r})):{method:"get",path:e,...n})}requestAPIList(e,t){let n=this.makeRequest(t,null,void 0);return new Wh(this,n,e)}async fetchWithTimeout(e,t,n,r,o,s){let{signal:i,method:a,...c}=t||{},l=this._makeAbort(r);if(i)i.addEventListener("abort",l,{once:!0});let u=globalThis.ReadableStream&&c.body instanceof globalThis.ReadableStream||typeof c.body==="object"&&c.body!==null&&Symbol.asyncIterator in c.body,p={signal:r.signal,...u?{duplex:"half"}:{},method:"GET",...c};if(a)p.method=a.toUpperCase();let f=this.fetch,m=async(b,x)=>{let v=setTimeout(l,n);try{return await f.call(void 0,b,x)}finally{clearTimeout(v)}},h=o===void 0?m:async(b,x={})=>{let v=typeof b==="string"?b:b instanceof URL?b.href:b.url;if(x.headers=x.headers instanceof Headers?x.headers:new Headers(x.headers),await this.prepareRequest(x,{url:v,options:o}),s)Be(this).debug(`[${s.requestLogID}] sending request`,Uo({retryOfRequestLogID:s.retryOfRequestLogID,method:x.method,url:v,options:o,headers:x.headers}));return m(b,x)},g=o?.middleware,y=this.backendMiddleware(),S=g?.length||y.length?[...this.middleware,...g??[],...y]:this.middleware;return await tx(h,S,o,this)(e,p)}async shouldRetry(e,t){let n=this._authFlags(t);if(e.status===401&&this._authState.tokenCache&&n.usedTokenCache&&!n.didRefreshFor401)return n.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let r=e.headers.get("x-should-retry");if(r==="true")return!0;if(r==="false")return!1;if(e.status===408)return!0;if(e.status===409)return!0;if(e.status===429)return!0;if(e.status>=500)return!0;return!1}async retryRequest(e,t,n,r){let o,s=r?.get("retry-after-ms");if(s){let a=parseFloat(s);if(!Number.isNaN(a))o=a}let i=r?.get("retry-after");if(i&&!o){let a=parseFloat(i);if(!Number.isNaN(a))o=a*1000;else o=Date.parse(i)-Date.now()}if(o===void 0){let a=e.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(t,a)}return await ro(o),this.makeRequest(e,t-1,n)}calculateDefaultRetryTimeoutMillis(e,t){let o=t-e,s=Math.min(0.5*Math.pow(2,o),8),i=1-Math.random()*0.25;return s*i*1000}calculateNonstreamingTimeout(e,t){if(3600000*e/128000>600000||t!=null&&e>t)throw new z("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest(e,{retryCount:t=0}={}){let n={...e},{method:r,path:o,query:s,defaultBaseURL:i}=n;if(this._authState.resolution)await this._authState.resolution;if(!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL)this.baseURL=this._authState.baseURL;let a=this.buildURL(o,s,i);if("timeout"in n)YL("timeout",n.timeout);n.timeout=n.timeout??this.timeout;let{bodyHeaders:c,body:l}=this.buildBody({options:n}),u=await this.buildHeaders({options:e,method:r,bodyHeaders:c,retryCount:t});return{req:{method:r,headers:u,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:"half"},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:a,timeout:n.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:n,retryCount:r}){let o={};if(this.idempotencyHeader&&t!=="get"){if(!e.idempotencyKey)e.idempotencyKey=this.defaultIdempotencyKey();o[this.idempotencyHeader]=e.idempotencyKey}let s=k([o,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1000))}:{},...Md(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(s),s.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=k([t]);if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==="string"&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:e};else if(typeof e==="object"&&((Symbol.asyncIterator in e)||(Symbol.iterator in e)&&("next"in e)&&typeof e.next==="function"))return{bodyHeaders:void 0,body:Oh(e)};else if(typeof e==="object"&&n.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e)};else return E(this,Og,"f").call(this,{body:e,headers:n})}}var Ov,Pv,Og,EN,xN="\\n\\nHuman:",vN="\\n\\nAssistant:",fa;var Iv=O(()=>{Kn();no();Rh();HE();pt();kc();E0();$0();q0();Xe();ax();SN();Bh();_v();Rv();gv();kv();Rh();Me();Fo();no();Pv=Mt,Og=new WeakMap,Ov=new WeakSet,EN=function(){return this.baseURL!=="https://api.anthropic.com"};Mt.Anthropic=Pv;Mt.HUMAN_PROMPT=xN;Mt.AI_PROMPT=vN;Mt.DEFAULT_TIMEOUT=600000;Mt.AnthropicError=z;Mt.APIError=Dt;Mt.APIConnectionError=ps;Mt.APIConnectionTimeoutError=wd;Mt.APIUserAbortError=fn;Mt.NotFoundError=kd;Mt.ConflictError=Rd;Mt.RateLimitError=Pd;Mt.BadRequestError=Ad;Mt.AuthenticationError=Td;Mt.InternalServerError=Id;Mt.PermissionDeniedError=Cd;Mt.UnprocessableEntityError=Od;Mt.toFile=qh;fa=class fa extends Mt{constructor(){super(...arguments);this.completions=new el(this),this.messages=new pa(this),this.models=new nl(this),this.beta=new Ht(this)}};fa.Completions=el;fa.Messages=pa;fa.Models=nl;fa.Beta=Ht});var wN=O(()=>{pt();$d();Me();jo();no()});var Tx=O(()=>{Iv();ax();Bh();wN();Iv();Xe();pt()});function nf(e,t){return function(){return e.apply(t,arguments)}}function rf(e){return e!==null&&!jl(e)&&e.constructor!==null&&!jl(e.constructor)&&Jn(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}function $fe(e){let t;if(typeof ArrayBuffer<"u"&&ArrayBuffer.isView)t=ArrayBuffer.isView(e);else t=e&&e.buffer&&kj(e.buffer);return t}function Jfe(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;return{}}function sf(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,o;if(typeof e!=="object")e=[e];if($l(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(rf(e))return;let s=n?Object.getOwnPropertyNames(e):Object.keys(e),i=s.length,a;for(r=0;r<i;r++)a=s[r],t.call(null,e[a],a,e)}}function Oj(e,t){if(rf(e))return null;t=t.toLowerCase();let n=Object.keys(e),r=n.length,o;while(r-- >0)if(o=n[r],t===o.toLowerCase())return o;return null}function oA(){let{caseless:e,skipUndefined:t}=Pj(this)&&this||{},n={},r=(o,s)=>{if(s==="__proto__"||s==="constructor"||s==="prototype")return;let i=e&&Oj(n,s)||s;if(c_(n[i])&&c_(o))n[i]=oA(n[i],o);else if(c_(o))n[i]=oA({},o);else if($l(o))n[i]=o.slice();else if(!t||!jl(o))n[i]=o};for(let o=0,s=arguments.length;o<s;o++)arguments[o]&&sf(arguments[o],r);return n}function Eme(e){return!!(e&&Jn(e.append)&&e[Cj]==="FormData"&&e[u_])}var jfe,l_,u_,Cj,d_,mo=(e)=>(e=e.toLowerCase(),(t)=>d_(t)===e),p_=(e)=>(t)=>typeof t===e,$l,jl,kj,zfe,Jn,Rj,of=(e)=>e!==null&&typeof e==="object",Hfe=(e)=>e===!0||e===!1,c_=(e)=>{if(d_(e)!=="object")return!1;let t=l_(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Cj in e)&&!(u_ in e)},Bfe=(e)=>{if(!of(e)||rf(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},Kfe,Gfe,Wfe=(e)=>!!(e&&typeof e.uri<"u"),qfe=(e)=>e&&typeof e.getParts<"u",Vfe,Zfe,Yfe=(e)=>of(e)&&Jn(e.pipe),wj,Aj,Xfe=(e)=>{if(!e)return!1;if(Aj&&e instanceof Aj)return!0;let t=l_(e);if(!t||t===Object.prototype)return!1;if(!Jn(e.append))return!1;let n=d_(e);return n==="formdata"||n==="object"&&Jn(e.toString)&&e.toString()==="[object FormData]"},Qfe,eme,tme,nme,rme,ome=(e)=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),Sa,Pj=(e)=>!jl(e)&&e!==Sa,sme=(e,t,n,{allOwnKeys:r}={})=>(sf(t,(o,s)=>{if(n&&Jn(o))Object.defineProperty(e,s,{value:nf(o,n),writable:!0,enumerable:!0,configurable:!0});else Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),ime=(e)=>{if(e.charCodeAt(0)===65279)e=e.slice(1);return e},ame=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},cme=(e,t,n,r)=>{let o,s,i,a={};if(t=t||{},e==null)return t;do{o=Object.getOwnPropertyNames(e),s=o.length;while(s-- >0)if(i=o[s],(!r||r(i,e,t))&&!a[i])t[i]=e[i],a[i]=!0;e=n!==!1&&l_(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},lme=(e,t,n)=>{if(e=String(e),n===void 0||n>e.length)n=e.length;n-=t.length;let r=e.indexOf(t,n);return r!==-1&&r===n},ume=(e)=>{if(!e)return null;if($l(e))return e;let t=e.length;if(!Rj(t))return null;let n=Array(t);while(t-- >0)n[t]=e[t];return n},dme,pme=(e,t)=>{let r=(e&&e[u_]).call(e),o;while((o=r.next())&&!o.done){let s=o.value;t.call(e,s[0],s[1])}},fme=(e,t)=>{let n,r=[];while((n=e.exec(t))!==null)r.push(n);return r},mme,hme=(e)=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,o){return r.toUpperCase()+o}),Tj,gme,Ij=(e,t)=>{let n=Object.getOwnPropertyDescriptors(e),r={};sf(n,(o,s)=>{let i;if((i=t(o,s,e))!==!1)r[s]=i||o}),Object.defineProperties(e,r)},_me=(e)=>{Ij(e,(t,n)=>{if(Jn(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;let r=e[n];if(!Jn(r))return;if(t.enumerable=!1,"writable"in t){t.writable=!1;return}if(!t.set)t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}})},yme=(e,t)=>{let n={},r=(o)=>{o.forEach((s)=>{n[s]=!0})};return $l(e)?r(e):r(String(e).split(t)),n},bme=()=>{},Sme=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,xme=(e)=>{let t=[,,,,,,,,,,],n=(r,o)=>{if(of(r)){if(t.indexOf(r)>=0)return;if(rf(r))return r;if(!("toJSON"in r)){t[o]=r;let s=$l(r)?[]:{};return sf(r,(i,a)=>{let c=n(i,o+1);!jl(c)&&(s[a]=c)}),t[o]=void 0,s}}return r};return n(e,0)},vme,wme=(e)=>e&&(of(e)||Jn(e))&&Jn(e.then)&&Jn(e.catch),Dj,Ame,Tme=(e)=>e!=null&&Jn(e[u_]),w;var lt=O(()=>{({toString:jfe}=Object.prototype),{getPrototypeOf:l_}=Object,{iterator:u_,toStringTag:Cj}=Symbol,d_=((e)=>(t)=>{let n=jfe.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),{isArray:$l}=Array,jl=p_("undefined");kj=mo("ArrayBuffer");zfe=p_("string"),Jn=p_("function"),Rj=p_("number"),Kfe=mo("Date"),Gfe=mo("File"),Vfe=mo("Blob"),Zfe=mo("FileList");wj=Jfe(),Aj=typeof wj.FormData<"u"?wj.FormData:void 0,Qfe=mo("URLSearchParams"),[eme,tme,nme,rme]=["ReadableStream","Request","Response","Headers"].map(mo);Sa=(()=>{if(typeof globalThis<"u")return globalThis;return typeof self<"u"?self:typeof window<"u"?window:global})();dme=((e)=>(t)=>e&&t instanceof e)(typeof Uint8Array<"u"&&l_(Uint8Array)),mme=mo("HTMLFormElement"),Tj=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),gme=mo("RegExp");vme=mo("AsyncFunction"),Dj=((e,t)=>{if(e)return setImmediate;return t?((n,r)=>(Sa.addEventListener("message",({source:o,data:s})=>{if(o===Sa&&s===n)r.length&&r.shift()()},!1),(o)=>{r.push(o),Sa.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):(n)=>setTimeout(n)})(typeof setImmediate==="function",Jn(Sa.postMessage)),Ame=typeof queueMicrotask<"u"?queueMicrotask.bind(Sa):typeof process<"u"&&process.nextTick||Dj,w={isArray:$l,isArrayBuffer:kj,isBuffer:rf,isFormData:Xfe,isArrayBufferView:$fe,isString:zfe,isNumber:Rj,isBoolean:Hfe,isObject:of,isPlainObject:c_,isEmptyObject:Bfe,isReadableStream:eme,isRequest:tme,isResponse:nme,isHeaders:rme,isUndefined:jl,isDate:Kfe,isFile:Gfe,isReactNativeBlob:Wfe,isReactNative:qfe,isBlob:Vfe,isRegExp:gme,isFunction:Jn,isStream:Yfe,isURLSearchParams:Qfe,isTypedArray:dme,isFileList:Zfe,forEach:sf,merge:oA,extend:sme,trim:ome,stripBOM:ime,inherits:ame,toFlatObject:cme,kindOf:d_,kindOfTest:mo,endsWith:lme,toArray:ume,forEachEntry:pme,matchAll:fme,isHTMLForm:mme,hasOwnProperty:Tj,hasOwnProp:Tj,reduceDescriptors:Ij,freezeMethods:_me,toObjectSet:yme,toCamelCase:hme,noop:bme,toFiniteNumber:Sme,findKey:Oj,global:Sa,isContextDefined:Pj,isSpecCompliantForm:Eme,toJSONObject:xme,isAsyncFn:vme,isThenable:wme,setImmediate:Dj,asap:Ame,isIterable:Tme}});var kn,G;var xr=O(()=>{lt();kn=class kn extends Error{static from(e,t,n,r,o,s){let i=new kn(e.message,t||e.code,n,r,o);if(i.cause=e,i.name=e.name,e.status!=null&&i.status==null)i.status=e.status;return s&&Object.assign(i,s),i}constructor(e,t,n,r,o){super(e);if(Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o)this.response=o,this.status=o.status}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:w.toJSONObject(this.config),code:this.code,status:this.status}}};kn.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";kn.ERR_BAD_OPTION="ERR_BAD_OPTION";kn.ECONNABORTED="ECONNABORTED";kn.ETIMEDOUT="ETIMEDOUT";kn.ERR_NETWORK="ERR_NETWORK";kn.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";kn.ERR_DEPRECATED="ERR_DEPRECATED";kn.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";kn.ERR_BAD_REQUEST="ERR_BAD_REQUEST";kn.ERR_CANCELED="ERR_CANCELED";kn.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";kn.ERR_INVALID_URL="ERR_INVALID_URL";kn.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";G=kn});var Nj=T(function(Ayt,Mj){var Lj=ue("stream").Stream,Cme=ue("util");Mj.exports=ho;function ho(){this.source=null,this.dataSize=0,this.maxDataSize=1048576,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}Cme.inherits(ho,Lj);ho.create=function(e,t){var n=new this;t=t||{};for(var r in t)n[r]=t[r];n.source=e;var o=e.emit;if(e.emit=function(){return n._handleEmit(arguments),o.apply(e,arguments)},e.on("error",function(){}),n.pauseStream)e.pause();return n};Object.defineProperty(ho.prototype,"readable",{configurable:!0,enumerable:!0,get:function(){return this.source.readable}});ho.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};ho.prototype.resume=function(){if(!this._released)this.release();this.source.resume()};ho.prototype.pause=function(){this.source.pause()};ho.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]};ho.prototype.pipe=function(){var e=Lj.prototype.pipe.apply(this,arguments);return this.resume(),e};ho.prototype._handleEmit=function(e){if(this._released){this.emit.apply(this,e);return}if(e[0]==="data")this.dataSize+=e[1].length,this._checkIfMaxDataSizeExceeded();this._bufferedEvents.push(e)};ho.prototype._checkIfMaxDataSizeExceeded=function(){if(this._maxDataSizeExceeded)return;if(this.dataSize<=this.maxDataSize)return;this._maxDataSizeExceeded=!0;var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",Error(e))}});var $j=T(function(Tyt,jj){var kme=ue("util"),Fj=ue("stream").Stream,Uj=Nj();jj.exports=Nt;function Nt(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2097152,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}kme.inherits(Nt,Fj);Nt.create=function(e){var t=new this;e=e||{};for(var n in e)t[n]=e[n];return t};Nt.isStreamLike=function(e){return typeof e!=="function"&&typeof e!=="string"&&typeof e!=="boolean"&&typeof e!=="number"&&!Buffer.isBuffer(e)};Nt.prototype.append=function(e){var t=Nt.isStreamLike(e);if(t){if(!(e instanceof Uj)){var n=Uj.create(e,{maxDataSize:1/0,pauseStream:this.pauseStreams});e.on("data",this._checkDataSize.bind(this)),e=n}if(this._handleErrors(e),this.pauseStreams)e.pause()}return this._streams.push(e),this};Nt.prototype.pipe=function(e,t){return Fj.prototype.pipe.call(this,e,t),this.resume(),e};Nt.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop){this._pendingNext=!0;return}this._insideLoop=!0;try{do this._pendingNext=!1,this._realGetNext();while(this._pendingNext)}finally{this._insideLoop=!1}};Nt.prototype._realGetNext=function(){var e=this._streams.shift();if(typeof e>"u"){this.end();return}if(typeof e!=="function"){this._pipeNext(e);return}var t=e;t(function(n){var r=Nt.isStreamLike(n);if(r)n.on("data",this._checkDataSize.bind(this)),this._handleErrors(n);this._pipeNext(n)}.bind(this))};Nt.prototype._pipeNext=function(e){this._currentStream=e;var t=Nt.isStreamLike(e);if(t){e.on("end",this._getNext.bind(this)),e.pipe(this,{end:!1});return}var n=e;this.write(n),this._getNext()};Nt.prototype._handleErrors=function(e){var t=this;e.on("error",function(n){t._emitError(n)})};Nt.prototype.write=function(e){this.emit("data",e)};Nt.prototype.pause=function(){if(!this.pauseStreams)return;if(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function")this._currentStream.pause();this.emit("pause")};Nt.prototype.resume=function(){if(!this._released)this._released=!0,this.writable=!0,this._getNext();if(this.pauseStreams&&this._currentStream&&typeof this._currentStream.resume=="function")this._currentStream.resume();this.emit("resume")};Nt.prototype.end=function(){this._reset(),this.emit("end")};Nt.prototype.destroy=function(){this._reset(),this.emit("close")};Nt.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null};Nt.prototype._checkDataSize=function(){if(this._updateDataSize(),this.dataSize<=this.maxDataSize)return;var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(Error(e))};Nt.prototype._updateDataSize=function(){this.dataSize=0;var e=this;if(this._streams.forEach(function(t){if(!t.dataSize)return;e.dataSize+=t.dataSize}),this._currentStream&&this._currentStream.dataSize)this.dataSize+=this._currentStream.dataSize};Nt.prototype._emitError=function(e){this._reset(),this.emit("error",e)}});var zj=T(function(Cyt,Rme){Rme.exports={"application/1d-interleaved-parityfec":{source:"iana"},"application/3gpdash-qoe-report+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/3gpp-ims+xml":{source:"iana",compressible:!0},"application/3gpphal+json":{source:"iana",compressible:!0},"application/3gpphalforms+json":{source:"iana",compressible:!0},"application/a2l":{source:"iana"},"application/ace+cbor":{source:"iana"},"application/activemessage":{source:"iana"},"application/activity+json":{source:"iana",compressible:!0},"application/alto-costmap+json":{source:"iana",compressible:!0},"application/alto-costmapfilter+json":{source:"iana",compressible:!0},"application/alto-directory+json":{source:"iana",compressible:!0},"application/alto-endpointcost+json":{source:"iana",compressible:!0},"application/alto-endpointcostparams+json":{source:"iana",compressible:!0},"application/alto-endpointprop+json":{source:"iana",compressible:!0},"application/alto-endpointpropparams+json":{source:"iana",compressible:!0},"application/alto-error+json":{source:"iana",compressible:!0},"application/alto-networkmap+json":{source:"iana",compressible:!0},"application/alto-networkmapfilter+json":{source:"iana",compressible:!0},"application/alto-updatestreamcontrol+json":{source:"iana",compressible:!0},"application/alto-updatestreamparams+json":{source:"iana",compressible:!0},"application/aml":{source:"iana"},"application/andrew-inset":{source:"iana",extensions:["ez"]},"application/applefile":{source:"iana"},"application/applixware":{source:"apache",extensions:["aw"]},"application/at+jwt":{source:"iana"},"application/atf":{source:"iana"},"application/atfx":{source:"iana"},"application/atom+xml":{source:"iana",compressible:!0,extensions:["atom"]},"application/atomcat+xml":{source:"iana",compressible:!0,extensions:["atomcat"]},"application/atomdeleted+xml":{source:"iana",compressible:!0,extensions:["atomdeleted"]},"application/atomicmail":{source:"iana"},"application/atomsvc+xml":{source:"iana",compressible:!0,extensions:["atomsvc"]},"application/atsc-dwd+xml":{source:"iana",compressible:!0,extensions:["dwd"]},"application/atsc-dynamic-event-message":{source:"iana"},"application/atsc-held+xml":{source:"iana",compressible:!0,extensions:["held"]},"application/atsc-rdt+json":{source:"iana",compressible:!0},"application/atsc-rsat+xml":{source:"iana",compressible:!0,extensions:["rsat"]},"application/atxml":{source:"iana"},"application/auth-policy+xml":{source:"iana",compressible:!0},"application/bacnet-xdd+zip":{source:"iana",compressible:!1},"application/batch-smtp":{source:"iana"},"application/bdoc":{compressible:!1,extensions:["bdoc"]},"application/beep+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/calendar+json":{source:"iana",compressible:!0},"application/calendar+xml":{source:"iana",compressible:!0,extensions:["xcs"]},"application/call-completion":{source:"iana"},"application/cals-1840":{source:"iana"},"application/captive+json":{source:"iana",compressible:!0},"application/cbor":{source:"iana"},"application/cbor-seq":{source:"iana"},"application/cccex":{source:"iana"},"application/ccmp+xml":{source:"iana",compressible:!0},"application/ccxml+xml":{source:"iana",compressible:!0,extensions:["ccxml"]},"application/cdfx+xml":{source:"iana",compressible:!0,extensions:["cdfx"]},"application/cdmi-capability":{source:"iana",extensions:["cdmia"]},"application/cdmi-container":{source:"iana",extensions:["cdmic"]},"application/cdmi-domain":{source:"iana",extensions:["cdmid"]},"application/cdmi-object":{source:"iana",extensions:["cdmio"]},"application/cdmi-queue":{source:"iana",extensions:["cdmiq"]},"application/cdni":{source:"iana"},"application/cea":{source:"iana"},"application/cea-2018+xml":{source:"iana",compressible:!0},"application/cellml+xml":{source:"iana",compressible:!0},"application/cfw":{source:"iana"},"application/city+json":{source:"iana",compressible:!0},"application/clr":{source:"iana"},"application/clue+xml":{source:"iana",compressible:!0},"application/clue_info+xml":{source:"iana",compressible:!0},"application/cms":{source:"iana"},"application/cnrp+xml":{source:"iana",compressible:!0},"application/coap-group+json":{source:"iana",compressible:!0},"application/coap-payload":{source:"iana"},"application/commonground":{source:"iana"},"application/conference-info+xml":{source:"iana",compressible:!0},"application/cose":{source:"iana"},"application/cose-key":{source:"iana"},"application/cose-key-set":{source:"iana"},"application/cpl+xml":{source:"iana",compressible:!0,extensions:["cpl"]},"application/csrattrs":{source:"iana"},"application/csta+xml":{source:"iana",compressible:!0},"application/cstadata+xml":{source:"iana",compressible:!0},"application/csvm+json":{source:"iana",compressible:!0},"application/cu-seeme":{source:"apache",extensions:["cu"]},"application/cwt":{source:"iana"},"application/cybercash":{source:"iana"},"application/dart":{compressible:!0},"application/dash+xml":{source:"iana",compressible:!0,extensions:["mpd"]},"application/dash-patch+xml":{source:"iana",compressible:!0,extensions:["mpp"]},"application/dashdelta":{source:"iana"},"application/davmount+xml":{source:"iana",compressible:!0,extensions:["davmount"]},"application/dca-rft":{source:"iana"},"application/dcd":{source:"iana"},"application/dec-dx":{source:"iana"},"application/dialog-info+xml":{source:"iana",compressible:!0},"application/dicom":{source:"iana"},"application/dicom+json":{source:"iana",compressible:!0},"application/dicom+xml":{source:"iana",compressible:!0},"application/dii":{source:"iana"},"application/dit":{source:"iana"},"application/dns":{source:"iana"},"application/dns+json":{source:"iana",compressible:!0},"application/dns-message":{source:"iana"},"application/docbook+xml":{source:"apache",compressible:!0,extensions:["dbk"]},"application/dots+cbor":{source:"iana"},"application/dskpp+xml":{source:"iana",compressible:!0},"application/dssc+der":{source:"iana",extensions:["dssc"]},"application/dssc+xml":{source:"iana",compressible:!0,extensions:["xdssc"]},"application/dvcs":{source:"iana"},"application/ecmascript":{source:"iana",compressible:!0,extensions:["es","ecma"]},"application/edi-consent":{source:"iana"},"application/edi-x12":{source:"iana",compressible:!1},"application/edifact":{source:"iana",compressible:!1},"application/efi":{source:"iana"},"application/elm+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/elm+xml":{source:"iana",compressible:!0},"application/emergencycalldata.cap+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/emergencycalldata.comment+xml":{source:"iana",compressible:!0},"application/emergencycalldata.control+xml":{source:"iana",compressible:!0},"application/emergencycalldata.deviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.ecall.msd":{source:"iana"},"application/emergencycalldata.providerinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.serviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.subscriberinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.veds+xml":{source:"iana",compressible:!0},"application/emma+xml":{source:"iana",compressible:!0,extensions:["emma"]},"application/emotionml+xml":{source:"iana",compressible:!0,extensions:["emotionml"]},"application/encaprtp":{source:"iana"},"application/epp+xml":{source:"iana",compressible:!0},"application/epub+zip":{source:"iana",compressible:!1,extensions:["epub"]},"application/eshop":{source:"iana"},"application/exi":{source:"iana",extensions:["exi"]},"application/expect-ct-report+json":{source:"iana",compressible:!0},"application/express":{source:"iana",extensions:["exp"]},"application/fastinfoset":{source:"iana"},"application/fastsoap":{source:"iana"},"application/fdt+xml":{source:"iana",compressible:!0,extensions:["fdt"]},"application/fhir+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/fhir+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/fido.trusted-apps+json":{compressible:!0},"application/fits":{source:"iana"},"application/flexfec":{source:"iana"},"application/font-sfnt":{source:"iana"},"application/font-tdpfr":{source:"iana",extensions:["pfr"]},"application/font-woff":{source:"iana",compressible:!1},"application/framework-attributes+xml":{source:"iana",compressible:!0},"application/geo+json":{source:"iana",compressible:!0,extensions:["geojson"]},"application/geo+json-seq":{source:"iana"},"application/geopackage+sqlite3":{source:"iana"},"application/geoxacml+xml":{source:"iana",compressible:!0},"application/gltf-buffer":{source:"iana"},"application/gml+xml":{source:"iana",compressible:!0,extensions:["gml"]},"application/gpx+xml":{source:"apache",compressible:!0,extensions:["gpx"]},"application/gxf":{source:"apache",extensions:["gxf"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/h224":{source:"iana"},"application/held+xml":{source:"iana",compressible:!0},"application/hjson":{extensions:["hjson"]},"application/http":{source:"iana"},"application/hyperstudio":{source:"iana",extensions:["stk"]},"application/ibe-key-request+xml":{source:"iana",compressible:!0},"application/ibe-pkg-reply+xml":{source:"iana",compressible:!0},"application/ibe-pp-data":{source:"iana"},"application/iges":{source:"iana"},"application/im-iscomposing+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/index":{source:"iana"},"application/index.cmd":{source:"iana"},"application/index.obj":{source:"iana"},"application/index.response":{source:"iana"},"application/index.vnd":{source:"iana"},"application/inkml+xml":{source:"iana",compressible:!0,extensions:["ink","inkml"]},"application/iotp":{source:"iana"},"application/ipfix":{source:"iana",extensions:["ipfix"]},"application/ipp":{source:"iana"},"application/isup":{source:"iana"},"application/its+xml":{source:"iana",compressible:!0,extensions:["its"]},"application/java-archive":{source:"apache",compressible:!1,extensions:["jar","war","ear"]},"application/java-serialized-object":{source:"apache",compressible:!1,extensions:["ser"]},"application/java-vm":{source:"apache",compressible:!1,extensions:["class"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/jf2feed+json":{source:"iana",compressible:!0},"application/jose":{source:"iana"},"application/jose+json":{source:"iana",compressible:!0},"application/jrd+json":{source:"iana",compressible:!0},"application/jscalendar+json":{source:"iana",compressible:!0},"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/json-patch+json":{source:"iana",compressible:!0},"application/json-seq":{source:"iana"},"application/json5":{extensions:["json5"]},"application/jsonml+json":{source:"apache",compressible:!0,extensions:["jsonml"]},"application/jwk+json":{source:"iana",compressible:!0},"application/jwk-set+json":{source:"iana",compressible:!0},"application/jwt":{source:"iana"},"application/kpml-request+xml":{source:"iana",compressible:!0},"application/kpml-response+xml":{source:"iana",compressible:!0},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/lgr+xml":{source:"iana",compressible:!0,extensions:["lgr"]},"application/link-format":{source:"iana"},"application/load-control+xml":{source:"iana",compressible:!0},"application/lost+xml":{source:"iana",compressible:!0,extensions:["lostxml"]},"application/lostsync+xml":{source:"iana",compressible:!0},"application/lpf+zip":{source:"iana",compressible:!1},"application/lxf":{source:"iana"},"application/mac-binhex40":{source:"iana",extensions:["hqx"]},"application/mac-compactpro":{source:"apache",extensions:["cpt"]},"application/macwriteii":{source:"iana"},"application/mads+xml":{source:"iana",compressible:!0,extensions:["mads"]},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/marc":{source:"iana",extensions:["mrc"]},"application/marcxml+xml":{source:"iana",compressible:!0,extensions:["mrcx"]},"application/mathematica":{source:"iana",extensions:["ma","nb","mb"]},"application/mathml+xml":{source:"iana",compressible:!0,extensions:["mathml"]},"application/mathml-content+xml":{source:"iana",compressible:!0},"application/mathml-presentation+xml":{source:"iana",compressible:!0},"application/mbms-associated-procedure-description+xml":{source:"iana",compressible:!0},"application/mbms-deregister+xml":{source:"iana",compressible:!0},"application/mbms-envelope+xml":{source:"iana",compressible:!0},"application/mbms-msk+xml":{source:"iana",compressible:!0},"application/mbms-msk-response+xml":{source:"iana",compressible:!0},"application/mbms-protection-description+xml":{source:"iana",compressible:!0},"application/mbms-reception-report+xml":{source:"iana",compressible:!0},"application/mbms-register+xml":{source:"iana",compressible:!0},"application/mbms-register-response+xml":{source:"iana",compressible:!0},"application/mbms-schedule+xml":{source:"iana",compressible:!0},"application/mbms-user-service-description+xml":{source:"iana",compressible:!0},"application/mbox":{source:"iana",extensions:["mbox"]},"application/media-policy-dataset+xml":{source:"iana",compressible:!0,extensions:["mpf"]},"application/media_control+xml":{source:"iana",compressible:!0},"application/mediaservercontrol+xml":{source:"iana",compressible:!0,extensions:["mscml"]},"application/merge-patch+json":{source:"iana",compressible:!0},"application/metalink+xml":{source:"apache",compressible:!0,extensions:["metalink"]},"application/metalink4+xml":{source:"iana",compressible:!0,extensions:["meta4"]},"application/mets+xml":{source:"iana",compressible:!0,extensions:["mets"]},"application/mf4":{source:"iana"},"application/mikey":{source:"iana"},"application/mipc":{source:"iana"},"application/missing-blocks+cbor-seq":{source:"iana"},"application/mmt-aei+xml":{source:"iana",compressible:!0,extensions:["maei"]},"application/mmt-usd+xml":{source:"iana",compressible:!0,extensions:["musd"]},"application/mods+xml":{source:"iana",compressible:!0,extensions:["mods"]},"application/moss-keys":{source:"iana"},"application/moss-signature":{source:"iana"},"application/mosskey-data":{source:"iana"},"application/mosskey-request":{source:"iana"},"application/mp21":{source:"iana",extensions:["m21","mp21"]},"application/mp4":{source:"iana",extensions:["mp4s","m4p"]},"application/mpeg4-generic":{source:"iana"},"application/mpeg4-iod":{source:"iana"},"application/mpeg4-iod-xmt":{source:"iana"},"application/mrb-consumer+xml":{source:"iana",compressible:!0},"application/mrb-publish+xml":{source:"iana",compressible:!0},"application/msc-ivr+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msc-mixer+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msword":{source:"iana",compressible:!1,extensions:["doc","dot"]},"application/mud+json":{source:"iana",compressible:!0},"application/multipart-core":{source:"iana"},"application/mxf":{source:"iana",extensions:["mxf"]},"application/n-quads":{source:"iana",extensions:["nq"]},"application/n-triples":{source:"iana",extensions:["nt"]},"application/nasdata":{source:"iana"},"application/news-checkgroups":{source:"iana",charset:"US-ASCII"},"application/news-groupinfo":{source:"iana",charset:"US-ASCII"},"application/news-transmission":{source:"iana"},"application/nlsml+xml":{source:"iana",compressible:!0},"application/node":{source:"iana",extensions:["cjs"]},"application/nss":{source:"iana"},"application/oauth-authz-req+jwt":{source:"iana"},"application/oblivious-dns-message":{source:"iana"},"application/ocsp-request":{source:"iana"},"application/ocsp-response":{source:"iana"},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{source:"iana",extensions:["oda"]},"application/odm+xml":{source:"iana",compressible:!0},"application/odx":{source:"iana"},"application/oebps-package+xml":{source:"iana",compressible:!0,extensions:["opf"]},"application/ogg":{source:"iana",compressible:!1,extensions:["ogx"]},"application/omdoc+xml":{source:"apache",compressible:!0,extensions:["omdoc"]},"application/onenote":{source:"apache",extensions:["onetoc","onetoc2","onetmp","onepkg"]},"application/opc-nodeset+xml":{source:"iana",compressible:!0},"application/oscore":{source:"iana"},"application/oxps":{source:"iana",extensions:["oxps"]},"application/p21":{source:"iana"},"application/p21+zip":{source:"iana",compressible:!1},"application/p2p-overlay+xml":{source:"iana",compressible:!0,extensions:["relo"]},"application/parityfec":{source:"iana"},"application/passport":{source:"iana"},"application/patch-ops-error+xml":{source:"iana",compressible:!0,extensions:["xer"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/pdx":{source:"iana"},"application/pem-certificate-chain":{source:"iana"},"application/pgp-encrypted":{source:"iana",compressible:!1,extensions:["pgp"]},"application/pgp-keys":{source:"iana",extensions:["asc"]},"application/pgp-signature":{source:"iana",extensions:["asc","sig"]},"application/pics-rules":{source:"apache",extensions:["prf"]},"application/pidf+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pidf-diff+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pkcs10":{source:"iana",extensions:["p10"]},"application/pkcs12":{source:"iana"},"application/pkcs7-mime":{source:"iana",extensions:["p7m","p7c"]},"application/pkcs7-signature":{source:"iana",extensions:["p7s"]},"application/pkcs8":{source:"iana",extensions:["p8"]},"application/pkcs8-encrypted":{source:"iana"},"application/pkix-attr-cert":{source:"iana",extensions:["ac"]},"application/pkix-cert":{source:"iana",extensions:["cer"]},"application/pkix-crl":{source:"iana",extensions:["crl"]},"application/pkix-pkipath":{source:"iana",extensions:["pkipath"]},"application/pkixcmp":{source:"iana",extensions:["pki"]},"application/pls+xml":{source:"iana",compressible:!0,extensions:["pls"]},"application/poc-settings+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/postscript":{source:"iana",compressible:!0,extensions:["ai","eps","ps"]},"application/ppsp-tracker+json":{source:"iana",compressible:!0},"application/problem+json":{source:"iana",compressible:!0},"application/problem+xml":{source:"iana",compressible:!0},"application/provenance+xml":{source:"iana",compressible:!0,extensions:["provx"]},"application/prs.alvestrand.titrax-sheet":{source:"iana"},"application/prs.cww":{source:"iana",extensions:["cww"]},"application/prs.cyn":{source:"iana",charset:"7-BIT"},"application/prs.hpub+zip":{source:"iana",compressible:!1},"application/prs.nprend":{source:"iana"},"application/prs.plucker":{source:"iana"},"application/prs.rdf-xml-crypt":{source:"iana"},"application/prs.xsf+xml":{source:"iana",compressible:!0},"application/pskc+xml":{source:"iana",compressible:!0,extensions:["pskcxml"]},"application/pvd+json":{source:"iana",compressible:!0},"application/qsig":{source:"iana"},"application/raml+yaml":{compressible:!0,extensions:["raml"]},"application/raptorfec":{source:"iana"},"application/rdap+json":{source:"iana",compressible:!0},"application/rdf+xml":{source:"iana",compressible:!0,extensions:["rdf","owl"]},"application/reginfo+xml":{source:"iana",compressible:!0,extensions:["rif"]},"application/relax-ng-compact-syntax":{source:"iana",extensions:["rnc"]},"application/remote-printing":{source:"iana"},"application/reputon+json":{source:"iana",compressible:!0},"application/resource-lists+xml":{source:"iana",compressible:!0,extensions:["rl"]},"application/resource-lists-diff+xml":{source:"iana",compressible:!0,extensions:["rld"]},"application/rfc+xml":{source:"iana",compressible:!0},"application/riscos":{source:"iana"},"application/rlmi+xml":{source:"iana",compressible:!0},"application/rls-services+xml":{source:"iana",compressible:!0,extensions:["rs"]},"application/route-apd+xml":{source:"iana",compressible:!0,extensions:["rapd"]},"application/route-s-tsid+xml":{source:"iana",compressible:!0,extensions:["sls"]},"application/route-usd+xml":{source:"iana",compressible:!0,extensions:["rusd"]},"application/rpki-ghostbusters":{source:"iana",extensions:["gbr"]},"application/rpki-manifest":{source:"iana",extensions:["mft"]},"application/rpki-publication":{source:"iana"},"application/rpki-roa":{source:"iana",extensions:["roa"]},"application/rpki-updown":{source:"iana"},"application/rsd+xml":{source:"apache",compressible:!0,extensions:["rsd"]},"application/rss+xml":{source:"apache",compressible:!0,extensions:["rss"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/rtploopback":{source:"iana"},"application/rtx":{source:"iana"},"application/samlassertion+xml":{source:"iana",compressible:!0},"application/samlmetadata+xml":{source:"iana",compressible:!0},"application/sarif+json":{source:"iana",compressible:!0},"application/sarif-external-properties+json":{source:"iana",compressible:!0},"application/sbe":{source:"iana"},"application/sbml+xml":{source:"iana",compressible:!0,extensions:["sbml"]},"application/scaip+xml":{source:"iana",compressible:!0},"application/scim+json":{source:"iana",compressible:!0},"application/scvp-cv-request":{source:"iana",extensions:["scq"]},"application/scvp-cv-response":{source:"iana",extensions:["scs"]},"application/scvp-vp-request":{source:"iana",extensions:["spq"]},"application/scvp-vp-response":{source:"iana",extensions:["spp"]},"application/sdp":{source:"iana",extensions:["sdp"]},"application/secevent+jwt":{source:"iana"},"application/senml+cbor":{source:"iana"},"application/senml+json":{source:"iana",compressible:!0},"application/senml+xml":{source:"iana",compressible:!0,extensions:["senmlx"]},"application/senml-etch+cbor":{source:"iana"},"application/senml-etch+json":{source:"iana",compressible:!0},"application/senml-exi":{source:"iana"},"application/sensml+cbor":{source:"iana"},"application/sensml+json":{source:"iana",compressible:!0},"application/sensml+xml":{source:"iana",compressible:!0,extensions:["sensmlx"]},"application/sensml-exi":{source:"iana"},"application/sep+xml":{source:"iana",compressible:!0},"application/sep-exi":{source:"iana"},"application/session-info":{source:"iana"},"application/set-payment":{source:"iana"},"application/set-payment-initiation":{source:"iana",extensions:["setpay"]},"application/set-registration":{source:"iana"},"application/set-registration-initiation":{source:"iana",extensions:["setreg"]},"application/sgml":{source:"iana"},"application/sgml-open-catalog":{source:"iana"},"application/shf+xml":{source:"iana",compressible:!0,extensions:["shf"]},"application/sieve":{source:"iana",extensions:["siv","sieve"]},"application/simple-filter+xml":{source:"iana",compressible:!0},"application/simple-message-summary":{source:"iana"},"application/simplesymbolcontainer":{source:"iana"},"application/sipc":{source:"iana"},"application/slate":{source:"iana"},"application/smil":{source:"iana"},"application/smil+xml":{source:"iana",compressible:!0,extensions:["smi","smil"]},"application/smpte336m":{source:"iana"},"application/soap+fastinfoset":{source:"iana"},"application/soap+xml":{source:"iana",compressible:!0},"application/sparql-query":{source:"iana",extensions:["rq"]},"application/sparql-results+xml":{source:"iana",compressible:!0,extensions:["srx"]},"application/spdx+json":{source:"iana",compressible:!0},"application/spirits-event+xml":{source:"iana",compressible:!0},"application/sql":{source:"iana"},"application/srgs":{source:"iana",extensions:["gram"]},"application/srgs+xml":{source:"iana",compressible:!0,extensions:["grxml"]},"application/sru+xml":{source:"iana",compressible:!0,extensions:["sru"]},"application/ssdl+xml":{source:"apache",compressible:!0,extensions:["ssdl"]},"application/ssml+xml":{source:"iana",compressible:!0,extensions:["ssml"]},"application/stix+json":{source:"iana",compressible:!0},"application/swid+xml":{source:"iana",compressible:!0,extensions:["swidtag"]},"application/tamp-apex-update":{source:"iana"},"application/tamp-apex-update-confirm":{source:"iana"},"application/tamp-community-update":{source:"iana"},"application/tamp-community-update-confirm":{source:"iana"},"application/tamp-error":{source:"iana"},"application/tamp-sequence-adjust":{source:"iana"},"application/tamp-sequence-adjust-confirm":{source:"iana"},"application/tamp-status-query":{source:"iana"},"application/tamp-status-response":{source:"iana"},"application/tamp-update":{source:"iana"},"application/tamp-update-confirm":{source:"iana"},"application/tar":{compressible:!0},"application/taxii+json":{source:"iana",compressible:!0},"application/td+json":{source:"iana",compressible:!0},"application/tei+xml":{source:"iana",compressible:!0,extensions:["tei","teicorpus"]},"application/tetra_isi":{source:"iana"},"application/thraud+xml":{source:"iana",compressible:!0,extensions:["tfi"]},"application/timestamp-query":{source:"iana"},"application/timestamp-reply":{source:"iana"},"application/timestamped-data":{source:"iana",extensions:["tsd"]},"application/tlsrpt+gzip":{source:"iana"},"application/tlsrpt+json":{source:"iana",compressible:!0},"application/tnauthlist":{source:"iana"},"application/token-introspection+jwt":{source:"iana"},"application/toml":{compressible:!0,extensions:["toml"]},"application/trickle-ice-sdpfrag":{source:"iana"},"application/trig":{source:"iana",extensions:["trig"]},"application/ttml+xml":{source:"iana",compressible:!0,extensions:["ttml"]},"application/tve-trigger":{source:"iana"},"application/tzif":{source:"iana"},"application/tzif-leap":{source:"iana"},"application/ubjson":{compressible:!1,extensions:["ubj"]},"application/ulpfec":{source:"iana"},"application/urc-grpsheet+xml":{source:"iana",compressible:!0},"application/urc-ressheet+xml":{source:"iana",compressible:!0,extensions:["rsheet"]},"application/urc-targetdesc+xml":{source:"iana",compressible:!0,extensions:["td"]},"application/urc-uisocketdesc+xml":{source:"iana",compressible:!0},"application/vcard+json":{source:"iana",compressible:!0},"application/vcard+xml":{source:"iana",compressible:!0},"application/vemmi":{source:"iana"},"application/vividence.scriptfile":{source:"apache"},"application/vnd.1000minds.decision-model+xml":{source:"iana",compressible:!0,extensions:["1km"]},"application/vnd.3gpp-prose+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-prose-pc3ch+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-v2x-local-service-information":{source:"iana"},"application/vnd.3gpp.5gnas":{source:"iana"},"application/vnd.3gpp.access-transfer-events+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.bsf+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gmop+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gtpc":{source:"iana"},"application/vnd.3gpp.interworking-data":{source:"iana"},"application/vnd.3gpp.lpp":{source:"iana"},"application/vnd.3gpp.mc-signalling-ear":{source:"iana"},"application/vnd.3gpp.mcdata-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-payload":{source:"iana"},"application/vnd.3gpp.mcdata-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-signalling":{source:"iana"},"application/vnd.3gpp.mcdata-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-floor-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-signed+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-init-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-transmission-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mid-call+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ngap":{source:"iana"},"application/vnd.3gpp.pfcp":{source:"iana"},"application/vnd.3gpp.pic-bw-large":{source:"iana",extensions:["plb"]},"application/vnd.3gpp.pic-bw-small":{source:"iana",extensions:["psb"]},"application/vnd.3gpp.pic-bw-var":{source:"iana",extensions:["pvb"]},"application/vnd.3gpp.s1ap":{source:"iana"},"application/vnd.3gpp.sms":{source:"iana"},"application/vnd.3gpp.sms+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-ext+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.state-and-event-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ussd+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.bcmcsinfo+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.sms":{source:"iana"},"application/vnd.3gpp2.tcap":{source:"iana",extensions:["tcap"]},"application/vnd.3lightssoftware.imagescal":{source:"iana"},"application/vnd.3m.post-it-notes":{source:"iana",extensions:["pwn"]},"application/vnd.accpac.simply.aso":{source:"iana",extensions:["aso"]},"application/vnd.accpac.simply.imp":{source:"iana",extensions:["imp"]},"application/vnd.acucobol":{source:"iana",extensions:["acu"]},"application/vnd.acucorp":{source:"iana",extensions:["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{source:"apache",compressible:!1,extensions:["air"]},"application/vnd.adobe.flash.movie":{source:"iana"},"application/vnd.adobe.formscentral.fcdt":{source:"iana",extensions:["fcdt"]},"application/vnd.adobe.fxp":{source:"iana",extensions:["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{source:"iana"},"application/vnd.adobe.xdp+xml":{source:"iana",compressible:!0,extensions:["xdp"]},"application/vnd.adobe.xfdf":{source:"iana",extensions:["xfdf"]},"application/vnd.aether.imp":{source:"iana"},"application/vnd.afpc.afplinedata":{source:"iana"},"application/vnd.afpc.afplinedata-pagedef":{source:"iana"},"application/vnd.afpc.cmoca-cmresource":{source:"iana"},"application/vnd.afpc.foca-charset":{source:"iana"},"application/vnd.afpc.foca-codedfont":{source:"iana"},"application/vnd.afpc.foca-codepage":{source:"iana"},"application/vnd.afpc.modca":{source:"iana"},"application/vnd.afpc.modca-cmtable":{source:"iana"},"application/vnd.afpc.modca-formdef":{source:"iana"},"application/vnd.afpc.modca-mediummap":{source:"iana"},"application/vnd.afpc.modca-objectcontainer":{source:"iana"},"application/vnd.afpc.modca-overlay":{source:"iana"},"application/vnd.afpc.modca-pagesegment":{source:"iana"},"application/vnd.age":{source:"iana",extensions:["age"]},"application/vnd.ah-barcode":{source:"iana"},"application/vnd.ahead.space":{source:"iana",extensions:["ahead"]},"application/vnd.airzip.filesecure.azf":{source:"iana",extensions:["azf"]},"application/vnd.airzip.filesecure.azs":{source:"iana",extensions:["azs"]},"application/vnd.amadeus+json":{source:"iana",compressible:!0},"application/vnd.amazon.ebook":{source:"apache",extensions:["azw"]},"application/vnd.amazon.mobi8-ebook":{source:"iana"},"application/vnd.americandynamics.acc":{source:"iana",extensions:["acc"]},"application/vnd.amiga.ami":{source:"iana",extensions:["ami"]},"application/vnd.amundsen.maze+xml":{source:"iana",compressible:!0},"application/vnd.android.ota":{source:"iana"},"application/vnd.android.package-archive":{source:"apache",compressible:!1,extensions:["apk"]},"application/vnd.anki":{source:"iana"},"application/vnd.anser-web-certificate-issue-initiation":{source:"iana",extensions:["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{source:"apache",extensions:["fti"]},"application/vnd.antix.game-component":{source:"iana",extensions:["atx"]},"application/vnd.apache.arrow.file":{source:"iana"},"application/vnd.apache.arrow.stream":{source:"iana"},"application/vnd.apache.thrift.binary":{source:"iana"},"application/vnd.apache.thrift.compact":{source:"iana"},"application/vnd.apache.thrift.json":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/vnd.aplextor.warrp+json":{source:"iana",compressible:!0},"application/vnd.apothekende.reservation+json":{source:"iana",compressible:!0},"application/vnd.apple.installer+xml":{source:"iana",compressible:!0,extensions:["mpkg"]},"application/vnd.apple.keynote":{source:"iana",extensions:["key"]},"application/vnd.apple.mpegurl":{source:"iana",extensions:["m3u8"]},"application/vnd.apple.numbers":{source:"iana",extensions:["numbers"]},"application/vnd.apple.pages":{source:"iana",extensions:["pages"]},"application/vnd.apple.pkpass":{compressible:!1,extensions:["pkpass"]},"application/vnd.arastra.swi":{source:"iana"},"application/vnd.aristanetworks.swi":{source:"iana",extensions:["swi"]},"application/vnd.artisan+json":{source:"iana",compressible:!0},"application/vnd.artsquare":{source:"iana"},"application/vnd.astraea-software.iota":{source:"iana",extensions:["iota"]},"application/vnd.audiograph":{source:"iana",extensions:["aep"]},"application/vnd.autopackage":{source:"iana"},"application/vnd.avalon+json":{source:"iana",compressible:!0},"application/vnd.avistar+xml":{source:"iana",compressible:!0},"application/vnd.balsamiq.bmml+xml":{source:"iana",compressible:!0,extensions:["bmml"]},"application/vnd.balsamiq.bmpr":{source:"iana"},"application/vnd.banana-accounting":{source:"iana"},"application/vnd.bbf.usp.error":{source:"iana"},"application/vnd.bbf.usp.msg":{source:"iana"},"application/vnd.bbf.usp.msg+json":{source:"iana",compressible:!0},"application/vnd.bekitzur-stech+json":{source:"iana",compressible:!0},"application/vnd.bint.med-content":{source:"iana"},"application/vnd.biopax.rdf+xml":{source:"iana",compressible:!0},"application/vnd.blink-idb-value-wrapper":{source:"iana"},"application/vnd.blueice.multipass":{source:"iana",extensions:["mpm"]},"application/vnd.bluetooth.ep.oob":{source:"iana"},"application/vnd.bluetooth.le.oob":{source:"iana"},"application/vnd.bmi":{source:"iana",extensions:["bmi"]},"application/vnd.bpf":{source:"iana"},"application/vnd.bpf3":{source:"iana"},"application/vnd.businessobjects":{source:"iana",extensions:["rep"]},"application/vnd.byu.uapi+json":{source:"iana",compressible:!0},"application/vnd.cab-jscript":{source:"iana"},"application/vnd.canon-cpdl":{source:"iana"},"application/vnd.canon-lips":{source:"iana"},"application/vnd.capasystems-pg+json":{source:"iana",compressible:!0},"application/vnd.cendio.thinlinc.clientconf":{source:"iana"},"application/vnd.century-systems.tcp_stream":{source:"iana"},"application/vnd.chemdraw+xml":{source:"iana",compressible:!0,extensions:["cdxml"]},"application/vnd.chess-pgn":{source:"iana"},"application/vnd.chipnuts.karaoke-mmd":{source:"iana",extensions:["mmd"]},"application/vnd.ciedi":{source:"iana"},"application/vnd.cinderella":{source:"iana",extensions:["cdy"]},"application/vnd.cirpack.isdn-ext":{source:"iana"},"application/vnd.citationstyles.style+xml":{source:"iana",compressible:!0,extensions:["csl"]},"application/vnd.claymore":{source:"iana",extensions:["cla"]},"application/vnd.cloanto.rp9":{source:"iana",extensions:["rp9"]},"application/vnd.clonk.c4group":{source:"iana",extensions:["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{source:"iana",extensions:["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{source:"iana",extensions:["c11amz"]},"application/vnd.coffeescript":{source:"iana"},"application/vnd.collabio.xodocuments.document":{source:"iana"},"application/vnd.collabio.xodocuments.document-template":{source:"iana"},"application/vnd.collabio.xodocuments.presentation":{source:"iana"},"application/vnd.collabio.xodocuments.presentation-template":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{source:"iana"},"application/vnd.collection+json":{source:"iana",compressible:!0},"application/vnd.collection.doc+json":{source:"iana",compressible:!0},"application/vnd.collection.next+json":{source:"iana",compressible:!0},"application/vnd.comicbook+zip":{source:"iana",compressible:!1},"application/vnd.comicbook-rar":{source:"iana"},"application/vnd.commerce-battelle":{source:"iana"},"application/vnd.commonspace":{source:"iana",extensions:["csp"]},"application/vnd.contact.cmsg":{source:"iana",extensions:["cdbcmsg"]},"application/vnd.coreos.ignition+json":{source:"iana",compressible:!0},"application/vnd.cosmocaller":{source:"iana",extensions:["cmc"]},"application/vnd.crick.clicker":{source:"iana",extensions:["clkx"]},"application/vnd.crick.clicker.keyboard":{source:"iana",extensions:["clkk"]},"application/vnd.crick.clicker.palette":{source:"iana",extensions:["clkp"]},"application/vnd.crick.clicker.template":{source:"iana",extensions:["clkt"]},"application/vnd.crick.clicker.wordbank":{source:"iana",extensions:["clkw"]},"application/vnd.criticaltools.wbs+xml":{source:"iana",compressible:!0,extensions:["wbs"]},"application/vnd.cryptii.pipe+json":{source:"iana",compressible:!0},"application/vnd.crypto-shade-file":{source:"iana"},"application/vnd.cryptomator.encrypted":{source:"iana"},"application/vnd.cryptomator.vault":{source:"iana"},"application/vnd.ctc-posml":{source:"iana",extensions:["pml"]},"application/vnd.ctct.ws+xml":{source:"iana",compressible:!0},"application/vnd.cups-pdf":{source:"iana"},"application/vnd.cups-postscript":{source:"iana"},"application/vnd.cups-ppd":{source:"iana",extensions:["ppd"]},"application/vnd.cups-raster":{source:"iana"},"application/vnd.cups-raw":{source:"iana"},"application/vnd.curl":{source:"iana"},"application/vnd.curl.car":{source:"apache",extensions:["car"]},"application/vnd.curl.pcurl":{source:"apache",extensions:["pcurl"]},"application/vnd.cyan.dean.root+xml":{source:"iana",compressible:!0},"application/vnd.cybank":{source:"iana"},"application/vnd.cyclonedx+json":{source:"iana",compressible:!0},"application/vnd.cyclonedx+xml":{source:"iana",compressible:!0},"application/vnd.d2l.coursepackage1p0+zip":{source:"iana",compressible:!1},"application/vnd.d3m-dataset":{source:"iana"},"application/vnd.d3m-problem":{source:"iana"},"application/vnd.dart":{source:"iana",compressible:!0,extensions:["dart"]},"application/vnd.data-vision.rdz":{source:"iana",extensions:["rdz"]},"application/vnd.datapackage+json":{source:"iana",compressible:!0},"application/vnd.dataresource+json":{source:"iana",compressible:!0},"application/vnd.dbf":{source:"iana",extensions:["dbf"]},"application/vnd.debian.binary-package":{source:"iana"},"application/vnd.dece.data":{source:"iana",extensions:["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{source:"iana",compressible:!0,extensions:["uvt","uvvt"]},"application/vnd.dece.unspecified":{source:"iana",extensions:["uvx","uvvx"]},"application/vnd.dece.zip":{source:"iana",extensions:["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{source:"iana",extensions:["fe_launch"]},"application/vnd.desmume.movie":{source:"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{source:"iana"},"application/vnd.dm.delegation+xml":{source:"iana",compressible:!0},"application/vnd.dna":{source:"iana",extensions:["dna"]},"application/vnd.document+json":{source:"iana",compressible:!0},"application/vnd.dolby.mlp":{source:"apache",extensions:["mlp"]},"application/vnd.dolby.mobile.1":{source:"iana"},"application/vnd.dolby.mobile.2":{source:"iana"},"application/vnd.doremir.scorecloud-binary-document":{source:"iana"},"application/vnd.dpgraph":{source:"iana",extensions:["dpg"]},"application/vnd.dreamfactory":{source:"iana",extensions:["dfac"]},"application/vnd.drive+json":{source:"iana",compressible:!0},"application/vnd.ds-keypoint":{source:"apache",extensions:["kpxx"]},"application/vnd.dtg.local":{source:"iana"},"application/vnd.dtg.local.flash":{source:"iana"},"application/vnd.dtg.local.html":{source:"iana"},"application/vnd.dvb.ait":{source:"iana",extensions:["ait"]},"application/vnd.dvb.dvbisl+xml":{source:"iana",compressible:!0},"application/vnd.dvb.dvbj":{source:"iana"},"application/vnd.dvb.esgcontainer":{source:"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess2":{source:"iana"},"application/vnd.dvb.ipdcesgpdd":{source:"iana"},"application/vnd.dvb.ipdcroaming":{source:"iana"},"application/vnd.dvb.iptv.alfec-base":{source:"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{source:"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-container+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-generic+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-msglist+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-request+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-response+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-init+xml":{source:"iana",compressible:!0},"application/vnd.dvb.pfr":{source:"iana"},"application/vnd.dvb.service":{source:"iana",extensions:["svc"]},"application/vnd.dxr":{source:"iana"},"application/vnd.dynageo":{source:"iana",extensions:["geo"]},"application/vnd.dzr":{source:"iana"},"application/vnd.easykaraoke.cdgdownload":{source:"iana"},"application/vnd.ecdis-update":{source:"iana"},"application/vnd.ecip.rlp":{source:"iana"},"application/vnd.eclipse.ditto+json":{source:"iana",compressible:!0},"application/vnd.ecowin.chart":{source:"iana",extensions:["mag"]},"application/vnd.ecowin.filerequest":{source:"iana"},"application/vnd.ecowin.fileupdate":{source:"iana"},"application/vnd.ecowin.series":{source:"iana"},"application/vnd.ecowin.seriesrequest":{source:"iana"},"application/vnd.ecowin.seriesupdate":{source:"iana"},"application/vnd.efi.img":{source:"iana"},"application/vnd.efi.iso":{source:"iana"},"application/vnd.emclient.accessrequest+xml":{source:"iana",compressible:!0},"application/vnd.enliven":{source:"iana",extensions:["nml"]},"application/vnd.enphase.envoy":{source:"iana"},"application/vnd.eprints.data+xml":{source:"iana",compressible:!0},"application/vnd.epson.esf":{source:"iana",extensions:["esf"]},"application/vnd.epson.msf":{source:"iana",extensions:["msf"]},"application/vnd.epson.quickanime":{source:"iana",extensions:["qam"]},"application/vnd.epson.salt":{source:"iana",extensions:["slt"]},"application/vnd.epson.ssf":{source:"iana",extensions:["ssf"]},"application/vnd.ericsson.quickcall":{source:"iana"},"application/vnd.espass-espass+zip":{source:"iana",compressible:!1},"application/vnd.eszigno3+xml":{source:"iana",compressible:!0,extensions:["es3","et3"]},"application/vnd.etsi.aoc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.asic-e+zip":{source:"iana",compressible:!1},"application/vnd.etsi.asic-s+zip":{source:"iana",compressible:!1},"application/vnd.etsi.cug+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvcommand+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-bc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-cod+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-npvr+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvservice+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsync+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvueprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mcid+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mheg5":{source:"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{source:"iana",compressible:!0},"application/vnd.etsi.pstn+xml":{source:"iana",compressible:!0},"application/vnd.etsi.sci+xml":{source:"iana",compressible:!0},"application/vnd.etsi.simservs+xml":{source:"iana",compressible:!0},"application/vnd.etsi.timestamp-token":{source:"iana"},"application/vnd.etsi.tsl+xml":{source:"iana",compressible:!0},"application/vnd.etsi.tsl.der":{source:"iana"},"application/vnd.eu.kasparian.car+json":{source:"iana",compressible:!0},"application/vnd.eudora.data":{source:"iana"},"application/vnd.evolv.ecig.profile":{source:"iana"},"application/vnd.evolv.ecig.settings":{source:"iana"},"application/vnd.evolv.ecig.theme":{source:"iana"},"application/vnd.exstream-empower+zip":{source:"iana",compressible:!1},"application/vnd.exstream-package":{source:"iana"},"application/vnd.ezpix-album":{source:"iana",extensions:["ez2"]},"application/vnd.ezpix-package":{source:"iana",extensions:["ez3"]},"application/vnd.f-secure.mobile":{source:"iana"},"application/vnd.familysearch.gedcom+zip":{source:"iana",compressible:!1},"application/vnd.fastcopy-disk-image":{source:"iana"},"application/vnd.fdf":{source:"iana",extensions:["fdf"]},"application/vnd.fdsn.mseed":{source:"iana",extensions:["mseed"]},"application/vnd.fdsn.seed":{source:"iana",extensions:["seed","dataless"]},"application/vnd.ffsns":{source:"iana"},"application/vnd.ficlab.flb+zip":{source:"iana",compressible:!1},"application/vnd.filmit.zfc":{source:"iana"},"application/vnd.fints":{source:"iana"},"application/vnd.firemonkeys.cloudcell":{source:"iana"},"application/vnd.flographit":{source:"iana",extensions:["gph"]},"application/vnd.fluxtime.clip":{source:"iana",extensions:["ftc"]},"application/vnd.font-fontforge-sfd":{source:"iana"},"application/vnd.framemaker":{source:"iana",extensions:["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{source:"iana",extensions:["fnc"]},"application/vnd.frogans.ltf":{source:"iana",extensions:["ltf"]},"application/vnd.fsc.weblaunch":{source:"iana",extensions:["fsc"]},"application/vnd.fujifilm.fb.docuworks":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.binder":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.container":{source:"iana"},"application/vnd.fujifilm.fb.jfi+xml":{source:"iana",compressible:!0},"application/vnd.fujitsu.oasys":{source:"iana",extensions:["oas"]},"application/vnd.fujitsu.oasys2":{source:"iana",extensions:["oa2"]},"application/vnd.fujitsu.oasys3":{source:"iana",extensions:["oa3"]},"application/vnd.fujitsu.oasysgp":{source:"iana",extensions:["fg5"]},"application/vnd.fujitsu.oasysprs":{source:"iana",extensions:["bh2"]},"application/vnd.fujixerox.art-ex":{source:"iana"},"application/vnd.fujixerox.art4":{source:"iana"},"application/vnd.fujixerox.ddd":{source:"iana",extensions:["ddd"]},"application/vnd.fujixerox.docuworks":{source:"iana",extensions:["xdw"]},"application/vnd.fujixerox.docuworks.binder":{source:"iana",extensions:["xbd"]},"application/vnd.fujixerox.docuworks.container":{source:"iana"},"application/vnd.fujixerox.hbpl":{source:"iana"},"application/vnd.fut-misnet":{source:"iana"},"application/vnd.futoin+cbor":{source:"iana"},"application/vnd.futoin+json":{source:"iana",compressible:!0},"application/vnd.fuzzysheet":{source:"iana",extensions:["fzs"]},"application/vnd.genomatix.tuxedo":{source:"iana",extensions:["txd"]},"application/vnd.gentics.grd+json":{source:"iana",compressible:!0},"application/vnd.geo+json":{source:"iana",compressible:!0},"application/vnd.geocube+xml":{source:"iana",compressible:!0},"application/vnd.geogebra.file":{source:"iana",extensions:["ggb"]},"application/vnd.geogebra.slides":{source:"iana"},"application/vnd.geogebra.tool":{source:"iana",extensions:["ggt"]},"application/vnd.geometry-explorer":{source:"iana",extensions:["gex","gre"]},"application/vnd.geonext":{source:"iana",extensions:["gxt"]},"application/vnd.geoplan":{source:"iana",extensions:["g2w"]},"application/vnd.geospace":{source:"iana",extensions:["g3w"]},"application/vnd.gerber":{source:"iana"},"application/vnd.globalplatform.card-content-mgt":{source:"iana"},"application/vnd.globalplatform.card-content-mgt-response":{source:"iana"},"application/vnd.gmx":{source:"iana",extensions:["gmx"]},"application/vnd.google-apps.document":{compressible:!1,extensions:["gdoc"]},"application/vnd.google-apps.presentation":{compressible:!1,extensions:["gslides"]},"application/vnd.google-apps.spreadsheet":{compressible:!1,extensions:["gsheet"]},"application/vnd.google-earth.kml+xml":{source:"iana",compressible:!0,extensions:["kml"]},"application/vnd.google-earth.kmz":{source:"iana",compressible:!1,extensions:["kmz"]},"application/vnd.gov.sk.e-form+xml":{source:"iana",compressible:!0},"application/vnd.gov.sk.e-form+zip":{source:"iana",compressible:!1},"application/vnd.gov.sk.xmldatacontainer+xml":{source:"iana",compressible:!0},"application/vnd.grafeq":{source:"iana",extensions:["gqf","gqs"]},"application/vnd.gridmp":{source:"iana"},"application/vnd.groove-account":{source:"iana",extensions:["gac"]},"application/vnd.groove-help":{source:"iana",extensions:["ghf"]},"application/vnd.groove-identity-message":{source:"iana",extensions:["gim"]},"application/vnd.groove-injector":{source:"iana",extensions:["grv"]},"application/vnd.groove-tool-message":{source:"iana",extensions:["gtm"]},"application/vnd.groove-tool-template":{source:"iana",extensions:["tpl"]},"application/vnd.groove-vcard":{source:"iana",extensions:["vcg"]},"application/vnd.hal+json":{source:"iana",compressible:!0},"application/vnd.hal+xml":{source:"iana",compressible:!0,extensions:["hal"]},"application/vnd.handheld-entertainment+xml":{source:"iana",compressible:!0,extensions:["zmm"]},"application/vnd.hbci":{source:"iana",extensions:["hbci"]},"application/vnd.hc+json":{source:"iana",compressible:!0},"application/vnd.hcl-bireports":{source:"iana"},"application/vnd.hdt":{source:"iana"},"application/vnd.heroku+json":{source:"iana",compressible:!0},"application/vnd.hhe.lesson-player":{source:"iana",extensions:["les"]},"application/vnd.hl7cda+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hl7v2+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hp-hpgl":{source:"iana",extensions:["hpgl"]},"application/vnd.hp-hpid":{source:"iana",extensions:["hpid"]},"application/vnd.hp-hps":{source:"iana",extensions:["hps"]},"application/vnd.hp-jlyt":{source:"iana",extensions:["jlt"]},"application/vnd.hp-pcl":{source:"iana",extensions:["pcl"]},"application/vnd.hp-pclxl":{source:"iana",extensions:["pclxl"]},"application/vnd.httphone":{source:"iana"},"application/vnd.hydrostatix.sof-data":{source:"iana",extensions:["sfd-hdstx"]},"application/vnd.hyper+json":{source:"iana",compressible:!0},"application/vnd.hyper-item+json":{source:"iana",compressible:!0},"application/vnd.hyperdrive+json":{source:"iana",compressible:!0},"application/vnd.hzn-3d-crossword":{source:"iana"},"application/vnd.ibm.afplinedata":{source:"iana"},"application/vnd.ibm.electronic-media":{source:"iana"},"application/vnd.ibm.minipay":{source:"iana",extensions:["mpy"]},"application/vnd.ibm.modcap":{source:"iana",extensions:["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{source:"iana",extensions:["irm"]},"application/vnd.ibm.secure-container":{source:"iana",extensions:["sc"]},"application/vnd.iccprofile":{source:"iana",extensions:["icc","icm"]},"application/vnd.ieee.1905":{source:"iana"},"application/vnd.igloader":{source:"iana",extensions:["igl"]},"application/vnd.imagemeter.folder+zip":{source:"iana",compressible:!1},"application/vnd.imagemeter.image+zip":{source:"iana",compressible:!1},"application/vnd.immervision-ivp":{source:"iana",extensions:["ivp"]},"application/vnd.immervision-ivu":{source:"iana",extensions:["ivu"]},"application/vnd.ims.imsccv1p1":{source:"iana"},"application/vnd.ims.imsccv1p2":{source:"iana"},"application/vnd.ims.imsccv1p3":{source:"iana"},"application/vnd.ims.lis.v2.result+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy.id+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings.simple+json":{source:"iana",compressible:!0},"application/vnd.informedcontrol.rms+xml":{source:"iana",compressible:!0},"application/vnd.informix-visionary":{source:"iana"},"application/vnd.infotech.project":{source:"iana"},"application/vnd.infotech.project+xml":{source:"iana",compressible:!0},"application/vnd.innopath.wamp.notification":{source:"iana"},"application/vnd.insors.igm":{source:"iana",extensions:["igm"]},"application/vnd.intercon.formnet":{source:"iana",extensions:["xpw","xpx"]},"application/vnd.intergeo":{source:"iana",extensions:["i2g"]},"application/vnd.intertrust.digibox":{source:"iana"},"application/vnd.intertrust.nncp":{source:"iana"},"application/vnd.intu.qbo":{source:"iana",extensions:["qbo"]},"application/vnd.intu.qfx":{source:"iana",extensions:["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.conceptitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.knowledgeitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsmessage+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.packageitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.planningitem+xml":{source:"iana",compressible:!0},"application/vnd.ipunplugged.rcprofile":{source:"iana",extensions:["rcprofile"]},"application/vnd.irepository.package+xml":{source:"iana",compressible:!0,extensions:["irp"]},"application/vnd.is-xpr":{source:"iana",extensions:["xpr"]},"application/vnd.isac.fcs":{source:"iana",extensions:["fcs"]},"application/vnd.iso11783-10+zip":{source:"iana",compressible:!1},"application/vnd.jam":{source:"iana",extensions:["jam"]},"application/vnd.japannet-directory-service":{source:"iana"},"application/vnd.japannet-jpnstore-wakeup":{source:"iana"},"application/vnd.japannet-payment-wakeup":{source:"iana"},"application/vnd.japannet-registration":{source:"iana"},"application/vnd.japannet-registration-wakeup":{source:"iana"},"application/vnd.japannet-setstore-wakeup":{source:"iana"},"application/vnd.japannet-verification":{source:"iana"},"application/vnd.japannet-verification-wakeup":{source:"iana"},"application/vnd.jcp.javame.midlet-rms":{source:"iana",extensions:["rms"]},"application/vnd.jisp":{source:"iana",extensions:["jisp"]},"application/vnd.joost.joda-archive":{source:"iana",extensions:["joda"]},"application/vnd.jsk.isdn-ngn":{source:"iana"},"application/vnd.kahootz":{source:"iana",extensions:["ktz","ktr"]},"application/vnd.kde.karbon":{source:"iana",extensions:["karbon"]},"application/vnd.kde.kchart":{source:"iana",extensions:["chrt"]},"application/vnd.kde.kformula":{source:"iana",extensions:["kfo"]},"application/vnd.kde.kivio":{source:"iana",extensions:["flw"]},"application/vnd.kde.kontour":{source:"iana",extensions:["kon"]},"application/vnd.kde.kpresenter":{source:"iana",extensions:["kpr","kpt"]},"application/vnd.kde.kspread":{source:"iana",extensions:["ksp"]},"application/vnd.kde.kword":{source:"iana",extensions:["kwd","kwt"]},"application/vnd.kenameaapp":{source:"iana",extensions:["htke"]},"application/vnd.kidspiration":{source:"iana",extensions:["kia"]},"application/vnd.kinar":{source:"iana",extensions:["kne","knp"]},"application/vnd.koan":{source:"iana",extensions:["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{source:"iana",extensions:["sse"]},"application/vnd.las":{source:"iana"},"application/vnd.las.las+json":{source:"iana",compressible:!0},"application/vnd.las.las+xml":{source:"iana",compressible:!0,extensions:["lasxml"]},"application/vnd.laszip":{source:"iana"},"application/vnd.leap+json":{source:"iana",compressible:!0},"application/vnd.liberty-request+xml":{source:"iana",compressible:!0},"application/vnd.llamagraphics.life-balance.desktop":{source:"iana",extensions:["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{source:"iana",compressible:!0,extensions:["lbe"]},"application/vnd.logipipe.circuit+zip":{source:"iana",compressible:!1},"application/vnd.loom":{source:"iana"},"application/vnd.lotus-1-2-3":{source:"iana",extensions:["123"]},"application/vnd.lotus-approach":{source:"iana",extensions:["apr"]},"application/vnd.lotus-freelance":{source:"iana",extensions:["pre"]},"application/vnd.lotus-notes":{source:"iana",extensions:["nsf"]},"application/vnd.lotus-organizer":{source:"iana",extensions:["org"]},"application/vnd.lotus-screencam":{source:"iana",extensions:["scm"]},"application/vnd.lotus-wordpro":{source:"iana",extensions:["lwp"]},"application/vnd.macports.portpkg":{source:"iana",extensions:["portpkg"]},"application/vnd.mapbox-vector-tile":{source:"iana",extensions:["mvt"]},"application/vnd.marlin.drm.actiontoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.conftoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.license+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.mdcf":{source:"iana"},"application/vnd.mason+json":{source:"iana",compressible:!0},"application/vnd.maxar.archive.3tz+zip":{source:"iana",compressible:!1},"application/vnd.maxmind.maxmind-db":{source:"iana"},"application/vnd.mcd":{source:"iana",extensions:["mcd"]},"application/vnd.medcalcdata":{source:"iana",extensions:["mc1"]},"application/vnd.mediastation.cdkey":{source:"iana",extensions:["cdkey"]},"application/vnd.meridian-slingshot":{source:"iana"},"application/vnd.mfer":{source:"iana",extensions:["mwf"]},"application/vnd.mfmp":{source:"iana",extensions:["mfm"]},"application/vnd.micro+json":{source:"iana",compressible:!0},"application/vnd.micrografx.flo":{source:"iana",extensions:["flo"]},"application/vnd.micrografx.igx":{source:"iana",extensions:["igx"]},"application/vnd.microsoft.portable-executable":{source:"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{source:"iana"},"application/vnd.miele+json":{source:"iana",compressible:!0},"application/vnd.mif":{source:"iana",extensions:["mif"]},"application/vnd.minisoft-hp3000-save":{source:"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{source:"iana"},"application/vnd.mobius.daf":{source:"iana",extensions:["daf"]},"application/vnd.mobius.dis":{source:"iana",extensions:["dis"]},"application/vnd.mobius.mbk":{source:"iana",extensions:["mbk"]},"application/vnd.mobius.mqy":{source:"iana",extensions:["mqy"]},"application/vnd.mobius.msl":{source:"iana",extensions:["msl"]},"application/vnd.mobius.plc":{source:"iana",extensions:["plc"]},"application/vnd.mobius.txf":{source:"iana",extensions:["txf"]},"application/vnd.mophun.application":{source:"iana",extensions:["mpn"]},"application/vnd.mophun.certificate":{source:"iana",extensions:["mpc"]},"application/vnd.motorola.flexsuite":{source:"iana"},"application/vnd.motorola.flexsuite.adsi":{source:"iana"},"application/vnd.motorola.flexsuite.fis":{source:"iana"},"application/vnd.motorola.flexsuite.gotap":{source:"iana"},"application/vnd.motorola.flexsuite.kmr":{source:"iana"},"application/vnd.motorola.flexsuite.ttc":{source:"iana"},"application/vnd.motorola.flexsuite.wem":{source:"iana"},"application/vnd.motorola.iprm":{source:"iana"},"application/vnd.mozilla.xul+xml":{source:"iana",compressible:!0,extensions:["xul"]},"application/vnd.ms-3mfdocument":{source:"iana"},"application/vnd.ms-artgalry":{source:"iana",extensions:["cil"]},"application/vnd.ms-asf":{source:"iana"},"application/vnd.ms-cab-compressed":{source:"iana",extensions:["cab"]},"application/vnd.ms-color.iccprofile":{source:"apache"},"application/vnd.ms-excel":{source:"iana",compressible:!1,extensions:["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{source:"iana",extensions:["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{source:"iana",extensions:["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{source:"iana",extensions:["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{source:"iana",extensions:["xltm"]},"application/vnd.ms-fontobject":{source:"iana",compressible:!0,extensions:["eot"]},"application/vnd.ms-htmlhelp":{source:"iana",extensions:["chm"]},"application/vnd.ms-ims":{source:"iana",extensions:["ims"]},"application/vnd.ms-lrm":{source:"iana",extensions:["lrm"]},"application/vnd.ms-office.activex+xml":{source:"iana",compressible:!0},"application/vnd.ms-officetheme":{source:"iana",extensions:["thmx"]},"application/vnd.ms-opentype":{source:"apache",compressible:!0},"application/vnd.ms-outlook":{compressible:!1,extensions:["msg"]},"application/vnd.ms-package.obfuscated-opentype":{source:"apache"},"application/vnd.ms-pki.seccat":{source:"apache",extensions:["cat"]},"application/vnd.ms-pki.stl":{source:"apache",extensions:["stl"]},"application/vnd.ms-playready.initiator+xml":{source:"iana",compressible:!0},"application/vnd.ms-powerpoint":{source:"iana",compressible:!1,extensions:["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{source:"iana",extensions:["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{source:"iana",extensions:["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{source:"iana",extensions:["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{source:"iana",extensions:["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{source:"iana",extensions:["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{source:"iana",compressible:!0},"application/vnd.ms-printing.printticket+xml":{source:"apache",compressible:!0},"application/vnd.ms-printschematicket+xml":{source:"iana",compressible:!0},"application/vnd.ms-project":{source:"iana",extensions:["mpp","mpt"]},"application/vnd.ms-tnef":{source:"iana"},"application/vnd.ms-windows.devicepairing":{source:"iana"},"application/vnd.ms-windows.nwprinting.oob":{source:"iana"},"application/vnd.ms-windows.printerpairing":{source:"iana"},"application/vnd.ms-windows.wsd.oob":{source:"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.lic-resp":{source:"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.meter-resp":{source:"iana"},"application/vnd.ms-word.document.macroenabled.12":{source:"iana",extensions:["docm"]},"application/vnd.ms-word.template.macroenabled.12":{source:"iana",extensions:["dotm"]},"application/vnd.ms-works":{source:"iana",extensions:["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{source:"iana",extensions:["wpl"]},"application/vnd.ms-xpsdocument":{source:"iana",compressible:!1,extensions:["xps"]},"application/vnd.msa-disk-image":{source:"iana"},"application/vnd.mseq":{source:"iana",extensions:["mseq"]},"application/vnd.msign":{source:"iana"},"application/vnd.multiad.creator":{source:"iana"},"application/vnd.multiad.creator.cif":{source:"iana"},"application/vnd.music-niff":{source:"iana"},"application/vnd.musician":{source:"iana",extensions:["mus"]},"application/vnd.muvee.style":{source:"iana",extensions:["msty"]},"application/vnd.mynfc":{source:"iana",extensions:["taglet"]},"application/vnd.nacamar.ybrid+json":{source:"iana",compressible:!0},"application/vnd.ncd.control":{source:"iana"},"application/vnd.ncd.reference":{source:"iana"},"application/vnd.nearst.inv+json":{source:"iana",compressible:!0},"application/vnd.nebumind.line":{source:"iana"},"application/vnd.nervana":{source:"iana"},"application/vnd.netfpx":{source:"iana"},"application/vnd.neurolanguage.nlu":{source:"iana",extensions:["nlu"]},"application/vnd.nimn":{source:"iana"},"application/vnd.nintendo.nitro.rom":{source:"iana"},"application/vnd.nintendo.snes.rom":{source:"iana"},"application/vnd.nitf":{source:"iana",extensions:["ntf","nitf"]},"application/vnd.noblenet-directory":{source:"iana",extensions:["nnd"]},"application/vnd.noblenet-sealer":{source:"iana",extensions:["nns"]},"application/vnd.noblenet-web":{source:"iana",extensions:["nnw"]},"application/vnd.nokia.catalogs":{source:"iana"},"application/vnd.nokia.conml+wbxml":{source:"iana"},"application/vnd.nokia.conml+xml":{source:"iana",compressible:!0},"application/vnd.nokia.iptv.config+xml":{source:"iana",compressible:!0},"application/vnd.nokia.isds-radio-presets":{source:"iana"},"application/vnd.nokia.landmark+wbxml":{source:"iana"},"application/vnd.nokia.landmark+xml":{source:"iana",compressible:!0},"application/vnd.nokia.landmarkcollection+xml":{source:"iana",compressible:!0},"application/vnd.nokia.n-gage.ac+xml":{source:"iana",compressible:!0,extensions:["ac"]},"application/vnd.nokia.n-gage.data":{source:"iana",extensions:["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{source:"iana",extensions:["n-gage"]},"application/vnd.nokia.ncd":{source:"iana"},"application/vnd.nokia.pcd+wbxml":{source:"iana"},"application/vnd.nokia.pcd+xml":{source:"iana",compressible:!0},"application/vnd.nokia.radio-preset":{source:"iana",extensions:["rpst"]},"application/vnd.nokia.radio-presets":{source:"iana",extensions:["rpss"]},"application/vnd.novadigm.edm":{source:"iana",extensions:["edm"]},"application/vnd.novadigm.edx":{source:"iana",extensions:["edx"]},"application/vnd.novadigm.ext":{source:"iana",extensions:["ext"]},"application/vnd.ntt-local.content-share":{source:"iana"},"application/vnd.ntt-local.file-transfer":{source:"iana"},"application/vnd.ntt-local.ogw_remote-access":{source:"iana"},"application/vnd.ntt-local.sip-ta_remote":{source:"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{source:"iana"},"application/vnd.oasis.opendocument.chart":{source:"iana",extensions:["odc"]},"application/vnd.oasis.opendocument.chart-template":{source:"iana",extensions:["otc"]},"application/vnd.oasis.opendocument.database":{source:"iana",extensions:["odb"]},"application/vnd.oasis.opendocument.formula":{source:"iana",extensions:["odf"]},"application/vnd.oasis.opendocument.formula-template":{source:"iana",extensions:["odft"]},"application/vnd.oasis.opendocument.graphics":{source:"iana",compressible:!1,extensions:["odg"]},"application/vnd.oasis.opendocument.graphics-template":{source:"iana",extensions:["otg"]},"application/vnd.oasis.opendocument.image":{source:"iana",extensions:["odi"]},"application/vnd.oasis.opendocument.image-template":{source:"iana",extensions:["oti"]},"application/vnd.oasis.opendocument.presentation":{source:"iana",compressible:!1,extensions:["odp"]},"application/vnd.oasis.opendocument.presentation-template":{source:"iana",extensions:["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{source:"iana",compressible:!1,extensions:["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{source:"iana",extensions:["ots"]},"application/vnd.oasis.opendocument.text":{source:"iana",compressible:!1,extensions:["odt"]},"application/vnd.oasis.opendocument.text-master":{source:"iana",extensions:["odm"]},"application/vnd.oasis.opendocument.text-template":{source:"iana",extensions:["ott"]},"application/vnd.oasis.opendocument.text-web":{source:"iana",extensions:["oth"]},"application/vnd.obn":{source:"iana"},"application/vnd.ocf+cbor":{source:"iana"},"application/vnd.oci.image.manifest.v1+json":{source:"iana",compressible:!0},"application/vnd.oftn.l10n+json":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessdownload+xml":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessstreaming+xml":{source:"iana",compressible:!0},"application/vnd.oipf.cspg-hexbinary":{source:"iana"},"application/vnd.oipf.dae.svg+xml":{source:"iana",compressible:!0},"application/vnd.oipf.dae.xhtml+xml":{source:"iana",compressible:!0},"application/vnd.oipf.mippvcontrolmessage+xml":{source:"iana",compressible:!0},"application/vnd.oipf.pae.gem":{source:"iana"},"application/vnd.oipf.spdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.oipf.spdlist+xml":{source:"iana",compressible:!0},"application/vnd.oipf.ueprofile+xml":{source:"iana",compressible:!0},"application/vnd.oipf.userprofile+xml":{source:"iana",compressible:!0},"application/vnd.olpc-sugar":{source:"iana",extensions:["xo"]},"application/vnd.oma-scws-config":{source:"iana"},"application/vnd.oma-scws-http-request":{source:"iana"},"application/vnd.oma-scws-http-response":{source:"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.drm-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.imd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.ltkm":{source:"iana"},"application/vnd.oma.bcast.notification+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.provisioningtrigger":{source:"iana"},"application/vnd.oma.bcast.sgboot":{source:"iana"},"application/vnd.oma.bcast.sgdd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sgdu":{source:"iana"},"application/vnd.oma.bcast.simple-symbol-container":{source:"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sprov+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.stkm":{source:"iana"},"application/vnd.oma.cab-address-book+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-feature-handler+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-pcc+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-subs-invite+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-user-prefs+xml":{source:"iana",compressible:!0},"application/vnd.oma.dcd":{source:"iana"},"application/vnd.oma.dcdc":{source:"iana"},"application/vnd.oma.dd2+xml":{source:"iana",compressible:!0,extensions:["dd2"]},"application/vnd.oma.drm.risd+xml":{source:"iana",compressible:!0},"application/vnd.oma.group-usage-list+xml":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+cbor":{source:"iana"},"application/vnd.oma.lwm2m+json":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+tlv":{source:"iana"},"application/vnd.oma.pal+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.detailed-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.final-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.groups+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.invocation-descriptor+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.optimized-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.push":{source:"iana"},"application/vnd.oma.scidm.messages+xml":{source:"iana",compressible:!0},"application/vnd.oma.xcap-directory+xml":{source:"iana",compressible:!0},"application/vnd.omads-email+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-file+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-folder+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omaloc-supl-init":{source:"iana"},"application/vnd.onepager":{source:"iana"},"application/vnd.onepagertamp":{source:"iana"},"application/vnd.onepagertamx":{source:"iana"},"application/vnd.onepagertat":{source:"iana"},"application/vnd.onepagertatp":{source:"iana"},"application/vnd.onepagertatx":{source:"iana"},"application/vnd.openblox.game+xml":{source:"iana",compressible:!0,extensions:["obgx"]},"application/vnd.openblox.game-binary":{source:"iana"},"application/vnd.openeye.oeb":{source:"iana"},"application/vnd.openofficeorg.extension":{source:"apache",extensions:["oxt"]},"application/vnd.openstreetmap.data+xml":{source:"iana",compressible:!0,extensions:["osm"]},"application/vnd.opentimestamps.ots":{source:"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawing+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",compressible:!1,extensions:["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slide":{source:"iana",extensions:["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{source:"iana",extensions:["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.template":{source:"iana",extensions:["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",compressible:!1,extensions:["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{source:"iana",extensions:["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.theme+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.vmldrawing":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",compressible:!1,extensions:["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{source:"iana",extensions:["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.core-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.relationships+xml":{source:"iana",compressible:!0},"application/vnd.oracle.resource+json":{source:"iana",compressible:!0},"application/vnd.orange.indata":{source:"iana"},"application/vnd.osa.netdeploy":{source:"iana"},"application/vnd.osgeo.mapguide.package":{source:"iana",extensions:["mgp"]},"application/vnd.osgi.bundle":{source:"iana"},"application/vnd.osgi.dp":{source:"iana",extensions:["dp"]},"application/vnd.osgi.subsystem":{source:"iana",extensions:["esa"]},"application/vnd.otps.ct-kip+xml":{source:"iana",compressible:!0},"application/vnd.oxli.countgraph":{source:"iana"},"application/vnd.pagerduty+json":{source:"iana",compressible:!0},"application/vnd.palm":{source:"iana",extensions:["pdb","pqa","oprc"]},"application/vnd.panoply":{source:"iana"},"application/vnd.paos.xml":{source:"iana"},"application/vnd.patentdive":{source:"iana"},"application/vnd.patientecommsdoc":{source:"iana"},"application/vnd.pawaafile":{source:"iana",extensions:["paw"]},"application/vnd.pcos":{source:"iana"},"application/vnd.pg.format":{source:"iana",extensions:["str"]},"application/vnd.pg.osasli":{source:"iana",extensions:["ei6"]},"application/vnd.piaccess.application-licence":{source:"iana"},"application/vnd.picsel":{source:"iana",extensions:["efif"]},"application/vnd.pmi.widget":{source:"iana",extensions:["wg"]},"application/vnd.poc.group-advertisement+xml":{source:"iana",compressible:!0},"application/vnd.pocketlearn":{source:"iana",extensions:["plf"]},"application/vnd.powerbuilder6":{source:"iana",extensions:["pbd"]},"application/vnd.powerbuilder6-s":{source:"iana"},"application/vnd.powerbuilder7":{source:"iana"},"application/vnd.powerbuilder7-s":{source:"iana"},"application/vnd.powerbuilder75":{source:"iana"},"application/vnd.powerbuilder75-s":{source:"iana"},"application/vnd.preminet":{source:"iana"},"application/vnd.previewsystems.box":{source:"iana",extensions:["box"]},"application/vnd.proteus.magazine":{source:"iana",extensions:["mgz"]},"application/vnd.psfs":{source:"iana"},"application/vnd.publishare-delta-tree":{source:"iana",extensions:["qps"]},"application/vnd.pvi.ptid1":{source:"iana",extensions:["ptid"]},"application/vnd.pwg-multiplexed":{source:"iana"},"application/vnd.pwg-xhtml-print+xml":{source:"iana",compressible:!0},"application/vnd.qualcomm.brew-app-res":{source:"iana"},"application/vnd.quarantainenet":{source:"iana"},"application/vnd.quark.quarkxpress":{source:"iana",extensions:["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{source:"iana"},"application/vnd.radisys.moml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conn+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-stream+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-base+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-detect+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-group+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-speech+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-transform+xml":{source:"iana",compressible:!0},"application/vnd.rainstor.data":{source:"iana"},"application/vnd.rapid":{source:"iana"},"application/vnd.rar":{source:"iana",extensions:["rar"]},"application/vnd.realvnc.bed":{source:"iana",extensions:["bed"]},"application/vnd.recordare.musicxml":{source:"iana",extensions:["mxl"]},"application/vnd.recordare.musicxml+xml":{source:"iana",compressible:!0,extensions:["musicxml"]},"application/vnd.renlearn.rlprint":{source:"iana"},"application/vnd.resilient.logic":{source:"iana"},"application/vnd.restful+json":{source:"iana",compressible:!0},"application/vnd.rig.cryptonote":{source:"iana",extensions:["cryptonote"]},"application/vnd.rim.cod":{source:"apache",extensions:["cod"]},"application/vnd.rn-realmedia":{source:"apache",extensions:["rm"]},"application/vnd.rn-realmedia-vbr":{source:"apache",extensions:["rmvb"]},"application/vnd.route66.link66+xml":{source:"iana",compressible:!0,extensions:["link66"]},"application/vnd.rs-274x":{source:"iana"},"application/vnd.ruckus.download":{source:"iana"},"application/vnd.s3sms":{source:"iana"},"application/vnd.sailingtracker.track":{source:"iana",extensions:["st"]},"application/vnd.sar":{source:"iana"},"application/vnd.sbm.cid":{source:"iana"},"application/vnd.sbm.mid2":{source:"iana"},"application/vnd.scribus":{source:"iana"},"application/vnd.sealed.3df":{source:"iana"},"application/vnd.sealed.csf":{source:"iana"},"application/vnd.sealed.doc":{source:"iana"},"application/vnd.sealed.eml":{source:"iana"},"application/vnd.sealed.mht":{source:"iana"},"application/vnd.sealed.net":{source:"iana"},"application/vnd.sealed.ppt":{source:"iana"},"application/vnd.sealed.tiff":{source:"iana"},"application/vnd.sealed.xls":{source:"iana"},"application/vnd.sealedmedia.softseal.html":{source:"iana"},"application/vnd.sealedmedia.softseal.pdf":{source:"iana"},"application/vnd.seemail":{source:"iana",extensions:["see"]},"application/vnd.seis+json":{source:"iana",compressible:!0},"application/vnd.sema":{source:"iana",extensions:["sema"]},"application/vnd.semd":{source:"iana",extensions:["semd"]},"application/vnd.semf":{source:"iana",extensions:["semf"]},"application/vnd.shade-save-file":{source:"iana"},"application/vnd.shana.informed.formdata":{source:"iana",extensions:["ifm"]},"application/vnd.shana.informed.formtemplate":{source:"iana",extensions:["itp"]},"application/vnd.shana.informed.interchange":{source:"iana",extensions:["iif"]},"application/vnd.shana.informed.package":{source:"iana",extensions:["ipk"]},"application/vnd.shootproof+json":{source:"iana",compressible:!0},"application/vnd.shopkick+json":{source:"iana",compressible:!0},"application/vnd.shp":{source:"iana"},"application/vnd.shx":{source:"iana"},"application/vnd.sigrok.session":{source:"iana"},"application/vnd.simtech-mindmapper":{source:"iana",extensions:["twd","twds"]},"application/vnd.siren+json":{source:"iana",compressible:!0},"application/vnd.smaf":{source:"iana",extensions:["mmf"]},"application/vnd.smart.notebook":{source:"iana"},"application/vnd.smart.teacher":{source:"iana",extensions:["teacher"]},"application/vnd.snesdev-page-table":{source:"iana"},"application/vnd.software602.filler.form+xml":{source:"iana",compressible:!0,extensions:["fo"]},"application/vnd.software602.filler.form-xml-zip":{source:"iana"},"application/vnd.solent.sdkm+xml":{source:"iana",compressible:!0,extensions:["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{source:"iana",extensions:["dxp"]},"application/vnd.spotfire.sfs":{source:"iana",extensions:["sfs"]},"application/vnd.sqlite3":{source:"iana"},"application/vnd.sss-cod":{source:"iana"},"application/vnd.sss-dtf":{source:"iana"},"application/vnd.sss-ntf":{source:"iana"},"application/vnd.stardivision.calc":{source:"apache",extensions:["sdc"]},"application/vnd.stardivision.draw":{source:"apache",extensions:["sda"]},"application/vnd.stardivision.impress":{source:"apache",extensions:["sdd"]},"application/vnd.stardivision.math":{source:"apache",extensions:["smf"]},"application/vnd.stardivision.writer":{source:"apache",extensions:["sdw","vor"]},"application/vnd.stardivision.writer-global":{source:"apache",extensions:["sgl"]},"application/vnd.stepmania.package":{source:"iana",extensions:["smzip"]},"application/vnd.stepmania.stepchart":{source:"iana",extensions:["sm"]},"application/vnd.street-stream":{source:"iana"},"application/vnd.sun.wadl+xml":{source:"iana",compressible:!0,extensions:["wadl"]},"application/vnd.sun.xml.calc":{source:"apache",extensions:["sxc"]},"application/vnd.sun.xml.calc.template":{source:"apache",extensions:["stc"]},"application/vnd.sun.xml.draw":{source:"apache",extensions:["sxd"]},"application/vnd.sun.xml.draw.template":{source:"apache",extensions:["std"]},"application/vnd.sun.xml.impress":{source:"apache",extensions:["sxi"]},"application/vnd.sun.xml.impress.template":{source:"apache",extensions:["sti"]},"application/vnd.sun.xml.math":{source:"apache",extensions:["sxm"]},"application/vnd.sun.xml.writer":{source:"apache",extensions:["sxw"]},"application/vnd.sun.xml.writer.global":{source:"apache",extensions:["sxg"]},"application/vnd.sun.xml.writer.template":{source:"apache",extensions:["stw"]},"application/vnd.sus-calendar":{source:"iana",extensions:["sus","susp"]},"application/vnd.svd":{source:"iana",extensions:["svd"]},"application/vnd.swiftview-ics":{source:"iana"},"application/vnd.sycle+xml":{source:"iana",compressible:!0},"application/vnd.syft+json":{source:"iana",compressible:!0},"application/vnd.symbian.install":{source:"apache",extensions:["sis","sisx"]},"application/vnd.syncml+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xsm"]},"application/vnd.syncml.dm+wbxml":{source:"iana",charset:"UTF-8",extensions:["bdm"]},"application/vnd.syncml.dm+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xdm"]},"application/vnd.syncml.dm.notification":{source:"iana"},"application/vnd.syncml.dmddf+wbxml":{source:"iana"},"application/vnd.syncml.dmddf+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["ddf"]},"application/vnd.syncml.dmtnds+wbxml":{source:"iana"},"application/vnd.syncml.dmtnds+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.syncml.ds.notification":{source:"iana"},"application/vnd.tableschema+json":{source:"iana",compressible:!0},"application/vnd.tao.intent-module-archive":{source:"iana",extensions:["tao"]},"application/vnd.tcpdump.pcap":{source:"iana",extensions:["pcap","cap","dmp"]},"application/vnd.think-cell.ppttc+json":{source:"iana",compressible:!0},"application/vnd.tmd.mediaflex.api+xml":{source:"iana",compressible:!0},"application/vnd.tml":{source:"iana"},"application/vnd.tmobile-livetv":{source:"iana",extensions:["tmo"]},"application/vnd.tri.onesource":{source:"iana"},"application/vnd.trid.tpt":{source:"iana",extensions:["tpt"]},"application/vnd.triscape.mxs":{source:"iana",extensions:["mxs"]},"application/vnd.trueapp":{source:"iana",extensions:["tra"]},"application/vnd.truedoc":{source:"iana"},"application/vnd.ubisoft.webplayer":{source:"iana"},"application/vnd.ufdl":{source:"iana",extensions:["ufd","ufdl"]},"application/vnd.uiq.theme":{source:"iana",extensions:["utz"]},"application/vnd.umajin":{source:"iana",extensions:["umj"]},"application/vnd.unity":{source:"iana",extensions:["unityweb"]},"application/vnd.uoml+xml":{source:"iana",compressible:!0,extensions:["uoml"]},"application/vnd.uplanet.alert":{source:"iana"},"application/vnd.uplanet.alert-wbxml":{source:"iana"},"application/vnd.uplanet.bearer-choice":{source:"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{source:"iana"},"application/vnd.uplanet.cacheop":{source:"iana"},"application/vnd.uplanet.cacheop-wbxml":{source:"iana"},"application/vnd.uplanet.channel":{source:"iana"},"application/vnd.uplanet.channel-wbxml":{source:"iana"},"application/vnd.uplanet.list":{source:"iana"},"application/vnd.uplanet.list-wbxml":{source:"iana"},"application/vnd.uplanet.listcmd":{source:"iana"},"application/vnd.uplanet.listcmd-wbxml":{source:"iana"},"application/vnd.uplanet.signal":{source:"iana"},"application/vnd.uri-map":{source:"iana"},"application/vnd.valve.source.material":{source:"iana"},"application/vnd.vcx":{source:"iana",extensions:["vcx"]},"application/vnd.vd-study":{source:"iana"},"application/vnd.vectorworks":{source:"iana"},"application/vnd.vel+json":{source:"iana",compressible:!0},"application/vnd.verimatrix.vcas":{source:"iana"},"application/vnd.veritone.aion+json":{source:"iana",compressible:!0},"application/vnd.veryant.thin":{source:"iana"},"application/vnd.ves.encrypted":{source:"iana"},"application/vnd.vidsoft.vidconference":{source:"iana"},"application/vnd.visio":{source:"iana",extensions:["vsd","vst","vss","vsw"]},"application/vnd.visionary":{source:"iana",extensions:["vis"]},"application/vnd.vividence.scriptfile":{source:"iana"},"application/vnd.vsf":{source:"iana",extensions:["vsf"]},"application/vnd.wap.sic":{source:"iana"},"application/vnd.wap.slc":{source:"iana"},"application/vnd.wap.wbxml":{source:"iana",charset:"UTF-8",extensions:["wbxml"]},"application/vnd.wap.wmlc":{source:"iana",extensions:["wmlc"]},"application/vnd.wap.wmlscriptc":{source:"iana",extensions:["wmlsc"]},"application/vnd.webturbo":{source:"iana",extensions:["wtb"]},"application/vnd.wfa.dpp":{source:"iana"},"application/vnd.wfa.p2p":{source:"iana"},"application/vnd.wfa.wsc":{source:"iana"},"application/vnd.windows.devicepairing":{source:"iana"},"application/vnd.wmc":{source:"iana"},"application/vnd.wmf.bootstrap":{source:"iana"},"application/vnd.wolfram.mathematica":{source:"iana"},"application/vnd.wolfram.mathematica.package":{source:"iana"},"application/vnd.wolfram.player":{source:"iana",extensions:["nbp"]},"application/vnd.wordperfect":{source:"iana",extensions:["wpd"]},"application/vnd.wqd":{source:"iana",extensions:["wqd"]},"application/vnd.wrq-hp3000-labelled":{source:"iana"},"application/vnd.wt.stf":{source:"iana",extensions:["stf"]},"application/vnd.wv.csp+wbxml":{source:"iana"},"application/vnd.wv.csp+xml":{source:"iana",compressible:!0},"application/vnd.wv.ssp+xml":{source:"iana",compressible:!0},"application/vnd.xacml+json":{source:"iana",compressible:!0},"application/vnd.xara":{source:"iana",extensions:["xar"]},"application/vnd.xfdl":{source:"iana",extensions:["xfdl"]},"application/vnd.xfdl.webform":{source:"iana"},"application/vnd.xmi+xml":{source:"iana",compressible:!0},"application/vnd.xmpie.cpkg":{source:"iana"},"application/vnd.xmpie.dpkg":{source:"iana"},"application/vnd.xmpie.plan":{source:"iana"},"application/vnd.xmpie.ppkg":{source:"iana"},"application/vnd.xmpie.xlim":{source:"iana"},"application/vnd.yamaha.hv-dic":{source:"iana",extensions:["hvd"]},"application/vnd.yamaha.hv-script":{source:"iana",extensions:["hvs"]},"application/vnd.yamaha.hv-voice":{source:"iana",extensions:["hvp"]},"application/vnd.yamaha.openscoreformat":{source:"iana",extensions:["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{source:"iana",compressible:!0,extensions:["osfpvg"]},"application/vnd.yamaha.remote-setup":{source:"iana"},"application/vnd.yamaha.smaf-audio":{source:"iana",extensions:["saf"]},"application/vnd.yamaha.smaf-phrase":{source:"iana",extensions:["spf"]},"application/vnd.yamaha.through-ngn":{source:"iana"},"application/vnd.yamaha.tunnel-udpencap":{source:"iana"},"application/vnd.yaoweme":{source:"iana"},"application/vnd.yellowriver-custom-menu":{source:"iana",extensions:["cmp"]},"application/vnd.youtube.yt":{source:"iana"},"application/vnd.zul":{source:"iana",extensions:["zir","zirz"]},"application/vnd.zzazz.deck+xml":{source:"iana",compressible:!0,extensions:["zaz"]},"application/voicexml+xml":{source:"iana",compressible:!0,extensions:["vxml"]},"application/voucher-cms+json":{source:"iana",compressible:!0},"application/vq-rtcpxr":{source:"iana"},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"application/watcherinfo+xml":{source:"iana",compressible:!0,extensions:["wif"]},"application/webpush-options+json":{source:"iana",compressible:!0},"application/whoispp-query":{source:"iana"},"application/whoispp-response":{source:"iana"},"application/widget":{source:"iana",extensions:["wgt"]},"application/winhlp":{source:"apache",extensions:["hlp"]},"application/wita":{source:"iana"},"application/wordperfect5.1":{source:"iana"},"application/wsdl+xml":{source:"iana",compressible:!0,extensions:["wsdl"]},"application/wspolicy+xml":{source:"iana",compressible:!0,extensions:["wspolicy"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/x-abiword":{source:"apache",extensions:["abw"]},"application/x-ace-compressed":{source:"apache",extensions:["ace"]},"application/x-amf":{source:"apache"},"application/x-apple-diskimage":{source:"apache",extensions:["dmg"]},"application/x-arj":{compressible:!1,extensions:["arj"]},"application/x-authorware-bin":{source:"apache",extensions:["aab","x32","u32","vox"]},"application/x-authorware-map":{source:"apache",extensions:["aam"]},"application/x-authorware-seg":{source:"apache",extensions:["aas"]},"application/x-bcpio":{source:"apache",extensions:["bcpio"]},"application/x-bdoc":{compressible:!1,extensions:["bdoc"]},"application/x-bittorrent":{source:"apache",extensions:["torrent"]},"application/x-blorb":{source:"apache",extensions:["blb","blorb"]},"application/x-bzip":{source:"apache",compressible:!1,extensions:["bz"]},"application/x-bzip2":{source:"apache",compressible:!1,extensions:["bz2","boz"]},"application/x-cbr":{source:"apache",extensions:["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{source:"apache",extensions:["vcd"]},"application/x-cfs-compressed":{source:"apache",extensions:["cfs"]},"application/x-chat":{source:"apache",extensions:["chat"]},"application/x-chess-pgn":{source:"apache",extensions:["pgn"]},"application/x-chrome-extension":{extensions:["crx"]},"application/x-cocoa":{source:"nginx",extensions:["cco"]},"application/x-compress":{source:"apache"},"application/x-conference":{source:"apache",extensions:["nsc"]},"application/x-cpio":{source:"apache",extensions:["cpio"]},"application/x-csh":{source:"apache",extensions:["csh"]},"application/x-deb":{compressible:!1},"application/x-debian-package":{source:"apache",extensions:["deb","udeb"]},"application/x-dgc-compressed":{source:"apache",extensions:["dgc"]},"application/x-director":{source:"apache",extensions:["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{source:"apache",extensions:["wad"]},"application/x-dtbncx+xml":{source:"apache",compressible:!0,extensions:["ncx"]},"application/x-dtbook+xml":{source:"apache",compressible:!0,extensions:["dtb"]},"application/x-dtbresource+xml":{source:"apache",compressible:!0,extensions:["res"]},"application/x-dvi":{source:"apache",compressible:!1,extensions:["dvi"]},"application/x-envoy":{source:"apache",extensions:["evy"]},"application/x-eva":{source:"apache",extensions:["eva"]},"application/x-font-bdf":{source:"apache",extensions:["bdf"]},"application/x-font-dos":{source:"apache"},"application/x-font-framemaker":{source:"apache"},"application/x-font-ghostscript":{source:"apache",extensions:["gsf"]},"application/x-font-libgrx":{source:"apache"},"application/x-font-linux-psf":{source:"apache",extensions:["psf"]},"application/x-font-pcf":{source:"apache",extensions:["pcf"]},"application/x-font-snf":{source:"apache",extensions:["snf"]},"application/x-font-speedo":{source:"apache"},"application/x-font-sunos-news":{source:"apache"},"application/x-font-type1":{source:"apache",extensions:["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{source:"apache"},"application/x-freearc":{source:"apache",extensions:["arc"]},"application/x-futuresplash":{source:"apache",extensions:["spl"]},"application/x-gca-compressed":{source:"apache",extensions:["gca"]},"application/x-glulx":{source:"apache",extensions:["ulx"]},"application/x-gnumeric":{source:"apache",extensions:["gnumeric"]},"application/x-gramps-xml":{source:"apache",extensions:["gramps"]},"application/x-gtar":{source:"apache",extensions:["gtar"]},"application/x-gzip":{source:"apache"},"application/x-hdf":{source:"apache",extensions:["hdf"]},"application/x-httpd-php":{compressible:!0,extensions:["php"]},"application/x-install-instructions":{source:"apache",extensions:["install"]},"application/x-iso9660-image":{source:"apache",extensions:["iso"]},"application/x-iwork-keynote-sffkey":{extensions:["key"]},"application/x-iwork-numbers-sffnumbers":{extensions:["numbers"]},"application/x-iwork-pages-sffpages":{extensions:["pages"]},"application/x-java-archive-diff":{source:"nginx",extensions:["jardiff"]},"application/x-java-jnlp-file":{source:"apache",compressible:!1,extensions:["jnlp"]},"application/x-javascript":{compressible:!0},"application/x-keepass2":{extensions:["kdbx"]},"application/x-latex":{source:"apache",compressible:!1,extensions:["latex"]},"application/x-lua-bytecode":{extensions:["luac"]},"application/x-lzh-compressed":{source:"apache",extensions:["lzh","lha"]},"application/x-makeself":{source:"nginx",extensions:["run"]},"application/x-mie":{source:"apache",extensions:["mie"]},"application/x-mobipocket-ebook":{source:"apache",extensions:["prc","mobi"]},"application/x-mpegurl":{compressible:!1},"application/x-ms-application":{source:"apache",extensions:["application"]},"application/x-ms-shortcut":{source:"apache",extensions:["lnk"]},"application/x-ms-wmd":{source:"apache",extensions:["wmd"]},"application/x-ms-wmz":{source:"apache",extensions:["wmz"]},"application/x-ms-xbap":{source:"apache",extensions:["xbap"]},"application/x-msaccess":{source:"apache",extensions:["mdb"]},"application/x-msbinder":{source:"apache",extensions:["obd"]},"application/x-mscardfile":{source:"apache",extensions:["crd"]},"application/x-msclip":{source:"apache",extensions:["clp"]},"application/x-msdos-program":{extensions:["exe"]},"application/x-msdownload":{source:"apache",extensions:["exe","dll","com","bat","msi"]},"application/x-msmediaview":{source:"apache",extensions:["mvb","m13","m14"]},"application/x-msmetafile":{source:"apache",extensions:["wmf","wmz","emf","emz"]},"application/x-msmoney":{source:"apache",extensions:["mny"]},"application/x-mspublisher":{source:"apache",extensions:["pub"]},"application/x-msschedule":{source:"apache",extensions:["scd"]},"application/x-msterminal":{source:"apache",extensions:["trm"]},"application/x-mswrite":{source:"apache",extensions:["wri"]},"application/x-netcdf":{source:"apache",extensions:["nc","cdf"]},"application/x-ns-proxy-autoconfig":{compressible:!0,extensions:["pac"]},"application/x-nzb":{source:"apache",extensions:["nzb"]},"application/x-perl":{source:"nginx",extensions:["pl","pm"]},"application/x-pilot":{source:"nginx",extensions:["prc","pdb"]},"application/x-pkcs12":{source:"apache",compressible:!1,extensions:["p12","pfx"]},"application/x-pkcs7-certificates":{source:"apache",extensions:["p7b","spc"]},"application/x-pkcs7-certreqresp":{source:"apache",extensions:["p7r"]},"application/x-pki-message":{source:"iana"},"application/x-rar-compressed":{source:"apache",compressible:!1,extensions:["rar"]},"application/x-redhat-package-manager":{source:"nginx",extensions:["rpm"]},"application/x-research-info-systems":{source:"apache",extensions:["ris"]},"application/x-sea":{source:"nginx",extensions:["sea"]},"application/x-sh":{source:"apache",compressible:!0,extensions:["sh"]},"application/x-shar":{source:"apache",extensions:["shar"]},"application/x-shockwave-flash":{source:"apache",compressible:!1,extensions:["swf"]},"application/x-silverlight-app":{source:"apache",extensions:["xap"]},"application/x-sql":{source:"apache",extensions:["sql"]},"application/x-stuffit":{source:"apache",compressible:!1,extensions:["sit"]},"application/x-stuffitx":{source:"apache",extensions:["sitx"]},"application/x-subrip":{source:"apache",extensions:["srt"]},"application/x-sv4cpio":{source:"apache",extensions:["sv4cpio"]},"application/x-sv4crc":{source:"apache",extensions:["sv4crc"]},"application/x-t3vm-image":{source:"apache",extensions:["t3"]},"application/x-tads":{source:"apache",extensions:["gam"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-tcl":{source:"apache",extensions:["tcl","tk"]},"application/x-tex":{source:"apache",extensions:["tex"]},"application/x-tex-tfm":{source:"apache",extensions:["tfm"]},"application/x-texinfo":{source:"apache",extensions:["texinfo","texi"]},"application/x-tgif":{source:"apache",extensions:["obj"]},"application/x-ustar":{source:"apache",extensions:["ustar"]},"application/x-virtualbox-hdd":{compressible:!0,extensions:["hdd"]},"application/x-virtualbox-ova":{compressible:!0,extensions:["ova"]},"application/x-virtualbox-ovf":{compressible:!0,extensions:["ovf"]},"application/x-virtualbox-vbox":{compressible:!0,extensions:["vbox"]},"application/x-virtualbox-vbox-extpack":{compressible:!1,extensions:["vbox-extpack"]},"application/x-virtualbox-vdi":{compressible:!0,extensions:["vdi"]},"application/x-virtualbox-vhd":{compressible:!0,extensions:["vhd"]},"application/x-virtualbox-vmdk":{compressible:!0,extensions:["vmdk"]},"application/x-wais-source":{source:"apache",extensions:["src"]},"application/x-web-app-manifest+json":{compressible:!0,extensions:["webapp"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"application/x-x509-ca-cert":{source:"iana",extensions:["der","crt","pem"]},"application/x-x509-ca-ra-cert":{source:"iana"},"application/x-x509-next-ca-cert":{source:"iana"},"application/x-xfig":{source:"apache",extensions:["fig"]},"application/x-xliff+xml":{source:"apache",compressible:!0,extensions:["xlf"]},"application/x-xpinstall":{source:"apache",compressible:!1,extensions:["xpi"]},"application/x-xz":{source:"apache",extensions:["xz"]},"application/x-zmachine":{source:"apache",extensions:["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{source:"iana"},"application/xacml+xml":{source:"iana",compressible:!0},"application/xaml+xml":{source:"apache",compressible:!0,extensions:["xaml"]},"application/xcap-att+xml":{source:"iana",compressible:!0,extensions:["xav"]},"application/xcap-caps+xml":{source:"iana",compressible:!0,extensions:["xca"]},"application/xcap-diff+xml":{source:"iana",compressible:!0,extensions:["xdf"]},"application/xcap-el+xml":{source:"iana",compressible:!0,extensions:["xel"]},"application/xcap-error+xml":{source:"iana",compressible:!0},"application/xcap-ns+xml":{source:"iana",compressible:!0,extensions:["xns"]},"application/xcon-conference-info+xml":{source:"iana",compressible:!0},"application/xcon-conference-info-diff+xml":{source:"iana",compressible:!0},"application/xenc+xml":{source:"iana",compressible:!0,extensions:["xenc"]},"application/xhtml+xml":{source:"iana",compressible:!0,extensions:["xhtml","xht"]},"application/xhtml-voice+xml":{source:"apache",compressible:!0},"application/xliff+xml":{source:"iana",compressible:!0,extensions:["xlf"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml","xsl","xsd","rng"]},"application/xml-dtd":{source:"iana",compressible:!0,extensions:["dtd"]},"application/xml-external-parsed-entity":{source:"iana"},"application/xml-patch+xml":{source:"iana",compressible:!0},"application/xmpp+xml":{source:"iana",compressible:!0},"application/xop+xml":{source:"iana",compressible:!0,extensions:["xop"]},"application/xproc+xml":{source:"apache",compressible:!0,extensions:["xpl"]},"application/xslt+xml":{source:"iana",compressible:!0,extensions:["xsl","xslt"]},"application/xspf+xml":{source:"apache",compressible:!0,extensions:["xspf"]},"application/xv+xml":{source:"iana",compressible:!0,extensions:["mxml","xhvml","xvml","xvm"]},"application/yang":{source:"iana",extensions:["yang"]},"application/yang-data+json":{source:"iana",compressible:!0},"application/yang-data+xml":{source:"iana",compressible:!0},"application/yang-patch+json":{source:"iana",compressible:!0},"application/yang-patch+xml":{source:"iana",compressible:!0},"application/yin+xml":{source:"iana",compressible:!0,extensions:["yin"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/zlib":{source:"iana"},"application/zstd":{source:"iana"},"audio/1d-interleaved-parityfec":{source:"iana"},"audio/32kadpcm":{source:"iana"},"audio/3gpp":{source:"iana",compressible:!1,extensions:["3gpp"]},"audio/3gpp2":{source:"iana"},"audio/aac":{source:"iana"},"audio/ac3":{source:"iana"},"audio/adpcm":{source:"apache",extensions:["adp"]},"audio/amr":{source:"iana",extensions:["amr"]},"audio/amr-wb":{source:"iana"},"audio/amr-wb+":{source:"iana"},"audio/aptx":{source:"iana"},"audio/asc":{source:"iana"},"audio/atrac-advanced-lossless":{source:"iana"},"audio/atrac-x":{source:"iana"},"audio/atrac3":{source:"iana"},"audio/basic":{source:"iana",compressible:!1,extensions:["au","snd"]},"audio/bv16":{source:"iana"},"audio/bv32":{source:"iana"},"audio/clearmode":{source:"iana"},"audio/cn":{source:"iana"},"audio/dat12":{source:"iana"},"audio/dls":{source:"iana"},"audio/dsr-es201108":{source:"iana"},"audio/dsr-es202050":{source:"iana"},"audio/dsr-es202211":{source:"iana"},"audio/dsr-es202212":{source:"iana"},"audio/dv":{source:"iana"},"audio/dvi4":{source:"iana"},"audio/eac3":{source:"iana"},"audio/encaprtp":{source:"iana"},"audio/evrc":{source:"iana"},"audio/evrc-qcp":{source:"iana"},"audio/evrc0":{source:"iana"},"audio/evrc1":{source:"iana"},"audio/evrcb":{source:"iana"},"audio/evrcb0":{source:"iana"},"audio/evrcb1":{source:"iana"},"audio/evrcnw":{source:"iana"},"audio/evrcnw0":{source:"iana"},"audio/evrcnw1":{source:"iana"},"audio/evrcwb":{source:"iana"},"audio/evrcwb0":{source:"iana"},"audio/evrcwb1":{source:"iana"},"audio/evs":{source:"iana"},"audio/flexfec":{source:"iana"},"audio/fwdred":{source:"iana"},"audio/g711-0":{source:"iana"},"audio/g719":{source:"iana"},"audio/g722":{source:"iana"},"audio/g7221":{source:"iana"},"audio/g723":{source:"iana"},"audio/g726-16":{source:"iana"},"audio/g726-24":{source:"iana"},"audio/g726-32":{source:"iana"},"audio/g726-40":{source:"iana"},"audio/g728":{source:"iana"},"audio/g729":{source:"iana"},"audio/g7291":{source:"iana"},"audio/g729d":{source:"iana"},"audio/g729e":{source:"iana"},"audio/gsm":{source:"iana"},"audio/gsm-efr":{source:"iana"},"audio/gsm-hr-08":{source:"iana"},"audio/ilbc":{source:"iana"},"audio/ip-mr_v2.5":{source:"iana"},"audio/isac":{source:"apache"},"audio/l16":{source:"iana"},"audio/l20":{source:"iana"},"audio/l24":{source:"iana",compressible:!1},"audio/l8":{source:"iana"},"audio/lpc":{source:"iana"},"audio/melp":{source:"iana"},"audio/melp1200":{source:"iana"},"audio/melp2400":{source:"iana"},"audio/melp600":{source:"iana"},"audio/mhas":{source:"iana"},"audio/midi":{source:"apache",extensions:["mid","midi","kar","rmi"]},"audio/mobile-xmf":{source:"iana",extensions:["mxmf"]},"audio/mp3":{compressible:!1,extensions:["mp3"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a","mp4a"]},"audio/mp4a-latm":{source:"iana"},"audio/mpa":{source:"iana"},"audio/mpa-robust":{source:"iana"},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{source:"iana"},"audio/musepack":{source:"apache"},"audio/ogg":{source:"iana",compressible:!1,extensions:["oga","ogg","spx","opus"]},"audio/opus":{source:"iana"},"audio/parityfec":{source:"iana"},"audio/pcma":{source:"iana"},"audio/pcma-wb":{source:"iana"},"audio/pcmu":{source:"iana"},"audio/pcmu-wb":{source:"iana"},"audio/prs.sid":{source:"iana"},"audio/qcelp":{source:"iana"},"audio/raptorfec":{source:"iana"},"audio/red":{source:"iana"},"audio/rtp-enc-aescm128":{source:"iana"},"audio/rtp-midi":{source:"iana"},"audio/rtploopback":{source:"iana"},"audio/rtx":{source:"iana"},"audio/s3m":{source:"apache",extensions:["s3m"]},"audio/scip":{source:"iana"},"audio/silk":{source:"apache",extensions:["sil"]},"audio/smv":{source:"iana"},"audio/smv-qcp":{source:"iana"},"audio/smv0":{source:"iana"},"audio/sofa":{source:"iana"},"audio/sp-midi":{source:"iana"},"audio/speex":{source:"iana"},"audio/t140c":{source:"iana"},"audio/t38":{source:"iana"},"audio/telephone-event":{source:"iana"},"audio/tetra_acelp":{source:"iana"},"audio/tetra_acelp_bb":{source:"iana"},"audio/tone":{source:"iana"},"audio/tsvcis":{source:"iana"},"audio/uemclip":{source:"iana"},"audio/ulpfec":{source:"iana"},"audio/usac":{source:"iana"},"audio/vdvi":{source:"iana"},"audio/vmr-wb":{source:"iana"},"audio/vnd.3gpp.iufp":{source:"iana"},"audio/vnd.4sb":{source:"iana"},"audio/vnd.audiokoz":{source:"iana"},"audio/vnd.celp":{source:"iana"},"audio/vnd.cisco.nse":{source:"iana"},"audio/vnd.cmles.radio-events":{source:"iana"},"audio/vnd.cns.anp1":{source:"iana"},"audio/vnd.cns.inf1":{source:"iana"},"audio/vnd.dece.audio":{source:"iana",extensions:["uva","uvva"]},"audio/vnd.digital-winds":{source:"iana",extensions:["eol"]},"audio/vnd.dlna.adts":{source:"iana"},"audio/vnd.dolby.heaac.1":{source:"iana"},"audio/vnd.dolby.heaac.2":{source:"iana"},"audio/vnd.dolby.mlp":{source:"iana"},"audio/vnd.dolby.mps":{source:"iana"},"audio/vnd.dolby.pl2":{source:"iana"},"audio/vnd.dolby.pl2x":{source:"iana"},"audio/vnd.dolby.pl2z":{source:"iana"},"audio/vnd.dolby.pulse.1":{source:"iana"},"audio/vnd.dra":{source:"iana",extensions:["dra"]},"audio/vnd.dts":{source:"iana",extensions:["dts"]},"audio/vnd.dts.hd":{source:"iana",extensions:["dtshd"]},"audio/vnd.dts.uhd":{source:"iana"},"audio/vnd.dvb.file":{source:"iana"},"audio/vnd.everad.plj":{source:"iana"},"audio/vnd.hns.audio":{source:"iana"},"audio/vnd.lucent.voice":{source:"iana",extensions:["lvp"]},"audio/vnd.ms-playready.media.pya":{source:"iana",extensions:["pya"]},"audio/vnd.nokia.mobile-xmf":{source:"iana"},"audio/vnd.nortel.vbk":{source:"iana"},"audio/vnd.nuera.ecelp4800":{source:"iana",extensions:["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{source:"iana",extensions:["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{source:"iana",extensions:["ecelp9600"]},"audio/vnd.octel.sbc":{source:"iana"},"audio/vnd.presonus.multitrack":{source:"iana"},"audio/vnd.qcelp":{source:"iana"},"audio/vnd.rhetorex.32kadpcm":{source:"iana"},"audio/vnd.rip":{source:"iana",extensions:["rip"]},"audio/vnd.rn-realaudio":{compressible:!1},"audio/vnd.sealedmedia.softseal.mpeg":{source:"iana"},"audio/vnd.vmx.cvsd":{source:"iana"},"audio/vnd.wave":{compressible:!1},"audio/vorbis":{source:"iana",compressible:!1},"audio/vorbis-config":{source:"iana"},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/wave":{compressible:!1,extensions:["wav"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/x-aac":{source:"apache",compressible:!1,extensions:["aac"]},"audio/x-aiff":{source:"apache",extensions:["aif","aiff","aifc"]},"audio/x-caf":{source:"apache",compressible:!1,extensions:["caf"]},"audio/x-flac":{source:"apache",extensions:["flac"]},"audio/x-m4a":{source:"nginx",extensions:["m4a"]},"audio/x-matroska":{source:"apache",extensions:["mka"]},"audio/x-mpegurl":{source:"apache",extensions:["m3u"]},"audio/x-ms-wax":{source:"apache",extensions:["wax"]},"audio/x-ms-wma":{source:"apache",extensions:["wma"]},"audio/x-pn-realaudio":{source:"apache",extensions:["ram","ra"]},"audio/x-pn-realaudio-plugin":{source:"apache",extensions:["rmp"]},"audio/x-realaudio":{source:"nginx",extensions:["ra"]},"audio/x-tta":{source:"apache"},"audio/x-wav":{source:"apache",extensions:["wav"]},"audio/xm":{source:"apache",extensions:["xm"]},"chemical/x-cdx":{source:"apache",extensions:["cdx"]},"chemical/x-cif":{source:"apache",extensions:["cif"]},"chemical/x-cmdf":{source:"apache",extensions:["cmdf"]},"chemical/x-cml":{source:"apache",extensions:["cml"]},"chemical/x-csml":{source:"apache",extensions:["csml"]},"chemical/x-pdb":{source:"apache"},"chemical/x-xyz":{source:"apache",extensions:["xyz"]},"font/collection":{source:"iana",extensions:["ttc"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"font/sfnt":{source:"iana"},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/woff":{source:"iana",extensions:["woff"]},"font/woff2":{source:"iana",extensions:["woff2"]},"image/aces":{source:"iana",extensions:["exr"]},"image/apng":{compressible:!1,extensions:["apng"]},"image/avci":{source:"iana",extensions:["avci"]},"image/avcs":{source:"iana",extensions:["avcs"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/cgm":{source:"iana",extensions:["cgm"]},"image/dicom-rle":{source:"iana",extensions:["drle"]},"image/emf":{source:"iana",extensions:["emf"]},"image/fits":{source:"iana",extensions:["fits"]},"image/g3fax":{source:"iana",extensions:["g3"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/heic":{source:"iana",extensions:["heic"]},"image/heic-sequence":{source:"iana",extensions:["heics"]},"image/heif":{source:"iana",extensions:["heif"]},"image/heif-sequence":{source:"iana",extensions:["heifs"]},"image/hej2k":{source:"iana",extensions:["hej2"]},"image/hsj2":{source:"iana",extensions:["hsj2"]},"image/ief":{source:"iana",extensions:["ief"]},"image/jls":{source:"iana",extensions:["jls"]},"image/jp2":{source:"iana",compressible:!1,extensions:["jp2","jpg2"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/jph":{source:"iana",extensions:["jph"]},"image/jphc":{source:"iana",extensions:["jhc"]},"image/jpm":{source:"iana",compressible:!1,extensions:["jpm"]},"image/jpx":{source:"iana",compressible:!1,extensions:["jpx","jpf"]},"image/jxr":{source:"iana",extensions:["jxr"]},"image/jxra":{source:"iana",extensions:["jxra"]},"image/jxrs":{source:"iana",extensions:["jxrs"]},"image/jxs":{source:"iana",extensions:["jxs"]},"image/jxsc":{source:"iana",extensions:["jxsc"]},"image/jxsi":{source:"iana",extensions:["jxsi"]},"image/jxss":{source:"iana",extensions:["jxss"]},"image/ktx":{source:"iana",extensions:["ktx"]},"image/ktx2":{source:"iana",extensions:["ktx2"]},"image/naplps":{source:"iana"},"image/pjpeg":{compressible:!1},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/prs.btif":{source:"iana",extensions:["btif"]},"image/prs.pti":{source:"iana",extensions:["pti"]},"image/pwg-raster":{source:"iana"},"image/sgi":{source:"apache",extensions:["sgi"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/t38":{source:"iana",extensions:["t38"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tif","tiff"]},"image/tiff-fx":{source:"iana",extensions:["tfx"]},"image/vnd.adobe.photoshop":{source:"iana",compressible:!0,extensions:["psd"]},"image/vnd.airzip.accelerator.azv":{source:"iana",extensions:["azv"]},"image/vnd.cns.inf2":{source:"iana"},"image/vnd.dece.graphic":{source:"iana",extensions:["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{source:"iana",extensions:["djvu","djv"]},"image/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"image/vnd.dwg":{source:"iana",extensions:["dwg"]},"image/vnd.dxf":{source:"iana",extensions:["dxf"]},"image/vnd.fastbidsheet":{source:"iana",extensions:["fbs"]},"image/vnd.fpx":{source:"iana",extensions:["fpx"]},"image/vnd.fst":{source:"iana",extensions:["fst"]},"image/vnd.fujixerox.edmics-mmr":{source:"iana",extensions:["mmr"]},"image/vnd.fujixerox.edmics-rlc":{source:"iana",extensions:["rlc"]},"image/vnd.globalgraphics.pgb":{source:"iana"},"image/vnd.microsoft.icon":{source:"iana",compressible:!0,extensions:["ico"]},"image/vnd.mix":{source:"iana"},"image/vnd.mozilla.apng":{source:"iana"},"image/vnd.ms-dds":{compressible:!0,extensions:["dds"]},"image/vnd.ms-modi":{source:"iana",extensions:["mdi"]},"image/vnd.ms-photo":{source:"apache",extensions:["wdp"]},"image/vnd.net-fpx":{source:"iana",extensions:["npx"]},"image/vnd.pco.b16":{source:"iana",extensions:["b16"]},"image/vnd.radiance":{source:"iana"},"image/vnd.sealed.png":{source:"iana"},"image/vnd.sealedmedia.softseal.gif":{source:"iana"},"image/vnd.sealedmedia.softseal.jpg":{source:"iana"},"image/vnd.svf":{source:"iana"},"image/vnd.tencent.tap":{source:"iana",extensions:["tap"]},"image/vnd.valve.source.texture":{source:"iana",extensions:["vtf"]},"image/vnd.wap.wbmp":{source:"iana",extensions:["wbmp"]},"image/vnd.xiff":{source:"iana",extensions:["xif"]},"image/vnd.zbrush.pcx":{source:"iana",extensions:["pcx"]},"image/webp":{source:"apache",extensions:["webp"]},"image/wmf":{source:"iana",extensions:["wmf"]},"image/x-3ds":{source:"apache",extensions:["3ds"]},"image/x-cmu-raster":{source:"apache",extensions:["ras"]},"image/x-cmx":{source:"apache",extensions:["cmx"]},"image/x-freehand":{source:"apache",extensions:["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/x-jng":{source:"nginx",extensions:["jng"]},"image/x-mrsid-image":{source:"apache",extensions:["sid"]},"image/x-ms-bmp":{source:"nginx",compressible:!0,extensions:["bmp"]},"image/x-pcx":{source:"apache",extensions:["pcx"]},"image/x-pict":{source:"apache",extensions:["pic","pct"]},"image/x-portable-anymap":{source:"apache",extensions:["pnm"]},"image/x-portable-bitmap":{source:"apache",extensions:["pbm"]},"image/x-portable-graymap":{source:"apache",extensions:["pgm"]},"image/x-portable-pixmap":{source:"apache",extensions:["ppm"]},"image/x-rgb":{source:"apache",extensions:["rgb"]},"image/x-tga":{source:"apache",extensions:["tga"]},"image/x-xbitmap":{source:"apache",extensions:["xbm"]},"image/x-xcf":{compressible:!1},"image/x-xpixmap":{source:"apache",extensions:["xpm"]},"image/x-xwindowdump":{source:"apache",extensions:["xwd"]},"message/cpim":{source:"iana"},"message/delivery-status":{source:"iana"},"message/disposition-notification":{source:"iana",extensions:["disposition-notification"]},"message/external-body":{source:"iana"},"message/feedback-report":{source:"iana"},"message/global":{source:"iana",extensions:["u8msg"]},"message/global-delivery-status":{source:"iana",extensions:["u8dsn"]},"message/global-disposition-notification":{source:"iana",extensions:["u8mdn"]},"message/global-headers":{source:"iana",extensions:["u8hdr"]},"message/http":{source:"iana",compressible:!1},"message/imdn+xml":{source:"iana",compressible:!0},"message/news":{source:"iana"},"message/partial":{source:"iana",compressible:!1},"message/rfc822":{source:"iana",compressible:!0,extensions:["eml","mime"]},"message/s-http":{source:"iana"},"message/sip":{source:"iana"},"message/sipfrag":{source:"iana"},"message/tracking-status":{source:"iana"},"message/vnd.si.simp":{source:"iana"},"message/vnd.wfa.wsc":{source:"iana",extensions:["wsc"]},"model/3mf":{source:"iana",extensions:["3mf"]},"model/e57":{source:"iana"},"model/gltf+json":{source:"iana",compressible:!0,extensions:["gltf"]},"model/gltf-binary":{source:"iana",compressible:!0,extensions:["glb"]},"model/iges":{source:"iana",compressible:!1,extensions:["igs","iges"]},"model/mesh":{source:"iana",compressible:!1,extensions:["msh","mesh","silo"]},"model/mtl":{source:"iana",extensions:["mtl"]},"model/obj":{source:"iana",extensions:["obj"]},"model/step":{source:"iana"},"model/step+xml":{source:"iana",compressible:!0,extensions:["stpx"]},"model/step+zip":{source:"iana",compressible:!1,extensions:["stpz"]},"model/step-xml+zip":{source:"iana",compressible:!1,extensions:["stpxz"]},"model/stl":{source:"iana",extensions:["stl"]},"model/vnd.collada+xml":{source:"iana",compressible:!0,extensions:["dae"]},"model/vnd.dwf":{source:"iana",extensions:["dwf"]},"model/vnd.flatland.3dml":{source:"iana"},"model/vnd.gdl":{source:"iana",extensions:["gdl"]},"model/vnd.gs-gdl":{source:"apache"},"model/vnd.gs.gdl":{source:"iana"},"model/vnd.gtw":{source:"iana",extensions:["gtw"]},"model/vnd.moml+xml":{source:"iana",compressible:!0},"model/vnd.mts":{source:"iana",extensions:["mts"]},"model/vnd.opengex":{source:"iana",extensions:["ogex"]},"model/vnd.parasolid.transmit.binary":{source:"iana",extensions:["x_b"]},"model/vnd.parasolid.transmit.text":{source:"iana",extensions:["x_t"]},"model/vnd.pytha.pyox":{source:"iana"},"model/vnd.rosette.annotated-data-model":{source:"iana"},"model/vnd.sap.vds":{source:"iana",extensions:["vds"]},"model/vnd.usdz+zip":{source:"iana",compressible:!1,extensions:["usdz"]},"model/vnd.valve.source.compiled-map":{source:"iana",extensions:["bsp"]},"model/vnd.vtu":{source:"iana",extensions:["vtu"]},"model/vrml":{source:"iana",compressible:!1,extensions:["wrl","vrml"]},"model/x3d+binary":{source:"apache",compressible:!1,extensions:["x3db","x3dbz"]},"model/x3d+fastinfoset":{source:"iana",extensions:["x3db"]},"model/x3d+vrml":{source:"apache",compressible:!1,extensions:["x3dv","x3dvz"]},"model/x3d+xml":{source:"iana",compressible:!0,extensions:["x3d","x3dz"]},"model/x3d-vrml":{source:"iana",extensions:["x3dv"]},"multipart/alternative":{source:"iana",compressible:!1},"multipart/appledouble":{source:"iana"},"multipart/byteranges":{source:"iana"},"multipart/digest":{source:"iana"},"multipart/encrypted":{source:"iana",compressible:!1},"multipart/form-data":{source:"iana",compressible:!1},"multipart/header-set":{source:"iana"},"multipart/mixed":{source:"iana"},"multipart/multilingual":{source:"iana"},"multipart/parallel":{source:"iana"},"multipart/related":{source:"iana",compressible:!1},"multipart/report":{source:"iana"},"multipart/signed":{source:"iana",compressible:!1},"multipart/vnd.bint.med-plus":{source:"iana"},"multipart/voice-message":{source:"iana"},"multipart/x-mixed-replace":{source:"iana"},"text/1d-interleaved-parityfec":{source:"iana"},"text/cache-manifest":{source:"iana",compressible:!0,extensions:["appcache","manifest"]},"text/calendar":{source:"iana",extensions:["ics","ifb"]},"text/calender":{compressible:!0},"text/cmd":{compressible:!0},"text/coffeescript":{extensions:["coffee","litcoffee"]},"text/cql":{source:"iana"},"text/cql-expression":{source:"iana"},"text/cql-identifier":{source:"iana"},"text/css":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["css"]},"text/csv":{source:"iana",compressible:!0,extensions:["csv"]},"text/csv-schema":{source:"iana"},"text/directory":{source:"iana"},"text/dns":{source:"iana"},"text/ecmascript":{source:"iana"},"text/encaprtp":{source:"iana"},"text/enriched":{source:"iana"},"text/fhirpath":{source:"iana"},"text/flexfec":{source:"iana"},"text/fwdred":{source:"iana"},"text/gff3":{source:"iana"},"text/grammar-ref-list":{source:"iana"},"text/html":{source:"iana",compressible:!0,extensions:["html","htm","shtml"]},"text/jade":{extensions:["jade"]},"text/javascript":{source:"iana",compressible:!0},"text/jcr-cnd":{source:"iana"},"text/jsx":{compressible:!0,extensions:["jsx"]},"text/less":{compressible:!0,extensions:["less"]},"text/markdown":{source:"iana",compressible:!0,extensions:["markdown","md"]},"text/mathml":{source:"nginx",extensions:["mml"]},"text/mdx":{compressible:!0,extensions:["mdx"]},"text/mizar":{source:"iana"},"text/n3":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["n3"]},"text/parameters":{source:"iana",charset:"UTF-8"},"text/parityfec":{source:"iana"},"text/plain":{source:"iana",compressible:!0,extensions:["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{source:"iana",charset:"UTF-8"},"text/prs.fallenstein.rst":{source:"iana"},"text/prs.lines.tag":{source:"iana",extensions:["dsc"]},"text/prs.prop.logic":{source:"iana"},"text/raptorfec":{source:"iana"},"text/red":{source:"iana"},"text/rfc822-headers":{source:"iana"},"text/richtext":{source:"iana",compressible:!0,extensions:["rtx"]},"text/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"text/rtp-enc-aescm128":{source:"iana"},"text/rtploopback":{source:"iana"},"text/rtx":{source:"iana"},"text/sgml":{source:"iana",extensions:["sgml","sgm"]},"text/shaclc":{source:"iana"},"text/shex":{source:"iana",extensions:["shex"]},"text/slim":{extensions:["slim","slm"]},"text/spdx":{source:"iana",extensions:["spdx"]},"text/strings":{source:"iana"},"text/stylus":{extensions:["stylus","styl"]},"text/t140":{source:"iana"},"text/tab-separated-values":{source:"iana",compressible:!0,extensions:["tsv"]},"text/troff":{source:"iana",extensions:["t","tr","roff","man","me","ms"]},"text/turtle":{source:"iana",charset:"UTF-8",extensions:["ttl"]},"text/ulpfec":{source:"iana"},"text/uri-list":{source:"iana",compressible:!0,extensions:["uri","uris","urls"]},"text/vcard":{source:"iana",compressible:!0,extensions:["vcard"]},"text/vnd.a":{source:"iana"},"text/vnd.abc":{source:"iana"},"text/vnd.ascii-art":{source:"iana"},"text/vnd.curl":{source:"iana",extensions:["curl"]},"text/vnd.curl.dcurl":{source:"apache",extensions:["dcurl"]},"text/vnd.curl.mcurl":{source:"apache",extensions:["mcurl"]},"text/vnd.curl.scurl":{source:"apache",extensions:["scurl"]},"text/vnd.debian.copyright":{source:"iana",charset:"UTF-8"},"text/vnd.dmclientscript":{source:"iana"},"text/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"text/vnd.esmertec.theme-descriptor":{source:"iana",charset:"UTF-8"},"text/vnd.familysearch.gedcom":{source:"iana",extensions:["ged"]},"text/vnd.ficlab.flt":{source:"iana"},"text/vnd.fly":{source:"iana",extensions:["fly"]},"text/vnd.fmi.flexstor":{source:"iana",extensions:["flx"]},"text/vnd.gml":{source:"iana"},"text/vnd.graphviz":{source:"iana",extensions:["gv"]},"text/vnd.hans":{source:"iana"},"text/vnd.hgl":{source:"iana"},"text/vnd.in3d.3dml":{source:"iana",extensions:["3dml"]},"text/vnd.in3d.spot":{source:"iana",extensions:["spot"]},"text/vnd.iptc.newsml":{source:"iana"},"text/vnd.iptc.nitf":{source:"iana"},"text/vnd.latex-z":{source:"iana"},"text/vnd.motorola.reflex":{source:"iana"},"text/vnd.ms-mediapackage":{source:"iana"},"text/vnd.net2phone.commcenter.command":{source:"iana"},"text/vnd.radisys.msml-basic-layout":{source:"iana"},"text/vnd.senx.warpscript":{source:"iana"},"text/vnd.si.uricatalogue":{source:"iana"},"text/vnd.sosi":{source:"iana"},"text/vnd.sun.j2me.app-descriptor":{source:"iana",charset:"UTF-8",extensions:["jad"]},"text/vnd.trolltech.linguist":{source:"iana",charset:"UTF-8"},"text/vnd.wap.si":{source:"iana"},"text/vnd.wap.sl":{source:"iana"},"text/vnd.wap.wml":{source:"iana",extensions:["wml"]},"text/vnd.wap.wmlscript":{source:"iana",extensions:["wmls"]},"text/vtt":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["vtt"]},"text/x-asm":{source:"apache",extensions:["s","asm"]},"text/x-c":{source:"apache",extensions:["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{source:"nginx",extensions:["htc"]},"text/x-fortran":{source:"apache",extensions:["f","for","f77","f90"]},"text/x-gwt-rpc":{compressible:!0},"text/x-handlebars-template":{extensions:["hbs"]},"text/x-java-source":{source:"apache",extensions:["java"]},"text/x-jquery-tmpl":{compressible:!0},"text/x-lua":{extensions:["lua"]},"text/x-markdown":{compressible:!0,extensions:["mkd"]},"text/x-nfo":{source:"apache",extensions:["nfo"]},"text/x-opml":{source:"apache",extensions:["opml"]},"text/x-org":{compressible:!0,extensions:["org"]},"text/x-pascal":{source:"apache",extensions:["p","pas"]},"text/x-processing":{compressible:!0,extensions:["pde"]},"text/x-sass":{extensions:["sass"]},"text/x-scss":{extensions:["scss"]},"text/x-setext":{source:"apache",extensions:["etx"]},"text/x-sfv":{source:"apache",extensions:["sfv"]},"text/x-suse-ymp":{compressible:!0,extensions:["ymp"]},"text/x-uuencode":{source:"apache",extensions:["uu"]},"text/x-vcalendar":{source:"apache",extensions:["vcs"]},"text/x-vcard":{source:"apache",extensions:["vcf"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/xml-external-parsed-entity":{source:"iana"},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"video/1d-interleaved-parityfec":{source:"iana"},"video/3gpp":{source:"iana",extensions:["3gp","3gpp"]},"video/3gpp-tt":{source:"iana"},"video/3gpp2":{source:"iana",extensions:["3g2"]},"video/av1":{source:"iana"},"video/bmpeg":{source:"iana"},"video/bt656":{source:"iana"},"video/celb":{source:"iana"},"video/dv":{source:"iana"},"video/encaprtp":{source:"iana"},"video/ffv1":{source:"iana"},"video/flexfec":{source:"iana"},"video/h261":{source:"iana",extensions:["h261"]},"video/h263":{source:"iana",extensions:["h263"]},"video/h263-1998":{source:"iana"},"video/h263-2000":{source:"iana"},"video/h264":{source:"iana",extensions:["h264"]},"video/h264-rcdo":{source:"iana"},"video/h264-svc":{source:"iana"},"video/h265":{source:"iana"},"video/iso.segment":{source:"iana",extensions:["m4s"]},"video/jpeg":{source:"iana",extensions:["jpgv"]},"video/jpeg2000":{source:"iana"},"video/jpm":{source:"apache",extensions:["jpm","jpgm"]},"video/jxsv":{source:"iana"},"video/mj2":{source:"iana",extensions:["mj2","mjp2"]},"video/mp1s":{source:"iana"},"video/mp2p":{source:"iana"},"video/mp2t":{source:"iana",extensions:["ts"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","mp4v","mpg4"]},"video/mp4v-es":{source:"iana"},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{source:"iana"},"video/mpv":{source:"iana"},"video/nv":{source:"iana"},"video/ogg":{source:"iana",compressible:!1,extensions:["ogv"]},"video/parityfec":{source:"iana"},"video/pointer":{source:"iana"},"video/quicktime":{source:"iana",compressible:!1,extensions:["qt","mov"]},"video/raptorfec":{source:"iana"},"video/raw":{source:"iana"},"video/rtp-enc-aescm128":{source:"iana"},"video/rtploopback":{source:"iana"},"video/rtx":{source:"iana"},"video/scip":{source:"iana"},"video/smpte291":{source:"iana"},"video/smpte292m":{source:"iana"},"video/ulpfec":{source:"iana"},"video/vc1":{source:"iana"},"video/vc2":{source:"iana"},"video/vnd.cctv":{source:"iana"},"video/vnd.dece.hd":{source:"iana",extensions:["uvh","uvvh"]},"video/vnd.dece.mobile":{source:"iana",extensions:["uvm","uvvm"]},"video/vnd.dece.mp4":{source:"iana"},"video/vnd.dece.pd":{source:"iana",extensions:["uvp","uvvp"]},"video/vnd.dece.sd":{source:"iana",extensions:["uvs","uvvs"]},"video/vnd.dece.video":{source:"iana",extensions:["uvv","uvvv"]},"video/vnd.directv.mpeg":{source:"iana"},"video/vnd.directv.mpeg-tts":{source:"iana"},"video/vnd.dlna.mpeg-tts":{source:"iana"},"video/vnd.dvb.file":{source:"iana",extensions:["dvb"]},"video/vnd.fvt":{source:"iana",extensions:["fvt"]},"video/vnd.hns.video":{source:"iana"},"video/vnd.iptvforum.1dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.1dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.2dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.2dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.ttsavc":{source:"iana"},"video/vnd.iptvforum.ttsmpeg2":{source:"iana"},"video/vnd.motorola.video":{source:"iana"},"video/vnd.motorola.videop":{source:"iana"},"video/vnd.mpegurl":{source:"iana",extensions:["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{source:"iana",extensions:["pyv"]},"video/vnd.nokia.interleaved-multimedia":{source:"iana"},"video/vnd.nokia.mp4vr":{source:"iana"},"video/vnd.nokia.videovoip":{source:"iana"},"video/vnd.objectvideo":{source:"iana"},"video/vnd.radgamettools.bink":{source:"iana"},"video/vnd.radgamettools.smacker":{source:"iana"},"video/vnd.sealed.mpeg1":{source:"iana"},"video/vnd.sealed.mpeg4":{source:"iana"},"video/vnd.sealed.swf":{source:"iana"},"video/vnd.sealedmedia.softseal.mov":{source:"iana"},"video/vnd.uvvu.mp4":{source:"iana",extensions:["uvu","uvvu"]},"video/vnd.vivo":{source:"iana",extensions:["viv"]},"video/vnd.youtube.yt":{source:"iana"},"video/vp8":{source:"iana"},"video/vp9":{source:"iana"},"video/webm":{source:"apache",compressible:!1,extensions:["webm"]},"video/x-f4v":{source:"apache",extensions:["f4v"]},"video/x-fli":{source:"apache",extensions:["fli"]},"video/x-flv":{source:"apache",compressible:!1,extensions:["flv"]},"video/x-m4v":{source:"apache",extensions:["m4v"]},"video/x-matroska":{source:"apache",compressible:!1,extensions:["mkv","mk3d","mks"]},"video/x-mng":{source:"apache",extensions:["mng"]},"video/x-ms-asf":{source:"apache",extensions:["asf","asx"]},"video/x-ms-vob":{source:"apache",extensions:["vob"]},"video/x-ms-wm":{source:"apache",extensions:["wm"]},"video/x-ms-wmv":{source:"apache",compressible:!1,extensions:["wmv"]},"video/x-ms-wmx":{source:"apache",extensions:["wmx"]},"video/x-ms-wvx":{source:"apache",extensions:["wvx"]},"video/x-msvideo":{source:"apache",extensions:["avi"]},"video/x-sgi-movie":{source:"apache",extensions:["movie"]},"video/x-smv":{source:"apache",extensions:["smv"]},"x-conference/x-cooltalk":{source:"apache",extensions:["ice"]},"x-shader/x-fragment":{compressible:!0},"x-shader/x-vertex":{compressible:!0}}});var Wj=T(function(Nme){/*!
60
- * mime-types
61
- * Copyright(c) 2014 Jonathan Ong
62
- * Copyright(c) 2015 Douglas Christopher Wilson
63
- * MIT Licensed
64
- */var f_=zj(),Ome=ue("path").extname,Hj=/^\s*([^;\s]*)(?:;|\s|$)/,Pme=/^text\//i;Nme.charset=Bj;Nme.charsets={lookup:Bj};Nme.contentType=Ime;Nme.extension=Dme;Nme.extensions=Object.create(null);Nme.lookup=Lme;Nme.types=Object.create(null);Mme(Nme.extensions,Nme.types);function Bj(e){if(!e||typeof e!=="string")return!1;var t=Hj.exec(e),n=t&&f_[t[1].toLowerCase()];if(n&&n.charset)return n.charset;if(t&&Pme.test(t[1]))return"UTF-8";return!1}function Ime(e){if(!e||typeof e!=="string")return!1;var t=e.indexOf("/")===-1?Nme.lookup(e):e;if(!t)return!1;if(t.indexOf("charset")===-1){var n=Nme.charset(t);if(n)t+="; charset="+n.toLowerCase()}return t}function Dme(e){if(!e||typeof e!=="string")return!1;var t=Hj.exec(e),n=t&&Nme.extensions[t[1].toLowerCase()];if(!n||!n.length)return!1;return n[0]}function Lme(e){if(!e||typeof e!=="string")return!1;var t=Ome("x."+e).toLowerCase().substr(1);if(!t)return!1;return Nme.types[t]||!1}function Mme(e,t){var n=["nginx","apache",void 0,"iana"];Object.keys(f_).forEach(function(o){var s=f_[o],i=s.extensions;if(!i||!i.length)return;e[o]=i;for(var a=0;a<i.length;a++){var c=i[a];if(t[c]){var l=n.indexOf(f_[t[c]].source),u=n.indexOf(s.source);if(t[c]!=="application/octet-stream"&&(l>u||l===u&&t[c].substr(0,12)==="application/"))continue}t[c]=o}})}});var Vj=T(function(Ryt,qj){qj.exports=$me;function $me(e){var t=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;if(t)t(e);else setTimeout(e,0)}});var aA=T(function(Oyt,Yj){var Zj=Vj();Yj.exports=zme;function zme(e){var t=!1;return Zj(function(){t=!0}),function(r,o){if(t)e(r,o);else Zj(function(){e(r,o)})}}});var cA=T(function(Pyt,Jj){Jj.exports=Hme;function Hme(e){Object.keys(e.jobs).forEach(Bme.bind(e)),e.jobs={}}function Bme(e){if(typeof this.jobs[e]=="function")this.jobs[e]()}});var lA=T(function(Iyt,Qj){var Xj=aA(),Kme=cA();Qj.exports=Gme;function Gme(e,t,n,r){var o=n.keyedList?n.keyedList[n.index]:n.index;n.jobs[o]=Wme(t,o,e[o],function(s,i){if(!(o in n.jobs))return;if(delete n.jobs[o],s)Kme(n);else n.results[o]=i;r(s,n.results)})}function Wme(e,t,n,r){var o;if(e.length==2)o=e(n,Xj(r));else o=e(n,t,Xj(r));return o}});var uA=T(function(Dyt,e$){e$.exports=qme;function qme(e,t){var n=!Array.isArray(e),r={index:0,keyedList:n||t?Object.keys(e):null,jobs:{},results:n?{}:[],size:n?Object.keys(e).length:e.length};if(t)r.keyedList.sort(n?t:function(o,s){return t(e[o],e[s])});return r}});var dA=T(function(Lyt,t$){var Vme=cA(),Zme=aA();t$.exports=Yme;function Yme(e){if(!Object.keys(this.jobs).length)return;this.index=this.size,Vme(this),Zme(e)(null,this.results)}});var r$=T(function(Myt,n$){var Jme=lA(),Xme=uA(),Qme=dA();n$.exports=ehe;function ehe(e,t,n){var r=Xme(e);while(r.index<(r.keyedList||e).length)Jme(e,t,r,function(o,s){if(o){n(o,s);return}if(Object.keys(r.jobs).length===0){n(null,r.results);return}}),r.index++;return Qme.bind(r,n)}});var pA=T(function(Nyt,m_){var o$=lA(),the=uA(),nhe=dA();m_.exports=rhe;m_.exports.ascending=s$;m_.exports.descending=ohe;function rhe(e,t,n,r){var o=the(e,n);return o$(e,t,o,function s(i,a){if(i){r(i,a);return}if(o.index++,o.index<(o.keyedList||e).length){o$(e,t,o,s);return}r(null,o.results)}),nhe.bind(o,r)}function s$(e,t){return e<t?-1:e>t?1:0}function ohe(e,t){return-1*s$(e,t)}});var a$=T(function(Uyt,i$){var she=pA();i$.exports=ihe;function ihe(e,t,n){return she(e,t,null,n)}});var l$=T(function(Fyt,c$){c$.exports={parallel:r$(),serial:a$(),serialOrdered:pA()}});var fA=T(function(jyt,u$){u$.exports=Object});var p$=T(function($yt,d$){d$.exports=Error});var m$=T(function(zyt,f$){f$.exports=EvalError});var g$=T(function(Hyt,h$){h$.exports=RangeError});var y$=T(function(Byt,_$){_$.exports=ReferenceError});var S$=T(function(Kyt,b$){b$.exports=SyntaxError});var h_=T(function(Gyt,E$){E$.exports=TypeError});var v$=T(function(Wyt,x$){x$.exports=URIError});var A$=T(function(qyt,w$){w$.exports=Math.abs});var C$=T(function(Vyt,T$){T$.exports=Math.floor});var R$=T(function(Zyt,k$){k$.exports=Math.max});var P$=T(function(Yyt,O$){O$.exports=Math.min});var D$=T(function(Jyt,I$){I$.exports=Math.pow});var M$=T(function(Xyt,L$){L$.exports=Math.round});var U$=T(function(Qyt,N$){N$.exports=Number.isNaN||function(t){return t!==t}});var j$=T(function(ebt,F$){var ahe=U$();F$.exports=function(t){if(ahe(t)||t===0)return t;return t<0?-1:1}});var z$=T(function(tbt,$$){$$.exports=Object.getOwnPropertyDescriptor});var mA=T(function(nbt,H$){var g_=z$();if(g_)try{g_([],"length")}catch(e){g_=null}H$.exports=g_});var K$=T(function(rbt,B$){var __=Object.defineProperty||!1;if(__)try{__({},"a",{value:1})}catch(e){__=!1}B$.exports=__});var hA=T(function(obt,G$){G$.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var t={},n=Symbol("test"),r=Object(n);if(typeof n==="string")return!1;if(Object.prototype.toString.call(n)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var o=42;t[n]=o;for(var s in t)return!1;if(typeof Object.keys==="function"&&Object.keys(t).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var i=Object.getOwnPropertySymbols(t);if(i.length!==1||i[0]!==n)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,n))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var a=Object.getOwnPropertyDescriptor(t,n);if(a.value!==o||a.enumerable!==!0)return!1}return!0}});var V$=T(function(sbt,q$){var W$=typeof Symbol<"u"&&Symbol,che=hA();q$.exports=function(){if(typeof W$!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof W$("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return che()}});var gA=T(function(ibt,Z$){Z$.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var _A=T(function(abt,Y$){var lhe=fA();Y$.exports=lhe.getPrototypeOf||null});var Q$=T(function(cbt,X$){var uhe="Function.prototype.bind called on incompatible ",dhe=Object.prototype.toString,phe=Math.max,fhe="[object Function]",J$=function(t,n){var r=[];for(var o=0;o<t.length;o+=1)r[o]=t[o];for(var s=0;s<n.length;s+=1)r[s+t.length]=n[s];return r},mhe=function(t,n){var r=[];for(var o=n||0,s=0;o<t.length;o+=1,s+=1)r[s]=t[o];return r},hhe=function(e,t){var n="";for(var r=0;r<e.length;r+=1)if(n+=e[r],r+1<e.length)n+=t;return n};X$.exports=function(t){var n=this;if(typeof n!=="function"||dhe.apply(n)!==fhe)throw TypeError(uhe+n);var r=mhe(arguments,1),o,s=function(){if(this instanceof o){var u=n.apply(this,J$(r,arguments));if(Object(u)===u)return u;return this}return n.apply(t,J$(r,arguments))},i=phe(0,n.length-r.length),a=[];for(var c=0;c<i;c++)a[c]="$"+c;if(o=Function("binder","return function ("+hhe(a,",")+"){ return binder.apply(this,arguments); }")(s),n.prototype){var l=function(){};l.prototype=n.prototype,o.prototype=new l,l.prototype=null}return o}});var Ea=T(function(lbt,ez){var ghe=Q$();ez.exports=Function.prototype.bind||ghe});var y_=T(function(ubt,tz){tz.exports=Function.prototype.call});var yA=T(function(dbt,nz){nz.exports=Function.prototype.apply});var oz=T(function(pbt,rz){rz.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var iz=T(function(fbt,sz){var _he=Ea(),yhe=yA(),bhe=y_(),She=oz();sz.exports=She||_he.call(bhe,yhe)});var cz=T(function(mbt,az){var Ehe=Ea(),xhe=h_(),vhe=y_(),whe=iz();az.exports=function(t){if(t.length<1||typeof t[0]!=="function")throw new xhe("a function is required");return whe(Ehe,vhe,t)}});var mz=T(function(hbt,fz){var Ahe=cz(),lz=mA(),dz;try{dz=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!=="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var bA=!!dz&&lz&&lz(Object.prototype,"__proto__"),pz=Object,uz=pz.getPrototypeOf;fz.exports=bA&&typeof bA.get==="function"?Ahe([bA.get]):typeof uz==="function"?function(t){return uz(t==null?t:pz(t))}:!1});var bz=T(function(gbt,yz){var hz=gA(),gz=_A(),_z=mz();yz.exports=hz?function(t){return hz(t)}:gz?function(t){if(!t||typeof t!=="object"&&typeof t!=="function")throw TypeError("getProto: not an object");return gz(t)}:_z?function(t){return _z(t)}:null});var Ez=T(function(_bt,Sz){var The=Function.prototype.call,Che=Object.prototype.hasOwnProperty,khe=Ea();Sz.exports=khe.call(The,Che)});var Cz=T(function(ybt,Tz){var Fe,Rhe=fA(),Ohe=p$(),Phe=m$(),Ihe=g$(),Dhe=y$(),Kl=S$(),Bl=h_(),Lhe=v$(),Mhe=A$(),Nhe=C$(),Uhe=R$(),Fhe=P$(),jhe=D$(),$he=M$(),zhe=j$(),wz=Function,SA=function(e){try{return wz('"use strict"; return ('+e+").constructor;")()}catch(t){}},af=mA(),Hhe=K$(),EA=function(){throw new Bl},Bhe=af?function(){try{return arguments.callee,EA}catch(e){try{return af(arguments,"callee").get}catch(t){return EA}}}():EA,zl=V$()(),an=bz(),Khe=_A(),Ghe=gA(),Az=yA(),cf=y_(),Hl={},Whe=typeof Uint8Array>"u"||!an?Fe:an(Uint8Array),xa={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Fe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Fe:ArrayBuffer,"%ArrayIteratorPrototype%":zl&&an?an([][Symbol.iterator]()):Fe,"%AsyncFromSyncIteratorPrototype%":Fe,"%AsyncFunction%":Hl,"%AsyncGenerator%":Hl,"%AsyncGeneratorFunction%":Hl,"%AsyncIteratorPrototype%":Hl,"%Atomics%":typeof Atomics>"u"?Fe:Atomics,"%BigInt%":typeof BigInt>"u"?Fe:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Fe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Fe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Fe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Ohe,"%eval%":eval,"%EvalError%":Phe,"%Float16Array%":typeof Float16Array>"u"?Fe:Float16Array,"%Float32Array%":typeof Float32Array>"u"?Fe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Fe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Fe:FinalizationRegistry,"%Function%":wz,"%GeneratorFunction%":Hl,"%Int8Array%":typeof Int8Array>"u"?Fe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Fe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Fe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":zl&&an?an(an([][Symbol.iterator]())):Fe,"%JSON%":typeof JSON==="object"?JSON:Fe,"%Map%":typeof Map>"u"?Fe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!zl||!an?Fe:an(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Rhe,"%Object.getOwnPropertyDescriptor%":af,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Fe:Promise,"%Proxy%":typeof Proxy>"u"?Fe:Proxy,"%RangeError%":Ihe,"%ReferenceError%":Dhe,"%Reflect%":typeof Reflect>"u"?Fe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Fe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!zl||!an?Fe:an(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Fe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":zl&&an?an(""[Symbol.iterator]()):Fe,"%Symbol%":zl?Symbol:Fe,"%SyntaxError%":Kl,"%ThrowTypeError%":Bhe,"%TypedArray%":Whe,"%TypeError%":Bl,"%Uint8Array%":typeof Uint8Array>"u"?Fe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Fe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Fe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Fe:Uint32Array,"%URIError%":Lhe,"%WeakMap%":typeof WeakMap>"u"?Fe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Fe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Fe:WeakSet,"%Function.prototype.call%":cf,"%Function.prototype.apply%":Az,"%Object.defineProperty%":Hhe,"%Object.getPrototypeOf%":Khe,"%Math.abs%":Mhe,"%Math.floor%":Nhe,"%Math.max%":Uhe,"%Math.min%":Fhe,"%Math.pow%":jhe,"%Math.round%":$he,"%Math.sign%":zhe,"%Reflect.getPrototypeOf%":Ghe};if(an)try{null.error}catch(e){xA=an(an(e)),xa["%Error.prototype%"]=xA}var xA,qhe=function e(t){var n;if(t==="%AsyncFunction%")n=SA("async function () {}");else if(t==="%GeneratorFunction%")n=SA("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=SA("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");if(r)n=r.prototype}else if(t==="%AsyncIteratorPrototype%"){var o=e("%AsyncGenerator%");if(o&&an)n=an(o.prototype)}return xa[t]=n,n},xz={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},lf=Ea(),b_=Ez(),Vhe=lf.call(cf,Array.prototype.concat),Zhe=lf.call(Az,Array.prototype.splice),vz=lf.call(cf,String.prototype.replace),S_=lf.call(cf,String.prototype.slice),Yhe=lf.call(cf,RegExp.prototype.exec),Jhe=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Xhe=/\\(\\)?/g,Qhe=function(t){var n=S_(t,0,1),r=S_(t,-1);if(n==="%"&&r!=="%")throw new Kl("invalid intrinsic syntax, expected closing `%`");else if(r==="%"&&n!=="%")throw new Kl("invalid intrinsic syntax, expected opening `%`");var o=[];return vz(t,Jhe,function(s,i,a,c){o[o.length]=a?vz(c,Xhe,"$1"):i||s}),o},ege=function(t,n){var r=t,o;if(b_(xz,r))o=xz[r],r="%"+o[0]+"%";if(b_(xa,r)){var s=xa[r];if(s===Hl)s=qhe(r);if(typeof s>"u"&&!n)throw new Bl("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:o,name:r,value:s}}throw new Kl("intrinsic "+t+" does not exist!")};Tz.exports=function(t,n){if(typeof t!=="string"||t.length===0)throw new Bl("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!=="boolean")throw new Bl('"allowMissing" argument must be a boolean');if(Yhe(/^%?[^%]*%?$/,t)===null)throw new Kl("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=Qhe(t),o=r.length>0?r[0]:"",s=ege("%"+o+"%",n),i=s.name,a=s.value,c=!1,l=s.alias;if(l)o=l[0],Zhe(r,Vhe([0,1],l));for(var u=1,p=!0;u<r.length;u+=1){var f=r[u],m=S_(f,0,1),h=S_(f,-1);if((m==='"'||m==="'"||m==="`"||(h==='"'||h==="'"||h==="`"))&&m!==h)throw new Kl("property names with quotes must have matching quotes");if(f==="constructor"||!p)c=!0;if(o+="."+f,i="%"+o+"%",b_(xa,i))a=xa[i];else if(a!=null){if(!(f in a)){if(!n)throw new Bl("base intrinsic for "+t+" exists, but the property is not available.");return}if(af&&u+1>=r.length){var g=af(a,f);if(p=!!g,p&&"get"in g&&!("originalValue"in g.get))a=g.get;else a=a[f]}else p=b_(a,f),a=a[f];if(p&&!c)xa[i]=a}}return a}});var Rz=T(function(bbt,kz){var tge=hA();kz.exports=function(){return tge()&&!!Symbol.toStringTag}});var Pz=T(function(Sbt,Oz){var nge=Function.prototype.call,rge=Object.prototype.hasOwnProperty,oge=Ea();Oz.exports=oge.call(nge,rge)});var Lz=T(function(Ebt,Dz){var sge=Cz(),Iz=sge("%Object.defineProperty%",!0),ige=Rz()(),age=Pz(),cge=h_(),E_=ige?Symbol.toStringTag:null;Dz.exports=function(t,n){var r=arguments.length>2&&!!arguments[2]&&arguments[2].force,o=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof r<"u"&&typeof r!=="boolean"||typeof o<"u"&&typeof o!=="boolean")throw new cge("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");if(E_&&(r||!age(t,E_)))if(Iz)Iz(t,E_,{configurable:!o,enumerable:!1,value:n,writable:!1});else t[E_]=n}});var Nz=T(function(xbt,Mz){var lge=Function.prototype.call,uge=Object.prototype.hasOwnProperty,dge=Ea();Mz.exports=dge.call(lge,uge)});var Fz=T(function(vbt,Uz){Uz.exports=function(e,t){return Object.keys(t).forEach(function(n){e[n]=e[n]||t[n]}),e}});var zz=T(function(wbt,$z){var TA=$j(),pge=ue("util"),vA=ue("path"),fge=ue("http"),mge=ue("https"),hge=ue("url").parse,gge=ue("fs"),_ge=ue("stream").Stream,yge=ue("crypto"),wA=Wj(),bge=l$(),Sge=Lz(),gi=Nz(),AA=Fz();function jz(e){return String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}function Ke(e){if(!(this instanceof Ke))return new Ke(e);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],TA.call(this),e=e||{};for(var t in e)this[t]=e[t]}pge.inherits(Ke,TA);Ke.LINE_BREAK=`\r
65
- `;Ke.DEFAULT_CONTENT_TYPE="application/octet-stream";Ke.prototype.append=function(e,t,n){if(n=n||{},typeof n==="string")n={filename:n};var r=TA.prototype.append.bind(this);if(typeof t==="number"||t==null)t=String(t);if(Array.isArray(t)){this._error(Error("Arrays are not supported."));return}var o=this._multiPartHeader(e,t,n),s=this._multiPartFooter();r(o),r(t),r(s),this._trackLength(o,t,n)};Ke.prototype._trackLength=function(e,t,n){var r=0;if(n.knownLength!=null)r+=Number(n.knownLength);else if(Buffer.isBuffer(t))r=t.length;else if(typeof t==="string")r=Buffer.byteLength(t);if(this._valueLength+=r,this._overheadLength+=Buffer.byteLength(e)+Ke.LINE_BREAK.length,!t||!t.path&&!(t.readable&&gi(t,"httpVersion"))&&!(t instanceof _ge))return;if(!n.knownLength)this._valuesToMeasure.push(t)};Ke.prototype._lengthRetriever=function(e,t){if(gi(e,"fd"))if(e.end!=null&&e.end!=1/0&&e.start!=null)t(null,e.end+1-(e.start?e.start:0));else gge.stat(e.path,function(n,r){if(n){t(n);return}var o=r.size-(e.start?e.start:0);t(null,o)});else if(gi(e,"httpVersion"))t(null,Number(e.headers["content-length"]));else if(gi(e,"httpModule"))e.on("response",function(n){e.pause(),t(null,Number(n.headers["content-length"]))}),e.resume();else t("Unknown stream")};Ke.prototype._multiPartHeader=function(e,t,n){if(typeof n.header==="string")return n.header;var r=this._getContentDisposition(t,n),o=this._getContentType(t,n),s="",i={"Content-Disposition":["form-data",'name="'+jz(e)+'"'].concat(r||[]),"Content-Type":[].concat(o||[])};if(typeof n.header==="object")AA(i,n.header);var a;for(var c in i)if(gi(i,c)){if(a=i[c],a==null)continue;if(!Array.isArray(a))a=[a];if(a.length)s+=c+": "+a.join("; ")+Ke.LINE_BREAK}return"--"+this.getBoundary()+Ke.LINE_BREAK+s+Ke.LINE_BREAK};Ke.prototype._getContentDisposition=function(e,t){var n;if(typeof t.filepath==="string")n=vA.normalize(t.filepath).replace(/\\/g,"/");else if(t.filename||e&&(e.name||e.path))n=vA.basename(t.filename||e&&(e.name||e.path));else if(e&&e.readable&&gi(e,"httpVersion"))n=vA.basename(e.client._httpMessage.path||"");if(n)return'filename="'+jz(n)+'"'};Ke.prototype._getContentType=function(e,t){var n=t.contentType;if(!n&&e&&e.name)n=wA.lookup(e.name);if(!n&&e&&e.path)n=wA.lookup(e.path);if(!n&&e&&e.readable&&gi(e,"httpVersion"))n=e.headers["content-type"];if(!n&&(t.filepath||t.filename))n=wA.lookup(t.filepath||t.filename);if(!n&&e&&typeof e==="object")n=Ke.DEFAULT_CONTENT_TYPE;return n};Ke.prototype._multiPartFooter=function(){return function(e){var t=Ke.LINE_BREAK,n=this._streams.length===0;if(n)t+=this._lastBoundary();e(t)}.bind(this)};Ke.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+Ke.LINE_BREAK};Ke.prototype.getHeaders=function(e){var t,n={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)if(gi(e,t))n[t.toLowerCase()]=e[t];return n};Ke.prototype.setBoundary=function(e){if(typeof e!=="string")throw TypeError("FormData boundary must be a string");this._boundary=e};Ke.prototype.getBoundary=function(){if(!this._boundary)this._generateBoundary();return this._boundary};Ke.prototype.getBuffer=function(){var e=new Buffer.alloc(0),t=this.getBoundary();for(var n=0,r=this._streams.length;n<r;n++)if(typeof this._streams[n]!=="function"){if(Buffer.isBuffer(this._streams[n]))e=Buffer.concat([e,this._streams[n]]);else e=Buffer.concat([e,Buffer.from(this._streams[n])]);if(typeof this._streams[n]!=="string"||this._streams[n].substring(2,t.length+2)!==t)e=Buffer.concat([e,Buffer.from(Ke.LINE_BREAK)])}return Buffer.concat([e,Buffer.from(this._lastBoundary())])};Ke.prototype._generateBoundary=function(){this._boundary="--------------------------"+yge.randomBytes(12).toString("hex")};Ke.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;if(this._streams.length)e+=this._lastBoundary().length;if(!this.hasKnownLength())this._error(Error("Cannot calculate proper length in synchronous way."));return e};Ke.prototype.hasKnownLength=function(){var e=!0;if(this._valuesToMeasure.length)e=!1;return e};Ke.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;if(this._streams.length)t+=this._lastBoundary().length;if(!this._valuesToMeasure.length){process.nextTick(e.bind(this,null,t));return}bge.parallel(this._valuesToMeasure,this._lengthRetriever,function(n,r){if(n){e(n);return}r.forEach(function(o){t+=o}),e(null,t)})};Ke.prototype.submit=function(e,t){var n,r,o={method:"post"};if(typeof e==="string")e=hge(e),r=AA({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},o);else if(r=AA(e,o),!r.port)r.port=r.protocol==="https:"?443:80;if(r.headers=this.getHeaders(e.headers),r.protocol==="https:")n=mge.request(r);else n=fge.request(r);return this.getLength(function(s,i){if(s&&s!=="Unknown stream"){this._error(s);return}if(i)n.setHeader("Content-Length",i);if(this.pipe(n),t){var a,c=function(l,u){return n.removeListener("error",c),n.removeListener("response",a),t.call(this,l,u)};a=c.bind(this,null),n.on("error",c),n.on("response",a)}}.bind(this)),n};Ke.prototype._error=function(e){if(!this.error)this.error=e,this.pause(),this.emit("error",e)};Ke.prototype.toString=function(){return"[object FormData]"};Sge(Ke.prototype,"FormData");$z.exports=Ke});var Hz,x_;var CA=O(()=>{Hz=Hn(zz(),1),x_=Hz.default});function RA(e){return w.isPlainObject(e)||w.isArray(e)}function Bz(e){return w.endsWith(e,"[]")?e.slice(0,-2):e}function kA(e,t,n){if(!e)return t;return e.concat(t).map(function(o,s){return o=Bz(o),!n&&s?"["+o+"]":o}).join(n?".":"")}function Ege(e){return w.isArray(e)&&!e.some(RA)}function vge(e,t,n){if(!w.isObject(e))throw TypeError("target must be an object");t=t||new(x_||FormData),n=w.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,S){return!w.isUndefined(S[y])});let r=n.metaTokens,o=n.visitor||p,s=n.dots,i=n.indexes,a=n.Blob||typeof Blob<"u"&&Blob,c=n.maxDepth===void 0?100:n.maxDepth,l=a&&w.isSpecCompliantForm(t);if(!w.isFunction(o))throw TypeError("visitor must be a function");function u(g){if(g===null)return"";if(w.isDate(g))return g.toISOString();if(w.isBoolean(g))return g.toString();if(!l&&w.isBlob(g))throw new G("Blob is not supported. Use a Buffer instead.");if(w.isArrayBuffer(g)||w.isTypedArray(g))return l&&typeof Blob==="function"?new Blob([g]):Buffer.from(g);return g}function p(g,y,S){let b=g;if(w.isReactNative(t)&&w.isReactNativeBlob(g))return t.append(kA(S,y,s),u(g)),!1;if(g&&!S&&typeof g==="object"){if(w.endsWith(y,"{}"))y=r?y:y.slice(0,-2),g=JSON.stringify(g);else if(w.isArray(g)&&Ege(g)||(w.isFileList(g)||w.endsWith(y,"[]"))&&(b=w.toArray(g)))return y=Bz(y),b.forEach(function(v,A){!(w.isUndefined(v)||v===null)&&t.append(i===!0?kA([y],A,s):i===null?y:y+"[]",u(v))}),!1}if(RA(g))return!0;return t.append(kA(S,y,s),u(g)),!1}let f=[],m=Object.assign(xge,{defaultVisitor:p,convertValue:u,isVisitable:RA});function h(g,y,S=0){if(w.isUndefined(g))return;if(S>c)throw new G("Object is too deeply nested ("+S+" levels). Max depth: "+c,G.ERR_FORM_DATA_DEPTH_EXCEEDED);if(f.indexOf(g)!==-1)throw Error("Circular reference detected in "+y.join("."));f.push(g),w.forEach(g,function(x,v){if((!(w.isUndefined(x)||x===null)&&o.call(t,x,w.isString(v)?v.trim():v,y,m))===!0)h(x,y?y.concat(v):[v],S+1)}),f.pop()}if(!w.isObject(e))throw TypeError("data must be an object");return h(e),t}var xge,_i;var uf=O(()=>{lt();xr();CA();xge=w.toFlatObject(w,{},null,function(t){return/^is[A-Z]/.test(t)});_i=vge});function Kz(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function Gz(e,t){this._pairs=[],e&&_i(e,this,t)}var Wz,qz;var Vz=O(()=>{uf();Wz=Gz.prototype;Wz.append=function(t,n){this._pairs.push([t,n])};Wz.toString=function(t){let n=t?function(r){return t.call(this,r,Kz)}:Kz;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};qz=Gz});function wge(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function va(e,t,n){if(!t)return e;let r=n&&n.encode||wge,o=w.isFunction(n)?{serialize:n}:n,s=o&&o.serialize,i;if(s)i=s(t,o);else i=w.isURLSearchParams(t)?t.toString():new qz(t,o).toString(r);if(i){let a=e.indexOf("#");if(a!==-1)e=e.slice(0,a);e+=(e.indexOf("?")===-1?"?":"&")+i}return e}var v_=O(()=>{lt();Vz()});class Zz{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){if(this.handlers[e])this.handlers[e]=null}clear(){if(this.handlers)this.handlers=[]}forEach(e){w.forEach(this.handlers,function(n){if(n!==null)e(n)})}}var OA;var Yz=O(()=>{lt();OA=Zz});var yi;var df=O(()=>{yi={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0}});import Age from"url";var Jz;var Xz=O(()=>{Jz=Age.URLSearchParams});import Tge from"crypto";var PA="abcdefghijklmnopqrstuvwxyz",Qz="0123456789",e1,Cge=(e=16,t=e1.ALPHA_DIGIT)=>{let n="",{length:r}=t,o=new Uint32Array(e);Tge.randomFillSync(o);for(let s=0;s<e;s++)n+=t[o[s]%r];return n},t1;var n1=O(()=>{Xz();CA();e1={DIGIT:Qz,ALPHA:PA,ALPHA_DIGIT:PA+PA.toUpperCase()+Qz},t1={isNode:!0,classes:{URLSearchParams:Jz,FormData:x_,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:e1,generateString:Cge,protocols:["http","https","file","data"]}});var LA={};rn(LA,{hasBrowserEnv:()=>DA,hasStandardBrowserEnv:()=>kge,hasStandardBrowserWebWorkerEnv:()=>Rge,navigator:()=>IA,origin:()=>Oge});var DA,IA,kge,Rge,Oge;var r1=O(()=>{DA=typeof window<"u"&&typeof document<"u",IA=typeof navigator==="object"&&navigator||void 0,kge=DA&&(!IA||["ReactNative","NativeScript","NS"].indexOf(IA.product)<0),Rge=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function")(),Oge=DA&&window.location.href||"http://localhost"});var Ve;var go=O(()=>{n1();r1();Ve={...LA,...t1}});function MA(e,t){return _i(e,new Ve.classes.URLSearchParams,{visitor:function(n,r,o,s){if(Ve.isNode&&w.isBuffer(n))return this.append(r,n.toString("base64")),!1;return s.defaultVisitor.apply(this,arguments)},...t})}var o1=O(()=>{lt();uf();go()});function Pge(e){return w.matchAll(/\w+|\[(\w*)]/g,e).map((t)=>t[0]==="[]"?"":t[1]||t[0])}function Ige(e){let t={},n=Object.keys(e),r,o=n.length,s;for(r=0;r<o;r++)s=n[r],t[s]=e[s];return t}function Dge(e){function t(n,r,o,s){let i=n[s++];if(i==="__proto__")return!0;let a=Number.isFinite(+i),c=s>=n.length;if(i=!i&&w.isArray(o)?o.length:i,c){if(w.hasOwnProp(o,i))o[i]=w.isArray(o[i])?o[i].concat(r):[o[i],r];else o[i]=r;return!a}if(!o[i]||!w.isObject(o[i]))o[i]=[];if(t(n,r,o[i],s)&&w.isArray(o[i]))o[i]=Ige(o[i]);return!a}if(w.isFormData(e)&&w.isFunction(e.entries)){let n={};return w.forEachEntry(e,(r,o)=>{t(Pge(r),o,n,0)}),n}return null}var w_;var NA=O(()=>{lt();w_=Dge});function Lge(e,t,n){if(w.isString(e))try{return(t||JSON.parse)(e),w.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}var Gl=(e,t)=>e!=null&&w.hasOwnProp(e,t)?e[t]:void 0,UA,Wl;var A_=O(()=>{lt();xr();df();uf();o1();go();NA();UA={transitional:yi,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){let r=n.getContentType()||"",o=r.indexOf("application/json")>-1,s=w.isObject(t);if(s&&w.isHTMLForm(t))t=new FormData(t);if(w.isFormData(t))return o?JSON.stringify(w_(t)):t;if(w.isArrayBuffer(t)||w.isBuffer(t)||w.isStream(t)||w.isFile(t)||w.isBlob(t)||w.isReadableStream(t))return t;if(w.isArrayBufferView(t))return t.buffer;if(w.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(s){let c=Gl(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return MA(t,c).toString();if((a=w.isFileList(t))||r.indexOf("multipart/form-data")>-1){let l=Gl(this,"env"),u=l&&l.FormData;return _i(a?{"files[]":t}:t,u&&new u,c)}}if(s||o)return n.setContentType("application/json",!1),Lge(t);return t}],transformResponse:[function(t){let n=Gl(this,"transitional")||UA.transitional,r=n&&n.forcedJSONParsing,o=Gl(this,"responseType"),s=o==="json";if(w.isResponse(t)||w.isReadableStream(t))return t;if(t&&w.isString(t)&&(r&&!o||s)){let a=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,Gl(this,"parseReviver"))}catch(c){if(a){if(c.name==="SyntaxError")throw G.from(c,G.ERR_BAD_RESPONSE,this,null,Gl(this,"response"));throw c}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ve.classes.FormData,Blob:Ve.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};w.forEach(["delete","get","head","post","put","patch"],(e)=>{UA.headers[e]={}});Wl=UA});var Mge,s1=(e)=>{let t={},n,r,o;return e&&e.split(`
66
- `).forEach(function(i){if(o=i.indexOf(":"),n=i.substring(0,o).trim().toLowerCase(),r=i.substring(o+1).trim(),!n||t[n]&&Mge[n])return;if(n==="set-cookie")if(t[n])t[n].push(r);else t[n]=[r];else t[n]=t[n]?t[n]+", "+r:r}),t};var i1=O(()=>{lt();Mge=w.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"])});function Uge(e){let t=0,n=e.length;while(t<n){let r=e.charCodeAt(t);if(r!==9&&r!==32)break;t+=1}while(n>t){let r=e.charCodeAt(n-1);if(r!==9&&r!==32)break;n-=1}return t===0&&n===e.length?e:e.slice(t,n)}function pf(e){return e&&String(e).trim().toLowerCase()}function Fge(e){return Uge(e.replace(Nge,""))}function T_(e){if(e===!1||e==null)return e;return w.isArray(e)?e.map(T_):Fge(String(e))}function jge(e){let t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;while(r=n.exec(e))t[r[1]]=r[2];return t}function FA(e,t,n,r,o){if(w.isFunction(r))return r.call(this,t,n);if(o)t=n;if(!w.isString(t))return;if(w.isString(r))return t.indexOf(r)!==-1;if(w.isRegExp(r))return r.test(t)}function zge(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Hge(e,t){let n=w.toCamelCase(" "+t);["get","set","has"].forEach((r)=>{Object.defineProperty(e,r+n,{value:function(o,s,i){return this[r].call(this,t,o,s,i)},configurable:!0})})}var a1,Nge,$ge=(e)=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()),ff,Rt;var Yo=O(()=>{lt();i1();a1=Symbol("internals"),Nge=/[^\x09\x20-\x7E\x80-\xFF]/g;ff=class ff{constructor(e){e&&this.set(e)}set(e,t,n){let r=this;function o(i,a,c){let l=pf(a);if(!l)throw Error("header name must be a non-empty string");let u=w.findKey(r,l);if(!u||r[u]===void 0||c===!0||c===void 0&&r[u]!==!1)r[u||a]=T_(i)}let s=(i,a)=>w.forEach(i,(c,l)=>o(c,l,a));if(w.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(w.isString(e)&&(e=e.trim())&&!$ge(e))s(s1(e),t);else if(w.isObject(e)&&w.isIterable(e)){let i={},a,c;for(let l of e){if(!w.isArray(l))throw TypeError("Object iterator must return a key-value pair");i[c=l[0]]=(a=i[c])?w.isArray(a)?[...a,l[1]]:[a,l[1]]:l[1]}s(i,t)}else e!=null&&o(t,e,n);return this}get(e,t){if(e=pf(e),e){let n=w.findKey(this,e);if(n){let r=this[n];if(!t)return r;if(t===!0)return jge(r);if(w.isFunction(t))return t.call(this,r,n);if(w.isRegExp(t))return t.exec(r);throw TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=pf(e),e){let n=w.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||FA(this,this[n],n,t)))}return!1}delete(e,t){let n=this,r=!1;function o(s){if(s=pf(s),s){let i=w.findKey(n,s);if(i&&(!t||FA(n,n[i],i,t)))delete n[i],r=!0}}if(w.isArray(e))e.forEach(o);else o(e);return r}clear(e){let t=Object.keys(this),n=t.length,r=!1;while(n--){let o=t[n];if(!e||FA(this,this[o],o,e,!0))delete this[o],r=!0}return r}normalize(e){let t=this,n={};return w.forEach(this,(r,o)=>{let s=w.findKey(n,o);if(s){t[s]=T_(r),delete t[o];return}let i=e?zge(o):String(o).trim();if(i!==o)delete t[o];t[i]=T_(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return w.forEach(this,(n,r)=>{n!=null&&n!==!1&&(t[r]=e&&w.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
67
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let n=new this(e);return t.forEach((r)=>n.set(r)),n}static accessor(e){let n=(this[a1]=this[a1]={accessors:{}}).accessors,r=this.prototype;function o(s){let i=pf(s);if(!n[i])Hge(r,s),n[i]=!0}return w.isArray(e)?e.forEach(o):o(e),this}};ff.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);w.reduceDescriptors(ff.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});w.freezeMethods(ff);Rt=ff});function mf(e,t){let n=this||Wl,r=t||n,o=Rt.from(r.headers),s=r.data;return w.forEach(e,function(a){s=a.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}var c1=O(()=>{lt();A_();Yo()});function hf(e){return!!(e&&e.__CANCEL__)}var l1,vr;var wa=O(()=>{xr();l1=class l1 extends G{constructor(e,t,n){super(e==null?"canceled":e,G.ERR_CANCELED,t,n);this.name="CanceledError",this.__CANCEL__=!0}};vr=l1});function Jo(e,t,n){let r=n.config.validateStatus;if(!n.status||!r||r(n.status))e(n);else t(new G("Request failed with status code "+n.status,[G.ERR_BAD_REQUEST,G.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}var C_=O(()=>{xr()});function jA(e){if(typeof e!=="string")return!1;return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function $A(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Aa(e,t,n){let r=!jA(t);if(e&&(r||n===!1))return $A(e,t);return t}var k_=()=>{};function Kge(e){try{return new URL(e)}catch{return null}}function u1(e){var t=(typeof e==="string"?Kge(e):e)||{},n=t.protocol,r=t.host,o=t.port;if(typeof r!=="string"||!r||typeof n!=="string")return"";if(n=n.split(":",1)[0],r=r.replace(/:\d*$/,""),o=parseInt(o)||Bge[n]||0,!Gge(r,o))return"";var s=zA(n+"_proxy")||zA("all_proxy");if(s&&s.indexOf("://")===-1)s=n+"://"+s;return s}function Gge(e,t){var n=zA("no_proxy").toLowerCase();if(!n)return!0;if(n==="*")return!1;return n.split(/[,\s]/).every(function(r){if(!r)return!0;var o=r.match(/^(.+):(\d+)$/),s=o?o[1]:r,i=o?parseInt(o[2]):0;if(i&&i!==t)return!0;if(!/^[.*]/.test(s))return e!==s;if(s.charAt(0)==="*")s=s.slice(1);return!e.endsWith(s)})}function zA(e){return process.env[e.toLowerCase()]||process.env[e.toUpperCase()]||""}var Bge;var d1=O(()=>{Bge={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443}});var f1=T(function(TSt,p1){var ql=1000,Vl=ql*60,Zl=Vl*60,Ta=Zl*24,Wge=Ta*7,qge=Ta*365.25;p1.exports=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return Vge(e);else if(n==="number"&&isFinite(e))return t.long?Yge(e):Zge(e);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Vge(e){if(e=String(e),e.length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*qge;case"weeks":case"week":case"w":return n*Wge;case"days":case"day":case"d":return n*Ta;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Zl;case"minutes":case"minute":case"mins":case"min":case"m":return n*Vl;case"seconds":case"second":case"secs":case"sec":case"s":return n*ql;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}function Zge(e){var t=Math.abs(e);if(t>=Ta)return Math.round(e/Ta)+"d";if(t>=Zl)return Math.round(e/Zl)+"h";if(t>=Vl)return Math.round(e/Vl)+"m";if(t>=ql)return Math.round(e/ql)+"s";return e+"ms"}function Yge(e){var t=Math.abs(e);if(t>=Ta)return R_(e,t,Ta,"day");if(t>=Zl)return R_(e,t,Zl,"hour");if(t>=Vl)return R_(e,t,Vl,"minute");if(t>=ql)return R_(e,t,ql,"second");return e+" ms"}function R_(e,t,n,r){var o=t>=n*1.5;return Math.round(e/n)+" "+r+(o?"s":"")}});var HA=T(function(CSt,m1){function Jge(e){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=f1(),n.destroy=l,Object.keys(e).forEach((u)=>{n[u]=e[u]}),n.names=[],n.skips=[],n.formatters={};function t(u){let p=0;for(let f=0;f<u.length;f++)p=(p<<5)-p+u.charCodeAt(f),p|=0;return n.colors[Math.abs(p)%n.colors.length]}n.selectColor=t;function n(u){let p,f=null,m,h;function g(...y){if(!g.enabled)return;let S=g,b=Number(new Date),x=b-(p||b);if(S.diff=x,S.prev=p,S.curr=b,p=b,y[0]=n.coerce(y[0]),typeof y[0]!=="string")y.unshift("%O");let v=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(U,D)=>{if(U==="%%")return"%";v++;let F=n.formatters[D];if(typeof F==="function"){let K=y[v];U=F.call(S,K),y.splice(v,1),v--}return U}),n.formatArgs.call(S,y),(S.log||n.log).apply(S,y)}if(g.namespace=u,g.useColors=n.useColors(),g.color=n.selectColor(u),g.extend=r,g.destroy=n.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(f!==null)return f;if(m!==n.namespaces)m=n.namespaces,h=n.enabled(u);return h},set:(y)=>{f=y}}),typeof n.init==="function")n.init(g);return g}function r(u,p){let f=n(this.namespace+(typeof p>"u"?":":p)+u);return f.log=this.log,f}function o(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let p=(typeof u==="string"?u:"").trim().replace(" ",",").split(",").filter(Boolean);for(let f of p)if(f[0]==="-")n.skips.push(f.slice(1));else n.names.push(f)}function s(u,p){let f=0,m=0,h=-1,g=0;while(f<u.length)if(m<p.length&&(p[m]===u[f]||p[m]==="*"))if(p[m]==="*")h=m,g=f,m++;else f++,m++;else if(h!==-1)m=h+1,g++,f=g;else return!1;while(m<p.length&&p[m]==="*")m++;return m===p.length}function i(){let u=[...n.names,...n.skips.map((p)=>"-"+p)].join(",");return n.enable(""),u}function a(u){for(let p of n.skips)if(s(u,p))return!1;for(let p of n.names)if(s(u,p))return!0;return!1}function c(u){if(u instanceof Error)return u.stack||u.message;return u}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}m1.exports=Jge});var g1=T(function(h1,P_){h1.formatArgs=Qge;h1.save=e_e;h1.load=t_e;h1.useColors=Xge;h1.storage=n_e();h1.destroy=(()=>{let e=!1;return()=>{if(!e)e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();h1.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Xge(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Qge(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+P_.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let n=0,r=0;e[0].replace(/%[a-zA-Z%]/g,(o)=>{if(o==="%%")return;if(n++,o==="%c")r=n}),e.splice(r,0,t)}h1.log=console.debug||console.log||(()=>{});function e_e(e){try{if(e)h1.storage.setItem("debug",e);else h1.storage.removeItem("debug")}catch(t){}}function t_e(){let e;try{e=h1.storage.getItem("debug")}catch(t){}if(!e&&typeof process<"u"&&"env"in process)e=process.env.DEBUG;return e}function n_e(){try{return localStorage}catch(e){}}P_.exports=HA()(h1);var{formatters:r_e}=P_.exports;r_e.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var y1=T(function(RSt,_1){_1.exports=(e,t=process.argv)=>{let n=e.startsWith("-")?"":e.length===1?"-":"--",r=t.indexOf(n+e),o=t.indexOf("--");return r!==-1&&(o===-1||r<o)}});var E1=T(function(OSt,S1){var d_e=ue("os"),b1=ue("tty"),$r=y1(),{env:cn}=process,I_;if($r("no-color")||$r("no-colors")||$r("color=false")||$r("color=never"))I_=0;else if($r("color")||$r("colors")||$r("color=true")||$r("color=always"))I_=1;function p_e(){if("FORCE_COLOR"in cn){if(cn.FORCE_COLOR==="true")return 1;if(cn.FORCE_COLOR==="false")return 0;return cn.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(cn.FORCE_COLOR,10),3)}}function f_e(e){if(e===0)return!1;return{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function m_e(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let r=p_e();if(r!==void 0)I_=r;let o=n?I_:r;if(o===0)return 0;if(n){if($r("color=16m")||$r("color=full")||$r("color=truecolor"))return 3;if($r("color=256"))return 2}if(e&&!t&&o===void 0)return 0;let s=o||0;if(cn.TERM==="dumb")return s;if(process.platform==="win32"){let i=d_e.release().split(".");if(Number(i[0])>=10&&Number(i[2])>=10586)return Number(i[2])>=14931?3:2;return 1}if("CI"in cn){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some((i)=>(i in cn))||cn.CI_NAME==="codeship")return 1;return s}if("TEAMCITY_VERSION"in cn)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(cn.TEAMCITY_VERSION)?1:0;if(cn.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in cn){let i=Number.parseInt((cn.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(cn.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(cn.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(cn.TERM))return 1;if("COLORTERM"in cn)return 1;return s}function BA(e,t={}){let n=m_e(e,{streamIsTTY:e&&e.isTTY,...t});return f_e(n)}S1.exports={supportsColor:BA,stdout:BA({isTTY:b1.isatty(1)}),stderr:BA({isTTY:b1.isatty(2)})}});var A1=T(function(v1,L_){var h_e=ue("tty"),D_=ue("util");v1.init=x_e;v1.log=b_e;v1.formatArgs=__e;v1.save=S_e;v1.load=E_e;v1.useColors=g_e;v1.destroy=D_.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");v1.colors=[6,2,3,4,5,1];try{let e=E1();if(e&&(e.stderr||e).level>=2)v1.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(e){}v1.inspectOpts=Object.keys(process.env).filter((e)=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(o,s)=>s.toUpperCase()),r=process.env[t];if(/^(yes|on|true|enabled)$/i.test(r))r=!0;else if(/^(no|off|false|disabled)$/i.test(r))r=!1;else if(r==="null")r=null;else r=Number(r);return e[n]=r,e},{});function g_e(){return"colors"in v1.inspectOpts?Boolean(v1.inspectOpts.colors):h_e.isatty(process.stderr.fd)}function __e(e){let{namespace:t,useColors:n}=this;if(n){let r=this.color,o="\x1B[3"+(r<8?r:"8;5;"+r),s=` ${o};1m${t} \x1B[0m`;e[0]=s+e[0].split(`
68
- `).join(`
69
- `+s),e.push(o+"m+"+L_.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=y_e()+t+" "+e[0]}function y_e(){if(v1.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function b_e(...e){return process.stderr.write(D_.formatWithOptions(v1.inspectOpts,...e)+`
70
- `)}function S_e(e){if(e)process.env.DEBUG=e;else delete process.env.DEBUG}function E_e(){return process.env.DEBUG}function x_e(e){e.inspectOpts={};let t=Object.keys(v1.inspectOpts);for(let n=0;n<t.length;n++)e.inspectOpts[t[n]]=v1.inspectOpts[t[n]]}L_.exports=HA()(v1);var{formatters:x1}=L_.exports;x1.o=function(e){return this.inspectOpts.colors=this.useColors,D_.inspect(e,this.inspectOpts).split(`
71
- `).map((t)=>t.trim()).join(" ")};x1.O=function(e){return this.inspectOpts.colors=this.useColors,D_.inspect(e,this.inspectOpts)}});var T1=T(function(ISt,KA){if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)KA.exports=g1();else KA.exports=A1()});var k1=T(function(DSt,C1){var gf;C1.exports=function(){if(!gf){try{gf=T1()("follow-redirects")}catch(e){}if(typeof gf!=="function")gf=function(){}}gf.apply(null,arguments)}});var D1=T(function(LSt,nT){var yf=ue("url"),_f=yf.URL,O_e=ue("http"),P_e=ue("https"),ZA=ue("stream").Writable,YA=ue("assert"),R1=k1();(function(){var t=typeof process<"u",n=typeof window<"u"&&typeof document<"u",r=Ra(Error.captureStackTrace);if(!t&&(n||!r))console.warn("The follow-redirects package should be excluded from browser builds.")})();var JA=!1;try{YA(new _f(""))}catch(e){JA=e.code==="ERR_INVALID_URL"}var I_e=["Authorization","Proxy-Authorization","Cookie"],D_e=["auth","host","hostname","href","path","pathname","port","protocol","query","search","hash"],XA=["abort","aborted","connect","error","socket","timeout"],QA=Object.create(null);XA.forEach(function(e){QA[e]=function(t,n,r){this._redirectable.emit(e,t,n,r)}});var WA=bf("ERR_INVALID_URL","Invalid URL",TypeError),qA=bf("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),L_e=bf("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",qA),M_e=bf("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),N_e=bf("ERR_STREAM_WRITE_AFTER_END","write after end"),U_e=ZA.prototype.destroy||P1;function Xn(e,t){if(ZA.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t)this.on("response",t);var n=this;this._onNativeResponse=function(r){try{n._processResponse(r)}catch(o){n.emit("error",o instanceof qA?o:new qA({cause:o}))}},this._headerFilter=new RegExp("^(?:"+I_e.concat(e.sensitiveHeaders).map(B_e).join("|")+")$","i"),this._performRequest()}Xn.prototype=Object.create(ZA.prototype);Xn.prototype.abort=function(){tT(this._currentRequest),this._currentRequest.abort(),this.emit("abort")};Xn.prototype.destroy=function(e){return tT(this._currentRequest,e),U_e.call(this,e),this};Xn.prototype.write=function(e,t,n){if(this._ending)throw new N_e;if(!ka(e)&&!z_e(e))throw TypeError("data should be a string, Buffer or Uint8Array");if(Ra(t))n=t,t=null;if(e.length===0){if(n)n();return}if(this._requestBodyLength+e.length<=this._options.maxBodyLength)this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,n);else this.emit("error",new M_e),this.abort()};Xn.prototype.end=function(e,t,n){if(Ra(e))n=e,e=t=null;else if(Ra(t))n=t,t=null;if(!e)this._ended=this._ending=!0,this._currentRequest.end(null,null,n);else{var r=this,o=this._currentRequest;this.write(e,t,function(){r._ended=!0,o.end(null,null,n)}),this._ending=!0}};Xn.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)};Xn.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)};Xn.prototype.setTimeout=function(e,t){var n=this;function r(i){i.setTimeout(e),i.removeListener("timeout",i.destroy),i.addListener("timeout",i.destroy)}function o(i){if(n._timeout)clearTimeout(n._timeout);n._timeout=setTimeout(function(){n.emit("timeout"),s()},e),r(i)}function s(){if(n._timeout)clearTimeout(n._timeout),n._timeout=null;if(n.removeListener("abort",s),n.removeListener("error",s),n.removeListener("response",s),n.removeListener("close",s),t)n.removeListener("timeout",t);if(!n.socket)n._currentRequest.removeListener("socket",o)}if(t)this.on("timeout",t);if(this.socket)o(this.socket);else this._currentRequest.once("socket",o);return this.on("socket",r),this.on("abort",s),this.on("error",s),this.on("response",s),this.on("close",s),this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(e){Xn.prototype[e]=function(t,n){return this._currentRequest[e](t,n)}});["aborted","connection","socket"].forEach(function(e){Object.defineProperty(Xn.prototype,e,{get:function(){return this._currentRequest[e]}})});Xn.prototype._sanitizeOptions=function(e){if(!e.headers)e.headers={};if(!$_e(e.sensitiveHeaders))e.sensitiveHeaders=[];if(e.host){if(!e.hostname)e.hostname=e.host;delete e.host}if(!e.pathname&&e.path){var t=e.path.indexOf("?");if(t<0)e.pathname=e.path;else e.pathname=e.path.substring(0,t),e.search=e.path.substring(t)}};Xn.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(!t)throw TypeError("Unsupported protocol "+e);if(this._options.agents){var n=e.slice(0,-1);this._options.agent=this._options.agents[n]}var r=this._currentRequest=t.request(this._options,this._onNativeResponse);r._redirectable=this;for(var o of XA)r.on(o,QA[o]);if(this._currentUrl=/^\//.test(this._options.path)?yf.format(this._options):this._options.path,this._isRedirect){var s=0,i=this,a=this._requestBodyBuffers;(function c(l){if(r===i._currentRequest){if(l)i.emit("error",l);else if(s<a.length){var u=a[s++];if(!r.finished)r.write(u.data,u.encoding,c)}else if(i._ended)r.end()}})()}};Xn.prototype._processResponse=function(e){var t=e.statusCode;if(this._options.trackRedirects)this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var n=e.headers.location;if(!n||this._options.followRedirects===!1||t<300||t>=400){e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),this._requestBodyBuffers=[];return}if(tT(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)throw new L_e;var r,o=this._options.beforeRedirect;if(o)r=Object.assign({Host:e.req.getHeader("host")},this._options.headers);var s=this._options.method;if((t===301||t===302)&&this._options.method==="POST"||t===303&&!/^(?:GET|HEAD)$/.test(this._options.method))this._options.method="GET",this._requestBodyBuffers=[],GA(/^content-/i,this._options.headers);var i=GA(/^host$/i,this._options.headers),a=eT(this._currentUrl),c=i||a.host,l=/^\w+:/.test(n)?this._currentUrl:yf.format(Object.assign(a,{host:c})),u=F_e(n,l);if(R1("redirecting to",u.href),this._isRedirect=!0,VA(u,this._options),u.protocol!==a.protocol&&u.protocol!=="https:"||u.host!==c&&!j_e(u.host,c))GA(this._headerFilter,this._options.headers);if(Ra(o)){var p={headers:e.headers,statusCode:t},f={url:l,method:s,headers:r};o(this._options,p,f),this._sanitizeOptions(this._options)}this._performRequest()};function O1(e){var t={maxRedirects:21,maxBodyLength:10485760},n={};return Object.keys(e).forEach(function(r){var o=r+":",s=n[o]=e[r],i=t[r]=Object.create(s);function a(l,u,p){if(H_e(l))l=VA(l);else if(ka(l))l=VA(eT(l));else p=u,u=I1(l),l={protocol:o};if(Ra(u))p=u,u=null;if(u=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},l,u),u.nativeProtocols=n,!ka(u.host)&&!ka(u.hostname))u.hostname="::1";return YA.equal(u.protocol,o,"protocol mismatch"),R1("options",u),new Xn(u,p)}function c(l,u,p){var f=i.request(l,u,p);return f.end(),f}Object.defineProperties(i,{request:{value:a,configurable:!0,enumerable:!0,writable:!0},get:{value:c,configurable:!0,enumerable:!0,writable:!0}})}),t}function P1(){}function eT(e){var t;if(JA)t=new _f(e);else if(t=I1(yf.parse(e)),!ka(t.protocol))throw new WA({input:e});return t}function F_e(e,t){return JA?new _f(e,t):eT(yf.resolve(t,e))}function I1(e){if(/^\[/.test(e.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(e.hostname))throw new WA({input:e.href||e});if(/^\[/.test(e.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(e.host))throw new WA({input:e.href||e});return e}function VA(e,t){var n=t||{};for(var r of D_e)n[r]=e[r];if(n.hostname.startsWith("["))n.hostname=n.hostname.slice(1,-1);if(n.port!=="")n.port=Number(n.port);return n.path=n.search?n.pathname+n.search:n.pathname,n}function GA(e,t){var n;for(var r in t)if(e.test(r))n=t[r],delete t[r];return n===null||typeof n>"u"?void 0:String(n).trim()}function bf(e,t,n){function r(o){if(Ra(Error.captureStackTrace))Error.captureStackTrace(this,this.constructor);Object.assign(this,o||{}),this.code=e,this.message=this.cause?t+": "+this.cause.message:t}return r.prototype=Object.create((n||Error).prototype),Object.defineProperties(r.prototype,{constructor:{value:r,enumerable:!1},name:{value:"Error ["+e+"]",enumerable:!1}}),r}function tT(e,t){for(var n of XA)e.removeListener(n,QA[n]);e.on("error",P1),e.destroy(t)}function j_e(e,t){YA(ka(e)&&ka(t));var n=e.length-t.length-1;return n>0&&e[n]==="."&&e.endsWith(t)}function $_e(e){return e instanceof Array}function ka(e){return typeof e==="string"||e instanceof String}function Ra(e){return typeof e==="function"}function z_e(e){return typeof e==="object"&&"length"in e}function H_e(e){return _f&&e instanceof _f}function B_e(e){return e.replace(/[\]\\/()*+?.$]/g,"\\$&")}nT.exports=O1({http:O_e,https:P_e});nT.exports.wrap=O1});var Oa="1.15.2";function Sf(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function rT(e,t,n){let r=n&&n.Blob||Ve.classes.Blob,o=Sf(e);if(t===void 0&&r)t=!0;if(o==="data"){e=o.length?e.slice(o.length+1):e;let s=K_e.exec(e);if(!s)throw new G("Invalid URL",G.ERR_INVALID_URL);let i=s[1],a=s[2],c=s[3],l=Buffer.from(decodeURIComponent(c),a?"base64":"utf8");if(t){if(!r)throw new G("Blob is not supported",G.ERR_NOT_SUPPORT);return new r([l],{type:i})}return l}throw new G("Unsupported protocol "+o,G.ERR_NOT_SUPPORT)}var K_e;var L1=O(()=>{xr();go();K_e=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/});import G_e from"stream";var oT,M1,sT;var N1=O(()=>{lt();oT=Symbol("internals");M1=class M1 extends G_e.Transform{constructor(e){e=w.toFlatObject(e,{maxRate:0,chunkSize:65536,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(n,r)=>!w.isUndefined(r[n]));super({readableHighWaterMark:e.chunkSize});let t=this[oT]={timeWindow:e.timeWindow,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",(n)=>{if(n==="progress"){if(!t.isCaptured)t.isCaptured=!0}})}_read(e){let t=this[oT];if(t.onReadCallback)t.onReadCallback();return super._read(e)}_transform(e,t,n){let r=this[oT],o=r.maxRate,s=this.readableHighWaterMark,i=r.timeWindow,a=1000/i,c=o/a,l=r.minChunkSize!==!1?Math.max(r.minChunkSize,c*0.01):0,u=(f,m)=>{let h=Buffer.byteLength(f);if(r.bytesSeen+=h,r.bytes+=h,r.isCaptured&&this.emit("progress",r.bytesSeen),this.push(f))process.nextTick(m);else r.onReadCallback=()=>{r.onReadCallback=null,process.nextTick(m)}},p=(f,m)=>{let h=Buffer.byteLength(f),g=null,y=s,S,b=0;if(o){let x=Date.now();if(!r.ts||(b=x-r.ts)>=i)r.ts=x,S=c-r.bytes,r.bytes=S<0?-S:0,b=0;S=c-r.bytes}if(o){if(S<=0)return setTimeout(()=>{m(null,f)},i-b);if(S<y)y=S}if(y&&h>y&&h-y>l)g=f.subarray(y),f=f.subarray(0,y);u(f,g?()=>{process.nextTick(m,null,g)}:m)};p(e,function f(m,h){if(m)return n(m);if(h)p(h,f);else n(null)})}};sT=M1});var U1,W_e=async function*(e){if(e.stream)yield*e.stream();else if(e.arrayBuffer)yield await e.arrayBuffer();else if(e[U1])yield*e[U1]();else yield e},M_;var iT=O(()=>{({asyncIterator:U1}=Symbol),M_=W_e});import q_e from"util";import{Readable as V_e}from"stream";class F1{constructor(e,t){let{escapeName:n}=this.constructor,r=w.isString(t),o=`Content-Disposition: form-data; name="${n(e)}"${!r&&t.name?`; filename="${n(t.name)}"`:""}${Pa}`;if(r)t=Ef.encode(String(t).replace(/\r?\n|\r\n?/g,Pa));else{let s=String(t.type||"application/octet-stream").replace(/[\r\n]/g,"");o+=`Content-Type: ${s}${Pa}`}this.headers=Ef.encode(o+Pa),this.contentLength=r?t.byteLength:t.size,this.size=this.headers.byteLength+this.contentLength+J_e,this.name=e,this.value=t}async*encode(){yield this.headers;let{value:e}=this;if(w.isTypedArray(e))yield e;else yield*M_(e);yield Y_e}static escapeName(e){return String(e).replace(/[\r\n"]/g,(t)=>({"\r":"%0D","\n":"%0A",'"':"%22"})[t])}}var Z_e,Ef,Pa=`\r
72
- `,Y_e,J_e=2,X_e=(e,t,n)=>{let{tag:r="form-data-boundary",size:o=25,boundary:s=r+"-"+Ve.generateString(o,Z_e)}=n||{};if(!w.isFormData(e))throw TypeError("FormData instance required");if(s.length<1||s.length>70)throw Error("boundary must be 10-70 characters long");let i=Ef.encode("--"+s+Pa),a=Ef.encode("--"+s+"--"+Pa),c=a.byteLength,l=Array.from(e.entries()).map(([p,f])=>{let m=new F1(p,f);return c+=m.size,m});c+=i.byteLength*l.length,c=w.toFiniteNumber(c);let u={"Content-Type":`multipart/form-data; boundary=${s}`};if(Number.isFinite(c))u["Content-Length"]=c;return t&&t(u),V_e.from(async function*(){for(let p of l)yield i,yield*p.encode();yield a}())},j1;var $1=O(()=>{lt();iT();go();Z_e=Ve.ALPHABET.ALPHA_DIGIT+"-_",Ef=typeof TextEncoder==="function"?new TextEncoder:new q_e.TextEncoder,Y_e=Ef.encode(Pa);j1=X_e});import Q_e from"stream";var z1,H1;var B1=O(()=>{z1=class z1 extends Q_e.Transform{__transform(e,t,n){this.push(e),n()}_transform(e,t,n){if(e.length!==0){if(this._transform=this.__transform,e[0]!==120){let r=Buffer.alloc(2);r[0]=120,r[1]=156,this.push(r,t)}}this.__transform(e,t,n)}};H1=z1});var eye=(e,t)=>w.isAsyncFn(e)?function(...n){let r=n.pop();e.apply(this,n).then((o)=>{try{t?r(null,...t(o)):r(null,o)}catch(s){r(s)}},r)}:e,K1;var G1=O(()=>{lt();K1=eye});function aT(e){let t;try{t=new URL(e)}catch(s){return!1}let n=(process.env.no_proxy||process.env.NO_PROXY||"").toLowerCase();if(!n)return!1;if(n==="*")return!0;let r=Number.parseInt(t.port,10)||rye[t.protocol.split(":",1)[0]]||0,o=q1(t.hostname.toLowerCase());return n.split(/[\s,]+/).some((s)=>{if(!s)return!1;let[i,a]=oye(s);if(i=q1(i),!i)return!1;if(a&&a!==r)return!1;if(i.charAt(0)==="*")i=i.slice(1);if(i.charAt(0)===".")return o.endsWith(i);return o===i||W1(o)&&W1(i)})}var tye,V1=(e)=>{let t=e.split(".");if(t.length!==4)return!1;if(t[0]!=="127")return!1;return t.every((n)=>/^\d+$/.test(n)&&Number(n)>=0&&Number(n)<=255)},nye=(e)=>{if(e==="::1")return!0;let t=e.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/i);if(t)return V1(t[1]);let n=e.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i);if(n){let o=parseInt(n[1],16);return o>=32512&&o<=32767}let r=e.split(":");if(r.length===8){for(let o=0;o<7;o++)if(!/^0+$/.test(r[o]))return!1;return/^0*1$/.test(r[7])}return!1},W1=(e)=>{if(!e)return!1;if(tye.has(e))return!0;if(V1(e))return!0;return nye(e)},rye,oye=(e)=>{let t=e,n=0;if(t.charAt(0)==="["){let s=t.indexOf("]");if(s!==-1){let i=t.slice(1,s),a=t.slice(s+1);if(a.charAt(0)===":"&&/^\d+$/.test(a.slice(1)))n=Number.parseInt(a.slice(1),10);return[i,n]}}let r=t.indexOf(":"),o=t.lastIndexOf(":");if(r!==-1&&r===o&&/^\d+$/.test(t.slice(o+1)))n=Number.parseInt(t.slice(o+1),10),t=t.slice(0,o);return[t,n]},q1=(e)=>{if(!e)return e;if(e.charAt(0)==="["&&e.charAt(e.length-1)==="]")e=e.slice(1,-1);return e.replace(/\.+$/,"")};var Z1=O(()=>{tye=new Set(["localhost"]),rye={http:80,https:443,ws:80,wss:443,ftp:21}});function sye(e,t){e=e||10;let n=Array(e),r=Array(e),o=0,s=0,i;return t=t!==void 0?t:1000,function(c){let l=Date.now(),u=r[s];if(!i)i=l;n[o]=c,r[o]=l;let p=s,f=0;while(p!==o)f+=n[p++],p=p%e;if(o=(o+1)%e,o===s)s=(s+1)%e;if(l-i<t)return;let m=u&&l-u;return m?Math.round(f*1000/m):void 0}}var Y1;var J1=O(()=>{Y1=sye});function iye(e,t){let n=0,r=1000/t,o,s,i=(l,u=Date.now())=>{if(n=u,o=null,s)clearTimeout(s),s=null;e(...l)};return[(...l)=>{let u=Date.now(),p=u-n;if(p>=r)i(l,u);else if(o=l,!s)s=setTimeout(()=>{s=null,i(o)},r-p)},()=>o&&i(o)]}var X1;var Q1=O(()=>{X1=iye});var Es=(e,t,n=3)=>{let r=0,o=Y1(50,250);return X1((s)=>{let i=s.loaded,a=s.lengthComputable?s.total:void 0,c=a!=null?Math.min(i,a):i,l=Math.max(0,c-r),u=o(l);r=Math.max(r,c);let p={loaded:c,total:a,progress:a?c/a:void 0,bytes:l,rate:u?u:void 0,estimated:u&&a?(a-c)/u:void 0,event:s,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(p)},n)},Yl=(e,t)=>{let n=e!=null;return[(r)=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Jl=(e)=>(...t)=>w.asap(()=>e(...t));var N_=O(()=>{J1();Q1();lt()});function cT(e){if(!e||typeof e!=="string")return 0;if(!e.startsWith("data:"))return 0;let t=e.indexOf(",");if(t<0)return 0;let n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let{length:s,length:i}=r;for(let f=0;f<i;f++)if(r.charCodeAt(f)===37&&f+2<i){let m=r.charCodeAt(f+1),h=r.charCodeAt(f+2);if((m>=48&&m<=57||m>=65&&m<=70||m>=97&&m<=102)&&(h>=48&&h<=57||h>=65&&h<=70||h>=97&&h<=102))s-=2,f+=2}let a=0,c=i-1,l=(f)=>f>=2&&r.charCodeAt(f-2)===37&&r.charCodeAt(f-1)===51&&(r.charCodeAt(f)===68||r.charCodeAt(f)===100);if(c>=0){if(r.charCodeAt(c)===61)a++,c--;else if(l(c))a++,c-=3}if(a===1&&c>=0){if(r.charCodeAt(c)===61)a++;else if(l(c))a++}let p=Math.floor(s/4)*3-(a||0);return p>0?p:0}return Buffer.byteLength(r,"utf8")}import aye from"http";import cye from"https";import aH from"http2";import cH from"util";import{resolve as eH}from"path";import bi from"zlib";import _o from"stream";import{EventEmitter as lye}from"events";class uH{constructor(){this.sessions=Object.create(null)}getSession(e,t){t=Object.assign({sessionTimeout:1000},t);let n=this.sessions[e];if(n){let l=n.length;for(let u=0;u<l;u++){let[p,f]=n[u];if(!p.destroyed&&!p.closed&&cH.isDeepStrictEqual(f,t))return p}}let r=aH.connect(e,t),o,s=()=>{if(o)return;o=!0;let l=n,u=l.length,p=u;while(p--)if(l[p][0]===r){if(u===1)delete this.sessions[e];else l.splice(p,1);if(!r.closed)r.close();return}},i=r.request,{sessionTimeout:a}=t;if(a!=null){let l,u=0;r.request=function(){let p=i.apply(this,arguments);if(u++,l)clearTimeout(l),l=null;return p.once("close",()=>{if(!--u)l=setTimeout(()=>{l=null,s()},a)}),p}}r.once("close",s);let c=[r,t];return n?n.push(c):n=this.sessions[e]=[c],r}}function hye(e,t){if(e.beforeRedirects.proxy)e.beforeRedirects.proxy(e);if(e.beforeRedirects.config)e.beforeRedirects.config(e,t)}function dH(e,t,n){let r=t;if(!r&&r!==!1){let o=u1(n);if(o){if(!aT(n))r=new URL(o)}}if(r){if(r.username)r.auth=(r.username||"")+":"+(r.password||"");if(r.auth){if(Boolean(r.auth.username||r.auth.password))r.auth=(r.auth.username||"")+":"+(r.auth.password||"");else if(typeof r.auth==="object")throw new G("Invalid proxy authorization",G.ERR_BAD_OPTION,{proxy:r});let i=Buffer.from(r.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+i}e.headers.host=e.hostname+(e.port?":"+e.port:"");let o=r.hostname||r.host;if(e.hostname=o,e.host=o,e.port=r.port,e.path=n,r.protocol)e.protocol=r.protocol.includes(":")?r.protocol:`${r.protocol}:`}e.beforeRedirects.proxy=function(s){dH(s,t,s.href)}}var lH,tH,uye,nH,dye,pye,fye,rH,U_,oH,sH=(e,[t,n])=>(e.on("end",n).on("error",n),t),mye,gye,_ye=(e)=>new Promise((t,n)=>{let r,o,s=(c,l)=>{if(o)return;o=!0,r&&r(c,l)},i=(c)=>{s(c),t(c)},a=(c)=>{s(c,!0),n(c)};e(i,a,(c)=>r=c).catch(a)}),yye=({address:e,family:t})=>{if(!w.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},iH=(e,t)=>yye(w.isObject(e)?e:{address:e,family:t}),bye,pH;var fH=O(()=>{lt();C_();k_();v_();d1();df();xr();wa();go();L1();Yo();N1();$1();iT();B1();G1();Z1();N_();lH=Hn(D1(),1),tH={flush:bi.constants.Z_SYNC_FLUSH,finishFlush:bi.constants.Z_SYNC_FLUSH},uye={flush:bi.constants.BROTLI_OPERATION_FLUSH,finishFlush:bi.constants.BROTLI_OPERATION_FLUSH},nH=w.isFunction(bi.createBrotliDecompress),{http:dye,https:pye}=lH.default,fye=/https:?/,rH=Symbol("axios.http.socketListener"),U_=Symbol("axios.http.currentReq"),oH=Ve.protocols.map((e)=>e+":");mye=new uH;gye=typeof process<"u"&&w.kindOf(process)==="process",bye={request(e,t){let n=e.protocol+"//"+e.hostname+":"+(e.port||(e.protocol==="https:"?443:80)),{http2Options:r,headers:o}=e,s=mye.getSession(n,r),{HTTP2_HEADER_SCHEME:i,HTTP2_HEADER_METHOD:a,HTTP2_HEADER_PATH:c,HTTP2_HEADER_STATUS:l}=aH.constants,u={[i]:e.protocol.replace(":",""),[a]:e.method,[c]:e.path};w.forEach(o,(f,m)=>{m.charAt(0)!==":"&&(u[m]=f)});let p=s.request(u);return p.once("response",(f)=>{let m=p;f=Object.assign({},f);let h=f[l];delete f[l],m.headers=f,m.statusCode=+h,t(m)}),p}},pH=gye&&function(t){return _ye(async function(r,o,s){let i=(se)=>w.hasOwnProp(t,se)?t[se]:void 0,a=i("data"),c=i("lookup"),l=i("family"),u=i("httpVersion");if(u===void 0)u=1;let p=i("http2Options"),f=i("responseType"),m=i("responseEncoding"),h=t.method.toUpperCase(),g,y=!1,S;if(u=+u,Number.isNaN(u))throw TypeError(`Invalid protocol version: '${t.httpVersion}' is not a number`);if(u!==1&&u!==2)throw TypeError(`Unsupported protocol version '${u}'`);let b=u===2;if(c){let se=K1(c,(Q)=>w.isArray(Q)?Q:[Q]);c=(Q,te,je)=>{se(Q,te,(Re,Pt,Ut)=>{if(Re)return je(Re);let gt=w.isArray(Pt)?Pt.map((On)=>iH(On)):[iH(Pt,Ut)];te.all?je(Re,gt):je(Re,gt[0].address,gt[0].family)})}}let x=new lye;function v(se){try{x.emit("abort",!se||se.type?new vr(null,t,S):se)}catch(Q){console.warn("emit error",Q)}}x.once("abort",o);let A=()=>{if(t.cancelToken)t.cancelToken.unsubscribe(v);if(t.signal)t.signal.removeEventListener("abort",v);x.removeAllListeners()};if(t.cancelToken||t.signal){if(t.cancelToken&&t.cancelToken.subscribe(v),t.signal)t.signal.aborted?v():t.signal.addEventListener("abort",v)}s((se,Q)=>{if(g=!0,Q){y=!0,A();return}let{data:te}=se;if(te instanceof _o.Readable||te instanceof _o.Duplex){let je=_o.finished(te,()=>{je(),A()})}else A()});let U=Aa(t.baseURL,t.url,t.allowAbsoluteUrls),D=new URL(U,Ve.hasBrowserEnv?Ve.origin:void 0),F=D.protocol||oH[0];if(F==="data:"){if(t.maxContentLength>-1){let Q=String(t.url||U||"");if(cT(Q)>t.maxContentLength)return o(new G("maxContentLength size of "+t.maxContentLength+" exceeded",G.ERR_BAD_RESPONSE,t))}let se;if(h!=="GET")return Jo(r,o,{status:405,statusText:"method not allowed",headers:{},config:t});try{se=rT(t.url,f==="blob",{Blob:t.env&&t.env.Blob})}catch(Q){throw G.from(Q,G.ERR_BAD_REQUEST,t)}if(f==="text"){if(se=se.toString(m),!m||m==="utf8")se=w.stripBOM(se)}else if(f==="stream")se=_o.Readable.from(se);return Jo(r,o,{data:se,status:200,statusText:"OK",headers:new Rt,config:t})}if(oH.indexOf(F)===-1)return o(new G("Unsupported protocol "+F,G.ERR_BAD_REQUEST,t));let K=Rt.from(t.headers).normalize();K.set("User-Agent","axios/"+Oa,!1);let{onUploadProgress:V,onDownloadProgress:ne}=t,oe=t.maxRate,_e=void 0,ke=void 0;if(w.isSpecCompliantForm(a)){let se=K.getContentType(/boundary=([-_\w\d]{10,70})/i);a=j1(a,(Q)=>{K.set(Q)},{tag:`axios-${Oa}-boundary`,boundary:se&&se[1]||void 0})}else if(w.isFormData(a)&&w.isFunction(a.getHeaders)&&a.getHeaders!==Object.prototype.getHeaders){if(K.set(a.getHeaders()),!K.hasContentLength())try{let se=await cH.promisify(a.getLength).call(a);Number.isFinite(se)&&se>=0&&K.setContentLength(se)}catch(se){}}else if(w.isBlob(a)||w.isFile(a))a.size&&K.setContentType(a.type||"application/octet-stream"),K.setContentLength(a.size||0),a=_o.Readable.from(M_(a));else if(a&&!w.isStream(a)){if(Buffer.isBuffer(a));else if(w.isArrayBuffer(a))a=Buffer.from(new Uint8Array(a));else if(w.isString(a))a=Buffer.from(a,"utf-8");else return o(new G("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",G.ERR_BAD_REQUEST,t));if(K.setContentLength(a.length,!1),t.maxBodyLength>-1&&a.length>t.maxBodyLength)return o(new G("Request body larger than maxBodyLength limit",G.ERR_BAD_REQUEST,t))}let vt=w.toFiniteNumber(K.getContentLength());if(w.isArray(oe))_e=oe[0],ke=oe[1];else _e=ke=oe;if(a&&(V||_e)){if(!w.isStream(a))a=_o.Readable.from(a,{objectMode:!1});a=_o.pipeline([a,new sT({maxRate:w.toFiniteNumber(_e)})],w.noop),V&&a.on("progress",sH(a,Yl(vt,Es(Jl(V),!1,3))))}let Z=void 0,Je=i("auth");if(Je){let se=Je.username||"",Q=Je.password||"";Z=se+":"+Q}if(!Z&&D.username){let{username:se,password:Q}=D;Z=se+":"+Q}Z&&K.delete("authorization");let wt;try{wt=va(D.pathname+D.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(se){let Q=Error(se.message);return Q.config=t,Q.url=t.url,Q.exists=!0,o(Q)}K.set("Accept-Encoding","gzip, compress, deflate"+(nH?", br":""),!1);let ht=Object.assign(Object.create(null),{path:wt,method:h,headers:K.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:Z,protocol:F,family:l,beforeRedirect:hye,beforeRedirects:Object.create(null),http2Options:p});if(!w.isUndefined(c)&&(ht.lookup=c),t.socketPath){if(typeof t.socketPath!=="string")return o(new G("socketPath must be a string",G.ERR_BAD_OPTION_VALUE,t));if(t.allowedSocketPaths!=null){let se=Array.isArray(t.allowedSocketPaths)?t.allowedSocketPaths:[t.allowedSocketPaths],Q=eH(t.socketPath);if(!se.some((je)=>typeof je==="string"&&eH(je)===Q))return o(new G(`socketPath "${t.socketPath}" is not permitted by allowedSocketPaths`,G.ERR_BAD_OPTION_VALUE,t))}ht.socketPath=t.socketPath}else ht.hostname=D.hostname.startsWith("[")?D.hostname.slice(1,-1):D.hostname,ht.port=D.port,dH(ht,t.proxy,F+"//"+D.hostname+(D.port?":"+D.port:"")+ht.path);let cr,Ot=fye.test(ht.protocol);if(ht.agent=Ot?t.httpsAgent:t.httpAgent,b)cr=bye;else{let se=i("transport");if(se)cr=se;else if(t.maxRedirects===0)cr=Ot?cye:aye;else{if(t.maxRedirects)ht.maxRedirects=t.maxRedirects;let Q=i("beforeRedirect");if(Q)ht.beforeRedirects.config=Q;cr=Ot?pye:dye}}if(t.maxBodyLength>-1)ht.maxBodyLength=t.maxBodyLength;else ht.maxBodyLength=1/0;if(ht.insecureHTTPParser=Boolean(i("insecureHTTPParser")),S=cr.request(ht,function(Q){if(S.destroyed)return;let te=[Q],je=w.toFiniteNumber(Q.headers["content-length"]);if(ne||ke){let gt=new sT({maxRate:w.toFiniteNumber(ke)});ne&&gt.on("progress",sH(gt,Yl(je,Es(Jl(ne),!0,3)))),te.push(gt)}let Re=Q,Pt=Q.req||S;if(t.decompress!==!1&&Q.headers["content-encoding"]){if(h==="HEAD"||Q.statusCode===204)delete Q.headers["content-encoding"];switch((Q.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":te.push(bi.createUnzip(tH)),delete Q.headers["content-encoding"];break;case"deflate":te.push(new H1),te.push(bi.createUnzip(tH)),delete Q.headers["content-encoding"];break;case"br":if(nH)te.push(bi.createBrotliDecompress(uye)),delete Q.headers["content-encoding"]}}Re=te.length>1?_o.pipeline(te,w.noop):te[0];let Ut={status:Q.statusCode,statusText:Q.statusMessage,headers:new Rt(Q.headers),config:t,request:Pt};if(f==="stream"){if(t.maxContentLength>-1){let gt=t.maxContentLength,On=Re;async function*Gi(){let It=0;for await(let ph of On){if(It+=ph.length,It>gt)throw new G("maxContentLength size of "+gt+" exceeded",G.ERR_BAD_RESPONSE,t,Pt);yield ph}}Re=_o.Readable.from(Gi(),{objectMode:!1})}Ut.data=Re,Jo(r,o,Ut)}else{let gt=[],On=0;Re.on("data",function(It){if(gt.push(It),On+=It.length,t.maxContentLength>-1&&On>t.maxContentLength)y=!0,Re.destroy(),v(new G("maxContentLength size of "+t.maxContentLength+" exceeded",G.ERR_BAD_RESPONSE,t,Pt))}),Re.on("aborted",function(){if(y)return;let It=new G("stream has been aborted",G.ERR_BAD_RESPONSE,t,Pt);Re.destroy(It),o(It)}),Re.on("error",function(It){if(S.destroyed)return;o(G.from(It,null,t,Pt))}),Re.on("end",function(){try{let It=gt.length===1?gt[0]:Buffer.concat(gt);if(f!=="arraybuffer"){if(It=It.toString(m),!m||m==="utf8")It=w.stripBOM(It)}Ut.data=It}catch(It){return o(G.from(It,null,t,Ut.request,Ut))}Jo(r,o,Ut)})}x.once("abort",(gt)=>{if(!Re.destroyed)Re.emit("error",gt),Re.destroy()})}),x.once("abort",(se)=>{if(S.close)S.close();else S.destroy(se)}),S.on("error",function(Q){o(G.from(Q,null,t,S))}),S.on("socket",function(Q){if(Q.setKeepAlive(!0,60000),!Q[rH])Q.on("error",function(je){let Re=Q[U_];if(Re&&!Re.destroyed)Re.destroy(je)}),Q[rH]=!0;Q[U_]=S,S.once("close",function(){if(Q[U_]===S)Q[U_]=null})}),t.timeout){let se=parseInt(t.timeout,10);if(Number.isNaN(se)){v(new G("error trying to parse `config.timeout` to int",G.ERR_BAD_OPTION_VALUE,t,S));return}S.setTimeout(se,function(){if(g)return;let te=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",je=t.transitional||yi;if(t.timeoutErrorMessage)te=t.timeoutErrorMessage;v(new G(te,je.clarifyTimeoutError?G.ETIMEDOUT:G.ECONNABORTED,t,S))})}else S.setTimeout(0);if(w.isStream(a)){let se=!1,Q=!1;a.on("end",()=>{se=!0}),a.once("error",(je)=>{Q=!0,S.destroy(je)}),a.on("close",()=>{if(!se&&!Q)v(new vr("Request stream has been aborted",t,S))});let te=a;if(t.maxBodyLength>-1&&t.maxRedirects===0){let je=t.maxBodyLength,Re=0;te=_o.pipeline([a,new _o.Transform({transform(Pt,Ut,gt){if(Re+=Pt.length,Re>je)return gt(new G("Request body larger than maxBodyLength limit",G.ERR_BAD_REQUEST,t,S));gt(null,Pt)}})],w.noop),te.on("error",(Pt)=>{if(!S.destroyed)S.destroy(Pt)})}te.pipe(S)}else a&&S.write(a),S.end()})}});var mH;var hH=O(()=>{go();mH=Ve.hasStandardBrowserEnv?((e,t)=>(n)=>(n=new URL(n,Ve.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ve.origin),Ve.navigator&&/(msie|trident)/i.test(Ve.navigator.userAgent)):()=>!0});var gH;var _H=O(()=>{lt();go();gH=Ve.hasStandardBrowserEnv?{write(e,t,n,r,o,s,i){if(typeof document>"u")return;let a=[`${e}=${encodeURIComponent(t)}`];if(w.isNumber(n))a.push(`expires=${new Date(n).toUTCString()}`);if(w.isString(r))a.push(`path=${r}`);if(w.isString(o))a.push(`domain=${o}`);if(s===!0)a.push("secure");if(w.isString(i))a.push(`SameSite=${i}`);document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-86400000,"/")}}:{write(){},read(){return null},remove(){}}});function yo(e,t){t=t||{};let n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(l,u,p,f){if(w.isPlainObject(l)&&w.isPlainObject(u))return w.merge.call({caseless:f},l,u);else if(w.isPlainObject(u))return w.merge({},u);else if(w.isArray(u))return u.slice();return u}function o(l,u,p,f){if(!w.isUndefined(u))return r(l,u,p,f);else if(!w.isUndefined(l))return r(void 0,l,p,f)}function s(l,u){if(!w.isUndefined(u))return r(void 0,u)}function i(l,u){if(!w.isUndefined(u))return r(void 0,u);else if(!w.isUndefined(l))return r(void 0,l)}function a(l,u,p){if(w.hasOwnProp(t,p))return r(l,u);else if(w.hasOwnProp(e,p))return r(void 0,l)}let c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,allowedSocketPaths:i,responseEncoding:i,validateStatus:a,headers:(l,u,p)=>o(yH(l),yH(u),p,!0)};return w.forEach(Object.keys({...e,...t}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;let p=w.hasOwnProp(c,u)?c[u]:o,f=w.hasOwnProp(e,u)?e[u]:void 0,m=w.hasOwnProp(t,u)?t[u]:void 0,h=p(f,m,u);w.isUndefined(h)&&p!==a||(n[u]=h)}),n}var yH=(e)=>e instanceof Rt?{...e}:e;var F_=O(()=>{lt();Yo()});var j_=(e)=>{let t=yo({},e),n=(f)=>w.hasOwnProp(t,f)?t[f]:void 0,r=n("data"),o=n("withXSRFToken"),s=n("xsrfHeaderName"),i=n("xsrfCookieName"),a=n("headers"),c=n("auth"),l=n("baseURL"),u=n("allowAbsoluteUrls"),p=n("url");if(t.headers=a=Rt.from(a),t.url=va(Aa(l,p,u),e.params,e.paramsSerializer),c)a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));if(w.isFormData(r)){if(Ve.hasStandardBrowserEnv||Ve.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(w.isFunction(r.getHeaders)){let f=r.getHeaders(),m=["content-type","content-length"];Object.entries(f).forEach(([h,g])=>{if(m.includes(h.toLowerCase()))a.set(h,g)})}}if(Ve.hasStandardBrowserEnv){if(w.isFunction(o))o=o(t);if(o===!0||o==null&&mH(t.url)){let m=s&&i&&gH.read(i);if(m)a.set(s,m)}}return t};var lT=O(()=>{go();lt();hH();_H();k_();F_();Yo();v_()});var Sye,bH;var SH=O(()=>{lt();C_();df();xr();wa();go();Yo();N_();lT();Sye=typeof XMLHttpRequest<"u",bH=Sye&&function(e){return new Promise(function(n,r){let o=j_(e),s=o.data,i=Rt.from(o.headers).normalize(),{responseType:a,onUploadProgress:c,onDownloadProgress:l}=o,u,p,f,m,h;function g(){m&&m(),h&&h(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(o.method.toUpperCase(),o.url,!0),y.timeout=o.timeout;function S(){if(!y)return;let x=Rt.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),A={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:x,config:e,request:y};Jo(function(D){n(D),g()},function(D){r(D),g()},A),y=null}if("onloadend"in y)y.onloadend=S;else y.onreadystatechange=function(){if(!y||y.readyState!==4)return;if(y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0))return;setTimeout(S)};if(y.onabort=function(){if(!y)return;r(new G("Request aborted",G.ECONNABORTED,e,y)),y=null},y.onerror=function(v){let A=v&&v.message?v.message:"Network Error",U=new G(A,G.ERR_NETWORK,e,y);U.event=v||null,r(U),y=null},y.ontimeout=function(){let v=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",A=o.transitional||yi;if(o.timeoutErrorMessage)v=o.timeoutErrorMessage;r(new G(v,A.clarifyTimeoutError?G.ETIMEDOUT:G.ECONNABORTED,e,y)),y=null},s===void 0&&i.setContentType(null),"setRequestHeader"in y)w.forEach(i.toJSON(),function(v,A){y.setRequestHeader(A,v)});if(!w.isUndefined(o.withCredentials))y.withCredentials=!!o.withCredentials;if(a&&a!=="json")y.responseType=o.responseType;if(l)[f,h]=Es(l,!0),y.addEventListener("progress",f);if(c&&y.upload)[p,m]=Es(c),y.upload.addEventListener("progress",p),y.upload.addEventListener("loadend",m);if(o.cancelToken||o.signal){if(u=(x)=>{if(!y)return;r(!x||x.type?new vr(null,e,y):x),y.abort(),y=null},o.cancelToken&&o.cancelToken.subscribe(u),o.signal)o.signal.aborted?u():o.signal.addEventListener("abort",u)}let b=Sf(o.url);if(b&&Ve.protocols.indexOf(b)===-1){r(new G("Unsupported protocol "+b+":",G.ERR_BAD_REQUEST,e));return}y.send(s||null)})}});var Eye=(e,t)=>{let{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,o,s=function(l){if(!o){o=!0,a();let u=l instanceof Error?l:this.reason;r.abort(u instanceof G?u:new vr(u instanceof Error?u.message:u))}},i=t&&setTimeout(()=>{i=null,s(new G(`timeout of ${t}ms exceeded`,G.ETIMEDOUT))},t),a=()=>{if(e)i&&clearTimeout(i),i=null,e.forEach((l)=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),e=null};e.forEach((l)=>l.addEventListener("abort",s));let{signal:c}=r;return c.unsubscribe=()=>w.asap(a),c}},EH;var xH=O(()=>{wa();xr();lt();EH=Eye});var xye=function*(e,t){let n=e.byteLength;if(!t||n<t){yield e;return}let r=0,o;while(r<n)o=r+t,yield e.slice(r,o),r=o},vye=async function*(e,t){for await(let n of wye(e))yield*xye(n,t)},wye=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},uT=(e,t,n,r)=>{let o=vye(e,t),s=0,i,a=(c)=>{if(!i)i=!0,r&&r(c)};return new ReadableStream({async pull(c){try{let{done:l,value:u}=await o.next();if(l){a(),c.close();return}let p=u.byteLength;if(n){let f=s+=p;n(f)}c.enqueue(new Uint8Array(u))}catch(l){throw a(l),l}},cancel(c){return a(c),o.return()}},{highWaterMark:2})};var vH=65536,$_,Aye,wH,AH,TH=(e,...t)=>{try{return!!e(...t)}catch(n){return!1}},Tye=(e)=>{e=w.merge.call({skipUndefined:!0},Aye,e);let{fetch:t,Request:n,Response:r}=e,o=t?$_(t):typeof fetch==="function",s=$_(n),i=$_(r);if(!o)return!1;let a=o&&$_(wH),c=o&&(typeof AH==="function"?((h)=>(g)=>h.encode(g))(new AH):async(h)=>new Uint8Array(await new n(h).arrayBuffer())),l=s&&a&&TH(()=>{let h=!1,g=new n(Ve.origin,{body:new wH,method:"POST",get duplex(){return h=!0,"half"}}),y=g.headers.has("Content-Type");if(g.body!=null)g.body.cancel();return h&&!y}),u=i&&a&&TH(()=>w.isReadableStream(new r("").body)),p={stream:u&&((h)=>h.body)};o&&(()=>{["text","arrayBuffer","blob","formData","stream"].forEach((h)=>{!p[h]&&(p[h]=(g,y)=>{let S=g&&g[h];if(S)return S.call(g);throw new G(`Response type '${h}' is not supported`,G.ERR_NOT_SUPPORT,y)})})})();let f=async(h)=>{if(h==null)return 0;if(w.isBlob(h))return h.size;if(w.isSpecCompliantForm(h))return(await new n(Ve.origin,{method:"POST",body:h}).arrayBuffer()).byteLength;if(w.isArrayBufferView(h)||w.isArrayBuffer(h))return h.byteLength;if(w.isURLSearchParams(h))h=h+"";if(w.isString(h))return(await c(h)).byteLength},m=async(h,g)=>{let y=w.toFiniteNumber(h.getContentLength());return y==null?f(g):y};return async(h)=>{let{url:g,method:y,data:S,signal:b,cancelToken:x,timeout:v,onDownloadProgress:A,onUploadProgress:U,responseType:D,headers:F,withCredentials:K="same-origin",fetchOptions:V}=j_(h),ne=t||fetch;D=D?(D+"").toLowerCase():"text";let oe=EH([b,x&&x.toAbortSignal()],v),_e=null,ke=oe&&oe.unsubscribe&&(()=>{oe.unsubscribe()}),vt;try{if(U&&l&&y!=="get"&&y!=="head"&&(vt=await m(F,S))!==0){let Ot=new n(g,{method:"POST",body:S,duplex:"half"}),se;if(w.isFormData(S)&&(se=Ot.headers.get("content-type")))F.setContentType(se);if(Ot.body){let[Q,te]=Yl(vt,Es(Jl(U)));S=uT(Ot.body,vH,Q,te)}}if(!w.isString(K))K=K?"include":"omit";let Z=s&&"credentials"in n.prototype;if(w.isFormData(S)){let Ot=F.getContentType();if(Ot&&/^multipart\/form-data/i.test(Ot)&&!/boundary=/i.test(Ot))F.delete("content-type")}let Je={...V,signal:oe,method:y.toUpperCase(),headers:F.normalize().toJSON(),body:S,duplex:"half",credentials:Z?K:void 0};_e=s&&new n(g,Je);let wt=await(s?ne(_e,V):ne(g,Je)),ht=u&&(D==="stream"||D==="response");if(u&&(A||ht&&ke)){let Ot={};["status","statusText","headers"].forEach((je)=>{Ot[je]=wt[je]});let se=w.toFiniteNumber(wt.headers.get("content-length")),[Q,te]=A&&Yl(se,Es(Jl(A),!0))||[];wt=new r(uT(wt.body,vH,Q,()=>{te&&te(),ke&&ke()}),Ot)}D=D||"text";let cr=await p[w.findKey(p,D)||"text"](wt,h);return!ht&&ke&&ke(),await new Promise((Ot,se)=>{Jo(Ot,se,{data:cr,headers:Rt.from(wt.headers),status:wt.status,statusText:wt.statusText,config:h,request:_e})})}catch(Z){if(ke&&ke(),Z&&Z.name==="TypeError"&&/Load failed|fetch/i.test(Z.message))throw Object.assign(new G("Network Error",G.ERR_NETWORK,h,_e,Z&&Z.response),{cause:Z.cause||Z});throw G.from(Z,Z&&Z.code,h,_e,Z&&Z.response)}}},Cye,dT=(e)=>{let t=e&&e.env||{},{fetch:n,Request:r,Response:o}=t,s=[r,o,n],i=s.length,a=i,c,l,u=Cye;while(a--)c=s[a],l=u.get(c),l===void 0&&u.set(c,l=a?new Map:Tye(t)),u=l;return l},Txt;var CH=O(()=>{go();lt();xr();xH();Yo();N_();lT();C_();({isFunction:$_}=w),Aye=(({Request:e,Response:t})=>({Request:e,Response:t}))(w.global),{ReadableStream:wH,TextEncoder:AH}=w.global,Cye=new Map,Txt=dT()});function Oye(e,t){e=w.isArray(e)?e:[e];let{length:n}=e,r,o,s={};for(let i=0;i<n;i++){r=e[i];let a;if(o=r,!Rye(r)){if(o=pT[(a=String(r)).toLowerCase()],o===void 0)throw new G(`Unknown adapter '${a}'`)}if(o&&(w.isFunction(o)||(o=o.get(t))))break;s[a||"#"+i]=o}if(!o){let i=Object.entries(s).map(([c,l])=>`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build")),a=n?i.length>1?`since :
73
- `+i.map(kH).join(`
74
- `):" "+kH(i[0]):"as no adapter specified";throw new G("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return o}var pT,kH=(e)=>`- ${e}`,Rye=(e)=>w.isFunction(e)||e===null||e===!1,z_;var fT=O(()=>{lt();fH();SH();CH();xr();pT={http:pH,xhr:bH,fetch:{get:dT}};w.forEach(pT,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(n){}Object.defineProperty(e,"adapterName",{value:t})}});z_={getAdapter:Oye,adapters:pT}});function mT(e){if(e.cancelToken)e.cancelToken.throwIfRequested();if(e.signal&&e.signal.aborted)throw new vr(null,e)}function H_(e){if(mT(e),e.headers=Rt.from(e.headers),e.data=mf.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1)e.headers.setContentType("application/x-www-form-urlencoded",!1);return z_.getAdapter(e.adapter||Wl.adapter,e)(e).then(function(r){return mT(e),r.data=mf.call(e,e.transformResponse,r),r.headers=Rt.from(r.headers),r},function(r){if(!hf(r)){if(mT(e),r&&r.response)r.response.data=mf.call(e,e.transformResponse,r.response),r.response.headers=Rt.from(r.response.headers)}return Promise.reject(r)})}var RH=O(()=>{c1();A_();wa();Yo();fT()});function Pye(e,t,n){if(typeof e!=="object")throw new G("options must be an object",G.ERR_BAD_OPTION_VALUE);let r=Object.keys(e),o=r.length;while(o-- >0){let s=r[o],i=Object.prototype.hasOwnProperty.call(t,s)?t[s]:void 0;if(i){let a=e[s],c=a===void 0||i(a,s,e);if(c!==!0)throw new G("option "+s+" must be "+c,G.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new G("Unknown option "+s,G.ERR_BAD_OPTION)}}var B_,OH,xf;var PH=O(()=>{xr();B_={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{B_[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});OH={};B_.transitional=function(t,n,r){function o(s,i){return"[Axios v"+Oa+"] Transitional option '"+s+"'"+i+(r?". "+r:"")}return(s,i,a)=>{if(t===!1)throw new G(o(i," has been removed"+(n?" in "+n:"")),G.ERR_DEPRECATED);if(n&&!OH[i])OH[i]=!0,console.warn(o(i," has been deprecated since v"+n+" and will be removed in the near future"));return t?t(s,i,a):!0}};B_.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};xf={assertOptions:Pye,validators:B_}});class vf{constructor(e){this.defaults=e||{},this.interceptors={request:new OA,response:new OA}}async request(e,t){try{return await this._request(e,t)}catch(n){if(n instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=Error();let o=(()=>{if(!r.stack)return"";let s=r.stack.indexOf(`
75
- `);return s===-1?"":r.stack.slice(s+1)})();try{if(!n.stack)n.stack=o;else if(o){let s=o.indexOf(`
76
- `),i=s===-1?-1:o.indexOf(`
77
- `,s+1),a=i===-1?"":o.slice(i+1);if(!String(n.stack).endsWith(a))n.stack+=`
78
- `+o}}catch(s){}}throw n}}_request(e,t){if(typeof e==="string")t=t||{},t.url=e;else t=e||{};t=yo(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:o}=t;if(n!==void 0)xf.assertOptions(n,{silentJSONParsing:zr.transitional(zr.boolean),forcedJSONParsing:zr.transitional(zr.boolean),clarifyTimeoutError:zr.transitional(zr.boolean),legacyInterceptorReqResOrdering:zr.transitional(zr.boolean)},!1);if(r!=null)if(w.isFunction(r))t.paramsSerializer={serialize:r};else xf.assertOptions(r,{encode:zr.function,serialize:zr.function},!0);if(t.allowAbsoluteUrls!==void 0);else if(this.defaults.allowAbsoluteUrls!==void 0)t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls;else t.allowAbsoluteUrls=!0;xf.assertOptions(t,{baseUrl:zr.spelling("baseURL"),withXsrfToken:zr.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&w.merge(o.common,o[t.method]);o&&w.forEach(["delete","get","head","post","put","patch","common"],(m)=>{delete o[m]}),t.headers=Rt.concat(s,o);let i=[],a=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen==="function"&&h.runWhen(t)===!1)return;a=a&&h.synchronous;let g=t.transitional||yi;if(g&&g.legacyInterceptorReqResOrdering)i.unshift(h.fulfilled,h.rejected);else i.push(h.fulfilled,h.rejected)});let c=[];this.interceptors.response.forEach(function(h){c.push(h.fulfilled,h.rejected)});let l,u=0,p;if(!a){let m=[H_.bind(this),void 0];m.unshift(...i),m.push(...c),p=m.length,l=Promise.resolve(t);while(u<p)l=l.then(m[u++],m[u++]);return l}p=i.length;let f=t;while(u<p){let m=i[u++],h=i[u++];try{f=m(f)}catch(g){h.call(this,g);break}}try{l=H_.call(this,f)}catch(m){return Promise.reject(m)}u=0,p=c.length;while(u<p)l=l.then(c[u++],c[u++]);return l}getUri(e){e=yo(this.defaults,e);let t=Aa(e.baseURL,e.url,e.allowAbsoluteUrls);return va(t,e.params,e.paramsSerializer)}}var zr,wf;var IH=O(()=>{lt();v_();Yz();RH();F_();k_();PH();Yo();df();zr=xf.validators;w.forEach(["delete","get","head","options"],function(t){vf.prototype[t]=function(n,r){return this.request(yo(r||{},{method:t,url:n,data:(r||{}).data}))}});w.forEach(["post","put","patch"],function(t){function n(r){return function(s,i,a){return this.request(yo(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}vf.prototype[t]=n(),vf.prototype[t+"Form"]=n(!0)});wf=vf});class hT{constructor(e){if(typeof e!=="function")throw TypeError("executor must be a function.");let t;this.promise=new Promise(function(o){t=o});let n=this;this.promise.then((r)=>{if(!n._listeners)return;let o=n._listeners.length;while(o-- >0)n._listeners[o](r);n._listeners=null}),this.promise.then=(r)=>{let o,s=new Promise((i)=>{n.subscribe(i),o=i}).then(r);return s.cancel=function(){n.unsubscribe(o)},s},e(function(o,s,i){if(n.reason)return;n.reason=new vr(o,s,i),t(n.reason)})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}if(this._listeners)this._listeners.push(e);else this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);if(t!==-1)this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=(n)=>{e.abort(n)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new hT(function(r){e=r}),cancel:e}}}var DH;var LH=O(()=>{wa();DH=hT});function gT(e){return function(n){return e.apply(null,n)}}function _T(e){return w.isObject(e)&&e.isAxiosError===!0}var MH=O(()=>{lt()});var yT,NH;var UH=O(()=>{yT={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(yT).forEach(([e,t])=>{yT[t]=e});NH=yT});function FH(e){let t=new wf(e),n=nf(wf.prototype.request,t);return w.extend(n,wf.prototype,t,{allOwnKeys:!0}),w.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return FH(yo(e,o))},n}var qt,wr;var jH=O(()=>{lt();IH();F_();A_();NA();wa();LH();uf();xr();MH();Yo();fT();UH();qt=FH(Wl);qt.Axios=wf;qt.CanceledError=vr;qt.CancelToken=DH;qt.isCancel=hf;qt.VERSION=Oa;qt.toFormData=_i;qt.AxiosError=G;qt.Cancel=qt.CanceledError;qt.all=function(t){return Promise.all(t)};qt.spread=gT;qt.isAxiosError=_T;qt.mergeConfig=yo;qt.AxiosHeaders=Rt;qt.formToJSON=(e)=>w_(w.isHTMLForm(e)?new FormData(e):e);qt.getAdapter=z_.getAdapter;qt.HttpStatusCode=NH;qt.default=qt;wr=qt});var vvt,wvt,Avt,$H,Tvt,Cvt,kvt,Rvt,K_,Ovt,Pvt,Ivt,Dvt,Lvt,Mvt,Nvt;var G_=O(()=>{jH();({Axios:vvt,AxiosError:wvt,CanceledError:Avt,isCancel:$H,CancelToken:Tvt,VERSION:Cvt,all:kvt,Cancel:Rvt,isAxiosError:K_,spread:Ovt,toFormData:Pvt,AxiosHeaders:Ivt,HttpStatusCode:Dvt,formToJSON:Lvt,getAdapter:Mvt,mergeConfig:Nvt}=wr)});function Dye(e){let t,n=e.startsWith("//")?`https:${e}`:e;try{t=new URL(n).hostname}catch{t=e.match(/^[^/:]+/)?.[0]??e}return t.endsWith(".")?t.slice(0,-1):t}function zH(e){return Iye.test(Dye(e))}var Iye;var HH=O(()=>{Iye=/(^|\.)(anthropic\.com|claude\.ai|claude\.com)$/i});var xs=T(function(jvt,GH){var BH=["nodebuffer","arraybuffer","fragments"],KH=typeof Blob<"u";if(KH)BH.push("blob");GH.exports={BINARY_TYPES:BH,CLOSE_TIMEOUT:30000,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:KH,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Af=T(function($vt,W_){var{EMPTY_BUFFER:Lye}=xs(),bT=Buffer[Symbol.species];function Mye(e,t){if(e.length===0)return Lye;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),r=0;for(let o=0;o<e.length;o++){let s=e[o];n.set(s,r),r+=s.length}if(r<t)return new bT(n.buffer,n.byteOffset,r);return n}function WH(e,t,n,r,o){for(let s=0;s<o;s++)n[r+s]=e[s]^t[s&3]}function qH(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function Nye(e){if(e.length===e.buffer.byteLength)return e.buffer;return e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function ST(e){if(ST.readOnly=!0,Buffer.isBuffer(e))return e;let t;if(e instanceof ArrayBuffer)t=new bT(e);else if(ArrayBuffer.isView(e))t=new bT(e.buffer,e.byteOffset,e.byteLength);else t=Buffer.from(e),ST.readOnly=!1;return t}W_.exports={concat:Mye,mask:WH,toArrayBuffer:Nye,toBuffer:ST,unmask:qH};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=(()=>{throw new Error("Cannot require module "+"bufferutil");})();W_.exports.mask=function(t,n,r,o,s){if(s<48)WH(t,n,r,o,s);else e.mask(t,n,r,o,s)},W_.exports.unmask=function(t,n){if(t.length<32)qH(t,n);else e.unmask(t,n)}}catch(e){}});var JH=T(function(zvt,YH){var VH=Symbol("kDone"),ET=Symbol("kRun");class ZH{constructor(e){this[VH]=()=>{this.pending--,this[ET]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[ET]()}[ET](){if(this.pending===this.concurrency)return;if(this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[VH])}}}YH.exports=ZH});var eu=T(function(Hvt,nB){var Tf=ue("zlib"),XH=Af(),Uye=JH(),{kStatusCode:QH}=xs(),Fye=Buffer[Symbol.species],jye=Buffer.from([0,0,255,255]),V_=Symbol("permessage-deflate"),vs=Symbol("total-length"),Xl=Symbol("callback"),Si=Symbol("buffers"),Ql=Symbol("error"),q_;class eB{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!q_){let t=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;q_=new Uye(t)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};if(this._options.serverNoContextTakeover)e.server_no_context_takeover=!0;if(this._options.clientNoContextTakeover)e.client_no_context_takeover=!0;if(this._options.serverMaxWindowBits)e.server_max_window_bits=this._options.serverMaxWindowBits;if(this._options.clientMaxWindowBits)e.client_max_window_bits=this._options.clientMaxWindowBits;else if(this._options.clientMaxWindowBits==null)e.client_max_window_bits=!0;return e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate)this._inflate.close(),this._inflate=null;if(this._deflate){let e=this._deflate[Xl];if(this._deflate.close(),this._deflate=null,e)e(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,n=e.find((r)=>{if(t.serverNoContextTakeover===!1&&r.server_no_context_takeover||r.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==="number"&&t.serverMaxWindowBits>r.server_max_window_bits)||typeof t.clientMaxWindowBits==="number"&&!r.client_max_window_bits)return!1;return!0});if(!n)throw Error("None of the extension offers can be accepted");if(t.serverNoContextTakeover)n.server_no_context_takeover=!0;if(t.clientNoContextTakeover)n.client_no_context_takeover=!0;if(typeof t.serverMaxWindowBits==="number")n.server_max_window_bits=t.serverMaxWindowBits;if(typeof t.clientMaxWindowBits==="number")n.client_max_window_bits=t.clientMaxWindowBits;else if(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)delete n.client_max_window_bits;return n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(!t.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number")t.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==="number"&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"');return t}normalizeParams(e){return e.forEach((t)=>{Object.keys(t).forEach((n)=>{let r=t[n];if(r.length>1)throw Error(`Parameter "${n}" must have only a single value`);if(r=r[0],n==="client_max_window_bits"){if(r!==!0){let o=+r;if(!Number.isInteger(o)||o<8||o>15)throw TypeError(`Invalid value for parameter "${n}": ${r}`);r=o}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${n}": ${r}`)}else if(n==="server_max_window_bits"){let o=+r;if(!Number.isInteger(o)||o<8||o>15)throw TypeError(`Invalid value for parameter "${n}": ${r}`);r=o}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(r!==!0)throw TypeError(`Invalid value for parameter "${n}": ${r}`)}else throw Error(`Unknown parameter "${n}"`);t[n]=r})}),e}decompress(e,t,n){q_.add((r)=>{this._decompress(e,t,(o,s)=>{r(),n(o,s)})})}compress(e,t,n){q_.add((r)=>{this._compress(e,t,(o,s)=>{r(),n(o,s)})})}_decompress(e,t,n){let r=this._isServer?"client":"server";if(!this._inflate){let o=`${r}_max_window_bits`,s=typeof this.params[o]!=="number"?Tf.Z_DEFAULT_WINDOWBITS:this.params[o];this._inflate=Tf.createInflateRaw({...this._options.zlibInflateOptions,windowBits:s}),this._inflate[V_]=this,this._inflate[vs]=0,this._inflate[Si]=[],this._inflate.on("error",zye),this._inflate.on("data",tB)}if(this._inflate[Xl]=n,this._inflate.write(e),t)this._inflate.write(jye);this._inflate.flush(()=>{let o=this._inflate[Ql];if(o){this._inflate.close(),this._inflate=null,n(o);return}let s=XH.concat(this._inflate[Si],this._inflate[vs]);if(this._inflate._readableState.endEmitted)this._inflate.close(),this._inflate=null;else if(this._inflate[vs]=0,this._inflate[Si]=[],t&&this.params[`${r}_no_context_takeover`])this._inflate.reset();n(null,s)})}_compress(e,t,n){let r=this._isServer?"server":"client";if(!this._deflate){let o=`${r}_max_window_bits`,s=typeof this.params[o]!=="number"?Tf.Z_DEFAULT_WINDOWBITS:this.params[o];this._deflate=Tf.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:s}),this._deflate[vs]=0,this._deflate[Si]=[],this._deflate.on("data",$ye)}this._deflate[Xl]=n,this._deflate.write(e),this._deflate.flush(Tf.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let o=XH.concat(this._deflate[Si],this._deflate[vs]);if(t)o=new Fye(o.buffer,o.byteOffset,o.length-4);if(this._deflate[Xl]=null,this._deflate[vs]=0,this._deflate[Si]=[],t&&this.params[`${r}_no_context_takeover`])this._deflate.reset();n(null,o)})}}nB.exports=eB;function $ye(e){this[Si].push(e),this[vs]+=e.length}function tB(e){if(this[vs]+=e.length,this[V_]._maxPayload<1||this[vs]<=this[V_]._maxPayload){this[Si].push(e);return}this[Ql]=RangeError("Max payload size exceeded"),this[Ql].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Ql][QH]=1009,this.removeListener("data",tB),this.reset()}function zye(e){if(this[V_]._inflate=null,this[Ql]){this[Xl](this[Ql]);return}e[QH]=1007,this[Xl](e)}});var tu=T(function(Bvt,Z_){var{isUtf8:rB}=ue("buffer"),{hasBlob:Hye}=xs(),Bye=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function Kye(e){return e>=1000&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3000&&e<=4999}function xT(e){let t=e.length,n=0;while(n<t)if((e[n]&128)===0)n++;else if((e[n]&224)===192){if(n+1===t||(e[n+1]&192)!==128||(e[n]&254)===192)return!1;n+=2}else if((e[n]&240)===224){if(n+2>=t||(e[n+1]&192)!==128||(e[n+2]&192)!==128||e[n]===224&&(e[n+1]&224)===128||e[n]===237&&(e[n+1]&224)===160)return!1;n+=3}else if((e[n]&248)===240){if(n+3>=t||(e[n+1]&192)!==128||(e[n+2]&192)!==128||(e[n+3]&192)!==128||e[n]===240&&(e[n+1]&240)===128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function Gye(e){return Hye&&typeof e==="object"&&typeof e.arrayBuffer==="function"&&typeof e.type==="string"&&typeof e.stream==="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}Z_.exports={isBlob:Gye,isValidStatusCode:Kye,isValidUTF8:xT,tokenChars:Bye};if(rB)Z_.exports.isValidUTF8=function(e){return e.length<24?xT(e):rB(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=(()=>{throw new Error("Cannot require module "+"utf-8-validate");})();Z_.exports.isValidUTF8=function(t){return t.length<32?xT(t):e(t)}}catch(e){}});var wT=T(function(Kvt,cB){var{Writable:Wye}=ue("stream"),oB=eu(),{BINARY_TYPES:qye,EMPTY_BUFFER:sB,kStatusCode:Vye,kWebSocket:Zye}=xs(),{concat:vT,toArrayBuffer:Yye,unmask:Jye}=Af(),{isValidStatusCode:Xye,isValidUTF8:iB}=tu(),Y_=Buffer[Symbol.species];class aB extends Wye{constructor(e={}){super();this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||qye[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Zye]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new Y_(n.buffer,n.byteOffset+e,n.length-e),new Y_(n.buffer,n.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;if(e>=n.length)t.set(this._buffers.shift(),r);else t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new Y_(n.buffer,n.byteOffset+e,n.length-e);e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);if(!this._errored)e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if((t[0]&48)!==0){let r=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(r);return}let n=(t[0]&64)===64;if(n&&!this._extensions[oB.extensionName]){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(r);return}if(this._fin=(t[0]&128)===128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(r);return}if(!this._fragmented){let r=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(r);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let r=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(r);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let r=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(r);return}if(n){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(r);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let r=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(r);return}}else{let r=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(r);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;if(this._masked=(t[1]&128)===128,this._isServer){if(!this._masked){let r=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(r);return}}else if(this._masked){let r=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(r);return}if(this._payloadLength===126)this._state=1;else if(this._payloadLength===127)this._state=2;else this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>Math.pow(2,21)-1){let r=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(r);return}this._payloadLength=n*Math.pow(2,32)+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8){if(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){let t=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(t);return}}if(this._masked)this._state=3;else this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=sB;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}if(t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0)Jye(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}if(t.length)this._messageLength=this._totalPayloadLength,this._fragments.push(t);this.dataMessage(e)}decompress(e,t){this._extensions[oB.extensionName].decompress(e,this._fin,(r,o)=>{if(r)return t(r);if(o.length){if(this._messageLength+=o.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let s=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(s);return}this._fragments.push(o)}if(this.dataMessage(t),this._state===0)this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;if(this._binaryType==="nodebuffer")r=vT(n,t);else if(this._binaryType==="arraybuffer")r=Yye(vT(n,t));else if(this._binaryType==="blob")r=new Blob(n);else r=n;if(this._allowSynchronousEvents)this.emit("message",r,!0),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",r,!0),this._state=0,this.startLoop(e)})}else{let r=vT(n,t);if(!this._skipUTF8Validation&&!iB(r)){let o=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(o);return}if(this._state===5||this._allowSynchronousEvents)this.emit("message",r,!1),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",r,!1),this._state=0,this.startLoop(e)})}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,sB),this.end();else{let n=e.readUInt16BE(0);if(!Xye(n)){let o=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");t(o);return}let r=new Y_(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!iB(r)){let o=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(o);return}this._loop=!1,this.emit("conclude",n,r),this.end()}this._state=0;return}if(this._allowSynchronousEvents)this.emit(this._opcode===9?"ping":"pong",e),this._state=0;else this._state=6,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=0,this.startLoop(t)})}createError(e,t,n,r,o){this._loop=!1,this._errored=!0;let s=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(s,this.createError),s.code=o,s[Vye]=r,s}}cB.exports=aB});var TT=T(function(Wvt,dB){var{Duplex:Gvt}=ue("stream"),{randomFillSync:Qye}=ue("crypto"),{types:{isUint8Array:ebe}}=ue("util"),lB=eu(),{EMPTY_BUFFER:tbe,kWebSocket:nbe,NOOP:rbe}=xs(),{isBlob:nu,isValidStatusCode:obe}=tu(),{mask:uB,toBuffer:Ia}=Af(),Hr=Symbol("kByteLength"),sbe=Buffer.alloc(4),Da,ru=8192,bo=0,ibe=1,abe=2;class Ei{constructor(e,t,n){if(this._extensions=t||{},n)this._generateMask=n,this._maskBuffer=Buffer.alloc(4);this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=bo,this.onerror=rbe,this[nbe]=void 0}static frame(e,t){let n,r=!1,o=2,s=!1;if(t.mask){if(n=t.maskBuffer||sbe,t.generateMask)t.generateMask(n);else{if(ru===8192){if(Da===void 0)Da=Buffer.alloc(8192);Qye(Da,0,8192),ru=0}n[0]=Da[ru++],n[1]=Da[ru++],n[2]=Da[ru++],n[3]=Da[ru++]}s=(n[0]|n[1]|n[2]|n[3])===0,o=6}let i;if(typeof e==="string")if((!t.mask||s)&&t[Hr]!==void 0)i=t[Hr];else e=Buffer.from(e),i=e.length;else i=e.length,r=t.mask&&t.readOnly&&!s;let a=i;if(i>=65536)o+=8,a=127;else if(i>125)o+=2,a=126;let c=Buffer.allocUnsafe(r?i+o:o);if(c[0]=t.fin?t.opcode|128:t.opcode,t.rsv1)c[0]|=64;if(c[1]=a,a===126)c.writeUInt16BE(i,2);else if(a===127)c[2]=c[3]=0,c.writeUIntBE(i,4,6);if(!t.mask)return[c,e];if(c[1]|=128,c[o-4]=n[0],c[o-3]=n[1],c[o-2]=n[2],c[o-1]=n[3],s)return[c,e];if(r)return uB(e,n,c,o,i),[c];return uB(e,n,e,0,i),[c,e]}close(e,t,n,r){let o;if(e===void 0)o=tbe;else if(typeof e!=="number"||!obe(e))throw TypeError("First argument must be a valid error code number");else if(t===void 0||!t.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(e,0);else{let i=Buffer.byteLength(t);if(i>123)throw RangeError("The message must not be greater than 123 bytes");if(o=Buffer.allocUnsafe(2+i),o.writeUInt16BE(e,0),typeof t==="string")o.write(t,2);else if(ebe(t))o.set(t,2);else throw TypeError("Second argument must be a string or a Uint8Array")}let s={[Hr]:o.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};if(this._state!==bo)this.enqueue([this.dispatch,o,!1,s,r]);else this.sendFrame(Ei.frame(o,s),r)}ping(e,t,n){let r,o;if(typeof e==="string")r=Buffer.byteLength(e),o=!1;else if(nu(e))r=e.size,o=!1;else e=Ia(e),r=e.length,o=Ia.readOnly;if(r>125)throw RangeError("The data size must not be greater than 125 bytes");let s={[Hr]:r,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:o,rsv1:!1};if(nu(e))if(this._state!==bo)this.enqueue([this.getBlobData,e,!1,s,n]);else this.getBlobData(e,!1,s,n);else if(this._state!==bo)this.enqueue([this.dispatch,e,!1,s,n]);else this.sendFrame(Ei.frame(e,s),n)}pong(e,t,n){let r,o;if(typeof e==="string")r=Buffer.byteLength(e),o=!1;else if(nu(e))r=e.size,o=!1;else e=Ia(e),r=e.length,o=Ia.readOnly;if(r>125)throw RangeError("The data size must not be greater than 125 bytes");let s={[Hr]:r,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:o,rsv1:!1};if(nu(e))if(this._state!==bo)this.enqueue([this.getBlobData,e,!1,s,n]);else this.getBlobData(e,!1,s,n);else if(this._state!==bo)this.enqueue([this.dispatch,e,!1,s,n]);else this.sendFrame(Ei.frame(e,s),n)}send(e,t,n){let r=this._extensions[lB.extensionName],o=t.binary?2:1,s=t.compress,i,a;if(typeof e==="string")i=Buffer.byteLength(e),a=!1;else if(nu(e))i=e.size,a=!1;else e=Ia(e),i=e.length,a=Ia.readOnly;if(this._firstFragment){if(this._firstFragment=!1,s&&r&&r.params[r._isServer?"server_no_context_takeover":"client_no_context_takeover"])s=i>=r._threshold;this._compress=s}else s=!1,o=0;if(t.fin)this._firstFragment=!0;let c={[Hr]:i,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:o,readOnly:a,rsv1:s};if(nu(e))if(this._state!==bo)this.enqueue([this.getBlobData,e,this._compress,c,n]);else this.getBlobData(e,this._compress,c,n);else if(this._state!==bo)this.enqueue([this.dispatch,e,this._compress,c,n]);else this.dispatch(e,this._compress,c,n)}getBlobData(e,t,n,r){this._bufferedBytes+=n[Hr],this._state=abe,e.arrayBuffer().then((o)=>{if(this._socket.destroyed){let i=Error("The socket was closed while the blob was being read");process.nextTick(AT,this,i,r);return}this._bufferedBytes-=n[Hr];let s=Ia(o);if(!t)this._state=bo,this.sendFrame(Ei.frame(s,n),r),this.dequeue();else this.dispatch(s,t,n,r)}).catch((o)=>{process.nextTick(cbe,this,o,r)})}dispatch(e,t,n,r){if(!t){this.sendFrame(Ei.frame(e,n),r);return}let o=this._extensions[lB.extensionName];this._bufferedBytes+=n[Hr],this._state=ibe,o.compress(e,n.fin,(s,i)=>{if(this._socket.destroyed){let a=Error("The socket was closed while data was being compressed");AT(this,a,r);return}this._bufferedBytes-=n[Hr],this._state=bo,n.readOnly=!1,this.sendFrame(Ei.frame(i,n),r),this.dequeue()})}dequeue(){while(this._state===bo&&this._queue.length){let e=this._queue.shift();this._bufferedBytes-=e[3][Hr],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][Hr],this._queue.push(e)}sendFrame(e,t){if(e.length===2)this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork();else this._socket.write(e[0],t)}}dB.exports=Ei;function AT(e,t,n){if(typeof n==="function")n(t);for(let r=0;r<e._queue.length;r++){let o=e._queue[r],s=o[o.length-1];if(typeof s==="function")s(t)}}function cbe(e,t,n){AT(e,t,n),e.onerror(t)}});var SB=T(function(qvt,bB){var{kForOnEventAttribute:Cf,kListener:CT}=xs(),pB=Symbol("kCode"),fB=Symbol("kData"),mB=Symbol("kError"),hB=Symbol("kMessage"),gB=Symbol("kReason"),ou=Symbol("kTarget"),_B=Symbol("kType"),yB=Symbol("kWasClean");class xi{constructor(e){this[ou]=null,this[_B]=e}get target(){return this[ou]}get type(){return this[_B]}}Object.defineProperty(xi.prototype,"target",{enumerable:!0});Object.defineProperty(xi.prototype,"type",{enumerable:!0});class su extends xi{constructor(e,t={}){super(e);this[pB]=t.code===void 0?0:t.code,this[gB]=t.reason===void 0?"":t.reason,this[yB]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[pB]}get reason(){return this[gB]}get wasClean(){return this[yB]}}Object.defineProperty(su.prototype,"code",{enumerable:!0});Object.defineProperty(su.prototype,"reason",{enumerable:!0});Object.defineProperty(su.prototype,"wasClean",{enumerable:!0});class kf extends xi{constructor(e,t={}){super(e);this[mB]=t.error===void 0?null:t.error,this[hB]=t.message===void 0?"":t.message}get error(){return this[mB]}get message(){return this[hB]}}Object.defineProperty(kf.prototype,"error",{enumerable:!0});Object.defineProperty(kf.prototype,"message",{enumerable:!0});class X_ extends xi{constructor(e,t={}){super(e);this[fB]=t.data===void 0?null:t.data}get data(){return this[fB]}}Object.defineProperty(X_.prototype,"data",{enumerable:!0});var lbe={addEventListener(e,t,n={}){for(let o of this.listeners(e))if(!n[Cf]&&o[CT]===t&&!o[Cf])return;let r;if(e==="message")r=function(s,i){let a=new X_("message",{data:i?s:s.toString()});a[ou]=this,J_(t,this,a)};else if(e==="close")r=function(s,i){let a=new su("close",{code:s,reason:i.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[ou]=this,J_(t,this,a)};else if(e==="error")r=function(s){let i=new kf("error",{error:s,message:s.message});i[ou]=this,J_(t,this,i)};else if(e==="open")r=function(){let s=new xi("open");s[ou]=this,J_(t,this,s)};else return;if(r[Cf]=!!n[Cf],r[CT]=t,n.once)this.once(e,r);else this.on(e,r)},removeEventListener(e,t){for(let n of this.listeners(e))if(n[CT]===t&&!n[Cf]){this.removeListener(e,n);break}}};bB.exports={CloseEvent:su,ErrorEvent:kf,Event:xi,EventTarget:lbe,MessageEvent:X_};function J_(e,t,n){if(typeof e==="object"&&e.handleEvent)e.handleEvent.call(e,n);else e.call(t,n)}});var Q_=T(function(Vvt,EB){var{tokenChars:Rf}=tu();function Xo(e,t,n){if(e[t]===void 0)e[t]=[n];else e[t].push(n)}function ube(e){let t=Object.create(null),n=Object.create(null),r=!1,o=!1,s=!1,i,a,c=-1,l=-1,u=-1,p=0;for(;p<e.length;p++)if(l=e.charCodeAt(p),i===void 0)if(u===-1&&Rf[l]===1){if(c===-1)c=p}else if(p!==0&&(l===32||l===9)){if(u===-1&&c!==-1)u=p}else if(l===59||l===44){if(c===-1)throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1)u=p;let m=e.slice(c,u);if(l===44)Xo(t,m,n),n=Object.create(null);else i=m;c=u=-1}else throw SyntaxError(`Unexpected character at index ${p}`);else if(a===void 0)if(u===-1&&Rf[l]===1){if(c===-1)c=p}else if(l===32||l===9){if(u===-1&&c!==-1)u=p}else if(l===59||l===44){if(c===-1)throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1)u=p;if(Xo(n,e.slice(c,u),!0),l===44)Xo(t,i,n),n=Object.create(null),i=void 0;c=u=-1}else if(l===61&&c!==-1&&u===-1)a=e.slice(c,p),c=u=-1;else throw SyntaxError(`Unexpected character at index ${p}`);else if(o){if(Rf[l]!==1)throw SyntaxError(`Unexpected character at index ${p}`);if(c===-1)c=p;else if(!r)r=!0;o=!1}else if(s)if(Rf[l]===1){if(c===-1)c=p}else if(l===34&&c!==-1)s=!1,u=p;else if(l===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`);else if(l===34&&e.charCodeAt(p-1)===61)s=!0;else if(u===-1&&Rf[l]===1){if(c===-1)c=p}else if(c!==-1&&(l===32||l===9)){if(u===-1)u=p}else if(l===59||l===44){if(c===-1)throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1)u=p;let m=e.slice(c,u);if(r)m=m.replace(/\\/g,""),r=!1;if(Xo(n,a,m),l===44)Xo(t,i,n),n=Object.create(null),i=void 0;a=void 0,c=u=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(c===-1||s||l===32||l===9)throw SyntaxError("Unexpected end of input");if(u===-1)u=p;let f=e.slice(c,u);if(i===void 0)Xo(t,f,n);else{if(a===void 0)Xo(n,f,!0);else if(r)Xo(n,a,f.replace(/\\/g,""));else Xo(n,a,f);Xo(t,i,n)}return t}function dbe(e){return Object.keys(e).map((t)=>{let n=e[t];if(!Array.isArray(n))n=[n];return n.map((r)=>[t].concat(Object.keys(r).map((o)=>{let s=r[o];if(!Array.isArray(s))s=[s];return s.map((i)=>i===!0?o:`${o}=${i}`).join("; ")})).join("; ")).join(", ")}).join(", ")}EB.exports={format:dbe,parse:ube}});var ry=T(function(Jvt,DB){var pbe=ue("events"),fbe=ue("https"),mbe=ue("http"),wB=ue("net"),hbe=ue("tls"),{randomBytes:gbe,createHash:_be}=ue("crypto"),{Duplex:Zvt,Readable:Yvt}=ue("stream"),{URL:kT}=ue("url"),vi=eu(),ybe=wT(),bbe=TT(),{isBlob:Sbe}=tu(),{BINARY_TYPES:xB,CLOSE_TIMEOUT:Ebe,EMPTY_BUFFER:ey,GUID:xbe,kForOnEventAttribute:RT,kListener:vbe,kStatusCode:wbe,kWebSocket:ln,NOOP:AB}=xs(),{EventTarget:{addEventListener:Abe,removeEventListener:Tbe}}=SB(),{format:Cbe,parse:kbe}=Q_(),{toBuffer:Rbe}=Af(),TB=Symbol("kAborted"),OT=[8,13],ws=["CONNECTING","OPEN","CLOSING","CLOSED"],Obe=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class xe extends pbe{constructor(e,t,n){super();if(this._binaryType=xB[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=ey,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=xe.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null){if(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,t===void 0)t=[];else if(!Array.isArray(t))if(typeof t==="object"&&t!==null)n=t,t=[];else t=[t];CB(this,e,t,n)}else this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){if(!xB.includes(e))return;if(this._binaryType=e,this._receiver)this._receiver._binaryType=e}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,n){let r=new ybe({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),o=new bbe(e,this._extensions,n.generateMask);if(this._receiver=r,this._sender=o,this._socket=e,r[ln]=this,o[ln]=this,e[ln]=this,r.on("conclude",Dbe),r.on("drain",Lbe),r.on("error",Mbe),r.on("message",Nbe),r.on("ping",Ube),r.on("pong",Fbe),o.onerror=jbe,e.setTimeout)e.setTimeout(0);if(e.setNoDelay)e.setNoDelay();if(t.length>0)e.unshift(t);e.on("close",OB),e.on("data",ny),e.on("end",PB),e.on("error",IB),this._readyState=xe.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=xe.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[vi.extensionName])this._extensions[vi.extensionName].cleanup();this._receiver.removeAllListeners(),this._readyState=xe.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState===xe.CLOSED)return;if(this.readyState===xe.CONNECTING){Ar(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===xe.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted))this._socket.end();return}this._readyState=xe.CLOSING,this._sender.close(e,t,!this._isServer,(n)=>{if(n)return;if(this._closeFrameSent=!0,this._closeFrameReceived||this._receiver._writableState.errorEmitted)this._socket.end()}),RB(this)}pause(){if(this.readyState===xe.CONNECTING||this.readyState===xe.CLOSED)return;this._paused=!0,this._socket.pause()}ping(e,t,n){if(this.readyState===xe.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e==="function")n=e,e=t=void 0;else if(typeof t==="function")n=t,t=void 0;if(typeof e==="number")e=e.toString();if(this.readyState!==xe.OPEN){PT(this,e,n);return}if(t===void 0)t=!this._isServer;this._sender.ping(e||ey,t,n)}pong(e,t,n){if(this.readyState===xe.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e==="function")n=e,e=t=void 0;else if(typeof t==="function")n=t,t=void 0;if(typeof e==="number")e=e.toString();if(this.readyState!==xe.OPEN){PT(this,e,n);return}if(t===void 0)t=!this._isServer;this._sender.pong(e||ey,t,n)}resume(){if(this.readyState===xe.CONNECTING||this.readyState===xe.CLOSED)return;if(this._paused=!1,!this._receiver._writableState.needDrain)this._socket.resume()}send(e,t,n){if(this.readyState===xe.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t==="function")n=t,t={};if(typeof e==="number")e=e.toString();if(this.readyState!==xe.OPEN){PT(this,e,n);return}let r={binary:typeof e!=="string",mask:!this._isServer,compress:!0,fin:!0,...t};if(!this._extensions[vi.extensionName])r.compress=!1;this._sender.send(e||ey,r,n)}terminate(){if(this.readyState===xe.CLOSED)return;if(this.readyState===xe.CONNECTING){Ar(this,this._req,"WebSocket was closed before the connection was established");return}if(this._socket)this._readyState=xe.CLOSING,this._socket.destroy()}}Object.defineProperty(xe,"CONNECTING",{enumerable:!0,value:ws.indexOf("CONNECTING")});Object.defineProperty(xe.prototype,"CONNECTING",{enumerable:!0,value:ws.indexOf("CONNECTING")});Object.defineProperty(xe,"OPEN",{enumerable:!0,value:ws.indexOf("OPEN")});Object.defineProperty(xe.prototype,"OPEN",{enumerable:!0,value:ws.indexOf("OPEN")});Object.defineProperty(xe,"CLOSING",{enumerable:!0,value:ws.indexOf("CLOSING")});Object.defineProperty(xe.prototype,"CLOSING",{enumerable:!0,value:ws.indexOf("CLOSING")});Object.defineProperty(xe,"CLOSED",{enumerable:!0,value:ws.indexOf("CLOSED")});Object.defineProperty(xe.prototype,"CLOSED",{enumerable:!0,value:ws.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((e)=>{Object.defineProperty(xe.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach((e)=>{Object.defineProperty(xe.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[RT])return t[vbe];return null},set(t){for(let n of this.listeners(e))if(n[RT]){this.removeListener(e,n);break}if(typeof t!=="function")return;this.addEventListener(e,t,{[RT]:!0})}})});xe.prototype.addEventListener=Abe;xe.prototype.removeEventListener=Tbe;DB.exports=xe;function CB(e,t,n,r){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Ebe,protocolVersion:OT[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!OT.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${OT.join(", ")})`);let s;if(t instanceof kT)s=t;else try{s=new kT(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}if(s.protocol==="http:")s.protocol="ws:";else if(s.protocol==="https:")s.protocol="wss:";e._url=s.href;let i=s.protocol==="wss:",a=s.protocol==="ws+unix:",c;if(s.protocol!=="ws:"&&!i&&!a)c=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;else if(a&&!s.pathname)c="The URL's pathname is empty";else if(s.hash)c="The URL contains a fragment identifier";if(c){let g=SyntaxError(c);if(e._redirects===0)throw g;else{ty(e,g);return}}let l=i?443:80,u=gbe(16).toString("base64"),p=i?fbe.request:mbe.request,f=new Set,m;if(o.createConnection=o.createConnection||(i?Ibe:Pbe),o.defaultPort=o.defaultPort||l,o.port=s.port||l,o.host=s.hostname.startsWith("[")?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":u,Connection:"Upgrade",Upgrade:"websocket"},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate)m=new vi({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=Cbe({[vi.extensionName]:m.offer()});if(n.length){for(let g of n){if(typeof g!=="string"||!Obe.test(g)||f.has(g))throw SyntaxError("An invalid or duplicated subprotocol was specified");f.add(g)}o.headers["Sec-WebSocket-Protocol"]=n.join(",")}if(o.origin)if(o.protocolVersion<13)o.headers["Sec-WebSocket-Origin"]=o.origin;else o.headers.Origin=o.origin;if(s.username||s.password)o.auth=`${s.username}:${s.password}`;if(a){let g=o.path.split(":");o.socketPath=g[0],o.path=g[1]}let h;if(o.followRedirects){if(e._redirects===0){e._originalIpc=a,e._originalSecure=i,e._originalHostOrSocketPath=a?o.socketPath:s.host;let g=r&&r.headers;if(r={...r,headers:{}},g)for(let[y,S]of Object.entries(g))r.headers[y.toLowerCase()]=S}else if(e.listenerCount("redirect")===0){let g=a?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:s.host===e._originalHostOrSocketPath;if(!g||e._originalSecure&&!i){if(delete o.headers.authorization,delete o.headers.cookie,!g)delete o.headers.host;o.auth=void 0}}if(o.auth&&!r.headers.authorization)r.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64");if(h=e._req=p(o),e._redirects)e.emit("redirect",e.url,h)}else h=e._req=p(o);if(o.timeout)h.on("timeout",()=>{Ar(e,h,"Opening handshake has timed out")});if(h.on("error",(g)=>{if(h===null||h[TB])return;h=e._req=null,ty(e,g)}),h.on("response",(g)=>{let y=g.headers.location,S=g.statusCode;if(y&&o.followRedirects&&S>=300&&S<400){if(++e._redirects>o.maxRedirects){Ar(e,h,"Maximum redirects exceeded");return}h.abort();let b;try{b=new kT(y,t)}catch(x){let v=SyntaxError(`Invalid URL: ${y}`);ty(e,v);return}CB(e,b,n,r)}else if(!e.emit("unexpected-response",h,g))Ar(e,h,`Unexpected server response: ${g.statusCode}`)}),h.on("upgrade",(g,y,S)=>{if(e.emit("upgrade",g),e.readyState!==xe.CONNECTING)return;h=e._req=null;let b=g.headers.upgrade;if(b===void 0||b.toLowerCase()!=="websocket"){Ar(e,y,"Invalid Upgrade header");return}let x=_be("sha1").update(u+xbe).digest("base64");if(g.headers["sec-websocket-accept"]!==x){Ar(e,y,"Invalid Sec-WebSocket-Accept header");return}let v=g.headers["sec-websocket-protocol"],A;if(v!==void 0){if(!f.size)A="Server sent a subprotocol but none was requested";else if(!f.has(v))A="Server sent an invalid subprotocol"}else if(f.size)A="Server sent no subprotocol";if(A){Ar(e,y,A);return}if(v)e._protocol=v;let U=g.headers["sec-websocket-extensions"];if(U!==void 0){if(!m){Ar(e,y,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let D;try{D=kbe(U)}catch(K){Ar(e,y,"Invalid Sec-WebSocket-Extensions header");return}let F=Object.keys(D);if(F.length!==1||F[0]!==vi.extensionName){Ar(e,y,"Server indicated an extension that was not requested");return}try{m.accept(D[vi.extensionName])}catch(K){Ar(e,y,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[vi.extensionName]=m}e.setSocket(y,S,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest)o.finishRequest(h,e);else h.end()}function ty(e,t){e._readyState=xe.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function Pbe(e){return e.path=e.socketPath,wB.connect(e)}function Ibe(e){if(e.path=void 0,!e.servername&&e.servername!=="")e.servername=wB.isIP(e.host)?"":e.host;return hbe.connect(e)}function Ar(e,t,n){e._readyState=xe.CLOSING;let r=Error(n);if(Error.captureStackTrace(r,Ar),t.setHeader){if(t[TB]=!0,t.abort(),t.socket&&!t.socket.destroyed)t.socket.destroy();process.nextTick(ty,e,r)}else t.destroy(r),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e))}function PT(e,t,n){if(t){let r=Sbe(t)?t.size:Rbe(t).length;if(e._socket)e._sender._bufferedBytes+=r;else e._bufferedAmount+=r}if(n){let r=Error(`WebSocket is not open: readyState ${e.readyState} (${ws[e.readyState]})`);process.nextTick(n,r)}}function Dbe(e,t){let n=this[ln];if(n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[ln]===void 0)return;if(n._socket.removeListener("data",ny),process.nextTick(kB,n._socket),e===1005)n.close();else n.close(e,t)}function Lbe(){let e=this[ln];if(!e.isPaused)e._socket.resume()}function Mbe(e){let t=this[ln];if(t._socket[ln]!==void 0)t._socket.removeListener("data",ny),process.nextTick(kB,t._socket),t.close(e[wbe]);if(!t._errorEmitted)t._errorEmitted=!0,t.emit("error",e)}function vB(){this[ln].emitClose()}function Nbe(e,t){this[ln].emit("message",e,t)}function Ube(e){let t=this[ln];if(t._autoPong)t.pong(e,!this._isServer,AB);t.emit("ping",e)}function Fbe(e){this[ln].emit("pong",e)}function kB(e){e.resume()}function jbe(e){let t=this[ln];if(t.readyState===xe.CLOSED)return;if(t.readyState===xe.OPEN)t._readyState=xe.CLOSING,RB(t);if(this._socket.end(),!t._errorEmitted)t._errorEmitted=!0,t.emit("error",e)}function RB(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function OB(){let e=this[ln];if(this.removeListener("close",OB),this.removeListener("data",ny),this.removeListener("end",PB),e._readyState=xe.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}if(e._receiver.end(),this[ln]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted)e.emitClose();else e._receiver.on("error",vB),e._receiver.on("finish",vB)}function ny(e){if(!this[ln]._receiver.write(e))this.pause()}function PB(){let e=this[ln];e._readyState=xe.CLOSING,e._receiver.end(),this.end()}function IB(){let e=this[ln];if(this.removeListener("error",IB),this.on("error",AB),e)e._readyState=xe.CLOSING,this.destroy()}});var UB=T(function(Qvt,NB){var Xvt=ry(),{Duplex:$be}=ue("stream");function LB(e){e.emit("close")}function zbe(){if(!this.destroyed&&this._writableState.finished)this.destroy()}function MB(e){if(this.removeListener("error",MB),this.destroy(),this.listenerCount("error")===0)this.emit("error",e)}function Hbe(e,t){let n=!0,r=new $be({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(s,i){let a=!i&&r._readableState.objectMode?s.toString():s;if(!r.push(a))e.pause()}),e.once("error",function(s){if(r.destroyed)return;n=!1,r.destroy(s)}),e.once("close",function(){if(r.destroyed)return;r.push(null)}),r._destroy=function(o,s){if(e.readyState===e.CLOSED){s(o),process.nextTick(LB,r);return}let i=!1;if(e.once("error",function(c){i=!0,s(c)}),e.once("close",function(){if(!i)s(o);process.nextTick(LB,r)}),n)e.terminate()},r._final=function(o){if(e.readyState===e.CONNECTING){e.once("open",function(){r._final(o)});return}if(e._socket===null)return;if(e._socket._writableState.finished){if(o(),r._readableState.endEmitted)r.destroy()}else e._socket.once("finish",function(){o()}),e.close()},r._read=function(){if(e.isPaused)e.resume()},r._write=function(o,s,i){if(e.readyState===e.CONNECTING){e.once("open",function(){r._write(o,s,i)});return}e.send(o,i)},r.on("end",zbe),r.on("error",MB),r}NB.exports=Hbe});var IT=T(function(ewt,FB){var{tokenChars:Bbe}=tu();function Kbe(e){let t=new Set,n=-1,r=-1,o=0;for(o;o<e.length;o++){let i=e.charCodeAt(o);if(r===-1&&Bbe[i]===1){if(n===-1)n=o}else if(o!==0&&(i===32||i===9)){if(r===-1&&n!==-1)r=o}else if(i===44){if(n===-1)throw SyntaxError(`Unexpected character at index ${o}`);if(r===-1)r=o;let a=e.slice(n,r);if(t.has(a))throw SyntaxError(`The "${a}" subprotocol is duplicated`);t.add(a),n=r=-1}else throw SyntaxError(`Unexpected character at index ${o}`)}if(n===-1||r!==-1)throw SyntaxError("Unexpected end of input");let s=e.slice(n,o);if(t.has(s))throw SyntaxError(`The "${s}" subprotocol is duplicated`);return t.add(s),t}FB.exports={parse:Kbe}});var BB=T(function(nwt,HB){var Gbe=ue("events"),oy=ue("http"),{Duplex:twt}=ue("stream"),{createHash:Wbe}=ue("crypto"),jB=Q_(),La=eu(),qbe=IT(),Vbe=ry(),{CLOSE_TIMEOUT:Zbe,GUID:Ybe,kWebSocket:Jbe}=xs(),Xbe=/^[+/0-9A-Za-z]{22}==$/;class zB extends Gbe{constructor(e,t){super();if(e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Zbe,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Vbe,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null)this._server=oy.createServer((n,r)=>{let o=oy.STATUS_CODES[426];r.writeHead(426,{"Content-Length":o.length,"Content-Type":"text/plain"}),r.end(o)}),this._server.listen(e.port,e.host,e.backlog,t);else if(e.server)this._server=e.server;if(this._server){let n=this.emit.bind(this,"connection");this._removeListeners=Qbe(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(r,o,s)=>{this.handleUpgrade(r,o,s,n)}})}if(e.perMessageDeflate===!0)e.perMessageDeflate={};if(e.clientTracking)this.clients=new Set,this._shouldEmitClose=!1;this.options=e,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');if(!this._server)return null;return this._server.address()}close(e){if(this._state===2){if(e)this.once("close",()=>{e(Error("The server is not running"))});process.nextTick(Of,this);return}if(e)this.once("close",e);if(this._state===1)return;if(this._state=1,this.options.noServer||this.options.server){if(this._server)this._removeListeners(),this._removeListeners=this._server=null;if(this.clients)if(!this.clients.size)process.nextTick(Of,this);else this._shouldEmitClose=!0;else process.nextTick(Of,this)}else{let t=this._server;this._removeListeners(),this._removeListeners=this._server=null,t.close(()=>{Of(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((t!==-1?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on("error",$B);let o=e.headers["sec-websocket-key"],s=e.headers.upgrade,i=+e.headers["sec-websocket-version"];if(e.method!=="GET"){Ma(this,e,t,405,"Invalid HTTP method");return}if(s===void 0||s.toLowerCase()!=="websocket"){Ma(this,e,t,400,"Invalid Upgrade header");return}if(o===void 0||!Xbe.test(o)){Ma(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");return}if(i!==13&&i!==8){Ma(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Pf(t,400);return}let a=e.headers["sec-websocket-protocol"],c=new Set;if(a!==void 0)try{c=qbe.parse(a)}catch(p){Ma(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let l=e.headers["sec-websocket-extensions"],u={};if(this.options.perMessageDeflate&&l!==void 0){let p=new La({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let f=jB.parse(l);if(f[La.extensionName])p.accept(f[La.extensionName]),u[La.extensionName]=p}catch(f){Ma(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let p={origin:e.headers[`${i===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(p,(f,m,h,g)=>{if(!f)return Pf(t,m||401,h,g);this.completeUpgrade(u,o,c,e,t,n,r)});return}if(!this.options.verifyClient(p))return Pf(t,401)}this.completeUpgrade(u,o,c,e,t,n,r)}completeUpgrade(e,t,n,r,o,s,i){if(!o.readable||!o.writable)return o.destroy();if(o[Jbe])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return Pf(o,503);let c=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Wbe("sha1").update(t+Ybe).digest("base64")}`],l=new this.options.WebSocket(null,void 0,this.options);if(n.size){let u=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;if(u)c.push(`Sec-WebSocket-Protocol: ${u}`),l._protocol=u}if(e[La.extensionName]){let u=e[La.extensionName].params,p=jB.format({[La.extensionName]:[u]});c.push(`Sec-WebSocket-Extensions: ${p}`),l._extensions=e}if(this.emit("headers",c,r),o.write(c.concat(`\r
79
- `).join(`\r
80
- `)),o.removeListener("error",$B),l.setSocket(o,s,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients)this.clients.add(l),l.on("close",()=>{if(this.clients.delete(l),this._shouldEmitClose&&!this.clients.size)process.nextTick(Of,this)});i(l,r)}}HB.exports=zB;function Qbe(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return function(){for(let r of Object.keys(t))e.removeListener(r,t[r])}}function Of(e){e._state=2,e.emit("close")}function $B(){this.destroy()}function Pf(e,t,n,r){n=n||oy.STATUS_CODES[t],r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(n),...r},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${oy.STATUS_CODES[t]}\r
81
- `+Object.keys(r).map((o)=>`${o}: ${r[o]}`).join(`\r
82
- `)+`\r
83
- \r
84
- `+n)}function Ma(e,t,n,r,o,s){if(e.listenerCount("wsClientError")){let i=Error(o);Error.captureStackTrace(i,Ma),e.emit("wsClientError",i,n,t)}else Pf(n,r,o,s)}});var eSe,tSe,nSe,rSe,oSe,sSe,iSe,aSe;var KB=O(()=>{eSe=Hn(UB(),1),tSe=Hn(Q_(),1),nSe=Hn(eu(),1),rSe=Hn(wT(),1),oSe=Hn(TT(),1),sSe=Hn(IT(),1),iSe=Hn(ry(),1),aSe=Hn(BB(),1)});function GB(e){return cSe.has(e)||lSe.test(e)}var cSe,lSe;var WB=O(()=>{cSe=new Set(["localhost","::1","[::1]"]),lSe=/^127(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$/});function uSe(){return Ie(process.env.CLAUDE_CODE_TEST_ALLOW_REAL_NETWORK)}function qB(e,t){return`[CLAUDE_CODE_TEST_ALLOW_REAL_NETWORK] live request from a test runtime: ${e} ${t}
85
- `}function VB(e){let t;try{t=GB(new URL(e).hostname)}catch{t=!1}if(t)return"loopback";return uSe()?"opted-in":"refused"}function DT(e,t){return`Blocked under test: ${e} ${t} — test runtimes must not reach the network. `+"Run the file via `bun run test:file -- <path>` with this request mocked, or set CLAUDE_CODE_TEST_ALLOW_REAL_NETWORK=1 for an intentional live probe."}function ZB(e){let t=wr.getUri(e),n=(e.method??"get").toUpperCase();switch(VB(t)){case"loopback":return dSe(e,n);case"opted-in":return process.stderr.write(qB(n,t)),e;case"refused":throw new LT(DT(n,t))}}function dSe(e,t){let n=e.beforeRedirect;return e.beforeRedirect=(r,o)=>{let s=typeof r.href==="string"?r.href:"";switch(VB(s)){case"loopback":break;case"opted-in":process.stderr.write(qB(t,s));break;case"refused":throw process.stderr.write(`${DT(t,s)}
86
- `),new LT(DT(t,s))}n?.(r,o)},e}function pSe(){if(!fSe())wr.interceptors.request.use(ZB)}function fSe(){return wr.interceptors.request.handlers?.some((e)=>e?.fulfilled===ZB)??!1}function Na(){return}var LT,uwt;var YB=O(()=>{bd();G_();KB();WB();LT=class LT extends Error{name="TestEgressBlockedError";code="TestEgressBlocked"};uwt=globalThis.fetch});var JB={};rn(JB,{externalHttp:()=>gSe,isAxiosError:()=>K_,isCancel:()=>$H,isTransportError:()=>hSe});function hSe(e){return K_(e)&&e.response===void 0&&!mSe.has(e.code??"")}function iu(e,t){for(let n of[e,t?.baseURL])if(n&&zH(n))throw Error(`externalHttp: ${n} is Anthropic-operated. Use firstPartyApi from `+"src/services/http/firstParty — it enforces the 3P data-residency gate.")}var mSe,gSe;var XB=O(()=>{G_();HH();YB();G_();mSe=new Set(["ERR_BAD_OPTION","ERR_BAD_OPTION_VALUE","ERR_BAD_REQUEST","ERR_BAD_RESPONSE","ERR_CANCELED","ERR_DEPRECATED","ERR_FORM_DATA_DEPTH_EXCEEDED","ERR_FR_MAX_BODY_LENGTH_EXCEEDED","ERR_FR_TOO_MANY_REDIRECTS","ERR_INVALID_URL","ERR_NOT_SUPPORT","ERR_STREAM_WRITE_AFTER_END"]);gSe={get(e,t){return iu(e,t),Na(),wr.get(e,t)},head(e,t){return iu(e,t),Na(),wr.head(e,t)},post(e,t,n){return iu(e,n),Na(),wr.post(e,t,n)},put(e,t,n){return iu(e,n),Na(),wr.put(e,t,n)},patch(e,t,n){return iu(e,n),Na(),wr.patch(e,t,n)},delete(e,t){return iu(e,t),Na(),wr.delete(e,t)}}});var E2=T(function(b2){Object.defineProperty(b2,"__esModule",{value:!0});b2._globalThis=void 0;b2._globalThis=typeof globalThis==="object"?globalThis:global});var x2=T(function(Ua){var fMe=Ua&&Ua.__createBinding||(Object.create?function(e,t,n,r){if(r===void 0)r=n;Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){if(r===void 0)r=n;e[r]=t[n]}),mMe=Ua&&Ua.__exportStar||function(e,t){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n))fMe(t,e,n)};Object.defineProperty(Ua,"__esModule",{value:!0});mMe(E2(),Ua)});var v2=T(function(Fa){var hMe=Fa&&Fa.__createBinding||(Object.create?function(e,t,n,r){if(r===void 0)r=n;Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){if(r===void 0)r=n;e[r]=t[n]}),gMe=Fa&&Fa.__exportStar||function(e,t){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n))hMe(t,e,n)};Object.defineProperty(Fa,"__esModule",{value:!0});gMe(x2(),Fa)});var XT=T(function(w2){Object.defineProperty(w2,"__esModule",{value:!0});w2.VERSION=void 0;w2.VERSION="1.9.0"});var O2=T(function(k2){Object.defineProperty(k2,"__esModule",{value:!0});k2.isCompatible=k2._makeCompatibilityCheck=void 0;var _Me=XT(),T2=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function C2(e){let t=new Set([e]),n=new Set,r=e.match(T2);if(!r)return()=>!1;let o={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(o.prerelease!=null)return function(c){return c===e};function s(a){return n.add(a),!1}function i(a){return t.add(a),!0}return function(c){if(t.has(c))return!0;if(n.has(c))return!1;let l=c.match(T2);if(!l)return s(c);let u={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};if(u.prerelease!=null)return s(c);if(o.major!==u.major)return s(c);if(o.major===0){if(o.minor===u.minor&&o.patch<=u.patch)return i(c);return s(c)}if(o.minor<=u.minor)return i(c);return s(c)}}k2._makeCompatibilityCheck=C2;k2.isCompatible=C2(_Me.VERSION)});var ja=T(function(P2){Object.defineProperty(P2,"__esModule",{value:!0});P2.unregisterGlobal=P2.getGlobal=P2.registerGlobal=void 0;var bMe=v2(),pu=XT(),SMe=O2(),EMe=pu.VERSION.split(".")[0],Nf=Symbol.for(`opentelemetry.js.api.${EMe}`),Uf=bMe._globalThis;function xMe(e,t,n,r=!1){var o;let s=Uf[Nf]=(o=Uf[Nf])!==null&&o!==void 0?o:{version:pu.VERSION};if(!r&&s[e]){let i=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(i.stack||i.message),!1}if(s.version!==pu.VERSION){let i=Error(`@opentelemetry/api: Registration of version v${s.version} for ${e} does not match previously registered API v${pu.VERSION}`);return n.error(i.stack||i.message),!1}return s[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${pu.VERSION}.`),!0}P2.registerGlobal=xMe;function vMe(e){var t,n;let r=(t=Uf[Nf])===null||t===void 0?void 0:t.version;if(!r||!(0,SMe.isCompatible)(r))return;return(n=Uf[Nf])===null||n===void 0?void 0:n[e]}P2.getGlobal=vMe;function wMe(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${pu.VERSION}.`);let n=Uf[Nf];if(n)delete n[e]}P2.unregisterGlobal=wMe});var N2=T(function(L2){Object.defineProperty(L2,"__esModule",{value:!0});L2.DiagComponentLogger=void 0;var CMe=ja();class D2{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return Ff("debug",this._namespace,e)}error(...e){return Ff("error",this._namespace,e)}info(...e){return Ff("info",this._namespace,e)}warn(...e){return Ff("warn",this._namespace,e)}verbose(...e){return Ff("verbose",this._namespace,e)}}L2.DiagComponentLogger=D2;function Ff(e,t,n){let r=(0,CMe.getGlobal)("diag");if(!r)return;return n.unshift(t),r[e](...n)}});var ly=T(function(U2){Object.defineProperty(U2,"__esModule",{value:!0});U2.DiagLogLevel=void 0;var kMe;(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(kMe=U2.DiagLogLevel||(U2.DiagLogLevel={}))});var $2=T(function(F2){Object.defineProperty(F2,"__esModule",{value:!0});F2.createLogLevelDiagLogger=void 0;var As=ly();function RMe(e,t){if(e<As.DiagLogLevel.NONE)e=As.DiagLogLevel.NONE;else if(e>As.DiagLogLevel.ALL)e=As.DiagLogLevel.ALL;t=t||{};function n(r,o){let s=t[r];if(typeof s==="function"&&e>=o)return s.bind(t);return function(){}}return{error:n("error",As.DiagLogLevel.ERROR),warn:n("warn",As.DiagLogLevel.WARN),info:n("info",As.DiagLogLevel.INFO),debug:n("debug",As.DiagLogLevel.DEBUG),verbose:n("verbose",As.DiagLogLevel.VERBOSE)}}F2.createLogLevelDiagLogger=RMe});var $a=T(function(H2){Object.defineProperty(H2,"__esModule",{value:!0});H2.DiagAPI=void 0;var OMe=N2(),PMe=$2(),z2=ly(),uy=ja(),IMe="diag";class eC{constructor(){function e(r){return function(...o){let s=(0,uy.getGlobal)("diag");if(!s)return;return s[r](...o)}}let t=this,n=(r,o={logLevel:z2.DiagLogLevel.INFO})=>{var s,i,a;if(r===t){let u=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error((s=u.stack)!==null&&s!==void 0?s:u.message),!1}if(typeof o==="number")o={logLevel:o};let c=(0,uy.getGlobal)("diag"),l=(0,PMe.createLogLevelDiagLogger)((i=o.logLevel)!==null&&i!==void 0?i:z2.DiagLogLevel.INFO,r);if(c&&!o.suppressOverrideMessage){let u=(a=Error().stack)!==null&&a!==void 0?a:"<failed to generate stacktrace>";c.warn(`Current logger will be overwritten from ${u}`),l.warn(`Current logger will overwrite one already registered from ${u}`)}return(0,uy.registerGlobal)("diag",l,t,!0)};t.setLogger=n,t.disable=()=>{(0,uy.unregisterGlobal)(IMe,t)},t.createComponentLogger=(r)=>new OMe.DiagComponentLogger(r),t.verbose=e("verbose"),t.debug=e("debug"),t.info=e("info"),t.warn=e("warn"),t.error=e("error")}static instance(){if(!this._instance)this._instance=new eC;return this._instance}}H2.DiagAPI=eC});var W2=T(function(K2){Object.defineProperty(K2,"__esModule",{value:!0});K2.BaggageImpl=void 0;class fu{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(!t)return;return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries()).map(([e,t])=>[e,t])}setEntry(e,t){let n=new fu(this._entries);return n._entries.set(e,t),n}removeEntry(e){let t=new fu(this._entries);return t._entries.delete(e),t}removeEntries(...e){let t=new fu(this._entries);for(let n of e)t._entries.delete(n);return t}clear(){return new fu}}K2.BaggageImpl=fu});var Z2=T(function(q2){Object.defineProperty(q2,"__esModule",{value:!0});q2.baggageEntryMetadataSymbol=void 0;q2.baggageEntryMetadataSymbol=Symbol("BaggageEntryMetadata")});var tC=T(function(Y2){Object.defineProperty(Y2,"__esModule",{value:!0});Y2.baggageEntryMetadataFromString=Y2.createBaggage=void 0;var DMe=$a(),LMe=W2(),MMe=Z2(),NMe=DMe.DiagAPI.instance();function UMe(e={}){return new LMe.BaggageImpl(new Map(Object.entries(e)))}Y2.createBaggage=UMe;function FMe(e){if(typeof e!=="string")NMe.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e="";return{__TYPE__:MMe.baggageEntryMetadataSymbol,toString(){return e}}}Y2.baggageEntryMetadataFromString=FMe});var jf=T(function(X2){Object.defineProperty(X2,"__esModule",{value:!0});X2.ROOT_CONTEXT=X2.createContextKey=void 0;function $Me(e){return Symbol.for(e)}X2.createContextKey=$Me;class dy{constructor(e){let t=this;t._currentContext=e?new Map(e):new Map,t.getValue=(n)=>t._currentContext.get(n),t.setValue=(n,r)=>{let o=new dy(t._currentContext);return o._currentContext.set(n,r),o},t.deleteValue=(n)=>{let r=new dy(t._currentContext);return r._currentContext.delete(n),r}}}X2.ROOT_CONTEXT=new dy});var rK=T(function(tK){Object.defineProperty(tK,"__esModule",{value:!0});tK.DiagConsoleLogger=void 0;var nC=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}];class eK{constructor(){function e(t){return function(...n){if(console){let r=console[t];if(typeof r!=="function")r=console.log;if(typeof r==="function")return r.apply(console,n)}}}for(let t=0;t<nC.length;t++)this[nC[t].n]=e(nC[t].c)}}tK.DiagConsoleLogger=eK});var dC=T(function(oK){Object.defineProperty(oK,"__esModule",{value:!0});oK.createNoopMeter=oK.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=oK.NOOP_OBSERVABLE_GAUGE_METRIC=oK.NOOP_OBSERVABLE_COUNTER_METRIC=oK.NOOP_UP_DOWN_COUNTER_METRIC=oK.NOOP_HISTOGRAM_METRIC=oK.NOOP_GAUGE_METRIC=oK.NOOP_COUNTER_METRIC=oK.NOOP_METER=oK.NoopObservableUpDownCounterMetric=oK.NoopObservableGaugeMetric=oK.NoopObservableCounterMetric=oK.NoopObservableMetric=oK.NoopHistogramMetric=oK.NoopGaugeMetric=oK.NoopUpDownCounterMetric=oK.NoopCounterMetric=oK.NoopMetric=oK.NoopMeter=void 0;class rC{constructor(){}createGauge(e,t){return oK.NOOP_GAUGE_METRIC}createHistogram(e,t){return oK.NOOP_HISTOGRAM_METRIC}createCounter(e,t){return oK.NOOP_COUNTER_METRIC}createUpDownCounter(e,t){return oK.NOOP_UP_DOWN_COUNTER_METRIC}createObservableGauge(e,t){return oK.NOOP_OBSERVABLE_GAUGE_METRIC}createObservableCounter(e,t){return oK.NOOP_OBSERVABLE_COUNTER_METRIC}createObservableUpDownCounter(e,t){return oK.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}}oK.NoopMeter=rC;class mu{}oK.NoopMetric=mu;class oC extends mu{add(e,t){}}oK.NoopCounterMetric=oC;class sC extends mu{add(e,t){}}oK.NoopUpDownCounterMetric=sC;class iC extends mu{record(e,t){}}oK.NoopGaugeMetric=iC;class aC extends mu{record(e,t){}}oK.NoopHistogramMetric=aC;class $f{addCallback(e){}removeCallback(e){}}oK.NoopObservableMetric=$f;class cC extends $f{}oK.NoopObservableCounterMetric=cC;class lC extends $f{}oK.NoopObservableGaugeMetric=lC;class uC extends $f{}oK.NoopObservableUpDownCounterMetric=uC;oK.NOOP_METER=new rC;oK.NOOP_COUNTER_METRIC=new oC;oK.NOOP_GAUGE_METRIC=new iC;oK.NOOP_HISTOGRAM_METRIC=new aC;oK.NOOP_UP_DOWN_COUNTER_METRIC=new sC;oK.NOOP_OBSERVABLE_COUNTER_METRIC=new cC;oK.NOOP_OBSERVABLE_GAUGE_METRIC=new lC;oK.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=new uC;function HMe(){return oK.NOOP_METER}oK.createNoopMeter=HMe});var hK=T(function(mK){Object.defineProperty(mK,"__esModule",{value:!0});mK.ValueType=void 0;var QMe;(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(QMe=mK.ValueType||(mK.ValueType={}))});var fC=T(function(gK){Object.defineProperty(gK,"__esModule",{value:!0});gK.defaultTextMapSetter=gK.defaultTextMapGetter=void 0;gK.defaultTextMapGetter={get(e,t){if(e==null)return;return e[t]},keys(e){if(e==null)return[];return Object.keys(e)}};gK.defaultTextMapSetter={set(e,t,n){if(e==null)return;e[t]=n}}});var EK=T(function(bK){Object.defineProperty(bK,"__esModule",{value:!0});bK.NoopContextManager=void 0;var tNe=jf();class yK{active(){return tNe.ROOT_CONTEXT}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}bK.NoopContextManager=yK});var zf=T(function(vK){Object.defineProperty(vK,"__esModule",{value:!0});vK.ContextAPI=void 0;var nNe=EK(),mC=ja(),xK=$a(),hC="context",rNe=new nNe.NoopContextManager;class gC{constructor(){}static getInstance(){if(!this._instance)this._instance=new gC;return this._instance}setGlobalContextManager(e){return(0,mC.registerGlobal)(hC,e,xK.DiagAPI.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return(0,mC.getGlobal)(hC)||rNe}disable(){this._getContextManager().disable(),(0,mC.unregisterGlobal)(hC,xK.DiagAPI.instance())}}vK.ContextAPI=gC});var yC=T(function(AK){Object.defineProperty(AK,"__esModule",{value:!0});AK.TraceFlags=void 0;var oNe;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(oNe=AK.TraceFlags||(AK.TraceFlags={}))});var py=T(function(TK){Object.defineProperty(TK,"__esModule",{value:!0});TK.INVALID_SPAN_CONTEXT=TK.INVALID_TRACEID=TK.INVALID_SPANID=void 0;var sNe=yC();TK.INVALID_SPANID="0000000000000000";TK.INVALID_TRACEID="00000000000000000000000000000000";TK.INVALID_SPAN_CONTEXT={traceId:TK.INVALID_TRACEID,spanId:TK.INVALID_SPANID,traceFlags:sNe.TraceFlags.NONE}});var fy=T(function(PK){Object.defineProperty(PK,"__esModule",{value:!0});PK.NonRecordingSpan=void 0;var iNe=py();class OK{constructor(e=iNe.INVALID_SPAN_CONTEXT){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}PK.NonRecordingSpan=OK});var EC=T(function(LK){Object.defineProperty(LK,"__esModule",{value:!0});LK.getSpanContext=LK.setSpanContext=LK.deleteSpan=LK.setSpan=LK.getActiveSpan=LK.getSpan=void 0;var aNe=jf(),cNe=fy(),lNe=zf(),bC=(0,aNe.createContextKey)("OpenTelemetry Context Key SPAN");function SC(e){return e.getValue(bC)||void 0}LK.getSpan=SC;function uNe(){return SC(lNe.ContextAPI.getInstance().active())}LK.getActiveSpan=uNe;function DK(e,t){return e.setValue(bC,t)}LK.setSpan=DK;function dNe(e){return e.deleteValue(bC)}LK.deleteSpan=dNe;function pNe(e,t){return DK(e,new cNe.NonRecordingSpan(t))}LK.setSpanContext=pNe;function fNe(e){var t;return(t=SC(e))===null||t===void 0?void 0:t.spanContext()}LK.getSpanContext=fNe});var my=T(function(jK){Object.defineProperty(jK,"__esModule",{value:!0});jK.wrapSpanContext=jK.isSpanContextValid=jK.isValidSpanId=jK.isValidTraceId=void 0;var NK=py(),bNe=fy(),SNe=/^([0-9a-f]{32})$/i,ENe=/^[0-9a-f]{16}$/i;function UK(e){return SNe.test(e)&&e!==NK.INVALID_TRACEID}jK.isValidTraceId=UK;function FK(e){return ENe.test(e)&&e!==NK.INVALID_SPANID}jK.isValidSpanId=FK;function xNe(e){return UK(e.traceId)&&FK(e.spanId)}jK.isSpanContextValid=xNe;function vNe(e){return new bNe.NonRecordingSpan(e)}jK.wrapSpanContext=vNe});var wC=T(function(BK){Object.defineProperty(BK,"__esModule",{value:!0});BK.NoopTracer=void 0;var CNe=zf(),zK=EC(),xC=fy(),kNe=my(),vC=CNe.ContextAPI.getInstance();class HK{startSpan(e,t,n=vC.active()){if(Boolean(t===null||t===void 0?void 0:t.root))return new xC.NonRecordingSpan;let o=n&&(0,zK.getSpanContext)(n);if(RNe(o)&&(0,kNe.isSpanContextValid)(o))return new xC.NonRecordingSpan(o);else return new xC.NonRecordingSpan}startActiveSpan(e,t,n,r){let o,s,i;if(arguments.length<2)return;else if(arguments.length===2)i=t;else if(arguments.length===3)o=t,i=n;else o=t,s=n,i=r;let a=s!==null&&s!==void 0?s:vC.active(),c=this.startSpan(e,o,a),l=(0,zK.setSpan)(a,c);return vC.with(l,i,void 0,c)}}BK.NoopTracer=HK;function RNe(e){return typeof e==="object"&&typeof e.spanId==="string"&&typeof e.traceId==="string"&&typeof e.traceFlags==="number"}});var AC=T(function(WK){Object.defineProperty(WK,"__esModule",{value:!0});WK.ProxyTracer=void 0;var ONe=wC(),PNe=new ONe.NoopTracer;class GK{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);if(!e)return PNe;return this._delegate=e,this._delegate}}WK.ProxyTracer=GK});var JK=T(function(ZK){Object.defineProperty(ZK,"__esModule",{value:!0});ZK.NoopTracerProvider=void 0;var INe=wC();class VK{getTracer(e,t,n){return new INe.NoopTracer}}ZK.NoopTracerProvider=VK});var TC=T(function(QK){Object.defineProperty(QK,"__esModule",{value:!0});QK.ProxyTracerProvider=void 0;var DNe=AC(),LNe=JK(),MNe=new LNe.NoopTracerProvider;class XK{getTracer(e,t,n){var r;return(r=this.getDelegateTracer(e,t,n))!==null&&r!==void 0?r:new DNe.ProxyTracer(this,e,t,n)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:MNe}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){var r;return(r=this._delegate)===null||r===void 0?void 0:r.getTracer(e,t,n)}}QK.ProxyTracerProvider=XK});var nG=T(function(tG){Object.defineProperty(tG,"__esModule",{value:!0});tG.SamplingDecision=void 0;var NNe;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(NNe=tG.SamplingDecision||(tG.SamplingDecision={}))});var oG=T(function(rG){Object.defineProperty(rG,"__esModule",{value:!0});rG.SpanKind=void 0;var UNe;(function(e){e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER"})(UNe=rG.SpanKind||(rG.SpanKind={}))});var iG=T(function(sG){Object.defineProperty(sG,"__esModule",{value:!0});sG.SpanStatusCode=void 0;var FNe;(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(FNe=sG.SpanStatusCode||(sG.SpanStatusCode={}))});var lG=T(function(aG){Object.defineProperty(aG,"__esModule",{value:!0});aG.validateValue=aG.validateKey=void 0;var OC="[_0-9a-z-*/]",jNe=`[a-z]${OC}{0,255}`,$Ne=`[a-z0-9]${OC}{0,240}@[a-z]${OC}{0,13}`,zNe=new RegExp(`^(?:${jNe}|${$Ne})$`),HNe=/^[ -~]{0,255}[!-~]$/,BNe=/,|=/;function KNe(e){return zNe.test(e)}aG.validateKey=KNe;function GNe(e){return HNe.test(e)&&!BNe.test(e)}aG.validateValue=GNe});var gG=T(function(mG){Object.defineProperty(mG,"__esModule",{value:!0});mG.TraceStateImpl=void 0;var uG=lG(),dG=32,qNe=512,pG=",",fG="=";class PC{constructor(e){if(this._internalState=new Map,e)this._parse(e)}set(e,t){let n=this._clone();if(n._internalState.has(e))n._internalState.delete(e);return n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,t)=>(e.push(t+fG+this.get(t)),e),[]).join(pG)}_parse(e){if(e.length>qNe)return;if(this._internalState=e.split(pG).reverse().reduce((t,n)=>{let r=n.trim(),o=r.indexOf(fG);if(o!==-1){let s=r.slice(0,o),i=r.slice(o+1,n.length);if((0,uG.validateKey)(s)&&(0,uG.validateValue)(i))t.set(s,i)}return t},new Map),this._internalState.size>dG)this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,dG))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new PC;return e._internalState=new Map(this._internalState),e}}mG.TraceStateImpl=PC});var bG=T(function(_G){Object.defineProperty(_G,"__esModule",{value:!0});_G.createTraceState=void 0;var VNe=gG();function ZNe(e){return new VNe.TraceStateImpl(e)}_G.createTraceState=ZNe});var xG=T(function(SG){Object.defineProperty(SG,"__esModule",{value:!0});SG.context=void 0;var YNe=zf();SG.context=YNe.ContextAPI.getInstance()});var AG=T(function(vG){Object.defineProperty(vG,"__esModule",{value:!0});vG.diag=void 0;var JNe=$a();vG.diag=JNe.DiagAPI.instance()});var kG=T(function(TG){Object.defineProperty(TG,"__esModule",{value:!0});TG.NOOP_METER_PROVIDER=TG.NoopMeterProvider=void 0;var XNe=dC();class IC{getMeter(e,t,n){return XNe.NOOP_METER}}TG.NoopMeterProvider=IC;TG.NOOP_METER_PROVIDER=new IC});var IG=T(function(OG){Object.defineProperty(OG,"__esModule",{value:!0});OG.MetricsAPI=void 0;var eUe=kG(),DC=ja(),RG=$a(),LC="metrics";class MC{constructor(){}static getInstance(){if(!this._instance)this._instance=new MC;return this._instance}setGlobalMeterProvider(e){return(0,DC.registerGlobal)(LC,e,RG.DiagAPI.instance())}getMeterProvider(){return(0,DC.getGlobal)(LC)||eUe.NOOP_METER_PROVIDER}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){(0,DC.unregisterGlobal)(LC,RG.DiagAPI.instance())}}OG.MetricsAPI=MC});var MG=T(function(DG){Object.defineProperty(DG,"__esModule",{value:!0});DG.metrics=void 0;var tUe=IG();DG.metrics=tUe.MetricsAPI.getInstance()});var jG=T(function(UG){Object.defineProperty(UG,"__esModule",{value:!0});UG.NoopTextMapPropagator=void 0;class NG{inject(e,t){}extract(e,t){return e}fields(){return[]}}UG.NoopTextMapPropagator=NG});var BG=T(function(zG){Object.defineProperty(zG,"__esModule",{value:!0});zG.deleteBaggage=zG.setBaggage=zG.getActiveBaggage=zG.getBaggage=void 0;var nUe=zf(),rUe=jf(),NC=(0,rUe.createContextKey)("OpenTelemetry Baggage Key");function $G(e){return e.getValue(NC)||void 0}zG.getBaggage=$G;function oUe(){return $G(nUe.ContextAPI.getInstance().active())}zG.getActiveBaggage=oUe;function sUe(e,t){return e.setValue(NC,t)}zG.setBaggage=sUe;function iUe(e){return e.deleteValue(NC)}zG.deleteBaggage=iUe});var VG=T(function(WG){Object.defineProperty(WG,"__esModule",{value:!0});WG.PropagationAPI=void 0;var UC=ja(),uUe=jG(),KG=fC(),hy=BG(),dUe=tC(),GG=$a(),FC="propagation",pUe=new uUe.NoopTextMapPropagator;class jC{constructor(){this.createBaggage=dUe.createBaggage,this.getBaggage=hy.getBaggage,this.getActiveBaggage=hy.getActiveBaggage,this.setBaggage=hy.setBaggage,this.deleteBaggage=hy.deleteBaggage}static getInstance(){if(!this._instance)this._instance=new jC;return this._instance}setGlobalPropagator(e){return(0,UC.registerGlobal)(FC,e,GG.DiagAPI.instance())}inject(e,t,n=KG.defaultTextMapSetter){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=KG.defaultTextMapGetter){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){(0,UC.unregisterGlobal)(FC,GG.DiagAPI.instance())}_getGlobalPropagator(){return(0,UC.getGlobal)(FC)||pUe}}WG.PropagationAPI=jC});var JG=T(function(ZG){Object.defineProperty(ZG,"__esModule",{value:!0});ZG.propagation=void 0;var fUe=VG();ZG.propagation=fUe.PropagationAPI.getInstance()});var rW=T(function(tW){Object.defineProperty(tW,"__esModule",{value:!0});tW.TraceAPI=void 0;var $C=ja(),XG=TC(),QG=my(),hu=EC(),eW=$a(),zC="trace";class HC{constructor(){this._proxyTracerProvider=new XG.ProxyTracerProvider,this.wrapSpanContext=QG.wrapSpanContext,this.isSpanContextValid=QG.isSpanContextValid,this.deleteSpan=hu.deleteSpan,this.getSpan=hu.getSpan,this.getActiveSpan=hu.getActiveSpan,this.getSpanContext=hu.getSpanContext,this.setSpan=hu.setSpan,this.setSpanContext=hu.setSpanContext}static getInstance(){if(!this._instance)this._instance=new HC;return this._instance}setGlobalTracerProvider(e){let t=(0,$C.registerGlobal)(zC,this._proxyTracerProvider,eW.DiagAPI.instance());if(t)this._proxyTracerProvider.setDelegate(e);return t}getTracerProvider(){return(0,$C.getGlobal)(zC)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){(0,$C.unregisterGlobal)(zC,eW.DiagAPI.instance()),this._proxyTracerProvider=new XG.ProxyTracerProvider}}tW.TraceAPI=HC});var iW=T(function(oW){Object.defineProperty(oW,"__esModule",{value:!0});oW.trace=void 0;var mUe=rW();oW.trace=mUe.TraceAPI.getInstance()});var mW=T(function(nt){Object.defineProperty(nt,"__esModule",{value:!0});nt.trace=nt.propagation=nt.metrics=nt.diag=nt.context=nt.INVALID_SPAN_CONTEXT=nt.INVALID_TRACEID=nt.INVALID_SPANID=nt.isValidSpanId=nt.isValidTraceId=nt.isSpanContextValid=nt.createTraceState=nt.TraceFlags=nt.SpanStatusCode=nt.SpanKind=nt.SamplingDecision=nt.ProxyTracerProvider=nt.ProxyTracer=nt.defaultTextMapSetter=nt.defaultTextMapGetter=nt.ValueType=nt.createNoopMeter=nt.DiagLogLevel=nt.DiagConsoleLogger=nt.ROOT_CONTEXT=nt.createContextKey=nt.baggageEntryMetadataFromString=void 0;var hUe=tC();Object.defineProperty(nt,"baggageEntryMetadataFromString",{enumerable:!0,get:function(){return hUe.baggageEntryMetadataFromString}});var aW=jf();Object.defineProperty(nt,"createContextKey",{enumerable:!0,get:function(){return aW.createContextKey}});Object.defineProperty(nt,"ROOT_CONTEXT",{enumerable:!0,get:function(){return aW.ROOT_CONTEXT}});var gUe=rK();Object.defineProperty(nt,"DiagConsoleLogger",{enumerable:!0,get:function(){return gUe.DiagConsoleLogger}});var _Ue=ly();Object.defineProperty(nt,"DiagLogLevel",{enumerable:!0,get:function(){return _Ue.DiagLogLevel}});var yUe=dC();Object.defineProperty(nt,"createNoopMeter",{enumerable:!0,get:function(){return yUe.createNoopMeter}});var bUe=hK();Object.defineProperty(nt,"ValueType",{enumerable:!0,get:function(){return bUe.ValueType}});var cW=fC();Object.defineProperty(nt,"defaultTextMapGetter",{enumerable:!0,get:function(){return cW.defaultTextMapGetter}});Object.defineProperty(nt,"defaultTextMapSetter",{enumerable:!0,get:function(){return cW.defaultTextMapSetter}});var SUe=AC();Object.defineProperty(nt,"ProxyTracer",{enumerable:!0,get:function(){return SUe.ProxyTracer}});var EUe=TC();Object.defineProperty(nt,"ProxyTracerProvider",{enumerable:!0,get:function(){return EUe.ProxyTracerProvider}});var xUe=nG();Object.defineProperty(nt,"SamplingDecision",{enumerable:!0,get:function(){return xUe.SamplingDecision}});var vUe=oG();Object.defineProperty(nt,"SpanKind",{enumerable:!0,get:function(){return vUe.SpanKind}});var wUe=iG();Object.defineProperty(nt,"SpanStatusCode",{enumerable:!0,get:function(){return wUe.SpanStatusCode}});var AUe=yC();Object.defineProperty(nt,"TraceFlags",{enumerable:!0,get:function(){return AUe.TraceFlags}});var TUe=bG();Object.defineProperty(nt,"createTraceState",{enumerable:!0,get:function(){return TUe.createTraceState}});var BC=my();Object.defineProperty(nt,"isSpanContextValid",{enumerable:!0,get:function(){return BC.isSpanContextValid}});Object.defineProperty(nt,"isValidTraceId",{enumerable:!0,get:function(){return BC.isValidTraceId}});Object.defineProperty(nt,"isValidSpanId",{enumerable:!0,get:function(){return BC.isValidSpanId}});var KC=py();Object.defineProperty(nt,"INVALID_SPANID",{enumerable:!0,get:function(){return KC.INVALID_SPANID}});Object.defineProperty(nt,"INVALID_TRACEID",{enumerable:!0,get:function(){return KC.INVALID_TRACEID}});Object.defineProperty(nt,"INVALID_SPAN_CONTEXT",{enumerable:!0,get:function(){return KC.INVALID_SPAN_CONTEXT}});var lW=xG();Object.defineProperty(nt,"context",{enumerable:!0,get:function(){return lW.context}});var uW=AG();Object.defineProperty(nt,"diag",{enumerable:!0,get:function(){return uW.diag}});var dW=MG();Object.defineProperty(nt,"metrics",{enumerable:!0,get:function(){return dW.metrics}});var pW=JG();Object.defineProperty(nt,"propagation",{enumerable:!0,get:function(){return pW.propagation}});var fW=iW();Object.defineProperty(nt,"trace",{enumerable:!0,get:function(){return fW.trace}});nt.default={context:lW.context,diag:uW.diag,metrics:dW.metrics,propagation:pW.propagation,trace:fW.trace}});var xm=T(function(d3){Object.defineProperty(d3,"__esModule",{value:!0});d3.regexpCode=d3.getEsmExportName=d3.getProperty=d3.safeStringify=d3.stringify=d3.strConcat=d3.addCodeArg=d3.str=d3._=d3.nil=d3._Code=d3.Name=d3.IDENTIFIER=d3._CodeOrName=void 0;class Ob{}d3._CodeOrName=Ob;d3.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Nu extends Ob{constructor(e){super();if(!d3.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}d3.Name=Nu;class To extends Ob{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,n)=>`${t}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,n)=>{if(n instanceof Nu)t[n.str]=(t[n.str]||0)+1;return t},{})}}d3._Code=To;d3.nil=new To("");function l3(e,...t){let n=[e[0]],r=0;while(r<t.length)VO(n,t[r]),n.push(e[++r]);return new To(n)}d3._=l3;var qO=new To("+");function u3(e,...t){let n=[Em(e[0])],r=0;while(r<t.length)n.push(qO),VO(n,t[r]),n.push(qO,Em(e[++r]));return rBe(n),new To(n)}d3.str=u3;function VO(e,t){if(t instanceof To)e.push(...t._items);else if(t instanceof Nu)e.push(t);else e.push(iBe(t))}d3.addCodeArg=VO;function rBe(e){let t=1;while(t<e.length-1){if(e[t]===qO){let n=oBe(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}function oBe(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof Nu||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Nu))return`"${e}${t.slice(1)}`;return}function sBe(e,t){return t.emptyStr()?e:e.emptyStr()?t:u3`${e}${t}`}d3.strConcat=sBe;function iBe(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Em(Array.isArray(e)?e.join(","):e)}function aBe(e){return new To(Em(e))}d3.stringify=aBe;function Em(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}d3.safeStringify=Em;function cBe(e){return typeof e=="string"&&d3.IDENTIFIER.test(e)?new To(`.${e}`):l3`[${e}]`}d3.getProperty=cBe;function lBe(e){if(typeof e=="string"&&d3.IDENTIFIER.test(e))return new To(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}d3.getEsmExportName=lBe;function uBe(e){return new To(e.toString())}d3.regexpCode=uBe});var XO=T(function(h3){Object.defineProperty(h3,"__esModule",{value:!0});h3.ValueScope=h3.ValueScopeName=h3.Scope=h3.varKinds=h3.UsedValueState=void 0;var or=xm();class f3 extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Ib;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Ib||(h3.UsedValueState=Ib={}));h3.varKinds={const:new or.Name("const"),let:new or.Name("let"),var:new or.Name("var")};class YO{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof or.Name?e:this.name(e)}name(e){return new or.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,n;if(((n=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||n===void 0?void 0:n.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}h3.Scope=YO;class JO extends or.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=or._`.${new or.Name(t)}[${n}]`}}h3.ValueScopeName=JO;var vBe=or._`\n`;class m3 extends YO{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?vBe:or.nil}}get(){return this._scope}name(e){return new JO(e,this._newName(e))}value(e,t){var n;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let r=this.toName(e),{prefix:o}=r,s=(n=t.key)!==null&&n!==void 0?n:t.ref,i=this._values[o];if(i){let l=i.get(s);if(l)return l}else i=this._values[o]=new Map;i.set(s,r);let a=this._scope[o]||(this._scope[o]=[]),c=a.length;return a[c]=t.ref,r.setValue(t,{property:o,itemIndex:c}),r}getValue(e,t){let n=this._values[e];if(!n)return;return n.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(n)=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return or._`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,(r)=>{if(r.value===void 0)throw Error(`CodeGen: name "${r}" has no value`);return r.value.code},t,n)}_reduceValues(e,t,n={},r){let o=or.nil;for(let s in e){let i=e[s];if(!i)continue;let a=n[s]=n[s]||new Map;i.forEach((c)=>{if(a.has(c))return;a.set(c,Ib.Started);let l=t(c);if(l){let u=this.opts.es5?h3.varKinds.var:h3.varKinds.const;o=or._`${o}${u} ${c} = ${l};${this.opts._n}`}else if(l=r===null||r===void 0?void 0:r(c))o=or._`${o}${l}${this.opts._n}`;else throw new f3(c);a.set(c,Ib.Completed)})}return o}}h3.ValueScope=m3});var Pe=T(function(sr){Object.defineProperty(sr,"__esModule",{value:!0});sr.or=sr.and=sr.not=sr.CodeGen=sr.operators=sr.varKinds=sr.ValueScopeName=sr.ValueScope=sr.Scope=sr.Name=sr.regexpCode=sr.stringify=sr.getProperty=sr.nil=sr.strConcat=sr.str=sr._=void 0;var He=xm(),Co=XO(),Di=xm();Object.defineProperty(sr,"_",{enumerable:!0,get:function(){return Di._}});Object.defineProperty(sr,"str",{enumerable:!0,get:function(){return Di.str}});Object.defineProperty(sr,"strConcat",{enumerable:!0,get:function(){return Di.strConcat}});Object.defineProperty(sr,"nil",{enumerable:!0,get:function(){return Di.nil}});Object.defineProperty(sr,"getProperty",{enumerable:!0,get:function(){return Di.getProperty}});Object.defineProperty(sr,"stringify",{enumerable:!0,get:function(){return Di.stringify}});Object.defineProperty(sr,"regexpCode",{enumerable:!0,get:function(){return Di.regexpCode}});Object.defineProperty(sr,"Name",{enumerable:!0,get:function(){return Di.Name}});var Fb=XO();Object.defineProperty(sr,"Scope",{enumerable:!0,get:function(){return Fb.Scope}});Object.defineProperty(sr,"ValueScope",{enumerable:!0,get:function(){return Fb.ValueScope}});Object.defineProperty(sr,"ValueScopeName",{enumerable:!0,get:function(){return Fb.ValueScopeName}});Object.defineProperty(sr,"varKinds",{enumerable:!0,get:function(){return Fb.varKinds}});sr.operators={GT:new He._Code(">"),GTE:new He._Code(">="),LT:new He._Code("<"),LTE:new He._Code("<="),EQ:new He._Code("==="),NEQ:new He._Code("!=="),NOT:new He._Code("!"),OR:new He._Code("||"),AND:new He._Code("&&"),ADD:new He._Code("+")};class Li{optimizeNodes(){return this}optimizeNames(e,t){return this}}class _3 extends Li{constructor(e,t,n){super();this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let n=e?Co.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${r};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=Fu(this.rhs,e,t);return this}get names(){return this.rhs instanceof He._CodeOrName?this.rhs.names:{}}}class tP extends Li{constructor(e,t,n){super();this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof He.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=Fu(this.rhs,e,t),this}get names(){let e=this.lhs instanceof He.Name?{}:{...this.lhs.names};return Ub(e,this.rhs)}}class y3 extends tP{constructor(e,t,n,r){super(e,n,r);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class b3 extends Li{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class S3 extends Li{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class E3 extends Li{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class x3 extends Li{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=Fu(this.code,e,t),this}get names(){return this.code instanceof He._CodeOrName?this.code.names:{}}}class jb extends Li{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let n=e[t].optimizeNodes();if(Array.isArray(n))e.splice(t,1,...n);else if(n)e[t]=n;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;while(r--){let o=n[r];if(o.optimizeNames(e,t))continue;CBe(e,o.names),n.splice(r,1)}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>Xa(e,t.names),{})}}class Mi extends jb{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class v3 extends jb{}class vm extends Mi{}vm.kind="else";class Ls extends Mi{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let n=t.optimizeNodes();t=this.else=Array.isArray(n)?new vm(n):n}if(t){if(e===!1)return t instanceof Ls?t:t.nodes;if(this.nodes.length)return this;return new Ls(k3(e),t instanceof Ls?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=Fu(this.condition,e,t),this}get names(){let e=super.names;if(Ub(e,this.condition),this.else)Xa(e,this.else.names);return e}}Ls.kind="if";class Uu extends Mi{}Uu.kind="for";class w3 extends Uu{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=Fu(this.iteration,e,t),this}get names(){return Xa(super.names,this.iteration.names)}}class A3 extends Uu{constructor(e,t,n,r){super();this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?Co.varKinds.var:this.varKind,{name:n,from:r,to:o}=this;return`for(${t} ${n}=${r}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=Ub(super.names,this.from);return Ub(e,this.to)}}class QO extends Uu{constructor(e,t,n,r){super();this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=Fu(this.iterable,e,t),this}get names(){return Xa(super.names,this.iterable.names)}}class Db extends Mi{constructor(e,t,n){super();this.name=e,this.args=t,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}Db.kind="func";class Lb extends jb{render(e){return"return "+super.render(e)}}Lb.kind="return";class T3 extends Mi{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)===null||n===void 0||n.optimizeNames(e,t),(r=this.finally)===null||r===void 0||r.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)Xa(e,this.catch.names);if(this.finally)Xa(e,this.finally.names);return e}}class Mb extends Mi{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Mb.kind="catch";class Nb extends Mi{render(e){return"finally"+super.render(e)}}Nb.kind="finally";class C3{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
87
- `:""},this._extScope=e,this._scope=new Co.Scope({parent:e}),this._nodes=[new v3]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let o=this._scope.toName(t);if(n!==void 0&&r)this._constants[o.str]=n;return this._leafNode(new _3(e,o,n)),o}const(e,t,n){return this._def(Co.varKinds.const,e,t,n)}let(e,t,n){return this._def(Co.varKinds.let,e,t,n)}var(e,t,n){return this._def(Co.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new tP(e,t,n))}add(e,t){return this._leafNode(new y3(e,sr.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==He.nil)this._leafNode(new x3(e));return this}object(...e){let t=["{"];for(let[n,r]of e){if(t.length>1)t.push(",");if(t.push(n),n!==r||this.opts.es5)t.push(":"),(0,He.addCodeArg)(t,r)}return t.push("}"),new He._Code(t)}if(e,t,n){if(this._blockNode(new Ls(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Ls(e))}else(){return this._elseNode(new vm)}endIf(){return this._endBlockNode(Ls,vm)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new w3(e),t)}forRange(e,t,n,r,o=this.opts.es5?Co.varKinds.var:Co.varKinds.let){let s=this._scope.toName(e);return this._for(new A3(o,s,t,n),()=>r(s))}forOf(e,t,n,r=Co.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=t instanceof He.Name?t:this.var("_arr",t);return this.forRange("_i",0,He._`${s}.length`,(i)=>{this.var(o,He._`${s}[${i}]`),n(o)})}return this._for(new QO("of",r,o,t),()=>n(o))}forIn(e,t,n,r=this.opts.es5?Co.varKinds.var:Co.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,He._`Object.keys(${t})`,n);let o=this._scope.toName(e);return this._for(new QO("in",r,o,t),()=>n(o))}endFor(){return this._endBlockNode(Uu)}label(e){return this._leafNode(new b3(e))}break(e){return this._leafNode(new S3(e))}return(e){let t=new Lb;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Lb)}try(e,t,n){if(!t&&!n)throw Error('CodeGen: "try" without "catch" and "finally"');let r=new T3;if(this._blockNode(r),this.code(e),t){let o=this.name("e");this._currNode=r.catch=new Mb(o),t(o)}if(n)this._currNode=r.finally=new Nb,this.code(n);return this._endBlockNode(Mb,Nb)}throw(e){return this._leafNode(new E3(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=He.nil,n,r){if(this._blockNode(new Db(e,t,n)),r)this.code(r).endFunc();return this}endFunc(){return this._endBlockNode(Db)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof Ls))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}sr.CodeGen=C3;function Xa(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function Ub(e,t){return t instanceof He._CodeOrName?Xa(e,t.names):e}function Fu(e,t,n){if(e instanceof He.Name)return r(e);if(!o(e))return e;return new He._Code(e._items.reduce((s,i)=>{if(i instanceof He.Name)i=r(i);if(i instanceof He._Code)s.push(...i._items);else s.push(i);return s},[]));function r(s){let i=n[s.str];if(i===void 0||t[s.str]!==1)return s;return delete t[s.str],i}function o(s){return s instanceof He._Code&&s._items.some((i)=>i instanceof He.Name&&t[i.str]===1&&n[i.str]!==void 0)}}function CBe(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function k3(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:He._`!${eP(e)}`}sr.not=k3;var kBe=R3(sr.operators.AND);function RBe(...e){return e.reduce(kBe)}sr.and=RBe;var OBe=R3(sr.operators.OR);function PBe(...e){return e.reduce(OBe)}sr.or=PBe;function R3(e){return(t,n)=>t===He.nil?n:n===He.nil?t:He._`${eP(t)} ${e} ${eP(n)}`}function eP(e){return e instanceof He.Name?e:He._`(${e})`}});var Ge=T(function(F3){Object.defineProperty(F3,"__esModule",{value:!0});F3.checkStrictMode=F3.getErrorPath=F3.Type=F3.useFunc=F3.setEvaluated=F3.evaluatedPropsToName=F3.mergeEvaluated=F3.eachItem=F3.unescapeJsonPointer=F3.escapeJsonPointer=F3.escapeFragment=F3.unescapeFragment=F3.schemaRefOrVal=F3.schemaHasRulesButRef=F3.schemaHasRules=F3.checkUnknownRules=F3.alwaysValidSchema=F3.toHash=void 0;var at=Pe(),MBe=xm();function NBe(e){let t={};for(let n of e)t[n]=!0;return t}F3.toHash=NBe;function UBe(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return D3(e,t),!L3(t,e.self.RULES.all)}F3.alwaysValidSchema=UBe;function D3(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema)return;if(typeof t==="boolean")return;let o=r.RULES.keywords;for(let s in t)if(!o[s])U3(e,`unknown keyword: "${s}"`)}F3.checkUnknownRules=D3;function L3(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(t[n])return!0;return!1}F3.schemaHasRules=L3;function FBe(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(n!=="$ref"&&t.all[n])return!0;return!1}F3.schemaHasRulesButRef=FBe;function jBe({topSchemaRef:e,schemaPath:t},n,r,o){if(!o){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return at._`${n}`}return at._`${e}${t}${(0,at.getProperty)(r)}`}F3.schemaRefOrVal=jBe;function $Be(e){return M3(decodeURIComponent(e))}F3.unescapeFragment=$Be;function zBe(e){return encodeURIComponent(rP(e))}F3.escapeFragment=zBe;function rP(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}F3.escapeJsonPointer=rP;function M3(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}F3.unescapeJsonPointer=M3;function HBe(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}F3.eachItem=HBe;function P3({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:r}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof at.Name?(s instanceof at.Name?e(o,s,i):t(o,s,i),i):s instanceof at.Name?(t(o,i,s),s):n(s,i);return a===at.Name&&!(c instanceof at.Name)?r(o,c):c}}F3.mergeEvaluated={props:P3({mergeNames:(e,t,n)=>e.if(at._`${n} !== true && ${t} !== undefined`,()=>{e.if(at._`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,at._`${n} || {}`).code(at._`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if(at._`${n} !== true`,()=>{if(t===!0)e.assign(n,!0);else e.assign(n,at._`${n} || {}`),oP(e,n,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:N3}),items:P3({mergeNames:(e,t,n)=>e.if(at._`${n} !== true && ${t} !== undefined`,()=>e.assign(n,at._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if(at._`${n} !== true`,()=>e.assign(n,t===!0?!0:at._`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function N3(e,t){if(t===!0)return e.var("props",!0);let n=e.var("props",at._`{}`);if(t!==void 0)oP(e,n,t);return n}F3.evaluatedPropsToName=N3;function oP(e,t,n){Object.keys(n).forEach((r)=>e.assign(at._`${t}${(0,at.getProperty)(r)}`,!0))}F3.setEvaluated=oP;var I3={};function BBe(e,t){return e.scopeValue("func",{ref:t,code:I3[t.code]||(I3[t.code]=new MBe._Code(t.code))})}F3.useFunc=BBe;var nP;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(nP||(F3.Type=nP={}));function KBe(e,t,n){if(e instanceof at.Name){let r=t===nP.Num;return n?r?at._`"[" + ${e} + "]"`:at._`"['" + ${e} + "']"`:r?at._`"/" + ${e}`:at._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,at.getProperty)(e).toString():"/"+rP(e)}F3.getErrorPath=KBe;function U3(e,t,n=e.opts.strictSchema){if(!n)return;if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}F3.checkStrictMode=U3});var Ms=T(function($3){Object.defineProperty($3,"__esModule",{value:!0});var Rn=Pe(),c2e={data:new Rn.Name("data"),valCxt:new Rn.Name("valCxt"),instancePath:new Rn.Name("instancePath"),parentData:new Rn.Name("parentData"),parentDataProperty:new Rn.Name("parentDataProperty"),rootData:new Rn.Name("rootData"),dynamicAnchors:new Rn.Name("dynamicAnchors"),vErrors:new Rn.Name("vErrors"),errors:new Rn.Name("errors"),this:new Rn.Name("this"),self:new Rn.Name("self"),scope:new Rn.Name("scope"),json:new Rn.Name("json"),jsonPos:new Rn.Name("jsonPos"),jsonLen:new Rn.Name("jsonLen"),jsonPart:new Rn.Name("jsonPart")};$3.default=c2e});var wm=T(function(K3){Object.defineProperty(K3,"__esModule",{value:!0});K3.extendErrors=K3.resetErrorsCount=K3.reportExtraError=K3.reportError=K3.keyword$DataError=K3.keywordError=void 0;var We=Pe(),zb=Ge(),jn=Ms();K3.keywordError={message:({keyword:e})=>We.str`must pass "${e}" keyword validation`};K3.keyword$DataError={message:({keyword:e,schemaType:t})=>t?We.str`"${e}" keyword must be ${t} ($data)`:We.str`"${e}" keyword is invalid ($data)`};function u2e(e,t=K3.keywordError,n,r){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=B3(e,t,n);if(r!==null&&r!==void 0?r:i||a)z3(s,c);else H3(o,We._`[${c}]`)}K3.reportError=u2e;function d2e(e,t=K3.keywordError,n){let{it:r}=e,{gen:o,compositeRule:s,allErrors:i}=r,a=B3(e,t,n);if(z3(o,a),!(s||i))H3(r,jn.default.vErrors)}K3.reportExtraError=d2e;function p2e(e,t){e.assign(jn.default.errors,t),e.if(We._`${jn.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(We._`${jn.default.vErrors}.length`,t),()=>e.assign(jn.default.vErrors,null)))}K3.resetErrorsCount=p2e;function f2e({gen:e,keyword:t,schemaValue:n,data:r,errsCount:o,it:s}){if(o===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",o,jn.default.errors,(a)=>{if(e.const(i,We._`${jn.default.vErrors}[${a}]`),e.if(We._`${i}.instancePath === undefined`,()=>e.assign(We._`${i}.instancePath`,(0,We.strConcat)(jn.default.instancePath,s.errorPath))),e.assign(We._`${i}.schemaPath`,We.str`${s.errSchemaPath}/${t}`),s.opts.verbose)e.assign(We._`${i}.schema`,n),e.assign(We._`${i}.data`,r)})}K3.extendErrors=f2e;function z3(e,t){let n=e.const("err",t);e.if(We._`${jn.default.vErrors} === null`,()=>e.assign(jn.default.vErrors,We._`[${n}]`),We._`${jn.default.vErrors}.push(${n})`),e.code(We._`${jn.default.errors}++`)}function H3(e,t){let{gen:n,validateName:r,schemaEnv:o}=e;if(o.$async)n.throw(We._`new ${e.ValidationError}(${t})`);else n.assign(We._`${r}.errors`,t),n.return(!1)}var Qa={keyword:new We.Name("keyword"),schemaPath:new We.Name("schemaPath"),params:new We.Name("params"),propertyName:new We.Name("propertyName"),message:new We.Name("message"),schema:new We.Name("schema"),parentSchema:new We.Name("parentSchema")};function B3(e,t,n){let{createErrors:r}=e.it;if(r===!1)return We._`{}`;return m2e(e,t,n)}function m2e(e,t,n={}){let{gen:r,it:o}=e,s=[h2e(o,n),g2e(e,n)];return _2e(e,t,s),r.object(...s)}function h2e({errorPath:e},{instancePath:t}){let n=t?We.str`${e}${(0,zb.getErrorPath)(t,zb.Type.Str)}`:e;return[jn.default.instancePath,(0,We.strConcat)(jn.default.instancePath,n)]}function g2e({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:r}){let o=r?t:We.str`${t}/${e}`;if(n)o=We.str`${o}${(0,zb.getErrorPath)(n,zb.Type.Str)}`;return[Qa.schemaPath,o]}function _2e(e,{params:t,message:n},r){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:p}=a;if(r.push([Qa.keyword,o],[Qa.params,typeof t=="function"?t(e):t||We._`{}`]),c.messages)r.push([Qa.message,typeof n=="function"?n(e):n]);if(c.verbose)r.push([Qa.schema,i],[Qa.parentSchema,We._`${u}${p}`],[jn.default.data,s]);if(l)r.push([Qa.propertyName,l])}});var Z3=T(function(q3){Object.defineProperty(q3,"__esModule",{value:!0});q3.boolOrEmptySchema=q3.topBoolOrEmptySchema=void 0;var x2e=wm(),v2e=Pe(),w2e=Ms(),A2e={message:"boolean schema is false"};function T2e(e){let{gen:t,schema:n,validateName:r}=e;if(n===!1)W3(e,!1);else if(typeof n=="object"&&n.$async===!0)t.return(w2e.default.data);else t.assign(v2e._`${r}.errors`,null),t.return(!0)}q3.topBoolOrEmptySchema=T2e;function C2e(e,t){let{gen:n,schema:r}=e;if(r===!1)n.var(t,!1),W3(e);else n.var(t,!0)}q3.boolOrEmptySchema=C2e;function W3(e,t){let{gen:n,data:r}=e,o={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,x2e.reportError)(o,A2e,void 0,t)}});var iP=T(function(Y3){Object.defineProperty(Y3,"__esModule",{value:!0});Y3.getRules=Y3.isJSONType=void 0;var R2e=["string","number","integer","boolean","null","object","array"],O2e=new Set(R2e);function P2e(e){return typeof e=="string"&&O2e.has(e)}Y3.isJSONType=P2e;function I2e(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Y3.getRules=I2e});var aP=T(function(e9){Object.defineProperty(e9,"__esModule",{value:!0});e9.shouldUseRule=e9.shouldUseGroup=e9.schemaHasRulesForType=void 0;function L2e({schema:e,self:t},n){let r=t.RULES.types[n];return r&&r!==!0&&X3(e,r)}e9.schemaHasRulesForType=L2e;function X3(e,t){return t.rules.some((n)=>Q3(e,n))}e9.shouldUseGroup=X3;function Q3(e,t){var n;return e[t.keyword]!==void 0||((n=t.definition.implements)===null||n===void 0?void 0:n.some((r)=>e[r]!==void 0))}e9.shouldUseRule=Q3});var Am=T(function(s9){Object.defineProperty(s9,"__esModule",{value:!0});s9.reportTypeError=s9.checkDataTypes=s9.checkDataType=s9.coerceAndCheckDataType=s9.getJSONTypes=s9.getSchemaTypes=s9.DataType=void 0;var U2e=iP(),F2e=aP(),j2e=wm(),Ce=Pe(),n9=Ge(),ju;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(ju||(s9.DataType=ju={}));function $2e(e){let t=r9(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}s9.getSchemaTypes=$2e;function r9(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(U2e.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}s9.getJSONTypes=r9;function z2e(e,t){let{gen:n,data:r,opts:o}=e,s=H2e(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,F2e.schemaHasRulesForType)(e,t[0]));if(i){let a=lP(t,r,o.strictNumbers,ju.Wrong);n.if(a,()=>{if(s.length)B2e(e,t,s);else uP(e)})}return i}s9.coerceAndCheckDataType=z2e;var o9=new Set(["string","number","integer","boolean","null"]);function H2e(e,t){return t?e.filter((n)=>o9.has(n)||t==="array"&&n==="array"):[]}function B2e(e,t,n){let{gen:r,data:o,opts:s}=e,i=r.let("dataType",Ce._`typeof ${o}`),a=r.let("coerced",Ce._`undefined`);if(s.coerceTypes==="array")r.if(Ce._`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>r.assign(o,Ce._`${o}[0]`).assign(i,Ce._`typeof ${o}`).if(lP(t,o,s.strictNumbers),()=>r.assign(a,o)));r.if(Ce._`${a} !== undefined`);for(let l of n)if(o9.has(l)||l==="array"&&s.coerceTypes==="array")c(l);r.else(),uP(e),r.endIf(),r.if(Ce._`${a} !== undefined`,()=>{r.assign(o,a),K2e(e,a)});function c(l){switch(l){case"string":r.elseIf(Ce._`${i} == "number" || ${i} == "boolean"`).assign(a,Ce._`"" + ${o}`).elseIf(Ce._`${o} === null`).assign(a,Ce._`""`);return;case"number":r.elseIf(Ce._`${i} == "boolean" || ${o} === null
88
- || (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,Ce._`+${o}`);return;case"integer":r.elseIf(Ce._`${i} === "boolean" || ${o} === null
89
- || (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,Ce._`+${o}`);return;case"boolean":r.elseIf(Ce._`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf(Ce._`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":r.elseIf(Ce._`${o} === "" || ${o} === 0 || ${o} === false`),r.assign(a,null);return;case"array":r.elseIf(Ce._`${i} === "string" || ${i} === "number"
90
- || ${i} === "boolean" || ${o} === null`).assign(a,Ce._`[${o}]`)}}}function K2e({gen:e,parentData:t,parentDataProperty:n},r){e.if(Ce._`${t} !== undefined`,()=>e.assign(Ce._`${t}[${n}]`,r))}function cP(e,t,n,r=ju.Correct){let o=r===ju.Correct?Ce.operators.EQ:Ce.operators.NEQ,s;switch(e){case"null":return Ce._`${t} ${o} null`;case"array":s=Ce._`Array.isArray(${t})`;break;case"object":s=Ce._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i(Ce._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return Ce._`typeof ${t} ${o} ${e}`}return r===ju.Correct?s:(0,Ce.not)(s);function i(a=Ce.nil){return(0,Ce.and)(Ce._`typeof ${t} == "number"`,a,n?Ce._`isFinite(${t})`:Ce.nil)}}s9.checkDataType=cP;function lP(e,t,n,r){if(e.length===1)return cP(e[0],t,n,r);let o,s=(0,n9.toHash)(e);if(s.array&&s.object){let i=Ce._`typeof ${t} != "object"`;o=s.null?i:Ce._`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=Ce.nil;if(s.number)delete s.integer;for(let i in s)o=(0,Ce.and)(o,cP(i,t,n,r));return o}s9.checkDataTypes=lP;var G2e={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?Ce._`{type: ${e}}`:Ce._`{type: ${t}}`};function uP(e){let t=W2e(e);(0,j2e.reportError)(t,G2e)}s9.reportTypeError=uP;function W2e(e){let{gen:t,data:n,schema:r}=e,o=(0,n9.schemaRefOrVal)(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:o,schemaValue:o,parentSchema:r,params:{},it:e}}});var u9=T(function(c9){Object.defineProperty(c9,"__esModule",{value:!0});c9.assignDefaults=void 0;var $u=Pe(),Q2e=Ge();function eKe(e,t){let{properties:n,items:r}=e.schema;if(t==="object"&&n)for(let o in n)a9(e,o,n[o].default);else if(t==="array"&&Array.isArray(r))r.forEach((o,s)=>a9(e,s,o.default))}c9.assignDefaults=eKe;function a9(e,t,n){let{gen:r,compositeRule:o,data:s,opts:i}=e;if(n===void 0)return;let a=$u._`${s}${(0,$u.getProperty)(t)}`;if(o){(0,Q2e.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=$u._`${a} === undefined`;if(i.useDefaults==="empty")c=$u._`${c} || ${a} === null || ${a} === ""`;r.if(c,$u._`${a} = ${(0,$u.stringify)(n)}`)}});var Vr=T(function(f9){Object.defineProperty(f9,"__esModule",{value:!0});f9.validateUnion=f9.validateArray=f9.usePattern=f9.callValidateCode=f9.schemaProperties=f9.allSchemaProperties=f9.noPropertyInData=f9.propertyInData=f9.isOwnProperty=f9.hasPropFunc=f9.reportMissingProp=f9.checkMissingProp=f9.checkReportMissingProp=void 0;var mt=Pe(),dP=Ge(),Ni=Ms(),tKe=Ge();function nKe(e,t){let{gen:n,data:r,it:o}=e;n.if(fP(n,r,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:mt._`${t}`},!0),e.error()})}f9.checkReportMissingProp=nKe;function rKe({gen:e,data:t,it:{opts:n}},r,o){return(0,mt.or)(...r.map((s)=>(0,mt.and)(fP(e,t,s,n.ownProperties),mt._`${o} = ${s}`)))}f9.checkMissingProp=rKe;function oKe(e,t){e.setParams({missingProperty:t},!0),e.error()}f9.reportMissingProp=oKe;function d9(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:mt._`Object.prototype.hasOwnProperty`})}f9.hasPropFunc=d9;function pP(e,t,n){return mt._`${d9(e)}.call(${t}, ${n})`}f9.isOwnProperty=pP;function sKe(e,t,n,r){let o=mt._`${t}${(0,mt.getProperty)(n)} !== undefined`;return r?mt._`${o} && ${pP(e,t,n)}`:o}f9.propertyInData=sKe;function fP(e,t,n,r){let o=mt._`${t}${(0,mt.getProperty)(n)} === undefined`;return r?(0,mt.or)(o,(0,mt.not)(pP(e,t,n))):o}f9.noPropertyInData=fP;function p9(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}f9.allSchemaProperties=p9;function iKe(e,t){return p9(t).filter((n)=>!(0,dP.alwaysValidSchema)(e,t[n]))}f9.schemaProperties=iKe;function aKe({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:o,errorPath:s},it:i},a,c,l){let u=l?mt._`${e}, ${t}, ${r}${o}`:t,p=[[Ni.default.instancePath,(0,mt.strConcat)(Ni.default.instancePath,s)],[Ni.default.parentData,i.parentData],[Ni.default.parentDataProperty,i.parentDataProperty],[Ni.default.rootData,Ni.default.rootData]];if(i.opts.dynamicRef)p.push([Ni.default.dynamicAnchors,Ni.default.dynamicAnchors]);let f=mt._`${u}, ${n.object(...p)}`;return c!==mt.nil?mt._`${a}.call(${c}, ${f})`:mt._`${a}(${f})`}f9.callValidateCode=aKe;var cKe=mt._`new RegExp`;function lKe({gen:e,it:{opts:t}},n){let r=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(n,r);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:mt._`${o.code==="new RegExp"?cKe:(0,tKe.useFunc)(e,o)}(${n}, ${r})`})}f9.usePattern=lKe;function uKe(e){let{gen:t,data:n,keyword:r,it:o}=e,s=t.name("valid");if(o.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",mt._`${n}.length`);t.forRange("i",0,c,(l)=>{e.subschema({keyword:r,dataProp:l,dataPropType:dP.Type.Num},s),t.if((0,mt.not)(s),a)})}}f9.validateArray=uKe;function dKe(e){let{gen:t,schema:n,keyword:r,it:o}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(n.some((c)=>(0,dP.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>n.forEach((c,l)=>{let u=e.subschema({keyword:r,schemaProp:l,compositeRule:!0},a);if(t.assign(i,mt._`${i} || ${a}`),!e.mergeValidEvaluated(u,a))t.if((0,mt.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}f9.validateUnion=dKe});var b9=T(function(_9){Object.defineProperty(_9,"__esModule",{value:!0});_9.validateKeywordUsage=_9.validSchemaType=_9.funcKeywordCode=_9.macroKeywordCode=void 0;var $n=Pe(),ec=Ms(),wKe=Vr(),AKe=wm();function TKe(e,t){let{gen:n,keyword:r,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=g9(n,r,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let l=n.name("valid");e.subschema({schema:a,schemaPath:$n.nil,errSchemaPath:`${i.errSchemaPath}/${r}`,topSchemaRef:c,compositeRule:!0},l),e.pass(l,()=>e.error(!0))}_9.macroKeywordCode=TKe;function CKe(e,t){var n;let{gen:r,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;RKe(c,t);let l=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,u=g9(r,o,l),p=r.let("valid");e.block$data(p,f),e.ok((n=t.valid)!==null&&n!==void 0?n:p);function f(){if(t.errors===!1){if(g(),t.modifying)h9(e);y(()=>e.error())}else{let S=t.async?m():h();if(t.modifying)h9(e);y(()=>kKe(e,S))}}function m(){let S=r.let("ruleErrs",null);return r.try(()=>g($n._`await `),(b)=>r.assign(p,!1).if($n._`${b} instanceof ${c.ValidationError}`,()=>r.assign(S,$n._`${b}.errors`),()=>r.throw(b))),S}function h(){let S=$n._`${u}.errors`;return r.assign(S,null),g($n.nil),S}function g(S=t.async?$n._`await `:$n.nil){let b=c.opts.passContext?ec.default.this:ec.default.self,x=!(("compile"in t)&&!a||t.schema===!1);r.assign(p,$n._`${S}${(0,wKe.callValidateCode)(e,u,b,x)}`,t.modifying)}function y(S){var b;r.if((0,$n.not)((b=t.valid)!==null&&b!==void 0?b:p),S)}}_9.funcKeywordCode=CKe;function h9(e){let{gen:t,data:n,it:r}=e;t.if(r.parentData,()=>t.assign(n,$n._`${r.parentData}[${r.parentDataProperty}]`))}function kKe(e,t){let{gen:n}=e;n.if($n._`Array.isArray(${t})`,()=>{n.assign(ec.default.vErrors,$n._`${ec.default.vErrors} === null ? ${t} : ${ec.default.vErrors}.concat(${t})`).assign(ec.default.errors,$n._`${ec.default.vErrors}.length`),(0,AKe.extendErrors)(e)},()=>e.error())}function RKe({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function g9(e,t,n){if(n===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:(0,$n.stringify)(n)})}function OKe(e,t,n=!1){return!t.length||t.some((r)=>r==="array"?Array.isArray(e):r==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==r||n&&typeof e>"u")}_9.validSchemaType=OKe;function PKe({schema:e,opts:t,self:n,errSchemaPath:r},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw Error("ajv implementation error");let i=o.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema){if(!o.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${r}": `+n.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")n.logger.error(c);else throw Error(c)}}}_9.validateKeywordUsage=PKe});var v9=T(function(E9){Object.defineProperty(E9,"__esModule",{value:!0});E9.extendSubschemaMode=E9.extendSubschemaData=E9.getSubschema=void 0;var ts=Pe(),S9=Ge();function MKe(e,{keyword:t,schemaProp:n,schema:r,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&r!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return n===void 0?{schema:a,schemaPath:ts._`${e.schemaPath}${(0,ts.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[n],schemaPath:ts._`${e.schemaPath}${(0,ts.getProperty)(t)}${(0,ts.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,S9.escapeFragment)(n)}`}}if(r!==void 0){if(o===void 0||s===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw Error('either "keyword" or "schema" must be passed')}E9.getSubschema=MKe;function NKe(e,t,{dataProp:n,dataPropType:r,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&n!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(n!==void 0){let{errorPath:l,dataPathArr:u,opts:p}=t,f=a.let("data",ts._`${t.data}${(0,ts.getProperty)(n)}`,!0);c(f),e.errorPath=ts.str`${l}${(0,S9.getErrorPath)(n,r,p.jsPropertySyntax)}`,e.parentDataProperty=ts._`${n}`,e.dataPathArr=[...u,e.parentDataProperty]}if(o!==void 0){let l=o instanceof ts.Name?o:a.let("data",o,!0);if(c(l),i!==void 0)e.propertyName=i}if(s)e.dataTypes=s;function c(l){e.data=l,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,l]}}E9.extendSubschemaData=NKe;function UKe(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:o,allErrors:s}){if(r!==void 0)e.compositeRule=r;if(o!==void 0)e.createErrors=o;if(s!==void 0)e.allErrors=s;e.jtdDiscriminator=t,e.jtdMetadata=n}E9.extendSubschemaMode=UKe});var mP=T(function(oMt,w9){w9.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,s;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(s=Object.keys(t),r=s.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[o]))return!1;for(o=r;o--!==0;){var i=s[o];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n}});var T9=T(function(sMt,A9){var Ui=A9.exports=function(e,t,n){if(typeof t=="function")n=t,t={};n=t.cb||n;var r=typeof n=="function"?n:n.pre||function(){},o=n.post||function(){};Hb(t,r,o,e,"",e)};Ui.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ui.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ui.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ui.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Hb(e,t,n,r,o,s,i,a,c,l){if(r&&typeof r=="object"&&!Array.isArray(r)){t(r,o,s,i,a,c,l);for(var u in r){var p=r[u];if(Array.isArray(p)){if(u in Ui.arrayKeywords)for(var f=0;f<p.length;f++)Hb(e,t,n,p[f],o+"/"+u+"/"+f,s,o,u,r,f)}else if(u in Ui.propsKeywords){if(p&&typeof p=="object")for(var m in p)Hb(e,t,n,p[m],o+"/"+u+"/"+$Ke(m),s,o,u,r,m)}else if(u in Ui.keywords||e.allKeys&&!(u in Ui.skipKeywords))Hb(e,t,n,p,o+"/"+u,s,o,u,r)}n(r,o,s,i,a,c,l)}}function $Ke(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Tm=T(function(O9){Object.defineProperty(O9,"__esModule",{value:!0});O9.getSchemaRefs=O9.resolveUrl=O9.normalizeId=O9._getFullPath=O9.getFullPath=O9.inlineRef=void 0;var zKe=Ge(),HKe=mP(),BKe=T9(),KKe=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function GKe(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!hP(e);if(!t)return!1;return C9(e)<=t}O9.inlineRef=GKe;var WKe=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function hP(e){for(let t in e){if(WKe.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(hP))return!0;if(typeof n=="object"&&hP(n))return!0}return!1}function C9(e){let t=0;for(let n in e){if(n==="$ref")return 1/0;if(t++,KKe.has(n))continue;if(typeof e[n]=="object")(0,zKe.eachItem)(e[n],(r)=>t+=C9(r));if(t===1/0)return 1/0}return t}function k9(e,t="",n){if(n!==!1)t=zu(t);let r=e.parse(t);return R9(e,r)}O9.getFullPath=k9;function R9(e,t){return e.serialize(t).split("#")[0]+"#"}O9._getFullPath=R9;var qKe=/#\/?$/;function zu(e){return e?e.replace(qKe,""):""}O9.normalizeId=zu;function VKe(e,t,n){return n=zu(n),e.resolve(t,n)}O9.resolveUrl=VKe;var ZKe=/^[a-z_][-a-z0-9._]*$/i;function YKe(e,t){if(typeof e=="boolean")return{};let{schemaId:n,uriResolver:r}=this.opts,o=zu(e[n]||t),s={"":o},i=k9(r,o,!1),a={},c=new Set;return BKe(e,{allKeys:!0},(p,f,m,h)=>{if(h===void 0)return;let g=i+f,y=s[h];if(typeof p[n]=="string")y=S.call(this,p[n]);b.call(this,p.$anchor),b.call(this,p.$dynamicAnchor),s[f]=y;function S(x){let v=this.opts.uriResolver.resolve;if(x=zu(y?v(y,x):x),c.has(x))throw u(x);c.add(x);let A=this.refs[x];if(typeof A=="string")A=this.refs[A];if(typeof A=="object")l(p,A.schema,x);else if(x!==zu(g))if(x[0]==="#")l(p,a[x],x),a[x]=p;else this.refs[x]=g;return x}function b(x){if(typeof x=="string"){if(!ZKe.test(x))throw Error(`invalid anchor "${x}"`);S.call(this,`#${x}`)}}}),a;function l(p,f,m){if(f!==void 0&&!HKe(p,f))throw u(m)}function u(p){return Error(`reference "${p}" resolves to more than one schema`)}}O9.getSchemaRefs=YKe});var Rm=T(function(W9){Object.defineProperty(W9,"__esModule",{value:!0});W9.getData=W9.KeywordCxt=W9.validateFunctionCode=void 0;var N9=Z3(),I9=Am(),_P=aP(),Bb=Am(),nGe=u9(),km=b9(),gP=v9(),le=Pe(),be=Ms(),rGe=Tm(),Ns=Ge(),Cm=wm();function oGe(e){if(j9(e)){if($9(e),F9(e)){aGe(e);return}}U9(e,()=>(0,N9.topBoolOrEmptySchema)(e))}W9.validateFunctionCode=oGe;function U9({gen:e,validateName:t,schema:n,schemaEnv:r,opts:o},s){if(o.code.es5)e.func(t,le._`${be.default.data}, ${be.default.valCxt}`,r.$async,()=>{e.code(le._`"use strict"; ${D9(n,o)}`),iGe(e,o),e.code(s)});else e.func(t,le._`${be.default.data}, ${sGe(o)}`,r.$async,()=>e.code(D9(n,o)).code(s))}function sGe(e){return le._`{${be.default.instancePath}="", ${be.default.parentData}, ${be.default.parentDataProperty}, ${be.default.rootData}=${be.default.data}${e.dynamicRef?le._`, ${be.default.dynamicAnchors}={}`:le.nil}}={}`}function iGe(e,t){e.if(be.default.valCxt,()=>{if(e.var(be.default.instancePath,le._`${be.default.valCxt}.${be.default.instancePath}`),e.var(be.default.parentData,le._`${be.default.valCxt}.${be.default.parentData}`),e.var(be.default.parentDataProperty,le._`${be.default.valCxt}.${be.default.parentDataProperty}`),e.var(be.default.rootData,le._`${be.default.valCxt}.${be.default.rootData}`),t.dynamicRef)e.var(be.default.dynamicAnchors,le._`${be.default.valCxt}.${be.default.dynamicAnchors}`)},()=>{if(e.var(be.default.instancePath,le._`""`),e.var(be.default.parentData,le._`undefined`),e.var(be.default.parentDataProperty,le._`undefined`),e.var(be.default.rootData,be.default.data),t.dynamicRef)e.var(be.default.dynamicAnchors,le._`{}`)})}function aGe(e){let{schema:t,opts:n,gen:r}=e;U9(e,()=>{if(n.$comment&&t.$comment)H9(e);if(pGe(e),r.let(be.default.vErrors,null),r.let(be.default.errors,0),n.unevaluated)cGe(e);z9(e),hGe(e)});return}function cGe(e){let{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",le._`${n}.evaluated`),t.if(le._`${e.evaluated}.dynamicProps`,()=>t.assign(le._`${e.evaluated}.props`,le._`undefined`)),t.if(le._`${e.evaluated}.dynamicItems`,()=>t.assign(le._`${e.evaluated}.items`,le._`undefined`))}function D9(e,t){let n=typeof e=="object"&&e[t.schemaId];return n&&(t.code.source||t.code.process)?le._`/*# sourceURL=${n} */`:le.nil}function lGe(e,t){if(j9(e)){if($9(e),F9(e)){uGe(e,t);return}}(0,N9.boolOrEmptySchema)(e,t)}function F9({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function j9(e){return typeof e.schema!="boolean"}function uGe(e,t){let{schema:n,gen:r,opts:o}=e;if(o.$comment&&n.$comment)H9(e);fGe(e),mGe(e);let s=r.const("_errs",be.default.errors);z9(e,s),r.var(t,le._`${s} === ${be.default.errors}`)}function $9(e){(0,Ns.checkUnknownRules)(e),dGe(e)}function z9(e,t){if(e.opts.jtd)return L9(e,[],!1,t);let n=(0,I9.getSchemaTypes)(e.schema),r=(0,I9.coerceAndCheckDataType)(e,n);L9(e,n,!r,t)}function dGe(e){let{schema:t,errSchemaPath:n,opts:r,self:o}=e;if(t.$ref&&r.ignoreKeywordsWithRef&&(0,Ns.schemaHasRulesButRef)(t,o.RULES))o.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function pGe(e){let{schema:t,opts:n}=e;if(t.default!==void 0&&n.useDefaults&&n.strictSchema)(0,Ns.checkStrictMode)(e,"default is ignored in the schema root")}function fGe(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=(0,rGe.resolveUrl)(e.opts.uriResolver,e.baseId,t)}function mGe(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function H9({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:o}){let s=n.$comment;if(o.$comment===!0)e.code(le._`${be.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=le.str`${r}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(le._`${be.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function hGe(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:o,opts:s}=e;if(n.$async)t.if(le._`${be.default.errors} === 0`,()=>t.return(be.default.data),()=>t.throw(le._`new ${o}(${be.default.vErrors})`));else{if(t.assign(le._`${r}.errors`,be.default.vErrors),s.unevaluated)gGe(e);t.return(le._`${be.default.errors} === 0`)}}function gGe({gen:e,evaluated:t,props:n,items:r}){if(n instanceof le.Name)e.assign(le._`${t}.props`,n);if(r instanceof le.Name)e.assign(le._`${t}.items`,r)}function L9(e,t,n,r){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:l}=e,{RULES:u}=l;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,Ns.schemaHasRulesButRef)(s,u))){o.block(()=>K9(e,"$ref",u.all.$ref.definition));return}if(!c.jtd)_Ge(e,t);o.block(()=>{for(let f of u.rules)p(f);p(u.post)});function p(f){if(!(0,_P.shouldUseGroup)(s,f))return;if(f.type){if(o.if((0,Bb.checkDataType)(f.type,i,c.strictNumbers)),M9(e,f),t.length===1&&t[0]===f.type&&n)o.else(),(0,Bb.reportTypeError)(e);o.endIf()}else M9(e,f);if(!a)o.if(le._`${be.default.errors} === ${r||0}`)}}function M9(e,t){let{gen:n,schema:r,opts:{useDefaults:o}}=e;if(o)(0,nGe.assignDefaults)(e,t.type);n.block(()=>{for(let s of t.rules)if((0,_P.shouldUseRule)(r,s))K9(e,s.keyword,s.definition,t.type)})}function _Ge(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(yGe(e,t),!e.opts.allowUnionTypes)bGe(e,t);SGe(e,e.dataTypes)}function yGe(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((n)=>{if(!B9(e.dataTypes,n))yP(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),xGe(e,t)}function bGe(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))yP(e,"use allowUnionTypes to allow union type keyword")}function SGe(e,t){let n=e.self.RULES.all;for(let r in n){let o=n[r];if(typeof o=="object"&&(0,_P.shouldUseRule)(e.schema,o)){let{type:s}=o.definition;if(s.length&&!s.some((i)=>EGe(t,i)))yP(e,`missing type "${s.join(",")}" for keyword "${r}"`)}}}function EGe(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function B9(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function xGe(e,t){let n=[];for(let r of e.dataTypes)if(B9(t,r))n.push(r);else if(t.includes("integer")&&r==="number")n.push("integer");e.dataTypes=n}function yP(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,Ns.checkStrictMode)(e,t,e.opts.strictTypes)}class bP{constructor(e,t,n){if((0,km.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ns.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",G9(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,km.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",be.default.errors)}result(e,t,n){this.failResult((0,le.not)(e),t,n)}failResult(e,t,n){if(this.gen.if(e),n)n();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult((0,le.not)(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(le._`${t} !== undefined && (${(0,le.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?Cm.reportExtraError:Cm.reportError)(this,this.def.error,t)}$dataError(){(0,Cm.reportError)(this,this.def.$dataError||Cm.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,Cm.resetErrorsCount)(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,n=le.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=le.nil,t=le.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:o,def:s}=this;if(n.if((0,le.or)(le._`${r} === undefined`,t)),e!==le.nil)n.assign(e,!0);if(o.length||s.validateSchema){if(n.elseIf(this.invalid$data()),this.$dataError(),e!==le.nil)n.assign(e,!1)}n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:o}=this;return(0,le.or)(s(),i());function s(){if(n.length){if(!(t instanceof le.Name))throw Error("ajv implementation error");let a=Array.isArray(n)?n:[n];return le._`${(0,Bb.checkDataTypes)(a,t,o.opts.strictNumbers,Bb.DataType.Wrong)}`}return le.nil}function i(){if(r.validateSchema){let a=e.scopeValue("validate$data",{ref:r.validateSchema});return le._`!${a}(${t})`}return le.nil}}subschema(e,t){let n=(0,gP.getSubschema)(this.it,e);(0,gP.extendSubschemaData)(n,this.it,e),(0,gP.extendSubschemaMode)(n,e);let r={...this.it,...n,items:void 0,props:void 0};return lGe(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;if(!n.opts.unevaluated)return;if(n.props!==!0&&e.props!==void 0)n.props=Ns.mergeEvaluated.props(r,e.props,n.props,t);if(n.items!==!0&&e.items!==void 0)n.items=Ns.mergeEvaluated.items(r,e.items,n.items,t)}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,le.Name)),!0}}W9.KeywordCxt=bP;function K9(e,t,n,r){let o=new bP(e,n,t);if("code"in n)n.code(o,r);else if(o.$data&&n.validate)(0,km.funcKeywordCode)(o,n);else if("macro"in n)(0,km.macroKeywordCode)(o,n);else if(n.compile||n.validate)(0,km.funcKeywordCode)(o,n)}var vGe=/^\/(?:[^~]|~0|~1)*$/,wGe=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function G9(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let o,s;if(e==="")return be.default.rootData;if(e[0]==="/"){if(!vGe.test(e))throw Error(`Invalid JSON-pointer: ${e}`);o=e,s=be.default.rootData}else{let l=wGe.exec(e);if(!l)throw Error(`Invalid JSON-pointer: ${e}`);let u=+l[1];if(o=l[2],o==="#"){if(u>=t)throw Error(c("property/index",u));return r[t-u]}if(u>t)throw Error(c("data",u));if(s=n[t-u],!o)return s}let i=s,a=o.split("/");for(let l of a)if(l)s=le._`${s}${(0,le.getProperty)((0,Ns.unescapeJsonPointer)(l))}`,i=le._`${i} && ${s}`;return i;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${t}`}}W9.getData=G9});var Kb=T(function(Z9){Object.defineProperty(Z9,"__esModule",{value:!0});class V9 extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}Z9.default=V9});var Om=T(function(J9){Object.defineProperty(J9,"__esModule",{value:!0});var SP=Tm();class Y9 extends Error{constructor(e,t,n,r){super(r||`can't resolve reference ${n} from id ${t}`);this.missingRef=(0,SP.resolveUrl)(e,t,n),this.missingSchema=(0,SP.normalizeId)((0,SP.getFullPath)(e,this.missingRef))}}J9.default=Y9});var Wb=T(function(eZ){Object.defineProperty(eZ,"__esModule",{value:!0});eZ.resolveSchema=eZ.getCompilingSchema=eZ.resolveRef=eZ.compileSchema=eZ.SchemaEnv=void 0;var ko=Pe(),RGe=Kb(),tc=Ms(),Ro=Tm(),X9=Ge(),OGe=Rm();class Pm{constructor(e){var t;this.refs={},this.dynamicAnchors={};let n;if(typeof e.schema=="object")n=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:(0,Ro.normalizeId)(n===null||n===void 0?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n===null||n===void 0?void 0:n.$async,this.refs={}}}eZ.SchemaEnv=Pm;function xP(e){let t=Q9.call(this,e);if(t)return t;let n=(0,Ro.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:r,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new ko.CodeGen(this.scope,{es5:r,lines:o,ownProperties:s}),a;if(e.$async)a=i.scopeValue("Error",{ref:RGe.default,code:ko._`require("ajv/dist/runtime/validation_error").default`});let c=i.scopeName("validate");e.validateName=c;let l={gen:i,allErrors:this.opts.allErrors,data:tc.default.data,parentData:tc.default.parentData,parentDataProperty:tc.default.parentDataProperty,dataNames:[tc.default.data],dataPathArr:[ko.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,ko.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:ko.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:ko._`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),(0,OGe.validateFunctionCode)(l),i.optimize(this.opts.code.optimize);let p=i.toString();if(u=`${i.scopeRefs(tc.default.scope)}return ${p}`,this.opts.code.process)u=this.opts.code.process(u,e);let m=Function(`${tc.default.self}`,`${tc.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async)m.$async=!0;if(this.opts.code.source===!0)m.source={validateName:c,validateCode:p,scopeValues:i._values};if(this.opts.unevaluated){let{props:h,items:g}=l;if(m.evaluated={props:h instanceof ko.Name?void 0:h,items:g instanceof ko.Name?void 0:g,dynamicProps:h instanceof ko.Name,dynamicItems:g instanceof ko.Name},m.source)m.source.evaluated=(0,ko.stringify)(m.evaluated)}return e.validate=m,e}catch(p){if(delete e.validate,delete e.validateName,u)this.logger.error("Error compiling schema, function code:",u);throw p}finally{this._compilations.delete(e)}}eZ.compileSchema=xP;function PGe(e,t,n){var r;n=(0,Ro.resolveUrl)(this.opts.uriResolver,t,n);let o=e.refs[n];if(o)return o;let s=LGe.call(this,e,n);if(s===void 0){let i=(r=e.localRefs)===null||r===void 0?void 0:r[n],{schemaId:a}=this.opts;if(i)s=new Pm({schema:i,schemaId:a,root:e,baseId:t})}if(s===void 0)return;return e.refs[n]=IGe.call(this,s)}eZ.resolveRef=PGe;function IGe(e){if((0,Ro.inlineRef)(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:xP.call(this,e)}function Q9(e){for(let t of this._compilations)if(DGe(t,e))return t}eZ.getCompilingSchema=Q9;function DGe(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function LGe(e,t){let n;while(typeof(n=this.refs[t])=="string")t=n;return n||this.schemas[t]||Gb.call(this,e,t)}function Gb(e,t){let n=this.opts.uriResolver.parse(t),r=(0,Ro._getFullPath)(this.opts.uriResolver,n),o=(0,Ro.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===o)return EP.call(this,n,e);let s=(0,Ro.normalizeId)(r),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=Gb.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return EP.call(this,n,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)xP.call(this,i);if(s===(0,Ro.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,l=a[c];if(l)o=(0,Ro.resolveUrl)(this.opts.uriResolver,o,l);return new Pm({schema:a,schemaId:c,root:e,baseId:o})}return EP.call(this,n,i)}eZ.resolveSchema=Gb;var MGe=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function EP(e,{baseId:t,schema:n,root:r}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof n==="boolean")return;let c=n[(0,X9.unescapeFragment)(a)];if(c===void 0)return;n=c;let l=typeof n==="object"&&n[this.opts.schemaId];if(!MGe.has(a)&&l)t=(0,Ro.resolveUrl)(this.opts.uriResolver,t,l)}let s;if(typeof n!="boolean"&&n.$ref&&!(0,X9.schemaHasRulesButRef)(n,this.RULES)){let a=(0,Ro.resolveUrl)(this.opts.uriResolver,t,n.$ref);s=Gb.call(this,r,a)}let{schemaId:i}=this.opts;if(s=s||new Pm({schema:n,schemaId:i,root:r,baseId:t}),s.schema!==s.root.schema)return s;return}});var nZ=T(function(dMt,$Ge){$Ge.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var AP=T(function(pMt,cZ){var zGe=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),oZ=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),vP=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),sZ=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),HGe=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function wP(e){let t="",n=0,r=0;for(r=0;r<e.length;r++){if(n=e[r].charCodeAt(0),n===48)continue;if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r]}return t}var BGe=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function rZ(e){return e.length=0,!0}function KGe(e,t,n){if(e.length){let r=wP(e);if(r!=="")t.push(r);else return n.error=!0,!1;e.length=0}return!0}function GGe(e){let t=0,n={error:!1,address:"",zone:""},r=[],o=[],s=!1,i=!1,a=KGe;for(let c=0;c<e.length;c++){let l=e[c];if(l==="["||l==="]")continue;if(l===":"){if(s===!0)i=!0;if(!a(o,r,n))break;if(++t>7){n.error=!0;break}if(c>0&&e[c-1]===":")s=!0;r.push(":");continue}else if(l==="%"){if(!a(o,r,n))break;a=rZ}else{o.push(l);continue}}if(o.length)if(a===rZ)n.zone=o.join("");else if(i)r.push(o.join(""));else r.push(wP(o));return n.address=r.join(""),n}function iZ(e){if(WGe(e,":")<2)return{host:e,isIPV6:!1};let t=GGe(e);if(!t.error){let{address:n,address:r}=t;if(t.zone)n+="%"+t.zone,r+="%25"+t.zone;return{host:n,isIPV6:!0,escapedHost:r}}else return{host:e,isIPV6:!1}}function WGe(e,t){let n=0;for(let r=0;r<e.length;r++)if(e[r]===t)n++;return n}function qGe(e){let t=e,n=[],r=-1,o=0;while(o=t.length){if(o===1)if(t===".")break;else if(t==="/"){n.push("/");break}else{n.push(t);break}else if(o===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){n.push("/");break}}}else if(o===3){if(t==="/.."){if(n.length!==0)n.pop();n.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),n.length!==0)n.pop();continue}}}}if((r=t.indexOf("/",1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join("")}var VGe={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},ZGe=/[@/?#:]/g,YGe=/[@/?#]/g;function aZ(e,t){let n=t?YGe:ZGe;return n.lastIndex=0,e.replace(n,(r)=>VGe[r])}function JGe(e,t=!1){if(e.indexOf("%")===-1)return e;let n="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(vP(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(t&&sZ(i))n+=i;else n+="%"+s;r+=2;continue}}n+=e[r]}return n}function XGe(e){let t="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let r=e.slice(n+1,n+3);if(vP(r)){let o=r.toUpperCase(),s=String.fromCharCode(parseInt(o,16));if(s!=="."&&sZ(s))t+=s;else t+="%"+o;n+=2;continue}}if(HGe(e[n]))t+=e[n];else t+=escape(e[n])}return t}function QGe(e){let t="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let r=e.slice(n+1,n+3);if(vP(r)){t+="%"+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function eWe(e){let t=[];if(e.userinfo!==void 0)t.push(e.userinfo),t.push("@");if(e.host!==void 0){let n=unescape(e.host);if(!oZ(n)){let r=iZ(n);if(r.isIPV6===!0)n=`[${r.escapedHost}]`;else n=aZ(n,!1)}t.push(n)}if(typeof e.port==="number"||typeof e.port==="string")t.push(":"),t.push(String(e.port));return t.length?t.join(""):void 0}cZ.exports={nonSimpleDomain:BGe,recomposeAuthority:eWe,reescapeHostDelimiters:aZ,normalizePercentEncoding:JGe,normalizePathEncoding:XGe,escapePreservingEscapes:QGe,removeDotSegments:qGe,isIPv4:oZ,isUUID:zGe,normalizeIPv6:iZ,stringArrayToHexStripped:wP}});var fZ=T(function(fMt,pZ){var{isUUID:tWe}=AP(),nWe=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,rWe=["http","https","ws","wss","urn","urn:uuid"];function oWe(e){return rWe.indexOf(e)!==-1}function TP(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function lZ(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function uZ(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function sWe(e){return e.secure=TP(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function iWe(e){if(e.port===(TP(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let[t,n]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}function aWe(e,t){if(!e.path)return e.error="URN can not be parsed",e;let n=e.path.match(nWe);if(n){let r=t.scheme||e.scheme||"urn";e.nid=n[1].toLowerCase(),e.nss=n[2];let o=`${r}:${t.nid||e.nid}`,s=CP(o);if(e.path=void 0,s)e=s.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function cWe(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let n=t.scheme||e.scheme||"urn",r=e.nid.toLowerCase(),o=`${n}:${t.nid||r}`,s=CP(o);if(s)e=s.serialize(e,t);let i=e,a=e.nss;return i.path=`${r||t.nid}:${a}`,t.skipEscape=!0,i}function lWe(e,t){let n=e;if(n.uuid=n.nss,n.nss=void 0,!t.tolerant&&(!n.uuid||!tWe(n.uuid)))n.error=n.error||"UUID is not valid.";return n}function uWe(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var dZ={scheme:"http",domainHost:!0,parse:lZ,serialize:uZ},dWe={scheme:"https",domainHost:dZ.domainHost,parse:lZ,serialize:uZ},qb={scheme:"ws",domainHost:!0,parse:sWe,serialize:iWe},pWe={scheme:"wss",domainHost:qb.domainHost,parse:qb.parse,serialize:qb.serialize},fWe={scheme:"urn",parse:aWe,serialize:cWe,skipNormalize:!0},mWe={scheme:"urn:uuid",parse:lWe,serialize:uWe,skipNormalize:!0},Vb={http:dZ,https:dWe,ws:qb,wss:pWe,urn:fWe,"urn:uuid":mWe};Object.setPrototypeOf(Vb,null);function CP(e){return e&&(Vb[e]||Vb[e.toLowerCase()])||void 0}pZ.exports={wsIsSecure:TP,SCHEMES:Vb,isValidSchemeName:oWe,getSchemeHandler:CP}});var bZ=T(function(mMt,Zb){var{normalizeIPv6:hWe,removeDotSegments:Im,recomposeAuthority:gWe,normalizePercentEncoding:_We,normalizePathEncoding:yWe,escapePreservingEscapes:bWe,reescapeHostDelimiters:SWe,isIPv4:EWe,nonSimpleDomain:xWe}=AP(),{SCHEMES:vWe,getSchemeHandler:hZ}=fZ();function wWe(e,t){if(typeof e==="string")e=RWe(e,t);else if(typeof e==="object")e=Hu(nc(e,t),t);return e}function AWe(e,t,n){let r=n?Object.assign({scheme:"null"},n):{scheme:"null"},o=gZ(Hu(e,r),Hu(t,r),r,!0);return r.skipEscape=!0,nc(o,r)}function gZ(e,t,n,r){let o={};if(!r)e=Hu(nc(e,n),n),t=Hu(nc(t,n),n);if(n=n||{},!n.tolerant&&t.scheme)o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Im(t.path||""),o.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Im(t.path||""),o.query=t.query;else{if(!t.path)if(o.path=e.path,t.query!==void 0)o.query=t.query;else o.query=e.query;else{if(t.path[0]==="/")o.path=Im(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)o.path="/"+t.path;else if(!e.path)o.path=t.path;else o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;o.path=Im(o.path)}o.query=t.query}o.userinfo=e.userinfo,o.host=e.host,o.port=e.port}o.scheme=e.scheme}return o.fragment=t.fragment,o}function TWe(e,t,n){let r=mZ(e,n),o=mZ(t,n);return r!==void 0&&o!==void 0&&r.toLowerCase()===o.toLowerCase()}function nc(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},r=Object.assign({},t),o=[],s=hZ(r.scheme||n.scheme);if(s&&s.serialize)s.serialize(n,r);if(n.path!==void 0)if(!r.skipEscape){if(n.path=bWe(n.path),n.scheme!==void 0)n.path=n.path.split("%3A").join(":")}else n.path=_We(n.path);if(r.reference!=="suffix"&&n.scheme)o.push(n.scheme,":");let i=gWe(n);if(i!==void 0){if(r.reference!=="suffix")o.push("//");if(o.push(i),n.path&&n.path[0]!=="/")o.push("/")}if(n.path!==void 0){let a=n.path;if(!r.absolutePath&&(!s||!s.absolutePath))a=Im(a);if(i===void 0&&a[0]==="/"&&a[1]==="/")a="/%2F"+a.slice(2);o.push(a)}if(n.query!==void 0)o.push("?",n.query);if(n.fragment!==void 0)o.push("#",n.fragment);return o.join("")}var CWe=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function kWe(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function _Z(e,t){let n=Object.assign({},t),r={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,s=!1;if(n.reference==="suffix")if(n.scheme)e=n.scheme+":"+e;else e="//"+e;let i=e.match(CWe);if(i){if(r.scheme=i[1],r.userinfo=i[3],r.host=i[4],r.port=parseInt(i[5],10),r.path=i[6]||"",r.query=i[7],r.fragment=i[8],isNaN(r.port))r.port=i[5];let a=kWe(r,i);if(a!==void 0)r.error=r.error||a,o=!0;if(r.host)if(EWe(r.host)===!1){let u=hWe(r.host);r.host=u.host.toLowerCase(),s=u.isIPV6}else s=!0;if(r.scheme===void 0&&r.userinfo===void 0&&r.host===void 0&&r.port===void 0&&r.query===void 0&&!r.path)r.reference="same-document";else if(r.scheme===void 0)r.reference="relative";else if(r.fragment===void 0)r.reference="absolute";else r.reference="uri";if(n.reference&&n.reference!=="suffix"&&n.reference!==r.reference)r.error=r.error||"URI is not a "+n.reference+" reference.";let c=hZ(n.scheme||r.scheme);if(!n.unicodeSupport&&(!c||!c.unicodeSupport)){if(r.host&&(n.domainHost||c&&c.domainHost)&&s===!1&&xWe(r.host))try{r.host=URL.domainToASCII(r.host.toLowerCase())}catch(l){r.error=r.error||"Host's domain name can not be converted to ASCII: "+l}}if(!c||c&&!c.skipNormalize){if(e.indexOf("%")!==-1){if(r.scheme!==void 0)r.scheme=unescape(r.scheme);if(r.host!==void 0)r.host=SWe(unescape(r.host),s)}if(r.path)r.path=yWe(r.path);if(r.fragment)try{r.fragment=encodeURI(decodeURIComponent(r.fragment))}catch{r.error=r.error||"URI malformed"}}if(c&&c.parse)c.parse(r,n)}else r.error=r.error||"URI can not be parsed.";return{parsed:r,malformedAuthorityOrPort:o}}function Hu(e,t){return _Z(e,t).parsed}function RWe(e,t){return yZ(e,t).normalized}function yZ(e,t){let{parsed:n,malformedAuthorityOrPort:r}=_Z(e,t);return{normalized:r?e:nc(n,t),malformedAuthorityOrPort:r}}function mZ(e,t){if(typeof e==="string"){let{normalized:n,malformedAuthorityOrPort:r}=yZ(e,t);return r?void 0:n}if(typeof e==="object")return nc(e,t)}var kP={SCHEMES:vWe,normalize:wWe,resolve:AWe,resolveComponent:gZ,equal:TWe,serialize:nc,parse:Hu};Zb.exports=kP;Zb.exports.default=kP;Zb.exports.fastUri=kP});var xZ=T(function(EZ){Object.defineProperty(EZ,"__esModule",{value:!0});var SZ=bZ();SZ.code='require("ajv/dist/runtime/uri").default';EZ.default=SZ});var OZ=T(function(Us){Object.defineProperty(Us,"__esModule",{value:!0});Us.CodeGen=Us.Name=Us.nil=Us.stringify=Us.str=Us._=Us.KeywordCxt=void 0;var PWe=Rm();Object.defineProperty(Us,"KeywordCxt",{enumerable:!0,get:function(){return PWe.KeywordCxt}});var Bu=Pe();Object.defineProperty(Us,"_",{enumerable:!0,get:function(){return Bu._}});Object.defineProperty(Us,"str",{enumerable:!0,get:function(){return Bu.str}});Object.defineProperty(Us,"stringify",{enumerable:!0,get:function(){return Bu.stringify}});Object.defineProperty(Us,"nil",{enumerable:!0,get:function(){return Bu.nil}});Object.defineProperty(Us,"Name",{enumerable:!0,get:function(){return Bu.Name}});Object.defineProperty(Us,"CodeGen",{enumerable:!0,get:function(){return Bu.CodeGen}});var IWe=Kb(),CZ=Om(),DWe=iP(),Dm=Wb(),LWe=Pe(),Lm=Tm(),Yb=Am(),OP=Ge(),vZ=nZ(),MWe=xZ(),kZ=(e,t)=>new RegExp(e,t);kZ.code="new RegExp";var NWe=["removeAdditional","useDefaults","coerceTypes"],UWe=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),FWe={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},jWe={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},wZ=200;function $We(e){var t,n,r,o,s,i,a,c,l,u,p,f,m,h,g,y,S,b,x,v,A,U,D,F,K;let V=e.strict,ne=(t=e.code)===null||t===void 0?void 0:t.optimize,oe=ne===!0||ne===void 0?1:ne||0,_e=(r=(n=e.code)===null||n===void 0?void 0:n.regExp)!==null&&r!==void 0?r:kZ,ke=(o=e.uriResolver)!==null&&o!==void 0?o:MWe.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:V)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:V)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=e.strictTypes)!==null&&l!==void 0?l:V)!==null&&u!==void 0?u:"log",strictTuples:(f=(p=e.strictTuples)!==null&&p!==void 0?p:V)!==null&&f!==void 0?f:"log",strictRequired:(h=(m=e.strictRequired)!==null&&m!==void 0?m:V)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:oe,regExp:_e}:{optimize:oe,regExp:_e},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:wZ,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:wZ,meta:(S=e.meta)!==null&&S!==void 0?S:!0,messages:(b=e.messages)!==null&&b!==void 0?b:!0,inlineRefs:(x=e.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(v=e.schemaId)!==null&&v!==void 0?v:"$id",addUsedSchema:(A=e.addUsedSchema)!==null&&A!==void 0?A:!0,validateSchema:(U=e.validateSchema)!==null&&U!==void 0?U:!0,validateFormats:(D=e.validateFormats)!==null&&D!==void 0?D:!0,unicodeRegExp:(F=e.unicodeRegExp)!==null&&F!==void 0?F:!0,int32range:(K=e.int32range)!==null&&K!==void 0?K:!0,uriResolver:ke}}class Jb{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...$We(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new LWe.ValueScope({scope:{},prefixes:UWe,es5:t,lines:n}),this.logger=WWe(e.logger);let r=e.validateFormats;if(e.validateFormats=!1,this.RULES=(0,DWe.getRules)(),AZ.call(this,FWe,e,"NOT SUPPORTED"),AZ.call(this,jWe,e,"DEPRECATED","warn"),this._metaOpts=KWe.call(this),e.formats)HWe.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)BWe.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);zWe.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=vZ;if(n==="id")r={...vZ},r.id=r.$id,delete r.$id;if(t&&e)this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);if(!("$async"in n))this.errors=n.errors;return r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(l,u){await o.call(this,l.$schema);let p=this._addSchema(l,u);return p.validate||s.call(this,p)}async function o(l){if(l&&!this.getSchema(l))await r.call(this,{$ref:l},!0)}async function s(l){try{return this._compileSchemaEnv(l)}catch(u){if(!(u instanceof CZ.default))throw u;return i.call(this,u),await a.call(this,u.missingSchema),s.call(this,l)}}function i({missingSchema:l,missingRef:u}){if(this.refs[l])throw Error(`AnySchema ${l} is loaded but ${u} cannot be resolved`)}async function a(l){let u=await c.call(this,l);if(!this.refs[l])await o.call(this,u.$schema);if(!this.refs[l])this.addSchema(u,l,t)}async function c(l){let u=this._loading[l];if(u)return u;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,n,r);return this}let o;if(typeof e==="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw Error(`schema ${s} must be string`)}return t=(0,Lm.normalizeId)(t||o),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw Error(o)}return r}getSchema(e){let t;while(typeof(t=TZ.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new Dm.SchemaEnv({schema:{},schemaId:n});if(t=Dm.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=TZ.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];if(n)n=(0,Lm.normalizeId)(n),delete this.schemas[n],delete this.refs[n];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e=="string"){if(n=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n}else if(typeof e=="object"&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(VWe.call(this,n,t),!t)return(0,OP.eachItem)(n,(o)=>RP.call(this,o)),this;YWe.call(this,t);let r={...t,type:(0,Yb.getJSONTypes)(t.type),schemaType:(0,Yb.getJSONTypes)(t.schemaType)};return(0,OP.eachItem)(n,r.type.length===0?(o)=>RP.call(this,o,r):(o)=>r.type.forEach((s)=>RP.call(this,o,r,s))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let r=n.rules.findIndex((o)=>o.keyword===e);if(r>=0)n.rules.splice(r,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:n="data"}={}){if(!e||e.length===0)return"No errors";return e.map((r)=>`${n}${r.instancePath} ${r.message}`).reduce((r,o)=>r+t+o)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let o=r.split("/").slice(1),s=e;for(let i of o)s=s[i];for(let i in n){let a=n[i];if(typeof a!="object")continue;let{$data:c}=a.definition,l=s[i];if(c&&l)s[i]=RZ(l)}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];if(!t||t.test(n)){if(typeof r=="string")delete e[n];else if(r&&!r.meta)this._cache.delete(r.schema),delete e[n]}}}_addSchema(e,t,n,r=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:i}=this.opts;if(typeof e=="object")s=e[i];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;n=(0,Lm.normalizeId)(s||n);let c=Lm.getSchemaRefs.call(this,e,n);if(a=new Dm.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:n,localRefs:c}),this._cache.set(a.schema,a),o&&!n.startsWith("#")){if(n)this._checkUnique(n);this.refs[n]=a}if(r)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else Dm.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{Dm.compileSchema.call(this,e)}finally{this.opts=t}}}Jb.ValidationError=IWe.default;Jb.MissingRefError=CZ.default;Us.default=Jb;function AZ(e,t,n,r="error"){for(let o in e){let s=o;if(s in t)this.logger[r](`${n}: option ${o}. ${e[s]}`)}}function TZ(e){return e=(0,Lm.normalizeId)(e),this.schemas[e]||this.refs[e]}function zWe(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function HWe(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function BWe(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let n=e[t];if(!n.keyword)n.keyword=t;this.addKeyword(n)}}function KWe(){let e={...this.opts};for(let t of NWe)delete e[t];return e}var GWe={log(){},warn(){},error(){}};function WWe(e){if(e===!1)return GWe;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var qWe=/^[a-z_$][a-z0-9_$:-]*$/i;function VWe(e,t){let{RULES:n}=this;if((0,OP.eachItem)(e,(r)=>{if(n.keywords[r])throw Error(`Keyword ${r} is already defined`);if(!qWe.test(r))throw Error(`Keyword ${r} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function RP(e,t,n){var r;let o=t===null||t===void 0?void 0:t.post;if(n&&o)throw Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===n);if(!i)i={type:n,rules:[]},s.rules.push(i);if(s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,Yb.getJSONTypes)(t.type),schemaType:(0,Yb.getJSONTypes)(t.schemaType)}};if(t.before)ZWe.call(this,i,a,t.before);else i.rules.push(a);s.all[e]=a,(r=t.implements)===null||r===void 0||r.forEach((c)=>this.addKeyword(c))}function ZWe(e,t,n){let r=e.rules.findIndex((o)=>o.keyword===n);if(r>=0)e.rules.splice(r,0,t);else e.rules.push(t),this.logger.warn(`rule ${n} is not defined`)}function YWe(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=RZ(t);e.validateSchema=this.compile(t,!0)}var JWe={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function RZ(e){return{anyOf:[e,JWe]}}});var IZ=T(function(PZ){Object.defineProperty(PZ,"__esModule",{value:!0});var eqe={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};PZ.default=eqe});var FZ=T(function(NZ){Object.defineProperty(NZ,"__esModule",{value:!0});NZ.callRef=NZ.getValidate=void 0;var nqe=Om(),DZ=Vr(),ir=Pe(),Ku=Ms(),LZ=Wb(),Xb=Ge(),rqe={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:n,it:r}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=r,{root:l}=s;if((n==="#"||n==="#/")&&o===l.baseId)return p();let u=LZ.resolveRef.call(c,l,o,n);if(u===void 0)throw new nqe.default(r.opts.uriResolver,o,n);if(u instanceof LZ.SchemaEnv)return f(u);return m(u);function p(){if(s===l)return Qb(e,i,s,s.$async);let h=t.scopeValue("root",{ref:l});return Qb(e,ir._`${h}.validate`,l,l.$async)}function f(h){let g=MZ(e,h);Qb(e,g,h,h.$async)}function m(h){let g=t.scopeValue("schema",a.code.source===!0?{ref:h,code:(0,ir.stringify)(h)}:{ref:h}),y=t.name("valid"),S=e.subschema({schema:h,dataTypes:[],schemaPath:ir.nil,topSchemaRef:g,errSchemaPath:n},y);e.mergeEvaluated(S),e.ok(y)}}};function MZ(e,t){let{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):ir._`${n.scopeValue("wrapper",{ref:t})}.validate`}NZ.getValidate=MZ;function Qb(e,t,n,r){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,l=c.passContext?Ku.default.this:ir.nil;if(r)u();else p();function u(){if(!a.$async)throw Error("async schema referenced by sync schema");let h=o.let("valid");o.try(()=>{if(o.code(ir._`await ${(0,DZ.callValidateCode)(e,t,l)}`),m(t),!i)o.assign(h,!0)},(g)=>{if(o.if(ir._`!(${g} instanceof ${s.ValidationError})`,()=>o.throw(g)),f(g),!i)o.assign(h,!1)}),e.ok(h)}function p(){e.result((0,DZ.callValidateCode)(e,t,l),()=>m(t),()=>f(t))}function f(h){let g=ir._`${h}.errors`;o.assign(Ku.default.vErrors,ir._`${Ku.default.vErrors} === null ? ${g} : ${Ku.default.vErrors}.concat(${g})`),o.assign(Ku.default.errors,ir._`${Ku.default.vErrors}.length`)}function m(h){var g;if(!s.opts.unevaluated)return;let y=(g=n===null||n===void 0?void 0:n.validate)===null||g===void 0?void 0:g.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps){if(y.props!==void 0)s.props=Xb.mergeEvaluated.props(o,y.props,s.props)}else{let S=o.var("props",ir._`${h}.evaluated.props`);s.props=Xb.mergeEvaluated.props(o,S,s.props,ir.Name)}if(s.items!==!0)if(y&&!y.dynamicItems){if(y.items!==void 0)s.items=Xb.mergeEvaluated.items(o,y.items,s.items)}else{let S=o.var("items",ir._`${h}.evaluated.items`);s.items=Xb.mergeEvaluated.items(o,S,s.items,ir.Name)}}}NZ.callRef=Qb;NZ.default=rqe});var $Z=T(function(jZ){Object.defineProperty(jZ,"__esModule",{value:!0});var iqe=IZ(),aqe=FZ(),cqe=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",iqe.default,aqe.default];jZ.default=cqe});var HZ=T(function(zZ){Object.defineProperty(zZ,"__esModule",{value:!0});var eS=Pe(),Fi=eS.operators,tS={maximum:{okStr:"<=",ok:Fi.LTE,fail:Fi.GT},minimum:{okStr:">=",ok:Fi.GTE,fail:Fi.LT},exclusiveMaximum:{okStr:"<",ok:Fi.LT,fail:Fi.GTE},exclusiveMinimum:{okStr:">",ok:Fi.GT,fail:Fi.LTE}},uqe={message:({keyword:e,schemaCode:t})=>eS.str`must be ${tS[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>eS._`{comparison: ${tS[e].okStr}, limit: ${t}}`},dqe={keyword:Object.keys(tS),type:"number",schemaType:"number",$data:!0,error:uqe,code(e){let{keyword:t,data:n,schemaCode:r}=e;e.fail$data(eS._`${n} ${tS[t].fail} ${r} || isNaN(${n})`)}};zZ.default=dqe});var KZ=T(function(BZ){Object.defineProperty(BZ,"__esModule",{value:!0});var Mm=Pe(),fqe={message:({schemaCode:e})=>Mm.str`must be multiple of ${e}`,params:({schemaCode:e})=>Mm._`{multipleOf: ${e}}`},mqe={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:fqe,code(e){let{gen:t,data:n,schemaCode:r,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?Mm._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:Mm._`${i} !== parseInt(${i})`;e.fail$data(Mm._`(${r} === 0 || (${i} = ${n}/${r}, ${a}))`)}};BZ.default=mqe});var qZ=T(function(WZ){Object.defineProperty(WZ,"__esModule",{value:!0});function GZ(e){let t=e.length,n=0,r=0,o;while(r<t)if(n++,o=e.charCodeAt(r++),o>=55296&&o<=56319&&r<t){if(o=e.charCodeAt(r),(o&64512)===56320)r++}return n}WZ.default=GZ;GZ.code='require("ajv/dist/runtime/ucs2length").default'});var ZZ=T(function(VZ){Object.defineProperty(VZ,"__esModule",{value:!0});var rc=Pe(),_qe=Ge(),yqe=qZ(),bqe={message({keyword:e,schemaCode:t}){let n=e==="maxLength"?"more":"fewer";return rc.str`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>rc._`{limit: ${e}}`},Sqe={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:bqe,code(e){let{keyword:t,data:n,schemaCode:r,it:o}=e,s=t==="maxLength"?rc.operators.GT:rc.operators.LT,i=o.opts.unicode===!1?rc._`${n}.length`:rc._`${(0,_qe.useFunc)(e.gen,yqe.default)}(${n})`;e.fail$data(rc._`${i} ${s} ${r}`)}};VZ.default=Sqe});var JZ=T(function(YZ){Object.defineProperty(YZ,"__esModule",{value:!0});var xqe=Vr(),vqe=Ge(),Gu=Pe(),wqe={message:({schemaCode:e})=>Gu.str`must match pattern "${e}"`,params:({schemaCode:e})=>Gu._`{pattern: ${e}}`},Aqe={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:wqe,code(e){let{gen:t,data:n,$data:r,schema:o,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(r){let{regExp:c}=i.opts.code,l=c.code==="new RegExp"?Gu._`new RegExp`:(0,vqe.useFunc)(t,c),u=t.let("valid");t.try(()=>t.assign(u,Gu._`${l}(${s}, ${a}).test(${n})`),()=>t.assign(u,!1)),e.fail$data(Gu._`!${u}`)}else{let c=(0,xqe.usePattern)(e,o);e.fail$data(Gu._`!${c}.test(${n})`)}}};YZ.default=Aqe});var QZ=T(function(XZ){Object.defineProperty(XZ,"__esModule",{value:!0});var Nm=Pe(),Cqe={message({keyword:e,schemaCode:t}){let n=e==="maxProperties"?"more":"fewer";return Nm.str`must NOT have ${n} than ${t} properties`},params:({schemaCode:e})=>Nm._`{limit: ${e}}`},kqe={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Cqe,code(e){let{keyword:t,data:n,schemaCode:r}=e,o=t==="maxProperties"?Nm.operators.GT:Nm.operators.LT;e.fail$data(Nm._`Object.keys(${n}).length ${o} ${r}`)}};XZ.default=kqe});var t5=T(function(e5){Object.defineProperty(e5,"__esModule",{value:!0});var Um=Vr(),Fm=Pe(),Oqe=Ge(),Pqe={message:({params:{missingProperty:e}})=>Fm.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Fm._`{missingProperty: ${e}}`},Iqe={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Pqe,code(e){let{gen:t,schema:n,schemaCode:r,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&n.length===0)return;let c=n.length>=a.loopRequired;if(i.allErrors)l();else u();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:h}=e.it;for(let g of n)if((m===null||m===void 0?void 0:m[g])===void 0&&!h.has(g)){let y=i.schemaEnv.baseId+i.errSchemaPath,S=`required property "${g}" is not defined at "${y}" (strictRequired)`;(0,Oqe.checkStrictMode)(i,S,i.opts.strictRequired)}}function l(){if(c||s)e.block$data(Fm.nil,p);else for(let m of n)(0,Um.checkReportMissingProp)(e,m)}function u(){let m=t.let("missing");if(c||s){let h=t.let("valid",!0);e.block$data(h,()=>f(m,h)),e.ok(h)}else t.if((0,Um.checkMissingProp)(e,n,m)),(0,Um.reportMissingProp)(e,m),t.else()}function p(){t.forOf("prop",r,(m)=>{e.setParams({missingProperty:m}),t.if((0,Um.noPropertyInData)(t,o,m,a.ownProperties),()=>e.error())})}function f(m,h){e.setParams({missingProperty:m}),t.forOf(m,r,()=>{t.assign(h,(0,Um.propertyInData)(t,o,m,a.ownProperties)),t.if((0,Fm.not)(h),()=>{e.error(),t.break()})},Fm.nil)}}};e5.default=Iqe});var r5=T(function(n5){Object.defineProperty(n5,"__esModule",{value:!0});var jm=Pe(),Lqe={message({keyword:e,schemaCode:t}){let n=e==="maxItems"?"more":"fewer";return jm.str`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>jm._`{limit: ${e}}`},Mqe={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Lqe,code(e){let{keyword:t,data:n,schemaCode:r}=e,o=t==="maxItems"?jm.operators.GT:jm.operators.LT;e.fail$data(jm._`${n}.length ${o} ${r}`)}};n5.default=Mqe});var nS=T(function(s5){Object.defineProperty(s5,"__esModule",{value:!0});var o5=mP();o5.code='require("ajv/dist/runtime/equal").default';s5.default=o5});var a5=T(function(i5){Object.defineProperty(i5,"__esModule",{value:!0});var PP=Am(),En=Pe(),Fqe=Ge(),jqe=nS(),$qe={message:({params:{i:e,j:t}})=>En.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>En._`{i: ${e}, j: ${t}}`},zqe={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:$qe,code(e){let{gen:t,data:n,$data:r,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!r&&!o)return;let c=t.let("valid"),l=s.items?(0,PP.getSchemaTypes)(s.items):[];e.block$data(c,u,En._`${i} === false`),e.ok(c);function u(){let h=t.let("i",En._`${n}.length`),g=t.let("j");e.setParams({i:h,j:g}),t.assign(c,!0),t.if(En._`${h} > 1`,()=>(p()?f:m)(h,g))}function p(){return l.length>0&&!l.some((h)=>h==="object"||h==="array")}function f(h,g){let y=t.name("item"),S=(0,PP.checkDataTypes)(l,y,a.opts.strictNumbers,PP.DataType.Wrong),b=t.const("indices",En._`{}`);t.for(En._`;${h}--;`,()=>{if(t.let(y,En._`${n}[${h}]`),t.if(S,En._`continue`),l.length>1)t.if(En._`typeof ${y} == "string"`,En._`${y} += "_"`);t.if(En._`typeof ${b}[${y}] == "number"`,()=>{t.assign(g,En._`${b}[${y}]`),e.error(),t.assign(c,!1).break()}).code(En._`${b}[${y}] = ${h}`)})}function m(h,g){let y=(0,Fqe.useFunc)(t,jqe.default),S=t.name("outer");t.label(S).for(En._`;${h}--;`,()=>t.for(En._`${g} = ${h}; ${g}--;`,()=>t.if(En._`${y}(${n}[${h}], ${n}[${g}])`,()=>{e.error(),t.assign(c,!1).break(S)})))}}};i5.default=zqe});var l5=T(function(c5){Object.defineProperty(c5,"__esModule",{value:!0});var IP=Pe(),Bqe=Ge(),Kqe=nS(),Gqe={message:"must be equal to constant",params:({schemaCode:e})=>IP._`{allowedValue: ${e}}`},Wqe={keyword:"const",$data:!0,error:Gqe,code(e){let{gen:t,data:n,$data:r,schemaCode:o,schema:s}=e;if(r||s&&typeof s=="object")e.fail$data(IP._`!${(0,Bqe.useFunc)(t,Kqe.default)}(${n}, ${o})`);else e.fail(IP._`${s} !== ${n}`)}};c5.default=Wqe});var d5=T(function(u5){Object.defineProperty(u5,"__esModule",{value:!0});var $m=Pe(),Vqe=Ge(),Zqe=nS(),Yqe={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>$m._`{allowedValues: ${e}}`},Jqe={keyword:"enum",schemaType:"array",$data:!0,error:Yqe,code(e){let{gen:t,data:n,$data:r,schema:o,schemaCode:s,it:i}=e;if(!r&&o.length===0)throw Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,l=()=>c!==null&&c!==void 0?c:c=(0,Vqe.useFunc)(t,Zqe.default),u;if(a||r)u=t.let("valid"),e.block$data(u,p);else{if(!Array.isArray(o))throw Error("ajv implementation error");let m=t.const("vSchema",s);u=(0,$m.or)(...o.map((h,g)=>f(m,g)))}e.pass(u);function p(){t.assign(u,!1),t.forOf("v",s,(m)=>t.if($m._`${l()}(${n}, ${m})`,()=>t.assign(u,!0).break()))}function f(m,h){let g=o[h];return typeof g==="object"&&g!==null?$m._`${l()}(${n}, ${m}[${h}])`:$m._`${n} === ${g}`}}};u5.default=Jqe});var f5=T(function(p5){Object.defineProperty(p5,"__esModule",{value:!0});var Qqe=HZ(),eVe=KZ(),tVe=ZZ(),nVe=JZ(),rVe=QZ(),oVe=t5(),sVe=r5(),iVe=a5(),aVe=l5(),cVe=d5(),lVe=[Qqe.default,eVe.default,tVe.default,nVe.default,rVe.default,oVe.default,sVe.default,iVe.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},aVe.default,cVe.default];p5.default=lVe});var LP=T(function(h5){Object.defineProperty(h5,"__esModule",{value:!0});h5.validateAdditionalItems=void 0;var oc=Pe(),DP=Ge(),dVe={message:({params:{len:e}})=>oc.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>oc._`{limit: ${e}}`},pVe={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:dVe,code(e){let{parentSchema:t,it:n}=e,{items:r}=t;if(!Array.isArray(r)){(0,DP.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}m5(e,r)}};function m5(e,t){let{gen:n,schema:r,data:o,keyword:s,it:i}=e;i.items=!0;let a=n.const("len",oc._`${o}.length`);if(r===!1)e.setParams({len:t.length}),e.pass(oc._`${a} <= ${t.length}`);else if(typeof r=="object"&&!(0,DP.alwaysValidSchema)(i,r)){let l=n.var("valid",oc._`${a} <= ${t.length}`);n.if((0,oc.not)(l),()=>c(l)),e.ok(l)}function c(l){n.forRange("i",t.length,a,(u)=>{if(e.subschema({keyword:s,dataProp:u,dataPropType:DP.Type.Num},l),!i.allErrors)n.if((0,oc.not)(l),()=>n.break())})}}h5.validateAdditionalItems=m5;h5.default=pVe});var MP=T(function(b5){Object.defineProperty(b5,"__esModule",{value:!0});b5.validateTuple=void 0;var _5=Pe(),rS=Ge(),mVe=Vr(),hVe={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:n}=e;if(Array.isArray(t))return y5(e,"additionalItems",t);if(n.items=!0,(0,rS.alwaysValidSchema)(n,t))return;e.ok((0,mVe.validateArray)(e))}};function y5(e,t,n=e.schema){let{gen:r,parentSchema:o,data:s,keyword:i,it:a}=e;if(u(o),a.opts.unevaluated&&n.length&&a.items!==!0)a.items=rS.mergeEvaluated.items(r,n.length,a.items);let c=r.name("valid"),l=r.const("len",_5._`${s}.length`);n.forEach((p,f)=>{if((0,rS.alwaysValidSchema)(a,p))return;r.if(_5._`${l} > ${f}`,()=>e.subschema({keyword:i,schemaProp:f,dataProp:f},c)),e.ok(c)});function u(p){let{opts:f,errSchemaPath:m}=a,h=n.length,g=h===p.minItems&&(h===p.maxItems||p[t]===!1);if(f.strictTuples&&!g){let y=`"${i}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;(0,rS.checkStrictMode)(a,y,f.strictTuples)}}}b5.validateTuple=y5;b5.default=hVe});var x5=T(function(E5){Object.defineProperty(E5,"__esModule",{value:!0});var _Ve=MP(),yVe={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>(0,_Ve.validateTuple)(e,"items")};E5.default=yVe});var A5=T(function(w5){Object.defineProperty(w5,"__esModule",{value:!0});var v5=Pe(),SVe=Ge(),EVe=Vr(),xVe=LP(),vVe={message:({params:{len:e}})=>v5.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>v5._`{limit: ${e}}`},wVe={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:vVe,code(e){let{schema:t,parentSchema:n,it:r}=e,{prefixItems:o}=n;if(r.items=!0,(0,SVe.alwaysValidSchema)(r,t))return;if(o)(0,xVe.validateAdditionalItems)(e,o);else e.ok((0,EVe.validateArray)(e))}};w5.default=wVe});var C5=T(function(T5){Object.defineProperty(T5,"__esModule",{value:!0});var Zr=Pe(),oS=Ge(),TVe={message:({params:{min:e,max:t}})=>t===void 0?Zr.str`must contain at least ${e} valid item(s)`:Zr.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?Zr._`{minContains: ${e}}`:Zr._`{minContains: ${e}, maxContains: ${t}}`},CVe={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:TVe,code(e){let{gen:t,schema:n,parentSchema:r,data:o,it:s}=e,i,a,{minContains:c,maxContains:l}=r;if(s.opts.next)i=c===void 0?1:c,a=l;else i=1;let u=t.const("len",Zr._`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,oS.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,oS.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,oS.alwaysValidSchema)(s,n)){let g=Zr._`${u} >= ${i}`;if(a!==void 0)g=Zr._`${g} && ${u} <= ${a}`;e.pass(g);return}s.items=!0;let p=t.name("valid");if(a===void 0&&i===1)m(p,()=>t.if(p,()=>t.break()));else if(i===0){if(t.let(p,!0),a!==void 0)t.if(Zr._`${o}.length > 0`,f)}else t.let(p,!1),f();e.result(p,()=>e.reset());function f(){let g=t.name("_valid"),y=t.let("count",0);m(g,()=>t.if(g,()=>h(y)))}function m(g,y){t.forRange("i",0,u,(S)=>{e.subschema({keyword:"contains",dataProp:S,dataPropType:oS.Type.Num,compositeRule:!0},g),y()})}function h(g){if(t.code(Zr._`${g}++`),a===void 0)t.if(Zr._`${g} >= ${i}`,()=>t.assign(p,!0).break());else if(t.if(Zr._`${g} > ${a}`,()=>t.assign(p,!1).break()),i===1)t.assign(p,!0);else t.if(Zr._`${g} >= ${i}`,()=>t.assign(p,!0))}}};T5.default=CVe});var D5=T(function(O5){Object.defineProperty(O5,"__esModule",{value:!0});O5.validateSchemaDeps=O5.validatePropertyDeps=O5.error=void 0;var NP=Pe(),RVe=Ge(),zm=Vr();O5.error={message:({params:{property:e,depsCount:t,deps:n}})=>{let r=t===1?"property":"properties";return NP.str`must have ${r} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:n,missingProperty:r}})=>NP._`{property: ${e},
91
- missingProperty: ${r},
92
- depsCount: ${t},
93
- deps: ${n}}`};var OVe={keyword:"dependencies",type:"object",schemaType:"object",error:O5.error,code(e){let[t,n]=PVe(e);k5(e,t),R5(e,n)}};function PVe({schema:e}){let t={},n={};for(let r in e){if(r==="__proto__")continue;let o=Array.isArray(e[r])?t:n;o[r]=e[r]}return[t,n]}function k5(e,t=e.schema){let{gen:n,data:r,it:o}=e;if(Object.keys(t).length===0)return;let s=n.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=(0,zm.propertyInData)(n,r,i,o.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors)n.if(c,()=>{for(let l of a)(0,zm.checkReportMissingProp)(e,l)});else n.if(NP._`${c} && (${(0,zm.checkMissingProp)(e,a,s)})`),(0,zm.reportMissingProp)(e,s),n.else()}}O5.validatePropertyDeps=k5;function R5(e,t=e.schema){let{gen:n,data:r,keyword:o,it:s}=e,i=n.name("valid");for(let a in t){if((0,RVe.alwaysValidSchema)(s,t[a]))continue;n.if((0,zm.propertyInData)(n,r,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>n.var(i,!0)),e.ok(i)}}O5.validateSchemaDeps=R5;O5.default=OVe});var N5=T(function(M5){Object.defineProperty(M5,"__esModule",{value:!0});var L5=Pe(),LVe=Ge(),MVe={message:"property name must be valid",params:({params:e})=>L5._`{propertyName: ${e.propertyName}}`},NVe={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:MVe,code(e){let{gen:t,schema:n,data:r,it:o}=e;if((0,LVe.alwaysValidSchema)(o,n))return;let s=t.name("valid");t.forIn("key",r,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,L5.not)(s),()=>{if(e.error(!0),!o.allErrors)t.break()})}),e.ok(s)}};M5.default=NVe});var UP=T(function(U5){Object.defineProperty(U5,"__esModule",{value:!0});var sS=Vr(),Oo=Pe(),FVe=Ms(),iS=Ge(),jVe={message:"must NOT have additional properties",params:({params:e})=>Oo._`{additionalProperty: ${e.additionalProperty}}`},$Ve={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:jVe,code(e){let{gen:t,schema:n,parentSchema:r,data:o,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,iS.alwaysValidSchema)(i,n))return;let l=(0,sS.allSchemaProperties)(r.properties),u=(0,sS.allSchemaProperties)(r.patternProperties);p(),e.ok(Oo._`${s} === ${FVe.default.errors}`);function p(){t.forIn("key",o,(y)=>{if(!l.length&&!u.length)h(y);else t.if(f(y),()=>h(y))})}function f(y){let S;if(l.length>8){let b=(0,iS.schemaRefOrVal)(i,r.properties,"properties");S=(0,sS.isOwnProperty)(t,b,y)}else if(l.length)S=(0,Oo.or)(...l.map((b)=>Oo._`${y} === ${b}`));else S=Oo.nil;if(u.length)S=(0,Oo.or)(S,...u.map((b)=>Oo._`${(0,sS.usePattern)(e,b)}.test(${y})`));return(0,Oo.not)(S)}function m(y){t.code(Oo._`delete ${o}[${y}]`)}function h(y){if(c.removeAdditional==="all"||c.removeAdditional&&n===!1){m(y);return}if(n===!1){if(e.setParams({additionalProperty:y}),e.error(),!a)t.break();return}if(typeof n=="object"&&!(0,iS.alwaysValidSchema)(i,n)){let S=t.name("valid");if(c.removeAdditional==="failing")g(y,S,!1),t.if((0,Oo.not)(S),()=>{e.reset(),m(y)});else if(g(y,S),!a)t.if((0,Oo.not)(S),()=>t.break())}}function g(y,S,b){let x={keyword:"additionalProperties",dataProp:y,dataPropType:iS.Type.Str};if(b===!1)Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(x,S)}}};U5.default=$Ve});var z5=T(function($5){Object.defineProperty($5,"__esModule",{value:!0});var HVe=Rm(),F5=Vr(),FP=Ge(),j5=UP(),BVe={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,parentSchema:r,data:o,it:s}=e;if(s.opts.removeAdditional==="all"&&r.additionalProperties===void 0)j5.default.code(new HVe.KeywordCxt(s,j5.default,"additionalProperties"));let i=(0,F5.allSchemaProperties)(n);for(let p of i)s.definedProperties.add(p);if(s.opts.unevaluated&&i.length&&s.props!==!0)s.props=FP.mergeEvaluated.props(t,(0,FP.toHash)(i),s.props);let a=i.filter((p)=>!(0,FP.alwaysValidSchema)(s,n[p]));if(a.length===0)return;let c=t.name("valid");for(let p of a){if(l(p))u(p);else{if(t.if((0,F5.propertyInData)(t,o,p,s.opts.ownProperties)),u(p),!s.allErrors)t.else().var(c,!0);t.endIf()}e.it.definedProperties.add(p),e.ok(c)}function l(p){return s.opts.useDefaults&&!s.compositeRule&&n[p].default!==void 0}function u(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},c)}}};$5.default=BVe});var W5=T(function(G5){Object.defineProperty(G5,"__esModule",{value:!0});var H5=Vr(),aS=Pe(),B5=Ge(),K5=Ge(),GVe={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,data:r,parentSchema:o,it:s}=e,{opts:i}=s,a=(0,H5.allSchemaProperties)(n),c=a.filter((g)=>(0,B5.alwaysValidSchema)(s,n[g]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let l=i.strictSchema&&!i.allowMatchingProperties&&o.properties,u=t.name("valid");if(s.props!==!0&&!(s.props instanceof aS.Name))s.props=(0,K5.evaluatedPropsToName)(t,s.props);let{props:p}=s;f();function f(){for(let g of a){if(l)m(g);if(s.allErrors)h(g);else t.var(u,!0),h(g),t.if(u)}}function m(g){for(let y in l)if(new RegExp(g).test(y))(0,B5.checkStrictMode)(s,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){t.forIn("key",r,(y)=>{t.if(aS._`${(0,H5.usePattern)(e,g)}.test(${y})`,()=>{let S=c.includes(g);if(!S)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:K5.Type.Str},u);if(s.opts.unevaluated&&p!==!0)t.assign(aS._`${p}[${y}]`,!0);else if(!S&&!s.allErrors)t.if((0,aS.not)(u),()=>t.break())})})}}};G5.default=GVe});var V5=T(function(q5){Object.defineProperty(q5,"__esModule",{value:!0});var qVe=Ge(),VVe={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:n,it:r}=e;if((0,qVe.alwaysValidSchema)(r,n)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};q5.default=VVe});var Y5=T(function(Z5){Object.defineProperty(Z5,"__esModule",{value:!0});var YVe=Vr(),JVe={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:YVe.validateUnion,error:{message:"must match a schema in anyOf"}};Z5.default=JVe});var X5=T(function(J5){Object.defineProperty(J5,"__esModule",{value:!0});var cS=Pe(),QVe=Ge(),e4e={message:"must match exactly one schema in oneOf",params:({params:e})=>cS._`{passingSchemas: ${e.passing}}`},t4e={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:e4e,code(e){let{gen:t,schema:n,parentSchema:r,it:o}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(o.opts.discriminator&&r.discriminator)return;let s=n,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(l),e.result(i,()=>e.reset(),()=>e.error(!0));function l(){s.forEach((u,p)=>{let f;if((0,QVe.alwaysValidSchema)(o,u))t.var(c,!0);else f=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},c);if(p>0)t.if(cS._`${c} && ${i}`).assign(i,!1).assign(a,cS._`[${a}, ${p}]`).else();t.if(c,()=>{if(t.assign(i,!0),t.assign(a,p),f)e.mergeEvaluated(f,cS.Name)})})}}};J5.default=t4e});var eY=T(function(Q5){Object.defineProperty(Q5,"__esModule",{value:!0});var r4e=Ge(),o4e={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw Error("ajv implementation error");let o=t.name("valid");n.forEach((s,i)=>{if((0,r4e.alwaysValidSchema)(r,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};Q5.default=o4e});var oY=T(function(rY){Object.defineProperty(rY,"__esModule",{value:!0});var lS=Pe(),nY=Ge(),i4e={message:({params:e})=>lS.str`must match "${e.ifClause}" schema`,params:({params:e})=>lS._`{failingKeyword: ${e.ifClause}}`},a4e={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:i4e,code(e){let{gen:t,parentSchema:n,it:r}=e;if(n.then===void 0&&n.else===void 0)(0,nY.checkStrictMode)(r,'"if" without "then" and "else" is ignored');let o=tY(r,"then"),s=tY(r,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),o&&s){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,l("then",u),l("else",u))}else if(o)t.if(a,l("then"));else t.if((0,lS.not)(a),l("else"));e.pass(i,()=>e.error(!0));function c(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function l(u,p){return()=>{let f=e.subschema({keyword:u},a);if(t.assign(i,a),e.mergeValidEvaluated(f,i),p)t.assign(p,lS._`${u}`);else e.setParams({ifClause:u})}}}};function tY(e,t){let n=e.schema[t];return n!==void 0&&!(0,nY.alwaysValidSchema)(e,n)}rY.default=a4e});var iY=T(function(sY){Object.defineProperty(sY,"__esModule",{value:!0});var l4e=Ge(),u4e={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){if(t.if===void 0)(0,l4e.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};sY.default=u4e});var cY=T(function(aY){Object.defineProperty(aY,"__esModule",{value:!0});var p4e=LP(),f4e=x5(),m4e=MP(),h4e=A5(),g4e=C5(),_4e=D5(),y4e=N5(),b4e=UP(),S4e=z5(),E4e=W5(),x4e=V5(),v4e=Y5(),w4e=X5(),A4e=eY(),T4e=oY(),C4e=iY();function k4e(e=!1){let t=[x4e.default,v4e.default,w4e.default,A4e.default,T4e.default,C4e.default,y4e.default,b4e.default,_4e.default,S4e.default,E4e.default];if(e)t.push(f4e.default,h4e.default);else t.push(p4e.default,m4e.default);return t.push(g4e.default),t}aY.default=k4e});var uY=T(function(lY){Object.defineProperty(lY,"__esModule",{value:!0});var Bt=Pe(),O4e={message:({schemaCode:e})=>Bt.str`must match format "${e}"`,params:({schemaCode:e})=>Bt._`{format: ${e}}`},P4e={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:O4e,code(e,t){let{gen:n,data:r,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:l,schemaEnv:u,self:p}=a;if(!c.validateFormats)return;if(o)f();else m();function f(){let h=n.scopeValue("formats",{ref:p.formats,code:c.code.formats}),g=n.const("fDef",Bt._`${h}[${i}]`),y=n.let("fType"),S=n.let("format");n.if(Bt._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>n.assign(y,Bt._`${g}.type || "string"`).assign(S,Bt._`${g}.validate`),()=>n.assign(y,Bt._`"string"`).assign(S,g)),e.fail$data((0,Bt.or)(b(),x()));function b(){if(c.strictSchema===!1)return Bt.nil;return Bt._`${i} && !${S}`}function x(){let v=u.$async?Bt._`(${g}.async ? await ${S}(${r}) : ${S}(${r}))`:Bt._`${S}(${r})`,A=Bt._`(typeof ${S} == "function" ? ${v} : ${S}.test(${r}))`;return Bt._`${S} && ${S} !== true && ${y} === ${t} && !${A}`}}function m(){let h=p.formats[s];if(!h){b();return}if(h===!0)return;let[g,y,S]=x(h);if(g===t)e.pass(v());function b(){if(c.strictSchema===!1){p.logger.warn(A());return}throw Error(A());function A(){return`unknown format "${s}" ignored in schema at path "${l}"`}}function x(A){let U=A instanceof RegExp?(0,Bt.regexpCode)(A):c.code.formats?Bt._`${c.code.formats}${(0,Bt.getProperty)(s)}`:void 0,D=n.scopeValue("formats",{key:s,ref:A,code:U});if(typeof A=="object"&&!(A instanceof RegExp))return[A.type||"string",A.validate,Bt._`${D}.validate`];return["string",A,D]}function v(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!u.$async)throw Error("async format in sync schema");return Bt._`await ${S}(${r})`}return typeof y=="function"?Bt._`${S}(${r})`:Bt._`${S}.test(${r})`}}}};lY.default=P4e});var pY=T(function(dY){Object.defineProperty(dY,"__esModule",{value:!0});var D4e=uY(),L4e=[D4e.default];dY.default=L4e});var hY=T(function(fY){Object.defineProperty(fY,"__esModule",{value:!0});fY.contentVocabulary=fY.metadataVocabulary=void 0;fY.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];fY.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var yY=T(function(_Y){Object.defineProperty(_Y,"__esModule",{value:!0});var U4e=$Z(),F4e=f5(),j4e=cY(),$4e=pY(),gY=hY(),z4e=[U4e.default,F4e.default,(0,j4e.default)(),$4e.default,gY.metadataVocabulary,gY.contentVocabulary];_Y.default=z4e});var xY=T(function(SY){Object.defineProperty(SY,"__esModule",{value:!0});SY.DiscrError=void 0;var bY;(function(e){e.Tag="tag",e.Mapping="mapping"})(bY||(SY.DiscrError=bY={}))});var AY=T(function(wY){Object.defineProperty(wY,"__esModule",{value:!0});var Wu=Pe(),jP=xY(),vY=Wb(),B4e=Om(),K4e=Ge(),G4e={message:({params:{discrError:e,tagName:t}})=>e===jP.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>Wu._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},W4e={keyword:"discriminator",type:"object",schemaType:"object",error:G4e,code(e){let{gen:t,data:n,schema:r,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=r.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(r.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),l=t.const("tag",Wu._`${n}${(0,Wu.getProperty)(a)}`);t.if(Wu._`typeof ${l} == "string"`,()=>u(),()=>e.error(!1,{discrError:jP.DiscrError.Tag,tag:l,tagName:a})),e.ok(c);function u(){let m=f();t.if(!1);for(let h in m)t.elseIf(Wu._`${l} === ${h}`),t.assign(c,p(m[h]));t.else(),e.error(!1,{discrError:jP.DiscrError.Mapping,tag:l,tagName:a}),t.endIf()}function p(m){let h=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:m},h);return e.mergeEvaluated(g,Wu.Name),h}function f(){var m;let h={},g=S(o),y=!0;for(let v=0;v<i.length;v++){let A=i[v];if((A===null||A===void 0?void 0:A.$ref)&&!(0,K4e.schemaHasRulesButRef)(A,s.self.RULES)){let D=A.$ref;if(A=vY.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,D),A instanceof vY.SchemaEnv)A=A.schema;if(A===void 0)throw new B4e.default(s.opts.uriResolver,s.baseId,D)}let U=(m=A===null||A===void 0?void 0:A.properties)===null||m===void 0?void 0:m[a];if(typeof U!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(g||S(A)),b(U,v)}if(!y)throw Error(`discriminator: "${a}" must be required`);return h;function S({required:v}){return Array.isArray(v)&&v.includes(a)}function b(v,A){if(v.const)x(v.const,A);else if(v.enum)for(let U of v.enum)x(U,A);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function x(v,A){if(typeof v!="string"||v in h)throw Error(`discriminator: "${a}" values must be unique strings`);h[v]=A}}}};wY.default=W4e});var TY=T(function(cNt,V4e){V4e.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var zP=T(function(ar,$P){Object.defineProperty(ar,"__esModule",{value:!0});ar.MissingRefError=ar.ValidationError=ar.CodeGen=ar.Name=ar.nil=ar.stringify=ar.str=ar._=ar.KeywordCxt=ar.Ajv=void 0;var Z4e=OZ(),Y4e=yY(),J4e=AY(),CY=TY(),X4e=["/properties"],uS="http://json-schema.org/draft-07/schema";class Hm extends Z4e.default{_addVocabularies(){if(super._addVocabularies(),Y4e.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(J4e.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(CY,X4e):CY;this.addMetaSchema(e,uS,!1),this.refs["http://json-schema.org/schema"]=uS}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(uS)?uS:void 0)}}ar.Ajv=Hm;$P.exports=ar=Hm;$P.exports.Ajv=Hm;Object.defineProperty(ar,"__esModule",{value:!0});ar.default=Hm;var Q4e=Rm();Object.defineProperty(ar,"KeywordCxt",{enumerable:!0,get:function(){return Q4e.KeywordCxt}});var qu=Pe();Object.defineProperty(ar,"_",{enumerable:!0,get:function(){return qu._}});Object.defineProperty(ar,"str",{enumerable:!0,get:function(){return qu.str}});Object.defineProperty(ar,"stringify",{enumerable:!0,get:function(){return qu.stringify}});Object.defineProperty(ar,"nil",{enumerable:!0,get:function(){return qu.nil}});Object.defineProperty(ar,"Name",{enumerable:!0,get:function(){return qu.Name}});Object.defineProperty(ar,"CodeGen",{enumerable:!0,get:function(){return qu.CodeGen}});var e6e=Kb();Object.defineProperty(ar,"ValidationError",{enumerable:!0,get:function(){return e6e.default}});var t6e=Om();Object.defineProperty(ar,"MissingRefError",{enumerable:!0,get:function(){return t6e.default}})});var UY=T(function(MY){Object.defineProperty(MY,"__esModule",{value:!0});MY.formatNames=MY.fastFormats=MY.fullFormats=void 0;function ns(e,t){return{validate:e,compare:t}}MY.fullFormats={date:ns(PY,GP),time:ns(BP(!0),WP),"date-time":ns(kY(!0),DY),"iso-time":ns(BP(),IY),"iso-date-time":ns(kY(),LY),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:l6e,"uri-reference":/^(?:[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,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|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-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([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,regex:g6e,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:u6e,int32:{type:"number",validate:f6e},int64:{type:"number",validate:m6e},float:{type:"number",validate:OY},double:{type:"number",validate:OY},password:!0,binary:!0};MY.fastFormats={...MY.fullFormats,date:ns(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,GP),time:ns(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,WP),"date-time":ns(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,DY),"iso-time":ns(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,IY),"iso-date-time":ns(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,LY),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};MY.formatNames=Object.keys(MY.fullFormats);function o6e(e){return e%4===0&&(e%100!==0||e%400===0)}var s6e=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i6e=[0,31,28,31,30,31,30,31,31,30,31,30,31];function PY(e){let t=s6e.exec(e);if(!t)return!1;let n=+t[1],r=+t[2],o=+t[3];return r>=1&&r<=12&&o>=1&&o<=(r===2&&o6e(n)?29:i6e[r])}function GP(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var HP=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function BP(e){return function(n){let r=HP.exec(n);if(!r)return!1;let o=+r[1],s=+r[2],i=+r[3],a=r[4],c=r[5]==="-"?-1:1,l=+(r[6]||0),u=+(r[7]||0);if(l>23||u>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let p=s-u*c,f=o-l*c-(p<0?1:0);return(f===23||f===-1)&&(p===59||p===-1)&&i<61}}function WP(e,t){if(!(e&&t))return;let n=new Date("2020-01-01T"+e).valueOf(),r=new Date("2020-01-01T"+t).valueOf();if(!(n&&r))return;return n-r}function IY(e,t){if(!(e&&t))return;let n=HP.exec(e),r=HP.exec(t);if(!(n&&r))return;if(e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t)return 1;if(e<t)return-1;return 0}var KP=/t|\s/i;function kY(e){let t=BP(e);return function(r){let o=r.split(KP);return o.length===2&&PY(o[0])&&t(o[1])}}function DY(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(!(n&&r))return;return n-r}function LY(e,t){if(!(e&&t))return;let[n,r]=e.split(KP),[o,s]=t.split(KP),i=GP(n,o);if(i===void 0)return;return i||WP(r,s)}var a6e=/\/|:/,c6e=/^(?:[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 l6e(e){return a6e.test(e)&&c6e.test(e)}var RY=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function u6e(e){return RY.lastIndex=0,RY.test(e)}var d6e=-2147483648,p6e=2147483647;function f6e(e){return Number.isInteger(e)&&e<=p6e&&e>=d6e}function m6e(e){return Number.isInteger(e)}function OY(){return!0}var h6e=/[^\\]\\Z/;function g6e(e){if(h6e.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var jY=T(function(FY){Object.defineProperty(FY,"__esModule",{value:!0});FY.formatLimitDefinition=void 0;var y6e=zP(),Po=Pe(),ji=Po.operators,dS={formatMaximum:{okStr:"<=",ok:ji.LTE,fail:ji.GT},formatMinimum:{okStr:">=",ok:ji.GTE,fail:ji.LT},formatExclusiveMaximum:{okStr:"<",ok:ji.LT,fail:ji.GTE},formatExclusiveMinimum:{okStr:">",ok:ji.GT,fail:ji.LTE}},b6e={message:({keyword:e,schemaCode:t})=>Po.str`should be ${dS[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Po._`{comparison: ${dS[e].okStr}, limit: ${t}}`};FY.formatLimitDefinition={keyword:Object.keys(dS),type:"string",schemaType:"string",$data:!0,error:b6e,code(e){let{gen:t,data:n,schemaCode:r,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new y6e.KeywordCxt(s,a.RULES.all.format.definition,"format");if(c.$data)l();else u();function l(){let f=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=t.const("fmt",Po._`${f}[${c.schemaCode}]`);e.fail$data((0,Po.or)(Po._`typeof ${m} != "object"`,Po._`${m} instanceof RegExp`,Po._`typeof ${m}.compare != "function"`,p(m)))}function u(){let f=c.schema,m=a.formats[f];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${o}": format "${f}" does not define "compare" function`);let h=t.scopeValue("formats",{key:f,ref:m,code:i.code.formats?Po._`${i.code.formats}${(0,Po.getProperty)(f)}`:void 0});e.fail$data(p(h))}function p(f){return Po._`${f}.compare(${n}, ${r}) ${dS[o].fail} 0`}},dependencies:["format"]};var S6e=(e)=>(e.addKeyword(FY.formatLimitDefinition),e);FY.default=S6e});var BY=T(function(Bm,HY){Object.defineProperty(Bm,"__esModule",{value:!0});var Vu=UY(),x6e=jY(),ZP=Pe(),$Y=new ZP.Name("fullFormats"),v6e=new ZP.Name("fastFormats"),YP=(e,t={keywords:!0})=>{if(Array.isArray(t))return zY(e,t,Vu.fullFormats,$Y),e;let[n,r]=t.mode==="fast"?[Vu.fastFormats,v6e]:[Vu.fullFormats,$Y],o=t.formats||Vu.formatNames;if(zY(e,o,n,r),t.keywords)(0,x6e.default)(e);return e};YP.get=(e,t="full")=>{let r=(t==="fast"?Vu.fastFormats:Vu.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function zY(e,t,n,r){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=ZP._`require("ajv-formats/dist/formats").${r}`);for(let i of t)e.addFormat(i,n[i])}HY.exports=Bm=YP;Object.defineProperty(Bm,"__esModule",{value:!0});Bm.default=YP});import{execFile as C8e}from"child_process";import{randomUUID as rD}from"crypto";import{createReadStream as k8e,realpathSync as R8e}from"fs";import{mkdir as QI,readdir as O8e,readFile as aQ,rm as P8e,writeFile as cQ}from"fs/promises";import{createRequire as I8e}from"module";import{homedir as eD,tmpdir as D8e}from"os";import{dirname as tD,isAbsolute as lQ,join as xn,relative as uQ,resolve as dh,sep as oD}from"path";import{createInterface as L8e}from"readline";import{fileURLToPath as M8e}from"url";import{setMaxListeners as BQ}from"events";var KQ=50;function md(e=KQ){let t=new AbortController;return BQ(e,t.signal),t}var rXe=new FinalizationRegistry(({parentSignalRef:e,handler:t})=>{e.deref()?.removeEventListener("abort",t)});var oXe={"user-cancel":new DOMException("user-cancel","AbortError"),"remote-cancel":new DOMException("remote-cancel","AbortError"),shutdown:new DOMException("shutdown","AbortError"),interrupt:new DOMException("interrupt","AbortError"),"turn-abort":new DOMException("turn-abort","AbortError"),background:new DOMException("background","AbortError"),"refusal-fallback-edit":new DOMException("refusal-fallback-edit","AbortError"),"recovery-timeout":new DOMException("recovery-timeout","AbortError")};var GQ="server-fallback-tombstone";var sXe=new DOMException(GQ,"AbortError");var WQ="subagent-park",iXe=new DOMException(WQ,"AbortError");import{realpathSync as RD}from"fs";import{homedir as qQ}from"os";import{basename as dXe,dirname as bD,isAbsolute as pXe,relative as fXe,resolve as gc,sep as is}from"path";import*as nE from"path";function ct(e){return process.platform==="darwin"?e.normalize("NFC"):e}function as(e){return/^[\\/]{2}/.test(e)||_h(e)}function SD(e){if(/^[\\/]{2}[?.][\\/](?!unc[\\/])/i.test(e))return null;return e.match(/^[\\/]{2}(?:[?.][\\/]unc[\\/])?([^\\/]+)/i)?.[1]?.replace(/[A-Z]/g,(t)=>t.toLowerCase())??null}function hd(e){return/(^|[\\/])\.{1,2}([\\/]|$)/.test(e)}function _c(e){return/^[\\/]{2}[?.][\\/]/.test(e)}function VQ(e){return/^[\\/](GLOBAL\?\?|GLOBALROOT|DosDevices|Device)[\\/]/i.test(e)}function OD(e,t){if(!as(e))return!1;if(_c(e)||_h(e))return!0;if(hd(e))return!0;let n=SD(e);return n===null||n!==SD(t)}function ED(e){if(process.platform==="win32"||!e.startsWith("/"))return null;let t=[];for(let n of e.split("/")){if(n===""||n===".")continue;if(n===".."){t.pop();continue}if(t.push(n),t.length===2&&xD(t[0])==="net")return xD(n)}return null}function xD(e){return e.replace(/[A-Z]/g,(t)=>t.toLowerCase())}function PD(e,t){if(!yc(e))return!1;let n=ED(e);return n===null||n!==ED(t)}function yc(e){if(process.platform==="win32")return!1;return js(e)}function js(e){return hh(e)!==null}function hh(e){if(!e.startsWith("/"))return null;let t=[];for(let n of e.split("/")){if(n===""||n===".")continue;if(n===".."){t.pop();continue}if(t.push(n),t.length===2&&t[0].toLowerCase()==="net")return"/"+t.join("/")}return null}function ID(e){return js(e)||/^\/Network\//i.test(e)}function rE(e){return oE(e)||js(e)||_c(e)||_h(e)||VQ(e)}function qi(e){return/^[\\/]{2}wsl(\$|\.localhost)[\\/]/i.test(e)}function oE(e){return as(e)&&!qi(e)}function sE(e){if(e.startsWith("\\\\?\\UNC\\"))return"\\\\"+e.slice(8);if(e.startsWith("\\\\?\\")&&e.length>=7&&e[5]===":")return e.slice(4);return e}function DD(e){if(/^\\\\\?\\volume\{/i.test(e))return vD(e);if(_h(e))return!0;let t=sE(e);if(t!==e&&vD(t))return!0;return as(t)&&!qi(t)}function vD(e){return hd(e)||e.includes("/")}function iE(e){try{return sE(RD.native(e))}catch{return null}}var ZQ=new Set(["EPERM","EBUSY","EACCES"]),YQ=4,JQ=50,wD;function fh(e){for(let t=0;;t++)try{return sE(RD.native(e))}catch(n){let r=n!=null&&typeof n==="object"&&"code"in n&&typeof n.code==="string"?n.code:void 0;if(r===void 0||!ZQ.has(r)||t>=YQ-1)return null;wD??=new Int32Array(new SharedArrayBuffer(4)),Atomics.wait(wD,0,0,JQ)}}function gh(e,t){let n=gc(t).toLowerCase(),r=bD(gc(e)).toLowerCase();if(r===n||AD(r,n)||TD(r,n,"lexical"))return!0;let o=fh(t)?.toLowerCase();if(o==null)return!1;let s=fh(bD(gc(e)))?.toLowerCase();if(s==null)return!0;return s===o||AD(s,o)||TD(s,o,"canonical")}var XQ=new Set(["node_modules",".venv","venv","env",".env","virtualenv",".tox",".nox",".direnv","__pypackages__"]);function AD(e,t){if(!e.startsWith(mh(t)+is))return!1;return e.split(is).some((n)=>XQ.has(n))}function mh(e){return e.endsWith(is)?e.slice(0,-1):e}var eE;function TD(e,t,n){let r=qQ(),o=(process.env.LOCALAPPDATA??"").trim();if(n==="lexical")return tE(CD(r,o,(c)=>gc(c).toLowerCase()),e,t);let s=r+"\x00"+o;if(eE?.key===s)return tE(eE.aliasDirs,e,t);let i=!0,a=CD(r,o,(c)=>{if(!QQ(c))return gc(c).toLowerCase();let l=fh(c)?.toLowerCase();if(l==null)return i=!1,gc(c).toLowerCase();return l});if(i)eE={key:s,aliasDirs:a};return tE(a,e,t)}function CD(e,t,n){let r=[];if(e)r.push(mh(n(e))+is+["appdata","local","microsoft","windowsapps"].join(is));if(t){let o=mh(n(t))+is+["microsoft","windowsapps"].join(is);if(!r.includes(o))r.push(o)}return r}function QQ(e){return process.platform==="win32"?/^[A-Za-z]:[\\/](?![\\/])/.test(e):e.startsWith("/")&&!as(e)}function tE(e,t,n){let r=mh(n);for(let o of e){if(!(o===r||o.startsWith(r+is)))continue;if(t===o||t.startsWith(o+is))return!0}return!1}function _h(e){return kD.test(e)||e.includes("??")&&kD.test(eee(e))}var kD=/^[\\/]\?\?[\\/]/;function eee(e){return nE.win32?nE.win32.normalize(e):e}function to(e,t,n){return new Promise((r,o)=>{if(t?.aborted){if(n?.throwOnAbort||n?.abortError)o(n.abortError?.()??Error("aborted"));else r();return}let s=setTimeout((a,c,l)=>{a?.removeEventListener("abort",c),l()},e,t,i,r);function i(){if(clearTimeout(s),n?.throwOnAbort||n?.abortError)o(n.abortError?.()??Error("aborted"));else r()}if(t?.addEventListener("abort",i,{once:!0}),n?.unref)s.unref()})}function tee(e,t){e(Error(t))}function Or(e,t,n){let r,o=new Promise((s,i)=>{r=setTimeout(tee,t,i,n)});return Promise.race([e,o]).finally(()=>{if(r!==void 0)clearTimeout(r)})}import{spawn as W0e}from"child_process";import{existsSync as q0e}from"fs";import{createInterface as V0e}from"readline";import{StringDecoder as Z0e}from"string_decoder";var bc=["PreToolUse","PostToolUse","PostToolUseFailure","PostToolBatch","Notification","UserPromptSubmit","UserPromptExpansion","SessionStart","SessionEnd","Stop","StopFailure","SubagentStart","SubagentStop","PreCompact","PostCompact","PermissionRequest","PermissionDenied","Setup","TeammateIdle","TaskCreated","TaskCompleted","Elicitation","ElicitationResult","ConfigChange","WorktreeCreate","WorktreeRemove","InstructionsLoaded","CwdChanged","FileChanged","DirectoryAdded","MessageDisplay"],nee=["clear","resume","logout","prompt_input_exit","other"],ree="__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__";function gd(e){return e.charAt(0).toUpperCase()+e.slice(1)}function aE(e,t,n=t+"s"){return e===1?t:n}function _d(e,t){if(t<=0)return"";if(e.length<=t)return e;let n=e.slice(0,t),r=n.charCodeAt(t-1);return LD(r>=55296&&r<=56319?n.slice(0,-1):n)}function cE(e,t){if(t<=0)return"";if(e.length<=t)return e;let n=e.slice(-t),r=n.charCodeAt(0);return LD(r>=56320&&r<=57343?n.slice(1):n)}function LD(e){if(typeof Buffer<"u")return Buffer.from(e,"utf16le").toString("utf16le");return oee(e)}function oee(e){let n=[];for(let r=0;r<e.length;r+=8192){let o=Math.min(r+8192,e.length),s=new Uint16Array(o-r);for(let i=r;i<o;i++)s[i-r]=e.charCodeAt(i);n.push(String.fromCharCode(...s))}return n.join("")}var see=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/,iee=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,yh=typeof String.prototype.isWellFormed==="function"?Function.prototype.call.bind(String.prototype.isWellFormed):void 0,yXe=typeof String.prototype.toWellFormed==="function"?Function.prototype.call.bind(String.prototype.toWellFormed):void 0;function bh(e){if(yh)return yh(e);return!see.test(e)}function lE(e){if(yh&&yh(e))return e;return e.replace(iee,"")}function uE(e,t){let n=e.indexOf(t);return n===-1?e:e.slice(0,n)}function MD(e,t,n=0){let r=0,o=e.indexOf(t,n);while(o!==-1)r++,o=e.indexOf(t,o+1);return r}var aee=/^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/,cee=/<command-name>(.*?)<\/command-name>/;function yd(e,t){if(e.type!=="user")return;if(e.isMeta===!0||e.isCompactSummary===!0)return;let n=e.message;if(!n)return;let r=n.content,o=[];if(typeof r==="string")o.push(r);else if(Array.isArray(r))for(let s of r){if(!s||typeof s!=="object")continue;if(s.type==="tool_result")return;if(s.type==="text"&&typeof s.text==="string")o.push(s.text)}for(let s of o){let i=s.replaceAll(`
94
- `," ").trim();if(!i)continue;let a=cee.exec(i);if(a){if(!t.commandFallback)t.commandFallback=a[1];continue}let c=/<bash-input>([\s\S]*?)<\/bash-input>/.exec(i);if(c)return`! ${c[1].trim()}`;if(aee.test(i))continue;if(i.length>200)i=_d(i,200).trim()+"…";return i}return}var lee={customTitle:"customTitle",aiTitle:"aiTitle",lastPrompt:"lastPrompt",summary:"summaryHint",gitBranch:"gitBranch"};function Sh(e,t,n,r){let o=r?.mtime??e?.mtime??0,s=e!==void 0?{sessionId:e.sessionId,mtime:o,data:{...e.data}}:{sessionId:t.sessionId,mtime:o,data:{}},i=s.data;for(let a of n){let c=dee(a.timestamp);if(i.isSidechain===void 0)i.isSidechain=a.isSidechain===!0;if(i.createdAt===void 0&&c!==void 0)i.createdAt=c;if(i.cwd===void 0){let l=a.cwd;if(typeof l==="string"&&l)i.cwd=l}pee(i,a);for(let[l,u]of Object.entries(lee)){let p=a[l];if(typeof p==="string")i[u]=p}if(a.type==="tag"){let l=a.tag;if(typeof l==="string"&&l)i.tag=l;else delete i.tag}if(a.type==="relocated"){let l=a.relocatedCwd;if(typeof l==="string"&&l)i.cwd=l}}return s}function ND(e,t){let n=e.data;if(n.isSidechain===!0)return null;let r=$s(n.firstPromptLocked===!0?n.firstPrompt:n.commandFallback)||void 0,o=$s(n.customTitle)||$s(n.aiTitle)||void 0,s=o||$s(n.lastPrompt)||$s(n.summaryHint)||r;if(!s)return null;return{sessionId:e.sessionId,summary:s,lastModified:e.mtime,fileSize:void 0,customTitle:o,firstPrompt:r,gitBranch:$s(n.gitBranch)||void 0,cwd:$s(n.cwd)||t||void 0,tag:$s(n.tag)||void 0,createdAt:uee(n.createdAt)}}function $s(e){return typeof e==="string"?e:void 0}function uee(e){return typeof e==="number"?e:void 0}function dee(e){if(typeof e!=="string")return;let t=Date.parse(e);return Number.isNaN(t)?void 0:t}function pee(e,t){if(e.firstPromptLocked)return;let n={commandFallback:e.commandFallback??""},r=yd(t,n);if(n.commandFallback&&!e.commandFallback)e.commandFallback=n.commandFallback;if(r!==void 0)e.firstPrompt=r,e.firstPromptLocked=!0}class dE{store=new Map;mtimes=new Map;summaries=new Map;lastMtime=0;keyToString(e){let t=[e.projectKey,e.sessionId];if(e.subpath)t.push(e.subpath);return t.join("/")}async append(e,t){let n=this.keyToString(e),r=this.store.get(n)??[];r.push(...t),this.store.set(n,r);let o=Math.max(Date.now(),this.lastMtime+1);if(this.lastMtime=o,this.mtimes.set(n,o),e.subpath===void 0){let s=`${e.projectKey}/${e.sessionId}`,i=Sh(this.summaries.get(s),e,t,{mtime:o});this.summaries.set(s,i)}}async load(e){let t=this.keyToString(e);return this.store.get(t)??null}async listSessions(e){let t=[],n=e+"/";for(let[r]of this.store)if(r.startsWith(n)){let o=r.slice(n.length);if(!o.includes("/"))t.push({sessionId:o,mtime:this.mtimes.get(r)??0})}return t}async listSessionSummaries(e){let t=[],n=e+"/";for(let[r,o]of this.summaries)if(r.startsWith(n))t.push(o);return t}async delete(e){let t=this.keyToString(e);if(this.store.delete(t),this.mtimes.delete(t),e.subpath===void 0){this.summaries.delete(`${e.projectKey}/${e.sessionId}`);let n=`${e.projectKey}/${e.sessionId}/`;for(let r of this.store.keys())if(r.startsWith(n))this.store.delete(r),this.mtimes.delete(r)}}async listSubkeys(e){let t=`${e.projectKey}/${e.sessionId}/`,n=[];for(let r of this.store.keys())if(r.startsWith(t))n.push(r.slice(t.length));return n}getEntries(e){return this.store.get(this.keyToString(e))??[]}get size(){let e=0;for(let t of this.store.keys()){let n=t.indexOf("/");if(n!==-1&&!t.slice(n+1).includes("/"))e++}return e}clear(){this.store.clear(),this.mtimes.clear(),this.summaries.clear()}}function cs(e){return!Array.isArray?KD(e)==="[object Array]":Array.isArray(e)}var fee=1/0;function mee(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-fee?"-0":t}function hee(e){return e==null?"":mee(e)}function Lo(e){return typeof e==="string"}function HD(e){return typeof e==="number"}function gee(e){return e===!0||e===!1||_ee(e)&&KD(e)=="[object Boolean]"}function BD(e){return typeof e==="object"}function _ee(e){return BD(e)&&e!==null}function ur(e){return e!==void 0&&e!==null}function pE(e){return!e.trim().length}function KD(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var yee="Incorrect 'index' type",bee=(e)=>`Invalid value for key ${e}`,See=(e)=>`Pattern length exceeds max of ${e}.`,Eee=(e)=>`Missing ${e} property in key`,xee=(e)=>`Property 'weight' in key '${e}' must be a positive integer`,UD=Object.prototype.hasOwnProperty;class GD{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((n)=>{let r=WD(n);this._keys.push(r),this._keyMap[r.id]=r,t+=r.weight}),this._keys.forEach((n)=>{n.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function WD(e){let t=null,n=null,r=null,o=1,s=null;if(Lo(e)||cs(e))r=e,t=FD(e),n=fE(e);else{if(!UD.call(e,"name"))throw Error(Eee("name"));let i=e.name;if(r=i,UD.call(e,"weight")){if(o=e.weight,o<=0)throw Error(xee(i))}t=FD(i),n=fE(i),s=e.getFn}return{path:t,id:n,weight:o,src:r,getFn:s}}function FD(e){return cs(e)?e:e.split(".")}function fE(e){return cs(e)?e.join("."):e}function vee(e,t){let n=[],r=!1,o=(s,i,a)=>{if(!ur(s))return;if(!i[a])n.push(s);else{let c=i[a],l=s[c];if(!ur(l))return;if(a===i.length-1&&(Lo(l)||HD(l)||gee(l)))n.push(hee(l));else if(cs(l)){r=!0;for(let u=0,p=l.length;u<p;u+=1)o(l[u],i,a+1)}else if(i.length)o(l,i,a+1)}};return o(e,Lo(t)?t.split("."):t,0),r?n:n[0]}var wee={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Aee={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},Tee={location:0,threshold:0.6,distance:100},Cee={useExtendedSearch:!1,getFn:vee,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},Se={...Aee,...wee,...Tee,...Cee},kee=/[^ ]+/g;function Ree(e=1,t=3){let n=new Map,r=Math.pow(10,t);return{get(o){let s=o.match(kee).length;if(n.has(s))return n.get(s);let i=1/Math.pow(s,0.5*e),a=parseFloat(Math.round(i*r)/r);return n.set(s,a),a},clear(){n.clear()}}}class vh{constructor({getFn:e=Se.getFn,fieldNormWeight:t=Se.fieldNormWeight}={}){this.norm=Ree(t,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((t,n)=>{this._keysMap[t.id]=n})}create(){if(this.isCreated||!this.docs.length)return;if(this.isCreated=!0,Lo(this.docs[0]))this.docs.forEach((e,t)=>{this._addString(e,t)});else this.docs.forEach((e,t)=>{this._addObject(e,t)});this.norm.clear()}add(e){let t=this.size();if(Lo(e))this._addString(e,t);else this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,n=this.size();t<n;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!ur(e)||pE(e))return;let n={v:e,i:t,n:this.norm.get(e)};this.records.push(n)}_addObject(e,t){let n={i:t,$:{}};this.keys.forEach((r,o)=>{let s=r.getFn?r.getFn(e):this.getFn(e,r.path);if(!ur(s))return;if(cs(s)){let i=[],a=[{nestedArrIndex:-1,value:s}];while(a.length){let{nestedArrIndex:c,value:l}=a.pop();if(!ur(l))continue;if(Lo(l)&&!pE(l)){let u={v:l,i:c,n:this.norm.get(l)};i.push(u)}else if(cs(l))l.forEach((u,p)=>{a.push({nestedArrIndex:p,value:u})})}n.$[o]=i}else if(Lo(s)&&!pE(s)){let i={v:s,n:this.norm.get(s)};n.$[o]=i}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function qD(e,t,{getFn:n=Se.getFn,fieldNormWeight:r=Se.fieldNormWeight}={}){let o=new vh({getFn:n,fieldNormWeight:r});return o.setKeys(e.map(WD)),o.setSources(t),o.create(),o}function Oee(e,{getFn:t=Se.getFn,fieldNormWeight:n=Se.fieldNormWeight}={}){let{keys:r,records:o}=e,s=new vh({getFn:t,fieldNormWeight:n});return s.setKeys(r),s.setIndexRecords(o),s}function Eh(e,{errors:t=0,currentLocation:n=0,expectedLocation:r=0,distance:o=Se.distance,ignoreLocation:s=Se.ignoreLocation}={}){let i=t/e.length;if(s)return i;let a=Math.abs(r-n);if(!o)return a?1:i;return i+a/o}function Pee(e=[],t=Se.minMatchCharLength){let n=[],r=-1,o=-1,s=0;for(let i=e.length;s<i;s+=1){let a=e[s];if(a&&r===-1)r=s;else if(!a&&r!==-1){if(o=s-1,o-r+1>=t)n.push([r,o]);r=-1}}if(e[s-1]&&s-r>=t)n.push([r,s-1]);return n}var Vi=32;function Iee(e,t,n,{location:r=Se.location,distance:o=Se.distance,threshold:s=Se.threshold,findAllMatches:i=Se.findAllMatches,minMatchCharLength:a=Se.minMatchCharLength,includeMatches:c=Se.includeMatches,ignoreLocation:l=Se.ignoreLocation}={}){if(t.length>Vi)throw Error(See(Vi));let u=t.length,p=e.length,f=Math.max(0,Math.min(r,p)),m=s,h=f,g=a>1||c,y=g?Array(p):[],S;while((S=e.indexOf(t,h))>-1){let D=Eh(t,{currentLocation:S,expectedLocation:f,distance:o,ignoreLocation:l});if(m=Math.min(D,m),h=S+u,g){let F=0;while(F<u)y[S+F]=1,F+=1}}h=-1;let b=[],x=1,v=u+p,A=1<<u-1;for(let D=0;D<u;D+=1){let F=0,K=v;while(F<K){if(Eh(t,{errors:D,currentLocation:f+K,expectedLocation:f,distance:o,ignoreLocation:l})<=m)F=K;else v=K;K=Math.floor((v-F)/2+F)}v=K;let V=Math.max(1,f-K+1),ne=i?p:Math.min(f+K,p)+u,oe=Array(ne+2);oe[ne+1]=(1<<D)-1;for(let ke=ne;ke>=V;ke-=1){let vt=ke-1,Z=n[e.charAt(vt)];if(g)y[vt]=+!!Z;if(oe[ke]=(oe[ke+1]<<1|1)&Z,D)oe[ke]|=(b[ke+1]|b[ke])<<1|1|b[ke+1];if(oe[ke]&A){if(x=Eh(t,{errors:D,currentLocation:vt,expectedLocation:f,distance:o,ignoreLocation:l}),x<=m){if(m=x,h=vt,h<=f)break;V=Math.max(1,2*f-h)}}}if(Eh(t,{errors:D+1,currentLocation:f,expectedLocation:f,distance:o,ignoreLocation:l})>m)break;b=oe}let U={isMatch:h>=0,score:Math.max(0.001,x)};if(g){let D=Pee(y,a);if(!D.length)U.isMatch=!1;else if(c)U.indices=D}return U}function Dee(e){let t={};for(let n=0,r=e.length;n<r;n+=1){let o=e.charAt(n);t[o]=(t[o]||0)|1<<r-n-1}return t}class bE{constructor(e,{location:t=Se.location,threshold:n=Se.threshold,distance:r=Se.distance,includeMatches:o=Se.includeMatches,findAllMatches:s=Se.findAllMatches,minMatchCharLength:i=Se.minMatchCharLength,isCaseSensitive:a=Se.isCaseSensitive,ignoreLocation:c=Se.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:o,findAllMatches:s,minMatchCharLength:i,isCaseSensitive:a,ignoreLocation:c},this.pattern=a?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;let l=(p,f)=>{this.chunks.push({pattern:p,alphabet:Dee(p),startIndex:f})},u=this.pattern.length;if(u>Vi){let p=0,f=u%Vi,m=u-f;while(p<m)l(this.pattern.substr(p,Vi),p),p+=Vi;if(f){let h=u-Vi;l(this.pattern.substr(h),h)}}else l(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,includeMatches:n}=this.options;if(!t)e=e.toLowerCase();if(this.pattern===e){let m={isMatch:!0,score:0};if(n)m.indices=[[0,e.length-1]];return m}let{location:r,distance:o,threshold:s,findAllMatches:i,minMatchCharLength:a,ignoreLocation:c}=this.options,l=[],u=0,p=!1;this.chunks.forEach(({pattern:m,alphabet:h,startIndex:g})=>{let{isMatch:y,score:S,indices:b}=Iee(e,m,h,{location:r+g,distance:o,threshold:s,findAllMatches:i,minMatchCharLength:a,includeMatches:n,ignoreLocation:c});if(y)p=!0;if(u+=S,y&&b)l=[...l,...b]});let f={isMatch:p,score:p?u/this.chunks.length:1};if(p&&n)f.indices=l;return f}}class ls{constructor(e){this.pattern=e}static isMultiMatch(e){return jD(e,this.multiRegex)}static isSingleMatch(e){return jD(e,this.singleRegex)}search(){}}function jD(e,t){let n=e.match(t);return n?n[1]:null}class VD extends ls{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){let t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}class ZD extends ls{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){let n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class YD extends ls{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){let t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}class JD extends ls{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){let t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class XD extends ls{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){let t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class QD extends ls{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){let t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class SE extends ls{constructor(e,{location:t=Se.location,threshold:n=Se.threshold,distance:r=Se.distance,includeMatches:o=Se.includeMatches,findAllMatches:s=Se.findAllMatches,minMatchCharLength:i=Se.minMatchCharLength,isCaseSensitive:a=Se.isCaseSensitive,ignoreLocation:c=Se.ignoreLocation}={}){super(e);this._bitapSearch=new bE(e,{location:t,threshold:n,distance:r,includeMatches:o,findAllMatches:s,minMatchCharLength:i,isCaseSensitive:a,ignoreLocation:c})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class EE extends ls{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t=0,n,r=[],o=this.pattern.length;while((n=e.indexOf(this.pattern,t))>-1)t=n+o,r.push([n,t-1]);let s=!!r.length;return{isMatch:s,score:s?0:1,indices:r}}}var mE=[VD,EE,YD,JD,QD,XD,ZD,SE],$D=mE.length,Lee=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Mee="|";function Nee(e,t={}){return e.split(Mee).map((n)=>{let r=n.trim().split(Lee).filter((s)=>s&&!!s.trim()),o=[];for(let s=0,i=r.length;s<i;s+=1){let a=r[s],c=!1,l=-1;while(!c&&++l<$D){let u=mE[l],p=u.isMultiMatch(a);if(p)o.push(new u(p,t)),c=!0}if(c)continue;l=-1;while(++l<$D){let u=mE[l],p=u.isSingleMatch(a);if(p){o.push(new u(p,t));break}}}return o})}var Uee=new Set([SE.type,EE.type]);class eL{constructor(e,{isCaseSensitive:t=Se.isCaseSensitive,includeMatches:n=Se.includeMatches,minMatchCharLength:r=Se.minMatchCharLength,ignoreLocation:o=Se.ignoreLocation,findAllMatches:s=Se.findAllMatches,location:i=Se.location,threshold:a=Se.threshold,distance:c=Se.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:n,minMatchCharLength:r,findAllMatches:s,ignoreLocation:o,location:i,threshold:a,distance:c},this.pattern=t?e:e.toLowerCase(),this.query=Nee(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:r}=this.options;e=r?e:e.toLowerCase();let o=0,s=[],i=0;for(let a=0,c=t.length;a<c;a+=1){let l=t[a];s.length=0,o=0;for(let u=0,p=l.length;u<p;u+=1){let f=l[u],{isMatch:m,indices:h,score:g}=f.search(e);if(m){if(o+=1,i+=g,n){let y=f.constructor.type;if(Uee.has(y))s=[...s,...h];else s.push(h)}}else{i=0,o=0,s.length=0;break}}if(o){let u={isMatch:!0,score:i/o};if(n)u.indices=s;return u}}return{isMatch:!1,score:1}}}var hE=[];function Fee(...e){hE.push(...e)}function gE(e,t){for(let n=0,r=hE.length;n<r;n+=1){let o=hE[n];if(o.condition(e,t))return new o(e,t)}return new bE(e,t)}var xh={AND:"$and",OR:"$or"},_E={PATH:"$path",PATTERN:"$val"},yE=(e)=>!!(e[xh.AND]||e[xh.OR]),jee=(e)=>!!e[_E.PATH],$ee=(e)=>!cs(e)&&BD(e)&&!yE(e),zD=(e)=>({[xh.AND]:Object.keys(e).map((t)=>({[t]:e[t]}))});function tL(e,t,{auto:n=!0}={}){let r=(o)=>{let s=Object.keys(o),i=jee(o);if(!i&&s.length>1&&!yE(o))return r(zD(o));if($ee(o)){let c=i?o[_E.PATH]:s[0],l=i?o[_E.PATTERN]:o[c];if(!Lo(l))throw Error(bee(c));let u={keyId:fE(c),pattern:l};if(n)u.searcher=gE(l,t);return u}let a={children:[],operator:s[0]};return s.forEach((c)=>{let l=o[c];if(cs(l))l.forEach((u)=>{a.children.push(r(u))})}),a};if(!yE(e))e=zD(e);return r(e)}function zee(e,{ignoreFieldNorm:t=Se.ignoreFieldNorm}){e.forEach((n)=>{let r=1;n.matches.forEach(({key:o,norm:s,score:i})=>{let a=o?o.weight:null;r*=Math.pow(i===0&&a?Number.EPSILON:i,(a||1)*(t?1:s))}),n.score=r})}function Hee(e,t){let n=e.matches;if(t.matches=[],!ur(n))return;n.forEach((r)=>{if(!ur(r.indices)||!r.indices.length)return;let{indices:o,value:s}=r,i={indices:o,value:s};if(r.key)i.key=r.key.src;if(r.idx>-1)i.refIndex=r.idx;t.matches.push(i)})}function Bee(e,t){t.score=e.score}function Kee(e,t,{includeMatches:n=Se.includeMatches,includeScore:r=Se.includeScore}={}){let o=[];if(n)o.push(Hee);if(r)o.push(Bee);return e.map((s)=>{let{idx:i}=s,a={item:t[i],refIndex:i};if(o.length)o.forEach((c)=>{c(s,a)});return a})}class zs{constructor(e,t={},n){this.options={...Se,...t},this.options.useExtendedSearch,this._keyStore=new GD(this.options.keys),this.setCollection(e,n)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof vh))throw Error(yee);this._myIndex=t||qD(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){if(!ur(e))return;this._docs.push(e),this._myIndex.add(e)}remove(e=()=>!1){let t=[];for(let n=0,r=this._docs.length;n<r;n+=1){let o=this._docs[n];if(e(o,n))this.removeAt(n),n-=1,r-=1,t.push(o)}return t}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){let{includeMatches:n,includeScore:r,shouldSort:o,sortFn:s,ignoreFieldNorm:i}=this.options,a=Lo(e)?Lo(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);if(zee(a,{ignoreFieldNorm:i}),o)a.sort(s);if(HD(t)&&t>-1)a=a.slice(0,t);return Kee(a,this._docs,{includeMatches:n,includeScore:r})}_searchStringList(e){let t=gE(e,this.options),{records:n}=this._myIndex,r=[];return n.forEach(({v:o,i:s,n:i})=>{if(!ur(o))return;let{isMatch:a,score:c,indices:l}=t.searchIn(o);if(a)r.push({item:o,idx:s,matches:[{score:c,value:o,norm:i,indices:l}]})}),r}_searchLogical(e){let t=tL(e,this.options),n=(i,a,c)=>{if(!i.children){let{keyId:u,searcher:p}=i,f=this._findMatches({key:this._keyStore.get(u),value:this._myIndex.getValueForItemAtKeyId(a,u),searcher:p});if(f&&f.length)return[{idx:c,item:a,matches:f}];return[]}let l=[];for(let u=0,p=i.children.length;u<p;u+=1){let f=i.children[u],m=n(f,a,c);if(m.length)l.push(...m);else if(i.operator===xh.AND)return[]}return l},r=this._myIndex.records,o={},s=[];return r.forEach(({$:i,i:a})=>{if(ur(i)){let c=n(t,i,a);if(c.length){if(!o[a])o[a]={idx:a,item:i,matches:[]},s.push(o[a]);c.forEach(({matches:l})=>{o[a].matches.push(...l)})}}}),s}_searchObjectList(e){let t=gE(e,this.options),{keys:n,records:r}=this._myIndex,o=[];return r.forEach(({$:s,i})=>{if(!ur(s))return;let a=[];if(n.forEach((c,l)=>{a.push(...this._findMatches({key:c,value:s[l],searcher:t}))}),a.length)o.push({idx:i,item:s,matches:a})}),o}_findMatches({key:e,value:t,searcher:n}){if(!ur(t))return[];let r=[];if(cs(t))t.forEach(({v:o,i:s,n:i})=>{if(!ur(o))return;let{isMatch:a,score:c,indices:l}=n.searchIn(o);if(a)r.push({score:c,key:e,value:o,idx:s,norm:i,indices:l})});else{let{v:o,n:s}=t,{isMatch:i,score:a,indices:c}=n.searchIn(o);if(i)r.push({score:a,key:e,value:o,norm:s,indices:c})}return r}}zs.version="7.0.0";zs.createIndex=qD;zs.parseIndex=Oee;zs.config=Se;zs.parseQuery=tL;Fee(eL);var nL=/[:_-]/g;class xE{fuse;constructor(e){let t=e.map((n)=>{let{name:r,displayName:o}=n,s=r.split(nL).filter(Boolean),i=o!==r?o.split(nL).filter(Boolean):[];return{descriptionKey:(n.description??"").split(" ").map((a)=>a.toLowerCase().replace(/[^a-z0-9]/g,"")).filter(Boolean),partKey:s.length>1?s:void 0,displayPartKey:i.length>1?i:void 0,commandName:r,displayName:o,candidate:n,aliasKey:n.aliases}});this.fuse=new zs(t,{includeScore:!0,threshold:0.3,location:0,distance:100,keys:[{name:"commandName",weight:3},{name:"displayName",weight:2},{name:"partKey",weight:2},{name:"aliasKey",weight:2},{name:"displayPartKey",weight:1},{name:"descriptionKey",weight:0.5}]})}search(e,t){let{getScoreBoost:n,filter:r}=t??{},o=e.trim().toLowerCase(),s=this.fuse.search(o);if(r)s=s.filter((c)=>r(c.item.candidate));return s.map((c)=>{let l=c.item.commandName.toLowerCase(),u=c.item.displayName.toLowerCase(),p=c.item.aliasKey?.map((m)=>m.toLowerCase())??[],f=n?n(c.item.candidate):0;return{r:c,name:l,display:u,aliases:p,boost:f}}).sort((c,l)=>{let u=c.name,p=l.name,f=c.aliases,m=l.aliases,h=u===o||c.display===o,g=p===o||l.display===o;if(h&&!g)return-1;if(g&&!h)return 1;let y=f.some((ne)=>ne===o),S=m.some((ne)=>ne===o);if(y&&!S)return-1;if(S&&!y)return 1;let b=(ne,oe)=>Math.min(ne.startsWith(o)?ne.length:1/0,oe.startsWith(o)?oe.length:1/0),x=b(u,c.display),v=b(p,l.display),A=x<1/0,U=v<1/0;if(A&&!U)return-1;if(U&&!A)return 1;if(A&&U&&x!==v)return x-v;let D=f.find((ne)=>ne.startsWith(o)),F=m.find((ne)=>ne.startsWith(o));if(D&&!F)return-1;if(F&&!D)return 1;if(D&&F&&D.length!==F.length)return D.length-F.length;let K=Math.floor((c.r.score??0)*10),V=Math.floor((l.r.score??0)*10);if(K!==V)return K-V;return l.boost-c.boost}).map((c)=>c.r.item.candidate)}}function vE(){if(typeof setImmediate==="function")return new Promise((e)=>setImmediate(e));if(typeof MessageChannel==="function")return new Promise((e)=>{let t=new MessageChannel;t.port1.onmessage=()=>{t.port1.close(),e()},t.port2.postMessage(null)});return to(0)}var rL=16,aL=8,Gee=6,Wee=4,cL=8,qee=3,Vee=1,Zee=100,oL=64,sL=4;class wE{paths=[];lowerPaths=[];charBits=new Int32Array(0);pathLens=new Uint16Array(0);topLevelCache=null;matchPositions=new Int32Array(oL);readyCount=0;buildGen=0;loadFromFileList(e){let t=new Set,n=[];for(let r of e)if(r.length>0&&!t.has(r))t.add(r),n.push(r);this.buildIndex(n)}loadFromFileListAsync(e){let t=()=>{},n=new Promise((o)=>{t=o}),r=this.buildAsync(e,t);return{queryable:n,done:r}}async buildAsync(e,t){let n=++this.buildGen,r=new Set,o=[],s=performance.now();for(let a=0;a<e.length;a++){let c=e[a];if(c.length>0&&!r.has(c))r.add(c),o.push(c);if((a&255)===255&&performance.now()-s>sL){if(await vE(),this.buildGen!==n)return t(),!1;s=performance.now()}}this.resetArrays(o),s=performance.now();let i=!0;for(let a=0;a<o.length;a++)if(this.indexPath(a),(a&255)===255&&performance.now()-s>sL){if(this.readyCount=a+1,i)t(),i=!1;if(await vE(),this.buildGen!==n)return!1;s=performance.now()}return this.readyCount=o.length,t(),!0}buildIndex(e){this.buildGen++,this.resetArrays(e);for(let t=0;t<e.length;t++)this.indexPath(t);this.readyCount=e.length}resetArrays(e){let t=e.length;this.paths=e,this.lowerPaths=Array(t),this.charBits=new Int32Array(t),this.pathLens=new Uint16Array(t),this.readyCount=0,this.topLevelCache=ete(e,Zee)}indexPath(e){let t=this.paths[e].toLowerCase();this.lowerPaths[e]=t;let n=t.length;this.pathLens[e]=n;let r=0;for(let o=0;o<n;o++){let s=t.charCodeAt(o);if(s>=97&&s<=122)r|=1<<s-97}this.charBits[e]=r}search(e,t){if(t<=0)return[];if(e.length===0){if(this.topLevelCache)return this.topLevelCache.slice(0,t).map(({path:x,score:v})=>({path:x,score:v,positions:[]}));return[]}let n=e!==e.toLowerCase(),r=n?e:e.toLowerCase(),o=Math.min(r.length,oL),s=Array(o),i=0;for(let x=0;x<o;x++){let v=r.charAt(x);s[x]=v;let A=v.charCodeAt(0);if(A>=97&&A<=122)i|=1<<A-97}let a=o*(rL+aL)+cL+32,c=[],l=-1/0,{paths:u,lowerPaths:p,charBits:f,pathLens:m,readyCount:h}=this,g=this.matchPositions;e:for(let x=0;x<h;x++){if((f[x]&i)!==i)continue;let v=n?u[x]:p[x],A=v.indexOf(s[0]);if(A===-1)continue;g[0]=A;let U=0,D=0,F=A;for(let oe=1;oe<o;oe++){if(A=v.indexOf(s[oe],F+1),A===-1)continue e;g[oe]=A;let _e=A-F-1;if(_e===0)D+=Wee;else U+=qee+_e*Vee;F=A}if(c.length===t&&a+D-U<=l)continue;let K=u[x],V=m[x],ne=o*rL+D-U;ne+=iL(K,g[0],!0);for(let oe=1;oe<o;oe++)ne+=iL(K,g[oe],!1);if(ne+=Math.max(0,32-(V>>2)),c.length<t){if(c.push({pathIndex:x,fuzzScore:ne}),c.length===t)c.sort((oe,_e)=>oe.fuzzScore-_e.fuzzScore),l=c[0].fuzzScore}else if(ne>l){let oe=0,_e=c.length;while(oe<_e){let ke=oe+_e>>1;if(c[ke].fuzzScore<ne)oe=ke+1;else _e=ke}c.splice(oe,0,{pathIndex:x,fuzzScore:ne}),c.shift(),l=c[0].fuzzScore}}c.sort((x,v)=>v.fuzzScore-x.fuzzScore);let y=c.length,S=Math.max(y,1),b=Array(y);for(let x=0;x<y;x++){let v=c[x].pathIndex,A=u[v],U=p[v],D=n?A:U,F=Array(o),K=0;for(let oe=0;oe<o;oe++){let _e=D.indexOf(s[oe],K);F[oe]=_e,K=_e+1}if(!n&&U.length!==A.length)Qee(A,F);let V=x/S,ne=A.includes("test")?Math.min(V*1.05,1):V;b[x]={path:A,score:ne,positions:F}}return b}}function iL(e,t,n){if(t===0)return n?cL:0;let r=e.charCodeAt(t-1);if(Yee(r))return aL;if(Jee(r)&&Xee(e.charCodeAt(t)))return Gee;return 0}function Yee(e){return e===47||e===92||e===45||e===95||e===46||e===32}function Jee(e){return e>=97&&e<=122}function Xee(e){return e>=65&&e<=90}function Qee(e,t){let n=0,r=0,o=0;while(o<t.length&&n<e.length){let s=e.codePointAt(n),i=s>65535?2:1,a=String.fromCodePoint(s).toLowerCase().length;while(o<t.length&&t[o]<r+a)t[o]=n,o++;n+=i,r+=a}}function ete(e,t){let n=new Set;for(let o of e){let s=o.length;for(let a=0;a<o.length;a++){let c=o.charCodeAt(a);if(c===47||c===92){s=a;break}}let i=o.slice(0,s);if(i.length>0){if(n.add(i),n.size>=t)break}}let r=Array.from(n);return r.sort((o,s)=>{let i=o.length-s.length;if(i!==0)return i;return o<s?-1:o>s?1:0}),r.slice(0,t).map((o)=>({path:o,score:0,positions:[]}))}var lL=["You've hit your","You've reached your","You're out of usage credits","Your org is out of usage · add funds to continue","Your org is out of usage · contact your admin","Your seat type doesn't include usage credits","Your seat type doesn't include usage","Your usage allocation has been disabled by your admin","Your group's usage limit is set to $0","Fable 5 requires usage credits","You're out of extra usage","Your seat type doesn't include extra usage"],uL=["This service is disabled for your org"],dL=["You've used","You're close to"],pL=["You're now using usage credits","You're now using your usage allocation","Now using your usage allocation","Now using usage credits","You're now using extra usage","Now using extra usage"];class dr extends Error{}function Sc(){return process.versions.bun!==void 0}bd();var tte=typeof global=="object"&&global&&global.Object===Object&&global,Ah=tte;var nte=typeof self=="object"&&self&&self.Object===Object&&self,rte=Ah||nte||Function("return this")(),Kt=rte;var ote=Kt.Symbol,on=ote;var gL=Object.prototype,ste=gL.hasOwnProperty,ite=gL.toString,Sd=on?on.toStringTag:void 0;function ate(e){var t=ste.call(e,Sd),n=e[Sd];try{e[Sd]=void 0;var r=!0}catch(s){}var o=ite.call(e);if(r)if(t)e[Sd]=n;else delete e[Sd];return o}var _L=ate;var cte=Object.prototype,lte=cte.toString;function ute(e){return lte.call(e)}var yL=ute;var dte="[object Null]",pte="[object Undefined]",bL=on?on.toStringTag:void 0;function fte(e){if(e==null)return e===void 0?pte:dte;return bL&&bL in Object(e)?_L(e):yL(e)}var pr=fte;function mte(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var zt=mte;var hte="[object AsyncFunction]",gte="[object Function]",_te="[object GeneratorFunction]",yte="[object Proxy]";function bte(e){if(!zt(e))return!1;var t=pr(e);return t==gte||t==_te||t==hte||t==yte}var Ec=bte;var Ste=Kt["__core-js_shared__"],Th=Ste;var SL=function(){var e=/[^.]+$/.exec(Th&&Th.keys&&Th.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Ete(e){return!!SL&&SL in e}var EL=Ete;var xte=Function.prototype,vte=xte.toString;function wte(e){if(e!=null){try{return vte.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var us=wte;var Ate=/[\\^$.*+?()[\]{}|]/g,Tte=/^\[object .+?Constructor\]$/,Cte=Function.prototype,kte=Object.prototype,Rte=Cte.toString,Ote=kte.hasOwnProperty,Pte=RegExp("^"+Rte.call(Ote).replace(Ate,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ite(e){if(!zt(e)||EL(e))return!1;var t=Ec(e)?Pte:Tte;return t.test(us(e))}var xL=Ite;function Dte(e,t){return e==null?void 0:e[t]}var vL=Dte;function Lte(e,t){var n=vL(e,t);return xL(n)?n:void 0}var Bn=Lte;var Mte=Bn(Object,"create"),ds=Mte;function Nte(){this.__data__=ds?ds(null):{},this.size=0}var wL=Nte;function Ute(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var AL=Ute;var Fte="__lodash_hash_undefined__",jte=Object.prototype,$te=jte.hasOwnProperty;function zte(e){var t=this.__data__;if(ds){var n=t[e];return n===Fte?void 0:n}return $te.call(t,e)?t[e]:void 0}var TL=zte;var Hte=Object.prototype,Bte=Hte.hasOwnProperty;function Kte(e){var t=this.__data__;return ds?t[e]!==void 0:Bte.call(t,e)}var CL=Kte;var Gte="__lodash_hash_undefined__";function Wte(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=ds&&t===void 0?Gte:t,this}var kL=Wte;function xc(e){var t=-1,n=e==null?0:e.length;this.clear();while(++t<n){var r=e[t];this.set(r[0],r[1])}}xc.prototype.clear=wL;xc.prototype.delete=AL;xc.prototype.get=TL;xc.prototype.has=CL;xc.prototype.set=kL;var CE=xc;function qte(){this.__data__=[],this.size=0}var RL=qte;function Vte(e,t){return e===t||e!==e&&t!==t}var Mo=Vte;function Zte(e,t){var n=e.length;while(n--)if(Mo(e[n][0],t))return n;return-1}var Hs=Zte;var Yte=Array.prototype,Jte=Yte.splice;function Xte(e){var t=this.__data__,n=Hs(t,e);if(n<0)return!1;var r=t.length-1;if(n==r)t.pop();else Jte.call(t,n,1);return--this.size,!0}var OL=Xte;function Qte(e){var t=this.__data__,n=Hs(t,e);return n<0?void 0:t[n][1]}var PL=Qte;function ene(e){return Hs(this.__data__,e)>-1}var IL=ene;function tne(e,t){var n=this.__data__,r=Hs(n,e);if(r<0)++this.size,n.push([e,t]);else n[r][1]=t;return this}var DL=tne;function vc(e){var t=-1,n=e==null?0:e.length;this.clear();while(++t<n){var r=e[t];this.set(r[0],r[1])}}vc.prototype.clear=RL;vc.prototype.delete=OL;vc.prototype.get=PL;vc.prototype.has=IL;vc.prototype.set=DL;var Bs=vc;var nne=Bn(Kt,"Map"),Ks=nne;function rne(){this.size=0,this.__data__={hash:new CE,map:new(Ks||Bs),string:new CE}}var LL=rne;function one(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var ML=one;function sne(e,t){var n=e.__data__;return ML(t)?n[typeof t=="string"?"string":"hash"]:n.map}var Gs=sne;function ine(e){var t=Gs(this,e).delete(e);return this.size-=t?1:0,t}var NL=ine;function ane(e){return Gs(this,e).get(e)}var UL=ane;function cne(e){return Gs(this,e).has(e)}var FL=cne;function lne(e,t){var n=Gs(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var jL=lne;function wc(e){var t=-1,n=e==null?0:e.length;this.clear();while(++t<n){var r=e[t];this.set(r[0],r[1])}}wc.prototype.clear=LL;wc.prototype.delete=NL;wc.prototype.get=UL;wc.prototype.has=FL;wc.prototype.set=jL;var Zi=wc;var une="Expected a function";function kE(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw TypeError(une);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],s=n.cache;if(s.has(o))return s.get(o);var i=e.apply(this,r);return n.cache=s.set(o,i)||s,i};return n.cache=new(kE.Cache||Zi),n}kE.Cache=Zi;var Ed=kE;import{homedir as hne}from"os";import{basename as XQe,dirname as QQe,join as gne,resolve as $L}from"path";var dne=/^[+-]?(\d+(\.\d*)?|\.\d+)[eE][+-]?\d+$/,pne=/^[+-]?\d{1,3}([_,\u00A0\u202F ])\d{3}(?:\1\d{3})*$/,fne=/[_,\u00A0\u202F ]/g;function mne(e){if(e.length<=32){if(dne.test(e)){let t=Number(e);return Number.isInteger(t)?t:NaN}if(pne.test(e))return parseInt(e.replace(fne,""),10)}return}function RE(e){let t=String(e).trim();return mne(t)??parseInt(t,10)}bd();function Ch(){return process.env.CLAUDE_CONFIG_DIR}var Gt=Ed(()=>(Ch()??gne(hne(),".claude")).normalize("NFC"),Ch);function zL(e){return $L(Gt())===$L(e)}function HL(){return process.env.CLAUDE_CODE_PROJECT_DIR_NAME}var _ne=/^[A-Za-z0-9_-]{1,64}$/,yne=/^(?:con|prn|aux|nul|com[0-9]|lpt[0-9])$/i;function OE(e){if(!e||!_ne.test(e)||yne.test(e))return;return e}function bne(){return`${Ch()??""}\x00${HL()??""}`}var BL=Ed(()=>Ch()?OE(HL()):void 0,bne);var Sne=/hooks\.slack\.com\/(?:services|workflows|triggers)\/[A-Za-z0-9/_-]+/gi;var PE={bearer:[/\bBearer\s+[A-Za-z0-9._~+/=-]{8,}/gi,"Bearer <token>"],basic:[/(:\s*)Basic\s+[A-Za-z0-9+/=]{8,}/gi,"$1Basic <token>"],sk:[/\bsk-[A-Za-z0-9_-]{20,}/g,"<token>"]},Ene=[/\bBearer\s{1,512}(?=[A-Za-z0-9._~+/=-]{16})(?:eyJ|(?=[A-Za-z0-9._~+/=-]{0,64}[0-9=]))/i,/:\s{0,512}Basic\s{1,512}(?=[A-Za-z0-9+/=]{16})(?=[A-Za-z0-9+/=]{0,64}[0-9=])/i,/\bsk-(?=[A-Za-z0-9_-]{20})(?=[A-Za-z0-9_-]{0,64}[0-9])/];var iet=new RegExp(`(?:\\b(?:xox[abe-z](?:\\.xox[a-z])?|xapp|xwfp)-${Ac("[A-Za-z0-9+/=%_-]")}|\\bxox[cd]-|(?:xox[abe-z](?:\\.xox[a-z])?|xapp|xwfp)-(?=[0-9])|xox[cd]-${Ac("[A-Za-z0-9+/=%_-]")}(?=[A-Za-z0-9+/=%_-]{16}))`,"i"),GL=[[xd("sk-ant-","[A-Za-z0-9_-]",8,KL(8)),"<token>"],[xd("sk-(?:proj|svcacct|admin)-","[A-Za-z0-9_-]",20,KL(20)),"<token>"]],WL=[[/(^|[^A-Za-z0-9+])AKIA[A-Z0-9]{16}(?![A-Za-z0-9+=])/g,"$1<token>"],[/(^|[^A-Za-z0-9+])ASIA[A-Z0-9]{16}(?![A-Za-z0-9+=])/g,"$1<token>"]],qL=[[xd("gh[opusr]_","[A-Za-z0-9]",20,Ac("[A-Za-z0-9]")),"<token>"],[/github_pat_[A-Za-z0-9_]{82,}/g,"<token>"],[/sq0(?:atp|csp)-[A-Za-z0-9_-]{22,}/g,"<token>"],[/(^|[^A-Za-z0-9+/])EAAA[A-Za-z0-9+/=%_-]{56,}/g,"$1<token>"],[xd("gl(?:pat|dt|rt|ft|soat|oas|agent|ptt|cbt|imt|ffct)-","[A-Za-z0-9_=-]",20,Ac("[A-Za-z0-9_=-]"),"(?:\\.[0-9a-z]{9})?"),"<token>"],[xd("(?:xox[abe-z](?:\\.xox[a-z])?|xapp|xwfp)-","[A-Za-z0-9+/=%_-]",10,"(?=[0-9])","",Ac("[A-Za-z0-9+/=%_-]"),"gi"),"<token>"],[new RegExp(`(?:\\bxox[cd]-[A-Za-z0-9+/=%_-]{10,}|xox[cd]-${Ac("[A-Za-z0-9+/=%_-]")}[A-Za-z0-9+/=%_-]{16,})`,"gi"),"<token>"],[Sne,"hooks.slack.com/<redacted>"]],xne=[/\bey[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g,"<jwt>"],vne=/\beyJ(?:[A-Za-z0-9_-]{256}|[A-Za-z0-9_-]{8,2048}\.[A-Za-z0-9_-]{10})/,wne=[PE.bearer,PE.basic,...GL,PE.sk,...WL],Ane=[...qL,xne];function vd(e){return[...wne,...Ane].reduce((t,[n,r])=>t.replace(n,r),String(e))}var aet=[...Ene,...[...GL,...WL,...qL].map(([e])=>new RegExp(e.source,e.flags.replaceAll("g",""))),vne];function xd(e,t,n,r,o="",s="",i="g"){let a=`${t}{${n},}${o}`;return new RegExp(`(?:\\b${e}${s}${a}|${e}${r}${a})`,i)}function Ac(e){return`(?=${e}{0,64}[0-9])`}function KL(e){return`(?=[A-Za-z0-9_-]{0,64}?(?=[A-Za-z0-9]{${e}})(?=[A-Za-z0-9]{0,64}[0-9])(?=[A-Za-z0-9]{0,64}[A-Za-z]))`}Tx();function AN(e){return e}function rl(e){return AN(e)}function TN(e){return AN(e)}class qe extends Error{telemetryMessage;errorClass;constructor(e,t,n){super(e);this.name="TelemetrySafeError",this.telemetryMessage=t??e,this.errorClass=n}}var CN=(e,t)=>{try{if(e!==null&&typeof e==="object"&&!("telemetryMessage"in e)&&Object.isExtensible(e))Object.assign(e,{telemetryMessage:t})}catch{}return e},An=(e,t)=>{try{if(e!==null&&typeof e==="object"&&Object.isExtensible(e)){let n=e,r=Object.entries(t).filter(([o,s])=>s!==void 0&&!(o in n));Object.assign(n,Object.fromEntries(r))}}catch{}return e};function kN(e){try{if(e!==null&&typeof e==="object"&&"telemetryMessage"in e&&typeof e.telemetryMessage==="string")return e.telemetryMessage}catch{}return}function RN(e,t){return e instanceof Error&&e.message===t}function Ur(e){return e instanceof Error?e:Error(String(e))}function Ho(e){return e instanceof Error?e.message:String(e)}function Ne(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return}function Hp(e){return zoe(Ne(e))}function zoe(e){return e&&/^[A-Z][A-Z0-9_]{0,63}$/.test(e)?TN(e):void 0}function br(e){return Ne(e)==="ENOENT"}function Dv(e){return Ne(e)==="EISDIR"}var Hoe=new Set(["ENOENT","EACCES","EPERM","ENOTDIR","ELOOP","ENAMETOOLONG","EROFS"]);function Lv(e){return Boe(Ne(e))}function Boe(e){return e!==void 0&&Hoe.has(e)}import{randomUUID as H0e}from"crypto";import{join as s2}from"path";import{realpathSync as ZU}from"fs";import{cwd as qae}from"process";import{randomUUID as Bp}from"crypto";import{createHash as Goe,randomBytes as Oct}from"crypto";function Mv(e){return e}var ON="[\\w-]{1,63}",Koe=new RegExp(`^${ON}$`),Cct=new RegExp(`^a(?:${ON}-)?[0-9a-f]{16}$`);function PN(e,t){let n=Buffer.from(t.replace(/-/g,""),"hex"),r=Goe("sha1").update(n).update(Buffer.from(e,"utf8")).digest();r[6]=r[6]&15|80,r[8]=r[8]&63|128;let o=r.subarray(0,16).toString("hex");return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20,32)}`}var Woe="3ab19d7e-9f35-45c2-926e-75e271cc60b3";function IN(){let e=process.env.CLAUDE_CODE_REMOTE_SESSION_ID?.trim();return e?PN(e,Woe):null}function qoe(){this.__data__=new Bs,this.size=0}var DN=qoe;function Voe(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var LN=Voe;function Zoe(e){return this.__data__.get(e)}var MN=Zoe;function Yoe(e){return this.__data__.has(e)}var NN=Yoe;var Joe=200;function Xoe(e,t){var n=this.__data__;if(n instanceof Bs){var r=n.__data__;if(!Ks||r.length<Joe-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Zi(r)}return n.set(e,t),this.size=n.size,this}var UN=Xoe;function ol(e){var t=this.__data__=new Bs(e);this.size=t.size}ol.prototype.clear=DN;ol.prototype.delete=LN;ol.prototype.get=MN;ol.prototype.has=NN;ol.prototype.set=UN;var Bo=ol;var Qoe="__lodash_hash_undefined__";function ese(e){return this.__data__.set(e,Qoe),this}var FN=ese;function tse(e){return this.__data__.has(e)}var jN=tse;function Pg(e){var t=-1,n=e==null?0:e.length;this.__data__=new Zi;while(++t<n)this.add(e[t])}Pg.prototype.add=Pg.prototype.push=FN;Pg.prototype.has=jN;var $N=Pg;function nse(e,t){var n=-1,r=e==null?0:e.length;while(++n<r)if(t(e[n],n,e))return!0;return!1}var zN=nse;function rse(e,t){return e.has(t)}var HN=rse;var ose=1,sse=2;function ise(e,t,n,r,o,s){var i=n&ose,a=e.length,c=t.length;if(a!=c&&!(i&&c>a))return!1;var l=s.get(e),u=s.get(t);if(l&&u)return l==t&&u==e;var p=-1,f=!0,m=n&sse?new $N:void 0;s.set(e,t),s.set(t,e);while(++p<a){var h=e[p],g=t[p];if(r)var y=i?r(g,h,p,t,e,s):r(h,g,p,e,t,s);if(y!==void 0){if(y)continue;f=!1;break}if(m){if(!zN(t,function(S,b){if(!HN(m,b)&&(h===S||o(h,S,n,r,s)))return m.push(b)})){f=!1;break}}else if(!(h===g||o(h,g,n,r,s))){f=!1;break}}return s.delete(e),s.delete(t),f}var Ig=ise;var ase=Kt.Uint8Array,sl=ase;function cse(e){var t=-1,n=Array(e.size);return e.forEach(function(r,o){n[++t]=[o,r]}),n}var BN=cse;function lse(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var KN=lse;var use=1,dse=2,pse="[object Boolean]",fse="[object Date]",mse="[object Error]",hse="[object Map]",gse="[object Number]",_se="[object RegExp]",yse="[object Set]",bse="[object String]",Sse="[object Symbol]",Ese="[object ArrayBuffer]",xse="[object DataView]",GN=on?on.prototype:void 0,Nv=GN?GN.valueOf:void 0;function vse(e,t,n,r,o,s,i){switch(n){case xse:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Ese:if(e.byteLength!=t.byteLength||!s(new sl(e),new sl(t)))return!1;return!0;case pse:case fse:case gse:return Mo(+e,+t);case mse:return e.name==t.name&&e.message==t.message;case _se:case bse:return e==t+"";case hse:var a=BN;case yse:var c=r&use;if(a||(a=KN),e.size!=t.size&&!c)return!1;var l=i.get(e);if(l)return l==t;r|=dse,i.set(e,t);var u=Ig(a(e),a(t),r,o,s,i);return i.delete(e),u;case Sse:if(Nv)return Nv.call(e)==Nv.call(t)}return!1}var WN=vse;function wse(e,t){var n=-1,r=t.length,o=e.length;while(++n<r)e[o+n]=t[n];return e}var il=wse;var Ase=Array.isArray,_t=Ase;function Tse(e,t,n){var r=t(e);return _t(e)?r:il(r,n(e))}var Dg=Tse;function Cse(e,t){var n=-1,r=e==null?0:e.length,o=0,s=[];while(++n<r){var i=e[n];if(t(i,n,e))s[o++]=i}return s}var qN=Cse;function kse(){return[]}var Lg=kse;var Rse=Object.prototype,Ose=Rse.propertyIsEnumerable,VN=Object.getOwnPropertySymbols,Pse=!VN?Lg:function(e){if(e==null)return[];return e=Object(e),qN(VN(e),function(t){return Ose.call(e,t)})},al=Pse;function Ise(e,t){var n=-1,r=Array(e);while(++n<e)r[n]=t(n);return r}var ZN=Ise;function Dse(e){return e!=null&&typeof e=="object"}var Xt=Dse;var Lse="[object Arguments]";function Mse(e){return Xt(e)&&pr(e)==Lse}var Uv=Mse;var YN=Object.prototype,Nse=YN.hasOwnProperty,Use=YN.propertyIsEnumerable,Fse=Uv(function(){return arguments}())?Uv:function(e){return Xt(e)&&Nse.call(e,"callee")&&!Use.call(e,"callee")},hs=Fse;var Ng={};rn(Ng,{default:()=>Ko});function jse(){return!1}var JN=jse;var eU=typeof Ng=="object"&&Ng&&!Ng.nodeType&&Ng,XN=eU&&typeof Mg=="object"&&Mg&&!Mg.nodeType&&Mg,$se=XN&&XN.exports===eU,QN=$se?Kt.Buffer:void 0,zse=QN?QN.isBuffer:void 0,Hse=zse||JN,Ko=Hse;var Bse=9007199254740991,Kse=/^(?:0|[1-9]\d*)$/;function Gse(e,t){var n=typeof e;return t=t==null?Bse:t,!!t&&(n=="number"||n!="symbol"&&Kse.test(e))&&(e>-1&&e%1==0&&e<t)}var oi=Gse;var Wse=9007199254740991;function qse(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Wse}var cl=qse;var Vse="[object Arguments]",Zse="[object Array]",Yse="[object Boolean]",Jse="[object Date]",Xse="[object Error]",Qse="[object Function]",eie="[object Map]",tie="[object Number]",nie="[object Object]",rie="[object RegExp]",oie="[object Set]",sie="[object String]",iie="[object WeakMap]",aie="[object ArrayBuffer]",cie="[object DataView]",lie="[object Float32Array]",uie="[object Float64Array]",die="[object Int8Array]",pie="[object Int16Array]",fie="[object Int32Array]",mie="[object Uint8Array]",hie="[object Uint8ClampedArray]",gie="[object Uint16Array]",_ie="[object Uint32Array]",ft={};ft[lie]=ft[uie]=ft[die]=ft[pie]=ft[fie]=ft[mie]=ft[hie]=ft[gie]=ft[_ie]=!0;ft[Vse]=ft[Zse]=ft[aie]=ft[Yse]=ft[cie]=ft[Jse]=ft[Xse]=ft[Qse]=ft[eie]=ft[tie]=ft[nie]=ft[rie]=ft[oie]=ft[sie]=ft[iie]=!1;function yie(e){return Xt(e)&&cl(e.length)&&!!ft[pr(e)]}var tU=yie;function bie(e){return function(t){return e(t)}}var ll=bie;var Fg={};rn(Fg,{default:()=>Go});var nU=typeof Fg=="object"&&Fg&&!Fg.nodeType&&Fg,Kp=nU&&typeof Ug=="object"&&Ug&&!Ug.nodeType&&Ug,Sie=Kp&&Kp.exports===nU,Fv=Sie&&Ah.process,Eie=function(){try{var e=Kp&&Kp.require&&Kp.require("util").types;if(e)return e;return Fv&&Fv.binding&&Fv.binding("util")}catch(t){}}(),Go=Eie;var rU=Go&&Go.isTypedArray,xie=rU?ll(rU):tU,ul=xie;var vie=Object.prototype,wie=vie.hasOwnProperty;function Aie(e,t){var n=_t(e),r=!n&&hs(e),o=!n&&!r&&Ko(e),s=!n&&!r&&!o&&ul(e),i=n||r||o||s,a=i?ZN(e.length,String):[],c=a.length;for(var l in e)if((t||wie.call(e,l))&&!(i&&(l=="length"||o&&(l=="offset"||l=="parent")||s&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||oi(l,c))))a.push(l);return a}var jg=Aie;var Tie=Object.prototype;function Cie(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Tie;return e===n}var dl=Cie;function kie(e,t){return function(n){return e(t(n))}}var $g=kie;var Rie=$g(Object.keys,Object),oU=Rie;var Oie=Object.prototype,Pie=Oie.hasOwnProperty;function Iie(e){if(!dl(e))return oU(e);var t=[];for(var n in Object(e))if(Pie.call(e,n)&&n!="constructor")t.push(n);return t}var sU=Iie;function Die(e){return e!=null&&cl(e.length)&&!Ec(e)}var si=Die;function Lie(e){return si(e)?jg(e):sU(e)}var Wo=Lie;function Mie(e){return Dg(e,Wo,al)}var Gp=Mie;var Nie=1,Uie=Object.prototype,Fie=Uie.hasOwnProperty;function jie(e,t,n,r,o,s){var i=n&Nie,a=Gp(e),c=a.length,l=Gp(t),u=l.length;if(c!=u&&!i)return!1;var p=c;while(p--){var f=a[p];if(!(i?f in t:Fie.call(t,f)))return!1}var m=s.get(e),h=s.get(t);if(m&&h)return m==t&&h==e;var g=!0;s.set(e,t),s.set(t,e);var y=i;while(++p<c){f=a[p];var S=e[f],b=t[f];if(r)var x=i?r(b,S,f,t,e,s):r(S,b,f,e,t,s);if(!(x===void 0?S===b||o(S,b,n,r,s):x)){g=!1;break}y||(y=f=="constructor")}if(g&&!y){var v=e.constructor,A=t.constructor;if(v!=A&&(("constructor"in e)&&("constructor"in t))&&!(typeof v=="function"&&v instanceof v&&typeof A=="function"&&A instanceof A))g=!1}return s.delete(e),s.delete(t),g}var iU=jie;var $ie=Bn(Kt,"DataView"),zg=$ie;var zie=Bn(Kt,"Promise"),Hg=zie;var Hie=Bn(Kt,"Set"),Bg=Hie;var Bie=Bn(Kt,"WeakMap"),Kg=Bie;var aU="[object Map]",Kie="[object Object]",cU="[object Promise]",lU="[object Set]",uU="[object WeakMap]",dU="[object DataView]",Gie=us(zg),Wie=us(Ks),qie=us(Hg),Vie=us(Bg),Zie=us(Kg),ma=pr;if(zg&&ma(new zg(new ArrayBuffer(1)))!=dU||Ks&&ma(new Ks)!=aU||Hg&&ma(Hg.resolve())!=cU||Bg&&ma(new Bg)!=lU||Kg&&ma(new Kg)!=uU)ma=function(e){var t=pr(e),n=t==Kie?e.constructor:void 0,r=n?us(n):"";if(r)switch(r){case Gie:return dU;case Wie:return aU;case qie:return cU;case Vie:return lU;case Zie:return uU}return t};var gs=ma;var Yie=1,pU="[object Arguments]",fU="[object Array]",Gg="[object Object]",Jie=Object.prototype,mU=Jie.hasOwnProperty;function Xie(e,t,n,r,o,s){var i=_t(e),a=_t(t),c=i?fU:gs(e),l=a?fU:gs(t);c=c==pU?Gg:c,l=l==pU?Gg:l;var u=c==Gg,p=l==Gg,f=c==l;if(f&&Ko(e)){if(!Ko(t))return!1;i=!0,u=!1}if(f&&!u)return s||(s=new Bo),i||ul(e)?Ig(e,t,n,r,o,s):WN(e,t,c,n,r,o,s);if(!(n&Yie)){var m=u&&mU.call(e,"__wrapped__"),h=p&&mU.call(t,"__wrapped__");if(m||h){var g=m?e.value():e,y=h?t.value():t;return s||(s=new Bo),o(g,y,n,r,s)}}if(!f)return!1;return s||(s=new Bo),iU(e,t,n,r,o,s)}var hU=Xie;function gU(e,t,n,r,o){if(e===t)return!0;if(e==null||t==null||!Xt(e)&&!Xt(t))return e!==e&&t!==t;return hU(e,t,n,r,gU,o)}var pl=gU;function Qie(e,t){return pl(e,t)}var fl=Qie;import{basename as tae,dirname as _U}from"path";var eae;function Te(){return eae===!0}class tt{#e;#t=new WeakMap;constructor(e){this.#e=e}of(e){let t=this.#t.get(e);if(t!==void 0)return t;let n=this.#e();return this.#t.set(e,n),n}}bd();class Wg{mergedSettings=null;perSource=new Map;parsedFiles=new Map;folderListings=new Map;managedFileReads=new Map;primedFiles=new Set;policyWalks=0;walkedFolders=new Map;policy={};lastPolicyEnvComposition=null;isLoadingFromDisk=!1;autoModeUntrustedSourceWarned=!1;changed=$t();internalWrites=new Map;enabledSources;pluginBase;epoch=0;systemSpaceServingLogged=!1;systemAttestationContradicted=!1;backendReadResetTail=Promise.resolve();invalidated=$t();pluginBaseLoaded=!1;primer;localStoreProbes=new yU;retained=new Map;retainedListings=new Map;setPluginBase(e){this.pluginBase=e,this.pluginBaseLoaded=!0}clearPluginBase(){this.pluginBase=void 0}invalidateAll(e){if(this.epoch++,this.mergedSettings=null,this.perSource.clear(),this.parsedFiles.clear(),this.primedFiles.clear(),this.policyWalks=0,this.walkedFolders.clear(),this.folderListings.clear(),this.policy={},e?.userLayer==="retain"&&Te()&&this.primer!==void 0){for(let[t,n]of this.retained)this.parsedFiles.set(t,n.parsed),this.primedFiles.add(t);for(let[t,n]of this.retainedListings)this.folderListings.set(t,n.names)}else this.retained.clear(),this.retainedListings.clear();this.invalidated.emit()}invalidatePolicyLayer(){this.mergedSettings=null,this.perSource.delete("policySettings"),this.policy={}}onInvalidate(e){return this.invalidated.subscribe(e)}seedParsedFile(e,t,n,r){if(r!==this.epoch)return!1;let o=this.parsedFiles.get(e),s=o===void 0||!fl(o,n);if(this.parsedFiles.set(e,n),s||this.primedFiles.has(e))this.primedFiles.add(e);let i=this.retained.get(e);if(i!==void 0)i.parsed=n;if(s)this.dropDerivedCaches(t);return!0}walkReadDiffers(e,t){let n=this.parsedFiles.get(e);return n!==void 0&&!this.primedFiles.has(e)&&!fl(n,t)}unseedParsedFile(e,t,n){if(n!==this.epoch)return;if(this.retained.delete(e),!this.primedFiles.has(e)||t==="policySettings"&&this.policyWalks>0)return;this.primedFiles.delete(e),this.parsedFiles.delete(e),this.dropDerivedCaches(t)}dropDerivedCaches(e){if(this.perSource.delete(e),this.mergedSettings=null,e==="policySettings")this.policy={}}primedFolderListing(e){return Te()?this.folderListings.get(e):void 0}folderListingForPolicyWalk(e){if(!Te())return;this.policyWalks++;let t=this.folderListings.get(e);if(!this.walkedFolders.has(e)||t!==void 0)this.walkedFolders.set(e,t??null);return t}noteWalkListing(e,t){if(!Te())return;this.walkedFolders.set(e,t)}get policyWalkCount(){return this.policyWalks}policyInstallVerdict(e,t,n){let r=this.parsedFiles.get(e);if(r===void 0||fl(r,t))return"install";if(!this.primedFiles.has(e))return"raced";if(this.policyWalks===0)return"install";return this.policyWalks>n?"raced":"deferred"}folderInstallVerdict(e,t,n){if(!this.walkedFolders.has(e))return this.hasParsedDropInOutside(e,t)?"raced":"install";let r=this.walkedFolders.get(e);if(r!==null&&r!==void 0&&fl(r,t))return"install";return this.policyWalks>n?"raced":"deferred"}seedFolderListing(e,t,n){if(n!==this.epoch)return!1;let r=this.folderListings.get(e);this.folderListings.set(e,t);let o=this.retainedListings.get(e);if(o!==void 0)o.names=t;if(r!==void 0&&!fl(r,t))this.dropDerivedCaches("policySettings");return!0}walkReadManagedFileIn(e,t){for(let[n,r]of this.parsedFiles)if(!n.includes("\x00")&&!this.primedFiles.has(n)&&r.settings!==null&&(n===e||_U(n)===t))return!0;return!1}hasParsedDropInOutside(e,t){for(let n of this.parsedFiles.keys())if(!n.includes("\x00")&&!this.primedFiles.has(n)&&_U(n)===e&&!t.includes(tae(n)))return!0;return!1}clearFolderListing(e,t){if(t!==this.epoch)return;if(this.retainedListings.delete(e),!this.folderListings.has(e)||this.walkedFolders.has(e))return;this.folderListings.delete(e),this.dropDerivedCaches("policySettings")}retainLayer(e,t){let n={parsed:t};return this.retained.set(e,n),()=>{if(this.retained.get(e)===n)this.retained.delete(e)}}dropRetainedLayer(e){this.retained.delete(e)}retainFolderListing(e,t){let n={names:t};return this.retainedListings.set(e,n),()=>{if(this.retainedListings.get(e)===n)this.retainedListings.delete(e)}}}class yU{ownerUidsByRoot=new Map;realHomeDir=void 0;canonicalRootOwnerUids(e,t){let n=this.ownerUidsByRoot.get(e);if(n!==void 0)return n;let r=t(e);return this.ownerUidsByRoot.set(e,r),r}hasCanonicalRootOwnerUids(e){return this.ownerUidsByRoot.has(e)}primeCanonicalRootOwnerUids(e,t){if(this.ownerUidsByRoot.has(e))return!1;return this.ownerUidsByRoot.set(e,t),!0}clearCanonicalRootOwnerUids(){this.ownerUidsByRoot.clear()}normalizedRealHomeDir(e){return this.realHomeDir??=e(),this.realHomeDir}clearNormalizedRealHomeDir(){this.realHomeDir=void 0}}var jv=new tt(()=>new Wg);function Wp(){return{sent:new Set,rejected:new Set}}class $v{spawner=void 0;pairings=new Map;mainEnsureInFlight=!1;mainSlotBlocked=!1}class zv{#e=Wp();#t=new Map;#n=void 0;stickyBetas(){return this.#e}unlatchStickyBetas(){this.#e=Wp()}perTurnEffortPins(){return this.#t}atisLatch(){return this.#n}replaceAtisLatch(e){this.#n=e}reset(){this.#e=Wp(),this.#t=new Map,this.#n=void 0}}var nae=function(){try{var e=Bn(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),ml=nae;function rae(e,t,n){if(t=="__proto__"&&ml)ml(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0});else e[t]=n}var ii=rae;function oae(e){return function(t,n,r){var o=-1,s=Object(t),i=r(t),a=i.length;while(a--){var c=i[e?a:++o];if(n(s[c],c,s)===!1)break}return t}}var bU=oae;var sae=bU(),qg=sae;function iae(e,t){return e&&qg(e,t,Wo)}var SU=iae;var aae=1,cae=2;function lae(e,t,n,r){var o=n.length,s=o,i=!r;if(e==null)return!s;e=Object(e);while(o--){var a=n[o];if(i&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}while(++o<s){a=n[o];var c=a[0],l=e[c],u=a[1];if(i&&a[2]){if(l===void 0&&!(c in e))return!1}else{var p=new Bo;if(r)var f=r(l,u,c,e,t,p);if(!(f===void 0?pl(u,l,aae|cae,r,p):f))return!1}}return!0}var EU=lae;function uae(e){return e===e&&!zt(e)}var Vg=uae;function dae(e){var t=Wo(e),n=t.length;while(n--){var r=t[n],o=e[r];t[n]=[r,o,Vg(o)]}return t}var xU=dae;function pae(e,t){return function(n){if(n==null)return!1;return n[e]===t&&(t!==void 0||(e in Object(n)))}}var Zg=pae;function fae(e){var t=xU(e);if(t.length==1&&t[0][2])return Zg(t[0][0],t[0][1]);return function(n){return n===e||EU(n,e,t)}}var vU=fae;var mae="[object Symbol]";function hae(e){return typeof e=="symbol"||Xt(e)&&pr(e)==mae}var hl=hae;var gae=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_ae=/^\w*$/;function yae(e,t){if(_t(e))return!1;var n=typeof e;if(n=="number"||n=="symbol"||n=="boolean"||e==null||hl(e))return!0;return _ae.test(e)||!gae.test(e)||t!=null&&e in Object(t)}var gl=yae;var bae=500;function Sae(e){var t=Ed(e,function(r){if(n.size===bae)n.clear();return r}),n=t.cache;return t}var wU=Sae;var Eae=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xae=/\\(\\)?/g,vae=wU(function(e){var t=[];if(e.charCodeAt(0)===46)t.push("");return e.replace(Eae,function(n,r,o,s){t.push(o?s.replace(xae,"$1"):r||n)}),t}),AU=vae;function wae(e,t){var n=-1,r=e==null?0:e.length,o=Array(r);while(++n<r)o[n]=t(e[n],n,e);return o}var _l=wae;var Aae=1/0,TU=on?on.prototype:void 0,CU=TU?TU.toString:void 0;function kU(e){if(typeof e=="string")return e;if(_t(e))return _l(e,kU)+"";if(hl(e))return CU?CU.call(e):"";var t=e+"";return t=="0"&&1/e==-Aae?"-0":t}var RU=kU;function Tae(e){return e==null?"":RU(e)}var OU=Tae;function Cae(e,t){if(_t(e))return e;return gl(e,t)?[e]:AU(OU(e))}var Fr=Cae;var kae=1/0;function Rae(e){if(typeof e=="string"||hl(e))return e;var t=e+"";return t=="0"&&1/e==-kae?"-0":t}var Sr=Rae;function Oae(e,t){t=Fr(t,e);var n=0,r=t.length;while(e!=null&&n<r)e=e[Sr(t[n++])];return n&&n==r?e:void 0}var ai=Oae;function Pae(e,t,n){var r=e==null?void 0:ai(e,t);return r===void 0?n:r}var PU=Pae;function Iae(e,t){return e!=null&&t in Object(e)}var IU=Iae;function Dae(e,t,n){t=Fr(t,e);var r=-1,o=t.length,s=!1;while(++r<o){var i=Sr(t[r]);if(!(s=e!=null&&n(e,i)))break;e=e[i]}if(s||++r!=o)return s;return o=e==null?0:e.length,!!o&&cl(o)&&oi(i,o)&&(_t(e)||hs(e))}var DU=Dae;function Lae(e,t){return e!=null&&DU(e,t,IU)}var Yg=Lae;var Mae=1,Nae=2;function Uae(e,t){if(gl(e)&&Vg(t))return Zg(Sr(e),t);return function(n){var r=PU(n,e);return r===void 0&&r===t?Yg(n,e):pl(t,r,Mae|Nae)}}var LU=Uae;function Fae(e){return e}var yl=Fae;function jae(e){return function(t){return t==null?void 0:t[e]}}var MU=jae;function $ae(e){return function(t){return ai(t,e)}}var NU=$ae;function zae(e){return gl(e)?MU(Sr(e)):NU(e)}var UU=zae;function Hae(e){if(typeof e=="function")return e;if(e==null)return yl;if(typeof e=="object")return _t(e)?LU(e[0],e[1]):vU(e);return UU(e)}var ci=Hae;function Bae(e,t){var n={};return t=ci(t,3),SU(e,function(r,o,s){ii(n,o,t(r,o,s))}),n}var Hv=Bae;function Kae(e,t){var n,r=-1,o=e.length;while(++r<o){var s=t(e[r]);if(s!==void 0)n=n===void 0?s:n+s}return n}var FU=Kae;function Gae(e,t){return e&&e.length?FU(e,ci(t,2)):0}var bl=Gae;function Jg(e){let t=Object.create(null);return Object.assign(t,e)}class Bv{#e=0;#t=0;#n=0;#r=0;#i=Date.now();#c=void 0;#o=0;#l=0;#u=!1;#a=Jg();#s=null;#p=null;#d=null;totalCostUSD(){return this.#e}totalAPIDuration(){return this.#t}totalAPIDurationWithoutRetries(){return this.#n}totalToolDuration(){return this.#r}totalDuration(){return Math.max(0,Date.now()-this.#i)}sessionStartTime(){return this.#c??this.#i}totalLinesAdded(){return this.#o}totalLinesRemoved(){return this.#l}hasUnknownModelCost(){return this.#u}modelUsage(){return this.#a}usageForModel(e){return this.#a[e]}totalInputTokens(){return bl(Object.values(this.#a),"inputTokens")}totalOutputTokens(){return bl(Object.values(this.#a),"outputTokens")}totalCacheReadInputTokens(){return bl(Object.values(this.#a),"cacheReadInputTokens")}totalCacheCreationInputTokens(){return bl(Object.values(this.#a),"cacheCreationInputTokens")}totalWebSearchRequests(){return bl(Object.values(this.#a),"webSearchRequests")}recordApiDuration(e,t){this.#t+=e,this.#n+=t}recordCost(e,t,n){this.#a[n]=t,this.#e+=e}recordToolDuration(e){this.#r+=e}recordLinesChanged(e,t){this.#o+=e,this.#l+=t}markUnknownModelCost(){this.#u=!0}zeroDurationsAndCostForTests(){this.#t=0,this.#n=0,this.#e=0}restartClock(){this.#i=Date.now(),this.anchorLogicalStart(void 0)}anchorLogicalStart(e){this.#c=e===void 0?void 0:Math.min(e,this.#i)}restore({totalCostUSD:e,totalAPIDuration:t,totalAPIDurationWithoutRetries:n,totalToolDuration:r,totalLinesAdded:o,totalLinesRemoved:s,lastDuration:i,startTime:a,modelUsage:c,hasUnknownModelCost:l},u){if(this.#d=u,this.#e=e,this.#t=t,this.#n=n,this.#r=r,this.#o=o,this.#l=s,this.#u=l??!1,c)this.#a=Jg(c);if(i!==void 0)this.#i=Date.now()-i;this.anchorLogicalStart(a)}registerSaver(e){this.#s=e}runSaver(e,t){(this.#s??(t?t.#s:null))?.(e)}registerTranscriptRecorder(e){this.#p=e}runTranscriptRecorder(e,t,n){(this.#p??(n?n.#p:null))?.(e,t)}snapshot(){return{ownerSessionId:this.#d,totalCostUSD:this.#e,totalAPIDuration:this.#t,totalAPIDurationWithoutRetries:this.#n,totalToolDuration:this.#r,startTime:this.#i,sessionLogicalStartTime:this.#c,totalLinesAdded:this.#o,totalLinesRemoved:this.#l,hasUnknownModelCost:this.#u,modelUsage:Hv(this.#a,(e)=>({...e}))}}restoreSnapshot(e){this.#d=e.ownerSessionId,this.#e=e.totalCostUSD,this.#t=e.totalAPIDuration,this.#n=e.totalAPIDurationWithoutRetries,this.#r=e.totalToolDuration,this.#i=e.startTime,this.#c=e.sessionLogicalStartTime,this.#o=e.totalLinesAdded,this.#l=e.totalLinesRemoved,this.#u=e.hasUnknownModelCost,this.#a=Jg(Hv(e.modelUsage,(t)=>({...t})))}claim(e){this.#d??=e}scopeTo(e){this.#d=e}ownerSessionId(){return this.#d}belongsTo(e){return this.#d===e}reset(e){this.#d=e,this.#e=0,this.#t=0,this.#n=0,this.#r=0,this.#i=Date.now(),this.anchorLogicalStart(void 0),this.#o=0,this.#l=0,this.#u=!1,this.#a=Jg()}}class Kv{#e=!1;fableConsentSessionFallback(){return this.#e}replaceFableConsentSessionFallback(e){this.#e=e}reset(){this.#e=!1}}class Gv{#e={registeredHooks:null};#t=void 0;#n=void 0;holder(){return this.#e}mainThreadAgentType(){return this.#t}replaceMainThreadAgentType(e){this.#t=e}mainThreadAgentHooks(){return this.#n}replaceMainThreadAgentHooks(e){this.#n=e}reset(){this.#e={registeredHooks:null},this.#t=void 0,this.#n=void 0}}class Wv{#e=new Map;skills(){return this.#e}lookup(e){return this.#e.get(e)}record(e,t){this.#e.set(e,t)}forget(e){this.#e.delete(e)}forgetAll(){this.#e.clear()}reset(){this.#e=new Map}}class qv{#e=[];#t;#n;#r;approvedServers(){return this.#e}approveServers(e,t){for(let n of t)if(!this.#e.some((r)=>r.name===n&&r.workspaceKey===e))this.#e.push({name:n,workspaceKey:e})}registerClientsAccessor(e){this.#t=e}acquireClientsAccessor(e){if(this.#t)return()=>{};return this.#t=e,()=>{if(this.#t===e)this.#t=void 0}}clientsFromAccessor(){return this.#t?.()}registerConnectedClientWiring(e){this.#n=e}connectedClientWiring(){return this.#n}registerToolsSwapper(e){this.#r=e}acquireToolsSwapper(e){if(this.#r)return()=>{};return this.#r=e,()=>{if(this.#r===e)this.#r=void 0}}swapServerTools(e,t){if(!this.#r)return!1;return this.#r(e,t)}reset(){this.#e=[],this.#t=void 0}}class Vv{#e=void 0;#t=void 0;#n=void 0;#r=void 0;#i=!1;#c=!1;#o=void 0;#l=void 0;mainLoopModelOverride(){return this.#e}overrideMainLoopModel(e){this.#e=e}initialMainLoopModel(){return this.#t}replaceInitialMainLoopModel(e){this.#t=e}resolvedOrgDefault(){return this.#n}replaceResolvedOrgDefault(e){this.#n=e}initialEnvDefaultModel(){return this.#r}replaceInitialEnvDefaultModel(e){this.#r=e}refusalFallbackOccurred(){return this.#i}markRefusalFallbackOccurred(e){this.#i=!0,this.#o??=e}refusalFallbackHeaderArmed(){return this.#c}armRefusalFallbackHeader(e){this.#c=!0,this.#o??=e}refusalFallbackLatchOriginRequestId(){return this.#o}forgetRefusalFallbackOccurred(){this.#i=!1,this.#c=!1,this.#o=void 0}refusalFallbackModelLatch(){return this.#l}replaceRefusalFallbackModelLatch(e){this.#l=e}unlatchRefusalFallbackModel(){this.#l=void 0}reset(){this.#e=void 0,this.#t=void 0,this.#n=void 0,this.#r=void 0,this.#i=!1,this.#c=!1,this.#o=void 0,this.#l=void 0}}class Zv{#e=new Map;#t=null;#n=0;#r=null;sections(){return this.#e}recordSection(e,t){this.#e.set(e,t)}forgetAllSections(){this.#e.clear()}noteInvalidation(){this.#n+=1}epoch(){return this.#n}registerWordingLatchClear(e){this.#r=e}clearWordingLatch(e){(this.#r??(e?e.#r:null))?.()}lastEmittedDate(){return this.#t}replaceLastEmittedDate(e){this.#t=e}reset(){this.#e=new Map,this.#t=null}}class Yv{#e=null;#t=null;#n=null;#r=null;#i=null;#c=0;#o=void 0;#l=null;#u=null;#a=null;#s=!1;lastAPIRequest(){return this.#e}replaceLastAPIRequest(e){this.#e=e}lastCancelledAPIMessageId(){return this.#t}replaceLastCancelledAPIMessageId(e){this.#t=e}lastAPIRequestMessages(){return this.#n}replaceLastAPIRequestMessages(e){this.#n=e}lastClassifierRequests(){return this.#r}replaceLastClassifierRequests(e){this.#r=e}promptId(){return this.#i}replacePromptId(e){this.#i=e}promptIndex(){return this.#c}replacePromptIndex(e){this.#c=e}incrementPromptIndex(){return this.#c++,this.#c}lastMainRequestId(){return this.#o}replaceLastMainRequestId(e){this.#o=e}lastMainThreadCacheTtlMs(){return this.#l}replaceLastMainThreadCacheTtlMs(e){this.#l=e,this.#u=Date.now()}lastMainThreadRequestAt(){return this.#u}clearLastMainThreadRequest(){this.#l=null,this.#u=null}lastApiCompletionTimestamp(){return this.#a}replaceLastApiCompletionTimestamp(e){this.#a=e}pendingPostCompaction(){return this.#s}replacePendingPostCompaction(e){this.#s=e}reset(){this.#e=null,this.#t=null,this.#n=null,this.#r=null,this.#i=null,this.#c=0,this.#o=void 0,this.#l=null,this.#u=null,this.#a=null,this.#s=!1}}class Jv{#e=[];#t=Object.create(null);#n=null;#r=0;#i=!1;#c=0;tasks(){return this.#e}schedule(e){this.#e.push(e)}replaceTasks(e){this.#e=e}chainStartedAt(e){return this.#t[e]}recordChainStart(e,t){this.#t[e]=t}forgetChainStart(e){delete this.#t[e]}tickInFlightPrompt(){return this.#n}replaceTickInFlightPrompt(e){this.#n=e}consecutiveKeepalives(){return this.#r}replaceConsecutiveKeepalives(e){this.#r=e}ended(){return this.#i}replaceEnded(e){this.#i=e}wakeFires(){return this.#c}recordWakeFire(){this.#c++}resetWakeFires(){this.#c=0}reset(){this.#e=[],this.#t=Object.create(null),this.#n=null,this.#r=0,this.#i=!1,this.#c=0}}class Xv{#e=!1;#t=!1;#n=!1;#r=!1;#i=!1;#c=!1;#o=!1;#l=!1;#u=!1;#a=null;#s=null;#p=null;#d=!1;#f=null;#m=!1;#E=!1;#h=!1;#y=!1;#b=!1;#_=void 0;#x=void 0;#v=null;#S=null;onboardingShownThisSession(){return this.#e}replaceOnboardingShownThisSession(e){this.#e=e}lspRecommendationShownThisSession(){return this.#t}replaceLspRecommendationShownThisSession(e){this.#t=e}sessionTrustAccepted(){return this.#n}replaceSessionTrustAccepted(e){this.#n=e}homeTrustDialogAccepted(){return this.#r}replaceHomeTrustDialogAccepted(e){this.#r=e}hasExitedPlanMode(){return this.#i}replaceHasExitedPlanMode(e){this.#i=e}needsPlanModeExitAttachment(){return this.#c}replaceNeedsPlanModeExitAttachment(e){this.#c=e}needsAutoModeExitAttachment(){return this.#o}replaceNeedsAutoModeExitAttachment(e){this.#o=e}memoryToggledOff(){return this.#l}replaceMemoryToggledOff(e){this.#l=e}teardownUnwindRequested(){return this.#d}replaceTeardownUnwindRequested(e){this.#d=e}backgroundAutoModeSetupInFlight(){return this.#u}replaceBackgroundAutoModeSetupInFlight(e){this.#u=e}deferredToolStubGateLatch(){return this.#a}replaceDeferredToolStubGateLatch(e){this.#a=e}verifySkillRolloutGateLatch(){return this.#s}replaceVerifySkillRolloutGateLatch(e){this.#s=e}commitSkillRolloutGateLatch(){return this.#p}replaceCommitSkillRolloutGateLatch(e){this.#p=e}memoryToolsShapeLatch(){return this.#f}replaceMemoryToolsShapeLatch(e){this.#f=e}proposeGoalAvailabilityLogged(){return this.#m}markProposeGoalAvailabilityLogged(){this.#m=!0}activeRoutine(){return this.#_}replaceActiveRoutine(e){this.#_=e}inheritedTeamName(){return this.#x}replaceInheritedTeamName(e){this.#x=e}teleportedSessionInfo(){return this.#v}replaceTeleportedSessionInfo(e){this.#v=e}markFirstTeleportMessageLogged(){if(this.#v)this.#v.hasLoggedFirstMessage=!0}cachedClaudeMdContent(){return this.#S}replaceCachedClaudeMdContent(e){this.#S=e}accountSkillsSyncEnabled(){return this.#E}replaceAccountSkillsSyncEnabled(e){this.#E=e}skillsSyncVetoed(){return this.#h}replaceSkillsSyncVetoed(e){this.#h=e}accountPluginsSyncEnabled(){return this.#y}replaceAccountPluginsSyncEnabled(e){this.#y=e}pluginsSyncVetoed(){return this.#b}replacePluginsSyncVetoed(e){this.#b=e}reset(){this.#E=!1,this.#h=!1,this.#y=!1,this.#b=!1,this.#e=!1,this.#t=!1,this.#n=!1,this.#r=!1,this.#i=!1,this.#c=!1,this.#o=!1,this.#l=!1,this.#d=!1,this.#u=!1,this.#a=null,this.#s=null,this.#p=null,this.#f=null,this.#m=!1,this.#_=void 0,this.#x=void 0,this.#v=null,this.#S=null}}class Qv{#e=new Map;#t=new Map;#n=null;#r=new Map;#i=new Set;#c=new Set;#o=new Set;#l=new Set;#u=new Set;#a=new Map;#s=new Set;#p=void 0;#d=void 0;#f=void 0;planSlugCache(){return this.#e}forgetPlanSlug(e){this.#e.delete(e)}pendingBranchLinks(){return this.#t}replacePendingBranchLinks(){this.#t=new Map}vimSharedState(){return this.#n}replaceVimSharedState(e){this.#n=e}agentColorMap(){return this.#r}sessionCreatedTeams(){return this.#i}surfacedHookSpawnFailures(){return this.#c}bareMcpServerMatchersWarned(){return this.#o}pendingPrLinks(){return this.#l}policyPredicateTelemetryEmitted(){return this.#u}humanAttachmentDigests(){return this.#a}chromeAvailabilityStagesLogged(){return this.#s}replaceChromeAvailabilityStagesLogged(e){if(this.#s=new Set,e)this.#p=Date.now()}chromeAvailabilityAnchorMs(){return this.#p}pendingGoalIdleCheckin(){return this.#d}replacePendingGoalIdleCheckin(e){this.#d=e}coordinatorWorkerCheckin(){return this.#f}replaceCoordinatorWorkerCheckin(e){this.#f=e}reset(){this.#e=new Map,this.#t=new Map,this.#n=null,this.#r=new Map,this.#i=new Set,this.#c=new Set,this.#o=new Set,this.#l=new Set,this.#u=new Set,this.#a=new Map,this.#s=new Set,this.#p=void 0,clearTimeout(this.#d),this.#d=void 0,clearInterval(this.#f?.timer),this.#f=void 0}}var jU={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};class ew{#e=!1;#t=void 0;#n=void 0;#r=void 0;#i=null;#c=!1;#o=void 0;#l=jU;#u=!1;#a=!1;attacherCapsChanged=$t();rvSupervisorLinkChanged=$t();sdkDialogHostActive(){return this.#e}markSdkDialogHostActive(e){this.#e=e}sdkSupportedDialogKinds(){return this.#t}sdkSupportedDialogKindsSource(){return this.#n}declareDialogKinds(e,t){this.#t=e,this.#n=e===void 0?void 0:t}sdkPerTaskStopAffordance(){return this.#r}declarePerTaskStopAffordance(e){this.#r=e}attacherCaps(){return this.#i}replaceAttacherCaps(e){this.#i=e,this.attacherCapsChanged.emit()}rvSupervisorLinkLive(){return this.#c}replaceRvSupervisorLinkLive(e){if(this.#c===e)return;this.#c=e,this.rvSupervisorLinkChanged.emit()}sdkBetas(){return this.#o}replaceSdkBetas(e){this.#o=e}caps(){return this.#l}replaceCaps(e){this.#l=e}markRemote(e){this.#l={...this.#l,workspace:e?"remote":"local"}}replBridgeActive(){return this.#u}replaceReplBridgeActive(e){if(this.#u===e)return;this.#u=e}mainLoopBusy(){return this.#a}replaceMainLoopBusy(e){this.#a=e}reset(){this.#e=!1,this.#t=void 0,this.#n=void 0,this.#r=void 0,this.#i=null,this.#o=void 0,this.#l=jU,this.#u=!1,this.#a=!1,this.#c=!1,this.attacherCapsChanged.clear(),this.rvSupervisorLinkChanged.clear()}}class tw{#e=0;#t=null;#n=0;outputTokensAtTurnStart(){return this.#e}budget(){return this.#t}continuationCount(){return this.#n}snapshotForTurn(e,t){this.#e=e,this.#t=t,this.#n=0}incrementContinuation(){this.#n++}reset(){this.#e=0,this.#t=null,this.#n=0}}var $U=150;class nw{#e=Date.now();#t=!1;interactionFired=$t();#n=void 0;terminalFocusFired=$t();#r=!1;#i;lastInteractionTime(){return this.#e}recordInteraction(e){if(e)this.#c();else this.#t=!0}flushIfDirty(){if(this.#t)this.#c()}#c(){this.#e=Date.now(),this.#t=!1,this.interactionFired.emit()}resetBaseline(){this.#e=Date.now(),this.#t=!1}terminalFocus(){return this.#n}updateTerminalFocus(e){this.#n=e,this.terminalFocusFired.emit()}scrollDraining(){return this.#r}markScrollActivity(){if(this.#r=!0,this.#i)clearTimeout(this.#i);this.#i=setTimeout(()=>{this.#r=!1,this.#i=void 0},$U),this.#i.unref?.()}async waitForScrollIdle(){while(this.#r)await new Promise((e)=>setTimeout(e,$U))}reset(){this.#e=Date.now(),this.#n=void 0,this.interactionFired.clear(),this.terminalFocusFired.clear()}}var Wae=["sdk_single_prompt_gate","subagent_estimate","subagent_final_turn"];class rw{byAgent=new Map;attemptsByAgent=new Map;cappedFailuresByAgent=new Map;armGateEventEmitted=new Set;sidecarIo=Promise.resolve();rehydrateAttemptedSessions=new Set;sidecarReadsAhead=new Map;get(e){return this.byAgent.get(e)}has(e){return this.byAgent.has(e)}put(e,t){this.byAgent.set(e,t)}remove(e){this.byAgent.delete(e)}nextAttemptNumber(e){let t=(this.attemptsByAgent.get(e)??0)+1;return this.attemptsByAgent.set(e,t),t}consecutiveCountedFailures(e){return this.cappedFailuresByAgent.get(e)??0}recordCountedFailure(e){let t=(this.cappedFailuresByAgent.get(e)??0)+1;return this.cappedFailuresByAgent.set(e,t),t}clearCountedFailures(e){this.cappedFailuresByAgent.delete(e)}latchArmGateEvent(e){if(this.armGateEventEmitted.has(e))return!1;return this.armGateEventEmitted.add(e),!0}enqueueSidecarIo(e,t){return this.sidecarIo=this.sidecarIo.then(e,e).catch(t),this.sidecarIo}sidecarIoSettled(){return this.sidecarIo}hasAttemptedRehydrate(e){return this.rehydrateAttemptedSessions.has(e)}markRehydrateAttempted(e){this.rehydrateAttemptedSessions.add(e)}keepSidecarReadAhead(e,t){this.sidecarReadsAhead.delete(e);while(this.sidecarReadsAhead.size>=8){let n=this.sidecarReadsAhead.keys().next().value;if(n===void 0)break;this.sidecarReadsAhead.delete(n)}this.sidecarReadsAhead.set(e,t)}takeSidecarReadAhead(e){let t=this.sidecarReadsAhead.get(e);return this.sidecarReadsAhead.delete(e),t}dropSidecarReadAhead(e){this.sidecarReadsAhead.delete(e)}forgetSubagentTelemetry(e){this.attemptsByAgent.delete(e),this.cappedFailuresByAgent.delete(e);for(let t of Wae)this.armGateEventEmitted.delete(`${e}:${t}`)}}class ow{#e=null;#t=null;mainAgentId(e){return this.#e??=Mv(e),this.#e}projectDir(){return this.#t}replaceProjectDir(e){this.#t=e}}class sw{granted=!1;isGranted(){return this.granted}grant(){this.granted=!0}}class iw{inFlight=null;startedForTurnEnd=!1;reset(){this.inFlight?.abort(),this.inFlight=null,this.startedForTurnEnd=!1}}class aw{firstSyncPromise=null;syncErrors=[];syncedLaneOpened=!1;pendingTrashRemovals=[]}class cw{abortController=null;reset(){this.abortController?.abort(),this.abortController=null}}class lw{#e=void 0;#t=void 0;ccrSessionID(){return this.#e}latchCcrSessionID(e){this.#e=e}syncEnabled(){return this.#t}latchSyncEnabled(e){return this.#t=e,e}}class uw{autonomousPreambleDelivered=!1;lastLoopFileDelivered=null;reset(){this.autonomousPreambleDelivered=!1,this.lastLoopFileDelivered=null}}class dw{exchanges=[];replace(e){this.exchanges=e}append(e,t,n){this.exchanges=[...this.exchanges,{question:e,response:t,...n&&{fallbackNotice:n}}].slice(-20)}}class pw{pending=null;shownThisSession=!1;changed=$t();subscribe=this.changed.subscribe;getSnapshot=()=>this.pending;offer(e){if(this.shownThisSession)return;this.pending=e,this.changed.emit()}dismiss(){if(this.pending!==null)this.pending=null,this.changed.emit()}markShown(){this.shownThisSession=!0}}class fw{lastEmittedAt=new Map;shouldEmit(e,t,n){let r=this.lastEmittedAt.get(e)||0;if(t-r<n)return!1;if(this.lastEmittedAt.size>=100){let o=this.lastEmittedAt.keys().next().value;if(o!==void 0)this.lastEmittedAt.delete(o)}return this.lastEmittedAt.set(e,t),!0}}class mw{pathsByToolUse=new Map;stash(e,t,n){if(e===void 0)return;let r=zU(e,t),o=this.pathsByToolUse.get(r);if(o!==void 0){let s=new Set(n);this.pathsByToolUse.set(r,o.filter((i)=>s.has(i)));return}if(this.pathsByToolUse.size>=256){let s=this.pathsByToolUse.keys().next().value;if(s!==void 0)this.pathsByToolUse.delete(s)}this.pathsByToolUse.set(r,n)}consume(e,t){if(e===void 0)return;let n=this.pathsByToolUse.get(zU(e,t)),r=`${e}\x00`;for(let o of this.pathsByToolUse.keys())if(o.startsWith(r))this.pathsByToolUse.delete(o);return n}}function zU(e,t){return`${e}\x00${t}`}function HU(e){return BU({kind:"root",host:e.host,id:e.id,parentId:e.parentId},e.project)}function BU(e,t){let n=ct(t.originalCwd),r=ct(t.projectRoot),o=ct(t.cwd),s=$t(),i=e.kind==="fork"?e.root.observers:new $v,a=e.kind==="fork"?e.root.autonomousLoopPreamble:new uw,c=e.kind==="fork"?e.root.precompute:new rw,l={get originalCwd(){return n},get projectRoot(){return r},get cwd(){return o}},u={host:e.kind==="fork"?e.root.host:e.host,get id(){return e.kind==="fork"?e.root.id:e.id},get parentId(){return e.kind==="fork"?e.root.parentId:e.parentId},get root(){return e.kind==="fork"?e.root:u},project:l,observers:i,autonomousLoopPreamble:a,btwHistory:e.kind==="fork"?e.root.btwHistory:new dw,ccrRecap:e.kind==="fork"?e.root.ccrRecap:new iw,conversationLatches:e.kind==="fork"?e.root.conversationLatches:new zv,costLedger:e.kind==="fork"?e.root.costLedger:new Bv,fableConsentSlots:e.kind==="fork"?e.root.fableConsentSlots:new Kv,hookRegistry:e.kind==="fork"?e.root.hookRegistry:new Gv,identity:e.kind==="fork"?e.root.identity:new ow,invokedSkills:e.kind==="fork"?e.root.invokedSkills:new Wv,mcpSessionWiring:e.kind==="fork"?e.root.mcpSessionWiring:new qv,modelSelection:e.kind==="fork"?e.root.modelSelection:new Vv,promptAssembly:e.kind==="fork"?e.root.promptAssembly:new Zv,promptSuggestion:e.kind==="fork"?e.root.promptSuggestion:new cw,pendingHint:e.kind==="fork"?e.root.pendingHint:new pw,pluginsSync:e.kind==="fork"?e.root.pluginsSync:new aw,precompute:c,requestJournal:e.kind==="fork"?e.root.requestJournal:new Yv,sessionCron:e.kind==="fork"?e.root.sessionCron:new Jv,sessionFlags:e.kind==="fork"?e.root.sessionFlags:new Xv,sessionRefsGate:e.kind==="fork"?e.root.sessionRefsGate:new lw,sessionScratch:e.kind==="fork"?e.root.sessionScratch:new Qv,surfaceCapabilities:e.kind==="fork"?e.root.surfaceCapabilities:new ew,toolProgressThrottle:e.kind==="fork"?e.root.toolProgressThrottle:new fw,turnBudget:e.kind==="fork"?e.root.turnBudget:new tw,userPresence:e.kind==="fork"?e.root.userPresence:new nw,workflowUsageConsent:e.kind==="fork"?e.root.workflowUsageConsent:new sw,writePermissionStash:e.kind==="fork"?e.root.writePermissionStash:new mw,subscribe(p){let f=s.subscribe(p);if(e.kind!=="fork")return f;let m=e.root,h=m.id,g=m.parentId,y=m.subscribe(()=>{if(m.id===h&&m.parentId===g)return;h=m.id,g=m.parentId,p()});return()=>{f(),y()}},setCwd(p){u.update({project:{cwd:p}})},withProject(p){return BU({kind:"fork",root:u.root},{originalCwd:p.originalCwd??n,projectRoot:p.projectRoot??r,cwd:p.cwd??o})},update(p){let f=!1;if(p.id!==void 0||"parentId"in p){if(e.kind==="fork")throw Error("A withProject fork cannot re-identify the session — update the root session instead");if(p.id!==void 0&&p.id!==e.id)e.id=p.id,f=!0;if("parentId"in p&&p.parentId!==e.parentId)e.parentId=p.parentId,f=!0}let m=p.project;if(m){if(m.originalCwd!==void 0){let h=ct(m.originalCwd);if(h!==n)n=h,f=!0}if(m.projectRoot!==void 0){let h=ct(m.projectRoot);if(h!==r)r=h,f=!0}if(m.cwd!==void 0){let h=ct(m.cwd);if(h!==o)o=h,f=!0}}if(f)s.emit()}};return u}class Xg{#e;#t=new WeakMap;constructor(e){this.#e=e}peek(e){return this.#t.get(e.root)}of(e){let t=e.root,n=this.#t.get(t);if(n!==void 0)return n;let r=this.#e();return this.#t.set(t,r),r}drop(e){this.#t.delete(e.root)}}class hw{#e=!1;#t=null;#n=!1;#r=void 0;#i=!1;#c=!1;#o=!1;#l=void 0;#u=!1;#a="cli";#s="fresh";#p=void 0;#d=[];#f=!1;#m=!1;#E=!1;#h=!1;#y=!1;#b=!1;#_=!1;#x=!1;#v=!1;#S=!0;#O=null;#T=!1;#A=null;#P=!1;#w=!1;#I={};isInteractive(){return this.#e}replaceIsInteractive(e){this.#e=e}printOutputFormat(){return this.#t}replacePrintOutputFormat(e){this.#t=e}thinkingDisplayExplicit(){return this.#n}replaceThinkingDisplayExplicit(e){this.#n=e}permissionPromptToolName(){return this.#r}replacePermissionPromptToolName(e){this.#r=e}hasStreamingInput(){return this.#i}replaceHasStreamingInput(e){this.#i=e}singleShotPrintSession(){return this.#c}replaceSingleShotPrintSession(e){this.#c=e}modelOverrideOptOutForSession(){return this.#o}replaceModelOverrideOptOutForSession(e){this.#o=e}rendererMode(){return this.#l}replaceRendererMode(e){this.#l=e}strictToolResultPairing(){return this.#u}replaceStrictToolResultPairing(e){this.#u=e}clientType(){return this.#a}replaceClientType(e){this.#a=e}sessionStartType(){return this.#s}replaceSessionStartType(e){this.#s=e}questionPreviewFormat(){return this.#p}replaceQuestionPreviewFormat(e){this.#p=e}replConfigArgv(){return this.#d}replaceReplConfigArgv(e){this.#d=e}userMsgOptIn(){return this.#f}replaceUserMsgOptIn(e){this.#f=e}searchToolsOptIn(){return this.#m}replaceSearchToolsOptIn(e){this.#m=e}todoToolsOptIn(){return this.#E}replaceTodoToolsOptIn(e){this.#E=e}wizardOperatorToolsEnabled(){return this.#h}replaceWizardOperatorToolsEnabled(e){this.#h=e}pollEventIngressWired(){return this.#y}markPollEventIngressWired(){this.#y=!0}sdkAgentProgressSummariesEnabled(){return this.#b}replaceSdkAgentProgressSummariesEnabled(e){this.#b=e}sessionPersistenceDisabled(){return this.#_}replaceSessionPersistenceDisabled(e){this.#_=e}sessionBypassPermissionsMode(){return this.#x}replaceSessionBypassPermissionsMode(e){this.#x=e}disableSlashCommands(){return this.#v}replaceDisableSlashCommands(e){this.#v=e}mayForwardHomeSettings(){return this.#S}replaceMayForwardHomeSettings(e){this.#S=e}homeSettingsHostConsent(){return this.#O}replaceHomeSettingsHostConsent(e){this.#O=e}scheduledTasksEnabled(){return this.#T}replaceScheduledTasksEnabled(e){this.#T=e}initJsonSchema(){return this.#A}replaceInitJsonSchema(e){this.#A=e}cliSessionConfigCarried(){return this.#P}replaceCliSessionConfigCarried(e){this.#P=e}forkRestrictedLaunchConfig(){return this.#w}replaceForkRestrictedLaunchConfig(e){this.#w=e}forkReplayLaunchConfig(){return this.#I}replaceForkReplayLaunchConfig(e){this.#I=e}reset(){this.#e=!1,this.#t=null,this.#n=!1,this.#r=void 0,this.#i=!1,this.#c=!1,this.#o=!1,this.#l=void 0,this.#u=!1,this.#a="cli",this.#s="fresh",this.#p=void 0,this.#d=[],this.#f=!1,this.#m=!1,this.#E=!1,this.#h=!1,this.#y=!1,this.#b=!1,this.#_=!1,this.#x=!1,this.#v=!1,this.#S=!0,this.#O=null,this.#T=!1,this.#A=null,this.#P=!1,this.#w=!1,this.#I={}}}class gw{#e=void 0;#t=void 0;#n=void 0;#r=null;#i=null;#c=!1;#o=KU();#l=!1;flagSettingsPath(){return this.#e}replaceFlagSettingsPath(e){this.#e=e}flagSettingsExpectedContent(){return this.#t}replaceFlagSettingsExpectedContent(e){this.#t=e}flagSettingsFilePinnedContent(){return this.#n}replaceFlagSettingsFilePinnedContent(e){this.#n=e}flagSettingsInline(){return this.#r}replaceFlagSettingsInline(e){this.#r=e}parentManagedSettings(){return this.#i}replaceParentManagedSettings(e){this.#i=e}parentManagedSettingsInvalid(){return this.#c}replaceParentManagedSettingsInvalid(e){this.#c=e}allowedSettingSources(){return this.#o}replaceAllowedSettingSources(e){this.#o=e}useCoworkPlugins(){return this.#l}replaceUseCoworkPlugins(e){this.#l=e}reset(){this.#e=void 0,this.#t=void 0,this.#n=void 0,this.#r=null,this.#i=null,this.#c=!1,this.#o=KU(),this.#l=!1}}function KU(){return["userSettings","projectSettings","localSettings","flagSettings","policySettings"]}class _w{#e=[];#t=[];#n=[];#r=void 0;#i=[];#c=[];#o=!1;#l=void 0;#u=void 0;#a=void 0;inlinePlugins(){return this.#e}replaceInlinePlugins(e){this.#e=e}inlinePluginsNoMcp(){return this.#t}replaceInlinePluginsNoMcp(e){this.#t=e}inlinePluginUrls(){return this.#n}replaceInlinePluginUrls(e){this.#n=e}syncedPluginDirs(){return this.#r??[]}syncedPluginDirsRegistered(){return this.#r!==void 0}replaceSyncedPluginDirs(e){this.#r=e}clearSyncedPluginDirs(){this.#r=void 0}additionalDirectoriesForClaudeMd(){return this.#i}replaceAdditionalDirectoriesForClaudeMd(e){this.#i=e}allowedChannels(){return this.#c}replaceAllowedChannels(e){this.#c=e}hasDevChannels(){return this.#o}replaceHasDevChannels(e){this.#o=e}sessionSkillAllowlist(){return this.#l}replaceSessionSkillAllowlist(e){this.#l=e}chromeFlagOverride(){return this.#u}replaceChromeFlagOverride(e){this.#u=e}teammateAgentId(){return this.#a}replaceTeammateAgentId(e){this.#a=e}reset(){this.#e=[],this.#t=[],this.#n=[],this.clearSyncedPluginDirs(),this.#i=[],this.#c=[],this.#o=!1,this.#l=void 0,this.#u=void 0,this.#a=void 0}}class yw{#e=null;#t=null;modelStrings(){return this.#e}replaceModelStrings(e){this.#e=e}invalidate(){this.#e=null}admin3PSteeringSnapshot(){return this.#t}recordAdmin3PSteeringSnapshot(e){this.#t=e}reset(){this.#e=null,this.#t=null}}var GU=[];class bw{#e=[];#t=[];errorLog(){return this.#e}recordError(e){if(this.#e.length>=100)this.#e.shift();this.#e.push(e)}recordSlowOperation(e,t){return}slowOperations(){if(this.#t.length===0)return GU;let e=Date.now();if(this.#t.some((t)=>e-t.timestamp>=1e4)){if(this.#t=this.#t.filter((t)=>e-t.timestamp<1e4),this.#t.length===0)return GU}return this.#t}reset(){this.#e=[],this.#t=[]}}function WU(){return{rateTokens:null,rateLastRefillMs:null,featureOkLogged:!1,reportedDropReasons:new Set}}class Sw{#e=null;#t=null;#n=null;#r=null;#i=null;#c=null;#o=null;#l=null;#u=null;#a=null;#s=null;#p=null;#d=null;#f=[];#m=null;#E=WU();#h=null;#y=null;#b=null;#_={direct:null,proxied:null};installMeter(e,t,{omitUnits:n=!1}={}){this.#e=e;let r=(o)=>n?void 0:o;this.#t=t("claude_code.session.count",{description:"Count of CLI sessions started"}),this.#n=t("claude_code.lines_of_code.count",{description:"Count of lines of code modified, with the 'type' attribute indicating whether lines were added or removed and the 'model' attribute indicating which model made the change"}),this.#r=t("claude_code.pull_request.count",{description:"Number of pull requests created"}),this.#i=t("claude_code.commit.count",{description:"Number of git commits created"}),this.#c=t("claude_code.cost.usage",{description:"Cost of the Claude Code session",unit:r("USD")}),this.#o=t("claude_code.token.usage",{description:"Number of tokens used",unit:r("tokens")}),this.#l=t("claude_code.code_edit_tool.decision",{description:"Count of code editing tool permission decisions (accept/reject) for Edit, Write, and NotebookEdit tools"}),this.#u=t("claude_code.active_time.total",{description:"Total active time in seconds",unit:r("s")})}meter(){return this.#e}sessionCounter(){return this.#t}locCounter(){return this.#n}prCounter(){return this.#r}commitCounter(){return this.#i}costCounter(){return this.#c}tokenCounter(){return this.#o}codeEditToolDecisionCounter(){return this.#l}activeTimeCounter(){return this.#u}statsStore(){return this.#a}replaceStatsStore(e){this.#a=e}loggerProvider(){return this.#s}replaceLoggerProvider(e){this.#s=e}eventLogger(){return this.#p}eventLoggerOwner(){return this.#d}attachEventLogger(e,t){if(this.#p=e,this.#d=e?t:null,!e)return;let n=this.#f;if(this.#f=null,n)for(let r of n)e.emit(r)}bufferPendingEvent(e){if(this.#f===null||this.#f.length>=100)return!1;return this.#f.push(e),!0}closeWindow(e){this.#f=null,this.#m=e}windowCloseCause(){return this.#m}isWindowOpen(){return this.#f!==null}hostOtel(){return this.#E}meterProvider(){return this.#h}replaceMeterProvider(e){this.#h=e}tracerProvider(){return this.#y}replaceTracerProvider(e){this.#y=e}cachedTelemetryResource(){return this.#b}replaceCachedTelemetryResource(e){this.#b=e}cachedOtlpHttpAgentFactory(e){return this.#_[e?"proxied":"direct"]}replaceCachedOtlpHttpAgentFactory(e,t){this.#_[e?"proxied":"direct"]=t}reset(){this.#e=null,this.#t=null,this.#n=null,this.#r=null,this.#i=null,this.#c=null,this.#o=null,this.#l=null,this.#u=null,this.#a=null,this.#s=null,this.#p=null,this.#d=null,this.#f=[],this.#m=null,this.#E=WU(),this.#h=null,this.#y=null,this.#b=null,this.#_={direct:null,proxied:null}}}class Ew{#e=void 0;#t=void 0;#n=!1;#r=void 0;#i=void 0;#c=null;#o=null;#l=0;#u=!1;#a=null;#s=void 0;#p=null;#d=null;sessionIngressToken(){return this.#e}replaceSessionIngressToken(e){this.#e=e}oauthTokenFromFd(){return this.#t}replaceOauthTokenFromFd(e){this.#t=e}oauthTokenFromBgSnapshot(){return this.#n}replaceOauthTokenFromBgSnapshot(e){this.#n=e}oauthScopesFromFd(){return this.#r}replaceOauthScopesFromFd(e){this.#r=e}apiKeyFromFd(){return this.#i}replaceApiKeyFromFd(e){this.#i=e}resetFdCredentialState(){this.#e=void 0,this.#t=void 0,this.#n=!1,this.#r=void 0,this.#i=void 0}gatewayAuth(){return this.#c}replaceGatewayAuth(e){this.#c=e}gatewayServerProcess(){return this.#u}replaceGatewayServerProcess(e){this.#u=e}authenticatedAccount(){return this.#o}authenticatedAccountEpoch(){return this.#l}stampAuthenticatedAccount(e){let t=this.#o;if(e!==null&&t!==null&&e.accountUuid===t.accountUuid&&e.emailAddress===t.emailAddress&&e.organizationUuid===t.organizationUuid)return;this.#l+=1,this.#o=e}startupPolicySnapshot(){return this.#s}replaceStartupPolicySnapshot(e){this.#s=e}gatewayRefreshInFlight(){return this.#a}replaceGatewayRefreshInFlight(e){this.#a=e}sdkOAuthTokenRefreshCallback(){return this.#p}replaceSdkOAuthTokenRefreshCallback(e){this.#p=e}hostAuthTokenRefreshCallback(){return this.#d}replaceHostAuthTokenRefreshCallback(e){this.#d=e}resetForTests(){this.#e=null,this.#t=null,this.#n=!1,this.#r=void 0,this.#i=null,this.#c=null,this.#o=null,this.#l=0,this.#u=!1,this.#a=null,this.#s=void 0,this.#p=null,this.#d=null}}class xw{#e=void 0;#t=!1;#n=!1;#r;directConnectServerUrl(){return this.#e}replaceDirectConnectServerUrl(e){this.#e=e}connectNonBlocking(){return this.#t}replaceConnectNonBlocking(e){this.#t=e}strictConfig(){return this.#n}replaceStrictConfig(e){this.#n=e}registerEnsureConnectedClient(e){this.#r=e}ensureConnectedClient(){return this.#r}reset(){this.#e=void 0,this.#t=!1,this.#n=!1}}class vw{#e=null;#t=new Map;#n=new Map;#r=new Set;#i=!1;#c=!1;#o=!1;#l=new Map;#u=new Map;promptCache1hAllowlist(){return this.#e}replacePromptCache1hAllowlist(e){this.#e=e}thinkingTypeOverrides(){return this.#t}recordThinkingTypeOverride(e,t){this.#t.set(e,t)}servedModelsByRequestedModel(){return this.#n}recordServedModels(e,t){this.#n.set(e,t)}effortUnsupportedModels(){return this.#r}markEffortUnsupported(e){this.#r.add(e)}midConvCachePromotionRejected(){return this.#i}markMidConvCachePromotionRejected(){this.#i=!0}strictPrefixLockStoodDown(){return this.#c}markStrictPrefixLockStoodDown(){this.#c=!0}perTurnEffortOkEmitted(){return this.#o}markPerTurnEffortOkEmitted(){this.#o=!0}inferenceProfileBackingModels(){return this.#l}recordInferenceProfileBackingModel(e,t){this.#l.set(e,t)}foundryDeploymentCapabilities(){return this.#u}reset(){this.#e=null,this.#t=new Map,this.#n=new Map,this.#r=new Set,this.#i=!1,this.#c=!1,this.#o=!1,this.#l=new Map,this.#u=new Map}}class ww{#e=!1;#t=!1;longContext1mCreditsBlocked(){return this.#e}replaceLongContext1mCreditsBlocked(e){this.#e=e}fableCreditsRequired(){return this.#t}replaceFableCreditsRequired(e){this.#t=e}reset(){this.#e=!1,this.#t=!1}}class Aw{#e=!1;#t=!1;#n=qU;#r=$t();selectorGate(){return this.#e}selectorGateEverOn(){return this.#t}replaceSelectorGate(e){this.#e=e,this.#t||=e}inheritSelectorGateEverOn(){this.#t=!0}resampleSelectorGate(e){let t=this.#e;if(this.#e=e,this.#t||=e,t!==e)this.#r.emit(e)}subscribeSelectorGateChanged(e){return this.#r.subscribe(e)}replaceHostGateSubscription(e){let t=this.#n;this.#n=e,t()}dropHostGateSubscription(){this.replaceHostGateSubscription(qU)}}function qU(){}class Tw{started=!1;stagingReaped=!1;claim(){if(this.started)return!1;return this.started=!0,!0}claimStagingReap(){if(this.stagingReaped)return!1;return this.stagingReaped=!0,!0}}class Cw{backgroundHousekeeping;launchOptions;settingsSource;extensionsConfig;modelStringsCache;diagnostics;telemetryHandles;credentialSlots;mcpProcessWiring;requestLatches;accountCreditLatches;proactivity;constructor(e){this.backgroundHousekeeping=e.backgroundHousekeeping,this.launchOptions=e.launchOptions,this.settingsSource=e.settingsSource,this.extensionsConfig=e.extensionsConfig,this.modelStringsCache=e.modelStringsCache,this.diagnostics=e.diagnostics,this.telemetryHandles=e.telemetryHandles,this.credentialSlots=e.credentialSlots,this.mcpProcessWiring=e.mcpProcessWiring,this.requestLatches=e.requestLatches,this.accountCreditLatches=e.accountCreditLatches,this.proactivity=e.proactivity}}function VU(){return new Cw({backgroundHousekeeping:new Tw,launchOptions:new hw,settingsSource:new gw,extensionsConfig:new _w,modelStringsCache:new yw,diagnostics:new bw,telemetryHandles:new Sw,credentialSlots:new Ew,mcpProcessWiring:new xw,requestLatches:new vw,accountCreditLatches:new ww,proactivity:new Aw})}function Vae(){let e="";if(typeof process<"u"&&typeof process.cwd==="function"&&typeof ZU==="function"){let t=qae();try{e=YU(ZU(t))}catch{e=YU(t)}}return HU({host:VU(),id:IN()??Bp(),project:{originalCwd:e,projectRoot:e,cwd:e}})}var Zae=Vae();function Tt(){return JU()}function JU(){return XU()?.session??Zae}function Yae(){let e=XU();return e?.session?void 0:e}var XU=()=>{return};function kw(){return Yae()?.sessionId??JU().id}var iht=new Xg(()=>$t());function YU(e){return process.platform==="darwin"?e.normalize("NFC"):e}var aht=new Xg(()=>$t());var cht=new tt(()=>$t());import{AsyncLocalStorage as Sce}from"async_hooks";import{constants as Ece}from"fs";import{appendFile as xce,copyFile as vce,lstat as wce,mkdir as Ace,open as oF,readdir as sF,readFile as iF,stat as Tce,unlink as Cce,writeFile as Dw}from"fs/promises";import{randomBytes as Jae}from"crypto";import{closeSync as pht,constants as Tn,fchmodSync as fht,fstatSync as mht,ftruncateSync as hht,lstatSync as ght,openSync as _ht,readFileSync as yht,renameSync as bht,unlinkSync as Sht,writeFileSync as Eht}from"fs";import{lstat as Ow,open as t_,rename as Xae,stat as Qae,unlink as e_,writeFile as ece}from"fs/promises";var tce=new Set(["EXDEV","EPERM","EEXIST","EBUSY"]),nce=new Set(["EPERM","EBUSY","EACCES"]);function rce(e){return`${e}.tmp.${Jae(4).toString("hex")}`}var oce=4,sce=50,Aht=new Int32Array(new SharedArrayBuffer(4));function ice(e,t){if(process.platform!=="win32")return!1;let n=Ne(e);return n!==void 0&&nce.has(n)&&t<oce-1}var ace=128;async function cce(e){try{return((await Ow(e)).mode&ace)===0}catch{return!1}}async function lce(e,t){let n=!1;for(let r=0;;r++)try{return await e(),n}catch(o){if(ice(o,r)){if(r===0&&t!==void 0&&await cce(t))throw o;n=!0,await to(sce);continue}throw o}}function uce(e,t,n=Xae){return lce(()=>n(e,t),t)}var dce=67108864,Pw=process.platform==="win32"?0:Tn.O_NONBLOCK;async function eF(e,t,n=process.platform){if(n!=="win32")return!0;try{return(await Ow(e)).isFile()}catch(r){return t&&Ne(r)==="ENOENT"}}async function pce(e,t=!1){if(!t&&!await eF(e,!0))return{kind:"unavailable"};let n;try{n=await t_(e,process.platform==="win32"?Tn.O_RDONLY:Tn.O_RDONLY|(t?0:Tn.O_NOFOLLOW)|Pw)}catch(r){return Ne(r)==="ENOENT"?{kind:"absent"}:{kind:"unavailable"}}try{let r=await n.stat();if(!r.isFile()||r.size>dce)return{kind:"unavailable"};return{kind:"snapshot",bytes:new Uint8Array(await n.readFile()),mode:r.mode&4095}}catch{return{kind:"unavailable"}}finally{await n.close().catch(()=>{})}}async function fce(e,t,n=!1){if(!n&&!await eF(e,!0))return!1;let r;try{r=await t_(e,process.platform==="win32"?"w":Tn.O_WRONLY|Tn.O_CREAT|Tn.O_TRUNC|(n?0:Tn.O_NOFOLLOW)|Pw,t.mode)}catch{return!1}try{if(!(await r.stat()).isFile())return await r.close().catch(()=>{}),!1;return await r.writeFile(t.bytes),await r.chmod(t.mode).catch(()=>{}),await r.close(),!0}catch{return await r.close().catch(()=>{}),!1}}function Qg(e,t,n){try{if(e instanceof Error)e.message=`${e.message}; ${t!==void 0?`new contents preserved at ${t}; `:""}${n==="restored"?"original target restored":n==="removed"?"partial target removed":n==="untouched"?"target untouched":"target left partial — treat contents as torn"}`,Object.assign(e,{...t!==void 0&&{preservedTmp:t},targetOutcome:n})}catch{}return e}function Rw(e){let t=Ne(e);return t==="EINVAL"||t==="ENOTSUP"||t==="EPERM"||t==="ENOSYS"}var QU=3;async function mce(e,t){if(t!=="win32")return!1;try{return await Ow(e),!0}catch(n){return Ne(n)==="ENOENT"?!1:{cause:n}}}function hce(e,t){return Object.assign(Error("EEXIST: name already taken (exclusive create)",typeof t==="object"?{cause:t.cause}:void 0),{code:"EEXIST",syscall:"lstat",path:e})}async function tF(e,t,n){for(let r=1;;r++){let o=rce(e),s=await mce(o,t);if(s!==!1){if(r<QU)continue;throw hce(o,s)}try{return await n(o)}catch(i){if(Ne(i)==="EEXIST"&&r<QU)continue;throw i}}}async function gce(e,t,n,r=process.platform){return tF(e,r,async(o)=>{try{return await ece(o,t,{encoding:"utf8",mode:n,flag:"wx"}),o}catch(s){if(Ne(s)!=="EEXIST")await e_(o).catch(()=>{});throw s}})}async function _ce(e,t,n=process.platform){return tF(e,n,async(r)=>({fh:await t_(r,n==="win32"?"wx":Tn.O_WRONLY|Tn.O_CREAT|Tn.O_EXCL,t),tmp:r}))}async function nF(e,t,n,r){return yce(e,t,{mode:n,renameFn:r})}async function yce(e,t,n){let{mode:r,createMode:o,exactMode:s,flush:i,followSymlinks:a,inPlaceOnTempCreateRefused:c,renameFn:l}=n,u=r??o,p=a===!0||process.platform==="win32"?0:Tn.O_NOFOLLOW,f,m=!1,h=!1,g=async(y)=>{let S=await pce(e,a===!0),b=S.kind==="snapshot"?S:void 0,x=await t_(e,process.platform==="win32"?Tn.O_WRONLY|Tn.O_CREAT:Tn.O_WRONLY|Tn.O_CREAT|p|Pw,s??u),v;try{v=await x.stat()}catch(F){throw await x.close().catch(()=>{}),m=y!==void 0,Qg(F,y,"untouched")}let A=v.isCharacterDevice();if(!v.isFile()&&!A)throw await x.close().catch(()=>{}),Object.assign(Error("refusing the in-place arm on a non-regular target"),{code:"ENXIO",path:e});let U=!1;try{if(!A)await x.truncate(0),U=!0;await x.writeFile(t,{encoding:"utf8"});let F=A?void 0:s??(S.kind!=="absent"?r:void 0);if(F!==void 0)await x.chmod(F).catch(()=>{});if(i===!0)try{await x.sync()}catch(K){if(!Rw(K))throw K}await x.close()}catch(F){if(await x.close().catch(()=>{}),!U)throw m=y!==void 0,Qg(F,y,"untouched");m=y!==void 0;let V=b!==void 0&&await fce(e,b,a===!0)?"restored":await e_(e).then(()=>!0,(ne)=>Ne(ne)==="ENOENT")?"removed":"partial";throw Qg(F,y,V)}let D=y??f;if(D!==void 0)await e_(D).catch(()=>{})};try{try{if(s!==void 0||i===!0){let S=await _ce(e,s??u),b=S.fh;f=S.tmp;let x=!1,v;try{if(await b.writeFile(t,{encoding:"utf8"}),s!==void 0)try{await b.chmod(s)}catch(A){if(!Rw(A))throw A}if(i===!0)try{await b.sync()}catch(A){if(!Rw(A))throw A}}catch(A){x=!0,v=A}if(!x)h=!0;try{await b.close()}catch(A){if(!x)throw m=!0,Qg(A,f,"untouched")}if(x)throw v}else f=await gce(e,t,u),h=!0}catch(S){if(c!==!0)throw S;if(h)throw S;if(Ne(S)!=="EACCES")throw S;if(!await Qae(e).then(()=>!0,()=>!1))throw S;await g(void 0);return}if(f===void 0)throw Error("staging block exited without a staging file");let y=f;try{await uce(y,e,l)}catch(S){let b=Ne(S);if(b===void 0||!tce.has(b))throw S;await g(y)}}catch(y){if(f!==void 0&&!m)await e_(f).catch(()=>{});throw y}}import{constants as rF}from"fs";var bce=process.platform==="win32"?0:rF.O_NONBLOCK,Iw=process.platform==="win32"?0:rF.O_NOFOLLOW|bce;class cF{read(e){return iF(e,"utf8")}readBytes(e){return iF(e)}write(e,t,n){return Dw(e,t,{encoding:"utf8",mode:n})}async mkdir(e,t){try{await Ace(e,{recursive:!0,mode:t})}catch(n){if(Ne(n)!=="EEXIST")throw n}}atomicWrite(e,t,n){return nF(e,t,n)}delete(e){return Cce(e)}list(e){return sF(e)}append(e,t,n){return xce(e,t,{encoding:"utf8",mode:n})}writeExclusive(e,t,n){return Dw(e,t,{encoding:"utf8",flag:"wx",mode:n})}writeBytes(e,t){return Dw(e,t)}copy(e,t){return vce(e,t)}async stat(e){return{mtimeMs:(await Tce(e)).mtimeMs}}async lstat(e){try{let t=await wce(e);return{isSymbolicLink:t.isSymbolicLink(),isFile:t.isFile(),isDirectory:t.isDirectory(),mtimeMs:t.mtimeMs}}catch(t){if(Ne(t)==="ENOENT")return;throw t}}async listEntries(e){return(await sF(e,{withFileTypes:!0})).map((n)=>({name:n.name,isDirectory:n.isDirectory(),isFile:n.isFile()}))}async readRange(e,t,n){Lw("readRange","offset",t),Lw("readRange","length",n);let r=await oF(e,"r");try{return await aF(r,t,n)}finally{await r.close()}}async readTail(e,t,n){Lw("readTail","maxBytes",t);let r=n?.noFollow?Ece.O_RDONLY|Iw:"r",o=await oF(e,r);try{let s=await o.stat();if(n?.noFollow&&!s.isFile())throw Object.assign(Error("ENXIO: not a regular file"),{code:"ENXIO",path:e});let{size:i}=s,a=Math.min(t,i);return await aF(o,i-a,a)}finally{await o.close()}}}function Lw(e,t,n){if(!Number.isInteger(n)||n<0)throw RangeError(`${e}: ${t} must be a non-negative integer, got ${n}`)}async function aF(e,t,n){if(n===0)return Buffer.alloc(0);let r=Buffer.alloc(n),o=0;while(o<n){let{bytesRead:s}=await e.read(r,o,n-o,t+o);if(s===0)break;o+=s}return o===n?r:Buffer.from(r.subarray(0,o))}var kce=new Sce;function Sl(){return kce.getStore()??new cF}var jw={};rn(jw,{AGENT_PROXY_AUTH_TOKEN:()=>sue,ANTHROPIC_API_KEY:()=>Wle,ANTHROPIC_AUTH_TOKEN:()=>qle,ANTHROPIC_AWS_API_KEY:()=>Yle,ANTHROPIC_FEDERATION_RULE_ID:()=>Bue,ANTHROPIC_FOUNDRY_API_KEY:()=>Jle,ANTHROPIC_FOUNDRY_AUTH_TOKEN:()=>Xle,ANTHROPIC_ORGANIZATION_ID:()=>Gue,ANTHROPIC_PROFILE:()=>que,ANTHROPIC_WORKSPACE_ID:()=>Wue,AWS_BEARER_TOKEN_BEDROCK:()=>Zle,AWS_CONTAINER_CREDENTIALS_FULL_URI:()=>nue,AWS_CONTAINER_CREDENTIALS_RELATIVE_URI:()=>tue,AWS_ROLE_ARN:()=>eue,AWS_WEB_IDENTITY_TOKEN_FILE:()=>Qle,CLAUDE_CODE_ACCOUNT_TAGGED_ID:()=>Zue,CLAUDE_CODE_ACCOUNT_UUID:()=>Vue,CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR:()=>lue,CLAUDE_CODE_API_KEY_HELPER_TTL_MS:()=>Iue,CLAUDE_CODE_AUTH_FAIL_EXIT_MS:()=>Pue,CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS:()=>Hue,CLAUDE_CODE_CUSTOM_OAUTH_URL:()=>_ue,CLAUDE_CODE_DESIGN_OAUTH_CLIENT_ID:()=>hue,CLAUDE_CODE_ENABLE_PROXY_AUTH_HELPER:()=>Due,CLAUDE_CODE_FEDERATION_CACHE_DIR:()=>Kue,CLAUDE_CODE_HFI_BEARER_TOKEN:()=>oue,CLAUDE_CODE_HOST_AUTH_ENV_VAR:()=>Eue,CLAUDE_CODE_HOST_AUTH_REFRESH_TIMEOUT_MS:()=>Sue,CLAUDE_CODE_HOST_CREDS_FILE:()=>xue,CLAUDE_CODE_OAUTH_401_WAIT_MS:()=>Oue,CLAUDE_CODE_OAUTH_CLIENT_ID:()=>mue,CLAUDE_CODE_OAUTH_REFRESH_TOKEN:()=>fue,CLAUDE_CODE_OAUTH_SCOPES:()=>gue,CLAUDE_CODE_OAUTH_TOKEN:()=>Vle,CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR:()=>uue,CLAUDE_CODE_ORGANIZATION_UUID:()=>Yue,CLAUDE_CODE_PROXY_AUTH_HELPER_TTL_MS:()=>Lue,CLAUDE_CODE_RATE_LIMIT_TIER:()=>Que,CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH:()=>bue,CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH:()=>yue,CLAUDE_CODE_SESSION_ACCESS_TOKEN:()=>vue,CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH:()=>Fue,CLAUDE_CODE_SKIP_ANTHROPIC_GOOGLE_CLOUD_AUTH:()=>jue,CLAUDE_CODE_SKIP_AWS_CRED_CACHE:()=>zue,CLAUDE_CODE_SKIP_BEDROCK_AUTH:()=>Mue,CLAUDE_CODE_SKIP_FOUNDRY_AUTH:()=>Uue,CLAUDE_CODE_SKIP_MANTLE_AUTH:()=>$ue,CLAUDE_CODE_SKIP_VERTEX_AUTH:()=>Nue,CLAUDE_CODE_SUBSCRIPTION_TYPE:()=>Xue,CLAUDE_CODE_USER_EMAIL:()=>Jue,CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR:()=>due,CLAUDE_LOCAL_OAUTH_API_BASE:()=>Cue,CLAUDE_LOCAL_OAUTH_APPS_BASE:()=>kue,CLAUDE_LOCAL_OAUTH_CONSOLE_BASE:()=>Rue,CLAUDE_SESSION_INGRESS_TOKEN_FILE:()=>pue,CLAUDE_TRUSTED_DEVICE_TOKEN:()=>wue,CLOUDSDK_AUTH_ACCESS_TOKEN:()=>rue,ENVIRONMENT_SERVICE_KEY:()=>iue,MCP_CLIENT_SECRET:()=>aue,MCP_XAA_IDP_CLIENT_SECRET:()=>cue,USE_LOCAL_OAUTH:()=>Aue,USE_STAGING_OAUTH:()=>Tue});var Ln={};rn(Ln,{BRAND:()=>ele,DIRTY:()=>ha,EMPTY_PATH:()=>Ice,INVALID:()=>he,NEVER:()=>Ule,OK:()=>Cn,ParseStatus:()=>gn,Schema:()=>De,ZodAny:()=>_a,ZodArray:()=>co,ZodBigInt:()=>pi,ZodBoolean:()=>Al,ZodBranded:()=>s_,ZodCatch:()=>Ll,ZodDate:()=>ga,ZodDefault:()=>Dl,ZodDiscriminatedUnion:()=>o_,ZodEffects:()=>uo,ZodEnum:()=>fi,ZodError:()=>Yn,ZodFirstPartyTypeKind:()=>B,ZodFunction:()=>wl,ZodIntersection:()=>Rl,ZodIssueCode:()=>H,ZodLazy:()=>Ol,ZodLiteral:()=>Pl,ZodMap:()=>Jp,ZodNaN:()=>Xp,ZodNativeEnum:()=>Il,ZodNever:()=>Vo,ZodNull:()=>Cl,ZodNullable:()=>bs,ZodNumber:()=>di,ZodObject:()=>Ct,ZodOptional:()=>Er,ZodParsedType:()=>W,ZodPipeline:()=>Qp,ZodPromise:()=>ba,ZodReadonly:()=>Ml,ZodRecord:()=>Yp,ZodSchema:()=>De,ZodSet:()=>ya,ZodString:()=>ao,ZodSymbol:()=>Vp,ZodTransformer:()=>uo,ZodTuple:()=>Zo,ZodType:()=>De,ZodUndefined:()=>Tl,ZodUnion:()=>kl,ZodUnknown:()=>ui,ZodVoid:()=>Zp,addIssueToContext:()=>Y,any:()=>lle,array:()=>fle,bigint:()=>ole,boolean:()=>bF,coerce:()=>Nle,custom:()=>gF,date:()=>sle,datetimeRegex:()=>mF,defaultErrorMap:()=>_s,discriminatedUnion:()=>gle,effect:()=>kle,enum:()=>Ale,function:()=>xle,getErrorMap:()=>El,getParsedType:()=>qo,instanceof:()=>nle,intersection:()=>_le,isAborted:()=>n_,isAsync:()=>xl,isDirty:()=>r_,isValid:()=>li,late:()=>tle,lazy:()=>vle,literal:()=>wle,makeIssue:()=>qp,map:()=>Sle,nan:()=>rle,nativeEnum:()=>Tle,never:()=>dle,null:()=>cle,nullable:()=>Ole,number:()=>yF,object:()=>Fw,objectUtil:()=>Mw,oboolean:()=>Mle,onumber:()=>Lle,optional:()=>Rle,ostring:()=>Dle,pipeline:()=>Ile,preprocess:()=>Ple,promise:()=>Cle,quotelessJson:()=>Rce,record:()=>ble,set:()=>Ele,setErrorMap:()=>Pce,strictObject:()=>mle,string:()=>_F,symbol:()=>ile,transformer:()=>kle,tuple:()=>yle,undefined:()=>ale,union:()=>hle,unknown:()=>ule,util:()=>Ue,void:()=>ple});var Ue;(function(e){e.assertEqual=(o)=>{};function t(o){}e.assertIs=t;function n(o){throw Error()}e.assertNever=n,e.arrayToEnum=(o)=>{let s={};for(let i of o)s[i]=i;return s},e.getValidEnumValues=(o)=>{let s=e.objectKeys(o).filter((a)=>typeof o[o[a]]!=="number"),i={};for(let a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=(o)=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys==="function"?(o)=>Object.keys(o):(o)=>{let s=[];for(let i in o)if(Object.prototype.hasOwnProperty.call(o,i))s.push(i);return s},e.find=(o,s)=>{for(let i of o)if(s(i))return i;return},e.isInteger=typeof Number.isInteger==="function"?(o)=>Number.isInteger(o):(o)=>typeof o==="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map((i)=>typeof i==="string"?`'${i}'`:i).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(o,s)=>{if(typeof s==="bigint")return s.toString();return s}})(Ue||(Ue={}));var Mw;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Mw||(Mw={}));var W=Ue.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),qo=(e)=>{switch(typeof e){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(e)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":if(Array.isArray(e))return W.array;if(e===null)return W.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return W.promise;if(typeof Map<"u"&&e instanceof Map)return W.map;if(typeof Set<"u"&&e instanceof Set)return W.set;if(typeof Date<"u"&&e instanceof Date)return W.date;return W.object;default:return W.unknown}};var H=Ue.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Rce=(e)=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Yn extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(n)=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(o){return o.message},n={_errors:[]},r=(o)=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(r);else if(s.code==="invalid_return_type")r(s.returnTypeError);else if(s.code==="invalid_arguments")r(s.argumentsError);else if(s.path.length===0)n._errors.push(t(s));else{let i=n,a=0;while(a<s.path.length){let c=s.path[a];if(a!==s.path.length-1)i[c]=i[c]||{_errors:[]};else i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s));i=i[c],a++}}};return r(this),n}static assert(e){if(!(e instanceof Yn))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ue.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let o=r.path[0];t[o]=t[o]||[],t[o].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Yn.create=(e)=>new Yn(e);var Oce=(e,t)=>{let n;switch(e.code){case H.invalid_type:if(e.received===W.undefined)n="Required";else n=`Expected ${e.expected}, received ${e.received}`;break;case H.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ue.jsonStringifyReplacer)}`;break;case H.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ue.joinValues(e.keys,", ")}`;break;case H.invalid_union:n="Invalid input";break;case H.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ue.joinValues(e.options)}`;break;case H.invalid_enum_value:n=`Invalid enum value. Expected ${Ue.joinValues(e.options)}, received '${e.received}'`;break;case H.invalid_arguments:n="Invalid function arguments";break;case H.invalid_return_type:n="Invalid function return type";break;case H.invalid_date:n="Invalid date";break;case H.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")n=`${n} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)n=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)n=`Invalid input: must end with "${e.validation.endsWith}"`;else Ue.assertNever(e.validation);else if(e.validation!=="regex")n=`Invalid ${e.validation}`;else n="Invalid";break;case H.too_small:if(e.type==="array")n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else n="Invalid input";break;case H.too_big:if(e.type==="array")n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else n="Invalid input";break;case H.custom:n="Invalid input";break;case H.invalid_intersection_types:n="Intersection results could not be merged";break;case H.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case H.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ue.assertNever(e)}return{message:n}},_s=Oce;var lF=_s;function Pce(e){lF=e}function El(){return lF}var qp=(e)=>{let{data:t,path:n,errorMaps:r,issueData:o}=e,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=r.filter((l)=>!!l).slice().reverse();for(let l of c)a=l(i,{data:t,defaultError:a}).message;return{...o,path:s,message:a}},Ice=[];function Y(e,t){let n=El(),r=qp({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===_s?void 0:_s].filter((o)=>!!o)});e.common.issues.push(r)}class gn{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let n=[];for(let r of t){if(r.status==="aborted")return he;if(r.status==="dirty")e.dirty();n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let r of t){let o=await r.key,s=await r.value;n.push({key:o,value:s})}return gn.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:o,value:s}=r;if(o.status==="aborted")return he;if(s.status==="aborted")return he;if(o.status==="dirty")e.dirty();if(s.status==="dirty")e.dirty();if(o.value!=="__proto__"&&(typeof s.value<"u"||r.alwaysSet))n[o.value]=s.value}return{status:e.value,value:n}}}var he=Object.freeze({status:"aborted"}),ha=(e)=>({status:"dirty",value:e}),Cn=(e)=>({status:"valid",value:e}),n_=(e)=>e.status==="aborted",r_=(e)=>e.status==="dirty",li=(e)=>e.status==="valid",xl=(e)=>typeof Promise<"u"&&e instanceof Promise;var ie;(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(ie||(ie={}));class lo{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var uF=(e,t)=>{if(li(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new Yn(e.common.issues);return this._error=n,this._error}}}};function we(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:o};return{errorMap:(i,a)=>{let{message:c}=e;if(i.code==="invalid_enum_value")return{message:c??a.defaultError};if(typeof a.data>"u")return{message:c??r??a.defaultError};if(i.code!=="invalid_type")return{message:a.defaultError};return{message:c??n??a.defaultError}},description:o}}class De{get description(){return this._def.description}_getType(e){return qo(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:qo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new gn,ctx:{common:e.parent.common,data:e.data,parsedType:qo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(xl(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qo(e)},r=this._parseSync({data:e,path:n.path,parent:n});return uF(n,r)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qo(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return li(n)?{value:n.value}:{issues:t.common.issues}}catch(n){if(n?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((n)=>li(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qo(e)},r=this._parse({data:e,path:n.path,parent:n}),o=await(xl(r)?r:Promise.resolve(r));return uF(n,o)}refine(e,t){let n=(r)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(r);else return t};return this._refinement((r,o)=>{let s=e(r),i=()=>o.addIssue({code:H.custom,...n(r)});if(typeof Promise<"u"&&s instanceof Promise)return s.then((a)=>{if(!a)return i(),!1;else return!0});if(!s)return i(),!1;else return!0})}refinement(e,t){return this._refinement((n,r)=>{if(!e(n))return r.addIssue(typeof t==="function"?t(n,r):t),!1;else return!0})}_refinement(e){return new uo({schema:this,typeName:B.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(t)=>this["~validate"](t)}}optional(){return Er.create(this,this._def)}nullable(){return bs.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return co.create(this)}promise(){return ba.create(this,this._def)}or(e){return kl.create([this,e],this._def)}and(e){return Rl.create(this,e,this._def)}transform(e){return new uo({...we(this._def),schema:this,typeName:B.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new Dl({...we(this._def),innerType:this,defaultValue:t,typeName:B.ZodDefault})}brand(){return new s_({typeName:B.ZodBranded,type:this,...we(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new Ll({...we(this._def),innerType:this,catchValue:t,typeName:B.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return Qp.create(this,e)}readonly(){return Ml.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var Dce=/^c[^\s-]{8,}$/i,Lce=/^[0-9a-z]+$/,Mce=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Nce=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Uce=/^[a-z0-9_-]{21}$/i,Fce=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,jce=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,$ce=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,zce="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Nw,Hce=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Bce=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Kce=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Gce=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Wce=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qce=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,pF="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Vce=new RegExp(`^${pF}$`);function fF(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Zce(e){return new RegExp(`^${fF(e)}$`)}function mF(e){let t=`${pF}T${fF(e)}`,n=[];if(n.push(e.local?"Z?":"Z"),e.offset)n.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Yce(e,t){if((t==="v4"||!t)&&Hce.test(e))return!0;if((t==="v6"||!t)&&Kce.test(e))return!0;return!1}function Jce(e,t){if(!Fce.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));if(typeof o!=="object"||o===null)return!1;if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&o.alg!==t)return!1;return!0}catch{return!1}}function Xce(e,t){if((t==="v4"||!t)&&Bce.test(e))return!0;if((t==="v6"||!t)&&Gce.test(e))return!0;return!1}class ao extends De{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==W.string){let o=this._getOrReturnCtx(e);return Y(o,{code:H.invalid_type,expected:W.string,received:o.parsedType}),he}let n=new gn,r=void 0;for(let o of this._def.checks)if(o.kind==="min"){if(e.data.length<o.value)r=this._getOrReturnCtx(e,r),Y(r,{code:H.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty()}else if(o.kind==="max"){if(e.data.length>o.value)r=this._getOrReturnCtx(e,r),Y(r,{code:H.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty()}else if(o.kind==="length"){let s=e.data.length>o.value,i=e.data.length<o.value;if(s||i){if(r=this._getOrReturnCtx(e,r),s)Y(r,{code:H.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message});else if(i)Y(r,{code:H.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message});n.dirty()}}else if(o.kind==="email"){if(!$ce.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"email",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="emoji"){if(!Nw)Nw=new RegExp(zce,"u");if(!Nw.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"emoji",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="uuid"){if(!Nce.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"uuid",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="nanoid"){if(!Uce.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"nanoid",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="cuid"){if(!Dce.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"cuid",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="cuid2"){if(!Lce.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"cuid2",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="ulid"){if(!Mce.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"ulid",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),Y(r,{validation:"url",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="regex"){if(o.regex.lastIndex=0,!o.regex.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"regex",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="trim")e.data=e.data.trim();else if(o.kind==="includes"){if(!e.data.includes(o.value,o.position))r=this._getOrReturnCtx(e,r),Y(r,{code:H.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()}else if(o.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(o.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(o.kind==="startsWith"){if(!e.data.startsWith(o.value))r=this._getOrReturnCtx(e,r),Y(r,{code:H.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()}else if(o.kind==="endsWith"){if(!e.data.endsWith(o.value))r=this._getOrReturnCtx(e,r),Y(r,{code:H.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()}else if(o.kind==="datetime"){if(!mF(o).test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{code:H.invalid_string,validation:"datetime",message:o.message}),n.dirty()}else if(o.kind==="date"){if(!Vce.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{code:H.invalid_string,validation:"date",message:o.message}),n.dirty()}else if(o.kind==="time"){if(!Zce(o).test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{code:H.invalid_string,validation:"time",message:o.message}),n.dirty()}else if(o.kind==="duration"){if(!jce.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"duration",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="ip"){if(!Yce(e.data,o.version))r=this._getOrReturnCtx(e,r),Y(r,{validation:"ip",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="jwt"){if(!Jce(e.data,o.alg))r=this._getOrReturnCtx(e,r),Y(r,{validation:"jwt",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="cidr"){if(!Xce(e.data,o.version))r=this._getOrReturnCtx(e,r),Y(r,{validation:"cidr",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="base64"){if(!Wce.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"base64",code:H.invalid_string,message:o.message}),n.dirty()}else if(o.kind==="base64url"){if(!qce.test(e.data))r=this._getOrReturnCtx(e,r),Y(r,{validation:"base64url",code:H.invalid_string,message:o.message}),n.dirty()}else Ue.assertNever(o);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement((r)=>e.test(r),{validation:t,code:H.invalid_string,...ie.errToObj(n)})}_addCheck(e){return new ao({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ie.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ie.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ie.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ie.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ie.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ie.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ie.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ie.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ie.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ie.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ie.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ie.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ie.errToObj(e)})}datetime(e){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ie.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...ie.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ie.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...ie.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...ie.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...ie.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...ie.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...ie.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...ie.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...ie.errToObj(t)})}nonempty(e){return this.min(1,ie.errToObj(e))}trim(){return new ao({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ao({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ao({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e)=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find((e)=>e.kind==="date")}get isTime(){return!!this._def.checks.find((e)=>e.kind==="time")}get isDuration(){return!!this._def.checks.find((e)=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find((e)=>e.kind==="email")}get isURL(){return!!this._def.checks.find((e)=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find((e)=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find((e)=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((e)=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((e)=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((e)=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find((e)=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find((e)=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find((e)=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find((e)=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find((e)=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}ao.create=(e)=>new ao({checks:[],typeName:B.ZodString,coerce:e?.coerce??!1,...we(e)});function Qce(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}class di extends De{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce)e.data=Number(e.data);if(this._getType(e)!==W.number){let o=this._getOrReturnCtx(e);return Y(o,{code:H.invalid_type,expected:W.number,received:o.parsedType}),he}let n=void 0,r=new gn;for(let o of this._def.checks)if(o.kind==="int"){if(!Ue.isInteger(e.data))n=this._getOrReturnCtx(e,n),Y(n,{code:H.invalid_type,expected:"integer",received:"float",message:o.message}),r.dirty()}else if(o.kind==="min"){if(o.inclusive?e.data<o.value:e.data<=o.value)n=this._getOrReturnCtx(e,n),Y(n,{code:H.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()}else if(o.kind==="max"){if(o.inclusive?e.data>o.value:e.data>=o.value)n=this._getOrReturnCtx(e,n),Y(n,{code:H.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()}else if(o.kind==="multipleOf"){if(Qce(e.data,o.value)!==0)n=this._getOrReturnCtx(e,n),Y(n,{code:H.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()}else if(o.kind==="finite"){if(!Number.isFinite(e.data))n=this._getOrReturnCtx(e,n),Y(n,{code:H.not_finite,message:o.message}),r.dirty()}else Ue.assertNever(o);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,ie.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ie.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ie.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ie.toString(t))}setLimit(e,t,n,r){return new di({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:ie.toString(r)}]})}_addCheck(e){return new di({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ie.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ie.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ie.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ie.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ie.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ie.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:ie.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ie.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ie.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&Ue.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;else if(n.kind==="min"){if(t===null||n.value>t)t=n.value}else if(n.kind==="max"){if(e===null||n.value<e)e=n.value}return Number.isFinite(t)&&Number.isFinite(e)}}di.create=(e)=>new di({checks:[],typeName:B.ZodNumber,coerce:e?.coerce||!1,...we(e)});class pi extends De{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==W.bigint)return this._getInvalidInput(e);let n=void 0,r=new gn;for(let o of this._def.checks)if(o.kind==="min"){if(o.inclusive?e.data<o.value:e.data<=o.value)n=this._getOrReturnCtx(e,n),Y(n,{code:H.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()}else if(o.kind==="max"){if(o.inclusive?e.data>o.value:e.data>=o.value)n=this._getOrReturnCtx(e,n),Y(n,{code:H.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()}else if(o.kind==="multipleOf"){if(e.data%o.value!==BigInt(0))n=this._getOrReturnCtx(e,n),Y(n,{code:H.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()}else Ue.assertNever(o);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Y(t,{code:H.invalid_type,expected:W.bigint,received:t.parsedType}),he}gte(e,t){return this.setLimit("min",e,!0,ie.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ie.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ie.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ie.toString(t))}setLimit(e,t,n,r){return new pi({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:ie.toString(r)}]})}_addCheck(e){return new pi({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ie.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ie.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ie.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ie.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ie.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}pi.create=(e)=>new pi({checks:[],typeName:B.ZodBigInt,coerce:e?.coerce??!1,...we(e)});class Al extends De{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==W.boolean){let n=this._getOrReturnCtx(e);return Y(n,{code:H.invalid_type,expected:W.boolean,received:n.parsedType}),he}return Cn(e.data)}}Al.create=(e)=>new Al({typeName:B.ZodBoolean,coerce:e?.coerce||!1,...we(e)});class ga extends De{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==W.date){let o=this._getOrReturnCtx(e);return Y(o,{code:H.invalid_type,expected:W.date,received:o.parsedType}),he}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return Y(o,{code:H.invalid_date}),he}let n=new gn,r=void 0;for(let o of this._def.checks)if(o.kind==="min"){if(e.data.getTime()<o.value)r=this._getOrReturnCtx(e,r),Y(r,{code:H.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()}else if(o.kind==="max"){if(e.data.getTime()>o.value)r=this._getOrReturnCtx(e,r),Y(r,{code:H.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()}else Ue.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ga({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:ie.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:ie.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}}ga.create=(e)=>new ga({checks:[],coerce:e?.coerce||!1,typeName:B.ZodDate,...we(e)});class Vp extends De{_parse(e){if(this._getType(e)!==W.symbol){let n=this._getOrReturnCtx(e);return Y(n,{code:H.invalid_type,expected:W.symbol,received:n.parsedType}),he}return Cn(e.data)}}Vp.create=(e)=>new Vp({typeName:B.ZodSymbol,...we(e)});class Tl extends De{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return Y(n,{code:H.invalid_type,expected:W.undefined,received:n.parsedType}),he}return Cn(e.data)}}Tl.create=(e)=>new Tl({typeName:B.ZodUndefined,...we(e)});class Cl extends De{_parse(e){if(this._getType(e)!==W.null){let n=this._getOrReturnCtx(e);return Y(n,{code:H.invalid_type,expected:W.null,received:n.parsedType}),he}return Cn(e.data)}}Cl.create=(e)=>new Cl({typeName:B.ZodNull,...we(e)});class _a extends De{constructor(){super(...arguments);this._any=!0}_parse(e){return Cn(e.data)}}_a.create=(e)=>new _a({typeName:B.ZodAny,...we(e)});class ui extends De{constructor(){super(...arguments);this._unknown=!0}_parse(e){return Cn(e.data)}}ui.create=(e)=>new ui({typeName:B.ZodUnknown,...we(e)});class Vo extends De{_parse(e){let t=this._getOrReturnCtx(e);return Y(t,{code:H.invalid_type,expected:W.never,received:t.parsedType}),he}}Vo.create=(e)=>new Vo({typeName:B.ZodNever,...we(e)});class Zp extends De{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return Y(n,{code:H.invalid_type,expected:W.void,received:n.parsedType}),he}return Cn(e.data)}}Zp.create=(e)=>new Zp({typeName:B.ZodVoid,...we(e)});class co extends De{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==W.array)return Y(t,{code:H.invalid_type,expected:W.array,received:t.parsedType}),he;if(r.exactLength!==null){let s=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;if(s||i)Y(t,{code:s?H.too_big:H.too_small,minimum:i?r.exactLength.value:void 0,maximum:s?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty()}if(r.minLength!==null){if(t.data.length<r.minLength.value)Y(t,{code:H.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()}if(r.maxLength!==null){if(t.data.length>r.maxLength.value)Y(t,{code:H.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()}if(t.common.async)return Promise.all([...t.data].map((s,i)=>r.type._parseAsync(new lo(t,s,t.path,i)))).then((s)=>gn.mergeArray(n,s));let o=[...t.data].map((s,i)=>r.type._parseSync(new lo(t,s,t.path,i)));return gn.mergeArray(n,o)}get element(){return this._def.type}min(e,t){return new co({...this._def,minLength:{value:e,message:ie.toString(t)}})}max(e,t){return new co({...this._def,maxLength:{value:e,message:ie.toString(t)}})}length(e,t){return new co({...this._def,exactLength:{value:e,message:ie.toString(t)}})}nonempty(e){return this.min(1,e)}}co.create=(e,t)=>new co({type:e,minLength:null,maxLength:null,exactLength:null,typeName:B.ZodArray,...we(t)});function vl(e){if(e instanceof Ct){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Er.create(vl(r))}return new Ct({...e._def,shape:()=>t})}else if(e instanceof co)return new co({...e._def,type:vl(e.element)});else if(e instanceof Er)return Er.create(vl(e.unwrap()));else if(e instanceof bs)return bs.create(vl(e.unwrap()));else if(e instanceof Zo)return Zo.create(e.items.map((t)=>vl(t)));else return e}class Ct extends De{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Ue.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==W.object){let c=this._getOrReturnCtx(e);return Y(c,{code:H.invalid_type,expected:W.object,received:c.parsedType}),he}let{status:n,ctx:r}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof Vo&&this._def.unknownKeys==="strip")){for(let c in r.data)if(!s.includes(c))i.push(c)}let a=[];for(let c of s){let l=o[c],u=r.data[c];a.push({key:{status:"valid",value:c},value:l._parse(new lo(r,u,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof Vo){let c=this._def.unknownKeys;if(c==="passthrough")for(let l of i)a.push({key:{status:"valid",value:l},value:{status:"valid",value:r.data[l]}});else if(c==="strict"){if(i.length>0)Y(r,{code:H.unrecognized_keys,keys:i}),n.dirty()}else if(c==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let l of i){let u=r.data[l];a.push({key:{status:"valid",value:l},value:c._parse(new lo(r,u,r.path,l)),alwaysSet:l in r.data})}}if(r.common.async)return Promise.resolve().then(async()=>{let c=[];for(let l of a){let u=await l.key,p=await l.value;c.push({key:u,value:p,alwaysSet:l.alwaysSet})}return c}).then((c)=>gn.mergeObjectSync(n,c));else return gn.mergeObjectSync(n,a)}get shape(){return this._def.shape()}strict(e){return ie.errToObj,new Ct({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{let r=this._def.errorMap?.(t,n).message??n.defaultError;if(t.code==="unrecognized_keys")return{message:ie.errToObj(e).message??r};return{message:r}}}:{}})}strip(){return new Ct({...this._def,unknownKeys:"strip"})}passthrough(){return new Ct({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ct({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ct({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:B.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Ct({...this._def,catchall:e})}pick(e){let t={};for(let n of Ue.objectKeys(e))if(e[n]&&this.shape[n])t[n]=this.shape[n];return new Ct({...this._def,shape:()=>t})}omit(e){let t={};for(let n of Ue.objectKeys(this.shape))if(!e[n])t[n]=this.shape[n];return new Ct({...this._def,shape:()=>t})}deepPartial(){return vl(this)}partial(e){let t={};for(let n of Ue.objectKeys(this.shape)){let r=this.shape[n];if(e&&!e[n])t[n]=r;else t[n]=r.optional()}return new Ct({...this._def,shape:()=>t})}required(e){let t={};for(let n of Ue.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let o=this.shape[n];while(o instanceof Er)o=o._def.innerType;t[n]=o}return new Ct({...this._def,shape:()=>t})}keyof(){return hF(Ue.objectKeys(this.shape))}}Ct.create=(e,t)=>new Ct({shape:()=>e,unknownKeys:"strip",catchall:Vo.create(),typeName:B.ZodObject,...we(t)});Ct.strictCreate=(e,t)=>new Ct({shape:()=>e,unknownKeys:"strict",catchall:Vo.create(),typeName:B.ZodObject,...we(t)});Ct.lazycreate=(e,t)=>new Ct({shape:e,unknownKeys:"strip",catchall:Vo.create(),typeName:B.ZodObject,...we(t)});class kl extends De{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(o){for(let i of o)if(i.result.status==="valid")return i.result;for(let i of o)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map((i)=>new Yn(i.ctx.common.issues));return Y(t,{code:H.invalid_union,unionErrors:s}),he}if(t.common.async)return Promise.all(n.map(async(o)=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(r);else{let o=void 0,s=[];for(let a of n){let c={...t,common:{...t.common,issues:[]},parent:null},l=a._parseSync({data:t.data,path:t.path,parent:c});if(l.status==="valid")return l;else if(l.status==="dirty"&&!o)o={result:l,ctx:c};if(c.common.issues.length)s.push(c.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let i=s.map((a)=>new Yn(a));return Y(t,{code:H.invalid_union,unionErrors:i}),he}}get options(){return this._def.options}}kl.create=(e,t)=>new kl({options:e,typeName:B.ZodUnion,...we(t)});var ys=(e)=>{if(e instanceof Ol)return ys(e.schema);else if(e instanceof uo)return ys(e.innerType());else if(e instanceof Pl)return[e.value];else if(e instanceof fi)return e.options;else if(e instanceof Il)return Ue.objectValues(e.enum);else if(e instanceof Dl)return ys(e._def.innerType);else if(e instanceof Tl)return[void 0];else if(e instanceof Cl)return[null];else if(e instanceof Er)return[void 0,...ys(e.unwrap())];else if(e instanceof bs)return[null,...ys(e.unwrap())];else if(e instanceof s_)return ys(e.unwrap());else if(e instanceof Ml)return ys(e.unwrap());else if(e instanceof Ll)return ys(e._def.innerType);else return[]};class o_ extends De{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==W.object)return Y(t,{code:H.invalid_type,expected:W.object,received:t.parsedType}),he;let n=this.discriminator,r=t.data[n],o=this.optionsMap.get(r);if(!o)return Y(t,{code:H.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),he;if(t.common.async)return o._parseAsync({data:t.data,path:t.path,parent:t});else return o._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let r=new Map;for(let o of t){let s=ys(o.shape[e]);if(!s.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(r.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,o)}}return new o_({typeName:B.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...we(n)})}}function Uw(e,t){let n=qo(e),r=qo(t);if(e===t)return{valid:!0,data:e};else if(n===W.object&&r===W.object){let o=Ue.objectKeys(t),s=Ue.objectKeys(e).filter((a)=>o.indexOf(a)!==-1),i={...e,...t};for(let a of s){let c=Uw(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===W.array&&r===W.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let s=0;s<e.length;s++){let i=e[s],a=t[s],c=Uw(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else if(n===W.date&&r===W.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}class Rl extends De{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(o,s)=>{if(n_(o)||n_(s))return he;let i=Uw(o.value,s.value);if(!i.valid)return Y(n,{code:H.invalid_intersection_types}),he;if(r_(o)||r_(s))t.dirty();return{status:t.value,value:i.data}};if(n.common.async)return Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>r(o,s));else return r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Rl.create=(e,t,n)=>new Rl({left:e,right:t,typeName:B.ZodIntersection,...we(n)});class Zo extends De{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.array)return Y(n,{code:H.invalid_type,expected:W.array,received:n.parsedType}),he;if(n.data.length<this._def.items.length)return Y(n,{code:H.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),he;if(!this._def.rest&&n.data.length>this._def.items.length)Y(n,{code:H.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let o=[...n.data].map((s,i)=>{let a=this._def.items[i]||this._def.rest;if(!a)return null;return a._parse(new lo(n,s,n.path,i))}).filter((s)=>!!s);if(n.common.async)return Promise.all(o).then((s)=>gn.mergeArray(t,s));else return gn.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new Zo({...this._def,rest:e})}}Zo.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zo({items:e,typeName:B.ZodTuple,rest:null,...we(t)})};class Yp extends De{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.object)return Y(n,{code:H.invalid_type,expected:W.object,received:n.parsedType}),he;let r=[],o=this._def.keyType,s=this._def.valueType;for(let i in n.data)r.push({key:o._parse(new lo(n,i,n.path,i)),value:s._parse(new lo(n,n.data[i],n.path,i)),alwaysSet:i in n.data});if(n.common.async)return gn.mergeObjectAsync(t,r);else return gn.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){if(t instanceof De)return new Yp({keyType:e,valueType:t,typeName:B.ZodRecord,...we(n)});return new Yp({keyType:ao.create(),valueType:e,typeName:B.ZodRecord,...we(t)})}}class Jp extends De{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.map)return Y(n,{code:H.invalid_type,expected:W.map,received:n.parsedType}),he;let r=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([i,a],c)=>({key:r._parse(new lo(n,i,n.path,[c,"key"])),value:o._parse(new lo(n,a,n.path,[c,"value"]))}));if(n.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let a of s){let c=await a.key,l=await a.value;if(c.status==="aborted"||l.status==="aborted")return he;if(c.status==="dirty"||l.status==="dirty")t.dirty();i.set(c.value,l.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let a of s){let{key:c,value:l}=a;if(c.status==="aborted"||l.status==="aborted")return he;if(c.status==="dirty"||l.status==="dirty")t.dirty();i.set(c.value,l.value)}return{status:t.value,value:i}}}}Jp.create=(e,t,n)=>new Jp({valueType:t,keyType:e,typeName:B.ZodMap,...we(n)});class ya extends De{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.set)return Y(n,{code:H.invalid_type,expected:W.set,received:n.parsedType}),he;let r=this._def;if(r.minSize!==null){if(n.data.size<r.minSize.value)Y(n,{code:H.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()}if(r.maxSize!==null){if(n.data.size>r.maxSize.value)Y(n,{code:H.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty()}let o=this._def.valueType;function s(a){let c=new Set;for(let l of a){if(l.status==="aborted")return he;if(l.status==="dirty")t.dirty();c.add(l.value)}return{status:t.value,value:c}}let i=[...n.data.values()].map((a,c)=>o._parse(new lo(n,a,n.path,c)));if(n.common.async)return Promise.all(i).then((a)=>s(a));else return s(i)}min(e,t){return new ya({...this._def,minSize:{value:e,message:ie.toString(t)}})}max(e,t){return new ya({...this._def,maxSize:{value:e,message:ie.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ya.create=(e,t)=>new ya({valueType:e,minSize:null,maxSize:null,typeName:B.ZodSet,...we(t)});class wl extends De{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==W.function)return Y(t,{code:H.invalid_type,expected:W.function,received:t.parsedType}),he;function n(i,a){return qp({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,El(),_s].filter((c)=>!!c),issueData:{code:H.invalid_arguments,argumentsError:a}})}function r(i,a){return qp({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,El(),_s].filter((c)=>!!c),issueData:{code:H.invalid_return_type,returnTypeError:a}})}let o={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof ba){let i=this;return Cn(async function(...a){let c=new Yn([]),l=await i._def.args.parseAsync(a,o).catch((f)=>{throw c.addIssue(n(a,f)),c}),u=await Reflect.apply(s,this,l);return await i._def.returns._def.type.parseAsync(u,o).catch((f)=>{throw c.addIssue(r(u,f)),c})})}else{let i=this;return Cn(function(...a){let c=i._def.args.safeParse(a,o);if(!c.success)throw new Yn([n(a,c.error)]);let l=Reflect.apply(s,this,c.data),u=i._def.returns.safeParse(l,o);if(!u.success)throw new Yn([r(l,u.error)]);return u.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new wl({...this._def,args:Zo.create(e).rest(ui.create())})}returns(e){return new wl({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new wl({args:e?e:Zo.create([]).rest(ui.create()),returns:t||ui.create(),typeName:B.ZodFunction,...we(n)})}}class Ol extends De{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ol.create=(e,t)=>new Ol({getter:e,typeName:B.ZodLazy,...we(t)});class Pl extends De{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Y(t,{received:t.data,code:H.invalid_literal,expected:this._def.value}),he}return{status:"valid",value:e.data}}get value(){return this._def.value}}Pl.create=(e,t)=>new Pl({value:e,typeName:B.ZodLiteral,...we(t)});function hF(e,t){return new fi({values:e,typeName:B.ZodEnum,...we(t)})}class fi extends De{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return Y(t,{expected:Ue.joinValues(n),received:t.parsedType,code:H.invalid_type}),he}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return Y(t,{received:t.data,code:H.invalid_enum_value,options:n}),he}return Cn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return fi.create(e,{...this._def,...t})}exclude(e,t=this._def){return fi.create(this.options.filter((n)=>!e.includes(n)),{...this._def,...t})}}fi.create=hF;class Il extends De{_parse(e){let t=Ue.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==W.string&&n.parsedType!==W.number){let r=Ue.objectValues(t);return Y(n,{expected:Ue.joinValues(r),received:n.parsedType,code:H.invalid_type}),he}if(!this._cache)this._cache=new Set(Ue.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let r=Ue.objectValues(t);return Y(n,{received:n.data,code:H.invalid_enum_value,options:r}),he}return Cn(e.data)}get enum(){return this._def.values}}Il.create=(e,t)=>new Il({values:e,typeName:B.ZodNativeEnum,...we(t)});class ba extends De{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==W.promise&&t.common.async===!1)return Y(t,{code:H.invalid_type,expected:W.promise,received:t.parsedType}),he;let n=t.parsedType===W.promise?t.data:Promise.resolve(t.data);return Cn(n.then((r)=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ba.create=(e,t)=>new ba({type:e,typeName:B.ZodPromise,...we(t)});class uo extends De{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===B.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,o={addIssue:(s)=>{if(Y(n,s),s.fatal)t.abort();else t.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),r.type==="preprocess"){let s=r.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async(i)=>{if(t.value==="aborted")return he;let a=await this._def.schema._parseAsync({data:i,path:n.path,parent:n});if(a.status==="aborted")return he;if(a.status==="dirty")return ha(a.value);if(t.value==="dirty")return ha(a.value);return a});else{if(t.value==="aborted")return he;let i=this._def.schema._parseSync({data:s,path:n.path,parent:n});if(i.status==="aborted")return he;if(i.status==="dirty")return ha(i.value);if(t.value==="dirty")return ha(i.value);return i}}if(r.type==="refinement"){let s=(i)=>{let a=r.refinement(i,o);if(n.common.async)return Promise.resolve(a);if(a instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(i.status==="aborted")return he;if(i.status==="dirty")t.dirty();return s(i.value),{status:t.value,value:i.value}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((i)=>{if(i.status==="aborted")return he;if(i.status==="dirty")t.dirty();return s(i.value).then(()=>({status:t.value,value:i.value}))})}if(r.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!li(s))return he;let i=r.transform(s.value,o);if(i instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((s)=>{if(!li(s))return he;return Promise.resolve(r.transform(s.value,o)).then((i)=>({status:t.value,value:i}))});Ue.assertNever(r)}}uo.create=(e,t,n)=>new uo({schema:e,typeName:B.ZodEffects,effect:t,...we(n)});uo.createWithPreprocess=(e,t,n)=>new uo({schema:t,effect:{type:"preprocess",transform:e},typeName:B.ZodEffects,...we(n)});class Er extends De{_parse(e){if(this._getType(e)===W.undefined)return Cn(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Er.create=(e,t)=>new Er({innerType:e,typeName:B.ZodOptional,...we(t)});class bs extends De{_parse(e){if(this._getType(e)===W.null)return Cn(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}bs.create=(e,t)=>new bs({innerType:e,typeName:B.ZodNullable,...we(t)});class Dl extends De{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;if(t.parsedType===W.undefined)n=this._def.defaultValue();return this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Dl.create=(e,t)=>new Dl({innerType:e,typeName:B.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...we(t)});class Ll extends De{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});if(xl(r))return r.then((o)=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Yn(n.common.issues)},input:n.data})}));else return{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Yn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ll.create=(e,t)=>new Ll({innerType:e,typeName:B.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...we(t)});class Xp extends De{_parse(e){if(this._getType(e)!==W.nan){let n=this._getOrReturnCtx(e);return Y(n,{code:H.invalid_type,expected:W.nan,received:n.parsedType}),he}return{status:"valid",value:e.data}}}Xp.create=(e)=>new Xp({typeName:B.ZodNaN,...we(e)});var ele=Symbol("zod_brand");class s_ extends De{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Qp extends De{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});if(o.status==="aborted")return he;if(o.status==="dirty")return t.dirty(),ha(o.value);else return this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();else{let r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});if(r.status==="aborted")return he;if(r.status==="dirty")return t.dirty(),{status:"dirty",value:r.value};else return this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,t){return new Qp({in:e,out:t,typeName:B.ZodPipeline})}}class Ml extends De{_parse(e){let t=this._def.innerType._parse(e),n=(r)=>{if(li(r))r.value=Object.freeze(r.value);return r};return xl(t)?t.then((r)=>n(r)):n(t)}unwrap(){return this._def.innerType}}Ml.create=(e,t)=>new Ml({innerType:e,typeName:B.ZodReadonly,...we(t)});function dF(e,t){let n=typeof e==="function"?e(t):typeof e==="string"?{message:e}:e;return typeof n==="string"?{message:n}:n}function gF(e,t={},n){if(e)return _a.create().superRefine((r,o)=>{let s=e(r);if(s instanceof Promise)return s.then((i)=>{if(!i){let a=dF(t,r),c=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!s){let i=dF(t,r),a=i.fatal??n??!0;o.addIssue({code:"custom",...i,fatal:a})}return});return _a.create()}var tle={object:Ct.lazycreate},B;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(B||(B={}));var nle=(e,t={message:`Input not instance of ${e.name}`})=>gF((n)=>n instanceof e,t),_F=ao.create,yF=di.create,rle=Xp.create,ole=pi.create,bF=Al.create,sle=ga.create,ile=Vp.create,ale=Tl.create,cle=Cl.create,lle=_a.create,ule=ui.create,dle=Vo.create,ple=Zp.create,fle=co.create,Fw=Ct.create,mle=Ct.strictCreate,hle=kl.create,gle=o_.create,_le=Rl.create,yle=Zo.create,ble=Yp.create,Sle=Jp.create,Ele=ya.create,xle=wl.create,vle=Ol.create,wle=Pl.create,Ale=fi.create,Tle=Il.create,Cle=ba.create,kle=uo.create,Rle=Er.create,Ole=bs.create,Ple=uo.createWithPreprocess,Ile=Qp.create,Dle=()=>_F().optional(),Lle=()=>yF().optional(),Mle=()=>bF().optional(),Nle={string:(e)=>ao.create({...e,coerce:!0}),number:(e)=>di.create({...e,coerce:!0}),boolean:(e)=>Al.create({...e,coerce:!0}),bigint:(e)=>pi.create({...e,coerce:!0}),date:(e)=>ga.create({...e,coerce:!0})};var Ule=he;class SF{resetters=[];lazy(e){let t;return this.resetters.push(()=>{t=void 0}),()=>t??=e()}reset(){for(let e of this.resetters)e()}}var jle=new SF;function M(e){return jle.lazy(e)}function $le(e){let t=e?.trim();return t?t:void 0}function Nl(e){return e===void 0?void 0:String(e)}var zle=M(()=>Ln.preprocess(Nl,Ln.string().optional().transform($le))),Hle=M(()=>Ln.preprocess(Nl,Ln.string().optional())),Ble=M(()=>Ln.preprocess(Nl,Ln.string().optional().transform((e)=>Ie(e)))),Kle=M(()=>Ln.preprocess(Nl,Ln.string().optional().transform((e)=>{if(Ie(e))return!0;if(wh(e))return!1;return}))),Gle=M(()=>xF());function EF(e){if(typeof e==="boolean")return e?"1":"0";return String(e)}var d={str:()=>zle(),rawStr:()=>Hle(),bool:()=>Ble(),triBool:()=>Kle(),int:(e)=>e?xF(e):Gle(),enum:(e)=>Ln.preprocess(Nl,Ln.string().optional().transform((t)=>t!==void 0&&e.includes(t.trim())?t.trim():void 0))};function xF(e){return Ln.preprocess(Nl,Ln.string().optional().transform((t)=>{if(t===void 0)return;if(e?.digitsOnly&&!/^[+-]?\d+$/.test(t.trim()))return;let n=RE(t);if(!Number.isFinite(n))return;if(e?.min!==void 0&&n<e.min)return;if(e?.max!==void 0&&n>e.max)return;return n}))}var Wle=d.str(),qle=d.str(),Vle=d.str(),Zle=d.str(),Yle=d.str(),Jle=d.str(),Xle=d.str(),Qle=d.str(),eue=d.str(),tue=d.str(),nue=d.str(),rue=d.str(),oue=d.str(),sue=d.str(),iue=d.str(),aue=d.str(),cue=d.str(),lue=d.str(),uue=d.str(),due=d.str(),pue=d.str(),fue=d.str(),mue=d.str(),hue=d.str(),gue=d.str(),_ue=d.str(),yue=d.bool(),bue=d.bool(),Sue=d.int({min:1}),Eue=d.str(),xue=d.str(),vue=d.str(),wue=d.str(),Aue=d.bool(),Tue=d.bool(),Cue=d.str(),kue=d.str(),Rue=d.str(),Oue=d.int({min:0}),Pue=d.int({min:0}),Iue=d.int(),Due=d.bool(),Lue=d.int(),Mue=d.bool(),Nue=d.bool(),Uue=d.bool(),Fue=d.bool(),jue=d.bool(),$ue=d.bool(),zue=d.bool(),Hue=d.int({min:1,max:2147483647}),Bue=d.str(),Kue=d.str(),Gue=d.str(),Wue=d.str(),que=d.str(),Vue=d.str(),Zue=d.str(),Yue=d.str(),Jue=d.str(),Xue=d.str(),Que=d.str();var $w={};rn($w,{ANT_CLAUDE_CODE_METRICS_ENDPOINT:()=>lpe,ANT_OTEL_EXPORTER_OTLP_ENDPOINT:()=>npe,ANT_OTEL_EXPORTER_OTLP_HEADERS:()=>rpe,ANT_OTEL_EXPORTER_OTLP_PROTOCOL:()=>ope,ANT_OTEL_LOGS_EXPORTER:()=>spe,ANT_OTEL_METRICS_EXPORTER:()=>ipe,ANT_OTEL_RESOURCE_ATTRIBUTES:()=>cpe,ANT_OTEL_TRACES_EXPORTER:()=>ape,BETA_TRACING_ENDPOINT:()=>upe,CLAUDE_CODE_BENCH_LIVE_COUNTS:()=>yde,CLAUDE_CODE_BYOC_ENABLE_DATADOG:()=>Ade,CLAUDE_CODE_DATADOG_FLUSH_INTERVAL_MS:()=>vde,CLAUDE_CODE_DD_ERROR_TRACKING_FLUSH_INTERVAL_MS:()=>wde,CLAUDE_CODE_DEBUG_LOGS_DIR:()=>rde,CLAUDE_CODE_DEBUG_LOG_LEVEL:()=>nde,CLAUDE_CODE_DEBUG_REPAINTS:()=>ode,CLAUDE_CODE_DIAGNOSTICS_FILE:()=>sde,CLAUDE_CODE_ENHANCED_TELEMETRY_BETA:()=>bde,CLAUDE_CODE_FRAME_TIMING_LOG:()=>pde,CLAUDE_CODE_FRAME_TIMING_SAMPLE_EVERY:()=>fde,CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH:()=>Yde,CLAUDE_CODE_OTEL_DIAG_STDERR:()=>Tde,CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS:()=>Sde,CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS:()=>xde,CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS:()=>Ede,CLAUDE_CODE_PERFETTO_TRACE:()=>ude,CLAUDE_CODE_PERFETTO_WRITE_INTERVAL_S:()=>dde,CLAUDE_CODE_PROFILE_QUERY:()=>lde,CLAUDE_CODE_PROFILE_STARTUP:()=>cde,CLAUDE_CODE_SESSION_LOG:()=>mde,CLAUDE_CODE_TEE_SDK_STDOUT:()=>_de,CLAUDE_CODE_TERMINAL_RECORDING:()=>gde,CLAUDE_DEBUG:()=>ede,CLAUDE_PTY_RECORD:()=>hde,DEBUG:()=>tde,DEBUG_CLAUDE_AGENT_SDK:()=>ide,DEBUG_SDK:()=>ade,OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT:()=>qde,OTEL_EXPORTER_OTLP_ENDPOINT:()=>Ode,OTEL_EXPORTER_OTLP_HEADERS:()=>Pde,OTEL_EXPORTER_OTLP_LOGS_ENDPOINT:()=>Dde,OTEL_EXPORTER_OTLP_LOGS_HEADERS:()=>Lde,OTEL_EXPORTER_OTLP_LOGS_PROTOCOL:()=>Mde,OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:()=>Nde,OTEL_EXPORTER_OTLP_METRICS_HEADERS:()=>Ude,OTEL_EXPORTER_OTLP_METRICS_PROTOCOL:()=>Fde,OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE:()=>jde,OTEL_EXPORTER_OTLP_PROTOCOL:()=>Ide,OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:()=>$de,OTEL_EXPORTER_OTLP_TRACES_HEADERS:()=>zde,OTEL_EXPORTER_OTLP_TRACES_PROTOCOL:()=>Hde,OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT:()=>Vde,OTEL_LOGS_EXPORTER:()=>kde,OTEL_LOGS_EXPORT_INTERVAL:()=>Kde,OTEL_LOG_ASSISTANT_RESPONSES:()=>Xde,OTEL_LOG_RAW_API_BODIES:()=>tpe,OTEL_LOG_TOOL_CONTENT:()=>Qde,OTEL_LOG_TOOL_DETAILS:()=>epe,OTEL_LOG_USER_PROMPTS:()=>Jde,OTEL_METRICS_EXPORTER:()=>Cde,OTEL_METRIC_EXPORT_INTERVAL:()=>Bde,OTEL_RESOURCE_ATTRIBUTES:()=>Wde,OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT:()=>Zde,OTEL_TRACES_EXPORTER:()=>Rde,OTEL_TRACES_EXPORT_INTERVAL:()=>Gde});var ede=d.bool(),tde=d.str(),nde=d.str(),rde=d.str(),ode=d.bool(),sde=d.str(),ide=d.bool(),ade=d.bool(),cde=d.bool(),lde=d.bool(),ude=d.str(),dde=d.int(),pde=d.str(),fde=d.int(),mde=d.str(),hde=d.str(),gde=d.str(),_de=d.bool(),yde=d.bool(),bde=d.bool(),Sde=d.int(),Ede=d.int(),xde=d.int(),vde=d.int({min:1}),wde=d.int({min:1}),Ade=d.bool(),Tde=d.bool(),Cde=d.str(),kde=d.str(),Rde=d.str(),Ode=d.str(),Pde=d.str(),Ide=d.str(),Dde=d.str(),Lde=d.str(),Mde=d.str(),Nde=d.str(),Ude=d.str(),Fde=d.str(),jde=d.str(),$de=d.str(),zde=d.str(),Hde=d.str(),Bde=d.int(),Kde=d.int(),Gde=d.int(),Wde=d.str(),qde=d.int({min:0}),Vde=d.int({min:0}),Zde=d.int({min:0}),Yde=d.int({min:1,digitsOnly:!0}),Jde=d.bool(),Xde=d.triBool(),Qde=d.bool(),epe=d.bool(),tpe=d.bool(),npe=d.str(),rpe=d.str(),ope=d.str(),spe=d.str(),ipe=d.str(),ape=d.str(),cpe=d.str(),lpe=d.str(),upe=d.str();import{constants as _Se}from"fs";import{access as MT,readdir as ySe,readFile as bSe,readlink as SSe}from"fs/promises";import{homedir as ESe}from"os";import{delimiter as xSe,join as Df}from"path";function ef(e,t){let n=0;for(let r of e)n+=+!!t(r);return n}function Ss(e){return[...new Set(e)]}function wF(){return"prod"}function AF(){if(process.env.CLAUDE_CODE_CUSTOM_OAUTH_URL)return"-custom-oauth";switch(wF()){case"local":return"-local-oauth";case"staging":return"-staging-oauth";case"prod":return""}}var dpe=31536000;var bgt=Math.round(dpe/86400),ppe="user:inference",TF="user:profile",fpe="org:create_api_key";var mpe=[fpe,TF],hpe=[TF,ppe,"user:sessions:claude_code","user:mcp_servers","user:file_upload"],Sgt=Ss([...mpe,...hpe]);var vF={BASE_API_URL:"https://api.anthropic.com",CONSOLE_AUTHORIZE_URL:"https://platform.claude.com/oauth/authorize",CLAUDE_AI_AUTHORIZE_URL:"https://claude.com/cai/oauth/authorize",CLAUDE_AI_ORIGIN:"https://claude.ai",TOKEN_URL:"https://platform.claude.com/v1/oauth/token",API_KEY_URL:"https://api.anthropic.com/api/oauth/claude_cli/create_api_key",ROLES_URL:"https://api.anthropic.com/api/oauth/claude_cli/roles",CONSOLE_SUCCESS_URL:"https://platform.claude.com/buy_credits?returnUrl=/oauth/code/success%3Fapp%3Dclaude-code",CLAUDEAI_SUCCESS_URL:"https://platform.claude.com/oauth/code/success?app=claude-code",MANUAL_REDIRECT_URL:"https://platform.claude.com/oauth/code/callback",CLIENT_ID:"9d1c250a-e61b-44d9-88ed-5944d1962f5e",DESIGN_CLIENT_ID:"59637612-477b-4836-a601-b0589eda7704",OAUTH_FILE_SUFFIX:"",MCP_PROXY_URL:"https://mcp-proxy.anthropic.com",MCP_PROXY_PATH:"/v1/mcp/{server_id}"};var gpe=void 0;function _pe(){let e=process.env.CLAUDE_LOCAL_OAUTH_API_BASE?.replace(/\/$/,"")??"http://localhost:8000",t=process.env.CLAUDE_LOCAL_OAUTH_APPS_BASE?.replace(/\/$/,"")??"http://localhost:4000",n=process.env.CLAUDE_LOCAL_OAUTH_CONSOLE_BASE?.replace(/\/$/,"")??"http://localhost:3000";return{BASE_API_URL:e,CONSOLE_AUTHORIZE_URL:`${n}/oauth/authorize`,CLAUDE_AI_AUTHORIZE_URL:`${t}/oauth/authorize`,CLAUDE_AI_ORIGIN:t,TOKEN_URL:`${e}/v1/oauth/token`,API_KEY_URL:`${e}/api/oauth/claude_cli/create_api_key`,ROLES_URL:`${e}/api/oauth/claude_cli/roles`,CONSOLE_SUCCESS_URL:`${n}/buy_credits?returnUrl=/oauth/code/success%3Fapp%3Dclaude-code`,CLAUDEAI_SUCCESS_URL:`${n}/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`${n}/oauth/code/callback`,CLIENT_ID:"22422756-60c9-4084-8eb7-27705fd5cf9a",DESIGN_CLIENT_ID:"00000000-0000-4000-8000-000000000000",OAUTH_FILE_SUFFIX:"-local-oauth",MCP_PROXY_URL:"http://localhost:8205",MCP_PROXY_PATH:"/v1/toolbox/shttp/mcp/{server_id}"}}var ype=["https://beacon.claude-ai.staging.ant.dev","https://claude.fedstart.com","https://claude-staging.fedstart.com"];function CF(){let e=(()=>{switch(wF()){case"local":return _pe();case"staging":return gpe??vF;case"prod":return vF}})(),t=process.env.CLAUDE_CODE_CUSTOM_OAUTH_URL;if(t){let r=t.replace(/\/$/,"");if(!ype.includes(r))throw Error("CLAUDE_CODE_CUSTOM_OAUTH_URL is not an approved endpoint.");e={...e,BASE_API_URL:r,CONSOLE_AUTHORIZE_URL:`${r}/oauth/authorize`,CLAUDE_AI_AUTHORIZE_URL:`${r}/oauth/authorize`,CLAUDE_AI_ORIGIN:r,TOKEN_URL:`${r}/v1/oauth/token`,API_KEY_URL:`${r}/api/oauth/claude_cli/create_api_key`,ROLES_URL:`${r}/api/oauth/claude_cli/roles`,CONSOLE_SUCCESS_URL:`${r}/oauth/code/success?app=claude-code`,CLAUDEAI_SUCCESS_URL:`${r}/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`${r}/oauth/code/callback`,OAUTH_FILE_SUFFIX:"-custom-oauth"}}let n=process.env.CLAUDE_CODE_OAUTH_CLIENT_ID;if(n)e={...e,CLIENT_ID:n};return e}import*as $e from"fs";import{appendFile as nfe,chmod as rfe,copyFile as ofe,link as sfe,lstat as ife,mkdir as afe,open as tj,readdir as cfe,readFile as nj,readlink as lfe,realpath as ufe,rename as dfe,rmdir as pfe,rm as ffe,stat as mfe,symlink as hfe,unlink as gfe}from"fs/promises";import*as sn from"path";import{appendFile as Ww,mkdir as WF,rename as qF,stat as zpe,symlink as Hpe,unlink as qw}from"fs/promises";import{dirname as Ul,isAbsolute as Bpe,join as mi,resolve as JF}from"path";function J(e,t){return{code:"InvalidArgument",argument:e,...t!==void 0&&{reason:t}}}var kF={home:(e)=>({space:"home",path:e}),workspace:(e)=>({space:"workspace",path:e}),system:(e)=>({space:"system",path:e}),userNamed:(e)=>({space:"userNamed",path:e})};var zw=globalThis.process?.getBuiltinModule?.("async_hooks"),RF=zw!==void 0,Hw=zw?new zw.AsyncLocalStorage:{run:(e,t)=>t(),getStore:()=>{return}};function OF({writeBatch:e,sizeOf:t,flushIntervalMs:n=1000,maxBufferSize:r=100,maxBufferBytes:o=1/0,immediateMode:s=!1}){let i=[],a=0,c=null,l=null;function u(){if(c)clearTimeout(c),c=null}function p(g){try{e(g)}catch{}}function f(){if(l)p(l),l=null;if(i.length===0)return;p(i),i=[],a=0,u()}function m(){if(!c)c=setTimeout(f,n)}function h(){if(l){l.push(...i),i=[],a=0,u();return}let g=i;i=[],a=0,u(),l=g,setImmediate(()=>{let y=l;if(l=null,y)p(y)})}return{write(g){if(s){p([g]);return}if(i.push(g),a+=t(g),m(),i.length>=r||a>=o)h()},flush:f,dispose(){f()}}}function Spe(e){if(typeof e==="function")return e;if(Symbol.asyncDispose in e)return()=>e[Symbol.asyncDispose]();return()=>e[Symbol.dispose]()}class Bw{#e=new Set;#t=!1;get drainStarted(){return this.#t}register(e){let t=Spe(e);this.#e.add(t);let n=()=>{this.#e.delete(t)};return Object.assign(n,{[Symbol.dispose]:n})}async drain(){this.#t=!0;let e=Array.from(this.#e);this.#e.clear();let n=(await Promise.allSettled(e.map(async(r)=>r()))).find((r)=>r.status==="rejected");if(n!==void 0)throw n.reason}async[Symbol.asyncDispose](){await this.drain()}get sizeForTesting(){return this.#e.size}}class PF{cleanup=new Bw;preExitFlush=new Bw}var Epe=new tt(()=>new PF);function xpe(){return Epe.of(Tt().host)}function i_(e){return xpe().cleanup.register(e)}class DF{parsed=new Map;lookup(e){return this.parsed.get(e)}remember(e,t){this.parsed.set(e,t)}reset(){this.parsed.clear()}}var IF=new DF;function LF(e){let t=IF.lookup(e);if(t!==void 0)return t;let n=vpe(e);return IF.remember(e,n),n}function vpe(e){if(!e||e.trim()==="")return null;let t=e.split(",").map((s)=>s.trim()).filter(Boolean);if(t.length===0)return null;let n=t.some((s)=>s.startsWith("!")),r=t.some((s)=>!s.startsWith("!"));if(n&&r)return null;let o=t.map((s)=>s.replace(/^!/,"").toLowerCase());return{include:n?[]:o,exclude:n?o:[],isExclusive:n}}function wpe(e){let t=[],n=e.match(/^MCP server ["']([^"']+)["']/);if(n&&n[1])t.push("mcp"),t.push(n[1].toLowerCase());else{let s=e.match(/^([^:[]+):/);if(s&&s[1])t.push(s[1].trim().toLowerCase())}let r=e.match(/^\[([^\]]+)]/);if(r&&r[1])t.push(r[1].trim().toLowerCase());if(e.toLowerCase().includes("1p event:"))t.push("1p");let o=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(o&&o[1]){let s=o[1].trim().toLowerCase();if(s.length<30&&!s.includes(" "))t.push(s)}return Array.from(new Set(t))}function Ape(e,t){if(!t)return!0;if(e.length===0)return!1;if(t.isExclusive)return!e.some((n)=>t.exclude.includes(n));else return e.some((n)=>t.include.includes(n))}function MF(e,t){if(!t)return!0;let n=wpe(e);return Ape(n,t)}function Tpe(e,t,n){if(e.destroyed||e.writableEnded)return!1;return e.write(t,n),!0}class Kw{everWritten=!1;drainPromise=void 0;bytesQueued=0;bytesFlushed=0;notifyFlushProgress=void 0;notifyExternallyClocked=void 0;externallyClockedPromise=void 0;externallyClocked=!1;errored=!1;flushConfirmedPromise=void 0;flushCloseListener=void 0;markEverWritten(){this.everWritten=!0}recordQueued(e){this.bytesQueued+=e}recordFlushed(e){this.bytesFlushed+=e,this.notifyFlushProgress?.()}markErrored(){this.errored=!0,this.notifyFlushProgress?.()}outstandingBytes(){return process.stdout.destroyed||this.errored?0:this.bytesQueued-this.bytesFlushed}endStdoutOnce(){if(this.drainPromise===void 0){let e=process.stdout;if(e.isTTY||e.destroyed||e.writableEnded||!this.everWritten)return;this.drainPromise=new Promise((t)=>e.end(t))}return this.drainPromise}fullyFlushed(){if(this.flushConfirmedPromise===void 0)this.flushConfirmedPromise=new Promise((e)=>{let t=()=>{if(this.outstandingBytes()<=0)this.notifyFlushProgress=void 0,e()};this.notifyFlushProgress=t,this.flushCloseListener=t,process.stdout.once("close",t),t()});return this.flushConfirmedPromise}isExternallyClocked(){return this.externallyClocked}ensureExternallyClockedPromise(){return this.externallyClockedPromise??=new Promise((e)=>{this.notifyExternallyClocked=e})}markExternallyClocked(){this.externallyClocked=!0,this.ensureExternallyClockedPromise(),this.notifyExternallyClocked?.(),this.notifyExternallyClocked=void 0}reset(){if(this.flushCloseListener!==void 0)process.stdout.removeListener("close",this.flushCloseListener);Object.assign(this,new Kw)}}var Ugt=new Kw;function NF(e){Tpe(process.stderr,e)}var Cpe=/api[_-]?key|secret|token|password|passwd|credential|bearer|authorization|auth[_-]?header|cookie|session[_-]?(?:id|key)|connection[_-]?string|(?:private|ssh|encryption|signing|access|deploy|master|license)[_-]?key|client[_-]?secret/i,UF="[^\\s,;&}\\])]+",FF=`"[^"]*"|'[^']*'|[^\\s-]{0,4}\\[REDACTED\\]['"\`]?|(?:Bearer|Basic)\\s+(?:\\[REDACTED\\]|${UF})|${UF}`,kpe=["sk","ant","api"].join("-"),po="[\\w=-]{20,}(?:\\.[0-9a-z]{9})?",HF=[{id:"url-userinfo",source:":\\/\\/([^/@\\s]+)@",confidence:"low"},{id:"gcp-service-account",source:"\\b([a-z0-9-]+@[a-z0-9-]+\\.iam\\.gserviceaccount\\.com)\\b",flags:"i",confidence:"low"},{id:"loose-anthropic-key",source:"\\b(sk-ant-?[\\w-]{10,})",confidence:"low"},{id:"http-auth-scheme",source:"\\b(?:Bearer|Basic)\\s+([A-Za-z0-9+/=._~-]{20,})",flags:"i",confidence:"low"},{id:"loose-jwt",source:"\\b(eyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,})",confidence:"low"},{id:"sensitive-assign",source:`(?:${Cpe.source})[\\w.-]*["']?\\s*[=:]\\s*(${FF})`,flags:"i",confidence:"low"},{id:"cloud-env-var",source:`\\b(?:AWS|GOOGLE|GCP|GCLOUD|AZURE)_\\w+\\s*[=:]\\s*(${FF})`,flags:"i",confidence:"low"},{id:"aws-access-token",source:"\\b((?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16})\\b",confidence:"high"},{id:"gcp-api-key",source:"\\b(AIza[\\w-]{35})(?![\\w-])",confidence:"high"},{id:"google-oauth-client-secret",source:"\\bGOCSPX-[\\w-]{28}(?![\\w-])",confidence:"high"},{id:"azure-ad-client-secret",source:`(?:^|[\\\\'"\\x60\\s>=:(,)])([a-zA-Z0-9_~.]{3}\\dQ~[a-zA-Z0-9_~.-]{31,34})(?:$|[\\\\'"\\x60\\s<),])`,confidence:"high"},{id:"digitalocean-pat",source:`\\b(dop_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"digitalocean-access-token",source:`\\b(doo_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-api-key",source:`\\b(${kpe}03-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-admin-api-key",source:`\\b(sk-ant-admin01-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-oauth-token",source:`\\b(sk-ant-(?:oat|ort)\\d{2}-[\\w-]{20,})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"openai-api-key",source:"sk-[A-Za-z0-9_-]{8,200}T3BlbkFJ[A-Za-z0-9_-]{8,200}",confidence:"high"},{id:"openai-legacy-api-key",source:"\\bsk-[a-zA-Z0-9]{48}(?![a-zA-Z0-9])",confidence:"high"},{id:"huggingface-access-token",source:`\\b(hf_[a-zA-Z]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"supabase-secret-key",source:"\\bsb_secret_[A-Za-z0-9_-]{20,}",confidence:"high"},{id:"supabase-access-token",source:"\\bsbp_[a-z0-9]{40,}",confidence:"high"},{id:"github-pat",source:"ghp_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-fine-grained-pat",source:"github_pat_\\w{82}",confidence:"high"},{id:"github-app-token",source:"(?:ghu|ghs)_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-oauth",source:"gho_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-refresh-token",source:"ghr_[0-9a-zA-Z]{36}",confidence:"high"},{id:"gitlab-pat",source:`glpat-${po}`,confidence:"high"},{id:"gitlab-deploy-token",source:`gldt-${po}`,confidence:"high"},{id:"gitlab-runner-authentication-token",source:`glrt-${po}`,confidence:"high"},{id:"gitlab-oauth-app-secret",source:`gloas-${po}`,confidence:"high"},{id:"gitlab-pipeline-trigger-token",source:`glptt-${po}`,confidence:"high"},{id:"gitlab-kubernetes-agent-token",source:`glagent-${po}`,confidence:"high"},{id:"gitlab-incoming-mail-token",source:`glimt-${po}`,confidence:"high"},{id:"gitlab-scim-oauth-token",source:`glsoat-${po}`,confidence:"high"},{id:"gitlab-ci-build-token",source:`glcbt-${po}`,confidence:"high"},{id:"gitlab-feed-token",source:`glft-${po}`,confidence:"high"},{id:"gitlab-feature-flag-client-token",source:`glffct-${po}`,confidence:"high"},{id:"slack-bot-token",source:"xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*",confidence:"high"},{id:"slack-user-token",source:"xox[a-z](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}",confidence:"high"},{id:"slack-rotation-token",source:"xoxe(?:\\.xox[a-z])?-[0-9]-[A-Za-z0-9-]{28,}",confidence:"high"},{id:"slack-app-token",source:"xapp-\\d-[A-Z0-9]+-\\d+-[a-z0-9]+",flags:"i",confidence:"high"},{id:"slack-workflow-token",source:"\\bxwfp-[a-zA-Z0-9-]{20,}",confidence:"high"},{id:"slack-webhook-url",source:"(?:https?://)?hooks\\.slack\\.com/(?:services|workflows|triggers)/[A-Za-z0-9+/_-]{40,}",flags:"i",confidence:"high"},{id:"twilio-api-key",source:"SK[0-9a-fA-F]{32}",confidence:"high"},{id:"sendgrid-api-token",source:`\\b(SG\\.[a-zA-Z0-9=_\\-.]{66})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"npm-access-token",source:`\\b(npm_[a-zA-Z0-9]{36})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"pypi-upload-token",source:"pypi-AgEIcHlwaS5vcmc[\\w-]{50,1000}",confidence:"high"},{id:"databricks-api-token",source:`\\b(dapi[a-f0-9]{32}(?:-\\d)?)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"hashicorp-tf-api-token",source:"[a-zA-Z0-9]{14}\\.atlasv1\\.[a-zA-Z0-9\\-_=]{60,70}",confidence:"high"},{id:"pulumi-api-token",source:`\\b(pul-[a-f0-9]{40})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"postman-api-token",source:`\\b(PMAK-[a-fA-F0-9]{24}-[a-fA-F0-9]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-api-key",source:`\\b(eyJrIjoi[A-Za-z0-9+/]{70,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-cloud-api-token",source:`\\b(glc_[A-Za-z0-9+/]{32,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-service-account-token",source:`\\b(glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-user-token",source:`\\b(sntryu_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-org-token",source:"\\bsntrys_eyJpYXQiO[a-zA-Z0-9+/]{10,200}(?:LCJyZWdpb25fdXJs|InJlZ2lvbl91cmwi|cmVnaW9uX3VybCI6)[a-zA-Z0-9+/]{10,200}={0,2}_[a-zA-Z0-9+/]{43}",confidence:"high"},{id:"stripe-access-token",source:`\\b((?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"shopify-access-token",source:"shpat_[a-fA-F0-9]{32}",confidence:"high"},{id:"shopify-shared-secret",source:"shpss_[a-fA-F0-9]{32}",confidence:"high"}],Rpe=64;function Gw(e,t){let n=/-----BEGIN[ A-Z0-9_-]{0,100}?PRIVATE KEY(?: BLOCK)?-----/gi,r=/-----END[ A-Z0-9_-]{0,100}?PRIVATE KEY(?: BLOCK)?-----/gi;n.lastIndex=t;let o=n.exec(e);if(!o)return null;r.lastIndex=o.index+o[0].length+Rpe;let s=r.exec(e);if(!s)return null;return{start:o.index,end:s.index+s[0].length}}function Ope(e){return Gw(e,0)!==null}function Ppe(e){let t=Gw(e,0);if(!t)return e;let n="",r=0;while(t)n+=e.slice(r,t.start)+"[REDACTED]",r=t.end,t=Gw(e,r);return n+e.slice(r)}var jF=`(?:[\\x60'"\\s;]|\\\\[nr]|$)`,$F="(?=[^a-zA-Z0-9_\\-+=]|$)",Ipe="(?<![a-zA-Z0-9_\\-])";function Dpe(){return HF.map((e)=>({id:e.id,confidence:e.confidence,re:new RegExp(e.confidence!=="high"?e.source:Ipe+(e.source.endsWith(jF)?e.source.slice(0,-jF.length)+$F:e.source+$F),(e.flags??"").replace("g","")+"g")}))}function zF(e){return HF.map((t)=>({id:t.id,confidence:t.confidence,re:new RegExp(t.source,e?(t.flags??"").replace("g","")+"g":t.flags??"")}))}function BF(e,t){if(typeof t!=="string")return"[REDACTED]";let n=t.length>=2&&(t[0]==='"'||t[0]==="'")&&t.at(-1)===t[0]?t[0]:"",r=e.lastIndexOf(t);return`${e.slice(0,r)}${n}[REDACTED]${n}${e.slice(r+t.length)}`}var Lpe=512,Mpe=512;class KF{testRules=null;redactRules=null;displayRules=null;resultCache=new Map;scan(e){this.testRules??=zF(!1);let t=[];for(let n of this.testRules)if(n.confidence==="high"&&n.re.test(e))t.push({ruleId:n.id,label:n.id.split("-").map((r)=>$pe[r]??gd(r)).join(" ")});if(Ope(e))t.push({ruleId:"private-key",label:"Private Key"});return t}redact(e){let t=e.length<=Lpe;if(t){let r=this.resultCache.get(e);if(r!==void 0)return r}this.redactRules??=zF(!0);let n=Ppe(e);for(let r of this.redactRules)n=n.replace(r.re,BF);if(t){if(this.resultCache.size>=Mpe)this.resultCache.delete(this.resultCache.keys().next().value);this.resultCache.set(e,n)}return n}redactForDisplay(e){this.displayRules??=Dpe();let t=e;for(let n of this.displayRules){if(n.confidence!=="high")continue;t=t.replace(n.re,jpe)}return t}}var Npe=new KF;function GF(e){return Npe.redact(e)}var Upe=/[$\x60|;&<>()\s]/,Fpe=/[/.@:~*?\\]/;function jpe(e,t){let n=typeof t==="string"?t:e;if(Upe.test(n)||Fpe.test(n))return e;return BF(e,t)}var $pe={aws:"AWS",gcp:"GCP",api:"API",pat:"PAT",ad:"AD",tf:"TF",oauth:"OAuth",npm:"NPM",pypi:"PyPI",jwt:"JWT",ci:"CI",scim:"SCIM",github:"GitHub",gitlab:"GitLab",openai:"OpenAI",digitalocean:"DigitalOcean",huggingface:"HuggingFace",hashicorp:"HashiCorp",sendgrid:"SendGrid"};var Zw={verbose:0,debug:1,info:2,warn:3,error:4},Kpe=10485760;function Gpe(e){return Object.hasOwn(Zw,e)}function VF(e){return DD(e)?null:JF(e)}function ZF(){}var Wpe={sessionId:"",fromBackend:!1};function YF(e,t,n,r){let o=mi(t,"debug"),s=mi(o,`${e.sessionId}.txt`),i;if(n===null)i=s;else if(r!==null&&n===r)i=mi(r,`${e.sessionId}.txt`);else i=n;let a=!e.fromBackend&&i===s?"v5":"raw";return{target:i,arm:a,configHome:t,rotate:a==="raw"&&!(Ul(i)===o&&i.endsWith(".txt"))}}function Vw(e){return kF.userNamed(Bpe(e)?e:JF(e))}function qpe(e){return e.code==="Failed"&&e.telemetryCode==="ENOENT"}function Vpe(e,t=RF){return t?e:void 0}async function Zpe(e,t,n){let r={namespace:"log",sessionId:t,channel:"debug"};return(await Hw.run(!0,()=>e.append(r,[{data:n}]))).ok}class XF{deps;minLevel;filter;toStderr;filePath;runtimeDebugEnabled=!1;hasFormattedOutput=!1;debugFromLaunch;storageV5;writer=null;redirect=null;pendingWrite=Promise.resolve();unflushedChunks=[];backendLinesLogged=0;exiting=!1;exitHandlerRegistered=!1;successor=null;writtenBytes=-1;rotating=!1;resolvedLogPath=null;overrideDirectory=null;rotationTarget=null;latestSymlinkUpdated=!1;constructor(e){this.deps=e;if(this.storageV5=Vpe(e.storageV5),e.launchIdentity!==void 0){this.minLevel=e.launchIdentity.minLevel,this.filter=e.launchIdentity.filter,this.toStderr=e.launchIdentity.toStderr,this.filePath=e.launchIdentity.filePath,this.debugFromLaunch=e.launchIdentity.debugFromLaunch;return}let t=Array.isArray(e.argv)?e.argv:[],n=t.indexOf("--"),r=n===-1?t:t.slice(0,n),o=e.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();this.minLevel=o&&Gpe(o)?o:"debug";let s=r.find((a)=>a.startsWith("--debug="));this.filter=s?LF(s.substring(8)):null,this.toStderr=r.includes("--debug-to-stderr")||r.includes("-d2e");let i=null;for(let a=0;a<r.length;a++){let c=r[a];if(c.startsWith("--debug-file=")){i=VF(c.substring(13));break}if(c==="--debug-file"&&a+1<r.length){i=VF(r[a+1]);break}}this.filePath=i,this.debugFromLaunch=Ie(e.env.DEBUG)||Ie(e.env.DEBUG_SDK)||r.includes("--debug")||r.includes("-d")||this.toStderr||s!==void 0||this.filePath!==null}isDebugMode(){return this.runtimeDebugEnabled||this.debugFromLaunch}launchIdentity(){return{minLevel:this.minLevel,filter:this.filter,toStderr:this.toStderr,filePath:this.filePath,debugFromLaunch:this.debugFromLaunch,isAnt:this.deps.isAnt,isTestEnvironment:this.deps.isTestEnvironment}}enableDebugLogging(){let e=this.isDebugMode()||this.deps.isAnt;return this.runtimeDebugEnabled=!0,e}logPath(){return this.filePath??(this.overrideDirectory!==null&&this.overrideDirectory===this.deps.env.CLAUDE_CODE_DEBUG_LOGS_DIR?mi(this.overrideDirectory,`${this.deps.sessionId()}.txt`):null)??this.resolvedLogPath??this.deps.env.CLAUDE_CODE_DEBUG_LOGS_DIR??this.defaultLogPath()}defaultLogPath(e=this.deps.sessionId()){return mi(this.deps.configHomeDir(),"debug",`${e}.txt`)}learnedOverrideDirectory(){return this.overrideDirectory}isArmed(){return this.storageV5!==void 0}log(e,{level:t}={level:"debug"}){if(Zw[t]<Zw[this.minLevel])return;if(!this.shouldLog(e))return;if(this.hasFormattedOutput&&e.includes(`
95
- `))e=me(e);let r=`${new Date().toISOString()} [${t.toUpperCase()}] ${GF(e.trim())}
96
- `;if(this.toStderr){this.deps.writeToStderr(r);return}this.write(r)}write(e){let t=this.getWriter(),n=Wpe;if(this.storageV5!==void 0){if(n={sessionId:this.deps.sessionId(),fromBackend:Hw.getStore()===!0},n.fromBackend)this.backendLinesLogged++}if(t.write({origin:n,content:e}),this.exiting)t.flush()}async flush(){let e=this.backendLinesLogged;if(this.writer?.flush(),await this.pendingWrite,this.storageV5!==void 0&&this.successor)return this.successor.flush();for(let t=0;this.backendLinesLogged!==e&&t<3;t++)e=this.backendLinesLogged,this.writer?.flush(),await this.pendingWrite}dispose(e){this.redirect=e;try{this.writer?.dispose()}finally{this.redirect=null,this.writer=null}}succeed(e){this.runtimeDebugEnabled=e.runtimeDebugEnabled,this.hasFormattedOutput=e.hasFormattedOutput,this.pendingWrite=e.pendingWrite,this.unflushedChunks=e.unflushedChunks,this.exitHandlerRegistered=e.exitHandlerRegistered,e.successor=this,e.dispose((t)=>{this.write(t)})}handleExit(){if(this.successor){this.successor.handleExit();return}this.exiting=!0,this.writer?.flush(),this.drainSync()}async maybeRotate(e,t,n=Kpe){let r=Te()&&this.storageV5!==void 0?this.storageV5.hostFiles:void 0;if(this.writtenBytes<0)if(r){let o=await r.stat(Vw(e));this.writtenBytes=o.ok&&o.value.kind!=="absent"?o.value.size:0}else this.writtenBytes=await zpe(e).then((o)=>o.size).catch(()=>0);else this.writtenBytes+=t;if(this.writtenBytes<=n||this.rotating)return;this.rotating=!0;try{let o=e.endsWith(".txt")?`${e.slice(0,-4)}.1.txt`:`${e}.1`;if(r){let s=Vw(e),i=Vw(o),a=await r.rename(s,i);if(!a.ok&&!qpe(a.error)){if(await r.delete(i,{missingOk:!0}),!(await r.rename(s,i)).ok)await r.delete(s,{missingOk:!0})}}else try{await qF(e,o)}catch(s){if(!br(s))await qw(o).catch(()=>{}),await qF(e,o).catch(()=>qw(e).catch(()=>{}))}this.writtenBytes=0}finally{this.rotating=!1}}shouldLog(e){if(this.deps.isTestEnvironment&&!this.toStderr&&this.filePath===null)return!1;if(!this.deps.isAnt&&!this.isDebugMode())return!1;if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;return MF(e,this.filter)}resolveDirToFile(e){return this.resolvedLogPath=mi(e,`${this.deps.sessionId()}.txt`),this.resolvedLogPath}async appendGroup(e,t,n,r){if(this.storageV5!==void 0&&e.arm==="v5"){await this.appendV5AndMark(this.storageV5,t,n);return}if(r)await WF(Ul(e.target),{recursive:!0}).catch(()=>{});let o=e;try{await Ww(e.target,n)}catch(s){if(!Dv(s))throw s;if(this.storageV5===void 0)o={...e,target:this.resolveDirToFile(e.target)},await Ww(o.target,n);else{if(this.overrideDirectory=e.target,o=YF(t,e.configHome,e.target,e.target),o.arm==="v5"){await this.appendV5AndMark(this.storageV5,t,n);return}await WF(Ul(o.target),{recursive:!0}).catch(()=>{});try{await Ww(o.target,n)}catch{return}}}if(o.rotate){if(this.storageV5!==void 0&&o.target!==this.rotationTarget)this.rotationTarget=o.target,this.writtenBytes=-1;await this.maybeRotate(o.target,Buffer.byteLength(n)).catch(ZF)}this.markLatestSymlink()}async appendV5AndMark(e,t,n){if(await Zpe(e,t.sessionId,n))this.markLatestSymlink()}markLatestSymlink(){if(!this.latestSymlinkUpdated)this.latestSymlinkUpdated=!0,this.updateLatestSymlink()}shiftUnflushedChunk(){this.unflushedChunks.shift()}drainSync(){if(this.unflushedChunks.length===0)return;let e=[];for(let t of this.unflushedChunks.splice(0)){let n=e.at(-1);if(n!==void 0&&n.armed===t.armed&&(!t.armed||n.target===t.target))n.parts.push(t);else e.push({target:t.target,armed:t.armed,parts:[t]})}for(let{target:t,armed:n,parts:r}of e){let o=n?t:this.logPath(),s=r.map((i)=>i.content).join("");try{Qe().mkdirSync(Ul(o))}catch{}try{Qe().appendFileSync(o,s)}catch(i){if(Dv(i))try{if(!n)Qe().appendFileSync(this.resolveDirToFile(o),s);else{let a=(u,p)=>{try{Qe().appendFileSync(mi(o,`${u}.txt`),p)}catch{}},c=r[0]?.sessionId,l="";for(let u of r){if(u.sessionId!==c)a(c,l),c=u.sessionId,l="";l+=u.content}a(c,l)}}catch{}}}}groupLines(e){let t=e[0];if(t===void 0)return[];if(this.storageV5===void 0)return[{decision:{target:this.logPath(),arm:"raw",configHome:"",rotate:!0},origin:t.origin,lines:e}];let n=[];for(let r of e){let o=n.at(-1);if(o!==void 0&&o.origin.sessionId===r.origin.sessionId&&o.origin.fromBackend===r.origin.fromBackend)o.lines.push(r);else n.push({decision:YF(r.origin,this.deps.configHomeDir(),this.filePath??this.deps.env.CLAUDE_CODE_DEBUG_LOGS_DIR??null,this.overrideDirectory),origin:r.origin,lines:[r]})}return n}getWriter(){if(this.writer)return this.writer;let e=null,t=this.storageV5!==void 0;if(this.writer=OF({writeBatch:(n)=>{if(this.redirect){this.redirect(n.map((r)=>r.content).join(""));return}if(this.exiting){for(let r of this.groupLines(n))this.unflushedChunks.push({target:r.decision.target,sessionId:r.origin.sessionId,armed:t,content:r.lines.map((o)=>o.content).join("")});this.drainSync();return}for(let r of this.groupLines(n)){let o=r.lines.map((a)=>a.content).join(""),s=Ul(r.decision.target),i=r.decision.arm==="raw"&&(r.origin.fromBackend||e!==s);if(r.decision.arm==="raw")e=s;this.unflushedChunks.push({target:r.decision.target,sessionId:r.origin.sessionId,armed:t,content:o}),this.pendingWrite=this.pendingWrite.then(this.appendGroup.bind(this,r.decision,r.origin,o,i)).catch(ZF).then(this.shiftUnflushedChunk.bind(this))}},sizeOf:(n)=>n.content.length,flushIntervalMs:1000,maxBufferSize:100,immediateMode:this.isDebugMode()}),this.deps.registerCleanup(async()=>{this.writer?.dispose(),await this.pendingWrite}),!this.exitHandlerRegistered)this.exitHandlerRegistered=!0,this.deps.onExit(this.handleExit.bind(this));return this.writer}async updateLatestSymlink(){try{let e=this.logPath(),t=mi(Ul(e),"latest");await qw(t).catch(()=>{}),await Hpe(e,t)}catch{}}}class QF{instance=void 0;init={};setInstance(e){this.instance=e}setInit(e){this.init=e}}var Ype=new tt(()=>new QF);function Jpe(){return Ype.of(Tt().host)}function Xpe(e,t){return new XF({argv:process.argv,env:process.env,sessionId:()=>kw(),configHomeDir:()=>Gt(),onExit:(n)=>{process.on("exit",n)},registerCleanup:(n)=>{i_(n)},writeToStderr:(n)=>{NF(n)},isAnt:t?.isAnt??!1,isTestEnvironment:t?.isTestEnvironment??!1,launchIdentity:t,storageV5:e.init.storageV5!==void 0&&e.init.configHome===Gt()?e.init.storageV5:void 0})}function Qpe(){let e=Jpe(),t=e.instance;if(t)return t;let n=Xpe(e);return e.setInstance(n),n}function de(e,t={level:"debug"}){Qpe().log(e,t)}var l_t=(()=>{let e=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(e!==void 0){let t=Number(e);if(!Number.isNaN(t)&&t>=0)return t}return 1/0})();var efe={[Symbol.dispose](){}};function tfe(){return efe}var Qt=tfe;function me(e,t,n){let o=[];try{const r=Ft(o,Qt`JSON.stringify(${e})`,0);return JSON.stringify(e,t,n)}catch(s){var i=s,a=1}finally{jt(o,i,a)}}var yt=(e,t)=>{let r=[];try{const n=Ft(r,Qt`JSON.parse(${e})`,0);return typeof t>"u"?JSON.parse(e):JSON.parse(e,t)}catch(o){var s=o,i=1}finally{jt(r,s,i)}};function ej(e){return JSON.parse(e)}function fo(e,t){let r=[];try{const n=Ft(r,Qt`structuredClone(${e})`,0);return structuredClone(e,t)}catch(o){var s=o,i=1}finally{jt(r,s,i)}}var _fe="→",Yw=process.platform==="win32"?/[\\/]+/:/\/+/;function Qw(e){let t="";for(let r of e.split(/([\\/]+)/)){if(r==="."||r==="..")break;t+=r}let n=t.replace(/(?<=[^\\/])[\\/]+$/,"");return n===""?e:n}function yfe(e){let t=sn.join(e).replace(/(?<=[^\\/])[\\/]+$/,"");if(as(t)&&!qi(t))return t;return Qw(e)}function bfe(e){if(e.startsWith("\\\\"))return Qw(e);let t=e.replace(/^\/+/,"/"),n=hh(t);if(n!==null)return n;return Qw(e)}var Sfe=process.platform==="win32"?yfe:bfe;function rj(e,t,n){let r=hd(e);if(t.length===0||r||t.some((o)=>o==="."||o==="..")){if(n!==void 0&&(t.length>0||r))n(sn.join(e,...t));return r?Sfe(e):e}return sn.join(e,...t)}var ij="\x00unverified-ancestry";function oj(e,t){if(t?.unreadableAncestry!=="unverified")return;let n=e!==void 0&&typeof e==="object"&&"errno"in e?e.errno:void 0;return n==="ENOENT"||n==="ENOTDIR"?void 0:ij}function Jw(e){return ID(e)&&!js(e)}function Xw(e,t){return t===void 0||t.every((n)=>PD(e,n))}function sj(e,t){return t===void 0||t.every((n)=>OD(e,n))}function Efe(e){if(e?.anchors!==void 0&&e.anchors.length>0)return e.anchors;return e?.anchor!==void 0?[e.anchor]:void 0}async function aj(e){return oE(e)||js(e)||await vfe(lj,e)!==void 0}function xfe(e,t,n){return wfe(cj(t,n),(r)=>{if(r.kind==="lstat")return e.lstatSync(r.path);return e.readlinkSync(r.path)})}function vfe(e,t,n){return Afe(cj(t,n),(r)=>r.kind==="lstat"?e.lstat(r.path):e.readlink(r.path))}function wfe(e,t){let n;for(;;){let r=e.next(n);if(r.done)return r.value;try{n=t(r.value)}catch(o){n={errno:Ne(o)}}}}async function Afe(e,t){let n;for(;;){let r=e.next(n);if(r.done)return r.value;try{n=await t(r.value)}catch(o){n={errno:Ne(o)}}}}function*cj(e,t){let n=Efe(t);if(as(e)&&!qi(e)&&sj(e,n)||yc(e)&&Xw(e,n))return;if(Jw(e))return e;let r=sn.resolve(e),o=sn.parse(r).root,s=o,i=r.slice(o.length).split(Yw).filter(Boolean),a=0,c=64;while(i.length>0&&a<c){let l=sn.join(s,i[0]);if(yc(l)&&Xw(l,n)||Jw(l))return rj(l,i.slice(1),t?.onCollapsedLanding);let u=yield{kind:"lstat",path:l};if(u===void 0||typeof u==="string"||"errno"in u)return oj(u,t);if(!u.isSymbolicLink()){i.shift(),s=l;continue}a++;let f=yield{kind:"readlink",path:l};if(typeof f!=="string")return oj(f,t);let m=f;if(!sn.isAbsolute(m)){i.shift(),i=[...m.split(Yw).filter(Boolean),...i];continue}let h=m;if(as(h)&&!qi(h)&&sj(h,n)||yc(h)&&Xw(h,n)||Jw(h))return i.shift(),rj(h,i,t?.onCollapsedLanding);if(t?.surfaceNetworkRaw===!0&&hd(h))return i.shift(),i.length===0?h:h+sn.sep+i.join(sn.sep);i.shift();let y=sn.parse(h).root||sn.sep;s=y,i=[...h.slice(y.length).split(Yw).filter(Boolean),...i]}if(i.length>0&&t?.surfaceNetworkRaw)return ij;return}function tf(e,t){if(as(t)&&!qi(t)||yc(t))return{resolvedPath:t,isSymlink:!1,isCanonical:!1};let n=xfe(e,t);if(n!==void 0)return{resolvedPath:n,isSymlink:!0,isCanonical:!1};try{let r=e.realpathSync(t);return{resolvedPath:r,isSymlink:r!==t,isCanonical:!0}}catch(r){return{resolvedPath:t,isSymlink:!1,isCanonical:!1}}}var lj={cwd(){return process.cwd()},existsSync(e){let n=[];try{const t=Ft(n,Qt`fs.existsSync(${e})`,0);return $e.existsSync(e)}catch(r){var o=r,s=1}finally{jt(n,o,s)}},async stat(e){return mfe(e)},async lstat(e){return ife(e)},async readdir(e){return cfe(e,{withFileTypes:!0})},async unlink(e){return gfe(e)},async rmdir(e){return pfe(e)},async rm(e,t){return ffe(e,t)},async mkdir(e,t){try{await afe(e,{recursive:!0,...t})}catch(n){if(Ne(n)!=="EEXIST")throw n}},async readFile(e,t){return nj(e,{encoding:t.encoding})},async rename(e,t){return dfe(e,t)},async realpath(e){return ct(await ufe(e))},async readlink(e){return lfe(e)},async copyFile(e,t){return ofe(e,t)},async appendFile(e,t,n){if(n?.mode!==void 0)try{let r=await tj(e,"ax",n.mode);try{await r.appendFile(t)}finally{await r.close()}return}catch(r){if(Ne(r)!=="EEXIST")throw r}return nfe(e,t)},async symlink(e,t,n){return hfe(e,t,n)},async link(e,t){return sfe(e,t)},async chmod(e,t){return rfe(e,t)},statSync(e){let n=[];try{const t=Ft(n,Qt`fs.statSync(${e})`,0);return $e.statSync(e)}catch(r){var o=r,s=1}finally{jt(n,o,s)}},lstatSync(e){let n=[];try{const t=Ft(n,Qt`fs.lstatSync(${e})`,0);return $e.lstatSync(e)}catch(r){var o=r,s=1}finally{jt(n,o,s)}},readFileSync(e,t){let r=[];try{const n=Ft(r,Qt`fs.readFileSync(${e})`,0);return $e.readFileSync(e,{encoding:t.encoding})}catch(o){var s=o,i=1}finally{jt(r,s,i)}},readSync(e,t){let o=[];try{const n=Ft(o,Qt`fs.readSync(${e}, ${t.length} bytes)`,0);let r=void 0;try{r=$e.openSync(e,"r");let c=Buffer.alloc(t.length),l=$e.readSync(r,c,0,t.length,0);return{buffer:c,bytesRead:l}}finally{if(r)$e.closeSync(r)}}catch(s){var i=s,a=1}finally{jt(o,i,a)}},appendFileSync(e,t,n){let o=[];try{const r=Ft(o,Qt`fs.appendFileSync(${e}, ${t.length} chars)`,0);if(n?.mode!==void 0)try{let c=$e.openSync(e,"ax",n.mode);try{$e.appendFileSync(c,t)}finally{$e.closeSync(c)}return}catch(c){if(Ne(c)!=="EEXIST")throw c}$e.appendFileSync(e,t)}catch(s){var i=s,a=1}finally{jt(o,i,a)}},unlinkSync(e){let n=[];try{const t=Ft(n,Qt`fs.unlinkSync(${e})`,0);$e.unlinkSync(e)}catch(r){var o=r,s=1}finally{jt(n,o,s)}},renameSync(e,t){let r=[];try{const n=Ft(r,Qt`fs.renameSync(${e} ${_fe} ${t})`,0);$e.renameSync(e,t)}catch(o){var s=o,i=1}finally{jt(r,s,i)}},readlinkSync(e){let n=[];try{const t=Ft(n,Qt`fs.readlinkSync(${e})`,0);return $e.readlinkSync(e)}catch(r){var o=r,s=1}finally{jt(n,o,s)}},realpathSync(e){let n=[];try{const t=Ft(n,Qt`fs.realpathSync(${e})`,0);return ct($e.realpathSync(e))}catch(r){var o=r,s=1}finally{jt(n,o,s)}},mkdirSync(e,t){let o=[];try{const n=Ft(o,Qt`fs.mkdirSync(${e})`,0);let r={recursive:!0};if(t?.mode!==void 0)r.mode=t.mode;try{$e.mkdirSync(e,r)}catch(c){if(Ne(c)!=="EEXIST")throw c}}catch(s){var i=s,a=1}finally{jt(o,i,a)}},readdirSync(e){let n=[];try{const t=Ft(n,Qt`fs.readdirSync(${e})`,0);return $e.readdirSync(e,{withFileTypes:!0})}catch(r){var o=r,s=1}finally{jt(n,o,s)}},rmSync(e,t){let r=[];try{const n=Ft(r,Qt`fs.rmSync(${e})`,0);$e.rmSync(e,t)}catch(o){var s=o,i=1}finally{jt(r,s,i)}},createWriteStream(e){return $e.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return nj(e);let n=await tj(e,"r");try{let{size:r}=await n.stat(),o=Math.min(r,t),s=Buffer.allocUnsafe(o),i=0;while(i<o){let{bytesRead:a}=await n.read(s,i,o-i,i);if(a===0)break;i+=a}return i<o?s.subarray(0,i):s}finally{await n.close()}}};function Qe(){return lj}import{readdir as cyt,readFile as gj}from"fs/promises";import{release as Lfe}from"os";var Tfe="finished",E_t=`" ${Tfe}`;var Cfe="channel",x_t=`<${Cfe} source="`;import kt from"node:path";import uj from"node:os";import eA from"node:process";var hi=uj.homedir(),tA=uj.tmpdir(),{env:Fl}=eA,kfe=(e)=>{let t=kt.join(hi,"Library");return{data:kt.join(t,"Application Support",e),config:kt.join(t,"Preferences",e),cache:kt.join(t,"Caches",e),log:kt.join(t,"Logs",e),temp:kt.join(tA,e)}},Rfe=(e)=>{let t=Fl.APPDATA||kt.join(hi,"AppData","Roaming"),n=Fl.LOCALAPPDATA||kt.join(hi,"AppData","Local");return{data:kt.join(n,e,"Data"),config:kt.join(t,e,"Config"),cache:kt.join(n,e,"Cache"),log:kt.join(n,e,"Log"),temp:kt.join(tA,e)}},Ofe=(e)=>{let t=kt.basename(hi);return{data:kt.join(Fl.XDG_DATA_HOME||kt.join(hi,".local","share"),e),config:kt.join(Fl.XDG_CONFIG_HOME||kt.join(hi,".config"),e),cache:kt.join(Fl.XDG_CACHE_HOME||kt.join(hi,".cache"),e),log:kt.join(Fl.XDG_STATE_HOME||kt.join(hi,".local","state"),e),temp:kt.join(tA,t,e)}};function nA(e,{suffix:t="nodejs"}={}){if(typeof e!=="string")throw TypeError(`Expected a string, got ${typeof e}`);if(t)e+=`-${t}`;if(eA.platform==="darwin")return kfe(e);if(eA.platform==="win32")return Rfe(e);return Ofe(e)}function rA(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t}var L_t=nA("claude-cli");function Ife(){if(process.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC)return"essential-traffic";if(process.env.DISABLE_TELEMETRY)return"no-telemetry";if(Ie(process.env.DO_NOT_TRACK))return"no-telemetry";return"default"}function dj(){return Ife()==="essential-traffic"}var Dfe=100;class fj{recentErrors=[];queue=[];sink=null;hardFailMode=void 0;remember(e){if(this.recentErrors.length>=Dfe)this.recentErrors.shift();this.recentErrors.push(e)}dispatch(e){if(this.sink===null){this.queue.push(e);return}switch(e.type){case"error":this.sink.logError(e.error);break;case"mcpError":this.sink.logMCPError(e.serverName,e.error);break;case"mcpDebug":this.sink.logMCPDebug(e.serverName,e.message);break}}attachSink(e){if(this.sink!==null)return;this.sink=e;let t=this.queue;this.queue=[];for(let n of t)this.dispatch(n)}isHardFailMode(){return this.hardFailMode??=process.argv.includes("--hard-fail"),this.hardFailMode}reset(){this.recentErrors=[],this.queue=[],this.sink=null,this.hardFailMode=void 0}}var pj=new fj;function a_(e){let t=Ur(e);try{if(Ie(process.env.CLAUDE_CODE_USE_BEDROCK)||Ie(process.env.CLAUDE_CODE_USE_VERTEX)||Ie(process.env.CLAUDE_CODE_USE_FOUNDRY)||Ie(process.env.CLAUDE_CODE_USE_ANTHROPIC_AWS)||Ie(process.env.CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD)||Ie(process.env.CLAUDE_CODE_USE_MANTLE)||process.env.DISABLE_ERROR_REPORTING||dj())return;let r={error:t.stack||t.message,timestamp:new Date().toISOString()};pj.remember(r),pj.dispatch({type:"error",error:t})}catch{}}function mj(){try{return Qe().readFileSync("/proc/version",{encoding:"utf8"}).toLowerCase()}catch{return}}function hj(e){return e.includes("microsoft")||e.includes("wsl")}class _j{sources;primedProcVersion;fallbackProcVersion;fallbackProcVersionRead=!1;platform;wslVersion=null;macOSMajorVersion=null;linuxDistroInfo;constructor(e){this.sources=e}kernelString(){if(this.primedProcVersion!==void 0)return this.primedProcVersion;if(!this.fallbackProcVersionRead)this.fallbackProcVersion=this.sources.readProcVersionSync(),this.fallbackProcVersionRead=!0;return this.fallbackProcVersion}getPlatform(){if(this.platform!==void 0)return this.platform;try{if(this.sources.platform==="darwin")this.platform="macos";else if(this.sources.platform==="win32")this.platform="windows";else if(this.sources.platform==="linux")if(this.sources.env.WSL_DISTRO_NAME||this.sources.env.WSL_INTEROP)this.platform="wsl";else{let e=this.kernelString();this.platform=e!==void 0&&hj(e)?"wsl":"linux"}else this.platform="unknown"}catch(e){a_(e),this.platform="unknown"}return this.platform}getWslVersion(){if(this.wslVersion!==null)return this.wslVersion;if(this.sources.platform!=="linux"){this.wslVersion=void 0;return}let e=this.kernelString();if(e===void 0){this.wslVersion=void 0;return}let t=e.match(/wsl(\d+)/);if(t&&t[1])this.wslVersion=t[1];else if(e.includes("microsoft"))this.wslVersion="1";else this.wslVersion=void 0;return this.wslVersion}getMacOSMajorVersion(){if(this.macOSMajorVersion!==null)return this.macOSMajorVersion;if(this.sources.platform!=="darwin"){this.macOSMajorVersion=void 0;return}let e=this.sources.osRelease().match(/^(\d+)\./);return this.macOSMajorVersion=e&&e[1]?parseInt(e[1],10)-9:void 0,this.macOSMajorVersion}getLinuxDistroInfo(){return this.linuxDistroInfo??=this.readLinuxDistroInfo()}async readLinuxDistroInfo(){if(this.sources.platform!=="linux")return;let e={linuxKernel:this.sources.osRelease()};try{let t=await this.sources.readOsRelease();for(let n of t.split(`
97
- `)){let r=n.match(/^(ID|VERSION_ID)=(.*)$/);if(r&&r[1]&&r[2]){let o=r[2].replace(/^"|"$/g,"");if(r[1]==="ID")e.linuxDistroId=o;else e.linuxDistroVersion=o}}}catch{}return e}async prime(){if(this.primedProcVersion!==void 0||this.sources.platform!=="linux")return;try{let e=await this.sources.readProcVersion();this.primedProcVersion=e.toLowerCase()}catch(e){de(`Failed to read /proc/version for WSL detection: ${e}`,{level:"error"});return}this.platform=void 0,this.wslVersion=null}}var Mfe;function Nfe(){return Mfe??=new _j({platform:process.platform,env:process.env,readProcVersionSync:mj,readProcVersion:()=>gj("/proc/version",{encoding:"utf8"}),osRelease:Lfe,readOsRelease:()=>gj("/etc/os-release","utf8")})}function jr(){return Nfe().getPlatform()}import{isAbsolute as Ufe}from"path";function Ffe(e){let t=process.cwd();return e.filter((n)=>!gh(n,t))}function yj(e){let t=Bun.which(e);if(!t||process.platform!=="win32")return t;if(Ufe(e))return t;return Ffe([t])[0]??null}var bj=async(e)=>yj(e),Sj=yj;function Ej(){if(process.platform!=="linux")return!1;return Qe().existsSync("/proc/sys/fs/binfmt_misc/WSLInterop")}function xj(){if(process.platform!=="linux")return;try{return Qe().readFileSync("/sys/hypervisor/uuid",{encoding:"utf8"}).trim().toLowerCase()}catch{return}}function vj(){if(process.platform!=="linux")return!1;return Qe().existsSync("/.dockerenv")}function vSe(){if(Qe().existsSync(Df(Gt(),".config.json")))return Df(Gt(),".config.json");return wSe()}function wSe(){let e=`.claude${AF()}.json`;return Df(process.env.CLAUDE_CONFIG_DIR||ESe(),e)}async function ASe(){try{let{externalHttp:e}=await Promise.resolve().then(() => (XB(),JB));return await e.head("http://1.1.1.1",{signal:AbortSignal.timeout(1000)}),!0}catch{return!1}}async function TSe(){return null}async function cu(e){try{return!!await bj(e)}catch{return!1}}async function CSe(){let e=[];if(await cu("npm"))e.push("npm");if(await cu("yarn"))e.push("yarn");if(await cu("pnpm"))e.push("pnpm");return e}async function kSe(){let e=[];if(await cu("bun"))e.push("bun");if(await cu("deno"))e.push("deno");if(await cu("node"))e.push("node");return e}var QB=["git","node","npm","npx","yarn","pnpm","bun","deno","tsc","python","python3","py","pip","uv","poetry","ruby","gem","bundle","rake","dotnet","msbuild","nuget","cl","nmake","cmake","ninja","make","gcc","g++","clang","cargo","rustc","go","java","javac","mvn","gradle","docker"],RSe=1000;async function OSe(e){try{return/appinstaller/i.test(await SSe(e))}catch{return!1}}async function PSe(e,t){let n=jr()==="windows",r=new Set(e),o=n?(process.env.PATHEXT??".COM;.EXE;.BAT;.CMD").toLowerCase().split(";").filter(Boolean):[],s=Ss((process.env.PATH??"").split(xSe).map((i)=>i.replace(/^"|"$/g,"")).filter(Boolean));await Promise.all(s.map(async(i)=>{let a;try{a=await ySe(i,{withFileTypes:!0})}catch{return}let c=n&&/[\\/]microsoft[\\/]windowsapps[\\/]?$/i.test(i);for(let l of a){if(l.isDirectory())continue;let u=l.name;if(n){let p=u.toLowerCase(),f=p.lastIndexOf(".");if(f<=0||!o.includes(p.slice(f)))continue;u=p.slice(0,f)}if(!r.has(u)||t.has(u))continue;if(n){if(c&&await OSe(Df(i,l.name)))continue}else try{await MT(Df(i,l.name),_Se.X_OK)}catch{continue}t.add(u)}}))}async function ISe(){let e=new Set;try{await Or(PSe(QB,e),RSe,"build tool PATH scan timed out")}catch{}return QB.filter((t)=>e.has(t))}function DSe(e){try{if(!e.isWslEnvironment())return!1;let t=Sj("npm");if(t===null)return!1;return t.startsWith("/mnt/c/")}catch(t){return!1}}function LSe(){return process.env.__CFBundleIdentifier==="com.conductor.app"}var e2=["pycharm","intellij","webstorm","phpstorm","rubymine","clion","goland","rider","datagrip","appcode","dataspell","aqua","gateway","fleet","jetbrains","androidstudio"];function MSe(e){let t=e.toLowerCase();return t.includes("windsurf")||t.includes("devin.app")||t.includes("devin desktop")||t.includes("devin-desktop")||/appdata[\\/]local[\\/](programs[\\/])?devin[\\/]/.test(t)}function NSe(){if(process.env.CURSOR_TRACE_ID)return"cursor";let e=process.env.VSCODE_GIT_ASKPASS_MAIN?.toLowerCase()??"";if(e.includes("cursor"))return"cursor";if(MSe(e))return"windsurf";if(e.includes("antigravity"))return"antigravity";let t=process.env.__CFBundleIdentifier?.toLowerCase();if(t?.includes("vscodium"))return"codium";if(t?.includes("windsurf")||t?.includes("devin"))return"windsurf";if(t?.includes("com.google.android.studio"))return"androidstudio";if(t){for(let n of e2)if(t.includes(n))return n}if(process.env.VisualStudioVersion)return"visualstudio";if(process.env.TERMINAL_EMULATOR==="JetBrains-JediTerm")return"pycharm";if(process.env.TERM==="xterm-ghostty")return"ghostty";if(process.env.TERM?.includes("kitty"))return"kitty";if(process.env.TERM_PROGRAM){if(/^devin([ -]desktop)?$/i.test(process.env.TERM_PROGRAM))return"windsurf";return process.env.TERM_PROGRAM}if(process.env.TMUX)return"tmux";if(process.env.STY)return"screen";if(process.env.KONSOLE_VERSION)return"konsole";if(process.env.GNOME_TERMINAL_SERVICE)return"gnome-terminal";if(process.env.XTERM_VERSION)return"xterm";if(process.env.VTE_VERSION)return"vte-based";if(process.env.TERMINATOR_UUID)return"terminator";if(process.env.KITTY_WINDOW_ID)return"kitty";if(process.env.ALACRITTY_LOG)return"alacritty";if(process.env.TILIX_ID)return"tilix";if(process.env.WT_SESSION)return"windows-terminal";if(process.env.SESSIONNAME&&process.env.TERM==="cygwin")return"cygwin";if(process.env.MSYSTEM)return process.env.MSYSTEM.toLowerCase();if(process.env.ConEmuANSI||process.env.ConEmuPID||process.env.ConEmuTask)return"conemu";if(process.env.WSL_DISTRO_NAME)return`wsl-${process.env.WSL_DISTRO_NAME}`;if(r2())return"ssh-session";if(process.env.TERM){let n=process.env.TERM;if(n.includes("alacritty"))return"alacritty";if(n.includes("rxvt"))return"rxvt";if(n.includes("termite"))return"termite";return process.env.TERM}if(!process.stdout.isTTY)return"non-interactive";return null}class t2{sources;globalClaudeFile;internetAccess;internetProbeOutcome;packageManagers;runtimes;detectedBuildTools;wslEnvironment;npmFromWindowsPath;deploymentEnvironment;primedWslInteropExists;primedHypervisorUuid;primedDockerenvExists;fallbackWslInteropExists;fallbackHypervisorUuid;fallbackDockerenvExists;constructor(e){this.sources=e}getGlobalClaudeFile(){return this.globalClaudeFile??=vSe()}seedGlobalClaudeFile(e){if(this.globalClaudeFile===void 0)return this.globalClaudeFile=e,"seeded";return this.globalClaudeFile===e?"unchanged":"conflict"}hasInternetAccess(){return this.internetAccess??=ASe().then((e)=>(this.internetProbeOutcome=e,e))}getInternetProbeOutcome(){return this.internetProbeOutcome}getPackageManagers(){return this.packageManagers??=CSe()}getRuntimes(){return this.runtimes??=kSe()}getDetectedBuildTools(){return this.detectedBuildTools??=ISe()}isWslEnvironment(){return this.wslEnvironment??=this.primedWslInteropExists??(process.platform==="linux"?this.fallbackWslInteropExists??=this.sources.wslInteropExistsSync():!1)}isNpmFromWindowsPath(){return this.npmFromWindowsPath??=DSe(this)}hypervisorUuid(){return this.primedHypervisorUuid??(this.fallbackHypervisorUuid??=this.sources.readHypervisorUuidSync()??"")}isDockerenvPresent(){return this.primedDockerenvExists??(this.fallbackDockerenvExists??=this.sources.dockerenvExistsSync())}detectDeploymentEnvironment(){return this.deploymentEnvironment??=FSe(this)}async prime(){if(this.primedWslInteropExists!==void 0||process.platform!=="linux")return;let[e,t,n]=await Promise.all([MT("/proc/sys/fs/binfmt_misc/WSLInterop").then(()=>!0,()=>!1),bSe("/sys/hypervisor/uuid",{encoding:"utf8"}).then((r)=>r.trim().toLowerCase(),()=>{return}),MT("/.dockerenv").then(()=>!0,()=>!1)]);this.primedWslInteropExists=e,this.primedHypervisorUuid=t??"",this.primedDockerenvExists=n,this.wslEnvironment=void 0,this.npmFromWindowsPath=void 0,this.deploymentEnvironment=void 0}}var USe=new tt(()=>new t2({wslInteropExistsSync:Ej,readHypervisorUuidSync:xj,dockerenvExistsSync:vj}));function au(){return USe.of(Tt().host)}function n2(){return au().detectDeploymentEnvironment()}function FSe(e){if(Ie(process.env.CODESPACES))return"codespaces";if(process.env.GITPOD_WORKSPACE_ID)return"gitpod";if(Ie(process.env.CODER)||process.env.CODER_WORKSPACE_NAME)return"coder";if(Ie(process.env.DEVPOD)||process.env.DEVPOD_WORKSPACE_UID)return"devpod";if(process.env.DAYTONA_WS_ID)return"daytona";if(Ie(process.env.GOOGLE_CLOUD_WORKSTATIONS))return"gcp-cloud-workstations";if(process.env.C9_PID||process.env.C9_USER)return"aws-cloud9";if(process.env.REPL_ID||process.env.REPL_SLUG)return"replit";if(process.env.PROJECT_DOMAIN)return"glitch";if(Ie(process.env.VERCEL))return"vercel";if(process.env.RAILWAY_ENVIRONMENT_NAME||process.env.RAILWAY_SERVICE_NAME)return"railway";if(Ie(process.env.RENDER))return"render";if(Ie(process.env.NETLIFY))return"netlify";if(process.env.DYNO)return"heroku";if(process.env.FLY_APP_NAME||process.env.FLY_MACHINE_ID)return"fly.io";if(Ie(process.env.CF_PAGES))return"cloudflare-pages";if(process.env.DENO_DEPLOYMENT_ID)return"deno-deploy";if(process.env.AWS_LAMBDA_FUNCTION_NAME)return"aws-lambda";if(process.env.AWS_EXECUTION_ENV==="AWS_ECS_FARGATE")return"aws-fargate";if(process.env.AWS_EXECUTION_ENV==="AWS_ECS_EC2")return"aws-ecs";if(e.hypervisorUuid().startsWith("ec2"))return"aws-ec2";if(process.env.K_SERVICE)return"gcp-cloud-run";if(process.env.GOOGLE_CLOUD_PROJECT)return"gcp";if(process.env.WEBSITE_SITE_NAME||process.env.WEBSITE_SKU)return"azure-app-service";if(process.env.AZURE_FUNCTIONS_ENVIRONMENT)return"azure-functions";if(process.env.APP_URL?.includes("ondigitalocean.app"))return"digitalocean-app-platform";if(process.env.SPACE_CREATOR_USER_ID)return"huggingface-spaces";if(Ie(process.env.GITHUB_ACTIONS))return"github-actions";if(Ie(process.env.GITLAB_CI))return"gitlab-ci";if(process.env.CIRCLECI)return"circleci";if(process.env.BUILDKITE)return"buildkite";if(Ie(!1))return"ci";if(process.env.KUBERNETES_SERVICE_HOST)return"kubernetes";if(e.isDockerenvPresent())return"docker";if(If.platform==="darwin")return"unknown-darwin";if(If.platform==="linux")return"unknown-linux";if(If.platform==="win32")return"unknown-win32";return"unknown"}function r2(){return!!(process.env.SSH_CONNECTION||process.env.SSH_CLIENT||process.env.SSH_TTY)}var If={hasInternetAccess(){return au().hasInternetAccess()},probeInternalNetworkAccess:TSe,isCI:Ie(!1),platform:["win32","darwin"].includes(process.platform)?process.platform:"linux",arch:process.arch,nodeVersion:process.version,terminal:NSe(),isSSH:r2,getPackageManagers(){return au().getPackageManagers()},getRuntimes(){return au().getRuntimes()},isRunningWithBun:Sc,isWslEnvironment(){return au().isWslEnvironment()},isNpmFromWindowsPath(){return au().isNpmFromWindowsPath()},isConductor:LSe,detectDeploymentEnvironment:n2};var NT={};rn(NT,{CLAUDE_AX_PREPARK_MS:()=>zSe,CLAUDE_AX_SCREEN_READER:()=>jSe,CLAUDE_AX_STARTUP_QUIET_MS:()=>$Se,CLAUDE_CHROME_CLASSIFIER_FLOOR:()=>HSe,CLAUDE_CODE_ACCESSIBILITY:()=>Dxe,CLAUDE_CODE_ACT_DONT_REDERIVE:()=>Lxe,CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT:()=>KSe,CLAUDE_CODE_AMBER_ASTROLABE:()=>cxe,CLAUDE_CODE_ARTIFACT_ASSETS:()=>Jxe,CLAUDE_CODE_ARTIFACT_COMMENTS:()=>Bxe,CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT:()=>Kxe,CLAUDE_CODE_ARTIFACT_COMMENT_FAST_ACK:()=>Wxe,CLAUDE_CODE_ARTIFACT_COMMENT_FAST_ACK_FIXED:()=>qxe,CLAUDE_CODE_ARTIFACT_COMMENT_RESPONDER:()=>Gxe,CLAUDE_CODE_ARTIFACT_DB:()=>Vxe,CLAUDE_CODE_ARTIFACT_DELETE:()=>Zxe,CLAUDE_CODE_ARTIFACT_ROOM:()=>Yxe,CLAUDE_CODE_ARTIFACT_TYPES:()=>Xxe,CLAUDE_CODE_ARTIFACT_TYPE_CATALOG:()=>Qxe,CLAUDE_CODE_ARTIFACT_TYPE_CLOUD_CREATE:()=>eve,CLAUDE_CODE_ARTIFACT_VERIFY:()=>tve,CLAUDE_CODE_AUTO_CONNECT_IDE:()=>nve,CLAUDE_CODE_BASALT_COVE:()=>VSe,CLAUDE_CODE_BASH_OUTPUT_AUDIENCE_NOTE:()=>$xe,CLAUDE_CODE_BASH_SANDBOX_SHOW_INDICATOR:()=>rve,CLAUDE_CODE_BG_TASKS_REPORT_RUNNING:()=>YSe,CLAUDE_CODE_BISON_CAIRN:()=>lxe,CLAUDE_CODE_BREEZY_HORIZON:()=>ZSe,CLAUDE_CODE_BUBBLEWRAP:()=>ove,CLAUDE_CODE_CHILD_SESSION:()=>sve,CLAUDE_CODE_COLD_COMPACT:()=>ive,CLAUDE_CODE_COWORK_FRAME_ARTIFACTS:()=>JSe,CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING:()=>eEe,CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION:()=>XSe,CLAUDE_CODE_DISABLE_ADVISOR_TOOL:()=>tEe,CLAUDE_CODE_DISABLE_AGENT_VIEW:()=>nEe,CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN:()=>rEe,CLAUDE_CODE_DISABLE_ARTIFACT:()=>oEe,CLAUDE_CODE_DISABLE_ATTACHMENTS:()=>sEe,CLAUDE_CODE_DISABLE_AUTO_MEMORY:()=>iEe,CLAUDE_CODE_DISABLE_BACKGROUND_TASKS:()=>aEe,CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_DEFAULT:()=>cEe,CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD:()=>lEe,CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF:()=>uEe,CLAUDE_CODE_DISABLE_BUNDLED_SKILLS:()=>dEe,CLAUDE_CODE_DISABLE_CLAUDE_API_SKILL:()=>pEe,CLAUDE_CODE_DISABLE_CLAUDE_CODE_SKILL:()=>fEe,CLAUDE_CODE_DISABLE_CLAUDE_MDS:()=>mEe,CLAUDE_CODE_DISABLE_CRON:()=>hEe,CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS:()=>gEe,CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS:()=>_Ee,CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY:()=>yEe,CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING:()=>bEe,CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS:()=>SEe,CLAUDE_CODE_DISABLE_LAUNCH_COMPOSER:()=>EEe,CLAUDE_CODE_DISABLE_MEMORY_BULK_INFLATE:()=>xEe,CLAUDE_CODE_DISABLE_MEMORY_MASS_DELETE_HOLD:()=>vEe,CLAUDE_CODE_DISABLE_MEMORY_PERIODIC_RESYNC:()=>wEe,CLAUDE_CODE_DISABLE_MEMORY_RO_UNSAVED_NOTICE:()=>AEe,CLAUDE_CODE_DISABLE_MEMORY_STREAM_LIST:()=>TEe,CLAUDE_CODE_DISABLE_MOUSE:()=>REe,CLAUDE_CODE_DISABLE_MOUSE_CLICKS:()=>OEe,CLAUDE_CODE_DISABLE_NESTED_CHAIN_IDLE:()=>PEe,CLAUDE_CODE_DISABLE_NESTED_USER_REPAIR:()=>IEe,CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC:()=>DEe,CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK:()=>LEe,CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK:()=>MEe,CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL:()=>NEe,CLAUDE_CODE_DISABLE_ORG_MEMORY:()=>UEe,CLAUDE_CODE_DISABLE_PERMISSION_PROMPT_NOTIFY_HOOKS:()=>CEe,CLAUDE_CODE_DISABLE_POLICY_SKILLS:()=>FEe,CLAUDE_CODE_DISABLE_PRECOMPACT_SKIP:()=>jEe,CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK:()=>$Ee,CLAUDE_CODE_DISABLE_TERMINAL_TITLE:()=>BEe,CLAUDE_CODE_DISABLE_THINKING:()=>GEe,CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL:()=>WEe,CLAUDE_CODE_DISABLE_WORKFLOWS:()=>qEe,CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT:()=>ZEe,CLAUDE_CODE_ENABLE_AWAY_SUMMARY:()=>YEe,CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH:()=>JEe,CLAUDE_CODE_ENABLE_CFC:()=>XEe,CLAUDE_CODE_ENABLE_DESIGN_SYNC:()=>QEe,CLAUDE_CODE_ENABLE_EXPERIMENTAL_ADVISOR_TOOL:()=>exe,CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL:()=>txe,CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING:()=>nxe,CLAUDE_CODE_ENABLE_LAUNCH_COMPOSER:()=>rxe,CLAUDE_CODE_ENABLE_MENU_KIND_LANES:()=>oxe,CLAUDE_CODE_ENABLE_NARRATION:()=>_xe,CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION:()=>hxe,CLAUDE_CODE_ENABLE_REFRESH_MCP_TOOLS:()=>gxe,CLAUDE_CODE_ENABLE_REMOTE_RECAP:()=>yxe,CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING:()=>bxe,CLAUDE_CODE_ENABLE_TASKS:()=>Sxe,CLAUDE_CODE_ENABLE_TODO_TOOLS:()=>Exe,CLAUDE_CODE_ENABLE_TOKEN_USAGE_ATTACHMENT:()=>xxe,CLAUDE_CODE_ENABLE_XAA:()=>vxe,CLAUDE_CODE_EVAL_INTERVIEW_SESSION:()=>qve,CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:()=>ave,CLAUDE_CODE_EXPERIMENTAL_OBSERVER_AGENTS:()=>cve,CLAUDE_CODE_FLEETVIEW_SIMPLE:()=>sxe,CLAUDE_CODE_FORCE_MID_CONVERSATION_SYSTEM:()=>hve,CLAUDE_CODE_FORCE_SESSION_PERSISTENCE:()=>fve,CLAUDE_CODE_FORCE_STRIKETHROUGH:()=>mve,CLAUDE_CODE_FORCE_WINDOWS_CREDMAN:()=>gve,CLAUDE_CODE_FORK_SUBAGENT:()=>lve,CLAUDE_CODE_FORWARD_SUBAGENT_TEXT:()=>_ve,CLAUDE_CODE_GAULT_KESTREL:()=>dxe,CLAUDE_CODE_GB_DISK_CACHE_WHEN_TELEMETRY_OFF:()=>ixe,CLAUDE_CODE_GLOB_HIDDEN:()=>uve,CLAUDE_CODE_GLOB_NO_IGNORE:()=>dve,CLAUDE_CODE_GORSE_PLOVER:()=>pxe,CLAUDE_CODE_HARBOR_KITE:()=>wxe,CLAUDE_CODE_HARBOR_KITE_CLOUD:()=>Txe,CLAUDE_CODE_HARBOR_KITE_PACING_OFF:()=>Axe,CLAUDE_CODE_HIDE_CWD:()=>pve,CLAUDE_CODE_HOOKS_SAME_THREAD:()=>oAe,CLAUDE_CODE_HOVER_REST:()=>axe,CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL:()=>yve,CLAUDE_CODE_IDE_SKIP_VALID_CHECK:()=>bve,CLAUDE_CODE_INCLUDE_PARTIAL_MESSAGES:()=>Sve,CLAUDE_CODE_INTRO_FRAME:()=>Mxe,CLAUDE_CODE_JUNIPER_SUNDIAL:()=>mxe,CLAUDE_CODE_KB_COHESION_FIXES:()=>Ixe,CLAUDE_CODE_LANTERN_PRISM:()=>Cxe,CLAUDE_CODE_LARCH_CISTERN:()=>uxe,CLAUDE_CODE_MEMORY_PUSH_DELETE_MODE:()=>kEe,CLAUDE_CODE_NANKEEN_KESTREL:()=>QSe,CLAUDE_CODE_NATIVE_CURSOR:()=>Eve,CLAUDE_CODE_NEW_INIT:()=>xve,CLAUDE_CODE_NO_FLICKER:()=>vve,CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE:()=>wve,CLAUDE_CODE_PARCHMENT_FERN:()=>fxe,CLAUDE_CODE_PEWTER_OWL:()=>owe,CLAUDE_CODE_PEWTER_OWL_TOOL:()=>swe,CLAUDE_CODE_PLAN_MODE_REQUIRED:()=>Ave,CLAUDE_CODE_PLUGIN_BINARY_ASSETS:()=>Qve,CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE:()=>Xve,CLAUDE_CODE_PLUGIN_PREFER_HTTPS:()=>twe,CLAUDE_CODE_PLUGIN_USE_ZIP_CACHE:()=>ewe,CLAUDE_CODE_POLL_EVENTS:()=>Tve,CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY:()=>nwe,CLAUDE_CODE_PRINT_ENGINE_LOOP:()=>Cve,CLAUDE_CODE_PROACTIVE:()=>kve,CLAUDE_CODE_PROMPT_CACHE_TTL:()=>qwe,CLAUDE_CODE_PROPAGATE_TRACEPARENT:()=>rwe,CLAUDE_CODE_REFUSAL_FALLBACK_CATCH_ALL:()=>zEe,CLAUDE_CODE_REPORT_FINDINGS:()=>HEe,CLAUDE_CODE_SABLE_THRUSH:()=>Hxe,CLAUDE_CODE_SEND_FEEDBACK:()=>KEe,CLAUDE_CODE_SILENT_TURN_REMINDER:()=>Uxe,CLAUDE_CODE_SILENT_TURN_REMINDER_TEXT:()=>jxe,CLAUDE_CODE_SILENT_TURN_REMINDER_TURNS:()=>Fxe,CLAUDE_CODE_SKILL_PROPOSALS:()=>Rve,CLAUDE_CODE_SKIP_PLUGIN_MCP_SERVERS:()=>Ove,CLAUDE_CODE_SKIP_PLUGIN_MCP_SERVERS_EXCEPT:()=>Pve,CLAUDE_CODE_SKIP_PROJECT_BACKFILL:()=>Ive,CLAUDE_CODE_SKIP_PROMPT_HISTORY:()=>Dve,CLAUDE_CODE_SKIP_REPO_UPLOAD:()=>Lve,CLAUDE_CODE_SUBAGENT_CACHE_EVICT:()=>Mve,CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL:()=>Vwe,CLAUDE_CODE_SUPPRESS_SESSION_ATTRIBUTION:()=>Nve,CLAUDE_CODE_SYNC_PLUGINS:()=>Fve,CLAUDE_CODE_SYNC_PLUGIN_INSTALL:()=>Uve,CLAUDE_CODE_SYNC_SKILLS:()=>jve,CLAUDE_CODE_TAG_ISMETA_MESSAGES:()=>$ve,CLAUDE_CODE_THINKING_DISPLAY_UPDATES:()=>zxe,CLAUDE_CODE_THISTLE_GREBE:()=>GSe,CLAUDE_CODE_THRIFTY_SONIC:()=>qSe,CLAUDE_CODE_TOASTY_THIMBLE:()=>WSe,CLAUDE_CODE_TODO_REMINDER_MODE:()=>kxe,CLAUDE_CODE_TOTAL_TOKENS_REMINDER:()=>Rxe,CLAUDE_CODE_TOTAL_TOKENS_REMINDER_AFTER_USER_TURN:()=>Pxe,CLAUDE_CODE_TOTAL_TOKENS_REMINDER_BUDGET:()=>Oxe,CLAUDE_CODE_TRANSCRIPT_LOCAL_GC:()=>zve,CLAUDE_CODE_TURN_UPDATES:()=>Nxe,CLAUDE_CODE_TWO_STAGE_CLASSIFIER:()=>Hve,CLAUDE_CODE_USE_COWORK_PLUGINS:()=>Bve,CLAUDE_CODE_USE_NATIVE_FILE_SEARCH:()=>Kve,CLAUDE_CODE_USE_POWERSHELL_TOOL:()=>Gve,CLAUDE_CODE_WALNUT_SPIRE:()=>Wve,CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS:()=>Zve,CLAUDE_CODE_WEBFETCH_USE_CCR_PROXY:()=>Yve,CLAUDE_CODE_WEBSEARCH_USE_CCR_PROXY:()=>Jve,CLAUDE_CODE_WEB_FETCH_AGENT:()=>Vve,CLAUDE_CODE_WORKFLOWS:()=>VEe,CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS:()=>pwe,CLAUDE_CODE_WORKFLOW_SIZE_WARNING_AGENTS:()=>uwe,CLAUDE_CODE_WORKFLOW_SIZE_WARNING_TOKENS:()=>dwe,CLAUDE_DISABLE_ADOPT:()=>iwe,CLAUDE_IMPORT_CONVERSATIONS:()=>awe,CLAUDE_RUNNER_DISABLE_AWAITING_ACTION_OVERRIDE:()=>cwe,CLAUDE_WORKFLOW_NAME_ONLY:()=>lwe,DISABLE_AUTOUPDATER:()=>mwe,DISABLE_AUTO_COMPACT:()=>fwe,DISABLE_BRIEF_MODE_STOP_HOOK:()=>hwe,DISABLE_BUG_COMMAND:()=>gwe,DISABLE_COMPACT:()=>_we,DISABLE_COST_WARNINGS:()=>ywe,DISABLE_DOCTOR_COMMAND:()=>bwe,DISABLE_ERROR_REPORTING:()=>Swe,DISABLE_EXTRA_USAGE_COMMAND:()=>Ewe,DISABLE_FEEDBACK_COMMAND:()=>xwe,DISABLE_GROWTHBOOK:()=>vwe,DISABLE_INSTALLATION_CHECKS:()=>Awe,DISABLE_INSTALL_GITHUB_APP_COMMAND:()=>wwe,DISABLE_INTERLEAVED_THINKING:()=>Twe,DISABLE_LOGIN_COMMAND:()=>Cwe,DISABLE_LOGOUT_COMMAND:()=>kwe,DISABLE_PROMPT_CACHING:()=>Rwe,DISABLE_PROMPT_CACHING_FABLE:()=>Dwe,DISABLE_PROMPT_CACHING_HAIKU:()=>Owe,DISABLE_PROMPT_CACHING_MYTHOS:()=>Lwe,DISABLE_PROMPT_CACHING_OPUS:()=>Pwe,DISABLE_PROMPT_CACHING_SONNET:()=>Iwe,DISABLE_TELEMETRY:()=>Mwe,DISABLE_UPDATES:()=>Nwe,DISABLE_UPGRADE_COMMAND:()=>Uwe,EMBEDDED_SEARCH_TOOLS:()=>nAe,ENABLE_BETA_TRACING_DETAILED:()=>Fwe,ENABLE_CLAUDEAI_MCP_SERVERS:()=>jwe,ENABLE_ENHANCED_TELEMETRY_BETA:()=>$we,ENABLE_LOCKLESS_UPDATES:()=>zwe,ENABLE_LSP_TOOL:()=>Hwe,ENABLE_MCP_LARGE_OUTPUT_FILES:()=>Bwe,ENABLE_PID_BASED_VERSION_LOCKING:()=>Kwe,ENABLE_PROMPT_CACHING_1H:()=>Gwe,ENABLE_PROMPT_CACHING_1H_BEDROCK:()=>Wwe,ENABLE_SESSION_BACKGROUNDING:()=>Zwe,ENABLE_SESSION_PERSISTENCE:()=>Ywe,ENABLE_TOOL_SEARCH:()=>Jwe,FORCE_AUTOUPDATE_PLUGINS:()=>Xwe,FORCE_CODE_TERMINAL:()=>Qwe,FORCE_PROMPT_CACHING_5M:()=>eAe,FORCE_VCR:()=>tAe,INK_SCREEN_READER:()=>BSe,USE_API_CONTEXT_MANAGEMENT:()=>rAe});var jSe=d.triBool(),$Se=d.int({min:0}),zSe=d.int({min:0}),HSe=d.triBool(),BSe=d.bool(),KSe=d.bool(),GSe=d.str(),WSe=d.str(),qSe=d.triBool(),VSe=d.bool(),ZSe=d.str(),YSe=d.bool(),JSe=d.bool(),XSe=d.bool(),QSe=d.bool(),eEe=d.bool(),tEe=d.bool(),nEe=d.bool(),rEe=d.bool(),oEe=d.bool(),sEe=d.bool(),iEe=d.bool(),aEe=d.bool(),cEe=d.bool(),lEe=d.bool(),uEe=d.bool(),dEe=d.bool(),pEe=d.bool(),fEe=d.bool(),mEe=d.bool(),hEe=d.bool(),gEe=d.bool(),_Ee=d.bool(),yEe=d.bool(),bEe=d.bool(),SEe=d.bool(),EEe=d.bool(),xEe=d.bool(),vEe=d.bool(),wEe=d.bool(),AEe=d.bool(),TEe=d.bool(),CEe=d.bool(),kEe=d.enum(["corroborate","immediate","never"]),REe=d.triBool(),OEe=d.triBool(),PEe=d.bool(),IEe=d.bool(),DEe=d.bool(),LEe=d.bool(),MEe=d.bool(),NEe=d.bool(),UEe=d.bool(),FEe=d.bool(),jEe=d.bool(),$Ee=d.bool(),zEe=d.triBool(),HEe=d.bool(),BEe=d.bool(),KEe=d.triBool(),GEe=d.bool(),WEe=d.bool(),qEe=d.bool(),VEe=d.triBool(),ZEe=d.bool(),YEe=d.bool(),JEe=d.bool(),XEe=d.triBool(),QEe=d.bool(),exe=d.bool(),txe=d.bool(),nxe=d.bool(),rxe=d.bool(),oxe=d.bool(),sxe=d.bool(),ixe=d.bool(),axe=d.triBool(),cxe=d.bool(),lxe=d.bool(),uxe=d.bool(),dxe=d.bool(),pxe=d.bool(),fxe=d.bool(),mxe=d.int({min:1,digitsOnly:!0}),hxe=d.triBool(),gxe=d.bool(),_xe=d.triBool(),yxe=d.triBool(),bxe=d.bool(),Sxe=d.triBool(),Exe=d.bool(),xxe=d.bool(),vxe=d.bool(),wxe=d.bool(),Axe=d.bool(),Txe=d.bool(),Cxe=d.bool(),kxe=d.enum(["baseline","off"]),Rxe=d.str(),Oxe=d.int(),Pxe=d.triBool(),Ixe=d.bool(),Dxe=d.bool(),Lxe=d.triBool(),Mxe=d.triBool(),Nxe=d.triBool(),Uxe=d.triBool(),Fxe=d.int({min:1}),jxe=d.str(),$xe=d.triBool(),zxe=d.triBool(),Hxe=d.triBool(),Bxe=d.triBool(),Kxe=d.triBool(),Gxe=d.triBool(),Wxe=d.triBool(),qxe=d.triBool(),Vxe=d.triBool(),Zxe=d.triBool(),Yxe=d.triBool(),Jxe=d.triBool(),Xxe=d.triBool(),Qxe=d.triBool(),eve=d.triBool(),tve=d.triBool(),nve=d.triBool(),rve=d.bool(),ove=d.bool(),sve=d.bool(),ive=d.bool(),ave=d.bool(),cve=d.bool(),lve=d.triBool(),uve=d.bool(),dve=d.bool(),pve=d.bool(),fve=d.bool(),mve=d.bool(),hve=d.bool(),gve=d.str(),_ve=d.bool(),yve=d.bool(),bve=d.bool(),Sve=d.bool(),Eve=d.bool(),xve=d.bool(),vve=d.triBool(),wve=d.bool(),Ave=d.bool(),Tve=d.bool(),Cve=d.triBool(),kve=d.bool(),Rve=d.bool(),Ove=d.bool(),Pve=d.str(),Ive=d.bool(),Dve=d.bool(),Lve=d.bool(),Mve=d.bool(),Nve=d.bool(),Uve=d.bool(),Fve=d.bool(),jve=d.bool(),$ve=d.bool(),zve=d.triBool(),Hve=d.bool(),Bve=d.bool(),Kve=d.bool(),Gve=d.bool(),Wve=d.bool(),qve=d.bool(),Vve=d.triBool(),Zve=d.int({min:1,digitsOnly:!0}),Yve=d.bool(),Jve=d.bool(),Xve=d.bool(),Qve=d.bool(),ewe=d.bool(),twe=d.bool(),nwe=d.bool(),rwe=d.bool(),owe=d.triBool(),swe=d.triBool(),iwe=d.bool(),awe=d.bool(),cwe=d.bool(),lwe=d.bool(),uwe=d.int({min:1}),dwe=d.int({min:1}),pwe=d.int({min:0}),fwe=d.bool(),mwe=d.bool(),hwe=d.bool(),gwe=d.bool(),_we=d.bool(),ywe=d.bool(),bwe=d.bool(),Swe=d.bool(),Ewe=d.bool(),xwe=d.bool(),vwe=d.bool(),wwe=d.bool(),Awe=d.bool(),Twe=d.bool(),Cwe=d.bool(),kwe=d.bool(),Rwe=d.bool(),Owe=d.bool(),Pwe=d.bool(),Iwe=d.bool(),Dwe=d.bool(),Lwe=d.bool(),Mwe=d.bool(),Nwe=d.bool(),Uwe=d.bool(),Fwe=d.bool(),jwe=d.bool(),$we=d.bool(),zwe=d.bool(),Hwe=d.bool(),Bwe=d.triBool(),Kwe=d.triBool(),Gwe=d.bool(),Wwe=d.bool(),qwe=d.enum(["5m","1h"]),Vwe=d.enum(["5m","1h"]),Zwe=d.bool(),Ywe=d.bool(),Jwe=d.str(),Xwe=d.bool(),Qwe=d.bool(),eAe=d.bool(),tAe=d.bool(),nAe=d.bool(),rAe=d.bool(),oAe=d.bool();var UT={};rn(UT,{ALACRITTY_LOG:()=>mTe,APPDATA:()=>MAe,APP_URL:()=>tke,AWS_EXECUTION_ENV:()=>BCe,AWS_LAMBDA_FUNCTION_NAME:()=>HCe,AZURE_FUNCTIONS_ENVIRONMENT:()=>eke,BASH_ENV:()=>GTe,BAT_THEME:()=>ike,BROWSER:()=>xAe,BUILDKITE:()=>vCe,BUN_CHROME_PATH:()=>ske,BUN_CONFIG_FILE:()=>VTe,BUN_INSTALL:()=>oke,CARGO_HOME:()=>QTe,CF_PAGES:()=>$Ce,CI:()=>ECe,CIRCLECI:()=>xCe,CLOUDSDK_CONFIG:()=>JCe,CODER:()=>kCe,CODER_WORKSPACE_NAME:()=>RCe,CODESPACES:()=>CCe,COLORFGBG:()=>JAe,COLORTERM:()=>YAe,COMSPEC:()=>fAe,CONTAINER_SANDBOX_MOUNT_POINT:()=>DAe,CURSOR_TRACE_ID:()=>ITe,ComSpec:()=>hAe,ConEmuANSI:()=>ATe,ConEmuPID:()=>TTe,ConEmuTask:()=>CTe,DAYTONA_WS_ID:()=>ICe,DEMO_VERSION:()=>pke,DENO_DEPLOYMENT_ID:()=>zCe,DISPLAY:()=>vAe,DOCKER_CONFIG:()=>YTe,DO_NOT_TRACK:()=>XAe,DYNO:()=>jCe,EDITOR:()=>SAe,FORCE_COLOR:()=>ZAe,GCLOUD_PROJECT:()=>WCe,GCM_INTERACTIVE:()=>$Te,GH_ENTERPRISE_TOKEN:()=>sCe,GH_HOST:()=>oCe,GH_TOKEN:()=>rCe,GITHUB_ACTIONS:()=>uCe,GITHUB_ACTION_INPUTS:()=>dCe,GITHUB_ACTION_PATH:()=>pCe,GITHUB_ACTOR:()=>fCe,GITHUB_ACTOR_ID:()=>mCe,GITHUB_ENTERPRISE_TOKEN:()=>aCe,GITHUB_ENV:()=>cCe,GITHUB_EVENT_NAME:()=>hCe,GITHUB_EVENT_PATH:()=>gCe,GITHUB_REPOSITORY:()=>_Ce,GITHUB_REPOSITORY_ID:()=>yCe,GITHUB_REPOSITORY_OWNER:()=>bCe,GITHUB_REPOSITORY_OWNER_ID:()=>SCe,GITHUB_TOKEN:()=>iCe,GITHUB_WORKSPACE:()=>lCe,GITLAB_CI:()=>wCe,GITPOD_WORKSPACE_ID:()=>OCe,GIT_ASKPASS:()=>jTe,GIT_CONFIG_COUNT:()=>zTe,GIT_CONFIG_GLOBAL:()=>HTe,GIT_CONFIG_SYSTEM:()=>BTe,GIT_SSH_COMMAND:()=>UTe,GIT_TERMINAL_PROMPT:()=>FTe,GNOME_TERMINAL_SERVICE:()=>pTe,GNUPGHOME:()=>tCe,GOOGLE_APPLICATION_CREDENTIALS:()=>qCe,GOOGLE_CLOUD_PROJECT:()=>GCe,GOOGLE_CLOUD_WORKSTATIONS:()=>PCe,GRADLE_USER_HOME:()=>nCe,HISTFILE:()=>zAe,HOME:()=>sAe,INTELLIJ_TERMINAL_COMMAND_BLOCKS:()=>kTe,INTELLIJ_TERMINAL_COMMAND_BLOCKS_REWORKED:()=>RTe,IS_DEMO:()=>dke,IS_SANDBOX:()=>uke,ITERM_SESSION_ID:()=>cTe,JAVA_HOME:()=>WAe,JAVA_TOOL_OPTIONS:()=>qAe,KITTY_WINDOW_ID:()=>lTe,KONSOLE_VERSION:()=>uTe,KUBECONFIG:()=>ZTe,KUBERNETES_SERVICE_HOST:()=>rke,K_SERVICE:()=>KCe,LANG:()=>AAe,LC_ALL:()=>TAe,LC_TERMINAL:()=>nTe,LC_TIME:()=>CAe,LOCALAPPDATA:()=>NAe,MSYSTEM:()=>wTe,NETLIFY:()=>FCe,NODE_EXTRA_CA_CERTS:()=>BAe,NODE_OPTIONS:()=>HAe,NO_COLOR:()=>VAe,NPM_CONFIG_GLOBALCONFIG:()=>qTe,NPM_CONFIG_USERCONFIG:()=>WTe,NoDefaultCurrentDirectoryInExePath:()=>bAe,P4PORT:()=>ake,PATH:()=>iAe,PATHEXT:()=>yAe,PIP_CONFIG_FILE:()=>JTe,PLAYWRIGHT_BROWSERS_PATH:()=>cke,PREFIX:()=>cAe,PROJECT_DOMAIN:()=>MCe,PWD:()=>aAe,PYTHONSTARTUP:()=>XTe,ProgramFiles:()=>_Ae,RENDER:()=>UCe,REPL_ID:()=>DCe,REPL_SLUG:()=>LCe,RUNNER_ENVIRONMENT:()=>TCe,RUNNER_OS:()=>ACe,RUSTUP_HOME:()=>eCe,SAFEUSER:()=>UAe,SESSIONNAME:()=>gTe,SHELL:()=>pAe,SPACE_CREATOR_USER_ID:()=>nke,SSH_AUTH_SOCK:()=>NTe,SSH_CLIENT:()=>DTe,SSH_CONNECTION:()=>LTe,SSH_TTY:()=>MTe,SSL_CERT_FILE:()=>KAe,STY:()=>_Te,SUDO_GID:()=>OAe,SUDO_UID:()=>RAe,SUDO_USER:()=>PAe,SYSTEMROOT:()=>mAe,SystemRoot:()=>gAe,TEMP:()=>dAe,TERM:()=>QAe,TERMINAL:()=>rTe,TERMINAL_EMULATOR:()=>oTe,TERMINATOR_UUID:()=>sTe,TERMUX_VERSION:()=>iTe,TERM_PROGRAM:()=>eTe,TERM_PROGRAM_VERSION:()=>tTe,TILIX_ID:()=>aTe,TMP:()=>uAe,TMPDIR:()=>lAe,TMUX:()=>yTe,TMUX_PANE:()=>bTe,TRACEPARENT:()=>fke,TRACESTATE:()=>mke,USER:()=>kAe,USERNAME:()=>IAe,USERPROFILE:()=>LAe,USE_BUILTIN_RIPGREP:()=>lke,UV_THREADPOOL_SIZE:()=>GAe,VERCEL:()=>NCe,VISUAL:()=>EAe,VSCODE_GIT_ASKPASS_MAIN:()=>PTe,VTE_VERSION:()=>fTe,WAYLAND_DISPLAY:()=>wAe,WEBSITE_SITE_NAME:()=>XCe,WEBSITE_SKU:()=>QCe,WSL_DISTRO_NAME:()=>xTe,WSL_INTEROP:()=>vTe,WT_SESSION:()=>hTe,XDG_CONFIG_HOME:()=>jAe,XDG_DATA_HOME:()=>$Ae,XDG_RUNTIME_DIR:()=>FAe,XTERM_VERSION:()=>dTe,ZDOTDIR:()=>KTe,ZED_TERM:()=>ETe,ZELLIJ:()=>STe,__CFBundleIdentifier:()=>OTe,gcloud_project:()=>VCe,google_application_credentials:()=>YCe,google_cloud_project:()=>ZCe});var sAe=d.str(),iAe=d.str(),aAe=d.str(),cAe=d.str(),lAe=d.str(),uAe=d.str(),dAe=d.str(),pAe=d.str(),fAe=d.str(),mAe=d.str(),hAe=d.str(),gAe=d.str(),_Ae=d.str(),yAe=d.str(),bAe=d.str(),SAe=d.str(),EAe=d.str(),xAe=d.str(),vAe=d.str(),wAe=d.str(),AAe=d.str(),TAe=d.str(),CAe=d.str(),kAe=d.str(),RAe=d.int({min:0,digitsOnly:!0}),OAe=d.int({min:0,digitsOnly:!0}),PAe=d.str(),IAe=d.str(),DAe=d.str(),LAe=d.str(),MAe=d.str(),NAe=d.str(),UAe=d.str(),FAe=d.str(),jAe=d.str(),$Ae=d.str(),zAe=d.str(),HAe=d.str(),BAe=d.str(),KAe=d.str(),GAe=d.str(),WAe=d.str(),qAe=d.str(),VAe=d.str(),ZAe=d.str(),YAe=d.str(),JAe=d.str(),XAe=d.str(),QAe=d.str(),eTe=d.str(),tTe=d.str(),nTe=d.str(),rTe=d.str(),oTe=d.str(),sTe=d.str(),iTe=d.str(),aTe=d.str(),cTe=d.str(),lTe=d.str(),uTe=d.str(),dTe=d.str(),pTe=d.str(),fTe=d.str(),mTe=d.str(),hTe=d.str(),gTe=d.str(),_Te=d.str(),yTe=d.str(),bTe=d.str(),STe=d.str(),ETe=d.str(),xTe=d.str(),vTe=d.str(),wTe=d.str(),ATe=d.str(),TTe=d.str(),CTe=d.str(),kTe=d.str(),RTe=d.str(),OTe=d.str(),PTe=d.str(),ITe=d.str(),DTe=d.str(),LTe=d.str(),MTe=d.str(),NTe=d.str(),UTe=d.str(),FTe=d.str(),jTe=d.str(),$Te=d.str(),zTe=d.str(),HTe=d.str(),BTe=d.str(),KTe=d.str(),GTe=d.str(),WTe=d.str(),qTe=d.str(),VTe=d.str(),ZTe=d.str(),YTe=d.str(),JTe=d.str(),XTe=d.str(),QTe=d.str(),eCe=d.str(),tCe=d.str(),nCe=d.str(),rCe=d.str(),oCe=d.str(),sCe=d.str(),iCe=d.str(),aCe=d.str(),cCe=d.str(),lCe=d.str(),uCe=d.str(),dCe=d.str(),pCe=d.str(),fCe=d.str(),mCe=d.str(),hCe=d.str(),gCe=d.str(),_Ce=d.str(),yCe=d.str(),bCe=d.str(),SCe=d.str(),ECe=d.str(),xCe=d.str(),vCe=d.str(),wCe=d.str(),ACe=d.str(),TCe=d.str(),CCe=d.str(),kCe=d.str(),RCe=d.str(),OCe=d.str(),PCe=d.str(),ICe=d.str(),DCe=d.str(),LCe=d.str(),MCe=d.str(),NCe=d.str(),UCe=d.str(),FCe=d.str(),jCe=d.str(),$Ce=d.str(),zCe=d.str(),HCe=d.str(),BCe=d.str(),KCe=d.str(),GCe=d.str(),WCe=d.str(),qCe=d.str(),VCe=d.str(),ZCe=d.str(),YCe=d.str(),JCe=d.str(),XCe=d.str(),QCe=d.str(),eke=d.str(),tke=d.str(),nke=d.str(),rke=d.str(),oke=d.str(),ske=d.str(),ike=d.str(),ake=d.str(),cke=d.str(),lke=d.str(),uke=d.str(),dke=d.str(),pke=d.str(),fke=d.str(),mke=d.str();var FT={};rn(FT,{AI_AGENT:()=>VOe,ALLOW_ANT_COMPUTER_USE_MCP:()=>ZOe,ANTHROPIC_CONFIG_DIR:()=>hke,BASH_MAX_OUTPUT_LENGTH:()=>lIe,CLAUBBIT:()=>YOe,CLAUDECODE:()=>JOe,CLAUDE_AFK_COUNTDOWN_MS:()=>uIe,CLAUDE_AFK_TIMEOUT_MS:()=>dIe,CLAUDE_AFTER_LAST_COMPACT:()=>gke,CLAUDE_AGENTS_SELECT:()=>_ke,CLAUDE_AGENT_SDK_CLIENT_APP:()=>yke,CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS:()=>XOe,CLAUDE_AGENT_SDK_MCP_NO_PREFIX:()=>QOe,CLAUDE_AGENT_SDK_VERSION:()=>bke,CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS:()=>pIe,CLAUDE_AUTOCOMPACT_PCT_OVERRIDE:()=>Ske,CLAUDE_AUTO_BACKGROUND_TASKS:()=>ePe,CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR:()=>tPe,CLAUDE_BG_AUTH_SNAPSHOT_PATH:()=>Eke,CLAUDE_BG_BACKEND:()=>xke,CLAUDE_BG_CLAIM_AUTH:()=>vke,CLAUDE_BG_ISOLATION:()=>wke,CLAUDE_BG_MEMORY_TOGGLED_OFF:()=>Ake,CLAUDE_BG_POST_CLEAR_RESPAWN:()=>Tke,CLAUDE_BG_PTY_AUTH:()=>Cke,CLAUDE_BG_RENDEZVOUS_SOCK:()=>kke,CLAUDE_BG_RV_AUTH:()=>Rke,CLAUDE_BG_SESSION_PERMISSION_RULES:()=>Oke,CLAUDE_BG_SOCKET_TOKENS_PATH:()=>Pke,CLAUDE_BG_SOURCE:()=>Ike,CLAUDE_BG_STARTUP_WEDGE_MS:()=>fIe,CLAUDE_BG_TCC_DISCLAIMED:()=>Dke,CLAUDE_BRIDGE_BASE_URL:()=>Lke,CLAUDE_BRIDGE_OAUTH_TOKEN:()=>Mke,CLAUDE_BRIDGE_REATTACH_GROUPING:()=>Nke,CLAUDE_BRIDGE_REATTACH_NO_BACKFILL:()=>nPe,CLAUDE_BRIDGE_REATTACH_OUTBOUND_ONLY:()=>rPe,CLAUDE_BRIDGE_REATTACH_OWNER_ACCT:()=>Uke,CLAUDE_BRIDGE_REATTACH_OWNER_ORG:()=>Fke,CLAUDE_BRIDGE_REATTACH_SEQ:()=>mIe,CLAUDE_BRIDGE_REATTACH_SESSION:()=>jke,CLAUDE_BRIDGE_SESSION_INGRESS_URL:()=>$ke,CLAUDE_CHROME_PERMISSION_MODE:()=>zke,CLAUDE_CLIENT_PRESENCE_FILE:()=>Hke,CLAUDE_CODE_ACTION:()=>Bke,CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD:()=>Kke,CLAUDE_CODE_ADDITIONAL_PROTECTION:()=>oPe,CLAUDE_CODE_ADOPT_UNDERIVABLE_PARKED_PERMISSION:()=>$Pe,CLAUDE_CODE_AGENT:()=>Gke,CLAUDE_CODE_ARTIFACT:()=>Wke,CLAUDE_CODE_ARTIFACTS_API_BASE_URL:()=>Vke,CLAUDE_CODE_ARTIFACTS_API_TOKEN:()=>Zke,CLAUDE_CODE_ARTIFACT_ASSET_BASE_URL:()=>Yke,CLAUDE_CODE_ARTIFACT_AUTO_OPEN:()=>qke,CLAUDE_CODE_ARTIFACT_LIVE_BASE_URL:()=>Jke,CLAUDE_CODE_ARTIFACT_SYNC_BASE_URL:()=>Xke,CLAUDE_CODE_ARTIFACT_VIEWER_BASE_URL:()=>Qke,CLAUDE_CODE_AUTO_COMPACT_WINDOW:()=>eRe,CLAUDE_CODE_AUTO_MODE_EXTERNAL_PERMISSIONS:()=>sPe,CLAUDE_CODE_BASE_REF:()=>tRe,CLAUDE_CODE_BASE_REFS:()=>nRe,CLAUDE_CODE_BLOCKING_LIMIT_OVERRIDE:()=>rRe,CLAUDE_CODE_BRIDGE_MCP_CARRIER:()=>oRe,CLAUDE_CODE_BRIDGE_PROMPT_SHA256:()=>sRe,CLAUDE_CODE_BRIDGE_SESSION_ID:()=>iRe,CLAUDE_CODE_BRIEF:()=>iPe,CLAUDE_CODE_BRIEF_UPLOAD:()=>aPe,CLAUDE_CODE_CLASSIFIER_SUMMARY:()=>aRe,CLAUDE_CODE_CONTAINER_ID:()=>cRe,CLAUDE_CODE_COORDINATOR_WORKER_CHECKIN_SECONDS:()=>hIe,CLAUDE_CODE_DAEMON_COLD_START:()=>cPe,CLAUDE_CODE_DECSTBM:()=>lRe,CLAUDE_CODE_DEV_RAW_CHANGELOG_URL:()=>uRe,CLAUDE_CODE_DIR_SYNC_DISABLE_ANCHORING:()=>dRe,CLAUDE_CODE_DIR_SYNC_ENGINE:()=>hRe,CLAUDE_CODE_DIR_SYNC_FFWD:()=>gRe,CLAUDE_CODE_DIR_SYNC_GIT:()=>mRe,CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP:()=>lPe,CLAUDE_CODE_DISABLE_DIR_SYNC:()=>fRe,CLAUDE_CODE_DISABLE_HOOK_FORWARDING:()=>_Re,CLAUDE_CODE_DISABLE_PLUGIN_FORWARDING:()=>yRe,CLAUDE_CODE_DISABLE_VITALS_EMITTER:()=>bRe,CLAUDE_CODE_DISABLE_WORKING_SYNC:()=>SRe,CLAUDE_CODE_DONT_INHERIT_ENV:()=>uPe,CLAUDE_CODE_DOWNLOAD_DEADLINE_MS_FOR_TESTING:()=>ERe,CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS:()=>dPe,CLAUDE_CODE_EMIT_TOOL_USE_SUMMARIES:()=>pPe,CLAUDE_CODE_ENTRYPOINT:()=>xRe,CLAUDE_CODE_ENVIRONMENT_KIND:()=>vRe,CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION:()=>wRe,CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER:()=>fPe,CLAUDE_CODE_EXIT_AFTER_STOP_DELAY:()=>gIe,CLAUDE_CODE_FORCE_BRIDGE:()=>mPe,CLAUDE_CODE_FORCE_EVALUATE_MEMORY:()=>hPe,CLAUDE_CODE_FORCE_FULLSCREEN_UPSELL:()=>gPe,CLAUDE_CODE_FORCE_MEMORY_SURVEY:()=>_Pe,CLAUDE_CODE_FORCE_TIP_ID:()=>ARe,CLAUDE_CODE_GIT_BASH_PATH:()=>TRe,CLAUDE_CODE_GLOB_TIMEOUT_SECONDS:()=>_Ie,CLAUDE_CODE_GOAL_CHECKIN_MINUTES:()=>yIe,CLAUDE_CODE_HIDE_SETTINGS_HINT:()=>CRe,CLAUDE_CODE_HOLD_REPORT_PARK_AT_INIT:()=>BPe,CLAUDE_CODE_HOLD_UNANSWERED_PARKED_PERMISSION:()=>jPe,CLAUDE_CODE_HOME_SEED_HOLD_TIMEOUT_MS:()=>kRe,CLAUDE_CODE_HOME_SEED_VERDICT_TIMEOUT_MS:()=>RRe,CLAUDE_CODE_HOST_PLATFORM:()=>ORe,CLAUDE_CODE_IDE_HOST_OVERRIDE:()=>PRe,CLAUDE_CODE_IDLE_THRESHOLD_MINUTES:()=>bIe,CLAUDE_CODE_IDLE_TOKEN_THRESHOLD:()=>SIe,CLAUDE_CODE_IS_COWORK:()=>yPe,CLAUDE_CODE_LEGACY_BUNDLE:()=>pRe,CLAUDE_CODE_LOOP_KEEPALIVE:()=>bPe,CLAUDE_CODE_LOOP_PERSISTENT:()=>SPe,CLAUDE_CODE_MANAGED_SETTINGS_PATH:()=>IRe,CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS:()=>EIe,CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH:()=>xIe,CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION:()=>vIe,CLAUDE_CODE_MCP_ALLOWLIST_ENV:()=>DRe,CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS:()=>cDe,CLAUDE_CODE_MCP_MEMORY_CGROUP:()=>eIe,CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT:()=>aDe,CLAUDE_CODE_MOCK_REMOTE_SETTINGS:()=>EPe,CLAUDE_CODE_MOCK_TRIAL:()=>xPe,CLAUDE_CODE_OVERRIDE_DATE:()=>LRe,CLAUDE_CODE_PARKED_PERMISSION_WAIT_MS:()=>UPe,CLAUDE_CODE_PARKED_STOP_RETIRES:()=>HPe,CLAUDE_CODE_PERFORCE_MODE:()=>MRe,CLAUDE_CODE_PLAN_V2_AGENT_COUNT:()=>wIe,CLAUDE_CODE_PLAN_V2_EXPLORE_AGENT_COUNT:()=>AIe,CLAUDE_CODE_PLUGIN_ATTRIBUTION:()=>NRe,CLAUDE_CODE_PLUGIN_CACHE_DIR:()=>URe,CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS:()=>TIe,CLAUDE_CODE_PLUGIN_SEED_DIR:()=>FRe,CLAUDE_CODE_POWERUP_ONBOARDING:()=>jRe,CLAUDE_CODE_PROJECT_DIR_NAME:()=>$Re,CLAUDE_CODE_PWSH_PARSE_TIMEOUT_MS:()=>CIe,CLAUDE_CODE_QUESTION_PREVIEW_FORMAT:()=>zRe,CLAUDE_CODE_RELAUNCH_TERMINAL_SIZE:()=>HRe,CLAUDE_CODE_REMOTE:()=>vPe,CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE:()=>BRe,CLAUDE_CODE_REMOTE_HERMETIC_MODE:()=>wPe,CLAUDE_CODE_REMOTE_MEMORY_DIR:()=>KRe,CLAUDE_CODE_REMOTE_RAW_EVENTS_FILE:()=>GRe,CLAUDE_CODE_REMOTE_SEND_KEEPALIVES:()=>APe,CLAUDE_CODE_REMOTE_SESSION_ID:()=>WRe,CLAUDE_CODE_REMOTE_SESSION_ORIGIN:()=>qRe,CLAUDE_CODE_REMOTE_SETTINGS_PATH:()=>VRe,CLAUDE_CODE_REMOTE_SETTINGS_POLL_MS:()=>kIe,CLAUDE_CODE_REPL:()=>TPe,CLAUDE_CODE_REPO_CHECKOUTS:()=>ZRe,CLAUDE_CODE_RESUME_FROM_SESSION:()=>YRe,CLAUDE_CODE_RESUME_INTERRUPTED_TURN:()=>CPe,CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS:()=>RPe,CLAUDE_CODE_RESUME_PROMPT:()=>JRe,CLAUDE_CODE_RESUME_SOURCE_ALIVE:()=>kPe,CLAUDE_CODE_RESUME_THRESHOLD_MINUTES:()=>RIe,CLAUDE_CODE_RESUME_TOKEN_THRESHOLD:()=>OIe,CLAUDE_CODE_RESUME_TOLERATES_CONTEXT_APPENDS:()=>zPe,CLAUDE_CODE_RETIRE_UNANSWERED_PARKED_PERMISSION:()=>FPe,CLAUDE_CODE_SAFE_MODE:()=>OPe,CLAUDE_CODE_SANDBOXED:()=>PPe,CLAUDE_CODE_SCRIPT_CAPS:()=>PIe,CLAUDE_CODE_SCROLL_SPEED:()=>XRe,CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS:()=>IIe,CLAUDE_CODE_SESSION_ID:()=>QRe,CLAUDE_CODE_SESSION_KIND:()=>eOe,CLAUDE_CODE_SESSION_NAME:()=>tOe,CLAUDE_CODE_SHELL:()=>nOe,CLAUDE_CODE_SHELL_PREFIX:()=>rOe,CLAUDE_CODE_SIMPLE:()=>IPe,CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT:()=>oOe,CLAUDE_CODE_SPAWN_TIMESTAMP_MS:()=>DIe,CLAUDE_CODE_SSE_PORT:()=>LIe,CLAUDE_CODE_STALL_TIMEOUT_MS_FOR_TESTING:()=>sOe,CLAUDE_CODE_STOP_HOOK_BLOCK_CAP:()=>MIe,CLAUDE_CODE_SUBPROCESS_ENV_SCRUB:()=>DPe,CLAUDE_CODE_SUPERVISED:()=>LPe,CLAUDE_CODE_SYNC_PLUGINS_BUFFERED_DOWNLOAD:()=>MPe,CLAUDE_CODE_SYNC_PLUGINS_DOWNLOAD_STALL_MS:()=>NPe,CLAUDE_CODE_SYNC_PLUGINS_INSTALL_TIMEOUT_MS:()=>UIe,CLAUDE_CODE_SYNC_PLUGINS_MCP_TIMEOUT_MS:()=>FIe,CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS:()=>NIe,CLAUDE_CODE_SYNC_SESSION_REFS:()=>KPe,CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS:()=>jIe,CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS:()=>$Ie,CLAUDE_CODE_SYNTAX_HIGHLIGHT:()=>GPe,CLAUDE_CODE_SYSTEM_PROMPT_GB_FEATURE:()=>iOe,CLAUDE_CODE_TAGS:()=>aOe,CLAUDE_CODE_TASK_LIST_ID:()=>lOe,CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS:()=>zIe,CLAUDE_CODE_TERMINAL_MCP_TOOLS:()=>cOe,CLAUDE_CODE_TEST_ALLOW_REAL_NETWORK:()=>WPe,CLAUDE_CODE_TEST_FIXTURES_ROOT:()=>uOe,CLAUDE_CODE_TEST_FORCE_DENY:()=>qPe,CLAUDE_CODE_TEST_NO_GIT_BASH:()=>VPe,CLAUDE_CODE_TEST_NO_PWSH:()=>ZPe,CLAUDE_CODE_TMPDIR:()=>dOe,CLAUDE_CODE_TMUX_PREFIX:()=>pOe,CLAUDE_CODE_TMUX_PREFIX_CONFLICTS:()=>YPe,CLAUDE_CODE_TMUX_SESSION:()=>fOe,CLAUDE_CODE_TMUX_TRUECOLOR:()=>JPe,CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE:()=>XPe,CLAUDE_CODE_TOOL_MEMORY_LIMIT:()=>QPe,CLAUDE_CODE_TRIGGER_ID:()=>mOe,CLAUDE_CODE_TUI_JUST_SWITCHED:()=>tIe,CLAUDE_CODE_TUI_TRIAL:()=>nIe,CLAUDE_CODE_ULTRAREVIEW_PREFLIGHT_FIXTURE:()=>hOe,CLAUDE_CODE_ULTRAREVIEW_QUOTA_FIXTURE:()=>gOe,CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS:()=>HIe,CLAUDE_CODE_VOICE_FORWARD_INTERIMS_TYPED:()=>rIe,CLAUDE_CODE_WORKER_EPOCH:()=>BIe,CLAUDE_CODE_WORKSPACE_HOST_PATHS:()=>_Oe,CLAUDE_CONFIG_DIR:()=>yOe,CLAUDE_COWORK_MEMORY_EXTRA_GUIDELINES:()=>bOe,CLAUDE_COWORK_MEMORY_GUIDELINES:()=>SOe,CLAUDE_COWORK_MEMORY_INDEX_CONTENT:()=>EOe,CLAUDE_COWORK_MEMORY_PATH_OVERRIDE:()=>xOe,CLAUDE_ENV_FILE:()=>vOe,CLAUDE_FORCE_DISPLAY_SURVEY:()=>oIe,CLAUDE_INTERNAL_ASSISTANT_TEAM_NAME:()=>wOe,CLAUDE_INTERNAL_FC_OVERRIDES:()=>AOe,CLAUDE_JOB_DIR:()=>TOe,CLAUDE_MEMORY_STORES:()=>COe,CLAUDE_PROJECT_UUID:()=>kOe,CLAUDE_PTY_HEARTBEAT_MS:()=>KIe,CLAUDE_PTY_HOST_EXEC:()=>ROe,CLAUDE_PTY_ORPHAN_CHECK_MS:()=>GIe,CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX:()=>OOe,CLAUDE_REMOTE_WORKFLOW_ARGS:()=>POe,CLAUDE_REMOTE_WORKFLOW_SCRIPT:()=>IOe,CLAUDE_REPL_VARIANT:()=>DOe,CLAUDE_RUNNER_ACTIVITY_FD:()=>WIe,CLAUDE_RUNNER_FETCH_DEPTH:()=>LOe,CLAUDE_SECURESTORAGE_CONFIG_DIR:()=>MOe,CLAUDE_SERVE_DRAIN_TIMEOUT_MS:()=>qIe,CLAUDE_SNIP:()=>NOe,CLAUDE_SSH_LOCAL_BINARY:()=>UOe,CLAUDE_SSH_VERSION:()=>FOe,CLAUDE_STAGE_FILE_ROOT:()=>jOe,CLAUDE_SUBAGENT_BG_SHELL_MAX_MS:()=>VIe,CLAUDE_TMPDIR:()=>$Oe,LOCAL_BRIDGE:()=>sIe,MCP_CONNECTION_NONBLOCKING:()=>iIe,MCP_CONNECT_TIMEOUT_MS:()=>ZIe,MCP_DISCOVERY_CACHE:()=>YIe,MCP_DISCOVERY_CACHE_MAX_STALE_S:()=>JIe,MCP_DISCOVERY_CACHE_STRIKES:()=>XIe,MCP_DISCOVERY_CACHE_TTL_S:()=>QIe,MCP_OAUTH_CALLBACK_PORT:()=>eDe,MCP_OAUTH_CLIENT_METADATA_URL:()=>zOe,MCP_PROTOCOL_NEGOTIATION:()=>tDe,MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE:()=>nDe,MCP_SDK_GENERATION:()=>oDe,MCP_SERVER_CONNECTION_BATCH_SIZE:()=>rDe,MCP_TIMEOUT:()=>sDe,MCP_TOOL_TIMEOUT:()=>iDe,MCP_TRUNCATION_PROMPT_OVERRIDE:()=>HOe,SDK_NATIVE_BIN:()=>BOe,SESSION_INGRESS_URL:()=>KOe,SLASH_COMMAND_TOOL_CHAR_BUDGET:()=>lDe,TASK_MAX_OUTPUT_LENGTH:()=>uDe,TEST_ENABLE_SESSION_PERSISTENCE:()=>aIe,ULTRAPLAN_PROMPT_FILE:()=>GOe,VCR_RECORD:()=>cIe,VITALS_EMITTER_BIN:()=>WOe,VOICE_STREAM_BASE_URL:()=>qOe});var hke=d.str(),gke=d.str(),_ke=d.str(),yke=d.str(),bke=d.str(),Ske=d.str(),Eke=d.str(),xke=d.str(),vke=d.str(),wke=d.str(),Ake=d.str(),Tke=d.bool(),Cke=d.str(),kke=d.str(),Rke=d.str(),Oke=d.str(),Pke=d.str(),Ike=d.str(),Dke=d.str(),Lke=d.str(),Mke=d.str(),Nke=d.str(),Uke=d.str(),Fke=d.str(),jke=d.str(),$ke=d.str(),zke=d.str(),Hke=d.str(),Bke=d.str(),Kke=d.str(),Gke=d.str(),Wke=d.str(),qke=d.str(),Vke=d.str(),Zke=d.str(),Yke=d.str(),Jke=d.str(),Xke=d.str(),Qke=d.str(),eRe=d.str(),tRe=d.str(),nRe=d.str(),rRe=d.str(),oRe=d.enum(["1","spent"]),sRe=d.str(),iRe=d.str(),aRe=d.str(),cRe=d.str(),lRe=d.str(),uRe=d.str(),dRe=d.bool(),pRe=d.bool(),fRe=d.bool(),mRe=d.bool(),hRe=d.str(),gRe=d.str(),_Re=d.bool(),yRe=d.bool(),bRe=d.bool(),SRe=d.bool(),ERe=d.str(),xRe=d.str(),vRe=d.str(),wRe=d.str(),ARe=d.str(),TRe=d.str(),CRe=d.str(),kRe=d.int({min:0}),RRe=d.int({min:0}),ORe=d.str(),PRe=d.str(),IRe=d.str(),DRe=d.str(),LRe=d.str(),MRe=d.str(),NRe=d.str(),URe=d.str(),FRe=d.str(),jRe=d.str(),$Re=d.str(),zRe=d.str(),HRe=d.str(),BRe=d.str(),KRe=d.str(),GRe=d.str(),WRe=d.str(),qRe=d.str(),VRe=d.str(),ZRe=d.str(),YRe=d.str(),JRe=d.str(),XRe=d.str(),QRe=d.str(),eOe=d.str(),tOe=d.str(),nOe=d.str(),rOe=d.str(),oOe=d.str(),sOe=d.str(),iOe=d.str(),aOe=d.str(),cOe=d.str(),lOe=d.str(),uOe=d.str(),dOe=d.str(),pOe=d.str(),fOe=d.str(),mOe=d.str(),hOe=d.str(),gOe=d.str(),_Oe=d.str(),yOe=d.str(),bOe=d.str(),SOe=d.str(),EOe=d.str(),xOe=d.str(),vOe=d.str(),wOe=d.str(),AOe=d.str(),TOe=d.str(),COe=d.str(),kOe=d.str(),ROe=d.str(),OOe=d.str(),POe=d.str(),IOe=d.str(),DOe=d.str(),LOe=d.str(),MOe=d.str(),NOe=d.str(),UOe=d.str(),FOe=d.str(),jOe=d.str(),$Oe=d.str(),zOe=d.str(),HOe=d.str(),BOe=d.str(),KOe=d.str(),GOe=d.str(),WOe=d.str(),qOe=d.str(),VOe=d.bool(),ZOe=d.bool(),YOe=d.bool(),JOe=d.bool(),XOe=d.bool(),QOe=d.bool(),ePe=d.bool(),tPe=d.bool(),nPe=d.bool(),rPe=d.bool(),oPe=d.bool(),sPe=d.bool(),iPe=d.bool(),aPe=d.bool(),cPe=d.bool(),lPe=d.bool(),uPe=d.bool(),dPe=d.bool(),pPe=d.bool(),fPe=d.bool(),mPe=d.bool(),hPe=d.bool(),gPe=d.bool(),_Pe=d.bool(),yPe=d.bool(),bPe=d.bool(),SPe=d.bool(),EPe=d.str(),xPe=d.bool(),vPe=d.bool(),wPe=d.bool(),APe=d.bool(),TPe=d.triBool(),CPe=d.bool(),kPe=d.str(),RPe=d.str(),OPe=d.bool(),PPe=d.bool(),IPe=d.bool(),DPe=d.triBool(),LPe=d.bool(),MPe=d.bool(),NPe=d.int({min:1}),UPe=d.int({min:0}),FPe=d.bool(),jPe=d.bool(),$Pe=d.bool(),zPe=d.bool(),HPe=d.bool(),BPe=d.bool(),KPe=d.bool(),GPe=d.str(),WPe=d.bool(),qPe=d.bool(),VPe=d.str(),ZPe=d.str(),YPe=d.bool(),JPe=d.bool(),XPe=d.str(),QPe=d.str(),eIe=d.str(),tIe=d.str(),nIe=d.str(),rIe=d.bool(),oIe=d.bool(),sIe=d.bool(),iIe=d.bool(),aIe=d.bool(),cIe=d.bool(),lIe=d.int(),uIe=d.int(),dIe=d.int(),pIe=d.int(),fIe=d.int(),mIe=d.int(),hIe=d.int({min:1,max:86400,digitsOnly:!0}),gIe=d.int(),_Ie=d.int({min:1}),yIe=d.int({min:0,max:10080,digitsOnly:!0}),bIe=d.int(),SIe=d.int(),EIe=d.int({min:1,digitsOnly:!0}),xIe=d.int({min:1,digitsOnly:!0}),vIe=d.int({min:1,digitsOnly:!0}),wIe=d.int(),AIe=d.int(),TIe=d.int(),CIe=d.int(),kIe=d.int(),RIe=d.int(),OIe=d.int(),PIe=d.int(),IIe=d.int(),DIe=d.int(),LIe=d.int(),MIe=d.int(),NIe=d.int({min:1}),UIe=d.int({min:1}),FIe=d.int({min:0}),jIe=d.int(),$Ie=d.int(),zIe=d.int({min:1000,max:60000}),HIe=d.int(),BIe=d.int(),KIe=d.int({min:1}),GIe=d.int({min:1}),WIe=d.int({min:3}),qIe=d.int({min:1}),VIe=d.int({min:1}),ZIe=d.int(),YIe=d.triBool(),JIe=d.int({min:1}),XIe=d.int({min:1}),QIe=d.int({min:1}),eDe=d.int({min:1}),tDe=d.str(),nDe=d.int({min:1}),rDe=d.int({min:1}),oDe=d.str(),sDe=d.int(),iDe=d.int({min:1}),aDe=d.int(),cDe=d.int(),lDe=d.int({min:1}),uDe=d.int();var jT={};rn(jT,{ANTHROPIC_CUSTOM_MODEL_OPTION:()=>kDe,ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION:()=>ODe,ANTHROPIC_CUSTOM_MODEL_OPTION_NAME:()=>RDe,ANTHROPIC_DEFAULT_FABLE_MODEL:()=>mDe,ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION:()=>gDe,ANTHROPIC_DEFAULT_FABLE_MODEL_NAME:()=>hDe,ANTHROPIC_DEFAULT_HAIKU_MODEL:()=>vDe,ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION:()=>ADe,ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME:()=>wDe,ANTHROPIC_DEFAULT_MODEL:()=>pDe,ANTHROPIC_DEFAULT_OPUS_MODEL:()=>_De,ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION:()=>bDe,ANTHROPIC_DEFAULT_OPUS_MODEL_NAME:()=>yDe,ANTHROPIC_DEFAULT_SONNET_MODEL:()=>SDe,ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION:()=>xDe,ANTHROPIC_DEFAULT_SONNET_MODEL_NAME:()=>EDe,ANTHROPIC_MODEL:()=>dDe,ANTHROPIC_SMALL_FAST_MODEL:()=>fDe,CLAUDE_CODE_3P_PROBE_WROTE_OPUS_DEFAULT:()=>CDe,CLAUDE_CODE_3P_PROBE_WROTE_SONNET_DEFAULT:()=>TDe,CLAUDE_CODE_ALWAYS_ENABLE_EFFORT:()=>zDe,CLAUDE_CODE_AUTO_MODE_MODEL:()=>IDe,CLAUDE_CODE_BG_CLASSIFIER_MODEL:()=>DDe,CLAUDE_CODE_DISABLE_1M_CONTEXT:()=>GDe,CLAUDE_CODE_DISABLE_EXPLORE_INHERIT_CAP:()=>FDe,CLAUDE_CODE_DISABLE_FAST_MODE:()=>HDe,CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP:()=>jDe,CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT:()=>WDe,CLAUDE_CODE_EFFORT_LEVEL:()=>$De,CLAUDE_CODE_NO_MODEL_FALLBACK:()=>UDe,CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS:()=>BDe,CLAUDE_CODE_SKIP_FAST_MODE_ORG_CHECK:()=>KDe,CLAUDE_CODE_SUBAGENT_MODEL:()=>PDe,CLAUDE_CONTEXT_COLLAPSE:()=>MDe,CLAUDE_CONTEXT_COLLAPSE_MODEL:()=>LDe,FALLBACK_FOR_ALL_PRIMARY_MODELS:()=>NDe});var dDe=d.str(),pDe=d.str(),fDe=d.str(),mDe=d.str(),hDe=d.str(),gDe=d.str(),_De=d.str(),yDe=d.str(),bDe=d.str(),SDe=d.str(),EDe=d.str(),xDe=d.str(),vDe=d.str(),wDe=d.str(),ADe=d.str(),TDe=d.str(),CDe=d.str(),kDe=d.str(),RDe=d.str(),ODe=d.str(),PDe=d.str(),IDe=d.str(),DDe=d.str(),LDe=d.str(),MDe=d.bool(),NDe=d.str(),UDe=d.bool(),FDe=d.bool(),jDe=d.bool(),$De=d.str(),zDe=d.bool(),HDe=d.bool(),BDe=d.bool(),KDe=d.bool(),GDe=d.bool(),WDe=d.bool();var $T={};rn($T,{ALL_PROXY:()=>QDe,ANTHROPIC_BETAS:()=>iLe,ANTHROPIC_CUSTOM_HEADERS:()=>aLe,API_FORCE_IDLE_TIMEOUT:()=>ELe,API_TIMEOUT_MS:()=>SLe,CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS:()=>CLe,CLAUDE_CODE_ATTRIBUTION_HEADER:()=>uLe,CLAUDE_CODE_CERT_STORE:()=>sLe,CLAUDE_CODE_CLIENT_CERT:()=>tLe,CLAUDE_CODE_CLIENT_KEY:()=>nLe,CLAUDE_CODE_CLIENT_KEY_PASSPHRASE:()=>rLe,CLAUDE_CODE_DISABLE_MTLS_RELOAD_ON_STALE_CONNECTION:()=>oLe,CLAUDE_CODE_EAGER_FLUSH:()=>PLe,CLAUDE_CODE_EXTRA_BODY:()=>cLe,CLAUDE_CODE_EXTRA_METADATA:()=>lLe,CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS:()=>mLe,CLAUDE_CODE_FORCE_SYNC_OUTPUT:()=>ILe,CLAUDE_CODE_GZIP_REQUEST_BODIES:()=>ALe,CLAUDE_CODE_MAX_CONTEXT_TOKENS:()=>fLe,CLAUDE_CODE_MAX_OUTPUT_TOKENS:()=>pLe,CLAUDE_CODE_MAX_RETRIES:()=>dLe,CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY:()=>hLe,CLAUDE_CODE_MAX_TURNS:()=>gLe,CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS:()=>MLe,CLAUDE_CODE_RETRY_WATCHDOG:()=>OLe,CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS:()=>LLe,CLAUDE_ENABLE_BYTE_WATCHDOG:()=>xLe,CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK:()=>vLe,CLAUDE_ENABLE_STREAM_WATCHDOG:()=>wLe,CLAUDE_MOCK_HEADERLESS_429:()=>DLe,CLAUDE_SLOW_FIRST_BYTE_MS:()=>RLe,CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS:()=>kLe,CLAUDE_STREAM_IDLE_TIMEOUT_MS:()=>TLe,HTTPS_PROXY:()=>VDe,HTTP_PROXY:()=>qDe,MAX_MCP_OUTPUT_TOKENS:()=>bLe,MAX_STRUCTURED_OUTPUT_RETRIES:()=>yLe,MAX_THINKING_TOKENS:()=>_Le,NO_PROXY:()=>ZDe,all_proxy:()=>eLe,http_proxy:()=>YDe,https_proxy:()=>JDe,no_proxy:()=>XDe});var qDe=d.str(),VDe=d.str(),ZDe=d.str(),YDe=d.str(),JDe=d.str(),XDe=d.str(),QDe=d.str(),eLe=d.str(),tLe=d.str(),nLe=d.str(),rLe=d.str(),oLe=d.bool(),sLe=d.str(),iLe=d.str(),aLe=d.str(),cLe=d.str(),lLe=d.str(),uLe=d.str(),dLe=d.int(),pLe=d.int(),fLe=d.int(),mLe=d.int(),hLe=d.int({min:1}),gLe=d.str(),_Le=d.int(),yLe=d.int(),bLe=d.int(),SLe=d.int(),ELe=d.int(),xLe=d.triBool(),vLe=d.bool(),wLe=d.triBool(),ALe=d.triBool(),TLe=d.int({min:1}),CLe=d.int({min:1}),kLe=d.int({min:1}),RLe=d.int({min:1}),OLe=d.bool(),PLe=d.bool(),ILe=d.bool(),DLe=d.bool(),LLe=d.int(),MLe=d.int({min:0});var zT={};rn(zT,{AGENT_PROXY_URL:()=>N0e,ANTHROPIC_AWS_BASE_URL:()=>ZLe,ANTHROPIC_AWS_WORKSPACE_ID:()=>YLe,ANTHROPIC_BASE_URL:()=>HLe,ANTHROPIC_BEDROCK_BASE_URL:()=>GLe,ANTHROPIC_BEDROCK_MANTLE_BASE_URL:()=>VLe,ANTHROPIC_BEDROCK_REGION_PREFIX:()=>WLe,ANTHROPIC_BEDROCK_SERVICE_TIER:()=>qLe,ANTHROPIC_FOUNDRY_BASE_URL:()=>o0e,ANTHROPIC_FOUNDRY_RESOURCE:()=>s0e,ANTHROPIC_GOOGLE_CLOUD_BASE_URL:()=>e0e,ANTHROPIC_GOOGLE_CLOUD_LOCATION:()=>XLe,ANTHROPIC_GOOGLE_CLOUD_PROJECT:()=>JLe,ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID:()=>QLe,ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION:()=>g0e,ANTHROPIC_UNIX_SOCKET:()=>_0e,ANTHROPIC_VERTEX_BASE_URL:()=>t0e,ANTHROPIC_VERTEX_PROJECT_ID:()=>n0e,AWS_ACCESS_KEY_ID:()=>d0e,AWS_CONFIG_FILE:()=>l0e,AWS_DEFAULT_REGION:()=>a0e,AWS_ENDPOINT_URL:()=>m0e,AWS_ENDPOINT_URL_STS:()=>h0e,AWS_PROFILE:()=>c0e,AWS_REGION:()=>i0e,AWS_SECRET_ACCESS_KEY:()=>p0e,AWS_SESSION_TOKEN:()=>f0e,AWS_SHARED_CREDENTIALS_FILE:()=>u0e,CCR_AGENT_PROXY_ENABLED:()=>C0e,CCR_AGENT_PROXY_FRAME_HOSTS:()=>I0e,CCR_AGENT_PROXY_INCLUDE_HOSTS:()=>P0e,CCR_AGENT_PROXY_RELAY_MODE:()=>O0e,CCR_ENABLE_BUNDLE:()=>D0e,CCR_FORCE_BUNDLE:()=>L0e,CCR_ON_BRANCH_DEFAULT_GUARD:()=>M0e,CLAUDE_CODE_AGENT_PROXY_GH_SHIM:()=>R0e,CLAUDE_CODE_AGENT_PROXY_GIT_CONFIG:()=>k0e,CLAUDE_CODE_API_BASE_URL:()=>KLe,CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY:()=>w0e,CLAUDE_CODE_GB_BASE_URL:()=>A0e,CLAUDE_CODE_GB_REFRESH_INTERVAL_MS:()=>T0e,CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST:()=>y0e,CLAUDE_CODE_PROXY_RESOLVES_HOSTS:()=>S0e,CLAUDE_CODE_SIMULATE_PROXY_USAGE:()=>b0e,CLAUDE_CODE_SKIP_HFI_VERSION_CHECK:()=>U0e,CLAUDE_CODE_USE_ANTHROPIC_AWS:()=>jLe,CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD:()=>$Le,CLAUDE_CODE_USE_BEDROCK:()=>NLe,CLAUDE_CODE_USE_FOUNDRY:()=>FLe,CLAUDE_CODE_USE_GATEWAY:()=>E0e,CLAUDE_CODE_USE_MANTLE:()=>zLe,CLAUDE_CODE_USE_VERTEX:()=>ULe,CLAUDE_GATEWAY_ALLOW_LOOPBACK:()=>x0e,CLAUDE_GATEWAY_LOG_LEVEL:()=>v0e,CLOUD_ML_REGION:()=>r0e,_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL:()=>BLe});var o2=["us","eu","apac","jp","au","global"];var NLe=d.bool(),ULe=d.bool(),FLe=d.bool(),jLe=d.bool(),$Le=d.bool(),zLe=d.bool(),HLe=d.str(),BLe=d.bool(),KLe=d.str(),GLe=d.str(),WLe=d.enum(o2),qLe=d.str(),VLe=d.str(),ZLe=d.str(),YLe=d.str(),JLe=d.str(),XLe=d.str(),QLe=d.str(),e0e=d.str(),t0e=d.str(),n0e=d.str(),r0e=d.str(),o0e=d.str(),s0e=d.str(),i0e=d.str(),a0e=d.str(),c0e=d.str(),l0e=d.str(),u0e=d.str(),d0e=d.str(),p0e=d.str(),f0e=d.str(),m0e=d.str(),h0e=d.str(),g0e=d.str(),_0e=d.str(),y0e=d.bool(),b0e=d.bool(),S0e=d.bool(),E0e=d.bool(),x0e=d.bool(),v0e=d.str(),w0e=d.bool(),A0e=d.str(),T0e=d.int(),C0e=d.bool(),k0e=d.bool(),R0e=d.bool(),O0e=d.str(),P0e=d.str(),I0e=d.str(),D0e=d.bool(),L0e=d.bool(),M0e=d.enum(["enforce","observe","off"]),N0e=d.str(),U0e=d.bool();var j0e={...jw,...zT,...jT,...NT,...$T,...UT,...$w,...FT};function HT(e,t){let n=Object.create(t);for(let[r,o]of Object.entries(e)){let s=n,i;Object.defineProperty(n,r,{get:()=>{let a=process.env[r];if(a!==s)i=o.parse(a),s=a;return i},enumerable:!0,configurable:!0})}return Object.defineProperties(n,{set:{value:(r,o)=>{process.env[r]=EF(o)}},unset:{value:(r)=>{delete process.env[r]}}}),n}var Mn=HT(j0e,If),$0e={},Wwt=HT($0e,null),z0e={},qwt=HT(z0e,null);class i2{debugFilePath=void 0;initPromise=null;logStem=null}var B0e=new tt(()=>new i2);function a2(){return B0e.of(Tt().host)}function c2(e){if(e.initPromise)return e.initPromise;if(!Mn.DEBUG_CLAUDE_AGENT_SDK)return e.debugFilePath=null,e.initPromise=Promise.resolve(),e.initPromise;let t=s2(Gt(),"debug");return e.logStem=`sdk-${H0e()}`,e.debugFilePath=s2(t,`${e.logStem}.txt`),process.stderr.write(`SDK debug logs: ${e.debugFilePath}
98
- `),e.initPromise=Sl().mkdir(t).catch(()=>{}),e.initPromise}function K0e(e){return e.logStem===null?null:{namespace:"log",sessionId:e.logStem,channel:"debug"}}function l2(){let e=a2();return c2(e),e.debugFilePath??null}function _n(e,t){let n=a2();if(n.debugFilePath===null)return;let o=`${new Date().toISOString()} ${e}
99
- `;c2(n).then(()=>{if(t!==void 0){let s=K0e(n);if(s!==null)t.append(s,[{data:o}]).catch(()=>{});return}if(n.debugFilePath)Sl().append(n.debugFilePath,o).catch(()=>{})})}function G0e(e){let t=e.trim();return t.startsWith("{")&&t.endsWith("}")}function u2(e,t){let n={...e};if(!t)return n;let r=t.enabled===!0&&t.failIfUnavailable===void 0?{...t,failIfUnavailable:!0}:t,o=n.settings;if(o&&!G0e(o))throw Error("Cannot use both a settings file path and the sandbox option. Include the sandbox configuration in your settings file instead.");let s={sandbox:r};if(o)try{s={...yt(o),sandbox:r}}catch{}return n.settings=me(s),n}function BT(e,t,n){let r=String(n);if(r.length>1&&r.startsWith("-"))e.push(`--${t}=${r}`);else e.push(`--${t}`,r)}var Y0e=2000,KT=2048,f2="sdk-exit-after-stderr-drained",J0e=200;function GT(e){return e==="exit"?f2:e}class m2{#e=new Set;#t=!1;#n=()=>this.killAll();track(e){if(this.#e.add(e),!this.#t)this.#t=!0,process.on("exit",this.#n)}untrack(e){this.#e.delete(e)}isTracking(e){return this.#e.has(e)}get size(){return this.#e.size}killAll(){for(let e of this.#e)if(!e.killed)if(process.platform==="win32")try{e.stdin.end()}catch{}else e.kill("SIGTERM")}reset(){process.off("exit",this.#n),this.#t=!1,this.#e.clear()}}var sy=new m2,X0e=/[(),\u0000-\u001f\u007f-\u009f]/;function Q0e(e){if(typeof e!=="string"||e.trim()==="")throw Error("Skill names must be non-empty strings.");if(!bh(e))throw new qe(`Invalid skill name ${me(e)}: the name contains an unpaired surrogate, which cannot survive the UTF-8 encoding of the CLI invocation; no skill discovered from the filesystem can have such a name.`,"skill name with unpaired surrogate rejected");if(e!==e.trim())throw new qe(`Invalid skill name ${me(e)}: leading or trailing whitespace is not allowed — the Skill tool trims the invoked name, so a padded rule can never match. Remove the padding.`,"skill name with surrounding whitespace rejected");if(X0e.test(e))throw new qe(`Invalid skill name ${me(e)}: parentheses, commas, and control characters are not allowed in skill names. Skill names match the skill's directory name (or 'plugin:skill' for plugin-qualified skills); rename the skill if its directory name contains these characters.`,"invalid skill name rejected");if(e==="*")throw Error("Invalid skill name '*': use skills: 'all' to enable every skill.");if(e.endsWith(":*")||e.endsWith(" *"))throw new qe(`Invalid skill name ${me(e)}: wildcard-suffix names are not allowed; list each skill by its exact name.`,"wildcard-suffix skill name rejected");if(e.startsWith("/"))throw new qe(`Invalid skill name ${me(e)}: skill names may not start with '/'. Skills are invoked as slash commands, but the skills option takes the skill's canonical name — the directory name, or 'plugin:skill'.`,"skill name with leading slash rejected");if(e.includes("\\\\"))throw new qe(`Invalid skill name ${me(e)}: consecutive backslashes are not allowed — the permission-rule parser collapses escaped backslashes, so the rule would name a different skill. Rename the skill.`,"skill name with consecutive backslashes rejected");if(e.endsWith("\\"))throw new qe(`Invalid skill name ${me(e)}: names may not end with an unpaired backslash.`,"skill name with unpaired trailing backslash rejected");return e}class qT{options;process;processStdin;processStdout;ready=!1;abortController;exitError;exitEventDelivered=!1;stderrTail="";exitListeners=[];abortHandler;forwardedAbort=md();pendingWrites=[];pendingEndInput=!1;spawnResolve;spawnReject;spawnPromise;constructor(e){this.options=e;if(this.abortController=e.abortController||md(),e.deferSpawn)this.spawnPromise=new Promise((t,n)=>{this.spawnResolve=t,this.spawnReject=n}),this.spawnPromise.catch(()=>{});else this.initialize()}spawn(){try{this.initialize()}catch(t){throw this.spawnAbort(Ur(t)),t}let e=this.pendingWrites;if(this.pendingWrites=[],this.spawnResolve)this.spawnResolve(),this.spawnResolve=void 0,this.spawnReject=void 0;for(let t of e)this.write(t);if(this.pendingEndInput)this.pendingEndInput=!1,this.processStdin?.end()}spawnAbort(e){if(this.spawnReject)this.spawnReject(e),this.spawnReject=void 0,this.spawnResolve=void 0,this.pendingWrites=[]}updateEnv(e){if(this.options.env)Object.assign(this.options.env,e);else this.options.env={...e}}updateResume(e){this.options.resume=e}getDefaultExecutable(){return Sc()?"bun":"node"}spawnLocalProcess(e){let{command:t,args:n,cwd:r,env:o,signal:s}=e,i=W0e(t,n,{cwd:r,stdio:["pipe","pipe","pipe"],signal:s,env:o,windowsHide:!0}),a=new Z0e("utf8"),c=!1,l=!1,u=!1,p,f=Ie(o.DEBUG_CLAUDE_AGENT_SDK)||this.options.stderr!==void 0;i.stderr.on("data",(g)=>{if(u)return;let y=a.write(g);if(this.stderrTail+=y,this.stderrTail.length>2*KT)this.stderrTail=cE(vd(this.stderrTail),KT);if(f)_n(y),this.options.stderr?.(y)}),i.stderr.on("error",(g)=>{_n(`[ProcessTransport] stderr read failed: ${g.code??g.message}`)});let m=()=>{if(u)return;if(u=!0,p)clearTimeout(p);i.emit(f2,i.exitCode,i.signalCode);let g=i.stderr;if(rMe(g))g.unref();else g.destroy()};return i.stderr.once("close",()=>{if(this.stderrTail+=a.end(),c=!0,l)m()}),i.once("exit",()=>{if(l=!0,this.ready=!1,c)m();else p=setTimeout(m,J0e)}),{stdin:i.stdin,stdout:i.stdout,get killed(){return i.killed},get exitCode(){return i.exitCode},get signalCode(){return i.signalCode},kill:i.kill.bind(i),on:(g,y)=>i.on(GT(g),y),once:(g,y)=>i.once(GT(g),y),off:(g,y)=>i.off(GT(g),y)}}initialize(){try{let{additionalDirectories:e=[],agent:t,betas:n,cwd:r,executable:o=this.getDefaultExecutable(),executableArgs:s=[],extraArgs:i={},pathToClaudeCodeExecutable:a,env:c={...process.env},thinkingConfig:l,maxTurns:u,maxBudgetUsd:p,taskBudget:f,model:m,fallbackModel:h,jsonSchema:g,permissionMode:y,allowDangerouslySkipPermissions:S,permissionPromptToolName:b,continueConversation:x,resume:v,settingSources:A,skills:U,disallowedTools:D=[],tools:F,mcpServers:K,strictMcpConfig:V,canUseTool:ne,includePartialMessages:oe,plugins:_e,sandbox:ke}=this.options,{allowedTools:vt=[]}=this.options;if(U!==void 0){let te=U==="all"?["Skill"]:U.map((Re)=>`Skill(${Q0e(Re)})`),je=new Set(vt);vt=[...vt,...te.filter((Re)=>!je.has(Re))]}let Z=["--output-format","stream-json","--verbose","--input-format","stream-json"];if(l){switch(l.type){case"enabled":if(l.budgetTokens===void 0)Z.push("--thinking","adaptive");else Z.push("--max-thinking-tokens",l.budgetTokens.toString());break;case"disabled":Z.push("--thinking","disabled");break;case"adaptive":Z.push("--thinking","adaptive");break}if(l.type!=="disabled"&&l.display)Z.push("--thinking-display",l.display)}if(this.options.effort)Z.push("--effort",this.options.effort);if(u)Z.push("--max-turns",u.toString());if(p!==void 0)Z.push("--max-budget-usd",p.toString());if(f)Z.push("--task-budget",f.total.toString());if(m)Z.push("--model",m);if(t)Z.push("--agent",t);if(n&&n.length>0)Z.push("--betas",n.join(","));if(g)Z.push("--json-schema",me(g));if(this.options.debugFile)Z.push("--debug-file",this.options.debugFile);else if(this.options.debug)Z.push("--debug");if(!this.options.debugFile&&!this.options.spawnClaudeCodeProcess){let te=l2();if(te)Z.push("--debug-file",te)}if(ne){if(b)throw Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");Z.push("--permission-prompt-tool","stdio")}else if(b)Z.push("--permission-prompt-tool",b);if(x)Z.push("--continue");if(v)Z.push(`--resume=${v}`);if(this.options.channels&&this.options.channels.length>0)for(let te of this.options.channels)BT(Z,"channels",te);if(vt.length>0)Z.push("--allowedTools",vt.join(","));if(D.length>0)Z.push("--disallowedTools",D.join(","));if(F!==void 0)if(Array.isArray(F))if(F.length===0)Z.push("--tools","");else Z.push("--tools",F.join(","));else Z.push("--tools","default");if(K&&Object.keys(K).length>0)Z.push("--mcp-config",me({mcpServers:K}));if(A!==void 0)Z.push(`--setting-sources=${A.join(",")}`);if(V)Z.push("--strict-mcp-config");if(y)Z.push("--permission-mode",y);if(S)Z.push("--allow-dangerously-skip-permissions");if(h){if(m&&h===m)throw Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");Z.push("--fallback-model",h)}if(this.options.includeHookEvents)Z.push("--include-hook-events");if(oe)Z.push("--include-partial-messages");if(this.options.sessionMirror)Z.push("--session-mirror");for(let te of e)Z.push("--add-dir",te);if(_e&&_e.length>0)for(let te of _e)if(te.type==="local")Z.push(te.skipMcpDiscovery?"--plugin-dir-no-mcp":"--plugin-dir",te.path);else throw Error(`Unsupported plugin type: ${te.type}`);if(this.options.forkSession)Z.push("--fork-session");if(this.options.resumeSessionAt)Z.push(`--resume-session-at=${this.options.resumeSessionAt}`);if(this.options.resumeDropsTurn!==void 0)Z.push(`--resume-drops-turn=${this.options.resumeDropsTurn}`);if(this.options.sessionId)Z.push(`--session-id=${this.options.sessionId}`);if(this.options.persistSession===!1)Z.push("--no-session-persistence");if(this.options.managedSettings)Z.push("--managed-settings",this.options.managedSettings);let Je={...i??{}};if(this.options.settings)Je.settings=this.options.settings;let wt=u2(Je,ke);for(let[te,je]of Object.entries(wt))if(je===null)Z.push(`--${te}`);else BT(Z,te,je);if(!c.CLAUDE_CODE_ENTRYPOINT)c.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(delete c.NODE_OPTIONS,Ie(c.DEBUG_CLAUDE_AGENT_SDK))c.DEBUG="1";else delete c.DEBUG;let ht=eMe(a),cr=ht?a:o,Ot=ht?[...s,...Z]:[...s,a,...Z],se={command:cr,args:Ot,cwd:r,env:c,signal:this.forwardedAbort.signal};if(this.options.spawnClaudeCodeProcess)_n(`Spawning Claude Code (custom): ${cr} ${Ot.join(" ")}`),this.process=this.options.spawnClaudeCodeProcess(se);else _n(`Spawning Claude Code: ${cr} ${Ot.join(" ")}`),this.process=this.spawnLocalProcess(se);if(this.processStdin=this.process.stdin,this.processStdout=this.process.stdout,this.processStdin.on("error",(te)=>{_n(`[ProcessTransport] stdin write failed (child likely exited): ${te.code??te.message}`),this.ready=!1}),sy.track(this.process),this.abortHandler=()=>this.close(),this.abortController.signal.addEventListener("abort",this.abortHandler),this.abortController.signal.aborted)this.close();let Q=this.process;Q.on("error",(te)=>{this.ready=!1;let je=te,Re=je.syscall!==void 0?je.syscall.startsWith("spawn"):Lv(te);if(Re&&!Q.killed)sy.untrack(Q);if(this.abortController.signal.aborted)this.exitError=iy(),An(te,{telemetryMessage:"Claude Code process aborted by user",errorClass:"aborted"});else if(Re&&Lv(te)){let{message:Pt,telemetryMessage:Ut,errorClass:gt}=tMe(a,ht),On={telemetryMessage:`${Ut}${WT(te)}`,errorClass:gt,code:Hp(te)};this.exitError=An(ReferenceError(Pt),On),An(te,On),_n(this.exitError.message)}else{let Pt={telemetryMessage:Re?`Failed to spawn Claude Code process${WT(te)}`:`Claude Code process error${WT(te)}`,errorClass:Re?"spawn_failed":"process_error",code:Hp(te)};this.exitError=An(Error(`Failed to spawn Claude Code process: ${vd(te.message)}`),Pt),An(te,Pt),_n(this.exitError.message)}}),Q.on("exit",(te,je)=>{if(this.exitEventDelivered=!0,this.ready=!1,this.abortController.signal.aborted)this.exitError=iy();else{let Re=this.getProcessExitError(te,je);if(Re)this.exitError=Re,_n(Re.message)}}),this.ready=!this.abortController.signal.aborted}catch(e){throw this.ready=!1,e}}getProcessExitError(e,t){if(e!==0&&e!==null){let n=Number.isInteger(e)?e:void 0;return An(Error(`Claude Code process exited with code ${e}${this.formatStderrTail()}`),{telemetryMessage:`Claude Code process exited with code ${n??"unknown"}`,errorClass:"process_exited_nonzero",exitCode:n})}else if(t){let n=/^SIG[A-Z0-9]{1,8}$/.test(t)?t:"unknown";return An(Error(`Claude Code process terminated by signal ${t}${this.formatStderrTail()}`),{telemetryMessage:`Claude Code process terminated by signal ${n}`,errorClass:"process_killed_by_signal",signal:n})}return}formatStderrTail(){let e=cE(vd(this.stderrTail),KT).trim();return e?`. stderr: ${e}`:""}write(e){if(this.abortController.signal.aborted)throw d2();if(this.spawnResolve){this.pendingWrites.push(e);return}if(!this.ready||!this.processStdin)throw Error("ProcessTransport is not ready for writing");if(this.processStdin.writableEnded){_n("[ProcessTransport] Dropping write to ended stdin stream");return}if(this.process?.killed||this.process?.exitCode!==null)throw Error("Cannot write to terminated process");if(this.exitError)throw An(Error(`Cannot write to process that exited with error: ${this.exitError.message}`),{telemetryMessage:`Cannot write to process that exited with error: ${kN(this.exitError)??"untagged exit error"}`,errorClass:p2(this.exitError,"errorClass"),code:Hp(this.exitError),exitCode:nMe(this.exitError),signal:p2(this.exitError,"signal")});_n(`[ProcessTransport] Writing to stdin: ${e.substring(0,100)}`);try{if(!this.processStdin.write(e))_n("[ProcessTransport] Write buffer full, data queued")}catch(t){throw this.ready=!1,Error(`Failed to write to process stdin: ${Ho(t)}`)}}[Symbol.dispose](){this.close()}close(){if(this.spawnAbort(this.abortController.signal.aborted?iy():Error("Query closed before spawn")),this.processStdin)this.processStdin.end(),this.processStdin=void 0;if(this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;let e=this.process?.exitCode??null,t=this.process?.signalCode??null,n=!this.exitEventDelivered&&(e!==null&&e>=0||t!==null),r;if(n){if(this.exitEventDelivered=!0,r=this.abortController.signal.aborted?iy():this.getProcessExitError(e,t),r&&!this.exitError)this.exitError=r}let o=this.exitListeners;this.exitListeners=[];for(let{callback:a,handler:c}of o)if(this.process?.off("exit",c),n)try{a(r)}catch(l){_n(`[ProcessTransport] onExit callback threw during close(): ${Ho(l)}`)}let s=()=>{if(this.abortController.signal.aborted)this.forwardedAbort.abort(this.abortController.signal.reason)},i=this.process;if(i&&!i.killed&&i.exitCode===null&&i.signalCode==null)setTimeout((a,c)=>{if(a.exitCode!==null||a.signalCode!=null){c();return}if(process.platform==="win32"){setTimeout((l,u)=>{if(l.exitCode===null)l.kill("SIGKILL");u()},5000,a,c).unref();return}a.kill("SIGTERM"),setTimeout((l)=>{if(l.exitCode===null)l.kill("SIGKILL")},5000,a).unref(),c()},Y0e,i,s).unref(),i.once("exit",()=>sy.untrack(i));else if(i)sy.untrack(i),s();this.ready=!1}isReady(){return this.ready}async*readMessages(){if(this.spawnPromise)await this.spawnPromise,this.spawnPromise=void 0;if(!this.processStdout)throw Error("ProcessTransport output stream not available");if(this.exitError)throw this.exitError;let e=V0e({input:this.processStdout}),t=this.process?(()=>{let n=this.process,r=()=>e.close();return n.on("error",r),()=>n.off("error",r)})():void 0;if(this.exitError)e.close();try{for await(let n of e)if(n.trim()){let r;try{r=yt(n)}catch(o){_n(`Non-JSON stdout: ${n}`);continue}yield r}if(this.exitError)throw this.exitError;await this.waitForExit()}finally{t?.(),e.close()}}endInput(){if(this.spawnResolve){this.pendingEndInput=!0;return}if(this.processStdin)this.processStdin.end()}getInputStream(){return this.processStdin}onExit(e){if(!this.process)return()=>{};let t=(n,r)=>{let o=this.getProcessExitError(n,r);e(o)};return this.process.on("exit",t),this.exitListeners.push({callback:e,handler:t}),()=>{if(this.process)this.process.off("exit",t);let n=this.exitListeners.findIndex((r)=>r.handler===t);if(n!==-1)this.exitListeners.splice(n,1)}}async waitForExit(){if(this.exitError)throw this.exitError;if(!this.process||this.process.exitCode===0||this.process.killed&&this.exitEventDelivered)return;return new Promise((e,t)=>{let n=(o,s)=>{if(this.abortController.signal.aborted){t(d2());return}let i=this.getProcessExitError(o,s);if(i)t(i);else e()};this.process.once("exit",n);let r=(o)=>{this.process.off("exit",n),t(o)};this.process.once("error",r),this.process.once("exit",()=>{this.process.off("error",r)})})}}function eMe(e){return![".js",".mjs",".tsx",".ts",".jsx"].some((n)=>e.endsWith(n))}function tMe(e,t){let n=t?"native binary":"executable",r=vd(e);if(q0e(e))return{message:t?`Claude Code native binary at ${r} exists but failed to launch. This usually means the binary does not match this system's libc — e.g. spawning a musl-linked binary on a glibc Linux host fails because the musl dynamic loader (/lib/ld-musl-*) is missing. Specify a matching binary with options.pathToClaudeCodeExecutable.`:`Claude Code executable at ${r} exists but failed to launch.`,telemetryMessage:`Claude Code ${n} exists at the configured path but failed to launch`,errorClass:"executable_launch_failed"};return{message:t?`Claude Code native binary not found at ${r}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${r}. Is options.pathToClaudeCodeExecutable set?`,telemetryMessage:`Claude Code ${n} not found at the configured path`,errorClass:"executable_not_found"}}function WT(e){let t=Hp(e);return t===void 0?"":` (${t})`}function iy(){return An(new dr("Claude Code process aborted by user"),{telemetryMessage:"Claude Code process aborted by user",errorClass:"aborted"})}function d2(){return An(new dr("Operation aborted"),{telemetryMessage:"Operation aborted",errorClass:"aborted"})}function p2(e,t){let n=Object.hasOwn(e,t)?Reflect.get(e,t):void 0;return typeof n==="string"?n:void 0}function nMe(e){let t=Object.hasOwn(e,"exitCode")?Reflect.get(e,"exitCode"):void 0;return typeof t==="number"?t:void 0}function rMe(e){return typeof Reflect.get(e,"unref")==="function"}import{existsSync as oMe}from"fs";var lu="@anthropic-ai/claude-agent-sdk";function sMe(){if(process.platform!=="linux")return!1;let e=typeof process.report?.getReport==="function"?process.report.getReport():null;return e!=null&&e.header?.glibcVersionRuntime===void 0}function h2(e,t={}){let n=t.platform??process.platform,r=t.arch??process.arch,o=t.exists??oMe,s=t.preferMusl??sMe(),i="claude",a=n==="win32"?".exe":"",l=(n==="android"?[`${lu}-linux-${r}-android`]:n==="linux"?s?[`${lu}-linux-${r}-musl`,`${lu}-linux-${r}`]:[`${lu}-linux-${r}`,`${lu}-linux-${r}-musl`]:[`${lu}-${n}-${r}`]).map((u)=>`${u}/claude${a}`);for(let u of l)try{let p=e(u);if(o(p))return p}catch{}return null}var iMe=["signed_out","identity_changed","transient","refresh_failed"];function g2(e){return iMe.some((t)=>t===e)}class Lf{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(e){this.returned=e}[Symbol.asyncIterator](){if(this.started)throw Error("Stream can only be iterated once");return this.started=!0,this}next(){if(this.queue.length>0)return Promise.resolve({done:!1,value:this.queue.shift()});if(this.isDone)return Promise.resolve({done:!0,value:void 0});if(this.hasError)return Promise.reject(this.hasError);return new Promise((e,t)=>{this.readResolve=e,this.readReject=t})}enqueue(e){if(this.readResolve){let t=this.readResolve;this.readResolve=void 0,this.readReject=void 0,t({done:!1,value:e})}else this.queue.push(e)}done(){if(this.isDone=!0,this.readResolve){let e=this.readResolve;this.readResolve=void 0,this.readReject=void 0,e({done:!0,value:void 0})}}error(e){if(this.hasError=e,this.readReject){let t=this.readReject;this.readResolve=void 0,this.readReject=void 0,t(e)}}return(){if(this.isDone=!0,this.returned)this.returned();return Promise.resolve({done:!0,value:void 0})}}var aMe=1000;function cMe(){return{eventQueue:[],sink:null,droppedEventCount:0}}function lMe(e,t){if(e.eventQueue.length>=aMe)e.eventQueue.shift(),e.droppedEventCount++;e.eventQueue.push(t)}class _2{state=cMe()}var uMe=new tt(()=>new _2);function dMe(){return uMe.of(Tt().host)}function uu(e,t){let n=dMe().state;if(n.sink===null){lMe(n,{eventName:e,metadata:t,async:!1});return}n.sink.logEvent(e,t)}function VT(e,t){uu("tengu_feature_ok",{feature_name:rl(e),...t})}function ZT(e,t,n){uu("tengu_feature_bad",{...n,feature_name:rl(e),error_code:t})}function y2(e,t,n){uu("tengu_feature_sad",{...n,feature_name:rl(e),error_code:t})}async function Tr(e,t,n){try{let r=await t();return VT(e),r}catch(r){throw ZT(e,n?.(r)??"error"),r}}class YT{sendMcpMessage;isClosed=!1;constructor(e){this.sendMcpMessage=e}onclose;onerror;onmessage;async start(){}async send(e){if(this.isClosed)throw Error("Transport is closed");this.sendMcpMessage(e)}async close(){if(this.isClosed)return;this.isClosed=!0,this.onclose?.()}}var Mf=Symbol("suppressControlResponse");class ay{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;onElicitation;getOAuthToken;getHostAuthToken;onUserDialog;pendingControlResponses=new Map;unmatchedControlResponses=new Map;static UNMATCHED_CONTROL_RESPONSES_MAX=1024;cleanupPerformed=!1;sdkMessages;inputStream=new Lf;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;initHooksPayload;sdkMcpTransports=new Map;sdkMcpServerInstances=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;lastErrorResultText;latestCommands;transcriptMirrorBatcher;cleanupCallbacks=[];cleanupPromise;setIsSingleUserTurn(e){this.isSingleUserTurn=e}setTranscriptMirrorBatcher(e){this.transcriptMirrorBatcher=e}reportMirrorError(e,t){let n={type:"system",subtype:"mirror_error",error:t,key:e,uuid:Bp(),session_id:e.sessionId};this.inputStream.enqueue(n)}addCleanupCallback(e){if(this.cleanupPerformed)e();else this.cleanupCallbacks.push(e)}isClosed(){return this.cleanupPerformed}hasBidirectionalNeeds(){return this.sdkMcpTransports.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0||this.onElicitation!==void 0||this.onUserDialog!==void 0||this.getOAuthToken!==void 0||this.getHostAuthToken!==void 0}constructor(e,t,n,r,o,s=new Map,i,a,c,l,u,p){this.transport=e;this.isSingleUserTurn=t;this.canUseTool=n;this.hooks=r;this.abortController=o;this.jsonSchema=i;this.initConfig=a;this.onElicitation=c;this.getOAuthToken=l;this.getHostAuthToken=u;this.onUserDialog=p;for(let[f,m]of s)this.connectSdkMcpServer(f,m);this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(e){this.inputStream.error(e)}async stopTask(e){await this.request({subtype:"stop_task",task_id:e})}async backgroundTasks(e){return(await this.request({subtype:"background_tasks",tool_use_id:e})).response.backgrounded??!0}close(){this.cleanup()}cleanup(e){if(this.cleanupPromise)return this.cleanupPromise;return this.cleanupPerformed=!0,this.cleanupPromise=this.performCleanup(e),this.cleanupPromise}async performCleanup(e){for(let t of this.cleanupCallbacks)try{t()}catch{}if(this.cleanupCallbacks=[],this.transcriptMirrorBatcher)try{await this.transcriptMirrorBatcher.flush()}catch{}try{for(let n of this.cancelControllers.values())n.abort();this.cancelControllers.clear(),this.transport.close();let t=e??Error("Query closed before response received");for(let{reject:n}of this.pendingControlResponses.values())n(t);this.pendingControlResponses.clear(),this.unmatchedControlResponses.clear();for(let{reject:n}of this.pendingMcpResponses.values())n(t);this.pendingMcpResponses.clear(),this.hookCallbacks.clear();for(let n of this.sdkMcpTransports.values())n.close().catch(()=>{});if(this.sdkMcpTransports.clear(),e)this.inputStream.error(e);else this.inputStream.done()}catch(t){}if(this.transport.waitForExit){let t=new AbortController;try{await Promise.race([this.transport.waitForExit(),to(2000,t.signal)])}catch{}finally{t.abort()}}}next(...[e]){return this.sdkMessages.next(...[e])}async return(e){return await this.cleanup(),this.sdkMessages.return(e)}async throw(e){return await this.cleanup(),this.sdkMessages.throw(e)}[Symbol.asyncIterator](){return this.sdkMessages}async[Symbol.asyncDispose](){await this.cleanup()}async readMessages(){try{for await(let e of this.transport.readMessages()){if(e.type==="control_response"){let t=this.pendingControlResponses.get(e.response.request_id);if(t)t.handler(e.response);else{if(this.unmatchedControlResponses.size>=ay.UNMATCHED_CONTROL_RESPONSES_MAX){let n=this.unmatchedControlResponses.keys().next().value;if(n!==void 0)this.unmatchedControlResponses.delete(n)}this.unmatchedControlResponses.set(e.response.request_id,e.response)}continue}else if(e.type==="control_request"){this.handleControlRequest(e);continue}else if(e.type==="control_cancel_request"){this.handleControlCancelRequest(e);continue}else if(e.type==="keep_alive")continue;else if(e.type==="transcript_mirror"){this.transcriptMirrorBatcher?.enqueue(e.filePath,e.entries);continue}if(e.type==="system"&&e.subtype==="commands_changed"&&Array.isArray(e.commands))this.latestCommands=e.commands;if(e.type==="system"&&(e.subtype==="post_turn_summary"||e.subtype==="task_summary")){this.inputStream.enqueue(e);continue}if(e.type==="active_goal"){this.inputStream.enqueue(e);continue}if(e.type==="autocompact_state"){this.inputStream.enqueue(e);continue}if(e.type==="result"){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();let t=e.is_error?e.subtype==="success"?e.result:e.errors.map((n)=>n.trim()).filter(Boolean).join("; "):void 0;if(this.lastErrorResultText=t||void 0,this.firstResultReceived=!0,this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.isSingleUserTurn)de("[Query.readMessages] First result received for single-turn query, closing stdin"),this.transport.endInput()}else if(!(e.type==="system"&&e.subtype==="session_state_changed"))this.lastErrorResultText=void 0;this.inputStream.enqueue(e)}if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();this.inputStream.done(),this.cleanup()}catch(e){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.lastErrorResultText!==void 0&&!(e instanceof dr)&&e?.name!=="SSEHttpError"){let t=An(Error(`Claude Code returned an error result: ${this.lastErrorResultText}`),{telemetryMessage:"Claude Code returned an error result",errorClass:"error_result"});de(`[Query.readMessages] Replacing exit error with result text. Original: ${Ho(e)}`),this.inputStream.error(t),this.cleanup(t);return}this.inputStream.error(e),this.cleanup(e)}}async handleControlRequest(e){if(this.cancelControllers.has(e.request_id)){de(`[Query.handleControlRequest] Duplicate delivery of in-flight request ${e.request_id} (${e.request.subtype}) — skipping`);return}let t=new AbortController;this.cancelControllers.set(e.request_id,t);try{let n=await this.processControlRequest(e,t.signal);if(this.cleanupPerformed)return;if(n===Mf)return;let r={type:"control_response",response:{subtype:"success",request_id:e.request_id,response:n}};await Promise.resolve(this.transport.write(me(r)+`
100
- `))}catch(n){if(this.cleanupPerformed)return;let r={type:"control_response",response:{subtype:"error",request_id:e.request_id,error:Ho(n)}};try{await Promise.resolve(this.transport.write(me(r)+`
101
- `))}catch(o){de(`[Query.handleControlRequest] Error-response write failed: ${Ho(o)}`,{level:"error"})}}finally{this.cancelControllers.delete(e.request_id)}}handleControlCancelRequest(e){let t=this.cancelControllers.get(e.request_id);if(t)t.abort(),this.cancelControllers.delete(e.request_id)}async processControlRequest(e,t){if(e.request.subtype==="can_use_tool"){if(!this.canUseTool)throw Error("canUseTool callback is not provided.");let n=await this.canUseTool(e.request.tool_name,e.request.input,{signal:t,suggestions:e.request.permission_suggestions,blockedPath:e.request.blocked_path,decisionReason:e.request.decision_reason,title:e.request.title,displayName:e.request.display_name,description:e.request.description,toolUseID:e.request.tool_use_id,agentID:e.request.agent_id,requestId:e.request_id,...e.request.matched_ask_rule&&{matchedAskRule:{source:e.request.matched_ask_rule.source,toolName:e.request.matched_ask_rule.tool_name,...e.request.matched_ask_rule.rule_content!==void 0&&{ruleContent:e.request.matched_ask_rule.rule_content}}}});if(n===null)return Mf;return{...n,toolUseID:e.request.tool_use_id}}else if(e.request.subtype==="hook_callback")return await this.handleHookCallbacks(e.request.callback_id,e.request.input,e.request.tool_use_id,t);else if(e.request.subtype==="mcp_message"){let n=e.request,r=this.sdkMcpTransports.get(n.server_name);if(!r)throw Error(`SDK MCP server not found: ${n.server_name}`);if("method"in n.message&&"id"in n.message&&n.message.id!==null)return{mcp_response:await this.handleMcpControlRequest(n.server_name,n,r)};else{if(r.onmessage)r.onmessage(n.message);return{mcp_response:{jsonrpc:"2.0",result:{},id:0}}}}else if(e.request.subtype==="elicitation"){let n=e.request;if(this.onElicitation){let r=await this.onElicitation({serverName:n.mcp_server_name,message:n.message,mode:n.mode,url:n.url,elicitationId:n.elicitation_id,requestedSchema:n.requested_schema,title:n.title,displayName:n.display_name,description:n.description},{signal:t,requestId:e.request_id});if(r===null)return Mf;return r}return{action:"decline"}}else if(e.request.subtype==="request_user_dialog"){if(this.onUserDialog){let n=await this.onUserDialog({dialogKind:e.request.dialog_kind,payload:e.request.payload,toolUseID:e.request.tool_use_id},{signal:t,requestId:e.request_id});if(n===null)return Mf;return n}return de(`[Query] No onUserDialog handler for request_user_dialog (kind=${e.request.dialog_kind}) — staying silent so a capable client (or the worker's park deadline) settles it`),uu("tengu_request_user_dialog_response_ignored",{shape:rl("auto_cancel")}),Mf}else if(e.request.subtype==="oauth_token_refresh"){if(!this.getOAuthToken)throw Error("getOAuthToken callback is not provided.");let n,r=await this.getOAuthToken({signal:t,onDecline:(o)=>{if(g2(o))n=o}})??null;return r===null&&n!==void 0?{accessToken:r,reason:n}:{accessToken:r}}else if(e.request.subtype==="host_auth_token_refresh"){if(!this.getHostAuthToken)throw Error("getHostAuthToken callback is not provided.");let n=await this.getHostAuthToken({signal:t})??null;return typeof n==="string"||n===null?{authToken:n}:n}throw Error("Unsupported control request subtype: "+e.request.subtype)}async*readSdkMessages(){try{for await(let e of this.inputStream)yield e}finally{await this.cleanup()}}async initialize(){if(this.hooks&&!this.initHooksPayload){this.initHooksPayload={};for(let[r,o]of Object.entries(this.hooks))if(o.length>0)this.initHooksPayload[r]=o.map((s)=>{let i=[];for(let a of s.hooks){let c=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(c,a),i.push(c)}return{matcher:s.matcher,hookCallbackIds:i,timeout:s.timeout}})}let e=this.sdkMcpTransports.size>0?Array.from(this.sdkMcpTransports.keys()):void 0,t={subtype:"initialize",hooks:this.initHooksPayload,sdkMcpServers:e,jsonSchema:this.jsonSchema,systemPrompt:typeof this.initConfig?.systemPrompt==="string"?[this.initConfig.systemPrompt]:this.initConfig?.systemPrompt,appendSystemPrompt:this.initConfig?.appendSystemPrompt,planModeInstructions:this.initConfig?.planModeInstructions,appendSubagentSystemPrompt:this.initConfig?.appendSubagentSystemPrompt,toolAliases:this.initConfig?.toolAliases,excludeDynamicSections:this.initConfig?.excludeDynamicSections,agents:this.initConfig?.agents,title:this.initConfig?.title,skills:Array.isArray(this.initConfig?.skills)?this.initConfig.skills:void 0,webSearchIsolationExemptMcpServers:this.initConfig?.webSearchIsolationExemptMcpServers,promptSuggestions:this.initConfig?.promptSuggestions,agentProgressSummaries:this.initConfig?.agentProgressSummaries,forwardSubagentText:this.initConfig?.forwardSubagentText,supportedDialogKinds:this.initConfig?.supportedDialogKinds,perTaskStopAffordance:this.initConfig?.perTaskStopAffordance};return(await this.request(t)).response}async interrupt(e){return Tr("sdk_interrupt",async()=>{let t=await this.request({subtype:"interrupt",...e?.cancelQueued===!0&&{cancel_queued:!0}}),n=t.response?.still_queued;if(!Array.isArray(n))return;let r=t.response?.cancelled;return{still_queued:n.filter((o)=>typeof o==="string"),...Array.isArray(r)&&{cancelled:r.filter((o)=>typeof o==="string")}}})}async setPermissionMode(e){await this.request({subtype:"set_permission_mode",mode:e})}async setMcpPermissionModeOverride(e,t){return(await this.request({subtype:"set_mcp_permission_mode_override",serverName:e,mode:t})).response??{}}awaitControlResponse(e){return this.transport.expectControlResponse?.(e),new Promise((t,n)=>{let r=(s)=>{if(s.subtype==="success"){let{pending_permission_requests:i,pending_user_dialog_requests:a,...c}=s;t(c)}else n(new qe(s.error,"awaitControlResponse: CLI error verdict"));if(s.pending_permission_requests||s.pending_user_dialog_requests)de("[Query] Ignoring prompt-redelivery fields on awaitControlResponse response")};if(this.cleanupPerformed){n(Error("Query closed before response received"));return}let o=this.unmatchedControlResponses.get(e);if(o){this.unmatchedControlResponses.delete(e),r(o);return}this.pendingControlResponses.set(e,{handler:(s)=>{this.pendingControlResponses.delete(e),r(s)},reject:n})})}async setModel(e){await this.request({subtype:"set_model",model:e})}async setMaxThinkingTokens(e,t){await this.request({subtype:"set_max_thinking_tokens",max_thinking_tokens:e,thinking_display:t})}async applyFlagSettings(e){return Tr("sdk_apply_flag_settings",async()=>{await this.request({subtype:"apply_flag_settings",settings:e})})}async getSettings(){return(await this.request({subtype:"get_settings"})).response}async rewindFiles(e,t){return Tr("sdk_rewind_files",async()=>(await this.request({subtype:"rewind_files",user_message_id:e,dry_run:t?.dryRun})).response)}async cancelAsyncMessage(e){return(await this.request({subtype:"cancel_async_message",message_uuid:e})).response.cancelled}async seedReadState(e,t){await this.request({subtype:"seed_read_state",path:e,mtime:t})}async setCwd(e,t){return Tr("sdk_set_cwd",async()=>(await this.request({subtype:"set_cwd",path:e,...t?.trustAccepted!==void 0&&{trust_accepted:t.trustAccepted},...t?.trustedDirectory!==void 0&&{trusted_directory:t.trustedDirectory}})).response)}async enableRemoteControl(e,t,n){return(await this.request({subtype:"remote_control",enabled:e,...t!==void 0&&{name:t},reattach_session_id:n?.reattachSessionId,keep_session_on_exit:n?.keepSessionOnExit})).response}async submitFeedback(e,t){return(await this.request({subtype:"submit_feedback",description:e,surface:t?.surface,draft_id:t?.draft_id,type:t?.type,title:t?.title,area:t?.area,attach_transcript:t?.attach_transcript})).response}async generateSessionTitle(e,t){return Tr("sdk_session_title_generate",async()=>(await this.request({subtype:"generate_session_title",description:e,persist:t?.persist})).response.title)}async askSideQuestion(e,t){return Tr("sdk_side_question",async()=>{let r=(await this.request({subtype:"side_question",question:e,...t?.history?.length&&{history:[...t.history]}},t)).response;return r.response===null?null:{response:r.response,synthetic:r.synthetic??!1,...r.refusal_fallback&&{refusalFallback:{originalModel:r.refusal_fallback.original_model,fallbackModel:r.refusal_fallback.fallback_model,content:r.refusal_fallback.content}}}},()=>t?.signal?.aborted?"cancelled":"error")}async launchUltrareview(e,t){return(await this.request({subtype:"ultrareview_launch",args:e,confirm:t?.confirm??!1})).response}async messageRated(e){await this.request({subtype:"message_rated",messageUuid:e.messageUuid,sentiment:e.sentiment,surface:e.surface,cleared:e.cleared??!1})}processPendingPermissionRequests(e){for(let t of e)if(t.request.subtype==="can_use_tool")this.handleControlRequest(t).catch(()=>{})}processPendingUserDialogRequests(e){for(let t of e)if(t.request.subtype==="request_user_dialog")this.handleControlRequest(t).catch(()=>{})}request(e,t){let n=Math.random().toString(36).substring(2,15);this.transport.expectControlResponse?.(n);let r={request_id:n,type:"control_request",request:e},o=e.subtype==="initialize";return new Promise((s,i)=>{let a=t?.signal,c,l=(p)=>{c?.(),s(p)},u=(p)=>{c?.(),i(p)};if(a){let p=()=>{this.pendingControlResponses.delete(n),u(Ur(a.reason??"Control request aborted"));try{Promise.resolve(this.transport.write(me({type:"control_cancel_request",request_id:n})+`
102
- `)).catch(()=>{})}catch{}};if(a.aborted){p();return}a.addEventListener("abort",p,{once:!0}),c=()=>{a.removeEventListener("abort",p)}}this.pendingControlResponses.set(n,{handler:(p)=>{if(this.pendingControlResponses.delete(n),p.subtype==="success")l(p);else u(An(Error(p.error),{telemetryMessage:`Claude Code control request failed (${e.subtype})`,errorClass:"control_request_failed"}));if(!o&&(p.pending_permission_requests||p.pending_user_dialog_requests))de(`[Query] Ignoring prompt-redelivery fields on non-initialize response (subtype=${e.subtype})`);else{if(p.pending_permission_requests)this.processPendingPermissionRequests(p.pending_permission_requests);if(p.pending_user_dialog_requests)this.processPendingUserDialogRequests(p.pending_user_dialog_requests)}},reject:u}),Promise.resolve(this.transport.write(me(r)+`
103
- `)).catch((p)=>{this.pendingControlResponses.delete(n),u(p)})})}initializationResult(){return this.initialization}reinitialize(){return Tr("sdk_reinitialize",()=>this.initialize())}async supportedCommands(){let{commands:e}=await this.initialization;return this.latestCommands??e}async supportedModels(){return(await this.initialization).models}async supportedAgents(){return(await this.initialization).agents}async reconnectMcpServer(e){await this.request({subtype:"mcp_reconnect",serverName:e})}async toggleMcpServer(e,t){return Tr("sdk_mcp_toggle_server",async()=>{await this.request({subtype:"mcp_toggle",serverName:e,enabled:t})})}async enableChannel(e){return Tr("sdk_mcp_enable_channel",async()=>{await this.request({subtype:"channel_enable",serverName:e})})}async mcpAuthenticate(e,t){return(await this.request({subtype:"mcp_authenticate",serverName:e,redirectUri:t})).response}async mcpClearAuth(e){return(await this.request({subtype:"mcp_clear_auth",serverName:e})).response}async mcpSubmitOAuthCallbackUrl(e,t){return(await this.request({subtype:"mcp_oauth_callback_url",serverName:e,callbackUrl:t})).response}async claudeAuthenticate(e){return(await this.request({subtype:"claude_authenticate",loginWithClaudeAi:e})).response}async claudeOAuthCallback(e,t){return(await this.request({subtype:"claude_oauth_callback",authorizationCode:e,state:t})).response}async claudeOAuthWaitForCompletion(){return(await this.request({subtype:"claude_oauth_wait_for_completion"})).response}async mcpServerStatus(){return(await this.request({subtype:"mcp_status"})).response.mcpServers}async getContextUsage(){return(await this.request({subtype:"get_context_usage"})).response}async usage_EXPERIMENTAL_MAY_CHANGE_DO_NOT_RELY_ON_THIS_API_YET(){return(await this.request({subtype:"get_usage"})).response}async readFile(e,t){try{return(await this.request({subtype:"read_file",path:e,max_bytes:t?.maxBytes,encoding:t?.encoding})).response}catch{return null}}async reloadPlugins(){return Tr("sdk_reload_plugins",async()=>(await this.request({subtype:"reload_plugins"})).response)}async reloadSkills(){return Tr("sdk_reload_skills",async()=>(await this.request({subtype:"reload_skills"})).response)}async setMcpServers(e){return Tr("sdk_mcp_set_servers",async()=>{let t={},n={};for(let[a,c]of Object.entries(e))if(c.type==="sdk"&&"instance"in c)t[a]=c.instance;else n[a]=c;let r=new Set(this.sdkMcpServerInstances.keys()),o=new Set(Object.keys(t));for(let a of r)if(!o.has(a))await this.disconnectSdkMcpServer(a);for(let[a,c]of Object.entries(t))if(!r.has(a))this.connectSdkMcpServer(a,c);let s={};for(let a of Object.keys(t))s[a]={type:"sdk",name:a};return(await this.request({subtype:"mcp_set_servers",servers:{...n,...s}})).response})}async accountInfo(){return(await this.initialization).account}async streamInput(e){de("[Query.streamInput] Starting to process input stream");try{let t=0;for await(let n of e){if(t++,de(`[Query.streamInput] Processing message ${t}: ${n.type}`),this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(me(n)+`
104
- `))}if(de(`[Query.streamInput] Finished processing ${t} messages from input stream`),t>0&&this.hasBidirectionalNeeds())de("[Query.streamInput] Has bidirectional needs, waiting for first result"),await this.waitForFirstResult();de("[Query] Calling transport.endInput() to close stdin to CLI process"),this.transport.endInput()}catch(t){if(!(t instanceof dr))throw t}}waitForFirstResult(){if(this.firstResultReceived)return de("[Query.waitForFirstResult] Result already received, returning immediately"),Promise.resolve();return new Promise((e)=>{let t=this.abortController?.signal;if(this.cleanupPerformed||t?.aborted){e();return}let n=()=>e();t?.addEventListener("abort",n,{once:!0}),this.addCleanupCallback(()=>{t?.removeEventListener("abort",n),e()}),this.firstResultReceivedResolve=()=>{t?.removeEventListener("abort",n),e()}})}handleHookCallbacks(e,t,n,r){let o=this.hookCallbacks.get(e);if(!o)throw Error(`No hook callback found for ID: ${e}`);return o(t,n,{signal:r})}connectSdkMcpServer(e,t){let n=new YT((r)=>this.sendMcpServerMessageToCli(e,r));this.sdkMcpTransports.set(e,n),this.sdkMcpServerInstances.set(e,t),t.connect(n).catch((r)=>{if(this.sdkMcpTransports.get(e)===n)this.sdkMcpTransports.delete(e);if(this.sdkMcpServerInstances.get(e)===t)this.sdkMcpServerInstances.delete(e);de(`[Query.connectSdkMcpServer] Failed to connect MCP server '${e}': ${r}`,{level:"error"})})}async disconnectSdkMcpServer(e){let t=this.sdkMcpTransports.get(e);if(t)await t.close(),this.sdkMcpTransports.delete(e);this.sdkMcpServerInstances.delete(e)}sendMcpServerMessageToCli(e,t){if("id"in t&&t.id!==null&&t.id!==void 0){let r=`${e}:${t.id}`,o=this.pendingMcpResponses.get(r);if(o){o.resolve(t),this.pendingMcpResponses.delete(r);return}}let n={type:"control_request",request_id:Bp(),request:{subtype:"mcp_message",server_name:e,message:t}};Promise.resolve(this.transport.write(me(n)+`
105
- `)).catch((r)=>{de(`[Query.sendMcpServerMessageToCli] Transport write failed: ${r}`,{level:"error"})})}handleMcpControlRequest(e,t,n){let r="id"in t.message?t.message.id:null,o=`${e}:${r}`;return new Promise((s,i)=>{let a=()=>{this.pendingMcpResponses.delete(o)},c=(u)=>{a(),s(u)},l=(u)=>{a(),i(u)};if(this.pendingMcpResponses.set(o,{resolve:c,reject:l}),n.onmessage)n.onmessage(t.message);else{a(),i(Error("No message handler registered"));return}})}}var cy=500,du=1048576;var pMe=[200,800];class JT{send;pending=[];pendingEntries=0;pendingBytes=0;flushPromise=null;sendTimeoutMs;onError;maxPendingEntries;maxPendingBytes;backoffMs;constructor(e,t){this.send=e;let{sendTimeoutMs:n=60000,onError:r,maxPendingEntries:o=cy,maxPendingBytes:s=du,backoffMs:i=pMe}=t??{};this.sendTimeoutMs=n,this.onError=r,this.maxPendingEntries=o,this.maxPendingBytes=s,this.backoffMs=i}enqueue(e,t){let n=me(t).length;if(this.pending.push({filePath:e,entries:t,bytes:n}),this.pendingEntries+=t.length,this.pendingBytes+=n,this.pendingEntries>this.maxPendingEntries||this.pendingBytes>this.maxPendingBytes)this.flushPromise=this.drain(),this.flushPromise.catch(()=>{})}async flush(){let e=this.drain();if(this.flushPromise=e,await e,this.flushPromise===e)this.flushPromise=null}async drain(){let e=this.flushPromise,t=this.pending.splice(0);if(this.pendingEntries=0,this.pendingBytes=0,e)await e;if(t.length===0)return;await this.doFlush(t)}async doFlush(e){let t=new Map;for(let n of e){let r=t.get(n.filePath);if(r)r.push(...n.entries);else t.set(n.filePath,n.entries.slice())}for(let[n,r]of t)await this.sendWithRetry(n,r)}async sendWithRetry(e,t){let n=this.backoffMs.length+1,r=`SessionStore.append() timed out after ${this.sendTimeoutMs}ms for ${e}`,o,s=1;for(;s<=n;s++)try{await Or(this.send(e,t),this.sendTimeoutMs,r),o=void 0;break}catch(i){if(o=Ur(i),o.message===r)break;let a=this.backoffMs[s-1];if(a===void 0)break;await to(a)}if(o){de(`[TranscriptMirrorBatcher] flush failed for ${e} after ${s} attempt(s): ${o}`,{level:"error"});try{this.onError?.(e,o)}catch(i){de(`[TranscriptMirrorBatcher] onError callback threw: ${i}`,{level:"error"})}}}}var VS=Hn(mW(),1);var hW="\\p{Default_Ignorable_Code_Point}\\u2800",gu=`\\p{Cc}\\p{Cf}\\p{Cs}\\p{Co}\\p{Cn}\\u2028\\u2029${hW}`,ACt=new RegExp(`[${gu}]+`,"gu"),TCt=new RegExp(`(?:(?![\\u200D\\uFE0E\\uFE0F])[${gu}])+`,"gu"),CCt=new RegExp(`(?:(?![\\u200D\\uFE0E\\uFE0F\\n])[${gu}])+`,"gu");var kCt=new RegExp(`[\\p{Cf}\\p{Co}\\p{Cn}\\u2028\\u2029\\u007F-\\u009F${hW}]`,"gu");function RUe(e){let t=e.replace(/[\p{Cf}\p{Co}\p{Cn}]/gu,"");return t=t.replace(/[\u200B-\u200F]/g,"").replace(/[\u202A-\u202E]/g,"").replace(/[\u2066-\u2069]/g,"").replace(/[\uFEFF]/g,"").replace(/[\uE000-\uF8FF]/g,""),t}function OUe(e){let t=lE(e);for(let n=0;n<10;n++){let r=RUe(t);if(r===t)return t;t=r}return t}function PUe(e){let t=e,n="",r=0,o=10;while(t!==n&&r<o)n=t,t=t.normalize("NFKC"),t=OUe(t),r++;if(r>=o)throw Error(`Unicode sanitization reached maximum iterations (${o}) for input: ${e.slice(0,100)}`);return t}function za(e){if(typeof e==="string")return PUe(e);if(Array.isArray(e))return e.map(za);if(e!==null&&typeof e==="object"){let t={};for(let[n,r]of Object.entries(e))t[za(n)]=za(r);return t}return e}function gy(e){return e.replace(/[\p{Cc}\p{Cf}\u2028\u2029]+/gu," ")}function _u(e){return e.startsWith("\uFEFF")?e.slice(1):e}import{readFile as uje}from"fs/promises";import{once as SW}from"events";import{createWriteStream as GUe}from"fs";import{open as kW,lstat as VCt,readdir as Hf,realpath as RW,rename as ZCt,stat as WUe}from"fs/promises";import{basename as qUe,dirname as VUe,join as Eo}from"path";var gW=1e4;async function So(e,t,n){let r=Math.max(1,Math.floor(n?.maxPages??1e4)),o;for(let s=0;s<r;s++){if(n?.budget!==void 0){if(n.budget.pagesLeft<1)return{status:"capped"};n.budget.pagesLeft--}let i=await e(o);if(!i.ok)return{status:"error",error:i.error};if(await t(i.value.items),n?.until?.())return{status:"done"};if(o=i.value.cursor,!o)return{status:"done"}}return{status:"capped"}}import{execFile as HUe}from"child_process";import{promisify as BUe}from"util";import{execFileSync as IUe}from"child_process";import{lstatSync as DUe}from"fs";import{join as LUe}from"path";function MUe(){return process.platform==="win32"}class yW{resolved=new Map;lookup(e){return this.resolved.get(e)}remember(e,t){this.resolved.set(e,t)}forget(e){this.resolved.delete(e)}}var NUe=new tt(()=>new yW),UUe=5000;function _W(e){try{return DUe(e,{throwIfNoEntry:!1})===void 0}catch{return!1}}var FUe=new Set([".com",".exe",".bat",".cmd"]);function jUe(e){let t=e.toLowerCase().replace(/.*[\\/]/,"").replace(/[. ]+$/,""),n=t.lastIndexOf(".");return n>0&&FUe.has(t.slice(n))}function $Ue(e,t=!1){let n=NUe.of(Tt().host),r=n.lookup(e);if(r!==void 0)if(r!==null){if(!_W(r))return r;n.forget(e)}else{if(!t)return r;n.forget(e)}let o=Mn.SYSTEMROOT||"C:\\Windows",s=LUe(o,"System32","where.exe");try{let a=IUe(s,[e],{stdio:"pipe",encoding:"utf8",timeout:UUe,windowsHide:!0,env:process.env}).trim().split(/\r?\n/).filter(Boolean),c=process.cwd(),l=!1;for(let u of a){if(_W(u))continue;if(gh(u,c)){l=!0;continue}if(!jUe(u))continue;return n.remember(e,u),u}if(a.length>0&&!l)n.remember(e,null);return null}catch(i){if(zUe(i))n.remember(e,null);return null}}function zUe(e){if(e===null||typeof e!=="object")return!1;let t="status"in e?e.status:void 0,n="signal"in e?e.signal:void 0,r="code"in e?e.code:void 0;return t===1&&!n&&!r}function bW(e,t=!1){if(!MUe())return e;if(e.includes("/")||e.includes("\\"))return e;return $Ue(e,t)}var KUe=BUe(HUe);async function Ts(e){let t=bW("git");if(t===null)return[];try{let{stdout:n}=await KUe(t,["-c","core.hooksPath=/dev/null","-c","core.fsmonitor=","worktree","list","--porcelain"],{cwd:e,timeout:5000,windowsHide:!0});if(!n)return[];return n.split(`
106
- `).filter((r)=>r.startsWith("worktree ")).map((r)=>ct(r.slice(9)))}catch{return[]}}var Cr=65536,ZUe=new Set(["sdk-cli","sdk-ts","sdk-py"]);function OW(e,t){let n=yu(e,"entrypoint")??un(t,"entrypoint");if(n&&ZUe.has(n))return!0;let r=e.split(`
107
- `).find((s)=>s.includes('"parentUuid":'))??e,o=yu(r,"sessionKind");return o==="daemon"||o==="daemon-worker"}var YUe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function rt(e){if(typeof e!=="string")return null;return YUe.test(e)?e:null}function PW(e){if(!e.includes("\\"))return e;try{return JSON.parse(`"${e}"`)}catch{return e}}function yu(e,t){let n=[`"${t}":"`,`"${t}": "`];for(let r of n){let o=e.indexOf(r);if(o<0)continue;let s=o+r.length,i=s;while(i<e.length){if(e[i]==="\\"){i+=2;continue}if(e[i]==='"')return PW(e.slice(s,i));i++}}return}function un(e,t){let n=[`"${t}":"`,`"${t}": "`],r,o=-1;for(let s of n){let i=0;while(!0){let a=e.indexOf(s,i);if(a<0)break;let c=a+s.length,l=c;while(l<e.length){if(e[l]==="\\"){l+=2;continue}if(e[l]==='"'){if(a>o)r=PW(e.slice(c,l)),o=a;break}l++}i=l+1}}return r}function Sy(e,t,n){let r=`"type":"${t}"`,o=`"${n}":`,s=e.length;while(s>0){let i=e.lastIndexOf(`
108
- `,s-1),a=e.slice(i+1,s);if(s=i,a.includes(r)&&a.includes(o))try{let c=JSON.parse(a);if(typeof c==="object"&&c!==null&&c.type===t){let l=c[n];if(typeof l==="string")return l}}catch{}if(i<0)break}return}function GC(e,t){let n=`"${t}":`,r=0;while(r<e.length){let o=e.indexOf(`
109
- `,r),s=o<0?e.slice(r):e.slice(r,o);if(r=o<0?e.length:o+1,s.includes(n))try{let i=JSON.parse(s);if(typeof i==="object"&&i!==null){let a=i[t];if(typeof a==="string")return a}}catch{}}return}async function Kf(e,t,n){return JUe(e,t,"w",n)}async function JUe(e,t,n,r){if(r!==void 0&&r.hoverRestOn&&(n==="w"||t.length>0))return XUe(r.source,t,n);let o=GUe(e,{mode:384,flags:n});try{for(let s of t)if(!o.write(JSON.stringify(s)+`
110
- `))await SW(o,"drain");o.end(),await SW(o,"finish")}catch(s){throw o.destroy(),s}}async function XUe(e,t,n){let{backend:r,key:o}=e,s=t.map((a)=>({data:JSON.stringify(a)+`
111
- `}));if(n==="w"){let a=await r.replaceRecords(o,s,{publishDiscipline:"inPlace",mode:384});if(!a.ok)throw Error("transcript stream replace failed",{cause:a.error});return}let i=await r.append(o,s);if(!i.ok)throw Error("transcript stream append failed",{cause:i.error})}function Ey(e){let t=0,n={commandFallback:""};while(t<e.length){let r=e.indexOf(`
112
- `,t),o=r>=0?e.slice(t,r):e.slice(t);if(t=r>=0?r+1:e.length,!o.includes('"type":"user"')&&!o.includes('"type": "user"'))continue;if(o.includes('"tool_result"'))continue;if(o.includes('"isMeta":true')||o.includes('"isMeta": true'))continue;if(o.includes('"isCompactSummary":true')||o.includes('"isCompactSummary": true'))continue;try{let s=JSON.parse(o),i=yd(s,n);if(i!==void 0)return i}catch{continue}}return n.commandFallback}function IW(e){let t={commandFallback:""};for(let n of e){if(typeof n!=="object"||n===null)continue;let r=yd(n,t);if(r!==void 0)return r}return t.commandFallback}async function QUe(e){let{backend:t,key:n}=e;try{let r=await t.read([{key:n,offset:0,length:Cr},{key:n,tail:Cr}]);if(!r.ok)return null;let[o,s]=r.value.items;if(!o.found||o.value.length===0)return null;let i=EW(o.value),a=s.found&&s.value.length>0?EW(s.value):i;return{head:i,tail:a,mtimeMs:o.mtimeMs,totalBytes:o.totalBytes}}catch{return null}}function EW(e){return Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")}var rkt=Buffer.from('"type":"user"'),okt=Buffer.from('"type":"assistant"');function xy(e,t){if(e.kind!=="scope"||e.scope.namespace!=="transcript"||e.scope.projectKey===void 0||e.scope.sessionId!==void 0||!t(e.scope.projectKey))return;return e.scope.projectKey}function DW(e){return{skipScopeStats:!0,skipKeyStats:!0,...e!==void 0&&{cursor:e}}}function eFe(e){let t=new Map,n=new Proxy(e.backend,{get(r,o,s){let i=Reflect.get(r,o,s);if(o!=="listEntries")return typeof i==="function"?i.bind(r):i;return(c,l)=>{if(!(c.namespace==="transcript"&&!("projectKey"in c)&&Object.keys(l??{}).every((m)=>m==="cursor"||m==="skipScopeStats"||m==="skipKeyStats")))return r.listEntries(c,l);let p=[l?.cursor??"",l?.skipScopeStats,l?.skipKeyStats].map(String).join("\x00"),f=t.get(p);if(f===void 0){f=r.listEntries(c,l),t.set(p,f);let m=()=>{t.delete(p)};f.then((h)=>{if(!h.ok)m()},m)}return f}}});return{...e,backend:n}}async function Gf(e,t){if(t!==void 0&&t.hoverRestOn)return LW(t.source);try{let n=await kW(e,"r");try{let r=await n.stat(),o=Buffer.allocUnsafe(Cr),s=await n.read(o,0,Cr,0);if(s.bytesRead===0)return null;let i=o.toString("utf8",0,s.bytesRead),a=Math.max(0,r.size-Cr),c=i;if(a>0){let l=await n.read(o,0,Cr,a);c=o.toString("utf8",0,l.bytesRead)}return{mtime:r.mtime.getTime(),size:r.size,head:i,tail:c}}finally{await n.close()}}catch{return null}}async function LW(e){let t=await QUe(e);if(t===null)return null;return{mtime:Math.trunc(t.mtimeMs),size:t.totalBytes,head:t.head,tail:t.tail}}var Cs=200;function tFe(e){return Math.abs(rA(e)).toString(36)}function bu(e){return e.replace(/[^a-zA-Z0-9]/g,"-")}function Wf(e){let t=bu(e);if(t.length<=Cs)return t;return`${t.slice(0,Cs)}-${tFe(e)}`}function _y(e,t){let n=e.replaceAll("\\","/");return t?n.toLowerCase():n}function xW(e,t,n){let r=ct(e),o=ct(t),s=(i)=>n?i.toLowerCase():i;if(s(bu(r))!==s(bu(o)))return!1;return _y(r,n)!==_y(o,n)}async function MW(e,t,n,r){if(!xW(e,t,n))return!1;if(rE(e)||rE(t))return!1;if(await r(e)||await r(t))return!1;let o;try{o=ct(await RW(e))}catch{return!1}let s=await Rs(t);return xW(o,s,n)}function NW(e,t,n){if(t===void 0)return!1;let r=_y(ct(e),n);return t.some((o)=>{let s=_y(ct(o),n);return r===s||r.startsWith(s.endsWith("/")?s:s+"/")})}function WC(){return process.platform==="win32"||process.platform==="darwin"}function bt(){return Eo(Gt(),"projects")}function ks(e){return BL()??Wf(e)}function qC(e){let t=Wf(e);return t===ks(e)?void 0:t}function Su(e){return Eo(bt(),ks(e))}function Ba(e,t){let n=qUe(e);return VUe(e)===bt()&&t(n)?n:void 0}async function Rs(e){try{return ct(await RW(e))}catch{return ct(e)}}async function Eu(e,t,n,r){let o=r!==void 0&&r.hoverRestOn?r.source:void 0,s=o===void 0?void 0:Ba(e,o.isKeySegment);if(o!==void 0&&s!==void 0){let c=await nFe(s,t,n,o);if(c!==void 0)return c}let i=bu(t),a;try{a=await Hf(e,{withFileTypes:!0})}catch{return!1}for(let c of a){if(!c.isFile()||!c.name.endsWith(".jsonl"))continue;let l=await Gf(Eo(e,c.name));if(l===null)continue;if(UW(l,i,n))return!0}return!1}function UW(e,t,n){let r=Sy(e.tail,"relocated","relocatedCwd")??GC(e.head,"cwd");if(r===void 0)return!1;let o=bu(ct(r));return n?o.toLowerCase()===t.toLowerCase():o===t}async function nFe(e,t,n,r){let{backend:o,transcriptKey:s,isKeySegment:i}=r,a=bu(t),c=!1,l=new Set;try{let u=await So((p)=>o.listEntries({namespace:"transcript",projectKey:e},DW(p)),async(p)=>{for(let f of p){if(f.kind!=="key"||f.key.namespace!=="transcript"||f.key.projectKey!==e||f.key.agentId!==void 0||!i(f.key.sessionId)||l.has(f.key.sessionId))continue;let m=f.key.sessionId,h=await LW({backend:o,key:s(e,m)});if(h===null)continue;if(l.add(m),UW(h,a,n)){c=!0;return}}},{until:()=>c});if(c)return!0;if(u.status!=="done")return}catch{return}return!1}async function Qn(e,t){if(t!==void 0&&t.hoverRestOn)return rFe(e,t);let n=Su(e),r=[];try{await Hf(n),r.push(n)}catch{}let o=qC(e);if(o!==void 0){let p=Eo(bt(),o);try{await Hf(p),r.push(p)}catch{}return r}let s=Wf(e);if(s.length<=Cs)return r;let i=bt(),a=process.platform==="win32",c=(p)=>a?p.toLowerCase():p,l=c(s.slice(0,Cs)+"-"),u=c(n);try{for(let p of await Hf(i,{withFileTypes:!0})){if(!p.isDirectory()||!c(p.name).startsWith(l))continue;let f=Eo(i,p.name);if(c(f)!==u&&await Eu(f,e,a))r.push(f)}}catch{}return r}async function rFe(e,t){let n=await xu(t.source);if(n===null){let r=qC(e);return[Su(e),...r!==void 0?[Eo(bt(),r)]:[]]}return VC(e,n,process.platform==="win32",t)}async function xu(e){let{backend:t,isKeySegment:n}=e,r=[],o=new Set,s=0;try{if((await So((a)=>t.listEntries({namespace:"transcript"},DW(a)),(a)=>{for(let c of a){let l=xy(c,n);if(l!==void 0&&!o.has(l))o.add(l),r.push(l)}s++})).status==="error")return s===0?null:r}catch{return s===0?null:r}return r}async function VC(e,t,n,r){let o=ks(e),s=Su(e),i=qC(e),a=i===void 0&&o.length>Cs?o.slice(0,Cs)+"-":void 0,c=bt(),l=(S)=>n?S.toLowerCase():S,u=a!==void 0?l(a):void 0,p=l(o),f=!1,m,h=[],g=new Set;for(let S of t)if(S===o)f=!0;else if(i!==void 0){if(m===void 0&&l(S)===l(i))m=Eo(c,S)}else if(u!==void 0&&l(S).startsWith(u)&&l(S)!==p&&!g.has(l(S)))g.add(l(S)),h.push(S);let y=[];for(let S of h){let b=Eo(c,S);if(await Eu(b,e,n,r))y.push(b)}return[...f?[s]:[],...m!==void 0?[m]:[],...y]}async function oFe(e,t){let n=[];for(let r of await Ts(e)){if(r===e)continue;let o=await Qn(r,t);if(t!==void 0&&t.hoverRestOn){let s=Su(r);if(!o.includes(s))o.push(s)}for(let s of o)n.push({worktreePath:r,projectDir:s})}return n}async function wi(e,t,n,r){let o=`${e}.jsonl`,s=r&&n!==void 0&&n.isKeySegment(e)?eFe(n):void 0,i=s===void 0?void 0:{source:s,hoverRestOn:r};async function a(u,p){let f=Eo(u,o);if(s){let m=Ba(u,s.isKeySegment);if(m!==void 0){try{let h=await s.backend.stat(s.transcriptKey(m,e));if(h.ok){let g=h.value.storedBytes??h.value.size;if(g>0)return{filePath:f,projectPath:p,fileSize:g}}}catch{}return}}try{let m=await WUe(f);if(m.size>0)return{filePath:f,projectPath:p,fileSize:m.size}}catch{}return}if(t){let u=await Rs(t);for(let p of await Qn(u,i)){let f=await a(p,u);if(f)return f}for(let{worktreePath:p,projectDir:f}of await oFe(u,i)){let m=await a(f,p);if(m)return m}return}let c=bt();if(s){let u=new Map;try{if((await So((m)=>s.backend.listEntries({namespace:"transcript"},m!==void 0?{cursor:m}:void 0),(m)=>{for(let h of m){let g=xy(h,s.isKeySegment);if(g===void 0)continue;let y=h.kind==="scope"&&h.mtimeMs!==void 0?h.mtimeMs:Number.NEGATIVE_INFINITY,S=u.get(g);if(S===void 0)u.set(g,{projectKey:g,mtimeMs:y});else if(y>S.mtimeMs)S.mtimeMs=y}})).status==="error")return}catch{return}let p=[...u.values()];p.sort((f,m)=>f.mtimeMs!==m.mtimeMs?m.mtimeMs-f.mtimeMs:f.projectKey<m.projectKey?-1:f.projectKey>m.projectKey?1:0);for(let{projectKey:f}of p){let m=await a(Eo(c,f),void 0);if(m)return m}return}let l;try{l=await Hf(c)}catch{return}for(let u of l){let p=await a(Eo(c,u),void 0);if(p)return p}return}var sFe=1048576,FW=5242880,iFe=Buffer.from('"compact_boundary"');function jW(e){try{let t=JSON.parse(e);if(t.type!=="system"||t.subtype!=="compact_boundary")return null;return{hasPreservedSegment:Boolean(t.compactMetadata?.preservedSegment||t.compactMetadata?.preservedMessages)}}catch{return null}}function Ha(e,t,n,r){let o=r-n;if(o<=0)return;if(e.len+o>e.buf.length){let s=Buffer.allocUnsafe(Math.min(Math.max(e.buf.length*2,e.len+o),e.cap));e.buf.copy(s,0,0,e.len),e.buf=s}t.copy(e.buf,e.len,n,r),e.len+=o}function yy(e,t,n,r){return r-n>=t.length&&e.compare(t,0,t.length,n,n+t.length)===0}var by=Buffer.from('{"type":"attribution-snapshot"'),aFe=Buffer.from('{"type":"system"'),Bf=10,cFe=Buffer.from([Bf]),lFe=256;function vW(e,t,n){if(e.straddleSnapCarryLen=0,e.straddleSnapTailEnd=0,e.carryLen===0)return 0;let r=e.carryBuf,o=t.indexOf(Bf);if(o===-1||o>=n)return 0;let s=o+1;if(yy(r,by,0,e.carryLen))e.straddleSnapCarryLen=e.carryLen,e.straddleSnapTailEnd=s,e.lastSnapSrc=null;else if(e.carryLen<by.length)return 0;else{if(yy(r,aFe,0,e.carryLen)){let i=jW(r.toString("utf-8",0,e.carryLen)+t.toString("utf-8",0,o));if(i?.hasPreservedSegment)e.hasPreservedSegment=!0;else if(i)e.out.len=0,e.boundaryStartOffset=e.bufFileOff,e.hasPreservedSegment=!1,e.lastSnapSrc=null}Ha(e.out,r,0,e.carryLen),Ha(e.out,t,0,s)}return e.bufFileOff+=e.carryLen+s,e.carryLen=0,s}function wW(e,t,n){let r=t.indexOf(n),o=0,s=0,i=-1,a=-1,c=t.indexOf(Bf);while(c!==-1){let l=c+1;if(r!==-1&&r<s)r=t.indexOf(n,s);if(yy(t,by,s,l))Ha(e.out,t,o,s),i=s,a=l,o=l;else if(r>=s&&r<Math.min(s+lFe,l)){let u=jW(t.toString("utf-8",s,c));if(u?.hasPreservedSegment)e.hasPreservedSegment=!0;else if(u)e.out.len=0,e.boundaryStartOffset=e.bufFileOff+s,e.hasPreservedSegment=!1,e.lastSnapSrc=null,i=-1,e.straddleSnapCarryLen=0,o=s;r=t.indexOf(n,r+n.length)}s=l,c=t.indexOf(Bf,s)}return Ha(e.out,t,o,s),{lastSnapStart:i,lastSnapEnd:a,trailStart:s}}function AW(e,t,n,r,o){if(r!==-1){if(e.lastSnapLen=o-r,e.lastSnapBuf===void 0||e.lastSnapLen>e.lastSnapBuf.length)e.lastSnapBuf=Buffer.allocUnsafe(e.lastSnapLen);t.copy(e.lastSnapBuf,0,r,o),e.lastSnapSrc=e.lastSnapBuf}else if(e.straddleSnapCarryLen>0){if(e.lastSnapLen=e.straddleSnapCarryLen+e.straddleSnapTailEnd,e.lastSnapBuf===void 0||e.lastSnapLen>e.lastSnapBuf.length)e.lastSnapBuf=Buffer.allocUnsafe(e.lastSnapLen);e.carryBuf.copy(e.lastSnapBuf,0,0,e.straddleSnapCarryLen),n.copy(e.lastSnapBuf,e.straddleSnapCarryLen,0,e.straddleSnapTailEnd),e.lastSnapSrc=e.lastSnapBuf}}function TW(e,t,n){if(e.carryLen=t.length-n,e.carryLen>0){if(e.carryBuf===void 0||e.carryLen>e.carryBuf.length)e.carryBuf=Buffer.allocUnsafe(e.carryLen);t.copy(e.carryBuf,0,n,t.length)}}function CW(e){if(e.carryLen>0){let t=e.carryBuf;if(yy(t,by,0,e.carryLen))e.lastSnapSrc=t,e.lastSnapLen=e.carryLen;else Ha(e.out,t,0,e.carryLen)}if(e.lastSnapSrc){if(e.out.len>0&&e.out.buf[e.out.len-1]!==Bf)Ha(e.out,cFe,0,1);Ha(e.out,e.lastSnapSrc,0,e.lastSnapLen)}}async function $W(e,t,n){let r=iFe,o=sFe,s={out:{buf:Buffer.allocUnsafe(Math.min(t,8388608)),len:0,cap:t+1},boundaryStartOffset:0,hasPreservedSegment:!1,lastSnapSrc:null,lastSnapLen:0,lastSnapBuf:void 0,bufFileOff:0,carryLen:0,carryBuf:void 0,straddleSnapCarryLen:0,straddleSnapTailEnd:0};if(n!==void 0&&n.hoverRestOn){let{backend:c,key:l}=n.source,u=0;while(u<t){let p=await c.read([{key:l,offset:u,length:Math.min(o,t-u)}]);if(!p.ok)throw Error("transcript ranged read failed",{cause:p.error});let[f]=p.value.items;if(!f.found)throw Error("transcript stream absent during load");if(f.value.length===0)break;let m=Buffer.from(f.value.buffer,f.value.byteOffset,f.value.length),h=m.length;u+=h;let g=vW(s,m,h),y;if(s.carryLen>0){let b=s.carryLen+(h-g);y=Buffer.allocUnsafe(b),s.carryBuf.copy(y,0,0,s.carryLen),m.copy(y,s.carryLen,g,h)}else y=m.subarray(g,h);let S=wW(s,y,r);AW(s,y,m,S.lastSnapStart,S.lastSnapEnd),TW(s,y,S.trailStart),s.bufFileOff+=S.trailStart}return CW(s),{boundaryStartOffset:s.boundaryStartOffset,postBoundaryBuf:s.out.buf.subarray(0,s.out.len),hasPreservedSegment:s.hasPreservedSegment}}let i=Buffer.allocUnsafe(o),a=await kW(e,"r");try{let c=0;while(c<t){let{bytesRead:l}=await a.read(i,0,Math.min(o,t-c),c);if(l===0)break;c+=l;let u=vW(s,i,l),p;if(s.carryLen>0){let m=s.carryLen+(l-u);p=Buffer.allocUnsafe(m),s.carryBuf.copy(p,0,0,s.carryLen),i.copy(p,s.carryLen,u,l)}else p=i.subarray(u,l);let f=wW(s,p,r);AW(s,p,i,f.lastSnapStart,f.lastSnapEnd),TW(s,p,f.trailStart),s.bufFileOff+=f.trailStart}CW(s)}finally{await a.close()}return{boundaryStartOffset:s.boundaryStartOffset,postBoundaryBuf:s.out.buf.subarray(0,s.out.len),hasPreservedSegment:s.hasPreservedSegment}}var zW=/^[0-9a-f]{16}(?:[0-9a-f]{48})?@v\d+$/;function HW(e,t,n){return{type:"history-suppression",sessionId:e,cause:t,...n&&{vetoedAgainstAccountUuid:n},ts:new Date().toISOString()}}import{basename as hq,dirname as gq,isAbsolute as Xkt,join as lje,relative as Qkt,sep as eRt}from"path";var uFe=String.fromCharCode(0),dFe=/^\.[0-9a-f]{16}\.aside$/;function pFe(e){if(e.charCodeAt(0)!==46)return!1;return Os(e).some((t)=>dFe.test(t))}function BW(e){return typeof e==="string"&&/^[. ]+$/.test(e)}function dn(e){return!(typeof e!=="string"||e.length===0||BW(e)||e.includes("/")||e.includes("\\")||e.includes(uFe)||pFe(e))}function er(e){return e.length>0&&e.every(dn)}function qf(e){return Os(e).some((t)=>t.endsWith(".jsonl"))}function Os(e){let t=vy.get(e);if(t!==void 0)return t;let n=Object.freeze(fFe(e));if(vy.size>=mFe)vy.clear();return vy.set(e,n),n}function fFe(e){let t=e.toLowerCase(),n=t.indexOf(":");return n===-1?[ZC(t)]:[ZC(t),ZC(t.slice(0,n))]}var vy=new Map,mFe=32768;function ZC(e){let t=e.length;while(t>0){let n=e.charCodeAt(t-1);if(n!==46&&n!==32)break;t-=1}return t===e.length?e:e.slice(0,t)}function wy(e,t,n){return n===void 0?e:{...e,[t]:n}}function hFe(e,t,n,r){let s=wy({namespace:"transcript",projectKey:e,sessionId:t},"agentId",n);return wy(s,"agentRelPath",r)}var en={transcript:hFe,journal:(e,t,n)=>({namespace:"transcript",projectKey:e,sessionId:t,agentRelPath:n,journal:!0}),sessionJournal:(e,t,n)=>({namespace:"transcript",projectKey:e,sessionId:t,sessionJournal:n}),history:()=>({namespace:"history"}),log:(e,t,n)=>{let o=wy({namespace:"log",sessionId:e,channel:t},"agentId",n?.agentId);return wy(o,"runId",n?.runId)},globalConfig:()=>({namespace:"globalConfig"}),globalConfigCopy:(e,t)=>({namespace:"globalConfig",kind:e,stamp:t}),userSettings:()=>({namespace:"settings",layer:"user"}),projectSettings:(e)=>({namespace:"settings",layer:"project",projectKey:e}),localSettings:(e)=>({namespace:"settings",layer:"local",consentRootKey:e}),task:(e,t)=>({namespace:"task",listId:e,taskId:t}),taskListMeta:(e)=>({namespace:"task",listId:e,meta:!0}),taskListHighWaterMark:(e)=>({namespace:"task",listId:e,highWaterMark:!0}),memory:(e,t)=>({namespace:"memory",projectKey:e,relPath:t}),pluginRegistry:(e)=>({namespace:"pluginRegistry",file:e}),marketplaceCache:(e,t)=>({namespace:"marketplaceCache",marketplace:e,form:t}),marketplaceTree:(e,t)=>({namespace:"marketplaceCache",marketplace:e,relPath:t}),pluginCache:(e,t,n,r)=>({namespace:"pluginCache",marketplace:e,plugin:t,version:n,relPath:r}),cache:(e,t)=>({namespace:"cache",store:e,id:t}),paste:(e)=>({namespace:"paste",id:e}),state:(e)=>({namespace:"state",id:e}),pluginAssetCache:(e)=>({namespace:"pluginAssetCache",digest:e}),plan:(e)=>({namespace:"plan",name:e}),daemon:(e)=>({namespace:"daemon",relPath:e}),feedbackDraft:(e)=>({namespace:"feedbackDraft",draftId:e}),agentMemory:(e,t)=>({namespace:"agentMemory",layer:"user",agentType:e,relPath:t}),identity:()=>({namespace:"identity"}),team:(e)=>({namespace:"team",team:e}),sidecar:(e,t,n)=>({namespace:"sidecar",projectKey:e,sessionId:t,relPath:n}),mailbox:(e,t)=>({namespace:"mailbox",team:e,teammate:t}),scratch:(e,t)=>({namespace:"scratch",sessionId:e,relPath:t}),userConfigDir:(e,t)=>({namespace:"userConfigDir",dir:e,relPath:t}),fileHistory:(e,t)=>({namespace:"fileHistory",sessionId:e,backupFileName:t}),job:(e,t)=>({namespace:"job",jobId:e,relPath:t}),jobTimeline:(e)=>({namespace:"jobTimeline",jobId:e}),recording:(e,t,n)=>({namespace:"recording",projectKey:e,sessionId:t,stamp:n}),sessionLog:(e,t,n)=>({namespace:"sessionLog",projectKey:e,year:t.year,month:t.month,day:t.day,logName:n}),jobPins:()=>({namespace:"jobsRoot",file:"pins"}),jobDraft:(e)=>({namespace:"jobsRoot",draftKey:e}),session:(e)=>({namespace:"session",file:e}),bridgePointer:(e)=>({namespace:"bridgePointer",projectKey:e}),sessionAliases:(e)=>({namespace:"sessionAliases",projectKey:e}),dirSyncRecord:(e,t)=>({namespace:"dirSyncRecord",projectKey:e,sessionId:t})};class KW{available=void 0;probing=void 0;procUnreadableLogged=!1}var Mkt=new tt(()=>new KW);function SFe(e){return J(e,"expected a segment that is not empty or made only of dots and spaces, with no path separator, NUL or set-aside shape")}function Ps(e){if(typeof e!=="object"||e===null)return J("key","expected a key object");let t=OFe(e);if(t!==void 0)return t;let n=oje(e);if(n===void 0)return J("key",`${e.namespace} is not a storage namespace`);return WW("key",n)}function WW(e,t){for(let[n,r,o]of t){let s=`${e}.${n}`;if(r===void 0){if(o!=="optional")return J(s,"required")}else if(EFe(n)){if(!(e==="scope"&&n==="agentRelPath"&&Array.isArray(r)&&r.length===0)&&(!Array.isArray(r)||!er(r)))return J(s,"expected a non-empty array of segments, none empty or made only of dots and spaces, with no path separator, NUL or set-aside shape")}else if(typeof r!=="string"||!dn(r))return SFe(s)}return}function EFe(e){return e==="relPath"||e==="agentRelPath"}var qW=["commands","agents","output-styles","skills","workflows","routines","themes","rules","session-env","uploads","mcp-skill-archives","usage-data","mcp-discovery-cache"];var VW=new Set(qW),ZW=`must be one of the userConfigDir directory names (${qW.join(", ")})`,YW=["installed","marketplaces","flagged","catalog","inUseSweep"];var xFe=new Set(YW),vFe=`must be one of the pluginRegistry files (${YW.join(", ")})`,JW=["manifest","catalog"];var wFe=new Set(JW),AFe=`must be one of the marketplaceCache forms (${JW.join(", ")})`;var XW=["world"];var TFe=new Set(XW),CFe=`must be one of the session journal names (${XW.join(", ")})`;function kFe(e){return TFe.has(e)}function RFe(e){return typeof e==="string"&&/^[0-9a-f]{64}$/.test(e)}function OFe(e){if(e.namespace==="transcript")return DFe(e);if(e.namespace==="pluginAssetCache"&&!RFe(e.digest))return J("key.digest","must be a SHA-256 digest: 64 lowercase hexadecimal characters");if(e.namespace==="globalConfig"&&"kind"in e){if(!nq(e.kind))return J("key.kind",tq);if(typeof e.stamp!=="string")return J("key.stamp","a recovery copy key carries its stamp")}if(e.namespace==="task")return ZFe(e);if(e.namespace==="sidecar"){let t=Ty("key.sessionId",e.sessionId);if(t!==void 0)return t;if(Cy(e.relPath))return J("key.relPath",Vf);return iq(e.relPath)?J("key.relPath",oq):void 0}if(e.namespace==="recording")return Ty("key.sessionId",e.sessionId)??(sq(e.stamp)?void 0:J("key.stamp",NFe));if(e.namespace==="jobsRoot")return YFe(e);if(e.namespace==="userConfigDir"&&!VW.has(e.dir))return J("key.dir",ZW);if(e.namespace==="fileHistory")return PFe(e);if(e.namespace==="settings"&&!VFe(e.layer))return J("key.layer","must be user, project or local");if(e.namespace==="log"&&!uq(e.channel))return J("key.channel",lq);if(e.namespace==="job"&&fq(e.relPath))return J("key.relPath",pq);if(e.namespace==="sessionLog")return mq("key",e)??(tje(e.logName)?void 0:J("key.logName","must be the session-log stem <sessionId8>[-<title-slug>]: up to eight word characters, then lower-case a-z / 0-9 runs joined by single hyphens; not a bare device name"));if(e.namespace==="pluginRegistry"&&!xFe.has(e.file))return J("key.file",vFe);if(e.namespace==="marketplaceCache"){if(!("relPath"in e))return wFe.has(e.form)?void 0:J("key.form",AFe);return e.form===void 0?void 0:J("key.form","a tree file key carries relPath, not form")}if(e.namespace!=="agentMemory")return;if(!QW(e.layer))return J("key.layer","must be user, project or local");if(e.layer==="user"&&"projectKey"in e)return J("key.projectKey","the user layer is not keyed by project");if(e.layer!=="user"&&typeof e.projectKey!=="string")return J("key.projectKey","required for the project and local layers");return typeof e.agentType==="string"?void 0:J("key.agentType","an agent memory key names its agent")}function PFe(e){return typeof e.backupFileName!=="string"||!zW.test(e.backupFileName)?J("key.backupFileName","must be a backup file name the engine has ever written (hex hash @v version)"):void 0}function QW(e){return e==="user"||e==="project"||e==="local"}var eq=["backup","corrupted"];var IFe=new Set(eq),tq=`must be one of the global-config copy kinds (${eq.join(", ")})`;function nq(e){return IFe.has(e)}function DFe(e){let t=Ty("key.sessionId",e.sessionId);if(t!==void 0)return t;if(Cy(e.agentRelPath))return J("key.agentRelPath",Vf);if("sessionJournal"in e){if(typeof e.sessionJournal!=="string"||!kFe(e.sessionJournal))return J("key.sessionJournal",CFe);return e.agentId===void 0&&e.agentRelPath===void 0&&!("journal"in e)?void 0:J("key.sessionJournal","a session journal key names the session's own journal: no agentId, agentRelPath or run journal")}if("journal"in e){if(e.journal!==!0)return J("key.journal","must be true");if(!Array.isArray(e.agentRelPath))return J("key.agentRelPath","a run journal key carries its run directory");return e.agentId===void 0?void 0:J("key.agentId","a transcript key names an agent transcript or the run journal, never both")}return e.agentRelPath!==void 0&&e.agentId===void 0?J("key.agentRelPath","requires agentId or journal"):void 0}var LFe="cloud-snapshots";var rq=new Set(["memory","tiny_memory","bagel",LFe,"bridge-pointer.json",".session-aliases"]),MFe=/^[0-9]{1,16}$/,NFe="must be the recording stamp: 1 to 16 decimal digits (epoch milliseconds)",Ay=".cast",oq=`<stamp>${Ay} inside a session's folder is that session's terminal recording stream: address it as keys.recording(projectKey, sessionId, stamp)`;function sq(e){return typeof e==="string"&&MFe.test(e)}function iq(e){return Array.isArray(e)&&typeof e[0]==="string"&&Os(e[0]).some((t)=>UFe(t)!==void 0)}function UFe(e){if(!e.endsWith(Ay))return;let t=e.slice(0,-Ay.length);return sq(t)?t:void 0}var aq=[".ccr-tip.json",".precompact.json",Ay],FFe=`must not end with ${aq.join(", ")}: those name a session's project-level sibling files`;function jFe(e){return Os(e).some((t)=>aq.some((n)=>t.endsWith(n)))}var cq=".dir-sync.json",$Fe=`must not end with ${cq}: that names a cloud session's directory-sync record at the project level`;function zFe(e){return Os(e).some((t)=>t.endsWith(cq))}var HFe=`${[...rq].join(", ")} are reserved: they name project-level entries, not sessions`;function BFe(e){return Os(e).some((t)=>rq.has(t))}function Ty(e,t){if(typeof t!=="string")return;if(BFe(t))return J(e,HFe);if(jFe(t))return J(e,FFe);if(zFe(t))return J(e,$Fe);return qf(t)?J(e,Vf):void 0}var KFe=".meta.json",GFe=".meta is reserved for the list metadata key, under every spelling that opens its file";function WFe(e){return qFe(`${e}.json`)}function qFe(e){return Os(e).includes(KFe)}var Vf="names a .jsonl stream, which only a transcript key addresses";function Cy(e){return Array.isArray(e)&&e.some((t)=>typeof t==="string"&&qf(t))}function VFe(e){return e==="user"||e==="project"||e==="local"}var lq="must be debug, telemetry or apiDump";function uq(e){return e==="debug"||e==="telemetry"||e==="apiDump"}function ZFe(e){if("taskId"in e&&(("meta"in e)||("highWaterMark"in e)))return J("key.taskId","a task key names an item, the list metadata or the list high-water mark, never more than one");if("meta"in e&&"highWaterMark"in e)return J("key.highWaterMark","a task key names an item, the list metadata or the list high-water mark, never more than one");if("meta"in e&&e.meta!==!0)return J("key.meta","must be true");if("highWaterMark"in e&&e.highWaterMark!==!0)return J("key.highWaterMark","must be true");if(typeof e.listId!=="string")return J("key.listId","a task key carries its listId");if("meta"in e||"highWaterMark"in e)return;if(typeof e.taskId!=="string")return J("key.taskId","a task item key carries its taskId");if(WFe(e.taskId))return J("key.taskId",GFe);return}function YFe(e){if("file"in e&&"draftKey"in e)return J("key.draftKey","a jobs-root key names the pins file or one draft, never both");if("file"in e)return e.file==="pins"?void 0:J("key.file","must be pins");if(typeof e.draftKey!=="string")return J("key.draftKey","a jobs-root draft key carries its draftKey");return rje.test(e.draftKey)?void 0:J("key.draftKey","must be 8 lowercase hex characters")}var dq="timeline.jsonl",pq=`${dq} is the job's timeline stream: address it as keys.jobTimeline(jobId)`;function fq(e){return Array.isArray(e)&&typeof e[0]==="string"&&Os(e[0]).includes(dq)}var JFe=/^\d{4}$/,GW=/^\d{2}$/,XFe=/^[A-Za-z0-9_-]{1,8}(?:-[a-z0-9]+)*$/,QFe=128,eje=/^(?:con|prn|aux|nul|com\d|lpt\d)$/i;function tje(e){return typeof e==="string"&&e.length<=QFe&&XFe.test(e)&&!eje.test(e)}function mq(e,t){if(t.year!==void 0&&!YC(JFe,t.year))return J(`${e}.year`,"must be four digits (YYYY)");if(t.month!==void 0&&!YC(GW,t.month))return J(`${e}.month`,"must be two digits (MM)");if(t.day!==void 0&&!YC(GW,t.day))return J(`${e}.day`,"must be two digits (DD)");return}function YC(e,t){return typeof t==="string"&&e.test(t)}function nje(e){if(e.year!==void 0&&e.projectKey===void 0)return J("scope.projectKey","required when year is given");if(e.month!==void 0&&e.year===void 0)return J("scope.year","required when month is given");if(e.day!==void 0&&e.month===void 0)return J("scope.month","required when day is given");return mq("scope",e)}var rje=/^[0-9a-f]{8}$/;function oje(e){switch(e.namespace){case"transcript":return[["projectKey",e.projectKey],["sessionId",e.sessionId],["agentId",e.agentId,"optional"],["agentRelPath",e.agentRelPath,"optional"]];case"history":case"identity":return[];case"globalConfig":return"kind"in e?[["stamp",e.stamp]]:[];case"settings":return e.layer==="user"?[]:e.layer==="project"?[["projectKey",e.projectKey]]:[["consentRootKey",e.consentRootKey]];case"task":return"taskId"in e?[["listId",e.listId],["taskId",e.taskId]]:[["listId",e.listId]];case"memory":return[["projectKey",e.projectKey],["relPath",e.relPath]];case"pluginRegistry":return[];case"marketplaceCache":return"relPath"in e?[["marketplace",e.marketplace],["relPath",e.relPath]]:[["marketplace",e.marketplace]];case"pluginCache":return[["marketplace",e.marketplace],["plugin",e.plugin],["version",e.version],["relPath",e.relPath]];case"cache":return[["store",e.store],["id",e.id]];case"paste":return[["id",e.id]];case"pluginAssetCache":return[["digest",e.digest]];case"state":return[["id",e.id]];case"plan":return[["name",e.name]];case"feedbackDraft":return[["draftId",e.draftId]];case"agentMemory":return[...e.layer==="user"?[]:[["projectKey",e.projectKey]],["agentType",e.agentType],["relPath",e.relPath]];case"team":return[["team",e.team]];case"sidecar":return[["projectKey",e.projectKey],["sessionId",e.sessionId],["relPath",e.relPath]];case"scratch":return[["sessionId",e.sessionId],["relPath",e.relPath]];case"userConfigDir":return[["relPath",e.relPath]];case"fileHistory":return[["sessionId",e.sessionId],["backupFileName",e.backupFileName]];case"job":return[["jobId",e.jobId],["relPath",e.relPath]];case"daemon":return[["relPath",e.relPath]];case"jobsRoot":return"file"in e?[]:[["draftKey",e.draftKey]];case"session":return[["file",e.file]];case"bridgePointer":case"sessionAliases":return[["projectKey",e.projectKey]];case"dirSyncRecord":return[["projectKey",e.projectKey],["sessionId",e.sessionId]];case"mailbox":return[["team",e.team],["teammate",e.teammate]];case"log":return[["sessionId",e.sessionId],["agentId",e.agentId,"optional"],["runId",e.runId,"optional"]];case"jobTimeline":return[["jobId",e.jobId]];case"recording":return[["projectKey",e.projectKey],["sessionId",e.sessionId],["stamp",e.stamp]];case"sessionLog":return[["projectKey",e.projectKey],["year",e.year],["month",e.month],["day",e.day],["logName",e.logName]]}return}function JC(e){if(typeof e!=="object"||e===null)return J("scope","expected a scope object");let t=cje(e);if(t===void 0)return J("scope",`${String(e.namespace)} is not a listable namespace`);return ije(e)??WW("scope",t)}var sje={transcript:[["agentId","names one agent transcript, a stream key, not a scope: narrow a scope with agentRelPath"],["journal","names a run journal, a stream key, not a scope: narrow a scope with agentRelPath"],["sessionJournal","names a session's own journal, a stream key, not a scope: the session scope lists it"]],log:[["agentId","names one log stream, a stream key, not a scope"],["runId","names one log stream, a stream key, not a scope"]],sessionLog:[["logName","names one session's log, a stream key, not a scope: a day scope lists its logs"]],task:[["taskId","names one task value, a key, not a scope: a list scope narrows with listId only"],["meta","names one task value, a key, not a scope: a list scope narrows with listId only"],["highWaterMark","names one task value, a key, not a scope: a list scope narrows with listId only"]],mailbox:[["teammate","names one inbox, a key, not a scope"]],cache:[["id","names one cached value, a key, not a scope: a cache scope narrows with store only"]],pluginAssetCache:[["digest","names one cached asset, a key, not a scope"]],fileHistory:[["backupFileName","names one backup, a key, not a scope: a file-history scope narrows with sessionId only"]],state:[["id","names one value, a key, not a scope"]],feedbackDraft:[["draftId","names one draft, a key, not a scope"]],jobsRoot:[["file","names one value, a key, not a scope"],["draftKey","names one value, a key, not a scope"]],plan:[["name","names one plan, a key, not a scope"]],paste:[["id","names one paste, a key, not a scope"]],session:[["file","names one value, a key, not a scope"]],globalConfig:[["stamp","names one recovery copy, a key, not a scope: the scope narrows with kind only"]],marketplaceCache:[["form","names one of the marketplace's two engine-written files, a key, not a scope: the tree narrows with relPath only"]],memory:[],pluginCache:[],daemon:[],sidecar:[],agentMemory:[],scratch:[],userConfigDir:[],job:[],bridgeSpawn:[]};function ije(e){let t=e.namespace==="agentMemory"?aje(e):void 0;if(t!==void 0)return t;if(e.namespace==="transcript"||e.namespace==="sidecar"){let r=Ty("scope.sessionId",e.sessionId);if(r!==void 0)return r}for(let[r,o]of sje[e.namespace])if(r in e&&e[r]!==void 0)return J(`scope.${r}`,o);if(e.namespace==="sidecar"&&Cy(e.relPath))return J("scope.relPath",Vf);if(e.namespace==="sidecar"&&iq(e.relPath))return J("scope.relPath",oq);if(e.namespace==="log"&&e.channel!==void 0&&!uq(e.channel))return J("scope.channel",lq);if(e.namespace==="job"&&fq(e.relPath))return J("scope.relPath",pq);let n=e.namespace==="sessionLog"?nje(e):void 0;if(n!==void 0)return n;if(e.namespace==="scratch"&&e.sessionId===void 0&&e.relPath!==void 0)return J("scope.relPath","requires scope.sessionId: a scratch relPath narrows one session directory, and no cross-session prefix filter exists");if(e.namespace==="userConfigDir"&&!VW.has(e.dir))return J("scope.dir",ZW);if(e.namespace==="transcript"&&e.agentRelPath!==void 0&&(e.projectKey===void 0||e.sessionId===void 0))return J("scope.agentRelPath","requires scope.projectKey and scope.sessionId: an agentRelPath narrows the subagents/ tree of one session directory");if(e.namespace==="transcript"&&Cy(e.agentRelPath))return J("scope.agentRelPath",Vf);if(e.namespace==="pluginCache"){if(e.marketplace===void 0&&e.plugin!==void 0)return J("scope.plugin","requires scope.marketplace: a plugin narrows one marketplace folder");if(e.plugin===void 0&&e.version!==void 0)return J("scope.version","requires scope.plugin: a version narrows one plugin folder");if(e.version===void 0&&e.relPath!==void 0)return J("scope.relPath","requires scope.version: a relPath narrows one version folder")}if(e.namespace==="job"&&e.jobId===void 0&&e.relPath!==void 0)return J("scope.relPath","requires scope.jobId: a job relPath narrows one job directory, and no cross-job prefix filter exists");if(e.namespace==="transcript"&&e.projectKey===void 0&&e.sessionId!==void 0)return J("scope.sessionId","requires scope.projectKey: a session narrows one project folder, and no cross-project session filter exists");if(e.namespace==="globalConfig"&&e.kind!==void 0&&!nq(e.kind))return J("scope.kind",tq);return}function aje(e){if(!QW(e.layer))return J("scope.layer","must be user, project or local");if(e.layer==="user"&&"projectKey"in e)return J("scope.projectKey","the user layer is not keyed by project");if(e.layer!=="user"&&typeof e.projectKey!=="string")return J("scope.projectKey","required for the project and local layers");return e.agentType===void 0&&e.relPath!==void 0?J("scope.relPath","requires scope.agentType: an agent-memory relPath narrows one agent directory"):void 0}function cje(e){switch(e.namespace){case"transcript":return[["projectKey",e.projectKey,"optional"],["sessionId",e.sessionId,"optional"],["agentRelPath",e.agentRelPath,"optional"]];case"task":return[["listId",e.listId,"optional"]];case"mailbox":return[["team",e.team,"optional"]];case"memory":return[["projectKey",e.projectKey],["relPath",e.relPath,"optional"]];case"pluginCache":return[["marketplace",e.marketplace,"optional"],["plugin",e.plugin,"optional"],["version",e.version,"optional"],["relPath",e.relPath,"optional"]];case"marketplaceCache":return[["marketplace",e.marketplace],["relPath",e.relPath,"optional"]];case"cache":return[["store",e.store]];case"state":case"plan":case"paste":case"pluginAssetCache":case"feedbackDraft":return[];case"sidecar":return[["projectKey",e.projectKey],["sessionId",e.sessionId],["relPath",e.relPath,"optional"]];case"agentMemory":return[["projectKey",e.layer==="user"?void 0:e.projectKey,"optional"],["agentType",e.agentType,"optional"],["relPath",e.relPath,"optional"]];case"scratch":return[["sessionId",e.sessionId,"optional"],["relPath",e.relPath,"optional"]];case"userConfigDir":return[["relPath",e.relPath,"optional"]];case"fileHistory":return[["sessionId",e.sessionId,"optional"]];case"job":return[["jobId",e.jobId,"optional"],["relPath",e.relPath,"optional"]];case"daemon":return[["relPath",e.relPath,"optional"]];case"jobsRoot":case"session":return[];case"bridgeSpawn":return[["dir",e.dir,"optional"]];case"globalConfig":return[["kind",e.kind,"optional"]];case"log":return[["sessionId",e.sessionId,"optional"]];case"sessionLog":return[["projectKey",e.projectKey,"optional"],["year",e.year,"optional"],["month",e.month,"optional"],["day",e.day,"optional"]]}return}function Ai(e,t){if(!Te()||t===void 0)return;if(!e.endsWith(".jsonl"))return;let n=gq(e);if(gq(n)!==bt())return;let r=hq(n),o=hq(e,".jsonl");if(e!==lje(bt(),r,`${o}.jsonl`))return;let s=en.transcript(r,o);return Ps(s)===void 0?{backend:t,key:s}:void 0}function tr(e){if(!Te()||e===void 0)return;return{backend:e,transcriptKey:en.transcript,isKeySegment:dn}}function Nn(e){return e===void 0?void 0:{source:e,hoverRestOn:Te()}}async function dje(e,t,n){try{let r=Nn(Ai(e,n));if(t>FW&&!Mn.CLAUDE_CODE_DISABLE_PRECOMPACT_SKIP)return(await $W(e,t,r)).postBoundaryBuf;if(r!==void 0&&r.hoverRestOn){let o=await r.source.backend.read([r.source.key]);if(!o.ok)return null;let s=o.value.items[0];if(!s.found)return null;return Buffer.from(s.value.buffer,s.value.byteOffset,s.value.byteLength)}return await uje(e)}catch{return null}}var _q=524288,yq=8192;async function pje(e){let a=[];try{const t=Ft(a,Qt`parseTranscriptEntries(${e.length} bytes)`,0);let n=[];let r=10;let o=e.length;let s=0;let i=_q;while(s<o){if(s>=i)await new Promise((h)=>setImmediate(h)),i=s+_q;let p=e.indexOf(r,s);if(p===-1)p=o;let f=s;while(f<p&&e[f]<=32)f++;if(s=p+1,f>=p)continue;let m=e.toString("utf-8",f,p);try{let h=ej(m),g=h.type;if((g==="user"||g==="assistant"||g==="progress"||g==="system"||g==="attachment")&&typeof h.uuid==="string")n.push(h)}catch{}}return n}catch(c){var l=c,u=1}finally{jt(a,l,u)}}async function fje(e){let t=new Map;for(let m of e)t.set(m.uuid,m);let n=0;for(let m of t.values()){if(m.type!=="system"||m.subtype!=="compact_boundary")continue;let h=m.compactMetadata?.preservedMessages,g=m.compactMetadata?.preservedSegment;if(h){if(h.uuids.length===0||h.uuids.some((x)=>!t.has(x)))continue;let y=h.anchorUuid;for(let x of h.uuids){let v=t.get(x);t.set(x,{...v,parentUuid:y}),y=x}let S=h.uuids[0],b=h.uuids.at(-1);for(let[x,v]of t){if(++n%yq===0)await new Promise((A)=>setImmediate(A));if(v.parentUuid===h.anchorUuid&&x!==S)t.set(x,{...v,parentUuid:b})}}else if(g){let y=t.get(g.headUuid);if(y)t.set(g.headUuid,{...y,parentUuid:g.anchorUuid});for(let[S,b]of t){if(++n%yq===0)await new Promise((x)=>setImmediate(x));if(b.parentUuid===g.anchorUuid&&S!==g.headUuid)t.set(S,{...b,parentUuid:g.tailUuid})}}}let r=new Map;for(let m=0;m<e.length;m++)r.set(e[m].uuid,m);let o=new Set;for(let m of t.values())if(m.parentUuid)o.add(m.parentUuid);let s=[...t.values()].filter((m)=>!o.has(m.uuid)),i=[];for(let m of s){let h=m,g=new Set;while(h){if(g.has(h.uuid))break;if(g.add(h.uuid),h.type==="user"||h.type==="assistant"){i.push(h);break}h=h.parentUuid?t.get(h.parentUuid):void 0}}if(i.length===0)return[];let a=i.filter((m)=>!m.isSidechain&&!m.teamName&&!m.isMeta),c=(m)=>m.reduce((h,g)=>(r.get(g.uuid)??-1)>(r.get(h.uuid)??-1)?g:h),l=a.length>0?c(a):c(i),u=[],p=new Set,f=t.get(l.uuid);while(f){if(p.has(f.uuid))break;p.add(f.uuid),u.push(f),f=f.parentUuid?t.get(f.parentUuid):void 0}return u.reverse(),await new Promise((m)=>setImmediate(m)),hje(t,u,p)}function XC(e){if(e.type!=="assistant")return;let t=e.message;if(typeof t!=="object"||t===null)return;let n=t.id;return typeof n==="string"?n:void 0}function mje(e){if(e.type!=="user"||!e.parentUuid)return!1;let t=e.message;if(typeof t!=="object"||t===null)return!1;let n=t.content;if(!Array.isArray(n))return!1;return n.some((r)=>typeof r==="object"&&r!==null&&r.type==="tool_result")}function hje(e,t,n){let r=t.filter((p)=>p.type==="assistant");if(r.length===0)return t;let o=new Map;for(let p of r){let f=XC(p);if(f)o.set(f,p)}let s=new Map,i=new Map;for(let p of e.values()){let f=XC(p);if(f){let m=s.get(f);if(m)m.push(p);else s.set(f,[p])}else if(mje(p)){let m=p.parentUuid,h=i.get(m);if(h)h.push(p);else i.set(m,[p])}}let a=new Set,c=new Map,l=0;for(let p of r){let f=XC(p);if(!f||a.has(f))continue;a.add(f);let m=s.get(f)??[p],h=m.filter((x)=>!n.has(x.uuid)),g=[];for(let x of m){let v=i.get(x.uuid);if(!v)continue;for(let A of v)if(!n.has(A.uuid))g.push(A)}if(h.length===0&&g.length===0)continue;let y=(x,v)=>(x.timestamp??"").localeCompare(v.timestamp??"");h.sort(y),g.sort(y);let S=o.get(f),b=[...h,...g];for(let x of b)n.add(x.uuid);l+=b.length,c.set(S.uuid,b)}if(l===0)return t;let u=[];for(let p of t){u.push(p);let f=c.get(p.uuid);if(f)u.push(...f)}return u}function gje(e,t){if(e.type==="user"||e.type==="assistant");else if(e.type==="system"&&t);else return!1;if(e.isMeta)return!1;if(e.isSidechain)return!1;if(e.teamName)return!1;return!0}function QC(e,t,n){return{type:e.type,uuid:e.uuid,session_id:e.sessionId,message:e.message,parent_tool_use_id:t??null,parent_agent_id:n??null,timestamp:e.timestamp}}function ek(e,t){let n=t?.offset??0;if(t?.limit!==void 0&&t.limit>0)return e.slice(n,n+t.limit);if(n>0)return e.slice(n);return e}async function bq(e,t){let n=[];for(let r of e){if(typeof r!=="object"||r===null)continue;let o=r,s=o.type;if((s==="user"||s==="assistant"||s==="progress"||s==="system"||s==="attachment")&&typeof o.uuid==="string")n.push(o)}return Sq(n,t)}async function Sq(e,t){let n=await fje(e),r=t?.includeSystemMessages??!1,s=n.filter((i)=>gje(i,r)).map((i)=>QC(i));return ek(s,t)}async function Eq(e,t,n){if(!rt(e))return[];let r=Te(),o=r?n:void 0,s=await wi(e,t?.dir,tr(o),r);if(!s)return[];let i=await dje(s.filePath,s.fileSize,o);if(!i)return[];return Sq(await pje(i),t)}import{readdir as mO,stat as Rze}from"fs/promises";import{basename as _je,dirname as yje,join as bje}from"path";function Sje(){return bje(Gt(),"projects")}function xq(e){return yje(e)===Sje()?_je(e):void 0}class vq{projectDirCache=new Map;agentTranscriptSubdirs=new Map;cacheProjectDir(e,t){this.projectDirCache.set(e,t)}clearProjectDirCache(){this.projectDirCache.clear()}setAgentTranscriptSubdir(e,t){this.agentTranscriptSubdirs.set(e,t)}clearAgentTranscriptSubdir(e){this.agentTranscriptSubdirs.delete(e)}}var vRt=new tt(()=>new vq);import{basename as Oze,join as lm}from"path";import{readFile as vze}from"fs/promises";import{dirname as wze,join as Aze}from"path";var wq=Object.freeze({status:"aborted"});function P(e,t,n){function r(a,c){var l;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(l=a._zod).traits??(l.traits=new Set),a._zod.traits.add(e),t(a,c);for(let u in i.prototype)if(!(u in a))Object.defineProperty(a,u,{value:i.prototype[u].bind(a)});a._zod.constr=i,a._zod.def=c}let o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let l=n?.Parent?new s:this;r(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let u of l._zod.deferred)u();return l}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:(a)=>{if(n?.Parent&&a instanceof n.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}var Aq=Symbol("zod_brand");class Ti extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var ky={};function nr(e){if(e)Object.assign(ky,e);return ky}var Oe={};rn(Oe,{BIGINT_FORMAT_RANGES:()=>Cq,Class:()=>Rq,NUMBER_FORMAT_RANGES:()=>ck,aborted:()=>Ga,allowsEval:()=>sk,assert:()=>Aje,assertEqual:()=>Eje,assertIs:()=>vje,assertNever:()=>wje,assertNotEqual:()=>xje,assignProp:()=>ok,cached:()=>Jf,captureStackTrace:()=>Oy,cleanEnum:()=>Fje,cleanRegex:()=>Qf,clone:()=>rr,createTransparentProxy:()=>Pje,defineLazy:()=>Ye,esc:()=>Ka,escapeRegex:()=>Ci,extend:()=>Lje,finalizeIssue:()=>xo,floatSafeRemainder:()=>rk,getElementAtPath:()=>Tje,getEnumValues:()=>Yf,getLengthableOrigin:()=>em,getParsedType:()=>Oje,getSizableOrigin:()=>kq,isObject:()=>vu,isPlainObject:()=>wu,issue:()=>lk,joinValues:()=>Ry,jsonStringifyReplacer:()=>nk,merge:()=>Mje,normalizeParams:()=>pe,nullish:()=>Xf,numKeys:()=>Rje,omit:()=>Dje,optionalKeys:()=>ak,partial:()=>Nje,pick:()=>Ije,prefixIssues:()=>Qo,primitiveTypes:()=>Tq,promiseAllObject:()=>Cje,propertyKeyTypes:()=>ik,randomString:()=>kje,required:()=>Uje,stringifyPrimitive:()=>Py,unwrapMessage:()=>Zf});function Eje(e){return e}function xje(e){return e}function vje(e){}function wje(e){throw Error()}function Aje(e){}function Yf(e){let t=Object.values(e).filter((r)=>typeof r==="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Ry(e,t="|"){return e.map((n)=>Py(n)).join(t)}function nk(e,t){if(typeof t==="bigint")return t.toString();return t}function Jf(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw Error("cached value already set")}}}function Xf(e){return e===null||e===void 0}function Qf(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function rk(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}function Ye(e,t,n){Object.defineProperty(e,t,{get(){{let o=n();return e[t]=o,o}throw Error("cached value already set")},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function ok(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Tje(e,t){if(!t)return e;return t.reduce((n,r)=>n?.[r],e)}function Cje(e){let t=Object.keys(e),n=t.map((r)=>e[r]);return Promise.all(n).then((r)=>{let o={};for(let s=0;s<t.length;s++)o[t[s]]=r[s];return o})}function kje(e=10){let n="";for(let r=0;r<e;r++)n+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return n}function Ka(e){return JSON.stringify(e)}var Oy=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function vu(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var sk=Jf(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function wu(e){if(vu(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;if(vu(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function Rje(e){let t=0;for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n))t++;return t}var Oje=(e)=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(e===null)return"null";if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return"promise";if(typeof Map<"u"&&e instanceof Map)return"map";if(typeof Set<"u"&&e instanceof Set)return"set";if(typeof Date<"u"&&e instanceof Date)return"date";if(typeof File<"u"&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},ik=new Set(["string","number","symbol"]),Tq=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ci(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function rr(e,t,n){let r=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)r._zod.parent=e;return r}function pe(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Pje(e){let t;return new Proxy({},{get(n,r,o){return t??(t=e()),Reflect.get(t,r,o)},set(n,r,o,s){return t??(t=e()),Reflect.set(t,r,o,s)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,o){return t??(t=e()),Reflect.defineProperty(t,r,o)}})}function Py(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function ak(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var ck={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Cq={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ije(e,t){let n={},r=e._zod.def;for(let o in t){if(!(o in r.shape))throw Error(`Unrecognized key: "${o}"`);if(!t[o])continue;n[o]=r.shape[o]}return rr(e,{...e._zod.def,shape:n,checks:[]})}function Dje(e,t){let n={...e._zod.def.shape},r=e._zod.def;for(let o in t){if(!(o in r.shape))throw Error(`Unrecognized key: "${o}"`);if(!t[o])continue;delete n[o]}return rr(e,{...e._zod.def,shape:n,checks:[]})}function Lje(e,t){if(!wu(t))throw Error("Invalid input to extend: expected a plain object");let n={...e._zod.def,get shape(){let r={...e._zod.def.shape,...t};return ok(this,"shape",r),r},checks:[]};return rr(e,n)}function Mje(e,t){return rr(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ok(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function Nje(e,t,n){let r=t._zod.def.shape,o={...r};if(n)for(let s in n){if(!(s in r))throw Error(`Unrecognized key: "${s}"`);if(!n[s])continue;o[s]=e?new e({type:"optional",innerType:r[s]}):r[s]}else for(let s in r)o[s]=e?new e({type:"optional",innerType:r[s]}):r[s];return rr(t,{...t._zod.def,shape:o,checks:[]})}function Uje(e,t,n){let r=t._zod.def.shape,o={...r};if(n)for(let s in n){if(!(s in o))throw Error(`Unrecognized key: "${s}"`);if(!n[s])continue;o[s]=new e({type:"nonoptional",innerType:r[s]})}else for(let s in r)o[s]=new e({type:"nonoptional",innerType:r[s]});return rr(t,{...t._zod.def,shape:o,checks:[]})}function Ga(e,t=0){for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Qo(e,t){return t.map((n)=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Zf(e){return typeof e==="string"?e:e?.message}function xo(e,t,n){let r={...e,path:e.path??[]};if(!e.message){let o=Zf(e.inst?._zod.def?.error?.(e))??Zf(t?.error?.(e))??Zf(n.customError?.(e))??Zf(n.localeError?.(e))??"Invalid input";r.message=o}if(delete r.inst,delete r.continue,!t?.reportInput)delete r.input;return r}function kq(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function em(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function lk(...e){let[t,n,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:r};return{...t}}function Fje(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map((t)=>t[1])}class Rq{constructor(...e){}}var Oq=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,nk,2)},enumerable:!0})},Iy=P("$ZodError",Oq),tm=P("$ZodError",Oq,{Parent:Error});function Dy(e,t=(n)=>n.message){let n={},r=[];for(let o of e.issues)if(o.path.length>0)n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o));else r.push(t(o));return{formErrors:r,fieldErrors:n}}function Ly(e,t){let n=t||function(s){return s.message},r={_errors:[]},o=(s)=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((a)=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)r._errors.push(n(i));else{let a=r,c=0;while(c<i.path.length){let l=i.path[c];if(c!==i.path.length-1)a[l]=a[l]||{_errors:[]};else a[l]=a[l]||{_errors:[]},a[l]._errors.push(n(i));a=a[l],c++}}};return o(e),r}var uk=(e)=>(t,n,r,o)=>{let s=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new Ti;if(i.issues.length){let a=new(o?.Err??e)(i.issues.map((c)=>xo(c,s,nr())));throw Oy(a,o?.callee),a}return i.value},dk=uk(tm),pk=(e)=>async(t,n,r,o)=>{let s=r?Object.assign(r,{async:!0}):{async:!0},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)i=await i;if(i.issues.length){let a=new(o?.Err??e)(i.issues.map((c)=>xo(c,s,nr())));throw Oy(a,o?.callee),a}return i.value},fk=pk(tm),mk=(e)=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Ti;return s.issues.length?{success:!1,error:new(e??Iy)(s.issues.map((i)=>xo(i,o,nr())))}:{success:!0,data:s.value}},Wa=mk(tm),hk=(e)=>async(t,n,r)=>{let o=r?Object.assign(r,{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)s=await s;return s.issues.length?{success:!1,error:new e(s.issues.map((i)=>xo(i,o,nr())))}:{success:!0,data:s.value}},qa=hk(tm);var Pq=/^[cC][^\s-]{8,}$/,Iq=/^[0-9a-z]+$/,Dq=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Lq=/^[0-9a-vA-V]{20}$/,Mq=/^[A-Za-z0-9]{27}$/,Nq=/^[a-zA-Z0-9_-]{21}$/,Uq=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Fq=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,gk=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var jq=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function $q(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var zq=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Hq=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Bq=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Kq=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Gq=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_k=/^[A-Za-z0-9_-]*$/,Wq=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var qq=/^\+(?:[0-9]){6,14}[0-9]$/,Vq="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Zq=new RegExp(`^${Vq}$`);function Yq(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Jq(e){return new RegExp(`^${Yq(e)}$`)}function Xq(e){let t=Yq({precision:e.precision}),n=["Z"];if(e.local)n.push("");if(e.offset)n.push("([+-]\\d{2}:\\d{2})");let r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Vq}T(?:${r})$`)}var Qq=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},eV=/^\d+n?$/,tV=/^\d+$/,nV=/^-?\d+(?:\.\d+)?/i,rV=/true|false/i,oV=/null/i;var sV=/undefined/i;var iV=/^[^A-Z]*$/,aV=/^[^a-z]*$/;var yn=P("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),cV={number:"number",bigint:"bigint",object:"date"},yk=P("$ZodCheckLessThan",(e,t)=>{yn.init(e,t);let n=cV[typeof t.value];e._zod.onattach.push((r)=>{let o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<s)if(t.inclusive)o.maximum=t.value;else o.exclusiveMaximum=t.value}),e._zod.check=(r)=>{if(t.inclusive?r.value<=t.value:r.value<t.value)return;r.issues.push({origin:n,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),bk=P("$ZodCheckGreaterThan",(e,t)=>{yn.init(e,t);let n=cV[typeof t.value];e._zod.onattach.push((r)=>{let o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>s)if(t.inclusive)o.minimum=t.value;else o.exclusiveMinimum=t.value}),e._zod.check=(r)=>{if(t.inclusive?r.value>=t.value:r.value>t.value)return;r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),lV=P("$ZodCheckMultipleOf",(e,t)=>{yn.init(e,t),e._zod.onattach.push((n)=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=(n)=>{if(typeof n.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?n.value%t.value===BigInt(0):rk(n.value,t.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),uV=P("$ZodCheckNumberFormat",(e,t)=>{yn.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[o,s]=ck[t.format];e._zod.onattach.push((i)=>{let a=i._zod.bag;if(a.format=t.format,a.minimum=o,a.maximum=s,n)a.pattern=tV}),e._zod.check=(i)=>{let a=i.value;if(n){if(!Number.isInteger(a)){i.issues.push({expected:r,format:t.format,code:"invalid_type",input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});else i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});return}}if(a<o)i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(a>s)i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:e})}});var dV=P("$ZodCheckMaxLength",(e,t)=>{yn.init(e,t),e._zod.when=(n)=>{let r=n.value;return!Xf(r)&&r.length!==void 0},e._zod.onattach.push((n)=>{let r=n._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<r)n._zod.bag.maximum=t.maximum}),e._zod.check=(n)=>{let r=n.value;if(r.length<=t.maximum)return;let s=em(r);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pV=P("$ZodCheckMinLength",(e,t)=>{yn.init(e,t),e._zod.when=(n)=>{let r=n.value;return!Xf(r)&&r.length!==void 0},e._zod.onattach.push((n)=>{let r=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>r)n._zod.bag.minimum=t.minimum}),e._zod.check=(n)=>{let r=n.value;if(r.length>=t.minimum)return;let s=em(r);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),fV=P("$ZodCheckLengthEquals",(e,t)=>{yn.init(e,t),e._zod.when=(n)=>{let r=n.value;return!Xf(r)&&r.length!==void 0},e._zod.onattach.push((n)=>{let r=n._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=(n)=>{let r=n.value,o=r.length;if(o===t.length)return;let s=em(r),i=o>t.length;n.issues.push({origin:s,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),rm=P("$ZodCheckStringFormat",(e,t)=>{var n,r;if(yn.init(e,t),e._zod.onattach.push((o)=>{let s=o._zod.bag;if(s.format=t.format,t.pattern)s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern)}),t.pattern)(n=e._zod).check??(n.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(r=e._zod).check??(r.check=()=>{})}),mV=P("$ZodCheckRegex",(e,t)=>{rm.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),hV=P("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=iV),rm.init(e,t)}),gV=P("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=aV),rm.init(e,t)}),_V=P("$ZodCheckIncludes",(e,t)=>{yn.init(e,t);let n=Ci(t.includes),r=new RegExp(typeof t.position==="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push((o)=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),yV=P("$ZodCheckStartsWith",(e,t)=>{yn.init(e,t);let n=new RegExp(`^${Ci(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=(r)=>{if(r.value.startsWith(t.prefix))return;r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),bV=P("$ZodCheckEndsWith",(e,t)=>{yn.init(e,t);let n=new RegExp(`.*${Ci(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=(r)=>{if(r.value.endsWith(t.suffix))return;r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});var SV=P("$ZodCheckOverwrite",(e,t)=>{yn.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class Sk{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
113
- `).filter((s)=>s),r=Math.min(...n.map((s)=>s.length-s.trimStart().length)),o=n.map((s)=>s.slice(r)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let e=Function,t=this?.args,r=[...(this?.content??[""]).map((o)=>` ${o}`)];return new e(...t,r.join(`
114
- `))}}var xV={major:4,minor:0,patch:0};var Ze=P("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=xV;let r=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))r.unshift(e);for(let o of r)for(let s of o._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(s,i,a)=>{let c=Ga(s),l;for(let u of i){if(u._zod.when){if(!u._zod.when(s))continue}else if(c)continue;let p=s.issues.length,f=u._zod.check(s);if(f instanceof Promise&&a?.async===!1)throw new Ti;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{if(await f,s.issues.length===p)return;if(!c)c=Ga(s,p)});else{if(s.issues.length===p)continue;if(!c)c=Ga(s,p)}}if(l)return l.then(()=>s);return s};e._zod.run=(s,i)=>{let a=e._zod.parse(s,i);if(a instanceof Promise){if(i.async===!1)throw new Ti;return a.then((c)=>o(c,r,i))}return o(a,r,i)}}e["~standard"]={validate:(o)=>{try{let s=Wa(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch(s){return qa(e,o).then((i)=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),om=P("$ZodString",(e,t)=>{Ze.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Qq(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),ut=P("$ZodStringFormat",(e,t)=>{rm.init(e,t),om.init(e,t)}),xk=P("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Fq),ut.init(e,t)}),vk=P("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=gk(r))}else t.pattern??(t.pattern=gk());ut.init(e,t)}),wk=P("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=jq),ut.init(e,t)}),Ak=P("$ZodURL",(e,t)=>{ut.init(e,t),e._zod.check=(n)=>{try{let r=n.value,o=new URL(r),s=o.href;if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(o.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Wq.source,input:n.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})}if(!r.endsWith("/")&&s.endsWith("/"))n.value=s.slice(0,-1);else n.value=s;return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Tk=P("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=$q()),ut.init(e,t)}),Ck=P("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Nq),ut.init(e,t)}),kk=P("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Pq),ut.init(e,t)}),Rk=P("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Iq),ut.init(e,t)}),Ok=P("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Dq),ut.init(e,t)}),Pk=P("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Lq),ut.init(e,t)}),Ik=P("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Mq),ut.init(e,t)}),IV=P("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Xq(t)),ut.init(e,t)}),DV=P("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Zq),ut.init(e,t)}),LV=P("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Jq(t)),ut.init(e,t)}),MV=P("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Uq),ut.init(e,t)}),Dk=P("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=zq),ut.init(e,t),e._zod.onattach.push((n)=>{let r=n._zod.bag;r.format="ipv4"})}),Lk=P("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Hq),ut.init(e,t),e._zod.onattach.push((n)=>{let r=n._zod.bag;r.format="ipv6"}),e._zod.check=(n)=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Mk=P("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Bq),ut.init(e,t)}),Nk=P("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Kq),ut.init(e,t),e._zod.check=(n)=>{let[r,o]=n.value.split("/");try{if(!o)throw Error();let s=Number(o);if(`${s}`!==o)throw Error();if(s<0||s>128)throw Error();new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function NV(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Uk=P("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Gq),ut.init(e,t),e._zod.onattach.push((n)=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=(n)=>{if(NV(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function $je(e){if(!_k.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return NV(n)}var Fk=P("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=_k),ut.init(e,t),e._zod.onattach.push((n)=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=(n)=>{if($je(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),jk=P("$ZodE164",(e,t)=>{t.pattern??(t.pattern=qq),ut.init(e,t)});function zje(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var $k=P("$ZodJWT",(e,t)=>{ut.init(e,t),e._zod.check=(n)=>{if(zje(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});var Ny=P("$ZodNumber",(e,t)=>{Ze.init(e,t),e._zod.pattern=e._zod.bag.pattern??nV,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(i){}let o=n.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let s=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?"Infinity":void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),zk=P("$ZodNumber",(e,t)=>{uV.init(e,t),Ny.init(e,t)}),Hk=P("$ZodBoolean",(e,t)=>{Ze.init(e,t),e._zod.pattern=rV,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(s){}let o=n.value;if(typeof o==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),Bk=P("$ZodBigInt",(e,t)=>{Ze.init(e,t),e._zod.pattern=eV,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(o){}if(typeof n.value==="bigint")return n;return n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}});var Kk=P("$ZodUndefined",(e,t)=>{Ze.init(e,t),e._zod.pattern=sV,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(n,r)=>{let o=n.value;if(typeof o>"u")return n;return n.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),n}}),Gk=P("$ZodNull",(e,t)=>{Ze.init(e,t),e._zod.pattern=oV,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{let o=n.value;if(o===null)return n;return n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}});var Wk=P("$ZodUnknown",(e,t)=>{Ze.init(e,t),e._zod.parse=(n)=>n}),qk=P("$ZodNever",(e,t)=>{Ze.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});var Vk=P("$ZodDate",(e,t)=>{Ze.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(a){}let o=n.value,s=o instanceof Date;if(s&&!Number.isNaN(o.getTime()))return n;return n.issues.push({expected:"date",code:"invalid_type",input:o,...s?{received:"Invalid Date"}:{},inst:e}),n}});function vV(e,t,n){if(e.issues.length)t.issues.push(...Qo(n,e.issues));t.value[n]=e.value}var Zk=P("$ZodArray",(e,t)=>{Ze.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let a=o[i],c=t.element._zod.run({value:a,issues:[]},r);if(c instanceof Promise)s.push(c.then((l)=>vV(l,n,i)));else vV(c,n,i)}if(s.length)return Promise.all(s).then(()=>n);return n}});function My(e,t,n){if(e.issues.length)t.issues.push(...Qo(n,e.issues));t.value[n]=e.value}function wV(e,t,n,r){if(e.issues.length)if(r[n]===void 0)if(n in r)t.value[n]=void 0;else t.value[n]=e.value;else t.issues.push(...Qo(n,e.issues));else if(e.value===void 0){if(n in r)t.value[n]=void 0}else t.value[n]=e.value}var Uy=P("$ZodObject",(e,t)=>{Ze.init(e,t);let n=Jf(()=>{let p=Object.keys(t.shape);for(let m of p)if(!(t.shape[m]instanceof Ze))throw Error(`Invalid element at key "${m}": expected a Zod schema`);let f=ak(t.shape);return{shape:t.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(f)}});Ye(e._zod,"propValues",()=>{let p=t.shape,f={};for(let m in p){let h=p[m]._zod;if(h.values){f[m]??(f[m]=new Set);for(let g of h.values)f[m].add(g)}}return f});let r=(p)=>{let f=new Sk(["shape","payload","ctx"]),m=n.value,h=(b)=>{let x=Ka(b);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};f.write("const input = payload.value;");let g=Object.create(null),y=0;for(let b of m.keys)g[b]=`key_${y++}`;f.write("const newResult = {}");for(let b of m.keys)if(m.optionalKeys.has(b)){let x=g[b];f.write(`const ${x} = ${h(b)};`);let v=Ka(b);f.write(`
115
- if (${x}.issues.length) {
116
- if (input[${v}] === undefined) {
117
- if (${v} in input) {
118
- newResult[${v}] = undefined;
119
- }
120
- } else {
121
- payload.issues = payload.issues.concat(
122
- ${x}.issues.map((iss) => ({
123
- ...iss,
124
- path: iss.path ? [${v}, ...iss.path] : [${v}],
125
- }))
126
- );
127
- }
128
- } else if (${x}.value === undefined) {
129
- if (${v} in input) newResult[${v}] = undefined;
130
- } else {
131
- newResult[${v}] = ${x}.value;
132
- }
133
- `)}else{let x=g[b];f.write(`const ${x} = ${h(b)};`),f.write(`
134
- if (${x}.issues.length) payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
135
- ...iss,
136
- path: iss.path ? [${Ka(b)}, ...iss.path] : [${Ka(b)}]
137
- })));`),f.write(`newResult[${Ka(b)}] = ${x}.value`)}f.write("payload.value = newResult;"),f.write("return payload;");let S=f.compile();return(b,x)=>S(p,b,x)},o,s=vu,i=!ky.jitless,c=i&&sk.value,l=t.catchall,u;e._zod.parse=(p,f)=>{u??(u=n.value);let m=p.value;if(!s(m))return p.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),p;let h=[];if(i&&c&&f?.async===!1&&f.jitless!==!0){if(!o)o=r(t.shape);p=o(p,f)}else{p.value={};let x=u.shape;for(let v of u.keys){let A=x[v],U=A._zod.run({value:m[v],issues:[]},f),D=A._zod.optin==="optional"&&A._zod.optout==="optional";if(U instanceof Promise)h.push(U.then((F)=>D?wV(F,p,v,m):My(F,p,v)));else if(D)wV(U,p,v,m);else My(U,p,v)}}if(!l)return h.length?Promise.all(h).then(()=>p):p;let g=[],y=u.keySet,S=l._zod,b=S.def.type;for(let x of Object.keys(m)){if(y.has(x))continue;if(b==="never"){g.push(x);continue}let v=S.run({value:m[x],issues:[]},f);if(v instanceof Promise)h.push(v.then((A)=>My(A,p,x)));else My(v,p,x)}if(g.length)p.issues.push({code:"unrecognized_keys",keys:g,input:m,inst:e});if(!h.length)return p;return Promise.all(h).then(()=>p)}});function AV(e,t,n,r){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((o)=>o.issues.map((s)=>xo(s,r,nr())))}),t}var Fy=P("$ZodUnion",(e,t)=>{Ze.init(e,t),Ye(e._zod,"optin",()=>t.options.some((n)=>n._zod.optin==="optional")?"optional":void 0),Ye(e._zod,"optout",()=>t.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),Ye(e._zod,"values",()=>{if(t.options.every((n)=>n._zod.values))return new Set(t.options.flatMap((n)=>Array.from(n._zod.values)));return}),Ye(e._zod,"pattern",()=>{if(t.options.every((n)=>n._zod.pattern)){let n=t.options.map((r)=>r._zod.pattern);return new RegExp(`^(${n.map((r)=>Qf(r.source)).join("|")})$`)}return}),e._zod.parse=(n,r)=>{let o=!1,s=[];for(let i of t.options){let a=i._zod.run({value:n.value,issues:[]},r);if(a instanceof Promise)s.push(a),o=!0;else{if(a.issues.length===0)return a;s.push(a)}}if(!o)return AV(s,n,e,r);return Promise.all(s).then((i)=>AV(i,n,e,r))}}),Yk=P("$ZodDiscriminatedUnion",(e,t)=>{Fy.init(e,t);let n=e._zod.parse;Ye(e._zod,"propValues",()=>{let o={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){if(!o[a])o[a]=new Set;for(let l of c)o[a].add(l)}}return o});let r=Jf(()=>{let o=t.options,s=new Map;for(let i of o){let a=i._zod.propValues[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(o,s)=>{let i=o.value;if(!vu(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=r.value.get(i?.[t.discriminator]);if(a)return a._zod.run(o,s);if(t.unionFallback)return n(o,s);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[t.discriminator],inst:e}),o}}),Jk=P("$ZodIntersection",(e,t)=>{Ze.init(e,t),e._zod.parse=(n,r)=>{let o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([c,l])=>TV(n,c,l));return TV(n,s,i)}});function Ek(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(wu(e)&&wu(t)){let n=Object.keys(t),r=Object.keys(e).filter((s)=>n.indexOf(s)!==-1),o={...e,...t};for(let s of r){let i=Ek(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let o=e[r],s=t[r],i=Ek(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function TV(e,t,n){if(t.issues.length)e.issues.push(...t.issues);if(n.issues.length)e.issues.push(...n.issues);if(Ga(e))return e;let r=Ek(t.value,n.value);if(!r.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}var Xk=P("$ZodRecord",(e,t)=>{Ze.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;if(!wu(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;let s=[];if(t.keyType._zod.values){let i=t.keyType._zod.values;n.value={};for(let c of i)if(typeof c==="string"||typeof c==="number"||typeof c==="symbol"){let l=t.valueType._zod.run({value:o[c],issues:[]},r);if(l instanceof Promise)s.push(l.then((u)=>{if(u.issues.length)n.issues.push(...Qo(c,u.issues));n.value[c]=u.value}));else{if(l.issues.length)n.issues.push(...Qo(c,l.issues));n.value[c]=l.value}}let a;for(let c in o)if(!i.has(c))a=a??[],a.push(c);if(a&&a.length>0)n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{n.value={};for(let i of Reflect.ownKeys(o)){if(i==="__proto__")continue;let a=t.keyType._zod.run({value:i,issues:[]},r);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map((l)=>xo(l,r,nr())),input:i,path:[i],inst:e}),n.value[a.value]=a.value;continue}let c=t.valueType._zod.run({value:o[i],issues:[]},r);if(c instanceof Promise)s.push(c.then((l)=>{if(l.issues.length)n.issues.push(...Qo(i,l.issues));n.value[a.value]=l.value}));else{if(c.issues.length)n.issues.push(...Qo(i,c.issues));n.value[a.value]=c.value}}}if(s.length)return Promise.all(s).then(()=>n);return n}});var Qk=P("$ZodEnum",(e,t)=>{Ze.init(e,t);let n=Yf(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter((r)=>ik.has(typeof r)).map((r)=>typeof r==="string"?Ci(r):r.toString()).join("|")})$`),e._zod.parse=(r,o)=>{let s=r.value;if(e._zod.values.has(s))return r;return r.issues.push({code:"invalid_value",values:n,input:s,inst:e}),r}}),eR=P("$ZodLiteral",(e,t)=>{Ze.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map((n)=>typeof n==="string"?Ci(n):n?n.toString():String(n)).join("|")})$`),e._zod.parse=(n,r)=>{let o=n.value;if(e._zod.values.has(o))return n;return n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}});var tR=P("$ZodTransform",(e,t)=>{Ze.init(e,t),e._zod.parse=(n,r)=>{let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then((i)=>(n.value=i,n));if(o instanceof Promise)throw new Ti;return n.value=o,n}}),nR=P("$ZodOptional",(e,t)=>{Ze.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ye(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ye(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Qf(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional")return t.innerType._zod.run(n,r);if(n.value===void 0)return n;return t.innerType._zod.run(n,r)}}),rR=P("$ZodNullable",(e,t)=>{Ze.init(e,t),Ye(e._zod,"optin",()=>t.innerType._zod.optin),Ye(e._zod,"optout",()=>t.innerType._zod.optout),Ye(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Qf(n.source)}|null)$`):void 0}),Ye(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>{if(n.value===null)return n;return t.innerType._zod.run(n,r)}}),oR=P("$ZodDefault",(e,t)=>{Ze.init(e,t),e._zod.optin="optional",Ye(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=t.defaultValue,n;let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then((s)=>CV(s,t));return CV(o,t)}});function CV(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var sR=P("$ZodPrefault",(e,t)=>{Ze.init(e,t),e._zod.optin="optional",Ye(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(n.value===void 0)n.value=t.defaultValue;return t.innerType._zod.run(n,r)}}),iR=P("$ZodNonOptional",(e,t)=>{Ze.init(e,t),Ye(e._zod,"values",()=>{let n=t.innerType._zod.values;return n?new Set([...n].filter((r)=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then((s)=>kV(s,e));return kV(o,e)}});function kV(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var aR=P("$ZodCatch",(e,t)=>{Ze.init(e,t),e._zod.optin="optional",Ye(e._zod,"optout",()=>t.innerType._zod.optout),Ye(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then((s)=>{if(n.value=s.value,s.issues.length)n.value=t.catchValue({...n,error:{issues:s.issues.map((i)=>xo(i,r,nr()))},input:n.value}),n.issues=[];return n});if(n.value=o.value,o.issues.length)n.value=t.catchValue({...n,error:{issues:o.issues.map((s)=>xo(s,r,nr()))},input:n.value}),n.issues=[];return n}});var cR=P("$ZodPipe",(e,t)=>{Ze.init(e,t),Ye(e._zod,"values",()=>t.in._zod.values),Ye(e._zod,"optin",()=>t.in._zod.optin),Ye(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(n,r)=>{let o=t.in._zod.run(n,r);if(o instanceof Promise)return o.then((s)=>RV(s,t,r));return RV(o,t,r)}});function RV(e,t,n){if(Ga(e))return e;return t.out._zod.run({value:e.value,issues:e.issues},n)}var lR=P("$ZodReadonly",(e,t)=>{Ze.init(e,t),Ye(e._zod,"propValues",()=>t.innerType._zod.propValues),Ye(e._zod,"values",()=>t.innerType._zod.values),Ye(e._zod,"optin",()=>t.innerType._zod.optin),Ye(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then(OV);return OV(o)}});function OV(e){return e.value=Object.freeze(e.value),e}var uR=P("$ZodLazy",(e,t)=>{Ze.init(e,t),Ye(e._zod,"innerType",()=>t.getter()),Ye(e._zod,"pattern",()=>e._zod.innerType._zod.pattern),Ye(e._zod,"propValues",()=>e._zod.innerType._zod.propValues),Ye(e._zod,"optin",()=>e._zod.innerType._zod.optin),Ye(e._zod,"optout",()=>e._zod.innerType._zod.optout),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),dR=P("$ZodCustom",(e,t)=>{yn.init(e,t),Ze.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=(n)=>{let r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then((s)=>PV(s,n,r,e));PV(o,n,r,e);return}});function PV(e,t,n,r){if(!e){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};if(r._zod.def.params)o.params=r._zod.def.params;t.issues.push(lk(o))}}var Hje=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},Bje=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function t(r){return e[r]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Invalid input: expected ${r.expected}, received ${Hje(r.input)}`;case"invalid_value":if(r.values.length===1)return`Invalid input: expected ${Py(r.values[0])}`;return`Invalid option: expected one of ${Ry(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",s=t(r.origin);if(s)return`Too big: expected ${r.origin??"value"} to have ${o}${r.maximum.toString()} ${s.unit??"elements"}`;return`Too big: expected ${r.origin??"value"} to be ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",s=t(r.origin);if(s)return`Too small: expected ${r.origin} to have ${o}${r.minimum.toString()} ${s.unit}`;return`Too small: expected ${r.origin} to be ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;if(o.format==="starts_with")return`Invalid string: must start with "${o.prefix}"`;if(o.format==="ends_with")return`Invalid string: must end with "${o.suffix}"`;if(o.format==="includes")return`Invalid string: must include "${o.includes}"`;if(o.format==="regex")return`Invalid string: must match pattern ${o.pattern}`;return`Invalid ${n[o.format]??r.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${r.divisor}`;case"unrecognized_keys":return`Unrecognized key${r.keys.length>1?"s":""}: ${Ry(r.keys,", ")}`;case"invalid_key":return`Invalid key in ${r.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${r.origin}`;default:return"Invalid input"}}};function pR(){return{localeError:Bje()}}var UV=Symbol("ZodOutput"),FV=Symbol("ZodInput");class jy{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==="object"&&"id"in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function fR(){return new jy}var Br=fR();function mR(e,t){return new e({type:"string",...pe(t)})}function jV(e,t){return new e({type:"string",coerce:!0,...pe(t)})}function hR(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...pe(t)})}function $y(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...pe(t)})}function gR(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...pe(t)})}function _R(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...pe(t)})}function yR(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...pe(t)})}function bR(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...pe(t)})}function SR(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...pe(t)})}function ER(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...pe(t)})}function xR(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...pe(t)})}function vR(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...pe(t)})}function wR(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...pe(t)})}function AR(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...pe(t)})}function TR(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...pe(t)})}function CR(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...pe(t)})}function kR(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...pe(t)})}function RR(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...pe(t)})}function OR(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...pe(t)})}function PR(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...pe(t)})}function IR(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...pe(t)})}function DR(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...pe(t)})}function LR(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...pe(t)})}function MR(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...pe(t)})}function $V(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...pe(t)})}function zV(e,t){return new e({type:"string",format:"date",check:"string_format",...pe(t)})}function HV(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...pe(t)})}function BV(e,t){return new e({type:"string",format:"duration",check:"string_format",...pe(t)})}function NR(e,t){return new e({type:"number",checks:[],...pe(t)})}function KV(e,t){return new e({type:"number",coerce:!0,checks:[],...pe(t)})}function UR(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...pe(t)})}function FR(e,t){return new e({type:"boolean",...pe(t)})}function GV(e,t){return new e({type:"boolean",coerce:!0,...pe(t)})}function WV(e,t){return new e({type:"bigint",coerce:!0,...pe(t)})}function jR(e,t){return new e({type:"undefined",...pe(t)})}function $R(e,t){return new e({type:"null",...pe(t)})}function zR(e){return new e({type:"unknown"})}function HR(e,t){return new e({type:"never",...pe(t)})}function qV(e,t){return new e({type:"date",coerce:!0,...pe(t)})}function Au(e,t){return new yk({check:"less_than",...pe(t),value:e,inclusive:!1})}function Is(e,t){return new yk({check:"less_than",...pe(t),value:e,inclusive:!0})}function Tu(e,t){return new bk({check:"greater_than",...pe(t),value:e,inclusive:!1})}function vo(e,t){return new bk({check:"greater_than",...pe(t),value:e,inclusive:!0})}function sm(e,t){return new lV({check:"multiple_of",...pe(t),value:e})}function zy(e,t){return new dV({check:"max_length",...pe(t),maximum:e})}function Cu(e,t){return new pV({check:"min_length",...pe(t),minimum:e})}function Hy(e,t){return new fV({check:"length_equals",...pe(t),length:e})}function BR(e,t){return new mV({check:"string_format",format:"regex",...pe(t),pattern:e})}function KR(e){return new hV({check:"string_format",format:"lowercase",...pe(e)})}function GR(e){return new gV({check:"string_format",format:"uppercase",...pe(e)})}function WR(e,t){return new _V({check:"string_format",format:"includes",...pe(t),includes:e})}function qR(e,t){return new yV({check:"string_format",format:"starts_with",...pe(t),prefix:e})}function VR(e,t){return new bV({check:"string_format",format:"ends_with",...pe(t),suffix:e})}function Va(e){return new SV({check:"overwrite",tx:e})}function ZR(e){return Va((t)=>t.normalize(e))}function YR(){return Va((e)=>e.trim())}function JR(){return Va((e)=>e.toLowerCase())}function XR(){return Va((e)=>e.toUpperCase())}function VV(e,t,n){return new e({type:"array",element:t,...pe(n)})}function QR(e,t,n){let r=pe(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function eO(e,t,n){return new e({type:"custom",check:"custom",fn:t,...pe(n)})}class tO{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Br,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,t={path:[],schemaPath:[]}){var n;let r=e._zod.def,o={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(e);if(s){if(s.count++,t.schemaPath.includes(e))s.cycle=t.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let u={...t,schemaPath:[...t.schemaPath,e],path:t.path},p=e._zod.parent;if(p)i.ref=p,this.process(p,u),this.seen.get(p).isParent=!0;else{let f=i.schema;switch(r.type){case"string":{let m=f;m.type="string";let{minimum:h,maximum:g,format:y,patterns:S,contentEncoding:b}=e._zod.bag;if(typeof h==="number")m.minLength=h;if(typeof g==="number")m.maxLength=g;if(y){if(m.format=o[y]??y,m.format==="")delete m.format}if(b)m.contentEncoding=b;if(S&&S.size>0){let x=[...S];if(x.length===1)m.pattern=x[0].source;else if(x.length>1)i.schema.allOf=[...x.map((v)=>({...this.target==="draft-7"?{type:"string"}:{},pattern:v.source}))]}break}case"number":{let m=f,{minimum:h,maximum:g,format:y,multipleOf:S,exclusiveMaximum:b,exclusiveMinimum:x}=e._zod.bag;if(typeof y==="string"&&y.includes("int"))m.type="integer";else m.type="number";if(typeof x==="number")m.exclusiveMinimum=x;if(typeof h==="number"){if(m.minimum=h,typeof x==="number")if(x>=h)delete m.minimum;else delete m.exclusiveMinimum}if(typeof b==="number")m.exclusiveMaximum=b;if(typeof g==="number"){if(m.maximum=g,typeof b==="number")if(b<=g)delete m.maximum;else delete m.exclusiveMaximum}if(typeof S==="number")m.multipleOf=S;break}case"boolean":{let m=f;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema");break}case"null":{f.type="null";break}case"any":break;case"unknown":break;case"undefined":case"never":{f.not={};break}case"void":{if(this.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema");break}case"date":{if(this.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema");break}case"array":{let m=f,{minimum:h,maximum:g}=e._zod.bag;if(typeof h==="number")m.minItems=h;if(typeof g==="number")m.maxItems=g;m.type="array",m.items=this.process(r.element,{...u,path:[...u.path,"items"]});break}case"object":{let m=f;m.type="object",m.properties={};let h=r.shape;for(let S in h)m.properties[S]=this.process(h[S],{...u,path:[...u.path,"properties",S]});let g=new Set(Object.keys(h)),y=new Set([...g].filter((S)=>{let b=r.shape[S]._zod;if(this.io==="input")return b.optin===void 0;else return b.optout===void 0}));if(y.size>0)m.required=Array.from(y);if(r.catchall?._zod.def.type==="never")m.additionalProperties=!1;else if(!r.catchall){if(this.io==="output")m.additionalProperties=!1}else if(r.catchall)m.additionalProperties=this.process(r.catchall,{...u,path:[...u.path,"additionalProperties"]});break}case"union":{let m=f;m.anyOf=r.options.map((h,g)=>this.process(h,{...u,path:[...u.path,"anyOf",g]}));break}case"intersection":{let m=f,h=this.process(r.left,{...u,path:[...u.path,"allOf",0]}),g=this.process(r.right,{...u,path:[...u.path,"allOf",1]}),y=(b)=>("allOf"in b)&&Object.keys(b).length===1,S=[...y(h)?h.allOf:[h],...y(g)?g.allOf:[g]];m.allOf=S;break}case"tuple":{let m=f;m.type="array";let h=r.items.map((S,b)=>this.process(S,{...u,path:[...u.path,"prefixItems",b]}));if(this.target==="draft-2020-12")m.prefixItems=h;else m.items=h;if(r.rest){let S=this.process(r.rest,{...u,path:[...u.path,"items"]});if(this.target==="draft-2020-12")m.items=S;else m.additionalItems=S}if(r.rest)m.items=this.process(r.rest,{...u,path:[...u.path,"items"]});let{minimum:g,maximum:y}=e._zod.bag;if(typeof g==="number")m.minItems=g;if(typeof y==="number")m.maxItems=y;break}case"record":{let m=f;m.type="object",m.propertyNames=this.process(r.keyType,{...u,path:[...u.path,"propertyNames"]}),m.additionalProperties=this.process(r.valueType,{...u,path:[...u.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema");break}case"enum":{let m=f,h=Yf(r.entries);if(h.every((g)=>typeof g==="number"))m.type="number";if(h.every((g)=>typeof g==="string"))m.type="string";m.enum=h;break}case"literal":{let m=f,h=[];for(let g of r.values)if(g===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g==="bigint")if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else h.push(Number(g));else h.push(g);if(h.length===0);else if(h.length===1){let g=h[0];m.type=g===null?"null":typeof g,m.const=g}else{if(h.every((g)=>typeof g==="number"))m.type="number";if(h.every((g)=>typeof g==="string"))m.type="string";if(h.every((g)=>typeof g==="boolean"))m.type="string";if(h.every((g)=>g===null))m.type="null";m.enum=h}break}case"file":{let m=f,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:y,mime:S}=e._zod.bag;if(g!==void 0)h.minLength=g;if(y!==void 0)h.maxLength=y;if(S)if(S.length===1)h.contentMediaType=S[0],Object.assign(m,h);else m.anyOf=S.map((b)=>({...h,contentMediaType:b}));else Object.assign(m,h);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let m=this.process(r.innerType,u);f.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(r.innerType,u),i.ref=r.innerType;break}case"success":{let m=f;m.type="boolean";break}case"default":{this.process(r.innerType,u),i.ref=r.innerType,f.default=JSON.parse(JSON.stringify(r.defaultValue));break}case"prefault":{if(this.process(r.innerType,u),i.ref=r.innerType,this.io==="input")f._prefault=JSON.parse(JSON.stringify(r.defaultValue));break}case"catch":{this.process(r.innerType,u),i.ref=r.innerType;let m;try{m=r.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}f.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let m=f,h=e._zod.pattern;if(!h)throw Error("Pattern not found in template literal");m.type="string",m.pattern=h.source;break}case"pipe":{let m=this.io==="input"?r.in._zod.def.type==="transform"?r.out:r.in:r.out;this.process(m,u),i.ref=m;break}case"readonly":{this.process(r.innerType,u),i.ref=r.innerType,f.readOnly=!0;break}case"promise":{this.process(r.innerType,u),i.ref=r.innerType;break}case"optional":{this.process(r.innerType,u),i.ref=r.innerType;break}case"lazy":{let m=e._zod.innerType;this.process(m,u),i.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema");break}default:}}}let c=this.metadataRegistry.get(e);if(c)Object.assign(i.schema,c);if(this.io==="input"&&tn(e))delete i.schema.examples,delete i.schema.default;if(this.io==="input"&&i.schema._prefault)(n=i.schema).default??(n.default=i.schema._prefault);return delete i.schema._prefault,this.seen.get(e).schema}emit(e,t){let n={cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0},r=this.seen.get(e);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(l)=>{let u=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let h=n.external.registry.get(l[0])?.id;if(h)return{ref:n.external.uri(h)};let g=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=g,{defId:g,ref:`${n.external.uri("__shared")}#/${u}/${g}`}}if(l[1]===r)return{ref:"#"};let f=`${"#"}/${u}/`,m=l[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:f+m}},s=(l)=>{if(l[1].schema.$ref)return;let u=l[1],{ref:p,defId:f}=o(l);if(u.def={...u.schema},f)u.defId=f;let m=u.schema;for(let h in m)delete m[h];m.$ref=p};for(let l of this.seen.entries()){let u=l[1];if(e===l[0]){s(l);continue}if(n.external){let f=n.external.registry.get(l[0])?.id;if(e!==l[0]&&f){s(l);continue}}if(this.metadataRegistry.get(l[0])?.id){s(l);continue}if(u.cycle){if(n.cycles==="throw")throw Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
138
-
139
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);else if(n.cycles==="ref")s(l);continue}if(u.count>1){if(n.reused==="ref"){s(l);continue}}}let i=(l,u)=>{let p=this.seen.get(l),f=p.def??p.schema,m={...f};if(p.ref===null)return;let h=p.ref;if(p.ref=null,h){i(h,u);let g=this.seen.get(h).schema;if(g.$ref&&u.target==="draft-7")f.allOf=f.allOf??[],f.allOf.push(g);else Object.assign(f,g),Object.assign(f,m)}if(!p.isParent)this.override({zodSchema:l,jsonSchema:f,path:p.path??[]})};for(let l of[...this.seen.entries()].reverse())i(l[0],{target:this.target});let a={};if(this.target==="draft-2020-12")a.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")a.$schema="http://json-schema.org/draft-07/schema#";else console.warn(`Invalid target: ${this.target}`);Object.assign(a,r.def);let c=n.external?.defs??{};for(let l of this.seen.entries()){let u=l[1];if(u.def&&u.defId)c[u.defId]=u.def}if(!n.external&&Object.keys(c).length>0)if(this.target==="draft-2020-12")a.$defs=c;else a.definitions=c;try{return JSON.parse(JSON.stringify(a))}catch(l){throw Error("Error converting schema to JSON.")}}}function By(e,t){if(e instanceof jy){let r=new tO(t),o={};for(let a of e._idmap.entries()){let[c,l]=a;r.process(l)}let s={},i={registry:e,uri:t?.uri||((a)=>a),defs:o};for(let a of e._idmap.entries()){let[c,l]=a;s[c]=r.emit(l,{...t,external:i})}if(Object.keys(o).length>0){let a=r.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[a]:o}}return{schemas:s}}let n=new tO(t);return n.process(e),n.emit(e,t)}function tn(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let o=e._zod.def;switch(o.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return tn(o.element,n);case"object":{for(let s in o.shape)if(tn(o.shape[s],n))return!0;return!1}case"union":{for(let s of o.options)if(tn(s,n))return!0;return!1}case"intersection":return tn(o.left,n)||tn(o.right,n);case"tuple":{for(let s of o.items)if(tn(s,n))return!0;if(o.rest&&tn(o.rest,n))return!0;return!1}case"record":return tn(o.keyType,n)||tn(o.valueType,n);case"map":return tn(o.keyType,n)||tn(o.valueType,n);case"set":return tn(o.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return tn(o.innerType,n);case"lazy":return tn(o.getter(),n);case"default":return tn(o.innerType,n);case"prefault":return tn(o.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return tn(o.in,n)||tn(o.out,n);case"success":return!1;case"catch":return!1;default:}throw Error(`Unknown schema type: ${o.type}`)}var im={};rn(im,{ZodISODate:()=>JV,ZodISODateTime:()=>YV,ZodISODuration:()=>QV,ZodISOTime:()=>XV,date:()=>rO,datetime:()=>nO,duration:()=>sO,time:()=>oO});var YV=P("ZodISODateTime",(e,t)=>{IV.init(e,t),St.init(e,t)});function nO(e){return $V(YV,e)}var JV=P("ZodISODate",(e,t)=>{DV.init(e,t),St.init(e,t)});function rO(e){return zV(JV,e)}var XV=P("ZodISOTime",(e,t)=>{LV.init(e,t),St.init(e,t)});function oO(e){return HV(XV,e)}var QV=P("ZodISODuration",(e,t)=>{MV.init(e,t),St.init(e,t)});function sO(e){return BV(QV,e)}var t4=(e,t)=>{Iy.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(n)=>Ly(e,n)},flatten:{value:(n)=>Dy(e,n)},addIssue:{value:(n)=>e.issues.push(n)},addIssues:{value:(n)=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},dOt=P("ZodError",t4),am=P("ZodError",t4,{Parent:Error});var n4=uk(am),r4=pk(am),o4=mk(am),s4=hk(am);var it=P("ZodType",(e,t)=>(Ze.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),e.clone=(n,r)=>rr(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>n4(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>o4(e,n,r),e.parseAsync=async(n,r)=>r4(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>s4(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(uze(n,r)),e.superRefine=(n)=>e.check(dze(n)),e.overwrite=(n)=>e.check(Va(n)),e.optional=()=>Et(e),e.nullable=()=>c4(e),e.nullish=()=>Et(c4(e)),e.nonoptional=(n)=>nze(e,n),e.array=()=>I(e),e.or=(n)=>ce([e,n]),e.and=(n)=>Wy(e,n),e.transform=(n)=>aO(e,g4(n)),e.default=(n)=>Q$e(e,n),e.prefault=(n)=>tze(e,n),e.catch=(n)=>oze(e,n),e.pipe=(n)=>aO(e,n),e.readonly=()=>aze(e),e.describe=(n)=>{let r=e.clone();return Br.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return Br.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Br.get(e);let r=e.clone();return Br.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),l4=P("_ZodString",(e,t)=>{om.init(e,t),it.init(e,t);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(BR(...r)),e.includes=(...r)=>e.check(WR(...r)),e.startsWith=(...r)=>e.check(qR(...r)),e.endsWith=(...r)=>e.check(VR(...r)),e.min=(...r)=>e.check(Cu(...r)),e.max=(...r)=>e.check(zy(...r)),e.length=(...r)=>e.check(Hy(...r)),e.nonempty=(...r)=>e.check(Cu(1,...r)),e.lowercase=(r)=>e.check(KR(r)),e.uppercase=(r)=>e.check(GR(r)),e.trim=()=>e.check(YR()),e.normalize=(...r)=>e.check(ZR(...r)),e.toLowerCase=()=>e.check(JR()),e.toUpperCase=()=>e.check(XR())}),cO=P("ZodString",(e,t)=>{om.init(e,t),l4.init(e,t),e.email=(n)=>e.check(hR(w$e,n)),e.url=(n)=>e.check(SR(A$e,n)),e.jwt=(n)=>e.check(MR($$e,n)),e.emoji=(n)=>e.check(ER(T$e,n)),e.guid=(n)=>e.check($y(i4,n)),e.uuid=(n)=>e.check(gR(Ky,n)),e.uuidv4=(n)=>e.check(_R(Ky,n)),e.uuidv6=(n)=>e.check(yR(Ky,n)),e.uuidv7=(n)=>e.check(bR(Ky,n)),e.nanoid=(n)=>e.check(xR(C$e,n)),e.guid=(n)=>e.check($y(i4,n)),e.cuid=(n)=>e.check(vR(k$e,n)),e.cuid2=(n)=>e.check(wR(R$e,n)),e.ulid=(n)=>e.check(AR(O$e,n)),e.base64=(n)=>e.check(IR(U$e,n)),e.base64url=(n)=>e.check(DR(F$e,n)),e.xid=(n)=>e.check(TR(P$e,n)),e.ksuid=(n)=>e.check(CR(I$e,n)),e.ipv4=(n)=>e.check(kR(D$e,n)),e.ipv6=(n)=>e.check(RR(L$e,n)),e.cidrv4=(n)=>e.check(OR(M$e,n)),e.cidrv6=(n)=>e.check(PR(N$e,n)),e.e164=(n)=>e.check(LR(j$e,n)),e.datetime=(n)=>e.check(nO(n)),e.date=(n)=>e.check(rO(n)),e.time=(n)=>e.check(oO(n)),e.duration=(n)=>e.check(sO(n))});function _(e){return mR(cO,e)}var St=P("ZodStringFormat",(e,t)=>{ut.init(e,t),l4.init(e,t)}),w$e=P("ZodEmail",(e,t)=>{wk.init(e,t),St.init(e,t)});var i4=P("ZodGUID",(e,t)=>{xk.init(e,t),St.init(e,t)});var Ky=P("ZodUUID",(e,t)=>{vk.init(e,t),St.init(e,t)});var A$e=P("ZodURL",(e,t)=>{Ak.init(e,t),St.init(e,t)});var T$e=P("ZodEmoji",(e,t)=>{Tk.init(e,t),St.init(e,t)});var C$e=P("ZodNanoID",(e,t)=>{Ck.init(e,t),St.init(e,t)});var k$e=P("ZodCUID",(e,t)=>{kk.init(e,t),St.init(e,t)});var R$e=P("ZodCUID2",(e,t)=>{Rk.init(e,t),St.init(e,t)});var O$e=P("ZodULID",(e,t)=>{Ok.init(e,t),St.init(e,t)});var P$e=P("ZodXID",(e,t)=>{Pk.init(e,t),St.init(e,t)});var I$e=P("ZodKSUID",(e,t)=>{Ik.init(e,t),St.init(e,t)});var D$e=P("ZodIPv4",(e,t)=>{Dk.init(e,t),St.init(e,t)});var L$e=P("ZodIPv6",(e,t)=>{Lk.init(e,t),St.init(e,t)});var M$e=P("ZodCIDRv4",(e,t)=>{Mk.init(e,t),St.init(e,t)});var N$e=P("ZodCIDRv6",(e,t)=>{Nk.init(e,t),St.init(e,t)});var U$e=P("ZodBase64",(e,t)=>{Uk.init(e,t),St.init(e,t)});var F$e=P("ZodBase64URL",(e,t)=>{Fk.init(e,t),St.init(e,t)});var j$e=P("ZodE164",(e,t)=>{jk.init(e,t),St.init(e,t)});var $$e=P("ZodJWT",(e,t)=>{$k.init(e,t),St.init(e,t)});var Gy=P("ZodNumber",(e,t)=>{Ny.init(e,t),it.init(e,t),e.gt=(r,o)=>e.check(Tu(r,o)),e.gte=(r,o)=>e.check(vo(r,o)),e.min=(r,o)=>e.check(vo(r,o)),e.lt=(r,o)=>e.check(Au(r,o)),e.lte=(r,o)=>e.check(Is(r,o)),e.max=(r,o)=>e.check(Is(r,o)),e.int=(r)=>e.check(a4(r)),e.safe=(r)=>e.check(a4(r)),e.positive=(r)=>e.check(Tu(0,r)),e.nonnegative=(r)=>e.check(vo(0,r)),e.negative=(r)=>e.check(Au(0,r)),e.nonpositive=(r)=>e.check(Is(0,r)),e.multipleOf=(r,o)=>e.check(sm(r,o)),e.step=(r,o)=>e.check(sm(r,o)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??0.5),e.isFinite=!0,e.format=n.format??null});function ee(e){return NR(Gy,e)}var z$e=P("ZodNumberFormat",(e,t)=>{zk.init(e,t),Gy.init(e,t)});function a4(e){return UR(z$e,e)}var lO=P("ZodBoolean",(e,t)=>{Hk.init(e,t),it.init(e,t)});function R(e){return FR(lO,e)}var u4=P("ZodBigInt",(e,t)=>{Bk.init(e,t),it.init(e,t),e.gte=(r,o)=>e.check(vo(r,o)),e.min=(r,o)=>e.check(vo(r,o)),e.gt=(r,o)=>e.check(Tu(r,o)),e.gte=(r,o)=>e.check(vo(r,o)),e.min=(r,o)=>e.check(vo(r,o)),e.lt=(r,o)=>e.check(Au(r,o)),e.lte=(r,o)=>e.check(Is(r,o)),e.max=(r,o)=>e.check(Is(r,o)),e.positive=(r)=>e.check(Tu(BigInt(0),r)),e.negative=(r)=>e.check(Au(BigInt(0),r)),e.nonpositive=(r)=>e.check(Is(BigInt(0),r)),e.nonnegative=(r)=>e.check(vo(BigInt(0),r)),e.multipleOf=(r,o)=>e.check(sm(r,o));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});var H$e=P("ZodUndefined",(e,t)=>{Kk.init(e,t),it.init(e,t)});function uO(e){return jR(H$e,e)}var B$e=P("ZodNull",(e,t)=>{Gk.init(e,t),it.init(e,t)});function d4(e){return $R(B$e,e)}var K$e=P("ZodUnknown",(e,t)=>{Wk.init(e,t),it.init(e,t)});function Ae(){return zR(K$e)}var G$e=P("ZodNever",(e,t)=>{qk.init(e,t),it.init(e,t)});function dO(e){return HR(G$e,e)}var p4=P("ZodDate",(e,t)=>{Vk.init(e,t),it.init(e,t),e.min=(r,o)=>e.check(vo(r,o)),e.max=(r,o)=>e.check(Is(r,o));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});var W$e=P("ZodArray",(e,t)=>{Zk.init(e,t),it.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(Cu(n,r)),e.nonempty=(n)=>e.check(Cu(1,n)),e.max=(n,r)=>e.check(zy(n,r)),e.length=(n,r)=>e.check(Hy(n,r)),e.unwrap=()=>e.element});function I(e,t){return VV(W$e,e,t)}var pO=P("ZodObject",(e,t)=>{Uy.init(e,t),it.init(e,t),Oe.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>q(Object.keys(e._zod.def.shape)),e.catchall=(n)=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ae()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ae()}),e.strict=()=>e.clone({...e._zod.def,catchall:dO()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(n)=>Oe.extend(e,n),e.merge=(n)=>Oe.merge(e,n),e.pick=(n)=>Oe.pick(e,n),e.omit=(n)=>Oe.omit(e,n),e.partial=(...n)=>Oe.partial(_4,e,n[0]),e.required=(...n)=>Oe.required(y4,e,n[0])});function C(e,t){let n={type:"object",get shape(){return Oe.assignProp(this,"shape",{...e}),this.shape},...Oe.normalizeParams(t)};return new pO(n)}function fO(e,t){return new pO({type:"object",get shape(){return Oe.assignProp(this,"shape",{...e}),this.shape},catchall:dO(),...Oe.normalizeParams(t)})}function Un(e,t){return new pO({type:"object",get shape(){return Oe.assignProp(this,"shape",{...e}),this.shape},catchall:Ae(),...Oe.normalizeParams(t)})}var f4=P("ZodUnion",(e,t)=>{Fy.init(e,t),it.init(e,t),e.options=t.options});function ce(e,t){return new f4({type:"union",options:e,...Oe.normalizeParams(t)})}var q$e=P("ZodDiscriminatedUnion",(e,t)=>{f4.init(e,t),Yk.init(e,t)});function Za(e,t,n){return new q$e({type:"union",options:t,discriminator:e,...Oe.normalizeParams(n)})}var V$e=P("ZodIntersection",(e,t)=>{Jk.init(e,t),it.init(e,t)});function Wy(e,t){return new V$e({type:"intersection",left:e,right:t})}var m4=P("ZodRecord",(e,t)=>{Xk.init(e,t),it.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function X(e,t,n){return new m4({type:"record",keyType:e,valueType:t,...Oe.normalizeParams(n)})}function h4(e,t,n){return new m4({type:"record",keyType:ce([e,dO()]),valueType:t,...Oe.normalizeParams(n)})}var iO=P("ZodEnum",(e,t)=>{Qk.init(e,t),it.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{let s={};for(let i of r)if(n.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new iO({...t,checks:[],...Oe.normalizeParams(o),entries:s})},e.exclude=(r,o)=>{let s={...t.entries};for(let i of r)if(n.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new iO({...t,checks:[],...Oe.normalizeParams(o),entries:s})}});function q(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new iO({type:"enum",entries:n,...Oe.normalizeParams(t)})}var Z$e=P("ZodLiteral",(e,t)=>{eR.init(e,t),it.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function j(e,t){return new Z$e({type:"literal",values:Array.isArray(e)?e:[e],...Oe.normalizeParams(t)})}var Y$e=P("ZodTransform",(e,t)=>{tR.init(e,t),it.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=(s)=>{if(typeof s==="string")n.issues.push(Oe.issue(s,n.value,t));else{let i=s;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),i.continue??(i.continue=!0),n.issues.push(Oe.issue(i))}};let o=t.transform(n.value,n);if(o instanceof Promise)return o.then((s)=>(n.value=s,n));return n.value=o,n}});function g4(e){return new Y$e({type:"transform",transform:e})}var _4=P("ZodOptional",(e,t)=>{nR.init(e,t),it.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Et(e){return new _4({type:"optional",innerType:e})}var J$e=P("ZodNullable",(e,t)=>{rR.init(e,t),it.init(e,t),e.unwrap=()=>e._zod.def.innerType});function c4(e){return new J$e({type:"nullable",innerType:e})}var X$e=P("ZodDefault",(e,t)=>{oR.init(e,t),it.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Q$e(e,t){return new X$e({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():t}})}var eze=P("ZodPrefault",(e,t)=>{sR.init(e,t),it.init(e,t),e.unwrap=()=>e._zod.def.innerType});function tze(e,t){return new eze({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():t}})}var y4=P("ZodNonOptional",(e,t)=>{iR.init(e,t),it.init(e,t),e.unwrap=()=>e._zod.def.innerType});function nze(e,t){return new y4({type:"nonoptional",innerType:e,...Oe.normalizeParams(t)})}var rze=P("ZodCatch",(e,t)=>{aR.init(e,t),it.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function oze(e,t){return new rze({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var sze=P("ZodPipe",(e,t)=>{cR.init(e,t),it.init(e,t),e.in=t.in,e.out=t.out});function aO(e,t){return new sze({type:"pipe",in:e,out:t})}var ize=P("ZodReadonly",(e,t)=>{lR.init(e,t),it.init(e,t)});function aze(e){return new ize({type:"readonly",innerType:e})}var cze=P("ZodLazy",(e,t)=>{uR.init(e,t),it.init(e,t),e.unwrap=()=>e._zod.def.getter()});function qy(e){return new cze({type:"lazy",getter:e})}var b4=P("ZodCustom",(e,t)=>{dR.init(e,t),it.init(e,t)});function lze(e,t){let n=new yn({check:"custom",...Oe.normalizeParams(t)});return n._zod.check=e,n}function S4(e,t){return QR(b4,e??(()=>!0),t)}function uze(e,t={}){return eO(b4,e,t)}function dze(e,t){let n=lze((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(Oe.issue(o,r.value,n._zod.def));else{let s=o;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(Oe.issue(s))}},e(r.value,r)),t);return n}function st(e,t){return aO(g4(e),t)}var Kr={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"};var Vy={};rn(Vy,{bigint:()=>hze,boolean:()=>mze,date:()=>gze,number:()=>fze,string:()=>pze});function pze(e){return jV(cO,e)}function fze(e){return KV(Gy,e)}function mze(e){return GV(lO,e)}function hze(e){return WV(u4,e)}function gze(e){return qV(p4,e)}nr(pR());var E4=200;function Eze(e){return[...e.replace(/[\x00-\x1f\x7f-\x9f]/g,"")].slice(0,E4).join("")}function x4(e){return Eze(gy(e.trim())).trim()}import{basename as v4,dirname as w4}from"path";var xze=6;function A4(e){let t=v4(e);if(qf(t))return;let n=bt(),r=[t],o=w4(e);while(o!==n&&r.length<=xze+1){let l=w4(o);if(l===o)return;r.unshift(v4(o)),o=l}if(o!==n||r.length<3)return;let[s,i,...a]=r;if(!dn(s)||!dn(i)||a.length===0||!a.every(dn))return;let c=en.sidecar(s,i,a);return Ps(c)===void 0?c:void 0}var Tze=M(()=>C({customTitle:_()}));function Cze(e,t){return Aze(wze(e),t,"custom-title.json")}async function ku(e,t,n){let r=await kze(Cze(e,t),n);if(r===void 0)return;let o;try{o=JSON.parse(r)}catch{return}let s=Tze().safeParse(o);if(!s.success)return;return x4(s.data.customTitle)||void 0}async function kze(e,t){if(Te()&&t!==void 0)try{let n=A4(e);if(n!==void 0){let r=await t.readText([n]);if(!r.ok)return;let o=r.value.items[0];return o.found?o.value:void 0}}catch{return}try{return await vze(e,"utf8")}catch{return}}function Ru(e,t,n,r){let{head:o,tail:s,mtime:i,size:a}=t,c=o.indexOf(`
140
- `),l=c>=0?o.slice(0,c):o;if(l.includes('"isSidechain":true')||l.includes('"isSidechain": true'))return null;let u=un(s,"customTitle")||r||un(o,"customTitle")||un(s,"aiTitle")||un(o,"aiTitle")||void 0,p=Ey(o)||void 0,f=yu(o,"timestamp"),m;if(f){let x=Date.parse(f);if(!Number.isNaN(x))m=x}let h=u||un(s,"lastPrompt")||un(s,"summary")||p;if(!h)return null;let g=un(s,"gitBranch")||yu(o,"gitBranch")||void 0,y=Sy(s,"relocated","relocatedCwd")||yu(o,"cwd")||n||void 0,S=s.split(`
141
- `).findLast((x)=>x.includes('"type":"tag"')&&x.includes('"tag":"')),b=S?un(S,"tag")||void 0:void 0;return{sessionId:e,summary:h,lastModified:i,fileSize:a,customTitle:u,firstPrompt:p,gitBranch:g,cwd:y,tag:b,createdAt:m}}function Pze(e){let t=xq(e);return t!==void 0&&dn(t)?t:void 0}function Zy(e){return{pagesLeft:gW+e}}async function cm(e,t,n,r,o,s){let i=Te()&&r!==void 0?Pze(e):void 0;if(r!==void 0&&i!==void 0){let l=new Map;try{await So((u)=>r.listEntries({namespace:"transcript",projectKey:i},{skipScopeStats:!0,...t?{}:{skipKeyStats:!0},...u!==void 0&&{cursor:u}}),(u)=>{for(let p of u){if(p.kind!=="key"||p.key.namespace!=="transcript")continue;let f=rt(p.key.sessionId);if(!f)continue;if(t&&p.mtimeMs===void 0)continue;let m=t?Math.trunc(p.mtimeMs??0):0,h=l.get(f);if(h!==void 0){if(m>h.mtime)h.mtime=m;continue}l.set(f,{sessionId:f,filePath:lm(e,`${p.key.sessionId}.jsonl`),mtime:m,projectPath:n,ownWorktrees:s})}},o!==void 0?{budget:o}:void 0)}catch{}return[...l.values()]}let a;try{a=await mO(e)}catch{return[]}return(await Promise.all(a.map(async(l)=>{if(!l.endsWith(".jsonl"))return null;let u=rt(l.slice(0,-6));if(!u)return null;let p=lm(e,l);if(!t)return{sessionId:u,filePath:p,mtime:0,projectPath:n,ownWorktrees:s};try{let f=await Rze(p);return{sessionId:u,filePath:p,mtime:f.mtime.getTime(),projectPath:n,ownWorktrees:s}}catch{return null}}))).filter((l)=>l!==null)}async function T4(e,t,n){let r=await Gf(e.filePath,Nn(Ai(e.filePath,n)));if(!r)return null;if(!t&&OW(r.head,r.tail))return null;let o=un(r.tail,"customTitle")===void 0?await ku(e.filePath,e.sessionId,n):void 0,s=Ru(e.sessionId,r,e.projectPath,o);if(!s)return null;let i=Sy(r.tail,"relocated","relocatedCwd")??GC(r.head,"cwd");if(i!==void 0&&e.projectPath!==void 0&&!NW(i,e.ownWorktrees,WC())&&await MW(i,e.projectPath,WC(),aj))return null;if(e.mtime)s.lastModified=e.mtime;return s}var Ize=32;function Dze(e,t){if(t.mtime!==e.mtime)return t.mtime-e.mtime;return t.sessionId<e.sessionId?-1:t.sessionId>e.sessionId?1:0}async function Lze(e,t,n,r,o){e.sort(Dze);let s=[],i=t&&t>0?t:1/0,a=0,c=new Set;for(let l=0;l<e.length&&s.length<i;){let u=Math.min(l+Ize,e.length),p=e.slice(l,u),f=await Promise.all(p.map((m)=>T4(m,r,o)));for(let m=0;m<f.length&&s.length<i;m++){l++;let h=f[m];if(!h)continue;if(c.has(h.sessionId))continue;if(c.add(h.sessionId),a<n){a++;continue}s.push(h)}}return s}async function Mze(e,t,n){let r=await Promise.all(e.map((i)=>T4(i,t,n))),o=new Map;for(let i of r){if(!i)continue;let a=o.get(i.sessionId);if(!a||i.lastModified>a.lastModified)o.set(i.sessionId,i)}let s=[...o.values()];return s.sort((i,a)=>a.lastModified!==i.lastModified?a.lastModified-i.lastModified:a.sessionId<i.sessionId?-1:a.sessionId>i.sessionId?1:0),s}async function Nze(e,t,n,r){let o=await Rs(e),s=Nn(tr(r)),i;if(t)try{i=await Ts(o)}catch{i=[]}else i=[];if(i.length<=1){let S=[],b=await Qn(o,s),x=Zy(b.length);for(let v of b)S.push(...await cm(v,n,o,r,x));return S}let a=bt(),c=process.platform==="win32",l=i.map((S)=>{let b=ks(S),x=c?b.toLowerCase():b;return{path:S,exactName:x,truncatedPrefix:b.length>Cs?x.slice(0,Cs):void 0}});l.sort((S,b)=>b.exactName.length-S.exactName.length);let u=s!==void 0&&s.hoverRestOn?await xu(s.source):null,p=u;if(p===null){let S;try{S=await mO(a,{withFileTypes:!0})}catch{let b=[],x=await Qn(o),v=Zy(x.length);for(let A of x)b.push(...await cm(A,n,o,r,v));return b}p=S.filter((b)=>b.isDirectory()).map((b)=>b.name)}let f=[],m=new Set,h=Zy(p.length+1),g=s!==void 0&&s.hoverRestOn&&u!==null?await VC(o,u,c,s):await Qn(o),y=[o,...i];for(let S of g){let b=Oze(S),x=c?b.toLowerCase():b;m.add(x),f.push(...await cm(S,n,o,r,h,y))}for(let S of p){let b=c?S.toLowerCase():S;if(m.has(b))continue;for(let{path:x,exactName:v,truncatedPrefix:A}of l)if(b===v||A!==void 0&&b.startsWith(A+"-")&&await Eu(lm(a,S),x,c,s)){m.add(b),f.push(...await cm(lm(a,S),n,x,r,h,y));break}}return f}async function Uze(e,t){let n=bt(),r=tr(t),o=r!==void 0?await xu(r):null;if(o===null){let a;try{a=await mO(n,{withFileTypes:!0})}catch{return[]}o=a.filter((c)=>c.isDirectory()).map((c)=>c.name)}let s=Zy(o.length);return(await Promise.all(o.map((a)=>cm(lm(n,a),e,void 0,t,s)))).flat()}async function C4(e,t){let n=Te()?t:void 0,{dir:r,limit:o,offset:s,includeWorktrees:i,includeProgrammatic:a}=e??{},c=s??0,l=a??!0,u=o!==void 0&&o>0||c>0,p=r?await Nze(r,i??!0,u,n):await Uze(u,n);if(!u)return Mze(p,l,n);return Lze(p,o,c,l,n)}async function k4(e,t={},n){let r=rt(e);if(!r)return;let o=Te(),s=o?n:void 0,i=await wi(r,t.dir,tr(s),o);if(!i)return;let a=await Gf(i.filePath,Nn(Ai(i.filePath,s)));if(!a)return;let c=un(a.tail,"customTitle")===void 0?await ku(i.filePath,r,s):void 0;return Ru(r,a,i.projectPath,c)??void 0}import{constants as R4}from"fs";import{open as Fze,readdir as I4,rm as O4,stat as jze}from"fs/promises";import{join as Ds}from"path";var $ze=64;function gO(e){return Te()?e:void 0}async function D4(e,t,n={},r){if(!rt(e))throw Error(`Invalid sessionId: ${e}`);if(!t.trim())throw Error("title must be non-empty");let o=me({type:"custom-title",customTitle:t.trim(),sessionId:e})+`
142
- `;await U4(e,o,n,gO(r))}async function L4(e,t,n={},r){if(!rt(e))throw Error(`Invalid sessionId: ${e}`);if(t!==null){let s=za(t).trim();if(!s)throw Error("tag must be non-empty (use null to clear)");t=s}let o=me({type:"tag",tag:t??"",sessionId:e})+`
143
- `;await U4(e,o,n,gO(r))}async function M4(e,t={},n){if(!rt(e))throw Error(`Invalid sessionId: ${e}`);let r=gO(n);for(let o of await Hze(t,r)){if(Te()&&r!==void 0){let a=Ba(o,r.isKeySegment);if(a!==void 0){if(await zze(a,e,r))return;continue}}let s=Ds(o,`${e}.jsonl`),i;try{({size:i}=await jze(s))}catch(a){let c=Ne(a);if(c==="ENOENT"||c==="ENOTDIR")continue;throw a}if(i===0)continue;await O4(s,{force:!0}),await O4(Ds(o,e),{recursive:!0,force:!0});return}throw Error(t.dir?`Session ${e} not found in project directory for ${t.dir}`:`Session ${e} not found in any project directory`)}async function zze(e,t,n){let{backend:r,transcriptKey:o}=n,s=o(e,t),i=await r.statMeta(s);if(!i.ok){if(i.error.code==="NotFound")return!1;throw Error("Session delete: transcript unreadable via storage",{cause:i.error})}if((i.value.storedBytes??i.value.size)===0)return!1;for(let c of["transcript","sidecar"]){let l=await r.deleteScope({namespace:c,projectKey:e,sessionId:t});if(!l.ok)throw Error("Session delete: session directory not deletable via storage",{cause:l.error})}let a=await r.delete(s);if(!a.ok)throw Error("Session delete: transcript not deletable via storage",{cause:a.error});return!0}async function Hze(e,t){if(e.dir){let r=await Rs(e.dir),o=await P4(r,t),s;try{s=await Ts(r)}catch{s=[]}for(let i of s){if(i===r)continue;o.push(...await P4(i,t))}return o}let n=bt();if(Te()&&t!==void 0){let r=await N4(t);if(r===void 0)return[];if(r.laterPageFailed)throw Error("Session delete: project listing incomplete via storage");return r.names.map((o)=>Ds(n,o))}try{return(await I4(n,{withFileTypes:!0})).filter((o)=>o.isDirectory()||o.isSymbolicLink()).map((o)=>Ds(n,o.name))}catch{return[]}}async function P4(e,t){let n=Nn(t);if(n===void 0||!n.hoverRestOn)return Qn(e);let r=await Qn(e,n),o=Su(e),s=process.platform==="win32",i=[];for(let a of r)if(a===o||await Eu(a,e,s,n))i.push(a);return i}async function N4(e){let t=[],n,r=0;try{do{let o=await e.backend.listEntries({namespace:"transcript"},{skipScopeStats:!0,...n!==void 0&&{cursor:n}});if(!o.ok)return r===0?void 0:{names:t,laterPageFailed:!0};for(let s of o.value.items){let i=xy(s,e.isKeySegment);if(i!==void 0)t.push(i)}n=o.value.cursor}while(n&&++r<$ze);return{names:t,laterPageFailed:Boolean(n)}}catch{return r===0&&t.length===0?void 0:{names:t,laterPageFailed:!0}}}async function U4(e,t,n,r){let o=`${e}.jsonl`;if(n.dir){let a=await Rs(n.dir);for(let l of await Qn(a,Nn(r)))if(await Yy(Ds(l,o),t,hO(l,e,r)))return;let c;try{c=await Ts(a)}catch{c=[]}for(let l of c){if(l===a)continue;for(let u of await Qn(l,Nn(r)))if(await Yy(Ds(u,o),t,hO(u,e,r)))return}throw Error(`Session ${e} not found in project directory for ${n.dir}`)}let s=bt();if(Te()&&r!==void 0){let a=await N4(r);if(a===void 0)throw new qe(`Session ${e} not found (no projects directory)`,"Session not found (no projects directory)");let{names:c}=a;for(let l of c){let u=Ds(s,l);if(await Yy(Ds(u,o),t,hO(u,e,r)))return}throw new qe(`Session ${e} not found in any project directory`,"Session not found in any project directory")}let i;try{i=await I4(s)}catch{throw Error(`Session ${e} not found (no projects directory)`)}for(let a of i)if(await Yy(Ds(s,a,o),t))return;throw Error(`Session ${e} not found in any project directory`)}async function Yy(e,t,n){if(Te()&&n!==void 0)return Bze(n,t);let r;try{r=await Fze(e,R4.O_WRONLY|R4.O_APPEND)}catch(o){let s=Ne(o);if(s==="ENOENT"||s==="ENOTDIR")return!1;throw o}try{let{size:o}=await r.stat();if(o===0)return!1;let s=process.platform==="win32"?o:void 0,i=Buffer.from(t,"utf8"),a=0;while(a<i.length){let{bytesWritten:c}=await r.write(i,a,i.length-a,s);if(c<=0)throw new qe(`tryAppend: short write to ${e} stalled with ${i.length-a} bytes remaining`,"tryAppend: zero-progress short write");if(a+=c,s!==void 0)s+=c}return!0}finally{await r.close()}}async function Bze({backend:e,key:t},n){let r=await e.append(t,[{data:n}],{precondition:{type:"ifExists",nonEmpty:!0}});if(!r.ok){if(r.error.code==="NotFound")return!1;throw Error("Session append: transcript not writable via storage",{cause:r.error})}return!0}function hO(e,t,n){if(!Te()||n===void 0)return;let r=Ba(e,n.isKeySegment);return r===void 0?void 0:{backend:n.backend,key:n.transcriptKey(r,t)}}import{randomUUID as Jy}from"crypto";import{basename as Kze,join as Ya}from"path";async function Gze(e,t,n){let r=`${e}.jsonl`,o=Nn(tr(n));async function s(c){let l=Nn(Ai(Ya(c,r),n));if(l!==void 0&&l.hoverRestOn)try{let u=await l.source.backend.read([l.source.key]);if(!u.ok)return null;let p=u.value.items[0];if(!p?.found)return null;if(p.value.byteLength===0){let f=await l.source.backend.statMeta(l.source.key);if(!f.ok||(f.value.storedBytes??f.value.size)===0)return null}return{buf:Buffer.from(p.value),projectDir:c}}catch{return null}try{let u=await Sl().readBytes(Ya(c,r));if(u.length===0)return null;return{buf:u,projectDir:c}}catch{return null}}if(t){let c=await Rs(t);for(let u of await Qn(c,o)){let p=await s(u);if(p)return p}let l;try{l=await Ts(c)}catch{l=[]}for(let u of l){if(u===c)continue;for(let p of await Qn(u,o)){let f=await s(p);if(f)return f}}return null}let i=bt();if(o!==void 0&&o.hoverRestOn){let c=await xu(o.source);if(c!==null){for(let l of c){let u=await s(Ya(i,l));if(u)return u}return null}}let a;try{a=await Sl().list(i)}catch{return null}for(let c of a){let l=await s(Ya(i,c));if(l)return l}return null}var Wze=new Set(["user","assistant","attachment","system","progress"]);function qze(e,t){let n=[],r=[],o,s={historySuppressed:!1},i=10,a=e.length,c=0;while(c<a){let l=e.indexOf(10,c);if(l===-1)l=a;let u=c;while(u<l&&e[u]<=32)u++;if(c=l+1,u>=l)continue;let p=e.toString("utf-8",u,l);try{o=F4(yt(p),t,n,r,s)??o}catch{}}return{transcript:n,contentReplacements:r,relocatedCwd:o,historySuppressed:s.historySuppressed,atisLatch:s.atisLatch}}function Vze(e,t){let n=[],r=[],o,s={historySuppressed:!1};for(let i of e){if(typeof i!=="object"||i===null)continue;o=F4(i,t,n,r,s)??o}return{transcript:n,contentReplacements:r,relocatedCwd:o,historySuppressed:s.historySuppressed,atisLatch:s.atisLatch}}function F4(e,t,n,r,o){if(Wze.has(e.type)&&typeof e.uuid==="string")n.push(e);else if(e.type==="history-suppression"){if(o)o.historySuppressed=!0}else if(e.type==="atis-latch"&&e.sessionId===t&&typeof e.atis==="string"&&/^[\x21-\x7e]*$/.test(e.atis)){if(o)o.atisLatch=e.atis}else if(e.type==="content-replacement"&&e.sessionId===t&&Array.isArray(e.replacements))r.push(...e.replacements);else if(e.type==="relocated"&&e.sessionId===t&&typeof e.relocatedCwd==="string"&&e.relocatedCwd!=="")return e.relocatedCwd;return}async function j4(e,t={},n){let r=Te()?n:void 0;if(!rt(e))throw new qe(`Invalid sessionId: ${e}`,"forkSession: invalid sessionId (not a UUID)");if(t.upToMessageId&&!rt(t.upToMessageId))throw new qe(`Invalid upToMessageId: ${t.upToMessageId}`,"forkSession: invalid upToMessageId (not a UUID)");let o=await Gze(e,t.dir,r);if(!o)throw Error(t.dir?`Session ${e} not found in project directory for ${t.dir}`:`Session ${e} not found`);let s=await ku(Ya(o.projectDir,`${e}.jsonl`),e,r),{entries:i,forkedSessionId:a}=Yze(o.buf,e,t,s);return await Kf(Ya(o.projectDir,`${a}.jsonl`),i,Nn(Zze(o.projectDir,a,tr(r)))),{sessionId:a}}function Zze(e,t,n){if(n===void 0)return;let r=Kze(e);if(Ya(bt(),r)!==e||!n.isKeySegment(r)||!n.isKeySegment(t))return;return{backend:n.backend,key:n.transcriptKey(r,t)}}function Yze(e,t,n,r){let o=qze(e,t);return z4(o,t,n,()=>{let i=e.length,a=e.toString("utf-8",0,Math.min(i,Cr)),c=e.toString("utf-8",Math.max(0,i-Cr)),l=un(c,"customTitle");return(l!==void 0?l:r??un(a,"customTitle"))||un(c,"aiTitle")||un(a,"aiTitle")||Ey(a)})}function $4(e,t,n){let r=Vze(e,t);return z4(r,t,n,()=>Jze(e))}function Jze(e){let t,n;for(let r of e){if(typeof r!=="object"||r===null)continue;let o=r;if(typeof o.customTitle==="string"&&o.customTitle)t=o.customTitle;if(typeof o.aiTitle==="string"&&o.aiTitle)n=o.aiTitle}return t||n||IW(e)||void 0}function z4(e,t,n,r){let o=e.transcript.filter((f)=>!f.isSidechain);if(o.length===0)throw Error(`Session ${t} has no messages to fork`);if(n.upToMessageId){let f=o.findIndex((m)=>m.uuid===n.upToMessageId);if(f===-1)throw Error(`Message ${n.upToMessageId} not found in session ${t}`);o=o.slice(0,f+1)}let s=new Map;for(let f of o)s.set(f.uuid,Jy());let i=o.filter((f)=>f.type!=="progress");if(i.length===0)throw Error(`Session ${t} has no messages to fork`);let a=new Map;for(let f of o)a.set(f.uuid,f);let c=Jy(),l=new Date().toISOString(),u=[];if(e.historySuppressed)u.push(HW(c,"fork_inherit"));for(let f=0;f<i.length;f++){let m=i[f],h=s.get(m.uuid),g=null,y=m.parentUuid;while(y){let A=a.get(y);if(!A)break;if(A.type!=="progress"){g=s.get(y)??null;break}y=A.parentUuid}let S=f===i.length-1?l:m.timestamp,b=m.logicalParentUuid==null?m.logicalParentUuid:s.get(m.logicalParentUuid)??null,x=m.type==="system"&&m.subtype==="model_refusal_fallback"?{neutralizedByFork:!0}:void 0,v={...m,...x,uuid:h,parentUuid:g,logicalParentUuid:b,sessionId:c,timestamp:S,isSidechain:!1,teamName:void 0,agentName:void 0,sessionKind:void 0,slug:void 0,sourceToolAssistantUUID:void 0,forkedFrom:{sessionId:t,messageUuid:m.uuid}};u.push(v)}if(e.contentReplacements.length>0)u.push({type:"content-replacement",sessionId:c,replacements:e.contentReplacements,uuid:Jy(),timestamp:l});if(e.atisLatch!==void 0)u.push({type:"atis-latch",sessionId:c,atis:e.atisLatch});if(e.relocatedCwd)u.push({type:"relocated",sessionId:c,relocatedCwd:e.relocatedCwd});let p=n.title?.trim();if(!p)p=`${r()||"Forked session"} (fork)`;return u.push({type:"custom-title",sessionId:c,customTitle:p,uuid:Jy(),timestamp:l}),{entries:u,forkedSessionId:c}}import{readdir as Xze,readFile as H4}from"fs/promises";import{isAbsolute as B4,join as Xy,relative as K4,sep as Qy}from"path";async function G4(e,t,n,r){let o=await wi(e,t,tr(n),r);if(!o)return null;let s=o.filePath.replace(/\.jsonl$/,"");return Xy(s,"subagents")}function W4(e){let t=K4(bt(),e);if(t===""||t.startsWith(`..${Qy}`)||t===".."||B4(t))return null;let n=t.split(Qy);return n.length<4||n[2]!=="subagents"?null:n}function Qze(e){let t=W4(e),n=t?.at(-1);if(!t||!n?.startsWith("agent-")||!n.endsWith(".jsonl"))return null;let r=n.slice(6,-6),o=t.slice(3,-1);if(!er([t[0],t[1],r])||o.length>0&&!er(o))return null;let s=en.transcript(t[0],t[1],r,o.length>0?o:void 0);return Ps(s)===void 0?s:null}function e1e(e){let t=W4(e);if(!t)return null;let n=t.slice(2);if(!er([t[0],t[1]])||!er(n))return null;let r=en.sidecar(t[0],t[1],n);return Ps(r)===void 0?r:null}async function q4(e,t){let n=Te()&&t!==void 0?t1e(e):null;if(t!==void 0&&n!==null)return r1e(t,n,e);let r=[];async function o(s){let i;try{i=await Xze(s,{withFileTypes:!0})}catch{return}for(let a of i)if(a.isFile()&&a.name.startsWith("agent-")&&a.name.endsWith(".jsonl")){let c=a.name.slice(6,-6);r.push({agentId:c,filePath:Xy(s,a.name)})}else if(a.isDirectory())await o(Xy(s,a.name))}return await o(e),r}function t1e(e){let t=K4(bt(),e);if(t===""||t.startsWith(`..${Qy}`)||B4(t))return null;let n=t.split(Qy);if(n.length!==3||n[2]!=="subagents"||!er([n[0],n[1]]))return null;let r={namespace:"transcript",projectKey:n[0],sessionId:n[1]};return JC(r)===void 0?r:null}var n1e=1e4;async function r1e(e,t,n,r=n1e){let o=[],s=[t],i=new Set([""]),a=0;try{while(s.length>0){if(++a>r)return[];let c=s.shift(),l=[];if((await So((p)=>e.listEntries(c,{skipKeyStats:!0,skipScopeStats:!0,...p!==void 0&&{cursor:p}}),(p)=>{for(let f of p)if(f.kind==="key"&&f.key.namespace==="transcript"&&f.key.agentId!==void 0&&dn(f.key.agentId)&&(f.key.agentRelPath===void 0||er(f.key.agentRelPath)))o.push({agentId:f.key.agentId,filePath:Xy(n,...f.key.agentRelPath??[],`agent-${f.key.agentId}.jsonl`)});else if(f.kind==="scope"&&f.scope.namespace==="transcript"&&f.scope.agentRelPath!==void 0&&er(f.scope.agentRelPath)&&!i.has(f.scope.agentRelPath.join("/"))){let m={...t,agentRelPath:f.scope.agentRelPath};if(JC(m)===void 0)i.add(f.scope.agentRelPath.join("/")),l.push(m)}})).status!=="done")return[];s.unshift(...l)}}catch{return[]}return o}function o1e(e){let t=[],n=10,r=e.length,o=0;while(o<r){let s=e.indexOf(10,o);if(s===-1)s=r;let i=o;while(i<s&&e[i]<=32)i++;if(o=s+1,i>=s)continue;let a=e.toString("utf-8",i,s);try{let c=yt(a),l=c.type;if((l==="user"||l==="assistant")&&typeof c.uuid==="string")t.push(c)}catch{}}return t}function s1e(e){if(e.length===0)return[];let t=new Map;for(let i of e)t.set(i.uuid,i);let n=e.findLast((i)=>i.type==="user"||i.type==="assistant");if(!n)return[];let r=[],o=new Set,s=n;while(s){if(o.has(s.uuid))break;o.add(s.uuid),r.push(s),s=s.parentUuid?t.get(s.parentUuid):void 0}return r.reverse(),r}async function V4(e,t,n){if(!rt(e))return[];let r=Te(),o=r?n:void 0,s=await G4(e,t?.dir,o,r);if(!s)return[];return(await q4(s,o)).map((a)=>a.agentId)}async function Z4(e,t,n,r){if(!rt(e))return[];if(!t)return[];let o=Te(),s=o?r:void 0,i=await G4(e,n?.dir,s,o);if(!i)return[];let c=(await q4(i,s)).find((m)=>m.agentId===t);if(!c)return[];let l,u=s!==void 0?Qze(c.filePath):null;if(s!==void 0&&u!==null)try{let m=await s.read([u]),h=m.ok?m.value.items[0]:void 0;if(!h?.found)return[];l=Buffer.from(h.value)}catch{return[]}else try{l=await H4(c.filePath)}catch{return[]}let p,f;try{let m=c.filePath.replace(/\.jsonl$/,".meta.json"),h=s!==void 0?e1e(m):null,g;if(s!==void 0&&h!==null){let S=await s.read([h]);if(!S.ok||!S.value.items[0]?.found)throw Error("sidecar absent");g=Buffer.from(S.value.items[0].value).toString("utf-8")}else g=await H4(m,"utf-8");let y=yt(g);p=y.toolUseId,f=y.parentAgentId}catch{}return _O(l,n,p,f)}function _O(e,t,n,r){if(e.length===0)return[];let o=o1e(e),i=s1e(o).filter((a)=>a.type==="user"||a.type==="assistant").map((a)=>QC(a,n,r));return ek(i,t)}function eb(e){return["subagents",...e.agentRelPath??[],e.kind==="agent"?`agent-${e.agentId}`:"journal"].join("/")}async function yO(e,t,n,r,o,s=a1e){let i=[],a=0,c,l=!1;for(let u=0;u<s;u++){let p=await e.readRecords(t,{order:"forward",maxBytes:i1e,...c!==void 0&&{fromSeq:c}});if(!p.ok)throw new qe(`importSessionToStore: transcript read failed (${p.error.code})`,"importSessionToStore: transcript read failed");for(let f of p.value.items){let m=Buffer.from(f.data.buffer,f.data.byteOffset,f.data.byteLength).toString("utf8").replace(/\r?\n$/,"");if(!m)continue;try{i.push(yt(m))}catch(h){de(`importSessionToStore: skipping unparseable record ${f.seq}: ${h}`);continue}if(a+=m.length,i.length>=o||a>=du)await r.append(n,i),i=[],a=0}if(c=p.value.nextSeq,c===void 0){l=!0;break}}if(!l)throw new qe("importSessionToStore: transcript read did not end (page cap reached)","importSessionToStore: transcript read did not end");if(i.length>0)await r.append(n,i)}var i1e=67108864,a1e=1e5,c1e=1e4;async function X4(e,t,n,r=c1e){let o=[],s=[{namespace:"transcript",projectKey:t,sessionId:n}],i=new Set([""]),a=new Set,c=0;while(s.length>0){if(++c>r)throw Error("importSessionToStore: subagent listing did not end (scope cap reached)");let l=s.shift(),u=[];if((await So((f)=>e.listEntries(l,{skipKeyStats:!0,skipScopeStats:!0,...f!==void 0&&{cursor:f}}),(f)=>{for(let m of f)if(m.kind==="key"&&m.key.namespace==="transcript"){let h=m.key.agentRelPath;if(h!==void 0&&!er(h))continue;let g=m.key.agentId!==void 0?dn(m.key.agentId)?{kind:"agent",agentId:m.key.agentId,...h&&{agentRelPath:h}}:void 0:m.key.journal===!0&&h!==void 0?{kind:"journal",agentRelPath:h}:void 0,y=g&&eb(g);if(g&&y!==void 0&&!a.has(y))a.add(y),o.push(g)}else if(m.kind==="scope"&&m.scope.namespace==="transcript"&&m.scope.agentRelPath!==void 0&&er(m.scope.agentRelPath)&&!i.has(m.scope.agentRelPath.join("/")))i.add(m.scope.agentRelPath.join("/")),u.push({namespace:"transcript",projectKey:t,sessionId:n,agentRelPath:m.scope.agentRelPath})})).status!=="done")throw Error("importSessionToStore: subagent listing failed");s.unshift(...u)}return o}function l1e(e,t,n){return en.sidecar(e,t,["subagents",...n.agentRelPath??[],n.kind==="agent"?`agent-${n.agentId}.meta.json`:"journal.meta.json"])}async function Q4(e,t,n,r){let o=r.map((a)=>({subpath:eb(a),key:l1e(t,n,a)})).filter(({key:a})=>Ps(a)===void 0),s=new Map;if(o.length===0)return s;let i=await e.readText(o.map(({key:a})=>a));if(i.ok)return i.value.items.forEach((a,c)=>{if(a.found)s.set(o[c].subpath,a.value)}),s;if(!Y4(i.error))throw J4(i.error.code);for(let{subpath:a,key:c}of o){let l=await e.readText([c]);if(l.ok){if(l.value.items[0].found)s.set(a,l.value.items[0].value)}else if(!Y4(l.error))throw J4(l.error.code)}return s}function Y4(e){return e.code==="Failed"&&(e.telemetryCode==="ELOOP"||e.telemetryCode==="ENXIO")}function J4(e){return new qe(`importSessionToStore: sidecar read failed (${e})`,"importSessionToStore: sidecar read failed")}import{copyFile as u1e,readFile as d1e,rm as t6,writeFile as n6}from"fs/promises";import{homedir as e6}from"os";import{join as bO}from"path";function r6(e){return{globalConfig:bO(e||e6(),".claude.json"),userSettings:bO(e||bO(e6(),".claude"),"settings.json")}}function SO(e,t,n,r){return e!==void 0&&t===n?{backend:e,key:r}:void 0}async function tb(e,t,n,r){if(r)return p1e(r,e,t,n);try{if(n)await n6(t,n(await d1e(e)),{mode:384});else await u1e(e,t)}catch(o){if(Ne(o)===void 0)throw o;if(!br(o))await t6(t,{force:!0}).catch(()=>{}),de(`sessionStore resume: skipping ${e} (${Ne(o)})`)}}async function p1e({backend:e,key:t},n,r,o){let s=await e.read([t]);if(!s.ok){if(s.error.code==="InvalidArgument")throw new qe(`sessionStore resume: invalid v5 key for ${n}: ${s.error.argument}${s.error.reason?` (${s.error.reason})`:""}`,"sessionStore resume: invalid v5 key (InvalidArgument from backend read)");de(`sessionStore resume: skipping ${n} (${s.error.code})`);return}let i=s.value.items[0];if(!i?.found)return;let a=Buffer.from(i.value);try{await n6(r,o?o(a):a,{mode:384})}catch(c){if(Ne(c)===void 0)throw c;if(!br(c))await t6(r,{force:!0}).catch(()=>{}),de(`sessionStore resume: skipping ${n} (${Ne(c)})`)}}import{createHash as f1e}from"crypto";import{homedir as eIt,userInfo as m1e}from"os";var o6="-credentials";function s6(e=""){let t=process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR,n=t!==void 0?!t:!process.env.CLAUDE_CONFIG_DIR,r=t!==void 0?t.normalize("NFC"):Gt(),o=n?"":`-${f1e("sha256").update(r).digest("hex").substring(0,8)}`;return`Claude Code${CF().OAUTH_FILE_SUFFIX}${e}${o}`}var h1e=/^[a-zA-Z0-9._-]+$/;function i6(){if(process.platform==="win32")return"claude-code-user";let e;try{e=process.env.USER||m1e().username}catch{e="claude-code-user"}if(!h1e.test(e))return"claude-code-user";return e}class a6{cache={data:null,cachedAt:0};generation=0;readInFlight=null;lastReadFailure=null;lastKnown=null;legacyApiKeyPrefetch=null}var sIt=new tt(()=>new a6);function g1e(e,t){if(e==="bypassPermissions")return"canUseTool will not be invoked: permissionMode 'bypassPermissions' auto-approves every tool call (except explicit deny rules) before the callback is consulted. To gate every tool call, use a PreToolUse hook instead.";let n=t.filter((r)=>r.length>0&&!r.includes("("));if(n.length===0)return;return`canUseTool will not be invoked for: ${n.join(", ")}. Bare allowedTools entries auto-approve the whole tool before the callback is consulted. To gate every tool call, use a PreToolUse hook; or remove the bare names from allowedTools so they fall through to canUseTool. Allow rules from settings files can also shadow the callback but are not visible here.`}function c6(e,t,n){if(!e)return;let r=g1e(t,n);if(r===void 0)return;process.emitWarning(r,{code:"CLAUDE_SDK_CAN_USE_TOOL_SHADOWED"})}var y1e=P("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");Ze.init(e,t),e.def=t,e.parse=(n,r)=>dk(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Wa(e,n,r),e.parseAsync=async(n,r)=>fk(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>qa(e,n,r),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),e.clone=(n,r)=>rr(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e)});var b1e=P("ZodMiniObject",(e,t)=>{Uy.init(e,t),y1e.init(e,t),Oe.defineLazy(e,"shape",()=>t.shape)});function EO(e,t){let n={type:"object",get shape(){return Oe.assignProp(this,"shape",{...e}),this.shape},...Oe.normalizeParams(t)};return new b1e(n)}function Gr(e){return!!e._zod}function Ja(e){let t=Object.values(e);if(t.length===0)return EO({});let n=t.every(Gr),r=t.every((o)=>!Gr(o));if(n)return EO(e);if(r)return Fw(e);throw Error("Mixed Zod versions detected in object shape.")}function Ri(e,t){if(Gr(e))return Wa(e,t);return e.safeParse(t)}async function nb(e,t){if(Gr(e))return await qa(e,t);return await e.safeParseAsync(t)}function Oi(e){if(!e)return;let t;if(Gr(e))t=e._zod?.def?.shape;else t=e.shape;if(!t)return;if(typeof t==="function")try{return t()}catch{return}return t}function Ou(e){if(!e)return;if(typeof e==="object"){let t=e,n=e;if(!t._def&&!n._zod){let r=Object.values(e);if(r.length>0&&r.every((o)=>typeof o==="object"&&o!==null&&(o._def!==void 0||o._zod!==void 0||typeof o.parse==="function")))return Ja(e)}}if(Gr(e)){let n=e._zod?.def;if(n&&(n.type==="object"||n.shape!==void 0))return e}else if(e.shape!==void 0)return e;return}function rb(e){if(e&&typeof e==="object"){if("message"in e&&typeof e.message==="string")return e.message;if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0){let t=e.issues[0];if(t&&typeof t==="object"&&"message"in t)return String(t.message)}try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function l6(e){return e.description}function u6(e){if(Gr(e))return e._zod?.def?.type==="optional";let t=e;if(typeof e.isOptional==="function")return e.isOptional();return t._def?.typeName==="ZodOptional"}function ob(e){if(Gr(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let n=e._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let r=e.value;if(r!==void 0)return r;return}var xO="2025-11-25";var d6=[xO,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Pi="io.modelcontextprotocol/related-task",ib="2.0",nn=S4((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),p6=ce([_(),ee().int()]),f6=_(),bIt=Un({ttl:ee().optional(),pollInterval:ee().optional()}),E1e=C({ttl:ee().optional()}),x1e=C({taskId:_()}),vO=Un({progressToken:p6.optional(),[Pi]:x1e.optional()}),kr=C({_meta:vO.optional()}),um=kr.extend({task:E1e.optional()}),m6=(e)=>um.safeParse(e).success,bn=C({method:_(),params:kr.loose().optional()}),Wr=C({_meta:vO.optional()}),qr=C({method:_(),params:Wr.loose().optional()}),Sn=Un({_meta:vO.optional()}),ab=ce([_(),ee().int()]),h6=C({jsonrpc:j(ib),id:ab,...bn.shape}).strict(),wO=(e)=>h6.safeParse(e).success,g6=C({jsonrpc:j(ib),...qr.shape}).strict(),_6=(e)=>g6.safeParse(e).success,AO=C({jsonrpc:j(ib),id:ab,result:Sn}).strict(),dm=(e)=>AO.safeParse(e).success;var fe;(function(e){e[e.ConnectionClosed=-32000]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(fe||(fe={}));var TO=C({jsonrpc:j(ib),id:ab.optional(),error:C({code:ee().int(),message:_(),data:Ae().optional()})}).strict();var y6=(e)=>TO.safeParse(e).success;var SIt=ce([h6,g6,AO,TO]),EIt=ce([AO,TO]),cb=Sn.strict(),v1e=Wr.extend({requestId:ab.optional(),reason:_().optional()}),lb=qr.extend({method:j("notifications/cancelled"),params:v1e}),w1e=C({src:_(),mimeType:_().optional(),sizes:I(_()).optional(),theme:q(["light","dark"]).optional()}),pm=C({icons:I(w1e).optional()}),Pu=C({name:_(),title:_().optional()}),b6=Pu.extend({...Pu.shape,...pm.shape,version:_(),websiteUrl:_().optional(),description:_().optional()}),A1e=Wy(C({applyDefaults:R().optional()}),X(_(),Ae())),T1e=st((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},Wy(C({form:A1e.optional(),url:nn.optional()}),X(_(),Ae()).optional())),C1e=Un({list:nn.optional(),cancel:nn.optional(),requests:Un({sampling:Un({createMessage:nn.optional()}).optional(),elicitation:Un({create:nn.optional()}).optional()}).optional()}),k1e=Un({list:nn.optional(),cancel:nn.optional(),requests:Un({tools:Un({call:nn.optional()}).optional()}).optional()}),R1e=C({experimental:X(_(),nn).optional(),sampling:C({context:nn.optional(),tools:nn.optional()}).optional(),elicitation:T1e.optional(),roots:C({listChanged:R().optional()}).optional(),tasks:C1e.optional(),extensions:X(_(),nn).optional()}),O1e=kr.extend({protocolVersion:_(),capabilities:R1e,clientInfo:b6}),CO=bn.extend({method:j("initialize"),params:O1e});var P1e=C({experimental:X(_(),nn).optional(),logging:nn.optional(),completions:nn.optional(),prompts:C({listChanged:R().optional()}).optional(),resources:C({subscribe:R().optional(),listChanged:R().optional()}).optional(),tools:C({listChanged:R().optional()}).optional(),tasks:k1e.optional(),extensions:X(_(),nn).optional()}),I1e=Sn.extend({protocolVersion:_(),capabilities:P1e,serverInfo:b6,instructions:_().optional()}),kO=qr.extend({method:j("notifications/initialized"),params:Wr.optional()});var ub=bn.extend({method:j("ping"),params:kr.optional()}),D1e=C({progress:ee(),total:Et(ee()),message:Et(_())}),L1e=C({...Wr.shape,...D1e.shape,progressToken:p6}),db=qr.extend({method:j("notifications/progress"),params:L1e}),M1e=kr.extend({cursor:f6.optional()}),fm=bn.extend({params:M1e.optional()}),mm=Sn.extend({nextCursor:f6.optional()}),N1e=q(["working","input_required","completed","failed","cancelled"]),hm=C({taskId:_(),status:N1e,ttl:ce([ee(),d4()]),createdAt:_(),lastUpdatedAt:_(),pollInterval:Et(ee()),statusMessage:Et(_())}),Iu=Sn.extend({task:hm}),U1e=Wr.merge(hm),gm=qr.extend({method:j("notifications/tasks/status"),params:U1e}),pb=bn.extend({method:j("tasks/get"),params:kr.extend({taskId:_()})}),fb=Sn.merge(hm),mb=bn.extend({method:j("tasks/result"),params:kr.extend({taskId:_()})}),xIt=Sn.loose(),hb=fm.extend({method:j("tasks/list")}),gb=mm.extend({tasks:I(hm)}),_b=bn.extend({method:j("tasks/cancel"),params:kr.extend({taskId:_()})}),S6=Sn.merge(hm),E6=C({uri:_(),mimeType:Et(_()),_meta:X(_(),Ae()).optional()}),x6=E6.extend({text:_()}),RO=_().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),v6=E6.extend({blob:RO}),_m=q(["user","assistant"]),Du=C({audience:I(_m).optional(),priority:ee().min(0).max(1).optional(),lastModified:im.datetime({offset:!0}).optional()}),w6=C({...Pu.shape,...pm.shape,uri:_(),description:Et(_()),mimeType:Et(_()),size:Et(ee()),annotations:Du.optional(),_meta:Et(Un({}))}),F1e=C({...Pu.shape,...pm.shape,uriTemplate:_(),description:Et(_()),mimeType:Et(_()),annotations:Du.optional(),_meta:Et(Un({}))}),yb=fm.extend({method:j("resources/list")}),j1e=mm.extend({resources:I(w6)}),bb=fm.extend({method:j("resources/templates/list")}),$1e=mm.extend({resourceTemplates:I(F1e)}),OO=kr.extend({uri:_()}),z1e=OO,Sb=bn.extend({method:j("resources/read"),params:z1e}),H1e=Sn.extend({contents:I(ce([x6,v6]))}),B1e=qr.extend({method:j("notifications/resources/list_changed"),params:Wr.optional()}),K1e=OO,G1e=bn.extend({method:j("resources/subscribe"),params:K1e}),W1e=OO,q1e=bn.extend({method:j("resources/unsubscribe"),params:W1e}),V1e=Wr.extend({uri:_()}),Z1e=qr.extend({method:j("notifications/resources/updated"),params:V1e}),Y1e=C({name:_(),description:Et(_()),required:Et(R())}),J1e=C({...Pu.shape,...pm.shape,description:Et(_()),arguments:Et(I(Y1e)),_meta:Et(Un({}))}),Eb=fm.extend({method:j("prompts/list")}),X1e=mm.extend({prompts:I(J1e)}),Q1e=kr.extend({name:_(),arguments:X(_(),_()).optional()}),xb=bn.extend({method:j("prompts/get"),params:Q1e}),PO=C({type:j("text"),text:_(),annotations:Du.optional(),_meta:X(_(),Ae()).optional()}),IO=C({type:j("image"),data:RO,mimeType:_(),annotations:Du.optional(),_meta:X(_(),Ae()).optional()}),DO=C({type:j("audio"),data:RO,mimeType:_(),annotations:Du.optional(),_meta:X(_(),Ae()).optional()}),eHe=C({type:j("tool_use"),name:_(),id:_(),input:X(_(),Ae()),_meta:X(_(),Ae()).optional()}),tHe=C({type:j("resource"),resource:ce([x6,v6]),annotations:Du.optional(),_meta:X(_(),Ae()).optional()}),nHe=w6.extend({type:j("resource_link")}),LO=ce([PO,IO,DO,nHe,tHe]),rHe=C({role:_m,content:LO}),oHe=Sn.extend({description:_().optional(),messages:I(rHe)}),sHe=qr.extend({method:j("notifications/prompts/list_changed"),params:Wr.optional()}),iHe=C({title:_().optional(),readOnlyHint:R().optional(),destructiveHint:R().optional(),idempotentHint:R().optional(),openWorldHint:R().optional()}),aHe=C({taskSupport:q(["required","optional","forbidden"]).optional()}),A6=C({...Pu.shape,...pm.shape,description:_().optional(),inputSchema:C({type:j("object"),properties:X(_(),nn).optional(),required:I(_()).optional()}).catchall(Ae()),outputSchema:C({type:j("object"),properties:X(_(),nn).optional(),required:I(_()).optional()}).catchall(Ae()).optional(),annotations:iHe.optional(),execution:aHe.optional(),_meta:X(_(),Ae()).optional()}),vb=fm.extend({method:j("tools/list")}),cHe=mm.extend({tools:I(A6)}),wb=Sn.extend({content:I(LO).default([]),structuredContent:X(_(),Ae()).optional(),isError:R().optional()}),vIt=wb.or(Sn.extend({toolResult:Ae()})),lHe=um.extend({name:_(),arguments:X(_(),Ae()).optional()}),Lu=bn.extend({method:j("tools/call"),params:lHe}),uHe=qr.extend({method:j("notifications/tools/list_changed"),params:Wr.optional()}),wIt=C({autoRefresh:R().default(!0),debounceMs:ee().int().nonnegative().default(300)}),ym=q(["debug","info","notice","warning","error","critical","alert","emergency"]),dHe=kr.extend({level:ym}),MO=bn.extend({method:j("logging/setLevel"),params:dHe}),pHe=Wr.extend({level:ym,logger:_().optional(),data:Ae()}),fHe=qr.extend({method:j("notifications/message"),params:pHe}),mHe=C({name:_().optional()}),hHe=C({hints:I(mHe).optional(),costPriority:ee().min(0).max(1).optional(),speedPriority:ee().min(0).max(1).optional(),intelligencePriority:ee().min(0).max(1).optional()}),gHe=C({mode:q(["auto","required","none"]).optional()}),_He=C({type:j("tool_result"),toolUseId:_().describe("The unique identifier for the corresponding tool call."),content:I(LO).default([]),structuredContent:C({}).loose().optional(),isError:R().optional(),_meta:X(_(),Ae()).optional()}),yHe=Za("type",[PO,IO,DO]),sb=Za("type",[PO,IO,DO,eHe,_He]),bHe=C({role:_m,content:ce([sb,I(sb)]),_meta:X(_(),Ae()).optional()}),SHe=um.extend({messages:I(bHe),modelPreferences:hHe.optional(),systemPrompt:_().optional(),includeContext:q(["none","thisServer","allServers"]).optional(),temperature:ee().optional(),maxTokens:ee().int(),stopSequences:I(_()).optional(),metadata:nn.optional(),tools:I(A6).optional(),toolChoice:gHe.optional()}),EHe=bn.extend({method:j("sampling/createMessage"),params:SHe}),bm=Sn.extend({model:_(),stopReason:Et(q(["endTurn","stopSequence","maxTokens"]).or(_())),role:_m,content:yHe}),NO=Sn.extend({model:_(),stopReason:Et(q(["endTurn","stopSequence","maxTokens","toolUse"]).or(_())),role:_m,content:ce([sb,I(sb)])}),xHe=C({type:j("boolean"),title:_().optional(),description:_().optional(),default:R().optional()}),vHe=C({type:j("string"),title:_().optional(),description:_().optional(),minLength:ee().optional(),maxLength:ee().optional(),format:q(["email","uri","date","date-time"]).optional(),default:_().optional()}),wHe=C({type:q(["number","integer"]),title:_().optional(),description:_().optional(),minimum:ee().optional(),maximum:ee().optional(),default:ee().optional()}),AHe=C({type:j("string"),title:_().optional(),description:_().optional(),enum:I(_()),default:_().optional()}),THe=C({type:j("string"),title:_().optional(),description:_().optional(),oneOf:I(C({const:_(),title:_()})),default:_().optional()}),CHe=C({type:j("string"),title:_().optional(),description:_().optional(),enum:I(_()),enumNames:I(_()).optional(),default:_().optional()}),kHe=ce([AHe,THe]),RHe=C({type:j("array"),title:_().optional(),description:_().optional(),minItems:ee().optional(),maxItems:ee().optional(),items:C({type:j("string"),enum:I(_())}),default:I(_()).optional()}),OHe=C({type:j("array"),title:_().optional(),description:_().optional(),minItems:ee().optional(),maxItems:ee().optional(),items:C({anyOf:I(C({const:_(),title:_()}))}),default:I(_()).optional()}),PHe=ce([RHe,OHe]),IHe=ce([CHe,kHe,PHe]),DHe=ce([IHe,xHe,vHe,wHe]),LHe=um.extend({mode:j("form").optional(),message:_(),requestedSchema:C({type:j("object"),properties:X(_(),DHe),required:I(_()).optional()})}),MHe=um.extend({mode:j("url"),message:_(),elicitationId:_(),url:_().url()}),NHe=ce([LHe,MHe]),UHe=bn.extend({method:j("elicitation/create"),params:NHe}),FHe=Wr.extend({elicitationId:_()}),jHe=qr.extend({method:j("notifications/elicitation/complete"),params:FHe}),Mu=Sn.extend({action:q(["accept","decline","cancel"]),content:st((e)=>e===null?void 0:e,X(_(),ce([_(),ee(),R(),I(_())])).optional())}),$He=C({type:j("ref/resource"),uri:_()});var zHe=C({type:j("ref/prompt"),name:_()}),HHe=kr.extend({ref:ce([zHe,$He]),argument:C({name:_(),value:_()}),context:C({arguments:X(_(),_()).optional()}).optional()}),Ab=bn.extend({method:j("completion/complete"),params:HHe});function T6(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function C6(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var BHe=Sn.extend({completion:Un({values:I(_()).max(100),total:Et(ee().int()),hasMore:Et(R())})}),KHe=C({uri:_().startsWith("file://"),name:_().optional(),_meta:X(_(),Ae()).optional()}),GHe=bn.extend({method:j("roots/list"),params:kr.optional()}),UO=Sn.extend({roots:I(KHe)}),WHe=qr.extend({method:j("notifications/roots/list_changed"),params:Wr.optional()}),AIt=ce([ub,CO,Ab,MO,xb,Eb,yb,bb,Sb,G1e,q1e,Lu,vb,pb,mb,hb,_b]),TIt=ce([lb,db,kO,WHe,gm]),CIt=ce([cb,bm,NO,Mu,UO,fb,gb,Iu]),kIt=ce([ub,EHe,UHe,GHe,pb,mb,hb,_b]),RIt=ce([lb,db,fHe,Z1e,B1e,uHe,sHe,gm,jHe]),OIt=ce([cb,I1e,BHe,oHe,X1e,j1e,$1e,H1e,wb,cHe,fb,gb,Iu]);class ae extends Error{constructor(e,t,n){super(`MCP error ${e}: ${t}`);this.code=e,this.data=n,this.name="McpError"}static fromError(e,t,n){if(e===fe.UrlElicitationRequired&&n){let r=n;if(r.elicitations)return new k6(r.elicitations,t)}return new ae(e,t,n)}}class k6 extends ae{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(fe.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function Ii(e){return e==="completed"||e==="failed"||e==="cancelled"}var O6=Symbol("Let zodToJsonSchema decide on which parser to use");var R6={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},P6=(e)=>typeof e==="string"?{...R6,name:e}:{...R6,...e};var I6=(e)=>{let t=P6(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,o])=>[o._def,{def:o._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}};function FO(e,t,n,r){if(!r?.errorMessages)return;if(n)e.errorMessage={...e.errorMessage,[t]:n}}function ze(e,t,n,r,o){e[t]=n,FO(e,t,r,o)}var Tb=(e,t)=>{let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!==t[n])break;return[(e.length-n).toString(),...t.slice(n)].join("/")};function xt(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?Tb(t,e.currentPath):t.join("/")}}function D6(e,t){let n={type:"array"};if(e.type?._def&&e.type?._def?.typeName!==B.ZodAny)n.items=ge(e.type._def,{...t,currentPath:[...t.currentPath,"items"]});if(e.minLength)ze(n,"minItems",e.minLength.value,e.minLength.message,t);if(e.maxLength)ze(n,"maxItems",e.maxLength.value,e.maxLength.message,t);if(e.exactLength)ze(n,"minItems",e.exactLength.value,e.exactLength.message,t),ze(n,"maxItems",e.exactLength.value,e.exactLength.message,t);return n}function L6(e,t){let n={type:"integer",format:"int64"};if(!e.checks)return n;for(let r of e.checks)switch(r.kind){case"min":if(t.target==="jsonSchema7")if(r.inclusive)ze(n,"minimum",r.value,r.message,t);else ze(n,"exclusiveMinimum",r.value,r.message,t);else{if(!r.inclusive)n.exclusiveMinimum=!0;ze(n,"minimum",r.value,r.message,t)}break;case"max":if(t.target==="jsonSchema7")if(r.inclusive)ze(n,"maximum",r.value,r.message,t);else ze(n,"exclusiveMaximum",r.value,r.message,t);else{if(!r.inclusive)n.exclusiveMaximum=!0;ze(n,"maximum",r.value,r.message,t)}break;case"multipleOf":ze(n,"multipleOf",r.value,r.message,t);break}return n}function M6(){return{type:"boolean"}}function Cb(e,t){return ge(e.type._def,t)}var N6=(e,t)=>ge(e.innerType._def,t);function jO(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((o,s)=>jO(e,t,o))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return qHe(e,t)}}var qHe=(e,t)=>{let n={type:"integer",format:"unix-time"};if(t.target==="openApi3")return n;for(let r of e.checks)switch(r.kind){case"min":ze(n,"minimum",r.value,r.message,t);break;case"max":ze(n,"maximum",r.value,r.message,t);break}return n};function U6(e,t){return{...ge(e.innerType._def,t),default:e.defaultValue()}}function F6(e,t){return t.effectStrategy==="input"?ge(e.schema._def,t):xt(t)}function j6(e){return{type:"string",enum:Array.from(e.values)}}var VHe=(e)=>{if("type"in e&&e.type==="string")return!1;return"allOf"in e};function $6(e,t){let n=[ge(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),ge(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((s)=>!!s),r=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return n.forEach((s)=>{if(VHe(s)){if(o.push(...s.allOf),s.unevaluatedProperties===void 0)r=void 0}else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...c}=s;i=c}else r=void 0;o.push(i)}}),o.length?{allOf:o,...r}:void 0}function z6(e,t){let n=typeof e.value;if(n!=="bigint"&&n!=="number"&&n!=="boolean"&&n!=="string")return{type:Array.isArray(e.value)?"array":"object"};if(t.target==="openApi3")return{type:n==="bigint"?"integer":n,enum:[e.value]};return{type:n==="bigint"?"integer":n,const:e.value}}var $O=void 0,wo={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if($O===void 0)$O=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return $O},uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function kb(e,t){let n={type:"string"};if(e.checks)for(let r of e.checks)switch(r.kind){case"min":ze(n,"minLength",typeof n.minLength==="number"?Math.max(n.minLength,r.value):r.value,r.message,t);break;case"max":ze(n,"maxLength",typeof n.maxLength==="number"?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Ao(n,"email",r.message,t);break;case"format:idn-email":Ao(n,"idn-email",r.message,t);break;case"pattern:zod":Fn(n,wo.email,r.message,t);break}break;case"url":Ao(n,"uri",r.message,t);break;case"uuid":Ao(n,"uuid",r.message,t);break;case"regex":Fn(n,r.regex,r.message,t);break;case"cuid":Fn(n,wo.cuid,r.message,t);break;case"cuid2":Fn(n,wo.cuid2,r.message,t);break;case"startsWith":Fn(n,RegExp(`^${zO(r.value,t)}`),r.message,t);break;case"endsWith":Fn(n,RegExp(`${zO(r.value,t)}$`),r.message,t);break;case"datetime":Ao(n,"date-time",r.message,t);break;case"date":Ao(n,"date",r.message,t);break;case"time":Ao(n,"time",r.message,t);break;case"duration":Ao(n,"duration",r.message,t);break;case"length":ze(n,"minLength",typeof n.minLength==="number"?Math.max(n.minLength,r.value):r.value,r.message,t),ze(n,"maxLength",typeof n.maxLength==="number"?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"includes":{Fn(n,RegExp(zO(r.value,t)),r.message,t);break}case"ip":{if(r.version!=="v6")Ao(n,"ipv4",r.message,t);if(r.version!=="v4")Ao(n,"ipv6",r.message,t);break}case"base64url":Fn(n,wo.base64url,r.message,t);break;case"jwt":Fn(n,wo.jwt,r.message,t);break;case"cidr":{if(r.version!=="v6")Fn(n,wo.ipv4Cidr,r.message,t);if(r.version!=="v4")Fn(n,wo.ipv6Cidr,r.message,t);break}case"emoji":Fn(n,wo.emoji(),r.message,t);break;case"ulid":{Fn(n,wo.ulid,r.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Ao(n,"binary",r.message,t);break}case"contentEncoding:base64":{ze(n,"contentEncoding","base64",r.message,t);break}case"pattern:zod":{Fn(n,wo.base64,r.message,t);break}}break}case"nanoid":Fn(n,wo.nanoid,r.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:((o)=>{})(r)}return n}function zO(e,t){return t.patternStrategy==="escape"?YHe(e):e}var ZHe=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function YHe(e){let t="";for(let n=0;n<e.length;n++){if(!ZHe.has(e[n]))t+="\\";t+=e[n]}return t}function Ao(e,t,n,r){if(e.format||e.anyOf?.some((o)=>o.format)){if(!e.anyOf)e.anyOf=[];if(e.format){if(e.anyOf.push({format:e.format,...e.errorMessage&&r.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage){if(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})}else ze(e,"format",t,n,r)}function Fn(e,t,n,r){if(e.pattern||e.allOf?.some((o)=>o.pattern)){if(!e.allOf)e.allOf=[];if(e.pattern){if(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage){if(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.allOf.push({pattern:H6(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})}else ze(e,"pattern",H6(t,r),n,r)}function H6(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},r=n.i?e.source.toLowerCase():e.source,o="",s=!1,i=!1,a=!1;for(let c=0;c<r.length;c++){if(s){o+=r[c],s=!1;continue}if(n.i){if(i){if(r[c].match(/[a-z]/)){if(a)o+=r[c],o+=`${r[c-2]}-${r[c]}`.toUpperCase(),a=!1;else if(r[c+1]==="-"&&r[c+2]?.match(/[a-z]/))o+=r[c],a=!0;else o+=`${r[c]}${r[c].toUpperCase()}`;continue}}else if(r[c].match(/[a-z]/)){o+=`[${r[c]}${r[c].toUpperCase()}]`;continue}}if(n.m){if(r[c]==="^"){o+=`(^|(?<=[\r
144
- ]))`;continue}else if(r[c]==="$"){o+=`($|(?=[\r
145
- ]))`;continue}}if(n.s&&r[c]==="."){o+=i?`${r[c]}\r
146
- `:`[${r[c]}\r
147
- ]`;continue}if(o+=r[c],r[c]==="\\")s=!0;else if(i&&r[c]==="]")i=!1;else if(!i&&r[c]==="[")i=!0}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function Rb(e,t){if(t.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(t.target==="openApi3"&&e.keyType?._def.typeName===B.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((r,o)=>({...r,[o]:ge(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",o]})??xt(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let n={type:"object",additionalProperties:ge(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return n;if(e.keyType?._def.typeName===B.ZodString&&e.keyType._def.checks?.length){let{type:r,...o}=kb(e.keyType._def,t);return{...n,propertyNames:o}}else if(e.keyType?._def.typeName===B.ZodEnum)return{...n,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===B.ZodBranded&&e.keyType._def.type._def.typeName===B.ZodString&&e.keyType._def.type._def.checks?.length){let{type:r,...o}=Cb(e.keyType._def,t);return{...n,propertyNames:o}}return n}function B6(e,t){if(t.mapStrategy==="record")return Rb(e,t);let n=ge(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||xt(t),r=ge(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||xt(t);return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function K6(e){let t=e.values,r=Object.keys(e.values).filter((s)=>typeof t[t[s]]!=="number").map((s)=>t[s]),o=Array.from(new Set(r.map((s)=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:r}}function G6(e){return e.target==="openAi"?void 0:{not:xt({...e,currentPath:[...e.currentPath,"not"]})}}function W6(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Sm={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function V6(e,t){if(t.target==="openApi3")return q6(e,t);let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every((r)=>(r._def.typeName in Sm)&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((o,s)=>{let i=Sm[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:r.length>1?r:r[0]}}else if(n.every((r)=>r._def.typeName==="ZodLiteral"&&!r.description)){let r=n.reduce((o,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(r.length===n.length){let o=r.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:n.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(n.every((r)=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,o)=>[...r,...o._def.values.filter((s)=>!r.includes(s))],[])};return q6(e,t)}var q6=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,o)=>ge(r._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter((r)=>!!r&&(!t.strictUnions||typeof r==="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function Z6(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length)){if(t.target==="openApi3")return{type:Sm[e.innerType._def.typeName],nullable:!0};return{type:[Sm[e.innerType._def.typeName],"null"]}}if(t.target==="openApi3"){let r=ge(e.innerType._def,{...t,currentPath:[...t.currentPath]});if(r&&"$ref"in r)return{allOf:[r],nullable:!0};return r&&{...r,nullable:!0}}let n=ge(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function Y6(e,t){let n={type:"number"};if(!e.checks)return n;for(let r of e.checks)switch(r.kind){case"int":n.type="integer",FO(n,"type",r.message,t);break;case"min":if(t.target==="jsonSchema7")if(r.inclusive)ze(n,"minimum",r.value,r.message,t);else ze(n,"exclusiveMinimum",r.value,r.message,t);else{if(!r.inclusive)n.exclusiveMinimum=!0;ze(n,"minimum",r.value,r.message,t)}break;case"max":if(t.target==="jsonSchema7")if(r.inclusive)ze(n,"maximum",r.value,r.message,t);else ze(n,"exclusiveMaximum",r.value,r.message,t);else{if(!r.inclusive)n.exclusiveMaximum=!0;ze(n,"maximum",r.value,r.message,t)}break;case"multipleOf":ze(n,"multipleOf",r.value,r.message,t);break}return n}function J6(e,t){let n=t.target==="openAi",r={type:"object",properties:{}},o=[],s=e.shape();for(let a in s){let c=s[a];if(c===void 0||c._def===void 0)continue;let l=XHe(c);if(l&&n){if(c._def.typeName==="ZodOptional")c=c._def.innerType;if(!c.isNullable())c=c.nullable();l=!1}let u=ge(c._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});if(u===void 0)continue;if(r.properties[a]=u,!l)o.push(a)}if(o.length)r.required=o;let i=JHe(e,t);if(i!==void 0)r.additionalProperties=i;return r}function JHe(e,t){if(e.catchall._def.typeName!=="ZodNever")return ge(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function XHe(e){try{return e.isOptional()}catch{return!0}}var X6=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return ge(e.innerType._def,t);let n=ge(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:xt(t)},n]}:xt(t)};var Q6=(e,t)=>{if(t.pipeStrategy==="input")return ge(e.in._def,t);else if(t.pipeStrategy==="output")return ge(e.out._def,t);let n=ge(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=ge(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter((o)=>o!==void 0)}};function e3(e,t){return ge(e.type._def,t)}function t3(e,t){let r={type:"array",uniqueItems:!0,items:ge(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};if(e.minSize)ze(r,"minItems",e.minSize.value,e.minSize.message,t);if(e.maxSize)ze(r,"maxItems",e.maxSize.value,e.maxSize.message,t);return r}function n3(e,t){if(e.rest)return{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>ge(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:ge(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})};else return{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>ge(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function r3(e){return{not:xt(e)}}function o3(e){return xt(e)}var s3=(e,t)=>ge(e.innerType._def,t);var i3=(e,t,n)=>{switch(t){case B.ZodString:return kb(e,n);case B.ZodNumber:return Y6(e,n);case B.ZodObject:return J6(e,n);case B.ZodBigInt:return L6(e,n);case B.ZodBoolean:return M6();case B.ZodDate:return jO(e,n);case B.ZodUndefined:return r3(n);case B.ZodNull:return W6(n);case B.ZodArray:return D6(e,n);case B.ZodUnion:case B.ZodDiscriminatedUnion:return V6(e,n);case B.ZodIntersection:return $6(e,n);case B.ZodTuple:return n3(e,n);case B.ZodRecord:return Rb(e,n);case B.ZodLiteral:return z6(e,n);case B.ZodEnum:return j6(e);case B.ZodNativeEnum:return K6(e);case B.ZodNullable:return Z6(e,n);case B.ZodOptional:return X6(e,n);case B.ZodMap:return B6(e,n);case B.ZodSet:return t3(e,n);case B.ZodLazy:return()=>e.getter()._def;case B.ZodPromise:return e3(e,n);case B.ZodNaN:case B.ZodNever:return G6(n);case B.ZodEffects:return F6(e,n);case B.ZodAny:return xt(n);case B.ZodUnknown:return o3(n);case B.ZodDefault:return U6(e,n);case B.ZodBranded:return Cb(e,n);case B.ZodReadonly:return s3(e,n);case B.ZodCatch:return N6(e,n);case B.ZodPipeline:return Q6(e,n);case B.ZodFunction:case B.ZodVoid:case B.ZodSymbol:return;default:return((r)=>{return})(t)}};function ge(e,t,n=!1){let r=t.seen.get(e);if(t.override){let a=t.override?.(e,t,r,n);if(a!==O6)return a}if(r&&!n){let a=QHe(r,t);if(a!==void 0)return a}let o={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,o);let s=i3(e,e.typeName,t),i=typeof s==="function"?ge(s(),t):s;if(i)eBe(e,t,i);if(t.postProcess){let a=t.postProcess(i,e,t);return o.jsonSchema=i,a}return o.jsonSchema=i,i}var QHe=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Tb(t.currentPath,e.path)};case"none":case"seen":{if(e.path.length<t.currentPath.length&&e.path.every((n,r)=>t.currentPath[r]===n))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),xt(t);return t.$refStrategy==="seen"?xt(t):void 0}}},eBe=(e,t,n)=>{if(e.description){if(n.description=e.description,t.markdownDescription)n.markdownDescription=e.description}return n};var HO=(e,t)=>{let n=I6(t),r=typeof t==="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[l,u])=>({...c,[l]:ge(u._def,{...n,currentPath:[...n.basePath,n.definitionPath,l]},!0)??xt(n)}),{}):void 0,o=typeof t==="string"?t:t?.nameStrategy==="title"?void 0:t?.name,s=ge(e._def,o===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,o]},!1)??xt(n),i=typeof t==="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;if(i!==void 0)s.title=i;if(n.flags.hasReferencedOpenAiAnyType){if(!r)r={};if(!r[n.openAiAnyTypeName])r[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:n.$refStrategy==="relative"?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}}}let a=o===void 0?r?{...s,[n.definitionPath]:r}:s:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,o].join("/"),[n.definitionPath]:{...r,[o]:s}};if(n.target==="jsonSchema7")a.$schema="http://json-schema.org/draft-07/schema#";else if(n.target==="jsonSchema2019-09"||n.target==="openAi")a.$schema="https://json-schema.org/draft/2019-09/schema#";if(n.target==="openAi"&&(("anyOf"in a)||("oneOf"in a)||("allOf"in a)||("type"in a)&&Array.isArray(a.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return a};function tBe(e){if(!e)return"draft-7";if(e==="jsonSchema7"||e==="draft-7")return"draft-7";if(e==="jsonSchema2019-09"||e==="draft-2020-12")return"draft-2020-12";return"draft-7"}function BO(e,t){if(Gr(e))return By(e,{target:tBe(t?.target),io:t?.pipeStrategy??"input"});return HO(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function KO(e){let n=Oi(e)?.method;if(!n)throw Error("Schema is missing a method literal");let r=ob(n);if(typeof r!=="string")throw Error("Schema method literal must be a string");return r}function GO(e,t){let n=Ri(e,t);if(!n.success)throw n.error;return n.data}var nBe=60000;class WO{constructor(e){if(this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(lb,(t)=>{this._oncancel(t)}),this.setNotificationHandler(db,(t)=>{this._onprogress(t)}),this.setRequestHandler(ub,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(pb,async(t,n)=>{let r=await this._taskStore.getTask(t.params.taskId,n.sessionId);if(!r)throw new ae(fe.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(mb,async(t,n)=>{let r=async()=>{let o=t.params.taskId;if(this._taskMessageQueue){let i;while(i=await this._taskMessageQueue.dequeue(o,n.sessionId)){if(i.type==="response"||i.type==="error"){let a=i.message,c=a.id,l=this._requestResolvers.get(c);if(l)if(this._requestResolvers.delete(c),i.type==="response")l(a);else{let u=a,p=new ae(u.error.code,u.error.message,u.error.data);l(p)}else{let u=i.type==="response"?"Response":"Error";this._onerror(Error(`${u} handler missing for request ${c}`))}continue}await this._transport?.send(i.message,{relatedRequestId:n.requestId})}}let s=await this._taskStore.getTask(o,n.sessionId);if(!s)throw new ae(fe.InvalidParams,`Task not found: ${o}`);if(!Ii(s.status))return await this._waitForTaskUpdate(o,n.signal),await r();if(Ii(s.status)){let i=await this._taskStore.getTaskResult(o,n.sessionId);return this._clearTaskQueue(o),{...i,_meta:{...i._meta,[Pi]:{taskId:o}}}}return await r()};return await r()}),this.setRequestHandler(hb,async(t,n)=>{try{let{tasks:r,nextCursor:o}=await this._taskStore.listTasks(t.params?.cursor,n.sessionId);return{tasks:r,nextCursor:o,_meta:{}}}catch(r){throw new ae(fe.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(_b,async(t,n)=>{try{let r=await this._taskStore.getTask(t.params.taskId,n.sessionId);if(!r)throw new ae(fe.InvalidParams,`Task not found: ${t.params.taskId}`);if(Ii(r.status))throw new ae(fe.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(t.params.taskId);let o=await this._taskStore.getTask(t.params.taskId,n.sessionId);if(!o)throw new ae(fe.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...o}}catch(r){if(r instanceof ae)throw r;throw new ae(fe.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),ae.fromError(fe.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=(o)=>{n?.(o),this._onerror(o)};let r=this._transport?.onmessage;this._transport.onmessage=(o,s)=>{if(r?.(o,s),dm(o)||y6(o))this._onresponse(o);else if(wO(o))this._onrequest(o,s);else if(_6(o))this._onnotification(o);else this._onerror(Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let t=ae.fromError(fe.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;if(t===void 0)return;Promise.resolve().then(()=>t(e)).catch((n)=>this._onerror(Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,t){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,o=e.params?._meta?.[Pi]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:fe.MethodNotFound,message:"Method not found"}};if(o&&this._taskMessageQueue)this._enqueueTaskMessage(o,{type:"error",message:l,timestamp:Date.now()},r?.sessionId).catch((u)=>this._onerror(Error(`Failed to enqueue error response: ${u}`)));else r?.send(l).catch((u)=>this._onerror(Error(`Failed to send an error response: ${u}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let i=m6(e.params)?e.params.task:void 0,a=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,c={signal:s.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async(l)=>{if(s.signal.aborted)return;let u={relatedRequestId:e.id};if(o)u.relatedTask={taskId:o};await this.notification(l,u)},sendRequest:async(l,u,p)=>{if(s.signal.aborted)throw new ae(fe.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:e.id};if(o&&!f.relatedTask)f.relatedTask={taskId:o};let m=f.relatedTask?.taskId??o;if(m&&a)await a.updateTaskStatus(m,"input_required");return await this.request(l,u,f)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:o,taskStore:a,taskRequestedTtl:i?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(i)this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,c)).then(async(l)=>{if(s.signal.aborted)return;let u={result:l,jsonrpc:"2.0",id:e.id};if(o&&this._taskMessageQueue)await this._enqueueTaskMessage(o,{type:"response",message:u,timestamp:Date.now()},r?.sessionId);else await r?.send(u)},async(l)=>{if(s.signal.aborted)return;let u={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:fe.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};if(o&&this._taskMessageQueue)await this._enqueueTaskMessage(o,{type:"error",message:u,timestamp:Date.now()},r?.sessionId);else await r?.send(u)}).catch((l)=>this._onerror(Error(`Failed to send response: ${l}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===s)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),o=this._progressHandlers.get(r);if(!o){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(r),i=this._timeoutInfo.get(r);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(a){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),s(a);return}o(n)}_onresponse(e){let t=Number(e.id),n=this._requestResolvers.get(t);if(n){if(this._requestResolvers.delete(t),dm(e))n(e);else{let s=new ae(e.error.code,e.error.message,e.error.data);n(s)}return}let r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let o=!1;if(dm(e)&&e.result&&typeof e.result==="object"){let s=e.result;if(s.task&&typeof s.task==="object"){let i=s.task;if(typeof i.taskId==="string")o=!0,this._taskProgressTokens.set(i.taskId,t)}}if(!o)this._progressHandlers.delete(t);if(dm(e))r(e);else{let s=ae.fromError(e.error.code,e.error.message,e.error.data);r(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,n){let{task:r}=n??{};if(!r){try{yield{type:"result",result:await this.request(e,t,n)}}catch(s){yield{type:"error",error:s instanceof ae?s:new ae(fe.InternalError,String(s))}}return}let o;try{let s=await this.request(e,Iu,n);if(s.task)o=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new ae(fe.InternalError,"Task creation did not return a task");while(!0){let i=await this.getTask({taskId:o},n);if(yield{type:"taskStatus",task:i},Ii(i.status)){if(i.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:o},t,n)};else if(i.status==="failed")yield{type:"error",error:new ae(fe.InternalError,`Task ${o} failed`)};else if(i.status==="cancelled")yield{type:"error",error:new ae(fe.InternalError,`Task ${o} was cancelled`)};return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},t,n)};return}let a=i.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((c)=>setTimeout(c,a)),n?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof ae?s:new ae(fe.InternalError,String(s))}}}request(e,t,n){let{relatedRequestId:r,resumptionToken:o,onresumptiontoken:s,task:i,relatedTask:a}=n??{};return new Promise((c,l)=>{let u=(S)=>{l(S)};if(!this._transport){u(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),i)this.assertTaskCapability(e.method)}catch(S){u(S);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};if(n?.onprogress)this._progressHandlers.set(p,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}};if(i)f.params={...f.params,task:i};if(a)f.params={...f.params,_meta:{...f.params?._meta||{},[Pi]:a}};let m=(S)=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(S)}},{relatedRequestId:r,resumptionToken:o,onresumptiontoken:s}).catch((x)=>this._onerror(Error(`Failed to send cancellation: ${x}`)));let b=S instanceof ae?S:new ae(fe.RequestTimeout,String(S));l(b)};this._responseHandlers.set(p,(S)=>{if(n?.signal?.aborted)return;if(S instanceof Error)return l(S);try{let b=Ri(t,S.result);if(!b.success)l(b.error);else c(b.data)}catch(b){l(b)}}),n?.signal?.addEventListener("abort",()=>{m(n?.signal?.reason)});let h=n?.timeout??nBe,g=()=>m(ae.fromError(fe.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(p,h,n?.maxTotalTimeout,g,n?.resetTimeoutOnProgress??!1);let y=a?.taskId;if(y){let S=(b)=>{let x=this._responseHandlers.get(p);if(x)x(b);else this._onerror(Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,S),this._enqueueTaskMessage(y,{type:"request",message:f,timestamp:Date.now()}).catch((b)=>{this._cleanupTimeout(p),l(b)})}else this._transport.send(f,{relatedRequestId:r,resumptionToken:o,onresumptiontoken:s}).catch((S)=>{this._cleanupTimeout(p),l(S)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},fb,t)}async getTaskResult(e,t,n){return this.request({method:"tasks/result",params:e},t,n)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},gb,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},S6,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let n=t?.relatedTask?.taskId;if(n){let i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Pi]:t.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let i={...e,jsonrpc:"2.0"};if(t?.relatedTask)i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Pi]:t.relatedTask}}};this._transport?.send(i,t).catch((a)=>this._onerror(a))});return}let s={...e,jsonrpc:"2.0"};if(t?.relatedTask)s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Pi]:t.relatedTask}}};await this._transport.send(s,t)}setRequestHandler(e,t){let n=KO(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(r,o)=>{let s=GO(e,r);return Promise.resolve(t(s,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let n=KO(e);this._notificationHandlers.set(n,(r)=>{let o=GO(e,r);return Promise.resolve(t(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);if(t!==void 0)this._progressHandlers.delete(t),this._taskProgressTokens.delete(e)}async _enqueueTaskMessage(e,t,n){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,n,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,t);for(let r of n)if(r.type==="request"&&wO(r.message)){let o=r.message.id,s=this._requestResolvers.get(o);if(s)s(new ae(fe.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o);else this._onerror(Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let n=this._options?.defaultTaskPollInterval??1000;try{let r=await this._taskStore?.getTask(e);if(r?.pollInterval)n=r.pollInterval}catch{}return new Promise((r,o)=>{if(t.aborted){o(new ae(fe.InvalidRequest,"Request cancelled"));return}let s=setTimeout(r,n);t.addEventListener("abort",()=>{clearTimeout(s),o(new ae(fe.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let n=this._taskStore;if(!n)throw Error("No task store configured");return{createTask:async(r)=>{if(!e)throw Error("No request provided");return await n.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async(r)=>{let o=await n.getTask(r,t);if(!o)throw new ae(fe.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(r,o,s)=>{await n.storeTaskResult(r,o,s,t);let i=await n.getTask(r,t);if(i){let a=gm.parse({method:"notifications/tasks/status",params:i});if(await this.notification(a),Ii(i.status))this._cleanupTaskProgressHandler(r)}},getTaskResult:(r)=>n.getTaskResult(r,t),updateTaskStatus:async(r,o,s)=>{let i=await n.getTask(r,t);if(!i)throw new ae(fe.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(Ii(i.status))throw new ae(fe.InvalidParams,`Cannot update task "${r}" from terminal status "${i.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(r,o,s,t);let a=await n.getTask(r,t);if(a){let c=gm.parse({method:"notifications/tasks/status",params:a});if(await this.notification(c),Ii(a.status))this._cleanupTaskProgressHandler(r)}},listTasks:(r)=>n.listTasks(r,t)}}}function a3(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function c3(e,t){let n={...e};for(let r in t){let o=r,s=t[o];if(s===void 0)continue;let i=n[o];if(a3(i)&&a3(s))n[o]={...i,...s};else n[o]=s}return n}var KY=Hn(zP(),1),GY=Hn(BY(),1);function w6e(){let e=new KY.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return GY.default(e),e}class JP{constructor(e){this._ajv=e??w6e()}getValidator(e){let t="$id"in e&&typeof e.$id==="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return(n)=>{if(t(n))return{valid:!0,data:n,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class XP{constructor(e){this._server=e}requestStream(e,t,n){return this._server.requestStream(e,t,n)}createMessageStream(e,t){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let r=e.messages[e.messages.length-1],o=Array.isArray(r.content)?r.content:[r.content],s=o.some((l)=>l.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some((l)=>l.type==="tool_use");if(s){if(o.some((l)=>l.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!c)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let l=new Set(a.filter((p)=>p.type==="tool_use").map((p)=>p.id)),u=new Set(o.filter((p)=>p.type==="tool_result").map((p)=>p.toolUseId));if(l.size!==u.size||![...l].every((p)=>u.has(p)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},bm,t)}elicitInputStream(e,t){let n=this._server.getClientCapabilities(),r=e.mode??"form";switch(r){case"url":{if(!n?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let o=r==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:o},Mu,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,n){return this._server.getTaskResult({taskId:e},t,n)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}function WY(e,t,n){if(!e)throw Error(`${n} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${n} does not support task creation for tools/call (required for ${t})`);break;default:break}}function qY(e,t,n){if(!e)throw Error(`${n} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${n} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${n} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}class QP extends WO{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(ym.options.map((n,r)=>[n,r])),this.isMessageIgnored=(n,r)=>{let o=this._loggingLevels.get(r);return o?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new JP,this.setRequestHandler(CO,(n)=>this._oninitialize(n)),this.setNotificationHandler(kO,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(MO,async(n,r)=>{let o=r.sessionId||r.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=n.params,i=ym.safeParse(s);if(i.success)this._loggingLevels.set(o,i.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new XP(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=c3(this._capabilities,e)}setRequestHandler(e,t){let r=Oi(e)?.method;if(!r)throw Error("Schema is missing a method literal");let o;if(Gr(r)){let i=r;o=i._zod?.def?.value??i.value}else{let i=r;o=i._def?.value??i.value}if(typeof o!=="string")throw Error("Schema method literal must be a string");if(o==="tools/call"){let i=async(a,c)=>{let l=Ri(Lu,a);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new ae(fe.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:u}=l.data,p=await Promise.resolve(t(a,c));if(u.task){let m=Ri(Iu,p);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new ae(fe.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}let f=Ri(wb,p);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new ae(fe.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){qY(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;WY(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:d6.includes(t)?t:xO,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},cb)}async createMessage(e,t){if(e.tools||e.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(e.messages.length>0){let n=e.messages[e.messages.length-1],r=Array.isArray(n.content)?n.content:[n.content],o=r.some((c)=>c.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=s?Array.isArray(s.content)?s.content:[s.content]:[],a=i.some((c)=>c.type==="tool_use");if(o){if(r.some((c)=>c.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!a)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(a){let c=new Set(i.filter((u)=>u.type==="tool_use").map((u)=>u.id)),l=new Set(r.filter((u)=>u.type==="tool_result").map((u)=>u.toolUseId));if(c.size!==l.size||![...c].every((u)=>l.has(u)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(e.tools)return this.request({method:"sampling/createMessage",params:e},NO,t);return this.request({method:"sampling/createMessage",params:e},bm,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let r=e;return this.request({method:"elicitation/create",params:r},Mu,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let r=e.mode==="form"?e:{...e,mode:"form"},o=await this.request({method:"elicitation/create",params:r},Mu,t);if(o.action==="accept"&&o.content&&r.requestedSchema)try{let i=this._jsonSchemaValidator.getValidator(r.requestedSchema)(o.content);if(!i.valid)throw new ae(fe.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorMessage}`)}catch(s){if(s instanceof ae)throw s;throw new ae(fe.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return o}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},UO,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging){if(!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var ZY=Symbol.for("mcp.completable");function eI(e){return!!e&&typeof e==="object"&&ZY in e}function YY(e){return e[ZY]?.complete}var VY;(function(e){e.Completable="McpCompletable"})(VY||(VY={}));var A6e=/^[A-Za-z0-9._-]{1,128}$/;function T6e(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" "))t.push("Tool name contains spaces, which may cause parsing issues");if(e.includes(","))t.push("Tool name contains commas, which may cause parsing issues");if(e.startsWith("-")||e.endsWith("-"))t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(e.startsWith(".")||e.endsWith("."))t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!A6e.test(e)){let n=e.split("").filter((r)=>!/[A-Za-z0-9._-]/.test(r)).filter((r,o,s)=>s.indexOf(r)===o);return t.push(`Tool name contains invalid characters: ${n.map((r)=>`"${r}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function C6e(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let n of t)console.warn(` - ${n}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function tI(e){let t=T6e(e);return C6e(e,t.warnings),t.isValid}class nI{constructor(e){this._mcpServer=e}registerToolTask(e,t,n){let r={taskSupport:"required",...t.execution};if(r.taskSupport==="forbidden")throw Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,r,t._meta,n)}}class oI{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new QP(e,t)}get experimental(){if(!this._experimental)this._experimental={tasks:new nI(this)};return this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler($i(vb)),this.server.assertCanSetRequestHandler($i(Lu)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(vb,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:(()=>{let r=Ou(t.inputSchema);return r?BO(r,{strictUnions:!0,pipeStrategy:"input"}):k6e})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let r=Ou(t.outputSchema);if(r)n.outputSchema=BO(r,{strictUnions:!0,pipeStrategy:"output"})}return n})})),this.server.setRequestHandler(Lu,async(e,t)=>{try{let n=this._registeredTools[e.params.name];if(!n)throw new ae(fe.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new ae(fe.InvalidParams,`Tool ${e.params.name} disabled`);let r=!!e.params.task,o=n.execution?.taskSupport,s="createTask"in n.handler;if((o==="required"||o==="optional")&&!s)throw new ae(fe.InternalError,`Tool ${e.params.name} has taskSupport '${o}' but was not registered with registerToolTask`);if(o==="required"&&!r)throw new ae(fe.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(o==="optional"&&!r&&s)return await this.handleAutomaticTaskPolling(n,e,t);let i=await this.validateToolInput(n,e.params.arguments,e.params.name),a=await this.executeToolHandler(n,i,t);if(r)return a;return await this.validateToolOutput(n,a,e.params.name),a}catch(n){if(n instanceof ae){if(n.code===fe.UrlElicitationRequired)throw n}return this.createToolError(n instanceof Error?n.message:String(n))}}),this._toolHandlersInitialized=!0}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,n){if(!e.inputSchema)return;let o=Ou(e.inputSchema)??e.inputSchema,s=await nb(o,t);if(!s.success){let i="error"in s?s.error:"Unknown error",a=rb(i);throw new ae(fe.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${a}`)}return s.data}async validateToolOutput(e,t,n){if(!e.outputSchema)return;if(!("content"in t))return;if(t.isError)return;if(!t.structuredContent)throw new ae(fe.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let r=Ou(e.outputSchema),o=await nb(r,t.structuredContent);if(!o.success){let s="error"in o?o.error:"Unknown error",i=rb(s);throw new ae(fe.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${i}`)}}async executeToolHandler(e,t,n){let r=e.handler;if("createTask"in r){if(!n.taskStore)throw Error("No task store provided.");let s={...n,taskStore:n.taskStore};if(e.inputSchema)return await Promise.resolve(r.createTask(t,s));else return await Promise.resolve(r.createTask(s))}if(e.inputSchema)return await Promise.resolve(r(t,n));else return await Promise.resolve(r(n))}async handleAutomaticTaskPolling(e,t,n){if(!n.taskStore)throw Error("No task store provided for task-capable tool.");let r=await this.validateToolInput(e,t.params.arguments,t.params.name),o=e.handler,s={...n,taskStore:n.taskStore},i=r?await Promise.resolve(o.createTask(r,s)):await Promise.resolve(o.createTask(s)),a=i.task.taskId,c=i.task,l=c.pollInterval??5000;while(c.status!=="completed"&&c.status!=="failed"&&c.status!=="cancelled"){await new Promise((p)=>setTimeout(p,l));let u=await n.taskStore.getTask(a);if(!u)throw new ae(fe.InternalError,`Task ${a} not found during polling`);c=u}return await n.taskStore.getTaskResult(a)}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler($i(Ab)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Ab,async(e)=>{switch(e.params.ref.type){case"ref/prompt":return T6(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return C6(e),this.handleResourceCompletion(e,e.params.ref);default:throw new ae(fe.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(e,t){let n=this._registeredPrompts[t.name];if(!n)throw new ae(fe.InvalidParams,`Prompt ${t.name} not found`);if(!n.enabled)throw new ae(fe.InvalidParams,`Prompt ${t.name} disabled`);if(!n.argsSchema)return Km;let o=Oi(n.argsSchema)?.[e.params.argument.name];if(!eI(o))return Km;let s=YY(o);if(!s)return Km;let i=await s(e.params.argument.value,e.params.context);return XY(i)}async handleResourceCompletion(e,t){let n=Object.values(this._registeredResourceTemplates).find((s)=>s.resourceTemplate.uriTemplate.toString()===t.uri);if(!n){if(this._registeredResources[t.uri])return Km;throw new ae(fe.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let r=n.resourceTemplate.completeCallback(e.params.argument.name);if(!r)return Km;let o=await r(e.params.argument.value,e.params.context);return XY(o)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler($i(yb)),this.server.assertCanSetRequestHandler($i(bb)),this.server.assertCanSetRequestHandler($i(Sb)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(yb,async(e,t)=>{let n=Object.entries(this._registeredResources).filter(([o,s])=>s.enabled).map(([o,s])=>({uri:o,name:s.name,...s.metadata})),r=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let s=await o.resourceTemplate.listCallback(t);for(let i of s.resources)r.push({...o.metadata,...i})}return{resources:[...n,...r]}}),this.server.setRequestHandler(bb,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,n])=>({name:t,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(Sb,async(e,t)=>{let n=new URL(e.params.uri),r=this._registeredResources[n.toString()];if(r){if(!r.enabled)throw new ae(fe.InvalidParams,`Resource ${n} disabled`);return r.readCallback(n,t)}for(let o of Object.values(this._registeredResourceTemplates)){let s=o.resourceTemplate.uriTemplate.match(n.toString());if(s)return o.readCallback(n,s,t)}throw new ae(fe.InvalidParams,`Resource ${n} not found`)}),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler($i(Eb)),this.server.assertCanSetRequestHandler($i(xb)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Eb,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?R6e(t.argsSchema):void 0}))})),this.server.setRequestHandler(xb,async(e,t)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new ae(fe.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new ae(fe.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){let r=Ou(n.argsSchema),o=await nb(r,e.params.arguments);if(!o.success){let a="error"in o?o.error:"Unknown error",c=rb(a);throw new ae(fe.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${c}`)}let s=o.data,i=n.callback;return await Promise.resolve(i(s,t))}else{let r=n.callback;return await Promise.resolve(r(t))}}),this._promptHandlersInitialized=!0}resource(e,t,...n){let r;if(typeof n[0]==="object")r=n.shift();let o=n[0];if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let s=this._createRegisteredResource(e,void 0,t,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,void 0,t,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(e,t,n,r){if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let o=this._createRegisteredResource(e,n.title,t,n,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,n.title,t,n,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,t,n,r,o){let s={name:e,title:t,metadata:r,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:(i)=>{if(typeof i.uri<"u"&&i.uri!==n){if(delete this._registeredResources[n],i.uri)this._registeredResources[i.uri]=s}if(typeof i.name<"u")s.name=i.name;if(typeof i.title<"u")s.title=i.title;if(typeof i.metadata<"u")s.metadata=i.metadata;if(typeof i.callback<"u")s.readCallback=i.callback;if(typeof i.enabled<"u")s.enabled=i.enabled;this.sendResourceListChanged()}};return this._registeredResources[n]=s,s}_createRegisteredResourceTemplate(e,t,n,r,o){let s={resourceTemplate:n,title:t,metadata:r,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:(c)=>{if(typeof c.name<"u"&&c.name!==e){if(delete this._registeredResourceTemplates[e],c.name)this._registeredResourceTemplates[c.name]=s}if(typeof c.title<"u")s.title=c.title;if(typeof c.template<"u")s.resourceTemplate=c.template;if(typeof c.metadata<"u")s.metadata=c.metadata;if(typeof c.callback<"u")s.readCallback=c.callback;if(typeof c.enabled<"u")s.enabled=c.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=s;let i=n.uriTemplate.variableNames;if(Array.isArray(i)&&i.some((c)=>!!n.completeCallback(c)))this.setCompletionRequestHandler();return s}_createRegisteredPrompt(e,t,n,r,o){let s={title:t,description:n,argsSchema:r===void 0?void 0:Ja(r),callback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:(i)=>{if(typeof i.name<"u"&&i.name!==e){if(delete this._registeredPrompts[e],i.name)this._registeredPrompts[i.name]=s}if(typeof i.title<"u")s.title=i.title;if(typeof i.description<"u")s.description=i.description;if(typeof i.argsSchema<"u")s.argsSchema=Ja(i.argsSchema);if(typeof i.callback<"u")s.callback=i.callback;if(typeof i.enabled<"u")s.enabled=i.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=s,r){if(Object.values(r).some((a)=>{let c=a instanceof Er?a._def?.innerType:a;return eI(c)}))this.setCompletionRequestHandler()}return s}_createRegisteredTool(e,t,n,r,o,s,i,a,c){tI(e);let l={title:t,description:n,inputSchema:JY(r),outputSchema:JY(o),annotations:s,execution:i,_meta:a,handler:c,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:(u)=>{if(typeof u.name<"u"&&u.name!==e){if(typeof u.name==="string")tI(u.name);if(delete this._registeredTools[e],u.name)this._registeredTools[u.name]=l}if(typeof u.title<"u")l.title=u.title;if(typeof u.description<"u")l.description=u.description;if(typeof u.paramsSchema<"u")l.inputSchema=Ja(u.paramsSchema);if(typeof u.outputSchema<"u")l.outputSchema=Ja(u.outputSchema);if(typeof u.callback<"u")l.handler=u.callback;if(typeof u.annotations<"u")l.annotations=u.annotations;if(typeof u._meta<"u")l._meta=u._meta;if(typeof u.enabled<"u")l.enabled=u.enabled;this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...t){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let n,r,o,s;if(typeof t[0]==="string")n=t.shift();if(t.length>1){let a=t[0];if(rI(a)){if(r=t.shift(),t.length>1&&typeof t[0]==="object"&&t[0]!==null&&!rI(t[0]))s=t.shift()}else if(typeof a==="object"&&a!==null){if(Object.values(a).some((c)=>typeof c==="object"&&c!==null))throw Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=t.shift()}}let i=t[0];return this._createRegisteredTool(e,void 0,n,r,o,s,{taskSupport:"forbidden"},void 0,i)}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:r,description:o,inputSchema:s,outputSchema:i,annotations:a,_meta:c}=t;return this._createRegisteredTool(e,r,o,s,i,a,{taskSupport:"forbidden"},c,n)}prompt(e,...t){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let n;if(typeof t[0]==="string")n=t.shift();let r;if(t.length>1)r=t.shift();let o=t[0],s=this._createRegisteredPrompt(e,void 0,n,r,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(e,t,n){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:r,description:o,argsSchema:s}=t,i=this._createRegisteredPrompt(e,r,o,s,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var k6e={type:"object",properties:{}};function QY(e){return e!==null&&typeof e==="object"&&"parse"in e&&typeof e.parse==="function"&&"safeParse"in e&&typeof e.safeParse==="function"}function eJ(e){return"_def"in e||"_zod"in e||QY(e)}function rI(e){if(typeof e!=="object"||e===null)return!1;if(eJ(e))return!1;if(Object.keys(e).length===0)return!0;return Object.values(e).some(QY)}function JY(e){if(!e)return;if(rI(e))return Ja(e);if(!eJ(e))throw Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}function R6e(e){let t=Oi(e);if(!t)return[];return Object.entries(t).map(([n,r])=>{let o=l6(r),s=u6(r);return{name:n,description:o,required:!s}})}function $i(e){let n=Oi(e)?.method;if(!n)throw Error("Schema is missing a method literal");let r=ob(n);if(typeof r==="string")return r;throw Error("Schema method literal must be a string")}function XY(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var Km={completion:{values:[],hasMore:!1}};function O6e(e,t,n,r,o){let s={};if(o?.searchHint)s["anthropic/searchHint"]=o.searchHint;if(o?.alwaysLoad)s["anthropic/alwaysLoad"]=!0;return{name:e,description:t,inputSchema:n,handler:r,annotations:o?.annotations,_meta:Object.keys(s).length>0?s:void 0}}function P6e(e){let t=new oI({name:e.name,version:e.version??"1.0.0"},{capabilities:{tools:e.tools?{}:void 0},instructions:e.instructions});if(e.tools)e.tools.forEach((n)=>{for(let r of Object.values(n.inputSchema)){if(!I6e(r))continue;let o=r.description;if(o&&!Br.has(r))Br.add(r,{description:o})}t.registerTool(n.name,{description:n.description,inputSchema:n.inputSchema,annotations:n.annotations,_meta:e.alwaysLoad?{"anthropic/alwaysLoad":!0,...n._meta}:n._meta},n.handler)});return{type:"sdk",name:e.name,instance:t}}function I6e(e){return typeof e==="object"&&e!==null&&"_zod"in e}var tJ=15000,D6e=M(()=>C({session_id:_(),ws_url:_(),work_dir:_().optional(),session_key:_().optional()}));class Io extends Error{code;constructor(e,t){super(e);this.name="DirectConnectError",this.code=t}}class rJ{options;ws;sessionId;workDir;abortController;readyState=!1;closed=!1;exitError;messages=new Lf;readyPromise;readyResolve;readyReject;abortHandler;partialChunks=[];telemetryEmitted=!1;constructor(e){this.options=e;this.abortController=e.abortController??new AbortController,this.readyPromise=new Promise((t,n)=>{this.readyResolve=t,this.readyReject=n}),this.readyPromise.catch(()=>{}),this.initialize()}get ready(){return this.readyPromise}getSessionId(){return this.sessionId}getWorkDir(){return this.workDir}async initialize(){if(this.abortController.signal.aborted){this.failInit(new dr("Connection aborted"));return}this.abortHandler=()=>{this.close(),this.exitError=new dr("Connection aborted by user")},this.abortController.signal.addEventListener("abort",this.abortHandler);let e;try{let o=await M6e(this.options);this.sessionId=o.sessionId,this.workDir=o.workDir,e=o.wsUrl}catch(o){let s=Ur(o);if(!(s instanceof dr)){let i=s instanceof Io&&s.code?s.code:"session_create_failed";this.emitTelemetry("bad",i)}this.failInit(s);return}if(this.closed){if(this.options.deleteSessionOnClose&&this.sessionId)nJ(this.options.serverUrl,this.sessionId,this.options.authToken);return}let t={};if(this.options.authToken)t.authorization=`Bearer ${this.options.authToken}`;let n=new WebSocket(e,{headers:t});this.ws=n;let r=setTimeout((o,s)=>{if(!o.readyState){s.close();let i=new Io(`WebSocket connection timeout after ${tJ}ms`);o.exitError=i,o.readyReject?.(i),o.emitTelemetry("bad","connect_timeout")}},tJ,this,n);n.addEventListener("open",()=>{clearTimeout(r),this.readyState=!0,_n(`[DirectConnectTransport] Connected to ${this.options.serverUrl}, session=${this.sessionId}`),this.readyResolve?.(),this.emitTelemetry("ok")}),n.addEventListener("message",(o)=>{let s=typeof o.data==="string"?o.data:"";if(s.indexOf(`
148
- `)===-1){if(s)this.partialChunks.push(s);return}let i=this.partialChunks.join("")+s;this.partialChunks.length=0;let a=i.split(`
149
- `),c=a.pop()??"";if(c)this.partialChunks.push(c);for(let l of a){if(!l)continue;let u;try{u=yt(l)}catch(p){_n(`DirectConnect: dropped malformed JSON line (${l.length} bytes): ${p}`);continue}this.messages.enqueue(u)}}),n.addEventListener("error",()=>{clearTimeout(r);let o=new Io("WebSocket connection error");if(this.exitError=o,this.readyReject?.(o),this.messages.done(),!this.readyState)this.emitTelemetry("bad","ws_error")}),n.addEventListener("close",(o)=>{let s=this.readyState;this.readyState=!1,this.closed=!0;let i=o.code!==1000&&o.code!==1001;if(i&&!this.exitError)this.exitError=new Io(`WebSocket closed abnormally: ${o.code} ${o.reason}`);if(this.messages.done(),s&&i&&!this.abortController.signal.aborted)this.emitTelemetry("sad","ws_closed_abnormally")})}emitTelemetry(e,t){if(this.telemetryEmitted)return;if(this.telemetryEmitted=!0,e==="ok")VT("transport_direct_connect");else if(e==="bad")ZT("transport_direct_connect",t??"unknown");else y2("transport_direct_connect",t??"unknown")}failInit(e){this.exitError=e,this.closed=!0,this.readyReject?.(e),this.messages.done()}async write(e){if(this.abortController.signal.aborted)throw new dr("Operation aborted");if(!this.readyState)await this.readyPromise;if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Io("Transport is not ready for writing");this.ws.send(e)}isReady(){return this.readyState&&this.ws?.readyState===WebSocket.OPEN}endInput(){}[Symbol.dispose](){this.close()}close(){if(this.closed)return;if(this.closed=!0,this.readyState=!1,this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;if(!this.abortController.signal.aborted)this.abortController.abort();if(this.ws&&this.ws.readyState===WebSocket.OPEN)this.ws.close(1000,"Normal closure");if(this.messages.done(),this.options.deleteSessionOnClose&&this.sessionId)nJ(this.options.serverUrl,this.sessionId,this.options.authToken)}async*readMessages(){if(yield*this.messages,this.exitError)throw this.exitError}}function L6e(e){if(e.startsWith("cc://")){let r=e.slice(5),o=new URL(`http://${r}`),s=o.pathname.slice(1)||void 0;return{serverUrl:`http://${o.host}`,authToken:s}}if(e.startsWith("cc+unix://"))throw new Io("Unix socket connect (cc+unix://) is not supported by the SDK transport");let t=/^https?:\/\//i.test(e)?e:`http://${e}`,n=new URL(t);return{serverUrl:`${n.protocol}//${n.host}`,authToken:void 0}}async function M6e(e){let t={"content-type":"application/json"};if(e.authToken)t.authorization=`Bearer ${e.authToken}`;let n={};if(e.cwd)n.cwd=e.cwd;if(e.sessionKey)n.session_key=e.sessionKey;if(e.permissionMode)n.permission_mode=e.permissionMode;let r;try{r=await fetch(`${e.serverUrl}/sessions`,{method:"POST",headers:t,body:me(n)})}catch(s){throw new Io(`Failed to connect to server at ${e.serverUrl}: ${s instanceof Error?s.message:String(s)}`,"session_create_failed")}if(!r.ok){let s=await r.text().catch(()=>"");throw new Io(`Failed to create session: ${r.status} ${r.statusText}${s?` — ${s}`:""}`,"session_create_failed")}let o=D6e().safeParse(await r.json());if(!o.success)throw new Io(`Invalid session response: ${o.error.message}`,"session_create_invalid_response");return{sessionId:o.data.session_id,wsUrl:o.data.ws_url,workDir:o.data.work_dir}}async function nJ(e,t,n){let r={};if(n)r.authorization=`Bearer ${n}`;try{await fetch(`${e}/sessions/${t}`,{method:"DELETE",headers:r})}catch{}}import{resolve as E8e}from"path";import{join as dd}from"path";import{dirname as N6e}from"path";function sJ(){}async function U6e(e,t){let n=Qe();try{await n.appendFile(e,t)}catch{await n.mkdir(N6e(e)).catch(sJ),await n.appendFile(e,t)}}class iJ{pendingWrite=Promise.resolve();cleanupRegistered=!1;append(e,t){if(this.pendingWrite=this.pendingWrite.then(U6e.bind(null,e,t)).catch(sJ),!this.cleanupRegistered)this.cleanupRegistered=!0,i_(()=>this.flush())}flush(){return this.pendingWrite}}var F6e=new tt(()=>new iJ);function j6e(){return F6e.of(Tt().host)}function Gm(e,t,n){let r=z6e();if(!r)return;let o;try{o=oJ(e,t,$6e(n))}catch{o=oJ(e,t,{diagnostics_payload_failed:!0})}j6e().append(r,o)}function $6e(e){try{return(typeof e==="function"?e():e)??{}}catch{return{diagnostics_payload_failed:!0}}}function oJ(e,t,n){let r={timestamp:new Date().toISOString(),level:e,event:t,data:n};return me(r)+`
150
- `}function z6e(){return Mn.CLAUDE_CODE_DIAGNOSTICS_FILE}function aJ(e,t,n){let r=e.statSync(t);if(r.isDirectory())throw Object.assign(Error("EISDIR: illegal operation on a directory, read"),{code:"EISDIR",errno:-21,syscall:"read",path:t});if(!r.isFile())throw Object.assign(Error("Not a regular file (device, FIFO, or socket)"),{code:"ERR_NOT_REGULAR_FILE",path:t});if(n!==void 0&&r.size>n)throw Object.assign(Error("File exceeds maxBytes limit"),{code:"ERR_FILE_TOO_LARGE",path:t,size:r.size,maxBytes:n})}function H6e(e){if(e.byteLength===0)return"utf8";if(e.byteLength>=2){if(e[0]===255&&e[1]===254)return"utf16le"}if(e.byteLength>=3&&e[0]===239&&e[1]===187&&e[2]===191)return"utf8";return"utf8"}function cJ(e){let{buffer:t,bytesRead:n}=Qe().readSync(e,{length:4096});return H6e(t.subarray(0,n))}function lJ(e){let t=0,n=0;for(let r=0;r<e.length;r++)if(e[r]===`
151
- `)if(r>0&&e[r-1]==="\r")t++;else n++;return t>n?"CRLF":"LF"}function B6e(e,t){let n=Qe(),{resolvedPath:r,isSymlink:o}=tf(n,e);if(o)de(`Reading through symlink: ${e} -> ${r}`);aJ(n,r,t);let s=cJ(r),i=n.readFileSync(r,{encoding:s}),a=lJ(i.slice(0,4096));return{content:i.replaceAll(`\r
152
- `,`
153
- `),encoding:s,lineEndings:a}}function sc(e,t){return B6e(e,t).content}async function uJ(e,t){let n=Qe(),{resolvedPath:r,isSymlink:o}=tf(n,e);if(o)de(`Reading through symlink: ${e} -> ${r}`);aJ(n,r,t);let s=cJ(r),i=await n.readFile(r,{encoding:s}),a=lJ(i.slice(0,4096));return{content:i.replaceAll(`\r
154
- `,`
155
- `),encoding:s,lineEndings:a}}var dJ;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(dJ||(dJ={}));var G6e=Array(20).fill(0).map((e,t)=>" ".repeat(t));var W6e={" ":{"\n":Array(200).fill(0).map((e,t)=>`
156
- `+" ".repeat(t)),"\r":Array(200).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":Array(200).fill(0).map((e,t)=>`\r
157
- `+" ".repeat(t))},"\t":{"\n":Array(200).fill(0).map((e,t)=>`
158
- `+"\t".repeat(t)),"\r":Array(200).fill(0).map((e,t)=>"\r"+"\t".repeat(t)),"\r\n":Array(200).fill(0).map((e,t)=>`\r
159
- `+"\t".repeat(t))}};var fJ;(function(e){e.DEFAULT={allowTrailingComma:!1}})(fJ||(fJ={}));var mJ;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(mJ||(mJ={}));var hJ;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(hJ||(hJ={}));var gJ;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(gJ||(gJ={}));var Zu=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,yJ=new Set,sI=typeof process==="object"&&!!process?process:{},bJ=(e,t,n,r)=>{typeof sI.emitWarning==="function"?sI.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},pS=globalThis.AbortController,_J=globalThis.AbortSignal;if(typeof pS>"u"){_J=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(r,o){this._onabort.push(o)}},pS=class{constructor(){t()}signal=new _J;abort(r){if(this.signal.aborted)return;this.signal.reason=r,this.signal.aborted=!0;for(let o of this.signal._onabort)o(r);this.signal.onabort?.(r)}};let e=sI.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{if(!e)return;e=!1,bJ("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t)}}var Q6e=(e)=>!yJ.has(e),PUt=Symbol("type"),zi=(e)=>e&&e===Math.floor(e)&&e>0&&isFinite(e),SJ=(e)=>!zi(e)?null:e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Wm:null;class Wm extends Array{constructor(e){super(e);this.fill(0)}}class Yu{heap;length;static#e=!1;static create(e){let t=SJ(e);if(!t)return[];Yu.#e=!0;let n=new Yu(e,t);return Yu.#e=!1,n}constructor(e,t){if(!Yu.#e)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class fS{#e;#t;#n;#r;#i;#c;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#o;#l;#u;#a;#s;#p;#d;#f;#m;#E;#h;#y;#b;#_;#x;#v;#S;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#_,sizes:e.#y,keyMap:e.#u,keyList:e.#a,valList:e.#s,next:e.#p,prev:e.#d,get head(){return e.#f},get tail(){return e.#m},free:e.#E,isBackgroundFetch:(t)=>e.#g(t),backgroundFetch:(t,n,r,o)=>e.#U(t,n,r,o),moveToTail:(t)=>e.#L(t),indexes:(t)=>e.#C(t),rindexes:(t)=>e.#k(t),isStale:(t)=>e.#w(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#l}get size(){return this.#o}get fetchMethod(){return this.#i}get memoMethod(){return this.#c}get dispose(){return this.#n}get disposeAfter(){return this.#r}constructor(e){let{max:t=0,ttl:n,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:i,allowStale:a,dispose:c,disposeAfter:l,noDisposeOnSet:u,noUpdateTTL:p,maxSize:f=0,maxEntrySize:m=0,sizeCalculation:h,fetchMethod:g,memoMethod:y,noDeleteOnFetchRejection:S,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:v,ignoreFetchAbort:A}=e;if(t!==0&&!zi(t))throw TypeError("max option must be a nonnegative integer");let U=t?SJ(t):Array;if(!U)throw Error("invalid max value: "+t);if(this.#e=t,this.#t=f,this.maxEntrySize=m||this.#t,this.sizeCalculation=h,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!=="function")throw TypeError("memoMethod must be a function if defined");if(this.#c=y,g!==void 0&&typeof g!=="function")throw TypeError("fetchMethod must be a function if specified");if(this.#i=g,this.#v=!!g,this.#u=new Map,this.#a=Array(t).fill(void 0),this.#s=Array(t).fill(void 0),this.#p=new U(t),this.#d=new U(t),this.#f=0,this.#m=0,this.#E=Yu.create(t),this.#o=0,this.#l=0,typeof c==="function")this.#n=c;if(typeof l==="function")this.#r=l,this.#h=[];else this.#r=void 0,this.#h=void 0;if(this.#x=!!this.#n,this.#S=!!this.#r,this.noDisposeOnSet=!!u,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!S,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!v,this.ignoreFetchAbort=!!A,this.maxEntrySize!==0){if(this.#t!==0){if(!zi(this.#t))throw TypeError("maxSize must be a positive integer if specified")}if(!zi(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#I()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!i,this.ttlResolution=zi(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=n||0,this.ttl){if(!zi(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#O()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){if(Q6e("LRU_CACHE_UNBOUNDED"))yJ.add("LRU_CACHE_UNBOUNDED"),bJ("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",fS)}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#O(){let e=new Wm(this.#e),t=new Wm(this.#e);this.#_=e,this.#b=t,this.#P=(o,s,i=Zu.now())=>{if(t[o]=s!==0?i:0,e[o]=s,s!==0&&this.ttlAutopurge){let a=setTimeout(()=>{if(this.#w(o))this.#R(this.#a[o],"expire")},s+1);if(a.unref)a.unref()}},this.#T=(o)=>{t[o]=e[o]!==0?Zu.now():0},this.#A=(o,s)=>{if(e[s]){let i=e[s],a=t[s];if(!i||!a)return;o.ttl=i,o.start=a,o.now=n||r();let c=o.now-a;o.remainingTTL=i-c}};let n=0,r=()=>{let o=Zu.now();if(this.ttlResolution>0){n=o;let s=setTimeout(()=>n=0,this.ttlResolution);if(s.unref)s.unref()}return o};this.getRemainingTTL=(o)=>{let s=this.#u.get(o);if(s===void 0)return 0;let i=e[s],a=t[s];if(!i||!a)return 1/0;let c=(n||r())-a;return i-c},this.#w=(o)=>{let s=t[o],i=e[o];return!!i&&!!s&&(n||r())-s>i}}#T=()=>{};#A=()=>{};#P=()=>{};#w=()=>!1;#I(){let e=new Wm(this.#e);this.#l=0,this.#y=e,this.#D=(t)=>{this.#l-=e[t],e[t]=0},this.#F=(t,n,r,o)=>{if(this.#g(n))return 0;if(!zi(r))if(o){if(typeof o!=="function")throw TypeError("sizeCalculation must be a function");if(r=o(n,t),!zi(r))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r},this.#M=(t,n,r)=>{if(e[t]=n,this.#t){let o=this.#t-e[t];while(this.#l>o)this.#N(!0)}if(this.#l+=e[t],r)r.entrySize=n,r.totalCalculatedSize=this.#l}}#D=(e)=>{};#M=(e,t,n)=>{};#F=(e,t,n,r)=>{if(n||r)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#C({allowStale:e=this.allowStale}={}){if(this.#o)for(let t=this.#m;;){if(!this.#j(t))break;if(e||!this.#w(t))yield t;if(t===this.#f)break;else t=this.#d[t]}}*#k({allowStale:e=this.allowStale}={}){if(this.#o)for(let t=this.#f;;){if(!this.#j(t))break;if(e||!this.#w(t))yield t;if(t===this.#m)break;else t=this.#p[t]}}#j(e){return e!==void 0&&this.#u.get(this.#a[e])===e}*entries(){for(let e of this.#C())if(this.#s[e]!==void 0&&this.#a[e]!==void 0&&!this.#g(this.#s[e]))yield[this.#a[e],this.#s[e]]}*rentries(){for(let e of this.#k())if(this.#s[e]!==void 0&&this.#a[e]!==void 0&&!this.#g(this.#s[e]))yield[this.#a[e],this.#s[e]]}*keys(){for(let e of this.#C()){let t=this.#a[e];if(t!==void 0&&!this.#g(this.#s[e]))yield t}}*rkeys(){for(let e of this.#k()){let t=this.#a[e];if(t!==void 0&&!this.#g(this.#s[e]))yield t}}*values(){for(let e of this.#C())if(this.#s[e]!==void 0&&!this.#g(this.#s[e]))yield this.#s[e]}*rvalues(){for(let e of this.#k())if(this.#s[e]!==void 0&&!this.#g(this.#s[e]))yield this.#s[e]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let n of this.#C()){let r=this.#s[n],o=this.#g(r)?r.__staleWhileFetching:r;if(o===void 0)continue;if(e(o,this.#a[n],this))return this.get(this.#a[n],t)}}forEach(e,t=this){for(let n of this.#C()){let r=this.#s[n],o=this.#g(r)?r.__staleWhileFetching:r;if(o===void 0)continue;e.call(t,o,this.#a[n],this)}}rforEach(e,t=this){for(let n of this.#k()){let r=this.#s[n],o=this.#g(r)?r.__staleWhileFetching:r;if(o===void 0)continue;e.call(t,o,this.#a[n],this)}}purgeStale(){let e=!1;for(let t of this.#k({allowStale:!0}))if(this.#w(t))this.#R(this.#a[t],"expire"),e=!0;return e}info(e){let t=this.#u.get(e);if(t===void 0)return;let n=this.#s[t],r=this.#g(n)?n.__staleWhileFetching:n;if(r===void 0)return;let o={value:r};if(this.#_&&this.#b){let s=this.#_[t],i=this.#b[t];if(s&&i){let a=s-(Zu.now()-i);o.ttl=a,o.start=Date.now()}}if(this.#y)o.size=this.#y[t];return o}dump(){let e=[];for(let t of this.#C({allowStale:!0})){let n=this.#a[t],r=this.#s[t],o=this.#g(r)?r.__staleWhileFetching:r;if(o===void 0||n===void 0)continue;let s={value:o};if(this.#_&&this.#b){s.ttl=this.#_[t];let i=Zu.now()-this.#b[t];s.start=Math.floor(Date.now()-i)}if(this.#y)s.size=this.#y[t];e.unshift([n,s])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let r=Date.now()-n.start;n.start=Zu.now()-r}this.set(t,n.value,n)}}set(e,t,n={}){if(t===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:i=this.sizeCalculation,status:a}=n,{noUpdateTTL:c=this.noUpdateTTL}=n,l=this.#F(e,t,n.size||0,i);if(this.maxEntrySize&&l>this.maxEntrySize){if(a)a.set="miss",a.maxEntrySizeExceeded=!0;return this.#R(e,"set"),this}let u=this.#o===0?void 0:this.#u.get(e);if(u===void 0){if(u=this.#o===0?this.#m:this.#E.length!==0?this.#E.pop():this.#o===this.#e?this.#N(!1):this.#o,this.#a[u]=e,this.#s[u]=t,this.#u.set(e,u),this.#p[this.#m]=u,this.#d[u]=this.#m,this.#m=u,this.#o++,this.#M(u,l,a),a)a.set="add";c=!1}else{this.#L(u);let p=this.#s[u];if(t!==p){if(this.#v&&this.#g(p)){p.__abortController.abort(Error("replaced"));let{__staleWhileFetching:f}=p;if(f!==void 0&&!s){if(this.#x)this.#n?.(f,e,"set");if(this.#S)this.#h?.push([f,e,"set"])}}else if(!s){if(this.#x)this.#n?.(p,e,"set");if(this.#S)this.#h?.push([p,e,"set"])}if(this.#D(u),this.#M(u,l,a),this.#s[u]=t,a){a.set="replace";let f=p&&this.#g(p)?p.__staleWhileFetching:p;if(f!==void 0)a.oldValue=f}}else if(a)a.set="update"}if(r!==0&&!this.#_)this.#O();if(this.#_){if(!c)this.#P(u,r,o);if(a)this.#A(a,u)}if(!s&&this.#S&&this.#h){let p=this.#h,f;while(f=p?.shift())this.#r?.(...f)}return this}pop(){try{while(this.#o){let e=this.#s[this.#f];if(this.#N(!0),this.#g(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#S&&this.#h){let e=this.#h,t;while(t=e?.shift())this.#r?.(...t)}}}#N(e){let t=this.#f,n=this.#a[t],r=this.#s[t];if(this.#v&&this.#g(r))r.__abortController.abort(Error("evicted"));else if(this.#x||this.#S){if(this.#x)this.#n?.(r,n,"evict");if(this.#S)this.#h?.push([r,n,"evict"])}if(this.#D(t),e)this.#a[t]=void 0,this.#s[t]=void 0,this.#E.push(t);if(this.#o===1)this.#f=this.#m=0,this.#E.length=0;else this.#f=this.#p[t];return this.#u.delete(n),this.#o--,t}has(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,o=this.#u.get(e);if(o!==void 0){let s=this.#s[o];if(this.#g(s)&&s.__staleWhileFetching===void 0)return!1;if(!this.#w(o)){if(n)this.#T(o);if(r)r.has="hit",this.#A(r,o);return!0}else if(r)r.has="stale",this.#A(r,o)}else if(r)r.has="miss";return!1}peek(e,t={}){let{allowStale:n=this.allowStale}=t,r=this.#u.get(e);if(r===void 0||!n&&this.#w(r))return;let o=this.#s[r];return this.#g(o)?o.__staleWhileFetching:o}#U(e,t,n,r){let o=t===void 0?void 0:this.#s[t];if(this.#g(o))return o;let s=new pS,{signal:i}=n;i?.addEventListener("abort",()=>s.abort(i.reason),{signal:s.signal});let a={signal:s.signal,options:n,context:r},c=(h,g=!1)=>{let{aborted:y}=s.signal,S=n.ignoreFetchAbort&&h!==void 0;if(n.status)if(y&&!g){if(n.status.fetchAborted=!0,n.status.fetchError=s.signal.reason,S)n.status.fetchAbortIgnored=!0}else n.status.fetchResolved=!0;if(y&&!S&&!g)return u(s.signal.reason);let b=f;if(this.#s[t]===f)if(h===void 0)if(b.__staleWhileFetching)this.#s[t]=b.__staleWhileFetching;else this.#R(e,"fetch");else{if(n.status)n.status.fetchUpdated=!0;this.set(e,h,a.options)}return h},l=(h)=>{if(n.status)n.status.fetchRejected=!0,n.status.fetchError=h;return u(h)},u=(h)=>{let{aborted:g}=s.signal,y=g&&n.allowStaleOnFetchAbort,S=y||n.allowStaleOnFetchRejection,b=S||n.noDeleteOnFetchRejection,x=f;if(this.#s[t]===f){if(!b||x.__staleWhileFetching===void 0)this.#R(e,"fetch");else if(!y)this.#s[t]=x.__staleWhileFetching}if(S){if(n.status&&x.__staleWhileFetching!==void 0)n.status.returnedStale=!0;return x.__staleWhileFetching}else if(x.__returned===x)throw h},p=(h,g)=>{let y=this.#i?.(e,o,a);if(y&&y instanceof Promise)y.then((S)=>h(S===void 0?void 0:S),g);s.signal.addEventListener("abort",()=>{if(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort){if(h(void 0),n.allowStaleOnFetchAbort)h=(S)=>c(S,!0)}})};if(n.status)n.status.fetchDispatched=!0;let f=new Promise(p).then(c,l),m=Object.assign(f,{__abortController:s,__staleWhileFetching:o,__returned:void 0});if(t===void 0)this.set(e,m,{...a.options,status:void 0}),t=this.#u.get(e);else this.#s[t]=m;return m}#g(e){if(!this.#v)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof pS}async fetch(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:i=this.noDisposeOnSet,size:a=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:h,forceRefresh:g=!1,status:y,signal:S}=t;if(!this.#v){if(y)y.fetch="get";return this.get(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:y})}let b={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:i,size:a,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:m,ignoreFetchAbort:f,status:y,signal:S},x=this.#u.get(e);if(x===void 0){if(y)y.fetch="miss";let v=this.#U(e,x,b,h);return v.__returned=v}else{let v=this.#s[x];if(this.#g(v)){let K=n&&v.__staleWhileFetching!==void 0;if(y){if(y.fetch="inflight",K)y.returnedStale=!0}return K?v.__staleWhileFetching:v.__returned=v}let A=this.#w(x);if(!g&&!A){if(y)y.fetch="hit";if(this.#L(x),r)this.#T(x);if(y)this.#A(y,x);return v}let U=this.#U(e,x,b,h),F=U.__staleWhileFetching!==void 0&&n;if(y){if(y.fetch=A?"stale":"refresh",F&&A)y.returnedStale=!0}return F?U.__staleWhileFetching:U.__returned=U}}async forceFetch(e,t={}){let n=await this.fetch(e,t);if(n===void 0)throw Error("fetch() returned undefined");return n}memo(e,t={}){let n=this.#c;if(!n)throw Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...s}=t,i=this.get(e,s);if(!o&&i!==void 0)return i;let a=n(e,i,{options:s,context:r});return this.set(e,a,s),a}get(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=t,i=this.#u.get(e);if(i!==void 0){let a=this.#s[i],c=this.#g(a);if(s)this.#A(s,i);if(this.#w(i)){if(s)s.get="stale";if(!c){if(!o)this.#R(e,"expire");if(s&&n)s.returnedStale=!0;return n?a:void 0}else{if(s&&n&&a.__staleWhileFetching!==void 0)s.returnedStale=!0;return n?a.__staleWhileFetching:void 0}}else{if(s)s.get="hit";if(c)return a.__staleWhileFetching;if(this.#L(i),r)this.#T(i);return a}}else if(s)s.get="miss"}#$(e,t){this.#d[t]=e,this.#p[e]=t}#L(e){if(e!==this.#m){if(e===this.#f)this.#f=this.#p[e];else this.#$(this.#d[e],this.#p[e]);this.#$(this.#m,e),this.#m=e}}delete(e){return this.#R(e,"delete")}#R(e,t){let n=!1;if(this.#o!==0){let r=this.#u.get(e);if(r!==void 0)if(n=!0,this.#o===1)this.#z(t);else{this.#D(r);let o=this.#s[r];if(this.#g(o))o.__abortController.abort(Error("deleted"));else if(this.#x||this.#S){if(this.#x)this.#n?.(o,e,t);if(this.#S)this.#h?.push([o,e,t])}if(this.#u.delete(e),this.#a[r]=void 0,this.#s[r]=void 0,r===this.#m)this.#m=this.#d[r];else if(r===this.#f)this.#f=this.#p[r];else{let s=this.#d[r];this.#p[s]=this.#p[r];let i=this.#p[r];this.#d[i]=this.#d[r]}this.#o--,this.#E.push(r)}}if(this.#S&&this.#h?.length){let r=this.#h,o;while(o=r?.shift())this.#r?.(...o)}return n}clear(){return this.#z("delete")}#z(e){for(let t of this.#k({allowStale:!0})){let n=this.#s[t];if(this.#g(n))n.__abortController.abort(Error("deleted"));else{let r=this.#a[t];if(this.#x)this.#n?.(n,r,e);if(this.#S)this.#h?.push([n,r,e])}}if(this.#u.clear(),this.#s.fill(void 0),this.#a.fill(void 0),this.#_&&this.#b)this.#_.fill(0),this.#b.fill(0);if(this.#y)this.#y.fill(0);if(this.#f=0,this.#m=0,this.#E.length=0,this.#l=0,this.#o=0,this.#S&&this.#h){let t=this.#h,n;while(n=t?.shift())this.#r?.(...n)}}}function EJ(e,t,n=100){let r=new fS({max:n}),o=(...s)=>{let i=t(...s),a=r.get(i);if(a!==void 0)return a;let c=e(...s);return r.set(i,c),c};return o.cache={clear:()=>r.clear(),size:()=>r.size,delete:(s)=>r.delete(s),get:(s)=>r.peek(s),has:(s)=>r.has(s),set:(s,i)=>void r.set(s,i)},o}var e3e=8192;function vJ(e,t){try{return{ok:!0,value:JSON.parse(_u(e))}}catch(n){if(t)a_(CN(n,`safeParseJSON: invalid JSON (${n instanceof Error?n.constructor.name:typeof n}, ${e.length} bytes)`));return{ok:!1}}}class wJ{cached=EJ(vJ,(e)=>e,50);cache=this.cached.cache;parse(e,t){return this.cached(e,t)}}var xJ=new wJ;var ic=Object.assign(function(t,n=!0){if(!t)return null;let r=t.length>e3e?vJ(t,n):xJ.parse(t,n);return r.ok?r.value:null},{cache:xJ.cache});import{join as t3e}from"path";class AJ{managedFilePath=void 0;dropInDir=void 0;getManagedFilePath(){return this.managedFilePath??=r3e(),this.managedFilePath}getDropInDir(){return this.dropInDir??=t3e(ac(),"managed-settings.d"),this.dropInDir}clearDropInDir(){this.dropInDir=void 0}reset(){this.managedFilePath=void 0,this.dropInDir=void 0}}var n3e=new AJ;function ac(){return n3e.getManagedFilePath()}function r3e(){let e=o3e();if(e!==void 0)return e;switch(jr()){case"macos":return"/Library/Application Support/ClaudeCode";case"windows":return"C:\\Program Files\\ClaudeCode";default:return"/etc/claude-code"}}function o3e(){return}function s3e(e,t,n){if(n!==void 0&&!Mo(e[t],n)||n===void 0&&!(t in e))ii(e,t,n)}var qm=s3e;var hS={};rn(hS,{default:()=>Vm});var RJ=typeof hS=="object"&&hS&&!hS.nodeType&&hS,TJ=RJ&&typeof mS=="object"&&mS&&!mS.nodeType&&mS,i3e=TJ&&TJ.exports===RJ,CJ=i3e?Kt.Buffer:void 0,kJ=CJ?CJ.allocUnsafe:void 0;function a3e(e,t){if(t)return e.slice();var n=e.length,r=kJ?kJ(n):new e.constructor(n);return e.copy(r),r}var Vm=a3e;function c3e(e){var t=new e.constructor(e.byteLength);return new sl(t).set(new sl(e)),t}var Ju=c3e;function l3e(e,t){var n=t?Ju(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var gS=l3e;function u3e(e,t){var n=-1,r=e.length;t||(t=Array(r));while(++n<r)t[n]=e[n];return t}var _S=u3e;var OJ=Object.create,d3e=function(){function e(){}return function(t){if(!zt(t))return{};if(OJ)return OJ(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),PJ=d3e;var p3e=$g(Object.getPrototypeOf,Object),Xu=p3e;function f3e(e){return typeof e.constructor=="function"&&!dl(e)?PJ(Xu(e)):{}}var yS=f3e;function m3e(e){return Xt(e)&&si(e)}var IJ=m3e;var h3e="[object Object]",g3e=Function.prototype,_3e=Object.prototype,DJ=g3e.toString,y3e=_3e.hasOwnProperty,b3e=DJ.call(Object);function S3e(e){if(!Xt(e)||pr(e)!=h3e)return!1;var t=Xu(e);if(t===null)return!0;var n=y3e.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&DJ.call(n)==b3e}var bS=S3e;function E3e(e,t){if(t==="constructor"&&typeof e[t]==="function")return;if(t=="__proto__")return;return e[t]}var Zm=E3e;var x3e=Object.prototype,v3e=x3e.hasOwnProperty;function w3e(e,t,n){var r=e[t];if(!(v3e.call(e,t)&&Mo(r,n))||n===void 0&&!(t in e))ii(e,t,n)}var Qu=w3e;function A3e(e,t,n,r){var o=!n;n||(n={});var s=-1,i=t.length;while(++s<i){var a=t[s],c=r?r(n[a],e[a],a,n,e):void 0;if(c===void 0)c=e[a];if(o)ii(n,a,c);else Qu(n,a,c)}return n}var Yr=A3e;function T3e(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var LJ=T3e;var C3e=Object.prototype,k3e=C3e.hasOwnProperty;function R3e(e){if(!zt(e))return LJ(e);var t=dl(e),n=[];for(var r in e)if(!(r=="constructor"&&(t||!k3e.call(e,r))))n.push(r);return n}var MJ=R3e;function O3e(e){return si(e)?jg(e,!0):MJ(e)}var rs=O3e;function P3e(e){return Yr(e,rs(e))}var NJ=P3e;function I3e(e,t,n,r,o,s,i){var a=Zm(e,n),c=Zm(t,n),l=i.get(c);if(l){qm(e,n,l);return}var u=s?s(a,c,n+"",e,t,i):void 0,p=u===void 0;if(p){var f=_t(c),m=!f&&Ko(c),h=!f&&!m&&ul(c);if(u=c,f||m||h)if(_t(a))u=a;else if(IJ(a))u=_S(a);else if(m)p=!1,u=Vm(c,!0);else if(h)p=!1,u=gS(c,!0);else u=[];else if(bS(c)||hs(c)){if(u=a,hs(a))u=NJ(a);else if(!zt(a)||Ec(a))u=yS(c)}else p=!1}if(p)i.set(c,u),o(u,c,r,s,i),i.delete(c);qm(e,n,u)}var UJ=I3e;function FJ(e,t,n,r,o){if(e===t)return;qg(t,function(s,i){if(o||(o=new Bo),zt(s))UJ(e,t,i,n,FJ,r,o);else{var a=r?r(Zm(e,i),s,i+"",e,t,o):void 0;if(a===void 0)a=s;qm(e,i,a)}},rs)}var jJ=FJ;function D3e(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var $J=D3e;var zJ=Math.max;function L3e(e,t,n){return t=zJ(t===void 0?e.length-1:t,0),function(){var r=arguments,o=-1,s=zJ(r.length-t,0),i=Array(s);while(++o<s)i[o]=r[t+o];o=-1;var a=Array(t+1);while(++o<t)a[o]=r[o];return a[t]=n(i),$J(e,this,a)}}var SS=L3e;function M3e(e){return function(){return e}}var HJ=M3e;var N3e=!ml?yl:function(e,t){return ml(e,"toString",{configurable:!0,enumerable:!1,value:HJ(t),writable:!0})},BJ=N3e;var U3e=800,F3e=16,j3e=Date.now;function $3e(e){var t=0,n=0;return function(){var r=j3e(),o=F3e-(r-n);if(n=r,o>0){if(++t>=U3e)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var KJ=$3e;var z3e=KJ(BJ),ES=z3e;function H3e(e,t){return ES(SS(e,t,yl),e+"")}var GJ=H3e;function B3e(e,t,n){if(!zt(n))return!1;var r=typeof t;if(r=="number"?si(n)&&oi(t,n.length):r=="string"&&(t in n))return Mo(n[t],e);return!1}var WJ=B3e;function K3e(e){return GJ(function(t,n){var r=-1,o=n.length,s=o>1?n[o-1]:void 0,i=o>2?n[2]:void 0;if(s=e.length>3&&typeof s=="function"?(o--,s):void 0,i&&WJ(n[0],n[1],i))s=o<3?void 0:s,o=1;t=Object(t);while(++r<o){var a=n[r];if(a)e(t,a,r,s)}return t})}var qJ=K3e;var G3e=qJ(function(e,t,n,r){jJ(e,t,n,r)}),zn=G3e;function W3e(e,t){var n=-1,r=e==null?0:e.length;while(++n<r)if(t(e[n],n,e)===!1)break;return e}var VJ=W3e;function q3e(e,t){return e&&Yr(t,Wo(t),e)}var ZJ=q3e;function V3e(e,t){return e&&Yr(t,rs(t),e)}var YJ=V3e;function Z3e(e,t){return Yr(e,al(e),t)}var JJ=Z3e;var Y3e=Object.getOwnPropertySymbols,J3e=!Y3e?Lg:function(e){var t=[];while(e)il(t,al(e)),e=Xu(e);return t},xS=J3e;function X3e(e,t){return Yr(e,xS(e),t)}var XJ=X3e;function Q3e(e){return Dg(e,rs,xS)}var ed=Q3e;var e9e=Object.prototype,t9e=e9e.hasOwnProperty;function n9e(e){var t=e.length,n=new e.constructor(t);if(t&&typeof e[0]=="string"&&t9e.call(e,"index"))n.index=e.index,n.input=e.input;return n}var QJ=n9e;function r9e(e,t){var n=t?Ju(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var e8=r9e;var o9e=/\w*$/;function s9e(e){var t=new e.constructor(e.source,o9e.exec(e));return t.lastIndex=e.lastIndex,t}var t8=s9e;var n8=on?on.prototype:void 0,r8=n8?n8.valueOf:void 0;function i9e(e){return r8?Object(r8.call(e)):{}}var o8=i9e;var a9e="[object Boolean]",c9e="[object Date]",l9e="[object Map]",u9e="[object Number]",d9e="[object RegExp]",p9e="[object Set]",f9e="[object String]",m9e="[object Symbol]",h9e="[object ArrayBuffer]",g9e="[object DataView]",_9e="[object Float32Array]",y9e="[object Float64Array]",b9e="[object Int8Array]",S9e="[object Int16Array]",E9e="[object Int32Array]",x9e="[object Uint8Array]",v9e="[object Uint8ClampedArray]",w9e="[object Uint16Array]",A9e="[object Uint32Array]";function T9e(e,t,n){var r=e.constructor;switch(t){case h9e:return Ju(e);case a9e:case c9e:return new r(+e);case g9e:return e8(e,n);case _9e:case y9e:case b9e:case S9e:case E9e:case x9e:case v9e:case w9e:case A9e:return gS(e,n);case l9e:return new r;case u9e:case f9e:return new r(e);case d9e:return t8(e);case p9e:return new r;case m9e:return o8(e)}}var s8=T9e;var C9e="[object Map]";function k9e(e){return Xt(e)&&gs(e)==C9e}var i8=k9e;var a8=Go&&Go.isMap,R9e=a8?ll(a8):i8,c8=R9e;var O9e="[object Set]";function P9e(e){return Xt(e)&&gs(e)==O9e}var l8=P9e;var u8=Go&&Go.isSet,I9e=u8?ll(u8):l8,d8=I9e;var D9e=1,L9e=2,M9e=4,p8="[object Arguments]",N9e="[object Array]",U9e="[object Boolean]",F9e="[object Date]",j9e="[object Error]",f8="[object Function]",$9e="[object GeneratorFunction]",z9e="[object Map]",H9e="[object Number]",m8="[object Object]",B9e="[object RegExp]",K9e="[object Set]",G9e="[object String]",W9e="[object Symbol]",q9e="[object WeakMap]",V9e="[object ArrayBuffer]",Z9e="[object DataView]",Y9e="[object Float32Array]",J9e="[object Float64Array]",X9e="[object Int8Array]",Q9e="[object Int16Array]",eZe="[object Int32Array]",tZe="[object Uint8Array]",nZe="[object Uint8ClampedArray]",rZe="[object Uint16Array]",oZe="[object Uint32Array]",dt={};dt[p8]=dt[N9e]=dt[V9e]=dt[Z9e]=dt[U9e]=dt[F9e]=dt[Y9e]=dt[J9e]=dt[X9e]=dt[Q9e]=dt[eZe]=dt[z9e]=dt[H9e]=dt[m8]=dt[B9e]=dt[K9e]=dt[G9e]=dt[W9e]=dt[tZe]=dt[nZe]=dt[rZe]=dt[oZe]=!0;dt[j9e]=dt[f8]=dt[q9e]=!1;function vS(e,t,n,r,o,s){var i,a=t&D9e,c=t&L9e,l=t&M9e;if(n)i=o?n(e,r,o,s):n(e);if(i!==void 0)return i;if(!zt(e))return e;var u=_t(e);if(u){if(i=QJ(e),!a)return _S(e,i)}else{var p=gs(e),f=p==f8||p==$9e;if(Ko(e))return Vm(e,a);if(p==m8||p==p8||f&&!o){if(i=c||f?{}:yS(e),!a)return c?XJ(e,YJ(i,e)):JJ(e,ZJ(i,e))}else{if(!dt[p])return o?e:{};i=s8(e,p,a)}}s||(s=new Bo);var m=s.get(e);if(m)return m;if(s.set(e,i),d8(e))e.forEach(function(y){i.add(vS(y,t,n,y,e,s))});else if(c8(e))e.forEach(function(y,S){i.set(S,vS(y,t,n,S,e,s))});var h=l?c?ed:Gp:c?rs:Wo,g=u?void 0:h(e);return VJ(g||e,function(y,S){if(g)S=y,y=e[S];Qu(i,S,vS(y,t,n,S,e,s))}),i}var h8=vS;function sZe(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var g8=sZe;function iZe(e,t,n){var r=-1,o=e.length;if(t<0)t=-t>o?0:o+t;if(n=n>o?o:n,n<0)n+=o;o=t>n?0:n-t>>>0,t>>>=0;var s=Array(o);while(++r<o)s[r]=e[r+t];return s}var _8=iZe;function aZe(e,t){return t.length<2?e:ai(e,_8(t,0,-1))}var y8=aZe;var cZe=Object.prototype,lZe=cZe.hasOwnProperty;function uZe(e,t){t=Fr(t,e);var n=-1,r=t.length;if(!r)return!0;while(++n<r){var o=Sr(t[n]);if(o==="__proto__"&&!lZe.call(e,"__proto__"))return!1;if((o==="constructor"||o==="prototype")&&n<r-1)return!1}var s=y8(e,t);return s==null||delete s[Sr(g8(t))]}var b8=uZe;function dZe(e){return bS(e)?void 0:e}var S8=dZe;var E8=on?on.isConcatSpreadable:void 0;function pZe(e){return _t(e)||hs(e)||!!(E8&&e&&e[E8])}var x8=pZe;function v8(e,t,n,r,o){var s=-1,i=e.length;n||(n=x8),o||(o=[]);while(++s<i){var a=e[s];if(t>0&&n(a))if(t>1)v8(a,t-1,n,r,o);else il(o,a);else if(!r)o[o.length]=a}return o}var w8=v8;function fZe(e){var t=e==null?0:e.length;return t?w8(e,1):[]}var A8=fZe;function mZe(e){return ES(SS(e,void 0,A8),e+"")}var wS=mZe;var hZe=1,gZe=2,_Ze=4,yZe=wS(function(e,t){var n={};if(e==null)return n;var r=!1;if(t=_l(t,function(s){return s=Fr(s,e),r||(r=s.length>1),s}),Yr(e,ed(e),n),r)n=h8(n,hZe|gZe|_Ze,S8);var o=t.length;while(o--)b8(n,t[o]);return n}),iI=yZe;function bZe(e,t,n,r){if(!zt(e))return e;t=Fr(t,e);var o=-1,s=t.length,i=s-1,a=e;while(a!=null&&++o<s){var c=Sr(t[o]),l=n;if(c==="__proto__"||c==="constructor"||c==="prototype")return e;if(o!=i){var u=a[c];if(l=r?r(u,c,a):void 0,l===void 0)l=zt(u)?u:oi(t[o+1])?[]:{}}Qu(a,c,l),a=a[c]}return e}var T8=bZe;function SZe(e,t,n){var r=-1,o=t.length,s={};while(++r<o){var i=t[r],a=ai(e,i);if(n(a,i))T8(s,Fr(i,e),a)}return s}var AS=SZe;function EZe(e,t){return AS(e,t,function(n,r){return Yg(e,r)})}var C8=EZe;var xZe=wS(function(e,t){return e==null?{}:C8(e,t)}),TS=xZe;import{homedir as wJe}from"os";import{dirname as AJe,join as Do,resolve as Xr}from"path";var vZe="Expected a function";function wZe(e){if(typeof e!="function")throw TypeError(vZe);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}var k8=wZe;function AZe(e,t){if(e==null)return{};var n=_l(ed(e),function(r){return[r]});return t=ci(t),AS(e,n,function(r,o){return t(r,o[0])})}var R8=AZe;function TZe(e,t){return R8(e,k8(ci(t)))}var Ym=TZe;function pn(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Jm=[{alias:"additionalMarketplaces",canonical:"extraKnownMarketplaces"},{alias:"allowedMarketplaces",canonical:"strictKnownMarketplaces"}];function O8(e,t){if(!pn(e))return[];let n=[];for(let{alias:r,canonical:o}of Jm){if(!(r in e))continue;if(o in e&&e[o]!==null)n.push({file:t,path:r,message:`"${r}" is an alias for "${o}" and this file sets both; the "${r}" value was ignored. Use only "${o}".`,severity:"warning",alias:r,canonical:o});else e[o]=e[r];delete e[r]}return n}import{join as n7}from"path";var aI=["CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_VERTEX","CLAUDE_CODE_USE_FOUNDRY","CLAUDE_CODE_USE_ANTHROPIC_AWS","CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD","CLAUDE_CODE_USE_MANTLE","CLAUDE_CODE_USE_GATEWAY","ANTHROPIC_FOUNDRY_RESOURCE","ANTHROPIC_VERTEX_PROJECT_ID","ANTHROPIC_AWS_WORKSPACE_ID","ANTHROPIC_GOOGLE_CLOUD_PROJECT","ANTHROPIC_GOOGLE_CLOUD_LOCATION","ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID","CLOUD_ML_REGION"],P8=["CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_ANTHROPIC_AWS","CLAUDE_CODE_USE_MANTLE"];var I8="OTEL_EXPORTER_OTLP_",D8=["OTEL_LOG_RAW_API_BODIES","OTEL_LOG_USER_PROMPTS","OTEL_LOG_ASSISTANT_RESPONSES","OTEL_LOG_TOOL_CONTENT","OTEL_LOG_TOOL_DETAILS","OTEL_LOGS_EXPORTER","ENABLE_BETA_TRACING_DETAILED","BETA_TRACING_ENDPOINT","ANT_OTEL_LOGS_EXPORTER"],L8=[I8,`ANT_${I8}`],M8={apiKeyHelper:["ANTHROPIC_BASE_URL","_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL"],awsAuthRefresh:[...P8,"ANTHROPIC_BEDROCK_BASE_URL","ANTHROPIC_AWS_BASE_URL","ANTHROPIC_BEDROCK_MANTLE_BASE_URL"],awsCredentialExport:[...P8,"ANTHROPIC_BEDROCK_BASE_URL","ANTHROPIC_AWS_BASE_URL","ANTHROPIC_BEDROCK_MANTLE_BASE_URL"],gcpAuthRefresh:["CLAUDE_CODE_USE_VERTEX","CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD","ANTHROPIC_VERTEX_BASE_URL","ANTHROPIC_GOOGLE_CLOUD_BASE_URL"]},CZe=["CLAUDE_CODE_MEMORY_API_BASE_URL","CLAUDE_CODE_MEMORY_API_TOKEN"];var cI=["ANTHROPIC_BASE_URL","_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL","ANTHROPIC_BEDROCK_BASE_URL","ANTHROPIC_VERTEX_BASE_URL","ANTHROPIC_FOUNDRY_BASE_URL","ANTHROPIC_AWS_BASE_URL","ANTHROPIC_GOOGLE_CLOUD_BASE_URL","ANTHROPIC_BEDROCK_MANTLE_BASE_URL","CLAUDE_CODE_ARTIFACTS_API_BASE_URL","CLAUDE_CODE_ARTIFACTS_API_TOKEN","CLAUDE_CODE_ARTIFACT_ASSET_BASE_URL","CLAUDE_CODE_ARTIFACT_LIVE_BASE_URL","CLAUDE_CODE_ARTIFACT_SYNC_BASE_URL","CLAUDE_CODE_ARTIFACT_VIEWER_BASE_URL",...CZe];var lI=["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_BEARER_TOKEN_BEDROCK","ANTHROPIC_FOUNDRY_API_KEY","ANTHROPIC_FOUNDRY_AUTH_TOKEN","ANTHROPIC_AWS_API_KEY"],kZe=["CLAUDE_CODE_SKIP_BEDROCK_AUTH","CLAUDE_CODE_SKIP_VERTEX_AUTH","CLAUDE_CODE_SKIP_FOUNDRY_AUTH","CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH","CLAUDE_CODE_SKIP_ANTHROPIC_GOOGLE_CLOUD_AUTH","CLAUDE_CODE_SKIP_MANTLE_AUTH"],uI=["ANTHROPIC_MODEL","ANTHROPIC_DEFAULT_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_FABLE_MODEL_NAME","ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_HAIKU_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME","ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_OPUS_MODEL_NAME","ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_SONNET_MODEL_NAME","ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_SMALL_FAST_MODEL","ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION","CLAUDE_CODE_SUBAGENT_MODEL","CLAUDE_CODE_3P_PROBE_WROTE_SONNET_DEFAULT","CLAUDE_CODE_3P_PROBE_WROTE_OPUS_DEFAULT"],dI=["ANTHROPIC_CUSTOM_MODEL_OPTION","ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION","ANTHROPIC_CUSTOM_MODEL_OPTION_NAME","ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES"],RZe=["AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN"],pI=[...RZe,"AWS_PROFILE","AWS_CONFIG_FILE","AWS_SHARED_CREDENTIALS_FILE","GOOGLE_APPLICATION_CREDENTIALS","GOOGLE_CLOUD_PROJECT"];var fI=["AWS_CONTAINER_CREDENTIALS_FULL_URI","AWS_CONTAINER_CREDENTIALS_RELATIVE_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE","AWS_EC2_METADATA_SERVICE_ENDPOINT","AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE","AWS_WEB_IDENTITY_TOKEN_FILE","AWS_ROLE_ARN"],mI=["GCE_METADATA_HOST","GCE_METADATA_IP","METADATA_SERVER_DETECTION"],m1t=new Set(["CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST",...aI,...cI,...lI,...kZe,"CLAUDE_CODE_HOST_AUTH_ENV_VAR","CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH","CLAUDE_CODE_HOST_AUTH_REFRESH_TIMEOUT_MS","CLAUDE_CODE_HOST_CREDS_FILE",...pI,"GCLOUD_PROJECT","GOOGLE_CLOUD_QUOTA_PROJECT",...mI,...fI,"AWS_REGION","AWS_DEFAULT_REGION",...uI,"ANTHROPIC_BEDROCK_SERVICE_TIER","ANTHROPIC_BEDROCK_REGION_PREFIX","CLAUDE_CODE_CERT_STORE","DISABLE_GROWTHBOOK","CLAUDE_CODE_AUTO_MODE_MODEL","CLAUDE_CODE_BG_CLASSIFIER_MODEL","CLAUDE_CONTEXT_COLLAPSE_MODEL",...dI]);var N8=["apiKeyHelper","awsAuthRefresh","awsCredentialExport","fileSuggestion","gcpAuthRefresh","otelHeadersHelper","processWrapper","policyHelpers","proxyAuthHelper","statusLine","subagentStatusLine"],U8=["bwrapPath","ripgrep","socatPath"],OZe=new Set(["ANTHROPIC_BEDROCK_REGION_PREFIX","ANTHROPIC_BEDROCK_SERVICE_TIER","ANTHROPIC_CUSTOM_HEADERS","ANTHROPIC_CUSTOM_MODEL_OPTION","ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION","ANTHROPIC_CUSTOM_MODEL_OPTION_NAME","ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_FABLE_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_FABLE_MODEL_NAME","ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME","ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_OPUS_MODEL_NAME","ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_SONNET_MODEL_NAME","ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES","ANTHROPIC_FOUNDRY_API_KEY","ANTHROPIC_MODEL","ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION","ANTHROPIC_SMALL_FAST_MODEL","AWS_DEFAULT_REGION","AWS_PROFILE","AWS_REGION","BASH_DEFAULT_TIMEOUT_MS","BASH_MAX_OUTPUT_LENGTH","BASH_MAX_TIMEOUT_MS","CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR","CLAUDE_CODE_API_KEY_HELPER_TTL_MS","CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS","CLAUDE_CODE_DISABLE_TERMINAL_TITLE","CLAUDE_CODE_ENABLE_AUTO_MODE","CLAUDE_CODE_ENABLE_DESIGN_SYNC","CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL","CLAUDE_CODE_ENABLE_TELEMETRY","CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS","CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL","CLAUDE_CODE_MAX_OUTPUT_TOKENS","CLAUDE_CODE_SKIP_BEDROCK_AUTH","CLAUDE_CODE_SKIP_FOUNDRY_AUTH","CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH","CLAUDE_CODE_SKIP_ANTHROPIC_GOOGLE_CLOUD_AUTH","CLAUDE_CODE_SKIP_MANTLE_AUTH","CLAUDE_CODE_SKIP_VERTEX_AUTH","CLAUDE_CODE_SUBAGENT_MODEL","CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_FOUNDRY","CLAUDE_CODE_USE_ANTHROPIC_AWS","CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD","CLAUDE_CODE_USE_GATEWAY","CLAUDE_CODE_USE_MANTLE","CLAUDE_CODE_USE_POWERSHELL_TOOL","CLAUDE_CODE_USE_VERTEX","DISABLE_AUTOUPDATER","DISABLE_BUG_COMMAND","DISABLE_COST_WARNINGS","DISABLE_FEEDBACK_COMMAND","DISABLE_GROWTHBOOK","DISABLE_INSTALLATION_CHECKS","DISABLE_UPDATES","ENABLE_TOOL_SEARCH","MAX_MCP_OUTPUT_TOKENS","MAX_THINKING_TOKENS","MCP_CONNECT_TIMEOUT_MS","MCP_TIMEOUT","MCP_TOOL_TIMEOUT","OTEL_EXPORTER_OTLP_COMPRESSION","OTEL_EXPORTER_OTLP_HEADERS","OTEL_EXPORTER_OTLP_LOGS_COMPRESSION","OTEL_EXPORTER_OTLP_LOGS_HEADERS","OTEL_EXPORTER_OTLP_LOGS_PROTOCOL","OTEL_EXPORTER_OTLP_METRICS_COMPRESSION","OTEL_EXPORTER_OTLP_METRICS_HEADERS","OTEL_EXPORTER_OTLP_METRICS_PROTOCOL","OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE","OTEL_EXPORTER_OTLP_PROTOCOL","OTEL_EXPORTER_OTLP_TRACES_COMPRESSION","OTEL_EXPORTER_OTLP_TRACES_HEADERS","OTEL_EXPORTER_OTLP_TRACES_PROTOCOL","OTEL_LOG_ASSISTANT_RESPONSES","OTEL_LOG_TOOL_CONTENT","OTEL_LOG_TOOL_DETAILS","OTEL_LOG_USER_PROMPTS","OTEL_LOGS_EXPORT_INTERVAL","OTEL_LOGS_EXPORTER","OTEL_METRIC_EXPORT_INTERVAL","OTEL_METRICS_EXPORTER","OTEL_METRICS_INCLUDE_ACCOUNT_UUID","OTEL_METRICS_INCLUDE_ENTRYPOINT","OTEL_METRICS_INCLUDE_RESOURCE_ATTRIBUTES","OTEL_METRICS_INCLUDE_SESSION_ID","OTEL_METRICS_INCLUDE_VERSION","OTEL_RESOURCE_ATTRIBUTES","OTEL_SERVICE_NAME","OTEL_TRACES_EXPORT_INTERVAL","OTEL_TRACES_EXPORTER","USE_BUILTIN_RIPGREP","VERTEX_REGION_CLAUDE_3_5_HAIKU","VERTEX_REGION_CLAUDE_3_5_SONNET","VERTEX_REGION_CLAUDE_3_7_SONNET","VERTEX_REGION_CLAUDE_4_0_OPUS","VERTEX_REGION_CLAUDE_4_0_SONNET","VERTEX_REGION_CLAUDE_4_1_OPUS","VERTEX_REGION_CLAUDE_4_5_OPUS","VERTEX_REGION_CLAUDE_4_6_OPUS","VERTEX_REGION_CLAUDE_4_7_OPUS","VERTEX_REGION_CLAUDE_4_8_OPUS","VERTEX_REGION_CLAUDE_5_OPUS","VERTEX_REGION_CLAUDE_FABLE_5","VERTEX_REGION_CLAUDE_4_5_SONNET","VERTEX_REGION_CLAUDE_4_6_SONNET","VERTEX_REGION_CLAUDE_5_SONNET","VERTEX_REGION_CLAUDE_HAIKU_4_5","CLAUDE_AUTOCOMPACT_PCT_OVERRIDE","CLAUDE_CODE_AUTO_COMPACT_WINDOW","CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT","CLAUDE_CODE_MAX_CONTEXT_TOKENS","DISABLE_AUTO_COMPACT","DISABLE_COMPACT","CLAUDE_CODE_ALWAYS_ENABLE_EFFORT","CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING","CLAUDE_CODE_DISABLE_FAST_MODE","CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP","CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK","CLAUDE_CODE_DISABLE_THINKING","CLAUDE_CODE_EFFORT_LEVEL","CLAUDE_CODE_PROMPT_CACHE_TTL","CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL","DISABLE_INTERLEAVED_THINKING","DISABLE_PROMPT_CACHING","DISABLE_PROMPT_CACHING_FABLE","DISABLE_PROMPT_CACHING_HAIKU","DISABLE_PROMPT_CACHING_OPUS","DISABLE_PROMPT_CACHING_SONNET","ENABLE_PROMPT_CACHING_1H","ENABLE_PROMPT_CACHING_1H_BEDROCK","FALLBACK_FOR_ALL_PRIMARY_MODELS","FORCE_PROMPT_CACHING_5M","CLAUDE_AUTO_BACKGROUND_TASKS","CLAUDE_CODE_DISABLE_ADVISOR_TOOL","CLAUDE_CODE_DISABLE_AGENT_VIEW","CLAUDE_CODE_DISABLE_ARTIFACT","CLAUDE_CODE_DISABLE_BACKGROUND_TASKS","CLAUDE_CODE_DISABLE_BUNDLED_SKILLS","CLAUDE_CODE_DISABLE_CRON","CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS","CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY","CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING","CLAUDE_CODE_DISABLE_WORKFLOWS","CLAUDE_CODE_ENABLE_AWAY_SUMMARY","CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING","CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION","CLAUDE_CODE_ENABLE_TASKS","CLAUDE_CODE_FORK_SUBAGENT","CLAUDE_CODE_PLAN_MODE_REQUIRED","DISABLE_DOCTOR_COMMAND","DISABLE_EXTRA_USAGE_COMMAND","DISABLE_INSTALL_GITHUB_APP_COMMAND","DISABLE_LOGIN_COMMAND","DISABLE_LOGOUT_COMMAND","DISABLE_UPGRADE_COMMAND","CLAUDE_AX_SCREEN_READER","CLAUDE_CODE_ACCESSIBILITY","CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN","CLAUDE_CODE_DISABLE_MOUSE","CLAUDE_CODE_DISABLE_MOUSE_CLICKS","CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL","CLAUDE_CODE_FORCE_STRIKETHROUGH","CLAUDE_CODE_HIDE_CWD","CLAUDE_CODE_NATIVE_CURSOR","CLAUDE_CODE_NO_FLICKER","CLAUDE_CODE_SCROLL_SPEED","CLAUDE_CODE_SYNTAX_HIGHLIGHT","API_TIMEOUT_MS","CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS","CLAUDE_CODE_GLOB_TIMEOUT_SECONDS","CLAUDE_CODE_MAX_RETRIES","CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION","CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY","CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION","CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS","CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT","CLAUDE_STREAM_IDLE_TIMEOUT_MS","MAX_STRUCTURED_OUTPUT_RETRIES","MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE","MCP_SERVER_CONNECTION_BATCH_SIZE","SLASH_COMMAND_TOOL_CHAR_BUDGET","TASK_MAX_OUTPUT_LENGTH"]),PZe=new Set(["CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC","DISABLE_ERROR_REPORTING","DISABLE_TELEMETRY","DO_NOT_TRACK"]);function F8(e,t){let n=e.toUpperCase();return OZe.has(n)||PZe.has(n)&&Ie(t)}function cc(){return jv.of(Tt().host)}function j8(e){cc().invalidateAll(e)}import{createHash as JX}from"crypto";import{posix as KX,win32 as GX}from"path";import{isAbsolute as $8}from"path";var DZe=M(()=>C({allowedDomains:I(_()).optional(),deniedDomains:I(_()).optional().describe("Domains that are always blocked, even if matched by allowedDomains. Supports the same wildcard syntax as allowedDomains. Merged from all settings sources regardless of allowManagedDomainsOnly."),strictAllowlist:R().optional().describe("When true, the sandbox runtime deterministically denies hosts not in allowedDomains instead of prompting. "+"Enforced for sandboxed commands only — in-process tools such as WebFetch are not gated by this setting. "+"Only honored from user, managed/policy, or CLI (--settings) settings — "+"project settings (.claude/settings.json and .claude/settings.local.json) are ignored."),allowManagedDomainsOnly:R().optional().describe("When true (and set in managed settings), only allowedDomains and WebFetch(domain:...) allow rules from managed settings are respected. User, project, local, and flag settings domains are ignored. Denied domains are still respected from all sources."),allowUnixSockets:I(_()).optional().describe("macOS only: Unix socket paths to allow. Ignored on Linux (seccomp cannot filter by path)."),allowAllUnixSockets:R().optional().describe("If true, allow all Unix sockets (disables blocking on both platforms)."),allowLocalBinding:R().optional(),allowMachLookup:I(_().refine((e)=>!(e.endsWith("*")?e.slice(0,-1):e).includes("*"),{message:'Wildcards are only allowed as a single trailing "*" (e.g., "com.example.*" or "*" for all services).'})).optional().describe('macOS only: Additional XPC/Mach service names to allow looking up. Supports trailing-wildcard prefix matching (e.g., "com.apple.coresimulator.*"). Needed for tools that communicate via XPC such as the iOS Simulator or Playwright.'),httpProxyPort:ee().optional(),socksProxyPort:ee().optional(),tlsTerminate:C({caCertPath:_().min(1).optional(),caKeyPath:_().min(1).optional()}).optional().describe("[EXPERIMENTAL] Enable in-process TLS termination so the per-request filter can see HTTPS request bodies. Provide a CA cert+key, or omit both to have sandbox-runtime generate an ephemeral one for the session. On native Windows an ephemeral CA cannot pass the sandbox trust check, so omitting the paths uses a persistent CA managed by the sandbox runtime (set up and trusted via /sandbox install); configured paths are passed to the sandbox runtime verbatim, which rejects a bad or incomplete pair at sandbox initialization. "+"Only honored from user, managed/policy, or CLI (`--settings`) settings — project settings "+"(.claude/settings.json and .claude/settings.local.json) are ignored.")}).optional()),LZe=M(()=>C({allowWrite:I(_()).optional().describe("Additional paths to allow writing within the sandbox. Merged with paths from Edit(...) allow permission rules."),denyWrite:I(_()).optional().describe("Additional paths to deny writing within the sandbox. Merged with paths from Edit(...) deny permission rules."),denyRead:I(_()).optional().describe("Additional paths to deny reading within the sandbox. Merged with paths from Read(...) deny permission rules."),allowRead:I(_()).optional().describe("Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths."),allowManagedReadPathsOnly:R().optional().describe("When true (set in managed settings), only allowRead paths from policySettings are used."),disabled:R().optional().describe("macOS and Linux/WSL only: skip filesystem isolation entirely while keeping network and seccomp isolation. Ignored on native Windows, where the sandboxed process runs as a separate user with no inherent rights, so skipping the filesystem rules would "+"withhold every access grant rather than loosen them — filesystem isolation stays on there. "+"Sandboxed commands get unrestricted read/write access to the host filesystem; network egress is still confined to network.allowedDomains. Intended for deployments whose goal is egress control rather than filesystem containment. Does not change Bash prompting: sandbox.autoAllowBashIfSandboxed is independent and still defaults to true, so set it to false to keep prompting for sandboxed commands. Drops the read protection from filesystem.denyRead and credentials.files deny entries for sandboxed commands, since both are enforced by the filesystem layer this turns off; credentials.files mask entries (sentinel binds) and credentials.envVars deny/mask are unaffected. "+"Only honored from user, managed/policy, or CLI (`--settings`) settings — "+"project settings (.claude/settings.json and .claude/settings.local.json) are ignored. If managed settings configure sandbox.filesystem at all, or list any sandbox.credentials.files deny entry, only managed settings can set this: an admin who deployed filesystem restrictions must not have them switched off by a user-writable file. (sandbox.credentials.envVars and credentials.files mask entries "+"do not pin it — env scrubbing and sentinel binds are independent of the filesystem "+"layer and survive this setting.) When unset, filesystem isolation stays on.")}).optional());function z8(e,t,n){if(e.length===0||e.some((r)=>r.length===0))n.addIssue({code:Kr.custom,path:["maskClaims"],message:"maskClaims must name at least one non-empty claim — omit maskClaims for whole-token masking."});if(t===void 0)n.addIssue({code:Kr.custom,path:["maskClaims"],message:"maskClaims requires decode — without a decode format there is no token to read claims from. Set decode, or omit maskClaims."})}function H8(e,t){let n;try{n=new RegExp(e)}catch(o){t.addIssue({code:Kr.custom,path:["extract"],message:`extract is not a valid regular expression: ${Ho(o)}`});return}if(new RegExp(n.source+"|").exec("").length-1<1)t.addIssue({code:Kr.custom,path:["extract"],message:"extract must contain at least one capturing group — "+'group 1 is the credential value to mask (e.g. "token:\\s*(\\S+)").'})}function B8(e){if(typeof e!=="object"||e===null)return e;let t=e;if(t.mode!=="deny")return e;let n={...t};if("extract"in n&&typeof n.extract!=="string")delete n.extract;if("onExtractNoMatch"in n&&n.onExtractNoMatch!=="warn"&&n.onExtractNoMatch!=="deny"&&n.onExtractNoMatch!=="error")delete n.onExtractNoMatch;if("decode"in n&&n.decode!=="jwt")delete n.decode;if("maskClaims"in n&&!(Array.isArray(n.maskClaims)&&n.maskClaims.every((r)=>typeof r==="string")))delete n.maskClaims;if("maskDuplicates"in n&&typeof n.maskDuplicates!=="boolean")delete n.maskDuplicates;if("injectHosts"in n&&!(Array.isArray(n.injectHosts)&&n.injectHosts.every((r)=>typeof r==="string")))delete n.injectHosts;return n}var CS=M(()=>st(B8,C({path:_().min(1).describe("Path to a credential file or directory. Same resolution as sandbox.filesystem.* paths: absolute, ~ expanded, or relative to the settings file root (project root for project settings, ~/.claude for user settings)."),mode:q(["deny","mask"]).describe("Access mode for this path. `deny` blocks reads inside the sandbox; `mask` shows sandboxed commands a sentinel-substituted copy (whole-file, or only the spans captured by `extract`) and the "+"host proxy swaps sentinel→real on egress to `injectHosts`. "+"On macOS and Windows `mask` currently degrades to `deny`."),extract:_().optional().describe("Optional regex for structured masking when mode is `mask`. Applied globally to the file; capture group 1 of each match is a credential value, and only those captured spans are replaced "+"with sentinels — the rest of the file is preserved so a tool "+"that parses it (.netrc, JSON, YAML) still succeeds. Without `extract`, the entire file content is replaced with one sentinel (whole-file masking, suited to single-secret files). If the regex matches nothing, behavior is governed by `onExtractNoMatch` (default `warn`). Accepted but ignored for `deny`."),onExtractNoMatch:q(["warn","deny","error"]).optional().describe("What to do when `extract` matches nothing in the file — or, "+"with `decode`, when no candidate survives verification. `warn` (default) emits a stderr warning and leaves the file readable as-is inside the sandbox (fail-open, for credentials that may be legitimately absent); `deny` degrades the entry to "+"mode `deny` so the file is unreadable (fail-closed) — under "+"`sandbox.filesystem.disabled` it is treated as `error`, since read-denies are dropped in that mode; `error` aborts at sandbox setup so nothing runs until the config is fixed. Only meaningful when mode is `mask` and `extract` or `decode` is set; accepted but ignored otherwise."),decode:q(["jwt"]).optional().describe("Optional encoded-credential format for `mask` mode. `jwt`: candidates are located with a built-in JWT regex (or the explicit `extract` pattern, if set), verified to actually be JWTs before masking, and replaced with a structurally valid fake JWT so client-side token parsing inside the sandbox keeps working. If no candidate verifies, behavior is governed by `onExtractNoMatch` (default `warn`). Accepted but ignored for `deny`."),maskClaims:I(_()).optional().describe("Names of top-level payload claims to mask inside each decoded value, instead of replacing the whole token. Each named claim present with a string value gets its own sentinel and the token is rebuilt around the modified payload; all other claims are preserved so a tool that decodes the token and reads a non-secret claim keeps working. Requires `decode`. If no named claim matches in any verified token, behavior is governed by `onExtractNoMatch` (default `warn`). Only meaningful when mode is `mask`; accepted but ignored for `deny`."),maskDuplicates:R().optional().describe("If true, verbatim occurrences of each captured credential value outside the regex-matched spans are also replaced with the "+"corresponding sentinel — for a secret repeated where the regex "+"does not reach (e.g. pasted into a comment). Matches raw substrings, so short or common values may corrupt unrelated content; intended for long, high-entropy secrets. Defaults to false. Only meaningful when mode is `mask` and `extract` or `decode` is set; accepted but ignored otherwise."),injectHosts:I(_()).optional().describe("Optional narrowing of where the proxy substitutes this credential. Only meaningful when mode is `mask`; accepted but ignored for `deny`. If unset, defaults to "+"`network.allowedDomains` — the credential is injected at "+"every reachable host. Each entry must be reachable via `network.allowedDomains` (sandbox-runtime validates this).")}).superRefine((e,t)=>{if(e.mode==="mask"&&e.path.endsWith("/"))t.addIssue({code:Kr.custom,path:["path"],message:'Credential mode "mask" applies to a single file, not a directory. List the specific credential file(s), or use "deny" for the directory.'});if(e.mode==="mask"&&e.extract!==void 0)H8(e.extract,t);if(e.mode==="mask"&&e.maskClaims!==void 0)z8(e.maskClaims,e.decode,t)}))),td=()=>_().regex(/^[A-Za-z_][A-Za-z0-9_]*$/,"Environment variable name must start with a letter or underscore and contain only letters, digits, and underscores"),kS=M(()=>st(B8,C({name:td().describe("Environment variable name."),mode:q(["deny","mask"]).describe("Access mode for this environment variable. `deny` unsets the variable for sandboxed commands; `mask` shows sandboxed commands a sentinel value and the "+"host proxy swaps sentinel→real on egress to `injectHosts`."),extract:_().optional().describe("Optional regex for structured masking when mode is `mask`. Applied globally to the value; capture group 1 of each match is a credential value, and only those captured spans are "+"replaced with sentinels — the rest of the value is preserved "+"so a tool that parses it (a `DATABASE_URL` connection string, a composite `KEY:SECRET` pair) still succeeds inside the sandbox. Without `extract`, the entire value is replaced with one sentinel (whole-value masking, suited to bare tokens). If the regex matches nothing, behavior is governed by `onExtractNoMatch` (default `warn`). Cannot be combined with `decode` (the decode path never consults it). Accepted but ignored for `deny`."),onExtractNoMatch:q(["warn","deny","error"]).optional().describe("What to do when `extract` matches nothing in the value. `warn` (default) emits a stderr warning and lets the variable pass through unmasked (fail-open, for credentials that may be legitimately absent); `deny` unsets the variable inside the sandbox (fail-closed); `error` aborts at sandbox setup so nothing runs until the config is fixed. Only meaningful when mode is `mask` and `extract` is set without `decode`. On a mask entry with `decode`, the runtime takes the decode path and never consults this field, so a fail-closed setting "+"cannot be honored — `deny` and `error` are rejected there; "+"only `warn` is accepted. In all other shapes the field is accepted but ignored."),decode:q(["jwt"]).optional().describe("Optional encoded-credential format for `mask` mode. `jwt`: the variable's whole value is verified to actually be a JWT and replaced with a structurally valid fake JWT so client-side token parsing inside the sandbox keeps working; the proxy swaps the whole fake token on egress. If the value does not verify, the variable is left unmasked with a stderr warning "+"(fail-open). Cannot be combined with `extract` — the decode "+"path never consults it. Accepted but ignored for `deny`."),maskClaims:I(_()).optional().describe("Names of top-level payload claims to mask inside the decoded value, instead of replacing the whole token. Each named claim present with a string value gets its own sentinel and the token is rebuilt around the modified payload; all other claims are preserved so claim-reading clients keep working. Requires `decode`. If no named claim matches, the variable is left unmasked with a stderr warning (fail-open). Only meaningful when mode is `mask`; accepted but ignored for `deny`."),injectHosts:I(_()).optional().describe("Optional narrowing of where the proxy substitutes this credential. Only meaningful when mode is `mask`; accepted but ignored for `deny`. If unset, defaults to "+"`network.allowedDomains` — the credential is injected at "+"every reachable host. Each entry must be reachable via `network.allowedDomains` (sandbox-runtime validates this).")}).superRefine((e,t)=>{if(e.mode==="mask"&&e.extract!==void 0)H8(e.extract,t);if(e.mode==="mask"&&e.maskClaims!==void 0)z8(e.maskClaims,e.decode,t);if(e.mode==="mask"&&e.decode!==void 0&&e.extract!==void 0)t.addIssue({code:Kr.custom,path:["extract"],message:"extract cannot be combined with decode on an env entry — the runtime takes the decode path (whole-value JWT verification) and never consults extract, silently disabling the structured masking. Remove one of the two."});if(e.mode==="mask"&&e.decode!==void 0&&(e.onExtractNoMatch==="deny"||e.onExtractNoMatch==="error"))t.addIssue({code:Kr.custom,path:["onExtractNoMatch"],message:"onExtractNoMatch cannot be honored on an env entry with decode — the runtime takes the decode path (which is unconditionally fail-open on verify failure) and never consults extract or onExtractNoMatch. Remove onExtractNoMatch, or drop decode to use extract-based masking (whose no-match handling does honor it)."})}))),nd=["AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN"];var hI="_INVALID_PAIR_",K8="_PARENT_PAIR_SUPPRESSOR_";var RS=M(()=>C({accessKeyIdVar:td().describe("Name of the masked env var holding the AWS access key id."),secretAccessKeyVar:td().describe("Name of the masked env var holding the AWS secret access key."),sessionTokenVar:td().optional().describe("Optional name of the masked env var holding the AWS session token (temporary credentials). When set, the proxy sends the real token as x-amz-security-token on re-signed requests and adds it to the signed header set if the client did not.")}).superRefine((e,t)=>{let n=new Map;for(let[r,o]of[["accessKeyIdVar",e.accessKeyIdVar],["secretAccessKeyVar",e.secretAccessKeyVar],["sessionTokenVar",e.sessionTokenVar]]){if(o===void 0)continue;let s=n.get(o);if(s!==void 0)t.addIssue({code:Kr.custom,path:[r],message:`${r} names the same env var ('${o}') as ${s} — each pair member must be a distinct variable.`});else n.set(o,r)}})),MZe=M(()=>{let e=q(["deny","passthrough"]);return C({streaming:e.optional().describe("Policy for aws-chunked streaming uploads (x-amz-content-sha256: STREAMING-*): per-chunk signatures chain off the seed signature, so re-signing would require rewriting the body. `deny` (default) fails closed with a 403; `passthrough` forwards the request unre-signed (the upstream will reject its signature)."),presigned:e.optional().describe("Policy for presigned URLs (X-Amz-Algorithm/X-Amz-Signature in the query, no Authorization header): the signature lives in the URL itself. `deny` (default) or `passthrough`."),sigv4a:e.optional().describe("Policy for SigV4A (AWS4-ECDSA-P256-SHA256) asymmetric signatures: there is no shared-key HMAC to recompute. `deny` (default) or `passthrough`.")})}),NZe=M(()=>C({files:I(CS()).optional().describe("Credential files or directories to protect. `deny` blocks reads inside the sandbox; `mask` substitutes a sentinel inside the sandbox (whole-file, or per-`extract` capture) and injects the real value at the proxy. On macOS and Windows `mask` degrades to `deny`."),envVars:I(kS()).optional().describe("Environment variables to protect. `deny` unsets the variable for sandboxed commands; `mask` substitutes a sentinel inside the sandbox and injects the real value at the proxy."),allowPlaintextInject:R().optional().describe("Allow sentinel→real substitution on the plain-HTTP proxy path. "+"Defaults to false: without TLS termination the upstream identity is unverified and the credential travels in cleartext. Set only for trusted-network test fixtures. Only honored from user, managed/policy, or CLI (`--settings`) "+"settings — project settings (.claude/settings.json and "+".claude/settings.local.json) are ignored."),awsPairs:I(RS()).optional().describe("Explicit groupings of masked env vars into AWS credential pairs for SigV4 re-signing, for non-standard variable names. The conventional AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY / AWS_SESSION_TOKEN trio is paired automatically when masked. Only honored from user, managed/policy, or CLI (`--settings`) "+"settings — project settings (.claude/settings.json and "+".claude/settings.local.json) are ignored. A member is only usable when its env var is forwarded as a whole-value `mask` entry (an entry carrying `extract` or `decode` does not "+"qualify — re-signing needs the whole real value). A pair "+"whose key id or secret member is unusable never re-signs: it is dropped, unless it names a conventional AWS variable, in which case it is forwarded as an inert suppressor so implicit auto-pairing stays overridden. A pair whose ONLY unusable member is the session token still re-signs, without an x-amz-security-token (temporary-credential requests fail upstream until the entry is fixed)."),sigv4:MZe().optional().describe("Policies for AWS SigV4 request shapes the proxy cannot re-sign (streaming, presigned, sigv4a) when they reference a masked credential pair: `deny` (default) or `passthrough`. Only honored from user, managed/policy, or CLI (`--settings`) "+"settings — project settings (.claude/settings.json and "+".claude/settings.local.json) are ignored.")}).superRefine((e,t)=>{let n=new Set;for(let[r,o]of(e?.awsPairs??[]).entries()){let s=[["accessKeyIdVar",o.accessKeyIdVar],["secretAccessKeyVar",o.secretAccessKeyVar],["sessionTokenVar",o.sessionTokenVar]],i=new Set;for(let[a,c]of s){if(c===void 0)continue;if(n.has(c))t.addIssue({code:Kr.custom,path:["awsPairs",r,a],message:`"${c}" appears in more than one awsPairs slot (within or across pairs) — each variable can fill exactly one slot.`});i.add(c)}for(let a of i)n.add(a)}}).optional()),gI=M(()=>C({enabled:R().optional(),failIfUnavailable:R().optional().describe("Exit with an error at startup if sandbox.enabled is true but the sandbox cannot start (missing dependencies or unsupported platform). When false (default), a warning is shown and commands run unsandboxed. Intended for managed-settings deployments that require sandboxing as a hard gate."),autoAllowBashIfSandboxed:R().optional(),allowUnsandboxedCommands:R().optional().describe("Allow commands to run outside the sandbox via the dangerouslyDisableSandbox parameter. When false, the dangerouslyDisableSandbox parameter is completely ignored and all commands must run sandboxed. Default: true."),network:DZe(),filesystem:LZe(),credentials:NZe(),ignoreViolations:X(_(),I(_())).optional(),enableWeakerNestedSandbox:R().optional(),enableWeakerNetworkIsolation:R().optional().describe("macOS only: Allow access to com.apple.trustd.agent in the sandbox. Needed for Go-based CLI tools (gh, gcloud, terraform, etc.) to verify TLS certificates when using httpProxyPort with a MITM proxy and custom CA. "+"**Reduces security** — opens a potential data exfiltration vector through the trustd service. Default: false"),allowAppleEvents:R().optional().describe("macOS only: Allow sandboxed commands to send Apple Events (and look up the appleeventsd Mach service). Needed for `open`, `osascript`, and browser-based auth flows that open URLs. "+"**Removes code-execution isolation** — sandboxed commands can launch other applications "+"unsandboxed with no user prompt, and can script running apps (e.g. Terminal) subject to the user's per-app TCC automation consent. "+"Only honored from user, managed/policy, or CLI (--settings) settings — "+"project settings (.claude/settings.json and .claude/settings.local.json) are ignored. Default: false"),excludedCommands:I(_()).optional(),ripgrep:C({command:_(),args:I(_()).optional()}).optional().describe("Custom ripgrep configuration for bundled ripgrep support. "+"Only honored from user, managed/policy, or CLI (--settings) settings — "+"project settings (.claude/settings.json and .claude/settings.local.json) are ignored."),bwrapPath:st((e)=>typeof e==="string"&&$8(e)?e:void 0,_()).optional().catch(void 0).describe("Linux/WSL only: Absolute path to the bwrap (bubblewrap) binary. Overrides auto-detection via PATH. Only honored from admin-controlled managed settings."),socatPath:st((e)=>typeof e==="string"&&$8(e)?e:void 0,_()).optional().catch(void 0).describe("Linux/WSL only: Absolute path to the socat binary used for the sandbox network proxy. Overrides auto-detection via PATH. Only honored from admin-controlled managed settings.")}).passthrough());var Xm=["acceptEdits","auto","bypassPermissions","default","dontAsk","plan"],G8=[...Xm],W8=G8;function Qm(e){return e==="manual"?"default":e}var I1t=`Cannot set permission mode: must be one of ${G8.join(", ")}`,D1t={dangerousRemoval:{bypassImmune:!0,classifierRouted:!0},backgroundOperator:{bypassImmune:!1,classifierRouted:!0},suspiciousWindowsPath:{bypassImmune:!1,classifierRouted:!0},isolatePeerMachines:{bypassImmune:!0,classifierRouted:!1},...{}};var q8=["auto","iterm2","terminal_bell","iterm2_with_bell","kitty","ghostty","notifications_disabled"];var V8=["normal","vim"],Z8=["classic","readline"];var Y8=["auto","tmux","iterm2","in-process"],UZe=["dark","light","light-daltonized","dark-daltonized","light-ansi","dark-ansi"],J8=["auto",...UZe],X8=["auto","alwaysAsk","disabled"];var F1t=jr()==="macos"?"⏺":"●";var W1t=M(()=>st(Qm,q(W8))),q1t=M(()=>st(Qm,q(Xm)));import{posix as YZe,win32 as JZe}from"path";import{isIPv4 as XZe,isIPv6 as QZe}from"net";var Q8=["bash","powershell"];var eh=M(()=>_().optional().describe('Permission rule syntax to filter when this hook runs (e.g., "Bash(git *)"). Only runs if the tool call matches the pattern. Avoids spawning hooks for non-matching commands.'));function FZe(){let e=C({type:j("command").describe("Shell command hook type"),command:_().describe("Shell command to execute"),args:I(_()).optional().describe("Argument list for exec form. When present, `command` is resolved as "+"an executable and spawned directly with these arguments — no shell. "+"Path placeholders like ${CLAUDE_PLUGIN_ROOT} are substituted per-element as plain strings, so paths with quotes, $, or backticks never reach a shell parser. When absent, `command` runs through a shell (bash on POSIX, PowerShell on Windows without Git Bash)."),if:eh(),shell:q(Q8).optional().describe("Shell interpreter. 'bash' uses your $SHELL (bash/zsh/sh); 'powershell' uses pwsh. Defaults to bash (powershell on Windows without Git Bash)."),timeout:ee().positive().optional().describe("Timeout in seconds for this specific command"),statusMessage:_().optional().describe("Custom status message to display in spinner while hook runs"),once:R().optional().describe("If true, hook runs once and is removed after execution"),async:R().optional().describe("If true, hook runs in background without blocking"),asyncRewake:R().optional().describe("If true, hook runs in background and wakes the model on exit code 2 (blocking error). Implies async."),rewakeMessage:_().min(1).optional().describe("@internal Custom prefix for the system-reminder shown to the model when an asyncRewake hook exits with code 2. The hook output is appended after this prefix."),rewakeSummary:_().min(1).optional().describe('@internal One-line summary shown to the user in the terminal when an asyncRewake hook exits with code 2. Defaults to "Stop hook feedback".'),cloud:q(["device","skip"]).optional().catch("skip").describe("@internal Where this hook may run when a cloud session is driven from this machine. 'device': offer it to the cloud session and run it here even when its script sits where the cloud session can write on this machine or cannot be pinned — the author accepts that the session may have changed files this hook executes. 'skip': never offer it to cloud sessions. Omit for the default: a command hook whose script could be read and pinned and lies outside everything the cloud session can write here is offered; other command hooks are not. Applies to this entry only: the same hook written in another settings scope keeps its own setting. An unrecognised value reads as 'skip' (the file still loads; the hook stays on this machine).")}),t=C({type:j("prompt").describe("LLM prompt hook type"),prompt:_().describe("Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON."),if:eh(),timeout:ee().positive().optional().describe("Timeout in seconds for this specific prompt evaluation"),model:_().optional().describe('Model to use for this prompt hook (e.g., "claude-sonnet-5"). If not specified, uses the default small fast model.'),continueOnBlock:R().optional().describe(`Sets the continue value for the decision:"block" produced when ok is false. Default false (turn ends). Whether continue:true lets the turn proceed depends on the event's decision:"block" semantics. On PostToolUse, the reason is fed back to Claude and the turn continues.`),statusMessage:_().optional().describe("Custom status message to display in spinner while hook runs"),once:R().optional().describe("If true, hook runs once and is removed after execution")}),n=C({type:j("mcp_tool").describe("MCP tool hook type"),server:_().describe("Name of an already-configured MCP server to invoke"),tool:_().describe("Name of the tool on that server to call"),input:X(_(),Ae()).optional().describe('Arguments passed to the MCP tool. String values support ${path} interpolation from the hook input JSON (e.g. "${tool_input.file_path}").'),if:eh(),timeout:ee().positive().optional().describe("Timeout in seconds for this specific tool call"),statusMessage:_().optional().describe("Custom status message to display in spinner while hook runs"),once:R().optional().describe("If true, hook runs once and is removed after execution")}),r=C({type:j("http").describe("HTTP hook type"),url:_().url().describe("URL to POST the hook input JSON to"),if:eh(),timeout:ee().positive().optional().describe("Timeout in seconds for this specific request"),headers:X(_(),_()).optional().describe('Additional headers to include in the request. Values may reference environment variables using $VAR_NAME or ${VAR_NAME} syntax (e.g., "Authorization": "Bearer $MY_TOKEN"). Only variables listed in allowedEnvVars will be interpolated.'),allowedEnvVars:I(_()).optional().describe("Explicit list of environment variable names that may be interpolated in header values. Only variables listed here will be resolved; all other $VAR references are left as empty strings. Required for env var interpolation to work."),statusMessage:_().optional().describe("Custom status message to display in spinner while hook runs"),once:R().optional().describe("If true, hook runs once and is removed after execution"),cloud:q(["device","skip"]).optional().catch("skip").describe("@internal Where this hook may run when a cloud session is driven from this machine. 'skip': never offer it to cloud sessions; 'device' or omitted: offered (an HTTP hook has no script to pin). Applies to this entry only. An unrecognised value reads as 'skip' (the file still loads).")}),o=C({type:j("agent").describe("Agentic verifier hook type"),prompt:_().describe('Prompt describing what to verify (e.g. "Verify that unit tests ran and passed."). Use $ARGUMENTS placeholder for hook input JSON.'),if:eh(),timeout:ee().positive().optional().describe("Timeout in seconds for agent execution (default 60)"),model:_().optional().describe('Model to use for this agent hook (e.g., "claude-sonnet-5"). If not specified, uses Haiku.'),statusMessage:_().optional().describe("Custom status message to display in spinner while hook runs"),once:R().optional().describe("If true, hook runs once and is removed after execution")});return{BashCommandHookSchema:e,PromptHookSchema:t,HttpHookSchema:r,AgentHookSchema:o,McpToolHookSchema:n}}var eX=M(()=>{let{BashCommandHookSchema:e,PromptHookSchema:t,AgentHookSchema:n,HttpHookSchema:r,McpToolHookSchema:o}=FZe();return Za("type",[e,t,n,r,o])}),tX=M(()=>C({matcher:_().optional().describe('String pattern to match (e.g. tool names like "Write")'),hooks:I(eX()).describe("List of hooks to execute when the matcher matches")})),lc=M(()=>h4(q(bc),I(tX())));var tHt=M(()=>q(["local","user","project","dynamic","enterprise","claudeai","managed","agent"])),nHt=M(()=>q(["stdio","sse","sse-ide","http","ws","sdk"])),rd=M(()=>j("comms").optional().catch(void 0)),Hi=M(()=>ee().int().positive()),jZe=300000,nX=M(()=>ee().int().positive().optional().catch(void 0).describe("@internal CCR backend wire hint; folded into timeout at parse."));function rX({request_timeout_ms:e,...t}){return{...t,...t.timeout===void 0&&e!==void 0&&{timeout:Math.min(e,jZe)}}}var $Ze=M(()=>C({type:j("stdio").optional(),command:_().min(1,"Command cannot be empty"),args:I(_()).default([]),env:X(_(),_()).optional(),timeout:Hi().optional(),alwaysLoad:R().optional(),role:rd()})),zZe=M(()=>R()),oX=M(()=>C({clientId:_().optional(),callbackPort:ee().int().positive().optional(),authServerMetadataUrl:_().url().startsWith("https://",{message:"authServerMetadataUrl must use https://"}).optional(),scopes:_().min(1).optional(),xaa:zZe().optional()})),sX=M(()=>C({name:_(),permission_policy:q(["always_allow","always_ask","always_deny"]).optional()})),HZe=M(()=>C({type:j("sse"),url:_(),headers:X(_(),_()).optional(),headersHelper:_().optional(),oauth:oX().optional(),timeout:Hi().optional(),request_timeout_ms:nX(),tools:I(sX()).optional(),alwaysLoad:R().optional(),discoveryCache:R().optional(),role:rd(),toolPermissions:X(_(),_I()).optional()}).transform(rX)),BZe=M(()=>C({type:j("sse-ide"),url:_(),ideName:_(),ideRunningInWindows:R().optional(),timeout:Hi().optional(),alwaysLoad:R().optional(),role:rd()})),KZe=M(()=>C({type:j("ws-ide"),url:_(),ideName:_(),authToken:_().optional(),ideRunningInWindows:R().optional(),timeout:Hi().optional(),alwaysLoad:R().optional(),role:rd()})),GZe=M(()=>C({type:q(["http","streamable-http"]).transform(()=>"http"),url:_(),headers:X(_(),_()).optional(),headersHelper:_().optional(),oauth:oX().optional(),timeout:Hi().optional(),request_timeout_ms:nX(),tools:I(sX()).optional(),alwaysLoad:R().optional(),discoveryCache:R().optional(),role:rd(),toolPermissions:X(_(),_I()).optional()}).transform(rX)),WZe=M(()=>C({type:j("ws"),url:_(),headers:X(_(),_()).optional(),headersHelper:_().optional(),timeout:Hi().optional(),alwaysLoad:R().optional(),role:rd()})),qZe=M(()=>C({type:j("sdk"),name:_(),timeout:Hi().optional(),alwaysLoad:R().optional()})),_I=M(()=>q(["allow","ask","blocked"])),VZe=M(()=>C({type:j("claudeai-proxy"),url:_(),id:_(),displayName:_().optional(),iconUrl:_().optional(),timeout:Hi().optional(),alwaysLoad:R().optional(),toolPermissions:X(_(),_I()).optional(),stateless:R().optional(),cachedInitResponse:X(_(),Ae()).nullish(),discoverSupport:q(["supported","legacy","unknown"]).optional().catch(void 0),cachedDiscoverResponse:X(_(),Ae()).nullish(),eligible:R().nullish(),ineligibleReason:_().nullish(),enterpriseManaged:R().optional()})),OS=M(()=>ce([$Ze(),HZe(),BZe(),KZe(),GZe(),WZe(),qZe(),VZe()]));var rHt=M(()=>C({mcpServers:X(_(),OS())}));function ZZe(e){return gy(e).replace(/ {2,}/g," ").trim()}function yI(e,t=160){let n=ZZe(e);return n.length>t?`${_d(n,t)}…`:n}var vI=500,e5e=32;function pX(){return{sourceCommand:_().max(vI+20).optional().catch(void 0).describe("The `command`-source command the user accepted at explicit install/update. The once-per-session background re-resolve only runs while the marketplace entry still declares this exact command; a changed command (or an entry that became command-sourced later) is skipped with a warning until the user runs an explicit update."),sourceProducerPath:_().max(4096).refine(iX,{message:"must be an absolute path"}).optional().catch(void 0).describe("The directory a `command`-source plugin was last resolved to (what its command printed). Served in place in link mode and re-copied every session in copy mode, so the sandbox write-denies it; refreshed on every install/update, including no-op updates that resolve to a new location."),previousProducerPaths:I(Ae()).transform((e)=>e.filter((t)=>typeof t==="string"&&t.length<=4096&&iX(t)).slice(-e5e)).optional().catch(void 0).describe("Producer directories this installation was resolved to before the current one (most recent last, bounded). A concurrent older session may still serve one of them, so the sandbox keeps write-denying them too.")}}function iX(e){return YZe.isAbsolute(e)||JZe.isAbsolute(e)}var fX=/[^\x20-\x7E]| {4,}/;function wI(){return _().max(vI,{message:"headersHelper must not be longer than the install consent UI can display"}).refine((e)=>!fX.test(e),{message:"headersHelper must be printable ASCII (letters, digits, punctuation, single spaces) with no runs of 4 or more spaces"})}var t5e=new Set(["claude-community","claude-plugins-community","healthcare"]),n5e=new Set(["claude-code-marketplace","claude-code-plugins","claude-plugins-official","anthropic-marketplace","anthropic-plugins","agent-skills","anthropic-agent-skills","life-sciences","knowledge-work-plugins","claude-for-legal","claude-for-financial-services","financial-services-plugins","first-party-plugins"]),mX=new Set([...n5e,...t5e]);var r5e=/(?:official[^a-z0-9]*(anthropic|claude)|(?:anthropic|claude)[^a-z0-9]*official|^(?:anthropic|claude)[^a-z0-9]*(marketplace|plugins|official))/i,o5e=/[^\u0020-\u007E]/;function s5e(e){if(mX.has(e.toLowerCase()))return!1;if(o5e.test(e))return!0;return r5e.test(e)}var os=M(()=>_().startsWith("./")),uc=M(()=>os().endsWith(".json")),aX=M(()=>ce([j("."),os()])),cX=M(()=>ce([os().refine((e)=>e.endsWith(".mcpb")||e.endsWith(".dxt"),{message:"MCPB file path must end with .mcpb or .dxt"}).describe("Path to MCPB file relative to plugin root"),_().url().refine((e)=>e.endsWith(".mcpb")||e.endsWith(".dxt"),{message:"MCPB URL must end with .mcpb or .dxt"}).describe("URL to MCPB file")])),SI=M(()=>os().endsWith(".md")),EI=M(()=>ce([SI(),os()])),hX={inline:"--plugin-dir session plugins",builtin:"built-in plugins","skills-dir":"plugins auto-loaded from .claude/skills/",synced:"plugins synced from your claude.ai account"};function i5e(e){return Object.hasOwn(hX,e)}var gX=M(()=>_().min(1,"Marketplace must have a name").refine((e)=>!e.includes(" "),{message:'Marketplace name cannot contain spaces. Use kebab-case (e.g., "my-marketplace")'}).refine((e)=>!e.includes("/")&&!e.includes("\\")&&!e.includes("..")&&e!==".",{message:'Marketplace name cannot contain path separators (/ or \\), ".." sequences, or be "."'}).refine((e)=>!s5e(e),{message:"Marketplace name impersonates an official Anthropic/Claude marketplace"}).superRefine((e,t)=>{let n=e.toLowerCase();if(!i5e(n))return;t.addIssue({code:"custom",message:`Marketplace name "${n}" is reserved for ${hX[n]}`})})),AI=M(()=>C({name:_().min(1,"Author name cannot be empty").describe("Display name of the plugin author or organization"),email:_().optional().describe("Contact email for support or feedback"),url:_().optional().describe("Website, GitHub profile, or organization URL")})),a5e=M(()=>C({$schema:_().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:_().min(1,"Plugin name cannot be empty").refine((e)=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Unique identifier for the plugin, used for namespacing (prefer kebab-case)"),displayName:_().optional().describe('Human-readable name shown in UI (e.g., "GitHub Utils"). Falls back to `name` when omitted. Unlike `name`, may contain spaces and any casing; not used for namespacing or lookup.'),version:_().optional().describe("Semantic version (e.g., 1.2.3) following semver.org specification"),description:_().optional().describe("Brief, user-facing explanation of what the plugin provides"),author:AI().optional().describe("Information about the plugin creator or maintainer"),homepage:_().url().optional().describe("Plugin homepage or documentation URL"),repository:_().optional().describe("Source code repository URL"),license:_().optional().describe("SPDX license identifier (e.g., MIT, Apache-2.0)"),keywords:I(_()).optional().describe("Tags for plugin discovery and categorization"),defaultEnabled:R().optional().describe("Whether the plugin starts enabled when the user has no explicit enabled/disabled setting for it (default: true). Explicit enabledPlugins values always win, and a plugin required by an enabled dependent is enabled regardless of this value."),dependencies:I(oYe()).optional().describe(`Plugins that must be enabled for this plugin to function. Bare names (no "@marketplace") are resolved against the declaring plugin's own marketplace.`),metadata:st((e)=>pn(e)?e:void 0,X(_(),Ae()).optional()).describe("Free-form metadata for the plugin author's own use (e.g. entitlement or catalog fields). Preserved on the parsed manifest but not read by Claude Code.")})),c5e=1,xHt=M(()=>C({description:_().optional().describe("Brief, user-facing explanation of what these hooks provide"),hooks:qy(()=>lc()).optional().describe("The hooks provided by the plugin, in the same format as the one used for settings"),modules:I(_()).max(c5e,{message:"hooks.json `modules` names one hooks module per plugin; a second entry is refused"}).optional().describe("The hooks module: one path, relative to this hooks.json, of a module exporting register(on). What it hooks and calls is read from its source before it loads; `claude plugin validate` shows the result.")}).refine((e)=>e.hooks!==void 0||(e.modules?.length??0)>0,{message:"hooks.json must have `hooks` (the hook matchers) or `modules` (hooks modules), or both"})),l5e=M(()=>C({hooks:ce([uc().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),qy(()=>lc()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)"),I(ce([uc().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),qy(()=>lc()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)")]))])})),u5e=M(()=>C({source:EI().optional().describe("Path to command markdown file, relative to plugin root"),content:_().optional().describe("Inline markdown content for the command"),description:_().optional().describe("Command description override"),argumentHint:_().optional().describe('Hint for command arguments (e.g., "[file]")'),model:_().optional().describe("Default model for this command"),allowedTools:I(_()).optional().describe("Tools allowed when command runs")}).refine((e)=>e.source&&!e.content||!e.source&&e.content,{message:'Command must have either "source" (file path) or "content" (inline markdown), but not both'})),d5e=M(()=>C({commands:ce([EI().describe("Path to a command file or skill directory, relative to the plugin root. When set, the commands/ directory is not auto-loaded — list its files here if you want both."),I(EI().describe("Path to a command file or skill directory, relative to the plugin root. When set, the commands/ directory is not auto-loaded — list its files here if you want both.")).describe("List of command file or skill directory paths. When set, the commands/ directory is not auto-loaded."),X(_(),u5e()).describe('Object mapping of command names to their metadata and source files. Command name becomes the slash command name (e.g., "about" → "/plugin:about")')])})),p5e=M(()=>C({agents:ce([SI().describe("Path to an agent file, relative to the plugin root. When set, the agents/ directory is not auto-loaded — list its files here if you want both."),I(SI().describe("Path to an agent file, relative to the plugin root. When set, the agents/ directory is not auto-loaded — list its files here if you want both.")).describe("List of agent file paths. When set, the agents/ directory is not auto-loaded.")])})),f5e=M(()=>C({skills:ce([aX().describe('Path to a skill directory, relative to the plugin root ("." / "./" denote the plugin root itself). Loaded in addition to the skills/ directory (except: for a marketplace entry whose source resolves to the marketplace root, declaring a specific subdirectory replaces the skills/ scan).'),I(aX().describe('Path to a skill directory, relative to the plugin root ("." / "./" denote the plugin root itself).')).describe("List of skill directory paths, loaded in addition to the skills/ directory (except: for a marketplace entry whose source resolves to the marketplace root, declaring specific subdirectories replaces the skills/ scan).")])})),m5e=M(()=>ce([_(),I(_())])),_X=M(()=>C({outputStyles:ce([os().describe("Path to an output-styles directory or file, relative to the plugin root. When set, the output-styles/ directory is not auto-loaded — list its files here if you want both."),I(os().describe("Path to an output-styles directory or file, relative to the plugin root. When set, the output-styles/ directory is not auto-loaded — list its files here if you want both.")).describe("List of output-style directory or file paths. When set, the output-styles/ directory is not auto-loaded.")])})),h5e=M(()=>_().max(64).regex(/^[a-z][a-z0-9_-]*$/,"must match ^[a-z][a-z0-9_-]*$")),g5e=16,_5e=M(()=>C({id:h5e(),remote:_().max(256).regex(/^(npm:[@a-z0-9/._-]+(@[a-z0-9._+-]+)?|github:[\w.-]+\/[\w.-]+@[\w./-]+#.+\.js)$/,"must be npm:<pkg>[@ver] or github:<owner>/<repo>@<ref>#<path>.js").optional(),integrity:_().max(512).regex(/^sha(256|384|512)-[A-Za-z0-9+/=]+$/,"must be SRI form: sha256-, sha384-, or sha512-<base64>").optional()}).strict()),y5e=M(()=>C({syntaxHighlighting:C({hljsLanguages:I(_5e()).max(g5e)}).strict()})),yX=M(()=>C({themes:ce([os().describe("Path to a themes directory or file, relative to the plugin root. When set, the themes/ directory is not auto-loaded — list its files here if you want both."),I(os().describe("Path to a themes directory or file, relative to the plugin root. When set, the themes/ directory is not auto-loaded — list its files here if you want both.")).describe("List of theme directory or file paths. When set, the themes/ directory is not auto-loaded.")])})),b5e=M(()=>C({})),lX=M(()=>_().min(1)),S5e=M(()=>_().min(2).refine((e)=>e.startsWith("."),{message:'File extensions must start with dot (e.g., ".ts", not "ts")'})),E5e=M(()=>C({mcpServers:ce([uc().describe("MCP servers to include in the plugin (in addition to those in the .mcp.json file, if it exists)"),cX().describe("Path or URL to MCPB file containing MCP server configuration"),X(_(),OS()).describe("MCP server configurations keyed by server name"),I(ce([uc().describe("Path to MCP servers configuration file"),cX().describe("Path or URL to MCPB file"),X(_(),OS()).describe("Inline MCP server configurations")])).describe("Array of MCP server configurations (paths, MCPB files, or inline definitions)")])})),bX=M(()=>C({type:q(["string","number","boolean","directory","file"]).describe("Type of the configuration value"),title:_().describe("Human-readable label shown in the config dialog"),description:_().describe("Help text shown beneath the field in the config dialog"),required:R().optional().describe("If true, validation fails when this field is empty"),default:ce([_(),ee(),R(),I(_())]).optional().describe("Default value used when the user provides nothing"),multiple:R().optional().describe("For string type: allow an array of strings"),sensitive:R().optional().describe("If true, masks dialog input and stores value in secure storage (keychain/credentials file) instead of settings.json"),min:ee().optional().describe("Minimum value (number type only)"),max:ee().optional().describe("Maximum value (number type only)")}).strict()),x5e=M(()=>C({userConfig:X(_().regex(/^[A-Za-z_]\w*$/,"Option keys must be valid identifiers (letters, digits, underscore; no leading digit) — they become CLAUDE_PLUGIN_OPTION_<KEY> env vars in hooks"),bX()).optional().describe("User-configurable values this plugin needs. Prompted at enable time. Non-sensitive values saved to settings.json; sensitive values to secure storage. Available as ${user_config.KEY} in MCP/LSP server config, hook commands, and (non-sensitive only) skill/agent content. Keep sensitive value counts small.")})),v5e=M(()=>C({channels:I(C({server:_().min(1).describe("Name of the MCP server this channel binds to. Must match a key in this plugin's mcpServers."),displayName:_().optional().describe('Human-readable name shown in the config dialog title (e.g., "Telegram"). Defaults to the server name.'),userConfig:X(_(),bX()).optional().describe("Fields to prompt the user for when enabling this plugin in assistant mode. Saved values are substituted into ${user_config.KEY} references in the mcpServers env.")}).strict()).describe("Channels this plugin provides. Each entry declares an MCP server as a message channel and optionally specifies user configuration to prompt for at enable time.")})),uX=M(()=>fO({command:_().min(1).refine((e)=>{if(e.includes(" ")&&!e.startsWith("/"))return!1;return!0},{message:"Command should not contain spaces. Use args array for arguments."}).describe('Command to execute the LSP server (e.g., "typescript-language-server")'),args:I(lX()).optional().describe("Command-line arguments to pass to the server"),extensionToLanguage:X(S5e(),lX()).refine((e)=>Object.keys(e).length>0,{message:"extensionToLanguage must have at least one mapping"}).describe("Mapping from file extension to LSP language ID. File extensions and languages are derived from this mapping."),transport:q(["stdio","socket"]).default("stdio").describe("Communication transport mechanism"),env:X(_(),_()).optional().describe("Environment variables to set when starting the server"),initializationOptions:Ae().optional().describe("Initialization options passed to the server during initialization"),settings:Ae().optional().describe("Settings passed to the server via workspace/didChangeConfiguration"),workspaceFolder:_().optional().describe("Workspace folder path to use for the server"),startupTimeout:ee().int().positive().optional().describe("Maximum time to wait for server startup (milliseconds)"),shutdownTimeout:ee().int().positive().optional().describe("Maximum time to wait for graceful shutdown (milliseconds)"),restartOnCrash:R().optional().describe("Whether to restart the server if it crashes"),maxRestarts:ee().int().nonnegative().optional().describe("Maximum number of restart attempts before giving up"),diagnostics:R().optional().describe("Whether to push publishDiagnostics into the agent context after edits. Set to false to keep LSP navigation (goToDefinition, hover, etc.) but suppress automatic diagnostic injection. Defaults to true.")})),w5e=M(()=>fO({name:_().min(1).describe("Identifier for this monitor, unique within the plugin. Used to dedupe so re-arming (plugin reload, repeat skill invoke) does not spawn duplicates."),command:_().min(1).describe('Shell command to run as a persistent background monitor. Each stdout line is delivered to the model as a <task_notification> event; the process runs for the session lifetime. ${CLAUDE_PLUGIN_ROOT}, ${CLAUDE_PLUGIN_DATA}, ${CLAUDE_PROJECT_DIR}, ${user_config.*}, and ${ENV_VAR} are substituted. Runs in the session cwd — prefix with `cd "${CLAUDE_PLUGIN_ROOT}" && ` if the script needs its own directory.'),description:_().min(1).describe("Short human-readable description of what is being monitored (shown in task panel and notification summary)."),when:ce([j("always"),_().startsWith("on-skill-invoke:").refine((e)=>e.length>16,{message:"on-skill-invoke: must specify a skill name"})]).default("always").describe('Arm trigger. "always" arms at session start and on plugin reload. "on-skill-invoke:<skill>" arms the first time that skill is dispatched (via Skill tool or slash command).')})),A5e=M(()=>I(w5e()).refine((e)=>new Set(e.map((t)=>t.name)).size===e.length,{message:"Monitor names must be unique within a plugin"})),SX=M(()=>C({monitors:ce([uc().describe("Path to a JSON file containing the monitors array, relative to the plugin root"),A5e()]).describe("Background watch scripts the host arms as persistent Monitor tasks (unsandboxed, same trust tier as hooks) so plugins need not instruct the model to arm them. When omitted, monitors/monitors.json at the plugin root is loaded if present.")})),T5e=M(()=>C({lspServers:ce([uc().describe("Path to .lsp.json configuration file relative to plugin root"),X(_(),uX()).describe("LSP server configurations keyed by server name"),I(ce([uc().describe("Path to LSP configuration file"),X(_(),uX()).describe("Inline LSP server configurations")])).describe("Array of LSP server configurations (paths or inline definitions)")])})),EX=M(()=>_().refine((e)=>!e.includes("..")&&!e.includes("//"),"Package name cannot contain path traversal patterns").refine((e)=>{let t=/^@[a-z0-9][a-z0-9-._]*\/[a-z0-9][a-z0-9-._]*$/,n=/^[a-z0-9][a-z0-9-._]*$/;return t.test(e)||n.test(e)},"Invalid npm package name format")),C5e=/^[a-z0-9](?:[a-z0-9._-]*[a-z0-9_-])?$/,k5e=/^[0-9a-f]{64}$/;var R5e=64;var O5e=M(()=>C({sha256:_().regex(k5e)}));function P5e(e){let t=X(_(),Ae()).safeParse(e);if(!t.success)return;let n=Object.create(null),r=0;for(let[o,s]of Object.entries(t.data)){if(r>=R5e)break;let i=O5e().safeParse(s);if(C5e.test(o)&&i.success)n[o]=i.data,r++}return r>0?n:void 0}var I5e=M(()=>C({binaries:Ae().transform(P5e).describe("sha256-pinned files to fetch into bin/ at install time, keyed by basename (target triple encoded in the name)")})),D5e=M(()=>C({settings:X(_(),Ae()).optional().describe("Settings to merge into the user settings while this plugin is enabled. Only the documented allowlisted keys are applied.")})),L5e=M(()=>C({experimental:st((e)=>pn(e)?e:void 0,C({...yX().partial().shape,...y5e().partial().shape,...SX().partial().shape,..._X().partial().shape,evals:m5e().optional().describe("Directory of eval cases for the plugin evaluation harness, relative to the plugin root (default: evals/). A list is accepted; its first entry is the case directory.")}).passthrough().optional().describe("Components whose manifest shape may change without a deprecation cycle. Move a key out of here once it is promoted to stable."))}));var M5e=M(()=>C({...a5e().shape,...l5e().partial().shape,...d5e().partial().shape,...p5e().partial().shape,...f5e().partial().shape,..._X().partial().shape,...yX().partial().shape,...b5e().shape,...v5e().partial().shape,...E5e().partial().shape,...T5e().partial().shape,...SX().partial().shape,...D5e().partial().shape,...x5e().partial().shape,...I5e().partial().shape,...L5e().partial().shape})),xX=new Set(["url","github","git","npm","file","directory","skills-dir","hostPattern","pathPattern","settings"]),od=M(()=>Za("source",[C({source:j("url"),url:_().url().describe("Direct URL to marketplace.json file"),headers:X(_(),_()).optional().describe("Custom HTTP headers (e.g., for authentication)"),headersHelper:wI().optional().describe("Command that prints a JSON object of HTTP headers (e.g. a short-lived auth token). Its output overrides `headers` and, like `headers`, is inherited by same-origin archive downloads from this marketplace. Runs from a fixed directory (the Claude config home, never the session's), so give a bare command found via PATH or an absolute path; it is re-run on later refreshes of this marketplace.")}),C({source:j("github"),repo:_().describe('GitHub repository in owner/repo format. ONLY in the managed-settings policy lists (strictKnownMarketplaces / blockedMarketplaces) the owner-wildcard form "owner/*" matches every repository under exactly that owner. Everywhere else (marketplace add, extraKnownMarketplaces, known_marketplaces.json) the value '+"must name a single repository — a wildcard is taken literally and fails to clone."),ref:_().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:_().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:I(_()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.'),skipLfs:R().optional().describe("Skip Git LFS smudge during clone and update (sets GIT_LFS_SKIP_SMUDGE=1) so LFS pointer files stay as pointers instead of downloading their content. Use for marketplaces hosted in repos with large LFS objects.")}),C({source:j("git"),url:_().describe("Full git repository URL"),ref:_().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:_().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:I(_()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.'),skipLfs:R().optional().describe("Skip Git LFS smudge during clone and update (sets GIT_LFS_SKIP_SMUDGE=1) so LFS pointer files stay as pointers instead of downloading their content. Use for marketplaces hosted in repos with large LFS objects.")}),C({source:j("npm"),package:EX().describe("NPM package containing marketplace.json")}),C({source:j("file"),path:_().describe("Local file path to marketplace.json")}),C({source:j("directory"),path:_().describe("Local directory containing .claude-plugin/marketplace.json")}),C({source:j("skills-dir")}).describe("Policy-list sentinel for the ~/.claude/skills/ auto-load (@skills-dir plugins). In strictKnownMarketplaces: opt the scan back IN (by default any allowlist blocks it). In blockedMarketplaces: turn the scan OFF without otherwise restricting marketplaces. Only meaningful in those two managed-settings lists (areLocalPluginDirsAllowedByPolicy); known_marketplaces.json / marketplace add etc. ignore it."),C({source:j("hostPattern"),hostPattern:_().describe('Regex pattern to match the host/domain extracted from any marketplace source type. For github sources, matches against github.com. For git sources (SSH or HTTPS), extracts the hostname from the URL. Use in strictKnownMarketplaces to allow all marketplaces from a specific host (e.g., "^github\\.mycompany\\.com$").')}),C({source:j("pathPattern"),pathPattern:_().describe('Regex pattern matched against the .path field of file and directory sources. Use in strictKnownMarketplaces to allow filesystem-based marketplaces alongside hostPattern restrictions for network sources. Use ".*" to allow all filesystem paths, or a narrower pattern (e.g., "^/opt/approved/") to restrict to specific directories.')}),C({source:j("settings"),name:gX().refine((e)=>!mX.has(e.toLowerCase()),{message:"Reserved marketplace names cannot be used with settings sources. validateOfficialNameSource only accepts github/git sources from anthropics/* for these names; a settings source would be rejected after loadAndCacheMarketplace has already written to disk with cleanupNeeded=false."}).describe("Marketplace name. Must match the extraKnownMarketplaces key (enforced); the synthetic manifest is written under this name. Same validation "+"as PluginMarketplaceSchema plus reserved-name rejection — "+"validateOfficialNameSource runs after the disk write, too late to clean up."),plugins:I($5e()).describe("Plugin entries declared inline in settings.json"),owner:AI().optional()}).describe("Inline marketplace manifest defined directly in settings.json. The reconciler writes a synthetic marketplace.json to the cache; diffMarketplaces detects edits via isEqual on the stored source (the plugins array is inside this object, so edits surface as sourceChanged).")])),bI=M(()=>_().length(40).regex(/^[a-f0-9]{40}$/,"Must be a full 40-character lowercase git commit SHA")),N5e=M(()=>_().regex(/^[0-9a-fA-F]{64}$/,"Must be a 64-character hex SHA-256 digest"));function xI(e){let t=e.toLowerCase().replace(/^\[|\]$/g,"");if(t.endsWith("."))t=t.slice(0,-1);if(t===""||t==="localhost"||t.endsWith(".localhost"))return!0;if(XZe(t)){let[s=0,i=0,a=0,c=0]=t.split(".").map(Number);return s===127||s===169&&i===254||s===0||s===100&&i===100&&a===100&&c===200}if(!QZe(t))return!1;let n=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/.exec(t);if(n?.[1])return xI(n[1]);let r=/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/.exec(t);if(r?.[1]!==void 0&&r[2]!==void 0){let s=parseInt(r[1],16),i=parseInt(r[2],16);return xI(`${s>>8}.${s&255}.${i>>8}.${i&255}`)}if(t==="::1"||t==="::"||t==="fd00:ec2::254")return!0;let o=parseInt(/^([0-9a-f]{1,4}):/.exec(t)?.[1]??"0",16);return o>=65152&&o<=65215}var U5e="Archive URLs must use https:// and must not point at a loopback, link-local, or cloud-metadata host";function F5e(e){try{let t=new URL(e);return t.protocol==="https:"&&!xI(t.hostname)}catch{return!1}}var j5e=M(()=>C({source:j("archive"),url:_().url().refine(F5e,{message:U5e}).describe("HTTPS URL of a zip archive containing the plugin. The plugin root (the directory holding .claude-plugin/) may be at the top of the archive "+"or nested one directory deep — a single wrapping directory is stripped."),sha256:N5e().optional().describe("SHA-256 digest of the archive. When set, every download is verified against it and the install is refused on mismatch. It also serves as the version identity when neither plugin.json nor the marketplace entry declares a `version`. Recommended. Note the update signal is the version string (plugin.json "+"version, else the entry version, else this digest) — changing only the digest "+"while a version is declared does not trigger an update.")}).describe("Plugin distributed as a zip archive fetched over HTTPS — for hosting on any "+"static file server or artifact repository (S3, GitLab, nginx) with no git or npm on the client. Authentication: the entry's own `headers` / `headersHelper` (bound to this URL), overlaid on the enclosing url-source marketplace's headers (static or `headersHelper`-minted) when the archive shares its origin.")),vX=M(()=>ce([st((e)=>e==="."?"./":e,os()).describe("Path to the plugin root, relative to the marketplace root (the directory containing .claude-plugin/, not .claude-plugin/ itself)"),C({source:j("npm"),package:EX().or(_().refine((e)=>/^(?:file|https?|git(?:\+https?|\+ssh)?|ssh|github|gitlab|bitbucket):/i.test(e)||!e.includes(".."),'Package reference cannot contain ".." path segments')).describe("Package name (or url, or local path, or anything else that can be passed to `npm` as a package)"),version:_().optional().describe("Specific version or version range (e.g., ^1.0.0, ~2.1.0)"),registry:_().url().optional().describe("Custom NPM registry URL (defaults to using system default, likely npmjs.org)")}).describe("NPM package as plugin source"),C({source:j("url"),url:_().describe("Full git repository URL (https:// or git@)"),ref:_().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:bI().optional().describe("Specific commit SHA to use")}),C({source:j("github"),repo:_().describe("GitHub repository in owner/repo format"),ref:_().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:bI().optional().describe("Specific commit SHA to use")}),C({source:j("git-subdir"),url:_().describe("Git repository: GitHub owner/repo shorthand, https://, or git@ URL"),path:_().min(1).describe('Subdirectory within the repo containing the plugin (e.g., "tools/claude-plugin"). Cloned sparsely using partial clone (--filter=tree:0) to minimize bandwidth for monorepos.'),ref:_().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:bI().optional().describe("Specific commit SHA to use")}).describe("Plugin located in a subdirectory of a larger repository (monorepo). Only the specified subdirectory is materialized; the rest of the repo is not downloaded."),j5e(),C({source:j("command"),command:_().min(1).max(vI,{message:"command must not be longer than the install consent UI can display"}).refine((e)=>!fX.test(e),{message:"command must be printable ASCII (letters, digits, punctuation, single spaces) with no runs of 4 or more spaces"}).describe("Shell command that prints the absolute path of the plugin directory on stdout (exactly one line) and exits 0. It must leave a complete plugin in that directory before exiting; the directory is copied into the plugin cache, so the printed path may change between runs (it is re-resolved on every install and update, and once per session in the background). Runs through the platform shell (sh on macOS/Linux, cmd.exe on Windows) from the user's home directory with Claude Code's subprocess environment."),timeout:ee().int().positive().max(600).optional().describe("Seconds to wait for the command before giving up (default: 60)"),mode:q(["copy","link"]).optional().describe("copy (default): the printed directory is copied into the plugin cache and content-hashed, so it may be deleted afterwards. link: the cache entry links to the printed directory "+"in place (no copy, no size limit; macOS/Linux) — for large exports; the directory must then stay "+"valid while Claude Code runs, and a different printed path is what signals new content.")}).describe("Plugin directory produced by a locally installed tool (e.g. an IDE that renders its plugin for the currently selected SDK). Claude Code runs the command, copies the directory it prints, and re-runs it in the background at startup to pick up changes."),C({source:j("unsupported"),error:_().optional()}).describe("Placeholder for source types this Claude Code version does not recognize, or a known type whose fields failed validation (then `error` "+"holds the reason). Never authored by hand — PluginMarketplaceSchema rewrites "+"unparseable sources to this so the entry remains in marketplace.plugins (detectDelistedPlugins must not see it as removed). Install attempts fail at cachePlugin with an actionable message.")])),$5e=M(()=>C({name:_().min(1,"Plugin name cannot be empty").refine((e)=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Plugin name as it appears in the target repository"),source:vX().describe("Where to fetch the plugin from. Must be a remote source — relative "+"paths have no marketplace repository to resolve against."),description:_().optional(),version:_().optional(),strict:R().optional(),headers:X(_(),_()).optional().describe("HTTP headers sent when downloading this entry's `archive` source."),headersHelper:wI().optional().describe("Command that prints a JSON object of HTTP headers for downloading this entry's `archive` source. Runs only when a user explicitly installs or updates this plugin. Unlike a catalog entry, an entry written here does not need `strict: false`: it is declared in a settings file, which has no manifest fields to inline. A declaration in project settings is not operator-authored, so request-routing and client-identity header names are still filtered there. Use an absolute path.")}).refine((e)=>typeof e.source!=="string",{message:'Plugins in a settings-sourced marketplace must use remote sources (github, git-subdir, npm, url, archive, command). Relative-path sources like "./foo" have no marketplace repository to resolve against.'}).refine((e)=>typeof e.source==="string"||e.source.source!=="unsupported",{message:"source.source: 'unsupported' is a parse-time placeholder and cannot be authored. Use a remote source (github, git-subdir, npm, url, archive, command)."}));var z5e=M(()=>C({cli:I(_().max(64)).max(10).optional().describe('First command tokens (e.g. ["stripe"]) — exact match against commands run this session.'),hosts:I(_().max(128)).max(20).optional().describe('Hostnames (e.g. ["api.stripe.com"]) — exact, case-insensitive match against '+"hostnames seen in https?:// URLs in bash commands run this session. Bare hostname only: lowercase, no scheme, no port, no path."),filesRead:I(_().max(256)).max(10).optional().describe('Glob patterns (e.g. ["**/*.tf"]) — the plugin is relevant when a file Claude has read '+"this session matches any pattern. Matched against read-file paths, forward-slash normalized, case-insensitive."),manifestDeps:I(C({file:_().max(256),pattern:_().max(256)})).max(10).optional().describe("Dependency declared in a package manifest. Each {file, pattern} is a pair of RegExp sources: "+"`file` matches the manifest filename (package.json, go.mod, requirements.txt, …); "+"`pattern` matches the dependency declaration inside that file. Evaluated against files read this session."),cwd:I(_().max(256)).max(10).optional().describe('Glob patterns (e.g. ["Engine/Source/Runtime/Renderer/**"]) — the plugin is relevant when the '+`session's working directory is at or under a directory matching the pattern. Matched against the cwd both relative to the enclosing git repo root and as an absolute path, forward-slash normalized, case-insensitive. A bare directory (no glob characters) means "cwd is at or under this directory". Known at session start, so this signal can surface a suggestion before the first turn.`)})),H5e=M(()=>C({topic:_().max(64).optional().describe('What the user is working with when this plugin is relevant — fills "Working with {topic}?". '+'Often the product name (e.g. "Stripe"); use a domain (e.g. "design") when the plugin name does not read naturally as a topic. Defaults to the plugin name with each hyphen-segment capitalized.'),signals:z5e().optional().describe("Matchers that determine when the plugin is relevant.")})),B5e=M(()=>M5e().partial().extend({name:_().min(1,"Plugin name cannot be empty").refine((e)=>!e.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Unique identifier matching the plugin name"),source:vX().describe("Where to fetch the plugin from"),headers:X(_(),_()).optional().describe("Custom HTTP headers for fetching this plugin's archive; overrides the marketplace's"),headersHelper:wI().optional().describe("Command that prints a JSON object of HTTP headers for fetching this plugin's archive (e.g. a short-lived auth token); overrides this entry's `headers` and the marketplace's. Runs only when the user installs or updates this plugin, never during catalog browse. An entry that sets it must be `strict: false` with its manifest inlined here, so consent is informed from the entry alone before the command runs."),category:_().optional().describe('Category for organizing plugins (e.g., "productivity", "development")'),tags:I(_()).optional().describe("Tags for searchability and discovery"),strict:R().optional().default(!0).describe("Require the plugin manifest to be present in the plugin folder. If false, the marketplace entry provides the manifest."),relevance:st((e)=>pn(e)?e:void 0,H5e().optional()).describe(`Declares when this plugin is relevant to the user's work. Consumed by the spinner tip ("Working with {topic}?"), session-start auto-suggest, and marketplace browse ranking.`)})),K5e=M(()=>C({name:_().min(1).refine((e)=>!e.includes(" "))}));function G5e(e){let t=B5e();return e.flatMap((n,r)=>{let o=t.safeParse(n);if(o.success){let a=o.data.source;if(typeof a==="object"&&a.source==="unsupported"&&a.error!==void 0)return[{...o.data,source:{source:"unsupported"}}];return[o.data]}let s=K5e().safeParse(n).data?.name,i=o.error.issues.map((a)=>`${a.path.join(".")}: ${a.message}`).join(", ");if(s){de(`Stubbing unparseable marketplace plugin entry (${s}): ${i}`,{level:"warn"});let a=wX(pn(n)?n.source:void 0)?X5e:TI(n)?void 0:q5e(o.error.issues)??PS(o.error.issues);return[{name:s,source:{source:"unsupported",...a&&{error:a}},strict:!0}]}return de(`Dropping unparseable marketplace plugin entry (index ${r}): ${i}`,{level:"warn"}),[]})}var W5e=new Set(["npm","url","github","git-subdir","archive","command","unsupported"]);function TI(e){if(!e||typeof e!=="object")return!1;let t=e.source;if(!t||typeof t!=="object")return!1;let n=t.source;return typeof n==="string"&&!W5e.has(n)}function q5e(e){let t=e.find((r)=>r.path.length===1&&r.path[0]==="source");if(!t||t.code!=="invalid_union")return;let n=t.errors.find((r)=>!r.some((o)=>o.path.length===0||o.code==="invalid_value"&&o.path[0]==="source"));if(!n||n.length===0)return;return PS(n.map((r)=>({...r,path:["source",...r.path]})))}var V5e=/^[A-Za-z0-9_$.-]{1,40}$/;function dc(e){return V5e.test(e)?e:"<key>"}var Z5e=3,Y5e=160;function PS(e){let t=e.slice(0,Z5e).map((r)=>{let o=r.path.map(String).map((i)=>dc(i)).join("."),s=r.code==="unrecognized_keys"?`Unrecognized ${r.keys.length===1?"field":"fields"}: ${r.keys.map(dc).join(", ")}`:yI(r.message,Y5e);return o?`${o}: ${s}`:s}),n=e.length-t.length;return n>0?`${t.join(", ")} (+${n} more)`:t.join(", ")}var J5e=/^[A-Za-z0-9][-A-Za-z0-9._]*$/,X5e='Bare source names resolve under metadata.pluginRoot, which this marketplace does not set (or sets to a path outside the marketplace root). Use a "./relative/path" source, or set metadata.pluginRoot to allow bare names.';function wX(e){return typeof e==="string"&&J5e.test(e)&&!e.includes("..")}function Q5e(e){if(typeof e!=="string"||e===""||e.startsWith("/")||e.includes("\\")||e.includes(":"))return;let t=e.replace(/^\.\//,"").replace(/\/+$/,"");if(t===""||t===".")return".";if(t.split("/").some((n)=>n===""||n==="."||n===".."))return;return t}function eYe(e,t){if(t===void 0||!pn(e)||!wX(e.source))return e;let n=t==="."?`./${e.source}`:`./${t}/${e.source}`;return{...e,source:n}}function tYe(e){if(!pn(e)||!Array.isArray(e.plugins))return e;let t=pn(e.metadata)?Q5e(e.metadata.pluginRoot):void 0;if(t===void 0)return e;return{...e,plugins:e.plugins.map((n)=>eYe(n,t))}}var nYe=M(()=>C({$schema:_().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:gX(),version:_().optional().describe("Marketplace manifest version"),description:_().optional().describe("Human-readable description of this marketplace"),owner:AI().describe("Marketplace maintainer or curator information"),plugins:I(Ae()).transform(G5e).describe("Collection of available plugins in this marketplace"),forceRemoveDeletedPlugins:R().optional().describe("When true, plugins removed from this marketplace will be automatically uninstalled and flagged for users"),metadata:C({pluginRoot:_().optional().describe('Base directory for bare plugin source names, relative to the marketplace root (e.g. "./plugins" resolves "source": "formatter" as ./plugins/formatter). Sources that already start with "./" are unaffected.'),version:_().optional().describe("Marketplace version"),description:_().optional().describe("Marketplace description")}).optional().describe("Optional marketplace metadata"),allowCrossMarketplaceDependenciesOn:I(_()).optional().describe("Marketplace names whose plugins may be auto-installed as dependencies. Only the root marketplace's allowlist applies — no transitive trust."),renames:X(_(),_().nullable()).optional().catch(void 0).describe("Append-only map of old plugin name → current name (or null when removed). The loader follows this on plugin-not-found and migrates user settings to the new name.")})),vHt=M(()=>st(tYe,nYe())),dX="[A-Za-z0-9][-A-Za-z0-9._]*",AX=M(()=>_().regex(new RegExp(`^${dX}@${dX}$`),"Plugin ID must be in format: plugin@marketplace")),wHt=new RegExp(`[@:\\s/\\\\${gu}]`,"u"),AHt=new RegExp(`[${gu}]`,"u"),rYe=/^[A-Za-z0-9][-A-Za-z0-9._]*(@[A-Za-z0-9][-A-Za-z0-9._]*)?(@\^[^@]*)?$/,oYe=M(()=>ce([_().regex(rYe,"Dependency must be a plugin name, optionally qualified with @marketplace").transform((e)=>e.replace(/@\^[^@]*$/,"")),C({name:_().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/),marketplace:_().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/).optional()}).loose().transform((e)=>e.marketplace?`${e.name}@${e.marketplace}`:e.name)])),sYe=M(()=>C({version:_().describe("Currently installed version"),installedAt:_().describe("ISO 8601 timestamp of installation"),lastUpdated:_().optional().describe("ISO 8601 timestamp of last update"),installPath:_().describe("Absolute path to the installed plugin directory"),gitCommitSha:_().optional().describe("Git commit SHA for git-based plugins (for version tracking)"),resolvedVersion:_().optional().describe("Tag-derived semver this install resolved to (when fetched via a version constraint). Used by verifyAndDemote in preference to manifest.version, since the upstream may have forgotten to bump plugin.json."),auto:R().optional().describe("True when this plugin was pulled in as a dependency rather than installed explicitly. Auto-installed plugins are eligible for removal by the orphan sweep when nothing depends on them. Absent = manual (preserves pre-flag installs)."),...pX()})),THt=M(()=>C({version:j(1).describe("Schema version 1"),plugins:X(AX(),sYe()).describe("Map of plugin IDs to their installation metadata")})),iYe=M(()=>q(["managed","user","project","local"])),aYe=M(()=>C({scope:iYe().describe("Installation scope"),projectPath:_().optional().describe("Project path (required for project/local scopes)"),installPath:_().describe("Absolute path to the versioned plugin directory"),version:_().optional().describe("Currently installed version"),installedAt:_().optional().describe("ISO 8601 timestamp of installation"),lastUpdated:_().optional().describe("ISO 8601 timestamp of last update"),gitCommitSha:_().optional().describe("Git commit SHA for git-based plugins"),resolvedVersion:_().optional().describe("Tag-derived semver this install resolved to"),auto:R().optional().describe("True when pulled in as a dependency. Eligible for orphan sweep."),...pX()})),CHt=M(()=>C({version:j(2).describe("Schema version 2"),plugins:X(AX(),I(aYe())).describe("Map of plugin IDs to arrays of installation entries")})),cYe=M(()=>C({source:od().describe("Where to fetch the marketplace from"),installLocation:_().describe("Local cache path where marketplace manifest is stored"),lastUpdated:_().describe("ISO 8601 timestamp of last marketplace refresh"),autoUpdate:R().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),kHt=M(()=>X(_(),cYe()));var IS=["aspell","hunspell","ispell"];var lYe=["autoMode","deepLink","voice","briefView","screenReader"],CI={},DS={autoMode:{buildGate:()=>!1,shape:()=>CI,permissionsShape:()=>CI,permissionModes:()=>[]},deepLink:{buildGate:()=>!0,shape:()=>({disableDeepLinkRegistration:q(["disable"]).optional().describe("Prevent claude-cli:// protocol handler registration with the OS")})},voice:{buildGate:()=>!0,shape:()=>({voiceEnabled:R().optional().describe("Enable voice mode (hold-to-talk dictation)")})},briefView:{buildGate:()=>!0,shape:()=>({defaultView:q(["chat","transcript"]).optional().describe("Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)")})},screenReader:{buildGate:()=>!1,shape:()=>CI}};function nh(){return lYe.filter((e)=>DS[e].buildGate())}function TX(e){let t={};for(let n of e)t={...t,...DS[n].shape()};return t}function CX(e){let t={};for(let n of e)t={...t,...DS[n].permissionsShape?.()};return t}function kX(e){let t=[];for(let n of e)t.push(...DS[n].permissionModes?.()??[]);return t}var RX={Task:"Agent",KillShell:"TaskStop",KillBash:"TaskStop",AgentOutputTool:"TaskOutput",BashOutputTool:"TaskOutput",AgentOutput:"TaskOutput",BashOutput:"TaskOutput",ListPeers:"ListAgents",Brief:"SendUserMessage",ListMcpResources:"ListMcpResourcesTool",ReadMcpResource:"ReadMcpResourceTool",ReadMcpResourceDir:"ReadMcpResourceDirTool"};function sd(e){return Object.hasOwn(RX,e)?RX[e]:e}var OX="workspace",MHt=`mcp__${OX}__bash`,NHt=`mcp__${OX}__web_fetch`;function LS(e){return e.includes("*")}function uYe(e){return e.replaceAll("\\","\\\\").replaceAll("(","\\(").replaceAll(")","\\)")}function dYe(e){return e.replaceAll("\\(","(").replaceAll("\\)",")").replaceAll("\\\\","\\")}function PX(e){let t=pYe(e,"(");if(t===-1)return{toolName:sd(e)};let n=fYe(e,")");if(n===-1||n<=t)return{toolName:sd(e)};if(n!==e.length-1)return{toolName:sd(e)};let r=e.substring(0,t),o=e.substring(t+1,n);if(!r)return{toolName:sd(e)};if(o===""||o==="*")return{toolName:sd(r)};let s=dYe(o);return{toolName:sd(r),ruleContent:s}}function MS(e){if(!e.ruleContent)return e.toolName;let t=uYe(e.ruleContent);return`${e.toolName}(${t})`}function pYe(e,t){for(let n=0;n<e.length;n++)if(e[n]===t){let r=0,o=n-1;while(o>=0&&e[o]==="\\")r++,o--;if(r%2===0)return n}return-1}function fYe(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t){let r=0,o=n-1;while(o>=0&&e[o]==="\\")r++,o--;if(r%2===0)return n}return-1}function kI(e){let t=e.split("__"),[n,r,...o]=t;if(n!=="mcp"||!r)return null;let s=o.length>0?o.join("__"):void 0;return{serverName:r,toolName:s}}var NS={filePatternTools:["Read","Write","Edit","Glob","NotebookRead","NotebookEdit","Cd"],bashPrefixTools:["Bash"],customValidation:{WebSearch:(e)=>{if(e.includes("*")||e.includes("?"))return{valid:!1,error:"WebSearch does not support wildcards",suggestion:"Use exact search terms without * or ?",examples:["WebSearch(claude ai)","WebSearch(typescript tutorial)"]};return{valid:!0}},WebFetch:(e)=>{if(e.includes("://")||e.startsWith("http"))return{valid:!1,error:"WebFetch permissions use domain format, not URLs",suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:github.com)"]};if(!e.startsWith("domain:"))return{valid:!1,error:'WebFetch permissions must use "domain:" prefix',suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:*.google.com)"]};return{valid:!0}}}};function IX(e){return NS.filePatternTools.includes(e)}function DX(e){return NS.bashPrefixTools.includes(e)}function LX(e){return Object.hasOwn(NS.customValidation,e)?NS.customValidation[e]:void 0}function OI(e,t){let n=0,r=t-1;while(r>=0&&e[r]==="\\")n++,r--;return n%2!==0}function RI(e,t){let n=0;for(let r=0;r<e.length;r++)if(e[r]===t&&!OI(e,r))n++;return n}function mYe(e){for(let t=0;t<e.length-1;t++)if(e[t]==="("&&e[t+1]===")"){if(!OI(e,t))return!0}return!1}var hYe=/^(?:[|&;<>]|\d+[<>])/;function gYe(e){return hYe.test(e)}function MX(e){for(let t=0;t<e.length;t++)if(e[t]==="*"&&!OI(e,t))return!0;return!1}function _Ye(e){if(e.endsWith(":*"))return;let t=e.trim().split(/\s+/).filter(Boolean),n=t[0];if(t.length<3||n===void 0||MX(n))return;let r=!1;for(let o of t.slice(1)){if(gYe(o))return;if(MX(o)){r=!0;continue}if(o.startsWith("-"))continue;return r?n:void 0}return}function NX(e){if(!LS(e))return null;let t=kI(e);if(t&&!LS(t.serverName))return null;return{valid:!1,error:`Wildcard tool name "${e}" is not supported in allow rules`,suggestion:"An allow pattern must name the scope it widens — globs are permitted only in the tool position after a literal mcp__<server>__ prefix. Deny and ask rules accept wildcards anywhere",examples:["mcp__puppeteer__*","mcp__github__get_*"]}}function PI(e,t){if(!e||e.trim()==="")return{valid:!1,error:"Permission rule cannot be empty"};let n=RI(e,"("),r=RI(e,")");if(n!==r)return{valid:!1,error:"Mismatched parentheses",suggestion:"Ensure all opening parentheses have matching closing parentheses"};if(mYe(e)){let a=e.substring(0,e.indexOf("("));if(!a)return{valid:!1,error:"Empty parentheses with no tool name",suggestion:"Specify a tool name before the parentheses"};return{valid:!1,error:"Empty parentheses",suggestion:`Either specify a pattern or use just "${a}" without parentheses`,examples:[`${a}`,`${a}(some-pattern)`]}}let o=PX(e),s=kI(o.toolName);if(s){if(o.ruleContent!==void 0||RI(e,"(")>0)return{valid:!1,error:"MCP rules do not support patterns in parentheses",suggestion:`Use "${o.toolName}" without parentheses, or use "mcp__${s.serverName}__*" for all tools`,examples:[`mcp__${s.serverName}`,`mcp__${s.serverName}__*`,s.toolName&&s.toolName!=="*"?`mcp__${s.serverName}__${s.toolName}`:void 0].filter(Boolean)};if(t==="allow"){let a=NX(o.toolName);if(a)return a}return{valid:!0}}if(!o.toolName||o.toolName.length===0)return{valid:!1,error:"Tool name cannot be empty"};if(t==="allow"){let a=NX(o.toolName);if(a)return a}if(!o.toolName.includes("_")&&o.toolName[0]!==o.toolName[0]?.toUpperCase())return{valid:!1,error:"Tool names must start with uppercase",suggestion:`Use "${gd(String(o.toolName))}"`};let i=LX(o.toolName);if(i&&o.ruleContent!==void 0){let a=i(o.ruleContent);if(!a.valid)return a}if(DX(o.toolName)&&o.ruleContent!==void 0){let a=o.ruleContent;if(a.includes(":*")&&!a.endsWith(":*"))return{valid:!1,error:"The :* pattern must be at the end",suggestion:"Move :* to the end for prefix matching, or use * for wildcard matching",examples:["Bash(npm run:*) - prefix matching (legacy)","Bash(npm run *) - wildcard matching"]};if(a===":*")return{valid:!1,error:"Prefix cannot be empty before :*",suggestion:"Specify a command prefix before :*",examples:["Bash(npm *)","Bash(git *)"]};if(t==="allow"){let c=_Ye(a);if(c!==void 0){let l=c==="git",u=l?" For git, options such as -c and --exec-path can run arbitrary commands.":"",p=l?" (for example Bash(git status *))":"";return{valid:!0,warning:`${MS(o)} has a wildcard before the rest of the command, so it also matches any options inserted at that position and approves them without a prompt.${u} Replace that * with the exact value you mean, or only use * after the subcommand${p}.`}}}}if(IX(o.toolName)&&o.ruleContent!==void 0){if(o.ruleContent.includes(":*"))return{valid:!1,error:'The ":*" syntax is only for Bash prefix rules',suggestion:'Use glob patterns like "*" or "**" for file matching',examples:[`${o.toolName}(*.ts) - matches .ts files`,`${o.toolName}(src/**) - matches all files in src`,`${o.toolName}(**/*.test.ts) - matches test files`]}}if(o.ruleContent!==void 0){let a=o.toolName==="Write"||o.toolName==="NotebookEdit"||o.toolName==="MultiEdit"?"Edit":o.toolName==="Glob"?"Read":void 0;if(a!==void 0&&!o.ruleContent.includes(":*"))return{valid:!0,warning:`${MS(o)} is not matched by file permission checks — only ${a}(path) rules are. Use ${MS({toolName:a,ruleContent:o.ruleContent})} instead (${a} rules cover all file-${a==="Edit"?"editing":"reading"} tools).`}}return{valid:!0}}var II=M(()=>FX()),UX=M(()=>FX("allow"));function FX(e){return _().superRefine((t,n)=>{let r=PI(t,e);if(!r.valid){let o=r.error;if(r.suggestion)o+=`. ${r.suggestion}`;if(r.examples&&r.examples.length>0)o+=`. Examples: ${r.examples.join(", ")}`;n.addIssue({code:Kr.custom,message:o,params:{received:t}})}})}var yYe=M(()=>X(_(),Vy.string()));function WX(e){return C({allow:I(UX()).optional().describe("List of permission rules for allowed operations"),deny:I(II()).optional().describe("List of permission rules for denied operations"),ask:I(II()).optional().describe("List of permission rules that should always prompt for confirmation"),defaultMode:st(Qm,q([...Xm,...kX(e)])).optional().describe("Default permission mode when Claude Code needs access ('manual' is accepted as an alias for 'default')"),disableBypassPermissionsMode:q(["disable"]).optional().describe("Disable the ability to bypass permission prompts"),...CX(e),additionalDirectories:I(_()).optional().describe("Additional directories to include in the permission scope")}).passthrough()}var gBt=M(()=>WX(nh())),MI=M(()=>C({source:od().describe("Where to fetch the marketplace from"),installLocation:_().optional().describe("Local cache path where marketplace manifest is stored (auto-generated if not provided)"),autoUpdate:R().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),NI=M(()=>{let e=()=>ee().min(0).max(1e4);return C({input:e(),output:e(),cacheRead:e(),cacheWrite:e()})}),UI=M(()=>ee().gt(0).lte(1).optional()),FI=M(()=>C({model:_().describe('Model to select, taken verbatim: an alias ("opus"), an Anthropic model ID, or a provider-format ID (Vertex, Bedrock, gateway). Same values --model accepts.'),label:_().optional().describe("Row title. Defaults to the model name."),description:_().optional().describe("Row subtitle. Defaults to a generic description.")})),jS=M(()=>C({serverName:_().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that users are allowed to configure"),serverCommand:I(_()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for allowed stdio servers"),serverUrl:_().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers')}).refine((e)=>ef([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),$S=M(()=>C({serverName:_().min(1,"Server name must be non-empty").refine((e)=>e.trim().length>0,{message:"Server name must not be whitespace-only"}).refine((e)=>e===e.trim(),{message:"Server name has leading or trailing whitespace and will never match (names are compared verbatim)"}).optional().describe("Name of the MCP server that is explicitly blocked"),serverCommand:I(_()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for blocked stdio servers"),serverUrl:_().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers')}).refine((e)=>ef([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),bYe=/[\x00-\x1f\x7f-\x9f\u2028\u2029]|\p{DI}/u;function SYe(e){let t=e.replaceAll("/","\\");if(_c(t))return!1;return/^\\{2}[^\\]/.test(t)}function EYe(e){return js(e)||/^\/network\/servers(\/|$)/i.test(e)}function xYe(e){return/^\/(proc|dev\/(fd|stdin|stdout|stderr))(\/|$)/i.test(e)}function vYe(e,t,n={}){if(t==="win32"){let r=e.replaceAll("/","\\");if(_c(r))return!1;let o=SYe(r);if(n.rejectUnc&&o)return!1;if(n.rejectDriveRelative){if(!/^[A-Za-z]:\\/.test(r)&&!o&&/^(\\|[A-Za-z]:)/.test(r))return!1}if(GX.normalize(r)!==r)return!1;let s=r.split("\\");if(s.some((a)=>a==="."||a===".."))return!1;if(s.some((a,c)=>/[. ]$/.test(a)||a.includes(":")&&!(c===0&&/^[A-Za-z]:$/.test(a))))return!1;let i=r.startsWith("\\\\")?r.slice(2):r;if(/\\{2}/.test(i))return!1;return!r.endsWith("\\")||/^([A-Za-z]:)?\\$/.test(r)}if(n.rejectNetworkRoot&&EYe(e))return!1;if(n.rejectMagicLinkRoot&&xYe(e))return!1;if(KX.normalize(e)!==e)return!1;if(e.split("/").some((r)=>r==="."||r===".."))return!1;if(/\/{2}/.test(e))return!1;return!e.endsWith("/")||e==="/"}var wYe=/\.(exe|ps1)$/i;function AYe(e){return/\.ps1$/i.test(e)}function TYe(e){return AYe(e)&&/[[\]`*?]/.test(e)}var CYe='a .ps1 path must not contain "[", "]", "`", "*", or "?" on Windows (PowerShell resolves them as wildcard syntax)',kYe=()=>_().describe("Absolute path to the helper executable"),id=(e)=>st((t)=>t===null?void 0:t,e.optional()).optional(),jX=["path","script","defaultSettings"];function qX(e){if(!e||typeof e!=="object"||Array.isArray(e))return!1;let t=e;return jX.some((n)=>t[n]===null)&&jX.every((n)=>t[n]===null||t[n]===void 0)}var FS=M(()=>C({path:kYe(),timeoutMs:id(ee().int().min(1000)),refreshIntervalMs:id(ce([j(0),ee().int().min(60000)]))})),VX=()=>q(["replace","merge"]).describe("How the helper's managedSettings compose with the settings of the source that delivered this entry: 'replace' (default) — the output is the policy; 'merge' — the output is deep-merged over that source's own settings (helper keys win, arrays replace), so a failed helper costs only the delta"),RYe=(e)=>(e==="windows"?j("pwsh",{message:"interpreter must be 'pwsh' on windows ('sh' is not supported there)"}):j("sh",{message:"interpreter must be 'sh' on macos/linux/wsl"})).describe("Fixed interpreter for `script`: 'sh' (/bin/sh) on macos/linux/wsl entries; 'pwsh' (PowerShell at its fixed install locations, never PATH) on the windows entry"),OYe="exactly one of path/script must be configured",PYe='"script" and "interpreter" must be configured together',IYe="script must be ASCII-only on Windows (PowerShell decodes stdin with the console OEM code page); spell non-ASCII characters as escapes, e.g. [char]0x00E9",DYe=(e)=>_({message:"script must be a string"}).min(1,{message:"script must not be empty"}).max(65536,{message:"script must be at most 65536 characters"}).refine((t)=>!t.includes("\x00"),{message:"script must not contain NUL bytes"}).refine((t)=>bh(t),{message:"script must be valid UTF-8 (no lone surrogates)"}).refine((t)=>e!=="windows"||!/[\u0080-\uffff]/.test(t),{message:IYe}).describe("Inline helper script, delivered to the fixed interpreter over stdin (never written to disk)");var ss=["macos","linux","windows","wsl"];function LYe(e){return e==="windows"?"win32":"posix"}function MYe(e){return{rejectDriveRelative:e==="windows",rejectUnc:e==="windows",rejectNetworkRoot:e!=="windows",rejectMagicLinkRoot:e!=="windows",requireWin32ExecutableSuffix:e==="windows"}}function NYe(e){let t=LYe(e),n=MYe(e);return _().max(1024,{message:"path must be at most 1024 characters"}).refine((r)=>!bYe.test(r),{message:"path must not contain control, line/paragraph-separator, or invisible (default-ignorable) characters"}).refine((r)=>(t==="win32"?GX:KX).isAbsolute(r),{message:"path must be absolute"}).refine((r)=>!(t==="win32"&&n.requireWin32ExecutableSuffix)||wYe.test(r),{message:"path must end in .exe or .ps1 on Windows"}).refine((r)=>t!=="win32"||!TYe(r),{message:CYe}).refine((r)=>vYe(r,t,n),{message:t==="win32"?'path must be in normalized form: no "." or ".." segments, no doubled or trailing separators, no component ending in "." or a space, no ":" outside the drive letter, no device-namespace (\\\\?\\) prefix, no drive-relative (\\dir or C:name) or UNC (\\\\server\\share) form':'path must be in normalized form: no "." or ".." segments, no doubled or trailing separators, and not under a network automount root (/net/<host>, /Network/Servers) or a kernel magic-link root (/proc, /dev/fd)'}).describe("Absolute path to the helper executable")}var jI=[...ss,"default"],DI=["path","script","interpreter","outputBehavior","timeoutMs","refreshIntervalMs","defaultSettings"],US=["managedSettings","appendSystemPrompt"],pc=M(()=>X(_(),Ae()).superRefine((e,t)=>{for(let n of["policyHelper","policyHelpers"])if(e[n]!==void 0&&e[n]!==null)t.addIssue({code:"custom",message:`must not contain "${n}" — the default payload is applied as managed settings and cannot configure further policy helpers`});for(let n of DI)if(e[n]!==void 0&&e[n]!==null)t.addIssue({code:"custom",message:`must not contain "${n}" — a static payload is a managed-settings object, not a policyHelpers entry; entry fields (${DI.join("/")}) belong on the per-OS entries (policyHelpers.${ss.join("/")})`});for(let n of US)if(e[n]!==void 0&&e[n]!==null)t.addIssue({code:"custom",message:`must not contain "${n}" — a static payload is the managedSettings SUBTREE, not the helper's stdout envelope; paste the object your helper emits UNDER "managedSettings", not the envelope around it`});for(let n of jI)if(e[n]!==void 0&&e[n]!==null)t.addIssue({code:"custom",message:`must not contain "${n}" — a static payload is the VALUE of a policyHelpers key (a managed-settings object), never another policyHelpers map; don't paste the map or its "${n}" line inside the slot`})})),UYe='Entry must carry "path" (a helper executable) or "script" + "interpreter" (an inline helper), and/or "defaultSettings" (a static settings payload)';function FYe(e){let{path:t,script:n,interpreter:r,defaultSettings:o}=e;if(t!==void 0&&n!==void 0)return OYe;if(n===void 0!==(r===void 0))return PYe;if(t===void 0&&n===void 0&&o===void 0)return UYe;return null}function ZX(e,t){return FS().omit({path:!0}).extend({path:id(NYe(e)),script:id(DYe(e)),interpreter:id(RYe(e)),outputBehavior:id(VX()),defaultSettings:st((n)=>n===null?void 0:n,t.optional()).optional()}).check((n)=>{if(n.issues.length>0)return;let r=FYe(n.value);if(r!==null)n.issues.push({code:"custom",message:r,input:n.value})})}var _Bt=M(()=>ZX("linux",pc()));function LI(e,t=pc()){return e==="default"?pc():ZX(e,t)}var jYe=M(()=>C(Object.fromEntries(jI.map((e)=>[e,st((t)=>{if(t===null)return;if(e!=="default"&&qX(t))return;return t},LI(e).optional()).optional()])))),$X=["skills","agents","hooks","mcp"],zX=Object.freeze({type:"invalid-entry-stripped"}),$Ye=M(()=>ce([C({type:j("regex").describe('Config variant. This client understands "regex": matches turn output and builds a URL from named capture groups. Entries with other variants are preserved but skipped at runtime.'),pattern:_().describe("Regex matched against turn output (tool results and assistant text)"),url:_().describe("Link target. {name} placeholders are filled from named regex capture groups, e.g. (?<id>...) -> {id}. Values are URL-encoded; the origin must be literal in the template. The scheme must be https, http, or a recognized editor or workspace deep-link scheme: vscode, vscode-insiders, cursor, windsurf, zed, jetbrains, idea, slack, linear, notion, figma."),label:_().optional().describe("Badge text. {name} placeholders filled from named capture groups; defaults to the full match.")}).passthrough(),C({type:_().describe("Config variant discriminator for entries this client does not understand; the entry is preserved as-is and skipped at runtime.")}).passthrough()]));function zS(e,{strictPolicyHelperKeys:t=!1}={}){function n(o){return X(_(),MI()).check((s)=>{for(let[i,a]of Object.entries(s.value))if(a.source.source==="settings"&&a.source.name!==i)s.issues.push({code:"custom",input:a.source.name,path:[i,"source","name"],message:`Settings-sourced marketplace name must match its ${o} key (got key "${i}" but source.name "${a.source.name}")`})})}let r=(o,s)=>t?st((i)=>{if(i===null)return;return s?s(i):i},o):o.catch(void 0);return C({$schema:_().optional().describe("JSON Schema reference for Claude Code settings"),apiKeyHelper:_().optional().describe("Path to a script that outputs authentication values"),proxyAuthHelper:_().optional().describe("Shell command that outputs a Proxy-Authorization header value (EAP)"),awsCredentialExport:_().optional().describe("Path to a script that exports AWS credentials"),awsAuthRefresh:_().optional().describe("Path to a script that refreshes AWS authentication"),gcpAuthRefresh:_().optional().describe("Command to refresh GCP authentication (e.g., gcloud auth application-default login)"),processWrapper:_().optional().describe("Corporate launcher argv prefix for the background-agent supervisor, the sessions and workers it hosts, and the other covered background processes listed in the Claude Code corporate-launcher documentation. Equivalent to the CLAUDE_CODE_PROCESS_WRAPPER environment variable, which takes precedence when set. Honored from managed settings, a --settings/SDK-supplied settings file, and user settings, in that precedence order; project and local settings are ignored."),policyHelper:r(FS().optional(),(o)=>o&&typeof o==="object"&&!Array.isArray(o)&&o.path===null?void 0:o).describe("Executable that computes managed settings at startup. Honored only from admin-controlled policy sources."),policyHelpers:r(jYe().optional()).describe(`@internal Per-OS variant of policyHelper, keyed by platform: macos, linux, windows, wsl, plus an optional "default" entry that is a STATIC settings payload (a JSON object of managed settings, not a helper). Each per-OS entry carries a helper — a "path", or an inline "script" + "interpreter" delivered to a fixed interpreter over stdin, either with timeoutMs/refreshIntervalMs — its own static "defaultSettings" payload, or both; an entry may be payload-only. Selection for a platform walks its chain (the platform's own entry; on wsl the linux entry next): the first helper on the chain wins over policyHelper; if no helper is configured — or the selected helper fails at startup or refresh — the first payload applies (the chain's "defaultSettings" in platform-specific-first order, then the top-level "default", applied with no process spawned; unrecognized platforms reach only "default"); with no payload either, policyHelper. Honored only from admin-controlled policy sources.`),...Mn.CLAUDE_CODE_ENABLE_XAA&&{xaaIdp:C({issuer:_().url().describe("IdP issuer URL for OIDC discovery"),clientId:_().describe("Claude Code's client_id registered at the IdP"),callbackPort:ee().int().positive().optional().describe("Fixed loopback callback port for the IdP OIDC login. Only needed if the IdP does not honor RFC 8252 port-any matching.")}).optional().describe("XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.")},fileSuggestion:C({type:j("command"),command:_()}).optional().describe("Custom file suggestion configuration for @ mentions"),respectGitignore:R().optional().describe("Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected."),breakReminder:C({enabled:R().optional().describe("Show a friendly nudge after sustained continuous use (default false). Must be true for the reminder to fire."),intervalMinutes:ee().int().positive().optional().describe("Minutes of continuous use before the reminder fires (default 30). Re-fires every interval until you take a break."),breakThresholdMinutes:ee().int().positive().optional().describe("Minutes of inactivity that count as a break and reset the timer (default 10)"),message:_().optional().describe("Custom reminder text. Leave unset for a rotating set of friendly nudges.")}).optional().describe("@internal Opt-in break reminder. When enabled, shows a dismissible nudge after sustained continuous use. Never blocks — just a friendly heads-up."),quietHours:C({enabled:R().optional().describe("Show a one-time nudge when you start or keep using the CLI inside your quiet-hours window (default false)."),start:_().regex(/^([01]?\d|2[0-3]):[0-5]\d$/,'Expected 24-hour local time "HH:MM" (e.g. "22:00")').optional().describe('Start of the quiet-hours window, 24-hour local time "HH:MM".'),end:_().regex(/^([01]?\d|2[0-3]):[0-5]\d$/,'Expected 24-hour local time "HH:MM" (e.g. "07:00")').optional().describe('End of the quiet-hours window, 24-hour local time "HH:MM". May be earlier than start for an overnight range.')}).optional().describe("@internal Opt-in quiet hours. When enabled, shows a single soft nudge per session while inside the configured local-time window. Never blocks."),cleanupPeriodDays:ee().int().positive().optional().describe("Number of days to retain chat transcripts before automatic cleanup (default: 30). Minimum 1. Use a large value for long retention; use --no-session-persistence to disable transcript writes entirely."),syncClaudeAiSkills:R().optional().describe("Set to false to turn off syncing of the skills you have enabled on claude.ai. In your user settings (or managed settings): nothing more is downloaded, previously synced skills (~/.claude/skills/synced) can no longer be run, are hidden from every session started afterwards, and are moved to ~/.claude/skills/.trash at the next launch (deleted after cleanupPeriodDays; re-downloaded, not restored, if you re-enable). In .claude/settings.local.json or --settings: downloads stop and synced skills are blocked and hidden for sessions in that workspace or invocation only (nothing is moved). Not read from project settings (.claude/settings.json). Only false is honored — the feature is enabled server-side for your account, so setting true does not turn it on early. While it is on, synced skills are available in every session, re-synced every 10 minutes, and removed when you disable them on claude.ai. Only applies when signed in with your Claude account."),syncClaudeAiPlugins:R().optional().describe("Set to false to turn off syncing of the plugins you have enabled on claude.ai. In your user settings (or managed settings): nothing more is downloaded, previously synced plugins (~/.claude/plugins/synced) are hidden from every session started afterwards and moved to ~/.claude/plugins/.trash at the next launch (deleted after cleanupPeriodDays; re-downloaded, not restored, if you re-enable). In .claude/settings.local.json or --settings: downloads stop and synced plugins are hidden for sessions in that workspace or invocation only (nothing is moved). Not read from project settings (.claude/settings.json). Only false is honored — the feature is enabled server-side for your account, so setting true does not turn it on early. While it is on, synced plugins load in every session like plugins you installed yourself (a plugin you installed with the same name takes precedence), are re-synced at each launch, and are removed when you disable them on claude.ai. Only applies when signed in with your Claude account."),skillListingMaxDescChars:ee().int().positive().optional().describe("Per-skill description character cap in the skill listing sent to Claude (default: 1536). Descriptions longer than this are truncated. Raise to opt in to higher per-turn context cost."),skillListingBudgetFraction:ee().gt(0).lte(1).optional().describe("Fraction of the context window (in characters) reserved for the skill listing sent to Claude (default: 0.01 = 1%). When the listing exceeds this, descriptions are shortened to fit. Raise to opt in to higher per-turn context cost."),wslInheritsWindowsSettings:R().optional().describe("When set to true in either admin-only Windows source — the HKLM SOFTWARE/Policies/ClaudeCode registry key or C:/Program Files/ClaudeCode/managed-settings.json — WSL reads managed settings from the full Windows policy chain (HKLM, C:/Program Files/ClaudeCode via DrvFs, HKCU) in addition to /etc/claude-code. Windows sources take priority. The flag is also required in HKCU itself for HKCU policy to apply on WSL (double opt-in: admin enables the chain, user confirms HKCU). On native Windows the flag has no effect."),env:yYe().optional().describe("Environment variables to set for Claude Code sessions"),attribution:C({commit:_().optional().describe("Attribution text for git commits, including any trailers. Empty string hides attribution."),pr:_().optional().describe("Attribution text for pull request descriptions. Empty string hides attribution."),sessionUrl:R().optional().describe("Whether to append the claude.ai session link to commits and PRs created from web or Remote Control sessions (default: true). Set to false to omit the Claude-Session trailer and PR-body link."),...!1}).passthrough().optional().describe("Customize attribution text for commits and PRs. Each field defaults to the standard Claude Code attribution if not set."),includeCoAuthoredBy:R().optional().describe("Deprecated: Use attribution instead. Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)"),...!1,...!1,includeGitInstructions:R().optional().describe("Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)"),permissions:WX(e).optional().describe("Tool usage permissions configuration"),model:_().optional().describe("Override the default model used by Claude Code"),fallbackModel:I(_()).optional().describe('Fallback model(s) tried in order when the primary model is overloaded or unavailable. Each element accepts a model name or alias; "default" expands to the default model. CLI --fallback-model takes precedence.'),availableModels:I(_()).optional().describe('Allowlist of models that users can select. Accepts family aliases ("opus" allows any opus version), version prefixes ("opus-4-5" allows only that version), and full model IDs. If undefined, all models are available. If empty array, only the default model is available. Typically set in managed settings by enterprise administrators.'),enforceAvailableModels:R().optional().describe("When true and availableModels is a non-empty array, the Default model selection is also constrained: if the default model for the user tier is not in availableModels, Default resolves to the first allowed availableModels entry instead. Has no effect when availableModels is unset or an empty array. Typically set in managed settings by enterprise administrators."),modelOverrides:X(_(),_()).optional().describe('Override mapping from Anthropic model ID (e.g. "claude-opus-4-6") to provider-specific model ID (e.g. a Bedrock inference profile ARN). Typically set in managed settings by enterprise administrators.'),modelPicker:C({options:I(FI()).describe("Rows to show in the /model picker, in order."),replaceBuiltInOptions:R().optional().describe("When true, the picker shows only the Default row and these options — the built-in "+"lineup, gateway-discovered models and ANTHROPIC_CUSTOM_MODEL_OPTION are hidden. When false or unset, these options are added after the built-in lineup.")}).optional().describe("Curate the /model picker: an ordered list of models with your own labels, independent of the built-in lineup and of Claude Code releases. availableModels still applies to these rows. Honored from managed, --settings/SDK, and user settings only (not from a project checkout); the highest-precedence of those that defines modelPicker wins outright (no merging across sources). Typically set in managed settings by enterprise administrators."),modelPricing:C({multiplier:UI(),overrides:X(_(),NI()).optional()}).optional().describe("Price usage at your organization's contracted rates instead of list price. "+"Affects every spend figure Claude Code reports — /cost, the status line, the SDK total_cost_usd, "+"--max-budget-usd, and the OpenTelemetry cost metric and events — which remain USD estimates, not an invoice "+'(the per-Mtok price labels in /model stay at list). "overrides" maps a model ID to its USD-per-million-token rates (input, output, cacheRead, '+"cacheWrite — all four required, each 0 to 10000; cacheWrite prices both 5-minute and 1-hour cache writes). "+"A matching row is charged exactly as written; fast-mode and US-data-residency surcharges are not added on top. "+'A key Claude Code itself uses for a built-in model — its ID such as "claude-sonnet-4-6", or its '+"first-party, Bedrock (any or no region prefix), Vertex or Foundry ID — covers every dated and provider form "+"of that model; any other key — a gateway model alias, or a spelling Claude Code does not itself use — "+'matches that model ID only (case-insensitive), and such an exact match wins over a built-in row. On Bedrock an application inference profile is matched by its backing model. An invalid row or multiplier is reported and skipped; the rest still apply. "multiplier" in (0, 1] scales every computed cost, overridden or not (0.85 = 85% of the price). Only honored from managed settings (server-managed, MDM / OS policy, or managed-settings.json), '+"or — when none of those sets it — when supplied by a host application that manages the model "+"provider; ignored in user, project, local and --settings sources."),enableAllProjectMcpServers:R().optional().describe("Whether to automatically approve all MCP servers in the project"),enabledMcpjsonServers:I(_()).optional().describe("List of approved MCP servers from .mcp.json"),disabledMcpjsonServers:I(_()).optional().describe("List of rejected MCP servers from .mcp.json"),disableClaudeAiConnectors:R().optional().describe("When true in any settings source, claude.ai MCP cloud connectors are not auto-fetched or connected. "+"Only gates auto-fetched connectors — a claudeai-proxy server passed explicitly "+"(e.g. via --mcp-config or the SDK mcpServers option) still follows the normal MCP config trust flow. Any-source-true wins: a project can opt out, but a project-level false cannot override a user-level true."),skillOverrides:X(_(),q(["on","name-only","user-invocable-only","off"])).optional().describe('Per-skill listing overrides keyed by skill name. "name-only" lists the skill without its description; "user-invocable-only" hides it from the model but keeps /name; "off" hides it from both. Absent = on.'),disableBundledSkills:R().optional().describe("Disable the skills and workflows that ship with Claude Code: bundled skills and workflows are removed entirely; built-in slash commands stay typable but are hidden from the model. Plugins, .claude/skills/, and .claude/commands/ are unaffected. Equivalent to CLAUDE_CODE_DISABLE_BUNDLED_SKILLS=1."),allowedMcpServers:I(jS()).optional().describe("Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied."),deniedMcpServers:I($S()).optional().describe("Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied."),hooks:lc().optional().describe("Custom commands to run before/after tool executions"),worktree:C({symlinkDirectories:I(_()).optional().describe('Directories to symlink from main repository to worktrees to avoid disk bloat. Must be explicitly configured - no directories are symlinked by default. Common examples: "node_modules", ".cache", ".bin"'),sparsePaths:I(_()).optional().describe("Directories to include when creating worktrees, via git sparse-checkout (cone mode). "+"Dramatically faster in large monorepos — only the listed paths are written to disk."),baseRef:q(["fresh","head"]).optional().describe("Which ref new worktrees branch from. 'fresh' (default) branches from origin/<default-branch> for a clean tree. 'head' branches from your current local HEAD so unpushed commits and feature-branch state are present. Applies to --worktree, EnterWorktree, and agent isolation."),bgIsolation:q(["worktree","none"]).optional().catch(void 0).describe("Isolation mode for background sessions in this repo. 'worktree' (default) blocks Edit/Write in the main checkout until EnterWorktree is called. 'none' lets background jobs edit the working copy directly."),location:_().optional().catch(void 0).describe("Directory under which Claude Code Desktop creates the worktrees of SSH sessions that run on this machine (an absolute path or one starting with ~/), instead of <project>/.claude/worktrees. Read by the desktop app from the SSH host user settings; a location chosen in the desktop app's SSH connection settings takes precedence. The CLI (--worktree, EnterWorktree, agent isolation) does not read it yet.")}).optional().describe("Git worktree configuration: the CLI --worktree flag, EnterWorktree and agent isolation, plus the location Claude Code Desktop uses for SSH-session worktrees on this machine."),disableAllHooks:R().optional().describe("Disable all hooks and statusLine execution"),disableAgentView:R().optional().describe("Disable agent view (`claude agents`, `--bg`, /background, the on-demand daemon). Typically set in managed settings. Equivalent to CLAUDE_CODE_DISABLE_AGENT_VIEW=1."),disableRemoteControl:R().optional().describe("Disable Remote Control (claude.ai/code, `claude remote-control`, `--remote-control`/`--rc`, auto-start, and the in-session toggle). Typically set in managed settings."),disableWorkflows:R().optional().describe("Disable the Workflows feature (also via CLAUDE_CODE_DISABLE_WORKFLOWS)."),disableArtifact:R().optional().describe("Deprecated: use enableArtifact: false. Still honored — true disables the Artifact tool; false is ignored."),enableArtifact:R().optional().describe("Turn the Artifact tool on or off. Off in any of managed, --settings, or user settings wins; project and local settings can only turn it off. Unset defaults to on once the feature is available."),enableWorkflows:R().optional().describe("Enable or disable the Workflows feature for this user. Unset = default by plan once the feature is available."),workflowSizeGuideline:q(["unrestricted","small","medium","large"]).optional().describe('Advisory size guideline for the dynamic workflows Claude writes: "small" aims for fewer than 5 agents, "medium" (the default) fewer than 15, "large" fewer than 50, and "unrestricted" sends no guideline. A value here — including from managed settings — takes precedence over the "Dynamic workflow size" choice in /config, and that /config row is hidden while a settings file provides the key. This is a guideline, not an enforced limit.'),workflowKeywordTriggerEnabled:R().optional().describe('Enable the "ultracode" keyword trigger: including the keyword in a prompt opts that turn into the Workflow tool. Set to false to disable the trigger. Default: true.'),disableSkillShellExecution:R().optional().describe("Disable inline shell execution in skills and custom slash commands from user, project, or plugin sources. Commands are replaced with a placeholder instead of being run."),defaultShell:q(["bash","powershell"]).optional().describe("Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip)."),respondToBashCommands:R().optional().describe("Whether Claude responds after an input-box ! bash command runs. Set to false to add the command output to context without a response. Default: true."),allowManagedHooksOnly:R().optional().describe("When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored."),allowedHttpHookUrls:I(_()).optional().describe('Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard (e.g. "https://hooks.example.com/*"). When set, HTTP hooks with non-matching URLs are blocked. If undefined, all URLs are allowed. If empty array, no HTTP hooks are allowed. Arrays merge across settings sources (same semantics as allowedMcpServers).'),httpHookAllowedEnvVars:I(_()).optional().describe("Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. If undefined, no restriction is applied. Arrays merge across settings sources (same semantics as allowedMcpServers)."),allowManagedPermissionRulesOnly:R().optional().describe("When true (and set in managed settings), only permission rules (allow/deny/ask) from managed settings are respected. User, project, local, and CLI argument permission rules are ignored."),allowManagedMcpServersOnly:R().optional().describe("When true (and set in managed settings), allowedMcpServers is only read from managed settings. deniedMcpServers still merges from all sources, so users can deny servers for themselves. Users can still add their own MCP servers, but only the admin-defined allowlist applies."),allowAllClaudeAiMcps:R().optional().describe("When true (and set in managed settings), claude.ai cloud MCP connectors load alongside managed-mcp.json instead of being suppressed by its exclusive-control lockdown. Default off preserves the lockdown. Read from managed settings only."),strictPluginOnlyCustomization:st((o)=>Array.isArray(o)?o.filter((s)=>$X.includes(s)):o,ce([R(),I(q($X))])).optional().catch(void 0).describe('When set in managed settings, blocks non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g. ["skills", "hooks"]); `true` locks all four; `false` is an explicit no-op. Blocked: ~/.claude/{surface}/, .claude/{surface}/ (project), settings.json hooks, .mcp.json. NOT blocked: managed (policySettings) sources, plugin-provided customizations. '+"Composes with strictKnownMarketplaces for end-to-end admin control — plugins gated by "+"marketplace allowlist, everything else blocked here."),statusLine:C({type:j("command"),command:_(),padding:ee().optional(),refreshInterval:ee().min(1).optional().catch(void 0).describe("Re-run the status line command every N seconds in addition to event-driven updates"),hideVimModeIndicator:R().optional().describe("Hide the built-in `-- INSERT --` / `-- VISUAL --` indicator below the prompt. Use this when your status line script renders `vim.mode` itself.")}).optional().describe("Custom status line display configuration"),prUrlTemplate:_().optional().describe('URL template for PR links in the footer link badges and inline messages. The detected git PR is rendered as the first footer-link badge. Placeholders: {host} {owner} {repo} {number} {url}. Example: "https://reviews.example.com/{owner}/{repo}/pull/{number}"'),footerLinksRegexes:I($Ye().catch(zX)).transform((o)=>o.filter((s)=>s!==zX)).optional().catch(void 0).describe("Extra clickable footer badges that appear when a regex matches turn output (tool results and assistant responses). Read from user, flag, and managed settings only; ignored in project .claude/settings.json and local .claude/settings.local.json. At most 5 badges render; the oldest is displaced by newer matches and /clear removes them. Use to surface IDs printed by project CLIs as session links."),subagentStatusLine:C({type:j("command"),command:_()}).optional().describe("Custom per-subagent status line shown in the agent panel; receives row context as JSON on stdin"),enabledPlugins:X(_(),ce([I(_()),R(),uO()])).optional().describe('Enabled plugins using plugin-id@marketplace-id format. Example: { "formatter@anthropic-tools": true }. Also supports extended format with version constraints. Settings precedence is user < project < local < flag < policy, so to disable a plugin that project settings enable, set it to false in .claude/settings.local.json — setting false in ~/.claude/settings.json is overridden by the project.'),extraKnownMarketplaces:n("extraKnownMarketplaces").optional().describe("Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources."),additionalMarketplaces:n("additionalMarketplaces").optional().describe("Alias for extraKnownMarketplaces: this key is read exactly as if it were spelled "+"extraKnownMarketplaces. Do not set both in one file — if both appear, this key is ignored "+"with a warning. Claude Code may rewrite this key as extraKnownMarketplaces when it updates the file. Clients older than this alias ignore it, so prefer extraKnownMarketplaces while older Claude Code versions still share the same settings."),strictKnownMarketplaces:I(od()).optional().describe('Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these sources can be added as marketplaces. Entries match exactly, except that a github entry may use the owner-wildcard form {"source":"github","repo":"owner/*"} to allow every repository under that owner. The check happens BEFORE downloading, so blocked sources never touch the filesystem. '+"Note: this is a policy gate only — it does NOT register marketplaces. "+"To pre-register allowed marketplaces for users, also set extraKnownMarketplaces."),allowedMarketplaces:I(od()).optional().describe("Alias for strictKnownMarketplaces (managed settings only): this key is read exactly as if it "+"were spelled strictKnownMarketplaces. Do not set both in one file — if both appear, this key "+"is ignored with a warning. Clients older than this alias ignore it, so keep using strictKnownMarketplaces when the allowlist must also bind older Claude Code versions."),blockedMarketplaces:I(od()).optional().describe('Enterprise blocklist of marketplace sources. When set in managed settings, these sources are blocked from being added as marketplaces. Entries match exactly, except that a github entry may use the owner-wildcard form {"source":"github","repo":"owner/*"} to block every repository under that owner. The check happens BEFORE downloading, so blocked sources never touch the filesystem.'),disableCommandPluginSources:R().optional().describe("Controls the `command` plugin source, whose plugin directory is produced by running a marketplace-declared command on this machine. true: command-sourced plugins are never installed, updated, or re-resolved (the command never runs). false: explicitly allowed. "+"Unset: follows allowManagedHooksOnly — an org that restricts hook execution to managed "+"settings gets command sources disabled too. Only honored from managed settings."),disableSideloadFlags:R().optional().describe("When true (and set in managed settings), rejects the --plugin-dir, --plugin-url, --agents, and non-sdk --mcp-config CLI flags at startup. Closes the CLI-flag bypass of strictKnownMarketplaces. Pair with allowedMcpServers for per-server MCP control; this setting does not gate other MCP entry points (SDK setMcpServers, claude mcp add, .mcp.json). Also blocks surfaces that spawn the CLI with these flags internally (see settings documentation). Only honored from managed settings; ignored in user/project/local settings."),pluginSuggestionMarketplaces:I(_()).optional().describe("Marketplace names whose plugins may surface as contextual install suggestions (relevance-based tips). No marketplace-declared suggestions surface without this allowlist; the built-in first-party frontend-design tip is unaffected. Only honored when set in managed settings (policy scope); the key is ignored in user, project, and local settings. A name only takes effect when the marketplace is registered on the machine AND its registered source is also declared in managed settings, either as the extraKnownMarketplaces entry for that name or as an entry of strictKnownMarketplaces. A marketplace registered from a different source under an allowlisted name is ignored. The official marketplace is exempt from the source requirement: allowlisting its name alone suffices, since that name can only register from the official Anthropic source."),forceLoginMethod:q(["claudeai","console","gateway"]).optional().catch(void 0).describe('Force a specific login method: "claudeai" for Claude Pro/Max, "console" for Console billing, "gateway" for the Cloud gateway OIDC device flow'),forceLoginGatewayUrl:_().url().optional().catch(void 0).describe('Cloud gateway URL to pre-fill and auto-connect to during login, alongside forceLoginMethod: "gateway". Honored only from admin-controlled managed settings (MDM / managed-settings.json / policy helper); ignored in user, project, and remote-delivered settings.'),parentSettingsBehavior:q(["first-wins","merge"]).optional().describe('Controls whether the SDK parent tier (Options.managedSettings / --managed-settings) layers under this admin tier. "first-wins" '+"(default): parent is dropped — admin tiers are the only policy "+`source. "merge": parent's restrictive-only-filtered settings union under the admin winner. Has no effect when no admin tier exists (parent applies as the sole policy tier, still filtered restrictive-only).`),managedSourcesBehavior:q(["first-wins","merge"]).optional().describe('Controls how the managed settings sources compose. "first-wins" (default): the highest-priority source present (server-managed > MDM (managed plist / HKLM) > managed-settings.json) is the managed tier alone. "merge": every present source deep-merges with fixed '+"precedence server-managed > MDM > managed-settings.json — scalars "+"take the highest source's value and arrays union, except fallbackModel and the restriction allowlists allowedMcpServers, availableModels, strictKnownMarketplaces and allowedChannelPlugins (the highest source that sets one owns it whole) and the auth pins forceLoginOrgUUID, forceLoginMethod and forceLoginGatewayUrl (highest source only). Honored only from the highest-priority source present; enable it only when every lower source is admin-controlled, since lower sources then contribute entries such as permissions.allow. HKCU and --managed-settings never take part in the merge."),forceLoginOrgUUID:ce([_(),I(_())]).optional().describe("Organization UUID to require for OAuth login. Accepts a single UUID string or an array of UUIDs (any one is permitted). When set in managed settings, login fails if the authenticated account does not belong to a listed organization."),forceRemoteSettingsRefresh:R().optional().describe("When set in managed settings, the CLI blocks startup until remote managed settings are freshly fetched, and exits if the fetch fails"),otelHeadersHelper:_().optional().describe("Path to a script that outputs OpenTelemetry headers"),outputStyle:_().optional().describe("Controls the output style for assistant responses"),viewMode:q(["default","verbose","focus"]).optional().catch(void 0).describe("Default transcript view mode on startup"),language:_().optional().describe('Preferred language for Claude responses and voice dictation (e.g., "japanese", "spanish")'),skipWebFetchPreflight:R().optional().describe("Skip the WebFetch blocklist check for enterprise environments with restrictive security policies"),sandbox:gI().optional(),feedbackSurveyRate:ee().min(0).max(1).optional().describe("Probability (0–1) that the session quality survey appears when eligible. 0.05 is a reasonable starting point."),feedbackDrafts:q(["notify","quiet","off"]).optional().describe('Model-drafted feedback (the SendFeedback tool). "notify" (default) shows a one-line notice when a draft is queued; "quiet" shows only the footer counter; "off" disables the tool entirely so drafts are never queued.'),spinnerTipsEnabled:R().optional().describe("Whether to show tips in the spinner"),spinnerVerbs:C({mode:q(["append","replace"]),verbs:I(_())}).optional().describe('Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.'),spinnerTipsOverride:C({excludeDefault:R().optional(),tips:I(_())}).optional().describe("Override spinner tips. tips: array of tip strings. excludeDefault: if true, only show custom tips (default: false)."),syntaxHighlightingDisabled:R().optional().describe("Whether to disable syntax highlighting in diffs"),spellcheck:C({enabled:R().optional().catch(void 0).describe("Turn on spell checking of the prompt input (default: false)"),checker:_().optional().catch(void 0).describe(`Which spell checker to run: ${IS.map((o)=>`"${o}"`).join(", ")}, or "auto" (default) for the first of those found on PATH`),language:_().optional().catch(void 0).describe(`Dictionary to use, passed to the checker as-is (aspell --lang, hunspell -d, ispell -d), e.g. "en_GB"; names are checker-specific (letters, digits and _ - . , only). Default: the checker's own default`),color:_().optional().catch(void 0).describe(`Color of misspelled words (they are also underlined): a terminal color name such as "red" or "magenta", "#rrggbb", "rgb(r,g,b)", "ansi256(n)" or "ansi:<name>". Default: the theme's error color`)}).passthrough().optional().catch(void 0).describe(`Underline misspelled words in the prompt input as you type, using an installed ${IS.slice(0,-1).join(", ")} or ${IS.at(-1)} (off unless "enabled" is true; does nothing if none is installed). Read from user, flag and managed settings only (the whole block from the highest-precedence of those applies); ignored in project .claude/settings.json and .claude/settings.local.json.`),terminalTitleFromRename:R().optional().describe("Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles."),promptCacheTtl:q(["5m","1h"]).optional().catch(void 0).describe('Prompt cache TTL for the main conversation (interactive, -p and SDK turns, plus the helpers that run inline with it): "5m" or "1h". Unset = automatic: 1 hour on a Claude subscription within its usage limits, 5 minutes on an API key, Bedrock, Vertex or Foundry. 1-hour cache writes are billed at a higher rate; the cache stays warm across longer breaks. The CLAUDE_CODE_PROMPT_CACHE_TTL environment variable takes precedence.'),subagentPromptCacheTtl:q(["5m","1h"]).optional().catch(void 0).describe("Prompt cache TTL for everything outside the main conversation — subagents, workflows, background and helper requests: "+'"5m" or "1h". Unset = automatic (5 minutes unless ENABLE_PROMPT_CACHING_1H=1). The CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL environment variable takes precedence.'),alwaysThinkingEnabled:R().optional().describe("When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models."),effortLevel:q(["low","medium","high","xhigh"]).optional().catch(void 0).describe("Persisted effort level for supported models."),modelSettings:st((o)=>typeof o==="object"&&o!==null&&!Array.isArray(o)?Ym(o,(s,i)=>Object.hasOwn(Object.prototype,i)):o,X(_(),C({effortLevel:q(["low","medium","high","xhigh"]).optional().catch(void 0).describe("Persisted effort level for this model.")}).passthrough().optional().catch(void 0))).optional().catch(void 0).describe("Per-model settings keyed by canonical model name."),ultracode:R().optional().catch(void 0).describe("Enable ultracode for the session: xhigh effort plus standing dynamic-workflow orchestration. "+"Session-scoped — typically provided via --settings or the apply_flag_settings control request; "+"interactive toggles never persist it. Requires workflows to be enabled and an xhigh-capable model."),autoCompactWindow:ee().int().min(1e5).max(1e6).optional().catch(void 0).describe("Auto-compact window size"),advisorModel:_().optional().describe("Advisor model for the server-side advisor tool."),fastMode:R().optional().describe("When true, fast mode is enabled. When absent or false, fast mode is off."),fastModePerSessionOptIn:R().optional().describe("When true, fast mode does not persist across sessions. Each session starts with fast mode off."),promptSuggestionEnabled:R().optional().describe("When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled."),emojiCompletionEnabled:R().optional().describe("When false, the :emoji: shortcode typeahead (the suggestion popup and the :name: inline replacement) is disabled. When absent or true, it is enabled."),awaySummaryEnabled:R().optional().describe("@internal When false, the session recap (shown when you return after being away for 5+ minutes) is disabled. When absent or true, recap is enabled. Hidden from public SDK types until external launch."),showClearContextOnPlanAccept:R().optional().describe('When true, the plan-approval dialog offers a "clear context" option. Defaults to false.'),askUserQuestionTimeout:q(["60s","5m","10m","never"]).optional().catch(void 0).describe("Idle time before Claude's questions auto-continue with any answers "+"selected so far. Defaults to never — auto-continue only runs "+"when explicitly set to 60s/5m/10m."),dialogExpiry:q(["60s","5m","10m","never"]).optional().catch(void 0).describe('Max time a permission/user dialog forwarded to a remote client stays parked awaiting an answer, and how long a HELD cross-session message awaits approval, before either resolves to its safe no-action default (cancelled / dropped-with-denial). Defaults to 5m to match the long-standing remote-dialog deadline; "never" disables the deadline. Local-only permission prompts (no remote client) are unaffected. The CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS env var, when set, overrides this. Read from trusted sources only (never a checked-in repo settings file).'),agent:_().optional().describe("Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model."),modelProposedGoals:q(X8).optional().catch(void 0).describe("@internal Controls the ProposeGoal tool (model-proposed session goals). 'auto' (the default when absent) lets the model choose per proposal whether to ask for approval via its ask_user parameter; 'alwaysAsk' routes every model-proposed goal through the approval dialog; 'disabled' turns the tool off. A typed /goal is unaffected. Consent-affecting, so it is read "+"from trusted sources only (user/policy/flag) — "+"workspace-resident project and local settings are ignored."),companyAnnouncements:I(_()).optional().describe("Company announcements to display at startup (one will be randomly selected if multiple are provided)"),pluginConfigs:X(_(),C({mcpServers:X(_(),X(_(),ce([_(),ee(),R(),I(_())]))).optional().describe("User configuration values for MCP servers keyed by server name"),options:X(_(),ce([_(),ee(),R(),I(_())])).optional().describe("Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.")}).or(uO())).optional().describe("Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)"),remote:C({defaultEnvironmentId:_().optional().describe("Default environment ID to use for cloud sessions")}).optional().describe("Cloud session configuration"),autoUpdatesChannel:q(["latest","stable","rc"]).optional().describe("Release channel for auto-updates (latest or stable)"),minimumVersion:_().optional().describe("Minimum version to stay on - prevents downgrades when switching to stable channel"),requiredMinimumVersion:_().optional().describe("Minimum Claude Code version required to start. If the running version is older, Claude Code exits at startup with instructions to update. Only enforced from managed (policy) settings."),requiredMaximumVersion:_().optional().describe("Maximum Claude Code version allowed to start. If the running version is newer, Claude Code exits at startup with instructions to install an approved version. Only enforced from managed (policy) settings."),plansDirectory:_().optional().describe("Custom directory for plan files, relative to project root. If not set, defaults to ~/.claude/plans/"),tui:q(["default","fullscreen"]).optional().describe('Terminal UI renderer. "fullscreen" uses the flicker-free alt-screen renderer with virtualized scrollback (equivalent to CLAUDE_CODE_NO_FLICKER=1). "default" uses the classic main-screen renderer.'),...!1,voice:C({enabled:R().optional(),mode:q(["hold","tap"]).optional().describe("'hold' (default): hold to talk. 'tap': tap to start, tap to stop+submit."),autoSubmit:R().optional().describe("Submit the prompt when hold-to-talk is released (hold mode only)")}).optional().describe("Voice mode settings (hold-to-talk / tap-to-toggle dictation)"),channelsEnabled:R().optional().describe("Managed-org opt-in for channel notifications (MCP servers with the claude/channel capability pushing inbound messages). claude.ai Teams/Enterprise: default off. Console: default on unless managed settings exist. Set true to allow; users then select servers via --channels."),allowedChannelPlugins:I(C({marketplace:_(),plugin:_()})).optional().describe("Managed-org allowlist of channel plugins. When set, "+"replaces the default Anthropic allowlist — admins decide which "+"plugins may push inbound messages. Undefined falls back to the default. Requires channelsEnabled: true."),prefersReducedMotion:R().optional().describe("Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)"),doneMeansMerged:R().optional().describe("@internal When true, Claude keeps working until the PR is ready for you to merge, a cron/Monitor is armed to resume later, or it hands you a self-contained next step."),totalTokensReminder:q(["off","infinite","fixed","countdown","padded-countdown"]).optional().describe("@internal Emit a <total_tokens>N tokens left</total_tokens> block in the system prompt, after each tool result, and (when totalTokensReminderAfterUserTurn is on) after each regular user prompt. 'infinite' uses the literal value Infinite, 'fixed' uses 5000000, 'countdown' uses the live remaining context-window tokens, 'padded-countdown' counts down from totalTokensReminderBudget (re-anchoring to the full budget on each regular user prompt when totalTokensReminderAfterUserTurn "+"is on — task-budget semantics). Defaults to padded-countdown. "+"Env var CLAUDE_CODE_TOTAL_TOKENS_REMINDER overrides."),totalTokensReminderBudget:ee().int().positive().optional().describe("@internal Starting budget (tokens) for totalTokensReminder 'padded-countdown' mode. Defaults to 15000000. Server-controlled via GrowthBook; env var CLAUDE_CODE_TOTAL_TOKENS_REMINDER_BUDGET overrides."),totalTokensReminderAfterUserTurn:R().optional().describe("@internal When true, emit the totalTokensReminder block after each regular user prompt and (for 'padded-countdown') re-anchor the task budget to the full configured value at the start of each user turn. When false, the reminder appears only in the system prompt and after each tool-result batch, and 'padded-countdown' counts down over the whole session. Defaults to on. Env var CLAUDE_CODE_TOTAL_TOKENS_REMINDER_AFTER_USER_TURN overrides; server-controlled via GrowthBook tengu_lapis_anchor_user_turn."),autoMemoryEnabled:R().optional().describe("Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory."),autoMemoryDirectory:_().optional().describe("Custom directory path for auto-memory storage. Supports ~/ prefix for home directory expansion. Ignored if set in projectSettings (checked-in .claude/settings.json) for security. When unset, defaults to ~/.claude/projects/<sanitized-cwd>/memory/."),autoDreamEnabled:R().optional().describe("Enable background memory consolidation (auto-dream). When set, overrides the server-side default."),showThinkingSummaries:R().optional().describe("Request API-side thinking summaries and show them in the conversation and in the transcript view (ctrl+o). Set explicitly to override the default for your install."),skipDangerousModePermissionPrompt:R().optional().describe("Whether the user has accepted the bypass permissions mode dialog"),skipWorkflowUsageWarning:R().optional().describe("@internal Whether the user has accepted the multi-agent workflow usage warning. Until set, auto permission mode prompts before running a workflow."),disableAutoMode:q(["disable"]).optional().describe("Disable auto mode"),sshConfigs:I(C({id:_().describe("Unique identifier for this SSH config. Used to match configs across settings sources."),name:_().describe("Display name for the SSH connection"),sshHost:_().describe('SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config'),sshPort:ee().int().optional().describe("SSH port (default: 22)"),sshIdentityFile:_().optional().describe("Path to SSH identity file (private key)"),startDirectory:_().optional().describe("Default working directory on the remote host. Supports tilde expansion (e.g. ~/projects). If not specified, defaults to the remote user home directory. Can be overridden by the [dir] positional argument in `claude ssh <config> [dir]`.")})).optional().describe("SSH connection configurations for remote environments. Typically set in managed settings by enterprise administrators to pre-configure SSH connections for team members."),claudeMd:_().optional().describe("CLAUDE.md-style instructions injected as organization-managed memory. Only honored from managed/policy settings."),claudeMdExcludes:I(_()).optional().describe('Glob patterns or absolute paths of CLAUDE.md files to exclude from loading. Patterns are matched against absolute file paths using picomatch. Only applies to User, Project, and Local memory types (Managed/policy files cannot be excluded). Examples: "/home/user/monorepo/CLAUDE.md", "**/code/CLAUDE.md", "**/some-dir/.claude/rules/**"'),pluginTrustMessage:_().optional().describe('Custom message to append to the plugin trust warning shown before installation. Only read from policy settings (managed-settings.json / MDM). Useful for enterprise administrators to add organization-specific context (e.g., "All plugins from our internal marketplace are vetted and approved.").'),theme:ce([q(J8),_().startsWith("custom:").transform((o)=>o)]).optional().catch(void 0).describe("Color theme for the UI"),editorMode:q(V8).optional().catch(void 0).describe("Key binding mode for the prompt input"),keybindingFlavor:q(Z8).optional().catch(void 0).describe(`Which conventions the prompt's word-editing keys follow: "readline" matches Bash and other readline programs (Ctrl+W deletes back to the previous whitespace; Alt+F and Alt+D stop at the end of the current word and Ctrl+Y can paste back what Alt+D deleted; for Alt+B, Alt+F, Alt+D, Ctrl/Option+Arrow and Option/Ctrl+Backspace a word is a run of letters and digits, so punctuation separates words); "classic" (default) keeps Claude Code's long-standing behavior (Ctrl+W deletes the previous word; the word keys use Unicode word segmentation, so foo_bar and 3.14 are one word)`),vimInsertModeRemaps:X(_(),Ae()).optional().catch(void 0).describe('Vim INSERT-mode key-sequence remaps, e.g. {"jj": "<Esc>"}. Each key is exactly two printable characters typed in sequence; "<Esc>" (return to NORMAL mode) is the only supported target. Applies when editorMode is "vim".'),verbose:R().optional().describe("Show full tool output instead of truncated summaries"),preferredNotifChannel:q(q8).optional().catch(void 0).describe("Preferred OS notification channel"),autoCompactEnabled:R().optional().describe("Automatically compact conversation when context fills"),precomputeCompactionEnabled:R().optional().describe("Precompute the compaction summary in the background before it is needed. Only applies when auto-compact is on."),switchModelsOnFlag:R().optional().describe("When safeguards flag a message, automatically switch to a different model to keep chatting. When off, your session will pause instead."),autoContinueAtUsageLimit:R().optional().describe("When a claude.ai usage limit stops your session, wait for the limit to reset and continue the task automatically. When off, the limit dialog offers the wait as a choice instead."),autoScrollEnabled:R().optional().describe("Auto-scroll the conversation view to bottom (fullscreen mode only)"),wheelScrollAccelerationEnabled:R().optional().describe("Ramp mouse-wheel scroll speed during fast scrolls (fullscreen mode only)"),fileCheckpointingEnabled:R().optional().describe("Snapshot files before edits so /rewind can restore them"),showTurnDuration:R().optional().describe('Show "Cooked for Nm Ns" after each assistant turn'),showMessageTimestamps:R().optional().describe("Stamp each message with its arrival time"),terminalProgressBarEnabled:R().optional().describe("Emit OSC 9;4 progress sequences during long operations"),todoFeatureEnabled:R().optional().describe("Enable the todo / task tracking panel"),teammateMode:q(Y8).optional().catch(void 0).describe("How spawned teammates execute (tmux, iterm2, in-process, auto)"),remoteControlAtStartup:R().optional().describe("Start Remote Control bridge automatically each session"),isolatePeerMachines:R().optional().describe("Require explicit approval before SendMessage can reach a peer session on another machine via Remote Control"),daemonColdStart:q(["transient","ask"]).optional().describe("When no background service is running: 'transient' spawns one for this login session; 'ask' offers to install it persistently"),crossSessionInbound:q(["accept","hold","refuse"]).optional().catch(void 0).describe("Inbound cross-session peer messages (SendMessage from your other sessions): 'accept' delivers them, 'hold' parks them for your review without letting Claude act, 'refuse' opts this session out. An explicit value always wins. Unset (mode parity): a message auto-delivers only when the sending session's permission-mode class matches yours (bypass↔bypass or prompting↔prompting); a mismatched sender's message is held for your approval; a sender that asserts no class is held only while this session bypasses permission prompts."),autoUploadSessions:R().optional().describe("Mirror local sessions to claude.ai as view-only (no remote control)"),inputNeededNotifEnabled:R().optional().describe("Push to mobile when a permission prompt or question is waiting"),agentPushNotifEnabled:R().optional().describe("Allow Claude to push proactive mobile notifications"),...TX(e)}).passthrough()}var ad=M(()=>zS(nh())),HX=Object.freeze({serverName:"invalid-entry-stripped"});function BX(e,t,n){return I(t.catch((r)=>(n({path:`${e}[]`,message:`Invalid entry was ignored: ${r.issues[0]?.message??"failed validation"}`}),HX))).transform((r)=>r.filter((o)=>o!==HX)).optional()}function $I(e,t){let n=ad(),r={};for(let[b,x]of Object.entries(n.shape))r[b]=x.catch((v)=>{e({path:b,message:`${v.issues[0]?.message??"Failed schema validation"}. This field was ignored.`});return});r.allowedMcpServers=BX("allowedMcpServers",jS(),e).catch(()=>(e({path:"allowedMcpServers",message:'"allowedMcpServers" was present but invalid; enforcing an empty allowlist (no MCP servers admitted) until it is fixed.'}),[])),r.deniedMcpServers=BX("deniedMcpServers",$S(),e).catch(()=>{e({path:"deniedMcpServers",message:'"deniedMcpServers" was present but invalid and was dropped; its entries cannot be enforced until it is fixed.'});return}),r.allowManagedHooksOnly=n.shape.allowManagedHooksOnly.catch(()=>(e({path:"allowManagedHooksOnly",message:'"allowManagedHooksOnly" was present but invalid; treating it as true (only managed hooks run; command-sourced plugins disabled) until it is fixed.'}),!0)),r.syncClaudeAiSkills=n.shape.syncClaudeAiSkills.catch(()=>(e({path:"syncClaudeAiSkills",message:'"syncClaudeAiSkills" was present but invalid; treating it as false (claude.ai skills sync off) until it is fixed.'}),!1)),r.syncClaudeAiPlugins=n.shape.syncClaudeAiPlugins.catch(()=>(e({path:"syncClaudeAiPlugins",message:'"syncClaudeAiPlugins" was present but invalid; treating it as false (claude.ai plugins sync off) until it is fixed.'}),!1)),r.disableCommandPluginSources=n.shape.disableCommandPluginSources.catch(()=>(e({path:"disableCommandPluginSources",message:'"disableCommandPluginSources" was present but invalid; treating it as true (command-sourced plugins disabled) until it is fixed.'}),!0)),r.allowManagedMcpServersOnly=n.shape.allowManagedMcpServersOnly.catch(()=>(e({path:"allowManagedMcpServersOnly",message:'"allowManagedMcpServersOnly" was present but invalid; treating it as true until it is fixed.'}),!0)),r.enforceAvailableModels=n.shape.enforceAvailableModels.catch(()=>(e({path:"enforceAvailableModels",message:'"enforceAvailableModels" was present but invalid; treating it as true until it is fixed.'}),!0)),r.availableModels=I(Ae()).transform((b,x)=>{let v=[];for(let A of b)if(typeof A==="string")v.push(A);else e({path:"availableModels",message:`"availableModels" contained a non-string entry (${JSON.stringify(A)}); the entry was ignored.`});return v}).optional().catch(()=>(e({path:"availableModels",message:'"availableModels" was present but invalid; enforcing an empty allowlist (only the default model is available) until it is fixed.'}),[])),r.forceLoginOrgUUID=n.shape.forceLoginOrgUUID.catch(()=>(e({path:"forceLoginOrgUUID",message:'"forceLoginOrgUUID" was present but invalid; no organization is permitted to log in until it is fixed.'}),[]));let o=!1,s=(b,x)=>{let v=b.safeParse(x);if(v.success)return;return v.error.issues.slice(0,3).map((A)=>A.path.length?`${A.path.join(".")}: ${A.message}`:A.message).join("; ")},i;r.policyHelper=st((b)=>{if(o=!1,i=b,b&&typeof b==="object"&&!Array.isArray(b)){let x=b;for(let v of["defaultSettings","default",...US])if(x[v]!==void 0&&x[v]!==null)e({path:"policyHelper",message:`"${v}" on the singular policyHelper is ignored — static fallback payloads belong on the policyHelpers per-OS entries ("defaultSettings") or the map's "default" key. The intended fallback will NOT apply from here.`,statusOnly:!0});for(let v of["policyHelper","policyHelpers"])if(x[v]!==void 0&&x[v]!==null)e({path:"policyHelper",message:`"${v}" inside the singular policyHelper is ignored — "policyHelper" and "policyHelpers" are TOP-LEVEL settings keys; nothing nests inside the singular entry. The nested config will NOT apply from here.`,statusOnly:!0});for(let v of ss)if(x[v]!==void 0&&x[v]!==null)e({path:"policyHelper",message:`"${v}" on the singular policyHelper is ignored — per-OS entries live on the policyHelpers MAP ("policyHelpers": {"${v}": ...}), not inside the singular key. The intended per-OS config will NOT apply from here.`,statusOnly:!0});if(x.claudeMd!==void 0&&x.claudeMd!==null)e({path:"policyHelper",message:`"claudeMd" on the singular policyHelper is ignored — "claudeMd" is a managed-settings key: put it at the settings top level or inside a static payload, or emit it from the helper's stdout envelope. The intended instructions will NOT apply from here.`,statusOnly:!0});if(x.outputBehavior!==void 0&&x.outputBehavior!==null)e({path:"policyHelper",message:`"outputBehavior" on the singular policyHelper is ignored — it is only honored on the policyHelpers per-OS entries (policyHelpers.${ss.join("/")}); this helper's output REPLACES the policy tier whatever the value says.`,statusOnly:!0});if(x.path===null||x.path===void 0)o=!0}return b===null?void 0:b},FS().optional()).catch((b)=>{e({path:"policyHelper",message:`${b.issues[0]?.message??s(FS(),i)??"Failed schema validation"}. This field was ignored.`,...o&&{statusOnly:!0}});return});let a=(b,x)=>{e({path:b,message:`"${b}" is not a valid static settings payload: ${x??"failed validation"}. When delivered from an OS-admin policy source (MDM or the managed settings file), Claude Code will not start until this is fixed.`,startupFatal:!0})},c=(b)=>{let x=!1,v,A=LI(b,pc().optional().catch((U)=>{x=!0,a(`policyHelpers.${b}.defaultSettings`,U.issues[0]?.message??s(pc(),v&&typeof v==="object"&&!Array.isArray(v)?v.defaultSettings:void 0));return}));return st((U)=>{if(x=!1,v=U,b!=="default"&&U&&typeof U==="object"&&!Array.isArray(U)){let D=U;for(let F of[...US,"claudeMd"])if(D[F]!==void 0&&D[F]!==null)e({path:`policyHelpers.${b}`,message:`"${F}" on the policyHelpers.${b} entry is ignored — helper output cannot be pre-seeded on an entry; a static fallback payload goes under this entry's "defaultSettings" (a managed-settings object). The intended content will NOT apply from here.`,statusOnly:!0});for(let F of["policyHelper","policyHelpers"])if(D[F]!==void 0&&D[F]!==null)e({path:`policyHelpers.${b}`,message:`"${F}" on the policyHelpers.${b} entry is ignored — "policyHelper" and "policyHelpers" are TOP-LEVEL settings keys; nothing nests inside an entry. The nested config will NOT apply from here.`,statusOnly:!0});for(let F of ss)if(D[F]!==void 0&&D[F]!==null)e({path:`policyHelpers.${b}`,message:`"${F}" on the policyHelpers.${b} entry is ignored — per-OS entries are SIBLINGS on the policyHelpers map, not nested inside each other. The intended ${F} config will NOT apply from here.`,statusOnly:!0});if(D.default!==void 0&&D.default!==null)e({path:`policyHelpers.${b}`,message:`"default" on the policyHelpers.${b} entry is ignored — the per-entry static payload field is spelled "defaultSettings"; "default" is the MAP's any-platform catch-all key (a sibling of the OS entries). The intended fallback will NOT apply from here.`,statusOnly:!0});if(qX(U))return}return U===null?void 0:U},A.optional()).catch((U)=>{if(b==="default"){a("policyHelpers.default",U.issues[0]?.message??s(pc(),v));return}if(x)return;let D=s(LI(b),v)??"failed validation",F=v;if(F&&typeof F==="object"&&!Array.isArray(F)){let K=F,V=K.defaultSettings;if(V!==void 0&&V!==null){let ne=pc().safeParse(V);if(ne.success){let oe=K.outputBehavior,_e=oe===void 0||oe===null?null:VX().safeParse(oe);if(_e&&!_e.success){e({path:`policyHelpers.${b}`,message:`Invalid entry was ignored: ${D}. Its "defaultSettings" static payload was NOT kept: "outputBehavior" is unrecognized, so whether the payload replaces or merges over this source's settings is unknown. No policy helper runs on ${b} from this entry.`,statusOnly:!0});return}return e({path:`policyHelpers.${b}`,message:`Invalid entry: its helper fields were ignored (${D}), but its "defaultSettings" static payload was kept. No policy helper runs on ${b} from this entry.`,statusOnly:!0}),{defaultSettings:ne.data,..._e&&{outputBehavior:_e.data}}}}}e({path:`policyHelpers.${b}`,message:`Invalid entry was ignored: ${D}. No policy helper runs on ${b} from this entry.`,statusOnly:!0});return})};r.policyHelpers=st((b)=>{if(b&&typeof b==="object"&&!Array.isArray(b)){let x=b;for(let v of["defaultSettings",...US,"claudeMd"])if(x[v]!==void 0&&x[v]!==null)e({path:"policyHelpers",message:`"${v}" directly on the policyHelpers map is ignored — static fallback payloads go on a per-OS entry's "defaultSettings" or the map's "default" key (a managed-settings object), and helper-output keys come from the helper's stdout. The intended content will NOT apply from here.`,statusOnly:!0});for(let v of["policyHelper","policyHelpers"])if(x[v]!==void 0&&x[v]!==null)e({path:"policyHelpers",message:`"${v}" inside the policyHelpers map is ignored — "policyHelper" and "policyHelpers" are TOP-LEVEL settings keys; the map's keys are the per-OS entries and "default". The nested config will NOT apply from here.`,statusOnly:!0});for(let v of DI.filter((A)=>A!=="defaultSettings"))if(x[v]!==void 0&&x[v]!==null){let A=v==="script"||v==="interpreter"?"; inline scripts are per-OS only (the singular policyHelper key takes a path)":v==="outputBehavior"?"":", or on the singular policyHelper key";e({path:"policyHelpers",message:`"${v}" directly on the policyHelpers map is ignored — helper configs go on a per-OS entry (policyHelpers.${ss.join("/")})${A}. No helper runs from this field here.`,statusOnly:!0})}}return b===null?void 0:b},C(Object.fromEntries(jI.map((b)=>[b,c(b)]))).transform((b)=>{for(let x of Object.keys(b))if(b[x]===void 0)delete b[x];return b}).optional().catch((b)=>(e({path:"policyHelpers",message:`"policyHelpers" could not be parsed: expected an object mapping OS keys (${ss.join(", ")}) to helper entries, plus an optional "default" settings payload (${b.issues[0]?.message??"failed schema validation"}). When delivered from an OS-admin policy source (MDM or the managed settings file), Claude Code will not start until this is fixed.`,startupFatal:!0}),{})));let l=Object.freeze({mode:"deny"}),u=Object.freeze({accessKeyIdVar:"_STRIPPED_",secretAccessKeyVar:"_STRIPPED_2_"}),p=0,f=[],m=t===void 0?"":`${[...t].reduce((b,x)=>Math.imul(b^x.charCodeAt(0),16777619)>>>0,2166136261).toString(16).toUpperCase().padStart(8,"0")}_`,h=(b,x)=>{if(typeof b!=="object"||b===null)return;let v=(Je)=>x.some((wt)=>wt.path?.includes(Je)),A=(Je)=>{let wt=b[Je];if(typeof wt==="string")return wt;return v(Je)?"":void 0},U=A("accessKeyIdVar"),D=A("secretAccessKeyVar"),F=A("sessionTokenVar"),K=nd;if(![U,D,F].some((Je)=>Je!==void 0&&K.includes(Je)))return;let V=(Je)=>Je!==void 0&&td().safeParse(Je).success;p+=1;let ne=(Je)=>`${hI}${Je}_${m}${p}_`,oe=V(U)?U:ne("ACCESS_KEY_ID"),_e=V(D)&&D!==oe?D:ne("SECRET_ACCESS_KEY"),ke=F===void 0?void 0:V(F)&&F!==oe&&F!==_e?F:ne("SESSION_TOKEN"),vt=(Je)=>Je.startsWith(hI);if(!vt(oe)&&!vt(_e)){let Je=K.includes(_e)?_e:void 0;if(_e=ne("SECRET_ACCESS_KEY"),Je!==void 0){let wt=h({accessKeyIdVar:Je},[]);if(wt!==void 0)f.push(wt)}}let Z=RS().safeParse({accessKeyIdVar:oe,secretAccessKeyVar:_e,...ke!==void 0&&{sessionTokenVar:ke}});return Z.success?Z.data:void 0},g=(b,x,v)=>I(x.catch((A)=>{let U=v(A.value);if(U!==void 0)return e({path:`sandbox.credentials.${b}[]`,message:`Invalid entry was degraded to mode "deny": ${A.issues[0]?.message??"failed validation"}. The credential stays blocked (not masked) until the entry is fixed.${b==="files"?" Under sandbox.filesystem.disabled, file read-denies are not enforced.":""}`}),U;return e({path:`sandbox.credentials.${b}[]`,message:`Invalid entry was ignored: ${A.issues[0]?.message??"failed validation"}. This credential is NOT protected until the entry is fixed.`}),l})).transform((A)=>A.filter((U)=>U!==l)).optional().catch((A)=>{if(typeof A.value==="object"&&A.value!==null&&!Array.isArray(A.value)){let U=x.safeParse(A.value);if(U.success)return e({path:`sandbox.credentials.${b}`,message:`"${b}" must be an array; a lone entry object was accepted as a one-element list. Wrap it in [ ] to silence this warning.`}),[U.data];let D=v(A.value);if(D!==void 0)return e({path:`sandbox.credentials.${b}`,message:`"${b}" must be an array; its lone entry object was invalid and was degraded to mode "deny". The credential stays blocked (not masked) until it is fixed.`}),[D]}return e({path:`sandbox.credentials.${b}`,message:`${A.issues[0]?.message??"Invalid value"}. "${b}" was ignored; these credential entries are NOT protected until it is fixed.`}),[]}),y=C({files:g("files",CS(),(b)=>{if(typeof b!=="object"||b===null||!("mode"in b)||b.mode!=="mask"&&b.mode!=="deny"||!("path"in b)||typeof b.path!=="string")return;let x=CS().safeParse({path:b.path,mode:"deny"});return x.success?x.data:void 0}),envVars:g("envVars",kS(),(b)=>{if(typeof b!=="object"||b===null||!("mode"in b)||b.mode!=="mask"&&b.mode!=="deny"||!("name"in b)||typeof b.name!=="string")return;let x=kS().safeParse({name:b.name,mode:"deny"});return x.success?x.data:void 0}),allowPlaintextInject:R().optional().catch((b)=>(e({path:"sandbox.credentials.allowPlaintextInject",message:`${b.issues[0]?.message??"Invalid value"}. "allowPlaintextInject" was degraded to an explicit false; plaintext credential injection stays disabled (lower-precedence values cannot enable it) until it is fixed.`}),!1)),awsPairs:I(RS().catch((b)=>{let x=h(b.value,b.issues);if(x!==void 0)return e({path:"sandbox.credentials.awsPairs[]",message:`Invalid pair was degraded to a non-functional suppressor: ${b.issues[0]?.message??"failed validation"}. It keeps implicit AWS auto-pairing suppressed but re-signs nothing until it is fixed.`}),x;return e({path:"sandbox.credentials.awsPairs[]",message:`Invalid pair was ignored: ${b.issues[0]?.message??"failed validation"}. SigV4 re-signing stays unconfigured for this pair until it is fixed.`}),u})).transform((b)=>{let x=b.filter((v)=>v!==u);if(f.length>0)x.push(...f),f.length=0;return x}).optional().catch((b)=>{let x=typeof b.value==="object"&&b.value!==null?h(b.value,[]):void 0,v=typeof b.value==="object"&&b.value!==null&&(("accessKeyIdVar"in b.value)||("secretAccessKeyVar"in b.value)||("sessionTokenVar"in b.value));if(x===void 0&&v)return f.length=0,e({path:"sandbox.credentials.awsPairs",message:`${b.issues[0]?.message??"Invalid value"}. "awsPairs" must be an array; its lone pair-shaped entry claimed no conventional AWS name and was ignored. SigV4 re-signing stays unconfigured until it is fixed.`}),[];let A=x!==void 0?[x]:nd.flatMap((U)=>{let D=h({accessKeyIdVar:U},[]);return D!==void 0?[D]:[]});if(f.length>0)A.push(...f),f.length=0;return e({path:"sandbox.credentials.awsPairs",message:`${b.issues[0]?.message??"Invalid value"}. "awsPairs" was degraded to non-functional suppressor pair(s); implicit AWS auto-pairing stays suppressed but nothing re-signs until it is fixed.`}),A}),sigv4:C(Object.fromEntries(["streaming","presigned","sigv4a"].map((b)=>[b,q(["deny","passthrough"]).optional().catch((x)=>(e({path:`sandbox.credentials.sigv4.${b}`,message:`${x.issues[0]?.message??"Invalid value"}. "${b}" was degraded to an explicit deny; this SigV4 request shape stays denied until it is fixed.`}),"deny"))]))).optional().catch((b)=>(e({path:"sandbox.credentials.sigv4",message:`${b.issues[0]?.message??"Invalid value"}. "sigv4" was degraded to an all-deny block (all shapes stay denied, and lower-precedence sigv4 values cannot take effect) until it is fixed.`}),{streaming:"deny",presigned:"deny",sigv4a:"deny"}))}).optional().catch((b)=>{e({path:"sandbox.credentials",message:`${b.issues[0]?.message??"Failed schema validation"}. The credentials block was degraded to a fail-closed skeleton (all-deny sigv4, implicit AWS auto-pairing suppressed, no masking) until it is fixed.`});let x=nd.flatMap((v)=>{let A=h({accessKeyIdVar:v},[]);return A!==void 0?[A]:[]});return f.length=0,{allowPlaintextInject:!1,awsPairs:x,sigv4:{streaming:"deny",presigned:"deny",sigv4a:"deny"}}});return r.sandbox=gI().extend({credentials:y}).optional().catch((b)=>{e({path:"sandbox",message:`${b.issues[0]?.message??"Failed schema validation"}. This field was ignored.`});let x=b.value;if(typeof x==="object"&&x!==null&&"credentials"in x){let v=y.safeParse(x.credentials);if(v.success&&v.data!==void 0)return e({path:"sandbox.credentials",message:"The credentials block was salvaged from the invalid sandbox value and stays enforced; every other sandbox field was ignored."}),{credentials:v.data}}return}),C(r).passthrough().transform((b)=>{for(let x of Object.keys(b))if(b[x]===void 0)delete b[x];return b})}function HS(e){if(Array.isArray(e))return e.map(HS);if(e!==null&&typeof e==="object"){let t={};for(let n of Object.keys(e).sort())t[n]=HS(e[n]);return t}return e}function XX(e){if(!e)return{shellSettings:{},envVars:{},hasHooks:!1,hasClaudeMd:!1};let t={},n;for(let c of N8){let l=e[c];if(c==="policyHelpers"){if(l!==null&&typeof l==="object")for(let p of ss){let f=BYe(l[p]);if(f){if(t[`policyHelpers.${p}`]=f.command,f.scriptSize)n??={},n[`policyHelpers.${p}`]=f.scriptSize}}continue}let u;if(typeof l==="string")u=l;else if(l!==null&&typeof l==="object"&&"command"in l&&typeof l.command==="string")u=l.command;if(u!==void 0&&u.length>0)t[c]=u}let r=VYe(e);if(r&&typeof r==="object")for(let[c,l]of Object.entries(r)){let u=l?.source;if(!u||typeof u!=="object")continue;if(u.source==="url"&&typeof u.headersHelper==="string"&&u.headersHelper.length>0)t[`extraKnownMarketplaces[${me(c)}].source.headersHelper`]=YX(u.headersHelper,"url",u.url);if(u.source==="settings"&&Array.isArray(u.plugins)){let p=new Map;for(let f of u.plugins){let m=me(f?.name),h=p.get(m)??0;p.set(m,h+1);let g=f?.source;if(g!==null&&typeof g==="object"&&"source"in g&&g.source==="command"&&"command"in g&&typeof g.command==="string"&&g.command.length>0)t[`extraKnownMarketplaces[${me(c)}].plugins[${me(f.name)}][${h}].source.command`]=g.command;if(typeof f?.headersHelper==="string"&&f.headersHelper.length>0){let y=f.source,S=y!==null&&typeof y==="object";t[`extraKnownMarketplaces[${me(c)}].plugins[${me(f.name)}][${h}].headersHelper`]=YX(f.headersHelper,S&&"source"in y?y.source:void 0,S&&"url"in y?y.url:void 0)}}}}let o=e.sandbox;if(o!==null&&typeof o==="object")for(let c of U8){let l=WYe(o[c]);if(l)t[`sandbox.${c}`]=l}let s={};if(e.env&&typeof e.env==="object")for(let[c,l]of Object.entries(e.env)){if(l===void 0)continue;let u=String(l);if(u.length>0&&!F8(c,u))s[c]=u}let i=e.hooks!==void 0&&e.hooks!==null&&typeof e.hooks==="object"&&Object.keys(e.hooks).length>0,a=typeof e.claudeMd==="string"&&e.claudeMd.length>0;return{shellSettings:t,inlineHelperScriptSizes:n,envVars:s,hasHooks:i,hooks:i?e.hooks:void 0,hasClaudeMd:a,claudeMd:a?e.claudeMd:void 0}}function zYe(e){return Object.keys(e.shellSettings).some((t)=>t.startsWith("policyHelpers."))}function QX(e){return zYe(e)||Object.keys(e.shellSettings).some((t)=>t.startsWith("extraKnownMarketplaces["))}function HYe(e){return e==="sh"||e==="pwsh"}function BYe(e){if(e===null||typeof e!=="object")return;let{path:t,script:n,interpreter:r,timeoutMs:o,refreshIntervalMs:s}=e,i,a;if(typeof t==="string"&&t)i=t;else if(typeof n==="string"&&n&&HYe(r))i={interpreter:r,script:GYe(n)},a=KYe(n);else return;return{command:me([i,o??null,s??null]),scriptSize:a}}function KYe(e){return{bytes:Buffer.byteLength(e,"utf8"),lines:MD(e,`
160
- `)+(e.endsWith(`
161
- `)?0:1)}}function GYe(e){return JX("sha256").update(me(e)).digest("hex")}function WYe(e){if(typeof e==="string")return e||void 0;if(e===null||typeof e!=="object"||!("command"in e)||typeof e.command!=="string"||!e.command)return;let t="args"in e&&Array.isArray(e.args)?e.args.map(String):[];return me([e.command,...t])}function qYe(e){return me(HS({shellSettings:e.shellSettings,envVars:e.envVars,hooks:e.hooks,claudeMd:e.claudeMd}))}function e7(e){return JX("sha256").update(qYe(e)).digest("hex")}function YX(e,t,n){return me([e,typeof t==="string"?t:null,typeof n==="string"?n:null])}function t7(e){return e.replace(/[^\x20-\x7e]/gu,"?")}function VYe(e){let t=e.extraKnownMarketplaces;if(t!==void 0&&t!==null)return t;let n=e;for(let{alias:r,canonical:o}of Jm){if(o!=="extraKnownMarketplaces")continue;let s=n[r];if(s!==void 0&&s!==null&&typeof s==="object")return s}return}var ZYe="remote-settings.json";var r7="remote-settings-helper-consent";function YYe(){return n7(Gt(),r7)}function JYe(e){if(e.policyHelpers===void 0&&e.extraKnownMarketplaces===void 0&&!Jm.some(({alias:n,canonical:r})=>r==="extraKnownMarketplaces"&&e[n]!==void 0))return;let t=XX(e);return QX(t)?e7(t):void 0}function XYe(e){return Ym(e,(t,n)=>n.startsWith("$")&&n!=="$schema")}class o7{sessionCache=null;eligible=void 0;eligibilityMemo=void 0;policySettingsNotified=!1;verifiedPayload=null;unverifiedView=null;consentedPayload=null;resetEpoch=0;backendView=void 0;replaceSessionCache(e,t){if(this.sessionCache=e,t?.verified)this.verifiedPayload=e}seedFromDisk(e){this.sessionCache=e;let t=JYe(e);if(t===void 0||t===nJe())this.consentedPayload??=e}markConsented(e){this.consentedPayload=e}markPolicySettingsNotified(){this.policySettingsNotified=!0}recordEligibility(e,t){if(this.eligible=e,t.memoize)this.eligibilityMemo=e}resetListener=null;registerResetListener(e){if(this.resetListener!==null)throw Error("registerSyncCacheResetListener: a listener is already registered; a second one would unhook the first");this.resetListener=e}reset(){this.sessionCache=null,this.eligible=void 0,this.eligibilityMemo=void 0,this.policySettingsNotified=!1,this.verifiedPayload=null,this.unverifiedView=null,this.consentedPayload=null,this.resetEpoch++}}var QYe=new tt(()=>new o7);function zI(){return QYe.of(Tt().host)}function BS(){return}function eJe(){return BS()??n7(Gt(),ZYe)}function tJe(){try{let e=rJe();if(e===null)return null;let t=yt(_u(e));if(!t||typeof t!=="object"||Array.isArray(t))return null;return XYe(t)}catch{return null}}function nJe(){let e=HI();if(e!==void 0)return e.attestation;try{return sc(YYe()).trim()||void 0}catch{return}}function rJe(){let e=HI();if(e!==void 0)return e.content;return sc(eJe())}function HI(){let e=zI().backendView;if(!Te()||e===void 0||!e.ready||e.stoodDown||BS()!==void 0)return;if(!zL(e.configHome)){e.standDown("config home changed");return}return e}var t2t=en.state("remote-settings"),n2t=en.state(r7);var oJe=new Set(["HTTPS_PROXY","HTTP_PROXY","NO_PROXY","CLAUDE_CODE_PROXY_RESOLVES_HOSTS","CLAUDE_CODE_ENABLE_PROXY_AUTH_HELPER","CLAUDE_CODE_PROXY_AUTH_HELPER_TTL_MS","API_FORCE_IDLE_TIMEOUT","ANTHROPIC_UNIX_SOCKET","NODE_EXTRA_CA_CERTS","CLAUDE_CODE_CERT_STORE","CLAUDE_CODE_CLIENT_CERT","CLAUDE_CODE_CLIENT_KEY","CLAUDE_CODE_CLIENT_KEY_PASSPHRASE","ALL_PROXY","NODE_OPTIONS","NODE_TLS_REJECT_UNAUTHORIZED",...aI,...cI,"AWS_ENDPOINT_URL_STS","AWS_ENDPOINT_URL","AWS_ENDPOINT_URL_SSO","AWS_ENDPOINT_URL_SSO_OIDC","AWS_ENDPOINT_URL_BEDROCK","AWS_ENDPOINT_URL_BEDROCK_RUNTIME",...pI,...fI,...mI,"CLOUDSDK_CONFIG","GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES","GCLOUD_PROJECT","CLAUDE_CODE_CUSTOM_OAUTH_URL",...lI,"CLAUDE_CODE_API_BASE_URL","CLAUDE_CODE_OAUTH_REFRESH_TOKEN","CLAUDE_CODE_OAUTH_SCOPES","CLAUDE_CODE_OAUTH_CLIENT_ID","CLAUDE_CODE_SESSION_ACCESS_TOKEN","CLAUDE_SESSION_INGRESS_TOKEN_FILE","CLAUDE_CODE_ENVIRONMENT_KIND","CLAUDE_CODE_REMOTE_SESSION_ID","ANTHROPIC_FEDERATION_RULE_ID","ANTHROPIC_ORGANIZATION_ID","ANTHROPIC_WORKSPACE_ID","ANTHROPIC_SERVICE_ACCOUNT_ID","ANTHROPIC_IDENTITY_TOKEN","ANTHROPIC_IDENTITY_TOKEN_FILE","ANTHROPIC_SCOPE","ANTHROPIC_PROFILE","ANTHROPIC_CONFIG_DIR","CLAUDE_CODE_FEDERATION_CACHE_DIR","HOME","XDG_CONFIG_HOME","APPDATA","USERPROFILE","ANTHROPIC_CUSTOM_HEADERS","CLAUDE_CODE_HOST_CREDS_FILE","CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST","CLAUDE_CODE_HOST_AUTH_ENV_VAR","CLAUDE_CONFIG_DIR","CLAUDE_SECURESTORAGE_CONFIG_DIR","CLAUDE_CODE_REMOTE_SETTINGS_PATH","CLAUDE_CODE_MANAGED_SETTINGS_PATH","CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION","CLAUDE_CODE_MOCK_REMOTE_SETTINGS","USE_LOCAL_OAUTH","USE_STAGING_OAUTH","CLAUDE_LOCAL_OAUTH_API_BASE","CLAUDE_LOCAL_OAUTH_APPS_BASE","CLAUDE_LOCAL_OAUTH_CONSOLE_BASE","CLAUDE_BRIDGE_BASE_URL","CLAUDE_BRIDGE_OAUTH_TOKEN","CLAUDE_BRIDGE_SESSION_INGRESS_URL","CLAUDE_REMOTE_TOOLS_BRIDGE_URL"].map((e)=>e.toUpperCase()));function sJe(e){if(!e?.env)return e;let t=Ym(e.env,(n,r)=>oJe.has(r.toUpperCase()));return{...e,env:t}}function iJe(){let e=zI();if(!BS()&&e.eligible!==!0)return null;if(e.sessionCache)return e.sessionCache;let t=HI()!==void 0,n=tJe();if(n){if(e.seedFromDisk(n),t)cc().invalidatePolicyLayer();else j8();return n}return null}function s7(){let e=iJe(),t=zI();if(e===t.verifiedPayload||BS())return e;if(e===null)return null;if(t.unverifiedView?.raw!==e)t.unverifiedView={raw:e,view:sJe(e)};return t.unverifiedView.view}var i7=["userSettings","projectSettings","localSettings","flagSettings","policySettings"];function aJe(e){return e!==void 0&&(e.commit!==void 0||e.pr!==void 0)}function a7(e,t){let n=e?.commitTrailers;if(typeof n==="boolean")return n?"explicit-enabled":"disabled";if(e!==void 0&&aJe(e))return e.commit===""?"disabled":"implicit-enabled";if(t!==void 0)return t?"implicit-enabled":"disabled";return}import{userInfo as cJe}from"os";var c7="com.anthropic.claudecode",rh="HKLM\\SOFTWARE\\Policies\\ClaudeCode",oh="HKCU\\SOFTWARE\\Policies\\ClaudeCode",Bi="Settings",l7="/usr/bin/plutil",u7=["-convert","json","-o","-","--"],d7=5000,BI="/mnt/c/Windows/System32/reg.exe",cd="/mnt/c/Program Files/ClaudeCode";function KS(){if(process.platform!=="linux")return!1;if(process.env.WSL_DISTRO_NAME)return!0;try{let e=ue("fs").readFileSync("/proc/version","utf8").toLowerCase();return e.includes("microsoft")||e.includes("wsl")}catch{return!1}}function p7(){let e="";try{e=cJe().username}catch{}let t=[];if(e)t.push({path:`/Library/Managed Preferences/${e}/${c7}.plist`,label:"per-user managed preferences"});return t.push({path:`/Library/Managed Preferences/${c7}.plist`,label:"device-level managed preferences"}),t}var f7=512;function m7(e){return e.map(lJe)}function lJe(e){let{file:t,severity:n,docLink:r,statusOnly:o,startupFatal:s,mcpErrorMetadata:i,path:a,message:c,expected:l,suggestion:u,invalidValue:p,...f}=e,m=f;return{file:t,severity:n,docLink:r,statusOnly:o,startupFatal:s,mcpErrorMetadata:i,path:sh(a),message:sh(c),expected:l===void 0?void 0:sh(l),suggestion:u===void 0?void 0:sh(u),invalidValue:typeof p==="string"?sh(p):void 0}}function sh(e){let t=t7(e.replace(/\s+/gu," "));return t.length>f7?`${t.slice(0,f7-1)}…`:t}var Fs="https://code.claude.com/docs/en",uJe=[{matches:(e)=>e.path==="permissions.defaultMode"&&e.code==="invalid_value",tip:{suggestion:'Valid modes: "acceptEdits" (ask before file changes), "plan" (analysis only), "bypassPermissions" (auto-accept all), or "default" (standard behavior)',docLink:`${Fs}/iam#permission-modes`}},{matches:(e)=>e.path==="apiKeyHelper"&&e.code==="invalid_type",tip:{suggestion:'Provide a shell command that outputs your API key to stdout. The script should output only the API key. Example: "/bin/generate_temp_api_key.sh"'}},{matches:(e)=>e.path==="cleanupPeriodDays"&&e.code==="too_small",tip:{suggestion:'cleanupPeriodDays must be at least 1. To keep transcripts for a long time, set a large number (e.g. 3650 for ~10 years). To disable transcript writes entirely, remove this setting and use the --no-session-persistence CLI flag or the SDK persistSession:false option instead. (0 is rejected because it previously silently disabled all transcript writes, which users setting it to mean "never clean up" did not expect.)'}},{matches:(e)=>e.path.startsWith("env.")&&e.code==="invalid_type",tip:{suggestion:'Environment variables must be strings. Wrap numbers and booleans in quotes. Example: "DEBUG": "true", "PORT": "3000"',docLink:`${Fs}/settings#environment-variables`}},{matches:(e)=>(e.path==="permissions.allow"||e.path==="permissions.deny")&&e.code==="invalid_type"&&e.expected==="array",tip:{suggestion:'Permission rules must be in an array. Format: ["Tool(specifier)"]. Examples: ["Bash(npm run build)", "Edit(docs/**)", "Read(~/.zshrc)"]. Use * for wildcards.'}},{matches:(e)=>e.path.startsWith("hooks.")&&e.code==="invalid_key",tip:{suggestion:"Not a recognized hook event. Common events: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop. Check spelling and capitalization.",docLink:`${Fs}/hooks`}},{matches:(e)=>/\.hooks\.\d+\.command$/.test(e.path)&&e.code==="invalid_type"&&e.received==="undefined",tip:{suggestion:'Command hooks require `command`. For exec form (no shell), set `command` to the executable and `args` to its arguments: {"type": "command", "command": "echo", "args": ["hi"]}. For shell form, set `command` to the full shell string: {"type": "command", "command": "echo hi"}.',docLink:`${Fs}/hooks#exec-form-and-shell-form`}},{matches:(e)=>e.path.includes("hooks")&&e.code==="invalid_type",tip:{suggestion:'Hooks use a matcher + hooks array. The matcher is a string: a tool name ("Bash"), pipe-separated list ("Edit|Write"), or empty to match all. Example: {"PostToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "echo Done"}]}]}'}},{matches:(e)=>e.code==="invalid_type"&&e.expected==="boolean",tip:{suggestion:'Use true or false without quotes. Example: "includeCoAuthoredBy": true'}},{matches:(e)=>e.code==="unrecognized_keys",tip:{suggestion:"Check for typos or refer to the documentation for valid fields",docLink:`${Fs}/settings`}},{matches:(e)=>e.code==="invalid_value"&&e.enumValues!==void 0,tip:{suggestion:void 0}},{matches:(e)=>e.code==="invalid_type"&&e.expected==="object"&&e.received===null&&e.path==="",tip:{suggestion:"Check for missing commas, unmatched brackets, or trailing commas. Use a JSON validator to identify the exact syntax error."}},{matches:(e)=>e.path==="permissions.additionalDirectories"&&e.code==="invalid_type",tip:{suggestion:'Must be an array of directory paths. Example: ["~/projects", "/tmp/workspace"]. You can also use --add-dir flag or /add-dir command',docLink:`${Fs}/iam#working-directories`}}],dJe={permissions:`${Fs}/iam#configuring-permissions`,env:`${Fs}/settings#environment-variables`,hooks:`${Fs}/hooks`};function h7(e){let t=uJe.find((r)=>r.matches(e));if(!t)return null;let n={...t.tip};if(e.code==="invalid_value"&&e.enumValues&&!n.suggestion)n.suggestion=`Valid values: ${e.enumValues.map((r)=>`"${r}"`).join(", ")}`;if(!n.docLink&&e.path)n.docLink=dJe[uE(e.path,".")];return n}var j2t=M(()=>zS(nh(),{strictPolicyHelperKeys:!0}).strict());function g7(e){return e.code==="invalid_type"}function _7(e){return e.code==="invalid_value"}function pJe(e){return e.code==="unrecognized_keys"}function y7(e){return e.code==="too_small"}function Rr(e){if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";return typeof e}function b7(e){let t=e.match(/received (\w+)/);return t?t[1]:void 0}function ih(e,t){return e.issues.map((n)=>{let r=n.path.map(String).join("."),o=n.message,s,i,a,c,l;if(_7(n))i=n.values.map((p)=>String(p)),a=i.join(" | "),c=void 0,l=void 0;else if(g7(n)){a=n.expected;let p=b7(n.message);c=p??Rr(n.input),l=p??Rr(n.input)}else if(y7(n))a=String(n.minimum);else if(n.code==="custom"&&"params"in n)c=n.params.received,l=c;let u=h7({path:r,code:n.code,expected:a,received:c,enumValues:i,message:n.message,value:c});if(_7(n))s=i?.map((p)=>`"${p}"`).join(", "),o=`Invalid value. Expected one of: ${s}`;else if(g7(n)){let p=b7(n.message)??Rr(n.input);if(n.expected==="object"&&p==="null"&&r==="")o="Invalid or malformed JSON";else o=`Expected ${n.expected}, but received ${p}`}else if(pJe(n)){let p=n.keys.join(", ");o=`Unrecognized ${aE(n.keys.length,"field")}: ${p}`}else if(y7(n))o=`Number must be greater than or equal to ${n.minimum}`,s=String(n.minimum);return{file:t,path:r,message:o,expected:s,invalidValue:l,suggestion:u?.suggestion,docLink:u?.docLink}})}function fJe(e,t){if(!e||typeof e!=="object")return[];let n=e;if(!n.permissions||typeof n.permissions!=="object")return[];let r=n.permissions,o=[];for(let s of["allow","deny","ask"]){let i=r[s];if(!Array.isArray(i))continue;r[s]=i.filter((a)=>{if(typeof a!=="string")return o.push({file:t,path:`permissions.${s}`,message:`Non-string value in ${s} array was removed`,severity:"warning",invalidValue:a}),!1;let c=PI(a,s);if(!c.valid){let l=`Invalid permission rule "${a}" was skipped: ${c.error}`;if(c.suggestion)l+=`. ${c.suggestion}`;return o.push({file:t,path:`permissions.${s}`,message:l,severity:"warning",invalidValue:a}),!1}return!0})}return o}var mJe=new Set(bc);function hJe(e,t){if(!e||typeof e!=="object")return[];let n=e;if(!("hooks"in n))return[];if(n.hooks===null||typeof n.hooks!=="object"||Array.isArray(n.hooks)){let s=Rr(n.hooks);return delete n.hooks,[{file:t,path:"hooks",message:`"hooks" must be an object mapping event names to matcher arrays; received ${s}. This field was ignored.`,severity:"warning",invalidValue:s,docLink:"https://code.claude.com/docs/en/hooks"}]}let r=n.hooks,o=[];for(let s of Object.keys(r)){if(!mJe.has(s)){delete r[s],o.push({file:t,path:`hooks.${s}`,message:`Unknown hook event "${s}" was ignored. Valid events: ${bc.join(", ")}`,severity:"warning",invalidValue:s,docLink:"https://code.claude.com/docs/en/hooks"});continue}if(!Array.isArray(r[s])){let i=Rr(r[s]);delete r[s],o.push({file:t,path:`hooks.${s}`,message:`Hook event "${s}" must be an array of matchers; received ${i}. This entry was ignored.`,severity:"warning",invalidValue:i,docLink:"https://code.claude.com/docs/en/hooks"})}}if(o.length>0&&Object.keys(r).length===0)delete n.hooks;return o}var gJe=[{key:"allowedMcpServers",schema:jS},{key:"deniedMcpServers",schema:$S}];function _Je(e,t,n){if(!e||typeof e!=="object")return[];let r=e,o=[];for(let{key:s,schema:i}of gJe){if(!(s in r))continue;if(!Array.isArray(r[s])){if(n?.keepWholeFieldInvalid)continue;let l=r[s];delete r[s],o.push({file:t,path:s,message:`"${s}" must be an array; received ${Rr(l)}. This field was ignored.`,severity:"warning",invalidValue:l});continue}let a=r[s],c=[];for(let l=0;l<a.length;l++){let u=i().safeParse(a[l]);if(u.success)c.push(a[l]);else o.push({file:t,path:`${s}[${l}]`,message:`Invalid entry was ignored: ${u.error.issues[0]?.message??"failed validation"}`,severity:"warning",invalidValue:a[l]})}if(c.length<a.length)r[s]=c}return o}function yJe(e){if(!e||typeof e!=="object")return;let t=e.source;if(!t||typeof t!=="object")return;let n=t.source;return typeof n==="string"?n:void 0}function bJe(e){if(!e||typeof e!=="object")return!1;let t=e.source;if(!t||typeof t!=="object")return!1;let n=t.plugins;return Array.isArray(n)&&n.some(TI)}function SJe(e,t){if(!e||typeof e!=="object")return[];let n=e,r="extraKnownMarketplaces";if(!(r in n))return[];let o=n[r];if(!o||typeof o!=="object"||Array.isArray(o)){let a=Rr(o);return delete n[r],[{file:t,path:r,message:`"${r}" must be an object mapping marketplace names to declarations; received ${a}. This field was ignored.`,severity:"warning",invalidValue:a}]}let s=o,i=[];for(let a of Object.keys(s)){let c=MI().safeParse(s[a]),l;if(!c.success){let u=yJe(s[a]);if(u!==void 0&&!xX.has(u)||bJe(s[a]))continue;l=PS(c.error.issues)}else if(c.data.source.source==="settings"&&c.data.source.name!==a)l=`key "${dc(a)}" must match the settings source name "${dc(c.data.source.name)}"`;if(l!==void 0)i.push({file:t,path:`${r}.${dc(a)}`,message:`Invalid marketplace entry was ignored: ${l}`,severity:"warning"}),delete s[a]}return i}function EJe(e,t){if(!e||typeof e!=="object")return[];let n=e,r="modelPicker";if(!(r in n))return[];let o=n[r];if(!pn(o)||!Array.isArray(o.options)){let c=pn(o)?`options: ${Rr(o.options)}`:Rr(o);return delete n[r],[{file:t,path:r,message:`"${r}" must be an object with an "options" array of { model, label?, description? } rows; received ${c}. This field was ignored.`,severity:"warning",invalidValue:c}]}let s=[];if("replaceBuiltInOptions"in o&&typeof o.replaceBuiltInOptions!=="boolean"){let c=Rr(o.replaceBuiltInOptions);delete o.replaceBuiltInOptions,s.push({file:t,path:`${r}.replaceBuiltInOptions`,message:`"replaceBuiltInOptions" must be true or false; received ${c}. This entry was ignored (the rows are added to the built-in lineup).`,severity:"warning",invalidValue:c})}let i=o.options,a=[];for(let c=0;c<i.length;c++){let l=FI().safeParse(i[c]);if(l.success){a.push(i[c]);continue}s.push({file:t,path:`${r}.options.${c}`,message:`${vJe(l.error.issues[0])}. This row was ignored; the other rows still apply.`,severity:"warning",invalidValue:Rr(i[c])})}if(a.length!==i.length)o.options=a;return s}function xJe(e,t){if(!e||typeof e!=="object"||Array.isArray(e))return[];let n=e;if(!("modelPricing"in n)||n.modelPricing===void 0)return[];let r=n.modelPricing;if(!r||typeof r!=="object"||Array.isArray(r))return delete n.modelPricing,[{file:t,path:"modelPricing",message:`"modelPricing" must be an object; received ${Rr(r)}. It was ignored.`,severity:"warning"}];let o=r,s=[];if(o.multiplier!==void 0&&!UI().safeParse(o.multiplier).success)s.push({file:t,path:"modelPricing.multiplier",message:'"multiplier" must be a number in (0, 1]. It was ignored.',severity:"warning",invalidValue:o.multiplier}),delete o.multiplier;if(o.overrides!==void 0){let i=o.overrides;if(!i||typeof i!=="object"||Array.isArray(i))s.push({file:t,path:"modelPricing.overrides",message:`"overrides" must be an object mapping model ID to rates; received ${Rr(i)}. It was ignored.`,severity:"warning"}),delete o.overrides;else{let a=i;for(let c of Object.keys(a)){let l=NI().safeParse(a[c]);if(l.success&&c!=="constructor"&&c!=="__proto__")continue;let u=l.success?void 0:l.error.issues[0];s.push({file:t,path:`modelPricing.overrides.${dc(c)}`,message:`Invalid pricing row was ignored (${u?`${u.path.join(".")||"row"}: ${u.message}`:"not a model ID"}).`,severity:"warning",invalidValue:a[c]}),delete a[c]}}}return s}function vJe(e){if(!e)return"Invalid modelPicker row";return`modelPicker row ${e.path.length>0?`"${e.path.join(".")}" `:""}${e.message}`.trim()}function fc(e,t,n){return[...O8(e,t),...fJe(e,t),...hJe(e,t),...SJe(e,t),...EJe(e,t),...xJe(e,t),...n?.skipMcpServerEntryFilter?[]:_Je(e,t,{keepWholeFieldInvalid:n?.mcpServerEntrySalvageOnly})]}function qI(e){let t=new Set(e.allowedSources);return t.add("flagSettings"),t.add("policySettings"),i7.filter((n)=>t.has(n))}function TJe(){return Do(ac(),"managed-settings.json")}function VI(e){if(jr()==="wsl"&&e.wslInherits?.()){let t=KI(cd,e.store);if(t.settings)return t;let n=KI(ac(),e.store);return{settings:n.settings,errors:[...t.errors,...n.errors]}}return KI(ac(),e.store)}function CJe(e){return e.endsWith(".json")&&!e.startsWith(".")}function KI(e,t){let n=[],r={},o=!1,{settings:s,errors:i}=ud(Do(e,"managed-settings.json"),t,void 0,!0);if(n.push(...i),s&&Object.keys(s).length>0)r=zn(r,s,Jr),o=!0;let a=Do(e,"managed-settings.d");try{let c=t.folderListingForPolicyWalk(a),l;if(c!==void 0)l=c;else l=Qe().readdirSync(a).filter((u)=>(u.isFile()||u.isSymbolicLink())&&CJe(u.name)).map((u)=>u.name).sort(),t.noteWalkListing(a,l);for(let u of l){let{settings:p,errors:f}=ud(Do(a,u),t,void 0,!0);if(n.push(...f),p&&Object.keys(p).length>0)r=zn(r,p,Jr),o=!0}}catch(c){let l=Ne(c);if(l!=="ENOENT"&&l!=="ENOTDIR")de(`managed-settings.d read failed: ${c}`,{level:"error"})}return{settings:o&&mc(r)?r:null,errors:n}}function kJe(e,t){if(br(e))LJe(t);else de(`settings file read failed at ${t}: ${e}`,{level:"error"})}function ud(e,t,n,r){let o=n!==void 0?`${e}\x00pinned`:e,s=t.parsedFiles.get(o);if(s)return{settings:s.settings?fo(s.settings):null,errors:s.errors};let i=IJe(e,n,r);return t.parsedFiles.set(o,i),{settings:i.settings?fo(i.settings):null,errors:i.errors}}function ZI(e){if(!e.mdm)return{settings:null,errors:[]};let t=e.mdm();return{settings:Object.keys(t.settings).length>0?t.settings:null,errors:t.errors}}function WS(e,t){let n=S7.get(e),r=n?.get(t);if(r)return{settings:r.settings&&fo(r.settings),errors:r.errors.map((s)=>({...s}))};let o=RJe(e,t);if(n)n.set(t,o);else S7.set(e,new Map([[t,o]]));return{settings:o.settings&&fo(o.settings),errors:o.errors.map((s)=>({...s}))}}var S7=new WeakMap;function RJe(e,t){let n=fo(e),r=fc(n,t,{skipMcpServerEntryFilter:!0}),o=[],s=$I(A7(t,o),t).safeParse(n);if(!s.success)return{settings:null,errors:[...r,...ih(s.error,t)]};return{settings:Object.keys(s.data).length>0?s.data:null,errors:[...r,...o]}}function A7(e,t){return(n)=>{if(t.push({file:e,path:n.path,message:n.message,severity:"warning",...n.statusOnly&&{statusOnly:n.statusOnly},...n.startupFatal&&{startupFatal:n.startupFatal}}),n.statusOnly||n.startupFatal)de(`${e}: ${n.path}: ${n.message}`,{level:n.startupFatal?"error":"warn"})}}function T7(e){let t=e?.remote?e.remote():s7();if(!t||Object.keys(t).length===0)return{settings:null,errors:[]};let{settings:n,errors:r}=WS(t,"remote managed settings");return{settings:n,errors:m7(r)}}function OJe(e){let t=e.parentManaged;if(!t||Object.keys(t).length===0)return{settings:null,errors:[]};return WS(t,"parent managed settings")}function C7(e){let t=e.flagInline;if(!t)return{settings:null,errors:[]};let n=fo(t),r=fc(n,"SDK inline settings"),o=ad().safeParse(n);if(!o.success)return{settings:null,errors:[...r,...ih(o.error,"SDK inline settings")]};return{settings:o.data,errors:r}}var PJe=2097152;function IJe(e,t,n){try{let r;if(t!==void 0)r=t;else{let{resolvedPath:o}=tf(Qe(),e);r=sc(o,PJe)}return DJe(r,e,n)}catch(r){return NJe(r,e)}}function DJe(e,t,n){if(e.trim()==="")return{settings:{},errors:[]};let r=fo(ic(e,!1));if(n){let i=fc(r,t,{skipMcpServerEntryFilter:!0}),a=[],c=$I(A7(t,a),t).safeParse(r);if(!c.success)return{settings:null,errors:[...i,...ih(c.error,t)]};return{settings:c.data,errors:[...i,...a]}}let o=fc(r,t),s=ad().safeParse(r);if(!s.success){let i=ih(s.error,t);return{settings:null,errors:[...o,...i]}}return{settings:s.data,errors:o}}function LJe(e){de(`Broken symlink or missing file encountered for settings.json at path: ${e}`)}function MJe(){return{settings:null,errors:[]}}function NJe(e,t){if(kJe(e,t),br(e))return MJe();return{settings:null,errors:[{file:t,path:"",message:`Settings file could not be read: ${e instanceof Error?e.message:String(e)}`,severity:"fatal"}]}}function E7(e,t){switch(e){case"userSettings":return Xr(Gt());case"policySettings":case"projectSettings":return Xr(t.cwd);case"localSettings":return k7(t.cwd,t.canonicalGitRoot);case"flagSettings":return t.flagPath?AJe(Xr(t.flagPath)):Xr(t.cwd)}}function k7(e,t){let n=UJe(e,t);if(n.decided!==void 0)return n.decided;if(!$Je(n.root))return n.cwdResolved;return n.root}function UJe(e,t){let n=t?.(e);if(!n)return{decided:Xr(e)};let r=Xr(n),o=Xr(e);if(r===o)return{decided:r};let s;try{s=zJe()}catch{return{decided:o}}if(r===s)return{decided:o};return{decided:void 0,root:r,cwdResolved:o}}function FJe(e){return cc().localStoreProbes.canonicalRootOwnerUids(e,jJe)}function jJe(e){let t=Qe(),n=null;try{n=t.lstatSync(Do(e,".claude")).uid}catch(r){if(!br(r))throw r}return{rootUid:t.statSync(e).uid,gitEntryUid:t.lstatSync(Do(e,".git")).uid,claudeEntryUid:n}}function $Je(e){if(typeof process.getuid!=="function"&&typeof process.geteuid!=="function")return de(`localSettings: not canonicalizing the consent store to ${e} — this platform has no uid semantics to verify directory ownership with, so the store stays at the session cwd (canonicalization is POSIX-only)`,{level:"warn"}),!1;let t=typeof process.geteuid==="function"?process.geteuid():process.getuid?.();try{let{rootUid:n,gitEntryUid:r,claudeEntryUid:o}=FJe(e);if(n===t&&r===t&&(o===null||o===t))return!0;return de(`localSettings: not canonicalizing the consent store to ${e} — it (uid ${n}), its .git entry (uid ${r}), or its .claude entry (uid ${o??"absent"}) is not owned by the current user (uid ${t}); the store stays at the session cwd (the pre-canonicalization behavior). If you own this repo, chown it (including .git and .claude) or run from a directory you own.`,{level:"warn"}),!1}catch(n){return de(`localSettings: not canonicalizing the consent store to ${e} — its ownership could not be verified (${n instanceof Error?n.message:String(n)}); the store stays at the session cwd`,{level:"warn"}),!1}}function zJe(){return cc().localStoreProbes.normalizedRealHomeDir(HJe)}function HJe(){let e=iE(wJe());if(e===null)throw Error("home directory realpath unavailable");return ct(e)}var x7={default:"settings.json",cowork:"cowork_settings.json"};function BJe(e){if(e.coworkPlugins||Mn.CLAUDE_CODE_USE_COWORK_PLUGINS)return x7.cowork;return x7.default}function ch(e,t){switch(e){case"userSettings":return Do(E7(e,t),BJe(t));case"projectSettings":case"localSettings":return Do(E7(e,t),R7(e));case"policySettings":return TJe();case"flagSettings":return t.flagPath}}function R7(e){switch(e){case"projectSettings":return Do(".claude","settings.json");case"localSettings":return Do(".claude","settings.local.json")}}function O7(e){if(k7(e.cwd,e.canonicalGitRoot)===Xr(e.cwd))return;return Do(Xr(e.cwd),R7("localSettings"))}function P7(e,t){let n=t.store.perSource.get(e);if(n!==void 0)return n;let r=c8e(e,t);return t.store.perSource.set(e,r),r}function KJe(e){return!e||e.parentSettingsBehavior==="merge"}var I7=[{path:["allowManagedPermissionRulesOnly"],restrictive:!0},{path:["allowManagedHooksOnly"],restrictive:!0},{path:["allowManagedMcpServersOnly"],restrictive:!0},{path:["enforceAvailableModels"],restrictive:!0},{path:["disableAllHooks"],restrictive:!0},{path:["disableClaudeAiConnectors"],restrictive:!0},{path:["disableCommandPluginSources"],restrictive:!0},{path:["disableSideloadFlags"],restrictive:!0},{path:["disableSkillShellExecution"],restrictive:!0},{path:["disableRemoteControl"],restrictive:!0},{path:["disableAgentView"],restrictive:!0},{path:["disableWorkflows"],restrictive:!0},{path:["disableArtifact"],restrictive:!0},{path:["disableBundledSkills"],restrictive:!0},{path:["fastModePerSessionOptIn"],restrictive:!0},{path:["isolatePeerMachines"],restrictive:!0},{path:["strictPluginOnlyCustomization"],restrictive:!0},{path:["disableAutoMode"],restrictive:"disable"},{path:["disableDeepLinkRegistration"],restrictive:"disable"},{path:["permissions","disableBypassPermissionsMode"],restrictive:"disable"},{path:["permissions","disableAutoMode"],restrictive:"disable"},{path:["autoMode","classifyAllShell"],restrictive:!0},...[],{path:["worktree","bgIsolation"],restrictive:"worktree"},{path:["enableArtifact"],restrictive:!1},{path:["enableWorkflows"],restrictive:!1},{path:["syncClaudeAiSkills"],restrictive:!1},{path:["syncClaudeAiPlugins"],restrictive:!1},{path:["useAutoModeDuringPlan"],restrictive:!1},{path:["skipDangerousModePermissionPrompt"],restrictive:!1},{path:["skipAutoPermissionPrompt"],restrictive:!1},{path:["enableAllProjectMcpServers"],restrictive:!1},{path:["channelsEnabled"],restrictive:!1},{path:["skipWebFetchPreflight"],restrictive:!1},{path:["skipWorkflowUsageWarning"],restrictive:!1},{path:["autoUploadSessions"],restrictive:!1},{path:["remoteControlAtStartup"],restrictive:!1},{path:["autoContinueAtUsageLimit"],restrictive:!1},...[],{path:["attribution","sessionUrl"],restrictive:!1},{path:["crossSessionInbound"],restrictive:["refuse","hold"]},{path:["modelProposedGoals"],restrictive:["disabled","alwaysAsk"]},{path:["feedbackDrafts"],restrictive:"off"},{path:["askUserQuestionTimeout"],restrictive:"never"},{path:["dialogExpiry"],restrictive:"never"},{path:["sandbox","enabled"],restrictive:!0},{path:["sandbox","failIfUnavailable"],restrictive:!0},{path:["sandbox","autoAllowBashIfSandboxed"],restrictive:!1},{path:["sandbox","allowUnsandboxedCommands"],restrictive:!1},{path:["sandbox","enableWeakerNestedSandbox"],restrictive:!1},{path:["sandbox","enableWeakerNetworkIsolation"],restrictive:!1},{path:["sandbox","allowAppleEvents"],restrictive:!1},{path:["sandbox","network","allowManagedDomainsOnly"],restrictive:!0},{path:["sandbox","network","strictAllowlist"],restrictive:!0},{path:["sandbox","network","allowAllUnixSockets"],restrictive:!1},{path:["sandbox","network","allowLocalBinding"],restrictive:!1},{path:["sandbox","filesystem","allowManagedReadPathsOnly"],restrictive:!0},{path:["sandbox","filesystem","disabled"],restrictive:!1},{path:["sandbox","credentials","allowPlaintextInject"],restrictive:!1},{path:["sandbox","credentials","sigv4","streaming"],restrictive:"deny"},{path:["sandbox","credentials","sigv4","presigned"],restrictive:"deny"},{path:["sandbox","credentials","sigv4","sigv4a"],restrictive:"deny"}];function D7(e){return Array.isArray(e)?e:[e]}var GJe=[["permissions","defaultMode"],["modelPicker","replaceBuiltInOptions"]];function ld(e,t){let n=e;for(let r of t){if(n===null||typeof n!=="object")return;n=n[r]}return n}function ah(e,t,n){let r=[e],o=e;for(let i of t.slice(0,-1)){let a={...o[i]};o[i]=a,o=a,r.push(o)}let s=t.at(-1);if(n!==void 0){o[s]=n;return}delete o[s];for(let i=r.length-1;i>0;i--){if(Object.keys(r[i]).length>0)break;delete r[i-1][t[i-1]]}}function WJe(e){let t={};for(let{path:n,restrictive:r}of I7){let o=ld(e,n);if(n[0]==="sandbox"&&D7(r).includes(o))ah(t,n,o)}return t.sandbox??{}}function qJe(e,t){let n={};if(e.allowManagedHooksOnly===!0)n.allowManagedHooksOnly=!0;if(e.disableCommandPluginSources===!0)n.disableCommandPluginSources=!0;if(e.allowManagedMcpServersOnly===!0)n.allowManagedMcpServersOnly=!0;if(e.disableClaudeAiConnectors===!0)n.disableClaudeAiConnectors=!0;if(e.syncClaudeAiSkills===!1)n.syncClaudeAiSkills=!1;if(e.syncClaudeAiPlugins===!1)n.syncClaudeAiPlugins=!1;if(e.allowManagedPermissionRulesOnly===!0)n.allowManagedPermissionRulesOnly=!0;if(a7(e.attribution,e.includeCoAuthoredBy)==="disabled")n.attribution={...n.attribution,commitTrailers:!1};if(e.attribution?.sessionUrl===!1)n.attribution={...n.attribution,sessionUrl:!1};let r=e.strictPluginOnlyCustomization;if(r===!0||Array.isArray(r)&&r.length>0)n.strictPluginOnlyCustomization=r;if(e.deniedMcpServers)n.deniedMcpServers=e.deniedMcpServers;if(t.forceLoginOrgUUID===void 0&&e.forceLoginOrgUUID)n.forceLoginOrgUUID=e.forceLoginOrgUUID;if(t.allowedMcpServers===void 0&&e.allowedMcpServers)n.allowedMcpServers=e.allowedMcpServers;if(t.availableModels===void 0&&e.availableModels)n.availableModels=e.availableModels;if(e.enforceAvailableModels===!0)n.enforceAvailableModels=!0;if(e.permissions){let o=TS(e.permissions,["deny","ask"]);if(e.permissions.disableBypassPermissionsMode==="disable")o.disableBypassPermissionsMode="disable";if(t.allowManagedPermissionRulesOnly!==!0){let{allow:s,additionalDirectories:i}=e.permissions;if(s&&t.sandbox?.network?.allowManagedDomainsOnly!==!0)o.allow=s;if(i)o.additionalDirectories=i}if(Object.keys(o).length>0)n.permissions=o}if(e.sandbox){let{network:o,filesystem:s,credentials:i}=e.sandbox,a={},c=o?TS(o,["deniedDomains"]):{},l=s?TS(s,["denyRead","denyWrite"]):{};if(o){if(t.sandbox?.network?.allowManagedDomainsOnly!==!0&&o.allowedDomains)c.allowedDomains=o.allowedDomains}if(Object.keys(c).length>0)a.network=c;if(s){if(t.sandbox?.filesystem?.allowManagedReadPathsOnly!==!0&&s.allowRead)l.allowRead=s.allowRead}if(Object.keys(l).length>0)a.filesystem=l;if(i){let u=(i.files??[]).map((m)=>m.mode==="deny"?{path:m.path,mode:"deny"}:{path:m.path,mode:"mask",injectHosts:[]}),p=(i.envVars??[]).filter((m)=>m.mode==="deny").map((m)=>({name:m.name,mode:"deny"})),f={...u.length>0&&{files:u},...p.length>0&&{envVars:p}};if(i.sigv4){let m={};for(let h of["streaming","presigned","sigv4a"])if(i.sigv4[h]==="deny")m[h]="deny";f.sigv4=m}{let m=nd,h=Ss((i.awsPairs??[]).flatMap((g)=>[g.accessKeyIdVar,g.secretAccessKeyVar,...g.sessionTokenVar!==void 0?[g.sessionTokenVar]:[]]).filter((g)=>m.includes(g)));if(h.length>0)f.awsPairs=h.map((g,y)=>({accessKeyIdVar:g,secretAccessKeyVar:`${K8}${y+1}_`}))}if(Object.keys(f).length>0)a.credentials=f}if(zn(a,WJe(e)),Object.keys(a).length>0)n.sandbox=a}return n}var VJe=new Set([...[...uI].filter((e)=>e!=="ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION"),...dI,"CLAUDE_CODE_AUTO_MODE_MODEL","CLAUDE_CODE_BG_CLASSIFIER_MODEL","CLAUDE_CONTEXT_COLLAPSE_MODEL"]);function ZJe(e,t){if(!t||!e)return null;let n={};if(e.model!==void 0)n.model=e.model;if(e.availableModels!==void 0)n.availableModels=e.availableModels;if(e.enforceAvailableModels!==void 0)n.enforceAvailableModels=e.enforceAvailableModels;if(e.fallbackModel!==void 0)n.fallbackModel=e.fallbackModel;if(e.modelPicker!==void 0)n.modelPicker=e.modelPicker;return Object.keys(n).length>0?n:null}function GS(e){if(delete e.model,delete e.fallbackModel,delete e.modelPicker,delete e.modelOverrides,e.env){let t={};for(let[n,r]of Object.entries(e.env))if(!VJe.has(n.toUpperCase()))t[n]=r;e.env=t}}function YJe(){return jr()==="macos"?"plist":"hklm"}function L7(e){let t=YI(e);if(t.composes==="tier")return"helper";let n=WI(e);if(t.composes==="remoteSlot"||n.present.remote)return"remote";if(n.present.mdm)return YJe();if(n.present.file)return"file";if(n.parentSlice||n.hostModelOverlay)return"parent";let r=e.hkcu?.();return r&&Object.keys(r.settings).length>0?"hkcu":null}function WI(e){let t=[],{settings:n,errors:r}=T7(e);t.push(...r);let o=YI(e),s=o.composes==="remoteSlot"?o.helper:GI(n),{settings:i,errors:a}=ZI(e);t.push(...a);let c=GI(i),{settings:l,errors:u}=e.file?.()??VI(e);t.push(...u);let p=GI(l),{settings:f,errors:m}=OJe(e);t.push(...m);let h=[s,c,p].filter((V)=>V!==null),y=(o.composes==="remoteSlot"?o.helper:[n,i,l].find((V)=>V!==null&&(V.managedSourcesBehavior!==void 0||mc(V))))?.managedSourcesBehavior,{admin:S,merged:b}=JJe(h,y),x={remote:s!==null,mdm:c!==null,file:p!==null},v=(V)=>V!==null&&(V===h[0]||Object.keys(iI(V,F7)).length>0),A={remote:v(s),mdm:v(c),file:v(p)},U={allowManagedPermissionRulesOnly:h.some((V)=>V.allowManagedPermissionRulesOnly===!0)||void 0,forceLoginOrgUUID:S?.forceLoginOrgUUID,allowedMcpServers:S?.allowedMcpServers,availableModels:S?.availableModels,sandbox:{network:{allowManagedDomainsOnly:h.some((V)=>V.sandbox?.network?.allowManagedDomainsOnly===!0)||void 0},filesystem:{allowManagedReadPathsOnly:h.some((V)=>V.sandbox?.filesystem?.allowManagedReadPathsOnly===!0)||void 0}}},D=f&&KJe(S)?qJe(f,U):null,F=D&&Object.keys(D).length>0?D:null,K=ZJe(f,e.hostManagedProvider);return{tiers:h,admin:S,parentSlice:F,hostModelOverlay:K,errors:t,present:x,merged:b,composed:A}}function JJe(e,t){let n=e[0];if(!n)return{admin:null,merged:!1};let{managedSourcesBehavior:r,...o}=n;if(t!=="merge"||e.length<2)return{admin:r===void 0?n:o,merged:!1};let s=e.slice(1).map((a)=>{let c=iI(a,F7);for(let u of GJe)if(ld(c,u)!==void 0)ah(c,u,void 0);let l=ld(c.sandbox,["enabledPlatforms"]);if(Array.isArray(l)&&l.includes(jr()))ah(c,["sandbox","enabledPlatforms"],void 0);else if(l!==void 0)delete c.sandbox;return c}),i={};for(let a of[...s].reverse())zn(i,a,v7);return zn(i,o,v7),e8e(i,[n,...s]),XJe(i,[n,...s]),{admin:i,merged:!0}}var M7=["managedSourcesBehavior","wslInheritsWindowsSettings"];function mc(e){return Object.keys(e).some((t)=>!M7.includes(t))}function GI(e){return e&&mc(e)?e:null}function XJe(e,t){let n=t.findIndex((o)=>o.availableModels!==void 0),r=t.findIndex((o)=>o.modelOverrides!==void 0);if(r!==-1&&(n===-1||r<=n))e.modelOverrides={...t[r].modelOverrides};else delete e.modelOverrides}var QJe=["allowedMcpServers","availableModels","strictKnownMarketplaces","allowedChannelPlugins"];function v7(e,t,n){if(n!==void 0&&QJe.includes(n)){if(t===void 0)return e;return Array.isArray(t)?[...t]:t}if(Array.isArray(e)&&Array.isArray(t)&&n!=="fallbackModel")return Ss([...t,...e]);return Jr(e,t,n)}function e8e(e,t){let n=t[0],r=e;for(let{path:o,restrictive:s}of I7){let i=D7(s),a=Math.min(...t.map((c)=>i.indexOf(ld(c,o))).filter((c)=>c!==-1));if(Number.isFinite(a))ah(r,o,i[a]);else if(ld(n,o)===void 0&&ld(e,o)!==void 0)ah(r,o,void 0)}if(e.strictPluginOnlyCustomization!==!0){let o=Ss(t.flatMap((s)=>Array.isArray(s.strictPluginOnlyCustomization)?s.strictPluginOnlyCustomization:[]));if(o.length>0)e.strictPluginOnlyCustomization=o;else if(n?.strictPluginOnlyCustomization===void 0)delete e.strictPluginOnlyCustomization}}function YI(e){let t=e.helper?.()??null;if(!t)return{composes:"none"};let n=e.helperArmedFromRemote?.()===!1?"tier":"remoteSlot";if(e.helperMergesOutput?.()!==!0)return{composes:n,helper:t,mergedOver:null};if(!e.store.policy.mergedHelper){let r,o;if(n==="remoteSlot")r=T7(e).settings,o="remote";else if(r=ZI(e).settings)o=jr()==="macos"?"plist":"hklm";else r=(e.file?.()??VI(e)).settings,o="file";e.store.policy.mergedHelper={helper:n8e(r,t),mergedOver:Object.keys(N7(r)).length>0?o:null}}return{composes:n,...e.store.policy.mergedHelper}}function N7(e){let{policyHelper:t,policyHelpers:n,...r}=e??{};return r}function t8e(e,t){let n=new Map;for(let[o,s]of Object.entries(t)){let i=o.toUpperCase();if(!n.has(i))n.set(i,s)}let r={};for(let[o,s]of Object.entries(e))r[o]=n.get(o.toUpperCase())??s;return Object.assign(r,t)}function n8e(e,t){let n=N7(e),r=zn({},n,t,(o,s,i)=>Array.isArray(s)?[...s]:Jr(o,s,i));if(n.env&&t.env)r.env=t8e(n.env,t.env);return r}var U7=["apiKeyHelper","awsAuthRefresh","awsCredentialExport","gcpAuthRefresh"];var F7=[...U7,"otelHeadersHelper","proxyAuthHelper","forceLoginOrgUUID","forceLoginMethod","forceLoginGatewayUrl","parentSettingsBehavior","env","modelPicker",...M7];function r8e(e){return L8.some((t)=>e.startsWith(t))||D8.includes(e)}function o8e(e,t,n){let r=new Map,o=new Map,s=!1;for(let[i,a]of e.entries()){let c=new Set,l=t?.[i]===!0;for(let[u,p]of Object.entries(a??{})){let f=u.toUpperCase(),m=r8e(f);if(m&&p.trim()==="")continue;if(m&&s)continue;if(m&&i>0&&t?.[i]===!0)continue;let h=r.get(f);if(h!==void 0){if(c.has(f))o.set(u,p);else if(!o.has(u))o.set(u,h);continue}if(i>0&&n?.[i]?.has(f))continue;if(o.set(u,p),c.add(f),r.set(f,p),m)l=!0}if(l)s=!0}return Object.fromEntries(o)}var s8e="CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION";function w7(e){if(!e)return;let t={};for(let[n,r]of Object.entries(e))if(n.toUpperCase()!==s8e)t[n]=r;return t}function i8e(e,t){let n=Object.entries(e??{}),r=t??{};return n.length===Object.keys(r).length&&n.every(([o,s])=>r[o]===s)}function a8e(e){let t=ZI(e);return t.settings?t.errors:[...t.errors,...(e.file?.()??VI(e)).errors]}function j7(e){let t=YI(e),n=e.helperWarnings?.()??[];if(t.composes==="tier"){let{helper:h}=t;e.store.lastPolicyEnvComposition=null;let g=e.hostManagedProvider?{...h}:h;if(e.hostManagedProvider)GS(g);e.store.policy.pairedModelOverrides={value:e.hostManagedProvider&&h.availableModels!==void 0?h.modelOverrides:void 0};let y=e.store.policy.helperBaseStatusNotices??=[...e.helperMergesOutput?.()===!0?a8e(e).filter((S)=>!S.statusOnly):[],...WI(e).errors.filter((S)=>S.statusOnly)];return{settings:g,errors:[...y,...n]}}let{tiers:r,admin:o,parentSlice:s,hostModelOverlay:i,errors:a,present:c}=WI(e);if(a.push(...n),!o&&!s){e.store.lastPolicyEnvComposition=null,e.store.policy.pairedModelOverrides={value:void 0};let h=e.hkcu?.();if(h&&Object.keys(h.settings).length>0){let g=e.hostManagedProvider?{...h.settings}:h.settings;if(e.hostManagedProvider){if(GS(g),i)Object.assign(g,i)}return{settings:g,errors:[...a,...h.errors]}}if(i)return{settings:{...i},errors:[...a,...h?.errors??[]]};return{settings:null,errors:[...a,...h?.errors??[]]}}let l=zn({},s??{},o??{},Jr);if(r.some((h)=>h.forceRemoteSettingsRefresh===!0))l.forceRemoteSettingsRefresh=!0;let u=Mn.CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION===!0,p=l.env;if(!u){let h=o8e(r.map((g)=>g.env),r.map((g)=>(g.otelHeadersHelper??"").trim()!==""),r.map((g)=>{let y=new Set;for(let S of U7){let b=g[S];if(typeof b==="string"&&b.trim()!=="")for(let x of M8[S])y.add(x)}return y.size>0?y:void 0}));if(Object.keys(h).length>0)l.env=h;else delete l.env}if(l.env){let h=w7(l.env);if(h&&Object.keys(h).length>0)l.env=h;else delete l.env}if(e.hostManagedProvider){if(GS(l),i)Object.assign(l,i)}let f={env:w7(p)};if(e.hostManagedProvider)GS(f);let m=!u&&!i8e(l.env,f.env);return e.store.lastPolicyEnvComposition={unionOptedOut:u,unionChangedEnv:m,remoteTierPresent:c.remote,mdmTierPresent:c.mdm,fileTierPresent:c.file,adminTierCount:r.length,tiersWithEnv:ef(r,(h)=>Object.keys(h.env??{}).length>0)},e.store.policy.pairedModelOverrides={value:e.hostManagedProvider&&o?.availableModels!==void 0&&o.modelOverrides!==void 0&&i?.availableModels===void 0?o.modelOverrides:void 0},{settings:l,errors:a}}function c8e(e,t,{includeLegacyLocalSettings:n=!0}={}){if(e==="policySettings")return j7(t).settings;let r=ch(e,t),{settings:o}=r?ud(r,t.store,e==="flagSettings"?t.flagExpectedContent:void 0):{settings:null};if(e==="flagSettings"){let{settings:s}=C7(t);if(s)return zn(o||{},s,Jr)}if(e==="localSettings"&&n){let s=O7(t);if(s){let{settings:i}=ud(s,t.store);if(i)return t.onLegacyLocalSettingsRead?.("per_source"),zn(i,o||{},Jr)}}return o}function l8e(e,t){return{...e,...t}}function Jr(e,t,n){if(n==="modelPicker"&&t!==void 0)return $7(t);if(Array.isArray(e)&&Array.isArray(t)){if(n==="fallbackModel")return t;return Ss([...e,...t])}if(n==="extraKnownMarketplaces"&&pn(e)&&pn(t))return l8e(e,t);return}function $7(e){if(!pn(e))return e;let t=e.options;return{...e,...Array.isArray(t)&&{options:t.map((n)=>pn(n)?{...n}:n)}}}function u8e(e){if(e.store.isLoadingFromDisk)return{settings:{},errors:[]};let t=Date.now();Gm("info","settings_load_started"),e.store.isLoadingFromDisk=!0;try{let n=e.store.pluginBase,r={};if(n)r=zn(r,n,Jr);let o=[],s=new Set,i=new Set,a=(l)=>{for(let u of l){let p=`${u.file}:${u.path}:${u.message}`;if(!s.has(p))s.add(p),o.push(u)}},c=null;for(let l of qI(e)){if(l==="policySettings"){let{settings:p,errors:f}=j7(e);if(c=p,p)r=zn(r,p,Jr);a(f);continue}if(l==="localSettings"){let p=O7(e);if(p&&!i.has(Xr(p))){i.add(Xr(p));let{settings:f,errors:m}=ud(p,e.store);if(a(m),f)e.onLegacyLocalSettingsRead?.("cascade"),r=zn(r,f,Jr)}}let u=ch(l,e);if(u){let p=Xr(u),f=l==="flagSettings"&&e.flagExpectedContent!==void 0;if(!i.has(p)||f){i.add(p);let{settings:m,errors:h}=ud(u,e.store,l==="flagSettings"?e.flagExpectedContent:void 0);if(a(h),m)r=zn(r,m,Jr)}}if(l==="flagSettings"){let{settings:p,errors:f}=C7(e);if(a(f),p)r=zn(r,p,Jr)}}if(c){if(c.availableModels!==void 0)r.availableModels=[...c.availableModels];if(c.enforceAvailableModels!==void 0)r.enforceAvailableModels=c.enforceAvailableModels;if(c.modelPicker!==void 0)r.modelPicker=$7(c.modelPicker)}return Gm("info","settings_load_completed",{duration_ms:Date.now()-t,source_count:i.size,error_count:o.length}),{settings:r,errors:o}}finally{e.store.isLoadingFromDisk=!1}}function d8e(e){let t=e.store.mergedSettings;if(t!==null)return t;let n=u8e(e);return e.store.mergedSettings=n,n}function p8e(e){let{settings:t}=d8e(e);return t||{}}function z7(e){e.store.invalidateAll();let t=[];for(let n of qI(e)){let r=P7(n,e);if(r&&Object.keys(r).length>0)t.push({source:n,settings:r})}return{effective:p8e(e),sources:t}}function H7(e,t){let n=qI(t);for(let r=n.length-1;r>=0;r--){let o=n[r];if(P7(o,t)?.[e]!==void 0)return o}return null}import{execFile as f8e}from"child_process";import{existsSync as m8e}from"fs";class B7{promise=null;start(){if(this.promise)return;this.promise=JI()}reset(){this.promise=null}}var h8e=new B7;function lh(e,t){return new Promise((n)=>{try{f8e(e,t,{encoding:"utf-8",timeout:d7,windowsHide:!0},(r,o)=>{n({stdout:o??"",code:r?1:0})})}catch{n({stdout:"",code:1})}})}function JI(){return(async()=>{if(process.platform==="darwin"){let e=p7(),n=(await Promise.all(e.map(async({path:r,label:o})=>{if(!m8e(r))return{stdout:"",label:o,ok:!1};let{stdout:s,code:i}=await lh(l7,[...u7,r]);return{stdout:s,label:o,ok:i===0&&!!s}}))).find((r)=>r.ok);return{plistStdouts:n?[{stdout:n.stdout,label:n.label}]:[],hklmStdout:null,hkcuStdout:null}}if(process.platform==="win32"){let t=`${process.env.SYSTEMROOT||"C:\\Windows"}\\System32\\reg.exe`,[n,r]=await Promise.all([lh(t,["query",rh,"/v",Bi]),lh(t,["query",oh,"/v",Bi])]);return{plistStdouts:null,hklmStdout:n.code===0?n.stdout:null,hkcuStdout:r.code===0?r.stdout:null}}if(KS()){let[e,t]=await Promise.all([lh(BI,["query",rh,"/v",Bi]),lh(BI,["query",oh,"/v",Bi])]);return{plistStdouts:null,hklmStdout:e.code===0?e.stdout:null,hkcuStdout:t.code===0?t.stdout:null}}return{plistStdouts:null,hklmStdout:null,hkcuStdout:null}})()}function K7(){return h8e.promise}var Ki=Object.freeze({settings:{},errors:[]});class V7{mdm=null;hkcu=null;wslInherits=!1;loadPromise=null;startLoad(e){if(this.loadPromise)return;this.loadPromise=(async()=>{let t=Date.now(),n=K7()??JI(),{mdm:r,hkcu:o,wslInherits:s}=await y8e(await n,e);this.replace(r,o,s);let i=Date.now()-t;if(de(`MDM settings load completed in ${i}ms`),Object.keys(r.settings).length>0){de(`MDM settings found: ${Object.keys(r.settings).join(", ")}`);try{Gm("info","mdm_settings_loaded",{duration_ms:i,key_count:Object.keys(r.settings).length,error_count:r.errors.length})}catch{}}})()}replace(e,t,n){this.mdm=e,this.hkcu=t,this.wslInherits=n}reset(){this.mdm=null,this.hkcu=null,this.wslInherits=!1,this.loadPromise=null}}var g8e=new tt(()=>new V7);function uh(){return g8e.of(Tt().host)}function _8e(e){uh().startLoad(e)}async function Z7(){let e=uh();if(!e.loadPromise)_8e();await e.loadPromise}function Y7(){return uh().mdm??Ki}function J7(){return uh().hkcu??Ki}function X7(){return uh().wslInherits}function XI(e,t){let n=ic(e,!1);if(!n||typeof n!=="object")return{settings:{},errors:[]};let{settings:r,errors:o}=WS(n,t);return{settings:r??{},errors:o}}function G7(e,t="Settings"){let n=e.split(/\r?\n/),r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`^\\s+${r}\\s+REG_(?:EXPAND_)?SZ\\s+(.*)$`,"i");for(let s of n){let i=s.match(o);if(i&&i[1])return i[1].trimEnd()}return null}async function y8e(e,t){let n=[];if(e.plistStdouts&&e.plistStdouts.length>0){let{stdout:a,label:c}=e.plistStdouts[0],l=XI(a,c);if(mc(l.settings))return{mdm:l,hkcu:Ki,wslInherits:!1};n.push(...l.errors)}let r=null;if(e.hklmStdout){let a=G7(e.hklmStdout);if(a)r=XI(a,`Registry: ${rh}\\${Bi}`)}if(r)n.push(...r.errors);let o=n.length>0?{settings:{},errors:n}:Ki,s=KS(),i=!1;if(s){if(i=r?.settings.wslInheritsWindowsSettings===!0||await S8e(t),!i)return{mdm:o,hkcu:Ki,wslInherits:!1}}if(r){if(mc(r.settings))return{mdm:r,hkcu:Ki,wslInherits:i}}if(await b8e(i,t))return{mdm:o,hkcu:Ki,wslInherits:i};if(e.hkcuStdout){let a=G7(e.hkcuStdout);if(a){let c=XI(a,`Registry: ${oh}\\${Bi}`);if(!s||c.settings.wslInheritsWindowsSettings===!0){let{wslInheritsWindowsSettings:l,managedSourcesBehavior:u,...p}=c.settings;return{mdm:o,hkcu:{settings:p,errors:c.errors},wslInherits:i}}if(c.errors.length>0)return{mdm:o,hkcu:{settings:{},errors:c.errors},wslInherits:i}}}return{mdm:o,hkcu:Ki,wslInherits:i}}async function Q7(e,t){if(Te()&&t!==void 0)return(await uJ(e)).content;return sc(e)}async function eQ(e,t){if(Te()&&t!==void 0)return await Qe().readdir(e);return Qe().readdirSync(e)}async function b8e(e,t){if(e&&await q7(cd,t))return!0;return q7(ac(),t)}async function W7(e,t){let n=fo(ic(await Q7(e,t),!1));if(!n||typeof n!=="object")return!1;return fc(n,e),mc(n)}async function S8e(e){async function t(n){try{let r=ic(await Q7(n,e),!1);return!!r&&typeof r==="object"&&"wslInheritsWindowsSettings"in r&&r.wslInheritsWindowsSettings===!0}catch{return!1}}if(await t(dd(cd,"managed-settings.json")))return!0;try{let n=dd(cd,"managed-settings.d");for(let r of await eQ(n,e))if((r.isFile()||r.isSymbolicLink())&&r.name.endsWith(".json")&&!r.name.startsWith(".")&&await t(dd(n,r.name)))return!0}catch{}return!1}async function q7(e,t){try{if(await W7(dd(e,"managed-settings.json"),t))return!0}catch{}try{let n=dd(e,"managed-settings.d"),r=await eQ(n,t);for(let o of r){if(!(o.isFile()||o.isSymbolicLink())||!o.name.endsWith(".json")||o.name.startsWith("."))continue;try{if(await W7(dd(n,o.name),t))return!0}catch{}}}catch{}return!1}var x8e={user:"userSettings",project:"projectSettings",local:"localSettings"},tQ={userSettings:"user",projectSettings:"project",localSettings:"local",flagSettings:"flag",policySettings:"managed"},v8e=["user","project","local"],w8e=new Set(["bypassPermissions","auto","acceptEdits"]),A8e=new Set(["project"]);function T8e(e){let t=e.effective.permissions?.defaultMode;if(!t||!w8e.has(t))return e.effective;for(let n=e.sources.length-1;n>=0;n--){let r=e.sources[n];if(r.settings.permissions?.defaultMode!==void 0){if(A8e.has(r.source)){let{defaultMode:o,...s}=e.effective.permissions??{};return{...e.effective,permissions:s}}return e.effective}}return e.effective}async function nQ(e={}){await Z7();let t={store:new Wg,cwd:E8e(e.cwd??Qe().cwd()),allowedSources:(e.settingSources??v8e).map((a)=>x8e[a]),parentManaged:e.managedSettings??null,flagInline:null,flagPath:void 0,mdm:Y7,hkcu:J7,wslInherits:X7,...e.serverManagedSettings!==void 0&&{remote:()=>e.serverManagedSettings}},{effective:n,sources:r}=z7(t),o=L7(t)??void 0,s=r.map(({source:a,settings:c})=>({source:tQ[a],settings:c,path:a==="policySettings"?void 0:ch(a,t),...a==="policySettings"&&{policyOrigin:o}})),i={};for(let a of Object.keys(n)){let c=H7(a,t);if(c)i[a]={source:tQ[c],path:c==="policySettings"?void 0:ch(c,t),...c==="policySettings"&&{policyOrigin:o}}}return{effective:n,provenance:i,sources:s}}process.env.NoDefaultCurrentDirectoryInExePath="1";async function OGt(e){return nQ(e)}var N8e=["enabledPlugins","extraKnownMarketplaces","additionalMarketplaces"];function rQ(e){let t;try{t=yt(_u(e.toString("utf8")))}catch{return e}if(!oQ(t))return e;let n=!1;for(let o of N8e)if(Object.hasOwn(t,o))delete t[o],n=!0;let r=t.env;if(oQ(r)&&Object.hasOwn(r,"CLAUDE_CONFIG_DIR"))delete r.CLAUDE_CONFIG_DIR,n=!0;return n?me(t):e}function oQ(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}async function U8e(e,t){if(!e)return;let n=e;try{let r=yt(e);if(r?.claudeAiOauth?.refreshToken)delete r.claudeAiOauth.refreshToken,n=me(r)}catch{}await cQ(t,n,{mode:384})}function F8e(){if(process.platform!=="darwin")return Promise.resolve(void 0);let e=s6(o6);return new Promise((t)=>{C8e("security",["find-generic-password","-a",i6(),"-w","-s",e],{encoding:"utf-8",timeout:5000,windowsHide:!0},(n,r)=>t(n?void 0:r.trim()||void 0))})}async function dQ(e,t,n,r,o=60000,s){if(!rt(t))return;let i=Qr(n,r),a=await Or(e.load({projectKey:i,sessionId:t}),o,`SessionStore.load() timed out after ${o}ms for session ${t}`);if(!a||a.length===0)return;let c=xn(D8e(),`claude-resume-${rD()}`);try{let l=xn(c,"projects",i);await QI(l,{recursive:!0,mode:448});let u=xn(l,`${t}.jsonl`);await Kf(u,a);let p=r?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR,f=p??xn(eD(),".claude"),m;try{m=await aQ(xn(f,".credentials.json"),"utf-8")}catch(S){if(!br(S))throw S}if(!p&&!(r??process.env).ANTHROPIC_API_KEY&&!(r??process.env).CLAUDE_CODE_OAUTH_TOKEN)m=await F8e()??m;await U8e(m,xn(c,".credentials.json"));let h=r6(Mn.CLAUDE_CONFIG_DIR),g=xn(p??eD(),".claude.json");await tb(g,xn(c,".claude.json"),void 0,SO(s,g,h.globalConfig,en.globalConfig()));let y=xn(f,"settings.json");if(await tb(y,xn(c,"settings.json"),rQ,SO(s,y,h.userSettings,en.userSettings())),await tb(xn(f,"cowork_settings.json"),xn(c,"cowork_settings.json"),rQ),e.listSubkeys)await j8e(e,{projectKey:i,sessionId:t},xn(l,t),o);return c}catch(l){throw await qS(c),l}}async function j8e(e,t,n,r){let o=await Or(e.listSubkeys({projectKey:t.projectKey,sessionId:t.sessionId}),r,`SessionStore.listSubkeys() timed out after ${r}ms for session ${t.sessionId}`);for(let s of o){let i=dh(n,s+".jsonl");if(!s||lQ(s)||s.split(/[\\/]/).includes("..")||!i.startsWith(n+oD)){de(`[SessionStore] skipping unsafe subpath from listSubkeys: ${s}`,{level:"warn"});continue}let a=await Or(e.load({projectKey:t.projectKey,sessionId:t.sessionId,subpath:s}),r,`SessionStore.load() timed out after ${r}ms for session ${t.sessionId} subpath ${s}`);if(!a||a.length===0)continue;let c=[],l=[];for(let u of a)if(nD(u))c.push(u);else l.push(u);if(l.length>0)await QI(tD(i),{recursive:!0}),await Kf(i,l);if(c.length>0){let u=c.at(-1),p=dh(n,s+".meta.json");await QI(tD(p),{recursive:!0});let{type:f,...m}=u;await cQ(p,me(m),{mode:384})}}}function sD(e,t){let{isSingleUserTurn:n,resumeConfigDir:r,deferSpawn:o}=t,{systemPrompt:s,settings:i,managedSettings:a,settingSources:c,sandbox:l,...u}=e??{},p,f,m;if(s===void 0)p="";else if(typeof s==="string")p=s;else if(Array.isArray(s))p=s;else if(s.type==="preset")f=s.append,m=s.excludeDynamicSections;process.env.CLAUDE_AGENT_SDK_VERSION="0.3.246";let{abortController:h=md(),additionalDirectories:g=[],agent:y,agents:S,allowedTools:b=[],betas:x,canUseTool:v,continue:A,cwd:U,debug:D,debugFile:F,disallowedTools:K=[],tools:V,env:ne,executable:oe=Sc()?"bun":"node",executableArgs:_e=[],extraArgs:ke={},fallbackModel:vt,enableFileCheckpointing:Z,toolConfig:Je,forkSession:wt,hooks:ht,includeHookEvents:cr,includePartialMessages:Ot,forwardSubagentText:se,onElicitation:Q,onUserDialog:te,supportedDialogKinds:je,perTaskStopAffordance:Re,persistSession:Pt,sessionStore:Ut,sessionStoreFlush:gt,thinking:On,effort:Gi,maxThinkingTokens:It,maxTurns:ph,maxBudgetUsd:yQ,taskBudget:bQ,mcpServers:aD,model:SQ,outputFormat:cD,permissionMode:EQ,allowDangerouslySkipPermissions:xQ=!1,permissionPromptToolName:vQ,plugins:wQ,getOAuthToken:lD,getHostAuthToken:uD,workload:dD,resume:pD,resumeSessionAt:AQ,resumeDropsTurn:TQ,sessionId:CQ,skills:fD,stderr:kQ,strictMcpConfig:RQ}=u,mD=EQ??(e?.resolvePermissionModeInCli?void 0:"default");if(Ut&&Pt===!1)throw Error("sessionStore cannot be used with persistSession: false -- the storage adapter requires local writes to mirror from. Use CLAUDE_CONFIG_DIR=/tmp for ephemeral local writes with external mirroring.");if(je!==void 0&&je.length>0&&!te)throw Error("supportedDialogKinds requires an onUserDialog callback -- declaring dialog kinds without a handler would park dialogs nothing can answer. Provide onUserDialog, or omit supportedDialogKinds.");if(Ut&&A&&!pD&&!Ut.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");if(Ut&&Z)throw Error("enableFileCheckpointing is not yet supported with sessionStore (backup blobs are not mirrored, so rewindFiles() fails after a store-backed resume).");if(Ut&&u.spawnClaudeCodeProcess)de("sessionStore with custom spawnClaudeCodeProcess: ensure the subprocess CLAUDE_CONFIG_DIR matches the parent (same path, same separators) or transcript_mirror frames will be dropped.",{level:"warn"});c6(!!v,mD??"default",b);let ZS=u.pathToClaudeCodeExecutable;if(!ZS){let lr=M8e(import.meta.url),eo=I8e(lr),Wi=h2((hc)=>eo.resolve(hc));if(!Wi)throw Error(`Native CLI binary for ${process.platform}-${process.arch} not found. Reinstall @anthropic-ai/claude-agent-sdk without --omit=optional, or set options.pathToClaudeCodeExecutable.`);ZS=Wi}let hD=cD?.type==="json_schema"?cD.schema:void 0,Pn=ne?{...ne}:{...process.env};if(!Pn.CLAUDE_CODE_ENTRYPOINT)Pn.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(!Pn.CLAUDE_AGENT_SDK_VERSION)Pn.CLAUDE_AGENT_SDK_VERSION="0.3.246";if(Z)Pn.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true";if(lD)Pn.CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH="1";if(uD)Pn.CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH="1";if(Je?.askUserQuestion?.previewFormat)Pn.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT=Je.askUserQuestion.previewFormat;let YS={};if(VS.propagation.inject(VS.context.active(),YS),"traceparent"in YS){for(let lr of["TRACEPARENT","TRACESTATE"])if(!(lr in(ne??{})))delete Pn[lr]}for(let[lr,eo]of Object.entries(YS)){let Wi=lr.toUpperCase();if(!(Wi in(ne??{})))Pn[Wi]=eo}let gD={},_D=new Map;if(aD)for(let[lr,eo]of Object.entries(aD))if(eo.type==="sdk"&&eo.instance)_D.set(lr,eo.instance);else gD[lr]=eo;let pd;if(On)switch(On.type){case"adaptive":pd={type:"adaptive",display:On.display};break;case"enabled":pd={type:"enabled",budgetTokens:On.budgetTokens,display:On.display};break;case"disabled":pd={type:"disabled"};break}else if(It!==void 0)pd=It===0?{type:"disabled"}:{type:"enabled",budgetTokens:It};if(r){if(Pn.CLAUDE_CONFIG_DIR=r,process.platform==="win32")Pn.CLAUDE_SECURESTORAGE_CONFIG_DIR=ne?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??ne?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??""}let yD=new qT({abortController:h,additionalDirectories:g,agent:y,betas:x,cwd:U,debug:D,debugFile:F,executable:oe,executableArgs:_e,extraArgs:dD?{...ke,workload:dD}:ke,pathToClaudeCodeExecutable:ZS,env:Pn,forkSession:wt,stderr:kQ,thinkingConfig:pd,effort:Gi,maxTurns:ph,maxBudgetUsd:yQ,taskBudget:bQ,model:SQ,fallbackModel:vt,jsonSchema:hD,permissionMode:mD,allowDangerouslySkipPermissions:xQ,permissionPromptToolName:vQ,continueConversation:Ut?void 0:A,resume:pD,resumeSessionAt:AQ,resumeDropsTurn:TQ,sessionId:CQ,settings:typeof i==="object"?me(i):i,managedSettings:a?me(a):void 0,settingSources:c,skills:fD,allowedTools:b,disallowedTools:K,tools:V,mcpServers:gD,strictMcpConfig:RQ,canUseTool:!!v,hooks:!!ht,includeHookEvents:cr,includePartialMessages:Ot,persistSession:Pt,sessionMirror:!!Ut,plugins:wQ,sandbox:l,spawnClaudeCodeProcess:u.spawnClaudeCodeProcess,deferSpawn:o}),OQ={systemPrompt:p,appendSystemPrompt:f,planModeInstructions:u.planModeInstructions,appendSubagentSystemPrompt:u.appendSubagentSystemPrompt,toolAliases:u.toolAliases,excludeDynamicSections:m,agents:S,title:u.title,skills:fD,webSearchIsolationExemptMcpServers:u.webSearchIsolationExemptMcpServers,promptSuggestions:u.promptSuggestions,agentProgressSummaries:u.agentProgressSummaries,forwardSubagentText:se,supportedDialogKinds:je,perTaskStopAffordance:Re},JS=new ay(yD,n,v,ht,h,_D,hD,OQ,Q,lD,uD,te);if(Ut){let lr=()=>xn(Pn.CLAUDE_CONFIG_DIR??xn(eD(),".claude"),"projects"),eo=gt==="eager",Wi=new JT(async(hc,XS)=>{let fd=iQ(hc,lr());if(fd)await Ut.append(fd,XS);else de(`[SessionStore] dropping mirror frame: filePath ${hc} is not under ${lr()} -- subprocess CLAUDE_CONFIG_DIR likely differs from parent (custom spawnClaudeCodeProcess / container?)`,{level:"warn"})},{onError:(hc,XS)=>{let fd=iQ(hc,lr());if(fd)JS.reportMirrorError(fd,XS.message)},maxPendingEntries:eo?0:cy,maxPendingBytes:eo?0:du});JS.setTranscriptMirrorBatcher(Wi)}return{queryInstance:JS,transport:yD,abortController:h,processEnv:Pn}}function iD(e,t,n,r){if(typeof n==="string")t.write(me({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:n}]},parent_tool_use_id:null})+`
162
- `);else e.streamInput(n).catch((o)=>r.abort(o))}var $8e=new Set(["EBUSY","EMFILE","ENFILE","ENOTEMPTY","EPERM"]);async function qS(e){for(let t=0;;t++)try{return await P8e(e,{recursive:!0,force:!0})}catch(n){if(t>=4||!$8e.has(Ne(n)??""))return;await to((t+1)*100)}}function z8e(e,t){e.waitForExit().catch(()=>{}).finally(()=>qS(t))}function PGt({prompt:e,options:t}){if((t?.resume||t?.continue)&&t?.sessionStore)return H8e(e,t);let{queryInstance:n,transport:r,abortController:o}=sD(t,{isSingleUserTurn:typeof e==="string"});return iD(n,r,e,o),n}function H8e(e,t){let{queryInstance:n,transport:r,abortController:o,processEnv:s}=sD({...t},{isSingleUserTurn:typeof e==="string",deferSpawn:!0}),i=dh(t.cwd??"."),a=t.sessionStore,c=t.loadTimeoutMs??60000,l=t.resume;return(async()=>{if(!l)l=(await Or(a.listSessions(Qr(i,t.env)),c,`SessionStore.listSessions() timed out after ${c}ms`)).slice().sort((f,m)=>m.mtime-f.mtime)[0]?.sessionId;if(!l)return;return dQ(a,l,i,t.env,t.loadTimeoutMs)})().then((p)=>{if(p){r.updateResume(l);let f={CLAUDE_CONFIG_DIR:p};if(process.platform==="win32"){let m=t.env?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??t.env?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??"";f.CLAUDE_SECURESTORAGE_CONFIG_DIR=m,s.CLAUDE_SECURESTORAGE_CONFIG_DIR=m}r.updateEnv(f),s.CLAUDE_CONFIG_DIR=p,n.addCleanupCallback(()=>z8e(r,p))}if(!n.isClosed())r.spawn()}).catch((p)=>{let f=Ur(p);r.spawnAbort(f),n.setError(f)}),iD(n,r,e,o),n}async function IGt({options:e,initializeTimeoutMs:t=60000}={}){let n,r=e?.resume;if((r||e?.continue)&&e?.sessionStore){let a=dh(e.cwd??".");if(!r){if(!e.sessionStore.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");let c=e.loadTimeoutMs??60000;r=(await Or(e.sessionStore.listSessions(Qr(a,e.env)),c,`SessionStore.listSessions() timed out after ${c}ms`)).slice().sort((u,p)=>p.mtime-u.mtime)[0]?.sessionId}if(r)n=await dQ(e.sessionStore,r,a,e.env,e.loadTimeoutMs)}let o,s,i;try{let m=function(){if(f)return;f=!0,u.close()},a=sD(n&&r&&r!==e?.resume?{...e,resume:r}:e,{isSingleUserTurn:!1,resumeConfigDir:n});o=a.queryInstance;let{transport:c,abortController:l}=a;s=c;let u=a.queryInstance;if(n){let h=n;u.addCleanupCallback(()=>{i=c.waitForExit().catch(()=>{}).then(()=>qS(h))})}let p=`Subprocess initialization did not complete within ${t}ms — check authentication and network connectivity`;await Or(u.initializationResult(),t,p).catch((h)=>{throw RN(h,p)?An(h,{telemetryMessage:`Subprocess initialization did not complete within ${t}ms`,errorClass:"initialize_timeout"}):h});let f=!1;return{query(h){if(f)throw Error("WarmQuery.query() can only be called once");f=!0;try{iD(u,c,h,l)}catch(g){throw u.close(),g}if(typeof h==="string")u.setIsSingleUserTurn(!0);return u},close:m,async[Symbol.asyncDispose](){f=!0,u.close(),await i}}}catch(a){if(o?.close(),n&&!i){let c=s;i=(c?c.waitForExit().catch(()=>{}):Promise.resolve()).then(()=>qS(n))}throw await i,a}}async function DGt(e,t){if(t?.sessionStore)return q8e(t.sessionStore,e,t);return Eq(e,t)}async function LGt(e){if(e?.sessionStore)return K8e(e.sessionStore,e);return C4(e)}async function MGt(e,t){if(t?.sessionStore)return V8e(t.sessionStore,e,t);return k4(e,t)}async function NGt(e,t,n){if(n?.sessionStore)return Z8e(n.sessionStore,e,t,n.dir);return D4(e,t,n)}async function UGt(e,t,n){if(n?.sessionStore)return Y8e(n.sessionStore,e,t,n.dir);return L4(e,t,n)}async function FGt(e,t){if(!rt(e))throw new qe(`Invalid sessionId: ${e}`,"deleteSession: invalid sessionId (must be a UUID)");if(t?.sessionStore){if(!t.sessionStore.delete)return;let n=Qr(t.dir);await t.sessionStore.delete({projectKey:n,sessionId:e});return}return M4(e,t)}async function jGt(e,t){if(t?.sessionStore)return J8e(t.sessionStore,e,t);return j4(e,t)}async function $Gt(e,t,n,r){if(!rt(e))throw new qe(`Invalid sessionId: ${e}`,"importSessionToStore: invalid sessionId (must be a UUID)");let o=Te(),s=o?r:void 0,i=await wi(e,n?.dir,tr(s),o);if(!i)throw Error(`Session ${e} not found`);let a=Qr(n?.dir),c=n?.batchSize&&n.batchSize>0?n.batchSize:cy,l=s===void 0?void 0:Ba(tD(i.filePath),dn),u=s!==void 0&&l!==void 0?{backend:s,projectKey:l}:void 0;if(u!==void 0)await yO(u.backend,en.transcript(u.projectKey,e),{projectKey:a,sessionId:e},t,c);else await sQ(i.filePath,{projectKey:a,sessionId:e},t,c);if(n?.includeSubagents===!1)return;if(u!==void 0){let m=await X4(u.backend,u.projectKey,e),h=await Q4(u.backend,u.projectKey,e,m);for(let g of m){let y={projectKey:a,sessionId:e,subpath:eb(g)};await yO(u.backend,g.kind==="agent"?en.transcript(u.projectKey,e,g.agentId,g.agentRelPath):en.journal(u.projectKey,e,g.agentRelPath),y,t,c);let S=h.get(y.subpath),b;if(S!==void 0)try{b=yt(S)}catch(x){de(`importSessionToStore: skipping unreadable sidecar for ${y.subpath}: ${x}`)}if(b!==void 0)await t.append(y,[{type:"agent_metadata",...b}])}return}let p=i.filePath.replace(/\.jsonl$/,""),f=xn(p,"subagents");for(let m of await B8e(f)){let h=uQ(p,m).split(oD);h[h.length-1]=h.at(-1).replace(/\.jsonl$/,"");let g={projectKey:a,sessionId:e,subpath:h.join("/")};await sQ(m,g,t,c);let y=m.replace(/\.jsonl$/,".meta.json"),S;try{S=yt(await aQ(y,"utf8"))}catch(b){if(!br(b))de(`importSessionToStore: skipping unreadable sidecar ${y}: ${b}`)}if(S!==void 0)await t.append(g,[{type:"agent_metadata",...S}])}}async function sQ(e,t,n,r){let o=L8e({input:k8e(e,{encoding:"utf8"}),crlfDelay:1/0}),s=[],i=0;for await(let a of o){if(!a)continue;try{s.push(yt(a))}catch(c){de(`importSessionToStore: skipping unparseable line in ${e}: ${c}`);continue}if(i+=a.length,s.length>=r||i>=du)await n.append(t,s),s=[],i=0}if(s.length>0)await n.append(t,s)}async function B8e(e){let t=[];async function n(r){let o;try{o=await O8e(r,{withFileTypes:!0})}catch{return}for(let s of o){let i=xn(r,s.name);if(s.isDirectory())await n(i);else if(s.isFile()&&s.name.endsWith(".jsonl"))t.push(i)}}return await n(e),t}async function zGt(e,t){if(t?.sessionStore)return X8e(t.sessionStore,e,t.dir);return V4(e,t)}async function HGt(e,t,n){if(n?.sessionStore)return Q8e(n.sessionStore,e,t,n);return Z4(e,t,n)}function pQ(e){let t=dh(e??"."),n;try{n=R8e(t)}catch{n=t}return ct(n)}function Qr(e,t){let n=pQ(e);if(t===void 0)return ks(n);return(t.CLAUDE_CONFIG_DIR?OE(t.CLAUDE_CODE_PROJECT_DIR_NAME):void 0)??Wf(n)}function fQ(e){return e.map((t)=>me(t)).join(`
163
- `)+`
164
- `}function mQ(e,t,n){if(t!==void 0&&t>0)return e.slice(n,n+t);if(n>0)return e.slice(n);return e}function nD(e){return typeof e==="object"&&e!==null&&"type"in e&&e.type==="agent_metadata"}async function K8e(e,t){let n=pQ(t.dir),r=ks(n),o=t.offset??0,s=t.limit;if(e.listSessionSummaries)return G8e(e,r,n,t.dir,s,o);if(!e.listSessions)throw Error("sessionStore.listSessions is not implemented -- cannot list sessions. Provide a store with a listSessions() method.");let a=(await e.listSessions(r)).slice().sort((l,u)=>u.mtime-l.mtime),c=mQ(a,s,o);return hQ(e,c,t.dir,n)}async function G8e(e,t,n,r,o,s){let i=await e.listSessionSummaries(t),a=e.listSessions?new Map((await e.listSessions(t)).map((p)=>[p.sessionId,p])):void 0,c=[];for(let p of i){let f=a?.get(p.sessionId);if(a&&!f)continue;let m=f!==void 0&&p.mtime<f.mtime;c.push({sessionId:p.sessionId,mtime:m?f.mtime:p.mtime,info:m?void 0:ND(p,n)})}if(a){let p=new Set(i.map((f)=>f.sessionId));for(let[f,m]of a)if(!p.has(f))c.push({sessionId:f,mtime:m.mtime})}else de("listSessionSummaries without listSessions: gap-fill skipped; sessions lacking a sidecar will be omitted");c.sort((p,f)=>f.mtime-p.mtime);let l=mQ(c,o,s),u=l.filter((p)=>p.info===void 0);if(u.length>0){let p=await hQ(e,u,r,n),f=new Map(p.map((m)=>[m.sessionId,m]));for(let m of l)if(m.info===void 0)m.info=f.get(m.sessionId)??null}return l.flatMap((p)=>p.info?[p.info]:[])}async function hQ(e,t,n,r){return(await Promise.allSettled(t.map(async(s)=>{let i=await _Q(e,s.sessionId,n);if(!i)return null;let a=Ru(s.sessionId,gQ(i,s.mtime),r);return a?{...a,lastModified:s.mtime}:null}))).flatMap((s,i)=>{let a=t[i];if(s.status==="fulfilled")return s.value?[s.value]:[];return[{sessionId:a.sessionId,summary:"",lastModified:a.mtime}]})}function gQ(e,t){let n=Buffer.from(e,"utf-8"),r=n.length,o=n.subarray(0,Cr).toString("utf-8"),s=r>Cr?n.subarray(r-Cr).toString("utf-8"):o;return{mtime:t,size:r,head:o,tail:s}}function W8e(e){let t=e.trimEnd(),n=t.slice(t.lastIndexOf(`
165
- `)+1);try{let r=yt(n);if(typeof r==="object"&&r!==null&&"timestamp"in r&&typeof r.timestamp==="string"){let o=Date.parse(r.timestamp);if(!Number.isNaN(o))return o}}catch{}return Date.now()}async function _Q(e,t,n){let r=Qr(n),o=await e.load({projectKey:r,sessionId:t});if(!o||o.length===0)return null;return fQ(o)}async function q8e(e,t,n){if(!rt(t))return[];let r=Qr(n.dir),o=await e.load({projectKey:r,sessionId:t});if(!o||o.length===0)return[];return bq(o,{limit:n.limit,offset:n.offset,includeSystemMessages:n.includeSystemMessages})}async function V8e(e,t,n){if(!rt(t))return;let r=await _Q(e,t,n.dir);if(!r)return;let o=gQ(r,W8e(r));return Ru(t,o)??void 0}async function Z8e(e,t,n,r){if(!rt(t))throw new qe(`Invalid sessionId: ${t}`,"renameSession: invalid sessionId (must be a UUID)");if(!n.trim())throw Error("title must be non-empty");let o=Qr(r);await e.append({projectKey:o,sessionId:t},[{type:"custom-title",customTitle:n.trim(),sessionId:t,uuid:rD(),timestamp:new Date().toISOString()}])}async function Y8e(e,t,n,r){if(!rt(t))throw new qe(`Invalid sessionId: ${t}`,"tagSession: invalid sessionId (must be a UUID)");if(n!==null){let s=za(n).trim();if(!s)throw Error("tag must be non-empty (use null to clear)");n=s}let o=Qr(r);await e.append({projectKey:o,sessionId:t},[{type:"tag",tag:n??"",sessionId:t,uuid:rD(),timestamp:new Date().toISOString()}])}async function J8e(e,t,n){if(!rt(t))throw new qe(`Invalid sessionId: ${t}`,"forkSession: invalid sessionId (must be a UUID)");if(n.upToMessageId&&!rt(n.upToMessageId))throw new qe(`Invalid upToMessageId: ${n.upToMessageId}`,"forkSession: invalid upToMessageId (must be a UUID)");let r=Qr(n.dir),o=await e.load({projectKey:r,sessionId:t});if(!o||o.length===0)throw Error(`Session ${t} not found`);let{entries:s,forkedSessionId:i}=$4(o,t,n);return await e.append({projectKey:r,sessionId:i},s),{sessionId:i}}async function X8e(e,t,n){if(!rt(t))return[];if(!e.listSubkeys)throw Error("sessionStore.listSubkeys is not implemented -- cannot list subagents. Provide a store with a listSubkeys() method.");let r=Qr(n),o=await e.listSubkeys({projectKey:r,sessionId:t}),s=new Set;for(let i of o){if(!i.startsWith("subagents/"))continue;let a=i.split("/").at(-1);if(a.startsWith("agent-"))s.add(a.slice(6))}return[...s]}async function Q8e(e,t,n,r){if(!rt(t))return[];if(!n)return[];let o=Qr(r.dir),s=`subagents/agent-${n}`;if(e.listSubkeys){let p=await e.listSubkeys({projectKey:o,sessionId:t}),f=`agent-${n}`,m=p.find((h)=>h.startsWith("subagents/")&&h.split("/").at(-1)===f);if(!m)return[];s=m}let i=await e.load({projectKey:o,sessionId:t,subpath:s});if(!i||i.length===0)return[];let a=i.findLast(nD),c=typeof a?.toolUseId==="string"?a.toolUseId:void 0,l=typeof a?.parentAgentId==="string"?a.parentAgentId:void 0,u=i.filter((p)=>!nD(p));if(u.length===0)return[];return _O(Buffer.from(fQ(u)),{limit:r.limit,offset:r.offset},c,l)}function iQ(e,t){let n=uQ(t,e),r=n.split(oD);if(r[0]===".."||lQ(n))return null;if(r.length<2)return null;let o=r[0],s=r[1];if(r.length===2&&s.endsWith(".jsonl"))return{projectKey:o,sessionId:s.replace(/\.jsonl$/,"")};if(r.length>=4){let i=r.slice(2),a=i.length-1;return i[a]=i.at(-1).replace(/\.jsonl$/,""),{projectKey:o,sessionId:s,subpath:i.join("/")}}return null}export{dr as AbortError,xE as CommandMatcher,Io as DirectConnectError,rJ as DirectConnectTransport,nee as EXIT_REASONS,wE as FileIndex,bc as HOOK_EVENTS,dE as InMemorySessionStore,uL as ORG_POLICY_LIMIT_PREFIXES,ree as SYSTEM_PROMPT_DYNAMIC_BOUNDARY,lL as USAGE_LIMIT_ERROR_PREFIXES,pL as USAGE_TRANSITION_PREFIXES,dL as USAGE_WARNING_PREFIXES,P6e as createSdkMcpServer,FGt as deleteSession,T8e as filterEscalatingDefaultMode,Sh as foldSessionSummary,jGt as forkSession,MGt as getSessionInfo,DGt as getSessionMessages,HGt as getSubagentMessages,$Gt as importSessionToStore,LGt as listSessions,zGt as listSubagents,L6e as parseDirectConnectUrl,PGt as query,NGt as renameSession,OGt as resolveSettings,IGt as startup,UGt as tagSession,O6e as tool};