@anthropic-ai/claude-agent-sdk 0.3.165 → 0.3.167

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/sdk.mjs CHANGED
@@ -1,27 +1,27 @@
1
1
  #!/usr/bin/env node
2
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
3
 
4
- // Version: 0.3.165
4
+ // Version: 0.3.167
5
5
 
6
6
  // Want to see the unminified source? We're hiring!
7
7
  // https://job-boards.greenhouse.io/anthropic/jobs/4816199008
8
- import{createRequire as pU}from"node:module";var nU=Object.create;var{getPrototypeOf:oU,defineProperty:Sg,getOwnPropertyNames:iU}=Object;var sU=Object.prototype.hasOwnProperty;function aU(e){return this[e]}var cU,lU,xg=(e,t,r)=>{var o=e!=null&&typeof e==="object";if(o){var n=t?cU??=new WeakMap:lU??=new WeakMap,i=n.get(e);if(i)return i}r=e!=null?nU(oU(e)):{};let s=t||!e||!e.__esModule?Sg(r,"default",{value:e,enumerable:!0}):r;for(let a of iU(e))if(!sU.call(s,a))Sg(s,a,{get:aU.bind(e,a),enumerable:!0});if(o)n.set(e,s);return s};var k=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var uU=(e)=>e;function dU(e,t){this[e]=uU.bind(null,t)}var xr=(e,t)=>{for(var r in t)Sg(e,r,{get:t[r],enumerable:!0,configurable:!0,set:dU.bind(t,r)})};var At=pU(import.meta.url),fU=Symbol.dispose||Symbol.for("Symbol.dispose"),mU=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),_e=(e,t,r)=>{if(t!=null){if(typeof t!=="object"&&typeof t!=="function")throw TypeError('Object expected to be assigned to "using" declaration');var o;if(r)o=t[mU];if(o===void 0)o=t[fU];if(typeof o!=="function")throw TypeError("Object not disposable");e.push([r,o,t])}else if(r)e.push([r]);return t},ve=(e,t,r)=>{var o=typeof SuppressedError==="function"?SuppressedError:function(s,a,c,u){return u=Error(c),u.name="SuppressedError",u.error=s,u.suppressed=a,u},n=(s)=>t=r?new o(s,t,"An error was suppressed during disposal"):(r=!0,s),i=(s)=>{while(s=e.pop())try{var a=s[1]&&s[1].call(s[2]);if(s[0])return Promise.resolve(a).then(i,(c)=>(n(c),i()))}catch(c){n(c)}if(r)throw t};return i()};var OE=k((RE)=>{Object.defineProperty(RE,"__esModule",{value:!0});RE._globalThis=void 0;RE._globalThis=typeof globalThis==="object"?globalThis:global});var AE=k((go)=>{var rH=go&&go.__createBinding||(Object.create?function(e,t,r,o){if(o===void 0)o=r;Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,o){if(o===void 0)o=r;e[o]=t[r]}),nH=go&&go.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r))rH(t,e,r)};Object.defineProperty(go,"__esModule",{value:!0});nH(OE(),go)});var CE=k((ho)=>{var oH=ho&&ho.__createBinding||(Object.create?function(e,t,r,o){if(o===void 0)o=r;Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,o){if(o===void 0)o=r;e[o]=t[r]}),iH=ho&&ho.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r))oH(t,e,r)};Object.defineProperty(ho,"__esModule",{value:!0});iH(AE(),ho)});var Mh=k((ME)=>{Object.defineProperty(ME,"__esModule",{value:!0});ME.VERSION=void 0;ME.VERSION="1.9.0"});var LE=k((zE)=>{Object.defineProperty(zE,"__esModule",{value:!0});zE.isCompatible=zE._makeCompatibilityCheck=void 0;var sH=Mh(),DE=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function jE(e){let t=new Set([e]),r=new Set,o=e.match(DE);if(!o)return()=>!1;let n={major:+o[1],minor:+o[2],patch:+o[3],prerelease:o[4]};if(n.prerelease!=null)return function(c){return c===e};function i(a){return r.add(a),!1}function s(a){return t.add(a),!0}return function(c){if(t.has(c))return!0;if(r.has(c))return!1;let u=c.match(DE);if(!u)return i(c);let d={major:+u[1],minor:+u[2],patch:+u[3],prerelease:u[4]};if(d.prerelease!=null)return i(c);if(n.major!==d.major)return i(c);if(n.major===0){if(n.minor===d.minor&&n.patch<=d.patch)return s(c);return i(c)}if(n.minor<=d.minor)return s(c);return i(c)}}zE._makeCompatibilityCheck=jE;zE.isCompatible=jE(sH.VERSION)});var yo=k((FE)=>{Object.defineProperty(FE,"__esModule",{value:!0});FE.unregisterGlobal=FE.getGlobal=FE.registerGlobal=void 0;var cH=CE(),Ii=Mh(),lH=LE(),uH=Ii.VERSION.split(".")[0],Ba=Symbol.for(`opentelemetry.js.api.${uH}`),qa=cH._globalThis;function dH(e,t,r,o=!1){var n;let i=qa[Ba]=(n=qa[Ba])!==null&&n!==void 0?n:{version:Ii.VERSION};if(!o&&i[e]){let s=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(s.stack||s.message),!1}if(i.version!==Ii.VERSION){let s=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${Ii.VERSION}`);return r.error(s.stack||s.message),!1}return i[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${Ii.VERSION}.`),!0}FE.registerGlobal=dH;function pH(e){var t,r;let o=(t=qa[Ba])===null||t===void 0?void 0:t.version;if(!o||!(0,lH.isCompatible)(o))return;return(r=qa[Ba])===null||r===void 0?void 0:r[e]}FE.getGlobal=pH;function fH(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${Ii.VERSION}.`);let r=qa[Ba];if(r)delete r[e]}FE.unregisterGlobal=fH});var VE=k((qE)=>{Object.defineProperty(qE,"__esModule",{value:!0});qE.DiagComponentLogger=void 0;var hH=yo();class BE{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return Za("debug",this._namespace,e)}error(...e){return Za("error",this._namespace,e)}info(...e){return Za("info",this._namespace,e)}warn(...e){return Za("warn",this._namespace,e)}verbose(...e){return Za("verbose",this._namespace,e)}}qE.DiagComponentLogger=BE;function Za(e,t,r){let o=(0,hH.getGlobal)("diag");if(!o)return;return r.unshift(t),o[e](...r)}});var _d=k((WE)=>{Object.defineProperty(WE,"__esModule",{value:!0});WE.DiagLogLevel=void 0;var yH;(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"})(yH=WE.DiagLogLevel||(WE.DiagLogLevel={}))});var JE=k((KE)=>{Object.defineProperty(KE,"__esModule",{value:!0});KE.createLogLevelDiagLogger=void 0;var Fr=_d();function bH(e,t){if(e<Fr.DiagLogLevel.NONE)e=Fr.DiagLogLevel.NONE;else if(e>Fr.DiagLogLevel.ALL)e=Fr.DiagLogLevel.ALL;t=t||{};function r(o,n){let i=t[o];if(typeof i==="function"&&e>=n)return i.bind(t);return function(){}}return{error:r("error",Fr.DiagLogLevel.ERROR),warn:r("warn",Fr.DiagLogLevel.WARN),info:r("info",Fr.DiagLogLevel.INFO),debug:r("debug",Fr.DiagLogLevel.DEBUG),verbose:r("verbose",Fr.DiagLogLevel.VERBOSE)}}KE.createLogLevelDiagLogger=bH});var bo=k((YE)=>{Object.defineProperty(YE,"__esModule",{value:!0});YE.DiagAPI=void 0;var _H=VE(),vH=JE(),XE=_d(),vd=yo(),SH="diag";class Dh{constructor(){function e(o){return function(...n){let i=(0,vd.getGlobal)("diag");if(!i)return;return i[o](...n)}}let t=this,r=(o,n={logLevel:XE.DiagLogLevel.INFO})=>{var i,s,a;if(o===t){let d=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error((i=d.stack)!==null&&i!==void 0?i:d.message),!1}if(typeof n==="number")n={logLevel:n};let c=(0,vd.getGlobal)("diag"),u=(0,vH.createLogLevelDiagLogger)((s=n.logLevel)!==null&&s!==void 0?s:XE.DiagLogLevel.INFO,o);if(c&&!n.suppressOverrideMessage){let d=(a=Error().stack)!==null&&a!==void 0?a:"<failed to generate stacktrace>";c.warn(`Current logger will be overwritten from ${d}`),u.warn(`Current logger will overwrite one already registered from ${d}`)}return(0,vd.registerGlobal)("diag",u,t,!0)};t.setLogger=r,t.disable=()=>{(0,vd.unregisterGlobal)(SH,t)},t.createComponentLogger=(o)=>{return new _H.DiagComponentLogger(o)},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 Dh;return this._instance}}YE.DiagAPI=Dh});var rP=k((eP)=>{Object.defineProperty(eP,"__esModule",{value:!0});eP.BaggageImpl=void 0;class Ri{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 r=new Ri(this._entries);return r._entries.set(e,t),r}removeEntry(e){let t=new Ri(this._entries);return t._entries.delete(e),t}removeEntries(...e){let t=new Ri(this._entries);for(let r of e)t._entries.delete(r);return t}clear(){return new Ri}}eP.BaggageImpl=Ri});var iP=k((nP)=>{Object.defineProperty(nP,"__esModule",{value:!0});nP.baggageEntryMetadataSymbol=void 0;nP.baggageEntryMetadataSymbol=Symbol("BaggageEntryMetadata")});var jh=k((sP)=>{Object.defineProperty(sP,"__esModule",{value:!0});sP.baggageEntryMetadataFromString=sP.createBaggage=void 0;var xH=bo(),wH=rP(),kH=iP(),TH=xH.DiagAPI.instance();function EH(e={}){return new wH.BaggageImpl(new Map(Object.entries(e)))}sP.createBaggage=EH;function PH(e){if(typeof e!=="string")TH.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e="";return{__TYPE__:kH.baggageEntryMetadataSymbol,toString(){return e}}}sP.baggageEntryMetadataFromString=PH});var Va=k((cP)=>{Object.defineProperty(cP,"__esModule",{value:!0});cP.ROOT_CONTEXT=cP.createContextKey=void 0;function RH(e){return Symbol.for(e)}cP.createContextKey=RH;class Sd{constructor(e){let t=this;t._currentContext=e?new Map(e):new Map,t.getValue=(r)=>t._currentContext.get(r),t.setValue=(r,o)=>{let n=new Sd(t._currentContext);return n._currentContext.set(r,o),n},t.deleteValue=(r)=>{let o=new Sd(t._currentContext);return o._currentContext.delete(r),o}}}cP.ROOT_CONTEXT=new Sd});var fP=k((dP)=>{Object.defineProperty(dP,"__esModule",{value:!0});dP.DiagConsoleLogger=void 0;var zh=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}];class uP{constructor(){function e(t){return function(...r){if(console){let o=console[t];if(typeof o!=="function")o=console.log;if(typeof o==="function")return o.apply(console,r)}}}for(let t=0;t<zh.length;t++)this[zh[t].n]=e(zh[t].c)}}dP.DiagConsoleLogger=uP});var Wh=k((mP)=>{Object.defineProperty(mP,"__esModule",{value:!0});mP.createNoopMeter=mP.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=mP.NOOP_OBSERVABLE_GAUGE_METRIC=mP.NOOP_OBSERVABLE_COUNTER_METRIC=mP.NOOP_UP_DOWN_COUNTER_METRIC=mP.NOOP_HISTOGRAM_METRIC=mP.NOOP_GAUGE_METRIC=mP.NOOP_COUNTER_METRIC=mP.NOOP_METER=mP.NoopObservableUpDownCounterMetric=mP.NoopObservableGaugeMetric=mP.NoopObservableCounterMetric=mP.NoopObservableMetric=mP.NoopHistogramMetric=mP.NoopGaugeMetric=mP.NoopUpDownCounterMetric=mP.NoopCounterMetric=mP.NoopMetric=mP.NoopMeter=void 0;class Uh{constructor(){}createGauge(e,t){return mP.NOOP_GAUGE_METRIC}createHistogram(e,t){return mP.NOOP_HISTOGRAM_METRIC}createCounter(e,t){return mP.NOOP_COUNTER_METRIC}createUpDownCounter(e,t){return mP.NOOP_UP_DOWN_COUNTER_METRIC}createObservableGauge(e,t){return mP.NOOP_OBSERVABLE_GAUGE_METRIC}createObservableCounter(e,t){return mP.NOOP_OBSERVABLE_COUNTER_METRIC}createObservableUpDownCounter(e,t){return mP.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}}mP.NoopMeter=Uh;class $i{}mP.NoopMetric=$i;class Lh extends $i{add(e,t){}}mP.NoopCounterMetric=Lh;class Fh extends $i{add(e,t){}}mP.NoopUpDownCounterMetric=Fh;class Hh extends $i{record(e,t){}}mP.NoopGaugeMetric=Hh;class Bh extends $i{record(e,t){}}mP.NoopHistogramMetric=Bh;class Wa{addCallback(e){}removeCallback(e){}}mP.NoopObservableMetric=Wa;class qh extends Wa{}mP.NoopObservableCounterMetric=qh;class Zh extends Wa{}mP.NoopObservableGaugeMetric=Zh;class Vh extends Wa{}mP.NoopObservableUpDownCounterMetric=Vh;mP.NOOP_METER=new Uh;mP.NOOP_COUNTER_METRIC=new Lh;mP.NOOP_GAUGE_METRIC=new Hh;mP.NOOP_HISTOGRAM_METRIC=new Bh;mP.NOOP_UP_DOWN_COUNTER_METRIC=new Fh;mP.NOOP_OBSERVABLE_COUNTER_METRIC=new qh;mP.NOOP_OBSERVABLE_GAUGE_METRIC=new Zh;mP.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=new Vh;function OH(){return mP.NOOP_METER}mP.createNoopMeter=OH});var TP=k((kP)=>{Object.defineProperty(kP,"__esModule",{value:!0});kP.ValueType=void 0;var HH;(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(HH=kP.ValueType||(kP.ValueType={}))});var Gh=k((EP)=>{Object.defineProperty(EP,"__esModule",{value:!0});EP.defaultTextMapSetter=EP.defaultTextMapGetter=void 0;EP.defaultTextMapGetter={get(e,t){if(e==null)return;return e[t]},keys(e){if(e==null)return[];return Object.keys(e)}};EP.defaultTextMapSetter={set(e,t,r){if(e==null)return;e[t]=r}}});var OP=k((RP)=>{Object.defineProperty(RP,"__esModule",{value:!0});RP.NoopContextManager=void 0;var qH=Va();class IP{active(){return qH.ROOT_CONTEXT}with(e,t,r,...o){return t.call(r,...o)}bind(e,t){return t}enable(){return this}disable(){return this}}RP.NoopContextManager=IP});var Ka=k((CP)=>{Object.defineProperty(CP,"__esModule",{value:!0});CP.ContextAPI=void 0;var ZH=OP(),Jh=yo(),AP=bo(),Xh="context",VH=new ZH.NoopContextManager;class Yh{constructor(){}static getInstance(){if(!this._instance)this._instance=new Yh;return this._instance}setGlobalContextManager(e){return(0,Jh.registerGlobal)(Xh,e,AP.DiagAPI.instance())}active(){return this._getContextManager().active()}with(e,t,r,...o){return this._getContextManager().with(e,t,r,...o)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return(0,Jh.getGlobal)(Xh)||VH}disable(){this._getContextManager().disable(),(0,Jh.unregisterGlobal)(Xh,AP.DiagAPI.instance())}}CP.ContextAPI=Yh});var ey=k((NP)=>{Object.defineProperty(NP,"__esModule",{value:!0});NP.TraceFlags=void 0;var WH;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(WH=NP.TraceFlags||(NP.TraceFlags={}))});var xd=k((DP)=>{Object.defineProperty(DP,"__esModule",{value:!0});DP.INVALID_SPAN_CONTEXT=DP.INVALID_TRACEID=DP.INVALID_SPANID=void 0;var KH=ey();DP.INVALID_SPANID="0000000000000000";DP.INVALID_TRACEID="00000000000000000000000000000000";DP.INVALID_SPAN_CONTEXT={traceId:DP.INVALID_TRACEID,spanId:DP.INVALID_SPANID,traceFlags:KH.TraceFlags.NONE}});var wd=k((FP)=>{Object.defineProperty(FP,"__esModule",{value:!0});FP.NonRecordingSpan=void 0;var GH=xd();class LP{constructor(e=GH.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){}}FP.NonRecordingSpan=LP});var ny=k((qP)=>{Object.defineProperty(qP,"__esModule",{value:!0});qP.getSpanContext=qP.setSpanContext=qP.deleteSpan=qP.setSpan=qP.getActiveSpan=qP.getSpan=void 0;var JH=Va(),XH=wd(),YH=Ka(),ty=(0,JH.createContextKey)("OpenTelemetry Context Key SPAN");function ry(e){return e.getValue(ty)||void 0}qP.getSpan=ry;function QH(){return ry(YH.ContextAPI.getInstance().active())}qP.getActiveSpan=QH;function BP(e,t){return e.setValue(ty,t)}qP.setSpan=BP;function eB(e){return e.deleteValue(ty)}qP.deleteSpan=eB;function tB(e,t){return BP(e,new XH.NonRecordingSpan(t))}qP.setSpanContext=tB;function rB(e){var t;return(t=ry(e))===null||t===void 0?void 0:t.spanContext()}qP.getSpanContext=rB});var kd=k((GP)=>{Object.defineProperty(GP,"__esModule",{value:!0});GP.wrapSpanContext=GP.isSpanContextValid=GP.isValidSpanId=GP.isValidTraceId=void 0;var VP=xd(),cB=wd(),lB=/^([0-9a-f]{32})$/i,uB=/^[0-9a-f]{16}$/i;function WP(e){return lB.test(e)&&e!==VP.INVALID_TRACEID}GP.isValidTraceId=WP;function KP(e){return uB.test(e)&&e!==VP.INVALID_SPANID}GP.isValidSpanId=KP;function dB(e){return WP(e.traceId)&&KP(e.spanId)}GP.isSpanContextValid=dB;function pB(e){return new cB.NonRecordingSpan(e)}GP.wrapSpanContext=pB});var sy=k((QP)=>{Object.defineProperty(QP,"__esModule",{value:!0});QP.NoopTracer=void 0;var hB=Ka(),XP=ny(),oy=wd(),yB=kd(),iy=hB.ContextAPI.getInstance();class YP{startSpan(e,t,r=iy.active()){if(Boolean(t===null||t===void 0?void 0:t.root))return new oy.NonRecordingSpan;let n=r&&(0,XP.getSpanContext)(r);if(bB(n)&&(0,yB.isSpanContextValid)(n))return new oy.NonRecordingSpan(n);else return new oy.NonRecordingSpan}startActiveSpan(e,t,r,o){let n,i,s;if(arguments.length<2)return;else if(arguments.length===2)s=t;else if(arguments.length===3)n=t,s=r;else n=t,i=r,s=o;let a=i!==null&&i!==void 0?i:iy.active(),c=this.startSpan(e,n,a),u=(0,XP.setSpan)(a,c);return iy.with(u,s,void 0,c)}}QP.NoopTracer=YP;function bB(e){return typeof e==="object"&&typeof e.spanId==="string"&&typeof e.traceId==="string"&&typeof e.traceFlags==="number"}});var ay=k((rI)=>{Object.defineProperty(rI,"__esModule",{value:!0});rI.ProxyTracer=void 0;var _B=sy(),vB=new _B.NoopTracer;class tI{constructor(e,t,r,o){this._provider=e,this.name=t,this.version=r,this.options=o}startSpan(e,t,r){return this._getTracer().startSpan(e,t,r)}startActiveSpan(e,t,r,o){let n=this._getTracer();return Reflect.apply(n.startActiveSpan,n,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);if(!e)return vB;return this._delegate=e,this._delegate}}rI.ProxyTracer=tI});var aI=k((iI)=>{Object.defineProperty(iI,"__esModule",{value:!0});iI.NoopTracerProvider=void 0;var SB=sy();class oI{getTracer(e,t,r){return new SB.NoopTracer}}iI.NoopTracerProvider=oI});var cy=k((lI)=>{Object.defineProperty(lI,"__esModule",{value:!0});lI.ProxyTracerProvider=void 0;var xB=ay(),wB=aI(),kB=new wB.NoopTracerProvider;class cI{getTracer(e,t,r){var o;return(o=this.getDelegateTracer(e,t,r))!==null&&o!==void 0?o:new xB.ProxyTracer(this,e,t,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:kB}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(e,t,r)}}lI.ProxyTracerProvider=cI});var pI=k((dI)=>{Object.defineProperty(dI,"__esModule",{value:!0});dI.SamplingDecision=void 0;var TB;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(TB=dI.SamplingDecision||(dI.SamplingDecision={}))});var mI=k((fI)=>{Object.defineProperty(fI,"__esModule",{value:!0});fI.SpanKind=void 0;var EB;(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"})(EB=fI.SpanKind||(fI.SpanKind={}))});var hI=k((gI)=>{Object.defineProperty(gI,"__esModule",{value:!0});gI.SpanStatusCode=void 0;var PB;(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(PB=gI.SpanStatusCode||(gI.SpanStatusCode={}))});var _I=k((yI)=>{Object.defineProperty(yI,"__esModule",{value:!0});yI.validateValue=yI.validateKey=void 0;var py="[_0-9a-z-*/]",IB=`[a-z]${py}{0,255}`,RB=`[a-z0-9]${py}{0,240}@[a-z]${py}{0,13}`,$B=new RegExp(`^(?:${IB}|${RB})$`),OB=/^[ -~]{0,255}[!-~]$/,AB=/,|=/;function CB(e){return $B.test(e)}yI.validateKey=CB;function MB(e){return OB.test(e)&&!AB.test(e)}yI.validateValue=MB});var EI=k((kI)=>{Object.defineProperty(kI,"__esModule",{value:!0});kI.TraceStateImpl=void 0;var vI=_I(),SI=32,DB=512,xI=",",wI="=";class fy{constructor(e){if(this._internalState=new Map,e)this._parse(e)}set(e,t){let r=this._clone();if(r._internalState.has(e))r._internalState.delete(e);return r._internalState.set(e,t),r}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)=>{return e.push(t+wI+this.get(t)),e},[]).join(xI)}_parse(e){if(e.length>DB)return;if(this._internalState=e.split(xI).reverse().reduce((t,r)=>{let o=r.trim(),n=o.indexOf(wI);if(n!==-1){let i=o.slice(0,n),s=o.slice(n+1,r.length);if((0,vI.validateKey)(i)&&(0,vI.validateValue)(s))t.set(i,s)}return t},new Map),this._internalState.size>SI)this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,SI))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new fy;return e._internalState=new Map(this._internalState),e}}kI.TraceStateImpl=fy});var RI=k((PI)=>{Object.defineProperty(PI,"__esModule",{value:!0});PI.createTraceState=void 0;var jB=EI();function zB(e){return new jB.TraceStateImpl(e)}PI.createTraceState=zB});var AI=k(($I)=>{Object.defineProperty($I,"__esModule",{value:!0});$I.context=void 0;var UB=Ka();$I.context=UB.ContextAPI.getInstance()});var NI=k((CI)=>{Object.defineProperty(CI,"__esModule",{value:!0});CI.diag=void 0;var LB=bo();CI.diag=LB.DiagAPI.instance()});var zI=k((DI)=>{Object.defineProperty(DI,"__esModule",{value:!0});DI.NOOP_METER_PROVIDER=DI.NoopMeterProvider=void 0;var FB=Wh();class my{getMeter(e,t,r){return FB.NOOP_METER}}DI.NoopMeterProvider=my;DI.NOOP_METER_PROVIDER=new my});var HI=k((LI)=>{Object.defineProperty(LI,"__esModule",{value:!0});LI.MetricsAPI=void 0;var BB=zI(),gy=yo(),UI=bo(),hy="metrics";class yy{constructor(){}static getInstance(){if(!this._instance)this._instance=new yy;return this._instance}setGlobalMeterProvider(e){return(0,gy.registerGlobal)(hy,e,UI.DiagAPI.instance())}getMeterProvider(){return(0,gy.getGlobal)(hy)||BB.NOOP_METER_PROVIDER}getMeter(e,t,r){return this.getMeterProvider().getMeter(e,t,r)}disable(){(0,gy.unregisterGlobal)(hy,UI.DiagAPI.instance())}}LI.MetricsAPI=yy});var ZI=k((BI)=>{Object.defineProperty(BI,"__esModule",{value:!0});BI.metrics=void 0;var qB=HI();BI.metrics=qB.MetricsAPI.getInstance()});var GI=k((WI)=>{Object.defineProperty(WI,"__esModule",{value:!0});WI.NoopTextMapPropagator=void 0;class VI{inject(e,t){}extract(e,t){return e}fields(){return[]}}WI.NoopTextMapPropagator=VI});var QI=k((XI)=>{Object.defineProperty(XI,"__esModule",{value:!0});XI.deleteBaggage=XI.setBaggage=XI.getActiveBaggage=XI.getBaggage=void 0;var ZB=Ka(),VB=Va(),by=(0,VB.createContextKey)("OpenTelemetry Baggage Key");function JI(e){return e.getValue(by)||void 0}XI.getBaggage=JI;function WB(){return JI(ZB.ContextAPI.getInstance().active())}XI.getActiveBaggage=WB;function KB(e,t){return e.setValue(by,t)}XI.setBaggage=KB;function GB(e){return e.deleteValue(by)}XI.deleteBaggage=GB});var o0=k((r0)=>{Object.defineProperty(r0,"__esModule",{value:!0});r0.PropagationAPI=void 0;var _y=yo(),QB=GI(),e0=Gh(),Td=QI(),eq=jh(),t0=bo(),vy="propagation",tq=new QB.NoopTextMapPropagator;class Sy{constructor(){this.createBaggage=eq.createBaggage,this.getBaggage=Td.getBaggage,this.getActiveBaggage=Td.getActiveBaggage,this.setBaggage=Td.setBaggage,this.deleteBaggage=Td.deleteBaggage}static getInstance(){if(!this._instance)this._instance=new Sy;return this._instance}setGlobalPropagator(e){return(0,_y.registerGlobal)(vy,e,t0.DiagAPI.instance())}inject(e,t,r=e0.defaultTextMapSetter){return this._getGlobalPropagator().inject(e,t,r)}extract(e,t,r=e0.defaultTextMapGetter){return this._getGlobalPropagator().extract(e,t,r)}fields(){return this._getGlobalPropagator().fields()}disable(){(0,_y.unregisterGlobal)(vy,t0.DiagAPI.instance())}_getGlobalPropagator(){return(0,_y.getGlobal)(vy)||tq}}r0.PropagationAPI=Sy});var a0=k((i0)=>{Object.defineProperty(i0,"__esModule",{value:!0});i0.propagation=void 0;var rq=o0();i0.propagation=rq.PropagationAPI.getInstance()});var f0=k((d0)=>{Object.defineProperty(d0,"__esModule",{value:!0});d0.TraceAPI=void 0;var xy=yo(),c0=cy(),l0=kd(),Oi=ny(),u0=bo(),wy="trace";class ky{constructor(){this._proxyTracerProvider=new c0.ProxyTracerProvider,this.wrapSpanContext=l0.wrapSpanContext,this.isSpanContextValid=l0.isSpanContextValid,this.deleteSpan=Oi.deleteSpan,this.getSpan=Oi.getSpan,this.getActiveSpan=Oi.getActiveSpan,this.getSpanContext=Oi.getSpanContext,this.setSpan=Oi.setSpan,this.setSpanContext=Oi.setSpanContext}static getInstance(){if(!this._instance)this._instance=new ky;return this._instance}setGlobalTracerProvider(e){let t=(0,xy.registerGlobal)(wy,this._proxyTracerProvider,u0.DiagAPI.instance());if(t)this._proxyTracerProvider.setDelegate(e);return t}getTracerProvider(){return(0,xy.getGlobal)(wy)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){(0,xy.unregisterGlobal)(wy,u0.DiagAPI.instance()),this._proxyTracerProvider=new c0.ProxyTracerProvider}}d0.TraceAPI=ky});var h0=k((m0)=>{Object.defineProperty(m0,"__esModule",{value:!0});m0.trace=void 0;var nq=f0();m0.trace=nq.TraceAPI.getInstance()});var k0=k((be)=>{Object.defineProperty(be,"__esModule",{value:!0});be.trace=be.propagation=be.metrics=be.diag=be.context=be.INVALID_SPAN_CONTEXT=be.INVALID_TRACEID=be.INVALID_SPANID=be.isValidSpanId=be.isValidTraceId=be.isSpanContextValid=be.createTraceState=be.TraceFlags=be.SpanStatusCode=be.SpanKind=be.SamplingDecision=be.ProxyTracerProvider=be.ProxyTracer=be.defaultTextMapSetter=be.defaultTextMapGetter=be.ValueType=be.createNoopMeter=be.DiagLogLevel=be.DiagConsoleLogger=be.ROOT_CONTEXT=be.createContextKey=be.baggageEntryMetadataFromString=void 0;var oq=jh();Object.defineProperty(be,"baggageEntryMetadataFromString",{enumerable:!0,get:function(){return oq.baggageEntryMetadataFromString}});var y0=Va();Object.defineProperty(be,"createContextKey",{enumerable:!0,get:function(){return y0.createContextKey}});Object.defineProperty(be,"ROOT_CONTEXT",{enumerable:!0,get:function(){return y0.ROOT_CONTEXT}});var iq=fP();Object.defineProperty(be,"DiagConsoleLogger",{enumerable:!0,get:function(){return iq.DiagConsoleLogger}});var sq=_d();Object.defineProperty(be,"DiagLogLevel",{enumerable:!0,get:function(){return sq.DiagLogLevel}});var aq=Wh();Object.defineProperty(be,"createNoopMeter",{enumerable:!0,get:function(){return aq.createNoopMeter}});var cq=TP();Object.defineProperty(be,"ValueType",{enumerable:!0,get:function(){return cq.ValueType}});var b0=Gh();Object.defineProperty(be,"defaultTextMapGetter",{enumerable:!0,get:function(){return b0.defaultTextMapGetter}});Object.defineProperty(be,"defaultTextMapSetter",{enumerable:!0,get:function(){return b0.defaultTextMapSetter}});var lq=ay();Object.defineProperty(be,"ProxyTracer",{enumerable:!0,get:function(){return lq.ProxyTracer}});var uq=cy();Object.defineProperty(be,"ProxyTracerProvider",{enumerable:!0,get:function(){return uq.ProxyTracerProvider}});var dq=pI();Object.defineProperty(be,"SamplingDecision",{enumerable:!0,get:function(){return dq.SamplingDecision}});var pq=mI();Object.defineProperty(be,"SpanKind",{enumerable:!0,get:function(){return pq.SpanKind}});var fq=hI();Object.defineProperty(be,"SpanStatusCode",{enumerable:!0,get:function(){return fq.SpanStatusCode}});var mq=ey();Object.defineProperty(be,"TraceFlags",{enumerable:!0,get:function(){return mq.TraceFlags}});var gq=RI();Object.defineProperty(be,"createTraceState",{enumerable:!0,get:function(){return gq.createTraceState}});var Ty=kd();Object.defineProperty(be,"isSpanContextValid",{enumerable:!0,get:function(){return Ty.isSpanContextValid}});Object.defineProperty(be,"isValidTraceId",{enumerable:!0,get:function(){return Ty.isValidTraceId}});Object.defineProperty(be,"isValidSpanId",{enumerable:!0,get:function(){return Ty.isValidSpanId}});var Ey=xd();Object.defineProperty(be,"INVALID_SPANID",{enumerable:!0,get:function(){return Ey.INVALID_SPANID}});Object.defineProperty(be,"INVALID_TRACEID",{enumerable:!0,get:function(){return Ey.INVALID_TRACEID}});Object.defineProperty(be,"INVALID_SPAN_CONTEXT",{enumerable:!0,get:function(){return Ey.INVALID_SPAN_CONTEXT}});var _0=AI();Object.defineProperty(be,"context",{enumerable:!0,get:function(){return _0.context}});var v0=NI();Object.defineProperty(be,"diag",{enumerable:!0,get:function(){return v0.diag}});var S0=ZI();Object.defineProperty(be,"metrics",{enumerable:!0,get:function(){return S0.metrics}});var x0=a0();Object.defineProperty(be,"propagation",{enumerable:!0,get:function(){return x0.propagation}});var w0=h0();Object.defineProperty(be,"trace",{enumerable:!0,get:function(){return w0.trace}});be.default={context:_0.context,diag:v0.diag,metrics:S0.metrics,propagation:x0.propagation,trace:w0.trace}});var Pl=k((kO)=>{Object.defineProperty(kO,"__esModule",{value:!0});kO.regexpCode=kO.getEsmExportName=kO.getProperty=kO.safeStringify=kO.stringify=kO.strConcat=kO.addCodeArg=kO.str=kO._=kO.nil=kO._Code=kO.Name=kO.IDENTIFIER=kO._CodeOrName=void 0;class ym{}kO._CodeOrName=ym;kO.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class ps extends ym{constructor(e){super();if(!kO.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}}}kO.Name=ps;class mr extends ym{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,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof ps)t[r.str]=(t[r.str]||0)+1;return t},{})}}kO._Code=mr;kO.nil=new mr("");function xO(e,...t){let r=[e[0]],o=0;while(o<t.length)fS(r,t[o]),r.push(e[++o]);return new mr(r)}kO._=xO;var pS=new mr("+");function wO(e,...t){let r=[El(e[0])],o=0;while(o<t.length)r.push(pS),fS(r,t[o]),r.push(pS,El(e[++o]));return AG(r),new mr(r)}kO.str=wO;function fS(e,t){if(t instanceof mr)e.push(...t._items);else if(t instanceof ps)e.push(t);else e.push(NG(t))}kO.addCodeArg=fS;function AG(e){let t=1;while(t<e.length-1){if(e[t]===pS){let r=CG(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function CG(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof ps||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 ps))return`"${e}${t.slice(1)}`;return}function MG(e,t){return t.emptyStr()?e:e.emptyStr()?t:wO`${e}${t}`}kO.strConcat=MG;function NG(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:El(Array.isArray(e)?e.join(","):e)}function DG(e){return new mr(El(e))}kO.stringify=DG;function El(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}kO.safeStringify=El;function jG(e){return typeof e=="string"&&kO.IDENTIFIER.test(e)?new mr(`.${e}`):xO`[${e}]`}kO.getProperty=jG;function zG(e){if(typeof e=="string"&&kO.IDENTIFIER.test(e))return new mr(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}kO.getEsmExportName=zG;function UG(e){return new mr(e.toString())}kO.regexpCode=UG});var yS=k((IO)=>{Object.defineProperty(IO,"__esModule",{value:!0});IO.ValueScope=IO.ValueScopeName=IO.Scope=IO.varKinds=IO.UsedValueState=void 0;var Pt=Pl();class EO extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var _m;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(_m||(IO.UsedValueState=_m={}));IO.varKinds={const:new Pt.Name("const"),let:new Pt.Name("let"),var:new Pt.Name("var")};class gS{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof Pt.Name?e:this.name(e)}name(e){return new Pt.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.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}}}IO.Scope=gS;class hS extends Pt.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=Pt._`.${new Pt.Name(t)}[${r}]`}}IO.ValueScopeName=hS;var YG=Pt._`\n`;class PO extends gS{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?YG:Pt.nil}}get(){return this._scope}name(e){return new hS(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:n}=o,i=(r=t.key)!==null&&r!==void 0?r:t.ref,s=this._values[n];if(s){let u=s.get(i);if(u)return u}else s=this._values[n]=new Map;s.set(i,o);let a=this._scope[n]||(this._scope[n]=[]),c=a.length;return a[c]=t.ref,o.setValue(t,{property:n,itemIndex:c}),o}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return Pt._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(o)=>{if(o.value===void 0)throw Error(`CodeGen: name "${o}" has no value`);return o.value.code},t,r)}_reduceValues(e,t,r={},o){let n=Pt.nil;for(let i in e){let s=e[i];if(!s)continue;let a=r[i]=r[i]||new Map;s.forEach((c)=>{if(a.has(c))return;a.set(c,_m.Started);let u=t(c);if(u){let d=this.opts.es5?IO.varKinds.var:IO.varKinds.const;n=Pt._`${n}${d} ${c} = ${u};${this.opts._n}`}else if(u=o===null||o===void 0?void 0:o(c))n=Pt._`${n}${u}${this.opts._n}`;else throw new EO(c);a.set(c,_m.Completed)})}return n}}IO.ValueScope=PO});var te=k((It)=>{Object.defineProperty(It,"__esModule",{value:!0});It.or=It.and=It.not=It.CodeGen=It.operators=It.varKinds=It.ValueScopeName=It.ValueScope=It.Scope=It.Name=It.regexpCode=It.stringify=It.getProperty=It.nil=It.strConcat=It.str=It._=void 0;var le=Pl(),gr=yS(),jn=Pl();Object.defineProperty(It,"_",{enumerable:!0,get:function(){return jn._}});Object.defineProperty(It,"str",{enumerable:!0,get:function(){return jn.str}});Object.defineProperty(It,"strConcat",{enumerable:!0,get:function(){return jn.strConcat}});Object.defineProperty(It,"nil",{enumerable:!0,get:function(){return jn.nil}});Object.defineProperty(It,"getProperty",{enumerable:!0,get:function(){return jn.getProperty}});Object.defineProperty(It,"stringify",{enumerable:!0,get:function(){return jn.stringify}});Object.defineProperty(It,"regexpCode",{enumerable:!0,get:function(){return jn.regexpCode}});Object.defineProperty(It,"Name",{enumerable:!0,get:function(){return jn.Name}});var Tm=yS();Object.defineProperty(It,"Scope",{enumerable:!0,get:function(){return Tm.Scope}});Object.defineProperty(It,"ValueScope",{enumerable:!0,get:function(){return Tm.ValueScope}});Object.defineProperty(It,"ValueScopeName",{enumerable:!0,get:function(){return Tm.ValueScopeName}});Object.defineProperty(It,"varKinds",{enumerable:!0,get:function(){return Tm.varKinds}});It.operators={GT:new le._Code(">"),GTE:new le._Code(">="),LT:new le._Code("<"),LTE:new le._Code("<="),EQ:new le._Code("==="),NEQ:new le._Code("!=="),NOT:new le._Code("!"),OR:new le._Code("||"),AND:new le._Code("&&"),ADD:new le._Code("+")};class zn{optimizeNodes(){return this}optimizeNames(e,t){return this}}class $O extends zn{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?gr.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${o};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=ms(this.rhs,e,t);return this}get names(){return this.rhs instanceof le._CodeOrName?this.rhs.names:{}}}class vS extends zn{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof le.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=ms(this.rhs,e,t),this}get names(){let e=this.lhs instanceof le.Name?{}:{...this.lhs.names};return km(e,this.rhs)}}class OO extends vS{constructor(e,t,r,o){super(e,r,o);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class AO extends zn{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class CO extends zn{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class MO extends zn{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class NO extends zn{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=ms(this.code,e,t),this}get names(){return this.code instanceof le._CodeOrName?this.code.names:{}}}class Em extends zn{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,o=r.length;while(o--){let n=r[o];if(n.optimizeNames(e,t))continue;r9(e,n.names),r.splice(o,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>No(e,t.names),{})}}class Un extends Em{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class DO extends Em{}class Il extends Un{}Il.kind="else";class en extends Un{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 r=t.optimizeNodes();t=this.else=Array.isArray(r)?new Il(r):r}if(t){if(e===!1)return t instanceof en?t:t.nodes;if(this.nodes.length)return this;return new en(FO(e),t instanceof en?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=ms(this.condition,e,t),this}get names(){let e=super.names;if(km(e,this.condition),this.else)No(e,this.else.names);return e}}en.kind="if";class fs extends Un{}fs.kind="for";class jO extends fs{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=ms(this.iteration,e,t),this}get names(){return No(super.names,this.iteration.names)}}class zO extends fs{constructor(e,t,r,o){super();this.varKind=e,this.name=t,this.from=r,this.to=o}render(e){let t=e.es5?gr.varKinds.var:this.varKind,{name:r,from:o,to:n}=this;return`for(${t} ${r}=${o}; ${r}<${n}; ${r}++)`+super.render(e)}get names(){let e=km(super.names,this.from);return km(e,this.to)}}class bS extends fs{constructor(e,t,r,o){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=o}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=ms(this.iterable,e,t),this}get names(){return No(super.names,this.iterable.names)}}class vm extends Un{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}vm.kind="func";class Sm extends Em{render(e){return"return "+super.render(e)}}Sm.kind="return";class UO extends Un{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 r,o;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(o=this.finally)===null||o===void 0||o.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)No(e,this.catch.names);if(this.finally)No(e,this.finally.names);return e}}class xm extends Un{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}xm.kind="catch";class wm extends Un{render(e){return"finally"+super.render(e)}}wm.kind="finally";class LO{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
9
- `:""},this._extScope=e,this._scope=new gr.Scope({parent:e}),this._nodes=[new DO]}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 r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}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,r,o){let n=this._scope.toName(t);if(r!==void 0&&o)this._constants[n.str]=r;return this._leafNode(new $O(e,n,r)),n}const(e,t,r){return this._def(gr.varKinds.const,e,t,r)}let(e,t,r){return this._def(gr.varKinds.let,e,t,r)}var(e,t,r){return this._def(gr.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new vS(e,t,r))}add(e,t){return this._leafNode(new OO(e,It.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==le.nil)this._leafNode(new NO(e));return this}object(...e){let t=["{"];for(let[r,o]of e){if(t.length>1)t.push(",");if(t.push(r),r!==o||this.opts.es5)t.push(":"),(0,le.addCodeArg)(t,o)}return t.push("}"),new le._Code(t)}if(e,t,r){if(this._blockNode(new en(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new en(e))}else(){return this._elseNode(new Il)}endIf(){return this._endBlockNode(en,Il)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new jO(e),t)}forRange(e,t,r,o,n=this.opts.es5?gr.varKinds.var:gr.varKinds.let){let i=this._scope.toName(e);return this._for(new zO(n,i,t,r),()=>o(i))}forOf(e,t,r,o=gr.varKinds.const){let n=this._scope.toName(e);if(this.opts.es5){let i=t instanceof le.Name?t:this.var("_arr",t);return this.forRange("_i",0,le._`${i}.length`,(s)=>{this.var(n,le._`${i}[${s}]`),r(n)})}return this._for(new bS("of",o,n,t),()=>r(n))}forIn(e,t,r,o=this.opts.es5?gr.varKinds.var:gr.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,le._`Object.keys(${t})`,r);let n=this._scope.toName(e);return this._for(new bS("in",o,n,t),()=>r(n))}endFor(){return this._endBlockNode(fs)}label(e){return this._leafNode(new AO(e))}break(e){return this._leafNode(new CO(e))}return(e){let t=new Sm;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Sm)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new UO;if(this._blockNode(o),this.code(e),t){let n=this.name("e");this._currNode=o.catch=new xm(n),t(n)}if(r)this._currNode=o.finally=new wm,this.code(r);return this._endBlockNode(xm,wm)}throw(e){return this._leafNode(new MO(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 r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=le.nil,r,o){if(this._blockNode(new vm(e,t,r)),o)this.code(o).endFunc();return this}endFunc(){return this._endBlockNode(vm)}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 r=this._currNode;if(r instanceof e||t&&r 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 en))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}}It.CodeGen=LO;function No(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function km(e,t){return t instanceof le._CodeOrName?No(e,t.names):e}function ms(e,t,r){if(e instanceof le.Name)return o(e);if(!n(e))return e;return new le._Code(e._items.reduce((i,s)=>{if(s instanceof le.Name)s=o(s);if(s instanceof le._Code)i.push(...s._items);else i.push(s);return i},[]));function o(i){let s=r[i.str];if(s===void 0||t[i.str]!==1)return i;return delete t[i.str],s}function n(i){return i instanceof le._Code&&i._items.some((s)=>s instanceof le.Name&&t[s.str]===1&&r[s.str]!==void 0)}}function r9(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function FO(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:le._`!${_S(e)}`}It.not=FO;var n9=HO(It.operators.AND);function o9(...e){return e.reduce(n9)}It.and=o9;var i9=HO(It.operators.OR);function s9(...e){return e.reduce(i9)}It.or=s9;function HO(e){return(t,r)=>t===le.nil?r:r===le.nil?t:le._`${_S(t)} ${e} ${_S(r)}`}function _S(e){return e instanceof le.Name?e:le._`(${e})`}});var ue=k((XO)=>{Object.defineProperty(XO,"__esModule",{value:!0});XO.checkStrictMode=XO.getErrorPath=XO.Type=XO.useFunc=XO.setEvaluated=XO.evaluatedPropsToName=XO.mergeEvaluated=XO.eachItem=XO.unescapeJsonPointer=XO.escapeJsonPointer=XO.escapeFragment=XO.unescapeFragment=XO.schemaRefOrVal=XO.schemaHasRulesButRef=XO.schemaHasRules=XO.checkUnknownRules=XO.alwaysValidSchema=XO.toHash=void 0;var Ee=te(),u9=Pl();function d9(e){let t={};for(let r of e)t[r]=!0;return t}XO.toHash=d9;function p9(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return VO(e,t),!WO(t,e.self.RULES.all)}XO.alwaysValidSchema=p9;function VO(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let n=o.RULES.keywords;for(let i in t)if(!n[i])JO(e,`unknown keyword: "${i}"`)}XO.checkUnknownRules=VO;function WO(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}XO.schemaHasRules=WO;function f9(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}XO.schemaHasRulesButRef=f9;function m9({topSchemaRef:e,schemaPath:t},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return Ee._`${r}`}return Ee._`${e}${t}${(0,Ee.getProperty)(o)}`}XO.schemaRefOrVal=m9;function g9(e){return KO(decodeURIComponent(e))}XO.unescapeFragment=g9;function h9(e){return encodeURIComponent(xS(e))}XO.escapeFragment=h9;function xS(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}XO.escapeJsonPointer=xS;function KO(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}XO.unescapeJsonPointer=KO;function y9(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}XO.eachItem=y9;function qO({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:o}){return(n,i,s,a)=>{let c=s===void 0?i:s instanceof Ee.Name?(i instanceof Ee.Name?e(n,i,s):t(n,i,s),s):i instanceof Ee.Name?(t(n,s,i),i):r(i,s);return a===Ee.Name&&!(c instanceof Ee.Name)?o(n,c):c}}XO.mergeEvaluated={props:qO({mergeNames:(e,t,r)=>e.if(Ee._`${r} !== true && ${t} !== undefined`,()=>{e.if(Ee._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,Ee._`${r} || {}`).code(Ee._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(Ee._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,Ee._`${r} || {}`),wS(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:GO}),items:qO({mergeNames:(e,t,r)=>e.if(Ee._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,Ee._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(Ee._`${r} !== true`,()=>e.assign(r,t===!0?!0:Ee._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function GO(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",Ee._`{}`);if(t!==void 0)wS(e,r,t);return r}XO.evaluatedPropsToName=GO;function wS(e,t,r){Object.keys(r).forEach((o)=>e.assign(Ee._`${t}${(0,Ee.getProperty)(o)}`,!0))}XO.setEvaluated=wS;var ZO={};function b9(e,t){return e.scopeValue("func",{ref:t,code:ZO[t.code]||(ZO[t.code]=new u9._Code(t.code))})}XO.useFunc=b9;var SS;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(SS||(XO.Type=SS={}));function _9(e,t,r){if(e instanceof Ee.Name){let o=t===SS.Num;return r?o?Ee._`"[" + ${e} + "]"`:Ee._`"['" + ${e} + "']"`:o?Ee._`"/" + ${e}`:Ee._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Ee.getProperty)(e).toString():"/"+xS(e)}XO.getErrorPath=_9;function JO(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}XO.checkStrictMode=JO});var tn=k((QO)=>{Object.defineProperty(QO,"__esModule",{value:!0});var ut=te(),j9={data:new ut.Name("data"),valCxt:new ut.Name("valCxt"),instancePath:new ut.Name("instancePath"),parentData:new ut.Name("parentData"),parentDataProperty:new ut.Name("parentDataProperty"),rootData:new ut.Name("rootData"),dynamicAnchors:new ut.Name("dynamicAnchors"),vErrors:new ut.Name("vErrors"),errors:new ut.Name("errors"),this:new ut.Name("this"),self:new ut.Name("self"),scope:new ut.Name("scope"),json:new ut.Name("json"),jsonPos:new ut.Name("jsonPos"),jsonLen:new ut.Name("jsonLen"),jsonPart:new ut.Name("jsonPart")};QO.default=j9});var Rl=k((nA)=>{Object.defineProperty(nA,"__esModule",{value:!0});nA.extendErrors=nA.resetErrorsCount=nA.reportExtraError=nA.reportError=nA.keyword$DataError=nA.keywordError=void 0;var de=te(),Im=ue(),ht=tn();nA.keywordError={message:({keyword:e})=>de.str`must pass "${e}" keyword validation`};nA.keyword$DataError={message:({keyword:e,schemaType:t})=>t?de.str`"${e}" keyword must be ${t} ($data)`:de.str`"${e}" keyword is invalid ($data)`};function U9(e,t=nA.keywordError,r,o){let{it:n}=e,{gen:i,compositeRule:s,allErrors:a}=n,c=rA(e,t,r);if(o!==null&&o!==void 0?o:s||a)eA(i,c);else tA(n,de._`[${c}]`)}nA.reportError=U9;function L9(e,t=nA.keywordError,r){let{it:o}=e,{gen:n,compositeRule:i,allErrors:s}=o,a=rA(e,t,r);if(eA(n,a),!(i||s))tA(o,ht.default.vErrors)}nA.reportExtraError=L9;function F9(e,t){e.assign(ht.default.errors,t),e.if(de._`${ht.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(de._`${ht.default.vErrors}.length`,t),()=>e.assign(ht.default.vErrors,null)))}nA.resetErrorsCount=F9;function H9({gen:e,keyword:t,schemaValue:r,data:o,errsCount:n,it:i}){if(n===void 0)throw Error("ajv implementation error");let s=e.name("err");e.forRange("i",n,ht.default.errors,(a)=>{if(e.const(s,de._`${ht.default.vErrors}[${a}]`),e.if(de._`${s}.instancePath === undefined`,()=>e.assign(de._`${s}.instancePath`,(0,de.strConcat)(ht.default.instancePath,i.errorPath))),e.assign(de._`${s}.schemaPath`,de.str`${i.errSchemaPath}/${t}`),i.opts.verbose)e.assign(de._`${s}.schema`,r),e.assign(de._`${s}.data`,o)})}nA.extendErrors=H9;function eA(e,t){let r=e.const("err",t);e.if(de._`${ht.default.vErrors} === null`,()=>e.assign(ht.default.vErrors,de._`[${r}]`),de._`${ht.default.vErrors}.push(${r})`),e.code(de._`${ht.default.errors}++`)}function tA(e,t){let{gen:r,validateName:o,schemaEnv:n}=e;if(n.$async)r.throw(de._`new ${e.ValidationError}(${t})`);else r.assign(de._`${o}.errors`,t),r.return(!1)}var Do={keyword:new de.Name("keyword"),schemaPath:new de.Name("schemaPath"),params:new de.Name("params"),propertyName:new de.Name("propertyName"),message:new de.Name("message"),schema:new de.Name("schema"),parentSchema:new de.Name("parentSchema")};function rA(e,t,r){let{createErrors:o}=e.it;if(o===!1)return de._`{}`;return B9(e,t,r)}function B9(e,t,r={}){let{gen:o,it:n}=e,i=[q9(n,r),Z9(e,r)];return V9(e,t,i),o.object(...i)}function q9({errorPath:e},{instancePath:t}){let r=t?de.str`${e}${(0,Im.getErrorPath)(t,Im.Type.Str)}`:e;return[ht.default.instancePath,(0,de.strConcat)(ht.default.instancePath,r)]}function Z9({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let n=o?t:de.str`${t}/${e}`;if(r)n=de.str`${n}${(0,Im.getErrorPath)(r,Im.Type.Str)}`;return[Do.schemaPath,n]}function V9(e,{params:t,message:r},o){let{keyword:n,data:i,schemaValue:s,it:a}=e,{opts:c,propertyName:u,topSchemaRef:d,schemaPath:p}=a;if(o.push([Do.keyword,n],[Do.params,typeof t=="function"?t(e):t||de._`{}`]),c.messages)o.push([Do.message,typeof r=="function"?r(e):r]);if(c.verbose)o.push([Do.schema,s],[Do.parentSchema,de._`${d}${p}`],[ht.default.data,i]);if(u)o.push([Do.propertyName,u])}});var cA=k((sA)=>{Object.defineProperty(sA,"__esModule",{value:!0});sA.boolOrEmptySchema=sA.topBoolOrEmptySchema=void 0;var X9=Rl(),Y9=te(),Q9=tn(),eJ={message:"boolean schema is false"};function tJ(e){let{gen:t,schema:r,validateName:o}=e;if(r===!1)iA(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(Q9.default.data);else t.assign(Y9._`${o}.errors`,null),t.return(!0)}sA.topBoolOrEmptySchema=tJ;function rJ(e,t){let{gen:r,schema:o}=e;if(o===!1)r.var(t,!1),iA(e);else r.var(t,!0)}sA.boolOrEmptySchema=rJ;function iA(e,t){let{gen:r,data:o}=e,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,X9.reportError)(n,eJ,void 0,t)}});var TS=k((lA)=>{Object.defineProperty(lA,"__esModule",{value:!0});lA.getRules=lA.isJSONType=void 0;var oJ=["string","number","integer","boolean","null","object","array"],iJ=new Set(oJ);function sJ(e){return typeof e=="string"&&iJ.has(e)}lA.isJSONType=sJ;function aJ(){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:{}}}lA.getRules=aJ});var ES=k((fA)=>{Object.defineProperty(fA,"__esModule",{value:!0});fA.shouldUseRule=fA.shouldUseGroup=fA.schemaHasRulesForType=void 0;function lJ({schema:e,self:t},r){let o=t.RULES.types[r];return o&&o!==!0&&dA(e,o)}fA.schemaHasRulesForType=lJ;function dA(e,t){return t.rules.some((r)=>pA(e,r))}fA.shouldUseGroup=dA;function pA(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some((o)=>e[o]!==void 0))}fA.shouldUseRule=pA});var $l=k((bA)=>{Object.defineProperty(bA,"__esModule",{value:!0});bA.reportTypeError=bA.checkDataTypes=bA.checkDataType=bA.coerceAndCheckDataType=bA.getJSONTypes=bA.getSchemaTypes=bA.DataType=void 0;var pJ=TS(),fJ=ES(),mJ=Rl(),ee=te(),gA=ue(),gs;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(gs||(bA.DataType=gs={}));function gJ(e){let t=hA(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}bA.getSchemaTypes=gJ;function hA(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(pJ.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}bA.getJSONTypes=hA;function hJ(e,t){let{gen:r,data:o,opts:n}=e,i=yJ(t,n.coerceTypes),s=t.length>0&&!(i.length===0&&t.length===1&&(0,fJ.schemaHasRulesForType)(e,t[0]));if(s){let a=IS(t,o,n.strictNumbers,gs.Wrong);r.if(a,()=>{if(i.length)bJ(e,t,i);else RS(e)})}return s}bA.coerceAndCheckDataType=hJ;var yA=new Set(["string","number","integer","boolean","null"]);function yJ(e,t){return t?e.filter((r)=>yA.has(r)||t==="array"&&r==="array"):[]}function bJ(e,t,r){let{gen:o,data:n,opts:i}=e,s=o.let("dataType",ee._`typeof ${n}`),a=o.let("coerced",ee._`undefined`);if(i.coerceTypes==="array")o.if(ee._`${s} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,ee._`${n}[0]`).assign(s,ee._`typeof ${n}`).if(IS(t,n,i.strictNumbers),()=>o.assign(a,n)));o.if(ee._`${a} !== undefined`);for(let u of r)if(yA.has(u)||u==="array"&&i.coerceTypes==="array")c(u);o.else(),RS(e),o.endIf(),o.if(ee._`${a} !== undefined`,()=>{o.assign(n,a),_J(e,a)});function c(u){switch(u){case"string":o.elseIf(ee._`${s} == "number" || ${s} == "boolean"`).assign(a,ee._`"" + ${n}`).elseIf(ee._`${n} === null`).assign(a,ee._`""`);return;case"number":o.elseIf(ee._`${s} == "boolean" || ${n} === null
8
+ import{createRequire as _U}from"node:module";var uU=Object.create;var{getPrototypeOf:dU,defineProperty:xg,getOwnPropertyNames:pU}=Object;var fU=Object.prototype.hasOwnProperty;function mU(e){return this[e]}var gU,hU,wg=(e,t,r)=>{var o=e!=null&&typeof e==="object";if(o){var n=t?gU??=new WeakMap:hU??=new WeakMap,i=n.get(e);if(i)return i}r=e!=null?uU(dU(e)):{};let s=t||!e||!e.__esModule?xg(r,"default",{value:e,enumerable:!0}):r;for(let a of pU(e))if(!fU.call(s,a))xg(s,a,{get:mU.bind(e,a),enumerable:!0});if(o)n.set(e,s);return s};var k=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var yU=(e)=>e;function bU(e,t){this[e]=yU.bind(null,t)}var wr=(e,t)=>{for(var r in t)xg(e,r,{get:t[r],enumerable:!0,configurable:!0,set:bU.bind(t,r)})};var At=_U(import.meta.url),vU=Symbol.dispose||Symbol.for("Symbol.dispose"),SU=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),_e=(e,t,r)=>{if(t!=null){if(typeof t!=="object"&&typeof t!=="function")throw TypeError('Object expected to be assigned to "using" declaration');var o;if(r)o=t[SU];if(o===void 0)o=t[vU];if(typeof o!=="function")throw TypeError("Object not disposable");e.push([r,o,t])}else if(r)e.push([r]);return t},ve=(e,t,r)=>{var o=typeof SuppressedError==="function"?SuppressedError:function(s,a,c,u){return u=Error(c),u.name="SuppressedError",u.error=s,u.suppressed=a,u},n=(s)=>t=r?new o(s,t,"An error was suppressed during disposal"):(r=!0,s),i=(s)=>{while(s=e.pop())try{var a=s[1]&&s[1].call(s[2]);if(s[0])return Promise.resolve(a).then(i,(c)=>(n(c),i()))}catch(c){n(c)}if(r)throw t};return i()};var CT=k((OT)=>{Object.defineProperty(OT,"__esModule",{value:!0});OT._globalThis=void 0;OT._globalThis=typeof globalThis==="object"?globalThis:global});var MT=k((yo)=>{var lH=yo&&yo.__createBinding||(Object.create?function(e,t,r,o){if(o===void 0)o=r;Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,o){if(o===void 0)o=r;e[o]=t[r]}),uH=yo&&yo.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r))lH(t,e,r)};Object.defineProperty(yo,"__esModule",{value:!0});uH(CT(),yo)});var NT=k((bo)=>{var dH=bo&&bo.__createBinding||(Object.create?function(e,t,r,o){if(o===void 0)o=r;Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,o){if(o===void 0)o=r;e[o]=t[r]}),pH=bo&&bo.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r))dH(t,e,r)};Object.defineProperty(bo,"__esModule",{value:!0});pH(MT(),bo)});var Nh=k((DT)=>{Object.defineProperty(DT,"__esModule",{value:!0});DT.VERSION=void 0;DT.VERSION="1.9.0"});var HT=k((LT)=>{Object.defineProperty(LT,"__esModule",{value:!0});LT.isCompatible=LT._makeCompatibilityCheck=void 0;var fH=Nh(),zT=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function UT(e){let t=new Set([e]),r=new Set,o=e.match(zT);if(!o)return()=>!1;let n={major:+o[1],minor:+o[2],patch:+o[3],prerelease:o[4]};if(n.prerelease!=null)return function(c){return c===e};function i(a){return r.add(a),!1}function s(a){return t.add(a),!0}return function(c){if(t.has(c))return!0;if(r.has(c))return!1;let u=c.match(zT);if(!u)return i(c);let d={major:+u[1],minor:+u[2],patch:+u[3],prerelease:u[4]};if(d.prerelease!=null)return i(c);if(n.major!==d.major)return i(c);if(n.major===0){if(n.minor===d.minor&&n.patch<=d.patch)return s(c);return i(c)}if(n.minor<=d.minor)return s(c);return i(c)}}LT._makeCompatibilityCheck=UT;LT.isCompatible=UT(fH.VERSION)});var _o=k((BT)=>{Object.defineProperty(BT,"__esModule",{value:!0});BT.unregisterGlobal=BT.getGlobal=BT.registerGlobal=void 0;var gH=NT(),Ii=Nh(),hH=HT(),yH=Ii.VERSION.split(".")[0],Ba=Symbol.for(`opentelemetry.js.api.${yH}`),qa=gH._globalThis;function bH(e,t,r,o=!1){var n;let i=qa[Ba]=(n=qa[Ba])!==null&&n!==void 0?n:{version:Ii.VERSION};if(!o&&i[e]){let s=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(s.stack||s.message),!1}if(i.version!==Ii.VERSION){let s=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${Ii.VERSION}`);return r.error(s.stack||s.message),!1}return i[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${Ii.VERSION}.`),!0}BT.registerGlobal=bH;function _H(e){var t,r;let o=(t=qa[Ba])===null||t===void 0?void 0:t.version;if(!o||!(0,hH.isCompatible)(o))return;return(r=qa[Ba])===null||r===void 0?void 0:r[e]}BT.getGlobal=_H;function vH(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${Ii.VERSION}.`);let r=qa[Ba];if(r)delete r[e]}BT.unregisterGlobal=vH});var KT=k((VT)=>{Object.defineProperty(VT,"__esModule",{value:!0});VT.DiagComponentLogger=void 0;var wH=_o();class ZT{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return Za("debug",this._namespace,e)}error(...e){return Za("error",this._namespace,e)}info(...e){return Za("info",this._namespace,e)}warn(...e){return Za("warn",this._namespace,e)}verbose(...e){return Za("verbose",this._namespace,e)}}VT.DiagComponentLogger=ZT;function Za(e,t,r){let o=(0,wH.getGlobal)("diag");if(!o)return;return r.unshift(t),o[e](...r)}});var vd=k((GT)=>{Object.defineProperty(GT,"__esModule",{value:!0});GT.DiagLogLevel=void 0;var kH;(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"})(kH=GT.DiagLogLevel||(GT.DiagLogLevel={}))});var YT=k((JT)=>{Object.defineProperty(JT,"__esModule",{value:!0});JT.createLogLevelDiagLogger=void 0;var Fr=vd();function EH(e,t){if(e<Fr.DiagLogLevel.NONE)e=Fr.DiagLogLevel.NONE;else if(e>Fr.DiagLogLevel.ALL)e=Fr.DiagLogLevel.ALL;t=t||{};function r(o,n){let i=t[o];if(typeof i==="function"&&e>=n)return i.bind(t);return function(){}}return{error:r("error",Fr.DiagLogLevel.ERROR),warn:r("warn",Fr.DiagLogLevel.WARN),info:r("info",Fr.DiagLogLevel.INFO),debug:r("debug",Fr.DiagLogLevel.DEBUG),verbose:r("verbose",Fr.DiagLogLevel.VERBOSE)}}JT.createLogLevelDiagLogger=EH});var vo=k((eP)=>{Object.defineProperty(eP,"__esModule",{value:!0});eP.DiagAPI=void 0;var TH=KT(),PH=YT(),QT=vd(),Sd=_o(),IH="diag";class jh{constructor(){function e(o){return function(...n){let i=(0,Sd.getGlobal)("diag");if(!i)return;return i[o](...n)}}let t=this,r=(o,n={logLevel:QT.DiagLogLevel.INFO})=>{var i,s,a;if(o===t){let d=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error((i=d.stack)!==null&&i!==void 0?i:d.message),!1}if(typeof n==="number")n={logLevel:n};let c=(0,Sd.getGlobal)("diag"),u=(0,PH.createLogLevelDiagLogger)((s=n.logLevel)!==null&&s!==void 0?s:QT.DiagLogLevel.INFO,o);if(c&&!n.suppressOverrideMessage){let d=(a=Error().stack)!==null&&a!==void 0?a:"<failed to generate stacktrace>";c.warn(`Current logger will be overwritten from ${d}`),u.warn(`Current logger will overwrite one already registered from ${d}`)}return(0,Sd.registerGlobal)("diag",u,t,!0)};t.setLogger=r,t.disable=()=>{(0,Sd.unregisterGlobal)(IH,t)},t.createComponentLogger=(o)=>{return new TH.DiagComponentLogger(o)},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 jh;return this._instance}}eP.DiagAPI=jh});var oP=k((rP)=>{Object.defineProperty(rP,"__esModule",{value:!0});rP.BaggageImpl=void 0;class Ri{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 r=new Ri(this._entries);return r._entries.set(e,t),r}removeEntry(e){let t=new Ri(this._entries);return t._entries.delete(e),t}removeEntries(...e){let t=new Ri(this._entries);for(let r of e)t._entries.delete(r);return t}clear(){return new Ri}}rP.BaggageImpl=Ri});var aP=k((iP)=>{Object.defineProperty(iP,"__esModule",{value:!0});iP.baggageEntryMetadataSymbol=void 0;iP.baggageEntryMetadataSymbol=Symbol("BaggageEntryMetadata")});var zh=k((cP)=>{Object.defineProperty(cP,"__esModule",{value:!0});cP.baggageEntryMetadataFromString=cP.createBaggage=void 0;var RH=vo(),$H=oP(),OH=aP(),AH=RH.DiagAPI.instance();function CH(e={}){return new $H.BaggageImpl(new Map(Object.entries(e)))}cP.createBaggage=CH;function MH(e){if(typeof e!=="string")AH.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e="";return{__TYPE__:OH.baggageEntryMetadataSymbol,toString(){return e}}}cP.baggageEntryMetadataFromString=MH});var Va=k((uP)=>{Object.defineProperty(uP,"__esModule",{value:!0});uP.ROOT_CONTEXT=uP.createContextKey=void 0;function DH(e){return Symbol.for(e)}uP.createContextKey=DH;class xd{constructor(e){let t=this;t._currentContext=e?new Map(e):new Map,t.getValue=(r)=>t._currentContext.get(r),t.setValue=(r,o)=>{let n=new xd(t._currentContext);return n._currentContext.set(r,o),n},t.deleteValue=(r)=>{let o=new xd(t._currentContext);return o._currentContext.delete(r),o}}}uP.ROOT_CONTEXT=new xd});var gP=k((fP)=>{Object.defineProperty(fP,"__esModule",{value:!0});fP.DiagConsoleLogger=void 0;var Uh=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}];class pP{constructor(){function e(t){return function(...r){if(console){let o=console[t];if(typeof o!=="function")o=console.log;if(typeof o==="function")return o.apply(console,r)}}}for(let t=0;t<Uh.length;t++)this[Uh[t].n]=e(Uh[t].c)}}fP.DiagConsoleLogger=pP});var Kh=k((hP)=>{Object.defineProperty(hP,"__esModule",{value:!0});hP.createNoopMeter=hP.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=hP.NOOP_OBSERVABLE_GAUGE_METRIC=hP.NOOP_OBSERVABLE_COUNTER_METRIC=hP.NOOP_UP_DOWN_COUNTER_METRIC=hP.NOOP_HISTOGRAM_METRIC=hP.NOOP_GAUGE_METRIC=hP.NOOP_COUNTER_METRIC=hP.NOOP_METER=hP.NoopObservableUpDownCounterMetric=hP.NoopObservableGaugeMetric=hP.NoopObservableCounterMetric=hP.NoopObservableMetric=hP.NoopHistogramMetric=hP.NoopGaugeMetric=hP.NoopUpDownCounterMetric=hP.NoopCounterMetric=hP.NoopMetric=hP.NoopMeter=void 0;class Lh{constructor(){}createGauge(e,t){return hP.NOOP_GAUGE_METRIC}createHistogram(e,t){return hP.NOOP_HISTOGRAM_METRIC}createCounter(e,t){return hP.NOOP_COUNTER_METRIC}createUpDownCounter(e,t){return hP.NOOP_UP_DOWN_COUNTER_METRIC}createObservableGauge(e,t){return hP.NOOP_OBSERVABLE_GAUGE_METRIC}createObservableCounter(e,t){return hP.NOOP_OBSERVABLE_COUNTER_METRIC}createObservableUpDownCounter(e,t){return hP.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}}hP.NoopMeter=Lh;class $i{}hP.NoopMetric=$i;class Fh extends $i{add(e,t){}}hP.NoopCounterMetric=Fh;class Hh extends $i{add(e,t){}}hP.NoopUpDownCounterMetric=Hh;class Bh extends $i{record(e,t){}}hP.NoopGaugeMetric=Bh;class qh extends $i{record(e,t){}}hP.NoopHistogramMetric=qh;class Wa{addCallback(e){}removeCallback(e){}}hP.NoopObservableMetric=Wa;class Zh extends Wa{}hP.NoopObservableCounterMetric=Zh;class Vh extends Wa{}hP.NoopObservableGaugeMetric=Vh;class Wh extends Wa{}hP.NoopObservableUpDownCounterMetric=Wh;hP.NOOP_METER=new Lh;hP.NOOP_COUNTER_METRIC=new Fh;hP.NOOP_GAUGE_METRIC=new Bh;hP.NOOP_HISTOGRAM_METRIC=new qh;hP.NOOP_UP_DOWN_COUNTER_METRIC=new Hh;hP.NOOP_OBSERVABLE_COUNTER_METRIC=new Zh;hP.NOOP_OBSERVABLE_GAUGE_METRIC=new Vh;hP.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=new Wh;function zH(){return hP.NOOP_METER}hP.createNoopMeter=zH});var PP=k((TP)=>{Object.defineProperty(TP,"__esModule",{value:!0});TP.ValueType=void 0;var GH;(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(GH=TP.ValueType||(TP.ValueType={}))});var Jh=k((IP)=>{Object.defineProperty(IP,"__esModule",{value:!0});IP.defaultTextMapSetter=IP.defaultTextMapGetter=void 0;IP.defaultTextMapGetter={get(e,t){if(e==null)return;return e[t]},keys(e){if(e==null)return[];return Object.keys(e)}};IP.defaultTextMapSetter={set(e,t,r){if(e==null)return;e[t]=r}}});var CP=k((OP)=>{Object.defineProperty(OP,"__esModule",{value:!0});OP.NoopContextManager=void 0;var XH=Va();class $P{active(){return XH.ROOT_CONTEXT}with(e,t,r,...o){return t.call(r,...o)}bind(e,t){return t}enable(){return this}disable(){return this}}OP.NoopContextManager=$P});var Ka=k((NP)=>{Object.defineProperty(NP,"__esModule",{value:!0});NP.ContextAPI=void 0;var YH=CP(),Xh=_o(),MP=vo(),Yh="context",QH=new YH.NoopContextManager;class Qh{constructor(){}static getInstance(){if(!this._instance)this._instance=new Qh;return this._instance}setGlobalContextManager(e){return(0,Xh.registerGlobal)(Yh,e,MP.DiagAPI.instance())}active(){return this._getContextManager().active()}with(e,t,r,...o){return this._getContextManager().with(e,t,r,...o)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return(0,Xh.getGlobal)(Yh)||QH}disable(){this._getContextManager().disable(),(0,Xh.unregisterGlobal)(Yh,MP.DiagAPI.instance())}}NP.ContextAPI=Qh});var ty=k((jP)=>{Object.defineProperty(jP,"__esModule",{value:!0});jP.TraceFlags=void 0;var eB;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(eB=jP.TraceFlags||(jP.TraceFlags={}))});var wd=k((zP)=>{Object.defineProperty(zP,"__esModule",{value:!0});zP.INVALID_SPAN_CONTEXT=zP.INVALID_TRACEID=zP.INVALID_SPANID=void 0;var tB=ty();zP.INVALID_SPANID="0000000000000000";zP.INVALID_TRACEID="00000000000000000000000000000000";zP.INVALID_SPAN_CONTEXT={traceId:zP.INVALID_TRACEID,spanId:zP.INVALID_SPANID,traceFlags:tB.TraceFlags.NONE}});var kd=k((BP)=>{Object.defineProperty(BP,"__esModule",{value:!0});BP.NonRecordingSpan=void 0;var rB=wd();class HP{constructor(e=rB.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){}}BP.NonRecordingSpan=HP});var oy=k((VP)=>{Object.defineProperty(VP,"__esModule",{value:!0});VP.getSpanContext=VP.setSpanContext=VP.deleteSpan=VP.setSpan=VP.getActiveSpan=VP.getSpan=void 0;var nB=Va(),oB=kd(),iB=Ka(),ry=(0,nB.createContextKey)("OpenTelemetry Context Key SPAN");function ny(e){return e.getValue(ry)||void 0}VP.getSpan=ny;function sB(){return ny(iB.ContextAPI.getInstance().active())}VP.getActiveSpan=sB;function ZP(e,t){return e.setValue(ry,t)}VP.setSpan=ZP;function aB(e){return e.deleteValue(ry)}VP.deleteSpan=aB;function cB(e,t){return ZP(e,new oB.NonRecordingSpan(t))}VP.setSpanContext=cB;function lB(e){var t;return(t=ny(e))===null||t===void 0?void 0:t.spanContext()}VP.getSpanContext=lB});var Ed=k((XP)=>{Object.defineProperty(XP,"__esModule",{value:!0});XP.wrapSpanContext=XP.isSpanContextValid=XP.isValidSpanId=XP.isValidTraceId=void 0;var KP=wd(),gB=kd(),hB=/^([0-9a-f]{32})$/i,yB=/^[0-9a-f]{16}$/i;function GP(e){return hB.test(e)&&e!==KP.INVALID_TRACEID}XP.isValidTraceId=GP;function JP(e){return yB.test(e)&&e!==KP.INVALID_SPANID}XP.isValidSpanId=JP;function bB(e){return GP(e.traceId)&&JP(e.spanId)}XP.isSpanContextValid=bB;function _B(e){return new gB.NonRecordingSpan(e)}XP.wrapSpanContext=_B});var ay=k((tI)=>{Object.defineProperty(tI,"__esModule",{value:!0});tI.NoopTracer=void 0;var wB=Ka(),QP=oy(),iy=kd(),kB=Ed(),sy=wB.ContextAPI.getInstance();class eI{startSpan(e,t,r=sy.active()){if(Boolean(t===null||t===void 0?void 0:t.root))return new iy.NonRecordingSpan;let n=r&&(0,QP.getSpanContext)(r);if(EB(n)&&(0,kB.isSpanContextValid)(n))return new iy.NonRecordingSpan(n);else return new iy.NonRecordingSpan}startActiveSpan(e,t,r,o){let n,i,s;if(arguments.length<2)return;else if(arguments.length===2)s=t;else if(arguments.length===3)n=t,s=r;else n=t,i=r,s=o;let a=i!==null&&i!==void 0?i:sy.active(),c=this.startSpan(e,n,a),u=(0,QP.setSpan)(a,c);return sy.with(u,s,void 0,c)}}tI.NoopTracer=eI;function EB(e){return typeof e==="object"&&typeof e.spanId==="string"&&typeof e.traceId==="string"&&typeof e.traceFlags==="number"}});var cy=k((oI)=>{Object.defineProperty(oI,"__esModule",{value:!0});oI.ProxyTracer=void 0;var TB=ay(),PB=new TB.NoopTracer;class nI{constructor(e,t,r,o){this._provider=e,this.name=t,this.version=r,this.options=o}startSpan(e,t,r){return this._getTracer().startSpan(e,t,r)}startActiveSpan(e,t,r,o){let n=this._getTracer();return Reflect.apply(n.startActiveSpan,n,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);if(!e)return PB;return this._delegate=e,this._delegate}}oI.ProxyTracer=nI});var lI=k((aI)=>{Object.defineProperty(aI,"__esModule",{value:!0});aI.NoopTracerProvider=void 0;var IB=ay();class sI{getTracer(e,t,r){return new IB.NoopTracer}}aI.NoopTracerProvider=sI});var ly=k((dI)=>{Object.defineProperty(dI,"__esModule",{value:!0});dI.ProxyTracerProvider=void 0;var RB=cy(),$B=lI(),OB=new $B.NoopTracerProvider;class uI{getTracer(e,t,r){var o;return(o=this.getDelegateTracer(e,t,r))!==null&&o!==void 0?o:new RB.ProxyTracer(this,e,t,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:OB}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(e,t,r)}}dI.ProxyTracerProvider=uI});var mI=k((fI)=>{Object.defineProperty(fI,"__esModule",{value:!0});fI.SamplingDecision=void 0;var AB;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(AB=fI.SamplingDecision||(fI.SamplingDecision={}))});var hI=k((gI)=>{Object.defineProperty(gI,"__esModule",{value:!0});gI.SpanKind=void 0;var CB;(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"})(CB=gI.SpanKind||(gI.SpanKind={}))});var bI=k((yI)=>{Object.defineProperty(yI,"__esModule",{value:!0});yI.SpanStatusCode=void 0;var MB;(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(MB=yI.SpanStatusCode||(yI.SpanStatusCode={}))});var SI=k((_I)=>{Object.defineProperty(_I,"__esModule",{value:!0});_I.validateValue=_I.validateKey=void 0;var fy="[_0-9a-z-*/]",NB=`[a-z]${fy}{0,255}`,DB=`[a-z0-9]${fy}{0,240}@[a-z]${fy}{0,13}`,jB=new RegExp(`^(?:${NB}|${DB})$`),zB=/^[ -~]{0,255}[!-~]$/,UB=/,|=/;function LB(e){return jB.test(e)}_I.validateKey=LB;function FB(e){return zB.test(e)&&!UB.test(e)}_I.validateValue=FB});var II=k((TI)=>{Object.defineProperty(TI,"__esModule",{value:!0});TI.TraceStateImpl=void 0;var xI=SI(),wI=32,BB=512,kI=",",EI="=";class my{constructor(e){if(this._internalState=new Map,e)this._parse(e)}set(e,t){let r=this._clone();if(r._internalState.has(e))r._internalState.delete(e);return r._internalState.set(e,t),r}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)=>{return e.push(t+EI+this.get(t)),e},[]).join(kI)}_parse(e){if(e.length>BB)return;if(this._internalState=e.split(kI).reverse().reduce((t,r)=>{let o=r.trim(),n=o.indexOf(EI);if(n!==-1){let i=o.slice(0,n),s=o.slice(n+1,r.length);if((0,xI.validateKey)(i)&&(0,xI.validateValue)(s))t.set(i,s)}return t},new Map),this._internalState.size>wI)this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,wI))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new my;return e._internalState=new Map(this._internalState),e}}TI.TraceStateImpl=my});var OI=k((RI)=>{Object.defineProperty(RI,"__esModule",{value:!0});RI.createTraceState=void 0;var qB=II();function ZB(e){return new qB.TraceStateImpl(e)}RI.createTraceState=ZB});var MI=k((AI)=>{Object.defineProperty(AI,"__esModule",{value:!0});AI.context=void 0;var VB=Ka();AI.context=VB.ContextAPI.getInstance()});var jI=k((NI)=>{Object.defineProperty(NI,"__esModule",{value:!0});NI.diag=void 0;var WB=vo();NI.diag=WB.DiagAPI.instance()});var LI=k((zI)=>{Object.defineProperty(zI,"__esModule",{value:!0});zI.NOOP_METER_PROVIDER=zI.NoopMeterProvider=void 0;var KB=Kh();class gy{getMeter(e,t,r){return KB.NOOP_METER}}zI.NoopMeterProvider=gy;zI.NOOP_METER_PROVIDER=new gy});var qI=k((HI)=>{Object.defineProperty(HI,"__esModule",{value:!0});HI.MetricsAPI=void 0;var JB=LI(),hy=_o(),FI=vo(),yy="metrics";class by{constructor(){}static getInstance(){if(!this._instance)this._instance=new by;return this._instance}setGlobalMeterProvider(e){return(0,hy.registerGlobal)(yy,e,FI.DiagAPI.instance())}getMeterProvider(){return(0,hy.getGlobal)(yy)||JB.NOOP_METER_PROVIDER}getMeter(e,t,r){return this.getMeterProvider().getMeter(e,t,r)}disable(){(0,hy.unregisterGlobal)(yy,FI.DiagAPI.instance())}}HI.MetricsAPI=by});var WI=k((ZI)=>{Object.defineProperty(ZI,"__esModule",{value:!0});ZI.metrics=void 0;var XB=qI();ZI.metrics=XB.MetricsAPI.getInstance()});var XI=k((GI)=>{Object.defineProperty(GI,"__esModule",{value:!0});GI.NoopTextMapPropagator=void 0;class KI{inject(e,t){}extract(e,t){return e}fields(){return[]}}GI.NoopTextMapPropagator=KI});var tR=k((QI)=>{Object.defineProperty(QI,"__esModule",{value:!0});QI.deleteBaggage=QI.setBaggage=QI.getActiveBaggage=QI.getBaggage=void 0;var YB=Ka(),QB=Va(),_y=(0,QB.createContextKey)("OpenTelemetry Baggage Key");function YI(e){return e.getValue(_y)||void 0}QI.getBaggage=YI;function eq(){return YI(YB.ContextAPI.getInstance().active())}QI.getActiveBaggage=eq;function tq(e,t){return e.setValue(_y,t)}QI.setBaggage=tq;function rq(e){return e.deleteValue(_y)}QI.deleteBaggage=rq});var sR=k((oR)=>{Object.defineProperty(oR,"__esModule",{value:!0});oR.PropagationAPI=void 0;var vy=_o(),sq=XI(),rR=Jh(),Td=tR(),aq=zh(),nR=vo(),Sy="propagation",cq=new sq.NoopTextMapPropagator;class xy{constructor(){this.createBaggage=aq.createBaggage,this.getBaggage=Td.getBaggage,this.getActiveBaggage=Td.getActiveBaggage,this.setBaggage=Td.setBaggage,this.deleteBaggage=Td.deleteBaggage}static getInstance(){if(!this._instance)this._instance=new xy;return this._instance}setGlobalPropagator(e){return(0,vy.registerGlobal)(Sy,e,nR.DiagAPI.instance())}inject(e,t,r=rR.defaultTextMapSetter){return this._getGlobalPropagator().inject(e,t,r)}extract(e,t,r=rR.defaultTextMapGetter){return this._getGlobalPropagator().extract(e,t,r)}fields(){return this._getGlobalPropagator().fields()}disable(){(0,vy.unregisterGlobal)(Sy,nR.DiagAPI.instance())}_getGlobalPropagator(){return(0,vy.getGlobal)(Sy)||cq}}oR.PropagationAPI=xy});var lR=k((aR)=>{Object.defineProperty(aR,"__esModule",{value:!0});aR.propagation=void 0;var lq=sR();aR.propagation=lq.PropagationAPI.getInstance()});var gR=k((fR)=>{Object.defineProperty(fR,"__esModule",{value:!0});fR.TraceAPI=void 0;var wy=_o(),uR=ly(),dR=Ed(),Oi=oy(),pR=vo(),ky="trace";class Ey{constructor(){this._proxyTracerProvider=new uR.ProxyTracerProvider,this.wrapSpanContext=dR.wrapSpanContext,this.isSpanContextValid=dR.isSpanContextValid,this.deleteSpan=Oi.deleteSpan,this.getSpan=Oi.getSpan,this.getActiveSpan=Oi.getActiveSpan,this.getSpanContext=Oi.getSpanContext,this.setSpan=Oi.setSpan,this.setSpanContext=Oi.setSpanContext}static getInstance(){if(!this._instance)this._instance=new Ey;return this._instance}setGlobalTracerProvider(e){let t=(0,wy.registerGlobal)(ky,this._proxyTracerProvider,pR.DiagAPI.instance());if(t)this._proxyTracerProvider.setDelegate(e);return t}getTracerProvider(){return(0,wy.getGlobal)(ky)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){(0,wy.unregisterGlobal)(ky,pR.DiagAPI.instance()),this._proxyTracerProvider=new uR.ProxyTracerProvider}}fR.TraceAPI=Ey});var bR=k((hR)=>{Object.defineProperty(hR,"__esModule",{value:!0});hR.trace=void 0;var uq=gR();hR.trace=uq.TraceAPI.getInstance()});var TR=k((be)=>{Object.defineProperty(be,"__esModule",{value:!0});be.trace=be.propagation=be.metrics=be.diag=be.context=be.INVALID_SPAN_CONTEXT=be.INVALID_TRACEID=be.INVALID_SPANID=be.isValidSpanId=be.isValidTraceId=be.isSpanContextValid=be.createTraceState=be.TraceFlags=be.SpanStatusCode=be.SpanKind=be.SamplingDecision=be.ProxyTracerProvider=be.ProxyTracer=be.defaultTextMapSetter=be.defaultTextMapGetter=be.ValueType=be.createNoopMeter=be.DiagLogLevel=be.DiagConsoleLogger=be.ROOT_CONTEXT=be.createContextKey=be.baggageEntryMetadataFromString=void 0;var dq=zh();Object.defineProperty(be,"baggageEntryMetadataFromString",{enumerable:!0,get:function(){return dq.baggageEntryMetadataFromString}});var _R=Va();Object.defineProperty(be,"createContextKey",{enumerable:!0,get:function(){return _R.createContextKey}});Object.defineProperty(be,"ROOT_CONTEXT",{enumerable:!0,get:function(){return _R.ROOT_CONTEXT}});var pq=gP();Object.defineProperty(be,"DiagConsoleLogger",{enumerable:!0,get:function(){return pq.DiagConsoleLogger}});var fq=vd();Object.defineProperty(be,"DiagLogLevel",{enumerable:!0,get:function(){return fq.DiagLogLevel}});var mq=Kh();Object.defineProperty(be,"createNoopMeter",{enumerable:!0,get:function(){return mq.createNoopMeter}});var gq=PP();Object.defineProperty(be,"ValueType",{enumerable:!0,get:function(){return gq.ValueType}});var vR=Jh();Object.defineProperty(be,"defaultTextMapGetter",{enumerable:!0,get:function(){return vR.defaultTextMapGetter}});Object.defineProperty(be,"defaultTextMapSetter",{enumerable:!0,get:function(){return vR.defaultTextMapSetter}});var hq=cy();Object.defineProperty(be,"ProxyTracer",{enumerable:!0,get:function(){return hq.ProxyTracer}});var yq=ly();Object.defineProperty(be,"ProxyTracerProvider",{enumerable:!0,get:function(){return yq.ProxyTracerProvider}});var bq=mI();Object.defineProperty(be,"SamplingDecision",{enumerable:!0,get:function(){return bq.SamplingDecision}});var _q=hI();Object.defineProperty(be,"SpanKind",{enumerable:!0,get:function(){return _q.SpanKind}});var vq=bI();Object.defineProperty(be,"SpanStatusCode",{enumerable:!0,get:function(){return vq.SpanStatusCode}});var Sq=ty();Object.defineProperty(be,"TraceFlags",{enumerable:!0,get:function(){return Sq.TraceFlags}});var xq=OI();Object.defineProperty(be,"createTraceState",{enumerable:!0,get:function(){return xq.createTraceState}});var Ty=Ed();Object.defineProperty(be,"isSpanContextValid",{enumerable:!0,get:function(){return Ty.isSpanContextValid}});Object.defineProperty(be,"isValidTraceId",{enumerable:!0,get:function(){return Ty.isValidTraceId}});Object.defineProperty(be,"isValidSpanId",{enumerable:!0,get:function(){return Ty.isValidSpanId}});var Py=wd();Object.defineProperty(be,"INVALID_SPANID",{enumerable:!0,get:function(){return Py.INVALID_SPANID}});Object.defineProperty(be,"INVALID_TRACEID",{enumerable:!0,get:function(){return Py.INVALID_TRACEID}});Object.defineProperty(be,"INVALID_SPAN_CONTEXT",{enumerable:!0,get:function(){return Py.INVALID_SPAN_CONTEXT}});var SR=MI();Object.defineProperty(be,"context",{enumerable:!0,get:function(){return SR.context}});var xR=jI();Object.defineProperty(be,"diag",{enumerable:!0,get:function(){return xR.diag}});var wR=WI();Object.defineProperty(be,"metrics",{enumerable:!0,get:function(){return wR.metrics}});var kR=lR();Object.defineProperty(be,"propagation",{enumerable:!0,get:function(){return kR.propagation}});var ER=bR();Object.defineProperty(be,"trace",{enumerable:!0,get:function(){return ER.trace}});be.default={context:SR.context,diag:xR.diag,metrics:wR.metrics,propagation:kR.propagation,trace:ER.trace}});var Pl=k((TO)=>{Object.defineProperty(TO,"__esModule",{value:!0});TO.regexpCode=TO.getEsmExportName=TO.getProperty=TO.safeStringify=TO.stringify=TO.strConcat=TO.addCodeArg=TO.str=TO._=TO.nil=TO._Code=TO.Name=TO.IDENTIFIER=TO._CodeOrName=void 0;class bm{}TO._CodeOrName=bm;TO.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class ps extends bm{constructor(e){super();if(!TO.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}}}TO.Name=ps;class mr extends bm{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,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof ps)t[r.str]=(t[r.str]||0)+1;return t},{})}}TO._Code=mr;TO.nil=new mr("");function kO(e,...t){let r=[e[0]],o=0;while(o<t.length)mS(r,t[o]),r.push(e[++o]);return new mr(r)}TO._=kO;var fS=new mr("+");function EO(e,...t){let r=[Tl(e[0])],o=0;while(o<t.length)r.push(fS),mS(r,t[o]),r.push(fS,Tl(e[++o]));return UG(r),new mr(r)}TO.str=EO;function mS(e,t){if(t instanceof mr)e.push(...t._items);else if(t instanceof ps)e.push(t);else e.push(HG(t))}TO.addCodeArg=mS;function UG(e){let t=1;while(t<e.length-1){if(e[t]===fS){let r=LG(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function LG(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof ps||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 ps))return`"${e}${t.slice(1)}`;return}function FG(e,t){return t.emptyStr()?e:e.emptyStr()?t:EO`${e}${t}`}TO.strConcat=FG;function HG(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Tl(Array.isArray(e)?e.join(","):e)}function BG(e){return new mr(Tl(e))}TO.stringify=BG;function Tl(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}TO.safeStringify=Tl;function qG(e){return typeof e=="string"&&TO.IDENTIFIER.test(e)?new mr(`.${e}`):kO`[${e}]`}TO.getProperty=qG;function ZG(e){if(typeof e=="string"&&TO.IDENTIFIER.test(e))return new mr(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}TO.getEsmExportName=ZG;function VG(e){return new mr(e.toString())}TO.regexpCode=VG});var bS=k(($O)=>{Object.defineProperty($O,"__esModule",{value:!0});$O.ValueScope=$O.ValueScopeName=$O.Scope=$O.varKinds=$O.UsedValueState=void 0;var Pt=Pl();class IO extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var vm;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(vm||($O.UsedValueState=vm={}));$O.varKinds={const:new Pt.Name("const"),let:new Pt.Name("let"),var:new Pt.Name("var")};class hS{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof Pt.Name?e:this.name(e)}name(e){return new Pt.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.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}}}$O.Scope=hS;class yS extends Pt.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=Pt._`.${new Pt.Name(t)}[${r}]`}}$O.ValueScopeName=yS;var i9=Pt._`\n`;class RO extends hS{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?i9:Pt.nil}}get(){return this._scope}name(e){return new yS(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:n}=o,i=(r=t.key)!==null&&r!==void 0?r:t.ref,s=this._values[n];if(s){let u=s.get(i);if(u)return u}else s=this._values[n]=new Map;s.set(i,o);let a=this._scope[n]||(this._scope[n]=[]),c=a.length;return a[c]=t.ref,o.setValue(t,{property:n,itemIndex:c}),o}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return Pt._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(o)=>{if(o.value===void 0)throw Error(`CodeGen: name "${o}" has no value`);return o.value.code},t,r)}_reduceValues(e,t,r={},o){let n=Pt.nil;for(let i in e){let s=e[i];if(!s)continue;let a=r[i]=r[i]||new Map;s.forEach((c)=>{if(a.has(c))return;a.set(c,vm.Started);let u=t(c);if(u){let d=this.opts.es5?$O.varKinds.var:$O.varKinds.const;n=Pt._`${n}${d} ${c} = ${u};${this.opts._n}`}else if(u=o===null||o===void 0?void 0:o(c))n=Pt._`${n}${u}${this.opts._n}`;else throw new IO(c);a.set(c,vm.Completed)})}return n}}$O.ValueScope=RO});var te=k((It)=>{Object.defineProperty(It,"__esModule",{value:!0});It.or=It.and=It.not=It.CodeGen=It.operators=It.varKinds=It.ValueScopeName=It.ValueScope=It.Scope=It.Name=It.regexpCode=It.stringify=It.getProperty=It.nil=It.strConcat=It.str=It._=void 0;var le=Pl(),gr=bS(),Un=Pl();Object.defineProperty(It,"_",{enumerable:!0,get:function(){return Un._}});Object.defineProperty(It,"str",{enumerable:!0,get:function(){return Un.str}});Object.defineProperty(It,"strConcat",{enumerable:!0,get:function(){return Un.strConcat}});Object.defineProperty(It,"nil",{enumerable:!0,get:function(){return Un.nil}});Object.defineProperty(It,"getProperty",{enumerable:!0,get:function(){return Un.getProperty}});Object.defineProperty(It,"stringify",{enumerable:!0,get:function(){return Un.stringify}});Object.defineProperty(It,"regexpCode",{enumerable:!0,get:function(){return Un.regexpCode}});Object.defineProperty(It,"Name",{enumerable:!0,get:function(){return Un.Name}});var Tm=bS();Object.defineProperty(It,"Scope",{enumerable:!0,get:function(){return Tm.Scope}});Object.defineProperty(It,"ValueScope",{enumerable:!0,get:function(){return Tm.ValueScope}});Object.defineProperty(It,"ValueScopeName",{enumerable:!0,get:function(){return Tm.ValueScopeName}});Object.defineProperty(It,"varKinds",{enumerable:!0,get:function(){return Tm.varKinds}});It.operators={GT:new le._Code(">"),GTE:new le._Code(">="),LT:new le._Code("<"),LTE:new le._Code("<="),EQ:new le._Code("==="),NEQ:new le._Code("!=="),NOT:new le._Code("!"),OR:new le._Code("||"),AND:new le._Code("&&"),ADD:new le._Code("+")};class Ln{optimizeNodes(){return this}optimizeNames(e,t){return this}}class AO extends Ln{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?gr.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${o};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=ms(this.rhs,e,t);return this}get names(){return this.rhs instanceof le._CodeOrName?this.rhs.names:{}}}class SS extends Ln{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof le.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=ms(this.rhs,e,t),this}get names(){let e=this.lhs instanceof le.Name?{}:{...this.lhs.names};return Em(e,this.rhs)}}class CO extends SS{constructor(e,t,r,o){super(e,r,o);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class MO extends Ln{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class NO extends Ln{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class DO extends Ln{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class jO extends Ln{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=ms(this.code,e,t),this}get names(){return this.code instanceof le._CodeOrName?this.code.names:{}}}class Pm extends Ln{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,o=r.length;while(o--){let n=r[o];if(n.optimizeNames(e,t))continue;l9(e,n.names),r.splice(o,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>jo(e,t.names),{})}}class Fn extends Pm{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class zO extends Pm{}class Il extends Fn{}Il.kind="else";class en extends Fn{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 r=t.optimizeNodes();t=this.else=Array.isArray(r)?new Il(r):r}if(t){if(e===!1)return t instanceof en?t:t.nodes;if(this.nodes.length)return this;return new en(BO(e),t instanceof en?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=ms(this.condition,e,t),this}get names(){let e=super.names;if(Em(e,this.condition),this.else)jo(e,this.else.names);return e}}en.kind="if";class fs extends Fn{}fs.kind="for";class UO extends fs{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=ms(this.iteration,e,t),this}get names(){return jo(super.names,this.iteration.names)}}class LO extends fs{constructor(e,t,r,o){super();this.varKind=e,this.name=t,this.from=r,this.to=o}render(e){let t=e.es5?gr.varKinds.var:this.varKind,{name:r,from:o,to:n}=this;return`for(${t} ${r}=${o}; ${r}<${n}; ${r}++)`+super.render(e)}get names(){let e=Em(super.names,this.from);return Em(e,this.to)}}class _S extends fs{constructor(e,t,r,o){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=o}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=ms(this.iterable,e,t),this}get names(){return jo(super.names,this.iterable.names)}}class Sm extends Fn{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}Sm.kind="func";class xm extends Pm{render(e){return"return "+super.render(e)}}xm.kind="return";class FO extends Fn{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 r,o;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(o=this.finally)===null||o===void 0||o.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)jo(e,this.catch.names);if(this.finally)jo(e,this.finally.names);return e}}class wm extends Fn{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}wm.kind="catch";class km extends Fn{render(e){return"finally"+super.render(e)}}km.kind="finally";class HO{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
9
+ `:""},this._extScope=e,this._scope=new gr.Scope({parent:e}),this._nodes=[new zO]}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 r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}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,r,o){let n=this._scope.toName(t);if(r!==void 0&&o)this._constants[n.str]=r;return this._leafNode(new AO(e,n,r)),n}const(e,t,r){return this._def(gr.varKinds.const,e,t,r)}let(e,t,r){return this._def(gr.varKinds.let,e,t,r)}var(e,t,r){return this._def(gr.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new SS(e,t,r))}add(e,t){return this._leafNode(new CO(e,It.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==le.nil)this._leafNode(new jO(e));return this}object(...e){let t=["{"];for(let[r,o]of e){if(t.length>1)t.push(",");if(t.push(r),r!==o||this.opts.es5)t.push(":"),(0,le.addCodeArg)(t,o)}return t.push("}"),new le._Code(t)}if(e,t,r){if(this._blockNode(new en(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new en(e))}else(){return this._elseNode(new Il)}endIf(){return this._endBlockNode(en,Il)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new UO(e),t)}forRange(e,t,r,o,n=this.opts.es5?gr.varKinds.var:gr.varKinds.let){let i=this._scope.toName(e);return this._for(new LO(n,i,t,r),()=>o(i))}forOf(e,t,r,o=gr.varKinds.const){let n=this._scope.toName(e);if(this.opts.es5){let i=t instanceof le.Name?t:this.var("_arr",t);return this.forRange("_i",0,le._`${i}.length`,(s)=>{this.var(n,le._`${i}[${s}]`),r(n)})}return this._for(new _S("of",o,n,t),()=>r(n))}forIn(e,t,r,o=this.opts.es5?gr.varKinds.var:gr.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,le._`Object.keys(${t})`,r);let n=this._scope.toName(e);return this._for(new _S("in",o,n,t),()=>r(n))}endFor(){return this._endBlockNode(fs)}label(e){return this._leafNode(new MO(e))}break(e){return this._leafNode(new NO(e))}return(e){let t=new xm;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(xm)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new FO;if(this._blockNode(o),this.code(e),t){let n=this.name("e");this._currNode=o.catch=new wm(n),t(n)}if(r)this._currNode=o.finally=new km,this.code(r);return this._endBlockNode(wm,km)}throw(e){return this._leafNode(new DO(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 r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=le.nil,r,o){if(this._blockNode(new Sm(e,t,r)),o)this.code(o).endFunc();return this}endFunc(){return this._endBlockNode(Sm)}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 r=this._currNode;if(r instanceof e||t&&r 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 en))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}}It.CodeGen=HO;function jo(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Em(e,t){return t instanceof le._CodeOrName?jo(e,t.names):e}function ms(e,t,r){if(e instanceof le.Name)return o(e);if(!n(e))return e;return new le._Code(e._items.reduce((i,s)=>{if(s instanceof le.Name)s=o(s);if(s instanceof le._Code)i.push(...s._items);else i.push(s);return i},[]));function o(i){let s=r[i.str];if(s===void 0||t[i.str]!==1)return i;return delete t[i.str],s}function n(i){return i instanceof le._Code&&i._items.some((s)=>s instanceof le.Name&&t[s.str]===1&&r[s.str]!==void 0)}}function l9(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function BO(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:le._`!${vS(e)}`}It.not=BO;var u9=qO(It.operators.AND);function d9(...e){return e.reduce(u9)}It.and=d9;var p9=qO(It.operators.OR);function f9(...e){return e.reduce(p9)}It.or=f9;function qO(e){return(t,r)=>t===le.nil?r:r===le.nil?t:le._`${vS(t)} ${e} ${vS(r)}`}function vS(e){return e instanceof le.Name?e:le._`(${e})`}});var ue=k((QO)=>{Object.defineProperty(QO,"__esModule",{value:!0});QO.checkStrictMode=QO.getErrorPath=QO.Type=QO.useFunc=QO.setEvaluated=QO.evaluatedPropsToName=QO.mergeEvaluated=QO.eachItem=QO.unescapeJsonPointer=QO.escapeJsonPointer=QO.escapeFragment=QO.unescapeFragment=QO.schemaRefOrVal=QO.schemaHasRulesButRef=QO.schemaHasRules=QO.checkUnknownRules=QO.alwaysValidSchema=QO.toHash=void 0;var Te=te(),y9=Pl();function b9(e){let t={};for(let r of e)t[r]=!0;return t}QO.toHash=b9;function _9(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return KO(e,t),!GO(t,e.self.RULES.all)}QO.alwaysValidSchema=_9;function KO(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let n=o.RULES.keywords;for(let i in t)if(!n[i])YO(e,`unknown keyword: "${i}"`)}QO.checkUnknownRules=KO;function GO(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}QO.schemaHasRules=GO;function v9(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}QO.schemaHasRulesButRef=v9;function S9({topSchemaRef:e,schemaPath:t},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return Te._`${r}`}return Te._`${e}${t}${(0,Te.getProperty)(o)}`}QO.schemaRefOrVal=S9;function x9(e){return JO(decodeURIComponent(e))}QO.unescapeFragment=x9;function w9(e){return encodeURIComponent(wS(e))}QO.escapeFragment=w9;function wS(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}QO.escapeJsonPointer=wS;function JO(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}QO.unescapeJsonPointer=JO;function k9(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}QO.eachItem=k9;function VO({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:o}){return(n,i,s,a)=>{let c=s===void 0?i:s instanceof Te.Name?(i instanceof Te.Name?e(n,i,s):t(n,i,s),s):i instanceof Te.Name?(t(n,s,i),i):r(i,s);return a===Te.Name&&!(c instanceof Te.Name)?o(n,c):c}}QO.mergeEvaluated={props:VO({mergeNames:(e,t,r)=>e.if(Te._`${r} !== true && ${t} !== undefined`,()=>{e.if(Te._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,Te._`${r} || {}`).code(Te._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(Te._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,Te._`${r} || {}`),kS(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:XO}),items:VO({mergeNames:(e,t,r)=>e.if(Te._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,Te._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(Te._`${r} !== true`,()=>e.assign(r,t===!0?!0:Te._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function XO(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",Te._`{}`);if(t!==void 0)kS(e,r,t);return r}QO.evaluatedPropsToName=XO;function kS(e,t,r){Object.keys(r).forEach((o)=>e.assign(Te._`${t}${(0,Te.getProperty)(o)}`,!0))}QO.setEvaluated=kS;var WO={};function E9(e,t){return e.scopeValue("func",{ref:t,code:WO[t.code]||(WO[t.code]=new y9._Code(t.code))})}QO.useFunc=E9;var xS;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(xS||(QO.Type=xS={}));function T9(e,t,r){if(e instanceof Te.Name){let o=t===xS.Num;return r?o?Te._`"[" + ${e} + "]"`:Te._`"['" + ${e} + "']"`:o?Te._`"/" + ${e}`:Te._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Te.getProperty)(e).toString():"/"+wS(e)}QO.getErrorPath=T9;function YO(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}QO.checkStrictMode=YO});var tn=k((tA)=>{Object.defineProperty(tA,"__esModule",{value:!0});var ut=te(),q9={data:new ut.Name("data"),valCxt:new ut.Name("valCxt"),instancePath:new ut.Name("instancePath"),parentData:new ut.Name("parentData"),parentDataProperty:new ut.Name("parentDataProperty"),rootData:new ut.Name("rootData"),dynamicAnchors:new ut.Name("dynamicAnchors"),vErrors:new ut.Name("vErrors"),errors:new ut.Name("errors"),this:new ut.Name("this"),self:new ut.Name("self"),scope:new ut.Name("scope"),json:new ut.Name("json"),jsonPos:new ut.Name("jsonPos"),jsonLen:new ut.Name("jsonLen"),jsonPart:new ut.Name("jsonPart")};tA.default=q9});var Rl=k((iA)=>{Object.defineProperty(iA,"__esModule",{value:!0});iA.extendErrors=iA.resetErrorsCount=iA.reportExtraError=iA.reportError=iA.keyword$DataError=iA.keywordError=void 0;var de=te(),Rm=ue(),ht=tn();iA.keywordError={message:({keyword:e})=>de.str`must pass "${e}" keyword validation`};iA.keyword$DataError={message:({keyword:e,schemaType:t})=>t?de.str`"${e}" keyword must be ${t} ($data)`:de.str`"${e}" keyword is invalid ($data)`};function V9(e,t=iA.keywordError,r,o){let{it:n}=e,{gen:i,compositeRule:s,allErrors:a}=n,c=oA(e,t,r);if(o!==null&&o!==void 0?o:s||a)rA(i,c);else nA(n,de._`[${c}]`)}iA.reportError=V9;function W9(e,t=iA.keywordError,r){let{it:o}=e,{gen:n,compositeRule:i,allErrors:s}=o,a=oA(e,t,r);if(rA(n,a),!(i||s))nA(o,ht.default.vErrors)}iA.reportExtraError=W9;function K9(e,t){e.assign(ht.default.errors,t),e.if(de._`${ht.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(de._`${ht.default.vErrors}.length`,t),()=>e.assign(ht.default.vErrors,null)))}iA.resetErrorsCount=K9;function G9({gen:e,keyword:t,schemaValue:r,data:o,errsCount:n,it:i}){if(n===void 0)throw Error("ajv implementation error");let s=e.name("err");e.forRange("i",n,ht.default.errors,(a)=>{if(e.const(s,de._`${ht.default.vErrors}[${a}]`),e.if(de._`${s}.instancePath === undefined`,()=>e.assign(de._`${s}.instancePath`,(0,de.strConcat)(ht.default.instancePath,i.errorPath))),e.assign(de._`${s}.schemaPath`,de.str`${i.errSchemaPath}/${t}`),i.opts.verbose)e.assign(de._`${s}.schema`,r),e.assign(de._`${s}.data`,o)})}iA.extendErrors=G9;function rA(e,t){let r=e.const("err",t);e.if(de._`${ht.default.vErrors} === null`,()=>e.assign(ht.default.vErrors,de._`[${r}]`),de._`${ht.default.vErrors}.push(${r})`),e.code(de._`${ht.default.errors}++`)}function nA(e,t){let{gen:r,validateName:o,schemaEnv:n}=e;if(n.$async)r.throw(de._`new ${e.ValidationError}(${t})`);else r.assign(de._`${o}.errors`,t),r.return(!1)}var zo={keyword:new de.Name("keyword"),schemaPath:new de.Name("schemaPath"),params:new de.Name("params"),propertyName:new de.Name("propertyName"),message:new de.Name("message"),schema:new de.Name("schema"),parentSchema:new de.Name("parentSchema")};function oA(e,t,r){let{createErrors:o}=e.it;if(o===!1)return de._`{}`;return J9(e,t,r)}function J9(e,t,r={}){let{gen:o,it:n}=e,i=[X9(n,r),Y9(e,r)];return Q9(e,t,i),o.object(...i)}function X9({errorPath:e},{instancePath:t}){let r=t?de.str`${e}${(0,Rm.getErrorPath)(t,Rm.Type.Str)}`:e;return[ht.default.instancePath,(0,de.strConcat)(ht.default.instancePath,r)]}function Y9({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let n=o?t:de.str`${t}/${e}`;if(r)n=de.str`${n}${(0,Rm.getErrorPath)(r,Rm.Type.Str)}`;return[zo.schemaPath,n]}function Q9(e,{params:t,message:r},o){let{keyword:n,data:i,schemaValue:s,it:a}=e,{opts:c,propertyName:u,topSchemaRef:d,schemaPath:p}=a;if(o.push([zo.keyword,n],[zo.params,typeof t=="function"?t(e):t||de._`{}`]),c.messages)o.push([zo.message,typeof r=="function"?r(e):r]);if(c.verbose)o.push([zo.schema,s],[zo.parentSchema,de._`${d}${p}`],[ht.default.data,i]);if(u)o.push([zo.propertyName,u])}});var uA=k((cA)=>{Object.defineProperty(cA,"__esModule",{value:!0});cA.boolOrEmptySchema=cA.topBoolOrEmptySchema=void 0;var oJ=Rl(),iJ=te(),sJ=tn(),aJ={message:"boolean schema is false"};function cJ(e){let{gen:t,schema:r,validateName:o}=e;if(r===!1)aA(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(sJ.default.data);else t.assign(iJ._`${o}.errors`,null),t.return(!0)}cA.topBoolOrEmptySchema=cJ;function lJ(e,t){let{gen:r,schema:o}=e;if(o===!1)r.var(t,!1),aA(e);else r.var(t,!0)}cA.boolOrEmptySchema=lJ;function aA(e,t){let{gen:r,data:o}=e,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,oJ.reportError)(n,aJ,void 0,t)}});var TS=k((dA)=>{Object.defineProperty(dA,"__esModule",{value:!0});dA.getRules=dA.isJSONType=void 0;var dJ=["string","number","integer","boolean","null","object","array"],pJ=new Set(dJ);function fJ(e){return typeof e=="string"&&pJ.has(e)}dA.isJSONType=fJ;function mJ(){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:{}}}dA.getRules=mJ});var PS=k((gA)=>{Object.defineProperty(gA,"__esModule",{value:!0});gA.shouldUseRule=gA.shouldUseGroup=gA.schemaHasRulesForType=void 0;function hJ({schema:e,self:t},r){let o=t.RULES.types[r];return o&&o!==!0&&fA(e,o)}gA.schemaHasRulesForType=hJ;function fA(e,t){return t.rules.some((r)=>mA(e,r))}gA.shouldUseGroup=fA;function mA(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some((o)=>e[o]!==void 0))}gA.shouldUseRule=mA});var $l=k((vA)=>{Object.defineProperty(vA,"__esModule",{value:!0});vA.reportTypeError=vA.checkDataTypes=vA.checkDataType=vA.coerceAndCheckDataType=vA.getJSONTypes=vA.getSchemaTypes=vA.DataType=void 0;var _J=TS(),vJ=PS(),SJ=Rl(),ee=te(),yA=ue(),gs;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(gs||(vA.DataType=gs={}));function xJ(e){let t=bA(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}vA.getSchemaTypes=xJ;function bA(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(_J.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}vA.getJSONTypes=bA;function wJ(e,t){let{gen:r,data:o,opts:n}=e,i=kJ(t,n.coerceTypes),s=t.length>0&&!(i.length===0&&t.length===1&&(0,vJ.schemaHasRulesForType)(e,t[0]));if(s){let a=RS(t,o,n.strictNumbers,gs.Wrong);r.if(a,()=>{if(i.length)EJ(e,t,i);else $S(e)})}return s}vA.coerceAndCheckDataType=wJ;var _A=new Set(["string","number","integer","boolean","null"]);function kJ(e,t){return t?e.filter((r)=>_A.has(r)||t==="array"&&r==="array"):[]}function EJ(e,t,r){let{gen:o,data:n,opts:i}=e,s=o.let("dataType",ee._`typeof ${n}`),a=o.let("coerced",ee._`undefined`);if(i.coerceTypes==="array")o.if(ee._`${s} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,ee._`${n}[0]`).assign(s,ee._`typeof ${n}`).if(RS(t,n,i.strictNumbers),()=>o.assign(a,n)));o.if(ee._`${a} !== undefined`);for(let u of r)if(_A.has(u)||u==="array"&&i.coerceTypes==="array")c(u);o.else(),$S(e),o.endIf(),o.if(ee._`${a} !== undefined`,()=>{o.assign(n,a),TJ(e,a)});function c(u){switch(u){case"string":o.elseIf(ee._`${s} == "number" || ${s} == "boolean"`).assign(a,ee._`"" + ${n}`).elseIf(ee._`${n} === null`).assign(a,ee._`""`);return;case"number":o.elseIf(ee._`${s} == "boolean" || ${n} === null
10
10
  || (${s} == "string" && ${n} && ${n} == +${n})`).assign(a,ee._`+${n}`);return;case"integer":o.elseIf(ee._`${s} === "boolean" || ${n} === null
11
11
  || (${s} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,ee._`+${n}`);return;case"boolean":o.elseIf(ee._`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf(ee._`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf(ee._`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf(ee._`${s} === "string" || ${s} === "number"
12
- || ${s} === "boolean" || ${n} === null`).assign(a,ee._`[${n}]`)}}}function _J({gen:e,parentData:t,parentDataProperty:r},o){e.if(ee._`${t} !== undefined`,()=>e.assign(ee._`${t}[${r}]`,o))}function PS(e,t,r,o=gs.Correct){let n=o===gs.Correct?ee.operators.EQ:ee.operators.NEQ,i;switch(e){case"null":return ee._`${t} ${n} null`;case"array":i=ee._`Array.isArray(${t})`;break;case"object":i=ee._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=s(ee._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=s();break;default:return ee._`typeof ${t} ${n} ${e}`}return o===gs.Correct?i:(0,ee.not)(i);function s(a=ee.nil){return(0,ee.and)(ee._`typeof ${t} == "number"`,a,r?ee._`isFinite(${t})`:ee.nil)}}bA.checkDataType=PS;function IS(e,t,r,o){if(e.length===1)return PS(e[0],t,r,o);let n,i=(0,gA.toHash)(e);if(i.array&&i.object){let s=ee._`typeof ${t} != "object"`;n=i.null?s:ee._`!${t} || ${s}`,delete i.null,delete i.array,delete i.object}else n=ee.nil;if(i.number)delete i.integer;for(let s in i)n=(0,ee.and)(n,PS(s,t,r,o));return n}bA.checkDataTypes=IS;var vJ={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?ee._`{type: ${e}}`:ee._`{type: ${t}}`};function RS(e){let t=SJ(e);(0,mJ.reportError)(t,vJ)}bA.reportTypeError=RS;function SJ(e){let{gen:t,data:r,schema:o}=e,n=(0,gA.schemaRefOrVal)(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:e}}});var wA=k((SA)=>{Object.defineProperty(SA,"__esModule",{value:!0});SA.assignDefaults=void 0;var hs=te(),IJ=ue();function RJ(e,t){let{properties:r,items:o}=e.schema;if(t==="object"&&r)for(let n in r)vA(e,n,r[n].default);else if(t==="array"&&Array.isArray(o))o.forEach((n,i)=>vA(e,i,n.default))}SA.assignDefaults=RJ;function vA(e,t,r){let{gen:o,compositeRule:n,data:i,opts:s}=e;if(r===void 0)return;let a=hs._`${i}${(0,hs.getProperty)(t)}`;if(n){(0,IJ.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=hs._`${a} === undefined`;if(s.useDefaults==="empty")c=hs._`${c} || ${a} === null || ${a} === ""`;o.if(c,hs._`${a} = ${(0,hs.stringify)(r)}`)}});var er=k((EA)=>{Object.defineProperty(EA,"__esModule",{value:!0});EA.validateUnion=EA.validateArray=EA.usePattern=EA.callValidateCode=EA.schemaProperties=EA.allSchemaProperties=EA.noPropertyInData=EA.propertyInData=EA.isOwnProperty=EA.hasPropFunc=EA.reportMissingProp=EA.checkMissingProp=EA.checkReportMissingProp=void 0;var Ae=te(),$S=ue(),Ln=tn(),$J=ue();function OJ(e,t){let{gen:r,data:o,it:n}=e;r.if(AS(r,o,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:Ae._`${t}`},!0),e.error()})}EA.checkReportMissingProp=OJ;function AJ({gen:e,data:t,it:{opts:r}},o,n){return(0,Ae.or)(...o.map((i)=>(0,Ae.and)(AS(e,t,i,r.ownProperties),Ae._`${n} = ${i}`)))}EA.checkMissingProp=AJ;function CJ(e,t){e.setParams({missingProperty:t},!0),e.error()}EA.reportMissingProp=CJ;function kA(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Ae._`Object.prototype.hasOwnProperty`})}EA.hasPropFunc=kA;function OS(e,t,r){return Ae._`${kA(e)}.call(${t}, ${r})`}EA.isOwnProperty=OS;function MJ(e,t,r,o){let n=Ae._`${t}${(0,Ae.getProperty)(r)} !== undefined`;return o?Ae._`${n} && ${OS(e,t,r)}`:n}EA.propertyInData=MJ;function AS(e,t,r,o){let n=Ae._`${t}${(0,Ae.getProperty)(r)} === undefined`;return o?(0,Ae.or)(n,(0,Ae.not)(OS(e,t,r))):n}EA.noPropertyInData=AS;function TA(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}EA.allSchemaProperties=TA;function NJ(e,t){return TA(t).filter((r)=>!(0,$S.alwaysValidSchema)(e,t[r]))}EA.schemaProperties=NJ;function DJ({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:i},it:s},a,c,u){let d=u?Ae._`${e}, ${t}, ${o}${n}`:t,p=[[Ln.default.instancePath,(0,Ae.strConcat)(Ln.default.instancePath,i)],[Ln.default.parentData,s.parentData],[Ln.default.parentDataProperty,s.parentDataProperty],[Ln.default.rootData,Ln.default.rootData]];if(s.opts.dynamicRef)p.push([Ln.default.dynamicAnchors,Ln.default.dynamicAnchors]);let f=Ae._`${d}, ${r.object(...p)}`;return c!==Ae.nil?Ae._`${a}.call(${c}, ${f})`:Ae._`${a}(${f})`}EA.callValidateCode=DJ;var jJ=Ae._`new RegExp`;function zJ({gen:e,it:{opts:t}},r){let o=t.unicodeRegExp?"u":"",{regExp:n}=t.code,i=n(r,o);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:Ae._`${n.code==="new RegExp"?jJ:(0,$J.useFunc)(e,n)}(${r}, ${o})`})}EA.usePattern=zJ;function UJ(e){let{gen:t,data:r,keyword:o,it:n}=e,i=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return s(()=>t.assign(a,!1)),a}return t.var(i,!0),s(()=>t.break()),i;function s(a){let c=t.const("len",Ae._`${r}.length`);t.forRange("i",0,c,(u)=>{e.subschema({keyword:o,dataProp:u,dataPropType:$S.Type.Num},i),t.if((0,Ae.not)(i),a)})}}EA.validateArray=UJ;function LJ(e){let{gen:t,schema:r,keyword:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((c)=>(0,$S.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let s=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let d=e.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);if(t.assign(s,Ae._`${s} || ${a}`),!e.mergeValidEvaluated(d,a))t.if((0,Ae.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}EA.validateUnion=LJ});var AA=k(($A)=>{Object.defineProperty($A,"__esModule",{value:!0});$A.validateKeywordUsage=$A.validSchemaType=$A.funcKeywordCode=$A.macroKeywordCode=void 0;var yt=te(),jo=tn(),QJ=er(),e5=Rl();function t5(e,t){let{gen:r,keyword:o,schema:n,parentSchema:i,it:s}=e,a=t.macro.call(s.self,n,i,s),c=RA(r,o,a);if(s.opts.validateSchema!==!1)s.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:yt.nil,errSchemaPath:`${s.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}$A.macroKeywordCode=t5;function r5(e,t){var r;let{gen:o,keyword:n,schema:i,parentSchema:s,$data:a,it:c}=e;o5(c,t);let u=!a&&t.compile?t.compile.call(c.self,i,s,c):t.validate,d=RA(o,n,u),p=o.let("valid");e.block$data(p,f),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function f(){if(t.errors===!1){if(h(),t.modifying)IA(e);y(()=>e.error())}else{let v=t.async?m():g();if(t.modifying)IA(e);y(()=>n5(e,v))}}function m(){let v=o.let("ruleErrs",null);return o.try(()=>h(yt._`await `),(x)=>o.assign(p,!1).if(yt._`${x} instanceof ${c.ValidationError}`,()=>o.assign(v,yt._`${x}.errors`),()=>o.throw(x))),v}function g(){let v=yt._`${d}.errors`;return o.assign(v,null),h(yt.nil),v}function h(v=t.async?yt._`await `:yt.nil){let x=c.opts.passContext?jo.default.this:jo.default.self,w=!(("compile"in t)&&!a||t.schema===!1);o.assign(p,yt._`${v}${(0,QJ.callValidateCode)(e,d,x,w)}`,t.modifying)}function y(v){var x;o.if((0,yt.not)((x=t.valid)!==null&&x!==void 0?x:p),v)}}$A.funcKeywordCode=r5;function IA(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,yt._`${o.parentData}[${o.parentDataProperty}]`))}function n5(e,t){let{gen:r}=e;r.if(yt._`Array.isArray(${t})`,()=>{r.assign(jo.default.vErrors,yt._`${jo.default.vErrors} === null ? ${t} : ${jo.default.vErrors}.concat(${t})`).assign(jo.default.errors,yt._`${jo.default.vErrors}.length`),(0,e5.extendErrors)(e)},()=>e.error())}function o5({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function RA(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,yt.stringify)(r)})}function i5(e,t,r=!1){return!t.length||t.some((o)=>o==="array"?Array.isArray(e):o==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==o||r&&typeof e>"u")}$A.validSchemaType=i5;function s5({schema:e,opts:t,self:r,errSchemaPath:o},n,i){if(Array.isArray(n.keyword)?!n.keyword.includes(i):n.keyword!==i)throw Error("ajv implementation error");let s=n.dependencies;if(s===null||s===void 0?void 0:s.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(n.validateSchema){if(!n.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw Error(c)}}}$A.validateKeywordUsage=s5});var DA=k((MA)=>{Object.defineProperty(MA,"__esModule",{value:!0});MA.extendSubschemaMode=MA.extendSubschemaData=MA.getSubschema=void 0;var Ir=te(),CA=ue();function u5(e,{keyword:t,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:i,topSchemaRef:s}){if(t!==void 0&&o!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:Ir._`${e.schemaPath}${(0,Ir.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:Ir._`${e.schemaPath}${(0,Ir.getProperty)(t)}${(0,Ir.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,CA.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||i===void 0||s===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:s,errSchemaPath:i}}throw Error('either "keyword" or "schema" must be passed')}MA.getSubschema=u5;function d5(e,t,{dataProp:r,dataPropType:o,data:n,dataTypes:i,propertyName:s}){if(n!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:d,opts:p}=t,f=a.let("data",Ir._`${t.data}${(0,Ir.getProperty)(r)}`,!0);c(f),e.errorPath=Ir.str`${u}${(0,CA.getErrorPath)(r,o,p.jsPropertySyntax)}`,e.parentDataProperty=Ir._`${r}`,e.dataPathArr=[...d,e.parentDataProperty]}if(n!==void 0){let u=n instanceof Ir.Name?n:a.let("data",n,!0);if(c(u),s!==void 0)e.propertyName=s}if(i)e.dataTypes=i;function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}MA.extendSubschemaData=d5;function p5(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:i}){if(o!==void 0)e.compositeRule=o;if(n!==void 0)e.createErrors=n;if(i!==void 0)e.allErrors=i;e.jtdDiscriminator=t,e.jtdMetadata=r}MA.extendSubschemaMode=p5});var CS=k((Fke,jA)=>{jA.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var o,n,i;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),o=i.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[n]))return!1;for(n=o;n--!==0;){var s=i[n];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}});var UA=k((Hke,zA)=>{var Fn=zA.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};Rm(t,o,n,e,"",e)};Fn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Fn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Fn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Fn.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 Rm(e,t,r,o,n,i,s,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){t(o,n,i,s,a,c,u);for(var d in o){var p=o[d];if(Array.isArray(p)){if(d in Fn.arrayKeywords)for(var f=0;f<p.length;f++)Rm(e,t,r,p[f],n+"/"+d+"/"+f,i,n,d,o,f)}else if(d in Fn.propsKeywords){if(p&&typeof p=="object")for(var m in p)Rm(e,t,r,p[m],n+"/"+d+"/"+g5(m),i,n,d,o,m)}else if(d in Fn.keywords||e.allKeys&&!(d in Fn.skipKeywords))Rm(e,t,r,p,n+"/"+d,i,n,d,o)}r(o,n,i,s,a,c,u)}}function g5(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ol=k((BA)=>{Object.defineProperty(BA,"__esModule",{value:!0});BA.getSchemaRefs=BA.resolveUrl=BA.normalizeId=BA._getFullPath=BA.getFullPath=BA.inlineRef=void 0;var h5=ue(),y5=CS(),b5=UA(),_5=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function v5(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!MS(e);if(!t)return!1;return LA(e)<=t}BA.inlineRef=v5;var S5=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function MS(e){for(let t in e){if(S5.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(MS))return!0;if(typeof r=="object"&&MS(r))return!0}return!1}function LA(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,_5.has(r))continue;if(typeof e[r]=="object")(0,h5.eachItem)(e[r],(o)=>t+=LA(o));if(t===1/0)return 1/0}return t}function FA(e,t="",r){if(r!==!1)t=ys(t);let o=e.parse(t);return HA(e,o)}BA.getFullPath=FA;function HA(e,t){return e.serialize(t).split("#")[0]+"#"}BA._getFullPath=HA;var x5=/#\/?$/;function ys(e){return e?e.replace(x5,""):""}BA.normalizeId=ys;function w5(e,t,r){return r=ys(r),e.resolve(t,r)}BA.resolveUrl=w5;var k5=/^[a-z_][-a-z0-9._]*$/i;function T5(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=ys(e[r]||t),i={"":n},s=FA(o,n,!1),a={},c=new Set;return b5(e,{allKeys:!0},(p,f,m,g)=>{if(g===void 0)return;let h=s+f,y=i[g];if(typeof p[r]=="string")y=v.call(this,p[r]);x.call(this,p.$anchor),x.call(this,p.$dynamicAnchor),i[f]=y;function v(w){let O=this.opts.uriResolver.resolve;if(w=ys(y?O(y,w):w),c.has(w))throw d(w);c.add(w);let L=this.refs[w];if(typeof L=="string")L=this.refs[L];if(typeof L=="object")u(p,L.schema,w);else if(w!==ys(h))if(w[0]==="#")u(p,a[w],w),a[w]=p;else this.refs[w]=h;return w}function x(w){if(typeof w=="string"){if(!k5.test(w))throw Error(`invalid anchor "${w}"`);v.call(this,`#${w}`)}}}),a;function u(p,f,m){if(f!==void 0&&!y5(p,f))throw d(m)}function d(p){return Error(`reference "${p}" resolves to more than one schema`)}}BA.getSchemaRefs=T5});var Ml=k((iC)=>{Object.defineProperty(iC,"__esModule",{value:!0});iC.getData=iC.KeywordCxt=iC.validateFunctionCode=void 0;var GA=cA(),ZA=$l(),DS=ES(),$m=$l(),O5=wA(),Cl=AA(),NS=DA(),q=te(),X=tn(),A5=Ol(),rn=ue(),Al=Rl();function C5(e){if(YA(e)){if(QA(e),XA(e)){D5(e);return}}JA(e,()=>(0,GA.topBoolOrEmptySchema)(e))}iC.validateFunctionCode=C5;function JA({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},i){if(n.code.es5)e.func(t,q._`${X.default.data}, ${X.default.valCxt}`,o.$async,()=>{e.code(q._`"use strict"; ${VA(r,n)}`),N5(e,n),e.code(i)});else e.func(t,q._`${X.default.data}, ${M5(n)}`,o.$async,()=>e.code(VA(r,n)).code(i))}function M5(e){return q._`{${X.default.instancePath}="", ${X.default.parentData}, ${X.default.parentDataProperty}, ${X.default.rootData}=${X.default.data}${e.dynamicRef?q._`, ${X.default.dynamicAnchors}={}`:q.nil}}={}`}function N5(e,t){e.if(X.default.valCxt,()=>{if(e.var(X.default.instancePath,q._`${X.default.valCxt}.${X.default.instancePath}`),e.var(X.default.parentData,q._`${X.default.valCxt}.${X.default.parentData}`),e.var(X.default.parentDataProperty,q._`${X.default.valCxt}.${X.default.parentDataProperty}`),e.var(X.default.rootData,q._`${X.default.valCxt}.${X.default.rootData}`),t.dynamicRef)e.var(X.default.dynamicAnchors,q._`${X.default.valCxt}.${X.default.dynamicAnchors}`)},()=>{if(e.var(X.default.instancePath,q._`""`),e.var(X.default.parentData,q._`undefined`),e.var(X.default.parentDataProperty,q._`undefined`),e.var(X.default.rootData,X.default.data),t.dynamicRef)e.var(X.default.dynamicAnchors,q._`{}`)})}function D5(e){let{schema:t,opts:r,gen:o}=e;JA(e,()=>{if(r.$comment&&t.$comment)tC(e);if(F5(e),o.let(X.default.vErrors,null),o.let(X.default.errors,0),r.unevaluated)j5(e);eC(e),q5(e)});return}function j5(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",q._`${r}.evaluated`),t.if(q._`${e.evaluated}.dynamicProps`,()=>t.assign(q._`${e.evaluated}.props`,q._`undefined`)),t.if(q._`${e.evaluated}.dynamicItems`,()=>t.assign(q._`${e.evaluated}.items`,q._`undefined`))}function VA(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?q._`/*# sourceURL=${r} */`:q.nil}function z5(e,t){if(YA(e)){if(QA(e),XA(e)){U5(e,t);return}}(0,GA.boolOrEmptySchema)(e,t)}function XA({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function YA(e){return typeof e.schema!="boolean"}function U5(e,t){let{schema:r,gen:o,opts:n}=e;if(n.$comment&&r.$comment)tC(e);H5(e),B5(e);let i=o.const("_errs",X.default.errors);eC(e,i),o.var(t,q._`${i} === ${X.default.errors}`)}function QA(e){(0,rn.checkUnknownRules)(e),L5(e)}function eC(e,t){if(e.opts.jtd)return WA(e,[],!1,t);let r=(0,ZA.getSchemaTypes)(e.schema),o=(0,ZA.coerceAndCheckDataType)(e,r);WA(e,r,!o,t)}function L5(e){let{schema:t,errSchemaPath:r,opts:o,self:n}=e;if(t.$ref&&o.ignoreKeywordsWithRef&&(0,rn.schemaHasRulesButRef)(t,n.RULES))n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function F5(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)(0,rn.checkStrictMode)(e,"default is ignored in the schema root")}function H5(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=(0,A5.resolveUrl)(e.opts.uriResolver,e.baseId,t)}function B5(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function tC({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){let i=r.$comment;if(n.$comment===!0)e.code(q._`${X.default.self}.logger.log(${i})`);else if(typeof n.$comment=="function"){let s=q.str`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(q._`${X.default.self}.opts.$comment(${i}, ${s}, ${a}.schema)`)}}function q5(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:i}=e;if(r.$async)t.if(q._`${X.default.errors} === 0`,()=>t.return(X.default.data),()=>t.throw(q._`new ${n}(${X.default.vErrors})`));else{if(t.assign(q._`${o}.errors`,X.default.vErrors),i.unevaluated)Z5(e);t.return(q._`${X.default.errors} === 0`)}}function Z5({gen:e,evaluated:t,props:r,items:o}){if(r instanceof q.Name)e.assign(q._`${t}.props`,r);if(o instanceof q.Name)e.assign(q._`${t}.items`,o)}function WA(e,t,r,o){let{gen:n,schema:i,data:s,allErrors:a,opts:c,self:u}=e,{RULES:d}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,rn.schemaHasRulesButRef)(i,d))){n.block(()=>nC(e,"$ref",d.all.$ref.definition));return}if(!c.jtd)V5(e,t);n.block(()=>{for(let f of d.rules)p(f);p(d.post)});function p(f){if(!(0,DS.shouldUseGroup)(i,f))return;if(f.type){if(n.if((0,$m.checkDataType)(f.type,s,c.strictNumbers)),KA(e,f),t.length===1&&t[0]===f.type&&r)n.else(),(0,$m.reportTypeError)(e);n.endIf()}else KA(e,f);if(!a)n.if(q._`${X.default.errors} === ${o||0}`)}}function KA(e,t){let{gen:r,schema:o,opts:{useDefaults:n}}=e;if(n)(0,O5.assignDefaults)(e,t.type);r.block(()=>{for(let i of t.rules)if((0,DS.shouldUseRule)(o,i))nC(e,i.keyword,i.definition,t.type)})}function V5(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(W5(e,t),!e.opts.allowUnionTypes)K5(e,t);G5(e,e.dataTypes)}function W5(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!rC(e.dataTypes,r))jS(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),X5(e,t)}function K5(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))jS(e,"use allowUnionTypes to allow union type keyword")}function G5(e,t){let r=e.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,DS.shouldUseRule)(e.schema,n)){let{type:i}=n.definition;if(i.length&&!i.some((s)=>J5(t,s)))jS(e,`missing type "${i.join(",")}" for keyword "${o}"`)}}}function J5(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function rC(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function X5(e,t){let r=[];for(let o of e.dataTypes)if(rC(t,o))r.push(o);else if(t.includes("integer")&&o==="number")r.push("integer");e.dataTypes=r}function jS(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,rn.checkStrictMode)(e,t,e.opts.strictTypes)}class zS{constructor(e,t,r){if((0,Cl.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,rn.schemaRefOrVal)(e,this.schema,r,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",oC(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Cl.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",X.default.errors)}result(e,t,r){this.failResult((0,q.not)(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();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,q.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(q._`${t} !== undefined && (${(0,q.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?Al.reportExtraError:Al.reportError)(this,this.def.error,t)}$dataError(){(0,Al.reportError)(this,this.def.$dataError||Al.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,Al.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,r=q.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=q.nil,t=q.nil){if(!this.$data)return;let{gen:r,schemaCode:o,schemaType:n,def:i}=this;if(r.if((0,q.or)(q._`${o} === undefined`,t)),e!==q.nil)r.assign(e,!0);if(n.length||i.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==q.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:o,it:n}=this;return(0,q.or)(i(),s());function i(){if(r.length){if(!(t instanceof q.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return q._`${(0,$m.checkDataTypes)(a,t,n.opts.strictNumbers,$m.DataType.Wrong)}`}return q.nil}function s(){if(o.validateSchema){let a=e.scopeValue("validate$data",{ref:o.validateSchema});return q._`!${a}(${t})`}return q.nil}}subschema(e,t){let r=(0,NS.getSubschema)(this.it,e);(0,NS.extendSubschemaData)(r,this.it,e),(0,NS.extendSubschemaMode)(r,e);let o={...this.it,...r,items:void 0,props:void 0};return z5(o,t),o}mergeEvaluated(e,t){let{it:r,gen:o}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=rn.mergeEvaluated.props(o,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=rn.mergeEvaluated.items(o,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:o}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return o.if(t,()=>this.mergeEvaluated(e,q.Name)),!0}}iC.KeywordCxt=zS;function nC(e,t,r,o){let n=new zS(e,r,t);if("code"in r)r.code(n,o);else if(n.$data&&r.validate)(0,Cl.funcKeywordCode)(n,r);else if("macro"in r)(0,Cl.macroKeywordCode)(n,r);else if(r.compile||r.validate)(0,Cl.funcKeywordCode)(n,r)}var Y5=/^\/(?:[^~]|~0|~1)*$/,Q5=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function oC(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,i;if(e==="")return X.default.rootData;if(e[0]==="/"){if(!Y5.test(e))throw Error(`Invalid JSON-pointer: ${e}`);n=e,i=X.default.rootData}else{let u=Q5.exec(e);if(!u)throw Error(`Invalid JSON-pointer: ${e}`);let d=+u[1];if(n=u[2],n==="#"){if(d>=t)throw Error(c("property/index",d));return o[t-d]}if(d>t)throw Error(c("data",d));if(i=r[t-d],!n)return i}let s=i,a=n.split("/");for(let u of a)if(u)i=q._`${i}${(0,q.getProperty)((0,rn.unescapeJsonPointer)(u))}`,s=q._`${s} && ${i}`;return s;function c(u,d){return`Cannot access ${u} ${d} levels up, current level is ${t}`}}iC.getData=oC});var Om=k((cC)=>{Object.defineProperty(cC,"__esModule",{value:!0});class aC extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}cC.default=aC});var Nl=k((uC)=>{Object.defineProperty(uC,"__esModule",{value:!0});var US=Ol();class lC extends Error{constructor(e,t,r,o){super(o||`can't resolve reference ${r} from id ${t}`);this.missingRef=(0,US.resolveUrl)(e,t,r),this.missingSchema=(0,US.normalizeId)((0,US.getFullPath)(e,this.missingRef))}}uC.default=lC});var Cm=k((fC)=>{Object.defineProperty(fC,"__esModule",{value:!0});fC.resolveSchema=fC.getCompilingSchema=fC.resolveRef=fC.compileSchema=fC.SchemaEnv=void 0;var hr=te(),o3=Om(),zo=tn(),yr=Ol(),dC=ue(),i3=Ml();class Dl{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=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,yr.normalizeId)(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}fC.SchemaEnv=Dl;function FS(e){let t=pC.call(this,e);if(t)return t;let r=(0,yr.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:i}=this.opts,s=new hr.CodeGen(this.scope,{es5:o,lines:n,ownProperties:i}),a;if(e.$async)a=s.scopeValue("Error",{ref:o3.default,code:hr._`require("ajv/dist/runtime/validation_error").default`});let c=s.scopeName("validate");e.validateName=c;let u={gen:s,allErrors:this.opts.allErrors,data:zo.default.data,parentData:zo.default.parentData,parentDataProperty:zo.default.parentDataProperty,dataNames:[zo.default.data],dataPathArr:[hr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,hr.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:hr.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:hr._`""`,opts:this.opts,self:this},d;try{this._compilations.add(e),(0,i3.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);let p=s.toString();if(d=`${s.scopeRefs(zo.default.scope)}return ${p}`,this.opts.code.process)d=this.opts.code.process(d,e);let m=Function(`${zo.default.self}`,`${zo.default.scope}`,d)(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:s._values};if(this.opts.unevaluated){let{props:g,items:h}=u;if(m.evaluated={props:g instanceof hr.Name?void 0:g,items:h instanceof hr.Name?void 0:h,dynamicProps:g instanceof hr.Name,dynamicItems:h instanceof hr.Name},m.source)m.source.evaluated=(0,hr.stringify)(m.evaluated)}return e.validate=m,e}catch(p){if(delete e.validate,delete e.validateName,d)this.logger.error("Error compiling schema, function code:",d);throw p}finally{this._compilations.delete(e)}}fC.compileSchema=FS;function s3(e,t,r){var o;r=(0,yr.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let i=l3.call(this,e,r);if(i===void 0){let s=(o=e.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;if(s)i=new Dl({schema:s,schemaId:a,root:e,baseId:t})}if(i===void 0)return;return e.refs[r]=a3.call(this,i)}fC.resolveRef=s3;function a3(e){if((0,yr.inlineRef)(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:FS.call(this,e)}function pC(e){for(let t of this._compilations)if(c3(t,e))return t}fC.getCompilingSchema=pC;function c3(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function l3(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||Am.call(this,e,t)}function Am(e,t){let r=this.opts.uriResolver.parse(t),o=(0,yr._getFullPath)(this.opts.uriResolver,r),n=(0,yr.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===n)return LS.call(this,r,e);let i=(0,yr.normalizeId)(o),s=this.refs[i]||this.schemas[i];if(typeof s=="string"){let a=Am.call(this,e,s);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return LS.call(this,r,a)}if(typeof(s===null||s===void 0?void 0:s.schema)!=="object")return;if(!s.validate)FS.call(this,s);if(i===(0,yr.normalizeId)(t)){let{schema:a}=s,{schemaId:c}=this.opts,u=a[c];if(u)n=(0,yr.resolveUrl)(this.opts.uriResolver,n,u);return new Dl({schema:a,schemaId:c,root:e,baseId:n})}return LS.call(this,r,s)}fC.resolveSchema=Am;var u3=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function LS(e,{baseId:t,schema:r,root:o}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let c=r[(0,dC.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r==="object"&&r[this.opts.schemaId];if(!u3.has(a)&&u)t=(0,yr.resolveUrl)(this.opts.uriResolver,t,u)}let i;if(typeof r!="boolean"&&r.$ref&&!(0,dC.schemaHasRulesButRef)(r,this.RULES)){let a=(0,yr.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=Am.call(this,o,a)}let{schemaId:s}=this.opts;if(i=i||new Dl({schema:r,schemaId:s,root:o,baseId:t}),i.schema!==i.root.schema)return i;return}});var gC=k((Kke,g3)=>{g3.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 qS=k((Gke,SC)=>{var h3=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),yC=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),HS=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),bC=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),y3=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function BS(e){let t="",r=0,o=0;for(o=0;o<e.length;o++){if(r=e[o].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(r=e[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}var b3=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function hC(e){return e.length=0,!0}function _3(e,t,r){if(e.length){let o=BS(e);if(o!=="")t.push(o);else return r.error=!0,!1;e.length=0}return!0}function v3(e){let t=0,r={error:!1,address:"",zone:""},o=[],n=[],i=!1,s=!1,a=_3;for(let c=0;c<e.length;c++){let u=e[c];if(u==="["||u==="]")continue;if(u===":"){if(i===!0)s=!0;if(!a(n,o,r))break;if(++t>7){r.error=!0;break}if(c>0&&e[c-1]===":")i=!0;o.push(":");continue}else if(u==="%"){if(!a(n,o,r))break;a=hC}else{n.push(u);continue}}if(n.length)if(a===hC)r.zone=n.join("");else if(s)o.push(n.join(""));else o.push(BS(n));return r.address=o.join(""),r}function _C(e){if(S3(e,":")<2)return{host:e,isIPV6:!1};let t=v3(e);if(!t.error){let{address:r,address:o}=t;if(t.zone)r+="%"+t.zone,o+="%25"+t.zone;return{host:r,isIPV6:!0,escapedHost:o}}else return{host:e,isIPV6:!1}}function S3(e,t){let r=0;for(let o=0;o<e.length;o++)if(e[o]===t)r++;return r}function x3(e){let t=e,r=[],o=-1,n=0;while(n=t.length){if(n===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(n===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]==="/"){r.push("/");break}}}else if(n===3){if(t==="/.."){if(r.length!==0)r.pop();r.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),r.length!==0)r.pop();continue}}}}if((o=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")}var w3={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},k3=/[@/?#:]/g,T3=/[@/?#]/g;function vC(e,t){let r=t?T3:k3;return r.lastIndex=0,e.replace(r,(o)=>w3[o])}function E3(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let o=0;o<e.length;o++){if(e[o]==="%"&&o+2<e.length){let n=e.slice(o+1,o+3);if(HS(n)){let i=n.toUpperCase(),s=String.fromCharCode(parseInt(i,16));if(t&&bC(s))r+=s;else r+="%"+i;o+=2;continue}}r+=e[o]}return r}function P3(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(HS(o)){let n=o.toUpperCase(),i=String.fromCharCode(parseInt(n,16));if(i!=="."&&bC(i))t+=i;else t+="%"+n;r+=2;continue}}if(y3(e[r]))t+=e[r];else t+=escape(e[r])}return t}function I3(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(HS(o)){t+="%"+o.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function R3(e){let t=[];if(e.userinfo!==void 0)t.push(e.userinfo),t.push("@");if(e.host!==void 0){let r=unescape(e.host);if(!yC(r)){let o=_C(r);if(o.isIPV6===!0)r=`[${o.escapedHost}]`;else r=vC(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string")t.push(":"),t.push(String(e.port));return t.length?t.join(""):void 0}SC.exports={nonSimpleDomain:b3,recomposeAuthority:R3,reescapeHostDelimiters:vC,normalizePercentEncoding:E3,normalizePathEncoding:P3,escapePreservingEscapes:I3,removeDotSegments:x3,isIPv4:yC,isUUID:h3,normalizeIPv6:_C,stringArrayToHexStripped:BS}});var EC=k((Jke,TC)=>{var{isUUID:$3}=qS(),O3=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,A3=["http","https","ws","wss","urn","urn:uuid"];function C3(e){return A3.indexOf(e)!==-1}function ZS(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 xC(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function wC(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 M3(e){return e.secure=ZS(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function N3(e){if(e.port===(ZS(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,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function D3(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(O3);if(r){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${o}:${t.nid||e.nid}`,i=VS(n);if(e.path=void 0,i)e=i.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function j3(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,i=VS(n);if(i)e=i.serialize(e,t);let s=e,a=e.nss;return s.path=`${o||t.nid}:${a}`,t.skipEscape=!0,s}function z3(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!$3(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function U3(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var kC={scheme:"http",domainHost:!0,parse:xC,serialize:wC},L3={scheme:"https",domainHost:kC.domainHost,parse:xC,serialize:wC},Mm={scheme:"ws",domainHost:!0,parse:M3,serialize:N3},F3={scheme:"wss",domainHost:Mm.domainHost,parse:Mm.parse,serialize:Mm.serialize},H3={scheme:"urn",parse:D3,serialize:j3,skipNormalize:!0},B3={scheme:"urn:uuid",parse:z3,serialize:U3,skipNormalize:!0},Nm={http:kC,https:L3,ws:Mm,wss:F3,urn:H3,"urn:uuid":B3};Object.setPrototypeOf(Nm,null);function VS(e){return e&&(Nm[e]||Nm[e.toLowerCase()])||void 0}TC.exports={wsIsSecure:ZS,SCHEMES:Nm,isValidSchemeName:C3,getSchemeHandler:VS}});var AC=k((Xke,Dm)=>{var{normalizeIPv6:q3,removeDotSegments:jl,recomposeAuthority:Z3,normalizePercentEncoding:V3,normalizePathEncoding:W3,escapePreservingEscapes:K3,reescapeHostDelimiters:G3,isIPv4:J3,nonSimpleDomain:X3}=qS(),{SCHEMES:Y3,getSchemeHandler:IC}=EC();function Q3(e,t){if(typeof e==="string")e=o8(e,t);else if(typeof e==="object")e=bs(Uo(e,t),t);return e}function e8(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=RC(bs(e,o),bs(t,o),o,!0);return o.skipEscape=!0,Uo(n,o)}function RC(e,t,r,o){let n={};if(!o)e=bs(Uo(e,r),r),t=bs(Uo(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=jl(t.path||""),n.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=jl(t.path||""),n.query=t.query;else{if(!t.path)if(n.path=e.path,t.query!==void 0)n.query=t.query;else n.query=e.query;else{if(t.path[0]==="/")n.path=jl(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)n.path="/"+t.path;else if(!e.path)n.path=t.path;else n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;n.path=jl(n.path)}n.query=t.query}n.userinfo=e.userinfo,n.host=e.host,n.port=e.port}n.scheme=e.scheme}return n.fragment=t.fragment,n}function t8(e,t,r){let o=PC(e,r),n=PC(t,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function Uo(e,t){let r={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:""},o=Object.assign({},t),n=[],i=IC(o.scheme||r.scheme);if(i&&i.serialize)i.serialize(r,o);if(r.path!==void 0)if(!o.skipEscape){if(r.path=K3(r.path),r.scheme!==void 0)r.path=r.path.split("%3A").join(":")}else r.path=V3(r.path);if(o.reference!=="suffix"&&r.scheme)n.push(r.scheme,":");let s=Z3(r);if(s!==void 0){if(o.reference!=="suffix")n.push("//");if(n.push(s),r.path&&r.path[0]!=="/")n.push("/")}if(r.path!==void 0){let a=r.path;if(!o.absolutePath&&(!i||!i.absolutePath))a=jl(a);if(s===void 0&&a[0]==="/"&&a[1]==="/")a="/%2F"+a.slice(2);n.push(a)}if(r.query!==void 0)n.push("?",r.query);if(r.fragment!==void 0)n.push("#",r.fragment);return n.join("")}var r8=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function n8(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 $C(e,t){let r=Object.assign({},t),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,i=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let s=e.match(r8);if(s){if(o.scheme=s[1],o.userinfo=s[3],o.host=s[4],o.port=parseInt(s[5],10),o.path=s[6]||"",o.query=s[7],o.fragment=s[8],isNaN(o.port))o.port=s[5];let a=n8(o,s);if(a!==void 0)o.error=o.error||a,n=!0;if(o.host)if(J3(o.host)===!1){let d=q3(o.host);o.host=d.host.toLowerCase(),i=d.isIPV6}else i=!0;if(o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path)o.reference="same-document";else if(o.scheme===void 0)o.reference="relative";else if(o.fragment===void 0)o.reference="absolute";else o.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==o.reference)o.error=o.error||"URI is not a "+r.reference+" reference.";let c=IC(r.scheme||o.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)){if(o.host&&(r.domainHost||c&&c.domainHost)&&i===!1&&X3(o.host))try{o.host=URL.domainToASCII(o.host.toLowerCase())}catch(u){o.error=o.error||"Host's domain name can not be converted to ASCII: "+u}}if(!c||c&&!c.skipNormalize){if(e.indexOf("%")!==-1){if(o.scheme!==void 0)o.scheme=unescape(o.scheme);if(o.host!==void 0)o.host=G3(unescape(o.host),i)}if(o.path)o.path=W3(o.path);if(o.fragment)try{o.fragment=encodeURI(decodeURIComponent(o.fragment))}catch{o.error=o.error||"URI malformed"}}if(c&&c.parse)c.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n}}function bs(e,t){return $C(e,t).parsed}function o8(e,t){return OC(e,t).normalized}function OC(e,t){let{parsed:r,malformedAuthorityOrPort:o}=$C(e,t);return{normalized:o?e:Uo(r,t),malformedAuthorityOrPort:o}}function PC(e,t){if(typeof e==="string"){let{normalized:r,malformedAuthorityOrPort:o}=OC(e,t);return o?void 0:r}if(typeof e==="object")return Uo(e,t)}var WS={SCHEMES:Y3,normalize:Q3,resolve:e8,resolveComponent:RC,equal:t8,serialize:Uo,parse:bs};Dm.exports=WS;Dm.exports.default=WS;Dm.exports.fastUri=WS});var NC=k((MC)=>{Object.defineProperty(MC,"__esModule",{value:!0});var CC=AC();CC.code='require("ajv/dist/runtime/uri").default';MC.default=CC});var BC=k((nn)=>{Object.defineProperty(nn,"__esModule",{value:!0});nn.CodeGen=nn.Name=nn.nil=nn.stringify=nn.str=nn._=nn.KeywordCxt=void 0;var s8=Ml();Object.defineProperty(nn,"KeywordCxt",{enumerable:!0,get:function(){return s8.KeywordCxt}});var _s=te();Object.defineProperty(nn,"_",{enumerable:!0,get:function(){return _s._}});Object.defineProperty(nn,"str",{enumerable:!0,get:function(){return _s.str}});Object.defineProperty(nn,"stringify",{enumerable:!0,get:function(){return _s.stringify}});Object.defineProperty(nn,"nil",{enumerable:!0,get:function(){return _s.nil}});Object.defineProperty(nn,"Name",{enumerable:!0,get:function(){return _s.Name}});Object.defineProperty(nn,"CodeGen",{enumerable:!0,get:function(){return _s.CodeGen}});var a8=Om(),LC=Nl(),c8=TS(),zl=Cm(),l8=te(),Ul=Ol(),jm=$l(),GS=ue(),DC=gC(),u8=NC(),FC=(e,t)=>new RegExp(e,t);FC.code="new RegExp";var d8=["removeAdditional","useDefaults","coerceTypes"],p8=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),f8={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."},m8={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},jC=200;function g8(e){var t,r,o,n,i,s,a,c,u,d,p,f,m,g,h,y,v,x,w,O,L,se,Ue,Ye,Ft;let bt=e.strict,Qn=(t=e.code)===null||t===void 0?void 0:t.optimize,Go=Qn===!0||Qn===void 0?1:Qn||0,Or=(o=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:FC,Ms=(n=e.uriResolver)!==null&&n!==void 0?n:u8.default;return{strictSchema:(s=(i=e.strictSchema)!==null&&i!==void 0?i:bt)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:bt)!==null&&c!==void 0?c:!0,strictTypes:(d=(u=e.strictTypes)!==null&&u!==void 0?u:bt)!==null&&d!==void 0?d:"log",strictTuples:(f=(p=e.strictTuples)!==null&&p!==void 0?p:bt)!==null&&f!==void 0?f:"log",strictRequired:(g=(m=e.strictRequired)!==null&&m!==void 0?m:bt)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:Go,regExp:Or}:{optimize:Go,regExp:Or},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:jC,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:jC,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(x=e.messages)!==null&&x!==void 0?x:!0,inlineRefs:(w=e.inlineRefs)!==null&&w!==void 0?w:!0,schemaId:(O=e.schemaId)!==null&&O!==void 0?O:"$id",addUsedSchema:(L=e.addUsedSchema)!==null&&L!==void 0?L:!0,validateSchema:(se=e.validateSchema)!==null&&se!==void 0?se:!0,validateFormats:(Ue=e.validateFormats)!==null&&Ue!==void 0?Ue:!0,unicodeRegExp:(Ye=e.unicodeRegExp)!==null&&Ye!==void 0?Ye:!0,int32range:(Ft=e.int32range)!==null&&Ft!==void 0?Ft:!0,uriResolver:Ms}}class zm{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...g8(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new l8.ValueScope({scope:{},prefixes:p8,es5:t,lines:r}),this.logger=S8(e.logger);let o=e.validateFormats;if(e.validateFormats=!1,this.RULES=(0,c8.getRules)(),zC.call(this,f8,e,"NOT SUPPORTED"),zC.call(this,m8,e,"DEPRECATED","warn"),this._metaOpts=_8.call(this),e.formats)y8.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)b8.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);h8.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,o=DC;if(r==="id")o={...DC},o.id=o.$id,delete o.$id;if(t&&e)this.addMetaSchema(o,o[r],!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 r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let o=r(t);if(!("$async"in r))this.errors=r.errors;return o}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return o.call(this,e,t);async function o(u,d){await n.call(this,u.$schema);let p=this._addSchema(u,d);return p.validate||i.call(this,p)}async function n(u){if(u&&!this.getSchema(u))await o.call(this,{$ref:u},!0)}async function i(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof LC.default))throw d;return s.call(this,d),await a.call(this,d.missingSchema),i.call(this,u)}}function s({missingSchema:u,missingRef:d}){if(this.refs[u])throw Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function a(u){let d=await c.call(this,u);if(!this.refs[u])await n.call(this,d.$schema);if(!this.refs[u])this.addSchema(d,u,t)}async function c(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=r(u))}finally{delete this._loading[u]}}}addSchema(e,t,r,o=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,r,o);return this}let n;if(typeof e==="object"){let{schemaId:i}=this.opts;if(n=e[i],n!==void 0&&typeof n!="string")throw Error(`schema ${i} must be string`)}return t=(0,Ul.normalizeId)(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,o,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(r,e);if(!o&&t){let n="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(n);else throw Error(n)}return o}getSchema(e){let t;while(typeof(t=UC.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,o=new zl.SchemaEnv({schema:{},schemaId:r});if(t=zl.resolveSchema.call(this,o,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=UC.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 r=e[this.opts.schemaId];if(r)r=(0,Ul.normalizeId)(r),delete this.schemas[r],delete this.refs[r];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 r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(w8.call(this,r,t),!t)return(0,GS.eachItem)(r,(n)=>KS.call(this,n)),this;T8.call(this,t);let o={...t,type:(0,jm.getJSONTypes)(t.type),schemaType:(0,jm.getJSONTypes)(t.schemaType)};return(0,GS.eachItem)(r,o.type.length===0?(n)=>KS.call(this,n,o):(n)=>o.type.forEach((i)=>KS.call(this,n,o,i))),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 r of t.rules){let o=r.rules.findIndex((n)=>n.keyword===e);if(o>=0)r.rules.splice(o,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:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((o)=>`${r}${o.instancePath} ${o.message}`).reduce((o,n)=>o+t+n)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of t){let n=o.split("/").slice(1),i=e;for(let s of n)i=i[s];for(let s in r){let a=r[s];if(typeof a!="object")continue;let{$data:c}=a.definition,u=i[s];if(c&&u)i[s]=HC(u)}}return e}_removeAllSchemas(e,t){for(let r in e){let o=e[r];if(!t||t.test(r)){if(typeof o=="string")delete e[r];else if(o&&!o.meta)this._cache.delete(o.schema),delete e[r]}}}_addSchema(e,t,r,o=this.opts.validateSchema,n=this.opts.addUsedSchema){let i,{schemaId:s}=this.opts;if(typeof e=="object")i=e[s];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;r=(0,Ul.normalizeId)(i||r);let c=Ul.getSchemaRefs.call(this,e,r);if(a=new zl.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:r,localRefs:c}),this._cache.set(a.schema,a),n&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(o)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 zl.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{zl.compileSchema.call(this,e)}finally{this.opts=t}}}zm.ValidationError=a8.default;zm.MissingRefError=LC.default;nn.default=zm;function zC(e,t,r,o="error"){for(let n in e){let i=n;if(i in t)this.logger[o](`${r}: option ${n}. ${e[i]}`)}}function UC(e){return e=(0,Ul.normalizeId)(e),this.schemas[e]||this.refs[e]}function h8(){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 y8(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function b8(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 r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function _8(){let e={...this.opts};for(let t of d8)delete e[t];return e}var v8={log(){},warn(){},error(){}};function S8(e){if(e===!1)return v8;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 x8=/^[a-z_$][a-z0-9_$:-]*$/i;function w8(e,t){let{RULES:r}=this;if((0,GS.eachItem)(e,(o)=>{if(r.keywords[o])throw Error(`Keyword ${o} is already defined`);if(!x8.test(o))throw Error(`Keyword ${o} 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 KS(e,t,r){var o;let n=t===null||t===void 0?void 0:t.post;if(r&&n)throw Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,s=n?i.post:i.rules.find(({type:c})=>c===r);if(!s)s={type:r,rules:[]},i.rules.push(s);if(i.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,jm.getJSONTypes)(t.type),schemaType:(0,jm.getJSONTypes)(t.schemaType)}};if(t.before)k8.call(this,s,a,t.before);else s.rules.push(a);i.all[e]=a,(o=t.implements)===null||o===void 0||o.forEach((c)=>this.addKeyword(c))}function k8(e,t,r){let o=e.rules.findIndex((n)=>n.keyword===r);if(o>=0)e.rules.splice(o,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function T8(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=HC(t);e.validateSchema=this.compile(t,!0)}var E8={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function HC(e){return{anyOf:[e,E8]}}});var ZC=k((qC)=>{Object.defineProperty(qC,"__esModule",{value:!0});var R8={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};qC.default=R8});var XC=k((GC)=>{Object.defineProperty(GC,"__esModule",{value:!0});GC.callRef=GC.getValidate=void 0;var O8=Nl(),VC=er(),Rt=te(),vs=tn(),WC=Cm(),Um=ue(),A8={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:o}=e,{baseId:n,schemaEnv:i,validateName:s,opts:a,self:c}=o,{root:u}=i;if((r==="#"||r==="#/")&&n===u.baseId)return p();let d=WC.resolveRef.call(c,u,n,r);if(d===void 0)throw new O8.default(o.opts.uriResolver,n,r);if(d instanceof WC.SchemaEnv)return f(d);return m(d);function p(){if(i===u)return Lm(e,s,i,i.$async);let g=t.scopeValue("root",{ref:u});return Lm(e,Rt._`${g}.validate`,u,u.$async)}function f(g){let h=KC(e,g);Lm(e,h,g,g.$async)}function m(g){let h=t.scopeValue("schema",a.code.source===!0?{ref:g,code:(0,Rt.stringify)(g)}:{ref:g}),y=t.name("valid"),v=e.subschema({schema:g,dataTypes:[],schemaPath:Rt.nil,topSchemaRef:h,errSchemaPath:r},y);e.mergeEvaluated(v),e.ok(y)}}};function KC(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):Rt._`${r.scopeValue("wrapper",{ref:t})}.validate`}GC.getValidate=KC;function Lm(e,t,r,o){let{gen:n,it:i}=e,{allErrors:s,schemaEnv:a,opts:c}=i,u=c.passContext?vs.default.this:Rt.nil;if(o)d();else p();function d(){if(!a.$async)throw Error("async schema referenced by sync schema");let g=n.let("valid");n.try(()=>{if(n.code(Rt._`await ${(0,VC.callValidateCode)(e,t,u)}`),m(t),!s)n.assign(g,!0)},(h)=>{if(n.if(Rt._`!(${h} instanceof ${i.ValidationError})`,()=>n.throw(h)),f(h),!s)n.assign(g,!1)}),e.ok(g)}function p(){e.result((0,VC.callValidateCode)(e,t,u),()=>m(t),()=>f(t))}function f(g){let h=Rt._`${g}.errors`;n.assign(vs.default.vErrors,Rt._`${vs.default.vErrors} === null ? ${h} : ${vs.default.vErrors}.concat(${h})`),n.assign(vs.default.errors,Rt._`${vs.default.vErrors}.length`)}function m(g){var h;if(!i.opts.unevaluated)return;let y=(h=r===null||r===void 0?void 0:r.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(y&&!y.dynamicProps){if(y.props!==void 0)i.props=Um.mergeEvaluated.props(n,y.props,i.props)}else{let v=n.var("props",Rt._`${g}.evaluated.props`);i.props=Um.mergeEvaluated.props(n,v,i.props,Rt.Name)}if(i.items!==!0)if(y&&!y.dynamicItems){if(y.items!==void 0)i.items=Um.mergeEvaluated.items(n,y.items,i.items)}else{let v=n.var("items",Rt._`${g}.evaluated.items`);i.items=Um.mergeEvaluated.items(n,v,i.items,Rt.Name)}}}GC.callRef=Lm;GC.default=A8});var QC=k((YC)=>{Object.defineProperty(YC,"__esModule",{value:!0});var N8=ZC(),D8=XC(),j8=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",N8.default,D8.default];YC.default=j8});var tM=k((eM)=>{Object.defineProperty(eM,"__esModule",{value:!0});var Fm=te(),Hn=Fm.operators,Hm={maximum:{okStr:"<=",ok:Hn.LTE,fail:Hn.GT},minimum:{okStr:">=",ok:Hn.GTE,fail:Hn.LT},exclusiveMaximum:{okStr:"<",ok:Hn.LT,fail:Hn.GTE},exclusiveMinimum:{okStr:">",ok:Hn.GT,fail:Hn.LTE}},U8={message:({keyword:e,schemaCode:t})=>Fm.str`must be ${Hm[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Fm._`{comparison: ${Hm[e].okStr}, limit: ${t}}`},L8={keyword:Object.keys(Hm),type:"number",schemaType:"number",$data:!0,error:U8,code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data(Fm._`${r} ${Hm[t].fail} ${o} || isNaN(${r})`)}};eM.default=L8});var nM=k((rM)=>{Object.defineProperty(rM,"__esModule",{value:!0});var Ll=te(),H8={message:({schemaCode:e})=>Ll.str`must be multiple of ${e}`,params:({schemaCode:e})=>Ll._`{multipleOf: ${e}}`},B8={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:H8,code(e){let{gen:t,data:r,schemaCode:o,it:n}=e,i=n.opts.multipleOfPrecision,s=t.let("res"),a=i?Ll._`Math.abs(Math.round(${s}) - ${s}) > 1e-${i}`:Ll._`${s} !== parseInt(${s})`;e.fail$data(Ll._`(${o} === 0 || (${s} = ${r}/${o}, ${a}))`)}};rM.default=B8});var sM=k((iM)=>{Object.defineProperty(iM,"__esModule",{value:!0});function oM(e){let t=e.length,r=0,o=0,n;while(o<t)if(r++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<t){if(n=e.charCodeAt(o),(n&64512)===56320)o++}return r}iM.default=oM;oM.code='require("ajv/dist/runtime/ucs2length").default'});var cM=k((aM)=>{Object.defineProperty(aM,"__esModule",{value:!0});var Lo=te(),V8=ue(),W8=sM(),K8={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return Lo.str`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>Lo._`{limit: ${e}}`},G8={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:K8,code(e){let{keyword:t,data:r,schemaCode:o,it:n}=e,i=t==="maxLength"?Lo.operators.GT:Lo.operators.LT,s=n.opts.unicode===!1?Lo._`${r}.length`:Lo._`${(0,V8.useFunc)(e.gen,W8.default)}(${r})`;e.fail$data(Lo._`${s} ${i} ${o}`)}};aM.default=G8});var uM=k((lM)=>{Object.defineProperty(lM,"__esModule",{value:!0});var X8=er(),Y8=ue(),Ss=te(),Q8={message:({schemaCode:e})=>Ss.str`must match pattern "${e}"`,params:({schemaCode:e})=>Ss._`{pattern: ${e}}`},eX={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Q8,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:i,it:s}=e,a=s.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=s.opts.code,u=c.code==="new RegExp"?Ss._`new RegExp`:(0,Y8.useFunc)(t,c),d=t.let("valid");t.try(()=>t.assign(d,Ss._`${u}(${i}, ${a}).test(${r})`),()=>t.assign(d,!1)),e.fail$data(Ss._`!${d}`)}else{let c=(0,X8.usePattern)(e,n);e.fail$data(Ss._`!${c}.test(${r})`)}}};lM.default=eX});var pM=k((dM)=>{Object.defineProperty(dM,"__esModule",{value:!0});var Fl=te(),rX={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return Fl.str`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>Fl._`{limit: ${e}}`},nX={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:rX,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxProperties"?Fl.operators.GT:Fl.operators.LT;e.fail$data(Fl._`Object.keys(${r}).length ${n} ${o}`)}};dM.default=nX});var mM=k((fM)=>{Object.defineProperty(fM,"__esModule",{value:!0});var Hl=er(),Bl=te(),iX=ue(),sX={message:({params:{missingProperty:e}})=>Bl.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Bl._`{missingProperty: ${e}}`},aX={keyword:"required",type:"object",schemaType:"array",$data:!0,error:sX,code(e){let{gen:t,schema:r,schemaCode:o,data:n,$data:i,it:s}=e,{opts:a}=s;if(!i&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors)u();else d();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:g}=e.it;for(let h of r)if((m===null||m===void 0?void 0:m[h])===void 0&&!g.has(h)){let y=s.schemaEnv.baseId+s.errSchemaPath,v=`required property "${h}" is not defined at "${y}" (strictRequired)`;(0,iX.checkStrictMode)(s,v,s.opts.strictRequired)}}function u(){if(c||i)e.block$data(Bl.nil,p);else for(let m of r)(0,Hl.checkReportMissingProp)(e,m)}function d(){let m=t.let("missing");if(c||i){let g=t.let("valid",!0);e.block$data(g,()=>f(m,g)),e.ok(g)}else t.if((0,Hl.checkMissingProp)(e,r,m)),(0,Hl.reportMissingProp)(e,m),t.else()}function p(){t.forOf("prop",o,(m)=>{e.setParams({missingProperty:m}),t.if((0,Hl.noPropertyInData)(t,n,m,a.ownProperties),()=>e.error())})}function f(m,g){e.setParams({missingProperty:m}),t.forOf(m,o,()=>{t.assign(g,(0,Hl.propertyInData)(t,n,m,a.ownProperties)),t.if((0,Bl.not)(g),()=>{e.error(),t.break()})},Bl.nil)}}};fM.default=aX});var hM=k((gM)=>{Object.defineProperty(gM,"__esModule",{value:!0});var ql=te(),lX={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return ql.str`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>ql._`{limit: ${e}}`},uX={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:lX,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxItems"?ql.operators.GT:ql.operators.LT;e.fail$data(ql._`${r}.length ${n} ${o}`)}};gM.default=uX});var Bm=k((bM)=>{Object.defineProperty(bM,"__esModule",{value:!0});var yM=CS();yM.code='require("ajv/dist/runtime/equal").default';bM.default=yM});var vM=k((_M)=>{Object.defineProperty(_M,"__esModule",{value:!0});var JS=$l(),ot=te(),fX=ue(),mX=Bm(),gX={message:({params:{i:e,j:t}})=>ot.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>ot._`{i: ${e}, j: ${t}}`},hX={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:gX,code(e){let{gen:t,data:r,$data:o,schema:n,parentSchema:i,schemaCode:s,it:a}=e;if(!o&&!n)return;let c=t.let("valid"),u=i.items?(0,JS.getSchemaTypes)(i.items):[];e.block$data(c,d,ot._`${s} === false`),e.ok(c);function d(){let g=t.let("i",ot._`${r}.length`),h=t.let("j");e.setParams({i:g,j:h}),t.assign(c,!0),t.if(ot._`${g} > 1`,()=>(p()?f:m)(g,h))}function p(){return u.length>0&&!u.some((g)=>g==="object"||g==="array")}function f(g,h){let y=t.name("item"),v=(0,JS.checkDataTypes)(u,y,a.opts.strictNumbers,JS.DataType.Wrong),x=t.const("indices",ot._`{}`);t.for(ot._`;${g}--;`,()=>{if(t.let(y,ot._`${r}[${g}]`),t.if(v,ot._`continue`),u.length>1)t.if(ot._`typeof ${y} == "string"`,ot._`${y} += "_"`);t.if(ot._`typeof ${x}[${y}] == "number"`,()=>{t.assign(h,ot._`${x}[${y}]`),e.error(),t.assign(c,!1).break()}).code(ot._`${x}[${y}] = ${g}`)})}function m(g,h){let y=(0,fX.useFunc)(t,mX.default),v=t.name("outer");t.label(v).for(ot._`;${g}--;`,()=>t.for(ot._`${h} = ${g}; ${h}--;`,()=>t.if(ot._`${y}(${r}[${g}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(v)})))}}};_M.default=hX});var xM=k((SM)=>{Object.defineProperty(SM,"__esModule",{value:!0});var XS=te(),bX=ue(),_X=Bm(),vX={message:"must be equal to constant",params:({schemaCode:e})=>XS._`{allowedValue: ${e}}`},SX={keyword:"const",$data:!0,error:vX,code(e){let{gen:t,data:r,$data:o,schemaCode:n,schema:i}=e;if(o||i&&typeof i=="object")e.fail$data(XS._`!${(0,bX.useFunc)(t,_X.default)}(${r}, ${n})`);else e.fail(XS._`${i} !== ${r}`)}};SM.default=SX});var kM=k((wM)=>{Object.defineProperty(wM,"__esModule",{value:!0});var Zl=te(),wX=ue(),kX=Bm(),TX={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Zl._`{allowedValues: ${e}}`},EX={keyword:"enum",schemaType:"array",$data:!0,error:TX,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:i,it:s}=e;if(!o&&n.length===0)throw Error("enum must have non-empty array");let a=n.length>=s.opts.loopEnum,c,u=()=>c!==null&&c!==void 0?c:c=(0,wX.useFunc)(t,kX.default),d;if(a||o)d=t.let("valid"),e.block$data(d,p);else{if(!Array.isArray(n))throw Error("ajv implementation error");let m=t.const("vSchema",i);d=(0,Zl.or)(...n.map((g,h)=>f(m,h)))}e.pass(d);function p(){t.assign(d,!1),t.forOf("v",i,(m)=>t.if(Zl._`${u()}(${r}, ${m})`,()=>t.assign(d,!0).break()))}function f(m,g){let h=n[g];return typeof h==="object"&&h!==null?Zl._`${u()}(${r}, ${m}[${g}])`:Zl._`${r} === ${h}`}}};wM.default=EX});var EM=k((TM)=>{Object.defineProperty(TM,"__esModule",{value:!0});var IX=tM(),RX=nM(),$X=cM(),OX=uM(),AX=pM(),CX=mM(),MX=hM(),NX=vM(),DX=xM(),jX=kM(),zX=[IX.default,RX.default,$X.default,OX.default,AX.default,CX.default,MX.default,NX.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},DX.default,jX.default];TM.default=zX});var QS=k((IM)=>{Object.defineProperty(IM,"__esModule",{value:!0});IM.validateAdditionalItems=void 0;var Fo=te(),YS=ue(),LX={message:({params:{len:e}})=>Fo.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Fo._`{limit: ${e}}`},FX={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:LX,code(e){let{parentSchema:t,it:r}=e,{items:o}=t;if(!Array.isArray(o)){(0,YS.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}PM(e,o)}};function PM(e,t){let{gen:r,schema:o,data:n,keyword:i,it:s}=e;s.items=!0;let a=r.const("len",Fo._`${n}.length`);if(o===!1)e.setParams({len:t.length}),e.pass(Fo._`${a} <= ${t.length}`);else if(typeof o=="object"&&!(0,YS.alwaysValidSchema)(s,o)){let u=r.var("valid",Fo._`${a} <= ${t.length}`);r.if((0,Fo.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,(d)=>{if(e.subschema({keyword:i,dataProp:d,dataPropType:YS.Type.Num},u),!s.allErrors)r.if((0,Fo.not)(u),()=>r.break())})}}IM.validateAdditionalItems=PM;IM.default=FX});var ex=k((AM)=>{Object.defineProperty(AM,"__esModule",{value:!0});AM.validateTuple=void 0;var $M=te(),qm=ue(),BX=er(),qX={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return OM(e,"additionalItems",t);if(r.items=!0,(0,qm.alwaysValidSchema)(r,t))return;e.ok((0,BX.validateArray)(e))}};function OM(e,t,r=e.schema){let{gen:o,parentSchema:n,data:i,keyword:s,it:a}=e;if(d(n),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=qm.mergeEvaluated.items(o,r.length,a.items);let c=o.name("valid"),u=o.const("len",$M._`${i}.length`);r.forEach((p,f)=>{if((0,qm.alwaysValidSchema)(a,p))return;o.if($M._`${u} > ${f}`,()=>e.subschema({keyword:s,schemaProp:f,dataProp:f},c)),e.ok(c)});function d(p){let{opts:f,errSchemaPath:m}=a,g=r.length,h=g===p.minItems&&(g===p.maxItems||p[t]===!1);if(f.strictTuples&&!h){let y=`"${s}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;(0,qm.checkStrictMode)(a,y,f.strictTuples)}}}AM.validateTuple=OM;AM.default=qX});var NM=k((MM)=>{Object.defineProperty(MM,"__esModule",{value:!0});var VX=ex(),WX={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>(0,VX.validateTuple)(e,"items")};MM.default=WX});var zM=k((jM)=>{Object.defineProperty(jM,"__esModule",{value:!0});var DM=te(),GX=ue(),JX=er(),XX=QS(),YX={message:({params:{len:e}})=>DM.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>DM._`{limit: ${e}}`},QX={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:YX,code(e){let{schema:t,parentSchema:r,it:o}=e,{prefixItems:n}=r;if(o.items=!0,(0,GX.alwaysValidSchema)(o,t))return;if(n)(0,XX.validateAdditionalItems)(e,n);else e.ok((0,JX.validateArray)(e))}};jM.default=QX});var LM=k((UM)=>{Object.defineProperty(UM,"__esModule",{value:!0});var tr=te(),Zm=ue(),tY={message:({params:{min:e,max:t}})=>t===void 0?tr.str`must contain at least ${e} valid item(s)`:tr.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?tr._`{minContains: ${e}}`:tr._`{minContains: ${e}, maxContains: ${t}}`},rY={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:tY,code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:i}=e,s,a,{minContains:c,maxContains:u}=o;if(i.opts.next)s=c===void 0?1:c,a=u;else s=1;let d=t.const("len",tr._`${n}.length`);if(e.setParams({min:s,max:a}),a===void 0&&s===0){(0,Zm.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,Zm.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Zm.alwaysValidSchema)(i,r)){let h=tr._`${d} >= ${s}`;if(a!==void 0)h=tr._`${h} && ${d} <= ${a}`;e.pass(h);return}i.items=!0;let p=t.name("valid");if(a===void 0&&s===1)m(p,()=>t.if(p,()=>t.break()));else if(s===0){if(t.let(p,!0),a!==void 0)t.if(tr._`${n}.length > 0`,f)}else t.let(p,!1),f();e.result(p,()=>e.reset());function f(){let h=t.name("_valid"),y=t.let("count",0);m(h,()=>t.if(h,()=>g(y)))}function m(h,y){t.forRange("i",0,d,(v)=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:Zm.Type.Num,compositeRule:!0},h),y()})}function g(h){if(t.code(tr._`${h}++`),a===void 0)t.if(tr._`${h} >= ${s}`,()=>t.assign(p,!0).break());else if(t.if(tr._`${h} > ${a}`,()=>t.assign(p,!1).break()),s===1)t.assign(p,!0);else t.if(tr._`${h} >= ${s}`,()=>t.assign(p,!0))}}};UM.default=rY});var VM=k((BM)=>{Object.defineProperty(BM,"__esModule",{value:!0});BM.validateSchemaDeps=BM.validatePropertyDeps=BM.error=void 0;var tx=te(),oY=ue(),Vl=er();BM.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let o=t===1?"property":"properties";return tx.str`must have ${o} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>tx._`{property: ${e},
12
+ || ${s} === "boolean" || ${n} === null`).assign(a,ee._`[${n}]`)}}}function TJ({gen:e,parentData:t,parentDataProperty:r},o){e.if(ee._`${t} !== undefined`,()=>e.assign(ee._`${t}[${r}]`,o))}function IS(e,t,r,o=gs.Correct){let n=o===gs.Correct?ee.operators.EQ:ee.operators.NEQ,i;switch(e){case"null":return ee._`${t} ${n} null`;case"array":i=ee._`Array.isArray(${t})`;break;case"object":i=ee._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=s(ee._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=s();break;default:return ee._`typeof ${t} ${n} ${e}`}return o===gs.Correct?i:(0,ee.not)(i);function s(a=ee.nil){return(0,ee.and)(ee._`typeof ${t} == "number"`,a,r?ee._`isFinite(${t})`:ee.nil)}}vA.checkDataType=IS;function RS(e,t,r,o){if(e.length===1)return IS(e[0],t,r,o);let n,i=(0,yA.toHash)(e);if(i.array&&i.object){let s=ee._`typeof ${t} != "object"`;n=i.null?s:ee._`!${t} || ${s}`,delete i.null,delete i.array,delete i.object}else n=ee.nil;if(i.number)delete i.integer;for(let s in i)n=(0,ee.and)(n,IS(s,t,r,o));return n}vA.checkDataTypes=RS;var PJ={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?ee._`{type: ${e}}`:ee._`{type: ${t}}`};function $S(e){let t=IJ(e);(0,SJ.reportError)(t,PJ)}vA.reportTypeError=$S;function IJ(e){let{gen:t,data:r,schema:o}=e,n=(0,yA.schemaRefOrVal)(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:e}}});var EA=k((wA)=>{Object.defineProperty(wA,"__esModule",{value:!0});wA.assignDefaults=void 0;var hs=te(),NJ=ue();function DJ(e,t){let{properties:r,items:o}=e.schema;if(t==="object"&&r)for(let n in r)xA(e,n,r[n].default);else if(t==="array"&&Array.isArray(o))o.forEach((n,i)=>xA(e,i,n.default))}wA.assignDefaults=DJ;function xA(e,t,r){let{gen:o,compositeRule:n,data:i,opts:s}=e;if(r===void 0)return;let a=hs._`${i}${(0,hs.getProperty)(t)}`;if(n){(0,NJ.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=hs._`${a} === undefined`;if(s.useDefaults==="empty")c=hs._`${c} || ${a} === null || ${a} === ""`;o.if(c,hs._`${a} = ${(0,hs.stringify)(r)}`)}});var er=k((IA)=>{Object.defineProperty(IA,"__esModule",{value:!0});IA.validateUnion=IA.validateArray=IA.usePattern=IA.callValidateCode=IA.schemaProperties=IA.allSchemaProperties=IA.noPropertyInData=IA.propertyInData=IA.isOwnProperty=IA.hasPropFunc=IA.reportMissingProp=IA.checkMissingProp=IA.checkReportMissingProp=void 0;var Ae=te(),OS=ue(),Hn=tn(),jJ=ue();function zJ(e,t){let{gen:r,data:o,it:n}=e;r.if(CS(r,o,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:Ae._`${t}`},!0),e.error()})}IA.checkReportMissingProp=zJ;function UJ({gen:e,data:t,it:{opts:r}},o,n){return(0,Ae.or)(...o.map((i)=>(0,Ae.and)(CS(e,t,i,r.ownProperties),Ae._`${n} = ${i}`)))}IA.checkMissingProp=UJ;function LJ(e,t){e.setParams({missingProperty:t},!0),e.error()}IA.reportMissingProp=LJ;function TA(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Ae._`Object.prototype.hasOwnProperty`})}IA.hasPropFunc=TA;function AS(e,t,r){return Ae._`${TA(e)}.call(${t}, ${r})`}IA.isOwnProperty=AS;function FJ(e,t,r,o){let n=Ae._`${t}${(0,Ae.getProperty)(r)} !== undefined`;return o?Ae._`${n} && ${AS(e,t,r)}`:n}IA.propertyInData=FJ;function CS(e,t,r,o){let n=Ae._`${t}${(0,Ae.getProperty)(r)} === undefined`;return o?(0,Ae.or)(n,(0,Ae.not)(AS(e,t,r))):n}IA.noPropertyInData=CS;function PA(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}IA.allSchemaProperties=PA;function HJ(e,t){return PA(t).filter((r)=>!(0,OS.alwaysValidSchema)(e,t[r]))}IA.schemaProperties=HJ;function BJ({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:i},it:s},a,c,u){let d=u?Ae._`${e}, ${t}, ${o}${n}`:t,p=[[Hn.default.instancePath,(0,Ae.strConcat)(Hn.default.instancePath,i)],[Hn.default.parentData,s.parentData],[Hn.default.parentDataProperty,s.parentDataProperty],[Hn.default.rootData,Hn.default.rootData]];if(s.opts.dynamicRef)p.push([Hn.default.dynamicAnchors,Hn.default.dynamicAnchors]);let f=Ae._`${d}, ${r.object(...p)}`;return c!==Ae.nil?Ae._`${a}.call(${c}, ${f})`:Ae._`${a}(${f})`}IA.callValidateCode=BJ;var qJ=Ae._`new RegExp`;function ZJ({gen:e,it:{opts:t}},r){let o=t.unicodeRegExp?"u":"",{regExp:n}=t.code,i=n(r,o);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:Ae._`${n.code==="new RegExp"?qJ:(0,jJ.useFunc)(e,n)}(${r}, ${o})`})}IA.usePattern=ZJ;function VJ(e){let{gen:t,data:r,keyword:o,it:n}=e,i=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return s(()=>t.assign(a,!1)),a}return t.var(i,!0),s(()=>t.break()),i;function s(a){let c=t.const("len",Ae._`${r}.length`);t.forRange("i",0,c,(u)=>{e.subschema({keyword:o,dataProp:u,dataPropType:OS.Type.Num},i),t.if((0,Ae.not)(i),a)})}}IA.validateArray=VJ;function WJ(e){let{gen:t,schema:r,keyword:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((c)=>(0,OS.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let s=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let d=e.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);if(t.assign(s,Ae._`${s} || ${a}`),!e.mergeValidEvaluated(d,a))t.if((0,Ae.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}IA.validateUnion=WJ});var MA=k((AA)=>{Object.defineProperty(AA,"__esModule",{value:!0});AA.validateKeywordUsage=AA.validSchemaType=AA.funcKeywordCode=AA.macroKeywordCode=void 0;var yt=te(),Uo=tn(),s5=er(),a5=Rl();function c5(e,t){let{gen:r,keyword:o,schema:n,parentSchema:i,it:s}=e,a=t.macro.call(s.self,n,i,s),c=OA(r,o,a);if(s.opts.validateSchema!==!1)s.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:yt.nil,errSchemaPath:`${s.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}AA.macroKeywordCode=c5;function l5(e,t){var r;let{gen:o,keyword:n,schema:i,parentSchema:s,$data:a,it:c}=e;d5(c,t);let u=!a&&t.compile?t.compile.call(c.self,i,s,c):t.validate,d=OA(o,n,u),p=o.let("valid");e.block$data(p,f),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function f(){if(t.errors===!1){if(h(),t.modifying)$A(e);y(()=>e.error())}else{let v=t.async?m():g();if(t.modifying)$A(e);y(()=>u5(e,v))}}function m(){let v=o.let("ruleErrs",null);return o.try(()=>h(yt._`await `),(x)=>o.assign(p,!1).if(yt._`${x} instanceof ${c.ValidationError}`,()=>o.assign(v,yt._`${x}.errors`),()=>o.throw(x))),v}function g(){let v=yt._`${d}.errors`;return o.assign(v,null),h(yt.nil),v}function h(v=t.async?yt._`await `:yt.nil){let x=c.opts.passContext?Uo.default.this:Uo.default.self,w=!(("compile"in t)&&!a||t.schema===!1);o.assign(p,yt._`${v}${(0,s5.callValidateCode)(e,d,x,w)}`,t.modifying)}function y(v){var x;o.if((0,yt.not)((x=t.valid)!==null&&x!==void 0?x:p),v)}}AA.funcKeywordCode=l5;function $A(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,yt._`${o.parentData}[${o.parentDataProperty}]`))}function u5(e,t){let{gen:r}=e;r.if(yt._`Array.isArray(${t})`,()=>{r.assign(Uo.default.vErrors,yt._`${Uo.default.vErrors} === null ? ${t} : ${Uo.default.vErrors}.concat(${t})`).assign(Uo.default.errors,yt._`${Uo.default.vErrors}.length`),(0,a5.extendErrors)(e)},()=>e.error())}function d5({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function OA(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,yt.stringify)(r)})}function p5(e,t,r=!1){return!t.length||t.some((o)=>o==="array"?Array.isArray(e):o==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==o||r&&typeof e>"u")}AA.validSchemaType=p5;function f5({schema:e,opts:t,self:r,errSchemaPath:o},n,i){if(Array.isArray(n.keyword)?!n.keyword.includes(i):n.keyword!==i)throw Error("ajv implementation error");let s=n.dependencies;if(s===null||s===void 0?void 0:s.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(n.validateSchema){if(!n.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw Error(c)}}}AA.validateKeywordUsage=f5});var zA=k((DA)=>{Object.defineProperty(DA,"__esModule",{value:!0});DA.extendSubschemaMode=DA.extendSubschemaData=DA.getSubschema=void 0;var Rr=te(),NA=ue();function y5(e,{keyword:t,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:i,topSchemaRef:s}){if(t!==void 0&&o!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:Rr._`${e.schemaPath}${(0,Rr.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:Rr._`${e.schemaPath}${(0,Rr.getProperty)(t)}${(0,Rr.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,NA.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||i===void 0||s===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:s,errSchemaPath:i}}throw Error('either "keyword" or "schema" must be passed')}DA.getSubschema=y5;function b5(e,t,{dataProp:r,dataPropType:o,data:n,dataTypes:i,propertyName:s}){if(n!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:d,opts:p}=t,f=a.let("data",Rr._`${t.data}${(0,Rr.getProperty)(r)}`,!0);c(f),e.errorPath=Rr.str`${u}${(0,NA.getErrorPath)(r,o,p.jsPropertySyntax)}`,e.parentDataProperty=Rr._`${r}`,e.dataPathArr=[...d,e.parentDataProperty]}if(n!==void 0){let u=n instanceof Rr.Name?n:a.let("data",n,!0);if(c(u),s!==void 0)e.propertyName=s}if(i)e.dataTypes=i;function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}DA.extendSubschemaData=b5;function _5(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:i}){if(o!==void 0)e.compositeRule=o;if(n!==void 0)e.createErrors=n;if(i!==void 0)e.allErrors=i;e.jtdDiscriminator=t,e.jtdMetadata=r}DA.extendSubschemaMode=_5});var MS=k((Kke,UA)=>{UA.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var o,n,i;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),o=i.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[n]))return!1;for(n=o;n--!==0;){var s=i[n];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}});var FA=k((Gke,LA)=>{var Bn=LA.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};$m(t,o,n,e,"",e)};Bn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Bn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Bn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Bn.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 $m(e,t,r,o,n,i,s,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){t(o,n,i,s,a,c,u);for(var d in o){var p=o[d];if(Array.isArray(p)){if(d in Bn.arrayKeywords)for(var f=0;f<p.length;f++)$m(e,t,r,p[f],n+"/"+d+"/"+f,i,n,d,o,f)}else if(d in Bn.propsKeywords){if(p&&typeof p=="object")for(var m in p)$m(e,t,r,p[m],n+"/"+d+"/"+x5(m),i,n,d,o,m)}else if(d in Bn.keywords||e.allKeys&&!(d in Bn.skipKeywords))$m(e,t,r,p,n+"/"+d,i,n,d,o)}r(o,n,i,s,a,c,u)}}function x5(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ol=k((ZA)=>{Object.defineProperty(ZA,"__esModule",{value:!0});ZA.getSchemaRefs=ZA.resolveUrl=ZA.normalizeId=ZA._getFullPath=ZA.getFullPath=ZA.inlineRef=void 0;var w5=ue(),k5=MS(),E5=FA(),T5=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function P5(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!NS(e);if(!t)return!1;return HA(e)<=t}ZA.inlineRef=P5;var I5=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function NS(e){for(let t in e){if(I5.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(NS))return!0;if(typeof r=="object"&&NS(r))return!0}return!1}function HA(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,T5.has(r))continue;if(typeof e[r]=="object")(0,w5.eachItem)(e[r],(o)=>t+=HA(o));if(t===1/0)return 1/0}return t}function BA(e,t="",r){if(r!==!1)t=ys(t);let o=e.parse(t);return qA(e,o)}ZA.getFullPath=BA;function qA(e,t){return e.serialize(t).split("#")[0]+"#"}ZA._getFullPath=qA;var R5=/#\/?$/;function ys(e){return e?e.replace(R5,""):""}ZA.normalizeId=ys;function $5(e,t,r){return r=ys(r),e.resolve(t,r)}ZA.resolveUrl=$5;var O5=/^[a-z_][-a-z0-9._]*$/i;function A5(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=ys(e[r]||t),i={"":n},s=BA(o,n,!1),a={},c=new Set;return E5(e,{allKeys:!0},(p,f,m,g)=>{if(g===void 0)return;let h=s+f,y=i[g];if(typeof p[r]=="string")y=v.call(this,p[r]);x.call(this,p.$anchor),x.call(this,p.$dynamicAnchor),i[f]=y;function v(w){let O=this.opts.uriResolver.resolve;if(w=ys(y?O(y,w):w),c.has(w))throw d(w);c.add(w);let L=this.refs[w];if(typeof L=="string")L=this.refs[L];if(typeof L=="object")u(p,L.schema,w);else if(w!==ys(h))if(w[0]==="#")u(p,a[w],w),a[w]=p;else this.refs[w]=h;return w}function x(w){if(typeof w=="string"){if(!O5.test(w))throw Error(`invalid anchor "${w}"`);v.call(this,`#${w}`)}}}),a;function u(p,f,m){if(f!==void 0&&!k5(p,f))throw d(m)}function d(p){return Error(`reference "${p}" resolves to more than one schema`)}}ZA.getSchemaRefs=A5});var Ml=k((aC)=>{Object.defineProperty(aC,"__esModule",{value:!0});aC.getData=aC.KeywordCxt=aC.validateFunctionCode=void 0;var XA=uA(),WA=$l(),jS=PS(),Om=$l(),z5=EA(),Cl=MA(),DS=zA(),q=te(),X=tn(),U5=Ol(),rn=ue(),Al=Rl();function L5(e){if(eC(e)){if(tC(e),QA(e)){B5(e);return}}YA(e,()=>(0,XA.topBoolOrEmptySchema)(e))}aC.validateFunctionCode=L5;function YA({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},i){if(n.code.es5)e.func(t,q._`${X.default.data}, ${X.default.valCxt}`,o.$async,()=>{e.code(q._`"use strict"; ${KA(r,n)}`),H5(e,n),e.code(i)});else e.func(t,q._`${X.default.data}, ${F5(n)}`,o.$async,()=>e.code(KA(r,n)).code(i))}function F5(e){return q._`{${X.default.instancePath}="", ${X.default.parentData}, ${X.default.parentDataProperty}, ${X.default.rootData}=${X.default.data}${e.dynamicRef?q._`, ${X.default.dynamicAnchors}={}`:q.nil}}={}`}function H5(e,t){e.if(X.default.valCxt,()=>{if(e.var(X.default.instancePath,q._`${X.default.valCxt}.${X.default.instancePath}`),e.var(X.default.parentData,q._`${X.default.valCxt}.${X.default.parentData}`),e.var(X.default.parentDataProperty,q._`${X.default.valCxt}.${X.default.parentDataProperty}`),e.var(X.default.rootData,q._`${X.default.valCxt}.${X.default.rootData}`),t.dynamicRef)e.var(X.default.dynamicAnchors,q._`${X.default.valCxt}.${X.default.dynamicAnchors}`)},()=>{if(e.var(X.default.instancePath,q._`""`),e.var(X.default.parentData,q._`undefined`),e.var(X.default.parentDataProperty,q._`undefined`),e.var(X.default.rootData,X.default.data),t.dynamicRef)e.var(X.default.dynamicAnchors,q._`{}`)})}function B5(e){let{schema:t,opts:r,gen:o}=e;YA(e,()=>{if(r.$comment&&t.$comment)nC(e);if(K5(e),o.let(X.default.vErrors,null),o.let(X.default.errors,0),r.unevaluated)q5(e);rC(e),X5(e)});return}function q5(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",q._`${r}.evaluated`),t.if(q._`${e.evaluated}.dynamicProps`,()=>t.assign(q._`${e.evaluated}.props`,q._`undefined`)),t.if(q._`${e.evaluated}.dynamicItems`,()=>t.assign(q._`${e.evaluated}.items`,q._`undefined`))}function KA(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?q._`/*# sourceURL=${r} */`:q.nil}function Z5(e,t){if(eC(e)){if(tC(e),QA(e)){V5(e,t);return}}(0,XA.boolOrEmptySchema)(e,t)}function QA({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function eC(e){return typeof e.schema!="boolean"}function V5(e,t){let{schema:r,gen:o,opts:n}=e;if(n.$comment&&r.$comment)nC(e);G5(e),J5(e);let i=o.const("_errs",X.default.errors);rC(e,i),o.var(t,q._`${i} === ${X.default.errors}`)}function tC(e){(0,rn.checkUnknownRules)(e),W5(e)}function rC(e,t){if(e.opts.jtd)return GA(e,[],!1,t);let r=(0,WA.getSchemaTypes)(e.schema),o=(0,WA.coerceAndCheckDataType)(e,r);GA(e,r,!o,t)}function W5(e){let{schema:t,errSchemaPath:r,opts:o,self:n}=e;if(t.$ref&&o.ignoreKeywordsWithRef&&(0,rn.schemaHasRulesButRef)(t,n.RULES))n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function K5(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)(0,rn.checkStrictMode)(e,"default is ignored in the schema root")}function G5(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=(0,U5.resolveUrl)(e.opts.uriResolver,e.baseId,t)}function J5(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function nC({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){let i=r.$comment;if(n.$comment===!0)e.code(q._`${X.default.self}.logger.log(${i})`);else if(typeof n.$comment=="function"){let s=q.str`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(q._`${X.default.self}.opts.$comment(${i}, ${s}, ${a}.schema)`)}}function X5(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:i}=e;if(r.$async)t.if(q._`${X.default.errors} === 0`,()=>t.return(X.default.data),()=>t.throw(q._`new ${n}(${X.default.vErrors})`));else{if(t.assign(q._`${o}.errors`,X.default.vErrors),i.unevaluated)Y5(e);t.return(q._`${X.default.errors} === 0`)}}function Y5({gen:e,evaluated:t,props:r,items:o}){if(r instanceof q.Name)e.assign(q._`${t}.props`,r);if(o instanceof q.Name)e.assign(q._`${t}.items`,o)}function GA(e,t,r,o){let{gen:n,schema:i,data:s,allErrors:a,opts:c,self:u}=e,{RULES:d}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,rn.schemaHasRulesButRef)(i,d))){n.block(()=>iC(e,"$ref",d.all.$ref.definition));return}if(!c.jtd)Q5(e,t);n.block(()=>{for(let f of d.rules)p(f);p(d.post)});function p(f){if(!(0,jS.shouldUseGroup)(i,f))return;if(f.type){if(n.if((0,Om.checkDataType)(f.type,s,c.strictNumbers)),JA(e,f),t.length===1&&t[0]===f.type&&r)n.else(),(0,Om.reportTypeError)(e);n.endIf()}else JA(e,f);if(!a)n.if(q._`${X.default.errors} === ${o||0}`)}}function JA(e,t){let{gen:r,schema:o,opts:{useDefaults:n}}=e;if(n)(0,z5.assignDefaults)(e,t.type);r.block(()=>{for(let i of t.rules)if((0,jS.shouldUseRule)(o,i))iC(e,i.keyword,i.definition,t.type)})}function Q5(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(e3(e,t),!e.opts.allowUnionTypes)t3(e,t);r3(e,e.dataTypes)}function e3(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!oC(e.dataTypes,r))zS(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),o3(e,t)}function t3(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))zS(e,"use allowUnionTypes to allow union type keyword")}function r3(e,t){let r=e.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,jS.shouldUseRule)(e.schema,n)){let{type:i}=n.definition;if(i.length&&!i.some((s)=>n3(t,s)))zS(e,`missing type "${i.join(",")}" for keyword "${o}"`)}}}function n3(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function oC(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function o3(e,t){let r=[];for(let o of e.dataTypes)if(oC(t,o))r.push(o);else if(t.includes("integer")&&o==="number")r.push("integer");e.dataTypes=r}function zS(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,rn.checkStrictMode)(e,t,e.opts.strictTypes)}class US{constructor(e,t,r){if((0,Cl.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,rn.schemaRefOrVal)(e,this.schema,r,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",sC(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Cl.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",X.default.errors)}result(e,t,r){this.failResult((0,q.not)(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();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,q.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(q._`${t} !== undefined && (${(0,q.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?Al.reportExtraError:Al.reportError)(this,this.def.error,t)}$dataError(){(0,Al.reportError)(this,this.def.$dataError||Al.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,Al.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,r=q.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=q.nil,t=q.nil){if(!this.$data)return;let{gen:r,schemaCode:o,schemaType:n,def:i}=this;if(r.if((0,q.or)(q._`${o} === undefined`,t)),e!==q.nil)r.assign(e,!0);if(n.length||i.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==q.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:o,it:n}=this;return(0,q.or)(i(),s());function i(){if(r.length){if(!(t instanceof q.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return q._`${(0,Om.checkDataTypes)(a,t,n.opts.strictNumbers,Om.DataType.Wrong)}`}return q.nil}function s(){if(o.validateSchema){let a=e.scopeValue("validate$data",{ref:o.validateSchema});return q._`!${a}(${t})`}return q.nil}}subschema(e,t){let r=(0,DS.getSubschema)(this.it,e);(0,DS.extendSubschemaData)(r,this.it,e),(0,DS.extendSubschemaMode)(r,e);let o={...this.it,...r,items:void 0,props:void 0};return Z5(o,t),o}mergeEvaluated(e,t){let{it:r,gen:o}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=rn.mergeEvaluated.props(o,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=rn.mergeEvaluated.items(o,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:o}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return o.if(t,()=>this.mergeEvaluated(e,q.Name)),!0}}aC.KeywordCxt=US;function iC(e,t,r,o){let n=new US(e,r,t);if("code"in r)r.code(n,o);else if(n.$data&&r.validate)(0,Cl.funcKeywordCode)(n,r);else if("macro"in r)(0,Cl.macroKeywordCode)(n,r);else if(r.compile||r.validate)(0,Cl.funcKeywordCode)(n,r)}var i3=/^\/(?:[^~]|~0|~1)*$/,s3=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function sC(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,i;if(e==="")return X.default.rootData;if(e[0]==="/"){if(!i3.test(e))throw Error(`Invalid JSON-pointer: ${e}`);n=e,i=X.default.rootData}else{let u=s3.exec(e);if(!u)throw Error(`Invalid JSON-pointer: ${e}`);let d=+u[1];if(n=u[2],n==="#"){if(d>=t)throw Error(c("property/index",d));return o[t-d]}if(d>t)throw Error(c("data",d));if(i=r[t-d],!n)return i}let s=i,a=n.split("/");for(let u of a)if(u)i=q._`${i}${(0,q.getProperty)((0,rn.unescapeJsonPointer)(u))}`,s=q._`${s} && ${i}`;return s;function c(u,d){return`Cannot access ${u} ${d} levels up, current level is ${t}`}}aC.getData=sC});var Am=k((uC)=>{Object.defineProperty(uC,"__esModule",{value:!0});class lC extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}uC.default=lC});var Nl=k((pC)=>{Object.defineProperty(pC,"__esModule",{value:!0});var LS=Ol();class dC extends Error{constructor(e,t,r,o){super(o||`can't resolve reference ${r} from id ${t}`);this.missingRef=(0,LS.resolveUrl)(e,t,r),this.missingSchema=(0,LS.normalizeId)((0,LS.getFullPath)(e,this.missingRef))}}pC.default=dC});var Mm=k((gC)=>{Object.defineProperty(gC,"__esModule",{value:!0});gC.resolveSchema=gC.getCompilingSchema=gC.resolveRef=gC.compileSchema=gC.SchemaEnv=void 0;var hr=te(),d3=Am(),Lo=tn(),yr=Ol(),fC=ue(),p3=Ml();class Dl{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=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,yr.normalizeId)(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}gC.SchemaEnv=Dl;function HS(e){let t=mC.call(this,e);if(t)return t;let r=(0,yr.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:i}=this.opts,s=new hr.CodeGen(this.scope,{es5:o,lines:n,ownProperties:i}),a;if(e.$async)a=s.scopeValue("Error",{ref:d3.default,code:hr._`require("ajv/dist/runtime/validation_error").default`});let c=s.scopeName("validate");e.validateName=c;let u={gen:s,allErrors:this.opts.allErrors,data:Lo.default.data,parentData:Lo.default.parentData,parentDataProperty:Lo.default.parentDataProperty,dataNames:[Lo.default.data],dataPathArr:[hr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,hr.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:hr.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:hr._`""`,opts:this.opts,self:this},d;try{this._compilations.add(e),(0,p3.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);let p=s.toString();if(d=`${s.scopeRefs(Lo.default.scope)}return ${p}`,this.opts.code.process)d=this.opts.code.process(d,e);let m=Function(`${Lo.default.self}`,`${Lo.default.scope}`,d)(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:s._values};if(this.opts.unevaluated){let{props:g,items:h}=u;if(m.evaluated={props:g instanceof hr.Name?void 0:g,items:h instanceof hr.Name?void 0:h,dynamicProps:g instanceof hr.Name,dynamicItems:h instanceof hr.Name},m.source)m.source.evaluated=(0,hr.stringify)(m.evaluated)}return e.validate=m,e}catch(p){if(delete e.validate,delete e.validateName,d)this.logger.error("Error compiling schema, function code:",d);throw p}finally{this._compilations.delete(e)}}gC.compileSchema=HS;function f3(e,t,r){var o;r=(0,yr.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let i=h3.call(this,e,r);if(i===void 0){let s=(o=e.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;if(s)i=new Dl({schema:s,schemaId:a,root:e,baseId:t})}if(i===void 0)return;return e.refs[r]=m3.call(this,i)}gC.resolveRef=f3;function m3(e){if((0,yr.inlineRef)(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:HS.call(this,e)}function mC(e){for(let t of this._compilations)if(g3(t,e))return t}gC.getCompilingSchema=mC;function g3(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function h3(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||Cm.call(this,e,t)}function Cm(e,t){let r=this.opts.uriResolver.parse(t),o=(0,yr._getFullPath)(this.opts.uriResolver,r),n=(0,yr.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===n)return FS.call(this,r,e);let i=(0,yr.normalizeId)(o),s=this.refs[i]||this.schemas[i];if(typeof s=="string"){let a=Cm.call(this,e,s);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return FS.call(this,r,a)}if(typeof(s===null||s===void 0?void 0:s.schema)!=="object")return;if(!s.validate)HS.call(this,s);if(i===(0,yr.normalizeId)(t)){let{schema:a}=s,{schemaId:c}=this.opts,u=a[c];if(u)n=(0,yr.resolveUrl)(this.opts.uriResolver,n,u);return new Dl({schema:a,schemaId:c,root:e,baseId:n})}return FS.call(this,r,s)}gC.resolveSchema=Cm;var y3=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function FS(e,{baseId:t,schema:r,root:o}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let c=r[(0,fC.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r==="object"&&r[this.opts.schemaId];if(!y3.has(a)&&u)t=(0,yr.resolveUrl)(this.opts.uriResolver,t,u)}let i;if(typeof r!="boolean"&&r.$ref&&!(0,fC.schemaHasRulesButRef)(r,this.RULES)){let a=(0,yr.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=Cm.call(this,o,a)}let{schemaId:s}=this.opts;if(i=i||new Dl({schema:r,schemaId:s,root:o,baseId:t}),i.schema!==i.root.schema)return i;return}});var yC=k((tEe,x3)=>{x3.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 ZS=k((rEe,wC)=>{var w3=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),_C=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),BS=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),vC=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),k3=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function qS(e){let t="",r=0,o=0;for(o=0;o<e.length;o++){if(r=e[o].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(r=e[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}var E3=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function bC(e){return e.length=0,!0}function T3(e,t,r){if(e.length){let o=qS(e);if(o!=="")t.push(o);else return r.error=!0,!1;e.length=0}return!0}function P3(e){let t=0,r={error:!1,address:"",zone:""},o=[],n=[],i=!1,s=!1,a=T3;for(let c=0;c<e.length;c++){let u=e[c];if(u==="["||u==="]")continue;if(u===":"){if(i===!0)s=!0;if(!a(n,o,r))break;if(++t>7){r.error=!0;break}if(c>0&&e[c-1]===":")i=!0;o.push(":");continue}else if(u==="%"){if(!a(n,o,r))break;a=bC}else{n.push(u);continue}}if(n.length)if(a===bC)r.zone=n.join("");else if(s)o.push(n.join(""));else o.push(qS(n));return r.address=o.join(""),r}function SC(e){if(I3(e,":")<2)return{host:e,isIPV6:!1};let t=P3(e);if(!t.error){let{address:r,address:o}=t;if(t.zone)r+="%"+t.zone,o+="%25"+t.zone;return{host:r,isIPV6:!0,escapedHost:o}}else return{host:e,isIPV6:!1}}function I3(e,t){let r=0;for(let o=0;o<e.length;o++)if(e[o]===t)r++;return r}function R3(e){let t=e,r=[],o=-1,n=0;while(n=t.length){if(n===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(n===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]==="/"){r.push("/");break}}}else if(n===3){if(t==="/.."){if(r.length!==0)r.pop();r.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),r.length!==0)r.pop();continue}}}}if((o=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")}var $3={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},O3=/[@/?#:]/g,A3=/[@/?#]/g;function xC(e,t){let r=t?A3:O3;return r.lastIndex=0,e.replace(r,(o)=>$3[o])}function C3(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let o=0;o<e.length;o++){if(e[o]==="%"&&o+2<e.length){let n=e.slice(o+1,o+3);if(BS(n)){let i=n.toUpperCase(),s=String.fromCharCode(parseInt(i,16));if(t&&vC(s))r+=s;else r+="%"+i;o+=2;continue}}r+=e[o]}return r}function M3(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(BS(o)){let n=o.toUpperCase(),i=String.fromCharCode(parseInt(n,16));if(i!=="."&&vC(i))t+=i;else t+="%"+n;r+=2;continue}}if(k3(e[r]))t+=e[r];else t+=escape(e[r])}return t}function N3(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(BS(o)){t+="%"+o.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function D3(e){let t=[];if(e.userinfo!==void 0)t.push(e.userinfo),t.push("@");if(e.host!==void 0){let r=unescape(e.host);if(!_C(r)){let o=SC(r);if(o.isIPV6===!0)r=`[${o.escapedHost}]`;else r=xC(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string")t.push(":"),t.push(String(e.port));return t.length?t.join(""):void 0}wC.exports={nonSimpleDomain:E3,recomposeAuthority:D3,reescapeHostDelimiters:xC,normalizePercentEncoding:C3,normalizePathEncoding:M3,escapePreservingEscapes:N3,removeDotSegments:R3,isIPv4:_C,isUUID:w3,normalizeIPv6:SC,stringArrayToHexStripped:qS}});var IC=k((nEe,PC)=>{var{isUUID:j3}=ZS(),z3=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,U3=["http","https","ws","wss","urn","urn:uuid"];function L3(e){return U3.indexOf(e)!==-1}function VS(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 kC(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function EC(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 F3(e){return e.secure=VS(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function H3(e){if(e.port===(VS(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,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function B3(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(z3);if(r){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${o}:${t.nid||e.nid}`,i=WS(n);if(e.path=void 0,i)e=i.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function q3(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,i=WS(n);if(i)e=i.serialize(e,t);let s=e,a=e.nss;return s.path=`${o||t.nid}:${a}`,t.skipEscape=!0,s}function Z3(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!j3(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function V3(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var TC={scheme:"http",domainHost:!0,parse:kC,serialize:EC},W3={scheme:"https",domainHost:TC.domainHost,parse:kC,serialize:EC},Nm={scheme:"ws",domainHost:!0,parse:F3,serialize:H3},K3={scheme:"wss",domainHost:Nm.domainHost,parse:Nm.parse,serialize:Nm.serialize},G3={scheme:"urn",parse:B3,serialize:q3,skipNormalize:!0},J3={scheme:"urn:uuid",parse:Z3,serialize:V3,skipNormalize:!0},Dm={http:TC,https:W3,ws:Nm,wss:K3,urn:G3,"urn:uuid":J3};Object.setPrototypeOf(Dm,null);function WS(e){return e&&(Dm[e]||Dm[e.toLowerCase()])||void 0}PC.exports={wsIsSecure:VS,SCHEMES:Dm,isValidSchemeName:L3,getSchemeHandler:WS}});var MC=k((oEe,jm)=>{var{normalizeIPv6:X3,removeDotSegments:jl,recomposeAuthority:Y3,normalizePercentEncoding:Q3,normalizePathEncoding:e8,escapePreservingEscapes:t8,reescapeHostDelimiters:r8,isIPv4:n8,nonSimpleDomain:o8}=ZS(),{SCHEMES:i8,getSchemeHandler:$C}=IC();function s8(e,t){if(typeof e==="string")e=d8(e,t);else if(typeof e==="object")e=bs(Fo(e,t),t);return e}function a8(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=OC(bs(e,o),bs(t,o),o,!0);return o.skipEscape=!0,Fo(n,o)}function OC(e,t,r,o){let n={};if(!o)e=bs(Fo(e,r),r),t=bs(Fo(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=jl(t.path||""),n.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=jl(t.path||""),n.query=t.query;else{if(!t.path)if(n.path=e.path,t.query!==void 0)n.query=t.query;else n.query=e.query;else{if(t.path[0]==="/")n.path=jl(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)n.path="/"+t.path;else if(!e.path)n.path=t.path;else n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;n.path=jl(n.path)}n.query=t.query}n.userinfo=e.userinfo,n.host=e.host,n.port=e.port}n.scheme=e.scheme}return n.fragment=t.fragment,n}function c8(e,t,r){let o=RC(e,r),n=RC(t,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function Fo(e,t){let r={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:""},o=Object.assign({},t),n=[],i=$C(o.scheme||r.scheme);if(i&&i.serialize)i.serialize(r,o);if(r.path!==void 0)if(!o.skipEscape){if(r.path=t8(r.path),r.scheme!==void 0)r.path=r.path.split("%3A").join(":")}else r.path=Q3(r.path);if(o.reference!=="suffix"&&r.scheme)n.push(r.scheme,":");let s=Y3(r);if(s!==void 0){if(o.reference!=="suffix")n.push("//");if(n.push(s),r.path&&r.path[0]!=="/")n.push("/")}if(r.path!==void 0){let a=r.path;if(!o.absolutePath&&(!i||!i.absolutePath))a=jl(a);if(s===void 0&&a[0]==="/"&&a[1]==="/")a="/%2F"+a.slice(2);n.push(a)}if(r.query!==void 0)n.push("?",r.query);if(r.fragment!==void 0)n.push("#",r.fragment);return n.join("")}var l8=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function u8(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 AC(e,t){let r=Object.assign({},t),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,i=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let s=e.match(l8);if(s){if(o.scheme=s[1],o.userinfo=s[3],o.host=s[4],o.port=parseInt(s[5],10),o.path=s[6]||"",o.query=s[7],o.fragment=s[8],isNaN(o.port))o.port=s[5];let a=u8(o,s);if(a!==void 0)o.error=o.error||a,n=!0;if(o.host)if(n8(o.host)===!1){let d=X3(o.host);o.host=d.host.toLowerCase(),i=d.isIPV6}else i=!0;if(o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path)o.reference="same-document";else if(o.scheme===void 0)o.reference="relative";else if(o.fragment===void 0)o.reference="absolute";else o.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==o.reference)o.error=o.error||"URI is not a "+r.reference+" reference.";let c=$C(r.scheme||o.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)){if(o.host&&(r.domainHost||c&&c.domainHost)&&i===!1&&o8(o.host))try{o.host=URL.domainToASCII(o.host.toLowerCase())}catch(u){o.error=o.error||"Host's domain name can not be converted to ASCII: "+u}}if(!c||c&&!c.skipNormalize){if(e.indexOf("%")!==-1){if(o.scheme!==void 0)o.scheme=unescape(o.scheme);if(o.host!==void 0)o.host=r8(unescape(o.host),i)}if(o.path)o.path=e8(o.path);if(o.fragment)try{o.fragment=encodeURI(decodeURIComponent(o.fragment))}catch{o.error=o.error||"URI malformed"}}if(c&&c.parse)c.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n}}function bs(e,t){return AC(e,t).parsed}function d8(e,t){return CC(e,t).normalized}function CC(e,t){let{parsed:r,malformedAuthorityOrPort:o}=AC(e,t);return{normalized:o?e:Fo(r,t),malformedAuthorityOrPort:o}}function RC(e,t){if(typeof e==="string"){let{normalized:r,malformedAuthorityOrPort:o}=CC(e,t);return o?void 0:r}if(typeof e==="object")return Fo(e,t)}var KS={SCHEMES:i8,normalize:s8,resolve:a8,resolveComponent:OC,equal:c8,serialize:Fo,parse:bs};jm.exports=KS;jm.exports.default=KS;jm.exports.fastUri=KS});var jC=k((DC)=>{Object.defineProperty(DC,"__esModule",{value:!0});var NC=MC();NC.code='require("ajv/dist/runtime/uri").default';DC.default=NC});var ZC=k((nn)=>{Object.defineProperty(nn,"__esModule",{value:!0});nn.CodeGen=nn.Name=nn.nil=nn.stringify=nn.str=nn._=nn.KeywordCxt=void 0;var f8=Ml();Object.defineProperty(nn,"KeywordCxt",{enumerable:!0,get:function(){return f8.KeywordCxt}});var _s=te();Object.defineProperty(nn,"_",{enumerable:!0,get:function(){return _s._}});Object.defineProperty(nn,"str",{enumerable:!0,get:function(){return _s.str}});Object.defineProperty(nn,"stringify",{enumerable:!0,get:function(){return _s.stringify}});Object.defineProperty(nn,"nil",{enumerable:!0,get:function(){return _s.nil}});Object.defineProperty(nn,"Name",{enumerable:!0,get:function(){return _s.Name}});Object.defineProperty(nn,"CodeGen",{enumerable:!0,get:function(){return _s.CodeGen}});var m8=Am(),HC=Nl(),g8=TS(),zl=Mm(),h8=te(),Ul=Ol(),zm=$l(),JS=ue(),zC=yC(),y8=jC(),BC=(e,t)=>new RegExp(e,t);BC.code="new RegExp";var b8=["removeAdditional","useDefaults","coerceTypes"],_8=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),v8={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."},S8={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},UC=200;function x8(e){var t,r,o,n,i,s,a,c,u,d,p,f,m,g,h,y,v,x,w,O,L,se,Ue,Ye,Ft;let bt=e.strict,to=(t=e.code)===null||t===void 0?void 0:t.optimize,Go=to===!0||to===void 0?1:to||0,Or=(o=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:BC,Ms=(n=e.uriResolver)!==null&&n!==void 0?n:y8.default;return{strictSchema:(s=(i=e.strictSchema)!==null&&i!==void 0?i:bt)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:bt)!==null&&c!==void 0?c:!0,strictTypes:(d=(u=e.strictTypes)!==null&&u!==void 0?u:bt)!==null&&d!==void 0?d:"log",strictTuples:(f=(p=e.strictTuples)!==null&&p!==void 0?p:bt)!==null&&f!==void 0?f:"log",strictRequired:(g=(m=e.strictRequired)!==null&&m!==void 0?m:bt)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:Go,regExp:Or}:{optimize:Go,regExp:Or},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:UC,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:UC,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(x=e.messages)!==null&&x!==void 0?x:!0,inlineRefs:(w=e.inlineRefs)!==null&&w!==void 0?w:!0,schemaId:(O=e.schemaId)!==null&&O!==void 0?O:"$id",addUsedSchema:(L=e.addUsedSchema)!==null&&L!==void 0?L:!0,validateSchema:(se=e.validateSchema)!==null&&se!==void 0?se:!0,validateFormats:(Ue=e.validateFormats)!==null&&Ue!==void 0?Ue:!0,unicodeRegExp:(Ye=e.unicodeRegExp)!==null&&Ye!==void 0?Ye:!0,int32range:(Ft=e.int32range)!==null&&Ft!==void 0?Ft:!0,uriResolver:Ms}}class Um{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...x8(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new h8.ValueScope({scope:{},prefixes:_8,es5:t,lines:r}),this.logger=I8(e.logger);let o=e.validateFormats;if(e.validateFormats=!1,this.RULES=(0,g8.getRules)(),LC.call(this,v8,e,"NOT SUPPORTED"),LC.call(this,S8,e,"DEPRECATED","warn"),this._metaOpts=T8.call(this),e.formats)k8.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)E8.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);w8.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,o=zC;if(r==="id")o={...zC},o.id=o.$id,delete o.$id;if(t&&e)this.addMetaSchema(o,o[r],!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 r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let o=r(t);if(!("$async"in r))this.errors=r.errors;return o}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return o.call(this,e,t);async function o(u,d){await n.call(this,u.$schema);let p=this._addSchema(u,d);return p.validate||i.call(this,p)}async function n(u){if(u&&!this.getSchema(u))await o.call(this,{$ref:u},!0)}async function i(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof HC.default))throw d;return s.call(this,d),await a.call(this,d.missingSchema),i.call(this,u)}}function s({missingSchema:u,missingRef:d}){if(this.refs[u])throw Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function a(u){let d=await c.call(this,u);if(!this.refs[u])await n.call(this,d.$schema);if(!this.refs[u])this.addSchema(d,u,t)}async function c(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=r(u))}finally{delete this._loading[u]}}}addSchema(e,t,r,o=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,r,o);return this}let n;if(typeof e==="object"){let{schemaId:i}=this.opts;if(n=e[i],n!==void 0&&typeof n!="string")throw Error(`schema ${i} must be string`)}return t=(0,Ul.normalizeId)(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,o,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(r,e);if(!o&&t){let n="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(n);else throw Error(n)}return o}getSchema(e){let t;while(typeof(t=FC.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,o=new zl.SchemaEnv({schema:{},schemaId:r});if(t=zl.resolveSchema.call(this,o,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=FC.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 r=e[this.opts.schemaId];if(r)r=(0,Ul.normalizeId)(r),delete this.schemas[r],delete this.refs[r];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 r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if($8.call(this,r,t),!t)return(0,JS.eachItem)(r,(n)=>GS.call(this,n)),this;A8.call(this,t);let o={...t,type:(0,zm.getJSONTypes)(t.type),schemaType:(0,zm.getJSONTypes)(t.schemaType)};return(0,JS.eachItem)(r,o.type.length===0?(n)=>GS.call(this,n,o):(n)=>o.type.forEach((i)=>GS.call(this,n,o,i))),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 r of t.rules){let o=r.rules.findIndex((n)=>n.keyword===e);if(o>=0)r.rules.splice(o,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:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((o)=>`${r}${o.instancePath} ${o.message}`).reduce((o,n)=>o+t+n)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of t){let n=o.split("/").slice(1),i=e;for(let s of n)i=i[s];for(let s in r){let a=r[s];if(typeof a!="object")continue;let{$data:c}=a.definition,u=i[s];if(c&&u)i[s]=qC(u)}}return e}_removeAllSchemas(e,t){for(let r in e){let o=e[r];if(!t||t.test(r)){if(typeof o=="string")delete e[r];else if(o&&!o.meta)this._cache.delete(o.schema),delete e[r]}}}_addSchema(e,t,r,o=this.opts.validateSchema,n=this.opts.addUsedSchema){let i,{schemaId:s}=this.opts;if(typeof e=="object")i=e[s];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;r=(0,Ul.normalizeId)(i||r);let c=Ul.getSchemaRefs.call(this,e,r);if(a=new zl.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:r,localRefs:c}),this._cache.set(a.schema,a),n&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(o)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 zl.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{zl.compileSchema.call(this,e)}finally{this.opts=t}}}Um.ValidationError=m8.default;Um.MissingRefError=HC.default;nn.default=Um;function LC(e,t,r,o="error"){for(let n in e){let i=n;if(i in t)this.logger[o](`${r}: option ${n}. ${e[i]}`)}}function FC(e){return e=(0,Ul.normalizeId)(e),this.schemas[e]||this.refs[e]}function w8(){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 k8(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function E8(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 r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function T8(){let e={...this.opts};for(let t of b8)delete e[t];return e}var P8={log(){},warn(){},error(){}};function I8(e){if(e===!1)return P8;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 R8=/^[a-z_$][a-z0-9_$:-]*$/i;function $8(e,t){let{RULES:r}=this;if((0,JS.eachItem)(e,(o)=>{if(r.keywords[o])throw Error(`Keyword ${o} is already defined`);if(!R8.test(o))throw Error(`Keyword ${o} 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 GS(e,t,r){var o;let n=t===null||t===void 0?void 0:t.post;if(r&&n)throw Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,s=n?i.post:i.rules.find(({type:c})=>c===r);if(!s)s={type:r,rules:[]},i.rules.push(s);if(i.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,zm.getJSONTypes)(t.type),schemaType:(0,zm.getJSONTypes)(t.schemaType)}};if(t.before)O8.call(this,s,a,t.before);else s.rules.push(a);i.all[e]=a,(o=t.implements)===null||o===void 0||o.forEach((c)=>this.addKeyword(c))}function O8(e,t,r){let o=e.rules.findIndex((n)=>n.keyword===r);if(o>=0)e.rules.splice(o,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function A8(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=qC(t);e.validateSchema=this.compile(t,!0)}var C8={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function qC(e){return{anyOf:[e,C8]}}});var WC=k((VC)=>{Object.defineProperty(VC,"__esModule",{value:!0});var D8={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};VC.default=D8});var QC=k((XC)=>{Object.defineProperty(XC,"__esModule",{value:!0});XC.callRef=XC.getValidate=void 0;var z8=Nl(),KC=er(),Rt=te(),vs=tn(),GC=Mm(),Lm=ue(),U8={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:o}=e,{baseId:n,schemaEnv:i,validateName:s,opts:a,self:c}=o,{root:u}=i;if((r==="#"||r==="#/")&&n===u.baseId)return p();let d=GC.resolveRef.call(c,u,n,r);if(d===void 0)throw new z8.default(o.opts.uriResolver,n,r);if(d instanceof GC.SchemaEnv)return f(d);return m(d);function p(){if(i===u)return Fm(e,s,i,i.$async);let g=t.scopeValue("root",{ref:u});return Fm(e,Rt._`${g}.validate`,u,u.$async)}function f(g){let h=JC(e,g);Fm(e,h,g,g.$async)}function m(g){let h=t.scopeValue("schema",a.code.source===!0?{ref:g,code:(0,Rt.stringify)(g)}:{ref:g}),y=t.name("valid"),v=e.subschema({schema:g,dataTypes:[],schemaPath:Rt.nil,topSchemaRef:h,errSchemaPath:r},y);e.mergeEvaluated(v),e.ok(y)}}};function JC(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):Rt._`${r.scopeValue("wrapper",{ref:t})}.validate`}XC.getValidate=JC;function Fm(e,t,r,o){let{gen:n,it:i}=e,{allErrors:s,schemaEnv:a,opts:c}=i,u=c.passContext?vs.default.this:Rt.nil;if(o)d();else p();function d(){if(!a.$async)throw Error("async schema referenced by sync schema");let g=n.let("valid");n.try(()=>{if(n.code(Rt._`await ${(0,KC.callValidateCode)(e,t,u)}`),m(t),!s)n.assign(g,!0)},(h)=>{if(n.if(Rt._`!(${h} instanceof ${i.ValidationError})`,()=>n.throw(h)),f(h),!s)n.assign(g,!1)}),e.ok(g)}function p(){e.result((0,KC.callValidateCode)(e,t,u),()=>m(t),()=>f(t))}function f(g){let h=Rt._`${g}.errors`;n.assign(vs.default.vErrors,Rt._`${vs.default.vErrors} === null ? ${h} : ${vs.default.vErrors}.concat(${h})`),n.assign(vs.default.errors,Rt._`${vs.default.vErrors}.length`)}function m(g){var h;if(!i.opts.unevaluated)return;let y=(h=r===null||r===void 0?void 0:r.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(y&&!y.dynamicProps){if(y.props!==void 0)i.props=Lm.mergeEvaluated.props(n,y.props,i.props)}else{let v=n.var("props",Rt._`${g}.evaluated.props`);i.props=Lm.mergeEvaluated.props(n,v,i.props,Rt.Name)}if(i.items!==!0)if(y&&!y.dynamicItems){if(y.items!==void 0)i.items=Lm.mergeEvaluated.items(n,y.items,i.items)}else{let v=n.var("items",Rt._`${g}.evaluated.items`);i.items=Lm.mergeEvaluated.items(n,v,i.items,Rt.Name)}}}XC.callRef=Fm;XC.default=U8});var tM=k((eM)=>{Object.defineProperty(eM,"__esModule",{value:!0});var H8=WC(),B8=QC(),q8=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",H8.default,B8.default];eM.default=q8});var nM=k((rM)=>{Object.defineProperty(rM,"__esModule",{value:!0});var Hm=te(),qn=Hm.operators,Bm={maximum:{okStr:"<=",ok:qn.LTE,fail:qn.GT},minimum:{okStr:">=",ok:qn.GTE,fail:qn.LT},exclusiveMaximum:{okStr:"<",ok:qn.LT,fail:qn.GTE},exclusiveMinimum:{okStr:">",ok:qn.GT,fail:qn.LTE}},V8={message:({keyword:e,schemaCode:t})=>Hm.str`must be ${Bm[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Hm._`{comparison: ${Bm[e].okStr}, limit: ${t}}`},W8={keyword:Object.keys(Bm),type:"number",schemaType:"number",$data:!0,error:V8,code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data(Hm._`${r} ${Bm[t].fail} ${o} || isNaN(${r})`)}};rM.default=W8});var iM=k((oM)=>{Object.defineProperty(oM,"__esModule",{value:!0});var Ll=te(),G8={message:({schemaCode:e})=>Ll.str`must be multiple of ${e}`,params:({schemaCode:e})=>Ll._`{multipleOf: ${e}}`},J8={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:G8,code(e){let{gen:t,data:r,schemaCode:o,it:n}=e,i=n.opts.multipleOfPrecision,s=t.let("res"),a=i?Ll._`Math.abs(Math.round(${s}) - ${s}) > 1e-${i}`:Ll._`${s} !== parseInt(${s})`;e.fail$data(Ll._`(${o} === 0 || (${s} = ${r}/${o}, ${a}))`)}};oM.default=J8});var cM=k((aM)=>{Object.defineProperty(aM,"__esModule",{value:!0});function sM(e){let t=e.length,r=0,o=0,n;while(o<t)if(r++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<t){if(n=e.charCodeAt(o),(n&64512)===56320)o++}return r}aM.default=sM;sM.code='require("ajv/dist/runtime/ucs2length").default'});var uM=k((lM)=>{Object.defineProperty(lM,"__esModule",{value:!0});var Ho=te(),Q8=ue(),eX=cM(),tX={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return Ho.str`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>Ho._`{limit: ${e}}`},rX={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:tX,code(e){let{keyword:t,data:r,schemaCode:o,it:n}=e,i=t==="maxLength"?Ho.operators.GT:Ho.operators.LT,s=n.opts.unicode===!1?Ho._`${r}.length`:Ho._`${(0,Q8.useFunc)(e.gen,eX.default)}(${r})`;e.fail$data(Ho._`${s} ${i} ${o}`)}};lM.default=rX});var pM=k((dM)=>{Object.defineProperty(dM,"__esModule",{value:!0});var oX=er(),iX=ue(),Ss=te(),sX={message:({schemaCode:e})=>Ss.str`must match pattern "${e}"`,params:({schemaCode:e})=>Ss._`{pattern: ${e}}`},aX={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:sX,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:i,it:s}=e,a=s.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=s.opts.code,u=c.code==="new RegExp"?Ss._`new RegExp`:(0,iX.useFunc)(t,c),d=t.let("valid");t.try(()=>t.assign(d,Ss._`${u}(${i}, ${a}).test(${r})`),()=>t.assign(d,!1)),e.fail$data(Ss._`!${d}`)}else{let c=(0,oX.usePattern)(e,n);e.fail$data(Ss._`!${c}.test(${r})`)}}};dM.default=aX});var mM=k((fM)=>{Object.defineProperty(fM,"__esModule",{value:!0});var Fl=te(),lX={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return Fl.str`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>Fl._`{limit: ${e}}`},uX={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:lX,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxProperties"?Fl.operators.GT:Fl.operators.LT;e.fail$data(Fl._`Object.keys(${r}).length ${n} ${o}`)}};fM.default=uX});var hM=k((gM)=>{Object.defineProperty(gM,"__esModule",{value:!0});var Hl=er(),Bl=te(),pX=ue(),fX={message:({params:{missingProperty:e}})=>Bl.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Bl._`{missingProperty: ${e}}`},mX={keyword:"required",type:"object",schemaType:"array",$data:!0,error:fX,code(e){let{gen:t,schema:r,schemaCode:o,data:n,$data:i,it:s}=e,{opts:a}=s;if(!i&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors)u();else d();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:g}=e.it;for(let h of r)if((m===null||m===void 0?void 0:m[h])===void 0&&!g.has(h)){let y=s.schemaEnv.baseId+s.errSchemaPath,v=`required property "${h}" is not defined at "${y}" (strictRequired)`;(0,pX.checkStrictMode)(s,v,s.opts.strictRequired)}}function u(){if(c||i)e.block$data(Bl.nil,p);else for(let m of r)(0,Hl.checkReportMissingProp)(e,m)}function d(){let m=t.let("missing");if(c||i){let g=t.let("valid",!0);e.block$data(g,()=>f(m,g)),e.ok(g)}else t.if((0,Hl.checkMissingProp)(e,r,m)),(0,Hl.reportMissingProp)(e,m),t.else()}function p(){t.forOf("prop",o,(m)=>{e.setParams({missingProperty:m}),t.if((0,Hl.noPropertyInData)(t,n,m,a.ownProperties),()=>e.error())})}function f(m,g){e.setParams({missingProperty:m}),t.forOf(m,o,()=>{t.assign(g,(0,Hl.propertyInData)(t,n,m,a.ownProperties)),t.if((0,Bl.not)(g),()=>{e.error(),t.break()})},Bl.nil)}}};gM.default=mX});var bM=k((yM)=>{Object.defineProperty(yM,"__esModule",{value:!0});var ql=te(),hX={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return ql.str`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>ql._`{limit: ${e}}`},yX={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:hX,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxItems"?ql.operators.GT:ql.operators.LT;e.fail$data(ql._`${r}.length ${n} ${o}`)}};yM.default=yX});var qm=k((vM)=>{Object.defineProperty(vM,"__esModule",{value:!0});var _M=MS();_M.code='require("ajv/dist/runtime/equal").default';vM.default=_M});var xM=k((SM)=>{Object.defineProperty(SM,"__esModule",{value:!0});var XS=$l(),ot=te(),vX=ue(),SX=qm(),xX={message:({params:{i:e,j:t}})=>ot.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>ot._`{i: ${e}, j: ${t}}`},wX={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:xX,code(e){let{gen:t,data:r,$data:o,schema:n,parentSchema:i,schemaCode:s,it:a}=e;if(!o&&!n)return;let c=t.let("valid"),u=i.items?(0,XS.getSchemaTypes)(i.items):[];e.block$data(c,d,ot._`${s} === false`),e.ok(c);function d(){let g=t.let("i",ot._`${r}.length`),h=t.let("j");e.setParams({i:g,j:h}),t.assign(c,!0),t.if(ot._`${g} > 1`,()=>(p()?f:m)(g,h))}function p(){return u.length>0&&!u.some((g)=>g==="object"||g==="array")}function f(g,h){let y=t.name("item"),v=(0,XS.checkDataTypes)(u,y,a.opts.strictNumbers,XS.DataType.Wrong),x=t.const("indices",ot._`{}`);t.for(ot._`;${g}--;`,()=>{if(t.let(y,ot._`${r}[${g}]`),t.if(v,ot._`continue`),u.length>1)t.if(ot._`typeof ${y} == "string"`,ot._`${y} += "_"`);t.if(ot._`typeof ${x}[${y}] == "number"`,()=>{t.assign(h,ot._`${x}[${y}]`),e.error(),t.assign(c,!1).break()}).code(ot._`${x}[${y}] = ${g}`)})}function m(g,h){let y=(0,vX.useFunc)(t,SX.default),v=t.name("outer");t.label(v).for(ot._`;${g}--;`,()=>t.for(ot._`${h} = ${g}; ${h}--;`,()=>t.if(ot._`${y}(${r}[${g}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(v)})))}}};SM.default=wX});var kM=k((wM)=>{Object.defineProperty(wM,"__esModule",{value:!0});var YS=te(),EX=ue(),TX=qm(),PX={message:"must be equal to constant",params:({schemaCode:e})=>YS._`{allowedValue: ${e}}`},IX={keyword:"const",$data:!0,error:PX,code(e){let{gen:t,data:r,$data:o,schemaCode:n,schema:i}=e;if(o||i&&typeof i=="object")e.fail$data(YS._`!${(0,EX.useFunc)(t,TX.default)}(${r}, ${n})`);else e.fail(YS._`${i} !== ${r}`)}};wM.default=IX});var TM=k((EM)=>{Object.defineProperty(EM,"__esModule",{value:!0});var Zl=te(),$X=ue(),OX=qm(),AX={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Zl._`{allowedValues: ${e}}`},CX={keyword:"enum",schemaType:"array",$data:!0,error:AX,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:i,it:s}=e;if(!o&&n.length===0)throw Error("enum must have non-empty array");let a=n.length>=s.opts.loopEnum,c,u=()=>c!==null&&c!==void 0?c:c=(0,$X.useFunc)(t,OX.default),d;if(a||o)d=t.let("valid"),e.block$data(d,p);else{if(!Array.isArray(n))throw Error("ajv implementation error");let m=t.const("vSchema",i);d=(0,Zl.or)(...n.map((g,h)=>f(m,h)))}e.pass(d);function p(){t.assign(d,!1),t.forOf("v",i,(m)=>t.if(Zl._`${u()}(${r}, ${m})`,()=>t.assign(d,!0).break()))}function f(m,g){let h=n[g];return typeof h==="object"&&h!==null?Zl._`${u()}(${r}, ${m}[${g}])`:Zl._`${r} === ${h}`}}};EM.default=CX});var IM=k((PM)=>{Object.defineProperty(PM,"__esModule",{value:!0});var NX=nM(),DX=iM(),jX=uM(),zX=pM(),UX=mM(),LX=hM(),FX=bM(),HX=xM(),BX=kM(),qX=TM(),ZX=[NX.default,DX.default,jX.default,zX.default,UX.default,LX.default,FX.default,HX.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},BX.default,qX.default];PM.default=ZX});var ex=k(($M)=>{Object.defineProperty($M,"__esModule",{value:!0});$M.validateAdditionalItems=void 0;var Bo=te(),QS=ue(),WX={message:({params:{len:e}})=>Bo.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Bo._`{limit: ${e}}`},KX={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:WX,code(e){let{parentSchema:t,it:r}=e,{items:o}=t;if(!Array.isArray(o)){(0,QS.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}RM(e,o)}};function RM(e,t){let{gen:r,schema:o,data:n,keyword:i,it:s}=e;s.items=!0;let a=r.const("len",Bo._`${n}.length`);if(o===!1)e.setParams({len:t.length}),e.pass(Bo._`${a} <= ${t.length}`);else if(typeof o=="object"&&!(0,QS.alwaysValidSchema)(s,o)){let u=r.var("valid",Bo._`${a} <= ${t.length}`);r.if((0,Bo.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,(d)=>{if(e.subschema({keyword:i,dataProp:d,dataPropType:QS.Type.Num},u),!s.allErrors)r.if((0,Bo.not)(u),()=>r.break())})}}$M.validateAdditionalItems=RM;$M.default=KX});var tx=k((MM)=>{Object.defineProperty(MM,"__esModule",{value:!0});MM.validateTuple=void 0;var AM=te(),Zm=ue(),JX=er(),XX={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return CM(e,"additionalItems",t);if(r.items=!0,(0,Zm.alwaysValidSchema)(r,t))return;e.ok((0,JX.validateArray)(e))}};function CM(e,t,r=e.schema){let{gen:o,parentSchema:n,data:i,keyword:s,it:a}=e;if(d(n),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=Zm.mergeEvaluated.items(o,r.length,a.items);let c=o.name("valid"),u=o.const("len",AM._`${i}.length`);r.forEach((p,f)=>{if((0,Zm.alwaysValidSchema)(a,p))return;o.if(AM._`${u} > ${f}`,()=>e.subschema({keyword:s,schemaProp:f,dataProp:f},c)),e.ok(c)});function d(p){let{opts:f,errSchemaPath:m}=a,g=r.length,h=g===p.minItems&&(g===p.maxItems||p[t]===!1);if(f.strictTuples&&!h){let y=`"${s}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;(0,Zm.checkStrictMode)(a,y,f.strictTuples)}}}MM.validateTuple=CM;MM.default=XX});var jM=k((DM)=>{Object.defineProperty(DM,"__esModule",{value:!0});var QX=tx(),eY={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>(0,QX.validateTuple)(e,"items")};DM.default=eY});var LM=k((UM)=>{Object.defineProperty(UM,"__esModule",{value:!0});var zM=te(),rY=ue(),nY=er(),oY=ex(),iY={message:({params:{len:e}})=>zM.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>zM._`{limit: ${e}}`},sY={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:iY,code(e){let{schema:t,parentSchema:r,it:o}=e,{prefixItems:n}=r;if(o.items=!0,(0,rY.alwaysValidSchema)(o,t))return;if(n)(0,oY.validateAdditionalItems)(e,n);else e.ok((0,nY.validateArray)(e))}};UM.default=sY});var HM=k((FM)=>{Object.defineProperty(FM,"__esModule",{value:!0});var tr=te(),Vm=ue(),cY={message:({params:{min:e,max:t}})=>t===void 0?tr.str`must contain at least ${e} valid item(s)`:tr.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?tr._`{minContains: ${e}}`:tr._`{minContains: ${e}, maxContains: ${t}}`},lY={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:cY,code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:i}=e,s,a,{minContains:c,maxContains:u}=o;if(i.opts.next)s=c===void 0?1:c,a=u;else s=1;let d=t.const("len",tr._`${n}.length`);if(e.setParams({min:s,max:a}),a===void 0&&s===0){(0,Vm.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,Vm.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Vm.alwaysValidSchema)(i,r)){let h=tr._`${d} >= ${s}`;if(a!==void 0)h=tr._`${h} && ${d} <= ${a}`;e.pass(h);return}i.items=!0;let p=t.name("valid");if(a===void 0&&s===1)m(p,()=>t.if(p,()=>t.break()));else if(s===0){if(t.let(p,!0),a!==void 0)t.if(tr._`${n}.length > 0`,f)}else t.let(p,!1),f();e.result(p,()=>e.reset());function f(){let h=t.name("_valid"),y=t.let("count",0);m(h,()=>t.if(h,()=>g(y)))}function m(h,y){t.forRange("i",0,d,(v)=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:Vm.Type.Num,compositeRule:!0},h),y()})}function g(h){if(t.code(tr._`${h}++`),a===void 0)t.if(tr._`${h} >= ${s}`,()=>t.assign(p,!0).break());else if(t.if(tr._`${h} > ${a}`,()=>t.assign(p,!1).break()),s===1)t.assign(p,!0);else t.if(tr._`${h} >= ${s}`,()=>t.assign(p,!0))}}};FM.default=lY});var KM=k((ZM)=>{Object.defineProperty(ZM,"__esModule",{value:!0});ZM.validateSchemaDeps=ZM.validatePropertyDeps=ZM.error=void 0;var rx=te(),dY=ue(),Vl=er();ZM.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let o=t===1?"property":"properties";return rx.str`must have ${o} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>rx._`{property: ${e},
13
13
  missingProperty: ${o},
14
14
  depsCount: ${t},
15
- deps: ${r}}`};var iY={keyword:"dependencies",type:"object",schemaType:"object",error:BM.error,code(e){let[t,r]=sY(e);FM(e,t),HM(e,r)}};function sY({schema:e}){let t={},r={};for(let o in e){if(o==="__proto__")continue;let n=Array.isArray(e[o])?t:r;n[o]=e[o]}return[t,r]}function FM(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let s in t){let a=t[s];if(a.length===0)continue;let c=(0,Vl.propertyInData)(r,o,s,n.opts.ownProperties);if(e.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),n.allErrors)r.if(c,()=>{for(let u of a)(0,Vl.checkReportMissingProp)(e,u)});else r.if(tx._`${c} && (${(0,Vl.checkMissingProp)(e,a,i)})`),(0,Vl.reportMissingProp)(e,i),r.else()}}BM.validatePropertyDeps=FM;function HM(e,t=e.schema){let{gen:r,data:o,keyword:n,it:i}=e,s=r.name("valid");for(let a in t){if((0,oY.alwaysValidSchema)(i,t[a]))continue;r.if((0,Vl.propertyInData)(r,o,a,i.opts.ownProperties),()=>{let c=e.subschema({keyword:n,schemaProp:a},s);e.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),e.ok(s)}}BM.validateSchemaDeps=HM;BM.default=iY});var GM=k((KM)=>{Object.defineProperty(KM,"__esModule",{value:!0});var WM=te(),lY=ue(),uY={message:"property name must be valid",params:({params:e})=>WM._`{propertyName: ${e.propertyName}}`},dY={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:uY,code(e){let{gen:t,schema:r,data:o,it:n}=e;if((0,lY.alwaysValidSchema)(n,r))return;let i=t.name("valid");t.forIn("key",o,(s)=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},i),t.if((0,WM.not)(i),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(i)}};KM.default=dY});var rx=k((JM)=>{Object.defineProperty(JM,"__esModule",{value:!0});var Vm=er(),br=te(),fY=tn(),Wm=ue(),mY={message:"must NOT have additional properties",params:({params:e})=>br._`{additionalProperty: ${e.additionalProperty}}`},gY={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:mY,code(e){let{gen:t,schema:r,parentSchema:o,data:n,errsCount:i,it:s}=e;if(!i)throw Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,Wm.alwaysValidSchema)(s,r))return;let u=(0,Vm.allSchemaProperties)(o.properties),d=(0,Vm.allSchemaProperties)(o.patternProperties);p(),e.ok(br._`${i} === ${fY.default.errors}`);function p(){t.forIn("key",n,(y)=>{if(!u.length&&!d.length)g(y);else t.if(f(y),()=>g(y))})}function f(y){let v;if(u.length>8){let x=(0,Wm.schemaRefOrVal)(s,o.properties,"properties");v=(0,Vm.isOwnProperty)(t,x,y)}else if(u.length)v=(0,br.or)(...u.map((x)=>br._`${y} === ${x}`));else v=br.nil;if(d.length)v=(0,br.or)(v,...d.map((x)=>br._`${(0,Vm.usePattern)(e,x)}.test(${y})`));return(0,br.not)(v)}function m(y){t.code(br._`delete ${n}[${y}]`)}function g(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(y);return}if(r===!1){if(e.setParams({additionalProperty:y}),e.error(),!a)t.break();return}if(typeof r=="object"&&!(0,Wm.alwaysValidSchema)(s,r)){let v=t.name("valid");if(c.removeAdditional==="failing")h(y,v,!1),t.if((0,br.not)(v),()=>{e.reset(),m(y)});else if(h(y,v),!a)t.if((0,br.not)(v),()=>t.break())}}function h(y,v,x){let w={keyword:"additionalProperties",dataProp:y,dataPropType:Wm.Type.Str};if(x===!1)Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(w,v)}}};JM.default=gY});var eN=k((QM)=>{Object.defineProperty(QM,"__esModule",{value:!0});var yY=Ml(),XM=er(),nx=ue(),YM=rx(),bY={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:i}=e;if(i.opts.removeAdditional==="all"&&o.additionalProperties===void 0)YM.default.code(new yY.KeywordCxt(i,YM.default,"additionalProperties"));let s=(0,XM.allSchemaProperties)(r);for(let p of s)i.definedProperties.add(p);if(i.opts.unevaluated&&s.length&&i.props!==!0)i.props=nx.mergeEvaluated.props(t,(0,nx.toHash)(s),i.props);let a=s.filter((p)=>!(0,nx.alwaysValidSchema)(i,r[p]));if(a.length===0)return;let c=t.name("valid");for(let p of a){if(u(p))d(p);else{if(t.if((0,XM.propertyInData)(t,n,p,i.opts.ownProperties)),d(p),!i.allErrors)t.else().var(c,!0);t.endIf()}e.it.definedProperties.add(p),e.ok(c)}function u(p){return i.opts.useDefaults&&!i.compositeRule&&r[p].default!==void 0}function d(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},c)}}};QM.default=bY});var iN=k((oN)=>{Object.defineProperty(oN,"__esModule",{value:!0});var tN=er(),Km=te(),rN=ue(),nN=ue(),vY={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:i}=e,{opts:s}=i,a=(0,tN.allSchemaProperties)(r),c=a.filter((h)=>(0,rN.alwaysValidSchema)(i,r[h]));if(a.length===0||c.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let u=s.strictSchema&&!s.allowMatchingProperties&&n.properties,d=t.name("valid");if(i.props!==!0&&!(i.props instanceof Km.Name))i.props=(0,nN.evaluatedPropsToName)(t,i.props);let{props:p}=i;f();function f(){for(let h of a){if(u)m(h);if(i.allErrors)g(h);else t.var(d,!0),g(h),t.if(d)}}function m(h){for(let y in u)if(new RegExp(h).test(y))(0,rN.checkStrictMode)(i,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function g(h){t.forIn("key",o,(y)=>{t.if(Km._`${(0,tN.usePattern)(e,h)}.test(${y})`,()=>{let v=c.includes(h);if(!v)e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:nN.Type.Str},d);if(i.opts.unevaluated&&p!==!0)t.assign(Km._`${p}[${y}]`,!0);else if(!v&&!i.allErrors)t.if((0,Km.not)(d),()=>t.break())})})}}};oN.default=vY});var aN=k((sN)=>{Object.defineProperty(sN,"__esModule",{value:!0});var xY=ue(),wY={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if((0,xY.alwaysValidSchema)(o,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};sN.default=wY});var lN=k((cN)=>{Object.defineProperty(cN,"__esModule",{value:!0});var TY=er(),EY={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:TY.validateUnion,error:{message:"must match a schema in anyOf"}};cN.default=EY});var dN=k((uN)=>{Object.defineProperty(uN,"__esModule",{value:!0});var Gm=te(),IY=ue(),RY={message:"must match exactly one schema in oneOf",params:({params:e})=>Gm._`{passingSchemas: ${e.passing}}`},$Y={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:RY,code(e){let{gen:t,schema:r,parentSchema:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let i=r,s=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(s,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((d,p)=>{let f;if((0,IY.alwaysValidSchema)(n,d))t.var(c,!0);else f=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},c);if(p>0)t.if(Gm._`${c} && ${s}`).assign(s,!1).assign(a,Gm._`[${a}, ${p}]`).else();t.if(c,()=>{if(t.assign(s,!0),t.assign(a,p),f)e.mergeEvaluated(f,Gm.Name)})})}}};uN.default=$Y});var fN=k((pN)=>{Object.defineProperty(pN,"__esModule",{value:!0});var AY=ue(),CY={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((i,s)=>{if((0,AY.alwaysValidSchema)(o,i))return;let a=e.subschema({keyword:"allOf",schemaProp:s},n);e.ok(n),e.mergeEvaluated(a)})}};pN.default=CY});var yN=k((hN)=>{Object.defineProperty(hN,"__esModule",{value:!0});var Jm=te(),gN=ue(),NY={message:({params:e})=>Jm.str`must match "${e.ifClause}" schema`,params:({params:e})=>Jm._`{failingKeyword: ${e.ifClause}}`},DY={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:NY,code(e){let{gen:t,parentSchema:r,it:o}=e;if(r.then===void 0&&r.else===void 0)(0,gN.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=mN(o,"then"),i=mN(o,"else");if(!n&&!i)return;let s=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),n&&i){let d=t.let("ifClause");e.setParams({ifClause:d}),t.if(a,u("then",d),u("else",d))}else if(n)t.if(a,u("then"));else t.if((0,Jm.not)(a),u("else"));e.pass(s,()=>e.error(!0));function c(){let d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(d)}function u(d,p){return()=>{let f=e.subschema({keyword:d},a);if(t.assign(s,a),e.mergeValidEvaluated(f,s),p)t.assign(p,Jm._`${d}`);else e.setParams({ifClause:d})}}}};function mN(e,t){let r=e.schema[t];return r!==void 0&&!(0,gN.alwaysValidSchema)(e,r)}hN.default=DY});var _N=k((bN)=>{Object.defineProperty(bN,"__esModule",{value:!0});var zY=ue(),UY={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)(0,zY.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};bN.default=UY});var SN=k((vN)=>{Object.defineProperty(vN,"__esModule",{value:!0});var FY=QS(),HY=NM(),BY=ex(),qY=zM(),ZY=LM(),VY=VM(),WY=GM(),KY=rx(),GY=eN(),JY=iN(),XY=aN(),YY=lN(),QY=dN(),e7=fN(),t7=yN(),r7=_N();function n7(e=!1){let t=[XY.default,YY.default,QY.default,e7.default,t7.default,r7.default,WY.default,KY.default,VY.default,GY.default,JY.default];if(e)t.push(HY.default,qY.default);else t.push(FY.default,BY.default);return t.push(ZY.default),t}vN.default=n7});var wN=k((xN)=>{Object.defineProperty(xN,"__esModule",{value:!0});var Be=te(),i7={message:({schemaCode:e})=>Be.str`must match format "${e}"`,params:({schemaCode:e})=>Be._`{format: ${e}}`},s7={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:i7,code(e,t){let{gen:r,data:o,$data:n,schema:i,schemaCode:s,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:d,self:p}=a;if(!c.validateFormats)return;if(n)f();else m();function f(){let g=r.scopeValue("formats",{ref:p.formats,code:c.code.formats}),h=r.const("fDef",Be._`${g}[${s}]`),y=r.let("fType"),v=r.let("format");r.if(Be._`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(y,Be._`${h}.type || "string"`).assign(v,Be._`${h}.validate`),()=>r.assign(y,Be._`"string"`).assign(v,h)),e.fail$data((0,Be.or)(x(),w()));function x(){if(c.strictSchema===!1)return Be.nil;return Be._`${s} && !${v}`}function w(){let O=d.$async?Be._`(${h}.async ? await ${v}(${o}) : ${v}(${o}))`:Be._`${v}(${o})`,L=Be._`(typeof ${v} == "function" ? ${O} : ${v}.test(${o}))`;return Be._`${v} && ${v} !== true && ${y} === ${t} && !${L}`}}function m(){let g=p.formats[i];if(!g){x();return}if(g===!0)return;let[h,y,v]=w(g);if(h===t)e.pass(O());function x(){if(c.strictSchema===!1){p.logger.warn(L());return}throw Error(L());function L(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function w(L){let se=L instanceof RegExp?(0,Be.regexpCode)(L):c.code.formats?Be._`${c.code.formats}${(0,Be.getProperty)(i)}`:void 0,Ue=r.scopeValue("formats",{key:i,ref:L,code:se});if(typeof L=="object"&&!(L instanceof RegExp))return[L.type||"string",L.validate,Be._`${Ue}.validate`];return["string",L,Ue]}function O(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!d.$async)throw Error("async format in sync schema");return Be._`await ${v}(${o})`}return typeof y=="function"?Be._`${v}(${o})`:Be._`${v}.test(${o})`}}}};xN.default=s7});var TN=k((kN)=>{Object.defineProperty(kN,"__esModule",{value:!0});var c7=wN(),l7=[c7.default];kN.default=l7});var IN=k((EN)=>{Object.defineProperty(EN,"__esModule",{value:!0});EN.contentVocabulary=EN.metadataVocabulary=void 0;EN.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];EN.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var ON=k(($N)=>{Object.defineProperty($N,"__esModule",{value:!0});var p7=QC(),f7=EM(),m7=SN(),g7=TN(),RN=IN(),h7=[p7.default,f7.default,(0,m7.default)(),g7.default,RN.metadataVocabulary,RN.contentVocabulary];$N.default=h7});var NN=k((CN)=>{Object.defineProperty(CN,"__esModule",{value:!0});CN.DiscrError=void 0;var AN;(function(e){e.Tag="tag",e.Mapping="mapping"})(AN||(CN.DiscrError=AN={}))});var zN=k((jN)=>{Object.defineProperty(jN,"__esModule",{value:!0});var xs=te(),ox=NN(),DN=Cm(),b7=Nl(),_7=ue(),v7={message:({params:{discrError:e,tagName:t}})=>e===ox.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>xs._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},S7={keyword:"discriminator",type:"object",schemaType:"object",error:v7,code(e){let{gen:t,data:r,schema:o,parentSchema:n,it:i}=e,{oneOf:s}=n;if(!i.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(o.mapping)throw Error("discriminator: mapping is not supported");if(!s)throw Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",xs._`${r}${(0,xs.getProperty)(a)}`);t.if(xs._`typeof ${u} == "string"`,()=>d(),()=>e.error(!1,{discrError:ox.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function d(){let m=f();t.if(!1);for(let g in m)t.elseIf(xs._`${u} === ${g}`),t.assign(c,p(m[g]));t.else(),e.error(!1,{discrError:ox.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function p(m){let g=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:m},g);return e.mergeEvaluated(h,xs.Name),g}function f(){var m;let g={},h=v(n),y=!0;for(let O=0;O<s.length;O++){let L=s[O];if((L===null||L===void 0?void 0:L.$ref)&&!(0,_7.schemaHasRulesButRef)(L,i.self.RULES)){let Ue=L.$ref;if(L=DN.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,Ue),L instanceof DN.SchemaEnv)L=L.schema;if(L===void 0)throw new b7.default(i.opts.uriResolver,i.baseId,Ue)}let se=(m=L===null||L===void 0?void 0:L.properties)===null||m===void 0?void 0:m[a];if(typeof se!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(h||v(L)),x(se,O)}if(!y)throw Error(`discriminator: "${a}" must be required`);return g;function v({required:O}){return Array.isArray(O)&&O.includes(a)}function x(O,L){if(O.const)w(O.const,L);else if(O.enum)for(let se of O.enum)w(se,L);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function w(O,L){if(typeof O!="string"||O in g)throw Error(`discriminator: "${a}" values must be unique strings`);g[O]=L}}}};jN.default=S7});var UN=k((ZTe,w7)=>{w7.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 sx=k(($t,ix)=>{Object.defineProperty($t,"__esModule",{value:!0});$t.MissingRefError=$t.ValidationError=$t.CodeGen=$t.Name=$t.nil=$t.stringify=$t.str=$t._=$t.KeywordCxt=$t.Ajv=void 0;var k7=BC(),T7=ON(),E7=zN(),LN=UN(),P7=["/properties"],Xm="http://json-schema.org/draft-07/schema";class Wl extends k7.default{_addVocabularies(){if(super._addVocabularies(),T7.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(E7.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(LN,P7):LN;this.addMetaSchema(e,Xm,!1),this.refs["http://json-schema.org/schema"]=Xm}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Xm)?Xm:void 0)}}$t.Ajv=Wl;ix.exports=$t=Wl;ix.exports.Ajv=Wl;Object.defineProperty($t,"__esModule",{value:!0});$t.default=Wl;var I7=Ml();Object.defineProperty($t,"KeywordCxt",{enumerable:!0,get:function(){return I7.KeywordCxt}});var ws=te();Object.defineProperty($t,"_",{enumerable:!0,get:function(){return ws._}});Object.defineProperty($t,"str",{enumerable:!0,get:function(){return ws.str}});Object.defineProperty($t,"stringify",{enumerable:!0,get:function(){return ws.stringify}});Object.defineProperty($t,"nil",{enumerable:!0,get:function(){return ws.nil}});Object.defineProperty($t,"Name",{enumerable:!0,get:function(){return ws.Name}});Object.defineProperty($t,"CodeGen",{enumerable:!0,get:function(){return ws.CodeGen}});var R7=Om();Object.defineProperty($t,"ValidationError",{enumerable:!0,get:function(){return R7.default}});var $7=Nl();Object.defineProperty($t,"MissingRefError",{enumerable:!0,get:function(){return $7.default}})});var JN=k((KN)=>{Object.defineProperty(KN,"__esModule",{value:!0});KN.formatNames=KN.fastFormats=KN.fullFormats=void 0;function Rr(e,t){return{validate:e,compare:t}}KN.fullFormats={date:Rr(qN,ux),time:Rr(cx(!0),dx),"date-time":Rr(FN(!0),VN),"iso-time":Rr(cx(),ZN),"iso-date-time":Rr(FN(),WN),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:z7,"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:Z7,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:U7,int32:{type:"number",validate:H7},int64:{type:"number",validate:B7},float:{type:"number",validate:BN},double:{type:"number",validate:BN},password:!0,binary:!0};KN.fastFormats={...KN.fullFormats,date:Rr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,ux),time:Rr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,dx),"date-time":Rr(/^\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,VN),"iso-time":Rr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,ZN),"iso-date-time":Rr(/^\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,WN),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};KN.formatNames=Object.keys(KN.fullFormats);function C7(e){return e%4===0&&(e%100!==0||e%400===0)}var M7=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,N7=[0,31,28,31,30,31,30,31,31,30,31,30,31];function qN(e){let t=M7.exec(e);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&C7(r)?29:N7[o])}function ux(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var ax=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function cx(e){return function(r){let o=ax.exec(r);if(!o)return!1;let n=+o[1],i=+o[2],s=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),d=+(o[7]||0);if(u>23||d>59||e&&!a)return!1;if(n<=23&&i<=59&&s<60)return!0;let p=i-d*c,f=n-u*c-(p<0?1:0);return(f===23||f===-1)&&(p===59||p===-1)&&s<61}}function dx(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(!(r&&o))return;return r-o}function ZN(e,t){if(!(e&&t))return;let r=ax.exec(e),o=ax.exec(t);if(!(r&&o))return;if(e=r[1]+r[2]+r[3],t=o[1]+o[2]+o[3],e>t)return 1;if(e<t)return-1;return 0}var lx=/t|\s/i;function FN(e){let t=cx(e);return function(o){let n=o.split(lx);return n.length===2&&qN(n[0])&&t(n[1])}}function VN(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(!(r&&o))return;return r-o}function WN(e,t){if(!(e&&t))return;let[r,o]=e.split(lx),[n,i]=t.split(lx),s=ux(r,n);if(s===void 0)return;return s||dx(o,i)}var D7=/\/|:/,j7=/^(?:[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 z7(e){return D7.test(e)&&j7.test(e)}var HN=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function U7(e){return HN.lastIndex=0,HN.test(e)}var L7=-2147483648,F7=2147483647;function H7(e){return Number.isInteger(e)&&e<=F7&&e>=L7}function B7(e){return Number.isInteger(e)}function BN(){return!0}var q7=/[^\\]\\Z/;function Z7(e){if(q7.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var YN=k((XN)=>{Object.defineProperty(XN,"__esModule",{value:!0});XN.formatLimitDefinition=void 0;var W7=sx(),_r=te(),Bn=_r.operators,Ym={formatMaximum:{okStr:"<=",ok:Bn.LTE,fail:Bn.GT},formatMinimum:{okStr:">=",ok:Bn.GTE,fail:Bn.LT},formatExclusiveMaximum:{okStr:"<",ok:Bn.LT,fail:Bn.GTE},formatExclusiveMinimum:{okStr:">",ok:Bn.GT,fail:Bn.LTE}},K7={message:({keyword:e,schemaCode:t})=>_r.str`should be ${Ym[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>_r._`{comparison: ${Ym[e].okStr}, limit: ${t}}`};XN.formatLimitDefinition={keyword:Object.keys(Ym),type:"string",schemaType:"string",$data:!0,error:K7,code(e){let{gen:t,data:r,schemaCode:o,keyword:n,it:i}=e,{opts:s,self:a}=i;if(!s.validateFormats)return;let c=new W7.KeywordCxt(i,a.RULES.all.format.definition,"format");if(c.$data)u();else d();function u(){let f=t.scopeValue("formats",{ref:a.formats,code:s.code.formats}),m=t.const("fmt",_r._`${f}[${c.schemaCode}]`);e.fail$data((0,_r.or)(_r._`typeof ${m} != "object"`,_r._`${m} instanceof RegExp`,_r._`typeof ${m}.compare != "function"`,p(m)))}function d(){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(`"${n}": format "${f}" does not define "compare" function`);let g=t.scopeValue("formats",{key:f,ref:m,code:s.code.formats?_r._`${s.code.formats}${(0,_r.getProperty)(f)}`:void 0});e.fail$data(p(g))}function p(f){return _r._`${f}.compare(${r}, ${o}) ${Ym[n].fail} 0`}},dependencies:["format"]};var G7=(e)=>{return e.addKeyword(XN.formatLimitDefinition),e};XN.default=G7});var rD=k((Kl,tD)=>{Object.defineProperty(Kl,"__esModule",{value:!0});var ks=JN(),X7=YN(),mx=te(),QN=new mx.Name("fullFormats"),Y7=new mx.Name("fastFormats"),gx=(e,t={keywords:!0})=>{if(Array.isArray(t))return eD(e,t,ks.fullFormats,QN),e;let[r,o]=t.mode==="fast"?[ks.fastFormats,Y7]:[ks.fullFormats,QN],n=t.formats||ks.formatNames;if(eD(e,n,r,o),t.keywords)(0,X7.default)(e);return e};gx.get=(e,t="full")=>{let o=(t==="fast"?ks.fastFormats:ks.fullFormats)[e];if(!o)throw Error(`Unknown format "${e}"`);return o};function eD(e,t,r,o){var n,i;(n=(i=e.opts.code).formats)!==null&&n!==void 0||(i.formats=mx._`require("ajv-formats/dist/formats").${o}`);for(let s of t)e.addFormat(s,r[s])}tD.exports=Kl=gx;Object.defineProperty(Kl,"__esModule",{value:!0});Kl.default=gx});import{execFile as ire}from"child_process";import{randomUUID as Gx}from"crypto";import{createReadStream as sre,realpathSync as are}from"fs";import{copyFile as cre,mkdir as qx,readdir as lre,readFile as Cz,rm as ure,writeFile as Mz}from"fs/promises";import{createRequire as dre}from"module";import{homedir as Zx,tmpdir as pre}from"os";import{dirname as Iz,isAbsolute as Nz,join as Lt,relative as Dz,resolve as cu,sep as Jx}from"path";import{createInterface as fre}from"readline";import{fileURLToPath as mre}from"url";import{setMaxListeners as gU}from"events";var hU=50;function Fs(e=hU){let t=new AbortController;return gU(e,t.signal),t}import{realpathSync as yU}from"fs";import{dirname as cw,resolve as wg,sep as lw}from"path";function Ar(e){return process.platform==="darwin"?e.normalize("NFC"):e}function dw(e){return/^[\\/]{2}/.test(e)}function pw(e){return/^[\\/]{2}wsl(\$|\.localhost)[\\/]/i.test(e)}function bU(e){if(e.startsWith("\\\\?\\UNC\\"))return"\\\\"+e.slice(8);if(e.startsWith("\\\\?\\")&&e.length>=7&&e[5]===":")return e.slice(4);return e}function uw(e){try{return bU(yU.native(e))}catch{return null}}function fw(e,t){let r=wg(t).toLowerCase(),o=wg(e).toLowerCase();if(cw(o)===r||o.startsWith(r+lw))return!0;let n=uw(t)?.toLowerCase();if(n==null)return!1;let i=uw(cw(wg(e)))?.toLowerCase();if(i==null)return!0;return i===n||i.startsWith(n+lw)}function pu(e,t,r){return new Promise((o,n)=>{if(t?.aborted){if(r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else o();return}let i=setTimeout((a,c,u)=>{a?.removeEventListener("abort",c),u()},e,t,s,o);function s(){if(clearTimeout(i),r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else o()}if(t?.addEventListener("abort",s,{once:!0}),r?.unref)i.unref()})}function _U(e,t){e(Error(t))}function Cr(e,t,r){let o,n=new Promise((i,s)=>{o=setTimeout(_U,t,s,r)});return Promise.race([e,n]).finally(()=>{if(o!==void 0)clearTimeout(o)})}import{spawn as H2}from"child_process";import{existsSync as B2}from"fs";import{createInterface as q2}from"readline";var Xo=["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","MessageDisplay"],vU=["clear","resume","logout","prompt_input_exit","other","bypass_permissions_disabled"],SU="__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__";var xU=/^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/,wU=/<command-name>(.*?)<\/command-name>/;function Hs(e,t){if(e.type!=="user")return;if(e.isMeta===!0||e.isCompactSummary===!0)return;let r=e.message;if(!r)return;let o=r.content,n=[];if(typeof o==="string")n.push(o);else if(Array.isArray(o))for(let i of o){if(!i||typeof i!=="object")continue;if(i.type==="tool_result")return;if(i.type==="text"&&typeof i.text==="string")n.push(i.text)}for(let i of n){let s=i.replaceAll(`
16
- `," ").trim();if(!s)continue;let a=wU.exec(s);if(a){if(!t.commandFallback)t.commandFallback=a[1];continue}let c=/<bash-input>([\s\S]*?)<\/bash-input>/.exec(s);if(c)return`! ${c[1].trim()}`;if(xU.test(s))continue;if(s.length>200)s=s.slice(0,200).trim()+"…";return s}return}var kU={customTitle:"customTitle",aiTitle:"aiTitle",lastPrompt:"lastPrompt",summary:"summaryHint",gitBranch:"gitBranch"};function fu(e,t,r,o){let n=o?.mtime??e?.mtime??0,i=e!==void 0?{sessionId:e.sessionId,mtime:n,data:{...e.data}}:{sessionId:t.sessionId,mtime:n,data:{}},s=i.data;for(let a of r){let c=EU(a.timestamp);if(s.isSidechain===void 0)s.isSidechain=a.isSidechain===!0;if(s.createdAt===void 0&&c!==void 0)s.createdAt=c;if(s.cwd===void 0){let u=a.cwd;if(typeof u==="string"&&u)s.cwd=u}PU(s,a);for(let[u,d]of Object.entries(kU)){let p=a[u];if(typeof p==="string")s[d]=p}if(a.type==="tag"){let u=a.tag;if(typeof u==="string"&&u)s.tag=u;else delete s.tag}}return i}function mw(e,t){let r=e.data;if(r.isSidechain===!0)return null;let o=cn(r.firstPromptLocked===!0?r.firstPrompt:r.commandFallback)||void 0,n=cn(r.customTitle)||cn(r.aiTitle)||void 0,i=n||cn(r.lastPrompt)||cn(r.summaryHint)||o;if(!i)return null;return{sessionId:e.sessionId,summary:i,lastModified:e.mtime,fileSize:void 0,customTitle:n,firstPrompt:o,gitBranch:cn(r.gitBranch)||void 0,cwd:cn(r.cwd)||t||void 0,tag:cn(r.tag)||void 0,createdAt:TU(r.createdAt)}}function cn(e){return typeof e==="string"?e:void 0}function TU(e){return typeof e==="number"?e:void 0}function EU(e){if(typeof e!=="string")return;let t=Date.parse(e);return Number.isNaN(t)?void 0:t}function PU(e,t){if(e.firstPromptLocked)return;let r={commandFallback:e.commandFallback??""},o=Hs(t,r);if(r.commandFallback&&!e.commandFallback)e.commandFallback=r.commandFallback;if(o!==void 0)e.firstPrompt=o,e.firstPromptLocked=!0}class kg{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 r=this.keyToString(e),o=this.store.get(r)??[];o.push(...t),this.store.set(r,o);let n=Math.max(Date.now(),this.lastMtime+1);if(this.lastMtime=n,this.mtimes.set(r,n),e.subpath===void 0){let i=`${e.projectKey}/${e.sessionId}`,s=fu(this.summaries.get(i),e,t,{mtime:n});this.summaries.set(i,s)}}async load(e){let t=this.keyToString(e);return this.store.get(t)??null}async listSessions(e){let t=[],r=e+"/";for(let[o]of this.store)if(o.startsWith(r)){let n=o.slice(r.length);if(!n.includes("/"))t.push({sessionId:n,mtime:this.mtimes.get(o)??0})}return t}async listSessionSummaries(e){let t=[],r=e+"/";for(let[o,n]of this.summaries)if(o.startsWith(r))t.push(n);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 r=`${e.projectKey}/${e.sessionId}/`;for(let o of this.store.keys())if(o.startsWith(r))this.store.delete(o),this.mtimes.delete(o)}}async listSubkeys(e){let t=`${e.projectKey}/${e.sessionId}/`,r=[];for(let o of this.store.keys())if(o.startsWith(t))r.push(o.slice(t.length));return r}getEntries(e){return this.store.get(this.keyToString(e))??[]}get size(){let e=0;for(let t of this.store.keys()){let r=t.indexOf("/");if(r!==-1&&!t.slice(r+1).includes("/"))e++}return e}clear(){this.store.clear(),this.mtimes.clear(),this.summaries.clear()}}class it extends Error{}function mu(){return process.versions.bun!==void 0}function Te(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 ln(){let e=new Set;return{subscribe(t){return e.add(t),()=>{e.delete(t)}},emit(...t){let r;for(let o of e)try{o(...t)}catch(n){(r??=[]).push(n)}if(r)throw r.length===1?r[0]:AggregateError(r,"Signal listener(s) threw")},clear(){e.clear()}}}var RU=typeof global=="object"&&global&&global.Object===Object&&global,gu=RU;var $U=typeof self=="object"&&self&&self.Object===Object&&self,OU=gu||$U||Function("return this")(),Ht=OU;var AU=Ht.Symbol,Bt=AU;var gw=Object.prototype,CU=gw.hasOwnProperty,MU=gw.toString,Bs=Bt?Bt.toStringTag:void 0;function NU(e){var t=CU.call(e,Bs),r=e[Bs];try{e[Bs]=void 0;var o=!0}catch(i){}var n=MU.call(e);if(o)if(t)e[Bs]=r;else delete e[Bs];return n}var hw=NU;var DU=Object.prototype,jU=DU.toString;function zU(e){return jU.call(e)}var yw=zU;var UU="[object Null]",LU="[object Undefined]",bw=Bt?Bt.toStringTag:void 0;function FU(e){if(e==null)return e===void 0?LU:UU;return bw&&bw in Object(e)?hw(e):yw(e)}var wr=FU;function HU(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var et=HU;var BU="[object AsyncFunction]",qU="[object Function]",ZU="[object GeneratorFunction]",VU="[object Proxy]";function WU(e){if(!et(e))return!1;var t=wr(e);return t==qU||t==ZU||t==BU||t==VU}var Yo=WU;var KU=Ht["__core-js_shared__"],hu=KU;var _w=function(){var e=/[^.]+$/.exec(hu&&hu.keys&&hu.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function GU(e){return!!_w&&_w in e}var vw=GU;var JU=Function.prototype,XU=JU.toString;function YU(e){if(e!=null){try{return XU.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var Sw=YU;var QU=/[\\^$.*+?()[\]{}|]/g,eL=/^\[object .+?Constructor\]$/,tL=Function.prototype,rL=Object.prototype,nL=tL.toString,oL=rL.hasOwnProperty,iL=RegExp("^"+nL.call(oL).replace(QU,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function sL(e){if(!et(e)||vw(e))return!1;var t=Yo(e)?iL:eL;return t.test(Sw(e))}var xw=sL;function aL(e,t){return e==null?void 0:e[t]}var ww=aL;function cL(e,t){var r=ww(e,t);return xw(r)?r:void 0}var Qo=cL;var lL=Qo(Object,"create"),Mr=lL;function uL(){this.__data__=Mr?Mr(null):{},this.size=0}var kw=uL;function dL(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Tw=dL;var pL="__lodash_hash_undefined__",fL=Object.prototype,mL=fL.hasOwnProperty;function gL(e){var t=this.__data__;if(Mr){var r=t[e];return r===pL?void 0:r}return mL.call(t,e)?t[e]:void 0}var Ew=gL;var hL=Object.prototype,yL=hL.hasOwnProperty;function bL(e){var t=this.__data__;return Mr?t[e]!==void 0:yL.call(t,e)}var Pw=bL;var _L="__lodash_hash_undefined__";function vL(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Mr&&t===void 0?_L:t,this}var Iw=vL;function ei(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var o=e[t];this.set(o[0],o[1])}}ei.prototype.clear=kw;ei.prototype.delete=Tw;ei.prototype.get=Ew;ei.prototype.has=Pw;ei.prototype.set=Iw;var Tg=ei;function SL(){this.__data__=[],this.size=0}var Rw=SL;function xL(e,t){return e===t||e!==e&&t!==t}var un=xL;function wL(e,t){var r=e.length;while(r--)if(un(e[r][0],t))return r;return-1}var dn=wL;var kL=Array.prototype,TL=kL.splice;function EL(e){var t=this.__data__,r=dn(t,e);if(r<0)return!1;var o=t.length-1;if(r==o)t.pop();else TL.call(t,r,1);return--this.size,!0}var $w=EL;function PL(e){var t=this.__data__,r=dn(t,e);return r<0?void 0:t[r][1]}var Ow=PL;function IL(e){return dn(this.__data__,e)>-1}var Aw=IL;function RL(e,t){var r=this.__data__,o=dn(r,e);if(o<0)++this.size,r.push([e,t]);else r[o][1]=t;return this}var Cw=RL;function ti(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var o=e[t];this.set(o[0],o[1])}}ti.prototype.clear=Rw;ti.prototype.delete=$w;ti.prototype.get=Ow;ti.prototype.has=Aw;ti.prototype.set=Cw;var pn=ti;var $L=Qo(Ht,"Map"),yu=$L;function OL(){this.size=0,this.__data__={hash:new Tg,map:new(yu||pn),string:new Tg}}var Mw=OL;function AL(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Nw=AL;function CL(e,t){var r=e.__data__;return Nw(t)?r[typeof t=="string"?"string":"hash"]:r.map}var fn=CL;function ML(e){var t=fn(this,e).delete(e);return this.size-=t?1:0,t}var Dw=ML;function NL(e){return fn(this,e).get(e)}var jw=NL;function DL(e){return fn(this,e).has(e)}var zw=DL;function jL(e,t){var r=fn(this,e),o=r.size;return r.set(e,t),this.size+=r.size==o?0:1,this}var Uw=jL;function ri(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var o=e[t];this.set(o[0],o[1])}}ri.prototype.clear=Mw;ri.prototype.delete=Dw;ri.prototype.get=jw;ri.prototype.has=zw;ri.prototype.set=Uw;var qs=ri;var zL="Expected a function";function Eg(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw TypeError(zL);var r=function(){var o=arguments,n=t?t.apply(this,o):o[0],i=r.cache;if(i.has(n))return i.get(n);var s=e.apply(this,o);return r.cache=i.set(n,s)||i,s};return r.cache=new(Eg.Cache||qs),r}Eg.Cache=qs;var Ce=Eg;import{homedir as UL}from"os";import{join as LL}from"path";var qt=Ce(()=>{return(process.env.CLAUDE_CONFIG_DIR??LL(UL(),".claude")).normalize("NFC")},()=>process.env.CLAUDE_CONFIG_DIR);var Xoe=Ce(()=>Te(process.env.CLAUDE_CODE_SUPERVISED));function D(e,t,r,o,n){if(o==="m")throw TypeError("Private method is not writable");if(o==="a"&&!n)throw TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!n:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?n.call(e,r):n?n.value=r:t.set(e,r),r}function _(e,t,r,o){if(r==="a"&&!o)throw TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!o:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?o:r==="a"?o.call(e):o?o.value:t.get(e)}var Pg=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return Pg=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),r=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(o)=>(+o^r()&15>>+o/4).toString(16))};function Nr(e){return typeof e==="object"&&e!==null&&(("name"in e)&&e.name==="AbortError"||("message"in e)&&String(e.message).includes("FetchRequestCanceledException"))}var Zs=(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)};class z extends Error{}class We extends z{constructor(e,t,r,o,n){super(`${We.makeMessage(e,t,r)}`);this.status=e,this.headers=o,this.requestID=o?.get("request-id"),this.error=t,this.type=n??null}static makeMessage(e,t,r){let o=t?.message?typeof t.message==="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):r;if(e&&o)return`${e} ${o}`;if(e)return`${e} status code (no body)`;if(o)return o;return"(no status code or body)"}static generate(e,t,r,o){if(!e||!o)return new to({message:r,cause:Zs(t)});let n=t,i=n?.error?.type;if(e===400)return new Ws(e,n,r,o,i);if(e===401)return new Ks(e,n,r,o,i);if(e===403)return new Gs(e,n,r,o,i);if(e===404)return new Js(e,n,r,o,i);if(e===409)return new Xs(e,n,r,o,i);if(e===422)return new Ys(e,n,r,o,i);if(e===429)return new Qs(e,n,r,o,i);if(e>=500)return new ea(e,n,r,o,i);return new We(e,n,r,o,i)}}class tt extends We{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}}class to extends We{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0);if(t)this.cause=t}}class Vs extends to{constructor({message:e}={}){super({message:e??"Request timed out."})}}class Ws extends We{}class Ks extends We{}class Gs extends We{}class Js extends We{}class Xs extends We{}class Ys extends We{}class Qs extends We{}class ea extends We{}var HL=/^[a-z][a-z0-9+.-]*:/i,Lw=(e)=>{return HL.test(e)},Ig=(e)=>(Ig=Array.isArray,Ig(e)),Rg=Ig;function bu(e){if(typeof e!=="object")return{};return e??{}}function $g(e){if(!e)return!0;for(let t in e)return!1;return!0}function Fw(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Hw=(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};var _u=(e)=>{try{return JSON.parse(e)}catch(t){return}};var Bw=(e)=>new Promise((t)=>setTimeout(t,e));var Zt="0.94.0";var Ww=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"};function BL(){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"}var qL=()=>{let e=BL();if(e==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Zt,"X-Stainless-OS":Zw(Deno.build.os),"X-Stainless-Arch":qw(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":Zt,"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":Zt,"X-Stainless-OS":Zw(globalThis.process.platform??"unknown"),"X-Stainless-Arch":qw(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let t=ZL();if(t)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Zt,"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":Zt,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function ZL(){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:r}of e){let o=r.exec(navigator.userAgent);if(o){let n=o[1]||0,i=o[2]||0,s=o[3]||0;return{browser:t,version:`${n}.${i}.${s}`}}}return null}var qw=(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"},Zw=(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"},Vw,ta=()=>{return Vw??(Vw=qL())};function Kw(){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 Og(...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 vu(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return Og({start(){},async pull(r){let{done:o,value:n}=await t.next();if(o)r.close();else r.enqueue(n)},async cancel(){await t.return?.()}})}function ra(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let r=await t.read();if(r?.done)t.releaseLock();return r}catch(r){throw t.releaseLock(),r}},async return(){let r=t.cancel();return t.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Gw(e){if(e===null||typeof e!=="object")return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),r=t.cancel();t.releaseLock(),await r}var Jw=({headers:e,body:t})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)}};function Xw(e){return Object.entries(e).filter(([t,r])=>typeof r<"u").map(([t,r])=>{if(typeof r==="string"||typeof r==="number"||typeof r==="boolean")return`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(r===null)return`${encodeURIComponent(t)}=`;throw new z(`Cannot stringify type ${typeof r}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}var Qw="urn:ietf:params:oauth:grant-type:jwt-bearer",ek="refresh_token",Su="/v1/oauth/token",ro="oauth-2025-04-20",tk="oidc-federation-2026-04-01",rk=120,ni=30,nk=5,Yw=1048576;function xu(e){if(!e)return;let t;try{t=new URL(e)}catch(o){throw new he(`Invalid token endpoint base URL "${e}": ${o}`)}if(t.protocol==="https:")return;let r=t.hostname.toLowerCase().replace(/^\[|\]$/g,"");if(t.protocol==="http:"&&(r==="localhost"||r==="127.0.0.1"||r==="::1"))return;throw new he(`Refusing to send credential over non-https token endpoint "${e}"`)}async function wu(e,t){let r=await GL(e),o;try{o=JSON.parse(r)}catch{throw new he(`Token endpoint returned non-JSON response (status ${e.status})`,e.status,_t(r),t)}if(!o.access_token)throw new he(`Token endpoint response missing access_token: ${JSON.stringify(_t(o))}`,e.status,_t(o),t);if(o.token_type&&o.token_type.toLowerCase()!=="bearer")throw new he(`Token endpoint response: unsupported token_type "${o.token_type}" (want Bearer)`,e.status,_t(o),t);return o}var Ag=2000,KL=new Set(["error","error_description","error_uri"]);function _t(e){if(e==null)return e;if(typeof e==="string"){let t;try{t=JSON.parse(e)}catch{if(e.length<=Ag)return e;return e.slice(0,Ag)+`... <${e.length-Ag} more chars>`}return JSON.stringify(_t(t))}if(typeof e==="object"&&!Array.isArray(e)){let t={};for(let[r,o]of Object.entries(e))if(KL.has(r))t[r]=o;return t}return null}async function ku(e,t=(r)=>console.warn(`anthropic-sdk: ${r}`)){if(typeof process>"u"||process.platform==="win32")return;let r=await import("node:fs"),o=e,n;try{o=await r.promises.realpath(e),n=await r.promises.stat(o)}catch{return}let i=n.mode&511;if(i&18)throw new he(`Credentials file at ${o} is group/world-writable (mode 0o${i.toString(8)}); this allows other local users to plant tokens. Run \`chmod 600 ${o}\`.`);if(i&36)throw new he(`Credentials file at ${o} is group/world-readable (mode 0o${i.toString(8)}); run \`chmod 600 ${o}\` before retrying.`);if(typeof process.getuid==="function"&&n.uid!==process.getuid())t(`credentials file at ${o} is owned by uid ${n.uid} (current process uid ${process.getuid()}); verify this is intentional.`)}async function Tu(e,t){let r=await import("node:fs"),n=(await import("node:path")).dirname(e);await r.promises.mkdir(n,{recursive:!0,mode:448});let i=`${e}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{let s=await r.promises.open(i,"w",384);try{await s.writeFile(JSON.stringify(t,null,2)),await s.sync()}finally{await s.close()}await r.promises.rename(i,e)}catch(s){throw await r.promises.unlink(i).catch(()=>{}),s}try{let s=await r.promises.open(n,"r");try{await s.sync()}finally{await s.close()}}catch{}}async function GL(e){if(!e.body)return"";let t=e.body.getReader(),r=[],o=0;for(;;){let{done:i,value:s}=await t.read();if(i)break;if(o+s.length>Yw){let a=Yw-o;if(a>0)r.push(s.subarray(0,a));await t.cancel();break}r.push(s),o+=s.length}let n;if(r.length===1)n=r[0];else{n=new Uint8Array(r.reduce((s,a)=>s+a.length,0));let i=0;for(let s of r)n.set(s,i),i+=s.length}return new TextDecoder("utf-8").decode(n)}class he extends z{constructor(e,t=null,r=null,o=null){super(e);this.statusCode=t,this.body=r,this.requestId=o}}function ir(){return Math.floor(Date.now()/1000)}class Cg{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 r=t.expiresAt-ir();if(r>rk)return t.token;if(r>ni)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(ir()-this.lastAdvisoryError<nk)return;this.doRefresh().catch((e)=>{this.lastAdvisoryError=ir(),this.onAdvisoryRefreshError?.(e)})}doRefresh(e=!1){return this.pendingRefresh=this.provider(e?{forceRefresh:!0}:void 0).then((t)=>{return this.cached=t,this.pendingRefresh=null,t},(t)=>{throw this.pendingRefresh=null,t}),this.pendingRefresh}}var ge=(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 sk(e){let t=0;for(let n of e)t+=n.length;let r=new Uint8Array(t),o=0;for(let n of e)r.set(n,o),o+=n.length;return r}var ok;function oi(e){let t;return(ok??(t=new globalThis.TextEncoder,ok=t.encode.bind(t)))(e)}var ik;function Mg(e){let t;return(ik??(t=new globalThis.TextDecoder,ik=t.decode.bind(t)))(e)}var Pu={off:0,error:200,warn:300,info:400,debug:500},Ng=(e,t,r)=>{if(!e)return;if(Fw(Pu,e))return e;Le(r).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Pu))}`);return};function na(){}function Eu(e,t,r){if(!t||Pu[e]>Pu[r])return na;else return t[e].bind(t)}var JL={error:na,warn:na,info:na,debug:na},ak=new WeakMap;function Le(e){let t=e.logger,r=e.logLevel??"off";if(!t)return JL;let o=ak.get(t);if(o&&o[0]===r)return o[1];let n={error:Eu("error",t,r),warn:Eu("warn",t,r),info:Eu("info",t,r),debug:Eu("debug",t,r)};return ak.set(t,[r,n]),n}var Dr=(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,r])=>[t,t.toLowerCase()==="x-api-key"||t.toLowerCase()==="authorization"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":r]));if("retryOfRequestLogID"in e){if(e.retryOfRequestLogID)e.retryOf=e.retryOfRequestLogID;delete e.retryOfRequestLogID}return e};var Iu="1.0",XL=/^[A-Za-z0-9_.-]+$/;function ck(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(!XL.test(e))throw Error(`profile name "${e}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`)}var lk=async(e)=>{var t,r;let o=await Dg();if(o===null)return null;let n=e??await dk();if(n===null)return null;ck(n);let i=await import("node:fs"),a=(await import("node:path")).join(o,"configs",`${n}.json`),c;try{c=await i.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=ge("ANTHROPIC_ORGANIZATION_ID"),f=ge("ANTHROPIC_IDENTITY_TOKEN_FILE"),m=ge("ANTHROPIC_FEDERATION_RULE_ID");if(m&&p)return{fromFile:!1,config:{organization_id:p,workspace_id:ge("ANTHROPIC_WORKSPACE_ID"),base_url:ge("ANTHROPIC_BASE_URL"),authentication:{type:"oidc_federation",federation_rule_id:m,service_account_id:ge("ANTHROPIC_SERVICE_ACCOUNT_ID"),identity_token:f?{source:"file",path:f}:void 0,scope:ge("ANTHROPIC_SCOPE")}}};return null}let u;try{u=JSON.parse(c)}catch(p){throw Error(`failed to parse config file ${a}: ${p}`)}if(!u.authentication)throw Error(`config file ${a} is missing "authentication"`);let d=u.authentication.type;if(d!=="oidc_federation"&&d!=="user_oauth")throw Error(`authentication.type "${d}" is not a known authentication type`);if(u.organization_id??(u.organization_id=ge("ANTHROPIC_ORGANIZATION_ID")),u.workspace_id??(u.workspace_id=ge("ANTHROPIC_WORKSPACE_ID")),u.base_url??(u.base_url=ge("ANTHROPIC_BASE_URL")),(t=u.authentication).scope??(t.scope=ge("ANTHROPIC_SCOPE")),u.authentication.type==="oidc_federation"){if(!u.authentication.identity_token){let p=ge("ANTHROPIC_IDENTITY_TOKEN_FILE");if(p)u.authentication.identity_token={source:"file",path:p}}if(!u.authentication.federation_rule_id)u.authentication.federation_rule_id=ge("ANTHROPIC_FEDERATION_RULE_ID")??"";(r=u.authentication).service_account_id??(r.service_account_id=ge("ANTHROPIC_SERVICE_ACCOUNT_ID"))}return{config:u,fromFile:!0}};var uk=async(e,t)=>{if(e?.authentication.credentials_path)return e.authentication.credentials_path;let r=await Dg();if(!r)return null;let o=t??await dk();if(!o)return null;return ck(o),(await import("node:path")).join(r,"credentials",`${o}.json`)},Dg=async()=>{if(!YL())return null;let e=await import("node:path"),t=ge("ANTHROPIC_CONFIG_DIR");if(t)return t;if(ta()["X-Stainless-OS"]==="Windows"){let i=ge("APPDATA");if(i)return e.join(i,"Anthropic");let s=ge("USERPROFILE");if(s)return e.join(s,"AppData","Roaming","Anthropic");return null}let o=ge("XDG_CONFIG_HOME");if(o)return e.join(o,"anthropic");let n=ge("HOME");if(n)return e.join(n,".config","anthropic");return null},YL=()=>{let e=ta()["X-Stainless-Runtime"];return e==="node"||e==="deno"},dk=async()=>{let e=await Dg();if(!e)return null;let t=ge("ANTHROPIC_PROFILE");if(t)return t;let r=await import("node:fs"),n=(await import("node:path")).join(e,"active_config");try{return(await r.promises.readFile(n,"utf-8")).trim()||"default"}catch(i){if(i?.code!=="ENOENT")throw Error(`failed to read ${n}: ${i}`);return"default"}};function jg(e){if(!e)throw new z("Identity token file path is empty");return async()=>{let t=await import("node:fs"),r;try{r=await t.promises.readFile(e,"utf-8")}catch(n){throw new z(`Failed to read identity token file at ${e}: ${n}`)}let o=r.trim();if(!o)throw new z(`Identity token file at ${e} is empty`);return o}}function pk(e){if(!e)throw new z("Identity token value is empty");return()=>e}function fk(e){return async()=>{xu(e.baseURL);let t=await e.identityTokenProvider();if(t.length>16384)throw new he(`Identity token is ${Math.ceil(t.length/1024)} KiB, exceeds the 16 KiB assertion limit`);let r={grant_type:Qw,assertion:t,federation_rule_id:e.federationRuleId,organization_id:e.organizationId};if(e.serviceAccountId)r.service_account_id=e.serviceAccountId;if(e.workspaceId)r.workspace_id=e.workspaceId;let o=`${e.baseURL}${Su}`,n;try{n=await e.fetch(o,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":`${ro},${tk}`,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${Zt} oidcFederationProvider`},body:JSON.stringify(r)})}catch(c){throw new he(`Failed to reach token endpoint ${o}: ${c}`)}let i=n.headers.get("Request-Id");if(!n.ok){let c=await n.text().catch(()=>""),u=_t(c),d="";if(n.status===401)d=` 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 he(`Token exchange failed with status ${n.status}${i?` (request-id ${i})`:""}: ${u}${d}`,n.status,u,i)}let s=await wu(n,i),a=Number(s.expires_in);if(!Number.isFinite(a))throw new he(`Token endpoint response missing required fields: ${JSON.stringify(_t(s))}`,n.status,_t(s),i);return{token:s.access_token,expiresAt:ir()+a}}}function mk(e){return async(t)=>{let r=await import("node:fs");await ku(e.credentialsPath,e.onSafetyWarning);let o;try{o=await r.promises.readFile(e.credentialsPath,"utf-8")}catch(y){throw new he(`Credentials file not found at ${e.credentialsPath}: ${y}`)}let n;try{n=JSON.parse(o)}catch(y){throw new he(`Credentials file at ${e.credentialsPath} is not valid JSON: ${y}`)}let i=n.access_token;if(!i)throw new he(`Credentials file at ${e.credentialsPath} must include 'access_token'`);let s=n.expires_at;if(!t?.forceRefresh&&(s==null||ir()<s-ni))return{token:i,expiresAt:s??null};let a=n.refresh_token;if(!e.clientId||!a)throw new he(`Access token at ${e.credentialsPath} has expired and no refresh is available (client_id ${e.clientId?"set":"empty"}, refresh_token ${a?"set":"empty"})`);xu(e.baseURL);let c={grant_type:ek,refresh_token:a,client_id:e.clientId},u=`${e.baseURL}${Su}`,d;try{d=await e.fetch(u,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":ro,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${Zt} userOAuthProvider`},body:JSON.stringify(c)})}catch(y){throw new he(`User OAuth refresh failed to reach token endpoint: ${y}`)}let p=d.headers.get("Request-Id");if(!d.ok){let y=await d.text().catch(()=>"");throw new he(`User OAuth refresh failed (HTTP ${d.status}): ${_t(y)}`,d.status,_t(y),p)}let f=await wu(d,p),m=Number(f.expires_in);if(!Number.isFinite(m))throw new he(`User OAuth refresh response missing or invalid expires_in: ${JSON.stringify(_t(f))}`,d.status,_t(f),p);let g=ir()+m,h=f.refresh_token||a;return await Tu(e.credentialsPath,{...n,version:Iu,type:"oauth_token",access_token:f.access_token,expires_at:g,refresh_token:h}),{token:f.access_token,expiresAt:g}}}function zg(e,t){let r=e.authentication.credentials_path??null,o=(e.base_url||t.baseURL).replace(/\/+$/,""),n=QL(e,r,o,t),i={};if(e.workspace_id&&e.authentication.type==="user_oauth")i["anthropic-workspace-id"]=e.workspace_id;return{provider:n,extraHeaders:i,baseURL:e.base_url||void 0}}async function gk(e,t){let r=await lk(t);if(!r)return null;let{config:o,fromFile:n}=r,i=o.authentication.credentials_path||!n?o:{...o,authentication:{...o.authentication,credentials_path:await uk(o,t)??void 0}};return zg(i,e)}function QL(e,t,r,o){switch(e.authentication.type){case"oidc_federation":{let n=e.authentication,i=e1(n);if(!i)throw new he("oidc_federation config requires an identity token (set authentication.identity_token, ANTHROPIC_IDENTITY_TOKEN_FILE, or ANTHROPIC_IDENTITY_TOKEN)");if(!n.federation_rule_id)throw new he("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 he("oidc_federation config requires organization_id (set ANTHROPIC_ORGANIZATION_ID or config.organization_id)");let s=fk({identityTokenProvider:i,federationRuleId:n.federation_rule_id,organizationId:e.organization_id,serviceAccountId:n.service_account_id,workspaceId:e.workspace_id,baseURL:r,fetch:o.fetch,userAgent:o.userAgent});if(t)return t1(s,t,o.onCacheWriteError,o.onSafetyWarning);return s}case"user_oauth":{if(!t)throw new he("user_oauth config requires authentication.credentials_path (or load via a profile so it defaults to <config_dir>/credentials/<profile>.json)");return mk({credentialsPath:t,clientId:e.authentication.client_id,baseURL:r,fetch:o.fetch,userAgent:o.userAgent,onSafetyWarning:o.onSafetyWarning})}default:{let n=e.authentication.type;throw new he(`authentication.type "${n}" is not a known authentication type`)}}}function e1(e){if(e.identity_token){let o=e.identity_token.source;if(o!=="file")throw new he(`identity_token.source "${o}" is not supported by this SDK version (only "file")`);if(!e.identity_token.path)throw new he('identity_token.source "file" requires a non-empty path');return jg(e.identity_token.path)}let t=ge("ANTHROPIC_IDENTITY_TOKEN_FILE");if(t)return jg(t);let r=ge("ANTHROPIC_IDENTITY_TOKEN");if(r)return pk(r);return null}function t1(e,t,r,o){return async(n)=>{let i=await import("node:fs");await ku(t,o);let s;try{let c=await i.promises.readFile(t,"utf-8");s=JSON.parse(c);let u=s?.access_token;if(u&&!n?.forceRefresh){let d=s?.expires_at;if(d==null||ir()<d-ni)return{token:u,expiresAt:d??null}}}catch(c){if(c?.code!=="ENOENT"&&!(c instanceof SyntaxError))r?.(c)}let a=await e(n);try{await Tu(t,{...s??{},version:Iu,type:"oauth_token",access_token:a.token,expires_at:a.expiresAt})}catch(c){r?.(c)}return a}}var Ct,Mt;class mn{constructor(){Ct.set(this,void 0),Mt.set(this,void 0),D(this,Ct,new Uint8Array,"f"),D(this,Mt,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==="string"?oi(e):e;D(this,Ct,sk([_(this,Ct,"f"),t]),"f");let r=[],o;while((o=r1(_(this,Ct,"f"),_(this,Mt,"f")))!=null){if(o.carriage&&_(this,Mt,"f")==null){D(this,Mt,o.index,"f");continue}if(_(this,Mt,"f")!=null&&(o.index!==_(this,Mt,"f")+1||o.carriage)){r.push(Mg(_(this,Ct,"f").subarray(0,_(this,Mt,"f")-1))),D(this,Ct,_(this,Ct,"f").subarray(_(this,Mt,"f")),"f"),D(this,Mt,null,"f");continue}let n=_(this,Mt,"f")!==null?o.preceding-1:o.preceding,i=Mg(_(this,Ct,"f").subarray(0,n));r.push(i),D(this,Ct,_(this,Ct,"f").subarray(o.index),"f"),D(this,Mt,null,"f")}return r}flush(){if(!_(this,Ct,"f").length)return[];return this.decode(`
17
- `)}}Ct=new WeakMap,Mt=new WeakMap;mn.NEWLINE_CHARS=new Set([`
18
- `,"\r"]);mn.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function r1(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function hk(e){for(let o=0;o<e.length-1;o++){if(e[o]===10&&e[o+1]===10)return o+2;if(e[o]===13&&e[o+1]===13)return o+2;if(e[o]===13&&e[o+1]===10&&o+3<e.length&&e[o+2]===13&&e[o+3]===10)return o+4}return-1}var oa;class Nt{constructor(e,t,r){this.iterator=e,oa.set(this,void 0),this.controller=t,D(this,oa,r,"f")}static fromSSEResponse(e,t,r){let o=!1,n=r?Le(r):console;async function*i(){if(o)throw new z("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let a of n1(e,t)){if(a.event==="completion")try{yield JSON.parse(a.data)}catch(c){throw n.error("Could not parse message into JSON:",a.data),n.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==="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==="span.model_request_start"||a.event==="span.model_request_end")try{yield JSON.parse(a.data)}catch(c){throw n.error("Could not parse message into JSON:",a.data),n.error("From chunk:",a.raw),c}if(a.event==="ping")continue;if(a.event==="error"){let c=_u(a.data)??a.data,u=c?.error?.type;throw new We(void 0,c,void 0,e.headers,u)}}s=!0}catch(a){if(Nr(a))return;throw a}finally{if(!s)t.abort()}}return new Nt(i,t,r)}static fromReadableStream(e,t,r){let o=!1;async function*n(){let s=new mn,a=ra(e);for await(let c of a)for(let u of s.decode(c))yield u;for(let c of s.flush())yield c}async function*i(){if(o)throw new z("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let a of n()){if(s)continue;if(a)yield JSON.parse(a)}s=!0}catch(a){if(Nr(a))return;throw a}finally{if(!s)t.abort()}}return new Nt(i,t,r)}[(oa=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],t=[],r=this.iterator(),o=(n)=>{return{next:()=>{if(n.length===0){let i=r.next();e.push(i),t.push(i)}return n.shift()}}};return[new Nt(()=>o(e),this.controller,_(this,oa,"f")),new Nt(()=>o(t),this.controller,_(this,oa,"f"))]}toReadableStream(){let e=this,t;return Og({async start(){t=e[Symbol.asyncIterator]()},async pull(r){try{let{value:o,done:n}=await t.next();if(n)return r.close();let i=oi(JSON.stringify(o)+`
19
- `);r.enqueue(i)}catch(o){r.error(o)}},async cancel(){await t.return?.()}})}}async function*n1(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 r=new yk,o=new mn,n=ra(e.body);for await(let i of o1(n))for(let s of o.decode(i)){let a=r.decode(s);if(a)yield a}for(let i of o.flush()){let s=r.decode(i);if(s)yield s}}async function*o1(e){let t=new Uint8Array;for await(let r of e){if(r==null)continue;let o=r instanceof ArrayBuffer?new Uint8Array(r):typeof r==="string"?oi(r):r,n=new Uint8Array(t.length+o.length);n.set(t),n.set(o,t.length),t=n;let i;while((i=hk(t))!==-1)yield t.slice(0,i),t=t.slice(i)}if(t.length>0)yield t}class yk{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 n={event:this.event,data:this.data.join(`
20
- `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],n}if(this.chunks.push(e),e.startsWith(":"))return null;let[t,r,o]=i1(e,":");if(o.startsWith(" "))o=o.substring(1);if(t==="event")this.event=o;else if(t==="data")this.data.push(o);return null}}function i1(e,t){let r=e.indexOf(t);if(r!==-1)return[e.substring(0,r),t,e.substring(r+t.length)];return[e,"",""]}async function Ru(e,t){let{response:r,requestLogID:o,retryOfRequestLogID:n,startTime:i}=t,s=await(async()=>{if(t.options.stream){if(Le(e).debug("response",r.status,r.url,r.headers,r.body),t.options.__streamClass)return t.options.__streamClass.fromSSEResponse(r,t.controller);return Nt.fromSSEResponse(r,t.controller)}if(r.status===204)return null;if(t.options.__binaryResponse)return r;let c=r.headers.get("content-type")?.split(";")[0]?.trim();if(c?.includes("application/json")||c?.endsWith("+json")){if(r.headers.get("content-length")==="0")return;let f=await r.json();return Ug(f,r)}return await r.text()})();return Le(e).debug(`[${o}] response parsed`,Dr({retryOfRequestLogID:n,url:r.url,status:r.status,body:s,durationMs:Date.now()-i})),s}function Ug(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 ia;class no extends Promise{constructor(e,t,r=Ru){super((o)=>{o(null)});this.responsePromise=t,this.parseResponse=r,ia.set(this,void 0),D(this,ia,e,"f")}_thenUnwrap(e){return new no(_(this,ia,"f"),this.responsePromise,async(t,r)=>Ug(e(await this.parseResponse(t,r),r),r.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(_(this,ia,"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)}}ia=new WeakMap;var $u;class Lg{constructor(e,t,r,o){$u.set(this,void 0),D(this,$u,e,"f"),this.options=o,this.response=t,this.body=r}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 _(this,$u,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;yield e;while(e.hasNextPage())e=await e.getNextPage(),yield e}async*[($u=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let t of e.getPaginatedItems())yield t}}class Ou extends no{constructor(e,t,r){super(e,t,async(o,n)=>new r(o,n.response,await Ru(o,n),n.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let t of e)yield t}}class sr extends Lg{constructor(e,t,r,o){super(e,t,r,o);this.data=r.data||[],this.has_more=r.has_more||!1,this.first_id=r.first_id||null,this.last_id=r.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:{...bu(this.options.query),before_id:t}}}let e=this.last_id;if(!e)return null;return{...this.options,query:{...bu(this.options.query),after_id:e}}}}class ye extends Lg{constructor(e,t,r,o){super(e,t,r,o);this.data=r.data||[],this.next_page=r.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let e=this.next_page;if(!e)return null;return{...this.options,query:{...bu(this.options.query),page:e}}}}var Hg=()=>{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`.":""))}};function oo(e,t,r){return Hg(),new File(e,t??"unknown_file",r)}function sa(e,t){let r=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?r.split(/[\\/]/).pop()||void 0:r}var Bg=(e)=>e!=null&&typeof e==="object"&&typeof e[Symbol.asyncIterator]==="function";var ii=async(e,t,r=!0)=>{return{...e,body:await c1(e.body,t,r)}},bk=new WeakMap;function a1(e){let t=typeof e==="function"?e:e.fetch,r=bk.get(t);if(r)return r;let o=(async()=>{try{let n="Response"in t?t.Response:(await t("data:,")).constructor,i=new FormData;if(i.toString()===await new n(i).text())return!1;return!0}catch{return!0}})();return bk.set(t,o),o}var c1=async(e,t,r=!0)=>{if(!await a1(t))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let o=new FormData;return await Promise.all(Object.entries(e||{}).map(([n,i])=>Fg(o,n,i,r))),o},l1=(e)=>e instanceof Blob&&("name"in e);var Fg=async(e,t,r,o)=>{if(r===void 0)return;if(r==null)throw TypeError(`Received null for "${t}"; to pass null in FormData, you must use the string 'null'`);if(typeof r==="string"||typeof r==="number"||typeof r==="boolean")e.append(t,String(r));else if(r instanceof Response){let n={},i=r.headers.get("Content-Type");if(i)n={type:i};e.append(t,oo([await r.blob()],sa(r,o),n))}else if(Bg(r))e.append(t,oo([await new Response(vu(r)).blob()],sa(r,o)));else if(l1(r))e.append(t,oo([r],sa(r,o),{type:r.type}));else if(Array.isArray(r))await Promise.all(r.map((n)=>Fg(e,t+"[]",n,o)));else if(typeof r==="object")await Promise.all(Object.entries(r).map(([n,i])=>Fg(e,`${t}[${n}]`,i,o)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)};var _k=(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",u1=(e)=>e!=null&&typeof e==="object"&&typeof e.name==="string"&&typeof e.lastModified==="number"&&_k(e),d1=(e)=>e!=null&&typeof e==="object"&&typeof e.url==="string"&&typeof e.blob==="function";async function Au(e,t,r){if(Hg(),e=await e,t||(t=sa(e,!0)),u1(e)){if(e instanceof File&&t==null&&r==null)return e;return oo([await e.arrayBuffer()],t??e.name,{type:e.type,lastModified:e.lastModified,...r})}if(d1(e)){let n=await e.blob();return t||(t=new URL(e.url).pathname.split(/[\\/]/).pop()),oo(await qg(n),t,r)}let o=await qg(e);if(!r?.type){let n=o.find((i)=>typeof i==="object"&&("type"in i)&&i.type);if(typeof n==="string")r={...r,type:n}}return oo(o,t,r)}async function qg(e){let t=[];if(typeof e==="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(_k(e))t.push(e instanceof Blob?e:await e.arrayBuffer());else if(Bg(e))for await(let r of e)t.push(...await qg(r));else{let r=e?.constructor?.name;throw Error(`Unexpected data type: ${typeof e}${r?`; constructor: ${r}`:""}${p1(e)}`)}return t}function p1(e){if(typeof e!=="object"||e===null)return"";return`; props: [${Object.getOwnPropertyNames(e).map((r)=>`"${r}"`).join(", ")}]`}class J{constructor(e){this._client=e}}var vk=Symbol.for("brand.privateNullableHeaders");function*m1(e){if(!e)return;if(vk in e){let{values:o,nulls:n}=e;yield*o.entries();for(let i of n)yield[i,null];return}let t=!1,r;if(e instanceof Headers)r=e.entries();else if(Rg(e))r=e;else t=!0,r=Object.entries(e??{});for(let o of r){let n=o[0];if(typeof n!=="string")throw TypeError("expected header name to be a string");let i=Rg(o[1])?o[1]:[o[1]],s=!1;for(let a of i){if(a===void 0)continue;if(t&&!s)s=!0,yield[n,null];yield[n,a]}}}var T=(e)=>{let t=new Headers,r=new Set;for(let o of e){let n=new Set;for(let[i,s]of m1(o)){let a=i.toLowerCase();if(!n.has(a))t.delete(i),n.add(a);if(s===null)t.delete(i),r.add(a);else t.append(i,s),r.delete(a)}}return{[vk]:!0,values:t,nulls:r}};function xk(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var Sk=Object.freeze(Object.create(null)),g1=(e=xk)=>function(r,...o){if(r.length===1)return r[0];let n=!1,i=[],s=r.reduce((d,p,f)=>{if(/[?#]/.test(p))n=!0;let m=o[f],g=(n?encodeURIComponent:e)(""+m);if(f!==o.length&&(m==null||typeof m==="object"&&m.toString===Object.getPrototypeOf(Object.getPrototypeOf(m.hasOwnProperty??Sk)??Sk)?.toString))g=m+"",i.push({start:d.length+p.length,length:g.length,error:`Value of type ${Object.prototype.toString.call(m).slice(8,-1)} is not a valid path parameter`});return d+p+(f===o.length?"":g)},""),a=s.split(/[?#]/,1)[0],c=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,u;while((u=c.exec(a))!==null)i.push({start:u.index,length:u[0].length,error:`Value "${u[0]}" can't be safely passed as a path parameter`});if(i.sort((d,p)=>d.start-p.start),i.length>0){let d=0,p=i.reduce((f,m)=>{let g=" ".repeat(m.start-d),h="^".repeat(m.length);return d=m.start+m.length,f+g+h},"");throw new z(`Path parameters result in path with invalid segments:
15
+ deps: ${r}}`};var pY={keyword:"dependencies",type:"object",schemaType:"object",error:ZM.error,code(e){let[t,r]=fY(e);BM(e,t),qM(e,r)}};function fY({schema:e}){let t={},r={};for(let o in e){if(o==="__proto__")continue;let n=Array.isArray(e[o])?t:r;n[o]=e[o]}return[t,r]}function BM(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let s in t){let a=t[s];if(a.length===0)continue;let c=(0,Vl.propertyInData)(r,o,s,n.opts.ownProperties);if(e.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),n.allErrors)r.if(c,()=>{for(let u of a)(0,Vl.checkReportMissingProp)(e,u)});else r.if(rx._`${c} && (${(0,Vl.checkMissingProp)(e,a,i)})`),(0,Vl.reportMissingProp)(e,i),r.else()}}ZM.validatePropertyDeps=BM;function qM(e,t=e.schema){let{gen:r,data:o,keyword:n,it:i}=e,s=r.name("valid");for(let a in t){if((0,dY.alwaysValidSchema)(i,t[a]))continue;r.if((0,Vl.propertyInData)(r,o,a,i.opts.ownProperties),()=>{let c=e.subschema({keyword:n,schemaProp:a},s);e.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),e.ok(s)}}ZM.validateSchemaDeps=qM;ZM.default=pY});var XM=k((JM)=>{Object.defineProperty(JM,"__esModule",{value:!0});var GM=te(),hY=ue(),yY={message:"property name must be valid",params:({params:e})=>GM._`{propertyName: ${e.propertyName}}`},bY={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:yY,code(e){let{gen:t,schema:r,data:o,it:n}=e;if((0,hY.alwaysValidSchema)(n,r))return;let i=t.name("valid");t.forIn("key",o,(s)=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},i),t.if((0,GM.not)(i),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(i)}};JM.default=bY});var nx=k((YM)=>{Object.defineProperty(YM,"__esModule",{value:!0});var Wm=er(),br=te(),vY=tn(),Km=ue(),SY={message:"must NOT have additional properties",params:({params:e})=>br._`{additionalProperty: ${e.additionalProperty}}`},xY={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:SY,code(e){let{gen:t,schema:r,parentSchema:o,data:n,errsCount:i,it:s}=e;if(!i)throw Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,Km.alwaysValidSchema)(s,r))return;let u=(0,Wm.allSchemaProperties)(o.properties),d=(0,Wm.allSchemaProperties)(o.patternProperties);p(),e.ok(br._`${i} === ${vY.default.errors}`);function p(){t.forIn("key",n,(y)=>{if(!u.length&&!d.length)g(y);else t.if(f(y),()=>g(y))})}function f(y){let v;if(u.length>8){let x=(0,Km.schemaRefOrVal)(s,o.properties,"properties");v=(0,Wm.isOwnProperty)(t,x,y)}else if(u.length)v=(0,br.or)(...u.map((x)=>br._`${y} === ${x}`));else v=br.nil;if(d.length)v=(0,br.or)(v,...d.map((x)=>br._`${(0,Wm.usePattern)(e,x)}.test(${y})`));return(0,br.not)(v)}function m(y){t.code(br._`delete ${n}[${y}]`)}function g(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(y);return}if(r===!1){if(e.setParams({additionalProperty:y}),e.error(),!a)t.break();return}if(typeof r=="object"&&!(0,Km.alwaysValidSchema)(s,r)){let v=t.name("valid");if(c.removeAdditional==="failing")h(y,v,!1),t.if((0,br.not)(v),()=>{e.reset(),m(y)});else if(h(y,v),!a)t.if((0,br.not)(v),()=>t.break())}}function h(y,v,x){let w={keyword:"additionalProperties",dataProp:y,dataPropType:Km.Type.Str};if(x===!1)Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(w,v)}}};YM.default=xY});var rN=k((tN)=>{Object.defineProperty(tN,"__esModule",{value:!0});var kY=Ml(),QM=er(),ox=ue(),eN=nx(),EY={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:i}=e;if(i.opts.removeAdditional==="all"&&o.additionalProperties===void 0)eN.default.code(new kY.KeywordCxt(i,eN.default,"additionalProperties"));let s=(0,QM.allSchemaProperties)(r);for(let p of s)i.definedProperties.add(p);if(i.opts.unevaluated&&s.length&&i.props!==!0)i.props=ox.mergeEvaluated.props(t,(0,ox.toHash)(s),i.props);let a=s.filter((p)=>!(0,ox.alwaysValidSchema)(i,r[p]));if(a.length===0)return;let c=t.name("valid");for(let p of a){if(u(p))d(p);else{if(t.if((0,QM.propertyInData)(t,n,p,i.opts.ownProperties)),d(p),!i.allErrors)t.else().var(c,!0);t.endIf()}e.it.definedProperties.add(p),e.ok(c)}function u(p){return i.opts.useDefaults&&!i.compositeRule&&r[p].default!==void 0}function d(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},c)}}};tN.default=EY});var aN=k((sN)=>{Object.defineProperty(sN,"__esModule",{value:!0});var nN=er(),Gm=te(),oN=ue(),iN=ue(),PY={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:i}=e,{opts:s}=i,a=(0,nN.allSchemaProperties)(r),c=a.filter((h)=>(0,oN.alwaysValidSchema)(i,r[h]));if(a.length===0||c.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let u=s.strictSchema&&!s.allowMatchingProperties&&n.properties,d=t.name("valid");if(i.props!==!0&&!(i.props instanceof Gm.Name))i.props=(0,iN.evaluatedPropsToName)(t,i.props);let{props:p}=i;f();function f(){for(let h of a){if(u)m(h);if(i.allErrors)g(h);else t.var(d,!0),g(h),t.if(d)}}function m(h){for(let y in u)if(new RegExp(h).test(y))(0,oN.checkStrictMode)(i,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function g(h){t.forIn("key",o,(y)=>{t.if(Gm._`${(0,nN.usePattern)(e,h)}.test(${y})`,()=>{let v=c.includes(h);if(!v)e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:iN.Type.Str},d);if(i.opts.unevaluated&&p!==!0)t.assign(Gm._`${p}[${y}]`,!0);else if(!v&&!i.allErrors)t.if((0,Gm.not)(d),()=>t.break())})})}}};sN.default=PY});var lN=k((cN)=>{Object.defineProperty(cN,"__esModule",{value:!0});var RY=ue(),$Y={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if((0,RY.alwaysValidSchema)(o,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};cN.default=$Y});var dN=k((uN)=>{Object.defineProperty(uN,"__esModule",{value:!0});var AY=er(),CY={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:AY.validateUnion,error:{message:"must match a schema in anyOf"}};uN.default=CY});var fN=k((pN)=>{Object.defineProperty(pN,"__esModule",{value:!0});var Jm=te(),NY=ue(),DY={message:"must match exactly one schema in oneOf",params:({params:e})=>Jm._`{passingSchemas: ${e.passing}}`},jY={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:DY,code(e){let{gen:t,schema:r,parentSchema:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let i=r,s=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(s,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((d,p)=>{let f;if((0,NY.alwaysValidSchema)(n,d))t.var(c,!0);else f=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},c);if(p>0)t.if(Jm._`${c} && ${s}`).assign(s,!1).assign(a,Jm._`[${a}, ${p}]`).else();t.if(c,()=>{if(t.assign(s,!0),t.assign(a,p),f)e.mergeEvaluated(f,Jm.Name)})})}}};pN.default=jY});var gN=k((mN)=>{Object.defineProperty(mN,"__esModule",{value:!0});var UY=ue(),LY={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((i,s)=>{if((0,UY.alwaysValidSchema)(o,i))return;let a=e.subschema({keyword:"allOf",schemaProp:s},n);e.ok(n),e.mergeEvaluated(a)})}};mN.default=LY});var _N=k((bN)=>{Object.defineProperty(bN,"__esModule",{value:!0});var Xm=te(),yN=ue(),HY={message:({params:e})=>Xm.str`must match "${e.ifClause}" schema`,params:({params:e})=>Xm._`{failingKeyword: ${e.ifClause}}`},BY={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:HY,code(e){let{gen:t,parentSchema:r,it:o}=e;if(r.then===void 0&&r.else===void 0)(0,yN.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=hN(o,"then"),i=hN(o,"else");if(!n&&!i)return;let s=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),n&&i){let d=t.let("ifClause");e.setParams({ifClause:d}),t.if(a,u("then",d),u("else",d))}else if(n)t.if(a,u("then"));else t.if((0,Xm.not)(a),u("else"));e.pass(s,()=>e.error(!0));function c(){let d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(d)}function u(d,p){return()=>{let f=e.subschema({keyword:d},a);if(t.assign(s,a),e.mergeValidEvaluated(f,s),p)t.assign(p,Xm._`${d}`);else e.setParams({ifClause:d})}}}};function hN(e,t){let r=e.schema[t];return r!==void 0&&!(0,yN.alwaysValidSchema)(e,r)}bN.default=BY});var SN=k((vN)=>{Object.defineProperty(vN,"__esModule",{value:!0});var ZY=ue(),VY={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)(0,ZY.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};vN.default=VY});var wN=k((xN)=>{Object.defineProperty(xN,"__esModule",{value:!0});var KY=ex(),GY=jM(),JY=tx(),XY=LM(),YY=HM(),QY=KM(),e7=XM(),t7=nx(),r7=rN(),n7=aN(),o7=lN(),i7=dN(),s7=fN(),a7=gN(),c7=_N(),l7=SN();function u7(e=!1){let t=[o7.default,i7.default,s7.default,a7.default,c7.default,l7.default,e7.default,t7.default,QY.default,r7.default,n7.default];if(e)t.push(GY.default,XY.default);else t.push(KY.default,JY.default);return t.push(YY.default),t}xN.default=u7});var EN=k((kN)=>{Object.defineProperty(kN,"__esModule",{value:!0});var Be=te(),p7={message:({schemaCode:e})=>Be.str`must match format "${e}"`,params:({schemaCode:e})=>Be._`{format: ${e}}`},f7={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:p7,code(e,t){let{gen:r,data:o,$data:n,schema:i,schemaCode:s,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:d,self:p}=a;if(!c.validateFormats)return;if(n)f();else m();function f(){let g=r.scopeValue("formats",{ref:p.formats,code:c.code.formats}),h=r.const("fDef",Be._`${g}[${s}]`),y=r.let("fType"),v=r.let("format");r.if(Be._`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(y,Be._`${h}.type || "string"`).assign(v,Be._`${h}.validate`),()=>r.assign(y,Be._`"string"`).assign(v,h)),e.fail$data((0,Be.or)(x(),w()));function x(){if(c.strictSchema===!1)return Be.nil;return Be._`${s} && !${v}`}function w(){let O=d.$async?Be._`(${h}.async ? await ${v}(${o}) : ${v}(${o}))`:Be._`${v}(${o})`,L=Be._`(typeof ${v} == "function" ? ${O} : ${v}.test(${o}))`;return Be._`${v} && ${v} !== true && ${y} === ${t} && !${L}`}}function m(){let g=p.formats[i];if(!g){x();return}if(g===!0)return;let[h,y,v]=w(g);if(h===t)e.pass(O());function x(){if(c.strictSchema===!1){p.logger.warn(L());return}throw Error(L());function L(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function w(L){let se=L instanceof RegExp?(0,Be.regexpCode)(L):c.code.formats?Be._`${c.code.formats}${(0,Be.getProperty)(i)}`:void 0,Ue=r.scopeValue("formats",{key:i,ref:L,code:se});if(typeof L=="object"&&!(L instanceof RegExp))return[L.type||"string",L.validate,Be._`${Ue}.validate`];return["string",L,Ue]}function O(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!d.$async)throw Error("async format in sync schema");return Be._`await ${v}(${o})`}return typeof y=="function"?Be._`${v}(${o})`:Be._`${v}.test(${o})`}}}};kN.default=f7});var PN=k((TN)=>{Object.defineProperty(TN,"__esModule",{value:!0});var g7=EN(),h7=[g7.default];TN.default=h7});var $N=k((IN)=>{Object.defineProperty(IN,"__esModule",{value:!0});IN.contentVocabulary=IN.metadataVocabulary=void 0;IN.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];IN.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var CN=k((AN)=>{Object.defineProperty(AN,"__esModule",{value:!0});var _7=tM(),v7=IM(),S7=wN(),x7=PN(),ON=$N(),w7=[_7.default,v7.default,(0,S7.default)(),x7.default,ON.metadataVocabulary,ON.contentVocabulary];AN.default=w7});var jN=k((NN)=>{Object.defineProperty(NN,"__esModule",{value:!0});NN.DiscrError=void 0;var MN;(function(e){e.Tag="tag",e.Mapping="mapping"})(MN||(NN.DiscrError=MN={}))});var LN=k((UN)=>{Object.defineProperty(UN,"__esModule",{value:!0});var xs=te(),ix=jN(),zN=Mm(),E7=Nl(),T7=ue(),P7={message:({params:{discrError:e,tagName:t}})=>e===ix.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>xs._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},I7={keyword:"discriminator",type:"object",schemaType:"object",error:P7,code(e){let{gen:t,data:r,schema:o,parentSchema:n,it:i}=e,{oneOf:s}=n;if(!i.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(o.mapping)throw Error("discriminator: mapping is not supported");if(!s)throw Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",xs._`${r}${(0,xs.getProperty)(a)}`);t.if(xs._`typeof ${u} == "string"`,()=>d(),()=>e.error(!1,{discrError:ix.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function d(){let m=f();t.if(!1);for(let g in m)t.elseIf(xs._`${u} === ${g}`),t.assign(c,p(m[g]));t.else(),e.error(!1,{discrError:ix.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function p(m){let g=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:m},g);return e.mergeEvaluated(h,xs.Name),g}function f(){var m;let g={},h=v(n),y=!0;for(let O=0;O<s.length;O++){let L=s[O];if((L===null||L===void 0?void 0:L.$ref)&&!(0,T7.schemaHasRulesButRef)(L,i.self.RULES)){let Ue=L.$ref;if(L=zN.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,Ue),L instanceof zN.SchemaEnv)L=L.schema;if(L===void 0)throw new E7.default(i.opts.uriResolver,i.baseId,Ue)}let se=(m=L===null||L===void 0?void 0:L.properties)===null||m===void 0?void 0:m[a];if(typeof se!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(h||v(L)),x(se,O)}if(!y)throw Error(`discriminator: "${a}" must be required`);return g;function v({required:O}){return Array.isArray(O)&&O.includes(a)}function x(O,L){if(O.const)w(O.const,L);else if(O.enum)for(let se of O.enum)w(se,L);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function w(O,L){if(typeof O!="string"||O in g)throw Error(`discriminator: "${a}" values must be unique strings`);g[O]=L}}}};UN.default=I7});var FN=k((YEe,$7)=>{$7.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 ax=k(($t,sx)=>{Object.defineProperty($t,"__esModule",{value:!0});$t.MissingRefError=$t.ValidationError=$t.CodeGen=$t.Name=$t.nil=$t.stringify=$t.str=$t._=$t.KeywordCxt=$t.Ajv=void 0;var O7=ZC(),A7=CN(),C7=LN(),HN=FN(),M7=["/properties"],Ym="http://json-schema.org/draft-07/schema";class Wl extends O7.default{_addVocabularies(){if(super._addVocabularies(),A7.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(C7.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(HN,M7):HN;this.addMetaSchema(e,Ym,!1),this.refs["http://json-schema.org/schema"]=Ym}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Ym)?Ym:void 0)}}$t.Ajv=Wl;sx.exports=$t=Wl;sx.exports.Ajv=Wl;Object.defineProperty($t,"__esModule",{value:!0});$t.default=Wl;var N7=Ml();Object.defineProperty($t,"KeywordCxt",{enumerable:!0,get:function(){return N7.KeywordCxt}});var ws=te();Object.defineProperty($t,"_",{enumerable:!0,get:function(){return ws._}});Object.defineProperty($t,"str",{enumerable:!0,get:function(){return ws.str}});Object.defineProperty($t,"stringify",{enumerable:!0,get:function(){return ws.stringify}});Object.defineProperty($t,"nil",{enumerable:!0,get:function(){return ws.nil}});Object.defineProperty($t,"Name",{enumerable:!0,get:function(){return ws.Name}});Object.defineProperty($t,"CodeGen",{enumerable:!0,get:function(){return ws.CodeGen}});var D7=Am();Object.defineProperty($t,"ValidationError",{enumerable:!0,get:function(){return D7.default}});var j7=Nl();Object.defineProperty($t,"MissingRefError",{enumerable:!0,get:function(){return j7.default}})});var YN=k((JN)=>{Object.defineProperty(JN,"__esModule",{value:!0});JN.formatNames=JN.fastFormats=JN.fullFormats=void 0;function $r(e,t){return{validate:e,compare:t}}JN.fullFormats={date:$r(VN,dx),time:$r(lx(!0),px),"date-time":$r(BN(!0),KN),"iso-time":$r(lx(),WN),"iso-date-time":$r(BN(),GN),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Z7,"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:Y7,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:V7,int32:{type:"number",validate:G7},int64:{type:"number",validate:J7},float:{type:"number",validate:ZN},double:{type:"number",validate:ZN},password:!0,binary:!0};JN.fastFormats={...JN.fullFormats,date:$r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,dx),time:$r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,px),"date-time":$r(/^\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,KN),"iso-time":$r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,WN),"iso-date-time":$r(/^\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,GN),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};JN.formatNames=Object.keys(JN.fullFormats);function L7(e){return e%4===0&&(e%100!==0||e%400===0)}var F7=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,H7=[0,31,28,31,30,31,30,31,31,30,31,30,31];function VN(e){let t=F7.exec(e);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&L7(r)?29:H7[o])}function dx(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var cx=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function lx(e){return function(r){let o=cx.exec(r);if(!o)return!1;let n=+o[1],i=+o[2],s=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),d=+(o[7]||0);if(u>23||d>59||e&&!a)return!1;if(n<=23&&i<=59&&s<60)return!0;let p=i-d*c,f=n-u*c-(p<0?1:0);return(f===23||f===-1)&&(p===59||p===-1)&&s<61}}function px(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(!(r&&o))return;return r-o}function WN(e,t){if(!(e&&t))return;let r=cx.exec(e),o=cx.exec(t);if(!(r&&o))return;if(e=r[1]+r[2]+r[3],t=o[1]+o[2]+o[3],e>t)return 1;if(e<t)return-1;return 0}var ux=/t|\s/i;function BN(e){let t=lx(e);return function(o){let n=o.split(ux);return n.length===2&&VN(n[0])&&t(n[1])}}function KN(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(!(r&&o))return;return r-o}function GN(e,t){if(!(e&&t))return;let[r,o]=e.split(ux),[n,i]=t.split(ux),s=dx(r,n);if(s===void 0)return;return s||px(o,i)}var B7=/\/|:/,q7=/^(?:[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 Z7(e){return B7.test(e)&&q7.test(e)}var qN=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function V7(e){return qN.lastIndex=0,qN.test(e)}var W7=-2147483648,K7=2147483647;function G7(e){return Number.isInteger(e)&&e<=K7&&e>=W7}function J7(e){return Number.isInteger(e)}function ZN(){return!0}var X7=/[^\\]\\Z/;function Y7(e){if(X7.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var eD=k((QN)=>{Object.defineProperty(QN,"__esModule",{value:!0});QN.formatLimitDefinition=void 0;var eQ=ax(),_r=te(),Zn=_r.operators,Qm={formatMaximum:{okStr:"<=",ok:Zn.LTE,fail:Zn.GT},formatMinimum:{okStr:">=",ok:Zn.GTE,fail:Zn.LT},formatExclusiveMaximum:{okStr:"<",ok:Zn.LT,fail:Zn.GTE},formatExclusiveMinimum:{okStr:">",ok:Zn.GT,fail:Zn.LTE}},tQ={message:({keyword:e,schemaCode:t})=>_r.str`should be ${Qm[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>_r._`{comparison: ${Qm[e].okStr}, limit: ${t}}`};QN.formatLimitDefinition={keyword:Object.keys(Qm),type:"string",schemaType:"string",$data:!0,error:tQ,code(e){let{gen:t,data:r,schemaCode:o,keyword:n,it:i}=e,{opts:s,self:a}=i;if(!s.validateFormats)return;let c=new eQ.KeywordCxt(i,a.RULES.all.format.definition,"format");if(c.$data)u();else d();function u(){let f=t.scopeValue("formats",{ref:a.formats,code:s.code.formats}),m=t.const("fmt",_r._`${f}[${c.schemaCode}]`);e.fail$data((0,_r.or)(_r._`typeof ${m} != "object"`,_r._`${m} instanceof RegExp`,_r._`typeof ${m}.compare != "function"`,p(m)))}function d(){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(`"${n}": format "${f}" does not define "compare" function`);let g=t.scopeValue("formats",{key:f,ref:m,code:s.code.formats?_r._`${s.code.formats}${(0,_r.getProperty)(f)}`:void 0});e.fail$data(p(g))}function p(f){return _r._`${f}.compare(${r}, ${o}) ${Qm[n].fail} 0`}},dependencies:["format"]};var rQ=(e)=>{return e.addKeyword(QN.formatLimitDefinition),e};QN.default=rQ});var oD=k((Kl,nD)=>{Object.defineProperty(Kl,"__esModule",{value:!0});var ks=YN(),oQ=eD(),gx=te(),tD=new gx.Name("fullFormats"),iQ=new gx.Name("fastFormats"),hx=(e,t={keywords:!0})=>{if(Array.isArray(t))return rD(e,t,ks.fullFormats,tD),e;let[r,o]=t.mode==="fast"?[ks.fastFormats,iQ]:[ks.fullFormats,tD],n=t.formats||ks.formatNames;if(rD(e,n,r,o),t.keywords)(0,oQ.default)(e);return e};hx.get=(e,t="full")=>{let o=(t==="fast"?ks.fastFormats:ks.fullFormats)[e];if(!o)throw Error(`Unknown format "${e}"`);return o};function rD(e,t,r,o){var n,i;(n=(i=e.opts.code).formats)!==null&&n!==void 0||(i.formats=gx._`require("ajv-formats/dist/formats").${o}`);for(let s of t)e.addFormat(s,r[s])}nD.exports=Kl=hx;Object.defineProperty(Kl,"__esModule",{value:!0});Kl.default=hx});import{execFile as pre}from"child_process";import{randomUUID as Xx}from"crypto";import{createReadStream as fre,realpathSync as mre}from"fs";import{copyFile as gre,mkdir as Vx,readdir as hre,readFile as Lz,rm as yre,writeFile as Fz}from"fs/promises";import{createRequire as bre}from"module";import{homedir as Wx,tmpdir as _re}from"os";import{dirname as Nz,isAbsolute as Hz,join as Lt,relative as Bz,resolve as lu,sep as Yx}from"path";import{createInterface as vre}from"readline";import{fileURLToPath as Sre}from"url";import{setMaxListeners as xU}from"events";var wU=50;function Fs(e=wU){let t=new AbortController;return xU(e,t.signal),t}import{realpathSync as kU}from"fs";import{dirname as uw,resolve as kg,sep as dw}from"path";function Ar(e){return process.platform==="darwin"?e.normalize("NFC"):e}function fw(e){return/^[\\/]{2}/.test(e)}function mw(e){return/^[\\/]{2}wsl(\$|\.localhost)[\\/]/i.test(e)}function EU(e){if(e.startsWith("\\\\?\\UNC\\"))return"\\\\"+e.slice(8);if(e.startsWith("\\\\?\\")&&e.length>=7&&e[5]===":")return e.slice(4);return e}function pw(e){try{return EU(kU.native(e))}catch{return null}}function gw(e,t){let r=kg(t).toLowerCase(),o=kg(e).toLowerCase();if(uw(o)===r||o.startsWith(r+dw))return!0;let n=pw(t)?.toLowerCase();if(n==null)return!1;let i=pw(uw(kg(e)))?.toLowerCase();if(i==null)return!0;return i===n||i.startsWith(n+dw)}function fu(e,t,r){return new Promise((o,n)=>{if(t?.aborted){if(r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else o();return}let i=setTimeout((a,c,u)=>{a?.removeEventListener("abort",c),u()},e,t,s,o);function s(){if(clearTimeout(i),r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else o()}if(t?.addEventListener("abort",s,{once:!0}),r?.unref)i.unref()})}function TU(e,t){e(Error(t))}function Cr(e,t,r){let o,n=new Promise((i,s)=>{o=setTimeout(TU,t,s,r)});return Promise.race([e,n]).finally(()=>{if(o!==void 0)clearTimeout(o)})}import{spawn as G2}from"child_process";import{existsSync as J2}from"fs";import{createInterface as X2}from"readline";var Xo=["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","MessageDisplay"],PU=["clear","resume","logout","prompt_input_exit","other","bypass_permissions_disabled"],IU="__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__";var RU=/^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/,$U=/<command-name>(.*?)<\/command-name>/;function Hs(e,t){if(e.type!=="user")return;if(e.isMeta===!0||e.isCompactSummary===!0)return;let r=e.message;if(!r)return;let o=r.content,n=[];if(typeof o==="string")n.push(o);else if(Array.isArray(o))for(let i of o){if(!i||typeof i!=="object")continue;if(i.type==="tool_result")return;if(i.type==="text"&&typeof i.text==="string")n.push(i.text)}for(let i of n){let s=i.replaceAll(`
16
+ `," ").trim();if(!s)continue;let a=$U.exec(s);if(a){if(!t.commandFallback)t.commandFallback=a[1];continue}let c=/<bash-input>([\s\S]*?)<\/bash-input>/.exec(s);if(c)return`! ${c[1].trim()}`;if(RU.test(s))continue;if(s.length>200)s=s.slice(0,200).trim()+"…";return s}return}var OU={customTitle:"customTitle",aiTitle:"aiTitle",lastPrompt:"lastPrompt",summary:"summaryHint",gitBranch:"gitBranch"};function mu(e,t,r,o){let n=o?.mtime??e?.mtime??0,i=e!==void 0?{sessionId:e.sessionId,mtime:n,data:{...e.data}}:{sessionId:t.sessionId,mtime:n,data:{}},s=i.data;for(let a of r){let c=CU(a.timestamp);if(s.isSidechain===void 0)s.isSidechain=a.isSidechain===!0;if(s.createdAt===void 0&&c!==void 0)s.createdAt=c;if(s.cwd===void 0){let u=a.cwd;if(typeof u==="string"&&u)s.cwd=u}MU(s,a);for(let[u,d]of Object.entries(OU)){let p=a[u];if(typeof p==="string")s[d]=p}if(a.type==="tag"){let u=a.tag;if(typeof u==="string"&&u)s.tag=u;else delete s.tag}}return i}function hw(e,t){let r=e.data;if(r.isSidechain===!0)return null;let o=un(r.firstPromptLocked===!0?r.firstPrompt:r.commandFallback)||void 0,n=un(r.customTitle)||un(r.aiTitle)||void 0,i=n||un(r.lastPrompt)||un(r.summaryHint)||o;if(!i)return null;return{sessionId:e.sessionId,summary:i,lastModified:e.mtime,fileSize:void 0,customTitle:n,firstPrompt:o,gitBranch:un(r.gitBranch)||void 0,cwd:un(r.cwd)||t||void 0,tag:un(r.tag)||void 0,createdAt:AU(r.createdAt)}}function un(e){return typeof e==="string"?e:void 0}function AU(e){return typeof e==="number"?e:void 0}function CU(e){if(typeof e!=="string")return;let t=Date.parse(e);return Number.isNaN(t)?void 0:t}function MU(e,t){if(e.firstPromptLocked)return;let r={commandFallback:e.commandFallback??""},o=Hs(t,r);if(r.commandFallback&&!e.commandFallback)e.commandFallback=r.commandFallback;if(o!==void 0)e.firstPrompt=o,e.firstPromptLocked=!0}class Eg{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 r=this.keyToString(e),o=this.store.get(r)??[];o.push(...t),this.store.set(r,o);let n=Math.max(Date.now(),this.lastMtime+1);if(this.lastMtime=n,this.mtimes.set(r,n),e.subpath===void 0){let i=`${e.projectKey}/${e.sessionId}`,s=mu(this.summaries.get(i),e,t,{mtime:n});this.summaries.set(i,s)}}async load(e){let t=this.keyToString(e);return this.store.get(t)??null}async listSessions(e){let t=[],r=e+"/";for(let[o]of this.store)if(o.startsWith(r)){let n=o.slice(r.length);if(!n.includes("/"))t.push({sessionId:n,mtime:this.mtimes.get(o)??0})}return t}async listSessionSummaries(e){let t=[],r=e+"/";for(let[o,n]of this.summaries)if(o.startsWith(r))t.push(n);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 r=`${e.projectKey}/${e.sessionId}/`;for(let o of this.store.keys())if(o.startsWith(r))this.store.delete(o),this.mtimes.delete(o)}}async listSubkeys(e){let t=`${e.projectKey}/${e.sessionId}/`,r=[];for(let o of this.store.keys())if(o.startsWith(t))r.push(o.slice(t.length));return r}getEntries(e){return this.store.get(this.keyToString(e))??[]}get size(){let e=0;for(let t of this.store.keys()){let r=t.indexOf("/");if(r!==-1&&!t.slice(r+1).includes("/"))e++}return e}clear(){this.store.clear(),this.mtimes.clear(),this.summaries.clear()}}class it extends Error{}function gu(){return process.versions.bun!==void 0}function Ee(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 dn(){let e=new Set;return{subscribe(t){return e.add(t),()=>{e.delete(t)}},emit(...t){let r;for(let o of e)try{o(...t)}catch(n){(r??=[]).push(n)}if(r)throw r.length===1?r[0]:AggregateError(r,"Signal listener(s) threw")},clear(){e.clear()}}}var DU=typeof global=="object"&&global&&global.Object===Object&&global,hu=DU;var jU=typeof self=="object"&&self&&self.Object===Object&&self,zU=hu||jU||Function("return this")(),Ht=zU;var UU=Ht.Symbol,Bt=UU;var yw=Object.prototype,LU=yw.hasOwnProperty,FU=yw.toString,Bs=Bt?Bt.toStringTag:void 0;function HU(e){var t=LU.call(e,Bs),r=e[Bs];try{e[Bs]=void 0;var o=!0}catch(i){}var n=FU.call(e);if(o)if(t)e[Bs]=r;else delete e[Bs];return n}var bw=HU;var BU=Object.prototype,qU=BU.toString;function ZU(e){return qU.call(e)}var _w=ZU;var VU="[object Null]",WU="[object Undefined]",vw=Bt?Bt.toStringTag:void 0;function KU(e){if(e==null)return e===void 0?WU:VU;return vw&&vw in Object(e)?bw(e):_w(e)}var kr=KU;function GU(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var et=GU;var JU="[object AsyncFunction]",XU="[object Function]",YU="[object GeneratorFunction]",QU="[object Proxy]";function eL(e){if(!et(e))return!1;var t=kr(e);return t==XU||t==YU||t==JU||t==QU}var Yo=eL;var tL=Ht["__core-js_shared__"],yu=tL;var Sw=function(){var e=/[^.]+$/.exec(yu&&yu.keys&&yu.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function rL(e){return!!Sw&&Sw in e}var xw=rL;var nL=Function.prototype,oL=nL.toString;function iL(e){if(e!=null){try{return oL.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var ww=iL;var sL=/[\\^$.*+?()[\]{}|]/g,aL=/^\[object .+?Constructor\]$/,cL=Function.prototype,lL=Object.prototype,uL=cL.toString,dL=lL.hasOwnProperty,pL=RegExp("^"+uL.call(dL).replace(sL,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function fL(e){if(!et(e)||xw(e))return!1;var t=Yo(e)?pL:aL;return t.test(ww(e))}var kw=fL;function mL(e,t){return e==null?void 0:e[t]}var Ew=mL;function gL(e,t){var r=Ew(e,t);return kw(r)?r:void 0}var Qo=gL;var hL=Qo(Object,"create"),Mr=hL;function yL(){this.__data__=Mr?Mr(null):{},this.size=0}var Tw=yL;function bL(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Pw=bL;var _L="__lodash_hash_undefined__",vL=Object.prototype,SL=vL.hasOwnProperty;function xL(e){var t=this.__data__;if(Mr){var r=t[e];return r===_L?void 0:r}return SL.call(t,e)?t[e]:void 0}var Iw=xL;var wL=Object.prototype,kL=wL.hasOwnProperty;function EL(e){var t=this.__data__;return Mr?t[e]!==void 0:kL.call(t,e)}var Rw=EL;var TL="__lodash_hash_undefined__";function PL(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Mr&&t===void 0?TL:t,this}var $w=PL;function ei(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var o=e[t];this.set(o[0],o[1])}}ei.prototype.clear=Tw;ei.prototype.delete=Pw;ei.prototype.get=Iw;ei.prototype.has=Rw;ei.prototype.set=$w;var Tg=ei;function IL(){this.__data__=[],this.size=0}var Ow=IL;function RL(e,t){return e===t||e!==e&&t!==t}var pn=RL;function $L(e,t){var r=e.length;while(r--)if(pn(e[r][0],t))return r;return-1}var fn=$L;var OL=Array.prototype,AL=OL.splice;function CL(e){var t=this.__data__,r=fn(t,e);if(r<0)return!1;var o=t.length-1;if(r==o)t.pop();else AL.call(t,r,1);return--this.size,!0}var Aw=CL;function ML(e){var t=this.__data__,r=fn(t,e);return r<0?void 0:t[r][1]}var Cw=ML;function NL(e){return fn(this.__data__,e)>-1}var Mw=NL;function DL(e,t){var r=this.__data__,o=fn(r,e);if(o<0)++this.size,r.push([e,t]);else r[o][1]=t;return this}var Nw=DL;function ti(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var o=e[t];this.set(o[0],o[1])}}ti.prototype.clear=Ow;ti.prototype.delete=Aw;ti.prototype.get=Cw;ti.prototype.has=Mw;ti.prototype.set=Nw;var mn=ti;var jL=Qo(Ht,"Map"),bu=jL;function zL(){this.size=0,this.__data__={hash:new Tg,map:new(bu||mn),string:new Tg}}var Dw=zL;function UL(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var jw=UL;function LL(e,t){var r=e.__data__;return jw(t)?r[typeof t=="string"?"string":"hash"]:r.map}var gn=LL;function FL(e){var t=gn(this,e).delete(e);return this.size-=t?1:0,t}var zw=FL;function HL(e){return gn(this,e).get(e)}var Uw=HL;function BL(e){return gn(this,e).has(e)}var Lw=BL;function qL(e,t){var r=gn(this,e),o=r.size;return r.set(e,t),this.size+=r.size==o?0:1,this}var Fw=qL;function ri(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var o=e[t];this.set(o[0],o[1])}}ri.prototype.clear=Dw;ri.prototype.delete=zw;ri.prototype.get=Uw;ri.prototype.has=Lw;ri.prototype.set=Fw;var qs=ri;var ZL="Expected a function";function Pg(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw TypeError(ZL);var r=function(){var o=arguments,n=t?t.apply(this,o):o[0],i=r.cache;if(i.has(n))return i.get(n);var s=e.apply(this,o);return r.cache=i.set(n,s)||i,s};return r.cache=new(Pg.Cache||qs),r}Pg.Cache=qs;var Ce=Pg;import{homedir as VL}from"os";import{join as WL}from"path";var qt=Ce(()=>{return(process.env.CLAUDE_CONFIG_DIR??WL(VL(),".claude")).normalize("NFC")},()=>process.env.CLAUDE_CONFIG_DIR);var oie=Ce(()=>Ee(process.env.CLAUDE_CODE_SUPERVISED));function D(e,t,r,o,n){if(o==="m")throw TypeError("Private method is not writable");if(o==="a"&&!n)throw TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!n:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?n.call(e,r):n?n.value=r:t.set(e,r),r}function _(e,t,r,o){if(r==="a"&&!o)throw TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!o:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?o:r==="a"?o.call(e):o?o.value:t.get(e)}var Ig=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return Ig=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),r=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(o)=>(+o^r()&15>>+o/4).toString(16))};function Nr(e){return typeof e==="object"&&e!==null&&(("name"in e)&&e.name==="AbortError"||("message"in e)&&String(e.message).includes("FetchRequestCanceledException"))}var Zs=(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)};class z extends Error{}class We extends z{constructor(e,t,r,o,n){super(`${We.makeMessage(e,t,r)}`);this.status=e,this.headers=o,this.requestID=o?.get("request-id"),this.error=t,this.type=n??null}static makeMessage(e,t,r){let o=t?.message?typeof t.message==="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):r;if(e&&o)return`${e} ${o}`;if(e)return`${e} status code (no body)`;if(o)return o;return"(no status code or body)"}static generate(e,t,r,o){if(!e||!o)return new no({message:r,cause:Zs(t)});let n=t,i=n?.error?.type;if(e===400)return new Ws(e,n,r,o,i);if(e===401)return new Ks(e,n,r,o,i);if(e===403)return new Gs(e,n,r,o,i);if(e===404)return new Js(e,n,r,o,i);if(e===409)return new Xs(e,n,r,o,i);if(e===422)return new Ys(e,n,r,o,i);if(e===429)return new Qs(e,n,r,o,i);if(e>=500)return new ea(e,n,r,o,i);return new We(e,n,r,o,i)}}class tt extends We{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}}class no extends We{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0);if(t)this.cause=t}}class Vs extends no{constructor({message:e}={}){super({message:e??"Request timed out."})}}class Ws extends We{}class Ks extends We{}class Gs extends We{}class Js extends We{}class Xs extends We{}class Ys extends We{}class Qs extends We{}class ea extends We{}var GL=/^[a-z][a-z0-9+.-]*:/i,Hw=(e)=>{return GL.test(e)},Rg=(e)=>(Rg=Array.isArray,Rg(e)),$g=Rg;function _u(e){if(typeof e!=="object")return{};return e??{}}function Og(e){if(!e)return!0;for(let t in e)return!1;return!0}function Bw(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var qw=(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};var vu=(e)=>{try{return JSON.parse(e)}catch(t){return}};var Zw=(e)=>new Promise((t)=>setTimeout(t,e));var Zt="0.94.0";var Gw=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"};function JL(){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"}var XL=()=>{let e=JL();if(e==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Zt,"X-Stainless-OS":Ww(Deno.build.os),"X-Stainless-Arch":Vw(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":Zt,"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":Zt,"X-Stainless-OS":Ww(globalThis.process.platform??"unknown"),"X-Stainless-Arch":Vw(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let t=YL();if(t)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Zt,"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":Zt,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function YL(){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:r}of e){let o=r.exec(navigator.userAgent);if(o){let n=o[1]||0,i=o[2]||0,s=o[3]||0;return{browser:t,version:`${n}.${i}.${s}`}}}return null}var Vw=(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"},Ww=(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"},Kw,ta=()=>{return Kw??(Kw=XL())};function Jw(){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 Ag(...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 Su(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return Ag({start(){},async pull(r){let{done:o,value:n}=await t.next();if(o)r.close();else r.enqueue(n)},async cancel(){await t.return?.()}})}function ra(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let r=await t.read();if(r?.done)t.releaseLock();return r}catch(r){throw t.releaseLock(),r}},async return(){let r=t.cancel();return t.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Xw(e){if(e===null||typeof e!=="object")return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),r=t.cancel();t.releaseLock(),await r}var Yw=({headers:e,body:t})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)}};function Qw(e){return Object.entries(e).filter(([t,r])=>typeof r<"u").map(([t,r])=>{if(typeof r==="string"||typeof r==="number"||typeof r==="boolean")return`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(r===null)return`${encodeURIComponent(t)}=`;throw new z(`Cannot stringify type ${typeof r}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}var tk="urn:ietf:params:oauth:grant-type:jwt-bearer",rk="refresh_token",xu="/v1/oauth/token",oo="oauth-2025-04-20",nk="oidc-federation-2026-04-01",ok=120,ni=30,ik=5,ek=1048576;function wu(e){if(!e)return;let t;try{t=new URL(e)}catch(o){throw new he(`Invalid token endpoint base URL "${e}": ${o}`)}if(t.protocol==="https:")return;let r=t.hostname.toLowerCase().replace(/^\[|\]$/g,"");if(t.protocol==="http:"&&(r==="localhost"||r==="127.0.0.1"||r==="::1"))return;throw new he(`Refusing to send credential over non-https token endpoint "${e}"`)}async function ku(e,t){let r=await r1(e),o;try{o=JSON.parse(r)}catch{throw new he(`Token endpoint returned non-JSON response (status ${e.status})`,e.status,_t(r),t)}if(!o.access_token)throw new he(`Token endpoint response missing access_token: ${JSON.stringify(_t(o))}`,e.status,_t(o),t);if(o.token_type&&o.token_type.toLowerCase()!=="bearer")throw new he(`Token endpoint response: unsupported token_type "${o.token_type}" (want Bearer)`,e.status,_t(o),t);return o}var Cg=2000,t1=new Set(["error","error_description","error_uri"]);function _t(e){if(e==null)return e;if(typeof e==="string"){let t;try{t=JSON.parse(e)}catch{if(e.length<=Cg)return e;return e.slice(0,Cg)+`... <${e.length-Cg} more chars>`}return JSON.stringify(_t(t))}if(typeof e==="object"&&!Array.isArray(e)){let t={};for(let[r,o]of Object.entries(e))if(t1.has(r))t[r]=o;return t}return null}async function Eu(e,t=(r)=>console.warn(`anthropic-sdk: ${r}`)){if(typeof process>"u"||process.platform==="win32")return;let r=await import("node:fs"),o=e,n;try{o=await r.promises.realpath(e),n=await r.promises.stat(o)}catch{return}let i=n.mode&511;if(i&18)throw new he(`Credentials file at ${o} is group/world-writable (mode 0o${i.toString(8)}); this allows other local users to plant tokens. Run \`chmod 600 ${o}\`.`);if(i&36)throw new he(`Credentials file at ${o} is group/world-readable (mode 0o${i.toString(8)}); run \`chmod 600 ${o}\` before retrying.`);if(typeof process.getuid==="function"&&n.uid!==process.getuid())t(`credentials file at ${o} is owned by uid ${n.uid} (current process uid ${process.getuid()}); verify this is intentional.`)}async function Tu(e,t){let r=await import("node:fs"),n=(await import("node:path")).dirname(e);await r.promises.mkdir(n,{recursive:!0,mode:448});let i=`${e}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{let s=await r.promises.open(i,"w",384);try{await s.writeFile(JSON.stringify(t,null,2)),await s.sync()}finally{await s.close()}await r.promises.rename(i,e)}catch(s){throw await r.promises.unlink(i).catch(()=>{}),s}try{let s=await r.promises.open(n,"r");try{await s.sync()}finally{await s.close()}}catch{}}async function r1(e){if(!e.body)return"";let t=e.body.getReader(),r=[],o=0;for(;;){let{done:i,value:s}=await t.read();if(i)break;if(o+s.length>ek){let a=ek-o;if(a>0)r.push(s.subarray(0,a));await t.cancel();break}r.push(s),o+=s.length}let n;if(r.length===1)n=r[0];else{n=new Uint8Array(r.reduce((s,a)=>s+a.length,0));let i=0;for(let s of r)n.set(s,i),i+=s.length}return new TextDecoder("utf-8").decode(n)}class he extends z{constructor(e,t=null,r=null,o=null){super(e);this.statusCode=t,this.body=r,this.requestId=o}}function ir(){return Math.floor(Date.now()/1000)}class Mg{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 r=t.expiresAt-ir();if(r>ok)return t.token;if(r>ni)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(ir()-this.lastAdvisoryError<ik)return;this.doRefresh().catch((e)=>{this.lastAdvisoryError=ir(),this.onAdvisoryRefreshError?.(e)})}doRefresh(e=!1){return this.pendingRefresh=this.provider(e?{forceRefresh:!0}:void 0).then((t)=>{return this.cached=t,this.pendingRefresh=null,t},(t)=>{throw this.pendingRefresh=null,t}),this.pendingRefresh}}var ge=(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 ck(e){let t=0;for(let n of e)t+=n.length;let r=new Uint8Array(t),o=0;for(let n of e)r.set(n,o),o+=n.length;return r}var sk;function oi(e){let t;return(sk??(t=new globalThis.TextEncoder,sk=t.encode.bind(t)))(e)}var ak;function Ng(e){let t;return(ak??(t=new globalThis.TextDecoder,ak=t.decode.bind(t)))(e)}var Iu={off:0,error:200,warn:300,info:400,debug:500},Dg=(e,t,r)=>{if(!e)return;if(Bw(Iu,e))return e;Le(r).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Iu))}`);return};function na(){}function Pu(e,t,r){if(!t||Iu[e]>Iu[r])return na;else return t[e].bind(t)}var n1={error:na,warn:na,info:na,debug:na},lk=new WeakMap;function Le(e){let t=e.logger,r=e.logLevel??"off";if(!t)return n1;let o=lk.get(t);if(o&&o[0]===r)return o[1];let n={error:Pu("error",t,r),warn:Pu("warn",t,r),info:Pu("info",t,r),debug:Pu("debug",t,r)};return lk.set(t,[r,n]),n}var Dr=(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,r])=>[t,t.toLowerCase()==="x-api-key"||t.toLowerCase()==="authorization"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":r]));if("retryOfRequestLogID"in e){if(e.retryOfRequestLogID)e.retryOf=e.retryOfRequestLogID;delete e.retryOfRequestLogID}return e};var Ru="1.0",o1=/^[A-Za-z0-9_.-]+$/;function uk(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(!o1.test(e))throw Error(`profile name "${e}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`)}var dk=async(e)=>{var t,r;let o=await jg();if(o===null)return null;let n=e??await fk();if(n===null)return null;uk(n);let i=await import("node:fs"),a=(await import("node:path")).join(o,"configs",`${n}.json`),c;try{c=await i.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=ge("ANTHROPIC_ORGANIZATION_ID"),f=ge("ANTHROPIC_IDENTITY_TOKEN_FILE"),m=ge("ANTHROPIC_FEDERATION_RULE_ID");if(m&&p)return{fromFile:!1,config:{organization_id:p,workspace_id:ge("ANTHROPIC_WORKSPACE_ID"),base_url:ge("ANTHROPIC_BASE_URL"),authentication:{type:"oidc_federation",federation_rule_id:m,service_account_id:ge("ANTHROPIC_SERVICE_ACCOUNT_ID"),identity_token:f?{source:"file",path:f}:void 0,scope:ge("ANTHROPIC_SCOPE")}}};return null}let u;try{u=JSON.parse(c)}catch(p){throw Error(`failed to parse config file ${a}: ${p}`)}if(!u.authentication)throw Error(`config file ${a} is missing "authentication"`);let d=u.authentication.type;if(d!=="oidc_federation"&&d!=="user_oauth")throw Error(`authentication.type "${d}" is not a known authentication type`);if(u.organization_id??(u.organization_id=ge("ANTHROPIC_ORGANIZATION_ID")),u.workspace_id??(u.workspace_id=ge("ANTHROPIC_WORKSPACE_ID")),u.base_url??(u.base_url=ge("ANTHROPIC_BASE_URL")),(t=u.authentication).scope??(t.scope=ge("ANTHROPIC_SCOPE")),u.authentication.type==="oidc_federation"){if(!u.authentication.identity_token){let p=ge("ANTHROPIC_IDENTITY_TOKEN_FILE");if(p)u.authentication.identity_token={source:"file",path:p}}if(!u.authentication.federation_rule_id)u.authentication.federation_rule_id=ge("ANTHROPIC_FEDERATION_RULE_ID")??"";(r=u.authentication).service_account_id??(r.service_account_id=ge("ANTHROPIC_SERVICE_ACCOUNT_ID"))}return{config:u,fromFile:!0}};var pk=async(e,t)=>{if(e?.authentication.credentials_path)return e.authentication.credentials_path;let r=await jg();if(!r)return null;let o=t??await fk();if(!o)return null;return uk(o),(await import("node:path")).join(r,"credentials",`${o}.json`)},jg=async()=>{if(!i1())return null;let e=await import("node:path"),t=ge("ANTHROPIC_CONFIG_DIR");if(t)return t;if(ta()["X-Stainless-OS"]==="Windows"){let i=ge("APPDATA");if(i)return e.join(i,"Anthropic");let s=ge("USERPROFILE");if(s)return e.join(s,"AppData","Roaming","Anthropic");return null}let o=ge("XDG_CONFIG_HOME");if(o)return e.join(o,"anthropic");let n=ge("HOME");if(n)return e.join(n,".config","anthropic");return null},i1=()=>{let e=ta()["X-Stainless-Runtime"];return e==="node"||e==="deno"},fk=async()=>{let e=await jg();if(!e)return null;let t=ge("ANTHROPIC_PROFILE");if(t)return t;let r=await import("node:fs"),n=(await import("node:path")).join(e,"active_config");try{return(await r.promises.readFile(n,"utf-8")).trim()||"default"}catch(i){if(i?.code!=="ENOENT")throw Error(`failed to read ${n}: ${i}`);return"default"}};function zg(e){if(!e)throw new z("Identity token file path is empty");return async()=>{let t=await import("node:fs"),r;try{r=await t.promises.readFile(e,"utf-8")}catch(n){throw new z(`Failed to read identity token file at ${e}: ${n}`)}let o=r.trim();if(!o)throw new z(`Identity token file at ${e} is empty`);return o}}function mk(e){if(!e)throw new z("Identity token value is empty");return()=>e}function gk(e){return async()=>{wu(e.baseURL);let t=await e.identityTokenProvider();if(t.length>16384)throw new he(`Identity token is ${Math.ceil(t.length/1024)} KiB, exceeds the 16 KiB assertion limit`);let r={grant_type:tk,assertion:t,federation_rule_id:e.federationRuleId,organization_id:e.organizationId};if(e.serviceAccountId)r.service_account_id=e.serviceAccountId;if(e.workspaceId)r.workspace_id=e.workspaceId;let o=`${e.baseURL}${xu}`,n;try{n=await e.fetch(o,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":`${oo},${nk}`,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${Zt} oidcFederationProvider`},body:JSON.stringify(r)})}catch(c){throw new he(`Failed to reach token endpoint ${o}: ${c}`)}let i=n.headers.get("Request-Id");if(!n.ok){let c=await n.text().catch(()=>""),u=_t(c),d="";if(n.status===401)d=` 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 he(`Token exchange failed with status ${n.status}${i?` (request-id ${i})`:""}: ${u}${d}`,n.status,u,i)}let s=await ku(n,i),a=Number(s.expires_in);if(!Number.isFinite(a))throw new he(`Token endpoint response missing required fields: ${JSON.stringify(_t(s))}`,n.status,_t(s),i);return{token:s.access_token,expiresAt:ir()+a}}}function hk(e){return async(t)=>{let r=await import("node:fs");await Eu(e.credentialsPath,e.onSafetyWarning);let o;try{o=await r.promises.readFile(e.credentialsPath,"utf-8")}catch(y){throw new he(`Credentials file not found at ${e.credentialsPath}: ${y}`)}let n;try{n=JSON.parse(o)}catch(y){throw new he(`Credentials file at ${e.credentialsPath} is not valid JSON: ${y}`)}let i=n.access_token;if(!i)throw new he(`Credentials file at ${e.credentialsPath} must include 'access_token'`);let s=n.expires_at;if(!t?.forceRefresh&&(s==null||ir()<s-ni))return{token:i,expiresAt:s??null};let a=n.refresh_token;if(!e.clientId||!a)throw new he(`Access token at ${e.credentialsPath} has expired and no refresh is available (client_id ${e.clientId?"set":"empty"}, refresh_token ${a?"set":"empty"})`);wu(e.baseURL);let c={grant_type:rk,refresh_token:a,client_id:e.clientId},u=`${e.baseURL}${xu}`,d;try{d=await e.fetch(u,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":oo,"User-Agent":e.userAgent||`anthropic-sdk-typescript/${Zt} userOAuthProvider`},body:JSON.stringify(c)})}catch(y){throw new he(`User OAuth refresh failed to reach token endpoint: ${y}`)}let p=d.headers.get("Request-Id");if(!d.ok){let y=await d.text().catch(()=>"");throw new he(`User OAuth refresh failed (HTTP ${d.status}): ${_t(y)}`,d.status,_t(y),p)}let f=await ku(d,p),m=Number(f.expires_in);if(!Number.isFinite(m))throw new he(`User OAuth refresh response missing or invalid expires_in: ${JSON.stringify(_t(f))}`,d.status,_t(f),p);let g=ir()+m,h=f.refresh_token||a;return await Tu(e.credentialsPath,{...n,version:Ru,type:"oauth_token",access_token:f.access_token,expires_at:g,refresh_token:h}),{token:f.access_token,expiresAt:g}}}function Ug(e,t){let r=e.authentication.credentials_path??null,o=(e.base_url||t.baseURL).replace(/\/+$/,""),n=s1(e,r,o,t),i={};if(e.workspace_id&&e.authentication.type==="user_oauth")i["anthropic-workspace-id"]=e.workspace_id;return{provider:n,extraHeaders:i,baseURL:e.base_url||void 0}}async function yk(e,t){let r=await dk(t);if(!r)return null;let{config:o,fromFile:n}=r,i=o.authentication.credentials_path||!n?o:{...o,authentication:{...o.authentication,credentials_path:await pk(o,t)??void 0}};return Ug(i,e)}function s1(e,t,r,o){switch(e.authentication.type){case"oidc_federation":{let n=e.authentication,i=a1(n);if(!i)throw new he("oidc_federation config requires an identity token (set authentication.identity_token, ANTHROPIC_IDENTITY_TOKEN_FILE, or ANTHROPIC_IDENTITY_TOKEN)");if(!n.federation_rule_id)throw new he("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 he("oidc_federation config requires organization_id (set ANTHROPIC_ORGANIZATION_ID or config.organization_id)");let s=gk({identityTokenProvider:i,federationRuleId:n.federation_rule_id,organizationId:e.organization_id,serviceAccountId:n.service_account_id,workspaceId:e.workspace_id,baseURL:r,fetch:o.fetch,userAgent:o.userAgent});if(t)return c1(s,t,o.onCacheWriteError,o.onSafetyWarning);return s}case"user_oauth":{if(!t)throw new he("user_oauth config requires authentication.credentials_path (or load via a profile so it defaults to <config_dir>/credentials/<profile>.json)");return hk({credentialsPath:t,clientId:e.authentication.client_id,baseURL:r,fetch:o.fetch,userAgent:o.userAgent,onSafetyWarning:o.onSafetyWarning})}default:{let n=e.authentication.type;throw new he(`authentication.type "${n}" is not a known authentication type`)}}}function a1(e){if(e.identity_token){let o=e.identity_token.source;if(o!=="file")throw new he(`identity_token.source "${o}" is not supported by this SDK version (only "file")`);if(!e.identity_token.path)throw new he('identity_token.source "file" requires a non-empty path');return zg(e.identity_token.path)}let t=ge("ANTHROPIC_IDENTITY_TOKEN_FILE");if(t)return zg(t);let r=ge("ANTHROPIC_IDENTITY_TOKEN");if(r)return mk(r);return null}function c1(e,t,r,o){return async(n)=>{let i=await import("node:fs");await Eu(t,o);let s;try{let c=await i.promises.readFile(t,"utf-8");s=JSON.parse(c);let u=s?.access_token;if(u&&!n?.forceRefresh){let d=s?.expires_at;if(d==null||ir()<d-ni)return{token:u,expiresAt:d??null}}}catch(c){if(c?.code!=="ENOENT"&&!(c instanceof SyntaxError))r?.(c)}let a=await e(n);try{await Tu(t,{...s??{},version:Ru,type:"oauth_token",access_token:a.token,expires_at:a.expiresAt})}catch(c){r?.(c)}return a}}var Ct,Mt;class hn{constructor(){Ct.set(this,void 0),Mt.set(this,void 0),D(this,Ct,new Uint8Array,"f"),D(this,Mt,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==="string"?oi(e):e;D(this,Ct,ck([_(this,Ct,"f"),t]),"f");let r=[],o;while((o=l1(_(this,Ct,"f"),_(this,Mt,"f")))!=null){if(o.carriage&&_(this,Mt,"f")==null){D(this,Mt,o.index,"f");continue}if(_(this,Mt,"f")!=null&&(o.index!==_(this,Mt,"f")+1||o.carriage)){r.push(Ng(_(this,Ct,"f").subarray(0,_(this,Mt,"f")-1))),D(this,Ct,_(this,Ct,"f").subarray(_(this,Mt,"f")),"f"),D(this,Mt,null,"f");continue}let n=_(this,Mt,"f")!==null?o.preceding-1:o.preceding,i=Ng(_(this,Ct,"f").subarray(0,n));r.push(i),D(this,Ct,_(this,Ct,"f").subarray(o.index),"f"),D(this,Mt,null,"f")}return r}flush(){if(!_(this,Ct,"f").length)return[];return this.decode(`
17
+ `)}}Ct=new WeakMap,Mt=new WeakMap;hn.NEWLINE_CHARS=new Set([`
18
+ `,"\r"]);hn.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function l1(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function bk(e){for(let o=0;o<e.length-1;o++){if(e[o]===10&&e[o+1]===10)return o+2;if(e[o]===13&&e[o+1]===13)return o+2;if(e[o]===13&&e[o+1]===10&&o+3<e.length&&e[o+2]===13&&e[o+3]===10)return o+4}return-1}var oa;class Nt{constructor(e,t,r){this.iterator=e,oa.set(this,void 0),this.controller=t,D(this,oa,r,"f")}static fromSSEResponse(e,t,r){let o=!1,n=r?Le(r):console;async function*i(){if(o)throw new z("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let a of u1(e,t)){if(a.event==="completion")try{yield JSON.parse(a.data)}catch(c){throw n.error("Could not parse message into JSON:",a.data),n.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==="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==="span.model_request_start"||a.event==="span.model_request_end")try{yield JSON.parse(a.data)}catch(c){throw n.error("Could not parse message into JSON:",a.data),n.error("From chunk:",a.raw),c}if(a.event==="ping")continue;if(a.event==="error"){let c=vu(a.data)??a.data,u=c?.error?.type;throw new We(void 0,c,void 0,e.headers,u)}}s=!0}catch(a){if(Nr(a))return;throw a}finally{if(!s)t.abort()}}return new Nt(i,t,r)}static fromReadableStream(e,t,r){let o=!1;async function*n(){let s=new hn,a=ra(e);for await(let c of a)for(let u of s.decode(c))yield u;for(let c of s.flush())yield c}async function*i(){if(o)throw new z("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let a of n()){if(s)continue;if(a)yield JSON.parse(a)}s=!0}catch(a){if(Nr(a))return;throw a}finally{if(!s)t.abort()}}return new Nt(i,t,r)}[(oa=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],t=[],r=this.iterator(),o=(n)=>{return{next:()=>{if(n.length===0){let i=r.next();e.push(i),t.push(i)}return n.shift()}}};return[new Nt(()=>o(e),this.controller,_(this,oa,"f")),new Nt(()=>o(t),this.controller,_(this,oa,"f"))]}toReadableStream(){let e=this,t;return Ag({async start(){t=e[Symbol.asyncIterator]()},async pull(r){try{let{value:o,done:n}=await t.next();if(n)return r.close();let i=oi(JSON.stringify(o)+`
19
+ `);r.enqueue(i)}catch(o){r.error(o)}},async cancel(){await t.return?.()}})}}async function*u1(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 r=new _k,o=new hn,n=ra(e.body);for await(let i of d1(n))for(let s of o.decode(i)){let a=r.decode(s);if(a)yield a}for(let i of o.flush()){let s=r.decode(i);if(s)yield s}}async function*d1(e){let t=new Uint8Array;for await(let r of e){if(r==null)continue;let o=r instanceof ArrayBuffer?new Uint8Array(r):typeof r==="string"?oi(r):r,n=new Uint8Array(t.length+o.length);n.set(t),n.set(o,t.length),t=n;let i;while((i=bk(t))!==-1)yield t.slice(0,i),t=t.slice(i)}if(t.length>0)yield t}class _k{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 n={event:this.event,data:this.data.join(`
20
+ `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],n}if(this.chunks.push(e),e.startsWith(":"))return null;let[t,r,o]=p1(e,":");if(o.startsWith(" "))o=o.substring(1);if(t==="event")this.event=o;else if(t==="data")this.data.push(o);return null}}function p1(e,t){let r=e.indexOf(t);if(r!==-1)return[e.substring(0,r),t,e.substring(r+t.length)];return[e,"",""]}async function $u(e,t){let{response:r,requestLogID:o,retryOfRequestLogID:n,startTime:i}=t,s=await(async()=>{if(t.options.stream){if(Le(e).debug("response",r.status,r.url,r.headers,r.body),t.options.__streamClass)return t.options.__streamClass.fromSSEResponse(r,t.controller);return Nt.fromSSEResponse(r,t.controller)}if(r.status===204)return null;if(t.options.__binaryResponse)return r;let c=r.headers.get("content-type")?.split(";")[0]?.trim();if(c?.includes("application/json")||c?.endsWith("+json")){if(r.headers.get("content-length")==="0")return;let f=await r.json();return Lg(f,r)}return await r.text()})();return Le(e).debug(`[${o}] response parsed`,Dr({retryOfRequestLogID:n,url:r.url,status:r.status,body:s,durationMs:Date.now()-i})),s}function Lg(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 ia;class io extends Promise{constructor(e,t,r=$u){super((o)=>{o(null)});this.responsePromise=t,this.parseResponse=r,ia.set(this,void 0),D(this,ia,e,"f")}_thenUnwrap(e){return new io(_(this,ia,"f"),this.responsePromise,async(t,r)=>Lg(e(await this.parseResponse(t,r),r),r.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(_(this,ia,"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)}}ia=new WeakMap;var Ou;class Fg{constructor(e,t,r,o){Ou.set(this,void 0),D(this,Ou,e,"f"),this.options=o,this.response=t,this.body=r}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 _(this,Ou,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;yield e;while(e.hasNextPage())e=await e.getNextPage(),yield e}async*[(Ou=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let t of e.getPaginatedItems())yield t}}class Au extends io{constructor(e,t,r){super(e,t,async(o,n)=>new r(o,n.response,await $u(o,n),n.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let t of e)yield t}}class sr extends Fg{constructor(e,t,r,o){super(e,t,r,o);this.data=r.data||[],this.has_more=r.has_more||!1,this.first_id=r.first_id||null,this.last_id=r.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:{..._u(this.options.query),before_id:t}}}let e=this.last_id;if(!e)return null;return{...this.options,query:{..._u(this.options.query),after_id:e}}}}class ye extends Fg{constructor(e,t,r,o){super(e,t,r,o);this.data=r.data||[],this.next_page=r.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let e=this.next_page;if(!e)return null;return{...this.options,query:{..._u(this.options.query),page:e}}}}var Bg=()=>{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`.":""))}};function so(e,t,r){return Bg(),new File(e,t??"unknown_file",r)}function sa(e,t){let r=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?r.split(/[\\/]/).pop()||void 0:r}var qg=(e)=>e!=null&&typeof e==="object"&&typeof e[Symbol.asyncIterator]==="function";var ii=async(e,t,r=!0)=>{return{...e,body:await g1(e.body,t,r)}},vk=new WeakMap;function m1(e){let t=typeof e==="function"?e:e.fetch,r=vk.get(t);if(r)return r;let o=(async()=>{try{let n="Response"in t?t.Response:(await t("data:,")).constructor,i=new FormData;if(i.toString()===await new n(i).text())return!1;return!0}catch{return!0}})();return vk.set(t,o),o}var g1=async(e,t,r=!0)=>{if(!await m1(t))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let o=new FormData;return await Promise.all(Object.entries(e||{}).map(([n,i])=>Hg(o,n,i,r))),o},h1=(e)=>e instanceof Blob&&("name"in e);var Hg=async(e,t,r,o)=>{if(r===void 0)return;if(r==null)throw TypeError(`Received null for "${t}"; to pass null in FormData, you must use the string 'null'`);if(typeof r==="string"||typeof r==="number"||typeof r==="boolean")e.append(t,String(r));else if(r instanceof Response){let n={},i=r.headers.get("Content-Type");if(i)n={type:i};e.append(t,so([await r.blob()],sa(r,o),n))}else if(qg(r))e.append(t,so([await new Response(Su(r)).blob()],sa(r,o)));else if(h1(r))e.append(t,so([r],sa(r,o),{type:r.type}));else if(Array.isArray(r))await Promise.all(r.map((n)=>Hg(e,t+"[]",n,o)));else if(typeof r==="object")await Promise.all(Object.entries(r).map(([n,i])=>Hg(e,`${t}[${n}]`,i,o)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)};var Sk=(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",y1=(e)=>e!=null&&typeof e==="object"&&typeof e.name==="string"&&typeof e.lastModified==="number"&&Sk(e),b1=(e)=>e!=null&&typeof e==="object"&&typeof e.url==="string"&&typeof e.blob==="function";async function Cu(e,t,r){if(Bg(),e=await e,t||(t=sa(e,!0)),y1(e)){if(e instanceof File&&t==null&&r==null)return e;return so([await e.arrayBuffer()],t??e.name,{type:e.type,lastModified:e.lastModified,...r})}if(b1(e)){let n=await e.blob();return t||(t=new URL(e.url).pathname.split(/[\\/]/).pop()),so(await Zg(n),t,r)}let o=await Zg(e);if(!r?.type){let n=o.find((i)=>typeof i==="object"&&("type"in i)&&i.type);if(typeof n==="string")r={...r,type:n}}return so(o,t,r)}async function Zg(e){let t=[];if(typeof e==="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(Sk(e))t.push(e instanceof Blob?e:await e.arrayBuffer());else if(qg(e))for await(let r of e)t.push(...await Zg(r));else{let r=e?.constructor?.name;throw Error(`Unexpected data type: ${typeof e}${r?`; constructor: ${r}`:""}${_1(e)}`)}return t}function _1(e){if(typeof e!=="object"||e===null)return"";return`; props: [${Object.getOwnPropertyNames(e).map((r)=>`"${r}"`).join(", ")}]`}class J{constructor(e){this._client=e}}var xk=Symbol.for("brand.privateNullableHeaders");function*S1(e){if(!e)return;if(xk in e){let{values:o,nulls:n}=e;yield*o.entries();for(let i of n)yield[i,null];return}let t=!1,r;if(e instanceof Headers)r=e.entries();else if($g(e))r=e;else t=!0,r=Object.entries(e??{});for(let o of r){let n=o[0];if(typeof n!=="string")throw TypeError("expected header name to be a string");let i=$g(o[1])?o[1]:[o[1]],s=!1;for(let a of i){if(a===void 0)continue;if(t&&!s)s=!0,yield[n,null];yield[n,a]}}}var E=(e)=>{let t=new Headers,r=new Set;for(let o of e){let n=new Set;for(let[i,s]of S1(o)){let a=i.toLowerCase();if(!n.has(a))t.delete(i),n.add(a);if(s===null)t.delete(i),r.add(a);else t.append(i,s),r.delete(a)}}return{[xk]:!0,values:t,nulls:r}};function kk(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var wk=Object.freeze(Object.create(null)),x1=(e=kk)=>function(r,...o){if(r.length===1)return r[0];let n=!1,i=[],s=r.reduce((d,p,f)=>{if(/[?#]/.test(p))n=!0;let m=o[f],g=(n?encodeURIComponent:e)(""+m);if(f!==o.length&&(m==null||typeof m==="object"&&m.toString===Object.getPrototypeOf(Object.getPrototypeOf(m.hasOwnProperty??wk)??wk)?.toString))g=m+"",i.push({start:d.length+p.length,length:g.length,error:`Value of type ${Object.prototype.toString.call(m).slice(8,-1)} is not a valid path parameter`});return d+p+(f===o.length?"":g)},""),a=s.split(/[?#]/,1)[0],c=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,u;while((u=c.exec(a))!==null)i.push({start:u.index,length:u[0].length,error:`Value "${u[0]}" can't be safely passed as a path parameter`});if(i.sort((d,p)=>d.start-p.start),i.length>0){let d=0,p=i.reduce((f,m)=>{let g=" ".repeat(m.start-d),h="^".repeat(m.length);return d=m.start+m.length,f+g+h},"");throw new z(`Path parameters result in path with invalid segments:
21
21
  ${i.map((f)=>f.error).join(`
22
22
  `)}
23
23
  ${s}
24
- ${p}`)}return s},M=g1(xk);class aa extends J{create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/environments?beta=true",{body:o,...t,headers:T([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/environments/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{betas:o,...n}=t;return this._client.post(M`/v1/environments/${e}?beta=true`,{body:n,...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/environments?beta=true",ye,{query:o,...t,headers:T([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(M`/v1/environments/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}archive(e,t={},r){let{betas:o}=t??{};return this._client.post(M`/v1/environments/${e}/archive?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}var ca=Symbol("anthropic.sdk.stainlessHelper");function Cu(e){return typeof e==="object"&&e!==null&&ca in e}function Zg(e,t){let r=new Set;if(e){for(let o of e)if(Cu(o))r.add(o[ca])}if(t)for(let o of t){if(Cu(o))r.add(o[ca]);if(Array.isArray(o.content)){for(let n of o.content)if(Cu(n))r.add(n[ca])}}return Array.from(r)}function Mu(e,t){let r=Zg(e,t);if(r.length===0)return{};return{"x-stainless-helper":r.join(", ")}}function wk(e){if(Cu(e))return{"x-stainless-helper":e[ca]};return{}}class la extends J{list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/files?beta=true",sr,{query:o,...t,headers:T([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(M`/v1/files/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"files-api-2025-04-14"].toString()},r?.headers])})}download(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/files/${e}/content?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},r?.headers]),__binaryResponse:!0})}retrieveMetadata(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/files/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"files-api-2025-04-14"].toString()},r?.headers])})}upload(e,t){let{betas:r,...o}=e;return this._client.post("/v1/files?beta=true",ii({body:o,...t,headers:T([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString()},wk(o.file),t?.headers])},this._client))}}class ua extends J{retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/models/${e}?beta=true`,{...r,headers:T([{...o?.toString()!=null?{"anthropic-beta":o?.toString()}:void 0},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/models?beta=true",sr,{query:o,...t,headers:T([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},t?.headers])})}}class da extends J{create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/user_profiles?beta=true",{body:o,...t,headers:T([{"anthropic-beta":[...r??[],"user-profiles-2026-03-24"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/user_profiles/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"user-profiles-2026-03-24"].toString()},r?.headers])})}update(e,t,r){let{betas:o,...n}=t;return this._client.post(M`/v1/user_profiles/${e}?beta=true`,{body:n,...r,headers:T([{"anthropic-beta":[...o??[],"user-profiles-2026-03-24"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/user_profiles?beta=true",ye,{query:o,...t,headers:T([{"anthropic-beta":[...r??[],"user-profiles-2026-03-24"].toString()},t?.headers])})}createEnrollmentURL(e,t={},r){let{betas:o}=t??{};return this._client.post(M`/v1/user_profiles/${e}/enrollment_url?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"user-profiles-2026-03-24"].toString()},r?.headers])})}}class pa extends J{list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(M`/v1/agents/${e}/versions?beta=true`,ye,{query:n,...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}class si extends J{constructor(){super(...arguments);this.versions=new pa(this._client)}create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/agents?beta=true",{body:o,...t,headers:T([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o,...n}=t??{};return this._client.get(M`/v1/agents/${e}?beta=true`,{query:n,...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{betas:o,...n}=t;return this._client.post(M`/v1/agents/${e}?beta=true`,{body:n,...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/agents?beta=true",ye,{query:o,...t,headers:T([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}archive(e,t={},r){let{betas:o}=t??{};return this._client.post(M`/v1/agents/${e}/archive?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}si.Versions=pa;class fa extends J{create(e,t,r){let{view:o,betas:n,...i}=t;return this._client.post(M`/v1/memory_stores/${e}/memories?beta=true`,{query:{view:o},body:i,...r,headers:T([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}retrieve(e,t,r){let{memory_store_id:o,betas:n,...i}=t;return this._client.get(M`/v1/memory_stores/${o}/memories/${e}?beta=true`,{query:i,...r,headers:T([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{memory_store_id:o,view:n,betas:i,...s}=t;return this._client.post(M`/v1/memory_stores/${o}/memories/${e}?beta=true`,{query:{view:n},body:s,...r,headers:T([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(M`/v1/memory_stores/${e}/memories?beta=true`,ye,{query:n,...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}delete(e,t,r){let{memory_store_id:o,expected_content_sha256:n,betas:i}=t;return this._client.delete(M`/v1/memory_stores/${o}/memories/${e}?beta=true`,{query:{expected_content_sha256:n},...r,headers:T([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}class ma extends J{retrieve(e,t,r){let{memory_store_id:o,betas:n,...i}=t;return this._client.get(M`/v1/memory_stores/${o}/memory_versions/${e}?beta=true`,{query:i,...r,headers:T([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(M`/v1/memory_stores/${e}/memory_versions?beta=true`,ye,{query:n,...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}redact(e,t,r){let{memory_store_id:o,betas:n}=t;return this._client.post(M`/v1/memory_stores/${o}/memory_versions/${e}/redact?beta=true`,{...r,headers:T([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}class io extends J{constructor(){super(...arguments);this.memories=new fa(this._client),this.memoryVersions=new ma(this._client)}create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/memory_stores?beta=true",{body:o,...t,headers:T([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/memory_stores/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{betas:o,...n}=t;return this._client.post(M`/v1/memory_stores/${e}?beta=true`,{body:n,...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/memory_stores?beta=true",ye,{query:o,...t,headers:T([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(M`/v1/memory_stores/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}archive(e,t={},r){let{betas:o}=t??{};return this._client.post(M`/v1/memory_stores/${e}/archive?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}io.Memories=fa;io.MemoryVersions=ma;class ai{constructor(e,t){this.iterator=e,this.controller=t}async*decoder(){let e=new mn;for await(let t of this.iterator)for(let r of e.decode(t))yield JSON.parse(r);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 ai(ra(e.body),t)}}class ga extends J{create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/messages/batches?beta=true",{body:o,...t,headers:T([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/messages/batches/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/messages/batches?beta=true",sr,{query:o,...t,headers:T([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(M`/v1/messages/batches/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString()},r?.headers])})}cancel(e,t={},r){let{betas:o}=t??{};return this._client.post(M`/v1/messages/batches/${e}/cancel?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString()},r?.headers])})}async results(e,t={},r){let o=await this.retrieve(e);if(!o.results_url)throw new z(`No batch \`results_url\`; Has it finished processing? ${o.processing_status} - ${o.id}`);let{betas:n}=t??{};return this._client.get(o.results_url,{...r,headers:T([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},r?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((i,s)=>ai.fromResponse(s.response,s.controller))}}var Nu={"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 kk(e){return e?.output_format??e?.output_config?.format}function Vg(e,t,r){let o=kk(t);if(!t||!("parse"in(o??{})))return{...e,content:e.content.map((n)=>{if(n.type==="text"){let i=Object.defineProperty({...n},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(i,"parsed",{get(){return r.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return n}),parsed_output:null};return Wg(e,t,r)}function Wg(e,t,r){let o=null,n=e.content.map((i)=>{if(i.type==="text"){let s=E1(t,i.text);if(o===null)o=s;let a=Object.defineProperty({...i},"parsed_output",{value:s,enumerable:!1});return Object.defineProperty(a,"parsed",{get(){return r.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),s},enumerable:!1})}return i});return{...e,content:n,parsed_output:o}}function E1(e,t){let r=kk(e);if(r?.type!=="json_schema")return null;try{if("parse"in r)return r.parse(t);return JSON.parse(t)}catch(o){throw new z(`Failed to parse structured output: ${o}`)}}var P1=(e)=>{let t=0,r=[];while(t<e.length){let o=e[t];if(o==="\\"){t++;continue}if(o==="{"){r.push({type:"brace",value:"{"}),t++;continue}if(o==="}"){r.push({type:"brace",value:"}"}),t++;continue}if(o==="["){r.push({type:"paren",value:"["}),t++;continue}if(o==="]"){r.push({type:"paren",value:"]"}),t++;continue}if(o===":"){r.push({type:"separator",value:":"}),t++;continue}if(o===","){r.push({type:"delimiter",value:","}),t++;continue}if(o==='"'){let a="",c=!1;o=e[++t];while(o!=='"'){if(t===e.length){c=!0;break}if(o==="\\"){if(t++,t===e.length){c=!0;break}a+=o+e[t],o=e[++t]}else a+=o,o=e[++t]}if(o=e[++t],!c)r.push({type:"string",value:a});continue}if(o&&/\s/.test(o)){t++;continue}let i=/[0-9]/;if(o&&i.test(o)||o==="-"||o==="."){let a="";if(o==="-")a+=o,o=e[++t];while(o&&i.test(o)||o===".")a+=o,o=e[++t];r.push({type:"number",value:a});continue}let s=/[a-z]/i;if(o&&s.test(o)){let a="";while(o&&s.test(o)){if(t===e.length)break;a+=o,o=e[++t]}if(a=="true"||a=="false"||a==="null")r.push({type:"name",value:a});else{t++;continue}continue}t++}return r},ci=(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),ci(e);break;case"number":let r=t.value[t.value.length-1];if(r==="."||r==="-")return e=e.slice(0,e.length-1),ci(e);case"string":let o=e[e.length-2];if(o?.type==="delimiter")return e=e.slice(0,e.length-1),ci(e);else if(o?.type==="brace"&&o.value==="{")return e=e.slice(0,e.length-1),ci(e);break;case"delimiter":return e=e.slice(0,e.length-1),ci(e);break}return e},I1=(e)=>{let t=[];if(e.map((r)=>{if(r.type==="brace")if(r.value==="{")t.push("}");else t.splice(t.lastIndexOf("}"),1);if(r.type==="paren")if(r.value==="[")t.push("]");else t.splice(t.lastIndexOf("]"),1)}),t.length>0)t.reverse().map((r)=>{if(r==="}")e.push({type:"brace",value:"}"});else if(r==="]")e.push({type:"paren",value:"]"})});return e},R1=(e)=>{let t="";return e.map((r)=>{switch(r.type){case"string":t+='"'+r.value+'"';break;default:t+=r.value;break}}),t},Du=(e)=>JSON.parse(R1(I1(ci(P1(e)))));var Vt,gn,li,ha,ju,ya,ba,zu,_a,jr,va,Uu,Lu,so,Fu,Hu,Sa,Kg,Tk,Bu,Gg,Jg,Xg,Ek,Pk="__json_buf";function Ik(e){return e.type==="tool_use"||e.type==="server_tool_use"||e.type==="mcp_tool_use"}class xa{constructor(e,t){Vt.add(this),this.messages=[],this.receivedMessages=[],gn.set(this,void 0),li.set(this,null),this.controller=new AbortController,ha.set(this,void 0),ju.set(this,()=>{}),ya.set(this,()=>{}),ba.set(this,void 0),zu.set(this,()=>{}),_a.set(this,()=>{}),jr.set(this,{}),va.set(this,!1),Uu.set(this,!1),Lu.set(this,!1),so.set(this,!1),Fu.set(this,void 0),Hu.set(this,void 0),Sa.set(this,void 0),Bu.set(this,(r)=>{if(D(this,Uu,!0,"f"),Nr(r))r=new tt;if(r instanceof tt)return D(this,Lu,!0,"f"),this._emit("abort",r);if(r instanceof z)return this._emit("error",r);if(r instanceof Error){let o=new z(r.message);return o.cause=r,this._emit("error",o)}return this._emit("error",new z(String(r)))}),D(this,ha,new Promise((r,o)=>{D(this,ju,r,"f"),D(this,ya,o,"f")}),"f"),D(this,ba,new Promise((r,o)=>{D(this,zu,r,"f"),D(this,_a,o,"f")}),"f"),_(this,ha,"f").catch(()=>{}),_(this,ba,"f").catch(()=>{}),D(this,li,e,"f"),D(this,Sa,t?.logger??console,"f")}get response(){return _(this,Fu,"f")}get request_id(){return _(this,Hu,"f")}async withResponse(){D(this,so,!0,"f");let e=await _(this,ha,"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 xa(null);return t._run(()=>t._fromReadableStream(e)),t}static createMessage(e,t,r,{logger:o}={}){let n=new xa(t,{logger:o});for(let i of t.messages)n._addMessageParam(i);return D(n,li,{...t,stream:!0},"f"),n._run(()=>n._createMessage(e,{...t,stream:!0},{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"stream"}})),n}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},_(this,Bu,"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,r){let o=r?.signal,n;if(o){if(o.aborted)this.controller.abort();n=this.controller.abort.bind(this.controller),o.addEventListener("abort",n)}try{_(this,Vt,"m",Gg).call(this);let{response:i,data:s}=await e.create({...t,stream:!0},{...r,signal:this.controller.signal}).withResponse();this._connected(i);for await(let a of s)_(this,Vt,"m",Jg).call(this,a);if(s.controller.signal?.aborted)throw new tt;_(this,Vt,"m",Xg).call(this)}finally{if(o&&n)o.removeEventListener("abort",n)}}_connected(e){if(this.ended)return;D(this,Fu,e,"f"),D(this,Hu,e?.headers.get("request-id"),"f"),_(this,ju,"f").call(this,e),this._emit("connect")}get ended(){return _(this,va,"f")}get errored(){return _(this,Uu,"f")}get aborted(){return _(this,Lu,"f")}abort(){this.controller.abort()}on(e,t){return(_(this,jr,"f")[e]||(_(this,jr,"f")[e]=[])).push({listener:t}),this}off(e,t){let r=_(this,jr,"f")[e];if(!r)return this;let o=r.findIndex((n)=>n.listener===t);if(o>=0)r.splice(o,1);return this}once(e,t){return(_(this,jr,"f")[e]||(_(this,jr,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,r)=>{if(D(this,so,!0,"f"),e!=="error")this.once("error",r);this.once(e,t)})}async done(){D(this,so,!0,"f"),await _(this,ba,"f")}get currentMessage(){return _(this,gn,"f")}async finalMessage(){return await this.done(),_(this,Vt,"m",Kg).call(this)}async finalText(){return await this.done(),_(this,Vt,"m",Tk).call(this)}_emit(e,...t){if(_(this,va,"f"))return;if(e==="end")D(this,va,!0,"f"),_(this,zu,"f").call(this);let r=_(this,jr,"f")[e];if(r)_(this,jr,"f")[e]=r.filter((o)=>!o.once),r.forEach(({listener:o})=>o(...t));if(e==="abort"){let o=t[0];if(!_(this,so,"f")&&!r?.length)Promise.reject(o);_(this,ya,"f").call(this,o),_(this,_a,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=t[0];if(!_(this,so,"f")&&!r?.length)Promise.reject(o);_(this,ya,"f").call(this,o),_(this,_a,"f").call(this,o),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",_(this,Vt,"m",Kg).call(this))}async _fromReadableStream(e,t){let r=t?.signal,o;if(r){if(r.aborted)this.controller.abort();o=this.controller.abort.bind(this.controller),r.addEventListener("abort",o)}try{_(this,Vt,"m",Gg).call(this),this._connected(null);let n=Nt.fromReadableStream(e,this.controller);for await(let i of n)_(this,Vt,"m",Jg).call(this,i);if(n.controller.signal?.aborted)throw new tt;_(this,Vt,"m",Xg).call(this)}finally{if(r&&o)r.removeEventListener("abort",o)}}[(gn=new WeakMap,li=new WeakMap,ha=new WeakMap,ju=new WeakMap,ya=new WeakMap,ba=new WeakMap,zu=new WeakMap,_a=new WeakMap,jr=new WeakMap,va=new WeakMap,Uu=new WeakMap,Lu=new WeakMap,so=new WeakMap,Fu=new WeakMap,Hu=new WeakMap,Sa=new WeakMap,Bu=new WeakMap,Vt=new WeakSet,Kg=function(){if(this.receivedMessages.length===0)throw new z("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Tk=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((r)=>r.type==="text").map((r)=>r.text);if(t.length===0)throw new z("stream ended without producing a content block with type=text");return t.join(" ")},Gg=function(){if(this.ended)return;D(this,gn,void 0,"f")},Jg=function(t){if(this.ended)return;let r=_(this,Vt,"m",Ek).call(this,t);switch(this._emit("streamEvent",t,r),t.type){case"content_block_delta":{let o=r.content.at(-1);switch(t.delta.type){case"text_delta":{if(o.type==="text")this._emit("text",t.delta.text,o.text||"");break}case"citations_delta":{if(o.type==="text")this._emit("citation",t.delta.citation,o.citations??[]);break}case"input_json_delta":{if(Ik(o)&&o.input)this._emit("inputJson",t.delta.partial_json,o.input);break}case"thinking_delta":{if(o.type==="thinking")this._emit("thinking",t.delta.thinking,o.thinking);break}case"signature_delta":{if(o.type==="thinking")this._emit("signature",o.signature);break}case"compaction_delta":{if(o.type==="compaction"&&o.content)this._emit("compaction",o.content);break}default:Rk(t.delta)}break}case"message_stop":{this._addMessageParam(r),this._addMessage(Vg(r,_(this,li,"f"),{logger:_(this,Sa,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",r.content.at(-1));break}case"message_start":{D(this,gn,r,"f");break}case"content_block_start":case"message_delta":break}},Xg=function(){if(this.ended)throw new z("stream has ended, this shouldn't happen");let t=_(this,gn,"f");if(!t)throw new z("request ended without sending any chunks");return D(this,gn,void 0,"f"),Vg(t,_(this,li,"f"),{logger:_(this,Sa,"f")})},Ek=function(t){let r=_(this,gn,"f");if(t.type==="message_start"){if(r)throw new z(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!r)throw new z(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return r;case"message_delta":if(r.container=t.delta.container,r.stop_reason=t.delta.stop_reason,r.stop_sequence=t.delta.stop_sequence,r.usage.output_tokens=t.usage.output_tokens,r.context_management=t.context_management,t.usage.input_tokens!=null)r.usage.input_tokens=t.usage.input_tokens;if(t.usage.cache_creation_input_tokens!=null)r.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens;if(t.usage.cache_read_input_tokens!=null)r.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens;if(t.usage.server_tool_use!=null)r.usage.server_tool_use=t.usage.server_tool_use;if(t.usage.iterations!=null)r.usage.iterations=t.usage.iterations;return r;case"content_block_start":return r.content.push(t.content_block),r;case"content_block_delta":{let o=r.content.at(t.index);switch(t.delta.type){case"text_delta":{if(o?.type==="text")r.content[t.index]={...o,text:(o.text||"")+t.delta.text};break}case"citations_delta":{if(o?.type==="text")r.content[t.index]={...o,citations:[...o.citations??[],t.delta.citation]};break}case"input_json_delta":{if(o&&Ik(o)){let n=o[Pk]||"";n+=t.delta.partial_json;let i={...o};if(Object.defineProperty(i,Pk,{value:n,enumerable:!1,writable:!0}),n)try{i.input=Du(n)}catch(s){let a=new z(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${s}. JSON: ${n}`);_(this,Bu,"f").call(this,a)}r.content[t.index]=i}break}case"thinking_delta":{if(o?.type==="thinking")r.content[t.index]={...o,thinking:o.thinking+t.delta.thinking};break}case"signature_delta":{if(o?.type==="thinking")r.content[t.index]={...o,signature:t.delta.signature};break}case"compaction_delta":{if(o?.type==="compaction")r.content[t.index]={...o,content:(o.content||"")+t.delta.content};break}default:Rk(t.delta)}return r}case"content_block_stop":return r}},Symbol.asyncIterator)](){let e=[],t=[],r=!1;return this.on("streamEvent",(o)=>{let n=t.shift();if(n)n.resolve(o);else e.push(o)}),this.on("end",()=>{r=!0;for(let o of t)o.resolve(void 0);t.length=0}),this.on("abort",(o)=>{r=!0;for(let n of t)n.reject(o);t.length=0}),this.on("error",(o)=>{r=!0;for(let n of t)n.reject(o);t.length=0}),{next:async()=>{if(!e.length){if(r)return{value:void 0,done:!0};return new Promise((n,i)=>t.push({resolve:n,reject:i})).then((n)=>n?{value:n,done:!1}:{value:void 0,done:!0})}return{value:e.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new Nt(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function Rk(e){}class ui extends Error{constructor(e){let t=typeof e==="string"?e:e.map((r)=>{if(r.type==="text")return r.text;return`[${r.type}]`}).join(" ");super(t);this.name="ToolError",this.content=e}}var $k=1e5,Ok=`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:
24
+ ${p}`)}return s},M=x1(kk);class aa extends J{create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/environments?beta=true",{body:o,...t,headers:E([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/environments/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{betas:o,...n}=t;return this._client.post(M`/v1/environments/${e}?beta=true`,{body:n,...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/environments?beta=true",ye,{query:o,...t,headers:E([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(M`/v1/environments/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}archive(e,t={},r){let{betas:o}=t??{};return this._client.post(M`/v1/environments/${e}/archive?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}var ca=Symbol("anthropic.sdk.stainlessHelper");function Mu(e){return typeof e==="object"&&e!==null&&ca in e}function Vg(e,t){let r=new Set;if(e){for(let o of e)if(Mu(o))r.add(o[ca])}if(t)for(let o of t){if(Mu(o))r.add(o[ca]);if(Array.isArray(o.content)){for(let n of o.content)if(Mu(n))r.add(n[ca])}}return Array.from(r)}function Nu(e,t){let r=Vg(e,t);if(r.length===0)return{};return{"x-stainless-helper":r.join(", ")}}function Ek(e){if(Mu(e))return{"x-stainless-helper":e[ca]};return{}}class la extends J{list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/files?beta=true",sr,{query:o,...t,headers:E([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(M`/v1/files/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"files-api-2025-04-14"].toString()},r?.headers])})}download(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/files/${e}/content?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},r?.headers]),__binaryResponse:!0})}retrieveMetadata(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/files/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"files-api-2025-04-14"].toString()},r?.headers])})}upload(e,t){let{betas:r,...o}=e;return this._client.post("/v1/files?beta=true",ii({body:o,...t,headers:E([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString()},Ek(o.file),t?.headers])},this._client))}}class ua extends J{retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/models/${e}?beta=true`,{...r,headers:E([{...o?.toString()!=null?{"anthropic-beta":o?.toString()}:void 0},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/models?beta=true",sr,{query:o,...t,headers:E([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},t?.headers])})}}class da extends J{create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/user_profiles?beta=true",{body:o,...t,headers:E([{"anthropic-beta":[...r??[],"user-profiles-2026-03-24"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/user_profiles/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"user-profiles-2026-03-24"].toString()},r?.headers])})}update(e,t,r){let{betas:o,...n}=t;return this._client.post(M`/v1/user_profiles/${e}?beta=true`,{body:n,...r,headers:E([{"anthropic-beta":[...o??[],"user-profiles-2026-03-24"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/user_profiles?beta=true",ye,{query:o,...t,headers:E([{"anthropic-beta":[...r??[],"user-profiles-2026-03-24"].toString()},t?.headers])})}createEnrollmentURL(e,t={},r){let{betas:o}=t??{};return this._client.post(M`/v1/user_profiles/${e}/enrollment_url?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"user-profiles-2026-03-24"].toString()},r?.headers])})}}class pa extends J{list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(M`/v1/agents/${e}/versions?beta=true`,ye,{query:n,...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}class si extends J{constructor(){super(...arguments);this.versions=new pa(this._client)}create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/agents?beta=true",{body:o,...t,headers:E([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o,...n}=t??{};return this._client.get(M`/v1/agents/${e}?beta=true`,{query:n,...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{betas:o,...n}=t;return this._client.post(M`/v1/agents/${e}?beta=true`,{body:n,...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/agents?beta=true",ye,{query:o,...t,headers:E([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}archive(e,t={},r){let{betas:o}=t??{};return this._client.post(M`/v1/agents/${e}/archive?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}si.Versions=pa;class fa extends J{create(e,t,r){let{view:o,betas:n,...i}=t;return this._client.post(M`/v1/memory_stores/${e}/memories?beta=true`,{query:{view:o},body:i,...r,headers:E([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}retrieve(e,t,r){let{memory_store_id:o,betas:n,...i}=t;return this._client.get(M`/v1/memory_stores/${o}/memories/${e}?beta=true`,{query:i,...r,headers:E([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{memory_store_id:o,view:n,betas:i,...s}=t;return this._client.post(M`/v1/memory_stores/${o}/memories/${e}?beta=true`,{query:{view:n},body:s,...r,headers:E([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(M`/v1/memory_stores/${e}/memories?beta=true`,ye,{query:n,...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}delete(e,t,r){let{memory_store_id:o,expected_content_sha256:n,betas:i}=t;return this._client.delete(M`/v1/memory_stores/${o}/memories/${e}?beta=true`,{query:{expected_content_sha256:n},...r,headers:E([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}class ma extends J{retrieve(e,t,r){let{memory_store_id:o,betas:n,...i}=t;return this._client.get(M`/v1/memory_stores/${o}/memory_versions/${e}?beta=true`,{query:i,...r,headers:E([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(M`/v1/memory_stores/${e}/memory_versions?beta=true`,ye,{query:n,...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}redact(e,t,r){let{memory_store_id:o,betas:n}=t;return this._client.post(M`/v1/memory_stores/${o}/memory_versions/${e}/redact?beta=true`,{...r,headers:E([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}class ao extends J{constructor(){super(...arguments);this.memories=new fa(this._client),this.memoryVersions=new ma(this._client)}create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/memory_stores?beta=true",{body:o,...t,headers:E([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/memory_stores/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{betas:o,...n}=t;return this._client.post(M`/v1/memory_stores/${e}?beta=true`,{body:n,...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/memory_stores?beta=true",ye,{query:o,...t,headers:E([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(M`/v1/memory_stores/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}archive(e,t={},r){let{betas:o}=t??{};return this._client.post(M`/v1/memory_stores/${e}/archive?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}ao.Memories=fa;ao.MemoryVersions=ma;class ai{constructor(e,t){this.iterator=e,this.controller=t}async*decoder(){let e=new hn;for await(let t of this.iterator)for(let r of e.decode(t))yield JSON.parse(r);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 ai(ra(e.body),t)}}class ga extends J{create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/messages/batches?beta=true",{body:o,...t,headers:E([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/messages/batches/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/messages/batches?beta=true",sr,{query:o,...t,headers:E([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(M`/v1/messages/batches/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString()},r?.headers])})}cancel(e,t={},r){let{betas:o}=t??{};return this._client.post(M`/v1/messages/batches/${e}/cancel?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString()},r?.headers])})}async results(e,t={},r){let o=await this.retrieve(e);if(!o.results_url)throw new z(`No batch \`results_url\`; Has it finished processing? ${o.processing_status} - ${o.id}`);let{betas:n}=t??{};return this._client.get(o.results_url,{...r,headers:E([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},r?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((i,s)=>ai.fromResponse(s.response,s.controller))}}var Du={"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 Tk(e){return e?.output_format??e?.output_config?.format}function Wg(e,t,r){let o=Tk(t);if(!t||!("parse"in(o??{})))return{...e,content:e.content.map((n)=>{if(n.type==="text"){let i=Object.defineProperty({...n},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(i,"parsed",{get(){return r.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return n}),parsed_output:null};return Kg(e,t,r)}function Kg(e,t,r){let o=null,n=e.content.map((i)=>{if(i.type==="text"){let s=C1(t,i.text);if(o===null)o=s;let a=Object.defineProperty({...i},"parsed_output",{value:s,enumerable:!1});return Object.defineProperty(a,"parsed",{get(){return r.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),s},enumerable:!1})}return i});return{...e,content:n,parsed_output:o}}function C1(e,t){let r=Tk(e);if(r?.type!=="json_schema")return null;try{if("parse"in r)return r.parse(t);return JSON.parse(t)}catch(o){throw new z(`Failed to parse structured output: ${o}`)}}var M1=(e)=>{let t=0,r=[];while(t<e.length){let o=e[t];if(o==="\\"){t++;continue}if(o==="{"){r.push({type:"brace",value:"{"}),t++;continue}if(o==="}"){r.push({type:"brace",value:"}"}),t++;continue}if(o==="["){r.push({type:"paren",value:"["}),t++;continue}if(o==="]"){r.push({type:"paren",value:"]"}),t++;continue}if(o===":"){r.push({type:"separator",value:":"}),t++;continue}if(o===","){r.push({type:"delimiter",value:","}),t++;continue}if(o==='"'){let a="",c=!1;o=e[++t];while(o!=='"'){if(t===e.length){c=!0;break}if(o==="\\"){if(t++,t===e.length){c=!0;break}a+=o+e[t],o=e[++t]}else a+=o,o=e[++t]}if(o=e[++t],!c)r.push({type:"string",value:a});continue}if(o&&/\s/.test(o)){t++;continue}let i=/[0-9]/;if(o&&i.test(o)||o==="-"||o==="."){let a="";if(o==="-")a+=o,o=e[++t];while(o&&i.test(o)||o===".")a+=o,o=e[++t];r.push({type:"number",value:a});continue}let s=/[a-z]/i;if(o&&s.test(o)){let a="";while(o&&s.test(o)){if(t===e.length)break;a+=o,o=e[++t]}if(a=="true"||a=="false"||a==="null")r.push({type:"name",value:a});else{t++;continue}continue}t++}return r},ci=(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),ci(e);break;case"number":let r=t.value[t.value.length-1];if(r==="."||r==="-")return e=e.slice(0,e.length-1),ci(e);case"string":let o=e[e.length-2];if(o?.type==="delimiter")return e=e.slice(0,e.length-1),ci(e);else if(o?.type==="brace"&&o.value==="{")return e=e.slice(0,e.length-1),ci(e);break;case"delimiter":return e=e.slice(0,e.length-1),ci(e);break}return e},N1=(e)=>{let t=[];if(e.map((r)=>{if(r.type==="brace")if(r.value==="{")t.push("}");else t.splice(t.lastIndexOf("}"),1);if(r.type==="paren")if(r.value==="[")t.push("]");else t.splice(t.lastIndexOf("]"),1)}),t.length>0)t.reverse().map((r)=>{if(r==="}")e.push({type:"brace",value:"}"});else if(r==="]")e.push({type:"paren",value:"]"})});return e},D1=(e)=>{let t="";return e.map((r)=>{switch(r.type){case"string":t+='"'+r.value+'"';break;default:t+=r.value;break}}),t},ju=(e)=>JSON.parse(D1(N1(ci(M1(e)))));var Vt,yn,li,ha,zu,ya,ba,Uu,_a,jr,va,Lu,Fu,co,Hu,Bu,Sa,Gg,Pk,qu,Jg,Xg,Yg,Ik,Rk="__json_buf";function $k(e){return e.type==="tool_use"||e.type==="server_tool_use"||e.type==="mcp_tool_use"}class xa{constructor(e,t){Vt.add(this),this.messages=[],this.receivedMessages=[],yn.set(this,void 0),li.set(this,null),this.controller=new AbortController,ha.set(this,void 0),zu.set(this,()=>{}),ya.set(this,()=>{}),ba.set(this,void 0),Uu.set(this,()=>{}),_a.set(this,()=>{}),jr.set(this,{}),va.set(this,!1),Lu.set(this,!1),Fu.set(this,!1),co.set(this,!1),Hu.set(this,void 0),Bu.set(this,void 0),Sa.set(this,void 0),qu.set(this,(r)=>{if(D(this,Lu,!0,"f"),Nr(r))r=new tt;if(r instanceof tt)return D(this,Fu,!0,"f"),this._emit("abort",r);if(r instanceof z)return this._emit("error",r);if(r instanceof Error){let o=new z(r.message);return o.cause=r,this._emit("error",o)}return this._emit("error",new z(String(r)))}),D(this,ha,new Promise((r,o)=>{D(this,zu,r,"f"),D(this,ya,o,"f")}),"f"),D(this,ba,new Promise((r,o)=>{D(this,Uu,r,"f"),D(this,_a,o,"f")}),"f"),_(this,ha,"f").catch(()=>{}),_(this,ba,"f").catch(()=>{}),D(this,li,e,"f"),D(this,Sa,t?.logger??console,"f")}get response(){return _(this,Hu,"f")}get request_id(){return _(this,Bu,"f")}async withResponse(){D(this,co,!0,"f");let e=await _(this,ha,"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 xa(null);return t._run(()=>t._fromReadableStream(e)),t}static createMessage(e,t,r,{logger:o}={}){let n=new xa(t,{logger:o});for(let i of t.messages)n._addMessageParam(i);return D(n,li,{...t,stream:!0},"f"),n._run(()=>n._createMessage(e,{...t,stream:!0},{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"stream"}})),n}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},_(this,qu,"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,r){let o=r?.signal,n;if(o){if(o.aborted)this.controller.abort();n=this.controller.abort.bind(this.controller),o.addEventListener("abort",n)}try{_(this,Vt,"m",Jg).call(this);let{response:i,data:s}=await e.create({...t,stream:!0},{...r,signal:this.controller.signal}).withResponse();this._connected(i);for await(let a of s)_(this,Vt,"m",Xg).call(this,a);if(s.controller.signal?.aborted)throw new tt;_(this,Vt,"m",Yg).call(this)}finally{if(o&&n)o.removeEventListener("abort",n)}}_connected(e){if(this.ended)return;D(this,Hu,e,"f"),D(this,Bu,e?.headers.get("request-id"),"f"),_(this,zu,"f").call(this,e),this._emit("connect")}get ended(){return _(this,va,"f")}get errored(){return _(this,Lu,"f")}get aborted(){return _(this,Fu,"f")}abort(){this.controller.abort()}on(e,t){return(_(this,jr,"f")[e]||(_(this,jr,"f")[e]=[])).push({listener:t}),this}off(e,t){let r=_(this,jr,"f")[e];if(!r)return this;let o=r.findIndex((n)=>n.listener===t);if(o>=0)r.splice(o,1);return this}once(e,t){return(_(this,jr,"f")[e]||(_(this,jr,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,r)=>{if(D(this,co,!0,"f"),e!=="error")this.once("error",r);this.once(e,t)})}async done(){D(this,co,!0,"f"),await _(this,ba,"f")}get currentMessage(){return _(this,yn,"f")}async finalMessage(){return await this.done(),_(this,Vt,"m",Gg).call(this)}async finalText(){return await this.done(),_(this,Vt,"m",Pk).call(this)}_emit(e,...t){if(_(this,va,"f"))return;if(e==="end")D(this,va,!0,"f"),_(this,Uu,"f").call(this);let r=_(this,jr,"f")[e];if(r)_(this,jr,"f")[e]=r.filter((o)=>!o.once),r.forEach(({listener:o})=>o(...t));if(e==="abort"){let o=t[0];if(!_(this,co,"f")&&!r?.length)Promise.reject(o);_(this,ya,"f").call(this,o),_(this,_a,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=t[0];if(!_(this,co,"f")&&!r?.length)Promise.reject(o);_(this,ya,"f").call(this,o),_(this,_a,"f").call(this,o),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",_(this,Vt,"m",Gg).call(this))}async _fromReadableStream(e,t){let r=t?.signal,o;if(r){if(r.aborted)this.controller.abort();o=this.controller.abort.bind(this.controller),r.addEventListener("abort",o)}try{_(this,Vt,"m",Jg).call(this),this._connected(null);let n=Nt.fromReadableStream(e,this.controller);for await(let i of n)_(this,Vt,"m",Xg).call(this,i);if(n.controller.signal?.aborted)throw new tt;_(this,Vt,"m",Yg).call(this)}finally{if(r&&o)r.removeEventListener("abort",o)}}[(yn=new WeakMap,li=new WeakMap,ha=new WeakMap,zu=new WeakMap,ya=new WeakMap,ba=new WeakMap,Uu=new WeakMap,_a=new WeakMap,jr=new WeakMap,va=new WeakMap,Lu=new WeakMap,Fu=new WeakMap,co=new WeakMap,Hu=new WeakMap,Bu=new WeakMap,Sa=new WeakMap,qu=new WeakMap,Vt=new WeakSet,Gg=function(){if(this.receivedMessages.length===0)throw new z("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Pk=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((r)=>r.type==="text").map((r)=>r.text);if(t.length===0)throw new z("stream ended without producing a content block with type=text");return t.join(" ")},Jg=function(){if(this.ended)return;D(this,yn,void 0,"f")},Xg=function(t){if(this.ended)return;let r=_(this,Vt,"m",Ik).call(this,t);switch(this._emit("streamEvent",t,r),t.type){case"content_block_delta":{let o=r.content.at(-1);switch(t.delta.type){case"text_delta":{if(o.type==="text")this._emit("text",t.delta.text,o.text||"");break}case"citations_delta":{if(o.type==="text")this._emit("citation",t.delta.citation,o.citations??[]);break}case"input_json_delta":{if($k(o)&&o.input)this._emit("inputJson",t.delta.partial_json,o.input);break}case"thinking_delta":{if(o.type==="thinking")this._emit("thinking",t.delta.thinking,o.thinking);break}case"signature_delta":{if(o.type==="thinking")this._emit("signature",o.signature);break}case"compaction_delta":{if(o.type==="compaction"&&o.content)this._emit("compaction",o.content);break}default:Ok(t.delta)}break}case"message_stop":{this._addMessageParam(r),this._addMessage(Wg(r,_(this,li,"f"),{logger:_(this,Sa,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",r.content.at(-1));break}case"message_start":{D(this,yn,r,"f");break}case"content_block_start":case"message_delta":break}},Yg=function(){if(this.ended)throw new z("stream has ended, this shouldn't happen");let t=_(this,yn,"f");if(!t)throw new z("request ended without sending any chunks");return D(this,yn,void 0,"f"),Wg(t,_(this,li,"f"),{logger:_(this,Sa,"f")})},Ik=function(t){let r=_(this,yn,"f");if(t.type==="message_start"){if(r)throw new z(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!r)throw new z(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return r;case"message_delta":if(r.container=t.delta.container,r.stop_reason=t.delta.stop_reason,r.stop_sequence=t.delta.stop_sequence,r.usage.output_tokens=t.usage.output_tokens,r.context_management=t.context_management,t.usage.input_tokens!=null)r.usage.input_tokens=t.usage.input_tokens;if(t.usage.cache_creation_input_tokens!=null)r.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens;if(t.usage.cache_read_input_tokens!=null)r.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens;if(t.usage.server_tool_use!=null)r.usage.server_tool_use=t.usage.server_tool_use;if(t.usage.iterations!=null)r.usage.iterations=t.usage.iterations;return r;case"content_block_start":return r.content.push(t.content_block),r;case"content_block_delta":{let o=r.content.at(t.index);switch(t.delta.type){case"text_delta":{if(o?.type==="text")r.content[t.index]={...o,text:(o.text||"")+t.delta.text};break}case"citations_delta":{if(o?.type==="text")r.content[t.index]={...o,citations:[...o.citations??[],t.delta.citation]};break}case"input_json_delta":{if(o&&$k(o)){let n=o[Rk]||"";n+=t.delta.partial_json;let i={...o};if(Object.defineProperty(i,Rk,{value:n,enumerable:!1,writable:!0}),n)try{i.input=ju(n)}catch(s){let a=new z(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${s}. JSON: ${n}`);_(this,qu,"f").call(this,a)}r.content[t.index]=i}break}case"thinking_delta":{if(o?.type==="thinking")r.content[t.index]={...o,thinking:o.thinking+t.delta.thinking};break}case"signature_delta":{if(o?.type==="thinking")r.content[t.index]={...o,signature:t.delta.signature};break}case"compaction_delta":{if(o?.type==="compaction")r.content[t.index]={...o,content:(o.content||"")+t.delta.content};break}default:Ok(t.delta)}return r}case"content_block_stop":return r}},Symbol.asyncIterator)](){let e=[],t=[],r=!1;return this.on("streamEvent",(o)=>{let n=t.shift();if(n)n.resolve(o);else e.push(o)}),this.on("end",()=>{r=!0;for(let o of t)o.resolve(void 0);t.length=0}),this.on("abort",(o)=>{r=!0;for(let n of t)n.reject(o);t.length=0}),this.on("error",(o)=>{r=!0;for(let n of t)n.reject(o);t.length=0}),{next:async()=>{if(!e.length){if(r)return{value:void 0,done:!0};return new Promise((n,i)=>t.push({resolve:n,reject:i})).then((n)=>n?{value:n,done:!1}:{value:void 0,done:!0})}return{value:e.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new Nt(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function Ok(e){}class ui extends Error{constructor(e){let t=typeof e==="string"?e:e.map((r)=>{if(r.type==="text")return r.text;return`[${r.type}]`}).join(" ");super(t);this.name="ToolError",this.content=e}}var Ak=1e5,Ck=`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:
25
25
  1. Task Overview
26
26
  The user's core request and success criteria
27
27
  Any clarifications or constraints they specified
@@ -43,36 +43,36 @@ User preferences or style requirements
43
43
  Domain-specific details that aren't obvious
44
44
  Any promises made to the user
45
45
  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.
46
- Wrap your summary in <summary></summary> tags.`;var wa,di,ao,Ke,vt,Dt,zr,hn,ka,Ak,Yg;function Ck(){let e,t;return{promise:new Promise((o,n)=>{e=o,t=n}),resolve:e,reject:t}}class Ta{constructor(e,t,r){wa.add(this),this.client=e,di.set(this,!1),ao.set(this,!1),Ke.set(this,void 0),vt.set(this,void 0),Dt.set(this,void 0),zr.set(this,void 0),hn.set(this,void 0),ka.set(this,0),D(this,Ke,{params:{...t,messages:structuredClone(t.messages)}},"f");let n=["BetaToolRunner",...Zg(t.tools,t.messages)].join(", ");if(D(this,vt,{...r,headers:T([{"x-stainless-helper":n},r?.headers])},"f"),D(this,hn,Ck(),"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*[(di=new WeakMap,ao=new WeakMap,Ke=new WeakMap,vt=new WeakMap,Dt=new WeakMap,zr=new WeakMap,hn=new WeakMap,ka=new WeakMap,wa=new WeakSet,Ak=async function(){let t=_(this,Ke,"f").params.compactionControl;if(!t||!t.enabled)return!1;let r=0;if(_(this,Dt,"f")!==void 0)try{let c=await _(this,Dt,"f");r=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 o=t.contextTokenThreshold??$k;if(r<o)return!1;let n=t.model??_(this,Ke,"f").params.model,i=t.summaryPrompt??Ok,s=_(this,Ke,"f").params.messages;if(s[s.length-1].role==="assistant"){let c=s[s.length-1];if(Array.isArray(c.content)){let u=c.content.filter((d)=>d.type!=="tool_use");if(u.length===0)s.pop();else c.content=u}}let a=await this.client.beta.messages.create({model:n,messages:[...s,{role:"user",content:[{type:"text",text:i}]}],max_tokens:_(this,Ke,"f").params.max_tokens},{signal:_(this,vt,"f").signal,headers:T([_(this,vt,"f").headers,{"x-stainless-helper":"compaction"}])});if(a.content[0]?.type!=="text")throw new z("Expected text response for compaction");return _(this,Ke,"f").params.messages=[{role:"user",content:a.content}],!0},Symbol.asyncIterator)](){var e;if(_(this,di,"f"))throw new z("Cannot iterate over a consumed stream");D(this,di,!0,"f"),D(this,ao,!0,"f"),D(this,zr,void 0,"f");try{while(!0){let t;try{if(_(this,Ke,"f").params.max_iterations&&_(this,ka,"f")>=_(this,Ke,"f").params.max_iterations)break;D(this,ao,!1,"f"),D(this,zr,void 0,"f"),D(this,ka,(e=_(this,ka,"f"),e++,e),"f"),D(this,Dt,void 0,"f");let{max_iterations:r,compactionControl:o,...n}=_(this,Ke,"f").params;if(n.stream)t=this.client.beta.messages.stream({...n},_(this,vt,"f")),D(this,Dt,t.finalMessage(),"f"),_(this,Dt,"f").catch(()=>{}),yield t;else D(this,Dt,this.client.beta.messages.create({...n,stream:!1},_(this,vt,"f")),"f"),yield _(this,Dt,"f");if(!await _(this,wa,"m",Ak).call(this)){if(!_(this,ao,"f")){let{role:a,content:c}=await _(this,Dt,"f");_(this,Ke,"f").params.messages.push({role:a,content:c})}let s=await _(this,wa,"m",Yg).call(this,_(this,Ke,"f").params.messages.at(-1));if(s)_(this,Ke,"f").params.messages.push(s);else if(!_(this,ao,"f"))break}}finally{if(t)t.abort()}}if(!_(this,Dt,"f"))throw new z("ToolRunner concluded without a message from the server");_(this,hn,"f").resolve(await _(this,Dt,"f"))}catch(t){throw D(this,di,!1,"f"),_(this,hn,"f").promise.catch(()=>{}),_(this,hn,"f").reject(t),D(this,hn,Ck(),"f"),t}}setMessagesParams(e){if(typeof e==="function")_(this,Ke,"f").params=e(_(this,Ke,"f").params);else _(this,Ke,"f").params=e;D(this,ao,!0,"f"),D(this,zr,void 0,"f")}setRequestOptions(e){if(typeof e==="function")D(this,vt,e(_(this,vt,"f")),"f");else D(this,vt,{..._(this,vt,"f"),...e},"f")}async generateToolResponse(e=_(this,vt,"f").signal){let t=await _(this,Dt,"f")??this.params.messages.at(-1);if(!t)return null;return _(this,wa,"m",Yg).call(this,t,e)}done(){return _(this,hn,"f").promise}async runUntilDone(){if(!_(this,di,"f"))for await(let e of this);return this.done()}get params(){return _(this,Ke,"f").params}pushMessages(...e){this.setMessagesParams((t)=>({...t,messages:[...t.messages,...e]}))}then(e,t){return this.runUntilDone().then(e,t)}}Yg=async function(t,r=_(this,vt,"f").signal){if(_(this,zr,"f")!==void 0)return _(this,zr,"f");return D(this,zr,$1(_(this,Ke,"f").params,t,{..._(this,vt,"f"),signal:r}),"f"),_(this,zr,"f")};async function $1(e,t=e.messages.at(-1),r){if(!t||t.role!=="assistant"||!t.content||typeof t.content==="string")return null;let o=t.content.filter((i)=>i.type==="tool_use");if(o.length===0)return null;return{role:"user",content:await Promise.all(o.map(async(i)=>{let s=e.tools.find((a)=>("name"in a?a.name:a.mcp_server_name)===i.name);if(!s||!("run"in s))return{type:"tool_result",tool_use_id:i.id,content:`Error: Tool '${i.name}' not found`,is_error:!0};try{let a=i.input;if("parse"in s&&s.parse)a=s.parse(a);let c=await s.run(a,{toolUseBlock:i,signal:r?.signal});return{type:"tool_result",tool_use_id:i.id,content:c}}catch(a){return{type:"tool_result",tool_use_id:i.id,content:a instanceof ui?a.content:`Error: ${a instanceof Error?a.message:String(a)}`,is_error:!0}}}))}}var Mk={"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"},O1=["claude-mythos-preview","claude-opus-4-6"];class yn extends J{constructor(){super(...arguments);this.batches=new ga(this._client)}create(e,t){let r=Nk(e),{betas:o,...n}=r;if(n.model in Mk)console.warn(`The model '${n.model}' is deprecated and will reach end-of-life on ${Mk[n.model]}
47
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(O1.includes(n.model)&&n.thinking&&n.thinking.type==="enabled")console.warn(`Using Claude with ${n.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(!n.stream&&i==null){let a=Nu[n.model]??void 0;i=this._client.calculateNonstreamingTimeout(n.max_tokens,a)}let s=Mu(n.tools,n.messages);return this._client.post("/v1/messages?beta=true",{body:n,timeout:i??600000,...t,headers:T([{...o?.toString()!=null?{"anthropic-beta":o?.toString()}:void 0},s,t?.headers]),stream:r.stream??!1})}parse(e,t){return t={...t,headers:T([{"anthropic-beta":[...e.betas??[],"structured-outputs-2025-12-15"].toString()},t?.headers])},this.create(e,t).then((r)=>Wg(r,e,{logger:this._client.logger??console}))}stream(e,t){return xa.createMessage(this,e,t)}countTokens(e,t){let r=Nk(e),{betas:o,...n}=r;return this._client.post("/v1/messages/count_tokens?beta=true",{body:n,...t,headers:T([{"anthropic-beta":[...o??[],"token-counting-2024-11-01"].toString()},t?.headers])})}toolRunner(e,t){return new Ta(this._client,e,t)}}function Nk(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,...r}=e;return{...r,output_config:{...e.output_config,format:t}}}yn.Batches=ga;yn.BetaToolRunner=Ta;yn.ToolError=ui;class Ea extends J{list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(M`/v1/sessions/${e}/events?beta=true`,ye,{query:n,...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}send(e,t,r){let{betas:o,...n}=t;return this._client.post(M`/v1/sessions/${e}/events?beta=true`,{body:n,...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}stream(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/sessions/${e}/events/stream?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers]),stream:!0})}}class Pa extends J{retrieve(e,t,r){let{session_id:o,betas:n}=t;return this._client.get(M`/v1/sessions/${o}/resources/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{session_id:o,betas:n,...i}=t;return this._client.post(M`/v1/sessions/${o}/resources/${e}?beta=true`,{body:i,...r,headers:T([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(M`/v1/sessions/${e}/resources?beta=true`,ye,{query:n,...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}delete(e,t,r){let{session_id:o,betas:n}=t;return this._client.delete(M`/v1/sessions/${o}/resources/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}add(e,t,r){let{betas:o,...n}=t;return this._client.post(M`/v1/sessions/${e}/resources?beta=true`,{body:n,...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}class co extends J{constructor(){super(...arguments);this.events=new Ea(this._client),this.resources=new Pa(this._client)}create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/sessions?beta=true",{body:o,...t,headers:T([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/sessions/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{betas:o,...n}=t;return this._client.post(M`/v1/sessions/${e}?beta=true`,{body:n,...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/sessions?beta=true",ye,{query:o,...t,headers:T([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(M`/v1/sessions/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}archive(e,t={},r){let{betas:o}=t??{};return this._client.post(M`/v1/sessions/${e}/archive?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}co.Events=Ea;co.Resources=Pa;class Ia extends J{create(e,t={},r){let{betas:o,...n}=t??{};return this._client.post(M`/v1/skills/${e}/versions?beta=true`,ii({body:n,...r,headers:T([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},r?.headers])},this._client))}retrieve(e,t,r){let{skill_id:o,betas:n}=t;return this._client.get(M`/v1/skills/${o}/versions/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},r?.headers])})}list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(M`/v1/skills/${e}/versions?beta=true`,ye,{query:n,...r,headers:T([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},r?.headers])})}delete(e,t,r){let{skill_id:o,betas:n}=t;return this._client.delete(M`/v1/skills/${o}/versions/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},r?.headers])})}}class pi extends J{constructor(){super(...arguments);this.versions=new Ia(this._client)}create(e={},t){let{betas:r,...o}=e??{};return this._client.post("/v1/skills?beta=true",ii({body:o,...t,headers:T([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},t?.headers])},this._client,!1))}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/skills/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/skills?beta=true",ye,{query:o,...t,headers:T([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(M`/v1/skills/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},r?.headers])})}}pi.Versions=Ia;class Ra extends J{create(e,t,r){let{betas:o,...n}=t;return this._client.post(M`/v1/vaults/${e}/credentials?beta=true`,{body:n,...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}retrieve(e,t,r){let{vault_id:o,betas:n}=t;return this._client.get(M`/v1/vaults/${o}/credentials/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{vault_id:o,betas:n,...i}=t;return this._client.post(M`/v1/vaults/${o}/credentials/${e}?beta=true`,{body:i,...r,headers:T([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(M`/v1/vaults/${e}/credentials?beta=true`,ye,{query:n,...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}delete(e,t,r){let{vault_id:o,betas:n}=t;return this._client.delete(M`/v1/vaults/${o}/credentials/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}archive(e,t,r){let{vault_id:o,betas:n}=t;return this._client.post(M`/v1/vaults/${o}/credentials/${e}/archive?beta=true`,{...r,headers:T([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}class fi extends J{constructor(){super(...arguments);this.credentials=new Ra(this._client)}create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/vaults?beta=true",{body:o,...t,headers:T([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/vaults/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{betas:o,...n}=t;return this._client.post(M`/v1/vaults/${e}?beta=true`,{body:n,...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/vaults?beta=true",ye,{query:o,...t,headers:T([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(M`/v1/vaults/${e}?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}archive(e,t={},r){let{betas:o}=t??{};return this._client.post(M`/v1/vaults/${e}/archive?beta=true`,{...r,headers:T([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}fi.Credentials=Ra;class st extends J{constructor(){super(...arguments);this.models=new ua(this._client),this.messages=new yn(this._client),this.agents=new si(this._client),this.environments=new aa(this._client),this.sessions=new co(this._client),this.vaults=new fi(this._client),this.memoryStores=new io(this._client),this.files=new la(this._client),this.skills=new pi(this._client),this.userProfiles=new da(this._client)}}st.Models=ua;st.Messages=yn;st.Agents=si;st.Environments=aa;st.Sessions=co;st.Vaults=fi;st.MemoryStores=io;st.Files=la;st.Skills=pi;st.UserProfiles=da;class mi extends J{create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/complete",{body:o,timeout:this._client._options.timeout??600000,...t,headers:T([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},t?.headers]),stream:e.stream??!1})}}function Dk(e){return e?.output_config?.format}function Qg(e,t,r){let o=Dk(t);if(!t||!("parse"in(o??{})))return{...e,content:e.content.map((n)=>{if(n.type==="text")return Object.defineProperty({...n},"parsed_output",{value:null,enumerable:!1});return n}),parsed_output:null};return eh(e,t,r)}function eh(e,t,r){let o=null,n=e.content.map((i)=>{if(i.type==="text"){let s=L1(t,i.text);if(o===null)o=s;return Object.defineProperty({...i},"parsed_output",{value:s,enumerable:!1})}return i});return{...e,content:n,parsed_output:o}}function L1(e,t){let r=Dk(e);if(r?.type!=="json_schema")return null;try{if("parse"in r)return r.parse(t);return JSON.parse(t)}catch(o){throw new z(`Failed to parse structured output: ${o}`)}}var Wt,bn,gi,$a,qu,Oa,Aa,Zu,Ca,Ur,Ma,Vu,Wu,lo,Ku,Gu,Na,th,jk,rh,nh,oh,ih,zk,Uk="__json_buf";function Lk(e){return e.type==="tool_use"||e.type==="server_tool_use"}class Da{constructor(e,t){Wt.add(this),this.messages=[],this.receivedMessages=[],bn.set(this,void 0),gi.set(this,null),this.controller=new AbortController,$a.set(this,void 0),qu.set(this,()=>{}),Oa.set(this,()=>{}),Aa.set(this,void 0),Zu.set(this,()=>{}),Ca.set(this,()=>{}),Ur.set(this,{}),Ma.set(this,!1),Vu.set(this,!1),Wu.set(this,!1),lo.set(this,!1),Ku.set(this,void 0),Gu.set(this,void 0),Na.set(this,void 0),rh.set(this,(r)=>{if(D(this,Vu,!0,"f"),Nr(r))r=new tt;if(r instanceof tt)return D(this,Wu,!0,"f"),this._emit("abort",r);if(r instanceof z)return this._emit("error",r);if(r instanceof Error){let o=new z(r.message);return o.cause=r,this._emit("error",o)}return this._emit("error",new z(String(r)))}),D(this,$a,new Promise((r,o)=>{D(this,qu,r,"f"),D(this,Oa,o,"f")}),"f"),D(this,Aa,new Promise((r,o)=>{D(this,Zu,r,"f"),D(this,Ca,o,"f")}),"f"),_(this,$a,"f").catch(()=>{}),_(this,Aa,"f").catch(()=>{}),D(this,gi,e,"f"),D(this,Na,t?.logger??console,"f")}get response(){return _(this,Ku,"f")}get request_id(){return _(this,Gu,"f")}async withResponse(){D(this,lo,!0,"f");let e=await _(this,$a,"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 Da(null);return t._run(()=>t._fromReadableStream(e)),t}static createMessage(e,t,r,{logger:o}={}){let n=new Da(t,{logger:o});for(let i of t.messages)n._addMessageParam(i);return D(n,gi,{...t,stream:!0},"f"),n._run(()=>n._createMessage(e,{...t,stream:!0},{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"stream"}})),n}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},_(this,rh,"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,r){let o=r?.signal,n;if(o){if(o.aborted)this.controller.abort();n=this.controller.abort.bind(this.controller),o.addEventListener("abort",n)}try{_(this,Wt,"m",nh).call(this);let{response:i,data:s}=await e.create({...t,stream:!0},{...r,signal:this.controller.signal}).withResponse();this._connected(i);for await(let a of s)_(this,Wt,"m",oh).call(this,a);if(s.controller.signal?.aborted)throw new tt;_(this,Wt,"m",ih).call(this)}finally{if(o&&n)o.removeEventListener("abort",n)}}_connected(e){if(this.ended)return;D(this,Ku,e,"f"),D(this,Gu,e?.headers.get("request-id"),"f"),_(this,qu,"f").call(this,e),this._emit("connect")}get ended(){return _(this,Ma,"f")}get errored(){return _(this,Vu,"f")}get aborted(){return _(this,Wu,"f")}abort(){this.controller.abort()}on(e,t){return(_(this,Ur,"f")[e]||(_(this,Ur,"f")[e]=[])).push({listener:t}),this}off(e,t){let r=_(this,Ur,"f")[e];if(!r)return this;let o=r.findIndex((n)=>n.listener===t);if(o>=0)r.splice(o,1);return this}once(e,t){return(_(this,Ur,"f")[e]||(_(this,Ur,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,r)=>{if(D(this,lo,!0,"f"),e!=="error")this.once("error",r);this.once(e,t)})}async done(){D(this,lo,!0,"f"),await _(this,Aa,"f")}get currentMessage(){return _(this,bn,"f")}async finalMessage(){return await this.done(),_(this,Wt,"m",th).call(this)}async finalText(){return await this.done(),_(this,Wt,"m",jk).call(this)}_emit(e,...t){if(_(this,Ma,"f"))return;if(e==="end")D(this,Ma,!0,"f"),_(this,Zu,"f").call(this);let r=_(this,Ur,"f")[e];if(r)_(this,Ur,"f")[e]=r.filter((o)=>!o.once),r.forEach(({listener:o})=>o(...t));if(e==="abort"){let o=t[0];if(!_(this,lo,"f")&&!r?.length)Promise.reject(o);_(this,Oa,"f").call(this,o),_(this,Ca,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=t[0];if(!_(this,lo,"f")&&!r?.length)Promise.reject(o);_(this,Oa,"f").call(this,o),_(this,Ca,"f").call(this,o),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",_(this,Wt,"m",th).call(this))}async _fromReadableStream(e,t){let r=t?.signal,o;if(r){if(r.aborted)this.controller.abort();o=this.controller.abort.bind(this.controller),r.addEventListener("abort",o)}try{_(this,Wt,"m",nh).call(this),this._connected(null);let n=Nt.fromReadableStream(e,this.controller);for await(let i of n)_(this,Wt,"m",oh).call(this,i);if(n.controller.signal?.aborted)throw new tt;_(this,Wt,"m",ih).call(this)}finally{if(r&&o)r.removeEventListener("abort",o)}}[(bn=new WeakMap,gi=new WeakMap,$a=new WeakMap,qu=new WeakMap,Oa=new WeakMap,Aa=new WeakMap,Zu=new WeakMap,Ca=new WeakMap,Ur=new WeakMap,Ma=new WeakMap,Vu=new WeakMap,Wu=new WeakMap,lo=new WeakMap,Ku=new WeakMap,Gu=new WeakMap,Na=new WeakMap,rh=new WeakMap,Wt=new WeakSet,th=function(){if(this.receivedMessages.length===0)throw new z("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},jk=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((r)=>r.type==="text").map((r)=>r.text);if(t.length===0)throw new z("stream ended without producing a content block with type=text");return t.join(" ")},nh=function(){if(this.ended)return;D(this,bn,void 0,"f")},oh=function(t){if(this.ended)return;let r=_(this,Wt,"m",zk).call(this,t);switch(this._emit("streamEvent",t,r),t.type){case"content_block_delta":{let o=r.content.at(-1);switch(t.delta.type){case"text_delta":{if(o.type==="text")this._emit("text",t.delta.text,o.text||"");break}case"citations_delta":{if(o.type==="text")this._emit("citation",t.delta.citation,o.citations??[]);break}case"input_json_delta":{if(Lk(o)&&o.input)this._emit("inputJson",t.delta.partial_json,o.input);break}case"thinking_delta":{if(o.type==="thinking")this._emit("thinking",t.delta.thinking,o.thinking);break}case"signature_delta":{if(o.type==="thinking")this._emit("signature",o.signature);break}default:Fk(t.delta)}break}case"message_stop":{this._addMessageParam(r),this._addMessage(Qg(r,_(this,gi,"f"),{logger:_(this,Na,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",r.content.at(-1));break}case"message_start":{D(this,bn,r,"f");break}case"content_block_start":case"message_delta":break}},ih=function(){if(this.ended)throw new z("stream has ended, this shouldn't happen");let t=_(this,bn,"f");if(!t)throw new z("request ended without sending any chunks");return D(this,bn,void 0,"f"),Qg(t,_(this,gi,"f"),{logger:_(this,Na,"f")})},zk=function(t){let r=_(this,bn,"f");if(t.type==="message_start"){if(r)throw new z(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!r)throw new z(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return r;case"message_delta":if(r.stop_reason=t.delta.stop_reason,r.stop_sequence=t.delta.stop_sequence,r.usage.output_tokens=t.usage.output_tokens,t.usage.input_tokens!=null)r.usage.input_tokens=t.usage.input_tokens;if(t.usage.cache_creation_input_tokens!=null)r.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens;if(t.usage.cache_read_input_tokens!=null)r.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens;if(t.usage.server_tool_use!=null)r.usage.server_tool_use=t.usage.server_tool_use;return r;case"content_block_start":return r.content.push({...t.content_block}),r;case"content_block_delta":{let o=r.content.at(t.index);switch(t.delta.type){case"text_delta":{if(o?.type==="text")r.content[t.index]={...o,text:(o.text||"")+t.delta.text};break}case"citations_delta":{if(o?.type==="text")r.content[t.index]={...o,citations:[...o.citations??[],t.delta.citation]};break}case"input_json_delta":{if(o&&Lk(o)){let n=o[Uk]||"";n+=t.delta.partial_json;let i={...o};if(Object.defineProperty(i,Uk,{value:n,enumerable:!1,writable:!0}),n)i.input=Du(n);r.content[t.index]=i}break}case"thinking_delta":{if(o?.type==="thinking")r.content[t.index]={...o,thinking:o.thinking+t.delta.thinking};break}case"signature_delta":{if(o?.type==="thinking")r.content[t.index]={...o,signature:t.delta.signature};break}default:Fk(t.delta)}return r}case"content_block_stop":return r}},Symbol.asyncIterator)](){let e=[],t=[],r=!1;return this.on("streamEvent",(o)=>{let n=t.shift();if(n)n.resolve(o);else e.push(o)}),this.on("end",()=>{r=!0;for(let o of t)o.resolve(void 0);t.length=0}),this.on("abort",(o)=>{r=!0;for(let n of t)n.reject(o);t.length=0}),this.on("error",(o)=>{r=!0;for(let n of t)n.reject(o);t.length=0}),{next:async()=>{if(!e.length){if(r)return{value:void 0,done:!0};return new Promise((n,i)=>t.push({resolve:n,reject:i})).then((n)=>n?{value:n,done:!1}:{value:void 0,done:!0})}return{value:e.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new Nt(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function Fk(e){}class ja extends J{create(e,t){return this._client.post("/v1/messages/batches",{body:e,...t})}retrieve(e,t){return this._client.get(M`/v1/messages/batches/${e}`,t)}list(e={},t){return this._client.getAPIList("/v1/messages/batches",sr,{query:e,...t})}delete(e,t){return this._client.delete(M`/v1/messages/batches/${e}`,t)}cancel(e,t){return this._client.post(M`/v1/messages/batches/${e}/cancel`,t)}async results(e,t){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}`);return this._client.get(r.results_url,{...t,headers:T([{Accept:"application/binary"},t?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((o,n)=>ai.fromResponse(n.response,n.controller))}}class uo extends J{constructor(){super(...arguments);this.batches=new ja(this._client)}create(e,t){if(e.model in Hk)console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${Hk[e.model]}
48
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(H1.includes(e.model)&&e.thinking&&e.thinking.type==="enabled")console.warn(`Using Claude with ${e.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 r=this._client._options.timeout;if(!e.stream&&r==null){let n=Nu[e.model]??void 0;r=this._client.calculateNonstreamingTimeout(e.max_tokens,n)}let o=Mu(e.tools,e.messages);return this._client.post("/v1/messages",{body:e,timeout:r??600000,...t,headers:T([o,t?.headers]),stream:e.stream??!1})}parse(e,t){return this.create(e,t).then((r)=>eh(r,e,{logger:this._client.logger??console}))}stream(e,t){return Da.createMessage(this,e,t,{logger:this._client.logger??console})}countTokens(e,t){return this._client.post("/v1/messages/count_tokens",{body:e,...t})}}var Hk={"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"},H1=["claude-mythos-preview","claude-opus-4-6"];uo.Batches=ja;class hi extends J{retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/models/${e}`,{...r,headers:T([{...o?.toString()!=null?{"anthropic-beta":o?.toString()}:void 0},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/models",sr,{query:o,...t,headers:T([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},t?.headers])})}}var sh,ah,Ju,Bk,qk="\\n\\nHuman:",Zk="\\n\\nAssistant:";class je{get credentials(){return this._authState.provider}constructor({baseURL:e=ge("ANTHROPIC_BASE_URL"),apiKey:t,authToken:r,...o}={}){if(sh.add(this),this._requestAuthFlags=new WeakMap,Ju.set(this,void 0),t===void 0)t=o.profile!=null?null:ge("ANTHROPIC_API_KEY")??null;if(r===void 0)r=o.profile!=null?null:ge("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 n={apiKey:t,authToken:r,...o,baseURL:e||"https://api.anthropic.com"};if(!n.dangerouslyAllowBrowser&&Ww())throw new z(`It looks like you're running in a browser-like environment.
46
+ Wrap your summary in <summary></summary> tags.`;var wa,di,lo,Ke,vt,Dt,zr,bn,ka,Mk,Qg;function Nk(){let e,t;return{promise:new Promise((o,n)=>{e=o,t=n}),resolve:e,reject:t}}class Ea{constructor(e,t,r){wa.add(this),this.client=e,di.set(this,!1),lo.set(this,!1),Ke.set(this,void 0),vt.set(this,void 0),Dt.set(this,void 0),zr.set(this,void 0),bn.set(this,void 0),ka.set(this,0),D(this,Ke,{params:{...t,messages:structuredClone(t.messages)}},"f");let n=["BetaToolRunner",...Vg(t.tools,t.messages)].join(", ");if(D(this,vt,{...r,headers:E([{"x-stainless-helper":n},r?.headers])},"f"),D(this,bn,Nk(),"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*[(di=new WeakMap,lo=new WeakMap,Ke=new WeakMap,vt=new WeakMap,Dt=new WeakMap,zr=new WeakMap,bn=new WeakMap,ka=new WeakMap,wa=new WeakSet,Mk=async function(){let t=_(this,Ke,"f").params.compactionControl;if(!t||!t.enabled)return!1;let r=0;if(_(this,Dt,"f")!==void 0)try{let c=await _(this,Dt,"f");r=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 o=t.contextTokenThreshold??Ak;if(r<o)return!1;let n=t.model??_(this,Ke,"f").params.model,i=t.summaryPrompt??Ck,s=_(this,Ke,"f").params.messages;if(s[s.length-1].role==="assistant"){let c=s[s.length-1];if(Array.isArray(c.content)){let u=c.content.filter((d)=>d.type!=="tool_use");if(u.length===0)s.pop();else c.content=u}}let a=await this.client.beta.messages.create({model:n,messages:[...s,{role:"user",content:[{type:"text",text:i}]}],max_tokens:_(this,Ke,"f").params.max_tokens},{signal:_(this,vt,"f").signal,headers:E([_(this,vt,"f").headers,{"x-stainless-helper":"compaction"}])});if(a.content[0]?.type!=="text")throw new z("Expected text response for compaction");return _(this,Ke,"f").params.messages=[{role:"user",content:a.content}],!0},Symbol.asyncIterator)](){var e;if(_(this,di,"f"))throw new z("Cannot iterate over a consumed stream");D(this,di,!0,"f"),D(this,lo,!0,"f"),D(this,zr,void 0,"f");try{while(!0){let t;try{if(_(this,Ke,"f").params.max_iterations&&_(this,ka,"f")>=_(this,Ke,"f").params.max_iterations)break;D(this,lo,!1,"f"),D(this,zr,void 0,"f"),D(this,ka,(e=_(this,ka,"f"),e++,e),"f"),D(this,Dt,void 0,"f");let{max_iterations:r,compactionControl:o,...n}=_(this,Ke,"f").params;if(n.stream)t=this.client.beta.messages.stream({...n},_(this,vt,"f")),D(this,Dt,t.finalMessage(),"f"),_(this,Dt,"f").catch(()=>{}),yield t;else D(this,Dt,this.client.beta.messages.create({...n,stream:!1},_(this,vt,"f")),"f"),yield _(this,Dt,"f");if(!await _(this,wa,"m",Mk).call(this)){if(!_(this,lo,"f")){let{role:a,content:c}=await _(this,Dt,"f");_(this,Ke,"f").params.messages.push({role:a,content:c})}let s=await _(this,wa,"m",Qg).call(this,_(this,Ke,"f").params.messages.at(-1));if(s)_(this,Ke,"f").params.messages.push(s);else if(!_(this,lo,"f"))break}}finally{if(t)t.abort()}}if(!_(this,Dt,"f"))throw new z("ToolRunner concluded without a message from the server");_(this,bn,"f").resolve(await _(this,Dt,"f"))}catch(t){throw D(this,di,!1,"f"),_(this,bn,"f").promise.catch(()=>{}),_(this,bn,"f").reject(t),D(this,bn,Nk(),"f"),t}}setMessagesParams(e){if(typeof e==="function")_(this,Ke,"f").params=e(_(this,Ke,"f").params);else _(this,Ke,"f").params=e;D(this,lo,!0,"f"),D(this,zr,void 0,"f")}setRequestOptions(e){if(typeof e==="function")D(this,vt,e(_(this,vt,"f")),"f");else D(this,vt,{..._(this,vt,"f"),...e},"f")}async generateToolResponse(e=_(this,vt,"f").signal){let t=await _(this,Dt,"f")??this.params.messages.at(-1);if(!t)return null;return _(this,wa,"m",Qg).call(this,t,e)}done(){return _(this,bn,"f").promise}async runUntilDone(){if(!_(this,di,"f"))for await(let e of this);return this.done()}get params(){return _(this,Ke,"f").params}pushMessages(...e){this.setMessagesParams((t)=>({...t,messages:[...t.messages,...e]}))}then(e,t){return this.runUntilDone().then(e,t)}}Qg=async function(t,r=_(this,vt,"f").signal){if(_(this,zr,"f")!==void 0)return _(this,zr,"f");return D(this,zr,j1(_(this,Ke,"f").params,t,{..._(this,vt,"f"),signal:r}),"f"),_(this,zr,"f")};async function j1(e,t=e.messages.at(-1),r){if(!t||t.role!=="assistant"||!t.content||typeof t.content==="string")return null;let o=t.content.filter((i)=>i.type==="tool_use");if(o.length===0)return null;return{role:"user",content:await Promise.all(o.map(async(i)=>{let s=e.tools.find((a)=>("name"in a?a.name:a.mcp_server_name)===i.name);if(!s||!("run"in s))return{type:"tool_result",tool_use_id:i.id,content:`Error: Tool '${i.name}' not found`,is_error:!0};try{let a=i.input;if("parse"in s&&s.parse)a=s.parse(a);let c=await s.run(a,{toolUseBlock:i,signal:r?.signal});return{type:"tool_result",tool_use_id:i.id,content:c}}catch(a){return{type:"tool_result",tool_use_id:i.id,content:a instanceof ui?a.content:`Error: ${a instanceof Error?a.message:String(a)}`,is_error:!0}}}))}}var Dk={"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"},z1=["claude-mythos-preview","claude-opus-4-6"];class _n extends J{constructor(){super(...arguments);this.batches=new ga(this._client)}create(e,t){let r=jk(e),{betas:o,...n}=r;if(n.model in Dk)console.warn(`The model '${n.model}' is deprecated and will reach end-of-life on ${Dk[n.model]}
47
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(z1.includes(n.model)&&n.thinking&&n.thinking.type==="enabled")console.warn(`Using Claude with ${n.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(!n.stream&&i==null){let a=Du[n.model]??void 0;i=this._client.calculateNonstreamingTimeout(n.max_tokens,a)}let s=Nu(n.tools,n.messages);return this._client.post("/v1/messages?beta=true",{body:n,timeout:i??600000,...t,headers:E([{...o?.toString()!=null?{"anthropic-beta":o?.toString()}:void 0},s,t?.headers]),stream:r.stream??!1})}parse(e,t){return t={...t,headers:E([{"anthropic-beta":[...e.betas??[],"structured-outputs-2025-12-15"].toString()},t?.headers])},this.create(e,t).then((r)=>Kg(r,e,{logger:this._client.logger??console}))}stream(e,t){return xa.createMessage(this,e,t)}countTokens(e,t){let r=jk(e),{betas:o,...n}=r;return this._client.post("/v1/messages/count_tokens?beta=true",{body:n,...t,headers:E([{"anthropic-beta":[...o??[],"token-counting-2024-11-01"].toString()},t?.headers])})}toolRunner(e,t){return new Ea(this._client,e,t)}}function jk(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,...r}=e;return{...r,output_config:{...e.output_config,format:t}}}_n.Batches=ga;_n.BetaToolRunner=Ea;_n.ToolError=ui;class Ta extends J{list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(M`/v1/sessions/${e}/events?beta=true`,ye,{query:n,...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}send(e,t,r){let{betas:o,...n}=t;return this._client.post(M`/v1/sessions/${e}/events?beta=true`,{body:n,...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}stream(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/sessions/${e}/events/stream?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers]),stream:!0})}}class Pa extends J{retrieve(e,t,r){let{session_id:o,betas:n}=t;return this._client.get(M`/v1/sessions/${o}/resources/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{session_id:o,betas:n,...i}=t;return this._client.post(M`/v1/sessions/${o}/resources/${e}?beta=true`,{body:i,...r,headers:E([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(M`/v1/sessions/${e}/resources?beta=true`,ye,{query:n,...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}delete(e,t,r){let{session_id:o,betas:n}=t;return this._client.delete(M`/v1/sessions/${o}/resources/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}add(e,t,r){let{betas:o,...n}=t;return this._client.post(M`/v1/sessions/${e}/resources?beta=true`,{body:n,...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}class uo extends J{constructor(){super(...arguments);this.events=new Ta(this._client),this.resources=new Pa(this._client)}create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/sessions?beta=true",{body:o,...t,headers:E([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/sessions/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{betas:o,...n}=t;return this._client.post(M`/v1/sessions/${e}?beta=true`,{body:n,...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/sessions?beta=true",ye,{query:o,...t,headers:E([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(M`/v1/sessions/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}archive(e,t={},r){let{betas:o}=t??{};return this._client.post(M`/v1/sessions/${e}/archive?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}uo.Events=Ta;uo.Resources=Pa;class Ia extends J{create(e,t={},r){let{betas:o,...n}=t??{};return this._client.post(M`/v1/skills/${e}/versions?beta=true`,ii({body:n,...r,headers:E([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},r?.headers])},this._client))}retrieve(e,t,r){let{skill_id:o,betas:n}=t;return this._client.get(M`/v1/skills/${o}/versions/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},r?.headers])})}list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(M`/v1/skills/${e}/versions?beta=true`,ye,{query:n,...r,headers:E([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},r?.headers])})}delete(e,t,r){let{skill_id:o,betas:n}=t;return this._client.delete(M`/v1/skills/${o}/versions/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},r?.headers])})}}class pi extends J{constructor(){super(...arguments);this.versions=new Ia(this._client)}create(e={},t){let{betas:r,...o}=e??{};return this._client.post("/v1/skills?beta=true",ii({body:o,...t,headers:E([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},t?.headers])},this._client,!1))}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/skills/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/skills?beta=true",ye,{query:o,...t,headers:E([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(M`/v1/skills/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},r?.headers])})}}pi.Versions=Ia;class Ra extends J{create(e,t,r){let{betas:o,...n}=t;return this._client.post(M`/v1/vaults/${e}/credentials?beta=true`,{body:n,...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}retrieve(e,t,r){let{vault_id:o,betas:n}=t;return this._client.get(M`/v1/vaults/${o}/credentials/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{vault_id:o,betas:n,...i}=t;return this._client.post(M`/v1/vaults/${o}/credentials/${e}?beta=true`,{body:i,...r,headers:E([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e,t={},r){let{betas:o,...n}=t??{};return this._client.getAPIList(M`/v1/vaults/${e}/credentials?beta=true`,ye,{query:n,...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}delete(e,t,r){let{vault_id:o,betas:n}=t;return this._client.delete(M`/v1/vaults/${o}/credentials/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}archive(e,t,r){let{vault_id:o,betas:n}=t;return this._client.post(M`/v1/vaults/${o}/credentials/${e}/archive?beta=true`,{...r,headers:E([{"anthropic-beta":[...n??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}class fi extends J{constructor(){super(...arguments);this.credentials=new Ra(this._client)}create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/vaults?beta=true",{body:o,...t,headers:E([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/vaults/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}update(e,t,r){let{betas:o,...n}=t;return this._client.post(M`/v1/vaults/${e}?beta=true`,{body:n,...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/vaults?beta=true",ye,{query:o,...t,headers:E([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},t?.headers])})}delete(e,t={},r){let{betas:o}=t??{};return this._client.delete(M`/v1/vaults/${e}?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}archive(e,t={},r){let{betas:o}=t??{};return this._client.post(M`/v1/vaults/${e}/archive?beta=true`,{...r,headers:E([{"anthropic-beta":[...o??[],"managed-agents-2026-04-01"].toString()},r?.headers])})}}fi.Credentials=Ra;class st extends J{constructor(){super(...arguments);this.models=new ua(this._client),this.messages=new _n(this._client),this.agents=new si(this._client),this.environments=new aa(this._client),this.sessions=new uo(this._client),this.vaults=new fi(this._client),this.memoryStores=new ao(this._client),this.files=new la(this._client),this.skills=new pi(this._client),this.userProfiles=new da(this._client)}}st.Models=ua;st.Messages=_n;st.Agents=si;st.Environments=aa;st.Sessions=uo;st.Vaults=fi;st.MemoryStores=ao;st.Files=la;st.Skills=pi;st.UserProfiles=da;class mi extends J{create(e,t){let{betas:r,...o}=e;return this._client.post("/v1/complete",{body:o,timeout:this._client._options.timeout??600000,...t,headers:E([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},t?.headers]),stream:e.stream??!1})}}function zk(e){return e?.output_config?.format}function eh(e,t,r){let o=zk(t);if(!t||!("parse"in(o??{})))return{...e,content:e.content.map((n)=>{if(n.type==="text")return Object.defineProperty({...n},"parsed_output",{value:null,enumerable:!1});return n}),parsed_output:null};return th(e,t,r)}function th(e,t,r){let o=null,n=e.content.map((i)=>{if(i.type==="text"){let s=W1(t,i.text);if(o===null)o=s;return Object.defineProperty({...i},"parsed_output",{value:s,enumerable:!1})}return i});return{...e,content:n,parsed_output:o}}function W1(e,t){let r=zk(e);if(r?.type!=="json_schema")return null;try{if("parse"in r)return r.parse(t);return JSON.parse(t)}catch(o){throw new z(`Failed to parse structured output: ${o}`)}}var Wt,vn,gi,$a,Zu,Oa,Aa,Vu,Ca,Ur,Ma,Wu,Ku,po,Gu,Ju,Na,rh,Uk,nh,oh,ih,sh,Lk,Fk="__json_buf";function Hk(e){return e.type==="tool_use"||e.type==="server_tool_use"}class Da{constructor(e,t){Wt.add(this),this.messages=[],this.receivedMessages=[],vn.set(this,void 0),gi.set(this,null),this.controller=new AbortController,$a.set(this,void 0),Zu.set(this,()=>{}),Oa.set(this,()=>{}),Aa.set(this,void 0),Vu.set(this,()=>{}),Ca.set(this,()=>{}),Ur.set(this,{}),Ma.set(this,!1),Wu.set(this,!1),Ku.set(this,!1),po.set(this,!1),Gu.set(this,void 0),Ju.set(this,void 0),Na.set(this,void 0),nh.set(this,(r)=>{if(D(this,Wu,!0,"f"),Nr(r))r=new tt;if(r instanceof tt)return D(this,Ku,!0,"f"),this._emit("abort",r);if(r instanceof z)return this._emit("error",r);if(r instanceof Error){let o=new z(r.message);return o.cause=r,this._emit("error",o)}return this._emit("error",new z(String(r)))}),D(this,$a,new Promise((r,o)=>{D(this,Zu,r,"f"),D(this,Oa,o,"f")}),"f"),D(this,Aa,new Promise((r,o)=>{D(this,Vu,r,"f"),D(this,Ca,o,"f")}),"f"),_(this,$a,"f").catch(()=>{}),_(this,Aa,"f").catch(()=>{}),D(this,gi,e,"f"),D(this,Na,t?.logger??console,"f")}get response(){return _(this,Gu,"f")}get request_id(){return _(this,Ju,"f")}async withResponse(){D(this,po,!0,"f");let e=await _(this,$a,"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 Da(null);return t._run(()=>t._fromReadableStream(e)),t}static createMessage(e,t,r,{logger:o}={}){let n=new Da(t,{logger:o});for(let i of t.messages)n._addMessageParam(i);return D(n,gi,{...t,stream:!0},"f"),n._run(()=>n._createMessage(e,{...t,stream:!0},{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"stream"}})),n}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},_(this,nh,"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,r){let o=r?.signal,n;if(o){if(o.aborted)this.controller.abort();n=this.controller.abort.bind(this.controller),o.addEventListener("abort",n)}try{_(this,Wt,"m",oh).call(this);let{response:i,data:s}=await e.create({...t,stream:!0},{...r,signal:this.controller.signal}).withResponse();this._connected(i);for await(let a of s)_(this,Wt,"m",ih).call(this,a);if(s.controller.signal?.aborted)throw new tt;_(this,Wt,"m",sh).call(this)}finally{if(o&&n)o.removeEventListener("abort",n)}}_connected(e){if(this.ended)return;D(this,Gu,e,"f"),D(this,Ju,e?.headers.get("request-id"),"f"),_(this,Zu,"f").call(this,e),this._emit("connect")}get ended(){return _(this,Ma,"f")}get errored(){return _(this,Wu,"f")}get aborted(){return _(this,Ku,"f")}abort(){this.controller.abort()}on(e,t){return(_(this,Ur,"f")[e]||(_(this,Ur,"f")[e]=[])).push({listener:t}),this}off(e,t){let r=_(this,Ur,"f")[e];if(!r)return this;let o=r.findIndex((n)=>n.listener===t);if(o>=0)r.splice(o,1);return this}once(e,t){return(_(this,Ur,"f")[e]||(_(this,Ur,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,r)=>{if(D(this,po,!0,"f"),e!=="error")this.once("error",r);this.once(e,t)})}async done(){D(this,po,!0,"f"),await _(this,Aa,"f")}get currentMessage(){return _(this,vn,"f")}async finalMessage(){return await this.done(),_(this,Wt,"m",rh).call(this)}async finalText(){return await this.done(),_(this,Wt,"m",Uk).call(this)}_emit(e,...t){if(_(this,Ma,"f"))return;if(e==="end")D(this,Ma,!0,"f"),_(this,Vu,"f").call(this);let r=_(this,Ur,"f")[e];if(r)_(this,Ur,"f")[e]=r.filter((o)=>!o.once),r.forEach(({listener:o})=>o(...t));if(e==="abort"){let o=t[0];if(!_(this,po,"f")&&!r?.length)Promise.reject(o);_(this,Oa,"f").call(this,o),_(this,Ca,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=t[0];if(!_(this,po,"f")&&!r?.length)Promise.reject(o);_(this,Oa,"f").call(this,o),_(this,Ca,"f").call(this,o),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",_(this,Wt,"m",rh).call(this))}async _fromReadableStream(e,t){let r=t?.signal,o;if(r){if(r.aborted)this.controller.abort();o=this.controller.abort.bind(this.controller),r.addEventListener("abort",o)}try{_(this,Wt,"m",oh).call(this),this._connected(null);let n=Nt.fromReadableStream(e,this.controller);for await(let i of n)_(this,Wt,"m",ih).call(this,i);if(n.controller.signal?.aborted)throw new tt;_(this,Wt,"m",sh).call(this)}finally{if(r&&o)r.removeEventListener("abort",o)}}[(vn=new WeakMap,gi=new WeakMap,$a=new WeakMap,Zu=new WeakMap,Oa=new WeakMap,Aa=new WeakMap,Vu=new WeakMap,Ca=new WeakMap,Ur=new WeakMap,Ma=new WeakMap,Wu=new WeakMap,Ku=new WeakMap,po=new WeakMap,Gu=new WeakMap,Ju=new WeakMap,Na=new WeakMap,nh=new WeakMap,Wt=new WeakSet,rh=function(){if(this.receivedMessages.length===0)throw new z("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Uk=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((r)=>r.type==="text").map((r)=>r.text);if(t.length===0)throw new z("stream ended without producing a content block with type=text");return t.join(" ")},oh=function(){if(this.ended)return;D(this,vn,void 0,"f")},ih=function(t){if(this.ended)return;let r=_(this,Wt,"m",Lk).call(this,t);switch(this._emit("streamEvent",t,r),t.type){case"content_block_delta":{let o=r.content.at(-1);switch(t.delta.type){case"text_delta":{if(o.type==="text")this._emit("text",t.delta.text,o.text||"");break}case"citations_delta":{if(o.type==="text")this._emit("citation",t.delta.citation,o.citations??[]);break}case"input_json_delta":{if(Hk(o)&&o.input)this._emit("inputJson",t.delta.partial_json,o.input);break}case"thinking_delta":{if(o.type==="thinking")this._emit("thinking",t.delta.thinking,o.thinking);break}case"signature_delta":{if(o.type==="thinking")this._emit("signature",o.signature);break}default:Bk(t.delta)}break}case"message_stop":{this._addMessageParam(r),this._addMessage(eh(r,_(this,gi,"f"),{logger:_(this,Na,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",r.content.at(-1));break}case"message_start":{D(this,vn,r,"f");break}case"content_block_start":case"message_delta":break}},sh=function(){if(this.ended)throw new z("stream has ended, this shouldn't happen");let t=_(this,vn,"f");if(!t)throw new z("request ended without sending any chunks");return D(this,vn,void 0,"f"),eh(t,_(this,gi,"f"),{logger:_(this,Na,"f")})},Lk=function(t){let r=_(this,vn,"f");if(t.type==="message_start"){if(r)throw new z(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!r)throw new z(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return r;case"message_delta":if(r.stop_reason=t.delta.stop_reason,r.stop_sequence=t.delta.stop_sequence,r.usage.output_tokens=t.usage.output_tokens,t.usage.input_tokens!=null)r.usage.input_tokens=t.usage.input_tokens;if(t.usage.cache_creation_input_tokens!=null)r.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens;if(t.usage.cache_read_input_tokens!=null)r.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens;if(t.usage.server_tool_use!=null)r.usage.server_tool_use=t.usage.server_tool_use;return r;case"content_block_start":return r.content.push({...t.content_block}),r;case"content_block_delta":{let o=r.content.at(t.index);switch(t.delta.type){case"text_delta":{if(o?.type==="text")r.content[t.index]={...o,text:(o.text||"")+t.delta.text};break}case"citations_delta":{if(o?.type==="text")r.content[t.index]={...o,citations:[...o.citations??[],t.delta.citation]};break}case"input_json_delta":{if(o&&Hk(o)){let n=o[Fk]||"";n+=t.delta.partial_json;let i={...o};if(Object.defineProperty(i,Fk,{value:n,enumerable:!1,writable:!0}),n)i.input=ju(n);r.content[t.index]=i}break}case"thinking_delta":{if(o?.type==="thinking")r.content[t.index]={...o,thinking:o.thinking+t.delta.thinking};break}case"signature_delta":{if(o?.type==="thinking")r.content[t.index]={...o,signature:t.delta.signature};break}default:Bk(t.delta)}return r}case"content_block_stop":return r}},Symbol.asyncIterator)](){let e=[],t=[],r=!1;return this.on("streamEvent",(o)=>{let n=t.shift();if(n)n.resolve(o);else e.push(o)}),this.on("end",()=>{r=!0;for(let o of t)o.resolve(void 0);t.length=0}),this.on("abort",(o)=>{r=!0;for(let n of t)n.reject(o);t.length=0}),this.on("error",(o)=>{r=!0;for(let n of t)n.reject(o);t.length=0}),{next:async()=>{if(!e.length){if(r)return{value:void 0,done:!0};return new Promise((n,i)=>t.push({resolve:n,reject:i})).then((n)=>n?{value:n,done:!1}:{value:void 0,done:!0})}return{value:e.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new Nt(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function Bk(e){}class ja extends J{create(e,t){return this._client.post("/v1/messages/batches",{body:e,...t})}retrieve(e,t){return this._client.get(M`/v1/messages/batches/${e}`,t)}list(e={},t){return this._client.getAPIList("/v1/messages/batches",sr,{query:e,...t})}delete(e,t){return this._client.delete(M`/v1/messages/batches/${e}`,t)}cancel(e,t){return this._client.post(M`/v1/messages/batches/${e}/cancel`,t)}async results(e,t){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}`);return this._client.get(r.results_url,{...t,headers:E([{Accept:"application/binary"},t?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((o,n)=>ai.fromResponse(n.response,n.controller))}}class fo extends J{constructor(){super(...arguments);this.batches=new ja(this._client)}create(e,t){if(e.model in qk)console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${qk[e.model]}
48
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(G1.includes(e.model)&&e.thinking&&e.thinking.type==="enabled")console.warn(`Using Claude with ${e.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 r=this._client._options.timeout;if(!e.stream&&r==null){let n=Du[e.model]??void 0;r=this._client.calculateNonstreamingTimeout(e.max_tokens,n)}let o=Nu(e.tools,e.messages);return this._client.post("/v1/messages",{body:e,timeout:r??600000,...t,headers:E([o,t?.headers]),stream:e.stream??!1})}parse(e,t){return this.create(e,t).then((r)=>th(r,e,{logger:this._client.logger??console}))}stream(e,t){return Da.createMessage(this,e,t,{logger:this._client.logger??console})}countTokens(e,t){return this._client.post("/v1/messages/count_tokens",{body:e,...t})}}var qk={"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"},G1=["claude-mythos-preview","claude-opus-4-6"];fo.Batches=ja;class hi extends J{retrieve(e,t={},r){let{betas:o}=t??{};return this._client.get(M`/v1/models/${e}`,{...r,headers:E([{...o?.toString()!=null?{"anthropic-beta":o?.toString()}:void 0},r?.headers])})}list(e={},t){let{betas:r,...o}=e??{};return this._client.getAPIList("/v1/models",sr,{query:o,...t,headers:E([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},t?.headers])})}}var ah,ch,Xu,Zk,Vk="\\n\\nHuman:",Wk="\\n\\nAssistant:";class je{get credentials(){return this._authState.provider}constructor({baseURL:e=ge("ANTHROPIC_BASE_URL"),apiKey:t,authToken:r,...o}={}){if(ah.add(this),this._requestAuthFlags=new WeakMap,Xu.set(this,void 0),t===void 0)t=o.profile!=null?null:ge("ANTHROPIC_API_KEY")??null;if(r===void 0)r=o.profile!=null?null:ge("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 n={apiKey:t,authToken:r,...o,baseURL:e||"https://api.anthropic.com"};if(!n.dangerouslyAllowBrowser&&Gw())throw new z(`It looks like you're running in a browser-like environment.
49
49
 
50
50
  This is disabled by default, as it risks exposing your secret API credentials to attackers.
51
51
  If you understand the risks and have appropriate mitigations in place,
52
52
  you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
53
53
 
54
54
  new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
55
- `);this.baseURL=n.baseURL,this._baseURLIsExplicit=o.__baseURLIsExplicit??!!e,this.timeout=n.timeout??ah.DEFAULT_TIMEOUT,this.logger=n.logger??console;let i="warn";this.logLevel=i,this.logLevel=Ng(n.logLevel,"ClientOptions.logLevel",this)??Ng(ge("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??i,this.fetchOptions=n.fetchOptions,this.maxRetries=n.maxRetries??2,this.fetch=n.fetch??Kw(),D(this,Ju,Jw,"f");let s=ge("ANTHROPIC_CUSTOM_HEADERS");if(s){let c={};for(let u of s.split(`
56
- `)){let d=u.indexOf(":");if(d>=0)c[u.substring(0,d).trim()]=u.substring(d+1).trim()}n.defaultHeaders={...c,...n.defaultHeaders}}let a=o.__auth;if(delete n.__auth,delete n.__baseURLIsExplicit,this._options=n,this.apiKey=typeof t==="string"?t:null,this.authToken=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=n.credentials??null;if(c)this._authState.provider=c,this._authState.tokenCache=this._makeTokenCache(c);else if(n.config!=null){let u=zg(n.config,this._credentialResolverOptions());this._authState.provider=u.provider,this._authState.tokenCache=this._makeTokenCache(u.provider),this._authState.extraHeaders=u.extraHeaders,this._applyCredentialBaseURL(u.baseURL)}else if(n.profile!=null)this._authState.resolution=this._resolveDefaultCredentials(n.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.fetch,userAgent:this.getUserAgent(),onCacheWriteError:(e)=>{Le(this).debug("credential cache write failed (best-effort)",e)},onSafetyWarning:(e)=>{Le(this).warn(e)}}}_makeTokenCache(e){return new Cg(e,(t)=>{Le(this).debug("advisory token refresh failed; serving cached token",t)})}withOptions(e){let t="credentials"in e||"config"in e||"profile"in e,r="apiKey"in e||"authToken"in e||t,o={...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,apiKey:this.apiKey,authToken:this.authToken,credentials:this.credentials,...t?{credentials:void 0,config:void 0,profile:void 0}:{},...e,__auth:r?void 0:this._authState,__baseURLIsExplicit:"baseURL"in e?!0:this._baseURLIsExplicit};return new this.constructor(o)}async _resolveDefaultCredentials(e){try{let t=await gk(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,T([{Authorization:`Bearer ${t}`}])}return T([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey==null)return;return T([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken==null)return;return T([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return Xw(e)}getUserAgent(){return`${this.constructor.name}/JS ${Zt}`}defaultIdempotencyKey(){return`stainless-node-retry-${Pg()}`}makeStatusError(e,t,r,o){return We.generate(e,t,r,o)}buildURL(e,t,r){let o=!_(this,sh,"m",Bk).call(this)&&r||this.baseURL,n=Lw(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),i=this.defaultQuery(),s=Object.fromEntries(n.searchParams);if(!$g(i)||!$g(s))t={...s,...i,...t};if(typeof t==="object"&&t&&!Array.isArray(t))n.search=this.stringifyQuery(t);return n.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:r}){if(this._authState.tokenCache&&this.apiKey==null){let o=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[i,s]of Object.entries(this._authState.extraHeaders))if(!o.has(i))o.set(i,s);if(!o.get("anthropic-beta")?.split(",").map((i)=>i.trim())?.includes(ro))o.append("anthropic-beta",ro);e.headers=o}}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,r){return this.request(Promise.resolve(r).then((o)=>{return{method:e,path:t,...o}}))}request(e,t=null){return new no(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,r){let o=await e,n=o.maxRetries??this.maxRetries;if(t==null)t=n,this._requestAuthFlags.delete(o);await this.prepareOptions(o);let{req:i,url:s,timeout:a}=await this.buildRequest(o,{retryCount:n-t});await this.prepareRequest(i,{url:s,options:o});let c="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),u=r===void 0?"":`, retryOf: ${r}`,d=Date.now();if(Le(this).debug(`[${c}] sending request`,Dr({retryOfRequestLogID:r,method:o.method,url:s,options:o,headers:i.headers})),o.signal?.aborted)throw new tt;let p=new AbortController,f=await this.fetchWithTimeout(s,i,a,p).catch(Zs),m=Date.now();if(f instanceof globalThis.Error){let y=`retrying, ${t} attempts remaining`;if(o.signal?.aborted)throw new tt;let v=Nr(f)||/timed? ?out/i.test(String(f)+("cause"in f?String(f.cause):""));if(t)return Le(this).info(`[${c}] connection ${v?"timed out":"failed"} - ${y}`),Le(this).debug(`[${c}] connection ${v?"timed out":"failed"} (${y})`,Dr({retryOfRequestLogID:r,url:s,durationMs:m-d,message:f.message})),this.retryRequest(o,t,r??c);if(Le(this).info(`[${c}] connection ${v?"timed out":"failed"} - error; no more retries left`),Le(this).debug(`[${c}] connection ${v?"timed out":"failed"} (error; no more retries left)`,Dr({retryOfRequestLogID:r,url:s,durationMs:m-d,message:f.message})),v)throw new Vs;throw new to({cause:f})}let g=[...f.headers.entries()].filter(([y])=>y==="request-id").map(([y,v])=>", "+y+": "+JSON.stringify(v)).join(""),h=`[${c}${u}${g}] ${i.method} ${s} ${f.ok?"succeeded":"failed"} with status ${f.status} in ${m-d}ms`;if(!f.ok){let y=await this.shouldRetry(f,o);if(t&&y){let se=`retrying, ${t} attempts remaining`;return await Gw(f.body),Le(this).info(`${h} - ${se}`),Le(this).debug(`[${c}] response error (${se})`,Dr({retryOfRequestLogID:r,url:f.url,status:f.status,headers:f.headers,durationMs:m-d})),this.retryRequest(o,t,r??c,f.headers)}let v=y?"error; no more retries left":"error; not retryable";Le(this).info(`${h} - ${v}`);let x=await f.text().catch((se)=>Zs(se).message),w=_u(x),O=w?void 0:x;throw Le(this).debug(`[${c}] response error (${v})`,Dr({retryOfRequestLogID:r,url:f.url,status:f.status,headers:f.headers,message:O,durationMs:Date.now()-d})),this.makeStatusError(f.status,w,O,f.headers)}return Le(this).info(h),Le(this).debug(`[${c}] response start`,Dr({retryOfRequestLogID:r,url:f.url,status:f.status,headers:f.headers,durationMs:m-d})),{response:f,options:o,controller:p,requestLogID:c,retryOfRequestLogID:r,startTime:d}}getAPIList(e,t,r){return this.requestAPIList(t,r&&"then"in r?r.then((o)=>({method:"get",path:e,...o})):{method:"get",path:e,...r})}requestAPIList(e,t){let r=this.makeRequest(t,null,void 0);return new Ou(this,r,e)}async fetchWithTimeout(e,t,r,o){let{signal:n,method:i,...s}=t||{},a=this._makeAbort(o);if(n)n.addEventListener("abort",a,{once:!0});let c=setTimeout(a,r),u=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body==="object"&&s.body!==null&&Symbol.asyncIterator in s.body,d={signal:o.signal,...u?{duplex:"half"}:{},method:"GET",...s};if(i)d.method=i.toUpperCase();try{return await this.fetch.call(void 0,e,d)}finally{clearTimeout(c)}}async shouldRetry(e,t){let r=this._authFlags(t);if(e.status===401&&this._authState.tokenCache&&r.usedTokenCache&&!r.didRefreshFor401)return r.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let o=e.headers.get("x-should-retry");if(o==="true")return!0;if(o==="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,r,o){let n,i=o?.get("retry-after-ms");if(i){let a=parseFloat(i);if(!Number.isNaN(a))n=a}let s=o?.get("retry-after");if(s&&!n){let a=parseFloat(s);if(!Number.isNaN(a))n=a*1000;else n=Date.parse(s)-Date.now()}if(n===void 0){let a=e.maxRetries??this.maxRetries;n=this.calculateDefaultRetryTimeoutMillis(t,a)}return await Bw(n),this.makeRequest(e,t-1,r)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e,i=Math.min(0.5*Math.pow(2,n),8),s=1-Math.random()*0.25;return i*s*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 r={...e},{method:o,path:n,query:i,defaultBaseURL:s}=r;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(n,i,s);if("timeout"in r)Hw("timeout",r.timeout);r.timeout=r.timeout??this.timeout;let{bodyHeaders:c,body:u}=this.buildBody({options:r}),d=await this.buildHeaders({options:e,method:o,bodyHeaders:c,retryCount:t});return{req:{method:o,headers:d,...r.signal&&{signal:r.signal},...globalThis.ReadableStream&&u instanceof globalThis.ReadableStream&&{duplex:"half"},...u&&{body:u},...this.fetchOptions??{},...r.fetchOptions??{}},url:a,timeout:r.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:r,retryCount:o}){let n={};if(this.idempotencyHeader&&t!=="get"){if(!e.idempotencyKey)e.idempotencyKey=this.defaultIdempotencyKey();n[this.idempotencyHeader]=e.idempotencyKey}let i=T([n,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1000))}:{},...ta(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,r,e.headers]);return this.validateHeaders(i),i.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let r=T([t]);if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==="string"&&r.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:vu(e)};else if(typeof e==="object"&&r.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e)};else return _(this,Ju,"f").call(this,{body:e,headers:r})}}ah=je,Ju=new WeakMap,sh=new WeakSet,Bk=function(){return this.baseURL!=="https://api.anthropic.com"};je.Anthropic=ah;je.HUMAN_PROMPT=qk;je.AI_PROMPT=Zk;je.DEFAULT_TIMEOUT=600000;je.AnthropicError=z;je.APIError=We;je.APIConnectionError=to;je.APIConnectionTimeoutError=Vs;je.APIUserAbortError=tt;je.NotFoundError=Js;je.ConflictError=Xs;je.RateLimitError=Qs;je.BadRequestError=Ws;je.AuthenticationError=Ks;je.InternalServerError=ea;je.PermissionDeniedError=Gs;je.UnprocessableEntityError=Ys;je.toFile=Au;class po extends je{constructor(){super(...arguments);this.completions=new mi(this),this.messages=new uo(this),this.models=new hi(this),this.beta=new st(this)}}po.Completions=mi;po.Messages=uo;po.Models=hi;po.Beta=st;function kr(e){return e instanceof Error?e:Error(String(e))}function yi(e){return e instanceof Error?e.message:String(e)}function Ge(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return}function _n(e){return Ge(e)==="ENOENT"}function ch(e){return Ge(e)==="EISDIR"}function Vk(e){let t=Ge(e);return t==="ENOENT"||t==="EACCES"||t==="EPERM"||t==="ENOTDIR"||t==="ELOOP"||t==="EROFS"}import{randomUUID as rF}from"crypto";import{join as Xk}from"path";import{AsyncLocalStorage as J1}from"async_hooks";import{appendFile as X1,mkdir as Y1,readdir as Kk,readFile as Gk,stat as Q1,unlink as eF,writeFile as uh}from"fs/promises";import{randomBytes as q1}from"crypto";import{copyFile as Z1,rename as V1,unlink as lh,writeFile as W1}from"fs/promises";var K1=new Set(["EXDEV","EPERM","EEXIST","EBUSY"]),G1=new Set(["ENOSPC","EIO","EDQUOT","EFBIG"]);async function Wk(e,t,r){let o=`${e}.tmp.${q1(4).toString("hex")}`;try{await W1(o,t,{encoding:"utf8",mode:r});try{await V1(o,e)}catch(n){let i=Ge(n);if(i!==void 0&&K1.has(i)){try{await Z1(o,e)}catch(s){if(G1.has(Ge(s)??""))await lh(e).catch(()=>{});throw s}await lh(o).catch(()=>{})}else throw n}}catch(n){throw await lh(o).catch(()=>{}),n}}class Jk{read(e){return Gk(e,"utf8")}readBytes(e){return Gk(e)}write(e,t,r){return uh(e,t,{encoding:"utf8",mode:r})}async mkdir(e){try{await Y1(e,{recursive:!0})}catch(t){if(Ge(t)!=="EEXIST")throw t}}atomicWrite(e,t,r){return Wk(e,t,r)}delete(e){return eF(e)}list(e){return Kk(e)}append(e,t,r){return X1(e,t,{encoding:"utf8",mode:r})}writeExclusive(e,t){return uh(e,t,{encoding:"utf8",flag:"wx"})}writeBytes(e,t){return uh(e,t)}async stat(e){return{mtimeMs:(await Q1(e)).mtimeMs}}async listEntries(e){return(await Kk(e,{withFileTypes:!0})).map((r)=>({name:r.name,isDirectory:r.isDirectory(),isFile:r.isFile()}))}}var tF=new J1;function bi(){return tF.getStore()??new Jk}var fo,_i=null;function Yk(){if(_i)return _i;if(!Te(process.env.DEBUG_CLAUDE_AGENT_SDK))return fo=null,_i=Promise.resolve(),_i;let e=Xk(qt(),"debug");return fo=Xk(e,`sdk-${rF()}.txt`),process.stderr.write(`SDK debug logs: ${fo}
57
- `),_i=bi().mkdir(e).catch(()=>{}),_i}function Qk(){return Yk(),fo??null}function St(e){if(fo===null)return;let r=`${new Date().toISOString()} ${e}
58
- `;Yk().then(()=>{if(fo)bi().append(fo,r).catch(()=>{})})}function nF(){this.__data__=new pn,this.size=0}var eT=nF;function oF(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var tT=oF;function iF(e){return this.__data__.get(e)}var rT=iF;function sF(e){return this.__data__.has(e)}var nT=sF;var aF=200;function cF(e,t){var r=this.__data__;if(r instanceof pn){var o=r.__data__;if(!yu||o.length<aF-1)return o.push([e,t]),this.size=++r.size,this;r=this.__data__=new qs(o)}return r.set(e,t),this.size=r.size,this}var oT=cF;function vi(e){var t=this.__data__=new pn(e);this.size=t.size}vi.prototype.clear=eT;vi.prototype.delete=tT;vi.prototype.get=rT;vi.prototype.has=nT;vi.prototype.set=oT;var iT=vi;var lF=function(){try{var e=Qo(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Si=lF;function uF(e,t,r){if(t=="__proto__"&&Si)Si(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0});else e[t]=r}var xi=uF;var dF=Object.prototype,pF=dF.hasOwnProperty;function fF(e,t,r){var o=e[t];if(!(pF.call(e,t)&&un(o,r))||r===void 0&&!(t in e))xi(e,t,r)}var Xu=fF;function mF(e,t,r,o){var n=!r;r||(r={});var i=-1,s=t.length;while(++i<s){var a=t[i],c=o?o(r[a],e[a],a,r,e):void 0;if(c===void 0)c=e[a];if(n)xi(r,a,c);else Xu(r,a,c)}return r}var sT=mF;function gF(e,t){var r=-1,o=Array(e);while(++r<e)o[r]=t(r);return o}var aT=gF;function hF(e){return e!=null&&typeof e=="object"}var Kt=hF;var yF="[object Arguments]";function bF(e){return Kt(e)&&wr(e)==yF}var dh=bF;var cT=Object.prototype,_F=cT.hasOwnProperty,vF=cT.propertyIsEnumerable,SF=dh(function(){return arguments}())?dh:function(e){return Kt(e)&&_F.call(e,"callee")&&!vF.call(e,"callee")},Lr=SF;var xF=Array.isArray,pt=xF;var Qu={};xr(Qu,{default:()=>za});function wF(){return!1}var lT=wF;var pT=typeof Qu=="object"&&Qu&&!Qu.nodeType&&Qu,uT=pT&&typeof Yu=="object"&&Yu&&!Yu.nodeType&&Yu,kF=uT&&uT.exports===pT,dT=kF?Ht.Buffer:void 0,TF=dT?dT.isBuffer:void 0,EF=TF||lT,za=EF;var PF=9007199254740991,IF=/^(?:0|[1-9]\d*)$/;function RF(e,t){var r=typeof e;return t=t==null?PF:t,!!t&&(r=="number"||r!="symbol"&&IF.test(e))&&(e>-1&&e%1==0&&e<t)}var vn=RF;var $F=9007199254740991;function OF(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=$F}var wi=OF;var AF="[object Arguments]",CF="[object Array]",MF="[object Boolean]",NF="[object Date]",DF="[object Error]",jF="[object Function]",zF="[object Map]",UF="[object Number]",LF="[object Object]",FF="[object RegExp]",HF="[object Set]",BF="[object String]",qF="[object WeakMap]",ZF="[object ArrayBuffer]",VF="[object DataView]",WF="[object Float32Array]",KF="[object Float64Array]",GF="[object Int8Array]",JF="[object Int16Array]",XF="[object Int32Array]",YF="[object Uint8Array]",QF="[object Uint8ClampedArray]",e4="[object Uint16Array]",t4="[object Uint32Array]",$e={};$e[WF]=$e[KF]=$e[GF]=$e[JF]=$e[XF]=$e[YF]=$e[QF]=$e[e4]=$e[t4]=!0;$e[AF]=$e[CF]=$e[ZF]=$e[MF]=$e[VF]=$e[NF]=$e[DF]=$e[jF]=$e[zF]=$e[UF]=$e[LF]=$e[FF]=$e[HF]=$e[BF]=$e[qF]=!1;function r4(e){return Kt(e)&&wi(e.length)&&!!$e[wr(e)]}var fT=r4;function n4(e){return function(t){return e(t)}}var mT=n4;var td={};xr(td,{default:()=>rd});var gT=typeof td=="object"&&td&&!td.nodeType&&td,Ua=gT&&typeof ed=="object"&&ed&&!ed.nodeType&&ed,o4=Ua&&Ua.exports===gT,ph=o4&&gu.process,i4=function(){try{var e=Ua&&Ua.require&&Ua.require("util").types;if(e)return e;return ph&&ph.binding&&ph.binding("util")}catch(t){}}(),rd=i4;var hT=rd&&rd.isTypedArray,s4=hT?mT(hT):fT,nd=s4;var a4=Object.prototype,c4=a4.hasOwnProperty;function l4(e,t){var r=pt(e),o=!r&&Lr(e),n=!r&&!o&&za(e),i=!r&&!o&&!n&&nd(e),s=r||o||n||i,a=s?aT(e.length,String):[],c=a.length;for(var u in e)if((t||c4.call(e,u))&&!(s&&(u=="length"||n&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||vn(u,c))))a.push(u);return a}var yT=l4;var u4=Object.prototype;function d4(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||u4;return e===r}var od=d4;function p4(e,t){return function(r){return e(t(r))}}var bT=p4;function f4(e){return e!=null&&wi(e.length)&&!Yo(e)}var ki=f4;function m4(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var _T=m4;var g4=Object.prototype,h4=g4.hasOwnProperty;function y4(e){if(!et(e))return _T(e);var t=od(e),r=[];for(var o in e)if(!(o=="constructor"&&(t||!h4.call(e,o))))r.push(o);return r}var vT=y4;function b4(e){return ki(e)?yT(e,!0):vT(e)}var id=b4;var ad={};xr(ad,{default:()=>fh});var kT=typeof ad=="object"&&ad&&!ad.nodeType&&ad,ST=kT&&typeof sd=="object"&&sd&&!sd.nodeType&&sd,_4=ST&&ST.exports===kT,xT=_4?Ht.Buffer:void 0,wT=xT?xT.allocUnsafe:void 0;function v4(e,t){if(t)return e.slice();var r=e.length,o=wT?wT(r):new e.constructor(r);return e.copy(o),o}var fh=v4;function S4(e,t){var r=-1,o=e.length;t||(t=Array(o));while(++r<o)t[r]=e[r];return t}var TT=S4;function x4(e,t){var r=-1,o=t.length,n=e.length;while(++r<o)e[n+r]=t[r];return e}var ET=x4;var w4=bT(Object.getPrototypeOf,Object),cd=w4;var k4=Ht.Uint8Array,mh=k4;function T4(e){var t=new e.constructor(e.byteLength);return new mh(t).set(new mh(e)),t}var PT=T4;function E4(e,t){var r=t?PT(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var IT=E4;var RT=Object.create,P4=function(){function e(){}return function(t){if(!et(t))return{};if(RT)return RT(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),$T=P4;function I4(e){return typeof e.constructor=="function"&&!od(e)?$T(cd(e)):{}}var OT=I4;import{realpathSync as QT}from"fs";var R4="[object Symbol]";function $4(e){return typeof e=="symbol"||Kt(e)&&wr(e)==R4}var Ti=$4;var O4=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,A4=/^\w*$/;function C4(e,t){if(pt(e))return!1;var r=typeof e;if(r=="number"||r=="symbol"||r=="boolean"||e==null||Ti(e))return!0;return A4.test(e)||!O4.test(e)||t!=null&&e in Object(t)}var AT=C4;var M4=500;function N4(e){var t=Ce(e,function(o){if(r.size===M4)r.clear();return o}),r=t.cache;return t}var CT=N4;var D4=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,j4=/\\(\\)?/g,z4=CT(function(e){var t=[];if(e.charCodeAt(0)===46)t.push("");return e.replace(D4,function(r,o,n,i){t.push(n?i.replace(j4,"$1"):o||r)}),t}),MT=z4;function U4(e,t){var r=-1,o=e==null?0:e.length,n=Array(o);while(++r<o)n[r]=t(e[r],r,e);return n}var NT=U4;var L4=1/0,DT=Bt?Bt.prototype:void 0,jT=DT?DT.toString:void 0;function zT(e){if(typeof e=="string")return e;if(pt(e))return NT(e,zT)+"";if(Ti(e))return jT?jT.call(e):"";var t=e+"";return t=="0"&&1/e==-L4?"-0":t}var UT=zT;function F4(e){return e==null?"":UT(e)}var LT=F4;function H4(e,t){if(pt(e))return e;return AT(e,t)?[e]:MT(LT(e))}var Sn=H4;var B4=1/0;function q4(e){if(typeof e=="string"||Ti(e))return e;var t=e+"";return t=="0"&&1/e==-B4?"-0":t}var Ei=q4;function Z4(e,t){t=Sn(t,e);var r=0,o=t.length;while(e!=null&&r<o)e=e[Ei(t[r++])];return r&&r==o?e:void 0}var FT=Z4;function V4(e,t){return e!=null&&t in Object(e)}var HT=V4;function W4(e,t,r){t=Sn(t,e);var o=-1,n=t.length,i=!1;while(++o<n){var s=Ei(t[o]);if(!(i=e!=null&&r(e,s)))break;e=e[s]}if(i||++o!=n)return i;return n=e==null?0:e.length,!!n&&wi(n)&&vn(s,n)&&(pt(e)||Lr(e))}var BT=W4;function K4(e,t){return e!=null&&BT(e,t,HT)}var qT=K4;function G4(e){return e}var ld=G4;import{cwd as Y4}from"process";import{randomUUID as La}from"crypto";var gh=null;function ZT(){return gh}function VT(e){gh=e}var ud=new Map;function WT(e){return ud.has(e)?ud.get(e):void 0}function KT(e,t){ud.set(e,t)}var J4;var hh=new Map;function GT(e){return hh.get(e)}function JT(e,t){hh.set(e,t)}function mo(){gh=null,ud.clear(),hh.clear(),J4=void 0}var X4;function XT(){return X4}function YT(){return{sent:new Set,rejected:new Set}}var Q4={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};function e2(){let e="";if(typeof process<"u"&&typeof process.cwd==="function"&&typeof QT==="function"){let r=Y4();try{e=eE(QT(r))}catch{e=eE(r)}}return{originalCwd:e,projectRoot:e,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:e,modelUsage:{},mainLoopModelOverride:void 0,refusalFallbackOccurred:!1,replConfigArgv:[],initialMainLoopModel:void 0,modelStrings:null,isInteractive:!1,attacherCaps:null,hasStreamingInput:!1,modelOverrideOptOutForSession:!1,kairosActive:!1,rendererMode:void 0,strictToolResultPairing:!1,memoryToggledOff:!1,teamMemoryServerStatus:void 0,sdkAgentProgressSummariesEnabled:!1,userMsgOptIn:!1,searchToolsOptIn:!1,clientType:"cli",sessionSource:void 0,sessionStartType:"fresh",questionPreviewFormat:void 0,sessionIngressToken:void 0,oauthTokenFromFd:void 0,oauthScopesFromFd:void 0,apiKeyFromFd:void 0,gatewayAuth:null,gatewayRefreshInFlight:null,flagSettingsPath:void 0,flagSettingsExpectedContent:void 0,flagSettingsInline:null,parentManagedSettings:null,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,statsStore:null,sessionId:La(),parentSessionId:void 0,loggerProvider:null,eventLogger:null,pendingOTelEvents:[],meterProvider:null,tracerProvider:null,cachedTelemetryResource:null,cachedOtlpHttpAgentFactory:null,agentColorMap:new Map,agentColorIndex:0,lastAPIRequest:null,lastCancelledAPIMessageId:null,lastAPIRequestMessages:null,lastClassifierRequests:null,cachedClaudeMdContent:null,inMemoryErrorLog:[],inlinePlugins:[],inlinePluginUrls:[],syncedPluginDirs:[],chromeFlagOverride:void 0,onboardingShownThisSession:!1,useCoworkPlugins:!1,disableSlashCommands:!1,sessionBypassPermissionsMode:!1,scheduledTasksEnabled:!1,sessionPrResolved:!1,sessionCronTasks:[],loopChainStartedAt:Object.create(null),loopTickInFlightPrompt:null,loopConsecutiveKeepalives:0,sessionCreatedTeams:new Set,sessionTrustAccepted:!1,sessionPersistenceDisabled:!1,hasExitedPlanMode:!1,needsPlanModeExitAttachment:!1,needsAutoModeExitAttachment:!1,lspRecommendationShownThisSession:!1,initJsonSchema:null,registeredHooks:null,planSlugCache:new Map,teleportedSessionInfo:null,invokedSkills:new Map,slowOperations:[],sdkBetas:void 0,sdkOAuthTokenRefreshCallback:null,hostAuthTokenRefreshCallback:null,mainThreadAgentType:void 0,mainThreadAgentHooks:void 0,sessionSkillAllowlist:void 0,caps:Q4,replBridgeActive:!1,directConnectServerUrl:void 0,mcpConnectNonBlocking:!1,strictMcpConfig:!1,activeRoutine:void 0,systemPromptSectionCache:new Map,lastEmittedDate:null,additionalDirectoriesForClaudeMd:[],allowedChannels:[],activeInputs:new Map,hasDevChannels:!1,sessionProjectDir:null,promptCache1hAllowlist:null,stickyBetas:YT(),thinkingTypeOverrides:new Map,inferenceProfileBackingModels:new Map,promptId:null,promptIndex:0,lastMainRequestId:void 0,lastMainThreadCacheTtlMs:null,lastApiCompletionTimestamp:null,pendingPostCompaction:!1}}var t2=e2(),r2=()=>{return};function yh(){return r2()?.sessionId??t2.sessionId}var n2=ln(),yfe=n2.subscribe;function eE(e){return process.platform==="darwin"?e.normalize("NFC"):e}var o2=ln(),bfe=o2.subscribe;var i2=ln(),_fe=i2.subscribe;var s2=ln();var vfe=s2.subscribe;var a2=ln();var Sfe=a2.subscribe;import{appendFile as mE,mkdir as I2,rename as gE,stat as R2,symlink as $2,unlink as xh}from"fs/promises";import{dirname as yE,join as Ph,resolve as hE}from"path";function tE({writeFn:e,flushIntervalMs:t=1000,maxBufferSize:r=100,maxBufferBytes:o=1/0,immediateMode:n=!1}){let i=[],s=0,a=null,c=null;function u(){if(a)clearTimeout(a),a=null}function d(g){try{e(g)}catch{}}function p(){if(c)d(c.join("")),c=null;if(i.length===0)return;d(i.join("")),i=[],s=0,u()}function f(){if(!a)a=setTimeout(p,t)}function m(){if(c){c.push(...i),i=[],s=0,u();return}let g=i;i=[],s=0,u(),c=g,setImmediate(()=>{let h=c;if(c=null,h)d(h.join(""))})}return{write(g){if(n){d(g);return}if(i.push(g),s+=g.length,f(),i.length>=r||s>=o)m()},flush:p,dispose(){p()}}}function c2(e){if(typeof e==="function")return e;if(Symbol.asyncDispose in e)return()=>e[Symbol.asyncDispose]();return()=>e[Symbol.dispose]()}class rE{#n=new Set;register(e){let t=c2(e);this.#n.add(t);let r=()=>{this.#n.delete(t)};return Object.assign(r,{[Symbol.dispose]:r})}async drain(){let e=Array.from(this.#n);this.#n.clear(),await Promise.all(e.map(async(t)=>t()))}async[Symbol.asyncDispose](){await this.drain()}get sizeForTesting(){return this.#n.size}}var l2=new rE;function nE(e){return l2.register(e)}var oE=Ce((e)=>{if(!e||e.trim()==="")return null;let t=e.split(",").map((i)=>i.trim()).filter(Boolean);if(t.length===0)return null;let r=t.some((i)=>i.startsWith("!")),o=t.some((i)=>!i.startsWith("!"));if(r&&o)return null;let n=t.map((i)=>i.replace(/^!/,"").toLowerCase());return{include:r?[]:n,exclude:r?n:[],isExclusive:r}});function u2(e){let t=[],r=e.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])t.push("mcp"),t.push(r[1].toLowerCase());else{let i=e.match(/^([^:[]+):/);if(i&&i[1])t.push(i[1].trim().toLowerCase())}let o=e.match(/^\[([^\]]+)]/);if(o&&o[1])t.push(o[1].trim().toLowerCase());if(e.toLowerCase().includes("1p event:"))t.push("1p");let n=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(n&&n[1]){let i=n[1].trim().toLowerCase();if(i.length<30&&!i.includes(" "))t.push(i)}return Array.from(new Set(t))}function d2(e,t){if(!t)return!0;if(e.length===0)return!1;if(t.isExclusive)return!e.some((r)=>t.exclude.includes(r));else return e.some((r)=>t.include.includes(r))}function iE(e,t){if(!t)return!0;let r=u2(e);return d2(r,t)}import*as Y from"fs";import{mkdir as p2,open as f2,readdir as m2,readFile as sE,rename as g2,rmdir as h2,rm as y2,stat as b2,unlink as _2}from"fs/promises";function dd(e,t){if(dw(t)&&!pw(t))return{resolvedPath:t,isSymlink:!1,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 v2={cwd(){return process.cwd()},existsSync(e){let r=[];try{const t=_e(r,Pe`fs.existsSync(${e})`,0);return Y.existsSync(e)}catch(o){var n=o,i=1}finally{ve(r,n,i)}},async stat(e){return b2(e)},async readdir(e){return m2(e,{withFileTypes:!0})},async unlink(e){return _2(e)},async rmdir(e){return h2(e)},async rm(e,t){return y2(e,t)},async mkdir(e,t){try{await p2(e,{recursive:!0,...t})}catch(r){if(Ge(r)!=="EEXIST")throw r}},async readFile(e,t){return sE(e,{encoding:t.encoding})},async rename(e,t){return g2(e,t)},statSync(e){let r=[];try{const t=_e(r,Pe`fs.statSync(${e})`,0);return Y.statSync(e)}catch(o){var n=o,i=1}finally{ve(r,n,i)}},lstatSync(e){let r=[];try{const t=_e(r,Pe`fs.lstatSync(${e})`,0);return Y.lstatSync(e)}catch(o){var n=o,i=1}finally{ve(r,n,i)}},readFileSync(e,t){let o=[];try{const r=_e(o,Pe`fs.readFileSync(${e})`,0);return Y.readFileSync(e,{encoding:t.encoding})}catch(n){var i=n,s=1}finally{ve(o,i,s)}},readFileBytesSync(e){let r=[];try{const t=_e(r,Pe`fs.readFileBytesSync(${e})`,0);return Y.readFileSync(e)}catch(o){var n=o,i=1}finally{ve(r,n,i)}},readSync(e,t){let n=[];try{const r=_e(n,Pe`fs.readSync(${e}, ${t.length} bytes)`,0);let o=void 0;try{o=Y.openSync(e,"r");let c=Buffer.alloc(t.length),u=Y.readSync(o,c,0,t.length,0);return{buffer:c,bytesRead:u}}finally{if(o)Y.closeSync(o)}}catch(i){var s=i,a=1}finally{ve(n,s,a)}},appendFileSync(e,t,r){let n=[];try{const o=_e(n,Pe`fs.appendFileSync(${e}, ${t.length} chars)`,0);if(r?.mode!==void 0)try{let c=Y.openSync(e,"ax",r.mode);try{Y.appendFileSync(c,t)}finally{Y.closeSync(c)}return}catch(c){if(Ge(c)!=="EEXIST")throw c}Y.appendFileSync(e,t)}catch(i){var s=i,a=1}finally{ve(n,s,a)}},copyFileSync(e,t){let o=[];try{const r=_e(o,Pe`fs.copyFileSync(${e} → ${t})`,0);Y.copyFileSync(e,t)}catch(n){var i=n,s=1}finally{ve(o,i,s)}},unlinkSync(e){let r=[];try{const t=_e(r,Pe`fs.unlinkSync(${e})`,0);Y.unlinkSync(e)}catch(o){var n=o,i=1}finally{ve(r,n,i)}},renameSync(e,t){let o=[];try{const r=_e(o,Pe`fs.renameSync(${e} → ${t})`,0);Y.renameSync(e,t)}catch(n){var i=n,s=1}finally{ve(o,i,s)}},linkSync(e,t){let o=[];try{const r=_e(o,Pe`fs.linkSync(${e} → ${t})`,0);Y.linkSync(e,t)}catch(n){var i=n,s=1}finally{ve(o,i,s)}},symlinkSync(e,t,r){let n=[];try{const o=_e(n,Pe`fs.symlinkSync(${e} → ${t})`,0);Y.symlinkSync(e,t,r)}catch(i){var s=i,a=1}finally{ve(n,s,a)}},readlinkSync(e){let r=[];try{const t=_e(r,Pe`fs.readlinkSync(${e})`,0);return Y.readlinkSync(e)}catch(o){var n=o,i=1}finally{ve(r,n,i)}},realpathSync(e){let r=[];try{const t=_e(r,Pe`fs.realpathSync(${e})`,0);return Ar(Y.realpathSync(e))}catch(o){var n=o,i=1}finally{ve(r,n,i)}},mkdirSync(e,t){let n=[];try{const r=_e(n,Pe`fs.mkdirSync(${e})`,0);let o={recursive:!0};if(t?.mode!==void 0)o.mode=t.mode;try{Y.mkdirSync(e,o)}catch(c){if(Ge(c)!=="EEXIST")throw c}}catch(i){var s=i,a=1}finally{ve(n,s,a)}},readdirSync(e){let r=[];try{const t=_e(r,Pe`fs.readdirSync(${e})`,0);return Y.readdirSync(e,{withFileTypes:!0})}catch(o){var n=o,i=1}finally{ve(r,n,i)}},readdirStringSync(e){let r=[];try{const t=_e(r,Pe`fs.readdirStringSync(${e})`,0);return Y.readdirSync(e)}catch(o){var n=o,i=1}finally{ve(r,n,i)}},isDirEmptySync(e){let o=[];try{const t=_e(o,Pe`fs.isDirEmptySync(${e})`,0);let r=this.readdirSync(e);return r.length===0}catch(n){var i=n,s=1}finally{ve(o,i,s)}},rmdirSync(e){let r=[];try{const t=_e(r,Pe`fs.rmdirSync(${e})`,0);Y.rmdirSync(e)}catch(o){var n=o,i=1}finally{ve(r,n,i)}},rmSync(e,t){let o=[];try{const r=_e(o,Pe`fs.rmSync(${e})`,0);Y.rmSync(e,t)}catch(n){var i=n,s=1}finally{ve(o,i,s)}},createWriteStream(e){return Y.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return sE(e);let r=await f2(e,"r");try{let{size:o}=await r.stat(),n=Math.min(o,t),i=Buffer.allocUnsafe(n),s=0;while(s<n){let{bytesRead:a}=await r.read(i,s,n-s,s);if(a===0)break;s+=a}return s<n?i.subarray(0,s):i}finally{await r.close()}}},S2=v2;function Fe(){return S2}function x2(e,t){if(e.destroyed)return;e.write(t)}function aE(e){x2(process.stderr,e)}function bh(e){return e.charAt(0).toUpperCase()+e.slice(1)}function cE(e,t,r=t+"s"){return e===1?t:r}var jfe=typeof String.prototype.isWellFormed==="function"?Function.prototype.call.bind(String.prototype.isWellFormed):void 0,zfe=typeof String.prototype.toWellFormed==="function"?Function.prototype.call.bind(String.prototype.toWellFormed):void 0;function _h(e,t){let r=e.indexOf(t);return r===-1?e:e.slice(0,r)}var w2=/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,lE="[^\\s,;&}\\])]+",pE="-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\\s\\S-]{64,}?-----END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----",k2=`[^\\s-]{0,4}${pE}['"\`]?`,uE=`\\[REDACTED\\]|"[^"]*"|'[^']*'|(?:Bearer|Basic)\\s+(?:\\[REDACTED\\]|${lE})|${k2}|${lE}`,T2=["sk","ant","api"].join("-"),E2=[{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:`(?:${w2.source})[\\w.-]*["']?\\s*[=:]\\s*(${uE})`,flags:"i",confidence:"low"},{id:"cloud-env-var",source:`\\b(?:AWS|GOOGLE|GCP|GCLOUD|AZURE)_\\w+\\s*[=:]\\s*(${uE})`,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})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,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(${T2}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:"openai-api-key",source:`\\b(sk-(?:proj|svcacct|admin)-(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})T3BlbkFJ(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})\\b|sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"huggingface-access-token",source:`\\b(hf_[a-zA-Z]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,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-[\\w-]{20}",confidence:"high"},{id:"gitlab-deploy-token",source:"gldt-[0-9a-zA-Z_\\-]{20}",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[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}",confidence:"high"},{id:"slack-app-token",source:"xapp-\\d-[A-Z0-9]+-\\d+-[a-z0-9]+",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"},{id:"private-key",source:pE,flags:"i",confidence:"high"}];var dE=null;function P2(e){return E2.map((t)=>({id:t.id,confidence:t.confidence,re:new RegExp(t.source,e?(t.flags??"").replace("g","")+"g":t.flags??"")}))}function fE(e){dE??=P2(!0);for(let t of dE)e=e.replace(t.re,(r,o)=>{if(typeof o!=="string")return"[REDACTED]";let n=o.length>=2&&(o[0]==='"'||o[0]==="'")&&o.at(-1)===o[0]?o[0]:"",i=r.lastIndexOf(o);return`${r.slice(0,i)}${n}[REDACTED]${n}${r.slice(i+o.length)}`});return e}var wh={verbose:0,debug:1,info:2,warn:3,error:4},O2=Ce(()=>{let e=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();if(e&&Object.hasOwn(wh,e))return e;return"debug"}),A2=!1;function fd(){return typeof process<"u"&&Array.isArray(process.argv)?process.argv:[]}var kh=Ce(()=>{let e=fd();return A2||Te(process.env.DEBUG)||Te(process.env.DEBUG_SDK)||e.includes("--debug")||e.includes("-d")||bE()||e.some((t)=>t.startsWith("--debug="))||_E()!==null});var C2=Ce(()=>{let e=fd().find((r)=>r.startsWith("--debug="));if(!e)return null;let t=e.substring(8);return oE(t)}),bE=Ce(()=>{let e=fd();return e.includes("--debug-to-stderr")||e.includes("-d2e")}),_E=Ce(()=>{let e=fd();for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("--debug-file="))return hE(r.substring(13));if(r==="--debug-file"&&t+1<e.length)return hE(e[t+1])}return null});function M2(e){if(!kh())return!1;if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let t=C2();return iE(e,t)}var N2=!1;var D2=10485760,pd=null,vh=Promise.resolve(),Fa=-1,Sh=!1,Th=null;async function vE(e,t,r=D2){if(Fa<0)Fa=await R2(e).then((o)=>o.size).catch(()=>0);else Fa+=t;if(Fa<=r||Sh)return;Sh=!0;try{let o=e.endsWith(".txt")?`${e.slice(0,-4)}.1.txt`:`${e}.1`;try{await gE(e,o)}catch(n){if(!_n(n))await xh(o).catch(()=>{}),await gE(e,o).catch(()=>xh(e).catch(()=>{}))}Fa=0}finally{Sh=!1}}function SE(e){return Th=Ph(e,`${yh()}.txt`),Th}async function j2(e,t,r,o){if(e)await I2(t,{recursive:!0}).catch(()=>{});let n=r;try{await mE(r,o)}catch(i){if(!ch(i))throw i;n=SE(r),await mE(n,o)}await vE(n,Buffer.byteLength(o)).catch(Eh),wE()}function Eh(){}function z2(){if(!pd){let e=null;pd=tE({writeFn:(t)=>{let r=xE(),o=yE(r),n=e!==o;if(e=o,kh()){if(n)try{Fe().mkdirSync(o)}catch{}let i=r;try{Fe().appendFileSync(r,t)}catch(s){if(!ch(s))throw s;i=SE(r),Fe().appendFileSync(i,t)}vE(i,Buffer.byteLength(t)).catch(Eh),wE();return}vh=vh.then(j2.bind(null,n,o,r,t)).catch(Eh)},flushIntervalMs:1000,maxBufferSize:100,immediateMode:kh()}),nE(async()=>{pd?.dispose(),await vh})}return pd}function ne(e,{level:t}={level:"debug"}){if(wh[t]<wh[O2()])return;if(!M2(e))return;if(N2&&e.includes(`
59
- `))e=pe(e);let o=`${new Date().toISOString()} [${t.toUpperCase()}] ${fE(e.trim())}
60
- `;if(bE()){aE(o);return}z2().write(o)}function xE(){return _E()??Th??process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??Ph(qt(),"debug",`${yh()}.txt`)}var wE=Ce(async()=>{try{let e=xE(),t=yE(e),r=Ph(t,"latest");await xh(r).catch(()=>{}),await $2(e,r)}catch{}});var sme=(()=>{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 U2={[Symbol.dispose](){}};function L2(){return U2}var Pe=L2;function pe(e,t,r){let n=[];try{const o=_e(n,Pe`JSON.stringify(${e})`,0);return JSON.stringify(e,t,r)}catch(i){var s=i,a=1}finally{ve(n,s,a)}}var Ze=(e,t)=>{let o=[];try{const r=_e(o,Pe`JSON.parse(${e})`,0);return typeof t>"u"?JSON.parse(e):JSON.parse(e,t)}catch(n){var i=n,s=1}finally{ve(o,i,s)}};function kE(e){return JSON.parse(e)}function Tr(e,t){let o=[];try{const r=_e(o,Pe`structuredClone(${e})`,0);return structuredClone(e,t)}catch(n){var i=n,s=1}finally{ve(o,i,s)}}function F2(e){let t=e.trim();return t.startsWith("{")&&t.endsWith("}")}function TE(e,t){let r={...e};if(t){let o=t.enabled===!0&&t.failIfUnavailable===void 0?{...t,failIfUnavailable:!0}:t,n=r.settings;if(n&&!F2(n))throw Error("Cannot use both a settings file path and the sandbox option. Include the sandbox configuration in your settings file instead.");let i={sandbox:o};if(n)try{i={...Ze(n),sandbox:o}}catch{}r.settings=pe(i)}return r}var Z2=2000,md=new Set,EE=!1;function V2(){for(let e of md)if(!e.killed)if(process.platform==="win32")try{e.stdin.end()}catch{}else e.kill("SIGTERM")}function W2(e){if(md.add(e),!EE)EE=!0,process.on("exit",V2)}class Ih{options;process;processStdin;processStdout;ready=!1;abortController;exitError;exitListeners=[];abortHandler;forwardedAbort=Fs();pendingWrites=[];pendingEndInput=!1;spawnResolve;spawnReject;spawnPromise;constructor(e){this.options=e;if(this.abortController=e.abortController||Fs(),e.deferSpawn)this.spawnPromise=new Promise((t,r)=>{this.spawnResolve=t,this.spawnReject=r}),this.spawnPromise.catch(()=>{});else this.initialize()}spawn(){try{this.initialize()}catch(t){throw this.spawnAbort(kr(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 mu()?"bun":"node"}spawnLocalProcess(e){let{command:t,args:r,cwd:o,env:n,signal:i}=e,s=Te(n.DEBUG_CLAUDE_AGENT_SDK)||this.options.stderr?"pipe":"ignore",a=H2(t,r,{cwd:o,stdio:["pipe","pipe",s],signal:i,env:n,windowsHide:!0});if(Te(n.DEBUG_CLAUDE_AGENT_SDK)||this.options.stderr)a.stderr.on("data",(u)=>{let d=u.toString();if(St(d),this.options.stderr)this.options.stderr(d)});return{stdin:a.stdin,stdout:a.stdout,get killed(){return a.killed},get exitCode(){return a.exitCode},kill:a.kill.bind(a),on:a.on.bind(a),once:a.once.bind(a),off:a.off.bind(a)}}initialize(){try{let{additionalDirectories:e=[],agent:t,betas:r,cwd:o,executable:n=this.getDefaultExecutable(),executableArgs:i=[],extraArgs:s={},pathToClaudeCodeExecutable:a,env:c={...process.env},thinkingConfig:u,maxTurns:d,maxBudgetUsd:p,taskBudget:f,model:m,fallbackModel:g,jsonSchema:h,permissionMode:y,allowDangerouslySkipPermissions:v,permissionPromptToolName:x,continueConversation:w,resume:O,settingSources:L,skills:se,disallowedTools:Ue=[],tools:Ye,mcpServers:Ft,strictMcpConfig:bt,canUseTool:Qn,includePartialMessages:Go,plugins:Or,sandbox:Ms}=this.options,{allowedTools:an=[]}=this.options;if(se!==void 0){let qe=se==="all"?["Skill"]:se.map((Qe)=>`Skill(${Qe})`),nr=new Set(an);an=[...an,...qe.filter((Qe)=>!nr.has(Qe))]}let V=["--output-format","stream-json","--verbose","--input-format","stream-json"];if(u){switch(u.type){case"enabled":if(u.budgetTokens===void 0)V.push("--thinking","adaptive");else V.push("--max-thinking-tokens",u.budgetTokens.toString());break;case"disabled":V.push("--thinking","disabled");break;case"adaptive":V.push("--thinking","adaptive");break}if(u.type!=="disabled"&&u.display)V.push("--thinking-display",u.display)}if(this.options.effort)V.push("--effort",this.options.effort);if(d)V.push("--max-turns",d.toString());if(p!==void 0)V.push("--max-budget-usd",p.toString());if(f)V.push("--task-budget",f.total.toString());if(m)V.push("--model",m);if(t)V.push("--agent",t);if(r&&r.length>0)V.push("--betas",r.join(","));if(h)V.push("--json-schema",pe(h));if(this.options.debugFile)V.push("--debug-file",this.options.debugFile);else if(this.options.debug)V.push("--debug");if(!this.options.debugFile&&!this.options.spawnClaudeCodeProcess){let qe=Qk();if(qe)V.push("--debug-file",qe)}if(Qn){if(x)throw Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");V.push("--permission-prompt-tool","stdio")}else if(x)V.push("--permission-prompt-tool",x);if(w)V.push("--continue");if(O)V.push("--resume",O);if(this.options.assistant)V.push("--assistant");if(this.options.channels&&this.options.channels.length>0)V.push("--channels",...this.options.channels);if(an.length>0)V.push("--allowedTools",an.join(","));if(Ue.length>0)V.push("--disallowedTools",Ue.join(","));if(Ye!==void 0)if(Array.isArray(Ye))if(Ye.length===0)V.push("--tools","");else V.push("--tools",Ye.join(","));else V.push("--tools","default");if(Ft&&Object.keys(Ft).length>0)V.push("--mcp-config",pe({mcpServers:Ft}));if(L!==void 0)V.push(`--setting-sources=${L.join(",")}`);if(bt)V.push("--strict-mcp-config");if(y)V.push("--permission-mode",y);if(v)V.push("--allow-dangerously-skip-permissions");if(g){if(m&&g===m)throw Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");V.push("--fallback-model",g)}if(this.options.includeHookEvents)V.push("--include-hook-events");if(Go)V.push("--include-partial-messages");if(this.options.sessionMirror)V.push("--session-mirror");for(let qe of e)V.push("--add-dir",qe);if(Or&&Or.length>0)for(let qe of Or)if(qe.type==="local")V.push("--plugin-dir",qe.path);else throw Error(`Unsupported plugin type: ${qe.type}`);if(this.options.forkSession)V.push("--fork-session");if(this.options.resumeSessionAt)V.push("--resume-session-at",this.options.resumeSessionAt);if(this.options.sessionId)V.push("--session-id",this.options.sessionId);if(this.options.persistSession===!1)V.push("--no-session-persistence");if(this.options.managedSettings)V.push("--managed-settings",this.options.managedSettings);let lu={...s??{}};if(this.options.settings)lu.settings=this.options.settings;let uu=TE(lu,Ms);for(let[qe,nr]of Object.entries(uu))if(nr===null)V.push(`--${qe}`);else V.push(`--${qe}`,nr);if(!c.CLAUDE_CODE_ENTRYPOINT)c.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(delete c.NODE_OPTIONS,Te(c.DEBUG_CLAUDE_AGENT_SDK))c.DEBUG="1";else delete c.DEBUG;let Ns=K2(a),Ds=Ns?a:n,js=Ns?[...i,...V]:[...i,a,...V],du={command:Ds,args:js,cwd:o,env:c,signal:this.forwardedAbort.signal};if(this.options.spawnClaudeCodeProcess)St(`Spawning Claude Code (custom): ${Ds} ${js.join(" ")}`),this.process=this.options.spawnClaudeCodeProcess(du);else St(`Spawning Claude Code: ${Ds} ${js.join(" ")}`),this.process=this.spawnLocalProcess(du);if(this.processStdin=this.process.stdin,this.processStdout=this.process.stdout,W2(this.process),this.abortHandler=()=>this.close(),this.abortController.signal.addEventListener("abort",this.abortHandler),this.abortController.signal.aborted)this.close();this.process.on("error",(qe)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new it("Claude Code process aborted by user");else if(Vk(qe)){let nr=G2(a,Ns);this.exitError=ReferenceError(nr),St(this.exitError.message)}else this.exitError=Error(`Failed to spawn Claude Code process: ${qe.message}`),St(this.exitError.message)}),this.process.on("exit",(qe,nr)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new it("Claude Code process aborted by user");else{let Qe=this.getProcessExitError(qe,nr);if(Qe)this.exitError=Qe,St(Qe.message)}}),this.ready=!this.abortController.signal.aborted}catch(e){throw this.ready=!1,e}}getProcessExitError(e,t){if(e!==0&&e!==null)return Error(`Claude Code process exited with code ${e}`);else if(t)return Error(`Claude Code process terminated by signal ${t}`);return}write(e){if(this.abortController.signal.aborted)throw new it("Operation aborted");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){St("[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 Error(`Cannot write to process that exited with error: ${this.exitError.message}`);St(`[ProcessTransport] Writing to stdin: ${e.substring(0,100)}`);try{if(!this.processStdin.write(e))St("[ProcessTransport] Write buffer full, data queued")}catch(t){throw this.ready=!1,Error(`Failed to write to process stdin: ${yi(t)}`)}}[Symbol.dispose](){this.close()}close(){if(this.spawnAbort(this.abortController.signal.aborted?new it("Claude Code process aborted by user"):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;for(let{handler:r}of this.exitListeners)this.process?.off("exit",r);this.exitListeners=[];let e=()=>{if(this.abortController.signal.aborted)this.forwardedAbort.abort(this.abortController.signal.reason)},t=this.process;if(t&&!t.killed&&t.exitCode===null)setTimeout((r,o)=>{if(r.exitCode!==null){o();return}if(process.platform==="win32"){setTimeout((n,i)=>{if(n.exitCode===null)n.kill("SIGKILL");i()},5000,r,o).unref();return}r.kill("SIGTERM"),setTimeout((n)=>{if(n.exitCode===null)n.kill("SIGKILL")},5000,r).unref(),o()},Z2,t,e).unref(),t.once("exit",()=>md.delete(t));else if(t)md.delete(t),e();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=q2({input:this.processStdout}),t=this.process?(()=>{let r=this.process,o=()=>e.close();return r.on("error",o),()=>r.off("error",o)})():void 0;if(this.exitError)e.close();try{for await(let r of e)if(r.trim()){let o;try{o=Ze(r)}catch(n){St(`Non-JSON stdout: ${r}`);continue}yield o}if(this.exitError)throw this.exitError;await this.waitForExit()}catch(r){throw r}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=(r,o)=>{let n=this.getProcessExitError(r,o);e(n)};return this.process.on("exit",t),this.exitListeners.push({callback:e,handler:t}),()=>{if(this.process)this.process.off("exit",t);let r=this.exitListeners.findIndex((o)=>o.handler===t);if(r!==-1)this.exitListeners.splice(r,1)}}async waitForExit(){if(!this.process){if(this.exitError)throw this.exitError;return}if(this.process.exitCode!==null||this.process.killed||this.exitError){if(this.exitError)throw this.exitError;return}return new Promise((e,t)=>{let r=(n,i)=>{if(this.abortController.signal.aborted){t(new it("Operation aborted"));return}let s=this.getProcessExitError(n,i);if(s)t(s);else e()};this.process.once("exit",r);let o=(n)=>{this.process.off("exit",r),t(n)};this.process.once("error",o),this.process.once("exit",()=>{this.process.off("error",o)})})}}function K2(e){return![".js",".mjs",".tsx",".ts",".jsx"].some((r)=>e.endsWith(r))}function G2(e,t){if(B2(e))return t?`Claude Code native binary at ${e} exists but failed to launch.`:`Claude Code executable at ${e} exists but failed to launch.`;return t?`Claude Code native binary not found at ${e}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${e}. Is options.pathToClaudeCodeExecutable set?`}import{existsSync as J2}from"fs";var Pi="@anthropic-ai/claude-agent-sdk";function X2(){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 PE(e,t=process.platform,r=process.arch,o=J2,n=X2()){let s=t==="win32"?".exe":"",c=(t==="android"?[`${Pi}-linux-${r}-android`]:t==="linux"?n?[`${Pi}-linux-${r}-musl`,`${Pi}-linux-${r}`]:[`${Pi}-linux-${r}`,`${Pi}-linux-${r}-musl`]:[`${Pi}-${t}-${r}`]).map((u)=>`${u}/claude${s}`);for(let u of c)try{let d=e(u);if(o(d))return d}catch{}return null}class Ha{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})}}function Y2(){return{eventQueue:[],sink:null}}var Q2=Y2();function gd(e,t){let r=Q2;if(r.sink===null){r.eventQueue.push({eventName:e,metadata:t,async:!1});return}r.sink.logEvent(e,t)}function eH(e){return e}function hd(e){return eH(e)}function Rh(e){gd("tengu_feature_ok",{feature_name:hd(e)})}function $h(e,t,r){gd("tengu_feature_bad",{feature_name:hd(e),error_code:t,...r})}function IE(e,t,r){gd("tengu_feature_sad",{feature_name:hd(e),error_code:t,...r})}async function ar(e,t,r){try{let o=await t();return Rh(e),o}catch(o){throw $h(e,r?.(o)??"error"),o}}class Oh{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?.()}}class Ah{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;onElicitation;getOAuthToken;getHostAuthToken;onUserDialog;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new Ha;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;sdkMcpTransports=new Map;sdkMcpServerInstances=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;lastErrorResultText;transcriptMirrorBatcher;cleanupCallbacks=[];cleanupPromise;setIsSingleUserTurn(e){this.isSingleUserTurn=e}setTranscriptMirrorBatcher(e){this.transcriptMirrorBatcher=e}reportMirrorError(e,t){let r={type:"system",subtype:"mirror_error",error:t,key:e,uuid:La(),session_id:e.sessionId};this.inputStream.enqueue(r)}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,r,o,n,i=new Map,s,a,c,u,d,p){this.transport=e;this.isSingleUserTurn=t;this.canUseTool=r;this.hooks=o;this.abortController=n;this.jsonSchema=s;this.initConfig=a;this.onElicitation=c;this.getOAuthToken=u;this.getHostAuthToken=d;this.onUserDialog=p;for(let[f,m]of i)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 r of this.cancelControllers.values())r.abort();this.cancelControllers.clear(),this.transport.close();let t=e??Error("Query closed before response received");for(let{reject:r}of this.pendingControlResponses.values())r(t);this.pendingControlResponses.clear();for(let{reject:r}of this.pendingMcpResponses.values())r(t);this.pendingMcpResponses.clear(),this.hookCallbacks.clear();for(let r of this.sdkMcpTransports.values())r.close().catch(()=>{});if(this.sdkMcpTransports.clear(),e)this.inputStream.error(e);else this.inputStream.done()}catch(t){}}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);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==="post_turn_summary"||e.subtype==="task_summary")){this.inputStream.enqueue(e);continue}if(e.type==="result"){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.lastErrorResultText=e.is_error?e.subtype==="success"?e.result:e.errors.join("; "):void 0,this.firstResultReceived=!0,this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.isSingleUserTurn)ne("[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 it)){let t=Error(`Claude Code returned an error result: ${this.lastErrorResultText}`);ne(`[Query.readMessages] Replacing exit error with result text. Original: ${yi(e)}`),this.inputStream.error(t),this.cleanup(t);return}this.inputStream.error(e),this.cleanup(e)}}async handleControlRequest(e){let t=new AbortController;this.cancelControllers.set(e.request_id,t);try{let r=await this.processControlRequest(e,t.signal);if(this.cleanupPerformed)return;let o={type:"control_response",response:{subtype:"success",request_id:e.request_id,response:r}};await Promise.resolve(this.transport.write(pe(o)+`
55
+ `);this.baseURL=n.baseURL,this._baseURLIsExplicit=o.__baseURLIsExplicit??!!e,this.timeout=n.timeout??ch.DEFAULT_TIMEOUT,this.logger=n.logger??console;let i="warn";this.logLevel=i,this.logLevel=Dg(n.logLevel,"ClientOptions.logLevel",this)??Dg(ge("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??i,this.fetchOptions=n.fetchOptions,this.maxRetries=n.maxRetries??2,this.fetch=n.fetch??Jw(),D(this,Xu,Yw,"f");let s=ge("ANTHROPIC_CUSTOM_HEADERS");if(s){let c={};for(let u of s.split(`
56
+ `)){let d=u.indexOf(":");if(d>=0)c[u.substring(0,d).trim()]=u.substring(d+1).trim()}n.defaultHeaders={...c,...n.defaultHeaders}}let a=o.__auth;if(delete n.__auth,delete n.__baseURLIsExplicit,this._options=n,this.apiKey=typeof t==="string"?t:null,this.authToken=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=n.credentials??null;if(c)this._authState.provider=c,this._authState.tokenCache=this._makeTokenCache(c);else if(n.config!=null){let u=Ug(n.config,this._credentialResolverOptions());this._authState.provider=u.provider,this._authState.tokenCache=this._makeTokenCache(u.provider),this._authState.extraHeaders=u.extraHeaders,this._applyCredentialBaseURL(u.baseURL)}else if(n.profile!=null)this._authState.resolution=this._resolveDefaultCredentials(n.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.fetch,userAgent:this.getUserAgent(),onCacheWriteError:(e)=>{Le(this).debug("credential cache write failed (best-effort)",e)},onSafetyWarning:(e)=>{Le(this).warn(e)}}}_makeTokenCache(e){return new Mg(e,(t)=>{Le(this).debug("advisory token refresh failed; serving cached token",t)})}withOptions(e){let t="credentials"in e||"config"in e||"profile"in e,r="apiKey"in e||"authToken"in e||t,o={...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,apiKey:this.apiKey,authToken:this.authToken,credentials:this.credentials,...t?{credentials:void 0,config:void 0,profile:void 0}:{},...e,__auth:r?void 0:this._authState,__baseURLIsExplicit:"baseURL"in e?!0:this._baseURLIsExplicit};return new this.constructor(o)}async _resolveDefaultCredentials(e){try{let t=await yk(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,E([{Authorization:`Bearer ${t}`}])}return E([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey==null)return;return E([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken==null)return;return E([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return Qw(e)}getUserAgent(){return`${this.constructor.name}/JS ${Zt}`}defaultIdempotencyKey(){return`stainless-node-retry-${Ig()}`}makeStatusError(e,t,r,o){return We.generate(e,t,r,o)}buildURL(e,t,r){let o=!_(this,ah,"m",Zk).call(this)&&r||this.baseURL,n=Hw(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),i=this.defaultQuery(),s=Object.fromEntries(n.searchParams);if(!Og(i)||!Og(s))t={...s,...i,...t};if(typeof t==="object"&&t&&!Array.isArray(t))n.search=this.stringifyQuery(t);return n.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:r}){if(this._authState.tokenCache&&this.apiKey==null){let o=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[i,s]of Object.entries(this._authState.extraHeaders))if(!o.has(i))o.set(i,s);if(!o.get("anthropic-beta")?.split(",").map((i)=>i.trim())?.includes(oo))o.append("anthropic-beta",oo);e.headers=o}}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,r){return this.request(Promise.resolve(r).then((o)=>{return{method:e,path:t,...o}}))}request(e,t=null){return new io(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,r){let o=await e,n=o.maxRetries??this.maxRetries;if(t==null)t=n,this._requestAuthFlags.delete(o);await this.prepareOptions(o);let{req:i,url:s,timeout:a}=await this.buildRequest(o,{retryCount:n-t});await this.prepareRequest(i,{url:s,options:o});let c="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),u=r===void 0?"":`, retryOf: ${r}`,d=Date.now();if(Le(this).debug(`[${c}] sending request`,Dr({retryOfRequestLogID:r,method:o.method,url:s,options:o,headers:i.headers})),o.signal?.aborted)throw new tt;let p=new AbortController,f=await this.fetchWithTimeout(s,i,a,p).catch(Zs),m=Date.now();if(f instanceof globalThis.Error){let y=`retrying, ${t} attempts remaining`;if(o.signal?.aborted)throw new tt;let v=Nr(f)||/timed? ?out/i.test(String(f)+("cause"in f?String(f.cause):""));if(t)return Le(this).info(`[${c}] connection ${v?"timed out":"failed"} - ${y}`),Le(this).debug(`[${c}] connection ${v?"timed out":"failed"} (${y})`,Dr({retryOfRequestLogID:r,url:s,durationMs:m-d,message:f.message})),this.retryRequest(o,t,r??c);if(Le(this).info(`[${c}] connection ${v?"timed out":"failed"} - error; no more retries left`),Le(this).debug(`[${c}] connection ${v?"timed out":"failed"} (error; no more retries left)`,Dr({retryOfRequestLogID:r,url:s,durationMs:m-d,message:f.message})),v)throw new Vs;throw new no({cause:f})}let g=[...f.headers.entries()].filter(([y])=>y==="request-id").map(([y,v])=>", "+y+": "+JSON.stringify(v)).join(""),h=`[${c}${u}${g}] ${i.method} ${s} ${f.ok?"succeeded":"failed"} with status ${f.status} in ${m-d}ms`;if(!f.ok){let y=await this.shouldRetry(f,o);if(t&&y){let se=`retrying, ${t} attempts remaining`;return await Xw(f.body),Le(this).info(`${h} - ${se}`),Le(this).debug(`[${c}] response error (${se})`,Dr({retryOfRequestLogID:r,url:f.url,status:f.status,headers:f.headers,durationMs:m-d})),this.retryRequest(o,t,r??c,f.headers)}let v=y?"error; no more retries left":"error; not retryable";Le(this).info(`${h} - ${v}`);let x=await f.text().catch((se)=>Zs(se).message),w=vu(x),O=w?void 0:x;throw Le(this).debug(`[${c}] response error (${v})`,Dr({retryOfRequestLogID:r,url:f.url,status:f.status,headers:f.headers,message:O,durationMs:Date.now()-d})),this.makeStatusError(f.status,w,O,f.headers)}return Le(this).info(h),Le(this).debug(`[${c}] response start`,Dr({retryOfRequestLogID:r,url:f.url,status:f.status,headers:f.headers,durationMs:m-d})),{response:f,options:o,controller:p,requestLogID:c,retryOfRequestLogID:r,startTime:d}}getAPIList(e,t,r){return this.requestAPIList(t,r&&"then"in r?r.then((o)=>({method:"get",path:e,...o})):{method:"get",path:e,...r})}requestAPIList(e,t){let r=this.makeRequest(t,null,void 0);return new Au(this,r,e)}async fetchWithTimeout(e,t,r,o){let{signal:n,method:i,...s}=t||{},a=this._makeAbort(o);if(n)n.addEventListener("abort",a,{once:!0});let c=setTimeout(a,r),u=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body==="object"&&s.body!==null&&Symbol.asyncIterator in s.body,d={signal:o.signal,...u?{duplex:"half"}:{},method:"GET",...s};if(i)d.method=i.toUpperCase();try{return await this.fetch.call(void 0,e,d)}finally{clearTimeout(c)}}async shouldRetry(e,t){let r=this._authFlags(t);if(e.status===401&&this._authState.tokenCache&&r.usedTokenCache&&!r.didRefreshFor401)return r.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let o=e.headers.get("x-should-retry");if(o==="true")return!0;if(o==="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,r,o){let n,i=o?.get("retry-after-ms");if(i){let a=parseFloat(i);if(!Number.isNaN(a))n=a}let s=o?.get("retry-after");if(s&&!n){let a=parseFloat(s);if(!Number.isNaN(a))n=a*1000;else n=Date.parse(s)-Date.now()}if(n===void 0){let a=e.maxRetries??this.maxRetries;n=this.calculateDefaultRetryTimeoutMillis(t,a)}return await Zw(n),this.makeRequest(e,t-1,r)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e,i=Math.min(0.5*Math.pow(2,n),8),s=1-Math.random()*0.25;return i*s*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 r={...e},{method:o,path:n,query:i,defaultBaseURL:s}=r;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(n,i,s);if("timeout"in r)qw("timeout",r.timeout);r.timeout=r.timeout??this.timeout;let{bodyHeaders:c,body:u}=this.buildBody({options:r}),d=await this.buildHeaders({options:e,method:o,bodyHeaders:c,retryCount:t});return{req:{method:o,headers:d,...r.signal&&{signal:r.signal},...globalThis.ReadableStream&&u instanceof globalThis.ReadableStream&&{duplex:"half"},...u&&{body:u},...this.fetchOptions??{},...r.fetchOptions??{}},url:a,timeout:r.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:r,retryCount:o}){let n={};if(this.idempotencyHeader&&t!=="get"){if(!e.idempotencyKey)e.idempotencyKey=this.defaultIdempotencyKey();n[this.idempotencyHeader]=e.idempotencyKey}let i=E([n,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1000))}:{},...ta(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,r,e.headers]);return this.validateHeaders(i),i.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let r=E([t]);if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==="string"&&r.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:Su(e)};else if(typeof e==="object"&&r.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e)};else return _(this,Xu,"f").call(this,{body:e,headers:r})}}ch=je,Xu=new WeakMap,ah=new WeakSet,Zk=function(){return this.baseURL!=="https://api.anthropic.com"};je.Anthropic=ch;je.HUMAN_PROMPT=Vk;je.AI_PROMPT=Wk;je.DEFAULT_TIMEOUT=600000;je.AnthropicError=z;je.APIError=We;je.APIConnectionError=no;je.APIConnectionTimeoutError=Vs;je.APIUserAbortError=tt;je.NotFoundError=Js;je.ConflictError=Xs;je.RateLimitError=Qs;je.BadRequestError=Ws;je.AuthenticationError=Ks;je.InternalServerError=ea;je.PermissionDeniedError=Gs;je.UnprocessableEntityError=Ys;je.toFile=Cu;class mo extends je{constructor(){super(...arguments);this.completions=new mi(this),this.messages=new fo(this),this.models=new hi(this),this.beta=new st(this)}}mo.Completions=mi;mo.Messages=fo;mo.Models=hi;mo.Beta=st;function Er(e){return e instanceof Error?e:Error(String(e))}function yi(e){return e instanceof Error?e.message:String(e)}function Ge(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return}function Sn(e){return Ge(e)==="ENOENT"}function lh(e){return Ge(e)==="EISDIR"}function Kk(e){let t=Ge(e);return t==="ENOENT"||t==="EACCES"||t==="EPERM"||t==="ENOTDIR"||t==="ELOOP"||t==="EROFS"}import{randomUUID as lF}from"crypto";import{join as Qk}from"path";import{AsyncLocalStorage as nF}from"async_hooks";import{appendFile as oF,mkdir as iF,readdir as Jk,readFile as Xk,stat as sF,unlink as aF,writeFile as dh}from"fs/promises";import{randomBytes as X1}from"crypto";import{copyFile as Y1,rename as Q1,unlink as uh,writeFile as eF}from"fs/promises";var tF=new Set(["EXDEV","EPERM","EEXIST","EBUSY"]),rF=new Set(["ENOSPC","EIO","EDQUOT","EFBIG"]);async function Gk(e,t,r){let o=`${e}.tmp.${X1(4).toString("hex")}`;try{await eF(o,t,{encoding:"utf8",mode:r});try{await Q1(o,e)}catch(n){let i=Ge(n);if(i!==void 0&&tF.has(i)){try{await Y1(o,e)}catch(s){if(rF.has(Ge(s)??""))await uh(e).catch(()=>{});throw s}await uh(o).catch(()=>{})}else throw n}}catch(n){throw await uh(o).catch(()=>{}),n}}class Yk{read(e){return Xk(e,"utf8")}readBytes(e){return Xk(e)}write(e,t,r){return dh(e,t,{encoding:"utf8",mode:r})}async mkdir(e){try{await iF(e,{recursive:!0})}catch(t){if(Ge(t)!=="EEXIST")throw t}}atomicWrite(e,t,r){return Gk(e,t,r)}delete(e){return aF(e)}list(e){return Jk(e)}append(e,t,r){return oF(e,t,{encoding:"utf8",mode:r})}writeExclusive(e,t){return dh(e,t,{encoding:"utf8",flag:"wx"})}writeBytes(e,t){return dh(e,t)}async stat(e){return{mtimeMs:(await sF(e)).mtimeMs}}async listEntries(e){return(await Jk(e,{withFileTypes:!0})).map((r)=>({name:r.name,isDirectory:r.isDirectory(),isFile:r.isFile()}))}}var cF=new nF;function bi(){return cF.getStore()??new Yk}var go,_i=null;function eE(){if(_i)return _i;if(!Ee(process.env.DEBUG_CLAUDE_AGENT_SDK))return go=null,_i=Promise.resolve(),_i;let e=Qk(qt(),"debug");return go=Qk(e,`sdk-${lF()}.txt`),process.stderr.write(`SDK debug logs: ${go}
57
+ `),_i=bi().mkdir(e).catch(()=>{}),_i}function tE(){return eE(),go??null}function St(e){if(go===null)return;let r=`${new Date().toISOString()} ${e}
58
+ `;eE().then(()=>{if(go)bi().append(go,r).catch(()=>{})})}function uF(){this.__data__=new mn,this.size=0}var rE=uF;function dF(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var nE=dF;function pF(e){return this.__data__.get(e)}var oE=pF;function fF(e){return this.__data__.has(e)}var iE=fF;var mF=200;function gF(e,t){var r=this.__data__;if(r instanceof mn){var o=r.__data__;if(!bu||o.length<mF-1)return o.push([e,t]),this.size=++r.size,this;r=this.__data__=new qs(o)}return r.set(e,t),this.size=r.size,this}var sE=gF;function vi(e){var t=this.__data__=new mn(e);this.size=t.size}vi.prototype.clear=rE;vi.prototype.delete=nE;vi.prototype.get=oE;vi.prototype.has=iE;vi.prototype.set=sE;var aE=vi;var hF=function(){try{var e=Qo(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Si=hF;function yF(e,t,r){if(t=="__proto__"&&Si)Si(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0});else e[t]=r}var xi=yF;var bF=Object.prototype,_F=bF.hasOwnProperty;function vF(e,t,r){var o=e[t];if(!(_F.call(e,t)&&pn(o,r))||r===void 0&&!(t in e))xi(e,t,r)}var Yu=vF;function SF(e,t,r,o){var n=!r;r||(r={});var i=-1,s=t.length;while(++i<s){var a=t[i],c=o?o(r[a],e[a],a,r,e):void 0;if(c===void 0)c=e[a];if(n)xi(r,a,c);else Yu(r,a,c)}return r}var cE=SF;function xF(e,t){var r=-1,o=Array(e);while(++r<e)o[r]=t(r);return o}var lE=xF;function wF(e){return e!=null&&typeof e=="object"}var Kt=wF;var kF="[object Arguments]";function EF(e){return Kt(e)&&kr(e)==kF}var ph=EF;var uE=Object.prototype,TF=uE.hasOwnProperty,PF=uE.propertyIsEnumerable,IF=ph(function(){return arguments}())?ph:function(e){return Kt(e)&&TF.call(e,"callee")&&!PF.call(e,"callee")},Lr=IF;var RF=Array.isArray,pt=RF;var ed={};wr(ed,{default:()=>za});function $F(){return!1}var dE=$F;var mE=typeof ed=="object"&&ed&&!ed.nodeType&&ed,pE=mE&&typeof Qu=="object"&&Qu&&!Qu.nodeType&&Qu,OF=pE&&pE.exports===mE,fE=OF?Ht.Buffer:void 0,AF=fE?fE.isBuffer:void 0,CF=AF||dE,za=CF;var MF=9007199254740991,NF=/^(?:0|[1-9]\d*)$/;function DF(e,t){var r=typeof e;return t=t==null?MF:t,!!t&&(r=="number"||r!="symbol"&&NF.test(e))&&(e>-1&&e%1==0&&e<t)}var xn=DF;var jF=9007199254740991;function zF(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=jF}var wi=zF;var UF="[object Arguments]",LF="[object Array]",FF="[object Boolean]",HF="[object Date]",BF="[object Error]",qF="[object Function]",ZF="[object Map]",VF="[object Number]",WF="[object Object]",KF="[object RegExp]",GF="[object Set]",JF="[object String]",XF="[object WeakMap]",YF="[object ArrayBuffer]",QF="[object DataView]",e4="[object Float32Array]",t4="[object Float64Array]",r4="[object Int8Array]",n4="[object Int16Array]",o4="[object Int32Array]",i4="[object Uint8Array]",s4="[object Uint8ClampedArray]",a4="[object Uint16Array]",c4="[object Uint32Array]",$e={};$e[e4]=$e[t4]=$e[r4]=$e[n4]=$e[o4]=$e[i4]=$e[s4]=$e[a4]=$e[c4]=!0;$e[UF]=$e[LF]=$e[YF]=$e[FF]=$e[QF]=$e[HF]=$e[BF]=$e[qF]=$e[ZF]=$e[VF]=$e[WF]=$e[KF]=$e[GF]=$e[JF]=$e[XF]=!1;function l4(e){return Kt(e)&&wi(e.length)&&!!$e[kr(e)]}var gE=l4;function u4(e){return function(t){return e(t)}}var hE=u4;var rd={};wr(rd,{default:()=>nd});var yE=typeof rd=="object"&&rd&&!rd.nodeType&&rd,Ua=yE&&typeof td=="object"&&td&&!td.nodeType&&td,d4=Ua&&Ua.exports===yE,fh=d4&&hu.process,p4=function(){try{var e=Ua&&Ua.require&&Ua.require("util").types;if(e)return e;return fh&&fh.binding&&fh.binding("util")}catch(t){}}(),nd=p4;var bE=nd&&nd.isTypedArray,f4=bE?hE(bE):gE,od=f4;var m4=Object.prototype,g4=m4.hasOwnProperty;function h4(e,t){var r=pt(e),o=!r&&Lr(e),n=!r&&!o&&za(e),i=!r&&!o&&!n&&od(e),s=r||o||n||i,a=s?lE(e.length,String):[],c=a.length;for(var u in e)if((t||g4.call(e,u))&&!(s&&(u=="length"||n&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||xn(u,c))))a.push(u);return a}var _E=h4;var y4=Object.prototype;function b4(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||y4;return e===r}var id=b4;function _4(e,t){return function(r){return e(t(r))}}var vE=_4;function v4(e){return e!=null&&wi(e.length)&&!Yo(e)}var ki=v4;function S4(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var SE=S4;var x4=Object.prototype,w4=x4.hasOwnProperty;function k4(e){if(!et(e))return SE(e);var t=id(e),r=[];for(var o in e)if(!(o=="constructor"&&(t||!w4.call(e,o))))r.push(o);return r}var xE=k4;function E4(e){return ki(e)?_E(e,!0):xE(e)}var sd=E4;var cd={};wr(cd,{default:()=>mh});var TE=typeof cd=="object"&&cd&&!cd.nodeType&&cd,wE=TE&&typeof ad=="object"&&ad&&!ad.nodeType&&ad,T4=wE&&wE.exports===TE,kE=T4?Ht.Buffer:void 0,EE=kE?kE.allocUnsafe:void 0;function P4(e,t){if(t)return e.slice();var r=e.length,o=EE?EE(r):new e.constructor(r);return e.copy(o),o}var mh=P4;function I4(e,t){var r=-1,o=e.length;t||(t=Array(o));while(++r<o)t[r]=e[r];return t}var PE=I4;function R4(e,t){var r=-1,o=t.length,n=e.length;while(++r<o)e[n+r]=t[r];return e}var IE=R4;var $4=vE(Object.getPrototypeOf,Object),ld=$4;var O4=Ht.Uint8Array,gh=O4;function A4(e){var t=new e.constructor(e.byteLength);return new gh(t).set(new gh(e)),t}var RE=A4;function C4(e,t){var r=t?RE(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var $E=C4;var OE=Object.create,M4=function(){function e(){}return function(t){if(!et(t))return{};if(OE)return OE(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),AE=M4;function N4(e){return typeof e.constructor=="function"&&!id(e)?AE(ld(e)):{}}var CE=N4;import{realpathSync as tT}from"fs";var D4="[object Symbol]";function j4(e){return typeof e=="symbol"||Kt(e)&&kr(e)==D4}var Ei=j4;var z4=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,U4=/^\w*$/;function L4(e,t){if(pt(e))return!1;var r=typeof e;if(r=="number"||r=="symbol"||r=="boolean"||e==null||Ei(e))return!0;return U4.test(e)||!z4.test(e)||t!=null&&e in Object(t)}var ME=L4;var F4=500;function H4(e){var t=Ce(e,function(o){if(r.size===F4)r.clear();return o}),r=t.cache;return t}var NE=H4;var B4=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,q4=/\\(\\)?/g,Z4=NE(function(e){var t=[];if(e.charCodeAt(0)===46)t.push("");return e.replace(B4,function(r,o,n,i){t.push(n?i.replace(q4,"$1"):o||r)}),t}),DE=Z4;function V4(e,t){var r=-1,o=e==null?0:e.length,n=Array(o);while(++r<o)n[r]=t(e[r],r,e);return n}var jE=V4;var W4=1/0,zE=Bt?Bt.prototype:void 0,UE=zE?zE.toString:void 0;function LE(e){if(typeof e=="string")return e;if(pt(e))return jE(e,LE)+"";if(Ei(e))return UE?UE.call(e):"";var t=e+"";return t=="0"&&1/e==-W4?"-0":t}var FE=LE;function K4(e){return e==null?"":FE(e)}var HE=K4;function G4(e,t){if(pt(e))return e;return ME(e,t)?[e]:DE(HE(e))}var wn=G4;var J4=1/0;function X4(e){if(typeof e=="string"||Ei(e))return e;var t=e+"";return t=="0"&&1/e==-J4?"-0":t}var Ti=X4;function Y4(e,t){t=wn(t,e);var r=0,o=t.length;while(e!=null&&r<o)e=e[Ti(t[r++])];return r&&r==o?e:void 0}var BE=Y4;function Q4(e,t){return e!=null&&t in Object(e)}var qE=Q4;function e2(e,t,r){t=wn(t,e);var o=-1,n=t.length,i=!1;while(++o<n){var s=Ti(t[o]);if(!(i=e!=null&&r(e,s)))break;e=e[s]}if(i||++o!=n)return i;return n=e==null?0:e.length,!!n&&wi(n)&&xn(s,n)&&(pt(e)||Lr(e))}var ZE=e2;function t2(e,t){return e!=null&&ZE(e,t,qE)}var VE=t2;function r2(e){return e}var ud=r2;import{cwd as i2}from"process";import{randomUUID as La}from"crypto";var hh=null;function WE(){return hh}function KE(e){hh=e}var dd=new Map;function GE(e){return dd.has(e)?dd.get(e):void 0}function JE(e,t){dd.set(e,t)}var n2;var yh=new Map;function XE(e){return yh.get(e)}function YE(e,t){yh.set(e,t)}function ho(){hh=null,dd.clear(),yh.clear(),n2=void 0}var o2;function QE(){return o2}function eT(){return{sent:new Set,rejected:new Set}}var s2={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};function a2(){let e="";if(typeof process<"u"&&typeof process.cwd==="function"&&typeof tT==="function"){let r=i2();try{e=rT(tT(r))}catch{e=rT(r)}}return{originalCwd:e,projectRoot:e,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:e,modelUsage:{},mainLoopModelOverride:void 0,refusalFallbackOccurred:!1,replConfigArgv:[],initialMainLoopModel:void 0,modelStrings:null,isInteractive:!1,attacherCaps:null,hasStreamingInput:!1,modelOverrideOptOutForSession:!1,kairosActive:!1,rendererMode:void 0,strictToolResultPairing:!1,memoryToggledOff:!1,teamMemoryServerStatus:void 0,sdkAgentProgressSummariesEnabled:!1,userMsgOptIn:!1,searchToolsOptIn:!1,clientType:"cli",sessionSource:void 0,sessionStartType:"fresh",questionPreviewFormat:void 0,sessionIngressToken:void 0,oauthTokenFromFd:void 0,oauthScopesFromFd:void 0,apiKeyFromFd:void 0,gatewayAuth:null,gatewayRefreshInFlight:null,flagSettingsPath:void 0,flagSettingsExpectedContent:void 0,flagSettingsInline:null,parentManagedSettings:null,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,statsStore:null,sessionId:La(),parentSessionId:void 0,loggerProvider:null,eventLogger:null,pendingOTelEvents:[],meterProvider:null,tracerProvider:null,cachedTelemetryResource:null,cachedOtlpHttpAgentFactory:null,agentColorMap:new Map,agentColorIndex:0,lastAPIRequest:null,lastCancelledAPIMessageId:null,lastAPIRequestMessages:null,lastClassifierRequests:null,cachedClaudeMdContent:null,inMemoryErrorLog:[],inlinePlugins:[],inlinePluginUrls:[],syncedPluginDirs:[],chromeFlagOverride:void 0,onboardingShownThisSession:!1,useCoworkPlugins:!1,disableSlashCommands:!1,sessionBypassPermissionsMode:!1,scheduledTasksEnabled:!1,sessionPrResolved:!1,sessionCronTasks:[],loopChainStartedAt:Object.create(null),loopTickInFlightPrompt:null,loopConsecutiveKeepalives:0,sessionCreatedTeams:new Set,sessionTrustAccepted:!1,sessionPersistenceDisabled:!1,hasExitedPlanMode:!1,needsPlanModeExitAttachment:!1,needsAutoModeExitAttachment:!1,lspRecommendationShownThisSession:!1,initJsonSchema:null,registeredHooks:null,planSlugCache:new Map,teleportedSessionInfo:null,invokedSkills:new Map,slowOperations:[],sdkBetas:void 0,sdkOAuthTokenRefreshCallback:null,hostAuthTokenRefreshCallback:null,mainThreadAgentType:void 0,mainThreadAgentHooks:void 0,sessionSkillAllowlist:void 0,caps:s2,replBridgeActive:!1,directConnectServerUrl:void 0,mcpConnectNonBlocking:!1,strictMcpConfig:!1,activeRoutine:void 0,systemPromptSectionCache:new Map,lastEmittedDate:null,additionalDirectoriesForClaudeMd:[],allowedChannels:[],activeInputs:new Map,hasDevChannels:!1,sessionProjectDir:null,promptCache1hAllowlist:null,stickyBetas:eT(),thinkingTypeOverrides:new Map,inferenceProfileBackingModels:new Map,promptId:null,promptIndex:0,lastMainRequestId:void 0,lastMainThreadCacheTtlMs:null,lastApiCompletionTimestamp:null,pendingPostCompaction:!1}}var c2=a2(),l2=()=>{return};function bh(){return l2()?.sessionId??c2.sessionId}var u2=dn(),kfe=u2.subscribe;function rT(e){return process.platform==="darwin"?e.normalize("NFC"):e}var d2=dn(),Efe=d2.subscribe;var p2=dn(),Tfe=p2.subscribe;var f2=dn();var Pfe=f2.subscribe;var m2=dn();var Ife=m2.subscribe;import{appendFile as hT,mkdir as N2,rename as yT,stat as D2,symlink as j2,unlink as wh}from"fs/promises";import{dirname as _T,join as Ih,resolve as bT}from"path";function nT({writeFn:e,flushIntervalMs:t=1000,maxBufferSize:r=100,maxBufferBytes:o=1/0,immediateMode:n=!1}){let i=[],s=0,a=null,c=null;function u(){if(a)clearTimeout(a),a=null}function d(g){try{e(g)}catch{}}function p(){if(c)d(c.join("")),c=null;if(i.length===0)return;d(i.join("")),i=[],s=0,u()}function f(){if(!a)a=setTimeout(p,t)}function m(){if(c){c.push(...i),i=[],s=0,u();return}let g=i;i=[],s=0,u(),c=g,setImmediate(()=>{let h=c;if(c=null,h)d(h.join(""))})}return{write(g){if(n){d(g);return}if(i.push(g),s+=g.length,f(),i.length>=r||s>=o)m()},flush:p,dispose(){p()}}}function g2(e){if(typeof e==="function")return e;if(Symbol.asyncDispose in e)return()=>e[Symbol.asyncDispose]();return()=>e[Symbol.dispose]()}class oT{#n=new Set;register(e){let t=g2(e);this.#n.add(t);let r=()=>{this.#n.delete(t)};return Object.assign(r,{[Symbol.dispose]:r})}async drain(){let e=Array.from(this.#n);this.#n.clear(),await Promise.all(e.map(async(t)=>t()))}async[Symbol.asyncDispose](){await this.drain()}get sizeForTesting(){return this.#n.size}}var h2=new oT;function iT(e){return h2.register(e)}var sT=Ce((e)=>{if(!e||e.trim()==="")return null;let t=e.split(",").map((i)=>i.trim()).filter(Boolean);if(t.length===0)return null;let r=t.some((i)=>i.startsWith("!")),o=t.some((i)=>!i.startsWith("!"));if(r&&o)return null;let n=t.map((i)=>i.replace(/^!/,"").toLowerCase());return{include:r?[]:n,exclude:r?n:[],isExclusive:r}});function y2(e){let t=[],r=e.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])t.push("mcp"),t.push(r[1].toLowerCase());else{let i=e.match(/^([^:[]+):/);if(i&&i[1])t.push(i[1].trim().toLowerCase())}let o=e.match(/^\[([^\]]+)]/);if(o&&o[1])t.push(o[1].trim().toLowerCase());if(e.toLowerCase().includes("1p event:"))t.push("1p");let n=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(n&&n[1]){let i=n[1].trim().toLowerCase();if(i.length<30&&!i.includes(" "))t.push(i)}return Array.from(new Set(t))}function b2(e,t){if(!t)return!0;if(e.length===0)return!1;if(t.isExclusive)return!e.some((r)=>t.exclude.includes(r));else return e.some((r)=>t.include.includes(r))}function aT(e,t){if(!t)return!0;let r=y2(e);return b2(r,t)}import*as Y from"fs";import{mkdir as _2,open as v2,readdir as S2,readFile as cT,rename as x2,rmdir as w2,rm as k2,stat as E2,unlink as T2}from"fs/promises";function pd(e,t){if(fw(t)&&!mw(t))return{resolvedPath:t,isSymlink:!1,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 P2={cwd(){return process.cwd()},existsSync(e){let r=[];try{const t=_e(r,Pe`fs.existsSync(${e})`,0);return Y.existsSync(e)}catch(o){var n=o,i=1}finally{ve(r,n,i)}},async stat(e){return E2(e)},async readdir(e){return S2(e,{withFileTypes:!0})},async unlink(e){return T2(e)},async rmdir(e){return w2(e)},async rm(e,t){return k2(e,t)},async mkdir(e,t){try{await _2(e,{recursive:!0,...t})}catch(r){if(Ge(r)!=="EEXIST")throw r}},async readFile(e,t){return cT(e,{encoding:t.encoding})},async rename(e,t){return x2(e,t)},statSync(e){let r=[];try{const t=_e(r,Pe`fs.statSync(${e})`,0);return Y.statSync(e)}catch(o){var n=o,i=1}finally{ve(r,n,i)}},lstatSync(e){let r=[];try{const t=_e(r,Pe`fs.lstatSync(${e})`,0);return Y.lstatSync(e)}catch(o){var n=o,i=1}finally{ve(r,n,i)}},readFileSync(e,t){let o=[];try{const r=_e(o,Pe`fs.readFileSync(${e})`,0);return Y.readFileSync(e,{encoding:t.encoding})}catch(n){var i=n,s=1}finally{ve(o,i,s)}},readFileBytesSync(e){let r=[];try{const t=_e(r,Pe`fs.readFileBytesSync(${e})`,0);return Y.readFileSync(e)}catch(o){var n=o,i=1}finally{ve(r,n,i)}},readSync(e,t){let n=[];try{const r=_e(n,Pe`fs.readSync(${e}, ${t.length} bytes)`,0);let o=void 0;try{o=Y.openSync(e,"r");let c=Buffer.alloc(t.length),u=Y.readSync(o,c,0,t.length,0);return{buffer:c,bytesRead:u}}finally{if(o)Y.closeSync(o)}}catch(i){var s=i,a=1}finally{ve(n,s,a)}},appendFileSync(e,t,r){let n=[];try{const o=_e(n,Pe`fs.appendFileSync(${e}, ${t.length} chars)`,0);if(r?.mode!==void 0)try{let c=Y.openSync(e,"ax",r.mode);try{Y.appendFileSync(c,t)}finally{Y.closeSync(c)}return}catch(c){if(Ge(c)!=="EEXIST")throw c}Y.appendFileSync(e,t)}catch(i){var s=i,a=1}finally{ve(n,s,a)}},copyFileSync(e,t){let o=[];try{const r=_e(o,Pe`fs.copyFileSync(${e} → ${t})`,0);Y.copyFileSync(e,t)}catch(n){var i=n,s=1}finally{ve(o,i,s)}},unlinkSync(e){let r=[];try{const t=_e(r,Pe`fs.unlinkSync(${e})`,0);Y.unlinkSync(e)}catch(o){var n=o,i=1}finally{ve(r,n,i)}},renameSync(e,t){let o=[];try{const r=_e(o,Pe`fs.renameSync(${e} → ${t})`,0);Y.renameSync(e,t)}catch(n){var i=n,s=1}finally{ve(o,i,s)}},linkSync(e,t){let o=[];try{const r=_e(o,Pe`fs.linkSync(${e} → ${t})`,0);Y.linkSync(e,t)}catch(n){var i=n,s=1}finally{ve(o,i,s)}},symlinkSync(e,t,r){let n=[];try{const o=_e(n,Pe`fs.symlinkSync(${e} → ${t})`,0);Y.symlinkSync(e,t,r)}catch(i){var s=i,a=1}finally{ve(n,s,a)}},readlinkSync(e){let r=[];try{const t=_e(r,Pe`fs.readlinkSync(${e})`,0);return Y.readlinkSync(e)}catch(o){var n=o,i=1}finally{ve(r,n,i)}},realpathSync(e){let r=[];try{const t=_e(r,Pe`fs.realpathSync(${e})`,0);return Ar(Y.realpathSync(e))}catch(o){var n=o,i=1}finally{ve(r,n,i)}},mkdirSync(e,t){let n=[];try{const r=_e(n,Pe`fs.mkdirSync(${e})`,0);let o={recursive:!0};if(t?.mode!==void 0)o.mode=t.mode;try{Y.mkdirSync(e,o)}catch(c){if(Ge(c)!=="EEXIST")throw c}}catch(i){var s=i,a=1}finally{ve(n,s,a)}},readdirSync(e){let r=[];try{const t=_e(r,Pe`fs.readdirSync(${e})`,0);return Y.readdirSync(e,{withFileTypes:!0})}catch(o){var n=o,i=1}finally{ve(r,n,i)}},readdirStringSync(e){let r=[];try{const t=_e(r,Pe`fs.readdirStringSync(${e})`,0);return Y.readdirSync(e)}catch(o){var n=o,i=1}finally{ve(r,n,i)}},isDirEmptySync(e){let o=[];try{const t=_e(o,Pe`fs.isDirEmptySync(${e})`,0);let r=this.readdirSync(e);return r.length===0}catch(n){var i=n,s=1}finally{ve(o,i,s)}},rmdirSync(e){let r=[];try{const t=_e(r,Pe`fs.rmdirSync(${e})`,0);Y.rmdirSync(e)}catch(o){var n=o,i=1}finally{ve(r,n,i)}},rmSync(e,t){let o=[];try{const r=_e(o,Pe`fs.rmSync(${e})`,0);Y.rmSync(e,t)}catch(n){var i=n,s=1}finally{ve(o,i,s)}},createWriteStream(e){return Y.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return cT(e);let r=await v2(e,"r");try{let{size:o}=await r.stat(),n=Math.min(o,t),i=Buffer.allocUnsafe(n),s=0;while(s<n){let{bytesRead:a}=await r.read(i,s,n-s,s);if(a===0)break;s+=a}return s<n?i.subarray(0,s):i}finally{await r.close()}}},I2=P2;function Fe(){return I2}function R2(e,t){if(e.destroyed)return;e.write(t)}function lT(e){R2(process.stderr,e)}function _h(e){return e.charAt(0).toUpperCase()+e.slice(1)}function uT(e,t,r=t+"s"){return e===1?t:r}var qfe=typeof String.prototype.isWellFormed==="function"?Function.prototype.call.bind(String.prototype.isWellFormed):void 0,Zfe=typeof String.prototype.toWellFormed==="function"?Function.prototype.call.bind(String.prototype.toWellFormed):void 0;function vh(e,t){let r=e.indexOf(t);return r===-1?e:e.slice(0,r)}var $2=/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,dT="[^\\s,;&}\\])]+",mT="-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\\s\\S-]{64,}?-----END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----",O2=`[^\\s-]{0,4}${mT}['"\`]?`,pT=`\\[REDACTED\\]|"[^"]*"|'[^']*'|(?:Bearer|Basic)\\s+(?:\\[REDACTED\\]|${dT})|${O2}|${dT}`,A2=["sk","ant","api"].join("-"),C2=[{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:`(?:${$2.source})[\\w.-]*["']?\\s*[=:]\\s*(${pT})`,flags:"i",confidence:"low"},{id:"cloud-env-var",source:`\\b(?:AWS|GOOGLE|GCP|GCLOUD|AZURE)_\\w+\\s*[=:]\\s*(${pT})`,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})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,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(${A2}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:"openai-api-key",source:`\\b(sk-(?:proj|svcacct|admin)-(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})T3BlbkFJ(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})\\b|sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"huggingface-access-token",source:`\\b(hf_[a-zA-Z]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,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-[\\w-]{20}",confidence:"high"},{id:"gitlab-deploy-token",source:"gldt-[0-9a-zA-Z_\\-]{20}",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[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}",confidence:"high"},{id:"slack-app-token",source:"xapp-\\d-[A-Z0-9]+-\\d+-[a-z0-9]+",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"},{id:"private-key",source:mT,flags:"i",confidence:"high"}];var fT=null;function M2(e){return C2.map((t)=>({id:t.id,confidence:t.confidence,re:new RegExp(t.source,e?(t.flags??"").replace("g","")+"g":t.flags??"")}))}function gT(e){fT??=M2(!0);for(let t of fT)e=e.replace(t.re,(r,o)=>{if(typeof o!=="string")return"[REDACTED]";let n=o.length>=2&&(o[0]==='"'||o[0]==="'")&&o.at(-1)===o[0]?o[0]:"",i=r.lastIndexOf(o);return`${r.slice(0,i)}${n}[REDACTED]${n}${r.slice(i+o.length)}`});return e}var kh={verbose:0,debug:1,info:2,warn:3,error:4},z2=Ce(()=>{let e=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();if(e&&Object.hasOwn(kh,e))return e;return"debug"}),U2=!1;function md(){return typeof process<"u"&&Array.isArray(process.argv)?process.argv:[]}var Eh=Ce(()=>{let e=md();return U2||Ee(process.env.DEBUG)||Ee(process.env.DEBUG_SDK)||e.includes("--debug")||e.includes("-d")||vT()||e.some((t)=>t.startsWith("--debug="))||ST()!==null});var L2=Ce(()=>{let e=md().find((r)=>r.startsWith("--debug="));if(!e)return null;let t=e.substring(8);return sT(t)}),vT=Ce(()=>{let e=md();return e.includes("--debug-to-stderr")||e.includes("-d2e")}),ST=Ce(()=>{let e=md();for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("--debug-file="))return bT(r.substring(13));if(r==="--debug-file"&&t+1<e.length)return bT(e[t+1])}return null});function F2(e){if(!Eh())return!1;if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let t=L2();return aT(e,t)}var H2=!1;var B2=10485760,fd=null,Sh=Promise.resolve(),Fa=-1,xh=!1,Th=null;async function xT(e,t,r=B2){if(Fa<0)Fa=await D2(e).then((o)=>o.size).catch(()=>0);else Fa+=t;if(Fa<=r||xh)return;xh=!0;try{let o=e.endsWith(".txt")?`${e.slice(0,-4)}.1.txt`:`${e}.1`;try{await yT(e,o)}catch(n){if(!Sn(n))await wh(o).catch(()=>{}),await yT(e,o).catch(()=>wh(e).catch(()=>{}))}Fa=0}finally{xh=!1}}function wT(e){return Th=Ih(e,`${bh()}.txt`),Th}async function q2(e,t,r,o){if(e)await N2(t,{recursive:!0}).catch(()=>{});let n=r;try{await hT(r,o)}catch(i){if(!lh(i))throw i;n=wT(r),await hT(n,o)}await xT(n,Buffer.byteLength(o)).catch(Ph),ET()}function Ph(){}function Z2(){if(!fd){let e=null;fd=nT({writeFn:(t)=>{let r=kT(),o=_T(r),n=e!==o;if(e=o,Eh()){if(n)try{Fe().mkdirSync(o)}catch{}let i=r;try{Fe().appendFileSync(r,t)}catch(s){if(!lh(s))throw s;i=wT(r),Fe().appendFileSync(i,t)}xT(i,Buffer.byteLength(t)).catch(Ph),ET();return}Sh=Sh.then(q2.bind(null,n,o,r,t)).catch(Ph)},flushIntervalMs:1000,maxBufferSize:100,immediateMode:Eh()}),iT(async()=>{fd?.dispose(),await Sh})}return fd}function ne(e,{level:t}={level:"debug"}){if(kh[t]<kh[z2()])return;if(!F2(e))return;if(H2&&e.includes(`
59
+ `))e=pe(e);let o=`${new Date().toISOString()} [${t.toUpperCase()}] ${gT(e.trim())}
60
+ `;if(vT()){lT(o);return}Z2().write(o)}function kT(){return ST()??Th??process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??Ih(qt(),"debug",`${bh()}.txt`)}var ET=Ce(async()=>{try{let e=kT(),t=_T(e),r=Ih(t,"latest");await wh(r).catch(()=>{}),await j2(e,r)}catch{}});var fme=(()=>{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 V2={[Symbol.dispose](){}};function W2(){return V2}var Pe=W2;function pe(e,t,r){let n=[];try{const o=_e(n,Pe`JSON.stringify(${e})`,0);return JSON.stringify(e,t,r)}catch(i){var s=i,a=1}finally{ve(n,s,a)}}var Ze=(e,t)=>{let o=[];try{const r=_e(o,Pe`JSON.parse(${e})`,0);return typeof t>"u"?JSON.parse(e):JSON.parse(e,t)}catch(n){var i=n,s=1}finally{ve(o,i,s)}};function TT(e){return JSON.parse(e)}function Tr(e,t){let o=[];try{const r=_e(o,Pe`structuredClone(${e})`,0);return structuredClone(e,t)}catch(n){var i=n,s=1}finally{ve(o,i,s)}}function K2(e){let t=e.trim();return t.startsWith("{")&&t.endsWith("}")}function PT(e,t){let r={...e};if(t){let o=t.enabled===!0&&t.failIfUnavailable===void 0?{...t,failIfUnavailable:!0}:t,n=r.settings;if(n&&!K2(n))throw Error("Cannot use both a settings file path and the sandbox option. Include the sandbox configuration in your settings file instead.");let i={sandbox:o};if(n)try{i={...Ze(n),sandbox:o}}catch{}r.settings=pe(i)}return r}var Y2=2000,gd=new Set,IT=!1;function Q2(){for(let e of gd)if(!e.killed)if(process.platform==="win32")try{e.stdin.end()}catch{}else e.kill("SIGTERM")}function eH(e){if(gd.add(e),!IT)IT=!0,process.on("exit",Q2)}class Rh{options;process;processStdin;processStdout;ready=!1;abortController;exitError;exitListeners=[];abortHandler;forwardedAbort=Fs();pendingWrites=[];pendingEndInput=!1;spawnResolve;spawnReject;spawnPromise;constructor(e){this.options=e;if(this.abortController=e.abortController||Fs(),e.deferSpawn)this.spawnPromise=new Promise((t,r)=>{this.spawnResolve=t,this.spawnReject=r}),this.spawnPromise.catch(()=>{});else this.initialize()}spawn(){try{this.initialize()}catch(t){throw this.spawnAbort(Er(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 gu()?"bun":"node"}spawnLocalProcess(e){let{command:t,args:r,cwd:o,env:n,signal:i}=e,s=Ee(n.DEBUG_CLAUDE_AGENT_SDK)||this.options.stderr?"pipe":"ignore",a=G2(t,r,{cwd:o,stdio:["pipe","pipe",s],signal:i,env:n,windowsHide:!0});if(Ee(n.DEBUG_CLAUDE_AGENT_SDK)||this.options.stderr)a.stderr.on("data",(u)=>{let d=u.toString();if(St(d),this.options.stderr)this.options.stderr(d)});return{stdin:a.stdin,stdout:a.stdout,get killed(){return a.killed},get exitCode(){return a.exitCode},kill:a.kill.bind(a),on:a.on.bind(a),once:a.once.bind(a),off:a.off.bind(a)}}initialize(){try{let{additionalDirectories:e=[],agent:t,betas:r,cwd:o,executable:n=this.getDefaultExecutable(),executableArgs:i=[],extraArgs:s={},pathToClaudeCodeExecutable:a,env:c={...process.env},thinkingConfig:u,maxTurns:d,maxBudgetUsd:p,taskBudget:f,model:m,fallbackModel:g,jsonSchema:h,permissionMode:y,allowDangerouslySkipPermissions:v,permissionPromptToolName:x,continueConversation:w,resume:O,settingSources:L,skills:se,disallowedTools:Ue=[],tools:Ye,mcpServers:Ft,strictMcpConfig:bt,canUseTool:to,includePartialMessages:Go,plugins:Or,sandbox:Ms}=this.options,{allowedTools:ln=[]}=this.options;if(se!==void 0){let qe=se==="all"?["Skill"]:se.map((Qe)=>`Skill(${Qe})`),nr=new Set(ln);ln=[...ln,...qe.filter((Qe)=>!nr.has(Qe))]}let V=["--output-format","stream-json","--verbose","--input-format","stream-json"];if(u){switch(u.type){case"enabled":if(u.budgetTokens===void 0)V.push("--thinking","adaptive");else V.push("--max-thinking-tokens",u.budgetTokens.toString());break;case"disabled":V.push("--thinking","disabled");break;case"adaptive":V.push("--thinking","adaptive");break}if(u.type!=="disabled"&&u.display)V.push("--thinking-display",u.display)}if(this.options.effort)V.push("--effort",this.options.effort);if(d)V.push("--max-turns",d.toString());if(p!==void 0)V.push("--max-budget-usd",p.toString());if(f)V.push("--task-budget",f.total.toString());if(m)V.push("--model",m);if(t)V.push("--agent",t);if(r&&r.length>0)V.push("--betas",r.join(","));if(h)V.push("--json-schema",pe(h));if(this.options.debugFile)V.push("--debug-file",this.options.debugFile);else if(this.options.debug)V.push("--debug");if(!this.options.debugFile&&!this.options.spawnClaudeCodeProcess){let qe=tE();if(qe)V.push("--debug-file",qe)}if(to){if(x)throw Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");V.push("--permission-prompt-tool","stdio")}else if(x)V.push("--permission-prompt-tool",x);if(w)V.push("--continue");if(O)V.push("--resume",O);if(this.options.assistant)V.push("--assistant");if(this.options.channels&&this.options.channels.length>0)V.push("--channels",...this.options.channels);if(ln.length>0)V.push("--allowedTools",ln.join(","));if(Ue.length>0)V.push("--disallowedTools",Ue.join(","));if(Ye!==void 0)if(Array.isArray(Ye))if(Ye.length===0)V.push("--tools","");else V.push("--tools",Ye.join(","));else V.push("--tools","default");if(Ft&&Object.keys(Ft).length>0)V.push("--mcp-config",pe({mcpServers:Ft}));if(L!==void 0)V.push(`--setting-sources=${L.join(",")}`);if(bt)V.push("--strict-mcp-config");if(y)V.push("--permission-mode",y);if(v)V.push("--allow-dangerously-skip-permissions");if(g){if(m&&g===m)throw Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");V.push("--fallback-model",g)}if(this.options.includeHookEvents)V.push("--include-hook-events");if(Go)V.push("--include-partial-messages");if(this.options.sessionMirror)V.push("--session-mirror");for(let qe of e)V.push("--add-dir",qe);if(Or&&Or.length>0)for(let qe of Or)if(qe.type==="local")V.push("--plugin-dir",qe.path);else throw Error(`Unsupported plugin type: ${qe.type}`);if(this.options.forkSession)V.push("--fork-session");if(this.options.resumeSessionAt)V.push("--resume-session-at",this.options.resumeSessionAt);if(this.options.sessionId)V.push("--session-id",this.options.sessionId);if(this.options.persistSession===!1)V.push("--no-session-persistence");if(this.options.managedSettings)V.push("--managed-settings",this.options.managedSettings);let uu={...s??{}};if(this.options.settings)uu.settings=this.options.settings;let du=PT(uu,Ms);for(let[qe,nr]of Object.entries(du))if(nr===null)V.push(`--${qe}`);else V.push(`--${qe}`,nr);if(!c.CLAUDE_CODE_ENTRYPOINT)c.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(delete c.NODE_OPTIONS,Ee(c.DEBUG_CLAUDE_AGENT_SDK))c.DEBUG="1";else delete c.DEBUG;let Ns=tH(a),Ds=Ns?a:n,js=Ns?[...i,...V]:[...i,a,...V],pu={command:Ds,args:js,cwd:o,env:c,signal:this.forwardedAbort.signal};if(this.options.spawnClaudeCodeProcess)St(`Spawning Claude Code (custom): ${Ds} ${js.join(" ")}`),this.process=this.options.spawnClaudeCodeProcess(pu);else St(`Spawning Claude Code: ${Ds} ${js.join(" ")}`),this.process=this.spawnLocalProcess(pu);if(this.processStdin=this.process.stdin,this.processStdout=this.process.stdout,eH(this.process),this.abortHandler=()=>this.close(),this.abortController.signal.addEventListener("abort",this.abortHandler),this.abortController.signal.aborted)this.close();this.process.on("error",(qe)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new it("Claude Code process aborted by user");else if(Kk(qe)){let nr=rH(a,Ns);this.exitError=ReferenceError(nr),St(this.exitError.message)}else this.exitError=Error(`Failed to spawn Claude Code process: ${qe.message}`),St(this.exitError.message)}),this.process.on("exit",(qe,nr)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new it("Claude Code process aborted by user");else{let Qe=this.getProcessExitError(qe,nr);if(Qe)this.exitError=Qe,St(Qe.message)}}),this.ready=!this.abortController.signal.aborted}catch(e){throw this.ready=!1,e}}getProcessExitError(e,t){if(e!==0&&e!==null)return Error(`Claude Code process exited with code ${e}`);else if(t)return Error(`Claude Code process terminated by signal ${t}`);return}write(e){if(this.abortController.signal.aborted)throw new it("Operation aborted");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){St("[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 Error(`Cannot write to process that exited with error: ${this.exitError.message}`);St(`[ProcessTransport] Writing to stdin: ${e.substring(0,100)}`);try{if(!this.processStdin.write(e))St("[ProcessTransport] Write buffer full, data queued")}catch(t){throw this.ready=!1,Error(`Failed to write to process stdin: ${yi(t)}`)}}[Symbol.dispose](){this.close()}close(){if(this.spawnAbort(this.abortController.signal.aborted?new it("Claude Code process aborted by user"):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;for(let{handler:r}of this.exitListeners)this.process?.off("exit",r);this.exitListeners=[];let e=()=>{if(this.abortController.signal.aborted)this.forwardedAbort.abort(this.abortController.signal.reason)},t=this.process;if(t&&!t.killed&&t.exitCode===null)setTimeout((r,o)=>{if(r.exitCode!==null){o();return}if(process.platform==="win32"){setTimeout((n,i)=>{if(n.exitCode===null)n.kill("SIGKILL");i()},5000,r,o).unref();return}r.kill("SIGTERM"),setTimeout((n)=>{if(n.exitCode===null)n.kill("SIGKILL")},5000,r).unref(),o()},Y2,t,e).unref(),t.once("exit",()=>gd.delete(t));else if(t)gd.delete(t),e();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=X2({input:this.processStdout}),t=this.process?(()=>{let r=this.process,o=()=>e.close();return r.on("error",o),()=>r.off("error",o)})():void 0;if(this.exitError)e.close();try{for await(let r of e)if(r.trim()){let o;try{o=Ze(r)}catch(n){St(`Non-JSON stdout: ${r}`);continue}yield o}if(this.exitError)throw this.exitError;await this.waitForExit()}catch(r){throw r}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=(r,o)=>{let n=this.getProcessExitError(r,o);e(n)};return this.process.on("exit",t),this.exitListeners.push({callback:e,handler:t}),()=>{if(this.process)this.process.off("exit",t);let r=this.exitListeners.findIndex((o)=>o.handler===t);if(r!==-1)this.exitListeners.splice(r,1)}}async waitForExit(){if(!this.process){if(this.exitError)throw this.exitError;return}if(this.process.exitCode!==null||this.process.killed||this.exitError){if(this.exitError)throw this.exitError;return}return new Promise((e,t)=>{let r=(n,i)=>{if(this.abortController.signal.aborted){t(new it("Operation aborted"));return}let s=this.getProcessExitError(n,i);if(s)t(s);else e()};this.process.once("exit",r);let o=(n)=>{this.process.off("exit",r),t(n)};this.process.once("error",o),this.process.once("exit",()=>{this.process.off("error",o)})})}}function tH(e){return![".js",".mjs",".tsx",".ts",".jsx"].some((r)=>e.endsWith(r))}function rH(e,t){if(J2(e))return t?`Claude Code native binary at ${e} exists but failed to launch.`:`Claude Code executable at ${e} exists but failed to launch.`;return t?`Claude Code native binary not found at ${e}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${e}. Is options.pathToClaudeCodeExecutable set?`}import{existsSync as nH}from"fs";var Pi="@anthropic-ai/claude-agent-sdk";function oH(){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 RT(e,t=process.platform,r=process.arch,o=nH,n=oH()){let s=t==="win32"?".exe":"",c=(t==="android"?[`${Pi}-linux-${r}-android`]:t==="linux"?n?[`${Pi}-linux-${r}-musl`,`${Pi}-linux-${r}`]:[`${Pi}-linux-${r}`,`${Pi}-linux-${r}-musl`]:[`${Pi}-${t}-${r}`]).map((u)=>`${u}/claude${s}`);for(let u of c)try{let d=e(u);if(o(d))return d}catch{}return null}class Ha{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})}}function iH(){return{eventQueue:[],sink:null}}var sH=iH();function hd(e,t){let r=sH;if(r.sink===null){r.eventQueue.push({eventName:e,metadata:t,async:!1});return}r.sink.logEvent(e,t)}function aH(e){return e}function yd(e){return aH(e)}function $h(e){hd("tengu_feature_ok",{feature_name:yd(e)})}function Oh(e,t,r){hd("tengu_feature_bad",{feature_name:yd(e),error_code:t,...r})}function $T(e,t,r){hd("tengu_feature_sad",{feature_name:yd(e),error_code:t,...r})}async function ar(e,t,r){try{let o=await t();return $h(e),o}catch(o){throw Oh(e,r?.(o)??"error"),o}}class Ah{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?.()}}class Ch{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;onElicitation;getOAuthToken;getHostAuthToken;onUserDialog;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new Ha;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;sdkMcpTransports=new Map;sdkMcpServerInstances=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;lastErrorResultText;transcriptMirrorBatcher;cleanupCallbacks=[];cleanupPromise;setIsSingleUserTurn(e){this.isSingleUserTurn=e}setTranscriptMirrorBatcher(e){this.transcriptMirrorBatcher=e}reportMirrorError(e,t){let r={type:"system",subtype:"mirror_error",error:t,key:e,uuid:La(),session_id:e.sessionId};this.inputStream.enqueue(r)}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,r,o,n,i=new Map,s,a,c,u,d,p){this.transport=e;this.isSingleUserTurn=t;this.canUseTool=r;this.hooks=o;this.abortController=n;this.jsonSchema=s;this.initConfig=a;this.onElicitation=c;this.getOAuthToken=u;this.getHostAuthToken=d;this.onUserDialog=p;for(let[f,m]of i)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 r of this.cancelControllers.values())r.abort();this.cancelControllers.clear(),this.transport.close();let t=e??Error("Query closed before response received");for(let{reject:r}of this.pendingControlResponses.values())r(t);this.pendingControlResponses.clear();for(let{reject:r}of this.pendingMcpResponses.values())r(t);this.pendingMcpResponses.clear(),this.hookCallbacks.clear();for(let r of this.sdkMcpTransports.values())r.close().catch(()=>{});if(this.sdkMcpTransports.clear(),e)this.inputStream.error(e);else this.inputStream.done()}catch(t){}}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);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==="post_turn_summary"||e.subtype==="task_summary")){this.inputStream.enqueue(e);continue}if(e.type==="result"){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.lastErrorResultText=e.is_error?e.subtype==="success"?e.result:e.errors.join("; "):void 0,this.firstResultReceived=!0,this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.isSingleUserTurn)ne("[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 it)){let t=Error(`Claude Code returned an error result: ${this.lastErrorResultText}`);ne(`[Query.readMessages] Replacing exit error with result text. Original: ${yi(e)}`),this.inputStream.error(t),this.cleanup(t);return}this.inputStream.error(e),this.cleanup(e)}}async handleControlRequest(e){let t=new AbortController;this.cancelControllers.set(e.request_id,t);try{let r=await this.processControlRequest(e,t.signal);if(this.cleanupPerformed)return;let o={type:"control_response",response:{subtype:"success",request_id:e.request_id,response:r}};await Promise.resolve(this.transport.write(pe(o)+`
61
61
  `))}catch(r){if(this.cleanupPerformed)return;let o={type:"control_response",response:{subtype:"error",request_id:e.request_id,error:yi(r)}};try{await Promise.resolve(this.transport.write(pe(o)+`
62
62
  `))}catch(n){ne(`[Query.handleControlRequest] Error-response write failed: ${yi(n)}`,{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.");return{...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}),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 r=e.request,o=this.sdkMcpTransports.get(r.server_name);if(!o)throw Error(`SDK MCP server not found: ${r.server_name}`);if("method"in r.message&&"id"in r.message&&r.message.id!==null)return{mcp_response:await this.handleMcpControlRequest(r.server_name,r,o)};else{if(o.onmessage)o.onmessage(r.message);return{mcp_response:{jsonrpc:"2.0",result:{},id:0}}}}else if(e.request.subtype==="elicitation"){let r=e.request;if(this.onElicitation)return await this.onElicitation({serverName:r.mcp_server_name,message:r.message,mode:r.mode,url:r.url,elicitationId:r.elicitation_id,requestedSchema:r.requested_schema,title:r.title,displayName:r.display_name,description:r.description},{signal:t});return{action:"decline"}}else if(e.request.subtype==="request_user_dialog"){if(this.onUserDialog)return await this.onUserDialog({dialogKind:e.request.dialog_kind,payload:e.request.payload,toolUseID:e.request.tool_use_id},{signal:t});return{behavior:"cancelled"}}else if(e.request.subtype==="oauth_token_refresh"){if(!this.getOAuthToken)throw Error("getOAuthToken callback is not provided.");return{accessToken:await this.getOAuthToken({signal:t})??null}}else if(e.request.subtype==="host_auth_token_refresh"){if(!this.getHostAuthToken)throw Error("getHostAuthToken callback is not provided.");return{authToken:await this.getHostAuthToken({signal:t})??null}}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(){let e;if(this.hooks){e={};for(let[n,i]of Object.entries(this.hooks))if(i.length>0)e[n]=i.map((s)=>{let a=[];for(let c of s.hooks){let u=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(u,c),a.push(u)}return{matcher:s.matcher,hookCallbackIds:a,timeout:s.timeout}})}let t=this.sdkMcpTransports.size>0?Array.from(this.sdkMcpTransports.keys()):void 0,r={subtype:"initialize",hooks:e,sdkMcpServers:t,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};return(await this.request(r)).response}async interrupt(){return ar("sdk_interrupt",async()=>{await this.request({subtype:"interrupt"})})}async setPermissionMode(e){await this.request({subtype:"set_permission_mode",mode:e})}async setModel(e){await this.request({subtype:"set_model",model:e})}async setMaxThinkingTokens(e){await this.request({subtype:"set_max_thinking_tokens",max_thinking_tokens:e})}async applyFlagSettings(e){return ar("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 ar("sdk_rewind_files",async()=>{return(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 enableRemoteControl(e,t){return(await this.request({subtype:"remote_control",enabled:e,...t!==void 0&&{name:t}})).response}async submitFeedback(e,t){return(await this.request({subtype:"submit_feedback",description:e,surface:t?.surface})).response}async generateSessionTitle(e,t){return ar("sdk_session_title_generate",async()=>{return(await this.request({subtype:"generate_session_title",description:e,persist:t?.persist})).response.title})}async askSideQuestion(e){return ar("sdk_side_question",async()=>{let r=(await this.request({subtype:"side_question",question:e})).response;return r.response===null?null:{response:r.response,synthetic:r.synthetic??!1}})}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(()=>{})}request(e){let t=Math.random().toString(36).substring(2,15),r={request_id:t,type:"control_request",request:e};return new Promise((o,n)=>{this.pendingControlResponses.set(t,{handler:(i)=>{if(this.pendingControlResponses.delete(t),i.subtype==="success")o(i);else n(Error(i.error));if(i.pending_permission_requests)this.processPendingPermissionRequests(i.pending_permission_requests)},reject:n}),Promise.resolve(this.transport.write(pe(r)+`
63
63
  `)).catch((i)=>{this.pendingControlResponses.delete(t),n(i)})})}initializationResult(){return this.initialization}async supportedCommands(){return(await this.initialization).commands}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 ar("sdk_mcp_toggle_server",async()=>{await this.request({subtype:"mcp_toggle",serverName:e,enabled:t})})}async enableChannel(e){return ar("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 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 ar("sdk_reload_plugins",async()=>{return(await this.request({subtype:"reload_plugins"})).response})}async reloadSkills(){return ar("sdk_reload_skills",async()=>{return(await this.request({subtype:"reload_skills"})).response})}async setMcpServers(e){return ar("sdk_mcp_set_servers",async()=>{let t={},r={};for(let[a,c]of Object.entries(e))if(c.type==="sdk"&&"instance"in c)t[a]=c.instance;else r[a]=c;let o=new Set(this.sdkMcpServerInstances.keys()),n=new Set(Object.keys(t));for(let a of o)if(!n.has(a))await this.disconnectSdkMcpServer(a);for(let[a,c]of Object.entries(t))if(!o.has(a))this.connectSdkMcpServer(a,c);let i={};for(let a of Object.keys(t))i[a]={type:"sdk",name:a};return(await this.request({subtype:"mcp_set_servers",servers:{...r,...i}})).response})}async accountInfo(){return(await this.initialization).account}async streamInput(e){ne("[Query.streamInput] Starting to process input stream");try{let t=0;for await(let r of e){if(t++,ne(`[Query.streamInput] Processing message ${t}: ${r.type}`),this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(pe(r)+`
64
- `))}if(ne(`[Query.streamInput] Finished processing ${t} messages from input stream`),t>0&&this.hasBidirectionalNeeds())ne("[Query.streamInput] Has bidirectional needs, waiting for first result"),await this.waitForFirstResult();ne("[Query] Calling transport.endInput() to close stdin to CLI process"),this.transport.endInput()}catch(t){if(!(t instanceof it))throw t}}waitForFirstResult(){if(this.firstResultReceived)return ne("[Query.waitForFirstResult] Result already received, returning immediately"),Promise.resolve();return new Promise((e)=>{if(this.abortController?.signal.aborted){e();return}this.abortController?.signal.addEventListener("abort",()=>e(),{once:!0}),this.firstResultReceivedResolve=e})}handleHookCallbacks(e,t,r,o){let n=this.hookCallbacks.get(e);if(!n)throw Error(`No hook callback found for ID: ${e}`);return n(t,r,{signal:o})}connectSdkMcpServer(e,t){let r=new Oh((o)=>this.sendMcpServerMessageToCli(e,o));this.sdkMcpTransports.set(e,r),this.sdkMcpServerInstances.set(e,t),t.connect(r).catch((o)=>{if(this.sdkMcpTransports.get(e)===r)this.sdkMcpTransports.delete(e);if(this.sdkMcpServerInstances.get(e)===t)this.sdkMcpServerInstances.delete(e);ne(`[Query.connectSdkMcpServer] Failed to connect MCP server '${e}': ${o}`,{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 o=`${e}:${t.id}`,n=this.pendingMcpResponses.get(o);if(n){n.resolve(t),this.pendingMcpResponses.delete(o);return}}let r={type:"control_request",request_id:La(),request:{subtype:"mcp_message",server_name:e,message:t}};Promise.resolve(this.transport.write(pe(r)+`
65
- `)).catch((o)=>{ne(`[Query.sendMcpServerMessageToCli] Transport write failed: ${o}`,{level:"error"})})}handleMcpControlRequest(e,t,r){let o="id"in t.message?t.message.id:null,n=`${e}:${o}`;return new Promise((i,s)=>{let a=()=>{this.pendingMcpResponses.delete(n)},c=(d)=>{a(),i(d)},u=(d)=>{a(),s(d)};if(this.pendingMcpResponses.set(n,{resolve:c,reject:u}),r.onmessage)r.onmessage(t.message);else{a(),s(Error("No message handler registered"));return}})}}var yd=500,bd=1048576;var tH=[200,800];class Ch{send;sendTimeoutMs;onError;maxPendingEntries;maxPendingBytes;backoffMs;pending=[];pendingEntries=0;pendingBytes=0;flushPromise=null;constructor(e,t=60000,r,o=yd,n=bd,i=tH){this.send=e;this.sendTimeoutMs=t;this.onError=r;this.maxPendingEntries=o;this.maxPendingBytes=n;this.backoffMs=i}enqueue(e,t){let r=pe(t).length;if(this.pending.push({filePath:e,entries:t,bytes:r}),this.pendingEntries+=t.length,this.pendingBytes+=r,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 o of e){let n=t.get(o.filePath);if(n)n.push(...o.entries);else t.set(o.filePath,o.entries.slice())}let r=this.backoffMs.length+1;for(let[o,n]of t){let i=`SessionStore.append() timed out after ${this.sendTimeoutMs}ms for ${o}`,s,a=1;for(;a<=r;a++)try{await Cr(this.send(o,n),this.sendTimeoutMs,i),s=void 0;break}catch(c){if(s=kr(c),s.message===i)break;let u=this.backoffMs[a-1];if(u===void 0)break;await pu(u)}if(s){ne(`[TranscriptMirrorBatcher] flush failed for ${o} after ${a} attempt(s): ${s}`,{level:"error"});try{this.onError?.(o,s)}catch(c){ne(`[TranscriptMirrorBatcher] onError callback threw: ${c}`,{level:"error"})}}}}}var gg=xg(k0(),1);function bq(e){let t=e,r="",o=0,n=10;while(t!==r&&o<n)r=t,t=t.normalize("NFKC"),t=t.replace(/[\p{Cf}\p{Co}\p{Cn}]/gu,""),t=t.replace(/[\u200B-\u200F]/g,"").replace(/[\u202A-\u202E]/g,"").replace(/[\u2066-\u2069]/g,"").replace(/[\uFEFF]/g,"").replace(/[\uE000-\uF8FF]/g,""),o++;if(o>=n)throw Error(`Unicode sanitization reached maximum iterations (${n}) for input: ${e.slice(0,100)}`);return t}function _o(e){if(typeof e==="string")return bq(e);if(Array.isArray(e))return e.map(_o);if(e!==null&&typeof e==="object"){let t={};for(let[r,o]of Object.entries(e))t[_o(r)]=_o(o);return t}return e}import{readFile as Zq}from"fs/promises";import{once as E0}from"events";import{createWriteStream as Iq}from"fs";import{open as P0,readdir as Ry,realpath as Rq,stat as $q}from"fs/promises";import{dirname as Phe,join as Ga}from"path";import{execFile as Tq}from"child_process";import{promisify as Eq}from"util";import{execFileSync as _q}from"child_process";import{join as vq}from"path";function Sq(){return process.platform==="win32"}var Py=new Map,xq=5000;function wq(e){let t=Py.get(e);if(t!==void 0)return t;let r=process.env.SYSTEMROOT||"C:\\Windows",o=vq(r,"System32","where.exe");try{let i=_q(o,[e],{stdio:"pipe",encoding:"utf8",timeout:xq,windowsHide:!0,env:process.env}).trim().split(/\r?\n/).filter(Boolean),s=process.cwd();for(let a of i){if(fw(a,s))continue;return Py.set(e,a),a}return null}catch(n){if(kq(n))Py.set(e,null);return null}}function kq(e){if(e===null||typeof e!=="object")return!1;let t="status"in e?e.status:void 0,r="signal"in e?e.signal:void 0,o="code"in e?e.code:void 0;return t===1&&!r&&!o}function T0(e){if(!Sq())return e;if(e.includes("/")||e.includes("\\"))return e;return wq(e)}var Pq=Eq(Tq);async function Hr(e){let t=T0("git");if(t===null)return[];try{let{stdout:r}=await Pq(t,["worktree","list","--porcelain"],{cwd:e,timeout:5000});if(!r)return[];return r.split(`
66
- `).filter((o)=>o.startsWith("worktree ")).map((o)=>Ar(o.slice(9)))}catch{return[]}}function Iy(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return t}var cr=65536,Oq=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Se(e){if(typeof e!=="string")return null;return Oq.test(e)?e:null}function I0(e){if(!e.includes("\\"))return e;try{return JSON.parse(`"${e}"`)}catch{return e}}function Id(e,t){let r=[`"${t}":"`,`"${t}": "`];for(let o of r){let n=e.indexOf(o);if(n<0)continue;let i=n+o.length,s=i;while(s<e.length){if(e[s]==="\\"){s+=2;continue}if(e[s]==='"')return I0(e.slice(i,s));s++}}return}function wt(e,t){let r=[`"${t}":"`,`"${t}": "`],o,n=-1;for(let i of r){let s=0;while(!0){let a=e.indexOf(i,s);if(a<0)break;let c=a+i.length,u=c;while(u<e.length){if(e[u]==="\\"){u+=2;continue}if(e[u]==='"'){if(a>n)o=I0(e.slice(c,u)),n=a;break}u++}s=u+1}}return o}async function Xa(e,t){let r=Iq(e,{mode:384});try{for(let o of t)if(!r.write(JSON.stringify(o)+`
67
- `))await E0(r,"drain");r.end(),await E0(r,"finish")}catch(o){throw r.destroy(),o}}function Rd(e){let t=0,r={commandFallback:""};while(t<e.length){let o=e.indexOf(`
68
- `,t),n=o>=0?e.slice(t,o):e.slice(t);if(t=o>=0?o+1:e.length,!n.includes('"type":"user"')&&!n.includes('"type": "user"'))continue;if(n.includes('"tool_result"'))continue;if(n.includes('"isMeta":true')||n.includes('"isMeta": true'))continue;if(n.includes('"isCompactSummary":true')||n.includes('"isCompactSummary": true'))continue;try{let i=JSON.parse(n),s=Hs(i,r);if(s!==void 0)return s}catch{continue}}return r.commandFallback}function R0(e){let t={commandFallback:""};for(let r of e){if(typeof r!=="object"||r===null)continue;let o=Hs(r,t);if(o!==void 0)return o}return t.commandFallback}async function $d(e){try{let t=await P0(e,"r");try{let r=await t.stat(),o=Buffer.allocUnsafe(cr),n=await t.read(o,0,cr,0);if(n.bytesRead===0)return null;let i=o.toString("utf8",0,n.bytesRead),s=Math.max(0,r.size-cr),a=i;if(s>0){let c=await t.read(o,0,cr,s);a=o.toString("utf8",0,c.bytesRead)}return{mtime:r.mtime.getTime(),size:r.size,head:i,tail:a}}finally{await t.close()}}catch{return null}}var Ai=200;function Aq(e){return Math.abs(Iy(e)).toString(36)}function So(e){let t=e.replace(/[^a-zA-Z0-9]/g,"-");if(t.length<=Ai)return t;return`${t.slice(0,Ai)}-${Aq(e)}`}function lr(){return Ga(qt(),"projects")}function Cq(e){return Ga(lr(),So(e))}async function xn(e){try{return Ar(await Rq(e))}catch{return Ar(e)}}async function xt(e){let t=Cq(e),r=[];try{await Ry(t),r.push(t)}catch{}let o=So(e);if(o.length<=Ai)return r;let n=o.slice(0,Ai)+"-",i=lr();try{for(let s of await Ry(i,{withFileTypes:!0})){if(!s.isDirectory()||!s.name.startsWith(n))continue;let a=Ga(i,s.name);if(a!==t)r.push(a)}}catch{}return r}async function wn(e,t){let r=`${e}.jsonl`;async function o(s,a){let c=Ga(s,r);try{let u=await $q(c);if(u.size>0)return{filePath:c,projectPath:a,fileSize:u.size}}catch{}return}if(t){let s=await xn(t);for(let c of await xt(s)){let u=await o(c,s);if(u)return u}let a;try{a=await Hr(s)}catch{a=[]}for(let c of a){if(c===s)continue;for(let u of await xt(c)){let d=await o(u,c);if(d)return d}}return}let n=lr(),i;try{i=await Ry(n)}catch{return}for(let s of i){let a=await o(Ga(n,s),void 0);if(a)return a}return}var Mq=1048576,$0=5242880,Nq;function Dq(){return Nq??=Buffer.from('"compact_boundary"')}function O0(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 vo(e,t,r,o){let n=o-r;if(n<=0)return;if(e.len+n>e.buf.length){let i=Buffer.allocUnsafe(Math.min(Math.max(e.buf.length*2,e.len+n),e.cap));e.buf.copy(i,0,0,e.len),e.buf=i}t.copy(e.buf,e.len,r,o),e.len+=n}function Ed(e,t,r,o){return o-r>=t.length&&e.compare(t,0,t.length,r,r+t.length)===0}var Pd=Buffer.from('{"type":"attribution-snapshot"'),jq=Buffer.from('{"type":"system"'),Ja=10,zq=Buffer.from([Ja]),Uq=256;function Lq(e,t,r){if(e.straddleSnapCarryLen=0,e.straddleSnapTailEnd=0,e.carryLen===0)return 0;let o=e.carryBuf,n=t.indexOf(Ja);if(n===-1||n>=r)return 0;let i=n+1;if(Ed(o,Pd,0,e.carryLen))e.straddleSnapCarryLen=e.carryLen,e.straddleSnapTailEnd=i,e.lastSnapSrc=null;else if(e.carryLen<Pd.length)return 0;else{if(Ed(o,jq,0,e.carryLen)){let s=O0(o.toString("utf-8",0,e.carryLen)+t.toString("utf-8",0,n));if(s?.hasPreservedSegment)e.hasPreservedSegment=!0;else if(s)e.out.len=0,e.boundaryStartOffset=e.bufFileOff,e.hasPreservedSegment=!1,e.lastSnapSrc=null}vo(e.out,o,0,e.carryLen),vo(e.out,t,0,i)}return e.bufFileOff+=e.carryLen+i,e.carryLen=0,i}function Fq(e,t,r){let o=t.indexOf(r),n=0,i=0,s=-1,a=-1,c=t.indexOf(Ja);while(c!==-1){let u=c+1;if(o!==-1&&o<i)o=t.indexOf(r,i);if(Ed(t,Pd,i,u))vo(e.out,t,n,i),s=i,a=u,n=u;else if(o>=i&&o<Math.min(i+Uq,u)){let d=O0(t.toString("utf-8",i,c));if(d?.hasPreservedSegment)e.hasPreservedSegment=!0;else if(d)e.out.len=0,e.boundaryStartOffset=e.bufFileOff+i,e.hasPreservedSegment=!1,e.lastSnapSrc=null,s=-1,e.straddleSnapCarryLen=0,n=i;o=t.indexOf(r,o+r.length)}i=u,c=t.indexOf(Ja,i)}return vo(e.out,t,n,i),{lastSnapStart:s,lastSnapEnd:a,trailStart:i}}function Hq(e,t,r,o,n){if(o!==-1){if(e.lastSnapLen=n-o,e.lastSnapBuf===void 0||e.lastSnapLen>e.lastSnapBuf.length)e.lastSnapBuf=Buffer.allocUnsafe(e.lastSnapLen);t.copy(e.lastSnapBuf,0,o,n),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),r.copy(e.lastSnapBuf,e.straddleSnapCarryLen,0,e.straddleSnapTailEnd),e.lastSnapSrc=e.lastSnapBuf}}function Bq(e,t,r){if(e.carryLen=t.length-r,e.carryLen>0){if(e.carryBuf===void 0||e.carryLen>e.carryBuf.length)e.carryBuf=Buffer.allocUnsafe(e.carryLen);t.copy(e.carryBuf,0,r,t.length)}}function qq(e){if(e.carryLen>0){let t=e.carryBuf;if(Ed(t,Pd,0,e.carryLen))e.lastSnapSrc=t,e.lastSnapLen=e.carryLen;else vo(e.out,t,0,e.carryLen)}if(e.lastSnapSrc){if(e.out.len>0&&e.out.buf[e.out.len-1]!==Ja)vo(e.out,zq,0,1);vo(e.out,e.lastSnapSrc,0,e.lastSnapLen)}}async function A0(e,t){let r=Dq(),o=Mq,n={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},i=Buffer.allocUnsafe(o),s=await P0(e,"r");try{let a=0;while(a<t){let{bytesRead:c}=await s.read(i,0,Math.min(o,t-a),a);if(c===0)break;a+=c;let u=Lq(n,i,c),d;if(n.carryLen>0){let f=n.carryLen+(c-u);d=Buffer.allocUnsafe(f),n.carryBuf.copy(d,0,0,n.carryLen),i.copy(d,n.carryLen,u,c)}else d=i.subarray(u,c);let p=Fq(n,d,r);Hq(n,d,i,p.lastSnapStart,p.lastSnapEnd),Bq(n,d,p.trailStart),n.bufFileOff+=p.trailStart}qq(n)}finally{await s.close()}return{boundaryStartOffset:n.boundaryStartOffset,postBoundaryBuf:n.out.buf.subarray(0,n.out.len),hasPreservedSegment:n.hasPreservedSegment}}async function Vq(e,t){try{if(t>$0&&!Te(process.env.CLAUDE_CODE_DISABLE_PRECOMPACT_SKIP))return(await A0(e,t)).postBoundaryBuf;return await Zq(e)}catch{return null}}function Wq(e){let s=[];try{const t=_e(s,Pe`parseTranscriptEntries(${e.length} bytes)`,0);let r=[];let o=10;let n=e.length;let i=0;while(i<n){let d=e.indexOf(o,i);if(d===-1)d=n;let p=i;while(p<d&&e[p]<=32)p++;if(i=d+1,p>=d)continue;let f=e.toString("utf-8",p,d);try{let m=kE(f),g=m.type;if((g==="user"||g==="assistant"||g==="progress"||g==="system"||g==="attachment")&&typeof m.uuid==="string")r.push(m)}catch{}}return r}catch(a){var c=a,u=1}finally{ve(s,c,u)}}function Kq(e){let t=new Map;for(let f of e)t.set(f.uuid,f);for(let f of t.values()){if(f.type!=="system"||f.subtype!=="compact_boundary")continue;let m=f.compactMetadata?.preservedMessages,g=f.compactMetadata?.preservedSegment;if(m){if(m.uuids.length===0||m.uuids.some((x)=>!t.has(x)))continue;let h=m.anchorUuid;for(let x of m.uuids){let w=t.get(x);t.set(x,{...w,parentUuid:h}),h=x}let y=m.uuids[0],v=m.uuids.at(-1);for(let[x,w]of t)if(w.parentUuid===m.anchorUuid&&x!==y)t.set(x,{...w,parentUuid:v})}else if(g){let h=t.get(g.headUuid);if(h)t.set(g.headUuid,{...h,parentUuid:g.anchorUuid});for(let[y,v]of t)if(v.parentUuid===g.anchorUuid&&y!==g.headUuid)t.set(y,{...v,parentUuid:g.tailUuid})}}let r=new Map;for(let f=0;f<e.length;f++)r.set(e[f].uuid,f);let o=new Set;for(let f of t.values())if(f.parentUuid)o.add(f.parentUuid);let n=[...t.values()].filter((f)=>!o.has(f.uuid)),i=[];for(let f of n){let m=f,g=new Set;while(m){if(g.has(m.uuid))break;if(g.add(m.uuid),m.type==="user"||m.type==="assistant"){i.push(m);break}m=m.parentUuid?t.get(m.parentUuid):void 0}}if(i.length===0)return[];let s=i.filter((f)=>!f.isSidechain&&!f.teamName&&!f.isMeta),a=(f)=>f.reduce((m,g)=>(r.get(g.uuid)??-1)>(r.get(m.uuid)??-1)?g:m),c=s.length>0?a(s):a(i),u=[],d=new Set,p=t.get(c.uuid);while(p){if(d.has(p.uuid))break;d.add(p.uuid),u.push(p),p=p.parentUuid?t.get(p.parentUuid):void 0}return u.reverse(),Jq(t,u,d)}function $y(e){if(e.type!=="assistant")return;let t=e.message;if(typeof t!=="object"||t===null)return;let r=t.id;return typeof r==="string"?r:void 0}function Gq(e){if(e.type!=="user"||!e.parentUuid)return!1;let t=e.message;if(typeof t!=="object"||t===null)return!1;let r=t.content;if(!Array.isArray(r))return!1;return r.some((o)=>typeof o==="object"&&o!==null&&o.type==="tool_result")}function Jq(e,t,r){let o=t.filter((p)=>p.type==="assistant");if(o.length===0)return t;let n=new Map;for(let p of o){let f=$y(p);if(f)n.set(f,p)}let i=new Map,s=new Map;for(let p of e.values()){let f=$y(p);if(f){let m=i.get(f);if(m)m.push(p);else i.set(f,[p])}else if(Gq(p)){let m=p.parentUuid,g=s.get(m);if(g)g.push(p);else s.set(m,[p])}}let a=new Set,c=new Map,u=0;for(let p of o){let f=$y(p);if(!f||a.has(f))continue;a.add(f);let m=i.get(f)??[p],g=m.filter((w)=>!r.has(w.uuid)),h=[];for(let w of m){let O=s.get(w.uuid);if(!O)continue;for(let L of O)if(!r.has(L.uuid))h.push(L)}if(g.length===0&&h.length===0)continue;let y=(w,O)=>(w.timestamp??"").localeCompare(O.timestamp??"");g.sort(y),h.sort(y);let v=n.get(f),x=[...g,...h];for(let w of x)r.add(w.uuid);u+=x.length,c.set(v.uuid,x)}if(u===0)return t;let d=[];for(let p of t){d.push(p);let f=c.get(p.uuid);if(f)d.push(...f)}return d}function Xq(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 Oy(e,t){return{type:e.type,uuid:e.uuid,session_id:e.sessionId,message:e.message,parent_tool_use_id:t??null,timestamp:e.timestamp}}function Ay(e,t){let r=t?.offset??0;if(t?.limit!==void 0&&t.limit>0)return e.slice(r,r+t.limit);if(r>0)return e.slice(r);return e}function C0(e,t){let r=[];for(let o of e){if(typeof o!=="object"||o===null)continue;let n=o,i=n.type;if((i==="user"||i==="assistant"||i==="progress"||i==="system"||i==="attachment")&&typeof n.uuid==="string")r.push(n)}return M0(r,t)}function M0(e,t){let r=Kq(e),o=t?.includeSystemMessages??!1,i=r.filter((s)=>Xq(s,o)).map((s)=>Oy(s));return Ay(i,t)}async function N0(e,t){if(!Se(e))return[];let r=await wn(e,t?.dir);if(!r)return[];let o=await Vq(r.filePath,r.fileSize);if(!o)return[];return M0(Wq(o),t)}import{readdir as Cy,stat as Yq}from"fs/promises";import{basename as Qq,join as My}from"path";function Ci(e,t,r){let{head:o,tail:n,mtime:i,size:s}=t,a=o.indexOf(`
69
- `),c=a>=0?o.slice(0,a):o;if(c.includes('"isSidechain":true')||c.includes('"isSidechain": true'))return null;let u=wt(n,"customTitle")||wt(o,"customTitle")||wt(n,"aiTitle")||wt(o,"aiTitle")||void 0,d=Rd(o)||void 0,p=Id(o,"timestamp"),f;if(p){let x=Date.parse(p);if(!Number.isNaN(x))f=x}let m=u||wt(n,"lastPrompt")||wt(n,"summary")||d;if(!m)return null;let g=wt(n,"gitBranch")||Id(o,"gitBranch")||void 0,h=Id(o,"cwd")||r||void 0,y=n.split(`
70
- `).findLast((x)=>x.includes('"type":"tag"')&&x.includes('"tag":"')),v=y?wt(y,"tag")||void 0:void 0;return{sessionId:e,summary:m,lastModified:i,fileSize:s,customTitle:u,firstPrompt:d,gitBranch:g,cwd:h,tag:v,createdAt:f}}async function Ya(e,t,r){let o;try{o=await Cy(e)}catch{return[]}return(await Promise.all(o.map(async(i)=>{if(!i.endsWith(".jsonl"))return null;let s=Se(i.slice(0,-6));if(!s)return null;let a=My(e,i);if(!t)return{sessionId:s,filePath:a,mtime:0,projectPath:r};try{let c=await Yq(a);return{sessionId:s,filePath:a,mtime:c.mtime.getTime(),projectPath:r}}catch{return null}}))).filter((i)=>i!==null)}async function D0(e){let t=await $d(e.filePath);if(!t)return null;let r=Ci(e.sessionId,t,e.projectPath);if(!r)return null;if(e.mtime)r.lastModified=e.mtime;return r}var e6=32;function t6(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 r6(e,t,r){e.sort(t6);let o=[],n=t&&t>0?t:1/0,i=0,s=new Set;for(let a=0;a<e.length&&o.length<n;){let c=Math.min(a+e6,e.length),u=e.slice(a,c),d=await Promise.all(u.map(D0));for(let p=0;p<d.length&&o.length<n;p++){a++;let f=d[p];if(!f)continue;if(s.has(f.sessionId))continue;if(s.add(f.sessionId),i<r){i++;continue}o.push(f)}}return o}async function n6(e){let t=await Promise.all(e.map(D0)),r=new Map;for(let n of t){if(!n)continue;let i=r.get(n.sessionId);if(!i||n.lastModified>i.lastModified)r.set(n.sessionId,n)}let o=[...r.values()];return o.sort((n,i)=>i.lastModified!==n.lastModified?i.lastModified-n.lastModified:i.sessionId<n.sessionId?-1:i.sessionId>n.sessionId?1:0),o}async function o6(e,t,r){let o=await xn(e),n;if(t)try{n=await Hr(o)}catch{n=[]}else n=[];if(n.length<=1){let p=[];for(let f of await xt(o))p.push(...await Ya(f,r,o));return p}let i=lr(),s=process.platform==="win32",a=n.map((p)=>{let f=So(p);return{path:p,prefix:s?f.toLowerCase():f}});a.sort((p,f)=>f.prefix.length-p.prefix.length);let c;try{c=await Cy(i,{withFileTypes:!0})}catch{let p=[];for(let f of await xt(o))p.push(...await Ya(f,r,o));return p}let u=[],d=new Set;for(let p of await xt(o)){let f=Qq(p);d.add(s?f.toLowerCase():f),u.push(...await Ya(p,r,o))}for(let p of c){if(!p.isDirectory())continue;let f=s?p.name.toLowerCase():p.name;if(d.has(f))continue;for(let{path:m,prefix:g}of a)if(f===g||g.length>=Ai&&f.startsWith(g+"-")){d.add(f),u.push(...await Ya(My(i,p.name),r,m));break}}return u}async function i6(e){let t=lr(),r;try{r=await Cy(t,{withFileTypes:!0})}catch{return[]}return(await Promise.all(r.filter((n)=>n.isDirectory()).map((n)=>Ya(My(t,n.name),e)))).flat()}async function j0(e){let{dir:t,limit:r,offset:o,includeWorktrees:n}=e??{},i=o??0,s=r!==void 0&&r>0||i>0,a=t?await o6(t,n??!0,s):await i6(s);if(!s)return n6(a);return r6(a,r,i)}async function z0(e,t={}){let r=Se(e);if(!r)return;let o=await wn(r,t.dir);if(!o)return;let n=await $d(o.filePath);if(!n)return;return Ci(r,n,o.projectPath)??void 0}import{constants as U0}from"fs";import{open as s6,readdir as F0,rm as L0,stat as a6}from"fs/promises";import{join as Mi}from"path";async function H0(e,t,r={}){if(!Se(e))throw Error(`Invalid sessionId: ${e}`);if(!t.trim())throw Error("title must be non-empty");let o=pe({type:"custom-title",customTitle:t.trim(),sessionId:e})+`
71
- `;await Z0(e,o,r)}async function B0(e,t,r={}){if(!Se(e))throw Error(`Invalid sessionId: ${e}`);if(t!==null){let n=_o(t).trim();if(!n)throw Error("tag must be non-empty (use null to clear)");t=n}let o=pe({type:"tag",tag:t??"",sessionId:e})+`
72
- `;await Z0(e,o,r)}async function q0(e,t={}){if(!Se(e))throw Error(`Invalid sessionId: ${e}`);for(let r of await c6(t)){let o=Mi(r,`${e}.jsonl`),n;try{({size:n}=await a6(o))}catch(i){let s=Ge(i);if(s==="ENOENT"||s==="ENOTDIR")continue;throw i}if(n===0)continue;await L0(o,{force:!0}),await L0(Mi(r,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 c6(e){if(e.dir){let r=await xn(e.dir),o=await xt(r),n;try{n=await Hr(r)}catch{n=[]}for(let i of n){if(i===r)continue;o.push(...await xt(i))}return o}let t=lr();try{return(await F0(t,{withFileTypes:!0})).filter((o)=>o.isDirectory()||o.isSymbolicLink()).map((o)=>Mi(t,o.name))}catch{return[]}}async function Z0(e,t,r){let o=`${e}.jsonl`;if(r.dir){let s=await xn(r.dir);for(let c of await xt(s))if(await Ny(Mi(c,o),t))return;let a;try{a=await Hr(s)}catch{a=[]}for(let c of a){if(c===s)continue;for(let u of await xt(c))if(await Ny(Mi(u,o),t))return}throw Error(`Session ${e} not found in project directory for ${r.dir}`)}let n=lr(),i;try{i=await F0(n)}catch{throw Error(`Session ${e} not found (no projects directory)`)}for(let s of i)if(await Ny(Mi(n,s,o),t))return;throw Error(`Session ${e} not found in any project directory`)}async function Ny(e,t){let r;try{r=await s6(e,U0.O_WRONLY|U0.O_APPEND)}catch(o){let n=Ge(o);if(n==="ENOENT"||n==="ENOTDIR")return!1;throw o}try{let{size:o}=await r.stat();if(o===0)return!1;let n=process.platform==="win32"?o:void 0;return await r.write(t,n,"utf8"),!0}finally{await r.close()}}import{randomUUID as Od}from"crypto";import{join as Dy}from"path";async function l6(e,t){let r=`${e}.jsonl`;async function o(s){try{let a=await bi().readBytes(Dy(s,r));if(a.length===0)return null;return{buf:a,projectDir:s}}catch{return null}}if(t){let s=await xn(t);for(let c of await xt(s)){let u=await o(c);if(u)return u}let a;try{a=await Hr(s)}catch{a=[]}for(let c of a){if(c===s)continue;for(let u of await xt(c)){let d=await o(u);if(d)return d}}return null}let n=lr(),i;try{i=await bi().list(n)}catch{return null}for(let s of i){let a=await o(Dy(n,s));if(a)return a}return null}var u6=new Set(["user","assistant","attachment","system","progress"]);function d6(e,t){let r=[],o=[],n=10,i=e.length,s=0;while(s<i){let a=e.indexOf(10,s);if(a===-1)a=i;let c=s;while(c<a&&e[c]<=32)c++;if(s=a+1,c>=a)continue;let u=e.toString("utf-8",c,a);try{V0(Ze(u),t,r,o)}catch{}}return{transcript:r,contentReplacements:o}}function p6(e,t){let r=[],o=[];for(let n of e){if(typeof n!=="object"||n===null)continue;V0(n,t,r,o)}return{transcript:r,contentReplacements:o}}function V0(e,t,r,o){if(u6.has(e.type)&&typeof e.uuid==="string")r.push(e);else if(e.type==="content-replacement"&&e.sessionId===t&&Array.isArray(e.replacements))o.push(...e.replacements)}async function W0(e,t={}){if(!Se(e))throw Error(`Invalid sessionId: ${e}`);if(t.upToMessageId&&!Se(t.upToMessageId))throw Error(`Invalid upToMessageId: ${t.upToMessageId}`);let r=await l6(e,t.dir);if(!r)throw Error(t.dir?`Session ${e} not found in project directory for ${t.dir}`:`Session ${e} not found`);let{entries:o,forkedSessionId:n}=f6(r.buf,e,t);return await Xa(Dy(r.projectDir,`${n}.jsonl`),o),{sessionId:n}}function f6(e,t,r){let o=d6(e,t);return G0(o,t,r,()=>{let i=e.length,s=e.toString("utf-8",0,Math.min(i,cr)),a=e.toString("utf-8",Math.max(0,i-cr));return wt(a,"customTitle")||wt(s,"customTitle")||wt(a,"aiTitle")||wt(s,"aiTitle")||Rd(s)})}function K0(e,t,r){let o=p6(e,t);return G0(o,t,r,()=>m6(e))}function m6(e){let t,r;for(let o of e){if(typeof o!=="object"||o===null)continue;let n=o;if(typeof n.customTitle==="string"&&n.customTitle)t=n.customTitle;if(typeof n.aiTitle==="string"&&n.aiTitle)r=n.aiTitle}return t||r||R0(e)||void 0}function G0(e,t,r,o){let n=e.transcript.filter((f)=>!f.isSidechain);if(n.length===0)throw Error(`Session ${t} has no messages to fork`);if(r.upToMessageId){let f=n.findIndex((m)=>m.uuid===r.upToMessageId);if(f===-1)throw Error(`Message ${r.upToMessageId} not found in session ${t}`);n=n.slice(0,f+1)}let i=new Map;for(let f of n)i.set(f.uuid,Od());let s=n.filter((f)=>f.type!=="progress");if(s.length===0)throw Error(`Session ${t} has no messages to fork`);let a=new Map;for(let f of n)a.set(f.uuid,f);let c=Od(),u=new Date().toISOString(),d=[];for(let f=0;f<s.length;f++){let m=s[f],g=i.get(m.uuid),h=null,y=m.parentUuid;while(y){let O=a.get(y);if(!O)break;if(O.type!=="progress"){h=i.get(y)??null;break}y=O.parentUuid}let v=f===s.length-1?u:m.timestamp,x=m.logicalParentUuid==null?m.logicalParentUuid:i.get(m.logicalParentUuid)??null,w={...m,uuid:g,parentUuid:h,logicalParentUuid:x,sessionId:c,timestamp:v,isSidechain:!1,teamName:void 0,agentName:void 0,sessionKind:void 0,slug:void 0,sourceToolAssistantUUID:void 0,forkedFrom:{sessionId:t,messageUuid:m.uuid}};d.push(w)}if(e.contentReplacements.length>0)d.push({type:"content-replacement",sessionId:c,replacements:e.contentReplacements,uuid:Od(),timestamp:u});let p=r.title?.trim();if(!p)p=`${o()||"Forked session"} (fork)`;return d.push({type:"custom-title",sessionId:c,customTitle:p,uuid:Od(),timestamp:u}),{entries:d,forkedSessionId:c}}import{readdir as g6,readFile as J0}from"fs/promises";import{join as jy}from"path";async function X0(e,t){let r=await wn(e,t);if(!r)return null;let o=r.filePath.replace(/\.jsonl$/,"");return jy(o,"subagents")}async function Y0(e){let t=[];async function r(o){let n;try{n=await g6(o,{withFileTypes:!0})}catch{return}for(let i of n)if(i.isFile()&&i.name.startsWith("agent-")&&i.name.endsWith(".jsonl")){let s=i.name.slice(6,-6);t.push({agentId:s,filePath:jy(o,i.name)})}else if(i.isDirectory())await r(jy(o,i.name))}return await r(e),t}function h6(e){let t=[],r=10,o=e.length,n=0;while(n<o){let i=e.indexOf(10,n);if(i===-1)i=o;let s=n;while(s<i&&e[s]<=32)s++;if(n=i+1,s>=i)continue;let a=e.toString("utf-8",s,i);try{let c=Ze(a),u=c.type;if((u==="user"||u==="assistant")&&typeof c.uuid==="string")t.push(c)}catch{}}return t}function y6(e){if(e.length===0)return[];let t=new Map;for(let s of e)t.set(s.uuid,s);let r=e.findLast((s)=>s.type==="user"||s.type==="assistant");if(!r)return[];let o=[],n=new Set,i=r;while(i){if(n.has(i.uuid))break;n.add(i.uuid),o.push(i),i=i.parentUuid?t.get(i.parentUuid):void 0}return o.reverse(),o}async function Q0(e,t){if(!Se(e))return[];let r=await X0(e,t?.dir);if(!r)return[];return(await Y0(r)).map((n)=>n.agentId)}async function eR(e,t,r){if(!Se(e))return[];if(!t)return[];let o=await X0(e,r?.dir);if(!o)return[];let i=(await Y0(o)).find((c)=>c.agentId===t);if(!i)return[];let s;try{s=await J0(i.filePath)}catch{return[]}let a;try{let c=i.filePath.replace(/\.jsonl$/,".meta.json");a=Ze(await J0(c,"utf-8")).toolUseId}catch{}return zy(s,r,a)}function zy(e,t,r){if(e.length===0)return[];let o=h6(e),i=y6(o).filter((s)=>s.type==="user"||s.type==="assistant").map((s)=>Oy(s,r));return Ay(i,t)}import{createHash as E6}from"crypto";import{homedir as kye,userInfo as P6}from"os";function Uy(e,t){let r=0;for(let o of e)r+=+!!t(o);return r}function Ad(e){return[...new Set(e)]}function b6(){return"prod"}var _6="user:inference",rR="user:profile",v6="org:create_api_key";var S6=[v6,rR],x6=[rR,_6,"user:sessions:claude_code","user:mcp_servers","user:file_upload",...[]],vye=Ad([...S6,...x6]),tR={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",OAUTH_FILE_SUFFIX:"",MCP_PROXY_URL:"https://mcp-proxy.anthropic.com",MCP_PROXY_PATH:"/v1/mcp/{server_id}"};var w6=void 0;function k6(){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",r=process.env.CLAUDE_LOCAL_OAUTH_CONSOLE_BASE?.replace(/\/$/,"")??"http://localhost:3000";return{BASE_API_URL:e,CONSOLE_AUTHORIZE_URL:`${r}/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:`${r}/buy_credits?returnUrl=/oauth/code/success%3Fapp%3Dclaude-code`,CLAUDEAI_SUCCESS_URL:`${r}/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`${r}/oauth/code/callback`,CLIENT_ID:"22422756-60c9-4084-8eb7-27705fd5cf9a",OAUTH_FILE_SUFFIX:"-local-oauth",MCP_PROXY_URL:"http://localhost:8205",MCP_PROXY_PATH:"/v1/toolbox/shttp/mcp/{server_id}"}}var T6=["https://beacon.claude-ai.staging.ant.dev","https://claude.fedstart.com","https://claude-staging.fedstart.com"];function nR(){let e=(()=>{switch(b6()){case"local":return k6();case"staging":return w6??tR;case"prod":return tR}})(),t=process.env.CLAUDE_CODE_CUSTOM_OAUTH_URL;if(t){let o=t.replace(/\/$/,"");if(!T6.includes(o))throw Error("CLAUDE_CODE_CUSTOM_OAUTH_URL is not an approved endpoint.");e={...e,BASE_API_URL:o,CONSOLE_AUTHORIZE_URL:`${o}/oauth/authorize`,CLAUDE_AI_AUTHORIZE_URL:`${o}/oauth/authorize`,CLAUDE_AI_ORIGIN:o,TOKEN_URL:`${o}/v1/oauth/token`,API_KEY_URL:`${o}/api/oauth/claude_cli/create_api_key`,ROLES_URL:`${o}/api/oauth/claude_cli/roles`,CONSOLE_SUCCESS_URL:`${o}/oauth/code/success?app=claude-code`,CLAUDEAI_SUCCESS_URL:`${o}/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`${o}/oauth/code/callback`,OAUTH_FILE_SUFFIX:"-custom-oauth"}}let r=process.env.CLAUDE_CODE_OAUTH_CLIENT_ID;if(r)e={...e,CLIENT_ID:r};return e}var oR="-credentials";function iR(e=""){let t=process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR,r=t!==void 0?!t:!process.env.CLAUDE_CONFIG_DIR,o=t!==void 0?t.normalize("NFC"):qt(),n=r?"":`-${E6("sha256").update(o).digest("hex").substring(0,8)}`;return`Claude Code${nR().OAUTH_FILE_SUFFIX}${e}${n}`}var I6=/^[a-zA-Z0-9._-]+$/;function sR(){if(process.platform==="win32")return"claude-code-user";let e;try{e=process.env.USER||P6().username}catch{e="claude-code-user"}if(!I6.test(e))return"claude-code-user";return e}var ae;(function(e){e.assertEqual=(n)=>{};function t(n){}e.assertIs=t;function r(n){throw Error()}e.assertNever=r,e.arrayToEnum=(n)=>{let i={};for(let s of n)i[s]=s;return i},e.getValidEnumValues=(n)=>{let i=e.objectKeys(n).filter((a)=>typeof n[n[a]]!=="number"),s={};for(let a of i)s[a]=n[a];return e.objectValues(s)},e.objectValues=(n)=>{return e.objectKeys(n).map(function(i){return n[i]})},e.objectKeys=typeof Object.keys==="function"?(n)=>Object.keys(n):(n)=>{let i=[];for(let s in n)if(Object.prototype.hasOwnProperty.call(n,s))i.push(s);return i},e.find=(n,i)=>{for(let s of n)if(i(s))return s;return},e.isInteger=typeof Number.isInteger==="function"?(n)=>Number.isInteger(n):(n)=>typeof n==="number"&&Number.isFinite(n)&&Math.floor(n)===n;function o(n,i=" | "){return n.map((s)=>typeof s==="string"?`'${s}'`:s).join(i)}e.joinValues=o,e.jsonStringifyReplacer=(n,i)=>{if(typeof i==="bigint")return i.toString();return i}})(ae||(ae={}));var aR;(function(e){e.mergeShapes=(t,r)=>{return{...t,...r}}})(aR||(aR={}));var C=ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Br=(e)=>{switch(typeof e){case"undefined":return C.undefined;case"string":return C.string;case"number":return Number.isNaN(e)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":if(Array.isArray(e))return C.array;if(e===null)return C.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return C.promise;if(typeof Map<"u"&&e instanceof Map)return C.map;if(typeof Set<"u"&&e instanceof Set)return C.set;if(typeof Date<"u"&&e instanceof Date)return C.date;return C.object;default:return C.unknown}};var P=ae.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"]);class jt extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};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(n){return n.message},r={_errors:[]},o=(n)=>{for(let i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(t(i));else{let s=r,a=0;while(a<i.path.length){let c=i.path[a];if(a!==i.path.length-1)s[c]=s[c]||{_errors:[]};else s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(i));s=s[c],a++}}};return o(this),r}static assert(e){if(!(e instanceof jt))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ae.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t={},r=[];for(let o of this.issues)if(o.path.length>0){let n=o.path[0];t[n]=t[n]||[],t[n].push(e(o))}else r.push(e(o));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}jt.create=(e)=>{return new jt(e)};var R6=(e,t)=>{let r;switch(e.code){case P.invalid_type:if(e.received===C.undefined)r="Required";else r=`Expected ${e.expected}, received ${e.received}`;break;case P.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ae.jsonStringifyReplacer)}`;break;case P.unrecognized_keys:r=`Unrecognized key(s) in object: ${ae.joinValues(e.keys,", ")}`;break;case P.invalid_union:r="Invalid input";break;case P.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ae.joinValues(e.options)}`;break;case P.invalid_enum_value:r=`Invalid enum value. Expected ${ae.joinValues(e.options)}, received '${e.received}'`;break;case P.invalid_arguments:r="Invalid function arguments";break;case P.invalid_return_type:r="Invalid function return type";break;case P.invalid_date:r="Invalid date";break;case P.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")r=`${r} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)r=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)r=`Invalid input: must end with "${e.validation.endsWith}"`;else ae.assertNever(e.validation);else if(e.validation!=="regex")r=`Invalid ${e.validation}`;else r="Invalid";break;case P.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else r="Invalid input";break;case P.too_big:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else r="Invalid input";break;case P.custom:r="Invalid input";break;case P.invalid_intersection_types:r="Intersection results could not be merged";break;case P.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case P.not_finite:r="Number must be finite";break;default:r=t.defaultError,ae.assertNever(e)}return{message:r}},kn=R6;var $6=kn;function Qa(){return $6}var Cd=(e)=>{let{data:t,path:r,errorMaps:o,issueData:n}=e,i=[...r,...n.path||[]],s={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let a="",c=o.filter((u)=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...n,path:i,message:a}};function j(e,t){let r=Qa(),o=Cd({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===kn?void 0:kn].filter((n)=>!!n)});e.common.issues.push(o)}class at{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 r=[];for(let o of t){if(o.status==="aborted")return W;if(o.status==="dirty")e.dirty();r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let o of t){let n=await o.key,i=await o.value;r.push({key:n,value:i})}return at.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let o of t){let{key:n,value:i}=o;if(n.status==="aborted")return W;if(i.status==="aborted")return W;if(n.status==="dirty")e.dirty();if(i.status==="dirty")e.dirty();if(n.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet))r[n.value]=i.value}return{status:e.value,value:r}}}var W=Object.freeze({status:"aborted"}),Ni=(e)=>({status:"dirty",value:e}),ft=(e)=>({status:"valid",value:e}),Ly=(e)=>e.status==="aborted",Fy=(e)=>e.status==="dirty",xo=(e)=>e.status==="valid",ec=(e)=>typeof Promise<"u"&&e instanceof Promise;var F;(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(F||(F={}));class ur{constructor(e,t,r,o){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=o}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 cR=(e,t)=>{if(xo(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 r=new jt(e.common.issues);return this._error=r,this._error}}}};function Q(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:o,description:n}=e;if(t&&(r||o))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:n};return{errorMap:(s,a)=>{let{message:c}=e;if(s.code==="invalid_enum_value")return{message:c??a.defaultError};if(typeof a.data>"u")return{message:c??o??a.defaultError};if(s.code!=="invalid_type")return{message:a.defaultError};return{message:c??r??a.defaultError}},description:n}}class oe{get description(){return this._def.description}_getType(e){return Br(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Br(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new at,ctx:{common:e.parent.common,data:e.data,parsedType:Br(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ec(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Br(e)},o=this._parseSync({data:e,path:r.path,parent:r});return cR(r,o)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Br(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return xo(r)?{value:r.value}:{issues:t.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((r)=>xo(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Br(e)},o=this._parse({data:e,path:r.path,parent:r}),n=await(ec(o)?o:Promise.resolve(o));return cR(r,n)}refine(e,t){let r=(o)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(o);else return t};return this._refinement((o,n)=>{let i=e(o),s=()=>n.addIssue({code:P.custom,...r(o)});if(typeof Promise<"u"&&i instanceof Promise)return i.then((a)=>{if(!a)return s(),!1;else return!0});if(!i)return s(),!1;else return!0})}refinement(e,t){return this._refinement((r,o)=>{if(!e(r))return o.addIssue(typeof t==="function"?t(r,o):t),!1;else return!0})}_refinement(e){return new Pr({schema:this,typeName:R.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 Gt.create(this,this._def)}nullable(){return Tn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Er.create(this)}promise(){return Li.create(this,this._def)}or(e){return ic.create([this,e],this._def)}and(e){return sc.create(this,e,this._def)}transform(e){return new Pr({...Q(this._def),schema:this,typeName:R.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new uc({...Q(this._def),innerType:this,defaultValue:t,typeName:R.ZodDefault})}brand(){return new Zy({typeName:R.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new dc({...Q(this._def),innerType:this,catchValue:t,typeName:R.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return Fd.create(this,e)}readonly(){return pc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var O6=/^c[^\s-]{8,}$/i,A6=/^[0-9a-z]+$/,C6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,M6=/^[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,N6=/^[a-z0-9_-]{21}$/i,D6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,j6=/^[-+]?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)?)??$/,z6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,U6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Hy,L6=/^(?:(?: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])$/,F6=/^(?:(?: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])$/,H6=/^(([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]))$/,B6=/^(([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])$/,q6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Z6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,lR="((\\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])))",V6=new RegExp(`^${lR}$`);function uR(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function W6(e){return new RegExp(`^${uR(e)}$`)}function K6(e){let t=`${lR}T${uR(e)}`,r=[];if(r.push(e.local?"Z?":"Z"),e.offset)r.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function G6(e,t){if((t==="v4"||!t)&&L6.test(e))return!0;if((t==="v6"||!t)&&H6.test(e))return!0;return!1}function J6(e,t){if(!D6.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let o=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(o));if(typeof n!=="object"||n===null)return!1;if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&n.alg!==t)return!1;return!0}catch{return!1}}function X6(e,t){if((t==="v4"||!t)&&F6.test(e))return!0;if((t==="v6"||!t)&&B6.test(e))return!0;return!1}class Zr extends oe{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==C.string){let n=this._getOrReturnCtx(e);return j(n,{code:P.invalid_type,expected:C.string,received:n.parsedType}),W}let r=new at,o=void 0;for(let n of this._def.checks)if(n.kind==="min"){if(e.data.length<n.value)o=this._getOrReturnCtx(e,o),j(o,{code:P.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty()}else if(n.kind==="max"){if(e.data.length>n.value)o=this._getOrReturnCtx(e,o),j(o,{code:P.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty()}else if(n.kind==="length"){let i=e.data.length>n.value,s=e.data.length<n.value;if(i||s){if(o=this._getOrReturnCtx(e,o),i)j(o,{code:P.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message});else if(s)j(o,{code:P.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message});r.dirty()}}else if(n.kind==="email"){if(!z6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"email",code:P.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="emoji"){if(!Hy)Hy=new RegExp(U6,"u");if(!Hy.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"emoji",code:P.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="uuid"){if(!M6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"uuid",code:P.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="nanoid"){if(!N6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"nanoid",code:P.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cuid"){if(!O6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"cuid",code:P.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cuid2"){if(!A6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"cuid2",code:P.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="ulid"){if(!C6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"ulid",code:P.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),j(o,{validation:"url",code:P.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="regex"){if(n.regex.lastIndex=0,!n.regex.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"regex",code:P.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="trim")e.data=e.data.trim();else if(n.kind==="includes"){if(!e.data.includes(n.value,n.position))o=this._getOrReturnCtx(e,o),j(o,{code:P.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()}else if(n.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(n.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(n.kind==="startsWith"){if(!e.data.startsWith(n.value))o=this._getOrReturnCtx(e,o),j(o,{code:P.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()}else if(n.kind==="endsWith"){if(!e.data.endsWith(n.value))o=this._getOrReturnCtx(e,o),j(o,{code:P.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()}else if(n.kind==="datetime"){if(!K6(n).test(e.data))o=this._getOrReturnCtx(e,o),j(o,{code:P.invalid_string,validation:"datetime",message:n.message}),r.dirty()}else if(n.kind==="date"){if(!V6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{code:P.invalid_string,validation:"date",message:n.message}),r.dirty()}else if(n.kind==="time"){if(!W6(n).test(e.data))o=this._getOrReturnCtx(e,o),j(o,{code:P.invalid_string,validation:"time",message:n.message}),r.dirty()}else if(n.kind==="duration"){if(!j6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"duration",code:P.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="ip"){if(!G6(e.data,n.version))o=this._getOrReturnCtx(e,o),j(o,{validation:"ip",code:P.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="jwt"){if(!J6(e.data,n.alg))o=this._getOrReturnCtx(e,o),j(o,{validation:"jwt",code:P.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cidr"){if(!X6(e.data,n.version))o=this._getOrReturnCtx(e,o),j(o,{validation:"cidr",code:P.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="base64"){if(!q6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"base64",code:P.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="base64url"){if(!Z6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"base64url",code:P.invalid_string,message:n.message}),r.dirty()}else ae.assertNever(n);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((o)=>e.test(o),{validation:t,code:P.invalid_string,...F.errToObj(r)})}_addCheck(e){return new Zr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...F.errToObj(e)})}url(e){return this._addCheck({kind:"url",...F.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...F.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...F.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...F.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...F.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...F.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...F.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...F.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...F.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...F.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...F.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...F.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,...F.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,...F.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...F.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...F.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...F.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...F.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...F.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...F.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...F.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...F.errToObj(t)})}nonempty(e){return this.min(1,F.errToObj(e))}trim(){return new Zr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Zr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Zr({...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}}Zr.create=(e)=>{return new Zr({checks:[],typeName:R.ZodString,coerce:e?.coerce??!1,...Q(e)})};function Y6(e,t){let r=(e.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,n=r>o?r:o,i=Number.parseInt(e.toFixed(n).replace(".","")),s=Number.parseInt(t.toFixed(n).replace(".",""));return i%s/10**n}class ji extends oe{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)!==C.number){let n=this._getOrReturnCtx(e);return j(n,{code:P.invalid_type,expected:C.number,received:n.parsedType}),W}let r=void 0,o=new at;for(let n of this._def.checks)if(n.kind==="int"){if(!ae.isInteger(e.data))r=this._getOrReturnCtx(e,r),j(r,{code:P.invalid_type,expected:"integer",received:"float",message:n.message}),o.dirty()}else if(n.kind==="min"){if(n.inclusive?e.data<n.value:e.data<=n.value)r=this._getOrReturnCtx(e,r),j(r,{code:P.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),o.dirty()}else if(n.kind==="max"){if(n.inclusive?e.data>n.value:e.data>=n.value)r=this._getOrReturnCtx(e,r),j(r,{code:P.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),o.dirty()}else if(n.kind==="multipleOf"){if(Y6(e.data,n.value)!==0)r=this._getOrReturnCtx(e,r),j(r,{code:P.not_multiple_of,multipleOf:n.value,message:n.message}),o.dirty()}else if(n.kind==="finite"){if(!Number.isFinite(e.data))r=this._getOrReturnCtx(e,r),j(r,{code:P.not_finite,message:n.message}),o.dirty()}else ae.assertNever(n);return{status:o.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,F.toString(t))}gt(e,t){return this.setLimit("min",e,!1,F.toString(t))}lte(e,t){return this.setLimit("max",e,!0,F.toString(t))}lt(e,t){return this.setLimit("max",e,!1,F.toString(t))}setLimit(e,t,r,o){return new ji({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:F.toString(o)}]})}_addCheck(e){return new ji({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:F.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:F.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:F.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:F.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:F.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:F.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:F.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:F.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:F.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"&&ae.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}return Number.isFinite(t)&&Number.isFinite(e)}}ji.create=(e)=>{return new ji({checks:[],typeName:R.ZodNumber,coerce:e?.coerce||!1,...Q(e)})};class zi extends oe{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)!==C.bigint)return this._getInvalidInput(e);let r=void 0,o=new at;for(let n of this._def.checks)if(n.kind==="min"){if(n.inclusive?e.data<n.value:e.data<=n.value)r=this._getOrReturnCtx(e,r),j(r,{code:P.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),o.dirty()}else if(n.kind==="max"){if(n.inclusive?e.data>n.value:e.data>=n.value)r=this._getOrReturnCtx(e,r),j(r,{code:P.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),o.dirty()}else if(n.kind==="multipleOf"){if(e.data%n.value!==BigInt(0))r=this._getOrReturnCtx(e,r),j(r,{code:P.not_multiple_of,multipleOf:n.value,message:n.message}),o.dirty()}else ae.assertNever(n);return{status:o.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return j(t,{code:P.invalid_type,expected:C.bigint,received:t.parsedType}),W}gte(e,t){return this.setLimit("min",e,!0,F.toString(t))}gt(e,t){return this.setLimit("min",e,!1,F.toString(t))}lte(e,t){return this.setLimit("max",e,!0,F.toString(t))}lt(e,t){return this.setLimit("max",e,!1,F.toString(t))}setLimit(e,t,r,o){return new zi({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:F.toString(o)}]})}_addCheck(e){return new zi({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:F.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:F.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:F.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:F.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:F.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}}zi.create=(e)=>{return new zi({checks:[],typeName:R.ZodBigInt,coerce:e?.coerce??!1,...Q(e)})};class Md extends oe{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==C.boolean){let r=this._getOrReturnCtx(e);return j(r,{code:P.invalid_type,expected:C.boolean,received:r.parsedType}),W}return ft(e.data)}}Md.create=(e)=>{return new Md({typeName:R.ZodBoolean,coerce:e?.coerce||!1,...Q(e)})};class rc extends oe{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==C.date){let n=this._getOrReturnCtx(e);return j(n,{code:P.invalid_type,expected:C.date,received:n.parsedType}),W}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return j(n,{code:P.invalid_date}),W}let r=new at,o=void 0;for(let n of this._def.checks)if(n.kind==="min"){if(e.data.getTime()<n.value)o=this._getOrReturnCtx(e,o),j(o,{code:P.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()}else if(n.kind==="max"){if(e.data.getTime()>n.value)o=this._getOrReturnCtx(e,o),j(o,{code:P.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()}else ae.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new rc({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:F.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:F.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}}rc.create=(e)=>{return new rc({checks:[],coerce:e?.coerce||!1,typeName:R.ZodDate,...Q(e)})};class Nd extends oe{_parse(e){if(this._getType(e)!==C.symbol){let r=this._getOrReturnCtx(e);return j(r,{code:P.invalid_type,expected:C.symbol,received:r.parsedType}),W}return ft(e.data)}}Nd.create=(e)=>{return new Nd({typeName:R.ZodSymbol,...Q(e)})};class nc extends oe{_parse(e){if(this._getType(e)!==C.undefined){let r=this._getOrReturnCtx(e);return j(r,{code:P.invalid_type,expected:C.undefined,received:r.parsedType}),W}return ft(e.data)}}nc.create=(e)=>{return new nc({typeName:R.ZodUndefined,...Q(e)})};class oc extends oe{_parse(e){if(this._getType(e)!==C.null){let r=this._getOrReturnCtx(e);return j(r,{code:P.invalid_type,expected:C.null,received:r.parsedType}),W}return ft(e.data)}}oc.create=(e)=>{return new oc({typeName:R.ZodNull,...Q(e)})};class Dd extends oe{constructor(){super(...arguments);this._any=!0}_parse(e){return ft(e.data)}}Dd.create=(e)=>{return new Dd({typeName:R.ZodAny,...Q(e)})};class wo extends oe{constructor(){super(...arguments);this._unknown=!0}_parse(e){return ft(e.data)}}wo.create=(e)=>{return new wo({typeName:R.ZodUnknown,...Q(e)})};class Vr extends oe{_parse(e){let t=this._getOrReturnCtx(e);return j(t,{code:P.invalid_type,expected:C.never,received:t.parsedType}),W}}Vr.create=(e)=>{return new Vr({typeName:R.ZodNever,...Q(e)})};class jd extends oe{_parse(e){if(this._getType(e)!==C.undefined){let r=this._getOrReturnCtx(e);return j(r,{code:P.invalid_type,expected:C.void,received:r.parsedType}),W}return ft(e.data)}}jd.create=(e)=>{return new jd({typeName:R.ZodVoid,...Q(e)})};class Er extends oe{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),o=this._def;if(t.parsedType!==C.array)return j(t,{code:P.invalid_type,expected:C.array,received:t.parsedType}),W;if(o.exactLength!==null){let i=t.data.length>o.exactLength.value,s=t.data.length<o.exactLength.value;if(i||s)j(t,{code:i?P.too_big:P.too_small,minimum:s?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty()}if(o.minLength!==null){if(t.data.length<o.minLength.value)j(t,{code:P.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()}if(o.maxLength!==null){if(t.data.length>o.maxLength.value)j(t,{code:P.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()}if(t.common.async)return Promise.all([...t.data].map((i,s)=>{return o.type._parseAsync(new ur(t,i,t.path,s))})).then((i)=>{return at.mergeArray(r,i)});let n=[...t.data].map((i,s)=>{return o.type._parseSync(new ur(t,i,t.path,s))});return at.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new Er({...this._def,minLength:{value:e,message:F.toString(t)}})}max(e,t){return new Er({...this._def,maxLength:{value:e,message:F.toString(t)}})}length(e,t){return new Er({...this._def,exactLength:{value:e,message:F.toString(t)}})}nonempty(e){return this.min(1,e)}}Er.create=(e,t)=>{return new Er({type:e,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray,...Q(t)})};function Di(e){if(e instanceof ze){let t={};for(let r in e.shape){let o=e.shape[r];t[r]=Gt.create(Di(o))}return new ze({...e._def,shape:()=>t})}else if(e instanceof Er)return new Er({...e._def,type:Di(e.element)});else if(e instanceof Gt)return Gt.create(Di(e.unwrap()));else if(e instanceof Tn)return Tn.create(Di(e.unwrap()));else if(e instanceof Wr)return Wr.create(e.items.map((t)=>Di(t)));else return e}class ze extends oe{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=ae.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==C.object){let c=this._getOrReturnCtx(e);return j(c,{code:P.invalid_type,expected:C.object,received:c.parsedType}),W}let{status:r,ctx:o}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof Vr&&this._def.unknownKeys==="strip")){for(let c in o.data)if(!i.includes(c))s.push(c)}let a=[];for(let c of i){let u=n[c],d=o.data[c];a.push({key:{status:"valid",value:c},value:u._parse(new ur(o,d,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Vr){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of s)a.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict"){if(s.length>0)j(o,{code:P.unrecognized_keys,keys:s}),r.dirty()}else if(c==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of s){let d=o.data[u];a.push({key:{status:"valid",value:u},value:c._parse(new ur(o,d,o.path,u)),alwaysSet:u in o.data})}}if(o.common.async)return Promise.resolve().then(async()=>{let c=[];for(let u of a){let d=await u.key,p=await u.value;c.push({key:d,value:p,alwaysSet:u.alwaysSet})}return c}).then((c)=>{return at.mergeObjectSync(r,c)});else return at.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(e){return F.errToObj,new ze({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let o=this._def.errorMap?.(t,r).message??r.defaultError;if(t.code==="unrecognized_keys")return{message:F.errToObj(e).message??o};return{message:o}}}:{}})}strip(){return new ze({...this._def,unknownKeys:"strip"})}passthrough(){return new ze({...this._def,unknownKeys:"passthrough"})}extend(e){return new ze({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ze({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:R.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ze({...this._def,catchall:e})}pick(e){let t={};for(let r of ae.objectKeys(e))if(e[r]&&this.shape[r])t[r]=this.shape[r];return new ze({...this._def,shape:()=>t})}omit(e){let t={};for(let r of ae.objectKeys(this.shape))if(!e[r])t[r]=this.shape[r];return new ze({...this._def,shape:()=>t})}deepPartial(){return Di(this)}partial(e){let t={};for(let r of ae.objectKeys(this.shape)){let o=this.shape[r];if(e&&!e[r])t[r]=o;else t[r]=o.optional()}return new ze({...this._def,shape:()=>t})}required(e){let t={};for(let r of ae.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let n=this.shape[r];while(n instanceof Gt)n=n._def.innerType;t[r]=n}return new ze({...this._def,shape:()=>t})}keyof(){return dR(ae.objectKeys(this.shape))}}ze.create=(e,t)=>{return new ze({shape:()=>e,unknownKeys:"strip",catchall:Vr.create(),typeName:R.ZodObject,...Q(t)})};ze.strictCreate=(e,t)=>{return new ze({shape:()=>e,unknownKeys:"strict",catchall:Vr.create(),typeName:R.ZodObject,...Q(t)})};ze.lazycreate=(e,t)=>{return new ze({shape:e,unknownKeys:"strip",catchall:Vr.create(),typeName:R.ZodObject,...Q(t)})};class ic extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function o(n){for(let s of n)if(s.result.status==="valid")return s.result;for(let s of n)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;let i=n.map((s)=>new jt(s.ctx.common.issues));return j(t,{code:P.invalid_union,unionErrors:i}),W}if(t.common.async)return Promise.all(r.map(async(n)=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(o);else{let n=void 0,i=[];for(let a of r){let c={...t,common:{...t.common,issues:[]},parent:null},u=a._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;else if(u.status==="dirty"&&!n)n={result:u,ctx:c};if(c.common.issues.length)i.push(c.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let s=i.map((a)=>new jt(a));return j(t,{code:P.invalid_union,unionErrors:s}),W}}get options(){return this._def.options}}ic.create=(e,t)=>{return new ic({options:e,typeName:R.ZodUnion,...Q(t)})};var qr=(e)=>{if(e instanceof ac)return qr(e.schema);else if(e instanceof Pr)return qr(e.innerType());else if(e instanceof cc)return[e.value];else if(e instanceof ko)return e.options;else if(e instanceof lc)return ae.objectValues(e.enum);else if(e instanceof uc)return qr(e._def.innerType);else if(e instanceof nc)return[void 0];else if(e instanceof oc)return[null];else if(e instanceof Gt)return[void 0,...qr(e.unwrap())];else if(e instanceof Tn)return[null,...qr(e.unwrap())];else if(e instanceof Zy)return qr(e.unwrap());else if(e instanceof pc)return qr(e.unwrap());else if(e instanceof dc)return qr(e._def.innerType);else return[]};class qy extends oe{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.object)return j(t,{code:P.invalid_type,expected:C.object,received:t.parsedType}),W;let r=this.discriminator,o=t.data[r],n=this.optionsMap.get(o);if(!n)return j(t,{code:P.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),W;if(t.common.async)return n._parseAsync({data:t.data,path:t.path,parent:t});else return n._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,r){let o=new Map;for(let n of t){let i=qr(n.shape[e]);if(!i.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of i){if(o.has(s))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,n)}}return new qy({typeName:R.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:o,...Q(r)})}}function By(e,t){let r=Br(e),o=Br(t);if(e===t)return{valid:!0,data:e};else if(r===C.object&&o===C.object){let n=ae.objectKeys(t),i=ae.objectKeys(e).filter((a)=>n.indexOf(a)!==-1),s={...e,...t};for(let a of i){let c=By(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===C.array&&o===C.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],c=By(s,a);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else if(r===C.date&&o===C.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}class sc extends oe{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),o=(n,i)=>{if(Ly(n)||Ly(i))return W;let s=By(n.value,i.value);if(!s.valid)return j(r,{code:P.invalid_intersection_types}),W;if(Fy(n)||Fy(i))t.dirty();return{status:t.value,value:s.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,i])=>o(n,i));else return o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}sc.create=(e,t,r)=>{return new sc({left:e,right:t,typeName:R.ZodIntersection,...Q(r)})};class Wr extends oe{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.array)return j(r,{code:P.invalid_type,expected:C.array,received:r.parsedType}),W;if(r.data.length<this._def.items.length)return j(r,{code:P.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),W;if(!this._def.rest&&r.data.length>this._def.items.length)j(r,{code:P.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let n=[...r.data].map((i,s)=>{let a=this._def.items[s]||this._def.rest;if(!a)return null;return a._parse(new ur(r,i,r.path,s))}).filter((i)=>!!i);if(r.common.async)return Promise.all(n).then((i)=>{return at.mergeArray(t,i)});else return at.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Wr({...this._def,rest:e})}}Wr.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new Wr({items:e,typeName:R.ZodTuple,rest:null,...Q(t)})};class zd extends oe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.object)return j(r,{code:P.invalid_type,expected:C.object,received:r.parsedType}),W;let o=[],n=this._def.keyType,i=this._def.valueType;for(let s in r.data)o.push({key:n._parse(new ur(r,s,r.path,s)),value:i._parse(new ur(r,r.data[s],r.path,s)),alwaysSet:s in r.data});if(r.common.async)return at.mergeObjectAsync(t,o);else return at.mergeObjectSync(t,o)}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof oe)return new zd({keyType:e,valueType:t,typeName:R.ZodRecord,...Q(r)});return new zd({keyType:Zr.create(),valueType:e,typeName:R.ZodRecord,...Q(t)})}}class Ud extends oe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.map)return j(r,{code:P.invalid_type,expected:C.map,received:r.parsedType}),W;let o=this._def.keyType,n=this._def.valueType,i=[...r.data.entries()].map(([s,a],c)=>{return{key:o._parse(new ur(r,s,r.path,[c,"key"])),value:n._parse(new ur(r,a,r.path,[c,"value"]))}});if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let a of i){let c=await a.key,u=await a.value;if(c.status==="aborted"||u.status==="aborted")return W;if(c.status==="dirty"||u.status==="dirty")t.dirty();s.set(c.value,u.value)}return{status:t.value,value:s}})}else{let s=new Map;for(let a of i){let{key:c,value:u}=a;if(c.status==="aborted"||u.status==="aborted")return W;if(c.status==="dirty"||u.status==="dirty")t.dirty();s.set(c.value,u.value)}return{status:t.value,value:s}}}}Ud.create=(e,t,r)=>{return new Ud({valueType:t,keyType:e,typeName:R.ZodMap,...Q(r)})};class Ui extends oe{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.set)return j(r,{code:P.invalid_type,expected:C.set,received:r.parsedType}),W;let o=this._def;if(o.minSize!==null){if(r.data.size<o.minSize.value)j(r,{code:P.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),t.dirty()}if(o.maxSize!==null){if(r.data.size>o.maxSize.value)j(r,{code:P.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),t.dirty()}let n=this._def.valueType;function i(a){let c=new Set;for(let u of a){if(u.status==="aborted")return W;if(u.status==="dirty")t.dirty();c.add(u.value)}return{status:t.value,value:c}}let s=[...r.data.values()].map((a,c)=>n._parse(new ur(r,a,r.path,c)));if(r.common.async)return Promise.all(s).then((a)=>i(a));else return i(s)}min(e,t){return new Ui({...this._def,minSize:{value:e,message:F.toString(t)}})}max(e,t){return new Ui({...this._def,maxSize:{value:e,message:F.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ui.create=(e,t)=>{return new Ui({valueType:e,minSize:null,maxSize:null,typeName:R.ZodSet,...Q(t)})};class tc extends oe{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.function)return j(t,{code:P.invalid_type,expected:C.function,received:t.parsedType}),W;function r(s,a){return Cd({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Qa(),kn].filter((c)=>!!c),issueData:{code:P.invalid_arguments,argumentsError:a}})}function o(s,a){return Cd({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Qa(),kn].filter((c)=>!!c),issueData:{code:P.invalid_return_type,returnTypeError:a}})}let n={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Li){let s=this;return ft(async function(...a){let c=new jt([]),u=await s._def.args.parseAsync(a,n).catch((f)=>{throw c.addIssue(r(a,f)),c}),d=await Reflect.apply(i,this,u);return await s._def.returns._def.type.parseAsync(d,n).catch((f)=>{throw c.addIssue(o(d,f)),c})})}else{let s=this;return ft(function(...a){let c=s._def.args.safeParse(a,n);if(!c.success)throw new jt([r(a,c.error)]);let u=Reflect.apply(i,this,c.data),d=s._def.returns.safeParse(u,n);if(!d.success)throw new jt([o(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new tc({...this._def,args:Wr.create(e).rest(wo.create())})}returns(e){return new tc({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new tc({args:e?e:Wr.create([]).rest(wo.create()),returns:t||wo.create(),typeName:R.ZodFunction,...Q(r)})}}class ac extends oe{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})}}ac.create=(e,t)=>{return new ac({getter:e,typeName:R.ZodLazy,...Q(t)})};class cc extends oe{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return j(t,{received:t.data,code:P.invalid_literal,expected:this._def.value}),W}return{status:"valid",value:e.data}}get value(){return this._def.value}}cc.create=(e,t)=>{return new cc({value:e,typeName:R.ZodLiteral,...Q(t)})};function dR(e,t){return new ko({values:e,typeName:R.ZodEnum,...Q(t)})}class ko extends oe{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return j(t,{expected:ae.joinValues(r),received:t.parsedType,code:P.invalid_type}),W}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return j(t,{received:t.data,code:P.invalid_enum_value,options:r}),W}return ft(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 ko.create(e,{...this._def,...t})}exclude(e,t=this._def){return ko.create(this.options.filter((r)=>!e.includes(r)),{...this._def,...t})}}ko.create=dR;class lc extends oe{_parse(e){let t=ae.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==C.string&&r.parsedType!==C.number){let o=ae.objectValues(t);return j(r,{expected:ae.joinValues(o),received:r.parsedType,code:P.invalid_type}),W}if(!this._cache)this._cache=new Set(ae.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let o=ae.objectValues(t);return j(r,{received:r.data,code:P.invalid_enum_value,options:o}),W}return ft(e.data)}get enum(){return this._def.values}}lc.create=(e,t)=>{return new lc({values:e,typeName:R.ZodNativeEnum,...Q(t)})};class Li extends oe{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.promise&&t.common.async===!1)return j(t,{code:P.invalid_type,expected:C.promise,received:t.parsedType}),W;let r=t.parsedType===C.promise?t.data:Promise.resolve(t.data);return ft(r.then((o)=>{return this._def.type.parseAsync(o,{path:t.path,errorMap:t.common.contextualErrorMap})}))}}Li.create=(e,t)=>{return new Li({type:e,typeName:R.ZodPromise,...Q(t)})};class Pr extends oe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),o=this._def.effect||null,n={addIssue:(i)=>{if(j(r,i),i.fatal)t.abort();else t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),o.type==="preprocess"){let i=o.transform(r.data,n);if(r.common.async)return Promise.resolve(i).then(async(s)=>{if(t.value==="aborted")return W;let a=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});if(a.status==="aborted")return W;if(a.status==="dirty")return Ni(a.value);if(t.value==="dirty")return Ni(a.value);return a});else{if(t.value==="aborted")return W;let s=this._def.schema._parseSync({data:i,path:r.path,parent:r});if(s.status==="aborted")return W;if(s.status==="dirty")return Ni(s.value);if(t.value==="dirty")return Ni(s.value);return s}}if(o.type==="refinement"){let i=(s)=>{let a=o.refinement(s,n);if(r.common.async)return Promise.resolve(a);if(a instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(s.status==="aborted")return W;if(s.status==="dirty")t.dirty();return i(s.value),{status:t.value,value:s.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((s)=>{if(s.status==="aborted")return W;if(s.status==="dirty")t.dirty();return i(s.value).then(()=>{return{status:t.value,value:s.value}})})}if(o.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!xo(i))return W;let s=o.transform(i.value,n);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((i)=>{if(!xo(i))return W;return Promise.resolve(o.transform(i.value,n)).then((s)=>({status:t.value,value:s}))});ae.assertNever(o)}}Pr.create=(e,t,r)=>{return new Pr({schema:e,typeName:R.ZodEffects,effect:t,...Q(r)})};Pr.createWithPreprocess=(e,t,r)=>{return new Pr({schema:t,effect:{type:"preprocess",transform:e},typeName:R.ZodEffects,...Q(r)})};class Gt extends oe{_parse(e){if(this._getType(e)===C.undefined)return ft(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Gt.create=(e,t)=>{return new Gt({innerType:e,typeName:R.ZodOptional,...Q(t)})};class Tn extends oe{_parse(e){if(this._getType(e)===C.null)return ft(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Tn.create=(e,t)=>{return new Tn({innerType:e,typeName:R.ZodNullable,...Q(t)})};class uc extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;if(t.parsedType===C.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}uc.create=(e,t)=>{return new uc({innerType:e,typeName:R.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...Q(t)})};class dc extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(ec(o))return o.then((n)=>{return{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new jt(r.common.issues)},input:r.data})}});else return{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new jt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}dc.create=(e,t)=>{return new dc({innerType:e,typeName:R.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...Q(t)})};class Ld extends oe{_parse(e){if(this._getType(e)!==C.nan){let r=this._getOrReturnCtx(e);return j(r,{code:P.invalid_type,expected:C.nan,received:r.parsedType}),W}return{status:"valid",value:e.data}}}Ld.create=(e)=>{return new Ld({typeName:R.ZodNaN,...Q(e)})};var Zye=Symbol("zod_brand");class Zy extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Fd extends oe{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return W;if(n.status==="dirty")return t.dirty(),Ni(n.value);else return this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();else{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(o.status==="aborted")return W;if(o.status==="dirty")return t.dirty(),{status:"dirty",value:o.value};else return this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,t){return new Fd({in:e,out:t,typeName:R.ZodPipeline})}}class pc extends oe{_parse(e){let t=this._def.innerType._parse(e),r=(o)=>{if(xo(o))o.value=Object.freeze(o.value);return o};return ec(t)?t.then((o)=>r(o)):r(t)}unwrap(){return this._def.innerType}}pc.create=(e,t)=>{return new pc({innerType:e,typeName:R.ZodReadonly,...Q(t)})};var Vye={object:ze.lazycreate},R;(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"})(R||(R={}));var Wye=Zr.create,Kye=ji.create,Gye=Ld.create,Jye=zi.create,Xye=Md.create,Yye=rc.create,Qye=Nd.create,ebe=nc.create,tbe=oc.create,rbe=Dd.create,nbe=wo.create,obe=Vr.create,ibe=jd.create,sbe=Er.create,pR=ze.create,abe=ze.strictCreate,cbe=ic.create,lbe=qy.create,ube=sc.create,dbe=Wr.create,pbe=zd.create,fbe=Ud.create,mbe=Ui.create,gbe=tc.create,hbe=ac.create,ybe=cc.create,bbe=ko.create,_be=lc.create,vbe=Li.create,Sbe=Pr.create,xbe=Gt.create,wbe=Tn.create,kbe=Pr.createWithPreprocess,Tbe=Fd.create;var dr={};xr(dr,{version:()=>Gb,util:()=>A,treeifyError:()=>Zd,toJSONSchema:()=>rs,toDotPath:()=>gR,safeParseAsync:()=>In,safeParse:()=>Pn,registry:()=>Ic,regexes:()=>Rn,prettifyError:()=>Vd,parseAsync:()=>Io,parse:()=>Po,locales:()=>Xi,isValidJWT:()=>CR,isValidBase64URL:()=>AR,isValidBase64:()=>t_,globalRegistry:()=>Tt,globalConfig:()=>fc,function:()=>Pf,formatError:()=>Zi,flattenError:()=>qi,config:()=>He,clone:()=>ct,_xid:()=>Lc,_void:()=>_f,_uuidv7:()=>Cc,_uuidv6:()=>Ac,_uuidv4:()=>Oc,_uuid:()=>$c,_url:()=>Mc,_uppercase:()=>Qc,_unknown:()=>Oo,_union:()=>hV,_undefined:()=>gf,_ulid:()=>Uc,_uint64:()=>ff,_uint32:()=>lf,_tuple:()=>ev,_trim:()=>il,_transform:()=>TV,_toUpperCase:()=>al,_toLowerCase:()=>sl,_templateLiteral:()=>MV,_symbol:()=>mf,_success:()=>$V,_stringbool:()=>Tf,_stringFormat:()=>Ef,_string:()=>tf,_startsWith:()=>tl,_size:()=>Jc,_set:()=>SV,_safeParseAsync:()=>Jd,_safeParse:()=>Gd,_regex:()=>Xc,_refine:()=>kf,_record:()=>_V,_readonly:()=>CV,_property:()=>Q_,_promise:()=>DV,_positive:()=>G_,_pipe:()=>AV,_parseAsync:()=>Kd,_parse:()=>Wd,_overwrite:()=>Yr,_optional:()=>EV,_number:()=>nf,_nullable:()=>PV,_null:()=>hf,_normalize:()=>ol,_nonpositive:()=>X_,_nonoptional:()=>RV,_nonnegative:()=>Y_,_never:()=>bf,_negative:()=>J_,_nativeEnum:()=>wV,_nanoid:()=>Dc,_nan:()=>Sf,_multipleOf:()=>Ao,_minSize:()=>Co,_minLength:()=>An,_min:()=>Et,_mime:()=>nl,_maxSize:()=>Qi,_maxLength:()=>es,_max:()=>Jt,_map:()=>vV,_lte:()=>Jt,_lt:()=>Jr,_lowercase:()=>Yc,_literal:()=>kV,_length:()=>ts,_lazy:()=>NV,_ksuid:()=>Fc,_jwt:()=>Gc,_isoTime:()=>B_,_isoDuration:()=>q_,_isoDateTime:()=>F_,_isoDate:()=>H_,_ipv6:()=>Bc,_ipv4:()=>Hc,_intersection:()=>bV,_int64:()=>pf,_int32:()=>cf,_int:()=>of,_includes:()=>el,_guid:()=>Yi,_gte:()=>Et,_gt:()=>Xr,_float64:()=>af,_float32:()=>sf,_file:()=>xf,_enum:()=>xV,_endsWith:()=>rl,_emoji:()=>Nc,_email:()=>Rc,_e164:()=>Kc,_discriminatedUnion:()=>yV,_default:()=>IV,_date:()=>vf,_custom:()=>wf,_cuid2:()=>zc,_cuid:()=>jc,_coercedString:()=>L_,_coercedNumber:()=>Z_,_coercedDate:()=>K_,_coercedBoolean:()=>V_,_coercedBigint:()=>W_,_cidrv6:()=>Zc,_cidrv4:()=>qc,_catch:()=>OV,_boolean:()=>uf,_bigint:()=>df,_base64url:()=>Wc,_base64:()=>Vc,_array:()=>cl,_any:()=>yf,TimePrecision:()=>rf,NEVER:()=>Hd,JSONSchemaGenerator:()=>If,JSONSchema:()=>jR,Doc:()=>ep,$output:()=>Qp,$input:()=>ef,$constructor:()=>b,$brand:()=>Bd,$ZodXID:()=>pp,$ZodVoid:()=>$p,$ZodUnknown:()=>$o,$ZodUnion:()=>Tc,$ZodUndefined:()=>Ep,$ZodUUID:()=>op,$ZodURL:()=>sp,$ZodULID:()=>dp,$ZodType:()=>G,$ZodTuple:()=>On,$ZodTransform:()=>Gi,$ZodTemplateLiteral:()=>Gp,$ZodSymbol:()=>Tp,$ZodSuccess:()=>Zp,$ZodStringFormat:()=>xe,$ZodString:()=>$n,$ZodSet:()=>Dp,$ZodRegistry:()=>Pc,$ZodRecord:()=>Mp,$ZodRealError:()=>Bi,$ZodReadonly:()=>Kp,$ZodPromise:()=>Jp,$ZodPrefault:()=>Bp,$ZodPipe:()=>Ji,$ZodOptional:()=>Lp,$ZodObject:()=>kc,$ZodNumberFormat:()=>wp,$ZodNumber:()=>xc,$ZodNullable:()=>Fp,$ZodNull:()=>Pp,$ZodNonOptional:()=>qp,$ZodNever:()=>Rp,$ZodNanoID:()=>cp,$ZodNaN:()=>Wp,$ZodMap:()=>Np,$ZodLiteral:()=>zp,$ZodLazy:()=>Xp,$ZodKSUID:()=>fp,$ZodJWT:()=>Sp,$ZodIntersection:()=>Cp,$ZodISOTime:()=>Qb,$ZodISODuration:()=>e_,$ZodISODateTime:()=>Xb,$ZodISODate:()=>Yb,$ZodIPv6:()=>gp,$ZodIPv4:()=>mp,$ZodGUID:()=>np,$ZodFunction:()=>tv,$ZodFile:()=>Up,$ZodError:()=>Sc,$ZodEnum:()=>jp,$ZodEmoji:()=>ap,$ZodEmail:()=>ip,$ZodE164:()=>vp,$ZodDiscriminatedUnion:()=>Ap,$ZodDefault:()=>Hp,$ZodDate:()=>Op,$ZodCustomStringFormat:()=>xp,$ZodCustom:()=>Yp,$ZodCheckUpperCase:()=>Hb,$ZodCheckStringFormat:()=>Vi,$ZodCheckStartsWith:()=>qb,$ZodCheckSizeEquals:()=>Db,$ZodCheckRegex:()=>Lb,$ZodCheckProperty:()=>Vb,$ZodCheckOverwrite:()=>Kb,$ZodCheckNumberFormat:()=>Ab,$ZodCheckMultipleOf:()=>Ob,$ZodCheckMinSize:()=>Nb,$ZodCheckMinLength:()=>zb,$ZodCheckMimeType:()=>Wb,$ZodCheckMaxSize:()=>Mb,$ZodCheckMaxLength:()=>jb,$ZodCheckLowerCase:()=>Fb,$ZodCheckLessThan:()=>Yd,$ZodCheckLengthEquals:()=>Ub,$ZodCheckIncludes:()=>Bb,$ZodCheckGreaterThan:()=>Qd,$ZodCheckEndsWith:()=>Zb,$ZodCheckBigIntFormat:()=>Cb,$ZodCheck:()=>Me,$ZodCatch:()=>Vp,$ZodCUID2:()=>up,$ZodCUID:()=>lp,$ZodCIDRv6:()=>yp,$ZodCIDRv4:()=>hp,$ZodBoolean:()=>Wi,$ZodBigIntFormat:()=>kp,$ZodBigInt:()=>wc,$ZodBase64URL:()=>_p,$ZodBase64:()=>bp,$ZodAsyncError:()=>Kr,$ZodArray:()=>Ki,$ZodAny:()=>Ip});var Hd=Object.freeze({status:"aborted"});function b(e,t,r){function o(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(e),t(a,c);for(let d in s.prototype)if(!(d in a))Object.defineProperty(a,d,{value:s.prototype[d].bind(a)});a._zod.constr=s,a._zod.def=c}let n=r?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function s(a){var c;let u=r?.Parent?new i:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let d of u._zod.deferred)d();return u}return Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}var Bd=Symbol("zod_brand");class Kr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var fc={};function He(e){if(e)Object.assign(fc,e);return fc}var A={};xr(A,{unwrapMessage:()=>mc,stringifyPrimitive:()=>N,required:()=>gZ,randomString:()=>sZ,propertyKeyTypes:()=>bc,promiseAllObject:()=>iZ,primitiveTypes:()=>Xy,prefixIssues:()=>kt,pick:()=>uZ,partial:()=>mZ,optionalKeys:()=>Yy,omit:()=>dZ,numKeys:()=>aZ,nullish:()=>En,normalizeParams:()=>$,merge:()=>fZ,jsonStringifyReplacer:()=>Wy,joinValues:()=>E,issue:()=>tb,isPlainObject:()=>Hi,isObject:()=>Fi,getSizableOrigin:()=>_c,getParsedType:()=>cZ,getLengthableOrigin:()=>vc,getEnumValues:()=>gc,getElementAtPath:()=>oZ,floatSafeRemainder:()=>Ky,finalizeIssue:()=>zt,extend:()=>pZ,escapeRegex:()=>Gr,esc:()=>To,defineLazy:()=>me,createTransparentProxy:()=>lZ,clone:()=>ct,cleanRegex:()=>yc,cleanEnum:()=>hZ,captureStackTrace:()=>qd,cached:()=>hc,assignProp:()=>Gy,assertNotEqual:()=>eZ,assertNever:()=>rZ,assertIs:()=>tZ,assertEqual:()=>Q6,assert:()=>nZ,allowsEval:()=>Jy,aborted:()=>Eo,NUMBER_FORMAT_RANGES:()=>Qy,Class:()=>fR,BIGINT_FORMAT_RANGES:()=>eb});function Q6(e){return e}function eZ(e){return e}function tZ(e){}function rZ(e){throw Error()}function nZ(e){}function gc(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function E(e,t="|"){return e.map((r)=>N(r)).join(t)}function Wy(e,t){if(typeof t==="bigint")return t.toString();return t}function hc(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function En(e){return e===null||e===void 0}function yc(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ky(e,t){let r=(e.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,n=r>o?r:o,i=Number.parseInt(e.toFixed(n).replace(".","")),s=Number.parseInt(t.toFixed(n).replace(".",""));return i%s/10**n}function me(e,t,r){Object.defineProperty(e,t,{get(){{let n=r();return e[t]=n,n}throw Error("cached value already set")},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Gy(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function oZ(e,t){if(!t)return e;return t.reduce((r,o)=>r?.[o],e)}function iZ(e){let t=Object.keys(e),r=t.map((o)=>e[o]);return Promise.all(r).then((o)=>{let n={};for(let i=0;i<t.length;i++)n[t[i]]=o[i];return n})}function sZ(e=10){let r="";for(let o=0;o<e;o++)r+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return r}function To(e){return JSON.stringify(e)}var qd=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Fi(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Jy=hc(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Hi(e){if(Fi(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;if(Fi(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function aZ(e){let t=0;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t++;return t}var cZ=(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}`)}},bc=new Set(["string","number","symbol"]),Xy=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Gr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ct(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function $(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 lZ(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,i){return t??(t=e()),Reflect.set(t,o,n,i)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function N(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Yy(e){return Object.keys(e).filter((t)=>{return e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional"})}var Qy={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]},eb={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function uZ(e,t){let r={},o=e._zod.def;for(let n in t){if(!(n in o.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;r[n]=o.shape[n]}return ct(e,{...e._zod.def,shape:r,checks:[]})}function dZ(e,t){let r={...e._zod.def.shape},o=e._zod.def;for(let n in t){if(!(n in o.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;delete r[n]}return ct(e,{...e._zod.def,shape:r,checks:[]})}function pZ(e,t){if(!Hi(t))throw Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let o={...e._zod.def.shape,...t};return Gy(this,"shape",o),o},checks:[]};return ct(e,r)}function fZ(e,t){return ct(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return Gy(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function mZ(e,t,r){let o=t._zod.def.shape,n={...o};if(r)for(let i in r){if(!(i in o))throw Error(`Unrecognized key: "${i}"`);if(!r[i])continue;n[i]=e?new e({type:"optional",innerType:o[i]}):o[i]}else for(let i in o)n[i]=e?new e({type:"optional",innerType:o[i]}):o[i];return ct(t,{...t._zod.def,shape:n,checks:[]})}function gZ(e,t,r){let o=t._zod.def.shape,n={...o};if(r)for(let i in r){if(!(i in n))throw Error(`Unrecognized key: "${i}"`);if(!r[i])continue;n[i]=new e({type:"nonoptional",innerType:o[i]})}else for(let i in o)n[i]=new e({type:"nonoptional",innerType:o[i]});return ct(t,{...t._zod.def,shape:n,checks:[]})}function Eo(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function kt(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function mc(e){return typeof e==="string"?e:e?.message}function zt(e,t,r){let o={...e,path:e.path??[]};if(!e.message){let n=mc(e.inst?._zod.def?.error?.(e))??mc(t?.error?.(e))??mc(r.customError?.(e))??mc(r.localeError?.(e))??"Invalid input";o.message=n}if(delete o.inst,delete o.continue,!t?.reportInput)delete o.input;return o}function _c(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function vc(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function tb(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}function hZ(e){return Object.entries(e).filter(([t,r])=>{return Number.isNaN(Number.parseInt(t,10))}).map((t)=>t[1])}class fR{constructor(...e){}}var mR=(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,Wy,2)},enumerable:!0})},Sc=b("$ZodError",mR),Bi=b("$ZodError",mR,{Parent:Error});function qi(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function Zi(e,t){let r=t||function(i){return i.message},o={_errors:[]},n=(i)=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>n({issues:a}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)o._errors.push(r(s));else{let a=o,c=0;while(c<s.path.length){let u=s.path[c];if(c!==s.path.length-1)a[u]=a[u]||{_errors:[]};else a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s));a=a[u],c++}}};return n(e),o}function Zd(e,t){let r=t||function(i){return i.message},o={errors:[]},n=(i,s=[])=>{var a,c;for(let u of i.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map((d)=>n({issues:d},u.path));else if(u.code==="invalid_key")n({issues:u.issues},u.path);else if(u.code==="invalid_element")n({issues:u.issues},u.path);else{let d=[...s,...u.path];if(d.length===0){o.errors.push(r(u));continue}let p=o,f=0;while(f<d.length){let m=d[f],g=f===d.length-1;if(typeof m==="string")p.properties??(p.properties={}),(a=p.properties)[m]??(a[m]={errors:[]}),p=p.properties[m];else p.items??(p.items=[]),(c=p.items)[m]??(c[m]={errors:[]}),p=p.items[m];if(g)p.errors.push(r(u));f++}}};return n(e),o}function gR(e){let t=[];for(let r of e)if(typeof r==="number")t.push(`[${r}]`);else if(typeof r==="symbol")t.push(`[${JSON.stringify(String(r))}]`);else if(/[^\w$]/.test(r))t.push(`[${JSON.stringify(r)}]`);else{if(t.length)t.push(".");t.push(r)}return t.join("")}function Vd(e){let t=[],r=[...e.issues].sort((o,n)=>o.path.length-n.path.length);for(let o of r)if(t.push(`✖ ${o.message}`),o.path?.length)t.push(` → at ${gR(o.path)}`);return t.join(`
73
- `)}var Wd=(e)=>(t,r,o,n)=>{let i=o?Object.assign(o,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new Kr;if(s.issues.length){let a=new(n?.Err??e)(s.issues.map((c)=>zt(c,i,He())));throw qd(a,n?.callee),a}return s.value},Po=Wd(Bi),Kd=(e)=>async(t,r,o,n)=>{let i=o?Object.assign(o,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)s=await s;if(s.issues.length){let a=new(n?.Err??e)(s.issues.map((c)=>zt(c,i,He())));throw qd(a,n?.callee),a}return s.value},Io=Kd(Bi),Gd=(e)=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new Kr;return i.issues.length?{success:!1,error:new(e??Sc)(i.issues.map((s)=>zt(s,n,He())))}:{success:!0,data:i.value}},Pn=Gd(Bi),Jd=(e)=>async(t,r,o)=>{let n=o?Object.assign(o,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)i=await i;return i.issues.length?{success:!1,error:new e(i.issues.map((s)=>zt(s,n,He())))}:{success:!0,data:i.value}},In=Jd(Bi);var Rn={};xr(Rn,{xid:()=>ib,uuid7:()=>SZ,uuid6:()=>vZ,uuid4:()=>_Z,uuid:()=>Ro,uppercase:()=>$b,unicodeEmail:()=>kZ,undefined:()=>Ib,ulid:()=>ob,time:()=>vb,string:()=>xb,rfc5322Email:()=>wZ,number:()=>Tb,null:()=>Pb,nanoid:()=>ab,lowercase:()=>Rb,ksuid:()=>sb,ipv6:()=>fb,ipv4:()=>pb,integer:()=>kb,html5Email:()=>xZ,hostname:()=>yb,guid:()=>lb,extendedDuration:()=>bZ,emoji:()=>db,email:()=>ub,e164:()=>bb,duration:()=>cb,domain:()=>PZ,datetime:()=>Sb,date:()=>_b,cuid2:()=>nb,cuid:()=>rb,cidrv6:()=>gb,cidrv4:()=>mb,browserEmail:()=>TZ,boolean:()=>Eb,bigint:()=>wb,base64url:()=>Xd,base64:()=>hb,_emoji:()=>EZ});var rb=/^[cC][^\s-]{8,}$/,nb=/^[0-9a-z]+$/,ob=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ib=/^[0-9a-vA-V]{20}$/,sb=/^[A-Za-z0-9]{27}$/,ab=/^[a-zA-Z0-9_-]{21}$/,cb=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,bZ=/^[-+]?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)?)??$/,lb=/^([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})$/,Ro=(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})$`)},_Z=Ro(4),vZ=Ro(6),SZ=Ro(7),ub=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,xZ=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,wZ=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,kZ=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,TZ=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,EZ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function db(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var pb=/^(?:(?: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])$/,fb=/^(([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})$/,mb=/^((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])$/,gb=/^(([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])$/,hb=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Xd=/^[A-Za-z0-9_-]*$/,yb=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,PZ=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,bb=/^\+(?:[0-9]){6,14}[0-9]$/,hR="(?:(?:\\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])))",_b=new RegExp(`^${hR}$`);function yR(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 vb(e){return new RegExp(`^${yR(e)}$`)}function Sb(e){let t=yR({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-]\\d{2}:\\d{2})");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${hR}T(?:${o})$`)}var xb=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},wb=/^\d+n?$/,kb=/^\d+$/,Tb=/^-?\d+(?:\.\d+)?/i,Eb=/true|false/i,Pb=/null/i;var Ib=/undefined/i;var Rb=/^[^A-Z]*$/,$b=/^[^a-z]*$/;var Me=b("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),_R={number:"number",bigint:"bigint",object:"date"},Yd=b("$ZodCheckLessThan",(e,t)=>{Me.init(e,t);let r=_R[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<i)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:r,code:"too_big",maximum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Qd=b("$ZodCheckGreaterThan",(e,t)=>{Me.init(e,t);let r=_R[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>i)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:r,code:"too_small",minimum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ob=b("$ZodCheckMultipleOf",(e,t)=>{Me.init(e,t),e._zod.onattach.push((r)=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):Ky(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Ab=b("$ZodCheckNumberFormat",(e,t)=>{Me.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,i]=Qy[t.format];e._zod.onattach.push((s)=>{let a=s._zod.bag;if(a.format=t.format,a.minimum=n,a.maximum=i,r)a.pattern=kb}),e._zod.check=(s)=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:o,format:t.format,code:"invalid_type",input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});return}}if(a<n)s.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inst:e})}}),Cb=b("$ZodCheckBigIntFormat",(e,t)=>{Me.init(e,t);let[r,o]=eb[t.format];e._zod.onattach.push((n)=>{let i=n._zod.bag;i.format=t.format,i.minimum=r,i.maximum=o}),e._zod.check=(n)=>{let i=n.value;if(i<r)n.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(i>o)n.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inst:e})}}),Mb=b("$ZodCheckMaxSize",(e,t)=>{Me.init(e,t),e._zod.when=(r)=>{let o=r.value;return!En(o)&&o.size!==void 0},e._zod.onattach.push((r)=>{let o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<o)r._zod.bag.maximum=t.maximum}),e._zod.check=(r)=>{let o=r.value;if(o.size<=t.maximum)return;r.issues.push({origin:_c(o),code:"too_big",maximum:t.maximum,input:o,inst:e,continue:!t.abort})}}),Nb=b("$ZodCheckMinSize",(e,t)=>{Me.init(e,t),e._zod.when=(r)=>{let o=r.value;return!En(o)&&o.size!==void 0},e._zod.onattach.push((r)=>{let o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>o)r._zod.bag.minimum=t.minimum}),e._zod.check=(r)=>{let o=r.value;if(o.size>=t.minimum)return;r.issues.push({origin:_c(o),code:"too_small",minimum:t.minimum,input:o,inst:e,continue:!t.abort})}}),Db=b("$ZodCheckSizeEquals",(e,t)=>{Me.init(e,t),e._zod.when=(r)=>{let o=r.value;return!En(o)&&o.size!==void 0},e._zod.onattach.push((r)=>{let o=r._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=(r)=>{let o=r.value,n=o.size;if(n===t.size)return;let i=n>t.size;r.issues.push({origin:_c(o),...i?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),jb=b("$ZodCheckMaxLength",(e,t)=>{Me.init(e,t),e._zod.when=(r)=>{let o=r.value;return!En(o)&&o.length!==void 0},e._zod.onattach.push((r)=>{let o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<o)r._zod.bag.maximum=t.maximum}),e._zod.check=(r)=>{let o=r.value;if(o.length<=t.maximum)return;let i=vc(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),zb=b("$ZodCheckMinLength",(e,t)=>{Me.init(e,t),e._zod.when=(r)=>{let o=r.value;return!En(o)&&o.length!==void 0},e._zod.onattach.push((r)=>{let o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>o)r._zod.bag.minimum=t.minimum}),e._zod.check=(r)=>{let o=r.value;if(o.length>=t.minimum)return;let i=vc(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ub=b("$ZodCheckLengthEquals",(e,t)=>{Me.init(e,t),e._zod.when=(r)=>{let o=r.value;return!En(o)&&o.length!==void 0},e._zod.onattach.push((r)=>{let o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=(r)=>{let o=r.value,n=o.length;if(n===t.length)return;let i=vc(o),s=n>t.length;r.issues.push({origin:i,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Vi=b("$ZodCheckStringFormat",(e,t)=>{var r,o;if(Me.init(e,t),e._zod.onattach.push((n)=>{let i=n._zod.bag;if(i.format=t.format,t.pattern)i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),Lb=b("$ZodCheckRegex",(e,t)=>{Vi.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Fb=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Rb),Vi.init(e,t)}),Hb=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=$b),Vi.init(e,t)}),Bb=b("$ZodCheckIncludes",(e,t)=>{Me.init(e,t);let r=Gr(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push((n)=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),qb=b("$ZodCheckStartsWith",(e,t)=>{Me.init(e,t);let r=new RegExp(`^${Gr(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Zb=b("$ZodCheckEndsWith",(e,t)=>{Me.init(e,t);let r=new RegExp(`.*${Gr(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});function bR(e,t,r){if(e.issues.length)t.issues.push(...kt(r,e.issues))}var Vb=b("$ZodCheckProperty",(e,t)=>{Me.init(e,t),e._zod.check=(r)=>{let o=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then((n)=>bR(n,r,t.property));bR(o,r,t.property);return}}),Wb=b("$ZodCheckMimeType",(e,t)=>{Me.init(e,t);let r=new Set(t.mime);e._zod.onattach.push((o)=>{o._zod.bag.mime=t.mime}),e._zod.check=(o)=>{if(r.has(o.value.type))return;o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e})}}),Kb=b("$ZodCheckOverwrite",(e,t)=>{Me.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class ep{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 r=e.split(`
64
+ `))}if(ne(`[Query.streamInput] Finished processing ${t} messages from input stream`),t>0&&this.hasBidirectionalNeeds())ne("[Query.streamInput] Has bidirectional needs, waiting for first result"),await this.waitForFirstResult();ne("[Query] Calling transport.endInput() to close stdin to CLI process"),this.transport.endInput()}catch(t){if(!(t instanceof it))throw t}}waitForFirstResult(){if(this.firstResultReceived)return ne("[Query.waitForFirstResult] Result already received, returning immediately"),Promise.resolve();return new Promise((e)=>{if(this.abortController?.signal.aborted){e();return}this.abortController?.signal.addEventListener("abort",()=>e(),{once:!0}),this.firstResultReceivedResolve=e})}handleHookCallbacks(e,t,r,o){let n=this.hookCallbacks.get(e);if(!n)throw Error(`No hook callback found for ID: ${e}`);return n(t,r,{signal:o})}connectSdkMcpServer(e,t){let r=new Ah((o)=>this.sendMcpServerMessageToCli(e,o));this.sdkMcpTransports.set(e,r),this.sdkMcpServerInstances.set(e,t),t.connect(r).catch((o)=>{if(this.sdkMcpTransports.get(e)===r)this.sdkMcpTransports.delete(e);if(this.sdkMcpServerInstances.get(e)===t)this.sdkMcpServerInstances.delete(e);ne(`[Query.connectSdkMcpServer] Failed to connect MCP server '${e}': ${o}`,{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 o=`${e}:${t.id}`,n=this.pendingMcpResponses.get(o);if(n){n.resolve(t),this.pendingMcpResponses.delete(o);return}}let r={type:"control_request",request_id:La(),request:{subtype:"mcp_message",server_name:e,message:t}};Promise.resolve(this.transport.write(pe(r)+`
65
+ `)).catch((o)=>{ne(`[Query.sendMcpServerMessageToCli] Transport write failed: ${o}`,{level:"error"})})}handleMcpControlRequest(e,t,r){let o="id"in t.message?t.message.id:null,n=`${e}:${o}`;return new Promise((i,s)=>{let a=()=>{this.pendingMcpResponses.delete(n)},c=(d)=>{a(),i(d)},u=(d)=>{a(),s(d)};if(this.pendingMcpResponses.set(n,{resolve:c,reject:u}),r.onmessage)r.onmessage(t.message);else{a(),s(Error("No message handler registered"));return}})}}var bd=500,_d=1048576;var cH=[200,800];class Mh{send;sendTimeoutMs;onError;maxPendingEntries;maxPendingBytes;backoffMs;pending=[];pendingEntries=0;pendingBytes=0;flushPromise=null;constructor(e,t=60000,r,o=bd,n=_d,i=cH){this.send=e;this.sendTimeoutMs=t;this.onError=r;this.maxPendingEntries=o;this.maxPendingBytes=n;this.backoffMs=i}enqueue(e,t){let r=pe(t).length;if(this.pending.push({filePath:e,entries:t,bytes:r}),this.pendingEntries+=t.length,this.pendingBytes+=r,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 o of e){let n=t.get(o.filePath);if(n)n.push(...o.entries);else t.set(o.filePath,o.entries.slice())}let r=this.backoffMs.length+1;for(let[o,n]of t){let i=`SessionStore.append() timed out after ${this.sendTimeoutMs}ms for ${o}`,s,a=1;for(;a<=r;a++)try{await Cr(this.send(o,n),this.sendTimeoutMs,i),s=void 0;break}catch(c){if(s=Er(c),s.message===i)break;let u=this.backoffMs[a-1];if(u===void 0)break;await fu(u)}if(s){ne(`[TranscriptMirrorBatcher] flush failed for ${o} after ${a} attempt(s): ${s}`,{level:"error"});try{this.onError?.(o,s)}catch(c){ne(`[TranscriptMirrorBatcher] onError callback threw: ${c}`,{level:"error"})}}}}}var hg=wg(TR(),1);function Eq(e){let t=e,r="",o=0,n=10;while(t!==r&&o<n)r=t,t=t.normalize("NFKC"),t=t.replace(/[\p{Cf}\p{Co}\p{Cn}]/gu,""),t=t.replace(/[\u200B-\u200F]/g,"").replace(/[\u202A-\u202E]/g,"").replace(/[\u2066-\u2069]/g,"").replace(/[\uFEFF]/g,"").replace(/[\uE000-\uF8FF]/g,""),o++;if(o>=n)throw Error(`Unicode sanitization reached maximum iterations (${n}) for input: ${e.slice(0,100)}`);return t}function So(e){if(typeof e==="string")return Eq(e);if(Array.isArray(e))return e.map(So);if(e!==null&&typeof e==="object"){let t={};for(let[r,o]of Object.entries(e))t[So(r)]=So(o);return t}return e}import{readFile as Yq}from"fs/promises";import{once as IR}from"events";import{createWriteStream as Nq}from"fs";import{open as RR,readdir as $y,realpath as Dq,stat as jq}from"fs/promises";import{dirname as Mhe,join as Ga}from"path";import{execFile as Aq}from"child_process";import{promisify as Cq}from"util";import{execFileSync as Tq}from"child_process";import{join as Pq}from"path";function Iq(){return process.platform==="win32"}var Iy=new Map,Rq=5000;function $q(e){let t=Iy.get(e);if(t!==void 0)return t;let r=process.env.SYSTEMROOT||"C:\\Windows",o=Pq(r,"System32","where.exe");try{let i=Tq(o,[e],{stdio:"pipe",encoding:"utf8",timeout:Rq,windowsHide:!0,env:process.env}).trim().split(/\r?\n/).filter(Boolean),s=process.cwd();for(let a of i){if(gw(a,s))continue;return Iy.set(e,a),a}return null}catch(n){if(Oq(n))Iy.set(e,null);return null}}function Oq(e){if(e===null||typeof e!=="object")return!1;let t="status"in e?e.status:void 0,r="signal"in e?e.signal:void 0,o="code"in e?e.code:void 0;return t===1&&!r&&!o}function PR(e){if(!Iq())return e;if(e.includes("/")||e.includes("\\"))return e;return $q(e)}var Mq=Cq(Aq);async function Hr(e){let t=PR("git");if(t===null)return[];try{let{stdout:r}=await Mq(t,["worktree","list","--porcelain"],{cwd:e,timeout:5000});if(!r)return[];return r.split(`
66
+ `).filter((o)=>o.startsWith("worktree ")).map((o)=>Ar(o.slice(9)))}catch{return[]}}function Ry(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return t}var cr=65536,zq=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Se(e){if(typeof e!=="string")return null;return zq.test(e)?e:null}function $R(e){if(!e.includes("\\"))return e;try{return JSON.parse(`"${e}"`)}catch{return e}}function Rd(e,t){let r=[`"${t}":"`,`"${t}": "`];for(let o of r){let n=e.indexOf(o);if(n<0)continue;let i=n+o.length,s=i;while(s<e.length){if(e[s]==="\\"){s+=2;continue}if(e[s]==='"')return $R(e.slice(i,s));s++}}return}function wt(e,t){let r=[`"${t}":"`,`"${t}": "`],o,n=-1;for(let i of r){let s=0;while(!0){let a=e.indexOf(i,s);if(a<0)break;let c=a+i.length,u=c;while(u<e.length){if(e[u]==="\\"){u+=2;continue}if(e[u]==='"'){if(a>n)o=$R(e.slice(c,u)),n=a;break}u++}s=u+1}}return o}async function Xa(e,t){let r=Nq(e,{mode:384});try{for(let o of t)if(!r.write(JSON.stringify(o)+`
67
+ `))await IR(r,"drain");r.end(),await IR(r,"finish")}catch(o){throw r.destroy(),o}}function $d(e){let t=0,r={commandFallback:""};while(t<e.length){let o=e.indexOf(`
68
+ `,t),n=o>=0?e.slice(t,o):e.slice(t);if(t=o>=0?o+1:e.length,!n.includes('"type":"user"')&&!n.includes('"type": "user"'))continue;if(n.includes('"tool_result"'))continue;if(n.includes('"isMeta":true')||n.includes('"isMeta": true'))continue;if(n.includes('"isCompactSummary":true')||n.includes('"isCompactSummary": true'))continue;try{let i=JSON.parse(n),s=Hs(i,r);if(s!==void 0)return s}catch{continue}}return r.commandFallback}function OR(e){let t={commandFallback:""};for(let r of e){if(typeof r!=="object"||r===null)continue;let o=Hs(r,t);if(o!==void 0)return o}return t.commandFallback}async function Od(e){try{let t=await RR(e,"r");try{let r=await t.stat(),o=Buffer.allocUnsafe(cr),n=await t.read(o,0,cr,0);if(n.bytesRead===0)return null;let i=o.toString("utf8",0,n.bytesRead),s=Math.max(0,r.size-cr),a=i;if(s>0){let c=await t.read(o,0,cr,s);a=o.toString("utf8",0,c.bytesRead)}return{mtime:r.mtime.getTime(),size:r.size,head:i,tail:a}}finally{await t.close()}}catch{return null}}var Ai=200;function Uq(e){return Math.abs(Ry(e)).toString(36)}function wo(e){let t=e.replace(/[^a-zA-Z0-9]/g,"-");if(t.length<=Ai)return t;return`${t.slice(0,Ai)}-${Uq(e)}`}function lr(){return Ga(qt(),"projects")}function Lq(e){return Ga(lr(),wo(e))}async function kn(e){try{return Ar(await Dq(e))}catch{return Ar(e)}}async function xt(e){let t=Lq(e),r=[];try{await $y(t),r.push(t)}catch{}let o=wo(e);if(o.length<=Ai)return r;let n=o.slice(0,Ai)+"-",i=lr();try{for(let s of await $y(i,{withFileTypes:!0})){if(!s.isDirectory()||!s.name.startsWith(n))continue;let a=Ga(i,s.name);if(a!==t)r.push(a)}}catch{}return r}async function En(e,t){let r=`${e}.jsonl`;async function o(s,a){let c=Ga(s,r);try{let u=await jq(c);if(u.size>0)return{filePath:c,projectPath:a,fileSize:u.size}}catch{}return}if(t){let s=await kn(t);for(let c of await xt(s)){let u=await o(c,s);if(u)return u}let a;try{a=await Hr(s)}catch{a=[]}for(let c of a){if(c===s)continue;for(let u of await xt(c)){let d=await o(u,c);if(d)return d}}return}let n=lr(),i;try{i=await $y(n)}catch{return}for(let s of i){let a=await o(Ga(n,s),void 0);if(a)return a}return}var Fq=1048576,AR=5242880,Hq;function Bq(){return Hq??=Buffer.from('"compact_boundary"')}function CR(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 xo(e,t,r,o){let n=o-r;if(n<=0)return;if(e.len+n>e.buf.length){let i=Buffer.allocUnsafe(Math.min(Math.max(e.buf.length*2,e.len+n),e.cap));e.buf.copy(i,0,0,e.len),e.buf=i}t.copy(e.buf,e.len,r,o),e.len+=n}function Pd(e,t,r,o){return o-r>=t.length&&e.compare(t,0,t.length,r,r+t.length)===0}var Id=Buffer.from('{"type":"attribution-snapshot"'),qq=Buffer.from('{"type":"system"'),Ja=10,Zq=Buffer.from([Ja]),Vq=256;function Wq(e,t,r){if(e.straddleSnapCarryLen=0,e.straddleSnapTailEnd=0,e.carryLen===0)return 0;let o=e.carryBuf,n=t.indexOf(Ja);if(n===-1||n>=r)return 0;let i=n+1;if(Pd(o,Id,0,e.carryLen))e.straddleSnapCarryLen=e.carryLen,e.straddleSnapTailEnd=i,e.lastSnapSrc=null;else if(e.carryLen<Id.length)return 0;else{if(Pd(o,qq,0,e.carryLen)){let s=CR(o.toString("utf-8",0,e.carryLen)+t.toString("utf-8",0,n));if(s?.hasPreservedSegment)e.hasPreservedSegment=!0;else if(s)e.out.len=0,e.boundaryStartOffset=e.bufFileOff,e.hasPreservedSegment=!1,e.lastSnapSrc=null}xo(e.out,o,0,e.carryLen),xo(e.out,t,0,i)}return e.bufFileOff+=e.carryLen+i,e.carryLen=0,i}function Kq(e,t,r){let o=t.indexOf(r),n=0,i=0,s=-1,a=-1,c=t.indexOf(Ja);while(c!==-1){let u=c+1;if(o!==-1&&o<i)o=t.indexOf(r,i);if(Pd(t,Id,i,u))xo(e.out,t,n,i),s=i,a=u,n=u;else if(o>=i&&o<Math.min(i+Vq,u)){let d=CR(t.toString("utf-8",i,c));if(d?.hasPreservedSegment)e.hasPreservedSegment=!0;else if(d)e.out.len=0,e.boundaryStartOffset=e.bufFileOff+i,e.hasPreservedSegment=!1,e.lastSnapSrc=null,s=-1,e.straddleSnapCarryLen=0,n=i;o=t.indexOf(r,o+r.length)}i=u,c=t.indexOf(Ja,i)}return xo(e.out,t,n,i),{lastSnapStart:s,lastSnapEnd:a,trailStart:i}}function Gq(e,t,r,o,n){if(o!==-1){if(e.lastSnapLen=n-o,e.lastSnapBuf===void 0||e.lastSnapLen>e.lastSnapBuf.length)e.lastSnapBuf=Buffer.allocUnsafe(e.lastSnapLen);t.copy(e.lastSnapBuf,0,o,n),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),r.copy(e.lastSnapBuf,e.straddleSnapCarryLen,0,e.straddleSnapTailEnd),e.lastSnapSrc=e.lastSnapBuf}}function Jq(e,t,r){if(e.carryLen=t.length-r,e.carryLen>0){if(e.carryBuf===void 0||e.carryLen>e.carryBuf.length)e.carryBuf=Buffer.allocUnsafe(e.carryLen);t.copy(e.carryBuf,0,r,t.length)}}function Xq(e){if(e.carryLen>0){let t=e.carryBuf;if(Pd(t,Id,0,e.carryLen))e.lastSnapSrc=t,e.lastSnapLen=e.carryLen;else xo(e.out,t,0,e.carryLen)}if(e.lastSnapSrc){if(e.out.len>0&&e.out.buf[e.out.len-1]!==Ja)xo(e.out,Zq,0,1);xo(e.out,e.lastSnapSrc,0,e.lastSnapLen)}}async function MR(e,t){let r=Bq(),o=Fq,n={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},i=Buffer.allocUnsafe(o),s=await RR(e,"r");try{let a=0;while(a<t){let{bytesRead:c}=await s.read(i,0,Math.min(o,t-a),a);if(c===0)break;a+=c;let u=Wq(n,i,c),d;if(n.carryLen>0){let f=n.carryLen+(c-u);d=Buffer.allocUnsafe(f),n.carryBuf.copy(d,0,0,n.carryLen),i.copy(d,n.carryLen,u,c)}else d=i.subarray(u,c);let p=Kq(n,d,r);Gq(n,d,i,p.lastSnapStart,p.lastSnapEnd),Jq(n,d,p.trailStart),n.bufFileOff+=p.trailStart}Xq(n)}finally{await s.close()}return{boundaryStartOffset:n.boundaryStartOffset,postBoundaryBuf:n.out.buf.subarray(0,n.out.len),hasPreservedSegment:n.hasPreservedSegment}}async function Qq(e,t){try{if(t>AR&&!Ee(process.env.CLAUDE_CODE_DISABLE_PRECOMPACT_SKIP))return(await MR(e,t)).postBoundaryBuf;return await Yq(e)}catch{return null}}function e6(e){let s=[];try{const t=_e(s,Pe`parseTranscriptEntries(${e.length} bytes)`,0);let r=[];let o=10;let n=e.length;let i=0;while(i<n){let d=e.indexOf(o,i);if(d===-1)d=n;let p=i;while(p<d&&e[p]<=32)p++;if(i=d+1,p>=d)continue;let f=e.toString("utf-8",p,d);try{let m=TT(f),g=m.type;if((g==="user"||g==="assistant"||g==="progress"||g==="system"||g==="attachment")&&typeof m.uuid==="string")r.push(m)}catch{}}return r}catch(a){var c=a,u=1}finally{ve(s,c,u)}}function t6(e){let t=new Map;for(let f of e)t.set(f.uuid,f);for(let f of t.values()){if(f.type!=="system"||f.subtype!=="compact_boundary")continue;let m=f.compactMetadata?.preservedMessages,g=f.compactMetadata?.preservedSegment;if(m){if(m.uuids.length===0||m.uuids.some((x)=>!t.has(x)))continue;let h=m.anchorUuid;for(let x of m.uuids){let w=t.get(x);t.set(x,{...w,parentUuid:h}),h=x}let y=m.uuids[0],v=m.uuids.at(-1);for(let[x,w]of t)if(w.parentUuid===m.anchorUuid&&x!==y)t.set(x,{...w,parentUuid:v})}else if(g){let h=t.get(g.headUuid);if(h)t.set(g.headUuid,{...h,parentUuid:g.anchorUuid});for(let[y,v]of t)if(v.parentUuid===g.anchorUuid&&y!==g.headUuid)t.set(y,{...v,parentUuid:g.tailUuid})}}let r=new Map;for(let f=0;f<e.length;f++)r.set(e[f].uuid,f);let o=new Set;for(let f of t.values())if(f.parentUuid)o.add(f.parentUuid);let n=[...t.values()].filter((f)=>!o.has(f.uuid)),i=[];for(let f of n){let m=f,g=new Set;while(m){if(g.has(m.uuid))break;if(g.add(m.uuid),m.type==="user"||m.type==="assistant"){i.push(m);break}m=m.parentUuid?t.get(m.parentUuid):void 0}}if(i.length===0)return[];let s=i.filter((f)=>!f.isSidechain&&!f.teamName&&!f.isMeta),a=(f)=>f.reduce((m,g)=>(r.get(g.uuid)??-1)>(r.get(m.uuid)??-1)?g:m),c=s.length>0?a(s):a(i),u=[],d=new Set,p=t.get(c.uuid);while(p){if(d.has(p.uuid))break;d.add(p.uuid),u.push(p),p=p.parentUuid?t.get(p.parentUuid):void 0}return u.reverse(),n6(t,u,d)}function Oy(e){if(e.type!=="assistant")return;let t=e.message;if(typeof t!=="object"||t===null)return;let r=t.id;return typeof r==="string"?r:void 0}function r6(e){if(e.type!=="user"||!e.parentUuid)return!1;let t=e.message;if(typeof t!=="object"||t===null)return!1;let r=t.content;if(!Array.isArray(r))return!1;return r.some((o)=>typeof o==="object"&&o!==null&&o.type==="tool_result")}function n6(e,t,r){let o=t.filter((p)=>p.type==="assistant");if(o.length===0)return t;let n=new Map;for(let p of o){let f=Oy(p);if(f)n.set(f,p)}let i=new Map,s=new Map;for(let p of e.values()){let f=Oy(p);if(f){let m=i.get(f);if(m)m.push(p);else i.set(f,[p])}else if(r6(p)){let m=p.parentUuid,g=s.get(m);if(g)g.push(p);else s.set(m,[p])}}let a=new Set,c=new Map,u=0;for(let p of o){let f=Oy(p);if(!f||a.has(f))continue;a.add(f);let m=i.get(f)??[p],g=m.filter((w)=>!r.has(w.uuid)),h=[];for(let w of m){let O=s.get(w.uuid);if(!O)continue;for(let L of O)if(!r.has(L.uuid))h.push(L)}if(g.length===0&&h.length===0)continue;let y=(w,O)=>(w.timestamp??"").localeCompare(O.timestamp??"");g.sort(y),h.sort(y);let v=n.get(f),x=[...g,...h];for(let w of x)r.add(w.uuid);u+=x.length,c.set(v.uuid,x)}if(u===0)return t;let d=[];for(let p of t){d.push(p);let f=c.get(p.uuid);if(f)d.push(...f)}return d}function o6(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 Ay(e,t){return{type:e.type,uuid:e.uuid,session_id:e.sessionId,message:e.message,parent_tool_use_id:t??null,timestamp:e.timestamp}}function Cy(e,t){let r=t?.offset??0;if(t?.limit!==void 0&&t.limit>0)return e.slice(r,r+t.limit);if(r>0)return e.slice(r);return e}function NR(e,t){let r=[];for(let o of e){if(typeof o!=="object"||o===null)continue;let n=o,i=n.type;if((i==="user"||i==="assistant"||i==="progress"||i==="system"||i==="attachment")&&typeof n.uuid==="string")r.push(n)}return DR(r,t)}function DR(e,t){let r=t6(e),o=t?.includeSystemMessages??!1,i=r.filter((s)=>o6(s,o)).map((s)=>Ay(s));return Cy(i,t)}async function jR(e,t){if(!Se(e))return[];let r=await En(e,t?.dir);if(!r)return[];let o=await Qq(r.filePath,r.fileSize);if(!o)return[];return DR(e6(o),t)}import{readdir as My,stat as i6}from"fs/promises";import{basename as s6,join as Ny}from"path";function Ci(e,t,r){let{head:o,tail:n,mtime:i,size:s}=t,a=o.indexOf(`
69
+ `),c=a>=0?o.slice(0,a):o;if(c.includes('"isSidechain":true')||c.includes('"isSidechain": true'))return null;let u=wt(n,"customTitle")||wt(o,"customTitle")||wt(n,"aiTitle")||wt(o,"aiTitle")||void 0,d=$d(o)||void 0,p=Rd(o,"timestamp"),f;if(p){let x=Date.parse(p);if(!Number.isNaN(x))f=x}let m=u||wt(n,"lastPrompt")||wt(n,"summary")||d;if(!m)return null;let g=wt(n,"gitBranch")||Rd(o,"gitBranch")||void 0,h=Rd(o,"cwd")||r||void 0,y=n.split(`
70
+ `).findLast((x)=>x.includes('"type":"tag"')&&x.includes('"tag":"')),v=y?wt(y,"tag")||void 0:void 0;return{sessionId:e,summary:m,lastModified:i,fileSize:s,customTitle:u,firstPrompt:d,gitBranch:g,cwd:h,tag:v,createdAt:f}}async function Ya(e,t,r){let o;try{o=await My(e)}catch{return[]}return(await Promise.all(o.map(async(i)=>{if(!i.endsWith(".jsonl"))return null;let s=Se(i.slice(0,-6));if(!s)return null;let a=Ny(e,i);if(!t)return{sessionId:s,filePath:a,mtime:0,projectPath:r};try{let c=await i6(a);return{sessionId:s,filePath:a,mtime:c.mtime.getTime(),projectPath:r}}catch{return null}}))).filter((i)=>i!==null)}async function zR(e){let t=await Od(e.filePath);if(!t)return null;let r=Ci(e.sessionId,t,e.projectPath);if(!r)return null;if(e.mtime)r.lastModified=e.mtime;return r}var a6=32;function c6(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 l6(e,t,r){e.sort(c6);let o=[],n=t&&t>0?t:1/0,i=0,s=new Set;for(let a=0;a<e.length&&o.length<n;){let c=Math.min(a+a6,e.length),u=e.slice(a,c),d=await Promise.all(u.map(zR));for(let p=0;p<d.length&&o.length<n;p++){a++;let f=d[p];if(!f)continue;if(s.has(f.sessionId))continue;if(s.add(f.sessionId),i<r){i++;continue}o.push(f)}}return o}async function u6(e){let t=await Promise.all(e.map(zR)),r=new Map;for(let n of t){if(!n)continue;let i=r.get(n.sessionId);if(!i||n.lastModified>i.lastModified)r.set(n.sessionId,n)}let o=[...r.values()];return o.sort((n,i)=>i.lastModified!==n.lastModified?i.lastModified-n.lastModified:i.sessionId<n.sessionId?-1:i.sessionId>n.sessionId?1:0),o}async function d6(e,t,r){let o=await kn(e),n;if(t)try{n=await Hr(o)}catch{n=[]}else n=[];if(n.length<=1){let p=[];for(let f of await xt(o))p.push(...await Ya(f,r,o));return p}let i=lr(),s=process.platform==="win32",a=n.map((p)=>{let f=wo(p);return{path:p,prefix:s?f.toLowerCase():f}});a.sort((p,f)=>f.prefix.length-p.prefix.length);let c;try{c=await My(i,{withFileTypes:!0})}catch{let p=[];for(let f of await xt(o))p.push(...await Ya(f,r,o));return p}let u=[],d=new Set;for(let p of await xt(o)){let f=s6(p);d.add(s?f.toLowerCase():f),u.push(...await Ya(p,r,o))}for(let p of c){if(!p.isDirectory())continue;let f=s?p.name.toLowerCase():p.name;if(d.has(f))continue;for(let{path:m,prefix:g}of a)if(f===g||g.length>=Ai&&f.startsWith(g+"-")){d.add(f),u.push(...await Ya(Ny(i,p.name),r,m));break}}return u}async function p6(e){let t=lr(),r;try{r=await My(t,{withFileTypes:!0})}catch{return[]}return(await Promise.all(r.filter((n)=>n.isDirectory()).map((n)=>Ya(Ny(t,n.name),e)))).flat()}async function UR(e){let{dir:t,limit:r,offset:o,includeWorktrees:n}=e??{},i=o??0,s=r!==void 0&&r>0||i>0,a=t?await d6(t,n??!0,s):await p6(s);if(!s)return u6(a);return l6(a,r,i)}async function LR(e,t={}){let r=Se(e);if(!r)return;let o=await En(r,t.dir);if(!o)return;let n=await Od(o.filePath);if(!n)return;return Ci(r,n,o.projectPath)??void 0}import{constants as FR}from"fs";import{open as f6,readdir as BR,rm as HR,stat as m6}from"fs/promises";import{join as Mi}from"path";async function qR(e,t,r={}){if(!Se(e))throw Error(`Invalid sessionId: ${e}`);if(!t.trim())throw Error("title must be non-empty");let o=pe({type:"custom-title",customTitle:t.trim(),sessionId:e})+`
71
+ `;await WR(e,o,r)}async function ZR(e,t,r={}){if(!Se(e))throw Error(`Invalid sessionId: ${e}`);if(t!==null){let n=So(t).trim();if(!n)throw Error("tag must be non-empty (use null to clear)");t=n}let o=pe({type:"tag",tag:t??"",sessionId:e})+`
72
+ `;await WR(e,o,r)}async function VR(e,t={}){if(!Se(e))throw Error(`Invalid sessionId: ${e}`);for(let r of await g6(t)){let o=Mi(r,`${e}.jsonl`),n;try{({size:n}=await m6(o))}catch(i){let s=Ge(i);if(s==="ENOENT"||s==="ENOTDIR")continue;throw i}if(n===0)continue;await HR(o,{force:!0}),await HR(Mi(r,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 g6(e){if(e.dir){let r=await kn(e.dir),o=await xt(r),n;try{n=await Hr(r)}catch{n=[]}for(let i of n){if(i===r)continue;o.push(...await xt(i))}return o}let t=lr();try{return(await BR(t,{withFileTypes:!0})).filter((o)=>o.isDirectory()||o.isSymbolicLink()).map((o)=>Mi(t,o.name))}catch{return[]}}async function WR(e,t,r){let o=`${e}.jsonl`;if(r.dir){let s=await kn(r.dir);for(let c of await xt(s))if(await Dy(Mi(c,o),t))return;let a;try{a=await Hr(s)}catch{a=[]}for(let c of a){if(c===s)continue;for(let u of await xt(c))if(await Dy(Mi(u,o),t))return}throw Error(`Session ${e} not found in project directory for ${r.dir}`)}let n=lr(),i;try{i=await BR(n)}catch{throw Error(`Session ${e} not found (no projects directory)`)}for(let s of i)if(await Dy(Mi(n,s,o),t))return;throw Error(`Session ${e} not found in any project directory`)}async function Dy(e,t){let r;try{r=await f6(e,FR.O_WRONLY|FR.O_APPEND)}catch(o){let n=Ge(o);if(n==="ENOENT"||n==="ENOTDIR")return!1;throw o}try{let{size:o}=await r.stat();if(o===0)return!1;let n=process.platform==="win32"?o:void 0;return await r.write(t,n,"utf8"),!0}finally{await r.close()}}import{randomUUID as Ad}from"crypto";import{join as jy}from"path";async function h6(e,t){let r=`${e}.jsonl`;async function o(s){try{let a=await bi().readBytes(jy(s,r));if(a.length===0)return null;return{buf:a,projectDir:s}}catch{return null}}if(t){let s=await kn(t);for(let c of await xt(s)){let u=await o(c);if(u)return u}let a;try{a=await Hr(s)}catch{a=[]}for(let c of a){if(c===s)continue;for(let u of await xt(c)){let d=await o(u);if(d)return d}}return null}let n=lr(),i;try{i=await bi().list(n)}catch{return null}for(let s of i){let a=await o(jy(n,s));if(a)return a}return null}var y6=new Set(["user","assistant","attachment","system","progress"]);function b6(e,t){let r=[],o=[],n=10,i=e.length,s=0;while(s<i){let a=e.indexOf(10,s);if(a===-1)a=i;let c=s;while(c<a&&e[c]<=32)c++;if(s=a+1,c>=a)continue;let u=e.toString("utf-8",c,a);try{KR(Ze(u),t,r,o)}catch{}}return{transcript:r,contentReplacements:o}}function _6(e,t){let r=[],o=[];for(let n of e){if(typeof n!=="object"||n===null)continue;KR(n,t,r,o)}return{transcript:r,contentReplacements:o}}function KR(e,t,r,o){if(y6.has(e.type)&&typeof e.uuid==="string")r.push(e);else if(e.type==="content-replacement"&&e.sessionId===t&&Array.isArray(e.replacements))o.push(...e.replacements)}async function GR(e,t={}){if(!Se(e))throw Error(`Invalid sessionId: ${e}`);if(t.upToMessageId&&!Se(t.upToMessageId))throw Error(`Invalid upToMessageId: ${t.upToMessageId}`);let r=await h6(e,t.dir);if(!r)throw Error(t.dir?`Session ${e} not found in project directory for ${t.dir}`:`Session ${e} not found`);let{entries:o,forkedSessionId:n}=v6(r.buf,e,t);return await Xa(jy(r.projectDir,`${n}.jsonl`),o),{sessionId:n}}function v6(e,t,r){let o=b6(e,t);return XR(o,t,r,()=>{let i=e.length,s=e.toString("utf-8",0,Math.min(i,cr)),a=e.toString("utf-8",Math.max(0,i-cr));return wt(a,"customTitle")||wt(s,"customTitle")||wt(a,"aiTitle")||wt(s,"aiTitle")||$d(s)})}function JR(e,t,r){let o=_6(e,t);return XR(o,t,r,()=>S6(e))}function S6(e){let t,r;for(let o of e){if(typeof o!=="object"||o===null)continue;let n=o;if(typeof n.customTitle==="string"&&n.customTitle)t=n.customTitle;if(typeof n.aiTitle==="string"&&n.aiTitle)r=n.aiTitle}return t||r||OR(e)||void 0}function XR(e,t,r,o){let n=e.transcript.filter((f)=>!f.isSidechain);if(n.length===0)throw Error(`Session ${t} has no messages to fork`);if(r.upToMessageId){let f=n.findIndex((m)=>m.uuid===r.upToMessageId);if(f===-1)throw Error(`Message ${r.upToMessageId} not found in session ${t}`);n=n.slice(0,f+1)}let i=new Map;for(let f of n)i.set(f.uuid,Ad());let s=n.filter((f)=>f.type!=="progress");if(s.length===0)throw Error(`Session ${t} has no messages to fork`);let a=new Map;for(let f of n)a.set(f.uuid,f);let c=Ad(),u=new Date().toISOString(),d=[];for(let f=0;f<s.length;f++){let m=s[f],g=i.get(m.uuid),h=null,y=m.parentUuid;while(y){let O=a.get(y);if(!O)break;if(O.type!=="progress"){h=i.get(y)??null;break}y=O.parentUuid}let v=f===s.length-1?u:m.timestamp,x=m.logicalParentUuid==null?m.logicalParentUuid:i.get(m.logicalParentUuid)??null,w={...m,uuid:g,parentUuid:h,logicalParentUuid:x,sessionId:c,timestamp:v,isSidechain:!1,teamName:void 0,agentName:void 0,sessionKind:void 0,slug:void 0,sourceToolAssistantUUID:void 0,forkedFrom:{sessionId:t,messageUuid:m.uuid}};d.push(w)}if(e.contentReplacements.length>0)d.push({type:"content-replacement",sessionId:c,replacements:e.contentReplacements,uuid:Ad(),timestamp:u});let p=r.title?.trim();if(!p)p=`${o()||"Forked session"} (fork)`;return d.push({type:"custom-title",sessionId:c,customTitle:p,uuid:Ad(),timestamp:u}),{entries:d,forkedSessionId:c}}import{readdir as x6,readFile as YR}from"fs/promises";import{join as zy}from"path";async function QR(e,t){let r=await En(e,t);if(!r)return null;let o=r.filePath.replace(/\.jsonl$/,"");return zy(o,"subagents")}async function e0(e){let t=[];async function r(o){let n;try{n=await x6(o,{withFileTypes:!0})}catch{return}for(let i of n)if(i.isFile()&&i.name.startsWith("agent-")&&i.name.endsWith(".jsonl")){let s=i.name.slice(6,-6);t.push({agentId:s,filePath:zy(o,i.name)})}else if(i.isDirectory())await r(zy(o,i.name))}return await r(e),t}function w6(e){let t=[],r=10,o=e.length,n=0;while(n<o){let i=e.indexOf(10,n);if(i===-1)i=o;let s=n;while(s<i&&e[s]<=32)s++;if(n=i+1,s>=i)continue;let a=e.toString("utf-8",s,i);try{let c=Ze(a),u=c.type;if((u==="user"||u==="assistant")&&typeof c.uuid==="string")t.push(c)}catch{}}return t}function k6(e){if(e.length===0)return[];let t=new Map;for(let s of e)t.set(s.uuid,s);let r=e.findLast((s)=>s.type==="user"||s.type==="assistant");if(!r)return[];let o=[],n=new Set,i=r;while(i){if(n.has(i.uuid))break;n.add(i.uuid),o.push(i),i=i.parentUuid?t.get(i.parentUuid):void 0}return o.reverse(),o}async function t0(e,t){if(!Se(e))return[];let r=await QR(e,t?.dir);if(!r)return[];return(await e0(r)).map((n)=>n.agentId)}async function r0(e,t,r){if(!Se(e))return[];if(!t)return[];let o=await QR(e,r?.dir);if(!o)return[];let i=(await e0(o)).find((c)=>c.agentId===t);if(!i)return[];let s;try{s=await YR(i.filePath)}catch{return[]}let a;try{let c=i.filePath.replace(/\.jsonl$/,".meta.json");a=Ze(await YR(c,"utf-8")).toolUseId}catch{}return Uy(s,r,a)}function Uy(e,t,r){if(e.length===0)return[];let o=w6(e),i=k6(o).filter((s)=>s.type==="user"||s.type==="assistant").map((s)=>Ay(s,r));return Cy(i,t)}import{createHash as C6}from"crypto";import{homedir as Oye,userInfo as M6}from"os";function Ly(e,t){let r=0;for(let o of e)r+=+!!t(o);return r}function Cd(e){return[...new Set(e)]}function E6(){return"prod"}var T6="user:inference",o0="user:profile",P6="org:create_api_key";var I6=[P6,o0],R6=[o0,T6,"user:sessions:claude_code","user:mcp_servers","user:file_upload",...[]],Pye=Cd([...I6,...R6]),n0={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",OAUTH_FILE_SUFFIX:"",MCP_PROXY_URL:"https://mcp-proxy.anthropic.com",MCP_PROXY_PATH:"/v1/mcp/{server_id}"};var $6=void 0;function O6(){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",r=process.env.CLAUDE_LOCAL_OAUTH_CONSOLE_BASE?.replace(/\/$/,"")??"http://localhost:3000";return{BASE_API_URL:e,CONSOLE_AUTHORIZE_URL:`${r}/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:`${r}/buy_credits?returnUrl=/oauth/code/success%3Fapp%3Dclaude-code`,CLAUDEAI_SUCCESS_URL:`${r}/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`${r}/oauth/code/callback`,CLIENT_ID:"22422756-60c9-4084-8eb7-27705fd5cf9a",OAUTH_FILE_SUFFIX:"-local-oauth",MCP_PROXY_URL:"http://localhost:8205",MCP_PROXY_PATH:"/v1/toolbox/shttp/mcp/{server_id}"}}var A6=["https://beacon.claude-ai.staging.ant.dev","https://claude.fedstart.com","https://claude-staging.fedstart.com"];function i0(){let e=(()=>{switch(E6()){case"local":return O6();case"staging":return $6??n0;case"prod":return n0}})(),t=process.env.CLAUDE_CODE_CUSTOM_OAUTH_URL;if(t){let o=t.replace(/\/$/,"");if(!A6.includes(o))throw Error("CLAUDE_CODE_CUSTOM_OAUTH_URL is not an approved endpoint.");e={...e,BASE_API_URL:o,CONSOLE_AUTHORIZE_URL:`${o}/oauth/authorize`,CLAUDE_AI_AUTHORIZE_URL:`${o}/oauth/authorize`,CLAUDE_AI_ORIGIN:o,TOKEN_URL:`${o}/v1/oauth/token`,API_KEY_URL:`${o}/api/oauth/claude_cli/create_api_key`,ROLES_URL:`${o}/api/oauth/claude_cli/roles`,CONSOLE_SUCCESS_URL:`${o}/oauth/code/success?app=claude-code`,CLAUDEAI_SUCCESS_URL:`${o}/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`${o}/oauth/code/callback`,OAUTH_FILE_SUFFIX:"-custom-oauth"}}let r=process.env.CLAUDE_CODE_OAUTH_CLIENT_ID;if(r)e={...e,CLIENT_ID:r};return e}var s0="-credentials";function a0(e=""){let t=process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR,r=t!==void 0?!t:!process.env.CLAUDE_CONFIG_DIR,o=t!==void 0?t.normalize("NFC"):qt(),n=r?"":`-${C6("sha256").update(o).digest("hex").substring(0,8)}`;return`Claude Code${i0().OAUTH_FILE_SUFFIX}${e}${n}`}var N6=/^[a-zA-Z0-9._-]+$/;function c0(){if(process.platform==="win32")return"claude-code-user";let e;try{e=process.env.USER||M6().username}catch{e="claude-code-user"}if(!N6.test(e))return"claude-code-user";return e}var ae;(function(e){e.assertEqual=(n)=>{};function t(n){}e.assertIs=t;function r(n){throw Error()}e.assertNever=r,e.arrayToEnum=(n)=>{let i={};for(let s of n)i[s]=s;return i},e.getValidEnumValues=(n)=>{let i=e.objectKeys(n).filter((a)=>typeof n[n[a]]!=="number"),s={};for(let a of i)s[a]=n[a];return e.objectValues(s)},e.objectValues=(n)=>{return e.objectKeys(n).map(function(i){return n[i]})},e.objectKeys=typeof Object.keys==="function"?(n)=>Object.keys(n):(n)=>{let i=[];for(let s in n)if(Object.prototype.hasOwnProperty.call(n,s))i.push(s);return i},e.find=(n,i)=>{for(let s of n)if(i(s))return s;return},e.isInteger=typeof Number.isInteger==="function"?(n)=>Number.isInteger(n):(n)=>typeof n==="number"&&Number.isFinite(n)&&Math.floor(n)===n;function o(n,i=" | "){return n.map((s)=>typeof s==="string"?`'${s}'`:s).join(i)}e.joinValues=o,e.jsonStringifyReplacer=(n,i)=>{if(typeof i==="bigint")return i.toString();return i}})(ae||(ae={}));var l0;(function(e){e.mergeShapes=(t,r)=>{return{...t,...r}}})(l0||(l0={}));var C=ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Br=(e)=>{switch(typeof e){case"undefined":return C.undefined;case"string":return C.string;case"number":return Number.isNaN(e)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":if(Array.isArray(e))return C.array;if(e===null)return C.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return C.promise;if(typeof Map<"u"&&e instanceof Map)return C.map;if(typeof Set<"u"&&e instanceof Set)return C.set;if(typeof Date<"u"&&e instanceof Date)return C.date;return C.object;default:return C.unknown}};var I=ae.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"]);class jt extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};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(n){return n.message},r={_errors:[]},o=(n)=>{for(let i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(t(i));else{let s=r,a=0;while(a<i.path.length){let c=i.path[a];if(a!==i.path.length-1)s[c]=s[c]||{_errors:[]};else s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(i));s=s[c],a++}}};return o(this),r}static assert(e){if(!(e instanceof jt))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ae.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t={},r=[];for(let o of this.issues)if(o.path.length>0){let n=o.path[0];t[n]=t[n]||[],t[n].push(e(o))}else r.push(e(o));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}jt.create=(e)=>{return new jt(e)};var D6=(e,t)=>{let r;switch(e.code){case I.invalid_type:if(e.received===C.undefined)r="Required";else r=`Expected ${e.expected}, received ${e.received}`;break;case I.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ae.jsonStringifyReplacer)}`;break;case I.unrecognized_keys:r=`Unrecognized key(s) in object: ${ae.joinValues(e.keys,", ")}`;break;case I.invalid_union:r="Invalid input";break;case I.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ae.joinValues(e.options)}`;break;case I.invalid_enum_value:r=`Invalid enum value. Expected ${ae.joinValues(e.options)}, received '${e.received}'`;break;case I.invalid_arguments:r="Invalid function arguments";break;case I.invalid_return_type:r="Invalid function return type";break;case I.invalid_date:r="Invalid date";break;case I.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")r=`${r} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)r=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)r=`Invalid input: must end with "${e.validation.endsWith}"`;else ae.assertNever(e.validation);else if(e.validation!=="regex")r=`Invalid ${e.validation}`;else r="Invalid";break;case I.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else r="Invalid input";break;case I.too_big:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else r="Invalid input";break;case I.custom:r="Invalid input";break;case I.invalid_intersection_types:r="Intersection results could not be merged";break;case I.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case I.not_finite:r="Number must be finite";break;default:r=t.defaultError,ae.assertNever(e)}return{message:r}},Tn=D6;var j6=Tn;function Qa(){return j6}var Md=(e)=>{let{data:t,path:r,errorMaps:o,issueData:n}=e,i=[...r,...n.path||[]],s={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let a="",c=o.filter((u)=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...n,path:i,message:a}};function j(e,t){let r=Qa(),o=Md({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Tn?void 0:Tn].filter((n)=>!!n)});e.common.issues.push(o)}class at{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 r=[];for(let o of t){if(o.status==="aborted")return W;if(o.status==="dirty")e.dirty();r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let o of t){let n=await o.key,i=await o.value;r.push({key:n,value:i})}return at.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let o of t){let{key:n,value:i}=o;if(n.status==="aborted")return W;if(i.status==="aborted")return W;if(n.status==="dirty")e.dirty();if(i.status==="dirty")e.dirty();if(n.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet))r[n.value]=i.value}return{status:e.value,value:r}}}var W=Object.freeze({status:"aborted"}),Ni=(e)=>({status:"dirty",value:e}),ft=(e)=>({status:"valid",value:e}),Fy=(e)=>e.status==="aborted",Hy=(e)=>e.status==="dirty",ko=(e)=>e.status==="valid",ec=(e)=>typeof Promise<"u"&&e instanceof Promise;var F;(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(F||(F={}));class ur{constructor(e,t,r,o){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=o}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 u0=(e,t)=>{if(ko(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 r=new jt(e.common.issues);return this._error=r,this._error}}}};function Q(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:o,description:n}=e;if(t&&(r||o))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:n};return{errorMap:(s,a)=>{let{message:c}=e;if(s.code==="invalid_enum_value")return{message:c??a.defaultError};if(typeof a.data>"u")return{message:c??o??a.defaultError};if(s.code!=="invalid_type")return{message:a.defaultError};return{message:c??r??a.defaultError}},description:n}}class oe{get description(){return this._def.description}_getType(e){return Br(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Br(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new at,ctx:{common:e.parent.common,data:e.data,parsedType:Br(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ec(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Br(e)},o=this._parseSync({data:e,path:r.path,parent:r});return u0(r,o)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Br(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return ko(r)?{value:r.value}:{issues:t.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((r)=>ko(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Br(e)},o=this._parse({data:e,path:r.path,parent:r}),n=await(ec(o)?o:Promise.resolve(o));return u0(r,n)}refine(e,t){let r=(o)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(o);else return t};return this._refinement((o,n)=>{let i=e(o),s=()=>n.addIssue({code:I.custom,...r(o)});if(typeof Promise<"u"&&i instanceof Promise)return i.then((a)=>{if(!a)return s(),!1;else return!0});if(!i)return s(),!1;else return!0})}refinement(e,t){return this._refinement((r,o)=>{if(!e(r))return o.addIssue(typeof t==="function"?t(r,o):t),!1;else return!0})}_refinement(e){return new Ir({schema:this,typeName:R.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 Gt.create(this,this._def)}nullable(){return Pn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Pr.create(this)}promise(){return Li.create(this,this._def)}or(e){return ic.create([this,e],this._def)}and(e){return sc.create(this,e,this._def)}transform(e){return new Ir({...Q(this._def),schema:this,typeName:R.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new uc({...Q(this._def),innerType:this,defaultValue:t,typeName:R.ZodDefault})}brand(){return new Vy({typeName:R.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new dc({...Q(this._def),innerType:this,catchValue:t,typeName:R.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return Hd.create(this,e)}readonly(){return pc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var z6=/^c[^\s-]{8,}$/i,U6=/^[0-9a-z]+$/,L6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,F6=/^[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,H6=/^[a-z0-9_-]{21}$/i,B6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,q6=/^[-+]?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)?)??$/,Z6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,V6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",By,W6=/^(?:(?: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])$/,K6=/^(?:(?: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])$/,G6=/^(([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]))$/,J6=/^(([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])$/,X6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Y6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,d0="((\\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])))",Q6=new RegExp(`^${d0}$`);function p0(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function eZ(e){return new RegExp(`^${p0(e)}$`)}function tZ(e){let t=`${d0}T${p0(e)}`,r=[];if(r.push(e.local?"Z?":"Z"),e.offset)r.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function rZ(e,t){if((t==="v4"||!t)&&W6.test(e))return!0;if((t==="v6"||!t)&&G6.test(e))return!0;return!1}function nZ(e,t){if(!B6.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let o=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(o));if(typeof n!=="object"||n===null)return!1;if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&n.alg!==t)return!1;return!0}catch{return!1}}function oZ(e,t){if((t==="v4"||!t)&&K6.test(e))return!0;if((t==="v6"||!t)&&J6.test(e))return!0;return!1}class Zr extends oe{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==C.string){let n=this._getOrReturnCtx(e);return j(n,{code:I.invalid_type,expected:C.string,received:n.parsedType}),W}let r=new at,o=void 0;for(let n of this._def.checks)if(n.kind==="min"){if(e.data.length<n.value)o=this._getOrReturnCtx(e,o),j(o,{code:I.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty()}else if(n.kind==="max"){if(e.data.length>n.value)o=this._getOrReturnCtx(e,o),j(o,{code:I.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty()}else if(n.kind==="length"){let i=e.data.length>n.value,s=e.data.length<n.value;if(i||s){if(o=this._getOrReturnCtx(e,o),i)j(o,{code:I.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message});else if(s)j(o,{code:I.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message});r.dirty()}}else if(n.kind==="email"){if(!Z6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"email",code:I.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="emoji"){if(!By)By=new RegExp(V6,"u");if(!By.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"emoji",code:I.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="uuid"){if(!F6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"uuid",code:I.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="nanoid"){if(!H6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"nanoid",code:I.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cuid"){if(!z6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"cuid",code:I.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cuid2"){if(!U6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"cuid2",code:I.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="ulid"){if(!L6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"ulid",code:I.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),j(o,{validation:"url",code:I.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="regex"){if(n.regex.lastIndex=0,!n.regex.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"regex",code:I.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="trim")e.data=e.data.trim();else if(n.kind==="includes"){if(!e.data.includes(n.value,n.position))o=this._getOrReturnCtx(e,o),j(o,{code:I.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()}else if(n.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(n.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(n.kind==="startsWith"){if(!e.data.startsWith(n.value))o=this._getOrReturnCtx(e,o),j(o,{code:I.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()}else if(n.kind==="endsWith"){if(!e.data.endsWith(n.value))o=this._getOrReturnCtx(e,o),j(o,{code:I.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()}else if(n.kind==="datetime"){if(!tZ(n).test(e.data))o=this._getOrReturnCtx(e,o),j(o,{code:I.invalid_string,validation:"datetime",message:n.message}),r.dirty()}else if(n.kind==="date"){if(!Q6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{code:I.invalid_string,validation:"date",message:n.message}),r.dirty()}else if(n.kind==="time"){if(!eZ(n).test(e.data))o=this._getOrReturnCtx(e,o),j(o,{code:I.invalid_string,validation:"time",message:n.message}),r.dirty()}else if(n.kind==="duration"){if(!q6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"duration",code:I.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="ip"){if(!rZ(e.data,n.version))o=this._getOrReturnCtx(e,o),j(o,{validation:"ip",code:I.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="jwt"){if(!nZ(e.data,n.alg))o=this._getOrReturnCtx(e,o),j(o,{validation:"jwt",code:I.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cidr"){if(!oZ(e.data,n.version))o=this._getOrReturnCtx(e,o),j(o,{validation:"cidr",code:I.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="base64"){if(!X6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"base64",code:I.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="base64url"){if(!Y6.test(e.data))o=this._getOrReturnCtx(e,o),j(o,{validation:"base64url",code:I.invalid_string,message:n.message}),r.dirty()}else ae.assertNever(n);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((o)=>e.test(o),{validation:t,code:I.invalid_string,...F.errToObj(r)})}_addCheck(e){return new Zr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...F.errToObj(e)})}url(e){return this._addCheck({kind:"url",...F.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...F.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...F.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...F.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...F.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...F.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...F.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...F.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...F.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...F.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...F.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...F.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,...F.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,...F.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...F.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...F.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...F.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...F.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...F.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...F.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...F.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...F.errToObj(t)})}nonempty(e){return this.min(1,F.errToObj(e))}trim(){return new Zr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Zr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Zr({...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}}Zr.create=(e)=>{return new Zr({checks:[],typeName:R.ZodString,coerce:e?.coerce??!1,...Q(e)})};function iZ(e,t){let r=(e.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,n=r>o?r:o,i=Number.parseInt(e.toFixed(n).replace(".","")),s=Number.parseInt(t.toFixed(n).replace(".",""));return i%s/10**n}class ji extends oe{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)!==C.number){let n=this._getOrReturnCtx(e);return j(n,{code:I.invalid_type,expected:C.number,received:n.parsedType}),W}let r=void 0,o=new at;for(let n of this._def.checks)if(n.kind==="int"){if(!ae.isInteger(e.data))r=this._getOrReturnCtx(e,r),j(r,{code:I.invalid_type,expected:"integer",received:"float",message:n.message}),o.dirty()}else if(n.kind==="min"){if(n.inclusive?e.data<n.value:e.data<=n.value)r=this._getOrReturnCtx(e,r),j(r,{code:I.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),o.dirty()}else if(n.kind==="max"){if(n.inclusive?e.data>n.value:e.data>=n.value)r=this._getOrReturnCtx(e,r),j(r,{code:I.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),o.dirty()}else if(n.kind==="multipleOf"){if(iZ(e.data,n.value)!==0)r=this._getOrReturnCtx(e,r),j(r,{code:I.not_multiple_of,multipleOf:n.value,message:n.message}),o.dirty()}else if(n.kind==="finite"){if(!Number.isFinite(e.data))r=this._getOrReturnCtx(e,r),j(r,{code:I.not_finite,message:n.message}),o.dirty()}else ae.assertNever(n);return{status:o.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,F.toString(t))}gt(e,t){return this.setLimit("min",e,!1,F.toString(t))}lte(e,t){return this.setLimit("max",e,!0,F.toString(t))}lt(e,t){return this.setLimit("max",e,!1,F.toString(t))}setLimit(e,t,r,o){return new ji({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:F.toString(o)}]})}_addCheck(e){return new ji({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:F.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:F.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:F.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:F.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:F.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:F.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:F.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:F.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:F.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"&&ae.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}return Number.isFinite(t)&&Number.isFinite(e)}}ji.create=(e)=>{return new ji({checks:[],typeName:R.ZodNumber,coerce:e?.coerce||!1,...Q(e)})};class zi extends oe{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)!==C.bigint)return this._getInvalidInput(e);let r=void 0,o=new at;for(let n of this._def.checks)if(n.kind==="min"){if(n.inclusive?e.data<n.value:e.data<=n.value)r=this._getOrReturnCtx(e,r),j(r,{code:I.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),o.dirty()}else if(n.kind==="max"){if(n.inclusive?e.data>n.value:e.data>=n.value)r=this._getOrReturnCtx(e,r),j(r,{code:I.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),o.dirty()}else if(n.kind==="multipleOf"){if(e.data%n.value!==BigInt(0))r=this._getOrReturnCtx(e,r),j(r,{code:I.not_multiple_of,multipleOf:n.value,message:n.message}),o.dirty()}else ae.assertNever(n);return{status:o.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return j(t,{code:I.invalid_type,expected:C.bigint,received:t.parsedType}),W}gte(e,t){return this.setLimit("min",e,!0,F.toString(t))}gt(e,t){return this.setLimit("min",e,!1,F.toString(t))}lte(e,t){return this.setLimit("max",e,!0,F.toString(t))}lt(e,t){return this.setLimit("max",e,!1,F.toString(t))}setLimit(e,t,r,o){return new zi({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:F.toString(o)}]})}_addCheck(e){return new zi({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:F.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:F.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:F.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:F.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:F.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}}zi.create=(e)=>{return new zi({checks:[],typeName:R.ZodBigInt,coerce:e?.coerce??!1,...Q(e)})};class Nd extends oe{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==C.boolean){let r=this._getOrReturnCtx(e);return j(r,{code:I.invalid_type,expected:C.boolean,received:r.parsedType}),W}return ft(e.data)}}Nd.create=(e)=>{return new Nd({typeName:R.ZodBoolean,coerce:e?.coerce||!1,...Q(e)})};class rc extends oe{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==C.date){let n=this._getOrReturnCtx(e);return j(n,{code:I.invalid_type,expected:C.date,received:n.parsedType}),W}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return j(n,{code:I.invalid_date}),W}let r=new at,o=void 0;for(let n of this._def.checks)if(n.kind==="min"){if(e.data.getTime()<n.value)o=this._getOrReturnCtx(e,o),j(o,{code:I.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()}else if(n.kind==="max"){if(e.data.getTime()>n.value)o=this._getOrReturnCtx(e,o),j(o,{code:I.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()}else ae.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new rc({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:F.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:F.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}}rc.create=(e)=>{return new rc({checks:[],coerce:e?.coerce||!1,typeName:R.ZodDate,...Q(e)})};class Dd extends oe{_parse(e){if(this._getType(e)!==C.symbol){let r=this._getOrReturnCtx(e);return j(r,{code:I.invalid_type,expected:C.symbol,received:r.parsedType}),W}return ft(e.data)}}Dd.create=(e)=>{return new Dd({typeName:R.ZodSymbol,...Q(e)})};class nc extends oe{_parse(e){if(this._getType(e)!==C.undefined){let r=this._getOrReturnCtx(e);return j(r,{code:I.invalid_type,expected:C.undefined,received:r.parsedType}),W}return ft(e.data)}}nc.create=(e)=>{return new nc({typeName:R.ZodUndefined,...Q(e)})};class oc extends oe{_parse(e){if(this._getType(e)!==C.null){let r=this._getOrReturnCtx(e);return j(r,{code:I.invalid_type,expected:C.null,received:r.parsedType}),W}return ft(e.data)}}oc.create=(e)=>{return new oc({typeName:R.ZodNull,...Q(e)})};class jd extends oe{constructor(){super(...arguments);this._any=!0}_parse(e){return ft(e.data)}}jd.create=(e)=>{return new jd({typeName:R.ZodAny,...Q(e)})};class Eo extends oe{constructor(){super(...arguments);this._unknown=!0}_parse(e){return ft(e.data)}}Eo.create=(e)=>{return new Eo({typeName:R.ZodUnknown,...Q(e)})};class Vr extends oe{_parse(e){let t=this._getOrReturnCtx(e);return j(t,{code:I.invalid_type,expected:C.never,received:t.parsedType}),W}}Vr.create=(e)=>{return new Vr({typeName:R.ZodNever,...Q(e)})};class zd extends oe{_parse(e){if(this._getType(e)!==C.undefined){let r=this._getOrReturnCtx(e);return j(r,{code:I.invalid_type,expected:C.void,received:r.parsedType}),W}return ft(e.data)}}zd.create=(e)=>{return new zd({typeName:R.ZodVoid,...Q(e)})};class Pr extends oe{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),o=this._def;if(t.parsedType!==C.array)return j(t,{code:I.invalid_type,expected:C.array,received:t.parsedType}),W;if(o.exactLength!==null){let i=t.data.length>o.exactLength.value,s=t.data.length<o.exactLength.value;if(i||s)j(t,{code:i?I.too_big:I.too_small,minimum:s?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty()}if(o.minLength!==null){if(t.data.length<o.minLength.value)j(t,{code:I.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()}if(o.maxLength!==null){if(t.data.length>o.maxLength.value)j(t,{code:I.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()}if(t.common.async)return Promise.all([...t.data].map((i,s)=>{return o.type._parseAsync(new ur(t,i,t.path,s))})).then((i)=>{return at.mergeArray(r,i)});let n=[...t.data].map((i,s)=>{return o.type._parseSync(new ur(t,i,t.path,s))});return at.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new Pr({...this._def,minLength:{value:e,message:F.toString(t)}})}max(e,t){return new Pr({...this._def,maxLength:{value:e,message:F.toString(t)}})}length(e,t){return new Pr({...this._def,exactLength:{value:e,message:F.toString(t)}})}nonempty(e){return this.min(1,e)}}Pr.create=(e,t)=>{return new Pr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray,...Q(t)})};function Di(e){if(e instanceof ze){let t={};for(let r in e.shape){let o=e.shape[r];t[r]=Gt.create(Di(o))}return new ze({...e._def,shape:()=>t})}else if(e instanceof Pr)return new Pr({...e._def,type:Di(e.element)});else if(e instanceof Gt)return Gt.create(Di(e.unwrap()));else if(e instanceof Pn)return Pn.create(Di(e.unwrap()));else if(e instanceof Wr)return Wr.create(e.items.map((t)=>Di(t)));else return e}class ze extends oe{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=ae.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==C.object){let c=this._getOrReturnCtx(e);return j(c,{code:I.invalid_type,expected:C.object,received:c.parsedType}),W}let{status:r,ctx:o}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof Vr&&this._def.unknownKeys==="strip")){for(let c in o.data)if(!i.includes(c))s.push(c)}let a=[];for(let c of i){let u=n[c],d=o.data[c];a.push({key:{status:"valid",value:c},value:u._parse(new ur(o,d,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Vr){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of s)a.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict"){if(s.length>0)j(o,{code:I.unrecognized_keys,keys:s}),r.dirty()}else if(c==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of s){let d=o.data[u];a.push({key:{status:"valid",value:u},value:c._parse(new ur(o,d,o.path,u)),alwaysSet:u in o.data})}}if(o.common.async)return Promise.resolve().then(async()=>{let c=[];for(let u of a){let d=await u.key,p=await u.value;c.push({key:d,value:p,alwaysSet:u.alwaysSet})}return c}).then((c)=>{return at.mergeObjectSync(r,c)});else return at.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(e){return F.errToObj,new ze({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let o=this._def.errorMap?.(t,r).message??r.defaultError;if(t.code==="unrecognized_keys")return{message:F.errToObj(e).message??o};return{message:o}}}:{}})}strip(){return new ze({...this._def,unknownKeys:"strip"})}passthrough(){return new ze({...this._def,unknownKeys:"passthrough"})}extend(e){return new ze({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ze({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:R.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ze({...this._def,catchall:e})}pick(e){let t={};for(let r of ae.objectKeys(e))if(e[r]&&this.shape[r])t[r]=this.shape[r];return new ze({...this._def,shape:()=>t})}omit(e){let t={};for(let r of ae.objectKeys(this.shape))if(!e[r])t[r]=this.shape[r];return new ze({...this._def,shape:()=>t})}deepPartial(){return Di(this)}partial(e){let t={};for(let r of ae.objectKeys(this.shape)){let o=this.shape[r];if(e&&!e[r])t[r]=o;else t[r]=o.optional()}return new ze({...this._def,shape:()=>t})}required(e){let t={};for(let r of ae.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let n=this.shape[r];while(n instanceof Gt)n=n._def.innerType;t[r]=n}return new ze({...this._def,shape:()=>t})}keyof(){return f0(ae.objectKeys(this.shape))}}ze.create=(e,t)=>{return new ze({shape:()=>e,unknownKeys:"strip",catchall:Vr.create(),typeName:R.ZodObject,...Q(t)})};ze.strictCreate=(e,t)=>{return new ze({shape:()=>e,unknownKeys:"strict",catchall:Vr.create(),typeName:R.ZodObject,...Q(t)})};ze.lazycreate=(e,t)=>{return new ze({shape:e,unknownKeys:"strip",catchall:Vr.create(),typeName:R.ZodObject,...Q(t)})};class ic extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function o(n){for(let s of n)if(s.result.status==="valid")return s.result;for(let s of n)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;let i=n.map((s)=>new jt(s.ctx.common.issues));return j(t,{code:I.invalid_union,unionErrors:i}),W}if(t.common.async)return Promise.all(r.map(async(n)=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(o);else{let n=void 0,i=[];for(let a of r){let c={...t,common:{...t.common,issues:[]},parent:null},u=a._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;else if(u.status==="dirty"&&!n)n={result:u,ctx:c};if(c.common.issues.length)i.push(c.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let s=i.map((a)=>new jt(a));return j(t,{code:I.invalid_union,unionErrors:s}),W}}get options(){return this._def.options}}ic.create=(e,t)=>{return new ic({options:e,typeName:R.ZodUnion,...Q(t)})};var qr=(e)=>{if(e instanceof ac)return qr(e.schema);else if(e instanceof Ir)return qr(e.innerType());else if(e instanceof cc)return[e.value];else if(e instanceof To)return e.options;else if(e instanceof lc)return ae.objectValues(e.enum);else if(e instanceof uc)return qr(e._def.innerType);else if(e instanceof nc)return[void 0];else if(e instanceof oc)return[null];else if(e instanceof Gt)return[void 0,...qr(e.unwrap())];else if(e instanceof Pn)return[null,...qr(e.unwrap())];else if(e instanceof Vy)return qr(e.unwrap());else if(e instanceof pc)return qr(e.unwrap());else if(e instanceof dc)return qr(e._def.innerType);else return[]};class Zy extends oe{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.object)return j(t,{code:I.invalid_type,expected:C.object,received:t.parsedType}),W;let r=this.discriminator,o=t.data[r],n=this.optionsMap.get(o);if(!n)return j(t,{code:I.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),W;if(t.common.async)return n._parseAsync({data:t.data,path:t.path,parent:t});else return n._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,r){let o=new Map;for(let n of t){let i=qr(n.shape[e]);if(!i.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of i){if(o.has(s))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,n)}}return new Zy({typeName:R.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:o,...Q(r)})}}function qy(e,t){let r=Br(e),o=Br(t);if(e===t)return{valid:!0,data:e};else if(r===C.object&&o===C.object){let n=ae.objectKeys(t),i=ae.objectKeys(e).filter((a)=>n.indexOf(a)!==-1),s={...e,...t};for(let a of i){let c=qy(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===C.array&&o===C.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],c=qy(s,a);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else if(r===C.date&&o===C.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}class sc extends oe{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),o=(n,i)=>{if(Fy(n)||Fy(i))return W;let s=qy(n.value,i.value);if(!s.valid)return j(r,{code:I.invalid_intersection_types}),W;if(Hy(n)||Hy(i))t.dirty();return{status:t.value,value:s.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,i])=>o(n,i));else return o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}sc.create=(e,t,r)=>{return new sc({left:e,right:t,typeName:R.ZodIntersection,...Q(r)})};class Wr extends oe{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.array)return j(r,{code:I.invalid_type,expected:C.array,received:r.parsedType}),W;if(r.data.length<this._def.items.length)return j(r,{code:I.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),W;if(!this._def.rest&&r.data.length>this._def.items.length)j(r,{code:I.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let n=[...r.data].map((i,s)=>{let a=this._def.items[s]||this._def.rest;if(!a)return null;return a._parse(new ur(r,i,r.path,s))}).filter((i)=>!!i);if(r.common.async)return Promise.all(n).then((i)=>{return at.mergeArray(t,i)});else return at.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Wr({...this._def,rest:e})}}Wr.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new Wr({items:e,typeName:R.ZodTuple,rest:null,...Q(t)})};class Ud extends oe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.object)return j(r,{code:I.invalid_type,expected:C.object,received:r.parsedType}),W;let o=[],n=this._def.keyType,i=this._def.valueType;for(let s in r.data)o.push({key:n._parse(new ur(r,s,r.path,s)),value:i._parse(new ur(r,r.data[s],r.path,s)),alwaysSet:s in r.data});if(r.common.async)return at.mergeObjectAsync(t,o);else return at.mergeObjectSync(t,o)}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof oe)return new Ud({keyType:e,valueType:t,typeName:R.ZodRecord,...Q(r)});return new Ud({keyType:Zr.create(),valueType:e,typeName:R.ZodRecord,...Q(t)})}}class Ld extends oe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.map)return j(r,{code:I.invalid_type,expected:C.map,received:r.parsedType}),W;let o=this._def.keyType,n=this._def.valueType,i=[...r.data.entries()].map(([s,a],c)=>{return{key:o._parse(new ur(r,s,r.path,[c,"key"])),value:n._parse(new ur(r,a,r.path,[c,"value"]))}});if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let a of i){let c=await a.key,u=await a.value;if(c.status==="aborted"||u.status==="aborted")return W;if(c.status==="dirty"||u.status==="dirty")t.dirty();s.set(c.value,u.value)}return{status:t.value,value:s}})}else{let s=new Map;for(let a of i){let{key:c,value:u}=a;if(c.status==="aborted"||u.status==="aborted")return W;if(c.status==="dirty"||u.status==="dirty")t.dirty();s.set(c.value,u.value)}return{status:t.value,value:s}}}}Ld.create=(e,t,r)=>{return new Ld({valueType:t,keyType:e,typeName:R.ZodMap,...Q(r)})};class Ui extends oe{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.set)return j(r,{code:I.invalid_type,expected:C.set,received:r.parsedType}),W;let o=this._def;if(o.minSize!==null){if(r.data.size<o.minSize.value)j(r,{code:I.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),t.dirty()}if(o.maxSize!==null){if(r.data.size>o.maxSize.value)j(r,{code:I.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),t.dirty()}let n=this._def.valueType;function i(a){let c=new Set;for(let u of a){if(u.status==="aborted")return W;if(u.status==="dirty")t.dirty();c.add(u.value)}return{status:t.value,value:c}}let s=[...r.data.values()].map((a,c)=>n._parse(new ur(r,a,r.path,c)));if(r.common.async)return Promise.all(s).then((a)=>i(a));else return i(s)}min(e,t){return new Ui({...this._def,minSize:{value:e,message:F.toString(t)}})}max(e,t){return new Ui({...this._def,maxSize:{value:e,message:F.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ui.create=(e,t)=>{return new Ui({valueType:e,minSize:null,maxSize:null,typeName:R.ZodSet,...Q(t)})};class tc extends oe{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.function)return j(t,{code:I.invalid_type,expected:C.function,received:t.parsedType}),W;function r(s,a){return Md({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Qa(),Tn].filter((c)=>!!c),issueData:{code:I.invalid_arguments,argumentsError:a}})}function o(s,a){return Md({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Qa(),Tn].filter((c)=>!!c),issueData:{code:I.invalid_return_type,returnTypeError:a}})}let n={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Li){let s=this;return ft(async function(...a){let c=new jt([]),u=await s._def.args.parseAsync(a,n).catch((f)=>{throw c.addIssue(r(a,f)),c}),d=await Reflect.apply(i,this,u);return await s._def.returns._def.type.parseAsync(d,n).catch((f)=>{throw c.addIssue(o(d,f)),c})})}else{let s=this;return ft(function(...a){let c=s._def.args.safeParse(a,n);if(!c.success)throw new jt([r(a,c.error)]);let u=Reflect.apply(i,this,c.data),d=s._def.returns.safeParse(u,n);if(!d.success)throw new jt([o(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new tc({...this._def,args:Wr.create(e).rest(Eo.create())})}returns(e){return new tc({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new tc({args:e?e:Wr.create([]).rest(Eo.create()),returns:t||Eo.create(),typeName:R.ZodFunction,...Q(r)})}}class ac extends oe{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})}}ac.create=(e,t)=>{return new ac({getter:e,typeName:R.ZodLazy,...Q(t)})};class cc extends oe{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return j(t,{received:t.data,code:I.invalid_literal,expected:this._def.value}),W}return{status:"valid",value:e.data}}get value(){return this._def.value}}cc.create=(e,t)=>{return new cc({value:e,typeName:R.ZodLiteral,...Q(t)})};function f0(e,t){return new To({values:e,typeName:R.ZodEnum,...Q(t)})}class To extends oe{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return j(t,{expected:ae.joinValues(r),received:t.parsedType,code:I.invalid_type}),W}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return j(t,{received:t.data,code:I.invalid_enum_value,options:r}),W}return ft(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 To.create(e,{...this._def,...t})}exclude(e,t=this._def){return To.create(this.options.filter((r)=>!e.includes(r)),{...this._def,...t})}}To.create=f0;class lc extends oe{_parse(e){let t=ae.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==C.string&&r.parsedType!==C.number){let o=ae.objectValues(t);return j(r,{expected:ae.joinValues(o),received:r.parsedType,code:I.invalid_type}),W}if(!this._cache)this._cache=new Set(ae.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let o=ae.objectValues(t);return j(r,{received:r.data,code:I.invalid_enum_value,options:o}),W}return ft(e.data)}get enum(){return this._def.values}}lc.create=(e,t)=>{return new lc({values:e,typeName:R.ZodNativeEnum,...Q(t)})};class Li extends oe{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.promise&&t.common.async===!1)return j(t,{code:I.invalid_type,expected:C.promise,received:t.parsedType}),W;let r=t.parsedType===C.promise?t.data:Promise.resolve(t.data);return ft(r.then((o)=>{return this._def.type.parseAsync(o,{path:t.path,errorMap:t.common.contextualErrorMap})}))}}Li.create=(e,t)=>{return new Li({type:e,typeName:R.ZodPromise,...Q(t)})};class Ir extends oe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),o=this._def.effect||null,n={addIssue:(i)=>{if(j(r,i),i.fatal)t.abort();else t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),o.type==="preprocess"){let i=o.transform(r.data,n);if(r.common.async)return Promise.resolve(i).then(async(s)=>{if(t.value==="aborted")return W;let a=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});if(a.status==="aborted")return W;if(a.status==="dirty")return Ni(a.value);if(t.value==="dirty")return Ni(a.value);return a});else{if(t.value==="aborted")return W;let s=this._def.schema._parseSync({data:i,path:r.path,parent:r});if(s.status==="aborted")return W;if(s.status==="dirty")return Ni(s.value);if(t.value==="dirty")return Ni(s.value);return s}}if(o.type==="refinement"){let i=(s)=>{let a=o.refinement(s,n);if(r.common.async)return Promise.resolve(a);if(a instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(s.status==="aborted")return W;if(s.status==="dirty")t.dirty();return i(s.value),{status:t.value,value:s.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((s)=>{if(s.status==="aborted")return W;if(s.status==="dirty")t.dirty();return i(s.value).then(()=>{return{status:t.value,value:s.value}})})}if(o.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ko(i))return W;let s=o.transform(i.value,n);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((i)=>{if(!ko(i))return W;return Promise.resolve(o.transform(i.value,n)).then((s)=>({status:t.value,value:s}))});ae.assertNever(o)}}Ir.create=(e,t,r)=>{return new Ir({schema:e,typeName:R.ZodEffects,effect:t,...Q(r)})};Ir.createWithPreprocess=(e,t,r)=>{return new Ir({schema:t,effect:{type:"preprocess",transform:e},typeName:R.ZodEffects,...Q(r)})};class Gt extends oe{_parse(e){if(this._getType(e)===C.undefined)return ft(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Gt.create=(e,t)=>{return new Gt({innerType:e,typeName:R.ZodOptional,...Q(t)})};class Pn extends oe{_parse(e){if(this._getType(e)===C.null)return ft(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Pn.create=(e,t)=>{return new Pn({innerType:e,typeName:R.ZodNullable,...Q(t)})};class uc extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;if(t.parsedType===C.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}uc.create=(e,t)=>{return new uc({innerType:e,typeName:R.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...Q(t)})};class dc extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(ec(o))return o.then((n)=>{return{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new jt(r.common.issues)},input:r.data})}});else return{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new jt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}dc.create=(e,t)=>{return new dc({innerType:e,typeName:R.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...Q(t)})};class Fd extends oe{_parse(e){if(this._getType(e)!==C.nan){let r=this._getOrReturnCtx(e);return j(r,{code:I.invalid_type,expected:C.nan,received:r.parsedType}),W}return{status:"valid",value:e.data}}}Fd.create=(e)=>{return new Fd({typeName:R.ZodNaN,...Q(e)})};var Yye=Symbol("zod_brand");class Vy extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Hd extends oe{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return W;if(n.status==="dirty")return t.dirty(),Ni(n.value);else return this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();else{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(o.status==="aborted")return W;if(o.status==="dirty")return t.dirty(),{status:"dirty",value:o.value};else return this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,t){return new Hd({in:e,out:t,typeName:R.ZodPipeline})}}class pc extends oe{_parse(e){let t=this._def.innerType._parse(e),r=(o)=>{if(ko(o))o.value=Object.freeze(o.value);return o};return ec(t)?t.then((o)=>r(o)):r(t)}unwrap(){return this._def.innerType}}pc.create=(e,t)=>{return new pc({innerType:e,typeName:R.ZodReadonly,...Q(t)})};var Qye={object:ze.lazycreate},R;(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"})(R||(R={}));var ebe=Zr.create,tbe=ji.create,rbe=Fd.create,nbe=zi.create,obe=Nd.create,ibe=rc.create,sbe=Dd.create,abe=nc.create,cbe=oc.create,lbe=jd.create,ube=Eo.create,dbe=Vr.create,pbe=zd.create,fbe=Pr.create,m0=ze.create,mbe=ze.strictCreate,gbe=ic.create,hbe=Zy.create,ybe=sc.create,bbe=Wr.create,_be=Ud.create,vbe=Ld.create,Sbe=Ui.create,xbe=tc.create,wbe=ac.create,kbe=cc.create,Ebe=To.create,Tbe=lc.create,Pbe=Li.create,Ibe=Ir.create,Rbe=Gt.create,$be=Pn.create,Obe=Ir.createWithPreprocess,Abe=Hd.create;var dr={};wr(dr,{version:()=>Jb,util:()=>A,treeifyError:()=>Vd,toJSONSchema:()=>rs,toDotPath:()=>y0,safeParseAsync:()=>$n,safeParse:()=>Rn,registry:()=>Ic,regexes:()=>On,prettifyError:()=>Wd,parseAsync:()=>$o,parse:()=>Ro,locales:()=>Xi,isValidJWT:()=>N0,isValidBase64URL:()=>M0,isValidBase64:()=>r_,globalRegistry:()=>Et,globalConfig:()=>fc,function:()=>If,formatError:()=>Zi,flattenError:()=>qi,config:()=>He,clone:()=>ct,_xid:()=>Lc,_void:()=>vf,_uuidv7:()=>Cc,_uuidv6:()=>Ac,_uuidv4:()=>Oc,_uuid:()=>$c,_url:()=>Mc,_uppercase:()=>Qc,_unknown:()=>Co,_union:()=>wV,_undefined:()=>hf,_ulid:()=>Uc,_uint64:()=>mf,_uint32:()=>uf,_tuple:()=>tv,_trim:()=>il,_transform:()=>AV,_toUpperCase:()=>al,_toLowerCase:()=>sl,_templateLiteral:()=>FV,_symbol:()=>gf,_success:()=>jV,_stringbool:()=>Tf,_stringFormat:()=>Pf,_string:()=>rf,_startsWith:()=>tl,_size:()=>Jc,_set:()=>IV,_safeParseAsync:()=>Xd,_safeParse:()=>Jd,_regex:()=>Xc,_refine:()=>Ef,_record:()=>TV,_readonly:()=>LV,_property:()=>ev,_promise:()=>BV,_positive:()=>J_,_pipe:()=>UV,_parseAsync:()=>Gd,_parse:()=>Kd,_overwrite:()=>Yr,_optional:()=>CV,_number:()=>of,_nullable:()=>MV,_null:()=>yf,_normalize:()=>ol,_nonpositive:()=>Y_,_nonoptional:()=>DV,_nonnegative:()=>Q_,_never:()=>_f,_negative:()=>X_,_nativeEnum:()=>$V,_nanoid:()=>Dc,_nan:()=>xf,_multipleOf:()=>Mo,_minSize:()=>No,_minLength:()=>Mn,_min:()=>Tt,_mime:()=>nl,_maxSize:()=>Qi,_maxLength:()=>es,_max:()=>Jt,_map:()=>PV,_lte:()=>Jt,_lt:()=>Jr,_lowercase:()=>Yc,_literal:()=>OV,_length:()=>ts,_lazy:()=>HV,_ksuid:()=>Fc,_jwt:()=>Gc,_isoTime:()=>q_,_isoDuration:()=>Z_,_isoDateTime:()=>H_,_isoDate:()=>B_,_ipv6:()=>Bc,_ipv4:()=>Hc,_intersection:()=>EV,_int64:()=>ff,_int32:()=>lf,_int:()=>sf,_includes:()=>el,_guid:()=>Yi,_gte:()=>Tt,_gt:()=>Xr,_float64:()=>cf,_float32:()=>af,_file:()=>wf,_enum:()=>RV,_endsWith:()=>rl,_emoji:()=>Nc,_email:()=>Rc,_e164:()=>Kc,_discriminatedUnion:()=>kV,_default:()=>NV,_date:()=>Sf,_custom:()=>kf,_cuid2:()=>zc,_cuid:()=>jc,_coercedString:()=>F_,_coercedNumber:()=>V_,_coercedDate:()=>G_,_coercedBoolean:()=>W_,_coercedBigint:()=>K_,_cidrv6:()=>Zc,_cidrv4:()=>qc,_catch:()=>zV,_boolean:()=>df,_bigint:()=>pf,_base64url:()=>Wc,_base64:()=>Vc,_array:()=>cl,_any:()=>bf,TimePrecision:()=>nf,NEVER:()=>Bd,JSONSchemaGenerator:()=>Rf,JSONSchema:()=>U0,Doc:()=>tp,$output:()=>ef,$input:()=>tf,$constructor:()=>b,$brand:()=>qd,$ZodXID:()=>fp,$ZodVoid:()=>Op,$ZodUnknown:()=>Ao,$ZodUnion:()=>Ec,$ZodUndefined:()=>Pp,$ZodUUID:()=>ip,$ZodURL:()=>ap,$ZodULID:()=>pp,$ZodType:()=>G,$ZodTuple:()=>Cn,$ZodTransform:()=>Gi,$ZodTemplateLiteral:()=>Jp,$ZodSymbol:()=>Tp,$ZodSuccess:()=>Vp,$ZodStringFormat:()=>xe,$ZodString:()=>An,$ZodSet:()=>jp,$ZodRegistry:()=>Pc,$ZodRecord:()=>Np,$ZodRealError:()=>Bi,$ZodReadonly:()=>Gp,$ZodPromise:()=>Xp,$ZodPrefault:()=>qp,$ZodPipe:()=>Ji,$ZodOptional:()=>Fp,$ZodObject:()=>kc,$ZodNumberFormat:()=>kp,$ZodNumber:()=>xc,$ZodNullable:()=>Hp,$ZodNull:()=>Ip,$ZodNonOptional:()=>Zp,$ZodNever:()=>$p,$ZodNanoID:()=>lp,$ZodNaN:()=>Kp,$ZodMap:()=>Dp,$ZodLiteral:()=>Up,$ZodLazy:()=>Yp,$ZodKSUID:()=>mp,$ZodJWT:()=>xp,$ZodIntersection:()=>Mp,$ZodISOTime:()=>e_,$ZodISODuration:()=>t_,$ZodISODateTime:()=>Yb,$ZodISODate:()=>Qb,$ZodIPv6:()=>hp,$ZodIPv4:()=>gp,$ZodGUID:()=>op,$ZodFunction:()=>rv,$ZodFile:()=>Lp,$ZodError:()=>Sc,$ZodEnum:()=>zp,$ZodEmoji:()=>cp,$ZodEmail:()=>sp,$ZodE164:()=>Sp,$ZodDiscriminatedUnion:()=>Cp,$ZodDefault:()=>Bp,$ZodDate:()=>Ap,$ZodCustomStringFormat:()=>wp,$ZodCustom:()=>Qp,$ZodCheckUpperCase:()=>Bb,$ZodCheckStringFormat:()=>Vi,$ZodCheckStartsWith:()=>Zb,$ZodCheckSizeEquals:()=>jb,$ZodCheckRegex:()=>Fb,$ZodCheckProperty:()=>Wb,$ZodCheckOverwrite:()=>Gb,$ZodCheckNumberFormat:()=>Cb,$ZodCheckMultipleOf:()=>Ab,$ZodCheckMinSize:()=>Db,$ZodCheckMinLength:()=>Ub,$ZodCheckMimeType:()=>Kb,$ZodCheckMaxSize:()=>Nb,$ZodCheckMaxLength:()=>zb,$ZodCheckLowerCase:()=>Hb,$ZodCheckLessThan:()=>Qd,$ZodCheckLengthEquals:()=>Lb,$ZodCheckIncludes:()=>qb,$ZodCheckGreaterThan:()=>ep,$ZodCheckEndsWith:()=>Vb,$ZodCheckBigIntFormat:()=>Mb,$ZodCheck:()=>Me,$ZodCatch:()=>Wp,$ZodCUID2:()=>dp,$ZodCUID:()=>up,$ZodCIDRv6:()=>bp,$ZodCIDRv4:()=>yp,$ZodBoolean:()=>Wi,$ZodBigIntFormat:()=>Ep,$ZodBigInt:()=>wc,$ZodBase64URL:()=>vp,$ZodBase64:()=>_p,$ZodAsyncError:()=>Kr,$ZodArray:()=>Ki,$ZodAny:()=>Rp});var Bd=Object.freeze({status:"aborted"});function b(e,t,r){function o(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(e),t(a,c);for(let d in s.prototype)if(!(d in a))Object.defineProperty(a,d,{value:s.prototype[d].bind(a)});a._zod.constr=s,a._zod.def=c}let n=r?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function s(a){var c;let u=r?.Parent?new i:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let d of u._zod.deferred)d();return u}return Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}var qd=Symbol("zod_brand");class Kr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var fc={};function He(e){if(e)Object.assign(fc,e);return fc}var A={};wr(A,{unwrapMessage:()=>mc,stringifyPrimitive:()=>N,required:()=>xZ,randomString:()=>fZ,propertyKeyTypes:()=>bc,promiseAllObject:()=>pZ,primitiveTypes:()=>Yy,prefixIssues:()=>kt,pick:()=>yZ,partial:()=>SZ,optionalKeys:()=>Qy,omit:()=>bZ,numKeys:()=>mZ,nullish:()=>In,normalizeParams:()=>$,merge:()=>vZ,jsonStringifyReplacer:()=>Ky,joinValues:()=>T,issue:()=>rb,isPlainObject:()=>Hi,isObject:()=>Fi,getSizableOrigin:()=>_c,getParsedType:()=>gZ,getLengthableOrigin:()=>vc,getEnumValues:()=>gc,getElementAtPath:()=>dZ,floatSafeRemainder:()=>Gy,finalizeIssue:()=>zt,extend:()=>_Z,escapeRegex:()=>Gr,esc:()=>Po,defineLazy:()=>me,createTransparentProxy:()=>hZ,clone:()=>ct,cleanRegex:()=>yc,cleanEnum:()=>wZ,captureStackTrace:()=>Zd,cached:()=>hc,assignProp:()=>Jy,assertNotEqual:()=>aZ,assertNever:()=>lZ,assertIs:()=>cZ,assertEqual:()=>sZ,assert:()=>uZ,allowsEval:()=>Xy,aborted:()=>Io,NUMBER_FORMAT_RANGES:()=>eb,Class:()=>g0,BIGINT_FORMAT_RANGES:()=>tb});function sZ(e){return e}function aZ(e){return e}function cZ(e){}function lZ(e){throw Error()}function uZ(e){}function gc(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function T(e,t="|"){return e.map((r)=>N(r)).join(t)}function Ky(e,t){if(typeof t==="bigint")return t.toString();return t}function hc(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function In(e){return e===null||e===void 0}function yc(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Gy(e,t){let r=(e.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,n=r>o?r:o,i=Number.parseInt(e.toFixed(n).replace(".","")),s=Number.parseInt(t.toFixed(n).replace(".",""));return i%s/10**n}function me(e,t,r){Object.defineProperty(e,t,{get(){{let n=r();return e[t]=n,n}throw Error("cached value already set")},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Jy(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function dZ(e,t){if(!t)return e;return t.reduce((r,o)=>r?.[o],e)}function pZ(e){let t=Object.keys(e),r=t.map((o)=>e[o]);return Promise.all(r).then((o)=>{let n={};for(let i=0;i<t.length;i++)n[t[i]]=o[i];return n})}function fZ(e=10){let r="";for(let o=0;o<e;o++)r+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return r}function Po(e){return JSON.stringify(e)}var Zd=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Fi(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Xy=hc(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Hi(e){if(Fi(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;if(Fi(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function mZ(e){let t=0;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t++;return t}var gZ=(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}`)}},bc=new Set(["string","number","symbol"]),Yy=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Gr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ct(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function $(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 hZ(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,i){return t??(t=e()),Reflect.set(t,o,n,i)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function N(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Qy(e){return Object.keys(e).filter((t)=>{return e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional"})}var eb={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]},tb={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function yZ(e,t){let r={},o=e._zod.def;for(let n in t){if(!(n in o.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;r[n]=o.shape[n]}return ct(e,{...e._zod.def,shape:r,checks:[]})}function bZ(e,t){let r={...e._zod.def.shape},o=e._zod.def;for(let n in t){if(!(n in o.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;delete r[n]}return ct(e,{...e._zod.def,shape:r,checks:[]})}function _Z(e,t){if(!Hi(t))throw Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let o={...e._zod.def.shape,...t};return Jy(this,"shape",o),o},checks:[]};return ct(e,r)}function vZ(e,t){return ct(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return Jy(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function SZ(e,t,r){let o=t._zod.def.shape,n={...o};if(r)for(let i in r){if(!(i in o))throw Error(`Unrecognized key: "${i}"`);if(!r[i])continue;n[i]=e?new e({type:"optional",innerType:o[i]}):o[i]}else for(let i in o)n[i]=e?new e({type:"optional",innerType:o[i]}):o[i];return ct(t,{...t._zod.def,shape:n,checks:[]})}function xZ(e,t,r){let o=t._zod.def.shape,n={...o};if(r)for(let i in r){if(!(i in n))throw Error(`Unrecognized key: "${i}"`);if(!r[i])continue;n[i]=new e({type:"nonoptional",innerType:o[i]})}else for(let i in o)n[i]=new e({type:"nonoptional",innerType:o[i]});return ct(t,{...t._zod.def,shape:n,checks:[]})}function Io(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function kt(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function mc(e){return typeof e==="string"?e:e?.message}function zt(e,t,r){let o={...e,path:e.path??[]};if(!e.message){let n=mc(e.inst?._zod.def?.error?.(e))??mc(t?.error?.(e))??mc(r.customError?.(e))??mc(r.localeError?.(e))??"Invalid input";o.message=n}if(delete o.inst,delete o.continue,!t?.reportInput)delete o.input;return o}function _c(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function vc(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function rb(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}function wZ(e){return Object.entries(e).filter(([t,r])=>{return Number.isNaN(Number.parseInt(t,10))}).map((t)=>t[1])}class g0{constructor(...e){}}var h0=(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,Ky,2)},enumerable:!0})},Sc=b("$ZodError",h0),Bi=b("$ZodError",h0,{Parent:Error});function qi(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function Zi(e,t){let r=t||function(i){return i.message},o={_errors:[]},n=(i)=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>n({issues:a}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)o._errors.push(r(s));else{let a=o,c=0;while(c<s.path.length){let u=s.path[c];if(c!==s.path.length-1)a[u]=a[u]||{_errors:[]};else a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s));a=a[u],c++}}};return n(e),o}function Vd(e,t){let r=t||function(i){return i.message},o={errors:[]},n=(i,s=[])=>{var a,c;for(let u of i.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map((d)=>n({issues:d},u.path));else if(u.code==="invalid_key")n({issues:u.issues},u.path);else if(u.code==="invalid_element")n({issues:u.issues},u.path);else{let d=[...s,...u.path];if(d.length===0){o.errors.push(r(u));continue}let p=o,f=0;while(f<d.length){let m=d[f],g=f===d.length-1;if(typeof m==="string")p.properties??(p.properties={}),(a=p.properties)[m]??(a[m]={errors:[]}),p=p.properties[m];else p.items??(p.items=[]),(c=p.items)[m]??(c[m]={errors:[]}),p=p.items[m];if(g)p.errors.push(r(u));f++}}};return n(e),o}function y0(e){let t=[];for(let r of e)if(typeof r==="number")t.push(`[${r}]`);else if(typeof r==="symbol")t.push(`[${JSON.stringify(String(r))}]`);else if(/[^\w$]/.test(r))t.push(`[${JSON.stringify(r)}]`);else{if(t.length)t.push(".");t.push(r)}return t.join("")}function Wd(e){let t=[],r=[...e.issues].sort((o,n)=>o.path.length-n.path.length);for(let o of r)if(t.push(`✖ ${o.message}`),o.path?.length)t.push(` → at ${y0(o.path)}`);return t.join(`
73
+ `)}var Kd=(e)=>(t,r,o,n)=>{let i=o?Object.assign(o,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new Kr;if(s.issues.length){let a=new(n?.Err??e)(s.issues.map((c)=>zt(c,i,He())));throw Zd(a,n?.callee),a}return s.value},Ro=Kd(Bi),Gd=(e)=>async(t,r,o,n)=>{let i=o?Object.assign(o,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)s=await s;if(s.issues.length){let a=new(n?.Err??e)(s.issues.map((c)=>zt(c,i,He())));throw Zd(a,n?.callee),a}return s.value},$o=Gd(Bi),Jd=(e)=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new Kr;return i.issues.length?{success:!1,error:new(e??Sc)(i.issues.map((s)=>zt(s,n,He())))}:{success:!0,data:i.value}},Rn=Jd(Bi),Xd=(e)=>async(t,r,o)=>{let n=o?Object.assign(o,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)i=await i;return i.issues.length?{success:!1,error:new e(i.issues.map((s)=>zt(s,n,He())))}:{success:!0,data:i.value}},$n=Xd(Bi);var On={};wr(On,{xid:()=>sb,uuid7:()=>IZ,uuid6:()=>PZ,uuid4:()=>TZ,uuid:()=>Oo,uppercase:()=>Ob,unicodeEmail:()=>OZ,undefined:()=>Rb,ulid:()=>ib,time:()=>Sb,string:()=>wb,rfc5322Email:()=>$Z,number:()=>Tb,null:()=>Ib,nanoid:()=>cb,lowercase:()=>$b,ksuid:()=>ab,ipv6:()=>mb,ipv4:()=>fb,integer:()=>Eb,html5Email:()=>RZ,hostname:()=>bb,guid:()=>ub,extendedDuration:()=>EZ,emoji:()=>pb,email:()=>db,e164:()=>_b,duration:()=>lb,domain:()=>MZ,datetime:()=>xb,date:()=>vb,cuid2:()=>ob,cuid:()=>nb,cidrv6:()=>hb,cidrv4:()=>gb,browserEmail:()=>AZ,boolean:()=>Pb,bigint:()=>kb,base64url:()=>Yd,base64:()=>yb,_emoji:()=>CZ});var nb=/^[cC][^\s-]{8,}$/,ob=/^[0-9a-z]+$/,ib=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,sb=/^[0-9a-vA-V]{20}$/,ab=/^[A-Za-z0-9]{27}$/,cb=/^[a-zA-Z0-9_-]{21}$/,lb=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,EZ=/^[-+]?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)?)??$/,ub=/^([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})$/,Oo=(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})$`)},TZ=Oo(4),PZ=Oo(6),IZ=Oo(7),db=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,RZ=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,$Z=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,OZ=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,AZ=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,CZ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function pb(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var fb=/^(?:(?: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])$/,mb=/^(([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})$/,gb=/^((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])$/,hb=/^(([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])$/,yb=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Yd=/^[A-Za-z0-9_-]*$/,bb=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,MZ=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,_b=/^\+(?:[0-9]){6,14}[0-9]$/,b0="(?:(?:\\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])))",vb=new RegExp(`^${b0}$`);function _0(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 Sb(e){return new RegExp(`^${_0(e)}$`)}function xb(e){let t=_0({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-]\\d{2}:\\d{2})");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${b0}T(?:${o})$`)}var wb=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},kb=/^\d+n?$/,Eb=/^\d+$/,Tb=/^-?\d+(?:\.\d+)?/i,Pb=/true|false/i,Ib=/null/i;var Rb=/undefined/i;var $b=/^[^A-Z]*$/,Ob=/^[^a-z]*$/;var Me=b("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),S0={number:"number",bigint:"bigint",object:"date"},Qd=b("$ZodCheckLessThan",(e,t)=>{Me.init(e,t);let r=S0[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<i)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:r,code:"too_big",maximum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ep=b("$ZodCheckGreaterThan",(e,t)=>{Me.init(e,t);let r=S0[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>i)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:r,code:"too_small",minimum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ab=b("$ZodCheckMultipleOf",(e,t)=>{Me.init(e,t),e._zod.onattach.push((r)=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):Gy(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Cb=b("$ZodCheckNumberFormat",(e,t)=>{Me.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,i]=eb[t.format];e._zod.onattach.push((s)=>{let a=s._zod.bag;if(a.format=t.format,a.minimum=n,a.maximum=i,r)a.pattern=Eb}),e._zod.check=(s)=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:o,format:t.format,code:"invalid_type",input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});return}}if(a<n)s.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inst:e})}}),Mb=b("$ZodCheckBigIntFormat",(e,t)=>{Me.init(e,t);let[r,o]=tb[t.format];e._zod.onattach.push((n)=>{let i=n._zod.bag;i.format=t.format,i.minimum=r,i.maximum=o}),e._zod.check=(n)=>{let i=n.value;if(i<r)n.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(i>o)n.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inst:e})}}),Nb=b("$ZodCheckMaxSize",(e,t)=>{Me.init(e,t),e._zod.when=(r)=>{let o=r.value;return!In(o)&&o.size!==void 0},e._zod.onattach.push((r)=>{let o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<o)r._zod.bag.maximum=t.maximum}),e._zod.check=(r)=>{let o=r.value;if(o.size<=t.maximum)return;r.issues.push({origin:_c(o),code:"too_big",maximum:t.maximum,input:o,inst:e,continue:!t.abort})}}),Db=b("$ZodCheckMinSize",(e,t)=>{Me.init(e,t),e._zod.when=(r)=>{let o=r.value;return!In(o)&&o.size!==void 0},e._zod.onattach.push((r)=>{let o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>o)r._zod.bag.minimum=t.minimum}),e._zod.check=(r)=>{let o=r.value;if(o.size>=t.minimum)return;r.issues.push({origin:_c(o),code:"too_small",minimum:t.minimum,input:o,inst:e,continue:!t.abort})}}),jb=b("$ZodCheckSizeEquals",(e,t)=>{Me.init(e,t),e._zod.when=(r)=>{let o=r.value;return!In(o)&&o.size!==void 0},e._zod.onattach.push((r)=>{let o=r._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=(r)=>{let o=r.value,n=o.size;if(n===t.size)return;let i=n>t.size;r.issues.push({origin:_c(o),...i?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),zb=b("$ZodCheckMaxLength",(e,t)=>{Me.init(e,t),e._zod.when=(r)=>{let o=r.value;return!In(o)&&o.length!==void 0},e._zod.onattach.push((r)=>{let o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<o)r._zod.bag.maximum=t.maximum}),e._zod.check=(r)=>{let o=r.value;if(o.length<=t.maximum)return;let i=vc(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ub=b("$ZodCheckMinLength",(e,t)=>{Me.init(e,t),e._zod.when=(r)=>{let o=r.value;return!In(o)&&o.length!==void 0},e._zod.onattach.push((r)=>{let o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>o)r._zod.bag.minimum=t.minimum}),e._zod.check=(r)=>{let o=r.value;if(o.length>=t.minimum)return;let i=vc(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Lb=b("$ZodCheckLengthEquals",(e,t)=>{Me.init(e,t),e._zod.when=(r)=>{let o=r.value;return!In(o)&&o.length!==void 0},e._zod.onattach.push((r)=>{let o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=(r)=>{let o=r.value,n=o.length;if(n===t.length)return;let i=vc(o),s=n>t.length;r.issues.push({origin:i,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Vi=b("$ZodCheckStringFormat",(e,t)=>{var r,o;if(Me.init(e,t),e._zod.onattach.push((n)=>{let i=n._zod.bag;if(i.format=t.format,t.pattern)i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),Fb=b("$ZodCheckRegex",(e,t)=>{Vi.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Hb=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=$b),Vi.init(e,t)}),Bb=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ob),Vi.init(e,t)}),qb=b("$ZodCheckIncludes",(e,t)=>{Me.init(e,t);let r=Gr(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push((n)=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Zb=b("$ZodCheckStartsWith",(e,t)=>{Me.init(e,t);let r=new RegExp(`^${Gr(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Vb=b("$ZodCheckEndsWith",(e,t)=>{Me.init(e,t);let r=new RegExp(`.*${Gr(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});function v0(e,t,r){if(e.issues.length)t.issues.push(...kt(r,e.issues))}var Wb=b("$ZodCheckProperty",(e,t)=>{Me.init(e,t),e._zod.check=(r)=>{let o=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then((n)=>v0(n,r,t.property));v0(o,r,t.property);return}}),Kb=b("$ZodCheckMimeType",(e,t)=>{Me.init(e,t);let r=new Set(t.mime);e._zod.onattach.push((o)=>{o._zod.bag.mime=t.mime}),e._zod.check=(o)=>{if(r.has(o.value.type))return;o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e})}}),Gb=b("$ZodCheckOverwrite",(e,t)=>{Me.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class tp{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 r=e.split(`
74
74
  `).filter((i)=>i),o=Math.min(...r.map((i)=>i.length-i.trimStart().length)),n=r.map((i)=>i.slice(o)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of n)this.content.push(i)}compile(){let e=Function,t=this?.args,o=[...(this?.content??[""]).map((n)=>` ${n}`)];return new e(...t,o.join(`
75
- `))}}var Gb={major:4,minor:0,patch:0};var G=b("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Gb;let o=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))o.unshift(e);for(let n of o)for(let i of n._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(i,s,a)=>{let c=Eo(i),u;for(let d of s){if(d._zod.when){if(!d._zod.when(i))continue}else if(c)continue;let p=i.issues.length,f=d._zod.check(i);if(f instanceof Promise&&a?.async===!1)throw new Kr;if(u||f instanceof Promise)u=(u??Promise.resolve()).then(async()=>{if(await f,i.issues.length===p)return;if(!c)c=Eo(i,p)});else{if(i.issues.length===p)continue;if(!c)c=Eo(i,p)}}if(u)return u.then(()=>{return i});return i};e._zod.run=(i,s)=>{let a=e._zod.parse(i,s);if(a instanceof Promise){if(s.async===!1)throw new Kr;return a.then((c)=>n(c,o,s))}return n(a,o,s)}}e["~standard"]={validate:(n)=>{try{let i=Pn(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch(i){return In(e,n).then((s)=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),$n=b("$ZodString",(e,t)=>{G.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??xb(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),xe=b("$ZodStringFormat",(e,t)=>{Vi.init(e,t),$n.init(e,t)}),np=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=lb),xe.init(e,t)}),op=b("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ro(o))}else t.pattern??(t.pattern=Ro());xe.init(e,t)}),ip=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ub),xe.init(e,t)}),sp=b("$ZodURL",(e,t)=>{xe.init(e,t),e._zod.check=(r)=>{try{let o=r.value,n=new URL(o),i=n.href;if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(n.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:yb.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(!o.endsWith("/")&&i.endsWith("/"))r.value=i.slice(0,-1);else r.value=i;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ap=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=db()),xe.init(e,t)}),cp=b("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ab),xe.init(e,t)}),lp=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=rb),xe.init(e,t)}),up=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=nb),xe.init(e,t)}),dp=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ob),xe.init(e,t)}),pp=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ib),xe.init(e,t)}),fp=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=sb),xe.init(e,t)}),Xb=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Sb(t)),xe.init(e,t)}),Yb=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=_b),xe.init(e,t)}),Qb=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=vb(t)),xe.init(e,t)}),e_=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=cb),xe.init(e,t)}),mp=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=pb),xe.init(e,t),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.format="ipv4"})}),gp=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=fb),xe.init(e,t),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.format="ipv6"}),e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),hp=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=mb),xe.init(e,t)}),yp=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=gb),xe.init(e,t),e._zod.check=(r)=>{let[o,n]=r.value.split("/");try{if(!n)throw Error();let i=Number(n);if(`${i}`!==n)throw Error();if(i<0||i>128)throw Error();new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function t_(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var bp=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=hb),xe.init(e,t),e._zod.onattach.push((r)=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=(r)=>{if(t_(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function AR(e){if(!Xd.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return t_(r)}var _p=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Xd),xe.init(e,t),e._zod.onattach.push((r)=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=(r)=>{if(AR(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),vp=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=bb),xe.init(e,t)});function CR(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var Sp=b("$ZodJWT",(e,t)=>{xe.init(e,t),e._zod.check=(r)=>{if(CR(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),xp=b("$ZodCustomStringFormat",(e,t)=>{xe.init(e,t),e._zod.check=(r)=>{if(t.fn(r.value))return;r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),xc=b("$ZodNumber",(e,t)=>{G.init(e,t),e._zod.pattern=e._zod.bag.pattern??Tb,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let i=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),r}}),wp=b("$ZodNumber",(e,t)=>{Ab.init(e,t),xc.init(e,t)}),Wi=b("$ZodBoolean",(e,t)=>{G.init(e,t),e._zod.pattern=Eb,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let n=r.value;if(typeof n==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),wc=b("$ZodBigInt",(e,t)=>{G.init(e,t),e._zod.pattern=wb,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(n){}if(typeof r.value==="bigint")return r;return r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),kp=b("$ZodBigInt",(e,t)=>{Cb.init(e,t),wc.init(e,t)}),Tp=b("$ZodSymbol",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(typeof n==="symbol")return r;return r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),Ep=b("$ZodUndefined",(e,t)=>{G.init(e,t),e._zod.pattern=Ib,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,o)=>{let n=r.value;if(typeof n>"u")return r;return r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),Pp=b("$ZodNull",(e,t)=>{G.init(e,t),e._zod.pattern=Pb,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;if(n===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Ip=b("$ZodAny",(e,t)=>{G.init(e,t),e._zod.parse=(r)=>r}),$o=b("$ZodUnknown",(e,t)=>{G.init(e,t),e._zod.parse=(r)=>r}),Rp=b("$ZodNever",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{return r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r}}),$p=b("$ZodVoid",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(typeof n>"u")return r;return r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),Op=b("$ZodDate",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(a){}let n=r.value,i=n instanceof Date;if(i&&!Number.isNaN(n.getTime()))return r;return r.issues.push({expected:"date",code:"invalid_type",input:n,...i?{received:"Invalid Date"}:{},inst:e}),r}});function SR(e,t,r){if(e.issues.length)t.issues.push(...kt(r,e.issues));t.value[r]=e.value}var Ki=b("$ZodArray",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let i=[];for(let s=0;s<n.length;s++){let a=n[s],c=t.element._zod.run({value:a,issues:[]},o);if(c instanceof Promise)i.push(c.then((u)=>SR(u,r,s)));else SR(c,r,s)}if(i.length)return Promise.all(i).then(()=>r);return r}});function tp(e,t,r){if(e.issues.length)t.issues.push(...kt(r,e.issues));t.value[r]=e.value}function xR(e,t,r,o){if(e.issues.length)if(o[r]===void 0)if(r in o)t.value[r]=void 0;else t.value[r]=e.value;else t.issues.push(...kt(r,e.issues));else if(e.value===void 0){if(r in o)t.value[r]=void 0}else t.value[r]=e.value}var kc=b("$ZodObject",(e,t)=>{G.init(e,t);let r=hc(()=>{let p=Object.keys(t.shape);for(let m of p)if(!(t.shape[m]instanceof G))throw Error(`Invalid element at key "${m}": expected a Zod schema`);let f=Yy(t.shape);return{shape:t.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(f)}});me(e._zod,"propValues",()=>{let p=t.shape,f={};for(let m in p){let g=p[m]._zod;if(g.values){f[m]??(f[m]=new Set);for(let h of g.values)f[m].add(h)}}return f});let o=(p)=>{let f=new ep(["shape","payload","ctx"]),m=r.value,g=(x)=>{let w=To(x);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};f.write("const input = payload.value;");let h=Object.create(null),y=0;for(let x of m.keys)h[x]=`key_${y++}`;f.write("const newResult = {}");for(let x of m.keys)if(m.optionalKeys.has(x)){let w=h[x];f.write(`const ${w} = ${g(x)};`);let O=To(x);f.write(`
75
+ `))}}var Jb={major:4,minor:0,patch:0};var G=b("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Jb;let o=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))o.unshift(e);for(let n of o)for(let i of n._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(i,s,a)=>{let c=Io(i),u;for(let d of s){if(d._zod.when){if(!d._zod.when(i))continue}else if(c)continue;let p=i.issues.length,f=d._zod.check(i);if(f instanceof Promise&&a?.async===!1)throw new Kr;if(u||f instanceof Promise)u=(u??Promise.resolve()).then(async()=>{if(await f,i.issues.length===p)return;if(!c)c=Io(i,p)});else{if(i.issues.length===p)continue;if(!c)c=Io(i,p)}}if(u)return u.then(()=>{return i});return i};e._zod.run=(i,s)=>{let a=e._zod.parse(i,s);if(a instanceof Promise){if(s.async===!1)throw new Kr;return a.then((c)=>n(c,o,s))}return n(a,o,s)}}e["~standard"]={validate:(n)=>{try{let i=Rn(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch(i){return $n(e,n).then((s)=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),An=b("$ZodString",(e,t)=>{G.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??wb(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),xe=b("$ZodStringFormat",(e,t)=>{Vi.init(e,t),An.init(e,t)}),op=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ub),xe.init(e,t)}),ip=b("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Oo(o))}else t.pattern??(t.pattern=Oo());xe.init(e,t)}),sp=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=db),xe.init(e,t)}),ap=b("$ZodURL",(e,t)=>{xe.init(e,t),e._zod.check=(r)=>{try{let o=r.value,n=new URL(o),i=n.href;if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(n.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:bb.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(!o.endsWith("/")&&i.endsWith("/"))r.value=i.slice(0,-1);else r.value=i;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),cp=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=pb()),xe.init(e,t)}),lp=b("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=cb),xe.init(e,t)}),up=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=nb),xe.init(e,t)}),dp=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ob),xe.init(e,t)}),pp=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ib),xe.init(e,t)}),fp=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=sb),xe.init(e,t)}),mp=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ab),xe.init(e,t)}),Yb=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=xb(t)),xe.init(e,t)}),Qb=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=vb),xe.init(e,t)}),e_=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Sb(t)),xe.init(e,t)}),t_=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=lb),xe.init(e,t)}),gp=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=fb),xe.init(e,t),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.format="ipv4"})}),hp=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=mb),xe.init(e,t),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.format="ipv6"}),e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),yp=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=gb),xe.init(e,t)}),bp=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=hb),xe.init(e,t),e._zod.check=(r)=>{let[o,n]=r.value.split("/");try{if(!n)throw Error();let i=Number(n);if(`${i}`!==n)throw Error();if(i<0||i>128)throw Error();new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function r_(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var _p=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=yb),xe.init(e,t),e._zod.onattach.push((r)=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=(r)=>{if(r_(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function M0(e){if(!Yd.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return r_(r)}var vp=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Yd),xe.init(e,t),e._zod.onattach.push((r)=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=(r)=>{if(M0(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Sp=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=_b),xe.init(e,t)});function N0(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var xp=b("$ZodJWT",(e,t)=>{xe.init(e,t),e._zod.check=(r)=>{if(N0(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),wp=b("$ZodCustomStringFormat",(e,t)=>{xe.init(e,t),e._zod.check=(r)=>{if(t.fn(r.value))return;r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),xc=b("$ZodNumber",(e,t)=>{G.init(e,t),e._zod.pattern=e._zod.bag.pattern??Tb,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let i=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),r}}),kp=b("$ZodNumber",(e,t)=>{Cb.init(e,t),xc.init(e,t)}),Wi=b("$ZodBoolean",(e,t)=>{G.init(e,t),e._zod.pattern=Pb,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let n=r.value;if(typeof n==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),wc=b("$ZodBigInt",(e,t)=>{G.init(e,t),e._zod.pattern=kb,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(n){}if(typeof r.value==="bigint")return r;return r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Ep=b("$ZodBigInt",(e,t)=>{Mb.init(e,t),wc.init(e,t)}),Tp=b("$ZodSymbol",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(typeof n==="symbol")return r;return r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),Pp=b("$ZodUndefined",(e,t)=>{G.init(e,t),e._zod.pattern=Rb,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,o)=>{let n=r.value;if(typeof n>"u")return r;return r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),Ip=b("$ZodNull",(e,t)=>{G.init(e,t),e._zod.pattern=Ib,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;if(n===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Rp=b("$ZodAny",(e,t)=>{G.init(e,t),e._zod.parse=(r)=>r}),Ao=b("$ZodUnknown",(e,t)=>{G.init(e,t),e._zod.parse=(r)=>r}),$p=b("$ZodNever",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{return r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r}}),Op=b("$ZodVoid",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(typeof n>"u")return r;return r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),Ap=b("$ZodDate",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(a){}let n=r.value,i=n instanceof Date;if(i&&!Number.isNaN(n.getTime()))return r;return r.issues.push({expected:"date",code:"invalid_type",input:n,...i?{received:"Invalid Date"}:{},inst:e}),r}});function w0(e,t,r){if(e.issues.length)t.issues.push(...kt(r,e.issues));t.value[r]=e.value}var Ki=b("$ZodArray",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let i=[];for(let s=0;s<n.length;s++){let a=n[s],c=t.element._zod.run({value:a,issues:[]},o);if(c instanceof Promise)i.push(c.then((u)=>w0(u,r,s)));else w0(c,r,s)}if(i.length)return Promise.all(i).then(()=>r);return r}});function rp(e,t,r){if(e.issues.length)t.issues.push(...kt(r,e.issues));t.value[r]=e.value}function k0(e,t,r,o){if(e.issues.length)if(o[r]===void 0)if(r in o)t.value[r]=void 0;else t.value[r]=e.value;else t.issues.push(...kt(r,e.issues));else if(e.value===void 0){if(r in o)t.value[r]=void 0}else t.value[r]=e.value}var kc=b("$ZodObject",(e,t)=>{G.init(e,t);let r=hc(()=>{let p=Object.keys(t.shape);for(let m of p)if(!(t.shape[m]instanceof G))throw Error(`Invalid element at key "${m}": expected a Zod schema`);let f=Qy(t.shape);return{shape:t.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(f)}});me(e._zod,"propValues",()=>{let p=t.shape,f={};for(let m in p){let g=p[m]._zod;if(g.values){f[m]??(f[m]=new Set);for(let h of g.values)f[m].add(h)}}return f});let o=(p)=>{let f=new tp(["shape","payload","ctx"]),m=r.value,g=(x)=>{let w=Po(x);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};f.write("const input = payload.value;");let h=Object.create(null),y=0;for(let x of m.keys)h[x]=`key_${y++}`;f.write("const newResult = {}");for(let x of m.keys)if(m.optionalKeys.has(x)){let w=h[x];f.write(`const ${w} = ${g(x)};`);let O=Po(x);f.write(`
76
76
  if (${w}.issues.length) {
77
77
  if (input[${O}] === undefined) {
78
78
  if (${O} in input) {
@@ -94,26 +94,26 @@ new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
94
94
  `)}else{let w=h[x];f.write(`const ${w} = ${g(x)};`),f.write(`
95
95
  if (${w}.issues.length) payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
96
96
  ...iss,
97
- path: iss.path ? [${To(x)}, ...iss.path] : [${To(x)}]
98
- })));`),f.write(`newResult[${To(x)}] = ${w}.value`)}f.write("payload.value = newResult;"),f.write("return payload;");let v=f.compile();return(x,w)=>v(p,x,w)},n,i=Fi,s=!fc.jitless,c=s&&Jy.value,u=t.catchall,d;e._zod.parse=(p,f)=>{d??(d=r.value);let m=p.value;if(!i(m))return p.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),p;let g=[];if(s&&c&&f?.async===!1&&f.jitless!==!0){if(!n)n=o(t.shape);p=n(p,f)}else{p.value={};let w=d.shape;for(let O of d.keys){let L=w[O],se=L._zod.run({value:m[O],issues:[]},f),Ue=L._zod.optin==="optional"&&L._zod.optout==="optional";if(se instanceof Promise)g.push(se.then((Ye)=>Ue?xR(Ye,p,O,m):tp(Ye,p,O)));else if(Ue)xR(se,p,O,m);else tp(se,p,O)}}if(!u)return g.length?Promise.all(g).then(()=>p):p;let h=[],y=d.keySet,v=u._zod,x=v.def.type;for(let w of Object.keys(m)){if(y.has(w))continue;if(x==="never"){h.push(w);continue}let O=v.run({value:m[w],issues:[]},f);if(O instanceof Promise)g.push(O.then((L)=>tp(L,p,w)));else tp(O,p,w)}if(h.length)p.issues.push({code:"unrecognized_keys",keys:h,input:m,inst:e});if(!g.length)return p;return Promise.all(g).then(()=>{return p})}});function wR(e,t,r,o){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((n)=>n.issues.map((i)=>zt(i,o,He())))}),t}var Tc=b("$ZodUnion",(e,t)=>{G.init(e,t),me(e._zod,"optin",()=>t.options.some((r)=>r._zod.optin==="optional")?"optional":void 0),me(e._zod,"optout",()=>t.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),me(e._zod,"values",()=>{if(t.options.every((r)=>r._zod.values))return new Set(t.options.flatMap((r)=>Array.from(r._zod.values)));return}),me(e._zod,"pattern",()=>{if(t.options.every((r)=>r._zod.pattern)){let r=t.options.map((o)=>o._zod.pattern);return new RegExp(`^(${r.map((o)=>yc(o.source)).join("|")})$`)}return}),e._zod.parse=(r,o)=>{let n=!1,i=[];for(let s of t.options){let a=s._zod.run({value:r.value,issues:[]},o);if(a instanceof Promise)i.push(a),n=!0;else{if(a.issues.length===0)return a;i.push(a)}}if(!n)return wR(i,r,e,o);return Promise.all(i).then((s)=>{return wR(s,r,e,o)})}}),Ap=b("$ZodDiscriminatedUnion",(e,t)=>{Tc.init(e,t);let r=e._zod.parse;me(e._zod,"propValues",()=>{let n={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[a,c]of Object.entries(s)){if(!n[a])n[a]=new Set;for(let u of c)n[a].add(u)}}return n});let o=hc(()=>{let n=t.options,i=new Map;for(let s of n){let a=s._zod.propValues[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let c of a){if(i.has(c))throw Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,s)}}return i});e._zod.parse=(n,i)=>{let s=n.value;if(!Fi(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),n;let a=o.value.get(s?.[t.discriminator]);if(a)return a._zod.run(n,i);if(t.unionFallback)return r(n,i);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:s,path:[t.discriminator],inst:e}),n}}),Cp=b("$ZodIntersection",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),s=t.right._zod.run({value:n,issues:[]},o);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([c,u])=>{return kR(r,c,u)});return kR(r,i,s)}});function Jb(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(Hi(e)&&Hi(t)){let r=Object.keys(t),o=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),n={...e,...t};for(let i of o){let s=Jb(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n[i]=s.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],i=t[o],s=Jb(n,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function kR(e,t,r){if(t.issues.length)e.issues.push(...t.issues);if(r.issues.length)e.issues.push(...r.issues);if(Eo(e))return e;let o=Jb(t.value,r.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var On=b("$ZodTuple",(e,t)=>{G.init(e,t);let r=t.items,o=r.length-[...r].reverse().findIndex((n)=>n._zod.optin!=="optional");e._zod.parse=(n,i)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[];if(!t.rest){let u=s.length>r.length,d=s.length<o-1;if(u||d)return n.issues.push({input:s,inst:e,origin:"array",...u?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length}}),n}let c=-1;for(let u of r){if(c++,c>=s.length){if(c>=o)continue}let d=u._zod.run({value:s[c],issues:[]},i);if(d instanceof Promise)a.push(d.then((p)=>rp(p,n,c)));else rp(d,n,c)}if(t.rest){let u=s.slice(r.length);for(let d of u){c++;let p=t.rest._zod.run({value:d,issues:[]},i);if(p instanceof Promise)a.push(p.then((f)=>rp(f,n,c)));else rp(p,n,c)}}if(a.length)return Promise.all(a).then(()=>n);return n}});function rp(e,t,r){if(e.issues.length)t.issues.push(...kt(r,e.issues));t.value[r]=e.value}var Mp=b("$ZodRecord",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Hi(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let i=[];if(t.keyType._zod.values){let s=t.keyType._zod.values;r.value={};for(let c of s)if(typeof c==="string"||typeof c==="number"||typeof c==="symbol"){let u=t.valueType._zod.run({value:n[c],issues:[]},o);if(u instanceof Promise)i.push(u.then((d)=>{if(d.issues.length)r.issues.push(...kt(c,d.issues));r.value[c]=d.value}));else{if(u.issues.length)r.issues.push(...kt(c,u.issues));r.value[c]=u.value}}let a;for(let c in n)if(!s.has(c))a=a??[],a.push(c);if(a&&a.length>0)r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:a})}else{r.value={};for(let s of Reflect.ownKeys(n)){if(s==="__proto__")continue;let a=t.keyType._zod.run({value:s,issues:[]},o);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map((u)=>zt(u,o,He())),input:s,path:[s],inst:e}),r.value[a.value]=a.value;continue}let c=t.valueType._zod.run({value:n[s],issues:[]},o);if(c instanceof Promise)i.push(c.then((u)=>{if(u.issues.length)r.issues.push(...kt(s,u.issues));r.value[a.value]=u.value}));else{if(c.issues.length)r.issues.push(...kt(s,c.issues));r.value[a.value]=c.value}}}if(i.length)return Promise.all(i).then(()=>r);return r}}),Np=b("$ZodMap",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:e}),r;let i=[];r.value=new Map;for(let[s,a]of n){let c=t.keyType._zod.run({value:s,issues:[]},o),u=t.valueType._zod.run({value:a,issues:[]},o);if(c instanceof Promise||u instanceof Promise)i.push(Promise.all([c,u]).then(([d,p])=>{TR(d,p,r,s,n,e,o)}));else TR(c,u,r,s,n,e,o)}if(i.length)return Promise.all(i).then(()=>r);return r}});function TR(e,t,r,o,n,i,s){if(e.issues.length)if(bc.has(typeof o))r.issues.push(...kt(o,e.issues));else r.issues.push({origin:"map",code:"invalid_key",input:n,inst:i,issues:e.issues.map((a)=>zt(a,s,He()))});if(t.issues.length)if(bc.has(typeof o))r.issues.push(...kt(o,t.issues));else r.issues.push({origin:"map",code:"invalid_element",input:n,inst:i,key:o,issues:t.issues.map((a)=>zt(a,s,He()))});r.value.set(e.value,t.value)}var Dp=b("$ZodSet",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let s of n){let a=t.valueType._zod.run({value:s,issues:[]},o);if(a instanceof Promise)i.push(a.then((c)=>ER(c,r)));else ER(a,r)}if(i.length)return Promise.all(i).then(()=>r);return r}});function ER(e,t){if(e.issues.length)t.issues.push(...e.issues);t.value.add(e.value)}var jp=b("$ZodEnum",(e,t)=>{G.init(e,t);let r=gc(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter((o)=>bc.has(typeof o)).map((o)=>typeof o==="string"?Gr(o):o.toString()).join("|")})$`),e._zod.parse=(o,n)=>{let i=o.value;if(e._zod.values.has(i))return o;return o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),zp=b("$ZodLiteral",(e,t)=>{G.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map((r)=>typeof r==="string"?Gr(r):r?r.toString():String(r)).join("|")})$`),e._zod.parse=(r,o)=>{let n=r.value;if(e._zod.values.has(n))return r;return r.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),r}}),Up=b("$ZodFile",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(n instanceof File)return r;return r.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),r}}),Gi=b("$ZodTransform",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((s)=>{return r.value=s,r});if(n instanceof Promise)throw new Kr;return r.value=n,r}}),Lp=b("$ZodOptional",(e,t)=>{G.init(e,t),e._zod.optin="optional",e._zod.optout="optional",me(e._zod,"values",()=>{return t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0}),me(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${yc(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional")return t.innerType._zod.run(r,o);if(r.value===void 0)return r;return t.innerType._zod.run(r,o)}}),Fp=b("$ZodNullable",(e,t)=>{G.init(e,t),me(e._zod,"optin",()=>t.innerType._zod.optin),me(e._zod,"optout",()=>t.innerType._zod.optout),me(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${yc(r.source)}|null)$`):void 0}),me(e._zod,"values",()=>{return t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0}),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),Hp=b("$ZodDefault",(e,t)=>{G.init(e,t),e._zod.optin="optional",me(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>PR(i,t));return PR(n,t)}});function PR(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Bp=b("$ZodPrefault",(e,t)=>{G.init(e,t),e._zod.optin="optional",me(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),qp=b("$ZodNonOptional",(e,t)=>{G.init(e,t),me(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>IR(i,e));return IR(n,e)}});function IR(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 Zp=b("$ZodSuccess",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>{return r.value=i.issues.length===0,r});return r.value=n.issues.length===0,r}}),Vp=b("$ZodCatch",(e,t)=>{G.init(e,t),e._zod.optin="optional",me(e._zod,"optout",()=>t.innerType._zod.optout),me(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>{if(r.value=i.value,i.issues.length)r.value=t.catchValue({...r,error:{issues:i.issues.map((s)=>zt(s,o,He()))},input:r.value}),r.issues=[];return r});if(r.value=n.value,n.issues.length)r.value=t.catchValue({...r,error:{issues:n.issues.map((i)=>zt(i,o,He()))},input:r.value}),r.issues=[];return r}}),Wp=b("$ZodNaN",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{if(typeof r.value!=="number"||!Number.isNaN(r.value))return r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r;return r}}),Ji=b("$ZodPipe",(e,t)=>{G.init(e,t),me(e._zod,"values",()=>t.in._zod.values),me(e._zod,"optin",()=>t.in._zod.optin),me(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(r,o)=>{let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>RR(i,t,o));return RR(n,t,o)}});function RR(e,t,r){if(Eo(e))return e;return t.out._zod.run({value:e.value,issues:e.issues},r)}var Kp=b("$ZodReadonly",(e,t)=>{G.init(e,t),me(e._zod,"propValues",()=>t.innerType._zod.propValues),me(e._zod,"values",()=>t.innerType._zod.values),me(e._zod,"optin",()=>t.innerType._zod.optin),me(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then($R);return $R(n)}});function $R(e){return e.value=Object.freeze(e.value),e}var Gp=b("$ZodTemplateLiteral",(e,t)=>{G.init(e,t);let r=[];for(let o of t.parts)if(o instanceof G){if(!o._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);let n=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!n)throw Error(`Invalid template literal part: ${o._zod.traits}`);let i=n.startsWith("^")?1:0,s=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(i,s))}else if(o===null||Xy.has(typeof o))r.push(Gr(`${o}`));else throw Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(o,n)=>{if(typeof o.value!=="string")return o.issues.push({input:o.value,inst:e,expected:"template_literal",code:"invalid_type"}),o;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(o.value))return o.issues.push({input:o.value,inst:e,code:"invalid_format",format:"template_literal",pattern:e._zod.pattern.source}),o;return o}}),Jp=b("$ZodPromise",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{return Promise.resolve(r.value).then((n)=>t.innerType._zod.run({value:n,issues:[]},o))}}),Xp=b("$ZodLazy",(e,t)=>{G.init(e,t),me(e._zod,"innerType",()=>t.getter()),me(e._zod,"pattern",()=>e._zod.innerType._zod.pattern),me(e._zod,"propValues",()=>e._zod.innerType._zod.propValues),me(e._zod,"optin",()=>e._zod.innerType._zod.optin),me(e._zod,"optout",()=>e._zod.innerType._zod.optout),e._zod.parse=(r,o)=>{return e._zod.innerType._zod.run(r,o)}}),Yp=b("$ZodCustom",(e,t)=>{Me.init(e,t),G.init(e,t),e._zod.parse=(r,o)=>{return r},e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((i)=>OR(i,r,o,e));OR(n,r,o,e);return}});function OR(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(tb(n))}}var Xi={};xr(Xi,{zhTW:()=>U_,zhCN:()=>z_,vi:()=>j_,ur:()=>D_,ua:()=>N_,tr:()=>M_,th:()=>C_,ta:()=>A_,sv:()=>O_,sl:()=>$_,ru:()=>R_,pt:()=>I_,ps:()=>E_,pl:()=>P_,ota:()=>T_,no:()=>k_,nl:()=>w_,ms:()=>x_,mk:()=>S_,ko:()=>v_,kh:()=>__,ja:()=>b_,it:()=>y_,id:()=>h_,hu:()=>g_,he:()=>m_,frCA:()=>f_,fr:()=>p_,fi:()=>d_,fa:()=>u_,es:()=>l_,eo:()=>c_,en:()=>Ec,de:()=>a_,cs:()=>s_,ca:()=>i_,be:()=>o_,az:()=>n_,ar:()=>r_});var IZ=()=>{let e={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return(n)=>{switch(n.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${n.expected}، ولكن تم إدخال ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${N(n.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return` أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${i} ${n.maximum.toString()} ${s.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${i} ${n.minimum.toString()} ${s.unit}`;return`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${n.prefix}"`;if(i.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${i.suffix}"`;if(i.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${i.includes}"`;if(i.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${i.pattern}`;return`${o[i.format]??n.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${n.divisor}`;case"unrecognized_keys":return`معرف${n.keys.length>1?"ات":""} غريب${n.keys.length>1?"ة":""}: ${E(n.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${n.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${n.origin}`;default:return"مدخل غير مقبول"}}};function r_(){return{localeError:IZ()}}var RZ=()=>{let e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={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(n)=>{switch(n.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${n.expected}, daxil olan ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Yanlış dəyər: gözlənilən ${N(n.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${i}${n.maximum.toString()} ${s.unit??"element"}`;return`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Çox kiçik: gözlənilən ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`;return`Çox kiçik: gözlənilən ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Yanlış mətn: "${i.prefix}" ilə başlamalıdır`;if(i.format==="ends_with")return`Yanlış mətn: "${i.suffix}" ilə bitməlidir`;if(i.format==="includes")return`Yanlış mətn: "${i.includes}" daxil olmalıdır`;if(i.format==="regex")return`Yanlış mətn: ${i.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${o[i.format]??n.format}`}case"not_multiple_of":return`Yanlış ədəd: ${n.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${n.keys.length>1?"lar":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${n.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function n_(){return{localeError:RZ()}}function NR(e,t,r,o){let n=Math.abs(e),i=n%10,s=n%100;if(s>=11&&s<=19)return o;if(i===1)return t;if(i>=2&&i<=4)return r;return o}var $Z=()=>{let e={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"лік";case"object":{if(Array.isArray(n))return"масіў";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return(n)=>{switch(n.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${n.expected}, атрымана ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Няправільны ўвод: чакалася ${N(n.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),c=NR(a,s.unit.one,s.unit.few,s.unit.many);return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна ${s.verb} ${i}${n.maximum.toString()} ${c}`}return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна быць ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),c=NR(a,s.unit.one,s.unit.few,s.unit.many);return`Занадта малы: чакалася, што ${n.origin} павінна ${s.verb} ${i}${n.minimum.toString()} ${c}`}return`Занадта малы: чакалася, што ${n.origin} павінна быць ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${i.prefix}"`;if(i.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${i.suffix}"`;if(i.format==="includes")return`Няправільны радок: павінен змяшчаць "${i.includes}"`;if(i.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${i.pattern}`;return`Няправільны ${o[i.format]??n.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${n.keys.length>1?"ключы":"ключ"}: ${E(n.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${n.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${n.origin}`;default:return"Няправільны ўвод"}}};function o_(){return{localeError:$Z()}}var OZ=()=>{let e={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"entrada",email:"adreça electrònica",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:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(n)=>{switch(n.code){case"invalid_type":return`Tipus invàlid: s'esperava ${n.expected}, s'ha rebut ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Valor invàlid: s'esperava ${N(n.values[0])}`;return`Opció invàlida: s'esperava una de ${E(n.values," o ")}`;case"too_big":{let i=n.inclusive?"com a màxim":"menys de",s=t(n.origin);if(s)return`Massa gran: s'esperava que ${n.origin??"el valor"} contingués ${i} ${n.maximum.toString()} ${s.unit??"elements"}`;return`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"com a mínim":"més de",s=t(n.origin);if(s)return`Massa petit: s'esperava que ${n.origin} contingués ${i} ${n.minimum.toString()} ${s.unit}`;return`Massa petit: s'esperava que ${n.origin} fos ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Format invàlid: ha de començar amb "${i.prefix}"`;if(i.format==="ends_with")return`Format invàlid: ha d'acabar amb "${i.suffix}"`;if(i.format==="includes")return`Format invàlid: ha d'incloure "${i.includes}"`;if(i.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${i.pattern}`;return`Format invàlid per a ${o[i.format]??n.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${n.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${n.origin}`;default:return"Entrada invàlida"}}};function i_(){return{localeError:OZ()}}var AZ=()=>{let e={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(n))return"pole";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"regulární výraz",email:"e-mailová adresa",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:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return(n)=>{switch(n.code){case"invalid_type":return`Neplatný vstup: očekáváno ${n.expected}, obdrženo ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Neplatný vstup: očekáváno ${N(n.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Hodnota je příliš velká: ${n.origin??"hodnota"} musí mít ${i}${n.maximum.toString()} ${s.unit??"prvků"}`;return`Hodnota je příliš velká: ${n.origin??"hodnota"} musí být ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Hodnota je příliš malá: ${n.origin??"hodnota"} musí mít ${i}${n.minimum.toString()} ${s.unit??"prvků"}`;return`Hodnota je příliš malá: ${n.origin??"hodnota"} musí být ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Neplatný řetězec: musí začínat na "${i.prefix}"`;if(i.format==="ends_with")return`Neplatný řetězec: musí končit na "${i.suffix}"`;if(i.format==="includes")return`Neplatný řetězec: musí obsahovat "${i.includes}"`;if(i.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${i.pattern}`;return`Neplatný formát ${o[i.format]??n.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${n.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${E(n.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${n.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${n.origin}`;default:return"Neplatný vstup"}}};function s_(){return{localeError:AZ()}}var CZ=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"Zahl";case"object":{if(Array.isArray(n))return"Array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"Eingabe",email:"E-Mail-Adresse",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-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return(n)=>{switch(n.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${n.expected}, erhalten ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Ungültige Eingabe: erwartet ${N(n.values[0])}`;return`Ungültige Option: erwartet eine von ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Zu groß: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ${s.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ist`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ${s.unit} hat`;return`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ist`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ungültiger String: muss mit "${i.prefix}" beginnen`;if(i.format==="ends_with")return`Ungültiger String: muss mit "${i.suffix}" enden`;if(i.format==="includes")return`Ungültiger String: muss "${i.includes}" enthalten`;if(i.format==="regex")return`Ungültiger String: muss dem Muster ${i.pattern} entsprechen`;return`Ungültig: ${o[i.format]??n.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${E(n.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${n.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${n.origin}`;default:return"Ungültige Eingabe"}}};function a_(){return{localeError:CZ()}}var MZ=(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},NZ=()=>{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(o){return e[o]??null}let r={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(o)=>{switch(o.code){case"invalid_type":return`Invalid input: expected ${o.expected}, received ${MZ(o.input)}`;case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${N(o.values[0])}`;return`Invalid option: expected one of ${E(o.values,"|")}`;case"too_big":{let n=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Too big: expected ${o.origin??"value"} to have ${n}${o.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${n}${o.maximum.toString()}`}case"too_small":{let n=o.inclusive?">=":">",i=t(o.origin);if(i)return`Too small: expected ${o.origin} to have ${n}${o.minimum.toString()} ${i.unit}`;return`Too small: expected ${o.origin} to be ${n}${o.minimum.toString()}`}case"invalid_format":{let n=o;if(n.format==="starts_with")return`Invalid string: must start with "${n.prefix}"`;if(n.format==="ends_with")return`Invalid string: must end with "${n.suffix}"`;if(n.format==="includes")return`Invalid string: must include "${n.includes}"`;if(n.format==="regex")return`Invalid string: must match pattern ${n.pattern}`;return`Invalid ${r[n.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Ec(){return{localeError:NZ()}}var DZ=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"nombro";case"object":{if(Array.isArray(e))return"tabelo";if(e===null)return"senvalora";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},jZ=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(o){return e[o]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return(o)=>{switch(o.code){case"invalid_type":return`Nevalida enigo: atendiĝis ${o.expected}, riceviĝis ${DZ(o.input)}`;case"invalid_value":if(o.values.length===1)return`Nevalida enigo: atendiĝis ${N(o.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${E(o.values,"|")}`;case"too_big":{let n=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${n}${o.maximum.toString()} ${i.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${n}${o.maximum.toString()}`}case"too_small":{let n=o.inclusive?">=":">",i=t(o.origin);if(i)return`Tro malgranda: atendiĝis ke ${o.origin} havu ${n}${o.minimum.toString()} ${i.unit}`;return`Tro malgranda: atendiĝis ke ${o.origin} estu ${n}${o.minimum.toString()}`}case"invalid_format":{let n=o;if(n.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${n.prefix}"`;if(n.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${n.suffix}"`;if(n.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${n.includes}"`;if(n.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${n.pattern}`;return`Nevalida ${r[n.format]??o.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${o.divisor}`;case"unrecognized_keys":return`Nekonata${o.keys.length>1?"j":""} ŝlosilo${o.keys.length>1?"j":""}: ${E(o.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${o.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${o.origin}`;default:return"Nevalida enigo"}}};function c_(){return{localeError:jZ()}}var zZ=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"número";case"object":{if(Array.isArray(n))return"arreglo";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype)return n.constructor.name}}return i},o={regex:"entrada",email:"dirección de correo electrónico",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:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(n)=>{switch(n.code){case"invalid_type":return`Entrada inválida: se esperaba ${n.expected}, recibido ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Entrada inválida: se esperaba ${N(n.values[0])}`;return`Opción inválida: se esperaba una de ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Demasiado grande: se esperaba que ${n.origin??"valor"} tuviera ${i}${n.maximum.toString()} ${s.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${n.origin??"valor"} fuera ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Demasiado pequeño: se esperaba que ${n.origin} tuviera ${i}${n.minimum.toString()} ${s.unit}`;return`Demasiado pequeño: se esperaba que ${n.origin} fuera ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Cadena inválida: debe comenzar con "${i.prefix}"`;if(i.format==="ends_with")return`Cadena inválida: debe terminar en "${i.suffix}"`;if(i.format==="includes")return`Cadena inválida: debe incluir "${i.includes}"`;if(i.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${i.pattern}`;return`Inválido ${o[i.format]??n.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Llave inválida en ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${n.origin}`;default:return"Entrada inválida"}}};function l_(){return{localeError:zZ()}}var UZ=()=>{let e={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"آرایه";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return(n)=>{switch(n.code){case"invalid_type":return`ورودی نامعتبر: می‌بایست ${n.expected} می‌بود، ${r(n.input)} دریافت شد`;case"invalid_value":if(n.values.length===1)return`ورودی نامعتبر: می‌بایست ${N(n.values[0])} می‌بود`;return`گزینه نامعتبر: می‌بایست یکی از ${E(n.values,"|")} می‌بود`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`خیلی بزرگ: ${n.origin??"مقدار"} باید ${i}${n.maximum.toString()} ${s.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${n.origin??"مقدار"} باید ${i}${n.maximum.toString()} باشد`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`خیلی کوچک: ${n.origin} باید ${i}${n.minimum.toString()} ${s.unit} باشد`;return`خیلی کوچک: ${n.origin} باید ${i}${n.minimum.toString()} باشد`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`رشته نامعتبر: باید با "${i.prefix}" شروع شود`;if(i.format==="ends_with")return`رشته نامعتبر: باید با "${i.suffix}" تمام شود`;if(i.format==="includes")return`رشته نامعتبر: باید شامل "${i.includes}" باشد`;if(i.format==="regex")return`رشته نامعتبر: باید با الگوی ${i.pattern} مطابقت داشته باشد`;return`${o[i.format]??n.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${n.divisor} باشد`;case"unrecognized_keys":return`کلید${n.keys.length>1?"های":""} ناشناس: ${E(n.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${n.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${n.origin}`;default:return"ورودی نامعتبر"}}};function u_(){return{localeError:UZ()}}var LZ=()=>{let e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return(n)=>{switch(n.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${n.expected}, oli ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Virheellinen syöte: täytyy olla ${N(n.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Liian suuri: ${s.subject} täytyy olla ${i}${n.maximum.toString()} ${s.unit}`.trim();return`Liian suuri: arvon täytyy olla ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Liian pieni: ${s.subject} täytyy olla ${i}${n.minimum.toString()} ${s.unit}`.trim();return`Liian pieni: arvon täytyy olla ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${i.prefix}"`;if(i.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${i.suffix}"`;if(i.format==="includes")return`Virheellinen syöte: täytyy sisältää "${i.includes}"`;if(i.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${i.pattern}`;return`Virheellinen ${o[i.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${E(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function d_(){return{localeError:LZ()}}var FZ=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"nombre";case"object":{if(Array.isArray(n))return"tableau";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"entrée",email:"adresse e-mail",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:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(n)=>{switch(n.code){case"invalid_type":return`Entrée invalide : ${n.expected} attendu, ${r(n.input)} reçu`;case"invalid_value":if(n.values.length===1)return`Entrée invalide : ${N(n.values[0])} attendu`;return`Option invalide : une valeur parmi ${E(n.values,"|")} attendue`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Trop grand : ${n.origin??"valeur"} doit ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"élément(s)"}`;return`Trop grand : ${n.origin??"valeur"} doit être ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Trop petit : ${n.origin} doit ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Trop petit : ${n.origin} doit être ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Chaîne invalide : doit commencer par "${i.prefix}"`;if(i.format==="ends_with")return`Chaîne invalide : doit se terminer par "${i.suffix}"`;if(i.format==="includes")return`Chaîne invalide : doit inclure "${i.includes}"`;if(i.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${i.pattern}`;return`${o[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${E(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function p_(){return{localeError:FZ()}}var HZ=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"entrée",email:"adresse courriel",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:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(n)=>{switch(n.code){case"invalid_type":return`Entrée invalide : attendu ${n.expected}, reçu ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Entrée invalide : attendu ${N(n.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"≤":"<",s=t(n.origin);if(s)return`Trop grand : attendu que ${n.origin??"la valeur"} ait ${i}${n.maximum.toString()} ${s.unit}`;return`Trop grand : attendu que ${n.origin??"la valeur"} soit ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"≥":">",s=t(n.origin);if(s)return`Trop petit : attendu que ${n.origin} ait ${i}${n.minimum.toString()} ${s.unit}`;return`Trop petit : attendu que ${n.origin} soit ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Chaîne invalide : doit commencer par "${i.prefix}"`;if(i.format==="ends_with")return`Chaîne invalide : doit se terminer par "${i.suffix}"`;if(i.format==="includes")return`Chaîne invalide : doit inclure "${i.includes}"`;if(i.format==="regex")return`Chaîne invalide : doit correspondre au motif ${i.pattern}`;return`${o[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${E(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function f_(){return{localeError:HZ()}}var BZ=()=>{let e={string:{unit:"אותיות",verb:"לכלול"},file:{unit:"בייטים",verb:"לכלול"},array:{unit:"פריטים",verb:"לכלול"},set:{unit:"פריטים",verb:"לכלול"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"קלט",email:"כתובת אימייל",url:"כתובת רשת",emoji:"אימוג'י",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"תאריך וזמן ISO",date:"תאריך ISO",time:"זמן ISO",duration:"משך זמן ISO",ipv4:"כתובת IPv4",ipv6:"כתובת IPv6",cidrv4:"טווח IPv4",cidrv6:"טווח IPv6",base64:"מחרוזת בבסיס 64",base64url:"מחרוזת בבסיס 64 לכתובות רשת",json_string:"מחרוזת JSON",e164:"מספר E.164",jwt:"JWT",template_literal:"קלט"};return(n)=>{switch(n.code){case"invalid_type":return`קלט לא תקין: צריך ${n.expected}, התקבל ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`קלט לא תקין: צריך ${N(n.values[0])}`;return`קלט לא תקין: צריך אחת מהאפשרויות ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`גדול מדי: ${n.origin??"value"} צריך להיות ${i}${n.maximum.toString()} ${s.unit??"elements"}`;return`גדול מדי: ${n.origin??"value"} צריך להיות ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`קטן מדי: ${n.origin} צריך להיות ${i}${n.minimum.toString()} ${s.unit}`;return`קטן מדי: ${n.origin} צריך להיות ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`מחרוזת לא תקינה: חייבת להתחיל ב"${i.prefix}"`;if(i.format==="ends_with")return`מחרוזת לא תקינה: חייבת להסתיים ב "${i.suffix}"`;if(i.format==="includes")return`מחרוזת לא תקינה: חייבת לכלול "${i.includes}"`;if(i.format==="regex")return`מחרוזת לא תקינה: חייבת להתאים לתבנית ${i.pattern}`;return`${o[i.format]??n.format} לא תקין`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${n.divisor}`;case"unrecognized_keys":return`מפתח${n.keys.length>1?"ות":""} לא מזוה${n.keys.length>1?"ים":"ה"}: ${E(n.keys,", ")}`;case"invalid_key":return`מפתח לא תקין ב${n.origin}`;case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${n.origin}`;default:return"קלט לא תקין"}}};function m_(){return{localeError:BZ()}}var qZ=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"szám";case"object":{if(Array.isArray(n))return"tömb";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"bemenet",email:"email cím",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 időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return(n)=>{switch(n.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${n.expected}, a kapott érték ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Érvénytelen bemenet: a várt érték ${N(n.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Túl nagy: ${n.origin??"érték"} mérete túl nagy ${i}${n.maximum.toString()} ${s.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${n.origin??"érték"} túl nagy: ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Túl kicsi: a bemeneti érték ${n.origin} mérete túl kicsi ${i}${n.minimum.toString()} ${s.unit}`;return`Túl kicsi: a bemeneti érték ${n.origin} túl kicsi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Érvénytelen string: "${i.prefix}" értékkel kell kezdődnie`;if(i.format==="ends_with")return`Érvénytelen string: "${i.suffix}" értékkel kell végződnie`;if(i.format==="includes")return`Érvénytelen string: "${i.includes}" értéket kell tartalmaznia`;if(i.format==="regex")return`Érvénytelen string: ${i.pattern} mintának kell megfelelnie`;return`Érvénytelen ${o[i.format]??n.format}`}case"not_multiple_of":return`Érvénytelen szám: ${n.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${n.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${n.origin}`;default:return"Érvénytelen bemenet"}}};function g_(){return{localeError:qZ()}}var ZZ=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"alamat email",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:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`Input tidak valid: diharapkan ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Input tidak valid: diharapkan ${N(n.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${i}${n.maximum.toString()} ${s.unit??"elemen"}`;return`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Terlalu kecil: diharapkan ${n.origin} memiliki ${i}${n.minimum.toString()} ${s.unit}`;return`Terlalu kecil: diharapkan ${n.origin} menjadi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`String tidak valid: harus dimulai dengan "${i.prefix}"`;if(i.format==="ends_with")return`String tidak valid: harus berakhir dengan "${i.suffix}"`;if(i.format==="includes")return`String tidak valid: harus menyertakan "${i.includes}"`;if(i.format==="regex")return`String tidak valid: harus sesuai pola ${i.pattern}`;return`${o[i.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};function h_(){return{localeError:ZZ()}}var VZ=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"numero";case"object":{if(Array.isArray(n))return"vettore";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"indirizzo email",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:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`Input non valido: atteso ${n.expected}, ricevuto ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Input non valido: atteso ${N(n.values[0])}`;return`Opzione non valida: atteso uno tra ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Troppo grande: ${n.origin??"valore"} deve avere ${i}${n.maximum.toString()} ${s.unit??"elementi"}`;return`Troppo grande: ${n.origin??"valore"} deve essere ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Troppo piccolo: ${n.origin} deve avere ${i}${n.minimum.toString()} ${s.unit}`;return`Troppo piccolo: ${n.origin} deve essere ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Stringa non valida: deve iniziare con "${i.prefix}"`;if(i.format==="ends_with")return`Stringa non valida: deve terminare con "${i.suffix}"`;if(i.format==="includes")return`Stringa non valida: deve includere "${i.includes}"`;if(i.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${i.pattern}`;return`Invalid ${o[i.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${E(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};function y_(){return{localeError:VZ()}}var WZ=()=>{let e={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"数値";case"object":{if(Array.isArray(n))return"配列";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return(n)=>{switch(n.code){case"invalid_type":return`無効な入力: ${n.expected}が期待されましたが、${r(n.input)}が入力されました`;case"invalid_value":if(n.values.length===1)return`無効な入力: ${N(n.values[0])}が期待されました`;return`無効な選択: ${E(n.values,"、")}のいずれかである必要があります`;case"too_big":{let i=n.inclusive?"以下である":"より小さい",s=t(n.origin);if(s)return`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${s.unit??"要素"}${i}必要があります`;return`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${i}必要があります`}case"too_small":{let i=n.inclusive?"以上である":"より大きい",s=t(n.origin);if(s)return`小さすぎる値: ${n.origin}は${n.minimum.toString()}${s.unit}${i}必要があります`;return`小さすぎる値: ${n.origin}は${n.minimum.toString()}${i}必要があります`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`無効な文字列: "${i.prefix}"で始まる必要があります`;if(i.format==="ends_with")return`無効な文字列: "${i.suffix}"で終わる必要があります`;if(i.format==="includes")return`無効な文字列: "${i.includes}"を含む必要があります`;if(i.format==="regex")return`無効な文字列: パターン${i.pattern}に一致する必要があります`;return`無効な${o[i.format]??n.format}`}case"not_multiple_of":return`無効な数値: ${n.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${n.keys.length>1?"群":""}: ${E(n.keys,"、")}`;case"invalid_key":return`${n.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${n.origin}内の無効な値`;default:return"無効な入力"}}};function b_(){return{localeError:WZ()}}var KZ=()=>{let e={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(n))return"អារេ (Array)";if(n===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return(n)=>{switch(n.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${n.expected} ប៉ុន្តែទទួលបាន ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${N(n.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${i} ${n.maximum.toString()} ${s.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`តូចពេក៖ ត្រូវការ ${n.origin} ${i} ${n.minimum.toString()} ${s.unit}`;return`តូចពេក៖ ត្រូវការ ${n.origin} ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${i.prefix}"`;if(i.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${i.suffix}"`;if(i.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${i.includes}"`;if(i.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${i.pattern}`;return`មិនត្រឹមត្រូវ៖ ${o[i.format]??n.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${n.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${E(n.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function __(){return{localeError:KZ()}}var GZ=()=>{let e={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return(n)=>{switch(n.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${n.expected}, 받은 타입은 ${r(n.input)}입니다`;case"invalid_value":if(n.values.length===1)return`잘못된 입력: 값은 ${N(n.values[0])} 이어야 합니다`;return`잘못된 옵션: ${E(n.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let i=n.inclusive?"이하":"미만",s=i==="미만"?"이어야 합니다":"여야 합니다",a=t(n.origin),c=a?.unit??"요소";if(a)return`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()}${c} ${i}${s}`;return`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()} ${i}${s}`}case"too_small":{let i=n.inclusive?"이상":"초과",s=i==="이상"?"이어야 합니다":"여야 합니다",a=t(n.origin),c=a?.unit??"요소";if(a)return`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()}${c} ${i}${s}`;return`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()} ${i}${s}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`잘못된 문자열: "${i.prefix}"(으)로 시작해야 합니다`;if(i.format==="ends_with")return`잘못된 문자열: "${i.suffix}"(으)로 끝나야 합니다`;if(i.format==="includes")return`잘못된 문자열: "${i.includes}"을(를) 포함해야 합니다`;if(i.format==="regex")return`잘못된 문자열: 정규식 ${i.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${o[i.format]??n.format}`}case"not_multiple_of":return`잘못된 숫자: ${n.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${E(n.keys,", ")}`;case"invalid_key":return`잘못된 키: ${n.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${n.origin}`;default:return"잘못된 입력"}}};function v_(){return{localeError:GZ()}}var JZ=()=>{let e={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"број";case"object":{if(Array.isArray(n))return"низа";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return(n)=>{switch(n.code){case"invalid_type":return`Грешен внес: се очекува ${n.expected}, примено ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${N(n.values[0])}`;return`Грешана опција: се очекува една ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Премногу голем: се очекува ${n.origin??"вредноста"} да има ${i}${n.maximum.toString()} ${s.unit??"елементи"}`;return`Премногу голем: се очекува ${n.origin??"вредноста"} да биде ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Премногу мал: се очекува ${n.origin} да има ${i}${n.minimum.toString()} ${s.unit}`;return`Премногу мал: се очекува ${n.origin} да биде ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Неважечка низа: мора да започнува со "${i.prefix}"`;if(i.format==="ends_with")return`Неважечка низа: мора да завршува со "${i.suffix}"`;if(i.format==="includes")return`Неважечка низа: мора да вклучува "${i.includes}"`;if(i.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${i.pattern}`;return`Invalid ${o[i.format]??n.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${E(n.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${n.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${n.origin}`;default:return"Грешен внес"}}};function S_(){return{localeError:JZ()}}var XZ=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"nombor";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"alamat e-mel",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:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`Input tidak sah: dijangka ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Input tidak sah: dijangka ${N(n.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Terlalu besar: dijangka ${n.origin??"nilai"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"elemen"}`;return`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Terlalu kecil: dijangka ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Terlalu kecil: dijangka ${n.origin} adalah ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`String tidak sah: mesti bermula dengan "${i.prefix}"`;if(i.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${i.suffix}"`;if(i.format==="includes")return`String tidak sah: mesti mengandungi "${i.includes}"`;if(i.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${i.pattern}`;return`${o[i.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${E(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};function x_(){return{localeError:XZ()}}var YZ=()=>{let e={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"getal";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"invoer",email:"emailadres",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 datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return(n)=>{switch(n.code){case"invalid_type":return`Ongeldige invoer: verwacht ${n.expected}, ontving ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Ongeldige invoer: verwacht ${N(n.values[0])}`;return`Ongeldige optie: verwacht één van ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Te lang: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} ${s.unit??"elementen"} bevat`;return`Te lang: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} is`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Te kort: verwacht dat ${n.origin} ${i}${n.minimum.toString()} ${s.unit} bevat`;return`Te kort: verwacht dat ${n.origin} ${i}${n.minimum.toString()} is`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ongeldige tekst: moet met "${i.prefix}" beginnen`;if(i.format==="ends_with")return`Ongeldige tekst: moet op "${i.suffix}" eindigen`;if(i.format==="includes")return`Ongeldige tekst: moet "${i.includes}" bevatten`;if(i.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`;return`Ongeldig: ${o[i.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};function w_(){return{localeError:YZ()}}var QZ=()=>{let e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"tall";case"object":{if(Array.isArray(n))return"liste";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"e-postadresse",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 dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`Ugyldig input: forventet ${n.expected}, fikk ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Ugyldig verdi: forventet ${N(n.values[0])}`;return`Ugyldig valg: forventet en av ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`For stor(t): forventet ${n.origin??"value"} til å ha ${i}${n.maximum.toString()} ${s.unit??"elementer"}`;return`For stor(t): forventet ${n.origin??"value"} til å ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`For lite(n): forventet ${n.origin} til å ha ${i}${n.minimum.toString()} ${s.unit}`;return`For lite(n): forventet ${n.origin} til å ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ugyldig streng: må starte med "${i.prefix}"`;if(i.format==="ends_with")return`Ugyldig streng: må ende med "${i.suffix}"`;if(i.format==="includes")return`Ugyldig streng: må inneholde "${i.includes}"`;if(i.format==="regex")return`Ugyldig streng: må matche mønsteret ${i.pattern}`;return`Ugyldig ${o[i.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${E(n.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function k_(){return{localeError:QZ()}}var eV=()=>{let e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"numara";case"object":{if(Array.isArray(n))return"saf";if(n===null)return"gayb";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"giren",email:"epostagâh",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 hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return(n)=>{switch(n.code){case"invalid_type":return`Fâsit giren: umulan ${n.expected}, alınan ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Fâsit giren: umulan ${N(n.values[0])}`;return`Fâsit tercih: mûteberler ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Fazla büyük: ${n.origin??"value"}, ${i}${n.maximum.toString()} ${s.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${n.origin??"value"}, ${i}${n.maximum.toString()} olmalıydı.`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Fazla küçük: ${n.origin}, ${i}${n.minimum.toString()} ${s.unit} sahip olmalıydı.`;return`Fazla küçük: ${n.origin}, ${i}${n.minimum.toString()} olmalıydı.`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Fâsit metin: "${i.prefix}" ile başlamalı.`;if(i.format==="ends_with")return`Fâsit metin: "${i.suffix}" ile bitmeli.`;if(i.format==="includes")return`Fâsit metin: "${i.includes}" ihtivâ etmeli.`;if(i.format==="regex")return`Fâsit metin: ${i.pattern} nakşına uymalı.`;return`Fâsit ${o[i.format]??n.format}`}case"not_multiple_of":return`Fâsit sayı: ${n.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${n.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function T_(){return{localeError:eV()}}var tV=()=>{let e={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"ارې";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return(n)=>{switch(n.code){case"invalid_type":return`ناسم ورودي: باید ${n.expected} وای, مګر ${r(n.input)} ترلاسه شو`;case"invalid_value":if(n.values.length===1)return`ناسم ورودي: باید ${N(n.values[0])} وای`;return`ناسم انتخاب: باید یو له ${E(n.values,"|")} څخه وای`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`ډیر لوی: ${n.origin??"ارزښت"} باید ${i}${n.maximum.toString()} ${s.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${n.origin??"ارزښت"} باید ${i}${n.maximum.toString()} وي`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`ډیر کوچنی: ${n.origin} باید ${i}${n.minimum.toString()} ${s.unit} ولري`;return`ډیر کوچنی: ${n.origin} باید ${i}${n.minimum.toString()} وي`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`ناسم متن: باید د "${i.prefix}" سره پیل شي`;if(i.format==="ends_with")return`ناسم متن: باید د "${i.suffix}" سره پای ته ورسيږي`;if(i.format==="includes")return`ناسم متن: باید "${i.includes}" ولري`;if(i.format==="regex")return`ناسم متن: باید د ${i.pattern} سره مطابقت ولري`;return`${o[i.format]??n.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${n.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${n.keys.length>1?"کلیډونه":"کلیډ"}: ${E(n.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${n.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${n.origin} کې`;default:return"ناسمه ورودي"}}};function E_(){return{localeError:tV()}}var rV=()=>{let e={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"liczba";case"object":{if(Array.isArray(n))return"tablica";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"wyrażenie",email:"adres email",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:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return(n)=>{switch(n.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${n.expected}, otrzymano ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${N(n.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Za duża wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${i}${n.maximum.toString()} ${s.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Za mała wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${i}${n.minimum.toString()} ${s.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${i.prefix}"`;if(i.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${i.suffix}"`;if(i.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${i.includes}"`;if(i.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${i.pattern}`;return`Nieprawidłow(y/a/e) ${o[i.format]??n.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${n.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${n.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function P_(){return{localeError:rV()}}var nV=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"número";case"object":{if(Array.isArray(n))return"array";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"padrão",email:"endereço de e-mail",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:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(n)=>{switch(n.code){case"invalid_type":return`Tipo inválido: esperado ${n.expected}, recebido ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Entrada inválida: esperado ${N(n.values[0])}`;return`Opção inválida: esperada uma das ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Muito grande: esperado que ${n.origin??"valor"} tivesse ${i}${n.maximum.toString()} ${s.unit??"elementos"}`;return`Muito grande: esperado que ${n.origin??"valor"} fosse ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Muito pequeno: esperado que ${n.origin} tivesse ${i}${n.minimum.toString()} ${s.unit}`;return`Muito pequeno: esperado que ${n.origin} fosse ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Texto inválido: deve começar com "${i.prefix}"`;if(i.format==="ends_with")return`Texto inválido: deve terminar com "${i.suffix}"`;if(i.format==="includes")return`Texto inválido: deve incluir "${i.includes}"`;if(i.format==="regex")return`Texto inválido: deve corresponder ao padrão ${i.pattern}`;return`${o[i.format]??n.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Chave inválida em ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${n.origin}`;default:return"Campo inválido"}}};function I_(){return{localeError:nV()}}function DR(e,t,r,o){let n=Math.abs(e),i=n%10,s=n%100;if(s>=11&&s<=19)return o;if(i===1)return t;if(i>=2&&i<=4)return r;return o}var oV=()=>{let e={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"массив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return(n)=>{switch(n.code){case"invalid_type":return`Неверный ввод: ожидалось ${n.expected}, получено ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Неверный ввод: ожидалось ${N(n.values[0])}`;return`Неверный вариант: ожидалось одно из ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),c=DR(a,s.unit.one,s.unit.few,s.unit.many);return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет иметь ${i}${n.maximum.toString()} ${c}`}return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),c=DR(a,s.unit.one,s.unit.few,s.unit.many);return`Слишком маленькое значение: ожидалось, что ${n.origin} будет иметь ${i}${n.minimum.toString()} ${c}`}return`Слишком маленькое значение: ожидалось, что ${n.origin} будет ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Неверная строка: должна начинаться с "${i.prefix}"`;if(i.format==="ends_with")return`Неверная строка: должна заканчиваться на "${i.suffix}"`;if(i.format==="includes")return`Неверная строка: должна содержать "${i.includes}"`;if(i.format==="regex")return`Неверная строка: должна соответствовать шаблону ${i.pattern}`;return`Неверный ${o[i.format]??n.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспознанн${n.keys.length>1?"ые":"ый"} ключ${n.keys.length>1?"и":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${n.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${n.origin}`;default:return"Неверные входные данные"}}};function R_(){return{localeError:oV()}}var iV=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"število";case"object":{if(Array.isArray(n))return"tabela";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"vnos",email:"e-poštni naslov",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 datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return(n)=>{switch(n.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${n.expected}, prejeto ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Neveljaven vnos: pričakovano ${N(n.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} imelo ${i}${n.maximum.toString()} ${s.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Premajhno: pričakovano, da bo ${n.origin} imelo ${i}${n.minimum.toString()} ${s.unit}`;return`Premajhno: pričakovano, da bo ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Neveljaven niz: mora se začeti z "${i.prefix}"`;if(i.format==="ends_with")return`Neveljaven niz: mora se končati z "${i.suffix}"`;if(i.format==="includes")return`Neveljaven niz: mora vsebovati "${i.includes}"`;if(i.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`;return`Neveljaven ${o[i.format]??n.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i ključi":" ključ"}: ${E(n.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function $_(){return{localeError:iV()}}var sV=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"antal";case"object":{if(Array.isArray(n))return"lista";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"reguljärt uttryck",email:"e-postadress",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-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return(n)=>{switch(n.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${n.expected}, fick ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Ogiltig inmatning: förväntat ${N(n.values[0])}`;return`Ogiltigt val: förväntade en av ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`För stor(t): förväntade ${n.origin??"värdet"} att ha ${i}${n.maximum.toString()} ${s.unit??"element"}`;return`För stor(t): förväntat ${n.origin??"värdet"} att ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`För lite(t): förväntade ${n.origin??"värdet"} att ha ${i}${n.minimum.toString()} ${s.unit}`;return`För lite(t): förväntade ${n.origin??"värdet"} att ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ogiltig sträng: måste börja med "${i.prefix}"`;if(i.format==="ends_with")return`Ogiltig sträng: måste sluta med "${i.suffix}"`;if(i.format==="includes")return`Ogiltig sträng: måste innehålla "${i.includes}"`;if(i.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${i.pattern}"`;return`Ogiltig(t) ${o[i.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${E(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${n.origin??"värdet"}`;default:return"Ogiltig input"}}};function O_(){return{localeError:sV()}}var aV=()=>{let e={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(n))return"அணி";if(n===null)return"வெறுமை";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",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 தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${n.expected}, பெறப்பட்டது ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${N(n.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${E(n.values,"|")} இல் ஒன்று`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${i}${n.maximum.toString()} ${s.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${i}${n.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${i}${n.minimum.toString()} ${s.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${i}${n.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`தவறான சரம்: "${i.prefix}" இல் தொடங்க வேண்டும்`;if(i.format==="ends_with")return`தவறான சரம்: "${i.suffix}" இல் முடிவடைய வேண்டும்`;if(i.format==="includes")return`தவறான சரம்: "${i.includes}" ஐ உள்ளடக்க வேண்டும்`;if(i.format==="regex")return`தவறான சரம்: ${i.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${o[i.format]??n.format}`}case"not_multiple_of":return`தவறான எண்: ${n.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${n.keys.length>1?"கள்":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${n.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function A_(){return{localeError:aV()}}var cV=()=>{let e={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(n))return"อาร์เรย์ (Array)";if(n===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return(n)=>{switch(n.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${n.expected} แต่ได้รับ ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${N(n.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"ไม่เกิน":"น้อยกว่า",s=t(n.origin);if(s)return`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${i} ${n.maximum.toString()} ${s.unit??"รายการ"}`;return`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"อย่างน้อย":"มากกว่า",s=t(n.origin);if(s)return`น้อยกว่ากำหนด: ${n.origin} ควรมี${i} ${n.minimum.toString()} ${s.unit}`;return`น้อยกว่ากำหนด: ${n.origin} ควรมี${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${i.prefix}"`;if(i.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${i.suffix}"`;if(i.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${i.includes}" อยู่ในข้อความ`;if(i.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${i.pattern}`;return`รูปแบบไม่ถูกต้อง: ${o[i.format]??n.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${n.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${E(n.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${n.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${n.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function C_(){return{localeError:cV()}}var lV=(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},uV=()=>{let e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function t(o){return e[o]??null}let r={regex:"girdi",email:"e-posta adresi",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 tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return(o)=>{switch(o.code){case"invalid_type":return`Geçersiz değer: beklenen ${o.expected}, alınan ${lV(o.input)}`;case"invalid_value":if(o.values.length===1)return`Geçersiz değer: beklenen ${N(o.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${E(o.values,"|")}`;case"too_big":{let n=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Çok büyük: beklenen ${o.origin??"değer"} ${n}${o.maximum.toString()} ${i.unit??"öğe"}`;return`Çok büyük: beklenen ${o.origin??"değer"} ${n}${o.maximum.toString()}`}case"too_small":{let n=o.inclusive?">=":">",i=t(o.origin);if(i)return`Çok küçük: beklenen ${o.origin} ${n}${o.minimum.toString()} ${i.unit}`;return`Çok küçük: beklenen ${o.origin} ${n}${o.minimum.toString()}`}case"invalid_format":{let n=o;if(n.format==="starts_with")return`Geçersiz metin: "${n.prefix}" ile başlamalı`;if(n.format==="ends_with")return`Geçersiz metin: "${n.suffix}" ile bitmeli`;if(n.format==="includes")return`Geçersiz metin: "${n.includes}" içermeli`;if(n.format==="regex")return`Geçersiz metin: ${n.pattern} desenine uymalı`;return`Geçersiz ${r[n.format]??o.format}`}case"not_multiple_of":return`Geçersiz sayı: ${o.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${o.keys.length>1?"lar":""}: ${E(o.keys,", ")}`;case"invalid_key":return`${o.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${o.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function M_(){return{localeError:uV()}}var dV=()=>{let e={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"масив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return(n)=>{switch(n.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${n.expected}, отримано ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Неправильні вхідні дані: очікується ${N(n.values[0])}`;return`Неправильна опція: очікується одне з ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Занадто велике: очікується, що ${n.origin??"значення"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"елементів"}`;return`Занадто велике: очікується, що ${n.origin??"значення"} буде ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Занадто мале: очікується, що ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Занадто мале: очікується, що ${n.origin} буде ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Неправильний рядок: повинен починатися з "${i.prefix}"`;if(i.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${i.suffix}"`;if(i.format==="includes")return`Неправильний рядок: повинен містити "${i.includes}"`;if(i.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${i.pattern}`;return`Неправильний ${o[i.format]??n.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${n.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${n.keys.length>1?"і":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${n.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${n.origin}`;default:return"Неправильні вхідні дані"}}};function N_(){return{localeError:dV()}}var pV=()=>{let e={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"نمبر";case"object":{if(Array.isArray(n))return"آرے";if(n===null)return"نل";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return(n)=>{switch(n.code){case"invalid_type":return`غلط ان پٹ: ${n.expected} متوقع تھا، ${r(n.input)} موصول ہوا`;case"invalid_value":if(n.values.length===1)return`غلط ان پٹ: ${N(n.values[0])} متوقع تھا`;return`غلط آپشن: ${E(n.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`بہت بڑا: ${n.origin??"ویلیو"} کے ${i}${n.maximum.toString()} ${s.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${n.origin??"ویلیو"} کا ${i}${n.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`بہت چھوٹا: ${n.origin} کے ${i}${n.minimum.toString()} ${s.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${n.origin} کا ${i}${n.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`غلط سٹرنگ: "${i.prefix}" سے شروع ہونا چاہیے`;if(i.format==="ends_with")return`غلط سٹرنگ: "${i.suffix}" پر ختم ہونا چاہیے`;if(i.format==="includes")return`غلط سٹرنگ: "${i.includes}" شامل ہونا چاہیے`;if(i.format==="regex")return`غلط سٹرنگ: پیٹرن ${i.pattern} سے میچ ہونا چاہیے`;return`غلط ${o[i.format]??n.format}`}case"not_multiple_of":return`غلط نمبر: ${n.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${n.keys.length>1?"ز":""}: ${E(n.keys,"، ")}`;case"invalid_key":return`${n.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${n.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function D_(){return{localeError:pV()}}var fV=()=>{let e={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"số";case"object":{if(Array.isArray(n))return"mảng";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"đầu vào",email:"địa chỉ email",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:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return(n)=>{switch(n.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${n.expected}, nhận được ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${N(n.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Quá lớn: mong đợi ${n.origin??"giá trị"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"phần tử"}`;return`Quá lớn: mong đợi ${n.origin??"giá trị"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Quá nhỏ: mong đợi ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Quá nhỏ: mong đợi ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${i.prefix}"`;if(i.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${i.suffix}"`;if(i.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${i.includes}"`;if(i.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${i.pattern}`;return`${o[i.format]??n.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${n.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${E(n.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${n.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${n.origin}`;default:return"Đầu vào không hợp lệ"}}};function j_(){return{localeError:fV()}}var mV=()=>{let e={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(n))return"数组";if(n===null)return"空值(null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return(n)=>{switch(n.code){case"invalid_type":return`无效输入:期望 ${n.expected},实际接收 ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`无效输入:期望 ${N(n.values[0])}`;return`无效选项:期望以下之一 ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`数值过大:期望 ${n.origin??"值"} ${i}${n.maximum.toString()} ${s.unit??"个元素"}`;return`数值过大:期望 ${n.origin??"值"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`数值过小:期望 ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`;return`数值过小:期望 ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`无效字符串:必须以 "${i.prefix}" 开头`;if(i.format==="ends_with")return`无效字符串:必须以 "${i.suffix}" 结尾`;if(i.format==="includes")return`无效字符串:必须包含 "${i.includes}"`;if(i.format==="regex")return`无效字符串:必须满足正则表达式 ${i.pattern}`;return`无效${o[i.format]??n.format}`}case"not_multiple_of":return`无效数字:必须是 ${n.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${n.origin} 中包含无效值(value)`;default:return"无效输入"}}};function z_(){return{localeError:mV()}}var gV=()=>{let e={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"輸入",email:"郵件地址",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 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return(n)=>{switch(n.code){case"invalid_type":return`無效的輸入值:預期為 ${n.expected},但收到 ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`無效的輸入值:預期為 ${N(n.values[0])}`;return`無效的選項:預期為以下其中之一 ${E(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`數值過大:預期 ${n.origin??"值"} 應為 ${i}${n.maximum.toString()} ${s.unit??"個元素"}`;return`數值過大:預期 ${n.origin??"值"} 應為 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`數值過小:預期 ${n.origin} 應為 ${i}${n.minimum.toString()} ${s.unit}`;return`數值過小:預期 ${n.origin} 應為 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`無效的字串:必須以 "${i.prefix}" 開頭`;if(i.format==="ends_with")return`無效的字串:必須以 "${i.suffix}" 結尾`;if(i.format==="includes")return`無效的字串:必須包含 "${i.includes}"`;if(i.format==="regex")return`無效的字串:必須符合格式 ${i.pattern}`;return`無效的 ${o[i.format]??n.format}`}case"not_multiple_of":return`無效的數字:必須為 ${n.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${n.keys.length>1?"們":""}:${E(n.keys,"、")}`;case"invalid_key":return`${n.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${n.origin} 中有無效的值`;default:return"無效的輸入值"}}};function U_(){return{localeError:gV()}}var Qp=Symbol("ZodOutput"),ef=Symbol("ZodInput");class Pc{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r){if(this._idmap.has(r.id))throw Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};return delete r.id,{...r,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function Ic(){return new Pc}var Tt=Ic();function tf(e,t){return new e({type:"string",...$(t)})}function L_(e,t){return new e({type:"string",coerce:!0,...$(t)})}function Rc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...$(t)})}function Yi(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...$(t)})}function $c(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...$(t)})}function Oc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...$(t)})}function Ac(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...$(t)})}function Cc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...$(t)})}function Mc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...$(t)})}function Nc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...$(t)})}function Dc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...$(t)})}function jc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...$(t)})}function zc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...$(t)})}function Uc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...$(t)})}function Lc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...$(t)})}function Fc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...$(t)})}function Hc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...$(t)})}function Bc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...$(t)})}function qc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...$(t)})}function Zc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...$(t)})}function Vc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...$(t)})}function Wc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...$(t)})}function Kc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...$(t)})}function Gc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...$(t)})}var rf={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function F_(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...$(t)})}function H_(e,t){return new e({type:"string",format:"date",check:"string_format",...$(t)})}function B_(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...$(t)})}function q_(e,t){return new e({type:"string",format:"duration",check:"string_format",...$(t)})}function nf(e,t){return new e({type:"number",checks:[],...$(t)})}function Z_(e,t){return new e({type:"number",coerce:!0,checks:[],...$(t)})}function of(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...$(t)})}function sf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...$(t)})}function af(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...$(t)})}function cf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...$(t)})}function lf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...$(t)})}function uf(e,t){return new e({type:"boolean",...$(t)})}function V_(e,t){return new e({type:"boolean",coerce:!0,...$(t)})}function df(e,t){return new e({type:"bigint",...$(t)})}function W_(e,t){return new e({type:"bigint",coerce:!0,...$(t)})}function pf(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...$(t)})}function ff(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...$(t)})}function mf(e,t){return new e({type:"symbol",...$(t)})}function gf(e,t){return new e({type:"undefined",...$(t)})}function hf(e,t){return new e({type:"null",...$(t)})}function yf(e){return new e({type:"any"})}function Oo(e){return new e({type:"unknown"})}function bf(e,t){return new e({type:"never",...$(t)})}function _f(e,t){return new e({type:"void",...$(t)})}function vf(e,t){return new e({type:"date",...$(t)})}function K_(e,t){return new e({type:"date",coerce:!0,...$(t)})}function Sf(e,t){return new e({type:"nan",...$(t)})}function Jr(e,t){return new Yd({check:"less_than",...$(t),value:e,inclusive:!1})}function Jt(e,t){return new Yd({check:"less_than",...$(t),value:e,inclusive:!0})}function Xr(e,t){return new Qd({check:"greater_than",...$(t),value:e,inclusive:!1})}function Et(e,t){return new Qd({check:"greater_than",...$(t),value:e,inclusive:!0})}function G_(e){return Xr(0,e)}function J_(e){return Jr(0,e)}function X_(e){return Jt(0,e)}function Y_(e){return Et(0,e)}function Ao(e,t){return new Ob({check:"multiple_of",...$(t),value:e})}function Qi(e,t){return new Mb({check:"max_size",...$(t),maximum:e})}function Co(e,t){return new Nb({check:"min_size",...$(t),minimum:e})}function Jc(e,t){return new Db({check:"size_equals",...$(t),size:e})}function es(e,t){return new jb({check:"max_length",...$(t),maximum:e})}function An(e,t){return new zb({check:"min_length",...$(t),minimum:e})}function ts(e,t){return new Ub({check:"length_equals",...$(t),length:e})}function Xc(e,t){return new Lb({check:"string_format",format:"regex",...$(t),pattern:e})}function Yc(e){return new Fb({check:"string_format",format:"lowercase",...$(e)})}function Qc(e){return new Hb({check:"string_format",format:"uppercase",...$(e)})}function el(e,t){return new Bb({check:"string_format",format:"includes",...$(t),includes:e})}function tl(e,t){return new qb({check:"string_format",format:"starts_with",...$(t),prefix:e})}function rl(e,t){return new Zb({check:"string_format",format:"ends_with",...$(t),suffix:e})}function Q_(e,t,r){return new Vb({check:"property",property:e,schema:t,...$(r)})}function nl(e,t){return new Wb({check:"mime_type",mime:e,...$(t)})}function Yr(e){return new Kb({check:"overwrite",tx:e})}function ol(e){return Yr((t)=>t.normalize(e))}function il(){return Yr((e)=>e.trim())}function sl(){return Yr((e)=>e.toLowerCase())}function al(){return Yr((e)=>e.toUpperCase())}function cl(e,t,r){return new e({type:"array",element:t,...$(r)})}function hV(e,t,r){return new e({type:"union",options:t,...$(r)})}function yV(e,t,r,o){return new e({type:"union",options:r,discriminator:t,...$(o)})}function bV(e,t,r){return new e({type:"intersection",left:t,right:r})}function ev(e,t,r,o){let n=r instanceof G;return new e({type:"tuple",items:t,rest:n?r:null,...$(n?o:r)})}function _V(e,t,r,o){return new e({type:"record",keyType:t,valueType:r,...$(o)})}function vV(e,t,r,o){return new e({type:"map",keyType:t,valueType:r,...$(o)})}function SV(e,t,r){return new e({type:"set",valueType:t,...$(r)})}function xV(e,t,r){let o=Array.isArray(t)?Object.fromEntries(t.map((n)=>[n,n])):t;return new e({type:"enum",entries:o,...$(r)})}function wV(e,t,r){return new e({type:"enum",entries:t,...$(r)})}function kV(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...$(r)})}function xf(e,t){return new e({type:"file",...$(t)})}function TV(e,t){return new e({type:"transform",transform:t})}function EV(e,t){return new e({type:"optional",innerType:t})}function PV(e,t){return new e({type:"nullable",innerType:t})}function IV(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r==="function"?r():r}})}function RV(e,t,r){return new e({type:"nonoptional",innerType:t,...$(r)})}function $V(e,t){return new e({type:"success",innerType:t})}function OV(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r==="function"?r:()=>r})}function AV(e,t,r){return new e({type:"pipe",in:t,out:r})}function CV(e,t){return new e({type:"readonly",innerType:t})}function MV(e,t,r){return new e({type:"template_literal",parts:t,...$(r)})}function NV(e,t){return new e({type:"lazy",getter:t})}function DV(e,t){return new e({type:"promise",innerType:t})}function wf(e,t,r){let o=$(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function kf(e,t,r){return new e({type:"custom",check:"custom",fn:t,...$(r)})}function Tf(e,t){let r=$(t),o=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];if(r.case!=="sensitive")o=o.map((g)=>typeof g==="string"?g.toLowerCase():g),n=n.map((g)=>typeof g==="string"?g.toLowerCase():g);let i=new Set(o),s=new Set(n),a=e.Pipe??Ji,c=e.Boolean??Wi,u=e.String??$n,p=new(e.Transform??Gi)({type:"transform",transform:(g,h)=>{let y=g;if(r.case!=="sensitive")y=y.toLowerCase();if(i.has(y))return!0;else if(s.has(y))return!1;else return h.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:h.value,inst:p}),{}},error:r.error}),f=new a({type:"pipe",in:new u({type:"string",error:r.error}),out:p,error:r.error});return new a({type:"pipe",in:f,out:new c({type:"boolean",error:r.error}),error:r.error})}function Ef(e,t,r,o={}){let n=$(o),i={...$(o),check:"string_format",type:"string",format:t,fn:typeof r==="function"?r:(a)=>r.test(a),...n};if(r instanceof RegExp)i.pattern=r;return new e(i)}class tv{constructor(e){this._def=e,this.def=e}implement(e){if(typeof e!=="function")throw Error("implement() must be called with a function");let t=(...r)=>{let o=this._def.input?Po(this._def.input,r,void 0,{callee:t}):r;if(!Array.isArray(o))throw Error("Invalid arguments schema: not an array or tuple schema.");let n=e(...o);return this._def.output?Po(this._def.output,n,void 0,{callee:t}):n};return t}implementAsync(e){if(typeof e!=="function")throw Error("implement() must be called with a function");let t=async(...r)=>{let o=this._def.input?await Io(this._def.input,r,void 0,{callee:t}):r;if(!Array.isArray(o))throw Error("Invalid arguments schema: not an array or tuple schema.");let n=await e(...o);return this._def.output?Io(this._def.output,n,void 0,{callee:t}):n};return t}input(...e){let t=this.constructor;if(Array.isArray(e[0]))return new t({type:"function",input:new On({type:"tuple",items:e[0],rest:e[1]}),output:this._def.output});return new t({type:"function",input:e[0],output:this._def.output})}output(e){return new this.constructor({type:"function",input:this._def.input,output:e})}}function Pf(e){return new tv({type:"function",input:Array.isArray(e?.input)?ev(On,e?.input):e?.input??cl(Ki,Oo($o)),output:e?.output??Oo($o)})}class If{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Tt,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 r;let o=e._zod.def,n={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i){if(i.count++,t.schemaPath.includes(e))i.cycle=t.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,s);let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let d={...t,schemaPath:[...t.schemaPath,e],path:t.path},p=e._zod.parent;if(p)s.ref=p,this.process(p,d),this.seen.get(p).isParent=!0;else{let f=s.schema;switch(o.type){case"string":{let m=f;m.type="string";let{minimum:g,maximum:h,format:y,patterns:v,contentEncoding:x}=e._zod.bag;if(typeof g==="number")m.minLength=g;if(typeof h==="number")m.maxLength=h;if(y){if(m.format=n[y]??y,m.format==="")delete m.format}if(x)m.contentEncoding=x;if(v&&v.size>0){let w=[...v];if(w.length===1)m.pattern=w[0].source;else if(w.length>1)s.schema.allOf=[...w.map((O)=>({...this.target==="draft-7"?{type:"string"}:{},pattern:O.source}))]}break}case"number":{let m=f,{minimum:g,maximum:h,format:y,multipleOf:v,exclusiveMaximum:x,exclusiveMinimum:w}=e._zod.bag;if(typeof y==="string"&&y.includes("int"))m.type="integer";else m.type="number";if(typeof w==="number")m.exclusiveMinimum=w;if(typeof g==="number"){if(m.minimum=g,typeof w==="number")if(w>=g)delete m.minimum;else delete m.exclusiveMinimum}if(typeof x==="number")m.exclusiveMaximum=x;if(typeof h==="number"){if(m.maximum=h,typeof x==="number")if(x<=h)delete m.maximum;else delete m.exclusiveMaximum}if(typeof v==="number")m.multipleOf=v;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:g,maximum:h}=e._zod.bag;if(typeof g==="number")m.minItems=g;if(typeof h==="number")m.maxItems=h;m.type="array",m.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let m=f;m.type="object",m.properties={};let g=o.shape;for(let v in g)m.properties[v]=this.process(g[v],{...d,path:[...d.path,"properties",v]});let h=new Set(Object.keys(g)),y=new Set([...h].filter((v)=>{let x=o.shape[v]._zod;if(this.io==="input")return x.optin===void 0;else return x.optout===void 0}));if(y.size>0)m.required=Array.from(y);if(o.catchall?._zod.def.type==="never")m.additionalProperties=!1;else if(!o.catchall){if(this.io==="output")m.additionalProperties=!1}else if(o.catchall)m.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]});break}case"union":{let m=f;m.anyOf=o.options.map((g,h)=>this.process(g,{...d,path:[...d.path,"anyOf",h]}));break}case"intersection":{let m=f,g=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),h=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),y=(x)=>("allOf"in x)&&Object.keys(x).length===1,v=[...y(g)?g.allOf:[g],...y(h)?h.allOf:[h]];m.allOf=v;break}case"tuple":{let m=f;m.type="array";let g=o.items.map((v,x)=>this.process(v,{...d,path:[...d.path,"prefixItems",x]}));if(this.target==="draft-2020-12")m.prefixItems=g;else m.items=g;if(o.rest){let v=this.process(o.rest,{...d,path:[...d.path,"items"]});if(this.target==="draft-2020-12")m.items=v;else m.additionalItems=v}if(o.rest)m.items=this.process(o.rest,{...d,path:[...d.path,"items"]});let{minimum:h,maximum:y}=e._zod.bag;if(typeof h==="number")m.minItems=h;if(typeof y==="number")m.maxItems=y;break}case"record":{let m=f;m.type="object",m.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]}),m.additionalProperties=this.process(o.valueType,{...d,path:[...d.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,g=gc(o.entries);if(g.every((h)=>typeof h==="number"))m.type="number";if(g.every((h)=>typeof h==="string"))m.type="string";m.enum=g;break}case"literal":{let m=f,g=[];for(let h of o.values)if(h===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof h==="bigint")if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else g.push(Number(h));else g.push(h);if(g.length===0);else if(g.length===1){let h=g[0];m.type=h===null?"null":typeof h,m.const=h}else{if(g.every((h)=>typeof h==="number"))m.type="number";if(g.every((h)=>typeof h==="string"))m.type="string";if(g.every((h)=>typeof h==="boolean"))m.type="string";if(g.every((h)=>h===null))m.type="null";m.enum=g}break}case"file":{let m=f,g={type:"string",format:"binary",contentEncoding:"binary"},{minimum:h,maximum:y,mime:v}=e._zod.bag;if(h!==void 0)g.minLength=h;if(y!==void 0)g.maxLength=y;if(v)if(v.length===1)g.contentMediaType=v[0],Object.assign(m,g);else m.anyOf=v.map((x)=>{return{...g,contentMediaType:x}});else Object.assign(m,g);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let m=this.process(o.innerType,d);f.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),s.ref=o.innerType;break}case"success":{let m=f;m.type="boolean";break}case"default":{this.process(o.innerType,d),s.ref=o.innerType,f.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{if(this.process(o.innerType,d),s.ref=o.innerType,this.io==="input")f._prefault=JSON.parse(JSON.stringify(o.defaultValue));break}case"catch":{this.process(o.innerType,d),s.ref=o.innerType;let m;try{m=o.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,g=e._zod.pattern;if(!g)throw Error("Pattern not found in template literal");m.type="string",m.pattern=g.source;break}case"pipe":{let m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,d),s.ref=m;break}case"readonly":{this.process(o.innerType,d),s.ref=o.innerType,f.readOnly=!0;break}case"promise":{this.process(o.innerType,d),s.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),s.ref=o.innerType;break}case"lazy":{let m=e._zod.innerType;this.process(m,d),s.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(s.schema,c);if(this.io==="input"&&Je(e))delete s.schema.examples,delete s.schema.default;if(this.io==="input"&&s.schema._prefault)(r=s.schema).default??(r.default=s.schema._prefault);return delete s.schema._prefault,this.seen.get(e).schema}emit(e,t){let r={cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0},o=this.seen.get(e);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(u)=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){let g=r.external.registry.get(u[0])?.id;if(g)return{ref:r.external.uri(g)};let h=u[1].defId??u[1].schema.id??`schema${this.counter++}`;return u[1].defId=h,{defId:h,ref:`${r.external.uri("__shared")}#/${d}/${h}`}}if(u[1]===o)return{ref:"#"};let f=`${"#"}/${d}/`,m=u[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:f+m}},i=(u)=>{if(u[1].schema.$ref)return;let d=u[1],{ref:p,defId:f}=n(u);if(d.def={...d.schema},f)d.defId=f;let m=d.schema;for(let g in m)delete m[g];m.$ref=p};for(let u of this.seen.entries()){let d=u[1];if(e===u[0]){i(u);continue}if(r.external){let f=r.external.registry.get(u[0])?.id;if(e!==u[0]&&f){i(u);continue}}if(this.metadataRegistry.get(u[0])?.id){i(u);continue}if(d.cycle){if(r.cycles==="throw")throw Error(`Cycle detected: #/${d.cycle?.join("/")}/<root>
97
+ path: iss.path ? [${Po(x)}, ...iss.path] : [${Po(x)}]
98
+ })));`),f.write(`newResult[${Po(x)}] = ${w}.value`)}f.write("payload.value = newResult;"),f.write("return payload;");let v=f.compile();return(x,w)=>v(p,x,w)},n,i=Fi,s=!fc.jitless,c=s&&Xy.value,u=t.catchall,d;e._zod.parse=(p,f)=>{d??(d=r.value);let m=p.value;if(!i(m))return p.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),p;let g=[];if(s&&c&&f?.async===!1&&f.jitless!==!0){if(!n)n=o(t.shape);p=n(p,f)}else{p.value={};let w=d.shape;for(let O of d.keys){let L=w[O],se=L._zod.run({value:m[O],issues:[]},f),Ue=L._zod.optin==="optional"&&L._zod.optout==="optional";if(se instanceof Promise)g.push(se.then((Ye)=>Ue?k0(Ye,p,O,m):rp(Ye,p,O)));else if(Ue)k0(se,p,O,m);else rp(se,p,O)}}if(!u)return g.length?Promise.all(g).then(()=>p):p;let h=[],y=d.keySet,v=u._zod,x=v.def.type;for(let w of Object.keys(m)){if(y.has(w))continue;if(x==="never"){h.push(w);continue}let O=v.run({value:m[w],issues:[]},f);if(O instanceof Promise)g.push(O.then((L)=>rp(L,p,w)));else rp(O,p,w)}if(h.length)p.issues.push({code:"unrecognized_keys",keys:h,input:m,inst:e});if(!g.length)return p;return Promise.all(g).then(()=>{return p})}});function E0(e,t,r,o){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((n)=>n.issues.map((i)=>zt(i,o,He())))}),t}var Ec=b("$ZodUnion",(e,t)=>{G.init(e,t),me(e._zod,"optin",()=>t.options.some((r)=>r._zod.optin==="optional")?"optional":void 0),me(e._zod,"optout",()=>t.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),me(e._zod,"values",()=>{if(t.options.every((r)=>r._zod.values))return new Set(t.options.flatMap((r)=>Array.from(r._zod.values)));return}),me(e._zod,"pattern",()=>{if(t.options.every((r)=>r._zod.pattern)){let r=t.options.map((o)=>o._zod.pattern);return new RegExp(`^(${r.map((o)=>yc(o.source)).join("|")})$`)}return}),e._zod.parse=(r,o)=>{let n=!1,i=[];for(let s of t.options){let a=s._zod.run({value:r.value,issues:[]},o);if(a instanceof Promise)i.push(a),n=!0;else{if(a.issues.length===0)return a;i.push(a)}}if(!n)return E0(i,r,e,o);return Promise.all(i).then((s)=>{return E0(s,r,e,o)})}}),Cp=b("$ZodDiscriminatedUnion",(e,t)=>{Ec.init(e,t);let r=e._zod.parse;me(e._zod,"propValues",()=>{let n={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[a,c]of Object.entries(s)){if(!n[a])n[a]=new Set;for(let u of c)n[a].add(u)}}return n});let o=hc(()=>{let n=t.options,i=new Map;for(let s of n){let a=s._zod.propValues[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let c of a){if(i.has(c))throw Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,s)}}return i});e._zod.parse=(n,i)=>{let s=n.value;if(!Fi(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),n;let a=o.value.get(s?.[t.discriminator]);if(a)return a._zod.run(n,i);if(t.unionFallback)return r(n,i);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:s,path:[t.discriminator],inst:e}),n}}),Mp=b("$ZodIntersection",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),s=t.right._zod.run({value:n,issues:[]},o);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([c,u])=>{return T0(r,c,u)});return T0(r,i,s)}});function Xb(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(Hi(e)&&Hi(t)){let r=Object.keys(t),o=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),n={...e,...t};for(let i of o){let s=Xb(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n[i]=s.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],i=t[o],s=Xb(n,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function T0(e,t,r){if(t.issues.length)e.issues.push(...t.issues);if(r.issues.length)e.issues.push(...r.issues);if(Io(e))return e;let o=Xb(t.value,r.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Cn=b("$ZodTuple",(e,t)=>{G.init(e,t);let r=t.items,o=r.length-[...r].reverse().findIndex((n)=>n._zod.optin!=="optional");e._zod.parse=(n,i)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[];if(!t.rest){let u=s.length>r.length,d=s.length<o-1;if(u||d)return n.issues.push({input:s,inst:e,origin:"array",...u?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length}}),n}let c=-1;for(let u of r){if(c++,c>=s.length){if(c>=o)continue}let d=u._zod.run({value:s[c],issues:[]},i);if(d instanceof Promise)a.push(d.then((p)=>np(p,n,c)));else np(d,n,c)}if(t.rest){let u=s.slice(r.length);for(let d of u){c++;let p=t.rest._zod.run({value:d,issues:[]},i);if(p instanceof Promise)a.push(p.then((f)=>np(f,n,c)));else np(p,n,c)}}if(a.length)return Promise.all(a).then(()=>n);return n}});function np(e,t,r){if(e.issues.length)t.issues.push(...kt(r,e.issues));t.value[r]=e.value}var Np=b("$ZodRecord",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Hi(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let i=[];if(t.keyType._zod.values){let s=t.keyType._zod.values;r.value={};for(let c of s)if(typeof c==="string"||typeof c==="number"||typeof c==="symbol"){let u=t.valueType._zod.run({value:n[c],issues:[]},o);if(u instanceof Promise)i.push(u.then((d)=>{if(d.issues.length)r.issues.push(...kt(c,d.issues));r.value[c]=d.value}));else{if(u.issues.length)r.issues.push(...kt(c,u.issues));r.value[c]=u.value}}let a;for(let c in n)if(!s.has(c))a=a??[],a.push(c);if(a&&a.length>0)r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:a})}else{r.value={};for(let s of Reflect.ownKeys(n)){if(s==="__proto__")continue;let a=t.keyType._zod.run({value:s,issues:[]},o);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map((u)=>zt(u,o,He())),input:s,path:[s],inst:e}),r.value[a.value]=a.value;continue}let c=t.valueType._zod.run({value:n[s],issues:[]},o);if(c instanceof Promise)i.push(c.then((u)=>{if(u.issues.length)r.issues.push(...kt(s,u.issues));r.value[a.value]=u.value}));else{if(c.issues.length)r.issues.push(...kt(s,c.issues));r.value[a.value]=c.value}}}if(i.length)return Promise.all(i).then(()=>r);return r}}),Dp=b("$ZodMap",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:e}),r;let i=[];r.value=new Map;for(let[s,a]of n){let c=t.keyType._zod.run({value:s,issues:[]},o),u=t.valueType._zod.run({value:a,issues:[]},o);if(c instanceof Promise||u instanceof Promise)i.push(Promise.all([c,u]).then(([d,p])=>{P0(d,p,r,s,n,e,o)}));else P0(c,u,r,s,n,e,o)}if(i.length)return Promise.all(i).then(()=>r);return r}});function P0(e,t,r,o,n,i,s){if(e.issues.length)if(bc.has(typeof o))r.issues.push(...kt(o,e.issues));else r.issues.push({origin:"map",code:"invalid_key",input:n,inst:i,issues:e.issues.map((a)=>zt(a,s,He()))});if(t.issues.length)if(bc.has(typeof o))r.issues.push(...kt(o,t.issues));else r.issues.push({origin:"map",code:"invalid_element",input:n,inst:i,key:o,issues:t.issues.map((a)=>zt(a,s,He()))});r.value.set(e.value,t.value)}var jp=b("$ZodSet",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let s of n){let a=t.valueType._zod.run({value:s,issues:[]},o);if(a instanceof Promise)i.push(a.then((c)=>I0(c,r)));else I0(a,r)}if(i.length)return Promise.all(i).then(()=>r);return r}});function I0(e,t){if(e.issues.length)t.issues.push(...e.issues);t.value.add(e.value)}var zp=b("$ZodEnum",(e,t)=>{G.init(e,t);let r=gc(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter((o)=>bc.has(typeof o)).map((o)=>typeof o==="string"?Gr(o):o.toString()).join("|")})$`),e._zod.parse=(o,n)=>{let i=o.value;if(e._zod.values.has(i))return o;return o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),Up=b("$ZodLiteral",(e,t)=>{G.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map((r)=>typeof r==="string"?Gr(r):r?r.toString():String(r)).join("|")})$`),e._zod.parse=(r,o)=>{let n=r.value;if(e._zod.values.has(n))return r;return r.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),r}}),Lp=b("$ZodFile",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(n instanceof File)return r;return r.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),r}}),Gi=b("$ZodTransform",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((s)=>{return r.value=s,r});if(n instanceof Promise)throw new Kr;return r.value=n,r}}),Fp=b("$ZodOptional",(e,t)=>{G.init(e,t),e._zod.optin="optional",e._zod.optout="optional",me(e._zod,"values",()=>{return t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0}),me(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${yc(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional")return t.innerType._zod.run(r,o);if(r.value===void 0)return r;return t.innerType._zod.run(r,o)}}),Hp=b("$ZodNullable",(e,t)=>{G.init(e,t),me(e._zod,"optin",()=>t.innerType._zod.optin),me(e._zod,"optout",()=>t.innerType._zod.optout),me(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${yc(r.source)}|null)$`):void 0}),me(e._zod,"values",()=>{return t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0}),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),Bp=b("$ZodDefault",(e,t)=>{G.init(e,t),e._zod.optin="optional",me(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>R0(i,t));return R0(n,t)}});function R0(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var qp=b("$ZodPrefault",(e,t)=>{G.init(e,t),e._zod.optin="optional",me(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),Zp=b("$ZodNonOptional",(e,t)=>{G.init(e,t),me(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>$0(i,e));return $0(n,e)}});function $0(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 Vp=b("$ZodSuccess",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>{return r.value=i.issues.length===0,r});return r.value=n.issues.length===0,r}}),Wp=b("$ZodCatch",(e,t)=>{G.init(e,t),e._zod.optin="optional",me(e._zod,"optout",()=>t.innerType._zod.optout),me(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>{if(r.value=i.value,i.issues.length)r.value=t.catchValue({...r,error:{issues:i.issues.map((s)=>zt(s,o,He()))},input:r.value}),r.issues=[];return r});if(r.value=n.value,n.issues.length)r.value=t.catchValue({...r,error:{issues:n.issues.map((i)=>zt(i,o,He()))},input:r.value}),r.issues=[];return r}}),Kp=b("$ZodNaN",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{if(typeof r.value!=="number"||!Number.isNaN(r.value))return r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r;return r}}),Ji=b("$ZodPipe",(e,t)=>{G.init(e,t),me(e._zod,"values",()=>t.in._zod.values),me(e._zod,"optin",()=>t.in._zod.optin),me(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(r,o)=>{let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>O0(i,t,o));return O0(n,t,o)}});function O0(e,t,r){if(Io(e))return e;return t.out._zod.run({value:e.value,issues:e.issues},r)}var Gp=b("$ZodReadonly",(e,t)=>{G.init(e,t),me(e._zod,"propValues",()=>t.innerType._zod.propValues),me(e._zod,"values",()=>t.innerType._zod.values),me(e._zod,"optin",()=>t.innerType._zod.optin),me(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(A0);return A0(n)}});function A0(e){return e.value=Object.freeze(e.value),e}var Jp=b("$ZodTemplateLiteral",(e,t)=>{G.init(e,t);let r=[];for(let o of t.parts)if(o instanceof G){if(!o._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);let n=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!n)throw Error(`Invalid template literal part: ${o._zod.traits}`);let i=n.startsWith("^")?1:0,s=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(i,s))}else if(o===null||Yy.has(typeof o))r.push(Gr(`${o}`));else throw Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(o,n)=>{if(typeof o.value!=="string")return o.issues.push({input:o.value,inst:e,expected:"template_literal",code:"invalid_type"}),o;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(o.value))return o.issues.push({input:o.value,inst:e,code:"invalid_format",format:"template_literal",pattern:e._zod.pattern.source}),o;return o}}),Xp=b("$ZodPromise",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{return Promise.resolve(r.value).then((n)=>t.innerType._zod.run({value:n,issues:[]},o))}}),Yp=b("$ZodLazy",(e,t)=>{G.init(e,t),me(e._zod,"innerType",()=>t.getter()),me(e._zod,"pattern",()=>e._zod.innerType._zod.pattern),me(e._zod,"propValues",()=>e._zod.innerType._zod.propValues),me(e._zod,"optin",()=>e._zod.innerType._zod.optin),me(e._zod,"optout",()=>e._zod.innerType._zod.optout),e._zod.parse=(r,o)=>{return e._zod.innerType._zod.run(r,o)}}),Qp=b("$ZodCustom",(e,t)=>{Me.init(e,t),G.init(e,t),e._zod.parse=(r,o)=>{return r},e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((i)=>C0(i,r,o,e));C0(n,r,o,e);return}});function C0(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(rb(n))}}var Xi={};wr(Xi,{zhTW:()=>L_,zhCN:()=>U_,vi:()=>z_,ur:()=>j_,ua:()=>D_,tr:()=>N_,th:()=>M_,ta:()=>C_,sv:()=>A_,sl:()=>O_,ru:()=>$_,pt:()=>R_,ps:()=>P_,pl:()=>I_,ota:()=>T_,no:()=>E_,nl:()=>k_,ms:()=>w_,mk:()=>x_,ko:()=>S_,kh:()=>v_,ja:()=>__,it:()=>b_,id:()=>y_,hu:()=>h_,he:()=>g_,frCA:()=>m_,fr:()=>f_,fi:()=>p_,fa:()=>d_,es:()=>u_,eo:()=>l_,en:()=>Tc,de:()=>c_,cs:()=>a_,ca:()=>s_,be:()=>i_,az:()=>o_,ar:()=>n_});var NZ=()=>{let e={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return(n)=>{switch(n.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${n.expected}، ولكن تم إدخال ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${N(n.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return` أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${i} ${n.maximum.toString()} ${s.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${i} ${n.minimum.toString()} ${s.unit}`;return`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${n.prefix}"`;if(i.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${i.suffix}"`;if(i.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${i.includes}"`;if(i.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${i.pattern}`;return`${o[i.format]??n.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${n.divisor}`;case"unrecognized_keys":return`معرف${n.keys.length>1?"ات":""} غريب${n.keys.length>1?"ة":""}: ${T(n.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${n.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${n.origin}`;default:return"مدخل غير مقبول"}}};function n_(){return{localeError:NZ()}}var DZ=()=>{let e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={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(n)=>{switch(n.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${n.expected}, daxil olan ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Yanlış dəyər: gözlənilən ${N(n.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${i}${n.maximum.toString()} ${s.unit??"element"}`;return`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Çox kiçik: gözlənilən ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`;return`Çox kiçik: gözlənilən ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Yanlış mətn: "${i.prefix}" ilə başlamalıdır`;if(i.format==="ends_with")return`Yanlış mətn: "${i.suffix}" ilə bitməlidir`;if(i.format==="includes")return`Yanlış mətn: "${i.includes}" daxil olmalıdır`;if(i.format==="regex")return`Yanlış mətn: ${i.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${o[i.format]??n.format}`}case"not_multiple_of":return`Yanlış ədəd: ${n.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${n.keys.length>1?"lar":""}: ${T(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${n.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function o_(){return{localeError:DZ()}}function j0(e,t,r,o){let n=Math.abs(e),i=n%10,s=n%100;if(s>=11&&s<=19)return o;if(i===1)return t;if(i>=2&&i<=4)return r;return o}var jZ=()=>{let e={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"лік";case"object":{if(Array.isArray(n))return"масіў";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return(n)=>{switch(n.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${n.expected}, атрымана ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Няправільны ўвод: чакалася ${N(n.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),c=j0(a,s.unit.one,s.unit.few,s.unit.many);return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна ${s.verb} ${i}${n.maximum.toString()} ${c}`}return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна быць ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),c=j0(a,s.unit.one,s.unit.few,s.unit.many);return`Занадта малы: чакалася, што ${n.origin} павінна ${s.verb} ${i}${n.minimum.toString()} ${c}`}return`Занадта малы: чакалася, што ${n.origin} павінна быць ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${i.prefix}"`;if(i.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${i.suffix}"`;if(i.format==="includes")return`Няправільны радок: павінен змяшчаць "${i.includes}"`;if(i.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${i.pattern}`;return`Няправільны ${o[i.format]??n.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${n.keys.length>1?"ключы":"ключ"}: ${T(n.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${n.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${n.origin}`;default:return"Няправільны ўвод"}}};function i_(){return{localeError:jZ()}}var zZ=()=>{let e={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"entrada",email:"adreça electrònica",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:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(n)=>{switch(n.code){case"invalid_type":return`Tipus invàlid: s'esperava ${n.expected}, s'ha rebut ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Valor invàlid: s'esperava ${N(n.values[0])}`;return`Opció invàlida: s'esperava una de ${T(n.values," o ")}`;case"too_big":{let i=n.inclusive?"com a màxim":"menys de",s=t(n.origin);if(s)return`Massa gran: s'esperava que ${n.origin??"el valor"} contingués ${i} ${n.maximum.toString()} ${s.unit??"elements"}`;return`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"com a mínim":"més de",s=t(n.origin);if(s)return`Massa petit: s'esperava que ${n.origin} contingués ${i} ${n.minimum.toString()} ${s.unit}`;return`Massa petit: s'esperava que ${n.origin} fos ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Format invàlid: ha de començar amb "${i.prefix}"`;if(i.format==="ends_with")return`Format invàlid: ha d'acabar amb "${i.suffix}"`;if(i.format==="includes")return`Format invàlid: ha d'incloure "${i.includes}"`;if(i.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${i.pattern}`;return`Format invàlid per a ${o[i.format]??n.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${T(n.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${n.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${n.origin}`;default:return"Entrada invàlida"}}};function s_(){return{localeError:zZ()}}var UZ=()=>{let e={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(n))return"pole";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"regulární výraz",email:"e-mailová adresa",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:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return(n)=>{switch(n.code){case"invalid_type":return`Neplatný vstup: očekáváno ${n.expected}, obdrženo ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Neplatný vstup: očekáváno ${N(n.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Hodnota je příliš velká: ${n.origin??"hodnota"} musí mít ${i}${n.maximum.toString()} ${s.unit??"prvků"}`;return`Hodnota je příliš velká: ${n.origin??"hodnota"} musí být ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Hodnota je příliš malá: ${n.origin??"hodnota"} musí mít ${i}${n.minimum.toString()} ${s.unit??"prvků"}`;return`Hodnota je příliš malá: ${n.origin??"hodnota"} musí být ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Neplatný řetězec: musí začínat na "${i.prefix}"`;if(i.format==="ends_with")return`Neplatný řetězec: musí končit na "${i.suffix}"`;if(i.format==="includes")return`Neplatný řetězec: musí obsahovat "${i.includes}"`;if(i.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${i.pattern}`;return`Neplatný formát ${o[i.format]??n.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${n.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${T(n.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${n.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${n.origin}`;default:return"Neplatný vstup"}}};function a_(){return{localeError:UZ()}}var LZ=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"Zahl";case"object":{if(Array.isArray(n))return"Array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"Eingabe",email:"E-Mail-Adresse",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-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return(n)=>{switch(n.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${n.expected}, erhalten ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Ungültige Eingabe: erwartet ${N(n.values[0])}`;return`Ungültige Option: erwartet eine von ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Zu groß: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ${s.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ist`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ${s.unit} hat`;return`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ist`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ungültiger String: muss mit "${i.prefix}" beginnen`;if(i.format==="ends_with")return`Ungültiger String: muss mit "${i.suffix}" enden`;if(i.format==="includes")return`Ungültiger String: muss "${i.includes}" enthalten`;if(i.format==="regex")return`Ungültiger String: muss dem Muster ${i.pattern} entsprechen`;return`Ungültig: ${o[i.format]??n.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${T(n.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${n.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${n.origin}`;default:return"Ungültige Eingabe"}}};function c_(){return{localeError:LZ()}}var FZ=(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},HZ=()=>{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(o){return e[o]??null}let r={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(o)=>{switch(o.code){case"invalid_type":return`Invalid input: expected ${o.expected}, received ${FZ(o.input)}`;case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${N(o.values[0])}`;return`Invalid option: expected one of ${T(o.values,"|")}`;case"too_big":{let n=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Too big: expected ${o.origin??"value"} to have ${n}${o.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${n}${o.maximum.toString()}`}case"too_small":{let n=o.inclusive?">=":">",i=t(o.origin);if(i)return`Too small: expected ${o.origin} to have ${n}${o.minimum.toString()} ${i.unit}`;return`Too small: expected ${o.origin} to be ${n}${o.minimum.toString()}`}case"invalid_format":{let n=o;if(n.format==="starts_with")return`Invalid string: must start with "${n.prefix}"`;if(n.format==="ends_with")return`Invalid string: must end with "${n.suffix}"`;if(n.format==="includes")return`Invalid string: must include "${n.includes}"`;if(n.format==="regex")return`Invalid string: must match pattern ${n.pattern}`;return`Invalid ${r[n.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${T(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Tc(){return{localeError:HZ()}}var BZ=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"nombro";case"object":{if(Array.isArray(e))return"tabelo";if(e===null)return"senvalora";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},qZ=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(o){return e[o]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return(o)=>{switch(o.code){case"invalid_type":return`Nevalida enigo: atendiĝis ${o.expected}, riceviĝis ${BZ(o.input)}`;case"invalid_value":if(o.values.length===1)return`Nevalida enigo: atendiĝis ${N(o.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${T(o.values,"|")}`;case"too_big":{let n=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${n}${o.maximum.toString()} ${i.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${n}${o.maximum.toString()}`}case"too_small":{let n=o.inclusive?">=":">",i=t(o.origin);if(i)return`Tro malgranda: atendiĝis ke ${o.origin} havu ${n}${o.minimum.toString()} ${i.unit}`;return`Tro malgranda: atendiĝis ke ${o.origin} estu ${n}${o.minimum.toString()}`}case"invalid_format":{let n=o;if(n.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${n.prefix}"`;if(n.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${n.suffix}"`;if(n.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${n.includes}"`;if(n.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${n.pattern}`;return`Nevalida ${r[n.format]??o.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${o.divisor}`;case"unrecognized_keys":return`Nekonata${o.keys.length>1?"j":""} ŝlosilo${o.keys.length>1?"j":""}: ${T(o.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${o.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${o.origin}`;default:return"Nevalida enigo"}}};function l_(){return{localeError:qZ()}}var ZZ=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"número";case"object":{if(Array.isArray(n))return"arreglo";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype)return n.constructor.name}}return i},o={regex:"entrada",email:"dirección de correo electrónico",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:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(n)=>{switch(n.code){case"invalid_type":return`Entrada inválida: se esperaba ${n.expected}, recibido ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Entrada inválida: se esperaba ${N(n.values[0])}`;return`Opción inválida: se esperaba una de ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Demasiado grande: se esperaba que ${n.origin??"valor"} tuviera ${i}${n.maximum.toString()} ${s.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${n.origin??"valor"} fuera ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Demasiado pequeño: se esperaba que ${n.origin} tuviera ${i}${n.minimum.toString()} ${s.unit}`;return`Demasiado pequeño: se esperaba que ${n.origin} fuera ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Cadena inválida: debe comenzar con "${i.prefix}"`;if(i.format==="ends_with")return`Cadena inválida: debe terminar en "${i.suffix}"`;if(i.format==="includes")return`Cadena inválida: debe incluir "${i.includes}"`;if(i.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${i.pattern}`;return`Inválido ${o[i.format]??n.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${T(n.keys,", ")}`;case"invalid_key":return`Llave inválida en ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${n.origin}`;default:return"Entrada inválida"}}};function u_(){return{localeError:ZZ()}}var VZ=()=>{let e={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"آرایه";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return(n)=>{switch(n.code){case"invalid_type":return`ورودی نامعتبر: می‌بایست ${n.expected} می‌بود، ${r(n.input)} دریافت شد`;case"invalid_value":if(n.values.length===1)return`ورودی نامعتبر: می‌بایست ${N(n.values[0])} می‌بود`;return`گزینه نامعتبر: می‌بایست یکی از ${T(n.values,"|")} می‌بود`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`خیلی بزرگ: ${n.origin??"مقدار"} باید ${i}${n.maximum.toString()} ${s.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${n.origin??"مقدار"} باید ${i}${n.maximum.toString()} باشد`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`خیلی کوچک: ${n.origin} باید ${i}${n.minimum.toString()} ${s.unit} باشد`;return`خیلی کوچک: ${n.origin} باید ${i}${n.minimum.toString()} باشد`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`رشته نامعتبر: باید با "${i.prefix}" شروع شود`;if(i.format==="ends_with")return`رشته نامعتبر: باید با "${i.suffix}" تمام شود`;if(i.format==="includes")return`رشته نامعتبر: باید شامل "${i.includes}" باشد`;if(i.format==="regex")return`رشته نامعتبر: باید با الگوی ${i.pattern} مطابقت داشته باشد`;return`${o[i.format]??n.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${n.divisor} باشد`;case"unrecognized_keys":return`کلید${n.keys.length>1?"های":""} ناشناس: ${T(n.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${n.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${n.origin}`;default:return"ورودی نامعتبر"}}};function d_(){return{localeError:VZ()}}var WZ=()=>{let e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return(n)=>{switch(n.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${n.expected}, oli ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Virheellinen syöte: täytyy olla ${N(n.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Liian suuri: ${s.subject} täytyy olla ${i}${n.maximum.toString()} ${s.unit}`.trim();return`Liian suuri: arvon täytyy olla ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Liian pieni: ${s.subject} täytyy olla ${i}${n.minimum.toString()} ${s.unit}`.trim();return`Liian pieni: arvon täytyy olla ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${i.prefix}"`;if(i.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${i.suffix}"`;if(i.format==="includes")return`Virheellinen syöte: täytyy sisältää "${i.includes}"`;if(i.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${i.pattern}`;return`Virheellinen ${o[i.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${T(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function p_(){return{localeError:WZ()}}var KZ=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"nombre";case"object":{if(Array.isArray(n))return"tableau";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"entrée",email:"adresse e-mail",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:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(n)=>{switch(n.code){case"invalid_type":return`Entrée invalide : ${n.expected} attendu, ${r(n.input)} reçu`;case"invalid_value":if(n.values.length===1)return`Entrée invalide : ${N(n.values[0])} attendu`;return`Option invalide : une valeur parmi ${T(n.values,"|")} attendue`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Trop grand : ${n.origin??"valeur"} doit ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"élément(s)"}`;return`Trop grand : ${n.origin??"valeur"} doit être ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Trop petit : ${n.origin} doit ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Trop petit : ${n.origin} doit être ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Chaîne invalide : doit commencer par "${i.prefix}"`;if(i.format==="ends_with")return`Chaîne invalide : doit se terminer par "${i.suffix}"`;if(i.format==="includes")return`Chaîne invalide : doit inclure "${i.includes}"`;if(i.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${i.pattern}`;return`${o[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${T(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function f_(){return{localeError:KZ()}}var GZ=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"entrée",email:"adresse courriel",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:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(n)=>{switch(n.code){case"invalid_type":return`Entrée invalide : attendu ${n.expected}, reçu ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Entrée invalide : attendu ${N(n.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"≤":"<",s=t(n.origin);if(s)return`Trop grand : attendu que ${n.origin??"la valeur"} ait ${i}${n.maximum.toString()} ${s.unit}`;return`Trop grand : attendu que ${n.origin??"la valeur"} soit ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"≥":">",s=t(n.origin);if(s)return`Trop petit : attendu que ${n.origin} ait ${i}${n.minimum.toString()} ${s.unit}`;return`Trop petit : attendu que ${n.origin} soit ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Chaîne invalide : doit commencer par "${i.prefix}"`;if(i.format==="ends_with")return`Chaîne invalide : doit se terminer par "${i.suffix}"`;if(i.format==="includes")return`Chaîne invalide : doit inclure "${i.includes}"`;if(i.format==="regex")return`Chaîne invalide : doit correspondre au motif ${i.pattern}`;return`${o[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${T(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function m_(){return{localeError:GZ()}}var JZ=()=>{let e={string:{unit:"אותיות",verb:"לכלול"},file:{unit:"בייטים",verb:"לכלול"},array:{unit:"פריטים",verb:"לכלול"},set:{unit:"פריטים",verb:"לכלול"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"קלט",email:"כתובת אימייל",url:"כתובת רשת",emoji:"אימוג'י",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"תאריך וזמן ISO",date:"תאריך ISO",time:"זמן ISO",duration:"משך זמן ISO",ipv4:"כתובת IPv4",ipv6:"כתובת IPv6",cidrv4:"טווח IPv4",cidrv6:"טווח IPv6",base64:"מחרוזת בבסיס 64",base64url:"מחרוזת בבסיס 64 לכתובות רשת",json_string:"מחרוזת JSON",e164:"מספר E.164",jwt:"JWT",template_literal:"קלט"};return(n)=>{switch(n.code){case"invalid_type":return`קלט לא תקין: צריך ${n.expected}, התקבל ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`קלט לא תקין: צריך ${N(n.values[0])}`;return`קלט לא תקין: צריך אחת מהאפשרויות ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`גדול מדי: ${n.origin??"value"} צריך להיות ${i}${n.maximum.toString()} ${s.unit??"elements"}`;return`גדול מדי: ${n.origin??"value"} צריך להיות ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`קטן מדי: ${n.origin} צריך להיות ${i}${n.minimum.toString()} ${s.unit}`;return`קטן מדי: ${n.origin} צריך להיות ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`מחרוזת לא תקינה: חייבת להתחיל ב"${i.prefix}"`;if(i.format==="ends_with")return`מחרוזת לא תקינה: חייבת להסתיים ב "${i.suffix}"`;if(i.format==="includes")return`מחרוזת לא תקינה: חייבת לכלול "${i.includes}"`;if(i.format==="regex")return`מחרוזת לא תקינה: חייבת להתאים לתבנית ${i.pattern}`;return`${o[i.format]??n.format} לא תקין`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${n.divisor}`;case"unrecognized_keys":return`מפתח${n.keys.length>1?"ות":""} לא מזוה${n.keys.length>1?"ים":"ה"}: ${T(n.keys,", ")}`;case"invalid_key":return`מפתח לא תקין ב${n.origin}`;case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${n.origin}`;default:return"קלט לא תקין"}}};function g_(){return{localeError:JZ()}}var XZ=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"szám";case"object":{if(Array.isArray(n))return"tömb";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"bemenet",email:"email cím",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 időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return(n)=>{switch(n.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${n.expected}, a kapott érték ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Érvénytelen bemenet: a várt érték ${N(n.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Túl nagy: ${n.origin??"érték"} mérete túl nagy ${i}${n.maximum.toString()} ${s.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${n.origin??"érték"} túl nagy: ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Túl kicsi: a bemeneti érték ${n.origin} mérete túl kicsi ${i}${n.minimum.toString()} ${s.unit}`;return`Túl kicsi: a bemeneti érték ${n.origin} túl kicsi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Érvénytelen string: "${i.prefix}" értékkel kell kezdődnie`;if(i.format==="ends_with")return`Érvénytelen string: "${i.suffix}" értékkel kell végződnie`;if(i.format==="includes")return`Érvénytelen string: "${i.includes}" értéket kell tartalmaznia`;if(i.format==="regex")return`Érvénytelen string: ${i.pattern} mintának kell megfelelnie`;return`Érvénytelen ${o[i.format]??n.format}`}case"not_multiple_of":return`Érvénytelen szám: ${n.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${T(n.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${n.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${n.origin}`;default:return"Érvénytelen bemenet"}}};function h_(){return{localeError:XZ()}}var YZ=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"alamat email",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:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`Input tidak valid: diharapkan ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Input tidak valid: diharapkan ${N(n.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${i}${n.maximum.toString()} ${s.unit??"elemen"}`;return`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Terlalu kecil: diharapkan ${n.origin} memiliki ${i}${n.minimum.toString()} ${s.unit}`;return`Terlalu kecil: diharapkan ${n.origin} menjadi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`String tidak valid: harus dimulai dengan "${i.prefix}"`;if(i.format==="ends_with")return`String tidak valid: harus berakhir dengan "${i.suffix}"`;if(i.format==="includes")return`String tidak valid: harus menyertakan "${i.includes}"`;if(i.format==="regex")return`String tidak valid: harus sesuai pola ${i.pattern}`;return`${o[i.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${T(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};function y_(){return{localeError:YZ()}}var QZ=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"numero";case"object":{if(Array.isArray(n))return"vettore";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"indirizzo email",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:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`Input non valido: atteso ${n.expected}, ricevuto ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Input non valido: atteso ${N(n.values[0])}`;return`Opzione non valida: atteso uno tra ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Troppo grande: ${n.origin??"valore"} deve avere ${i}${n.maximum.toString()} ${s.unit??"elementi"}`;return`Troppo grande: ${n.origin??"valore"} deve essere ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Troppo piccolo: ${n.origin} deve avere ${i}${n.minimum.toString()} ${s.unit}`;return`Troppo piccolo: ${n.origin} deve essere ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Stringa non valida: deve iniziare con "${i.prefix}"`;if(i.format==="ends_with")return`Stringa non valida: deve terminare con "${i.suffix}"`;if(i.format==="includes")return`Stringa non valida: deve includere "${i.includes}"`;if(i.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${i.pattern}`;return`Invalid ${o[i.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${T(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};function b_(){return{localeError:QZ()}}var eV=()=>{let e={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"数値";case"object":{if(Array.isArray(n))return"配列";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return(n)=>{switch(n.code){case"invalid_type":return`無効な入力: ${n.expected}が期待されましたが、${r(n.input)}が入力されました`;case"invalid_value":if(n.values.length===1)return`無効な入力: ${N(n.values[0])}が期待されました`;return`無効な選択: ${T(n.values,"、")}のいずれかである必要があります`;case"too_big":{let i=n.inclusive?"以下である":"より小さい",s=t(n.origin);if(s)return`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${s.unit??"要素"}${i}必要があります`;return`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${i}必要があります`}case"too_small":{let i=n.inclusive?"以上である":"より大きい",s=t(n.origin);if(s)return`小さすぎる値: ${n.origin}は${n.minimum.toString()}${s.unit}${i}必要があります`;return`小さすぎる値: ${n.origin}は${n.minimum.toString()}${i}必要があります`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`無効な文字列: "${i.prefix}"で始まる必要があります`;if(i.format==="ends_with")return`無効な文字列: "${i.suffix}"で終わる必要があります`;if(i.format==="includes")return`無効な文字列: "${i.includes}"を含む必要があります`;if(i.format==="regex")return`無効な文字列: パターン${i.pattern}に一致する必要があります`;return`無効な${o[i.format]??n.format}`}case"not_multiple_of":return`無効な数値: ${n.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${n.keys.length>1?"群":""}: ${T(n.keys,"、")}`;case"invalid_key":return`${n.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${n.origin}内の無効な値`;default:return"無効な入力"}}};function __(){return{localeError:eV()}}var tV=()=>{let e={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(n))return"អារេ (Array)";if(n===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return(n)=>{switch(n.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${n.expected} ប៉ុន្តែទទួលបាន ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${N(n.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${i} ${n.maximum.toString()} ${s.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`តូចពេក៖ ត្រូវការ ${n.origin} ${i} ${n.minimum.toString()} ${s.unit}`;return`តូចពេក៖ ត្រូវការ ${n.origin} ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${i.prefix}"`;if(i.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${i.suffix}"`;if(i.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${i.includes}"`;if(i.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${i.pattern}`;return`មិនត្រឹមត្រូវ៖ ${o[i.format]??n.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${n.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${T(n.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function v_(){return{localeError:tV()}}var rV=()=>{let e={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return(n)=>{switch(n.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${n.expected}, 받은 타입은 ${r(n.input)}입니다`;case"invalid_value":if(n.values.length===1)return`잘못된 입력: 값은 ${N(n.values[0])} 이어야 합니다`;return`잘못된 옵션: ${T(n.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let i=n.inclusive?"이하":"미만",s=i==="미만"?"이어야 합니다":"여야 합니다",a=t(n.origin),c=a?.unit??"요소";if(a)return`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()}${c} ${i}${s}`;return`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()} ${i}${s}`}case"too_small":{let i=n.inclusive?"이상":"초과",s=i==="이상"?"이어야 합니다":"여야 합니다",a=t(n.origin),c=a?.unit??"요소";if(a)return`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()}${c} ${i}${s}`;return`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()} ${i}${s}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`잘못된 문자열: "${i.prefix}"(으)로 시작해야 합니다`;if(i.format==="ends_with")return`잘못된 문자열: "${i.suffix}"(으)로 끝나야 합니다`;if(i.format==="includes")return`잘못된 문자열: "${i.includes}"을(를) 포함해야 합니다`;if(i.format==="regex")return`잘못된 문자열: 정규식 ${i.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${o[i.format]??n.format}`}case"not_multiple_of":return`잘못된 숫자: ${n.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${T(n.keys,", ")}`;case"invalid_key":return`잘못된 키: ${n.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${n.origin}`;default:return"잘못된 입력"}}};function S_(){return{localeError:rV()}}var nV=()=>{let e={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"број";case"object":{if(Array.isArray(n))return"низа";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return(n)=>{switch(n.code){case"invalid_type":return`Грешен внес: се очекува ${n.expected}, примено ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${N(n.values[0])}`;return`Грешана опција: се очекува една ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Премногу голем: се очекува ${n.origin??"вредноста"} да има ${i}${n.maximum.toString()} ${s.unit??"елементи"}`;return`Премногу голем: се очекува ${n.origin??"вредноста"} да биде ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Премногу мал: се очекува ${n.origin} да има ${i}${n.minimum.toString()} ${s.unit}`;return`Премногу мал: се очекува ${n.origin} да биде ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Неважечка низа: мора да започнува со "${i.prefix}"`;if(i.format==="ends_with")return`Неважечка низа: мора да завршува со "${i.suffix}"`;if(i.format==="includes")return`Неважечка низа: мора да вклучува "${i.includes}"`;if(i.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${i.pattern}`;return`Invalid ${o[i.format]??n.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${T(n.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${n.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${n.origin}`;default:return"Грешен внес"}}};function x_(){return{localeError:nV()}}var oV=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"nombor";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"alamat e-mel",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:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`Input tidak sah: dijangka ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Input tidak sah: dijangka ${N(n.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Terlalu besar: dijangka ${n.origin??"nilai"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"elemen"}`;return`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Terlalu kecil: dijangka ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Terlalu kecil: dijangka ${n.origin} adalah ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`String tidak sah: mesti bermula dengan "${i.prefix}"`;if(i.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${i.suffix}"`;if(i.format==="includes")return`String tidak sah: mesti mengandungi "${i.includes}"`;if(i.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${i.pattern}`;return`${o[i.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${T(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};function w_(){return{localeError:oV()}}var iV=()=>{let e={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"getal";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"invoer",email:"emailadres",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 datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return(n)=>{switch(n.code){case"invalid_type":return`Ongeldige invoer: verwacht ${n.expected}, ontving ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Ongeldige invoer: verwacht ${N(n.values[0])}`;return`Ongeldige optie: verwacht één van ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Te lang: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} ${s.unit??"elementen"} bevat`;return`Te lang: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} is`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Te kort: verwacht dat ${n.origin} ${i}${n.minimum.toString()} ${s.unit} bevat`;return`Te kort: verwacht dat ${n.origin} ${i}${n.minimum.toString()} is`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ongeldige tekst: moet met "${i.prefix}" beginnen`;if(i.format==="ends_with")return`Ongeldige tekst: moet op "${i.suffix}" eindigen`;if(i.format==="includes")return`Ongeldige tekst: moet "${i.includes}" bevatten`;if(i.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`;return`Ongeldig: ${o[i.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${T(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};function k_(){return{localeError:iV()}}var sV=()=>{let e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"tall";case"object":{if(Array.isArray(n))return"liste";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"e-postadresse",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 dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`Ugyldig input: forventet ${n.expected}, fikk ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Ugyldig verdi: forventet ${N(n.values[0])}`;return`Ugyldig valg: forventet en av ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`For stor(t): forventet ${n.origin??"value"} til å ha ${i}${n.maximum.toString()} ${s.unit??"elementer"}`;return`For stor(t): forventet ${n.origin??"value"} til å ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`For lite(n): forventet ${n.origin} til å ha ${i}${n.minimum.toString()} ${s.unit}`;return`For lite(n): forventet ${n.origin} til å ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ugyldig streng: må starte med "${i.prefix}"`;if(i.format==="ends_with")return`Ugyldig streng: må ende med "${i.suffix}"`;if(i.format==="includes")return`Ugyldig streng: må inneholde "${i.includes}"`;if(i.format==="regex")return`Ugyldig streng: må matche mønsteret ${i.pattern}`;return`Ugyldig ${o[i.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${T(n.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function E_(){return{localeError:sV()}}var aV=()=>{let e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"numara";case"object":{if(Array.isArray(n))return"saf";if(n===null)return"gayb";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"giren",email:"epostagâh",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 hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return(n)=>{switch(n.code){case"invalid_type":return`Fâsit giren: umulan ${n.expected}, alınan ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Fâsit giren: umulan ${N(n.values[0])}`;return`Fâsit tercih: mûteberler ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Fazla büyük: ${n.origin??"value"}, ${i}${n.maximum.toString()} ${s.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${n.origin??"value"}, ${i}${n.maximum.toString()} olmalıydı.`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Fazla küçük: ${n.origin}, ${i}${n.minimum.toString()} ${s.unit} sahip olmalıydı.`;return`Fazla küçük: ${n.origin}, ${i}${n.minimum.toString()} olmalıydı.`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Fâsit metin: "${i.prefix}" ile başlamalı.`;if(i.format==="ends_with")return`Fâsit metin: "${i.suffix}" ile bitmeli.`;if(i.format==="includes")return`Fâsit metin: "${i.includes}" ihtivâ etmeli.`;if(i.format==="regex")return`Fâsit metin: ${i.pattern} nakşına uymalı.`;return`Fâsit ${o[i.format]??n.format}`}case"not_multiple_of":return`Fâsit sayı: ${n.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${n.keys.length>1?"s":""}: ${T(n.keys,", ")}`;case"invalid_key":return`${n.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${n.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function T_(){return{localeError:aV()}}var cV=()=>{let e={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"ارې";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return(n)=>{switch(n.code){case"invalid_type":return`ناسم ورودي: باید ${n.expected} وای, مګر ${r(n.input)} ترلاسه شو`;case"invalid_value":if(n.values.length===1)return`ناسم ورودي: باید ${N(n.values[0])} وای`;return`ناسم انتخاب: باید یو له ${T(n.values,"|")} څخه وای`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`ډیر لوی: ${n.origin??"ارزښت"} باید ${i}${n.maximum.toString()} ${s.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${n.origin??"ارزښت"} باید ${i}${n.maximum.toString()} وي`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`ډیر کوچنی: ${n.origin} باید ${i}${n.minimum.toString()} ${s.unit} ولري`;return`ډیر کوچنی: ${n.origin} باید ${i}${n.minimum.toString()} وي`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`ناسم متن: باید د "${i.prefix}" سره پیل شي`;if(i.format==="ends_with")return`ناسم متن: باید د "${i.suffix}" سره پای ته ورسيږي`;if(i.format==="includes")return`ناسم متن: باید "${i.includes}" ولري`;if(i.format==="regex")return`ناسم متن: باید د ${i.pattern} سره مطابقت ولري`;return`${o[i.format]??n.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${n.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${n.keys.length>1?"کلیډونه":"کلیډ"}: ${T(n.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${n.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${n.origin} کې`;default:return"ناسمه ورودي"}}};function P_(){return{localeError:cV()}}var lV=()=>{let e={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"liczba";case"object":{if(Array.isArray(n))return"tablica";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"wyrażenie",email:"adres email",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:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return(n)=>{switch(n.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${n.expected}, otrzymano ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${N(n.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Za duża wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${i}${n.maximum.toString()} ${s.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Za mała wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${i}${n.minimum.toString()} ${s.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${i.prefix}"`;if(i.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${i.suffix}"`;if(i.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${i.includes}"`;if(i.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${i.pattern}`;return`Nieprawidłow(y/a/e) ${o[i.format]??n.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${T(n.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${n.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${n.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function I_(){return{localeError:lV()}}var uV=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"número";case"object":{if(Array.isArray(n))return"array";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"padrão",email:"endereço de e-mail",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:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(n)=>{switch(n.code){case"invalid_type":return`Tipo inválido: esperado ${n.expected}, recebido ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Entrada inválida: esperado ${N(n.values[0])}`;return`Opção inválida: esperada uma das ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Muito grande: esperado que ${n.origin??"valor"} tivesse ${i}${n.maximum.toString()} ${s.unit??"elementos"}`;return`Muito grande: esperado que ${n.origin??"valor"} fosse ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Muito pequeno: esperado que ${n.origin} tivesse ${i}${n.minimum.toString()} ${s.unit}`;return`Muito pequeno: esperado que ${n.origin} fosse ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Texto inválido: deve começar com "${i.prefix}"`;if(i.format==="ends_with")return`Texto inválido: deve terminar com "${i.suffix}"`;if(i.format==="includes")return`Texto inválido: deve incluir "${i.includes}"`;if(i.format==="regex")return`Texto inválido: deve corresponder ao padrão ${i.pattern}`;return`${o[i.format]??n.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${T(n.keys,", ")}`;case"invalid_key":return`Chave inválida em ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${n.origin}`;default:return"Campo inválido"}}};function R_(){return{localeError:uV()}}function z0(e,t,r,o){let n=Math.abs(e),i=n%10,s=n%100;if(s>=11&&s<=19)return o;if(i===1)return t;if(i>=2&&i<=4)return r;return o}var dV=()=>{let e={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"массив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return(n)=>{switch(n.code){case"invalid_type":return`Неверный ввод: ожидалось ${n.expected}, получено ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Неверный ввод: ожидалось ${N(n.values[0])}`;return`Неверный вариант: ожидалось одно из ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),c=z0(a,s.unit.one,s.unit.few,s.unit.many);return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет иметь ${i}${n.maximum.toString()} ${c}`}return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),c=z0(a,s.unit.one,s.unit.few,s.unit.many);return`Слишком маленькое значение: ожидалось, что ${n.origin} будет иметь ${i}${n.minimum.toString()} ${c}`}return`Слишком маленькое значение: ожидалось, что ${n.origin} будет ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Неверная строка: должна начинаться с "${i.prefix}"`;if(i.format==="ends_with")return`Неверная строка: должна заканчиваться на "${i.suffix}"`;if(i.format==="includes")return`Неверная строка: должна содержать "${i.includes}"`;if(i.format==="regex")return`Неверная строка: должна соответствовать шаблону ${i.pattern}`;return`Неверный ${o[i.format]??n.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспознанн${n.keys.length>1?"ые":"ый"} ключ${n.keys.length>1?"и":""}: ${T(n.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${n.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${n.origin}`;default:return"Неверные входные данные"}}};function $_(){return{localeError:dV()}}var pV=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"število";case"object":{if(Array.isArray(n))return"tabela";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"vnos",email:"e-poštni naslov",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 datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return(n)=>{switch(n.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${n.expected}, prejeto ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Neveljaven vnos: pričakovano ${N(n.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} imelo ${i}${n.maximum.toString()} ${s.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Premajhno: pričakovano, da bo ${n.origin} imelo ${i}${n.minimum.toString()} ${s.unit}`;return`Premajhno: pričakovano, da bo ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Neveljaven niz: mora se začeti z "${i.prefix}"`;if(i.format==="ends_with")return`Neveljaven niz: mora se končati z "${i.suffix}"`;if(i.format==="includes")return`Neveljaven niz: mora vsebovati "${i.includes}"`;if(i.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`;return`Neveljaven ${o[i.format]??n.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i ključi":" ključ"}: ${T(n.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function O_(){return{localeError:pV()}}var fV=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"antal";case"object":{if(Array.isArray(n))return"lista";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"reguljärt uttryck",email:"e-postadress",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-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return(n)=>{switch(n.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${n.expected}, fick ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Ogiltig inmatning: förväntat ${N(n.values[0])}`;return`Ogiltigt val: förväntade en av ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`För stor(t): förväntade ${n.origin??"värdet"} att ha ${i}${n.maximum.toString()} ${s.unit??"element"}`;return`För stor(t): förväntat ${n.origin??"värdet"} att ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`För lite(t): förväntade ${n.origin??"värdet"} att ha ${i}${n.minimum.toString()} ${s.unit}`;return`För lite(t): förväntade ${n.origin??"värdet"} att ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ogiltig sträng: måste börja med "${i.prefix}"`;if(i.format==="ends_with")return`Ogiltig sträng: måste sluta med "${i.suffix}"`;if(i.format==="includes")return`Ogiltig sträng: måste innehålla "${i.includes}"`;if(i.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${i.pattern}"`;return`Ogiltig(t) ${o[i.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${T(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${n.origin??"värdet"}`;default:return"Ogiltig input"}}};function A_(){return{localeError:fV()}}var mV=()=>{let e={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(n))return"அணி";if(n===null)return"வெறுமை";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",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 தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${n.expected}, பெறப்பட்டது ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${N(n.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${T(n.values,"|")} இல் ஒன்று`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${i}${n.maximum.toString()} ${s.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${i}${n.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${i}${n.minimum.toString()} ${s.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${i}${n.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`தவறான சரம்: "${i.prefix}" இல் தொடங்க வேண்டும்`;if(i.format==="ends_with")return`தவறான சரம்: "${i.suffix}" இல் முடிவடைய வேண்டும்`;if(i.format==="includes")return`தவறான சரம்: "${i.includes}" ஐ உள்ளடக்க வேண்டும்`;if(i.format==="regex")return`தவறான சரம்: ${i.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${o[i.format]??n.format}`}case"not_multiple_of":return`தவறான எண்: ${n.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${n.keys.length>1?"கள்":""}: ${T(n.keys,", ")}`;case"invalid_key":return`${n.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${n.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function C_(){return{localeError:mV()}}var gV=()=>{let e={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(n))return"อาร์เรย์ (Array)";if(n===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return(n)=>{switch(n.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${n.expected} แต่ได้รับ ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${N(n.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"ไม่เกิน":"น้อยกว่า",s=t(n.origin);if(s)return`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${i} ${n.maximum.toString()} ${s.unit??"รายการ"}`;return`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"อย่างน้อย":"มากกว่า",s=t(n.origin);if(s)return`น้อยกว่ากำหนด: ${n.origin} ควรมี${i} ${n.minimum.toString()} ${s.unit}`;return`น้อยกว่ากำหนด: ${n.origin} ควรมี${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${i.prefix}"`;if(i.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${i.suffix}"`;if(i.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${i.includes}" อยู่ในข้อความ`;if(i.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${i.pattern}`;return`รูปแบบไม่ถูกต้อง: ${o[i.format]??n.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${n.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${T(n.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${n.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${n.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function M_(){return{localeError:gV()}}var hV=(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},yV=()=>{let e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function t(o){return e[o]??null}let r={regex:"girdi",email:"e-posta adresi",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 tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return(o)=>{switch(o.code){case"invalid_type":return`Geçersiz değer: beklenen ${o.expected}, alınan ${hV(o.input)}`;case"invalid_value":if(o.values.length===1)return`Geçersiz değer: beklenen ${N(o.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${T(o.values,"|")}`;case"too_big":{let n=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Çok büyük: beklenen ${o.origin??"değer"} ${n}${o.maximum.toString()} ${i.unit??"öğe"}`;return`Çok büyük: beklenen ${o.origin??"değer"} ${n}${o.maximum.toString()}`}case"too_small":{let n=o.inclusive?">=":">",i=t(o.origin);if(i)return`Çok küçük: beklenen ${o.origin} ${n}${o.minimum.toString()} ${i.unit}`;return`Çok küçük: beklenen ${o.origin} ${n}${o.minimum.toString()}`}case"invalid_format":{let n=o;if(n.format==="starts_with")return`Geçersiz metin: "${n.prefix}" ile başlamalı`;if(n.format==="ends_with")return`Geçersiz metin: "${n.suffix}" ile bitmeli`;if(n.format==="includes")return`Geçersiz metin: "${n.includes}" içermeli`;if(n.format==="regex")return`Geçersiz metin: ${n.pattern} desenine uymalı`;return`Geçersiz ${r[n.format]??o.format}`}case"not_multiple_of":return`Geçersiz sayı: ${o.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${o.keys.length>1?"lar":""}: ${T(o.keys,", ")}`;case"invalid_key":return`${o.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${o.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function N_(){return{localeError:yV()}}var bV=()=>{let e={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"масив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return(n)=>{switch(n.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${n.expected}, отримано ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Неправильні вхідні дані: очікується ${N(n.values[0])}`;return`Неправильна опція: очікується одне з ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Занадто велике: очікується, що ${n.origin??"значення"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"елементів"}`;return`Занадто велике: очікується, що ${n.origin??"значення"} буде ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Занадто мале: очікується, що ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Занадто мале: очікується, що ${n.origin} буде ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Неправильний рядок: повинен починатися з "${i.prefix}"`;if(i.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${i.suffix}"`;if(i.format==="includes")return`Неправильний рядок: повинен містити "${i.includes}"`;if(i.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${i.pattern}`;return`Неправильний ${o[i.format]??n.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${n.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${n.keys.length>1?"і":""}: ${T(n.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${n.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${n.origin}`;default:return"Неправильні вхідні дані"}}};function D_(){return{localeError:bV()}}var _V=()=>{let e={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"نمبر";case"object":{if(Array.isArray(n))return"آرے";if(n===null)return"نل";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return(n)=>{switch(n.code){case"invalid_type":return`غلط ان پٹ: ${n.expected} متوقع تھا، ${r(n.input)} موصول ہوا`;case"invalid_value":if(n.values.length===1)return`غلط ان پٹ: ${N(n.values[0])} متوقع تھا`;return`غلط آپشن: ${T(n.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`بہت بڑا: ${n.origin??"ویلیو"} کے ${i}${n.maximum.toString()} ${s.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${n.origin??"ویلیو"} کا ${i}${n.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`بہت چھوٹا: ${n.origin} کے ${i}${n.minimum.toString()} ${s.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${n.origin} کا ${i}${n.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`غلط سٹرنگ: "${i.prefix}" سے شروع ہونا چاہیے`;if(i.format==="ends_with")return`غلط سٹرنگ: "${i.suffix}" پر ختم ہونا چاہیے`;if(i.format==="includes")return`غلط سٹرنگ: "${i.includes}" شامل ہونا چاہیے`;if(i.format==="regex")return`غلط سٹرنگ: پیٹرن ${i.pattern} سے میچ ہونا چاہیے`;return`غلط ${o[i.format]??n.format}`}case"not_multiple_of":return`غلط نمبر: ${n.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${n.keys.length>1?"ز":""}: ${T(n.keys,"، ")}`;case"invalid_key":return`${n.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${n.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function j_(){return{localeError:_V()}}var vV=()=>{let e={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"số";case"object":{if(Array.isArray(n))return"mảng";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"đầu vào",email:"địa chỉ email",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:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return(n)=>{switch(n.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${n.expected}, nhận được ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${N(n.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Quá lớn: mong đợi ${n.origin??"giá trị"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"phần tử"}`;return`Quá lớn: mong đợi ${n.origin??"giá trị"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Quá nhỏ: mong đợi ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Quá nhỏ: mong đợi ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${i.prefix}"`;if(i.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${i.suffix}"`;if(i.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${i.includes}"`;if(i.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${i.pattern}`;return`${o[i.format]??n.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${n.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${T(n.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${n.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${n.origin}`;default:return"Đầu vào không hợp lệ"}}};function z_(){return{localeError:vV()}}var SV=()=>{let e={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(n))return"数组";if(n===null)return"空值(null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return(n)=>{switch(n.code){case"invalid_type":return`无效输入:期望 ${n.expected},实际接收 ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`无效输入:期望 ${N(n.values[0])}`;return`无效选项:期望以下之一 ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`数值过大:期望 ${n.origin??"值"} ${i}${n.maximum.toString()} ${s.unit??"个元素"}`;return`数值过大:期望 ${n.origin??"值"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`数值过小:期望 ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`;return`数值过小:期望 ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`无效字符串:必须以 "${i.prefix}" 开头`;if(i.format==="ends_with")return`无效字符串:必须以 "${i.suffix}" 结尾`;if(i.format==="includes")return`无效字符串:必须包含 "${i.includes}"`;if(i.format==="regex")return`无效字符串:必须满足正则表达式 ${i.pattern}`;return`无效${o[i.format]??n.format}`}case"not_multiple_of":return`无效数字:必须是 ${n.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${T(n.keys,", ")}`;case"invalid_key":return`${n.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${n.origin} 中包含无效值(value)`;default:return"无效输入"}}};function U_(){return{localeError:SV()}}var xV=()=>{let e={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function t(n){return e[n]??null}let r=(n)=>{let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"輸入",email:"郵件地址",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 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return(n)=>{switch(n.code){case"invalid_type":return`無效的輸入值:預期為 ${n.expected},但收到 ${r(n.input)}`;case"invalid_value":if(n.values.length===1)return`無效的輸入值:預期為 ${N(n.values[0])}`;return`無效的選項:預期為以下其中之一 ${T(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`數值過大:預期 ${n.origin??"值"} 應為 ${i}${n.maximum.toString()} ${s.unit??"個元素"}`;return`數值過大:預期 ${n.origin??"值"} 應為 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`數值過小:預期 ${n.origin} 應為 ${i}${n.minimum.toString()} ${s.unit}`;return`數值過小:預期 ${n.origin} 應為 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`無效的字串:必須以 "${i.prefix}" 開頭`;if(i.format==="ends_with")return`無效的字串:必須以 "${i.suffix}" 結尾`;if(i.format==="includes")return`無效的字串:必須包含 "${i.includes}"`;if(i.format==="regex")return`無效的字串:必須符合格式 ${i.pattern}`;return`無效的 ${o[i.format]??n.format}`}case"not_multiple_of":return`無效的數字:必須為 ${n.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${n.keys.length>1?"們":""}:${T(n.keys,"、")}`;case"invalid_key":return`${n.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${n.origin} 中有無效的值`;default:return"無效的輸入值"}}};function L_(){return{localeError:xV()}}var ef=Symbol("ZodOutput"),tf=Symbol("ZodInput");class Pc{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r){if(this._idmap.has(r.id))throw Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};return delete r.id,{...r,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function Ic(){return new Pc}var Et=Ic();function rf(e,t){return new e({type:"string",...$(t)})}function F_(e,t){return new e({type:"string",coerce:!0,...$(t)})}function Rc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...$(t)})}function Yi(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...$(t)})}function $c(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...$(t)})}function Oc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...$(t)})}function Ac(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...$(t)})}function Cc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...$(t)})}function Mc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...$(t)})}function Nc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...$(t)})}function Dc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...$(t)})}function jc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...$(t)})}function zc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...$(t)})}function Uc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...$(t)})}function Lc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...$(t)})}function Fc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...$(t)})}function Hc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...$(t)})}function Bc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...$(t)})}function qc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...$(t)})}function Zc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...$(t)})}function Vc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...$(t)})}function Wc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...$(t)})}function Kc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...$(t)})}function Gc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...$(t)})}var nf={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function H_(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...$(t)})}function B_(e,t){return new e({type:"string",format:"date",check:"string_format",...$(t)})}function q_(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...$(t)})}function Z_(e,t){return new e({type:"string",format:"duration",check:"string_format",...$(t)})}function of(e,t){return new e({type:"number",checks:[],...$(t)})}function V_(e,t){return new e({type:"number",coerce:!0,checks:[],...$(t)})}function sf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...$(t)})}function af(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...$(t)})}function cf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...$(t)})}function lf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...$(t)})}function uf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...$(t)})}function df(e,t){return new e({type:"boolean",...$(t)})}function W_(e,t){return new e({type:"boolean",coerce:!0,...$(t)})}function pf(e,t){return new e({type:"bigint",...$(t)})}function K_(e,t){return new e({type:"bigint",coerce:!0,...$(t)})}function ff(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...$(t)})}function mf(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...$(t)})}function gf(e,t){return new e({type:"symbol",...$(t)})}function hf(e,t){return new e({type:"undefined",...$(t)})}function yf(e,t){return new e({type:"null",...$(t)})}function bf(e){return new e({type:"any"})}function Co(e){return new e({type:"unknown"})}function _f(e,t){return new e({type:"never",...$(t)})}function vf(e,t){return new e({type:"void",...$(t)})}function Sf(e,t){return new e({type:"date",...$(t)})}function G_(e,t){return new e({type:"date",coerce:!0,...$(t)})}function xf(e,t){return new e({type:"nan",...$(t)})}function Jr(e,t){return new Qd({check:"less_than",...$(t),value:e,inclusive:!1})}function Jt(e,t){return new Qd({check:"less_than",...$(t),value:e,inclusive:!0})}function Xr(e,t){return new ep({check:"greater_than",...$(t),value:e,inclusive:!1})}function Tt(e,t){return new ep({check:"greater_than",...$(t),value:e,inclusive:!0})}function J_(e){return Xr(0,e)}function X_(e){return Jr(0,e)}function Y_(e){return Jt(0,e)}function Q_(e){return Tt(0,e)}function Mo(e,t){return new Ab({check:"multiple_of",...$(t),value:e})}function Qi(e,t){return new Nb({check:"max_size",...$(t),maximum:e})}function No(e,t){return new Db({check:"min_size",...$(t),minimum:e})}function Jc(e,t){return new jb({check:"size_equals",...$(t),size:e})}function es(e,t){return new zb({check:"max_length",...$(t),maximum:e})}function Mn(e,t){return new Ub({check:"min_length",...$(t),minimum:e})}function ts(e,t){return new Lb({check:"length_equals",...$(t),length:e})}function Xc(e,t){return new Fb({check:"string_format",format:"regex",...$(t),pattern:e})}function Yc(e){return new Hb({check:"string_format",format:"lowercase",...$(e)})}function Qc(e){return new Bb({check:"string_format",format:"uppercase",...$(e)})}function el(e,t){return new qb({check:"string_format",format:"includes",...$(t),includes:e})}function tl(e,t){return new Zb({check:"string_format",format:"starts_with",...$(t),prefix:e})}function rl(e,t){return new Vb({check:"string_format",format:"ends_with",...$(t),suffix:e})}function ev(e,t,r){return new Wb({check:"property",property:e,schema:t,...$(r)})}function nl(e,t){return new Kb({check:"mime_type",mime:e,...$(t)})}function Yr(e){return new Gb({check:"overwrite",tx:e})}function ol(e){return Yr((t)=>t.normalize(e))}function il(){return Yr((e)=>e.trim())}function sl(){return Yr((e)=>e.toLowerCase())}function al(){return Yr((e)=>e.toUpperCase())}function cl(e,t,r){return new e({type:"array",element:t,...$(r)})}function wV(e,t,r){return new e({type:"union",options:t,...$(r)})}function kV(e,t,r,o){return new e({type:"union",options:r,discriminator:t,...$(o)})}function EV(e,t,r){return new e({type:"intersection",left:t,right:r})}function tv(e,t,r,o){let n=r instanceof G;return new e({type:"tuple",items:t,rest:n?r:null,...$(n?o:r)})}function TV(e,t,r,o){return new e({type:"record",keyType:t,valueType:r,...$(o)})}function PV(e,t,r,o){return new e({type:"map",keyType:t,valueType:r,...$(o)})}function IV(e,t,r){return new e({type:"set",valueType:t,...$(r)})}function RV(e,t,r){let o=Array.isArray(t)?Object.fromEntries(t.map((n)=>[n,n])):t;return new e({type:"enum",entries:o,...$(r)})}function $V(e,t,r){return new e({type:"enum",entries:t,...$(r)})}function OV(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...$(r)})}function wf(e,t){return new e({type:"file",...$(t)})}function AV(e,t){return new e({type:"transform",transform:t})}function CV(e,t){return new e({type:"optional",innerType:t})}function MV(e,t){return new e({type:"nullable",innerType:t})}function NV(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r==="function"?r():r}})}function DV(e,t,r){return new e({type:"nonoptional",innerType:t,...$(r)})}function jV(e,t){return new e({type:"success",innerType:t})}function zV(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r==="function"?r:()=>r})}function UV(e,t,r){return new e({type:"pipe",in:t,out:r})}function LV(e,t){return new e({type:"readonly",innerType:t})}function FV(e,t,r){return new e({type:"template_literal",parts:t,...$(r)})}function HV(e,t){return new e({type:"lazy",getter:t})}function BV(e,t){return new e({type:"promise",innerType:t})}function kf(e,t,r){let o=$(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Ef(e,t,r){return new e({type:"custom",check:"custom",fn:t,...$(r)})}function Tf(e,t){let r=$(t),o=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];if(r.case!=="sensitive")o=o.map((g)=>typeof g==="string"?g.toLowerCase():g),n=n.map((g)=>typeof g==="string"?g.toLowerCase():g);let i=new Set(o),s=new Set(n),a=e.Pipe??Ji,c=e.Boolean??Wi,u=e.String??An,p=new(e.Transform??Gi)({type:"transform",transform:(g,h)=>{let y=g;if(r.case!=="sensitive")y=y.toLowerCase();if(i.has(y))return!0;else if(s.has(y))return!1;else return h.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:h.value,inst:p}),{}},error:r.error}),f=new a({type:"pipe",in:new u({type:"string",error:r.error}),out:p,error:r.error});return new a({type:"pipe",in:f,out:new c({type:"boolean",error:r.error}),error:r.error})}function Pf(e,t,r,o={}){let n=$(o),i={...$(o),check:"string_format",type:"string",format:t,fn:typeof r==="function"?r:(a)=>r.test(a),...n};if(r instanceof RegExp)i.pattern=r;return new e(i)}class rv{constructor(e){this._def=e,this.def=e}implement(e){if(typeof e!=="function")throw Error("implement() must be called with a function");let t=(...r)=>{let o=this._def.input?Ro(this._def.input,r,void 0,{callee:t}):r;if(!Array.isArray(o))throw Error("Invalid arguments schema: not an array or tuple schema.");let n=e(...o);return this._def.output?Ro(this._def.output,n,void 0,{callee:t}):n};return t}implementAsync(e){if(typeof e!=="function")throw Error("implement() must be called with a function");let t=async(...r)=>{let o=this._def.input?await $o(this._def.input,r,void 0,{callee:t}):r;if(!Array.isArray(o))throw Error("Invalid arguments schema: not an array or tuple schema.");let n=await e(...o);return this._def.output?$o(this._def.output,n,void 0,{callee:t}):n};return t}input(...e){let t=this.constructor;if(Array.isArray(e[0]))return new t({type:"function",input:new Cn({type:"tuple",items:e[0],rest:e[1]}),output:this._def.output});return new t({type:"function",input:e[0],output:this._def.output})}output(e){return new this.constructor({type:"function",input:this._def.input,output:e})}}function If(e){return new rv({type:"function",input:Array.isArray(e?.input)?tv(Cn,e?.input):e?.input??cl(Ki,Co(Ao)),output:e?.output??Co(Ao)})}class Rf{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Et,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 r;let o=e._zod.def,n={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i){if(i.count++,t.schemaPath.includes(e))i.cycle=t.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,s);let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let d={...t,schemaPath:[...t.schemaPath,e],path:t.path},p=e._zod.parent;if(p)s.ref=p,this.process(p,d),this.seen.get(p).isParent=!0;else{let f=s.schema;switch(o.type){case"string":{let m=f;m.type="string";let{minimum:g,maximum:h,format:y,patterns:v,contentEncoding:x}=e._zod.bag;if(typeof g==="number")m.minLength=g;if(typeof h==="number")m.maxLength=h;if(y){if(m.format=n[y]??y,m.format==="")delete m.format}if(x)m.contentEncoding=x;if(v&&v.size>0){let w=[...v];if(w.length===1)m.pattern=w[0].source;else if(w.length>1)s.schema.allOf=[...w.map((O)=>({...this.target==="draft-7"?{type:"string"}:{},pattern:O.source}))]}break}case"number":{let m=f,{minimum:g,maximum:h,format:y,multipleOf:v,exclusiveMaximum:x,exclusiveMinimum:w}=e._zod.bag;if(typeof y==="string"&&y.includes("int"))m.type="integer";else m.type="number";if(typeof w==="number")m.exclusiveMinimum=w;if(typeof g==="number"){if(m.minimum=g,typeof w==="number")if(w>=g)delete m.minimum;else delete m.exclusiveMinimum}if(typeof x==="number")m.exclusiveMaximum=x;if(typeof h==="number"){if(m.maximum=h,typeof x==="number")if(x<=h)delete m.maximum;else delete m.exclusiveMaximum}if(typeof v==="number")m.multipleOf=v;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:g,maximum:h}=e._zod.bag;if(typeof g==="number")m.minItems=g;if(typeof h==="number")m.maxItems=h;m.type="array",m.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let m=f;m.type="object",m.properties={};let g=o.shape;for(let v in g)m.properties[v]=this.process(g[v],{...d,path:[...d.path,"properties",v]});let h=new Set(Object.keys(g)),y=new Set([...h].filter((v)=>{let x=o.shape[v]._zod;if(this.io==="input")return x.optin===void 0;else return x.optout===void 0}));if(y.size>0)m.required=Array.from(y);if(o.catchall?._zod.def.type==="never")m.additionalProperties=!1;else if(!o.catchall){if(this.io==="output")m.additionalProperties=!1}else if(o.catchall)m.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]});break}case"union":{let m=f;m.anyOf=o.options.map((g,h)=>this.process(g,{...d,path:[...d.path,"anyOf",h]}));break}case"intersection":{let m=f,g=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),h=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),y=(x)=>("allOf"in x)&&Object.keys(x).length===1,v=[...y(g)?g.allOf:[g],...y(h)?h.allOf:[h]];m.allOf=v;break}case"tuple":{let m=f;m.type="array";let g=o.items.map((v,x)=>this.process(v,{...d,path:[...d.path,"prefixItems",x]}));if(this.target==="draft-2020-12")m.prefixItems=g;else m.items=g;if(o.rest){let v=this.process(o.rest,{...d,path:[...d.path,"items"]});if(this.target==="draft-2020-12")m.items=v;else m.additionalItems=v}if(o.rest)m.items=this.process(o.rest,{...d,path:[...d.path,"items"]});let{minimum:h,maximum:y}=e._zod.bag;if(typeof h==="number")m.minItems=h;if(typeof y==="number")m.maxItems=y;break}case"record":{let m=f;m.type="object",m.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]}),m.additionalProperties=this.process(o.valueType,{...d,path:[...d.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,g=gc(o.entries);if(g.every((h)=>typeof h==="number"))m.type="number";if(g.every((h)=>typeof h==="string"))m.type="string";m.enum=g;break}case"literal":{let m=f,g=[];for(let h of o.values)if(h===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof h==="bigint")if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else g.push(Number(h));else g.push(h);if(g.length===0);else if(g.length===1){let h=g[0];m.type=h===null?"null":typeof h,m.const=h}else{if(g.every((h)=>typeof h==="number"))m.type="number";if(g.every((h)=>typeof h==="string"))m.type="string";if(g.every((h)=>typeof h==="boolean"))m.type="string";if(g.every((h)=>h===null))m.type="null";m.enum=g}break}case"file":{let m=f,g={type:"string",format:"binary",contentEncoding:"binary"},{minimum:h,maximum:y,mime:v}=e._zod.bag;if(h!==void 0)g.minLength=h;if(y!==void 0)g.maxLength=y;if(v)if(v.length===1)g.contentMediaType=v[0],Object.assign(m,g);else m.anyOf=v.map((x)=>{return{...g,contentMediaType:x}});else Object.assign(m,g);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let m=this.process(o.innerType,d);f.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),s.ref=o.innerType;break}case"success":{let m=f;m.type="boolean";break}case"default":{this.process(o.innerType,d),s.ref=o.innerType,f.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{if(this.process(o.innerType,d),s.ref=o.innerType,this.io==="input")f._prefault=JSON.parse(JSON.stringify(o.defaultValue));break}case"catch":{this.process(o.innerType,d),s.ref=o.innerType;let m;try{m=o.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,g=e._zod.pattern;if(!g)throw Error("Pattern not found in template literal");m.type="string",m.pattern=g.source;break}case"pipe":{let m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,d),s.ref=m;break}case"readonly":{this.process(o.innerType,d),s.ref=o.innerType,f.readOnly=!0;break}case"promise":{this.process(o.innerType,d),s.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),s.ref=o.innerType;break}case"lazy":{let m=e._zod.innerType;this.process(m,d),s.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(s.schema,c);if(this.io==="input"&&Je(e))delete s.schema.examples,delete s.schema.default;if(this.io==="input"&&s.schema._prefault)(r=s.schema).default??(r.default=s.schema._prefault);return delete s.schema._prefault,this.seen.get(e).schema}emit(e,t){let r={cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0},o=this.seen.get(e);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(u)=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){let g=r.external.registry.get(u[0])?.id;if(g)return{ref:r.external.uri(g)};let h=u[1].defId??u[1].schema.id??`schema${this.counter++}`;return u[1].defId=h,{defId:h,ref:`${r.external.uri("__shared")}#/${d}/${h}`}}if(u[1]===o)return{ref:"#"};let f=`${"#"}/${d}/`,m=u[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:f+m}},i=(u)=>{if(u[1].schema.$ref)return;let d=u[1],{ref:p,defId:f}=n(u);if(d.def={...d.schema},f)d.defId=f;let m=d.schema;for(let g in m)delete m[g];m.$ref=p};for(let u of this.seen.entries()){let d=u[1];if(e===u[0]){i(u);continue}if(r.external){let f=r.external.registry.get(u[0])?.id;if(e!==u[0]&&f){i(u);continue}}if(this.metadataRegistry.get(u[0])?.id){i(u);continue}if(d.cycle){if(r.cycles==="throw")throw Error(`Cycle detected: #/${d.cycle?.join("/")}/<root>
99
99
 
100
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);else if(r.cycles==="ref")i(u);continue}if(d.count>1){if(r.reused==="ref"){i(u);continue}}}let s=(u,d)=>{let p=this.seen.get(u),f=p.def??p.schema,m={...f};if(p.ref===null)return;let g=p.ref;if(p.ref=null,g){s(g,d);let h=this.seen.get(g).schema;if(h.$ref&&d.target==="draft-7")f.allOf=f.allOf??[],f.allOf.push(h);else Object.assign(f,h),Object.assign(f,m)}if(!p.isParent)this.override({zodSchema:u,jsonSchema:f,path:p.path??[]})};for(let u of[...this.seen.entries()].reverse())s(u[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,o.def);let c=r.external?.defs??{};for(let u of this.seen.entries()){let d=u[1];if(d.def&&d.defId)c[d.defId]=d.def}if(!r.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(u){throw Error("Error converting schema to JSON.")}}}function rs(e,t){if(e instanceof Pc){let o=new If(t),n={};for(let a of e._idmap.entries()){let[c,u]=a;o.process(u)}let i={},s={registry:e,uri:t?.uri||((a)=>a),defs:n};for(let a of e._idmap.entries()){let[c,u]=a;i[c]=o.emit(u,{...t,external:s})}if(Object.keys(n).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:n}}return{schemas:i}}let r=new If(t);return r.process(e),r.emit(e,t)}function Je(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;switch(n.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 Je(n.element,r);case"object":{for(let i in n.shape)if(Je(n.shape[i],r))return!0;return!1}case"union":{for(let i of n.options)if(Je(i,r))return!0;return!1}case"intersection":return Je(n.left,r)||Je(n.right,r);case"tuple":{for(let i of n.items)if(Je(i,r))return!0;if(n.rest&&Je(n.rest,r))return!0;return!1}case"record":return Je(n.keyType,r)||Je(n.valueType,r);case"map":return Je(n.keyType,r)||Je(n.valueType,r);case"set":return Je(n.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Je(n.innerType,r);case"lazy":return Je(n.getter(),r);case"default":return Je(n.innerType,r);case"prefault":return Je(n.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return Je(n.in,r)||Je(n.out,r);case"success":return!1;case"catch":return!1;default:}throw Error(`Unknown schema type: ${n.type}`)}var jR={};var zV=b("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");G.init(e,t),e.def=t,e.parse=(r,o)=>Po(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>Pn(e,r,o),e.parseAsync=async(r,o)=>Io(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>In(e,r,o),e.check=(...r)=>{return e.clone({...t,checks:[...t.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]})},e.clone=(r,o)=>ct(e,r,o),e.brand=()=>e,e.register=(r,o)=>{return r.add(e,o),e}});var UV=b("ZodMiniObject",(e,t)=>{kc.init(e,t),zV.init(e,t),A.defineLazy(e,"shape",()=>t.shape)});function rv(e,t){let r={type:"object",get shape(){return A.assignProp(this,"shape",{...e}),this.shape},...A.normalizeParams(t)};return new UV(r)}function Xt(e){return!!e._zod}function Mo(e){let t=Object.values(e);if(t.length===0)return rv({});let r=t.every(Xt),o=t.every((n)=>!Xt(n));if(r)return rv(e);if(o)return pR(e);throw Error("Mixed Zod versions detected in object shape.")}function Cn(e,t){if(Xt(e))return Pn(e,t);return e.safeParse(t)}async function Rf(e,t){if(Xt(e))return await In(e,t);return await e.safeParseAsync(t)}function Mn(e){if(!e)return;let t;if(Xt(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 ns(e){if(!e)return;if(typeof e==="object"){let t=e,r=e;if(!t._def&&!r._zod){let o=Object.values(e);if(o.length>0&&o.every((n)=>typeof n==="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse==="function")))return Mo(e)}}if(Xt(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e;return}function $f(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 zR(e){return e.description}function UR(e){if(Xt(e))return e._zod?.def?.type==="optional";let t=e;if(typeof e.isOptional==="function")return e.isOptional();return t._def?.typeName==="ZodOptional"}function Of(e){if(Xt(e)){let i=e._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=e.value;if(o!==void 0)return o;return}var l={};xr(l,{xid:()=>rW,void:()=>wW,uuidv7:()=>GV,uuidv6:()=>KV,uuidv4:()=>WV,uuid:()=>VV,url:()=>JV,uppercase:()=>Qc,unknown:()=>Oe,union:()=>we,undefined:()=>SW,ulid:()=>tW,uint64:()=>_W,uint32:()=>hW,tuple:()=>PW,trim:()=>il,treeifyError:()=>Zd,transform:()=>Mv,toUpperCase:()=>al,toLowerCase:()=>sl,toJSONSchema:()=>rs,templateLiteral:()=>DW,symbol:()=>vW,superRefine:()=>x$,success:()=>MW,stringbool:()=>UW,stringFormat:()=>pW,string:()=>S,strictObject:()=>EW,startsWith:()=>tl,size:()=>Jc,setErrorMap:()=>HW,set:()=>$W,safeParseAsync:()=>uv,safeParse:()=>lv,registry:()=>Ic,regexes:()=>Rn,regex:()=>Xc,refine:()=>S$,record:()=>ke,readonly:()=>g$,property:()=>Q_,promise:()=>jW,prettifyError:()=>Vd,preprocess:()=>Zf,prefault:()=>c$,positive:()=>G_,pipe:()=>zf,partialRecord:()=>IW,parseAsync:()=>cv,parse:()=>av,overwrite:()=>Yr,optional:()=>Re,object:()=>U,number:()=>fe,nullish:()=>CW,nullable:()=>jf,null:()=>Uf,normalize:()=>ol,nonpositive:()=>X_,nonoptional:()=>l$,nonnegative:()=>Y_,never:()=>Lf,negative:()=>J_,nativeEnum:()=>OW,nanoid:()=>YV,nan:()=>NW,multipleOf:()=>Ao,minSize:()=>Co,minLength:()=>An,mime:()=>nl,maxSize:()=>Qi,maxLength:()=>es,map:()=>RW,lte:()=>Jt,lt:()=>Jr,lowercase:()=>Yc,looseObject:()=>lt,locales:()=>Xi,literal:()=>H,length:()=>ts,lazy:()=>b$,ksuid:()=>nW,keyof:()=>TW,jwt:()=>dW,json:()=>LW,iso:()=>os,ipv6:()=>iW,ipv4:()=>oW,intersection:()=>ml,int64:()=>bW,int32:()=>gW,int:()=>dv,instanceof:()=>zW,includes:()=>el,guid:()=>ZV,gte:()=>Et,gt:()=>Xr,globalRegistry:()=>Tt,getErrorMap:()=>BW,function:()=>Pf,formatError:()=>Zi,float64:()=>mW,float32:()=>fW,flattenError:()=>qi,file:()=>AW,enum:()=>mt,endsWith:()=>rl,emoji:()=>XV,email:()=>qV,e164:()=>uW,discriminatedUnion:()=>Bf,date:()=>kW,custom:()=>zv,cuid2:()=>eW,cuid:()=>QV,core:()=>dr,config:()=>He,coerce:()=>Uv,clone:()=>ct,cidrv6:()=>aW,cidrv4:()=>sW,check:()=>v$,catch:()=>p$,boolean:()=>Ve,bigint:()=>yW,base64url:()=>lW,base64:()=>cW,array:()=>ie,any:()=>xW,_default:()=>s$,_ZodString:()=>pv,ZodXID:()=>vv,ZodVoid:()=>GR,ZodUnknown:()=>WR,ZodUnion:()=>Ov,ZodUndefined:()=>qR,ZodUUID:()=>Qr,ZodURL:()=>mv,ZodULID:()=>_v,ZodType:()=>re,ZodTuple:()=>QR,ZodTransform:()=>Cv,ZodTemplateLiteral:()=>h$,ZodSymbol:()=>BR,ZodSuccess:()=>u$,ZodStringFormat:()=>Ie,ZodString:()=>ul,ZodSet:()=>t$,ZodRecord:()=>Av,ZodRealError:()=>is,ZodReadonly:()=>m$,ZodPromise:()=>_$,ZodPrefault:()=>a$,ZodPipe:()=>jv,ZodOptional:()=>Nv,ZodObject:()=>Hf,ZodNumberFormat:()=>ss,ZodNumber:()=>dl,ZodNullable:()=>o$,ZodNull:()=>ZR,ZodNonOptional:()=>Dv,ZodNever:()=>KR,ZodNanoID:()=>hv,ZodNaN:()=>f$,ZodMap:()=>e$,ZodLiteral:()=>r$,ZodLazy:()=>y$,ZodKSUID:()=>Sv,ZodJWT:()=>Rv,ZodIssueCode:()=>FW,ZodIntersection:()=>YR,ZodISOTime:()=>Mf,ZodISODuration:()=>Nf,ZodISODateTime:()=>Af,ZodISODate:()=>Cf,ZodIPv6:()=>wv,ZodIPv4:()=>xv,ZodGUID:()=>Df,ZodFile:()=>n$,ZodError:()=>HV,ZodEnum:()=>ll,ZodEmoji:()=>gv,ZodEmail:()=>fv,ZodE164:()=>Iv,ZodDiscriminatedUnion:()=>XR,ZodDefault:()=>i$,ZodDate:()=>Ff,ZodCustomStringFormat:()=>HR,ZodCustom:()=>qf,ZodCatch:()=>d$,ZodCUID2:()=>bv,ZodCUID:()=>yv,ZodCIDRv6:()=>Tv,ZodCIDRv4:()=>kv,ZodBoolean:()=>pl,ZodBigIntFormat:()=>$v,ZodBigInt:()=>fl,ZodBase64URL:()=>Pv,ZodBase64:()=>Ev,ZodArray:()=>JR,ZodAny:()=>VR,TimePrecision:()=>rf,NEVER:()=>Hd,$output:()=>Qp,$input:()=>ef,$brand:()=>Bd});var os={};xr(os,{time:()=>iv,duration:()=>sv,datetime:()=>nv,date:()=>ov,ZodISOTime:()=>Mf,ZodISODuration:()=>Nf,ZodISODateTime:()=>Af,ZodISODate:()=>Cf});var Af=b("ZodISODateTime",(e,t)=>{Xb.init(e,t),Ie.init(e,t)});function nv(e){return F_(Af,e)}var Cf=b("ZodISODate",(e,t)=>{Yb.init(e,t),Ie.init(e,t)});function ov(e){return H_(Cf,e)}var Mf=b("ZodISOTime",(e,t)=>{Qb.init(e,t),Ie.init(e,t)});function iv(e){return B_(Mf,e)}var Nf=b("ZodISODuration",(e,t)=>{e_.init(e,t),Ie.init(e,t)});function sv(e){return q_(Nf,e)}var FR=(e,t)=>{Sc.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>Zi(e,r)},flatten:{value:(r)=>qi(e,r)},addIssue:{value:(r)=>e.issues.push(r)},addIssues:{value:(r)=>e.issues.push(...r)},isEmpty:{get(){return e.issues.length===0}}})},HV=b("ZodError",FR),is=b("ZodError",FR,{Parent:Error});var av=Wd(is),cv=Kd(is),lv=Gd(is),uv=Jd(is);var re=b("ZodType",(e,t)=>{return G.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>{return e.clone({...t,checks:[...t.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]})},e.clone=(r,o)=>ct(e,r,o),e.brand=()=>e,e.register=(r,o)=>{return r.add(e,o),e},e.parse=(r,o)=>av(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>lv(e,r,o),e.parseAsync=async(r,o)=>cv(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>uv(e,r,o),e.spa=e.safeParseAsync,e.refine=(r,o)=>e.check(S$(r,o)),e.superRefine=(r)=>e.check(x$(r)),e.overwrite=(r)=>e.check(Yr(r)),e.optional=()=>Re(e),e.nullable=()=>jf(e),e.nullish=()=>Re(jf(e)),e.nonoptional=(r)=>l$(e,r),e.array=()=>ie(e),e.or=(r)=>we([e,r]),e.and=(r)=>ml(e,r),e.transform=(r)=>zf(e,Mv(r)),e.default=(r)=>s$(e,r),e.prefault=(r)=>c$(e,r),e.catch=(r)=>p$(e,r),e.pipe=(r)=>zf(e,r),e.readonly=()=>g$(e),e.describe=(r)=>{let o=e.clone();return Tt.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return Tt.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Tt.get(e);let o=e.clone();return Tt.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e}),pv=b("_ZodString",(e,t)=>{$n.init(e,t),re.init(e,t);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...o)=>e.check(Xc(...o)),e.includes=(...o)=>e.check(el(...o)),e.startsWith=(...o)=>e.check(tl(...o)),e.endsWith=(...o)=>e.check(rl(...o)),e.min=(...o)=>e.check(An(...o)),e.max=(...o)=>e.check(es(...o)),e.length=(...o)=>e.check(ts(...o)),e.nonempty=(...o)=>e.check(An(1,...o)),e.lowercase=(o)=>e.check(Yc(o)),e.uppercase=(o)=>e.check(Qc(o)),e.trim=()=>e.check(il()),e.normalize=(...o)=>e.check(ol(...o)),e.toLowerCase=()=>e.check(sl()),e.toUpperCase=()=>e.check(al())}),ul=b("ZodString",(e,t)=>{$n.init(e,t),pv.init(e,t),e.email=(r)=>e.check(Rc(fv,r)),e.url=(r)=>e.check(Mc(mv,r)),e.jwt=(r)=>e.check(Gc(Rv,r)),e.emoji=(r)=>e.check(Nc(gv,r)),e.guid=(r)=>e.check(Yi(Df,r)),e.uuid=(r)=>e.check($c(Qr,r)),e.uuidv4=(r)=>e.check(Oc(Qr,r)),e.uuidv6=(r)=>e.check(Ac(Qr,r)),e.uuidv7=(r)=>e.check(Cc(Qr,r)),e.nanoid=(r)=>e.check(Dc(hv,r)),e.guid=(r)=>e.check(Yi(Df,r)),e.cuid=(r)=>e.check(jc(yv,r)),e.cuid2=(r)=>e.check(zc(bv,r)),e.ulid=(r)=>e.check(Uc(_v,r)),e.base64=(r)=>e.check(Vc(Ev,r)),e.base64url=(r)=>e.check(Wc(Pv,r)),e.xid=(r)=>e.check(Lc(vv,r)),e.ksuid=(r)=>e.check(Fc(Sv,r)),e.ipv4=(r)=>e.check(Hc(xv,r)),e.ipv6=(r)=>e.check(Bc(wv,r)),e.cidrv4=(r)=>e.check(qc(kv,r)),e.cidrv6=(r)=>e.check(Zc(Tv,r)),e.e164=(r)=>e.check(Kc(Iv,r)),e.datetime=(r)=>e.check(nv(r)),e.date=(r)=>e.check(ov(r)),e.time=(r)=>e.check(iv(r)),e.duration=(r)=>e.check(sv(r))});function S(e){return tf(ul,e)}var Ie=b("ZodStringFormat",(e,t)=>{xe.init(e,t),pv.init(e,t)}),fv=b("ZodEmail",(e,t)=>{ip.init(e,t),Ie.init(e,t)});function qV(e){return Rc(fv,e)}var Df=b("ZodGUID",(e,t)=>{np.init(e,t),Ie.init(e,t)});function ZV(e){return Yi(Df,e)}var Qr=b("ZodUUID",(e,t)=>{op.init(e,t),Ie.init(e,t)});function VV(e){return $c(Qr,e)}function WV(e){return Oc(Qr,e)}function KV(e){return Ac(Qr,e)}function GV(e){return Cc(Qr,e)}var mv=b("ZodURL",(e,t)=>{sp.init(e,t),Ie.init(e,t)});function JV(e){return Mc(mv,e)}var gv=b("ZodEmoji",(e,t)=>{ap.init(e,t),Ie.init(e,t)});function XV(e){return Nc(gv,e)}var hv=b("ZodNanoID",(e,t)=>{cp.init(e,t),Ie.init(e,t)});function YV(e){return Dc(hv,e)}var yv=b("ZodCUID",(e,t)=>{lp.init(e,t),Ie.init(e,t)});function QV(e){return jc(yv,e)}var bv=b("ZodCUID2",(e,t)=>{up.init(e,t),Ie.init(e,t)});function eW(e){return zc(bv,e)}var _v=b("ZodULID",(e,t)=>{dp.init(e,t),Ie.init(e,t)});function tW(e){return Uc(_v,e)}var vv=b("ZodXID",(e,t)=>{pp.init(e,t),Ie.init(e,t)});function rW(e){return Lc(vv,e)}var Sv=b("ZodKSUID",(e,t)=>{fp.init(e,t),Ie.init(e,t)});function nW(e){return Fc(Sv,e)}var xv=b("ZodIPv4",(e,t)=>{mp.init(e,t),Ie.init(e,t)});function oW(e){return Hc(xv,e)}var wv=b("ZodIPv6",(e,t)=>{gp.init(e,t),Ie.init(e,t)});function iW(e){return Bc(wv,e)}var kv=b("ZodCIDRv4",(e,t)=>{hp.init(e,t),Ie.init(e,t)});function sW(e){return qc(kv,e)}var Tv=b("ZodCIDRv6",(e,t)=>{yp.init(e,t),Ie.init(e,t)});function aW(e){return Zc(Tv,e)}var Ev=b("ZodBase64",(e,t)=>{bp.init(e,t),Ie.init(e,t)});function cW(e){return Vc(Ev,e)}var Pv=b("ZodBase64URL",(e,t)=>{_p.init(e,t),Ie.init(e,t)});function lW(e){return Wc(Pv,e)}var Iv=b("ZodE164",(e,t)=>{vp.init(e,t),Ie.init(e,t)});function uW(e){return Kc(Iv,e)}var Rv=b("ZodJWT",(e,t)=>{Sp.init(e,t),Ie.init(e,t)});function dW(e){return Gc(Rv,e)}var HR=b("ZodCustomStringFormat",(e,t)=>{xp.init(e,t),Ie.init(e,t)});function pW(e,t,r={}){return Ef(HR,e,t,r)}var dl=b("ZodNumber",(e,t)=>{xc.init(e,t),re.init(e,t),e.gt=(o,n)=>e.check(Xr(o,n)),e.gte=(o,n)=>e.check(Et(o,n)),e.min=(o,n)=>e.check(Et(o,n)),e.lt=(o,n)=>e.check(Jr(o,n)),e.lte=(o,n)=>e.check(Jt(o,n)),e.max=(o,n)=>e.check(Jt(o,n)),e.int=(o)=>e.check(dv(o)),e.safe=(o)=>e.check(dv(o)),e.positive=(o)=>e.check(Xr(0,o)),e.nonnegative=(o)=>e.check(Et(0,o)),e.negative=(o)=>e.check(Jr(0,o)),e.nonpositive=(o)=>e.check(Jt(0,o)),e.multipleOf=(o,n)=>e.check(Ao(o,n)),e.step=(o,n)=>e.check(Ao(o,n)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function fe(e){return nf(dl,e)}var ss=b("ZodNumberFormat",(e,t)=>{wp.init(e,t),dl.init(e,t)});function dv(e){return of(ss,e)}function fW(e){return sf(ss,e)}function mW(e){return af(ss,e)}function gW(e){return cf(ss,e)}function hW(e){return lf(ss,e)}var pl=b("ZodBoolean",(e,t)=>{Wi.init(e,t),re.init(e,t)});function Ve(e){return uf(pl,e)}var fl=b("ZodBigInt",(e,t)=>{wc.init(e,t),re.init(e,t),e.gte=(o,n)=>e.check(Et(o,n)),e.min=(o,n)=>e.check(Et(o,n)),e.gt=(o,n)=>e.check(Xr(o,n)),e.gte=(o,n)=>e.check(Et(o,n)),e.min=(o,n)=>e.check(Et(o,n)),e.lt=(o,n)=>e.check(Jr(o,n)),e.lte=(o,n)=>e.check(Jt(o,n)),e.max=(o,n)=>e.check(Jt(o,n)),e.positive=(o)=>e.check(Xr(BigInt(0),o)),e.negative=(o)=>e.check(Jr(BigInt(0),o)),e.nonpositive=(o)=>e.check(Jt(BigInt(0),o)),e.nonnegative=(o)=>e.check(Et(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(Ao(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function yW(e){return df(fl,e)}var $v=b("ZodBigIntFormat",(e,t)=>{kp.init(e,t),fl.init(e,t)});function bW(e){return pf($v,e)}function _W(e){return ff($v,e)}var BR=b("ZodSymbol",(e,t)=>{Tp.init(e,t),re.init(e,t)});function vW(e){return mf(BR,e)}var qR=b("ZodUndefined",(e,t)=>{Ep.init(e,t),re.init(e,t)});function SW(e){return gf(qR,e)}var ZR=b("ZodNull",(e,t)=>{Pp.init(e,t),re.init(e,t)});function Uf(e){return hf(ZR,e)}var VR=b("ZodAny",(e,t)=>{Ip.init(e,t),re.init(e,t)});function xW(){return yf(VR)}var WR=b("ZodUnknown",(e,t)=>{$o.init(e,t),re.init(e,t)});function Oe(){return Oo(WR)}var KR=b("ZodNever",(e,t)=>{Rp.init(e,t),re.init(e,t)});function Lf(e){return bf(KR,e)}var GR=b("ZodVoid",(e,t)=>{$p.init(e,t),re.init(e,t)});function wW(e){return _f(GR,e)}var Ff=b("ZodDate",(e,t)=>{Op.init(e,t),re.init(e,t),e.min=(o,n)=>e.check(Et(o,n)),e.max=(o,n)=>e.check(Jt(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function kW(e){return vf(Ff,e)}var JR=b("ZodArray",(e,t)=>{Ki.init(e,t),re.init(e,t),e.element=t.element,e.min=(r,o)=>e.check(An(r,o)),e.nonempty=(r)=>e.check(An(1,r)),e.max=(r,o)=>e.check(es(r,o)),e.length=(r,o)=>e.check(ts(r,o)),e.unwrap=()=>e.element});function ie(e,t){return cl(JR,e,t)}function TW(e){let t=e._zod.def.shape;return H(Object.keys(t))}var Hf=b("ZodObject",(e,t)=>{kc.init(e,t),re.init(e,t),A.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>mt(Object.keys(e._zod.def.shape)),e.catchall=(r)=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Oe()}),e.loose=()=>e.clone({...e._zod.def,catchall:Oe()}),e.strict=()=>e.clone({...e._zod.def,catchall:Lf()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(r)=>{return A.extend(e,r)},e.merge=(r)=>A.merge(e,r),e.pick=(r)=>A.pick(e,r),e.omit=(r)=>A.omit(e,r),e.partial=(...r)=>A.partial(Nv,e,r[0]),e.required=(...r)=>A.required(Dv,e,r[0])});function U(e,t){let r={type:"object",get shape(){return A.assignProp(this,"shape",{...e}),this.shape},...A.normalizeParams(t)};return new Hf(r)}function EW(e,t){return new Hf({type:"object",get shape(){return A.assignProp(this,"shape",{...e}),this.shape},catchall:Lf(),...A.normalizeParams(t)})}function lt(e,t){return new Hf({type:"object",get shape(){return A.assignProp(this,"shape",{...e}),this.shape},catchall:Oe(),...A.normalizeParams(t)})}var Ov=b("ZodUnion",(e,t)=>{Tc.init(e,t),re.init(e,t),e.options=t.options});function we(e,t){return new Ov({type:"union",options:e,...A.normalizeParams(t)})}var XR=b("ZodDiscriminatedUnion",(e,t)=>{Ov.init(e,t),Ap.init(e,t)});function Bf(e,t,r){return new XR({type:"union",options:t,discriminator:e,...A.normalizeParams(r)})}var YR=b("ZodIntersection",(e,t)=>{Cp.init(e,t),re.init(e,t)});function ml(e,t){return new YR({type:"intersection",left:e,right:t})}var QR=b("ZodTuple",(e,t)=>{On.init(e,t),re.init(e,t),e.rest=(r)=>e.clone({...e._zod.def,rest:r})});function PW(e,t,r){let o=t instanceof G,n=o?r:t;return new QR({type:"tuple",items:e,rest:o?t:null,...A.normalizeParams(n)})}var Av=b("ZodRecord",(e,t)=>{Mp.init(e,t),re.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function ke(e,t,r){return new Av({type:"record",keyType:e,valueType:t,...A.normalizeParams(r)})}function IW(e,t,r){return new Av({type:"record",keyType:we([e,Lf()]),valueType:t,...A.normalizeParams(r)})}var e$=b("ZodMap",(e,t)=>{Np.init(e,t),re.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function RW(e,t,r){return new e$({type:"map",keyType:e,valueType:t,...A.normalizeParams(r)})}var t$=b("ZodSet",(e,t)=>{Dp.init(e,t),re.init(e,t),e.min=(...r)=>e.check(Co(...r)),e.nonempty=(r)=>e.check(Co(1,r)),e.max=(...r)=>e.check(Qi(...r)),e.size=(...r)=>e.check(Jc(...r))});function $W(e,t){return new t$({type:"set",valueType:e,...A.normalizeParams(t)})}var ll=b("ZodEnum",(e,t)=>{jp.init(e,t),re.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let s of o)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new ll({...t,checks:[],...A.normalizeParams(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let s of o)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new ll({...t,checks:[],...A.normalizeParams(n),entries:i})}});function mt(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new ll({type:"enum",entries:r,...A.normalizeParams(t)})}function OW(e,t){return new ll({type:"enum",entries:e,...A.normalizeParams(t)})}var r$=b("ZodLiteral",(e,t)=>{zp.init(e,t),re.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 H(e,t){return new r$({type:"literal",values:Array.isArray(e)?e:[e],...A.normalizeParams(t)})}var n$=b("ZodFile",(e,t)=>{Up.init(e,t),re.init(e,t),e.min=(r,o)=>e.check(Co(r,o)),e.max=(r,o)=>e.check(Qi(r,o)),e.mime=(r,o)=>e.check(nl(Array.isArray(r)?r:[r],o))});function AW(e){return xf(n$,e)}var Cv=b("ZodTransform",(e,t)=>{Gi.init(e,t),re.init(e,t),e._zod.parse=(r,o)=>{r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(A.issue(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),s.continue??(s.continue=!0),r.issues.push(A.issue(s))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((i)=>{return r.value=i,r});return r.value=n,r}});function Mv(e){return new Cv({type:"transform",transform:e})}var Nv=b("ZodOptional",(e,t)=>{Lp.init(e,t),re.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Re(e){return new Nv({type:"optional",innerType:e})}var o$=b("ZodNullable",(e,t)=>{Fp.init(e,t),re.init(e,t),e.unwrap=()=>e._zod.def.innerType});function jf(e){return new o$({type:"nullable",innerType:e})}function CW(e){return Re(jf(e))}var i$=b("ZodDefault",(e,t)=>{Hp.init(e,t),re.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function s$(e,t){return new i$({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():t}})}var a$=b("ZodPrefault",(e,t)=>{Bp.init(e,t),re.init(e,t),e.unwrap=()=>e._zod.def.innerType});function c$(e,t){return new a$({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():t}})}var Dv=b("ZodNonOptional",(e,t)=>{qp.init(e,t),re.init(e,t),e.unwrap=()=>e._zod.def.innerType});function l$(e,t){return new Dv({type:"nonoptional",innerType:e,...A.normalizeParams(t)})}var u$=b("ZodSuccess",(e,t)=>{Zp.init(e,t),re.init(e,t),e.unwrap=()=>e._zod.def.innerType});function MW(e){return new u$({type:"success",innerType:e})}var d$=b("ZodCatch",(e,t)=>{Vp.init(e,t),re.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function p$(e,t){return new d$({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var f$=b("ZodNaN",(e,t)=>{Wp.init(e,t),re.init(e,t)});function NW(e){return Sf(f$,e)}var jv=b("ZodPipe",(e,t)=>{Ji.init(e,t),re.init(e,t),e.in=t.in,e.out=t.out});function zf(e,t){return new jv({type:"pipe",in:e,out:t})}var m$=b("ZodReadonly",(e,t)=>{Kp.init(e,t),re.init(e,t)});function g$(e){return new m$({type:"readonly",innerType:e})}var h$=b("ZodTemplateLiteral",(e,t)=>{Gp.init(e,t),re.init(e,t)});function DW(e,t){return new h$({type:"template_literal",parts:e,...A.normalizeParams(t)})}var y$=b("ZodLazy",(e,t)=>{Xp.init(e,t),re.init(e,t),e.unwrap=()=>e._zod.def.getter()});function b$(e){return new y$({type:"lazy",getter:e})}var _$=b("ZodPromise",(e,t)=>{Jp.init(e,t),re.init(e,t),e.unwrap=()=>e._zod.def.innerType});function jW(e){return new _$({type:"promise",innerType:e})}var qf=b("ZodCustom",(e,t)=>{Yp.init(e,t),re.init(e,t)});function v$(e,t){let r=new Me({check:"custom",...A.normalizeParams(t)});return r._zod.check=e,r}function zv(e,t){return wf(qf,e??(()=>!0),t)}function S$(e,t={}){return kf(qf,e,t)}function x$(e,t){let r=v$((o)=>{return o.addIssue=(n)=>{if(typeof n==="string")o.issues.push(A.issue(n,o.value,r._zod.def));else{let i=n;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=o.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),o.issues.push(A.issue(i))}},e(o.value,o)},t);return r}function zW(e,t={error:`Input not instance of ${e.name}`}){let r=new qf({type:"custom",check:"custom",fn:(o)=>o instanceof e,abort:!0,...A.normalizeParams(t)});return r._zod.bag.Class=e,r}var UW=(...e)=>Tf({Pipe:jv,Boolean:pl,String:ul,Transform:Cv},...e);function LW(e){let t=b$(()=>{return we([S(e),fe(),Ve(),Uf(),ie(t),ke(S(),t)])});return t}function Zf(e,t){return zf(Mv(e),t)}var FW={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"};function HW(e){He({customError:e})}function BW(){return He().customError}var Uv={};xr(Uv,{string:()=>qW,number:()=>ZW,date:()=>KW,boolean:()=>VW,bigint:()=>WW});function qW(e){return L_(ul,e)}function ZW(e){return Z_(dl,e)}function VW(e){return V_(pl,e)}function WW(e){return W_(fl,e)}function KW(e){return K_(Ff,e)}He(Ec());var w$=l;var Lv=w$;var Fv="2025-11-25";var k$=[Fv,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Nn="io.modelcontextprotocol/related-task",Wf="2.0",Xe=zv((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),T$=we([S(),fe().int()]),E$=S(),rSe=lt({ttl:fe().optional(),pollInterval:fe().optional()}),JW=U({ttl:fe().optional()}),XW=U({taskId:S()}),Hv=lt({progressToken:T$.optional(),[Nn]:XW.optional()}),Ut=U({_meta:Hv.optional()}),gl=Ut.extend({task:JW.optional()}),P$=(e)=>gl.safeParse(e).success,rt=U({method:S(),params:Ut.loose().optional()}),Yt=U({_meta:Hv.optional()}),Qt=U({method:S(),params:Yt.loose().optional()}),nt=lt({_meta:Hv.optional()}),Kf=we([S(),fe().int()]),I$=U({jsonrpc:H(Wf),id:Kf,...rt.shape}).strict(),Bv=(e)=>I$.safeParse(e).success,R$=U({jsonrpc:H(Wf),...Qt.shape}).strict(),$$=(e)=>R$.safeParse(e).success,qv=U({jsonrpc:H(Wf),id:Kf,result:nt}).strict(),hl=(e)=>qv.safeParse(e).success;var Z;(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"})(Z||(Z={}));var Zv=U({jsonrpc:H(Wf),id:Kf.optional(),error:U({code:fe().int(),message:S(),data:Oe().optional()})}).strict();var O$=(e)=>Zv.safeParse(e).success;var nSe=we([I$,R$,qv,Zv]),oSe=we([qv,Zv]),Gf=nt.strict(),YW=Yt.extend({requestId:Kf.optional(),reason:S().optional()}),Jf=Qt.extend({method:H("notifications/cancelled"),params:YW}),QW=U({src:S(),mimeType:S().optional(),sizes:ie(S()).optional(),theme:mt(["light","dark"]).optional()}),yl=U({icons:ie(QW).optional()}),as=U({name:S(),title:S().optional()}),A$=as.extend({...as.shape,...yl.shape,version:S(),websiteUrl:S().optional(),description:S().optional()}),eK=ml(U({applyDefaults:Ve().optional()}),ke(S(),Oe())),tK=Zf((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},ml(U({form:eK.optional(),url:Xe.optional()}),ke(S(),Oe()).optional())),rK=lt({list:Xe.optional(),cancel:Xe.optional(),requests:lt({sampling:lt({createMessage:Xe.optional()}).optional(),elicitation:lt({create:Xe.optional()}).optional()}).optional()}),nK=lt({list:Xe.optional(),cancel:Xe.optional(),requests:lt({tools:lt({call:Xe.optional()}).optional()}).optional()}),oK=U({experimental:ke(S(),Xe).optional(),sampling:U({context:Xe.optional(),tools:Xe.optional()}).optional(),elicitation:tK.optional(),roots:U({listChanged:Ve().optional()}).optional(),tasks:rK.optional(),extensions:ke(S(),Xe).optional()}),iK=Ut.extend({protocolVersion:S(),capabilities:oK,clientInfo:A$}),Vv=rt.extend({method:H("initialize"),params:iK});var sK=U({experimental:ke(S(),Xe).optional(),logging:Xe.optional(),completions:Xe.optional(),prompts:U({listChanged:Ve().optional()}).optional(),resources:U({subscribe:Ve().optional(),listChanged:Ve().optional()}).optional(),tools:U({listChanged:Ve().optional()}).optional(),tasks:nK.optional(),extensions:ke(S(),Xe).optional()}),aK=nt.extend({protocolVersion:S(),capabilities:sK,serverInfo:A$,instructions:S().optional()}),Wv=Qt.extend({method:H("notifications/initialized"),params:Yt.optional()});var Xf=rt.extend({method:H("ping"),params:Ut.optional()}),cK=U({progress:fe(),total:Re(fe()),message:Re(S())}),lK=U({...Yt.shape,...cK.shape,progressToken:T$}),Yf=Qt.extend({method:H("notifications/progress"),params:lK}),uK=Ut.extend({cursor:E$.optional()}),bl=rt.extend({params:uK.optional()}),_l=nt.extend({nextCursor:E$.optional()}),dK=mt(["working","input_required","completed","failed","cancelled"]),vl=U({taskId:S(),status:dK,ttl:we([fe(),Uf()]),createdAt:S(),lastUpdatedAt:S(),pollInterval:Re(fe()),statusMessage:Re(S())}),cs=nt.extend({task:vl}),pK=Yt.merge(vl),Sl=Qt.extend({method:H("notifications/tasks/status"),params:pK}),Qf=rt.extend({method:H("tasks/get"),params:Ut.extend({taskId:S()})}),em=nt.merge(vl),tm=rt.extend({method:H("tasks/result"),params:Ut.extend({taskId:S()})}),iSe=nt.loose(),rm=bl.extend({method:H("tasks/list")}),nm=_l.extend({tasks:ie(vl)}),om=rt.extend({method:H("tasks/cancel"),params:Ut.extend({taskId:S()})}),C$=nt.merge(vl),M$=U({uri:S(),mimeType:Re(S()),_meta:ke(S(),Oe()).optional()}),N$=M$.extend({text:S()}),Kv=S().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),D$=M$.extend({blob:Kv}),xl=mt(["user","assistant"]),ls=U({audience:ie(xl).optional(),priority:fe().min(0).max(1).optional(),lastModified:os.datetime({offset:!0}).optional()}),j$=U({...as.shape,...yl.shape,uri:S(),description:Re(S()),mimeType:Re(S()),size:Re(fe()),annotations:ls.optional(),_meta:Re(lt({}))}),fK=U({...as.shape,...yl.shape,uriTemplate:S(),description:Re(S()),mimeType:Re(S()),annotations:ls.optional(),_meta:Re(lt({}))}),im=bl.extend({method:H("resources/list")}),mK=_l.extend({resources:ie(j$)}),sm=bl.extend({method:H("resources/templates/list")}),gK=_l.extend({resourceTemplates:ie(fK)}),Gv=Ut.extend({uri:S()}),hK=Gv,am=rt.extend({method:H("resources/read"),params:hK}),yK=nt.extend({contents:ie(we([N$,D$]))}),bK=Qt.extend({method:H("notifications/resources/list_changed"),params:Yt.optional()}),_K=Gv,vK=rt.extend({method:H("resources/subscribe"),params:_K}),SK=Gv,xK=rt.extend({method:H("resources/unsubscribe"),params:SK}),wK=Yt.extend({uri:S()}),kK=Qt.extend({method:H("notifications/resources/updated"),params:wK}),TK=U({name:S(),description:Re(S()),required:Re(Ve())}),EK=U({...as.shape,...yl.shape,description:Re(S()),arguments:Re(ie(TK)),_meta:Re(lt({}))}),cm=bl.extend({method:H("prompts/list")}),PK=_l.extend({prompts:ie(EK)}),IK=Ut.extend({name:S(),arguments:ke(S(),S()).optional()}),lm=rt.extend({method:H("prompts/get"),params:IK}),Jv=U({type:H("text"),text:S(),annotations:ls.optional(),_meta:ke(S(),Oe()).optional()}),Xv=U({type:H("image"),data:Kv,mimeType:S(),annotations:ls.optional(),_meta:ke(S(),Oe()).optional()}),Yv=U({type:H("audio"),data:Kv,mimeType:S(),annotations:ls.optional(),_meta:ke(S(),Oe()).optional()}),RK=U({type:H("tool_use"),name:S(),id:S(),input:ke(S(),Oe()),_meta:ke(S(),Oe()).optional()}),$K=U({type:H("resource"),resource:we([N$,D$]),annotations:ls.optional(),_meta:ke(S(),Oe()).optional()}),OK=j$.extend({type:H("resource_link")}),Qv=we([Jv,Xv,Yv,OK,$K]),AK=U({role:xl,content:Qv}),CK=nt.extend({description:S().optional(),messages:ie(AK)}),MK=Qt.extend({method:H("notifications/prompts/list_changed"),params:Yt.optional()}),NK=U({title:S().optional(),readOnlyHint:Ve().optional(),destructiveHint:Ve().optional(),idempotentHint:Ve().optional(),openWorldHint:Ve().optional()}),DK=U({taskSupport:mt(["required","optional","forbidden"]).optional()}),z$=U({...as.shape,...yl.shape,description:S().optional(),inputSchema:U({type:H("object"),properties:ke(S(),Xe).optional(),required:ie(S()).optional()}).catchall(Oe()),outputSchema:U({type:H("object"),properties:ke(S(),Xe).optional(),required:ie(S()).optional()}).catchall(Oe()).optional(),annotations:NK.optional(),execution:DK.optional(),_meta:ke(S(),Oe()).optional()}),um=bl.extend({method:H("tools/list")}),jK=_l.extend({tools:ie(z$)}),dm=nt.extend({content:ie(Qv).default([]),structuredContent:ke(S(),Oe()).optional(),isError:Ve().optional()}),sSe=dm.or(nt.extend({toolResult:Oe()})),zK=gl.extend({name:S(),arguments:ke(S(),Oe()).optional()}),us=rt.extend({method:H("tools/call"),params:zK}),UK=Qt.extend({method:H("notifications/tools/list_changed"),params:Yt.optional()}),aSe=U({autoRefresh:Ve().default(!0),debounceMs:fe().int().nonnegative().default(300)}),wl=mt(["debug","info","notice","warning","error","critical","alert","emergency"]),LK=Ut.extend({level:wl}),eS=rt.extend({method:H("logging/setLevel"),params:LK}),FK=Yt.extend({level:wl,logger:S().optional(),data:Oe()}),HK=Qt.extend({method:H("notifications/message"),params:FK}),BK=U({name:S().optional()}),qK=U({hints:ie(BK).optional(),costPriority:fe().min(0).max(1).optional(),speedPriority:fe().min(0).max(1).optional(),intelligencePriority:fe().min(0).max(1).optional()}),ZK=U({mode:mt(["auto","required","none"]).optional()}),VK=U({type:H("tool_result"),toolUseId:S().describe("The unique identifier for the corresponding tool call."),content:ie(Qv).default([]),structuredContent:U({}).loose().optional(),isError:Ve().optional(),_meta:ke(S(),Oe()).optional()}),WK=Bf("type",[Jv,Xv,Yv]),Vf=Bf("type",[Jv,Xv,Yv,RK,VK]),KK=U({role:xl,content:we([Vf,ie(Vf)]),_meta:ke(S(),Oe()).optional()}),GK=gl.extend({messages:ie(KK),modelPreferences:qK.optional(),systemPrompt:S().optional(),includeContext:mt(["none","thisServer","allServers"]).optional(),temperature:fe().optional(),maxTokens:fe().int(),stopSequences:ie(S()).optional(),metadata:Xe.optional(),tools:ie(z$).optional(),toolChoice:ZK.optional()}),JK=rt.extend({method:H("sampling/createMessage"),params:GK}),kl=nt.extend({model:S(),stopReason:Re(mt(["endTurn","stopSequence","maxTokens"]).or(S())),role:xl,content:WK}),tS=nt.extend({model:S(),stopReason:Re(mt(["endTurn","stopSequence","maxTokens","toolUse"]).or(S())),role:xl,content:we([Vf,ie(Vf)])}),XK=U({type:H("boolean"),title:S().optional(),description:S().optional(),default:Ve().optional()}),YK=U({type:H("string"),title:S().optional(),description:S().optional(),minLength:fe().optional(),maxLength:fe().optional(),format:mt(["email","uri","date","date-time"]).optional(),default:S().optional()}),QK=U({type:mt(["number","integer"]),title:S().optional(),description:S().optional(),minimum:fe().optional(),maximum:fe().optional(),default:fe().optional()}),eG=U({type:H("string"),title:S().optional(),description:S().optional(),enum:ie(S()),default:S().optional()}),tG=U({type:H("string"),title:S().optional(),description:S().optional(),oneOf:ie(U({const:S(),title:S()})),default:S().optional()}),rG=U({type:H("string"),title:S().optional(),description:S().optional(),enum:ie(S()),enumNames:ie(S()).optional(),default:S().optional()}),nG=we([eG,tG]),oG=U({type:H("array"),title:S().optional(),description:S().optional(),minItems:fe().optional(),maxItems:fe().optional(),items:U({type:H("string"),enum:ie(S())}),default:ie(S()).optional()}),iG=U({type:H("array"),title:S().optional(),description:S().optional(),minItems:fe().optional(),maxItems:fe().optional(),items:U({anyOf:ie(U({const:S(),title:S()}))}),default:ie(S()).optional()}),sG=we([oG,iG]),aG=we([rG,nG,sG]),cG=we([aG,XK,YK,QK]),lG=gl.extend({mode:H("form").optional(),message:S(),requestedSchema:U({type:H("object"),properties:ke(S(),cG),required:ie(S()).optional()})}),uG=gl.extend({mode:H("url"),message:S(),elicitationId:S(),url:S().url()}),dG=we([lG,uG]),pG=rt.extend({method:H("elicitation/create"),params:dG}),fG=Yt.extend({elicitationId:S()}),mG=Qt.extend({method:H("notifications/elicitation/complete"),params:fG}),ds=nt.extend({action:mt(["accept","decline","cancel"]),content:Zf((e)=>e===null?void 0:e,ke(S(),we([S(),fe(),Ve(),ie(S())])).optional())}),gG=U({type:H("ref/resource"),uri:S()});var hG=U({type:H("ref/prompt"),name:S()}),yG=Ut.extend({ref:we([hG,gG]),argument:U({name:S(),value:S()}),context:U({arguments:ke(S(),S()).optional()}).optional()}),pm=rt.extend({method:H("completion/complete"),params:yG});function U$(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function L$(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var bG=nt.extend({completion:lt({values:ie(S()).max(100),total:Re(fe().int()),hasMore:Re(Ve())})}),_G=U({uri:S().startsWith("file://"),name:S().optional(),_meta:ke(S(),Oe()).optional()}),vG=rt.extend({method:H("roots/list"),params:Ut.optional()}),rS=nt.extend({roots:ie(_G)}),SG=Qt.extend({method:H("notifications/roots/list_changed"),params:Yt.optional()}),cSe=we([Xf,Vv,pm,eS,lm,cm,im,sm,am,vK,xK,us,um,Qf,tm,rm,om]),lSe=we([Jf,Yf,Wv,SG,Sl]),uSe=we([Gf,kl,tS,ds,rS,em,nm,cs]),dSe=we([Xf,JK,pG,vG,Qf,tm,rm,om]),pSe=we([Jf,Yf,HK,kK,bK,UK,MK,Sl,mG]),fSe=we([Gf,aK,bG,CK,PK,mK,gK,yK,dm,jK,em,nm,cs]);class B extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===Z.UrlElicitationRequired&&r){let o=r;if(o.elicitations)return new F$(o.elicitations,t)}return new B(e,t,r)}}class F$ extends B{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(Z.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function Dn(e){return e==="completed"||e==="failed"||e==="cancelled"}var B$=Symbol("Let zodToJsonSchema decide on which parser to use");var H$={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"},q$=(e)=>typeof e==="string"?{...H$,name:e}:{...H$,...e};var Z$=(e)=>{let t=q$(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([o,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,o],jsonSchema:void 0}]))}};function nS(e,t,r,o){if(!o?.errorMessages)return;if(r)e.errorMessage={...e.errorMessage,[t]:r}}function ce(e,t,r,o,n){e[t]=r,nS(e,t,o,n)}var fm=(e,t)=>{let r=0;for(;r<e.length&&r<t.length;r++)if(e[r]!==t[r])break;return[(e.length-r).toString(),...t.slice(r)].join("/")};function Ne(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?fm(t,e.currentPath):t.join("/")}}function V$(e,t){let r={type:"array"};if(e.type?._def&&e.type?._def?.typeName!==R.ZodAny)r.items=K(e.type._def,{...t,currentPath:[...t.currentPath,"items"]});if(e.minLength)ce(r,"minItems",e.minLength.value,e.minLength.message,t);if(e.maxLength)ce(r,"maxItems",e.maxLength.value,e.maxLength.message,t);if(e.exactLength)ce(r,"minItems",e.exactLength.value,e.exactLength.message,t),ce(r,"maxItems",e.exactLength.value,e.exactLength.message,t);return r}function W$(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let o of e.checks)switch(o.kind){case"min":if(t.target==="jsonSchema7")if(o.inclusive)ce(r,"minimum",o.value,o.message,t);else ce(r,"exclusiveMinimum",o.value,o.message,t);else{if(!o.inclusive)r.exclusiveMinimum=!0;ce(r,"minimum",o.value,o.message,t)}break;case"max":if(t.target==="jsonSchema7")if(o.inclusive)ce(r,"maximum",o.value,o.message,t);else ce(r,"exclusiveMaximum",o.value,o.message,t);else{if(!o.inclusive)r.exclusiveMaximum=!0;ce(r,"maximum",o.value,o.message,t)}break;case"multipleOf":ce(r,"multipleOf",o.value,o.message,t);break}return r}function K$(){return{type:"boolean"}}function mm(e,t){return K(e.type._def,t)}var G$=(e,t)=>{return K(e.innerType._def,t)};function oS(e,t,r){let o=r??t.dateStrategy;if(Array.isArray(o))return{anyOf:o.map((n,i)=>oS(e,t,n))};switch(o){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return xG(e,t)}}var xG=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let o of e.checks)switch(o.kind){case"min":ce(r,"minimum",o.value,o.message,t);break;case"max":ce(r,"maximum",o.value,o.message,t);break}return r};function J$(e,t){return{...K(e.innerType._def,t),default:e.defaultValue()}}function X$(e,t){return t.effectStrategy==="input"?K(e.schema._def,t):Ne(t)}function Y$(e){return{type:"string",enum:Array.from(e.values)}}var wG=(e)=>{if("type"in e&&e.type==="string")return!1;return"allOf"in e};function Q$(e,t){let r=[K(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),K(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((i)=>!!i),o=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return r.forEach((i)=>{if(wG(i)){if(n.push(...i.allOf),i.unevaluatedProperties===void 0)o=void 0}else{let s=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:a,...c}=i;s=c}else o=void 0;n.push(s)}}),n.length?{allOf:n,...o}:void 0}function eO(e,t){let r=typeof e.value;if(r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string")return{type:Array.isArray(e.value)?"array":"object"};if(t.target==="openApi3")return{type:r==="bigint"?"integer":r,enum:[e.value]};return{type:r==="bigint"?"integer":r,const:e.value}}var iS=void 0,pr={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(iS===void 0)iS=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return iS},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 gm(e,t){let r={type:"string"};if(e.checks)for(let o of e.checks)switch(o.kind){case"min":ce(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,o.value):o.value,o.message,t);break;case"max":ce(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,o.value):o.value,o.message,t);break;case"email":switch(t.emailStrategy){case"format:email":fr(r,"email",o.message,t);break;case"format:idn-email":fr(r,"idn-email",o.message,t);break;case"pattern:zod":gt(r,pr.email,o.message,t);break}break;case"url":fr(r,"uri",o.message,t);break;case"uuid":fr(r,"uuid",o.message,t);break;case"regex":gt(r,o.regex,o.message,t);break;case"cuid":gt(r,pr.cuid,o.message,t);break;case"cuid2":gt(r,pr.cuid2,o.message,t);break;case"startsWith":gt(r,RegExp(`^${sS(o.value,t)}`),o.message,t);break;case"endsWith":gt(r,RegExp(`${sS(o.value,t)}$`),o.message,t);break;case"datetime":fr(r,"date-time",o.message,t);break;case"date":fr(r,"date",o.message,t);break;case"time":fr(r,"time",o.message,t);break;case"duration":fr(r,"duration",o.message,t);break;case"length":ce(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,o.value):o.value,o.message,t),ce(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,o.value):o.value,o.message,t);break;case"includes":{gt(r,RegExp(sS(o.value,t)),o.message,t);break}case"ip":{if(o.version!=="v6")fr(r,"ipv4",o.message,t);if(o.version!=="v4")fr(r,"ipv6",o.message,t);break}case"base64url":gt(r,pr.base64url,o.message,t);break;case"jwt":gt(r,pr.jwt,o.message,t);break;case"cidr":{if(o.version!=="v6")gt(r,pr.ipv4Cidr,o.message,t);if(o.version!=="v4")gt(r,pr.ipv6Cidr,o.message,t);break}case"emoji":gt(r,pr.emoji(),o.message,t);break;case"ulid":{gt(r,pr.ulid,o.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{fr(r,"binary",o.message,t);break}case"contentEncoding:base64":{ce(r,"contentEncoding","base64",o.message,t);break}case"pattern:zod":{gt(r,pr.base64,o.message,t);break}}break}case"nanoid":gt(r,pr.nanoid,o.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:((n)=>{})(o)}return r}function sS(e,t){return t.patternStrategy==="escape"?TG(e):e}var kG=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function TG(e){let t="";for(let r=0;r<e.length;r++){if(!kG.has(e[r]))t+="\\";t+=e[r]}return t}function fr(e,t,r,o){if(e.format||e.anyOf?.some((n)=>n.format)){if(!e.anyOf)e.anyOf=[];if(e.format){if(e.anyOf.push({format:e.format,...e.errorMessage&&o.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,...r&&o.errorMessages&&{errorMessage:{format:r}}})}else ce(e,"format",t,r,o)}function gt(e,t,r,o){if(e.pattern||e.allOf?.some((n)=>n.pattern)){if(!e.allOf)e.allOf=[];if(e.pattern){if(e.allOf.push({pattern:e.pattern,...e.errorMessage&&o.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:tO(t,o),...r&&o.errorMessages&&{errorMessage:{pattern:r}}})}else ce(e,"pattern",tO(t,o),r,o)}function tO(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},o=r.i?e.source.toLowerCase():e.source,n="",i=!1,s=!1,a=!1;for(let c=0;c<o.length;c++){if(i){n+=o[c],i=!1;continue}if(r.i){if(s){if(o[c].match(/[a-z]/)){if(a)n+=o[c],n+=`${o[c-2]}-${o[c]}`.toUpperCase(),a=!1;else if(o[c+1]==="-"&&o[c+2]?.match(/[a-z]/))n+=o[c],a=!0;else n+=`${o[c]}${o[c].toUpperCase()}`;continue}}else if(o[c].match(/[a-z]/)){n+=`[${o[c]}${o[c].toUpperCase()}]`;continue}}if(r.m){if(o[c]==="^"){n+=`(^|(?<=[\r
100
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);else if(r.cycles==="ref")i(u);continue}if(d.count>1){if(r.reused==="ref"){i(u);continue}}}let s=(u,d)=>{let p=this.seen.get(u),f=p.def??p.schema,m={...f};if(p.ref===null)return;let g=p.ref;if(p.ref=null,g){s(g,d);let h=this.seen.get(g).schema;if(h.$ref&&d.target==="draft-7")f.allOf=f.allOf??[],f.allOf.push(h);else Object.assign(f,h),Object.assign(f,m)}if(!p.isParent)this.override({zodSchema:u,jsonSchema:f,path:p.path??[]})};for(let u of[...this.seen.entries()].reverse())s(u[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,o.def);let c=r.external?.defs??{};for(let u of this.seen.entries()){let d=u[1];if(d.def&&d.defId)c[d.defId]=d.def}if(!r.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(u){throw Error("Error converting schema to JSON.")}}}function rs(e,t){if(e instanceof Pc){let o=new Rf(t),n={};for(let a of e._idmap.entries()){let[c,u]=a;o.process(u)}let i={},s={registry:e,uri:t?.uri||((a)=>a),defs:n};for(let a of e._idmap.entries()){let[c,u]=a;i[c]=o.emit(u,{...t,external:s})}if(Object.keys(n).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:n}}return{schemas:i}}let r=new Rf(t);return r.process(e),r.emit(e,t)}function Je(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;switch(n.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 Je(n.element,r);case"object":{for(let i in n.shape)if(Je(n.shape[i],r))return!0;return!1}case"union":{for(let i of n.options)if(Je(i,r))return!0;return!1}case"intersection":return Je(n.left,r)||Je(n.right,r);case"tuple":{for(let i of n.items)if(Je(i,r))return!0;if(n.rest&&Je(n.rest,r))return!0;return!1}case"record":return Je(n.keyType,r)||Je(n.valueType,r);case"map":return Je(n.keyType,r)||Je(n.valueType,r);case"set":return Je(n.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Je(n.innerType,r);case"lazy":return Je(n.getter(),r);case"default":return Je(n.innerType,r);case"prefault":return Je(n.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return Je(n.in,r)||Je(n.out,r);case"success":return!1;case"catch":return!1;default:}throw Error(`Unknown schema type: ${n.type}`)}var U0={};var ZV=b("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");G.init(e,t),e.def=t,e.parse=(r,o)=>Ro(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>Rn(e,r,o),e.parseAsync=async(r,o)=>$o(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>$n(e,r,o),e.check=(...r)=>{return e.clone({...t,checks:[...t.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]})},e.clone=(r,o)=>ct(e,r,o),e.brand=()=>e,e.register=(r,o)=>{return r.add(e,o),e}});var VV=b("ZodMiniObject",(e,t)=>{kc.init(e,t),ZV.init(e,t),A.defineLazy(e,"shape",()=>t.shape)});function nv(e,t){let r={type:"object",get shape(){return A.assignProp(this,"shape",{...e}),this.shape},...A.normalizeParams(t)};return new VV(r)}function Xt(e){return!!e._zod}function Do(e){let t=Object.values(e);if(t.length===0)return nv({});let r=t.every(Xt),o=t.every((n)=>!Xt(n));if(r)return nv(e);if(o)return m0(e);throw Error("Mixed Zod versions detected in object shape.")}function Nn(e,t){if(Xt(e))return Rn(e,t);return e.safeParse(t)}async function $f(e,t){if(Xt(e))return await $n(e,t);return await e.safeParseAsync(t)}function Dn(e){if(!e)return;let t;if(Xt(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 ns(e){if(!e)return;if(typeof e==="object"){let t=e,r=e;if(!t._def&&!r._zod){let o=Object.values(e);if(o.length>0&&o.every((n)=>typeof n==="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse==="function")))return Do(e)}}if(Xt(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e;return}function Of(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 L0(e){return e.description}function F0(e){if(Xt(e))return e._zod?.def?.type==="optional";let t=e;if(typeof e.isOptional==="function")return e.isOptional();return t._def?.typeName==="ZodOptional"}function Af(e){if(Xt(e)){let i=e._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=e.value;if(o!==void 0)return o;return}var l={};wr(l,{xid:()=>lW,void:()=>$W,uuidv7:()=>rW,uuidv6:()=>tW,uuidv4:()=>eW,uuid:()=>QV,url:()=>nW,uppercase:()=>Qc,unknown:()=>Oe,union:()=>we,undefined:()=>IW,ulid:()=>cW,uint64:()=>TW,uint32:()=>wW,tuple:()=>MW,trim:()=>il,treeifyError:()=>Vd,transform:()=>Nv,toUpperCase:()=>al,toLowerCase:()=>sl,toJSONSchema:()=>rs,templateLiteral:()=>BW,symbol:()=>PW,superRefine:()=>k$,success:()=>FW,stringbool:()=>VW,stringFormat:()=>_W,string:()=>S,strictObject:()=>CW,startsWith:()=>tl,size:()=>Jc,setErrorMap:()=>GW,set:()=>jW,safeParseAsync:()=>dv,safeParse:()=>uv,registry:()=>Ic,regexes:()=>On,regex:()=>Xc,refine:()=>w$,record:()=>ke,readonly:()=>y$,property:()=>ev,promise:()=>qW,prettifyError:()=>Wd,preprocess:()=>Vf,prefault:()=>u$,positive:()=>J_,pipe:()=>Uf,partialRecord:()=>NW,parseAsync:()=>lv,parse:()=>cv,overwrite:()=>Yr,optional:()=>Re,object:()=>U,number:()=>fe,nullish:()=>LW,nullable:()=>zf,null:()=>Lf,normalize:()=>ol,nonpositive:()=>Y_,nonoptional:()=>d$,nonnegative:()=>Q_,never:()=>Ff,negative:()=>X_,nativeEnum:()=>zW,nanoid:()=>iW,nan:()=>HW,multipleOf:()=>Mo,minSize:()=>No,minLength:()=>Mn,mime:()=>nl,maxSize:()=>Qi,maxLength:()=>es,map:()=>DW,lte:()=>Jt,lt:()=>Jr,lowercase:()=>Yc,looseObject:()=>lt,locales:()=>Xi,literal:()=>H,length:()=>ts,lazy:()=>v$,ksuid:()=>uW,keyof:()=>AW,jwt:()=>bW,json:()=>WW,iso:()=>os,ipv6:()=>pW,ipv4:()=>dW,intersection:()=>ml,int64:()=>EW,int32:()=>xW,int:()=>pv,instanceof:()=>ZW,includes:()=>el,guid:()=>YV,gte:()=>Tt,gt:()=>Xr,globalRegistry:()=>Et,getErrorMap:()=>JW,function:()=>If,formatError:()=>Zi,float64:()=>SW,float32:()=>vW,flattenError:()=>qi,file:()=>UW,enum:()=>mt,endsWith:()=>rl,emoji:()=>oW,email:()=>XV,e164:()=>yW,discriminatedUnion:()=>qf,date:()=>OW,custom:()=>Uv,cuid2:()=>aW,cuid:()=>sW,core:()=>dr,config:()=>He,coerce:()=>Lv,clone:()=>ct,cidrv6:()=>mW,cidrv4:()=>fW,check:()=>x$,catch:()=>m$,boolean:()=>Ve,bigint:()=>kW,base64url:()=>hW,base64:()=>gW,array:()=>ie,any:()=>RW,_default:()=>c$,_ZodString:()=>fv,ZodXID:()=>Sv,ZodVoid:()=>X0,ZodUnknown:()=>G0,ZodUnion:()=>Av,ZodUndefined:()=>V0,ZodUUID:()=>Qr,ZodURL:()=>gv,ZodULID:()=>vv,ZodType:()=>re,ZodTuple:()=>t$,ZodTransform:()=>Mv,ZodTemplateLiteral:()=>b$,ZodSymbol:()=>Z0,ZodSuccess:()=>p$,ZodStringFormat:()=>Ie,ZodString:()=>ul,ZodSet:()=>n$,ZodRecord:()=>Cv,ZodRealError:()=>is,ZodReadonly:()=>h$,ZodPromise:()=>S$,ZodPrefault:()=>l$,ZodPipe:()=>zv,ZodOptional:()=>Dv,ZodObject:()=>Bf,ZodNumberFormat:()=>ss,ZodNumber:()=>dl,ZodNullable:()=>s$,ZodNull:()=>W0,ZodNonOptional:()=>jv,ZodNever:()=>J0,ZodNanoID:()=>yv,ZodNaN:()=>g$,ZodMap:()=>r$,ZodLiteral:()=>o$,ZodLazy:()=>_$,ZodKSUID:()=>xv,ZodJWT:()=>$v,ZodIssueCode:()=>KW,ZodIntersection:()=>e$,ZodISOTime:()=>Nf,ZodISODuration:()=>Df,ZodISODateTime:()=>Cf,ZodISODate:()=>Mf,ZodIPv6:()=>kv,ZodIPv4:()=>wv,ZodGUID:()=>jf,ZodFile:()=>i$,ZodError:()=>GV,ZodEnum:()=>ll,ZodEmoji:()=>hv,ZodEmail:()=>mv,ZodE164:()=>Rv,ZodDiscriminatedUnion:()=>Q0,ZodDefault:()=>a$,ZodDate:()=>Hf,ZodCustomStringFormat:()=>q0,ZodCustom:()=>Zf,ZodCatch:()=>f$,ZodCUID2:()=>_v,ZodCUID:()=>bv,ZodCIDRv6:()=>Tv,ZodCIDRv4:()=>Ev,ZodBoolean:()=>pl,ZodBigIntFormat:()=>Ov,ZodBigInt:()=>fl,ZodBase64URL:()=>Iv,ZodBase64:()=>Pv,ZodArray:()=>Y0,ZodAny:()=>K0,TimePrecision:()=>nf,NEVER:()=>Bd,$output:()=>ef,$input:()=>tf,$brand:()=>qd});var os={};wr(os,{time:()=>sv,duration:()=>av,datetime:()=>ov,date:()=>iv,ZodISOTime:()=>Nf,ZodISODuration:()=>Df,ZodISODateTime:()=>Cf,ZodISODate:()=>Mf});var Cf=b("ZodISODateTime",(e,t)=>{Yb.init(e,t),Ie.init(e,t)});function ov(e){return H_(Cf,e)}var Mf=b("ZodISODate",(e,t)=>{Qb.init(e,t),Ie.init(e,t)});function iv(e){return B_(Mf,e)}var Nf=b("ZodISOTime",(e,t)=>{e_.init(e,t),Ie.init(e,t)});function sv(e){return q_(Nf,e)}var Df=b("ZodISODuration",(e,t)=>{t_.init(e,t),Ie.init(e,t)});function av(e){return Z_(Df,e)}var B0=(e,t)=>{Sc.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>Zi(e,r)},flatten:{value:(r)=>qi(e,r)},addIssue:{value:(r)=>e.issues.push(r)},addIssues:{value:(r)=>e.issues.push(...r)},isEmpty:{get(){return e.issues.length===0}}})},GV=b("ZodError",B0),is=b("ZodError",B0,{Parent:Error});var cv=Kd(is),lv=Gd(is),uv=Jd(is),dv=Xd(is);var re=b("ZodType",(e,t)=>{return G.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>{return e.clone({...t,checks:[...t.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]})},e.clone=(r,o)=>ct(e,r,o),e.brand=()=>e,e.register=(r,o)=>{return r.add(e,o),e},e.parse=(r,o)=>cv(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>uv(e,r,o),e.parseAsync=async(r,o)=>lv(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>dv(e,r,o),e.spa=e.safeParseAsync,e.refine=(r,o)=>e.check(w$(r,o)),e.superRefine=(r)=>e.check(k$(r)),e.overwrite=(r)=>e.check(Yr(r)),e.optional=()=>Re(e),e.nullable=()=>zf(e),e.nullish=()=>Re(zf(e)),e.nonoptional=(r)=>d$(e,r),e.array=()=>ie(e),e.or=(r)=>we([e,r]),e.and=(r)=>ml(e,r),e.transform=(r)=>Uf(e,Nv(r)),e.default=(r)=>c$(e,r),e.prefault=(r)=>u$(e,r),e.catch=(r)=>m$(e,r),e.pipe=(r)=>Uf(e,r),e.readonly=()=>y$(e),e.describe=(r)=>{let o=e.clone();return Et.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return Et.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Et.get(e);let o=e.clone();return Et.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e}),fv=b("_ZodString",(e,t)=>{An.init(e,t),re.init(e,t);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...o)=>e.check(Xc(...o)),e.includes=(...o)=>e.check(el(...o)),e.startsWith=(...o)=>e.check(tl(...o)),e.endsWith=(...o)=>e.check(rl(...o)),e.min=(...o)=>e.check(Mn(...o)),e.max=(...o)=>e.check(es(...o)),e.length=(...o)=>e.check(ts(...o)),e.nonempty=(...o)=>e.check(Mn(1,...o)),e.lowercase=(o)=>e.check(Yc(o)),e.uppercase=(o)=>e.check(Qc(o)),e.trim=()=>e.check(il()),e.normalize=(...o)=>e.check(ol(...o)),e.toLowerCase=()=>e.check(sl()),e.toUpperCase=()=>e.check(al())}),ul=b("ZodString",(e,t)=>{An.init(e,t),fv.init(e,t),e.email=(r)=>e.check(Rc(mv,r)),e.url=(r)=>e.check(Mc(gv,r)),e.jwt=(r)=>e.check(Gc($v,r)),e.emoji=(r)=>e.check(Nc(hv,r)),e.guid=(r)=>e.check(Yi(jf,r)),e.uuid=(r)=>e.check($c(Qr,r)),e.uuidv4=(r)=>e.check(Oc(Qr,r)),e.uuidv6=(r)=>e.check(Ac(Qr,r)),e.uuidv7=(r)=>e.check(Cc(Qr,r)),e.nanoid=(r)=>e.check(Dc(yv,r)),e.guid=(r)=>e.check(Yi(jf,r)),e.cuid=(r)=>e.check(jc(bv,r)),e.cuid2=(r)=>e.check(zc(_v,r)),e.ulid=(r)=>e.check(Uc(vv,r)),e.base64=(r)=>e.check(Vc(Pv,r)),e.base64url=(r)=>e.check(Wc(Iv,r)),e.xid=(r)=>e.check(Lc(Sv,r)),e.ksuid=(r)=>e.check(Fc(xv,r)),e.ipv4=(r)=>e.check(Hc(wv,r)),e.ipv6=(r)=>e.check(Bc(kv,r)),e.cidrv4=(r)=>e.check(qc(Ev,r)),e.cidrv6=(r)=>e.check(Zc(Tv,r)),e.e164=(r)=>e.check(Kc(Rv,r)),e.datetime=(r)=>e.check(ov(r)),e.date=(r)=>e.check(iv(r)),e.time=(r)=>e.check(sv(r)),e.duration=(r)=>e.check(av(r))});function S(e){return rf(ul,e)}var Ie=b("ZodStringFormat",(e,t)=>{xe.init(e,t),fv.init(e,t)}),mv=b("ZodEmail",(e,t)=>{sp.init(e,t),Ie.init(e,t)});function XV(e){return Rc(mv,e)}var jf=b("ZodGUID",(e,t)=>{op.init(e,t),Ie.init(e,t)});function YV(e){return Yi(jf,e)}var Qr=b("ZodUUID",(e,t)=>{ip.init(e,t),Ie.init(e,t)});function QV(e){return $c(Qr,e)}function eW(e){return Oc(Qr,e)}function tW(e){return Ac(Qr,e)}function rW(e){return Cc(Qr,e)}var gv=b("ZodURL",(e,t)=>{ap.init(e,t),Ie.init(e,t)});function nW(e){return Mc(gv,e)}var hv=b("ZodEmoji",(e,t)=>{cp.init(e,t),Ie.init(e,t)});function oW(e){return Nc(hv,e)}var yv=b("ZodNanoID",(e,t)=>{lp.init(e,t),Ie.init(e,t)});function iW(e){return Dc(yv,e)}var bv=b("ZodCUID",(e,t)=>{up.init(e,t),Ie.init(e,t)});function sW(e){return jc(bv,e)}var _v=b("ZodCUID2",(e,t)=>{dp.init(e,t),Ie.init(e,t)});function aW(e){return zc(_v,e)}var vv=b("ZodULID",(e,t)=>{pp.init(e,t),Ie.init(e,t)});function cW(e){return Uc(vv,e)}var Sv=b("ZodXID",(e,t)=>{fp.init(e,t),Ie.init(e,t)});function lW(e){return Lc(Sv,e)}var xv=b("ZodKSUID",(e,t)=>{mp.init(e,t),Ie.init(e,t)});function uW(e){return Fc(xv,e)}var wv=b("ZodIPv4",(e,t)=>{gp.init(e,t),Ie.init(e,t)});function dW(e){return Hc(wv,e)}var kv=b("ZodIPv6",(e,t)=>{hp.init(e,t),Ie.init(e,t)});function pW(e){return Bc(kv,e)}var Ev=b("ZodCIDRv4",(e,t)=>{yp.init(e,t),Ie.init(e,t)});function fW(e){return qc(Ev,e)}var Tv=b("ZodCIDRv6",(e,t)=>{bp.init(e,t),Ie.init(e,t)});function mW(e){return Zc(Tv,e)}var Pv=b("ZodBase64",(e,t)=>{_p.init(e,t),Ie.init(e,t)});function gW(e){return Vc(Pv,e)}var Iv=b("ZodBase64URL",(e,t)=>{vp.init(e,t),Ie.init(e,t)});function hW(e){return Wc(Iv,e)}var Rv=b("ZodE164",(e,t)=>{Sp.init(e,t),Ie.init(e,t)});function yW(e){return Kc(Rv,e)}var $v=b("ZodJWT",(e,t)=>{xp.init(e,t),Ie.init(e,t)});function bW(e){return Gc($v,e)}var q0=b("ZodCustomStringFormat",(e,t)=>{wp.init(e,t),Ie.init(e,t)});function _W(e,t,r={}){return Pf(q0,e,t,r)}var dl=b("ZodNumber",(e,t)=>{xc.init(e,t),re.init(e,t),e.gt=(o,n)=>e.check(Xr(o,n)),e.gte=(o,n)=>e.check(Tt(o,n)),e.min=(o,n)=>e.check(Tt(o,n)),e.lt=(o,n)=>e.check(Jr(o,n)),e.lte=(o,n)=>e.check(Jt(o,n)),e.max=(o,n)=>e.check(Jt(o,n)),e.int=(o)=>e.check(pv(o)),e.safe=(o)=>e.check(pv(o)),e.positive=(o)=>e.check(Xr(0,o)),e.nonnegative=(o)=>e.check(Tt(0,o)),e.negative=(o)=>e.check(Jr(0,o)),e.nonpositive=(o)=>e.check(Jt(0,o)),e.multipleOf=(o,n)=>e.check(Mo(o,n)),e.step=(o,n)=>e.check(Mo(o,n)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function fe(e){return of(dl,e)}var ss=b("ZodNumberFormat",(e,t)=>{kp.init(e,t),dl.init(e,t)});function pv(e){return sf(ss,e)}function vW(e){return af(ss,e)}function SW(e){return cf(ss,e)}function xW(e){return lf(ss,e)}function wW(e){return uf(ss,e)}var pl=b("ZodBoolean",(e,t)=>{Wi.init(e,t),re.init(e,t)});function Ve(e){return df(pl,e)}var fl=b("ZodBigInt",(e,t)=>{wc.init(e,t),re.init(e,t),e.gte=(o,n)=>e.check(Tt(o,n)),e.min=(o,n)=>e.check(Tt(o,n)),e.gt=(o,n)=>e.check(Xr(o,n)),e.gte=(o,n)=>e.check(Tt(o,n)),e.min=(o,n)=>e.check(Tt(o,n)),e.lt=(o,n)=>e.check(Jr(o,n)),e.lte=(o,n)=>e.check(Jt(o,n)),e.max=(o,n)=>e.check(Jt(o,n)),e.positive=(o)=>e.check(Xr(BigInt(0),o)),e.negative=(o)=>e.check(Jr(BigInt(0),o)),e.nonpositive=(o)=>e.check(Jt(BigInt(0),o)),e.nonnegative=(o)=>e.check(Tt(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(Mo(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function kW(e){return pf(fl,e)}var Ov=b("ZodBigIntFormat",(e,t)=>{Ep.init(e,t),fl.init(e,t)});function EW(e){return ff(Ov,e)}function TW(e){return mf(Ov,e)}var Z0=b("ZodSymbol",(e,t)=>{Tp.init(e,t),re.init(e,t)});function PW(e){return gf(Z0,e)}var V0=b("ZodUndefined",(e,t)=>{Pp.init(e,t),re.init(e,t)});function IW(e){return hf(V0,e)}var W0=b("ZodNull",(e,t)=>{Ip.init(e,t),re.init(e,t)});function Lf(e){return yf(W0,e)}var K0=b("ZodAny",(e,t)=>{Rp.init(e,t),re.init(e,t)});function RW(){return bf(K0)}var G0=b("ZodUnknown",(e,t)=>{Ao.init(e,t),re.init(e,t)});function Oe(){return Co(G0)}var J0=b("ZodNever",(e,t)=>{$p.init(e,t),re.init(e,t)});function Ff(e){return _f(J0,e)}var X0=b("ZodVoid",(e,t)=>{Op.init(e,t),re.init(e,t)});function $W(e){return vf(X0,e)}var Hf=b("ZodDate",(e,t)=>{Ap.init(e,t),re.init(e,t),e.min=(o,n)=>e.check(Tt(o,n)),e.max=(o,n)=>e.check(Jt(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function OW(e){return Sf(Hf,e)}var Y0=b("ZodArray",(e,t)=>{Ki.init(e,t),re.init(e,t),e.element=t.element,e.min=(r,o)=>e.check(Mn(r,o)),e.nonempty=(r)=>e.check(Mn(1,r)),e.max=(r,o)=>e.check(es(r,o)),e.length=(r,o)=>e.check(ts(r,o)),e.unwrap=()=>e.element});function ie(e,t){return cl(Y0,e,t)}function AW(e){let t=e._zod.def.shape;return H(Object.keys(t))}var Bf=b("ZodObject",(e,t)=>{kc.init(e,t),re.init(e,t),A.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>mt(Object.keys(e._zod.def.shape)),e.catchall=(r)=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Oe()}),e.loose=()=>e.clone({...e._zod.def,catchall:Oe()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ff()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(r)=>{return A.extend(e,r)},e.merge=(r)=>A.merge(e,r),e.pick=(r)=>A.pick(e,r),e.omit=(r)=>A.omit(e,r),e.partial=(...r)=>A.partial(Dv,e,r[0]),e.required=(...r)=>A.required(jv,e,r[0])});function U(e,t){let r={type:"object",get shape(){return A.assignProp(this,"shape",{...e}),this.shape},...A.normalizeParams(t)};return new Bf(r)}function CW(e,t){return new Bf({type:"object",get shape(){return A.assignProp(this,"shape",{...e}),this.shape},catchall:Ff(),...A.normalizeParams(t)})}function lt(e,t){return new Bf({type:"object",get shape(){return A.assignProp(this,"shape",{...e}),this.shape},catchall:Oe(),...A.normalizeParams(t)})}var Av=b("ZodUnion",(e,t)=>{Ec.init(e,t),re.init(e,t),e.options=t.options});function we(e,t){return new Av({type:"union",options:e,...A.normalizeParams(t)})}var Q0=b("ZodDiscriminatedUnion",(e,t)=>{Av.init(e,t),Cp.init(e,t)});function qf(e,t,r){return new Q0({type:"union",options:t,discriminator:e,...A.normalizeParams(r)})}var e$=b("ZodIntersection",(e,t)=>{Mp.init(e,t),re.init(e,t)});function ml(e,t){return new e$({type:"intersection",left:e,right:t})}var t$=b("ZodTuple",(e,t)=>{Cn.init(e,t),re.init(e,t),e.rest=(r)=>e.clone({...e._zod.def,rest:r})});function MW(e,t,r){let o=t instanceof G,n=o?r:t;return new t$({type:"tuple",items:e,rest:o?t:null,...A.normalizeParams(n)})}var Cv=b("ZodRecord",(e,t)=>{Np.init(e,t),re.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function ke(e,t,r){return new Cv({type:"record",keyType:e,valueType:t,...A.normalizeParams(r)})}function NW(e,t,r){return new Cv({type:"record",keyType:we([e,Ff()]),valueType:t,...A.normalizeParams(r)})}var r$=b("ZodMap",(e,t)=>{Dp.init(e,t),re.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function DW(e,t,r){return new r$({type:"map",keyType:e,valueType:t,...A.normalizeParams(r)})}var n$=b("ZodSet",(e,t)=>{jp.init(e,t),re.init(e,t),e.min=(...r)=>e.check(No(...r)),e.nonempty=(r)=>e.check(No(1,r)),e.max=(...r)=>e.check(Qi(...r)),e.size=(...r)=>e.check(Jc(...r))});function jW(e,t){return new n$({type:"set",valueType:e,...A.normalizeParams(t)})}var ll=b("ZodEnum",(e,t)=>{zp.init(e,t),re.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let s of o)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new ll({...t,checks:[],...A.normalizeParams(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let s of o)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new ll({...t,checks:[],...A.normalizeParams(n),entries:i})}});function mt(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new ll({type:"enum",entries:r,...A.normalizeParams(t)})}function zW(e,t){return new ll({type:"enum",entries:e,...A.normalizeParams(t)})}var o$=b("ZodLiteral",(e,t)=>{Up.init(e,t),re.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 H(e,t){return new o$({type:"literal",values:Array.isArray(e)?e:[e],...A.normalizeParams(t)})}var i$=b("ZodFile",(e,t)=>{Lp.init(e,t),re.init(e,t),e.min=(r,o)=>e.check(No(r,o)),e.max=(r,o)=>e.check(Qi(r,o)),e.mime=(r,o)=>e.check(nl(Array.isArray(r)?r:[r],o))});function UW(e){return wf(i$,e)}var Mv=b("ZodTransform",(e,t)=>{Gi.init(e,t),re.init(e,t),e._zod.parse=(r,o)=>{r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(A.issue(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),s.continue??(s.continue=!0),r.issues.push(A.issue(s))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((i)=>{return r.value=i,r});return r.value=n,r}});function Nv(e){return new Mv({type:"transform",transform:e})}var Dv=b("ZodOptional",(e,t)=>{Fp.init(e,t),re.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Re(e){return new Dv({type:"optional",innerType:e})}var s$=b("ZodNullable",(e,t)=>{Hp.init(e,t),re.init(e,t),e.unwrap=()=>e._zod.def.innerType});function zf(e){return new s$({type:"nullable",innerType:e})}function LW(e){return Re(zf(e))}var a$=b("ZodDefault",(e,t)=>{Bp.init(e,t),re.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function c$(e,t){return new a$({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():t}})}var l$=b("ZodPrefault",(e,t)=>{qp.init(e,t),re.init(e,t),e.unwrap=()=>e._zod.def.innerType});function u$(e,t){return new l$({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():t}})}var jv=b("ZodNonOptional",(e,t)=>{Zp.init(e,t),re.init(e,t),e.unwrap=()=>e._zod.def.innerType});function d$(e,t){return new jv({type:"nonoptional",innerType:e,...A.normalizeParams(t)})}var p$=b("ZodSuccess",(e,t)=>{Vp.init(e,t),re.init(e,t),e.unwrap=()=>e._zod.def.innerType});function FW(e){return new p$({type:"success",innerType:e})}var f$=b("ZodCatch",(e,t)=>{Wp.init(e,t),re.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function m$(e,t){return new f$({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var g$=b("ZodNaN",(e,t)=>{Kp.init(e,t),re.init(e,t)});function HW(e){return xf(g$,e)}var zv=b("ZodPipe",(e,t)=>{Ji.init(e,t),re.init(e,t),e.in=t.in,e.out=t.out});function Uf(e,t){return new zv({type:"pipe",in:e,out:t})}var h$=b("ZodReadonly",(e,t)=>{Gp.init(e,t),re.init(e,t)});function y$(e){return new h$({type:"readonly",innerType:e})}var b$=b("ZodTemplateLiteral",(e,t)=>{Jp.init(e,t),re.init(e,t)});function BW(e,t){return new b$({type:"template_literal",parts:e,...A.normalizeParams(t)})}var _$=b("ZodLazy",(e,t)=>{Yp.init(e,t),re.init(e,t),e.unwrap=()=>e._zod.def.getter()});function v$(e){return new _$({type:"lazy",getter:e})}var S$=b("ZodPromise",(e,t)=>{Xp.init(e,t),re.init(e,t),e.unwrap=()=>e._zod.def.innerType});function qW(e){return new S$({type:"promise",innerType:e})}var Zf=b("ZodCustom",(e,t)=>{Qp.init(e,t),re.init(e,t)});function x$(e,t){let r=new Me({check:"custom",...A.normalizeParams(t)});return r._zod.check=e,r}function Uv(e,t){return kf(Zf,e??(()=>!0),t)}function w$(e,t={}){return Ef(Zf,e,t)}function k$(e,t){let r=x$((o)=>{return o.addIssue=(n)=>{if(typeof n==="string")o.issues.push(A.issue(n,o.value,r._zod.def));else{let i=n;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=o.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),o.issues.push(A.issue(i))}},e(o.value,o)},t);return r}function ZW(e,t={error:`Input not instance of ${e.name}`}){let r=new Zf({type:"custom",check:"custom",fn:(o)=>o instanceof e,abort:!0,...A.normalizeParams(t)});return r._zod.bag.Class=e,r}var VW=(...e)=>Tf({Pipe:zv,Boolean:pl,String:ul,Transform:Mv},...e);function WW(e){let t=v$(()=>{return we([S(e),fe(),Ve(),Lf(),ie(t),ke(S(),t)])});return t}function Vf(e,t){return Uf(Nv(e),t)}var KW={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"};function GW(e){He({customError:e})}function JW(){return He().customError}var Lv={};wr(Lv,{string:()=>XW,number:()=>YW,date:()=>tK,boolean:()=>QW,bigint:()=>eK});function XW(e){return F_(ul,e)}function YW(e){return V_(dl,e)}function QW(e){return W_(pl,e)}function eK(e){return K_(fl,e)}function tK(e){return G_(Hf,e)}He(Tc());var E$=l;var Fv=E$;var Hv="2025-11-25";var T$=[Hv,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],jn="io.modelcontextprotocol/related-task",Kf="2.0",Xe=Uv((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),P$=we([S(),fe().int()]),I$=S(),lSe=lt({ttl:fe().optional(),pollInterval:fe().optional()}),nK=U({ttl:fe().optional()}),oK=U({taskId:S()}),Bv=lt({progressToken:P$.optional(),[jn]:oK.optional()}),Ut=U({_meta:Bv.optional()}),gl=Ut.extend({task:nK.optional()}),R$=(e)=>gl.safeParse(e).success,rt=U({method:S(),params:Ut.loose().optional()}),Yt=U({_meta:Bv.optional()}),Qt=U({method:S(),params:Yt.loose().optional()}),nt=lt({_meta:Bv.optional()}),Gf=we([S(),fe().int()]),$$=U({jsonrpc:H(Kf),id:Gf,...rt.shape}).strict(),qv=(e)=>$$.safeParse(e).success,O$=U({jsonrpc:H(Kf),...Qt.shape}).strict(),A$=(e)=>O$.safeParse(e).success,Zv=U({jsonrpc:H(Kf),id:Gf,result:nt}).strict(),hl=(e)=>Zv.safeParse(e).success;var Z;(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"})(Z||(Z={}));var Vv=U({jsonrpc:H(Kf),id:Gf.optional(),error:U({code:fe().int(),message:S(),data:Oe().optional()})}).strict();var C$=(e)=>Vv.safeParse(e).success;var uSe=we([$$,O$,Zv,Vv]),dSe=we([Zv,Vv]),Jf=nt.strict(),iK=Yt.extend({requestId:Gf.optional(),reason:S().optional()}),Xf=Qt.extend({method:H("notifications/cancelled"),params:iK}),sK=U({src:S(),mimeType:S().optional(),sizes:ie(S()).optional(),theme:mt(["light","dark"]).optional()}),yl=U({icons:ie(sK).optional()}),as=U({name:S(),title:S().optional()}),M$=as.extend({...as.shape,...yl.shape,version:S(),websiteUrl:S().optional(),description:S().optional()}),aK=ml(U({applyDefaults:Ve().optional()}),ke(S(),Oe())),cK=Vf((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},ml(U({form:aK.optional(),url:Xe.optional()}),ke(S(),Oe()).optional())),lK=lt({list:Xe.optional(),cancel:Xe.optional(),requests:lt({sampling:lt({createMessage:Xe.optional()}).optional(),elicitation:lt({create:Xe.optional()}).optional()}).optional()}),uK=lt({list:Xe.optional(),cancel:Xe.optional(),requests:lt({tools:lt({call:Xe.optional()}).optional()}).optional()}),dK=U({experimental:ke(S(),Xe).optional(),sampling:U({context:Xe.optional(),tools:Xe.optional()}).optional(),elicitation:cK.optional(),roots:U({listChanged:Ve().optional()}).optional(),tasks:lK.optional(),extensions:ke(S(),Xe).optional()}),pK=Ut.extend({protocolVersion:S(),capabilities:dK,clientInfo:M$}),Wv=rt.extend({method:H("initialize"),params:pK});var fK=U({experimental:ke(S(),Xe).optional(),logging:Xe.optional(),completions:Xe.optional(),prompts:U({listChanged:Ve().optional()}).optional(),resources:U({subscribe:Ve().optional(),listChanged:Ve().optional()}).optional(),tools:U({listChanged:Ve().optional()}).optional(),tasks:uK.optional(),extensions:ke(S(),Xe).optional()}),mK=nt.extend({protocolVersion:S(),capabilities:fK,serverInfo:M$,instructions:S().optional()}),Kv=Qt.extend({method:H("notifications/initialized"),params:Yt.optional()});var Yf=rt.extend({method:H("ping"),params:Ut.optional()}),gK=U({progress:fe(),total:Re(fe()),message:Re(S())}),hK=U({...Yt.shape,...gK.shape,progressToken:P$}),Qf=Qt.extend({method:H("notifications/progress"),params:hK}),yK=Ut.extend({cursor:I$.optional()}),bl=rt.extend({params:yK.optional()}),_l=nt.extend({nextCursor:I$.optional()}),bK=mt(["working","input_required","completed","failed","cancelled"]),vl=U({taskId:S(),status:bK,ttl:we([fe(),Lf()]),createdAt:S(),lastUpdatedAt:S(),pollInterval:Re(fe()),statusMessage:Re(S())}),cs=nt.extend({task:vl}),_K=Yt.merge(vl),Sl=Qt.extend({method:H("notifications/tasks/status"),params:_K}),em=rt.extend({method:H("tasks/get"),params:Ut.extend({taskId:S()})}),tm=nt.merge(vl),rm=rt.extend({method:H("tasks/result"),params:Ut.extend({taskId:S()})}),pSe=nt.loose(),nm=bl.extend({method:H("tasks/list")}),om=_l.extend({tasks:ie(vl)}),im=rt.extend({method:H("tasks/cancel"),params:Ut.extend({taskId:S()})}),N$=nt.merge(vl),D$=U({uri:S(),mimeType:Re(S()),_meta:ke(S(),Oe()).optional()}),j$=D$.extend({text:S()}),Gv=S().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),z$=D$.extend({blob:Gv}),xl=mt(["user","assistant"]),ls=U({audience:ie(xl).optional(),priority:fe().min(0).max(1).optional(),lastModified:os.datetime({offset:!0}).optional()}),U$=U({...as.shape,...yl.shape,uri:S(),description:Re(S()),mimeType:Re(S()),size:Re(fe()),annotations:ls.optional(),_meta:Re(lt({}))}),vK=U({...as.shape,...yl.shape,uriTemplate:S(),description:Re(S()),mimeType:Re(S()),annotations:ls.optional(),_meta:Re(lt({}))}),sm=bl.extend({method:H("resources/list")}),SK=_l.extend({resources:ie(U$)}),am=bl.extend({method:H("resources/templates/list")}),xK=_l.extend({resourceTemplates:ie(vK)}),Jv=Ut.extend({uri:S()}),wK=Jv,cm=rt.extend({method:H("resources/read"),params:wK}),kK=nt.extend({contents:ie(we([j$,z$]))}),EK=Qt.extend({method:H("notifications/resources/list_changed"),params:Yt.optional()}),TK=Jv,PK=rt.extend({method:H("resources/subscribe"),params:TK}),IK=Jv,RK=rt.extend({method:H("resources/unsubscribe"),params:IK}),$K=Yt.extend({uri:S()}),OK=Qt.extend({method:H("notifications/resources/updated"),params:$K}),AK=U({name:S(),description:Re(S()),required:Re(Ve())}),CK=U({...as.shape,...yl.shape,description:Re(S()),arguments:Re(ie(AK)),_meta:Re(lt({}))}),lm=bl.extend({method:H("prompts/list")}),MK=_l.extend({prompts:ie(CK)}),NK=Ut.extend({name:S(),arguments:ke(S(),S()).optional()}),um=rt.extend({method:H("prompts/get"),params:NK}),Xv=U({type:H("text"),text:S(),annotations:ls.optional(),_meta:ke(S(),Oe()).optional()}),Yv=U({type:H("image"),data:Gv,mimeType:S(),annotations:ls.optional(),_meta:ke(S(),Oe()).optional()}),Qv=U({type:H("audio"),data:Gv,mimeType:S(),annotations:ls.optional(),_meta:ke(S(),Oe()).optional()}),DK=U({type:H("tool_use"),name:S(),id:S(),input:ke(S(),Oe()),_meta:ke(S(),Oe()).optional()}),jK=U({type:H("resource"),resource:we([j$,z$]),annotations:ls.optional(),_meta:ke(S(),Oe()).optional()}),zK=U$.extend({type:H("resource_link")}),eS=we([Xv,Yv,Qv,zK,jK]),UK=U({role:xl,content:eS}),LK=nt.extend({description:S().optional(),messages:ie(UK)}),FK=Qt.extend({method:H("notifications/prompts/list_changed"),params:Yt.optional()}),HK=U({title:S().optional(),readOnlyHint:Ve().optional(),destructiveHint:Ve().optional(),idempotentHint:Ve().optional(),openWorldHint:Ve().optional()}),BK=U({taskSupport:mt(["required","optional","forbidden"]).optional()}),L$=U({...as.shape,...yl.shape,description:S().optional(),inputSchema:U({type:H("object"),properties:ke(S(),Xe).optional(),required:ie(S()).optional()}).catchall(Oe()),outputSchema:U({type:H("object"),properties:ke(S(),Xe).optional(),required:ie(S()).optional()}).catchall(Oe()).optional(),annotations:HK.optional(),execution:BK.optional(),_meta:ke(S(),Oe()).optional()}),dm=bl.extend({method:H("tools/list")}),qK=_l.extend({tools:ie(L$)}),pm=nt.extend({content:ie(eS).default([]),structuredContent:ke(S(),Oe()).optional(),isError:Ve().optional()}),fSe=pm.or(nt.extend({toolResult:Oe()})),ZK=gl.extend({name:S(),arguments:ke(S(),Oe()).optional()}),us=rt.extend({method:H("tools/call"),params:ZK}),VK=Qt.extend({method:H("notifications/tools/list_changed"),params:Yt.optional()}),mSe=U({autoRefresh:Ve().default(!0),debounceMs:fe().int().nonnegative().default(300)}),wl=mt(["debug","info","notice","warning","error","critical","alert","emergency"]),WK=Ut.extend({level:wl}),tS=rt.extend({method:H("logging/setLevel"),params:WK}),KK=Yt.extend({level:wl,logger:S().optional(),data:Oe()}),GK=Qt.extend({method:H("notifications/message"),params:KK}),JK=U({name:S().optional()}),XK=U({hints:ie(JK).optional(),costPriority:fe().min(0).max(1).optional(),speedPriority:fe().min(0).max(1).optional(),intelligencePriority:fe().min(0).max(1).optional()}),YK=U({mode:mt(["auto","required","none"]).optional()}),QK=U({type:H("tool_result"),toolUseId:S().describe("The unique identifier for the corresponding tool call."),content:ie(eS).default([]),structuredContent:U({}).loose().optional(),isError:Ve().optional(),_meta:ke(S(),Oe()).optional()}),eG=qf("type",[Xv,Yv,Qv]),Wf=qf("type",[Xv,Yv,Qv,DK,QK]),tG=U({role:xl,content:we([Wf,ie(Wf)]),_meta:ke(S(),Oe()).optional()}),rG=gl.extend({messages:ie(tG),modelPreferences:XK.optional(),systemPrompt:S().optional(),includeContext:mt(["none","thisServer","allServers"]).optional(),temperature:fe().optional(),maxTokens:fe().int(),stopSequences:ie(S()).optional(),metadata:Xe.optional(),tools:ie(L$).optional(),toolChoice:YK.optional()}),nG=rt.extend({method:H("sampling/createMessage"),params:rG}),kl=nt.extend({model:S(),stopReason:Re(mt(["endTurn","stopSequence","maxTokens"]).or(S())),role:xl,content:eG}),rS=nt.extend({model:S(),stopReason:Re(mt(["endTurn","stopSequence","maxTokens","toolUse"]).or(S())),role:xl,content:we([Wf,ie(Wf)])}),oG=U({type:H("boolean"),title:S().optional(),description:S().optional(),default:Ve().optional()}),iG=U({type:H("string"),title:S().optional(),description:S().optional(),minLength:fe().optional(),maxLength:fe().optional(),format:mt(["email","uri","date","date-time"]).optional(),default:S().optional()}),sG=U({type:mt(["number","integer"]),title:S().optional(),description:S().optional(),minimum:fe().optional(),maximum:fe().optional(),default:fe().optional()}),aG=U({type:H("string"),title:S().optional(),description:S().optional(),enum:ie(S()),default:S().optional()}),cG=U({type:H("string"),title:S().optional(),description:S().optional(),oneOf:ie(U({const:S(),title:S()})),default:S().optional()}),lG=U({type:H("string"),title:S().optional(),description:S().optional(),enum:ie(S()),enumNames:ie(S()).optional(),default:S().optional()}),uG=we([aG,cG]),dG=U({type:H("array"),title:S().optional(),description:S().optional(),minItems:fe().optional(),maxItems:fe().optional(),items:U({type:H("string"),enum:ie(S())}),default:ie(S()).optional()}),pG=U({type:H("array"),title:S().optional(),description:S().optional(),minItems:fe().optional(),maxItems:fe().optional(),items:U({anyOf:ie(U({const:S(),title:S()}))}),default:ie(S()).optional()}),fG=we([dG,pG]),mG=we([lG,uG,fG]),gG=we([mG,oG,iG,sG]),hG=gl.extend({mode:H("form").optional(),message:S(),requestedSchema:U({type:H("object"),properties:ke(S(),gG),required:ie(S()).optional()})}),yG=gl.extend({mode:H("url"),message:S(),elicitationId:S(),url:S().url()}),bG=we([hG,yG]),_G=rt.extend({method:H("elicitation/create"),params:bG}),vG=Yt.extend({elicitationId:S()}),SG=Qt.extend({method:H("notifications/elicitation/complete"),params:vG}),ds=nt.extend({action:mt(["accept","decline","cancel"]),content:Vf((e)=>e===null?void 0:e,ke(S(),we([S(),fe(),Ve(),ie(S())])).optional())}),xG=U({type:H("ref/resource"),uri:S()});var wG=U({type:H("ref/prompt"),name:S()}),kG=Ut.extend({ref:we([wG,xG]),argument:U({name:S(),value:S()}),context:U({arguments:ke(S(),S()).optional()}).optional()}),fm=rt.extend({method:H("completion/complete"),params:kG});function F$(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function H$(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var EG=nt.extend({completion:lt({values:ie(S()).max(100),total:Re(fe().int()),hasMore:Re(Ve())})}),TG=U({uri:S().startsWith("file://"),name:S().optional(),_meta:ke(S(),Oe()).optional()}),PG=rt.extend({method:H("roots/list"),params:Ut.optional()}),nS=nt.extend({roots:ie(TG)}),IG=Qt.extend({method:H("notifications/roots/list_changed"),params:Yt.optional()}),gSe=we([Yf,Wv,fm,tS,um,lm,sm,am,cm,PK,RK,us,dm,em,rm,nm,im]),hSe=we([Xf,Qf,Kv,IG,Sl]),ySe=we([Jf,kl,rS,ds,nS,tm,om,cs]),bSe=we([Yf,nG,_G,PG,em,rm,nm,im]),_Se=we([Xf,Qf,GK,OK,EK,VK,FK,Sl,SG]),vSe=we([Jf,mK,EG,LK,MK,SK,xK,kK,pm,qK,tm,om,cs]);class B extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===Z.UrlElicitationRequired&&r){let o=r;if(o.elicitations)return new B$(o.elicitations,t)}return new B(e,t,r)}}class B$ extends B{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(Z.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function zn(e){return e==="completed"||e==="failed"||e==="cancelled"}var Z$=Symbol("Let zodToJsonSchema decide on which parser to use");var q$={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"},V$=(e)=>typeof e==="string"?{...q$,name:e}:{...q$,...e};var W$=(e)=>{let t=V$(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([o,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,o],jsonSchema:void 0}]))}};function oS(e,t,r,o){if(!o?.errorMessages)return;if(r)e.errorMessage={...e.errorMessage,[t]:r}}function ce(e,t,r,o,n){e[t]=r,oS(e,t,o,n)}var mm=(e,t)=>{let r=0;for(;r<e.length&&r<t.length;r++)if(e[r]!==t[r])break;return[(e.length-r).toString(),...t.slice(r)].join("/")};function Ne(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?mm(t,e.currentPath):t.join("/")}}function K$(e,t){let r={type:"array"};if(e.type?._def&&e.type?._def?.typeName!==R.ZodAny)r.items=K(e.type._def,{...t,currentPath:[...t.currentPath,"items"]});if(e.minLength)ce(r,"minItems",e.minLength.value,e.minLength.message,t);if(e.maxLength)ce(r,"maxItems",e.maxLength.value,e.maxLength.message,t);if(e.exactLength)ce(r,"minItems",e.exactLength.value,e.exactLength.message,t),ce(r,"maxItems",e.exactLength.value,e.exactLength.message,t);return r}function G$(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let o of e.checks)switch(o.kind){case"min":if(t.target==="jsonSchema7")if(o.inclusive)ce(r,"minimum",o.value,o.message,t);else ce(r,"exclusiveMinimum",o.value,o.message,t);else{if(!o.inclusive)r.exclusiveMinimum=!0;ce(r,"minimum",o.value,o.message,t)}break;case"max":if(t.target==="jsonSchema7")if(o.inclusive)ce(r,"maximum",o.value,o.message,t);else ce(r,"exclusiveMaximum",o.value,o.message,t);else{if(!o.inclusive)r.exclusiveMaximum=!0;ce(r,"maximum",o.value,o.message,t)}break;case"multipleOf":ce(r,"multipleOf",o.value,o.message,t);break}return r}function J$(){return{type:"boolean"}}function gm(e,t){return K(e.type._def,t)}var X$=(e,t)=>{return K(e.innerType._def,t)};function iS(e,t,r){let o=r??t.dateStrategy;if(Array.isArray(o))return{anyOf:o.map((n,i)=>iS(e,t,n))};switch(o){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return RG(e,t)}}var RG=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let o of e.checks)switch(o.kind){case"min":ce(r,"minimum",o.value,o.message,t);break;case"max":ce(r,"maximum",o.value,o.message,t);break}return r};function Y$(e,t){return{...K(e.innerType._def,t),default:e.defaultValue()}}function Q$(e,t){return t.effectStrategy==="input"?K(e.schema._def,t):Ne(t)}function eO(e){return{type:"string",enum:Array.from(e.values)}}var $G=(e)=>{if("type"in e&&e.type==="string")return!1;return"allOf"in e};function tO(e,t){let r=[K(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),K(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((i)=>!!i),o=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return r.forEach((i)=>{if($G(i)){if(n.push(...i.allOf),i.unevaluatedProperties===void 0)o=void 0}else{let s=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:a,...c}=i;s=c}else o=void 0;n.push(s)}}),n.length?{allOf:n,...o}:void 0}function rO(e,t){let r=typeof e.value;if(r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string")return{type:Array.isArray(e.value)?"array":"object"};if(t.target==="openApi3")return{type:r==="bigint"?"integer":r,enum:[e.value]};return{type:r==="bigint"?"integer":r,const:e.value}}var sS=void 0,pr={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(sS===void 0)sS=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return sS},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 hm(e,t){let r={type:"string"};if(e.checks)for(let o of e.checks)switch(o.kind){case"min":ce(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,o.value):o.value,o.message,t);break;case"max":ce(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,o.value):o.value,o.message,t);break;case"email":switch(t.emailStrategy){case"format:email":fr(r,"email",o.message,t);break;case"format:idn-email":fr(r,"idn-email",o.message,t);break;case"pattern:zod":gt(r,pr.email,o.message,t);break}break;case"url":fr(r,"uri",o.message,t);break;case"uuid":fr(r,"uuid",o.message,t);break;case"regex":gt(r,o.regex,o.message,t);break;case"cuid":gt(r,pr.cuid,o.message,t);break;case"cuid2":gt(r,pr.cuid2,o.message,t);break;case"startsWith":gt(r,RegExp(`^${aS(o.value,t)}`),o.message,t);break;case"endsWith":gt(r,RegExp(`${aS(o.value,t)}$`),o.message,t);break;case"datetime":fr(r,"date-time",o.message,t);break;case"date":fr(r,"date",o.message,t);break;case"time":fr(r,"time",o.message,t);break;case"duration":fr(r,"duration",o.message,t);break;case"length":ce(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,o.value):o.value,o.message,t),ce(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,o.value):o.value,o.message,t);break;case"includes":{gt(r,RegExp(aS(o.value,t)),o.message,t);break}case"ip":{if(o.version!=="v6")fr(r,"ipv4",o.message,t);if(o.version!=="v4")fr(r,"ipv6",o.message,t);break}case"base64url":gt(r,pr.base64url,o.message,t);break;case"jwt":gt(r,pr.jwt,o.message,t);break;case"cidr":{if(o.version!=="v6")gt(r,pr.ipv4Cidr,o.message,t);if(o.version!=="v4")gt(r,pr.ipv6Cidr,o.message,t);break}case"emoji":gt(r,pr.emoji(),o.message,t);break;case"ulid":{gt(r,pr.ulid,o.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{fr(r,"binary",o.message,t);break}case"contentEncoding:base64":{ce(r,"contentEncoding","base64",o.message,t);break}case"pattern:zod":{gt(r,pr.base64,o.message,t);break}}break}case"nanoid":gt(r,pr.nanoid,o.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:((n)=>{})(o)}return r}function aS(e,t){return t.patternStrategy==="escape"?AG(e):e}var OG=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function AG(e){let t="";for(let r=0;r<e.length;r++){if(!OG.has(e[r]))t+="\\";t+=e[r]}return t}function fr(e,t,r,o){if(e.format||e.anyOf?.some((n)=>n.format)){if(!e.anyOf)e.anyOf=[];if(e.format){if(e.anyOf.push({format:e.format,...e.errorMessage&&o.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,...r&&o.errorMessages&&{errorMessage:{format:r}}})}else ce(e,"format",t,r,o)}function gt(e,t,r,o){if(e.pattern||e.allOf?.some((n)=>n.pattern)){if(!e.allOf)e.allOf=[];if(e.pattern){if(e.allOf.push({pattern:e.pattern,...e.errorMessage&&o.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:nO(t,o),...r&&o.errorMessages&&{errorMessage:{pattern:r}}})}else ce(e,"pattern",nO(t,o),r,o)}function nO(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},o=r.i?e.source.toLowerCase():e.source,n="",i=!1,s=!1,a=!1;for(let c=0;c<o.length;c++){if(i){n+=o[c],i=!1;continue}if(r.i){if(s){if(o[c].match(/[a-z]/)){if(a)n+=o[c],n+=`${o[c-2]}-${o[c]}`.toUpperCase(),a=!1;else if(o[c+1]==="-"&&o[c+2]?.match(/[a-z]/))n+=o[c],a=!0;else n+=`${o[c]}${o[c].toUpperCase()}`;continue}}else if(o[c].match(/[a-z]/)){n+=`[${o[c]}${o[c].toUpperCase()}]`;continue}}if(r.m){if(o[c]==="^"){n+=`(^|(?<=[\r
101
101
  ]))`;continue}else if(o[c]==="$"){n+=`($|(?=[\r
102
102
  ]))`;continue}}if(r.s&&o[c]==="."){n+=s?`${o[c]}\r
103
103
  `:`[${o[c]}\r
104
- ]`;continue}if(n+=o[c],o[c]==="\\")i=!0;else if(s&&o[c]==="]")s=!1;else if(!s&&o[c]==="[")s=!0}try{new RegExp(n)}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 n}function hm(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===R.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((o,n)=>({...o,[n]:K(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",n]})??Ne(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:K(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===R.ZodString&&e.keyType._def.checks?.length){let{type:o,...n}=gm(e.keyType._def,t);return{...r,propertyNames:n}}else if(e.keyType?._def.typeName===R.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===R.ZodBranded&&e.keyType._def.type._def.typeName===R.ZodString&&e.keyType._def.type._def.checks?.length){let{type:o,...n}=mm(e.keyType._def,t);return{...r,propertyNames:n}}return r}function rO(e,t){if(t.mapStrategy==="record")return hm(e,t);let r=K(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Ne(t),o=K(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Ne(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,o],minItems:2,maxItems:2}}}function nO(e){let t=e.values,o=Object.keys(e.values).filter((i)=>{return typeof t[t[i]]!=="number"}).map((i)=>t[i]),n=Array.from(new Set(o.map((i)=>typeof i)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:o}}function oO(e){return e.target==="openAi"?void 0:{not:Ne({...e,currentPath:[...e.currentPath,"not"]})}}function iO(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Tl={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function aO(e,t){if(t.target==="openApi3")return sO(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every((o)=>(o._def.typeName in Tl)&&(!o._def.checks||!o._def.checks.length))){let o=r.reduce((n,i)=>{let s=Tl[i._def.typeName];return s&&!n.includes(s)?[...n,s]:n},[]);return{type:o.length>1?o:o[0]}}else if(r.every((o)=>o._def.typeName==="ZodLiteral"&&!o.description)){let o=r.reduce((n,i)=>{let s=typeof i._def.value;switch(s){case"string":case"number":case"boolean":return[...n,s];case"bigint":return[...n,"integer"];case"object":if(i._def.value===null)return[...n,"null"];case"symbol":case"undefined":case"function":default:return n}},[]);if(o.length===r.length){let n=o.filter((i,s,a)=>a.indexOf(i)===s);return{type:n.length>1?n:n[0],enum:r.reduce((i,s)=>{return i.includes(s._def.value)?i:[...i,s._def.value]},[])}}}else if(r.every((o)=>o._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((o,n)=>[...o,...n._def.values.filter((i)=>!o.includes(i))],[])};return sO(e,t)}var sO=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((o,n)=>K(o._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter((o)=>!!o&&(!t.strictUnions||typeof o==="object"&&Object.keys(o).length>0));return r.length?{anyOf:r}:void 0};function cO(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:Tl[e.innerType._def.typeName],nullable:!0};return{type:[Tl[e.innerType._def.typeName],"null"]}}if(t.target==="openApi3"){let o=K(e.innerType._def,{...t,currentPath:[...t.currentPath]});if(o&&"$ref"in o)return{allOf:[o],nullable:!0};return o&&{...o,nullable:!0}}let r=K(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function lO(e,t){let r={type:"number"};if(!e.checks)return r;for(let o of e.checks)switch(o.kind){case"int":r.type="integer",nS(r,"type",o.message,t);break;case"min":if(t.target==="jsonSchema7")if(o.inclusive)ce(r,"minimum",o.value,o.message,t);else ce(r,"exclusiveMinimum",o.value,o.message,t);else{if(!o.inclusive)r.exclusiveMinimum=!0;ce(r,"minimum",o.value,o.message,t)}break;case"max":if(t.target==="jsonSchema7")if(o.inclusive)ce(r,"maximum",o.value,o.message,t);else ce(r,"exclusiveMaximum",o.value,o.message,t);else{if(!o.inclusive)r.exclusiveMaximum=!0;ce(r,"maximum",o.value,o.message,t)}break;case"multipleOf":ce(r,"multipleOf",o.value,o.message,t);break}return r}function uO(e,t){let r=t.target==="openAi",o={type:"object",properties:{}},n=[],i=e.shape();for(let a in i){let c=i[a];if(c===void 0||c._def===void 0)continue;let u=PG(c);if(u&&r){if(c._def.typeName==="ZodOptional")c=c._def.innerType;if(!c.isNullable())c=c.nullable();u=!1}let d=K(c._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});if(d===void 0)continue;if(o.properties[a]=d,!u)n.push(a)}if(n.length)o.required=n;let s=EG(e,t);if(s!==void 0)o.additionalProperties=s;return o}function EG(e,t){if(e.catchall._def.typeName!=="ZodNever")return K(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 PG(e){try{return e.isOptional()}catch{return!0}}var dO=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return K(e.innerType._def,t);let r=K(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Ne(t)},r]}:Ne(t)};var pO=(e,t)=>{if(t.pipeStrategy==="input")return K(e.in._def,t);else if(t.pipeStrategy==="output")return K(e.out._def,t);let r=K(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),o=K(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,o].filter((n)=>n!==void 0)}};function fO(e,t){return K(e.type._def,t)}function mO(e,t){let o={type:"array",uniqueItems:!0,items:K(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};if(e.minSize)ce(o,"minItems",e.minSize.value,e.minSize.message,t);if(e.maxSize)ce(o,"maxItems",e.maxSize.value,e.maxSize.message,t);return o}function gO(e,t){if(e.rest)return{type:"array",minItems:e.items.length,items:e.items.map((r,o)=>K(r._def,{...t,currentPath:[...t.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[]),additionalItems:K(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})};else return{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,o)=>K(r._def,{...t,currentPath:[...t.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[])}}function hO(e){return{not:Ne(e)}}function yO(e){return Ne(e)}var bO=(e,t)=>{return K(e.innerType._def,t)};var _O=(e,t,r)=>{switch(t){case R.ZodString:return gm(e,r);case R.ZodNumber:return lO(e,r);case R.ZodObject:return uO(e,r);case R.ZodBigInt:return W$(e,r);case R.ZodBoolean:return K$();case R.ZodDate:return oS(e,r);case R.ZodUndefined:return hO(r);case R.ZodNull:return iO(r);case R.ZodArray:return V$(e,r);case R.ZodUnion:case R.ZodDiscriminatedUnion:return aO(e,r);case R.ZodIntersection:return Q$(e,r);case R.ZodTuple:return gO(e,r);case R.ZodRecord:return hm(e,r);case R.ZodLiteral:return eO(e,r);case R.ZodEnum:return Y$(e);case R.ZodNativeEnum:return nO(e);case R.ZodNullable:return cO(e,r);case R.ZodOptional:return dO(e,r);case R.ZodMap:return rO(e,r);case R.ZodSet:return mO(e,r);case R.ZodLazy:return()=>e.getter()._def;case R.ZodPromise:return fO(e,r);case R.ZodNaN:case R.ZodNever:return oO(r);case R.ZodEffects:return X$(e,r);case R.ZodAny:return Ne(r);case R.ZodUnknown:return yO(r);case R.ZodDefault:return J$(e,r);case R.ZodBranded:return mm(e,r);case R.ZodReadonly:return bO(e,r);case R.ZodCatch:return G$(e,r);case R.ZodPipeline:return pO(e,r);case R.ZodFunction:case R.ZodVoid:case R.ZodSymbol:return;default:return((o)=>{return})(t)}};function K(e,t,r=!1){let o=t.seen.get(e);if(t.override){let a=t.override?.(e,t,o,r);if(a!==B$)return a}if(o&&!r){let a=IG(o,t);if(a!==void 0)return a}let n={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,n);let i=_O(e,e.typeName,t),s=typeof i==="function"?K(i(),t):i;if(s)RG(e,t,s);if(t.postProcess){let a=t.postProcess(s,e,t);return n.jsonSchema=s,a}return n.jsonSchema=s,s}var IG=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:fm(t.currentPath,e.path)};case"none":case"seen":{if(e.path.length<t.currentPath.length&&e.path.every((r,o)=>t.currentPath[o]===r))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Ne(t);return t.$refStrategy==="seen"?Ne(t):void 0}}},RG=(e,t,r)=>{if(e.description){if(r.description=e.description,t.markdownDescription)r.markdownDescription=e.description}return r};var aS=(e,t)=>{let r=Z$(t),o=typeof t==="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[u,d])=>({...c,[u]:K(d._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??Ne(r)}),{}):void 0,n=typeof t==="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=K(e._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??Ne(r),s=typeof t==="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;if(s!==void 0)i.title=s;if(r.flags.hasReferencedOpenAiAnyType){if(!o)o={};if(!o[r.openAiAnyTypeName])o[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}}let a=n===void 0?o?{...i,[r.definitionPath]:o}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...o,[n]:i}};if(r.target==="jsonSchema7")a.$schema="http://json-schema.org/draft-07/schema#";else if(r.target==="jsonSchema2019-09"||r.target==="openAi")a.$schema="https://json-schema.org/draft/2019-09/schema#";if(r.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 $G(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 cS(e,t){if(Xt(e))return rs(e,{target:$G(t?.target),io:t?.pipeStrategy??"input"});return aS(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function lS(e){let r=Mn(e)?.method;if(!r)throw Error("Schema is missing a method literal");let o=Of(r);if(typeof o!=="string")throw Error("Schema method literal must be a string");return o}function uS(e,t){let r=Cn(e,t);if(!r.success)throw r.error;return r.data}var OG=60000;class dS{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(Jf,(t)=>{this._oncancel(t)}),this.setNotificationHandler(Yf,(t)=>{this._onprogress(t)}),this.setRequestHandler(Xf,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(Qf,async(t,r)=>{let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new B(Z.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(tm,async(t,r)=>{let o=async()=>{let n=t.params.taskId;if(this._taskMessageQueue){let s;while(s=await this._taskMessageQueue.dequeue(n,r.sessionId)){if(s.type==="response"||s.type==="error"){let a=s.message,c=a.id,u=this._requestResolvers.get(c);if(u)if(this._requestResolvers.delete(c),s.type==="response")u(a);else{let d=a,p=new B(d.error.code,d.error.message,d.error.data);u(p)}else{let d=s.type==="response"?"Response":"Error";this._onerror(Error(`${d} handler missing for request ${c}`))}continue}await this._transport?.send(s.message,{relatedRequestId:r.requestId})}}let i=await this._taskStore.getTask(n,r.sessionId);if(!i)throw new B(Z.InvalidParams,`Task not found: ${n}`);if(!Dn(i.status))return await this._waitForTaskUpdate(n,r.signal),await o();if(Dn(i.status)){let s=await this._taskStore.getTaskResult(n,r.sessionId);return this._clearTaskQueue(n),{...s,_meta:{...s._meta,[Nn]:{taskId:n}}}}return await o()};return await o()}),this.setRequestHandler(rm,async(t,r)=>{try{let{tasks:o,nextCursor:n}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:o,nextCursor:n,_meta:{}}}catch(o){throw new B(Z.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(om,async(t,r)=>{try{let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new B(Z.InvalidParams,`Task not found: ${t.params.taskId}`);if(Dn(o.status))throw new B(Z.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId);let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new B(Z.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...n}}catch(o){if(o instanceof B)throw o;throw new B(Z.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),B.fromError(Z.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});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 r=this.transport?.onerror;this._transport.onerror=(n)=>{r?.(n),this._onerror(n)};let o=this._transport?.onmessage;this._transport.onmessage=(n,i)=>{if(o?.(n,i),hl(n)||O$(n))this._onresponse(n);else if(Bv(n))this._onrequest(n,i);else if($$(n))this._onnotification(n);else this._onerror(Error(`Unknown message type: ${JSON.stringify(n)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let t=B.fromError(Z.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(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((r)=>this._onerror(Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,n=e.params?._meta?.[Nn]?.taskId;if(r===void 0){let u={jsonrpc:"2.0",id:e.id,error:{code:Z.MethodNotFound,message:"Method not found"}};if(n&&this._taskMessageQueue)this._enqueueTaskMessage(n,{type:"error",message:u,timestamp:Date.now()},o?.sessionId).catch((d)=>this._onerror(Error(`Failed to enqueue error response: ${d}`)));else o?.send(u).catch((d)=>this._onerror(Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let s=P$(e.params)?e.params.task:void 0,a=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,c={signal:i.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async(u)=>{if(i.signal.aborted)return;let d={relatedRequestId:e.id};if(n)d.relatedTask={taskId:n};await this.notification(u,d)},sendRequest:async(u,d,p)=>{if(i.signal.aborted)throw new B(Z.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:e.id};if(n&&!f.relatedTask)f.relatedTask={taskId:n};let m=f.relatedTask?.taskId??n;if(m&&a)await a.updateTaskStatus(m,"input_required");return await this.request(u,d,f)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:n,taskStore:a,taskRequestedTtl:s?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(s)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,c)).then(async(u)=>{if(i.signal.aborted)return;let d={result:u,jsonrpc:"2.0",id:e.id};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"response",message:d,timestamp:Date.now()},o?.sessionId);else await o?.send(d)},async(u)=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:Z.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"error",message:d,timestamp:Date.now()},o?.sessionId);else await o?.send(d)}).catch((u)=>this._onerror(Error(`Failed to send response: ${u}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===i)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),n=this._progressHandlers.get(o);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&i&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(a){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(a);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),hl(e))r(e);else{let i=new B(e.error.code,e.error.message,e.error.data);r(i)}return}let o=this._responseHandlers.get(t);if(o===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 n=!1;if(hl(e)&&e.result&&typeof e.result==="object"){let i=e.result;if(i.task&&typeof i.task==="object"){let s=i.task;if(typeof s.taskId==="string")n=!0,this._taskProgressTokens.set(s.taskId,t)}}if(!n)this._progressHandlers.delete(t);if(hl(e))o(e);else{let i=B.fromError(e.error.code,e.error.message,e.error.data);o(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){let{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(e,t,r)}}catch(i){yield{type:"error",error:i instanceof B?i:new B(Z.InternalError,String(i))}}return}let n;try{let i=await this.request(e,cs,r);if(i.task)n=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new B(Z.InternalError,"Task creation did not return a task");while(!0){let s=await this.getTask({taskId:n},r);if(yield{type:"taskStatus",task:s},Dn(s.status)){if(s.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};else if(s.status==="failed")yield{type:"error",error:new B(Z.InternalError,`Task ${n} failed`)};else if(s.status==="cancelled")yield{type:"error",error:new B(Z.InternalError,`Task ${n} was cancelled`)};return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};return}let a=s.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((c)=>setTimeout(c,a)),r?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof B?i:new B(Z.InternalError,String(i))}}}request(e,t,r){let{relatedRequestId:o,resumptionToken:n,onresumptiontoken:i,task:s,relatedTask:a}=r??{};return new Promise((c,u)=>{let d=(v)=>{u(v)};if(!this._transport){d(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),s)this.assertTaskCapability(e.method)}catch(v){d(v);return}r?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};if(r?.onprogress)this._progressHandlers.set(p,r.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}};if(s)f.params={...f.params,task:s};if(a)f.params={...f.params,_meta:{...f.params?._meta||{},[Nn]:a}};let m=(v)=>{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(v)}},{relatedRequestId:o,resumptionToken:n,onresumptiontoken:i}).catch((w)=>this._onerror(Error(`Failed to send cancellation: ${w}`)));let x=v instanceof B?v:new B(Z.RequestTimeout,String(v));u(x)};this._responseHandlers.set(p,(v)=>{if(r?.signal?.aborted)return;if(v instanceof Error)return u(v);try{let x=Cn(t,v.result);if(!x.success)u(x.error);else c(x.data)}catch(x){u(x)}}),r?.signal?.addEventListener("abort",()=>{m(r?.signal?.reason)});let g=r?.timeout??OG,h=()=>m(B.fromError(Z.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(p,g,r?.maxTotalTimeout,h,r?.resetTimeoutOnProgress??!1);let y=a?.taskId;if(y){let v=(x)=>{let w=this._responseHandlers.get(p);if(w)w(x);else this._onerror(Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,v),this._enqueueTaskMessage(y,{type:"request",message:f,timestamp:Date.now()}).catch((x)=>{this._cleanupTimeout(p),u(x)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:n,onresumptiontoken:i}).catch((v)=>{this._cleanupTimeout(p),u(v)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},em,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},nm,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},C$,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Nn]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:s,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 s={...e,jsonrpc:"2.0"};if(t?.relatedTask)s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Nn]:t.relatedTask}}};this._transport?.send(s,t).catch((a)=>this._onerror(a))});return}let i={...e,jsonrpc:"2.0"};if(t?.relatedTask)i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Nn]:t.relatedTask}}};await this._transport.send(i,t)}setRequestHandler(e,t){let r=lS(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,n)=>{let i=uS(e,o);return Promise.resolve(t(i,n))})}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 r=lS(e);this._notificationHandlers.set(r,(o)=>{let n=uS(e,o);return Promise.resolve(t(n))})}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,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,o)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,t);for(let o of r)if(o.type==="request"&&Bv(o.message)){let n=o.message.id,i=this._requestResolvers.get(n);if(i)i(new B(Z.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(n);else this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1000;try{let o=await this._taskStore?.getTask(e);if(o?.pollInterval)r=o.pollInterval}catch{}return new Promise((o,n)=>{if(t.aborted){n(new B(Z.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,r);t.addEventListener("abort",()=>{clearTimeout(i),n(new B(Z.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async(o)=>{if(!e)throw Error("No request provided");return await r.createTask(o,e.id,{method:e.method,params:e.params},t)},getTask:async(o)=>{let n=await r.getTask(o,t);if(!n)throw new B(Z.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(o,n,i)=>{await r.storeTaskResult(o,n,i,t);let s=await r.getTask(o,t);if(s){let a=Sl.parse({method:"notifications/tasks/status",params:s});if(await this.notification(a),Dn(s.status))this._cleanupTaskProgressHandler(o)}},getTaskResult:(o)=>{return r.getTaskResult(o,t)},updateTaskStatus:async(o,n,i)=>{let s=await r.getTask(o,t);if(!s)throw new B(Z.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Dn(s.status))throw new B(Z.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,n,i,t);let a=await r.getTask(o,t);if(a){let c=Sl.parse({method:"notifications/tasks/status",params:a});if(await this.notification(c),Dn(a.status))this._cleanupTaskProgressHandler(o)}},listTasks:(o)=>{return r.listTasks(o,t)}}}}function vO(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function SO(e,t){let r={...e};for(let o in t){let n=o,i=t[n];if(i===void 0)continue;let s=r[n];if(vO(s)&&vO(i))r[n]={...s,...i};else r[n]=i}return r}var nD=xg(sx(),1),oD=xg(rD(),1);function Q7(){let e=new nD.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return oD.default(e),e}class hx{constructor(e){this._ajv=e??Q7()}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(r)=>{if(t(r))return{valid:!0,data:r,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class yx{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}createMessageStream(e,t){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],i=n.some((u)=>u.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=s?Array.isArray(s.content)?s.content:[s.content]:[],c=a.some((u)=>u.type==="tool_use");if(i){if(n.some((u)=>u.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 u=new Set(a.filter((p)=>p.type==="tool_use").map((p)=>p.id)),d=new Set(n.filter((p)=>p.type==="tool_result").map((p)=>p.toolUseId));if(u.size!==d.size||![...u].every((p)=>d.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},kl,t)}elicitInputStream(e,t){let r=this._server.getClientCapabilities(),o=e.mode??"form";switch(o){case"url":{if(!r?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let n=o==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:n},ds,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}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 iD(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function sD(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}class bx extends dS{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(wl.options.map((r,o)=>[r,o])),this.isMessageIgnored=(r,o)=>{let n=this._loggingLevels.get(o);return n?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new hx,this.setRequestHandler(Vv,(r)=>this._oninitialize(r)),this.setNotificationHandler(Wv,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(eS,async(r,o)=>{let n=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=r.params,s=wl.safeParse(i);if(s.success)this._loggingLevels.set(n,s.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new yx(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=SO(this._capabilities,e)}setRequestHandler(e,t){let o=Mn(e)?.method;if(!o)throw Error("Schema is missing a method literal");let n;if(Xt(o)){let s=o;n=s._zod?.def?.value??s.value}else{let s=o;n=s._def?.value??s.value}if(typeof n!=="string")throw Error("Schema method literal must be a string");if(n==="tools/call"){let s=async(a,c)=>{let u=Cn(us,a);if(!u.success){let m=u.error instanceof Error?u.error.message:String(u.error);throw new B(Z.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=u.data,p=await Promise.resolve(t(a,c));if(d.task){let m=Cn(cs,p);if(!m.success){let g=m.error instanceof Error?m.error.message:String(m.error);throw new B(Z.InvalidParams,`Invalid task creation result: ${g}`)}return m.data}let f=Cn(dm,p);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new B(Z.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(e,s)}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){sD(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;iD(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:k$.includes(t)?t:Fv,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"},Gf)}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 r=e.messages[e.messages.length-1],o=Array.isArray(r.content)?r.content:[r.content],n=o.some((c)=>c.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=i?Array.isArray(i.content)?i.content:[i.content]:[],a=s.some((c)=>c.type==="tool_use");if(n){if(o.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(s.filter((d)=>d.type==="tool_use").map((d)=>d.id)),u=new Set(o.filter((d)=>d.type==="tool_result").map((d)=>d.toolUseId));if(c.size!==u.size||![...c].every((d)=>u.has(d)))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},tS,t);return this.request({method:"sampling/createMessage",params:e},kl,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 o=e;return this.request({method:"elicitation/create",params:o},ds,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let o=e.mode==="form"?e:{...e,mode:"form"},n=await this.request({method:"elicitation/create",params:o},ds,t);if(n.action==="accept"&&n.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(n.content);if(!s.valid)throw new B(Z.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(i){if(i instanceof B)throw i;throw new B(Z.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return n}}}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},rS,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 cD=Symbol.for("mcp.completable");function _x(e){return!!e&&typeof e==="object"&&cD in e}function lD(e){return e[cD]?.complete}var aD;(function(e){e.Completable="McpCompletable"})(aD||(aD={}));var eQ=/^[A-Za-z0-9._-]{1,128}$/;function tQ(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(!eQ.test(e)){let r=e.split("").filter((o)=>!/[A-Za-z0-9._-]/.test(o)).filter((o,n,i)=>i.indexOf(o)===n);return t.push(`Tool name contains invalid characters: ${r.map((o)=>`"${o}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function rQ(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);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 vx(e){let t=tQ(e);return rQ(e,t.warnings),t.isValid}class Sx{constructor(e){this._mcpServer=e}registerToolTask(e,t,r){let o={taskSupport:"required",...t.execution};if(o.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,o,t._meta,r)}}class wx{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 bx(e,t)}get experimental(){if(!this._experimental)this._experimental={tasks:new Sx(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(qn(um)),this.server.assertCanSetRequestHandler(qn(us)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(um,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:(()=>{let o=ns(t.inputSchema);return o?cS(o,{strictUnions:!0,pipeStrategy:"input"}):nQ})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let o=ns(t.outputSchema);if(o)r.outputSchema=cS(o,{strictUnions:!0,pipeStrategy:"output"})}return r})})),this.server.setRequestHandler(us,async(e,t)=>{try{let r=this._registeredTools[e.params.name];if(!r)throw new B(Z.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new B(Z.InvalidParams,`Tool ${e.params.name} disabled`);let o=!!e.params.task,n=r.execution?.taskSupport,i="createTask"in r.handler;if((n==="required"||n==="optional")&&!i)throw new B(Z.InternalError,`Tool ${e.params.name} has taskSupport '${n}' but was not registered with registerToolTask`);if(n==="required"&&!o)throw new B(Z.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(n==="optional"&&!o&&i)return await this.handleAutomaticTaskPolling(r,e,t);let s=await this.validateToolInput(r,e.params.arguments,e.params.name),a=await this.executeToolHandler(r,s,t);if(o)return a;return await this.validateToolOutput(r,a,e.params.name),a}catch(r){if(r instanceof B){if(r.code===Z.UrlElicitationRequired)throw r}return this.createToolError(r instanceof Error?r.message:String(r))}}),this._toolHandlersInitialized=!0}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let n=ns(e.inputSchema)??e.inputSchema,i=await Rf(n,t);if(!i.success){let s="error"in i?i.error:"Unknown error",a=$f(s);throw new B(Z.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${a}`)}return i.data}async validateToolOutput(e,t,r){if(!e.outputSchema)return;if(!("content"in t))return;if(t.isError)return;if(!t.structuredContent)throw new B(Z.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let o=ns(e.outputSchema),n=await Rf(o,t.structuredContent);if(!n.success){let i="error"in n?n.error:"Unknown error",s=$f(i);throw new B(Z.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${s}`)}}async executeToolHandler(e,t,r){let o=e.handler;if("createTask"in o){if(!r.taskStore)throw Error("No task store provided.");let i={...r,taskStore:r.taskStore};if(e.inputSchema)return await Promise.resolve(o.createTask(t,i));else return await Promise.resolve(o.createTask(i))}if(e.inputSchema)return await Promise.resolve(o(t,r));else return await Promise.resolve(o(r))}async handleAutomaticTaskPolling(e,t,r){if(!r.taskStore)throw Error("No task store provided for task-capable tool.");let o=await this.validateToolInput(e,t.params.arguments,t.params.name),n=e.handler,i={...r,taskStore:r.taskStore},s=o?await Promise.resolve(n.createTask(o,i)):await Promise.resolve(n.createTask(i)),a=s.task.taskId,c=s.task,u=c.pollInterval??5000;while(c.status!=="completed"&&c.status!=="failed"&&c.status!=="cancelled"){await new Promise((p)=>setTimeout(p,u));let d=await r.taskStore.getTask(a);if(!d)throw new B(Z.InternalError,`Task ${a} not found during polling`);c=d}return await r.taskStore.getTaskResult(a)}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(qn(pm)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(pm,async(e)=>{switch(e.params.ref.type){case"ref/prompt":return U$(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return L$(e),this.handleResourceCompletion(e,e.params.ref);default:throw new B(Z.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new B(Z.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new B(Z.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return Gl;let n=Mn(r.argsSchema)?.[e.params.argument.name];if(!_x(n))return Gl;let i=lD(n);if(!i)return Gl;let s=await i(e.params.argument.value,e.params.context);return dD(s)}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find((i)=>i.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return Gl;throw new B(Z.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let o=r.resourceTemplate.completeCallback(e.params.argument.name);if(!o)return Gl;let n=await o(e.params.argument.value,e.params.context);return dD(n)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(qn(im)),this.server.assertCanSetRequestHandler(qn(sm)),this.server.assertCanSetRequestHandler(qn(am)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(im,async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([n,i])=>i.enabled).map(([n,i])=>({uri:n,name:i.name,...i.metadata})),o=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let i=await n.resourceTemplate.listCallback(t);for(let s of i.resources)o.push({...n.metadata,...s})}return{resources:[...r,...o]}}),this.server.setRequestHandler(sm,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,r])=>({name:t,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))}}),this.server.setRequestHandler(am,async(e,t)=>{let r=new URL(e.params.uri),o=this._registeredResources[r.toString()];if(o){if(!o.enabled)throw new B(Z.InvalidParams,`Resource ${r} disabled`);return o.readCallback(r,t)}for(let n of Object.values(this._registeredResourceTemplates)){let i=n.resourceTemplate.uriTemplate.match(r.toString());if(i)return n.readCallback(r,i,t)}throw new B(Z.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(qn(cm)),this.server.assertCanSetRequestHandler(qn(lm)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(cm,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>{return{name:e,title:t.title,description:t.description,arguments:t.argsSchema?oQ(t.argsSchema):void 0}})})),this.server.setRequestHandler(lm,async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new B(Z.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new B(Z.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let o=ns(r.argsSchema),n=await Rf(o,e.params.arguments);if(!n.success){let a="error"in n?n.error:"Unknown error",c=$f(a);throw new B(Z.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${c}`)}let i=n.data,s=r.callback;return await Promise.resolve(s(i,t))}else{let o=r.callback;return await Promise.resolve(o(t))}}),this._promptHandlersInitialized=!0}resource(e,t,...r){let o;if(typeof r[0]==="object")o=r.shift();let n=r[0];if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let i=this._createRegisteredResource(e,void 0,t,o,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,void 0,t,o,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,t,r,o){if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let n=this._createRegisteredResource(e,r.title,t,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let n=this._createRegisteredResourceTemplate(e,r.title,t,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(e,t,r,o,n){let i={name:e,title:t,metadata:o,readCallback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:(s)=>{if(typeof s.uri<"u"&&s.uri!==r){if(delete this._registeredResources[r],s.uri)this._registeredResources[s.uri]=i}if(typeof s.name<"u")i.name=s.name;if(typeof s.title<"u")i.title=s.title;if(typeof s.metadata<"u")i.metadata=s.metadata;if(typeof s.callback<"u")i.readCallback=s.callback;if(typeof s.enabled<"u")i.enabled=s.enabled;this.sendResourceListChanged()}};return this._registeredResources[r]=i,i}_createRegisteredResourceTemplate(e,t,r,o,n){let i={resourceTemplate:r,title:t,metadata:o,readCallback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:(c)=>{if(typeof c.name<"u"&&c.name!==e){if(delete this._registeredResourceTemplates[e],c.name)this._registeredResourceTemplates[c.name]=i}if(typeof c.title<"u")i.title=c.title;if(typeof c.template<"u")i.resourceTemplate=c.template;if(typeof c.metadata<"u")i.metadata=c.metadata;if(typeof c.callback<"u")i.readCallback=c.callback;if(typeof c.enabled<"u")i.enabled=c.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=i;let s=r.uriTemplate.variableNames;if(Array.isArray(s)&&s.some((c)=>!!r.completeCallback(c)))this.setCompletionRequestHandler();return i}_createRegisteredPrompt(e,t,r,o,n){let i={title:t,description:r,argsSchema:o===void 0?void 0:Mo(o),callback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:(s)=>{if(typeof s.name<"u"&&s.name!==e){if(delete this._registeredPrompts[e],s.name)this._registeredPrompts[s.name]=i}if(typeof s.title<"u")i.title=s.title;if(typeof s.description<"u")i.description=s.description;if(typeof s.argsSchema<"u")i.argsSchema=Mo(s.argsSchema);if(typeof s.callback<"u")i.callback=s.callback;if(typeof s.enabled<"u")i.enabled=s.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=i,o){if(Object.values(o).some((a)=>{let c=a instanceof Gt?a._def?.innerType:a;return _x(c)}))this.setCompletionRequestHandler()}return i}_createRegisteredTool(e,t,r,o,n,i,s,a,c){vx(e);let u={title:t,description:r,inputSchema:uD(o),outputSchema:uD(n),annotations:i,execution:s,_meta:a,handler:c,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:(d)=>{if(typeof d.name<"u"&&d.name!==e){if(typeof d.name==="string")vx(d.name);if(delete this._registeredTools[e],d.name)this._registeredTools[d.name]=u}if(typeof d.title<"u")u.title=d.title;if(typeof d.description<"u")u.description=d.description;if(typeof d.paramsSchema<"u")u.inputSchema=Mo(d.paramsSchema);if(typeof d.outputSchema<"u")u.outputSchema=Mo(d.outputSchema);if(typeof d.callback<"u")u.handler=d.callback;if(typeof d.annotations<"u")u.annotations=d.annotations;if(typeof d._meta<"u")u._meta=d._meta;if(typeof d.enabled<"u")u.enabled=d.enabled;this.sendToolListChanged()}};return this._registeredTools[e]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(e,...t){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r,o,n,i;if(typeof t[0]==="string")r=t.shift();if(t.length>1){let a=t[0];if(xx(a)){if(o=t.shift(),t.length>1&&typeof t[0]==="object"&&t[0]!==null&&!xx(t[0]))i=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`);i=t.shift()}}let s=t[0];return this._createRegisteredTool(e,void 0,r,o,n,i,{taskSupport:"forbidden"},void 0,s)}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:o,description:n,inputSchema:i,outputSchema:s,annotations:a,_meta:c}=t;return this._createRegisteredTool(e,o,n,i,s,a,{taskSupport:"forbidden"},c,r)}prompt(e,...t){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let r;if(typeof t[0]==="string")r=t.shift();let o;if(t.length>1)o=t.shift();let n=t[0],i=this._createRegisteredPrompt(e,void 0,r,o,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:o,description:n,argsSchema:i}=t,s=this._createRegisteredPrompt(e,o,n,i,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}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 nQ={type:"object",properties:{}};function pD(e){return e!==null&&typeof e==="object"&&"parse"in e&&typeof e.parse==="function"&&"safeParse"in e&&typeof e.safeParse==="function"}function fD(e){return"_def"in e||"_zod"in e||pD(e)}function xx(e){if(typeof e!=="object"||e===null)return!1;if(fD(e))return!1;if(Object.keys(e).length===0)return!0;return Object.values(e).some(pD)}function uD(e){if(!e)return;if(xx(e))return Mo(e);if(!fD(e))throw Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}function oQ(e){let t=Mn(e);if(!t)return[];return Object.entries(t).map(([r,o])=>{let n=zR(o),i=UR(o);return{name:r,description:n,required:!i}})}function qn(e){let r=Mn(e)?.method;if(!r)throw Error("Schema is missing a method literal");let o=Of(r);if(typeof o==="string")return o;throw Error("Schema method literal must be a string")}function dD(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var Gl={completion:{values:[],hasMore:!1}};function iQ(e,t,r,o,n){let i={};if(n?.searchHint)i["anthropic/searchHint"]=n.searchHint;if(n?.alwaysLoad)i["anthropic/alwaysLoad"]=!0;return{name:e,description:t,inputSchema:r,handler:o,annotations:n?.annotations,_meta:Object.keys(i).length>0?i:void 0}}function sQ(e){let t=new wx({name:e.name,version:e.version??"1.0.0"},{capabilities:{tools:e.tools?{}:void 0},instructions:e.instructions});if(e.tools)e.tools.forEach((r)=>{for(let o of Object.values(r.inputSchema)){if(!aQ(o))continue;let n=o.description;if(n&&!Tt.has(o))Tt.add(o,{description:n})}t.registerTool(r.name,{description:r.description,inputSchema:r.inputSchema,annotations:r.annotations,_meta:e.alwaysLoad?{"anthropic/alwaysLoad":!0,...r._meta}:r._meta},r.handler)});return{type:"sdk",name:e.name,instance:t}}function aQ(e){return typeof e==="object"&&e!==null&&"_zod"in e}function I(e){let t;return()=>t??=e()}var mD=15000,cQ=I(()=>l.object({session_id:l.string(),ws_url:l.string(),work_dir:l.string().optional(),session_key:l.string().optional()}));class vr extends Error{code;constructor(e,t){super(e);this.name="DirectConnectError",this.code=t}}class hD{options;ws;sessionId;workDir;abortController;readyState=!1;closed=!1;exitError;messages=new Ha;readyPromise;readyResolve;readyReject;abortHandler;partialChunks=[];telemetryEmitted=!1;constructor(e){this.options=e;this.abortController=e.abortController??new AbortController,this.readyPromise=new Promise((t,r)=>{this.readyResolve=t,this.readyReject=r}),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 it("Connection aborted"));return}this.abortHandler=()=>{this.close(),this.exitError=new it("Connection aborted by user")},this.abortController.signal.addEventListener("abort",this.abortHandler);let e;try{let n=await uQ(this.options);this.sessionId=n.sessionId,this.workDir=n.workDir,e=n.wsUrl}catch(n){let i=kr(n);if(!(i instanceof it)){let s=i instanceof vr&&i.code?i.code:"session_create_failed";this.emitTelemetry("bad",s)}this.failInit(i);return}if(this.closed){if(this.options.deleteSessionOnClose&&this.sessionId)gD(this.options.serverUrl,this.sessionId,this.options.authToken);return}let t={};if(this.options.authToken)t.authorization=`Bearer ${this.options.authToken}`;let r=new WebSocket(e,{headers:t});this.ws=r;let o=setTimeout((n,i)=>{if(!n.readyState){i.close();let s=new vr(`WebSocket connection timeout after ${mD}ms`);n.exitError=s,n.readyReject?.(s),n.emitTelemetry("bad","connect_timeout")}},mD,this,r);r.addEventListener("open",()=>{clearTimeout(o),this.readyState=!0,St(`[DirectConnectTransport] Connected to ${this.options.serverUrl}, session=${this.sessionId}`),this.readyResolve?.(),this.emitTelemetry("ok")}),r.addEventListener("message",(n)=>{let i=typeof n.data==="string"?n.data:"";if(i.indexOf(`
104
+ ]`;continue}if(n+=o[c],o[c]==="\\")i=!0;else if(s&&o[c]==="]")s=!1;else if(!s&&o[c]==="[")s=!0}try{new RegExp(n)}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 n}function ym(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===R.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((o,n)=>({...o,[n]:K(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",n]})??Ne(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:K(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===R.ZodString&&e.keyType._def.checks?.length){let{type:o,...n}=hm(e.keyType._def,t);return{...r,propertyNames:n}}else if(e.keyType?._def.typeName===R.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===R.ZodBranded&&e.keyType._def.type._def.typeName===R.ZodString&&e.keyType._def.type._def.checks?.length){let{type:o,...n}=gm(e.keyType._def,t);return{...r,propertyNames:n}}return r}function oO(e,t){if(t.mapStrategy==="record")return ym(e,t);let r=K(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Ne(t),o=K(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Ne(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,o],minItems:2,maxItems:2}}}function iO(e){let t=e.values,o=Object.keys(e.values).filter((i)=>{return typeof t[t[i]]!=="number"}).map((i)=>t[i]),n=Array.from(new Set(o.map((i)=>typeof i)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:o}}function sO(e){return e.target==="openAi"?void 0:{not:Ne({...e,currentPath:[...e.currentPath,"not"]})}}function aO(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var El={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function lO(e,t){if(t.target==="openApi3")return cO(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every((o)=>(o._def.typeName in El)&&(!o._def.checks||!o._def.checks.length))){let o=r.reduce((n,i)=>{let s=El[i._def.typeName];return s&&!n.includes(s)?[...n,s]:n},[]);return{type:o.length>1?o:o[0]}}else if(r.every((o)=>o._def.typeName==="ZodLiteral"&&!o.description)){let o=r.reduce((n,i)=>{let s=typeof i._def.value;switch(s){case"string":case"number":case"boolean":return[...n,s];case"bigint":return[...n,"integer"];case"object":if(i._def.value===null)return[...n,"null"];case"symbol":case"undefined":case"function":default:return n}},[]);if(o.length===r.length){let n=o.filter((i,s,a)=>a.indexOf(i)===s);return{type:n.length>1?n:n[0],enum:r.reduce((i,s)=>{return i.includes(s._def.value)?i:[...i,s._def.value]},[])}}}else if(r.every((o)=>o._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((o,n)=>[...o,...n._def.values.filter((i)=>!o.includes(i))],[])};return cO(e,t)}var cO=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((o,n)=>K(o._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter((o)=>!!o&&(!t.strictUnions||typeof o==="object"&&Object.keys(o).length>0));return r.length?{anyOf:r}:void 0};function uO(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:El[e.innerType._def.typeName],nullable:!0};return{type:[El[e.innerType._def.typeName],"null"]}}if(t.target==="openApi3"){let o=K(e.innerType._def,{...t,currentPath:[...t.currentPath]});if(o&&"$ref"in o)return{allOf:[o],nullable:!0};return o&&{...o,nullable:!0}}let r=K(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function dO(e,t){let r={type:"number"};if(!e.checks)return r;for(let o of e.checks)switch(o.kind){case"int":r.type="integer",oS(r,"type",o.message,t);break;case"min":if(t.target==="jsonSchema7")if(o.inclusive)ce(r,"minimum",o.value,o.message,t);else ce(r,"exclusiveMinimum",o.value,o.message,t);else{if(!o.inclusive)r.exclusiveMinimum=!0;ce(r,"minimum",o.value,o.message,t)}break;case"max":if(t.target==="jsonSchema7")if(o.inclusive)ce(r,"maximum",o.value,o.message,t);else ce(r,"exclusiveMaximum",o.value,o.message,t);else{if(!o.inclusive)r.exclusiveMaximum=!0;ce(r,"maximum",o.value,o.message,t)}break;case"multipleOf":ce(r,"multipleOf",o.value,o.message,t);break}return r}function pO(e,t){let r=t.target==="openAi",o={type:"object",properties:{}},n=[],i=e.shape();for(let a in i){let c=i[a];if(c===void 0||c._def===void 0)continue;let u=MG(c);if(u&&r){if(c._def.typeName==="ZodOptional")c=c._def.innerType;if(!c.isNullable())c=c.nullable();u=!1}let d=K(c._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});if(d===void 0)continue;if(o.properties[a]=d,!u)n.push(a)}if(n.length)o.required=n;let s=CG(e,t);if(s!==void 0)o.additionalProperties=s;return o}function CG(e,t){if(e.catchall._def.typeName!=="ZodNever")return K(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 MG(e){try{return e.isOptional()}catch{return!0}}var fO=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return K(e.innerType._def,t);let r=K(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Ne(t)},r]}:Ne(t)};var mO=(e,t)=>{if(t.pipeStrategy==="input")return K(e.in._def,t);else if(t.pipeStrategy==="output")return K(e.out._def,t);let r=K(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),o=K(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,o].filter((n)=>n!==void 0)}};function gO(e,t){return K(e.type._def,t)}function hO(e,t){let o={type:"array",uniqueItems:!0,items:K(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};if(e.minSize)ce(o,"minItems",e.minSize.value,e.minSize.message,t);if(e.maxSize)ce(o,"maxItems",e.maxSize.value,e.maxSize.message,t);return o}function yO(e,t){if(e.rest)return{type:"array",minItems:e.items.length,items:e.items.map((r,o)=>K(r._def,{...t,currentPath:[...t.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[]),additionalItems:K(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})};else return{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,o)=>K(r._def,{...t,currentPath:[...t.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[])}}function bO(e){return{not:Ne(e)}}function _O(e){return Ne(e)}var vO=(e,t)=>{return K(e.innerType._def,t)};var SO=(e,t,r)=>{switch(t){case R.ZodString:return hm(e,r);case R.ZodNumber:return dO(e,r);case R.ZodObject:return pO(e,r);case R.ZodBigInt:return G$(e,r);case R.ZodBoolean:return J$();case R.ZodDate:return iS(e,r);case R.ZodUndefined:return bO(r);case R.ZodNull:return aO(r);case R.ZodArray:return K$(e,r);case R.ZodUnion:case R.ZodDiscriminatedUnion:return lO(e,r);case R.ZodIntersection:return tO(e,r);case R.ZodTuple:return yO(e,r);case R.ZodRecord:return ym(e,r);case R.ZodLiteral:return rO(e,r);case R.ZodEnum:return eO(e);case R.ZodNativeEnum:return iO(e);case R.ZodNullable:return uO(e,r);case R.ZodOptional:return fO(e,r);case R.ZodMap:return oO(e,r);case R.ZodSet:return hO(e,r);case R.ZodLazy:return()=>e.getter()._def;case R.ZodPromise:return gO(e,r);case R.ZodNaN:case R.ZodNever:return sO(r);case R.ZodEffects:return Q$(e,r);case R.ZodAny:return Ne(r);case R.ZodUnknown:return _O(r);case R.ZodDefault:return Y$(e,r);case R.ZodBranded:return gm(e,r);case R.ZodReadonly:return vO(e,r);case R.ZodCatch:return X$(e,r);case R.ZodPipeline:return mO(e,r);case R.ZodFunction:case R.ZodVoid:case R.ZodSymbol:return;default:return((o)=>{return})(t)}};function K(e,t,r=!1){let o=t.seen.get(e);if(t.override){let a=t.override?.(e,t,o,r);if(a!==Z$)return a}if(o&&!r){let a=NG(o,t);if(a!==void 0)return a}let n={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,n);let i=SO(e,e.typeName,t),s=typeof i==="function"?K(i(),t):i;if(s)DG(e,t,s);if(t.postProcess){let a=t.postProcess(s,e,t);return n.jsonSchema=s,a}return n.jsonSchema=s,s}var NG=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:mm(t.currentPath,e.path)};case"none":case"seen":{if(e.path.length<t.currentPath.length&&e.path.every((r,o)=>t.currentPath[o]===r))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Ne(t);return t.$refStrategy==="seen"?Ne(t):void 0}}},DG=(e,t,r)=>{if(e.description){if(r.description=e.description,t.markdownDescription)r.markdownDescription=e.description}return r};var cS=(e,t)=>{let r=W$(t),o=typeof t==="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[u,d])=>({...c,[u]:K(d._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??Ne(r)}),{}):void 0,n=typeof t==="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=K(e._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??Ne(r),s=typeof t==="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;if(s!==void 0)i.title=s;if(r.flags.hasReferencedOpenAiAnyType){if(!o)o={};if(!o[r.openAiAnyTypeName])o[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}}let a=n===void 0?o?{...i,[r.definitionPath]:o}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...o,[n]:i}};if(r.target==="jsonSchema7")a.$schema="http://json-schema.org/draft-07/schema#";else if(r.target==="jsonSchema2019-09"||r.target==="openAi")a.$schema="https://json-schema.org/draft/2019-09/schema#";if(r.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 jG(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 lS(e,t){if(Xt(e))return rs(e,{target:jG(t?.target),io:t?.pipeStrategy??"input"});return cS(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function uS(e){let r=Dn(e)?.method;if(!r)throw Error("Schema is missing a method literal");let o=Af(r);if(typeof o!=="string")throw Error("Schema method literal must be a string");return o}function dS(e,t){let r=Nn(e,t);if(!r.success)throw r.error;return r.data}var zG=60000;class pS{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(Xf,(t)=>{this._oncancel(t)}),this.setNotificationHandler(Qf,(t)=>{this._onprogress(t)}),this.setRequestHandler(Yf,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(em,async(t,r)=>{let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new B(Z.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(rm,async(t,r)=>{let o=async()=>{let n=t.params.taskId;if(this._taskMessageQueue){let s;while(s=await this._taskMessageQueue.dequeue(n,r.sessionId)){if(s.type==="response"||s.type==="error"){let a=s.message,c=a.id,u=this._requestResolvers.get(c);if(u)if(this._requestResolvers.delete(c),s.type==="response")u(a);else{let d=a,p=new B(d.error.code,d.error.message,d.error.data);u(p)}else{let d=s.type==="response"?"Response":"Error";this._onerror(Error(`${d} handler missing for request ${c}`))}continue}await this._transport?.send(s.message,{relatedRequestId:r.requestId})}}let i=await this._taskStore.getTask(n,r.sessionId);if(!i)throw new B(Z.InvalidParams,`Task not found: ${n}`);if(!zn(i.status))return await this._waitForTaskUpdate(n,r.signal),await o();if(zn(i.status)){let s=await this._taskStore.getTaskResult(n,r.sessionId);return this._clearTaskQueue(n),{...s,_meta:{...s._meta,[jn]:{taskId:n}}}}return await o()};return await o()}),this.setRequestHandler(nm,async(t,r)=>{try{let{tasks:o,nextCursor:n}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:o,nextCursor:n,_meta:{}}}catch(o){throw new B(Z.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(im,async(t,r)=>{try{let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new B(Z.InvalidParams,`Task not found: ${t.params.taskId}`);if(zn(o.status))throw new B(Z.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId);let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new B(Z.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...n}}catch(o){if(o instanceof B)throw o;throw new B(Z.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),B.fromError(Z.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});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 r=this.transport?.onerror;this._transport.onerror=(n)=>{r?.(n),this._onerror(n)};let o=this._transport?.onmessage;this._transport.onmessage=(n,i)=>{if(o?.(n,i),hl(n)||C$(n))this._onresponse(n);else if(qv(n))this._onrequest(n,i);else if(A$(n))this._onnotification(n);else this._onerror(Error(`Unknown message type: ${JSON.stringify(n)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let t=B.fromError(Z.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(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((r)=>this._onerror(Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,n=e.params?._meta?.[jn]?.taskId;if(r===void 0){let u={jsonrpc:"2.0",id:e.id,error:{code:Z.MethodNotFound,message:"Method not found"}};if(n&&this._taskMessageQueue)this._enqueueTaskMessage(n,{type:"error",message:u,timestamp:Date.now()},o?.sessionId).catch((d)=>this._onerror(Error(`Failed to enqueue error response: ${d}`)));else o?.send(u).catch((d)=>this._onerror(Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let s=R$(e.params)?e.params.task:void 0,a=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,c={signal:i.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async(u)=>{if(i.signal.aborted)return;let d={relatedRequestId:e.id};if(n)d.relatedTask={taskId:n};await this.notification(u,d)},sendRequest:async(u,d,p)=>{if(i.signal.aborted)throw new B(Z.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:e.id};if(n&&!f.relatedTask)f.relatedTask={taskId:n};let m=f.relatedTask?.taskId??n;if(m&&a)await a.updateTaskStatus(m,"input_required");return await this.request(u,d,f)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:n,taskStore:a,taskRequestedTtl:s?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(s)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,c)).then(async(u)=>{if(i.signal.aborted)return;let d={result:u,jsonrpc:"2.0",id:e.id};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"response",message:d,timestamp:Date.now()},o?.sessionId);else await o?.send(d)},async(u)=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:Z.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"error",message:d,timestamp:Date.now()},o?.sessionId);else await o?.send(d)}).catch((u)=>this._onerror(Error(`Failed to send response: ${u}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===i)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),n=this._progressHandlers.get(o);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&i&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(a){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(a);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),hl(e))r(e);else{let i=new B(e.error.code,e.error.message,e.error.data);r(i)}return}let o=this._responseHandlers.get(t);if(o===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 n=!1;if(hl(e)&&e.result&&typeof e.result==="object"){let i=e.result;if(i.task&&typeof i.task==="object"){let s=i.task;if(typeof s.taskId==="string")n=!0,this._taskProgressTokens.set(s.taskId,t)}}if(!n)this._progressHandlers.delete(t);if(hl(e))o(e);else{let i=B.fromError(e.error.code,e.error.message,e.error.data);o(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){let{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(e,t,r)}}catch(i){yield{type:"error",error:i instanceof B?i:new B(Z.InternalError,String(i))}}return}let n;try{let i=await this.request(e,cs,r);if(i.task)n=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new B(Z.InternalError,"Task creation did not return a task");while(!0){let s=await this.getTask({taskId:n},r);if(yield{type:"taskStatus",task:s},zn(s.status)){if(s.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};else if(s.status==="failed")yield{type:"error",error:new B(Z.InternalError,`Task ${n} failed`)};else if(s.status==="cancelled")yield{type:"error",error:new B(Z.InternalError,`Task ${n} was cancelled`)};return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};return}let a=s.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((c)=>setTimeout(c,a)),r?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof B?i:new B(Z.InternalError,String(i))}}}request(e,t,r){let{relatedRequestId:o,resumptionToken:n,onresumptiontoken:i,task:s,relatedTask:a}=r??{};return new Promise((c,u)=>{let d=(v)=>{u(v)};if(!this._transport){d(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),s)this.assertTaskCapability(e.method)}catch(v){d(v);return}r?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};if(r?.onprogress)this._progressHandlers.set(p,r.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}};if(s)f.params={...f.params,task:s};if(a)f.params={...f.params,_meta:{...f.params?._meta||{},[jn]:a}};let m=(v)=>{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(v)}},{relatedRequestId:o,resumptionToken:n,onresumptiontoken:i}).catch((w)=>this._onerror(Error(`Failed to send cancellation: ${w}`)));let x=v instanceof B?v:new B(Z.RequestTimeout,String(v));u(x)};this._responseHandlers.set(p,(v)=>{if(r?.signal?.aborted)return;if(v instanceof Error)return u(v);try{let x=Nn(t,v.result);if(!x.success)u(x.error);else c(x.data)}catch(x){u(x)}}),r?.signal?.addEventListener("abort",()=>{m(r?.signal?.reason)});let g=r?.timeout??zG,h=()=>m(B.fromError(Z.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(p,g,r?.maxTotalTimeout,h,r?.resetTimeoutOnProgress??!1);let y=a?.taskId;if(y){let v=(x)=>{let w=this._responseHandlers.get(p);if(w)w(x);else this._onerror(Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,v),this._enqueueTaskMessage(y,{type:"request",message:f,timestamp:Date.now()}).catch((x)=>{this._cleanupTimeout(p),u(x)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:n,onresumptiontoken:i}).catch((v)=>{this._cleanupTimeout(p),u(v)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},tm,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},om,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},N$,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[jn]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:s,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 s={...e,jsonrpc:"2.0"};if(t?.relatedTask)s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[jn]:t.relatedTask}}};this._transport?.send(s,t).catch((a)=>this._onerror(a))});return}let i={...e,jsonrpc:"2.0"};if(t?.relatedTask)i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[jn]:t.relatedTask}}};await this._transport.send(i,t)}setRequestHandler(e,t){let r=uS(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,n)=>{let i=dS(e,o);return Promise.resolve(t(i,n))})}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 r=uS(e);this._notificationHandlers.set(r,(o)=>{let n=dS(e,o);return Promise.resolve(t(n))})}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,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,o)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,t);for(let o of r)if(o.type==="request"&&qv(o.message)){let n=o.message.id,i=this._requestResolvers.get(n);if(i)i(new B(Z.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(n);else this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1000;try{let o=await this._taskStore?.getTask(e);if(o?.pollInterval)r=o.pollInterval}catch{}return new Promise((o,n)=>{if(t.aborted){n(new B(Z.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,r);t.addEventListener("abort",()=>{clearTimeout(i),n(new B(Z.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async(o)=>{if(!e)throw Error("No request provided");return await r.createTask(o,e.id,{method:e.method,params:e.params},t)},getTask:async(o)=>{let n=await r.getTask(o,t);if(!n)throw new B(Z.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(o,n,i)=>{await r.storeTaskResult(o,n,i,t);let s=await r.getTask(o,t);if(s){let a=Sl.parse({method:"notifications/tasks/status",params:s});if(await this.notification(a),zn(s.status))this._cleanupTaskProgressHandler(o)}},getTaskResult:(o)=>{return r.getTaskResult(o,t)},updateTaskStatus:async(o,n,i)=>{let s=await r.getTask(o,t);if(!s)throw new B(Z.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(zn(s.status))throw new B(Z.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,n,i,t);let a=await r.getTask(o,t);if(a){let c=Sl.parse({method:"notifications/tasks/status",params:a});if(await this.notification(c),zn(a.status))this._cleanupTaskProgressHandler(o)}},listTasks:(o)=>{return r.listTasks(o,t)}}}}function xO(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function wO(e,t){let r={...e};for(let o in t){let n=o,i=t[n];if(i===void 0)continue;let s=r[n];if(xO(s)&&xO(i))r[n]={...s,...i};else r[n]=i}return r}var iD=wg(ax(),1),sD=wg(oD(),1);function sQ(){let e=new iD.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return sD.default(e),e}class yx{constructor(e){this._ajv=e??sQ()}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(r)=>{if(t(r))return{valid:!0,data:r,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class bx{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}createMessageStream(e,t){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],i=n.some((u)=>u.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=s?Array.isArray(s.content)?s.content:[s.content]:[],c=a.some((u)=>u.type==="tool_use");if(i){if(n.some((u)=>u.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 u=new Set(a.filter((p)=>p.type==="tool_use").map((p)=>p.id)),d=new Set(n.filter((p)=>p.type==="tool_result").map((p)=>p.toolUseId));if(u.size!==d.size||![...u].every((p)=>d.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},kl,t)}elicitInputStream(e,t){let r=this._server.getClientCapabilities(),o=e.mode??"form";switch(o){case"url":{if(!r?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let n=o==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:n},ds,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}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 aD(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function cD(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}class _x extends pS{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(wl.options.map((r,o)=>[r,o])),this.isMessageIgnored=(r,o)=>{let n=this._loggingLevels.get(o);return n?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new yx,this.setRequestHandler(Wv,(r)=>this._oninitialize(r)),this.setNotificationHandler(Kv,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(tS,async(r,o)=>{let n=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=r.params,s=wl.safeParse(i);if(s.success)this._loggingLevels.set(n,s.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new bx(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=wO(this._capabilities,e)}setRequestHandler(e,t){let o=Dn(e)?.method;if(!o)throw Error("Schema is missing a method literal");let n;if(Xt(o)){let s=o;n=s._zod?.def?.value??s.value}else{let s=o;n=s._def?.value??s.value}if(typeof n!=="string")throw Error("Schema method literal must be a string");if(n==="tools/call"){let s=async(a,c)=>{let u=Nn(us,a);if(!u.success){let m=u.error instanceof Error?u.error.message:String(u.error);throw new B(Z.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=u.data,p=await Promise.resolve(t(a,c));if(d.task){let m=Nn(cs,p);if(!m.success){let g=m.error instanceof Error?m.error.message:String(m.error);throw new B(Z.InvalidParams,`Invalid task creation result: ${g}`)}return m.data}let f=Nn(pm,p);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new B(Z.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(e,s)}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){cD(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;aD(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:T$.includes(t)?t:Hv,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"},Jf)}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 r=e.messages[e.messages.length-1],o=Array.isArray(r.content)?r.content:[r.content],n=o.some((c)=>c.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=i?Array.isArray(i.content)?i.content:[i.content]:[],a=s.some((c)=>c.type==="tool_use");if(n){if(o.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(s.filter((d)=>d.type==="tool_use").map((d)=>d.id)),u=new Set(o.filter((d)=>d.type==="tool_result").map((d)=>d.toolUseId));if(c.size!==u.size||![...c].every((d)=>u.has(d)))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},rS,t);return this.request({method:"sampling/createMessage",params:e},kl,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 o=e;return this.request({method:"elicitation/create",params:o},ds,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let o=e.mode==="form"?e:{...e,mode:"form"},n=await this.request({method:"elicitation/create",params:o},ds,t);if(n.action==="accept"&&n.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(n.content);if(!s.valid)throw new B(Z.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(i){if(i instanceof B)throw i;throw new B(Z.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return n}}}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},nS,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 uD=Symbol.for("mcp.completable");function vx(e){return!!e&&typeof e==="object"&&uD in e}function dD(e){return e[uD]?.complete}var lD;(function(e){e.Completable="McpCompletable"})(lD||(lD={}));var aQ=/^[A-Za-z0-9._-]{1,128}$/;function cQ(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(!aQ.test(e)){let r=e.split("").filter((o)=>!/[A-Za-z0-9._-]/.test(o)).filter((o,n,i)=>i.indexOf(o)===n);return t.push(`Tool name contains invalid characters: ${r.map((o)=>`"${o}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function lQ(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);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 Sx(e){let t=cQ(e);return lQ(e,t.warnings),t.isValid}class xx{constructor(e){this._mcpServer=e}registerToolTask(e,t,r){let o={taskSupport:"required",...t.execution};if(o.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,o,t._meta,r)}}class kx{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 _x(e,t)}get experimental(){if(!this._experimental)this._experimental={tasks:new xx(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(Vn(dm)),this.server.assertCanSetRequestHandler(Vn(us)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(dm,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:(()=>{let o=ns(t.inputSchema);return o?lS(o,{strictUnions:!0,pipeStrategy:"input"}):uQ})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let o=ns(t.outputSchema);if(o)r.outputSchema=lS(o,{strictUnions:!0,pipeStrategy:"output"})}return r})})),this.server.setRequestHandler(us,async(e,t)=>{try{let r=this._registeredTools[e.params.name];if(!r)throw new B(Z.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new B(Z.InvalidParams,`Tool ${e.params.name} disabled`);let o=!!e.params.task,n=r.execution?.taskSupport,i="createTask"in r.handler;if((n==="required"||n==="optional")&&!i)throw new B(Z.InternalError,`Tool ${e.params.name} has taskSupport '${n}' but was not registered with registerToolTask`);if(n==="required"&&!o)throw new B(Z.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(n==="optional"&&!o&&i)return await this.handleAutomaticTaskPolling(r,e,t);let s=await this.validateToolInput(r,e.params.arguments,e.params.name),a=await this.executeToolHandler(r,s,t);if(o)return a;return await this.validateToolOutput(r,a,e.params.name),a}catch(r){if(r instanceof B){if(r.code===Z.UrlElicitationRequired)throw r}return this.createToolError(r instanceof Error?r.message:String(r))}}),this._toolHandlersInitialized=!0}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let n=ns(e.inputSchema)??e.inputSchema,i=await $f(n,t);if(!i.success){let s="error"in i?i.error:"Unknown error",a=Of(s);throw new B(Z.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${a}`)}return i.data}async validateToolOutput(e,t,r){if(!e.outputSchema)return;if(!("content"in t))return;if(t.isError)return;if(!t.structuredContent)throw new B(Z.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let o=ns(e.outputSchema),n=await $f(o,t.structuredContent);if(!n.success){let i="error"in n?n.error:"Unknown error",s=Of(i);throw new B(Z.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${s}`)}}async executeToolHandler(e,t,r){let o=e.handler;if("createTask"in o){if(!r.taskStore)throw Error("No task store provided.");let i={...r,taskStore:r.taskStore};if(e.inputSchema)return await Promise.resolve(o.createTask(t,i));else return await Promise.resolve(o.createTask(i))}if(e.inputSchema)return await Promise.resolve(o(t,r));else return await Promise.resolve(o(r))}async handleAutomaticTaskPolling(e,t,r){if(!r.taskStore)throw Error("No task store provided for task-capable tool.");let o=await this.validateToolInput(e,t.params.arguments,t.params.name),n=e.handler,i={...r,taskStore:r.taskStore},s=o?await Promise.resolve(n.createTask(o,i)):await Promise.resolve(n.createTask(i)),a=s.task.taskId,c=s.task,u=c.pollInterval??5000;while(c.status!=="completed"&&c.status!=="failed"&&c.status!=="cancelled"){await new Promise((p)=>setTimeout(p,u));let d=await r.taskStore.getTask(a);if(!d)throw new B(Z.InternalError,`Task ${a} not found during polling`);c=d}return await r.taskStore.getTaskResult(a)}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(Vn(fm)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(fm,async(e)=>{switch(e.params.ref.type){case"ref/prompt":return F$(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return H$(e),this.handleResourceCompletion(e,e.params.ref);default:throw new B(Z.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new B(Z.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new B(Z.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return Gl;let n=Dn(r.argsSchema)?.[e.params.argument.name];if(!vx(n))return Gl;let i=dD(n);if(!i)return Gl;let s=await i(e.params.argument.value,e.params.context);return fD(s)}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find((i)=>i.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return Gl;throw new B(Z.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let o=r.resourceTemplate.completeCallback(e.params.argument.name);if(!o)return Gl;let n=await o(e.params.argument.value,e.params.context);return fD(n)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(Vn(sm)),this.server.assertCanSetRequestHandler(Vn(am)),this.server.assertCanSetRequestHandler(Vn(cm)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(sm,async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([n,i])=>i.enabled).map(([n,i])=>({uri:n,name:i.name,...i.metadata})),o=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let i=await n.resourceTemplate.listCallback(t);for(let s of i.resources)o.push({...n.metadata,...s})}return{resources:[...r,...o]}}),this.server.setRequestHandler(am,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,r])=>({name:t,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))}}),this.server.setRequestHandler(cm,async(e,t)=>{let r=new URL(e.params.uri),o=this._registeredResources[r.toString()];if(o){if(!o.enabled)throw new B(Z.InvalidParams,`Resource ${r} disabled`);return o.readCallback(r,t)}for(let n of Object.values(this._registeredResourceTemplates)){let i=n.resourceTemplate.uriTemplate.match(r.toString());if(i)return n.readCallback(r,i,t)}throw new B(Z.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(Vn(lm)),this.server.assertCanSetRequestHandler(Vn(um)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(lm,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>{return{name:e,title:t.title,description:t.description,arguments:t.argsSchema?dQ(t.argsSchema):void 0}})})),this.server.setRequestHandler(um,async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new B(Z.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new B(Z.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let o=ns(r.argsSchema),n=await $f(o,e.params.arguments);if(!n.success){let a="error"in n?n.error:"Unknown error",c=Of(a);throw new B(Z.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${c}`)}let i=n.data,s=r.callback;return await Promise.resolve(s(i,t))}else{let o=r.callback;return await Promise.resolve(o(t))}}),this._promptHandlersInitialized=!0}resource(e,t,...r){let o;if(typeof r[0]==="object")o=r.shift();let n=r[0];if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let i=this._createRegisteredResource(e,void 0,t,o,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,void 0,t,o,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,t,r,o){if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let n=this._createRegisteredResource(e,r.title,t,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let n=this._createRegisteredResourceTemplate(e,r.title,t,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(e,t,r,o,n){let i={name:e,title:t,metadata:o,readCallback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:(s)=>{if(typeof s.uri<"u"&&s.uri!==r){if(delete this._registeredResources[r],s.uri)this._registeredResources[s.uri]=i}if(typeof s.name<"u")i.name=s.name;if(typeof s.title<"u")i.title=s.title;if(typeof s.metadata<"u")i.metadata=s.metadata;if(typeof s.callback<"u")i.readCallback=s.callback;if(typeof s.enabled<"u")i.enabled=s.enabled;this.sendResourceListChanged()}};return this._registeredResources[r]=i,i}_createRegisteredResourceTemplate(e,t,r,o,n){let i={resourceTemplate:r,title:t,metadata:o,readCallback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:(c)=>{if(typeof c.name<"u"&&c.name!==e){if(delete this._registeredResourceTemplates[e],c.name)this._registeredResourceTemplates[c.name]=i}if(typeof c.title<"u")i.title=c.title;if(typeof c.template<"u")i.resourceTemplate=c.template;if(typeof c.metadata<"u")i.metadata=c.metadata;if(typeof c.callback<"u")i.readCallback=c.callback;if(typeof c.enabled<"u")i.enabled=c.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=i;let s=r.uriTemplate.variableNames;if(Array.isArray(s)&&s.some((c)=>!!r.completeCallback(c)))this.setCompletionRequestHandler();return i}_createRegisteredPrompt(e,t,r,o,n){let i={title:t,description:r,argsSchema:o===void 0?void 0:Do(o),callback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:(s)=>{if(typeof s.name<"u"&&s.name!==e){if(delete this._registeredPrompts[e],s.name)this._registeredPrompts[s.name]=i}if(typeof s.title<"u")i.title=s.title;if(typeof s.description<"u")i.description=s.description;if(typeof s.argsSchema<"u")i.argsSchema=Do(s.argsSchema);if(typeof s.callback<"u")i.callback=s.callback;if(typeof s.enabled<"u")i.enabled=s.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=i,o){if(Object.values(o).some((a)=>{let c=a instanceof Gt?a._def?.innerType:a;return vx(c)}))this.setCompletionRequestHandler()}return i}_createRegisteredTool(e,t,r,o,n,i,s,a,c){Sx(e);let u={title:t,description:r,inputSchema:pD(o),outputSchema:pD(n),annotations:i,execution:s,_meta:a,handler:c,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:(d)=>{if(typeof d.name<"u"&&d.name!==e){if(typeof d.name==="string")Sx(d.name);if(delete this._registeredTools[e],d.name)this._registeredTools[d.name]=u}if(typeof d.title<"u")u.title=d.title;if(typeof d.description<"u")u.description=d.description;if(typeof d.paramsSchema<"u")u.inputSchema=Do(d.paramsSchema);if(typeof d.outputSchema<"u")u.outputSchema=Do(d.outputSchema);if(typeof d.callback<"u")u.handler=d.callback;if(typeof d.annotations<"u")u.annotations=d.annotations;if(typeof d._meta<"u")u._meta=d._meta;if(typeof d.enabled<"u")u.enabled=d.enabled;this.sendToolListChanged()}};return this._registeredTools[e]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(e,...t){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r,o,n,i;if(typeof t[0]==="string")r=t.shift();if(t.length>1){let a=t[0];if(wx(a)){if(o=t.shift(),t.length>1&&typeof t[0]==="object"&&t[0]!==null&&!wx(t[0]))i=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`);i=t.shift()}}let s=t[0];return this._createRegisteredTool(e,void 0,r,o,n,i,{taskSupport:"forbidden"},void 0,s)}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:o,description:n,inputSchema:i,outputSchema:s,annotations:a,_meta:c}=t;return this._createRegisteredTool(e,o,n,i,s,a,{taskSupport:"forbidden"},c,r)}prompt(e,...t){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let r;if(typeof t[0]==="string")r=t.shift();let o;if(t.length>1)o=t.shift();let n=t[0],i=this._createRegisteredPrompt(e,void 0,r,o,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:o,description:n,argsSchema:i}=t,s=this._createRegisteredPrompt(e,o,n,i,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}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 uQ={type:"object",properties:{}};function mD(e){return e!==null&&typeof e==="object"&&"parse"in e&&typeof e.parse==="function"&&"safeParse"in e&&typeof e.safeParse==="function"}function gD(e){return"_def"in e||"_zod"in e||mD(e)}function wx(e){if(typeof e!=="object"||e===null)return!1;if(gD(e))return!1;if(Object.keys(e).length===0)return!0;return Object.values(e).some(mD)}function pD(e){if(!e)return;if(wx(e))return Do(e);if(!gD(e))throw Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}function dQ(e){let t=Dn(e);if(!t)return[];return Object.entries(t).map(([r,o])=>{let n=L0(o),i=F0(o);return{name:r,description:n,required:!i}})}function Vn(e){let r=Dn(e)?.method;if(!r)throw Error("Schema is missing a method literal");let o=Af(r);if(typeof o==="string")return o;throw Error("Schema method literal must be a string")}function fD(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var Gl={completion:{values:[],hasMore:!1}};function pQ(e,t,r,o,n){let i={};if(n?.searchHint)i["anthropic/searchHint"]=n.searchHint;if(n?.alwaysLoad)i["anthropic/alwaysLoad"]=!0;return{name:e,description:t,inputSchema:r,handler:o,annotations:n?.annotations,_meta:Object.keys(i).length>0?i:void 0}}function fQ(e){let t=new kx({name:e.name,version:e.version??"1.0.0"},{capabilities:{tools:e.tools?{}:void 0},instructions:e.instructions});if(e.tools)e.tools.forEach((r)=>{for(let o of Object.values(r.inputSchema)){if(!mQ(o))continue;let n=o.description;if(n&&!Et.has(o))Et.add(o,{description:n})}t.registerTool(r.name,{description:r.description,inputSchema:r.inputSchema,annotations:r.annotations,_meta:e.alwaysLoad?{"anthropic/alwaysLoad":!0,...r._meta}:r._meta},r.handler)});return{type:"sdk",name:e.name,instance:t}}function mQ(e){return typeof e==="object"&&e!==null&&"_zod"in e}function P(e){let t;return()=>t??=e()}var hD=15000,gQ=P(()=>l.object({session_id:l.string(),ws_url:l.string(),work_dir:l.string().optional(),session_key:l.string().optional()}));class vr extends Error{code;constructor(e,t){super(e);this.name="DirectConnectError",this.code=t}}class bD{options;ws;sessionId;workDir;abortController;readyState=!1;closed=!1;exitError;messages=new Ha;readyPromise;readyResolve;readyReject;abortHandler;partialChunks=[];telemetryEmitted=!1;constructor(e){this.options=e;this.abortController=e.abortController??new AbortController,this.readyPromise=new Promise((t,r)=>{this.readyResolve=t,this.readyReject=r}),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 it("Connection aborted"));return}this.abortHandler=()=>{this.close(),this.exitError=new it("Connection aborted by user")},this.abortController.signal.addEventListener("abort",this.abortHandler);let e;try{let n=await yQ(this.options);this.sessionId=n.sessionId,this.workDir=n.workDir,e=n.wsUrl}catch(n){let i=Er(n);if(!(i instanceof it)){let s=i instanceof vr&&i.code?i.code:"session_create_failed";this.emitTelemetry("bad",s)}this.failInit(i);return}if(this.closed){if(this.options.deleteSessionOnClose&&this.sessionId)yD(this.options.serverUrl,this.sessionId,this.options.authToken);return}let t={};if(this.options.authToken)t.authorization=`Bearer ${this.options.authToken}`;let r=new WebSocket(e,{headers:t});this.ws=r;let o=setTimeout((n,i)=>{if(!n.readyState){i.close();let s=new vr(`WebSocket connection timeout after ${hD}ms`);n.exitError=s,n.readyReject?.(s),n.emitTelemetry("bad","connect_timeout")}},hD,this,r);r.addEventListener("open",()=>{clearTimeout(o),this.readyState=!0,St(`[DirectConnectTransport] Connected to ${this.options.serverUrl}, session=${this.sessionId}`),this.readyResolve?.(),this.emitTelemetry("ok")}),r.addEventListener("message",(n)=>{let i=typeof n.data==="string"?n.data:"";if(i.indexOf(`
105
105
  `)===-1){if(i)this.partialChunks.push(i);return}let s=this.partialChunks.join("")+i;this.partialChunks.length=0;let a=s.split(`
106
- `),c=a.pop()??"";if(c)this.partialChunks.push(c);for(let u of a){if(!u)continue;let d;try{d=Ze(u)}catch(p){St(`DirectConnect: dropped malformed JSON line (${u.length} bytes): ${p}`);continue}this.messages.enqueue(d)}}),r.addEventListener("error",()=>{clearTimeout(o);let n=new vr("WebSocket connection error");if(this.exitError=n,this.readyReject?.(n),this.messages.done(),!this.readyState)this.emitTelemetry("bad","ws_error")}),r.addEventListener("close",(n)=>{let i=this.readyState;this.readyState=!1,this.closed=!0;let s=n.code!==1000&&n.code!==1001;if(s&&!this.exitError)this.exitError=new vr(`WebSocket closed abnormally: ${n.code} ${n.reason}`);if(this.messages.done(),i&&s&&!this.abortController.signal.aborted)this.emitTelemetry("sad","ws_closed_abnormally")})}emitTelemetry(e,t){if(this.telemetryEmitted)return;if(this.telemetryEmitted=!0,e==="ok")Rh("transport_direct_connect");else if(e==="bad")$h("transport_direct_connect",t??"unknown");else IE("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 it("Operation aborted");if(!this.readyState)await this.readyPromise;if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new vr("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)gD(this.options.serverUrl,this.sessionId,this.options.authToken)}async*readMessages(){if(yield*this.messages,this.exitError)throw this.exitError}}function lQ(e){if(e.startsWith("cc://")){let o=e.slice(5),n=new URL(`http://${o}`),i=n.pathname.slice(1)||void 0;return{serverUrl:`http://${n.host}`,authToken:i}}if(e.startsWith("cc+unix://"))throw new vr("Unix socket connect (cc+unix://) is not supported by the SDK transport");let t=/^https?:\/\//i.test(e)?e:`http://${e}`,r=new URL(t);return{serverUrl:`${r.protocol}//${r.host}`,authToken:void 0}}async function uQ(e){let t={"content-type":"application/json"};if(e.authToken)t.authorization=`Bearer ${e.authToken}`;let r={};if(e.cwd)r.cwd=e.cwd;if(e.sessionKey)r.session_key=e.sessionKey;if(e.permissionMode)r.permission_mode=e.permissionMode;let o;try{o=await fetch(`${e.serverUrl}/sessions`,{method:"POST",headers:t,body:pe(r)})}catch(i){throw new vr(`Failed to connect to server at ${e.serverUrl}: ${i instanceof Error?i.message:String(i)}`,"session_create_failed")}if(!o.ok){let i=await o.text().catch(()=>"");throw new vr(`Failed to create session: ${o.status} ${o.statusText}${i?` — ${i}`:""}`,"session_create_failed")}let n=cQ().safeParse(await o.json());if(!n.success)throw new vr(`Invalid session response: ${n.error.message}`,"session_create_invalid_response");return{sessionId:n.data.session_id,wsUrl:n.data.ws_url,workDir:n.data.work_dir}}async function gD(e,t,r){let o={};if(r)o.authorization=`Bearer ${r}`;try{await fetch(`${e}/sessions/${t}`,{method:"DELETE",headers:o})}catch{}}import{resolve as Qte}from"path";import{join as Cs}from"path";import{dirname as dQ}from"path";function Jl(e,t,r){let o=pQ();if(!o)return;let n={timestamp:new Date().toISOString(),level:e,event:t,data:r??{}},i=Fe(),s=pe(n)+`
107
- `;try{i.appendFileSync(o,s)}catch{try{i.mkdirSync(dQ(o)),i.appendFileSync(o,s)}catch{}}}function pQ(){return process.env.CLAUDE_CODE_DIAGNOSTICS_FILE}function fQ(e){let{buffer:t,bytesRead:r}=Fe().readSync(e,{length:4096});if(r===0)return"utf8";if(r>=2){if(t[0]===255&&t[1]===254)return"utf16le"}if(r>=3&&t[0]===239&&t[1]===187&&t[2]===191)return"utf8";return"utf8"}function mQ(e){let t=0,r=0;for(let o=0;o<e.length;o++)if(e[o]===`
108
- `)if(o>0&&e[o-1]==="\r")t++;else r++;return t>r?"CRLF":"LF"}function gQ(e){let t=Fe(),{resolvedPath:r,isSymlink:o}=dd(t,e);if(o)ne(`Reading through symlink: ${e} -> ${r}`);let n=fQ(r),i=t.readFileSync(r,{encoding:n}),s=mQ(i.slice(0,4096));return{content:i.replaceAll(`\r
106
+ `),c=a.pop()??"";if(c)this.partialChunks.push(c);for(let u of a){if(!u)continue;let d;try{d=Ze(u)}catch(p){St(`DirectConnect: dropped malformed JSON line (${u.length} bytes): ${p}`);continue}this.messages.enqueue(d)}}),r.addEventListener("error",()=>{clearTimeout(o);let n=new vr("WebSocket connection error");if(this.exitError=n,this.readyReject?.(n),this.messages.done(),!this.readyState)this.emitTelemetry("bad","ws_error")}),r.addEventListener("close",(n)=>{let i=this.readyState;this.readyState=!1,this.closed=!0;let s=n.code!==1000&&n.code!==1001;if(s&&!this.exitError)this.exitError=new vr(`WebSocket closed abnormally: ${n.code} ${n.reason}`);if(this.messages.done(),i&&s&&!this.abortController.signal.aborted)this.emitTelemetry("sad","ws_closed_abnormally")})}emitTelemetry(e,t){if(this.telemetryEmitted)return;if(this.telemetryEmitted=!0,e==="ok")$h("transport_direct_connect");else if(e==="bad")Oh("transport_direct_connect",t??"unknown");else $T("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 it("Operation aborted");if(!this.readyState)await this.readyPromise;if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new vr("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)yD(this.options.serverUrl,this.sessionId,this.options.authToken)}async*readMessages(){if(yield*this.messages,this.exitError)throw this.exitError}}function hQ(e){if(e.startsWith("cc://")){let o=e.slice(5),n=new URL(`http://${o}`),i=n.pathname.slice(1)||void 0;return{serverUrl:`http://${n.host}`,authToken:i}}if(e.startsWith("cc+unix://"))throw new vr("Unix socket connect (cc+unix://) is not supported by the SDK transport");let t=/^https?:\/\//i.test(e)?e:`http://${e}`,r=new URL(t);return{serverUrl:`${r.protocol}//${r.host}`,authToken:void 0}}async function yQ(e){let t={"content-type":"application/json"};if(e.authToken)t.authorization=`Bearer ${e.authToken}`;let r={};if(e.cwd)r.cwd=e.cwd;if(e.sessionKey)r.session_key=e.sessionKey;if(e.permissionMode)r.permission_mode=e.permissionMode;let o;try{o=await fetch(`${e.serverUrl}/sessions`,{method:"POST",headers:t,body:pe(r)})}catch(i){throw new vr(`Failed to connect to server at ${e.serverUrl}: ${i instanceof Error?i.message:String(i)}`,"session_create_failed")}if(!o.ok){let i=await o.text().catch(()=>"");throw new vr(`Failed to create session: ${o.status} ${o.statusText}${i?` — ${i}`:""}`,"session_create_failed")}let n=gQ().safeParse(await o.json());if(!n.success)throw new vr(`Invalid session response: ${n.error.message}`,"session_create_invalid_response");return{sessionId:n.data.session_id,wsUrl:n.data.ws_url,workDir:n.data.work_dir}}async function yD(e,t,r){let o={};if(r)o.authorization=`Bearer ${r}`;try{await fetch(`${e}/sessions/${t}`,{method:"DELETE",headers:o})}catch{}}import{resolve as sre}from"path";import{join as Cs}from"path";import{dirname as bQ}from"path";function Jl(e,t,r){let o=_Q();if(!o)return;let n={timestamp:new Date().toISOString(),level:e,event:t,data:r??{}},i=Fe(),s=pe(n)+`
107
+ `;try{i.appendFileSync(o,s)}catch{try{i.mkdirSync(bQ(o)),i.appendFileSync(o,s)}catch{}}}function _Q(){return process.env.CLAUDE_CODE_DIAGNOSTICS_FILE}function vQ(e){let{buffer:t,bytesRead:r}=Fe().readSync(e,{length:4096});if(r===0)return"utf8";if(r>=2){if(t[0]===255&&t[1]===254)return"utf16le"}if(r>=3&&t[0]===239&&t[1]===187&&t[2]===191)return"utf8";return"utf8"}function SQ(e){let t=0,r=0;for(let o=0;o<e.length;o++)if(e[o]===`
108
+ `)if(o>0&&e[o-1]==="\r")t++;else r++;return t>r?"CRLF":"LF"}function xQ(e){let t=Fe(),{resolvedPath:r,isSymlink:o}=pd(t,e);if(o)ne(`Reading through symlink: ${e} -> ${r}`);let n=vQ(r),i=t.readFileSync(r,{encoding:n}),s=SQ(i.slice(0,4096));return{content:i.replaceAll(`\r
109
109
  `,`
110
- `),encoding:n,lineEndings:s}}function Ho(e){return gQ(e).content}var yD;(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"})(yD||(yD={}));var yQ=Array(20).fill(0).map((e,t)=>{return" ".repeat(t)});var bQ={" ":{"\n":Array(200).fill(0).map((e,t)=>{return`
110
+ `),encoding:n,lineEndings:s}}function qo(e){return xQ(e).content}var _D;(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"})(_D||(_D={}));var kQ=Array(20).fill(0).map((e,t)=>{return" ".repeat(t)});var EQ={" ":{"\n":Array(200).fill(0).map((e,t)=>{return`
111
111
  `+" ".repeat(t)}),"\r":Array(200).fill(0).map((e,t)=>{return"\r"+" ".repeat(t)}),"\r\n":Array(200).fill(0).map((e,t)=>{return`\r
112
112
  `+" ".repeat(t)})},"\t":{"\n":Array(200).fill(0).map((e,t)=>{return`
113
113
  `+"\t".repeat(t)}),"\r":Array(200).fill(0).map((e,t)=>{return"\r"+"\t".repeat(t)}),"\r\n":Array(200).fill(0).map((e,t)=>{return`\r
114
- `+"\t".repeat(t)})}};var _D;(function(e){e.DEFAULT={allowTrailingComma:!1}})(_D||(_D={}));var vD;(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"})(vD||(vD={}));var SD;(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"})(SD||(SD={}));var xD;(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"})(xD||(xD={}));function Qm(e){return e.startsWith("\uFEFF")?e.slice(1):e}import De from"node:path";import wD from"node:os";import kx from"node:process";var Zn=wD.homedir(),Tx=wD.tmpdir(),{env:Ts}=kx,TQ=(e)=>{let t=De.join(Zn,"Library");return{data:De.join(t,"Application Support",e),config:De.join(t,"Preferences",e),cache:De.join(t,"Caches",e),log:De.join(t,"Logs",e),temp:De.join(Tx,e)}},EQ=(e)=>{let t=Ts.APPDATA||De.join(Zn,"AppData","Roaming"),r=Ts.LOCALAPPDATA||De.join(Zn,"AppData","Local");return{data:De.join(r,e,"Data"),config:De.join(t,e,"Config"),cache:De.join(r,e,"Cache"),log:De.join(r,e,"Log"),temp:De.join(Tx,e)}},PQ=(e)=>{let t=De.basename(Zn);return{data:De.join(Ts.XDG_DATA_HOME||De.join(Zn,".local","share"),e),config:De.join(Ts.XDG_CONFIG_HOME||De.join(Zn,".config"),e),cache:De.join(Ts.XDG_CACHE_HOME||De.join(Zn,".cache"),e),log:De.join(Ts.XDG_STATE_HOME||De.join(Zn,".local","state"),e),temp:De.join(Tx,t,e)}};function Ex(e,{suffix:t="nodejs"}={}){if(typeof e!=="string")throw TypeError(`Expected a string, got ${typeof e}`);if(t)e+=`-${t}`;if(kx.platform==="darwin")return TQ(e);if(kx.platform==="win32")return EQ(e);return PQ(e)}var xPe=Ex("claude-cli");function IQ(){if(process.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC)return"essential-traffic";if(process.env.DISABLE_TELEMETRY)return"no-telemetry";if(Te(process.env.DO_NOT_TRACK))return"no-telemetry";return"default"}function kD(){return IQ()==="essential-traffic"}var RQ=100,Px=[];function $Q(e){if(Px.length>=RQ)Px.shift();Px.push(e)}var OQ=[],TD=null;var WPe=Ce(()=>{return process.argv.includes("--hard-fail")});function eg(e){let t=kr(e);try{if(Te(process.env.CLAUDE_CODE_USE_BEDROCK)||Te(process.env.CLAUDE_CODE_USE_VERTEX)||Te(process.env.CLAUDE_CODE_USE_FOUNDRY)||Te(process.env.CLAUDE_CODE_USE_ANTHROPIC_AWS)||Te(process.env.CLAUDE_CODE_USE_MANTLE)||process.env.DISABLE_ERROR_REPORTING||kD())return;let o={error:t.stack||t.message,timestamp:new Date().toISOString()};if($Q(o),TD===null){OQ.push({type:"error",error:t});return}TD.logError(t)}catch{}}var Es=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,PD=new Set,Ix=typeof process==="object"&&!!process?process:{},ID=(e,t,r,o)=>{typeof Ix.emitWarning==="function"?Ix.emitWarning(e,t,r,o):console.error(`[${r}] ${t}: ${e}`)},tg=globalThis.AbortController,ED=globalThis.AbortSignal;if(typeof tg>"u"){ED=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(o,n){this._onabort.push(n)}},tg=class{constructor(){t()}signal=new ED;abort(o){if(this.signal.aborted)return;this.signal.reason=o,this.signal.aborted=!0;for(let n of this.signal._onabort)n(o);this.signal.onabort?.(o)}};let e=Ix.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{if(!e)return;e=!1,ID("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 AQ=(e)=>!PD.has(e),GPe=Symbol("type"),Vn=(e)=>e&&e===Math.floor(e)&&e>0&&isFinite(e),RD=(e)=>!Vn(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?Xl:null;class Xl extends Array{constructor(e){super(e);this.fill(0)}}class Ps{heap;length;static#n=!1;static create(e){let t=RD(e);if(!t)return[];Ps.#n=!0;let r=new Ps(e,t);return Ps.#n=!1,r}constructor(e,t){if(!Ps.#n)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 rg{#n;#d;#g;#h;#$;#O;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#y;#o;#r;#e;#l;#p;#c;#s;#b;#a;#_;#v;#f;#S;#E;#u;static unsafeExposeInternals(e){return{starts:e.#v,ttls:e.#f,sizes:e.#_,keyMap:e.#o,keyList:e.#r,valList:e.#e,next:e.#l,prev:e.#p,get head(){return e.#c},get tail(){return e.#s},free:e.#b,isBackgroundFetch:(t)=>e.#t(t),backgroundFetch:(t,r,o,n)=>e.#M(t,r,o,n),moveToTail:(t)=>e.#R(t),indexes:(t)=>e.#x(t),rindexes:(t)=>e.#w(t),isStale:(t)=>e.#m(t)}}get max(){return this.#n}get maxSize(){return this.#d}get calculatedSize(){return this.#y}get size(){return this.#i}get fetchMethod(){return this.#$}get memoMethod(){return this.#O}get dispose(){return this.#g}get disposeAfter(){return this.#h}constructor(e){let{max:t=0,ttl:r,ttlResolution:o=1,ttlAutopurge:n,updateAgeOnGet:i,updateAgeOnHas:s,allowStale:a,dispose:c,disposeAfter:u,noDisposeOnSet:d,noUpdateTTL:p,maxSize:f=0,maxEntrySize:m=0,sizeCalculation:g,fetchMethod:h,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:x,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:O,ignoreFetchAbort:L}=e;if(t!==0&&!Vn(t))throw TypeError("max option must be a nonnegative integer");let se=t?RD(t):Array;if(!se)throw Error("invalid max value: "+t);if(this.#n=t,this.#d=f,this.maxEntrySize=m||this.#d,this.sizeCalculation=g,this.sizeCalculation){if(!this.#d&&!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.#O=y,h!==void 0&&typeof h!=="function")throw TypeError("fetchMethod must be a function if specified");if(this.#$=h,this.#E=!!h,this.#o=new Map,this.#r=Array(t).fill(void 0),this.#e=Array(t).fill(void 0),this.#l=new se(t),this.#p=new se(t),this.#c=0,this.#s=0,this.#b=Ps.create(t),this.#i=0,this.#y=0,typeof c==="function")this.#g=c;if(typeof u==="function")this.#h=u,this.#a=[];else this.#h=void 0,this.#a=void 0;if(this.#S=!!this.#g,this.#u=!!this.#h,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!O,this.ignoreFetchAbort=!!L,this.maxEntrySize!==0){if(this.#d!==0){if(!Vn(this.#d))throw TypeError("maxSize must be a positive integer if specified")}if(!Vn(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#F()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!x,this.updateAgeOnGet=!!i,this.updateAgeOnHas=!!s,this.ttlResolution=Vn(o)||o===0?o:1,this.ttlAutopurge=!!n,this.ttl=r||0,this.ttl){if(!Vn(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#N()}if(this.#n===0&&this.ttl===0&&this.#d===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#n&&!this.#d){if(AQ("LRU_CACHE_UNBOUNDED"))PD.add("LRU_CACHE_UNBOUNDED"),ID("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",rg)}}getRemainingTTL(e){return this.#o.has(e)?1/0:0}#N(){let e=new Xl(this.#n),t=new Xl(this.#n);this.#f=e,this.#v=t,this.#D=(n,i,s=Es.now())=>{if(t[n]=i!==0?s:0,e[n]=i,i!==0&&this.ttlAutopurge){let a=setTimeout(()=>{if(this.#m(n))this.#k(this.#r[n],"expire")},i+1);if(a.unref)a.unref()}},this.#P=(n)=>{t[n]=e[n]!==0?Es.now():0},this.#T=(n,i)=>{if(e[i]){let s=e[i],a=t[i];if(!s||!a)return;n.ttl=s,n.start=a,n.now=r||o();let c=n.now-a;n.remainingTTL=s-c}};let r=0,o=()=>{let n=Es.now();if(this.ttlResolution>0){r=n;let i=setTimeout(()=>r=0,this.ttlResolution);if(i.unref)i.unref()}return n};this.getRemainingTTL=(n)=>{let i=this.#o.get(n);if(i===void 0)return 0;let s=e[i],a=t[i];if(!s||!a)return 1/0;let c=(r||o())-a;return s-c},this.#m=(n)=>{let i=t[n],s=e[n];return!!s&&!!i&&(r||o())-i>s}}#P=()=>{};#T=()=>{};#D=()=>{};#m=()=>!1;#F(){let e=new Xl(this.#n);this.#y=0,this.#_=e,this.#I=(t)=>{this.#y-=e[t],e[t]=0},this.#j=(t,r,o,n)=>{if(this.#t(r))return 0;if(!Vn(o))if(n){if(typeof n!=="function")throw TypeError("sizeCalculation must be a function");if(o=n(r,t),!Vn(o))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 o},this.#A=(t,r,o)=>{if(e[t]=r,this.#d){let n=this.#d-e[t];while(this.#y>n)this.#C(!0)}if(this.#y+=e[t],o)o.entrySize=r,o.totalCalculatedSize=this.#y}}#I=(e)=>{};#A=(e,t,r)=>{};#j=(e,t,r,o)=>{if(r||o)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#x({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#s;;){if(!this.#z(t))break;if(e||!this.#m(t))yield t;if(t===this.#c)break;else t=this.#p[t]}}*#w({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#c;;){if(!this.#z(t))break;if(e||!this.#m(t))yield t;if(t===this.#s)break;else t=this.#l[t]}}#z(e){return e!==void 0&&this.#o.get(this.#r[e])===e}*entries(){for(let e of this.#x())if(this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e]))yield[this.#r[e],this.#e[e]]}*rentries(){for(let e of this.#w())if(this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e]))yield[this.#r[e],this.#e[e]]}*keys(){for(let e of this.#x()){let t=this.#r[e];if(t!==void 0&&!this.#t(this.#e[e]))yield t}}*rkeys(){for(let e of this.#w()){let t=this.#r[e];if(t!==void 0&&!this.#t(this.#e[e]))yield t}}*values(){for(let e of this.#x())if(this.#e[e]!==void 0&&!this.#t(this.#e[e]))yield this.#e[e]}*rvalues(){for(let e of this.#w())if(this.#e[e]!==void 0&&!this.#t(this.#e[e]))yield this.#e[e]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let r of this.#x()){let o=this.#e[r],n=this.#t(o)?o.__staleWhileFetching:o;if(n===void 0)continue;if(e(n,this.#r[r],this))return this.get(this.#r[r],t)}}forEach(e,t=this){for(let r of this.#x()){let o=this.#e[r],n=this.#t(o)?o.__staleWhileFetching:o;if(n===void 0)continue;e.call(t,n,this.#r[r],this)}}rforEach(e,t=this){for(let r of this.#w()){let o=this.#e[r],n=this.#t(o)?o.__staleWhileFetching:o;if(n===void 0)continue;e.call(t,n,this.#r[r],this)}}purgeStale(){let e=!1;for(let t of this.#w({allowStale:!0}))if(this.#m(t))this.#k(this.#r[t],"expire"),e=!0;return e}info(e){let t=this.#o.get(e);if(t===void 0)return;let r=this.#e[t],o=this.#t(r)?r.__staleWhileFetching:r;if(o===void 0)return;let n={value:o};if(this.#f&&this.#v){let i=this.#f[t],s=this.#v[t];if(i&&s){let a=i-(Es.now()-s);n.ttl=a,n.start=Date.now()}}if(this.#_)n.size=this.#_[t];return n}dump(){let e=[];for(let t of this.#x({allowStale:!0})){let r=this.#r[t],o=this.#e[t],n=this.#t(o)?o.__staleWhileFetching:o;if(n===void 0||r===void 0)continue;let i={value:n};if(this.#f&&this.#v){i.ttl=this.#f[t];let s=Es.now()-this.#v[t];i.start=Math.floor(Date.now()-s)}if(this.#_)i.size=this.#_[t];e.unshift([r,i])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let o=Date.now()-r.start;r.start=Es.now()-o}this.set(t,r.value,r)}}set(e,t,r={}){if(t===void 0)return this.delete(e),this;let{ttl:o=this.ttl,start:n,noDisposeOnSet:i=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:a}=r,{noUpdateTTL:c=this.noUpdateTTL}=r,u=this.#j(e,t,r.size||0,s);if(this.maxEntrySize&&u>this.maxEntrySize){if(a)a.set="miss",a.maxEntrySizeExceeded=!0;return this.#k(e,"set"),this}let d=this.#i===0?void 0:this.#o.get(e);if(d===void 0){if(d=this.#i===0?this.#s:this.#b.length!==0?this.#b.pop():this.#i===this.#n?this.#C(!1):this.#i,this.#r[d]=e,this.#e[d]=t,this.#o.set(e,d),this.#l[this.#s]=d,this.#p[d]=this.#s,this.#s=d,this.#i++,this.#A(d,u,a),a)a.set="add";c=!1}else{this.#R(d);let p=this.#e[d];if(t!==p){if(this.#E&&this.#t(p)){p.__abortController.abort(Error("replaced"));let{__staleWhileFetching:f}=p;if(f!==void 0&&!i){if(this.#S)this.#g?.(f,e,"set");if(this.#u)this.#a?.push([f,e,"set"])}}else if(!i){if(this.#S)this.#g?.(p,e,"set");if(this.#u)this.#a?.push([p,e,"set"])}if(this.#I(d),this.#A(d,u,a),this.#e[d]=t,a){a.set="replace";let f=p&&this.#t(p)?p.__staleWhileFetching:p;if(f!==void 0)a.oldValue=f}}else if(a)a.set="update"}if(o!==0&&!this.#f)this.#N();if(this.#f){if(!c)this.#D(d,o,n);if(a)this.#T(a,d)}if(!i&&this.#u&&this.#a){let p=this.#a,f;while(f=p?.shift())this.#h?.(...f)}return this}pop(){try{while(this.#i){let e=this.#e[this.#c];if(this.#C(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#u&&this.#a){let e=this.#a,t;while(t=e?.shift())this.#h?.(...t)}}}#C(e){let t=this.#c,r=this.#r[t],o=this.#e[t];if(this.#E&&this.#t(o))o.__abortController.abort(Error("evicted"));else if(this.#S||this.#u){if(this.#S)this.#g?.(o,r,"evict");if(this.#u)this.#a?.push([o,r,"evict"])}if(this.#I(t),e)this.#r[t]=void 0,this.#e[t]=void 0,this.#b.push(t);if(this.#i===1)this.#c=this.#s=0,this.#b.length=0;else this.#c=this.#l[t];return this.#o.delete(r),this.#i--,t}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:o}=t,n=this.#o.get(e);if(n!==void 0){let i=this.#e[n];if(this.#t(i)&&i.__staleWhileFetching===void 0)return!1;if(!this.#m(n)){if(r)this.#P(n);if(o)o.has="hit",this.#T(o,n);return!0}else if(o)o.has="stale",this.#T(o,n)}else if(o)o.has="miss";return!1}peek(e,t={}){let{allowStale:r=this.allowStale}=t,o=this.#o.get(e);if(o===void 0||!r&&this.#m(o))return;let n=this.#e[o];return this.#t(n)?n.__staleWhileFetching:n}#M(e,t,r,o){let n=t===void 0?void 0:this.#e[t];if(this.#t(n))return n;let i=new tg,{signal:s}=r;s?.addEventListener("abort",()=>i.abort(s.reason),{signal:i.signal});let a={signal:i.signal,options:r,context:o},c=(g,h=!1)=>{let{aborted:y}=i.signal,v=r.ignoreFetchAbort&&g!==void 0;if(r.status)if(y&&!h){if(r.status.fetchAborted=!0,r.status.fetchError=i.signal.reason,v)r.status.fetchAbortIgnored=!0}else r.status.fetchResolved=!0;if(y&&!v&&!h)return d(i.signal.reason);let x=f;if(this.#e[t]===f)if(g===void 0)if(x.__staleWhileFetching)this.#e[t]=x.__staleWhileFetching;else this.#k(e,"fetch");else{if(r.status)r.status.fetchUpdated=!0;this.set(e,g,a.options)}return g},u=(g)=>{if(r.status)r.status.fetchRejected=!0,r.status.fetchError=g;return d(g)},d=(g)=>{let{aborted:h}=i.signal,y=h&&r.allowStaleOnFetchAbort,v=y||r.allowStaleOnFetchRejection,x=v||r.noDeleteOnFetchRejection,w=f;if(this.#e[t]===f){if(!x||w.__staleWhileFetching===void 0)this.#k(e,"fetch");else if(!y)this.#e[t]=w.__staleWhileFetching}if(v){if(r.status&&w.__staleWhileFetching!==void 0)r.status.returnedStale=!0;return w.__staleWhileFetching}else if(w.__returned===w)throw g},p=(g,h)=>{let y=this.#$?.(e,n,a);if(y&&y instanceof Promise)y.then((v)=>g(v===void 0?void 0:v),h);i.signal.addEventListener("abort",()=>{if(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort){if(g(void 0),r.allowStaleOnFetchAbort)g=(v)=>c(v,!0)}})};if(r.status)r.status.fetchDispatched=!0;let f=new Promise(p).then(c,u),m=Object.assign(f,{__abortController:i,__staleWhileFetching:n,__returned:void 0});if(t===void 0)this.set(e,m,{...a.options,status:void 0}),t=this.#o.get(e);else this.#e[t]=m;return m}#t(e){if(!this.#E)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof tg}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:i=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:a=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:g,forceRefresh:h=!1,status:y,signal:v}=t;if(!this.#E){if(y)y.fetch="get";return this.get(e,{allowStale:r,updateAgeOnGet:o,noDeleteOnStaleGet:n,status:y})}let x={allowStale:r,updateAgeOnGet:o,noDeleteOnStaleGet:n,ttl:i,noDisposeOnSet:s,size:a,sizeCalculation:c,noUpdateTTL:u,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:m,ignoreFetchAbort:f,status:y,signal:v},w=this.#o.get(e);if(w===void 0){if(y)y.fetch="miss";let O=this.#M(e,w,x,g);return O.__returned=O}else{let O=this.#e[w];if(this.#t(O)){let Ft=r&&O.__staleWhileFetching!==void 0;if(y){if(y.fetch="inflight",Ft)y.returnedStale=!0}return Ft?O.__staleWhileFetching:O.__returned=O}let L=this.#m(w);if(!h&&!L){if(y)y.fetch="hit";if(this.#R(w),o)this.#P(w);if(y)this.#T(y,w);return O}let se=this.#M(e,w,x,g),Ye=se.__staleWhileFetching!==void 0&&r;if(y){if(y.fetch=L?"stale":"refresh",Ye&&L)y.returnedStale=!0}return Ye?se.__staleWhileFetching:se.__returned=se}}async forceFetch(e,t={}){let r=await this.fetch(e,t);if(r===void 0)throw Error("fetch() returned undefined");return r}memo(e,t={}){let r=this.#O;if(!r)throw Error("no memoMethod provided to constructor");let{context:o,forceRefresh:n,...i}=t,s=this.get(e,i);if(!n&&s!==void 0)return s;let a=r(e,s,{options:i,context:o});return this.set(e,a,i),a}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:i}=t,s=this.#o.get(e);if(s!==void 0){let a=this.#e[s],c=this.#t(a);if(i)this.#T(i,s);if(this.#m(s)){if(i)i.get="stale";if(!c){if(!n)this.#k(e,"expire");if(i&&r)i.returnedStale=!0;return r?a:void 0}else{if(i&&r&&a.__staleWhileFetching!==void 0)i.returnedStale=!0;return r?a.__staleWhileFetching:void 0}}else{if(i)i.get="hit";if(c)return a.__staleWhileFetching;if(this.#R(s),o)this.#P(s);return a}}else if(i)i.get="miss"}#U(e,t){this.#p[t]=e,this.#l[e]=t}#R(e){if(e!==this.#s){if(e===this.#c)this.#c=this.#l[e];else this.#U(this.#p[e],this.#l[e]);this.#U(this.#s,e),this.#s=e}}delete(e){return this.#k(e,"delete")}#k(e,t){let r=!1;if(this.#i!==0){let o=this.#o.get(e);if(o!==void 0)if(r=!0,this.#i===1)this.#L(t);else{this.#I(o);let n=this.#e[o];if(this.#t(n))n.__abortController.abort(Error("deleted"));else if(this.#S||this.#u){if(this.#S)this.#g?.(n,e,t);if(this.#u)this.#a?.push([n,e,t])}if(this.#o.delete(e),this.#r[o]=void 0,this.#e[o]=void 0,o===this.#s)this.#s=this.#p[o];else if(o===this.#c)this.#c=this.#l[o];else{let i=this.#p[o];this.#l[i]=this.#l[o];let s=this.#l[o];this.#p[s]=this.#p[o]}this.#i--,this.#b.push(o)}}if(this.#u&&this.#a?.length){let o=this.#a,n;while(n=o?.shift())this.#h?.(...n)}return r}clear(){return this.#L("delete")}#L(e){for(let t of this.#w({allowStale:!0})){let r=this.#e[t];if(this.#t(r))r.__abortController.abort(Error("deleted"));else{let o=this.#r[t];if(this.#S)this.#g?.(r,o,e);if(this.#u)this.#a?.push([r,o,e])}}if(this.#o.clear(),this.#e.fill(void 0),this.#r.fill(void 0),this.#f&&this.#v)this.#f.fill(0),this.#v.fill(0);if(this.#_)this.#_.fill(0);if(this.#c=0,this.#s=0,this.#b.length=0,this.#y=0,this.#i=0,this.#u&&this.#a){let t=this.#a,r;while(r=t?.shift())this.#h?.(...r)}}}function $D(e,t,r=100){let o=new rg({max:r}),n=(...i)=>{let s=t(...i),a=o.get(s);if(a!==void 0)return a;let c=e(...i);return o.set(s,c),c};return n.cache={clear:()=>o.clear(),size:()=>o.size,delete:(i)=>o.delete(i),get:(i)=>o.peek(i),has:(i)=>o.has(i)},n}var CQ=8192;function AD(e,t){try{return{ok:!0,value:JSON.parse(Qm(e))}}catch(r){if(t)eg(r);return{ok:!1}}}var OD=$D(AD,(e)=>e,50);var Is=Object.assign(function(t,r=!0){if(!t)return null;let o=t.length>CQ?AD(t,r):OD(t,r);return o.ok?o.value:null},{cache:OD.cache});import{join as NQ}from"path";import{readdir as fIe,readFile as MQ}from"fs/promises";import{release as CD}from"os";var Bo=Ce(()=>{try{if(process.platform==="darwin")return"macos";if(process.platform==="win32")return"windows";if(process.platform==="linux"){if(process.env.WSL_DISTRO_NAME||process.env.WSL_INTEROP)return"wsl";try{let e=Fe().readFileSync("/proc/version",{encoding:"utf8"});if(e.toLowerCase().includes("microsoft")||e.toLowerCase().includes("wsl"))return"wsl"}catch(e){ne(`Failed to read /proc/version for WSL detection: ${e}`,{level:"error"})}return"linux"}return"unknown"}catch(e){return eg(e),"unknown"}}),_Ie=Ce(()=>{if(process.platform!=="linux")return;try{let e=Fe().readFileSync("/proc/version",{encoding:"utf8"}),t=e.match(/WSL(\d+)/i);if(t&&t[1])return t[1];if(e.toLowerCase().includes("microsoft"))return"1";return}catch(e){ne(`Failed to read /proc/version for WSL detection: ${e}`,{level:"error"});return}}),vIe=Ce(async()=>{if(process.platform!=="linux")return;let e={linuxKernel:CD()};try{let t=await MQ("/etc/os-release","utf8");for(let r of t.split(`
115
- `)){let o=r.match(/^(ID|VERSION_ID)=(.*)$/);if(o&&o[1]&&o[2]){let n=o[2].replace(/^"|"$/g,"");if(o[1]==="ID")e.linuxDistroId=n;else e.linuxDistroVersion=n}}}catch{}return e});var SIe=Ce(()=>{if(process.platform!=="darwin")return;let t=CD().match(/^(\d+)\./);if(!t||!t[1])return;return parseInt(t[1],10)-9});var qo=Ce(function(){switch(Bo()){case"macos":return"/Library/Application Support/ClaudeCode";case"windows":return"C:\\Program Files\\ClaudeCode";default:return"/etc/claude-code"}}),EIe=Ce(function(){return NQ(qo(),"managed-settings.d")});import{isAbsolute as MD}from"path";var DQ=I(()=>l.object({allowedDomains:l.array(l.string()).optional(),deniedDomains:l.array(l.string()).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."),allowManagedDomainsOnly:l.boolean().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:l.array(l.string()).optional().describe("macOS only: Unix socket paths to allow. Ignored on Linux (seccomp cannot filter by path)."),allowAllUnixSockets:l.boolean().optional().describe("If true, allow all Unix sockets (disables blocking on both platforms)."),allowLocalBinding:l.boolean().optional(),allowMachLookup:l.array(l.string().refine((e)=>{return!(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:l.number().optional(),socksProxyPort:l.number().optional(),tlsTerminate:l.object({caCertPath:l.string().min(1).optional(),caKeyPath:l.string().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.")}).optional()),jQ=I(()=>l.object({allowWrite:l.array(l.string()).optional().describe("Additional paths to allow writing within the sandbox. Merged with paths from Edit(...) allow permission rules."),denyWrite:l.array(l.string()).optional().describe("Additional paths to deny writing within the sandbox. Merged with paths from Edit(...) deny permission rules."),denyRead:l.array(l.string()).optional().describe("Additional paths to deny reading within the sandbox. Merged with paths from Read(...) deny permission rules."),allowRead:l.array(l.string()).optional().describe("Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths."),allowManagedReadPathsOnly:l.boolean().optional().describe("When true (set in managed settings), only allowRead paths from policySettings are used.")}).optional()),ND=I(()=>l.object({enabled:l.boolean().optional(),failIfUnavailable:l.boolean().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:l.boolean().optional(),allowUnsandboxedCommands:l.boolean().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:DQ(),filesystem:jQ(),ignoreViolations:l.record(l.string(),l.array(l.string())).optional(),enableWeakerNestedSandbox:l.boolean().optional(),enableWeakerNetworkIsolation:l.boolean().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"),excludedCommands:l.array(l.string()).optional(),ripgrep:l.object({command:l.string(),args:l.array(l.string()).optional()}).optional().describe("Custom ripgrep configuration for bundled ripgrep support"),bwrapPath:l.preprocess((e)=>typeof e==="string"&&MD(e)?e:void 0,l.string()).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:l.preprocess((e)=>typeof e==="string"&&MD(e)?e:void 0,l.string()).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 DD=["auto","iterm2","iterm2_with_bell","terminal_bell","kitty","ghostty","notifications_disabled"],jD=["normal","vim"],zD=["auto","tmux","in-process"],zQ=["dark","light","light-daltonized","dark-daltonized","light-ansi","dark-ansi"],UD=["auto",...zQ];var MIe=Bo()==="macos"?"⏺":"●";var Yl=["acceptEdits","auto","bypassPermissions","default","dontAsk","plan"],UQ=[...Yl,"bubble"],LD=UQ;var HIe=I(()=>Lv.enum(LD)),BIe=I(()=>Lv.enum(Yl));var FD=["bash","powershell"];var Ql=I(()=>l.string().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 LQ(){let e=l.object({type:l.literal("command").describe("Shell command hook type"),command:l.string().describe("Shell command to execute"),args:l.array(l.string()).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:Ql(),shell:l.enum(FD).optional().describe("Shell interpreter. 'bash' uses your $SHELL (bash/zsh/sh); 'powershell' uses pwsh. Defaults to bash (powershell on Windows without Git Bash)."),timeout:l.number().positive().optional().describe("Timeout in seconds for this specific command"),statusMessage:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution"),async:l.boolean().optional().describe("If true, hook runs in background without blocking"),asyncRewake:l.boolean().optional().describe("If true, hook runs in background and wakes the model on exit code 2 (blocking error). Implies async."),rewakeMessage:l.string().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:l.string().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".')}),t=l.object({type:l.literal("prompt").describe("LLM prompt hook type"),prompt:l.string().describe("Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON."),if:Ql(),timeout:l.number().positive().optional().describe("Timeout in seconds for this specific prompt evaluation"),model:l.string().optional().describe('Model to use for this prompt hook (e.g., "claude-sonnet-4-6"). If not specified, uses the default small fast model.'),continueOnBlock:l.boolean().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:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution")}),r=l.object({type:l.literal("mcp_tool").describe("MCP tool hook type"),server:l.string().describe("Name of an already-configured MCP server to invoke"),tool:l.string().describe("Name of the tool on that server to call"),input:l.record(l.string(),l.unknown()).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:Ql(),timeout:l.number().positive().optional().describe("Timeout in seconds for this specific tool call"),statusMessage:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution")}),o=l.object({type:l.literal("http").describe("HTTP hook type"),url:l.string().url().describe("URL to POST the hook input JSON to"),if:Ql(),timeout:l.number().positive().optional().describe("Timeout in seconds for this specific request"),headers:l.record(l.string(),l.string()).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:l.array(l.string()).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:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution")}),n=l.object({type:l.literal("agent").describe("Agentic verifier hook type"),prompt:l.string().describe('Prompt describing what to verify (e.g. "Verify that unit tests ran and passed."). Use $ARGUMENTS placeholder for hook input JSON.'),if:Ql(),timeout:l.number().positive().optional().describe("Timeout in seconds for agent execution (default 60)"),model:l.string().optional().describe('Model to use for this agent hook (e.g., "claude-sonnet-4-6"). If not specified, uses Haiku.'),statusMessage:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution")});return{BashCommandHookSchema:e,PromptHookSchema:t,HttpHookSchema:o,AgentHookSchema:n,McpToolHookSchema:r}}var HD=I(()=>{let{BashCommandHookSchema:e,PromptHookSchema:t,AgentHookSchema:r,HttpHookSchema:o,McpToolHookSchema:n}=LQ();return l.discriminatedUnion("type",[e,t,r,o,n])}),BD=I(()=>l.object({matcher:l.string().optional().describe('String pattern to match (e.g. tool names like "Write")'),hooks:l.array(HD()).describe("List of hooks to execute when the matcher matches")})),Zo=I(()=>l.partialRecord(l.enum(Xo),l.array(BD())));var QIe=I(()=>l.enum(["local","user","project","dynamic","enterprise","claudeai","managed","agent"])),e0e=I(()=>l.enum(["stdio","sse","sse-ide","http","ws","sdk"])),Rs=I(()=>l.literal("comms").optional().catch(void 0)),Wn=I(()=>l.number().int().positive()),FQ=I(()=>l.object({type:l.literal("stdio").optional(),command:l.string().min(1,"Command cannot be empty"),args:l.array(l.string()).default([]),env:l.record(l.string(),l.string()).optional(),timeout:Wn().optional(),alwaysLoad:l.boolean().optional(),role:Rs()})),HQ=I(()=>l.boolean()),qD=I(()=>l.object({clientId:l.string().optional(),callbackPort:l.number().int().positive().optional(),authServerMetadataUrl:l.string().url().startsWith("https://",{message:"authServerMetadataUrl must use https://"}).optional(),scopes:l.string().min(1).optional(),xaa:HQ().optional()})),BQ=I(()=>l.object({type:l.literal("sse"),url:l.string(),headers:l.record(l.string(),l.string()).optional(),headersHelper:l.string().optional(),oauth:qD().optional(),timeout:Wn().optional(),alwaysLoad:l.boolean().optional(),role:Rs()})),qQ=I(()=>l.object({type:l.literal("sse-ide"),url:l.string(),ideName:l.string(),ideRunningInWindows:l.boolean().optional(),timeout:Wn().optional(),alwaysLoad:l.boolean().optional(),role:Rs()})),ZQ=I(()=>l.object({type:l.literal("ws-ide"),url:l.string(),ideName:l.string(),authToken:l.string().optional(),ideRunningInWindows:l.boolean().optional(),timeout:Wn().optional(),alwaysLoad:l.boolean().optional(),role:Rs()})),VQ=I(()=>l.object({type:l.enum(["http","streamable-http"]).transform(()=>"http"),url:l.string(),headers:l.record(l.string(),l.string()).optional(),headersHelper:l.string().optional(),oauth:qD().optional(),timeout:Wn().optional(),alwaysLoad:l.boolean().optional(),role:Rs()})),WQ=I(()=>l.object({type:l.literal("ws"),url:l.string(),headers:l.record(l.string(),l.string()).optional(),headersHelper:l.string().optional(),timeout:Wn().optional(),alwaysLoad:l.boolean().optional(),role:Rs()})),KQ=I(()=>l.object({type:l.literal("sdk"),name:l.string(),timeout:Wn().optional(),alwaysLoad:l.boolean().optional()})),GQ=I(()=>l.enum(["allow","ask","blocked"])),JQ=I(()=>l.object({type:l.literal("claudeai-proxy"),url:l.string(),id:l.string(),timeout:Wn().optional(),alwaysLoad:l.boolean().optional(),toolPermissions:l.record(l.string(),GQ()).optional()})),ng=I(()=>l.union([FQ(),BQ(),qQ(),ZQ(),VQ(),WQ(),KQ(),JQ()])),t0e=I(()=>l.object({mcpServers:l.record(l.string(),ng())}));var KD=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"]);var XQ=/(?:official[^a-z0-9]*(anthropic|claude)|(?:anthropic|claude)[^a-z0-9]*official|^(?:anthropic|claude)[^a-z0-9]*(marketplace|plugins|official))/i,YQ=/[^\u0020-\u007E]/;function QQ(e){if(KD.has(e.toLowerCase()))return!1;if(YQ.test(e))return!0;return XQ.test(e)}var Sr=I(()=>l.string().startsWith("./")),Vo=I(()=>Sr().endsWith(".json")),ZD=I(()=>l.union([Sr().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"),l.string().url().refine((e)=>e.endsWith(".mcpb")||e.endsWith(".dxt"),{message:"MCPB URL must end with .mcpb or .dxt"}).describe("URL to MCPB file")])),$x=I(()=>Sr().endsWith(".md")),Ox=I(()=>l.union([$x(),Sr()])),GD=I(()=>l.string().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)=>!QQ(e),{message:"Marketplace name impersonates an official Anthropic/Claude marketplace"}).refine((e)=>e.toLowerCase()!=="inline",{message:'Marketplace name "inline" is reserved for --plugin-dir session plugins'}).refine((e)=>e.toLowerCase()!=="builtin",{message:'Marketplace name "builtin" is reserved for built-in plugins'}).refine((e)=>e.toLowerCase()!=="skills-dir",{message:'Marketplace name "skills-dir" is reserved for plugins auto-loaded from .claude/skills/'})),Ax=I(()=>l.object({name:l.string().min(1,"Author name cannot be empty").describe("Display name of the plugin author or organization"),email:l.string().optional().describe("Contact email for support or feedback"),url:l.string().optional().describe("Website, GitHub profile, or organization URL")})),eee=I(()=>l.object({$schema:l.string().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:l.string().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:l.string().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:l.string().optional().describe("Semantic version (e.g., 1.2.3) following semver.org specification"),description:l.string().optional().describe("Brief, user-facing explanation of what the plugin provides"),author:Ax().optional().describe("Information about the plugin creator or maintainer"),homepage:l.string().url().optional().describe("Plugin homepage or documentation URL"),repository:l.string().optional().describe("Source code repository URL"),license:l.string().optional().describe("SPDX license identifier (e.g., MIT, Apache-2.0)"),keywords:l.array(l.string()).optional().describe("Tags for plugin discovery and categorization"),defaultEnabled:l.boolean().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:l.array(kee()).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.`)})),l0e=I(()=>l.object({description:l.string().optional().describe("Brief, user-facing explanation of what these hooks provide"),hooks:l.lazy(()=>Zo()).describe("The hooks provided by the plugin, in the same format as the one used for settings")})),tee=I(()=>l.object({hooks:l.union([Vo().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),l.lazy(()=>Zo()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)"),l.array(l.union([Vo().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),l.lazy(()=>Zo()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)")]))])})),ree=I(()=>l.object({source:Ox().optional().describe("Path to command markdown file, relative to plugin root"),content:l.string().optional().describe("Inline markdown content for the command"),description:l.string().optional().describe("Command description override"),argumentHint:l.string().optional().describe('Hint for command arguments (e.g., "[file]")'),model:l.string().optional().describe("Default model for this command"),allowedTools:l.array(l.string()).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'})),nee=I(()=>l.object({commands:l.union([Ox().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."),l.array(Ox().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."),l.record(l.string(),ree()).describe('Object mapping of command names to their metadata and source files. Command name becomes the slash command name (e.g., "about" → "/plugin:about")')])})),oee=I(()=>l.object({agents:l.union([$x().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."),l.array($x().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.")])})),iee=I(()=>l.object({skills:l.union([Sr().describe("Path to a skill directory, relative to the plugin root. Loaded in addition to the skills/ directory."),l.array(Sr().describe("Path to a skill directory, relative to the plugin root. Loaded in addition to the skills/ directory.")).describe("List of skill directory paths, loaded in addition to the skills/ directory.")])})),JD=I(()=>l.object({outputStyles:l.union([Sr().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."),l.array(Sr().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.")])})),XD=I(()=>l.object({themes:l.union([Sr().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."),l.array(Sr().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.")])})),see=I(()=>l.object({})),VD=I(()=>l.string().min(1)),aee=I(()=>l.string().min(2).refine((e)=>e.startsWith("."),{message:'File extensions must start with dot (e.g., ".ts", not "ts")'})),cee=I(()=>l.object({mcpServers:l.union([Vo().describe("MCP servers to include in the plugin (in addition to those in the .mcp.json file, if it exists)"),ZD().describe("Path or URL to MCPB file containing MCP server configuration"),l.record(l.string(),ng()).describe("MCP server configurations keyed by server name"),l.array(l.union([Vo().describe("Path to MCP servers configuration file"),ZD().describe("Path or URL to MCPB file"),l.record(l.string(),ng()).describe("Inline MCP server configurations")])).describe("Array of MCP server configurations (paths, MCPB files, or inline definitions)")])})),YD=I(()=>l.object({type:l.enum(["string","number","boolean","directory","file"]).describe("Type of the configuration value"),title:l.string().describe("Human-readable label shown in the config dialog"),description:l.string().describe("Help text shown beneath the field in the config dialog"),required:l.boolean().optional().describe("If true, validation fails when this field is empty"),default:l.union([l.string(),l.number(),l.boolean(),l.array(l.string())]).optional().describe("Default value used when the user provides nothing"),multiple:l.boolean().optional().describe("For string type: allow an array of strings"),sensitive:l.boolean().optional().describe("If true, masks dialog input and stores value in secure storage (keychain/credentials file) instead of settings.json"),min:l.number().optional().describe("Minimum value (number type only)"),max:l.number().optional().describe("Maximum value (number type only)")}).strict()),lee=I(()=>l.object({userConfig:l.record(l.string().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"),YD()).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.")})),uee=I(()=>l.object({channels:l.array(l.object({server:l.string().min(1).describe("Name of the MCP server this channel binds to. Must match a key in this plugin's mcpServers."),displayName:l.string().optional().describe('Human-readable name shown in the config dialog title (e.g., "Telegram"). Defaults to the server name.'),userConfig:l.record(l.string(),YD()).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.")})),WD=I(()=>l.strictObject({command:l.string().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:l.array(VD()).optional().describe("Command-line arguments to pass to the server"),extensionToLanguage:l.record(aee(),VD()).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:l.enum(["stdio","socket"]).default("stdio").describe("Communication transport mechanism"),env:l.record(l.string(),l.string()).optional().describe("Environment variables to set when starting the server"),initializationOptions:l.unknown().optional().describe("Initialization options passed to the server during initialization"),settings:l.unknown().optional().describe("Settings passed to the server via workspace/didChangeConfiguration"),workspaceFolder:l.string().optional().describe("Workspace folder path to use for the server"),startupTimeout:l.number().int().positive().optional().describe("Maximum time to wait for server startup (milliseconds)"),shutdownTimeout:l.number().int().positive().optional().describe("Maximum time to wait for graceful shutdown (milliseconds)"),restartOnCrash:l.boolean().optional().describe("Whether to restart the server if it crashes"),maxRestarts:l.number().int().nonnegative().optional().describe("Maximum number of restart attempts before giving up")})),dee=I(()=>l.strictObject({name:l.string().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:l.string().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:l.string().min(1).describe("Short human-readable description of what is being monitored (shown in task panel and notification summary)."),when:l.union([l.literal("always"),l.string().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).')})),pee=I(()=>l.array(dee()).refine((e)=>new Set(e.map((t)=>t.name)).size===e.length,{message:"Monitor names must be unique within a plugin"})),QD=I(()=>l.object({monitors:l.union([Vo().describe("Path to a JSON file containing the monitors array, relative to the plugin root"),pee()]).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.")})),fee=I(()=>l.object({lspServers:l.union([Vo().describe("Path to .lsp.json configuration file relative to plugin root"),l.record(l.string(),WD()).describe("LSP server configurations keyed by server name"),l.array(l.union([Vo().describe("Path to LSP configuration file"),l.record(l.string(),WD()).describe("Inline LSP server configurations")])).describe("Array of LSP server configurations (paths or inline definitions)")])})),ej=I(()=>l.string().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-._]*$/,r=/^[a-z0-9][a-z0-9-._]*$/;return t.test(e)||r.test(e)},"Invalid npm package name format")),mee=I(()=>l.object({settings:l.record(l.string(),l.unknown()).optional().describe("Settings to merge into the user settings while this plugin is enabled. Only the documented allowlisted keys are applied.")})),gee=I(()=>l.object({experimental:l.preprocess((e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?e:void 0,l.object({...XD().partial().shape,...QD().partial().shape,...JD().partial().shape,evals:l.union([l.string(),l.array(l.string())]).optional().describe("Path(s) to evaluation query files for `claude plugin eval`. Defaults to `evals/`.")}).optional().describe("Components whose manifest shape may change without a deprecation cycle. Move a key out of here once it is promoted to stable."))})),hee=I(()=>l.object({...eee().shape,...tee().partial().shape,...nee().partial().shape,...oee().partial().shape,...iee().partial().shape,...JD().partial().shape,...XD().partial().shape,...see().shape,...uee().partial().shape,...cee().partial().shape,...fee().partial().shape,...QD().partial().shape,...mee().partial().shape,...lee().partial().shape,...gee().partial().shape})),eu=I(()=>l.discriminatedUnion("source",[l.object({source:l.literal("url"),url:l.string().url().describe("Direct URL to marketplace.json file"),headers:l.record(l.string(),l.string()).optional().describe("Custom HTTP headers (e.g., for authentication)")}),l.object({source:l.literal("github"),repo:l.string().describe("GitHub repository in owner/repo format"),ref:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:l.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:l.array(l.string()).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:l.boolean().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.")}),l.object({source:l.literal("git"),url:l.string().describe("Full git repository URL"),ref:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:l.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:l.array(l.string()).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:l.boolean().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.")}),l.object({source:l.literal("npm"),package:ej().describe("NPM package containing marketplace.json")}),l.object({source:l.literal("file"),path:l.string().describe("Local file path to marketplace.json")}),l.object({source:l.literal("directory"),path:l.string().describe("Local directory containing .claude-plugin/marketplace.json")}),l.object({source:l.literal("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."),l.object({source:l.literal("hostPattern"),hostPattern:l.string().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$").')}),l.object({source:l.literal("pathPattern"),pathPattern:l.string().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.')}),l.object({source:l.literal("settings"),name:GD().refine((e)=>!KD.has(e.toLowerCase()),{message:"Reserved official 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:l.array(yee()).describe("Plugin entries declared inline in settings.json"),owner:Ax().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).")])),Rx=I(()=>l.string().length(40).regex(/^[a-f0-9]{40}$/,"Must be a full 40-character lowercase git commit SHA")),tj=I(()=>l.union([l.preprocess((e)=>e==="."?"./":e,Sr()).describe("Path to the plugin root, relative to the marketplace root (the directory containing .claude-plugin/, not .claude-plugin/ itself)"),l.object({source:l.literal("npm"),package:ej().or(l.string().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:l.string().optional().describe("Specific version or version range (e.g., ^1.0.0, ~2.1.0)"),registry:l.string().url().optional().describe("Custom NPM registry URL (defaults to using system default, likely npmjs.org)")}).describe("NPM package as plugin source"),l.object({source:l.literal("url"),url:l.string().describe("Full git repository URL (https:// or git@)"),ref:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Rx().optional().describe("Specific commit SHA to use")}),l.object({source:l.literal("github"),repo:l.string().describe("GitHub repository in owner/repo format"),ref:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Rx().optional().describe("Specific commit SHA to use")}),l.object({source:l.literal("git-subdir"),url:l.string().describe("Git repository: GitHub owner/repo shorthand, https://, or git@ URL"),path:l.string().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:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:Rx().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."),l.object({source:l.literal("unsupported")}).describe("Placeholder for source types this Claude Code version does not "+"recognize. 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 a clear "update Claude Code" message.')])),yee=I(()=>l.object({name:l.string().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:tj().describe("Where to fetch the plugin from. Must be a remote source — relative "+"paths have no marketplace repository to resolve against."),description:l.string().optional(),version:l.string().optional(),strict:l.boolean().optional()}).refine((e)=>typeof e.source!=="string",{message:'Plugins in a settings-sourced marketplace must use remote sources (github, git-subdir, npm, url). 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)."}));var bee=I(()=>l.object({cli:l.array(l.string().max(64)).max(10).optional().describe('First command tokens (e.g. ["stripe"]) — exact match against commands run this session.'),hosts:l.array(l.string().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:l.array(l.string().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:l.array(l.object({file:l.string().max(256),pattern:l.string().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:l.array(l.string().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.`)})),_ee=I(()=>l.object({topic:l.string().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:bee().optional().describe("Matchers that determine when the plugin is relevant.")})),vee=I(()=>hee().partial().extend({name:l.string().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:tj().describe("Where to fetch the plugin from"),category:l.string().optional().describe('Category for organizing plugins (e.g., "productivity", "development")'),tags:l.array(l.string()).optional().describe("Tags for searchability and discovery"),strict:l.boolean().optional().default(!0).describe("Require the plugin manifest to be present in the plugin folder. If false, the marketplace entry provides the manifest."),relevance:l.preprocess((e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?e:void 0,_ee().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.`)})),See=I(()=>l.object({name:l.string().min(1).refine((e)=>!e.includes(" "))}));function xee(e){let t=vee();return e.flatMap((r,o)=>{let n=t.safeParse(r);if(n.success)return[n.data];let i=See().safeParse(r).data?.name,s=n.error.issues.map((a)=>`${a.path.join(".")}: ${a.message}`).join(", ");if(i)return ne(`Stubbing unparseable marketplace plugin entry (${i}): ${s}`,{level:"warn"}),[{name:i,source:{source:"unsupported"},strict:!0}];return ne(`Dropping unparseable marketplace plugin entry (index ${o}): ${s}`,{level:"warn"}),[]})}var u0e=I(()=>l.object({$schema:l.string().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:GD(),version:l.string().optional().describe("Marketplace manifest version"),description:l.string().optional().describe("Human-readable description of this marketplace"),owner:Ax().describe("Marketplace maintainer or curator information"),plugins:l.array(l.unknown()).transform(xee).describe("Collection of available plugins in this marketplace"),forceRemoveDeletedPlugins:l.boolean().optional().describe("When true, plugins removed from this marketplace will be automatically uninstalled and flagged for users"),metadata:l.object({pluginRoot:l.string().optional().describe("Base path for relative plugin sources"),version:l.string().optional().describe("Marketplace version"),description:l.string().optional().describe("Marketplace description")}).optional().describe("Optional marketplace metadata"),allowCrossMarketplaceDependenciesOn:l.array(l.string()).optional().describe("Marketplace names whose plugins may be auto-installed as dependencies. Only the root marketplace's allowlist applies — no transitive trust.")})),rj=I(()=>l.string().regex(/^[A-Za-z0-9][-A-Za-z0-9._]*@[A-Za-z0-9][-A-Za-z0-9._]*$/,"Plugin ID must be in format: plugin@marketplace")),wee=/^[A-Za-z0-9][-A-Za-z0-9._]*(@[A-Za-z0-9][-A-Za-z0-9._]*)?(@\^[^@]*)?$/,kee=I(()=>l.union([l.string().regex(wee,"Dependency must be a plugin name, optionally qualified with @marketplace").transform((e)=>e.replace(/@\^[^@]*$/,"")),l.object({name:l.string().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/),marketplace:l.string().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/).optional()}).loose().transform((e)=>e.marketplace?`${e.name}@${e.marketplace}`:e.name)])),Tee=I(()=>l.object({version:l.string().describe("Currently installed version"),installedAt:l.string().describe("ISO 8601 timestamp of installation"),lastUpdated:l.string().optional().describe("ISO 8601 timestamp of last update"),installPath:l.string().describe("Absolute path to the installed plugin directory"),gitCommitSha:l.string().optional().describe("Git commit SHA for git-based plugins (for version tracking)"),resolvedVersion:l.string().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:l.boolean().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).")})),Eee=I(()=>l.object({version:l.literal(1).describe("Schema version 1"),plugins:l.record(rj(),Tee()).describe("Map of plugin IDs to their installation metadata")})),Pee=I(()=>l.enum(["managed","user","project","local"])),Iee=I(()=>l.object({scope:Pee().describe("Installation scope"),projectPath:l.string().optional().describe("Project path (required for project/local scopes)"),installPath:l.string().describe("Absolute path to the versioned plugin directory"),version:l.string().optional().describe("Currently installed version"),installedAt:l.string().optional().describe("ISO 8601 timestamp of installation"),lastUpdated:l.string().optional().describe("ISO 8601 timestamp of last update"),gitCommitSha:l.string().optional().describe("Git commit SHA for git-based plugins"),resolvedVersion:l.string().optional().describe("Tag-derived semver this install resolved to"),auto:l.boolean().optional().describe("True when pulled in as a dependency. Eligible for orphan sweep.")})),Ree=I(()=>l.object({version:l.literal(2).describe("Schema version 2"),plugins:l.record(rj(),l.array(Iee())).describe("Map of plugin IDs to arrays of installation entries")})),d0e=I(()=>l.union([Eee(),Ree()])),$ee=I(()=>l.object({source:eu().describe("Where to fetch the marketplace from"),installLocation:l.string().describe("Local cache path where marketplace manifest is stored"),lastUpdated:l.string().describe("ISO 8601 timestamp of last marketplace refresh"),autoUpdate:l.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),p0e=I(()=>l.record(l.string(),$ee()));var nj=["userSettings","projectSettings","localSettings","flagSettings","policySettings"];var oj="https://json.schemastore.org/claude-code-settings.json";var Oee=["autoMode","deepLink","voice","assistant","briefView"],og={},ig={autoMode:{buildGate:()=>!1,shape:()=>og,permissionsShape:()=>og,permissionModes:()=>[]},deepLink:{buildGate:()=>!0,shape:()=>({disableDeepLinkRegistration:l.enum(["disable"]).optional().describe("Prevent claude-cli:// protocol handler registration with the OS")})},voice:{buildGate:()=>!1,shape:()=>og},assistant:{buildGate:()=>!1,shape:()=>og},briefView:{buildGate:()=>!0,shape:()=>({defaultView:l.enum(["chat","transcript"]).optional().describe("Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)")})}};function Cx(){return Oee.filter((e)=>ig[e].buildGate())}function ij(e){let t={};for(let r of e)t={...t,...ig[r].shape()};return t}function sj(e){let t={};for(let r of e)t={...t,...ig[r].permissionsShape?.()};return t}function aj(e){let t=[];for(let r of e)t.push(...ig[r].permissionModes?.()??[]);return t}function cj(e){let t=e.split("__"),[r,o,...n]=t;if(r!=="mcp"||!o)return null;let i=n.length>0?n.join("__"):void 0;return{serverName:o,toolName:i}}var lj={Task:"Agent",KillShell:"TaskStop",KillBash:"TaskStop",AgentOutputTool:"TaskOutput",BashOutputTool:"TaskOutput",AgentOutput:"TaskOutput",BashOutput:"TaskOutput",ListPeers:"ListAgents",Brief:"SendUserMessage",ListMcpResources:"ListMcpResourcesTool",ReadMcpResource:"ReadMcpResourceTool"};function $s(e){return Object.hasOwn(lj,e)?lj[e]:e}var uj="workspace",E0e=`mcp__${uj}__bash`,P0e=`mcp__${uj}__web_fetch`;function Aee(e){return e.replaceAll("\\(","(").replaceAll("\\)",")").replaceAll("\\\\","\\")}function dj(e){let t=Cee(e,"(");if(t===-1)return{toolName:$s(e)};let r=Mee(e,")");if(r===-1||r<=t)return{toolName:$s(e)};if(r!==e.length-1)return{toolName:$s(e)};let o=e.substring(0,t),n=e.substring(t+1,r);if(!o)return{toolName:$s(e)};if(n===""||n==="*")return{toolName:$s(o)};let i=Aee(n);return{toolName:$s(o),ruleContent:i}}function Cee(e,t){for(let r=0;r<e.length;r++)if(e[r]===t){let o=0,n=r-1;while(n>=0&&e[n]==="\\")o++,n--;if(o%2===0)return r}return-1}function Mee(e,t){for(let r=e.length-1;r>=0;r--)if(e[r]===t){let o=0,n=r-1;while(n>=0&&e[n]==="\\")o++,n--;if(o%2===0)return r}return-1}var sg={filePatternTools:["Read","Write","Edit","Glob","NotebookRead","NotebookEdit"],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 pj(e){return sg.filePatternTools.includes(e)}function fj(e){return sg.bashPrefixTools.includes(e)}function mj(e){return Object.hasOwn(sg.customValidation,e)?sg.customValidation[e]:void 0}function gj(e,t){let r=0,o=t-1;while(o>=0&&e[o]==="\\")r++,o--;return r%2!==0}function Mx(e,t){let r=0;for(let o=0;o<e.length;o++)if(e[o]===t&&!gj(e,o))r++;return r}function Nee(e){for(let t=0;t<e.length-1;t++)if(e[t]==="("&&e[t+1]===")"){if(!gj(e,t))return!0}return!1}function Nx(e){if(!e||e.trim()==="")return{valid:!1,error:"Permission rule cannot be empty"};let t=Mx(e,"("),r=Mx(e,")");if(t!==r)return{valid:!1,error:"Mismatched parentheses",suggestion:"Ensure all opening parentheses have matching closing parentheses"};if(Nee(e)){let s=e.substring(0,e.indexOf("("));if(!s)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 "${s}" without parentheses`,examples:[`${s}`,`${s}(some-pattern)`]}}let o=dj(e),n=cj(o.toolName);if(n){if(o.ruleContent!==void 0||Mx(e,"(")>0)return{valid:!1,error:"MCP rules do not support patterns in parentheses",suggestion:`Use "${o.toolName}" without parentheses, or use "mcp__${n.serverName}__*" for all tools`,examples:[`mcp__${n.serverName}`,`mcp__${n.serverName}__*`,n.toolName&&n.toolName!=="*"?`mcp__${n.serverName}__${n.toolName}`:void 0].filter(Boolean)};return{valid:!0}}if(!o.toolName||o.toolName.length===0)return{valid:!1,error:"Tool name cannot be empty"};if(!o.toolName.includes("_")&&o.toolName[0]!==o.toolName[0]?.toUpperCase())return{valid:!1,error:"Tool names must start with uppercase",suggestion:`Use "${bh(String(o.toolName))}"`};let i=mj(o.toolName);if(i&&o.ruleContent!==void 0){let s=i(o.ruleContent);if(!s.valid)return s}if(fj(o.toolName)&&o.ruleContent!==void 0){let s=o.ruleContent;if(s.includes(":*")&&!s.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(s===":*")return{valid:!1,error:"Prefix cannot be empty before :*",suggestion:"Specify a command prefix before :*",examples:["Bash(npm *)","Bash(git *)"]}}if(pj(o.toolName)&&o.ruleContent!==void 0){let s=o.ruleContent;if(s.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(s.includes("*")&&!s.match(/^\*|\*$|\*\*|\/\*|\*\.|\*\)/)&&!s.includes("**"))return{valid:!1,error:"Wildcard placement might be incorrect",suggestion:"Wildcards are typically used at path boundaries",examples:[`${o.toolName}(*.js) - all .js files`,`${o.toolName}(src/*) - all files directly in src`,`${o.toolName}(src/**) - all files recursively in src`]}}return{valid:!0}}var ag=I(()=>l.string().superRefine((e,t)=>{let r=Nx(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(", ")}`;t.addIssue({code:l.ZodIssueCode.custom,message:o,params:{received:e}})}}));var Dee=I(()=>l.record(l.string(),l.coerce.string()));function yj(e){return l.object({allow:l.array(ag()).optional().describe("List of permission rules for allowed operations"),deny:l.array(ag()).optional().describe("List of permission rules for denied operations"),ask:l.array(ag()).optional().describe("List of permission rules that should always prompt for confirmation"),defaultMode:l.enum([...Yl,...aj(e)]).optional().describe("Default permission mode when Claude Code needs access"),disableBypassPermissionsMode:l.enum(["disable"]).optional().describe("Disable the ability to bypass permission prompts"),...sj(e),additionalDirectories:l.array(l.string()).optional().describe("Additional directories to include in the permission scope")}).passthrough()}var G0e=I(()=>yj(Cx())),jee=I(()=>l.object({source:eu().describe("Where to fetch the marketplace from"),installLocation:l.string().optional().describe("Local cache path where marketplace manifest is stored (auto-generated if not provided)"),autoUpdate:l.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),Dx=I(()=>l.object({serverName:l.string().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:l.array(l.string()).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:l.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers')}).refine((e)=>{return Uy([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"'})),jx=I(()=>l.object({serverName:l.string().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that is explicitly blocked"),serverCommand:l.array(l.string()).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:l.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers')}).refine((e)=>{return Uy([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"'})),zee=I(()=>l.object({path:l.string().describe("Absolute path to the helper executable"),timeoutMs:l.number().int().min(1000).optional(),refreshIntervalMs:l.union([l.literal(0),l.number().int().min(60000)]).optional()})),hj=["skills","agents","hooks","mcp"];function bj(e){return l.object({$schema:l.literal(oj).optional().describe("JSON Schema reference for Claude Code settings"),apiKeyHelper:l.string().optional().describe("Path to a script that outputs authentication values"),proxyAuthHelper:l.string().optional().describe("Shell command that outputs a Proxy-Authorization header value (EAP)"),awsCredentialExport:l.string().optional().describe("Path to a script that exports AWS credentials"),awsAuthRefresh:l.string().optional().describe("Path to a script that refreshes AWS authentication"),gcpAuthRefresh:l.string().optional().describe("Command to refresh GCP authentication (e.g., gcloud auth application-default login)"),policyHelper:zee().optional().describe("Executable that computes managed settings at startup. Honored only from admin-controlled policy sources."),...Te(process.env.CLAUDE_CODE_ENABLE_XAA)&&{xaaIdp:l.object({issuer:l.string().url().describe("IdP issuer URL for OIDC discovery"),clientId:l.string().describe("Claude Code's client_id registered at the IdP"),callbackPort:l.number().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:l.object({type:l.literal("command"),command:l.string()}).optional().describe("Custom file suggestion configuration for @ mentions"),respectGitignore:l.boolean().optional().describe("Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected."),breakReminder:l.object({enabled:l.boolean().optional().describe("Show a friendly nudge after sustained continuous use (default false). Must be true for the reminder to fire."),intervalMinutes:l.number().int().positive().optional().describe("Minutes of continuous use before the reminder fires (default 120). Re-fires every interval until you take a break."),breakThresholdMinutes:l.number().int().positive().optional().describe("Minutes of inactivity that count as a break and reset the timer (default 15)"),message:l.string().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:l.object({enabled:l.boolean().optional().describe("Show a one-time nudge when you start or keep using the CLI inside your quiet-hours window (default false)."),start:l.string().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:l.string().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:l.number().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."),skillListingMaxDescChars:l.number().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:l.number().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:l.boolean().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:Dee().optional().describe("Environment variables to set for Claude Code sessions"),attribution:l.object({commit:l.string().optional().describe("Attribution text for git commits, including any trailers. Empty string hides attribution."),pr:l.string().optional().describe("Attribution text for pull request descriptions. Empty string hides attribution.")}).optional().describe("Customize attribution text for commits and PRs. Each field defaults to the standard Claude Code attribution if not set."),includeCoAuthoredBy:l.boolean().optional().describe("Deprecated: Use attribution instead. Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)"),...!1,includeGitInstructions:l.boolean().optional().describe("Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)"),permissions:yj(e).optional().describe("Tool usage permissions configuration"),model:l.string().optional().describe("Override the default model used by Claude Code"),availableModels:l.array(l.string()).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.'),modelOverrides:l.record(l.string(),l.string()).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.'),enableAllProjectMcpServers:l.boolean().optional().describe("Whether to automatically approve all MCP servers in the project"),enabledMcpjsonServers:l.array(l.string()).optional().describe("List of approved MCP servers from .mcp.json"),disabledMcpjsonServers:l.array(l.string()).optional().describe("List of rejected MCP servers from .mcp.json"),skillOverrides:l.record(l.string(),l.enum(["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.'),allowedMcpServers:l.array(Dx()).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:l.array(jx()).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:Zo().optional().describe("Custom commands to run before/after tool executions"),worktree:l.object({symlinkDirectories:l.array(l.string()).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:l.array(l.string()).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:l.enum(["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:l.enum(["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.")}).optional().describe("Git worktree configuration for --worktree flag."),disableAllHooks:l.boolean().optional().describe("Disable all hooks and statusLine execution"),disableAgentView:l.boolean().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:l.boolean().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:l.boolean().optional().describe("Disable the Workflows feature (also via CLAUDE_CODE_DISABLE_WORKFLOWS)."),enableWorkflows:l.boolean().optional().describe("Enable or disable the Workflows feature for this user. Unset = default by plan once the feature is available."),workflowKeywordTriggerEnabled:l.boolean().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:l.boolean().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:l.enum(["bash","powershell"]).optional().describe("Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip)."),allowManagedHooksOnly:l.boolean().optional().describe("When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored."),allowedHttpHookUrls:l.array(l.string()).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:l.array(l.string()).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:l.boolean().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:l.boolean().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:l.boolean().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:l.preprocess((t)=>Array.isArray(t)?t.filter((r)=>hj.includes(r)):t,l.union([l.boolean(),l.array(l.enum(hj))])).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:l.object({type:l.literal("command"),command:l.string(),padding:l.number().optional(),refreshInterval:l.number().min(1).optional().catch(void 0).describe("Re-run the status line command every N seconds in addition to event-driven updates"),hideVimModeIndicator:l.boolean().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:l.string().optional().describe('URL template for PR links in the footer badge and inline messages. Placeholders: {host} {owner} {repo} {number} {url}. Example: "https://reviews.example.com/{owner}/{repo}/pull/{number}"'),subagentStatusLine:l.object({type:l.literal("command"),command:l.string()}).optional().describe("Custom per-subagent status line shown in the agent panel; receives row context as JSON on stdin"),enabledPlugins:l.record(l.string(),l.union([l.array(l.string()),l.boolean(),l.undefined()])).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:l.record(l.string(),jee()).check((t)=>{for(let[r,o]of Object.entries(t.value))if(o.source.source==="settings"&&o.source.name!==r)t.issues.push({code:"custom",input:o.source.name,path:[r,"source","name"],message:`Settings-sourced marketplace name must match its extraKnownMarketplaces key (got key "${r}" but source.name "${o.source.name}")`})}).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."),strictKnownMarketplaces:l.array(eu()).optional().describe("Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these exact sources can be added as marketplaces. 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."),blockedMarketplaces:l.array(eu()).optional().describe("Enterprise blocklist of marketplace sources. When set in managed settings, these exact sources are blocked from being added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem."),pluginSuggestionMarketplaces:l.array(l.string()).optional().describe("Marketplace names whose plugins may surface as contextual install suggestions (relevance-based tips), in addition to the official marketplace. 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."),forceLoginMethod:l.enum(["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:l.string().url().optional().catch(void 0).describe('@internal Cloud gateway URL to pre-fill and auto-connect to during login. Typically set in local managed settings alongside forceLoginMethod: "gateway" so users never type the URL. Hidden from public SDK types until Cloud gateway is documented.'),parentSettingsBehavior:l.enum(["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).`),forceLoginOrgUUID:l.union([l.string(),l.array(l.string())]).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:l.boolean().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:l.string().optional().describe("Path to a script that outputs OpenTelemetry headers"),outputStyle:l.string().optional().describe("Controls the output style for assistant responses"),viewMode:l.enum(["default","verbose","focus"]).optional().catch(void 0).describe("Default transcript view mode on startup"),language:l.string().optional().describe('Preferred language for Claude responses and voice dictation (e.g., "japanese", "spanish")'),skipWebFetchPreflight:l.boolean().optional().describe("Skip the WebFetch blocklist check for enterprise environments with restrictive security policies"),sandbox:ND().optional(),feedbackSurveyRate:l.number().min(0).max(1).optional().describe("Probability (0–1) that the session quality survey appears when eligible. 0.05 is a reasonable starting point."),spinnerTipsEnabled:l.boolean().optional().describe("Whether to show tips in the spinner"),spinnerVerbs:l.object({mode:l.enum(["append","replace"]),verbs:l.array(l.string())}).optional().describe('Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.'),spinnerTipsOverride:l.object({excludeDefault:l.boolean().optional(),tips:l.array(l.string())}).optional().describe("Override spinner tips. tips: array of tip strings. excludeDefault: if true, only show custom tips (default: false)."),syntaxHighlightingDisabled:l.boolean().optional().describe("Whether to disable syntax highlighting in diffs"),terminalTitleFromRename:l.boolean().optional().describe("Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles."),alwaysThinkingEnabled:l.boolean().optional().describe("When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models."),effortLevel:l.enum(["low","medium","high","xhigh"]).optional().catch(void 0).describe("Persisted effort level for supported models."),ultracode:l.boolean().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:l.number().int().min(1e5).max(1e6).optional().catch(void 0).describe("Auto-compact window size"),advisorModel:l.string().optional().describe("Advisor model for the server-side advisor tool."),fastMode:l.boolean().optional().describe("When true, fast mode is enabled. When absent or false, fast mode is off."),fastModePerSessionOptIn:l.boolean().optional().describe("When true, fast mode does not persist across sessions. Each session starts with fast mode off."),promptSuggestionEnabled:l.boolean().optional().describe("When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled."),awaySummaryEnabled:l.boolean().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:l.boolean().optional().describe('When true, the plan-approval dialog offers a "clear context" option. Defaults to false.'),agent:l.string().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."),companyAnnouncements:l.array(l.string()).optional().describe("Company announcements to display at startup (one will be randomly selected if multiple are provided)"),pluginConfigs:l.record(l.string(),l.object({mcpServers:l.record(l.string(),l.record(l.string(),l.union([l.string(),l.number(),l.boolean(),l.array(l.string())]))).optional().describe("User configuration values for MCP servers keyed by server name"),options:l.record(l.string(),l.union([l.string(),l.number(),l.boolean(),l.array(l.string())])).optional().describe("Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.")})).optional().describe("Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)"),remote:l.object({defaultEnvironmentId:l.string().optional().describe("Default environment ID to use for remote sessions")}).optional().describe("Remote session configuration"),autoUpdatesChannel:l.enum(["latest","stable","rc"]).optional().describe("Release channel for auto-updates (latest or stable)"),minimumVersion:l.string().optional().describe("Minimum version to stay on - prevents downgrades when switching to stable channel"),requiredMinimumVersion:l.string().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:l.string().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:l.string().optional().describe("Custom directory for plan files, relative to project root. If not set, defaults to ~/.claude/plans/"),tui:l.enum(["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:l.object({enabled:l.boolean().optional(),mode:l.enum(["hold","tap"]).optional().describe("'hold' (default): hold to talk. 'tap': tap to start, tap to stop+submit."),autoSubmit:l.boolean().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:l.boolean().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:l.array(l.object({marketplace:l.string(),plugin:l.string()})).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:l.boolean().optional().describe("Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)"),doneMeansMerged:l.boolean().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."),autoMemoryEnabled:l.boolean().optional().describe("Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory."),autoMemoryDirectory:l.string().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:l.boolean().optional().describe("Enable background memory consolidation (auto-dream). When set, overrides the server-side default."),showThinkingSummaries:l.boolean().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:l.boolean().optional().describe("Whether the user has accepted the bypass permissions mode dialog"),skipWorkflowUsageWarning:l.boolean().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:l.enum(["disable"]).optional().describe("Disable auto mode"),sshConfigs:l.array(l.object({id:l.string().describe("Unique identifier for this SSH config. Used to match configs across settings sources."),name:l.string().describe("Display name for the SSH connection"),sshHost:l.string().describe('SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config'),sshPort:l.number().int().optional().describe("SSH port (default: 22)"),sshIdentityFile:l.string().optional().describe("Path to SSH identity file (private key)"),startDirectory:l.string().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:l.string().optional().describe("CLAUDE.md-style instructions injected as organization-managed memory. Only honored from managed/policy settings."),claudeMdExcludes:l.array(l.string()).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:l.string().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:l.union([l.enum(UD),l.string().startsWith("custom:").transform((t)=>t)]).optional().catch(void 0).describe("Color theme for the UI"),editorMode:l.enum(jD).optional().catch(void 0).describe("Key binding mode for the prompt input"),verbose:l.boolean().optional().describe("Show full tool output instead of truncated summaries"),preferredNotifChannel:l.enum(DD).optional().catch(void 0).describe("Preferred OS notification channel"),autoCompactEnabled:l.boolean().optional().describe("Automatically compact conversation when context fills"),switchModelsOnFlag:l.boolean().optional().describe("When safety filters block a message, automatically switch to a different model to keep chatting. When off, your chat may stop instead."),autoScrollEnabled:l.boolean().optional().describe("Auto-scroll the conversation view to bottom (fullscreen mode only)"),fileCheckpointingEnabled:l.boolean().optional().describe("Snapshot files before edits so /rewind can restore them"),showTurnDuration:l.boolean().optional().describe('Show "Cooked for Nm Ns" after each assistant turn'),showMessageTimestamps:l.boolean().optional().describe("Stamp each assistant message with its arrival time"),terminalProgressBarEnabled:l.boolean().optional().describe("Emit OSC 9;4 progress sequences during long operations"),todoFeatureEnabled:l.boolean().optional().describe("Enable the todo / task tracking panel"),teammateMode:l.enum(zD).optional().catch(void 0).describe("How spawned teammates execute (tmux, in-process, auto)"),remoteControlAtStartup:l.boolean().optional().describe("Start Remote Control bridge automatically each session"),isolatePeerMachines:l.boolean().optional().describe("Require explicit approval before SendMessage can reach a peer session on another machine via Remote Control"),daemonColdStart:l.enum(["transient","ask"]).optional().describe("When no background service is running: 'transient' spawns one for this login session; 'ask' offers to install it persistently"),autoUploadSessions:l.boolean().optional().describe("Mirror local sessions to claude.ai as view-only (no remote control)"),inputNeededNotifEnabled:l.boolean().optional().describe("Push to mobile when a permission prompt or question is waiting"),agentPushNotifEnabled:l.boolean().optional().describe("Allow Claude to push proactive mobile notifications"),...ij(e)}).passthrough()}var $r=I(()=>bj(Cx()));var on="https://code.claude.com/docs/en",Uee=[{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:`${on}/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:`${on}/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:`${on}/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:`${on}/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:`${on}/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:`${on}/iam#working-directories`}}],Lee={permissions:`${on}/iam#configuring-permissions`,env:`${on}/settings#environment-variables`,hooks:`${on}/hooks`};function _j(e){let t=Uee.find((o)=>o.matches(e));if(!t)return null;let r={...t.tip};if(e.code==="invalid_value"&&e.enumValues&&!r.suggestion)r.suggestion=`Valid values: ${e.enumValues.map((o)=>`"${o}"`).join(", ")}`;if(!r.docLink&&e.path)r.docLink=Lee[_h(e.path,".")];return r}var pRe=I(()=>$r().strict());function vj(e){return e.code==="invalid_type"}function Sj(e){return e.code==="invalid_value"}function Fee(e){return e.code==="unrecognized_keys"}function xj(e){return e.code==="too_small"}function Os(e){if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";return typeof e}function wj(e){let t=e.match(/received (\w+)/);return t?t[1]:void 0}function Ko(e,t){return e.issues.map((r)=>{let o=r.path.map(String).join("."),n=r.message,i,s,a,c,u;if(Sj(r))s=r.values.map((p)=>String(p)),a=s.join(" | "),c=void 0,u=void 0;else if(vj(r)){a=r.expected;let p=wj(r.message);c=p??Os(r.input),u=p??Os(r.input)}else if(xj(r))a=String(r.minimum);else if(r.code==="custom"&&"params"in r)c=r.params.received,u=c;let d=_j({path:o,code:r.code,expected:a,received:c,enumValues:s,message:r.message,value:c});if(Sj(r))i=s?.map((p)=>`"${p}"`).join(", "),n=`Invalid value. Expected one of: ${i}`;else if(vj(r)){let p=wj(r.message)??Os(r.input);if(r.expected==="object"&&p==="null"&&o==="")n="Invalid or malformed JSON";else n=`Expected ${r.expected}, but received ${p}`}else if(Fee(r)){let p=r.keys.join(", ");n=`Unrecognized ${cE(r.keys.length,"field")}: ${p}`}else if(xj(r))n=`Number must be greater than or equal to ${r.minimum}`,i=String(r.minimum);return{file:t,path:o,message:n,expected:i,invalidValue:u,suggestion:d?.suggestion,docLink:d?.docLink}})}function Hee(e,t){if(!e||typeof e!=="object")return[];let r=e;if(!r.permissions||typeof r.permissions!=="object")return[];let o=r.permissions,n=[];for(let i of["allow","deny","ask"]){let s=o[i];if(!Array.isArray(s))continue;o[i]=s.filter((a)=>{if(typeof a!=="string")return n.push({file:t,path:`permissions.${i}`,message:`Non-string value in ${i} array was removed`,severity:"warning",invalidValue:a}),!1;let c=Nx(a);if(!c.valid){let u=`Invalid permission rule "${a}" was skipped: ${c.error}`;if(c.suggestion)u+=`. ${c.suggestion}`;return n.push({file:t,path:`permissions.${i}`,message:u,severity:"warning",invalidValue:a}),!1}return!0})}return n}var Bee=new Set(Xo);function qee(e,t){if(!e||typeof e!=="object")return[];let r=e;if(!("hooks"in r))return[];if(r.hooks===null||typeof r.hooks!=="object"||Array.isArray(r.hooks)){let i=Os(r.hooks);return delete r.hooks,[{file:t,path:"hooks",message:`"hooks" must be an object mapping event names to matcher arrays; received ${i}. This field was ignored.`,severity:"warning",invalidValue:i,docLink:"https://code.claude.com/docs/en/hooks"}]}let o=r.hooks,n=[];for(let i of Object.keys(o)){if(!Bee.has(i)){delete o[i],n.push({file:t,path:`hooks.${i}`,message:`Unknown hook event "${i}" was ignored. Valid events: ${Xo.join(", ")}`,severity:"warning",invalidValue:i,docLink:"https://code.claude.com/docs/en/hooks"});continue}if(!Array.isArray(o[i])){let s=Os(o[i]);delete o[i],n.push({file:t,path:`hooks.${i}`,message:`Hook event "${i}" must be an array of matchers; received ${s}. This entry was ignored.`,severity:"warning",invalidValue:s,docLink:"https://code.claude.com/docs/en/hooks"})}}if(n.length>0&&Object.keys(o).length===0)delete r.hooks;return n}var Zee=[{key:"allowedMcpServers",schema:Dx},{key:"deniedMcpServers",schema:jx}];function Vee(e,t){if(!e||typeof e!=="object")return[];let r=e,o=[];for(let{key:n,schema:i}of Zee){if(!(n in r))continue;if(!Array.isArray(r[n])){let c=r[n];delete r[n],o.push({file:t,path:n,message:`"${n}" must be an array; received ${Os(c)}. This field was ignored.`,severity:"warning",invalidValue:c});continue}let s=r[n],a=[];for(let c=0;c<s.length;c++){let u=i().safeParse(s[c]);if(u.success)a.push(s[c]);else o.push({file:t,path:`${n}[${c}]`,message:`Invalid entry was ignored: ${u.error.issues[0]?.message??"failed validation"}`,severity:"warning",invalidValue:s[c]})}if(a.length<s.length)r[n]=a}return o}function Kn(e,t){return[...Hee(e,t),...qee(e,t),...Vee(e,t)]}import{userInfo as Wee}from"os";var kj="com.anthropic.claudecode",tu="HKLM\\SOFTWARE\\Policies\\ClaudeCode",ru="HKCU\\SOFTWARE\\Policies\\ClaudeCode",Gn="Settings",Tj="/usr/bin/plutil",Ej=["-convert","json","-o","-","--"],Pj=5000,zx="/mnt/c/Windows/System32/reg.exe",As="/mnt/c/Program Files/ClaudeCode";function cg(){if(process.platform!=="linux")return!1;if(process.env.WSL_DISTRO_NAME)return!0;try{let e=At("fs").readFileSync("/proc/version","utf8").toLowerCase();return e.includes("microsoft")||e.includes("wsl")}catch{return!1}}function Ij(){let e="";try{e=Wee().username}catch{}let t=[];if(e)t.push({path:`/Library/Managed Preferences/${e}/${kj}.plist`,label:"per-user managed preferences"});return t.push({path:`/Library/Managed Preferences/${kj}.plist`,label:"device-level managed preferences"}),t}import{execFile as Kee}from"child_process";import{existsSync as Gee}from"fs";var Jee=null;function nu(e,t){return new Promise((r)=>{try{Kee(e,t,{encoding:"utf-8",timeout:Pj},(o,n)=>{r({stdout:n??"",code:o?1:0})})}catch{r({stdout:"",code:1})}})}function Rj(){return(async()=>{if(process.platform==="darwin"){let e=Ij(),r=(await Promise.all(e.map(async({path:o,label:n})=>{if(!Gee(o))return{stdout:"",label:n,ok:!1};let{stdout:i,code:s}=await nu(Tj,[...Ej,o]);return{stdout:i,label:n,ok:s===0&&!!i}}))).find((o)=>o.ok);return{plistStdouts:r?[{stdout:r.stdout,label:r.label}]:[],hklmStdout:null,hkcuStdout:null}}if(process.platform==="win32"){let t=`${process.env.SYSTEMROOT||"C:\\Windows"}\\System32\\reg.exe`,[r,o]=await Promise.all([nu(t,["query",tu,"/v",Gn]),nu(t,["query",ru,"/v",Gn])]);return{plistStdouts:null,hklmStdout:r.code===0?r.stdout:null,hkcuStdout:o.code===0?o.stdout:null}}if(cg()){let[e,t]=await Promise.all([nu(zx,["query",tu,"/v",Gn]),nu(zx,["query",ru,"/v",Gn])]);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 $j(){return Jee}var Jn=Object.freeze({settings:{},errors:[]}),Mj=null,Nj=null,Dj=!1,lg=null;function Xee(){if(lg)return;lg=(async()=>{let e=Date.now(),t=$j()??Rj(),{mdm:r,hkcu:o,wslInherits:n}=Yee(await t);Mj=r,Nj=o,Dj=n;let i=Date.now()-e;if(ne(`MDM settings load completed in ${i}ms`),Object.keys(r.settings).length>0){ne(`MDM settings found: ${Object.keys(r.settings).join(", ")}`);try{Jl("info","mdm_settings_loaded",{duration_ms:i,key_count:Object.keys(r.settings).length,error_count:r.errors.length})}catch{}}})()}async function jj(){if(!lg)Xee();await lg}function zj(){return Mj??Jn}function Uj(){return Nj??Jn}function Lj(){return Dj}function Ux(e,t){let r=Tr(Is(e,!1));if(!r||typeof r!=="object")return{settings:{},errors:[]};let o=Kn(r,t),n=$r().safeParse(r);if(!n.success){let i=Ko(n.error,t);return{settings:{},errors:[...o,...i]}}return{settings:n.data,errors:o}}function Oj(e,t="Settings"){let r=e.split(/\r?\n/),o=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp(`^\\s+${o}\\s+REG_(?:EXPAND_)?SZ\\s+(.*)$`,"i");for(let i of r){let s=i.match(n);if(s&&s[1])return s[1].trimEnd()}return null}function Yee(e){let t=[];if(e.plistStdouts&&e.plistStdouts.length>0){let{stdout:s,label:a}=e.plistStdouts[0],c=Ux(s,a),{wslInheritsWindowsSettings:u,...d}=c.settings;if(Object.keys(d).length>0)return{mdm:c,hkcu:Jn,wslInherits:!1};t.push(...c.errors)}let r=null;if(e.hklmStdout){let s=Oj(e.hklmStdout);if(s)r=Ux(s,`Registry: ${tu}\\${Gn}`)}if(r)t.push(...r.errors);let o=t.length>0?{settings:{},errors:t}:Jn,n=cg(),i=!1;if(n){if(i=r?.settings.wslInheritsWindowsSettings===!0||ete(),!i)return{mdm:o,hkcu:Jn,wslInherits:!1}}if(r){let{wslInheritsWindowsSettings:s,...a}=r.settings;if(Object.keys(a).length>0)return{mdm:r,hkcu:Jn,wslInherits:i}}if(Qee(i))return{mdm:o,hkcu:Jn,wslInherits:i};if(e.hkcuStdout){let s=Oj(e.hkcuStdout);if(s){let a=Ux(s,`Registry: ${ru}\\${Gn}`);if(!n||a.settings.wslInheritsWindowsSettings===!0){let{wslInheritsWindowsSettings:c,...u}=a.settings;return{mdm:o,hkcu:{settings:u,errors:a.errors},wslInherits:i}}if(a.errors.length>0)return{mdm:o,hkcu:{settings:{},errors:a.errors},wslInherits:i}}}return{mdm:o,hkcu:Jn,wslInherits:i}}function Qee(e){if(e&&Cj(As))return!0;return Cj(qo())}function Aj(e){let t=Tr(Is(Ho(e),!1));if(!t||typeof t!=="object")return!1;Kn(t,e);let{wslInheritsWindowsSettings:r,...o}=t;return Object.keys(o).length>0}function ete(){function e(t){try{let r=Is(Ho(t),!1);return!!r&&typeof r==="object"&&"wslInheritsWindowsSettings"in r&&r.wslInheritsWindowsSettings===!0}catch{return!1}}if(e(Cs(As,"managed-settings.json")))return!0;try{let t=Cs(As,"managed-settings.d");for(let r of Fe().readdirSync(t))if((r.isFile()||r.isSymbolicLink())&&r.name.endsWith(".json")&&!r.name.startsWith(".")&&e(Cs(t,r.name)))return!0}catch{}return!1}function Cj(e){try{if(Aj(Cs(e,"managed-settings.json")))return!0}catch{}try{let t=Cs(e,"managed-settings.d"),r=Fe().readdirSync(t);for(let o of r){if(!(o.isFile()||o.isSymbolicLink())||!o.name.endsWith(".json")||o.name.startsWith("."))continue;try{if(Aj(Cs(t,o.name)))return!0}catch{}}}catch{}return!1}function tte(e,t,r){if(r!==void 0&&!un(e[t],r)||r===void 0&&!(t in e))xi(e,t,r)}var ou=tte;function rte(e){return function(t,r,o){var n=-1,i=Object(t),s=o(t),a=s.length;while(a--){var c=s[e?a:++n];if(r(i[c],c,i)===!1)break}return t}}var Fj=rte;var nte=Fj(),Hj=nte;function ote(e){return Kt(e)&&ki(e)}var Bj=ote;var ite="[object Object]",ste=Function.prototype,ate=Object.prototype,qj=ste.toString,cte=ate.hasOwnProperty,lte=qj.call(Object);function ute(e){if(!Kt(e)||wr(e)!=ite)return!1;var t=cd(e);if(t===null)return!0;var r=cte.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&qj.call(r)==lte}var Zj=ute;function dte(e,t){if(t==="constructor"&&typeof e[t]==="function")return;if(t=="__proto__")return;return e[t]}var iu=dte;function pte(e){return sT(e,id(e))}var Vj=pte;function fte(e,t,r,o,n,i,s){var a=iu(e,r),c=iu(t,r),u=s.get(c);if(u){ou(e,r,u);return}var d=i?i(a,c,r+"",e,t,s):void 0,p=d===void 0;if(p){var f=pt(c),m=!f&&za(c),g=!f&&!m&&nd(c);if(d=c,f||m||g)if(pt(a))d=a;else if(Bj(a))d=TT(a);else if(m)p=!1,d=fh(c,!0);else if(g)p=!1,d=IT(c,!0);else d=[];else if(Zj(c)||Lr(c)){if(d=a,Lr(a))d=Vj(a);else if(!et(a)||Yo(a))d=OT(c)}else p=!1}if(p)s.set(c,d),n(d,c,o,i,s),s.delete(c);ou(e,r,d)}var Wj=fte;function Kj(e,t,r,o,n){if(e===t)return;Hj(t,function(i,s){if(n||(n=new iT),et(i))Wj(e,t,s,r,Kj,o,n);else{var a=o?o(iu(e,s),i,s+"",e,t,n):void 0;if(a===void 0)a=i;ou(e,s,a)}},id)}var Gj=Kj;function mte(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var Jj=mte;var Xj=Math.max;function gte(e,t,r){return t=Xj(t===void 0?e.length-1:t,0),function(){var o=arguments,n=-1,i=Xj(o.length-t,0),s=Array(i);while(++n<i)s[n]=o[t+n];n=-1;var a=Array(t+1);while(++n<t)a[n]=o[n];return a[t]=r(s),Jj(e,this,a)}}var ug=gte;function hte(e){return function(){return e}}var Yj=hte;var yte=!Si?ld:function(e,t){return Si(e,"toString",{configurable:!0,enumerable:!1,value:Yj(t),writable:!0})},Qj=yte;var bte=800,_te=16,vte=Date.now;function Ste(e){var t=0,r=0;return function(){var o=vte(),n=_te-(o-r);if(r=o,n>0){if(++t>=bte)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var ez=Ste;var xte=ez(Qj),dg=xte;function wte(e,t){return dg(ug(e,t,ld),e+"")}var tz=wte;function kte(e,t,r){if(!et(r))return!1;var o=typeof t;if(o=="number"?ki(r)&&vn(t,r.length):o=="string"&&(t in r))return un(r[t],e);return!1}var rz=kte;function Tte(e){return tz(function(t,r){var o=-1,n=r.length,i=n>1?r[n-1]:void 0,s=n>2?r[2]:void 0;if(i=e.length>3&&typeof i=="function"?(n--,i):void 0,s&&rz(r[0],r[1],s))i=n<3?void 0:i,n=1;t=Object(t);while(++o<n){var a=r[o];if(a)e(t,a,o,i)}return t})}var nz=Tte;var Ete=nz(function(e,t,r,o){Gj(e,t,r,o)}),sn=Ete;function Pte(e,t,r,o){if(!et(e))return e;t=Sn(t,e);var n=-1,i=t.length,s=i-1,a=e;while(a!=null&&++n<i){var c=Ei(t[n]),u=r;if(c==="__proto__"||c==="constructor"||c==="prototype")return e;if(n!=s){var d=a[c];if(u=o?o(d,c,a):void 0,u===void 0)u=et(d)?d:vn(t[n+1])?[]:{}}Xu(a,c,u),a=a[c]}return e}var oz=Pte;function Ite(e,t,r){var o=-1,n=t.length,i={};while(++o<n){var s=t[o],a=FT(e,s);if(r(a,s))oz(i,Sn(s,e),a)}return i}var iz=Ite;function Rte(e,t){return iz(e,t,function(r,o){return qT(e,o)})}var sz=Rte;var az=Bt?Bt.isConcatSpreadable:void 0;function $te(e){return pt(e)||Lr(e)||!!(az&&e&&e[az])}var cz=$te;function lz(e,t,r,o,n){var i=-1,s=e.length;r||(r=cz),n||(n=[]);while(++i<s){var a=e[i];if(t>0&&r(a))if(t>1)lz(a,t-1,r,o,n);else ET(n,a);else if(!o)n[n.length]=a}return n}var uz=lz;function Ote(e){var t=e==null?0:e.length;return t?uz(e,1):[]}var dz=Ote;function Ate(e){return dg(ug(e,void 0,dz),e+"")}var pz=Ate;var Cte=pz(function(e,t){return e==null?{}:sz(e,t)}),pg=Cte;import{dirname as Ute,join as Yn,resolve as su}from"path";import{join as Mte}from"path";var Nte="remote-settings.json",Lx=null,Dte;function fz(){return}function jte(){return fz()??Mte(qt(),Nte)}function zte(){try{let e=Ho(jte()),t=Ze(Qm(e));if(!t||typeof t!=="object"||Array.isArray(t))return null;return t}catch{return null}}function mz(){if(!fz()&&Dte!==!0)return null;if(Lx)return Lx;let e=zte();if(e)return Lx=e,mo(),e;return null}function Bx(e){let t=new Set(e.allowedSources);return t.add("flagSettings"),t.add("policySettings"),nj.filter((r)=>t.has(r))}function Lte(){return Yn(qo(),"managed-settings.json")}function hz(e){if(Bo()==="wsl"&&e.wslInherits?.()){let t=Fx(As);if(t.settings)return t;let r=Fx(qo());return{settings:r.settings,errors:[...t.errors,...r.errors]}}return Fx(qo())}function Fx(e){let t=[],r={},o=!1,{settings:n,errors:i}=fg(Yn(e,"managed-settings.json"));if(t.push(...i),n&&Object.keys(n).length>0)r=sn(r,n,Xn),o=!0;let s=Yn(e,"managed-settings.d");try{let u=Fe().readdirSync(s).filter((d)=>(d.isFile()||d.isSymbolicLink())&&d.name.endsWith(".json")&&!d.name.startsWith(".")).map((d)=>d.name).sort();for(let d of u){let{settings:p,errors:f}=fg(Yn(s,d));if(t.push(...f),p&&Object.keys(p).length>0)r=sn(r,p,Xn),o=!0}}catch(u){let d=Ge(u);if(d!=="ENOENT"&&d!=="ENOTDIR")ne(`managed-settings.d read failed: ${u}`,{level:"error"})}let{wslInheritsWindowsSettings:a,...c}=r;return{settings:o&&Object.keys(c).length>0?r:null,errors:t}}function Fte(e,t){if(_n(e))ne(`Broken symlink or missing file encountered for settings.json at path: ${t}`);else ne(`settings file read failed at ${t}: ${e}`,{level:"error"})}function fg(e,t){let r=GT(e);if(r)return{settings:r.settings?Tr(r.settings):null,errors:r.errors};let o=Hte(e,t);return JT(e,o),{settings:o.settings?Tr(o.settings):null,errors:o.errors}}function yz(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 bz(e){let t=e?.remote?e.remote():mz();if(!t||Object.keys(t).length===0)return{settings:null,errors:[]};let r=Tr(t),o=Kn(r,"remote managed settings"),n=$r().safeParse(r);if(!n.success)return{settings:null,errors:[...o,...Ko(n.error,"remote managed settings")]};return{settings:Object.keys(n.data).length>0?n.data:null,errors:o}}function _z(e){let t=e.parentManaged;if(!t||Object.keys(t).length===0)return{settings:null,errors:[]};let r=Tr(t),o=Kn(r,"parent managed settings"),n=$r().safeParse(r);if(!n.success)return{settings:null,errors:[...o,...Ko(n.error,"parent managed settings")]};return Object.keys(n.data).length>0?{settings:n.data,errors:o}:{settings:null,errors:o}}function vz(e){let t=e.flagInline;if(!t)return{settings:null,errors:[]};let r=Tr(t),o=Kn(r,"SDK inline settings"),n=$r().safeParse(r);if(!n.success)return{settings:null,errors:[...o,...Ko(n.error,"SDK inline settings")]};return{settings:n.data,errors:o}}function Hte(e,t){try{let r;if(t!==void 0)r=t;else{let{resolvedPath:s}=dd(Fe(),e);r=Ho(s)}if(r.trim()==="")return{settings:{},errors:[]};let o=Tr(Is(r,!1)),n=Kn(o,e),i=$r().safeParse(o);if(!i.success){let s=Ko(i.error,e);return{settings:null,errors:[...n,...s]}}return{settings:i.data,errors:n}}catch(r){return Fte(r,e),{settings:null,errors:[]}}}function gz(e,t){switch(e){case"userSettings":return su(qt());case"policySettings":case"projectSettings":case"localSettings":return su(t.cwd);case"flagSettings":return t.flagPath?Ute(su(t.flagPath)):su(t.cwd)}}function Bte(e){if(e.coworkPlugins||Te(process.env.CLAUDE_CODE_USE_COWORK_PLUGINS))return"cowork_settings.json";return"settings.json"}function au(e,t){switch(e){case"userSettings":return Yn(gz(e,t),Bte(t));case"projectSettings":case"localSettings":return Yn(gz(e,t),qte(e));case"policySettings":return Lte();case"flagSettings":return t.flagPath}}function qte(e){switch(e){case"projectSettings":return Yn(".claude","settings.json");case"localSettings":return Yn(".claude","settings.local.json")}}function Sz(e,t){let r=WT(e);if(r!==void 0)return r;let o=Kte(e,t);return KT(e,o),o}function Zte(e){return!e||e.parentSettingsBehavior==="merge"}function Vte(e,t){let r={};if(e.allowManagedHooksOnly===!0)r.allowManagedHooksOnly=!0;if(e.allowManagedMcpServersOnly===!0)r.allowManagedMcpServersOnly=!0;if(e.allowManagedPermissionRulesOnly===!0)r.allowManagedPermissionRulesOnly=!0;let o=e.strictPluginOnlyCustomization;if(o===!0||Array.isArray(o)&&o.length>0)r.strictPluginOnlyCustomization=o;if(e.deniedMcpServers)r.deniedMcpServers=e.deniedMcpServers;if(t.forceLoginOrgUUID===void 0&&e.forceLoginOrgUUID)r.forceLoginOrgUUID=e.forceLoginOrgUUID;if(t.allowedMcpServers===void 0&&e.allowedMcpServers)r.allowedMcpServers=e.allowedMcpServers;if(e.permissions){let n=pg(e.permissions,["deny","ask"]);if(e.permissions.disableBypassPermissionsMode==="disable")n.disableBypassPermissionsMode="disable";if(t.allowManagedPermissionRulesOnly!==!0){let{allow:i,additionalDirectories:s}=e.permissions;if(i&&t.sandbox?.network?.allowManagedDomainsOnly!==!0)n.allow=i;if(s)n.additionalDirectories=s}if(Object.keys(n).length>0)r.permissions=n}if(e.sandbox){let{network:n,filesystem:i}=e.sandbox,s={};if(e.sandbox.enabled===!0)s.enabled=!0;if(e.sandbox.failIfUnavailable===!0)s.failIfUnavailable=!0;if(e.sandbox.allowUnsandboxedCommands===!1)s.allowUnsandboxedCommands=!1;if(e.sandbox.autoAllowBashIfSandboxed===!1)s.autoAllowBashIfSandboxed=!1;if(n){let a=pg(n,["deniedDomains"]);if(n.allowManagedDomainsOnly===!0)a.allowManagedDomainsOnly=!0;if(t.sandbox?.network?.allowManagedDomainsOnly!==!0&&n.allowedDomains)a.allowedDomains=n.allowedDomains;if(Object.keys(a).length>0)s.network=a}if(i){let a=pg(i,["denyRead","denyWrite"]);if(i.allowManagedReadPathsOnly===!0)a.allowManagedReadPathsOnly=!0;if(t.sandbox?.filesystem?.allowManagedReadPathsOnly!==!0&&i.allowRead)a.allowRead=i.allowRead;if(Object.keys(a).length>0)s.filesystem=a}if(Object.keys(s).length>0)r.sandbox=s}return r}function xz(e){if(e.helper?.())return"helper";if(bz(e).settings)return"remote";if(yz(e).settings)return Bo()==="macos"?"plist":"hklm";if((e.file?.()??hz(e)).settings)return"file";if(_z(e).settings)return"parent";let t=e.hkcu?.();return t&&Object.keys(t.settings).length>0?"hkcu":null}function Wte(e){let t=[],{settings:r,errors:o}=bz(e);t.push(...o);let{settings:n,errors:i}=yz(e);t.push(...i);let{settings:s,errors:a}=e.file?.()??hz(e);t.push(...a);let{settings:c,errors:u}=_z(e);t.push(...u);let d=[r,n,s].filter((g)=>g!==null),p=d[0]??null,f={allowManagedPermissionRulesOnly:d.some((g)=>g.allowManagedPermissionRulesOnly===!0)||void 0,forceLoginOrgUUID:d.find((g)=>g.forceLoginOrgUUID!==void 0)?.forceLoginOrgUUID,allowedMcpServers:d.find((g)=>g.allowedMcpServers!==void 0)?.allowedMcpServers,sandbox:{network:{allowManagedDomainsOnly:d.some((g)=>g.sandbox?.network?.allowManagedDomainsOnly===!0)||void 0},filesystem:{allowManagedReadPathsOnly:d.some((g)=>g.sandbox?.filesystem?.allowManagedReadPathsOnly===!0)||void 0}}},m=c&&Zte(p)?Vte(c,f):null;return{tiers:d,admin:p,parentSlice:m,errors:t}}function wz(e){let t=e.helper?.();if(t)return{settings:t,errors:e.helperWarnings?.()??[]};let{admin:r,parentSlice:o,errors:n}=Wte(e);if(!r&&!o){let i=e.hkcu?.();if(i&&Object.keys(i.settings).length>0)return{settings:i.settings,errors:[...n,...i.errors]};return{settings:null,errors:[...n,...i?.errors??[]]}}return{settings:sn({},o??{},r??{},Xn),errors:n}}function Kte(e,t){if(e==="policySettings")return wz(t).settings;let r=au(e,t),{settings:o}=r?fg(r,e==="flagSettings"?t.flagExpectedContent:void 0):{settings:null};if(e==="flagSettings"){let{settings:n}=vz(t);if(n)return sn(o||{},n,Xn)}return o}function Gte(e,t){return Ad([...e,...t])}function Xn(e,t){if(Array.isArray(e)&&Array.isArray(t))return Gte(e,t);return}var Hx=!1;function Jte(e){if(Hx)return{settings:{},errors:[]};let t=Date.now();Jl("info","settings_load_started"),Hx=!0;try{let r=XT(),o={};if(r)o=sn(o,r,Xn);let n=[],i=new Set,s=new Set;for(let a of Bx(e)){if(a==="policySettings"){let{settings:u,errors:d}=wz(e);if(u)o=sn(o,u,Xn);for(let p of d){let f=`${p.file}:${p.path}:${p.message}`;if(!i.has(f))i.add(f),n.push(p)}continue}let c=au(a,e);if(c){let u=su(c);if(!s.has(u)){s.add(u);let{settings:d,errors:p}=fg(c,a==="flagSettings"?e.flagExpectedContent:void 0);for(let f of p){let m=`${f.file}:${f.path}:${f.message}`;if(!i.has(m))i.add(m),n.push(f)}if(d)o=sn(o,d,Xn)}}if(a==="flagSettings"){let{settings:u,errors:d}=vz(e);for(let p of d){let f=`${p.file}:${p.path}:${p.message}`;if(!i.has(f))i.add(f),n.push(p)}if(u)o=sn(o,u,Xn)}}return Jl("info","settings_load_completed",{duration_ms:Date.now()-t,source_count:s.size,error_count:n.length}),{settings:o,errors:n}}finally{Hx=!1}}function Xte(e){let t=ZT();if(t!==null)return t;let r=Jte(e);return VT(r),r}function Yte(e){let{settings:t}=Xte(e);return t||{}}function kz(e){mo();let t=[];for(let r of Bx(e)){let o=Sz(r,e);if(o&&Object.keys(o).length>0)t.push({source:r,settings:o})}return{effective:Yte(e),sources:t}}function Tz(e,t){let r=Bx(t);for(let o=r.length-1;o>=0;o--){let n=r[o];if(Sz(n,t)?.[e]!==void 0)return n}return null}var ere={user:"userSettings",project:"projectSettings",local:"localSettings"},Ez={userSettings:"user",projectSettings:"project",localSettings:"local",flagSettings:"flag",policySettings:"managed"},tre=["user","project","local"],rre=new Set(["bypassPermissions","auto","acceptEdits"]),nre=new Set(["project"]);function ore(e){let t=e.effective.permissions?.defaultMode;if(!t||!rre.has(t))return e.effective;for(let r=e.sources.length-1;r>=0;r--){let o=e.sources[r];if(o.settings.permissions?.defaultMode!==void 0){if(nre.has(o.source)){let{defaultMode:n,...i}=e.effective.permissions??{};return{...e.effective,permissions:i}}return e.effective}}return e.effective}async function Pz(e={}){await jj();let t={cwd:Qte(e.cwd??Fe().cwd()),allowedSources:(e.settingSources??tre).map((r)=>ere[r]),parentManaged:e.managedSettings??null,flagInline:null,flagPath:void 0,mdm:zj,hkcu:Uj,wslInherits:Lj,...e.serverManagedSettings!==void 0&&{remote:()=>e.serverManagedSettings}};try{let{effective:r,sources:o}=kz(t),n=xz(t)??void 0,i=o.map(({source:a,settings:c})=>({source:Ez[a],settings:c,path:a==="policySettings"?void 0:au(a,t),...a==="policySettings"&&{policyOrigin:n}})),s={};for(let a of Object.keys(r)){let c=Tz(a,t);if(c)s[a]={source:Ez[c],path:c==="policySettings"?void 0:au(c,t),...c==="policySettings"&&{policyOrigin:n}}}return{effective:r,provenance:s,sources:i}}finally{mo()}}process.env.NoDefaultCurrentDirectoryInExePath="1";async function DAe(e){return Pz(e)}async function gre(e,t){try{await cre(e,t)}catch(r){if(!_n(r))throw r}}async function hre(e,t){if(!e)return;let r=e;try{let o=Ze(e);if(o?.claudeAiOauth?.refreshToken)delete o.claudeAiOauth.refreshToken,r=pe(o)}catch{}await Mz(t,r,{mode:384})}function yre(){if(process.platform!=="darwin")return Promise.resolve(void 0);let e=iR(oR);return new Promise((t)=>{ire("security",["find-generic-password","-a",sR(),"-w","-s",e],{encoding:"utf-8",timeout:5000},(r,o)=>t(r?void 0:o.trim()||void 0))})}async function jz(e,t,r,o,n=60000){if(!Se(t))return;let i=rr(r),s=await Cr(e.load({projectKey:i,sessionId:t}),n,`SessionStore.load() timed out after ${n}ms for session ${t}`);if(!s||s.length===0)return;let a=Lt(pre(),`claude-resume-${Gx()}`);try{let c=Lt(a,"projects",i);await qx(c,{recursive:!0});let u=Lt(c,`${t}.jsonl`);await Xa(u,s);let d=o?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR,p=d??Lt(Zx(),".claude"),f;try{f=await Cz(Lt(p,".credentials.json"),"utf-8")}catch(m){if(!_n(m))throw m}if(!d&&!(o??process.env).ANTHROPIC_API_KEY&&!(o??process.env).CLAUDE_CODE_OAUTH_TOKEN)f=await yre()??f;if(await hre(f,Lt(a,".credentials.json")),await gre(Lt(d??Zx(),".claude.json"),Lt(a,".claude.json")),e.listSubkeys){let m=Lt(c,t),g=await Cr(e.listSubkeys({projectKey:i,sessionId:t}),n,`SessionStore.listSubkeys() timed out after ${n}ms for session ${t}`);for(let h of g){let y=cu(m,h+".jsonl");if(!h||Nz(h)||h.split(/[\\/]/).includes("..")||!y.startsWith(m+Jx)){ne(`[SessionStore] skipping unsafe subpath from listSubkeys: ${h}`,{level:"warn"});continue}let v=await Cr(e.load({projectKey:i,sessionId:t,subpath:h}),n,`SessionStore.load() timed out after ${n}ms for session ${t} subpath ${h}`);if(!v||v.length===0)continue;let x=[],w=[];for(let O of v)if(Kx(O))x.push(O);else w.push(O);if(w.length>0)await qx(Iz(y),{recursive:!0}),await Xa(y,w);if(x.length>0){let O=x.at(-1),L=cu(m,h+".meta.json");await qx(Iz(L),{recursive:!0});let{type:se,...Ue}=O;await Mz(L,pe(Ue),{mode:384})}}}return a}catch(c){throw await mg(a),c}}function Vx(e,t,r,o){let{systemPrompt:n,settings:i,managedSettings:s,settingSources:a,sandbox:c,...u}=e??{},d,p,f;if(n===void 0)d="";else if(typeof n==="string")d=n;else if(Array.isArray(n))d=n;else if(n.type==="preset")p=n.append,f=n.excludeDynamicSections;process.env.CLAUDE_AGENT_SDK_VERSION="0.3.165";let{abortController:m=Fs(),additionalDirectories:g=[],agent:h,agents:y,allowedTools:v=[],betas:x,canUseTool:w,continue:O,cwd:L,debug:se,debugFile:Ue,disallowedTools:Ye=[],tools:Ft,env:bt,executable:Qn=mu()?"bun":"node",executableArgs:Go=[],extraArgs:Or={},fallbackModel:Ms,enableFileCheckpointing:an,toolConfig:V,forkSession:lu,hooks:uu,includeHookEvents:Ns,includePartialMessages:Ds,forwardSubagentText:js,onElicitation:du,onUserDialog:qe,persistSession:nr,sessionStore:Qe,sessionStoreFlush:Hz,thinking:zs,effort:Bz,maxThinkingTokens:hg,maxTurns:qz,maxBudgetUsd:Zz,taskBudget:Vz,mcpServers:Xx,model:Wz,outputFormat:Yx,permissionMode:Kz="default",allowDangerouslySkipPermissions:Gz=!1,permissionPromptToolName:Jz,plugins:Xz,getOAuthToken:Qx,getHostAuthToken:ew,workload:tw,resume:rw,resumeSessionAt:Yz,sessionId:Qz,skills:nw,stderr:eU,strictMcpConfig:tU}=u;if(Qe&&nr===!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(Qe&&O&&!rw&&!Qe.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");if(Qe&&an)throw Error("enableFileCheckpointing is not yet supported with sessionStore (backup blobs are not mirrored, so rewindFiles() fails after a store-backed resume).");if(Qe&&u.spawnClaudeCodeProcess)ne("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"});let yg=u.pathToClaudeCodeExecutable;if(!yg){let Ot=mre(import.meta.url),or=dre(Ot),eo=PE((Jo)=>or.resolve(Jo));if(!eo)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.`);yg=eo}let ow=Yx?.type==="json_schema"?Yx.schema:void 0,dt=bt?{...bt}:{...process.env};if(!dt.CLAUDE_CODE_ENTRYPOINT)dt.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(!dt.CLAUDE_AGENT_SDK_VERSION)dt.CLAUDE_AGENT_SDK_VERSION="0.3.165";if(an)dt.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true";if(Qx)dt.CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH="1";if(ew)dt.CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH="1";if(V?.askUserQuestion?.previewFormat)dt.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT=V.askUserQuestion.previewFormat;let bg={};if(gg.propagation.inject(gg.context.active(),bg),"traceparent"in bg){for(let Ot of["TRACEPARENT","TRACESTATE"])if(!(Ot in(bt??{})))delete dt[Ot]}for(let[Ot,or]of Object.entries(bg)){let eo=Ot.toUpperCase();if(!(eo in(bt??{})))dt[eo]=or}let iw={},sw=new Map;if(Xx)for(let[Ot,or]of Object.entries(Xx))if(or.type==="sdk"&&or.instance)sw.set(Ot,or.instance);else iw[Ot]=or;let Us;if(zs)switch(zs.type){case"adaptive":Us={type:"adaptive",display:zs.display};break;case"enabled":Us={type:"enabled",budgetTokens:zs.budgetTokens,display:zs.display};break;case"disabled":Us={type:"disabled"};break}else if(hg!==void 0)Us=hg===0?{type:"disabled"}:{type:"enabled",budgetTokens:hg};if(r){if(dt.CLAUDE_CONFIG_DIR=r,process.platform==="win32")dt.CLAUDE_SECURESTORAGE_CONFIG_DIR=bt?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??bt?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??""}let aw=new Ih({abortController:m,additionalDirectories:g,agent:h,betas:x,cwd:L,debug:se,debugFile:Ue,executable:Qn,executableArgs:Go,extraArgs:tw?{...Or,workload:tw}:Or,pathToClaudeCodeExecutable:yg,env:dt,forkSession:lu,stderr:eU,thinkingConfig:Us,effort:Bz,maxTurns:qz,maxBudgetUsd:Zz,taskBudget:Vz,model:Wz,fallbackModel:Ms,jsonSchema:ow,permissionMode:Kz,allowDangerouslySkipPermissions:Gz,permissionPromptToolName:Jz,continueConversation:Qe?void 0:O,resume:rw,resumeSessionAt:Yz,sessionId:Qz,settings:typeof i==="object"?pe(i):i,managedSettings:s?pe(s):void 0,settingSources:a,skills:nw,allowedTools:v,disallowedTools:Ye,tools:Ft,mcpServers:iw,strictMcpConfig:tU,canUseTool:!!w,hooks:!!uu,includeHookEvents:Ns,includePartialMessages:Ds,persistSession:nr,sessionMirror:!!Qe,plugins:Xz,sandbox:c,spawnClaudeCodeProcess:u.spawnClaudeCodeProcess,deferSpawn:o}),rU={systemPrompt:d,appendSystemPrompt:p,planModeInstructions:u.planModeInstructions,appendSubagentSystemPrompt:u.appendSubagentSystemPrompt,toolAliases:u.toolAliases,excludeDynamicSections:f,agents:y,title:u.title,skills:nw,webSearchIsolationExemptMcpServers:u.webSearchIsolationExemptMcpServers,promptSuggestions:u.promptSuggestions,agentProgressSummaries:u.agentProgressSummaries,forwardSubagentText:js},_g=new Ah(aw,t,w,uu,m,sw,ow,rU,du,Qx,ew,qe);if(Qe){let Ot=()=>Lt(dt.CLAUDE_CONFIG_DIR??Lt(Zx(),".claude"),"projects"),or=Hz==="eager",eo=new Ch(async(Jo,vg)=>{let Ls=Az(Jo,Ot());if(Ls)await Qe.append(Ls,vg);else ne(`[SessionStore] dropping mirror frame: filePath ${Jo} is not under ${Ot()} -- subprocess CLAUDE_CONFIG_DIR likely differs from parent (custom spawnClaudeCodeProcess / container?)`,{level:"warn"})},void 0,(Jo,vg)=>{let Ls=Az(Jo,Ot());if(Ls)_g.reportMirrorError(Ls,vg.message)},or?0:yd,or?0:bd);_g.setTranscriptMirrorBatcher(eo)}return{queryInstance:_g,transport:aw,abortController:m,processEnv:dt}}function Wx(e,t,r,o){if(typeof r==="string")t.write(pe({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:r}]},parent_tool_use_id:null})+`
116
- `);else e.streamInput(r).catch((n)=>o.abort(n))}var bre=new Set(["EBUSY","EMFILE","ENFILE","ENOTEMPTY","EPERM"]);async function mg(e){for(let t=0;;t++)try{return await ure(e,{recursive:!0,force:!0})}catch(r){if(t>=4||!bre.has(Ge(r)??""))return;await pu((t+1)*100)}}function _re(e,t){e.waitForExit().catch(()=>{}).finally(()=>mg(t))}function jAe({prompt:e,options:t}){if((t?.resume||t?.continue)&&t?.sessionStore){let{queryInstance:i,transport:s,abortController:a,processEnv:c}=Vx({...t},typeof e==="string",void 0,!0),u=cu(t.cwd??"."),d=t.sessionStore,p=t.loadTimeoutMs??60000,f=t.resume;return(async()=>{if(!f)f=(await Cr(d.listSessions(rr(u)),p,`SessionStore.listSessions() timed out after ${p}ms`)).slice().sort((h,y)=>y.mtime-h.mtime)[0]?.sessionId;if(!f)return;return jz(d,f,u,t.env,t.loadTimeoutMs)})().then((g)=>{if(g){s.updateResume(f);let h={CLAUDE_CONFIG_DIR:g};if(process.platform==="win32"){let y=t.env?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??t.env?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??"";h.CLAUDE_SECURESTORAGE_CONFIG_DIR=y,c.CLAUDE_SECURESTORAGE_CONFIG_DIR=y}s.updateEnv(h),c.CLAUDE_CONFIG_DIR=g,i.addCleanupCallback(()=>_re(s,g))}if(!i.isClosed())s.spawn()}).catch((g)=>{let h=kr(g);s.spawnAbort(h),i.setError(h)}),Wx(i,s,e,a),i}let{queryInstance:r,transport:o,abortController:n}=Vx(t,typeof e==="string");return Wx(r,o,e,n),r}async function zAe({options:e,initializeTimeoutMs:t=60000}={}){let r,o=e?.resume;if((o||e?.continue)&&e?.sessionStore){let a=cu(e.cwd??".");if(!o){if(!e.sessionStore.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");let c=e.loadTimeoutMs??60000;o=(await Cr(e.sessionStore.listSessions(rr(a)),c,`SessionStore.listSessions() timed out after ${c}ms`)).slice().sort((d,p)=>p.mtime-d.mtime)[0]?.sessionId}if(o)r=await jz(e.sessionStore,o,a,e.env,e.loadTimeoutMs)}let n,i,s;try{let f=function(){if(p)return;p=!0,d.close()},a=Vx(r&&o&&o!==e?.resume?{...e,resume:o}:e,!1,r);n=a.queryInstance;let{transport:c,abortController:u}=a;i=c;let d=a.queryInstance;if(r){let m=r;d.addCleanupCallback(()=>{s=c.waitForExit().catch(()=>{}).then(()=>mg(m))})}await Cr(d.initializationResult(),t,`Subprocess initialization did not complete within ${t}ms — check authentication and network connectivity`);let p=!1;return{query(m){if(p)throw Error("WarmQuery.query() can only be called once");p=!0;try{Wx(d,c,m,u)}catch(g){throw d.close(),g}if(typeof m==="string")d.setIsSingleUserTurn(!0);return d},close:f,async[Symbol.asyncDispose](){p=!0,d.close(),await s}}}catch(a){if(n?.close(),r&&!s){let c=i;s=(c?c.waitForExit().catch(()=>{}):Promise.resolve()).then(()=>mg(r))}throw await s,a}}async function UAe(e,t){if(t?.sessionStore)return wre(t.sessionStore,e,t);return N0(e,t)}async function LAe(e){if(e?.sessionStore)return Sre(e.sessionStore,e);return j0(e)}async function FAe(e,t){if(t?.sessionStore)return kre(t.sessionStore,e,t);return z0(e,t)}async function HAe(e,t,r){if(r?.sessionStore)return Tre(r.sessionStore,e,t,r.dir);return H0(e,t,r)}async function BAe(e,t,r){if(r?.sessionStore)return Ere(r.sessionStore,e,t,r.dir);return B0(e,t,r)}async function qAe(e,t){if(!Se(e))throw Error(`Invalid sessionId: ${e}`);if(t?.sessionStore){if(!t.sessionStore.delete)return;let r=rr(t.dir);await t.sessionStore.delete({projectKey:r,sessionId:e});return}return q0(e,t)}async function ZAe(e,t){if(t?.sessionStore)return Pre(t.sessionStore,e,t);return W0(e,t)}async function VAe(e,t,r){if(!Se(e))throw Error(`Invalid sessionId: ${e}`);let o=await wn(e,r?.dir);if(!o)throw Error(`Session ${e} not found`);let n=rr(r?.dir),i=r?.batchSize&&r.batchSize>0?r.batchSize:yd;if(await Rz(o.filePath,{projectKey:n,sessionId:e},t,i),r?.includeSubagents===!1)return;let s=o.filePath.replace(/\.jsonl$/,""),a=Lt(s,"subagents");for(let c of await vre(a)){let u=Dz(s,c).split(Jx);u[u.length-1]=u.at(-1).replace(/\.jsonl$/,"");let d={projectKey:n,sessionId:e,subpath:u.join("/")};await Rz(c,d,t,i);let p=c.replace(/\.jsonl$/,".meta.json");try{let f=Ze(await Cz(p,"utf8"));await t.append(d,[{type:"agent_metadata",...f}])}catch(f){if(!_n(f))throw f}}}async function Rz(e,t,r,o){let n=fre({input:sre(e,{encoding:"utf8"}),crlfDelay:1/0}),i=[],s=0;for await(let a of n){if(!a)continue;if(i.push(Ze(a)),s+=a.length,i.length>=o||s>=bd)await r.append(t,i),i=[],s=0}if(i.length>0)await r.append(t,i)}async function vre(e){let t=[];async function r(o){let n;try{n=await lre(o,{withFileTypes:!0})}catch{return}for(let i of n){let s=Lt(o,i.name);if(i.isDirectory())await r(s);else if(i.isFile()&&i.name.endsWith(".jsonl"))t.push(s)}}return await r(e),t}async function WAe(e,t){if(t?.sessionStore)return Ire(t.sessionStore,e,t.dir);return Q0(e,t)}async function KAe(e,t,r){if(r?.sessionStore)return Rre(r.sessionStore,e,t,r);return eR(e,t,r)}function zz(e){let t=cu(e??"."),r;try{r=are(t)}catch{r=t}return Ar(r)}function rr(e){return So(zz(e))}function Uz(e){return e.map((t)=>pe(t)).join(`
114
+ `+"\t".repeat(t)})}};var SD;(function(e){e.DEFAULT={allowTrailingComma:!1}})(SD||(SD={}));var xD;(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"})(xD||(xD={}));var wD;(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"})(wD||(wD={}));var kD;(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"})(kD||(kD={}));function eg(e){return e.startsWith("\uFEFF")?e.slice(1):e}import De from"node:path";import ED from"node:os";import Ex from"node:process";var Wn=ED.homedir(),Tx=ED.tmpdir(),{env:Es}=Ex,AQ=(e)=>{let t=De.join(Wn,"Library");return{data:De.join(t,"Application Support",e),config:De.join(t,"Preferences",e),cache:De.join(t,"Caches",e),log:De.join(t,"Logs",e),temp:De.join(Tx,e)}},CQ=(e)=>{let t=Es.APPDATA||De.join(Wn,"AppData","Roaming"),r=Es.LOCALAPPDATA||De.join(Wn,"AppData","Local");return{data:De.join(r,e,"Data"),config:De.join(t,e,"Config"),cache:De.join(r,e,"Cache"),log:De.join(r,e,"Log"),temp:De.join(Tx,e)}},MQ=(e)=>{let t=De.basename(Wn);return{data:De.join(Es.XDG_DATA_HOME||De.join(Wn,".local","share"),e),config:De.join(Es.XDG_CONFIG_HOME||De.join(Wn,".config"),e),cache:De.join(Es.XDG_CACHE_HOME||De.join(Wn,".cache"),e),log:De.join(Es.XDG_STATE_HOME||De.join(Wn,".local","state"),e),temp:De.join(Tx,t,e)}};function Px(e,{suffix:t="nodejs"}={}){if(typeof e!=="string")throw TypeError(`Expected a string, got ${typeof e}`);if(t)e+=`-${t}`;if(Ex.platform==="darwin")return AQ(e);if(Ex.platform==="win32")return CQ(e);return MQ(e)}var RPe=Px("claude-cli");function NQ(){if(process.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC)return"essential-traffic";if(process.env.DISABLE_TELEMETRY)return"no-telemetry";if(Ee(process.env.DO_NOT_TRACK))return"no-telemetry";return"default"}function TD(){return NQ()==="essential-traffic"}var DQ=100,Ix=[];function jQ(e){if(Ix.length>=DQ)Ix.shift();Ix.push(e)}var zQ=[],PD=null;var eIe=Ce(()=>{return process.argv.includes("--hard-fail")});function tg(e){let t=Er(e);try{if(Ee(process.env.CLAUDE_CODE_USE_BEDROCK)||Ee(process.env.CLAUDE_CODE_USE_VERTEX)||Ee(process.env.CLAUDE_CODE_USE_FOUNDRY)||Ee(process.env.CLAUDE_CODE_USE_ANTHROPIC_AWS)||Ee(process.env.CLAUDE_CODE_USE_MANTLE)||process.env.DISABLE_ERROR_REPORTING||TD())return;let o={error:t.stack||t.message,timestamp:new Date().toISOString()};if(jQ(o),PD===null){zQ.push({type:"error",error:t});return}PD.logError(t)}catch{}}var Ts=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,RD=new Set,Rx=typeof process==="object"&&!!process?process:{},$D=(e,t,r,o)=>{typeof Rx.emitWarning==="function"?Rx.emitWarning(e,t,r,o):console.error(`[${r}] ${t}: ${e}`)},rg=globalThis.AbortController,ID=globalThis.AbortSignal;if(typeof rg>"u"){ID=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(o,n){this._onabort.push(n)}},rg=class{constructor(){t()}signal=new ID;abort(o){if(this.signal.aborted)return;this.signal.reason=o,this.signal.aborted=!0;for(let n of this.signal._onabort)n(o);this.signal.onabort?.(o)}};let e=Rx.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{if(!e)return;e=!1,$D("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 UQ=(e)=>!RD.has(e),rIe=Symbol("type"),Kn=(e)=>e&&e===Math.floor(e)&&e>0&&isFinite(e),OD=(e)=>!Kn(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?Xl:null;class Xl extends Array{constructor(e){super(e);this.fill(0)}}class Ps{heap;length;static#n=!1;static create(e){let t=OD(e);if(!t)return[];Ps.#n=!0;let r=new Ps(e,t);return Ps.#n=!1,r}constructor(e,t){if(!Ps.#n)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 ng{#n;#d;#g;#h;#$;#O;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#y;#o;#r;#e;#l;#p;#c;#s;#b;#a;#_;#v;#f;#S;#T;#u;static unsafeExposeInternals(e){return{starts:e.#v,ttls:e.#f,sizes:e.#_,keyMap:e.#o,keyList:e.#r,valList:e.#e,next:e.#l,prev:e.#p,get head(){return e.#c},get tail(){return e.#s},free:e.#b,isBackgroundFetch:(t)=>e.#t(t),backgroundFetch:(t,r,o,n)=>e.#M(t,r,o,n),moveToTail:(t)=>e.#R(t),indexes:(t)=>e.#x(t),rindexes:(t)=>e.#w(t),isStale:(t)=>e.#m(t)}}get max(){return this.#n}get maxSize(){return this.#d}get calculatedSize(){return this.#y}get size(){return this.#i}get fetchMethod(){return this.#$}get memoMethod(){return this.#O}get dispose(){return this.#g}get disposeAfter(){return this.#h}constructor(e){let{max:t=0,ttl:r,ttlResolution:o=1,ttlAutopurge:n,updateAgeOnGet:i,updateAgeOnHas:s,allowStale:a,dispose:c,disposeAfter:u,noDisposeOnSet:d,noUpdateTTL:p,maxSize:f=0,maxEntrySize:m=0,sizeCalculation:g,fetchMethod:h,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:x,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:O,ignoreFetchAbort:L}=e;if(t!==0&&!Kn(t))throw TypeError("max option must be a nonnegative integer");let se=t?OD(t):Array;if(!se)throw Error("invalid max value: "+t);if(this.#n=t,this.#d=f,this.maxEntrySize=m||this.#d,this.sizeCalculation=g,this.sizeCalculation){if(!this.#d&&!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.#O=y,h!==void 0&&typeof h!=="function")throw TypeError("fetchMethod must be a function if specified");if(this.#$=h,this.#T=!!h,this.#o=new Map,this.#r=Array(t).fill(void 0),this.#e=Array(t).fill(void 0),this.#l=new se(t),this.#p=new se(t),this.#c=0,this.#s=0,this.#b=Ps.create(t),this.#i=0,this.#y=0,typeof c==="function")this.#g=c;if(typeof u==="function")this.#h=u,this.#a=[];else this.#h=void 0,this.#a=void 0;if(this.#S=!!this.#g,this.#u=!!this.#h,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!O,this.ignoreFetchAbort=!!L,this.maxEntrySize!==0){if(this.#d!==0){if(!Kn(this.#d))throw TypeError("maxSize must be a positive integer if specified")}if(!Kn(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#F()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!x,this.updateAgeOnGet=!!i,this.updateAgeOnHas=!!s,this.ttlResolution=Kn(o)||o===0?o:1,this.ttlAutopurge=!!n,this.ttl=r||0,this.ttl){if(!Kn(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#N()}if(this.#n===0&&this.ttl===0&&this.#d===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#n&&!this.#d){if(UQ("LRU_CACHE_UNBOUNDED"))RD.add("LRU_CACHE_UNBOUNDED"),$D("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",ng)}}getRemainingTTL(e){return this.#o.has(e)?1/0:0}#N(){let e=new Xl(this.#n),t=new Xl(this.#n);this.#f=e,this.#v=t,this.#D=(n,i,s=Ts.now())=>{if(t[n]=i!==0?s:0,e[n]=i,i!==0&&this.ttlAutopurge){let a=setTimeout(()=>{if(this.#m(n))this.#k(this.#r[n],"expire")},i+1);if(a.unref)a.unref()}},this.#P=(n)=>{t[n]=e[n]!==0?Ts.now():0},this.#E=(n,i)=>{if(e[i]){let s=e[i],a=t[i];if(!s||!a)return;n.ttl=s,n.start=a,n.now=r||o();let c=n.now-a;n.remainingTTL=s-c}};let r=0,o=()=>{let n=Ts.now();if(this.ttlResolution>0){r=n;let i=setTimeout(()=>r=0,this.ttlResolution);if(i.unref)i.unref()}return n};this.getRemainingTTL=(n)=>{let i=this.#o.get(n);if(i===void 0)return 0;let s=e[i],a=t[i];if(!s||!a)return 1/0;let c=(r||o())-a;return s-c},this.#m=(n)=>{let i=t[n],s=e[n];return!!s&&!!i&&(r||o())-i>s}}#P=()=>{};#E=()=>{};#D=()=>{};#m=()=>!1;#F(){let e=new Xl(this.#n);this.#y=0,this.#_=e,this.#I=(t)=>{this.#y-=e[t],e[t]=0},this.#j=(t,r,o,n)=>{if(this.#t(r))return 0;if(!Kn(o))if(n){if(typeof n!=="function")throw TypeError("sizeCalculation must be a function");if(o=n(r,t),!Kn(o))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 o},this.#A=(t,r,o)=>{if(e[t]=r,this.#d){let n=this.#d-e[t];while(this.#y>n)this.#C(!0)}if(this.#y+=e[t],o)o.entrySize=r,o.totalCalculatedSize=this.#y}}#I=(e)=>{};#A=(e,t,r)=>{};#j=(e,t,r,o)=>{if(r||o)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#x({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#s;;){if(!this.#z(t))break;if(e||!this.#m(t))yield t;if(t===this.#c)break;else t=this.#p[t]}}*#w({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#c;;){if(!this.#z(t))break;if(e||!this.#m(t))yield t;if(t===this.#s)break;else t=this.#l[t]}}#z(e){return e!==void 0&&this.#o.get(this.#r[e])===e}*entries(){for(let e of this.#x())if(this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e]))yield[this.#r[e],this.#e[e]]}*rentries(){for(let e of this.#w())if(this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e]))yield[this.#r[e],this.#e[e]]}*keys(){for(let e of this.#x()){let t=this.#r[e];if(t!==void 0&&!this.#t(this.#e[e]))yield t}}*rkeys(){for(let e of this.#w()){let t=this.#r[e];if(t!==void 0&&!this.#t(this.#e[e]))yield t}}*values(){for(let e of this.#x())if(this.#e[e]!==void 0&&!this.#t(this.#e[e]))yield this.#e[e]}*rvalues(){for(let e of this.#w())if(this.#e[e]!==void 0&&!this.#t(this.#e[e]))yield this.#e[e]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let r of this.#x()){let o=this.#e[r],n=this.#t(o)?o.__staleWhileFetching:o;if(n===void 0)continue;if(e(n,this.#r[r],this))return this.get(this.#r[r],t)}}forEach(e,t=this){for(let r of this.#x()){let o=this.#e[r],n=this.#t(o)?o.__staleWhileFetching:o;if(n===void 0)continue;e.call(t,n,this.#r[r],this)}}rforEach(e,t=this){for(let r of this.#w()){let o=this.#e[r],n=this.#t(o)?o.__staleWhileFetching:o;if(n===void 0)continue;e.call(t,n,this.#r[r],this)}}purgeStale(){let e=!1;for(let t of this.#w({allowStale:!0}))if(this.#m(t))this.#k(this.#r[t],"expire"),e=!0;return e}info(e){let t=this.#o.get(e);if(t===void 0)return;let r=this.#e[t],o=this.#t(r)?r.__staleWhileFetching:r;if(o===void 0)return;let n={value:o};if(this.#f&&this.#v){let i=this.#f[t],s=this.#v[t];if(i&&s){let a=i-(Ts.now()-s);n.ttl=a,n.start=Date.now()}}if(this.#_)n.size=this.#_[t];return n}dump(){let e=[];for(let t of this.#x({allowStale:!0})){let r=this.#r[t],o=this.#e[t],n=this.#t(o)?o.__staleWhileFetching:o;if(n===void 0||r===void 0)continue;let i={value:n};if(this.#f&&this.#v){i.ttl=this.#f[t];let s=Ts.now()-this.#v[t];i.start=Math.floor(Date.now()-s)}if(this.#_)i.size=this.#_[t];e.unshift([r,i])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let o=Date.now()-r.start;r.start=Ts.now()-o}this.set(t,r.value,r)}}set(e,t,r={}){if(t===void 0)return this.delete(e),this;let{ttl:o=this.ttl,start:n,noDisposeOnSet:i=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:a}=r,{noUpdateTTL:c=this.noUpdateTTL}=r,u=this.#j(e,t,r.size||0,s);if(this.maxEntrySize&&u>this.maxEntrySize){if(a)a.set="miss",a.maxEntrySizeExceeded=!0;return this.#k(e,"set"),this}let d=this.#i===0?void 0:this.#o.get(e);if(d===void 0){if(d=this.#i===0?this.#s:this.#b.length!==0?this.#b.pop():this.#i===this.#n?this.#C(!1):this.#i,this.#r[d]=e,this.#e[d]=t,this.#o.set(e,d),this.#l[this.#s]=d,this.#p[d]=this.#s,this.#s=d,this.#i++,this.#A(d,u,a),a)a.set="add";c=!1}else{this.#R(d);let p=this.#e[d];if(t!==p){if(this.#T&&this.#t(p)){p.__abortController.abort(Error("replaced"));let{__staleWhileFetching:f}=p;if(f!==void 0&&!i){if(this.#S)this.#g?.(f,e,"set");if(this.#u)this.#a?.push([f,e,"set"])}}else if(!i){if(this.#S)this.#g?.(p,e,"set");if(this.#u)this.#a?.push([p,e,"set"])}if(this.#I(d),this.#A(d,u,a),this.#e[d]=t,a){a.set="replace";let f=p&&this.#t(p)?p.__staleWhileFetching:p;if(f!==void 0)a.oldValue=f}}else if(a)a.set="update"}if(o!==0&&!this.#f)this.#N();if(this.#f){if(!c)this.#D(d,o,n);if(a)this.#E(a,d)}if(!i&&this.#u&&this.#a){let p=this.#a,f;while(f=p?.shift())this.#h?.(...f)}return this}pop(){try{while(this.#i){let e=this.#e[this.#c];if(this.#C(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#u&&this.#a){let e=this.#a,t;while(t=e?.shift())this.#h?.(...t)}}}#C(e){let t=this.#c,r=this.#r[t],o=this.#e[t];if(this.#T&&this.#t(o))o.__abortController.abort(Error("evicted"));else if(this.#S||this.#u){if(this.#S)this.#g?.(o,r,"evict");if(this.#u)this.#a?.push([o,r,"evict"])}if(this.#I(t),e)this.#r[t]=void 0,this.#e[t]=void 0,this.#b.push(t);if(this.#i===1)this.#c=this.#s=0,this.#b.length=0;else this.#c=this.#l[t];return this.#o.delete(r),this.#i--,t}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:o}=t,n=this.#o.get(e);if(n!==void 0){let i=this.#e[n];if(this.#t(i)&&i.__staleWhileFetching===void 0)return!1;if(!this.#m(n)){if(r)this.#P(n);if(o)o.has="hit",this.#E(o,n);return!0}else if(o)o.has="stale",this.#E(o,n)}else if(o)o.has="miss";return!1}peek(e,t={}){let{allowStale:r=this.allowStale}=t,o=this.#o.get(e);if(o===void 0||!r&&this.#m(o))return;let n=this.#e[o];return this.#t(n)?n.__staleWhileFetching:n}#M(e,t,r,o){let n=t===void 0?void 0:this.#e[t];if(this.#t(n))return n;let i=new rg,{signal:s}=r;s?.addEventListener("abort",()=>i.abort(s.reason),{signal:i.signal});let a={signal:i.signal,options:r,context:o},c=(g,h=!1)=>{let{aborted:y}=i.signal,v=r.ignoreFetchAbort&&g!==void 0;if(r.status)if(y&&!h){if(r.status.fetchAborted=!0,r.status.fetchError=i.signal.reason,v)r.status.fetchAbortIgnored=!0}else r.status.fetchResolved=!0;if(y&&!v&&!h)return d(i.signal.reason);let x=f;if(this.#e[t]===f)if(g===void 0)if(x.__staleWhileFetching)this.#e[t]=x.__staleWhileFetching;else this.#k(e,"fetch");else{if(r.status)r.status.fetchUpdated=!0;this.set(e,g,a.options)}return g},u=(g)=>{if(r.status)r.status.fetchRejected=!0,r.status.fetchError=g;return d(g)},d=(g)=>{let{aborted:h}=i.signal,y=h&&r.allowStaleOnFetchAbort,v=y||r.allowStaleOnFetchRejection,x=v||r.noDeleteOnFetchRejection,w=f;if(this.#e[t]===f){if(!x||w.__staleWhileFetching===void 0)this.#k(e,"fetch");else if(!y)this.#e[t]=w.__staleWhileFetching}if(v){if(r.status&&w.__staleWhileFetching!==void 0)r.status.returnedStale=!0;return w.__staleWhileFetching}else if(w.__returned===w)throw g},p=(g,h)=>{let y=this.#$?.(e,n,a);if(y&&y instanceof Promise)y.then((v)=>g(v===void 0?void 0:v),h);i.signal.addEventListener("abort",()=>{if(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort){if(g(void 0),r.allowStaleOnFetchAbort)g=(v)=>c(v,!0)}})};if(r.status)r.status.fetchDispatched=!0;let f=new Promise(p).then(c,u),m=Object.assign(f,{__abortController:i,__staleWhileFetching:n,__returned:void 0});if(t===void 0)this.set(e,m,{...a.options,status:void 0}),t=this.#o.get(e);else this.#e[t]=m;return m}#t(e){if(!this.#T)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof rg}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:i=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:a=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:g,forceRefresh:h=!1,status:y,signal:v}=t;if(!this.#T){if(y)y.fetch="get";return this.get(e,{allowStale:r,updateAgeOnGet:o,noDeleteOnStaleGet:n,status:y})}let x={allowStale:r,updateAgeOnGet:o,noDeleteOnStaleGet:n,ttl:i,noDisposeOnSet:s,size:a,sizeCalculation:c,noUpdateTTL:u,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:m,ignoreFetchAbort:f,status:y,signal:v},w=this.#o.get(e);if(w===void 0){if(y)y.fetch="miss";let O=this.#M(e,w,x,g);return O.__returned=O}else{let O=this.#e[w];if(this.#t(O)){let Ft=r&&O.__staleWhileFetching!==void 0;if(y){if(y.fetch="inflight",Ft)y.returnedStale=!0}return Ft?O.__staleWhileFetching:O.__returned=O}let L=this.#m(w);if(!h&&!L){if(y)y.fetch="hit";if(this.#R(w),o)this.#P(w);if(y)this.#E(y,w);return O}let se=this.#M(e,w,x,g),Ye=se.__staleWhileFetching!==void 0&&r;if(y){if(y.fetch=L?"stale":"refresh",Ye&&L)y.returnedStale=!0}return Ye?se.__staleWhileFetching:se.__returned=se}}async forceFetch(e,t={}){let r=await this.fetch(e,t);if(r===void 0)throw Error("fetch() returned undefined");return r}memo(e,t={}){let r=this.#O;if(!r)throw Error("no memoMethod provided to constructor");let{context:o,forceRefresh:n,...i}=t,s=this.get(e,i);if(!n&&s!==void 0)return s;let a=r(e,s,{options:i,context:o});return this.set(e,a,i),a}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:i}=t,s=this.#o.get(e);if(s!==void 0){let a=this.#e[s],c=this.#t(a);if(i)this.#E(i,s);if(this.#m(s)){if(i)i.get="stale";if(!c){if(!n)this.#k(e,"expire");if(i&&r)i.returnedStale=!0;return r?a:void 0}else{if(i&&r&&a.__staleWhileFetching!==void 0)i.returnedStale=!0;return r?a.__staleWhileFetching:void 0}}else{if(i)i.get="hit";if(c)return a.__staleWhileFetching;if(this.#R(s),o)this.#P(s);return a}}else if(i)i.get="miss"}#U(e,t){this.#p[t]=e,this.#l[e]=t}#R(e){if(e!==this.#s){if(e===this.#c)this.#c=this.#l[e];else this.#U(this.#p[e],this.#l[e]);this.#U(this.#s,e),this.#s=e}}delete(e){return this.#k(e,"delete")}#k(e,t){let r=!1;if(this.#i!==0){let o=this.#o.get(e);if(o!==void 0)if(r=!0,this.#i===1)this.#L(t);else{this.#I(o);let n=this.#e[o];if(this.#t(n))n.__abortController.abort(Error("deleted"));else if(this.#S||this.#u){if(this.#S)this.#g?.(n,e,t);if(this.#u)this.#a?.push([n,e,t])}if(this.#o.delete(e),this.#r[o]=void 0,this.#e[o]=void 0,o===this.#s)this.#s=this.#p[o];else if(o===this.#c)this.#c=this.#l[o];else{let i=this.#p[o];this.#l[i]=this.#l[o];let s=this.#l[o];this.#p[s]=this.#p[o]}this.#i--,this.#b.push(o)}}if(this.#u&&this.#a?.length){let o=this.#a,n;while(n=o?.shift())this.#h?.(...n)}return r}clear(){return this.#L("delete")}#L(e){for(let t of this.#w({allowStale:!0})){let r=this.#e[t];if(this.#t(r))r.__abortController.abort(Error("deleted"));else{let o=this.#r[t];if(this.#S)this.#g?.(r,o,e);if(this.#u)this.#a?.push([r,o,e])}}if(this.#o.clear(),this.#e.fill(void 0),this.#r.fill(void 0),this.#f&&this.#v)this.#f.fill(0),this.#v.fill(0);if(this.#_)this.#_.fill(0);if(this.#c=0,this.#s=0,this.#b.length=0,this.#y=0,this.#i=0,this.#u&&this.#a){let t=this.#a,r;while(r=t?.shift())this.#h?.(...r)}}}function AD(e,t,r=100){let o=new ng({max:r}),n=(...i)=>{let s=t(...i),a=o.get(s);if(a!==void 0)return a;let c=e(...i);return o.set(s,c),c};return n.cache={clear:()=>o.clear(),size:()=>o.size,delete:(i)=>o.delete(i),get:(i)=>o.peek(i),has:(i)=>o.has(i)},n}var LQ=8192;function MD(e,t){try{return{ok:!0,value:JSON.parse(eg(e))}}catch(r){if(t)tg(r);return{ok:!1}}}var CD=AD(MD,(e)=>e,50);var Is=Object.assign(function(t,r=!0){if(!t)return null;let o=t.length>LQ?MD(t,r):CD(t,r);return o.ok?o.value:null},{cache:CD.cache});import{join as HQ}from"path";import{readdir as vIe,readFile as FQ}from"fs/promises";import{release as ND}from"os";var Zo=Ce(()=>{try{if(process.platform==="darwin")return"macos";if(process.platform==="win32")return"windows";if(process.platform==="linux"){if(process.env.WSL_DISTRO_NAME||process.env.WSL_INTEROP)return"wsl";try{let e=Fe().readFileSync("/proc/version",{encoding:"utf8"});if(e.toLowerCase().includes("microsoft")||e.toLowerCase().includes("wsl"))return"wsl"}catch(e){ne(`Failed to read /proc/version for WSL detection: ${e}`,{level:"error"})}return"linux"}return"unknown"}catch(e){return tg(e),"unknown"}}),TIe=Ce(()=>{if(process.platform!=="linux")return;try{let e=Fe().readFileSync("/proc/version",{encoding:"utf8"}),t=e.match(/WSL(\d+)/i);if(t&&t[1])return t[1];if(e.toLowerCase().includes("microsoft"))return"1";return}catch(e){ne(`Failed to read /proc/version for WSL detection: ${e}`,{level:"error"});return}}),PIe=Ce(async()=>{if(process.platform!=="linux")return;let e={linuxKernel:ND()};try{let t=await FQ("/etc/os-release","utf8");for(let r of t.split(`
115
+ `)){let o=r.match(/^(ID|VERSION_ID)=(.*)$/);if(o&&o[1]&&o[2]){let n=o[2].replace(/^"|"$/g,"");if(o[1]==="ID")e.linuxDistroId=n;else e.linuxDistroVersion=n}}}catch{}return e});var IIe=Ce(()=>{if(process.platform!=="darwin")return;let t=ND().match(/^(\d+)\./);if(!t||!t[1])return;return parseInt(t[1],10)-9});var Vo=Ce(function(){switch(Zo()){case"macos":return"/Library/Application Support/ClaudeCode";case"windows":return"C:\\Program Files\\ClaudeCode";default:return"/etc/claude-code"}}),CIe=Ce(function(){return HQ(Vo(),"managed-settings.d")});import{isAbsolute as DD}from"path";var BQ=P(()=>l.object({allowedDomains:l.array(l.string()).optional(),deniedDomains:l.array(l.string()).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."),allowManagedDomainsOnly:l.boolean().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:l.array(l.string()).optional().describe("macOS only: Unix socket paths to allow. Ignored on Linux (seccomp cannot filter by path)."),allowAllUnixSockets:l.boolean().optional().describe("If true, allow all Unix sockets (disables blocking on both platforms)."),allowLocalBinding:l.boolean().optional(),allowMachLookup:l.array(l.string().refine((e)=>{return!(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:l.number().optional(),socksProxyPort:l.number().optional(),tlsTerminate:l.object({caCertPath:l.string().min(1).optional(),caKeyPath:l.string().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.")}).optional()),qQ=P(()=>l.object({allowWrite:l.array(l.string()).optional().describe("Additional paths to allow writing within the sandbox. Merged with paths from Edit(...) allow permission rules."),denyWrite:l.array(l.string()).optional().describe("Additional paths to deny writing within the sandbox. Merged with paths from Edit(...) deny permission rules."),denyRead:l.array(l.string()).optional().describe("Additional paths to deny reading within the sandbox. Merged with paths from Read(...) deny permission rules."),allowRead:l.array(l.string()).optional().describe("Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths."),allowManagedReadPathsOnly:l.boolean().optional().describe("When true (set in managed settings), only allowRead paths from policySettings are used.")}).optional()),jD=P(()=>l.object({enabled:l.boolean().optional(),failIfUnavailable:l.boolean().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:l.boolean().optional(),allowUnsandboxedCommands:l.boolean().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:BQ(),filesystem:qQ(),ignoreViolations:l.record(l.string(),l.array(l.string())).optional(),enableWeakerNestedSandbox:l.boolean().optional(),enableWeakerNetworkIsolation:l.boolean().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"),excludedCommands:l.array(l.string()).optional(),ripgrep:l.object({command:l.string(),args:l.array(l.string()).optional()}).optional().describe("Custom ripgrep configuration for bundled ripgrep support"),bwrapPath:l.preprocess((e)=>typeof e==="string"&&DD(e)?e:void 0,l.string()).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:l.preprocess((e)=>typeof e==="string"&&DD(e)?e:void 0,l.string()).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 zD=["auto","iterm2","iterm2_with_bell","terminal_bell","kitty","ghostty","notifications_disabled"],UD=["normal","vim"],LD=["auto","tmux","in-process"],ZQ=["dark","light","light-daltonized","dark-daltonized","light-ansi","dark-ansi"],FD=["auto",...ZQ];var FIe=Zo()==="macos"?"⏺":"●";var Yl=["acceptEdits","auto","bypassPermissions","default","dontAsk","plan"],VQ=[...Yl,"bubble"],HD=VQ;var GIe=P(()=>Fv.enum(HD)),JIe=P(()=>Fv.enum(Yl));var BD=["bash","powershell"];var Ql=P(()=>l.string().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 WQ(){let e=l.object({type:l.literal("command").describe("Shell command hook type"),command:l.string().describe("Shell command to execute"),args:l.array(l.string()).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:Ql(),shell:l.enum(BD).optional().describe("Shell interpreter. 'bash' uses your $SHELL (bash/zsh/sh); 'powershell' uses pwsh. Defaults to bash (powershell on Windows without Git Bash)."),timeout:l.number().positive().optional().describe("Timeout in seconds for this specific command"),statusMessage:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution"),async:l.boolean().optional().describe("If true, hook runs in background without blocking"),asyncRewake:l.boolean().optional().describe("If true, hook runs in background and wakes the model on exit code 2 (blocking error). Implies async."),rewakeMessage:l.string().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:l.string().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".')}),t=l.object({type:l.literal("prompt").describe("LLM prompt hook type"),prompt:l.string().describe("Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON."),if:Ql(),timeout:l.number().positive().optional().describe("Timeout in seconds for this specific prompt evaluation"),model:l.string().optional().describe('Model to use for this prompt hook (e.g., "claude-sonnet-4-6"). If not specified, uses the default small fast model.'),continueOnBlock:l.boolean().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:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution")}),r=l.object({type:l.literal("mcp_tool").describe("MCP tool hook type"),server:l.string().describe("Name of an already-configured MCP server to invoke"),tool:l.string().describe("Name of the tool on that server to call"),input:l.record(l.string(),l.unknown()).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:Ql(),timeout:l.number().positive().optional().describe("Timeout in seconds for this specific tool call"),statusMessage:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution")}),o=l.object({type:l.literal("http").describe("HTTP hook type"),url:l.string().url().describe("URL to POST the hook input JSON to"),if:Ql(),timeout:l.number().positive().optional().describe("Timeout in seconds for this specific request"),headers:l.record(l.string(),l.string()).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:l.array(l.string()).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:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution")}),n=l.object({type:l.literal("agent").describe("Agentic verifier hook type"),prompt:l.string().describe('Prompt describing what to verify (e.g. "Verify that unit tests ran and passed."). Use $ARGUMENTS placeholder for hook input JSON.'),if:Ql(),timeout:l.number().positive().optional().describe("Timeout in seconds for agent execution (default 60)"),model:l.string().optional().describe('Model to use for this agent hook (e.g., "claude-sonnet-4-6"). If not specified, uses Haiku.'),statusMessage:l.string().optional().describe("Custom status message to display in spinner while hook runs"),once:l.boolean().optional().describe("If true, hook runs once and is removed after execution")});return{BashCommandHookSchema:e,PromptHookSchema:t,HttpHookSchema:o,AgentHookSchema:n,McpToolHookSchema:r}}var qD=P(()=>{let{BashCommandHookSchema:e,PromptHookSchema:t,AgentHookSchema:r,HttpHookSchema:o,McpToolHookSchema:n}=WQ();return l.discriminatedUnion("type",[e,t,r,o,n])}),ZD=P(()=>l.object({matcher:l.string().optional().describe('String pattern to match (e.g. tool names like "Write")'),hooks:l.array(qD()).describe("List of hooks to execute when the matcher matches")})),Wo=P(()=>l.partialRecord(l.enum(Xo),l.array(ZD())));var sRe=P(()=>l.enum(["local","user","project","dynamic","enterprise","claudeai","managed","agent"])),aRe=P(()=>l.enum(["stdio","sse","sse-ide","http","ws","sdk"])),Rs=P(()=>l.literal("comms").optional().catch(void 0)),Gn=P(()=>l.number().int().positive()),KQ=P(()=>l.object({type:l.literal("stdio").optional(),command:l.string().min(1,"Command cannot be empty"),args:l.array(l.string()).default([]),env:l.record(l.string(),l.string()).optional(),timeout:Gn().optional(),alwaysLoad:l.boolean().optional(),role:Rs()})),GQ=P(()=>l.boolean()),VD=P(()=>l.object({clientId:l.string().optional(),callbackPort:l.number().int().positive().optional(),authServerMetadataUrl:l.string().url().startsWith("https://",{message:"authServerMetadataUrl must use https://"}).optional(),scopes:l.string().min(1).optional(),xaa:GQ().optional()})),JQ=P(()=>l.object({type:l.literal("sse"),url:l.string(),headers:l.record(l.string(),l.string()).optional(),headersHelper:l.string().optional(),oauth:VD().optional(),timeout:Gn().optional(),alwaysLoad:l.boolean().optional(),role:Rs()})),XQ=P(()=>l.object({type:l.literal("sse-ide"),url:l.string(),ideName:l.string(),ideRunningInWindows:l.boolean().optional(),timeout:Gn().optional(),alwaysLoad:l.boolean().optional(),role:Rs()})),YQ=P(()=>l.object({type:l.literal("ws-ide"),url:l.string(),ideName:l.string(),authToken:l.string().optional(),ideRunningInWindows:l.boolean().optional(),timeout:Gn().optional(),alwaysLoad:l.boolean().optional(),role:Rs()})),QQ=P(()=>l.object({type:l.enum(["http","streamable-http"]).transform(()=>"http"),url:l.string(),headers:l.record(l.string(),l.string()).optional(),headersHelper:l.string().optional(),oauth:VD().optional(),timeout:Gn().optional(),alwaysLoad:l.boolean().optional(),role:Rs()})),eee=P(()=>l.object({type:l.literal("ws"),url:l.string(),headers:l.record(l.string(),l.string()).optional(),headersHelper:l.string().optional(),timeout:Gn().optional(),alwaysLoad:l.boolean().optional(),role:Rs()})),tee=P(()=>l.object({type:l.literal("sdk"),name:l.string(),timeout:Gn().optional(),alwaysLoad:l.boolean().optional()})),ree=P(()=>l.enum(["allow","ask","blocked"])),nee=P(()=>l.object({type:l.literal("claudeai-proxy"),url:l.string(),id:l.string(),timeout:Gn().optional(),alwaysLoad:l.boolean().optional(),toolPermissions:l.record(l.string(),ree()).optional(),stateless:l.boolean().optional(),cachedInitResponse:l.record(l.string(),l.unknown()).nullish()})),og=P(()=>l.union([KQ(),JQ(),XQ(),YQ(),QQ(),eee(),tee(),nee()])),cRe=P(()=>l.object({mcpServers:l.record(l.string(),og())}));var JD=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"]);var oee=/(?:official[^a-z0-9]*(anthropic|claude)|(?:anthropic|claude)[^a-z0-9]*official|^(?:anthropic|claude)[^a-z0-9]*(marketplace|plugins|official))/i,iee=/[^\u0020-\u007E]/;function see(e){if(JD.has(e.toLowerCase()))return!1;if(iee.test(e))return!0;return oee.test(e)}var Sr=P(()=>l.string().startsWith("./")),Ko=P(()=>Sr().endsWith(".json")),WD=P(()=>l.union([Sr().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"),l.string().url().refine((e)=>e.endsWith(".mcpb")||e.endsWith(".dxt"),{message:"MCPB URL must end with .mcpb or .dxt"}).describe("URL to MCPB file")])),Ox=P(()=>Sr().endsWith(".md")),Ax=P(()=>l.union([Ox(),Sr()])),XD=P(()=>l.string().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)=>!see(e),{message:"Marketplace name impersonates an official Anthropic/Claude marketplace"}).refine((e)=>e.toLowerCase()!=="inline",{message:'Marketplace name "inline" is reserved for --plugin-dir session plugins'}).refine((e)=>e.toLowerCase()!=="builtin",{message:'Marketplace name "builtin" is reserved for built-in plugins'}).refine((e)=>e.toLowerCase()!=="skills-dir",{message:'Marketplace name "skills-dir" is reserved for plugins auto-loaded from .claude/skills/'})),Cx=P(()=>l.object({name:l.string().min(1,"Author name cannot be empty").describe("Display name of the plugin author or organization"),email:l.string().optional().describe("Contact email for support or feedback"),url:l.string().optional().describe("Website, GitHub profile, or organization URL")})),aee=P(()=>l.object({$schema:l.string().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:l.string().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:l.string().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:l.string().optional().describe("Semantic version (e.g., 1.2.3) following semver.org specification"),description:l.string().optional().describe("Brief, user-facing explanation of what the plugin provides"),author:Cx().optional().describe("Information about the plugin creator or maintainer"),homepage:l.string().url().optional().describe("Plugin homepage or documentation URL"),repository:l.string().optional().describe("Source code repository URL"),license:l.string().optional().describe("SPDX license identifier (e.g., MIT, Apache-2.0)"),keywords:l.array(l.string()).optional().describe("Tags for plugin discovery and categorization"),defaultEnabled:l.boolean().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:l.array(Oee()).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.`)})),hRe=P(()=>l.object({description:l.string().optional().describe("Brief, user-facing explanation of what these hooks provide"),hooks:l.lazy(()=>Wo()).describe("The hooks provided by the plugin, in the same format as the one used for settings")})),cee=P(()=>l.object({hooks:l.union([Ko().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),l.lazy(()=>Wo()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)"),l.array(l.union([Ko().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),l.lazy(()=>Wo()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)")]))])})),lee=P(()=>l.object({source:Ax().optional().describe("Path to command markdown file, relative to plugin root"),content:l.string().optional().describe("Inline markdown content for the command"),description:l.string().optional().describe("Command description override"),argumentHint:l.string().optional().describe('Hint for command arguments (e.g., "[file]")'),model:l.string().optional().describe("Default model for this command"),allowedTools:l.array(l.string()).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'})),uee=P(()=>l.object({commands:l.union([Ax().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."),l.array(Ax().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."),l.record(l.string(),lee()).describe('Object mapping of command names to their metadata and source files. Command name becomes the slash command name (e.g., "about" → "/plugin:about")')])})),dee=P(()=>l.object({agents:l.union([Ox().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."),l.array(Ox().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.")])})),pee=P(()=>l.object({skills:l.union([Sr().describe("Path to a skill directory, relative to the plugin root. Loaded in addition to the skills/ directory."),l.array(Sr().describe("Path to a skill directory, relative to the plugin root. Loaded in addition to the skills/ directory.")).describe("List of skill directory paths, loaded in addition to the skills/ directory.")])})),YD=P(()=>l.object({outputStyles:l.union([Sr().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."),l.array(Sr().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.")])})),QD=P(()=>l.object({themes:l.union([Sr().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."),l.array(Sr().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.")])})),fee=P(()=>l.object({})),KD=P(()=>l.string().min(1)),mee=P(()=>l.string().min(2).refine((e)=>e.startsWith("."),{message:'File extensions must start with dot (e.g., ".ts", not "ts")'})),gee=P(()=>l.object({mcpServers:l.union([Ko().describe("MCP servers to include in the plugin (in addition to those in the .mcp.json file, if it exists)"),WD().describe("Path or URL to MCPB file containing MCP server configuration"),l.record(l.string(),og()).describe("MCP server configurations keyed by server name"),l.array(l.union([Ko().describe("Path to MCP servers configuration file"),WD().describe("Path or URL to MCPB file"),l.record(l.string(),og()).describe("Inline MCP server configurations")])).describe("Array of MCP server configurations (paths, MCPB files, or inline definitions)")])})),ej=P(()=>l.object({type:l.enum(["string","number","boolean","directory","file"]).describe("Type of the configuration value"),title:l.string().describe("Human-readable label shown in the config dialog"),description:l.string().describe("Help text shown beneath the field in the config dialog"),required:l.boolean().optional().describe("If true, validation fails when this field is empty"),default:l.union([l.string(),l.number(),l.boolean(),l.array(l.string())]).optional().describe("Default value used when the user provides nothing"),multiple:l.boolean().optional().describe("For string type: allow an array of strings"),sensitive:l.boolean().optional().describe("If true, masks dialog input and stores value in secure storage (keychain/credentials file) instead of settings.json"),min:l.number().optional().describe("Minimum value (number type only)"),max:l.number().optional().describe("Maximum value (number type only)")}).strict()),hee=P(()=>l.object({userConfig:l.record(l.string().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"),ej()).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.")})),yee=P(()=>l.object({channels:l.array(l.object({server:l.string().min(1).describe("Name of the MCP server this channel binds to. Must match a key in this plugin's mcpServers."),displayName:l.string().optional().describe('Human-readable name shown in the config dialog title (e.g., "Telegram"). Defaults to the server name.'),userConfig:l.record(l.string(),ej()).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.")})),GD=P(()=>l.strictObject({command:l.string().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:l.array(KD()).optional().describe("Command-line arguments to pass to the server"),extensionToLanguage:l.record(mee(),KD()).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:l.enum(["stdio","socket"]).default("stdio").describe("Communication transport mechanism"),env:l.record(l.string(),l.string()).optional().describe("Environment variables to set when starting the server"),initializationOptions:l.unknown().optional().describe("Initialization options passed to the server during initialization"),settings:l.unknown().optional().describe("Settings passed to the server via workspace/didChangeConfiguration"),workspaceFolder:l.string().optional().describe("Workspace folder path to use for the server"),startupTimeout:l.number().int().positive().optional().describe("Maximum time to wait for server startup (milliseconds)"),shutdownTimeout:l.number().int().positive().optional().describe("Maximum time to wait for graceful shutdown (milliseconds)"),restartOnCrash:l.boolean().optional().describe("Whether to restart the server if it crashes"),maxRestarts:l.number().int().nonnegative().optional().describe("Maximum number of restart attempts before giving up")})),bee=P(()=>l.strictObject({name:l.string().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:l.string().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:l.string().min(1).describe("Short human-readable description of what is being monitored (shown in task panel and notification summary)."),when:l.union([l.literal("always"),l.string().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).')})),_ee=P(()=>l.array(bee()).refine((e)=>new Set(e.map((t)=>t.name)).size===e.length,{message:"Monitor names must be unique within a plugin"})),tj=P(()=>l.object({monitors:l.union([Ko().describe("Path to a JSON file containing the monitors array, relative to the plugin root"),_ee()]).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.")})),vee=P(()=>l.object({lspServers:l.union([Ko().describe("Path to .lsp.json configuration file relative to plugin root"),l.record(l.string(),GD()).describe("LSP server configurations keyed by server name"),l.array(l.union([Ko().describe("Path to LSP configuration file"),l.record(l.string(),GD()).describe("Inline LSP server configurations")])).describe("Array of LSP server configurations (paths or inline definitions)")])})),rj=P(()=>l.string().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-._]*$/,r=/^[a-z0-9][a-z0-9-._]*$/;return t.test(e)||r.test(e)},"Invalid npm package name format")),See=P(()=>l.object({settings:l.record(l.string(),l.unknown()).optional().describe("Settings to merge into the user settings while this plugin is enabled. Only the documented allowlisted keys are applied.")})),xee=P(()=>l.object({experimental:l.preprocess((e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?e:void 0,l.object({...QD().partial().shape,...tj().partial().shape,...YD().partial().shape,evals:l.union([l.string(),l.array(l.string())]).optional().describe("Path(s) to evaluation query files for `claude plugin eval`. Defaults to `evals/`.")}).optional().describe("Components whose manifest shape may change without a deprecation cycle. Move a key out of here once it is promoted to stable."))})),wee=P(()=>l.object({...aee().shape,...cee().partial().shape,...uee().partial().shape,...dee().partial().shape,...pee().partial().shape,...YD().partial().shape,...QD().partial().shape,...fee().shape,...yee().partial().shape,...gee().partial().shape,...vee().partial().shape,...tj().partial().shape,...See().partial().shape,...hee().partial().shape,...xee().partial().shape})),eu=P(()=>l.discriminatedUnion("source",[l.object({source:l.literal("url"),url:l.string().url().describe("Direct URL to marketplace.json file"),headers:l.record(l.string(),l.string()).optional().describe("Custom HTTP headers (e.g., for authentication)")}),l.object({source:l.literal("github"),repo:l.string().describe("GitHub repository in owner/repo format"),ref:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:l.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:l.array(l.string()).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:l.boolean().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.")}),l.object({source:l.literal("git"),url:l.string().describe("Full git repository URL"),ref:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:l.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:l.array(l.string()).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:l.boolean().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.")}),l.object({source:l.literal("npm"),package:rj().describe("NPM package containing marketplace.json")}),l.object({source:l.literal("file"),path:l.string().describe("Local file path to marketplace.json")}),l.object({source:l.literal("directory"),path:l.string().describe("Local directory containing .claude-plugin/marketplace.json")}),l.object({source:l.literal("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."),l.object({source:l.literal("hostPattern"),hostPattern:l.string().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$").')}),l.object({source:l.literal("pathPattern"),pathPattern:l.string().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.')}),l.object({source:l.literal("settings"),name:XD().refine((e)=>!JD.has(e.toLowerCase()),{message:"Reserved official 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:l.array(kee()).describe("Plugin entries declared inline in settings.json"),owner:Cx().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).")])),$x=P(()=>l.string().length(40).regex(/^[a-f0-9]{40}$/,"Must be a full 40-character lowercase git commit SHA")),nj=P(()=>l.union([l.preprocess((e)=>e==="."?"./":e,Sr()).describe("Path to the plugin root, relative to the marketplace root (the directory containing .claude-plugin/, not .claude-plugin/ itself)"),l.object({source:l.literal("npm"),package:rj().or(l.string().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:l.string().optional().describe("Specific version or version range (e.g., ^1.0.0, ~2.1.0)"),registry:l.string().url().optional().describe("Custom NPM registry URL (defaults to using system default, likely npmjs.org)")}).describe("NPM package as plugin source"),l.object({source:l.literal("url"),url:l.string().describe("Full git repository URL (https:// or git@)"),ref:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:$x().optional().describe("Specific commit SHA to use")}),l.object({source:l.literal("github"),repo:l.string().describe("GitHub repository in owner/repo format"),ref:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:$x().optional().describe("Specific commit SHA to use")}),l.object({source:l.literal("git-subdir"),url:l.string().describe("Git repository: GitHub owner/repo shorthand, https://, or git@ URL"),path:l.string().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:l.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:$x().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."),l.object({source:l.literal("unsupported")}).describe("Placeholder for source types this Claude Code version does not "+"recognize. 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 a clear "update Claude Code" message.')])),kee=P(()=>l.object({name:l.string().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:nj().describe("Where to fetch the plugin from. Must be a remote source — relative "+"paths have no marketplace repository to resolve against."),description:l.string().optional(),version:l.string().optional(),strict:l.boolean().optional()}).refine((e)=>typeof e.source!=="string",{message:'Plugins in a settings-sourced marketplace must use remote sources (github, git-subdir, npm, url). 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)."}));var Eee=P(()=>l.object({cli:l.array(l.string().max(64)).max(10).optional().describe('First command tokens (e.g. ["stripe"]) — exact match against commands run this session.'),hosts:l.array(l.string().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:l.array(l.string().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:l.array(l.object({file:l.string().max(256),pattern:l.string().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:l.array(l.string().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.`)})),Tee=P(()=>l.object({topic:l.string().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:Eee().optional().describe("Matchers that determine when the plugin is relevant.")})),Pee=P(()=>wee().partial().extend({name:l.string().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:nj().describe("Where to fetch the plugin from"),category:l.string().optional().describe('Category for organizing plugins (e.g., "productivity", "development")'),tags:l.array(l.string()).optional().describe("Tags for searchability and discovery"),strict:l.boolean().optional().default(!0).describe("Require the plugin manifest to be present in the plugin folder. If false, the marketplace entry provides the manifest."),relevance:l.preprocess((e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?e:void 0,Tee().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.`)})),Iee=P(()=>l.object({name:l.string().min(1).refine((e)=>!e.includes(" "))}));function Ree(e){let t=Pee();return e.flatMap((r,o)=>{let n=t.safeParse(r);if(n.success)return[n.data];let i=Iee().safeParse(r).data?.name,s=n.error.issues.map((a)=>`${a.path.join(".")}: ${a.message}`).join(", ");if(i)return ne(`Stubbing unparseable marketplace plugin entry (${i}): ${s}`,{level:"warn"}),[{name:i,source:{source:"unsupported"},strict:!0}];return ne(`Dropping unparseable marketplace plugin entry (index ${o}): ${s}`,{level:"warn"}),[]})}var yRe=P(()=>l.object({$schema:l.string().optional().describe("JSON Schema reference for editor autocomplete/validation; ignored at load time"),name:XD(),version:l.string().optional().describe("Marketplace manifest version"),description:l.string().optional().describe("Human-readable description of this marketplace"),owner:Cx().describe("Marketplace maintainer or curator information"),plugins:l.array(l.unknown()).transform(Ree).describe("Collection of available plugins in this marketplace"),forceRemoveDeletedPlugins:l.boolean().optional().describe("When true, plugins removed from this marketplace will be automatically uninstalled and flagged for users"),metadata:l.object({pluginRoot:l.string().optional().describe("Base path for relative plugin sources"),version:l.string().optional().describe("Marketplace version"),description:l.string().optional().describe("Marketplace description")}).optional().describe("Optional marketplace metadata"),allowCrossMarketplaceDependenciesOn:l.array(l.string()).optional().describe("Marketplace names whose plugins may be auto-installed as dependencies. Only the root marketplace's allowlist applies — no transitive trust.")})),oj=P(()=>l.string().regex(/^[A-Za-z0-9][-A-Za-z0-9._]*@[A-Za-z0-9][-A-Za-z0-9._]*$/,"Plugin ID must be in format: plugin@marketplace")),$ee=/^[A-Za-z0-9][-A-Za-z0-9._]*(@[A-Za-z0-9][-A-Za-z0-9._]*)?(@\^[^@]*)?$/,Oee=P(()=>l.union([l.string().regex($ee,"Dependency must be a plugin name, optionally qualified with @marketplace").transform((e)=>e.replace(/@\^[^@]*$/,"")),l.object({name:l.string().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/),marketplace:l.string().min(1).regex(/^[A-Za-z0-9][-A-Za-z0-9._]*$/).optional()}).loose().transform((e)=>e.marketplace?`${e.name}@${e.marketplace}`:e.name)])),Aee=P(()=>l.object({version:l.string().describe("Currently installed version"),installedAt:l.string().describe("ISO 8601 timestamp of installation"),lastUpdated:l.string().optional().describe("ISO 8601 timestamp of last update"),installPath:l.string().describe("Absolute path to the installed plugin directory"),gitCommitSha:l.string().optional().describe("Git commit SHA for git-based plugins (for version tracking)"),resolvedVersion:l.string().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:l.boolean().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).")})),Cee=P(()=>l.object({version:l.literal(1).describe("Schema version 1"),plugins:l.record(oj(),Aee()).describe("Map of plugin IDs to their installation metadata")})),Mee=P(()=>l.enum(["managed","user","project","local"])),Nee=P(()=>l.object({scope:Mee().describe("Installation scope"),projectPath:l.string().optional().describe("Project path (required for project/local scopes)"),installPath:l.string().describe("Absolute path to the versioned plugin directory"),version:l.string().optional().describe("Currently installed version"),installedAt:l.string().optional().describe("ISO 8601 timestamp of installation"),lastUpdated:l.string().optional().describe("ISO 8601 timestamp of last update"),gitCommitSha:l.string().optional().describe("Git commit SHA for git-based plugins"),resolvedVersion:l.string().optional().describe("Tag-derived semver this install resolved to"),auto:l.boolean().optional().describe("True when pulled in as a dependency. Eligible for orphan sweep.")})),Dee=P(()=>l.object({version:l.literal(2).describe("Schema version 2"),plugins:l.record(oj(),l.array(Nee())).describe("Map of plugin IDs to arrays of installation entries")})),bRe=P(()=>l.union([Cee(),Dee()])),jee=P(()=>l.object({source:eu().describe("Where to fetch the marketplace from"),installLocation:l.string().describe("Local cache path where marketplace manifest is stored"),lastUpdated:l.string().describe("ISO 8601 timestamp of last marketplace refresh"),autoUpdate:l.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),_Re=P(()=>l.record(l.string(),jee()));var ij=["userSettings","projectSettings","localSettings","flagSettings","policySettings"];var sj="https://json.schemastore.org/claude-code-settings.json";var zee=["autoMode","deepLink","voice","assistant","briefView","screenReader"],tu={},ig={autoMode:{buildGate:()=>!1,shape:()=>tu,permissionsShape:()=>tu,permissionModes:()=>[]},deepLink:{buildGate:()=>!0,shape:()=>({disableDeepLinkRegistration:l.enum(["disable"]).optional().describe("Prevent claude-cli:// protocol handler registration with the OS")})},voice:{buildGate:()=>!1,shape:()=>tu},assistant:{buildGate:()=>!1,shape:()=>tu},briefView:{buildGate:()=>!0,shape:()=>({defaultView:l.enum(["chat","transcript"]).optional().describe("Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)")})},screenReader:{buildGate:()=>!1,shape:()=>tu}};function Mx(){return zee.filter((e)=>ig[e].buildGate())}function aj(e){let t={};for(let r of e)t={...t,...ig[r].shape()};return t}function cj(e){let t={};for(let r of e)t={...t,...ig[r].permissionsShape?.()};return t}function lj(e){let t=[];for(let r of e)t.push(...ig[r].permissionModes?.()??[]);return t}function Nx(e){let t=e.split("__"),[r,o,...n]=t;if(r!=="mcp"||!o)return null;let i=n.length>0?n.join("__"):void 0;return{serverName:o,toolName:i}}var uj={Task:"Agent",KillShell:"TaskStop",KillBash:"TaskStop",AgentOutputTool:"TaskOutput",BashOutputTool:"TaskOutput",AgentOutput:"TaskOutput",BashOutput:"TaskOutput",ListPeers:"ListAgents",Brief:"SendUserMessage",ListMcpResources:"ListMcpResourcesTool",ReadMcpResource:"ReadMcpResourceTool"};function $s(e){return Object.hasOwn(uj,e)?uj[e]:e}var dj="workspace",CRe=`mcp__${dj}__bash`,MRe=`mcp__${dj}__web_fetch`;function Dx(e){return e.includes("*")}function Uee(e){return e.replaceAll("\\(","(").replaceAll("\\)",")").replaceAll("\\\\","\\")}function pj(e){let t=Lee(e,"(");if(t===-1)return{toolName:$s(e)};let r=Fee(e,")");if(r===-1||r<=t)return{toolName:$s(e)};if(r!==e.length-1)return{toolName:$s(e)};let o=e.substring(0,t),n=e.substring(t+1,r);if(!o)return{toolName:$s(e)};if(n===""||n==="*")return{toolName:$s(o)};let i=Uee(n);return{toolName:$s(o),ruleContent:i}}function Lee(e,t){for(let r=0;r<e.length;r++)if(e[r]===t){let o=0,n=r-1;while(n>=0&&e[n]==="\\")o++,n--;if(o%2===0)return r}return-1}function Fee(e,t){for(let r=e.length-1;r>=0;r--)if(e[r]===t){let o=0,n=r-1;while(n>=0&&e[n]==="\\")o++,n--;if(o%2===0)return r}return-1}var sg={filePatternTools:["Read","Write","Edit","Glob","NotebookRead","NotebookEdit"],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 fj(e){return sg.filePatternTools.includes(e)}function mj(e){return sg.bashPrefixTools.includes(e)}function gj(e){return Object.hasOwn(sg.customValidation,e)?sg.customValidation[e]:void 0}function yj(e,t){let r=0,o=t-1;while(o>=0&&e[o]==="\\")r++,o--;return r%2!==0}function jx(e,t){let r=0;for(let o=0;o<e.length;o++)if(e[o]===t&&!yj(e,o))r++;return r}function Hee(e){for(let t=0;t<e.length-1;t++)if(e[t]==="("&&e[t+1]===")"){if(!yj(e,t))return!0}return!1}function hj(e){if(!Dx(e))return null;let t=Nx(e);if(t&&!Dx(t.serverName)&&t.toolName==="*")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__*"]}}function zx(e,t){if(!e||e.trim()==="")return{valid:!1,error:"Permission rule cannot be empty"};let r=jx(e,"("),o=jx(e,")");if(r!==o)return{valid:!1,error:"Mismatched parentheses",suggestion:"Ensure all opening parentheses have matching closing parentheses"};if(Hee(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 n=pj(e),i=Nx(n.toolName);if(i){if(n.ruleContent!==void 0||jx(e,"(")>0)return{valid:!1,error:"MCP rules do not support patterns in parentheses",suggestion:`Use "${n.toolName}" without parentheses, or use "mcp__${i.serverName}__*" for all tools`,examples:[`mcp__${i.serverName}`,`mcp__${i.serverName}__*`,i.toolName&&i.toolName!=="*"?`mcp__${i.serverName}__${i.toolName}`:void 0].filter(Boolean)};if(t==="allow"){let a=hj(n.toolName);if(a)return a}return{valid:!0}}if(!n.toolName||n.toolName.length===0)return{valid:!1,error:"Tool name cannot be empty"};if(t==="allow"){let a=hj(n.toolName);if(a)return a}if(!n.toolName.includes("_")&&n.toolName[0]!==n.toolName[0]?.toUpperCase())return{valid:!1,error:"Tool names must start with uppercase",suggestion:`Use "${_h(String(n.toolName))}"`};let s=gj(n.toolName);if(s&&n.ruleContent!==void 0){let a=s(n.ruleContent);if(!a.valid)return a}if(mj(n.toolName)&&n.ruleContent!==void 0){let a=n.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(fj(n.toolName)&&n.ruleContent!==void 0){let a=n.ruleContent;if(a.includes(":*"))return{valid:!1,error:'The ":*" syntax is only for Bash prefix rules',suggestion:'Use glob patterns like "*" or "**" for file matching',examples:[`${n.toolName}(*.ts) - matches .ts files`,`${n.toolName}(src/**) - matches all files in src`,`${n.toolName}(**/*.test.ts) - matches test files`]};if(a.includes("*")&&!a.match(/^\*|\*$|\*\*|\/\*|\*\.|\*\)/)&&!a.includes("**"))return{valid:!1,error:"Wildcard placement might be incorrect",suggestion:"Wildcards are typically used at path boundaries",examples:[`${n.toolName}(*.js) - all .js files`,`${n.toolName}(src/*) - all files directly in src`,`${n.toolName}(src/**) - all files recursively in src`]}}return{valid:!0}}var Ux=P(()=>_j()),bj=P(()=>_j("allow"));function _j(e){return l.string().superRefine((t,r)=>{let o=zx(t,e);if(!o.valid){let n=o.error;if(o.suggestion)n+=`. ${o.suggestion}`;if(o.examples&&o.examples.length>0)n+=`. Examples: ${o.examples.join(", ")}`;r.addIssue({code:l.ZodIssueCode.custom,message:n,params:{received:t}})}})}var Bee=P(()=>l.record(l.string(),l.coerce.string()));function wj(e){return l.object({allow:l.array(bj()).optional().describe("List of permission rules for allowed operations"),deny:l.array(Ux()).optional().describe("List of permission rules for denied operations"),ask:l.array(Ux()).optional().describe("List of permission rules that should always prompt for confirmation"),defaultMode:l.enum([...Yl,...lj(e)]).optional().describe("Default permission mode when Claude Code needs access"),disableBypassPermissionsMode:l.enum(["disable"]).optional().describe("Disable the ability to bypass permission prompts"),...cj(e),additionalDirectories:l.array(l.string()).optional().describe("Additional directories to include in the permission scope")}).passthrough()}var r0e=P(()=>wj(Mx())),qee=P(()=>l.object({source:eu().describe("Where to fetch the marketplace from"),installLocation:l.string().optional().describe("Local cache path where marketplace manifest is stored (auto-generated if not provided)"),autoUpdate:l.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),ag=P(()=>l.object({serverName:l.string().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:l.array(l.string()).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:l.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers')}).refine((e)=>{return Ly([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"'})),cg=P(()=>l.object({serverName:l.string().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that is explicitly blocked"),serverCommand:l.array(l.string()).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:l.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers')}).refine((e)=>{return Ly([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"'})),Zee=P(()=>l.object({path:l.string().describe("Absolute path to the helper executable"),timeoutMs:l.number().int().min(1000).optional(),refreshIntervalMs:l.union([l.literal(0),l.number().int().min(60000)]).optional()})),vj=["skills","agents","hooks","mcp"];function kj(e){return l.object({$schema:l.literal(sj).optional().describe("JSON Schema reference for Claude Code settings"),apiKeyHelper:l.string().optional().describe("Path to a script that outputs authentication values"),proxyAuthHelper:l.string().optional().describe("Shell command that outputs a Proxy-Authorization header value (EAP)"),awsCredentialExport:l.string().optional().describe("Path to a script that exports AWS credentials"),awsAuthRefresh:l.string().optional().describe("Path to a script that refreshes AWS authentication"),gcpAuthRefresh:l.string().optional().describe("Command to refresh GCP authentication (e.g., gcloud auth application-default login)"),policyHelper:Zee().optional().describe("Executable that computes managed settings at startup. Honored only from admin-controlled policy sources."),...Ee(process.env.CLAUDE_CODE_ENABLE_XAA)&&{xaaIdp:l.object({issuer:l.string().url().describe("IdP issuer URL for OIDC discovery"),clientId:l.string().describe("Claude Code's client_id registered at the IdP"),callbackPort:l.number().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:l.object({type:l.literal("command"),command:l.string()}).optional().describe("Custom file suggestion configuration for @ mentions"),respectGitignore:l.boolean().optional().describe("Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected."),breakReminder:l.object({enabled:l.boolean().optional().describe("Show a friendly nudge after sustained continuous use (default false). Must be true for the reminder to fire."),intervalMinutes:l.number().int().positive().optional().describe("Minutes of continuous use before the reminder fires (default 120). Re-fires every interval until you take a break."),breakThresholdMinutes:l.number().int().positive().optional().describe("Minutes of inactivity that count as a break and reset the timer (default 15)"),message:l.string().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:l.object({enabled:l.boolean().optional().describe("Show a one-time nudge when you start or keep using the CLI inside your quiet-hours window (default false)."),start:l.string().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:l.string().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:l.number().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."),skillListingMaxDescChars:l.number().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:l.number().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:l.boolean().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:Bee().optional().describe("Environment variables to set for Claude Code sessions"),attribution:l.object({commit:l.string().optional().describe("Attribution text for git commits, including any trailers. Empty string hides attribution."),pr:l.string().optional().describe("Attribution text for pull request descriptions. Empty string hides attribution.")}).optional().describe("Customize attribution text for commits and PRs. Each field defaults to the standard Claude Code attribution if not set."),includeCoAuthoredBy:l.boolean().optional().describe("Deprecated: Use attribution instead. Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)"),...!1,includeGitInstructions:l.boolean().optional().describe("Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)"),permissions:wj(e).optional().describe("Tool usage permissions configuration"),model:l.string().optional().describe("Override the default model used by Claude Code"),fallbackModel:l.array(l.string()).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:l.array(l.string()).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.'),modelOverrides:l.record(l.string(),l.string()).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.'),enableAllProjectMcpServers:l.boolean().optional().describe("Whether to automatically approve all MCP servers in the project"),enabledMcpjsonServers:l.array(l.string()).optional().describe("List of approved MCP servers from .mcp.json"),disabledMcpjsonServers:l.array(l.string()).optional().describe("List of rejected MCP servers from .mcp.json"),skillOverrides:l.record(l.string(),l.enum(["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.'),allowedMcpServers:l.array(ag()).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:l.array(cg()).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:Wo().optional().describe("Custom commands to run before/after tool executions"),worktree:l.object({symlinkDirectories:l.array(l.string()).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:l.array(l.string()).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:l.enum(["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:l.enum(["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.")}).optional().describe("Git worktree configuration for --worktree flag."),disableAllHooks:l.boolean().optional().describe("Disable all hooks and statusLine execution"),disableAgentView:l.boolean().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:l.boolean().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:l.boolean().optional().describe("Disable the Workflows feature (also via CLAUDE_CODE_DISABLE_WORKFLOWS)."),enableWorkflows:l.boolean().optional().describe("Enable or disable the Workflows feature for this user. Unset = default by plan once the feature is available."),workflowKeywordTriggerEnabled:l.boolean().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:l.boolean().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:l.enum(["bash","powershell"]).optional().describe("Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip)."),allowManagedHooksOnly:l.boolean().optional().describe("When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored."),allowedHttpHookUrls:l.array(l.string()).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:l.array(l.string()).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:l.boolean().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:l.boolean().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:l.boolean().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:l.preprocess((t)=>Array.isArray(t)?t.filter((r)=>vj.includes(r)):t,l.union([l.boolean(),l.array(l.enum(vj))])).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:l.object({type:l.literal("command"),command:l.string(),padding:l.number().optional(),refreshInterval:l.number().min(1).optional().catch(void 0).describe("Re-run the status line command every N seconds in addition to event-driven updates"),hideVimModeIndicator:l.boolean().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:l.string().optional().describe('URL template for PR links in the footer badge and inline messages. Placeholders: {host} {owner} {repo} {number} {url}. Example: "https://reviews.example.com/{owner}/{repo}/pull/{number}"'),subagentStatusLine:l.object({type:l.literal("command"),command:l.string()}).optional().describe("Custom per-subagent status line shown in the agent panel; receives row context as JSON on stdin"),enabledPlugins:l.record(l.string(),l.union([l.array(l.string()),l.boolean(),l.undefined()])).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:l.record(l.string(),qee()).check((t)=>{for(let[r,o]of Object.entries(t.value))if(o.source.source==="settings"&&o.source.name!==r)t.issues.push({code:"custom",input:o.source.name,path:[r,"source","name"],message:`Settings-sourced marketplace name must match its extraKnownMarketplaces key (got key "${r}" but source.name "${o.source.name}")`})}).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."),strictKnownMarketplaces:l.array(eu()).optional().describe("Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these exact sources can be added as marketplaces. 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."),blockedMarketplaces:l.array(eu()).optional().describe("Enterprise blocklist of marketplace sources. When set in managed settings, these exact sources are blocked from being added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem."),pluginSuggestionMarketplaces:l.array(l.string()).optional().describe("Marketplace names whose plugins may surface as contextual install suggestions (relevance-based tips), in addition to the official marketplace. 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."),forceLoginMethod:l.enum(["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:l.string().url().optional().catch(void 0).describe('@internal Cloud gateway URL to pre-fill and auto-connect to during login. Typically set in local managed settings alongside forceLoginMethod: "gateway" so users never type the URL. Hidden from public SDK types until Cloud gateway is documented.'),parentSettingsBehavior:l.enum(["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).`),forceLoginOrgUUID:l.union([l.string(),l.array(l.string())]).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:l.boolean().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:l.string().optional().describe("Path to a script that outputs OpenTelemetry headers"),outputStyle:l.string().optional().describe("Controls the output style for assistant responses"),viewMode:l.enum(["default","verbose","focus"]).optional().catch(void 0).describe("Default transcript view mode on startup"),language:l.string().optional().describe('Preferred language for Claude responses and voice dictation (e.g., "japanese", "spanish")'),skipWebFetchPreflight:l.boolean().optional().describe("Skip the WebFetch blocklist check for enterprise environments with restrictive security policies"),sandbox:jD().optional(),feedbackSurveyRate:l.number().min(0).max(1).optional().describe("Probability (0–1) that the session quality survey appears when eligible. 0.05 is a reasonable starting point."),spinnerTipsEnabled:l.boolean().optional().describe("Whether to show tips in the spinner"),spinnerVerbs:l.object({mode:l.enum(["append","replace"]),verbs:l.array(l.string())}).optional().describe('Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.'),spinnerTipsOverride:l.object({excludeDefault:l.boolean().optional(),tips:l.array(l.string())}).optional().describe("Override spinner tips. tips: array of tip strings. excludeDefault: if true, only show custom tips (default: false)."),syntaxHighlightingDisabled:l.boolean().optional().describe("Whether to disable syntax highlighting in diffs"),terminalTitleFromRename:l.boolean().optional().describe("Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles."),alwaysThinkingEnabled:l.boolean().optional().describe("When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models."),effortLevel:l.enum(["low","medium","high","xhigh"]).optional().catch(void 0).describe("Persisted effort level for supported models."),ultracode:l.boolean().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:l.number().int().min(1e5).max(1e6).optional().catch(void 0).describe("Auto-compact window size"),advisorModel:l.string().optional().describe("Advisor model for the server-side advisor tool."),fastMode:l.boolean().optional().describe("When true, fast mode is enabled. When absent or false, fast mode is off."),fastModePerSessionOptIn:l.boolean().optional().describe("When true, fast mode does not persist across sessions. Each session starts with fast mode off."),promptSuggestionEnabled:l.boolean().optional().describe("When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled."),awaySummaryEnabled:l.boolean().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:l.boolean().optional().describe('When true, the plan-approval dialog offers a "clear context" option. Defaults to false.'),agent:l.string().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."),companyAnnouncements:l.array(l.string()).optional().describe("Company announcements to display at startup (one will be randomly selected if multiple are provided)"),pluginConfigs:l.record(l.string(),l.object({mcpServers:l.record(l.string(),l.record(l.string(),l.union([l.string(),l.number(),l.boolean(),l.array(l.string())]))).optional().describe("User configuration values for MCP servers keyed by server name"),options:l.record(l.string(),l.union([l.string(),l.number(),l.boolean(),l.array(l.string())])).optional().describe("Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.")})).optional().describe("Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)"),remote:l.object({defaultEnvironmentId:l.string().optional().describe("Default environment ID to use for remote sessions")}).optional().describe("Remote session configuration"),autoUpdatesChannel:l.enum(["latest","stable","rc"]).optional().describe("Release channel for auto-updates (latest or stable)"),minimumVersion:l.string().optional().describe("Minimum version to stay on - prevents downgrades when switching to stable channel"),requiredMinimumVersion:l.string().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:l.string().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:l.string().optional().describe("Custom directory for plan files, relative to project root. If not set, defaults to ~/.claude/plans/"),tui:l.enum(["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:l.object({enabled:l.boolean().optional(),mode:l.enum(["hold","tap"]).optional().describe("'hold' (default): hold to talk. 'tap': tap to start, tap to stop+submit."),autoSubmit:l.boolean().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:l.boolean().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:l.array(l.object({marketplace:l.string(),plugin:l.string()})).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:l.boolean().optional().describe("Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)"),doneMeansMerged:l.boolean().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."),autoMemoryEnabled:l.boolean().optional().describe("Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory."),autoMemoryDirectory:l.string().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:l.boolean().optional().describe("Enable background memory consolidation (auto-dream). When set, overrides the server-side default."),showThinkingSummaries:l.boolean().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:l.boolean().optional().describe("Whether the user has accepted the bypass permissions mode dialog"),skipWorkflowUsageWarning:l.boolean().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:l.enum(["disable"]).optional().describe("Disable auto mode"),sshConfigs:l.array(l.object({id:l.string().describe("Unique identifier for this SSH config. Used to match configs across settings sources."),name:l.string().describe("Display name for the SSH connection"),sshHost:l.string().describe('SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config'),sshPort:l.number().int().optional().describe("SSH port (default: 22)"),sshIdentityFile:l.string().optional().describe("Path to SSH identity file (private key)"),startDirectory:l.string().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:l.string().optional().describe("CLAUDE.md-style instructions injected as organization-managed memory. Only honored from managed/policy settings."),claudeMdExcludes:l.array(l.string()).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:l.string().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:l.union([l.enum(FD),l.string().startsWith("custom:").transform((t)=>t)]).optional().catch(void 0).describe("Color theme for the UI"),editorMode:l.enum(UD).optional().catch(void 0).describe("Key binding mode for the prompt input"),verbose:l.boolean().optional().describe("Show full tool output instead of truncated summaries"),preferredNotifChannel:l.enum(zD).optional().catch(void 0).describe("Preferred OS notification channel"),autoCompactEnabled:l.boolean().optional().describe("Automatically compact conversation when context fills"),switchModelsOnFlag:l.boolean().optional().describe("When safety measures flag a message, automatically switch to a different model to keep chatting. When off, your session will pause instead."),autoScrollEnabled:l.boolean().optional().describe("Auto-scroll the conversation view to bottom (fullscreen mode only)"),fileCheckpointingEnabled:l.boolean().optional().describe("Snapshot files before edits so /rewind can restore them"),showTurnDuration:l.boolean().optional().describe('Show "Cooked for Nm Ns" after each assistant turn'),showMessageTimestamps:l.boolean().optional().describe("Stamp each assistant message with its arrival time"),terminalProgressBarEnabled:l.boolean().optional().describe("Emit OSC 9;4 progress sequences during long operations"),todoFeatureEnabled:l.boolean().optional().describe("Enable the todo / task tracking panel"),teammateMode:l.enum(LD).optional().catch(void 0).describe("How spawned teammates execute (tmux, in-process, auto)"),remoteControlAtStartup:l.boolean().optional().describe("Start Remote Control bridge automatically each session"),isolatePeerMachines:l.boolean().optional().describe("Require explicit approval before SendMessage can reach a peer session on another machine via Remote Control"),daemonColdStart:l.enum(["transient","ask"]).optional().describe("When no background service is running: 'transient' spawns one for this login session; 'ask' offers to install it persistently"),autoUploadSessions:l.boolean().optional().describe("Mirror local sessions to claude.ai as view-only (no remote control)"),inputNeededNotifEnabled:l.boolean().optional().describe("Push to mobile when a permission prompt or question is waiting"),agentPushNotifEnabled:l.boolean().optional().describe("Allow Claude to push proactive mobile notifications"),...aj(e)}).passthrough()}var xr=P(()=>kj(Mx())),Sj=Object.freeze({serverName:"invalid-entry-stripped"});function xj(e,t,r){return l.array(t.catch((o)=>{return r({path:`${e}[]`,message:`Invalid entry was ignored: ${o.issues[0]?.message??"failed validation"}`}),Sj})).transform((o)=>o.filter((n)=>n!==Sj)).optional()}function Ej(e){let t=xr(),r={};for(let[n,i]of Object.entries(t.shape))r[n]=i.catch((s)=>{e({path:n,message:`${s.issues[0]?.message??"Failed schema validation"}. This field was ignored.`});return});return r.allowedMcpServers=xj("allowedMcpServers",ag(),e).catch(()=>{return e({path:"allowedMcpServers",message:'"allowedMcpServers" was present but invalid; enforcing an empty allowlist (no MCP servers admitted) until it is fixed.'}),[]}),r.deniedMcpServers=xj("deniedMcpServers",cg(),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.allowManagedMcpServersOnly=t.shape.allowManagedMcpServersOnly.catch(()=>{return e({path:"allowManagedMcpServersOnly",message:'"allowManagedMcpServersOnly" was present but invalid; treating it as true until it is fixed.'}),!0}),r.forceLoginOrgUUID=t.shape.forceLoginOrgUUID.catch(()=>{return e({path:"forceLoginOrgUUID",message:'"forceLoginOrgUUID" was present but invalid; no organization is permitted to log in until it is fixed.'}),[]}),l.object(r).passthrough().transform((n)=>{for(let i of Object.keys(n))if(n[i]===void 0)delete n[i];return n})}var sn="https://code.claude.com/docs/en",Vee=[{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:`${sn}/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:`${sn}/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:`${sn}/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:`${sn}/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:`${sn}/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:`${sn}/iam#working-directories`}}],Wee={permissions:`${sn}/iam#configuring-permissions`,env:`${sn}/settings#environment-variables`,hooks:`${sn}/hooks`};function Tj(e){let t=Vee.find((o)=>o.matches(e));if(!t)return null;let r={...t.tip};if(e.code==="invalid_value"&&e.enumValues&&!r.suggestion)r.suggestion=`Valid values: ${e.enumValues.map((o)=>`"${o}"`).join(", ")}`;if(!r.docLink&&e.path)r.docLink=Wee[vh(e.path,".")];return r}var _0e=P(()=>xr().strict());function Pj(e){return e.code==="invalid_type"}function Ij(e){return e.code==="invalid_value"}function Kee(e){return e.code==="unrecognized_keys"}function Rj(e){return e.code==="too_small"}function Os(e){if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";return typeof e}function $j(e){let t=e.match(/received (\w+)/);return t?t[1]:void 0}function Jn(e,t){return e.issues.map((r)=>{let o=r.path.map(String).join("."),n=r.message,i,s,a,c,u;if(Ij(r))s=r.values.map((p)=>String(p)),a=s.join(" | "),c=void 0,u=void 0;else if(Pj(r)){a=r.expected;let p=$j(r.message);c=p??Os(r.input),u=p??Os(r.input)}else if(Rj(r))a=String(r.minimum);else if(r.code==="custom"&&"params"in r)c=r.params.received,u=c;let d=Tj({path:o,code:r.code,expected:a,received:c,enumValues:s,message:r.message,value:c});if(Ij(r))i=s?.map((p)=>`"${p}"`).join(", "),n=`Invalid value. Expected one of: ${i}`;else if(Pj(r)){let p=$j(r.message)??Os(r.input);if(r.expected==="object"&&p==="null"&&o==="")n="Invalid or malformed JSON";else n=`Expected ${r.expected}, but received ${p}`}else if(Kee(r)){let p=r.keys.join(", ");n=`Unrecognized ${uT(r.keys.length,"field")}: ${p}`}else if(Rj(r))n=`Number must be greater than or equal to ${r.minimum}`,i=String(r.minimum);return{file:t,path:o,message:n,expected:i,invalidValue:u,suggestion:d?.suggestion,docLink:d?.docLink}})}function Gee(e,t){if(!e||typeof e!=="object")return[];let r=e;if(!r.permissions||typeof r.permissions!=="object")return[];let o=r.permissions,n=[];for(let i of["allow","deny","ask"]){let s=o[i];if(!Array.isArray(s))continue;o[i]=s.filter((a)=>{if(typeof a!=="string")return n.push({file:t,path:`permissions.${i}`,message:`Non-string value in ${i} array was removed`,severity:"warning",invalidValue:a}),!1;let c=zx(a,i);if(!c.valid){let u=`Invalid permission rule "${a}" was skipped: ${c.error}`;if(c.suggestion)u+=`. ${c.suggestion}`;return n.push({file:t,path:`permissions.${i}`,message:u,severity:"warning",invalidValue:a}),!1}return!0})}return n}var Jee=new Set(Xo);function Xee(e,t){if(!e||typeof e!=="object")return[];let r=e;if(!("hooks"in r))return[];if(r.hooks===null||typeof r.hooks!=="object"||Array.isArray(r.hooks)){let i=Os(r.hooks);return delete r.hooks,[{file:t,path:"hooks",message:`"hooks" must be an object mapping event names to matcher arrays; received ${i}. This field was ignored.`,severity:"warning",invalidValue:i,docLink:"https://code.claude.com/docs/en/hooks"}]}let o=r.hooks,n=[];for(let i of Object.keys(o)){if(!Jee.has(i)){delete o[i],n.push({file:t,path:`hooks.${i}`,message:`Unknown hook event "${i}" was ignored. Valid events: ${Xo.join(", ")}`,severity:"warning",invalidValue:i,docLink:"https://code.claude.com/docs/en/hooks"});continue}if(!Array.isArray(o[i])){let s=Os(o[i]);delete o[i],n.push({file:t,path:`hooks.${i}`,message:`Hook event "${i}" must be an array of matchers; received ${s}. This entry was ignored.`,severity:"warning",invalidValue:s,docLink:"https://code.claude.com/docs/en/hooks"})}}if(n.length>0&&Object.keys(o).length===0)delete r.hooks;return n}var Yee=[{key:"allowedMcpServers",schema:ag},{key:"deniedMcpServers",schema:cg}];function Qee(e,t){if(!e||typeof e!=="object")return[];let r=e,o=[];for(let{key:n,schema:i}of Yee){if(!(n in r))continue;if(!Array.isArray(r[n])){let c=r[n];delete r[n],o.push({file:t,path:n,message:`"${n}" must be an array; received ${Os(c)}. This field was ignored.`,severity:"warning",invalidValue:c});continue}let s=r[n],a=[];for(let c=0;c<s.length;c++){let u=i().safeParse(s[c]);if(u.success)a.push(s[c]);else o.push({file:t,path:`${n}[${c}]`,message:`Invalid entry was ignored: ${u.error.issues[0]?.message??"failed validation"}`,severity:"warning",invalidValue:s[c]})}if(a.length<s.length)r[n]=a}return o}function an(e,t,r){return[...Gee(e,t),...Xee(e,t),...r?.skipMcpServerEntryFilter?[]:Qee(e,t)]}import{userInfo as ete}from"os";var Oj="com.anthropic.claudecode",ru="HKLM\\SOFTWARE\\Policies\\ClaudeCode",nu="HKCU\\SOFTWARE\\Policies\\ClaudeCode",Xn="Settings",Aj="/usr/bin/plutil",Cj=["-convert","json","-o","-","--"],Mj=5000,Lx="/mnt/c/Windows/System32/reg.exe",As="/mnt/c/Program Files/ClaudeCode";function lg(){if(process.platform!=="linux")return!1;if(process.env.WSL_DISTRO_NAME)return!0;try{let e=At("fs").readFileSync("/proc/version","utf8").toLowerCase();return e.includes("microsoft")||e.includes("wsl")}catch{return!1}}function Nj(){let e="";try{e=ete().username}catch{}let t=[];if(e)t.push({path:`/Library/Managed Preferences/${e}/${Oj}.plist`,label:"per-user managed preferences"});return t.push({path:`/Library/Managed Preferences/${Oj}.plist`,label:"device-level managed preferences"}),t}import{execFile as tte}from"child_process";import{existsSync as rte}from"fs";var nte=null;function ou(e,t){return new Promise((r)=>{try{tte(e,t,{encoding:"utf-8",timeout:Mj},(o,n)=>{r({stdout:n??"",code:o?1:0})})}catch{r({stdout:"",code:1})}})}function Dj(){return(async()=>{if(process.platform==="darwin"){let e=Nj(),r=(await Promise.all(e.map(async({path:o,label:n})=>{if(!rte(o))return{stdout:"",label:n,ok:!1};let{stdout:i,code:s}=await ou(Aj,[...Cj,o]);return{stdout:i,label:n,ok:s===0&&!!i}}))).find((o)=>o.ok);return{plistStdouts:r?[{stdout:r.stdout,label:r.label}]:[],hklmStdout:null,hkcuStdout:null}}if(process.platform==="win32"){let t=`${process.env.SYSTEMROOT||"C:\\Windows"}\\System32\\reg.exe`,[r,o]=await Promise.all([ou(t,["query",ru,"/v",Xn]),ou(t,["query",nu,"/v",Xn])]);return{plistStdouts:null,hklmStdout:r.code===0?r.stdout:null,hkcuStdout:o.code===0?o.stdout:null}}if(lg()){let[e,t]=await Promise.all([ou(Lx,["query",ru,"/v",Xn]),ou(Lx,["query",nu,"/v",Xn])]);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 jj(){return nte}var Yn=Object.freeze({settings:{},errors:[]}),Fj=null,Hj=null,Bj=!1,ug=null;function ote(){if(ug)return;ug=(async()=>{let e=Date.now(),t=jj()??Dj(),{mdm:r,hkcu:o,wslInherits:n}=ite(await t);Fj=r,Hj=o,Bj=n;let i=Date.now()-e;if(ne(`MDM settings load completed in ${i}ms`),Object.keys(r.settings).length>0){ne(`MDM settings found: ${Object.keys(r.settings).join(", ")}`);try{Jl("info","mdm_settings_loaded",{duration_ms:i,key_count:Object.keys(r.settings).length,error_count:r.errors.length})}catch{}}})()}async function qj(){if(!ug)ote();await ug}function Zj(){return Fj??Yn}function Vj(){return Hj??Yn}function Wj(){return Bj}function Fx(e,t){let r=Tr(Is(e,!1));if(!r||typeof r!=="object")return{settings:{},errors:[]};let o=an(r,t),n=xr().safeParse(r);if(!n.success){let i=Jn(n.error,t);return{settings:{},errors:[...o,...i]}}return{settings:n.data,errors:o}}function zj(e,t="Settings"){let r=e.split(/\r?\n/),o=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp(`^\\s+${o}\\s+REG_(?:EXPAND_)?SZ\\s+(.*)$`,"i");for(let i of r){let s=i.match(n);if(s&&s[1])return s[1].trimEnd()}return null}function ite(e){let t=[];if(e.plistStdouts&&e.plistStdouts.length>0){let{stdout:s,label:a}=e.plistStdouts[0],c=Fx(s,a),{wslInheritsWindowsSettings:u,...d}=c.settings;if(Object.keys(d).length>0)return{mdm:c,hkcu:Yn,wslInherits:!1};t.push(...c.errors)}let r=null;if(e.hklmStdout){let s=zj(e.hklmStdout);if(s)r=Fx(s,`Registry: ${ru}\\${Xn}`)}if(r)t.push(...r.errors);let o=t.length>0?{settings:{},errors:t}:Yn,n=lg(),i=!1;if(n){if(i=r?.settings.wslInheritsWindowsSettings===!0||ate(),!i)return{mdm:o,hkcu:Yn,wslInherits:!1}}if(r){let{wslInheritsWindowsSettings:s,...a}=r.settings;if(Object.keys(a).length>0)return{mdm:r,hkcu:Yn,wslInherits:i}}if(ste(i))return{mdm:o,hkcu:Yn,wslInherits:i};if(e.hkcuStdout){let s=zj(e.hkcuStdout);if(s){let a=Fx(s,`Registry: ${nu}\\${Xn}`);if(!n||a.settings.wslInheritsWindowsSettings===!0){let{wslInheritsWindowsSettings:c,...u}=a.settings;return{mdm:o,hkcu:{settings:u,errors:a.errors},wslInherits:i}}if(a.errors.length>0)return{mdm:o,hkcu:{settings:{},errors:a.errors},wslInherits:i}}}return{mdm:o,hkcu:Yn,wslInherits:i}}function ste(e){if(e&&Lj(As))return!0;return Lj(Vo())}function Uj(e){let t=Tr(Is(qo(e),!1));if(!t||typeof t!=="object")return!1;an(t,e);let{wslInheritsWindowsSettings:r,...o}=t;return Object.keys(o).length>0}function ate(){function e(t){try{let r=Is(qo(t),!1);return!!r&&typeof r==="object"&&"wslInheritsWindowsSettings"in r&&r.wslInheritsWindowsSettings===!0}catch{return!1}}if(e(Cs(As,"managed-settings.json")))return!0;try{let t=Cs(As,"managed-settings.d");for(let r of Fe().readdirSync(t))if((r.isFile()||r.isSymbolicLink())&&r.name.endsWith(".json")&&!r.name.startsWith(".")&&e(Cs(t,r.name)))return!0}catch{}return!1}function Lj(e){try{if(Uj(Cs(e,"managed-settings.json")))return!0}catch{}try{let t=Cs(e,"managed-settings.d"),r=Fe().readdirSync(t);for(let o of r){if(!(o.isFile()||o.isSymbolicLink())||!o.name.endsWith(".json")||o.name.startsWith("."))continue;try{if(Uj(Cs(t,o.name)))return!0}catch{}}}catch{}return!1}function cte(e,t,r){if(r!==void 0&&!pn(e[t],r)||r===void 0&&!(t in e))xi(e,t,r)}var iu=cte;function lte(e){return function(t,r,o){var n=-1,i=Object(t),s=o(t),a=s.length;while(a--){var c=s[e?a:++n];if(r(i[c],c,i)===!1)break}return t}}var Kj=lte;var ute=Kj(),Gj=ute;function dte(e){return Kt(e)&&ki(e)}var Jj=dte;var pte="[object Object]",fte=Function.prototype,mte=Object.prototype,Xj=fte.toString,gte=mte.hasOwnProperty,hte=Xj.call(Object);function yte(e){if(!Kt(e)||kr(e)!=pte)return!1;var t=ld(e);if(t===null)return!0;var r=gte.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Xj.call(r)==hte}var Yj=yte;function bte(e,t){if(t==="constructor"&&typeof e[t]==="function")return;if(t=="__proto__")return;return e[t]}var su=bte;function _te(e){return cE(e,sd(e))}var Qj=_te;function vte(e,t,r,o,n,i,s){var a=su(e,r),c=su(t,r),u=s.get(c);if(u){iu(e,r,u);return}var d=i?i(a,c,r+"",e,t,s):void 0,p=d===void 0;if(p){var f=pt(c),m=!f&&za(c),g=!f&&!m&&od(c);if(d=c,f||m||g)if(pt(a))d=a;else if(Jj(a))d=PE(a);else if(m)p=!1,d=mh(c,!0);else if(g)p=!1,d=$E(c,!0);else d=[];else if(Yj(c)||Lr(c)){if(d=a,Lr(a))d=Qj(a);else if(!et(a)||Yo(a))d=CE(c)}else p=!1}if(p)s.set(c,d),n(d,c,o,i,s),s.delete(c);iu(e,r,d)}var ez=vte;function tz(e,t,r,o,n){if(e===t)return;Gj(t,function(i,s){if(n||(n=new aE),et(i))ez(e,t,s,r,tz,o,n);else{var a=o?o(su(e,s),i,s+"",e,t,n):void 0;if(a===void 0)a=i;iu(e,s,a)}},sd)}var rz=tz;function Ste(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var nz=Ste;var oz=Math.max;function xte(e,t,r){return t=oz(t===void 0?e.length-1:t,0),function(){var o=arguments,n=-1,i=oz(o.length-t,0),s=Array(i);while(++n<i)s[n]=o[t+n];n=-1;var a=Array(t+1);while(++n<t)a[n]=o[n];return a[t]=r(s),nz(e,this,a)}}var dg=xte;function wte(e){return function(){return e}}var iz=wte;var kte=!Si?ud:function(e,t){return Si(e,"toString",{configurable:!0,enumerable:!1,value:iz(t),writable:!0})},sz=kte;var Ete=800,Tte=16,Pte=Date.now;function Ite(e){var t=0,r=0;return function(){var o=Pte(),n=Tte-(o-r);if(r=o,n>0){if(++t>=Ete)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var az=Ite;var Rte=az(sz),pg=Rte;function $te(e,t){return pg(dg(e,t,ud),e+"")}var cz=$te;function Ote(e,t,r){if(!et(r))return!1;var o=typeof t;if(o=="number"?ki(r)&&xn(t,r.length):o=="string"&&(t in r))return pn(r[t],e);return!1}var lz=Ote;function Ate(e){return cz(function(t,r){var o=-1,n=r.length,i=n>1?r[n-1]:void 0,s=n>2?r[2]:void 0;if(i=e.length>3&&typeof i=="function"?(n--,i):void 0,s&&lz(r[0],r[1],s))i=n<3?void 0:i,n=1;t=Object(t);while(++o<n){var a=r[o];if(a)e(t,a,o,i)}return t})}var uz=Ate;var Cte=uz(function(e,t,r,o){rz(e,t,r,o)}),cn=Cte;function Mte(e,t,r,o){if(!et(e))return e;t=wn(t,e);var n=-1,i=t.length,s=i-1,a=e;while(a!=null&&++n<i){var c=Ti(t[n]),u=r;if(c==="__proto__"||c==="constructor"||c==="prototype")return e;if(n!=s){var d=a[c];if(u=o?o(d,c,a):void 0,u===void 0)u=et(d)?d:xn(t[n+1])?[]:{}}Yu(a,c,u),a=a[c]}return e}var dz=Mte;function Nte(e,t,r){var o=-1,n=t.length,i={};while(++o<n){var s=t[o],a=BE(e,s);if(r(a,s))dz(i,wn(s,e),a)}return i}var pz=Nte;function Dte(e,t){return pz(e,t,function(r,o){return VE(e,o)})}var fz=Dte;var mz=Bt?Bt.isConcatSpreadable:void 0;function jte(e){return pt(e)||Lr(e)||!!(mz&&e&&e[mz])}var gz=jte;function hz(e,t,r,o,n){var i=-1,s=e.length;r||(r=gz),n||(n=[]);while(++i<s){var a=e[i];if(t>0&&r(a))if(t>1)hz(a,t-1,r,o,n);else IE(n,a);else if(!o)n[n.length]=a}return n}var yz=hz;function zte(e){var t=e==null?0:e.length;return t?yz(e,1):[]}var bz=zte;function Ute(e){return pg(dg(e,void 0,bz),e+"")}var _z=Ute;var Lte=_z(function(e,t){return e==null?{}:fz(e,t)}),fg=Lte;import{dirname as Vte,join as eo,resolve as au}from"path";import{join as Fte}from"path";var Hte="remote-settings.json",Hx=null,Bte;function vz(){return}function qte(){return vz()??Fte(qt(),Hte)}function Zte(){try{let e=qo(qte()),t=Ze(eg(e));if(!t||typeof t!=="object"||Array.isArray(t))return null;return t}catch{return null}}function Sz(){if(!vz()&&Bte!==!0)return null;if(Hx)return Hx;let e=Zte();if(e)return Hx=e,ho(),e;return null}function Zx(e){let t=new Set(e.allowedSources);return t.add("flagSettings"),t.add("policySettings"),ij.filter((r)=>t.has(r))}function Wte(){return eo(Vo(),"managed-settings.json")}function wz(e){if(Zo()==="wsl"&&e.wslInherits?.()){let t=Bx(As);if(t.settings)return t;let r=Bx(Vo());return{settings:r.settings,errors:[...t.errors,...r.errors]}}return Bx(Vo())}function Bx(e){let t=[],r={},o=!1,{settings:n,errors:i}=mg(eo(e,"managed-settings.json"),void 0,!0);if(t.push(...i),n&&Object.keys(n).length>0)r=cn(r,n,Qn),o=!0;let s=eo(e,"managed-settings.d");try{let u=Fe().readdirSync(s).filter((d)=>(d.isFile()||d.isSymbolicLink())&&d.name.endsWith(".json")&&!d.name.startsWith(".")).map((d)=>d.name).sort();for(let d of u){let{settings:p,errors:f}=mg(eo(s,d),void 0,!0);if(t.push(...f),p&&Object.keys(p).length>0)r=cn(r,p,Qn),o=!0}}catch(u){let d=Ge(u);if(d!=="ENOENT"&&d!=="ENOTDIR")ne(`managed-settings.d read failed: ${u}`,{level:"error"})}let{wslInheritsWindowsSettings:a,...c}=r;return{settings:o&&Object.keys(c).length>0?r:null,errors:t}}function Kte(e,t){if(Sn(e))ne(`Broken symlink or missing file encountered for settings.json at path: ${t}`);else ne(`settings file read failed at ${t}: ${e}`,{level:"error"})}function mg(e,t,r){let o=XE(e);if(o)return{settings:o.settings?Tr(o.settings):null,errors:o.errors};let n=Gte(e,t,r);return YE(e,n),{settings:n.settings?Tr(n.settings):null,errors:n.errors}}function kz(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 Ez(e){let t=e?.remote?e.remote():Sz();if(!t||Object.keys(t).length===0)return{settings:null,errors:[]};let r=Tr(t),o=an(r,"remote managed settings"),n=xr().safeParse(r);if(!n.success)return{settings:null,errors:[...o,...Jn(n.error,"remote managed settings")]};return{settings:Object.keys(n.data).length>0?n.data:null,errors:o}}function Tz(e){let t=e.parentManaged;if(!t||Object.keys(t).length===0)return{settings:null,errors:[]};let r=Tr(t),o=an(r,"parent managed settings"),n=xr().safeParse(r);if(!n.success)return{settings:null,errors:[...o,...Jn(n.error,"parent managed settings")]};return Object.keys(n.data).length>0?{settings:n.data,errors:o}:{settings:null,errors:o}}function Pz(e){let t=e.flagInline;if(!t)return{settings:null,errors:[]};let r=Tr(t),o=an(r,"SDK inline settings"),n=xr().safeParse(r);if(!n.success)return{settings:null,errors:[...o,...Jn(n.error,"SDK inline settings")]};return{settings:n.data,errors:o}}function Gte(e,t,r){try{let o;if(t!==void 0)o=t;else{let{resolvedPath:a}=pd(Fe(),e);o=qo(a)}if(o.trim()==="")return{settings:{},errors:[]};let n=Tr(Is(o,!1));if(r){let a=an(n,e,{skipMcpServerEntryFilter:!0}),c=[],u=Ej((d)=>c.push({file:e,path:d.path,message:d.message,severity:"warning"})).safeParse(n);if(!u.success)return{settings:null,errors:[...a,...Jn(u.error,e)]};return{settings:u.data,errors:[...a,...c]}}let i=an(n,e),s=xr().safeParse(n);if(!s.success){let a=Jn(s.error,e);return{settings:null,errors:[...i,...a]}}return{settings:s.data,errors:i}}catch(o){return Kte(o,e),{settings:null,errors:[]}}}function xz(e,t){switch(e){case"userSettings":return au(qt());case"policySettings":case"projectSettings":case"localSettings":return au(t.cwd);case"flagSettings":return t.flagPath?Vte(au(t.flagPath)):au(t.cwd)}}function Jte(e){if(e.coworkPlugins||Ee(process.env.CLAUDE_CODE_USE_COWORK_PLUGINS))return"cowork_settings.json";return"settings.json"}function cu(e,t){switch(e){case"userSettings":return eo(xz(e,t),Jte(t));case"projectSettings":case"localSettings":return eo(xz(e,t),Xte(e));case"policySettings":return Wte();case"flagSettings":return t.flagPath}}function Xte(e){switch(e){case"projectSettings":return eo(".claude","settings.json");case"localSettings":return eo(".claude","settings.local.json")}}function Iz(e,t){let r=GE(e);if(r!==void 0)return r;let o=tre(e,t);return JE(e,o),o}function Yte(e){return!e||e.parentSettingsBehavior==="merge"}function Qte(e,t){let r={};if(e.allowManagedHooksOnly===!0)r.allowManagedHooksOnly=!0;if(e.allowManagedMcpServersOnly===!0)r.allowManagedMcpServersOnly=!0;if(e.allowManagedPermissionRulesOnly===!0)r.allowManagedPermissionRulesOnly=!0;let o=e.strictPluginOnlyCustomization;if(o===!0||Array.isArray(o)&&o.length>0)r.strictPluginOnlyCustomization=o;if(e.deniedMcpServers)r.deniedMcpServers=e.deniedMcpServers;if(t.forceLoginOrgUUID===void 0&&e.forceLoginOrgUUID)r.forceLoginOrgUUID=e.forceLoginOrgUUID;if(t.allowedMcpServers===void 0&&e.allowedMcpServers)r.allowedMcpServers=e.allowedMcpServers;if(e.permissions){let n=fg(e.permissions,["deny","ask"]);if(e.permissions.disableBypassPermissionsMode==="disable")n.disableBypassPermissionsMode="disable";if(t.allowManagedPermissionRulesOnly!==!0){let{allow:i,additionalDirectories:s}=e.permissions;if(i&&t.sandbox?.network?.allowManagedDomainsOnly!==!0)n.allow=i;if(s)n.additionalDirectories=s}if(Object.keys(n).length>0)r.permissions=n}if(e.sandbox){let{network:n,filesystem:i}=e.sandbox,s={};if(e.sandbox.enabled===!0)s.enabled=!0;if(e.sandbox.failIfUnavailable===!0)s.failIfUnavailable=!0;if(e.sandbox.allowUnsandboxedCommands===!1)s.allowUnsandboxedCommands=!1;if(e.sandbox.autoAllowBashIfSandboxed===!1)s.autoAllowBashIfSandboxed=!1;if(n){let a=fg(n,["deniedDomains"]);if(n.allowManagedDomainsOnly===!0)a.allowManagedDomainsOnly=!0;if(t.sandbox?.network?.allowManagedDomainsOnly!==!0&&n.allowedDomains)a.allowedDomains=n.allowedDomains;if(Object.keys(a).length>0)s.network=a}if(i){let a=fg(i,["denyRead","denyWrite"]);if(i.allowManagedReadPathsOnly===!0)a.allowManagedReadPathsOnly=!0;if(t.sandbox?.filesystem?.allowManagedReadPathsOnly!==!0&&i.allowRead)a.allowRead=i.allowRead;if(Object.keys(a).length>0)s.filesystem=a}if(Object.keys(s).length>0)r.sandbox=s}return r}function Rz(e){if(e.helper?.())return"helper";if(Ez(e).settings)return"remote";if(kz(e).settings)return Zo()==="macos"?"plist":"hklm";if((e.file?.()??wz(e)).settings)return"file";if(Tz(e).settings)return"parent";let t=e.hkcu?.();return t&&Object.keys(t.settings).length>0?"hkcu":null}function ere(e){let t=[],{settings:r,errors:o}=Ez(e);t.push(...o);let{settings:n,errors:i}=kz(e);t.push(...i);let{settings:s,errors:a}=e.file?.()??wz(e);t.push(...a);let{settings:c,errors:u}=Tz(e);t.push(...u);let d=[r,n,s].filter((g)=>g!==null),p=d[0]??null,f={allowManagedPermissionRulesOnly:d.some((g)=>g.allowManagedPermissionRulesOnly===!0)||void 0,forceLoginOrgUUID:d.find((g)=>g.forceLoginOrgUUID!==void 0)?.forceLoginOrgUUID,allowedMcpServers:d.find((g)=>g.allowedMcpServers!==void 0)?.allowedMcpServers,sandbox:{network:{allowManagedDomainsOnly:d.some((g)=>g.sandbox?.network?.allowManagedDomainsOnly===!0)||void 0},filesystem:{allowManagedReadPathsOnly:d.some((g)=>g.sandbox?.filesystem?.allowManagedReadPathsOnly===!0)||void 0}}},m=c&&Yte(p)?Qte(c,f):null;return{tiers:d,admin:p,parentSlice:m,errors:t}}function $z(e){let t=e.helper?.();if(t)return{settings:t,errors:e.helperWarnings?.()??[]};let{admin:r,parentSlice:o,errors:n}=ere(e);if(!r&&!o){let i=e.hkcu?.();if(i&&Object.keys(i.settings).length>0)return{settings:i.settings,errors:[...n,...i.errors]};return{settings:null,errors:[...n,...i?.errors??[]]}}return{settings:cn({},o??{},r??{},Qn),errors:n}}function tre(e,t){if(e==="policySettings")return $z(t).settings;let r=cu(e,t),{settings:o}=r?mg(r,e==="flagSettings"?t.flagExpectedContent:void 0):{settings:null};if(e==="flagSettings"){let{settings:n}=Pz(t);if(n)return cn(o||{},n,Qn)}return o}function rre(e,t){return Cd([...e,...t])}function Qn(e,t,r){if(Array.isArray(e)&&Array.isArray(t)){if(r==="fallbackModel")return t;return rre(e,t)}return}var qx=!1;function nre(e){if(qx)return{settings:{},errors:[]};let t=Date.now();Jl("info","settings_load_started"),qx=!0;try{let r=QE(),o={};if(r)o=cn(o,r,Qn);let n=[],i=new Set,s=new Set;for(let a of Zx(e)){if(a==="policySettings"){let{settings:u,errors:d}=$z(e);if(u)o=cn(o,u,Qn);for(let p of d){let f=`${p.file}:${p.path}:${p.message}`;if(!i.has(f))i.add(f),n.push(p)}continue}let c=cu(a,e);if(c){let u=au(c);if(!s.has(u)){s.add(u);let{settings:d,errors:p}=mg(c,a==="flagSettings"?e.flagExpectedContent:void 0);for(let f of p){let m=`${f.file}:${f.path}:${f.message}`;if(!i.has(m))i.add(m),n.push(f)}if(d)o=cn(o,d,Qn)}}if(a==="flagSettings"){let{settings:u,errors:d}=Pz(e);for(let p of d){let f=`${p.file}:${p.path}:${p.message}`;if(!i.has(f))i.add(f),n.push(p)}if(u)o=cn(o,u,Qn)}}return Jl("info","settings_load_completed",{duration_ms:Date.now()-t,source_count:s.size,error_count:n.length}),{settings:o,errors:n}}finally{qx=!1}}function ore(e){let t=WE();if(t!==null)return t;let r=nre(e);return KE(r),r}function ire(e){let{settings:t}=ore(e);return t||{}}function Oz(e){ho();let t=[];for(let r of Zx(e)){let o=Iz(r,e);if(o&&Object.keys(o).length>0)t.push({source:r,settings:o})}return{effective:ire(e),sources:t}}function Az(e,t){let r=Zx(t);for(let o=r.length-1;o>=0;o--){let n=r[o];if(Iz(n,t)?.[e]!==void 0)return n}return null}var are={user:"userSettings",project:"projectSettings",local:"localSettings"},Cz={userSettings:"user",projectSettings:"project",localSettings:"local",flagSettings:"flag",policySettings:"managed"},cre=["user","project","local"],lre=new Set(["bypassPermissions","auto","acceptEdits"]),ure=new Set(["project"]);function dre(e){let t=e.effective.permissions?.defaultMode;if(!t||!lre.has(t))return e.effective;for(let r=e.sources.length-1;r>=0;r--){let o=e.sources[r];if(o.settings.permissions?.defaultMode!==void 0){if(ure.has(o.source)){let{defaultMode:n,...i}=e.effective.permissions??{};return{...e.effective,permissions:i}}return e.effective}}return e.effective}async function Mz(e={}){await qj();let t={cwd:sre(e.cwd??Fe().cwd()),allowedSources:(e.settingSources??cre).map((r)=>are[r]),parentManaged:e.managedSettings??null,flagInline:null,flagPath:void 0,mdm:Zj,hkcu:Vj,wslInherits:Wj,...e.serverManagedSettings!==void 0&&{remote:()=>e.serverManagedSettings}};try{let{effective:r,sources:o}=Oz(t),n=Rz(t)??void 0,i=o.map(({source:a,settings:c})=>({source:Cz[a],settings:c,path:a==="policySettings"?void 0:cu(a,t),...a==="policySettings"&&{policyOrigin:n}})),s={};for(let a of Object.keys(r)){let c=Az(a,t);if(c)s[a]={source:Cz[c],path:c==="policySettings"?void 0:cu(c,t),...c==="policySettings"&&{policyOrigin:n}}}return{effective:r,provenance:s,sources:i}}finally{ho()}}process.env.NoDefaultCurrentDirectoryInExePath="1";async function BAe(e){return Mz(e)}async function xre(e,t){try{await gre(e,t)}catch(r){if(!Sn(r))throw r}}async function wre(e,t){if(!e)return;let r=e;try{let o=Ze(e);if(o?.claudeAiOauth?.refreshToken)delete o.claudeAiOauth.refreshToken,r=pe(o)}catch{}await Fz(t,r,{mode:384})}function kre(){if(process.platform!=="darwin")return Promise.resolve(void 0);let e=a0(s0);return new Promise((t)=>{pre("security",["find-generic-password","-a",c0(),"-w","-s",e],{encoding:"utf-8",timeout:5000},(r,o)=>t(r?void 0:o.trim()||void 0))})}async function qz(e,t,r,o,n=60000){if(!Se(t))return;let i=rr(r),s=await Cr(e.load({projectKey:i,sessionId:t}),n,`SessionStore.load() timed out after ${n}ms for session ${t}`);if(!s||s.length===0)return;let a=Lt(_re(),`claude-resume-${Xx()}`);try{let c=Lt(a,"projects",i);await Vx(c,{recursive:!0});let u=Lt(c,`${t}.jsonl`);await Xa(u,s);let d=o?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR,p=d??Lt(Wx(),".claude"),f;try{f=await Lz(Lt(p,".credentials.json"),"utf-8")}catch(m){if(!Sn(m))throw m}if(!d&&!(o??process.env).ANTHROPIC_API_KEY&&!(o??process.env).CLAUDE_CODE_OAUTH_TOKEN)f=await kre()??f;if(await wre(f,Lt(a,".credentials.json")),await xre(Lt(d??Wx(),".claude.json"),Lt(a,".claude.json")),e.listSubkeys){let m=Lt(c,t),g=await Cr(e.listSubkeys({projectKey:i,sessionId:t}),n,`SessionStore.listSubkeys() timed out after ${n}ms for session ${t}`);for(let h of g){let y=lu(m,h+".jsonl");if(!h||Hz(h)||h.split(/[\\/]/).includes("..")||!y.startsWith(m+Yx)){ne(`[SessionStore] skipping unsafe subpath from listSubkeys: ${h}`,{level:"warn"});continue}let v=await Cr(e.load({projectKey:i,sessionId:t,subpath:h}),n,`SessionStore.load() timed out after ${n}ms for session ${t} subpath ${h}`);if(!v||v.length===0)continue;let x=[],w=[];for(let O of v)if(Jx(O))x.push(O);else w.push(O);if(w.length>0)await Vx(Nz(y),{recursive:!0}),await Xa(y,w);if(x.length>0){let O=x.at(-1),L=lu(m,h+".meta.json");await Vx(Nz(L),{recursive:!0});let{type:se,...Ue}=O;await Fz(L,pe(Ue),{mode:384})}}}return a}catch(c){throw await gg(a),c}}function Kx(e,t,r,o){let{systemPrompt:n,settings:i,managedSettings:s,settingSources:a,sandbox:c,...u}=e??{},d,p,f;if(n===void 0)d="";else if(typeof n==="string")d=n;else if(Array.isArray(n))d=n;else if(n.type==="preset")p=n.append,f=n.excludeDynamicSections;process.env.CLAUDE_AGENT_SDK_VERSION="0.3.167";let{abortController:m=Fs(),additionalDirectories:g=[],agent:h,agents:y,allowedTools:v=[],betas:x,canUseTool:w,continue:O,cwd:L,debug:se,debugFile:Ue,disallowedTools:Ye=[],tools:Ft,env:bt,executable:to=gu()?"bun":"node",executableArgs:Go=[],extraArgs:Or={},fallbackModel:Ms,enableFileCheckpointing:ln,toolConfig:V,forkSession:uu,hooks:du,includeHookEvents:Ns,includePartialMessages:Ds,forwardSubagentText:js,onElicitation:pu,onUserDialog:qe,persistSession:nr,sessionStore:Qe,sessionStoreFlush:Gz,thinking:zs,effort:Jz,maxThinkingTokens:yg,maxTurns:Xz,maxBudgetUsd:Yz,taskBudget:Qz,mcpServers:Qx,model:eU,outputFormat:ew,permissionMode:tU="default",allowDangerouslySkipPermissions:rU=!1,permissionPromptToolName:nU,plugins:oU,getOAuthToken:tw,getHostAuthToken:rw,workload:nw,resume:ow,resumeSessionAt:iU,sessionId:sU,skills:iw,stderr:aU,strictMcpConfig:cU}=u;if(Qe&&nr===!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(Qe&&O&&!ow&&!Qe.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");if(Qe&&ln)throw Error("enableFileCheckpointing is not yet supported with sessionStore (backup blobs are not mirrored, so rewindFiles() fails after a store-backed resume).");if(Qe&&u.spawnClaudeCodeProcess)ne("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"});let bg=u.pathToClaudeCodeExecutable;if(!bg){let Ot=Sre(import.meta.url),or=bre(Ot),ro=RT((Jo)=>or.resolve(Jo));if(!ro)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.`);bg=ro}let sw=ew?.type==="json_schema"?ew.schema:void 0,dt=bt?{...bt}:{...process.env};if(!dt.CLAUDE_CODE_ENTRYPOINT)dt.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(!dt.CLAUDE_AGENT_SDK_VERSION)dt.CLAUDE_AGENT_SDK_VERSION="0.3.167";if(ln)dt.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true";if(tw)dt.CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH="1";if(rw)dt.CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH="1";if(V?.askUserQuestion?.previewFormat)dt.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT=V.askUserQuestion.previewFormat;let _g={};if(hg.propagation.inject(hg.context.active(),_g),"traceparent"in _g){for(let Ot of["TRACEPARENT","TRACESTATE"])if(!(Ot in(bt??{})))delete dt[Ot]}for(let[Ot,or]of Object.entries(_g)){let ro=Ot.toUpperCase();if(!(ro in(bt??{})))dt[ro]=or}let aw={},cw=new Map;if(Qx)for(let[Ot,or]of Object.entries(Qx))if(or.type==="sdk"&&or.instance)cw.set(Ot,or.instance);else aw[Ot]=or;let Us;if(zs)switch(zs.type){case"adaptive":Us={type:"adaptive",display:zs.display};break;case"enabled":Us={type:"enabled",budgetTokens:zs.budgetTokens,display:zs.display};break;case"disabled":Us={type:"disabled"};break}else if(yg!==void 0)Us=yg===0?{type:"disabled"}:{type:"enabled",budgetTokens:yg};if(r){if(dt.CLAUDE_CONFIG_DIR=r,process.platform==="win32")dt.CLAUDE_SECURESTORAGE_CONFIG_DIR=bt?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??bt?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??""}let lw=new Rh({abortController:m,additionalDirectories:g,agent:h,betas:x,cwd:L,debug:se,debugFile:Ue,executable:to,executableArgs:Go,extraArgs:nw?{...Or,workload:nw}:Or,pathToClaudeCodeExecutable:bg,env:dt,forkSession:uu,stderr:aU,thinkingConfig:Us,effort:Jz,maxTurns:Xz,maxBudgetUsd:Yz,taskBudget:Qz,model:eU,fallbackModel:Ms,jsonSchema:sw,permissionMode:tU,allowDangerouslySkipPermissions:rU,permissionPromptToolName:nU,continueConversation:Qe?void 0:O,resume:ow,resumeSessionAt:iU,sessionId:sU,settings:typeof i==="object"?pe(i):i,managedSettings:s?pe(s):void 0,settingSources:a,skills:iw,allowedTools:v,disallowedTools:Ye,tools:Ft,mcpServers:aw,strictMcpConfig:cU,canUseTool:!!w,hooks:!!du,includeHookEvents:Ns,includePartialMessages:Ds,persistSession:nr,sessionMirror:!!Qe,plugins:oU,sandbox:c,spawnClaudeCodeProcess:u.spawnClaudeCodeProcess,deferSpawn:o}),lU={systemPrompt:d,appendSystemPrompt:p,planModeInstructions:u.planModeInstructions,appendSubagentSystemPrompt:u.appendSubagentSystemPrompt,toolAliases:u.toolAliases,excludeDynamicSections:f,agents:y,title:u.title,skills:iw,webSearchIsolationExemptMcpServers:u.webSearchIsolationExemptMcpServers,promptSuggestions:u.promptSuggestions,agentProgressSummaries:u.agentProgressSummaries,forwardSubagentText:js},vg=new Ch(lw,t,w,du,m,cw,sw,lU,pu,tw,rw,qe);if(Qe){let Ot=()=>Lt(dt.CLAUDE_CONFIG_DIR??Lt(Wx(),".claude"),"projects"),or=Gz==="eager",ro=new Mh(async(Jo,Sg)=>{let Ls=Uz(Jo,Ot());if(Ls)await Qe.append(Ls,Sg);else ne(`[SessionStore] dropping mirror frame: filePath ${Jo} is not under ${Ot()} -- subprocess CLAUDE_CONFIG_DIR likely differs from parent (custom spawnClaudeCodeProcess / container?)`,{level:"warn"})},void 0,(Jo,Sg)=>{let Ls=Uz(Jo,Ot());if(Ls)vg.reportMirrorError(Ls,Sg.message)},or?0:bd,or?0:_d);vg.setTranscriptMirrorBatcher(ro)}return{queryInstance:vg,transport:lw,abortController:m,processEnv:dt}}function Gx(e,t,r,o){if(typeof r==="string")t.write(pe({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:r}]},parent_tool_use_id:null})+`
116
+ `);else e.streamInput(r).catch((n)=>o.abort(n))}var Ere=new Set(["EBUSY","EMFILE","ENFILE","ENOTEMPTY","EPERM"]);async function gg(e){for(let t=0;;t++)try{return await yre(e,{recursive:!0,force:!0})}catch(r){if(t>=4||!Ere.has(Ge(r)??""))return;await fu((t+1)*100)}}function Tre(e,t){e.waitForExit().catch(()=>{}).finally(()=>gg(t))}function qAe({prompt:e,options:t}){if((t?.resume||t?.continue)&&t?.sessionStore){let{queryInstance:i,transport:s,abortController:a,processEnv:c}=Kx({...t},typeof e==="string",void 0,!0),u=lu(t.cwd??"."),d=t.sessionStore,p=t.loadTimeoutMs??60000,f=t.resume;return(async()=>{if(!f)f=(await Cr(d.listSessions(rr(u)),p,`SessionStore.listSessions() timed out after ${p}ms`)).slice().sort((h,y)=>y.mtime-h.mtime)[0]?.sessionId;if(!f)return;return qz(d,f,u,t.env,t.loadTimeoutMs)})().then((g)=>{if(g){s.updateResume(f);let h={CLAUDE_CONFIG_DIR:g};if(process.platform==="win32"){let y=t.env?.CLAUDE_SECURESTORAGE_CONFIG_DIR??process.env.CLAUDE_SECURESTORAGE_CONFIG_DIR??t.env?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR??"";h.CLAUDE_SECURESTORAGE_CONFIG_DIR=y,c.CLAUDE_SECURESTORAGE_CONFIG_DIR=y}s.updateEnv(h),c.CLAUDE_CONFIG_DIR=g,i.addCleanupCallback(()=>Tre(s,g))}if(!i.isClosed())s.spawn()}).catch((g)=>{let h=Er(g);s.spawnAbort(h),i.setError(h)}),Gx(i,s,e,a),i}let{queryInstance:r,transport:o,abortController:n}=Kx(t,typeof e==="string");return Gx(r,o,e,n),r}async function ZAe({options:e,initializeTimeoutMs:t=60000}={}){let r,o=e?.resume;if((o||e?.continue)&&e?.sessionStore){let a=lu(e.cwd??".");if(!o){if(!e.sessionStore.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");let c=e.loadTimeoutMs??60000;o=(await Cr(e.sessionStore.listSessions(rr(a)),c,`SessionStore.listSessions() timed out after ${c}ms`)).slice().sort((d,p)=>p.mtime-d.mtime)[0]?.sessionId}if(o)r=await qz(e.sessionStore,o,a,e.env,e.loadTimeoutMs)}let n,i,s;try{let f=function(){if(p)return;p=!0,d.close()},a=Kx(r&&o&&o!==e?.resume?{...e,resume:o}:e,!1,r);n=a.queryInstance;let{transport:c,abortController:u}=a;i=c;let d=a.queryInstance;if(r){let m=r;d.addCleanupCallback(()=>{s=c.waitForExit().catch(()=>{}).then(()=>gg(m))})}await Cr(d.initializationResult(),t,`Subprocess initialization did not complete within ${t}ms — check authentication and network connectivity`);let p=!1;return{query(m){if(p)throw Error("WarmQuery.query() can only be called once");p=!0;try{Gx(d,c,m,u)}catch(g){throw d.close(),g}if(typeof m==="string")d.setIsSingleUserTurn(!0);return d},close:f,async[Symbol.asyncDispose](){p=!0,d.close(),await s}}}catch(a){if(n?.close(),r&&!s){let c=i;s=(c?c.waitForExit().catch(()=>{}):Promise.resolve()).then(()=>gg(r))}throw await s,a}}async function VAe(e,t){if(t?.sessionStore)return $re(t.sessionStore,e,t);return jR(e,t)}async function WAe(e){if(e?.sessionStore)return Ire(e.sessionStore,e);return UR(e)}async function KAe(e,t){if(t?.sessionStore)return Ore(t.sessionStore,e,t);return LR(e,t)}async function GAe(e,t,r){if(r?.sessionStore)return Are(r.sessionStore,e,t,r.dir);return qR(e,t,r)}async function JAe(e,t,r){if(r?.sessionStore)return Cre(r.sessionStore,e,t,r.dir);return ZR(e,t,r)}async function XAe(e,t){if(!Se(e))throw Error(`Invalid sessionId: ${e}`);if(t?.sessionStore){if(!t.sessionStore.delete)return;let r=rr(t.dir);await t.sessionStore.delete({projectKey:r,sessionId:e});return}return VR(e,t)}async function YAe(e,t){if(t?.sessionStore)return Mre(t.sessionStore,e,t);return GR(e,t)}async function QAe(e,t,r){if(!Se(e))throw Error(`Invalid sessionId: ${e}`);let o=await En(e,r?.dir);if(!o)throw Error(`Session ${e} not found`);let n=rr(r?.dir),i=r?.batchSize&&r.batchSize>0?r.batchSize:bd;if(await Dz(o.filePath,{projectKey:n,sessionId:e},t,i),r?.includeSubagents===!1)return;let s=o.filePath.replace(/\.jsonl$/,""),a=Lt(s,"subagents");for(let c of await Pre(a)){let u=Bz(s,c).split(Yx);u[u.length-1]=u.at(-1).replace(/\.jsonl$/,"");let d={projectKey:n,sessionId:e,subpath:u.join("/")};await Dz(c,d,t,i);let p=c.replace(/\.jsonl$/,".meta.json");try{let f=Ze(await Lz(p,"utf8"));await t.append(d,[{type:"agent_metadata",...f}])}catch(f){if(!Sn(f))throw f}}}async function Dz(e,t,r,o){let n=vre({input:fre(e,{encoding:"utf8"}),crlfDelay:1/0}),i=[],s=0;for await(let a of n){if(!a)continue;if(i.push(Ze(a)),s+=a.length,i.length>=o||s>=_d)await r.append(t,i),i=[],s=0}if(i.length>0)await r.append(t,i)}async function Pre(e){let t=[];async function r(o){let n;try{n=await hre(o,{withFileTypes:!0})}catch{return}for(let i of n){let s=Lt(o,i.name);if(i.isDirectory())await r(s);else if(i.isFile()&&i.name.endsWith(".jsonl"))t.push(s)}}return await r(e),t}async function eCe(e,t){if(t?.sessionStore)return Nre(t.sessionStore,e,t.dir);return t0(e,t)}async function tCe(e,t,r){if(r?.sessionStore)return Dre(r.sessionStore,e,t,r);return r0(e,t,r)}function Zz(e){let t=lu(e??"."),r;try{r=mre(t)}catch{r=t}return Ar(r)}function rr(e){return wo(Zz(e))}function Vz(e){return e.map((t)=>pe(t)).join(`
117
117
  `)+`
118
- `}function $z(e,t,r){if(t!==void 0&&t>0)return e.slice(r,r+t);if(r>0)return e.slice(r);return e}function Kx(e){return typeof e==="object"&&e!==null&&"type"in e&&e.type==="agent_metadata"}async function Sre(e,t){let r=zz(t.dir),o=So(r),n=t.offset??0,i=t.limit;if(e.listSessionSummaries){let u=await e.listSessionSummaries(o),d=e.listSessions?new Map((await e.listSessions(o)).map((g)=>[g.sessionId,g])):void 0,p=[];for(let g of u){let h=d?.get(g.sessionId);if(d&&!h)continue;let y=h!==void 0&&g.mtime<h.mtime;p.push({sessionId:g.sessionId,mtime:y?h.mtime:g.mtime,info:y?void 0:mw(g,r)})}if(d){let g=new Set(u.map((h)=>h.sessionId));for(let[h,y]of d)if(!g.has(h))p.push({sessionId:h,mtime:y.mtime})}else ne("listSessionSummaries without listSessions: gap-fill skipped; sessions lacking a sidecar will be omitted");p.sort((g,h)=>h.mtime-g.mtime);let f=$z(p,i,n),m=f.filter((g)=>g.info===void 0);if(m.length>0){let g=await Oz(e,m,t.dir,r),h=new Map(g.map((y)=>[y.sessionId,y]));for(let y of f)if(y.info===void 0)y.info=h.get(y.sessionId)??null}return f.flatMap((g)=>g.info?[g.info]:[])}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(o)).slice().sort((u,d)=>d.mtime-u.mtime),c=$z(a,i,n);return Oz(e,c,t.dir,r)}async function Oz(e,t,r,o){return(await Promise.allSettled(t.map(async(i)=>{let s=await Fz(e,i.sessionId,r);if(!s)return null;let a=Ci(i.sessionId,Lz(s,i.mtime),o);return a?{...a,lastModified:i.mtime}:null}))).flatMap((i,s)=>{let a=t[s];if(i.status==="fulfilled")return i.value?[i.value]:[];return[{sessionId:a.sessionId,summary:"",lastModified:a.mtime}]})}function Lz(e,t){let r=Buffer.from(e,"utf-8"),o=r.length,n=r.subarray(0,cr).toString("utf-8"),i=o>cr?r.subarray(o-cr).toString("utf-8"):n;return{mtime:t,size:o,head:n,tail:i}}function xre(e){let t=e.trimEnd(),r=t.slice(t.lastIndexOf(`
119
- `)+1);try{let o=Ze(r);if(typeof o==="object"&&o!==null&&"timestamp"in o&&typeof o.timestamp==="string"){let n=Date.parse(o.timestamp);if(!Number.isNaN(n))return n}}catch{}return Date.now()}async function Fz(e,t,r){let o=rr(r),n=await e.load({projectKey:o,sessionId:t});if(!n||n.length===0)return null;return Uz(n)}async function wre(e,t,r){if(!Se(t))return[];let o=rr(r.dir),n=await e.load({projectKey:o,sessionId:t});if(!n||n.length===0)return[];return C0(n,{limit:r.limit,offset:r.offset,includeSystemMessages:r.includeSystemMessages})}async function kre(e,t,r){if(!Se(t))return;let o=await Fz(e,t,r.dir);if(!o)return;let n=Lz(o,xre(o));return Ci(t,n)??void 0}async function Tre(e,t,r,o){if(!Se(t))throw Error(`Invalid sessionId: ${t}`);if(!r.trim())throw Error("title must be non-empty");let n=rr(o);await e.append({projectKey:n,sessionId:t},[{type:"custom-title",customTitle:r.trim(),sessionId:t,uuid:Gx(),timestamp:new Date().toISOString()}])}async function Ere(e,t,r,o){if(!Se(t))throw Error(`Invalid sessionId: ${t}`);if(r!==null){let i=_o(r).trim();if(!i)throw Error("tag must be non-empty (use null to clear)");r=i}let n=rr(o);await e.append({projectKey:n,sessionId:t},[{type:"tag",tag:r??"",sessionId:t,uuid:Gx(),timestamp:new Date().toISOString()}])}async function Pre(e,t,r){if(!Se(t))throw Error(`Invalid sessionId: ${t}`);if(r.upToMessageId&&!Se(r.upToMessageId))throw Error(`Invalid upToMessageId: ${r.upToMessageId}`);let o=rr(r.dir),n=await e.load({projectKey:o,sessionId:t});if(!n||n.length===0)throw Error(`Session ${t} not found`);let{entries:i,forkedSessionId:s}=K0(n,t,r);return await e.append({projectKey:o,sessionId:s},i),{sessionId:s}}async function Ire(e,t,r){if(!Se(t))return[];if(!e.listSubkeys)throw Error("sessionStore.listSubkeys is not implemented -- cannot list subagents. Provide a store with a listSubkeys() method.");let o=rr(r),n=await e.listSubkeys({projectKey:o,sessionId:t}),i=new Set;for(let s of n){if(!s.startsWith("subagents/"))continue;let a=s.split("/").at(-1);if(a.startsWith("agent-"))i.add(a.slice(6))}return[...i]}async function Rre(e,t,r,o){if(!Se(t))return[];if(!r)return[];let n=rr(o.dir),i=`subagents/agent-${r}`;if(e.listSubkeys){let d=await e.listSubkeys({projectKey:n,sessionId:t}),p=`agent-${r}`,f=d.find((m)=>m.startsWith("subagents/")&&m.split("/").at(-1)===p);if(!f)return[];i=f}let s=await e.load({projectKey:n,sessionId:t,subpath:i});if(!s||s.length===0)return[];let a=s.findLast(Kx),c=typeof a?.toolUseId==="string"?a.toolUseId:void 0,u=s.filter((d)=>!Kx(d));if(u.length===0)return[];return zy(Buffer.from(Uz(u)),{limit:o.limit,offset:o.offset},c)}function Az(e,t){let r=Dz(t,e),o=r.split(Jx);if(o[0]===".."||Nz(r))return null;if(o.length<2)return null;let n=o[0],i=o[1];if(o.length===2&&i.endsWith(".jsonl"))return{projectKey:n,sessionId:i.replace(/\.jsonl$/,"")};if(o.length>=4){let s=o.slice(2),a=s.length-1;return s[a]=s.at(-1).replace(/\.jsonl$/,""),{projectKey:n,sessionId:i,subpath:s.join("/")}}return null}export{iQ as tool,BAe as tagSession,zAe as startup,DAe as resolveSettings,HAe as renameSession,jAe as query,lQ as parseDirectConnectUrl,WAe as listSubagents,LAe as listSessions,VAe as importSessionToStore,KAe as getSubagentMessages,UAe as getSessionMessages,FAe as getSessionInfo,ZAe as forkSession,fu as foldSessionSummary,ore as filterEscalatingDefaultMode,qAe as deleteSession,sQ as createSdkMcpServer,SU as SYSTEM_PROMPT_DYNAMIC_BOUNDARY,kg as InMemorySessionStore,Xo as HOOK_EVENTS,vU as EXIT_REASONS,hD as DirectConnectTransport,vr as DirectConnectError,it as AbortError};
118
+ `}function jz(e,t,r){if(t!==void 0&&t>0)return e.slice(r,r+t);if(r>0)return e.slice(r);return e}function Jx(e){return typeof e==="object"&&e!==null&&"type"in e&&e.type==="agent_metadata"}async function Ire(e,t){let r=Zz(t.dir),o=wo(r),n=t.offset??0,i=t.limit;if(e.listSessionSummaries){let u=await e.listSessionSummaries(o),d=e.listSessions?new Map((await e.listSessions(o)).map((g)=>[g.sessionId,g])):void 0,p=[];for(let g of u){let h=d?.get(g.sessionId);if(d&&!h)continue;let y=h!==void 0&&g.mtime<h.mtime;p.push({sessionId:g.sessionId,mtime:y?h.mtime:g.mtime,info:y?void 0:hw(g,r)})}if(d){let g=new Set(u.map((h)=>h.sessionId));for(let[h,y]of d)if(!g.has(h))p.push({sessionId:h,mtime:y.mtime})}else ne("listSessionSummaries without listSessions: gap-fill skipped; sessions lacking a sidecar will be omitted");p.sort((g,h)=>h.mtime-g.mtime);let f=jz(p,i,n),m=f.filter((g)=>g.info===void 0);if(m.length>0){let g=await zz(e,m,t.dir,r),h=new Map(g.map((y)=>[y.sessionId,y]));for(let y of f)if(y.info===void 0)y.info=h.get(y.sessionId)??null}return f.flatMap((g)=>g.info?[g.info]:[])}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(o)).slice().sort((u,d)=>d.mtime-u.mtime),c=jz(a,i,n);return zz(e,c,t.dir,r)}async function zz(e,t,r,o){return(await Promise.allSettled(t.map(async(i)=>{let s=await Kz(e,i.sessionId,r);if(!s)return null;let a=Ci(i.sessionId,Wz(s,i.mtime),o);return a?{...a,lastModified:i.mtime}:null}))).flatMap((i,s)=>{let a=t[s];if(i.status==="fulfilled")return i.value?[i.value]:[];return[{sessionId:a.sessionId,summary:"",lastModified:a.mtime}]})}function Wz(e,t){let r=Buffer.from(e,"utf-8"),o=r.length,n=r.subarray(0,cr).toString("utf-8"),i=o>cr?r.subarray(o-cr).toString("utf-8"):n;return{mtime:t,size:o,head:n,tail:i}}function Rre(e){let t=e.trimEnd(),r=t.slice(t.lastIndexOf(`
119
+ `)+1);try{let o=Ze(r);if(typeof o==="object"&&o!==null&&"timestamp"in o&&typeof o.timestamp==="string"){let n=Date.parse(o.timestamp);if(!Number.isNaN(n))return n}}catch{}return Date.now()}async function Kz(e,t,r){let o=rr(r),n=await e.load({projectKey:o,sessionId:t});if(!n||n.length===0)return null;return Vz(n)}async function $re(e,t,r){if(!Se(t))return[];let o=rr(r.dir),n=await e.load({projectKey:o,sessionId:t});if(!n||n.length===0)return[];return NR(n,{limit:r.limit,offset:r.offset,includeSystemMessages:r.includeSystemMessages})}async function Ore(e,t,r){if(!Se(t))return;let o=await Kz(e,t,r.dir);if(!o)return;let n=Wz(o,Rre(o));return Ci(t,n)??void 0}async function Are(e,t,r,o){if(!Se(t))throw Error(`Invalid sessionId: ${t}`);if(!r.trim())throw Error("title must be non-empty");let n=rr(o);await e.append({projectKey:n,sessionId:t},[{type:"custom-title",customTitle:r.trim(),sessionId:t,uuid:Xx(),timestamp:new Date().toISOString()}])}async function Cre(e,t,r,o){if(!Se(t))throw Error(`Invalid sessionId: ${t}`);if(r!==null){let i=So(r).trim();if(!i)throw Error("tag must be non-empty (use null to clear)");r=i}let n=rr(o);await e.append({projectKey:n,sessionId:t},[{type:"tag",tag:r??"",sessionId:t,uuid:Xx(),timestamp:new Date().toISOString()}])}async function Mre(e,t,r){if(!Se(t))throw Error(`Invalid sessionId: ${t}`);if(r.upToMessageId&&!Se(r.upToMessageId))throw Error(`Invalid upToMessageId: ${r.upToMessageId}`);let o=rr(r.dir),n=await e.load({projectKey:o,sessionId:t});if(!n||n.length===0)throw Error(`Session ${t} not found`);let{entries:i,forkedSessionId:s}=JR(n,t,r);return await e.append({projectKey:o,sessionId:s},i),{sessionId:s}}async function Nre(e,t,r){if(!Se(t))return[];if(!e.listSubkeys)throw Error("sessionStore.listSubkeys is not implemented -- cannot list subagents. Provide a store with a listSubkeys() method.");let o=rr(r),n=await e.listSubkeys({projectKey:o,sessionId:t}),i=new Set;for(let s of n){if(!s.startsWith("subagents/"))continue;let a=s.split("/").at(-1);if(a.startsWith("agent-"))i.add(a.slice(6))}return[...i]}async function Dre(e,t,r,o){if(!Se(t))return[];if(!r)return[];let n=rr(o.dir),i=`subagents/agent-${r}`;if(e.listSubkeys){let d=await e.listSubkeys({projectKey:n,sessionId:t}),p=`agent-${r}`,f=d.find((m)=>m.startsWith("subagents/")&&m.split("/").at(-1)===p);if(!f)return[];i=f}let s=await e.load({projectKey:n,sessionId:t,subpath:i});if(!s||s.length===0)return[];let a=s.findLast(Jx),c=typeof a?.toolUseId==="string"?a.toolUseId:void 0,u=s.filter((d)=>!Jx(d));if(u.length===0)return[];return Uy(Buffer.from(Vz(u)),{limit:o.limit,offset:o.offset},c)}function Uz(e,t){let r=Bz(t,e),o=r.split(Yx);if(o[0]===".."||Hz(r))return null;if(o.length<2)return null;let n=o[0],i=o[1];if(o.length===2&&i.endsWith(".jsonl"))return{projectKey:n,sessionId:i.replace(/\.jsonl$/,"")};if(o.length>=4){let s=o.slice(2),a=s.length-1;return s[a]=s.at(-1).replace(/\.jsonl$/,""),{projectKey:n,sessionId:i,subpath:s.join("/")}}return null}export{pQ as tool,JAe as tagSession,ZAe as startup,BAe as resolveSettings,GAe as renameSession,qAe as query,hQ as parseDirectConnectUrl,eCe as listSubagents,WAe as listSessions,QAe as importSessionToStore,tCe as getSubagentMessages,VAe as getSessionMessages,KAe as getSessionInfo,YAe as forkSession,mu as foldSessionSummary,dre as filterEscalatingDefaultMode,XAe as deleteSession,fQ as createSdkMcpServer,IU as SYSTEM_PROMPT_DYNAMIC_BOUNDARY,Eg as InMemorySessionStore,Xo as HOOK_EVENTS,PU as EXIT_REASONS,bD as DirectConnectTransport,vr as DirectConnectError,it as AbortError};