@reason-machines/cli-linux-arm64-musl 0.2.286 → 0.2.288
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/bin/ara +1 -1
- package/bin/vm-hands/connect-cli-603s7j9a.js +2 -0
- package/bin/vm-hands/{custom-endpoint-device-7kd3qh6r.js → custom-endpoint-device-tv4wtdb2.js} +1 -1
- package/bin/vm-hands/desktop-account-vr5beh82.js +2 -0
- package/bin/vm-hands/device-workspace-s5z0zr53.js +2 -0
- package/bin/vm-hands/{hands-worker-source-wddm7sdp.js → hands-worker-source-xvkfkf6v.js} +1 -1
- package/bin/vm-hands/{index-9aw1gjs5.js → index-bwnyk312.js} +1 -1
- package/bin/vm-hands/local-automation-4ke1jrmj.js +2 -0
- package/bin/vm-hands/local-capabilities-sc9f2pjw.js +2 -0
- package/bin/vm-hands/local-desktop-users-vztj8kn8.js +2 -0
- package/bin/vm-hands/{local-display-mac-rp51a8w7.js → local-display-mac-4mtwfgty.js} +1 -1
- package/bin/vm-hands/local-display-session-b2953j3d.js +2 -0
- package/bin/vm-hands/{network-contract-wkc0ycet.js → network-contract-y6kbgyhe.js} +1 -1
- package/bin/vm-hands/package-q8gdr1z1.js +2 -0
- package/bin/vm-hands/permissions-4rf2aknt.js +2 -0
- package/bin/vm-hands/{reason-hands-protocol-zcnd1srf.js → reason-hands-protocol-5wqth9ga.js} +1 -1
- package/bin/vm-hands/{status-9grfvv20.js → status-5qksq9mv.js} +6 -6
- package/bin/vm-hands/version-dpdqjcta.js +2 -0
- package/bin/vm-hands/{vm-hands-entry-lite-94nvv1qx.js → vm-hands-entry-lite-00sd3eb1.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-yvmzze06.js → vm-hands-entry-lite-250sqsry.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-5m5d6fne.js → vm-hands-entry-lite-3nfhybjy.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-yh7n4svm.js → vm-hands-entry-lite-5zzey257.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-ee8txzdd.js → vm-hands-entry-lite-91tcwjpv.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-ss2w3h3d.js → vm-hands-entry-lite-a3n86qqm.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-gfynf6jv.js → vm-hands-entry-lite-cfjx91rj.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-k901yfkm.js → vm-hands-entry-lite-d3fvjfh4.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-y9k070mt.js → vm-hands-entry-lite-d94sv87n.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-kbwr4e6f.js → vm-hands-entry-lite-ekzch8tn.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-76hys77m.js → vm-hands-entry-lite-ey5wf75d.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-d2wyay7h.js → vm-hands-entry-lite-fg8cwd29.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-m5pmd2cz.js → vm-hands-entry-lite-h7ndfgwc.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-8byz0e1v.js → vm-hands-entry-lite-jefk3h6n.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-h2xpqaxn.js → vm-hands-entry-lite-mk9p22xa.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-85cf0jww.js → vm-hands-entry-lite-mysjgrwy.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-mxavr4y3.js → vm-hands-entry-lite-ngvxyjhy.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-shde1mg2.js → vm-hands-entry-lite-pr65ksfz.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-whcnpjdx.js → vm-hands-entry-lite-qdwm3ya8.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-wffqkcjq.js → vm-hands-entry-lite-sn3vjjgx.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-p8yz62gj.js → vm-hands-entry-lite-t2ee2e71.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-yf8h8gmh.js → vm-hands-entry-lite-tkpfs08y.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-5vrdj7jm.js → vm-hands-entry-lite-yadv8a82.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-4fnbmmp6.js → vm-hands-entry-lite-z7twr5ec.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-hnq065fd.js → vm-hands-entry-lite-zmf3vn3w.js} +1 -1
- package/bin/vm-hands/vm-hands-entry-lite.js +1 -1
- package/bin/vm-hands/{vm-hands-executor-82wtd24g.js → vm-hands-executor-qke5rfh4.js} +1 -1
- package/bin/vm-hands/{vm-hands-op-runner-1848vv0m.js → vm-hands-op-runner-yd9x9ytb.js} +1 -1
- package/bin/vm-hands/{vm-hands-runtime-dmk9hnwr.js → vm-hands-runtime-qjpasm8p.js} +3 -3
- package/bin/vm-hands/worker-sandbox-wqxffxa1.js +2 -0
- package/package.json +1 -1
- package/bin/vm-hands/connect-cli-0g851qhv.js +0 -2
- package/bin/vm-hands/desktop-account-8z3zns7q.js +0 -2
- package/bin/vm-hands/device-workspace-pkcqavr9.js +0 -2
- package/bin/vm-hands/local-automation-70sarejz.js +0 -2
- package/bin/vm-hands/local-capabilities-0842mh3q.js +0 -2
- package/bin/vm-hands/local-desktop-users-nxyv3mk1.js +0 -2
- package/bin/vm-hands/local-display-session-1tzx2c36.js +0 -2
- package/bin/vm-hands/package-56yg8k4a.js +0 -2
- package/bin/vm-hands/permissions-1dzt3phg.js +0 -2
- package/bin/vm-hands/version-4m73yc89.js +0 -2
- package/bin/vm-hands/worker-sandbox-4c9302zr.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t as u0}from"./vm-hands-entry-lite-
|
|
2
|
+
import{t as u0}from"./vm-hands-entry-lite-250sqsry.js";import{A as Z5,B as Q5,C as j7,D as z7,E as v3,F as p5,G as G5,H as _0,I as l$,J as p$,K as E0,L as J2,M as c5,N as i0,O as H6,P as Z3,Q as o5,U as e5,ba as R7,ca as C7,da as I7,ea as P7,fa as u3,y as v6,z as g6}from"./vm-hands-entry-lite-jefk3h6n.js";import{Aa as X5,Ba as Y5,Ca as T7,Da as _7,Fa as u,Ga as e,Ha as s,Ia as c,Ja as M5,Ka as W7,La as W$,Oa as V4,Pa as H4,Qa as zJ,Ra as OJ,Sa as AJ,Ta as k0,Ua as J0,Va as g,Wa as g3,Xa as E$,Ya as K2,Za as U0,_a as L7,db as K6,fb as k8,ha as s7,ib as u2,ka as W5,kb as l5,la as L5,lb as T3,nb as b5,oa as q5,qa as C5,rb as D7,sb as N3,ta as I5,ya as S5,za as w5}from"./vm-hands-entry-lite-fg8cwd29.js";import{Ab as P5,Bb as x5,Ib as E5}from"./vm-hands-entry-lite-3nfhybjy.js";import{Nb as B5}from"./vm-hands-entry-lite-mk9p22xa.js";import{Ub as d5}from"./vm-hands-entry-lite-qvrnx0vk.js";import{Ac as G4,Ec as a5,Hc as O7,Kc as u6,Lc as d6,mc as i1,nc as Y1,oc as _1,pc as L$,qc as GJ,rc as CJ,sc as IJ,tc as D$,uc as PJ,vc as e3,wc as xJ,xc as Y4,yc as F1,zc as I8}from"./vm-hands-entry-lite-91tcwjpv.js";import{Bd as J5,Hd as $$,Rd as F2,Vc as b2,Zc as q7,_c as M7}from"./vm-hands-entry-lite-5zzey257.js";import{ae as B}from"./vm-hands-entry-lite-h7ndfgwc.js";import{ie as RJ,je as o2,me as A7,pe as n$,re as aJ,se as iJ,xe as t5}from"./vm-hands-entry-lite-t2ee2e71.js";import{$e as h1,Be as b0,Ce as k$,Ee as P0,Fe as j4,He as o0,Ie as z0,Je as w9,Ke as DJ,Le as jJ,Me as E2,Ne as q2,Oe as f3,Pe as R8,Qe as C8,Re as Y$,Se as v$,Te as Y0,Ue as T2,Ve as S7,We as w7,Xe as e1,Ye as R4,_e as Q3,af as m0,bf as y$,cf as X3,ff as m1}from"./vm-hands-entry-lite-zmf3vn3w.js";import{jf as R5}from"./vm-hands-entry-lite-mysjgrwy.js";import{hg as TJ,kg as s5,lg as h3,ng as K5}from"./vm-hands-entry-lite-00sd3eb1.js";import{Wg as Z2,Xg as u5}from"./vm-hands-entry-lite-cfjx91rj.js";import{$g as Y7,Zg as V0}from"./vm-hands-entry-lite-pr65ksfz.js";import{xh as r}from"./vm-hands-entry-lite-d3fvjfh4.js";import{Eh as F7}from"./vm-hands-entry-lite-d94sv87n.js";import{Jh as v0}from"./vm-hands-entry-lite-sn3vjjgx.js";import{spawn as EJ,spawnSync as lK}from"child_process";import{closeSync as SJ,mkdirSync as pK,openSync as wJ,readdirSync as cK,realpathSync as G1,rmSync as z$}from"fs";import{hostname as sK}from"os";import{dirname as $9,join as F0,resolve as aK}from"path";var rJ=/^(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})$/;function U9($){let J=typeof $==="string"?rJ.exec($):null;return J?{major:Number(J[1]),minor:Number(J[2])}:null}import{createHash as XZ,randomBytes as j9}from"crypto";import{createInterface as YZ}from"readline";import{randomBytes as tJ}from"crypto";import{chmodSync as M9,existsSync as T9,lstatSync as oJ,mkdirSync as eJ,readFileSync as _9,renameSync as $Z,unlinkSync as F9,writeFileSync as W9}from"fs";import{homedir as JZ}from"os";import{dirname as ZZ,join as q9}from"path";function e0($=process.env,J=JZ()){let Z=$.XDG_CONFIG_HOME?.trim()||q9(J,".config"),X=P0({env:$})==="staging"?["staging"]:[];return q9(q2(Z,...X),"credentials.json")}function L9($,J=e0()){return eJ(ZZ(J),{recursive:!0,mode:448}),W9(J,`${JSON.stringify($,null,2)}
|
|
3
3
|
`,{mode:384}),M9(J,384),J}function P$($=e0()){if(!T9($))return null;try{let J=_9($,"utf8"),Z=JSON.parse(J);if(typeof Z.apiOrigin!=="string"||typeof Z.clientId!=="string"||typeof Z.accessToken!=="string"||typeof Z.refreshToken!=="string"||typeof Z.expiresAt!=="string"||typeof Z.orgId!=="string"||!Array.isArray(Z.scopes))return null;let Q=new URL(Z.apiOrigin).origin,X=o0(Q);if(X!==Q)QZ($,J,X);return{apiOrigin:X,clientId:Z.clientId,accessToken:Z.accessToken,refreshToken:Z.refreshToken,expiresAt:Z.expiresAt,scopes:Z.scopes.filter((Y)=>typeof Y==="string"),orgId:Z.orgId}}catch{return null}}function QZ($,J,Z){let Q=`${$}.${process.pid}.${tJ(6).toString("hex")}.tmp`;try{let X=oJ($);if(!X.isFile()||X.uid!==process.geteuid?.())return;let Y=JSON.parse(J);if(W9(Q,`${JSON.stringify({...Y,apiOrigin:Z},null,2)}
|
|
4
4
|
`,{mode:384,flag:"wx"}),M9(Q,384),_9($,"utf8")!==J)throw Error("credentials_changed");$Z(Q,$)}catch{try{F9(Q)}catch{}}}function D9($=e0()){if(!T9($))return!1;return F9($),!0}class x$ extends Error{oauthCode;constructor($,J=null){super($);this.oauthCode=J;this.name="LoginError"}}function O9(){let $=j9(48).toString("base64url"),J=XZ("sha256").update($).digest("base64url");return{verifier:$,challenge:J,state:j9(32).toString("base64url")}}function GZ($,J){let Z=typeof $.error==="string"?$.error:null,Q=typeof $.error_description==="string"?$.error_description:Z?Z:J;return new x$(Q,Z)}async function BZ($,J,Z,Q){let X=await Z(`${$}/mcp/oauth/token`,{method:"POST",redirect:"error",headers:{"content-type":"application/x-www-form-urlencoded"},body:J,signal:Q}),Y=await X.json().catch(()=>({}));if(!X.ok)throw GZ(Y,`OAuth token request failed (${X.status})`);return Y}var KZ=1e4;async function VZ($,J={}){let Z=J.fetchImpl??fetch,Q=await BZ($.apiOrigin,new URLSearchParams({grant_type:"refresh_token",client_id:$.clientId,refresh_token:$.refreshToken}),Z,AbortSignal.timeout(KZ)).catch((Y)=>{if(Y instanceof Error&&Y.name==="TimeoutError")throw new x$("Reason did not answer the login refresh in time. Check the network and retry.");throw Y});if(typeof Q.access_token!=="string"||typeof Q.refresh_token!=="string"||typeof Q.expires_in!=="number")throw new x$("Reason returned an incomplete refreshed login.");let X={...$,accessToken:Q.access_token,refreshToken:Q.refresh_token,expiresAt:new Date(Date.now()+Q.expires_in*1000).toISOString(),scopes:typeof Q.scope==="string"?Q.scope.split(/\s+/).filter(Boolean):$.scopes};return L9(X,J.path??e0()),X}var M2=new Map;function z9($,J){if(!J)return $;if(J.aborted)return Promise.reject(J.reason);return new Promise((Z,Q)=>{let X=()=>Q(J.reason);J.addEventListener("abort",X,{once:!0}),$.then(Z,Q).finally(()=>J.removeEventListener("abort",X))})}async function b1($={}){let J=$.path??e0(),Z=P$(J);if(!Z)return null;let Q=$.apiOrigin??b0(process.env,"REASON_API_URL")?.trim();if(Q&&!z0(Z.apiOrigin,new URL(Q).origin))return null;let X=Date.parse(Z.expiresAt)<=Date.now()+60000;if(!$.forceRefresh&&!X)return Z;let Y=[J,Z.apiOrigin,Z.clientId,Z.refreshToken].join("\x00"),G=M2.get(Y);if(G)return z9(G,$.signal);let V;return V=VZ(Z,{fetchImpl:$.fetchImpl,path:J}).catch(async(K)=>{if(!(K instanceof x$)||K.oauthCode!=="invalid_grant"&&K.oauthCode!=="invalid_client")throw K;let N=P$(J),q=K.oauthCode==="invalid_client"?N?.clientId!==Z.clientId:N?.refreshToken!==Z.refreshToken;if(N&&q)return b1({fetchImpl:$.fetchImpl,path:J});return D9(J),null}).finally(()=>{if(M2.get(Y)===V)M2.delete(Y)}),M2.set(Y,V),z9(V,$.signal)}function A9($,J){return new Promise((Z)=>{let Q=YZ({input:$}),X=!1,Y=(V)=>{if(X)return;X=!0,J.removeEventListener("abort",G),Q.close(),$.pause(),Z(V)},G=()=>Y(null);J.addEventListener("abort",G,{once:!0}),Q.once("line",(V)=>Y(V)),Q.once("close",()=>Y(null))})}var HZ=B.object({label:B.string(),used_percent:B.number().min(0).max(100).nullable(),resets_at:B.string().nullable(),exhausted:B.boolean().nullable()}),NZ=B.object({groups:B.array(B.object({selectable:B.boolean().optional(),accounts:B.array(B.object({source_id:B.string().min(1),model_ids:B.array(B.string().min(1)).optional()}))}))});function UZ($){let J=NZ.safeParse($);if(!J.success)return;return J.data.groups.some((Z)=>Z.selectable!==!1&&Z.accounts.some((Q)=>Q.model_ids===void 0||Q.model_ids.length>0))}class G0 extends Error{status;code;suggestedModel;retryAfterMs;constructor($,J,Z,Q,X){super(Z);this.status=$;this.code=J;this.suggestedModel=Q;this.retryAfterMs=X;this.name="ApiError"}static rateLimitDelayMs($,J){if(!($ instanceof G0)||$.status!==429)return null;return Math.min(60000,Math.max(J,$.retryAfterMs??0))}}var qZ=["minimal","low","medium","high","xhigh","max"],MZ=B.object({id:B.string().min(1),kind:B.string(),name:B.string(),custom_name:B.string().nullish(),status:B.string(),online:B.boolean(),compatible:B.boolean().optional(),compatibility_reason:B.string().nullish(),folder_lane_of:B.string().nullish(),roots:B.array(B.object({id:B.string().min(1),label:B.string()}))}),TZ=B.object({devices:B.array(MZ),end_cursor:B.string().nullish(),has_next_page:B.boolean().optional()}),_Z=B.object({id:B.string().min(1),name:B.string()}),FZ=B.object({items:B.array(_Z)}),WZ=B.object({skill_id:B.string().min(1),name:B.string(),description:B.string().nullish(),activation_keywords:B.array(B.string()).default([]),is_enabled:B.boolean().default(!0)}),LZ=B.object({items:B.array(WZ).default([])}),DZ=B.enum(["linux","macos"]),R9=B.object({id:B.string().min(1),name:B.string().min(1),platform:DZ.nullable(),workers:B.object({total:B.number().int(),online:B.number().int(),busy:B.number().int(),idle:B.number().int()}),sessions:B.object({queued:B.number().int(),running:B.number().int()})}),jZ=B.object({machines:B.array(R9)}),zZ=B.object({machine:R9}),OZ=B.object({deleted:B.literal(!0),revoked_workers:B.number().int(),revoked_tokens:B.number().int()}),AZ=B.object({token:B.object({id:B.string().min(1),machine_id:B.string().min(1),token_prefix:B.string()}),secret:B.string().startsWith("rmt_")}),C9=B.looseObject({machine_id:B.string().min(1),machine_name:B.string().min(1)}),RZ=C9.extend({organization_id:B.string().min(1)}),yV=B.object({id:B.string().min(1),name:B.string().min(1),state:B.enum(["waiting","placed"]),queue_position:B.number().int().nullable()});var fV=B.union([B.object({kind:B.literal("cloud")}),B.object({kind:B.enum(["mac","headless"]),device_id:B.string().min(1),root_id:B.string().min(1)})]);function k1($,J,Z){let Q=$.safeParse(J);if(!Q.success)throw new G0(502,Z,"Reason returned an unexpected response.");return Q.data}var CZ=B.object({error:B.object({type:B.string(),message:B.string()})});function I9($,J,Z){let Q=CZ.safeParse(J),X=typeof J.error==="string"?J.error:Q.success?Q.data.error.type:`http_${$}`,Y=typeof J.detail==="string"?J.detail:typeof J.message==="string"?J.message:Q.success?Q.data.error.message:`Reason request failed (${$}${typeof J.error==="string"?` ${J.error}`:""})`,G=X==="github_connection_required"&&typeof J.connect_url==="string"&&/^https?:\/\//.test(J.connect_url)?` Connect it at ${J.connect_url}`:"",V=Z===null||Z.trim()===""?NaN:Number(Z);return new G0($,X,`${Y}${G}`,typeof J.suggested_model==="string"?J.suggested_model:void 0,Number.isFinite(V)&&V>=0?V*1000:void 0)}async function P9($){let J=await($.fetchImpl??fetch)(`${$.apiOrigin}/v3/machines/enrollment-tickets`,{method:"POST",headers:{authorization:`Bearer ${$.token}`,accept:"application/json","content-type":"application/json"},body:JSON.stringify($.body),signal:AbortSignal.timeout(30000),redirect:"error"}),Z=await J.json().catch(()=>({}));if(!J.ok)throw I9(J.status,Z,J.headers.get("retry-after"));return k1(RZ,Z,"invalid_machine_ticket")}class N1{options;credentials;constructor($,J={}){this.options=J;this.credentials=$}trackEvent($,J={}){}async request($,J={},Z=!1){let Q=this.options.fetchImpl??fetch,X=await Q(`${this.credentials.apiOrigin}/v3${$}`,{method:J.method??"GET",headers:{authorization:`Bearer ${this.credentials.accessToken}`,accept:"application/json","user-agent":"reason-cli","x-reason-agent":"Reason CLI",...J.body===void 0?{}:{"content-type":"application/json"},...J.headers},body:J.body===void 0?void 0:JSON.stringify(J.body),signal:J.signal,redirect:"error"}),Y=await X.json().catch(()=>({}));if(X.status===401&&!Z&&J.retryUnauthorized!==!1&&this.credentials.credentialKind!=="api_key"){let G=await b1({fetchImpl:Q,path:this.options.credentialsPath,forceRefresh:!0,signal:J.signal});if(G)return this.credentials=G,this.request($,J,!0)}if(!X.ok)throw I9(X.status,Y,X.headers.get("retry-after"));return Y}createHeadlessDeviceEnrollmentTicket($){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/devices/enrollment-tickets`,{method:"POST",body:$,signal:AbortSignal.timeout(30000),retryUnauthorized:!1})}async enrollHeadlessDevice($){try{return await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/devices/enrollments`,{method:"POST",body:$,signal:AbortSignal.timeout(30000),retryUnauthorized:!1})}catch(J){if(J instanceof G0&&(J.status===404||J.status===405||J.status===403&&J.code==="endpoint_not_available"))return null;throw J}}addDeviceRoot($,J){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/devices/${encodeURIComponent($)}/roots`,{method:"POST",body:J,signal:AbortSignal.timeout(30000)})}removeDeviceRoot($,J){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/devices/${encodeURIComponent($)}/roots/${encodeURIComponent(J)}`,{method:"DELETE",signal:AbortSignal.timeout(30000)})}machinePath($,J=""){let Z=`/organizations/${encodeURIComponent(this.credentials.orgId)}/machines`;return $===void 0?Z:`${Z}/${encodeURIComponent($)}${J}`}async listMachines(){return k1(jZ,await this.request(this.machinePath()),"invalid_machine_list").machines}async createMachine($){let J=await this.request(this.machinePath(),{method:"POST",body:{name:$.name,...$.platform?{platform:$.platform}:{}}});return k1(zZ,J,"invalid_machine").machine}async deleteMachine($){let J=await this.request(this.machinePath($),{method:"DELETE"});return k1(OZ,J,"invalid_machine_deletion")}async createMachineToken($){let J=await this.request(this.machinePath($,"/tokens"),{method:"POST",body:{}});return k1(AZ,J,"invalid_machine_token")}async createMachineEnrollmentTicket($,J){let Z=await this.request(this.machinePath($,"/enrollment-tickets"),{method:"POST",body:J,signal:AbortSignal.timeout(30000),retryUnauthorized:!1});return k1(C9,Z,"invalid_machine_ticket")}self($){return this.request("/self",{signal:$})}claimExistingCliPairing($){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/onboarding/import/pairing/claim-existing`,{method:"POST",body:{pairing_code:$}})}connectAnthropicProvider($,J,Z={}){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/provider-credentials/anthropic`,{method:"POST",retryUnauthorized:Z.retryUnauthorized,signal:Z.signal,body:{access_token:$.access,refresh_token:$.refresh,expires_at:new Date($.expires).toISOString(),...J?{account_key:J}:{}}})}async listRepositories(){return((await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/repositories`)).items??[]).flatMap((J)=>{let Z=typeof J.full_name==="string"?J.full_name:typeof J.repo_full_name==="string"?J.repo_full_name:null;if(!Z)return[];return[{repo_id:typeof J.repo_id==="string"?J.repo_id:void 0,full_name:Z,provider:J.provider==="gitlab"?"gitlab":"github",default_branch:typeof J.default_branch==="string"?J.default_branch:null,private:typeof J.private==="boolean"?J.private:void 0}]})}async listProjects(){let $=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/projects`),J=FZ.safeParse($);if(!J.success)throw new G0(502,"invalid_project_list","Reason returned an unexpected project list.");return J.data.items}async listSkills(){try{let $=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/skills`);return k1(LZ,$,"invalid_skill_list").items}catch($){if($ instanceof G0&&($.status===403||$.status===404))return[];throw $}}async listDevices(){let $=[],J=null;for(let Z=0;Z<50;Z+=1){let Q=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/devices${J?`?after=${encodeURIComponent(J)}`:""}`),X=TZ.safeParse(Q);if(!X.success)throw new G0(502,"invalid_device_list","Reason returned an unexpected machine list.");if($.push(...X.data.devices),J=X.data.has_next_page?X.data.end_cursor??null:null,!J)break}return $}async listModels(){try{let J=((await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/agent-auth/models`)).models??[]).filter((Q)=>Q.hidden!==!0&&Q.available!==!1).map(({reasoning_efforts:Q,hidden:X,available:Y,...G})=>({...G,...Array.isArray(Q)?{reasoning_efforts:qZ.filter((V)=>Q.includes(V))}:{}})),Z=new Set(J.map((Q)=>Q.detail));return J.length>1&&Z.size===1?J.map(({detail:Q,...X})=>X):J}catch($){if($ instanceof G0&&($.status===403||$.status===404))return[];throw $}}async getAgentVersion($){try{let J=await this.request("/deployment",{signal:$,retryUnauthorized:!1});return U9(J.reason_version)?J.reason_version:null}catch{return null}}async getUsageQuota(){try{let $=HZ.safeParse(await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/usage/quota`));if(!$.success)return null;let J;try{J=UZ(await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/agent-auth/models`))}catch{}return{...$.data,own_inference:J}}catch($){if($ instanceof G0&&($.status===403||$.status===404))return null;throw $}}async listSessions($=50,J,Z={}){let Q=new URLSearchParams({first:String(Math.min(Math.max($,1),200)),status:Z.status??"active"});if(J)Q.set("project_id",J);if(Z.origin)Q.set("origin",Z.origin);return(await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions?${Q.toString()}`)).items??[]}getSession($){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent($)}`)}async prestartSession($){let J=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/prestart`,{method:"POST",body:{client_session_id:$}});return J?.status==="starting"||J?.status==="ready"}async createSession($){let J=$.mode==="ephemeral"||$.workspaceOwnership==="externally-managed";if($.attachments?.length)await this.requireSessionAttachments();if(J||$.runtimeProfile){let X=await this.request("/deployment");if(J&&(!Array.isArray(X.session_modes)||!X.session_modes.includes($.mode??"standard")||!Array.isArray(X.workspace_ownerships)||!X.workspace_ownerships.includes($.workspaceOwnership??"managed")))throw Error("Deployment does not support the requested Session policy; refusing to create a Session.");if($.runtimeProfile&&(!Array.isArray(X.experimental_runtime_profiles)||!X.experimental_runtime_profiles.includes($.runtimeProfile)))throw Error("Deployment does not support the requested runtime profile; refusing to create a Session.")}let Z=await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions`,{method:"POST",body:{prompt:$.prompt,...$.attachments?.length?{attachments:$.attachments}:{},...$.mode?{mode:$.mode}:{},...$.workspaceOwnership?{workspace_ownership:$.workspaceOwnership}:{},...$.target?{target:$.target}:{},...$.repo?{repo:$.repo}:{},...$.provider?{provider:$.provider}:{},...$.model?{model:$.model}:{},...$.reasoningEffort?{reasoning_effort:$.reasoningEffort}:{},...$.runtimeProfile?{experimental_runtime_profile:$.runtimeProfile}:{},...$.ref?{ref:$.ref}:{},...$.completionMode?{completion_mode:$.completionMode}:{},...$.env&&Object.keys($.env).length>0?{env:$.env}:{},...$.clientSessionId?{client_session_id:$.clientSessionId}:{},idempotency_key:`cli-${crypto.randomUUID()}`}}),Q=await this.getSession(Z.session_id);if(J){let X=Q.session_policy,Y=["memoryRead","memoryWrite","skills","inheritedInstructions","integrations","secretInjection"];if(!X||X.version!==1||X.mode!==($.mode??"standard")||X.workspaceOwnership!==($.workspaceOwnership??"managed")||!X.components||Y.some((G)=>X.components[G]!==!0))throw await this.cancelSession(Z.session_id),Error("Server did not attest the requested Session policy; cancellation requested.")}if($.runtimeProfile&&Q.experimental_runtime_profile!==$.runtimeProfile)throw await this.cancelSession(Z.session_id),Error("Server did not attest the requested runtime profile; cancellation requested.");return Q}async getEvents($,J=-1,Z={}){try{return await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent($)}/events?after_seq=${J}&limit=500${Z.waitMs?`&wait_ms=${Z.waitMs}`:""}`,Z.signal?{signal:Z.signal}:{})}catch(Q){if(!(Q instanceof G0)||Q.status!==403&&Q.status!==404)throw Q;return{session:await this.getSession($),items:[],next_seq:J}}}async getMessages($,J){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent($)}/messages?first=500${J===void 0?"":`&after_seq=${J}`}`)}async getAttachments($){try{return(await this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent($)}/attachments`)).items??[]}catch(J){if(J instanceof G0&&(J.status===403||J.status===404))return[];throw J}}async requireSessionAttachments(){if((await this.request("/deployment")).session_attachments!==!0)throw Error("This server does not support Session image attachments yet. Update the server and retry; the image was not sent.")}async sendMessage($,J,Z={}){if(Z.attachments?.length)await this.requireSessionAttachments();return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent($)}/messages`,{method:"POST",body:{message:J,...Z.attachments?.length?{attachments:Z.attachments}:{},...Z.model?{model:Z.model}:{},...Z.reasoningEffort?{reasoning_effort:Z.reasoningEffort}:{},...Z.target?{target:Z.target}:{}}})}createSharedLink($,J){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent($)}/shared-links`,{method:"POST",body:{url:J.url,...J.label?{label:J.label}:{},...J.expiresInSeconds!==void 0?{expires_in_seconds:J.expiresInSeconds}:{}}})}cancelSession($,J={}){return this.request(`/organizations/${encodeURIComponent(this.credentials.orgId)}/sessions/${encodeURIComponent($)}/cancel`,{method:"POST",body:J.mode==="hard"?{mode:"hard"}:{}})}}function y1($,J){let Z=b0($,"REASON_API_URL")?.trim();if(!Z)return j4(J);let Q=new URL(Z);if(Q.protocol!=="https:"&&!(Q.protocol==="http:"&&["127.0.0.1","localhost","::1"].includes(Q.hostname)))throw Error("REASON_API_URL must use HTTPS (HTTP is allowed only for loopback development).");return Q.origin}function IZ($){return b0($,"REASON_API_URL")?.trim()?y1($,"production"):void 0}function z4($){return b0($,"REASON_API_KEY")?.trim()||void 0}async function x9($,J){let Z=$.env??process.env,Q=z4(Z);if(!Q)return($.getCredentials??b1)({apiOrigin:IZ(Z),signal:J});let X=y1(Z,$.channel??P0({env:Z})),Y=await($.fetchImpl??fetch)(X+"/v3/self",{redirect:"error",headers:{authorization:"Bearer "+Q,accept:"application/json"},signal:J}),G=await Y.json().catch(()=>({})),V=i0(G)?G:{};if(!Y.ok){let N=typeof V.detail==="string"?V.detail:typeof V.message==="string"?V.message:"API key authentication failed ("+Y.status+")";throw new G0(Y.status,typeof V.error==="string"?V.error:"api_key_auth_failed",N)}if(typeof V.org_id!=="string"||!V.org_id)throw Error("The API key in the environment did not resolve to a Workspace.");let K=Array.isArray(V.scopes)?V.scopes.filter((N)=>typeof N==="string"):[];return{credentialKind:"api_key",apiOrigin:X,accessToken:Q,orgId:V.org_id,clientId:"api-key",refreshToken:"",expiresAt:"",scopes:K}}import{createHash as PZ}from"crypto";import{unlinkSync as xZ}from"fs";import{platform as EZ}from"os";import{join as SZ}from"path";var E9=B.discriminatedUnion("store",[B.strictObject({version:B.literal(1),store:B.literal("keychain")}),B.strictObject({version:B.literal(1),store:B.literal("file"),api_key:B.string().min(1).max(4096)})]),f1=($)=>SZ($,"api-key.json");function z1($){let J=PZ("sha256").update(`reason-connect-api-key
|
|
5
5
|
${$}`).digest("hex");return new e1(T2(),EZ(),J)}function O4($,J,Z=z1($)){try{Z.deleteBinding(),Z.createBinding(new TextEncoder().encode(J)),c(f1($),{version:1,store:"keychain"});return}catch(Q){if(!(Q instanceof Y0))throw Q}c(f1($),{version:1,store:"file",api_key:J})}function l0($,J=z1($)){if(!u(f1($)))return null;let Z=E9.parse(JSON.parse(s(f1($))));if(Z.store==="file")return Z.api_key;try{let Q=J.loadBinding();return Q?new TextDecoder().decode(Q):null}catch(Q){if(!(Q instanceof Y0))throw Q;throw Error("worker_api_key_unreadable")}}function S9($,J=z1($)){if(!u(f1($)))return;if(E9.parse(JSON.parse(s(f1($)))).store==="keychain")try{J.deleteBinding()}catch(Z){if(!(Z instanceof Y0))throw Z}xZ(f1($))}async function A4($,J){let Z;try{Z=await x9({env:{REASON_API_KEY:J,REASON_API_URL:$.apiOrigin},fetchImpl:k0($.proxy)})}catch(Q){if(Q instanceof G0&&(Q.status===401||Q.status===403))throw Error("worker_api_key_rejected");throw Q}if(!Z)throw Error("worker_api_key_rejected");if(!Z.scopes.includes("devices:write"))throw Error("worker_api_key_devices_write_required");return Z}import{readdirSync as rZ,renameSync as tZ,rmSync as v1}from"fs";import{join as M0}from"path";import{createHash as wZ}from"crypto";import{realpathSync as bZ,statSync as kZ,unlinkSync as _2}from"fs";import{platform as yZ}from"os";import{join as y0}from"path";function d($){return{state:y0(g($),"device.json"),control:y0(g($),"control.json"),lock:y0(g($),"lifecycle.lock"),socket:y0(g($),"control.sock"),daemon:y0(g($),"daemon.json"),releaseCheck:y0(g($),"release-check.json"),updateDeferral:y0(g($),"update-deferral.json"),firstHeartbeat:y0(g($),"first-heartbeat.json")}}var fZ=B.object({version:B.literal(1),device_id:B.string().min(1).max(160),offer:B.unknown().optional(),enrollment_ms:B.number().int().nonnegative().max($$).optional()});function b9($,J,Z){e(g($),!0),c(d($).firstHeartbeat,{version:1,device_id:J,...Z.offer?{offer:Z.offer}:{},...Z.enrollmentMs!==void 0?{enrollment_ms:Z.enrollmentMs}:{}})}function C4($,J){let Z=d($).firstHeartbeat;try{if(!u(Z))return null;let Q=fZ.safeParse(JSON.parse(s(Z)));if(_2(Z),!Q.success||Q.data.device_id!==J)return null;let X=F2(Q.data.offer);return{...X?{offer:X}:{},...Q.data.enrollment_ms!==void 0?{enrollmentMs:Q.data.enrollment_ms}:{}}}catch{return null}}function T0($,J=!1){e(g($),J);let Z=["local-device.key","local-device.binding","device.json"].filter((Q)=>{let X=y0(g($),Q);if(!u(X))return!1;return s(X),!0});return $.lifetime==="persistent"&&Z.join()==="device.json"?I4($):new R4(g($))}function W2($,J){T0($,!0),vZ($);let Z=J??I4($),Q=new R4(g($));try{Z.deleteBinding(),Z.deleteKey(),Z.createFreshPublicKey()}catch(X){if(X instanceof Y0)return Q;throw X}return Q.deleteBinding(),Q.deleteKey(),Z}function I4($){return new e1(T2(),yZ(),hZ($))}function hZ($){let J=P4($);return wZ("sha256").update(`reason-worker
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var r={name:"github-native-engineer-device-worker-production",version:"0.2.
|
|
3
|
-
export{r as
|
|
2
|
+
var r={name:"github-native-engineer-device-worker-production",version:"0.2.288",private:!0,type:"module",engines:{node:">=22",bun:">=1.3.0"},workspaces:["../../packages/runtime-distribution"],dependencies:{"@anthropic-ai/sandbox-runtime":"^0.0.73","@earendil-works/pi-tui":"1.0.0","@modelcontextprotocol/sdk":"^1.29.0","@reason/runtime-distribution":"workspace:*","playwright-core":"1.60.0",zod:"^4.4.3"},overrides:{"@hono/node-server":"1.19.15","@earendil-works/pi-agent-core":"1.0.0","@earendil-works/pi-ai":"1.0.0","@earendil-works/pi-coding-agent":"1.0.0","@earendil-works/chord":"1.0.0","@earendil-works/pi-codemode":"1.0.0","@earendil-works/pi-mcp":"1.0.0","@earendil-works/pi-telemetry":"1.0.0","@earendil-works/pi-tui":"1.0.0","brace-expansion":"2.1.7",axios:"1.20.0","basic-ftp":"6.2.1","@grpc/grpc-js":"1.14.5",browserslist:"4.28.8","engine.io":"6.6.7","fast-uri":"3.1.8",hono:"^4.13.7","ip-address":"10.7.1",nanoid:"3.3.18",dompurify:"3.4.13",postcss:"8.5.23",qs:"6.16.0","shell-quote":"1.11.0","socket.io-parser":"4.2.7",tmp:"0.2.7",toml:"4.2.0",undici:"8.10.2",ws:"^8.21.0","js-yaml":"4.3.2","@modelcontextprotocol/sdk":"1.31.0","proxy-addr":"2.0.8","source-map-js":"1.2.2"}};
|
|
3
|
+
export{r as Bh};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ab as U9,Bb as u0,Ib as z0,wb as UQ,xb as Z8,yb as u9,zb as q0}from"./vm-hands-entry-lite-
|
|
2
|
+
import{Ab as U9,Bb as u0,Ib as z0,wb as UQ,xb as Z8,yb as u9,zb as q0}from"./vm-hands-entry-lite-3nfhybjy.js";import{Qb as PQ,Rb as IQ,Sb as rZ,Tb as tZ,Ub as G8}from"./vm-hands-entry-lite-qvrnx0vk.js";import{Zb as E0}from"./vm-hands-entry-lite-n07kxrd1.js";import{Bd as N0,Oc as a$,Rc as o$,ud as R9,vd as n0,wd as V8,xd as b0}from"./vm-hands-entry-lite-5zzey257.js";import{ae as I}from"./vm-hands-entry-lite-h7ndfgwc.js";import{Ke as kQ,Le as f8,Ze as wQ,df as s9,ef as w8}from"./vm-hands-entry-lite-zmf3vn3w.js";import{Af as x8,Df as c9,Lf as A8,Mf as I0,Nf as j0,Of as d9,Vf as R8,Wf as $Q,Xf as l$,gf as UZ,jf as F9,sf as r$,tf as t$,vf as e$,xf as v9,yf as p$,zf as u$}from"./vm-hands-entry-lite-mysjgrwy.js";import{Xg as aZ}from"./vm-hands-entry-lite-cfjx91rj.js";import{Zg as W8,_g as p9,bh as iZ}from"./vm-hands-entry-lite-pr65ksfz.js";import{ch as F8,dh as l0,eh as U8,fh as s0,gh as K9,hh as Q8,ih as r8,jh as p0,kh as v0,lh as d$,wh as F$}from"./vm-hands-entry-lite-ngvxyjhy.js";import{Bh as JZ}from"./vm-hands-entry-lite-ey5wf75d.js";import{Hh as oZ}from"./vm-hands-entry-lite-d94sv87n.js";import{Jh as C}from"./vm-hands-entry-lite-sn3vjjgx.js";import{Kh as L1,Nh as ZZ}from"./vm-hands-entry-lite-a3n86qqm.js";var v={chunk:32768,upload:1048576,total:536870912,streams:16,queued:512,buffered:262144,relayBuffered:8388608,requestMs:30000,lifetimeMs:600000,authorizationMs:2000,window:8};function g9($){return $!==null&&typeof $==="object"&&!Array.isArray($)}function _0($,Q,Z=Number.MAX_SAFE_INTEGER){return typeof $==="number"&&Number.isSafeInteger($)&&$>=Q&&$<=Z}function I$($){return typeof $==="string"&&/^[a-zA-Z0-9_-]{1,160}$/.test($)}function A0($){if(!g9($)||Object.keys($).length!==12||![$.organizationId,$.userId,$.runId,$.deviceId,$.rootId,$.jobId,$.fenceId].every(I$)||!_0($.attachmentRevision,0)||!_0($.grantRevision,1)||!_0($.generation,1)||!_0($.port,1024,65535)||!_0($.expiresAtMs,1))throw Error("preview_binding_invalid");return Object.freeze({...$})}function y0($,Q){return Object.keys($).every((Z)=>$[Z]===Q[Z])}function M9($){if($.length>4096||!$.startsWith("/")||$.startsWith("//")||/[\\\x00-\x20\x7f#]/.test($))throw Error("preview_path_invalid");let Q=decodeURIComponent($);if(Q.startsWith("//")||/[\\\x00-\x1f\x7f]/.test(Q))throw Error("preview_path_invalid");return $}function P$($){return Array.isArray($)&&$.length<=64&&$.every((Q)=>Array.isArray(Q)&&Q.length===2&&typeof Q[0]==="string"&&/^[a-zA-Z0-9-]{1,80}$/.test(Q[0])&&typeof Q[1]==="string"&&Q[1].length<=4096&&!/[\x00-\x1f\x7f]/.test(Q[1]))}function N9($,Q=v.chunk){if($.length>Math.ceil(Q/3)*4||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test($))throw Error("preview_data_invalid");let Z=Buffer.from($,"base64");if(Z.length>Q)throw Error("preview_data_too_large");return Z}function R$($){if(Array.isArray($))return Buffer.concat($);if(typeof $==="string")return Buffer.from($,"utf8");if($ instanceof ArrayBuffer)return Buffer.from($);return $}function E$($){if(Buffer.byteLength($)>v.upload*1.4+300000)throw Error("preview_frame_too_large");let Q=JSON.parse($);if(!g9(Q))throw Error("preview_frame_invalid");if(Q.type==="hello")return{type:"hello",binding:A0(Q.binding),..._0(Q.messages,v.chunk,v.upload)?{messages:Q.messages}:{},..._0(Q.window,1,v.window)?{window:Q.window}:{}};if(Q.type==="refused"&&typeof Q.reason==="string"&&/^[a-z_]{1,32}$/.test(Q.reason))return{type:"refused",binding:A0(Q.binding),reason:Q.reason};if(!I$(Q.id))throw Error("preview_frame_invalid");if(Q.type==="end"||Q.type==="cancel"||Q.type==="credit")return{type:Q.type,id:Q.id};if(Q.type==="ws"&&typeof Q.protocol==="string"&&/^[a-zA-Z0-9._-]{0,100}$/.test(Q.protocol))return{type:"ws",id:Q.id,protocol:Q.protocol};if(Q.type==="data"&&typeof Q.data==="string"&&typeof Q.binary==="boolean")return N9(Q.data,v.upload),{type:"data",id:Q.id,data:Q.data,binary:Q.binary};if(Q.type==="head"&&_0(Q.status,200,599)&&P$(Q.headers))return{type:"head",id:Q.id,status:Q.status,headers:Q.headers};if(Q.type==="request"&&typeof Q.method==="string"&&/^(GET|HEAD|POST|PUT|PATCH|DELETE|OPTIONS)$/.test(Q.method)&&typeof Q.path==="string"&&P$(Q.headers)&&typeof Q.body==="string"&&typeof Q.upgrade==="boolean")return N9(Q.body,v.upload),{type:"request",id:Q.id,method:Q.method,path:M9(Q.path),headers:Q.headers,body:Q.body,upgrade:Q.upgrade};throw Error("preview_frame_invalid")}function T8($){let Q=[...$],Z=new Set(Q.filter(([J])=>J.toLowerCase()==="connection").flatMap(([,J])=>J.toLowerCase().split(",").map((G)=>G.trim()))),X=new Set(["authorization","proxy-authorization","cookie","set-cookie","host","origin","referer","connection","upgrade","keep-alive","transfer-encoding","te","trailer","content-length","forwarded","alt-svc","service-worker-allowed","clear-site-data","refresh"]);return Q.filter(([J])=>!X.has(J.toLowerCase())&&!Z.has(J.toLowerCase())&&!/^(x-forwarded-|x-ara-|sec-websocket-|access-control-)/i.test(J))}async function O8($){let Q;try{return await Promise.race([Promise.resolve().then($).then((Z)=>Z===!0||(Z===!1?!1:void 0),()=>{return}),new Promise((Z)=>{Q=setTimeout(()=>Z(void 0),v.authorizationMs)})])}finally{clearTimeout(Q)}}async function j9($){return await O8($)===!0}function y9($,Q){let Z=new URL($);if(Z.username||Z.password||Z.search||Z.hash||!(Z.protocol==="wss:"||Z.protocol==="ws:"&&["127.0.0.1","[::1]"].includes(Z.hostname))||!new RegExp(`^/${Q}/[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]{32,}$`).test(Z.pathname))throw Error("preview_relay_invalid");return Z.href}function S$($){if(!g9($)||Object.keys($).length!==2||typeof $.deviceRelayUrl!=="string")throw Error("preview_open_invalid");return{binding:A0($.binding),deviceRelayUrl:y9($.deviceRelayUrl,"device")}}function w$($){if(!g9($)||Object.keys($).length!==1||!("binding"in $))throw Error("preview_close_invalid");return{binding:A0($.binding)}}import{request as B4}from"http";import{WebSocket as C9}from"ws";import{randomBytes as F4,timingSafeEqual as U4}from"crypto";import{createServer as W4}from"net";var b$="x-preview-connection";async function k$($,Q){if(Q.aborted)throw Error("preview_closed");let Z=F4(32).toString("base64url"),X=new Set,J=!1,G=W4((Y)=>{if(J||Q.aborted||X.size>=v.streams*2)return Y.destroy();X.add(Y);let V=new AbortController;Y.once("close",()=>{X.delete(Y),V.abort()}),Y.on("error",()=>Y.destroy()),Y.setTimeout(2000,()=>Y.destroy());let U=Buffer.alloc(0),F=(L)=>{U=Buffer.concat([U,L]);let B=U.indexOf(`\r
|
|
3
3
|
\r
|
|
4
4
|
`);if(B<0){if(U.length>16384)Y.destroy();return}if(Y.pause(),Y.off("data",F),B>16384||U.length>v.upload+16384)return Y.destroy();K(U,B).catch(()=>Y.destroy())};Y.on("data",F);async function K(L,B){let W=L.subarray(0,B).toString("latin1").split(`\r
|
|
5
5
|
`),M=/^(GET|HEAD|POST|PUT|PATCH|DELETE|OPTIONS) (\S+) HTTP\/1\.1$/.exec(W.shift()??"");if(!M)throw Error("preview_request_invalid");M9(M[2]);let _=!1,q=0,D=[];for(let T of W){let k=/^([a-zA-Z0-9-]+):[ \t]*([^\x00-\x08\x0a-\x1f\x7f]*)$/.exec(T);if(!k)throw Error("preview_header_invalid");if(k[1].toLowerCase()===b$){q++;let g=Buffer.from(k[2].trim());_=g.length===Z.length&&U4(g,Buffer.from(Z))}else if(k[1].toLowerCase()!=="host")D.push(T)}if(!_||q!==1||J||V.signal.aborted)throw Error("preview_connection_denied");let x=await $.connect(V.signal);if(J||V.signal.aborted)throw x.destroy(),Error("preview_closed");X.add(x),x.on("error",()=>Y.destroy()),x.once("close",()=>{X.delete(x),Y.destroy()}),Y.once("close",()=>x.destroy()),Y.setTimeout(0);let b=[`${M[1]} ${M[2]} HTTP/1.1`,`Host: 127.0.0.1:${x.remotePort}`,...D,"",""].join(`\r
|
|
@@ -303,7 +303,7 @@ async (input) => {
|
|
|
303
303
|
if (!bridge || typeof bridge.evaluate !== "function") throw new Error("Reason Hands browser bridge is not installed");
|
|
304
304
|
return await bridge.evaluate(typeof input === "string" ? input : input && input.code);
|
|
305
305
|
}
|
|
306
|
-
`.trim();import{Buffer as Q9}from"buffer";import{randomUUID as a3}from"crypto";class lQ extends Error{code;constructor($){super($==="hands_repl_private_profile_attribute_denied"?"Private browser attribute read denied.":$);this.code=$;this.name="HandsReplBrowserDispatcherError"}}var sQ=new Set(["__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","__proto__","constructor","prototype"]),dQ=/^hands_[A-Za-z0-9_-]{8,128}$/,o3=2048,nQ=32,iQ=1e4,r3=new Set(["href","src","alt","title","role","aria-label","aria-expanded","aria-checked","aria-selected","aria-disabled","placeholder","type","name","data-testid"]);function t3($){let Q=$.split("+"),Z=(Q.pop()??"").replace(/^Key/,"").toLowerCase();if(Z==="f12")return!0;if(Q.some((X)=>["Control","ControlOrMeta","Meta"].includes(X))&&["l","n","t","j","i","p","s","w","u","o","r","tab","pageup","pagedown"].includes(Z))return!0;if(Q.some((X)=>["Control","ControlOrMeta","Meta"].includes(X))&&Q.includes("Shift")&&Z==="c")return!0;return Q.includes("Alt")&&["d","arrowleft","arrowright","home"].includes(Z)}var e3=($)=>{let Q=$.closest("a[href],area[href]");return{password:$.tagName==="INPUT"&&$.type==="password",executableLink:Boolean(Q&&!/^(https?:|about:blank)/i.test(Q.href))}},aQ={browser:{close:{returns:"void"},contexts:{returns:"context[]"},isConnected:{returns:"json"},version:{returns:"json"}},context:{addCookies:{returns:"void"},addInitScript:{returns:"void"},browser:{returns:"browser"},clearCookies:{returns:"void"},clearPermissions:{returns:"void"},close:{returns:"void"},cookies:{returns:"json"},grantPermissions:{returns:"void"},newPage:{returns:"page"},pages:{returns:"page[]"},setDefaultNavigationTimeout:{returns:"void"},setDefaultTimeout:{returns:"void"},setExtraHTTPHeaders:{returns:"void"},setGeolocation:{returns:"void"},setHTTPCredentials:{returns:"void"},setOffline:{returns:"void"},setViewportSize:{returns:"void"},storageState:{returns:"json"},viewportSize:{returns:"json",special:"contextViewportSize"}},page:{addInitScript:{returns:"void"},addScriptTag:{returns:"void"},addStyleTag:{returns:"void"},bringToFront:{returns:"void"},close:{returns:"void"},content:{returns:"json"},context:{returns:"context"},emulateMedia:{returns:"void"},evaluate:{returns:"json",requiresStringSource:!0},frame:{returns:"frame"},frameLocator:{returns:"frameLocator"},frames:{returns:"frame[]"},getByAltText:{returns:"locator"},getByLabel:{returns:"locator"},getByPlaceholder:{returns:"locator"},getByRole:{returns:"locator"},getByTestId:{returns:"locator"},getByText:{returns:"locator"},getByTitle:{returns:"locator"},goBack:{returns:"void"},goForward:{returns:"void"},goto:{returns:"void"},isClosed:{returns:"json"},locator:{returns:"locator"},mainFrame:{returns:"frame"},opener:{returns:"page"},pdf:{returns:"bytes"},reload:{returns:"void"},screenshot:{returns:"bytes"},selectOption:{returns:"json"},setContent:{returns:"void"},setDefaultNavigationTimeout:{returns:"void"},setDefaultTimeout:{returns:"void"},setExtraHTTPHeaders:{returns:"void"},setInputFiles:{returns:"void"},setViewportSize:{returns:"void"},title:{returns:"json"},url:{returns:"json"},viewportSize:{returns:"json"},waitForFunction:{returns:"void",requiresStringSource:!0},waitForLoadState:{returns:"void"},waitForNavigation:{returns:"void"},waitForTimeout:{returns:"void"},waitForURL:{returns:"void"}},locator:{all:{returns:"locator[]"},allInnerTexts:{returns:"json"},allTextContents:{returns:"json"},and:{returns:"locator"},ariaSnapshot:{returns:"json"},blur:{returns:"void"},boundingBox:{returns:"json"},check:{returns:"void"},clear:{returns:"void"},click:{returns:"void"},contentFrame:{returns:"frameLocator"},count:{returns:"json"},dblclick:{returns:"void"},dragTo:{returns:"void"},evaluate:{returns:"json",requiresStringSource:!0},evaluateAll:{returns:"json",requiresStringSource:!0},fill:{returns:"void"},filter:{returns:"locator"},first:{returns:"locator",special:"property"},focus:{returns:"void"},getAttribute:{returns:"json"},getByAltText:{returns:"locator"},getByLabel:{returns:"locator"},getByPlaceholder:{returns:"locator"},getByRole:{returns:"locator"},getByTestId:{returns:"locator"},getByText:{returns:"locator"},getByTitle:{returns:"locator"},hover:{returns:"void"},innerHTML:{returns:"json"},innerText:{returns:"json"},inputValue:{returns:"json"},isChecked:{returns:"json"},isEditable:{returns:"json"},isEnabled:{returns:"json"},isHidden:{returns:"json"},isVisible:{returns:"json"},last:{returns:"locator",special:"property"},locator:{returns:"locator"},nth:{returns:"locator"},or:{returns:"locator"},page:{returns:"page"},press:{returns:"void"},pressSequentially:{returns:"void"},scrollIntoViewIfNeeded:{returns:"void"},screenshot:{returns:"bytes"},selectOption:{returns:"json"},setInputFiles:{returns:"void"},tap:{returns:"void"},textContent:{returns:"json"},type:{returns:"void"},uncheck:{returns:"void"},waitFor:{returns:"void"}},frame:{addScriptTag:{returns:"void"},addStyleTag:{returns:"void"},childFrames:{returns:"frame[]"},content:{returns:"json"},evaluate:{returns:"json",requiresStringSource:!0},frameLocator:{returns:"frameLocator"},getByAltText:{returns:"locator"},getByLabel:{returns:"locator"},getByPlaceholder:{returns:"locator"},getByRole:{returns:"locator"},getByTestId:{returns:"locator"},getByText:{returns:"locator"},getByTitle:{returns:"locator"},goto:{returns:"void"},isDetached:{returns:"json"},locator:{returns:"locator"},name:{returns:"json"},page:{returns:"page"},parentFrame:{returns:"frame"},setContent:{returns:"void"},title:{returns:"json"},url:{returns:"json"},waitForFunction:{returns:"void",requiresStringSource:!0},waitForLoadState:{returns:"void"},waitForNavigation:{returns:"void"},waitForTimeout:{returns:"void"},waitForURL:{returns:"void"}},frameLocator:{getByAltText:{returns:"locator"},getByLabel:{returns:"locator"},getByPlaceholder:{returns:"locator"},getByRole:{returns:"locator"},getByTestId:{returns:"locator"},getByText:{returns:"locator"},getByTitle:{returns:"locator"},locator:{returns:"locator"},owner:{returns:"locator"}}};function R($){throw new lQ($)}function G0($){if(!$||typeof $!=="object"||Array.isArray($))return!1;let Q=Object.getPrototypeOf($);return Q===Object.prototype||Q===null}function Z9($,Q=0,Z={nodes:0}){if(Q>nQ||++Z.nodes>iQ)R("hands_repl_json_too_complex");if($===null||typeof $==="boolean"||typeof $==="string")return;if(typeof $==="number"){if(!Number.isFinite($))R("hands_repl_invalid_json");return}if(Array.isArray($)){for(let X of $)Z9(X,Q+1,Z);return}if(!G0($))R("hands_repl_invalid_json");for(let[X,J]of Object.entries($)){if(sQ.has(X))R("hands_repl_invalid_json");Z9(J,Q+1,Z)}}function m8($){return typeof $==="string"&&Object.hasOwn(aQ,$)}function $1($){if(!$.endsWith("[]"))return null;let Q=$.slice(0,-2);return m8(Q)?Q:null}function pQ($){return G0($)&&Object.keys($).length===2&&$.$handsRepl==="bytes"&&typeof $.base64==="string"}function Q1($){return G0($)&&Object.keys($).length===1&&$.$handsRepl==="undefined"}function uQ($){return G0($)&&Object.keys($).length===2&&$.$handsRepl==="routeFulfill"&&"options"in $}function S0($){return!!$&&typeof $==="object"}function a9(){return Object.freeze({$handsRepl:"undefined"})}function Z1($){if(!Q9.isBuffer($)&&!($ instanceof Uint8Array))R("hands_repl_expected_bytes");return Object.freeze({$handsRepl:"bytes",base64:Q9.from($).toString("base64")})}function oQ($){if(!S0($.browser)||!S0($.context)||!S0($.page))R("hands_repl_invalid_roots");if(typeof $.a11y!=="function"||typeof $.view!=="function")R("hands_repl_invalid_callbacks");let Q=$.maxHandles??o3;if(!Number.isInteger(Q)||Q<3||Q>1e5)R("hands_repl_invalid_handle_limit");let Z=new Map,X=new WeakMap,J=$.createOpaqueId??a3,G=(K,L)=>{if(!S0(L))R("hands_repl_expected_target");let B=X.get(L)?.get(K);if(B)return B;if(Z.size>=Q)R("hands_repl_handle_limit");let W="";for(let q=0;q<16;q+=1){let D=`hands_${J()}`;if(dQ.test(D)&&!Z.has(D)){W=D;break}}if(!W)R("hands_repl_invalid_opaque_id");let M=Object.freeze({$handsRepl:"handle",id:W,kind:K});Z.set(W,{kind:K,target:L});let _=X.get(L);if(!_)_=new Map,X.set(L,_);return _.set(K,M),M},z=Object.freeze({browser:G("browser",$.browser),context:G("context",$.context),page:G("page",$.page)}),H=(K)=>{if(!G0(K)||Object.keys(K).length!==3||K.$handsRepl!=="handle"||typeof K.id!=="string"||!dQ.test(K.id)||!m8(K.kind))R("hands_repl_invalid_handle");let L=Z.get(K.id);if(!L||L.kind!==K.kind)R("hands_repl_unknown_handle");return L},Y=(K,L=0,B=new Set)=>{if(L>nQ)R("hands_repl_json_too_complex");if(K===void 0)return a9();if(K===null||typeof K==="boolean"||typeof K==="string")return K;if(typeof K==="number"){if(!Number.isFinite(K))R("hands_repl_non_json_result");return K}if(Array.isArray(K)){if(B.has(K))R("hands_repl_cyclic_result");B.add(K);try{return K.map((W)=>Y(W,L+1,B))}finally{B.delete(K)}}if(!G0(K))R("hands_repl_non_json_result");if(B.has(K))R("hands_repl_cyclic_result");B.add(K);try{let W=Object.create(null);for(let M of Object.keys(K)){let _=Object.getOwnPropertyDescriptor(K,M);if(!_||!("value"in _))continue;W[M]=Y(_.value,L+1,B)}return W}finally{B.delete(K)}},V=(K,L)=>{if(L==="void")return a9();if(L==="json")return Y(K);if(L==="bytes")return Z1(K);let B=$1(L);if(B){if(!Array.isArray(K))R("hands_repl_expected_target_list");if(B==="context"&&K.some((W)=>W!==$.context))R("hands_repl_foreign_context");return K.map((W)=>G(B,W))}if(K===null||K===void 0)return a9();if(!m8(L))R("hands_repl_invalid_return_kind");if(L==="context"&&K!==$.context)R("hands_repl_foreign_context");return G(L,K)},U=(K)=>{if(G0(K)&&K.$handsRepl==="handle")return H(K).target;if(pQ(K))return Q9.from(K.base64,"base64");if(Q1(K))return;if(uQ(K))R("hands_repl_route_fulfill_only");if(Array.isArray(K))return K.map(U);if(!G0(K))return K;let L=Object.create(null);for(let[B,W]of Object.entries(K))L[B]=U(W);return L};return Object.freeze({roots:z,dispatch:async(K)=>{if(!G0(K)||typeof K.type!=="string")R("hands_repl_invalid_request");if(K.type==="a11y"){let T=K.target===void 0?Z.get(z.page.id):H(K.target);if(!T||T.kind!=="page"&&T.kind!=="locator")R("hands_repl_invalid_a11y_target");return Y(await $.a11y(T.target))}if(K.type==="view"){if(Z9(K.source),K.options!==void 0)Z9(K.options);let T=pQ(K.source)?Q9.from(K.source.base64,"base64"):K.source;if($.privateProfile&&!Q9.isBuffer(T))R("hands_repl_profile_requires_image_bytes");return Y(await $.view(T,K.options))}if(K.type!=="call")R("hands_repl_invalid_request");if(typeof K.method!=="string"||K.method.length===0||K.method.length>128)R("hands_repl_invalid_method");if(sQ.has(K.method))R("hands_repl_forbidden_method");let L=H(K.target),B=K.args??[];if(!Array.isArray(B))R("hands_repl_invalid_arguments");if(Z9(B),L.kind==="page"&&K.method==="captureScreenshot"){if(B.length!==0)R("hands_repl_invalid_arguments");if(!$.screenshotExport)R("hands_repl_screenshot_export_unavailable");return Y(await $.screenshotExport(L.target))}if(L.kind==="context"&&["startRecording","stopRecording"].includes(K.method)){if(!$.recording||L.target!==$.context)R("hands_repl_recording_unavailable");if(B.length>(K.method==="startRecording"?1:0))R("hands_repl_invalid_arguments");return Y(K.method==="startRecording"?await $.recording.start(B[0]):await $.recording.stop())}if($.privateProfile){let T=K.method;if(["evaluate","evaluateAll","waitForFunction","addInitScript","addScriptTag","addStyleTag","setContent","setInputFiles","route","content","cookies","storageState","addCookies","clearCookies","setExtraHTTPHeaders","setHTTPCredentials","grantPermissions","clearPermissions","innerHTML","textContent","allTextContents"].includes(T)||L.kind==="browser"&&T==="close"||L.kind==="context"&&T==="close")R("hands_repl_private_profile_method_denied");if(L.kind==="browser"&&T==="contexts")return V([$.context],"context[]");if((T==="screenshot"||T==="pdf")&&G0(B[0])&&(("path"in B[0])||("style"in B[0])))R("hands_repl_private_profile_path_denied");if(T==="goto"){if(typeof B[0]!=="string")R("hands_repl_private_profile_url_denied");try{let k=new URL(B[0]);if(!["http:","https:"].includes(k.protocol)&&B[0]!=="about:blank")R("hands_repl_private_profile_url_denied")}catch{R("hands_repl_private_profile_url_denied")}}if(T==="getAttribute"&&(typeof B[0]!=="string"||!r3.has(B[0].toLowerCase())))R("hands_repl_private_profile_attribute_denied");if(L.kind==="locator"&&["innerText","allInnerTexts","getAttribute"].includes(T)){let k=[L.target];if(T==="allInnerTexts"){let g=Reflect.get(L.target,"all");if(typeof g!=="function")R("hands_repl_private_profile_probe_unavailable");let O=await Reflect.apply(g,L.target,[]);if(!Array.isArray(O)||O.length>iQ||!O.every(S0))R("hands_repl_private_profile_probe_unavailable");k=O}for(let g of k){let O=Reflect.get(g,"isVisible");if(typeof O!=="function"||!await Reflect.apply(O,g,[]))R("hands_repl_private_profile_hidden_value_denied")}}if(T==="press"&&typeof B[0]==="string"&&t3(B[0]))R("hands_repl_private_profile_browser_shortcut_denied");if(L.kind==="locator"&&["inputValue","click","dblclick","tap","press"].includes(T)){let k=Reflect.get(L.target,"evaluate");if(typeof k!=="function")R("hands_repl_private_profile_probe_unavailable");let g=await Reflect.apply(k,L.target,[e3]);if(!G0(g)||typeof g.password!=="boolean"||typeof g.executableLink!=="boolean")R("hands_repl_private_profile_probe_unavailable");if(T==="inputValue"&&g.password)R("hands_repl_private_profile_password_denied");if(T!=="inputValue"&&g.executableLink)R("hands_repl_private_profile_url_denied");if(T==="inputValue"){let O=Reflect.get(L.target,"isVisible");if(typeof O!=="function"||!await Reflect.apply(O,L.target,[]))R("hands_repl_private_profile_hidden_value_denied")}}}let W=aQ[L.kind][K.method];if(!W)R("hands_repl_method_not_allowed");if(W.requiresStringSource&&typeof B[0]!=="string")R("hands_repl_string_source_required");if(L.kind==="browser"&&K.method==="contexts")return[z.context];if(["addInitScript","addScriptTag","addStyleTag","screenshot","pdf","storageState"].includes(K.method)&&B.some((T)=>G0(T)&&("path"in T)))R("hands_repl_file_path_not_allowed");if(K.method==="goto"&&typeof B[0]==="string"){let T;try{T=new URL(B[0]).protocol}catch{R("hands_repl_invalid_url")}if(!["http:","https:","data:","about:","blob:"].includes(T))R("hands_repl_file_path_not_allowed")}if(W.special==="contextViewportSize"){let T=Reflect.get(L.target,"pages");if(typeof T!=="function")R("hands_repl_method_unavailable");let k=await Reflect.apply(T,L.target,[]),g=Array.isArray(k)?k[0]:void 0,O=S0(g)?Reflect.get(g,"viewportSize"):void 0;if(typeof O!=="function")return a9();return V(await Reflect.apply(O,g,[]),W.returns)}if(W.special==="property"){let T=Reflect.get(L.target,K.method);return V(typeof T==="function"?Reflect.apply(T,L.target,[]):T,W.returns)}let M=Reflect.get(L.target,K.method);if(typeof M!=="function")R("hands_repl_method_unavailable");if(W.special==="route"){let T=B[1];if(!uQ(T))R("hands_repl_invalid_route_handler");Z9(T.options);let k=U(T.options),g=async(j)=>{if(!S0(j))R("hands_repl_invalid_route");let A=Reflect.get(j,"fulfill");if(typeof A!=="function")R("hands_repl_invalid_route");await Reflect.apply(A,j,[k])},O=[U(B[0]??null),g],N=await Reflect.apply(M,L.target,O);return V(N,W.returns)}let _=B.map(U);if(K.method==="setInputFiles"){let T=L.kind==="locator"?0:1,k=async(O)=>{if(typeof O!=="string"){if(!G0(O)||typeof O.name!=="string"||typeof O.mimeType!=="string"||!Q9.isBuffer(O.buffer))R("hands_repl_invalid_file_input");return O}if(!$.readWorkspaceFile)R("hands_repl_workspace_required");return $.readWorkspaceFile(O)},g=_[T];_[T]=Array.isArray(g)?await Promise.all(g.map(k)):await k(g)}if(K.method==="goto")await $.beforeNavigation?.();let q=$.actionRecorder?.(),D=await Reflect.apply(M,L.target,_),b={click:"Click browser element",tap:"Click browser element",dblclick:"Double click browser element",fill:"Type text",type:"Type text",pressSequentially:"Type text",clear:"Clear browser field",press:"Press key",scrollIntoViewIfNeeded:"Scroll browser element into view",dragTo:"Drag on computer",selectOption:"Select browser option",check:"Check browser control",uncheck:"Uncheck browser control",hover:"Hover browser element",focus:"Focus browser element",goto:"Open browser page",reload:"Reload browser page",goBack:"Go back in browser",goForward:"Go forward in browser",screenshot:"Take browser screenshot"}[K.method];if(b){let T=Reflect.get(L.target,"page"),k=L.kind==="page"?L.target:typeof T==="function"?Reflect.apply(T,L.target,[]):void 0;q?.(b,S0(k)?k:void 0)}return V(D,W.returns)}})}import{isIP as QZ}from"net";import{Resolver as X1}from"dns/promises";import{isIP as r9}from"net";var J1=[["0.0.0.0",8],["10.0.0.0",8],["100.64.0.0",10],["127.0.0.0",8],["169.254.0.0",16],["172.16.0.0",12],["192.0.0.0",24],["192.0.2.0",24],["192.168.0.0",16],["198.18.0.0",15],["198.51.100.0",24],["203.0.113.0",24],["224.0.0.0",4],["240.0.0.0",4]];function g8($){if(r9($)!==4)return null;let Q=$.split(".");if(Q.length!==4)return null;let Z=0;for(let X of Q){let J=Number(X);if(!Number.isInteger(J)||J<0||J>255)return null;Z=Z*256+J}return Z>>>0}function Y1($,Q,Z){let X=g8(Q);if(X===null)return!1;let J=Z===0?0:4294967295<<32-Z>>>0;return($&J)>>>0===(X&J)>>>0}function rQ($){let Q=g8($);if(Q===null)return!0;return J1.some(([Z,X])=>Y1(Q,Z,X))}function G1($){if(r9($)!==6)return null;let Q=$.toLowerCase(),Z=Q.indexOf("%");if(Z>=0)Q=Q.slice(0,Z);let X=[],J=Q.lastIndexOf(":"),G=J>=0?Q.slice(J+1):"";if(G.includes(".")){let K=g8(G);if(K===null)return null;X=[K>>>16&65535,K&65535],Q=Q.slice(0,J+1)+"0:0"}let z=Q.split("::");if(z.length>2)return null;let H=(K)=>{if(K==="")return[];let L=[];for(let B of K.split(":")){if(B===""||B.length>4||!/^[0-9a-f]+$/.test(B))return null;L.push(Number.parseInt(B,16))}return L},Y=H(z[0]??"");if(Y===null)return null;if(z.length===1){let K=Y;if(K.length!==8)return null;return X.length>0?K.slice(0,6).concat(X):K}let V=H(z[1]??"");if(V===null)return null;let U=8-Y.length-V.length;if(U<0)return null;let F=Y.concat(Array(U).fill(0),V);if(F.length!==8)return null;return X.length>0?F.slice(0,6).concat(X):F}function z1($,Q){return`${$>>8&255}.${$&255}.${Q>>8&255}.${Q&255}`}function K1($){let Q=G1($);if(Q===null)return!0;let[Z,X,J]=Q;if((Z&57344)!==8192)return!0;if(Z===8193&&(X&65024)===0)return!0;if(Z===8193&&X===3512)return!0;if(Z===16383&&(X&61440)===0)return!0;if(Z===8194)return rQ(z1(X,J));return!1}function tQ($){return $.replace(/^\[|\]$/g,"")}function o9($){let Q=tQ($.trim()),Z=r9(Q);if(Z===4)return rQ(Q);if(Z===6)return K1(Q);return!0}function eQ($){if($ instanceof Error&&$.name==="TimeoutError")return"dns_timeout";switch(typeof $==="object"&&$!==null&&"code"in $?$.code:void 0){case"ENOTFOUND":return"dns_not_found";case"ENODATA":return"dns_empty";case"EAI_AGAIN":case"ESERVFAIL":case"ECONNREFUSED":return"dns_temporary";case"ETIMEOUT":case"ETIMEDOUT":return"dns_timeout";default:return"dns_failed"}}var $Z=5000;function H1($){return async(Q,Z)=>{if(Z?.aborted)throw Error("aborted");let X=new X1({timeout:$Z,tries:1});if($)X.setServers($);let J=()=>X.cancel();Z?.addEventListener("abort",J,{once:!0});try{let[G,z]=await Promise.allSettled([X.resolve4(Q),X.resolve6(Q)]),H=[...G.status==="fulfilled"?G.value:[],...z.status==="fulfilled"?z.value:[]];if(H.length>0)return H;let Y=[G,z].flatMap((U)=>U.status==="rejected"?[U.reason]:[]);throw Y.find((U)=>["dns_temporary","dns_timeout"].includes(eQ(U)))??Y[0]??Object.assign(Error("DNS returned no addresses"),{code:"ENODATA"})}finally{Z?.removeEventListener("abort",J)}}}var V1=H1();async function F1($,Q,Z,X){if(X?.aborted)throw Error("aborted");let J=new AbortController,G,z,H=Q($,J.signal);H.catch(()=>{});try{return await Promise.race([H,new Promise((Y,V)=>{if(G=setTimeout(()=>V(new DOMException("DNS lookup timed out","TimeoutError")),Z),X)z=()=>V(Error("aborted")),X.addEventListener("abort",z,{once:!0})})])}finally{if(G!==void 0)clearTimeout(G);if(X&&z)X.removeEventListener("abort",z);J.abort()}}async function p5($,Q=V1,Z){let X=tQ($);if(r9(X))return o9(X)?{ok:!1,reason:"non_public_ip"}:{ok:!0,addresses:[X]};let J;try{J=await F1(X,Q,$Z,Z)}catch(G){return{ok:!1,reason:Z?.aborted?Z.reason instanceof Error&&Z.reason.name==="TimeoutError"?"dns_timeout":"aborted":eQ(G)}}if(J.length===0)return{ok:!1,reason:"dns_empty"};if(J.some(o9))return{ok:!1,reason:"non_public_ip"};return{ok:!0,addresses:J}}var U1=/^(?:\*\.)?[a-z0-9](?:[a-z0-9.-]{0,251}[a-z0-9])?$/;function y8($){return $.length<=253&&U1.test($.toLowerCase())}function W1($,Q){let Z=$.trim().toLowerCase();if(!y8(Z))return!1;if(Z.startsWith("*.")){let X=Z.slice(2);return Q===X||Q.endsWith(`.${X}`)}return Z===Q}function B1($){let Q=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec($);if(!Q)return null;let Z=Q.slice(1).map(Number);return Z.some((X)=>X>255)?null:Z}function h8($,Q=[]){let Z=(X)=>{if(X=X.toLowerCase().replace(/^\[|\]$/g,"").replace(/\.$/,""),!X.includes(":"))return X;try{X=new URL(`http://[${X}]/`).hostname.slice(1,-1)}catch{return X}let J=/^::ffff:([\da-f]+):([\da-f]+)$/.exec(X);if(!J)return X;let G=parseInt(J[1],16),z=parseInt(J[2],16);return`${G>>8}.${G&255}.${z>>8}.${z&255}`};return Q.some((X)=>Z(X)===Z($))}function c0($){$=$.toLowerCase().replace(/^\[|\]$/g,"");let Q=B1($);if(Q){let[G,z,H]=Q;if(G===127)return"loopback";return G===0||G===10||G>=224||G===100&&z>=64&&z<=127||G===169&&z===254||G===172&&z>=16&&z<=31||G===192&&(z===168||z===0&&(H===0||H===2)||z===88&&H===99)||G===198&&(z===18||z===19||z===51&&H===100)||G===203&&z===0&&H===113?"private":"public"}if(!$.includes(":"))return"hostname";try{$=new URL(`http://[${$}]/`).hostname.slice(1,-1)}catch{return"private"}if($==="::1")return"loopback";let Z=/^::ffff:([\da-f]+):([\da-f]+)$/.exec($);if(Z){let G=parseInt(Z[1],16),z=parseInt(Z[2],16);return c0(`${G>>8}.${G&255}.${z>>8}.${z&255}`)==="public"?"public":"private"}let[X,J=0]=$.split(":").map((G)=>parseInt(G||"0",16));return X<8192||X>16383||X===8194||X===8193&&(J<512||J===3512)||X===16383&&J<4096?"private":"public"}function A9($,Q){let Z;try{Z=new URL($)}catch{return{allowed:!1,url:$,host:null,reason:"invalid_url"}}if(["about:","data:","blob:"].includes(Z.protocol))return{allowed:!0,url:$,host:null,reason:"local_document"};if(!["http:","https:","ws:","wss:"].includes(Z.protocol))return{allowed:!1,url:$,host:Z.hostname||null,reason:"unsupported_protocol"};let X=Z.hostname.toLowerCase().replace(/^\[|\]$/g,"").replace(/\.$/,"");if(Q.mode==="off")return{allowed:!0,url:$,host:X,reason:"policy_off"};let J=(H)=>({allowed:!1,url:$,host:X,reason:H});if(Z.username||Z.password)return J("invalid_url");if(Q.mode==="public_web"){let H=c0(X)!=="public"&&c0(X)!=="hostname"||X==="localhost"||/\.(?:localhost|local|internal|arpa)$/.test(X)||!X.includes(".")&&!QZ(X)||Boolean(QZ(X)&&o9(X));return{allowed:!H,url:$,host:X,reason:H?"private_network":"public_web"}}let G=Number(Z.port||(["https:","wss:"].includes(Z.protocol)?443:80));if(Q.deniedPorts?.includes(G)||h8(X,Q.deniedHosts))return J("destination_not_allowed");let z=c0(X);if(z==="private"||["local","internal","arpa"].some((H)=>X===H||X.endsWith(`.${H}`)))return J("private_network");if(z==="loopback"||X==="localhost"||X.endsWith(".localhost"))return Q.allowedLoopbackPorts?.includes(G)?{allowed:!0,url:$,host:X,reason:"loopback"}:J("destination_not_allowed");if(Q.allowedDomains.some((H)=>W1(H,X)))return{allowed:!0,url:$,host:X,reason:"allowed_domain"};return{allowed:!1,url:$,host:X,reason:"destination_not_allowed"}}import XZ from"child_process";import{accessSync as N1,constants as M1,readFileSync as j1,statSync as C1}from"fs";import{createRequire as q1}from"module";import{isAbsolute as v8,join as T1}from"path";var c8=Object.freeze({schemaVersion:1,driver:"playwright-core",driverVersion:JZ.dependencies["playwright-core"],browser:"chromium"}),YZ=["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome","/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge","/Applications/Brave Browser.app/Contents/MacOS/Brave Browser","/Applications/Chromium.app/Contents/MacOS/Chromium"],d8=["/usr/bin/chromium","/usr/bin/chromium-browser","/usr/bin/google-chrome","/usr/bin/google-chrome-stable"];function x9($){try{return N1($,M1.X_OK),v8($)&&C1($).isFile()}catch{return!1}}function p8($,Q=process.platform){let Z=Q==="darwin"?YZ:Q==="linux"?d8:null;return Z?($??Z).find(x9)??null:null}function O1(){if(!process.versions.bun)return;let $=Symbol.for("ara.headless-browser.bun-pipe-owners");if(Object.hasOwn(globalThis,$))return;let Q=[];XZ.spawn=new Proxy(XZ.spawn,{apply(Z,X,J){let G=Reflect.apply(Z,X,J),z=J[1],H=J[2]?.stdio;if(Array.isArray(z)&&z.includes("--remote-debugging-pipe")&&Array.isArray(H)&&H[3]==="pipe"&&H[4]==="pipe")Q.push(G);return G}}),Object.defineProperty(globalThis,$,{value:Q})}async function t9($){if(O1(),$!==void 0){if(!v8($))throw Error("hands_browser_driver_path_must_be_absolute");let X=T1($,"package.json"),J=JSON.parse(j1(X,"utf8"));if(J.name!==c8.driver)throw Error("hands_browser_wrong_driver");let G=q1(X)($),z=G.default?.chromium??G.chromium;if(!z)throw Error("hands_browser_missing_chromium");return{version:J.version,chromium:z}}let[Q,Z]=await Promise.all([import("./index-9aw1gjs5.js"),import("./package-56yg8k4a.js").then((m)=>L1(m.default,1))]);return{version:Z.default.version,chromium:Q.chromium}}var D1=($,Q=c8.driverVersion)=>({status:"unavailable",reason:$,expectedDriverVersion:Q}),_1=($)=>$.loadDriver?.()??t9($.driverModuleDirectory);async function X9($={}){return GZ($,c8.driverVersion)}async function u8($,Q={}){if($.driverVersion!=="1.61.1"||!v8($.driverModuleDirectory))throw Error("hands_browser_invalid_managed_compatibility");return GZ({...Q,driverModuleDirectory:$.driverModuleDirectory,allowSystemBrowser:!0},$.driverVersion)}async function GZ($,Q){let Z=(Y)=>D1(Y,Q),X=$.platform??process.platform;if(X!=="linux"&&X!=="darwin")return Z("unsupported_platform");let J;try{J=await _1($)}catch{return Z("driver_missing")}if(J.version!==Q)return Z("driver_version_mismatch");let G=(Y,V)=>({status:"resolved",executablePath:Y,source:V,driverVersion:J.version});if($.executablePath!==void 0)return x9($.executablePath)?G($.executablePath,"configured"):Z("executable_missing");let z=J.chromium.executablePath();if(x9(z))return G(z,"managed");let H=$.allowSystemBrowser===!0?p8($.systemCandidates,X):null;return H?G(H,"system"):Z("executable_missing")}var g1=["/usr/local/bin/chromium",...d8];function y1($,Q=WZ()){return p8($??(Q==="linux"?g1:void 0),Q)}async function h1(){try{return(await t9()).chromium}catch{return w1(import.meta.url)("playwright-core").chromium}}var v1=1048576,c1=105000,d1=20000,HZ=5000,p1=2000,u1=1000,l1=30000,VZ=81920,s1={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp",".gif":"image/gif"};async function n1($,Q){let Z=new URL($.url()),X={...await $.allHeaders(),host:Z.host};for(let J of Object.keys(X))if(/^(?:proxy-|connection$|upgrade$|transfer-encoding$|content-length$)/i.test(J))delete X[J];return new Promise((J,G)=>{let H=(Z.protocol==="https:"?k1:b1)(Z,{method:$.method(),headers:X,agent:!1,lookup:(V,U,F)=>{let K=d0.isIP(Q);if(U.all)F(null,[{address:Q,family:K}]);else F(null,Q,K)}},(V)=>{let U=[],F=0;V.on("data",(K)=>{if(F+=K.length,F>33554432)H.destroy(Error("hands_browser_response_too_large"));else U.push(K)}),V.on("error",G),V.on("end",()=>{let K={};for(let[L,B]of Object.entries(V.headers))if(B!==void 0&&!["transfer-encoding","connection","content-length"].includes(L))K[L]=Array.isArray(B)?B.join(`
|
|
306
|
+
`.trim();import{Buffer as Q9}from"buffer";import{randomUUID as a3}from"crypto";class lQ extends Error{code;constructor($){super($==="hands_repl_private_profile_attribute_denied"?"Private browser attribute read denied.":$);this.code=$;this.name="HandsReplBrowserDispatcherError"}}var sQ=new Set(["__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","__proto__","constructor","prototype"]),dQ=/^hands_[A-Za-z0-9_-]{8,128}$/,o3=2048,nQ=32,iQ=1e4,r3=new Set(["href","src","alt","title","role","aria-label","aria-expanded","aria-checked","aria-selected","aria-disabled","placeholder","type","name","data-testid"]);function t3($){let Q=$.split("+"),Z=(Q.pop()??"").replace(/^Key/,"").toLowerCase();if(Z==="f12")return!0;if(Q.some((X)=>["Control","ControlOrMeta","Meta"].includes(X))&&["l","n","t","j","i","p","s","w","u","o","r","tab","pageup","pagedown"].includes(Z))return!0;if(Q.some((X)=>["Control","ControlOrMeta","Meta"].includes(X))&&Q.includes("Shift")&&Z==="c")return!0;return Q.includes("Alt")&&["d","arrowleft","arrowright","home"].includes(Z)}var e3=($)=>{let Q=$.closest("a[href],area[href]");return{password:$.tagName==="INPUT"&&$.type==="password",executableLink:Boolean(Q&&!/^(https?:|about:blank)/i.test(Q.href))}},aQ={browser:{close:{returns:"void"},contexts:{returns:"context[]"},isConnected:{returns:"json"},version:{returns:"json"}},context:{addCookies:{returns:"void"},addInitScript:{returns:"void"},browser:{returns:"browser"},clearCookies:{returns:"void"},clearPermissions:{returns:"void"},close:{returns:"void"},cookies:{returns:"json"},grantPermissions:{returns:"void"},newPage:{returns:"page"},pages:{returns:"page[]"},setDefaultNavigationTimeout:{returns:"void"},setDefaultTimeout:{returns:"void"},setExtraHTTPHeaders:{returns:"void"},setGeolocation:{returns:"void"},setHTTPCredentials:{returns:"void"},setOffline:{returns:"void"},setViewportSize:{returns:"void"},storageState:{returns:"json"},viewportSize:{returns:"json",special:"contextViewportSize"}},page:{addInitScript:{returns:"void"},addScriptTag:{returns:"void"},addStyleTag:{returns:"void"},bringToFront:{returns:"void"},close:{returns:"void"},content:{returns:"json"},context:{returns:"context"},emulateMedia:{returns:"void"},evaluate:{returns:"json",requiresStringSource:!0},frame:{returns:"frame"},frameLocator:{returns:"frameLocator"},frames:{returns:"frame[]"},getByAltText:{returns:"locator"},getByLabel:{returns:"locator"},getByPlaceholder:{returns:"locator"},getByRole:{returns:"locator"},getByTestId:{returns:"locator"},getByText:{returns:"locator"},getByTitle:{returns:"locator"},goBack:{returns:"void"},goForward:{returns:"void"},goto:{returns:"void"},isClosed:{returns:"json"},locator:{returns:"locator"},mainFrame:{returns:"frame"},opener:{returns:"page"},pdf:{returns:"bytes"},reload:{returns:"void"},screenshot:{returns:"bytes"},selectOption:{returns:"json"},setContent:{returns:"void"},setDefaultNavigationTimeout:{returns:"void"},setDefaultTimeout:{returns:"void"},setExtraHTTPHeaders:{returns:"void"},setInputFiles:{returns:"void"},setViewportSize:{returns:"void"},title:{returns:"json"},url:{returns:"json"},viewportSize:{returns:"json"},waitForFunction:{returns:"void",requiresStringSource:!0},waitForLoadState:{returns:"void"},waitForNavigation:{returns:"void"},waitForTimeout:{returns:"void"},waitForURL:{returns:"void"}},locator:{all:{returns:"locator[]"},allInnerTexts:{returns:"json"},allTextContents:{returns:"json"},and:{returns:"locator"},ariaSnapshot:{returns:"json"},blur:{returns:"void"},boundingBox:{returns:"json"},check:{returns:"void"},clear:{returns:"void"},click:{returns:"void"},contentFrame:{returns:"frameLocator"},count:{returns:"json"},dblclick:{returns:"void"},dragTo:{returns:"void"},evaluate:{returns:"json",requiresStringSource:!0},evaluateAll:{returns:"json",requiresStringSource:!0},fill:{returns:"void"},filter:{returns:"locator"},first:{returns:"locator",special:"property"},focus:{returns:"void"},getAttribute:{returns:"json"},getByAltText:{returns:"locator"},getByLabel:{returns:"locator"},getByPlaceholder:{returns:"locator"},getByRole:{returns:"locator"},getByTestId:{returns:"locator"},getByText:{returns:"locator"},getByTitle:{returns:"locator"},hover:{returns:"void"},innerHTML:{returns:"json"},innerText:{returns:"json"},inputValue:{returns:"json"},isChecked:{returns:"json"},isEditable:{returns:"json"},isEnabled:{returns:"json"},isHidden:{returns:"json"},isVisible:{returns:"json"},last:{returns:"locator",special:"property"},locator:{returns:"locator"},nth:{returns:"locator"},or:{returns:"locator"},page:{returns:"page"},press:{returns:"void"},pressSequentially:{returns:"void"},scrollIntoViewIfNeeded:{returns:"void"},screenshot:{returns:"bytes"},selectOption:{returns:"json"},setInputFiles:{returns:"void"},tap:{returns:"void"},textContent:{returns:"json"},type:{returns:"void"},uncheck:{returns:"void"},waitFor:{returns:"void"}},frame:{addScriptTag:{returns:"void"},addStyleTag:{returns:"void"},childFrames:{returns:"frame[]"},content:{returns:"json"},evaluate:{returns:"json",requiresStringSource:!0},frameLocator:{returns:"frameLocator"},getByAltText:{returns:"locator"},getByLabel:{returns:"locator"},getByPlaceholder:{returns:"locator"},getByRole:{returns:"locator"},getByTestId:{returns:"locator"},getByText:{returns:"locator"},getByTitle:{returns:"locator"},goto:{returns:"void"},isDetached:{returns:"json"},locator:{returns:"locator"},name:{returns:"json"},page:{returns:"page"},parentFrame:{returns:"frame"},setContent:{returns:"void"},title:{returns:"json"},url:{returns:"json"},waitForFunction:{returns:"void",requiresStringSource:!0},waitForLoadState:{returns:"void"},waitForNavigation:{returns:"void"},waitForTimeout:{returns:"void"},waitForURL:{returns:"void"}},frameLocator:{getByAltText:{returns:"locator"},getByLabel:{returns:"locator"},getByPlaceholder:{returns:"locator"},getByRole:{returns:"locator"},getByTestId:{returns:"locator"},getByText:{returns:"locator"},getByTitle:{returns:"locator"},locator:{returns:"locator"},owner:{returns:"locator"}}};function R($){throw new lQ($)}function G0($){if(!$||typeof $!=="object"||Array.isArray($))return!1;let Q=Object.getPrototypeOf($);return Q===Object.prototype||Q===null}function Z9($,Q=0,Z={nodes:0}){if(Q>nQ||++Z.nodes>iQ)R("hands_repl_json_too_complex");if($===null||typeof $==="boolean"||typeof $==="string")return;if(typeof $==="number"){if(!Number.isFinite($))R("hands_repl_invalid_json");return}if(Array.isArray($)){for(let X of $)Z9(X,Q+1,Z);return}if(!G0($))R("hands_repl_invalid_json");for(let[X,J]of Object.entries($)){if(sQ.has(X))R("hands_repl_invalid_json");Z9(J,Q+1,Z)}}function m8($){return typeof $==="string"&&Object.hasOwn(aQ,$)}function $1($){if(!$.endsWith("[]"))return null;let Q=$.slice(0,-2);return m8(Q)?Q:null}function pQ($){return G0($)&&Object.keys($).length===2&&$.$handsRepl==="bytes"&&typeof $.base64==="string"}function Q1($){return G0($)&&Object.keys($).length===1&&$.$handsRepl==="undefined"}function uQ($){return G0($)&&Object.keys($).length===2&&$.$handsRepl==="routeFulfill"&&"options"in $}function S0($){return!!$&&typeof $==="object"}function a9(){return Object.freeze({$handsRepl:"undefined"})}function Z1($){if(!Q9.isBuffer($)&&!($ instanceof Uint8Array))R("hands_repl_expected_bytes");return Object.freeze({$handsRepl:"bytes",base64:Q9.from($).toString("base64")})}function oQ($){if(!S0($.browser)||!S0($.context)||!S0($.page))R("hands_repl_invalid_roots");if(typeof $.a11y!=="function"||typeof $.view!=="function")R("hands_repl_invalid_callbacks");let Q=$.maxHandles??o3;if(!Number.isInteger(Q)||Q<3||Q>1e5)R("hands_repl_invalid_handle_limit");let Z=new Map,X=new WeakMap,J=$.createOpaqueId??a3,G=(K,L)=>{if(!S0(L))R("hands_repl_expected_target");let B=X.get(L)?.get(K);if(B)return B;if(Z.size>=Q)R("hands_repl_handle_limit");let W="";for(let q=0;q<16;q+=1){let D=`hands_${J()}`;if(dQ.test(D)&&!Z.has(D)){W=D;break}}if(!W)R("hands_repl_invalid_opaque_id");let M=Object.freeze({$handsRepl:"handle",id:W,kind:K});Z.set(W,{kind:K,target:L});let _=X.get(L);if(!_)_=new Map,X.set(L,_);return _.set(K,M),M},z=Object.freeze({browser:G("browser",$.browser),context:G("context",$.context),page:G("page",$.page)}),H=(K)=>{if(!G0(K)||Object.keys(K).length!==3||K.$handsRepl!=="handle"||typeof K.id!=="string"||!dQ.test(K.id)||!m8(K.kind))R("hands_repl_invalid_handle");let L=Z.get(K.id);if(!L||L.kind!==K.kind)R("hands_repl_unknown_handle");return L},Y=(K,L=0,B=new Set)=>{if(L>nQ)R("hands_repl_json_too_complex");if(K===void 0)return a9();if(K===null||typeof K==="boolean"||typeof K==="string")return K;if(typeof K==="number"){if(!Number.isFinite(K))R("hands_repl_non_json_result");return K}if(Array.isArray(K)){if(B.has(K))R("hands_repl_cyclic_result");B.add(K);try{return K.map((W)=>Y(W,L+1,B))}finally{B.delete(K)}}if(!G0(K))R("hands_repl_non_json_result");if(B.has(K))R("hands_repl_cyclic_result");B.add(K);try{let W=Object.create(null);for(let M of Object.keys(K)){let _=Object.getOwnPropertyDescriptor(K,M);if(!_||!("value"in _))continue;W[M]=Y(_.value,L+1,B)}return W}finally{B.delete(K)}},V=(K,L)=>{if(L==="void")return a9();if(L==="json")return Y(K);if(L==="bytes")return Z1(K);let B=$1(L);if(B){if(!Array.isArray(K))R("hands_repl_expected_target_list");if(B==="context"&&K.some((W)=>W!==$.context))R("hands_repl_foreign_context");return K.map((W)=>G(B,W))}if(K===null||K===void 0)return a9();if(!m8(L))R("hands_repl_invalid_return_kind");if(L==="context"&&K!==$.context)R("hands_repl_foreign_context");return G(L,K)},U=(K)=>{if(G0(K)&&K.$handsRepl==="handle")return H(K).target;if(pQ(K))return Q9.from(K.base64,"base64");if(Q1(K))return;if(uQ(K))R("hands_repl_route_fulfill_only");if(Array.isArray(K))return K.map(U);if(!G0(K))return K;let L=Object.create(null);for(let[B,W]of Object.entries(K))L[B]=U(W);return L};return Object.freeze({roots:z,dispatch:async(K)=>{if(!G0(K)||typeof K.type!=="string")R("hands_repl_invalid_request");if(K.type==="a11y"){let T=K.target===void 0?Z.get(z.page.id):H(K.target);if(!T||T.kind!=="page"&&T.kind!=="locator")R("hands_repl_invalid_a11y_target");return Y(await $.a11y(T.target))}if(K.type==="view"){if(Z9(K.source),K.options!==void 0)Z9(K.options);let T=pQ(K.source)?Q9.from(K.source.base64,"base64"):K.source;if($.privateProfile&&!Q9.isBuffer(T))R("hands_repl_profile_requires_image_bytes");return Y(await $.view(T,K.options))}if(K.type!=="call")R("hands_repl_invalid_request");if(typeof K.method!=="string"||K.method.length===0||K.method.length>128)R("hands_repl_invalid_method");if(sQ.has(K.method))R("hands_repl_forbidden_method");let L=H(K.target),B=K.args??[];if(!Array.isArray(B))R("hands_repl_invalid_arguments");if(Z9(B),L.kind==="page"&&K.method==="captureScreenshot"){if(B.length!==0)R("hands_repl_invalid_arguments");if(!$.screenshotExport)R("hands_repl_screenshot_export_unavailable");return Y(await $.screenshotExport(L.target))}if(L.kind==="context"&&["startRecording","stopRecording"].includes(K.method)){if(!$.recording||L.target!==$.context)R("hands_repl_recording_unavailable");if(B.length>(K.method==="startRecording"?1:0))R("hands_repl_invalid_arguments");return Y(K.method==="startRecording"?await $.recording.start(B[0]):await $.recording.stop())}if($.privateProfile){let T=K.method;if(["evaluate","evaluateAll","waitForFunction","addInitScript","addScriptTag","addStyleTag","setContent","setInputFiles","route","content","cookies","storageState","addCookies","clearCookies","setExtraHTTPHeaders","setHTTPCredentials","grantPermissions","clearPermissions","innerHTML","textContent","allTextContents"].includes(T)||L.kind==="browser"&&T==="close"||L.kind==="context"&&T==="close")R("hands_repl_private_profile_method_denied");if(L.kind==="browser"&&T==="contexts")return V([$.context],"context[]");if((T==="screenshot"||T==="pdf")&&G0(B[0])&&(("path"in B[0])||("style"in B[0])))R("hands_repl_private_profile_path_denied");if(T==="goto"){if(typeof B[0]!=="string")R("hands_repl_private_profile_url_denied");try{let k=new URL(B[0]);if(!["http:","https:"].includes(k.protocol)&&B[0]!=="about:blank")R("hands_repl_private_profile_url_denied")}catch{R("hands_repl_private_profile_url_denied")}}if(T==="getAttribute"&&(typeof B[0]!=="string"||!r3.has(B[0].toLowerCase())))R("hands_repl_private_profile_attribute_denied");if(L.kind==="locator"&&["innerText","allInnerTexts","getAttribute"].includes(T)){let k=[L.target];if(T==="allInnerTexts"){let g=Reflect.get(L.target,"all");if(typeof g!=="function")R("hands_repl_private_profile_probe_unavailable");let O=await Reflect.apply(g,L.target,[]);if(!Array.isArray(O)||O.length>iQ||!O.every(S0))R("hands_repl_private_profile_probe_unavailable");k=O}for(let g of k){let O=Reflect.get(g,"isVisible");if(typeof O!=="function"||!await Reflect.apply(O,g,[]))R("hands_repl_private_profile_hidden_value_denied")}}if(T==="press"&&typeof B[0]==="string"&&t3(B[0]))R("hands_repl_private_profile_browser_shortcut_denied");if(L.kind==="locator"&&["inputValue","click","dblclick","tap","press"].includes(T)){let k=Reflect.get(L.target,"evaluate");if(typeof k!=="function")R("hands_repl_private_profile_probe_unavailable");let g=await Reflect.apply(k,L.target,[e3]);if(!G0(g)||typeof g.password!=="boolean"||typeof g.executableLink!=="boolean")R("hands_repl_private_profile_probe_unavailable");if(T==="inputValue"&&g.password)R("hands_repl_private_profile_password_denied");if(T!=="inputValue"&&g.executableLink)R("hands_repl_private_profile_url_denied");if(T==="inputValue"){let O=Reflect.get(L.target,"isVisible");if(typeof O!=="function"||!await Reflect.apply(O,L.target,[]))R("hands_repl_private_profile_hidden_value_denied")}}}let W=aQ[L.kind][K.method];if(!W)R("hands_repl_method_not_allowed");if(W.requiresStringSource&&typeof B[0]!=="string")R("hands_repl_string_source_required");if(L.kind==="browser"&&K.method==="contexts")return[z.context];if(["addInitScript","addScriptTag","addStyleTag","screenshot","pdf","storageState"].includes(K.method)&&B.some((T)=>G0(T)&&("path"in T)))R("hands_repl_file_path_not_allowed");if(K.method==="goto"&&typeof B[0]==="string"){let T;try{T=new URL(B[0]).protocol}catch{R("hands_repl_invalid_url")}if(!["http:","https:","data:","about:","blob:"].includes(T))R("hands_repl_file_path_not_allowed")}if(W.special==="contextViewportSize"){let T=Reflect.get(L.target,"pages");if(typeof T!=="function")R("hands_repl_method_unavailable");let k=await Reflect.apply(T,L.target,[]),g=Array.isArray(k)?k[0]:void 0,O=S0(g)?Reflect.get(g,"viewportSize"):void 0;if(typeof O!=="function")return a9();return V(await Reflect.apply(O,g,[]),W.returns)}if(W.special==="property"){let T=Reflect.get(L.target,K.method);return V(typeof T==="function"?Reflect.apply(T,L.target,[]):T,W.returns)}let M=Reflect.get(L.target,K.method);if(typeof M!=="function")R("hands_repl_method_unavailable");if(W.special==="route"){let T=B[1];if(!uQ(T))R("hands_repl_invalid_route_handler");Z9(T.options);let k=U(T.options),g=async(j)=>{if(!S0(j))R("hands_repl_invalid_route");let A=Reflect.get(j,"fulfill");if(typeof A!=="function")R("hands_repl_invalid_route");await Reflect.apply(A,j,[k])},O=[U(B[0]??null),g],N=await Reflect.apply(M,L.target,O);return V(N,W.returns)}let _=B.map(U);if(K.method==="setInputFiles"){let T=L.kind==="locator"?0:1,k=async(O)=>{if(typeof O!=="string"){if(!G0(O)||typeof O.name!=="string"||typeof O.mimeType!=="string"||!Q9.isBuffer(O.buffer))R("hands_repl_invalid_file_input");return O}if(!$.readWorkspaceFile)R("hands_repl_workspace_required");return $.readWorkspaceFile(O)},g=_[T];_[T]=Array.isArray(g)?await Promise.all(g.map(k)):await k(g)}if(K.method==="goto")await $.beforeNavigation?.();let q=$.actionRecorder?.(),D=await Reflect.apply(M,L.target,_),b={click:"Click browser element",tap:"Click browser element",dblclick:"Double click browser element",fill:"Type text",type:"Type text",pressSequentially:"Type text",clear:"Clear browser field",press:"Press key",scrollIntoViewIfNeeded:"Scroll browser element into view",dragTo:"Drag on computer",selectOption:"Select browser option",check:"Check browser control",uncheck:"Uncheck browser control",hover:"Hover browser element",focus:"Focus browser element",goto:"Open browser page",reload:"Reload browser page",goBack:"Go back in browser",goForward:"Go forward in browser",screenshot:"Take browser screenshot"}[K.method];if(b){let T=Reflect.get(L.target,"page"),k=L.kind==="page"?L.target:typeof T==="function"?Reflect.apply(T,L.target,[]):void 0;q?.(b,S0(k)?k:void 0)}return V(D,W.returns)}})}import{isIP as QZ}from"net";import{Resolver as X1}from"dns/promises";import{isIP as r9}from"net";var J1=[["0.0.0.0",8],["10.0.0.0",8],["100.64.0.0",10],["127.0.0.0",8],["169.254.0.0",16],["172.16.0.0",12],["192.0.0.0",24],["192.0.2.0",24],["192.168.0.0",16],["198.18.0.0",15],["198.51.100.0",24],["203.0.113.0",24],["224.0.0.0",4],["240.0.0.0",4]];function g8($){if(r9($)!==4)return null;let Q=$.split(".");if(Q.length!==4)return null;let Z=0;for(let X of Q){let J=Number(X);if(!Number.isInteger(J)||J<0||J>255)return null;Z=Z*256+J}return Z>>>0}function Y1($,Q,Z){let X=g8(Q);if(X===null)return!1;let J=Z===0?0:4294967295<<32-Z>>>0;return($&J)>>>0===(X&J)>>>0}function rQ($){let Q=g8($);if(Q===null)return!0;return J1.some(([Z,X])=>Y1(Q,Z,X))}function G1($){if(r9($)!==6)return null;let Q=$.toLowerCase(),Z=Q.indexOf("%");if(Z>=0)Q=Q.slice(0,Z);let X=[],J=Q.lastIndexOf(":"),G=J>=0?Q.slice(J+1):"";if(G.includes(".")){let K=g8(G);if(K===null)return null;X=[K>>>16&65535,K&65535],Q=Q.slice(0,J+1)+"0:0"}let z=Q.split("::");if(z.length>2)return null;let H=(K)=>{if(K==="")return[];let L=[];for(let B of K.split(":")){if(B===""||B.length>4||!/^[0-9a-f]+$/.test(B))return null;L.push(Number.parseInt(B,16))}return L},Y=H(z[0]??"");if(Y===null)return null;if(z.length===1){let K=Y;if(K.length!==8)return null;return X.length>0?K.slice(0,6).concat(X):K}let V=H(z[1]??"");if(V===null)return null;let U=8-Y.length-V.length;if(U<0)return null;let F=Y.concat(Array(U).fill(0),V);if(F.length!==8)return null;return X.length>0?F.slice(0,6).concat(X):F}function z1($,Q){return`${$>>8&255}.${$&255}.${Q>>8&255}.${Q&255}`}function K1($){let Q=G1($);if(Q===null)return!0;let[Z,X,J]=Q;if((Z&57344)!==8192)return!0;if(Z===8193&&(X&65024)===0)return!0;if(Z===8193&&X===3512)return!0;if(Z===16383&&(X&61440)===0)return!0;if(Z===8194)return rQ(z1(X,J));return!1}function tQ($){return $.replace(/^\[|\]$/g,"")}function o9($){let Q=tQ($.trim()),Z=r9(Q);if(Z===4)return rQ(Q);if(Z===6)return K1(Q);return!0}function eQ($){if($ instanceof Error&&$.name==="TimeoutError")return"dns_timeout";switch(typeof $==="object"&&$!==null&&"code"in $?$.code:void 0){case"ENOTFOUND":return"dns_not_found";case"ENODATA":return"dns_empty";case"EAI_AGAIN":case"ESERVFAIL":case"ECONNREFUSED":return"dns_temporary";case"ETIMEOUT":case"ETIMEDOUT":return"dns_timeout";default:return"dns_failed"}}var $Z=5000;function H1($){return async(Q,Z)=>{if(Z?.aborted)throw Error("aborted");let X=new X1({timeout:$Z,tries:1});if($)X.setServers($);let J=()=>X.cancel();Z?.addEventListener("abort",J,{once:!0});try{let[G,z]=await Promise.allSettled([X.resolve4(Q),X.resolve6(Q)]),H=[...G.status==="fulfilled"?G.value:[],...z.status==="fulfilled"?z.value:[]];if(H.length>0)return H;let Y=[G,z].flatMap((U)=>U.status==="rejected"?[U.reason]:[]);throw Y.find((U)=>["dns_temporary","dns_timeout"].includes(eQ(U)))??Y[0]??Object.assign(Error("DNS returned no addresses"),{code:"ENODATA"})}finally{Z?.removeEventListener("abort",J)}}}var V1=H1();async function F1($,Q,Z,X){if(X?.aborted)throw Error("aborted");let J=new AbortController,G,z,H=Q($,J.signal);H.catch(()=>{});try{return await Promise.race([H,new Promise((Y,V)=>{if(G=setTimeout(()=>V(new DOMException("DNS lookup timed out","TimeoutError")),Z),X)z=()=>V(Error("aborted")),X.addEventListener("abort",z,{once:!0})})])}finally{if(G!==void 0)clearTimeout(G);if(X&&z)X.removeEventListener("abort",z);J.abort()}}async function p5($,Q=V1,Z){let X=tQ($);if(r9(X))return o9(X)?{ok:!1,reason:"non_public_ip"}:{ok:!0,addresses:[X]};let J;try{J=await F1(X,Q,$Z,Z)}catch(G){return{ok:!1,reason:Z?.aborted?Z.reason instanceof Error&&Z.reason.name==="TimeoutError"?"dns_timeout":"aborted":eQ(G)}}if(J.length===0)return{ok:!1,reason:"dns_empty"};if(J.some(o9))return{ok:!1,reason:"non_public_ip"};return{ok:!0,addresses:J}}var U1=/^(?:\*\.)?[a-z0-9](?:[a-z0-9.-]{0,251}[a-z0-9])?$/;function y8($){return $.length<=253&&U1.test($.toLowerCase())}function W1($,Q){let Z=$.trim().toLowerCase();if(!y8(Z))return!1;if(Z.startsWith("*.")){let X=Z.slice(2);return Q===X||Q.endsWith(`.${X}`)}return Z===Q}function B1($){let Q=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec($);if(!Q)return null;let Z=Q.slice(1).map(Number);return Z.some((X)=>X>255)?null:Z}function h8($,Q=[]){let Z=(X)=>{if(X=X.toLowerCase().replace(/^\[|\]$/g,"").replace(/\.$/,""),!X.includes(":"))return X;try{X=new URL(`http://[${X}]/`).hostname.slice(1,-1)}catch{return X}let J=/^::ffff:([\da-f]+):([\da-f]+)$/.exec(X);if(!J)return X;let G=parseInt(J[1],16),z=parseInt(J[2],16);return`${G>>8}.${G&255}.${z>>8}.${z&255}`};return Q.some((X)=>Z(X)===Z($))}function c0($){$=$.toLowerCase().replace(/^\[|\]$/g,"");let Q=B1($);if(Q){let[G,z,H]=Q;if(G===127)return"loopback";return G===0||G===10||G>=224||G===100&&z>=64&&z<=127||G===169&&z===254||G===172&&z>=16&&z<=31||G===192&&(z===168||z===0&&(H===0||H===2)||z===88&&H===99)||G===198&&(z===18||z===19||z===51&&H===100)||G===203&&z===0&&H===113?"private":"public"}if(!$.includes(":"))return"hostname";try{$=new URL(`http://[${$}]/`).hostname.slice(1,-1)}catch{return"private"}if($==="::1")return"loopback";let Z=/^::ffff:([\da-f]+):([\da-f]+)$/.exec($);if(Z){let G=parseInt(Z[1],16),z=parseInt(Z[2],16);return c0(`${G>>8}.${G&255}.${z>>8}.${z&255}`)==="public"?"public":"private"}let[X,J=0]=$.split(":").map((G)=>parseInt(G||"0",16));return X<8192||X>16383||X===8194||X===8193&&(J<512||J===3512)||X===16383&&J<4096?"private":"public"}function A9($,Q){let Z;try{Z=new URL($)}catch{return{allowed:!1,url:$,host:null,reason:"invalid_url"}}if(["about:","data:","blob:"].includes(Z.protocol))return{allowed:!0,url:$,host:null,reason:"local_document"};if(!["http:","https:","ws:","wss:"].includes(Z.protocol))return{allowed:!1,url:$,host:Z.hostname||null,reason:"unsupported_protocol"};let X=Z.hostname.toLowerCase().replace(/^\[|\]$/g,"").replace(/\.$/,"");if(Q.mode==="off")return{allowed:!0,url:$,host:X,reason:"policy_off"};let J=(H)=>({allowed:!1,url:$,host:X,reason:H});if(Z.username||Z.password)return J("invalid_url");if(Q.mode==="public_web"){let H=c0(X)!=="public"&&c0(X)!=="hostname"||X==="localhost"||/\.(?:localhost|local|internal|arpa)$/.test(X)||!X.includes(".")&&!QZ(X)||Boolean(QZ(X)&&o9(X));return{allowed:!H,url:$,host:X,reason:H?"private_network":"public_web"}}let G=Number(Z.port||(["https:","wss:"].includes(Z.protocol)?443:80));if(Q.deniedPorts?.includes(G)||h8(X,Q.deniedHosts))return J("destination_not_allowed");let z=c0(X);if(z==="private"||["local","internal","arpa"].some((H)=>X===H||X.endsWith(`.${H}`)))return J("private_network");if(z==="loopback"||X==="localhost"||X.endsWith(".localhost"))return Q.allowedLoopbackPorts?.includes(G)?{allowed:!0,url:$,host:X,reason:"loopback"}:J("destination_not_allowed");if(Q.allowedDomains.some((H)=>W1(H,X)))return{allowed:!0,url:$,host:X,reason:"allowed_domain"};return{allowed:!1,url:$,host:X,reason:"destination_not_allowed"}}import XZ from"child_process";import{accessSync as N1,constants as M1,readFileSync as j1,statSync as C1}from"fs";import{createRequire as q1}from"module";import{isAbsolute as v8,join as T1}from"path";var c8=Object.freeze({schemaVersion:1,driver:"playwright-core",driverVersion:JZ.dependencies["playwright-core"],browser:"chromium"}),YZ=["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome","/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge","/Applications/Brave Browser.app/Contents/MacOS/Brave Browser","/Applications/Chromium.app/Contents/MacOS/Chromium"],d8=["/usr/bin/chromium","/usr/bin/chromium-browser","/usr/bin/google-chrome","/usr/bin/google-chrome-stable"];function x9($){try{return N1($,M1.X_OK),v8($)&&C1($).isFile()}catch{return!1}}function p8($,Q=process.platform){let Z=Q==="darwin"?YZ:Q==="linux"?d8:null;return Z?($??Z).find(x9)??null:null}function O1(){if(!process.versions.bun)return;let $=Symbol.for("ara.headless-browser.bun-pipe-owners");if(Object.hasOwn(globalThis,$))return;let Q=[];XZ.spawn=new Proxy(XZ.spawn,{apply(Z,X,J){let G=Reflect.apply(Z,X,J),z=J[1],H=J[2]?.stdio;if(Array.isArray(z)&&z.includes("--remote-debugging-pipe")&&Array.isArray(H)&&H[3]==="pipe"&&H[4]==="pipe")Q.push(G);return G}}),Object.defineProperty(globalThis,$,{value:Q})}async function t9($){if(O1(),$!==void 0){if(!v8($))throw Error("hands_browser_driver_path_must_be_absolute");let X=T1($,"package.json"),J=JSON.parse(j1(X,"utf8"));if(J.name!==c8.driver)throw Error("hands_browser_wrong_driver");let G=q1(X)($),z=G.default?.chromium??G.chromium;if(!z)throw Error("hands_browser_missing_chromium");return{version:J.version,chromium:z}}let[Q,Z]=await Promise.all([import("./index-bwnyk312.js"),import("./package-q8gdr1z1.js").then((m)=>L1(m.default,1))]);return{version:Z.default.version,chromium:Q.chromium}}var D1=($,Q=c8.driverVersion)=>({status:"unavailable",reason:$,expectedDriverVersion:Q}),_1=($)=>$.loadDriver?.()??t9($.driverModuleDirectory);async function X9($={}){return GZ($,c8.driverVersion)}async function u8($,Q={}){if($.driverVersion!=="1.61.1"||!v8($.driverModuleDirectory))throw Error("hands_browser_invalid_managed_compatibility");return GZ({...Q,driverModuleDirectory:$.driverModuleDirectory,allowSystemBrowser:!0},$.driverVersion)}async function GZ($,Q){let Z=(Y)=>D1(Y,Q),X=$.platform??process.platform;if(X!=="linux"&&X!=="darwin")return Z("unsupported_platform");let J;try{J=await _1($)}catch{return Z("driver_missing")}if(J.version!==Q)return Z("driver_version_mismatch");let G=(Y,V)=>({status:"resolved",executablePath:Y,source:V,driverVersion:J.version});if($.executablePath!==void 0)return x9($.executablePath)?G($.executablePath,"configured"):Z("executable_missing");let z=J.chromium.executablePath();if(x9(z))return G(z,"managed");let H=$.allowSystemBrowser===!0?p8($.systemCandidates,X):null;return H?G(H,"system"):Z("executable_missing")}var g1=["/usr/local/bin/chromium",...d8];function y1($,Q=WZ()){return p8($??(Q==="linux"?g1:void 0),Q)}async function h1(){try{return(await t9()).chromium}catch{return w1(import.meta.url)("playwright-core").chromium}}var v1=1048576,c1=105000,d1=20000,HZ=5000,p1=2000,u1=1000,l1=30000,VZ=81920,s1={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp",".gif":"image/gif"};async function n1($,Q){let Z=new URL($.url()),X={...await $.allHeaders(),host:Z.host};for(let J of Object.keys(X))if(/^(?:proxy-|connection$|upgrade$|transfer-encoding$|content-length$)/i.test(J))delete X[J];return new Promise((J,G)=>{let H=(Z.protocol==="https:"?k1:b1)(Z,{method:$.method(),headers:X,agent:!1,lookup:(V,U,F)=>{let K=d0.isIP(Q);if(U.all)F(null,[{address:Q,family:K}]);else F(null,Q,K)}},(V)=>{let U=[],F=0;V.on("data",(K)=>{if(F+=K.length,F>33554432)H.destroy(Error("hands_browser_response_too_large"));else U.push(K)}),V.on("error",G),V.on("end",()=>{let K={};for(let[L,B]of Object.entries(V.headers))if(B!==void 0&&!["transfer-encoding","connection","content-length"].includes(L))K[L]=Array.isArray(B)?B.join(`
|
|
307
307
|
`):B;J({status:V.statusCode??502,headers:K,body:Buffer.concat(U)})})}),Y=setTimeout(()=>H.destroy(Error("hands_browser_fetch_timeout")),l1);H.once("close",()=>clearTimeout(Y)),H.on("error",G),H.end($.postDataBuffer()??void 0)})}async function i1($,Q,Z=()=>{},X={lookup:(J)=>S1(J,{all:!0}),fetch:n1}){let J=new WeakSet,G=new WeakMap,z=(H)=>{let Y=G.get(H);if(Y)return Y;let V=(async()=>{if(!$.newCDPSession)return;let U=await $.newCDPSession(H),F=new Map;U.on("Network.loadingFinished",({requestId:K})=>F.delete(K)),U.on("Network.loadingFailed",({requestId:K})=>F.delete(K)),U.on("Fetch.requestPaused",async(K)=>{let L=K.networkId??K.requestId,B=K.redirectedRequestId?(F.get(L)??0)+1:0;F.set(L,B);let W=A9(K.request.url,Q),M=Q.mode==="enforce"&&Boolean(K.redirectedRequestId)&&W.host!==null&&!d0.isIP(W.host),_=!W.allowed?W:M?{...W,allowed:!1,reason:"destination_not_allowed"}:B>20?{...W,allowed:!1,reason:"redirect_not_supported"}:null;try{if(_)Z(_),await U.send("Fetch.failRequest",{requestId:K.requestId,errorReason:"BlockedByClient"});else await U.send("Fetch.continueRequest",{requestId:K.requestId})}catch{await U.send("Fetch.failRequest",{requestId:K.requestId,errorReason:"Failed"}).catch(()=>{})}}),await U.send("Network.enable"),await U.send("Fetch.enable",{patterns:[{urlPattern:"*",requestStage:"Request"}]}),J.add(H)})();return G.set(H,V),V};return await $.route("**/*",async(H)=>{let Y=H.request().url(),V=A9(Y,Q);if(V.allowed&&Q.mode==="public_web"){await H.continue();return}let U=H.request();if(V.allowed&&V.host&&d0.isIP(V.host)&&U.isNavigationRequest?.()){let F=U.frame();if(J.has(F.page())&&F===F.page().mainFrame()){await H.continue();return}}if(V.allowed&&(Q.mode==="off"||V.reason==="local_document")){await H.continue();return}if(V.allowed&&V.host)try{let F=V.host,K=c0(F),L,B=await(async()=>{if(K!=="hostname")return[{address:F,family:d0.isIP(F)}];if(V.reason==="loopback")return[{address:"127.0.0.1",family:4}];try{return await Promise.race([X.lookup(F),new Promise((W,M)=>{L=setTimeout(()=>M(Error("hands_browser_dns_timeout")),5000)})])}finally{if(L)clearTimeout(L)}})();if(!B.length||B.some(({address:W})=>{let M=c0(W);return!d0.isIP(W)||Q.mode==="enforce"&&h8(W,Q.deniedHosts)||(V.reason==="loopback"?M!=="loopback":M!=="public")}))V={...V,allowed:!1,reason:"private_network"};else{let W=await X.fetch(H.request(),B[0].address);if(W.status>=300&&W.status<400){let M=W.headers.location??Y;try{M=new URL(M,Y).href}catch{}let _=A9(M,Q);V=_.allowed?{..._,allowed:!1,reason:"redirect_not_supported"}:_}else{await H.fulfill(W);return}}}catch{await H.abort("failed");return}Z(V),await H.abort("blockedbyclient")}),await $.routeWebSocket("**/*",async(H)=>{let Y=A9(H.url(),Q);if(Q.mode==="enforce"&&Y.allowed&&(!Y.host||!d0.isIP(Y.host)))Y={...Y,allowed:!1,reason:"destination_not_allowed"};if(Y.allowed){H.connectToServer();return}Z(Y),await H.close({code:1008,reason:"Reason egress policy denied"})}),Q.mode==="off"?void 0:{preparePage:z}}async function BZ($,Q=WZ(),Z){if(Z){let J=await u8(Z,{platform:Q,systemCandidates:$});return J.status==="resolved"?J.executablePath:null}if($!==void 0){let J=y1($,Q);if(J)return J}let X=await X9({platform:Q,systemCandidates:$,allowSystemBrowser:!0});return X.status==="resolved"?X.executablePath:null}function FZ($,Q){if(!$)throw Error("hands_repl_workspace_required");let Z=s8($),X=J9($),J=n8(X,J9(X,Q)),z=J!==".."&&!J.startsWith(`..${i8}`)&&!KZ(J)?J9(Z,J):J9(Z,Q);if(E0(J9(X,Q))||E0(z))throw Error("hands_repl_protected_path");let H=(B)=>{let W=n8(Z,B);return W!==""&&W!==".."&&!W.startsWith(`..${i8}`)&&!KZ(W)},Y=s8(z);if(E0(Y))throw Error("hands_repl_protected_path");if(!H(z)||!H(Y))throw Error("hands_repl_file_outside_workspace");let V=n8(Z,z).split(i8),U=[Z,...V.map((B,W)=>J9(Z,...V.slice(0,W+1)))],F=U.map((B)=>zZ(B));if(F.some((B)=>B.isSymbolicLink()))throw Error("hands_repl_file_symlink");let K=F[F.length-1];if(!K.isFile()||K.nlink!==1||K.size>16777216)throw Error("hands_repl_file_not_regular_or_too_large");let L=I1(z,l8.O_RDONLY|l8.O_NOFOLLOW|l8.O_NONBLOCK);try{let B=P1(L);if(B.dev!==K.dev||B.ino!==K.ino||!B.isFile())throw Error("hands_repl_file_changed");for(let q=0;q<U.length;q++){let D=zZ(U[q]);if(D.dev!==F[q].dev||D.ino!==F[q].ino||D.isSymbolicLink())throw Error("hands_repl_file_changed")}if(!H(s8(z)))throw Error("hands_repl_file_outside_workspace");let W=Buffer.alloc(16777217),M=0;while(M<W.length){let q=R1(L,W,M,W.length-M,null);if(!q)break;M+=q}if(M===W.length)throw Error("hands_repl_file_too_large");let _=W.subarray(0,M);return{name:f1(z),mimeType:s1[m1(z).toLowerCase()]??"application/octet-stream",buffer:_}}finally{x1(L)}}function Y9($,Q){$.end(`${JSON.stringify(Q)}
|
|
308
308
|
`)}function e9($){try{E1($)}catch{}}async function LZ($){if($.managedBrowser&&$.driverModuleDirectory!==void 0)throw Error("hands_browser_ambiguous_driver_configuration");let Q=$.launch||$.targetContext?null:$.managedBrowser?await u8($.managedBrowser,{executablePath:$.browserExecutablePath}):await X9({executablePath:$.browserExecutablePath,driverModuleDirectory:$.driverModuleDirectory});if(Q?.status==="unavailable")throw Error(`hands_browser_${Q.reason}`);let Z=Q?.status==="resolved"?Q.executablePath:$.browserExecutablePath;if(!Z||!x9(Z))throw Error("hands_browser_unavailable");let X=$.launch??(async(N)=>($.targetContext?await h1():(await t9($.managedBrowser?.driverModuleDirectory??$.driverModuleDirectory)).chromium).launch(N)),J=[],G={},z=null,H=null,Y=null,V=null,U=!1,F=null,K=new Map,L=new WeakMap,B=null,W=()=>{if(U)throw Error("hands_repl_stopped");if(V)throw V},M=(N)=>{let j=L.get(N);if(j)return j;let A=Promise.resolve().then(()=>N.close()).then(()=>{K.delete(N)});return L.set(N,A),A},_=async()=>{let N=[...K.entries()].reverse(),j=B??=performance.now()+u1,A=Promise.allSettled(N.filter(([,P])=>P==="context").map(([P])=>M(P))),m;try{await Promise.race([A,new Promise((P)=>{m=setTimeout(P,Math.max(0,j-performance.now()))})])}finally{if(m)clearTimeout(m)}let w=await Promise.allSettled(N.map(([P])=>M(P))),E=[];for(let[P,f]of w.entries()){if(f.status!=="rejected")continue;let d=f.reason instanceof Error&&["Error","TimeoutError","ProtocolError"].includes(f.reason.name)?f.reason.name:"unknown";E.push(Error(`hands_repl_close_failed: ${N[P][1]}: ${d}`))}if(E.length)throw AggregateError(E,"hands_repl_stop_unconfirmed")},q=(N,j)=>{if(K.set(N,j),U||V)M(N).catch(()=>{return}),W();return N},D=async()=>{let N=await X({executablePath:Z,headless:!0,chromiumSandbox:$.managedBrowser===void 0,args:["--disable-background-networking","--disable-quic","--disable-dev-shm-usage","--disable-gpu","--disable-software-rasterizer","--dns-prefetch-disable","--force-webrtc-ip-handling-policy=disable_non_proxied_udp","--no-pings"]}),j=null;try{q(N,"browser"),j=$.targetContext??q(await N.newContext({viewport:{width:1440,height:900},screen:{width:1440,height:900},serviceWorkers:"block",acceptDownloads:!1}),"context");let A=await i1(j,$.networkPolicy??{mode:"off"},$.onEgressDenied);if(W(),A){let S=j.newPage.bind(j);j.newPage=async()=>{let h=await S();return await A.preparePage(h),h}}let w=j.pages()[0]??await j.newPage();await A?.preparePage(w),W();let E=async(S=w)=>{let h=S;if(typeof h.ariaSnapshot==="function")return h.ariaSnapshot({timeout:1e4});return w.locator("body").innerText({timeout:1e4})},P=async(S,h={})=>{let c=h&&typeof h==="object"&&!Array.isArray(h)?h:{},a,V0="image/png";if(Buffer.isBuffer(S)||S instanceof Uint8Array)a=Buffer.from(S);else if(typeof S==="string"&&(S.startsWith("data:")||/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(S)))a=Buffer.from(S.replace(/^data:[^,]*,/,""),"base64");else if(typeof S==="string"){let f0=FZ($.workspaceRoot,S);a=f0.buffer,V0=f0.mimeType}else throw Error("view() needs a Buffer, a base64 string, or a path to an image file");if(a.length===0)throw Error("view(): the image is empty");let B8=String(c.label??"").replace(/[\r\n>]+/g," ").trim().slice(0,120),D0=Number(c.maxWidth)||1024,i0=Number(c.quality)||72,w9=$.targetContext?await N.newPage():await j.newPage();try{let f0=`data:${V0};base64,${a.toString("base64")}`;for(let r=0;r<5;r+=1){let B0=await w9.evaluate(async(F0)=>{let L0=new Image;L0.src=F0.url,await L0.decode();let m0=Math.min(1,F0.maxWidth/L0.naturalWidth),Y0=document.createElement("canvas");Y0.width=Math.max(1,Math.round(L0.naturalWidth*m0)),Y0.height=Math.max(1,Math.round(L0.naturalHeight*m0));let X0=Y0.getContext("2d");if(!X0)throw Error("view(): canvas unavailable");return X0.fillStyle="#ffffff",X0.fillRect(0,0,Y0.width,Y0.height),X0.drawImage(L0,0,0,Y0.width,Y0.height),{data:Y0.toDataURL("image/jpeg",F0.q/100).split(",")[1]??"",width:Y0.width,height:Y0.height,sourceWidth:L0.naturalWidth,sourceHeight:L0.naturalHeight}},{url:f0,maxWidth:D0,q:i0}),a0=Buffer.from(B0.data,"base64");if(a0.length<=VZ){let F0=B8||"image";return`<<<ARA_VIEW_IMAGE ${B0.data} image/jpeg ${F0}>>>
|
|
309
309
|
Viewing ${F0} (${B0.sourceWidth}x${B0.sourceHeight} source, sent at ${B0.width}x${B0.height}, ${Math.round(a0.length/1024)}KB).`}if(D0>640)D0=Math.round(D0*0.75);else i0=Math.max(30,i0-15)}throw Error(`view(): could not reduce the image under ${Math.round(VZ/1024)}KB`)}finally{await w9.close().catch(()=>{return})}},f=oQ({browser:$.targetContext?.browser()??N,context:j,page:w,a11y:E,view:P,readWorkspaceFile:(S)=>FZ($.workspaceRoot,S),privateProfile:$.privateProfile,beforeNavigation:$.beforeNavigation,recording:$.recording,screenshotExport:$.screenshotExport,actionRecorder:()=>{let S=J,h=G;return(c,a)=>{if(S.length<UZ)S.push(c);if(a)h.page=a}}}),d=async(S)=>{W();let h=q(await N.newContext({serviceWorkers:"block",acceptDownloads:!1}),"context");try{await h.route("**/*",(a)=>a.abort()),W(),await h.routeWebSocket("**/*",(a)=>a.close({code:1008,reason:"Reason evaluator network denied"})),W(),await h.exposeBinding("__araHandsRpc",async(a,V0)=>$.onBrowserOperation?$.onBrowserOperation(S,()=>f.dispatch(V0)):f.dispatch(V0)),W();let c=await h.newPage();return W(),await c.goto("data:text/html,<title>Reason Hands evaluator</title>"),W(),await c.evaluate(`(${vQ})(${JSON.stringify(f.roots)})`),{context:h,page:c,runId:S}}catch(c){throw await M(h).catch(()=>{return}),c}},u=await d(),l={browser:N,context:j,page:w,evaluator:u,async captureProgressFrame(S){return P(await S.screenshot({type:"jpeg",quality:65,timeout:2000}),{label:"Screen after browser action"})},async resetEvaluator(S){await M(l.evaluator.context),l.evaluator=await d(S)}};return W(),l}catch(A){throw await _().catch(()=>{return}),A}},x=async()=>{if(W(),z)return z;if(!Y){H=D();let N;Y=Promise.race([H,new Promise((j,A)=>{N=setTimeout(()=>A(Error("hands_browser_unavailable: startup timed out")),d1)})]).then((j)=>{return W(),z=j,j}).catch(async()=>{V=Error("hands_browser_unavailable: startup failed or timed out");let j;try{await Promise.race([_(),new Promise((A,m)=>{j=setTimeout(()=>m(Error("hands_repl_stop_timeout")),HZ)})])}catch{V=Error("hands_browser_unavailable: startup cleanup unconfirmed")}finally{if(j)clearTimeout(j)}throw V}).finally(()=>{if(N)clearTimeout(N)})}return Y},b=async(N,j,A=!1)=>{let m=await x(),w=G;if($.onBrowserOperation&&m.evaluator.runId!==j)await m.resetEvaluator(j);let P=(async()=>{let u=await m.evaluator.page.evaluate(`(${cQ})(${JSON.stringify({code:N})})`);if(typeof u!=="string")throw Error("hands_repl_invalid_evaluator_output");let l=w.page;if(A&&l&&!u.includes("<<<ARA_VIEW_IMAGE")){let S=()=>m.captureProgressFrame(l);try{let h=await($.onBrowserOperation?$.onBrowserOperation(j,S):S());return w.automaticProgressImage=!0,`${u}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Lh as s}from"./vm-hands-entry-lite-ss2w3h3d.js";var mc={};s(mc,{xor:()=>Zl,xid:()=>kl,void:()=>Bl,uuidv7:()=>$l,uuidv6:()=>ul,uuidv4:()=>el,uuid:()=>vl,util:()=>k,url:()=>gl,uppercase:()=>Xr,unknown:()=>mr,union:()=>gt,undefined:()=>Tl,ulid:()=>Ul,uint64:()=>Ql,uint32:()=>ql,tuple:()=>Q$,trim:()=>Tr,treeifyError:()=>Lt,transform:()=>ct,toUpperCase:()=>Br,toLowerCase:()=>Hr,toJSONSchema:()=>Yi,templateLiteral:()=>uc,symbol:()=>Fl,superRefine:()=>cg,success:()=>tc,stringbool:()=>Uc,stringFormat:()=>Ll,string:()=>On,strictObject:()=>Rl,startsWith:()=>Kr,slugify:()=>Mr,size:()=>Dr,setErrorMap:()=>i4,set:()=>pl,safeParseAsync:()=>c$,safeParse:()=>l$,safeEncodeAsync:()=>w$,safeEncode:()=>k$,safeDecodeAsync:()=>S$,safeDecode:()=>D$,registry:()=>ui,regexes:()=>d,regex:()=>Ar,refine:()=>lg,record:()=>F$,readonly:()=>og,property:()=>Vi,promise:()=>$c,prettifyError:()=>Et,preprocess:()=>Dc,prefault:()=>y$,positive:()=>Ei,pipe:()=>di,partialRecord:()=>hl,parseAsync:()=>g$,parse:()=>$$,overwrite:()=>f,optional:()=>Pn,object:()=>xl,number:()=>N$,nullish:()=>ic,nullable:()=>Jn,null:()=>J$,normalize:()=>Fr,nonpositive:()=>Wi,nonoptional:()=>a$,nonnegative:()=>Ai,never:()=>$t,negative:()=>Gi,nativeEnum:()=>sl,nanoid:()=>Il,nan:()=>oc,multipleOf:()=>ur,minSize:()=>a,minLength:()=>nr,mime:()=>Qr,meta:()=>bc,maxSize:()=>$r,maxLength:()=>wr,map:()=>al,mac:()=>Sl,lte:()=>x,lt:()=>h,lowercase:()=>Vr,looseRecord:()=>yl,looseObject:()=>fl,locales:()=>Sn,literal:()=>rc,length:()=>Sr,lazy:()=>ug,ksuid:()=>Dl,keyof:()=>dl,jwt:()=>Jl,json:()=>kc,iso:()=>Rr,ipv6:()=>ml,ipv4:()=>wl,invertCodec:()=>ec,intersection:()=>K$,int64:()=>Yl,int32:()=>Xl,int:()=>Mi,instanceof:()=>_c,includes:()=>qr,httpUrl:()=>ll,hostname:()=>El,hex:()=>Gl,hash:()=>Wl,guid:()=>ol,gte:()=>Q,gt:()=>y,globalRegistry:()=>X,getErrorMap:()=>t4,function:()=>gc,fromJSONSchema:()=>Sc,formatError:()=>$n,float64:()=>Vl,float32:()=>Al,flattenError:()=>un,file:()=>nc,exactOptional:()=>R$,enum:()=>lt,endsWith:()=>Yr,encodeAsync:()=>_$,encode:()=>I$,emoji:()=>cl,email:()=>tl,e164:()=>Pl,discriminatedUnion:()=>Cl,describe:()=>Ic,decodeAsync:()=>U$,decode:()=>b$,date:()=>Ml,custom:()=>cc,cuid2:()=>_l,cuid:()=>bl,core:()=>ir,config:()=>W,coerce:()=>bg,codec:()=>vc,clone:()=>K,cidrv6:()=>zl,cidrv4:()=>Nl,check:()=>lc,catch:()=>rg,boolean:()=>z$,bigint:()=>Kl,base64url:()=>jl,base64:()=>Ol,array:()=>Wn,any:()=>Hl,_function:()=>gc,_default:()=>C$,_ZodString:()=>xi,ZodXor:()=>V$,ZodXID:()=>ai,ZodVoid:()=>W$,ZodUnknown:()=>E$,ZodUnion:()=>Vn,ZodUndefined:()=>j$,ZodUUID:()=>p,ZodURL:()=>En,ZodULID:()=>yi,ZodType:()=>O,ZodTuple:()=>Y$,ZodTransform:()=>d$,ZodTemplateLiteral:()=>vg,ZodSymbol:()=>O$,ZodSuccess:()=>p$,ZodStringFormat:()=>L,ZodString:()=>Cr,ZodSet:()=>H$,ZodRecord:()=>fr,ZodRealError:()=>M,ZodReadonly:()=>tg,ZodPromise:()=>$g,ZodPreprocess:()=>ig,ZodPrefault:()=>h$,ZodPipe:()=>Xn,ZodOptional:()=>It,ZodObject:()=>An,ZodNumberFormat:()=>Nr,ZodNumber:()=>yr,ZodNullable:()=>f$,ZodNull:()=>P$,ZodNonOptional:()=>bt,ZodNever:()=>G$,ZodNanoID:()=>Zi,ZodNaN:()=>ng,ZodMap:()=>T$,ZodMAC:()=>m$,ZodLiteral:()=>B$,ZodLazy:()=>eg,ZodKSUID:()=>pi,ZodJWT:()=>et,ZodIssueCode:()=>n4,ZodIntersection:()=>q$,ZodISOTime:()=>Hi,ZodISODuration:()=>Bi,ZodISODateTime:()=>Fi,ZodISODate:()=>Ti,ZodIPv6:()=>rt,ZodIPv4:()=>si,ZodGUID:()=>jn,ZodFunction:()=>gg,ZodFirstPartyTypeKind:()=>Ig,ZodFile:()=>M$,ZodExactOptional:()=>x$,ZodError:()=>sb,ZodEnum:()=>Zr,ZodEmoji:()=>fi,ZodEmail:()=>Ri,ZodE164:()=>vt,ZodDiscriminatedUnion:()=>X$,ZodDefault:()=>Z$,ZodDate:()=>Gn,ZodCustomStringFormat:()=>hr,ZodCustom:()=>Kn,ZodCodec:()=>qn,ZodCatch:()=>s$,ZodCUID2:()=>hi,ZodCUID:()=>Ci,ZodCIDRv6:()=>it,ZodCIDRv4:()=>nt,ZodBoolean:()=>ar,ZodBigIntFormat:()=>ut,ZodBigInt:()=>pr,ZodBase64URL:()=>ot,ZodBase64:()=>tt,ZodArray:()=>A$,ZodAny:()=>L$,TimePrecision:()=>Qe,NEVER:()=>Ut,$output:()=>Ae,$input:()=>Ve,$brand:()=>kt});var ir={};s(ir,{version:()=>jo,util:()=>k,treeifyError:()=>Lt,toJSONSchema:()=>Yi,toDotPath:()=>zg,safeParseAsync:()=>Wt,safeParse:()=>Gt,safeEncodeAsync:()=>nI,safeEncode:()=>sc,safeDecodeAsync:()=>iI,safeDecode:()=>rI,registry:()=>ui,regexes:()=>d,process:()=>P,prettifyError:()=>Et,parseAsync:()=>Tn,parse:()=>Fn,meta:()=>Du,locales:()=>Sn,isValidJWT:()=>xg,isValidBase64URL:()=>dg,isValidBase64:()=>Zo,initializeContext:()=>gr,globalRegistry:()=>X,globalConfig:()=>Ir,formatError:()=>$n,flattenError:()=>un,finalize:()=>cr,extractDefs:()=>lr,encodeAsync:()=>ac,encode:()=>hc,describe:()=>ku,decodeAsync:()=>pc,decode:()=>yc,createToJSONSchemaMethod:()=>Su,createStandardJSONSchemaMethod:()=>xr,config:()=>W,clone:()=>K,_xor:()=>Gb,_xid:()=>wi,_void:()=>uu,_uuidv7:()=>Ii,_uuidv6:()=>ci,_uuidv4:()=>li,_uuid:()=>gi,_url:()=>Nn,_uppercase:()=>Xr,_unknown:()=>vu,_union:()=>Eb,_undefined:()=>iu,_ulid:()=>Di,_uint64:()=>ru,_uint32:()=>Ce,_tuple:()=>Vb,_trim:()=>Tr,_transform:()=>Tb,_toUpperCase:()=>Br,_toLowerCase:()=>Hr,_templateLiteral:()=>Cb,_symbol:()=>nu,_superRefine:()=>Uu,_success:()=>xb,_stringbool:()=>wu,_stringFormat:()=>dr,_string:()=>qe,_startsWith:()=>Kr,_slugify:()=>Mr,_size:()=>Dr,_set:()=>Kb,_safeParseAsync:()=>Er,_safeParse:()=>Lr,_safeEncodeAsync:()=>fn,_safeEncode:()=>xn,_safeDecodeAsync:()=>Zn,_safeDecode:()=>Rn,_regex:()=>Ar,_refine:()=>_u,_record:()=>Xb,_readonly:()=>Zb,_property:()=>Vi,_promise:()=>yb,_positive:()=>Ei,_pipe:()=>fb,_parseAsync:()=>Jr,_parse:()=>Pr,_overwrite:()=>f,_optional:()=>Hb,_number:()=>Me,_nullable:()=>Bb,_null:()=>tu,_normalize:()=>Fr,_nonpositive:()=>Wi,_nonoptional:()=>db,_nonnegative:()=>Ai,_never:()=>eu,_negative:()=>Gi,_nativeEnum:()=>Qb,_nanoid:()=>_i,_nan:()=>lu,_multipleOf:()=>ur,_minSize:()=>a,_minLength:()=>nr,_min:()=>Q,_mime:()=>Qr,_maxSize:()=>$r,_maxLength:()=>wr,_max:()=>x,_map:()=>qb,_mac:()=>Ye,_lte:()=>x,_lt:()=>h,_lowercase:()=>Vr,_literal:()=>Fb,_length:()=>Sr,_lazy:()=>hb,_ksuid:()=>Si,_jwt:()=>Li,_isoTime:()=>He,_isoDuration:()=>Be,_isoDateTime:()=>Fe,_isoDate:()=>Te,_ipv6:()=>Ni,_ipv4:()=>mi,_intersection:()=>Ab,_int64:()=>se,_int32:()=>Ze,_int:()=>xe,_includes:()=>qr,_guid:()=>mn,_gte:()=>Q,_gt:()=>y,_float64:()=>fe,_float32:()=>Re,_file:()=>Iu,_enum:()=>Yb,_endsWith:()=>Yr,_encodeAsync:()=>Mn,_encode:()=>Hn,_emoji:()=>bi,_email:()=>$i,_e164:()=>Ji,_discriminatedUnion:()=>Wb,_default:()=>Mb,_decodeAsync:()=>dn,_decode:()=>Bn,_date:()=>$u,_custom:()=>bu,_cuid2:()=>ki,_cuid:()=>Ui,_coercedString:()=>Ke,_coercedNumber:()=>de,_coercedDate:()=>gu,_coercedBoolean:()=>ye,_coercedBigint:()=>pe,_cidrv6:()=>Oi,_cidrv4:()=>zi,_check:()=>sg,_catch:()=>Rb,_boolean:()=>he,_bigint:()=>ae,_base64url:()=>Pi,_base64:()=>ji,_array:()=>cu,_any:()=>ou,TimePrecision:()=>Qe,NEVER:()=>Ut,JSONSchemaGenerator:()=>t$,JSONSchema:()=>rl,Doc:()=>an,$output:()=>Ae,$input:()=>Ve,$constructor:()=>l,$brand:()=>kt,$ZodXor:()=>cv,$ZodXID:()=>Ko,$ZodVoid:()=>uv,$ZodUnknown:()=>vv,$ZodUnion:()=>bn,$ZodUndefined:()=>iv,$ZodUUID:()=>Lo,$ZodURL:()=>Go,$ZodULID:()=>qo,$ZodType:()=>z,$ZodTuple:()=>oi,$ZodTransform:()=>mv,$ZodTemplateLiteral:()=>Av,$ZodSymbol:()=>nv,$ZodSuccess:()=>Jv,$ZodStringFormat:()=>J,$ZodString:()=>kr,$ZodSet:()=>kv,$ZodRegistry:()=>Xe,$ZodRecord:()=>_v,$ZodRealError:()=>B,$ZodReadonly:()=>Wv,$ZodPromise:()=>Xv,$ZodPreprocess:()=>Gv,$ZodPrefault:()=>jv,$ZodPipe:()=>ei,$ZodOptional:()=>vi,$ZodObjectJIT:()=>lv,$ZodObject:()=>Zg,$ZodNumberFormat:()=>so,$ZodNumber:()=>ii,$ZodNullable:()=>zv,$ZodNull:()=>tv,$ZodNonOptional:()=>Pv,$ZodNever:()=>ev,$ZodNanoID:()=>Ao,$ZodNaN:()=>Ev,$ZodMap:()=>Uv,$ZodMAC:()=>xo,$ZodLiteral:()=>wv,$ZodLazy:()=>qv,$ZodKSUID:()=>Yo,$ZodJWT:()=>ao,$ZodIntersection:()=>bv,$ZodISOTime:()=>To,$ZodISODuration:()=>Ho,$ZodISODateTime:()=>Qo,$ZodISODate:()=>Fo,$ZodIPv6:()=>Mo,$ZodIPv4:()=>Bo,$ZodGUID:()=>Jo,$ZodFunction:()=>Vv,$ZodFile:()=>Sv,$ZodExactOptional:()=>Nv,$ZodError:()=>en,$ZodEnum:()=>Dv,$ZodEncodeError:()=>br,$ZodEmoji:()=>Wo,$ZodEmail:()=>Eo,$ZodE164:()=>yo,$ZodDiscriminatedUnion:()=>Iv,$ZodDefault:()=>Ov,$ZodDate:()=>$v,$ZodCustomStringFormat:()=>po,$ZodCustom:()=>Kv,$ZodCodec:()=>_n,$ZodCheckUpperCase:()=>Do,$ZodCheckStringFormat:()=>Gr,$ZodCheckStartsWith:()=>So,$ZodCheckSizeEquals:()=>co,$ZodCheckRegex:()=>Uo,$ZodCheckProperty:()=>No,$ZodCheckOverwrite:()=>Oo,$ZodCheckNumberFormat:()=>uo,$ZodCheckMultipleOf:()=>eo,$ZodCheckMinSize:()=>lo,$ZodCheckMinLength:()=>bo,$ZodCheckMimeType:()=>zo,$ZodCheckMaxSize:()=>go,$ZodCheckMaxLength:()=>Io,$ZodCheckLowerCase:()=>ko,$ZodCheckLessThan:()=>hn,$ZodCheckLengthEquals:()=>_o,$ZodCheckIncludes:()=>wo,$ZodCheckGreaterThan:()=>yn,$ZodCheckEndsWith:()=>mo,$ZodCheckBigIntFormat:()=>$o,$ZodCheck:()=>E,$ZodCatch:()=>Lv,$ZodCUID2:()=>Xo,$ZodCUID:()=>Vo,$ZodCIDRv6:()=>fo,$ZodCIDRv4:()=>Ro,$ZodBoolean:()=>In,$ZodBigIntFormat:()=>rv,$ZodBigInt:()=>ti,$ZodBase64URL:()=>ho,$ZodBase64:()=>Co,$ZodAsyncError:()=>C,$ZodArray:()=>gv,$ZodAny:()=>ov});var kg,Ut=Object.freeze({status:"aborted"});function l(n,i,o){function v(u,g){if(!u._zod)Object.defineProperty(u,"_zod",{value:{def:g,constr:e,traits:new Set},enumerable:!1});if(u._zod.traits.has(n))return;u._zod.traits.add(n),i(u,g);let $=e.prototype,c=Object.keys($);for(let b=0;b<c.length;b++){let S=c[b];if(!(S in u))u[S]=$[S].bind(u)}}let r=o?.Parent??Object;class t extends r{}Object.defineProperty(t,"name",{value:n});function e(u){var g;let $=o?.Parent?new t:this;v($,u),(g=$._zod).deferred??(g.deferred=[]);for(let c of $._zod.deferred)c();return $}return Object.defineProperty(e,"init",{value:v}),Object.defineProperty(e,Symbol.hasInstance,{value:(u)=>{if(o?.Parent&&u instanceof o.Parent)return!0;return u?._zod?.traits?.has(n)}}),Object.defineProperty(e,"name",{value:n}),e}var kt=Symbol("zod_brand");class C extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class br extends Error{constructor(n){super(`Encountered unidirectional transform during encode: ${n}`);this.name="ZodEncodeError"}}(kg=globalThis).__zod_globalConfig??(kg.__zod_globalConfig={});var Ir=globalThis.__zod_globalConfig;function W(n){if(n)Object.assign(Ir,n);return Ir}var k={};s(k,{unwrapMessage:()=>sr,uint8ArrayToHex:()=>Zc,uint8ArrayToBase64url:()=>Rc,uint8ArrayToBase64:()=>Sg,stringifyPrimitive:()=>_,slugify:()=>St,shallowClone:()=>Nt,safeExtend:()=>Tc,required:()=>Mc,randomString:()=>Vc,propertyKeyTypes:()=>tn,promiseAllObject:()=>Ac,primitiveTypes:()=>zt,prefixIssues:()=>H,pick:()=>Yc,partial:()=>Bc,parsedType:()=>U,optionalKeys:()=>Ot,omit:()=>Qc,objectClone:()=>Ec,numKeys:()=>Xc,nullish:()=>tr,normalizeParams:()=>w,mergeDefs:()=>rr,merge:()=>Hc,jsonStringifyReplacer:()=>zr,joinValues:()=>I,issue:()=>jr,isPlainObject:()=>vr,isObject:()=>_r,hexToUint8Array:()=>fc,getSizableOrigin:()=>on,getParsedType:()=>qc,getLengthableOrigin:()=>vn,getEnumValues:()=>rn,getElementAtPath:()=>Wc,floatSafeRemainder:()=>wt,finalizeIssue:()=>Y,extend:()=>Fc,explicitlyAborted:()=>Jt,escapeRegex:()=>R,esc:()=>Yn,defineLazy:()=>j,createTransparentProxy:()=>Kc,cloneDef:()=>Gc,clone:()=>K,cleanRegex:()=>nn,cleanEnum:()=>dc,captureStackTrace:()=>Qn,cached:()=>Or,base64urlToUint8Array:()=>xc,base64ToUint8Array:()=>wg,assignProp:()=>or,assertNotEqual:()=>jc,assertNever:()=>Jc,assertIs:()=>Pc,assertEqual:()=>Oc,assert:()=>Lc,allowsEval:()=>mt,aborted:()=>er,NUMBER_FORMAT_RANGES:()=>jt,Class:()=>mg,BIGINT_FORMAT_RANGES:()=>Pt});function Oc(n){return n}function jc(n){return n}function Pc(n){}function Jc(n){throw Error("Unexpected value in exhaustive check")}function Lc(n){}function rn(n){let i=Object.values(n).filter((v)=>typeof v==="number");return Object.entries(n).filter(([v,r])=>i.indexOf(+v)===-1).map(([v,r])=>r)}function I(n,i="|"){return n.map((o)=>_(o)).join(i)}function zr(n,i){if(typeof i==="bigint")return i.toString();return i}function Or(n){return{get value(){{let o=n();return Object.defineProperty(this,"value",{value:o}),o}throw Error("cached value already set")}}}function tr(n){return n===null||n===void 0}function nn(n){let i=n.startsWith("^")?1:0,o=n.endsWith("$")?n.length-1:n.length;return n.slice(i,o)}function wt(n,i){let o=n/i,v=Math.round(o),r=Number.EPSILON*Math.max(Math.abs(o),1);if(Math.abs(o-v)<r)return 0;return o-v}var Dg=Symbol("evaluating");function j(n,i,o){let v=void 0;Object.defineProperty(n,i,{get(){if(v===Dg)return;if(v===void 0)v=Dg,v=o();return v},set(r){Object.defineProperty(n,i,{value:r})},configurable:!0})}function Ec(n){return Object.create(Object.getPrototypeOf(n),Object.getOwnPropertyDescriptors(n))}function or(n,i,o){Object.defineProperty(n,i,{value:o,writable:!0,enumerable:!0,configurable:!0})}function rr(...n){let i={};for(let o of n){let v=Object.getOwnPropertyDescriptors(o);Object.assign(i,v)}return Object.defineProperties({},i)}function Gc(n){return rr(n._zod.def)}function Wc(n,i){if(!i)return n;return i.reduce((o,v)=>o?.[v],n)}function Ac(n){let i=Object.keys(n),o=i.map((v)=>n[v]);return Promise.all(o).then((v)=>{let r={};for(let t=0;t<i.length;t++)r[i[t]]=v[t];return r})}function Vc(n=10){let o="";for(let v=0;v<n;v++)o+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return o}function Yn(n){return JSON.stringify(n)}function St(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Qn="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function _r(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}var mt=Or(()=>{if(Ir.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(n){return!1}});function vr(n){if(_r(n)===!1)return!1;let i=n.constructor;if(i===void 0)return!0;if(typeof i!=="function")return!0;let o=i.prototype;if(_r(o)===!1)return!1;if(Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)return!1;return!0}function Nt(n){if(vr(n))return{...n};if(Array.isArray(n))return[...n];if(n instanceof Map)return new Map(n);if(n instanceof Set)return new Set(n);return n}function Xc(n){let i=0;for(let o in n)if(Object.prototype.hasOwnProperty.call(n,o))i++;return i}var qc=(n)=>{let i=typeof n;switch(i){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(n)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(n))return"array";if(n===null)return"null";if(n.then&&typeof n.then==="function"&&n.catch&&typeof n.catch==="function")return"promise";if(typeof Map<"u"&&n instanceof Map)return"map";if(typeof Set<"u"&&n instanceof Set)return"set";if(typeof Date<"u"&&n instanceof Date)return"date";if(typeof File<"u"&&n instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${i}`)}},tn=new Set(["string","number","symbol"]),zt=new Set(["string","number","bigint","boolean","symbol","undefined"]);function R(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function K(n,i,o){let v=new n._zod.constr(i??n._zod.def);if(!i||o?.parent)v._zod.parent=n;return v}function w(n){let i=n;if(!i)return{};if(typeof i==="string")return{error:()=>i};if(i?.message!==void 0){if(i?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");i.error=i.message}if(delete i.message,typeof i.error==="string")return{...i,error:()=>i.error};return i}function Kc(n){let i;return new Proxy({},{get(o,v,r){return i??(i=n()),Reflect.get(i,v,r)},set(o,v,r,t){return i??(i=n()),Reflect.set(i,v,r,t)},has(o,v){return i??(i=n()),Reflect.has(i,v)},deleteProperty(o,v){return i??(i=n()),Reflect.deleteProperty(i,v)},ownKeys(o){return i??(i=n()),Reflect.ownKeys(i)},getOwnPropertyDescriptor(o,v){return i??(i=n()),Reflect.getOwnPropertyDescriptor(i,v)},defineProperty(o,v,r){return i??(i=n()),Reflect.defineProperty(i,v,r)}})}function _(n){if(typeof n==="bigint")return n.toString()+"n";if(typeof n==="string")return`"${n}"`;return`${n}`}function Ot(n){return Object.keys(n).filter((i)=>{return n[i]._zod.optin==="optional"&&n[i]._zod.optout==="optional"})}var jt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Pt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Yc(n,i){let o=n._zod.def,v=o.checks;if(v&&v.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let t=rr(n._zod.def,{get shape(){let e={};for(let u in i){if(!(u in o.shape))throw Error(`Unrecognized key: "${u}"`);if(!i[u])continue;e[u]=o.shape[u]}return or(this,"shape",e),e},checks:[]});return K(n,t)}function Qc(n,i){let o=n._zod.def,v=o.checks;if(v&&v.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let t=rr(n._zod.def,{get shape(){let e={...n._zod.def.shape};for(let u in i){if(!(u in o.shape))throw Error(`Unrecognized key: "${u}"`);if(!i[u])continue;delete e[u]}return or(this,"shape",e),e},checks:[]});return K(n,t)}function Fc(n,i){if(!vr(i))throw Error("Invalid input to extend: expected a plain object");let o=n._zod.def.checks;if(o&&o.length>0){let t=n._zod.def.shape;for(let e in i)if(Object.getOwnPropertyDescriptor(t,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=rr(n._zod.def,{get shape(){let t={...n._zod.def.shape,...i};return or(this,"shape",t),t}});return K(n,r)}function Tc(n,i){if(!vr(i))throw Error("Invalid input to safeExtend: expected a plain object");let o=rr(n._zod.def,{get shape(){let v={...n._zod.def.shape,...i};return or(this,"shape",v),v}});return K(n,o)}function Hc(n,i){if(n._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let o=rr(n._zod.def,{get shape(){let v={...n._zod.def.shape,...i._zod.def.shape};return or(this,"shape",v),v},get catchall(){return i._zod.def.catchall},checks:i._zod.def.checks??[]});return K(n,o)}function Bc(n,i,o){let r=i._zod.def.checks;if(r&&r.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let e=rr(i._zod.def,{get shape(){let u=i._zod.def.shape,g={...u};if(o)for(let $ in o){if(!($ in u))throw Error(`Unrecognized key: "${$}"`);if(!o[$])continue;g[$]=n?new n({type:"optional",innerType:u[$]}):u[$]}else for(let $ in u)g[$]=n?new n({type:"optional",innerType:u[$]}):u[$];return or(this,"shape",g),g},checks:[]});return K(i,e)}function Mc(n,i,o){let v=rr(i._zod.def,{get shape(){let r=i._zod.def.shape,t={...r};if(o)for(let e in o){if(!(e in t))throw Error(`Unrecognized key: "${e}"`);if(!o[e])continue;t[e]=new n({type:"nonoptional",innerType:r[e]})}else for(let e in r)t[e]=new n({type:"nonoptional",innerType:r[e]});return or(this,"shape",t),t}});return K(i,v)}function er(n,i=0){if(n.aborted===!0)return!0;for(let o=i;o<n.issues.length;o++)if(n.issues[o]?.continue!==!0)return!0;return!1}function Jt(n,i=0){if(n.aborted===!0)return!0;for(let o=i;o<n.issues.length;o++)if(n.issues[o]?.continue===!1)return!0;return!1}function H(n,i){return i.map((o)=>{var v;return(v=o).path??(v.path=[]),o.path.unshift(n),o})}function sr(n){return typeof n==="string"?n:n?.message}function Y(n,i,o){let v=n.message?n.message:sr(n.inst?._zod.def?.error?.(n))??sr(i?.error?.(n))??sr(o.customError?.(n))??sr(o.localeError?.(n))??"Invalid input",{inst:r,continue:t,input:e,...u}=n;if(u.path??(u.path=[]),u.message=v,i?.reportInput)u.input=e;return u}function on(n){if(n instanceof Set)return"set";if(n instanceof Map)return"map";if(n instanceof File)return"file";return"unknown"}function vn(n){if(Array.isArray(n))return"array";if(typeof n==="string")return"string";return"unknown"}function U(n){let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"nan":"number";case"object":{if(n===null)return"null";if(Array.isArray(n))return"array";let o=n;if(o&&Object.getPrototypeOf(o)!==Object.prototype&&"constructor"in o&&o.constructor)return o.constructor.name}}return i}function jr(...n){let[i,o,v]=n;if(typeof i==="string")return{message:i,code:"custom",input:o,inst:v};return{...i}}function dc(n){return Object.entries(n).filter(([i,o])=>{return Number.isNaN(Number.parseInt(i,10))}).map((i)=>i[1])}function wg(n){let i=atob(n),o=new Uint8Array(i.length);for(let v=0;v<i.length;v++)o[v]=i.charCodeAt(v);return o}function Sg(n){let i="";for(let o=0;o<n.length;o++)i+=String.fromCharCode(n[o]);return btoa(i)}function xc(n){let i=n.replace(/-/g,"+").replace(/_/g,"/"),o="=".repeat((4-i.length%4)%4);return wg(i+o)}function Rc(n){return Sg(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function fc(n){let i=n.replace(/^0x/,"");if(i.length%2!==0)throw Error("Invalid hex string length");let o=new Uint8Array(i.length/2);for(let v=0;v<i.length;v+=2)o[v/2]=Number.parseInt(i.slice(v,v+2),16);return o}function Zc(n){return Array.from(n).map((i)=>i.toString(16).padStart(2,"0")).join("")}class mg{constructor(...n){}}var Ng=(n,i)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:i,enumerable:!1}),n.message=JSON.stringify(i,zr,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},en=l("$ZodError",Ng),B=l("$ZodError",Ng,{Parent:Error});function un(n,i=(o)=>o.message){let o={},v=[];for(let r of n.issues)if(r.path.length>0)o[r.path[0]]=o[r.path[0]]||[],o[r.path[0]].push(i(r));else v.push(i(r));return{formErrors:v,fieldErrors:o}}function $n(n,i=(o)=>o.message){let o={_errors:[]},v=(r,t=[])=>{for(let e of r.issues)if(e.code==="invalid_union"&&e.errors.length)e.errors.map((u)=>v({issues:u},[...t,...e.path]));else if(e.code==="invalid_key")v({issues:e.issues},[...t,...e.path]);else if(e.code==="invalid_element")v({issues:e.issues},[...t,...e.path]);else{let u=[...t,...e.path];if(u.length===0)o._errors.push(i(e));else{let g=o,$=0;while($<u.length){let c=u[$];if($!==u.length-1)g[c]=g[c]||{_errors:[]};else g[c]=g[c]||{_errors:[]},g[c]._errors.push(i(e));g=g[c],$++}}}};return v(n),o}function Lt(n,i=(o)=>o.message){let o={errors:[]},v=(r,t=[])=>{var e,u;for(let g of r.issues)if(g.code==="invalid_union"&&g.errors.length)g.errors.map(($)=>v({issues:$},[...t,...g.path]));else if(g.code==="invalid_key")v({issues:g.issues},[...t,...g.path]);else if(g.code==="invalid_element")v({issues:g.issues},[...t,...g.path]);else{let $=[...t,...g.path];if($.length===0){o.errors.push(i(g));continue}let c=o,b=0;while(b<$.length){let S=$[b],D=b===$.length-1;if(typeof S==="string")c.properties??(c.properties={}),(e=c.properties)[S]??(e[S]={errors:[]}),c=c.properties[S];else c.items??(c.items=[]),(u=c.items)[S]??(u[S]={errors:[]}),c=c.items[S];if(D)c.errors.push(i(g));b++}}};return v(n),o}function zg(n){let i=[],o=n.map((v)=>typeof v==="object"?v.key:v);for(let v of o)if(typeof v==="number")i.push(`[${v}]`);else if(typeof v==="symbol")i.push(`[${JSON.stringify(String(v))}]`);else if(/[^\w$]/.test(v))i.push(`[${JSON.stringify(v)}]`);else{if(i.length)i.push(".");i.push(v)}return i.join("")}function Et(n){let i=[],o=[...n.issues].sort((v,r)=>(v.path??[]).length-(r.path??[]).length);for(let v of o)if(i.push(`\u2716 ${v.message}`),v.path?.length)i.push(` \u2192 at ${zg(v.path)}`);return i.join(`
|
|
2
|
+
import{Mh as s}from"./vm-hands-entry-lite-a3n86qqm.js";var mc={};s(mc,{xor:()=>Zl,xid:()=>kl,void:()=>Bl,uuidv7:()=>$l,uuidv6:()=>ul,uuidv4:()=>el,uuid:()=>vl,util:()=>k,url:()=>gl,uppercase:()=>Xr,unknown:()=>mr,union:()=>gt,undefined:()=>Tl,ulid:()=>Ul,uint64:()=>Ql,uint32:()=>ql,tuple:()=>Q$,trim:()=>Tr,treeifyError:()=>Lt,transform:()=>ct,toUpperCase:()=>Br,toLowerCase:()=>Hr,toJSONSchema:()=>Yi,templateLiteral:()=>uc,symbol:()=>Fl,superRefine:()=>cg,success:()=>tc,stringbool:()=>Uc,stringFormat:()=>Ll,string:()=>On,strictObject:()=>Rl,startsWith:()=>Kr,slugify:()=>Mr,size:()=>Dr,setErrorMap:()=>i4,set:()=>pl,safeParseAsync:()=>c$,safeParse:()=>l$,safeEncodeAsync:()=>w$,safeEncode:()=>k$,safeDecodeAsync:()=>S$,safeDecode:()=>D$,registry:()=>ui,regexes:()=>d,regex:()=>Ar,refine:()=>lg,record:()=>F$,readonly:()=>og,property:()=>Vi,promise:()=>$c,prettifyError:()=>Et,preprocess:()=>Dc,prefault:()=>y$,positive:()=>Ei,pipe:()=>di,partialRecord:()=>hl,parseAsync:()=>g$,parse:()=>$$,overwrite:()=>f,optional:()=>Pn,object:()=>xl,number:()=>N$,nullish:()=>ic,nullable:()=>Jn,null:()=>J$,normalize:()=>Fr,nonpositive:()=>Wi,nonoptional:()=>a$,nonnegative:()=>Ai,never:()=>$t,negative:()=>Gi,nativeEnum:()=>sl,nanoid:()=>Il,nan:()=>oc,multipleOf:()=>ur,minSize:()=>a,minLength:()=>nr,mime:()=>Qr,meta:()=>bc,maxSize:()=>$r,maxLength:()=>wr,map:()=>al,mac:()=>Sl,lte:()=>x,lt:()=>h,lowercase:()=>Vr,looseRecord:()=>yl,looseObject:()=>fl,locales:()=>Sn,literal:()=>rc,length:()=>Sr,lazy:()=>ug,ksuid:()=>Dl,keyof:()=>dl,jwt:()=>Jl,json:()=>kc,iso:()=>Rr,ipv6:()=>ml,ipv4:()=>wl,invertCodec:()=>ec,intersection:()=>K$,int64:()=>Yl,int32:()=>Xl,int:()=>Mi,instanceof:()=>_c,includes:()=>qr,httpUrl:()=>ll,hostname:()=>El,hex:()=>Gl,hash:()=>Wl,guid:()=>ol,gte:()=>Q,gt:()=>y,globalRegistry:()=>X,getErrorMap:()=>t4,function:()=>gc,fromJSONSchema:()=>Sc,formatError:()=>$n,float64:()=>Vl,float32:()=>Al,flattenError:()=>un,file:()=>nc,exactOptional:()=>R$,enum:()=>lt,endsWith:()=>Yr,encodeAsync:()=>_$,encode:()=>I$,emoji:()=>cl,email:()=>tl,e164:()=>Pl,discriminatedUnion:()=>Cl,describe:()=>Ic,decodeAsync:()=>U$,decode:()=>b$,date:()=>Ml,custom:()=>cc,cuid2:()=>_l,cuid:()=>bl,core:()=>ir,config:()=>W,coerce:()=>bg,codec:()=>vc,clone:()=>K,cidrv6:()=>zl,cidrv4:()=>Nl,check:()=>lc,catch:()=>rg,boolean:()=>z$,bigint:()=>Kl,base64url:()=>jl,base64:()=>Ol,array:()=>Wn,any:()=>Hl,_function:()=>gc,_default:()=>C$,_ZodString:()=>xi,ZodXor:()=>V$,ZodXID:()=>ai,ZodVoid:()=>W$,ZodUnknown:()=>E$,ZodUnion:()=>Vn,ZodUndefined:()=>j$,ZodUUID:()=>p,ZodURL:()=>En,ZodULID:()=>yi,ZodType:()=>O,ZodTuple:()=>Y$,ZodTransform:()=>d$,ZodTemplateLiteral:()=>vg,ZodSymbol:()=>O$,ZodSuccess:()=>p$,ZodStringFormat:()=>L,ZodString:()=>Cr,ZodSet:()=>H$,ZodRecord:()=>fr,ZodRealError:()=>M,ZodReadonly:()=>tg,ZodPromise:()=>$g,ZodPreprocess:()=>ig,ZodPrefault:()=>h$,ZodPipe:()=>Xn,ZodOptional:()=>It,ZodObject:()=>An,ZodNumberFormat:()=>Nr,ZodNumber:()=>yr,ZodNullable:()=>f$,ZodNull:()=>P$,ZodNonOptional:()=>bt,ZodNever:()=>G$,ZodNanoID:()=>Zi,ZodNaN:()=>ng,ZodMap:()=>T$,ZodMAC:()=>m$,ZodLiteral:()=>B$,ZodLazy:()=>eg,ZodKSUID:()=>pi,ZodJWT:()=>et,ZodIssueCode:()=>n4,ZodIntersection:()=>q$,ZodISOTime:()=>Hi,ZodISODuration:()=>Bi,ZodISODateTime:()=>Fi,ZodISODate:()=>Ti,ZodIPv6:()=>rt,ZodIPv4:()=>si,ZodGUID:()=>jn,ZodFunction:()=>gg,ZodFirstPartyTypeKind:()=>Ig,ZodFile:()=>M$,ZodExactOptional:()=>x$,ZodError:()=>sb,ZodEnum:()=>Zr,ZodEmoji:()=>fi,ZodEmail:()=>Ri,ZodE164:()=>vt,ZodDiscriminatedUnion:()=>X$,ZodDefault:()=>Z$,ZodDate:()=>Gn,ZodCustomStringFormat:()=>hr,ZodCustom:()=>Kn,ZodCodec:()=>qn,ZodCatch:()=>s$,ZodCUID2:()=>hi,ZodCUID:()=>Ci,ZodCIDRv6:()=>it,ZodCIDRv4:()=>nt,ZodBoolean:()=>ar,ZodBigIntFormat:()=>ut,ZodBigInt:()=>pr,ZodBase64URL:()=>ot,ZodBase64:()=>tt,ZodArray:()=>A$,ZodAny:()=>L$,TimePrecision:()=>Qe,NEVER:()=>Ut,$output:()=>Ae,$input:()=>Ve,$brand:()=>kt});var ir={};s(ir,{version:()=>jo,util:()=>k,treeifyError:()=>Lt,toJSONSchema:()=>Yi,toDotPath:()=>zg,safeParseAsync:()=>Wt,safeParse:()=>Gt,safeEncodeAsync:()=>nI,safeEncode:()=>sc,safeDecodeAsync:()=>iI,safeDecode:()=>rI,registry:()=>ui,regexes:()=>d,process:()=>P,prettifyError:()=>Et,parseAsync:()=>Tn,parse:()=>Fn,meta:()=>Du,locales:()=>Sn,isValidJWT:()=>xg,isValidBase64URL:()=>dg,isValidBase64:()=>Zo,initializeContext:()=>gr,globalRegistry:()=>X,globalConfig:()=>Ir,formatError:()=>$n,flattenError:()=>un,finalize:()=>cr,extractDefs:()=>lr,encodeAsync:()=>ac,encode:()=>hc,describe:()=>ku,decodeAsync:()=>pc,decode:()=>yc,createToJSONSchemaMethod:()=>Su,createStandardJSONSchemaMethod:()=>xr,config:()=>W,clone:()=>K,_xor:()=>Gb,_xid:()=>wi,_void:()=>uu,_uuidv7:()=>Ii,_uuidv6:()=>ci,_uuidv4:()=>li,_uuid:()=>gi,_url:()=>Nn,_uppercase:()=>Xr,_unknown:()=>vu,_union:()=>Eb,_undefined:()=>iu,_ulid:()=>Di,_uint64:()=>ru,_uint32:()=>Ce,_tuple:()=>Vb,_trim:()=>Tr,_transform:()=>Tb,_toUpperCase:()=>Br,_toLowerCase:()=>Hr,_templateLiteral:()=>Cb,_symbol:()=>nu,_superRefine:()=>Uu,_success:()=>xb,_stringbool:()=>wu,_stringFormat:()=>dr,_string:()=>qe,_startsWith:()=>Kr,_slugify:()=>Mr,_size:()=>Dr,_set:()=>Kb,_safeParseAsync:()=>Er,_safeParse:()=>Lr,_safeEncodeAsync:()=>fn,_safeEncode:()=>xn,_safeDecodeAsync:()=>Zn,_safeDecode:()=>Rn,_regex:()=>Ar,_refine:()=>_u,_record:()=>Xb,_readonly:()=>Zb,_property:()=>Vi,_promise:()=>yb,_positive:()=>Ei,_pipe:()=>fb,_parseAsync:()=>Jr,_parse:()=>Pr,_overwrite:()=>f,_optional:()=>Hb,_number:()=>Me,_nullable:()=>Bb,_null:()=>tu,_normalize:()=>Fr,_nonpositive:()=>Wi,_nonoptional:()=>db,_nonnegative:()=>Ai,_never:()=>eu,_negative:()=>Gi,_nativeEnum:()=>Qb,_nanoid:()=>_i,_nan:()=>lu,_multipleOf:()=>ur,_minSize:()=>a,_minLength:()=>nr,_min:()=>Q,_mime:()=>Qr,_maxSize:()=>$r,_maxLength:()=>wr,_max:()=>x,_map:()=>qb,_mac:()=>Ye,_lte:()=>x,_lt:()=>h,_lowercase:()=>Vr,_literal:()=>Fb,_length:()=>Sr,_lazy:()=>hb,_ksuid:()=>Si,_jwt:()=>Li,_isoTime:()=>He,_isoDuration:()=>Be,_isoDateTime:()=>Fe,_isoDate:()=>Te,_ipv6:()=>Ni,_ipv4:()=>mi,_intersection:()=>Ab,_int64:()=>se,_int32:()=>Ze,_int:()=>xe,_includes:()=>qr,_guid:()=>mn,_gte:()=>Q,_gt:()=>y,_float64:()=>fe,_float32:()=>Re,_file:()=>Iu,_enum:()=>Yb,_endsWith:()=>Yr,_encodeAsync:()=>Mn,_encode:()=>Hn,_emoji:()=>bi,_email:()=>$i,_e164:()=>Ji,_discriminatedUnion:()=>Wb,_default:()=>Mb,_decodeAsync:()=>dn,_decode:()=>Bn,_date:()=>$u,_custom:()=>bu,_cuid2:()=>ki,_cuid:()=>Ui,_coercedString:()=>Ke,_coercedNumber:()=>de,_coercedDate:()=>gu,_coercedBoolean:()=>ye,_coercedBigint:()=>pe,_cidrv6:()=>Oi,_cidrv4:()=>zi,_check:()=>sg,_catch:()=>Rb,_boolean:()=>he,_bigint:()=>ae,_base64url:()=>Pi,_base64:()=>ji,_array:()=>cu,_any:()=>ou,TimePrecision:()=>Qe,NEVER:()=>Ut,JSONSchemaGenerator:()=>t$,JSONSchema:()=>rl,Doc:()=>an,$output:()=>Ae,$input:()=>Ve,$constructor:()=>l,$brand:()=>kt,$ZodXor:()=>cv,$ZodXID:()=>Ko,$ZodVoid:()=>uv,$ZodUnknown:()=>vv,$ZodUnion:()=>bn,$ZodUndefined:()=>iv,$ZodUUID:()=>Lo,$ZodURL:()=>Go,$ZodULID:()=>qo,$ZodType:()=>z,$ZodTuple:()=>oi,$ZodTransform:()=>mv,$ZodTemplateLiteral:()=>Av,$ZodSymbol:()=>nv,$ZodSuccess:()=>Jv,$ZodStringFormat:()=>J,$ZodString:()=>kr,$ZodSet:()=>kv,$ZodRegistry:()=>Xe,$ZodRecord:()=>_v,$ZodRealError:()=>B,$ZodReadonly:()=>Wv,$ZodPromise:()=>Xv,$ZodPreprocess:()=>Gv,$ZodPrefault:()=>jv,$ZodPipe:()=>ei,$ZodOptional:()=>vi,$ZodObjectJIT:()=>lv,$ZodObject:()=>Zg,$ZodNumberFormat:()=>so,$ZodNumber:()=>ii,$ZodNullable:()=>zv,$ZodNull:()=>tv,$ZodNonOptional:()=>Pv,$ZodNever:()=>ev,$ZodNanoID:()=>Ao,$ZodNaN:()=>Ev,$ZodMap:()=>Uv,$ZodMAC:()=>xo,$ZodLiteral:()=>wv,$ZodLazy:()=>qv,$ZodKSUID:()=>Yo,$ZodJWT:()=>ao,$ZodIntersection:()=>bv,$ZodISOTime:()=>To,$ZodISODuration:()=>Ho,$ZodISODateTime:()=>Qo,$ZodISODate:()=>Fo,$ZodIPv6:()=>Mo,$ZodIPv4:()=>Bo,$ZodGUID:()=>Jo,$ZodFunction:()=>Vv,$ZodFile:()=>Sv,$ZodExactOptional:()=>Nv,$ZodError:()=>en,$ZodEnum:()=>Dv,$ZodEncodeError:()=>br,$ZodEmoji:()=>Wo,$ZodEmail:()=>Eo,$ZodE164:()=>yo,$ZodDiscriminatedUnion:()=>Iv,$ZodDefault:()=>Ov,$ZodDate:()=>$v,$ZodCustomStringFormat:()=>po,$ZodCustom:()=>Kv,$ZodCodec:()=>_n,$ZodCheckUpperCase:()=>Do,$ZodCheckStringFormat:()=>Gr,$ZodCheckStartsWith:()=>So,$ZodCheckSizeEquals:()=>co,$ZodCheckRegex:()=>Uo,$ZodCheckProperty:()=>No,$ZodCheckOverwrite:()=>Oo,$ZodCheckNumberFormat:()=>uo,$ZodCheckMultipleOf:()=>eo,$ZodCheckMinSize:()=>lo,$ZodCheckMinLength:()=>bo,$ZodCheckMimeType:()=>zo,$ZodCheckMaxSize:()=>go,$ZodCheckMaxLength:()=>Io,$ZodCheckLowerCase:()=>ko,$ZodCheckLessThan:()=>hn,$ZodCheckLengthEquals:()=>_o,$ZodCheckIncludes:()=>wo,$ZodCheckGreaterThan:()=>yn,$ZodCheckEndsWith:()=>mo,$ZodCheckBigIntFormat:()=>$o,$ZodCheck:()=>E,$ZodCatch:()=>Lv,$ZodCUID2:()=>Xo,$ZodCUID:()=>Vo,$ZodCIDRv6:()=>fo,$ZodCIDRv4:()=>Ro,$ZodBoolean:()=>In,$ZodBigIntFormat:()=>rv,$ZodBigInt:()=>ti,$ZodBase64URL:()=>ho,$ZodBase64:()=>Co,$ZodAsyncError:()=>C,$ZodArray:()=>gv,$ZodAny:()=>ov});var kg,Ut=Object.freeze({status:"aborted"});function l(n,i,o){function v(u,g){if(!u._zod)Object.defineProperty(u,"_zod",{value:{def:g,constr:e,traits:new Set},enumerable:!1});if(u._zod.traits.has(n))return;u._zod.traits.add(n),i(u,g);let $=e.prototype,c=Object.keys($);for(let b=0;b<c.length;b++){let S=c[b];if(!(S in u))u[S]=$[S].bind(u)}}let r=o?.Parent??Object;class t extends r{}Object.defineProperty(t,"name",{value:n});function e(u){var g;let $=o?.Parent?new t:this;v($,u),(g=$._zod).deferred??(g.deferred=[]);for(let c of $._zod.deferred)c();return $}return Object.defineProperty(e,"init",{value:v}),Object.defineProperty(e,Symbol.hasInstance,{value:(u)=>{if(o?.Parent&&u instanceof o.Parent)return!0;return u?._zod?.traits?.has(n)}}),Object.defineProperty(e,"name",{value:n}),e}var kt=Symbol("zod_brand");class C extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class br extends Error{constructor(n){super(`Encountered unidirectional transform during encode: ${n}`);this.name="ZodEncodeError"}}(kg=globalThis).__zod_globalConfig??(kg.__zod_globalConfig={});var Ir=globalThis.__zod_globalConfig;function W(n){if(n)Object.assign(Ir,n);return Ir}var k={};s(k,{unwrapMessage:()=>sr,uint8ArrayToHex:()=>Zc,uint8ArrayToBase64url:()=>Rc,uint8ArrayToBase64:()=>Sg,stringifyPrimitive:()=>_,slugify:()=>St,shallowClone:()=>Nt,safeExtend:()=>Tc,required:()=>Mc,randomString:()=>Vc,propertyKeyTypes:()=>tn,promiseAllObject:()=>Ac,primitiveTypes:()=>zt,prefixIssues:()=>H,pick:()=>Yc,partial:()=>Bc,parsedType:()=>U,optionalKeys:()=>Ot,omit:()=>Qc,objectClone:()=>Ec,numKeys:()=>Xc,nullish:()=>tr,normalizeParams:()=>w,mergeDefs:()=>rr,merge:()=>Hc,jsonStringifyReplacer:()=>zr,joinValues:()=>I,issue:()=>jr,isPlainObject:()=>vr,isObject:()=>_r,hexToUint8Array:()=>fc,getSizableOrigin:()=>on,getParsedType:()=>qc,getLengthableOrigin:()=>vn,getEnumValues:()=>rn,getElementAtPath:()=>Wc,floatSafeRemainder:()=>wt,finalizeIssue:()=>Y,extend:()=>Fc,explicitlyAborted:()=>Jt,escapeRegex:()=>R,esc:()=>Yn,defineLazy:()=>j,createTransparentProxy:()=>Kc,cloneDef:()=>Gc,clone:()=>K,cleanRegex:()=>nn,cleanEnum:()=>dc,captureStackTrace:()=>Qn,cached:()=>Or,base64urlToUint8Array:()=>xc,base64ToUint8Array:()=>wg,assignProp:()=>or,assertNotEqual:()=>jc,assertNever:()=>Jc,assertIs:()=>Pc,assertEqual:()=>Oc,assert:()=>Lc,allowsEval:()=>mt,aborted:()=>er,NUMBER_FORMAT_RANGES:()=>jt,Class:()=>mg,BIGINT_FORMAT_RANGES:()=>Pt});function Oc(n){return n}function jc(n){return n}function Pc(n){}function Jc(n){throw Error("Unexpected value in exhaustive check")}function Lc(n){}function rn(n){let i=Object.values(n).filter((v)=>typeof v==="number");return Object.entries(n).filter(([v,r])=>i.indexOf(+v)===-1).map(([v,r])=>r)}function I(n,i="|"){return n.map((o)=>_(o)).join(i)}function zr(n,i){if(typeof i==="bigint")return i.toString();return i}function Or(n){return{get value(){{let o=n();return Object.defineProperty(this,"value",{value:o}),o}throw Error("cached value already set")}}}function tr(n){return n===null||n===void 0}function nn(n){let i=n.startsWith("^")?1:0,o=n.endsWith("$")?n.length-1:n.length;return n.slice(i,o)}function wt(n,i){let o=n/i,v=Math.round(o),r=Number.EPSILON*Math.max(Math.abs(o),1);if(Math.abs(o-v)<r)return 0;return o-v}var Dg=Symbol("evaluating");function j(n,i,o){let v=void 0;Object.defineProperty(n,i,{get(){if(v===Dg)return;if(v===void 0)v=Dg,v=o();return v},set(r){Object.defineProperty(n,i,{value:r})},configurable:!0})}function Ec(n){return Object.create(Object.getPrototypeOf(n),Object.getOwnPropertyDescriptors(n))}function or(n,i,o){Object.defineProperty(n,i,{value:o,writable:!0,enumerable:!0,configurable:!0})}function rr(...n){let i={};for(let o of n){let v=Object.getOwnPropertyDescriptors(o);Object.assign(i,v)}return Object.defineProperties({},i)}function Gc(n){return rr(n._zod.def)}function Wc(n,i){if(!i)return n;return i.reduce((o,v)=>o?.[v],n)}function Ac(n){let i=Object.keys(n),o=i.map((v)=>n[v]);return Promise.all(o).then((v)=>{let r={};for(let t=0;t<i.length;t++)r[i[t]]=v[t];return r})}function Vc(n=10){let o="";for(let v=0;v<n;v++)o+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return o}function Yn(n){return JSON.stringify(n)}function St(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Qn="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function _r(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}var mt=Or(()=>{if(Ir.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(n){return!1}});function vr(n){if(_r(n)===!1)return!1;let i=n.constructor;if(i===void 0)return!0;if(typeof i!=="function")return!0;let o=i.prototype;if(_r(o)===!1)return!1;if(Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)return!1;return!0}function Nt(n){if(vr(n))return{...n};if(Array.isArray(n))return[...n];if(n instanceof Map)return new Map(n);if(n instanceof Set)return new Set(n);return n}function Xc(n){let i=0;for(let o in n)if(Object.prototype.hasOwnProperty.call(n,o))i++;return i}var qc=(n)=>{let i=typeof n;switch(i){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(n)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(n))return"array";if(n===null)return"null";if(n.then&&typeof n.then==="function"&&n.catch&&typeof n.catch==="function")return"promise";if(typeof Map<"u"&&n instanceof Map)return"map";if(typeof Set<"u"&&n instanceof Set)return"set";if(typeof Date<"u"&&n instanceof Date)return"date";if(typeof File<"u"&&n instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${i}`)}},tn=new Set(["string","number","symbol"]),zt=new Set(["string","number","bigint","boolean","symbol","undefined"]);function R(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function K(n,i,o){let v=new n._zod.constr(i??n._zod.def);if(!i||o?.parent)v._zod.parent=n;return v}function w(n){let i=n;if(!i)return{};if(typeof i==="string")return{error:()=>i};if(i?.message!==void 0){if(i?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");i.error=i.message}if(delete i.message,typeof i.error==="string")return{...i,error:()=>i.error};return i}function Kc(n){let i;return new Proxy({},{get(o,v,r){return i??(i=n()),Reflect.get(i,v,r)},set(o,v,r,t){return i??(i=n()),Reflect.set(i,v,r,t)},has(o,v){return i??(i=n()),Reflect.has(i,v)},deleteProperty(o,v){return i??(i=n()),Reflect.deleteProperty(i,v)},ownKeys(o){return i??(i=n()),Reflect.ownKeys(i)},getOwnPropertyDescriptor(o,v){return i??(i=n()),Reflect.getOwnPropertyDescriptor(i,v)},defineProperty(o,v,r){return i??(i=n()),Reflect.defineProperty(i,v,r)}})}function _(n){if(typeof n==="bigint")return n.toString()+"n";if(typeof n==="string")return`"${n}"`;return`${n}`}function Ot(n){return Object.keys(n).filter((i)=>{return n[i]._zod.optin==="optional"&&n[i]._zod.optout==="optional"})}var jt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Pt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Yc(n,i){let o=n._zod.def,v=o.checks;if(v&&v.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let t=rr(n._zod.def,{get shape(){let e={};for(let u in i){if(!(u in o.shape))throw Error(`Unrecognized key: "${u}"`);if(!i[u])continue;e[u]=o.shape[u]}return or(this,"shape",e),e},checks:[]});return K(n,t)}function Qc(n,i){let o=n._zod.def,v=o.checks;if(v&&v.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let t=rr(n._zod.def,{get shape(){let e={...n._zod.def.shape};for(let u in i){if(!(u in o.shape))throw Error(`Unrecognized key: "${u}"`);if(!i[u])continue;delete e[u]}return or(this,"shape",e),e},checks:[]});return K(n,t)}function Fc(n,i){if(!vr(i))throw Error("Invalid input to extend: expected a plain object");let o=n._zod.def.checks;if(o&&o.length>0){let t=n._zod.def.shape;for(let e in i)if(Object.getOwnPropertyDescriptor(t,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=rr(n._zod.def,{get shape(){let t={...n._zod.def.shape,...i};return or(this,"shape",t),t}});return K(n,r)}function Tc(n,i){if(!vr(i))throw Error("Invalid input to safeExtend: expected a plain object");let o=rr(n._zod.def,{get shape(){let v={...n._zod.def.shape,...i};return or(this,"shape",v),v}});return K(n,o)}function Hc(n,i){if(n._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let o=rr(n._zod.def,{get shape(){let v={...n._zod.def.shape,...i._zod.def.shape};return or(this,"shape",v),v},get catchall(){return i._zod.def.catchall},checks:i._zod.def.checks??[]});return K(n,o)}function Bc(n,i,o){let r=i._zod.def.checks;if(r&&r.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let e=rr(i._zod.def,{get shape(){let u=i._zod.def.shape,g={...u};if(o)for(let $ in o){if(!($ in u))throw Error(`Unrecognized key: "${$}"`);if(!o[$])continue;g[$]=n?new n({type:"optional",innerType:u[$]}):u[$]}else for(let $ in u)g[$]=n?new n({type:"optional",innerType:u[$]}):u[$];return or(this,"shape",g),g},checks:[]});return K(i,e)}function Mc(n,i,o){let v=rr(i._zod.def,{get shape(){let r=i._zod.def.shape,t={...r};if(o)for(let e in o){if(!(e in t))throw Error(`Unrecognized key: "${e}"`);if(!o[e])continue;t[e]=new n({type:"nonoptional",innerType:r[e]})}else for(let e in r)t[e]=new n({type:"nonoptional",innerType:r[e]});return or(this,"shape",t),t}});return K(i,v)}function er(n,i=0){if(n.aborted===!0)return!0;for(let o=i;o<n.issues.length;o++)if(n.issues[o]?.continue!==!0)return!0;return!1}function Jt(n,i=0){if(n.aborted===!0)return!0;for(let o=i;o<n.issues.length;o++)if(n.issues[o]?.continue===!1)return!0;return!1}function H(n,i){return i.map((o)=>{var v;return(v=o).path??(v.path=[]),o.path.unshift(n),o})}function sr(n){return typeof n==="string"?n:n?.message}function Y(n,i,o){let v=n.message?n.message:sr(n.inst?._zod.def?.error?.(n))??sr(i?.error?.(n))??sr(o.customError?.(n))??sr(o.localeError?.(n))??"Invalid input",{inst:r,continue:t,input:e,...u}=n;if(u.path??(u.path=[]),u.message=v,i?.reportInput)u.input=e;return u}function on(n){if(n instanceof Set)return"set";if(n instanceof Map)return"map";if(n instanceof File)return"file";return"unknown"}function vn(n){if(Array.isArray(n))return"array";if(typeof n==="string")return"string";return"unknown"}function U(n){let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"nan":"number";case"object":{if(n===null)return"null";if(Array.isArray(n))return"array";let o=n;if(o&&Object.getPrototypeOf(o)!==Object.prototype&&"constructor"in o&&o.constructor)return o.constructor.name}}return i}function jr(...n){let[i,o,v]=n;if(typeof i==="string")return{message:i,code:"custom",input:o,inst:v};return{...i}}function dc(n){return Object.entries(n).filter(([i,o])=>{return Number.isNaN(Number.parseInt(i,10))}).map((i)=>i[1])}function wg(n){let i=atob(n),o=new Uint8Array(i.length);for(let v=0;v<i.length;v++)o[v]=i.charCodeAt(v);return o}function Sg(n){let i="";for(let o=0;o<n.length;o++)i+=String.fromCharCode(n[o]);return btoa(i)}function xc(n){let i=n.replace(/-/g,"+").replace(/_/g,"/"),o="=".repeat((4-i.length%4)%4);return wg(i+o)}function Rc(n){return Sg(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function fc(n){let i=n.replace(/^0x/,"");if(i.length%2!==0)throw Error("Invalid hex string length");let o=new Uint8Array(i.length/2);for(let v=0;v<i.length;v+=2)o[v/2]=Number.parseInt(i.slice(v,v+2),16);return o}function Zc(n){return Array.from(n).map((i)=>i.toString(16).padStart(2,"0")).join("")}class mg{constructor(...n){}}var Ng=(n,i)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:i,enumerable:!1}),n.message=JSON.stringify(i,zr,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},en=l("$ZodError",Ng),B=l("$ZodError",Ng,{Parent:Error});function un(n,i=(o)=>o.message){let o={},v=[];for(let r of n.issues)if(r.path.length>0)o[r.path[0]]=o[r.path[0]]||[],o[r.path[0]].push(i(r));else v.push(i(r));return{formErrors:v,fieldErrors:o}}function $n(n,i=(o)=>o.message){let o={_errors:[]},v=(r,t=[])=>{for(let e of r.issues)if(e.code==="invalid_union"&&e.errors.length)e.errors.map((u)=>v({issues:u},[...t,...e.path]));else if(e.code==="invalid_key")v({issues:e.issues},[...t,...e.path]);else if(e.code==="invalid_element")v({issues:e.issues},[...t,...e.path]);else{let u=[...t,...e.path];if(u.length===0)o._errors.push(i(e));else{let g=o,$=0;while($<u.length){let c=u[$];if($!==u.length-1)g[c]=g[c]||{_errors:[]};else g[c]=g[c]||{_errors:[]},g[c]._errors.push(i(e));g=g[c],$++}}}};return v(n),o}function Lt(n,i=(o)=>o.message){let o={errors:[]},v=(r,t=[])=>{var e,u;for(let g of r.issues)if(g.code==="invalid_union"&&g.errors.length)g.errors.map(($)=>v({issues:$},[...t,...g.path]));else if(g.code==="invalid_key")v({issues:g.issues},[...t,...g.path]);else if(g.code==="invalid_element")v({issues:g.issues},[...t,...g.path]);else{let $=[...t,...g.path];if($.length===0){o.errors.push(i(g));continue}let c=o,b=0;while(b<$.length){let S=$[b],D=b===$.length-1;if(typeof S==="string")c.properties??(c.properties={}),(e=c.properties)[S]??(e[S]={errors:[]}),c=c.properties[S];else c.items??(c.items=[]),(u=c.items)[S]??(u[S]={errors:[]}),c=c.items[S];if(D)c.errors.push(i(g));b++}}};return v(n),o}function zg(n){let i=[],o=n.map((v)=>typeof v==="object"?v.key:v);for(let v of o)if(typeof v==="number")i.push(`[${v}]`);else if(typeof v==="symbol")i.push(`[${JSON.stringify(String(v))}]`);else if(/[^\w$]/.test(v))i.push(`[${JSON.stringify(v)}]`);else{if(i.length)i.push(".");i.push(v)}return i.join("")}function Et(n){let i=[],o=[...n.issues].sort((v,r)=>(v.path??[]).length-(r.path??[]).length);for(let v of o)if(i.push(`\u2716 ${v.message}`),v.path?.length)i.push(` \u2192 at ${zg(v.path)}`);return i.join(`
|
|
3
3
|
`)}var Pr=(n)=>(i,o,v,r)=>{let t=v?{...v,async:!1}:{async:!1},e=i._zod.run({value:o,issues:[]},t);if(e instanceof Promise)throw new C;if(e.issues.length){let u=new(r?.Err??n)(e.issues.map((g)=>Y(g,t,W())));throw Qn(u,r?.callee),u}return e.value},Fn=Pr(B),Jr=(n)=>async(i,o,v,r)=>{let t=v?{...v,async:!0}:{async:!0},e=i._zod.run({value:o,issues:[]},t);if(e instanceof Promise)e=await e;if(e.issues.length){let u=new(r?.Err??n)(e.issues.map((g)=>Y(g,t,W())));throw Qn(u,r?.callee),u}return e.value},Tn=Jr(B),Lr=(n)=>(i,o,v)=>{let r=v?{...v,async:!1}:{async:!1},t=i._zod.run({value:o,issues:[]},r);if(t instanceof Promise)throw new C;return t.issues.length?{success:!1,error:new(n??en)(t.issues.map((e)=>Y(e,r,W())))}:{success:!0,data:t.value}},Gt=Lr(B),Er=(n)=>async(i,o,v)=>{let r=v?{...v,async:!0}:{async:!0},t=i._zod.run({value:o,issues:[]},r);if(t instanceof Promise)t=await t;return t.issues.length?{success:!1,error:new n(t.issues.map((e)=>Y(e,r,W())))}:{success:!0,data:t.value}},Wt=Er(B),Hn=(n)=>(i,o,v)=>{let r=v?{...v,direction:"backward"}:{direction:"backward"};return Pr(n)(i,o,r)},hc=Hn(B),Bn=(n)=>(i,o,v)=>{return Pr(n)(i,o,v)},yc=Bn(B),Mn=(n)=>async(i,o,v)=>{let r=v?{...v,direction:"backward"}:{direction:"backward"};return Jr(n)(i,o,r)},ac=Mn(B),dn=(n)=>async(i,o,v)=>{return Jr(n)(i,o,v)},pc=dn(B),xn=(n)=>(i,o,v)=>{let r=v?{...v,direction:"backward"}:{direction:"backward"};return Lr(n)(i,o,r)},sc=xn(B),Rn=(n)=>(i,o,v)=>{return Lr(n)(i,o,v)},rI=Rn(B),fn=(n)=>async(i,o,v)=>{let r=v?{...v,direction:"backward"}:{direction:"backward"};return Er(n)(i,o,r)},nI=fn(B),Zn=(n)=>async(i,o,v)=>{return Er(n)(i,o,v)},iI=Zn(B);var d={};s(d,{xid:()=>qt,uuid7:()=>eI,uuid6:()=>vI,uuid4:()=>oI,uuid:()=>Ur,uppercase:()=>vo,unicodeEmail:()=>Og,undefined:()=>to,ulid:()=>Xt,time:()=>yt,string:()=>pt,sha512_hex:()=>LI,sha512_base64url:()=>GI,sha512_base64:()=>EI,sha384_hex:()=>jI,sha384_base64url:()=>JI,sha384_base64:()=>PI,sha256_hex:()=>NI,sha256_base64url:()=>OI,sha256_base64:()=>zI,sha1_hex:()=>wI,sha1_base64url:()=>mI,sha1_base64:()=>SI,rfc5322Email:()=>$I,number:()=>gn,null:()=>io,nanoid:()=>Yt,md5_hex:()=>UI,md5_base64url:()=>DI,md5_base64:()=>kI,mac:()=>dt,lowercase:()=>oo,ksuid:()=>Kt,ipv6:()=>Mt,ipv4:()=>Bt,integer:()=>ro,idnEmail:()=>gI,httpProtocol:()=>Zt,html5Email:()=>uI,hostname:()=>II,hex:()=>_I,guid:()=>Ft,extendedDuration:()=>tI,emoji:()=>Ht,email:()=>Tt,e164:()=>Ct,duration:()=>Qt,domain:()=>bI,datetime:()=>at,date:()=>ht,cuid2:()=>Vt,cuid:()=>At,cidrv6:()=>Rt,cidrv4:()=>xt,browserEmail:()=>lI,boolean:()=>no,bigint:()=>st,base64url:()=>Cn,base64:()=>ft});var At=/^[cC][0-9a-z]{6,}$/,Vt=/^[0-9a-z]+$/,Xt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,qt=/^[0-9a-vA-V]{20}$/,Kt=/^[A-Za-z0-9]{27}$/,Yt=/^[a-zA-Z0-9_-]{21}$/,Qt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tI=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ft=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ur=(n)=>{if(!n)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},oI=Ur(4),vI=Ur(6),eI=Ur(7),Tt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,uI=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,$I=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Og=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,gI=Og,lI=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,cI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Ht(){return new RegExp(cI,"u")}var Bt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Mt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,dt=(n)=>{let i=R(n??":");return new RegExp(`^(?:[0-9A-F]{2}${i}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${i}){5}[0-9a-f]{2}$`)},xt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Rt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ft=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Cn=/^[A-Za-z0-9_-]*$/,II=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,bI=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Zt=/^https?$/,Ct=/^\+[1-9]\d{6,14}$/,jg="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",ht=new RegExp(`^${jg}$`);function Pg(n){return typeof n.precision==="number"?n.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":n.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${n.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function yt(n){return new RegExp(`^${Pg(n)}$`)}function at(n){let i=Pg({precision:n.precision}),o=["Z"];if(n.local)o.push("");if(n.offset)o.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let v=`${i}(?:${o.join("|")})`;return new RegExp(`^${jg}T(?:${v})$`)}var pt=(n)=>{let i=n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${i}$`)},st=/^-?\d+n?$/,ro=/^-?\d+$/,gn=/^-?\d+(?:\.\d+)?$/,no=/^(?:true|false)$/i,io=/^null$/i;var to=/^undefined$/i;var oo=/^[^A-Z]*$/,vo=/^[^a-z]*$/,_I=/^[0-9a-fA-F]*$/;function ln(n,i){return new RegExp(`^[A-Za-z0-9+/]{${n}}${i}$`)}function cn(n){return new RegExp(`^[A-Za-z0-9_-]{${n}}$`)}var UI=/^[0-9a-fA-F]{32}$/,kI=ln(22,"=="),DI=cn(22),wI=/^[0-9a-fA-F]{40}$/,SI=ln(27,"="),mI=cn(27),NI=/^[0-9a-fA-F]{64}$/,zI=ln(43,"="),OI=cn(43),jI=/^[0-9a-fA-F]{96}$/,PI=ln(64,""),JI=cn(64),LI=/^[0-9a-fA-F]{128}$/,EI=ln(86,"=="),GI=cn(86);var E=l("$ZodCheck",(n,i)=>{var o;n._zod??(n._zod={}),n._zod.def=i,(o=n._zod).onattach??(o.onattach=[])}),Lg={number:"number",bigint:"bigint",object:"date"},hn=l("$ZodCheckLessThan",(n,i)=>{E.init(n,i);let o=Lg[typeof i.value];n._zod.onattach.push((v)=>{let r=v._zod.bag,t=(i.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(i.value<t)if(i.inclusive)r.maximum=i.value;else r.exclusiveMaximum=i.value}),n._zod.check=(v)=>{if(i.inclusive?v.value<=i.value:v.value<i.value)return;v.issues.push({origin:o,code:"too_big",maximum:typeof i.value==="object"?i.value.getTime():i.value,input:v.value,inclusive:i.inclusive,inst:n,continue:!i.abort})}}),yn=l("$ZodCheckGreaterThan",(n,i)=>{E.init(n,i);let o=Lg[typeof i.value];n._zod.onattach.push((v)=>{let r=v._zod.bag,t=(i.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(i.value>t)if(i.inclusive)r.minimum=i.value;else r.exclusiveMinimum=i.value}),n._zod.check=(v)=>{if(i.inclusive?v.value>=i.value:v.value>i.value)return;v.issues.push({origin:o,code:"too_small",minimum:typeof i.value==="object"?i.value.getTime():i.value,input:v.value,inclusive:i.inclusive,inst:n,continue:!i.abort})}}),eo=l("$ZodCheckMultipleOf",(n,i)=>{E.init(n,i),n._zod.onattach.push((o)=>{var v;(v=o._zod.bag).multipleOf??(v.multipleOf=i.value)}),n._zod.check=(o)=>{if(typeof o.value!==typeof i.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof o.value==="bigint"?o.value%i.value===BigInt(0):wt(o.value,i.value)===0)return;o.issues.push({origin:typeof o.value,code:"not_multiple_of",divisor:i.value,input:o.value,inst:n,continue:!i.abort})}}),uo=l("$ZodCheckNumberFormat",(n,i)=>{E.init(n,i),i.format=i.format||"float64";let o=i.format?.includes("int"),v=o?"int":"number",[r,t]=jt[i.format];n._zod.onattach.push((e)=>{let u=e._zod.bag;if(u.format=i.format,u.minimum=r,u.maximum=t,o)u.pattern=ro}),n._zod.check=(e)=>{let u=e.value;if(o){if(!Number.isInteger(u)){e.issues.push({expected:v,format:i.format,code:"invalid_type",continue:!1,input:u,inst:n});return}if(!Number.isSafeInteger(u)){if(u>0)e.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:v,inclusive:!0,continue:!i.abort});else e.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:v,inclusive:!0,continue:!i.abort});return}}if(u<r)e.issues.push({origin:"number",input:u,code:"too_small",minimum:r,inclusive:!0,inst:n,continue:!i.abort});if(u>t)e.issues.push({origin:"number",input:u,code:"too_big",maximum:t,inclusive:!0,inst:n,continue:!i.abort})}}),$o=l("$ZodCheckBigIntFormat",(n,i)=>{E.init(n,i);let[o,v]=Pt[i.format];n._zod.onattach.push((r)=>{let t=r._zod.bag;t.format=i.format,t.minimum=o,t.maximum=v}),n._zod.check=(r)=>{let t=r.value;if(t<o)r.issues.push({origin:"bigint",input:t,code:"too_small",minimum:o,inclusive:!0,inst:n,continue:!i.abort});if(t>v)r.issues.push({origin:"bigint",input:t,code:"too_big",maximum:v,inclusive:!0,inst:n,continue:!i.abort})}}),go=l("$ZodCheckMaxSize",(n,i)=>{var o;E.init(n,i),(o=n._zod.def).when??(o.when=(v)=>{let r=v.value;return!tr(r)&&r.size!==void 0}),n._zod.onattach.push((v)=>{let r=v._zod.bag.maximum??Number.POSITIVE_INFINITY;if(i.maximum<r)v._zod.bag.maximum=i.maximum}),n._zod.check=(v)=>{let r=v.value;if(r.size<=i.maximum)return;v.issues.push({origin:on(r),code:"too_big",maximum:i.maximum,inclusive:!0,input:r,inst:n,continue:!i.abort})}}),lo=l("$ZodCheckMinSize",(n,i)=>{var o;E.init(n,i),(o=n._zod.def).when??(o.when=(v)=>{let r=v.value;return!tr(r)&&r.size!==void 0}),n._zod.onattach.push((v)=>{let r=v._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(i.minimum>r)v._zod.bag.minimum=i.minimum}),n._zod.check=(v)=>{let r=v.value;if(r.size>=i.minimum)return;v.issues.push({origin:on(r),code:"too_small",minimum:i.minimum,inclusive:!0,input:r,inst:n,continue:!i.abort})}}),co=l("$ZodCheckSizeEquals",(n,i)=>{var o;E.init(n,i),(o=n._zod.def).when??(o.when=(v)=>{let r=v.value;return!tr(r)&&r.size!==void 0}),n._zod.onattach.push((v)=>{let r=v._zod.bag;r.minimum=i.size,r.maximum=i.size,r.size=i.size}),n._zod.check=(v)=>{let r=v.value,t=r.size;if(t===i.size)return;let e=t>i.size;v.issues.push({origin:on(r),...e?{code:"too_big",maximum:i.size}:{code:"too_small",minimum:i.size},inclusive:!0,exact:!0,input:v.value,inst:n,continue:!i.abort})}}),Io=l("$ZodCheckMaxLength",(n,i)=>{var o;E.init(n,i),(o=n._zod.def).when??(o.when=(v)=>{let r=v.value;return!tr(r)&&r.length!==void 0}),n._zod.onattach.push((v)=>{let r=v._zod.bag.maximum??Number.POSITIVE_INFINITY;if(i.maximum<r)v._zod.bag.maximum=i.maximum}),n._zod.check=(v)=>{let r=v.value;if(r.length<=i.maximum)return;let e=vn(r);v.issues.push({origin:e,code:"too_big",maximum:i.maximum,inclusive:!0,input:r,inst:n,continue:!i.abort})}}),bo=l("$ZodCheckMinLength",(n,i)=>{var o;E.init(n,i),(o=n._zod.def).when??(o.when=(v)=>{let r=v.value;return!tr(r)&&r.length!==void 0}),n._zod.onattach.push((v)=>{let r=v._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(i.minimum>r)v._zod.bag.minimum=i.minimum}),n._zod.check=(v)=>{let r=v.value;if(r.length>=i.minimum)return;let e=vn(r);v.issues.push({origin:e,code:"too_small",minimum:i.minimum,inclusive:!0,input:r,inst:n,continue:!i.abort})}}),_o=l("$ZodCheckLengthEquals",(n,i)=>{var o;E.init(n,i),(o=n._zod.def).when??(o.when=(v)=>{let r=v.value;return!tr(r)&&r.length!==void 0}),n._zod.onattach.push((v)=>{let r=v._zod.bag;r.minimum=i.length,r.maximum=i.length,r.length=i.length}),n._zod.check=(v)=>{let r=v.value,t=r.length;if(t===i.length)return;let e=vn(r),u=t>i.length;v.issues.push({origin:e,...u?{code:"too_big",maximum:i.length}:{code:"too_small",minimum:i.length},inclusive:!0,exact:!0,input:v.value,inst:n,continue:!i.abort})}}),Gr=l("$ZodCheckStringFormat",(n,i)=>{var o,v;if(E.init(n,i),n._zod.onattach.push((r)=>{let t=r._zod.bag;if(t.format=i.format,i.pattern)t.patterns??(t.patterns=new Set),t.patterns.add(i.pattern)}),i.pattern)(o=n._zod).check??(o.check=(r)=>{if(i.pattern.lastIndex=0,i.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:i.format,input:r.value,...i.pattern?{pattern:i.pattern.toString()}:{},inst:n,continue:!i.abort})});else(v=n._zod).check??(v.check=()=>{})}),Uo=l("$ZodCheckRegex",(n,i)=>{Gr.init(n,i),n._zod.check=(o)=>{if(i.pattern.lastIndex=0,i.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:"regex",input:o.value,pattern:i.pattern.toString(),inst:n,continue:!i.abort})}}),ko=l("$ZodCheckLowerCase",(n,i)=>{i.pattern??(i.pattern=oo),Gr.init(n,i)}),Do=l("$ZodCheckUpperCase",(n,i)=>{i.pattern??(i.pattern=vo),Gr.init(n,i)}),wo=l("$ZodCheckIncludes",(n,i)=>{E.init(n,i);let o=R(i.includes),v=new RegExp(typeof i.position==="number"?`^.{${i.position}}${o}`:o);i.pattern=v,n._zod.onattach.push((r)=>{let t=r._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(v)}),n._zod.check=(r)=>{if(r.value.includes(i.includes,i.position))return;r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:i.includes,input:r.value,inst:n,continue:!i.abort})}}),So=l("$ZodCheckStartsWith",(n,i)=>{E.init(n,i);let o=new RegExp(`^${R(i.prefix)}.*`);i.pattern??(i.pattern=o),n._zod.onattach.push((v)=>{let r=v._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(o)}),n._zod.check=(v)=>{if(v.value.startsWith(i.prefix))return;v.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:i.prefix,input:v.value,inst:n,continue:!i.abort})}}),mo=l("$ZodCheckEndsWith",(n,i)=>{E.init(n,i);let o=new RegExp(`.*${R(i.suffix)}$`);i.pattern??(i.pattern=o),n._zod.onattach.push((v)=>{let r=v._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(o)}),n._zod.check=(v)=>{if(v.value.endsWith(i.suffix))return;v.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:i.suffix,input:v.value,inst:n,continue:!i.abort})}});function Jg(n,i,o){if(n.issues.length)i.issues.push(...H(o,n.issues))}var No=l("$ZodCheckProperty",(n,i)=>{E.init(n,i),n._zod.check=(o)=>{let v=i.schema._zod.run({value:o.value[i.property],issues:[]},{});if(v instanceof Promise)return v.then((r)=>Jg(r,o,i.property));Jg(v,o,i.property);return}}),zo=l("$ZodCheckMimeType",(n,i)=>{E.init(n,i);let o=new Set(i.mime);n._zod.onattach.push((v)=>{v._zod.bag.mime=i.mime}),n._zod.check=(v)=>{if(o.has(v.value.type))return;v.issues.push({code:"invalid_value",values:i.mime,input:v.value.type,inst:n,continue:!i.abort})}}),Oo=l("$ZodCheckOverwrite",(n,i)=>{E.init(n,i),n._zod.check=(o)=>{o.value=i.tx(o.value)}});class an{constructor(n=[]){if(this.content=[],this.indent=0,this)this.args=n}indented(n){this.indent+=1,n(this),this.indent-=1}write(n){if(typeof n==="function"){n(this,{execution:"sync"}),n(this,{execution:"async"});return}let o=n.split(`
|
|
4
4
|
`).filter((t)=>t),v=Math.min(...o.map((t)=>t.length-t.trimStart().length)),r=o.map((t)=>t.slice(v)).map((t)=>" ".repeat(this.indent*2)+t);for(let t of r)this.content.push(t)}compile(){let n=Function,i=this?.args,v=[...(this?.content??[""]).map((r)=>` ${r}`)];return new n(...i,v.join(`
|
|
5
5
|
`))}}var jo={major:4,minor:4,patch:3};var z=l("$ZodType",(n,i)=>{var o;n??(n={}),n._zod.def=i,n._zod.bag=n._zod.bag||{},n._zod.version=jo;let v=[...n._zod.def.checks??[]];if(n._zod.traits.has("$ZodCheck"))v.unshift(n);for(let r of v)for(let t of r._zod.onattach)t(n);if(v.length===0)(o=n._zod).deferred??(o.deferred=[]),n._zod.deferred?.push(()=>{n._zod.run=n._zod.parse});else{let r=(e,u,g)=>{let $=er(e),c;for(let b of u){if(b._zod.def.when){if(Jt(e))continue;if(!b._zod.def.when(e))continue}else if($)continue;let S=e.issues.length,D=b._zod.check(e);if(D instanceof Promise&&g?.async===!1)throw new C;if(c||D instanceof Promise)c=(c??Promise.resolve()).then(async()=>{if(await D,e.issues.length===S)return;if(!$)$=er(e,S)});else{if(e.issues.length===S)continue;if(!$)$=er(e,S)}}if(c)return c.then(()=>{return e});return e},t=(e,u,g)=>{if(er(e))return e.aborted=!0,e;let $=r(u,v,g);if($ instanceof Promise){if(g.async===!1)throw new C;return $.then((c)=>n._zod.parse(c,g))}return n._zod.parse($,g)};n._zod.run=(e,u)=>{if(u.skipChecks)return n._zod.parse(e,u);if(u.direction==="backward"){let $=n._zod.parse({value:e.value,issues:[]},{...u,skipChecks:!0});if($ instanceof Promise)return $.then((c)=>{return t(c,e,u)});return t($,e,u)}let g=n._zod.parse(e,u);if(g instanceof Promise){if(u.async===!1)throw new C;return g.then(($)=>r($,v,u))}return r(g,v,u)}}j(n,"~standard",()=>({validate:(r)=>{try{let t=Gt(n,r);return t.success?{value:t.data}:{issues:t.error?.issues}}catch(t){return Wt(n,r).then((e)=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),kr=l("$ZodString",(n,i)=>{z.init(n,i),n._zod.pattern=[...n?._zod.bag?.patterns??[]].pop()??pt(n._zod.bag),n._zod.parse=(o,v)=>{if(i.coerce)try{o.value=String(o.value)}catch(r){}if(typeof o.value==="string")return o;return o.issues.push({expected:"string",code:"invalid_type",input:o.value,inst:n}),o}}),J=l("$ZodStringFormat",(n,i)=>{Gr.init(n,i),kr.init(n,i)}),Jo=l("$ZodGUID",(n,i)=>{i.pattern??(i.pattern=Ft),J.init(n,i)}),Lo=l("$ZodUUID",(n,i)=>{if(i.version){let v={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[i.version];if(v===void 0)throw Error(`Invalid UUID version: "${i.version}"`);i.pattern??(i.pattern=Ur(v))}else i.pattern??(i.pattern=Ur());J.init(n,i)}),Eo=l("$ZodEmail",(n,i)=>{i.pattern??(i.pattern=Tt),J.init(n,i)}),Go=l("$ZodURL",(n,i)=>{J.init(n,i),n._zod.check=(o)=>{try{let v=o.value.trim();if(!i.normalize&&i.protocol?.source===Zt.source){if(!/^https?:\/\//i.test(v)){o.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:o.value,inst:n,continue:!i.abort});return}}let r=new URL(v);if(i.hostname){if(i.hostname.lastIndex=0,!i.hostname.test(r.hostname))o.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:i.hostname.source,input:o.value,inst:n,continue:!i.abort})}if(i.protocol){if(i.protocol.lastIndex=0,!i.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol))o.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:i.protocol.source,input:o.value,inst:n,continue:!i.abort})}if(i.normalize)o.value=r.href;else o.value=v;return}catch(v){o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:n,continue:!i.abort})}}}),Wo=l("$ZodEmoji",(n,i)=>{i.pattern??(i.pattern=Ht()),J.init(n,i)}),Ao=l("$ZodNanoID",(n,i)=>{i.pattern??(i.pattern=Yt),J.init(n,i)}),Vo=l("$ZodCUID",(n,i)=>{i.pattern??(i.pattern=At),J.init(n,i)}),Xo=l("$ZodCUID2",(n,i)=>{i.pattern??(i.pattern=Vt),J.init(n,i)}),qo=l("$ZodULID",(n,i)=>{i.pattern??(i.pattern=Xt),J.init(n,i)}),Ko=l("$ZodXID",(n,i)=>{i.pattern??(i.pattern=qt),J.init(n,i)}),Yo=l("$ZodKSUID",(n,i)=>{i.pattern??(i.pattern=Kt),J.init(n,i)}),Qo=l("$ZodISODateTime",(n,i)=>{i.pattern??(i.pattern=at(i)),J.init(n,i)}),Fo=l("$ZodISODate",(n,i)=>{i.pattern??(i.pattern=ht),J.init(n,i)}),To=l("$ZodISOTime",(n,i)=>{i.pattern??(i.pattern=yt(i)),J.init(n,i)}),Ho=l("$ZodISODuration",(n,i)=>{i.pattern??(i.pattern=Qt),J.init(n,i)}),Bo=l("$ZodIPv4",(n,i)=>{i.pattern??(i.pattern=Bt),J.init(n,i),n._zod.bag.format="ipv4"}),Mo=l("$ZodIPv6",(n,i)=>{i.pattern??(i.pattern=Mt),J.init(n,i),n._zod.bag.format="ipv6",n._zod.check=(o)=>{try{new URL(`http://[${o.value}]`)}catch{o.issues.push({code:"invalid_format",format:"ipv6",input:o.value,inst:n,continue:!i.abort})}}}),xo=l("$ZodMAC",(n,i)=>{i.pattern??(i.pattern=dt(i.delimiter)),J.init(n,i),n._zod.bag.format="mac"}),Ro=l("$ZodCIDRv4",(n,i)=>{i.pattern??(i.pattern=xt),J.init(n,i)}),fo=l("$ZodCIDRv6",(n,i)=>{i.pattern??(i.pattern=Rt),J.init(n,i),n._zod.check=(o)=>{let v=o.value.split("/");try{if(v.length!==2)throw Error();let[r,t]=v;if(!t)throw Error();let e=Number(t);if(`${e}`!==t)throw Error();if(e<0||e>128)throw Error();new URL(`http://[${r}]`)}catch{o.issues.push({code:"invalid_format",format:"cidrv6",input:o.value,inst:n,continue:!i.abort})}}});function Zo(n){if(n==="")return!0;if(/\s/.test(n))return!1;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}var Co=l("$ZodBase64",(n,i)=>{i.pattern??(i.pattern=ft),J.init(n,i),n._zod.bag.contentEncoding="base64",n._zod.check=(o)=>{if(Zo(o.value))return;o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:n,continue:!i.abort})}});function dg(n){if(!Cn.test(n))return!1;let i=n.replace(/[-_]/g,(v)=>v==="-"?"+":"/"),o=i.padEnd(Math.ceil(i.length/4)*4,"=");return Zo(o)}var ho=l("$ZodBase64URL",(n,i)=>{i.pattern??(i.pattern=Cn),J.init(n,i),n._zod.bag.contentEncoding="base64url",n._zod.check=(o)=>{if(dg(o.value))return;o.issues.push({code:"invalid_format",format:"base64url",input:o.value,inst:n,continue:!i.abort})}}),yo=l("$ZodE164",(n,i)=>{i.pattern??(i.pattern=Ct),J.init(n,i)});function xg(n,i=null){try{let o=n.split(".");if(o.length!==3)return!1;let[v]=o;if(!v)return!1;let r=JSON.parse(atob(v));if("typ"in r&&r?.typ!=="JWT")return!1;if(!r.alg)return!1;if(i&&(!("alg"in r)||r.alg!==i))return!1;return!0}catch{return!1}}var ao=l("$ZodJWT",(n,i)=>{J.init(n,i),n._zod.check=(o)=>{if(xg(o.value,i.alg))return;o.issues.push({code:"invalid_format",format:"jwt",input:o.value,inst:n,continue:!i.abort})}}),po=l("$ZodCustomStringFormat",(n,i)=>{J.init(n,i),n._zod.check=(o)=>{if(i.fn(o.value))return;o.issues.push({code:"invalid_format",format:i.format,input:o.value,inst:n,continue:!i.abort})}}),ii=l("$ZodNumber",(n,i)=>{z.init(n,i),n._zod.pattern=n._zod.bag.pattern??gn,n._zod.parse=(o,v)=>{if(i.coerce)try{o.value=Number(o.value)}catch(e){}let r=o.value;if(typeof r==="number"&&!Number.isNaN(r)&&Number.isFinite(r))return o;let t=typeof r==="number"?Number.isNaN(r)?"NaN":!Number.isFinite(r)?"Infinity":void 0:void 0;return o.issues.push({expected:"number",code:"invalid_type",input:r,inst:n,...t?{received:t}:{}}),o}}),so=l("$ZodNumberFormat",(n,i)=>{uo.init(n,i),ii.init(n,i)}),In=l("$ZodBoolean",(n,i)=>{z.init(n,i),n._zod.pattern=no,n._zod.parse=(o,v)=>{if(i.coerce)try{o.value=Boolean(o.value)}catch(t){}let r=o.value;if(typeof r==="boolean")return o;return o.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:n}),o}}),ti=l("$ZodBigInt",(n,i)=>{z.init(n,i),n._zod.pattern=st,n._zod.parse=(o,v)=>{if(i.coerce)try{o.value=BigInt(o.value)}catch(r){}if(typeof o.value==="bigint")return o;return o.issues.push({expected:"bigint",code:"invalid_type",input:o.value,inst:n}),o}}),rv=l("$ZodBigIntFormat",(n,i)=>{$o.init(n,i),ti.init(n,i)}),nv=l("$ZodSymbol",(n,i)=>{z.init(n,i),n._zod.parse=(o,v)=>{let r=o.value;if(typeof r==="symbol")return o;return o.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:n}),o}}),iv=l("$ZodUndefined",(n,i)=>{z.init(n,i),n._zod.pattern=to,n._zod.values=new Set([void 0]),n._zod.parse=(o,v)=>{let r=o.value;if(typeof r>"u")return o;return o.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:n}),o}}),tv=l("$ZodNull",(n,i)=>{z.init(n,i),n._zod.pattern=io,n._zod.values=new Set([null]),n._zod.parse=(o,v)=>{let r=o.value;if(r===null)return o;return o.issues.push({expected:"null",code:"invalid_type",input:r,inst:n}),o}}),ov=l("$ZodAny",(n,i)=>{z.init(n,i),n._zod.parse=(o)=>o}),vv=l("$ZodUnknown",(n,i)=>{z.init(n,i),n._zod.parse=(o)=>o}),ev=l("$ZodNever",(n,i)=>{z.init(n,i),n._zod.parse=(o,v)=>{return o.issues.push({expected:"never",code:"invalid_type",input:o.value,inst:n}),o}}),uv=l("$ZodVoid",(n,i)=>{z.init(n,i),n._zod.parse=(o,v)=>{let r=o.value;if(typeof r>"u")return o;return o.issues.push({expected:"void",code:"invalid_type",input:r,inst:n}),o}}),$v=l("$ZodDate",(n,i)=>{z.init(n,i),n._zod.parse=(o,v)=>{if(i.coerce)try{o.value=new Date(o.value)}catch(u){}let r=o.value,t=r instanceof Date;if(t&&!Number.isNaN(r.getTime()))return o;return o.issues.push({expected:"date",code:"invalid_type",input:r,...t?{received:"Invalid Date"}:{},inst:n}),o}});function Gg(n,i,o){if(n.issues.length)i.issues.push(...H(o,n.issues));i.value[o]=n.value}var gv=l("$ZodArray",(n,i)=>{z.init(n,i),n._zod.parse=(o,v)=>{let r=o.value;if(!Array.isArray(r))return o.issues.push({expected:"array",code:"invalid_type",input:r,inst:n}),o;o.value=Array(r.length);let t=[];for(let e=0;e<r.length;e++){let u=r[e],g=i.element._zod.run({value:u,issues:[]},v);if(g instanceof Promise)t.push(g.then(($)=>Gg($,o,e)));else Gg(g,o,e)}if(t.length)return Promise.all(t).then(()=>o);return o}});function ni(n,i,o,v,r,t){let e=o in v;if(n.issues.length){if(r&&t&&!e)return;i.issues.push(...H(o,n.issues))}if(!e&&!r){if(!n.issues.length)i.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[o]});return}if(n.value===void 0){if(e)i.value[o]=void 0}else i.value[o]=n.value}function Rg(n){let i=Object.keys(n.shape);for(let v of i)if(!n.shape?.[v]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${v}": expected a Zod schema`);let o=Ot(n.shape);return{...n,keys:i,keySet:new Set(i),numKeys:i.length,optionalKeys:new Set(o)}}function fg(n,i,o,v,r,t){let e=[],u=r.keySet,g=r.catchall._zod,$=g.def.type,c=g.optin==="optional",b=g.optout==="optional";for(let S in i){if(S==="__proto__")continue;if(u.has(S))continue;if($==="never"){e.push(S);continue}let D=g.run({value:i[S],issues:[]},v);if(D instanceof Promise)n.push(D.then((N)=>ni(N,o,S,i,c,b)));else ni(D,o,S,i,c,b)}if(e.length)o.issues.push({code:"unrecognized_keys",keys:e,input:i,inst:t});if(!n.length)return o;return Promise.all(n).then(()=>{return o})}var Zg=l("$ZodObject",(n,i)=>{if(z.init(n,i),!Object.getOwnPropertyDescriptor(i,"shape")?.get){let u=i.shape;Object.defineProperty(i,"shape",{get:()=>{let g={...u};return Object.defineProperty(i,"shape",{value:g}),g}})}let v=Or(()=>Rg(i));j(n._zod,"propValues",()=>{let u=i.shape,g={};for(let $ in u){let c=u[$]._zod;if(c.values){g[$]??(g[$]=new Set);for(let b of c.values)g[$].add(b)}}return g});let r=_r,t=i.catchall,e;n._zod.parse=(u,g)=>{e??(e=v.value);let $=u.value;if(!r($))return u.issues.push({expected:"object",code:"invalid_type",input:$,inst:n}),u;u.value={};let c=[],b=e.shape;for(let S of e.keys){let D=b[S],N=D._zod.optin==="optional",T=D._zod.optout==="optional",A=D._zod.run({value:$[S],issues:[]},g);if(A instanceof Promise)c.push(A.then((_t)=>ni(_t,u,S,$,N,T)));else ni(A,u,S,$,N,T)}if(!t)return c.length?Promise.all(c).then(()=>u):u;return fg(c,$,u,g,v.value,n)}}),lv=l("$ZodObjectJIT",(n,i)=>{Zg.init(n,i);let o=n._zod.parse,v=Or(()=>Rg(i)),r=(S)=>{let D=new an(["shape","payload","ctx"]),N=v.value,T=(Z)=>{let G=Yn(Z);return`shape[${G}]._zod.run({ value: input[${G}], issues: [] }, ctx)`};D.write("const input = payload.value;");let A=Object.create(null),_t=0;for(let Z of N.keys)A[Z]=`key_${_t++}`;D.write("const newResult = {};");for(let Z of N.keys){let G=A[Z],V=Yn(Z),_g=S[Z],Ug=_g?._zod?.optin==="optional",zc=_g?._zod?.optout==="optional";if(D.write(`const ${G} = ${T(Z)};`),Ug&&zc)D.write(`
|