oauth1.a&2.0以get,head,post请求access_token[php]

 忽如一夜春风来,千万开放平台开。然而开放平台不是开房平台,你需要先申请一个叫access_token的东东。这个东西就是你在开放平台上的应用(consumer)、开放平台、使用你的应用来访问自身数据客户的一个三方契约;契约写明本用户允许consumer访问本用户在开房平台上的数据;consumer每次拿着这个契约给开房平台看一下,就可以大摇大摆的取得想要的数据了。

取得access token常用的有两种方法:oauth1.a和oauth2.0(本来存在oauth1.0,后来因为安全性问题被弃用)。流程开始之前,你必须为你的应用申请一个consumer_key(任意申请key和token都会附带secret,secret在2.0里面基本没啥用),consumer_key用于申请,consumer_secret+当前其他token附带的secret用于提取传输参数的签名,校验正确性。

oauth1.a是一种比较繁琐的认证流程。它要先使用consumer_key申请一个未授权的request token,用户授权之后变为授权的request token并生成一个verified以get方式送到应用的回调地址(无回调地址即ood,会发送一个pin code到浏览器),然后应用将发送授权的request_token(事实上和未授权的一样,因此上步不存在新的secret)+verified申请access_token. 之后调用api时需要将access token+函数参数+(consumer_secret+access_secret)提取签名发送到开房平台,开放平台将函数结果返回。

oauth2一种存在4中方式申请,采用了https加密,因此不用个人手动提取签名,且认证步骤简化,所以说简单很多。另外,其返回结果通常是以json格式返回。在此就不一一解释了。

Http请求数据可以有多种方式,在开放平台中接受三种: post, get, head. post将数据放在http请求体中,get将请求数据放在网址中和网址以?分割,head不是head request是把请求放在head中,实验表明其方式是get. 具体实验写在后面。由于get是将所有数据以近乎于明文的方式拼接到网址,因此post,head相对安全点,所以在发送某些敏感数据时推荐使用post。

============================================烦人的理论到此为止=============================================================

在oauth1.a&2.0申请token过程中,需要发送多次http请求,有些需要请求需要浏览器重定向。所以先封装各种不同的用于发送的http请求的类,使用了一个工厂,方便调用不同的请求方式。

 

sender.php
<?php
abstract class Sender{
    public abstract function send($url, $data);
}

abstract class GetSender extends Sender{
    protected function makeUrl($aUrl, $data){
        $url=$aUrl.'?';
        foreach($data as $key=>$value){
            if($url.chr(strlen($url)-1)!='?'){
                $url.='&';
            }
            $url=$url.$key.'='.$value;
        }
        return $url;
    }
}

abstract class PostSender extends Sender{
}

abstract class HeadSender extends Sender{
    protected function makeHead($data){
        $head = array();
        if(array_key_exists('oauth_version', $data) && $data['oauth_version']=='1.0'){
            $head[0] = 'Authorization: OAuth ';
        }else{
            $head[0] = 'Authorization: OAuth2 ';
        }
        foreach($data as $key=>$value){
            $head[0] = $head[0].$key.'='.$value.',';
        }
        $head[0][strlen($head[0])-1]=null;
        return $head;
    }
}

class RedirectGetSender extends GetSender{
    public function send($url, $data){
        $url = $this->makeUrl($url, $data);
        header("Location:$url");
    }
}

class DirectGetSender extends GetSender{
    public function send($url, $data){
        $url = $this->makeUrl($url, $data);
        $result = file_get_contents($url);
        return $result;
    }
}
class RedirectPostSender extends PostSender{
    public function send($url, $data){
        echo "click submit to authorize!<br>";
        echo '<form action="'.$url.'" method="post">';
        foreach($data as $key=>$value){
            echo '<input type="hidden" name='.$key.' value="'.$value.'"/>';
        }
        echo '<input type="submit" value="SBUMIT">';
        echo '</form>';
    }
}
class DirectPostSender extends PostSender{
    public function send($url, $data){
        $curlHandle = curl_init();
        curl_setopt($curlHandle, CURLOPT_URL, $url);
        curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array('Expect:'));
        curl_setopt($curlHandle, CURLOPT_POST, true);
        curl_setopt($curlHandle, CURLOPT_POSTFIELDS, http_build_query($data));
        $result = curl_exec($curlHandle);
        curl_close($curlHandle);
        return $result;
    }
}
class DirectHeadSender extends HeadSender{
    public function send($url, $data){
        $head = $this->makeHead($data);
        $curlHandle = curl_init();
        curl_setopt($curlHandle, CURLOPT_URL, $url);
        curl_setopt($curlHandle, CURLOPT_HEADER, false);
        curl_setopt($curlHandle, CURLOPT_HTTPHEADER, $head);
        curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curlHandle, CURLOPT_FRESH_CONNECT, 1);
        $result = curl_exec($curlHandle);
        curl_close($curlHandle);
        return $result;
    }
}
class RedirectHeadsender extends HeadSender{
    public function send($url, $data){
        echo "There are no head method for this redirect request!<br>";
    }
}
class SenderFactory{
    public static function createSender($isRedirect, $mode){
        switch (strtolower($mode)){
        case "get":
            if($isRedirect===true){
                return new RedirectGetSender();
            }else{
                return new DirectGetSender();
            }
            break;
        case "post":
            if($isRedirect===true){
                return new RedirectPostSender();
            }else{
                return new DirectPostSender();
            }
            break;
        case "head":
            if($isRedirect ===true){
                return new RedirectHeadSender();
            }else{
                return new DirectHeadSender();
            }
            break;
        }
    }
}
?>


--------------------------------------oauth1.a----------------------------------------------------------

url->base string类;签名类:

url.php
<?php
class Helper_URL
{
    /**
     * * Build HTTP Query
     * *
     * * @param array $params Name => value array of 
     * parameters
     * *
     * * @return string HTTP query
     * */
    public static function buildHttpQuery(array $params)
    {
        if (empty($params)) {
            return '';
        }

        $keys   = self::urlEncode(array_keys($params));
        $values = self::urlEncode(array_values($params));
        $params = array_combine($keys, $values);
        uksort($params, 'strcmp');
        $pairs = array();
        foreach ($params as $key => $value) {
            $pairs[] =  $key . '=' . $value;
        }
        return implode('&', $pairs);
    }
    /**
     * * URL Encode
     * *
     * * @param mixed $item string or array of items 
     * to url encode;
     * *
     * * @return mixed url encoded string 
     * or array of strings
     * */
    public static function urlEncode($item)
    {
        static $search  = array('%7E');
        static $replace = array('~');
        if (is_array($item)) {
            return array_map(array(__CLASS__, 'urlEncode'), $item);
        }
        if (is_scalar($item) === false) {
            return $item;
        }
        return str_replace($search, $replace, rawurlencode($item));
    }
    /**
     * * URL Decode
     * *
     * * @param mixed $item Item to url decode
     * *
     * * @return string URL decoded string
     * */
    public static function urlDecode($item)
    {
        if (is_array($item)) {
            return array_map(array(__CLASS__, 'urlDecode'), $item);
        }
        return rawurldecode($item);
    }
}
?>


 

