sliccy 5.73.2 → 5.73.4
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/ui/assets/account-store-DwSzwLW8.js +43 -0
- package/dist/ui/assets/account-store-DzwZMcTg.js +101 -0
- package/dist/ui/assets/{adobe-DES2cp-y.js → adobe-ChyPg00A.js} +1 -1
- package/dist/ui/assets/{adobe-DHUcvdyP.js → adobe-h2gWq2z2.js} +1 -1
- package/dist/ui/assets/anthropic-messages-BFic5zKY.js +39 -0
- package/dist/ui/assets/anthropic-messages-C8dDJE2X.js +39 -0
- package/dist/ui/assets/{apps-DJx3akpR.js → apps-C86xnKLs.js} +1 -1
- package/dist/ui/assets/{azure-openai-D7xJ5VET.js → azure-openai-CjkdyGG4.js} +1 -1
- package/dist/ui/assets/{azure-openai-C3DSYzL8.js → azure-openai-DMNa-Eup.js} +1 -1
- package/dist/ui/assets/azure-openai-responses-B_twhN44.js +1 -0
- package/dist/ui/assets/azure-openai-responses-CzG7X9qb.js +1 -0
- package/dist/ui/assets/bedrock-camp-BO4bvAKs.js +1 -0
- package/dist/ui/assets/{bedrock-camp-PMQ4Iu6f.js → bedrock-camp-CVignIdH.js} +1 -1
- package/dist/ui/assets/{cerebras-CnOHiorM.js → cerebras-B0gvSD27.js} +1 -1
- package/dist/ui/assets/{cerebras-EsczMAGe.js → cerebras-CvSC_Q2O.js} +1 -1
- package/dist/ui/assets/compat-aVSWLlYQ.js +2 -0
- package/dist/ui/assets/{connect-surface-BTk8oHjU.js → connect-surface-3UvT0SF3.js} +1 -1
- package/dist/ui/assets/constrained-sampling-DafcjXU6.js +1 -0
- package/dist/ui/assets/{context-compaction-CW5AQ9bv.js → context-compaction-_UkD06XB.js} +1 -1
- package/dist/ui/assets/{fs-C_SqCSvP.js → fs-DC3MEAD4.js} +2 -2
- package/dist/ui/assets/{fs-PoNPHaXB.js → fs-DgMOH-Zj.js} +1 -1
- package/dist/ui/assets/{github-DF16zQXQ.js → github-HKW-k0Oh.js} +1 -1
- package/dist/ui/assets/{github-copilot-DiGxn4oA.js → github-copilot-C7lsRXxS.js} +1 -1
- package/dist/ui/assets/{github-copilot-DeMLYZUN.js → github-copilot-CBv0T4_S.js} +1 -1
- package/dist/ui/assets/{github-DjE0FC03.js → github-mH266f8L.js} +2 -2
- package/dist/ui/assets/google-generative-ai-4YtIu_sJ.js +1 -0
- package/dist/ui/assets/google-generative-ai-DzD1vsXe.js +1 -0
- package/dist/ui/assets/google-shared-BAKd3aSn.js +371 -0
- package/dist/ui/assets/google-shared-CCLlnqMF.js +11 -0
- package/dist/ui/assets/google-vertex-8lUayXF0.js +1 -0
- package/dist/ui/assets/google-vertex-oQOD3HKr.js +1 -0
- package/dist/ui/assets/js-realm-worker-BIrkB9d8.js +48 -0
- package/dist/ui/assets/{kernel-worker-C-tryBGn.js → kernel-worker-CHs5yDJo.js} +589 -591
- package/dist/ui/assets/{legacy-api-aliases-CRTuRAqQ.js → legacy-api-aliases-IllWZ-uu.js} +1 -1
- package/dist/ui/assets/{legacy-api-aliases-CdGTJw-r.js → legacy-api-aliases-sqlB2uHc.js} +1 -1
- package/dist/ui/assets/{lick-ws-bridge-C3foeWDS.js → lick-ws-bridge-DbbdXQSp.js} +1 -1
- package/dist/ui/assets/{local-llm-CWi0ZprP.js → local-llm-DcKgaorK.js} +2 -2
- package/dist/ui/assets/{local-llm-Dq9HBaqe.js → local-llm-DpBDM1Dm.js} +1 -1
- package/dist/ui/assets/{main-BMElPt_b.js → main-CBUfGcTh.js} +3 -3
- package/dist/ui/assets/mistral-conversations-C57IiFrP.js +8 -0
- package/dist/ui/assets/mistral-conversations-CzEm7KNl.js +7 -0
- package/dist/ui/assets/{mount-CAFjW1QS.js → mount-BHqxxbwU.js} +1 -1
- package/dist/ui/assets/{mount-C7OeghLh.js → mount-BRSg0FIY.js} +2 -2
- package/dist/ui/assets/{mount-recovery-B8VdqP8T.js → mount-recovery-Beig7gzz.js} +1 -1
- package/dist/ui/assets/{new-session-BwNVjrlp.js → new-session-UPnjrqyz.js} +2 -2
- package/dist/ui/assets/oauth-bootstrap-DUaR-il_.js +2 -0
- package/dist/ui/assets/{openai-codex-D9LHZUcr.js → openai-codex-CZit4W_R.js} +1 -1
- package/dist/ui/assets/openai-codex-D0W343kX.js +1 -0
- package/dist/ui/assets/openai-codex-responses-DRR6raXn.js +7 -0
- package/dist/ui/assets/openai-codex-responses-DU5CHdDQ.js +7 -0
- package/dist/ui/assets/openai-completions-B9S6450Q.js +5 -0
- package/dist/ui/assets/openai-completions-DhKgaAgM.js +5 -0
- package/dist/ui/assets/openai-responses-C4_jiYtu.js +1 -0
- package/dist/ui/assets/openai-responses-DmKhLxzV.js +1 -0
- package/dist/ui/assets/openai-responses-shared-CiIL52L-.js +10 -0
- package/dist/ui/assets/openai-responses-shared-IJFiSqdz.js +10 -0
- package/dist/ui/assets/{openrouter-BmRdV9UY.js → openrouter-D4iz9RSI.js} +1 -1
- package/dist/ui/assets/{openrouter-BIvugNQ1.js → openrouter-XorTuzAh.js} +1 -1
- package/dist/ui/assets/openrouter-images-6_MxZkJZ.js +1 -0
- package/dist/ui/assets/openrouter-images-BixC5B6a.js +1 -0
- package/dist/ui/assets/{openrouter-models-DM9v24kQ.js → openrouter-models-Bu1Cy5AD.js} +1 -1
- package/dist/ui/assets/{openrouter-models-B8MWxzTa.js → openrouter-models-CfnkMx5-.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-lGTI8QBz.js → openrouter-oauth-BGOdgzqm.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-QExY6Qo3.js → openrouter-oauth-BLGBWXoP.js} +1 -1
- package/dist/ui/assets/openrouter.models-DS1_VkCm.js +1 -0
- package/dist/ui/assets/openrouter.models-HnnH-abS.js +1 -0
- package/dist/ui/assets/{panel-rpc-handlers-SvYz4p6A.js → panel-rpc-handlers-BPMsj1iE.js} +2 -2
- package/dist/ui/assets/{provider-dLnW_Qmu.js → provider-DZ7x1aM4.js} +1 -1
- package/dist/ui/assets/{provider-CDDFVleF.js → provider-YxK-lzhm.js} +2 -2
- package/dist/ui/assets/provider-retry-C8PJzY_l.js +1 -0
- package/dist/ui/assets/{provider-settings-BonXlQHx.js → provider-settings-CmJnFmK2.js} +1 -1
- package/dist/ui/assets/provider-settings-D6FC6-Ws.js +2 -0
- package/dist/ui/assets/{provider-store-access-CDUXoK9n.js → provider-store-access-Bqa_EvEK.js} +2 -2
- package/dist/ui/assets/provider-store-access-Dw2dlNIf.js +1 -0
- package/dist/ui/assets/{providers-BE5wq_hp.js → providers-7r6dA4ra.js} +1 -1
- package/dist/ui/assets/{providers-B8AC4r1K.js → providers-Bklgdp4G.js} +2 -2
- package/dist/ui/assets/quick-llm-BHegEzYY.js +1 -0
- package/dist/ui/assets/{session-freezer-jCi1eAnA.js → session-freezer-oYKtZTY0.js} +3 -3
- package/dist/ui/assets/{setup-sudo-CglheNlM.js → setup-sudo-DGrMEyR3.js} +2 -2
- package/dist/ui/assets/{skills-B6K9VVT7.js → skills-DkHenAsV.js} +1 -1
- package/dist/ui/assets/{store-Dpqwm0j1.js → store-DICK08O4.js} +1 -1
- package/dist/ui/assets/{sudo-Bfbjy3cy.js → sudo-9mYhdwPD.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-DdRKki36.js → upgrade-detection-B8LfSgMb.js} +1 -1
- package/dist/ui/assets/{wc-extension-K9Yoj8xX.js → wc-extension-grYSDyJN.js} +2 -2
- package/dist/ui/assets/{wc-follower-BmFSgVpW.js → wc-follower-B6JesvuH.js} +3 -3
- package/dist/ui/assets/{wc-live-FQiVeP5H.js → wc-live-OHBNpb_A.js} +3 -3
- package/dist/ui/assets/{wc-nav-CPTHD9Gm.js → wc-nav-DcxqwpAS.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-Du7r32Nc.js → wc-onboarding-t5pRxVjL.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-qw9xzwIX.js → wc-placeholder-XW-qi_GD.js} +2 -2
- package/dist/ui/assets/{wc-settings-Dsqf_wFN.js → wc-settings-7Jj2UM15.js} +2 -2
- package/dist/ui/assets/{wc-shell-LFcAIFJQ.js → wc-shell-CoYCAmK-.js} +2 -2
- package/dist/ui/assets/{wc-sprinkles-CYSiEKaU.js → wc-sprinkles-CFaUt2sb.js} +2 -2
- package/dist/ui/assets/{wc-tray-Dg2nqNkH.js → wc-tray-C_yJiqov.js} +2 -2
- package/dist/ui/assets/xai-grok-CrEqywR8.js +1 -0
- package/dist/ui/assets/{xai-grok-D-owzioC.js → xai-grok-QulUPZS-.js} +1 -1
- package/dist/ui/index.html +10 -10
- package/dist/ui/packages/webapp/index.html +10 -10
- package/package.json +1 -1
- package/dist/ui/assets/account-store-1sWsdBXV.js +0 -38
- package/dist/ui/assets/account-store-DWKDZbQl.js +0 -94
- package/dist/ui/assets/amazon-bedrock-Cg62P8pR.json +0 -1
- package/dist/ui/assets/anthropic-4_qTN2Mu.json +0 -1
- package/dist/ui/assets/anthropic-messages-6XWFkWWy.js +0 -39
- package/dist/ui/assets/anthropic-messages-D42B1WVl.js +0 -39
- package/dist/ui/assets/azure-openai-responses-BvEv9lZE.js +0 -1
- package/dist/ui/assets/azure-openai-responses-DE9sINqp.json +0 -1
- package/dist/ui/assets/azure-openai-responses-DRSA640t.js +0 -1
- package/dist/ui/assets/bedrock-camp-D_7EbOFH.js +0 -1
- package/dist/ui/assets/cloudflare-ai-gateway-DDb7hKDm.json +0 -1
- package/dist/ui/assets/cloudflare-workers-ai-hYVOS3es.json +0 -1
- package/dist/ui/assets/compat-Spvv5tCW.js +0 -2
- package/dist/ui/assets/fireworks-B7kEGNCU.json +0 -1
- package/dist/ui/assets/github-copilot-K9C_HNHm.json +0 -1
- package/dist/ui/assets/google-F4XgvJ1y.json +0 -1
- package/dist/ui/assets/google-generative-ai-BqEHWDKc.js +0 -1
- package/dist/ui/assets/google-generative-ai-DOAY2Bef.js +0 -1
- package/dist/ui/assets/google-shared-2WQG4pNx.js +0 -11
- package/dist/ui/assets/google-shared-CGD-JGZx.js +0 -371
- package/dist/ui/assets/google-vertex-C-dQj0iH.js +0 -1
- package/dist/ui/assets/google-vertex-CiTExP0E.js +0 -1
- package/dist/ui/assets/huggingface-BjNadu0v.json +0 -1
- package/dist/ui/assets/js-realm-worker-BCzouR_m.js +0 -48
- package/dist/ui/assets/mistral-CLEcIOtP.json +0 -1
- package/dist/ui/assets/mistral-conversations-BIHTMTfL.js +0 -7
- package/dist/ui/assets/mistral-conversations-CFKNSaPt.js +0 -8
- package/dist/ui/assets/moonshotai-8QShYhhE.json +0 -1
- package/dist/ui/assets/moonshotai-cn-7hHZff5z.json +0 -1
- package/dist/ui/assets/nvidia-dA6GzUPm.json +0 -1
- package/dist/ui/assets/oauth-bootstrap-Bf7Ewk3g.js +0 -2
- package/dist/ui/assets/openai-BehvdaXx.json +0 -1
- package/dist/ui/assets/openai-codex-je7irmYi.js +0 -1
- package/dist/ui/assets/openai-codex-responses-B7cFMjWk.js +0 -7
- package/dist/ui/assets/openai-codex-responses-DqxoDEwc.js +0 -7
- package/dist/ui/assets/openai-completions-Z1aRkqWe.js +0 -5
- package/dist/ui/assets/openai-completions-o78dOizF.js +0 -5
- package/dist/ui/assets/openai-responses-SPfzkTJm.js +0 -1
- package/dist/ui/assets/openai-responses-shared-BHsJFKuB.js +0 -10
- package/dist/ui/assets/openai-responses-shared-Dg5Ojqlw.js +0 -10
- package/dist/ui/assets/openai-responses-xSdsW9lw.js +0 -1
- package/dist/ui/assets/opencode-4chvZrBR.json +0 -1
- package/dist/ui/assets/opencode-go-Chp1OOUx.json +0 -1
- package/dist/ui/assets/openrouter-ZLTwKIjA.json +0 -1
- package/dist/ui/assets/openrouter-images-BrQDTa3_.js +0 -1
- package/dist/ui/assets/openrouter-images-DtvjLeGK.js +0 -1
- package/dist/ui/assets/openrouter.models-Bi9GV7Zn.js +0 -1
- package/dist/ui/assets/openrouter.models-D41M1z_D.js +0 -1
- package/dist/ui/assets/provider-settings-BQ_ViD6o.js +0 -2
- package/dist/ui/assets/provider-store-access-B_M384kS.js +0 -1
- package/dist/ui/assets/quick-llm-j8Lw8DXh.js +0 -1
- package/dist/ui/assets/qwen-token-plan-BpxmzamU.json +0 -1
- package/dist/ui/assets/qwen-token-plan-cn-CPhDR0u_.json +0 -1
- package/dist/ui/assets/together-CYZ-lBBF.json +0 -1
- package/dist/ui/assets/vercel-ai-gateway-ZtkcQH_C.json +0 -1
- package/dist/ui/assets/xai-grok-BvvyCW-L.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./event-stream-qbAZIAKV.js";import{n as t,t as n}from"./models-Bnh9VDA1.js";import{t as r}from"./provider-env-D37PhSJu.js";import{r as i}from"./transform-messages-wECJwtH0.js";import{n as a}from"./headers-CbDaTl3c.js";import{t as o}from"./sanitize-unicode-DmIE6hZJ.js";import{n as s,t as c}from"./error-body-C0EnfbdK.js";import{a as l,c as u,i as d,l as f,n as p,o as m,r as h,s as g,t as _,u as v}from"./google-shared-CCLlnqMF.js";var y=`v1`,b=`gcp-vertex-credentials`,x={THINKING_LEVEL_UNSPECIFIED:v.THINKING_LEVEL_UNSPECIFIED,MINIMAL:v.MINIMAL,LOW:v.LOW,MEDIUM:v.MEDIUM,HIGH:v.HIGH},S=0,C=(t,r,i)=>{let a=new e;return(async()=>{let e={role:`assistant`,content:[],api:`google-vertex`,provider:t.provider,model:t.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`stop`,timestamp:Date.now()};try{let o=j(i),s=o?E(t,o,i?.headers):T(t,N(i),P(i),i?.headers,i?.env),c=F(t,r,i),l=await i?.onPayload?.(c,t);l!==void 0&&(c=l);let u=await s.models.generateContentStream(c);a.push({type:`start`,partial:e});let f=null,p=e.content,g=()=>p.length-1;for await(let r of u){e.responseId||=r.responseId;let i=r.candidates?.[0];if(i?.content?.parts)for(let t of i.content.parts){if(t.text!==void 0){let n=h(t);(!f||n&&f.type!==`thinking`||!n&&f.type!==`text`)&&(f&&(f.type===`text`?a.push({type:`text_end`,contentIndex:p.length-1,content:f.text,partial:e}):a.push({type:`thinking_end`,contentIndex:g(),content:f.thinking,partial:e})),n?(f={type:`thinking`,thinking:``,thinkingSignature:void 0},e.content.push(f),a.push({type:`thinking_start`,contentIndex:g(),partial:e})):(f={type:`text`,text:``},e.content.push(f),a.push({type:`text_start`,contentIndex:g(),partial:e}))),f.type===`thinking`?(f.thinking+=t.text,f.thinkingSignature=m(f.thinkingSignature,t.thoughtSignature),a.push({type:`thinking_delta`,contentIndex:g(),delta:t.text,partial:e})):(f.text+=t.text,f.textSignature=m(f.textSignature,t.thoughtSignature),a.push({type:`text_delta`,contentIndex:g(),delta:t.text,partial:e}))}if(t.functionCall){f&&=(f.type===`text`?a.push({type:`text_end`,contentIndex:g(),content:f.text,partial:e}):a.push({type:`thinking_end`,contentIndex:g(),content:f.thinking,partial:e}),null);let n=t.functionCall.id,r={type:`toolCall`,id:!n||e.content.some(e=>e.type===`toolCall`&&e.id===n)?`${t.functionCall.name}_${Date.now()}_${++S}`:n,name:t.functionCall.name||``,arguments:t.functionCall.args??{},...t.thoughtSignature&&{thoughtSignature:t.thoughtSignature}};e.content.push(r),a.push({type:`toolcall_start`,contentIndex:g(),partial:e}),a.push({type:`toolcall_delta`,contentIndex:g(),delta:JSON.stringify(r.arguments),partial:e}),a.push({type:`toolcall_end`,contentIndex:g(),toolCall:r,partial:e})}}i?.finishReason&&(e.stopReason=d(i.finishReason),e.content.some(e=>e.type===`toolCall`)&&(e.stopReason=`toolUse`)),r.usageMetadata&&(e.usage={input:(r.usageMetadata.promptTokenCount||0)-(r.usageMetadata.cachedContentTokenCount||0),output:(r.usageMetadata.candidatesTokenCount||0)+(r.usageMetadata.thoughtsTokenCount||0),cacheRead:r.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:r.usageMetadata.thoughtsTokenCount||0,totalTokens:r.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},n(t,e.usage))}if(f&&(f.type===`text`?a.push({type:`text_end`,contentIndex:g(),content:f.text,partial:e}):a.push({type:`thinking_end`,contentIndex:g(),content:f.thinking,partial:e})),i?.signal?.aborted)throw Error(`Request was aborted`);if(e.stopReason===`aborted`||e.stopReason===`error`)throw Error(`An unknown error occurred`);a.push({type:`done`,reason:e.stopReason,message:e}),a.end()}catch(t){for(let t of e.content)`index`in t&&delete t.index;e.stopReason=i?.signal?.aborted?`aborted`:`error`,e.errorMessage=c(s(t)),a.push({type:`error`,reason:e.stopReason,error:e}),a.end()}})(),a},w=(e,n,r)=>{let a=i(e,n,r,void 0);if(!r?.reasoning)return C(e,n,{...a,thinking:{enabled:!1}});let o=t(e,r.reasoning),s=o===`off`?`high`:o,c=e;return I(c)||L(c)?C(e,n,{...a,thinking:{enabled:!0,level:z(s,c)}}):C(e,n,{...a,thinking:{enabled:!0,budgetTokens:B(c,s,r.thinkingBudgets)}})};function T(e,t,n,r,i){let a=A(i);return new u({vertexai:!0,project:t,location:n,apiVersion:y,...a?{googleAuthOptions:a}:{},httpOptions:D(e,r)})}function E(e,t,n){return new u({vertexai:!0,apiKey:t,apiVersion:y,httpOptions:D(e,n)})}function D(e,t){let n={},r=O(e.baseUrl);r&&(n.baseUrl=r,n.baseUrlResourceScope=f.COLLECTION,k(r)&&(n.apiVersion=``));let i=a({...e.headers,...t});return i&&(n.headers=i),Object.keys(n).length>0?n:void 0}function O(e){let t=e.trim();if(!(!t||t.includes(`{location}`)))return t}function k(e){try{return new URL(e).pathname.split(`/`).some(e=>/^v\d+(?:beta\d*)?$/.test(e))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(e)}}function A(e){let t=r(`GOOGLE_APPLICATION_CREDENTIALS`,e);return t?{keyFilename:t}:void 0}function j(e){let t=e?.apiKey?.trim();if(!(!t||t===b||M(t)))return t}function M(e){return/^<[^>]+>$/.test(e)}function N(e){let t=e?.project||r(`GOOGLE_CLOUD_PROJECT`,e?.env)||r(`GCLOUD_PROJECT`,e?.env);if(!t)throw Error(`Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.`);return t}function P(e){let t=e?.location||r(`GOOGLE_CLOUD_LOCATION`,e?.env);if(!t)throw Error(`Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.`);return t}function F(e,t,n={}){let r=_(e,t),i={};n.temperature!==void 0&&(i.temperature=n.temperature),n.maxTokens!==void 0&&(i.maxOutputTokens=n.maxTokens);let a=t.tools?.length?l(t.tools,n.toolChoice,g(e.id)):void 0,s={...Object.keys(i).length>0&&i,...t.systemPrompt&&{systemInstruction:o(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:p(t.tools)},...a!==void 0&&{toolConfig:{functionCallingConfig:{mode:a}}}};if(n.thinking?.enabled&&e.reasoning){let e={includeThoughts:!0};n.thinking.level===void 0?n.thinking.budgetTokens!==void 0&&(e.thinkingBudget=n.thinking.budgetTokens):e.thinkingLevel=x[n.thinking.level],s.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(s.thinkingConfig=R(e));if(n.signal){if(n.signal.aborted)throw Error(`Request aborted`);s.abortSignal=n.signal}return{model:e.id,contents:r,config:s}}function I(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function L(e){let t=e.id.toLowerCase();return/gemini-3(?:\.\d+)?-flash/.test(t)||t===`gemini-flash-latest`||t===`gemini-flash-lite-latest`}function R(e){let t=e;return I(t)?{thinkingLevel:v.LOW}:L(t)?{thinkingLevel:v.MINIMAL}:{thinkingBudget:0}}function z(e,t){if(I(t))switch(e){case`minimal`:case`low`:return`LOW`;case`medium`:case`high`:return`HIGH`}switch(e){case`minimal`:return`MINIMAL`;case`low`:return`LOW`;case`medium`:return`MEDIUM`;case`high`:return`HIGH`}}function B(e,t,n){return n?.[t]===void 0?e.id.includes(`2.5-pro`)?{minimal:128,low:2048,medium:8192,high:32768}[t]:e.id.includes(`2.5-flash`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{C as stream,w as streamSimple};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./event-stream-qbAZIAKV.js";import{o as t,r as n,s as r}from"./transform-messages-Bp94o3FD.js";import{t as i}from"./provider-env-DwY8YuMk.js";import{n as a}from"./headers-CbDaTl3c.js";import{t as o}from"./sanitize-unicode-DmIE6hZJ.js";import{n as s,t as c}from"./error-body-C0EnfbdK.js";import{a as l,c as u,i as d,l as f,n as p,o as m,r as h,s as g,t as _,u as v}from"./google-shared-BAKd3aSn.js";const y={THINKING_LEVEL_UNSPECIFIED:v.THINKING_LEVEL_UNSPECIFIED,MINIMAL:v.MINIMAL,LOW:v.LOW,MEDIUM:v.MEDIUM,HIGH:v.HIGH};let b=0;const x=(n,r,i)=>{let a=new e;return(async()=>{let e={role:`assistant`,content:[],api:`google-vertex`,provider:n.provider,model:n.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`stop`,timestamp:Date.now()};try{let o=k(i),s=o?w(n,o,i?.headers):C(n,j(i),M(i),i?.headers,i?.env),c=N(n,r,i),l=await i?.onPayload?.(c,n);l!==void 0&&(c=l);let u=await s.models.generateContentStream(c);a.push({type:`start`,partial:e});let f=null,p=e.content,g=()=>p.length-1;for await(let r of u){e.responseId||=r.responseId;let i=r.candidates?.[0];if(i?.content?.parts)for(let t of i.content.parts){if(t.text!==void 0){let n=h(t);(!f||n&&f.type!==`thinking`||!n&&f.type!==`text`)&&(f&&(f.type===`text`?a.push({type:`text_end`,contentIndex:p.length-1,content:f.text,partial:e}):a.push({type:`thinking_end`,contentIndex:g(),content:f.thinking,partial:e})),n?(f={type:`thinking`,thinking:``,thinkingSignature:void 0},e.content.push(f),a.push({type:`thinking_start`,contentIndex:g(),partial:e})):(f={type:`text`,text:``},e.content.push(f),a.push({type:`text_start`,contentIndex:g(),partial:e}))),f.type===`thinking`?(f.thinking+=t.text,f.thinkingSignature=m(f.thinkingSignature,t.thoughtSignature),a.push({type:`thinking_delta`,contentIndex:g(),delta:t.text,partial:e})):(f.text+=t.text,f.textSignature=m(f.textSignature,t.thoughtSignature),a.push({type:`text_delta`,contentIndex:g(),delta:t.text,partial:e}))}if(t.functionCall){f&&=(f.type===`text`?a.push({type:`text_end`,contentIndex:g(),content:f.text,partial:e}):a.push({type:`thinking_end`,contentIndex:g(),content:f.thinking,partial:e}),null);let n=t.functionCall.id,r={type:`toolCall`,id:!n||e.content.some(e=>e.type===`toolCall`&&e.id===n)?`${t.functionCall.name}_${Date.now()}_${++b}`:n,name:t.functionCall.name||``,arguments:t.functionCall.args??{},...t.thoughtSignature&&{thoughtSignature:t.thoughtSignature}};e.content.push(r),a.push({type:`toolcall_start`,contentIndex:g(),partial:e}),a.push({type:`toolcall_delta`,contentIndex:g(),delta:JSON.stringify(r.arguments),partial:e}),a.push({type:`toolcall_end`,contentIndex:g(),toolCall:r,partial:e})}}i?.finishReason&&(e.stopReason=d(i.finishReason),e.content.some(e=>e.type===`toolCall`)&&(e.stopReason=`toolUse`)),r.usageMetadata&&(e.usage={input:(r.usageMetadata.promptTokenCount||0)-(r.usageMetadata.cachedContentTokenCount||0),output:(r.usageMetadata.candidatesTokenCount||0)+(r.usageMetadata.thoughtsTokenCount||0),cacheRead:r.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:r.usageMetadata.thoughtsTokenCount||0,totalTokens:r.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},t(n,e.usage))}if(f&&(f.type===`text`?a.push({type:`text_end`,contentIndex:g(),content:f.text,partial:e}):a.push({type:`thinking_end`,contentIndex:g(),content:f.thinking,partial:e})),i?.signal?.aborted)throw Error(`Request was aborted`);if(e.stopReason===`aborted`||e.stopReason===`error`)throw Error(`An unknown error occurred`);a.push({type:`done`,reason:e.stopReason,message:e}),a.end()}catch(t){for(let t of e.content)`index`in t&&delete t.index;e.stopReason=i?.signal?.aborted?`aborted`:`error`,e.errorMessage=c(s(t)),a.push({type:`error`,reason:e.stopReason,error:e}),a.end()}})(),a},S=(e,t,i)=>{let a=n(e,t,i,void 0);if(!i?.reasoning)return x(e,t,{...a,thinking:{enabled:!1}});let o=r(e,i.reasoning),s=o===`off`?`high`:o,c=e;return P(c)||F(c)?x(e,t,{...a,thinking:{enabled:!0,level:L(s,c)}}):x(e,t,{...a,thinking:{enabled:!0,budgetTokens:R(c,s,i.thinkingBudgets)}})};function C(e,t,n,r,i){let a=O(i);return new u({vertexai:!0,project:t,location:n,apiVersion:`v1`,...a?{googleAuthOptions:a}:{},httpOptions:T(e,r)})}function w(e,t,n){return new u({vertexai:!0,apiKey:t,apiVersion:`v1`,httpOptions:T(e,n)})}function T(e,t){let n={},r=E(e.baseUrl);r&&(n.baseUrl=r,n.baseUrlResourceScope=f.COLLECTION,D(r)&&(n.apiVersion=``));let i=a({...e.headers,...t});return i&&(n.headers=i),Object.keys(n).length>0?n:void 0}function E(e){let t=e.trim();if(!(!t||t.includes(`{location}`)))return t}function D(e){try{return new URL(e).pathname.split(`/`).some(e=>/^v\d+(?:beta\d*)?$/.test(e))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(e)}}function O(e){let t=i(`GOOGLE_APPLICATION_CREDENTIALS`,e);return t?{keyFilename:t}:void 0}function k(e){let t=e?.apiKey?.trim();if(!(!t||t===`gcp-vertex-credentials`||A(t)))return t}function A(e){return/^<[^>]+>$/.test(e)}function j(e){let t=e?.project||i(`GOOGLE_CLOUD_PROJECT`,e?.env)||i(`GCLOUD_PROJECT`,e?.env);if(!t)throw Error(`Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.`);return t}function M(e){let t=e?.location||i(`GOOGLE_CLOUD_LOCATION`,e?.env);if(!t)throw Error(`Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.`);return t}function N(e,t,n={}){let r=_(e,t),i={};n.temperature!==void 0&&(i.temperature=n.temperature),n.maxTokens!==void 0&&(i.maxOutputTokens=n.maxTokens);let a=t.tools?.length?l(t.tools,n.toolChoice,g(e.id)):void 0,s={...Object.keys(i).length>0&&i,...t.systemPrompt&&{systemInstruction:o(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:p(t.tools)},...a!==void 0&&{toolConfig:{functionCallingConfig:{mode:a}}}};if(n.thinking?.enabled&&e.reasoning){let e={includeThoughts:!0};n.thinking.level===void 0?n.thinking.budgetTokens!==void 0&&(e.thinkingBudget=n.thinking.budgetTokens):e.thinkingLevel=y[n.thinking.level],s.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(s.thinkingConfig=I(e));if(n.signal){if(n.signal.aborted)throw Error(`Request aborted`);s.abortSignal=n.signal}return{model:e.id,contents:r,config:s}}function P(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function F(e){let t=e.id.toLowerCase();return/gemini-3(?:\.\d+)?-flash/.test(t)||t===`gemini-flash-latest`||t===`gemini-flash-lite-latest`}function I(e){let t=e;return P(t)?{thinkingLevel:v.LOW}:F(t)?{thinkingLevel:v.MINIMAL}:{thinkingBudget:0}}function L(e,t){if(P(t))switch(e){case`minimal`:case`low`:return`LOW`;case`medium`:case`high`:return`HIGH`}switch(e){case`minimal`:return`MINIMAL`;case`low`:return`LOW`;case`medium`:return`MEDIUM`;case`high`:return`HIGH`}}function R(e,t,n){return n?.[t]===void 0?e.id.includes(`2.5-pro`)?{minimal:128,low:2048,medium:8192,high:32768}[t]:e.id.includes(`2.5-flash`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{x as stream,S as streamSimple};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),t=e((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f;for(f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),n=e((e=>{
|
|
2
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
3
|
+
e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),r=e((e=>{
|
|
4
|
+
/*!
|
|
5
|
+
* The buffer module from node.js, for the browser.
|
|
6
|
+
*
|
|
7
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
8
|
+
* @license MIT
|
|
9
|
+
*/
|
|
10
|
+
let r=t(),i=n(),a=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=l,e.SlowBuffer=b,e.INSPECT_MAX_BYTES=50;let o=2147483647;e.kMaxLength=o,l.TYPED_ARRAY_SUPPORT=s(),!l.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function c(e){if(e>o)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return p(e)}return u(e,t,n)}l.poolSize=8192;function u(e,t,n){if(typeof e==`string`)return m(e,t);if(ArrayBuffer.isView(e))return g(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(P(e,ArrayBuffer)||e&&P(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(P(e,SharedArrayBuffer)||e&&P(e.buffer,SharedArrayBuffer)))return _(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return l.from(r,t,n);let i=v(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return l.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}l.from=function(e,t,n){return u(e,t,n)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function d(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function f(e,t,n){return d(e),e<=0||t===void 0?c(e):typeof n==`string`?c(e).fill(t,n):c(e).fill(t)}l.alloc=function(e,t,n){return f(e,t,n)};function p(e){return d(e),c(e<0?0:y(e)|0)}l.allocUnsafe=function(e){return p(e)},l.allocUnsafeSlow=function(e){return p(e)};function m(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!l.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=x(e,t)|0,r=c(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function h(e){let t=e.length<0?0:y(e.length)|0,n=c(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function g(e){if(P(e,Uint8Array)){let t=new Uint8Array(e);return _(t.buffer,t.byteOffset,t.byteLength)}return h(e)}function _(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,l.prototype),r}function v(e){if(l.isBuffer(e)){let t=y(e.length)|0,n=c(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||Ee(e.length)?c(0):h(e);if(e.type===`Buffer`&&Array.isArray(e.data))return h(e.data)}function y(e){if(e>=o)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+o.toString(16)+` bytes`);return e|0}function b(e){return+e!=e&&(e=0),l.alloc(+e)}l.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==l.prototype},l.compare=function(e,t){if(P(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),P(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},l.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return l.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=l.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(P(t,Uint8Array))i+t.length>r.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(l.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function x(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||P(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return xe(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return we(e).length;default:if(i)return r?-1:xe(e).length;t=(``+t).toLowerCase(),i=!0}}l.byteLength=x;function S(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return se(this,t,n);case`utf8`:case`utf-8`:return ne(this,t,n);case`ascii`:return ae(this,t,n);case`latin1`:case`binary`:return oe(this,t,n);case`base64`:return te(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return ce(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}l.prototype._isBuffer=!0;function C(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}l.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)C(this,t,t+1);return this},l.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)C(this,t,t+3),C(this,t+1,t+2);return this},l.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)C(this,t,t+7),C(this,t+1,t+6),C(this,t+2,t+5),C(this,t+3,t+4);return this},l.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?ne(this,0,e):S.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||l.compare(this,e)===0},l.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},a&&(l.prototype[a]=l.prototype.inspect),l.prototype.compare=function(e,t,n,r,i){if(P(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,s=Math.min(a,o),c=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<s;++e)if(c[e]!==u[e]){a=c[e],o=u[e];break}return a<o?-1:+(o<a)};function w(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Ee(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=l.from(t,r)),l.isBuffer(t))return t.length===0?-1:T(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):T(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function T(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}l.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},l.prototype.indexOf=function(e,t,n){return w(this,e,t,n,!0)},l.prototype.lastIndexOf=function(e,t,n){return w(this,e,t,n,!1)};function E(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(Ee(r))return o;e[n+o]=r}return o}function D(e,t,n,r){return Te(xe(t,e.length-n),e,n,r)}function O(e,t,n,r){return Te(Se(t),e,n,r)}function ee(e,t,n,r){return Te(we(t),e,n,r)}function k(e,t,n,r){return Te(Ce(t,e.length-n),e,n,r)}l.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return E(this,e,t,n);case`utf8`:case`utf-8`:return D(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return O(this,e,t,n);case`base64`:return ee(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return k(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},l.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function te(e,t,n){return t===0&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function ne(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return ie(r)}let re=4096;function ie(e){let t=e.length;if(t<=re)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=re));return n}function ae(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function oe(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function se(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=De[e[r]];return i}function ce(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}l.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,l.prototype),r};function A(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=F(function(e){e>>>=0,ve(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&N(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),l.prototype.readBigUInt64BE=F(function(e){e>>>=0,ve(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&N(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),l.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},l.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||A(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},l.prototype.readInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||A(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},l.prototype.readInt16BE=function(e,t){e>>>=0,t||A(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=F(function(e){e>>>=0,ve(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&N(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),l.prototype.readBigInt64BE=F(function(e){e>>>=0,ve(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&N(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||A(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||A(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||A(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||A(e,8,this.length),i.read(this,e,!1,52,8)};function j(e,t,n,r,i,a){if(!l.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;j(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;j(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,1,255,0),this[t]=e&255,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function le(e,t,n,r,i){_e(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function ue(e,t,n,r,i){_e(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}l.prototype.writeBigUInt64LE=F(function(e,t=0){return le(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),l.prototype.writeBigUInt64BE=F(function(e,t=0){return ue(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);j(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);j(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},l.prototype.writeBigInt64LE=F(function(e,t=0){return le(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),l.prototype.writeBigInt64BE=F(function(e,t=0){return ue(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function de(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function fe(e,t,n,r,a){return t=+t,n>>>=0,a||de(e,t,n,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,n,r,23,4),n+4}l.prototype.writeFloatLE=function(e,t,n){return fe(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return fe(this,e,t,!1,n)};function pe(e,t,n,r,a){return t=+t,n>>>=0,a||de(e,t,n,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,n,r,52,8),n+8}l.prototype.writeDoubleLE=function(e,t,n){return pe(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return pe(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(!l.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},l.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!l.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=l.isBuffer(e)?e:l.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let M={};function me(e,t,n){M[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}me(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),me(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),me(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=he(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=he(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function he(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function ge(e,t,n){ve(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&N(t,e.length-(n+1))}function _e(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new M.ERR_OUT_OF_RANGE(`value`,i,e)}ge(r,i,a)}function ve(e,t){if(typeof e!=`number`)throw new M.ERR_INVALID_ARG_TYPE(t,`number`,e)}function N(e,t,n){throw Math.floor(e)===e?t<0?new M.ERR_BUFFER_OUT_OF_BOUNDS:new M.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(ve(e,n),new M.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let ye=/[^+/0-9A-Za-z-_]/g;function be(e){if(e=e.split(`=`)[0],e=e.trim().replace(ye,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function xe(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function Se(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function Ce(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function we(e){return r.toByteArray(be(e))}function Te(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function P(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Ee(e){return e!==e}let De=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function F(e){return typeof BigInt>`u`?Oe:e}function Oe(){throw Error(`BigInt not supported`)}})),i=r();globalThis.Buffer===void 0&&(globalThis.Buffer=i.Buffer);var a=class extends Error{status;statusText;url;body;constructor(e,t,n,r){let i=typeof r==`string`&&r?`: ${r.slice(0,200)}`:r&&typeof r==`object`?`: ${o(r).slice(0,200)}`:``;super(`HTTP ${e} ${t} ${n}${i}`),this.status=e,this.statusText=t,this.url=n,this.body=r,this.name=`HttpError`}};function o(e){try{return JSON.stringify(e)}catch{return String(e)}}function s(e){return new Promise(t=>setTimeout(t,e))}function c(e,t,n){let r;if(r=/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:e?`${e.endsWith(`/`)?e.slice(0,-1):e}${t.startsWith(`/`)?t:`/${t}`}`:t,!n)return r;let i=[];for(let[e,t]of Object.entries(n))if(t!=null)if(Array.isArray(t))for(let n of t)n!=null&&i.push(`${encodeURIComponent(e)}=${encodeURIComponent(String(n))}`);else i.push(`${encodeURIComponent(e)}=${encodeURIComponent(String(t))}`);return i.length===0?r:r+(r.includes(`?`)?`&`:`?`)+i.join(`&`)}function l(e,t){let n={};if(e)for(let[t,r]of Object.entries(e))n[t]=r;if(t)for(let[e,r]of Object.entries(t))n[e]=r;return n}function u(e){if(!e)return!1;let t=e.toLowerCase();return t.startsWith(`application/json`)||/[+/]json(;|$|\s)/.test(t)}function d(e){if(!e)return null;let t=e.trim();if(!t)return null;if(/^\d+(\.\d+)?$/.test(t)){let e=Number(t);if(Number.isFinite(e)&&e>=0)return Math.round(e*1e3)}let n=Date.parse(t);if(Number.isFinite(n)){let e=n-Date.now();return e>0?e:0}return null}async function f(e){if(u(e.headers.get(`content-type`))){let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return t}}return e.text()}function p(e,t){if(e!=null)return typeof e==`string`||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof Blob<`u`&&e instanceof Blob||typeof FormData<`u`&&e instanceof FormData||typeof URLSearchParams<`u`&&e instanceof URLSearchParams||typeof ReadableStream<`u`&&e instanceof ReadableStream?e:typeof e==`object`?(Object.keys(t).some(e=>e.toLowerCase()===`content-type`)||(t[`Content-Type`]=`application/json`),JSON.stringify(e)):String(e)}function m(e){let t=e.sleep??s;function n(n){let r=new Set(n.retry?.on??[]),i=Math.max(1,Math.trunc(n.retry?.maxAttempts??1));async function o(o,s,u={}){let m=c(n.baseUrl,s,u.params),h=l(n.headers,u.headers);if(n.token){let e=await n.token({method:o,path:s,url:m});e&&(Object.keys(h).some(e=>e.toLowerCase()===`authorization`)||(h.Authorization=`Bearer ${e}`))}let g=p(u.body,h),_={method:o,headers:h};g!==void 0&&(_.body=g);let v=null;for(let o=0;o<i;o++){let s=n.timeoutMs?new AbortController:null,c=s?setTimeout(()=>s.abort(Error(`timeout`)),n.timeoutMs):null,l=u.signal&&s?.signal?AbortSignal.any([u.signal,s.signal]):u.signal??s?.signal,p=l?{..._,signal:l}:_,h;try{h=await e.fetch(m,p)}finally{c!==null&&clearTimeout(c)}if(v=h,h.ok){let e=await f(h);return u.raw?{body:e,headers:Object.fromEntries(h.headers.entries()),status:h.status}:e}if(!(o+1<i&&r.has(h.status))){let e=await f(h).catch(()=>null);throw new a(h.status,h.statusText,m,e)}let g=d(h.headers.get(`retry-after`)),y=500*2**o;await t(g===null?y:g)}if(v){let e=await f(v).catch(()=>null);throw new a(v.status,v.statusText,m,e)}throw Error(`http: no attempts made for ${o} ${m}`)}return Object.freeze({get:((e,t)=>o(`GET`,e,t)),post:((e,t)=>o(`POST`,e,t)),put:((e,t)=>o(`PUT`,e,t)),patch:((e,t)=>o(`PATCH`,e,t)),delete:((e,t)=>o(`DELETE`,e,t))})}return Object.freeze({client:n})}function h(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var g={exports:{}};
|
|
11
|
+
/**
|
|
12
|
+
* [js-md5]{@link https://github.com/emn178/js-md5}
|
|
13
|
+
*
|
|
14
|
+
* @namespace md5
|
|
15
|
+
* @version 0.9.0
|
|
16
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
17
|
+
* @copyright Chen, Yi-Cyuan 2014-2026
|
|
18
|
+
* @license MIT
|
|
19
|
+
*/
|
|
20
|
+
(function(e){(function(){var t=`input is invalid type`,n=typeof window==`object`,r=n?window:{};r.JS_MD5_NO_WINDOW&&(n=!1),!n&&typeof self==`object`&&(r=self);var i=!r.JS_MD5_NO_COMMON_JS&&e.exports,a=!r.JS_MD5_NO_ARRAY_BUFFER&&typeof ArrayBuffer<`u`,o=`0123456789abcdef`.split(``),s=[128,32768,8388608,-2147483648],c=[0,8,16,24],l=[`hex`,`array`,`digest`,`arrayBuffer`];l.push(`buffer`),l.push(`base64`);var u=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``),d=[],f;if(a){var p=new ArrayBuffer(68);f=new Uint8Array(p),d=new Uint32Array(p)}var m=Array.isArray;(r.JS_MD5_NO_NODE_JS||!m)&&(m=function(e){return Object.prototype.toString.call(e)===`[object Array]`});var h=ArrayBuffer.isView;a&&(r.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW||!h)&&(h=function(e){return typeof e==`object`&&e.buffer&&e.buffer.constructor===ArrayBuffer});var g=function(e){var n=typeof e;if(n===`string`)return[e,!0];if(n!==`object`||e===null)throw Error(t);if(a&&e.constructor===ArrayBuffer)return[new Uint8Array(e),!1];if(!m(e)&&!h(e))throw Error(t);return[e,!1]},_=function(e){return function(t){return new x(!0).update(t)[e]()}},v=function(){var e=_(`hex`);e.create=function(){return new x},e.update=function(t){return e.create().update(t)};for(var t=0;t<l.length;++t){var n=l[t];e[n]=_(n)}return e},y=function(e){return function(t,n){return new S(t,!0).update(n)[e]()}},b=function(){var e=y(`hex`);e.create=function(e){return new S(e)},e.update=function(t,n){return e.create(t).update(n)};for(var t=0;t<l.length;++t){var n=l[t];e[n]=y(n)}return e};function x(e){if(e)d[0]=d[16]=d[1]=d[2]=d[3]=d[4]=d[5]=d[6]=d[7]=d[8]=d[9]=d[10]=d[11]=d[12]=d[13]=d[14]=d[15]=0,this.blocks=d,this.buffer8=f;else if(a){var t=new ArrayBuffer(68);this.buffer8=new Uint8Array(t),this.blocks=new Uint32Array(t)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}x.prototype.update=function(e){if(this.finalized)throw Error(`finalize already called`);var t=g(e);e=t[0];for(var n=t[1],r,i=0,o,s=e.length,l=this.blocks,u=this.buffer8;i<s;){if(this.hashed&&(this.hashed=!1,l[0]=l[16],l[16]=l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=0),n)if(a)for(o=this.start;i<s&&o<64;++i)r=e.charCodeAt(i),r<128?u[o++]=r:r<2048?(u[o++]=192|r>>>6,u[o++]=128|r&63):r<55296||r>=57344?(u[o++]=224|r>>>12,u[o++]=128|r>>>6&63,u[o++]=128|r&63):(r=65536+((r&1023)<<10|e.charCodeAt(++i)&1023),u[o++]=240|r>>>18,u[o++]=128|r>>>12&63,u[o++]=128|r>>>6&63,u[o++]=128|r&63);else for(o=this.start;i<s&&o<64;++i)r=e.charCodeAt(i),r<128?l[o>>>2]|=r<<c[o++&3]:r<2048?(l[o>>>2]|=(192|r>>>6)<<c[o++&3],l[o>>>2]|=(128|r&63)<<c[o++&3]):r<55296||r>=57344?(l[o>>>2]|=(224|r>>>12)<<c[o++&3],l[o>>>2]|=(128|r>>>6&63)<<c[o++&3],l[o>>>2]|=(128|r&63)<<c[o++&3]):(r=65536+((r&1023)<<10|e.charCodeAt(++i)&1023),l[o>>>2]|=(240|r>>>18)<<c[o++&3],l[o>>>2]|=(128|r>>>12&63)<<c[o++&3],l[o>>>2]|=(128|r>>>6&63)<<c[o++&3],l[o>>>2]|=(128|r&63)<<c[o++&3]);else if(a)for(o=this.start;i<s&&o<64;++i)u[o++]=e[i];else for(o=this.start;i<s&&o<64;++i)l[o>>>2]|=e[i]<<c[o++&3];this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes%=4294967296),this},x.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[t>>>2]|=s[t&3],t>=56&&(this.hashed||this.hash(),e[0]=e[16],e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.bytes<<3,e[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},x.prototype.hash=function(){var e,t,n,r,i,a,o=this.blocks;this.first?(e=o[0]-680876937,e=(e<<7|e>>>25)-271733879<<0,r=(-1732584194^e&2004318071)+o[1]-117830708,r=(r<<12|r>>>20)+e<<0,n=(-271733879^r&(e^-271733879))+o[2]-1126478375,n=(n<<17|n>>>15)+r<<0,t=(e^n&(r^e))+o[3]-1316259209,t=(t<<22|t>>>10)+n<<0):(e=this.h0,t=this.h1,n=this.h2,r=this.h3,e+=(r^t&(n^r))+o[0]-680876936,e=(e<<7|e>>>25)+t<<0,r+=(n^e&(t^n))+o[1]-389564586,r=(r<<12|r>>>20)+e<<0,n+=(t^r&(e^t))+o[2]+606105819,n=(n<<17|n>>>15)+r<<0,t+=(e^n&(r^e))+o[3]-1044525330,t=(t<<22|t>>>10)+n<<0),e+=(r^t&(n^r))+o[4]-176418897,e=(e<<7|e>>>25)+t<<0,r+=(n^e&(t^n))+o[5]+1200080426,r=(r<<12|r>>>20)+e<<0,n+=(t^r&(e^t))+o[6]-1473231341,n=(n<<17|n>>>15)+r<<0,t+=(e^n&(r^e))+o[7]-45705983,t=(t<<22|t>>>10)+n<<0,e+=(r^t&(n^r))+o[8]+1770035416,e=(e<<7|e>>>25)+t<<0,r+=(n^e&(t^n))+o[9]-1958414417,r=(r<<12|r>>>20)+e<<0,n+=(t^r&(e^t))+o[10]-42063,n=(n<<17|n>>>15)+r<<0,t+=(e^n&(r^e))+o[11]-1990404162,t=(t<<22|t>>>10)+n<<0,e+=(r^t&(n^r))+o[12]+1804603682,e=(e<<7|e>>>25)+t<<0,r+=(n^e&(t^n))+o[13]-40341101,r=(r<<12|r>>>20)+e<<0,n+=(t^r&(e^t))+o[14]-1502002290,n=(n<<17|n>>>15)+r<<0,t+=(e^n&(r^e))+o[15]+1236535329,t=(t<<22|t>>>10)+n<<0,e+=(n^r&(t^n))+o[1]-165796510,e=(e<<5|e>>>27)+t<<0,r+=(t^n&(e^t))+o[6]-1069501632,r=(r<<9|r>>>23)+e<<0,n+=(e^t&(r^e))+o[11]+643717713,n=(n<<14|n>>>18)+r<<0,t+=(r^e&(n^r))+o[0]-373897302,t=(t<<20|t>>>12)+n<<0,e+=(n^r&(t^n))+o[5]-701558691,e=(e<<5|e>>>27)+t<<0,r+=(t^n&(e^t))+o[10]+38016083,r=(r<<9|r>>>23)+e<<0,n+=(e^t&(r^e))+o[15]-660478335,n=(n<<14|n>>>18)+r<<0,t+=(r^e&(n^r))+o[4]-405537848,t=(t<<20|t>>>12)+n<<0,e+=(n^r&(t^n))+o[9]+568446438,e=(e<<5|e>>>27)+t<<0,r+=(t^n&(e^t))+o[14]-1019803690,r=(r<<9|r>>>23)+e<<0,n+=(e^t&(r^e))+o[3]-187363961,n=(n<<14|n>>>18)+r<<0,t+=(r^e&(n^r))+o[8]+1163531501,t=(t<<20|t>>>12)+n<<0,e+=(n^r&(t^n))+o[13]-1444681467,e=(e<<5|e>>>27)+t<<0,r+=(t^n&(e^t))+o[2]-51403784,r=(r<<9|r>>>23)+e<<0,n+=(e^t&(r^e))+o[7]+1735328473,n=(n<<14|n>>>18)+r<<0,t+=(r^e&(n^r))+o[12]-1926607734,t=(t<<20|t>>>12)+n<<0,i=t^n,e+=(i^r)+o[5]-378558,e=(e<<4|e>>>28)+t<<0,r+=(i^e)+o[8]-2022574463,r=(r<<11|r>>>21)+e<<0,a=r^e,n+=(a^t)+o[11]+1839030562,n=(n<<16|n>>>16)+r<<0,t+=(a^n)+o[14]-35309556,t=(t<<23|t>>>9)+n<<0,i=t^n,e+=(i^r)+o[1]-1530992060,e=(e<<4|e>>>28)+t<<0,r+=(i^e)+o[4]+1272893353,r=(r<<11|r>>>21)+e<<0,a=r^e,n+=(a^t)+o[7]-155497632,n=(n<<16|n>>>16)+r<<0,t+=(a^n)+o[10]-1094730640,t=(t<<23|t>>>9)+n<<0,i=t^n,e+=(i^r)+o[13]+681279174,e=(e<<4|e>>>28)+t<<0,r+=(i^e)+o[0]-358537222,r=(r<<11|r>>>21)+e<<0,a=r^e,n+=(a^t)+o[3]-722521979,n=(n<<16|n>>>16)+r<<0,t+=(a^n)+o[6]+76029189,t=(t<<23|t>>>9)+n<<0,i=t^n,e+=(i^r)+o[9]-640364487,e=(e<<4|e>>>28)+t<<0,r+=(i^e)+o[12]-421815835,r=(r<<11|r>>>21)+e<<0,a=r^e,n+=(a^t)+o[15]+530742520,n=(n<<16|n>>>16)+r<<0,t+=(a^n)+o[2]-995338651,t=(t<<23|t>>>9)+n<<0,e+=(n^(t|~r))+o[0]-198630844,e=(e<<6|e>>>26)+t<<0,r+=(t^(e|~n))+o[7]+1126891415,r=(r<<10|r>>>22)+e<<0,n+=(e^(r|~t))+o[14]-1416354905,n=(n<<15|n>>>17)+r<<0,t+=(r^(n|~e))+o[5]-57434055,t=(t<<21|t>>>11)+n<<0,e+=(n^(t|~r))+o[12]+1700485571,e=(e<<6|e>>>26)+t<<0,r+=(t^(e|~n))+o[3]-1894986606,r=(r<<10|r>>>22)+e<<0,n+=(e^(r|~t))+o[10]-1051523,n=(n<<15|n>>>17)+r<<0,t+=(r^(n|~e))+o[1]-2054922799,t=(t<<21|t>>>11)+n<<0,e+=(n^(t|~r))+o[8]+1873313359,e=(e<<6|e>>>26)+t<<0,r+=(t^(e|~n))+o[15]-30611744,r=(r<<10|r>>>22)+e<<0,n+=(e^(r|~t))+o[6]-1560198380,n=(n<<15|n>>>17)+r<<0,t+=(r^(n|~e))+o[13]+1309151649,t=(t<<21|t>>>11)+n<<0,e+=(n^(t|~r))+o[4]-145523070,e=(e<<6|e>>>26)+t<<0,r+=(t^(e|~n))+o[11]-1120210379,r=(r<<10|r>>>22)+e<<0,n+=(e^(r|~t))+o[2]+718787259,n=(n<<15|n>>>17)+r<<0,t+=(r^(n|~e))+o[9]-343485551,t=(t<<21|t>>>11)+n<<0,this.first?(this.h0=e+1732584193<<0,this.h1=t-271733879<<0,this.h2=n-1732584194<<0,this.h3=r+271733878<<0,this.first=!1):(this.h0=this.h0+e<<0,this.h1=this.h1+t<<0,this.h2=this.h2+n<<0,this.h3=this.h3+r<<0)},x.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3;return o[e>>>4&15]+o[e&15]+o[e>>>12&15]+o[e>>>8&15]+o[e>>>20&15]+o[e>>>16&15]+o[e>>>28&15]+o[e>>>24&15]+o[t>>>4&15]+o[t&15]+o[t>>>12&15]+o[t>>>8&15]+o[t>>>20&15]+o[t>>>16&15]+o[t>>>28&15]+o[t>>>24&15]+o[n>>>4&15]+o[n&15]+o[n>>>12&15]+o[n>>>8&15]+o[n>>>20&15]+o[n>>>16&15]+o[n>>>28&15]+o[n>>>24&15]+o[r>>>4&15]+o[r&15]+o[r>>>12&15]+o[r>>>8&15]+o[r>>>20&15]+o[r>>>16&15]+o[r>>>28&15]+o[r>>>24&15]},x.prototype.toString=x.prototype.hex,x.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3;return[e&255,e>>>8&255,e>>>16&255,e>>>24&255,t&255,t>>>8&255,t>>>16&255,t>>>24&255,n&255,n>>>8&255,n>>>16&255,n>>>24&255,r&255,r>>>8&255,r>>>16&255,r>>>24&255]},x.prototype.array=x.prototype.digest,x.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(16),t=new Uint32Array(e);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,e},x.prototype.buffer=x.prototype.arrayBuffer,x.prototype.base64=function(){for(var e,t,n,r=``,i=this.array(),a=0;a<15;)e=i[a++],t=i[a++],n=i[a++],r+=u[e>>>2]+u[(e<<4|t>>>4)&63]+u[(t<<2|n>>>6)&63]+u[n&63];return e=i[a],r+=u[e>>>2]+u[e<<4&63]+`==`,r};function S(e,t){var n,r=g(e);if(e=r[0],r[1]){var i=[],a=e.length,o=0,s;for(n=0;n<a;++n)s=e.charCodeAt(n),s<128?i[o++]=s:s<2048?(i[o++]=192|s>>>6,i[o++]=128|s&63):s<55296||s>=57344?(i[o++]=224|s>>>12,i[o++]=128|s>>>6&63,i[o++]=128|s&63):(s=65536+((s&1023)<<10|e.charCodeAt(++n)&1023),i[o++]=240|s>>>18,i[o++]=128|s>>>12&63,i[o++]=128|s>>>6&63,i[o++]=128|s&63);e=i}e.length>64&&(e=new x(!0).update(e).array());var c=[],l=[];for(n=0;n<64;++n){var u=e[n]||0;c[n]=92^u,l[n]=54^u}x.call(this,t),this.update(l),this.oKeyPad=c,this.inner=!0,this.sharedMemory=t}S.prototype=new x,S.prototype.finalize=function(){if(x.prototype.finalize.call(this),this.inner){this.inner=!1;var e=this.array();x.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),x.prototype.finalize.call(this)}};var C=v();C.md5=C,C.md5.hmac=b(),i?e.exports=C:r.md5=C})()})(g);var _=g.exports,v=h(_),y=e(((e,t)=>{t.exports={}})),b=e(((e,t)=>{
|
|
21
|
+
/*
|
|
22
|
+
* [js-sha1]{@link https://github.com/emn178/js-sha1}
|
|
23
|
+
*
|
|
24
|
+
* @version 0.7.0
|
|
25
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
26
|
+
* @copyright Chen, Yi-Cyuan 2014-2024
|
|
27
|
+
* @license MIT
|
|
28
|
+
*/
|
|
29
|
+
(function(){var e=`input is invalid type`,n=typeof window==`object`,i=n?window:{};i.JS_SHA1_NO_WINDOW&&(n=!1);var a=!n&&typeof self==`object`,o=!i.JS_SHA1_NO_NODE_JS&&typeof process==`object`&&process.versions&&process.versions.node;o?i=globalThis:a&&(i=self);var s=!i.JS_SHA1_NO_COMMON_JS&&typeof t==`object`&&t.exports,c=typeof define==`function`&&define.amd,l=!i.JS_SHA1_NO_ARRAY_BUFFER&&typeof ArrayBuffer<`u`,u=`0123456789abcdef`.split(``),d=[-2147483648,8388608,32768,128],f=[24,16,8,0],p=[`hex`,`array`,`digest`,`arrayBuffer`],m=[],h=Array.isArray;(i.JS_SHA1_NO_NODE_JS||!h)&&(h=function(e){return Object.prototype.toString.call(e)===`[object Array]`});var g=ArrayBuffer.isView;l&&(i.JS_SHA1_NO_ARRAY_BUFFER_IS_VIEW||!g)&&(g=function(e){return typeof e==`object`&&e.buffer&&e.buffer.constructor===ArrayBuffer});var _=function(t){var n=typeof t;if(n===`string`)return[t,!0];if(n!==`object`||t===null)throw Error(e);if(l&&t.constructor===ArrayBuffer)return[new Uint8Array(t),!1];if(!h(t)&&!g(t))throw Error(e);return[t,!1]},v=function(e){return function(t){return new w(!0).update(t)[e]()}},b=function(){var e=v(`hex`);o&&(e=x(e)),e.create=function(){return new w},e.update=function(t){return e.create().update(t)};for(var t=0;t<p.length;++t){var n=p[t];e[n]=v(n)}return e},x=function(t){var n=y(),a=r().Buffer,o=a.from&&!i.JS_SHA1_NO_BUFFER_FROM?a.from:function(e){return new a(e)};return function(r){if(typeof r==`string`)return n.createHash(`sha1`).update(r,`utf8`).digest(`hex`);if(r==null)throw Error(e);return r.constructor===ArrayBuffer&&(r=new Uint8Array(r)),h(r)||g(r)||r.constructor===a?n.createHash(`sha1`).update(o(r)).digest(`hex`):t(r)}},S=function(e){return function(t,n){return new T(t,!0).update(n)[e]()}},C=function(){var e=S(`hex`);e.create=function(e){return new T(e)},e.update=function(t,n){return e.create(t).update(n)};for(var t=0;t<p.length;++t){var n=p[t];e[n]=S(n)}return e};function w(e){e?(m[0]=m[16]=m[1]=m[2]=m[3]=m[4]=m[5]=m[6]=m[7]=m[8]=m[9]=m[10]=m[11]=m[12]=m[13]=m[14]=m[15]=0,this.blocks=m):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}w.prototype.update=function(e){if(this.finalized)throw Error(`finalize already called`);var t=_(e);e=t[0];for(var n=t[1],r,i=0,a,o=e.length||0,s=this.blocks;i<o;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,this.block=s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),n)for(a=this.start;i<o&&a<64;++i)r=e.charCodeAt(i),r<128?s[a>>>2]|=r<<f[a++&3]:r<2048?(s[a>>>2]|=(192|r>>>6)<<f[a++&3],s[a>>>2]|=(128|r&63)<<f[a++&3]):r<55296||r>=57344?(s[a>>>2]|=(224|r>>>12)<<f[a++&3],s[a>>>2]|=(128|r>>>6&63)<<f[a++&3],s[a>>>2]|=(128|r&63)<<f[a++&3]):(r=65536+((r&1023)<<10|e.charCodeAt(++i)&1023),s[a>>>2]|=(240|r>>>18)<<f[a++&3],s[a>>>2]|=(128|r>>>12&63)<<f[a++&3],s[a>>>2]|=(128|r>>>6&63)<<f[a++&3],s[a>>>2]|=(128|r&63)<<f[a++&3]);else for(a=this.start;i<o&&a<64;++i)s[a>>>2]|=e[i]<<f[a++&3];this.lastByteIndex=a,this.bytes+=a-this.start,a>=64?(this.block=s[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes%=4294967296),this},w.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>>2]|=d[t&3],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}},w.prototype.hash=function(){var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,a,o,s,c=this.blocks;for(o=16;o<80;++o)s=c[o-3]^c[o-8]^c[o-14]^c[o-16],c[o]=s<<1|s>>>31;for(o=0;o<20;o+=5)a=t&n|~t&r,s=e<<5|e>>>27,i=s+a+i+1518500249+c[o]<<0,t=t<<30|t>>>2,a=e&t|~e&n,s=i<<5|i>>>27,r=s+a+r+1518500249+c[o+1]<<0,e=e<<30|e>>>2,a=i&e|~i&t,s=r<<5|r>>>27,n=s+a+n+1518500249+c[o+2]<<0,i=i<<30|i>>>2,a=r&i|~r&e,s=n<<5|n>>>27,t=s+a+t+1518500249+c[o+3]<<0,r=r<<30|r>>>2,a=n&r|~n&i,s=t<<5|t>>>27,e=s+a+e+1518500249+c[o+4]<<0,n=n<<30|n>>>2;for(;o<40;o+=5)a=t^n^r,s=e<<5|e>>>27,i=s+a+i+1859775393+c[o]<<0,t=t<<30|t>>>2,a=e^t^n,s=i<<5|i>>>27,r=s+a+r+1859775393+c[o+1]<<0,e=e<<30|e>>>2,a=i^e^t,s=r<<5|r>>>27,n=s+a+n+1859775393+c[o+2]<<0,i=i<<30|i>>>2,a=r^i^e,s=n<<5|n>>>27,t=s+a+t+1859775393+c[o+3]<<0,r=r<<30|r>>>2,a=n^r^i,s=t<<5|t>>>27,e=s+a+e+1859775393+c[o+4]<<0,n=n<<30|n>>>2;for(;o<60;o+=5)a=t&n|t&r|n&r,s=e<<5|e>>>27,i=s+a+i-1894007588+c[o]<<0,t=t<<30|t>>>2,a=e&t|e&n|t&n,s=i<<5|i>>>27,r=s+a+r-1894007588+c[o+1]<<0,e=e<<30|e>>>2,a=i&e|i&t|e&t,s=r<<5|r>>>27,n=s+a+n-1894007588+c[o+2]<<0,i=i<<30|i>>>2,a=r&i|r&e|i&e,s=n<<5|n>>>27,t=s+a+t-1894007588+c[o+3]<<0,r=r<<30|r>>>2,a=n&r|n&i|r&i,s=t<<5|t>>>27,e=s+a+e-1894007588+c[o+4]<<0,n=n<<30|n>>>2;for(;o<80;o+=5)a=t^n^r,s=e<<5|e>>>27,i=s+a+i-899497514+c[o]<<0,t=t<<30|t>>>2,a=e^t^n,s=i<<5|i>>>27,r=s+a+r-899497514+c[o+1]<<0,e=e<<30|e>>>2,a=i^e^t,s=r<<5|r>>>27,n=s+a+n-899497514+c[o+2]<<0,i=i<<30|i>>>2,a=r^i^e,s=n<<5|n>>>27,t=s+a+t-899497514+c[o+3]<<0,r=r<<30|r>>>2,a=n^r^i,s=t<<5|t>>>27,e=s+a+e-899497514+c[o+4]<<0,n=n<<30|n>>>2;this.h0=this.h0+e<<0,this.h1=this.h1+t<<0,this.h2=this.h2+n<<0,this.h3=this.h3+r<<0,this.h4=this.h4+i<<0},w.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4;return u[e>>>28&15]+u[e>>>24&15]+u[e>>>20&15]+u[e>>>16&15]+u[e>>>12&15]+u[e>>>8&15]+u[e>>>4&15]+u[e&15]+u[t>>>28&15]+u[t>>>24&15]+u[t>>>20&15]+u[t>>>16&15]+u[t>>>12&15]+u[t>>>8&15]+u[t>>>4&15]+u[t&15]+u[n>>>28&15]+u[n>>>24&15]+u[n>>>20&15]+u[n>>>16&15]+u[n>>>12&15]+u[n>>>8&15]+u[n>>>4&15]+u[n&15]+u[r>>>28&15]+u[r>>>24&15]+u[r>>>20&15]+u[r>>>16&15]+u[r>>>12&15]+u[r>>>8&15]+u[r>>>4&15]+u[r&15]+u[i>>>28&15]+u[i>>>24&15]+u[i>>>20&15]+u[i>>>16&15]+u[i>>>12&15]+u[i>>>8&15]+u[i>>>4&15]+u[i&15]},w.prototype.toString=w.prototype.hex,w.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4;return[e>>>24&255,e>>>16&255,e>>>8&255,e&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255]},w.prototype.array=w.prototype.digest,w.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(20),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),e};function T(e,t){var n,r=_(e);if(e=r[0],r[1]){var i=[],a=e.length,o=0,s;for(n=0;n<a;++n)s=e.charCodeAt(n),s<128?i[o++]=s:s<2048?(i[o++]=192|s>>>6,i[o++]=128|s&63):s<55296||s>=57344?(i[o++]=224|s>>>12,i[o++]=128|s>>>6&63,i[o++]=128|s&63):(s=65536+((s&1023)<<10|e.charCodeAt(++n)&1023),i[o++]=240|s>>>18,i[o++]=128|s>>>12&63,i[o++]=128|s>>>6&63,i[o++]=128|s&63);e=i}e.length>64&&(e=new w(!0).update(e).array());var c=[],l=[];for(n=0;n<64;++n){var u=e[n]||0;c[n]=92^u,l[n]=54^u}w.call(this,t),this.update(l),this.oKeyPad=c,this.inner=!0,this.sharedMemory=t}T.prototype=new w,T.prototype.finalize=function(){if(w.prototype.finalize.call(this),this.inner){this.inner=!1;var e=this.array();w.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),w.prototype.finalize.call(this)}};var E=b();E.sha1=E,E.sha1.hmac=C(),s?t.exports=E:(i.sha1=E,c&&define(function(){return E}))})()}))();function x(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var S={exports:{}};
|
|
30
|
+
/**
|
|
31
|
+
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
|
32
|
+
*
|
|
33
|
+
* @version 0.12.0
|
|
34
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
35
|
+
* @copyright Chen, Yi-Cyuan 2014-2026
|
|
36
|
+
* @license MIT
|
|
37
|
+
*/
|
|
38
|
+
(function(e){(function(){var t=`input is invalid type`,n=typeof window==`object`,r=n?window:{};r.JS_SHA256_NO_WINDOW&&(n=!1),!n&&typeof self==`object`&&(r=self);var i=!r.JS_SHA256_NO_COMMON_JS&&e.exports,a=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<`u`,o=`0123456789abcdef`.split(``),s=[-2147483648,8388608,32768,128],c=[24,16,8,0],l=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],u=[`hex`,`array`,`digest`,`arrayBuffer`],d=[];(r.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(e){return Object.prototype.toString.call(e)===`[object Array]`}),a&&(r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(e){return typeof e==`object`&&e.buffer&&e.buffer.constructor===ArrayBuffer});var f=function(e,t){return function(n){return new g(t,!0).update(n)[e]()}},p=function(e){var t=f(`hex`,e);t.create=function(){return new g(e)},t.update=function(e){return t.create().update(e)};for(var n=0;n<u.length;++n){var r=u[n];t[r]=f(r,e)}return t},m=function(e,t){return function(n,r){return new _(n,t,!0).update(r)[e]()}},h=function(e){var t=m(`hex`,e);t.create=function(t){return new _(t,e)},t.update=function(e,n){return t.create(e).update(n)};for(var n=0;n<u.length;++n){var r=u[n];t[r]=m(r,e)}return t};function g(e,t){t?(d[0]=d[16]=d[1]=d[2]=d[3]=d[4]=d[5]=d[6]=d[7]=d[8]=d[9]=d[10]=d[11]=d[12]=d[13]=d[14]=d[15]=0,this.blocks=d):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=e}g.prototype.update=function(e){if(!this.finalized){var n,r=typeof e;if(r!==`string`){if(r===`object`){if(e===null)throw Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!a||!ArrayBuffer.isView(e)))throw Error(t)}else throw Error(t);n=!0}for(var i,o=0,s,l=e.length,u=this.blocks;o<l;){if(this.hashed&&(this.hashed=!1,u[0]=this.block,this.block=u[16]=u[1]=u[2]=u[3]=u[4]=u[5]=u[6]=u[7]=u[8]=u[9]=u[10]=u[11]=u[12]=u[13]=u[14]=u[15]=0),n)for(s=this.start;o<l&&s<64;++o)u[s>>>2]|=e[o]<<c[s++&3];else for(s=this.start;o<l&&s<64;++o)i=e.charCodeAt(o),i<128?u[s>>>2]|=i<<c[s++&3]:i<2048?(u[s>>>2]|=(192|i>>>6)<<c[s++&3],u[s>>>2]|=(128|i&63)<<c[s++&3]):i<55296||i>=57344?(u[s>>>2]|=(224|i>>>12)<<c[s++&3],u[s>>>2]|=(128|i>>>6&63)<<c[s++&3],u[s>>>2]|=(128|i&63)<<c[s++&3]):(i=65536+((i&1023)<<10|e.charCodeAt(++o)&1023),u[s>>>2]|=(240|i>>>18)<<c[s++&3],u[s>>>2]|=(128|i>>>12&63)<<c[s++&3],u[s>>>2]|=(128|i>>>6&63)<<c[s++&3],u[s>>>2]|=(128|i&63)<<c[s++&3]);this.lastByteIndex=s,this.bytes+=s-this.start,s>=64?(this.block=u[16],this.start=s-64,this.hash(),this.hashed=!0):this.start=s}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes%=4294967296),this}},g.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>>2]|=s[t&3],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}},g.prototype.hash=function(){var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,o=this.h6,s=this.h7,c=this.blocks,u,d,f,p,m,h,g,_,v,y,b;for(u=16;u<64;++u)m=c[u-15],d=(m>>>7|m<<25)^(m>>>18|m<<14)^m>>>3,m=c[u-2],f=(m>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,c[u]=c[u-16]+d+c[u-7]+f<<0;for(b=t&n,u=0;u<64;u+=4)this.first?(this.is224?(_=300032,m=c[0]-1413257819,s=m-150054599<<0,r=m+24177077<<0):(_=704751109,m=c[0]-210244248,s=m-1521486534<<0,r=m+143694565<<0),this.first=!1):(d=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),f=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),_=e&t,p=_^e&n^b,g=i&a^~i&o,m=s+f+g+l[u]+c[u],h=d+p,s=r+m<<0,r=m+h<<0),d=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),f=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),v=r&e,p=v^r&t^_,g=s&i^~s&a,m=o+f+g+l[u+1]+c[u+1],h=d+p,o=n+m<<0,n=m+h<<0,d=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),f=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),y=n&r,p=y^n&e^v,g=o&s^~o&i,m=a+f+g+l[u+2]+c[u+2],h=d+p,a=t+m<<0,t=m+h<<0,d=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),f=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),b=t&n,p=b^t&r^y,g=a&o^~a&s,m=i+f+g+l[u+3]+c[u+3],h=d+p,i=e+m<<0,e=m+h<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+e<<0,this.h1=this.h1+t<<0,this.h2=this.h2+n<<0,this.h3=this.h3+r<<0,this.h4=this.h4+i<<0,this.h5=this.h5+a<<0,this.h6=this.h6+o<<0,this.h7=this.h7+s<<0},g.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,s=this.h6,c=this.h7,l=o[e>>>28&15]+o[e>>>24&15]+o[e>>>20&15]+o[e>>>16&15]+o[e>>>12&15]+o[e>>>8&15]+o[e>>>4&15]+o[e&15]+o[t>>>28&15]+o[t>>>24&15]+o[t>>>20&15]+o[t>>>16&15]+o[t>>>12&15]+o[t>>>8&15]+o[t>>>4&15]+o[t&15]+o[n>>>28&15]+o[n>>>24&15]+o[n>>>20&15]+o[n>>>16&15]+o[n>>>12&15]+o[n>>>8&15]+o[n>>>4&15]+o[n&15]+o[r>>>28&15]+o[r>>>24&15]+o[r>>>20&15]+o[r>>>16&15]+o[r>>>12&15]+o[r>>>8&15]+o[r>>>4&15]+o[r&15]+o[i>>>28&15]+o[i>>>24&15]+o[i>>>20&15]+o[i>>>16&15]+o[i>>>12&15]+o[i>>>8&15]+o[i>>>4&15]+o[i&15]+o[a>>>28&15]+o[a>>>24&15]+o[a>>>20&15]+o[a>>>16&15]+o[a>>>12&15]+o[a>>>8&15]+o[a>>>4&15]+o[a&15]+o[s>>>28&15]+o[s>>>24&15]+o[s>>>20&15]+o[s>>>16&15]+o[s>>>12&15]+o[s>>>8&15]+o[s>>>4&15]+o[s&15];return this.is224||(l+=o[c>>>28&15]+o[c>>>24&15]+o[c>>>20&15]+o[c>>>16&15]+o[c>>>12&15]+o[c>>>8&15]+o[c>>>4&15]+o[c&15]),l},g.prototype.toString=g.prototype.hex,g.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,o=this.h6,s=this.h7,c=[e>>>24&255,e>>>16&255,e>>>8&255,e&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,a>>>24&255,a>>>16&255,a>>>8&255,a&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255];return this.is224||c.push(s>>>24&255,s>>>16&255,s>>>8&255,s&255),c},g.prototype.array=g.prototype.digest,g.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(this.is224?28:32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),e};function _(e,n,r){var i,o=typeof e;if(o===`string`){var s=[],c=e.length,l=0,u;for(i=0;i<c;++i)u=e.charCodeAt(i),u<128?s[l++]=u:u<2048?(s[l++]=192|u>>>6,s[l++]=128|u&63):u<55296||u>=57344?(s[l++]=224|u>>>12,s[l++]=128|u>>>6&63,s[l++]=128|u&63):(u=65536+((u&1023)<<10|e.charCodeAt(++i)&1023),s[l++]=240|u>>>18,s[l++]=128|u>>>12&63,s[l++]=128|u>>>6&63,s[l++]=128|u&63);e=s}else if(o===`object`){if(e===null)throw Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!a||!ArrayBuffer.isView(e)))throw Error(t)}else throw Error(t);e.length>64&&(e=new g(n,!0).update(e).array());var d=[],f=[];for(i=0;i<64;++i){var p=e[i]||0;d[i]=92^p,f[i]=54^p}g.call(this,n,r),this.update(f),this.oKeyPad=d,this.inner=!0,this.sharedMemory=r}_.prototype=new g,_.prototype.finalize=function(){if(g.prototype.finalize.call(this),this.inner){this.inner=!1;var e=this.array();g.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(e),g.prototype.finalize.call(this)}};var v=p();v.sha256=v,v.sha224=p(!0),v.sha256.hmac=h(),v.sha224.hmac=h(!0),i?e.exports=v:(r.sha256=v.sha256,r.sha224=v.sha224)})()})(S);var C=S.exports,w=x(C);const{sha224:T}=w;var E=4,D=0,O=1,ee=2;function k(e){let t=e.length;for(;--t>=0;)e[t]=0}var te=0,ne=1,re=2,ie=29,ae=256,oe=286,se=30,ce=19,A=573,j=15,le=16,ue=7,de=256,fe=16,pe=17,M=18,me=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),he=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),ge=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),_e=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ve=512,N=Array(288*2);k(N);var ye=Array(se*2);k(ye);var be=Array(ve);k(be);var xe=Array(256);k(xe);var Se=Array(ie);k(Se);var Ce=Array(se);k(Ce);var we=class{constructor(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}},Te,P,Ee,De=class{constructor(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}},F=e=>e<256?be[e]:be[256+(e>>>7)],Oe=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},I=(e,t,n)=>{e.bi_valid>le-n?(e.bi_buf|=t<<e.bi_valid&65535,Oe(e,e.bi_buf),e.bi_buf=t>>le-e.bi_valid,e.bi_valid+=n-le):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},L=(e,t,n)=>{I(e,n[t*2],n[t*2+1])},ke=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},Ae=e=>{e.bi_valid===16?(Oe(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},je=(e,t)=>{let n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length,l,u,d,f,p,m,h=0;for(f=0;f<=j;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<A;l++)u=e.heap[l],f=n[n[u*2+1]*2+1]+1,f>c&&(f=c,h++),n[u*2+1]=f,!(u>r)&&(e.bl_count[f]++,p=0,u>=s&&(p=o[u-s]),m=n[u*2],e.opt_len+=m*(f+p),a&&(e.static_len+=m*(i[u*2+1]+p)));if(h!==0){do{for(f=c-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[c]--,h-=2}while(h>0);for(f=c;f!==0;f--)for(u=e.bl_count[f];u!==0;)d=e.heap[--l],!(d>r)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),u--)}},Me=(e,t,n)=>{let r=Array(16),i=0,a,o;for(a=1;a<=j;a++)i=i+n[a-1]<<1,r[a]=i;for(o=0;o<=t;o++){let t=e[o*2+1];t!==0&&(e[o*2]=ke(r[t]++,t))}},Ne=()=>{let e,t,n,r,i,a=Array(16);for(n=0,r=0;r<ie-1;r++)for(Se[r]=n,e=0;e<1<<me[r];e++)xe[n++]=r;for(xe[n-1]=r,i=0,r=0;r<16;r++)for(Ce[r]=i,e=0;e<1<<he[r];e++)be[i++]=r;for(i>>=7;r<se;r++)for(Ce[r]=i<<7,e=0;e<1<<he[r]-7;e++)be[256+i++]=r;for(t=0;t<=j;t++)a[t]=0;for(e=0;e<=143;)N[e*2+1]=8,e++,a[8]++;for(;e<=255;)N[e*2+1]=9,e++,a[9]++;for(;e<=279;)N[e*2+1]=7,e++,a[7]++;for(;e<=287;)N[e*2+1]=8,e++,a[8]++;for(Me(N,287,a),e=0;e<se;e++)ye[e*2+1]=5,ye[e*2]=ke(e,5);Te=new we(N,me,257,oe,j),P=new we(ye,he,0,se,j),Ee=new we([],ge,0,ce,ue)},Pe=e=>{let t;for(t=0;t<oe;t++)e.dyn_ltree[t*2]=0;for(t=0;t<se;t++)e.dyn_dtree[t*2]=0;for(t=0;t<ce;t++)e.bl_tree[t*2]=0;e.dyn_ltree[de*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Fe=e=>{e.bi_valid>8?Oe(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Ie=(e,t,n,r)=>{let i=t*2,a=n*2;return e[i]<e[a]||e[i]===e[a]&&r[t]<=r[n]},Le=(e,t,n)=>{let r=e.heap[n],i=n<<1;for(;i<=e.heap_len&&(i<e.heap_len&&Ie(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Ie(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r},Re=(e,t,n)=>{let r,i,a=0,o,s;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+a++]&255,r+=(e.pending_buf[e.sym_buf+a++]&255)<<8,i=e.pending_buf[e.sym_buf+a++],r===0?L(e,i,t):(o=xe[i],L(e,o+ae+1,t),s=me[o],s!==0&&(i-=Se[o],I(e,i,s)),r--,o=F(r),L(e,o,n),s=he[o],s!==0&&(r-=Ce[o],I(e,r,s)));while(a<e.sym_next);L(e,de,t)},ze=(e,t)=>{let n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.elems,o,s,c=-1,l;for(e.heap_len=0,e.heap_max=A,o=0;o<a;o++)n[o*2]===0?n[o*2+1]=0:(e.heap[++e.heap_len]=c=o,e.depth[o]=0);for(;e.heap_len<2;)l=e.heap[++e.heap_len]=c<2?++c:0,n[l*2]=1,e.depth[l]=0,e.opt_len--,i&&(e.static_len-=r[l*2+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)Le(e,n,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Le(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,n[l*2]=n[o*2]+n[s*2],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,n[o*2+1]=n[s*2+1]=l,e.heap[1]=l++,Le(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],je(e,t),Me(n,c,e.bl_count)},Be=(e,t,n)=>{let r,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)a=o,o=t[(r+1)*2+1],!(++s<c&&a===o)&&(s<l?e.bl_tree[a*2]+=s:a===0?s<=10?e.bl_tree[pe*2]++:e.bl_tree[M*2]++:(a!==i&&e.bl_tree[a*2]++,e.bl_tree[fe*2]++),s=0,i=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4))},Ve=(e,t,n)=>{let r,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),r=0;r<=n;r++)if(a=o,o=t[(r+1)*2+1],!(++s<c&&a===o)){if(s<l)do L(e,a,e.bl_tree);while(--s!==0);else a===0?s<=10?(L(e,pe,e.bl_tree),I(e,s-3,3)):(L(e,M,e.bl_tree),I(e,s-11,7)):(a!==i&&(L(e,a,e.bl_tree),s--),L(e,fe,e.bl_tree),I(e,s-3,2));s=0,i=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4)}},He=e=>{let t;for(Be(e,e.dyn_ltree,e.l_desc.max_code),Be(e,e.dyn_dtree,e.d_desc.max_code),ze(e,e.bl_desc),t=ce-1;t>=3&&e.bl_tree[_e[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},Ue=(e,t,n,r)=>{let i;for(I(e,t-257,5),I(e,n-1,5),I(e,r-4,4),i=0;i<r;i++)I(e,e.bl_tree[_e[i]*2+1],3);Ve(e,e.dyn_ltree,t-1),Ve(e,e.dyn_dtree,n-1)},We=e=>{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return D;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return O;for(n=32;n<ae;n++)if(e.dyn_ltree[n*2]!==0)return O;return D},Ge=!1,Ke=e=>{Ge||=(Ne(),!0),e.l_desc=new De(e.dyn_ltree,Te),e.d_desc=new De(e.dyn_dtree,P),e.bl_desc=new De(e.bl_tree,Ee),e.bi_buf=0,e.bi_valid=0,Pe(e)},qe=(e,t,n,r)=>{I(e,(te<<1)+ +!!r,3),Fe(e),Oe(e,n),Oe(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},Je=e=>{I(e,ne<<1,3),L(e,de,N),Ae(e)},Ye=(e,t,n,r)=>{let i,a,o=0;e.level>0?(e.strm.data_type===ee&&(e.strm.data_type=We(e)),ze(e,e.l_desc),ze(e,e.d_desc),o=He(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=i&&(i=a)):i=a=n+5,n+4<=i&&t!==-1?qe(e,t,n,r):e.strategy===E||a===i?(I(e,(ne<<1)+ +!!r,3),Re(e,N,ye)):(I(e,(re<<1)+ +!!r,3),Ue(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Re(e,e.dyn_ltree,e.dyn_dtree)),Pe(e),r&&Fe(e)},Xe=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(xe[n]+ae+1)*2]++,e.dyn_dtree[F(t)*2]++),e.sym_next===e.sym_end),Ze=(e,t,n,r)=>{let i=e&65535|0,a=e>>>16&65535|0,o=0;for(;n!==0;){o=n>2e3?2e3:n,n-=o;do i=i+t[r++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0},Qe=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t})()),R=(e,t,n,r)=>{let i=Qe,a=r+n;e^=-1;for(let n=r;n<a;n++)e=e>>>8^i[(e^t[n])&255];return e^-1},$e={2:`need dictionary`,1:`stream end`,0:``,"-1":`file error`,"-2":`stream error`,"-3":`data error`,"-4":`insufficient memory`,"-5":`buffer error`,"-6":`incompatible version`},et=9,tt=573,z=3,nt=258,B=262,rt=32,it=42,at=57,ot=69,st=73,ct=91,lt=103,ut=113,dt=666,V=1,ft=2,pt=3,mt=4,ht=3,gt=(e,t)=>(e.msg=$e[t],t),_t=e=>e*2-(e>4?9:0),H=e=>{let t=e.length;for(;--t>=0;)e[t]=0},vt=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)},yt=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask,bt=(e,t)=>{let n;if(e.legacy_hash)n=e.ins_h=yt(e,e.ins_h,e.window[t+z-1]);else{let r=e.window,i=r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24;n=e.ins_h=Math.imul(i,66521)+66521>>>16&e.hash_mask}let r=e.prev[t&e.w_mask]=e.head[n];return e.head[n]=t,r},U=e=>{let t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},W=(e,t)=>{Ye(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,U(e.strm)},G=(e,t)=>{e.pending_buf[e.pending++]=t},xt=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},St=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=Ze(e.adler,t,i,n):e.state.wrap===2&&(e.adler=R(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},Ct=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,a,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-B?e.strstart-(e.w_size-B):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+nt,p=l[r+o-1],m=l[r+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(i=t,l[i+o]!==m||l[i+o-1]!==p||l[i]!==l[r]||l[++i]!==l[r+1])continue;r+=2,i++;do;while(l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&r<f);if(a=nt-(f-r),r=f-nt,a>o){if(e.match_start=t,o=a,a>=s)break;p=l[r+o-1],m=l[r+o]}}while((t=d[t&u])>c&&--n!==0);return o<=e.lookahead?o:e.lookahead},wt=e=>{let t=e.w_size,n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-B)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),vt(e),r+=t),e.strm.avail_in===0)break;if(n=St(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,!e.legacy_hash){if(e.lookahead+e.insert>z)for(i=e.strstart-e.insert;e.insert&&(bt(e,i),i++,e.insert--,!(e.lookahead+e.insert<=z)););}else if(e.lookahead+e.insert>=z)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=yt(e,e.ins_h,e.window[i+1]);e.insert&&(bt(e,i),i++,e.insert--,!(e.lookahead+e.insert<z)););}while(e.lookahead<B&&e.strm.avail_in!==0)},Tt=(e,t)=>{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,a,o=0,s=e.strm.avail_in;do{if(r=65535,a=e.bi_valid+42>>3,e.strm.avail_out<a||(a=e.strm.avail_out-a,i=e.strstart-e.block_start,r>i+e.strm.avail_in&&(r=i+e.strm.avail_in),r>a&&(r=a),r<n&&(r===0&&t!==4||t===0||r!==i+e.strm.avail_in)))break;o=+(t===4&&r===i+e.strm.avail_in),qe(e,0,0,o),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,U(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(St(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(o===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),o?mt:t!==0&&t!==4&&e.strm.avail_in===0&&e.strstart===e.block_start?ft:(a=e.window_size-e.strstart,e.strm.avail_in>a&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(St(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water<e.strstart&&(e.high_water=e.strstart),a=e.bi_valid+42>>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,n=a>e.w_size?e.w_size:a,i=e.strstart-e.block_start,(i>=n||(i||t===4)&&t!==0&&e.strm.avail_in===0&&i<=a)&&(r=i>a?a:i,o=+(t===4&&e.strm.avail_in===0&&r===i),qe(e,e.block_start,r,o),e.block_start+=r,U(e.strm)),o?pt:V)},Et=(e,t)=>{let n,r;for(;;){if(e.lookahead<B){if(wt(e),e.lookahead<B&&t===0)return V;if(e.lookahead===0)break}if(n=0,e.lookahead>=z&&(n=bt(e,e.strstart)),n!==0&&e.strstart-n<=e.w_size-B&&(e.match_length=Ct(e,n)),e.match_length>=z)if(r=Xe(e,e.strstart-e.match_start,e.match_length-z),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=z){e.match_length--;do e.strstart++,n=bt(e,e.strstart);while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.legacy_hash&&(e.ins_h=e.window[e.strstart],e.ins_h=yt(e,e.ins_h,e.window[e.strstart+1]));else r=Xe(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(W(e,!1),e.strm.avail_out===0))return V}return e.insert=e.strstart<z-1?e.strstart:z-1,t===4?(W(e,!0),e.strm.avail_out===0?pt:mt):e.sym_next&&(W(e,!1),e.strm.avail_out===0)?V:ft},Dt=(e,t)=>{let n,r,i;for(;;){if(e.lookahead<B){if(wt(e),e.lookahead<B&&t===0)return V;if(e.lookahead===0)break}if(n=0,e.lookahead>=z&&(n=bt(e,e.strstart)),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=z-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-B&&(e.match_length=Ct(e,n),e.match_length<=5&&(e.strategy===1||e.match_length===z&&e.strstart-e.match_start>4096)&&(e.match_length=z-1)),e.prev_length>=z&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-z,r=Xe(e,e.strstart-1-e.prev_match,e.prev_length-z),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(n=bt(e,e.strstart));while(--e.prev_length!==0);if(e.match_available=0,e.match_length=z-1,e.strstart++,r&&(W(e,!1),e.strm.avail_out===0))return V}else if(e.match_available){if(r=Xe(e,0,e.window[e.strstart-1]),r&&W(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return V}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&=(r=Xe(e,0,e.window[e.strstart-1]),0),e.insert=e.strstart<z-1?e.strstart:z-1,t===4?(W(e,!0),e.strm.avail_out===0?pt:mt):e.sym_next&&(W(e,!1),e.strm.avail_out===0)?V:ft},Ot=(e,t)=>{let n,r,i,a,o=e.window;for(;;){if(e.lookahead<=nt){if(wt(e),e.lookahead<=nt&&t===0)return V;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=z&&e.strstart>0&&(i=e.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=e.strstart+nt;do;while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<a);e.match_length=nt-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=z?(n=Xe(e,1,e.match_length-z),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Xe(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(W(e,!1),e.strm.avail_out===0))return V}return e.insert=0,t===4?(W(e,!0),e.strm.avail_out===0?pt:mt):e.sym_next&&(W(e,!1),e.strm.avail_out===0)?V:ft},kt=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(wt(e),e.lookahead===0)){if(t===0)return V;break}if(e.match_length=0,n=Xe(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(W(e,!1),e.strm.avail_out===0))return V}return e.insert=0,t===4?(W(e,!0),e.strm.avail_out===0?pt:mt):e.sym_next&&(W(e,!1),e.strm.avail_out===0)?V:ft},K=class{constructor(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}},At=[new K(0,0,0,0,Tt),new K(4,4,8,4,Et),new K(4,5,16,8,Et),new K(4,6,32,32,Et),new K(4,4,16,16,Dt),new K(8,16,32,32,Dt),new K(8,16,128,128,Dt),new K(8,32,128,256,Dt),new K(32,128,258,1024,Dt),new K(32,258,258,4096,Dt)],jt=e=>{e.window_size=2*e.w_size,H(e.head),e.max_lazy_match=At[e.level].max_lazy,e.good_match=At[e.level].good_length,e.nice_match=At[e.level].nice_length,e.max_chain_length=At[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=z-1,e.match_available=0,e.ins_h=0},Mt=class{constructor(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.legacy_hash=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(tt*2),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),H(this.dyn_ltree),H(this.dyn_dtree),H(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),H(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),H(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}},Nt=e=>{if(!e)return 1;let t=e.state;return+(!t||t.strm!==e||t.status!==it&&t.status!==at&&t.status!==ot&&t.status!==st&&t.status!==ct&&t.status!==lt&&t.status!==ut&&t.status!==dt)},Pt=e=>{if(Nt(e))return gt(e,-2);e.total_in=e.total_out=0,e.data_type=2;let t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?at:t.wrap?it:ut,e.adler=t.wrap===2?0:1,t.last_flush=-2,Ke(t),0},Ft=e=>{let t=Pt(e);return t===0&&jt(e.state),t},It=(e,t,n,r,i,a,o)=>{if(!e)return-2;let s=1;if(t===-1&&(t=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),i<1||i>et||n!==8||r<8||r>15||t<0||t>9||a<0||a>4||r===8&&s!==1)return gt(e,-2);r===8&&(r=9);let c=new Mt;return e.state=c,c.strm=e,c.status=it,c.wrap=s,c.gzhead=null,c.w_bits=r,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.legacy_hash=+!!o,c.hash_bits=i+7,!c.legacy_hash&&c.hash_bits<15&&(c.hash_bits=15),c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+z-1)/z),c.window=new Uint8Array(c.w_size*2),c.head=new Uint16Array(c.hash_size),c.prev=new Uint16Array(c.w_size),c.lit_bufsize=1<<i+6,c.pending_buf_size=c.lit_bufsize*4,c.pending_buf=new Uint8Array(c.pending_buf_size),c.sym_buf=c.lit_bufsize,c.sym_end=(c.lit_bufsize-1)*3,c.level=t,c.strategy=a,c.method=n,Ft(e)},Lt=(e,t)=>{if(Nt(e)||t>5||t<0)return e?gt(e,-2):-2;let n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===dt&&t!==4)return gt(e,e.avail_out===0?-5:-2);let r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(U(e),e.avail_out===0)return n.last_flush=-1,0}else if(e.avail_in===0&&_t(t)<=_t(r)&&t!==4)return gt(e,-5);if(n.status===dt&&e.avail_in!==0)return gt(e,-5);if(n.status===it&&n.wrap===0&&(n.status=ut),n.status===it){let t=8+(n.w_bits-8<<4)<<8,r=-1;if(r=n.strategy>=2||n.level<2?0:n.level<6?1:n.level===6?2:3,t|=r<<6,n.strstart!==0&&(t|=rt),t+=31-t%31,xt(n,t),n.strstart!==0&&(xt(n,e.adler>>>16),xt(n,e.adler&65535)),e.adler=1,n.status=ut,U(e),n.pending!==0)return n.last_flush=-1,0}if(n.status===at){if(e.adler=0,G(n,31),G(n,139),G(n,8),n.gzhead)G(n,+!!n.gzhead.text+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),G(n,n.gzhead.time&255),G(n,n.gzhead.time>>8&255),G(n,n.gzhead.time>>16&255),G(n,n.gzhead.time>>24&255),G(n,n.level===9?2:n.strategy>=2||n.level<2?4:0),G(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(G(n,n.gzhead.extra.length&255),G(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=R(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=ot;else if(G(n,0),G(n,0),G(n,0),G(n,0),G(n,0),G(n,n.level===9?2:n.strategy>=2||n.level<2?4:0),G(n,ht),n.status=ut,U(e),n.pending!==0)return n.last_flush=-1,0}if(n.status===ot){if(n.gzhead.extra){let t=n.pending,r=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=R(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=i,U(e),n.pending!==0)return n.last_flush=-1,0;t=0,r-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>t&&(e.adler=R(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=st}if(n.status===st){if(n.gzhead.name){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=R(e.adler,n.pending_buf,n.pending-t,t)),U(e),n.pending!==0)return n.last_flush=-1,0;t=0}r=n.gzindex<n.gzhead.name.length?n.gzhead.name.charCodeAt(n.gzindex++)&255:0,G(n,r)}while(r!==0);n.gzhead.hcrc&&n.pending>t&&(e.adler=R(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=ct}if(n.status===ct){if(n.gzhead.comment){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=R(e.adler,n.pending_buf,n.pending-t,t)),U(e),n.pending!==0)return n.last_flush=-1,0;t=0}r=n.gzindex<n.gzhead.comment.length?n.gzhead.comment.charCodeAt(n.gzindex++)&255:0,G(n,r)}while(r!==0);n.gzhead.hcrc&&n.pending>t&&(e.adler=R(e.adler,n.pending_buf,n.pending-t,t))}n.status=lt}if(n.status===lt){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(U(e),n.pending!==0))return n.last_flush=-1,0;G(n,e.adler&255),G(n,e.adler>>8&255),e.adler=0}if(n.status=ut,U(e),n.pending!==0)return n.last_flush=-1,0}if(e.avail_in!==0||n.lookahead!==0||t!==0&&n.status!==dt){let r=n.level===0?Tt(n,t):n.strategy===2?kt(n,t):n.strategy===3?Ot(n,t):At[n.level].func(n,t);if((r===pt||r===mt)&&(n.status=dt),r===V||r===pt)return e.avail_out===0&&(n.last_flush=-1),0;if(r===ft&&(t===1?Je(n):t!==5&&(qe(n,0,0,!1),t===3&&(H(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),U(e),e.avail_out===0))return n.last_flush=-1,0}return t===4?n.wrap<=0?1:(n.wrap===2?(G(n,e.adler&255),G(n,e.adler>>8&255),G(n,e.adler>>16&255),G(n,e.adler>>24&255),G(n,e.total_in&255),G(n,e.total_in>>8&255),G(n,e.total_in>>16&255),G(n,e.total_in>>24&255)):(xt(n,e.adler>>>16),xt(n,e.adler&65535)),U(e),n.wrap>0&&(n.wrap=-n.wrap),+(n.pending===0)):0},Rt=e=>{if(Nt(e))return-2;let t=e.state.status;return e.state=null,t===ut?gt(e,-3):0},zt=(e,t)=>{let n=t.length;if(Nt(e))return-2;let r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==it||r.lookahead)return-2;if(i===1&&(e.adler=Ze(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(H(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(n-r.w_size,n),0),t=e,n=r.w_size}let a=e.avail_in,o=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,wt(r);r.lookahead>=z;){let e=r.strstart,t=r.lookahead-(z-1);do bt(r,e),e++;while(--t);r.strstart=e,r.lookahead=z-1,wt(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=z-1,r.match_available=0,e.next_in=o,e.input=s,e.avail_in=a,r.wrap=i,0},Bt=16209,Vt=16191;function Ht(e,t){let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E=e.state;n=e.next_in,w=e.input,r=n+(e.avail_in-5),i=e.next_out,T=e.output,a=i-(t-e.avail_out),o=i+(e.avail_out-257),s=E.dmax,c=E.wsize,l=E.whave,u=E.wnext,d=E.window,f=E.hold,p=E.bits,m=E.lencode,h=E.distcode,g=(1<<E.lenbits)-1,_=(1<<E.distbits)-1;top:do{p<15&&(f+=w[n++]<<p,p+=8,f+=w[n++]<<p,p+=8),v=m[f&g];dolen:for(;;){if(y=v>>>24,f>>>=y,p-=y,y=v>>>16&255,y===0)T[i++]=v&65535;else if(y&16){b=v&65535,y&=15,y&&(p<y&&(f+=w[n++]<<p,p+=8),b+=f&(1<<y)-1,f>>>=y,p-=y),p<15&&(f+=w[n++]<<p,p+=8,f+=w[n++]<<p,p+=8),v=h[f&_];dodist:for(;;){if(y=v>>>24,f>>>=y,p-=y,y=v>>>16&255,y&16){if(x=v&65535,y&=15,p<y&&(f+=w[n++]<<p,p+=8,p<y&&(f+=w[n++]<<p,p+=8)),x+=f&(1<<y)-1,x>s){e.msg=`invalid distance too far back`,E.mode=Bt;break top}if(f>>>=y,p-=y,y=i-a,x>y){if(y=x-y,y>l&&E.sane){e.msg=`invalid distance too far back`,E.mode=Bt;break top}if(S=0,C=d,u===0){if(S+=c-y,y<b){b-=y;do T[i++]=d[S++];while(--y);S=i-x,C=T}}else if(u<y){if(S+=c+u-y,y-=u,y<b){b-=y;do T[i++]=d[S++];while(--y);if(S=0,u<b){y=u,b-=y;do T[i++]=d[S++];while(--y);S=i-x,C=T}}}else if(S+=u-y,y<b){b-=y;do T[i++]=d[S++];while(--y);S=i-x,C=T}for(;b>2;)T[i++]=C[S++],T[i++]=C[S++],T[i++]=C[S++],b-=3;b&&(T[i++]=C[S++],b>1&&(T[i++]=C[S++]))}else{S=i-x;do T[i++]=T[S++],T[i++]=T[S++],T[i++]=T[S++],b-=3;while(b>2);b&&(T[i++]=T[S++],b>1&&(T[i++]=T[S++]))}}else if(y&64){e.msg=`invalid distance code`,E.mode=Bt;break top}else{v=h[(v&65535)+(f&(1<<y)-1)];continue dodist}break}}else if(!(y&64)){v=m[(v&65535)+(f&(1<<y)-1)];continue dolen}else if(y&32){E.mode=Vt;break top}else{e.msg=`invalid literal/length code`,E.mode=Bt;break top}break}}while(n<r&&i<o);b=p>>3,n-=b,p-=b<<3,f&=(1<<p)-1,e.next_in=n,e.next_out=i,e.avail_in=n<r?5+(r-n):5-(n-r),e.avail_out=i<o?257+(o-i):257-(i-o),E.hold=f,E.bits=p}var Ut=15,Wt=852,Gt=592,Kt=0,qt=1,Jt=2,Yt=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Xt=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,199,75]),Zt=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Qt=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),$t=(e,t,n,r,i,a,o,s)=>{let c=s.bits,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y,b,x,S,C,w=null,T,E=new Uint16Array(16),D=new Uint16Array(16),O=null,ee,k,te;for(l=0;l<=Ut;l++)E[l]=0;for(u=0;u<r;u++)E[t[n+u]]++;for(p=c,f=Ut;f>=1&&E[f]===0;f--);if(p>f&&(p=f),f===0)return i[a++]=20971520,i[a++]=20971520,s.bits=1,0;for(d=1;d<f&&E[d]===0;d++);for(p<d&&(p=d),g=1,l=1;l<=Ut;l++)if(g<<=1,g-=E[l],g<0)return-1;if(g>0&&(e===Kt||f!==1))return-1;for(D[1]=0,l=1;l<Ut;l++)D[l+1]=D[l]+E[l];for(u=0;u<r;u++)t[n+u]!==0&&(o[D[t[n+u]]++]=u);if(e===Kt?(w=O=o,T=20):e===qt?(w=Yt,O=Xt,T=257):(w=Zt,O=Qt,T=0),v=0,u=0,l=d,C=a,m=p,h=0,x=-1,_=1<<p,S=_-1,e===qt&&_>Wt||e===Jt&&_>Gt)return 1;for(;;){ee=l-h,o[u]+1<T?(k=0,te=o[u]):o[u]>=T?(k=O[o[u]-T],te=w[o[u]-T]):(k=96,te=0),y=1<<l-h,b=1<<m,d=b;do b-=y,i[C+(v>>h)+b]=ee<<24|k<<16|te|0;while(b!==0);for(y=1<<l-1;v&y;)y>>=1;if(y===0?v=0:(v&=y-1,v+=y),u++,--E[l]===0){if(l===f)break;l=t[n+o[u]]}if(l>p&&(v&S)!==x){for(h===0&&(h=p),C+=d,m=l-h,g=1<<m;m+h<f&&(g-=E[m+h],!(g<=0));)m++,g<<=1;if(_+=1<<m,e===qt&&_>Wt||e===Jt&&_>Gt)return 1;x=v&S,i[x]=p<<24|m<<16|C-a|0}}return v!==0&&(i[C+v]=l-h<<24|4194304),s.bits=p,0},en=0,tn=1,nn=2,rn=16180,an=16181,on=16182,sn=16183,cn=16184,ln=16185,un=16186,dn=16187,fn=16188,pn=16189,mn=16190,q=16191,hn=16192,gn=16193,_n=16194,vn=16195,yn=16196,bn=16197,xn=16198,Sn=16199,Cn=16200,wn=16201,Tn=16202,En=16203,Dn=16204,On=16205,kn=16206,An=16207,jn=16208,J=16209,Mn=16210,Nn=16211,Pn=852,Fn=592,In=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24),Ln=class{constructor(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}},Rn=e=>{if(!e)return 1;let t=e.state;return+(!t||t.strm!==e||t.mode<rn||t.mode>Nn)},zn=e=>{if(Rn(e))return-2;let t=e.state;return e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=t.wrap&1),t.mode=rn,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(Pn),t.distcode=t.distdyn=new Int32Array(Fn),t.sane=1,t.back=-1,0},Bn=e=>{if(Rn(e))return-2;let t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,zn(e)},Vn=(e,t)=>{let n;if(Rn(e))return-2;let r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?-2:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,Bn(e))},Hn=(e,t)=>{if(!e)return-2;let n=new Ln;e.state=n,n.strm=e,n.window=null,n.mode=rn;let r=Vn(e,t);return r!==0&&(e.state=null),r},Un=!0,Wn,Gn,Kn=e=>{if(Un){Wn=new Int32Array(512),Gn=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for($t(tn,e.lens,0,288,Wn,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;$t(nn,e.lens,0,32,Gn,0,e.work,{bits:5}),Un=!1}e.lencode=Wn,e.lenbits=9,e.distcode=Gn,e.distbits=5},qn=(e,t,n,r)=>{let i,a=e.state;return a.window===null&&(a.window=new Uint8Array(1<<a.wbits)),a.wsize===0&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0),r>=a.wsize?(a.window.set(t.subarray(n-a.wsize,n),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),a.window.set(t.subarray(n-r,n-r+i),a.wnext),r-=i,r?(a.window.set(t.subarray(n-r,n),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0},Jn=(e,t)=>{let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g=0,_,v,y,b,x,S,C,w,T=new Uint8Array(4),E,D,O=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Rn(e)||!e.output||!e.input&&e.avail_in!==0)return-2;n=e.state,n.mode===q&&(n.mode=hn),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,l=n.hold,u=n.bits,d=s,f=c,w=0;inf_leave:for(;;)switch(n.mode){case rn:if(n.wrap===0){n.mode=hn;break}for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&2&&l===35615){n.wbits===0&&(n.wbits=15),n.check=0,T[0]=l&255,T[1]=l>>>8&255,n.check=R(n.check,T,2,0),l=0,u=0,n.mode=an;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg=`incorrect header check`,n.mode=J;break}if((l&15)!=8){e.msg=`unknown compression method`,n.mode=J;break}if(l>>>=4,u-=4,C=(l&15)+8,n.wbits===0&&(n.wbits=C),C>15||C>n.wbits){e.msg=`invalid window size`,n.mode=J;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=l&512?pn:q,l=0,u=0;break;case an:for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.flags=l,(n.flags&255)!=8){e.msg=`unknown compression method`,n.mode=J;break}if(n.flags&57344){e.msg=`unknown header flags set`,n.mode=J;break}n.head&&(n.head.text=l>>8&1),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=R(n.check,T,2,0)),l=0,u=0,n.mode=on;case on:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.head&&(n.head.time=l),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,T[2]=l>>>16&255,T[3]=l>>>24&255,n.check=R(n.check,T,4,0)),l=0,u=0,n.mode=sn;case sn:for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.head&&(n.head.xflags=l&255,n.head.os=l>>8),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=R(n.check,T,2,0)),l=0,u=0,n.mode=cn;case cn:if(n.flags&1024){for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.length=l,n.head&&(n.head.extra_len=l),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=R(n.check,T,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=ln;case ln:if(n.flags&1024&&(p=n.length,p>s&&(p=s),p&&(n.head&&(C=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(a,a+p),C)),n.flags&512&&n.wrap&4&&(n.check=R(n.check,r,p,a)),s-=p,a+=p,n.length-=p),n.length))break inf_leave;n.length=0,n.mode=un;case un:if(n.flags&2048){if(s===0)break inf_leave;p=0;do C=r[a+p++],n.head&&C&&n.length<65536&&(n.head.name+=String.fromCharCode(C));while(C&&p<s);if(n.flags&512&&n.wrap&4&&(n.check=R(n.check,r,p,a)),s-=p,a+=p,C)break inf_leave}else n.head&&(n.head.name=null);n.length=0,n.mode=dn;case dn:if(n.flags&4096){if(s===0)break inf_leave;p=0;do C=r[a+p++],n.head&&C&&n.length<65536&&(n.head.comment+=String.fromCharCode(C));while(C&&p<s);if(n.flags&512&&n.wrap&4&&(n.check=R(n.check,r,p,a)),s-=p,a+=p,C)break inf_leave}else n.head&&(n.head.comment=null);n.mode=fn;case fn:if(n.flags&512){for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&4&&l!==(n.check&65535)){e.msg=`header crc mismatch`,n.mode=J;break}l=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=q;break;case pn:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}e.adler=n.check=In(l),l=0,u=0,n.mode=mn;case mn:if(n.havedict===0)return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,2;e.adler=n.check=1,n.mode=q;case q:if(t===5||t===6)break inf_leave;case hn:if(n.last){l>>>=u&7,u-=u&7,n.mode=kn;break}for(;u<3;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}switch(n.last=l&1,l>>>=1,--u,l&3){case 0:n.mode=gn;break;case 1:if(Kn(n),n.mode=Sn,t===6){l>>>=2,u-=2;break inf_leave}break;case 2:n.mode=yn;break;case 3:e.msg=`invalid block type`,n.mode=J}l>>>=2,u-=2;break;case gn:for(l>>>=u&7,u-=u&7;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if((l&65535)!=(l>>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=J;break}if(n.length=l&65535,l=0,u=0,n.mode=_n,t===6)break inf_leave;case _n:n.mode=vn;case vn:if(p=n.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break inf_leave;i.set(r.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,n.length-=p;break}n.mode=q;break;case yn:for(;u<14;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.nlen=(l&31)+257,l>>>=5,u-=5,n.ndist=(l&31)+1,l>>>=5,u-=5,n.ncode=(l&15)+4,l>>>=4,u-=4,n.nlen>286||n.ndist>30){e.msg=`too many length or distance symbols`,n.mode=J;break}n.have=0,n.mode=bn;case bn:for(;n.have<n.ncode;){for(;u<3;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.lens[O[n.have++]]=l&7,l>>>=3,u-=3}for(;n.have<19;)n.lens[O[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,E={bits:n.lenbits},w=$t(en,n.lens,0,19,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid code lengths set`,n.mode=J;break}n.have=0,n.mode=xn;case xn:for(;n.have<n.nlen+n.ndist;){for(;g=n.lencode[l&(1<<n.lenbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(y<16)l>>>=_,u-=_,n.lens[n.have++]=y;else{if(y===16){for(D=_+2;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(l>>>=_,u-=_,n.have===0){e.msg=`invalid bit length repeat`,n.mode=J;break}C=n.lens[n.have-1],p=3+(l&3),l>>>=2,u-=2}else if(y===17){for(D=_+3;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=_,u-=_,C=0,p=3+(l&7),l>>>=3,u-=3}else{for(D=_+7;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=_,u-=_,C=0,p=11+(l&127),l>>>=7,u-=7}if(n.have+p>n.nlen+n.ndist){e.msg=`invalid bit length repeat`,n.mode=J;break}for(;p--;)n.lens[n.have++]=C}}if(n.mode===J)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=J;break}if(n.lenbits=9,E={bits:n.lenbits},w=$t(tn,n.lens,0,n.nlen,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid literal/lengths set`,n.mode=J;break}if(n.distbits=6,n.distcode=n.distdyn,E={bits:n.distbits},w=$t(nn,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,E),n.distbits=E.bits,w){e.msg=`invalid distances set`,n.mode=J;break}if(n.mode=Sn,t===6)break inf_leave;case Sn:n.mode=Cn;case Cn:if(s>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,Ht(e,f),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,l=n.hold,u=n.bits,n.mode===q&&(n.back=-1);break}for(n.back=0;g=n.lencode[l&(1<<n.lenbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(v&&!(v&240)){for(b=_,x=v,S=y;g=n.lencode[S+((l&(1<<b+x)-1)>>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,n.length=y,v===0){n.mode=On;break}if(v&32){n.back=-1,n.mode=q;break}if(v&64){e.msg=`invalid literal/length code`,n.mode=J;break}n.extra=v&15,n.mode=wn;case wn:if(n.extra){for(D=n.extra;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.length+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=Tn;case Tn:for(;g=n.distcode[l&(1<<n.distbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(!(v&240)){for(b=_,x=v,S=y;g=n.distcode[S+((l&(1<<b+x)-1)>>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,v&64){e.msg=`invalid distance code`,n.mode=J;break}n.offset=y,n.extra=v&15,n.mode=En;case En:if(n.extra){for(D=n.extra;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.offset+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=J;break}n.mode=Dn;case Dn:if(c===0)break inf_leave;if(p=f-c,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){e.msg=`invalid distance too far back`,n.mode=J;break}p>n.wnext?(p-=n.wnext,m=n.wsize-p):m=n.wnext-p,p>n.length&&(p=n.length),h=n.window}else h=i,m=o-n.offset,p=n.length;p>c&&(p=c),c-=p,n.length-=p;do i[o++]=h[m++];while(--p);n.length===0&&(n.mode=Cn);break;case On:if(c===0)break inf_leave;i[o++]=n.length,c--,n.mode=Cn;break;case kn:if(n.wrap){for(;u<32;){if(s===0)break inf_leave;s--,l|=r[a++]<<u,u+=8}if(f-=c,e.total_out+=f,n.total+=f,n.wrap&4&&f&&(e.adler=n.check=n.flags?R(n.check,i,f,o-f):Ze(n.check,i,f,o-f)),f=c,n.wrap&4&&(n.flags?l:In(l))!==n.check){e.msg=`incorrect data check`,n.mode=J;break}l=0,u=0}n.mode=An;case An:if(n.wrap&&n.flags){for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&4&&l!==(n.total&4294967295)){e.msg=`incorrect length check`,n.mode=J;break}l=0,u=0}n.mode=jn;case jn:w=1;break inf_leave;case J:w=-3;break inf_leave;case Mn:return-4;case Nn:default:return-2}return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,(n.wsize||f!==e.avail_out&&n.mode<J&&(n.mode<kn||t!==4))&&qn(e,e.output,e.next_out,f-e.avail_out)?(n.mode=Mn,-4):(d-=e.avail_in,f-=e.avail_out,e.total_in+=d,e.total_out+=f,n.total+=f,n.wrap&4&&f&&(e.adler=n.check=n.flags?R(n.check,i,f,e.next_out-f):Ze(n.check,i,f,e.next_out-f)),e.data_type=n.bits+(n.last?64:0)+(n.mode===q?128:0)+(n.mode===Sn||n.mode===_n?256:0),(d===0&&f===0||t===4)&&w===0&&(w=-5),w)},Yn=e=>{if(Rn(e))return-2;let t=e.state;return t.window&&=null,e.state=null,0},Xn=(e,t)=>{let n=t.length,r,i,a;return Rn(e)||(r=e.state,r.wrap!==0&&r.mode!==mn)?-2:r.mode===mn&&(i=1,i=Ze(i,t,n,0),i!==r.check)?-3:(a=qn(e,t,n,n),a?(r.mode=Mn,-4):(r.havedict=1,0))},Zn=class{constructor(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=``,this.state=null,this.data_type=2,this.adler=0}},Qn=e=>{let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t},$n=Object.prototype.toString,er={level:-1,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,raw:!1,gzip:!1,legacyHash:!1,dictionary:new Uint8Array},tr=class{options;err;msg;ended;started;chunks;strm;result;constructor(e={}){this.options=Object.assign({},er,e);let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg=``,this.ended=!1,this.started=!1,this.chunks=[],this.result=new Uint8Array,this.strm=new Zn,this.strm.avail_out=0;let n=It(this.strm,t.level,8,t.windowBits,t.memLevel,t.strategy,t.legacyHash);if(n!==0)throw Error($e[n]);$n.call(t.dictionary)===`[object ArrayBuffer]`&&(t.dictionary=new Uint8Array(t.dictionary));let r=t.dictionary;if(r.length){if(t.gzip)throw Error(`dictionary is not supported with gzip`);if(n=zt(this.strm,r),n!==0)throw Error($e[n])}}push(e,t=!1){let n=this.strm,r=this.options.chunkSize,i,a;if(this.ended)return!1;for(a=typeof t==`number`?t:t===!0?4:0,typeof e==`string`?n.input=new TextEncoder().encode(e):$n.call(e)===`[object ArrayBuffer]`?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length,this.started||(this.started=!0,this.onStart(n));;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(a===2||a===3)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=Lt(n,a),i===1){n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=Rt(this.strm);break}if(n.avail_out===0){this.onData(n.output);continue}if(a>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)return!0}return this.err=i,this.msg=n.msg||$e[i],this.ended=!0,this.onEnd(i),i===0}onStart(e){}onData(e){this.chunks.push(e)}onEnd(e){e===0&&(this.result=Qn(this.chunks)),this.chunks=[]}};function nr(e,t={}){let n=new tr(t);if(n.push(e,!0),n.err)throw Error(n.msg);return n.result}function rr(e,t={}){return nr(e,Object.assign({},t,{raw:!0}))}function ir(e,t={}){return nr(e,Object.assign({},t,{gzip:!0}))}var ar=Object.prototype.toString,or={chunkSize:1024*64,windowBits:15,raw:!1,dictionary:new Uint8Array},sr=class{options;err;msg;ended;started;chunks;strm;result;constructor(e={}){this.options=Object.assign({},or,e);let t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!e.windowBits&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg=``,this.ended=!1,this.started=!1,this.chunks=[],this.result=new Uint8Array,this.strm=new Zn,this.strm.avail_out=0;let n=Hn(this.strm,t.windowBits);if(n!==0)throw Error($e[n]);ar.call(t.dictionary)===`[object ArrayBuffer]`&&(t.dictionary=new Uint8Array(t.dictionary));let r=t.dictionary;if(t.raw&&r.length&&(n=Xn(this.strm,r),n!==0))throw Error($e[n])}push(e,t=!1){let n=this.strm,r=this.options.chunkSize,i,a,o;if(this.ended)return this.err===0;for(a=typeof t==`number`?t:t===!0?4:0,ar.call(e)===`[object ArrayBuffer]`?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length,this.started||(this.started=!0,this.onStart(n));;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),i=Jn(n,a),i===2){let e=this.options.dictionary;e.length&&(i=Xn(n,e),i===0?i=Jn(n,a):i===-3&&(i=2))}for(;n.avail_in>0&&i===1&&n.state.wrap&2&&n.state.flags!==0&&n.input[n.next_in]!==0;)Bn(n),i=Jn(n,a);if(i===-2||i===-3||i===2||i===-4)break;if(o=n.avail_out,n.next_out&&(n.avail_out===0||i===1||a>0)&&(this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out)),n.avail_out=0,n.next_out=0),!((i===0||i===-5)&&o===0)){if(i===1){i=Yn(this.strm);break}if(n.avail_in===0){if(a===4){i=Yn(this.strm),i===0&&(i=-5);break}return!0}}}return this.err=i,this.msg=n.msg||$e[i],this.ended=!0,this.onEnd(i),i===0}onStart(e){}onData(e){this.chunks.push(e)}onEnd(e){e===0&&(this.result=Qn(this.chunks)),this.chunks=[]}};function cr(e,t={}){let n=new sr(t);if(n.push(e,!0),n.err)throw Error(n.msg);let r=n.result;return t.toText?new TextDecoder().decode(r):r}function lr(e,t={}){return cr(e,{...t,raw:!0})}function ur(e){let t=[],n={},r=[],i=(e,t)=>{if(e in n){let r=n[e];Array.isArray(r)?r.push(String(t)):n[e]=[String(r),String(t)]}else n[e]=t},a=2;for(;a<e.length;){let n=e[a];if(n===`--`){r.push(...e.slice(a+1));break}if(n.startsWith(`--`)){let t=n.slice(2),r=t.indexOf(`=`);if(r!==-1){i(t.slice(0,r),t.slice(r+1)),a++;continue}let o=e[a+1];if(o!==void 0&&!o.startsWith(`-`)){i(t,o),a+=2;continue}i(t,!0),a++;continue}if(n.startsWith(`-`)&&n.length>1){for(let e of n.slice(1))i(e,!0);a++;continue}t.push(n),a++}return{positional:t,flags:n,subcommand:t.length>0&&/^[a-z][\w-]*$/i.test(t[0])?t[0]:null,passthrough:r}}function dr(e){let t=[...e];return Object.defineProperty(t,"parseFlags",{value:()=>ur(t),enumerable:!1,writable:!1,configurable:!1}),t}function fr(e){let t=e=>{if(typeof e==`string`)return e;if(e instanceof Error)return e.message;if(e==null)return String(e);try{return JSON.stringify(e)}catch{return String(e)}},n=(e,t,n)=>t===void 0?`${e(`Error:`)} ${n}\n`:t===``?`${e(n)}\n`:`${e(`${t}:`)} ${n}\n`,r=(t,n)=>t===void 0?`${e.color.yellow(`Warning:`)} ${n}\n`:t===``?`${e.color.yellow(n)}\n`:`${e.color.yellow(`${t}:`)} ${n}\n`;return{die(r,i){let a=typeof i==`number`?i:i?.exitCode??1,o=typeof i==`object`&&i&&`prefix`in i?i.prefix:void 0,s=t(r);throw e.writeStderr(n(e.color.red,o,s)),e.exit(a),Error(`unreachable`)},out(t){if(typeof t==`string`){e.writeStdout(t.endsWith(`
|
|
39
|
+
`)?t:`${t}\n`);return}try{e.writeStdout(`${JSON.stringify(t,null,2)}\n`)}catch{e.writeStdout(`${String(t)}\n`)}},warn(n,i){let a=typeof i==`object`&&i&&`prefix`in i?i.prefix:void 0;e.writeStderr(r(a,t(n)))},help(t){throw e.writeStdout(t.endsWith(`
|
|
40
|
+
`)?t:`${t}\n`),e.exit(0),Error(`unreachable`)}}}const pr={reset:`\x1B[0m`,green:`\x1B[32m`,red:`\x1B[31m`,yellow:`\x1B[33m`,gray:`\x1B[90m`,bold:`\x1B[1m`,cyan:`\x1B[36m`,dim:`\x1B[2m`};function mr(e){let t=e.isTTY&&!e.noColor,n=e=>n=>t?`${e}${n}${pr.reset}`:String(n);return{enabled:t,green:n(pr.green),red:n(pr.red),yellow:n(pr.yellow),gray:n(pr.gray),bold:n(pr.bold),cyan:n(pr.cyan),dim:n(pr.dim)}}const hr={ms:1,s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5,M:26298e5,y:315576e5};function gr(e){if(typeof e==`number`&&Number.isFinite(e))return Math.trunc(e);if(typeof e!=`string`)throw TypeError(`time.parseDuration: spec must be string or number`);let t=e.trim(),n=/^([0-9]+(?:\.[0-9]+)?)\s*(ms|s|m|h|d|w|M|y)?$/.exec(t);if(!n)throw RangeError(`time.parseDuration: unrecognized spec "${e}"`);let r=Number(n[1]),i=n[2]??`ms`;return Math.trunc(r*hr[i])}function _r(e){return e<10?`0${e}`:String(e)}const vr={parseDuration:gr,ago(e,t=new Date){return new Date(t.getTime()-gr(e))},range(e,t=new Date){let n=new Date(t.getTime());return{start:new Date(n.getTime()-gr(e)),end:n}},future(e,t=new Date){let n=new Date(t.getTime());return{start:n,end:new Date(n.getTime()+gr(e))}},gmailDate(e,t=new Date){let n=new Date(t.getTime()-gr(e));return`${n.getFullYear()}/${_r(n.getMonth()+1)}/${_r(n.getDate())}`}},yr=/\u001b\[[0-9;]*m/g;function br(e){return e.replace(yr,``)}function xr(e){return br(e).length}function Sr(e,t){let n=String(e??``);return t<=0?``:xr(n)<=t?n:t<=1?n.slice(0,t):`${br(n).slice(0,t-1)}…`}function Cr(e,t){let n=String(e??``),r=xr(n);return r===t?n:r>t?Sr(n,t):n+` `.repeat(t-r)}function wr(e,t){if(!e.length)return``;let n=Math.max(...e.map(e=>e.length)),r=[];for(let i=0;i<n;i++)if(t&&t[i]!==void 0)r[i]=t[i];else{let t=0;for(let n of e){let e=i<n.length?String(n[i]??``):``;t=Math.max(t,xr(e))}r[i]=t}return e.map(e=>r.map((t,n)=>Cr(n<e.length?String(e[n]??``):``,t)).join(` `).replace(/\s+$/,``)).join(`
|
|
41
|
+
`)}function Tr(e){return e instanceof Date?e:new Date(e)}function Er(e,t=`short`){let n=Tr(e);if(Number.isNaN(n.getTime()))return String(e);if(t===`iso`)return n.toISOString();if(t===`locale`)return new Intl.DateTimeFormat(void 0,{dateStyle:`medium`}).format(n);if(t===`human`){let e=Date.now()-n.getTime(),t=Math.abs(e);if(t<6e4)return e>=0?`just now`:`in a moment`;let r=(t,n)=>e>=0?`${t} ${n}${t===1?``:`s`} ago`:`in ${t} ${n}${t===1?``:`s`}`;return t<36e5?r(Math.round(t/6e4),`minute`):t<864e5?r(Math.round(t/36e5),`hour`):t<26298e5?r(Math.round(t/864e5),`day`):t<315576e5?r(Math.round(t/26298e5),`month`):r(Math.round(t/315576e5),`year`)}return`${n.getFullYear()}-${_r(n.getMonth()+1)}-${_r(n.getDate())}`}const Dr={trunc:Sr,col:Cr,table:wr,date:Er},Or=async(e,t,n)=>{let r=Math.max(1,Math.trunc(e)||1),i=Array(t.length),a=0,o=[],s=async()=>{for(;;){let e=a++;if(e>=t.length)return;i[e]=await n(t[e],e)}};for(let e=0;e<Math.min(r,t.length);e++)o.push(s());return await Promise.all(o),i};function kr(e,t){let n=[];for(let r of e)r===``||r===`.`||(r===`..`?n.length>0&&n[n.length-1]!==`..`?n.pop():t&&n.push(`..`):n.push(r));return n}function Ar(e){if(e.length===0)return`.`;let t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47,r=kr(e.split(`/`),!t).join(`/`);return r.length===0&&!t&&(r=`.`),r.length>0&&n&&(r+=`/`),(t?`/`:``)+r}function jr(...e){let t=e.filter(e=>typeof e==`string`&&e.length>0).join(`/`);return t.length===0?`.`:Ar(t)}function Mr(e){if(e.length===0)return`.`;let t=e.charCodeAt(0)===47,n=-1,r=!0;for(let t=e.length-1;t>=1;t--)if(e.charCodeAt(t)===47){if(!r){n=t;break}}else r=!1;return n===-1?t?`/`:`.`:t&&n===1?`//`:e.slice(0,n)}function Nr(e,t){let n=0,r=-1,i=!0;for(let t=e.length-1;t>=0;t--)if(e.charCodeAt(t)===47){if(!i){n=t+1;break}}else r===-1&&(i=!1,r=t+1);let a=r===-1?``:e.slice(n,r);return t&&a.endsWith(t)&&a!==t?a.slice(0,a.length-t.length):a}function Pr(e){let t=Nr(e),n=t.lastIndexOf(`.`);return n<=0?``:t.slice(n)}function Fr(...e){let t=``,n=!1;for(let r=e.length-1;r>=0&&!n;r--){let i=e[r];typeof i!=`string`||i.length===0||(t=t.length>0?`${i}/${t}`:i,n=i.charCodeAt(0)===47)}n||(t=t.length>0?`/${t}`:`/`);let r=kr(t.split(`/`),!1).join(`/`);return r.length>0?`/${r}`:`/`}function Ir(e,t){let n=Fr(e),r=Fr(t);if(n===r)return``;let i=n.split(`/`).filter(Boolean),a=r.split(`/`).filter(Boolean),o=0;for(;o<i.length&&o<a.length&&i[o]===a[o];)o++;return[...i.slice(o).map(()=>`..`),...a.slice(o)].join(`/`)}function Lr(e){let t=e.charCodeAt(0)===47?`/`:``,n=Nr(e),r=Pr(e),i=r?n.slice(0,n.length-r.length):n,a=Mr(e);return a===`.`&&t===``&&(a=``),{root:t,dir:a,base:n,ext:r,name:i}}function Rr(e){let t=e.dir||e.root||``,n=e.base||`${e.name||``}${e.ext||``}`;return t?t===e.root?`${t}${n}`:`${t}/${n}`:n}const zr={sep:`/`,delimiter:`:`,basename:Nr,dirname:Mr,extname:Pr,isAbsolute:e=>e.length>0&&e.charCodeAt(0)===47,join:jr,normalize:Ar,resolve:Fr,relative:Ir,parse:Lr,format:Rr},Br=65536,Vr={md5:v,sha1:b.sha1,sha256:w};function Hr(e,t){let n=globalThis.Buffer;if(!n)throw Error(`crypto.createHash: Buffer is unavailable in this environment`);return t?n.from(e,t):n.from(e)}function Ur(e,t){return typeof e==`string`?t===`hex`||t===`base64`||t===`base64url`||t===`latin1`||t===`binary`?new Uint8Array(Hr(e,t===`binary`?`latin1`:t)):e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function Wr(e){let t=String(e).toLowerCase().replace(`-`,``),n=Vr[t];if(!n)throw Error(`Digest method not supported: ${e}`);let r=n.create(),i=!1,a={update(e,t){if(i)throw Error(`Digest already called`);return r.update(Ur(e,t)),a},digest(e){i=!0;let t=Hr(r.array());return e?t.toString(e):t}};return a}function Gr(){let e=globalThis.crypto;if(!e||typeof e.getRandomValues!=`function`)throw Error(`crypto: globalThis.crypto is unavailable in this environment`);return e}function Kr(e){return Gr().getRandomValues(e)}function qr(e){for(let t=0;t<e.length;t+=Br){let n=Math.min(t+Br,e.length);Kr(e.subarray(t,n))}}function Jr(e){return e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}const Y=Array.from({length:256},(e,t)=>(t+256).toString(16).slice(1));function Yr(){let e=Gr();if(typeof e.randomUUID==`function`)return e.randomUUID();let t=Kr(new Uint8Array(16));return t[6]=t[6]&15|64,t[8]=t[8]&63|128,`${Y[t[0]]}${Y[t[1]]}${Y[t[2]]}${Y[t[3]]}-${Y[t[4]]}${Y[t[5]]}-${Y[t[6]]}${Y[t[7]]}-${Y[t[8]]}${Y[t[9]]}-${Y[t[10]]}${Y[t[11]]}${Y[t[12]]}${Y[t[13]]}${Y[t[14]]}${Y[t[15]]}`}const Xr={randomFillSync(e,t=0,n){let r=Jr(e),i=t,a=n===void 0?r.length:i+n;return qr(r.subarray(i,a)),e},randomBytes(e){let t=globalThis.Buffer,n=t&&typeof t.allocUnsafe==`function`?t.allocUnsafe(e):new Uint8Array(e);return qr(Jr(n)),n},randomUUID:Yr,getRandomValues(e){return Kr(e)},createHash:Wr,get webcrypto(){return Gr()},get subtle(){return Gr().subtle}};var X=class extends Error{actual;expected;operator;generatedMessage;code;constructor(e={}){let t=!e.message;super(e.message||`${Zr(e.actual)} ${e.operator||`!=`} ${Zr(e.expected)}`),this.name=`AssertionError`,this.actual=e.actual,this.expected=e.expected,this.operator=e.operator||``,this.generatedMessage=t,this.code=`ERR_ASSERTION`}};function Zr(e){if(typeof e==`string`)return JSON.stringify(e);if(e==null)return String(e);if(typeof e==`object`)try{return JSON.stringify(e)}catch{return String(e)}return String(e)}function Z(e,t){return e instanceof Error?e:typeof e==`string`?new X({message:e}):t()}function Qr(e,t,n,r){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!ei(e[i],t[i],n,r))return!1;return!0}function $r(e,t,n,r){let i=Object.keys(e);if(i.length!==Object.keys(t).length)return!1;for(let a of i){if(!Object.prototype.hasOwnProperty.call(t,a))return!1;let i=e[a],o=t[a];if(!ei(i,o,n,r))return!1}return!0}function ei(e,t,n,r){if((n?Object.is(e,t):e===t)||!n&&e==t)return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null)return!1;let i=e,a=t;return n&&Object.getPrototypeOf(i)!==Object.getPrototypeOf(a)?!1:r.get(i)===a?!0:(r.set(i,a),Array.isArray(e)===Array.isArray(t)?Array.isArray(e)&&Array.isArray(t)?Qr(e,t,n,r):$r(i,a,n,r):!1)}function ti(e,t){try{if(e instanceof t)return!0}catch{}try{return!!t(e)}catch{return!1}}function ni(e,t){for(let[n,r]of Object.entries(t)){let t=e[n];if(r instanceof RegExp){if(typeof t!=`string`||!r.test(t))return!1}else if(t!==r)return!1}return!0}function ri(e,t){if(t===void 0)return!0;if(t instanceof RegExp){let n=e instanceof Error?e.message:String(e);return t.test(n)}return typeof t==`function`?ti(e,t):t&&typeof t==`object`?!e||typeof e!=`object`?!1:ni(e,t):!1}function ii(e){let t=(e,t)=>{if(!e)throw Z(t,()=>new X({message:`The expression evaluated to a falsy value`,actual:e,expected:!0,operator:`==`}))},n=((e,n)=>t(e,n)),r=(e,t,n)=>{if(!Object.is(e,t))throw Z(n,()=>new X({actual:e,expected:t,operator:`strictEqual`}))},i=(t,n,i)=>{if(e){r(t,n,i);return}if(t!=n)throw Z(i,()=>new X({actual:t,expected:n,operator:`==`}))},a=(e,t,n)=>{if(Object.is(e,t))throw Z(n,()=>new X({actual:e,expected:t,operator:`notStrictEqual`}))},o=(t,n,r)=>{if(e){a(t,n,r);return}if(t==n)throw Z(r,()=>new X({actual:t,expected:n,operator:`!=`}))},s=(e,t,n)=>{if(!ei(e,t,!0,new WeakMap))throw Z(n,()=>new X({actual:e,expected:t,operator:`deepStrictEqual`}))},c=(t,n,r)=>{if(e){s(t,n,r);return}if(!ei(t,n,!1,new WeakMap))throw Z(r,()=>new X({actual:t,expected:n,operator:`deepEqual`}))},l=(e,t,n)=>{if(ei(e,t,!0,new WeakMap))throw Z(n,()=>new X({actual:e,expected:t,operator:`notDeepStrictEqual`}))};return n.ok=t,n.equal=i,n.notEqual=o,n.strictEqual=r,n.notStrictEqual=a,n.deepEqual=c,n.deepStrictEqual=s,n.notDeepEqual=(t,n,r)=>{if(e){l(t,n,r);return}if(ei(t,n,!1,new WeakMap))throw Z(r,()=>new X({actual:t,expected:n,operator:`notDeepEqual`}))},n.notDeepStrictEqual=l,n.throws=(e,t,n)=>{let r,i=!1;try{e()}catch(e){r=e,i=!0}if(!i)throw Z(typeof t==`string`?t:n,()=>new X({message:`Missing expected exception`,operator:`throws`}));if(!(typeof t==`string`||t instanceof Error)&&!ri(r,t))throw Z(n,()=>new X({message:`Got unwanted exception`,actual:r,operator:`throws`}))},n.doesNotThrow=(e,t)=>{try{e()}catch(e){throw Z(t,()=>new X({message:`Got unwanted exception`,actual:e,operator:`doesNotThrow`}))}},n.fail=e=>{throw Z(e,()=>new X({message:`Failed`,operator:`fail`}))},n.AssertionError=X,n}const ai=ii(!0);ai.strict=ai;const oi=ii(!1);oi.strict=ai;const si=Symbol.for(`nodejs.util.inspect.custom`),ci=Symbol.for(`nodejs.util.promisify.custom`);function li(e){return`'${e.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`).replace(/\n/g,`\\n`)}'`}function ui(e){if(e===null)return`null`;let t=typeof e;if(t===`string`)return li(e);if(t===`number`)return Object.is(e,-0)?`-0`:String(e);if(t===`bigint`)return`${String(e)}n`;if(t===`boolean`||t===`undefined`)return String(e);if(t===`symbol`)return e.toString();if(t===`function`){let t=e.name;return t?`[Function: ${t}]`:`[Function (anonymous)]`}return null}function di(e){return e instanceof RegExp?e.toString():e instanceof Date?Number.isNaN(e.getTime())?`Invalid Date`:e.toISOString():e instanceof Error?e.stack||`${e.name}: ${e.message}`:null}function fi(e,t,n){if(Array.isArray(e))return e.length===0?`[]`:`[ ${e.map(e=>pi(e,t+1,n)).join(`, `)} ]`;if(e instanceof Map){let r=[...e].map(([e,r])=>`${pi(e,t+1,n)} => ${pi(r,t+1,n)}`);return`Map(${e.size}) {${r.length?` ${r.join(`, `)} `:``}}`}if(e instanceof Set){let r=[...e].map(e=>pi(e,t+1,n));return`Set(${e.size}) {${r.length?` ${r.join(`, `)} `:``}}`}let r=Object.keys(e),i=e.constructor?e.constructor.name:``,a=i&&i!==`Object`?`${i} `:``;return r.length===0?`${a}{}`:`${a}{ ${r.map(r=>`${/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(r)?r:li(r)}: ${pi(e[r],t+1,n)}`).join(`, `)} }`}function pi(e,t,n){let r=ui(e);if(r!==null)return r;let i=e,a=di(i);if(a!==null)return a;let o=i[si];if(typeof o==`function`)try{return String(o.call(i,n.maxDepth,n.opts))}catch{}if(n.seen.has(e))return`[Circular *1]`;if(n.maxDepth!==null&&t>n.maxDepth)return Array.isArray(e)?`[Array]`:`[Object]`;n.seen.add(e);try{return fi(i,t,n)}finally{n.seen.delete(e)}}function mi(e,t={}){let n=t.depth===void 0?2:t.depth;return pi(e,0,{seen:new Set,maxDepth:n,opts:t})}function hi(e,t,n,r){if(e===`%%`)return`%`;if(n.i>=t.length)return e;let i=t[n.i];switch(e){case`%s`:return n.i++,typeof i==`string`?i:typeof i==`bigint`?`${String(i)}n`:i==null||typeof i==`number`||typeof i==`boolean`?String(i):mi(i,{depth:r.depth===void 0?2:r.depth});case`%d`:return n.i++,typeof i==`bigint`?`${String(i)}n`:Number.isNaN(Number(i))?`NaN`:String(Number(i));case`%i`:return n.i++,typeof i==`bigint`?`${String(i)}n`:String(Number.parseInt(i,10));case`%f`:return n.i++,String(typeof i==`bigint`?i:Number.parseFloat(i));case`%j`:n.i++;try{return JSON.stringify(i)??`undefined`}catch{return`[Circular]`}case`%o`:return n.i++,mi(i,{depth:4});case`%O`:return n.i++,mi(i,{depth:null});case`%c`:return n.i++,``;default:return e}}function gi(e,...t){let n=t[0];if(typeof n!=`string`)return t.map(e=>typeof e==`string`?e:mi(e)).join(` `);let r={i:1},i=n.replace(/%[sdifjoOc%]/g,n=>hi(n,t,r,e));for(;r.i<t.length;r.i++){let e=t[r.i];i+=` ${typeof e==`string`?e:mi(e)}`}return i}function _i(...e){return gi({},...e)}function vi(e,t){if(e==null)throw TypeError(`The constructor to "inherits" must not be null or undefined`);if(t==null)throw TypeError(`The super constructor to "inherits" must not be null or undefined`);if(t.prototype===void 0)throw TypeError(`The super constructor to "inherits" must have a prototype`);e.super_=t,Object.setPrototypeOf(e.prototype,t.prototype)}function yi(e){if(typeof e!=`function`)throw TypeError(`The "original" argument must be of type function`);let t=e[ci];if(t){if(typeof t!=`function`)throw TypeError(`The [util.promisify.custom] property must be of type function`);return t}function n(...t){return new Promise((n,r)=>{e.call(this,...t,(e,...t)=>{if(e){r(e);return}n(t.length>1?t:t[0])})})}return Object.setPrototypeOf(n,Object.getPrototypeOf(e)),Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)),n}const bi=mi;bi.custom=si;const xi=yi;xi.custom=ci;const Si={format:_i,formatWithOptions:gi,inspect:bi,inherits:vi,promisify:xi};function Ci(e){return typeof e==`string`?new Uint8Array(Hr(e,`utf8`)):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}function wi(e){let t={};return e&&(typeof e.level==`number`&&(t.level=e.level),typeof e.windowBits==`number`&&(t.windowBits=e.windowBits),typeof e.memLevel==`number`&&(t.memLevel=e.memLevel),typeof e.strategy==`number`&&(t.strategy=e.strategy)),t}function Ti(e,t,n){return Hr(e(Ci(t),wi(n)))}function Ei(e,t,n,r){let i=typeof n==`function`?n:r,a=typeof n==`function`?void 0:n;if(typeof i!=`function`)throw TypeError(`zlib: callback is required`);let o;try{o=Ti(e,t,a)}catch(e){queueMicrotask(()=>i(e instanceof Error?e:Error(String(e))));return}queueMicrotask(()=>i(null,o))}const Di={gzipSync:(e,t)=>Ti(ir,e,t),gunzipSync:(e,t)=>Ti(cr,e,t),deflateSync:(e,t)=>Ti(nr,e,t),inflateSync:(e,t)=>Ti(cr,e,t),deflateRawSync:(e,t)=>Ti(rr,e,t),inflateRawSync:(e,t)=>Ti(lr,e,t),gzip:(e,t,n)=>Ei(ir,e,t,n),gunzip:(e,t,n)=>Ei(cr,e,t,n),deflate:(e,t,n)=>Ei(nr,e,t,n),inflate:(e,t,n)=>Ei(cr,e,t,n),deflateRaw:(e,t,n)=>Ei(rr,e,t,n),inflateRaw:(e,t,n)=>Ei(lr,e,t,n),constants:{Z_NO_FLUSH:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1}},Oi={tmpdir:()=>`/tmp`,homedir:()=>`/home/user`,platform:()=>`linux`,arch:()=>`x64`,EOL:`
|
|
42
|
+
`,cpus:()=>[{model:`virtual`,speed:0}],hostname:()=>`slicc`,type:()=>`Linux`,release:()=>`0.0.0`},ki={isatty:e=>!1,ReadStream:class{},WriteStream:class{}};function Ai(e){let t=typeof e==`string`?e:e.href;if(!t.startsWith(`file://`))throw TypeError(`fileURLToPath: not a file URL`);let n=t.slice(7);return decodeURIComponent(n)}function ji(e){let t=e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`);return new URL(`file://${t}`)}const Mi={URL:globalThis.URL,URLSearchParams:globalThis.URLSearchParams,fileURLToPath:Ai,pathToFileURL:ji};var Ni=class{_events=new Map;on(e,t){let n=this._events.get(e);return n?n.push(t):this._events.set(e,[t]),this}addListener(e,t){return this.on(e,t)}off(e,t){let n=this._events.get(e);if(n){let r=n.indexOf(t);r!==-1&&n.splice(r,1),n.length===0&&this._events.delete(e)}return this}removeListener(e,t){return this.off(e,t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};return this.on(e,n)}emit(e,...t){let n=this._events.get(e);if(!n||n.length===0)return!1;for(let e of[...n])e(...t);return!0}removeAllListeners(e){return e===void 0?this._events.clear():this._events.delete(e),this}listenerCount(e){return this._events.get(e)?.length??0}listeners(e){return[...this._events.get(e)??[]]}};const Pi=Object.assign(Ni,{EventEmitter:Ni,default:Ni});var Fi=class{_events=new Map;writable=!0;readable=!0;on(e,t){let n=this._events.get(e);return n?n.push(t):this._events.set(e,[t]),this}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};return this.on(e,n)}off(e,t){let n=this._events.get(e);if(n){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}return this}emit(e,...t){let n=this._events.get(e);if(!n||n.length===0)return!1;for(let e of[...n])e(...t);return!0}pipe(e){return e}removeListener(e,t){return this.off(e,t)}removeAllListeners(){return this._events.clear(),this}},Ii=class extends Fi{read(){return null}destroy(){return this}},Li=class extends Fi{write(e,t,n){return n&&queueMicrotask(n),!0}end(e){return e&&queueMicrotask(e),this}destroy(){return this}},Ri=class extends Fi{write(e,t,n){return n&&queueMicrotask(n),!0}end(e){return e&&queueMicrotask(e),this}read(){return null}destroy(){return this}};const zi={Readable:Ii,Writable:Li,Transform:Ri,PassThrough:class extends Ri{},Stream:Fi};let Bi=1;function Vi(e){if(typeof e==`string`)return e;if(ArrayBuffer.isView(e)){let t=e;return new TextDecoder().decode(new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}return e==null?``:String(e)}function Hi(e,t){return t===void 0||t===`utf8`||t===`utf-8`?e:t===`buffer`||t===null?Hr(e):Hr(e).toString(t)}function Ui(e,t){if(e.length===0)return Hi(``,t);if(typeof e[0]==`string`)return e.join(``);let n=globalThis.Buffer;return n?n.concat(e):e[0]}function Wi(e,t,n){t.length>0&&e.emit(`data`,Hi(t,n)),e.readable=!1,e.emit(`end`)}function Gi(e){let t=e=>{typeof e==`function`&&queueMicrotask(e)};return{writable:!0,write(n,r,i){return e.stdin.write(Vi(n)),t(typeof r==`function`?r:i),!0},end(n,r,i){n!==void 0&&typeof n!=`function`&&e.stdin.write(Vi(n)),e.stdin.end(),this.writable=!1,t(typeof n==`function`?n:typeof r==`function`?r:i)}}}var Ki=class extends Ni{stdout;stderr;stdin;pid;exitCode=null;signalCode=null;killed=!1;spawnfile;spawnargs;handle;constructor(e,t,n,r){super(),this.handle=e,this.pid=Bi++,this.spawnfile=n,this.spawnargs=r,this.stdout=new Ii,this.stderr=new Ii,this.stdin=Gi(e),e.done.then(e=>this.finish(e,t),e=>this.emit(`error`,e instanceof Error?e:Error(String(e))))}finish(e,t){Wi(this.stdout,e.stdout,t),Wi(this.stderr,e.stderr,t),this.exitCode=e.exitCode;let n=this.killed?null:e.exitCode,r=this.killed?this.signalCode:null;this.emit(`exit`,n,r),this.emit(`close`,n,r)}kill(e=`SIGTERM`){return this.killed=!0,this.signalCode=e,this.handle.kill(e).catch(()=>{}),!0}};function qi(e){let t=(t,n,r,i,a)=>{let o=e.start(t),s=new Ki(o,r,i,a);return n.input!==void 0&&s.stdin.write(Vi(n.input)),queueMicrotask(()=>o.stdin.end()),s},n=(e,t,n,r)=>{if(typeof r!=`function`)return;let i=[],a=[];e.stdout.on(`data`,e=>i.push(e)),e.stderr.on(`data`,e=>a.push(e)),e.once(`error`,e=>r(e,Ui(i,t),Ui(a,t))),e.once(`close`,(o,s)=>{let c=Ui(i,t),l=Ui(a,t);if(o===0){r(null,c,l);return}r(Object.assign(Error(`Command failed: ${n}\n${Vi(l)}`),{code:o===null?void 0:o,killed:e.killed,signal:s??null,cmd:n}),c,l)})},r=(e,r,i)=>{let a=typeof r==`function`?r:i,o=r&&typeof r==`object`?r:{},s=o.encoding===void 0?`utf8`:o.encoding,c=t(e,o,s,e,[]);return n(c,s,e,a),c},i=(e,r,i,a)=>{let o=[],s={},c;Array.isArray(r)?(o=r,typeof i==`function`?c=i:(s=i??{},c=typeof a==`function`?a:void 0)):typeof r==`function`?c=r:r&&typeof r==`object`&&(s=r,c=typeof i==`function`?i:void 0);let l=s.encoding===void 0?`utf8`:s.encoding,u=[e,...o],d=t(u,s,l,e,o);return n(d,l,u.join(` `),c),d},a=(e,n,r)=>{let i=[],a={};Array.isArray(n)?(i=n,a=r??{}):n&&typeof n==`object`&&(a=n);let o=a.encoding===void 0?`buffer`:a.encoding,s=a.shell?`${e}${i.length?` ${i.join(` `)}`:``}`:[e,...i];return t(s,a,o,e,i)},o=(e,t)=>new Promise((n,i)=>{r(e,t,(e,t,r)=>{if(e){i(Object.assign(e,{stdout:t,stderr:r}));return}n({stdout:t,stderr:r})})}),s=(e,t,n)=>new Promise((r,a)=>{i(e,Array.isArray(t)?t:[],Array.isArray(t)?n:t,(e,t,n)=>{if(e){a(Object.assign(e,{stdout:t,stderr:n}));return}r({stdout:t,stderr:n})})}),c=e=>()=>{throw Error(`child_process.${e} is not available in the browser realm`)},l=(e,t)=>{Object.defineProperty(e,ci,{value:t,enumerable:!1,configurable:!0})};return l(r,o),l(i,s),{exec:r,execFile:i,spawn:a,execSync:c(`execSync`),spawnSync:c(`spawnSync`),execFileSync:c(`execFileSync`),fork:c(`fork`),ChildProcess:Ki}}function Ji(e){let t=new TextEncoder().encode(e),n=``;for(let e=0;e<t.length;e++)n+=String.fromCharCode(t[e]);return btoa(n)}function Yi(e,t,n){let r=[];t.model&&r.push(`--model`,String(t.model)),t.thinking&&r.push(`--thinking`,String(t.thinking)),t.schema&&r.push(`--schema-b64`,Ji(JSON.stringify(t.schema)));let i=t.readOnly===void 0?`/workspace/`:Array.isArray(t.readOnly)?t.readOnly.join(`,`):String(t.readOnly),a=t.cwd===void 0?n||`.`:String(t.cwd),o=t.allowedCommands===void 0?`*`:String(t.allowedCommands);return[`agent`,...r,`--read-only`,i,a,o,String(e)]}function Xi(e,t){let n=t.cwd,r=async(t,r)=>{let i=r??{},a=await e.spawn(Yi(t,i,n)),o=typeof a.exitCode==`number`?a.exitCode:0;return{finalText:String(a.stdout??``).replace(/\n+$/,``),exitCode:o,stderr:String(a.stderr??``).replace(/\n+$/,``)}},i=(async(e,t)=>{let n=t??{},i=await r(e,n);if(i.exitCode!==0)throw Error(`agent: exited with code ${i.exitCode}${i.stderr?`: ${i.stderr}`:``}`);if(n.schema)try{return JSON.parse(i.finalText)}catch{throw Error(`agent: schema response was not valid JSON (exit ${i.exitCode}): ${i.finalText.slice(0,200)}`)}return i.finalText});return i.spawn=r,i}function Zi(e){let t=``,n=32768;for(let r=0;r<e.length;r+=n)t+=String.fromCharCode(...Array.from(e.subarray(r,r+n)));return btoa(t)}async function Qi(e){let t=[];for(let[n,r]of e.entries()){if(typeof r==`string`){t.push({name:n,value:r});continue}let e=new Uint8Array(await r.arrayBuffer());t.push({name:n,file:{data:Zi(e),filename:typeof r.name==`string`?r.name:`blob`,type:r.type||``}})}return{kind:`formdata`,entries:t}}async function $i(e,t){let n=()=>Object.keys(t).some(e=>e.toLowerCase()===`content-type`);return typeof e==`string`?{body:e}:e instanceof URLSearchParams?(n()||(t[`Content-Type`]=`application/x-www-form-urlencoded;charset=UTF-8`),{body:e.toString()}):e instanceof Blob?{descriptor:{kind:`blob`,data:Zi(new Uint8Array(await e.arrayBuffer())),type:e.type||``}}:e instanceof ArrayBuffer?{descriptor:{kind:`bytes`,data:Zi(new Uint8Array(e))}}:ArrayBuffer.isView(e)?{descriptor:{kind:`bytes`,data:Zi(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}}:e instanceof FormData?{descriptor:await Qi(e)}:(n()||(t[`Content-Type`]=`application/json`),{body:JSON.stringify(e)})}function ea(e){return e?`const __b64 = (s) => { const bin = atob(s); const n = bin.length; const u = new Uint8Array(n); for (let i = 0; i < n; i++) u[i] = bin.charCodeAt(i); return u; };const __body = `+JSON.stringify(e)+`;if (__body.kind === 'bytes') { __init.body = __b64(__body.data); }else if (__body.kind === 'blob') { __init.body = new Blob([__b64(__body.data)], { type: __body.type }); }else if (__body.kind === 'formdata') { const __fd = new FormData(); for (const e of __body.entries) { if (e.file) { __fd.append(e.name, new Blob([__b64(e.file.data)], { type: e.file.type }), e.file.filename); } else { __fd.append(e.name, e.value); } } __init.body = __fd; }`:``}function ta(e){return`const h = {};r.headers.forEach((v, k) => { h[k] = v; });const ct = r.headers.get('content-type') || '';const __rt = `+JSON.stringify(e??null)+`;const __ctl = ct.toLowerCase();const __binPrefixes = ['image/','audio/','video/','application/octet-stream','application/pdf','application/protobuf','application/x-protobuf','application/wasm','application/zip'];const __isXml = __ctl.indexOf('+xml') !== -1 || __ctl.indexOf('application/xml') === 0 || __ctl.indexOf('text/xml') === 0;const __isBinary = __rt === 'binary' || (__rt !== 'text' && __rt !== 'json' && !__isXml && __binPrefixes.some((p) => __ctl.indexOf(p) === 0));if (__isBinary) {const __u = new Uint8Array(await r.arrayBuffer());let __s = ''; const __cs = 0x8000;for (let __i = 0; __i < __u.length; __i += __cs) { __s += String.fromCharCode.apply(null, __u.subarray(__i, __i + __cs)); }return { ok: r.ok, status: r.status, headers: h, body: btoa(__s), bodyEncoding: 'base64' };}const t = await r.text();let b;const __jsonWanted = __rt === 'json' || (__rt !== 'text' && ct.indexOf('application/json') !== -1);if (__jsonWanted) { if (!t) { b = null; } else { try { b = JSON.parse(t); } catch (e) { b = t; } } }else { b = t; }return { ok: r.ok, status: r.status, headers: h, body: b };`}async function na(e,t={}){let n={},r=t.headers??{};for(let[e,t]of Object.entries(r))typeof t==`string`&&(n[e]=t);let i=typeof t.method==`string`?t.method:`GET`,a=t.credentials===`same-origin`||t.credentials===`omit`?t.credentials:`include`,o=t.body,{body:s,descriptor:c}=o==null?{}:await $i(o,n),l={method:i,credentials:a,headers:n};s!==void 0&&(l.body=s);for(let e of[`mode`,`cache`,`redirect`,`referrer`,`referrerPolicy`,`integrity`,`keepalive`]){let n=t[e];n!==void 0&&(l[e]=n)}let u=ea(c),d=ta(t.responseType);return`(async () => {const __init = `+JSON.stringify(l)+`;`+u+`const r = await fetch(`+JSON.stringify(e)+`, __init);`+d+`})()`}function ra(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`&&typeof e.targetId==`string`)return e.targetId;throw TypeError(`browser: expected a tab handle or targetId string`)}function ia(e){function t(t){return{...t,async update(n){let r={};return n.urlMatch!==void 0&&(r.urlMatch=n.urlMatch===null?null:n.urlMatch instanceof RegExp?n.urlMatch.source:n.urlMatch),n.filter!==void 0&&(r.filter=n.filter),e.call(`browser`,`wsUpdate`,[t.id,r])},async close(){return e.call(`browser`,`wsClose`,[t.id])}}}return{on(n,r={}){let i=ra(n),a=r.urlMatch===void 0?void 0:r.urlMatch instanceof RegExp?r.urlMatch.source:r.urlMatch,o,s={filter(e){if(typeof e==`function`||typeof e==`string`)throw TypeError(`browser.websocket: filter must be a declarative JSON object, not a function or string`);return o=e,s},async forward(n){return t(await e.call(`browser`,`wsObserve`,[{targetId:i,urlMatch:a,filter:o,forward:n}]))}};return s},async list(){return e.call(`browser`,`wsList`,[])}}}async function aa(e,t){if(!e&&!(t instanceof Request))return;let n=t instanceof Request?t:null,r=(e?.method??n?.method??`GET`).toUpperCase(),i={};if(e?.headers)if(e.headers instanceof Headers)e.headers.forEach((e,t)=>{i[t]=e});else if(Array.isArray(e.headers))for(let[t,n]of e.headers)i[t]=n;else Object.assign(i,e.headers);else n&&n.headers.forEach((e,t)=>{i[t]=e});let a,o;if(e?.body!==void 0&&e?.body!==null&&e?.body!==``){let t=await oa(e.body);a=t.body,o=t.defaultContentType}return o&&!Object.keys(i).some(e=>e.toLowerCase()===`content-type`)&&(i[`Content-Type`]=o),{method:r,headers:i,body:a}}async function oa(e){if(typeof e==`string`||e instanceof URLSearchParams)return{body:e.toString()};if(e instanceof Blob)return{body:sa(new Uint8Array(await e.arrayBuffer())),defaultContentType:e.type||`application/octet-stream`};if(e instanceof ArrayBuffer)return{body:sa(new Uint8Array(e)),defaultContentType:`application/octet-stream`};if(ArrayBuffer.isView(e))return{body:sa(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),defaultContentType:`application/octet-stream`};throw typeof FormData<`u`&&e instanceof FormData?Error(`node fetch shim: FormData request bodies are not supported (post raw application/x-www-form-urlencoded with URLSearchParams instead)`):typeof ReadableStream<`u`&&e instanceof ReadableStream?Error(`node fetch shim: ReadableStream request bodies are not supported (collect into a Uint8Array or string before calling fetch)`):Error(`node fetch shim: unsupported request body type (${Object.prototype.toString.call(e)}); use a string, Uint8Array, ArrayBuffer, Blob, or URLSearchParams`)}function sa(e){let t=[];for(let n=0;n<e.length;n+=32768)t.push(String.fromCharCode(...e.subarray(n,n+32768)));return t.join(``)}function ca(e){return{findTab:t=>e.call(`browser`,`findTab`,[ua(t)]),ensureTab:(t,n={})=>e.call(`browser`,`ensureTab`,[t,da(n)]),eval:(t,n)=>e.call(`browser`,`eval`,[ra(t),la(n,!1)]),evalAsync:(t,n)=>e.call(`browser`,`evalAsync`,[ra(t),la(n,!0)]),cookie:(t,n)=>e.call(`browser`,`cookie`,[ra(t),n]),localStorage:(t,n)=>e.call(`browser`,`localStorage`,[ra(t),n]),fetch:(t,n,r={})=>na(n,r).then(n=>e.call(`browser`,`evalAsync`,[ra(t),n])),websocket:ia(e)}}function la(e,t){if(typeof e==`function`)return`(${e.toString()})()`;if(typeof e==`string`)return e;throw TypeError(`browser.eval/evalAsync: source must be a function or string`)}function ua(e){let t={};return e.domain!==void 0&&(t.domain=e.domain),e.urlMatch!==void 0&&(t.urlMatch=e.urlMatch instanceof RegExp?e.urlMatch.source:e.urlMatch),t}function da(e){return e.matchUrl===void 0?{}:{matchUrl:e.matchUrl instanceof RegExp?e.matchUrl.source:e.matchUrl}}function fa(e){return e===`SIGKILL`?137:e===`SIGINT`?130:143}function pa(e,t,n,r){let i=async()=>{if(!t?.wasUsed())return;let n=t.getMutations();(n.created.length||n.modified.length||n.deleted.length)&&await e.call(`vfs`,`flushWrites`,[n]),t.resetBaseline()},a=async(i=!1)=>{if(t?.wasUsed())try{let r=await e.call(`vfs`,`snapshot`,[n]);i?t.applySnapshotPreservingMutations(r):t.applySnapshot(r)}catch(e){let t=e instanceof Error?e.message:String(e);r?.(`[sync-fs] re-snapshot after exec failed: ${t}\n`)}},o=async t=>{await i();try{return await e.call(`exec`,`run`,[t])}finally{await a()}},s=async t=>{await i();try{return await e.call(`exec`,`spawn`,[t])}finally{await a()}},c=1,l=Object.assign(o,{spawn:s,start:(t,n)=>{let r=c++,o=[],s=!1,l=!1,u=!1,d,f,p=new Promise((e,t)=>{d=e,f=t}),m=()=>{if(s||u||l)return;l=!0;let c=o.length>0?o.join(``):n?.stdin,p={};c!==void 0&&(p.stdin=c),n?.stdinKind!==void 0&&(p.stdinKind=n.stdinKind),n?.args!==void 0&&(p.args=n.args),(async()=>{try{if(await i(),u){await a(!0);return}s=!0;let n=await e.call(`exec`,`start`,[r,t,p]);await a(!0),d(n)}catch(e){await a(!0),f(e)}})()};return{kill:t=>s?e.call(`exec`,`kill`,[r,t]):(u=!0,d({stdout:``,stderr:``,exitCode:fa(t)}),Promise.resolve(!0)),stdin:{write:e=>{!s&&!u&&o.push(e)},end:()=>m()},done:p}}});return l.exec=l,l}function Q(e){if(!e||e===`/`)return`/`;e.startsWith(`/`)||(e=`/`+e);let t=e.split(`/`),n=[];for(let e of t)e===``||e===`.`||(e===`..`?n.pop():n.push(e));return`/`+n.join(`/`)}function ma(e){let t=Q(e);if(t===`/`)return`/`;let n=t.lastIndexOf(`/`);return n===0?`/`:t.slice(0,n)}function ha(e){return Object.assign(Error(`ENOENT: no such file or directory, '${e}'`),{code:`ENOENT`})}function ga(e){return Object.assign(Error(`ENOSYNC: file too large for sync access, '${e}' — use async readFile() instead`),{code:`ENOSYNC`})}function _a(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var va=class{tree=new Map;initialPaths=new Set;initialContent=new Map;initialIsDirectory=new Map;mkdtempCounter=0;tombstones=new Set;removedDirs=new Set;touched=!1;constructor(e){this.loadSnapshot(e)}loadSnapshot(e){this.tree=new Map,this.tombstones=new Set,this.removedDirs=new Set,this.initialPaths=new Set,this.initialContent=new Map,this.initialIsDirectory=new Map,this.tree.set(`/`,{content:new Uint8Array,isDirectory:!0}),this.initialPaths.add(`/`),this.initialIsDirectory.set(`/`,!0);for(let t of e.entries){let e=Q(t.path);this.tree.set(e,{content:t.content,isDirectory:t.isDirectory,truncated:t.truncated,size:t.size}),this.initialPaths.add(e),this.initialIsDirectory.set(e,t.isDirectory),t.isDirectory||this.initialContent.set(e,t.content)}for(let t of e.entries){let e=ma(Q(t.path));for(;e!==`/`&&!this.tree.has(e);)this.tree.set(e,{content:new Uint8Array,isDirectory:!0}),this.initialPaths.add(e),this.initialIsDirectory.set(e,!0),e=ma(e)}}wasUsed(){return this.touched}applySnapshot(e){this.loadSnapshot(e)}applySnapshotPreservingMutations(e){let t=this.getMutations();this.loadSnapshot(e);for(let e of t.deleted){if(this.tree.get(e)?.isDirectory){let t=e===`/`?`/`:e+`/`;for(let n of Array.from(this.tree.keys()))n!==e&&n.startsWith(t)&&this.tree.delete(n)}this.tree.delete(e)}for(let e of t.created)this.ensureParentDirs(e.path),this.tree.set(e.path,{content:e.content,isDirectory:e.isDirectory});for(let e of t.modified)this.ensureParentDirs(e.path),this.tree.set(e.path,{content:e.content,isDirectory:!1})}resetBaseline(){this.initialPaths=new Set,this.initialContent=new Map,this.initialIsDirectory=new Map;for(let[e,t]of this.tree.entries())this.initialPaths.add(e),this.initialIsDirectory.set(e,t.isDirectory),t.isDirectory||this.initialContent.set(e,t.content)}ensureParentDirs(e){let t=ma(e);t!==`/`&&(this.tree.has(t)||this.mkdir(t,!0))}commitWrite(e,t){this.writeFile(e,t);let n=Q(e);for(this.initialContent.set(n,t);n!==`/`;){let e=this.tree.get(n);e&&(this.initialPaths.add(n),this.initialIsDirectory.set(n,e.isDirectory)),n=ma(n)}}readFile(e){this.touched=!0;let t=Q(e),n=this.tree.get(t);if(!n||n.isDirectory)throw ha(t);if(n.truncated)throw ga(t);return n.content}writeFile(e,t){this.touched=!0;let n=Q(e);this.ensureParentDirs(n),this.tree.set(n,{content:t,isDirectory:!1}),this.tombstones.delete(n),this.removedDirs.delete(n)}exists(e){this.touched=!0;let t=Q(e);return this.tree.has(t)}stat(e){this.touched=!0;let t=Q(e),n=this.tree.get(t);if(!n)throw ha(t);return{isFile:!n.isDirectory,isDirectory:n.isDirectory,size:n.isDirectory?0:n.size??n.content.byteLength}}readdir(e){this.touched=!0;let t=Q(e);if(!this.tree.get(t)?.isDirectory)throw ha(t);let n=t===`/`?`/`:t+`/`,r=new Set;for(let e of this.tree.keys()){if(e===t||e===`/`||!e.startsWith(n))continue;let i=e.slice(n.length).split(`/`)[0];i&&r.add(i)}return Array.from(r)}mkdir(e,t){this.touched=!0;let n=Q(e);if(this.tree.has(n)){if(this.tree.get(n).isDirectory)return;throw Object.assign(Error(`EEXIST: file already exists, '${n}'`),{code:`EEXIST`})}let r=ma(n);if(r!==`/`&&!this.tree.has(r)){if(!t)throw ha(n);this.mkdir(r,!0)}this.tree.set(n,{content:new Uint8Array,isDirectory:!0}),this.tombstones.delete(n),this.removedDirs.delete(n)}rm(e,t){this.touched=!0;let n=Q(e),r=this.tree.get(n);if(!r)throw ha(n);if(r.isDirectory){let e=n===`/`?`/`:n+`/`,r=Array.from(this.tree.keys()).filter(t=>t!==n&&t.startsWith(e));if(r.length>0&&!t)throw Object.assign(Error(`ENOTEMPTY: directory not empty, '${n}'`),{code:`ENOTEMPTY`});for(let e of r)this.tree.delete(e),this.tombstones.add(e);t&&this.removedDirs.add(n)}this.tree.delete(n),this.tombstones.add(n)}copyFile(e,t){this.touched=!0;let n=Q(e),r=this.tree.get(n);if(!r||r.isDirectory)throw ha(n);if(r.truncated)throw ga(n);let i=Q(t);this.ensureParentDirs(i),this.tree.set(i,{content:r.content.slice(),isDirectory:!1}),this.tombstones.delete(i),this.removedDirs.delete(i)}rename(e,t){this.touched=!0;let n=Q(e),r=this.tree.get(n);if(!r)throw ha(n);let i=Q(t);if(r.isDirectory){let e=n===`/`?`/`:n+`/`,t=Array.from(this.tree.keys()).filter(t=>t!==n&&t.startsWith(e));this.ensureParentDirs(i),this.tree.set(i,r),this.tree.delete(n);for(let e of t){let t=this.tree.get(e),r=i+e.slice(n.length);this.tree.set(r,t),this.tree.delete(e)}this.tombstones.add(n),this.removedDirs.add(n),this.tombstones.delete(i),this.removedDirs.delete(i);return}this.ensureParentDirs(i),this.tree.set(i,r),this.tree.delete(n),this.tombstones.add(n),this.tombstones.delete(i),this.removedDirs.delete(i)}unlink(e){this.touched=!0;let t=Q(e),n=this.tree.get(t);if(!n)throw ha(t);if(n.isDirectory)throw Object.assign(Error(`EISDIR: illegal operation on a directory, unlink '${t}'`),{code:`EISDIR`});this.tree.delete(t),this.tombstones.add(t)}isTombstoned(e){let t=Q(e);if(this.tombstones.has(t))return!0;for(let e of this.removedDirs)if(t===e||t.startsWith(`${e}/`))return!0;return!1}mkdtemp(e){this.touched=!0;for(let t=0;t<100;t++){let t=`_${String(this.mkdtempCounter).padStart(6,`0`)}`;this.mkdtempCounter++;let n=Q(e+t);if(!this.tree.has(n))return this.mkdir(n,!0),n}throw Error(`mkdtemp: failed to create unique directory after 100 attempts`)}getMutations(){let e=[],t=[],n=[];for(let[r,i]of this.tree.entries()){if(r===`/`)continue;if(!this.initialPaths.has(r)){e.push({path:r,content:i.content,isDirectory:i.isDirectory});continue}let a=this.initialIsDirectory.get(r);if(a!==void 0&&a!==i.isDirectory){n.push(r),e.push({path:r,content:i.content,isDirectory:i.isDirectory});continue}if(!i.isDirectory){let e=this.initialContent.get(r);e&&!_a(e,i.content)&&t.push({path:r,content:i.content})}}for(let e of this.initialPaths)e!==`/`&&(this.tree.has(e)||n.push(e));return{created:e,modified:t,deleted:n}}};function ya(e,t){function n(e){if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e)){let t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}return e instanceof ArrayBuffer?new Uint8Array(e):new TextEncoder().encode(typeof e==`string`?e:String(e))}async function r(t,n){let r=typeof n==`string`?n:n?.encoding;if(r===null||r===`buffer`){let n=await e.call(`vfs`,`readFileBinary`,[t]),r=globalThis.Buffer;return r?r.from(n instanceof Uint8Array?n:new Uint8Array(n)):n}return e.call(`vfs`,`readFile`,[t])}async function i(t,r){return typeof r==`string`?e.call(`vfs`,`writeFile`,[t,r]):e.call(`vfs`,`writeFileBinary`,[t,n(r)])}async function a(t,r){let i=new Uint8Array;if(await e.call(`vfs`,`exists`,[t])){let n=await e.call(`vfs`,`readFileBinary`,[t]);i=n instanceof Uint8Array?n:new Uint8Array(n)}let a=n(r),o=new Uint8Array(i.byteLength+a.byteLength);o.set(i),o.set(a,i.byteLength),await e.call(`vfs`,`writeFileBinary`,[t,o])}async function o(t,n,r){let i=await e.call(`vfs`,`stat`,[t]);if(i.isFile){let r=await e.call(`vfs`,`readFileBinary`,[t]);await e.call(`vfs`,`writeFileBinary`,[n,r]);return}if(!i.isDirectory||!r?.recursive)throw Error(`cp: '${t}' is a directory (use {recursive: true})`);await c(n);let a=await e.call(`vfs`,`readDir`,[t]);for(let e of a)await o(`${t}/${e}`,`${n}/${e}`,r)}async function s(t,n){if(n?.force&&!await e.call(`vfs`,`exists`,[t]))return!0;if((await e.call(`vfs`,`stat`,[t])).isFile)return e.call(`vfs`,`rm`,[t]);if(!n?.recursive)throw Error(`rm: '${t}' is a directory (use {recursive: true})`);let r=await e.call(`vfs`,`readDir`,[t]);for(let e of r)await s(`${t}/${e}`,n);return e.call(`vfs`,`rm`,[t])}async function c(t){await e.call(`vfs`,`mkdir`,[t])}async function l(t){for(let n=0;n<5;n++){let n=`${t}${Math.random().toString(36).slice(2,10)+Math.random().toString(36).slice(2,6)}`;if(!await e.call(`vfs`,`exists`,[n]))return await e.call(`vfs`,`mkdir`,[n]),n}throw Error(`mkdtemp: failed to create unique directory after 5 attempts`)}async function u(t,n){try{await e.call(`vfs`,`rename`,[t,n])}catch{let r=await e.call(`vfs`,`readFileBinary`,[t]);await e.call(`vfs`,`writeFileBinary`,[n,r]),await e.call(`vfs`,`rm`,[t])}}async function d(t){if(!await e.call(`vfs`,`exists`,[t]))throw Object.assign(Error(`ENOENT: no such file or directory, access '${t}'`),{code:`ENOENT`})}let f={readFile:r,readFileBinary:t=>e.call(`vfs`,`readFileBinary`,[t]),writeFile:i,writeFileBinary:(t,n)=>e.call(`vfs`,`writeFileBinary`,[t,n]),appendFile:a,cp:o,rm:s,readDir:t=>e.call(`vfs`,`readDir`,[t]),readdir:t=>e.call(`vfs`,`readDir`,[t]),exists:t=>e.call(`vfs`,`exists`,[t]),stat:t=>e.call(`vfs`,`stat`,[t]),mkdir:(t,n)=>e.call(`vfs`,`mkdir`,[t]),mkdtemp:l,rename:u,access:d,unlink:t=>e.call(`vfs`,`rm`,[t]),rmdir:t=>e.call(`vfs`,`rm`,[t]),copyFile:async(t,n)=>{let r=await e.call(`vfs`,`readFileBinary`,[t]);await e.call(`vfs`,`writeFileBinary`,[n,r])},fetchToFile:async(n,r)=>{let i=await t(n);if(!i.ok)throw Error(`fetch ${i.status} ${i.statusText}`);let a=new Uint8Array(await i.arrayBuffer());return await e.call(`vfs`,`writeFileBinary`,[r,a]),a.byteLength},promises:null};return f.promises=f,f}function ba(e,t,n=``){return Object.assign(Error(`${e}: sync-fs, ${n?`${n} `:``}'${t}'`),{code:e})}function xa(e){if(typeof e==`string`)return new TextEncoder().encode(e);if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e)){let t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}return new TextEncoder().encode(String(e))}function Sa(e,t,n){function r(e){return Q(e.startsWith(`/`)?e:t+(t.endsWith(`/`)?``:`/`)+e)}function i(t){try{return e.readFile(t)}catch(r){let i=r?.code;if(n&&!e.isTombstoned(t)&&(i===`ENOENT`||i===`ENOSYNC`))return n.readFile(t);throw r}}function a(t,r){n?(n.writeFile(t,r),e.commitWrite(t,r)):e.writeFile(t,r)}function o(t){if(e.exists(t))return!0;if(!n||e.isTombstoned(t))return!1;try{return n.exists(t)}catch{return!1}}function s(t){try{return e.stat(t)}catch(r){let i=r?.code;if(!n||e.isTombstoned(t)||i!==`ENOENT`)throw r;return n.stat(t)}}function c(t){try{return e.readdir(t)}catch(r){let i=r?.code;if(!n||e.isTombstoned(t)||i!==`ENOENT`)throw r;return n.readdir(t)}}let l=e=>({isFile:()=>e.isFile,isDirectory:()=>e.isDirectory,size:e.size}),u=(e,t)=>e===`/`?`/${t}`:`${e}/${t}`;function d(t,n){if(!s(t).isDirectory){a(n,i(t));return}e.mkdir(n,!0);for(let e of c(t))d(u(t,e),u(n,e))}return{readFileSync(e,t){let n=typeof t==`string`?t:t?.encoding,a=i(r(e));if(n===`utf8`||n===`utf-8`)return new TextDecoder().decode(a);let o=globalThis.Buffer;return o?o.from(a):a},writeFileSync(e,t){a(r(e),xa(t))},appendFileSync(e,t){let n=r(e),o=new Uint8Array;try{o=i(n)}catch(e){if(e?.code!==`ENOENT`)throw e}let s=xa(t),c=new Uint8Array(o.byteLength+s.byteLength);c.set(o),c.set(s,o.byteLength),a(n,c)},truncateSync(e,t=0){let n=r(e),o=i(n),s=new Uint8Array(t);s.set(o.subarray(0,Math.min(t,o.byteLength))),a(n,s)},existsSync(e){return o(r(e))},accessSync(e){let t=r(e);if(!o(t))throw ba(`ENOENT`,t,`access`)},mkdirSync(t,n){e.mkdir(r(t),n?.recursive)},statSync(e){return l(s(r(e)))},lstatSync(e){return l(s(r(e)))},realpathSync(e){let t=r(e);if(!o(t))throw ba(`ENOENT`,t,`realpath`);return t},readdirSync(e){return c(r(e))},rmSync(t,n){let i=r(t);n?.force&&!e.exists(i)||e.rm(i,n?.recursive)},rmdirSync(t,n){let i=r(t);if(o(i)&&!s(i).isDirectory)throw ba(`ENOTDIR`,i,`rmdir`);e.rm(i,n?.recursive)},copyFileSync(e,t){a(r(t),i(r(e)))},cpSync(e,t){d(r(e),r(t))},chmodSync(e){let t=r(e);if(!o(t))throw ba(`ENOENT`,t,`chmod`)},mkdtempSync(t){return e.mkdtemp(r(t))},unlinkSync(t){e.unlink(r(t))},renameSync(t,n){e.rename(r(t),r(n))}}}function Ca(e){if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(e instanceof ArrayBuffer)return new Uint8Array(e);throw TypeError(`expected an ArrayBuffer or typed array`)}function wa(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ta(e){return e==null?[]:Array.isArray(e)?e:[e]}function Ea(e,t){let n=t.handle,r=new Set,i=new Set,a=!1,o=null,s=e=>{let t=e;if(!t||t.handle!==n)return;let i={reportId:t.reportId,data:wa(t.bytes)};for(let e of[...r])try{e(i)}catch{}},c=()=>{a||(a=!0,o=e.onEvent?e.onEvent(`hid-input-report`,s):null,e.call(`hid`,`subscribeInputReports`,[n]).catch(()=>{a=!1,o?.(),o=null}))},l=()=>{!a||r.size>0||(a=!1,o?.(),o=null,e.call(`hid`,`unsubscribeInputReports`,[n]).catch(()=>{}))};return{...t,open:()=>e.call(`hid`,`open`,[n]),close:()=>e.call(`hid`,`close`,[n]),sendReport:(t,r)=>e.call(`hid`,`sendReport`,[n,t,Ca(r)]),sendFeatureReport:(t,r)=>e.call(`hid`,`sendFeatureReport`,[n,t,Ca(r)]),receiveFeatureReport:async t=>wa((await e.call(`hid`,`receiveFeatureReport`,[n,t])).bytes),addEventListener(e,t){if(e===`inputreport`)r.add(t),c();else if(e===`disconnect`)i.add(t);else throw TypeError(`hid device: unknown event type '${String(e)}'`)},removeEventListener(e,t){e===`inputreport`?(r.delete(t),l()):e===`disconnect`&&i.delete(t)},onInputReport(e){r.add(e),c()}}}function Da(e){return{list:async()=>(await e.call(`hid`,`list`,[])).map(t=>Ea(e,t)),request:async t=>{let n=(await e.call(`hid`,`request`,[Ta(t)]))[0];if(!n)throw Error(`No device selected.`);return Ea(e,n)}}}const Oa=new Set([`child_process`,`events`,`fs`,`fs/promises`,`os`,`path`,`stream`,`tty`,`url`,`crypto`,`process`,`buffer`,`assert`,`assert/strict`,`util`]),ka=new Set([...new Set(`assert.assert/strict.async_hooks.buffer.child_process.cluster.console.constants.crypto.dgram.diagnostics_channel.dns.dns/promises.domain.events.fs.fs/promises.http.http2.https.inspector.inspector/promises.module.net.os.path.path/posix.path/win32.perf_hooks.process.punycode.querystring.readline.readline/promises.repl.stream.stream/consumers.stream/promises.stream/web.string_decoder.sys.timers.timers/promises.tls.trace_events.tty.url.util.util/types.v8.vm.wasi.worker_threads.zlib`.split(`.`))].filter(e=>!Oa.has(e)));function Aa(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var ja=class{rpc;targetId;selector;index;constructor(e,t,n,r){this.rpc=e,this.targetId=t,this.selector=n,this.index=r}evalOnElement(e){let t=`(() => { const els = document.querySelectorAll(${JSON.stringify(this.selector)}); const el = els[${this.index}]; ${e} })()`;return this.rpc.call(`browser`,`evalAsync`,[this.targetId,t])}async textContent(){return this.evalOnElement(`return el ? el.textContent : null;`)}async getAttribute(e){return this.evalOnElement(`return el ? el.getAttribute(${JSON.stringify(e)}) : null;`)}async isVisible(){return this.evalOnElement(`if (!el) return false; const s = getComputedStyle(el); if (s.display === 'none' || s.visibility === 'hidden' || s.opacity === '0') return false; const r = el.getBoundingClientRect(); return r.width > 0 && r.height > 0;`)}async boundingBox(){return this.evalOnElement(`if (!el) return null; const r = el.getBoundingClientRect(); return { x: r.x, y: r.y, width: r.width, height: r.height };`)}},Ma=class{rpc;targetId;onClose;closed=!1;constructor(e,t,n){this.rpc=e,this.targetId=t,this.onClose=n}async goto(e,t){await this.rpc.call(`browser`,`navigateTab`,[this.targetId,e])}async waitForLoadState(e){await this.rpc.call(`browser`,`waitForLoadState`,[this.targetId,e??`load`])}async waitForTimeout(e){await new Promise(t=>setTimeout(t,e))}async evaluate(e,...t){let n=typeof e==`string`?e:`(${e.toString()}).apply(null, JSON.parse(${JSON.stringify(JSON.stringify(t))}))`;return this.rpc.call(`browser`,`evalAsync`,[this.targetId,n])}async screenshot(e){let t={};e?.fullPage!==void 0&&(t.fullPage=e.fullPage);let n=Aa(await this.rpc.call(`browser`,`screenshotTab`,[this.targetId,t]));return e?.path&&await this.rpc.call(`vfs`,`writeFileBinary`,[e.path,n]),n}async $(e){return await this.rpc.call(`browser`,`evalAsync`,[this.targetId,`!!document.querySelector(${JSON.stringify(e)})`])?new ja(this.rpc,this.targetId,e,0):null}async $$(e){let t=await this.rpc.call(`browser`,`evalAsync`,[this.targetId,`document.querySelectorAll(${JSON.stringify(e)}).length`]),n=[];for(let r=0;r<t;r++)n.push(new ja(this.rpc,this.targetId,e,r));return n}async $$eval(e,t,...n){if(typeof t==`string`)return this.rpc.call(`browser`,`evalAsync`,[this.targetId,t]);let r=`(${t.toString()}).apply(null, [Array.from(document.querySelectorAll(${JSON.stringify(e)}))].concat(JSON.parse(${JSON.stringify(JSON.stringify(n))})))`;return this.rpc.call(`browser`,`evalAsync`,[this.targetId,r])}async content(){return this.rpc.call(`browser`,`evalAsync`,[this.targetId,`document.documentElement.outerHTML`])}async setViewportSize(e){await this.rpc.call(`browser`,`setViewport`,[this.targetId,e.width,e.height])}async close(){this.closed||(this.closed=!0,await this.rpc.call(`browser`,`closeTab`,[this.targetId]),this.onClose?.())}},Na=class{rpc;openPages=[];constructor(e){this.rpc=e}async newPage(e){let t=await this.rpc.call(`browser`,`createTab`,[`about:blank`]);e?.viewport&&await this.rpc.call(`browser`,`setViewport`,[t,e.viewport.width,e.viewport.height]);let n=new Ma(this.rpc,t,()=>{let e=this.openPages.indexOf(n);e!==-1&&this.openPages.splice(e,1)});return this.openPages.push(n),n}pages(){return[...this.openPages]}async close(){let e=this.openPages.splice(0,this.openPages.length);for(let t of e)await t.close()}},Pa=class{rpc;openPages=[];openContexts=[];constructor(e){this.rpc=e}async newPage(e){let t=await this.rpc.call(`browser`,`createTab`,[`about:blank`]);e?.viewport&&await this.rpc.call(`browser`,`setViewport`,[t,e.viewport.width,e.viewport.height]);let n=new Ma(this.rpc,t,()=>{let e=this.openPages.indexOf(n);e!==-1&&this.openPages.splice(e,1)});return this.openPages.push(n),n}async newContext(e){let t=new Na(this.rpc);return this.openContexts.push(t),t}contexts(){return[...this.openContexts]}async close(){let e=this.openPages.splice(0,this.openPages.length);for(let t of e)await t.close();let t=this.openContexts.splice(0,this.openContexts.length);for(let e of t)await e.close()}};function Fa(e){let t=async t=>new Pa(e),n=async(t,n)=>new Pa(e);return{chromium:{launch:t,connect:n,connectOverCDP:n},firefox:{launch:t,connect:n},webkit:{launch:t,connect:n}}}function Ia(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t<0?``:t===0?`/`:e.substring(0,t)}var La=class extends Error{code;constructor(e){super(`Process exited with code ${e}`),this.code=e,this.name=`NodeExitError`}};function Ra(e){if(typeof e==`string`)return e;if(e==null)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function za(e,t){return{log:(...t)=>e(`${t.map(Ra).join(` `)}
|
|
43
|
+
`),info:(...t)=>e(`${t.map(Ra).join(` `)}
|
|
44
|
+
`),warn:(...e)=>t(`${e.map(Ra).join(` `)}
|
|
45
|
+
`),error:(...e)=>t(`${e.map(Ra).join(` `)}
|
|
46
|
+
`)}}function Ba(e,t,n){let r=!!e.env?.NO_COLOR,i=Va(e.stdin??``),a=dr(e.argv),o=!1;return{processShim:{argv:a,env:e.env,cwd:()=>e.cwd,exit:e=>{throw o=!0,new La(Number.isFinite(e)?Number(e):0)},stdin:i,stdout:{write:t,isTTY:!r},stderr:{write:n,isTTY:!r}},getDidCallProcessExit:()=>o}}function Va(e){let t=!1;return{isTTY:!1,read(){return t?null:(t=!0,e)},toString(){return e},[Symbol.asyncIterator](){return{async next(){return t?{value:void 0,done:!0}:(t=!0,{value:e,done:!1})}}}}}const Ha=new Set([`bcrypt`,`better-sqlite3`,`canvas`,`cpu-features`,`fsevents`,`leveldown`,`libxmljs`,`libxmljs2`,`node-gyp-build`,`node-sass`,`puppeteer`,`robotjs`,`sass-embedded`,`sharp`,`snappy`,`sqlite3`,`tree-sitter`,`usb`]),Ua={sharp:` Use the built-in 'convert' shell command for image work.`,canvas:` Use the built-in 'convert' / OffscreenCanvas for image work.`,"better-sqlite3":` Use the built-in 'sqlite3' shell command (sql.js WASM).`,sqlite3:` Use the built-in 'sqlite3' shell command (sql.js WASM).`,bcrypt:` Use crypto.subtle.digest() with PBKDF2 / Argon2 in pure JS.`,puppeteer:` Use the built-in browser-automation shell commands.`};function Wa(e,t){let n=Ua[t]??``;return Error(`require('${e}'): '${t}' is a Node native module (C++ bindings) — it cannot run in the browser sandbox.${n}`)}function Ga(e){return{...e,time:vr,fmt:Dr,pool:Or}}function Ka(e,t){return e?.startsWith(`/`)?Ia(e):t}function qa(e){return e.includes(`require`)||e.includes(`import`)}async function Ja(e,t,n,r){return qa(t)?e.call(`module`,`buildGraph`,[t,Ka(r,n),r]):{files:[],entryMap:{},edges:{},errors:{}}}function Ya(e){if(typeof e!=`object`||!e)return;let t=e;if(t.__esModule&&!Object.prototype.hasOwnProperty.call(t,`default`)&&Object.isExtensible(t))try{Object.defineProperty(t,"default",{value:t,enumerable:!1,configurable:!0})}catch{}}function Xa(e){return{playwright:Fa(e)}}function Za(e){let{graph:t,fsBridge:n,processShim:r,childProcess:i,nodeConsole:a,sliccyModules:o,shimmedPackages:s={}}=e,c=new Map(t.files.map(e=>[e.path,e.cjsSource])),l=new Map(t.files.map(e=>[e.path,e.kind])),u=new Map,d=e=>{if(typeof e==`string`&&e.startsWith(`sliccy:`))return{hit:!0,value:eo(e,o)};let t=e.startsWith(`node:`)?e.slice(5):e,a=Qa(t,n,r,i);if(a.hit)return a;if(Ha.has(t))throw Wa(e,t);if(ka.has(t))throw no(e,t);return t in s?{hit:!0,value:s[t]}:{hit:!1}},f=(e,n)=>{let r=d(n);if(r.hit)return r.value;let i=e?.[n];if(i)return p(i);throw n in t.errors?Error(t.errors[n]):$a(n)};function p(e){let n=u.get(e);if(n)return n.exports;let i=c.get(e);if(i===void 0)throw Error(`Cannot find module '${e}'`);let o={exports:{}};u.set(e,o);let s=n=>f(t.edges[e],n),d=Ia(e);return Function(`module`,`exports`,`require`,`__dirname`,`__filename`,`process`,`console`,`Buffer`,`global`,i)(o,o.exports,s,d,e,r,a,globalThis.Buffer,globalThis),l.get(e)===`cjs`&&Ya(o.exports),o.exports}return{require:e=>f(t.entryMap,e)}}function Qa(e,t,n,r){return e===`fs`||e===`fs/promises`?{hit:!0,value:t}:e===`path`?{hit:!0,value:zr}:e===`crypto`?{hit:!0,value:Xr}:e===`child_process`?{hit:!0,value:r}:e===`process`?{hit:!0,value:n}:e===`buffer`?{hit:!0,value:{Buffer:globalThis.Buffer}}:e===`assert`?{hit:!0,value:oi}:e===`assert/strict`?{hit:!0,value:ai}:e===`util`?{hit:!0,value:Si}:e===`events`?{hit:!0,value:Pi}:e===`os`?{hit:!0,value:Oi}:e===`tty`?{hit:!0,value:ki}:e===`stream`?{hit:!0,value:zi}:e===`url`?{hit:!0,value:Mi}:e===`zlib`?{hit:!0,value:Di}:{hit:!1}}function $a(e){if(e.startsWith(`.`)||e.startsWith(`/`)||e.startsWith(`node:`))return Error(`Cannot find module '${e}'`);let t=e.startsWith(`@`)?e.split(`/`).slice(0,2).join(`/`):e.split(`/`)[0];return Error(`Cannot find module '${e}' (run: ipk install ${t})`)}function eo(e,t){let n=e.slice(7);if(n===``)throw Error(`require('sliccy:'): empty sliccy: module name`);if(!Object.prototype.hasOwnProperty.call(t,n))throw Error(`require('${e}'): unknown sliccy: module '${n}'. Known names: ${Object.keys(t).sort().join(`, `)}`);return t[n]}const to={http:` Use fetch() instead.`,https:` Use fetch() instead.`,crypto:` Use globalThis.crypto (Web Crypto API) instead.`};function no(e,t){return Error(`require('${e}'): Node built-in '${t}' is not available in the browser environment.${to[t]||``}`)}async function ro(e,t,n,r){let i=Object.keys(t),a=i.map(e=>t[e]),o=Object.getPrototypeOf(async function(){}).constructor,s=new o(...i,`${r?`"use strict";
|
|
47
|
+
`:``}${e}`);try{return await s(...a),0}catch(e){return e instanceof La?e.code:(n(`${e instanceof Error?e.stack??e.message:String(e)}\n`),1)}}var io=class{port;nextId=1;pending=new Map;eventSubscribers=new Map;handler;disposed=!1;constructor(e){this.port=e,this.handler=e=>{let t=e.data;if(t?.type===`realm-rpc-res`){let t=e.data,n=this.pending.get(t.id);if(!n)return;this.pending.delete(t.id),typeof t.error==`string`?n.reject(Error(t.error)):n.resolve(t.result);return}if(t?.type===`realm-event`){let t=e.data,n=this.eventSubscribers.get(t.channel);if(!n)return;for(let e of[...n])try{e(t.payload)}catch{}}},e.addEventListener(`message`,this.handler),e.start?.()}get pendingCount(){return this.pending.size}call(e,t,n=[]){if(this.disposed)return Promise.reject(Error(`realm-rpc: client disposed`));let r=this.nextId++,i={type:`realm-rpc-req`,id:r,channel:e,op:t,args:n};return new Promise((e,t)=>{this.pending.set(r,{resolve:e,reject:t}),this.port.postMessage(i)})}onEvent(e,t){if(this.disposed)return()=>{};let n=this.eventSubscribers.get(e);return n||(n=new Set,this.eventSubscribers.set(e,n)),n.add(t),()=>{let n=this.eventSubscribers.get(e);n&&(n.delete(t),n.size===0&&this.eventSubscribers.delete(e))}}dispose(){if(this.disposed)return;this.disposed=!0,this.port.removeEventListener(`message`,this.handler);let e=Error(`realm-rpc: client disposed`);for(let t of this.pending.values())t.reject(e);this.pending.clear(),this.eventSubscribers.clear()}};function ao(e,t){let n=t.handle;return{...t,open:t=>e.call(`serial`,`open`,[n,t]),close:()=>e.call(`serial`,`close`,[n]),read:(t={})=>e.call(`serial`,`read`,[n,{maxBytes:t.maxBytes??t.bytes,until:t.until?Ca(t.until):void 0,timeoutMs:t.timeoutMs}]),write:t=>e.call(`serial`,`write`,[n,Ca(t)]),getSignals:()=>e.call(`serial`,`getSignals`,[n]),setSignals:t=>e.call(`serial`,`setSignals`,[n,t])}}function oo(e){return{list:async()=>(await e.call(`serial`,`list`,[])).map(t=>ao(e,t)),request:async t=>ao(e,await e.call(`serial`,`request`,[Ta(t)]))}}function so(e,t){let n=t.handle,r=e=>({status:e.status,data:wa(e.bytes)});return{...t,open:()=>e.call(`usb`,`open`,[n]),close:()=>e.call(`usb`,`close`,[n]),reset:()=>e.call(`usb`,`reset`,[n]),selectConfiguration:t=>e.call(`usb`,`selectConfig`,[n,t]),claimInterface:t=>e.call(`usb`,`claim`,[n,t]),releaseInterface:t=>e.call(`usb`,`release`,[n,t]),controlTransferIn:async(t,i)=>r(await e.call(`usb`,`controlIn`,[n,t,i])),controlTransferOut:(t,r)=>e.call(`usb`,`controlOut`,[n,t,Ca(r)]),transferIn:async(t,i)=>r(await e.call(`usb`,`transferIn`,[n,t,i])),transferOut:(t,r)=>e.call(`usb`,`transferOut`,[n,t,Ca(r)])}}function co(e){return{list:async()=>(await e.call(`usb`,`list`,[])).map(t=>so(e,t)),request:async t=>so(e,await e.call(`usb`,`request`,[Ta(t)]))}}function lo(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t<0?``:t===0?`/`:e.substring(0,t)}function uo(e){return/^[A-Za-z0-9_\-./:@]+$/.test(e)?e:`'`+e.replace(/'/g,`'\\''`)+`'`}function fo(e,t){return e===``?t:e===`/`?`/${t}`:`${e}/${t}`}function po(e){let t=lo(e.argv[1]??``),n=fo(t,`references`),r=fo(t,`assets`),i=fo(t,`.config`);async function a(){let t;try{t=await e.fs.exists(i)}catch{return null}if(!t)return null;let n;try{n=await e.fs.readFile(i)}catch{return null}let r=typeof n==`string`?n:String(n);if(!r.trim())return null;let a;try{a=JSON.parse(r)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`skill.config(): failed to parse ${i}: ${t}`)}if(a&&typeof a==`object`&&!Array.isArray(a))return a;throw Error(`skill.config(): ${i} must contain a JSON object`)}async function o(t){let n=await a();if(t===void 0)return n;if(typeof t!=`object`||!t||Array.isArray(t))throw TypeError(`skill.config(updates): updates must be a plain object`);let r={...n??{},...t};return await e.fs.writeFile(i,JSON.stringify(r,null,2)+`
|
|
48
|
+
`),r}async function s(t){if(typeof t!=`string`||!t.trim())throw TypeError(`skill.token(providerId): providerId must be a non-empty string`);let n=`oauth-token ${uo(t)}`,{stdout:r,stderr:i,exitCode:a}=await e.exec(n);if(a!==0){let e=i.trim()||`oauth-token exited with code ${a}`;throw Error(`skill.token('${t}'): ${e}`)}return r.replace(/\r?\n+$/,``)}return Object.freeze({dir:t,refs:n,assets:r,config:o,token:s})}function $(e,t){return Object.assign(Error(`${e}: sync-fs bridge, '${t}'`),{code:e})}function mo(e,t){let n=`/__slicc/fs-sync`+(e.startsWith(`/`)?e:`/${e}`).split(`/`).map(encodeURIComponent).join(`/`);return t?`${n}?op=${t}`:n}function ho(e,t={}){let n=t.timeoutMs??3e4;function r(t,r,i,a){let o=new XMLHttpRequest;try{o.open(t,mo(r,a),!1),o.responseType=`arraybuffer`,o.timeout=n,o.setRequestHeader(`x-slicc-fs-token`,e),i?o.send(new Uint8Array(i)):o.send()}catch{throw $(`EIO`,r)}return o}function i(e,t){try{let t=new Uint8Array(e.response);return JSON.parse(new TextDecoder().decode(t))}catch{throw $(`EIO`,t)}}function a(e,t){throw $(e.getResponseHeader(`x-slicc-fs`)===`1`&&e.getResponseHeader(`x-slicc-fs-errno`)||`EIO`,t)}function o(e){return e.status>=200&&e.status<300&&e.getResponseHeader(`x-slicc-fs`)===`1`}return{readFile(e){let t=r(`GET`,e);if(o(t))return new Uint8Array(t.response);if(t.status>=200&&t.status<300)throw $(`EIO`,e);a(t,e)},writeFile(e,t){let n=r(`POST`,e,t);if(!o(n)){if(n.status>=200&&n.status<300)throw $(`EIO`,e);a(n,e)}},stat(e){let t=r(`GET`,e,void 0,`stat`);if(o(t)){let n=i(t,e);if(!n||typeof n.isFile!=`boolean`||typeof n.isDirectory!=`boolean`||typeof n.size!=`number`)throw $(`EIO`,e);return{isFile:n.isFile,isDirectory:n.isDirectory,size:n.size}}if(t.status>=200&&t.status<300)throw $(`EIO`,e);a(t,e)},readdir(e){let t=r(`GET`,e,void 0,`readdir`);if(o(t)){let n=i(t,e);if(!Array.isArray(n)||!n.every(e=>typeof e==`string`))throw $(`EIO`,e);return n}if(t.status>=200&&t.status<300)throw $(`EIO`,e);a(t,e)},exists(e){let t=r(`GET`,e,void 0,`exists`);if(o(t)){let n=i(t,e);if(typeof n!=`boolean`)throw $(`EIO`,e);return n}if(t.status>=200&&t.status<300)throw $(`EIO`,e);a(t,e)}}}async function go(e,t,n){let r;try{r=await e.call(`vfs`,`snapshot`,[t])}catch(e){n?.(e instanceof Error?e.message:String(e)),r={entries:[]}}return new va(r)}function _o(e,t){if(e.syncFsToken)return e=>t(`[sync-fs] snapshot failed, sync metadata will be incomplete: ${e}\n`)}function vo(e){return e.syncFsToken?ho(e.syncFsToken):void 0}function yo(e){return{usbBridge:co(e),serialBridge:oo(e),hidBridge:Da(e)}}async function bo(e,t){let n=[],r=[],i=e=>{n.push(typeof e==`string`?e:String(e))},a=e=>{r.push(typeof e==`string`?e:String(e))},o=za(i,a),{processShim:s,getDidCallProcessExit:c}=Ba(e,i,a),l=!!e.env?.NO_COLOR,u=mr({isTTY:!l,noColor:l}),d=fr({writeStdout:i,writeStderr:a,exit:e=>{throw new La(e)},color:u}),f=new io(t),p=ya(f,w),h=await go(f,e.cwd,_o(e,a));Object.assign(p,Sa(h,e.cwd,vo(e)));let g=pa(f,h,e.cwd,a),_=Xi(g,{cwd:e.cwd}),v=po({argv:e.argv,fs:p,exec:g}),y=ca(f),{usbBridge:b,serialBridge:x,hidBridge:S}=yo(f),C=m({fetch:w});async function w(e,t){let n=e instanceof Request?e.url:e instanceof URL?e.toString():String(e),r=await f.call(`fetch`,`request`,[n,await aa(t,e)]),i=r.body.byteLength===0?null:r.body.buffer.slice(r.body.byteOffset,r.body.byteOffset+r.body.byteLength),a=new Response(i,{status:r.status,statusText:r.statusText,headers:r.headers});return Object.defineProperty(a,"url",{value:r.url||n}),a}let T=Ga({exec:g,agent:_,skill:v,http:C,browser:y,usb:b,serial:x,hid:S,cli:d,color:u}),E=e.filename,D=Ia(E),O=await Ja(f,e.code,e.cwd,E),ee=Za({graph:O,fsBridge:p,processShim:s,childProcess:qi(g),nodeConsole:o,sliccyModules:T,shimmedPackages:Xa(f)}).require,k={exports:{},filename:e.filename},te=O.entrySource!==void 0,ne=O.entrySource??e.code,re=globalThis;re.__slicc_compileWasm=e=>f.call(`wasm`,`compile`,[e]);let ie=await ro(ne,{process:s,console:o,require:ee,module:k,exports:k.exports,fetch:w,__dirname:D,__filename:E},a,te);await xo(f,h,a),c()||await So(f),delete re.__slicc_compileWasm,f.dispose(),t.postMessage({type:`realm-done`,stdout:n.join(``),stderr:r.join(``),exitCode:ie})}async function xo(e,t,n){let r=t.getMutations();if(r.created.length||r.modified.length||r.deleted.length)try{await e.call(`vfs`,`flushWrites`,[r])}catch(e){let t=e instanceof Error?e.message:String(e);n(`[sync-fs] ERROR: flush failed — ${r.created.length+r.modified.length} write(s) + ${r.deleted.length} delete(s) were NOT persisted: ${t}\n`)}}async function So(e){let t=Date.now()+1e3,n=0;do await new Promise(e=>setTimeout(e,0)),n++;while(e.pendingCount>0&&n<50&&Date.now()<t)}const Co={postMessage:(e,t)=>t?self.postMessage(e,t):self.postMessage(e),addEventListener:(e,t)=>self.addEventListener(e,t),removeEventListener:(e,t)=>self.removeEventListener(e,t)};self.addEventListener(`message`,e=>{if(e.data?.type!==`realm-init`)return;let t=e.data;t.kind===`js`&&bo(t,Co).catch(e=>{let t={type:`realm-error`,message:e instanceof Error?e.message:String(e)};self.postMessage(t)})});
|