eve 0.22.5 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/src/channel/types.d.ts +1 -1
- package/dist/src/compiled/.vendor-stamp.json +4 -4
- package/dist/src/compiled/@workflow/core/index.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/runtime/start.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/runtime/step-latency.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/runtime.js +1 -1
- package/dist/src/compiled/@workflow/core/set-attributes.d.ts +12 -7
- package/dist/src/compiled/@workflow/core/step/context-storage.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow/index.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow/set-attributes.d.ts +20 -16
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/world/recovery.d.ts +3 -2
- package/dist/src/compiled/@workflow/world-local/index.js +2 -2
- package/dist/src/compiled/@workflow/world-vercel/index.js +3 -3
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-ubiPfqvY.js → attribute-changes-Dmf_myUv.js} +2 -2
- package/dist/src/compiled/_chunks/workflow/{dist-DnBjuNAZ.js → dist-CQenixFf.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{resume-hook-BkVkWg2r.js → resume-hook-BH01MfRF.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{run-B3N1kN9q.js → run-CL3mguvM.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{sleep-C2Bn-UUg.js → sleep-BkAHCD_s.js} +1 -1
- package/dist/src/compiler/artifacts.d.ts +0 -1
- package/dist/src/compiler/artifacts.js +1 -1
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/execution/create-session-step.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
- package/dist/src/execution/durable-session-store.d.ts +0 -1
- package/dist/src/execution/node-step.d.ts +1 -1
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/run-session-limits.d.ts +1 -1
- package/dist/src/execution/sandbox/prewarm.js +1 -1
- package/dist/src/execution/session.d.ts +0 -1
- package/dist/src/execution/session.js +2 -2
- package/dist/src/execution/subagent-tool.js +1 -1
- package/dist/src/harness/advertised-tools.d.ts +1 -1
- package/dist/src/harness/advertised-tools.js +1 -1
- package/dist/src/harness/execute-tool.d.ts +1 -0
- package/dist/src/harness/subagent-depth.d.ts +2 -5
- package/dist/src/harness/subagent-depth.js +1 -1
- package/dist/src/harness/types.d.ts +1 -7
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/application/paths.d.ts +1 -0
- package/dist/src/internal/application/paths.js +1 -1
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/nitro/host/prepare-application-host.js +1 -1
- package/dist/src/internal/nitro/host/vercel-build-output-config.d.ts +1 -0
- package/dist/src/internal/nitro/host/vercel-build-output-config.js +1 -1
- package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +1 -1
- package/dist/src/public/channels/index.d.ts +14 -64
- package/dist/src/public/instrumentation/index.d.ts +1 -1
- package/dist/src/public/next/server.js +1 -1
- package/dist/src/runtime/resolve-agent-graph.js +1 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/sessions/compiled-agent-cache.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +2 -2
- package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
- package/dist/src/setup/scaffold/create/web-template.js +0 -1
- package/dist/src/shared/agent-definition.d.ts +0 -12
- package/docs/agent-config.md +8 -8
- package/docs/channels/custom.mdx +1 -3
- package/docs/concepts/default-harness.md +7 -5
- package/docs/extensions.md +1 -3
- package/docs/guides/dynamic-workflows.md +1 -1
- package/docs/guides/instrumentation.md +1 -1
- package/docs/subagents.mdx +13 -26
- package/package.json +5 -5
- package/dist/src/compiler/channel-instrumentation-types.d.ts +0 -8
- package/dist/src/compiler/channel-instrumentation-types.js +0 -2
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import{a as e,i as t,t as n}from"../../_chunks/workflow/chunk-BHKSVoKr.js";import{C as r,T as i,h as a,l as o,m as s,o as c,r as l}from"../../_chunks/workflow/dist-DpDDcpTl.js";import{$ as u,C as d,D as f,F as p,H as m,L as h,M as g,N as _,P as v,Q as y,S as b,T as x,U as S,X as C,Y as w,Z as T,b as ee,et as E,f as te,k as ne,l as D,m as re,nt as ie,p as ae,q as oe,r as se,rt as ce,tt as le,w as ue,x as de,y as fe}from"../../_chunks/workflow/dist-
|
|
1
|
+
import{a as e,i as t,t as n}from"../../_chunks/workflow/chunk-BHKSVoKr.js";import{C as r,T as i,h as a,l as o,m as s,o as c,r as l}from"../../_chunks/workflow/dist-DpDDcpTl.js";import{$ as u,C as d,D as f,F as p,H as m,L as h,M as g,N as _,P as v,Q as y,S as b,T as x,U as S,X as C,Y as w,Z as T,b as ee,et as E,f as te,k as ne,l as D,m as re,nt as ie,p as ae,q as oe,r as se,rt as ce,tt as le,w as ue,x as de,y as fe}from"../../_chunks/workflow/dist-CQenixFf.js";import{t as pe}from"../../_chunks/workflow/undici-fb54XL8i.js";import{webcrypto as me}from"node:crypto";import{inspect as he}from"node:util";import{AsyncLocalStorage as ge}from"node:async_hooks";import _e from"node:os";import*as ve from"path";import*as ye from"fs";import{createRequire as be}from"module";import*as xe from"net";var Se=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);let u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}0&&(t.exports={SYMBOL_FOR_REQ_CONTEXT:u,getContext:d})})),Ce=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{VercelOidcTokenError:()=>u}),t.exports=c(l);var u=class extends Error{constructor(e,t){super(e),this.name=`VercelOidcTokenError`,this.cause=t}toString(){return this.cause?`${this.name}: ${this.message}: ${this.cause}`:`${this.name}: ${this.message}`}};0&&(t.exports={VercelOidcTokenError:u})})),we=n(((t,n)=>{var r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},c=(e,t,n,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(r({},`__esModule`,{value:!0}),e),u={};s(u,{getVercelOidcToken:()=>p,getVercelOidcTokenSync:()=>m}),n.exports=l(u);var d=Se(),f=Ce();async function p(t){let n=``,r;try{n=m()}catch(e){r=e}try{let[{getTokenPayload:r,isExpired:i},{refreshToken:a}]=await Promise.all([await Promise.resolve().then(()=>e(ke())),await import(`../../_chunks/workflow/token-CaY0nA5J.js`).then(t=>e(t.default))]);(!n||i(r(n),t?.expirationBufferMs))&&(await a(t),n=m())}catch(e){let t=r instanceof Error?r.message:``;throw e instanceof Error&&(t=`${t}
|
|
2
2
|
${e.message}`),t?new f.VercelOidcTokenError(t):e}return n}function m(){let e=(0,d.getContext)().headers?.[`x-vercel-oidc-token`]??process.env.VERCEL_OIDC_TOKEN;if(!e)throw Error(`The 'x-vercel-oidc-token' header is missing from the request. Do you have the OIDC option enabled in the Vercel project settings?`);return e}0&&(n.exports={getVercelOidcToken:p,getVercelOidcTokenSync:m})})),Te=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>u,RefreshAccessTokenFailedError:()=>d}),t.exports=c(l);var u=class extends Error{constructor(){super(`No authentication found. Please log in with the Vercel CLI (vercel login).`),this.name=`AccessTokenMissingError`}},d=class extends Error{constructor(e){super(`Failed to refresh authentication token.`,{cause:e}),this.name=`RefreshAccessTokenFailedError`}};0&&(t.exports={AccessTokenMissingError:u,RefreshAccessTokenFailedError:d})})),Ee=n(((e,n)=>{var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of o(t))!c.call(e,s)&&s!==n&&i(e,s,{get:()=>t[s],enumerable:!(r=a(t,s))||r.enumerable});return e},d=(e,t,n)=>(n=e==null?{}:r(s(e)),u(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),f=e=>u(i({},`__esModule`,{value:!0}),e),p={};l(p,{findRootDir:()=>v,getUserDataDir:()=>y}),n.exports=f(p);var m=d(t(`path`)),h=d(t(`fs`)),g=d(t(`os`)),_=Ce();function v(){try{let e=process.cwd();for(;e!==m.default.dirname(e);){let t=m.default.join(e,`.vercel`);if(h.default.existsSync(t))return e;e=m.default.dirname(e)}}catch{throw new _.VercelOidcTokenError(`Token refresh only supported in node server environments`)}return null}function y(){if(process.env.XDG_DATA_HOME)return process.env.XDG_DATA_HOME;switch(g.default.platform()){case`darwin`:return m.default.join(g.default.homedir(),`Library/Application Support`);case`linux`:return m.default.join(g.default.homedir(),`.local/share`);case`win32`:return process.env.LOCALAPPDATA?process.env.LOCALAPPDATA:null;default:return null}}0&&(n.exports={findRootDir:v,getUserDataDir:y})})),De=n(((e,n)=>{var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of o(t))!c.call(e,s)&&s!==n&&i(e,s,{get:()=>t[s],enumerable:!(r=a(t,s))||r.enumerable});return e},d=(e,t,n)=>(n=e==null?{}:r(s(e)),u(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),f=e=>u(i({},`__esModule`,{value:!0}),e),p={};l(p,{isValidAccessToken:()=>b,readAuthConfig:()=>v,writeAuthConfig:()=>y}),n.exports=f(p);var m=d(t(`fs`)),h=d(t(`path`)),g=ke();function _(){let e=(0,g.getVercelDataDir)();if(!e)throw Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);return h.join(e,`auth.json`)}function v(){try{let e=_();if(!m.existsSync(e))return null;let t=m.readFileSync(e,`utf8`);return t?JSON.parse(t):null}catch{return null}}function y(e){let t=_(),n=h.dirname(t);m.existsSync(n)||m.mkdirSync(n,{mode:504,recursive:!0}),m.writeFileSync(t,JSON.stringify(e,null,2),{mode:384})}function b(e,t=0){if(!e.token)return!1;if(typeof e.expiresAt!=`number`)return!0;let n=Math.floor(Date.now()/1e3),r=t/1e3;return e.expiresAt>=n+r}0&&(n.exports={isValidAccessToken:b,readAuthConfig:v,writeAuthConfig:y})})),Oe=n(((e,n)=>{var r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},c=(e,t,n,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(r({},`__esModule`,{value:!0}),e),u={};s(u,{processTokenResponse:()=>g,refreshTokenRequest:()=>h}),n.exports=l(u);var d=t(`os`);let f=`@vercel/oidc node-${process.version} ${(0,d.platform)()} (${(0,d.arch)()}) ${(0,d.hostname)()}`,p=null;async function m(){if(p)return p;let e=await fetch(`https://vercel.com/.well-known/openid-configuration`,{headers:{"user-agent":f}});if(!e.ok)throw Error(`Failed to discover OAuth endpoints`);let t=await e.json();if(!t||typeof t.token_endpoint!=`string`)throw Error(`Invalid OAuth discovery response`);let n=t.token_endpoint;return p=n,n}async function h(e){let t=await m();return await fetch(t,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,"user-agent":f},body:new URLSearchParams({client_id:`cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp`,grant_type:`refresh_token`,...e})})}async function g(e){let t=await e.json();if(!e.ok){let e=typeof t==`object`&&t&&`error`in t?String(t.error):`Token refresh failed`;return[Error(e)]}return typeof t!=`object`||!t?[Error(`Invalid token response`)]:typeof t.access_token==`string`?t.token_type===`Bearer`?typeof t.expires_in==`number`?[null,t]:[Error(`Missing expires_in in response`)]:[Error(`Invalid token_type in response`)]:[Error(`Missing access_token in response`)]}0&&(n.exports={processTokenResponse:g,refreshTokenRequest:h})})),ke=n(((e,n)=>{var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of o(t))!c.call(e,s)&&s!==n&&i(e,s,{get:()=>t[s],enumerable:!(r=a(t,s))||r.enumerable});return e},d=(e,t,n)=>(n=e==null?{}:r(s(e)),u(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),f=e=>u(i({},`__esModule`,{value:!0}),e),p={};l(p,{assertVercelOidcTokenResponse:()=>w,findProjectInfo:()=>T,getTokenPayload:()=>te,getVercelDataDir:()=>x,getVercelOidcToken:()=>C,getVercelToken:()=>S,isExpired:()=>ne,loadToken:()=>E,saveToken:()=>ee}),n.exports=f(p);var m=d(t(`path`)),h=d(t(`fs`)),g=Ce(),_=Ee(),v=De(),y=Oe(),b=Te();function x(){let e=(0,_.getUserDataDir)();return e?m.join(e,`com.vercel.cli`):null}async function S(e){let t=(0,v.readAuthConfig)();if(!t?.token)throw new b.AccessTokenMissingError;if((0,v.isValidAccessToken)(t,e?.expirationBufferMs))return t.token;if(!t.refreshToken)throw(0,v.writeAuthConfig)({}),new b.RefreshAccessTokenFailedError(`No refresh token available`);try{let e=await(0,y.refreshTokenRequest)({refresh_token:t.refreshToken}),[n,r]=await(0,y.processTokenResponse)(e);if(n||!r)throw(0,v.writeAuthConfig)({}),new b.RefreshAccessTokenFailedError(n);let i={token:r.access_token,expiresAt:Math.floor(Date.now()/1e3)+r.expires_in};return r.refresh_token&&(i.refreshToken=r.refresh_token),(0,v.writeAuthConfig)(i),i.token}catch(e){throw(0,v.writeAuthConfig)({}),e instanceof b.AccessTokenMissingError||e instanceof b.RefreshAccessTokenFailedError?e:new b.RefreshAccessTokenFailedError(e)}}async function C(e,t,n){let r=`https://api.vercel.com/v1/projects/${t}/token?source=vercel-oidc-refresh${n?`&teamId=${n}`:``}`,i=await fetch(r,{method:`POST`,headers:{Authorization:`Bearer ${e}`}});if(!i.ok)throw new g.VercelOidcTokenError(`Failed to refresh OIDC token: ${i.statusText}`);let a=await i.json();return w(a),a}function w(e){if(!e||typeof e!=`object`)throw TypeError("Vercel OIDC token is malformed. Expected an object. Please run `vc env pull` and try again");if(!(`token`in e)||typeof e.token!=`string`)throw TypeError("Vercel OIDC token is malformed. Expected a string-valued token property. Please run `vc env pull` and try again")}function T(){let e=(0,_.findRootDir)();if(!e)throw new g.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");let t=m.join(e,`.vercel`,`project.json`);if(!h.existsSync(t))throw new g.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");let n=JSON.parse(h.readFileSync(t,`utf8`));if(typeof n.projectId!=`string`&&typeof n.orgId!=`string`)throw TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");return{projectId:n.projectId,teamId:n.orgId}}function ee(e,t){let n=(0,_.getUserDataDir)();if(!n)throw new g.VercelOidcTokenError(`Unable to find user data directory. Please reach out to Vercel support.`);let r=m.join(n,`com.vercel.token`,`${t}.json`),i=JSON.stringify(e);h.mkdirSync(m.dirname(r),{mode:504,recursive:!0}),h.writeFileSync(r,i),h.chmodSync(r,432)}function E(e){let t=(0,_.getUserDataDir)();if(!t)throw new g.VercelOidcTokenError(`Unable to find user data directory. Please reach out to Vercel support.`);let n=m.join(t,`com.vercel.token`,`${e}.json`);if(!h.existsSync(n))return null;let r=JSON.parse(h.readFileSync(n,`utf8`));return w(r),r}function te(e){let t=e.split(`.`);if(t.length!==3)throw new g.VercelOidcTokenError("Invalid token. Please run `vc env pull` and try again");let n=t[1].replace(/-/g,`+`).replace(/_/g,`/`),r=n.padEnd(n.length+(4-n.length%4)%4,`=`);return JSON.parse(Buffer.from(r,`base64`).toString(`utf8`))}function ne(e,t=0){return e.exp*1e3<Date.now()+t}0&&(n.exports={assertVercelOidcTokenResponse:w,findProjectInfo:T,getTokenPayload:te,getVercelDataDir:x,getVercelOidcToken:C,getVercelToken:S,isExpired:ne,loadToken:E,saveToken:ee})})),Ae=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>f.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>f.RefreshAccessTokenFailedError,getContext:()=>d.getContext,getVercelOidcToken:()=>u.getVercelOidcToken,getVercelOidcTokenSync:()=>u.getVercelOidcTokenSync,getVercelToken:()=>p.getVercelToken}),t.exports=c(l);var u=we(),d=Se(),f=Te(),p=ke();0&&(t.exports={AccessTokenMissingError,RefreshAccessTokenFailedError,getContext,getVercelOidcToken,getVercelOidcTokenSync,getVercelToken})}))();let je;try{je=new TextDecoder}catch{}let O,Me,k=0;const Ne=[],Pe=57337,Fe={};let Ie=11281e4,Le=1681e4,Re=Ne,ze=0,A={},j,Be,Ve=0,He=0,M,N,P=[],Ue=[],F,I,We,Ge={useRecords:!1,mapsAsObjects:!0},Ke=!1,qe=2;try{Function(``)}catch{qe=1/0}var Je=class e{constructor(e){if(e&&((e.keyMap||e._keyMap)&&!e.useRecords&&(e.useRecords=!1,e.mapsAsObjects=!0),e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.getStructures&&(e.getShared=e.getStructures),e.getShared&&!e.structures&&((e.structures=[]).uninitialized=!0),e.keyMap)){this.mapKey=new Map;for(let[t,n]of Object.entries(e.keyMap))this.mapKey.set(n,t)}Object.assign(this,e)}decodeKey(e){return this.keyMap&&this.mapKey.get(e)||e}encodeKey(e){return this.keyMap&&this.keyMap.hasOwnProperty(e)?this.keyMap[e]:e}encodeKeys(e){if(!this._keyMap)return e;let t=new Map;for(let[n,r]of Object.entries(e))t.set(this._keyMap.hasOwnProperty(n)?this._keyMap[n]:n,r);return t}decodeKeys(e){if(!this._keyMap||e.constructor.name!=`Map`)return e;if(!this._mapKey){this._mapKey=new Map;for(let[e,t]of Object.entries(this._keyMap))this._mapKey.set(t,e)}let t={};return e.forEach((e,n)=>t[R(this._mapKey.has(n)?this._mapKey.get(n):n)]=e),t}mapDecode(e,t){let n=this.decode(e);if(this._keyMap)switch(n.constructor.name){case`Array`:return n.map(e=>this.decodeKeys(e))}return n}decode(t,n){if(O)return bt(()=>(xt(),this?this.decode(t,n):e.prototype.decode.call(Ge,t,n)));Me=n>-1?n:t.length,k=0,ze=0,He=0,Be=null,Re=Ne,M=null,O=t;try{I=t.dataView||=new DataView(t.buffer,t.byteOffset,t.byteLength)}catch(e){throw O=null,t instanceof Uint8Array?e:Error(`Source must be a Uint8Array or Buffer but was a `+(t&&typeof t==`object`?t.constructor.name:typeof t))}if(this instanceof e){if(A=this,F=this.sharedValues&&(this.pack?Array(this.maxPrivatePackedValues||16).concat(this.sharedValues):this.sharedValues),this.structures)return j=this.structures,Ye();(!j||j.length>0)&&(j=[])}else A=Ge,(!j||j.length>0)&&(j=[]),F=null;return Ye()}decodeMultiple(e,t){let n,r=0;try{let i=e.length;Ke=!0;let a=this?this.decode(e,i):Ct.decode(e,i);if(t){if(t(a)===!1)return;for(;k<i;)if(r=k,t(Ye())===!1)return}else{for(n=[a];k<i;)r=k,n.push(Ye());return n}}catch(e){throw e.lastPosition=r,e.values=n,e}finally{Ke=!1,xt()}}};function Ye(){try{let e=L();if(M){if(k>=M.postBundlePosition){let e=Error(`Unexpected bundle position`);throw e.incomplete=!0,e}k=M.postBundlePosition,M=null}if(k==Me)j=null,O=null,N&&=null;else if(k>Me){let e=Error(`Unexpected end of CBOR data`);throw e.incomplete=!0,e}else if(!Ke)throw Error(`Data read, but end of buffer not reached`);return e}catch(e){throw xt(),(e instanceof RangeError||e.message.startsWith(`Unexpected end of buffer`))&&(e.incomplete=!0),e}}function L(){let e=O[k++],t=e>>5;if(e&=31,e>23)switch(e){case 24:e=O[k++];break;case 25:if(t==7)return ot();e=I.getUint16(k),k+=2;break;case 26:if(t==7){let e=I.getFloat32(k);if(A.useFloat32>2){let t=St[(O[k]&127)<<1|O[k+1]>>7];return k+=4,(t*e+(e>0?.5:-.5)>>0)/t}return k+=4,e}e=I.getUint32(k),k+=4;break;case 27:if(t==7){let e=I.getFloat64(k);return k+=8,e}if(t>1){if(I.getUint32(k)>0)throw Error(`JavaScript does not support arrays, maps, or strings with length over 4294967295`);e=I.getUint32(k+4)}else A.int64AsNumber?(e=I.getUint32(k)*4294967296,e+=I.getUint32(k+4)):e=I.getBigUint64(k);k+=8;break;case 31:switch(t){case 2:case 3:throw Error(`Indefinite length not supported for byte or text strings`);case 4:let e=[],n,r=0;for(;(n=L())!=Fe;){if(r>=Ie)throw Error(`Array length exceeds ${Ie}`);e[r++]=n}return t==4?e:t==3?e.join(``):Buffer.concat(e);case 5:let i;if(A.mapsAsObjects){let e={},t=0;if(A.keyMap)for(;(i=L())!=Fe;){if(t++>=Le)throw Error(`Property count exceeds ${Le}`);e[R(A.decodeKey(i))]=L()}else for(;(i=L())!=Fe;){if(t++>=Le)throw Error(`Property count exceeds ${Le}`);e[R(i)]=L()}return e}else{We&&=(A.mapsAsObjects=!0,!1);let e=new Map;if(A.keyMap){let t=0;for(;(i=L())!=Fe;){if(t++>=Le)throw Error(`Map size exceeds ${Le}`);e.set(A.decodeKey(i),L())}}else{let t=0;for(;(i=L())!=Fe;){if(t++>=Le)throw Error(`Map size exceeds ${Le}`);e.set(i,L())}}return e}case 7:return Fe;default:throw Error(`Invalid major type for indefinite length `+t)}default:throw Error(`Unknown token `+e)}switch(t){case 0:return e;case 1:return~e;case 2:return rt(e);case 3:if(He>=k)return Be.slice(k-Ve,(k+=e)-Ve);if(He==0&&Me<140&&e<32){let t=e<16?nt(e):tt(e);if(t!=null)return t}return Qe(e);case 4:if(e>=Ie)throw Error(`Array length exceeds ${Ie}`);let t=Array(e);for(let n=0;n<e;n++)t[n]=L();return t;case 5:if(e>=Le)throw Error(`Map size exceeds ${Ie}`);if(A.mapsAsObjects){let t={};if(A.keyMap)for(let n=0;n<e;n++)t[R(A.decodeKey(L()))]=L();else for(let n=0;n<e;n++)t[R(L())]=L();return t}else{We&&=(A.mapsAsObjects=!0,!1);let t=new Map;if(A.keyMap)for(let n=0;n<e;n++)t.set(A.decodeKey(L()),L());else for(let n=0;n<e;n++)t.set(L(),L());return t}case 6:if(e>=Pe){let t=j[e&8191];if(t)return t.read||=Ze(t),t.read();if(e<65536){if(e==57343){let e=vt(),t=L(),n=L();ct(t,n);let r={};if(A.keyMap)for(let t=2;t<e;t++){let e=A.decodeKey(n[t-2]);r[R(e)]=L()}else for(let t=2;t<e;t++){let e=n[t-2];r[R(e)]=L()}return r}else if(e==57342){let e=vt(),t=L();for(let n=2;n<e;n++)ct(t++,L());return L()}else if(e==Pe)return _t();if(A.getShared&&(yt(),t=j[e&8191],t))return t.read||=Ze(t),t.read()}}let n=P[e];if(n)return n.handlesRead?n(L):n(L());{let t=L();for(let n=0;n<Ue.length;n++){let r=Ue[n](e,t);if(r!==void 0)return r}return new st(t,e)}case 7:switch(e){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;default:let t=(F||ft())[e];if(t!==void 0)return t;throw Error(`Unknown token `+e)}default:if(isNaN(e)){let e=Error(`Unexpected end of CBOR data`);throw e.incomplete=!0,e}throw Error(`Unknown CBOR token `+e)}}const Xe=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Ze(e){if(!e)throw Error(`Structure is required in record definition`);function t(){let e=O[k++];if(e&=31,e>23)switch(e){case 24:e=O[k++];break;case 25:e=I.getUint16(k),k+=2;break;case 26:e=I.getUint32(k),k+=4;break;default:throw Error(`Expected array header, but got `+O[k-1])}let t=this.compiledReader;for(;t;){if(t.propertyCount===e)return t(L);t=t.next}if(this.slowReads++>=qe){let n=this.length==e?this:this.slice(0,e);return t=A.keyMap?Function(`r`,`return {`+n.map(e=>A.decodeKey(e)).map(e=>Xe.test(e)?R(e)+`:r()`:`[`+JSON.stringify(e)+`]:r()`).join(`,`)+`}`):Function(`r`,`return {`+n.map(e=>Xe.test(e)?R(e)+`:r()`:`[`+JSON.stringify(e)+`]:r()`).join(`,`)+`}`),this.compiledReader&&(t.next=this.compiledReader),t.propertyCount=e,this.compiledReader=t,t(L)}let n={};if(A.keyMap)for(let t=0;t<e;t++)n[R(A.decodeKey(this[t]))]=L();else for(let t=0;t<e;t++)n[R(this[t])]=L();return n}return e.slowReads=0,t}function R(e){if(typeof e==`string`)return e===`__proto__`?`__proto_`:e;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return e.toString();if(e==null)return e+``;throw Error(`Invalid property name type `+typeof e)}let Qe=et;function $e(e){Qe=t(1);function t(t){return function(t){let n=Re[ze++];if(n==null){if(M)return et(t);let r=e(k,Me,t,O);if(typeof r==`string`)n=r,Re=Ne;else if(Re=r,ze=1,He=1,n=Re[0],n===void 0)throw Error(`Unexpected end of buffer`)}let r=n.length;return r<=t?(k+=t,n):(Be=n,Ve=k,He=k+r,k+=t,n.slice(0,t))}}}function et(e){let t;if(e<16&&(t=nt(e)))return t;if(e>64&&je)return je.decode(O.subarray(k,k+=e));let n=k+e,r=[];for(t=``;k<n;){let e=O[k++];if(!(e&128))r.push(e);else if((e&224)==192){let t=O[k++]&63;r.push((e&31)<<6|t)}else if((e&240)==224){let t=O[k++]&63,n=O[k++]&63;r.push((e&31)<<12|t<<6|n)}else if((e&248)==240){let t=O[k++]&63,n=O[k++]&63,i=O[k++]&63,a=(e&7)<<18|t<<12|n<<6|i;a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a)}else r.push(e);r.length>=4096&&(t+=z.apply(String,r),r.length=0)}return r.length>0&&(t+=z.apply(String,r)),t}let z=String.fromCharCode;function tt(e){let t=k,n=Array(e);for(let r=0;r<e;r++){let e=O[k++];if((e&128)>0){k=t;return}n[r]=e}return z.apply(String,n)}function nt(e){if(e<4)if(e<2){if(e===0)return``;{let e=O[k++];if((e&128)>1){--k;return}return z(e)}}else{let t=O[k++],n=O[k++];if((t&128)>0||(n&128)>0){k-=2;return}if(e<3)return z(t,n);let r=O[k++];if((r&128)>0){k-=3;return}return z(t,n,r)}else{let t=O[k++],n=O[k++],r=O[k++],i=O[k++];if((t&128)>0||(n&128)>0||(r&128)>0||(i&128)>0){k-=4;return}if(e<6){if(e===4)return z(t,n,r,i);{let e=O[k++];if((e&128)>0){k-=5;return}return z(t,n,r,i,e)}}else if(e<8){let a=O[k++],o=O[k++];if((a&128)>0||(o&128)>0){k-=6;return}if(e<7)return z(t,n,r,i,a,o);let s=O[k++];if((s&128)>0){k-=7;return}return z(t,n,r,i,a,o,s)}else{let a=O[k++],o=O[k++],s=O[k++],c=O[k++];if((a&128)>0||(o&128)>0||(s&128)>0||(c&128)>0){k-=8;return}if(e<10){if(e===8)return z(t,n,r,i,a,o,s,c);{let e=O[k++];if((e&128)>0){k-=9;return}return z(t,n,r,i,a,o,s,c,e)}}else if(e<12){let l=O[k++],u=O[k++];if((l&128)>0||(u&128)>0){k-=10;return}if(e<11)return z(t,n,r,i,a,o,s,c,l,u);let d=O[k++];if((d&128)>0){k-=11;return}return z(t,n,r,i,a,o,s,c,l,u,d)}else{let l=O[k++],u=O[k++],d=O[k++],f=O[k++];if((l&128)>0||(u&128)>0||(d&128)>0||(f&128)>0){k-=12;return}if(e<14){if(e===12)return z(t,n,r,i,a,o,s,c,l,u,d,f);{let e=O[k++];if((e&128)>0){k-=13;return}return z(t,n,r,i,a,o,s,c,l,u,d,f,e)}}else{let p=O[k++],m=O[k++];if((p&128)>0||(m&128)>0){k-=14;return}if(e<15)return z(t,n,r,i,a,o,s,c,l,u,d,f,p,m);let h=O[k++];if((h&128)>0){k-=15;return}return z(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}}}}}function rt(e){return A.copyBuffers?Uint8Array.prototype.slice.call(O,k,k+=e):O.subarray(k,k+=e)}let it=new Float32Array(1),at=new Uint8Array(it.buffer,0,4);function ot(){let e=O[k++],t=O[k++],n=(e&127)>>2;if(n===31)return t||e&3?NaN:e&128?-1/0:1/0;if(n===0){let n=((e&3)<<8|t)/(1<<24);return e&128?-n:n}return at[3]=e&128|(n>>1)+56,at[2]=(e&7)<<5|t>>3,at[1]=t<<5,at[0]=0,it[0]}Array(4096);var st=class{constructor(e,t){this.value=e,this.tag=t}};P[0]=e=>new Date(e),P[1]=e=>new Date(Math.round(e*1e3)),P[2]=e=>{let t=BigInt(0);for(let n=0,r=e.byteLength;n<r;n++)t=BigInt(e[n])+(t<<BigInt(8));return t},P[3]=e=>BigInt(-1)-P[2](e),P[4]=e=>+(e[1]+`e`+e[0]),P[5]=e=>e[1]*Math.exp(e[0]*Math.log(2));const ct=(e,t)=>{e-=57344;let n=j[e];n&&n.isShared&&((j.restoreStructures||=[])[e]=n),j[e]=t,t.read=Ze(t)};P[105]=e=>{let t=e.length,n=e[1];ct(e[0],n);let r={};for(let i=2;i<t;i++){let t=n[i-2];r[R(t)]=e[i]}return r},P[14]=e=>M?M[0].slice(M.position0,M.position0+=e):new st(e,14),P[15]=e=>M?M[1].slice(M.position1,M.position1+=e):new st(e,15);let lt={Error,RegExp};P[27]=e=>(lt[e[0]]||Error)(e[1],e[2]);const ut=e=>{if(O[k++]!=132){let e=Error(`Packed values structure must be followed by a 4 element array`);throw O.length<k&&(e.incomplete=!0),e}let t=e();if(!t||!t.length){let e=Error(`Packed values structure must be followed by a 4 element array`);throw e.incomplete=!0,e}return F=F?t.concat(F.slice(t.length)):t,F.prefixes=e(),F.suffixes=e(),e()};ut.handlesRead=!0,P[51]=ut,P[6]=e=>{if(!F)if(A.getShared)yt();else return new st(e,6);if(typeof e==`number`)return F[16+(e>=0?2*e:-2*e-1)];let t=Error(`No support for non-integer packed references yet`);throw e===void 0&&(t.incomplete=!0),t},P[28]=e=>{N||(N=new Map,N.id=0);let t=N.id++,n=k,r=O[k],i;i=r>>5==4?[]:{};let a={target:i};N.set(t,a);let o=e();return a.used?(Object.getPrototypeOf(i)!==Object.getPrototypeOf(o)&&(k=n,i=o,N.set(t,{target:i}),o=e()),Object.assign(i,o)):(a.target=o,o)},P[28].handlesRead=!0,P[29]=e=>{let t=N.get(e);return t.used=!0,t.target},P[258]=e=>new Set(e),(P[259]=e=>(A.mapsAsObjects&&(A.mapsAsObjects=!1,We=!0),e())).handlesRead=!0;function dt(e,t){return typeof e==`string`?e+t:e instanceof Array?e.concat(t):Object.assign({},e,t)}function ft(){if(!F)if(A.getShared)yt();else throw Error(`No packed values available`);return F}Ue.push((e,t)=>{if(e>=225&&e<=255)return dt(ft().prefixes[e-224],t);if(e>=28704&&e<=32767)return dt(ft().prefixes[e-28672],t);if(e>=1879052288&&e<=2147483647)return dt(ft().prefixes[e-1879048192],t);if(e>=216&&e<=223)return dt(t,ft().suffixes[e-216]);if(e>=27647&&e<=28671)return dt(t,ft().suffixes[e-27639]);if(e>=1811940352&&e<=1879048191)return dt(t,ft().suffixes[e-1811939328]);if(e==1399353956)return{packedValues:F,structures:j.slice(0),version:t};if(e==55799)return t});const pt=new Uint8Array(new Uint16Array([1]).buffer)[0]==1,mt=[Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,typeof BigUint64Array>`u`?{name:`BigUint64Array`}:BigUint64Array,Int8Array,Int16Array,Int32Array,typeof BigInt64Array>`u`?{name:`BigInt64Array`}:BigInt64Array,Float32Array,Float64Array],ht=[64,68,69,70,71,72,77,78,79,85,86];for(let e=0;e<mt.length;e++)gt(mt[e],ht[e]);function gt(e,t){let n=`get`+e.name.slice(0,-5),r;typeof e==`function`?r=e.BYTES_PER_ELEMENT:e=null;for(let i=0;i<2;i++){if(!i&&r==1)continue;let a=r==2?1:r==4?2:r==8?3:0;P[i?t:t-4]=r==1||i==pt?n=>{if(!e)throw Error(`Could not find typed array for code `+t);return!A.copyBuffers&&(r===1||r===2&&!(n.byteOffset&1)||r===4&&!(n.byteOffset&3)||r===8&&!(n.byteOffset&7))?new e(n.buffer,n.byteOffset,n.byteLength>>a):new e(Uint8Array.prototype.slice.call(n,0).buffer)}:r=>{if(!e)throw Error(`Could not find typed array for code `+t);let o=new DataView(r.buffer,r.byteOffset,r.byteLength),s=r.length>>a,c=new e(s),l=o[n];for(let e=0;e<s;e++)c[e]=l.call(o,e<<a,i);return c}}}function _t(){let e=vt(),t=k+L();for(let t=2;t<e;t++){let e=vt();k+=e}let n=k;return k=t,M=[et(vt()),et(vt())],M.position0=0,M.position1=0,M.postBundlePosition=k,k=n,L()}function vt(){let e=O[k++]&31;if(e>23)switch(e){case 24:e=O[k++];break;case 25:e=I.getUint16(k),k+=2;break;case 26:e=I.getUint32(k),k+=4;break}return e}function yt(){if(A.getShared){let e=bt(()=>(O=null,A.getShared()))||{},t=e.structures||[];A.sharedVersion=e.version,F=A.sharedValues=e.packedValues,j===!0?A.structures=j=t:j.splice.apply(j,[0,t.length].concat(t))}}function bt(e){let t=Me,n=k,r=ze,i=Ve,a=He,o=Be,s=Re,c=N,l=M,u=new Uint8Array(O.slice(0,Me)),d=j,f=A,p=Ke,m=e();return Me=t,k=n,ze=r,Ve=i,He=a,Be=o,Re=s,N=c,M=l,O=u,Ke=p,j=d,A=f,I=new DataView(O.buffer,O.byteOffset,O.byteLength),m}function xt(){O=null,N=null,j=null}const St=Array(147);for(let e=0;e<256;e++)St[e]=+(`1e`+Math.floor(45.15-e*.30103));let Ct=new Je({useRecords:!1});const wt=Ct.decode;Ct.decodeMultiple;const Tt={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};let Et;try{Et=new TextEncoder}catch{}let Dt,Ot;const kt=typeof globalThis==`object`&&globalThis.Buffer,At=kt!==void 0,jt=At?kt.allocUnsafeSlow:Uint8Array,Mt=At?kt:Uint8Array,Nt=At?4294967296:2144337920;let Pt,B,V,H=0,Ft,U=null;const It=/[\u0080-\uFFFF]/,W=Symbol(`record-id`);var Lt=class extends Je{constructor(e){super(e),this.offset=0;let t,n,r,i,a;e||={};let o=Mt.prototype.utf8Write?function(e,t,n){return B.utf8Write(e,t,n)}:Et&&Et.encodeInto?function(e,t){return Et.encodeInto(e,B.subarray(t)).written}:!1,s=this,c=e.structures||e.saveStructures,l=e.maxSharedStructures;if(l??=c?128:0,l>8190)throw Error(`Maximum maxSharedStructure is 8190`);let u=e.sequential;u&&(l=0),this.structures||=[],this.saveStructures&&(this.saveShared=this.saveStructures);let d,f,p=e.sharedValues,m;if(p){m=Object.create(null);for(let e=0,t=p.length;e<t;e++)m[p[e]]=e}let h=[],g=0,_=0;this.mapEncode=function(e,t){if(this._keyMap&&!this._mapped)switch(e.constructor.name){case`Array`:e=e.map(e=>this.encodeKeys(e));break}return this.encode(e,t)},this.encode=function(o,c){if(B||(B=new jt(8192),V=new DataView(B.buffer,0,8192),H=0),Ft=B.length-10,Ft-H<2048?(B=new jt(B.length),V=new DataView(B.buffer,0,B.length),Ft=B.length-10,H=0):c===512&&(H=H+7&2147483640),t=H,s.useSelfDescribedHeader&&(V.setUint32(H,3654940416),H+=3),a=s.structuredClone?new Map:null,s.bundleStrings&&typeof o!=`string`?(U=[],U.size=1/0):U=null,n=s.structures,n){if(n.uninitialized){let e=s.getShared()||{};s.structures=n=e.structures||[],s.sharedVersion=e.version;let t=s.sharedValues=e.packedValues;if(t){m={};for(let e=0,n=t.length;e<n;e++)m[t[e]]=e}}let e=n.length;if(e>l&&!u&&(e=l),!n.transitions){n.transitions=Object.create(null);for(let t=0;t<e;t++){let e=n[t];if(!e)continue;let r,i=n.transitions;for(let n=0,a=e.length;n<a;n++){i[W]===void 0&&(i[W]=t);let a=e[n];r=i[a],r||=i[a]=Object.create(null),i=r}i[W]=t|1048576}}u||(n.nextId=e)}if(r&&=!1,i=n||[],f=m,e.pack){let t=new Map;if(t.values=[],t.encoder=s,t.maxValues=e.maxPrivatePackedValues||(m?16:1/0),t.objectMap=m||!1,t.samplingPackedValues=d,Ut(o,t),t.values.length>0){B[H++]=216,B[H++]=51,Bt(4);let e=t.values;v(e),Bt(0),Bt(0),f=Object.create(m||null);for(let t=0,n=e.length;t<n;t++)f[e[t]]=t}}Pt=c&tn;try{if(Pt)return;if(v(o),U&&Jt(t,v),s.offset=H,a&&a.idsToInsert){H+=a.idsToInsert.length*2,H>Ft&&b(H),s.offset=H;let e=qt(B.subarray(t,H),a.idsToInsert);return a=null,e}return c&512?(B.start=t,B.end=H,B):B.subarray(t,H)}finally{if(n){if(_<10&&_++,n.length>l&&(n.length=l),g>1e4)n.transitions=null,_=0,g=0,h.length>0&&(h=[]);else if(h.length>0&&!u){for(let e=0,t=h.length;e<t;e++)h[e][W]=void 0;h=[]}}if(r&&s.saveShared){s.structures.length>l&&(s.structures=s.structures.slice(0,l));let e=B.subarray(t,H);return s.updateSharedData()===!1?s.encode(o):e}c&1024&&(H=t)}},this.findCommonStringsToPack=()=>(d=new Map,m||=Object.create(null),e=>{let t=e&&e.threshold||4,n=this.pack?e.maxPrivatePackedValues||16:0;p||=this.sharedValues=[];for(let[e,i]of d)i.count>t&&(m[e]=n++,p.push(e),r=!0);for(;this.saveShared&&this.updateSharedData()===!1;);d=null});let v=n=>{H>Ft&&(B=b(H));var r=typeof n,i;if(r===`string`){if(f){let t=f[n];if(t>=0){t<16?B[H++]=t+224:(B[H++]=198,t&1?v(15-t>>1):v(t-16>>1));return}else if(d&&!e.pack){let e=d.get(n);e?e.count++:d.set(n,{count:1})}}let r=n.length;if(U&&r>=4&&r<1024){if((U.size+=r)>61440){let e,n=(U[0]?U[0].length*3+U[1].length:0)+10;H+n>Ft&&(B=b(H+n)),B[H++]=217,B[H++]=223,B[H++]=249,B[H++]=U.position?132:130,B[H++]=26,e=H-t,H+=4,U.position&&Jt(t,v),U=[``,``],U.size=0,U.position=e}let e=It.test(n);U[+!e]+=n,B[H++]=e?206:207,v(r);return}let a;a=r<32?1:r<256?2:r<65536?3:5;let s=r*3;if(H+s>Ft&&(B=b(H+s)),r<64||!o){let e,t,o,s=H+a;for(e=0;e<r;e++)t=n.charCodeAt(e),t<128?B[s++]=t:t<2048?(B[s++]=t>>6|192,B[s++]=t&63|128):(t&64512)==55296&&((o=n.charCodeAt(e+1))&64512)==56320?(t=65536+((t&1023)<<10)+(o&1023),e++,B[s++]=t>>18|240,B[s++]=t>>12&63|128,B[s++]=t>>6&63|128,B[s++]=t&63|128):(B[s++]=t>>12|224,B[s++]=t>>6&63|128,B[s++]=t&63|128);i=s-H-a}else i=o(n,H+a,s);i<24?B[H++]=96|i:i<256?(a<2&&B.copyWithin(H+2,H+1,H+1+i),B[H++]=120,B[H++]=i):i<65536?(a<3&&B.copyWithin(H+3,H+2,H+2+i),B[H++]=121,B[H++]=i>>8,B[H++]=i&255):(a<5&&B.copyWithin(H+5,H+3,H+3+i),B[H++]=122,V.setUint32(H,i),H+=4),H+=i}else if(r===`number`)if(!this.alwaysUseFloat&&n>>>0===n)n<24?B[H++]=n:n<256?(B[H++]=24,B[H++]=n):n<65536?(B[H++]=25,B[H++]=n>>8,B[H++]=n&255):(B[H++]=26,V.setUint32(H,n),H+=4);else if(!this.alwaysUseFloat&&n>>0===n)n>=-24?B[H++]=31-n:n>=-256?(B[H++]=56,B[H++]=~n):n>=-65536?(B[H++]=57,V.setUint16(H,~n),H+=2):(B[H++]=58,V.setUint32(H,~n),H+=4);else{let e;if((e=this.useFloat32)>0&&n<4294967296&&n>=-2147483648){B[H++]=250,V.setFloat32(H,n);let t;if(e<4||(t=n*St[(B[H]&127)<<1|B[H+1]>>7])>>0===t){H+=4;return}else H--}B[H++]=251,V.setFloat64(H,n),H+=8}else if(r===`object`)if(!n)B[H++]=246;else{if(a){let e=a.get(n);if(e){if(B[H++]=216,B[H++]=29,B[H++]=25,!e.references){let t=a.idsToInsert||=[];e.references=[],t.push(e)}e.references.push(H-t),H+=2;return}else a.set(n,{offset:H-t})}let e=n.constructor;if(e===Object)y(n);else if(e===Array){i=n.length,i<24?B[H++]=128|i:Bt(i);for(let e=0;e<i;e++)v(n[e])}else if(e===Map)if((this.mapsAsObjects?this.useTag259ForMaps!==!1:this.useTag259ForMaps)&&(B[H++]=217,B[H++]=1,B[H++]=3),i=n.size,i<24?B[H++]=160|i:i<256?(B[H++]=184,B[H++]=i):i<65536?(B[H++]=185,B[H++]=i>>8,B[H++]=i&255):(B[H++]=186,V.setUint32(H,i),H+=4),s.keyMap)for(let[e,t]of n)v(s.encodeKey(e)),v(t);else for(let[e,t]of n)v(e),v(t);else{for(let e=0,t=Dt.length;e<t;e++){let t=Ot[e];if(n instanceof t){let t=Dt[e],r=t.tag;r??=t.getTag&&t.getTag.call(this,n),r<24?B[H++]=192|r:r<256?(B[H++]=216,B[H++]=r):r<65536?(B[H++]=217,B[H++]=r>>8,B[H++]=r&255):r>-1&&(B[H++]=218,V.setUint32(H,r),H+=4),t.encode.call(this,n,v,b);return}}if(n[Symbol.iterator]){if(Pt){let e=Error(`Iterable should be serialized as iterator`);throw e.iteratorNotHandled=!0,e}B[H++]=159;for(let e of n)v(e);B[H++]=255;return}if(n[Symbol.asyncIterator]||Ht(n)){let e=Error(`Iterable/blob should be serialized as iterator`);throw e.iteratorNotHandled=!0,e}if(this.useToJSON&&n.toJSON){let e=n.toJSON();if(e!==n)return v(e)}y(n)}}else if(r===`boolean`)B[H++]=n?245:244;else if(r===`bigint`){if(n<BigInt(1)<<BigInt(64)&&n>=0)B[H++]=27,V.setBigUint64(H,n);else if(n>-(BigInt(1)<<BigInt(64))&&n<0)B[H++]=59,V.setBigUint64(H,-n-BigInt(1));else if(this.largeBigIntToFloat)B[H++]=251,V.setFloat64(H,Number(n));else{n>=BigInt(0)?B[H++]=194:(B[H++]=195,n=BigInt(-1)-n);let e=[];for(;n;)e.push(Number(n&BigInt(255))),n>>=BigInt(8);Kt(new Uint8Array(e.reverse()),b);return}H+=8}else if(r===`undefined`)B[H++]=247;else throw Error(`Unknown type: `+r)},y=this.useRecords===!1?this.variableMapSize?e=>{let t=Object.keys(e),n=Object.values(e),r=t.length;if(r<24?B[H++]=160|r:r<256?(B[H++]=184,B[H++]=r):r<65536?(B[H++]=185,B[H++]=r>>8,B[H++]=r&255):(B[H++]=186,V.setUint32(H,r),H+=4),s.keyMap)for(let e=0;e<r;e++)v(s.encodeKey(t[e])),v(n[e]);else for(let e=0;e<r;e++)v(t[e]),v(n[e])}:e=>{B[H++]=185;let n=H-t;H+=2;let r=0;if(s.keyMap)for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&(v(s.encodeKey(t)),v(e[t]),r++);else for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&(v(t),v(e[t]),r++);B[n+++t]=r>>8,B[n+t]=r&255}:(e,t)=>{let n,a=i.transitions||=Object.create(null),o=0,s=0,c,u;if(this.keyMap){u=Object.keys(e).map(e=>this.encodeKey(e)),s=u.length;for(let e=0;e<s;e++){let t=u[e];n=a[t],n||(n=a[t]=Object.create(null),o++),a=n}}else for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&(n=a[t],n||(a[W]&1048576&&(c=a[W]&65535),n=a[t]=Object.create(null),o++),a=n,s++);let d=a[W];if(d!==void 0)d&=65535,B[H++]=217,B[H++]=d>>8|224,B[H++]=d&255;else if(u||=a.__keys__||=Object.keys(e),c===void 0?(d=i.nextId++,d||(d=0,i.nextId=1),d>=256&&(i.nextId=(d=l)+1)):d=c,i[d]=u,d<l){B[H++]=217,B[H++]=d>>8|224,B[H++]=d&255,a=i.transitions;for(let e=0;e<s;e++)(a[W]===void 0||a[W]&1048576)&&(a[W]=d),a=a[u[e]];a[W]=d|1048576,r=!0}else{if(a[W]=d,V.setUint32(H,3655335680),H+=3,o&&(g+=_*o),h.length>=256-l&&(h.shift()[W]=void 0),h.push(a),Bt(s+2),v(57344+d),v(u),t)return;for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&v(e[t]);return}if(s<24?B[H++]=128|s:Bt(s),!t)for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&v(e[t])},b=e=>{let n;if(e>16777216){if(e-t>Nt)throw Error(`Encoded buffer would be larger than maximum buffer size`);n=Math.min(Nt,Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096)*4096)}else n=(Math.max(e-t<<2,B.length-1)>>12)+1<<12;let r=new jt(n);return V=new DataView(r.buffer,0,n),B.copy?B.copy(r,0,t,e):r.set(B.slice(t,e)),H-=t,t=0,Ft=r.length-10,B=r},x=100,S=1e3;this.encodeAsIterable=function(e,t){return ee(e,t,C)},this.encodeAsAsyncIterable=function(e,t){return ee(e,t,E)};function*C(e,n,r){let i=e.constructor;if(i===Object){let t=s.useRecords!==!1;t?y(e,!0):Rt(Object.keys(e).length,160);for(let r in e){let i=e[r];t||v(r),i&&typeof i==`object`?n[r]?yield*C(i,n[r]):yield*w(i,n,r):v(i)}}else if(i===Array){let r=e.length;Bt(r);for(let i=0;i<r;i++){let r=e[i];r&&(typeof r==`object`||H-t>x)?n.element?yield*C(r,n.element):yield*w(r,n,`element`):v(r)}}else if(e[Symbol.iterator]&&!e.buffer){B[H++]=159;for(let r of e)r&&(typeof r==`object`||H-t>x)?n.element?yield*C(r,n.element):yield*w(r,n,`element`):v(r);B[H++]=255}else Ht(e)?(Rt(e.size,64),yield B.subarray(t,H),yield e,T()):e[Symbol.asyncIterator]?(B[H++]=159,yield B.subarray(t,H),yield e,T(),B[H++]=255):v(e);r&&H>t?yield B.subarray(t,H):H-t>x&&(yield B.subarray(t,H),T())}function*w(e,n,r){let i=H-t;try{v(e),H-t>x&&(yield B.subarray(t,H),T())}catch(a){if(a.iteratorNotHandled)n[r]={},H=t+i,yield*C.call(this,e,n[r]);else throw a}}function T(){x=S,s.encode(null,tn)}function ee(e,t,n){return x=t&&t.chunkThreshold?S=t.chunkThreshold:100,e&&typeof e==`object`?(s.encode(null,tn),n(e,s.iterateProperties||={},!0)):[s.encode(e)]}async function*E(e,t){for(let n of C(e,t,!0)){let e=n.constructor;if(e===Mt||e===Uint8Array)yield n;else if(Ht(n)){let e=n.stream().getReader(),t;for(;!(t=await e.read()).done;)yield t.value}else if(n[Symbol.asyncIterator])for await(let e of n)T(),e?yield*E(e,t.async||={}):yield s.encode(e);else yield n}}}useBuffer(e){B=e,V=new DataView(B.buffer,B.byteOffset,B.byteLength),H=0}clearSharedData(){this.structures&&=[],this.sharedValues&&=void 0}updateSharedData(){let e=this.sharedVersion||0;this.sharedVersion=e+1;let t=this.structures.slice(0),n=new zt(t,this.sharedValues,this.sharedVersion),r=this.saveShared(n,t=>(t&&t.version||0)==e);return r===!1?(n=this.getShared()||{},this.structures=n.structures||[],this.sharedValues=n.packedValues,this.sharedVersion=n.version,this.structures.nextId=this.structures.length):t.forEach((e,t)=>this.structures[t]=e),r}};function Rt(e,t){e<24?B[H++]=t|e:e<256?(B[H++]=t|24,B[H++]=e):e<65536?(B[H++]=t|25,B[H++]=e>>8,B[H++]=e&255):(B[H++]=t|26,V.setUint32(H,e),H+=4)}var zt=class{constructor(e,t,n){this.structures=e,this.packedValues=t,this.version=n}};function Bt(e){e<24?B[H++]=128|e:e<256?(B[H++]=152,B[H++]=e):e<65536?(B[H++]=153,B[H++]=e>>8,B[H++]=e&255):(B[H++]=154,V.setUint32(H,e),H+=4)}const Vt=typeof Blob>`u`?function(){}:Blob;function Ht(e){if(e instanceof Vt)return!0;let t=e[Symbol.toStringTag];return t===`Blob`||t===`File`}function Ut(e,t){switch(typeof e){case`string`:if(e.length>3){if(t.objectMap[e]>-1||t.values.length>=t.maxValues)return;let n=t.get(e);if(n)++n.count==2&&t.values.push(e);else if(t.set(e,{count:1}),t.samplingPackedValues){let n=t.samplingPackedValues.get(e);n?n.count++:t.samplingPackedValues.set(e,{count:1})}}break;case`object`:if(e)if(e instanceof Array)for(let n=0,r=e.length;n<r;n++)Ut(e[n],t);else{let r=!t.encoder.useRecords;for(var n in e)e.hasOwnProperty(n)&&(r&&Ut(n,t),Ut(e[n],t))}break;case`function`:console.log(e)}}const Wt=new Uint8Array(new Uint16Array([1]).buffer)[0]==1;Ot=[Date,Set,Error,RegExp,st,ArrayBuffer,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,typeof BigUint64Array>`u`?function(){}:BigUint64Array,Int8Array,Int16Array,Int32Array,typeof BigInt64Array>`u`?function(){}:BigInt64Array,Float32Array,Float64Array,zt],Dt=[{tag:1,encode(e,t){let n=e.getTime()/1e3;(this.useTimestamp32||e.getMilliseconds()===0)&&n>=0&&n<4294967296?(B[H++]=26,V.setUint32(H,n),H+=4):(B[H++]=251,V.setFloat64(H,n),H+=8)}},{tag:258,encode(e,t){t(Array.from(e))}},{tag:27,encode(e,t){t([e.name,e.message])}},{tag:27,encode(e,t){t([`RegExp`,e.source,e.flags])}},{getTag(e){return e.tag},encode(e,t){t(e.value)}},{encode(e,t,n){Kt(e,n)}},{getTag(e){if(e.constructor===Uint8Array&&(this.tagUint8Array||At&&this.tagUint8Array!==!1))return 64},encode(e,t,n){Kt(e,n)}},Gt(68,1),Gt(69,2),Gt(70,4),Gt(71,8),Gt(72,1),Gt(77,2),Gt(78,4),Gt(79,8),Gt(85,4),Gt(86,8),{encode(e,t){let n=e.packedValues||[],r=e.structures||[];if(n.values.length>0){B[H++]=216,B[H++]=51,Bt(4);let e=n.values;t(e),Bt(0),Bt(0),packedObjectMap=Object.create(sharedPackedObjectMap||null);for(let t=0,n=e.length;t<n;t++)packedObjectMap[e[t]]=t}if(r){V.setUint32(H,3655335424),H+=3;let n=r.slice(0);n.unshift(57344),n.push(new st(e.version,1399353956)),t(n)}else t(new st(e.version,1399353956))}}];function Gt(e,t){return!Wt&&t>1&&(e-=4),{tag:e,encode:function(e,t){let n=e.byteLength,r=e.byteOffset||0,i=e.buffer||e;t(At?kt.from(i,r,n):new Uint8Array(i,r,n))}}}function Kt(e,t){let n=e.byteLength;n<24?B[H++]=64+n:n<256?(B[H++]=88,B[H++]=n):n<65536?(B[H++]=89,B[H++]=n>>8,B[H++]=n&255):(B[H++]=90,V.setUint32(H,n),H+=4),H+n>=B.length&&t(H+n),B.set(e.buffer?e:new Uint8Array(e),H),H+=n}function qt(e,t){let n,r=t.length*2,i=e.length-r;t.sort((e,t)=>e.offset>t.offset?1:-1);for(let n=0;n<t.length;n++){let r=t[n];r.id=n;for(let t of r.references)e[t++]=n>>8,e[t]=n&255}for(;n=t.pop();){let t=n.offset;e.copyWithin(t+r,t,i),r-=2;let a=t+r;e[a++]=216,e[a++]=28,i=t}return e}function Jt(e,t){V.setUint32(U.position+e,H-U.position-e+1);let n=U;U=null,t(n[0]),t(n[1])}let Yt=new Lt({useRecords:!1});const Xt=Yt.encode;Yt.encodeAsIterable,Yt.encodeAsAsyncIterable;const{NEVER:Zt,ALWAYS:Qt,DECIMAL_ROUND:$t,DECIMAL_FIT:en}=Tt,tn=2048;var nn=n(((e,t)=>{let n=()=>process.platform===`linux`,r=null;t.exports={isLinux:n,getReport:()=>{if(!r)if(n()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,r=process.report.getReport(),process.report.excludeNetwork=e}else r={};return r}}})),rn=n(((e,n)=>{let r=t(`fs`),i=2048;n.exports={LDD_PATH:`/usr/bin/ldd`,SELF_PATH:`/proc/self/exe`,readFileSync:e=>{let t=r.openSync(e,`r`),n=Buffer.alloc(i),a=r.readSync(t,n,0,i,0);return r.close(t,()=>{}),n.subarray(0,a)},readFile:e=>new Promise((t,n)=>{r.open(e,`r`,(e,a)=>{if(e)n(e);else{let e=Buffer.alloc(i);r.read(a,e,0,i,0,(n,i)=>{t(e.subarray(0,i)),r.close(a,()=>{})})}})})}})),an=n(((e,t)=>{t.exports={interpreterPath:e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),n=e.readUInt16LE(54),r=e.readUInt16LE(56);for(let i=0;i<r;i++){let r=t+i*n;if(e.readUInt32LE(r)===3){let t=e.readUInt32LE(r+8),n=e.readUInt32LE(r+32);return e.subarray(t,t+n).toString().replace(/\0.*$/g,``)}}return null}}})),on=n(((e,n)=>{let r=t(`child_process`),{isLinux:i,getReport:a}=nn(),{LDD_PATH:o,SELF_PATH:s,readFile:c,readFileSync:l}=rn(),{interpreterPath:u}=an(),d,f,p,m=`getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true`,h=``,g=()=>h||new Promise(e=>{r.exec(m,(t,n)=>{h=t?` `:n,e(h)})}),_=()=>{if(!h)try{h=r.execSync(m,{encoding:`utf8`})}catch{h=` `}return h},v=`glibc`,y=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,b=`musl`,x=e=>e.includes(`libc.musl-`)||e.includes(`ld-musl-`),S=()=>{let e=a();return e.header&&e.header.glibcVersionRuntime?v:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(x)?b:null},C=e=>{let[t,n]=e.split(/[\r\n]+/);return t&&t.includes(v)?v:n&&n.includes(b)?b:null},w=e=>{if(e){if(e.includes(`/ld-musl-`))return b;if(e.includes(`/ld-linux-`))return v}return null},T=e=>(e=e.toString(),e.includes(`musl`)?b:e.includes(`GNU C Library`)?v:null),ee=async()=>{if(f!==void 0)return f;f=null;try{f=T(await c(o))}catch{}return f},E=()=>{if(f!==void 0)return f;f=null;try{f=T(l(o))}catch{}return f},te=async()=>{if(d!==void 0)return d;d=null;try{d=w(u(await c(s)))}catch{}return d},ne=()=>{if(d!==void 0)return d;d=null;try{d=w(u(l(s)))}catch{}return d},D=async()=>{let e=null;return i()&&(e=await te(),e||(e=await ee(),e||=S(),e||=C(await g()))),e},re=()=>{let e=null;return i()&&(e=ne(),e||(e=E(),e||=S(),e||=C(_()))),e},ie=async()=>i()&&await D()!==v,ae=()=>i()&&re()!==v,oe=async()=>{if(p!==void 0)return p;p=null;try{let e=(await c(o)).match(y);e&&(p=e[1])}catch{}return p},se=()=>{if(p!==void 0)return p;p=null;try{let e=l(o).match(y);e&&(p=e[1])}catch{}return p},ce=()=>{let e=a();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},le=e=>e.trim().split(/\s+/)[1],ue=e=>{let[t,n,r]=e.split(/[\r\n]+/);return t&&t.includes(v)?le(t):n&&r&&n.includes(b)?le(r):null};n.exports={GLIBC:v,MUSL:b,family:D,familySync:re,isNonGlibcLinux:ie,isNonGlibcLinuxSync:ae,version:async()=>{let e=null;return i()&&(e=await oe(),e||=ce(),e||=ue(await g())),e},versionSync:()=>{let e=null;return i()&&(e=se(),e||=ce(),e||=ue(_())),e}}})),sn=n(((e,n)=>{var r=t(`fs`),i=t(`path`),a=t(`url`),o=process.config&&process.config.variables||{},s=!!process.env.PREBUILDS_ONLY,c=process.versions,l=c.modules;(c.deno||process.isBun)&&(l=`unsupported`);var u=E()?`electron`:`node`,d=process.arch,f=process.platform,p=process.env.LIBC||(te(f)?`musl`:`glibc`),m=process.env.ARM_VERSION||(d===`arm64`?`8`:o.arm_version)||``,h=(c.uv||``).split(`.`)[0];n.exports=g;function g(e){return typeof __webpack_require__==`function`?__non_webpack_require__(g.path(e)):t(g.path(e))}g.path=function(e){e=i.resolve(e||`.`);var n=``;try{n=typeof __webpack_require__==`function`?__non_webpack_require__(i.join(e,`package.json`)).name:t(i.join(e,`package.json`)).name;var r=n.toUpperCase().replace(/-/g,`_`)+`_PREBUILD`;process.env[r]&&(e=process.env[r])}catch{}if(!s){var o=v(i.join(e,`build/Release`),y);if(o)return o;var c=v(i.join(e,`build/Debug`),y);if(c)return c}var g=ne(e);if(g)return g;var T=ne(i.dirname(process.execPath));if(T)return T;var E=(n[0]==`@`?``:`@`+n+`/`)+n+`-`+f+`-`+d;try{return D(i.dirname(t(`module`).createRequire(a.pathToFileURL(i.join(e,`package.json`))).resolve(E)))}catch{}var te=[`platform=`+f,`arch=`+d,`runtime=`+u,`abi=`+l,`uv=`+h,m?`armv=`+m:``,`libc=`+p,`node=`+process.versions.node,process.versions.electron?`electron=`+process.versions.electron:``,typeof __webpack_require__==`function`?`webpack=true`:``].filter(Boolean).join(` `);throw Error(`No native build was found for `+te+`
|
|
3
3
|
attempted loading from: `+e+` and package: `+E+`
|
|
4
|
-
`);function ne(e){var t=_(i.join(e,`prebuilds`)).map(b).filter(x(f,d)).sort(S)[0];if(t)return D(i.join(e,`prebuilds`,t.name))}function D(e){var t=_(e).map(C).filter(w(u,l)).sort(ee(u))[0];if(t)return i.join(e,t.file)}};function _(e){try{return r.readdirSync(e)}catch{return[]}}function v(e,t){var n=_(e).filter(t);return n[0]&&i.join(e,n[0])}function y(e){return/\.node$/.test(e)}function b(e){var t=e.split(`-`);if(t.length===2){var n=t[0],r=t[1].split(`+`);if(n&&r.length&&r.every(Boolean))return{name:e,platform:n,architectures:r}}}function x(e,t){return function(n){return n==null||n.platform!==e?!1:n.architectures.includes(t)}}function S(e,t){return e.architectures.length-t.architectures.length}function C(e){var t=e.split(`.`),n=t.pop(),r={file:e,specificity:0};if(n===`node`){for(var i=0;i<t.length;i++){var a=t[i];if(a===`node`||a===`electron`||a===`node-webkit`)r.runtime=a;else if(a===`napi`)r.napi=!0;else if(a.slice(0,3)===`abi`)r.abi=a.slice(3);else if(a.slice(0,2)===`uv`)r.uv=a.slice(2);else if(a.slice(0,4)===`armv`)r.armv=a.slice(4);else if(a===`glibc`||a===`musl`)r.libc=a;else continue;r.specificity++}return r}}function w(e,t){return function(n){return!(n==null||n.runtime!==e&&!T(n)||n.abi!==t&&!n.napi||n.uv&&n.uv!==h||n.armv&&n.armv!==m||n.libc&&n.libc!==p)}}function T(e){return e.runtime===`node`&&e.napi}function ee(e){return function(t,n){return t.runtime===n.runtime?t.abi===n.abi?t.specificity===n.specificity?0:t.specificity>n.specificity?-1:1:t.abi?-1:1:t.runtime===e?-1:1}}function E(){return process.versions&&process.versions.electron||process.env.ELECTRON_RUN_AS_NODE?!0:typeof window<`u`&&window.process&&window.process.type===`renderer`}function te(e){if(e!==`linux`)return!1;let{familySync:t,MUSL:n}=on();return t()===n}g.parseTags=C,g.matchTags=w,g.compareTags=ee,g.parseTuple=b,g.matchTuple=x,g.compareTuples=S})),cn=n(((e,t)=>{t.exports=sn()(__dirname)}));if(!(process.env.CBOR_NATIVE_ACCELERATION_DISABLED!==void 0&&process.env.CBOR_NATIVE_ACCELERATION_DISABLED.toLowerCase()===`true`)){let e;try{e=typeof t==`function`?cn():be(import.meta.url)(`cbor-extract`),e&&$e(e.extractStrings)}catch{}}var ln=pe();let un,dn,fn;const pn={connections:8,keepAliveTimeout:1e4,pipelining:1},mn={...pn,allowH2:!1},hn={...pn,allowH2:!0},gn={retryAfter:!0,statusCodes:[500,502,503,504]},_n={retryAfter:!0,methods:[`PUT`],statusCodes:[429]};function vn(e){return e?.dispatcher??Sn()}function yn(e){return e?.dispatcher??Cn()}function bn(e){return e?.dispatcher??wn()}function xn(e,t){return new ln.RetryAgent(new ln.Agent(e),t)}function Sn(){return un??=xn(mn,gn),un}function Cn(){return dn??=xn(hn,gn),dn}function wn(){return fn??=xn(hn,_n),fn}let Tn=null;async function En(){return Tn||=import(`../../_chunks/workflow/src-CQuMexnO.js`).then(t=>e(t.t(),1)).catch(()=>null),Tn}let Dn=null;async function On(){return Dn||=En().then(e=>e?e.trace.getTracer(`workflow`):null),Dn}async function kn(e,...t){let[n,r]=await Promise.all([On(),En()]),{fn:i,opts:a}=typeof t[0]==`function`?{fn:t[0],opts:{}}:{fn:t[1],opts:t[0]};if(!i)throw Error(`Function to trace must be provided`);return!n||!r?await i():n.startActiveSpan(e,a,async e=>{try{let t=await i(e);return e.setStatus({code:r.SpanStatusCode.OK}),t}catch(t){throw e.setStatus({code:r.SpanStatusCode.ERROR,message:t.message}),t}finally{e.end()}})}async function An(e){let t=await En();if(t)return t.SpanKind[e]}async function jn(e){let t=await En();if(!t)return;let n={};t.propagation.inject(t.context.active(),n);for(let[t,r]of Object.entries(n))e.set(t,r)}function G(...e){return t=>Object.fromEntries(e.map(e=>[e,t]))}const Mn=G(`http.request.method`),Nn=G(`url.full`),Pn=G(`server.address`),Fn=G(`server.port`),In=G(`http.response.status_code`),Ln=G(`error.type`),Rn=G(`workflow.world.parse.format`),zn=G(`peer.service`),Bn=G(`rpc.system`),Vn=G(`rpc.service`),Hn=G(`rpc.method`),Un=G(`workflow.run.id`),Wn=G(`step.id`),Gn=G(`workflow.stream.name`),Kn=G(`workflow.stream.operation`),qn=G(`workflow.stream.start_index`),Jn=()=>ee(`WORKFLOW_REQUEST_TIMEOUT_MS`,6e4,{integer:!0,min:1}),Yn=typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`),Xn=[`x-vercel-id`,`x-vercel-error`,`x-vercel-mitigated`];function Zn(e){return Xn.flatMap(t=>{let n=e.get(t);return n?[`${t}=${n}`]:[]})}function Qn(e){let t=Zn(e);return t.length>0?` (${t.join(`; `)})`:``}function $n(e,t,n,r){if(!Yn)return;let i=Zn(n.headers),a=i.length>0?`; ${i.join(`; `)}`:``;console.debug(`[workflow:world-vercel:http] ${e} ${t} -> ${n.status} (${r}ms${a})`)}function er(e,t,n){if(!process.env.DEBUG)return;let r=Array.from(n.entries()).filter(([e])=>e.toLowerCase()!==`authorization`).map(([e,t])=>`-H "${e}: ${t}"`).join(` `);console.error(`Failed to fetch, reproduce with:\ncurl -X ${e} ${r} "${t}"`)}function tr(e){if(!e)return;let t=parseInt(e,10);return Number.isNaN(t)?void 0:t}function nr(e,t,n={}){let{retryAfter:r,code:c,url:u,mitigated:d}=n;return e===409?new l(t):e===410?new o(t):e===425?new a(t,{retryAfter:r}):e===429?rr(e,d)?new i(`${t} (x-vercel-mitigated=challenge)`,{url:u,status:e,code:`TRANSPORT`,retryAfter:r}):new s(t,{retryAfter:r}):new i(t,{url:u,status:e,code:c,retryAfter:r})}function rr(e,t){return e===429&&t===`challenge`}async function ir(e){return e?.token??process.env.VERCEL_TOKEN??await(0,Ae.getVercelOidcToken)().catch(()=>null)}function ar(e){try{let t=new URL(e);return{serverAddress:t.hostname,serverPort:t.port?parseInt(t.port,10):t.protocol===`https:`?443:80}}catch{return{}}}function or(e){let{method:t,url:n,peerService:r}=e,{serverAddress:i,serverPort:a}=ar(n);return{...Mn(t),...Nn(n),...i?Pn(i):{},...a?Fn(a):{},...zn(r),...Bn(`http`),...Vn(r)}}async function sr(e){let{method:t,url:n,headers:r,body:a,dispatcher:o,peerService:s=`workflow-server`,timeoutMs:c=Jn(),signal:l,injectTraceContext:u=!0,cacheBust:d=!0,logLabel:f,buildError:p,spanName:m,attributes:h,durationAttribute:g}=e,_=f??n;return kn(m??`http ${t}`,{kind:await An(`CLIENT`)},async e=>{e?.setAttributes(or({method:t,url:n,peerService:s})),h&&e?.setAttributes(h),u&&await jn(r),d&&r.set(`X-Request-Time`,Date.now().toString());let f=c==null?void 0:AbortSignal.timeout(c),m=l&&f?AbortSignal.any([l,f]):l??f,v=Date.now(),y;try{y=await fetch(n,{method:t,headers:r,body:a,signal:m,dispatcher:o})}catch(r){let a=Date.now()-v;if(r instanceof Error&&(r.name===`TimeoutError`||r.name===`AbortError`)){let o=new i(`${t} ${_} timed out after ${a}ms`,{url:n,cause:r});throw e?.setAttributes({...Ln(`TIMEOUT`)}),e?.recordException?.(o),o}throw r}let b=Date.now()-v;if($n(t,_,y,b),e?.setAttributes({...In(y.status)}),g&&e?.setAttributes({[g]:b}),!y.ok){if(e?.setAttributes({...Ln(`HTTP ${y.status}`)}),er(t,n,r),p){let t=await p(y);throw e?.recordException?.(t),t}let i=await y.text().catch(()=>``),a=nr(y.status,`${t} ${_} -> HTTP ${y.status}: ${y.statusText}${i?` ${i}`:``}${Qn(y.headers)}`,{url:n,retryAfter:tr(y.headers.get(`Retry-After`))});throw e?.recordException?.(a),a}return y})}const cr=`5.0.0-beta.26`,lr=new Set([`GET`,`HEAD`]),ur=new Set([`UND_ERR_REQ_RETRY`,`UND_ERR_SOCKET`,`UND_ERR_CONNECT`,`UND_ERR_CONNECT_TIMEOUT`,`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`UND_ERR_CLOSED`,`ECONNRESET`,`ECONNREFUSED`,`ENOTFOUND`,`EAI_AGAIN`,`EPIPE`]);function dr(e){let t=e;for(let e=0;t!=null&&e<5;e++){if(typeof t==`object`&&`code`in t){let e=t.code;if(typeof e==`string`&&ur.has(e))return e}t=t?.cause}}const fr=()=>process.env.VERCEL_WORKFLOW_SERVER_URL||``,pr=()=>process.env.WORKFLOW_TEST_LIMIT_OVERRIDES?.trim()||``;function mr(e){return e}const hr=()=>{let e=process.env.VERCEL_DEPLOYMENT_ID;return e?`@workflow/world-vercel/${cr} node-${process.version} ${_e.platform()} (${_e.arch()}) ${e}`:`@workflow/world-vercel/${cr} node-${process.version} ${_e.platform()} (${_e.arch()})`},gr=e=>{let t=e?.projectConfig,n=fr()||`https://vercel-workflow.com`,r=process.env.WORKFLOW_VERCEL_BACKEND_URL,i=!!(t?.projectId&&t?.teamId);return{baseUrl:i?r||`https://api.vercel.com/v1/workflow`:`${n}/api`,usingProxy:i}},_r=(e,t)=>{let n=e?.projectConfig,r=new Headers(e?.headers);r.set(`User-Agent`,hr());let i=pr();i&&r.set(`x-workflow-test-limit-overrides`,i),n&&(r.set(`x-vercel-environment`,n.environment||`production`),n.projectId&&r.set(`x-vercel-project-id`,n.projectId),n.teamId&&r.set(`x-vercel-team-id`,n.teamId));let a=fr();return a&&t.usingProxy&&r.set(`x-vercel-workflow-api-url`,a),r};async function vr(e){let{baseUrl:t,usingProxy:n}=gr(e),r=_r(e,{usingProxy:n});if(n){if(!e?.token)throw Error(`world-vercel: api-workflow proxy requested (${t}) but no Vercel auth token was provided. Pass one as \`config.token\` (the SDK reads it from \`WORKFLOW_VERCEL_AUTH_TOKEN\`).`);r.set(`Authorization`,`Bearer ${e.token}`)}else{let t;try{t=await(0,Ae.getVercelOidcToken)()}catch{}let n=e?.token??t;n&&r.set(`Authorization`,`Bearer ${n}`),t&&r.set(`x-vercel-trusted-oidc-idp-token`,t)}return{baseUrl:t,headers:r,usingProxy:n}}async function K({endpoint:e,options:t={},config:n={},schema:r,data:a,onResponse:o}){let s=t.method||`GET`,{baseUrl:c,headers:l}=await vr(n),u=`${c}${e}`;return kn(`http ${s}`,{kind:await An(`CLIENT`)},async c=>{c?.setAttributes(or({method:s,url:u,peerService:`workflow-server`})),l.set(`Accept`,`application/cbor`),await jn(l);let d;a!==void 0&&(l.set(`Content-Type`,`application/cbor`),d=Xt(a));let f=lr.has(s.toUpperCase()),p,m=``;for(let r=0;;r++){l.set(`X-Request-Time`,Date.now().toString());let a=AbortSignal.timeout(Jn()),h=t.signal?AbortSignal.any([t.signal,a]):a,g=new Request(u,{...t,body:d,headers:l,signal:h}),_=Date.now(),v;try{v=await fetch(g,{dispatcher:vn(n)})}catch(t){let n=Date.now()-_;if(t instanceof Error&&(t.name===`TimeoutError`||t.name===`AbortError`)){let r=new i(`${s} ${e} timed out after ${n}ms`,{url:u,code:`TIMEOUT`,cause:t});throw c?.setAttributes({...Ln(`TIMEOUT`)}),c?.recordException?.(r),r}let r=dr(t);if(r){let a=new i(`${s} ${e} transport failure after ${n}ms (${r})`,{url:u,code:`TRANSPORT`,cause:t});throw c?.setAttributes({...Ln(`TRANSPORT`)}),c?.recordException?.(a),a}throw t}let y=Date.now()-_;if(m=Qn(v.headers),$n(s,e,v,y),c?.setAttributes({...In(v.status)}),!v.ok){let t=await br(v).then(e=>e.data).catch(()=>({})),n=t.code??t.error;er(g.method,u,l);let r=tr(v.headers.get(`Retry-After`)),i=(t.message||`${g.method} ${e} -> HTTP ${v.status}: ${v.statusText}`)+m,a=nr(v.status,i,{url:u,code:n,retryAfter:r,mitigated:v.headers.get(`x-vercel-mitigated`)});throw c?.setAttributes({...Ln(n||`HTTP ${v.status}`)}),c?.recordException?.(a),a}o?.(v);try{p=await kn(`world.parse`,async e=>{let t=await br(v),n=(v.headers.get(`Content-Type`)||``).includes(`application/cbor`);return e?.setAttributes({...Rn(n?`cbor`:`json`)}),t});break}catch(t){if(f&&r<2){let n=100*2**r;c?.setAttributes({...Ln(`PARSE_ERROR_RETRYING`)}),Yn&&console.debug(`[workflow:world-vercel:http] ${s} ${e} body parse failed (attempt ${r+1}/3); retrying in ${n}ms: ${t}`),await new Promise(e=>setTimeout(e,n));continue}let n=v.headers.get(`Content-Type`)||`unknown`;throw new i(`Failed to parse response body for ${s} ${e}${m} (Content-Type: ${n}):\n\n${t}`,{url:u,code:`PARSE_ERROR`,cause:t})}}return await kn(`world.validate`,async()=>{let t=r.safeParse(p.data);if(!t.success){let n=t.error.issues.map(e=>` ${e.path.length>0?e.path.join(`.`):`<root>`}: ${e.message}`).join(`
|
|
4
|
+
`);function ne(e){var t=_(i.join(e,`prebuilds`)).map(b).filter(x(f,d)).sort(S)[0];if(t)return D(i.join(e,`prebuilds`,t.name))}function D(e){var t=_(e).map(C).filter(w(u,l)).sort(ee(u))[0];if(t)return i.join(e,t.file)}};function _(e){try{return r.readdirSync(e)}catch{return[]}}function v(e,t){var n=_(e).filter(t);return n[0]&&i.join(e,n[0])}function y(e){return/\.node$/.test(e)}function b(e){var t=e.split(`-`);if(t.length===2){var n=t[0],r=t[1].split(`+`);if(n&&r.length&&r.every(Boolean))return{name:e,platform:n,architectures:r}}}function x(e,t){return function(n){return n==null||n.platform!==e?!1:n.architectures.includes(t)}}function S(e,t){return e.architectures.length-t.architectures.length}function C(e){var t=e.split(`.`),n=t.pop(),r={file:e,specificity:0};if(n===`node`){for(var i=0;i<t.length;i++){var a=t[i];if(a===`node`||a===`electron`||a===`node-webkit`)r.runtime=a;else if(a===`napi`)r.napi=!0;else if(a.slice(0,3)===`abi`)r.abi=a.slice(3);else if(a.slice(0,2)===`uv`)r.uv=a.slice(2);else if(a.slice(0,4)===`armv`)r.armv=a.slice(4);else if(a===`glibc`||a===`musl`)r.libc=a;else continue;r.specificity++}return r}}function w(e,t){return function(n){return!(n==null||n.runtime!==e&&!T(n)||n.abi!==t&&!n.napi||n.uv&&n.uv!==h||n.armv&&n.armv!==m||n.libc&&n.libc!==p)}}function T(e){return e.runtime===`node`&&e.napi}function ee(e){return function(t,n){return t.runtime===n.runtime?t.abi===n.abi?t.specificity===n.specificity?0:t.specificity>n.specificity?-1:1:t.abi?-1:1:t.runtime===e?-1:1}}function E(){return process.versions&&process.versions.electron||process.env.ELECTRON_RUN_AS_NODE?!0:typeof window<`u`&&window.process&&window.process.type===`renderer`}function te(e){if(e!==`linux`)return!1;let{familySync:t,MUSL:n}=on();return t()===n}g.parseTags=C,g.matchTags=w,g.compareTags=ee,g.parseTuple=b,g.matchTuple=x,g.compareTuples=S})),cn=n(((e,t)=>{t.exports=sn()(__dirname)}));if(!(process.env.CBOR_NATIVE_ACCELERATION_DISABLED!==void 0&&process.env.CBOR_NATIVE_ACCELERATION_DISABLED.toLowerCase()===`true`)){let e;try{e=typeof t==`function`?cn():be(import.meta.url)(`cbor-extract`),e&&$e(e.extractStrings)}catch{}}var ln=pe();let un,dn,fn;const pn={connections:8,keepAliveTimeout:1e4,pipelining:1},mn={...pn,allowH2:!1},hn={...pn,allowH2:!0},gn={retryAfter:!0,statusCodes:[500,502,503,504]},_n={retryAfter:!0,methods:[`PUT`],statusCodes:[429]};function vn(e){return e?.dispatcher??Sn()}function yn(e){return e?.dispatcher??Cn()}function bn(e){return e?.dispatcher??wn()}function xn(e,t){return new ln.RetryAgent(new ln.Agent(e),t)}function Sn(){return un??=xn(mn,gn),un}function Cn(){return dn??=xn(hn,gn),dn}function wn(){return fn??=xn(hn,_n),fn}let Tn=null;async function En(){return Tn||=import(`../../_chunks/workflow/src-CQuMexnO.js`).then(t=>e(t.t(),1)).catch(()=>null),Tn}let Dn=null;async function On(){return Dn||=En().then(e=>e?e.trace.getTracer(`workflow`):null),Dn}async function kn(e,...t){let[n,r]=await Promise.all([On(),En()]),{fn:i,opts:a}=typeof t[0]==`function`?{fn:t[0],opts:{}}:{fn:t[1],opts:t[0]};if(!i)throw Error(`Function to trace must be provided`);return!n||!r?await i():n.startActiveSpan(e,a,async e=>{try{let t=await i(e);return e.setStatus({code:r.SpanStatusCode.OK}),t}catch(t){throw e.setStatus({code:r.SpanStatusCode.ERROR,message:t.message}),t}finally{e.end()}})}async function An(e){let t=await En();if(t)return t.SpanKind[e]}async function jn(e){let t=await En();if(!t)return;let n={};t.propagation.inject(t.context.active(),n);for(let[t,r]of Object.entries(n))e.set(t,r)}function G(...e){return t=>Object.fromEntries(e.map(e=>[e,t]))}const Mn=G(`http.request.method`),Nn=G(`url.full`),Pn=G(`server.address`),Fn=G(`server.port`),In=G(`http.response.status_code`),Ln=G(`error.type`),Rn=G(`workflow.world.parse.format`),zn=G(`peer.service`),Bn=G(`rpc.system`),Vn=G(`rpc.service`),Hn=G(`rpc.method`),Un=G(`workflow.run.id`),Wn=G(`step.id`),Gn=G(`workflow.stream.name`),Kn=G(`workflow.stream.operation`),qn=G(`workflow.stream.start_index`),Jn=()=>ee(`WORKFLOW_REQUEST_TIMEOUT_MS`,6e4,{integer:!0,min:1}),Yn=typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`),Xn=[`x-vercel-id`,`x-vercel-error`,`x-vercel-mitigated`];function Zn(e){return Xn.flatMap(t=>{let n=e.get(t);return n?[`${t}=${n}`]:[]})}function Qn(e){let t=Zn(e);return t.length>0?` (${t.join(`; `)})`:``}function $n(e,t,n,r){if(!Yn)return;let i=Zn(n.headers),a=i.length>0?`; ${i.join(`; `)}`:``;console.debug(`[workflow:world-vercel:http] ${e} ${t} -> ${n.status} (${r}ms${a})`)}function er(e,t,n){if(!process.env.DEBUG)return;let r=Array.from(n.entries()).filter(([e])=>e.toLowerCase()!==`authorization`).map(([e,t])=>`-H "${e}: ${t}"`).join(` `);console.error(`Failed to fetch, reproduce with:\ncurl -X ${e} ${r} "${t}"`)}function tr(e){if(!e)return;let t=parseInt(e,10);return Number.isNaN(t)?void 0:t}function nr(e,t,n={}){let{retryAfter:r,code:c,url:u,mitigated:d}=n;return e===409?new l(t):e===410?new o(t):e===425?new a(t,{retryAfter:r}):e===429?rr(e,d)?new i(`${t} (x-vercel-mitigated=challenge)`,{url:u,status:e,code:`TRANSPORT`,retryAfter:r}):new s(t,{retryAfter:r}):new i(t,{url:u,status:e,code:c,retryAfter:r})}function rr(e,t){return e===429&&t===`challenge`}async function ir(e){return e?.token??process.env.VERCEL_TOKEN??await(0,Ae.getVercelOidcToken)().catch(()=>null)}function ar(e){try{let t=new URL(e);return{serverAddress:t.hostname,serverPort:t.port?parseInt(t.port,10):t.protocol===`https:`?443:80}}catch{return{}}}function or(e){let{method:t,url:n,peerService:r}=e,{serverAddress:i,serverPort:a}=ar(n);return{...Mn(t),...Nn(n),...i?Pn(i):{},...a?Fn(a):{},...zn(r),...Bn(`http`),...Vn(r)}}async function sr(e){let{method:t,url:n,headers:r,body:a,dispatcher:o,peerService:s=`workflow-server`,timeoutMs:c=Jn(),signal:l,injectTraceContext:u=!0,cacheBust:d=!0,logLabel:f,buildError:p,spanName:m,attributes:h,durationAttribute:g}=e,_=f??n;return kn(m??`http ${t}`,{kind:await An(`CLIENT`)},async e=>{e?.setAttributes(or({method:t,url:n,peerService:s})),h&&e?.setAttributes(h),u&&await jn(r),d&&r.set(`X-Request-Time`,Date.now().toString());let f=c==null?void 0:AbortSignal.timeout(c),m=l&&f?AbortSignal.any([l,f]):l??f,v=Date.now(),y;try{y=await fetch(n,{method:t,headers:r,body:a,signal:m,dispatcher:o})}catch(r){let a=Date.now()-v;if(r instanceof Error&&(r.name===`TimeoutError`||r.name===`AbortError`)){let o=new i(`${t} ${_} timed out after ${a}ms`,{url:n,cause:r});throw e?.setAttributes({...Ln(`TIMEOUT`)}),e?.recordException?.(o),o}throw r}let b=Date.now()-v;if($n(t,_,y,b),e?.setAttributes({...In(y.status)}),g&&e?.setAttributes({[g]:b}),!y.ok){if(e?.setAttributes({...Ln(`HTTP ${y.status}`)}),er(t,n,r),p){let t=await p(y);throw e?.recordException?.(t),t}let i=await y.text().catch(()=>``),a=nr(y.status,`${t} ${_} -> HTTP ${y.status}: ${y.statusText}${i?` ${i}`:``}${Qn(y.headers)}`,{url:n,retryAfter:tr(y.headers.get(`Retry-After`))});throw e?.recordException?.(a),a}return y})}const cr=`5.0.0-beta.27`,lr=new Set([`GET`,`HEAD`]),ur=new Set([`UND_ERR_REQ_RETRY`,`UND_ERR_SOCKET`,`UND_ERR_CONNECT`,`UND_ERR_CONNECT_TIMEOUT`,`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`UND_ERR_CLOSED`,`ECONNRESET`,`ECONNREFUSED`,`ENOTFOUND`,`EAI_AGAIN`,`EPIPE`]);function dr(e){let t=e;for(let e=0;t!=null&&e<5;e++){if(typeof t==`object`&&`code`in t){let e=t.code;if(typeof e==`string`&&ur.has(e))return e}t=t?.cause}}const fr=()=>process.env.VERCEL_WORKFLOW_SERVER_URL||``,pr=()=>process.env.WORKFLOW_TEST_LIMIT_OVERRIDES?.trim()||``;function mr(e){return e}const hr=()=>{let e=process.env.VERCEL_DEPLOYMENT_ID;return e?`@workflow/world-vercel/${cr} node-${process.version} ${_e.platform()} (${_e.arch()}) ${e}`:`@workflow/world-vercel/${cr} node-${process.version} ${_e.platform()} (${_e.arch()})`},gr=e=>{let t=e?.projectConfig,n=fr()||`https://vercel-workflow.com`,r=process.env.WORKFLOW_VERCEL_BACKEND_URL,i=!!(t?.projectId&&t?.teamId);return{baseUrl:i?r||`https://api.vercel.com/v1/workflow`:`${n}/api`,usingProxy:i}},_r=(e,t)=>{let n=e?.projectConfig,r=new Headers(e?.headers);r.set(`User-Agent`,hr());let i=pr();i&&r.set(`x-workflow-test-limit-overrides`,i),n&&(r.set(`x-vercel-environment`,n.environment||`production`),n.projectId&&r.set(`x-vercel-project-id`,n.projectId),n.teamId&&r.set(`x-vercel-team-id`,n.teamId));let a=fr();return a&&t.usingProxy&&r.set(`x-vercel-workflow-api-url`,a),r};async function vr(e){let{baseUrl:t,usingProxy:n}=gr(e),r=_r(e,{usingProxy:n});if(n){if(!e?.token)throw Error(`world-vercel: api-workflow proxy requested (${t}) but no Vercel auth token was provided. Pass one as \`config.token\` (the SDK reads it from \`WORKFLOW_VERCEL_AUTH_TOKEN\`).`);r.set(`Authorization`,`Bearer ${e.token}`)}else{let t;try{t=await(0,Ae.getVercelOidcToken)()}catch{}let n=e?.token??t;n&&r.set(`Authorization`,`Bearer ${n}`),t&&r.set(`x-vercel-trusted-oidc-idp-token`,t)}return{baseUrl:t,headers:r,usingProxy:n}}async function K({endpoint:e,options:t={},config:n={},schema:r,data:a,onResponse:o}){let s=t.method||`GET`,{baseUrl:c,headers:l}=await vr(n),u=`${c}${e}`;return kn(`http ${s}`,{kind:await An(`CLIENT`)},async c=>{c?.setAttributes(or({method:s,url:u,peerService:`workflow-server`})),l.set(`Accept`,`application/cbor`),await jn(l);let d;a!==void 0&&(l.set(`Content-Type`,`application/cbor`),d=Xt(a));let f=lr.has(s.toUpperCase()),p,m=``;for(let r=0;;r++){l.set(`X-Request-Time`,Date.now().toString());let a=AbortSignal.timeout(Jn()),h=t.signal?AbortSignal.any([t.signal,a]):a,g=new Request(u,{...t,body:d,headers:l,signal:h}),_=Date.now(),v;try{v=await fetch(g,{dispatcher:vn(n)})}catch(t){let n=Date.now()-_;if(t instanceof Error&&(t.name===`TimeoutError`||t.name===`AbortError`)){let r=new i(`${s} ${e} timed out after ${n}ms`,{url:u,code:`TIMEOUT`,cause:t});throw c?.setAttributes({...Ln(`TIMEOUT`)}),c?.recordException?.(r),r}let r=dr(t);if(r){let a=new i(`${s} ${e} transport failure after ${n}ms (${r})`,{url:u,code:`TRANSPORT`,cause:t});throw c?.setAttributes({...Ln(`TRANSPORT`)}),c?.recordException?.(a),a}throw t}let y=Date.now()-_;if(m=Qn(v.headers),$n(s,e,v,y),c?.setAttributes({...In(v.status)}),!v.ok){let t=await br(v).then(e=>e.data).catch(()=>({})),n=t.code??t.error;er(g.method,u,l);let r=tr(v.headers.get(`Retry-After`)),i=(t.message||`${g.method} ${e} -> HTTP ${v.status}: ${v.statusText}`)+m,a=nr(v.status,i,{url:u,code:n,retryAfter:r,mitigated:v.headers.get(`x-vercel-mitigated`)});throw c?.setAttributes({...Ln(n||`HTTP ${v.status}`)}),c?.recordException?.(a),a}o?.(v);try{p=await kn(`world.parse`,async e=>{let t=await br(v),n=(v.headers.get(`Content-Type`)||``).includes(`application/cbor`);return e?.setAttributes({...Rn(n?`cbor`:`json`)}),t});break}catch(t){if(f&&r<2){let n=100*2**r;c?.setAttributes({...Ln(`PARSE_ERROR_RETRYING`)}),Yn&&console.debug(`[workflow:world-vercel:http] ${s} ${e} body parse failed (attempt ${r+1}/3); retrying in ${n}ms: ${t}`),await new Promise(e=>setTimeout(e,n));continue}let n=v.headers.get(`Content-Type`)||`unknown`;throw new i(`Failed to parse response body for ${s} ${e}${m} (Content-Type: ${n}):\n\n${t}`,{url:u,code:`PARSE_ERROR`,cause:t})}}return await kn(`world.validate`,async()=>{let t=r.safeParse(p.data);if(!t.success){let n=t.error.issues.map(e=>` ${e.path.length>0?e.path.join(`.`):`<root>`}: ${e.message}`).join(`
|
|
5
5
|
`),r=process.env.DEBUG?`\n\nResponse context: ${p.getDebugContext()}`:``;throw new i(`Schema validation failed for ${s} ${e}${m}:\n${n}${r}`,{url:u,code:`SCHEMA_VALIDATION`,cause:t.error})}return t.data})})}function yr(e){let t=he(e,{depth:3,maxArrayLength:10,breakLength:120});return t.length>500?`${t.slice(0,500)}...`:t}async function br(e){let t=e.headers.get(`Content-Type`)||``;if(t.includes(`application/cbor`)){let n=await e.arrayBuffer(),r=wt(new Uint8Array(n));return{data:r,getDebugContext:()=>`Content-Type: ${t}, ${n.byteLength} bytes (CBOR), preview: ${yr(r)}`}}let n=await e.text(),r=JSON.parse(n);return{data:r,getDebugContext:()=>`Content-Type: ${t}, ${n.length} bytes, preview: ${yr(r)}`}}function xr(e,t){t?.limit&&e.set(`limit`,t.limit.toString()),t?.cursor&&e.set(`cursor`,t.cursor),t?.sortOrder&&e.set(`sortOrder`,t.sortOrder)}function Sr(e){let t=e.toString();return t?`?${t}`:``}function Cr(e){return{runs:{get(t){return K({endpoint:`/v2/analytics/runs/${encodeURIComponent(t)}`,config:e,schema:d})},list(t={}){let n=new URLSearchParams;return t.workflowName&&n.set(`workflowName`,t.workflowName),t.status&&n.set(`status`,t.status),t.startTime&&t.endTime&&(n.set(`startTime`,t.startTime),n.set(`endTime`,t.endTime)),xr(n,t.pagination),K({endpoint:`/v2/analytics/runs${Sr(n)}`,config:e,schema:D(d)})}},steps:{get(t,n){return K({endpoint:`/v2/analytics/runs/${encodeURIComponent(t)}/steps/${encodeURIComponent(n)}`,config:e,schema:ue})},list(t){let n=new URLSearchParams;return xr(n,t.pagination),K({endpoint:`/v2/analytics/runs/${encodeURIComponent(t.runId)}/steps${Sr(n)}`,config:e,schema:D(ue)})}},events:{get(t,n){return K({endpoint:`/v2/analytics/runs/${encodeURIComponent(t)}/events/${encodeURIComponent(n)}`,config:e,schema:de})},list(t){let n=new URLSearchParams;return t.eventType&&n.set(`eventType`,t.eventType),t.correlationId&&n.set(`correlationId`,t.correlationId),xr(n,t.pagination),K({endpoint:`/v2/analytics/runs/${encodeURIComponent(t.runId)}/events${Sr(n)}`,config:e,schema:D(de)})},listByCorrelationId(t){let n=new URLSearchParams;return n.set(`correlationId`,t.correlationId),xr(n,t.pagination),K({endpoint:`/v2/analytics/events${Sr(n)}`,config:e,schema:D(de)})}},hooks:{get(t,n){let r=new URLSearchParams;return n?.runId&&r.set(`runId`,n.runId),K({endpoint:`/v2/analytics/hooks/${encodeURIComponent(t)}${Sr(r)}`,config:e,schema:b})},list(t){let n=new URLSearchParams;return n.set(`runId`,t.runId),xr(n,t.pagination),K({endpoint:`/v2/analytics/hooks${Sr(n)}`,config:e,schema:D(b)})}},waits:{get(t,n){return K({endpoint:`/v2/analytics/runs/${encodeURIComponent(t)}/waits/${encodeURIComponent(n)}`,config:e,schema:x})},list(t){let n=new URLSearchParams;return t.status&&n.set(`status`,t.status),xr(n,t.pagination),K({endpoint:`/v2/analytics/runs/${encodeURIComponent(t.runId)}/waits${Sr(n)}`,config:e,schema:D(x)})}}}}async function wr(e,t,n){if(e.length!==32)throw Error(`Invalid deployment key length: expected 32 bytes for AES-256, got ${e.length} bytes`);if(!t||typeof t!=`string`)throw Error(`projectId must be a non-empty string`);let r=await me.subtle.importKey(`raw`,e,`HKDF`,!1,[`deriveBits`]),i=new TextEncoder().encode(`${t}|${n}`),a=await me.subtle.deriveBits({name:`HKDF`,hash:`SHA-256`,salt:new Uint8Array(32),info:i},r,256);return new Uint8Array(a)}async function Tr(e,t,n,r){let i=await ir({token:r?.token});if(!i)throw Error(`Cannot fetch run key: no OIDC token or VERCEL_TOKEN available`);let a=new URLSearchParams({projectId:t,runId:n});r?.teamId&&a.set(`teamId`,r.teamId);let o=await(await sr({method:`GET`,url:`https://api.vercel.com/v1/workflow/run-key/${e}?${a}`,headers:new Headers({Authorization:`Bearer ${i}`}),dispatcher:vn({dispatcher:r?.dispatcher}),peerService:`vercel-api`,timeoutMs:null,buildError:async t=>{let r;try{r=await t.text()}catch{r=`<unable to read response body>`}return Error(`Failed to fetch run key for ${n} (deployment ${e}): HTTP ${t.status} ${t.statusText}${r?` — ${r}`:``}`)}})).json(),s=E({key:ie().nullable()}).safeParse(o);if(!s.success)throw Error(`Invalid response from Vercel API: expected { key: string | null }. Zod error: ${s.error.message}`);if(s.data.key!==null)return Buffer.from(s.data.key,`base64`)}function Er(e,t,n,r){if(!e)return;let i=process.env.VERCEL===`1`,a;function o(){if(a)return a;let e=process.env.VERCEL_DEPLOYMENT_KEY;if(e)return a=Buffer.from(e,`base64`),a}return async function(a,s){let c=typeof a==`string`?a:a.runId,l=typeof a==`string`?s?.deploymentId:a.deploymentId;if(i&&(!l||l===process.env.VERCEL_DEPLOYMENT_ID)){let t=o();return t?wr(t,e,c):void 0}if(l)return Tr(l,e,c,{token:n,teamId:t,dispatcher:r})}}const Dr={peerService:`workflow-server`,rpcSystem:`http`,rpcService:`workflow-server`},Or={"world.runs.get":0,"world.runs.experimentalSetAttributes":0,"world.steps.get":0,"world.events.create":0,"world.events.get":0},kr=new Set([`world.steps.list`,`world.events.list`,`world.hooks.list`]);function Ar(e){if(e.length>=2&&typeof e[1]==`object`&&e[1]!==null){let t=e[1];if(typeof t.eventType==`string`)return t.eventType}}function jr(e,t){return typeof e[t]==`string`?e[t]:void 0}function Mr(e){if(typeof e!=`object`||!e)return;let t=e.runId;return typeof t==`string`?t:void 0}function Nr(e){if(typeof e!=`object`||!e)return;let t=e;if(typeof t.runId==`string`)return t.runId;for(let e of[`run`,`step`,`hook`,`wait`]){let n=t[e];if(typeof n==`object`&&n){let e=n.runId;if(typeof e==`string`)return e}}}function Pr(e,t,n){let r=`${e}.${t}`,i={},a=Or[r],o=a===void 0?kr.has(r)?Mr(n[0]):void 0:jr(n,a);if(o&&Object.assign(i,Un(o)),r===`world.steps.get`){let e=jr(n,1);e&&Object.assign(i,Wn(e))}return i}function Fr(e,t){let n={};for(let r of Object.keys(t))if(typeof t[r]!=`function`)n[r]=t[r];else{let i=t[r],a=String(r);n[r]=async(...t)=>{let n=`${e}.${a}`;if(e===`world.events`&&a===`create`){let r=Ar(t);r&&(n=`${e}.${a} ${r}`)}return kn(n,{kind:await An(`CLIENT`)},async r=>{r?.setAttributes({...zn(Dr.peerService),...Bn(Dr.rpcSystem),...Vn(Dr.rpcService),...Hn(n),...Pr(e,a,t)});let o=await i(...t),s=Nr(o);return s&&r?.setAttributes(Un(s)),o})}}return n}var q=class extends Error{constructor(e){super(e),this.name=`MultipartParseError`}};function Ir(e){let t=new TextEncoder().encode(e);return(e,n=0)=>Buffer.prototype.indexOf.call(e,t,n)}function Lr(e){let t=new TextEncoder().encode(e),n={};for(let e=0;e<t.length;++e){let r=t[e];n[r]===void 0&&(n[r]=[]),n[r].push(e)}return function(e){let r=e.length-1;if(e[r]in n){let i=n[e[r]];for(let n=i.length-1;n>=0;--n)for(let a=i[n],o=r;a>=0&&e[o]===t[a];--a,--o)if(a===0)return o}return-1}}function Rr(e){let t=new TextDecoder(`iso-8859-1`).decode(e).trim().split(/\r?\n/),n=[];for(let e of t){let t=e.indexOf(`:`);if(t>0){let r=e.slice(0,t).trim(),i=e.slice(t+1).trim();n.push([r,i])}}return new Headers(n)}function zr(e){let t=e.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!t)throw new q(`No boundary found in Content-Type header`);return t[1]??t[2]}var Br=class{queue=[];waiters=[];finished=!1;cancelled=!1;error=null;enqueue(e){this.finished||this.cancelled||(this.waiters.length>0?this.waiters.shift().resolve(e):this.queue.push(e))}finish(e){if(!this.finished)for(this.finished=!0,this.error=e||null;this.waiters.length>0;){let t=this.waiters.shift();e?t.reject(e):t.resolve(null)}}cancel(){if(!(this.cancelled||this.finished))for(this.cancelled=!0;this.waiters.length>0;)this.waiters.shift().resolve(null)}async dequeue(){if(this.queue.length>0)return this.queue.shift();if(this.finished||this.cancelled){if(this.error)throw this.error;return null}return new Promise((e,t)=>{this.waiters.push({resolve:e,reject:t})})}get isTerminal(){return this.finished||this.cancelled}};async function*Vr(e,t){if(!e.body)throw new q(`Response body is null`);let n=e.headers.get(`content-type`);if(!n)throw new q(`Missing Content-Type header`);yield*new Hr(zr(n),t).parseStream(e.body)}var Hr=class{boundary;findOpeningBoundary;openingBoundaryLength;findBoundary;findPartialTailBoundary;boundaryLength;findDoubleNewline;maxHeaderSize;maxBoundaryBuffer;state=0;buffer=null;currentHeaders=new Headers;currentPayloadController=null;constructor(e,t={}){this.boundary=e,this.findOpeningBoundary=Ir(`--${e}`),this.openingBoundaryLength=2+e.length,this.findBoundary=Ir(`\r
|
|
6
6
|
--${e}`),this.findPartialTailBoundary=Lr(`\r
|
|
7
7
|
--${e}`),this.boundaryLength=4+e.length,this.findDoubleNewline=Ir(`\r
|
|
8
8
|
\r
|
|
9
9
|
`),this.maxHeaderSize=t.maxHeaderSize??65536,this.maxBoundaryBuffer=t.maxBoundaryBuffer??8192}async*parseStream(e){let t=e.getReader(),n=new Br,r=this.startProducer(t,n);try{yield*this.consumeMessages(n)}finally{n.cancel(),this.closeCurrentPayload();try{await t.cancel()}catch{}await r}}async startProducer(e,t){try{for(;!t.isTerminal;){let n;try{n=await e.read()}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.constructor.name===`AbortError`||e.name===`TimeoutError`||e.constructor.name===`TimeoutError`))break;throw e}let{done:r,value:i}=n;if(r){if(this.buffer!==null&&this.buffer.length>0){let e=this.write(new Uint8Array);for(let n of e){if(t.isTerminal)break;t.enqueue(n)}}if(this.state!==4)throw this.state===0?new q(`Invalid multipart stream: missing initial boundary`):new q(`Unexpected end of stream`);break}if(!(i instanceof Uint8Array))throw new q(`Invalid chunk type: expected Uint8Array, got ${typeof i}`);let a=this.write(i);for(let e of a){if(t.isTerminal)break;t.enqueue(e)}}t.isTerminal||t.finish()}catch(e){this.closeCurrentPayload(e),t.isTerminal||t.finish(e)}finally{try{e.releaseLock()}catch{}}}async*consumeMessages(e){for(;;){let t=await e.dequeue();if(t===null)break;yield t}}write(e){let t=[];if(this.state===4)throw new q(`Unexpected data after end of stream`);let n=0,r=e.length;if(this.buffer!==null){let t=this.buffer.length,n=t+r;if(this.state===2){if(n>this.maxHeaderSize)throw new q(`Buffer size limit exceeded: ${n} bytes > ${this.maxHeaderSize} bytes. This may indicate malformed multipart data with oversized headers.`)}else if(t>this.maxBoundaryBuffer)throw new q(`Boundary buffer limit exceeded: ${t} bytes > ${this.maxBoundaryBuffer} bytes. This may indicate malformed multipart data with invalid boundaries.`);let i=new Uint8Array(n);i.set(this.buffer,0),i.set(e,t),e=i,r=e.length,this.buffer=null}if(r===0&&this.state===0)throw new q(`Invalid multipart stream: missing initial boundary`);for(;;){if(this.state===3){if(r-n<this.boundaryLength){let t=e.subarray(n);if(t.length>this.maxBoundaryBuffer)throw new q(`Boundary buffer limit exceeded: ${t.length} > ${this.maxBoundaryBuffer}`);this.buffer=t;break}let t=this.findBoundary(e,n);if(t===-1){let t=this.findPartialTailBoundary(e);if(t===-1)this.writeBody(n===0?e:e.subarray(n));else{this.writeBody(e.subarray(n,t));let r=e.subarray(t);if(r.length>this.maxBoundaryBuffer)throw new q(`Partial boundary too large: ${r.length} > ${this.maxBoundaryBuffer}`);this.buffer=r}break}this.writeBody(e.subarray(n,t)),this.finishMessage(),n=t+this.boundaryLength,this.state=1}if(this.state===1){if(r-n<2){let t=e.subarray(n);if(t.length>this.maxBoundaryBuffer)throw new q(`After-boundary buffer limit exceeded: ${t.length} > ${this.maxBoundaryBuffer}`);this.buffer=t;break}if(e[n]===45&&e[n+1]===45){this.state=4;break}if(e[n]===13&&e[n+1]===10)n+=2;else if(e[n]===10)n+=1;else throw new q(`Invalid character after boundary: expected CRLF or LF, got 0x${e[n].toString(16)}`);this.state=2}if(this.state===2){if(r-n<4){let t=e.subarray(n);if(t.length>this.maxHeaderSize)throw new q(`Header buffer limit exceeded: ${t.length} > ${this.maxHeaderSize}`);this.buffer=t;break}let i=this.findDoubleNewline(e,n),a=4;if(i===-1&&(i=Ir(`
|
|
10
10
|
|
|
11
|
-
`)(e,n),a=2),i===-1){let t=e.subarray(n);if(t.length>this.maxHeaderSize)throw new q(`Headers too large: ${t.length} > ${this.maxHeaderSize} bytes`);this.buffer=t;break}let o=e.subarray(n,i);this.currentHeaders=Rr(o);let s=this.createStreamingMessage();t.push(s),n=i+a,this.state=3;continue}if(this.state===0){if(r<this.openingBoundaryLength){if(e.length>this.maxBoundaryBuffer)throw new q(`Initial chunk too large for boundary detection: ${e.length} > ${this.maxBoundaryBuffer}`);this.buffer=e;break}if(this.findOpeningBoundary(e)!==0)throw new q(`Invalid multipart stream: missing initial boundary`);n=this.openingBoundaryLength,this.state=1}}return t}createStreamingMessage(){let e=new Headers(this.currentHeaders),t=new ReadableStream({start:e=>{this.currentPayloadController=e}});return this.currentHeaders=new Headers,{headers:e,payload:t}}writeBody(e){this.currentPayloadController&&this.currentPayloadController.enqueue(e)}finishMessage(){this.currentPayloadController&&=(this.currentPayloadController.close(),null)}closeCurrentPayload(e){if(this.currentPayloadController){try{e?this.currentPayloadController.error(e):this.currentPayloadController.close()}catch{}this.currentPayloadController=null}}};const Ur=(e,t,n)=>{let r=e instanceof RegExp?Wr(e,n):e,i=t instanceof RegExp?Wr(t,n):t,a=r!==null&&i!=null&&Gr(r,i,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+r.length,a[1]),post:n.slice(a[1]+i.length)}},Wr=(e,t)=>{let n=t.match(e);return n?n[0]:null},Gr=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},Kr=`\0SLASH`+Math.random()+`\0`,qr=`\0OPEN`+Math.random()+`\0`,Jr=`\0CLOSE`+Math.random()+`\0`,Yr=`\0COMMA`+Math.random()+`\0`,Xr=`\0PERIOD`+Math.random()+`\0`,Zr=new RegExp(Kr,`g`),Qr=new RegExp(qr,`g`),$r=new RegExp(Jr,`g`),ei=new RegExp(Yr,`g`),ti=new RegExp(Xr,`g`),ni=/\\\\/g,ri=/\\{/g,ii=/\\}/g,ai=/\\,/g,oi=/\\\./g;function si(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function ci(e){return e.replace(ni,Kr).replace(ri,qr).replace(ii,Jr).replace(ai,Yr).replace(oi,Xr)}function li(e){return e.replace(Zr,`\\`).replace(Qr,`{`).replace($r,`}`).replace(ei,`,`).replace(ti,`.`)}function ui(e){if(!e)return[``];let t=[],n=Ur(`{`,`}`,e);if(!n)return e.split(`,`);let{pre:r,body:i,post:a}=n,o=r.split(`,`);o[o.length-1]+=`{`+i+`}`;let s=ui(a);return a.length&&(o[o.length-1]+=s.shift(),o.push.apply(o,s)),t.push.apply(t,o),t}function di(e,t={}){if(!e)return[];let{max:n=1e5}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),gi(ci(e),n,!0).map(li)}function fi(e){return`{`+e+`}`}function pi(e){return/^-?0\d/.test(e)}function mi(e,t){return e<=t}function hi(e,t){return e>=t}function gi(e,t,n){let r=[],i=Ur(`{`,`}`,e);if(!i)return[e];let a=i.pre,o=i.post.length?gi(i.post,t,!1):[``];if(/\$$/.test(i.pre))for(let e=0;e<o.length&&e<t;e++){let t=a+`{`+i.body+`}`+o[e];r.push(t)}else{let s=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),l=s||c,u=i.body.indexOf(`,`)>=0;if(!l&&!u)return i.post.match(/,(?!,).*\}/)?(e=i.pre+`{`+i.body+Jr+i.post,gi(e,t,!0)):[e];let d;if(l)d=i.body.split(/\.\./);else if(d=ui(i.body),d.length===1&&d[0]!==void 0&&(d=gi(d[0],t,!1).map(fi),d.length===1))return o.map(e=>i.pre+d[0]+e);let f;if(l&&d[0]!==void 0&&d[1]!==void 0){let e=si(d[0]),n=si(d[1]),r=Math.max(d[0].length,d[1].length),i=d.length===3&&d[2]!==void 0?Math.max(Math.abs(si(d[2])),1):1,a=mi;n<e&&(i*=-1,a=hi);let o=d.some(pi);f=[];for(let s=e;a(s,n)&&f.length<t;s+=i){let e;if(c)e=String.fromCharCode(s),e===`\\`&&(e=``);else if(e=String(s),o){let t=r-e.length;if(t>0){let n=Array(t+1).join(`0`);e=s<0?`-`+n+e.slice(1):n+e}}f.push(e)}}else{f=[];for(let e=0;e<d.length;e++)f.push.apply(f,gi(d[e],t,!1))}for(let e=0;e<f.length;e++)for(let i=0;i<o.length&&r.length<t;i++){let t=a+f[e]+o[i];(!n||l||t)&&r.push(t)}}return r}const _i=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>65536)throw TypeError(`pattern is too long`)},vi={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},yi=e=>e.replace(/[[\]\\-]/g,`\\$&`),bi=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),xi=e=>e.join(``),Si=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;WHILE:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1){l=!0,a++;continue}if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c){c=!0,a++;continue}if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(vi))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue WHILE}}if(c=!1,d){t>d?r.push(yi(d)+`-`+yi(t)):t===d&&r.push(yi(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push(yi(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push(yi(t)),a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l)return[bi(r[0].length===2?r[0].slice(-1):r[0]),!1,u-n,!1];let f=`[`+(l?`^`:``)+xi(r)+`]`,p=`[`+(l?``:`^`)+xi(i)+`]`;return[r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p,s,u-n,!0]},Ci=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\])\]/g,`$1$2`).replace(/\\([^/])/g,`$1`):t?e.replace(/\[([^/\\{}])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,`$1$2`).replace(/\\([^/{}])/g,`$1`);var J;const wi=new Set([`!`,`?`,`+`,`*`,`@`]),Ti=e=>wi.has(e),Ei=e=>Ti(e.type),Di=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),Oi=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),ki=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),Ai=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),ji=`(?!\\.)`,Mi=new Set([`[`,`.`]),Ni=new Set([`..`,`.`]),Pi=new Set(`().*{}+?[]^$\\!`),Fi=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),Ii=`[^/]+?`;let Li=0;var Ri=class{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;id=++Li;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for(`nodejs.util.inspect.custom`)](){return{"@@type":`AST`,id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#r.length,parts:this.#r}}constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.type?this.#l=this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#l=this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...e){for(let t of e)if(t!==``){if(typeof t!=`string`&&!(t instanceof J&&t.#i===this))throw Error(`invalid part: `+t);this.#r.push(t)}}toJSON(){let e=this.type===null?this.#r.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let e=this.#i;for(let t=0;t<this.#a;t++){let n=e.#r[t];if(!(n instanceof J&&n.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(e){let t=new J(this.type,e);for(let e of this.#r)t.copyIn(e);return t}static#f(e,t,n,r,i){let a=r.maxExtglobRecursion??2,o=!1,s=!1,c=-1,l=!1;if(t.type===null){let u=n,d=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,d+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),d+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,d+=n;continue}if(!r.noext&&Ti(n)&&e.charAt(u)===`(`&&i<=a){t.push(d),d=``;let a=new J(n,t);u=J.#f(e,a,u,r,i+1),t.push(a);continue}d+=n}return t.push(d),u}let u=n+1,d=new J(null,t),f=[],p=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,p+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),p+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,p+=n;continue}if(!r.noext&&Ti(n)&&e.charAt(u)===`(`&&(i<=a||t&&t.#h(n))){let a=t&&t.#h(n)?0:1;d.push(p),p=``;let o=new J(n,d);d.push(o),u=J.#f(e,o,u,r,i+a);continue}if(n===`|`){d.push(p),p=``,f.push(d),d=new J(null,t);continue}if(n===`)`)return p===``&&t.#r.length===0&&(t.#u=!0),d.push(p),p=``,t.push(...f,d),u;p+=n}return t.type=null,t.#t=void 0,t.#r=[e.substring(n-1)],u}#p(e){return this.#m(e,Oi)}#m(e,t=Di){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null)return!1;let n=e.#r[0];return!n||typeof n!=`object`||n.type===null?!1:this.#h(n.type,t)}#h(e,t=ki){return!!t.get(this.type)?.includes(e)}#g(e,t){let n=e.#r[0],r=new J(null,n,this.options);r.#r.push(``),n.push(r),this.#_(e,t)}#_(e,t){let n=e.#r[0];this.#r.splice(t,1,...n.#r);for(let e of n.#r)typeof e==`object`&&(e.#i=this);this.#l=void 0}#v(e){return!!Ai.get(this.type)?.has(e)}#y(e){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let t=e.#r[0];return!t||typeof t!=`object`||t.type===null?!1:this.#v(t.type)}#b(e){let t=Ai.get(this.type),n=e.#r[0],r=t?.get(n.type);if(!r)return!1;this.#r=n.#r;for(let e of this.#r)typeof e==`object`&&(e.#i=this);this.type=r,this.#l=void 0,this.#u=!1}static fromGlob(e,t={}){let n=new J(null,void 0,t);return J.#f(e,n,0,t,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(e){let t=e??!!this.#c.dot;if(this.#e===this&&(this.#x(),this.#d()),!Ei(this)){let n=this.isStart()&&this.isEnd()&&!this.#r.some(e=>typeof e!=`string`),r=this.#r.map(t=>{let[r,i,a,o]=typeof t==`string`?J.#C(t,this.#t,n):t.toRegExpSource(e);return this.#t=this.#t||a,this.#n=this.#n||o,r}).join(``),i=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&Ni.has(this.#r[0]))){let n=Mi,a=t&&n.has(r.charAt(0))||r.startsWith(`\\.`)&&n.has(r.charAt(2))||r.startsWith(`\\.\\.`)&&n.has(r.charAt(4)),o=!t&&!e&&n.has(r.charAt(0));i=a?`(?!(?:^|/)\\.\\.?(?:$|/))`:o?ji:``}let a=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(a=`(?:$|\\/)`),[i+r+a,Ci(r),this.#t=!!this.#t,this.#n]}let n=this.type===`*`||this.type===`+`,r=this.type===`!`?`(?:(?!(?:`:`(?:`,i=this.#S(t);if(this.isStart()&&this.isEnd()&&!i&&this.type!==`!`){let e=this.toString(),t=this;return t.#r=[e],t.type=null,t.#t=void 0,[e,Ci(this.toString()),!1,!1]}let a=!n||e||t?``:this.#S(!0);a===i&&(a=``),a&&(i=`(?:${i})(?:${a})*?`);let o=``;if(this.type===`!`&&this.#u)o=(this.isStart()&&!t?ji:``)+Ii;else{let n=this.type===`!`?`))`+(this.isStart()&&!t&&!e?ji:``)+`[^/]*?)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&a?`)`:this.type===`*`&&a?`)?`:`)${this.type}`;o=r+i+n}return[o,Ci(i),this.#t=!!this.#t,this.#n]}#x(){if(Ei(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<this.#r.length;e++){let n=this.#r[e];typeof n==`object`&&(n.#x(),this.#m(n)?(t=!1,this.#_(n,e)):this.#p(n)?(t=!1,this.#g(n,e)):this.#y(n)&&(t=!1,this.#b(n)))}}while(!t&&++e<10)}else for(let e of this.#r)typeof e==`object`&&e.#x();this.#l=void 0}#S(e){return this.#r.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#C(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(r){r=!1,i+=(Pi.has(c)?`\\`:``)+c;continue}if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?Ii:`[^/]*?`,t=!0;continue}else o=!1;if(c===`\\`){s===e.length-1?i+=`\\\\`:r=!0;continue}if(c===`[`){let[n,r,o,c]=Si(e,s);if(o){i+=n,a||=r,s+=o-1,t||=c;continue}}if(c===`?`){i+=`[^/]`,t=!0;continue}i+=Fi(c)}return[i,Ci(e),!!t,a]}};J=Ri;const zi=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,`[$&]`):e.replace(/[?*()[\]\\{}]/g,`\\$&`):t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),Y=(e,t,n={})=>(_i(t),!n.nocomment&&t.charAt(0)===`#`?!1:new da(t,n).match(e)),Bi=/^\*+([^+@!?*[(]*)$/,Vi=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),Hi=e=>t=>t.endsWith(e),Ui=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),Wi=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Gi=/^\*+\.\*+$/,Ki=e=>!e.startsWith(`.`)&&e.includes(`.`),qi=e=>e!==`.`&&e!==`..`&&e.includes(`.`),Ji=/^\.\*+$/,Yi=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),Xi=/^\*+$/,Zi=e=>e.length!==0&&!e.startsWith(`.`),Qi=e=>e.length!==0&&e!==`.`&&e!==`..`,$i=/^\?+([^+@!?*[(]*)?$/,ea=([e,t=``])=>{let n=ia([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},ta=([e,t=``])=>{let n=aa([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},na=([e,t=``])=>{let n=aa([e]);return t?e=>n(e)&&e.endsWith(t):n},ra=([e,t=``])=>{let n=ia([e]);return t?e=>n(e)&&e.endsWith(t):n},ia=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},aa=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},oa=typeof process==`object`&&process?typeof process.env==`object`&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,sa={win32:{sep:`\\`},posix:{sep:`/`}};Y.sep=oa===`win32`?sa.win32.sep:sa.posix.sep;const X=Symbol(`globstar **`);Y.GLOBSTAR=X,Y.filter=(e,t={})=>n=>Y(n,e,t);const Z=(e,t={})=>Object.assign({},e,t);Y.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return Y;let t=Y;return Object.assign((n,r,i={})=>t(n,r,Z(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,Z(e,n))}static defaults(n){return t.defaults(Z(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,Z(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,Z(e,r))}},unescape:(n,r={})=>t.unescape(n,Z(e,r)),escape:(n,r={})=>t.escape(n,Z(e,r)),filter:(n,r={})=>t.filter(n,Z(e,r)),defaults:n=>t.defaults(Z(e,n)),makeRe:(n,r={})=>t.makeRe(n,Z(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,Z(e,r)),match:(n,r,i={})=>t.match(n,r,Z(e,i)),sep:t.sep,GLOBSTAR:X})};const ca=(e,t={})=>(_i(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:di(e,{max:t.braceExpandMax}));Y.braceExpand=ca,Y.makeRe=(e,t={})=>new da(e,t).makeRe(),Y.match=(e,t,n={})=>{let r=new da(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};const la=/[?*]|[+@!]\(.*?\)|\[|\]/,ua=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`);var da=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){_i(e),t||={},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||oa,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!la.test(e[2]))&&!la.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t of e)for(let e=0;e<t.length;e++)t[e]===`**`&&(t[e]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===``&&e[0]===``||(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&!(this.isWindows&&/^[a-z]:$/i.test(r))&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];e===1&&r===``&&n[0]===``||(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=0,i=0;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),a=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),o=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),s=!o&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]),c=a?3:n?0:void 0,l=s?3:o?0:void 0;if(typeof c==`number`&&typeof l==`number`){let[n,a]=[e[c],t[l]];n.toLowerCase()===a.toLowerCase()&&(t[l]=n,i=l,r=c)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(X)?this.#e(e,t,n,r,i):this.#n(e,t,n,r,i)}#e(e,t,n,r,i){let a=t.indexOf(X,i),o=t.lastIndexOf(X),[s,c,l]=n?[t.slice(i,a),t.slice(a+1),[]]:[t.slice(i,a),t.slice(a+1,o),t.slice(o+1)];if(s.length){let t=e.slice(r,r+s.length);if(!this.#n(t,s,n,0,0))return!1;r+=s.length,i+=s.length}let u=0;if(l.length){if(l.length+r>e.length)return!1;let t=e.length-l.length;if(this.#n(e,l,n,t,0))u=l.length;else{if(e[e.length-1]!==``||r+l.length===e.length||(t--,!this.#n(e,l,n,t,0)))return!1;u=l.length+1}}if(!c.length){let t=!!u;for(let n=r;n<e.length-u;n++){let r=String(e[n]);if(t=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return n||t}let d=[[[],0]],f=d[0],p=0,m=[0];for(let e of c)e===X?(m.push(p),f=[[],0],d.push(f)):(f[0].push(e),p++);let h=d.length-1,g=e.length-u;for(let e of d)e[1]=g-(m[h--]+e[0].length);return!!this.#t(e,d,r,0,n,0,!!u)}#t(e,t,n,r,i,a,o){let s=t[r];if(!s){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[c,l]=s;for(;n<=l;){if(this.#n(e.slice(0,n+c.length),c,i,n,0)&&a<this.maxGlobstarRecursion){let s=this.#t(e,t,n+c.length,r+1,i,a+1,o);if(s!==!1)return s}let s=e[n];if(s===`.`||s===`..`||!this.options.dot&&s.startsWith(`.`))return!1;n++}return i||null}#n(e,t,n,r,i){let a,o,s,c;for(a=r,o=i,c=e.length,s=t.length;a<c&&o<s;a++,o++){this.debug(`matchOne loop`);let n=t[o],r=e[a];if(this.debug(t,n,r),n===!1||n===X)return!1;let i;if(typeof n==`string`?(i=r===n,this.debug(`string match`,n,r,i)):(i=n.test(r),this.debug(`pattern match`,n,r,i)),!i)return!1}if(a===c&&o===s)return!0;if(a===c)return n;if(o===s)return a===c-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return ca(this.pattern,this.options)}parse(e){_i(e);let t=this.options;if(e===`**`)return X;if(e===``)return``;let n,r=null;(n=e.match(Xi))?r=t.dot?Qi:Zi:(n=e.match(Bi))?r=(t.nocase?t.dot?Wi:Ui:t.dot?Hi:Vi)(n[1]):(n=e.match($i))?r=(t.nocase?t.dot?ta:ea:t.dot?na:ra)(n):(n=e.match(Gi))?r=t.dot?qi:Ki:(n=e.match(Ji))&&(r=Yi);let i=Ri.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,"test",{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?`[^/]*?`:t.dot?`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`:`(?:(?!(?:\\/|^)\\.).)*?`,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?ua(e):e===X?X:e._src});t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e!==X||a===X||(a===void 0?i!==void 0&&i!==X?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|\\/`+n+`)?`:i!==X&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=X))});let i=t.filter(e=>e!==X);if(this.partial&&i.length>=1){let e=[];for(let t=1;t<=i.length;t++)e.push(i.slice(0,t).join(`/`));return`(?:`+e.join(`|`)+`)`}return i.join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.partial&&(i=`^(?:\\/|`+a+i.slice(1,-1)+o+`)$`),this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e of i){let i=r;if(n.matchBase&&e.length===1&&(i=[a]),this.matchOne(i,e,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return Y.defaults(e).Minimatch}};Y.AST=Ri,Y.Minimatch=da,Y.escape=zi,Y.unescape=Ci;var fa=n(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c})),pa=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);let u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}0&&(t.exports={SYMBOL_FOR_REQ_CONTEXT:u,getContext:d})})),ma=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{getVercelOidcTokenSync:()=>d}),t.exports=c(l);var u=pa();function d(){let e=(0,u.getContext)().headers?.[`x-vercel-oidc-token`]??process.env.VERCEL_OIDC_TOKEN;if(!e)throw Error(`The 'x-vercel-oidc-token' header is missing from the request.`);return e}0&&(t.exports={getVercelOidcTokenSync:d})})),ha=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{VercelOidcTokenError:()=>u}),t.exports=c(l);var u=class extends Error{constructor(e,t){super(e),this.name=`VercelOidcTokenError`,this.cause=t}toString(){return this.cause?`${this.name}: ${this.message}: ${this.cause}`:`${this.name}: ${this.message}`}};0&&(t.exports={VercelOidcTokenError:u})})),ga=n(((t,n)=>{var r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},c=(e,t,n,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(r({},`__esModule`,{value:!0}),e),u={};s(u,{getVercelOidcToken:()=>p}),n.exports=l(u);var d=ma(),f=ha();async function p(t){let n=``,r;try{n=(0,d.getVercelOidcTokenSync)()}catch(e){r=e}try{let[{getTokenPayload:r,isExpired:i},{refreshToken:a}]=await Promise.all([await Promise.resolve().then(()=>e(xa())),await import(`../../_chunks/workflow/token-D4VIwGlD.js`).then(t=>e(t.default))]);(!n||i(r(n),t?.expirationBufferMs))&&(await a(t),n=(0,d.getVercelOidcTokenSync)())}catch(e){let t=r instanceof Error?r.message:``;throw e instanceof Error&&(t=`${t}
|
|
11
|
+
`)(e,n),a=2),i===-1){let t=e.subarray(n);if(t.length>this.maxHeaderSize)throw new q(`Headers too large: ${t.length} > ${this.maxHeaderSize} bytes`);this.buffer=t;break}let o=e.subarray(n,i);this.currentHeaders=Rr(o);let s=this.createStreamingMessage();t.push(s),n=i+a,this.state=3;continue}if(this.state===0){if(r<this.openingBoundaryLength){if(e.length>this.maxBoundaryBuffer)throw new q(`Initial chunk too large for boundary detection: ${e.length} > ${this.maxBoundaryBuffer}`);this.buffer=e;break}if(this.findOpeningBoundary(e)!==0)throw new q(`Invalid multipart stream: missing initial boundary`);n=this.openingBoundaryLength,this.state=1}}return t}createStreamingMessage(){let e=new Headers(this.currentHeaders),t=new ReadableStream({start:e=>{this.currentPayloadController=e}});return this.currentHeaders=new Headers,{headers:e,payload:t}}writeBody(e){this.currentPayloadController&&this.currentPayloadController.enqueue(e)}finishMessage(){this.currentPayloadController&&=(this.currentPayloadController.close(),null)}closeCurrentPayload(e){if(this.currentPayloadController){try{e?this.currentPayloadController.error(e):this.currentPayloadController.close()}catch{}this.currentPayloadController=null}}};const Ur=(e,t,n)=>{let r=e instanceof RegExp?Wr(e,n):e,i=t instanceof RegExp?Wr(t,n):t,a=r!==null&&i!=null&&Gr(r,i,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+r.length,a[1]),post:n.slice(a[1]+i.length)}},Wr=(e,t)=>{let n=t.match(e);return n?n[0]:null},Gr=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},Kr=`\0SLASH`+Math.random()+`\0`,qr=`\0OPEN`+Math.random()+`\0`,Jr=`\0CLOSE`+Math.random()+`\0`,Yr=`\0COMMA`+Math.random()+`\0`,Xr=`\0PERIOD`+Math.random()+`\0`,Zr=new RegExp(Kr,`g`),Qr=new RegExp(qr,`g`),$r=new RegExp(Jr,`g`),ei=new RegExp(Yr,`g`),ti=new RegExp(Xr,`g`),ni=/\\\\/g,ri=/\\{/g,ii=/\\}/g,ai=/\\,/g,oi=/\\\./g;function si(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function ci(e){return e.replace(ni,Kr).replace(ri,qr).replace(ii,Jr).replace(ai,Yr).replace(oi,Xr)}function li(e){return e.replace(Zr,`\\`).replace(Qr,`{`).replace($r,`}`).replace(ei,`,`).replace(ti,`.`)}function ui(e){if(!e)return[``];let t=[],n=Ur(`{`,`}`,e);if(!n)return e.split(`,`);let{pre:r,body:i,post:a}=n,o=r.split(`,`);o[o.length-1]+=`{`+i+`}`;let s=ui(a);return a.length&&(o[o.length-1]+=s.shift(),o.push.apply(o,s)),t.push.apply(t,o),t}function di(e,t={}){if(!e)return[];let{max:n=1e5}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),gi(ci(e),n,!0).map(li)}function fi(e){return`{`+e+`}`}function pi(e){return/^-?0\d/.test(e)}function mi(e,t){return e<=t}function hi(e,t){return e>=t}function gi(e,t,n){let r=[];for(;;){let i=Ur(`{`,`}`,e);if(!i)return[e];let a=i.pre;if(/\$$/.test(i.pre)){let e=i.post.length?gi(i.post,t,!1):[``];for(let n=0;n<e.length&&n<t;n++){let t=a+`{`+i.body+`}`+e[n];r.push(t)}return r}let o=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),s=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),c=o||s,l=i.body.indexOf(`,`)>=0;if(!c&&!l){if(i.post.match(/,(?!,).*\}/)){e=i.pre+`{`+i.body+Jr+i.post,n=!0;continue}return[e]}let u=i.post.length?gi(i.post,t,!1):[``],d;if(c)d=i.body.split(/\.\./);else if(d=ui(i.body),d.length===1&&d[0]!==void 0&&(d=gi(d[0],t,!1).map(fi),d.length===1))return u.map(e=>i.pre+d[0]+e);let f;if(c&&d[0]!==void 0&&d[1]!==void 0){let e=si(d[0]),n=si(d[1]),r=Math.max(d[0].length,d[1].length),i=d.length===3&&d[2]!==void 0?Math.max(Math.abs(si(d[2])),1):1,a=mi;n<e&&(i*=-1,a=hi);let o=d.some(pi);f=[];for(let c=e;a(c,n)&&f.length<t;c+=i){let e;if(s)e=String.fromCharCode(c),e===`\\`&&(e=``);else if(e=String(c),o){let t=r-e.length;if(t>0){let n=Array(t+1).join(`0`);e=c<0?`-`+n+e.slice(1):n+e}}f.push(e)}}else{f=[];for(let e=0;e<d.length;e++)f.push.apply(f,gi(d[e],t,!1))}for(let e=0;e<f.length;e++)for(let i=0;i<u.length&&r.length<t;i++){let t=a+f[e]+u[i];(!n||c||t)&&r.push(t)}return r}}const _i=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>65536)throw TypeError(`pattern is too long`)},vi={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},yi=e=>e.replace(/[[\]\\-]/g,`\\$&`),bi=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),xi=e=>e.join(``),Si=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;WHILE:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1){l=!0,a++;continue}if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c){c=!0,a++;continue}if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(vi))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue WHILE}}if(c=!1,d){t>d?r.push(yi(d)+`-`+yi(t)):t===d&&r.push(yi(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push(yi(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push(yi(t)),a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l)return[bi(r[0].length===2?r[0].slice(-1):r[0]),!1,u-n,!1];let f=`[`+(l?`^`:``)+xi(r)+`]`,p=`[`+(l?``:`^`)+xi(i)+`]`;return[r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p,s,u-n,!0]},Ci=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\])\]/g,`$1$2`).replace(/\\([^/])/g,`$1`):t?e.replace(/\[([^/\\{}])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,`$1$2`).replace(/\\([^/{}])/g,`$1`);var J;const wi=new Set([`!`,`?`,`+`,`*`,`@`]),Ti=e=>wi.has(e),Ei=e=>Ti(e.type),Di=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),Oi=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),ki=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),Ai=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),ji=`(?!\\.)`,Mi=new Set([`[`,`.`]),Ni=new Set([`..`,`.`]),Pi=new Set(`().*{}+?[]^$\\!`),Fi=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),Ii=`[^/]+?`;let Li=0;var Ri=class{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;id=++Li;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for(`nodejs.util.inspect.custom`)](){return{"@@type":`AST`,id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#r.length,parts:this.#r}}constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.type?this.#l=this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#l=this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...e){for(let t of e)if(t!==``){if(typeof t!=`string`&&!(t instanceof J&&t.#i===this))throw Error(`invalid part: `+t);this.#r.push(t)}}toJSON(){let e=this.type===null?this.#r.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let e=this.#i;for(let t=0;t<this.#a;t++){let n=e.#r[t];if(!(n instanceof J&&n.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(e){let t=new J(this.type,e);for(let e of this.#r)t.copyIn(e);return t}static#f(e,t,n,r,i){let a=r.maxExtglobRecursion??2,o=!1,s=!1,c=-1,l=!1;if(t.type===null){let u=n,d=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,d+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),d+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,d+=n;continue}if(!r.noext&&Ti(n)&&e.charAt(u)===`(`&&i<=a){t.push(d),d=``;let a=new J(n,t);u=J.#f(e,a,u,r,i+1),t.push(a);continue}d+=n}return t.push(d),u}let u=n+1,d=new J(null,t),f=[],p=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,p+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),p+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,p+=n;continue}if(!r.noext&&Ti(n)&&e.charAt(u)===`(`&&(i<=a||t&&t.#h(n))){let a=t&&t.#h(n)?0:1;d.push(p),p=``;let o=new J(n,d);d.push(o),u=J.#f(e,o,u,r,i+a);continue}if(n===`|`){d.push(p),p=``,f.push(d),d=new J(null,t);continue}if(n===`)`)return p===``&&t.#r.length===0&&(t.#u=!0),d.push(p),p=``,t.push(...f,d),u;p+=n}return t.type=null,t.#t=void 0,t.#r=[e.substring(n-1)],u}#p(e){return this.#m(e,Oi)}#m(e,t=Di){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null)return!1;let n=e.#r[0];return!n||typeof n!=`object`||n.type===null?!1:this.#h(n.type,t)}#h(e,t=ki){return!!t.get(this.type)?.includes(e)}#g(e,t){let n=e.#r[0],r=new J(null,n,this.options);r.#r.push(``),n.push(r),this.#_(e,t)}#_(e,t){let n=e.#r[0];this.#r.splice(t,1,...n.#r);for(let e of n.#r)typeof e==`object`&&(e.#i=this);this.#l=void 0}#v(e){return!!Ai.get(this.type)?.has(e)}#y(e){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let t=e.#r[0];return!t||typeof t!=`object`||t.type===null?!1:this.#v(t.type)}#b(e){let t=Ai.get(this.type),n=e.#r[0],r=t?.get(n.type);if(!r)return!1;this.#r=n.#r;for(let e of this.#r)typeof e==`object`&&(e.#i=this);this.type=r,this.#l=void 0,this.#u=!1}static fromGlob(e,t={}){let n=new J(null,void 0,t);return J.#f(e,n,0,t,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(e){let t=e??!!this.#c.dot;if(this.#e===this&&(this.#x(),this.#d()),!Ei(this)){let n=this.isStart()&&this.isEnd()&&!this.#r.some(e=>typeof e!=`string`),r=this.#r.map(t=>{let[r,i,a,o]=typeof t==`string`?J.#C(t,this.#t,n):t.toRegExpSource(e);return this.#t=this.#t||a,this.#n=this.#n||o,r}).join(``),i=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&Ni.has(this.#r[0]))){let n=Mi,a=t&&n.has(r.charAt(0))||r.startsWith(`\\.`)&&n.has(r.charAt(2))||r.startsWith(`\\.\\.`)&&n.has(r.charAt(4)),o=!t&&!e&&n.has(r.charAt(0));i=a?`(?!(?:^|/)\\.\\.?(?:$|/))`:o?ji:``}let a=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(a=`(?:$|\\/)`),[i+r+a,Ci(r),this.#t=!!this.#t,this.#n]}let n=this.type===`*`||this.type===`+`,r=this.type===`!`?`(?:(?!(?:`:`(?:`,i=this.#S(t);if(this.isStart()&&this.isEnd()&&!i&&this.type!==`!`){let e=this.toString(),t=this;return t.#r=[e],t.type=null,t.#t=void 0,[e,Ci(this.toString()),!1,!1]}let a=!n||e||t?``:this.#S(!0);a===i&&(a=``),a&&(i=`(?:${i})(?:${a})*?`);let o=``;if(this.type===`!`&&this.#u)o=(this.isStart()&&!t?ji:``)+Ii;else{let n=this.type===`!`?`))`+(this.isStart()&&!t&&!e?ji:``)+`[^/]*?)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&a?`)`:this.type===`*`&&a?`)?`:`)${this.type}`;o=r+i+n}return[o,Ci(i),this.#t=!!this.#t,this.#n]}#x(){if(Ei(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<this.#r.length;e++){let n=this.#r[e];typeof n==`object`&&(n.#x(),this.#m(n)?(t=!1,this.#_(n,e)):this.#p(n)?(t=!1,this.#g(n,e)):this.#y(n)&&(t=!1,this.#b(n)))}}while(!t&&++e<10)}else for(let e of this.#r)typeof e==`object`&&e.#x();this.#l=void 0}#S(e){return this.#r.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#C(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(r){r=!1,i+=(Pi.has(c)?`\\`:``)+c;continue}if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?Ii:`[^/]*?`,t=!0;continue}else o=!1;if(c===`\\`){s===e.length-1?i+=`\\\\`:r=!0;continue}if(c===`[`){let[n,r,o,c]=Si(e,s);if(o){i+=n,a||=r,s+=o-1,t||=c;continue}}if(c===`?`){i+=`[^/]`,t=!0;continue}i+=Fi(c)}return[i,Ci(e),!!t,a]}};J=Ri;const zi=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,`[$&]`):e.replace(/[?*()[\]\\{}]/g,`\\$&`):t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),Y=(e,t,n={})=>(_i(t),!n.nocomment&&t.charAt(0)===`#`?!1:new da(t,n).match(e)),Bi=/^\*+([^+@!?*[(]*)$/,Vi=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),Hi=e=>t=>t.endsWith(e),Ui=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),Wi=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Gi=/^\*+\.\*+$/,Ki=e=>!e.startsWith(`.`)&&e.includes(`.`),qi=e=>e!==`.`&&e!==`..`&&e.includes(`.`),Ji=/^\.\*+$/,Yi=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),Xi=/^\*+$/,Zi=e=>e.length!==0&&!e.startsWith(`.`),Qi=e=>e.length!==0&&e!==`.`&&e!==`..`,$i=/^\?+([^+@!?*[(]*)?$/,ea=([e,t=``])=>{let n=ia([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},ta=([e,t=``])=>{let n=aa([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},na=([e,t=``])=>{let n=aa([e]);return t?e=>n(e)&&e.endsWith(t):n},ra=([e,t=``])=>{let n=ia([e]);return t?e=>n(e)&&e.endsWith(t):n},ia=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},aa=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},oa=typeof process==`object`&&process?typeof process.env==`object`&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,sa={win32:{sep:`\\`},posix:{sep:`/`}};Y.sep=oa===`win32`?sa.win32.sep:sa.posix.sep;const X=Symbol(`globstar **`);Y.GLOBSTAR=X,Y.filter=(e,t={})=>n=>Y(n,e,t);const Z=(e,t={})=>Object.assign({},e,t);Y.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return Y;let t=Y;return Object.assign((n,r,i={})=>t(n,r,Z(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,Z(e,n))}static defaults(n){return t.defaults(Z(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,Z(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,Z(e,r))}},unescape:(n,r={})=>t.unescape(n,Z(e,r)),escape:(n,r={})=>t.escape(n,Z(e,r)),filter:(n,r={})=>t.filter(n,Z(e,r)),defaults:n=>t.defaults(Z(e,n)),makeRe:(n,r={})=>t.makeRe(n,Z(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,Z(e,r)),match:(n,r,i={})=>t.match(n,r,Z(e,i)),sep:t.sep,GLOBSTAR:X})};const ca=(e,t={})=>(_i(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:di(e,{max:t.braceExpandMax}));Y.braceExpand=ca,Y.makeRe=(e,t={})=>new da(e,t).makeRe(),Y.match=(e,t,n={})=>{let r=new da(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};const la=/[?*]|[+@!]\(.*?\)|\[|\]/,ua=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`);var da=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){_i(e),t||={},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||oa,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!la.test(e[2]))&&!la.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t of e)for(let e=0;e<t.length;e++)t[e]===`**`&&(t[e]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===``&&e[0]===``||(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&!(this.isWindows&&/^[a-z]:$/i.test(r))&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];e===1&&r===``&&n[0]===``||(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=0,i=0;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),a=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),o=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),s=!o&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]),c=a?3:n?0:void 0,l=s?3:o?0:void 0;if(typeof c==`number`&&typeof l==`number`){let[n,a]=[e[c],t[l]];n.toLowerCase()===a.toLowerCase()&&(t[l]=n,i=l,r=c)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(X)?this.#e(e,t,n,r,i):this.#n(e,t,n,r,i)}#e(e,t,n,r,i){let a=t.indexOf(X,i),o=t.lastIndexOf(X),[s,c,l]=n?[t.slice(i,a),t.slice(a+1),[]]:[t.slice(i,a),t.slice(a+1,o),t.slice(o+1)];if(s.length){let t=e.slice(r,r+s.length);if(!this.#n(t,s,n,0,0))return!1;r+=s.length,i+=s.length}let u=0;if(l.length){if(l.length+r>e.length)return!1;let t=e.length-l.length;if(this.#n(e,l,n,t,0))u=l.length;else{if(e[e.length-1]!==``||r+l.length===e.length||(t--,!this.#n(e,l,n,t,0)))return!1;u=l.length+1}}if(!c.length){let t=!!u;for(let n=r;n<e.length-u;n++){let r=String(e[n]);if(t=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return n||t}let d=[[[],0]],f=d[0],p=0,m=[0];for(let e of c)e===X?(m.push(p),f=[[],0],d.push(f)):(f[0].push(e),p++);let h=d.length-1,g=e.length-u;for(let e of d)e[1]=g-(m[h--]+e[0].length);return!!this.#t(e,d,r,0,n,0,!!u)}#t(e,t,n,r,i,a,o){let s=t[r];if(!s){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[c,l]=s;for(;n<=l;){if(this.#n(e.slice(0,n+c.length),c,i,n,0)&&a<this.maxGlobstarRecursion){let s=this.#t(e,t,n+c.length,r+1,i,a+1,o);if(s!==!1)return s}let s=e[n];if(s===`.`||s===`..`||!this.options.dot&&s.startsWith(`.`))return!1;n++}return i||null}#n(e,t,n,r,i){let a,o,s,c;for(a=r,o=i,c=e.length,s=t.length;a<c&&o<s;a++,o++){this.debug(`matchOne loop`);let n=t[o],r=e[a];if(this.debug(t,n,r),n===!1||n===X)return!1;let i;if(typeof n==`string`?(i=r===n,this.debug(`string match`,n,r,i)):(i=n.test(r),this.debug(`pattern match`,n,r,i)),!i)return!1}if(a===c&&o===s)return!0;if(a===c)return n;if(o===s)return a===c-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return ca(this.pattern,this.options)}parse(e){_i(e);let t=this.options;if(e===`**`)return X;if(e===``)return``;let n,r=null;(n=e.match(Xi))?r=t.dot?Qi:Zi:(n=e.match(Bi))?r=(t.nocase?t.dot?Wi:Ui:t.dot?Hi:Vi)(n[1]):(n=e.match($i))?r=(t.nocase?t.dot?ta:ea:t.dot?na:ra)(n):(n=e.match(Gi))?r=t.dot?qi:Ki:(n=e.match(Ji))&&(r=Yi);let i=Ri.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,"test",{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?`[^/]*?`:t.dot?`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`:`(?:(?!(?:\\/|^)\\.).)*?`,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?ua(e):e===X?X:e._src});t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e!==X||a===X||(a===void 0?i!==void 0&&i!==X?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|\\/`+n+`)?`:i!==X&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=X))});let i=t.filter(e=>e!==X);if(this.partial&&i.length>=1){let e=[];for(let t=1;t<=i.length;t++)e.push(i.slice(0,t).join(`/`));return`(?:`+e.join(`|`)+`)`}return i.join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.partial&&(i=`^(?:\\/|`+a+i.slice(1,-1)+o+`)$`),this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e of i){let i=r;if(n.matchBase&&e.length===1&&(i=[a]),this.matchOne(i,e,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return Y.defaults(e).Minimatch}};Y.AST=Ri,Y.Minimatch=da,Y.escape=zi,Y.unescape=Ci;var fa=n(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c})),pa=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);let u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}0&&(t.exports={SYMBOL_FOR_REQ_CONTEXT:u,getContext:d})})),ma=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{getVercelOidcTokenSync:()=>d}),t.exports=c(l);var u=pa();function d(){let e=(0,u.getContext)().headers?.[`x-vercel-oidc-token`]??process.env.VERCEL_OIDC_TOKEN;if(!e)throw Error(`The 'x-vercel-oidc-token' header is missing from the request.`);return e}0&&(t.exports={getVercelOidcTokenSync:d})})),ha=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{VercelOidcTokenError:()=>u}),t.exports=c(l);var u=class extends Error{constructor(e,t){super(e),this.name=`VercelOidcTokenError`,this.cause=t}toString(){return this.cause?`${this.name}: ${this.message}: ${this.cause}`:`${this.name}: ${this.message}`}};0&&(t.exports={VercelOidcTokenError:u})})),ga=n(((t,n)=>{var r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},c=(e,t,n,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(r({},`__esModule`,{value:!0}),e),u={};s(u,{getVercelOidcToken:()=>p}),n.exports=l(u);var d=ma(),f=ha();async function p(t){let n=``,r;try{n=(0,d.getVercelOidcTokenSync)()}catch(e){r=e}try{let[{getTokenPayload:r,isExpired:i},{refreshToken:a}]=await Promise.all([await Promise.resolve().then(()=>e(xa())),await import(`../../_chunks/workflow/token-D4VIwGlD.js`).then(t=>e(t.default))]);(!n||i(r(n),t?.expirationBufferMs))&&(await a(t),n=(0,d.getVercelOidcTokenSync)())}catch(e){let t=r instanceof Error?r.message:``;throw e instanceof Error&&(t=`${t}
|
|
12
12
|
${e.message}`),t?new f.VercelOidcTokenError(t):e}return n}0&&(n.exports={getVercelOidcToken:p})})),_a=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>u,RefreshAccessTokenFailedError:()=>d}),t.exports=c(l);var u=class extends Error{constructor(){super(`No authentication found. Please log in with the Vercel CLI (vercel login).`),this.name=`AccessTokenMissingError`}},d=class extends Error{constructor(e){super(`Failed to refresh authentication token.`,{cause:e}),this.name=`RefreshAccessTokenFailedError`}};0&&(t.exports={AccessTokenMissingError:u,RefreshAccessTokenFailedError:d})})),va=n(((e,n)=>{var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of o(t))!c.call(e,s)&&s!==n&&i(e,s,{get:()=>t[s],enumerable:!(r=a(t,s))||r.enumerable});return e},d=(e,t,n)=>(n=e==null?{}:r(s(e)),u(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),f=e=>u(i({},`__esModule`,{value:!0}),e),p={};l(p,{findRootDir:()=>v,getUserDataDir:()=>y}),n.exports=f(p);var m=d(t(`path`)),h=d(t(`fs`)),g=d(t(`os`)),_=ha();function v(){try{let e=process.cwd();for(;e!==m.default.dirname(e);){let t=m.default.join(e,`.vercel`);if(h.default.existsSync(t))return e;e=m.default.dirname(e)}}catch{throw new _.VercelOidcTokenError(`Token refresh only supported in node server environments`)}return null}function y(){if(process.env.XDG_DATA_HOME)return process.env.XDG_DATA_HOME;switch(g.default.platform()){case`darwin`:return m.default.join(g.default.homedir(),`Library/Application Support`);case`linux`:return m.default.join(g.default.homedir(),`.local/share`);case`win32`:return process.env.LOCALAPPDATA?process.env.LOCALAPPDATA:null;default:return null}}0&&(n.exports={findRootDir:v,getUserDataDir:y})})),ya=n(((e,n)=>{var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of o(t))!c.call(e,s)&&s!==n&&i(e,s,{get:()=>t[s],enumerable:!(r=a(t,s))||r.enumerable});return e},d=(e,t,n)=>(n=e==null?{}:r(s(e)),u(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),f=e=>u(i({},`__esModule`,{value:!0}),e),p={};l(p,{isValidAccessToken:()=>b,readAuthConfig:()=>v,writeAuthConfig:()=>y}),n.exports=f(p);var m=d(t(`fs`)),h=d(t(`path`)),g=xa();function _(){let e=(0,g.getVercelDataDir)();if(!e)throw Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);return h.join(e,`auth.json`)}function v(){try{let e=_();if(!m.existsSync(e))return null;let t=m.readFileSync(e,`utf8`);return t?JSON.parse(t):null}catch{return null}}function y(e){let t=_(),n=h.dirname(t);m.existsSync(n)||m.mkdirSync(n,{mode:504,recursive:!0}),m.writeFileSync(t,JSON.stringify(e,null,2),{mode:384})}function b(e,t=0){if(!e.token)return!1;if(typeof e.expiresAt!=`number`)return!0;let n=Math.floor(Date.now()/1e3),r=t/1e3;return e.expiresAt>=n+r}0&&(n.exports={isValidAccessToken:b,readAuthConfig:v,writeAuthConfig:y})})),ba=n(((e,n)=>{var r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},c=(e,t,n,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(r({},`__esModule`,{value:!0}),e),u={};s(u,{processTokenResponse:()=>g,refreshTokenRequest:()=>h}),n.exports=l(u);var d=t(`os`);let f=`@vercel/oidc node-${process.version} ${(0,d.platform)()} (${(0,d.arch)()}) ${(0,d.hostname)()}`,p=null;async function m(){if(p)return p;let e=await fetch(`https://vercel.com/.well-known/openid-configuration`,{headers:{"user-agent":f}});if(!e.ok)throw Error(`Failed to discover OAuth endpoints`);let t=await e.json();if(!t||typeof t.token_endpoint!=`string`)throw Error(`Invalid OAuth discovery response`);let n=t.token_endpoint;return p=n,n}async function h(e){let t=await m();return await fetch(t,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,"user-agent":f},body:new URLSearchParams({client_id:`cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp`,grant_type:`refresh_token`,...e})})}async function g(e){let t=await e.json();if(!e.ok){let e=typeof t==`object`&&t&&`error`in t?String(t.error):`Token refresh failed`;return[Error(e)]}return typeof t!=`object`||!t?[Error(`Invalid token response`)]:typeof t.access_token==`string`?t.token_type===`Bearer`?typeof t.expires_in==`number`?[null,t]:[Error(`Missing expires_in in response`)]:[Error(`Invalid token_type in response`)]:[Error(`Missing access_token in response`)]}0&&(n.exports={processTokenResponse:g,refreshTokenRequest:h})})),xa=n(((e,n)=>{var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of o(t))!c.call(e,s)&&s!==n&&i(e,s,{get:()=>t[s],enumerable:!(r=a(t,s))||r.enumerable});return e},d=(e,t,n)=>(n=e==null?{}:r(s(e)),u(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),f=e=>u(i({},`__esModule`,{value:!0}),e),p={};l(p,{assertVercelOidcTokenResponse:()=>w,findProjectInfo:()=>T,getTokenPayload:()=>te,getVercelDataDir:()=>x,getVercelOidcToken:()=>C,getVercelToken:()=>S,isExpired:()=>ne,loadToken:()=>E,saveToken:()=>ee}),n.exports=f(p);var m=d(t(`path`)),h=d(t(`fs`)),g=ha(),_=va(),v=ya(),y=ba(),b=_a();function x(){let e=(0,_.getUserDataDir)();return e?m.join(e,`com.vercel.cli`):null}async function S(e){let t=(0,v.readAuthConfig)();if(!t?.token)throw new b.AccessTokenMissingError;if((0,v.isValidAccessToken)(t,e?.expirationBufferMs))return t.token;if(!t.refreshToken)throw(0,v.writeAuthConfig)({}),new b.RefreshAccessTokenFailedError(`No refresh token available`);try{let e=await(0,y.refreshTokenRequest)({refresh_token:t.refreshToken}),[n,r]=await(0,y.processTokenResponse)(e);if(n||!r)throw(0,v.writeAuthConfig)({}),new b.RefreshAccessTokenFailedError(n);let i={token:r.access_token,expiresAt:Math.floor(Date.now()/1e3)+r.expires_in};return r.refresh_token&&(i.refreshToken=r.refresh_token),(0,v.writeAuthConfig)(i),i.token}catch(e){throw(0,v.writeAuthConfig)({}),e instanceof b.AccessTokenMissingError||e instanceof b.RefreshAccessTokenFailedError?e:new b.RefreshAccessTokenFailedError(e)}}async function C(e,t,n){let r=`https://api.vercel.com/v1/projects/${t}/token?source=vercel-oidc-refresh${n?`&teamId=${n}`:``}`,i=await fetch(r,{method:`POST`,headers:{Authorization:`Bearer ${e}`}});if(!i.ok)throw new g.VercelOidcTokenError(`Failed to refresh OIDC token: ${i.statusText}`);let a=await i.json();return w(a),a}function w(e){if(!e||typeof e!=`object`)throw TypeError("Vercel OIDC token is malformed. Expected an object. Please run `vc env pull` and try again");if(!(`token`in e)||typeof e.token!=`string`)throw TypeError("Vercel OIDC token is malformed. Expected a string-valued token property. Please run `vc env pull` and try again")}function T(){let e=(0,_.findRootDir)();if(!e)throw new g.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");let t=m.join(e,`.vercel`,`project.json`);if(!h.existsSync(t))throw new g.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");let n=JSON.parse(h.readFileSync(t,`utf8`));if(typeof n.projectId!=`string`&&typeof n.orgId!=`string`)throw TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");return{projectId:n.projectId,teamId:n.orgId}}function ee(e,t){let n=(0,_.getUserDataDir)();if(!n)throw new g.VercelOidcTokenError(`Unable to find user data directory. Please reach out to Vercel support.`);let r=m.join(n,`com.vercel.token`,`${t}.json`),i=JSON.stringify(e);h.mkdirSync(m.dirname(r),{mode:504,recursive:!0}),h.writeFileSync(r,i),h.chmodSync(r,432)}function E(e){let t=(0,_.getUserDataDir)();if(!t)throw new g.VercelOidcTokenError(`Unable to find user data directory. Please reach out to Vercel support.`);let n=m.join(t,`com.vercel.token`,`${e}.json`);if(!h.existsSync(n))return null;let r=JSON.parse(h.readFileSync(n,`utf8`));return w(r),r}function te(e){let t=e.split(`.`);if(t.length!==3)throw new g.VercelOidcTokenError("Invalid token. Please run `vc env pull` and try again");let n=t[1].replace(/-/g,`+`).replace(/_/g,`/`),r=n.padEnd(n.length+(4-n.length%4)%4,`=`);return JSON.parse(Buffer.from(r,`base64`).toString(`utf8`))}function ne(e,t=0){return e.exp*1e3<Date.now()+t}0&&(n.exports={assertVercelOidcTokenResponse:w,findProjectInfo:T,getTokenPayload:te,getVercelDataDir:x,getVercelOidcToken:C,getVercelToken:S,isExpired:ne,loadToken:E,saveToken:ee})})),Sa=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>p.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>p.RefreshAccessTokenFailedError,getContext:()=>f.getContext,getVercelOidcToken:()=>u.getVercelOidcToken,getVercelOidcTokenSync:()=>d.getVercelOidcTokenSync,getVercelToken:()=>m.getVercelToken}),t.exports=c(l);var u=ga(),d=ma(),f=pa(),p=_a(),m=xa();0&&(t.exports={AccessTokenMissingError,RefreshAccessTokenFailedError,getContext,getVercelOidcToken,getVercelOidcTokenSync,getVercelToken})})),Ca=e(fa(),1),wa=Sa();async function Ta(e){let t=0,n=e.getReader(),r=[];try{for(;;){let{done:e,value:i}=await n.read();if(e)break;r.push(i),t+=i.length}}finally{n.releaseLock()}return Buffer.concat(r,t)}var Ea=class{contentType=`application/json`;replacer;reviver;constructor(e={}){this.replacer=e.replacer,this.reviver=e.reviver}serialize(e){return Buffer.from(JSON.stringify(e,this.replacer),`utf8`)}async deserialize(e){let t=await Ta(e);return JSON.parse(t.toString(`utf8`),this.reviver)}},Da=class extends Error{constructor(e){super(`Message ${e} not found`),this.name=`MessageNotFoundError`}},Oa=class extends Error{constructor(e,t){super(`Message ${e} not available for processing${t?`: ${t}`:``}`),this.name=`MessageNotAvailableError`}},ka=class extends Error{constructor(e,t){super(`Message ${e} is corrupted: ${t}`),this.name=`MessageCorruptedError`}},Aa=class extends Error{retryAfter;constructor(e=`Too many requests`,t){super(e),this.name=`TooManyRequestsError`,this.retryAfter=t}},ja=class extends Error{constructor(e=`Missing or invalid authentication token`){super(e),this.name=`UnauthorizedError`}},Ma=class extends Error{constructor(e=`Queue environment doesn't match token environment`){super(e),this.name=`ForbiddenError`}},Na=class extends Error{constructor(e){super(e),this.name=`BadRequestError`}},Pa=class extends Error{constructor(e=`Unexpected server error`){super(e),this.name=`InternalServerError`}},Fa=class extends Error{constructor(e,t=1,n=10){super(`Invalid limit: ${e}. Limit must be between ${t} and ${n}.`),this.name=`InvalidLimitError`}},Ia=class extends Error{constructor(e){super(`Message ${e} has already been processed`),this.name=`MessageAlreadyProcessedError`}},La=class extends Error{idempotencyKey;constructor(e,t){super(e),this.name=`DuplicateMessageError`,this.idempotencyKey=t}},Ra=class extends Error{deploymentId;constructor(e,t){super(e),this.name=`ConsumerDiscoveryError`,this.deploymentId=t}},za=class extends Error{constructor(e=`Consumer registry not configured`){super(e),this.name=`ConsumerRegistryNotConfiguredError`}},Ba=300,Va=30,Ha=60,Ua=10,Wa=3e3,Ga=3,Ka=250;function qa(e){return Math.min(Ha,Math.max(Ua,e/5))}var Ja=class{client;topicName;consumerGroupName;visibilityTimeout;constructor(e,t,n,r={}){this.client=e,this.topicName=t,this.consumerGroupName=n,this.visibilityTimeout=Math.max(Va,r.visibilityTimeoutSeconds??Ba)}isClientError(e){return e instanceof Oa||e instanceof Da||e instanceof Na||e instanceof ja||e instanceof Ma}isNetworkError(e){return e instanceof TypeError}async directiveCallWithRetries(e){let t;for(let n=1;n<=Ga;n++)try{return await e()}catch(e){if(t=e,n===Ga)throw e;if(e instanceof Aa){if(e.retryAfter===void 0)throw e;await new Promise(t=>setTimeout(t,e.retryAfter*1e3));continue}if(!this.isNetworkError(e))throw e;let r=Ka*n,i=r/2+r/2*Math.random();await new Promise(e=>setTimeout(e,i))}throw t}startVisibilityExtension(e,t){let n=!0,r=!1,i,a=null,o=qa(this.visibilityTimeout)*1e3,s=o;if(t?.visibilityDeadline){let e=t.visibilityDeadline.getTime()-Date.now();s=e>0?qa(e/1e3)*1e3:0}let c=new Promise(e=>{i=e}),l=()=>{r||(r=!0,i())},u=async()=>{if(!n){l();return}try{await this.client.changeVisibility({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e,visibilityTimeoutSeconds:this.visibilityTimeout}),n?a=setTimeout(()=>u(),o):l()}catch(t){if(this.isClientError(t)){console.error(`Visibility extension failed with client error for receipt handle ${e} (stopping retries):`,t),l();return}console.error(`Failed to extend visibility for receipt handle ${e} (will retry in ${Wa/1e3}s):`,t),n?a=setTimeout(()=>u(),Wa):l()}};return a=setTimeout(()=>u(),s),async(e=!1)=>{n=!1,a&&=(clearTimeout(a),null),e?await c:l()}}async finalizePayload(e){let t=this.client.getTransport();if(t.finalize&&e!=null)try{await t.finalize(e)}catch(e){console.warn(`Failed to finalize message payload:`,e)}}async processMessage(e,t,n){let r=this.startVisibilityExtension(e.receiptHandle,n),i={messageId:e.messageId,deliveryCount:e.deliveryCount,createdAt:e.createdAt,expiresAt:e.expiresAt??new Date(e.createdAt.getTime()+864e5),topicName:this.topicName,consumerGroup:this.consumerGroupName,region:this.client.getRegion()};try{await t(e.payload,i),await r(),await this.client.acknowledgeMessage({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e.receiptHandle})}catch(t){if(await r(),n?.retry){let r;try{r=n.retry(t,i)}catch(e){console.warn(`retry handler threw:`,e)}if(r){if(`acknowledge`in r&&r.acknowledge){try{await this.directiveCallWithRetries(()=>this.client.acknowledgeMessage({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e.receiptHandle}))}catch(e){console.warn(`Failed to acknowledge message:`,e)}await this.finalizePayload(e.payload);return}if(`afterSeconds`in r&&typeof r.afterSeconds==`number`){try{await this.directiveCallWithRetries(()=>this.client.changeVisibility({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e.receiptHandle,visibilityTimeoutSeconds:r.afterSeconds}))}catch(e){console.warn(`Failed to reschedule message for retry:`,e)}await this.finalizePayload(e.payload);return}}}throw await this.finalizePayload(e.payload),t}}async consumeMessage(e,t,n){await this.processMessage(t,e,n)}async consume(e,t){let n=t?.retry;if(t&&`messageId`in t){let r=await this.client.receiveMessageById({queueName:this.topicName,consumerGroup:this.consumerGroupName,messageId:t.messageId,visibilityTimeoutSeconds:this.visibilityTimeout});return await this.processMessage(r.message,e,{retry:n}),1}else{let r=t&&`limit`in t?t.limit:1,i=0;for await(let t of this.client.receiveMessages({queueName:this.topicName,consumerGroup:this.consumerGroupName,visibilityTimeoutSeconds:this.visibilityTimeout,limit:r}))i++,await this.processMessage(t,e,{retry:n});return i}}get name(){return this.consumerGroupName}get topic(){return this.topicName}},Ya=class{client;topicName;constructor(e,t){this.client=e,this.topicName=t}async publish(e,t){let n=await this.client.sendMessage({queueName:this.topicName,payload:e,idempotencyKey:t?.idempotencyKey,retentionSeconds:t?.retentionSeconds,delaySeconds:t?.delaySeconds,headers:t?.headers,telemetry:t?.telemetry});return n.messageId&&co()&&Yo(this.topicName,n.messageId,this.client.getRegion(),t?.delaySeconds,t?.retentionSeconds),{messageId:n.messageId}}consumerGroup(e,t){return new Ja(this.client,this.topicName,e,t)}get name(){return this.topicName}},Xa=`com.vercel.queue.v1beta`,Za=`com.vercel.queue.v2beta`;function Qa(e,t){let n=t.slice(0,-1);return e.startsWith(n)}function $a(e){return typeof e==`object`&&!!e}function eo(e,t){if(!t||!t.includes(`application/cloudevents+json`))throw Error(`Invalid content type: expected 'application/cloudevents+json'`);if(!$a(e)||!e.type||!e.source||!e.id||!$a(e.data))throw Error(`Invalid CloudEvent: missing required fields`);if(e.type!==`com.vercel.queue.v1beta`)throw Error(`Invalid CloudEvent type: expected '${Xa}', got '${String(e.type)}'`);let{data:n}=e,r=[];if(`queueName`in n||r.push(`queueName`),`consumerGroup`in n||r.push(`consumerGroup`),`messageId`in n||r.push(`messageId`),r.length>0)throw Error(`Missing required CloudEvent data fields: ${r.join(`, `)}`);return{queueName:String(n.queueName),consumerGroup:String(n.consumerGroup),messageId:String(n.messageId)}}function Q(e,t){if(e instanceof Headers)return e.get(t);let n=e[t];return Array.isArray(n)?n[0]??null:n??null}function to(e){let t=Q(e,`ce-type`);if(t!==`com.vercel.queue.v2beta`)throw Error(`Invalid CloudEvent type: expected '${Za}', got '${t}'`);let n=Q(e,`ce-vqsqueuename`),r=Q(e,`ce-vqsconsumergroup`),i=Q(e,`ce-vqsmessageid`),a=[];if(n||a.push(`ce-vqsqueuename`),r||a.push(`ce-vqsconsumergroup`),i||a.push(`ce-vqsmessageid`),a.length>0)throw Error(`Missing required CloudEvent headers: ${a.join(`, `)}`);let o=Q(e,`ce-vqsregion`)??void 0;if(o!==void 0&&!/^[a-z]{2,5}[0-9]{1,2}$/.test(o))throw Error(`Invalid ce-vqsregion header: ${JSON.stringify(o)}. Region must match /^[a-z]{2,5}[0-9]{1,2}$/ (e.g. "iad1", "lhr1").`);let s={queueName:n,consumerGroup:r,messageId:i,region:o},c=Q(e,`ce-vqsreceipthandle`);if(!c)return s;let l={...s,receiptHandle:c},u=Q(e,`ce-vqsdeliverycount`);u&&(l.deliveryCount=parseInt(u,10));let d=Q(e,`ce-vqscreatedat`);d&&(l.createdAt=d);let f=Q(e,`ce-vqsexpiresat`);f&&(l.expiresAt=f);let p=Q(e,`content-type`);p&&(l.contentType=p);let m=Q(e,`ce-vqsvisibilitydeadline`);return m&&(l.visibilityDeadline=m),l}function no(e,t){if(Q(t,`ce-type`)===`com.vercel.queue.v2beta`){let n=to(t);return`receiptHandle`in n&&(n.parsedPayload=e),n}return eo(e,Q(t,`content-type`))}async function ro(e){if(e.headers.get(`ce-type`)===`com.vercel.queue.v2beta`){let t=to(e.headers);return`receiptHandle`in t&&e.body&&(t.rawBody=e.body),t}let t;try{t=await e.json()}catch{throw Error(`Failed to parse CloudEvent from request body`)}let n={};return e.headers.forEach((e,t)=>{n[t]=e}),no(t,n)}async function io(e,t,n){let{queueName:r,consumerGroup:i,messageId:a}=t;if(!n?.client)throw Error(`HandleCallbackOptions.client is required`);let o=Os(n.client);t.region&&(o=o.withRegion(t.region));let s=new Ya(o,r).consumerGroup(i,n?.visibilityTimeoutSeconds===void 0?void 0:{visibilityTimeoutSeconds:n.visibilityTimeoutSeconds});if(`receiptHandle`in t){let r=o.getTransport(),i;if(t.rawBody)i=await r.deserialize(t.rawBody);else if(t.parsedPayload!==void 0)i=t.parsedPayload;else throw Error(`Binary mode callback with receipt handle is missing payload`);let c={messageId:a,payload:i,deliveryCount:t.deliveryCount??1,createdAt:t.createdAt?new Date(t.createdAt):new Date,expiresAt:t.expiresAt?new Date(t.expiresAt):void 0,contentType:t.contentType??r.contentType,receiptHandle:t.receiptHandle},l=t.visibilityDeadline?new Date(t.visibilityDeadline):void 0;await s.consumeMessage(e,c,{visibilityDeadline:l,retry:n?.retry})}else await s.consume(e,{messageId:a,retry:n?.retry})}var $=Ca.default.cyan(`[queue]`),ao=Ca.default.green(`✓`),oo=Ca.default.red(`✗`),so=Ca.default.yellow(`↻`);function co(){return process.env.NODE_ENV===`development`&&process.env.VERCEL_DEPLOYMENT_ID===void 0}var lo=Symbol.for(`@vercel/queue.devRouteMappings`);function uo(e){let t=``;for(let n of e)n===`_`?t+=`__`:n===`/`?t+=`_S`:n===`.`?t+=`_D`:/[A-Za-z0-9-]/.test(n)?t+=n:t+=`_`+n.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`);return t}function fo(){let e=globalThis;if(lo in e)return e[lo]??null;try{let t=ve.join(process.cwd(),`vercel.json`);if(!ye.existsSync(t))return e[lo]=null,null;let n=JSON.parse(ye.readFileSync(t,`utf-8`));if(!n.functions)return e[lo]=null,null;let r=[];for(let[e,t]of Object.entries(n.functions))if(t.experimentalTriggers){for(let n of t.experimentalTriggers)if(!(!n.type?.startsWith(`queue/`)||!n.topic)){if(n.type!==`queue/v2beta`){console.warn(`${$} Unsupported trigger type "${n.type}" for topic "${n.topic}" in ${e}. Use "queue/v2beta" instead.`);continue}r.push({filePath:e,topic:n.topic,consumer:uo(e),retryAfterSeconds:n.retryAfterSeconds})}}return e[lo]=r.length>0?r:null,e[lo]}catch(t){return console.warn(`${$} Failed to read vercel.json:`,t),e[lo]=null,null}}function po(e){let t=fo();return t?t.filter(t=>t.topic.includes(`*`)?Qa(e,t.topic):t.topic===e):[]}function mo(e,t){return po(e).find(e=>e.consumer===t)?.retryAfterSeconds}function ho(e){return/^src\/(app|pages|server)\//.test(e)?e.slice(4):null}function go(e,t){return e===t||Y(e,t)}function _o(e){let t=fo();if(!t)return[];let n=process.cwd(),r;try{r=ve.relative(n,e)}catch{return[]}let i=r.replace(/\\/g,`/`),a=ho(i);return t.filter(e=>go(i,e.filePath)||a!==null&&go(a,e.filePath))}function vo(e){let t=e.match(/\((.+?):\d+:\d+\)/);if(t||=e.match(/at\s+(.+?):\d+:\d+/),!t)return null;let n=t[1].trim();if(n===`native`||n.startsWith(`node:`)||n.startsWith(`internal`))return null;if(n.startsWith(`file://`))try{n=new URL(n).pathname}catch{return null}return/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(n)?null:(n.startsWith(`./`)&&(n=n.slice(2)),n)}var yo;function bo(){if(yo)return yo;try{let e=typeof __dirname<`u`?__dirname:ve.dirname(new URL(import.meta.url).pathname);yo=ve.resolve(e,`..`)}catch{yo=``}return yo}function xo(){let e=Error().stack;if(!e)return null;let t=e.split(`
|
|
13
13
|
`).slice(1),n=bo();for(let e of t){let t=vo(e);if(!t)continue;let r=ve.isAbsolute(t)?t:ve.resolve(process.cwd(),t),i;try{i=ye.realpathSync(r)}catch{i=r}if(!(n&&i.startsWith(n)))return i}return null}var So=Symbol.for(`@vercel/queue.devHandlerRegistry`);function Co(){let e=globalThis;return e[So]||(e[So]=new Map),e[So]}function wo(e,t,n,r){let i=_o(ve.isAbsolute(e)?e:ve.resolve(process.cwd(),e));if(i.length===0)return!1;let a=Co();for(let e of i){let i=e.topic,o=a.get(i)??[],s={consumerGroup:e.consumer,handler:t,client:n,options:r},c=o.findIndex(t=>t.consumerGroup===e.consumer);c>=0?o[c]=s:o.push(s),a.set(i,o)}return!0}function To(e,t,n,r){let i=r??xo();if(!i){console.warn(`${$} Could not determine caller file path for handler registration.`);return}if(!wo(i,e,t,n)){let e=fo();if(e&&e.length>0)return;let t=process.cwd(),n;try{n=ve.relative(t,i).replace(/\\/g,`/`)}catch{n=i}console.warn(`${$} handleCallback() in ${n} has no matching experimentalTriggers in vercel.json. This handler won't receive messages.
|
|
14
14
|
|