signature.php
<?php
include_once('url.php');
/*
 * This class is used to generate the signature of base string.
 * $url is the url your request will be sended to. and if in 'get' mode it is 
 * only the part before '?';
 * $reqMod is request mode: 'get', 'post'; when paremeters are put in the head, 
 * its request mode is 'get';
 * $params are all the params except 'oauth_signature';
 * $consumerSecret is your consumer_secret;
 * $token_secret is the secret you got in the nearest formal step;
 */
class Signaturer{
    public function getSignature($url, $reqMode, array $params, $consumerSecret, $tokenSecret=''){
        $baseStr = $this->getBaseStr($reqMode, $url, $params);
        if(isSet($params['oauth_signature_method'])){
            $signMethod = $this->getSignMethod($params['oauth_signature_method']);
        }else{
            $signMethod = 'sha1';
        }
        $key = $this->getKey($consumerSecret, $tokenSecret);
        return base64_encode(hash_hmac($signMethod, $baseStr, $key, true));
    }

    /* used for constructing the base string.
     * */
    public function getBaseStr($method, $url, $params){
        if (array_key_exists('oauth_signature', $params)) {
            unset($params['oauth_signature']);
        }
        $urlParts = explode('?', $url);
        $parts = array(strtoupper($method), $urlParts[0], Helper_URL::buildHTTPQuery($params));
        return implode('&', Helper_URL::urlEncode($parts));
    }

    /*
     * used to analyse signature method automatically
     * */
    public function getSignMethod($signMethod){
        list($begin, $end) = explode('-', $signMethod);
        return strtolower($end);
    }
    /*
     * create key for signature;
     * in the first step, since there is no secret, it is "$consumerSecret&"
     * */
    public function getKey($consumerSecret, $tokenSecret = ''){
        $secrets = array($consumerSecret, $tokenSecret);
        return implode('&', Helper_URL::urlEncode($secrets));
    }
}

?>


 

oauthTokenFetcher.php
<?php
include_once('sender.php');
include_once('signaturer.php');
/* 
 * to apply an access_token, there are three step:
 * 1. consumer (get post head) a request for unauthorised_request_token and an 
 * unauthorizised request token would be sended back;
 * 2. consumer redirect to the authorization center url;
 * 3. consumer get the authorized request token in the callback url; and then 
 * consumer (get post head) a request for access token; finally, an access 
 * token is sended back;
 */

class OauthTokenFetcher{
    private $signaturer;
	function __construct(){
		$this->signaturer = new Signaturer();
	}
	public function setNonceStamp(array &$params){
		$params['oauth_nonce'] = md5(mt_rand());
		$params['oauth_timestamp'] = time();
	}
    public function fetchToken($url, $reqMode, array $params, $consumerSecret, $tokenSecret, $tokenStyle='request_token'){
        $reqParam = strtolower($reqMode)==='head'?'get':$reqMode;
		$params['oauth_signature'] = $this->signaturer->getSignature($url, $reqParam, $params, $consumerSecret, $tokenSecret);
        foreach($params as $key=>$value){
            $params[$key] = Helper_URL::urlEncode($value);
        }
        if($tokenStyle === 'request_token'){
            $sender = SenderFactory::createSender(true, $reqMode);
            $sender->send($url, $params);
        }else{
            $sender = SenderFactory::createSender(false, $reqMode);
            $result = $sender->send($url, $params);
            return $result;
        }
    }
    /*
     * parse return of fetchToken
     * */
    public function parse($str){
		$infoTmps = explode('&', $str);
		$info = array();
		foreach($infoTmps as $value){
			list($begin, $end) = explode('=', $value);
			$info[$begin] = $end;
		}
		return $info;
	}
}
?>

 

--待续--

 

 

 

 

 

 

 

