@muxcodecli/cli 1.15.16 → 1.15.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bip-bop-01-ga21wr3r.mp3 +0 -0
- package/dist/bip-bop-03-kgfd4rq4.mp3 +0 -0
- package/dist/chunk-0hqmdrjr.js +3 -0
- package/dist/chunk-0npjzye0.js +2 -0
- package/dist/chunk-0pe6y883.js +2 -0
- package/dist/chunk-0qqpjj2h.js +3 -0
- package/dist/chunk-0r3h8jgj.js +2 -0
- package/dist/chunk-11285jfy.js +3 -0
- package/dist/chunk-11ant2kk.js +3 -0
- package/dist/chunk-124qmktt.js +18 -0
- package/dist/chunk-138ntz3h.js +2 -0
- package/dist/chunk-1e73ypg5.js +3 -0
- package/dist/chunk-1evcc54z.js +3 -0
- package/dist/chunk-1mqsg5s7.js +75 -0
- package/dist/chunk-1pv2317e.js +7 -0
- package/dist/chunk-1y3ssxx6.js +2 -0
- package/dist/chunk-20x8vsdn.js +7 -0
- package/dist/chunk-21x3anp4.js +9 -0
- package/dist/chunk-22qpzg37.js +212 -0
- package/dist/chunk-2bt5mtgm.js +3 -0
- package/dist/chunk-2d95ene8.js +2 -0
- package/dist/chunk-2h2zq5cp.js +2 -0
- package/dist/chunk-2pc63est.js +2 -0
- package/dist/chunk-33gs9z8d.js +2 -0
- package/dist/chunk-33vwwxjk.js +2 -0
- package/dist/chunk-3dq7hfxc.js +9 -0
- package/dist/chunk-3jvft1k1.js +2 -0
- package/dist/chunk-4jqh4mpm.js +2 -0
- package/dist/chunk-4mgyaytc.js +672 -0
- package/dist/chunk-4va8fzq1.js +2 -0
- package/dist/chunk-4wkq9y2z.js +7 -0
- package/dist/chunk-526nbm9e.js +2 -0
- package/dist/chunk-5a6895cv.js +37 -0
- package/dist/chunk-5e9dq2av.js +2 -0
- package/dist/chunk-5jn2z3nf.js +3 -0
- package/dist/chunk-5npr1qyq.js +574 -0
- package/dist/chunk-5sfky0gz.js +8 -0
- package/dist/chunk-5t7xqdvk.js +3 -0
- package/dist/chunk-5tpqj6ag.js +10 -0
- package/dist/chunk-5v5015am.js +12 -0
- package/dist/chunk-5wawdxv2.js +7 -0
- package/dist/chunk-6btrg3ff.js +2 -0
- package/dist/chunk-6skbzman.js +6 -0
- package/dist/chunk-6sz698ew.js +11 -0
- package/dist/chunk-6xzrzmsr.js +2 -0
- package/dist/chunk-7848rf5q.js +63 -0
- package/dist/chunk-7ep2edcv.js +12 -0
- package/dist/chunk-7svw66kw.js +13 -0
- package/dist/chunk-7xgr8vx6.js +2 -0
- package/dist/chunk-7zjn6m1m.js +2 -0
- package/dist/chunk-8atqb297.js +12 -0
- package/dist/chunk-8ebkxjar.js +7 -0
- package/dist/chunk-8j3aw4qg.js +3 -0
- package/dist/chunk-8jy0dvcn.js +3 -0
- package/dist/chunk-8refh038.js +2 -0
- package/dist/chunk-93cszp8k.js +3 -0
- package/dist/chunk-93ze3gcb.js +2 -0
- package/dist/chunk-98yxzxtd.js +2 -0
- package/dist/chunk-9g64kggy.js +3 -0
- package/dist/chunk-9h1pwxb2.js +8 -0
- package/dist/chunk-9j4j9nrm.js +2 -0
- package/dist/chunk-9kzczwh0.js +3 -0
- package/dist/chunk-9n629gtn.js +3 -0
- package/dist/chunk-9y59sxde.js +2 -0
- package/dist/chunk-a2m5jyd8.js +2 -0
- package/dist/chunk-a595cp8s.js +2 -0
- package/dist/chunk-ak0k3m4q.js +3 -0
- package/dist/chunk-apksmrz9.js +3 -0
- package/dist/chunk-b05r09sj.js +10 -0
- package/dist/chunk-b47e563q.js +2 -0
- package/dist/chunk-b57avnse.js +2 -0
- package/dist/chunk-bfjq7w7k.js +2 -0
- package/dist/chunk-bhc70qet.js +3 -0
- package/dist/chunk-bvtscj68.js +2 -0
- package/dist/chunk-bw2cy5v0.js +8 -0
- package/dist/chunk-c7dvyh2x.js +2 -0
- package/dist/chunk-cbz8b7g5.js +3 -0
- package/dist/chunk-cw4vbnet.js +3 -0
- package/dist/chunk-czcj3j9y.js +2 -0
- package/dist/chunk-dg466kdp.js +2 -0
- package/dist/chunk-dmscgnhq.js +2 -0
- package/dist/chunk-dtk4m8rm.js +3 -0
- package/dist/chunk-dy7akyj3.js +2 -0
- package/dist/chunk-e2wv2sp4.js +2 -0
- package/dist/chunk-e8j03wnd.js +3 -0
- package/dist/chunk-egkp6tct.js +2 -0
- package/dist/chunk-emfc800a.js +2 -0
- package/dist/chunk-envnht72.js +4 -0
- package/dist/chunk-eskw1cj2.js +3 -0
- package/dist/chunk-ezz15tyg.js +2 -0
- package/dist/chunk-fkmzj0qt.js +16 -0
- package/dist/chunk-fqt3c3g5.js +4 -0
- package/dist/chunk-frbht418.js +19 -0
- package/dist/chunk-ftz8cqfq.js +2 -0
- package/dist/chunk-g4jxdrr6.js +2 -0
- package/dist/chunk-g52xzmrr.js +2 -0
- package/dist/chunk-gbtvkje9.js +4 -0
- package/dist/chunk-gm9msqq5.js +8 -0
- package/dist/chunk-gxat3dpd.js +3 -0
- package/dist/chunk-hfppq1w5.js +4 -0
- package/dist/chunk-jdg870gy.js +1683 -0
- package/dist/chunk-jfz77m78.js +3 -0
- package/dist/chunk-jg9r58pf.js +16 -0
- package/dist/chunk-jgzt4945.js +2 -0
- package/dist/chunk-jh2epywq.js +2 -0
- package/dist/chunk-jpj6a56k.js +2 -0
- package/dist/chunk-jw4sgq23.js +2 -0
- package/dist/chunk-jws11ngd.js +2 -0
- package/dist/chunk-jxhz82qt.js +2 -0
- package/dist/chunk-k19y2psf.js +4 -0
- package/dist/chunk-k6cj14zk.js +2 -0
- package/dist/chunk-kktm0pdc.js +3 -0
- package/dist/chunk-kmr27ake.js +160 -0
- package/dist/chunk-kyhwvbvq.js +2 -0
- package/dist/chunk-mgn5pejx.js +2 -0
- package/dist/chunk-mskyzxb3.js +3 -0
- package/dist/chunk-my9cfmvt.js +5 -0
- package/dist/chunk-n4vx7kvs.js +389 -0
- package/dist/chunk-nc44rvs7.js +23 -0
- package/dist/chunk-ng3vbpmy.js +3 -0
- package/dist/chunk-nmnp5g5p.js +228 -0
- package/dist/chunk-nn0t3xmn.js +2 -0
- package/dist/chunk-npr41z9a.js +19 -0
- package/dist/chunk-ntvr3177.js +25 -0
- package/dist/chunk-pkc5hkha.js +2 -0
- package/dist/chunk-ppg6zhae.js +3 -0
- package/dist/chunk-pqwm9zk1.js +6 -0
- package/dist/chunk-ptvjmfqx.js +2 -0
- package/dist/chunk-q1r48y0y.js +34 -0
- package/dist/chunk-q9yddd1r.js +3 -0
- package/dist/chunk-qavtgsrh.js +2 -0
- package/dist/chunk-qvh8ghjw.js +7 -0
- package/dist/chunk-qx6r187q.js +2 -0
- package/dist/chunk-r093mfa8.js +32 -0
- package/dist/chunk-rbaj9ktq.js +2 -0
- package/dist/chunk-rkf9ynkx.js +3 -0
- package/dist/chunk-rpp44jtx.js +3 -0
- package/dist/chunk-rrvwp351.js +2 -0
- package/dist/chunk-rs8fsgqt.js +81 -0
- package/dist/chunk-s4gy87ft.js +8 -0
- package/dist/chunk-s5qq2ch2.js +12 -0
- package/dist/chunk-s92578qx.js +71 -0
- package/dist/chunk-snsb760m.js +2 -0
- package/dist/chunk-sp1cvejp.js +2 -0
- package/dist/chunk-spb3tm25.js +4 -0
- package/dist/chunk-srnmswkj.js +2 -0
- package/dist/chunk-sxgbzwrs.js +2 -0
- package/dist/chunk-t2s6m9t2.js +35 -0
- package/dist/chunk-t98sdxty.js +2 -0
- package/dist/chunk-tbnxx5na.js +2 -0
- package/dist/chunk-tfxm3qz4.js +2 -0
- package/dist/chunk-treb38pz.js +3 -0
- package/dist/chunk-tvw8tfpr.js +6 -0
- package/dist/chunk-v107htgw.js +101 -0
- package/dist/chunk-v8at4gnt.js +2 -0
- package/dist/chunk-vmr3get8.js +2 -0
- package/dist/chunk-vqrnejgj.js +71 -0
- package/dist/chunk-vvwy955j.js +3 -0
- package/dist/chunk-w5jxffnq.js +2 -0
- package/dist/chunk-wcbh5jqy.js +3 -0
- package/dist/chunk-wfmrnep1.js +2 -0
- package/dist/chunk-wk11yy8h.js +3 -0
- package/dist/chunk-wn5f1tfj.js +2 -0
- package/dist/chunk-wpm2p1gq.js +3 -0
- package/dist/chunk-wxkyv5gj.js +2 -0
- package/dist/chunk-wyed730e.js +2 -0
- package/dist/chunk-x65zs89t.js +3 -0
- package/dist/chunk-x6zjq78z.js +2 -0
- package/dist/chunk-xedav0qx.js +3 -0
- package/dist/chunk-xmftb9ad.js +38 -0
- package/dist/chunk-xvtkw7hj.js +3 -0
- package/dist/chunk-xy0txg0n.js +2 -0
- package/dist/chunk-y7s5cpwr.js +34 -0
- package/dist/chunk-yg48tfvv.js +16 -0
- package/dist/chunk-ygpen625.js +3 -0
- package/dist/chunk-ymb45bt6.js +2 -0
- package/dist/chunk-yp2zfcvh.js +8 -0
- package/dist/chunk-z3mx7n44.js +3 -0
- package/dist/chunk-zaj612bw.js +3 -0
- package/dist/chunk-zb3179f9.js +3 -0
- package/dist/chunk-zhd8f4pc.js +759 -0
- package/dist/chunk-zjpnyah2.js +3 -0
- package/dist/cli/cmd/tui/worker.js +2 -0
- package/dist/highlights-eq9cgrbb.scm +604 -0
- package/dist/highlights-ghv9g403.scm +205 -0
- package/dist/highlights-hk7bwhj4.scm +284 -0
- package/dist/highlights-r812a2qc.scm +150 -0
- package/dist/highlights-x6tmsnaa.scm +115 -0
- package/dist/index.js +146 -5742
- package/dist/injections-73j83es3.scm +27 -0
- package/dist/muxcode-linux-x64 +0 -0
- package/dist/nope-03-2z8weyjw.mp3 +0 -0
- package/dist/photon_rs_bg-bq08arze.wasm +0 -0
- package/dist/staplebops-06-rz29m246.mp3 +0 -0
- package/dist/tree-sitter-3jzf13jk.wasm +0 -0
- package/dist/tree-sitter-bash-hq5s6fxb.wasm +0 -0
- package/dist/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
- package/dist/tree-sitter-markdown-411r6y9b.wasm +0 -0
- package/dist/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
- package/dist/tree-sitter-powershell-ryb2ffqs.wasm +0 -0
- package/dist/tree-sitter-typescript-zxjzwt75.wasm +0 -0
- package/dist/tree-sitter-zig-e78zbjpm.wasm +0 -0
- package/dist/yup-01-30ecpeh9.mp3 +0 -0
- package/package.json +8 -7
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Et as _,Gt as yG,Ht as YG,It as d,Jt as IG,Kt as RG,Lt as xG,Ps as g,Rs as FG,Ts as NG,Vs as wG,Ws as e,Xs as SG,dt as $G,ht as OG,it as XG,lt as fG,ot as v,rt as k,st as s,vt as CG,yt as p,zt as u}from"./chunk-1pv2317e.js";import{Nt as l,Ot as JG,Xt as BG,_t as c}from"./chunk-21x3anp4.js";import{Du as G}from"./chunk-ntvr3177.js";import"./chunk-8j3aw4qg.js";function vG(J){var D;let U=[],q=[];for(let{role:K,content:z}of J)switch(K){case"system":{U.push({role:"system",content:z});break}case"user":{if(z.length===1&&z[0].type==="text"){U.push({role:"user",content:z[0].text});break}U.push({role:"user",content:z.map((A)=>{switch(A.type){case"text":return{type:"text",text:A.text};case"file":if(A.mediaType.startsWith("image/")){let Y=A.mediaType==="image/*"?"image/jpeg":A.mediaType;return{type:"image_url",image_url:{url:A.data instanceof URL?A.data.toString():`data:${Y};base64,${e(A.data)}`}}}else throw new c({functionality:`file part media type ${A.mediaType}`})}})});break}case"assistant":{let A="",Y=[];for(let X of z)switch(X.type){case"text":{A+=X.text;break}case"tool-call":{Y.push({id:X.toolCallId,type:"function",function:{name:X.toolName,arguments:JSON.stringify(X.input)}});break}}U.push({role:"assistant",content:A,tool_calls:Y.length>0?Y:void 0});break}case"tool":{for(let A of z){if(A.type==="tool-approval-response")continue;let Y=A.output,X;switch(Y.type){case"text":case"error-text":X=Y.value;break;case"execution-denied":X=(D=Y.reason)!=null?D:"Tool execution denied.";break;case"content":case"json":case"error-json":X=JSON.stringify(Y.value);break}U.push({role:"tool",tool_call_id:A.toolCallId,content:X})}break}default:throw Error(`Unsupported role: ${K}`)}return{messages:U,warnings:q}}function PG(J){var D,U,q,K;let z=(U=(D=J.prompt_tokens_details)==null?void 0:D.cached_tokens)!=null?U:0,A=(K=(q=J.completion_tokens_details)==null?void 0:q.reasoning_tokens)!=null?K:0,Y=z<=J.prompt_tokens;return{inputTokens:{total:Y?J.prompt_tokens:J.prompt_tokens+z,noCache:Y?J.prompt_tokens-z:J.prompt_tokens,cacheRead:z,cacheWrite:void 0},outputTokens:{total:J.completion_tokens+A,text:J.completion_tokens,reasoning:A},raw:J}}function QG({id:J,model:D,created:U,created_at:q}){let K=U!=null?U:q;return{id:J!=null?J:void 0,modelId:D!=null?D:void 0,timestamp:K!=null?new Date(K*1000):void 0}}function WG(J){switch(J){case"stop":return"stop";case"length":return"length";case"tool_calls":case"function_call":return"tool-calls";case"content_filter":return"content-filter";default:return"other"}}var kG=G.object({type:G.literal("web"),country:G.string().length(2).optional(),excludedWebsites:G.array(G.string()).max(5).optional(),allowedWebsites:G.array(G.string()).max(5).optional(),safeSearch:G.boolean().optional()}),hG=G.object({type:G.literal("x"),excludedXHandles:G.array(G.string()).optional(),includedXHandles:G.array(G.string()).optional(),postFavoriteCount:G.number().int().optional(),postViewCount:G.number().int().optional(),xHandles:G.array(G.string()).optional()}),bG=G.object({type:G.literal("news"),country:G.string().length(2).optional(),excludedWebsites:G.array(G.string()).max(5).optional(),safeSearch:G.boolean().optional()}),_G=G.object({type:G.literal("rss"),links:G.array(G.string().url()).max(1)}),mG=G.discriminatedUnion("type",[kG,hG,bG,_G]),gG=G.object({reasoningEffort:G.enum(["low","high"]).optional(),logprobs:G.boolean().optional(),topLogprobs:G.number().int().min(0).max(8).optional(),parallel_function_calling:G.boolean().optional(),searchParameters:G.object({mode:G.enum(["off","auto","on"]),returnCitations:G.boolean().optional(),fromDate:G.string().optional(),toDate:G.string().optional(),maxSearchResults:G.number().min(1).max(50).optional(),sources:G.array(mG).optional()}).optional()}),uG=G.object({error:G.object({message:G.string(),type:G.string().nullish(),param:G.any().nullish(),code:G.union([G.string(),G.number()]).nullish()})}),r=yG({errorSchema:uG,errorToMessage:(J)=>J.error.message});function dG({tools:J,toolChoice:D}){J=(J==null?void 0:J.length)?J:void 0;let U=[];if(J==null)return{tools:void 0,toolChoice:void 0,toolWarnings:U};let q=[];for(let z of J)if(z.type==="provider")U.push({type:"unsupported",feature:`provider-defined tool ${z.name}`});else q.push({type:"function",function:{name:z.name,description:z.description,parameters:z.inputSchema,...z.strict!=null?{strict:z.strict}:{}}});if(D==null)return{tools:q,toolChoice:void 0,toolWarnings:U};let K=D.type;switch(K){case"auto":case"none":return{tools:q,toolChoice:K,toolWarnings:U};case"required":return{tools:q,toolChoice:"required",toolWarnings:U};case"tool":return{tools:q,toolChoice:{type:"function",function:{name:D.toolName}},toolWarnings:U};default:throw new c({functionality:`tool choice type: ${K}`})}}var cG=class{constructor(J,D){this.specificationVersion="v3",this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=J,this.config=D}get provider(){return this.config.provider}async getArgs({prompt:J,maxOutputTokens:D,temperature:U,topP:q,topK:K,frequencyPenalty:z,presencePenalty:A,stopSequences:Y,seed:X,responseFormat:Z,providerOptions:V,tools:P,toolChoice:F}){var B,R,N;let $=[],W=(B=await p({provider:"xai",providerOptions:V,schema:gG}))!=null?B:{};if(K!=null)$.push({type:"unsupported",feature:"topK"});if(z!=null)$.push({type:"unsupported",feature:"frequencyPenalty"});if(A!=null)$.push({type:"unsupported",feature:"presencePenalty"});if(Y!=null)$.push({type:"unsupported",feature:"stopSequences"});let{messages:M,warnings:O}=vG(J);$.push(...O);let{tools:C,toolChoice:w,toolWarnings:j}=dG({tools:P,toolChoice:F});return $.push(...j),{args:{model:this.modelId,logprobs:W.logprobs===!0||W.topLogprobs!=null?!0:void 0,top_logprobs:W.topLogprobs,max_completion_tokens:D,temperature:U,top_p:q,seed:X,reasoning_effort:W.reasoningEffort,parallel_function_calling:W.parallel_function_calling,response_format:(Z==null?void 0:Z.type)==="json"?Z.schema!=null?{type:"json_schema",json_schema:{name:(R=Z.name)!=null?R:"response",schema:Z.schema,strict:!0}}:{type:"json_object"}:void 0,search_parameters:W.searchParameters?{mode:W.searchParameters.mode,return_citations:W.searchParameters.returnCitations,from_date:W.searchParameters.fromDate,to_date:W.searchParameters.toDate,max_search_results:W.searchParameters.maxSearchResults,sources:(N=W.searchParameters.sources)==null?void 0:N.map((S)=>{var b;return{type:S.type,...S.type==="web"&&{country:S.country,excluded_websites:S.excludedWebsites,allowed_websites:S.allowedWebsites,safe_search:S.safeSearch},...S.type==="x"&&{excluded_x_handles:S.excludedXHandles,included_x_handles:(b=S.includedXHandles)!=null?b:S.xHandles,post_favorite_count:S.postFavoriteCount,post_view_count:S.postViewCount},...S.type==="news"&&{country:S.country,excluded_websites:S.excludedWebsites,safe_search:S.safeSearch},...S.type==="rss"&&{links:S.links}}})}:void 0,messages:M,tools:C,tool_choice:w},warnings:$}}async doGenerate(J){var D,U;let{args:q,warnings:K}=await this.getArgs(J),z=`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/chat/completions`,{responseHeaders:A,value:Y,rawValue:X}=await u({url:z,headers:g(this.config.headers(),J.headers),body:q,failedResponseHandler:r,successfulResponseHandler:d(pG),abortSignal:J.abortSignal,fetch:this.config.fetch});if(Y.error!=null)throw new JG({message:Y.error,url:z,requestBodyValues:q,statusCode:200,responseHeaders:A,responseBody:JSON.stringify(X),isRetryable:Y.code==="The service is currently unavailable"});let Z=Y.choices[0],V=[];if(Z.message.content!=null&&Z.message.content.length>0){let P=Z.message.content,F=q.messages[q.messages.length-1];if((F==null?void 0:F.role)==="assistant"&&P===F.content)P="";if(P.length>0)V.push({type:"text",text:P})}if(Z.message.reasoning_content!=null&&Z.message.reasoning_content.length>0)V.push({type:"reasoning",text:Z.message.reasoning_content});if(Z.message.tool_calls!=null)for(let P of Z.message.tool_calls)V.push({type:"tool-call",toolCallId:P.id,toolName:P.function.name,input:P.function.arguments});if(Y.citations!=null)for(let P of Y.citations)V.push({type:"source",sourceType:"url",id:this.config.generateId(),url:P});return{content:V,finishReason:{unified:WG(Z.finish_reason),raw:(U=Z.finish_reason)!=null?U:void 0},usage:Y.usage?PG(Y.usage):{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}},request:{body:q},response:{...QG(Y),headers:A,body:X},warnings:K}}async doStream(J){var D;let{args:U,warnings:q}=await this.getArgs(J),K={...U,stream:!0,stream_options:{include_usage:!0}},z=`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/chat/completions`,{responseHeaders:A,value:Y}=await u({url:z,headers:g(this.config.headers(),J.headers),body:K,failedResponseHandler:r,successfulResponseHandler:async({response:N})=>{let $=NG(N),W=N.headers.get("content-type");if(W==null?void 0:W.includes("application/json")){let M=await N.text(),O=await CG({text:M,schema:lG});if(O.success)throw new JG({message:O.value.error,url:z,requestBodyValues:K,statusCode:200,responseHeaders:$,responseBody:M,isRetryable:O.value.code==="The service is currently unavailable"});throw new JG({message:"Invalid JSON response",url:z,requestBodyValues:K,statusCode:200,responseHeaders:$,responseBody:M})}return YG(iG)({response:N,url:z,requestBodyValues:K})},abortSignal:J.abortSignal,fetch:this.config.fetch}),X={unified:"other",raw:void 0},Z=void 0,V=!0,P={},F={},B=void 0,R=this;return{stream:Y.pipeThrough(new TransformStream({start(N){N.enqueue({type:"stream-start",warnings:q})},transform(N,$){if(J.includeRawChunks)$.enqueue({type:"raw",rawValue:N.rawValue});if(!N.success){$.enqueue({type:"error",error:N.error});return}let W=N.value;if(V)$.enqueue({type:"response-metadata",...QG(W)}),V=!1;if(W.citations!=null)for(let w of W.citations)$.enqueue({type:"source",sourceType:"url",id:R.config.generateId(),url:w});if(W.usage!=null)Z=PG(W.usage);let M=W.choices[0];if((M==null?void 0:M.finish_reason)!=null)X={unified:WG(M.finish_reason),raw:M.finish_reason};if((M==null?void 0:M.delta)==null)return;let{delta:O,index:C}=M;if(O.content!=null&&O.content.length>0){let w=O.content;if(B!=null&&!P[B].ended)$.enqueue({type:"reasoning-end",id:B}),P[B].ended=!0,B=void 0;let j=K.messages[K.messages.length-1];if((j==null?void 0:j.role)==="assistant"&&w===j.content)return;let y=`text-${W.id||C}`;if(P[y]==null)P[y]={type:"text",ended:!1},$.enqueue({type:"text-start",id:y});$.enqueue({type:"text-delta",id:y,delta:w})}if(O.reasoning_content!=null&&O.reasoning_content.length>0){let w=`reasoning-${W.id||C}`;if(F[w]===O.reasoning_content)return;if(F[w]=O.reasoning_content,P[w]==null)P[w]={type:"reasoning",ended:!1},B=w,$.enqueue({type:"reasoning-start",id:w});$.enqueue({type:"reasoning-delta",id:w,delta:O.reasoning_content})}if(O.tool_calls!=null){if(B!=null&&!P[B].ended)$.enqueue({type:"reasoning-end",id:B}),P[B].ended=!0,B=void 0;for(let w of O.tool_calls){let j=w.id;$.enqueue({type:"tool-input-start",id:j,toolName:w.function.name}),$.enqueue({type:"tool-input-delta",id:j,delta:w.function.arguments}),$.enqueue({type:"tool-input-end",id:j}),$.enqueue({type:"tool-call",toolCallId:j,toolName:w.function.name,input:w.function.arguments})}}},flush(N){for(let[$,W]of Object.entries(P))if(!W.ended)N.enqueue({type:W.type==="text"?"text-end":"reasoning-end",id:$});N.enqueue({type:"finish",finishReason:X,usage:Z!=null?Z:{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}}})}})),request:{body:K},response:{headers:A}}}},TG=G.object({prompt_tokens:G.number(),completion_tokens:G.number(),total_tokens:G.number(),prompt_tokens_details:G.object({text_tokens:G.number().nullish(),audio_tokens:G.number().nullish(),image_tokens:G.number().nullish(),cached_tokens:G.number().nullish()}).nullish(),completion_tokens_details:G.object({reasoning_tokens:G.number().nullish(),audio_tokens:G.number().nullish(),accepted_prediction_tokens:G.number().nullish(),rejected_prediction_tokens:G.number().nullish()}).nullish()}),pG=G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({message:G.object({role:G.literal("assistant"),content:G.string().nullish(),reasoning_content:G.string().nullish(),tool_calls:G.array(G.object({id:G.string(),type:G.literal("function"),function:G.object({name:G.string(),arguments:G.string()})})).nullish()}),index:G.number(),finish_reason:G.string().nullish()})).nullish(),object:G.literal("chat.completion").nullish(),usage:TG.nullish(),citations:G.array(G.string().url()).nullish(),code:G.string().nullish(),error:G.string().nullish()}),iG=G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({delta:G.object({role:G.enum(["assistant"]).optional(),content:G.string().nullish(),reasoning_content:G.string().nullish(),tool_calls:G.array(G.object({id:G.string(),type:G.literal("function"),function:G.object({name:G.string(),arguments:G.string()})})).nullish()}),finish_reason:G.string().nullish(),index:G.number()})),usage:TG.nullish(),citations:G.array(G.string().url()).nullish()}),lG=G.object({code:G.string(),error:G.string()}),rG=G.object({aspect_ratio:G.string().optional(),output_format:G.string().optional(),sync_mode:G.boolean().optional(),resolution:G.enum(["1k","2k"]).optional(),quality:G.enum(["low","medium","high"]).optional(),user:G.string().optional()}),aG=class{constructor(J,D){this.modelId=J,this.config=D,this.specificationVersion="v3",this.maxImagesPerCall=3}get provider(){return this.config.provider}async doGenerate({prompt:J,n:D,size:U,aspectRatio:q,seed:K,providerOptions:z,headers:A,abortSignal:Y,files:X,mask:Z}){var V,P,F,B,R;let N=[];if(U!=null)N.push({type:"unsupported",feature:"size",details:"This model does not support the `size` option. Use `aspectRatio` instead."});if(K!=null)N.push({type:"unsupported",feature:"seed"});if(Z!=null)N.push({type:"unsupported",feature:"mask"});let $=await p({provider:"xai",providerOptions:z,schema:rG}),W=X!=null&&X.length>0,M=W?X.map((I)=>SG(I)):[],O=W?"/images/edits":"/images/generations",C={model:this.modelId,prompt:J,n:D,response_format:"b64_json"};if(q!=null)C.aspect_ratio=q;if(($==null?void 0:$.output_format)!=null)C.output_format=$.output_format;if(($==null?void 0:$.sync_mode)!=null)C.sync_mode=$.sync_mode;if(($==null?void 0:$.aspect_ratio)!=null&&q==null)C.aspect_ratio=$.aspect_ratio;if(($==null?void 0:$.resolution)!=null)C.resolution=$.resolution;if(($==null?void 0:$.quality)!=null)C.quality=$.quality;if(($==null?void 0:$.user)!=null)C.user=$.user;if(M.length===1)C.image={url:M[0],type:"image_url"};else if(M.length>1)C.images=M.map((I)=>({url:I,type:"image_url"}));let w=(V=this.config.baseURL)!=null?V:"https://api.x.ai/v1",j=(B=(F=(P=this.config._internal)==null?void 0:P.currentDate)==null?void 0:F.call(P))!=null?B:new Date,{value:y,responseHeaders:S}=await u({url:`${w}${O}`,headers:g(this.config.headers(),A),body:C,failedResponseHandler:r,successfulResponseHandler:d(nG),abortSignal:Y,fetch:this.config.fetch});return{images:y.data.every((I)=>I.b64_json!=null)?y.data.map((I)=>I.b64_json):await Promise.all(y.data.map((I)=>this.downloadImage(I.url,Y))),warnings:N,response:{timestamp:j,modelId:this.modelId,headers:S},providerMetadata:{xai:{images:y.data.map((I)=>({...I.revised_prompt?{revisedPrompt:I.revised_prompt}:{}})),...((R=y.usage)==null?void 0:R.cost_in_usd_ticks)!=null?{costInUsdTicks:y.usage.cost_in_usd_ticks}:{}}}}}async downloadImage(J,D){let{value:U}=await XG({url:J,abortSignal:D,failedResponseHandler:RG(),successfulResponseHandler:IG(),fetch:this.config.fetch});return U}},nG=G.object({data:G.array(G.object({url:G.string().nullish(),b64_json:G.string().nullish(),revised_prompt:G.string().nullish()})),usage:G.object({cost_in_usd_ticks:G.number().nullish()}).nullish()});async function sG({prompt:J}){var D,U,q,K,z;let A=[],Y=[];for(let X of J)switch(X.role){case"system":{A.push({role:"system",content:X.content});break}case"user":{let Z=[];for(let V of X.content)switch(V.type){case"text":{Z.push({type:"input_text",text:V.text});break}case"file":{if(V.mediaType.startsWith("image/")){let P=V.mediaType==="image/*"?"image/jpeg":V.mediaType,F=V.data instanceof URL?V.data.toString():`data:${P};base64,${e(V.data)}`;Z.push({type:"input_image",image_url:F})}else if(V.mediaType==="application/pdf")if(V.data instanceof URL)Z.push({type:"input_file",file_url:V.data.toString()});else Z.push({type:"input_file",...typeof V.data==="string"&&V.data.startsWith("file-")?{file_id:V.data}:{filename:V.filename??"file",file_data:`data:application/pdf;base64,${e(V.data)}`}});else throw new c({functionality:`file part media type ${V.mediaType}`});break}default:{let P=V;Y.push({type:"other",message:"xAI Responses API does not support this content type in user messages"})}}A.push({role:"user",content:Z});break}case"assistant":{for(let Z of X.content)switch(Z.type){case"text":{let V=typeof((U=(D=Z.providerOptions)==null?void 0:D.xai)==null?void 0:U.itemId)==="string"?Z.providerOptions.xai.itemId:void 0;A.push({role:"assistant",content:Z.text,id:V});break}case"tool-call":{if(Z.providerExecuted)break;let V=typeof((K=(q=Z.providerOptions)==null?void 0:q.xai)==null?void 0:K.itemId)==="string"?Z.providerOptions.xai.itemId:void 0;A.push({type:"function_call",id:V!=null?V:Z.toolCallId,call_id:Z.toolCallId,name:Z.toolName,arguments:JSON.stringify(Z.input),status:"completed"});break}case"tool-result":break;case"reasoning":case"file":{Y.push({type:"other",message:`xAI Responses API does not support ${Z.type} in assistant messages`});break}default:{let V=Z;Y.push({type:"other",message:"xAI Responses API does not support this content type in assistant messages"})}}break}case"tool":{for(let Z of X.content){if(Z.type==="tool-approval-response")continue;let V=Z.output,P;switch(V.type){case"text":case"error-text":P=V.value;break;case"execution-denied":P=(z=V.reason)!=null?z:"tool execution denied";break;case"json":case"error-json":P=JSON.stringify(V.value);break;case"content":P=V.value.map((F)=>{if(F.type==="text")return F.text;return""}).join("");break;default:{let F=V;P=""}}A.push({type:"function_call_output",call_id:Z.toolCallId,output:P})}break}default:{let Z=X;Y.push({type:"other",message:"unsupported message role"})}}return{input:A,inputWarnings:Y}}function ZG(J){var D,U,q,K;let z=(U=(D=J.input_tokens_details)==null?void 0:D.cached_tokens)!=null?U:0,A=(K=(q=J.output_tokens_details)==null?void 0:q.reasoning_tokens)!=null?K:0,Y=z<=J.input_tokens;return{inputTokens:{total:Y?J.input_tokens:J.input_tokens+z,noCache:Y?J.input_tokens-z:J.input_tokens,cacheRead:z,cacheWrite:void 0},outputTokens:{total:J.output_tokens,text:J.output_tokens-A,reasoning:A},raw:J}}function GG(J){switch(J){case"stop":case"completed":return"stop";case"length":case"max_output_tokens":return"length";case"tool_calls":case"function_call":return"tool-calls";case"content_filter":return"content-filter";default:return"other"}}var KG=G.union([G.object({type:G.literal("url_citation"),url:G.string(),title:G.string().optional()}),G.object({type:G.string()})]),AG=G.object({type:G.string(),text:G.string().optional(),logprobs:G.array(G.any()).optional(),annotations:G.array(KG).optional()}),jG=G.object({type:G.string(),text:G.string()}),i=G.object({name:G.string().optional(),arguments:G.string().optional(),input:G.string().optional(),call_id:G.string().optional(),id:G.string(),status:G.string(),action:G.any().optional()}),tG=G.object({name:G.string().optional(),arguments:G.string().optional(),output:G.string().optional(),error:G.string().optional(),id:G.string(),status:G.string(),server_label:G.string().optional()}),DG=G.discriminatedUnion("type",[G.object({type:G.literal("web_search_call"),...i.shape}),G.object({type:G.literal("x_search_call"),...i.shape}),G.object({type:G.literal("code_interpreter_call"),...i.shape}),G.object({type:G.literal("code_execution_call"),...i.shape}),G.object({type:G.literal("view_image_call"),...i.shape}),G.object({type:G.literal("view_x_video_call"),...i.shape}),G.object({type:G.literal("file_search_call"),id:G.string(),status:G.string(),queries:G.array(G.string()).optional(),results:G.array(G.object({file_id:G.string(),filename:G.string(),score:G.number(),text:G.string()})).nullish()}),G.object({type:G.literal("custom_tool_call"),...i.shape}),G.object({type:G.literal("mcp_call"),...tG.shape}),G.object({type:G.literal("message"),role:G.string(),content:G.array(AG),id:G.string(),status:G.string()}),G.object({type:G.literal("function_call"),name:G.string(),arguments:G.string(),call_id:G.string(),id:G.string()}),G.object({type:G.literal("reasoning"),id:G.string(),summary:G.array(jG),status:G.string(),encrypted_content:G.string().nullish()})]),qG=G.object({input_tokens:G.number(),output_tokens:G.number(),total_tokens:G.number().optional(),input_tokens_details:G.object({cached_tokens:G.number().optional()}).optional(),output_tokens_details:G.object({reasoning_tokens:G.number().optional()}).optional(),num_sources_used:G.number().optional(),num_server_side_tools_used:G.number().optional()}),t=G.object({id:G.string().nullish(),created_at:G.number().nullish(),model:G.string().nullish(),object:G.literal("response"),output:G.array(DG),usage:qG.nullish(),status:G.string()}),eG=G.union([G.object({type:G.literal("response.created"),response:t.partial({usage:!0,status:!0})}),G.object({type:G.literal("response.in_progress"),response:t.partial({usage:!0,status:!0})}),G.object({type:G.literal("response.output_item.added"),item:DG,output_index:G.number()}),G.object({type:G.literal("response.output_item.done"),item:DG,output_index:G.number()}),G.object({type:G.literal("response.content_part.added"),item_id:G.string(),output_index:G.number(),content_index:G.number(),part:AG}),G.object({type:G.literal("response.content_part.done"),item_id:G.string(),output_index:G.number(),content_index:G.number(),part:AG}),G.object({type:G.literal("response.output_text.delta"),item_id:G.string(),output_index:G.number(),content_index:G.number(),delta:G.string(),logprobs:G.array(G.any()).optional()}),G.object({type:G.literal("response.output_text.done"),item_id:G.string(),output_index:G.number(),content_index:G.number(),text:G.string(),logprobs:G.array(G.any()).optional(),annotations:G.array(KG).optional()}),G.object({type:G.literal("response.output_text.annotation.added"),item_id:G.string(),output_index:G.number(),content_index:G.number(),annotation_index:G.number(),annotation:KG}),G.object({type:G.literal("response.reasoning_summary_part.added"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),part:jG}),G.object({type:G.literal("response.reasoning_summary_part.done"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),part:jG}),G.object({type:G.literal("response.reasoning_summary_text.delta"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.reasoning_summary_text.done"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),text:G.string()}),G.object({type:G.literal("response.reasoning_text.delta"),item_id:G.string(),output_index:G.number(),content_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.reasoning_text.done"),item_id:G.string(),output_index:G.number(),content_index:G.number(),text:G.string()}),G.object({type:G.literal("response.web_search_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.web_search_call.searching"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.web_search_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.x_search_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.x_search_call.searching"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.x_search_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.file_search_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.file_search_call.searching"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.file_search_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_execution_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_execution_call.executing"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_execution_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.executing"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.interpreting"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call_code.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.code_interpreter_call_code.done"),item_id:G.string(),output_index:G.number(),code:G.string()}),G.object({type:G.literal("response.custom_tool_call_input.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.custom_tool_call_input.done"),item_id:G.string(),output_index:G.number(),input:G.string()}),G.object({type:G.literal("response.function_call_arguments.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.function_call_arguments.done"),item_id:G.string(),output_index:G.number(),arguments:G.string()}),G.object({type:G.literal("response.mcp_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call.executing"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call.failed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call_arguments.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.mcp_call_arguments.done"),item_id:G.string(),output_index:G.number(),arguments:G.string().optional()}),G.object({type:G.literal("response.mcp_call_output.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.mcp_call_output.done"),item_id:G.string(),output_index:G.number(),output:G.string().optional()}),G.object({type:G.literal("response.incomplete"),response:G.object({incomplete_details:G.object({reason:G.string()}).nullish(),usage:qG.nullish()})}),G.object({type:G.literal("response.failed"),response:G.object({error:G.object({code:G.string().nullish(),message:G.string()}).nullish(),incomplete_details:G.object({reason:G.string()}).nullish(),usage:qG.nullish()})}),G.object({type:G.literal("error"),code:G.string().nullish(),message:G.string(),param:G.string().nullish()}),G.object({type:G.literal("response.done"),response:t}),G.object({type:G.literal("response.completed"),response:t})]),oG=G.object({reasoningEffort:G.enum(["low","medium","high"]).optional(),logprobs:G.boolean().optional(),topLogprobs:G.number().int().min(0).max(8).optional(),store:G.boolean().optional(),previousResponseId:G.string().optional(),include:G.array(G.enum(["file_search_call.results"])).nullish()}),GJ=v(()=>k(G.object({vectorStoreIds:G.array(G.string()),maxNumResults:G.number().optional()}))),JJ=v(()=>k(G.object({queries:G.array(G.string()),results:G.array(G.object({fileId:G.string(),filename:G.string(),score:G.number().min(0).max(1),text:G.string()})).nullable()}))),QJ=_({id:"xai.file_search",inputSchema:v(()=>k(G.object({}))),outputSchema:JJ}),XJ=(J)=>QJ(J),YJ=v(()=>k(G.object({serverUrl:G.string().describe("The URL of the MCP server"),serverLabel:G.string().optional().describe("A label for the MCP server"),serverDescription:G.string().optional().describe("Description of the MCP server"),allowedTools:G.array(G.string()).optional().describe("List of allowed tool names"),headers:G.record(G.string(),G.string()).optional().describe("Custom headers to send"),authorization:G.string().optional().describe("Authorization header value")}))),ZJ=v(()=>k(G.object({name:G.string(),arguments:G.string(),result:G.unknown()}))),$J=_({id:"xai.mcp",inputSchema:v(()=>k(G.object({}))),outputSchema:ZJ}),KJ=(J)=>$J(J),AJ=v(()=>k(G.object({allowedDomains:G.array(G.string()).max(5).optional(),excludedDomains:G.array(G.string()).max(5).optional(),enableImageUnderstanding:G.boolean().optional()}))),jJ=v(()=>k(G.object({query:G.string(),sources:G.array(G.object({title:G.string(),url:G.string(),snippet:G.string()}))}))),DJ=_({id:"xai.web_search",inputSchema:v(()=>k(G.object({}))),outputSchema:jJ}),qJ=(J={})=>DJ(J),zJ=v(()=>k(G.object({allowedXHandles:G.array(G.string()).max(10).optional(),excludedXHandles:G.array(G.string()).max(10).optional(),fromDate:G.string().optional(),toDate:G.string().optional(),enableImageUnderstanding:G.boolean().optional(),enableVideoUnderstanding:G.boolean().optional()}))),VJ=v(()=>k(G.object({query:G.string(),posts:G.array(G.object({author:G.string(),text:G.string(),url:G.string(),likes:G.number()}))}))),LJ=_({id:"xai.x_search",inputSchema:v(()=>k(G.object({}))),outputSchema:VJ}),UJ=(J={})=>LJ(J);async function HJ({tools:J,toolChoice:D}){let U=(J==null?void 0:J.length)?J:void 0,q=[];if(U==null)return{tools:void 0,toolChoice:void 0,toolWarnings:q};let K=[],z=new Map;for(let Y of U)if(z.set(Y.name,Y),Y.type==="provider")switch(Y.id){case"xai.web_search":{let X=await s({value:Y.args,schema:AJ});K.push({type:"web_search",allowed_domains:X.allowedDomains,excluded_domains:X.excludedDomains,enable_image_understanding:X.enableImageUnderstanding});break}case"xai.x_search":{let X=await s({value:Y.args,schema:zJ});K.push({type:"x_search",allowed_x_handles:X.allowedXHandles,excluded_x_handles:X.excludedXHandles,from_date:X.fromDate,to_date:X.toDate,enable_image_understanding:X.enableImageUnderstanding,enable_video_understanding:X.enableVideoUnderstanding});break}case"xai.code_execution":{K.push({type:"code_interpreter"});break}case"xai.view_image":{K.push({type:"view_image"});break}case"xai.view_x_video":{K.push({type:"view_x_video"});break}case"xai.file_search":{let X=await s({value:Y.args,schema:GJ});K.push({type:"file_search",vector_store_ids:X.vectorStoreIds,max_num_results:X.maxNumResults});break}case"xai.mcp":{let X=await s({value:Y.args,schema:YJ});K.push({type:"mcp",server_url:X.serverUrl,server_label:X.serverLabel,server_description:X.serverDescription,allowed_tools:X.allowedTools,headers:X.headers,authorization:X.authorization});break}default:{q.push({type:"unsupported",feature:`provider-defined tool ${Y.name}`});break}}else K.push({type:"function",name:Y.name,description:Y.description,parameters:Y.inputSchema,...Y.strict!=null?{strict:Y.strict}:{}});if(D==null)return{tools:K,toolChoice:void 0,toolWarnings:q};let A=D.type;switch(A){case"auto":case"none":return{tools:K,toolChoice:A,toolWarnings:q};case"required":return{tools:K,toolChoice:"required",toolWarnings:q};case"tool":{let Y=z.get(D.toolName);if(Y==null)return{tools:K,toolChoice:void 0,toolWarnings:q};if(Y.type==="provider")return q.push({type:"unsupported",feature:`toolChoice for server-side tool "${Y.name}"`}),{tools:K,toolChoice:void 0,toolWarnings:q};return{tools:K,toolChoice:{type:"function",name:Y.name},toolWarnings:q}}default:throw new c({functionality:`tool choice type: ${A}`})}}var MJ=class{constructor(J,D){this.specificationVersion="v3",this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=J,this.config=D}get provider(){return this.config.provider}async getArgs({prompt:J,maxOutputTokens:D,temperature:U,topP:q,stopSequences:K,seed:z,responseFormat:A,providerOptions:Y,tools:X,toolChoice:Z}){var V,P,F,B,R,N,$;let W=[],M=(V=await p({provider:"xai",providerOptions:Y,schema:oG}))!=null?V:{};if(K!=null)W.push({type:"unsupported",feature:"stopSequences"});let O=(P=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.web_search"))==null?void 0:P.name,C=(F=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.x_search"))==null?void 0:F.name,w=(B=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.code_execution"))==null?void 0:B.name,j=(R=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.mcp"))==null?void 0:R.name,y=(N=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.file_search"))==null?void 0:N.name,{input:S,inputWarnings:b}=await sG({prompt:J,store:!0});W.push(...b);let{tools:m,toolChoice:I,toolWarnings:E}=await HJ({tools:X,toolChoice:Z});W.push(...E);let f=M.include?[...M.include]:void 0;if(M.store===!1)if(f==null)f=["reasoning.encrypted_content"];else f=[...f,"reasoning.encrypted_content"];let H={model:this.modelId,input:S,logprobs:M.logprobs===!0||M.topLogprobs!=null?!0:void 0,top_logprobs:M.topLogprobs,max_output_tokens:D,temperature:U,top_p:q,seed:z,...(A==null?void 0:A.type)==="json"&&{text:{format:A.schema!=null?{type:"json_schema",strict:!0,name:($=A.name)!=null?$:"response",description:A.description,schema:A.schema}:{type:"json_object"}}},...M.reasoningEffort!=null&&{reasoning:{effort:M.reasoningEffort}},...M.store===!1&&{store:M.store},...f!=null&&{include:f},...M.previousResponseId!=null&&{previous_response_id:M.previousResponseId}};if(m&&m.length>0)H.tools=m;if(I!=null)H.tool_choice=I;return{args:H,warnings:W,webSearchToolName:O,xSearchToolName:C,codeExecutionToolName:w,mcpToolName:j,fileSearchToolName:y}}async doGenerate(J){var D,U,q,K,z,A,Y,X,Z,V,P,F,B;let{args:R,warnings:N,webSearchToolName:$,xSearchToolName:W,codeExecutionToolName:M,mcpToolName:O,fileSearchToolName:C}=await this.getArgs(J),{responseHeaders:w,value:j,rawValue:y}=await u({url:`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/responses`,headers:g(this.config.headers(),J.headers),body:R,failedResponseHandler:r,successfulResponseHandler:d(t),abortSignal:J.abortSignal,fetch:this.config.fetch}),S=[],b=!1,m=["web_search","web_search_with_snippets","browse_page"],I=["x_user_search","x_keyword_search","x_semantic_search","x_thread_fetch"];for(let E of j.output){if(E.type==="file_search_call"){let f=C!=null?C:"file_search";S.push({type:"tool-call",toolCallId:E.id,toolName:f,input:"",providerExecuted:!0}),S.push({type:"tool-result",toolCallId:E.id,toolName:f,result:{queries:(U=E.queries)!=null?U:[],results:(K=(q=E.results)==null?void 0:q.map((H)=>({fileId:H.file_id,filename:H.filename,score:H.score,text:H.text})))!=null?K:null}});continue}if(E.type==="web_search_call"||E.type==="x_search_call"||E.type==="code_interpreter_call"||E.type==="code_execution_call"||E.type==="view_image_call"||E.type==="view_x_video_call"||E.type==="custom_tool_call"||E.type==="mcp_call"){let f=(z=E.name)!=null?z:"";if(m.includes((A=E.name)!=null?A:"")||E.type==="web_search_call")f=$!=null?$:"web_search";else if(I.includes((Y=E.name)!=null?Y:"")||E.type==="x_search_call")f=W!=null?W:"x_search";else if(E.name==="code_execution"||E.type==="code_interpreter_call"||E.type==="code_execution_call")f=M!=null?M:"code_execution";else if(E.type==="mcp_call")f=(X=O!=null?O:E.name)!=null?X:"mcp";let H=E.type==="custom_tool_call"?(Z=E.input)!=null?Z:"":E.type==="mcp_call"?(V=E.arguments)!=null?V:"":(P=E.arguments)!=null?P:"";S.push({type:"tool-call",toolCallId:E.id,toolName:f,input:H,providerExecuted:!0});continue}switch(E.type){case"message":{for(let f of E.content){if(f.text)S.push({type:"text",text:f.text});if(f.annotations){for(let H of f.annotations)if(H.type==="url_citation"&&"url"in H)S.push({type:"source",sourceType:"url",id:this.config.generateId(),url:H.url,title:(F=H.title)!=null?F:H.url})}}break}case"function_call":{b=!0,S.push({type:"tool-call",toolCallId:E.call_id,toolName:E.name,input:E.arguments});break}case"reasoning":{let f=E.summary.map((H)=>H.text).filter((H)=>H&&H.length>0);if(f.length>0){let H=f.join("");if(E.encrypted_content||E.id)S.push({type:"reasoning",text:H,providerMetadata:{xai:{...E.encrypted_content&&{reasoningEncryptedContent:E.encrypted_content},...E.id&&{itemId:E.id}}}});else S.push({type:"reasoning",text:H})}break}default:break}}return{content:S,finishReason:{unified:b?"tool-calls":GG(j.status),raw:(B=j.status)!=null?B:void 0},usage:j.usage?ZG(j.usage):{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}},request:{body:R},response:{...QG(j),headers:w,body:y},warnings:N}}async doStream(J){var D;let{args:U,warnings:q,webSearchToolName:K,xSearchToolName:z,codeExecutionToolName:A,mcpToolName:Y,fileSearchToolName:X}=await this.getArgs(J),Z={...U,stream:!0},{responseHeaders:V,value:P}=await u({url:`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/responses`,headers:g(this.config.headers(),J.headers),body:Z,failedResponseHandler:r,successfulResponseHandler:YG(eG),abortSignal:J.abortSignal,fetch:this.config.fetch}),F={unified:"other",raw:void 0},B=!1,R=void 0,N=!0,$={},W=new Set,M={},O={},C=this;return{stream:P.pipeThrough(new TransformStream({start(w){w.enqueue({type:"stream-start",warnings:q})},transform(w,j){var y,S,b,m,I,E,f,H,x,zG,VG,LG,UG,HG,MG;if(J.includeRawChunks)j.enqueue({type:"raw",rawValue:w.rawValue});if(!w.success){j.enqueue({type:"error",error:w.error});return}let L=w.value;if(L.type==="response.created"||L.type==="response.in_progress"){if(N)j.enqueue({type:"response-metadata",...QG(L.response)}),N=!1;return}if(L.type==="response.reasoning_summary_part.added"){let Q=`reasoning-${L.item_id}`;O[L.item_id]={},j.enqueue({type:"reasoning-start",id:Q,providerMetadata:{xai:{itemId:L.item_id}}})}if(L.type==="response.reasoning_summary_text.delta"){let Q=`reasoning-${L.item_id}`;j.enqueue({type:"reasoning-delta",id:Q,delta:L.delta,providerMetadata:{xai:{itemId:L.item_id}}});return}if(L.type==="response.reasoning_summary_text.done")return;if(L.type==="response.reasoning_text.delta"){let Q=`reasoning-${L.item_id}`;if(O[L.item_id]==null)O[L.item_id]={},j.enqueue({type:"reasoning-start",id:Q,providerMetadata:{xai:{itemId:L.item_id}}});j.enqueue({type:"reasoning-delta",id:Q,delta:L.delta,providerMetadata:{xai:{itemId:L.item_id}}});return}if(L.type==="response.reasoning_text.done")return;if(L.type==="response.output_text.delta"){let Q=`text-${L.item_id}`;if($[Q]==null)$[Q]={type:"text"},j.enqueue({type:"text-start",id:Q});j.enqueue({type:"text-delta",id:Q,delta:L.delta});return}if(L.type==="response.output_text.done"){if(L.annotations){for(let Q of L.annotations)if(Q.type==="url_citation"&&"url"in Q)j.enqueue({type:"source",sourceType:"url",id:C.config.generateId(),url:Q.url,title:(y=Q.title)!=null?y:Q.url})}return}if(L.type==="response.output_text.annotation.added"){let Q=L.annotation;if(Q.type==="url_citation"&&"url"in Q)j.enqueue({type:"source",sourceType:"url",id:C.config.generateId(),url:Q.url,title:(S=Q.title)!=null?S:Q.url});return}if(L.type==="response.done"||L.type==="response.completed"||L.type==="response.incomplete"){let Q=L.response;if(Q.usage)R=ZG(Q.usage);if(L.type==="response.incomplete"){let T="incomplete_details"in Q?(b=Q.incomplete_details)==null?void 0:b.reason:void 0;F={unified:T?GG(T):"other",raw:T!=null?T:"incomplete"}}else if("status"in Q&&Q.status)F={unified:B?"tool-calls":GG(Q.status),raw:Q.status};return}if(L.type==="response.failed"){let Q=(m=L.response.incomplete_details)==null?void 0:m.reason;if(F={unified:Q?GG(Q):"error",raw:Q!=null?Q:"error"},L.response.usage)R=ZG(L.response.usage);return}if(L.type==="error"){j.enqueue({type:"error",error:L});return}if(L.type==="response.custom_tool_call_input.delta"||L.type==="response.custom_tool_call_input.done")return;if(L.type==="response.function_call_arguments.delta"){let Q=M[L.output_index];if(Q!=null)j.enqueue({type:"tool-input-delta",id:Q.toolCallId,delta:L.delta});return}if(L.type==="response.function_call_arguments.done")return;if(L.type==="response.output_item.added"||L.type==="response.output_item.done"){let Q=L.item;if(Q.type==="reasoning"){if(L.type==="response.output_item.done"){let T=`reasoning-${Q.id}`;if(!(Q.id in O))O[Q.id]={},j.enqueue({type:"reasoning-start",id:T,providerMetadata:{xai:{...Q.id&&{itemId:Q.id}}}});j.enqueue({type:"reasoning-end",id:T,providerMetadata:{xai:{...Q.encrypted_content&&{reasoningEncryptedContent:Q.encrypted_content},...Q.id&&{itemId:Q.id}}}}),delete O[Q.id]}return}if(Q.type==="file_search_call"){let T=X!=null?X:"file_search";if(!W.has(Q.id))W.add(Q.id),j.enqueue({type:"tool-input-start",id:Q.id,toolName:T}),j.enqueue({type:"tool-input-delta",id:Q.id,delta:""}),j.enqueue({type:"tool-input-end",id:Q.id}),j.enqueue({type:"tool-call",toolCallId:Q.id,toolName:T,input:"",providerExecuted:!0});if(L.type==="response.output_item.done")j.enqueue({type:"tool-result",toolCallId:Q.id,toolName:T,result:{queries:(I=Q.queries)!=null?I:[],results:(f=(E=Q.results)==null?void 0:E.map((h)=>({fileId:h.file_id,filename:h.filename,score:h.score,text:h.text})))!=null?f:null}});return}if(Q.type==="web_search_call"||Q.type==="x_search_call"||Q.type==="code_interpreter_call"||Q.type==="code_execution_call"||Q.type==="view_image_call"||Q.type==="view_x_video_call"||Q.type==="custom_tool_call"||Q.type==="mcp_call"){let T=["web_search","web_search_with_snippets","browse_page"],h=["x_user_search","x_keyword_search","x_semantic_search","x_thread_fetch"],n=(H=Q.name)!=null?H:"";if(T.includes((x=Q.name)!=null?x:"")||Q.type==="web_search_call")n=K!=null?K:"web_search";else if(h.includes((zG=Q.name)!=null?zG:"")||Q.type==="x_search_call")n=z!=null?z:"x_search";else if(Q.name==="code_execution"||Q.type==="code_interpreter_call"||Q.type==="code_execution_call")n=A!=null?A:"code_execution";else if(Q.type==="mcp_call")n=(VG=Y!=null?Y:Q.name)!=null?VG:"mcp";let EG=Q.type==="custom_tool_call"?(LG=Q.input)!=null?LG:"":Q.type==="mcp_call"?(UG=Q.arguments)!=null?UG:"":(HG=Q.arguments)!=null?HG:"";if((Q.type==="custom_tool_call"?L.type==="response.output_item.done":!W.has(Q.id))&&!W.has(Q.id))W.add(Q.id),j.enqueue({type:"tool-input-start",id:Q.id,toolName:n}),j.enqueue({type:"tool-input-delta",id:Q.id,delta:EG}),j.enqueue({type:"tool-input-end",id:Q.id}),j.enqueue({type:"tool-call",toolCallId:Q.id,toolName:n,input:EG,providerExecuted:!0});return}if(Q.type==="message")for(let T of Q.content){if(T.text&&T.text.length>0){let h=`text-${Q.id}`;if($[h]==null)$[h]={type:"text"},j.enqueue({type:"text-start",id:h}),j.enqueue({type:"text-delta",id:h,delta:T.text})}if(T.annotations){for(let h of T.annotations)if(h.type==="url_citation"&&"url"in h)j.enqueue({type:"source",sourceType:"url",id:C.config.generateId(),url:h.url,title:(MG=h.title)!=null?MG:h.url})}}else if(Q.type==="function_call"){if(L.type==="response.output_item.added")M[L.output_index]={toolName:Q.name,toolCallId:Q.call_id},j.enqueue({type:"tool-input-start",id:Q.call_id,toolName:Q.name});else if(L.type==="response.output_item.done")B=!0,M[L.output_index]=void 0,j.enqueue({type:"tool-input-end",id:Q.call_id}),j.enqueue({type:"tool-call",toolCallId:Q.call_id,toolName:Q.name,input:Q.arguments})}}},flush(w){for(let[j,y]of Object.entries($))if(y.type==="text")w.enqueue({type:"text-end",id:j});w.enqueue({type:"finish",finishReason:F,usage:R!=null?R:{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}}})}})),request:{body:Z},response:{headers:V}}}},EJ=G.object({output:G.string().describe("the output of the code execution"),error:G.string().optional().describe("any error that occurred")}),PJ=_({id:"xai.code_execution",inputSchema:G.object({}).describe("no input parameters"),outputSchema:EJ}),WJ=(J={})=>PJ(J),BJ=G.object({description:G.string().describe("description of the image"),objects:G.array(G.string()).optional().describe("objects detected in the image")}),FJ=_({id:"xai.view_image",inputSchema:G.object({}).describe("no input parameters"),outputSchema:BJ}),NJ=(J={})=>FJ(J),wJ=G.object({transcript:G.string().optional().describe("transcript of the video"),description:G.string().describe("description of the video content"),duration:G.number().optional().describe("duration in seconds")}),SJ=_({id:"xai.view_x_video",inputSchema:G.object({}).describe("no input parameters"),outputSchema:wJ}),OJ=(J={})=>SJ(J),fJ={codeExecution:WJ,fileSearch:XJ,mcpServer:KJ,viewImage:NJ,viewXVideo:OJ,webSearch:qJ,xSearch:UJ},CJ="3.0.82",a=G.string().min(1),yJ=G.enum(["480p","720p"]),IJ=G.enum(["edit-video","extend-video","reference-to-video"]),o={pollIntervalMs:G.number().positive().nullish(),pollTimeoutMs:G.number().positive().nullish(),resolution:yJ.nullish()},RJ=G.object({...o,mode:G.literal("edit-video"),videoUrl:a,referenceImageUrls:G.undefined().optional()}),xJ=G.object({...o,mode:G.literal("extend-video"),videoUrl:a,referenceImageUrls:G.undefined().optional()}),TJ=G.object({...o,mode:G.literal("reference-to-video"),referenceImageUrls:G.array(a).min(1).max(7),videoUrl:G.undefined().optional()}),vJ=G.object({...o,mode:G.undefined().optional(),videoUrl:a.optional(),referenceImageUrls:G.array(a).min(1).max(7).optional()}),IQ=G.union([RJ,xJ,TJ,vJ]),kJ=G.object({mode:IJ.optional(),videoUrl:a.optional(),referenceImageUrls:G.array(a).min(1).max(7).optional(),...o}).passthrough(),hJ=v(()=>k(kJ)),bJ={"1280x720":"720p","854x480":"480p","640x480":"480p"};function _J(J){if((J==null?void 0:J.mode)!=null)return J.mode;if((J==null?void 0:J.videoUrl)!=null)return"edit-video";if((J==null?void 0:J.referenceImageUrls)!=null&&J.referenceImageUrls.length>0)return"reference-to-video";return}var mJ=class{constructor(J,D){this.modelId=J,this.config=D,this.specificationVersion="v3",this.maxVideosPerCall=1}get provider(){return this.config.provider}async doGenerate(J){var D,U,q,K,z,A,Y,X,Z,V;let P=(q=(U=(D=this.config._internal)==null?void 0:D.currentDate)==null?void 0:U.call(D))!=null?q:new Date,F=[],B=await p({provider:"xai",providerOptions:J.providerOptions,schema:hJ}),R=_J(B),N=R==="edit-video",$=R==="extend-video",W=R==="reference-to-video";if(J.fps!=null)F.push({type:"unsupported",feature:"fps",details:"xAI video models do not support custom FPS."});if(J.seed!=null)F.push({type:"unsupported",feature:"seed",details:"xAI video models do not support seed."});if(J.n!=null&&J.n>1)F.push({type:"unsupported",feature:"n",details:"xAI video models do not support generating multiple videos per call. Only 1 video will be generated."});if(N&&J.duration!=null)F.push({type:"unsupported",feature:"duration",details:"xAI video editing does not support custom duration."});if(N&&J.aspectRatio!=null)F.push({type:"unsupported",feature:"aspectRatio",details:"xAI video editing does not support custom aspect ratio."});if(N&&((B==null?void 0:B.resolution)!=null||J.resolution!=null))F.push({type:"unsupported",feature:"resolution",details:"xAI video editing does not support custom resolution."});if($&&J.aspectRatio!=null)F.push({type:"unsupported",feature:"aspectRatio",details:"xAI video extension does not support custom aspect ratio."});if($&&((B==null?void 0:B.resolution)!=null||J.resolution!=null))F.push({type:"unsupported",feature:"resolution",details:"xAI video extension does not support custom resolution."});let M={model:this.modelId,prompt:J.prompt},O=!N,C=!N&&!$,w=!N&&!$;if(O&&J.duration!=null)M.duration=J.duration;if(C&&J.aspectRatio!=null)M.aspect_ratio=J.aspectRatio;if(w&&(B==null?void 0:B.resolution)!=null)M.resolution=B.resolution;else if(w&&J.resolution!=null){let H=bJ[J.resolution];if(H!=null)M.resolution=H;else F.push({type:"unsupported",feature:"resolution",details:`Unrecognized resolution "${J.resolution}". Use providerOptions.xai.resolution with "480p" or "720p" instead.`})}if(N)M.video={url:B.videoUrl};if($)M.video={url:B.videoUrl};if(J.image!=null)if(J.image.type==="url")M.image={url:J.image.url};else{let H=typeof J.image.data==="string"?J.image.data:wG(J.image.data);M.image={url:`data:${J.image.mediaType};base64,${H}`}}if(W)M.reference_images=B.referenceImageUrls.map((H)=>({url:H}));if(B!=null){for(let[H,x]of Object.entries(B))if(!["mode","pollIntervalMs","pollTimeoutMs","resolution","videoUrl","referenceImageUrls"].includes(H))M[H]=x}let j=(K=this.config.baseURL)!=null?K:"https://api.x.ai/v1",y;if(N)y=`${j}/videos/edits`;else if($)y=`${j}/videos/extensions`;else y=`${j}/videos/generations`;let{value:S}=await u({url:y,headers:g(this.config.headers(),J.headers),body:M,failedResponseHandler:r,successfulResponseHandler:d(gJ),abortSignal:J.abortSignal,fetch:this.config.fetch}),b=S.request_id;if(!b)throw new l({name:"XAI_VIDEO_GENERATION_ERROR",message:`No request_id returned from xAI API. Response: ${JSON.stringify(S)}`});let m=(z=B==null?void 0:B.pollIntervalMs)!=null?z:5000,I=(A=B==null?void 0:B.pollTimeoutMs)!=null?A:600000,E=Date.now(),f;while(!0){if(await FG(m,{abortSignal:J.abortSignal}),Date.now()-E>I)throw new l({name:"XAI_VIDEO_GENERATION_TIMEOUT",message:`Video generation timed out after ${I}ms`});let{value:H,responseHeaders:x}=await XG({url:`${j}/videos/${b}`,headers:g(this.config.headers(),J.headers),successfulResponseHandler:d(uJ),failedResponseHandler:r,abortSignal:J.abortSignal,fetch:this.config.fetch});if(f=x,H.status==="done"||H.status==null&&((Y=H.video)==null?void 0:Y.url)){if(((X=H.video)==null?void 0:X.respect_moderation)===!1)throw new l({name:"XAI_VIDEO_MODERATION_ERROR",message:"Video generation was blocked due to a content policy violation."});if(!((Z=H.video)==null?void 0:Z.url))throw new l({name:"XAI_VIDEO_GENERATION_ERROR",message:"Video generation completed but no video URL was returned."});return{videos:[{type:"url",url:H.video.url,mediaType:"video/mp4"}],warnings:F,response:{timestamp:P,modelId:this.modelId,headers:f},providerMetadata:{xai:{requestId:b,videoUrl:H.video.url,...H.video.duration!=null?{duration:H.video.duration}:{},...((V=H.usage)==null?void 0:V.cost_in_usd_ticks)!=null?{costInUsdTicks:H.usage.cost_in_usd_ticks}:{},...H.progress!=null?{progress:H.progress}:{}}}}}if(H.status==="expired")throw new l({name:"XAI_VIDEO_GENERATION_EXPIRED",message:"Video generation request expired."});if(H.status==="failed")throw new l({name:"XAI_VIDEO_GENERATION_FAILED",message:"Video generation failed."})}}},gJ=G.object({request_id:G.string().nullish()}),uJ=G.object({status:G.string().nullish(),video:G.object({url:G.string(),duration:G.number().nullish(),respect_moderation:G.boolean().nullish()}).nullish(),model:G.string().nullish(),usage:G.object({cost_in_usd_ticks:G.number().nullish()}).nullish(),progress:G.number().nullish(),error:G.object({code:G.string().nullish(),message:G.string().nullish()}).nullish()});function dJ(J={}){var D;let U=xG((D=J.baseURL)!=null?D:"https://api.x.ai/v1"),q=()=>OG({Authorization:`Bearer ${fG({apiKey:J.apiKey,environmentVariableName:"XAI_API_KEY",description:"xAI API key"})}`,...J.headers},`ai-sdk/xai/${CJ}`),K=(Z)=>{return new cG(Z,{provider:"xai.chat",baseURL:U,headers:q,generateId:$G,fetch:J.fetch})},z=(Z)=>{return new MJ(Z,{provider:"xai.responses",baseURL:U,headers:q,generateId:$G,fetch:J.fetch})},A=(Z)=>{return new aG(Z,{provider:"xai.image",baseURL:U,headers:q,fetch:J.fetch})},Y=(Z)=>{return new mJ(Z,{provider:"xai.video",baseURL:U,headers:q,fetch:J.fetch})},X=(Z)=>K(Z);return X.specificationVersion="v3",X.languageModel=K,X.chat=K,X.responses=z,X.embeddingModel=(Z)=>{throw new BG({modelId:Z,modelType:"embeddingModel"})},X.textEmbeddingModel=X.embeddingModel,X.imageModel=A,X.image=A,X.videoModel=Y,X.video=Y,X.tools=fJ,X}var RQ=dJ();export{fJ as xaiTools,RQ as xai,UJ as xSearch,qJ as webSearch,OJ as viewXVideo,NJ as viewImage,KJ as mcpServer,dJ as createXai,WJ as codeExecution,CJ as VERSION};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{qg as N}from"./chunk-nc44rvs7.js";import{zg as T}from"./chunk-spb3tm25.js";import{Rg as A}from"./chunk-e8j03wnd.js";import{$g as a}from"./chunk-3dq7hfxc.js";import{ah as V}from"./chunk-zaj612bw.js";import{RF as M}from"./chunk-8j3aw4qg.js";var ms=M((e)=>{var L=A(),h=T(),Z=V(),_=a(),k=N(),G=(s)=>L.HttpResponse.isInstance(s)?s.headers?.date??s.headers?.Date:void 0,Q=(s)=>new Date(Date.now()+s),O=(s,d)=>Math.abs(Q(d).getTime()-s)>=300000,Y=(s,d)=>{let t=Date.parse(s);if(O(t,d))return t-Date.now();return d},$=(s,d)=>{if(!d)throw Error(`Property \`${s}\` is not resolved for AWS SDK SigV4Auth`);return d},X=async(s)=>{let d=$("context",s.context),t=$("config",s.config),u=d.endpointV2?.properties?.authSchemes?.[0],l=await $("signer",t.signer)(u),w=s?.signingRegion,b=s?.signingRegionSet,W=s?.signingName;return{config:t,signer:l,signingRegion:w,signingRegionSet:b,signingName:W}};class K{async sign(s,d,t){if(!L.HttpRequest.isInstance(s))throw Error("The request is not an instance of `HttpRequest` and cannot be signed");let u=await X(t),{config:j,signer:l}=u,{signingRegion:w,signingName:b}=u,W=t.context;if(W?.authSchemes?.length??!1){let[x,y]=W.authSchemes;if(x?.name==="sigv4a"&&y?.name==="sigv4")w=y?.signingRegion??w,b=y?.signingName??b}return await l.sign(s,{signingDate:Q(j.systemClockOffset),signingRegion:w,signingService:b})}errorHandler(s){return(d)=>{let t=d.ServerTime??G(d.$response);if(t){let u=$("config",s.config),j=u.systemClockOffset;if(u.systemClockOffset=Y(t,u.systemClockOffset),u.systemClockOffset!==j&&d.$metadata)d.$metadata.clockSkewCorrected=!0}throw d}}successHandler(s,d){let t=G(s);if(t){let u=$("config",d.config);u.systemClockOffset=Y(t,u.systemClockOffset)}}}var E=K;class U extends K{async sign(s,d,t){if(!L.HttpRequest.isInstance(s))throw Error("The request is not an instance of `HttpRequest` and cannot be signed");let{config:u,signer:j,signingRegion:l,signingRegionSet:w,signingName:b}=await X(t),m=(await u.sigv4aSigningRegionSet?.()??w??[l]).join(",");return await j.sign(s,{signingDate:Q(u.systemClockOffset),signingRegion:m,signingService:b})}}var q=(s)=>typeof s==="string"&&s.length>0?s.split(",").map((d)=>d.trim()):[],p=(s)=>`AWS_BEARER_TOKEN_${s.replace(/[\s-]/g,"_").toUpperCase()}`,D="AWS_AUTH_SCHEME_PREFERENCE",F="auth_scheme_preference",R={environmentVariableSelector:(s,d)=>{if(d?.signingName){if(p(d.signingName)in s)return["httpBearerAuth"]}if(!(D in s))return;return q(s[D])},configFileSelector:(s)=>{if(!(F in s))return;return q(s[F])},default:[]},C=(s)=>{return s.sigv4aSigningRegionSet=h.normalizeProvider(s.sigv4aSigningRegionSet),s},v={environmentVariableSelector(s){if(s.AWS_SIGV4A_SIGNING_REGION_SET)return s.AWS_SIGV4A_SIGNING_REGION_SET.split(",").map((d)=>d.trim());throw new Z.ProviderError("AWS_SIGV4A_SIGNING_REGION_SET not set in env.",{tryNextLink:!0})},configFileSelector(s){if(s.sigv4a_signing_region_set)return(s.sigv4a_signing_region_set??"").split(",").map((d)=>d.trim());throw new Z.ProviderError("sigv4a_signing_region_set not set in profile.",{tryNextLink:!0})},default:void 0},H=(s)=>{let d=s.credentials,t=!!s.credentials,u=void 0;Object.defineProperty(s,"credentials",{set(m){if(m&&m!==d&&m!==u)t=!0;d=m;let x=P(s,{credentials:d,credentialDefaultProvider:s.credentialDefaultProvider}),y=o(s,x);if(t&&!y.attributed){let J=typeof d==="object"&&d!==null;u=async(z)=>{let B=await y(z);if(J&&(!B.$source||Object.keys(B.$source).length===0))return _.setCredentialFeature(B,"CREDENTIALS_CODE","e");return B},u.memoized=y.memoized,u.configBound=y.configBound,u.attributed=!0}else u=y},get(){return u},enumerable:!0,configurable:!0}),s.credentials=d;let{signingEscapePath:j=!0,systemClockOffset:l=s.systemClockOffset||0,sha256:w}=s,b;if(s.signer)b=h.normalizeProvider(s.signer);else if(s.regionInfoProvider)b=()=>h.normalizeProvider(s.region)().then(async(m)=>[await s.regionInfoProvider(m,{useFipsEndpoint:await s.useFipsEndpoint(),useDualstackEndpoint:await s.useDualstackEndpoint()})||{},m]).then(([m,x])=>{let{signingRegion:y,signingService:J}=m;s.signingRegion=s.signingRegion||y||x,s.signingName=s.signingName||J||s.serviceId;let z={...s,credentials:s.credentials,region:s.signingRegion,service:s.signingName,sha256:w,uriEscapePath:j};return new(s.signerConstructor||k.SignatureV4)(z)});else b=async(m)=>{m=Object.assign({},{name:"sigv4",signingName:s.signingName||s.defaultSigningName,signingRegion:await h.normalizeProvider(s.region)(),properties:{}},m);let{signingRegion:x,signingName:y}=m;s.signingRegion=s.signingRegion||x,s.signingName=s.signingName||y||s.serviceId;let J={...s,credentials:s.credentials,region:s.signingRegion,service:s.signingName,sha256:w,uriEscapePath:j};return new(s.signerConstructor||k.SignatureV4)(J)};return Object.assign(s,{systemClockOffset:l,signingEscapePath:j,signer:b})},S=H;function P(s,{credentials:d,credentialDefaultProvider:t}){let u;if(d)if(!d?.memoized)u=h.memoizeIdentityProvider(d,h.isIdentityExpired,h.doesIdentityRequireRefresh);else u=d;else if(t)u=h.normalizeProvider(t(Object.assign({},s,{parentClientConfig:s})));else u=async()=>{throw Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")};return u.memoized=!0,u}function o(s,d){if(d.configBound)return d;let t=async(u)=>d({...u,callerClientConfig:s});return t.memoized=d.memoized,t.configBound=!0,t}e.AWSSDKSigV4Signer=E;e.AwsSdkSigV4ASigner=U;e.AwsSdkSigV4Signer=K;e.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS=R;e.NODE_SIGV4A_CONFIG_OPTIONS=v;e.getBearerTokenEnvKey=p;e.resolveAWSSDKSigV4Config=S;e.resolveAwsSdkSigV4AConfig=C;e.resolveAwsSdkSigV4Config=H;e.validateSigningProperties=X});var bs=M((ws,ys)=>{ys.exports={name:"@aws-sdk/nested-clients",version:"3.996.19",description:"Nested clients for AWS SDK packages.",main:"./dist-cjs/index.js",module:"./dist-es/index.js",types:"./dist-types/index.d.ts",scripts:{build:"yarn lint && concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline nested-clients","build:es":"tsc -p tsconfig.es.json","build:include:deps":'yarn g:turbo run build -F="$npm_package_name"',"build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",lint:"node ../../scripts/validation/submodules-linter.js --pkg nested-clients",test:"yarn g:vitest run","test:watch":"yarn g:vitest watch"},engines:{node:">=20.0.0"},sideEffects:!1,author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",dependencies:{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"^3.973.27","@aws-sdk/middleware-host-header":"^3.972.9","@aws-sdk/middleware-logger":"^3.972.9","@aws-sdk/middleware-recursion-detection":"^3.972.10","@aws-sdk/middleware-user-agent":"^3.972.29","@aws-sdk/region-config-resolver":"^3.972.11","@aws-sdk/types":"^3.973.7","@aws-sdk/util-endpoints":"^3.996.6","@aws-sdk/util-user-agent-browser":"^3.972.9","@aws-sdk/util-user-agent-node":"^3.973.15","@smithy/config-resolver":"^4.4.14","@smithy/core":"^3.23.14","@smithy/fetch-http-handler":"^5.3.16","@smithy/hash-node":"^4.2.13","@smithy/invalid-dependency":"^4.2.13","@smithy/middleware-content-length":"^4.2.13","@smithy/middleware-endpoint":"^4.4.29","@smithy/middleware-retry":"^4.5.0","@smithy/middleware-serde":"^4.2.17","@smithy/middleware-stack":"^4.2.13","@smithy/node-config-provider":"^4.3.13","@smithy/node-http-handler":"^4.5.2","@smithy/protocol-http":"^5.3.13","@smithy/smithy-client":"^4.12.9","@smithy/types":"^4.14.0","@smithy/url-parser":"^4.2.13","@smithy/util-base64":"^4.3.2","@smithy/util-body-length-browser":"^4.2.2","@smithy/util-body-length-node":"^4.2.3","@smithy/util-defaults-mode-browser":"^4.3.45","@smithy/util-defaults-mode-node":"^4.2.49","@smithy/util-endpoints":"^3.3.4","@smithy/util-middleware":"^4.2.13","@smithy/util-retry":"^4.3.0","@smithy/util-utf8":"^4.2.2",tslib:"^2.6.2"},devDependencies:{concurrently:"7.0.0","downlevel-dts":"0.10.1",premove:"4.0.0",typescript:"~5.8.3"},typesVersions:{"<4.5":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["./cognito-identity.d.ts","./cognito-identity.js","./signin.d.ts","./signin.js","./sso-oidc.d.ts","./sso-oidc.js","./sso.d.ts","./sso.js","./sts.d.ts","./sts.js","dist-*/**"],browser:{"./dist-es/submodules/cognito-identity/runtimeConfig":"./dist-es/submodules/cognito-identity/runtimeConfig.browser","./dist-es/submodules/signin/runtimeConfig":"./dist-es/submodules/signin/runtimeConfig.browser","./dist-es/submodules/sso-oidc/runtimeConfig":"./dist-es/submodules/sso-oidc/runtimeConfig.browser","./dist-es/submodules/sso/runtimeConfig":"./dist-es/submodules/sso/runtimeConfig.browser","./dist-es/submodules/sts/runtimeConfig":"./dist-es/submodules/sts/runtimeConfig.browser"},"react-native":{},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/packages/nested-clients",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"packages/nested-clients"},exports:{"./package.json":"./package.json","./sso-oidc":{types:"./dist-types/submodules/sso-oidc/index.d.ts",module:"./dist-es/submodules/sso-oidc/index.js",node:"./dist-cjs/submodules/sso-oidc/index.js",import:"./dist-es/submodules/sso-oidc/index.js",require:"./dist-cjs/submodules/sso-oidc/index.js"},"./sts":{types:"./dist-types/submodules/sts/index.d.ts",module:"./dist-es/submodules/sts/index.js",node:"./dist-cjs/submodules/sts/index.js",import:"./dist-es/submodules/sts/index.js",require:"./dist-cjs/submodules/sts/index.js"},"./signin":{types:"./dist-types/submodules/signin/index.d.ts",module:"./dist-es/submodules/signin/index.js",node:"./dist-cjs/submodules/signin/index.js",import:"./dist-es/submodules/signin/index.js",require:"./dist-cjs/submodules/signin/index.js"},"./cognito-identity":{types:"./dist-types/submodules/cognito-identity/index.d.ts",module:"./dist-es/submodules/cognito-identity/index.js",node:"./dist-cjs/submodules/cognito-identity/index.js",import:"./dist-es/submodules/cognito-identity/index.js",require:"./dist-cjs/submodules/cognito-identity/index.js"},"./sso":{types:"./dist-types/submodules/sso/index.d.ts",module:"./dist-es/submodules/sso/index.js",node:"./dist-cjs/submodules/sso/index.js",import:"./dist-es/submodules/sso/index.js",require:"./dist-cjs/submodules/sso/index.js"}}}});
|
|
3
|
+
export{ms as fg,bs as gg};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{SF as c}from"./chunk-8j3aw4qg.js";var s={};c(s,{truncateMiddle:()=>h,truncateLeft:()=>m,truncate:()=>d,todayTimeOrDateTime:()=>u,titlecase:()=>l,time:()=>i,pluralize:()=>x,number:()=>f,duration:()=>g,datetime:()=>a,Locale:()=>s});function l(e){return e.replace(/\b\w/g,(t)=>t.toUpperCase())}function i(e){return new Date(e).toLocaleTimeString(void 0,{timeStyle:"short"})}function a(e){let t=new Date(e),r=i(e),n=t.toLocaleDateString();return`${r} \xB7 ${n}`}function u(e){let t=new Date(e),r=new Date;if(t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()&&t.getDate()===r.getDate())return i(e);else return a(e)}function f(e){if(e>=1e6)return(e/1e6).toFixed(1)+"M";else if(e>=1000)return(e/1000).toFixed(1)+"K";return e.toString()}function g(e){if(e<1000)return`${e}ms`;if(e<60000)return`${(e/1000).toFixed(1)}s`;if(e<3600000){let n=Math.floor(e/60000),o=Math.floor(e%60000/1000);return`${n}m ${o}s`}if(e<86400000){let n=Math.floor(e/3600000),o=Math.floor(e%3600000/60000);return`${n}h ${o}m`}let t=Math.floor(e/3600000);return`${Math.floor(e%3600000/86400000)}d ${t}h`}function d(e,t){if(e.length<=t)return e;return e.slice(0,t-1)+"\u2026"}function m(e,t){if(e.length<=t)return e;return"\u2026"+e.slice(-(t-1))}function h(e,t=35){if(e.length<=t)return e;let r="\u2026",n=Math.ceil((t-r.length)/2),o=Math.floor((t-r.length)/2);return e.slice(0,n)+r+e.slice(-o)}function x(e,t,r){return(e===1?t:r).replace("{}",e.toString())}
|
|
3
|
+
export{l as vj,f as wj,g as xj,d as yj,h as zj,s as Aj};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{nv as E}from"./chunk-1e73ypg5.js";import{PF as D}from"./chunk-9g64kggy.js";import{RF as B,UF as C}from"./chunk-8j3aw4qg.js";var J=B((v)=>{Object.defineProperty(v,"__esModule",{value:!0});v.getMachineId=void 0;var q=C("process"),F=E(),G=D();async function H(){let b="%windir%\\System32\\REG.exe";if(q.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in q.env)b="%windir%\\sysnative\\cmd.exe /c "+b;try{let k=(await(0,F.execAsync)(`${b} QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid`)).stdout.split("REG_SZ");if(k.length===2)return k[1].trim()}catch(f){G.diag.debug(`error reading machine id: ${f}`)}return}v.getMachineId=H});export default J();
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Fg as a}from"./chunk-6skbzman.js";import"./chunk-npr41z9a.js";import"./chunk-e8j03wnd.js";import"./chunk-wk11yy8h.js";import"./chunk-rkf9ynkx.js";import"./chunk-3dq7hfxc.js";import"./chunk-zaj612bw.js";import"./chunk-zjpnyah2.js";import"./chunk-0hqmdrjr.js";import"./chunk-8j3aw4qg.js";export{a as fromHttp};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{MF as NQ}from"./chunk-z3mx7n44.js";import{NF as gJ,OF as w}from"./chunk-0qqpjj2h.js";import{PF as D}from"./chunk-9g64kggy.js";import{RF as Y}from"./chunk-8j3aw4qg.js";var qq=Y((t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.ExceptionEventName=void 0;t.ExceptionEventName="exception"});var Zq=Y((Qq)=>{Object.defineProperty(Qq,"__esModule",{value:!0});Qq.SpanImpl=void 0;var G=D(),K=w(),O=gJ(),xJ=qq();class Jq{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:G.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(q){let J=Date.now();if(this._spanContext=q.spanContext,this._performanceStartTime=K.otperformance.now(),this._performanceOffset=J-(this._performanceStartTime+K.otperformance.timeOrigin),this._startTimeProvided=q.startTime!=null,this._spanLimits=q.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=q.spanProcessor,this.name=q.name,this.parentSpanContext=q.parentSpanContext,this.kind=q.kind,q.links)for(let Q of q.links)this.addLink(Q);if(this.startTime=this._getTime(q.startTime??J),this.resource=q.resource,this.instrumentationScope=q.scope,this._recordEndMetrics=q.recordEndMetrics,q.attributes!=null)this.setAttributes(q.attributes);this._spanProcessor.onStart(this,q.context)}spanContext(){return this._spanContext}setAttribute(q,J){if(J==null||this._isSpanEnded())return this;if(q.length===0)return G.diag.warn(`Invalid attribute key: ${q}`),this;if(!(0,K.isAttributeValue)(J))return G.diag.warn(`Invalid attribute value set for key: ${q}`),this;let{attributeCountLimit:Q}=this._spanLimits,X=!Object.prototype.hasOwnProperty.call(this.attributes,q);if(Q!==void 0&&this._attributesCount>=Q&&X)return this._droppedAttributesCount++,this;if(this.attributes[q]=this._truncateToSize(J),X)this._attributesCount++;return this}setAttributes(q){for(let J in q)if(Object.prototype.hasOwnProperty.call(q,J))this.setAttribute(J,q[J]);return this}addEvent(q,J,Q){if(this._isSpanEnded())return this;let{eventCountLimit:X}=this._spanLimits;if(X===0)return G.diag.warn("No events allowed."),this._droppedEventsCount++,this;if(X!==void 0&&this.events.length>=X){if(this._droppedEventsCount===0)G.diag.debug("Dropping extra events.");this.events.shift(),this._droppedEventsCount++}if((0,K.isTimeInput)(J)){if(!(0,K.isTimeInput)(Q))Q=J;J=void 0}let Z=(0,K.sanitizeAttributes)(J),{attributePerEventCountLimit:W}=this._spanLimits,$={},N=0,H=0;for(let U in Z){if(!Object.prototype.hasOwnProperty.call(Z,U))continue;let I=Z[U];if(W!==void 0&&H>=W){N++;continue}$[U]=this._truncateToSize(I),H++}return this.events.push({name:q,attributes:$,time:this._getTime(Q),droppedAttributesCount:N}),this}addLink(q){if(this._isSpanEnded())return this;let{linkCountLimit:J}=this._spanLimits;if(J===0)return this._droppedLinksCount++,this;if(J!==void 0&&this.links.length>=J){if(this._droppedLinksCount===0)G.diag.debug("Dropping extra links.");this.links.shift(),this._droppedLinksCount++}let{attributePerLinkCountLimit:Q}=this._spanLimits,X=(0,K.sanitizeAttributes)(q.attributes),Z={},W=0,$=0;for(let H in X){if(!Object.prototype.hasOwnProperty.call(X,H))continue;let U=X[H];if(Q!==void 0&&$>=Q){W++;continue}Z[H]=this._truncateToSize(U),$++}let N={context:q.context};if($>0)N.attributes=Z;if(W>0)N.droppedAttributesCount=W;return this.links.push(N),this}addLinks(q){for(let J of q)this.addLink(J);return this}setStatus(q){if(this._isSpanEnded())return this;if(q.code===G.SpanStatusCode.UNSET)return this;if(this.status.code===G.SpanStatusCode.OK)return this;let J={code:q.code};if(q.code===G.SpanStatusCode.ERROR){if(typeof q.message==="string")J.message=q.message;else if(q.message!=null)G.diag.warn(`Dropping invalid status.message of type '${typeof q.message}', expected 'string'`)}return this.status=J,this}updateName(q){if(this._isSpanEnded())return this;return this.name=q,this}end(q){if(this._isSpanEnded()){G.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}if(this.endTime=this._getTime(q),this._duration=(0,K.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0)G.diag.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0];if(this._droppedEventsCount>0)G.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`);if(this._droppedLinksCount>0)G.diag.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`);if(this._spanProcessor.onEnding)this._spanProcessor.onEnding(this);this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(q){if(typeof q==="number"&&q<=K.otperformance.now())return(0,K.hrTime)(q+this._performanceOffset);if(typeof q==="number")return(0,K.millisToHrTime)(q);if(q instanceof Date)return(0,K.millisToHrTime)(q.getTime());if((0,K.isTimeInputHrTime)(q))return q;if(this._startTimeProvided)return(0,K.millisToHrTime)(Date.now());let J=K.otperformance.now()-this._performanceStartTime;return(0,K.addHrTimes)(this.startTime,(0,K.millisToHrTime)(J))}isRecording(){return this._ended===!1}recordException(q,J){let Q={};if(typeof q==="string")Q[O.ATTR_EXCEPTION_MESSAGE]=q;else if(q){if(q.code)Q[O.ATTR_EXCEPTION_TYPE]=q.code.toString();else if(q.name)Q[O.ATTR_EXCEPTION_TYPE]=q.name;if(q.message)Q[O.ATTR_EXCEPTION_MESSAGE]=q.message;if(q.stack)Q[O.ATTR_EXCEPTION_STACKTRACE]=q.stack}if(Q[O.ATTR_EXCEPTION_TYPE]||Q[O.ATTR_EXCEPTION_MESSAGE])this.addEvent(xJ.ExceptionEventName,Q,J);else G.diag.warn(`Failed to record an exception ${q}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let q=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);G.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,q)}return this._ended}_truncateToLimitUtil(q,J){if(q.length<=J)return q;return q.substring(0,J)}_truncateToSize(q){let J=this._attributeValueLengthLimit;if(J<=0)return G.diag.warn(`Attribute value limit must be positive, got ${J}`),q;if(typeof q==="string")return this._truncateToLimitUtil(q,J);if(Array.isArray(q))return q.map((Q)=>typeof Q==="string"?this._truncateToLimitUtil(Q,J):Q);return q}}Qq.SpanImpl=Jq});var E=Y(($q)=>{Object.defineProperty($q,"__esModule",{value:!0});$q.SamplingDecision=void 0;var _J;(function(q){q[q.NOT_RECORD=0]="NOT_RECORD",q[q.RECORD=1]="RECORD",q[q.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(_J=$q.SamplingDecision||($q.SamplingDecision={}))});var R=Y((Yq)=>{Object.defineProperty(Yq,"__esModule",{value:!0});Yq.AlwaysOffSampler=void 0;var SJ=E();class Wq{shouldSample(){return{decision:SJ.SamplingDecision.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}Yq.AlwaysOffSampler=Wq});var F=Y((Gq)=>{Object.defineProperty(Gq,"__esModule",{value:!0});Gq.AlwaysOnSampler=void 0;var uJ=E();class zq{shouldSample(){return{decision:uJ.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}Gq.AlwaysOnSampler=zq});var m=Y((wq)=>{Object.defineProperty(wq,"__esModule",{value:!0});wq.ParentBasedSampler=void 0;var T=D(),mJ=w(),Nq=R(),u=F();class Vq{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(q){if(this._root=q.root,!this._root)(0,mJ.globalErrorHandler)(Error("ParentBasedSampler must have a root sampler configured")),this._root=new u.AlwaysOnSampler;this._remoteParentSampled=q.remoteParentSampled??new u.AlwaysOnSampler,this._remoteParentNotSampled=q.remoteParentNotSampled??new Nq.AlwaysOffSampler,this._localParentSampled=q.localParentSampled??new u.AlwaysOnSampler,this._localParentNotSampled=q.localParentNotSampled??new Nq.AlwaysOffSampler}shouldSample(q,J,Q,X,Z,W){let $=T.trace.getSpanContext(q);if(!$||!(0,T.isSpanContextValid)($))return this._root.shouldSample(q,J,Q,X,Z,W);if($.isRemote){if($.traceFlags&T.TraceFlags.SAMPLED)return this._remoteParentSampled.shouldSample(q,J,Q,X,Z,W);return this._remoteParentNotSampled.shouldSample(q,J,Q,X,Z,W)}if($.traceFlags&T.TraceFlags.SAMPLED)return this._localParentSampled.shouldSample(q,J,Q,X,Z,W);return this._localParentNotSampled.shouldSample(q,J,Q,X,Z,W)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}wq.ParentBasedSampler=Vq});var l=Y((Mq)=>{Object.defineProperty(Mq,"__esModule",{value:!0});Mq.TraceIdRatioBasedSampler=void 0;var lJ=D(),hq=E();class jq{_ratio;_upperBound;constructor(q=0){this._ratio=this._normalize(q),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(q,J){return{decision:(0,lJ.isValidTraceId)(J)&&this._accumulate(J)<this._upperBound?hq.SamplingDecision.RECORD_AND_SAMPLED:hq.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(q){if(typeof q!=="number"||isNaN(q))return 0;return q>=1?1:q<=0?0:q}_accumulate(q){let J=0;for(let Q=0;Q<q.length/8;Q++){let X=Q*8,Z=parseInt(q.slice(X,X+8),16);J=(J^Z)>>>0}return J}}Mq.TraceIdRatioBasedSampler=jq});var p=Y((Aq)=>{Object.defineProperty(Aq,"__esModule",{value:!0});Aq.buildSamplerFromEnv=Aq.loadDefaultConfig=void 0;var i=D(),h=w(),Dq=R(),c=F(),y=m(),Eq=l(),j;(function(q){q.AlwaysOff="always_off",q.AlwaysOn="always_on",q.ParentBasedAlwaysOff="parentbased_always_off",q.ParentBasedAlwaysOn="parentbased_always_on",q.ParentBasedTraceIdRatio="parentbased_traceidratio",q.TraceIdRatio="traceidratio"})(j||(j={}));var C=1;function cJ(){return{sampler:Lq(),forceFlushTimeoutMillis:30000,generalLimits:{attributeValueLengthLimit:(0,h.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,h.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128},spanLimits:{attributeValueLengthLimit:(0,h.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,h.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??128,linkCountLimit:(0,h.getNumberFromEnv)("OTEL_SPAN_LINK_COUNT_LIMIT")??128,eventCountLimit:(0,h.getNumberFromEnv)("OTEL_SPAN_EVENT_COUNT_LIMIT")??128,attributePerEventCountLimit:(0,h.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT")??128,attributePerLinkCountLimit:(0,h.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT")??128}}}Aq.loadDefaultConfig=cJ;function Lq(){let q=(0,h.getStringFromEnv)("OTEL_TRACES_SAMPLER")??j.ParentBasedAlwaysOn;switch(q){case j.AlwaysOn:return new c.AlwaysOnSampler;case j.AlwaysOff:return new Dq.AlwaysOffSampler;case j.ParentBasedAlwaysOn:return new y.ParentBasedSampler({root:new c.AlwaysOnSampler});case j.ParentBasedAlwaysOff:return new y.ParentBasedSampler({root:new Dq.AlwaysOffSampler});case j.TraceIdRatio:return new Eq.TraceIdRatioBasedSampler(Bq());case j.ParentBasedTraceIdRatio:return new y.ParentBasedSampler({root:new Eq.TraceIdRatioBasedSampler(Bq())});default:return i.diag.error(`OTEL_TRACES_SAMPLER value "${q}" invalid, defaulting to "${j.ParentBasedAlwaysOn}".`),new y.ParentBasedSampler({root:new c.AlwaysOnSampler})}}Aq.buildSamplerFromEnv=Lq;function Bq(){let q=(0,h.getNumberFromEnv)("OTEL_TRACES_SAMPLER_ARG");if(q==null)return i.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${C}.`),C;if(q<0||q>1)return i.diag.error(`OTEL_TRACES_SAMPLER_ARG=${q} was given, but it is out of range ([0..1]), defaulting to ${C}.`),C;return q}});var n=Y((Pq)=>{Object.defineProperty(Pq,"__esModule",{value:!0});Pq.reconfigureLimits=Pq.mergeConfig=Pq.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=Pq.DEFAULT_ATTRIBUTE_COUNT_LIMIT=void 0;var Iq=p(),b=w();Pq.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128;Pq.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function pJ(q){let J={sampler:(0,Iq.buildSamplerFromEnv)()},Q=(0,Iq.loadDefaultConfig)(),X=Object.assign({},Q,J,q);return X.generalLimits=Object.assign({},Q.generalLimits,q.generalLimits||{}),X.spanLimits=Object.assign({},Q.spanLimits,q.spanLimits||{}),X}Pq.mergeConfig=pJ;function nJ(q){let J=Object.assign({},q.spanLimits);return J.attributeCountLimit=q.spanLimits?.attributeCountLimit??q.generalLimits?.attributeCountLimit??(0,b.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??(0,b.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??Pq.DEFAULT_ATTRIBUTE_COUNT_LIMIT,J.attributeValueLengthLimit=q.spanLimits?.attributeValueLengthLimit??q.generalLimits?.attributeValueLengthLimit??(0,b.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,b.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??Pq.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},q,{spanLimits:J})}Pq.reconfigureLimits=nJ});var vq=Y((Cq)=>{Object.defineProperty(Cq,"__esModule",{value:!0});Cq.BatchSpanProcessorBase=void 0;var B=D(),M=w();class yq{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(q,J){if(this._exporter=q,this._maxExportBatchSize=typeof J?.maxExportBatchSize==="number"?J.maxExportBatchSize:(0,M.getNumberFromEnv)("OTEL_BSP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=typeof J?.maxQueueSize==="number"?J.maxQueueSize:(0,M.getNumberFromEnv)("OTEL_BSP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=typeof J?.scheduledDelayMillis==="number"?J.scheduledDelayMillis:(0,M.getNumberFromEnv)("OTEL_BSP_SCHEDULE_DELAY")??5000,this._exportTimeoutMillis=typeof J?.exportTimeoutMillis==="number"?J.exportTimeoutMillis:(0,M.getNumberFromEnv)("OTEL_BSP_EXPORT_TIMEOUT")??30000,this._shutdownOnce=new M.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize)B.diag.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize}forceFlush(){if(this._shutdownOnce.isCalled)return this._shutdownOnce.promise;return this._flushAll()}onStart(q,J){}onEnd(q){if(this._shutdownOnce.isCalled)return;if((q.spanContext().traceFlags&B.TraceFlags.SAMPLED)===0)return;this._addToBuffer(q)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>{return this.onShutdown()}).then(()=>{return this._flushAll()}).then(()=>{return this._exporter.shutdown()})}_addToBuffer(q){if(this._finishedSpans.length>=this._maxQueueSize){if(this._droppedSpansCount===0)B.diag.debug("maxQueueSize reached, dropping spans");this._droppedSpansCount++;return}if(this._droppedSpansCount>0)B.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0;this._finishedSpans.push(q),this._maybeStartTimer()}_flushAll(){return new Promise((q,J)=>{let Q=[],X=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let Z=0,W=X;Z<W;Z++)Q.push(this._flushOneBatch());Promise.all(Q).then(()=>{q()}).catch(J)})}_flushOneBatch(){if(this._clearTimer(),this._finishedSpans.length===0)return Promise.resolve();return new Promise((q,J)=>{let Q=setTimeout(()=>{J(Error("Timeout"))},this._exportTimeoutMillis);B.context.with((0,M.suppressTracing)(B.context.active()),()=>{let X;if(this._finishedSpans.length<=this._maxExportBatchSize)X=this._finishedSpans,this._finishedSpans=[];else X=this._finishedSpans.splice(0,this._maxExportBatchSize);let Z=()=>this._exporter.export(X,($)=>{if(clearTimeout(Q),$.code===M.ExportResultCode.SUCCESS)q();else J($.error??Error("BatchSpanProcessor: span export failed"))}),W=null;for(let $=0,N=X.length;$<N;$++){let H=X[$];if(H.resource.asyncAttributesPending&&H.resource.waitForAsyncAttributes)W??=[],W.push(H.resource.waitForAsyncAttributes())}if(W===null)Z();else Promise.all(W).then(Z,($)=>{(0,M.globalErrorHandler)($),J($)})})})}_maybeStartTimer(){if(this._isExporting)return;let q=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{if(this._isExporting=!1,this._finishedSpans.length>0)this._clearTimer(),this._maybeStartTimer()}).catch((J)=>{this._isExporting=!1,(0,M.globalErrorHandler)(J)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return q();if(this._timer!==void 0)return;if(this._timer=setTimeout(()=>q(),this._scheduledDelayMillis),typeof this._timer!=="number")this._timer.unref()}_clearTimer(){if(this._timer!==void 0)clearTimeout(this._timer),this._timer=void 0}}Cq.BatchSpanProcessorBase=yq});var xq=Y((dq)=>{Object.defineProperty(dq,"__esModule",{value:!0});dq.BatchSpanProcessor=void 0;var sJ=vq();class fq extends sJ.BatchSpanProcessorBase{onShutdown(){}}dq.BatchSpanProcessor=fq});var cq=Y((mq)=>{Object.defineProperty(mq,"__esModule",{value:!0});mq.RandomIdGenerator=void 0;var rJ=8,Sq=16;class uq{generateTraceId=_q(Sq);generateSpanId=_q(rJ)}mq.RandomIdGenerator=uq;var v=Buffer.allocUnsafe(Sq);function _q(q){return function(){for(let Q=0;Q<q/4;Q++)v.writeUInt32BE(Math.random()*4294967296>>>0,Q*4);for(let Q=0;Q<q;Q++)if(v[Q]>0)break;else if(Q===q-1)v[q-1]=1;return v.toString("hex",0,q)}}});var iq=Y((f)=>{Object.defineProperty(f,"__esModule",{value:!0});f.RandomIdGenerator=f.BatchSpanProcessor=void 0;var aJ=xq();Object.defineProperty(f,"BatchSpanProcessor",{enumerable:!0,get:function(){return aJ.BatchSpanProcessor}});var tJ=cq();Object.defineProperty(f,"RandomIdGenerator",{enumerable:!0,get:function(){return tJ.RandomIdGenerator}})});var o=Y((d)=>{Object.defineProperty(d,"__esModule",{value:!0});d.RandomIdGenerator=d.BatchSpanProcessor=void 0;var pq=iq();Object.defineProperty(d,"BatchSpanProcessor",{enumerable:!0,get:function(){return pq.BatchSpanProcessor}});Object.defineProperty(d,"RandomIdGenerator",{enumerable:!0,get:function(){return pq.RandomIdGenerator}})});var sq=Y((nq)=>{Object.defineProperty(nq,"__esModule",{value:!0});nq.METRIC_OTEL_SDK_SPAN_STARTED=nq.METRIC_OTEL_SDK_SPAN_LIVE=nq.ATTR_OTEL_SPAN_SAMPLING_RESULT=nq.ATTR_OTEL_SPAN_PARENT_ORIGIN=void 0;nq.ATTR_OTEL_SPAN_PARENT_ORIGIN="otel.span.parent.origin";nq.ATTR_OTEL_SPAN_SAMPLING_RESULT="otel.span.sampling_result";nq.METRIC_OTEL_SDK_SPAN_LIVE="otel.sdk.span.live";nq.METRIC_OTEL_SDK_SPAN_STARTED="otel.sdk.span.started"});var eq=Y((aq)=>{Object.defineProperty(aq,"__esModule",{value:!0});aq.TracerMetrics=void 0;var g=E(),k=sq();class rq{startedSpans;liveSpans;constructor(q){this.startedSpans=q.createCounter(k.METRIC_OTEL_SDK_SPAN_STARTED,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=q.createUpDownCounter(k.METRIC_OTEL_SDK_SPAN_LIVE,{unit:"{span}",description:"The number of currently live spans."})}startSpan(q,J){let Q=$Q(J);if(this.startedSpans.add(1,{[k.ATTR_OTEL_SPAN_PARENT_ORIGIN]:ZQ(q),[k.ATTR_OTEL_SPAN_SAMPLING_RESULT]:Q}),J===g.SamplingDecision.NOT_RECORD)return()=>{};let X={[k.ATTR_OTEL_SPAN_SAMPLING_RESULT]:Q};return this.liveSpans.add(1,X),()=>{this.liveSpans.add(-1,X)}}}aq.TracerMetrics=rq;function ZQ(q){if(!q)return"none";if(q.isRemote)return"remote";return"local"}function $Q(q){switch(q){case g.SamplingDecision.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case g.SamplingDecision.RECORD:return"RECORD_ONLY";case g.SamplingDecision.NOT_RECORD:return"DROP"}}});var QJ=Y((qJ)=>{Object.defineProperty(qJ,"__esModule",{value:!0});qJ.VERSION=void 0;qJ.VERSION="2.6.1"});var WJ=Y((ZJ)=>{Object.defineProperty(ZJ,"__esModule",{value:!0});ZJ.Tracer=void 0;var z=D(),x=w(),WQ=Zq(),YQ=n(),HQ=o(),zQ=eq(),GQ=QJ();class XJ{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(q,J,Q,X){let Z=(0,YQ.mergeConfig)(J);this._sampler=Z.sampler,this._generalLimits=Z.generalLimits,this._spanLimits=Z.spanLimits,this._idGenerator=J.idGenerator||new HQ.RandomIdGenerator,this._resource=Q,this._spanProcessor=X,this.instrumentationScope=q;let W=Z.meterProvider?Z.meterProvider.getMeter("@opentelemetry/sdk-trace",GQ.VERSION):z.createNoopMeter();this._tracerMetrics=new zQ.TracerMetrics(W)}startSpan(q,J={},Q=z.context.active()){if(J.root)Q=z.trace.deleteSpan(Q);let X=z.trace.getSpan(Q);if((0,x.isTracingSuppressed)(Q))return z.diag.debug("Instrumentation suppressed, returning Noop Span"),z.trace.wrapSpanContext(z.INVALID_SPAN_CONTEXT);let Z=X?.spanContext(),W=this._idGenerator.generateSpanId(),$,N,H;if(!Z||!z.trace.isSpanContextValid(Z))N=this._idGenerator.generateTraceId();else N=Z.traceId,H=Z.traceState,$=Z;let U=J.kind??z.SpanKind.INTERNAL,I=(J.links??[]).map((P)=>{return{context:P.context,attributes:(0,x.sanitizeAttributes)(P.attributes)}}),r=(0,x.sanitizeAttributes)(J.attributes),A=this._sampler.shouldSample(Q,N,q,U,r,I),vJ=this._tracerMetrics.startSpan(Z,A.decision);H=A.traceState??H;let fJ=A.decision===z.SamplingDecision.RECORD_AND_SAMPLED?z.TraceFlags.SAMPLED:z.TraceFlags.NONE,a={traceId:N,spanId:W,traceFlags:fJ,traceState:H};if(A.decision===z.SamplingDecision.NOT_RECORD)return z.diag.debug("Recording is off, propagating context in a non-recording span"),z.trace.wrapSpanContext(a);let dJ=(0,x.sanitizeAttributes)(Object.assign(r,A.attributes));return new WQ.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:Q,spanContext:a,name:q,kind:U,links:I,parentSpanContext:$,attributes:dJ,startTime:J.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:vJ})}startActiveSpan(q,J,Q,X){let Z,W,$;if(arguments.length<2)return;else if(arguments.length===2)$=J;else if(arguments.length===3)Z=J,$=Q;else Z=J,W=Q,$=X;let N=W??z.context.active(),H=this.startSpan(q,Z,N),U=z.trace.setSpan(N,H);return z.context.with(U,$,void 0,H)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}ZJ.Tracer=XJ});var GJ=Y((HJ)=>{Object.defineProperty(HJ,"__esModule",{value:!0});HJ.MultiSpanProcessor=void 0;var KQ=w();class YJ{_spanProcessors;constructor(q){this._spanProcessors=q}forceFlush(){let q=[];for(let J of this._spanProcessors)q.push(J.forceFlush());return new Promise((J)=>{Promise.all(q).then(()=>{J()}).catch((Q)=>{(0,KQ.globalErrorHandler)(Q||Error("MultiSpanProcessor: forceFlush failed")),J()})})}onStart(q,J){for(let Q of this._spanProcessors)Q.onStart(q,J)}onEnding(q){for(let J of this._spanProcessors)if(J.onEnding)J.onEnding(q)}onEnd(q){for(let J of this._spanProcessors)J.onEnd(q)}shutdown(){let q=[];for(let J of this._spanProcessors)q.push(J.shutdown());return new Promise((J,Q)=>{Promise.all(q).then(()=>{J()},Q)})}}HJ.MultiSpanProcessor=YJ});var UJ=Y((VJ)=>{Object.defineProperty(VJ,"__esModule",{value:!0});VJ.BasicTracerProvider=VJ.ForceFlushState=void 0;var VQ=w(),wQ=NQ(),UQ=WJ(),hQ=p(),jQ=GJ(),MQ=n(),L;(function(q){q[q.resolved=0]="resolved",q[q.timeout=1]="timeout",q[q.error=2]="error",q[q.unresolved=3]="unresolved"})(L=VJ.ForceFlushState||(VJ.ForceFlushState={}));class NJ{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(q={}){let J=(0,VQ.merge)({},(0,hQ.loadDefaultConfig)(),(0,MQ.reconfigureLimits)(q));this._resource=J.resource??(0,wQ.defaultResource)(),this._config=Object.assign({},J,{resource:this._resource});let Q=[];if(q.spanProcessors?.length)Q.push(...q.spanProcessors);this._activeSpanProcessor=new jQ.MultiSpanProcessor(Q)}getTracer(q,J,Q){let X=`${q}@${J||""}:${Q?.schemaUrl||""}`;if(!this._tracers.has(X))this._tracers.set(X,new UQ.Tracer({name:q,version:J,schemaUrl:Q?.schemaUrl},this._config,this._resource,this._activeSpanProcessor));return this._tracers.get(X)}forceFlush(){let q=this._config.forceFlushTimeoutMillis,J=this._activeSpanProcessor._spanProcessors.map((Q)=>{return new Promise((X)=>{let Z,W=setTimeout(()=>{X(Error(`Span processor did not completed within timeout period of ${q} ms`)),Z=L.timeout},q);Q.forceFlush().then(()=>{if(clearTimeout(W),Z!==L.timeout)Z=L.resolved,X(Z)}).catch(($)=>{clearTimeout(W),Z=L.error,X($)})})});return new Promise((Q,X)=>{Promise.all(J).then((Z)=>{let W=Z.filter(($)=>$!==L.resolved);if(W.length>0)X(W);else Q()}).catch((Z)=>X([Z]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}VJ.BasicTracerProvider=NJ});var OJ=Y((jJ)=>{Object.defineProperty(jJ,"__esModule",{value:!0});jJ.ConsoleSpanExporter=void 0;var s=w();class hJ{export(q,J){return this._sendSpans(q,J)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(q){return{resource:{attributes:q.resource.attributes},instrumentationScope:q.instrumentationScope,traceId:q.spanContext().traceId,parentSpanContext:q.parentSpanContext,traceState:q.spanContext().traceState?.serialize(),name:q.name,id:q.spanContext().spanId,kind:q.kind,timestamp:(0,s.hrTimeToMicroseconds)(q.startTime),duration:(0,s.hrTimeToMicroseconds)(q.duration),attributes:q.attributes,status:q.status,events:q.events,links:q.links}}_sendSpans(q,J){for(let Q of q)console.dir(this._exportInfo(Q),{depth:3});if(J)return J({code:s.ExportResultCode.SUCCESS})}}jJ.ConsoleSpanExporter=hJ});var AJ=Y((BJ)=>{Object.defineProperty(BJ,"__esModule",{value:!0});BJ.InMemorySpanExporter=void 0;var DJ=w();class EJ{_finishedSpans=[];_stopped=!1;export(q,J){if(this._stopped)return J({code:DJ.ExportResultCode.FAILED,error:Error("Exporter has been stopped")});this._finishedSpans.push(...q),setTimeout(()=>J({code:DJ.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}BJ.InMemorySpanExporter=EJ});var RJ=Y((IJ)=>{Object.defineProperty(IJ,"__esModule",{value:!0});IJ.SimpleSpanProcessor=void 0;var OQ=D(),_=w();class kJ{_exporter;_shutdownOnce;_pendingExports;constructor(q){this._exporter=q,this._shutdownOnce=new _.BindOnceFuture(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){if(await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush)await this._exporter.forceFlush()}onStart(q,J){}onEnd(q){if(this._shutdownOnce.isCalled)return;if((q.spanContext().traceFlags&OQ.TraceFlags.SAMPLED)===0)return;let J=this._doExport(q).catch((Q)=>(0,_.globalErrorHandler)(Q));this._pendingExports.add(J),J.finally(()=>this._pendingExports.delete(J))}async _doExport(q){if(q.resource.asyncAttributesPending)await q.resource.waitForAsyncAttributes?.();let J=await _.internal._export(this._exporter,[q]);if(J.code!==_.ExportResultCode.SUCCESS)throw J.error??Error(`SimpleSpanProcessor: span export failed (status ${J})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}IJ.SimpleSpanProcessor=kJ});var CJ=Y((TJ)=>{Object.defineProperty(TJ,"__esModule",{value:!0});TJ.NoopSpanProcessor=void 0;class FJ{onStart(q,J){}onEnd(q){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}TJ.NoopSpanProcessor=FJ});var yQ=Y((V)=>{Object.defineProperty(V,"__esModule",{value:!0});V.SamplingDecision=V.TraceIdRatioBasedSampler=V.ParentBasedSampler=V.AlwaysOnSampler=V.AlwaysOffSampler=V.NoopSpanProcessor=V.SimpleSpanProcessor=V.InMemorySpanExporter=V.ConsoleSpanExporter=V.RandomIdGenerator=V.BatchSpanProcessor=V.BasicTracerProvider=void 0;var DQ=UJ();Object.defineProperty(V,"BasicTracerProvider",{enumerable:!0,get:function(){return DQ.BasicTracerProvider}});var bJ=o();Object.defineProperty(V,"BatchSpanProcessor",{enumerable:!0,get:function(){return bJ.BatchSpanProcessor}});Object.defineProperty(V,"RandomIdGenerator",{enumerable:!0,get:function(){return bJ.RandomIdGenerator}});var EQ=OJ();Object.defineProperty(V,"ConsoleSpanExporter",{enumerable:!0,get:function(){return EQ.ConsoleSpanExporter}});var BQ=AJ();Object.defineProperty(V,"InMemorySpanExporter",{enumerable:!0,get:function(){return BQ.InMemorySpanExporter}});var LQ=RJ();Object.defineProperty(V,"SimpleSpanProcessor",{enumerable:!0,get:function(){return LQ.SimpleSpanProcessor}});var AQ=CJ();Object.defineProperty(V,"NoopSpanProcessor",{enumerable:!0,get:function(){return AQ.NoopSpanProcessor}});var kQ=R();Object.defineProperty(V,"AlwaysOffSampler",{enumerable:!0,get:function(){return kQ.AlwaysOffSampler}});var IQ=F();Object.defineProperty(V,"AlwaysOnSampler",{enumerable:!0,get:function(){return IQ.AlwaysOnSampler}});var PQ=m();Object.defineProperty(V,"ParentBasedSampler",{enumerable:!0,get:function(){return PQ.ParentBasedSampler}});var RQ=l();Object.defineProperty(V,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return RQ.TraceIdRatioBasedSampler}});var FQ=E();Object.defineProperty(V,"SamplingDecision",{enumerable:!0,get:function(){return FQ.SamplingDecision}})});
|
|
3
|
+
export{yQ as ov};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Tg as re}from"./chunk-rkf9ynkx.js";import{RF as _,UF as a}from"./chunk-8j3aw4qg.js";var I=_((b)=>{Object.defineProperty(b,"__esModule",{value:!0});b.getHomeDir=void 0;var W=a("os"),V=a("path"),x={},G=()=>{if(process&&process.geteuid)return`${process.geteuid()}`;return"DEFAULT"},U=()=>{let{HOME:e,USERPROFILE:t,HOMEPATH:r,HOMEDRIVE:o=`C:${V.sep}`}=process.env;if(e)return e;if(t)return t;if(r)return`${o}${r}`;let i=G();if(!x[i])x[i]=(0,W.homedir)();return x[i]};b.getHomeDir=U});var P=_((j)=>{Object.defineProperty(j,"__esModule",{value:!0});j.getSSOTokenFilepath=void 0;var X=a("crypto"),B=a("path"),J=I(),z=(e)=>{let r=(0,X.createHash)("sha1").update(e).digest("hex");return(0,B.join)((0,J.getHomeDir)(),".aws","sso","cache",`${r}.json`)};j.getSSOTokenFilepath=z});var R=_((C)=>{Object.defineProperty(C,"__esModule",{value:!0});C.getSSOTokenFromFile=C.tokenIntercept=void 0;var Q=a("fs/promises"),Y=P();C.tokenIntercept={};var Z=async(e)=>{if(C.tokenIntercept[e])return C.tokenIntercept[e];let t=(0,Y.getSSOTokenFilepath)(e),r=await(0,Q.readFile)(t,"utf8");return JSON.parse(r)};C.getSSOTokenFromFile=Z});var k=_((L)=>{Object.defineProperty(L,"__esModule",{value:!0});L.readFile=L.fileIntercept=L.filePromises=void 0;var ee=a("fs/promises");L.filePromises={};L.fileIntercept={};var te=(e,t)=>{if(L.fileIntercept[e]!==void 0)return L.fileIntercept[e];if(!L.filePromises[e]||t?.ignoreCache)L.filePromises[e]=(0,ee.readFile)(e,"utf8");return L.filePromises[e]};L.readFile=te});var ye=_((c)=>{var l=I(),O=P(),y=R(),g=a("path"),S=re(),f=k(),q="AWS_PROFILE",$="default",oe=(e)=>e.profile||process.env[q]||$,p=".",ie=(e)=>Object.entries(e).filter(([t])=>{let r=t.indexOf(p);if(r===-1)return!1;return Object.values(S.IniSectionType).includes(t.substring(0,r))}).reduce((t,[r,o])=>{let i=r.indexOf(p),n=r.substring(0,i)===S.IniSectionType.PROFILE?r.substring(i+1):r;return t[n]=o,t},{...e.default&&{default:e.default}}),ne="AWS_CONFIG_FILE",M=()=>process.env[ne]||g.join(l.getHomeDir(),".aws","config"),se="AWS_SHARED_CREDENTIALS_FILE",ce=()=>process.env[se]||g.join(l.getHomeDir(),".aws","credentials"),ae=/^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/,le=["__proto__","profile __proto__"],T=(e)=>{let t={},r,o;for(let i of e.split(/\r?\n/)){let n=i.split(/(^|\s)[;#]/)[0].trim();if(n[0]==="["&&n[n.length-1]==="]"){r=void 0,o=void 0;let s=n.substring(1,n.length-1),u=ae.exec(s);if(u){let[,d,,m]=u;if(Object.values(S.IniSectionType).includes(d))r=[d,m].join(p)}else r=s;if(le.includes(s))throw Error(`Found invalid profile name "${s}"`)}else if(r){let s=n.indexOf("=");if(![0,-1].includes(s)){let[u,d]=[n.substring(0,s).trim(),n.substring(s+1).trim()];if(d==="")o=u;else{if(o&&i.trimStart()===i)o=void 0;t[r]=t[r]||{};let m=o?[o,u].join(p):u;t[r][m]=d}}}}return t},A=()=>({}),K=async(e={})=>{let{filepath:t=ce(),configFilepath:r=M()}=e,o=l.getHomeDir(),i="~/",n=t;if(t.startsWith("~/"))n=g.join(o,t.slice(2));let h=r;if(r.startsWith("~/"))h=g.join(o,r.slice(2));let s=await Promise.all([f.readFile(h,{ignoreCache:e.ignoreCache}).then(T).then(ie).catch(A),f.readFile(n,{ignoreCache:e.ignoreCache}).then(T).catch(A)]);return{configFile:s[0],credentialsFile:s[1]}},pe=(e)=>Object.entries(e).filter(([t])=>t.startsWith(S.IniSectionType.SSO_SESSION+p)).reduce((t,[r,o])=>({...t,[r.substring(r.indexOf(p)+1)]:o}),{}),ue=()=>({}),fe=async(e={})=>f.readFile(e.configFilepath??M()).then(T).then(pe).catch(ue),de=(...e)=>{let t={};for(let r of e)for(let[o,i]of Object.entries(r))if(t[o]!==void 0)Object.assign(t[o],i);else t[o]=i;return t},_e=async(e)=>{let t=await K(e);return de(t.configFile,t.credentialsFile)},Fe={getFileRecord(){return f.fileIntercept},interceptFile(e,t){f.fileIntercept[e]=Promise.resolve(t)},getTokenRecord(){return y.tokenIntercept},interceptToken(e,t){y.tokenIntercept[e]=t}};c.getSSOTokenFromFile=y.getSSOTokenFromFile;c.readFile=f.readFile;c.CONFIG_PREFIX_SEPARATOR=p;c.DEFAULT_PROFILE=$;c.ENV_PROFILE=q;c.externalDataInterceptor=Fe;c.getProfileName=oe;c.loadSharedConfigFiles=K;c.loadSsoSessionData=fe;c.parseKnownFiles=_e;Object.prototype.hasOwnProperty.call(l,"__proto__")&&!Object.prototype.hasOwnProperty.call(c,"__proto__")&&Object.defineProperty(c,"__proto__",{enumerable:!0,value:l.__proto__});Object.keys(l).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(c,e))c[e]=l[e]});Object.prototype.hasOwnProperty.call(O,"__proto__")&&!Object.prototype.hasOwnProperty.call(c,"__proto__")&&Object.defineProperty(c,"__proto__",{enumerable:!0,value:O.__proto__});Object.keys(O).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(c,e))c[e]=O[e]})});
|
|
3
|
+
export{ye as Eg};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ji as i}from"./chunk-qvh8ghjw.js";import{RF as P,UF as C}from"./chunk-8j3aw4qg.js";var h=P((V)=>{var s=V&&V.__createBinding||(Object.create?function(w,z,G,J){if(J===void 0)J=G;var K=Object.getOwnPropertyDescriptor(z,G);if(!K||("get"in K?!z.__esModule:K.writable||K.configurable))K={enumerable:!0,get:function(){return z[G]}};Object.defineProperty(w,J,K)}:function(w,z,G,J){if(J===void 0)J=G;w[J]=z[G]}),t=V&&V.__setModuleDefault||(Object.create?function(w,z){Object.defineProperty(w,"default",{enumerable:!0,value:z})}:function(w,z){w.default=z}),g=V&&V.__importStar||function(w){if(w&&w.__esModule)return w;var z={};if(w!=null){for(var G in w)if(G!=="default"&&Object.prototype.hasOwnProperty.call(w,G))s(z,w,G)}return t(z,w),z};Object.defineProperty(V,"__esModule",{value:!0});V.req=V.json=V.toBuffer=void 0;var o=g(C("http")),e=g(C("https"));async function b(w){let z=0,G=[];for await(let J of w)z+=J.length,G.push(J);return Buffer.concat(G,z)}V.toBuffer=b;async function ww(w){let G=(await b(w)).toString("utf8");try{return JSON.parse(G)}catch(J){let K=J;throw K.message+=` (input: ${G})`,K}}V.json=ww;function zw(w,z={}){let J=((typeof w==="string"?w:w.href).startsWith("https:")?e:o).request(w,z),K=new Promise((X,Q)=>{J.once("response",X).once("error",Q).end()});return J.then=K.then.bind(K),J}V.req=zw});var u=P((W)=>{var _=W&&W.__createBinding||(Object.create?function(w,z,G,J){if(J===void 0)J=G;var K=Object.getOwnPropertyDescriptor(z,G);if(!K||("get"in K?!z.__esModule:K.writable||K.configurable))K={enumerable:!0,get:function(){return z[G]}};Object.defineProperty(w,J,K)}:function(w,z,G,J){if(J===void 0)J=G;w[J]=z[G]}),Gw=W&&W.__setModuleDefault||(Object.create?function(w,z){Object.defineProperty(w,"default",{enumerable:!0,value:z})}:function(w,z){w.default=z}),l=W&&W.__importStar||function(w){if(w&&w.__esModule)return w;var z={};if(w!=null){for(var G in w)if(G!=="default"&&Object.prototype.hasOwnProperty.call(w,G))_(z,w,G)}return Gw(z,w),z},Jw=W&&W.__exportStar||function(w,z){for(var G in w)if(G!=="default"&&!Object.prototype.hasOwnProperty.call(z,G))_(z,w,G)};Object.defineProperty(W,"__esModule",{value:!0});W.Agent=void 0;var Kw=l(C("net")),f=l(C("http")),Qw=C("https");Jw(h(),W);var F=Symbol("AgentBaseInternalState");class x extends f.Agent{constructor(w){super(w);this[F]={}}isSecureEndpoint(w){if(w){if(typeof w.secureEndpoint==="boolean")return w.secureEndpoint;if(typeof w.protocol==="string")return w.protocol==="https:"}let{stack:z}=Error();if(typeof z!=="string")return!1;return z.split(`
|
|
3
|
+
`).some((G)=>G.indexOf("(https.js:")!==-1||G.indexOf("node:https:")!==-1)}incrementSockets(w){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;if(!this.sockets[w])this.sockets[w]=[];let z=new Kw.Socket({writable:!1});return this.sockets[w].push(z),this.totalSocketCount++,z}decrementSockets(w,z){if(!this.sockets[w]||z===null)return;let G=this.sockets[w],J=G.indexOf(z);if(J!==-1){if(G.splice(J,1),this.totalSocketCount--,G.length===0)delete this.sockets[w]}}getName(w){if(this.isSecureEndpoint(w))return Qw.Agent.prototype.getName.call(this,w);return super.getName(w)}createSocket(w,z,G){let J={...z,secureEndpoint:this.isSecureEndpoint(z)},K=this.getName(J),X=this.incrementSockets(K);Promise.resolve().then(()=>this.connect(w,J)).then((Q)=>{if(this.decrementSockets(K,X),Q instanceof f.Agent)try{return Q.addRequest(w,J)}catch(U){return G(U)}this[F].currentSocket=Q,super.createSocket(w,z,G)},(Q)=>{this.decrementSockets(K,X),G(Q)})}createConnection(){let w=this[F].currentSocket;if(this[F].currentSocket=void 0,!w)throw Error("No socket was returned in the `connect()` function");return w}get defaultPort(){return this[F].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(w){if(this[F])this[F].defaultPort=w}get protocol(){return this[F].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(w){if(this[F])this[F].protocol=w}}W.Agent=x});var a=P((B)=>{var Vw=B&&B.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(B,"__esModule",{value:!0});B.parseProxyResponse=void 0;var Ww=Vw(i()),T=(0,Ww.default)("https-proxy-agent:parse-proxy-response");function Xw(w){return new Promise((z,G)=>{let J=0,K=[];function X(){let $=w.read();if($)S($);else w.once("readable",X)}function Q(){w.removeListener("end",U),w.removeListener("error",O),w.removeListener("readable",X)}function U(){Q(),T("onend"),G(Error("Proxy connection ended before receiving CONNECT response"))}function O($){Q(),T("onerror %o",$),G($)}function S($){K.push($),J+=$.length;let Y=Buffer.concat(K,J),N=Y.indexOf(`\r
|
|
4
|
+
\r
|
|
5
|
+
`);if(N===-1){T("have not received end of HTTP headers yet..."),X();return}let v=Y.slice(0,N).toString("ascii").split(`\r
|
|
6
|
+
`),A=v.shift();if(!A)return w.destroy(),G(Error("No header received from proxy CONNECT response"));let y=A.split(" "),p=+y[1],r=y.slice(2).join(" "),D={};for(let M of v){if(!M)continue;let R=M.indexOf(":");if(R===-1)return w.destroy(),G(Error(`Invalid header from proxy CONNECT response: "${M}"`));let q=M.slice(0,R).toLowerCase(),j=M.slice(R+1).trimStart(),E=D[q];if(typeof E==="string")D[q]=[E,j];else if(Array.isArray(E))E.push(j);else D[q]=j}T("got proxy server response: %o %o",A,D),Q(),z({connect:{statusCode:p,statusText:r,headers:D},buffered:Y})}w.on("error",O),w.on("end",U),X()})}B.parseProxyResponse=Xw});var Dw=P((Z)=>{var Yw=Z&&Z.__createBinding||(Object.create?function(w,z,G,J){if(J===void 0)J=G;var K=Object.getOwnPropertyDescriptor(z,G);if(!K||("get"in K?!z.__esModule:K.writable||K.configurable))K={enumerable:!0,get:function(){return z[G]}};Object.defineProperty(w,J,K)}:function(w,z,G,J){if(J===void 0)J=G;w[J]=z[G]}),Zw=Z&&Z.__setModuleDefault||(Object.create?function(w,z){Object.defineProperty(w,"default",{enumerable:!0,value:z})}:function(w,z){w.default=z}),d=Z&&Z.__importStar||function(w){if(w&&w.__esModule)return w;var z={};if(w!=null){for(var G in w)if(G!=="default"&&Object.prototype.hasOwnProperty.call(w,G))Yw(z,w,G)}return Zw(z,w),z},k=Z&&Z.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(Z,"__esModule",{value:!0});Z.HttpsProxyAgent=void 0;var I=d(C("net")),c=d(C("tls")),$w=k(C("assert")),Fw=k(i()),Cw=u(),Uw=C("url"),Ow=a(),H=(0,Fw.default)("https-proxy-agent"),m=(w)=>{if(w.servername===void 0&&w.host&&!I.isIP(w.host))return{...w,servername:w.host};return w};class L extends Cw.Agent{constructor(w,z){super(z);this.options={path:void 0},this.proxy=typeof w==="string"?new Uw.URL(w):w,this.proxyHeaders=z?.headers??{},H("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let G=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),J=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...z?n(z,"headers"):null,host:G,port:J}}async connect(w,z){let{proxy:G}=this;if(!z.host)throw TypeError('No "host" provided');let J;if(G.protocol==="https:")H("Creating `tls.Socket`: %o",this.connectOpts),J=c.connect(m(this.connectOpts));else H("Creating `net.Socket`: %o",this.connectOpts),J=I.connect(this.connectOpts);let K=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders},X=I.isIPv6(z.host)?`[${z.host}]`:z.host,Q=`CONNECT ${X}:${z.port} HTTP/1.1\r
|
|
7
|
+
`;if(G.username||G.password){let Y=`${decodeURIComponent(G.username)}:${decodeURIComponent(G.password)}`;K["Proxy-Authorization"]=`Basic ${Buffer.from(Y).toString("base64")}`}if(K.Host=`${X}:${z.port}`,!K["Proxy-Connection"])K["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close";for(let Y of Object.keys(K))Q+=`${Y}: ${K[Y]}\r
|
|
8
|
+
`;let U=(0,Ow.parseProxyResponse)(J);J.write(`${Q}\r
|
|
9
|
+
`);let{connect:O,buffered:S}=await U;if(w.emit("proxyConnect",O),this.emit("proxyConnect",O,w),O.statusCode===200){if(w.once("socket",Bw),z.secureEndpoint)return H("Upgrading socket connection to TLS"),c.connect({...n(m(z),"host","path","port"),socket:J});return J}J.destroy();let $=new I.Socket({writable:!1});return $.readable=!0,w.once("socket",(Y)=>{H("Replaying proxy buffer for failed request"),(0,$w.default)(Y.listenerCount("data")>0),Y.push(S),Y.push(null)}),$}}L.protocols=["http","https"];Z.HttpsProxyAgent=L;function Bw(w){w.resume()}function n(w,...z){let G={},J;for(J in w)if(!z.includes(J))G[J]=w[J];return G}});
|
|
10
|
+
export{u as Hi,Dw as Ii};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{fg as L,gg as Nr}from"./chunk-9kzczwh0.js";import{hg as Yr,ig as jr,jg as Br,kg as Ht,lg as Rr,mg as Jr,ng as Xr,og as Qr,pg as at,rg as Mr,sg as Ur,tg as wr,ug as hr,xg as lr,yg as Zr}from"./chunk-nc44rvs7.js";import{Ag as $t,Cg as dt,zg as et}from"./chunk-spb3tm25.js";import{Dg as Fr}from"./chunk-kktm0pdc.js";import"./chunk-apksmrz9.js";import{Gg as Ft,Hg as dr,Jg as Dr,Mg as He,Qg as M}from"./chunk-npr41z9a.js";import{Rg as Wr}from"./chunk-e8j03wnd.js";import{Sg as ar}from"./chunk-wk11yy8h.js";import"./chunk-rkf9ynkx.js";import{$g as br}from"./chunk-3dq7hfxc.js";import"./chunk-zaj612bw.js";import{Ks as qr}from"./chunk-zjpnyah2.js";import{Os as ur}from"./chunk-0hqmdrjr.js";import{RF as p}from"./chunk-8j3aw4qg.js";var V=p((se)=>{Object.defineProperty(se,"__esModule",{value:!0});se.resolveHttpAuthSchemeConfig=se.defaultSigninHttpAuthSchemeProvider=se.defaultSigninHttpAuthSchemeParametersProvider=void 0;var Nt=L(),H=Ft(),Mt=async(e,t,r)=>{return{operation:(0,H.getSmithyContext)(t).operation,region:await(0,H.normalizeProvider)(e.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()}};se.defaultSigninHttpAuthSchemeParametersProvider=Mt;function Ut(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"signin",region:e.region},propertiesExtractor:(t,r)=>({signingProperties:{config:t,context:r}})}}function wt(e){return{schemeId:"smithy.api#noAuth"}}var ht=(e)=>{let t=[];switch(e.operation){case"CreateOAuth2Token":{t.push(wt(e));break}default:t.push(Ut(e))}return t};se.defaultSigninHttpAuthSchemeProvider=ht;var xt=(e)=>{let t=(0,Nt.resolveAwsSdkSigV4Config)(e);return Object.assign(t,{authSchemePreference:(0,H.normalizeProvider)(e.authSchemePreference??[])})};se.resolveHttpAuthSchemeConfig=xt});var ye=p((Ee)=>{Object.defineProperty(Ee,"__esModule",{value:!0});Ee.ruleSet=void 0;var ve="required",o="fn",n="argv",c="ref",ne=!0,ie="isSet",y="booleanEquals",I="error",E="endpoint",l="tree",N="PartitionResult",z="stringEquals",ue={[ve]:!0,default:!1,type:"boolean"},de={[ve]:!1,type:"string"},ae={[c]:"Endpoint"},A={[o]:y,[n]:[{[c]:"UseFIPS"},!0]},W={[o]:y,[n]:[{[c]:"UseDualStack"},!0]},s={},Y={[o]:"getAttr",[n]:[{[c]:N},"name"]},R={[o]:y,[n]:[{[c]:"UseFIPS"},!1]},F={[o]:y,[n]:[{[c]:"UseDualStack"},!1]},le={[o]:"getAttr",[n]:[{[c]:N},"supportsFIPS"]},pe={[o]:y,[n]:[!0,{[o]:"getAttr",[n]:[{[c]:N},"supportsDualStack"]}]},ce=[{[c]:"Region"}],Gt={version:"1.0",parameters:{UseDualStack:ue,UseFIPS:ue,Endpoint:de,Region:de},rules:[{conditions:[{[o]:ie,[n]:[ae]}],rules:[{conditions:[A],error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:I},{rules:[{conditions:[W],error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:I},{endpoint:{url:ae,properties:s,headers:s},type:E}],type:l}],type:l},{rules:[{conditions:[{[o]:ie,[n]:ce}],rules:[{conditions:[{[o]:"aws.partition",[n]:ce,assign:N}],rules:[{conditions:[{[o]:z,[n]:[Y,"aws"]},R,F],endpoint:{url:"https://{Region}.signin.aws.amazon.com",properties:s,headers:s},type:E},{conditions:[{[o]:z,[n]:[Y,"aws-cn"]},R,F],endpoint:{url:"https://{Region}.signin.amazonaws.cn",properties:s,headers:s},type:E},{conditions:[{[o]:z,[n]:[Y,"aws-us-gov"]},R,F],endpoint:{url:"https://{Region}.signin.amazonaws-us-gov.com",properties:s,headers:s},type:E},{conditions:[A,W],rules:[{conditions:[{[o]:y,[n]:[ne,le]},pe],rules:[{endpoint:{url:"https://signin-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:s,headers:s},type:E}],type:l},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:I}],type:l},{conditions:[A,F],rules:[{conditions:[{[o]:y,[n]:[le,ne]}],rules:[{endpoint:{url:"https://signin-fips.{Region}.{PartitionResult#dnsSuffix}",properties:s,headers:s},type:E}],type:l},{error:"FIPS is enabled but this partition does not support FIPS",type:I}],type:l},{conditions:[R,W],rules:[{conditions:[pe],rules:[{endpoint:{url:"https://signin.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:s,headers:s},type:E}],type:l},{error:"DualStack is enabled but this partition does not support DualStack",type:I}],type:l},{endpoint:{url:"https://signin.{Region}.{PartitionResult#dnsSuffix}",properties:s,headers:s},type:E}],type:l}],type:l},{error:"Invalid Configuration: Missing Region",type:I}],type:l}]};Ee.ruleSet=Gt});var Ie=p((Pe)=>{Object.defineProperty(Pe,"__esModule",{value:!0});Pe.defaultEndpointResolver=void 0;var Lt=Ht(),j=$t(),Vt=ye(),zt=new j.EndpointCache({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),At=(e,t={})=>{return zt.get(e,()=>(0,j.resolveEndpoint)(Vt.ruleSet,{endpointParams:e,logger:t.logger}))};Pe.defaultEndpointResolver=At;j.customEndpointFunctions.aws=Lt.awsEndpointFunctions});var U=p((J)=>{Object.defineProperty(J,"__esModule",{value:!0});J.SigninServiceException=J.__ServiceException=void 0;var qe=M();Object.defineProperty(J,"__ServiceException",{enumerable:!0,get:function(){return qe.ServiceException}});class B extends qe.ServiceException{constructor(e){super(e);Object.setPrototypeOf(this,B.prototype)}}J.SigninServiceException=B});var k=p((be)=>{Object.defineProperty(be,"__esModule",{value:!0});be.ValidationException=be.TooManyRequestsError=be.InternalServerException=be.AccessDeniedException=void 0;var w=U();class X extends w.SigninServiceException{name="AccessDeniedException";$fault="client";error;constructor(e){super({name:"AccessDeniedException",$fault:"client",...e});Object.setPrototypeOf(this,X.prototype),this.error=e.error}}be.AccessDeniedException=X;class Q extends w.SigninServiceException{name="InternalServerException";$fault="server";error;constructor(e){super({name:"InternalServerException",$fault:"server",...e});Object.setPrototypeOf(this,Q.prototype),this.error=e.error}}be.InternalServerException=Q;class Z extends w.SigninServiceException{name="TooManyRequestsError";$fault="client";error;constructor(e){super({name:"TooManyRequestsError",$fault:"client",...e});Object.setPrototypeOf(this,Z.prototype),this.error=e.error}}be.TooManyRequestsError=Z;class K extends w.SigninServiceException{name="ValidationException";$fault="client";error;constructor(e){super({name:"ValidationException",$fault:"client",...e});Object.setPrototypeOf(this,K.prototype),this.error=e.error}}be.ValidationException=K});var C=p((We)=>{Object.defineProperty(We,"__esModule",{value:!0});We.CreateOAuth2Token$=We.CreateOAuth2TokenResponseBody$=We.CreateOAuth2TokenResponse$=We.CreateOAuth2TokenRequestBody$=We.CreateOAuth2TokenRequest$=We.AccessToken$=We.errorTypeRegistries=We.ValidationException$=We.TooManyRequestsError$=We.InternalServerException$=We.AccessDeniedException$=We.SigninServiceException$=void 0;var Bt="AccessDeniedException",Jt="AccessToken",Xt="CreateOAuth2Token",Qt="CreateOAuth2TokenRequest",Zt="CreateOAuth2TokenRequestBody",Kt="CreateOAuth2TokenResponseBody",kt="CreateOAuth2TokenResponse",Tt="InternalServerException",mt="RefreshToken",Ct="TooManyRequestsError",_t="ValidationException",Fe="accessKeyId",Ne="accessToken",T="client",Me="clientId",Ue="codeVerifier",er="code",S="error",we="expiresIn",he="grantType",tr="http",m="httpError",xe="idToken",u="jsonName",x="message",h="refreshToken",ge="redirectUri",Le="smithy.ts.sdk.synthetic.com.amazonaws.signin",fe="secretAccessKey",Ge="sessionToken",rr="server",sr="tokenInput",or="tokenOutput",$e="tokenType",d="com.amazonaws.signin",Ve=He(),g=k(),nr=U(),ze=Ve.TypeRegistry.for(Le);We.SigninServiceException$=[-3,Le,"SigninServiceException",0,[],[]];ze.registerError(We.SigninServiceException$,nr.SigninServiceException);var q=Ve.TypeRegistry.for(d);We.AccessDeniedException$=[-3,d,Bt,{[S]:T},[S,x],[0,0],2];q.registerError(We.AccessDeniedException$,g.AccessDeniedException);We.InternalServerException$=[-3,d,Tt,{[S]:rr,[m]:500},[S,x],[0,0],2];q.registerError(We.InternalServerException$,g.InternalServerException);We.TooManyRequestsError$=[-3,d,Ct,{[S]:T,[m]:429},[S,x],[0,0],2];q.registerError(We.TooManyRequestsError$,g.TooManyRequestsError);We.ValidationException$=[-3,d,_t,{[S]:T,[m]:400},[S,x],[0,0],2];q.registerError(We.ValidationException$,g.ValidationException);We.errorTypeRegistries=[ze,q];var Ae=[0,d,mt,8,0];We.AccessToken$=[3,d,Jt,8,[Fe,fe,Ge],[[0,{[u]:Fe}],[0,{[u]:fe}],[0,{[u]:Ge}]],3];We.CreateOAuth2TokenRequest$=[3,d,Qt,0,[sr],[[()=>We.CreateOAuth2TokenRequestBody$,16]],1];We.CreateOAuth2TokenRequestBody$=[3,d,Zt,0,[Me,he,er,ge,Ue,h],[[0,{[u]:Me}],[0,{[u]:he}],0,[0,{[u]:ge}],[0,{[u]:Ue}],[()=>Ae,{[u]:h}]],2];We.CreateOAuth2TokenResponse$=[3,d,kt,0,[or],[[()=>We.CreateOAuth2TokenResponseBody$,16]],1];We.CreateOAuth2TokenResponseBody$=[3,d,Kt,0,[Ne,$e,we,h,xe],[[()=>We.AccessToken$,{[u]:Ne}],[0,{[u]:$e}],[1,{[u]:we}],[()=>Ae,{[u]:h}],[0,{[u]:xe}]],4];We.CreateOAuth2Token$=[9,d,Xt,{[tr]:["POST","/v1/token",200]},()=>We.CreateOAuth2TokenRequest$,()=>We.CreateOAuth2TokenResponse$]});var st=p((tt)=>{Object.defineProperty(tt,"__esModule",{value:!0});tt.getRuntimeConfig=void 0;var pr=L(),cr=lr(),vr=et(),Er=M(),Sr=ar(),Ce=dr(),_e=ur(),yr=V(),Pr=Ie(),Or=C(),Ir=(e)=>{return{apiVersion:"2023-01-01",base64Decoder:e?.base64Decoder??Ce.fromBase64,base64Encoder:e?.base64Encoder??Ce.toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Pr.defaultEndpointResolver,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??yr.defaultSigninHttpAuthSchemeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(t)=>t.getIdentityProvider("aws.auth#sigv4"),signer:new pr.AwsSdkSigV4Signer},{schemeId:"smithy.api#noAuth",identityProvider:(t)=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new vr.NoAuthSigner}],logger:e?.logger??new Er.NoOpLogger,protocol:e?.protocol??cr.AwsRestJsonProtocol,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.signin",errorTypeRegistries:Or.errorTypeRegistries,version:"2023-01-01",serviceTarget:"Signin"},serviceId:e?.serviceId??"Signin",urlParser:e?.urlParser??Sr.parseUrl,utf8Decoder:e?.utf8Decoder??_e.fromUtf8,utf8Encoder:e?.utf8Encoder??_e.toUtf8}};tt.getRuntimeConfig=Ir});var ct=p((lt)=>{Object.defineProperty(lt,"__esModule",{value:!0});lt.getRuntimeConfig=void 0;var xr=qr(),gr=xr.__importDefault(Nr()),fr=br(),Gr=L(),ot=Mr(),f=dt(),$r=Ur(),nt=at(),P=Fr(),it=Dr(),ut=M(),Hr=wr(),Lr=hr(),Vr=Rr(),zr=st(),Ar=(e)=>{(0,ut.emitWarningIfUnsupportedVersion)(process.version);let t=(0,Lr.resolveDefaultsModeConfig)(e),r=()=>t().then(ut.loadConfigsForDefaultMode),a=(0,zr.getRuntimeConfig)(e);(0,fr.emitWarningIfUnsupportedVersion)(process.version);let i={profile:e?.profile,logger:a.logger};return{...a,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??(0,P.loadConfig)(Gr.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,i),bodyLengthChecker:e?.bodyLengthChecker??Hr.calculateBodyLength,defaultUserAgentProvider:e?.defaultUserAgentProvider??(0,ot.createDefaultUserAgentProvider)({serviceId:a.serviceId,clientVersion:gr.default.version}),maxAttempts:e?.maxAttempts??(0,P.loadConfig)(nt.NODE_MAX_ATTEMPT_CONFIG_OPTIONS,e),region:e?.region??(0,P.loadConfig)(f.NODE_REGION_CONFIG_OPTIONS,{...f.NODE_REGION_CONFIG_FILE_OPTIONS,...i}),requestHandler:it.NodeHttpHandler.create(e?.requestHandler??r),retryMode:e?.retryMode??(0,P.loadConfig)({...nt.NODE_RETRY_MODE_CONFIG_OPTIONS,default:async()=>(await r()).retryMode||Vr.DEFAULT_RETRY_MODE},e),sha256:e?.sha256??$r.Hash.bind(null,"sha256"),streamCollector:e?.streamCollector??it.streamCollector,useDualstackEndpoint:e?.useDualstackEndpoint??(0,P.loadConfig)(f.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,i),useFipsEndpoint:e?.useFipsEndpoint??(0,P.loadConfig)(f.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,i),userAgentAppId:e?.userAgentAppId??(0,P.loadConfig)(ot.NODE_APP_ID_CONFIG_OPTIONS,i)}};lt.getRuntimeConfig=Ar});var Ss=p((v)=>{var vt=Yr(),Kr=jr(),kr=Br(),Et=Jr(),Tr=dt(),_=et(),mr=He(),Cr=Xr(),It=Qr(),St=at(),O=M(),yt=V(),_r=ct(),Pt=Zr(),Ot=Wr(),D=C(),G=k(),es=U(),ts=(e)=>{return Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"signin"})},rs={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},ss=(e)=>{let{httpAuthSchemes:t,httpAuthSchemeProvider:r,credentials:a}=e;return{setHttpAuthScheme(i){let b=t.findIndex(($)=>$.schemeId===i.schemeId);if(b===-1)t.push(i);else t.splice(b,1,i)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(i){r=i},httpAuthSchemeProvider(){return r},setCredentials(i){a=i},credentials(){return a}}},os=(e)=>{return{httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}},ns=(e,t)=>{let r=Object.assign(Pt.getAwsRegionExtensionConfiguration(e),O.getDefaultExtensionConfiguration(e),Ot.getHttpHandlerExtensionConfiguration(e),ss(e));return t.forEach((a)=>a.configure(r)),Object.assign(e,Pt.resolveAwsRegionExtensionConfiguration(r),O.resolveDefaultRuntimeConfig(r),Ot.resolveHttpHandlerRuntimeConfig(r),os(r))};class ee extends O.Client{config;constructor(...[e]){let t=_r.getRuntimeConfig(e||{});super(t);this.initConfig=t;let r=ts(t),a=Et.resolveUserAgentConfig(r),i=St.resolveRetryConfig(a),b=Tr.resolveRegionConfig(i),$=vt.resolveHostHeaderConfig(b),qt=It.resolveEndpointConfig($),Dt=yt.resolveHttpAuthSchemeConfig(qt),bt=ns(Dt,e?.extensions||[]);this.config=bt,this.middlewareStack.use(mr.getSchemaSerdePlugin(this.config)),this.middlewareStack.use(Et.getUserAgentPlugin(this.config)),this.middlewareStack.use(St.getRetryPlugin(this.config)),this.middlewareStack.use(Cr.getContentLengthPlugin(this.config)),this.middlewareStack.use(vt.getHostHeaderPlugin(this.config)),this.middlewareStack.use(Kr.getLoggerPlugin(this.config)),this.middlewareStack.use(kr.getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(_.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:yt.defaultSigninHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async(Rt)=>new _.DefaultIdentityProviderConfig({"aws.auth#sigv4":Rt.credentials})})),this.middlewareStack.use(_.getHttpSigningPlugin(this.config))}destroy(){super.destroy()}}class te extends O.Command.classBuilder().ep(rs).m(function(e,t,r,a){return[It.getEndpointPlugin(r,e.getEndpointParameterInstructions())]}).s("Signin","CreateOAuth2Token",{}).n("SigninClient","CreateOAuth2TokenCommand").sc(D.CreateOAuth2Token$).build(){}var is={CreateOAuth2TokenCommand:te};class re extends ee{}O.createAggregatedClient(is,re);var us={AUTHCODE_EXPIRED:"AUTHCODE_EXPIRED",INSUFFICIENT_PERMISSIONS:"INSUFFICIENT_PERMISSIONS",INVALID_REQUEST:"INVALID_REQUEST",SERVER_ERROR:"server_error",TOKEN_EXPIRED:"TOKEN_EXPIRED",USER_CREDENTIALS_CHANGED:"USER_CREDENTIALS_CHANGED"};v.$Command=O.Command;v.__Client=O.Client;v.SigninServiceException=es.SigninServiceException;v.CreateOAuth2TokenCommand=te;v.OAuth2ErrorCode=us;v.Signin=re;v.SigninClient=ee;Object.prototype.hasOwnProperty.call(D,"__proto__")&&!Object.prototype.hasOwnProperty.call(v,"__proto__")&&Object.defineProperty(v,"__proto__",{enumerable:!0,value:D.__proto__});Object.keys(D).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(v,e))v[e]=D[e]});Object.prototype.hasOwnProperty.call(G,"__proto__")&&!Object.prototype.hasOwnProperty.call(v,"__proto__")&&Object.defineProperty(v,"__proto__",{enumerable:!0,value:G.__proto__});Object.keys(G).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(v,e))v[e]=G[e]})});export default Ss();
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$f as g,Vf as a,Wf as b,Xf as c,Yf as d,Zf as e,_f as f,ag as h,bg as i,cg as j,dg as k,eg as l}from"./chunk-fqt3c3g5.js";import"./chunk-kktm0pdc.js";import"./chunk-apksmrz9.js";import"./chunk-wk11yy8h.js";import"./chunk-rkf9ynkx.js";import"./chunk-zaj612bw.js";import"./chunk-8j3aw4qg.js";l();export{d as providerConfigFromInit,a as httpRequest,j as getInstanceMetadataEndpoint,k as fromInstanceMetadata,h as fromContainerMetadata,i as Endpoint,f as ENV_CMDS_RELATIVE_URI,e as ENV_CMDS_FULL_URI,g as ENV_CMDS_AUTH_TOKEN,b as DEFAULT_TIMEOUT,c as DEFAULT_MAX_RETRIES};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Nj as d}from"./chunk-2bt5mtgm.js";import{ol as i}from"./chunk-pqwm9zk1.js";import{$o as w}from"./chunk-zhd8f4pc.js";import{vs as M,xs as v}from"./chunk-8jy0dvcn.js";import{SF as l}from"./chunk-8j3aw4qg.js";var f={};l(f,{listen:()=>T,emit:()=>O,client:()=>S,Rpc:()=>f});function T(t){onmessage=async(e)=>{let r=JSON.parse(e.data);if(r.type==="rpc.request"){let n=await t[r.method](r.input);postMessage(JSON.stringify({type:"rpc.result",result:n,id:r.id}))}}}function O(t,e){postMessage(JSON.stringify({type:"rpc.event",event:t,data:e}))}function S(t){let e=new Map,r=new Map,n=0;return t.onmessage=async(o)=>{let a=JSON.parse(o.data);if(a.type==="rpc.result"){let s=e.get(a.id);if(s)s(a.result),e.delete(a.id)}if(a.type==="rpc.event"){let s=r.get(a.event);if(s)for(let p of s)p(a.data)}},{call(o,a){let s=n++;return new Promise((p)=>{e.set(s,p),t.postMessage(JSON.stringify({type:"rpc.request",method:o,input:a,id:s}))})},on(o,a){let s=r.get(o);if(!s)s=new Set,r.set(o,s);return s.add(a),()=>{s.delete(a)}}}}var c={};l(c,{reloadInstance:()=>P,load:()=>x,disposeInstance:()=>D,disposeAllInstances:()=>N,InstanceRuntime:()=>c});var x=(t)=>d.runPromise(i.Service.use((e)=>e.load(t))),D=(t)=>d.runPromise(i.Service.use((e)=>e.dispose(t))),N=()=>d.runPromise(i.Service.use((t)=>t.disposeAll())),P=(t)=>d.runPromise(i.Service.use((e)=>e.reload(t)));var h={};l(h,{start:()=>H,Heap:()=>h});import E from"path";import{writeHeapSnapshot as J}from"v8";var y=w({service:"heap"}),U=60000,k=2147483648,g,m=!1,u=!0;function H(){if(!M.MUXCODE_AUTO_HEAP_SNAPSHOT)return;if(g)return;let t=async()=>{if(m)return;let e=process.memoryUsage();if(e.rss<=k){u=!0;return}if(!u)return;m=!0,u=!1;let r=E.join(v.Path.log,`heap-${process.pid}-${new Date().toISOString().replace(/[:.]/g,"")}.heapsnapshot`);y.warn("heap usage exceeded limit",{rss:e.rss,heap:e.heapUsed,file:r}),await Promise.resolve().then(()=>J(r)).catch((n)=>{y.error("failed to write heap snapshot",{error:n instanceof Error?n.message:String(n),file:r})}),m=!1};g=setInterval(()=>{t()},U),g.unref?.()}
|
|
3
|
+
export{f as Bj,c as Cj,h as Dj};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ov as AJ}from"./chunk-ak0k3m4q.js";import{pv as jQ}from"./chunk-x65zs89t.js";import{qv as oJ,rv as hJ,sv as m,tv as FQ,uv as KQ,vv as UQ,xv as BQ,yv as VQ}from"./chunk-ng3vbpmy.js";import{AA as $Q,Cv as HQ,JF as iJ,KF as aJ,Pz as zJ,Qz as $J,Rv as yJ,Sz as ZQ,Tz as qQ,UA as l,Uz as XQ,Vx as mJ,Vz as EJ,WA as y,Wz as YQ,ax as CJ,cx as jJ,fB as zQ,gz as cJ,hA as QQ,iA as wQ,lA as d,nx as JQ,pA as _,qB as g,rx as gJ,tA as f,uz as pJ,vz as uJ,xB as v,xx as vJ}from"./chunk-1mqsg5s7.js";import{MF as RQ}from"./chunk-z3mx7n44.js";import{NF as MQ,OF as r}from"./chunk-0qqpjj2h.js";import{PF as u}from"./chunk-9g64kggy.js";import{QF as R,RF as MJ}from"./chunk-8j3aw4qg.js";var fJ=MJ((LJ)=>{Object.defineProperty(LJ,"__esModule",{value:!0});LJ.NodeTracerProvider=void 0;var kQ=jQ(),CQ=AJ(),p=u(),HJ=r();function OQ(J){if(J===null)return;if(J===void 0){let Q=new kQ.AsyncLocalStorageContextManager;Q.enable(),p.context.setGlobalContextManager(Q);return}J.enable(),p.context.setGlobalContextManager(J)}function EQ(J){if(J===null)return;if(J===void 0){p.propagation.setGlobalPropagator(new HJ.CompositePropagator({propagators:[new HJ.W3CTraceContextPropagator,new HJ.W3CBaggagePropagator]}));return}p.propagation.setGlobalPropagator(J)}class RJ extends CQ.BasicTracerProvider{constructor(J={}){super(J)}register(J={}){p.trace.setGlobalTracerProvider(this),OQ(J.contextManager),EQ(J.propagator)}}LJ.NodeTracerProvider=RJ});var PJ=MJ((U)=>{Object.defineProperty(U,"__esModule",{value:!0});U.TraceIdRatioBasedSampler=U.SimpleSpanProcessor=U.SamplingDecision=U.RandomIdGenerator=U.ParentBasedSampler=U.NoopSpanProcessor=U.InMemorySpanExporter=U.ConsoleSpanExporter=U.BatchSpanProcessor=U.BasicTracerProvider=U.AlwaysOnSampler=U.AlwaysOffSampler=U.NodeTracerProvider=void 0;var DQ=fJ();Object.defineProperty(U,"NodeTracerProvider",{enumerable:!0,get:function(){return DQ.NodeTracerProvider}});var C=AJ();Object.defineProperty(U,"AlwaysOffSampler",{enumerable:!0,get:function(){return C.AlwaysOffSampler}});Object.defineProperty(U,"AlwaysOnSampler",{enumerable:!0,get:function(){return C.AlwaysOnSampler}});Object.defineProperty(U,"BasicTracerProvider",{enumerable:!0,get:function(){return C.BasicTracerProvider}});Object.defineProperty(U,"BatchSpanProcessor",{enumerable:!0,get:function(){return C.BatchSpanProcessor}});Object.defineProperty(U,"ConsoleSpanExporter",{enumerable:!0,get:function(){return C.ConsoleSpanExporter}});Object.defineProperty(U,"InMemorySpanExporter",{enumerable:!0,get:function(){return C.InMemorySpanExporter}});Object.defineProperty(U,"NoopSpanProcessor",{enumerable:!0,get:function(){return C.NoopSpanProcessor}});Object.defineProperty(U,"ParentBasedSampler",{enumerable:!0,get:function(){return C.ParentBasedSampler}});Object.defineProperty(U,"RandomIdGenerator",{enumerable:!0,get:function(){return C.RandomIdGenerator}});Object.defineProperty(U,"SamplingDecision",{enumerable:!0,get:function(){return C.SamplingDecision}});Object.defineProperty(U,"SimpleSpanProcessor",{enumerable:!0,get:function(){return C.SimpleSpanProcessor}});Object.defineProperty(U,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return C.TraceIdRatioBasedSampler}})});var GQ=R(PJ(),1);var t=(J)=>J!==void 0&&!(Array.isArray(J)&&J.length===0);var K;(function(J){J[J.UNSPECIFIED=0]="UNSPECIFIED",J[J.TRACE=1]="TRACE",J[J.TRACE2=2]="TRACE2",J[J.TRACE3=3]="TRACE3",J[J.TRACE4=4]="TRACE4",J[J.DEBUG=5]="DEBUG",J[J.DEBUG2=6]="DEBUG2",J[J.DEBUG3=7]="DEBUG3",J[J.DEBUG4=8]="DEBUG4",J[J.INFO=9]="INFO",J[J.INFO2=10]="INFO2",J[J.INFO3=11]="INFO3",J[J.INFO4=12]="INFO4",J[J.WARN=13]="WARN",J[J.WARN2=14]="WARN2",J[J.WARN3=15]="WARN3",J[J.WARN4=16]="WARN4",J[J.ERROR=17]="ERROR",J[J.ERROR2=18]="ERROR2",J[J.ERROR3=19]="ERROR3",J[J.ERROR4=20]="ERROR4",J[J.FATAL=21]="FATAL",J[J.FATAL2=22]="FATAL2",J[J.FATAL3=23]="FATAL3",J[J.FATAL4=24]="FATAL4"})(K||(K={}));class n{emit(J){}}var s=new n;var i=Symbol.for("io.opentelemetry.js.api.logs"),b=globalThis;function _J(J,Q,Z){return($)=>$===J?Q:Z}var qJ=1;class SJ{getLogger(J,Q,Z){return new n}}var e=new SJ;class XJ{constructor(J,Q,Z,$){this._provider=J,this.name=Q,this.version=Z,this.options=$}emit(J){this._getLogger().emit(J)}_getLogger(){if(this._delegate)return this._delegate;let J=this._provider._getDelegateLogger(this.name,this.version,this.options);if(!J)return s;return this._delegate=J,this._delegate}}class JJ{getLogger(J,Q,Z){var $;return($=this._getDelegateLogger(J,Q,Z))!==null&&$!==void 0?$:new XJ(this,J,Q,Z)}_getDelegate(){var J;return(J=this._delegate)!==null&&J!==void 0?J:e}_setDelegate(J){this._delegate=J}_getDelegateLogger(J,Q,Z){var $;return($=this._delegate)===null||$===void 0?void 0:$.getLogger(J,Q,Z)}}class QJ{constructor(){this._proxyLoggerProvider=new JJ}static getInstance(){if(!this._instance)this._instance=new QJ;return this._instance}setGlobalLoggerProvider(J){if(b[i])return this.getLoggerProvider();return b[i]=_J(qJ,J,e),this._proxyLoggerProvider._setDelegate(J),J}getLoggerProvider(){var J,Q;return(Q=(J=b[i])===null||J===void 0?void 0:J.call(b,qJ))!==null&&Q!==void 0?Q:this._proxyLoggerProvider}getLogger(J,Q,Z){return this.getLoggerProvider().getLogger(J,Q,Z)}disable(){delete b[i],this._proxyLoggerProvider=new JJ}}var kZ=QJ.getInstance();var a=R(u(),1);var dJ=R(RQ(),1),lJ=R(r(),1);var I=R(u(),1);var D=R(u(),1),wJ=R(r(),1),h=R(MQ(),1);function TJ(J){return YJ(J,new WeakSet)}function YJ(J,Q){if(J==null)return!0;if(typeof J==="string"||typeof J==="number"||typeof J==="boolean")return!0;if(J instanceof Uint8Array)return!0;if(typeof J==="object"){if(Q.has(J))return!1;if(Q.add(J),Array.isArray(J))return J.every(($)=>YJ($,Q));let Z=J;if(Z.constructor!==Object&&Z.constructor!==void 0)return!1;return Object.values(Z).every(($)=>YJ($,Q))}return!1}class FJ{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;_attributesCount=0;_droppedAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(J){if(this._isLogRecordReadonly())return;this._severityText=J}get severityText(){return this._severityText}set severityNumber(J){if(this._isLogRecordReadonly())return;this._severityNumber=J}get severityNumber(){return this._severityNumber}set body(J){if(this._isLogRecordReadonly())return;this._body=J}get body(){return this._body}get eventName(){return this._eventName}set eventName(J){if(this._isLogRecordReadonly())return;this._eventName=J}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(J,Q,Z){let{timestamp:$,observedTimestamp:W,eventName:X,severityNumber:B,severityText:j,body:V,attributes:G={},exception:x,context:z}=Z,w=Date.now();if(this.hrTime=wJ.timeInputToHrTime($??w),this.hrTimeObserved=wJ.timeInputToHrTime(W??w),z){let k=D.trace.getSpanContext(z);if(k&&D.isSpanContextValid(k))this.spanContext=k}if(this.severityNumber=B,this.severityText=j,this.body=V,this.resource=J.resource,this.instrumentationScope=Q,this._logRecordLimits=J.logRecordLimits,this._eventName=X,this.setAttributes(G),x!=null)this._setException(x)}setAttribute(J,Q){if(this._isLogRecordReadonly())return this;if(J.length===0)return D.diag.warn(`Invalid attribute key: ${J}`),this;if(!TJ(Q))return D.diag.warn(`Invalid attribute value set for key: ${J}`),this;let Z=!Object.prototype.hasOwnProperty.call(this.attributes,J);if(Z&&this._attributesCount>=this._logRecordLimits.attributeCountLimit){if(this._droppedAttributesCount++,this._droppedAttributesCount===1)D.diag.warn("Dropping extra attributes.");return this}if(this.attributes[J]=this._truncateToSize(Q),Z)this._attributesCount++;return this}setAttributes(J){for(let[Q,Z]of Object.entries(J))this.setAttribute(Q,Z);return this}setBody(J){return this.body=J,this}setEventName(J){return this.eventName=J,this}setSeverityNumber(J){return this.severityNumber=J,this}setSeverityText(J){return this.severityText=J,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(J){let Q=this._logRecordLimits.attributeValueLengthLimit;if(Q<=0)return D.diag.warn(`Attribute value limit must be positive, got ${Q}`),J;if(J==null)return J;if(typeof J==="string")return this._truncateToLimitUtil(J,Q);if(J instanceof Uint8Array)return J;if(Array.isArray(J))return J.map((Z)=>this._truncateToSize(Z));if(typeof J==="object"){let Z={};for(let[$,W]of Object.entries(J))Z[$]=this._truncateToSize(W);return Z}return J}_setException(J){let Q=!1;if(typeof J==="string"||typeof J==="number"){if(!Object.hasOwn(this.attributes,h.ATTR_EXCEPTION_MESSAGE))this.setAttribute(h.ATTR_EXCEPTION_MESSAGE,String(J));Q=!0}else if(J&&typeof J==="object"){let Z=J;if(Z.code){if(!Object.hasOwn(this.attributes,h.ATTR_EXCEPTION_TYPE))this.setAttribute(h.ATTR_EXCEPTION_TYPE,Z.code.toString());Q=!0}else if(Z.name){if(!Object.hasOwn(this.attributes,h.ATTR_EXCEPTION_TYPE))this.setAttribute(h.ATTR_EXCEPTION_TYPE,Z.name);Q=!0}if(Z.message){if(!Object.hasOwn(this.attributes,h.ATTR_EXCEPTION_MESSAGE))this.setAttribute(h.ATTR_EXCEPTION_MESSAGE,Z.message);Q=!0}if(Z.stack){if(!Object.hasOwn(this.attributes,h.ATTR_EXCEPTION_STACKTRACE))this.setAttribute(h.ATTR_EXCEPTION_STACKTRACE,Z.stack);Q=!0}}if(!Q)D.diag.warn(`Failed to record an exception ${J}`)}_truncateToLimitUtil(J,Q){if(J.length<=Q)return J;return J.substring(0,Q)}_isLogRecordReadonly(){if(this._isReadonly)D.diag.warn("Can not execute the operation on emitted log record");return this._isReadonly}}class KJ{instrumentationScope;_sharedState;_loggerConfig;constructor(J,Q){this.instrumentationScope=J,this._sharedState=Q,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(J){let Q=this._loggerConfig,Z=J.context||I.context.active(),$=J.severityNumber??K.UNSPECIFIED;if($!==K.UNSPECIFIED&&$<Q.minimumSeverity)return;if(Q.traceBased){let X=I.trace.getSpanContext(Z);if(X&&I.isSpanContextValid(X)){if((X.traceFlags&I.TraceFlags.SAMPLED)!==I.TraceFlags.SAMPLED)return}}let W=new FJ(this._sharedState,this.instrumentationScope,{context:Z,...J});this._sharedState.activeProcessor.onEmit(W,Z),W._makeReadonly()}}class UJ{forceFlush(){return Promise.resolve()}onEmit(J,Q){}shutdown(){return Promise.resolve()}}var NJ=R(r(),1);class BJ{processors;forceFlushTimeoutMillis;constructor(J,Q){this.processors=J,this.forceFlushTimeoutMillis=Q}async forceFlush(){let J=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map((Q)=>NJ.callWithTimeout(Q.forceFlush(),J)))}onEmit(J,Q){this.processors.forEach((Z)=>Z.onEmit(J,Q))}async shutdown(){await Promise.all(this.processors.map((J)=>J.shutdown()))}}function bJ(J){return`${J.name}@${J.version||""}:${J.schemaUrl||""}`}var AQ={disabled:!1,minimumSeverity:K.UNSPECIFIED,traceBased:!1},VJ=()=>({...AQ});class GJ{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;_loggerConfigurator;_loggerConfigs=new Map;constructor(J,Q,Z,$,W){if(this.resource=J,this.forceFlushTimeoutMillis=Q,this.logRecordLimits=Z,this.processors=$,$.length>0)this.registeredLogRecordProcessors=$,this.activeProcessor=new BJ(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis);else this.activeProcessor=new UJ;this._loggerConfigurator=W??VJ}getLoggerConfig(J){let Q=bJ(J),Z=this._loggerConfigs.get(Q);if(Z)return Z;return Z=this._loggerConfigurator(J),this._loggerConfigs.set(Q,Z),Z}}var LQ="unknown";class ZJ{_shutdownOnce;_sharedState;constructor(J={}){let Q={resource:J.resource??dJ.defaultResource(),forceFlushTimeoutMillis:J.forceFlushTimeoutMillis??30000,logRecordLimits:{attributeCountLimit:J.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:J.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:J.loggerConfigurator??VJ,processors:J.processors??[]};this._sharedState=new GJ(Q.resource,Q.forceFlushTimeoutMillis,Q.logRecordLimits,Q.processors,Q.loggerConfigurator),this._shutdownOnce=new lJ.BindOnceFuture(this._shutdown,this)}getLogger(J,Q,Z){if(this._shutdownOnce.isCalled)return a.diag.warn("A shutdown LoggerProvider cannot provide a Logger"),s;if(!J)a.diag.warn("Logger requested without instrumentation scope name.");let $=J||LQ,W=`${$}@${Q||""}:${Z?.schemaUrl||""}`;if(!this._sharedState.loggers.has(W))this._sharedState.loggers.set(W,new KJ({name:$,version:Q,schemaUrl:Z?.schemaUrl},this._sharedState));return this._sharedState.loggers.get(W)}forceFlush(){if(this._shutdownOnce.isCalled)return a.diag.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise;return this._sharedState.activeProcessor.forceFlush()}shutdown(){if(this._shutdownOnce.isCalled)return a.diag.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise;return this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}class kJ extends gJ()("@effect/opentelemetry/Logger/OtelLoggerProvider"){}var PQ=(J)=>{switch(J){case"Trace":return K.TRACE;case"Debug":return K.DEBUG;case"Info":return K.INFO;case"Warn":return K.WARN;case"Error":return K.ERROR;case"Fatal":return K.FATAL;default:return K.UNSPECIFIED}},_Q=f(function*(){let J=yield*kJ,Q=yield*cJ,Z=J.getLogger("@effect/opentelemetry");return iJ(($)=>{let W={fiberId:$.fiber.id},X=vJ($.fiber.context,mJ);if(yJ(X))W.spanId=X.spanId,W.traceId=X.traceId;for(let[G,x]of Object.entries($.fiber.getRef(pJ)))W[G]=hJ(x);let B=$.date.getTime();for(let[G,x]of $.fiber.getRef(uJ))W[`logSpan.${G}`]=`${B-x}ms`;let j=jJ($.message).map(hJ),V=oJ(Q.currentTimeNanosUnsafe());Z.emit({body:j.length===1?j[0]:j,severityText:$.logLevel,severityNumber:PQ($.logLevel),timestamp:V,observedTimestamp:V,attributes:W})})}),rJ=(J)=>aJ([_Q],{mergeWithExisting:J.mergeWithExisting??!0}),tJ=(J,Q)=>$J(kJ,f(function*(){let Z=yield*m;return yield*g(_(()=>new ZJ({...Q??void 0,processors:jJ(J),resource:Z})),($)=>d(()=>$.forceFlush().then(()=>$.shutdown())).pipe(l,v,y(Q?.shutdownTimeout??3000)))}));var P=R(u(),1);var S;(function(J){J[J.DELTA=0]="DELTA",J[J.CUMULATIVE=1]="CUMULATIVE"})(S||(S={}));var O;(function(J){J.COUNTER="COUNTER",J.GAUGE="GAUGE",J.HISTOGRAM="HISTOGRAM",J.UP_DOWN_COUNTER="UP_DOWN_COUNTER",J.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",J.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",J.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(O||(O={}));var M;(function(J){J[J.HISTOGRAM=0]="HISTOGRAM",J[J.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",J[J.GAUGE=2]="GAUGE",J[J.SUM=3]="SUM"})(M||(M={}));var TQ="@effect/opentelemetry/Metrics";class OJ{resource;context;temporality;startTimes;startTimeNanos;previousExportTimeNanos;previousCounterState;previousHistogramState;previousFrequencyState;previousSummaryState;constructor(J,Q,Z="cumulative"){this.resource=J,this.context=Q,this.temporality=Z,this.startTimes=new Map,this.startTimeNanos=eJ(),this.previousExportTimeNanos=this.startTimeNanos,this.previousCounterState=new Map,this.previousHistogramState=new Map,this.previousFrequencyState=new Map,this.previousSummaryState=new Map}startTimeFor(J,Q){if(this.startTimes.has(J))return this.startTimes.get(J);return this.startTimes.set(J,Q),Q}collect(J){let Q=QQ(this.context),Z=eJ(),$=[],W=new Map,X=(G)=>{$.push(G),W.set(G.descriptor.name,G)},B=this.temporality==="delta",j=B?S.DELTA:S.CUMULATIVE,V=B?this.previousExportTimeNanos:this.startTimeNanos;for(let G=0,x=Q.length;G<x;G++){let z=Q[G],w=z.attributes?JQ(Object.entries(z.attributes),{},(H,[q,Y])=>{return H[q]=String(Y),H}):{},k=NQ(z.id,z.attributes);switch(z.type){case"Counter":{let H=z.state.count,q=H;if(B){let F=this.previousCounterState.get(k);if(F!==void 0)if(typeof H==="bigint"&&typeof F==="bigint"){if(q=H-F,q<BigInt(0))q=H}else{let L=Number(H),T=Number(F);if(q=L-T,q<0)q=L}this.previousCounterState.set(k,H)}let Y=c(z,w),E={startTime:this.startTimeFor(Y.name,V),endTime:Z,attributes:w,value:Number(q)};if(W.has(z.id))W.get(z.id).dataPoints.push(E);else X({dataPointType:M.SUM,descriptor:Y,isMonotonic:z.state.incremental,aggregationTemporality:j,dataPoints:[E]});break}case"Gauge":{let H=c(z,w),Y={startTime:this.startTimeFor(H.name,this.startTimeNanos),endTime:Z,attributes:w,value:Number(z.state.value)};if(W.has(z.id))W.get(z.id).dataPoints.push(Y);else X({dataPointType:M.GAUGE,descriptor:H,aggregationTemporality:S.CUMULATIVE,dataPoints:[Y]});break}case"Histogram":{let H=z.state.buckets.length,q={boundaries:CJ(H-1),counts:CJ(H)},Y=0,A=0;for(let[N,o]of z.state.buckets){if(Y<H-1)q.boundaries[Y]=N;q.counts[Y]=o-A,A=o,Y++}let E=z.state.count,F=z.state.sum,L=q.counts,T=z.state.min,WJ=z.state.max;if(B){let N=this.previousHistogramState.get(k);if(N!==void 0)E=z.state.count-N.count,F=z.state.sum-N.sum,L=q.counts.map((o,hQ)=>Math.max(0,o-(N.bucketCounts[hQ]??0)));this.previousHistogramState.set(k,{count:z.state.count,sum:z.state.sum,bucketCounts:q.counts.slice(),min:z.state.min,max:z.state.max})}let DJ=c(z,w),IJ={startTime:this.startTimeFor(DJ.name,V),endTime:Z,attributes:w,value:{buckets:{boundaries:q.boundaries,counts:L},count:E,min:T,max:WJ,sum:F}};if(W.has(z.id))W.get(z.id).dataPoints.push(IJ);else X({dataPointType:M.HISTOGRAM,descriptor:DJ,aggregationTemporality:j,dataPoints:[IJ]});break}case"Frequency":{let H=[],q=new Map;for(let[Y,A]of z.state.occurrences){q.set(Y,A);let E=A;if(B){let T=this.previousFrequencyState.get(k);if(T!==void 0){let WJ=T.get(Y)??0;E=Math.max(0,A-WJ)}}let F=c(z,w),L=this.startTimeFor(F.name,V);H.push({startTime:L,endTime:Z,attributes:{...w,key:Y},value:E})}if(B)this.previousFrequencyState.set(k,q);if(W.has(z.id))W.get(z.id).dataPoints.push(...H);else{let Y=c(z,w);X({dataPointType:M.SUM,descriptor:Y,aggregationTemporality:j,isMonotonic:!0,dataPoints:H})}break}case"Summary":{let H=[{startTime:V,endTime:Z,attributes:{...w,quantile:"min"},value:z.state.min}];for(let[F,L]of z.state.quantiles)H.push({startTime:V,endTime:Z,attributes:{...w,quantile:F.toString()},value:L??0});H.push({startTime:V,endTime:Z,attributes:{...w,quantile:"max"},value:z.state.max});let q=z.state.count,Y=z.state.sum;if(B){let F=this.previousSummaryState.get(k);if(F!==void 0)q=z.state.count-F.count,Y=z.state.sum-F.sum;this.previousSummaryState.set(k,{count:z.state.count,sum:z.state.sum})}let A={startTime:V,endTime:Z,attributes:w,value:q},E={startTime:V,endTime:Z,attributes:w,value:Y};if(W.has(`${z.id}_quantiles`))W.get(`${z.id}_quantiles`).dataPoints.push(...H),W.get(`${z.id}_count`).dataPoints.push(A),W.get(`${z.id}_sum`).dataPoints.push(E);else{let F=c(z,w);X({dataPointType:M.SUM,descriptor:{...F,name:`${F.name}_quantiles`},aggregationTemporality:j,isMonotonic:!1,dataPoints:H}),X({dataPointType:M.SUM,descriptor:{name:`${z.id}_count`,description:z.description??"",unit:"1",type:O.COUNTER,valueType:P.ValueType.INT,advice:{}},aggregationTemporality:j,isMonotonic:!0,dataPoints:[A]}),X({dataPointType:M.SUM,descriptor:{name:`${z.id}_sum`,description:z.description??"",unit:"1",type:O.COUNTER,valueType:P.ValueType.DOUBLE,advice:{}},aggregationTemporality:j,isMonotonic:!0,dataPoints:[E]})}break}}}if(B)this.previousExportTimeNanos=Z;return Promise.resolve({resourceMetrics:{resource:this.resource,scopeMetrics:[{scope:{name:TQ},metrics:$}]},errors:[]})}}var NQ=(J,Q)=>{if(Q===void 0||Object.keys(Q).length===0)return J;let Z=Object.entries(Q).sort(($,W)=>$[0].localeCompare(W[0]));return`${J}:${JSON.stringify(Z)}`},eJ=()=>{let J=Date.now();return[Math.floor(J/1000),J%1000*1e6]},c=(J,Q)=>{let Z=Q.unit??Q.time_unit??"1";return{name:J.id,description:J.description??"",unit:Z,type:bQ(J),valueType:dQ(J),advice:{}}},bQ=(J)=>{switch(J.type){case"Histogram":return O.HISTOGRAM;case"Gauge":return O.OBSERVABLE_GAUGE;case"Frequency":return O.COUNTER;case"Counter":return J.state.incremental?O.COUNTER:O.UP_DOWN_COUNTER;case"Summary":return O.COUNTER}},dQ=(J)=>{if(J.type==="Counter")return typeof J.state.count==="bigint"?P.ValueType.INT:P.ValueType.DOUBLE;else if(J.type==="Gauge")return typeof J.state.value==="bigint"?P.ValueType.INT:P.ValueType.DOUBLE;return P.ValueType.DOUBLE};var lQ=(J)=>f(function*(){let Q=yield*m,Z=yield*zQ();return new OJ(Q,Z,J)}),yQ=(J,Q,Z)=>g(_(()=>{let $=Q(),W=Array.isArray($)?$:[$];return W.forEach((X)=>X.setMetricProducer(J)),W}),($)=>d(()=>Promise.all($.map((W)=>W.shutdown()))).pipe(l,v,y(Z?.shutdownTimeout??3000))),WQ=(J,Q)=>ZQ($Q(lQ(Q?.temporality),(Z)=>yQ(Z,J,Q)));var vQ=(J,Q)=>$J(BQ,f(function*(){let Z=yield*m;return yield*g(_(()=>{return new GQ.NodeTracerProvider({...Q??void 0,resource:Z,spanProcessors:Array.isArray(J)?J:[J]})}),($)=>d(()=>$.forceFlush().then(()=>$.shutdown())).pipe(l,v,y(Q?.shutdownTimeout??3000)))})),L0=(J)=>qQ(f(function*(){let Q=yield*wQ(J)?J:_(J),Z=KQ(Q.resource&&FQ(Q.resource)),$=t(Q.spanProcessor)?EJ(VQ,vQ(Q.spanProcessor,{...Q.tracerConfig,shutdownTimeout:Q.shutdownTimeout})):zJ,W=t(Q.metricReader)?WQ(HQ(Q.metricReader),{shutdownTimeout:Q.shutdownTimeout,temporality:Q.metricTemporality}):zJ,X=t(Q.logRecordProcessor)?EJ(rJ({mergeWithExisting:Q.loggerMergeWithExisting}),tJ(Q.logRecordProcessor,{...Q.loggerProviderConfig,shutdownTimeout:Q.shutdownTimeout})):zJ;return XQ($,W,X).pipe(YQ(Z))})),x0=UQ;export{vQ as layerTracerProvider,x0 as layerEmpty,L0 as layer};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{UF as U}from"./chunk-8j3aw4qg.js";import{dlopen as S,FFIType as x,ptr as M}from"bun:ffi";import{Buffer as G}from"buffer";class O{listeners=[];event=(z)=>{return this.listeners.push(z),{dispose:()=>{let H=this.listeners.indexOf(z);if(H!==-1)this.listeners.splice(H,1)}}};fire(z){for(let H of this.listeners)H(z)}}import{join as Y,dirname as R,basename as L}from"path";import{existsSync as j}from"fs";var k=80,N=24,_="sh",B="xterm";function P(z){if(z.length===0)return"''";return`'${z.replace(/'/g,"'\\''")}'`}function v(){let z=process.env.BUN_PTY_LIB;if(z&&j(z))return z;try{let q=U(`../rust-pty/target/release/${process.platform==="win32"?"rust_pty.dll":process.platform==="darwin"?process.arch==="arm64"?"librust_pty_arm64.dylib":"librust_pty.dylib":process.arch==="arm64"?"librust_pty_arm64.so":"librust_pty.so"}`);if(q)return q}catch{}let{platform:H,arch:J}=process,X=H==="darwin"?J==="arm64"?["librust_pty_arm64.dylib","librust_pty.dylib"]:["librust_pty.dylib"]:H==="win32"?["rust_pty.dll"]:J==="arm64"?["librust_pty_arm64.so","librust_pty.so"]:["librust_pty.so"],V=Bun.fileURLToPath(import.meta.url),$=R(V),W=L($),K=W==="src"||W==="dist"?R($):$,w=[Y(K,"rust-pty","target","release"),Y(K,"..","bun-pty","rust-pty","target","release"),Y(process.cwd(),"node_modules","bun-pty","rust-pty","target","release")],C=[];for(let q of w)for(let A of X)C.push(Y(q,A));for(let q of C)if(j(q))return q;throw Error(`librust_pty shared library not found.
|
|
3
|
+
Checked:
|
|
4
|
+
- BUN_PTY_LIB=${z??"<unset>"}
|
|
5
|
+
- ${C.join(`
|
|
6
|
+
- `)}
|
|
7
|
+
|
|
8
|
+
Set BUN_PTY_LIB or ensure one of these paths contains the file.`)}var g=v(),Z;try{Z=S(g,{bun_pty_spawn:{args:[x.cstring,x.cstring,x.cstring,x.i32,x.i32],returns:x.i32},bun_pty_write:{args:[x.i32,x.pointer,x.i32],returns:x.i32},bun_pty_read:{args:[x.i32,x.pointer,x.i32],returns:x.i32},bun_pty_resize:{args:[x.i32,x.i32,x.i32],returns:x.i32},bun_pty_kill:{args:[x.i32],returns:x.i32},bun_pty_get_pid:{args:[x.i32],returns:x.i32},bun_pty_get_exit_code:{args:[x.i32],returns:x.i32},bun_pty_close:{args:[x.i32],returns:x.void}})}catch(z){console.error("Failed to load lib",z)}class Q{handle=-1;_pid=-1;_cols=k;_rows=N;_name=B;_readLoop=!1;_closing=!1;_decoder=new TextDecoder("utf-8");_onData=new O;_onExit=new O;constructor(z=_,H=[],J={name:B}){this._cols=J.cols??k,this._rows=J.rows??N;let X=J.cwd??process.cwd(),V=[P(z),...H.map(P)].join(" "),$="";if(J.env)$=Object.entries(J.env).map(([K,w])=>`${K}=${w}`).join("\x00")+"\x00";if(this.handle=Z.symbols.bun_pty_spawn(G.from(`${V}\x00`,"utf8"),G.from(`${X}\x00`,"utf8"),G.from(`${$}\x00`,"utf8"),this._cols,this._rows),this.handle<0)throw Error("PTY spawn failed");this._pid=Z.symbols.bun_pty_get_pid(this.handle),this._startReadLoop()}get pid(){return this._pid}get cols(){return this._cols}get rows(){return this._rows}get process(){return"shell"}get onData(){return this._onData.event}get onExit(){return this._onExit.event}write(z){if(this._closing)return;let H=G.from(z,"utf8");Z.symbols.bun_pty_write(this.handle,M(H),H.length)}resize(z,H){if(this._closing)return;this._cols=z,this._rows=H,Z.symbols.bun_pty_resize(this.handle,z,H)}kill(z="SIGTERM"){if(this._closing)return;this._closing=!0,Z.symbols.bun_pty_kill(this.handle),Z.symbols.bun_pty_close(this.handle),this._onExit.fire({exitCode:0,signal:z})}async _startReadLoop(){if(this._readLoop)return;this._readLoop=!0;let z=G.allocUnsafe(4096);while(this._readLoop&&!this._closing){let H=Z.symbols.bun_pty_read(this.handle,M(z),z.length);if(H>0){let J=this._decoder.decode(z.subarray(0,H),{stream:!0});if(J)this._onData.fire(J)}else if(H===-2){let J=this._decoder.decode();if(J)this._onData.fire(J);let X=Z.symbols.bun_pty_get_exit_code(this.handle);this._onExit.fire({exitCode:X});break}else if(H<0){let J=this._decoder.decode();if(J)this._onData.fire(J);break}else await new Promise((J)=>setTimeout(J,8))}}}function D(z,H,J){return new Q(z,H,J)}function f(z,H,J){let X=D(z,H,J);return{pid:X.pid,onData(V){return X.onData(V)},onExit(V){return X.onExit(V)},write(V){X.write(V)},resize(V,$){X.resize(V,$)},kill(V){X.kill(V)}}}export{f as spawn};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ek as a,Fk as b,Gk as c,Hk as d,Ik as e,Jk as f,Kk as g,Lk as h,Mk as i,Nk as j}from"./chunk-tvw8tfpr.js";import"./chunk-8j3aw4qg.js";export{c as TreeCursor,b as Tree,f as Query,j as Parser,d as Node,i as MIN_COMPATIBLE_VERSION,a as LookaheadIterator,g as Language,h as LANGUAGE_VERSION,e as CaptureQuantifier};
|