using System; using System.IO; using System.Net; using System.Net.Security; using System.Security.Cryptography.X509Certificates; using System.Text; using DouYinPush.Model; using DouYinPush.Model.DouYinVideo.New; using Fandi.Common.Convert; using Fandi.Common.Helper; using Newtonsoft.Json; namespace DouYinPush.Helper; public class RequestOperate { private static T HttpGet<T>(string url, string cookie) { T val = default(T); try { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; using WebClient webClient = new WebClient(); webClient.Headers.Add("Referer", "https://www.douyin.com/"); webClient.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36"); webClient.Headers.Add("Cookie", cookie); byte[] bytes = webClient.DownloadData(url); string value = Encoding.UTF8.GetString(bytes); return JsonConvert.DeserializeObject<T>(value); } catch (Exception) { throw; } } private static T HttpPost<T>(string url, string param, string cookie) { T result = default(T); try { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; using WebClient webClient = new WebClient(); byte[] bytes = Encoding.UTF8.GetBytes(param); webClient.Headers.Add("Cookie", cookie); byte[] bytes2 = webClient.UploadData(url, "POST", bytes); string value = Encoding.UTF8.GetString(bytes2); result = JsonConvert.DeserializeObject<T>(value); return result; } catch (Exception ex) { if (!url.StartsWith("https://webcast.amemv.com/webcast/room/ping/anchor/")) { LogHelper.WriteException(ex, "HttpPost"); } } return result; } public static GetQrCodeResponse GetQrCodeInfo() { return HttpGet<GetQrCodeResponse>("https://sso.douyin.com/get_qrcode/?service=https%3A%2F%2Fwebcast.amemv.com&need_logo=false&aid=10006&account_sdk_source=sso&language=zh", ""); } public static string GetHtml(string url) { string result = ""; try { WebRequest webRequest = WebRequest.Create(url); webRequest.Method = "GET"; webRequest.Headers.Add("Cookie", CacheHelper.look_video_cookie); WebResponse response = webRequest.GetResponse(); Stream responseStream = response.GetResponseStream(); Encoding encoding = Encoding.Default; StreamReader streamReader = new StreamReader(responseStream, encoding); result = streamReader.ReadToEnd(); streamReader.Close(); responseStream.Close(); response.Close(); } catch (Exception) { } return result; } public static QueryScanQrCodeStatusResponse GetQrCodeStatus() { return HttpGet<QueryScanQrCodeStatusResponse>("https://sso.douyin.com/check_qrconnect/?service=https%3A%2F%2Fwebcast.amemv.com&token=" + CacheHelper.token + "&need_logo=false&is_frontier=false&aid=10006&account_sdk_source=sso&language=zh", ""); } public static StreamUrlResponse GetPushUrl() { return HttpPost<StreamUrlResponse>("https://webcast.amemv.com/webcast/room/get_latest_room/?ac=wifi&app_name=webcast_mate&version_code=2.2.9&device_platform=windows&webcast_sdk_version=1520&resolution=1920%2A1080&os_version=10.0.19043&language=zh&aid=2079&live_id=1&channel=online&device_id=3096676051989080&iid=1117559680415880", "", CacheHelper.cookie); } public static void PingAnchor() { if (!CacheHelper.room_id.IsEmpty() && !CacheHelper.stream_id.IsEmpty()) { HttpPost<RoomPingResponse>("https://webcast.amemv.com/webcast/room/ping/anchor/?ac=wifi&app_name=webcast_mate&version_code=2.2.9&device_platform=windows&webcast_sdk_version=1520&resolution=1920%2A1080&os_version=10.0.19043&language=zh&aid=2079&live_id=1&channel=online&device_id=3096676051989080&iid=1117559680415880", "stream_id=" + CacheHelper.stream_id + "&room_id=" + CacheHelper.room_id + "&status=2", CacheHelper.cookie); } } public static LiveInfoItemEntity GetLiveInfoByID(string web_r_id) { return HttpGet<LiveInfoItemEntity>("https://live.douyin.com/webcast/room/web/enter/?aid=6383&app_name=douyin_web&live_id=1&device_platform=web&language=zh-CN&enter_from=page_refresh&cookie_enabled=true&screen_width=1920&screen_height=1080&browser_language=zh-CN&browser_platform=Win32&browser_name=Edge&browser_version=127.0.0.0&web_rid=" + web_r_id + "&enter_source=&is_need_double_stream=false&insert_task_id=&live_reason=", CacheHelper.cookie); } public static void CloseLive() { if (!CacheHelper.stream_id.IsEmpty() && !CacheHelper.room_id.IsEmpty() && !CacheHelper.cookie.IsEmpty()) { RoomPingResponse roomPingResponse = HttpPost<RoomPingResponse>("https://webcast.amemv.com/webcast/room/ping/anchor/?ac=wifi&app_name=webcast_mate&version_code=8.6.1&device_platform=windows&webcast_sdk_version=1520&resolution=1920%2A1080&os_version=10.0.19045&language=zh&aid=2079&live_id=1&channel=online&device_id=4229146318764409&iid=2566679780145658&msToken=Q6DSpfUwpMfquGjBJTh2oplGdt2OqLSidNY-HegSpQysL8_lZgft_GgLedjiJvtseHO0AU8sU4cJT5woBO8hG4Kt8cR5NvW5l0GjqSsJJK4-gxLL0w==&X-Bogus=DFSzswVuZFVuRe0FtQCB6rl849N7&_signature=_02B4Z6wo00001uxlUIwAAIDBRSaf3TbcWzbsZVQAANwPrarTWR064S2XsK2HpvtNj1lRBCGX5VsHWhCGawcNNtUheDXzOgM4dCF3J3bOFDSX8cIdchJRQDmHOpFyiLhZ3ReEUoH4Vow.QTj54c", "stream_id=" + CacheHelper.stream_id + "&room_id=" + CacheHelper.room_id + "&status=4", CacheHelper.cookie); if (roomPingResponse.status_code == 0) { MessageHelper.WarningMsg("直播已关闭!"); return; } MessageHelper.WarningMsg(roomPingResponse.data.prompts + "(" + roomPingResponse.data.message + "-" + roomPingResponse.status_code + ")"); } else { MessageHelper.WarningMsg("未检测到开播信息!"); } } public static string RequestUrl(string url) { return GetRedirectUrl(url); } public static string GetRedirectUrl(string url, int type = 0, string cookies = "") { string result = ""; try { HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url); httpWebRequest.Method = "HEAD"; httpWebRequest.AllowAutoRedirect = false; string userAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.861.0 Safari/535.2"; if (type > 0) { userAgent = "Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"; } httpWebRequest.UserAgent = userAgent; httpWebRequest.ContentType = "application/x-www-form-urlencoded"; httpWebRequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"; if (!cookies.IsEmpty()) { httpWebRequest.Headers.Add("Cookie", cookies); } using WebResponse webResponse = httpWebRequest.GetResponse(); result = webResponse.Headers["Location"]; } catch (Exception) { throw new Exception("地址重定向错误!"); } return result; } public static bool DownMP4(string url, string savePath) { bool result = false; try { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url); httpWebRequest.Referer = url; WebResponse response = httpWebRequest.GetResponse(); if (response.ContentType.ToLower().Length > 0) { using (Stream stream = response.GetResponseStream()) { using FileStream fileStream = new FileStream(savePath, FileMode.OpenOrCreate, FileAccess.Write); byte[] array = new byte[1024]; int num = 0; while ((num = stream.Read(array, 0, array.Length)) > 0) { fileStream.Write(array, 0, num); } } result = true; } } catch (Exception ex) { LogHelper.WriteException(ex); } return result; } public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { return true; } }
08-07
file:///D:/nvm/nvm/node_global/node_modules/@anthropic-ai/claude-code/cli.js:707 `),Q.code=Z.error.code,Q.errors=Z.error.errors;else Q.message=Z.error.message,Q.code=Z.error.code;else if(B&&B.status>=400)Q.message=Z,Q.status=B.status;return Q}}nl2.DefaultTransporter=mI1;mI1.USER_AGENT=`${il2}/${ZI6.version}`});var sA1=U((yw0,rl2)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Ob1=U1("buffer"),dR=Ob1.Buffer;function sl2(A,B){for(var Q in A)B[Q]=A[Q]}if(dR.from&&dR.alloc&&dR.allocUnsafe&&dR.allocUnsafeSlow)rl2.exports=Ob1;else sl2(Ob1,yw0),yw0.Buffer=kl;function kl(A,B,Q){return dR(A,B,Q)}kl.prototype=Object.create(dR.prototype);sl2(dR,kl);kl.from=function(A,B,Q){if(typeof A==="number")throw TypeError("Argument must not be a number");return dR(A,B,Q)};kl.alloc=function(A,B,Q){if(typeof A!=="number")throw TypeError("Argument must be a number");var Z=dR(A);if(B!==void 0)if(typeof Q==="string")Z.fill(B,Q);else Z.fill(B);else Z.fill(0);return Z};kl.allocUnsafe=function(A){if(typeof A!=="number")throw TypeError("Argument must be a number");return dR(A)};kl.allocUnsafeSlow=function(A){if(typeof A!=="number")throw TypeError("Argument must be a number");return Ob1.SlowBuffer(A)}});var tl2=U((aL3,ol2)=>{function _w0(A){var B=(A/8|0)+(A%8===0?0:1);return B}var GI6={ES256:_w0(256),ES384:_w0(384),ES512:_w0(521)};function YI6(A){var B=GI6[A];if(B)return B;throw Error('Unknown algorithm "'+A+'"')}ol2.exports=YI6});var kw0=U((sL3,Gp2)=>{var Rb1=sA1().Buffer,Ap2=tl2(),Tb1=128,Bp2=0,WI6=32,II6=16,JI6=2,Qp2=II6|WI6|Bp2<<6,Pb1=JI6|Bp2<<6;function XI6(A){return A.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Zp2(A){if(Rb1.isBuffer(A))return A;else if(typeof A==="string")return Rb1.from(A,"base64");throw TypeError("ECDSA signature must be a Base64 string or a Buffer")}function FI6(A,B){A=Zp2(A);var Q=Ap2(B),Z=Q+1,G=A.length,Y=0;if(A[Y++]!==Qp2)throw Error('Could not find expected "seq"');var W=A[Y++];if(W===(Tb1|1))W=A[Y++];if(G-Y<W)throw Error('"seq" specified length of "'+W+'", only "'+(G-Y)+'" remaining');if(A[Y++]!==Pb1)throw Error('Could not find expected "int" for "r"');var I=A[Y++];if(G-Y-2<I)throw Error('"r" specified length of "'+I+'", only "'+(G-Y-2)+'" available');if(Z<I)throw Error('"r" specified length of "'+I+'", max of "'+Z+'" is acceptable');var J=Y;if(Y+=I,A[Y++]!==Pb1)throw Error('Could not find expected "int" for "s"');var X=A[Y++];if(G-Y!==X)throw Error('"s" specified length of "'+X+'", expected "'+(G-Y)+'"');if(Z<X)throw Error('"s" specified length of "'+X+'", max of "'+Z+'" is acceptable');var F=Y;if(Y+=X,Y!==G)throw Error('Expected to consume entire buffer, but "'+(G-Y)+'" bytes remain');var V=Q-I,D=Q-X,K=Rb1.allocUnsafe(V+I+D+X);for(Y=0;Y<V;++Y)K[Y]=0;A.copy(K,Y,J+Math.max(-V,0),J+I),Y=Q;for(var H=Y;Y<H+D;++Y)K[Y]=0;return A.copy(K,Y,F+Math.max(-D,0),F+X),K=K.toString("base64"),K=XI6(K),K}function el2(A,B,Q){var Z=0;while(B+Z<Q&&A[B+Z]===0)++Z;var G=A[B+Z]>=Tb1;if(G)--Z;return Z}function VI6(A,B){A=Zp2(A);var Q=Ap2(B),Z=A.length;if(Z!==Q*2)throw TypeError('"'+B+'" signatures must be "'+Q*2+'" bytes, saw "'+Z+'"');var G=el2(A,0,Q),Y=el2(A,Q,A.length),W=Q-G,I=Q-Y,J=2+W+1+1+I,X=J<Tb1,F=Rb1.allocUnsafe((X?2:3)+J),V=0;if(F[V++]=Qp2,X)F[V++]=J;else F[V++]=Tb1|1,F[V++]=J&255;if(F[V++]=Pb1,F[V++]=W,G<0)F[V++]=0,V+=A.copy(F,V,0,Q);else V+=A.copy(F,V,G,Q);if(F[V++]=Pb1,F[V++]=I,Y<0)F[V++]=0,A.copy(F,V,Q);else A.copy(F,V,Q+Y);return F}Gp2.exports={derToJose:FI6,joseToDer:VI6}});var cf=U((df)=>{var BL=df&&df.__classPrivateFieldGet||function(A,B,Q,Z){if(Q==="a&quot;&&!Z)throw TypeError("Private accessor was defined without a getter");if(typeof B==="function"?A!==B||!Z:!B.has(A))throw TypeError("Cannot read private member from an object whose class did not declare it");return Q==="m"?Z:Q==="a&quot;?Z.call(A):Z?Z.value:B.get(A)},rA1,Ly,xw0,vw0;Object.defineProperty(df,"__esModule",{value:!0});df.LRUCache=void 0;df.snakeToCamel=Yp2;df.originalOrCamelOptions=DI6;function Yp2(A){return A.replace(/([_][^_])/g,(B)=>B.slice(1).toUpperCase())}function DI6(A){function B(Q){var Z;let G=A||{};return(Z=G[Q])!==null&&Z!==void 0?Z:G[Yp2(Q)]}return{get:B}}class Wp2{constructor(A){rA1.add(this),Ly.set(this,new Map),this.capacity=A.capacity,this.maxAge=A.maxAge}set(A,B){BL(this,rA1,"m",xw0).call(this,A,B),BL(this,rA1,"m",vw0).call(this)}get(A){let B=BL(this,Ly,"f").get(A);if(!B)return;return BL(this,rA1,"m",xw0).call(this,A,B.value),BL(this,rA1,"m",vw0).call(this),B.value}}df.LRUCache=Wp2;Ly=new WeakMap,rA1=new WeakSet,xw0=function(B,Q){BL(this,Ly,"f").delete(B),BL(this,Ly,"f").set(B,{value:Q,lastAccessed:Date.now()})},vw0=function(){let B=this.maxAge?Date.now()-this.maxAge:0,Q=BL(this,Ly,"f").entries().next();while(!Q.done&&(BL(this,Ly,"f").size>this.capacity||Q.value[1].lastAccessed<B))BL(this,Ly,"f").delete(Q.value[0]),Q=BL(this,Ly,"f").entries().next()}});var cR=U((Fp2)=>{Object.defineProperty(Fp2,"__esModule",{value:!0});Fp2.AuthClient=Fp2.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=Fp2.DEFAULT_UNIVERSE=void 0;var KI6=U1("events"),Ip2=eN(),Jp2=dI1(),HI6=cf();Fp2.DEFAULT_UNIVERSE="googleapis.com";Fp2.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=300000;class Xp2 extends KI6.EventEmitter{constructor(A={}){var B,Q,Z,G,Y;super();this.credentials={},this.eagerRefreshThresholdMillis=Fp2.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS,this.forceRefreshOnFailure=!1,this.universeDomain=Fp2.DEFAULT_UNIVERSE;let W=(0,HI6.originalOrCamelOptions)(A);if(this.apiKey=A.apiKey,this.projectId=(B=W.get("project_id"))!==null&&B!==void 0?B:null,this.quotaProjectId=W.get("quota_project_id"),this.credentials=(Q=W.get("credentials"))!==null&&Q!==void 0?Q:{},this.universeDomain=(Z=W.get("universe_domain"))!==null&&Z!==void 0?Z:Fp2.DEFAULT_UNIVERSE,this.transporter=(G=A.transporter)!==null&&G!==void 0?G:new Jp2.DefaultTransporter,A.transporterOptions)this.transporter.defaults=A.transporterOptions;if(A.eagerRefreshThresholdMillis)this.eagerRefreshThresholdMillis=A.eagerRefreshThresholdMillis;this.forceRefreshOnFailure=(Y=A.forceRefreshOnFailure)!==null&&Y!==void 0?Y:!1}get gaxios(){if(this.transporter instanceof Ip2.Gaxios)return this.transporter;else if(this.transporter instanceof Jp2.DefaultTransporter)return this.transporter.instance;else if("instance"in this.transporter&&this.transporter.instance instanceof Ip2.Gaxios)return this.transporter.instance;return null}setCredentials(A){this.credentials=A}addSharedMetadataHeaders(A){if(!A["x-goog-user-project"]&&this.quotaProjectId)A["x-goog-user-project"]=this.quotaProjectId;return A}static get RETRY_CONFIG(){return{retry:!0,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}}Fp2.AuthClient=Xp2});var fw0=U((Hp2)=>{Object.defineProperty(Hp2,"__esModule",{value:!0});Hp2.LoginTicket=void 0;class Kp2{constructor(A,B){this.envelope=A,this.payload=B}getEnvelope(){return this.envelope}getPayload(){return this.payload}getUserId(){let A=this.getPayload();if(A&amp;&A.sub)return A.sub;return null}getAttributes(){return{envelope:this.getEnvelope(),payload:this.getPayload()}}}Hp2.LoginTicket=Kp2});var xl=U((Up2)=>{Object.defineProperty(Up2,"__esModule",{value:!0});Up2.OAuth2Client=Up2.ClientAuthentication=Up2.CertificateFormat=Up2.CodeChallengeMethod=void 0;var zI6=eN(),hw0=U1("querystring"),CI6=U1("stream"),UI6=kw0(),gw0=nA1(),$I6=cR(),wI6=fw0(),Cp2;(function(A){A.Plain="plain",A.S256="S256"})(Cp2||(Up2.CodeChallengeMethod=Cp2={}));var My;(function(A){A.PEM="PEM",A.JWK="JWK"})(My||(Up2.CertificateFormat=My={}));var cI1;(function(A){A.ClientSecretPost="ClientSecretPost",A.ClientSecretBasic="ClientSecretBasic",A.None="None"})(cI1||(Up2.ClientAuthentication=cI1={}));class CK extends $I6.AuthClient{constructor(A,B,Q){let Z=A&amp;&typeof A==="object"?A:{clientId:A,clientSecret:B,redirectUri:Q};super(Z);this.certificateCache={},this.certificateExpiry=null,this.certificateCacheFormat=My.PEM,this.refreshTokenPromises=new Map,this._clientId=Z.clientId,this._clientSecret=Z.clientSecret,this.redirectUri=Z.redirectUri,this.endpoints={tokenInfoUrl:"https://oauth2.googleapis.com/tokeninfo",oauth2AuthBaseUrl:"https://accounts.google.com/o/oauth2/v2/auth",oauth2TokenUrl:"https://oauth2.googleapis.com/token",oauth2RevokeUrl:"https://oauth2.googleapis.com/revoke",oauth2FederatedSignonPemCertsUrl:"https://www.googleapis.com/oauth2/v1/certs",oauth2FederatedSignonJwkCertsUrl:"https://www.googleapis.com/oauth2/v3/certs",oauth2IapPublicKeyUrl:"https://www.gstatic.com/iap/verify/public_key",...Z.endpoints},this.clientAuthentication=Z.clientAuthentication||cI1.ClientSecretPost,this.issuers=Z.issuers||["accounts.google.com","https://accounts.google.com",this.universeDomain]}generateAuthUrl(A={}){if(A.code_challenge_method&&!A.code_challenge)throw Error("If a code_challenge_method is provided, code_challenge must be included.");if(A.response_type=A.response_type||"code",A.client_id=A.client_id||this._clientId,A.redirect_uri=A.redirect_uri||this.redirectUri,Array.isArray(A.scope))A.scope=A.scope.join(" ");return this.endpoints.oauth2AuthBaseUrl.toString()+"?"+hw0.stringify(A)}generateCodeVerifier(){throw Error("generateCodeVerifier is removed, please use generateCodeVerifierAsync instead.")}async generateCodeVerifierAsync(){let A=(0,gw0.createCrypto)(),Q=A.randomBytesBase64(96).replace(/\+/g,"~").replace(/=/g,"_").replace(/\//g,"-"),G=(await A.sha256DigestBase64(Q)).split("=")[0].replace(/\+/g,"-").replace(/\//g,"_");return{codeVerifier:Q,codeChallenge:G}}getToken(A,B){let Q=typeof A==="string"?{code:A}:A;if(B)this.getTokenAsync(Q).then((Z)=>B(null,Z.tokens,Z.res),(Z)=>B(Z,null,Z.response));else return this.getTokenAsync(Q)}async getTokenAsync(A){let B=this.endpoints.oauth2TokenUrl.toString(),Q={"Content-Type":"application/x-www-form-urlencoded"},Z={client_id:A.client_id||this._clientId,code_verifier:A.codeVerifier,code:A.code,grant_type:"authorization_code",redirect_uri:A.redirect_uri||this.redirectUri};if(this.clientAuthentication===cI1.ClientSecretBasic){let W=Buffer.from(`${this._clientId}:${this._clientSecret}`);Q.Authorization=`Basic ${W.toString("base64")}`}if(this.clientAuthentication===cI1.ClientSecretPost)Z.client_secret=this._clientSecret;let G=await this.transporter.request({...CK.RETRY_CONFIG,method:"POST",url:B,data:hw0.stringify(Z),headers:Q}),Y=G.data;if(G.data&amp;&G.data.expires_in)Y.expiry_date=new Date().getTime()+G.data.expires_in*1000,delete Y.expires_in;return this.emit("tokens",Y),{tokens:Y,res:G}}async refreshToken(A){if(!A)return this.refreshTokenNoCache(A);if(this.refreshTokenPromises.has(A))return this.refreshTokenPromises.get(A);let B=this.refreshTokenNoCache(A).then((Q)=>{return this.refreshTokenPromises.delete(A),Q},(Q)=>{throw this.refreshTokenPromises.delete(A),Q});return this.refreshTokenPromises.set(A,B),B}async refreshTokenNoCache(A){var B;if(!A)throw Error("No refresh token is set.");let Q=this.endpoints.oauth2TokenUrl.toString(),Z={refresh_token:A,client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token"},G;try{G=await this.transporter.request({...CK.RETRY_CONFIG,method:"POST",url:Q,data:hw0.stringify(Z),headers:{"Content-Type":"application/x-www-form-urlencoded"}})}catch(W){if(W instanceof zI6.GaxiosError&&W.message==="invalid_grant"&&((B=W.response)===null||B===void 0?void 0:B.data)&&/ReAuth/i.test(W.response.data.error_description))W.message=JSON.stringify(W.response.data);throw W}let Y=G.data;if(G.data&amp;&G.data.expires_in)Y.expiry_date=new Date().getTime()+G.data.expires_in*1000,delete Y.expires_in;return this.emit("tokens",Y),{tokens:Y,res:G}}refreshAccessToken(A){if(A)this.refreshAccessTokenAsync().then((B)=>A(null,B.credentials,B.res),A);else return this.refreshAccessTokenAsync()}async refreshAccessTokenAsync(){let A=await this.refreshToken(this.credentials.refresh_token),B=A.tokens;return B.refresh_token=this.credentials.refresh_token,this.credentials=B,{credentials:this.credentials,res:A.res}}getAccessToken(A){if(A)this.getAccessTokenAsync().then((B)=>A(null,B.token,B.res),A);else return this.getAccessTokenAsync()}async getAccessTokenAsync(){if(!this.credentials.access_token||this.isTokenExpiring()){if(!this.credentials.refresh_token)if(this.refreshHandler){let Q=await this.processAndValidateRefreshHandler();if(Q===null||Q===void 0?void 0:Q.access_token)return this.setCredentials(Q),{token:this.credentials.access_token}}else throw Error("No refresh token or refresh handler callback is set.");let B=await this.refreshAccessTokenAsync();if(!B.credentials||B.credentials&&!B.credentials.access_token)throw Error("Could not refresh access token.");return{token:B.credentials.access_token,res:B.res}}else return{token:this.credentials.access_token}}async getRequestHeaders(A){return(await this.getRequestMetadataAsync(A)).headers}async getRequestMetadataAsync(A){let B=this.credentials;if(!B.access_token&&!B.refresh_token&&!this.apiKey&&!this.refreshHandler)throw Error("No access, refresh token, API key or refresh handler callback is set.");if(B.access_token&&!this.isTokenExpiring()){B.token_type=B.token_type||"Bearer";let W={Authorization:B.token_type+" "+B.access_token};return{headers:this.addSharedMetadataHeaders(W)}}if(this.refreshHandler){let W=await this.processAndValidateRefreshHandler();if(W===null||W===void 0?void 0:W.access_token){this.setCredentials(W);let I={Authorization:"Bearer "+this.credentials.access_token};return{headers:this.addSharedMetadataHeaders(I)}}}if(this.apiKey)return{headers:{"X-Goog-Api-Key":this.apiKey}};let Q=null,Z=null;try{Q=await this.refreshToken(B.refresh_token),Z=Q.tokens}catch(W){let I=W;if(I.response&&(I.response.status===403||I.response.status===404))I.message=`Could not refresh access token: ${I.message}`;throw I}let G=this.credentials;G.token_type=G.token_type||"Bearer",Z.refresh_token=G.refresh_token,this.credentials=Z;let Y={Authorization:G.token_type+" "+Z.access_token};return{headers:this.addSharedMetadataHeaders(Y),res:Q.res}}static getRevokeTokenUrl(A){return new CK().getRevokeTokenURL(A).toString()}getRevokeTokenURL(A){let B=new URL(this.endpoints.oauth2RevokeUrl);return B.searchParams.append("token",A),B}revokeToken(A,B){let Q={...CK.RETRY_CONFIG,url:this.getRevokeTokenURL(A).toString(),method:"POST"};if(B)this.transporter.request(Q).then((Z)=>B(null,Z),B);else return this.transporter.request(Q)}revokeCredentials(A){if(A)this.revokeCredentialsAsync().then((B)=>A(null,B),A);else return this.revokeCredentialsAsync()}async revokeCredentialsAsync(){let A=this.credentials.access_token;if(this.credentials={},A)return this.revokeToken(A);else throw Error("No access token to revoke.")}request(A,B){if(B)this.requestAsync(A).then((Q)=>B(null,Q),(Q)=>{return B(Q,Q.response)});else return this.requestAsync(A)}async requestAsync(A,B=!1){let Q;try{let Z=await this.getRequestMetadataAsync(A.url);if(A.headers=A.headers||{},Z.headers&&Z.headers["x-goog-user-project"])A.headers["x-goog-user-project"]=Z.headers["x-goog-user-project"];if(Z.headers&&Z.headers.Authorization)A.headers.Authorization=Z.headers.Authorization;if(this.apiKey)A.headers["X-Goog-Api-Key"]=this.apiKey;Q=await this.transporter.request(A)}catch(Z){let G=Z.response;if(G){let Y=G.status,W=this.credentials&&this.credentials.access_token&&this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure),I=this.credentials&&this.credentials.access_token&&!this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure)&&this.refreshHandler,J=G.config.data instanceof CI6.Readable,X=Y===401||Y===403;if(!B&&X&&!J&&W)return await this.refreshAccessTokenAsync(),this.requestAsync(A,!0);else if(!B&&X&&!J&&I){let F=await this.processAndValidateRefreshHandler();if(F===null||F===void 0?void 0:F.access_token)this.setCredentials(F);return this.requestAsync(A,!0)}}throw Z}return Q}verifyIdToken(A,B){if(B&&typeof B!=="function")throw Error("This method accepts an options object as the first parameter, which includes the idToken, audience, and maxExpiry.");if(B)this.verifyIdTokenAsync(A).then((Q)=>B(null,Q),B);else return this.verifyIdTokenAsync(A)}async verifyIdTokenAsync(A){if(!A.idToken)throw Error("The verifyIdToken method requires an ID Token");let B=await this.getFederatedSignonCertsAsync();return await this.verifySignedJwtWithCertsAsync(A.idToken,B.certs,A.audience,this.issuers,A.maxExpiry)}async getTokenInfo(A){let{data:B}=await this.transporter.request({...CK.RETRY_CONFIG,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Bearer ${A}`},url:this.endpoints.tokenInfoUrl.toString()}),Q=Object.assign({expiry_date:new Date().getTime()+B.expires_in*1000,scopes:B.scope.split(" ")},B);return delete Q.expires_in,delete Q.scope,Q}getFederatedSignonCerts(A){if(A)this.getFederatedSignonCertsAsync().then((B)=>A(null,B.certs,B.res),A);else return this.getFederatedSignonCertsAsync()}async getFederatedSignonCertsAsync(){let A=new Date().getTime(),B=(0,gw0.hasBrowserCrypto)()?My.JWK:My.PEM;if(this.certificateExpiry&&A&lt;this.certificateExpiry.getTime()&&this.certificateCacheFormat===B)return{certs:this.certificateCache,format:B};let Q,Z;switch(B){case My.PEM:Z=this.endpoints.oauth2FederatedSignonPemCertsUrl.toString();break;case My.JWK:Z=this.endpoints.oauth2FederatedSignonJwkCertsUrl.toString();break;default:throw Error(`Unsupported certificate format ${B}`)}try{Q=await this.transporter.request({...CK.RETRY_CONFIG,url:Z})}catch(J){if(J instanceof Error)J.message=`Failed to retrieve verification certificates: ${J.message}`;throw J}let G=Q?Q.headers["cache-control"]:void 0,Y=-1;if(G){let X=new RegExp("max-age=([0-9]*)").exec(G);if(X&&X.length===2)Y=Number(X[1])*1000}let W={};switch(B){case My.PEM:W=Q.data;break;case My.JWK:for(let J of Q.data.keys)W[J.kid]=J;break;default:throw Error(`Unsupported certificate format ${B}`)}let I=new Date;return this.certificateExpiry=Y===-1?null:new Date(I.getTime()+Y),this.certificateCache=W,this.certificateCacheFormat=B,{certs:W,format:B,res:Q}}getIapPublicKeys(A){if(A)this.getIapPublicKeysAsync().then((B)=>A(null,B.pubkeys,B.res),A);else return this.getIapPublicKeysAsync()}async getIapPublicKeysAsync(){let A,B=this.endpoints.oauth2IapPublicKeyUrl.toString();try{A=await this.transporter.request({...CK.RETRY_CONFIG,url:B})}catch(Q){if(Q instanceof Error)Q.message=`Failed to retrieve verification certificates: ${Q.message}`;throw Q}return{pubkeys:A.data,res:A}}verifySignedJwtWithCerts(){throw Error("verifySignedJwtWithCerts is removed, please use verifySignedJwtWithCertsAsync instead.")}async verifySignedJwtWithCertsAsync(A,B,Q,Z,G){let Y=(0,gw0.createCrypto)();if(!G)G=CK.DEFAULT_MAX_TOKEN_LIFETIME_SECS_;let W=A.split(".");if(W.length!==3)throw Error("Wrong number of segments in token: "+A);let I=W[0]+"."+W[1],J=W[2],X,F;try{X=JSON.parse(Y.decodeBase64StringUtf8(W[0]))}catch(N){if(N instanceof Error)N.message=`Can't parse token envelope: ${W[0]}': ${N.message}`;throw N}if(!X)throw Error("Can't parse token envelope: "+W[0]);try{F=JSON.parse(Y.decodeBase64StringUtf8(W[1]))}catch(N){if(N instanceof Error)N.message=`Can't parse token payload '${W[0]}`;throw N}if(!F)throw Error("Can't parse token payload: "+W[1]);if(!Object.prototype.hasOwnProperty.call(B,X.kid))throw Error("No pem found for envelope: "+JSON.stringify(X));let V=B[X.kid];if(X.alg==="ES256")J=UI6.joseToDer(J,"ES256").toString("base64");if(!await Y.verify(V,I,J))throw Error("Invalid token signature: "+A);if(!F.iat)throw Error("No issue time in token: "+JSON.stringify(F));if(!F.exp)throw Error("No expiration time in token: "+JSON.stringify(F));let K=Number(F.iat);if(isNaN(K))throw Error("iat field using invalid format");let H=Number(F.exp);if(isNaN(H))throw Error("exp field using invalid format");let z=new Date().getTime()/1000;if(H>=z+G)throw Error("Expiration time too far in future: "+JSON.stringify(F));let C=K-CK.CLOCK_SKEW_SECS_,w=H+CK.CLOCK_SKEW_SECS_;if(z<C)throw Error("Token used too early, "+z+" < "+C+": "+JSON.stringify(F));if(z>w)throw Error("Token used too late, "+z+" > "+w+": "+JSON.stringify(F));if(Z&&Z.indexOf(F.iss)<0)throw Error("Invalid issuer, expected one of ["+Z+"], but got "+F.iss);if(typeof Q<"u"&&Q!==null){let N=F.aud,M=!1;if(Q.constructor===Array)M=Q.indexOf(N)>-1;else M=N===Q;if(!M)throw Error("Wrong recipient, payload audience != requiredAudience")}return new wI6.LoginTicket(X,F)}async processAndValidateRefreshHandler(){if(this.refreshHandler){let A=await this.refreshHandler();if(!A.access_token)throw Error("No access token is returned by the refreshHandler callback.");return A}return}isTokenExpiring(){let A=this.credentials.expiry_date;return A?A&lt;=new Date().getTime()+this.eagerRefreshThresholdMillis:!1}}Up2.OAuth2Client=CK;CK.GOOGLE_TOKEN_INFO_URL="https://oauth2.googleapis.com/tokeninfo";CK.CLOCK_SKEW_SECS_=300;CK.DEFAULT_MAX_TOKEN_LIFETIME_SECS_=86400});var uw0=U((qp2)=>{Object.defineProperty(qp2,"__esModule",{value:!0});qp2.Compute=void 0;var LI6=eN(),wp2=uI1(),MI6=xl();class Ep2 extends MI6.OAuth2Client{constructor(A={}){super(A);this.credentials={expiry_date:1,refresh_token:"compute-placeholder"},this.serviceAccountEmail=A.serviceAccountEmail||"default",this.scopes=Array.isArray(A.scopes)?A.scopes:A.scopes?[A.scopes]:[]}async refreshTokenNoCache(A){let B=`service-accounts/${this.serviceAccountEmail}/token`,Q;try{let G={property:B};if(this.scopes.length>0)G.params={scopes:this.scopes.join(",")};Q=await wp2.instance(G)}catch(G){if(G instanceof LI6.GaxiosError)G.message=`Could not refresh access token: ${G.message}`,this.wrapError(G);throw G}let Z=Q;if(Q&&Q.expires_in)Z.expiry_date=new Date().getTime()+Q.expires_in*1000,delete Z.expires_in;return this.emit("tokens",Z),{tokens:Z,res:null}}async fetchIdToken(A){let B=`service-accounts/${this.serviceAccountEmail}/identity?format=full&audience=${A}`,Q;try{let Z={property:B};Q=await wp2.instance(Z)}catch(Z){if(Z instanceof Error)Z.message=`Could not fetch ID token: ${Z.message}`;throw Z}return Q}wrapError(A){let B=A.response;if(B&&B.status){if(A.status=B.status,B.status===403)A.message="A Forbidden error was returned while attempting to retrieve an access token for the Compute Engine built-in service account. This may be because the Compute Engine instance does not have the correct permission scopes specified: "+A.message;else if(B.status===404)A.message="A Not Found error was returned while attempting to retrieve an accesstoken for the Compute Engine built-in service account. This may be because the Compute Engine instance does not have any permission scopes specified: "+A.message}}}qp2.Compute=Ep2});var mw0=U((Mp2)=>{Object.defineProperty(Mp2,"__esModule",{value:!0});Mp2.IdTokenClient=void 0;var OI6=xl();class Lp2 extends OI6.OAuth2Client{constructor(A){super(A);this.targetAudience=A.targetAudience,this.idTokenProvider=A.idTokenProvider}async getRequestMetadataAsync(A){if(!this.credentials.id_token||!this.credentials.expiry_date||this.isTokenExpiring()){let Q=await this.idTokenProvider.fetchIdToken(this.targetAudience);this.credentials={id_token:Q,expiry_date:this.getIdTokenExpiryDate(Q)}}return{headers:{Authorization:"Bearer "+this.credentials.id_token}}}getIdTokenExpiryDate(A){let B=A.split(".")[1];if(B)return JSON.parse(Buffer.from(B,"base64").toString("ascii")).exp*1000}}Mp2.IdTokenClient=Lp2});var dw0=U((Tp2)=>{Object.defineProperty(Tp2,"__esModule",{value:!0});Tp2.GCPEnv=void 0;Tp2.clear=RI6;Tp2.getEnv=TI6;var Rp2=uI1(),Oy;(function(A){A.APP_ENGINE="APP_ENGINE",A.KUBERNETES_ENGINE="KUBERNETES_ENGINE",A.CLOUD_FUNCTIONS="CLOUD_FUNCTIONS",A.COMPUTE_ENGINE="COMPUTE_ENGINE",A.CLOUD_RUN="CLOUD_RUN",A.NONE="NONE"})(Oy||(Tp2.GCPEnv=Oy={}));var lI1;function RI6(){lI1=void 0}async function TI6(){if(lI1)return lI1;return lI1=PI6(),lI1}async function PI6(){let A=Oy.NONE;if(jI6())A=Oy.APP_ENGINE;else if(SI6())A=Oy.CLOUD_FUNCTIONS;else if(await kI6())if(await _I6())A=Oy.KUBERNETES_ENGINE;else if(yI6())A=Oy.CLOUD_RUN;else A=Oy.COMPUTE_ENGINE;else A=Oy.NONE;return A}function jI6(){return!!(process.env.GAE_SERVICE||process.env.GAE_MODULE_NAME)}function SI6(){return!!(process.env.FUNCTION_NAME||process.env.FUNCTION_TARGET)}function yI6(){return!!process.env.K_CONFIGURATION}async function _I6(){try{return await Rp2.instance("attributes/cluster-name"),!0}catch(A){return!1}}async function kI6(){return Rp2.isAvailable()}});var cw0=U((ZM3,jp2)=>{var jb1=sA1().Buffer,bI6=U1("stream"),fI6=U1("util");function Sb1(A){if(this.buffer=null,this.writable=!0,this.readable=!0,!A)return this.buffer=jb1.alloc(0),this;if(typeof A.pipe==="function")return this.buffer=jb1.alloc(0),A.pipe(this),this;if(A.length||typeof A==="object")return this.buffer=A,this.writable=!1,process.nextTick(function(){this.emit("end",A),this.readable=!1,this.emit("close")}.bind(this)),this;throw TypeError("Unexpected data type ("+typeof A+")")}fI6.inherits(Sb1,bI6);Sb1.prototype.write=function(B){this.buffer=jb1.concat([this.buffer,jb1.from(B)]),this.emit("data&quot;,B)};Sb1.prototype.end=function(B){if(B)this.write(B);this.emit("end",B),this.emit("close"),this.writable=!1,this.readable=!1};jp2.exports=Sb1});var yp2=U((GM3,Sp2)=>{var pI1=U1("buffer").Buffer,lw0=U1("buffer").SlowBuffer;Sp2.exports=yb1;function yb1(A,B){if(!pI1.isBuffer(A)||!pI1.isBuffer(B))return!1;if(A.length!==B.length)return!1;var Q=0;for(var Z=0;Z<A.length;Z++)Q|=A[Z]^B[Z];return Q===0}yb1.install=function(){pI1.prototype.equal=lw0.prototype.equal=function(B){return yb1(this,B)}};var hI6=pI1.prototype.equal,gI6=lw0.prototype.equal;yb1.restore=function(){pI1.prototype.equal=hI6,lw0.prototype.equal=gI6}});var nw0=U((YM3,up2)=>{var uI6=yp2(),tA1=sA1().Buffer,lR=U1("crypto"),kp2=kw0(),_p2=U1("util"),mI6=`"%s" is not a valid algorithm. TypeError: Cannot read properties of undefined (reading 'prototype') at file:///D:/nvm/nvm/node_global/node_modules/@anthropic-ai/claude-code/cli.js:707:25327 at file:///D:/nvm/nvm/node_global/node_modules/@anthropic-ai/claude-code/cli.js:8:402 at file:///D:/nvm/nvm/node_global/node_modules/@anthropic-ai/claude-code/cli.js:707:25447 at file:///D:/nvm/nvm/node_global/node_modules/@anthropic-ai/claude-code/cli.js:8:402 at file:///D:/nvm/nvm/node_global/node_modules/@anthropic-ai/claude-code/cli.js:709:3204 at file:///D:/nvm/nvm/node_global/node_modules/@anthropic-ai/claude-code/cli.js:8:402 at file:///D:/nvm/nvm/node_global/node_modules/@anthropic-ai/claude-code/cli.js:709:6226 at file:///D:/nvm/nvm/node_global/node_modules/@anthropic-ai/claude-code/cli.js:8:402 at file:///D:/nvm/nvm/node_global/node_modules/@anthropic-ai/claude-code/cli.js:709:7408 at file:///D:/nvm/nvm/node_global/node_modules/@anthropic-ai/claude-code/cli.js:8:402
10-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值