edgeone 1.6.47 → 1.6.48
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/edgeone-dist/cli.js +1672 -1445
- package/edgeone-dist/libs-pages-blob-python/pages_blob_python-0.13.0-py3-none-any.whl +0 -0
- package/edgeone-dist/pages/dev/runner-worker.js +1410 -1183
- package/libs-pages-blob-python/pages_blob_python-0.13.0-py3-none-any.whl +0 -0
- package/package.json +3 -3
- package/edgeone-dist/libs-pages-blob-python/pages_blob_python-0.12.0-py3-none-any.whl +0 -0
- package/libs-pages-blob-python/pages_blob_python-0.12.0-py3-none-any.whl +0 -0
|
@@ -165,7 +165,7 @@ Read about how to prevent this error on https://github.com/vadimdemedes/ink/#isr
|
|
|
165
165
|
[`+He+"] ";for(Gt in arguments[0])n(arguments[0],Gt)&&(oe+=Gt+": "+arguments[0][Gt]+", ");oe=oe.slice(0,-2)}else oe=arguments[He];X.push(oe)}De(T+`
|
|
166
166
|
Arguments: `+Array.prototype.slice.call(X).join("")+`
|
|
167
167
|
`+new Error().stack),V=!1}return R.apply(this,arguments)},R)}var We={};function Rt(T,R){t.deprecationHandler!=null&&t.deprecationHandler(T,R),We[T]||(De(R+`
|
|
168
|
-
`+new Error().stack),We[T]=!0)}t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;function Et(T){return typeof Function<"u"&&T instanceof Function||Object.prototype.toString.call(T)==="[object Function]"}var It={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Qe(T){return typeof T=="string"?It[T]||It[T.toLowerCase()]:void 0}function pe(T){var R={},V,X;for(X in T)n(T,X)&&(V=Qe(X),V&&(R[V]=T[X]));return R}var Le={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function Me(T){var R=[],V;for(V in T)n(T,V)&&R.push({unit:V,priority:Le[V]});return R.sort(function(X,oe){return X.priority-oe.priority}),R}function tt(T,R,V){var X=""+Math.abs(T),oe=R-X.length,He=T>=0;return(He?V?"+":"":"-")+Math.pow(10,Math.max(0,oe)).toString().substr(1)+X}var wt=/(\[[^\[]*\])|(\\e)|(\\)?(eHHmm|[Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,cr=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Pr={},ot={};function Ve(T,R,V,X){var oe=X;typeof X=="string"&&(oe=function(){return this[X]()}),T&&(ot[T]=oe),R&&(ot[R[0]]=function(){return tt(oe.apply(this,arguments),R[1],R[2])}),V&&(ot[V]=function(){return this.localeData().ordinal(oe.apply(this,arguments),T)})}function ze(T){return T.match(/\[[\s\S]/)?T.replace(/^\[|\]$/g,""):T.replace(/\\/g,"")}function Bt(T){var R=T.match(wt),V,X;for(V=0,X=R.length;V<X;V++)ot[R[V]]?R[V]=ot[R[V]]:R[V]=ze(R[V]);return function(oe){var He="",Gt;for(Gt=0;Gt<X;Gt++)He+=Et(R[Gt])?R[Gt].call(oe,T):R[Gt];return He}}function Oe(T,R){if(!T.isValid())return T.localeData().invalidDate();R=ft(R,T.localeData());var V="$"+R;return n(Pr,V)||(Pr[V]=Bt(R)),Pr[V](T)}function ft(T,R){var V=5;function X(oe){return R.longDateFormat(oe)||oe}for(cr.lastIndex=0;V>=0&&cr.test(T);)T=T.replace(cr,X),cr.lastIndex=0,V-=1;return T}var lt=/\d/,Kt=/\d\d/,zr=/\d{3}/,gr=/\d{4}/,pr=/[+-]?\d{6}/,D=/\d\d?/,Wt=/\d\d\d\d?/,ar=/\d\d\d\d\d\d?/,Qr=/\d{1,3}/,Yt=/\d{1,4}/,Vt=/[+-]?\d{1,6}/,Jt=/\d+/,Ce=/[+-]?\d+/,Be=/Z|[+-]\d\d:?\d\d/gi,gt=/Z|[+-]\d\d(?::?\d\d)?/gi,Zt=/[+-]?\d+(\.\d{1,3})?/,Ir=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,br=/^[1-9]\d?/,pn=/^([1-9]\d|\d)/,en;en={};function er(T,R,V){en[T]=Et(R)?R:function(X,oe){return X&&V?V:R}}function ts(T,R){return n(en,T)?en[T](R._strict,R._locale):new RegExp(M(T))}function M(T){return Je(T.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(R,V,X,oe,He){return V||X||oe||He}))}function Je(T){return T.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Ot(T){return T<0?Math.ceil(T)||0:Math.floor(T)}function St(T){var R=+T,V=0;return R!==0&&isFinite(R)&&(V=Ot(R)),V}var Ht={};function te(T,R){var V,X=R,oe;for(typeof T=="string"&&(T=[T]),d(R)&&(X=function(He,Gt){Gt[R]=St(He)}),oe=T.length,V=0;V<oe;V++)Ht[T[V]]=X}function ve(T,R){te(T,function(V,X,oe,He){oe._w=oe._w||{},R(V,oe._w,oe,He)})}function Re(T,R,V){R!=null&&n(Ht,T)&&Ht[T](R,V._a,V,T)}function Ge(T){return T%4===0&&T%100!==0||T%400===0}var et=0,Tt=1,st=2,$t=3,vr=4,Er=5,Fr=6,tn=7,yn=8;Ve("Y",0,0,function(){var T=this.year();return T<=9999?tt(T,4):"+"+T}),Ve(0,["YY",2],0,function(){return this.year()%100}),Ve(0,["YYYY",4],0,"year"),Ve(0,["YYYYY",5],0,"year"),Ve(0,["YYYYYY",6,!0],0,"year"),er("Y",Ce),er("YY",D,Kt),er("YYYY",Yt,gr),er("YYYYY",Vt,pr),er("YYYYYY",Vt,pr),te(["YYYYY","YYYYYY"],et),te("YYYY",function(T,R){R[et]=T.length===2?t.parseTwoDigitYear(T):St(T)}),te("YY",function(T,R){R[et]=t.parseTwoDigitYear(T)}),te("Y",function(T,R){R[et]=parseInt(T,10)});function rs(T){return Ge(T)?366:365}t.parseTwoDigitYear=function(T){return St(T)+(St(T)>68?1900:2e3)};var xo=To("FullYear",!0);function co(){return Ge(this.year())}function To(T,R){return function(V){return V!=null?(Gu(this,T,V),t.updateOffset(this,R),this):lo(this,T)}}function lo(T,R){if(!T.isValid())return NaN;var V=T._d,X=T._isUTC;switch(R){case"Milliseconds":return X?V.getUTCMilliseconds():V.getMilliseconds();case"Seconds":return X?V.getUTCSeconds():V.getSeconds();case"Minutes":return X?V.getUTCMinutes():V.getMinutes();case"Hours":return X?V.getUTCHours():V.getHours();case"Date":return X?V.getUTCDate():V.getDate();case"Day":return X?V.getUTCDay():V.getDay();case"Month":return X?V.getUTCMonth():V.getMonth();case"FullYear":return X?V.getUTCFullYear():V.getFullYear();default:return NaN}}function Gu(T,R,V){var X,oe,He,Gt,Mr;if(!(!T.isValid()||isNaN(V))){switch(X=T._d,oe=T._isUTC,R){case"Milliseconds":return void(oe?X.setUTCMilliseconds(V):X.setMilliseconds(V));case"Seconds":return void(oe?X.setUTCSeconds(V):X.setSeconds(V));case"Minutes":return void(oe?X.setUTCMinutes(V):X.setMinutes(V));case"Hours":return void(oe?X.setUTCHours(V):X.setHours(V));case"Date":return void(oe?X.setUTCDate(V):X.setDate(V));case"FullYear":break;default:return}He=V,Gt=T.month(),Mr=T.date(),Mr=Mr===29&&Gt===1&&!Ge(He)?28:Mr,oe?X.setUTCFullYear(He,Gt,Mr):X.setFullYear(He,Gt,Mr)}}function Aa(T){return T=Qe(T),Et(this[T])?this[T]():this}function hn(T,R){if(typeof T=="object"){T=pe(T);var V=Me(T),X,oe=V.length;for(X=0;X<oe;X++)this[V[X].unit](T[V[X].unit])}else if(T=Qe(T),Et(this[T]))return this[T](R);return this}function El(T,R){return(T%R+R)%R}var Ts;Array.prototype.indexOf?Ts=Array.prototype.indexOf:Ts=function(T){var R;for(R=0;R<this.length;++R)if(this[R]===T)return R;return-1};function lp(T,R){if(isNaN(T)||isNaN(R))return NaN;var V=El(R,12);return T+=(R-V)/12,V===1?Ge(T)?29:28:31-V%7%2}Ve("M",["MM",2],"Mo",function(){return this.month()+1}),Ve("MMM",0,0,function(T){return this.localeData().monthsShort(this,T)}),Ve("MMMM",0,0,function(T){return this.localeData().months(this,T)}),er("M",D,br),er("MM",D,Kt),er("MMM",function(T,R){return R.monthsShortRegex(T)}),er("MMMM",function(T,R){return R.monthsRegex(T)}),te(["M","MM"],function(T,R){R[Tt]=St(T)-1}),te(["MMM","MMMM"],function(T,R,V,X){var oe=V._locale.monthsParse(T,X,V._strict);oe!=null?R[Tt]=oe:x(V).invalidMonth=T});var pp="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),dc="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Da=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,wl=Ir,kc=Ir,Qc=["monthsParse","longMonthsParse","shortMonthsParse","monthsRegex","monthsShortRegex","monthsStrictRegex","monthsShortStrictRegex"];function Tl(T,R){var V,X;for(V=0;V<Qc.length;V++)X=Qc[V],n(R,X)||delete T["_"+X]}function qp(T,R){return T?s(this._months)?this._months[T.month()]:this._months[(this._months.isFormat||Da).test(R)?"format":"standalone"][T.month()]:s(this._months)?this._months:this._months.standalone}function ii(T,R){return T?s(this._monthsShort)?this._monthsShort[T.month()]:this._monthsShort[Da.test(R)?"format":"standalone"][T.month()]:s(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Dd(T,R,V){var X,oe,He,Gt=T.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],X=0;X<12;++X)He=P([2e3,X]),this._shortMonthsParse[X]=this.monthsShort(He,"").toLocaleLowerCase(),this._longMonthsParse[X]=this.months(He,"").toLocaleLowerCase();return V?R==="MMM"?(oe=Ts.call(this._shortMonthsParse,Gt),oe!==-1?oe:null):(oe=Ts.call(this._longMonthsParse,Gt),oe!==-1?oe:null):R==="MMM"?(oe=Ts.call(this._shortMonthsParse,Gt),oe!==-1?oe:(oe=Ts.call(this._longMonthsParse,Gt),oe!==-1?oe:null)):(oe=Ts.call(this._longMonthsParse,Gt),oe!==-1?oe:(oe=Ts.call(this._shortMonthsParse,Gt),oe!==-1?oe:null))}function el(T,R,V){var X,oe,He;if(this._monthsParseExact)return Dd.call(this,T,R,V);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),X=0;X<12;X++){if(oe=P([2e3,X]),V&&!this._longMonthsParse[X]&&(this._longMonthsParse[X]=new RegExp("^"+this.months(oe,"").replace(".","")+"$","i"),this._shortMonthsParse[X]=new RegExp("^"+this.monthsShort(oe,"").replace(".","")+"$","i")),!V&&!this._monthsParse[X]&&(He="^"+this.months(oe,"")+"|^"+this.monthsShort(oe,""),this._monthsParse[X]=new RegExp(He.replace(".",""),"i")),V&&R==="MMMM"&&this._longMonthsParse[X].test(T))return X;if(V&&R==="MMM"&&this._shortMonthsParse[X].test(T))return X;if(!V&&this._monthsParse[X].test(T))return X}}function hc(T,R){if(!T.isValid())return T;if(typeof R=="string"){if(/^\d+$/.test(R))R=St(R);else if(R=T.localeData().monthsParse(R),!d(R))return T}var V=R,X=T.date();return X=X<29?X:Math.min(X,lp(T.year(),V)),T._isUTC?T._d.setUTCMonth(V,X):T._d.setMonth(V,X),T}function Ps(T){return T!=null?(hc(this,T),t.updateOffset(this,!0),this):lo(this,"Month")}function Ms(){return lp(this.year(),this.month())}function Pl(T){return this._monthsParseExact?(n(this,"_monthsRegex")||ta.call(this),T?this._monthsShortStrictRegex:this._monthsShortRegex):(n(this,"_monthsShortRegex")||(this._monthsShortRegex=wl),this._monthsShortStrictRegex&&T?this._monthsShortStrictRegex:this._monthsShortRegex)}function ea(T){return this._monthsParseExact?(n(this,"_monthsRegex")||ta.call(this),T?this._monthsStrictRegex:this._monthsRegex):(n(this,"_monthsRegex")||(this._monthsRegex=kc),this._monthsStrictRegex&&T?this._monthsStrictRegex:this._monthsRegex)}function ta(){function T(ci,Jn){return Jn.length-ci.length}var R=[],V=[],X=[],oe,He,Gt,Mr;for(oe=0;oe<12;oe++)He=P([2e3,oe]),Gt=Je(this.monthsShort(He,"")),Mr=Je(this.months(He,"")),R.push(Gt),V.push(Mr),X.push(Mr),X.push(Gt);R.sort(T),V.sort(T),X.sort(T),this._monthsRegex=new RegExp("^("+X.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+V.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+R.join("|")+")","i")}Ve("d",0,"do","day"),Ve("dd",0,0,function(T){return this.localeData().weekdaysMin(this,T)}),Ve("ddd",0,0,function(T){return this.localeData().weekdaysShort(this,T)}),Ve("dddd",0,0,function(T){return this.localeData().weekdays(this,T)}),Ve("e",0,0,"weekday"),Ve("E",0,0,"isoWeekday"),Ve("eHHmm",0,0,function(){return""+this.weekday()+tt(this.hours(),2)+tt(this.minutes(),2)}),er("d",D),er("e",D),er("E",D),er("eHHmm",ar),er("dd",function(T,R){return R.weekdaysMinRegex(T)}),er("ddd",function(T,R){return R.weekdaysShortRegex(T)}),er("dddd",function(T,R){return R.weekdaysRegex(T)}),ve(["dd","ddd","dddd"],function(T,R,V,X){var oe=V._locale.weekdaysParse(T,X,V._strict);oe!=null?R.d=oe:x(V).invalidWeekday=T}),ve(["d","e","E"],function(T,R,V,X){R[X]=St(T)}),ve("eHHmm",function(T,R,V){var X=T.length-4;R.e=St(T.substr(0,X)),V._a[$t]=St(T.substr(X,2)),V._a[vr]=St(T.substr(X+2))});function Ku(T,R){return typeof T!="string"?T:isNaN(T)?(T=R.weekdaysParse(T),typeof T=="number"?T:null):parseInt(T,10)}function lu(T,R){return typeof T=="string"?R.weekdaysParse(T)%7||7:isNaN(T)?null:T}function ra(T,R){return T.slice(R,7).concat(T.slice(0,R))}var Up="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),T0="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),If="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),fp=Ir,pu=Ir,yr=Ir,Yu=["weekdaysParse","fullWeekdaysParse","shortWeekdaysParse","minWeekdaysParse","weekdaysRegex","weekdaysShortRegex","weekdaysMinRegex","weekdaysStrictRegex","weekdaysShortStrictRegex","weekdaysMinStrictRegex"];function Tm(T,R){var V,X;for(V=0;V<Yu.length;V++)X=Yu[V],n(R,X)||delete T["_"+X]}function $p(T,R){var V=s(this._weekdays)?this._weekdays:this._weekdays[T&&T!==!0&&this._weekdays.isFormat.test(R)?"format":"standalone"];return T===!0?ra(V,this._week.dow):T?V[T.day()]:V}function Cs(T){return T===!0?ra(this._weekdaysShort,this._week.dow):T?this._weekdaysShort[T.day()]:this._weekdaysShort}function Cl(T){return T===!0?ra(this._weekdaysMin,this._week.dow):T?this._weekdaysMin[T.day()]:this._weekdaysMin}function P0(T,R,V){var X,oe,He,Gt=T.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],X=0;X<7;++X)He=P([2e3,1]).day(X),this._minWeekdaysParse[X]=this.weekdaysMin(He,"").toLocaleLowerCase(),this._shortWeekdaysParse[X]=this.weekdaysShort(He,"").toLocaleLowerCase(),this._weekdaysParse[X]=this.weekdays(He,"").toLocaleLowerCase();return V?R==="dddd"?(oe=Ts.call(this._weekdaysParse,Gt),oe!==-1?oe:null):R==="ddd"?(oe=Ts.call(this._shortWeekdaysParse,Gt),oe!==-1?oe:null):(oe=Ts.call(this._minWeekdaysParse,Gt),oe!==-1?oe:null):R==="dddd"?(oe=Ts.call(this._weekdaysParse,Gt),oe!==-1||(oe=Ts.call(this._shortWeekdaysParse,Gt),oe!==-1)?oe:(oe=Ts.call(this._minWeekdaysParse,Gt),oe!==-1?oe:null)):R==="ddd"?(oe=Ts.call(this._shortWeekdaysParse,Gt),oe!==-1||(oe=Ts.call(this._weekdaysParse,Gt),oe!==-1)?oe:(oe=Ts.call(this._minWeekdaysParse,Gt),oe!==-1?oe:null)):(oe=Ts.call(this._minWeekdaysParse,Gt),oe!==-1||(oe=Ts.call(this._weekdaysParse,Gt),oe!==-1)?oe:(oe=Ts.call(this._shortWeekdaysParse,Gt),oe!==-1?oe:null))}function Pm(T,R,V){var X,oe,He;if(this._weekdaysParseExact)return P0.call(this,T,R,V);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),X=0;X<7;X++){if(oe=P([2e3,1]).day(X),V&&!this._fullWeekdaysParse[X]&&(this._fullWeekdaysParse[X]=new RegExp("^"+this.weekdays(oe,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[X]=new RegExp("^"+this.weekdaysShort(oe,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[X]=new RegExp("^"+this.weekdaysMin(oe,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[X]||(He="^"+this.weekdays(oe,"")+"|^"+this.weekdaysShort(oe,"")+"|^"+this.weekdaysMin(oe,""),this._weekdaysParse[X]=new RegExp(He.replace(".",""),"i")),V&&R==="dddd"&&this._fullWeekdaysParse[X].test(T))return X;if(V&&R==="ddd"&&this._shortWeekdaysParse[X].test(T))return X;if(V&&R==="dd"&&this._minWeekdaysParse[X].test(T))return X;if(!V&&this._weekdaysParse[X].test(T))return X}}function Of(T){if(!this.isValid())return T!=null?this:NaN;var R=lo(this,"Day");return T!=null?(T=Ku(T,this.localeData()),this.add(T-R,"d")):R}function kd(T){if(!this.isValid())return T!=null?this:NaN;var R=(this.day()+7-this.localeData()._week.dow)%7;return T==null?R:this.add(T-R,"d")}function qr(T){if(!this.isValid())return T!=null?this:NaN;if(T!=null){var R=lu(T,this.localeData());return this.day(this.day()%7?R:R-7)}else return this.day()||7}function Io(T){return this._weekdaysParseExact?(n(this,"_weekdaysRegex")||ma.call(this),T?this._weekdaysStrictRegex:this._weekdaysRegex):(n(this,"_weekdaysRegex")||(this._weekdaysRegex=fp),this._weekdaysStrictRegex&&T?this._weekdaysStrictRegex:this._weekdaysRegex)}function Nf(T){return this._weekdaysParseExact?(n(this,"_weekdaysRegex")||ma.call(this),T?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(n(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=pu),this._weekdaysShortStrictRegex&&T?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Al(T){return this._weekdaysParseExact?(n(this,"_weekdaysRegex")||ma.call(this),T?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(n(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=yr),this._weekdaysMinStrictRegex&&T?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function ma(){function T(Oo,ll){return ll.length-Oo.length}var R=[],V=[],X=[],oe=[],He,Gt,Mr,ci,Jn;for(He=0;He<7;He++)Gt=P([2e3,1]).day(He),Mr=Je(this.weekdaysMin(Gt,"")),ci=Je(this.weekdaysShort(Gt,"")),Jn=Je(this.weekdays(Gt,"")),R.push(Mr),V.push(ci),X.push(Jn),oe.push(Mr),oe.push(ci),oe.push(Jn);R.sort(T),V.sort(T),X.sort(T),oe.sort(T),this._weekdaysRegex=new RegExp("^("+oe.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+X.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+V.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+R.join("|")+")","i")}function Rf(T){var R,V;Tl(this,T),Tm(this,T);for(V in T)n(T,V)&&(R=T[V],Et(R)?this[V]=R:this["_"+V]=R);this._config=T,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function Id(T,R){var V=w({},T),X;for(X in R)n(R,X)&&(a(T[X])&&a(R[X])?(V[X]={},w(V[X],T[X]),w(V[X],R[X])):R[X]!=null?V[X]=R[X]:delete V[X]);for(X in T)n(T,X)&&!n(R,X)&&a(T[X])&&(V[X]=w({},V[X]));return V}function Od(T){T!=null&&this.set(T)}var Nd;Object.keys?Nd=Object.keys:Nd=function(T){var R,V=[];for(R in T)n(T,R)&&V.push(R);return V};var Du={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function mc(T,R,V){var X=this._calendar[T]||this._calendar.sameElse;return Et(X)?X.call(R,V):X}var Nh={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function Cm(T){var R=this._longDateFormat[T],V=this._longDateFormat[T.toUpperCase()],X=this._longDateFormatCache;return R||!V?R:X&&X[T]&&X[T].formatUpper===V?X[T].format:(R=V.match(wt).map(function(oe){return oe==="MMMM"||oe==="MM"||oe==="DD"||oe==="dddd"?oe.slice(1):oe}).join(""),X||(X=this._longDateFormatCache={}),X[T]={formatUpper:V,format:R},R)}var Ff="Invalid date";function fu(){return this._invalidDate}var Vp="%d",Ju=/\d{1,2}/;function dp(T){return this._ordinal.replace("%d",T)}var Ic={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Oc(T,R,V,X){var oe=this._relativeTime[V];return Et(oe)?oe(T,R,V,X):oe.replace(/%d/i,T)}function Nc(T,R,V,X){return this.postformat(Oc.call(this,T,R,V,X))}function tl(T,R){var V=this._relativeTime[T>0?"future":"past"];return Et(V)?V(R):V.replace(/%s/i,R)}function Po(T,R){return this.postformat(tl.call(this,T,R))}function pi(T,R,V,X,oe,He,Gt){var Mr;return T<100&&T>=0?(Mr=new Date(T+400,R,V,X,oe,He,Gt),isFinite(Mr.getFullYear())&&Mr.setFullYear(T)):Mr=new Date(T,R,V,X,oe,He,Gt),Mr}function za(T){var R,V;return T<100&&T>=0?(V=Array.prototype.slice.call(arguments),V[0]=T+400,R=new Date(Date.UTC.apply(null,V)),isFinite(R.getUTCFullYear())&&R.setUTCFullYear(T)):R=new Date(Date.UTC.apply(null,arguments)),R}function Lf(T,R,V){var X=7+R-V,oe=(7+za(T,0,X).getUTCDay()-R)%7;return-oe+X-1}function fi(T,R,V,X,oe){var He=(7+V-X)%7,Gt=Lf(T,X,oe),Mr=1+7*(R-1)+He+Gt,ci,Jn;return Mr<=0?(ci=T-1,Jn=rs(ci)+Mr):Mr>rs(T)?(ci=T+1,Jn=Mr-rs(T)):(ci=T,Jn=Mr),{year:ci,dayOfYear:Jn}}function ls(T,R,V,X){var oe=Lf(T,V,X),He=Math.floor((R-oe-1)/7)+1,Gt,Mr;return He<1?(Mr=T-1,Gt=He+ku(Mr,V,X)):He>ku(T,V,X)?(Gt=He-ku(T,V,X),Mr=T+1):(Mr=T,Gt=He),{week:Gt,year:Mr}}function Hp(T,R,V){return ls(T.year(),T.dayOfYear(),R,V)}function gc(T,R,V,X,oe){var He=Math.round((za(T,R,V)-za(T,0,1))/864e5)+1;return ls(T,He,X,oe)}function ku(T,R,V){var X=Lf(T,R,V),oe=Lf(T+1,R,V);return(rs(T)-X+oe)/7}Ve("w",["ww",2],"wo","week"),Ve("W",["WW",2],"Wo","isoWeek"),er("w",D,br),er("ww",D,Kt),er("W",D,br),er("WW",D,Kt),ve(["w","ww","W","WW"],function(T,R,V,X){R[X.substr(0,1)]=St(T)});function Wa(T){return Hp(T,this._week.dow,this._week.doy).week}var Rd={dow:0,doy:6};function C0(){return this._week.dow}function Xu(){return this._week.doy}function Iu(T){var R=this.localeData().week(this);return T==null?R:this.add((T-R)*7,"d")}function Co(T){var R=Hp(this,1,4).week;return T==null?R:this.add((T-R)*7,"d")}function Rc(){return this.hours()%12||12}function hp(){return this.hours()||24}Ve("H",["HH",2],0,"hour"),Ve("h",["hh",2],0,Rc),Ve("k",["kk",2],0,hp),Ve("hmm",0,0,function(){return""+Rc.apply(this)+tt(this.minutes(),2)}),Ve("hmmss",0,0,function(){return""+Rc.apply(this)+tt(this.minutes(),2)+tt(this.seconds(),2)}),Ve("Hmm",0,0,function(){return""+this.hours()+tt(this.minutes(),2)}),Ve("Hmmss",0,0,function(){return""+this.hours()+tt(this.minutes(),2)+tt(this.seconds(),2)});function ga(T,R){Ve(T,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),R)})}ga("a",!0),ga("A",!1);function Dl(T,R){return R._meridiemParse}er("a",Dl),er("A",Dl),er("H",D,pn),er("h",D,br),er("k",D,br),er("HH",D,Kt),er("hh",D,Kt),er("kk",D,Kt),er("hmm",Wt),er("hmmss",ar),er("Hmm",Wt),er("Hmmss",ar),te(["H","HH"],$t),te(["k","kk"],function(T,R,V){var X=St(T);R[$t]=X===24?0:X}),te(["a","A"],function(T,R,V){V._isPm=V._locale.isPM(T),V._meridiem=T}),te(["h","hh"],function(T,R,V){R[$t]=St(T),x(V).bigHour=!0}),te("hmm",function(T,R,V){var X=T.length-2;R[$t]=St(T.substr(0,X)),R[vr]=St(T.substr(X)),x(V).bigHour=!0}),te("hmmss",function(T,R,V){var X=T.length-4,oe=T.length-2;R[$t]=St(T.substr(0,X)),R[vr]=St(T.substr(X,2)),R[Er]=St(T.substr(oe)),x(V).bigHour=!0}),te("Hmm",function(T,R,V){var X=T.length-2;R[$t]=St(T.substr(0,X)),R[vr]=St(T.substr(X))}),te("Hmmss",function(T,R,V){var X=T.length-4,oe=T.length-2;R[$t]=St(T.substr(0,X)),R[vr]=St(T.substr(X,2)),R[Er]=St(T.substr(oe))});function Ga(T){return(T+"").toLowerCase().charAt(0)==="p"}var Fc=/[ap]\.?m?\.?/i,kl=To("Hours",!0);function _e(T,R,V){return T>11?V?"pm":"PM":V?"am":"AM"}var fe={calendar:Du,longDateFormat:Nh,invalidDate:Ff,ordinal:Vp,dayOfMonthOrdinalParse:Ju,relativeTime:Ic,months:pp,monthsShort:dc,week:Rd,weekdays:Up,weekdaysMin:If,weekdaysShort:T0,meridiemParse:Fc},ge={},Xe={},yt;function At(T,R){var V,X=Math.min(T.length,R.length);for(V=0;V<X;V+=1)if(T[V]!==R[V])return V;return X}function Ft(T){return T&&T.toLowerCase().replace("_","-")}function rr(T){for(var R=0,V,X,oe,He;R<T.length;){for(He=Ft(T[R]).split("-"),V=He.length,X=Ft(T[R+1]),X=X?X.split("-"):null;V>0;){if(oe=Ur(He.slice(0,V).join("-")),oe)return oe;if(X&&X.length>=V&&At(He,X)>=V-1)break;V--}R++}return yt}function xr(T){return typeof T=="string"&&/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(T)}function Ur(T){var R=null,V,X;if(n(ge,T))return ge[T];if(X=Ft(T),n(ge,X))return ge[X];if(typeof lE<"u"&&lE&&lE.exports&&xr(X))try{R=yt._abbr,V=require,V("./locale/"+X),Rn(R)}catch{ge[X]=null}if(n(ge,X))return ge[X]}function Rn(T,R){var V;return T&&(p(R)?V=Bs(T):V=Mi(T,R),V?yt=V:typeof console<"u"&&console.warn&&console.warn("Locale "+T+" not found. Did you forget to load it?")),yt._abbr}function Mi(T,R){if(R!==null){var V,X=fe;if(R.abbr=T,ge[T]!=null)Rt("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),X=ge[T]._config;else if(R.parentLocale!=null)if(ge[R.parentLocale]!=null)X=ge[R.parentLocale]._config;else if(V=Ur(R.parentLocale),V!=null)X=V._config;else return Xe[R.parentLocale]||(Xe[R.parentLocale]=[]),Xe[R.parentLocale].push({name:T,config:R}),null;return ge[T]=new Od(Id(X,R)),Xe[T]&&Xe[T].forEach(function(oe){Mi(oe.name,oe.config)}),Rn(T),ge[T]}else return delete ge[T],null}function vn(T,R){var V,X=Ur(T),oe=fe;return X!=null&&(T=X._abbr),R!=null?(ge[T]!=null&&ge[T].parentLocale!=null?ge[T].set(Id(ge[T]._config,R)):(X!=null&&(oe=X._config),R=Id(oe,R),X==null&&(R.abbr=T),V=new Od(R),V.parentLocale=ge[T],ge[T]=V),Rn(T)):ge[T]!=null&&(ge[T].parentLocale!=null?(ge[T]=ge[T].parentLocale,T===Rn()&&Rn(T)):ge[T]!=null&&delete ge[T]),ge[T]}function Bs(T){var R;if(T&&T._locale&&T._locale._abbr&&(T=T._locale._abbr),!T)return yt;if(!s(T)){if(R=Ur(T),R)return R;T=[T]}return rr(T)}function Il(){return Nd(ge)}function Ka(T){var R,V=T._a;return V&&x(T).overflow===-2&&(R=V[Tt]<0||V[Tt]>11?Tt:V[st]<1||V[st]>lp(V[et],V[Tt])?st:V[$t]<0||V[$t]>24||V[$t]===24&&(V[vr]!==0||V[Er]!==0||V[Fr]!==0)?$t:V[vr]<0||V[vr]>59?vr:V[Er]<0||V[Er]>59?Er:V[Fr]<0||V[Fr]>999?Fr:-1,x(T)._overflowDayOfYear&&(R<et||R>st)&&(R=st),x(T)._overflowWeeks&&R===-1&&(R=tn),x(T)._overflowWeekday&&R===-1&&(R=yn),x(T).overflow=R),T}var ya=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ji=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Hn=/Z|[+-]\d\d(?::?\d\d)?/,mn=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Dn=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ci=/^\/?Date\((-?\d+)/i,ns=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Bo={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function du(T){var R,V,X=T._i,oe=ya.exec(X)||Ji.exec(X),He,Gt,Mr,ci,Jn=mn.length,Oo=Dn.length;if(oe){for(x(T).iso=!0,R=0,V=Jn;R<V;R++)if(mn[R][1].exec(oe[1])){Gt=mn[R][0],He=mn[R][2]!==!1;break}if(Gt==null){T._isValid=!1;return}if(oe[3]){for(R=0,V=Oo;R<V;R++)if(Dn[R][1].exec(oe[3])){Mr=(oe[2]||" ")+Dn[R][0];break}if(Mr==null){T._isValid=!1;return}}if(!He&&Mr!=null){T._isValid=!1;return}if(oe[4])if(Hn.exec(oe[4]))ci="Z";else{T._isValid=!1;return}T._f=Gt+(Mr||"")+(ci||""),na(T)}else T._isValid=!1}function rl(T,R,V,X,oe,He){var Gt=[zo(T),dc.indexOf(R),parseInt(V,10),parseInt(X,10),parseInt(oe,10)];return He&&Gt.push(parseInt(He,10)),Gt}function zo(T){var R=parseInt(T,10);return R<=49?2e3+R:R<=999?1900+R:R}function hu(T){return T.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function mu(T,R,V){if(T){var X=T0.indexOf(T),oe=new Date(R[0],R[1],R[2]).getDay();if(X!==oe)return x(V).weekdayMismatch=!0,V._isValid=!1,!1}return!0}function zp(T,R,V){if(T)return Bo[T];if(R)return 0;var X=parseInt(V,10),oe=X%100,He=(X-oe)/100;return He*60+oe}function Ol(T){var R=ns.exec(hu(T._i)),V;if(R){if(V=rl(R[4],R[3],R[2],R[5],R[6],R[7]),!mu(R[1],V,T))return;T._a=V,T._tzm=zp(R[8],R[9],R[10]),T._d=za.apply(null,T._a),T._d.setUTCMinutes(T._d.getUTCMinutes()-T._tzm),x(T).rfc2822=!0}else T._isValid=!1}function yc(T){var R=Ci.exec(T._i);if(R!==null){T._d=new Date(+R[1]);return}if(du(T),T._isValid===!1)delete T._isValid;else return;if(Ol(T),T._isValid===!1)delete T._isValid;else return;T._strict?T._isValid=!1:t.createFromInputFallback(T)}t.createFromInputFallback=rt("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(T){T._d=new Date(T._i+(T._useUTC?" UTC":""))});function nl(T,R,V){return T!=null?T:R!=null?R:V}function ka(T,R,V){var X=Object.prototype.hasOwnProperty.call(T,"_isDefaultDatePartsForWeek"),oe=T._isDefaultDatePartsForWeek;T._isDefaultDatePartsForWeek=!!V;try{return t._getDefaultDateParts(T,R,V)}finally{X?T._isDefaultDatePartsForWeek=oe:delete T._isDefaultDatePartsForWeek}}function Ei(T){var R=T._defaultDatePartsNow;return R?(R.hasValue||(R.value=t.now(),R.hasValue=!0),R.value):t.now()}function Rh(T,R,V){var X=V||T._isDefaultDatePartsForWeek,oe=X?po(R):new Date(R);return X?[oe.year(),oe.month(),oe.date()]:T._useUTC?[oe.getUTCFullYear(),oe.getUTCMonth(),oe.getUTCDate()]:[oe.getFullYear(),oe.getMonth(),oe.getDate()]}t._getDefaultDateParts=Rh;function js(T){var R,V,X=[],oe,He,Gt,Mr,ci;if(!T._d){for((T._a[et]==null||T._a[Tt]==null||T._a[st]==null)&&(oe=Ei(T),He=ka(T,oe)),T._w&&T._a[st]==null&&T._a[Tt]==null&&Fh(T,ka(T,oe,!0)),T._dayOfYear!=null&&(Mr=T._a[et]!=null?T._a[et]:He[et],(T._dayOfYear>rs(Mr)||T._dayOfYear===0)&&(x(T)._overflowDayOfYear=!0),V=za(Mr,0,T._dayOfYear),T._a[Tt]=V.getUTCMonth(),T._a[st]=V.getUTCDate()),ci=T._a[et]==null||T._a[Tt]==null||T._a[st]==null,R=0;R<3&&T._a[R]==null;++R)T._a[R]=X[R]=He[R];for(;R<7;R++)T._a[R]=X[R]=T._a[R]==null?R===2?1:0:T._a[R];T._a[$t]===24&&T._a[vr]===0&&T._a[Er]===0&&T._a[Fr]===0&&(T._nextDay=!0,T._a[$t]=0),T._d=(T._useUTC?za:pi).apply(null,X),Gt=T._useUTC?T._d.getUTCDay():T._d.getDay(),T._tzm!=null&&T._d.setUTCMinutes(T._d.getUTCMinutes()-T._tzm),T._nextDay&&(T._a[$t]=24),T._w&&typeof T._w.d<"u"&&!ci&&T._w.d!==Gt&&(x(T).weekdayMismatch=!0)}}function Fh(T,R){var V,X,oe,He,Gt,Mr,ci,Jn,Oo;V=T._w,V.GG!=null||V.W!=null||V.E!=null?(Gt=1,Mr=4,X=nl(V.GG,T._a[et],gc(R[et],R[Tt],R[st],1,4).year),oe=nl(V.W,1),He=nl(V.E,1),(He<1||He>7)&&(Jn=!0)):(Gt=T._locale._week.dow,Mr=T._locale._week.doy,Oo=gc(R[et],R[Tt],R[st],Gt,Mr),X=nl(V.gg,T._a[et],Oo.year),oe=nl(V.w,Oo.week),V.d!=null?(He=V.d,(He<0||He>6)&&(Jn=!0)):V.e!=null?(He=V.e+Gt,(V.e<0||V.e>6)&&(Jn=!0)):He=Gt),oe<1||oe>ku(X,Gt,Mr)?x(T)._overflowWeeks=!0:Jn!=null?x(T)._overflowWeekday=!0:(ci=fi(X,oe,He,Gt,Mr),T._a[et]=ci.year,T._dayOfYear=ci.dayOfYear)}t.ISO_8601=function(){},t.RFC_2822=function(){};function na(T){if(T._f===t.ISO_8601){du(T);return}if(T._f===t.RFC_2822){Ol(T);return}T._a=[],x(T).empty=!0;var R=""+T._i,V,X,oe,He,Gt,Mr=R.length,ci=0,Jn,Oo;for(oe=ft(T._f,T._locale).match(wt)||[],Oo=oe.length,V=0;V<Oo;V++)He=oe[V],X=(R.match(ts(He,T))||[])[0],X&&(Gt=R.substr(0,R.indexOf(X)),Gt.length>0&&x(T).unusedInput.push(Gt),R=R.slice(R.indexOf(X)+X.length),ci+=X.length),ot[He]?(X?x(T).empty=!1:x(T).unusedTokens.push(He),Re(He,X,T)):T._strict&&!X&&x(T).unusedTokens.push(He);x(T).charsLeftOver=Mr-ci,R.length>0&&x(T).unusedInput.push(R),T._a[$t]<=12&&x(T).bigHour===!0&&T._a[$t]>0&&(x(T).bigHour=void 0),x(T).parsedDateParts=T._a.slice(0),x(T).meridiem=T._meridiem,T._a[$t]=Xi(T._locale,T._a[$t],T._meridiem),Jn=x(T).era,Jn!==null&&(T._a[et]=T._locale.erasConvertYear(Jn,T._a[et])),js(T),Ka(T)}function Xi(T,R,V){var X;return V==null?R:T.meridiemHour!=null?T.meridiemHour(R,V):(T.isPM!=null&&(X=T.isPM(V),X&&R<12&&(R+=12),!X&&R===12&&(R=0)),R)}function vc(T){var R,V,X,oe,He,Gt,Mr=!1,ci={},Jn=T._f.length;if(Jn===0){x(T).invalidFormat=!0,T._d=new Date(NaN);return}for(oe=0;oe<Jn;oe++)He=0,Gt=!1,R=ne({},T),T._useUTC!=null&&(R._useUTC=T._useUTC),R._defaultDatePartsNow=ci,R._f=T._f[oe],na(R),q(R)&&(Gt=!0),He+=x(R).charsLeftOver,He+=x(R).unusedTokens.length*10,x(R).score=He,Mr?He<X&&(X=He,V=R):(X==null||He<X||Gt)&&(X=He,V=R,Gt&&(Mr=!0));w(T,V||R)}function Lh(T){if(!T._d){var R=pe(T._i),V=R.day===void 0?R.date:R.day;T._a=y([R.year,R.month,V,R.hour,R.minute,R.second,R.millisecond],function(X){return X&&parseInt(X,10)}),js(T)}}function Fd(T){var R=new me(Ka(Am(T)));return R._nextDay&&(R.add(1,"d"),R._nextDay=void 0),R}function Am(T){var R=T._i,V=T._f;return T._locale=T._locale||Bs(T._l),R===null||V===void 0&&R===""?F({nullInput:!0}):(typeof R=="string"&&(T._i=R=T._locale.preparse(R)),Ae(R)?new me(Ka(R)):(h(R)?T._d=R:s(V)?vc(T):V?na(T):Ld(T),q(T)||(T._d=null),T))}function Ld(T){var R=T._i;p(R)?T._d=new Date(t.now()):h(R)?T._d=new Date(R.valueOf()):typeof R=="string"?yc(T):s(R)?(T._a=y(R.slice(0),function(V){return parseInt(V,10)}),js(T)):a(R)?Lh(T):d(R)?T._d=new Date(R):t.createFromInputFallback(T)}function Md(T,R,V,X,oe){var He={};return(R===!0||R===!1)&&(X=R,R=void 0),(V===!0||V===!1)&&(X=V,V=void 0),(a(T)&&c(T)||s(T)&&T.length===0)&&(T=void 0),He._isAMomentObject=!0,He._useUTC=He._isUTC=oe,He._l=V,He._i=T,He._f=R,He._strict=X,Fd(He)}function po(T,R,V,X){return Md(T,R,V,X,!1)}var mp=rt("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var T=po.apply(null,arguments);return this.isValid()&&T.isValid()?T<this?this:T:F()}),Lc=rt("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var T=po.apply(null,arguments);return this.isValid()&&T.isValid()?T>this?this:T:F()});function Ou(T,R){var V,X;if(R.length===1&&s(R[0])&&(R=R[0]),!R.length)return po();for(X=0;X<R.length;++X)if(Ae(R[X])){V=R[X];break}if(!V)return F();for(++X;X<R.length;++X)Ae(R[X])&&(!R[X].isValid()||R[X][T](V))&&(V=R[X]);return V}function gu(){var T=[].slice.call(arguments,0);return Ou("isBefore",T)}function Bd(){var T=[].slice.call(arguments,0);return Ou("isAfter",T)}var jo=function(){return Date.now?Date.now():+new Date},ia=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ao(T){var R,V=!1,X,oe=ia.length;for(R in T)if(n(T,R)&&!(Ts.call(ia,R)!==-1&&(T[R]==null||!isNaN(T[R]))))return!1;for(X=0;X<oe;++X)if(T[ia[X]]){if(V)return!1;parseFloat(T[ia[X]])!==St(T[ia[X]])&&(V=!0)}return!0}function Ia(){return this._isValid}function Mf(){return Ai(NaN)}function Zi(T){var R=pe(T),V=R.year||0,X=R.quarter||0,oe=R.month||0,He=R.week||R.isoWeek||0,Gt=R.day||0,Mr=R.hour||0,ci=R.minute||0,Jn=R.second||0,Oo=R.millisecond||0;this._isValid=Ao(R),this._milliseconds=+Oo+Jn*1e3+ci*6e4+Mr*1e3*60*60,this._days=+Gt+He*7,this._months=+oe+X*3+V*12,this._data={},this._locale=Bs(),this._bubble()}function jd(T){return T instanceof Zi}function Mh(T){return T<0?Math.round(-1*T)*-1:Math.round(T)}function yu(T,R,V){var X=Math.min(T.length,R.length),oe=Math.abs(T.length-R.length),He=0,Gt;for(Gt=0;Gt<X;Gt++)St(T[Gt])!==St(R[Gt])&&He++;return He+oe}function vu(T,R){Ve(T,0,0,function(){var V=this.utcOffset(),X="+";return V<0&&(V=-V,X="-"),X+tt(~~(V/60),2)+R+tt(~~V%60,2)})}vu("Z",":"),vu("ZZ",""),er("Z",gt),er("ZZ",gt),te(["Z","ZZ"],function(T,R,V){var X=ct(gt,T);V._useUTC=!0,V._tzm=X,X===null&&(x(V).invalidOffset=T)});var sa=/([\+\-]|\d\d)/gi;function ct(T,R){var V=(R||"").match(T),X,oe,He;return V===null||(X=V[V.length-1]||[],oe=(X+"").match(sa)||["-",0,0],He=+(oe[1]*60)+St(oe[2]),St(oe[2])>59||(oe[0]==="+"?He>14*60:He>12*60))?null:He===0?0:oe[0]==="+"?He:-He}function Qt(T,R){var V,X;return R._isUTC?(V=R.clone(),X=(Ae(T)||h(T)?T.valueOf():po(T).valueOf())-V.valueOf(),V._d.setTime(V._d.valueOf()+X),t.updateOffset(V,!1),V):po(T).local()}function Ut(T){return-Math.round(T._d.getTimezoneOffset())}t.updateOffset=function(){};function Cr(T,R,V){var X=this._offset||0,oe;if(!this.isValid())return T!=null?this:NaN;if(T!=null){if(typeof T=="string"){if(T=ct(gt,T),T===null)return this}else Math.abs(T)<16&&!V&&(T=T*60);return!this._isUTC&&R&&(oe=Ut(this)),this._offset=T,this._isUTC=!0,oe!=null&&this.add(oe,"m"),X!==T&&(!R||this._changeInProgress?Bh(this,Ai(T-X,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?X:Ut(this)}function Fn(T,R){return T!=null?(typeof T!="string"&&(T=-T),this.utcOffset(T,R),this):-this.utcOffset()}function $i(T){return this.utcOffset(0,T)}function eo(T){return this._isUTC&&(this.utcOffset(0,T),this._isUTC=!1,T&&this.subtract(Ut(this),"m")),this}function qs(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var T=ct(Be,this._i);T!=null?this.utcOffset(T):this.utcOffset(0,!0)}return this}function Mc(T){return this.isValid()?(T=T?po(T).utcOffset():0,(this.utcOffset()-T)%60===0):!1}function Dm(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ya(){if(!p(this._isDSTShifted))return this._isDSTShifted;var T={},R;return ne(T,this),T=Am(T),T._a?(R=T._isUTC?P(T._a):po(T._a),this._isDSTShifted=this.isValid()&&yu(T._a,R.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Ja(){return this.isValid()?!this._isUTC:!1}function Vi(){return this.isValid()?this._isUTC:!1}function il(){return this.isValid()?this._isUTC&&this._offset===0:!1}var qd=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Bf=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Ai(T,R){var V=T,X=null,oe,He,Gt;return jd(T)?V={ms:T._milliseconds,d:T._days,M:T._months}:d(T)||!isNaN(+T)?(V={},R?V[R]=+T:V.milliseconds=+T):(X=qd.exec(T))?(oe=X[1]==="-"?-1:1,V={y:0,d:St(X[st])*oe,h:St(X[$t])*oe,m:St(X[vr])*oe,s:St(X[Er])*oe,ms:St(Mh(X[Fr]*1e3))*oe}):(X=Bf.exec(T))?(oe=X[1]==="-"?-1:1,V={y:Wp(X[2],oe),M:Wp(X[3],oe),w:Wp(X[4],oe),d:Wp(X[5],oe),h:Wp(X[6],oe),m:Wp(X[7],oe),s:Wp(X[8],oe)}):V==null?V={}:typeof V=="object"&&("from"in V||"to"in V)&&(Gt=Im(po(V.from),po(V.to)),V={},V.ms=Gt.milliseconds,V.M=Gt.months),He=new Zi(V),jd(T)&&n(T,"_locale")&&(He._locale=T._locale),jd(T)&&n(T,"_isValid")&&(He._isValid=T._isValid),He}Ai.fn=Zi.prototype,Ai.invalid=Mf;function Wp(T,R){var V=T&&parseFloat(T.replace(",","."));return(isNaN(V)?0:V)*R}function km(T,R){var V={};return V.months=R.month()-T.month()+(R.year()-T.year())*12,T.clone().add(V.months,"M").isAfter(R)&&--V.months,V.milliseconds=+R-+T.clone().add(V.months,"M"),V}function Im(T,R){var V;return T.isValid()&&R.isValid()?(R=Qt(R,T),T.isBefore(R)?V=km(T,R):(V=km(R,T),V.milliseconds=-V.milliseconds,V.months=-V.months),V):{milliseconds:0,months:0}}function A0(T,R){return function(V,X){var oe,He;return X!==null&&!isNaN(+X)&&(Rt(R,"moment()."+R+"(period, number) is deprecated. Please use moment()."+R+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),He=V,V=X,X=He),oe=Ai(V,X),Bh(this,oe,T),this}}function Bh(T,R,V,X){var oe=R._milliseconds,He=Mh(R._days),Gt=Mh(R._months);T.isValid()&&(X=X==null?!0:X,Gt&&hc(T,lo(T,"Month")+Gt*V),He&&Gu(T,"Date",lo(T,"Date")+He*V),oe&&T._d.setTime(T._d.valueOf()+oe*V),X&&t.updateOffset(T,He||Gt))}var Zy=A0(1,"add"),Zu=A0(-1,"subtract");function xu(T){return typeof T=="string"||T instanceof String}function Oa(T){return Ae(T)||h(T)||xu(T)||d(T)||Na(T)||xc(T)||T===null||T===void 0}function xc(T){var R=a(T)&&!c(T),V=!1,X=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],oe,He,Gt=X.length;for(oe=0;oe<Gt;oe+=1)He=X[oe],V=V||n(T,He);return R&&V}function Na(T){var R=s(T),V=!1;return R&&(V=T.filter(function(X){return!d(X)&&xu(T)}).length===0),R&&V}function Gp(T){var R=a(T)&&!c(T),V=!1,X=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],oe,He;for(oe=0;oe<X.length;oe+=1)He=X[oe],V=V||n(T,He);return R&&V}function Nl(T,R){var V=T.diff(R,"days",!0);return V<-6?"sameElse":V<-1?"lastWeek":V<0?"lastDay":V<1?"sameDay":V<2?"nextDay":V<7?"nextWeek":"sameElse"}function Bc(T,R){arguments.length===1&&(arguments[0]?Oa(arguments[0])?(T=arguments[0],R=void 0):Gp(arguments[0])&&(R=arguments[0],T=void 0):(T=void 0,R=void 0));var V=T||po(),X=Qt(V,this).startOf("day"),oe=t.calendarFormat(this,X)||"sameElse",He=R&&(Et(R[oe])?R[oe].call(this,V):R[oe]);return this.format(He||this.localeData().calendar(oe,this,po(V)))}function jf(){return new me(this)}function Rl(T,R){var V=Ae(T)?T:po(T);return this.isValid()&&V.isValid()?(R=Qe(R)||"millisecond",R==="millisecond"?this.valueOf()>V.valueOf():V.valueOf()<this.clone().startOf(R).valueOf()):!1}function sl(T,R){var V=Ae(T)?T:po(T);return this.isValid()&&V.isValid()?(R=Qe(R)||"millisecond",R==="millisecond"?this.valueOf()<V.valueOf():this.clone().endOf(R).valueOf()<V.valueOf()):!1}function jh(T,R,V,X){var oe=Ae(T)?T:po(T),He=Ae(R)?R:po(R);return this.isValid()&&oe.isValid()&&He.isValid()?(X=X||"()",(X[0]==="("?this.isAfter(oe,V):!this.isBefore(oe,V))&&(X[1]===")"?this.isBefore(He,V):!this.isAfter(He,V))):!1}function Om(T,R){var V=Ae(T)?T:po(T),X;return this.isValid()&&V.isValid()?(R=Qe(R)||"millisecond",R==="millisecond"?this.valueOf()===V.valueOf():(X=V.valueOf(),this.clone().startOf(R).valueOf()<=X&&X<=this.clone().endOf(R).valueOf())):!1}function Ud(T,R){return this.isSame(T,R)||this.isAfter(T,R)}function Kp(T,R){return this.isSame(T,R)||this.isBefore(T,R)}function qh(T,R,V){var X,oe,He;if(!this.isValid())return NaN;if(X=Qt(T,this),!X.isValid())return NaN;switch(oe=(X.utcOffset()-this.utcOffset())*6e4,R=Qe(R),R){case"year":He=Xa(this,X)/12;break;case"month":He=Xa(this,X);break;case"quarter":He=Xa(this,X)/3;break;case"second":He=(this-X)/1e3;break;case"minute":He=(this-X)/6e4;break;case"hour":He=(this-X)/36e5;break;case"day":He=(this-X-oe)/864e5;break;case"week":He=(this-X-oe)/6048e5;break;default:He=this-X}return V?He:Ot(He)}function Xa(T,R){if(T.date()<R.date())return-Xa(R,T);var V=(R.year()-T.year())*12+(R.month()-T.month()),X=T.clone().add(V,"months"),oe,He;return R-X<0?(oe=T.clone().add(V-1,"months"),He=(R-X)/(X-oe)):(oe=T.clone().add(V+1,"months"),He=(R-X)/(oe-X)),-(V+He)||0}t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function D0(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function $d(T){if(!this.isValid())return null;var R=T!==!0,V=R?this.clone().utc():this;return V.year()<0||V.year()>9999?Oe(V,R?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):Et(Date.prototype.toISOString)?R?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Oe(V,"Z")):Oe(V,R?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Vd(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var T="moment",R="",V,X,oe,He;return this.isLocal()||(T=this.utcOffset()===0?"moment.utc":"moment.parseZone",R="Z"),V="["+T+'("]',X=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",oe="-MM-DD[T]HH:mm:ss.SSS",He=R+'[")]',this.format(V+X+oe+He)}function Uh(T){T||(T=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var R=Oe(this,T);return this.localeData().postformat(R)}function Qy(T,R){return this.isValid()&&(Ae(T)&&T.isValid()||po(T).isValid())?Ai({to:this,from:T}).locale(this.locale()).humanize(!R):this.localeData().invalidDate()}function gi(T){return this.from(po(),T)}function ys(T,R){return this.isValid()&&(Ae(T)&&T.isValid()||po(T).isValid())?Ai({from:this,to:T}).locale(this.locale()).humanize(!R):this.localeData().invalidDate()}function ol(T){return this.to(po(),T)}function jc(T){var R;return T===void 0?this._locale._abbr:(R=Bs(T),R!=null&&(this._locale=R),this)}var al=rt("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(T){return T===void 0?this.localeData():this.locale(T)});function Qu(){return this._locale}var qc=1e3,Ra=60*qc,Hd=60*Ra,gp=(365*400+97)*24*Hd;function Nu(T,R){return(T%R+R)%R}function Fl(T,R,V){return T<100&&T>=0?new Date(T+400,R,V)-gp:new Date(T,R,V).valueOf()}function k0(T,R,V){return T<100&&T>=0?Date.UTC(T+400,R,V)-gp:Date.UTC(T,R,V)}function qf(T){var R,V;if(T=Qe(T),T===void 0||T==="millisecond"||!this.isValid())return this;switch(V=this._isUTC?k0:Fl,T){case"year":R=V(this.year(),0,1);break;case"quarter":R=V(this.year(),this.month()-this.month()%3,1);break;case"month":R=V(this.year(),this.month(),1);break;case"week":R=V(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":R=V(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":R=V(this.year(),this.month(),this.date());break;case"hour":R=this._d.valueOf(),R-=Nu(R+(this._isUTC?0:this.utcOffset()*Ra),Hd);break;case"minute":R=this._d.valueOf(),R-=Nu(R,Ra);break;case"second":R=this._d.valueOf(),R-=Nu(R,qc);break}return this._d.setTime(R),t.updateOffset(this,!0),this}function I0(T){var R,V;if(T=Qe(T),T===void 0||T==="millisecond"||!this.isValid())return this;switch(V=this._isUTC?k0:Fl,T){case"year":R=V(this.year()+1,0,1)-1;break;case"quarter":R=V(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":R=V(this.year(),this.month()+1,1)-1;break;case"week":R=V(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":R=V(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":R=V(this.year(),this.month(),this.date()+1)-1;break;case"hour":R=this._d.valueOf(),R+=Hd-Nu(R+(this._isUTC?0:this.utcOffset()*Ra),Hd)-1;break;case"minute":R=this._d.valueOf(),R+=Ra-Nu(R,Ra)-1;break;case"second":R=this._d.valueOf(),R+=qc-Nu(R,qc)-1;break}return this._d.setTime(R),t.updateOffset(this,!0),this}function Hg(){return this._d.valueOf()-(this._offset||0)*6e4}function zg(){return Math.floor(this.valueOf()/1e3)}function Nm(){return new Date(this.valueOf())}function Uf(){var T=this;return[T.year(),T.month(),T.date(),T.hour(),T.minute(),T.second(),T.millisecond()]}function $h(){var T=this;return{years:T.year(),months:T.month(),date:T.date(),hours:T.hours(),minutes:T.minutes(),seconds:T.seconds(),milliseconds:T.milliseconds()}}function Vh(){return this.isValid()?this.toISOString():null}function zd(){return q(this)}function le(){return w({},x(this))}function yp(){return x(this).overflow}function vp(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}Ve("N",0,0,"eraAbbr"),Ve("NN",0,0,"eraAbbr"),Ve("NNN",0,0,"eraAbbr"),Ve("NNNN",0,0,"eraName"),Ve("NNNNN",0,0,"eraNarrow"),Ve("y",["y",1],"yo","eraYear"),Ve("y",["yy",2],0,"eraYear"),Ve("y",["yyy",3],0,"eraYear"),Ve("y",["yyyy",4],0,"eraYear"),er("N",Ll),er("NN",Ll),er("NNN",Ll),er("NNNN",Ru),er("NNNNN",ul),te(["N","NN","NNN","NNNN","NNNNN"],function(T,R,V,X){var oe=V._locale.erasParse(T,X,V._strict);oe?x(V).era=oe:x(V).invalidEra=T}),er("y",Jt),er("yy",Jt),er("yyy",Jt),er("yyyy",Jt),er("yo",$f),te(["y","yy","yyy","yyyy"],et),te(["yo"],function(T,R,V,X){var oe;V._locale._eraYearOrdinalRegex&&(oe=T.match(V._locale._eraYearOrdinalRegex)),V._locale.eraYearOrdinalParse?R[et]=V._locale.eraYearOrdinalParse(T,oe):R[et]=parseInt(T,10)});function ec(T,R){var V,X,oe,He=this._eras||Bs("en")._eras;for(V=0,X=He.length;V<X;++V){switch(typeof He[V].since){case"string":oe=t(He[V].since).startOf("day"),He[V].since=oe.valueOf();break}switch(typeof He[V].until){case"undefined":He[V].until=1/0;break;case"string":oe=t(He[V].until).startOf("day").valueOf(),He[V].until=oe.valueOf();break}}return He}function Bi(T,R,V){var X,oe,He=this.eras(),Gt,Mr,ci;for(T=T.toUpperCase(),X=0,oe=He.length;X<oe;++X)if(Gt=He[X].name.toUpperCase(),Mr=He[X].abbr.toUpperCase(),ci=He[X].narrow.toUpperCase(),V)switch(R){case"N":case"NN":case"NNN":if(Mr===T)return He[X];break;case"NNNN":if(Gt===T)return He[X];break;case"NNNNN":if(ci===T)return He[X];break}else if([Gt,Mr,ci].indexOf(T)>=0)return He[X]}function O0(T,R){var V=T.since<=T.until?1:-1;return R===void 0?t(T.since).year():t(T.since).year()+(R-T.offset)*V}function Rm(){var T,R,V,X=this.localeData().eras();for(T=0,R=X.length;T<R;++T)if(V=this.clone().startOf("day").valueOf(),X[T].since<=V&&V<=X[T].until||X[T].until<=V&&V<=X[T].since)return X[T].name;return""}function N0(){var T,R,V,X=this.localeData().eras();for(T=0,R=X.length;T<R;++T)if(V=this.clone().startOf("day").valueOf(),X[T].since<=V&&V<=X[T].until||X[T].until<=V&&V<=X[T].since)return X[T].narrow;return""}function xp(){var T,R,V,X=this.localeData().eras();for(T=0,R=X.length;T<R;++T)if(V=this.clone().startOf("day").valueOf(),X[T].since<=V&&V<=X[T].until||X[T].until<=V&&V<=X[T].since)return X[T].abbr;return""}function Wd(){var T,R,V,X,oe=this.localeData().eras();for(T=0,R=oe.length;T<R;++T)if(V=oe[T].since<=oe[T].until?1:-1,X=this.clone().startOf("day").valueOf(),oe[T].since<=X&&X<=oe[T].until||oe[T].until<=X&&X<=oe[T].since)return(this.year()-t(oe[T].since).year())*V+oe[T].offset;return this.year()}function Wg(T){return n(this,"_erasNameRegex")||Hh.call(this),T?this._erasNameRegex:this._erasRegex}function R0(T){return n(this,"_erasAbbrRegex")||Hh.call(this),T?this._erasAbbrRegex:this._erasRegex}function F0(T){return n(this,"_erasNarrowRegex")||Hh.call(this),T?this._erasNarrowRegex:this._erasRegex}function Ll(T,R){return R.erasAbbrRegex(T)}function Ru(T,R){return R.erasNameRegex(T)}function ul(T,R){return R.erasNarrowRegex(T)}function $f(T,R){return R._eraYearOrdinalRegex||Jt}function Hh(){var T=[],R=[],V=[],X=[],oe,He,Gt,Mr,ci,Jn=this.eras();for(oe=0,He=Jn.length;oe<He;++oe)Gt=Je(Jn[oe].name),Mr=Je(Jn[oe].abbr),ci=Je(Jn[oe].narrow),R.push(Gt),T.push(Mr),V.push(ci),X.push(Gt),X.push(Mr),X.push(ci);this._erasRegex=new RegExp("^("+X.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+R.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+T.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+V.join("|")+")","i")}Ve(0,["gg",2],0,function(){return this.weekYear()%100}),Ve(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Ml(T,R){Ve(0,[T,T.length],0,R)}Ml("gggg","weekYear"),Ml("ggggg","weekYear"),Ml("GGGG","isoWeekYear"),Ml("GGGGG","isoWeekYear"),er("G",Ce),er("g",Ce),er("GG",D,Kt),er("gg",D,Kt),er("GGGG",Yt,gr),er("gggg",Yt,gr),er("GGGGG",Vt,pr),er("ggggg",Vt,pr),ve(["gggg","ggggg","GGGG","GGGGG"],function(T,R,V,X){R[X.substr(0,2)]=St(T)}),ve(["gg","GG"],function(T,R,V,X){R[X]=t.parseTwoDigitYear(T)});function Bl(T){return Wh.call(this,T,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function cl(T){return Wh.call(this,T,this.isoWeek(),this.isoWeekday(),1,4)}function zh(){return ku(this.year(),1,4)}function L0(){return ku(this.isoWeekYear(),1,4)}function Gg(){var T=this.localeData()._week;return ku(this.year(),T.dow,T.doy)}function Kg(){var T=this.localeData()._week;return ku(this.weekYear(),T.dow,T.doy)}function Wh(T,R,V,X,oe){var He;return T==null?Hp(this,X,oe).year:(He=ku(T,X,oe),R>He&&(R=He),jl.call(this,T,R,V,X,oe))}function jl(T,R,V,X,oe){var He=fi(T,R,V,X,oe),Gt=za(He.year,0,He.dayOfYear);return this.year(Gt.getUTCFullYear()),this.month(Gt.getUTCMonth()),this.date(Gt.getUTCDate()),this}Ve("Q",0,"Qo","quarter"),er("Q",lt),te("Q",function(T,R){R[Tt]=(St(T)-1)*3});function Fm(T){return T==null?Math.ceil((this.month()+1)/3):this.month((T-1)*3+this.month()%3)}Ve("D",["DD",2],"Do","date"),er("D",D,br),er("DD",D,Kt),er("Do",function(T,R){return T?R._dayOfMonthOrdinalParse||R._ordinalParse:R._dayOfMonthOrdinalParseLenient}),te(["D","DD"],st),te("Do",function(T,R){R[st]=St(T.match(D)[0])});var Yn=To("Date",!0);Ve("DDD",["DDDD",3],"DDDo","dayOfYear"),er("DDD",Qr),er("DDDD",zr),te(["DDD","DDDD"],function(T,R,V){V._dayOfYear=St(T)});function fo(T){var R=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return T==null?R:this.add(T-R,"d")}Ve("m",["mm",2],0,"minute"),er("m",D,pn),er("mm",D,Kt),te(["m","mm"],vr);var va=To("Minutes",!1);Ve("s",["ss",2],0,"second"),er("s",D,pn),er("ss",D,Kt),te(["s","ss"],Er);var _u=To("Seconds",!1);Ve("S",0,0,function(){return~~(this.millisecond()/100)}),Ve(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),Ve(0,["SSS",3],0,"millisecond"),Ve(0,["SSSS",4],0,function(){return this.millisecond()*10}),Ve(0,["SSSSS",5],0,function(){return this.millisecond()*100}),Ve(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),Ve(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),Ve(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),Ve(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),er("S",Qr,lt),er("SS",Qr,Kt),er("SSS",Qr,zr);var Fa,Gh;for(Fa="SSSS";Fa.length<=9;Fa+="S")er(Fa,Jt);function oa(T,R){R[Fr]=St(("0."+T)*1e3)}for(Fa="S";Fa.length<=9;Fa+="S")te(Fa,oa);Gh=To("Milliseconds",!1),Ve("z",0,0,"zoneAbbr"),Ve("zz",0,0,"zoneName");function Gd(){return this._isUTC?"UTC":""}function vi(){return this._isUTC?"Coordinated Universal Time":""}var Ar=me.prototype;Ar.add=Zy,Ar.calendar=Bc,Ar.clone=jf,Ar.diff=qh,Ar.endOf=I0,Ar.format=Uh,Ar.from=Qy,Ar.fromNow=gi,Ar.to=ys,Ar.toNow=ol,Ar.get=Aa,Ar.invalidAt=yp,Ar.isAfter=Rl,Ar.isBefore=sl,Ar.isBetween=jh,Ar.isSame=Om,Ar.isSameOrAfter=Ud,Ar.isSameOrBefore=Kp,Ar.isValid=zd,Ar.lang=al,Ar.locale=jc,Ar.localeData=Qu,Ar.max=Lc,Ar.min=mp,Ar.parsingFlags=le,Ar.set=hn,Ar.startOf=qf,Ar.subtract=Zu,Ar.toArray=Uf,Ar.toObject=$h,Ar.toDate=Nm,Ar.toISOString=$d,Ar.inspect=Vd,typeof Symbol<"u"&&Symbol.for!=null&&(Ar[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),Ar.toJSON=Vh,Ar.toString=D0,Ar.unix=zg,Ar.valueOf=Hg,Ar.creationData=vp,Ar.eraName=Rm,Ar.eraNarrow=N0,Ar.eraAbbr=xp,Ar.eraYear=Wd,Ar.year=xo,Ar.isLeapYear=co,Ar.weekYear=Bl,Ar.isoWeekYear=cl,Ar.quarter=Ar.quarters=Fm,Ar.month=Ps,Ar.daysInMonth=Ms,Ar.week=Ar.weeks=Iu,Ar.isoWeek=Ar.isoWeeks=Co,Ar.weeksInYear=Gg,Ar.weeksInWeekYear=Kg,Ar.isoWeeksInYear=zh,Ar.isoWeeksInISOWeekYear=L0,Ar.date=Yn,Ar.day=Ar.days=Of,Ar.weekday=kd,Ar.isoWeekday=qr,Ar.dayOfYear=fo,Ar.hour=Ar.hours=kl,Ar.minute=Ar.minutes=va,Ar.second=Ar.seconds=_u,Ar.millisecond=Ar.milliseconds=Gh,Ar.utcOffset=Cr,Ar.utc=$i,Ar.local=eo,Ar.parseZone=qs,Ar.hasAlignedHourOffset=Mc,Ar.isDST=Dm,Ar.isLocal=Ja,Ar.isUtcOffset=Vi,Ar.isUtc=il,Ar.isUTC=il,Ar.zoneAbbr=Gd,Ar.zoneName=vi,Ar.dates=rt("dates accessor is deprecated. Use date instead.",Yn),Ar.months=rt("months accessor is deprecated. Use month instead",Ps),Ar.years=rt("years accessor is deprecated. Use year instead",xo),Ar.zone=rt("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Fn),Ar.isDSTShifted=rt("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Ya);function Vf(T){return po(T*1e3)}function Kh(){return po.apply(null,arguments).parseZone()}function Hf(T){return T}var Wi=Od.prototype;Wi.calendar=mc,Wi.longDateFormat=Cm,Wi.invalidDate=fu,Wi.ordinal=dp,Wi.preparse=Hf,Wi.postformat=Hf,Wi.relativeTime=Nc,Wi.pastFuture=Po,Wi.set=Rf,Wi.eras=ec,Wi.erasParse=Bi,Wi.erasConvertYear=O0,Wi.erasAbbrRegex=R0,Wi.erasNameRegex=Wg,Wi.erasNarrowRegex=F0,Wi.months=qp,Wi.monthsShort=ii,Wi.monthsParse=el,Wi.monthsRegex=ea,Wi.monthsShortRegex=Pl,Wi.week=Wa,Wi.firstDayOfYear=Xu,Wi.firstDayOfWeek=C0,Wi.weekdays=$p,Wi.weekdaysMin=Cl,Wi.weekdaysShort=Cs,Wi.weekdaysParse=Pm,Wi.weekdaysRegex=Io,Wi.weekdaysShortRegex=Nf,Wi.weekdaysMinRegex=Al,Wi.isPM=Ga,Wi.meridiem=_e;function Kd(T,R,V,X){var oe=Bs(),He=P().set(X,R);return oe[V](He,T)}function ql(T,R,V){if(d(T)&&(R=T,T=void 0),T=T||"",R!=null)return Kd(T,R,V,"month");var X,oe=[];for(X=0;X<12;X++)oe[X]=Kd(T,X,V,"month");return oe}function an(T,R,V,X){typeof T=="boolean"?(d(R)&&(V=R,R=void 0),R=R||""):(R=T,V=R,T=!1,d(R)&&(V=R,R=void 0),R=R||"");var oe=Bs(),He=T?oe._week.dow:0,Gt,Mr=[];if(V!=null)return Kd(R,(V+He)%7,X,"day");for(Gt=0;Gt<7;Gt++)Mr[Gt]=Kd(R,(Gt+He)%7,X,"day");return Mr}function Fu(T,R){return ql(T,R,"months")}function Yh(T,R){return ql(T,R,"monthsShort")}function Za(T,R,V){return an(T,R,V,"weekdays")}function xa(T,R,V){return an(T,R,V,"weekdaysShort")}function Jh(T,R,V){return an(T,R,V,"weekdaysMin")}Rn("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(T){var R=T%10,V=St(T%100/10)===1?"th":R===1?"st":R===2?"nd":R===3?"rd":"th";return T+V}}),t.lang=rt("moment.lang is deprecated. Use moment.locale instead.",Rn),t.langData=rt("moment.langData is deprecated. Use moment.localeData instead.",Bs);var tc=Math.abs;function Yd(){var T=this._data;return this._milliseconds=tc(this._milliseconds),this._days=tc(this._days),this._months=tc(this._months),T.milliseconds=tc(T.milliseconds),T.seconds=tc(T.seconds),T.minutes=tc(T.minutes),T.hours=tc(T.hours),T.months=tc(T.months),T.years=tc(T.years),this}function Yp(T,R,V,X){var oe=Ai(R,V);return T._milliseconds+=X*oe._milliseconds,T._days+=X*oe._days,T._months+=X*oe._months,T._bubble()}function Su(T,R){return Yp(this,T,R,1)}function Jd(T,R){return Yp(this,T,R,-1)}function Jp(T){return T<0?Math.floor(T):Math.ceil(T)}function _p(){var T=this._milliseconds,R=this._days,V=this._months,X=this._data,oe,He,Gt,Mr,ci;return T>=0&&R>=0&&V>=0||T<=0&&R<=0&&V<=0||(T+=Jp(_c(V)+R)*864e5,R=0,V=0),X.milliseconds=T%1e3,oe=Ot(T/1e3),X.seconds=oe%60,He=Ot(oe/60),X.minutes=He%60,Gt=Ot(He/60),X.hours=Gt%24,R+=Ot(Gt/24),ci=Ot(Uc(R)),V+=ci,R-=Jp(_c(ci)),Mr=Ot(V/12),V%=12,X.days=R,X.months=V,X.years=Mr,this}function Uc(T){return T*4800/146097}function _c(T){return T*146097/4800}function Wo(T){if(!this.isValid())return NaN;var R,V,X=this._milliseconds;if(T=Qe(T),T==="month"||T==="quarter"||T==="year")switch(R=this._days+X/864e5,V=this._months+Uc(R),T){case"month":return V;case"quarter":return V/3;case"year":return V/12}else switch(R=this._days+Math.round(_c(this._months)),T){case"week":return R/7+X/6048e5;case"day":return R+X/864e5;case"hour":return R*24+X/36e5;case"minute":return R*1440+X/6e4;case"second":return R*86400+X/1e3;case"millisecond":return Math.floor(R*864e5)+X;default:throw new Error("Unknown unit "+T)}}function Qa(T){return function(){return this.as(T)}}var eu=Qa("ms"),ji=Qa("s"),to=Qa("m"),zf=Qa("h"),Sa=Qa("d"),Lm=Qa("w"),aa=Qa("M"),Xh=Qa("Q"),ev=Qa("y"),Mm=eu;function M0(){return Ai(this)}function Xd(T){return T=Qe(T),this.isValid()?this[T+"s"]():NaN}function Sp(T){return function(){return this.isValid()?this._data[T]:NaN}}var Ul=Sp("milliseconds"),Bm=Sp("seconds"),Yg=Sp("minutes"),Zh=Sp("hours"),Qh=Sp("days"),Jg=Sp("months"),jm=Sp("years");function Lu(){return Ot(this.days()/7)}var La=Math.round,Wf={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function e0(T,R,V,X,oe){return Oc.call(oe,R||1,!!V,T,X)}function $l(T,R,V,X){var oe=Ai(T).abs(),He=La(oe.as("s")),Gt=La(oe.as("m")),Mr=La(oe.as("h")),ci=La(oe.as("d")),Jn=La(oe.as("M")),Oo=La(oe.as("w")),ll=La(oe.as("y")),Ln=He<=V.ss&&["s",He]||He<V.s&&["ss",He]||Gt<=1&&["m"]||Gt<V.m&&["mm",Gt]||Mr<=1&&["h"]||Mr<V.h&&["hh",Mr]||ci<=1&&["d"]||ci<V.d&&["dd",ci];return V.w!=null&&(Ln=Ln||Oo<=1&&["w"]||Oo<V.w&&["ww",Oo]),Ln=Ln||Jn<=1&&["M"]||Jn<V.M&&["MM",Jn]||ll<=1&&["y"]||["yy",ll],Ln[2]=R,Ln[3]=+T>0,Ln[4]=X,e0.apply(null,Ln)}function tv(T){return T===void 0?La:typeof T=="function"?(La=T,!0):!1}function t0(T,R){return Wf[T]===void 0?!1:R===void 0?Wf[T]:(Wf[T]=R,T==="s"&&(Wf.ss=R-1),!0)}function $c(T,R){if(!this.isValid())return this.localeData().invalidDate();var V=!1,X=Wf,oe,He;return typeof T=="object"&&(R=T,T=!1),typeof T=="boolean"&&(V=T),typeof R=="object"&&(X=w(w({},Wf),R||{}),R.s!=null&&R.ss==null&&(X.ss=R.s-1)),oe=this.localeData(),He=$l(this,!V,X,oe),V&&(He=tl.call(oe,+this,He)),oe.postformat(He)}var Gf=Math.abs;function rc(T){return(T>0)-(T<0)||+T}function Vl(){if(!this.isValid())return this.localeData().invalidDate();var T=Gf(this._milliseconds)/1e3,R=Gf(this._days),V=Gf(this._months),X,oe,He,Gt,Mr=this.asSeconds(),ci,Jn,Oo,ll;return Mr?(X=Ot(T/60),oe=Ot(X/60),T%=60,X%=60,He=Ot(V/12),V%=12,Gt=T?T.toFixed(3).replace(/\.?0+$/,""):"",ci=Mr<0?"-":"",Jn=rc(this._months)!==rc(Mr)?"-":"",Oo=rc(this._days)!==rc(Mr)?"-":"",ll=rc(this._milliseconds)!==rc(Mr)?"-":"",ci+"P"+(He?Jn+He+"Y":"")+(V?Jn+V+"M":"")+(R?Oo+R+"D":"")+(oe||X||T?"T":"")+(oe?ll+oe+"H":"")+(X?ll+X+"M":"")+(T?ll+Gt+"S":"")):"P0D"}var is=Zi.prototype;is.isValid=Ia,is.abs=Yd,is.add=Su,is.subtract=Jd,is.as=Wo,is.asMilliseconds=eu,is.asSeconds=ji,is.asMinutes=to,is.asHours=zf,is.asDays=Sa,is.asWeeks=Lm,is.asMonths=aa,is.asQuarters=Xh,is.asYears=ev,is.valueOf=Mm,is._bubble=_p,is.clone=M0,is.get=Xd,is.milliseconds=Ul,is.seconds=Bm,is.minutes=Yg,is.hours=Zh,is.days=Qh,is.weeks=Lu,is.months=Jg,is.years=jm,is.humanize=$c,is.toISOString=Vl,is.toString=Vl,is.toJSON=Vl,is.locale=jc,is.localeData=Qu,is.toIsoString=rt("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Vl),is.lang=al,Ve("X",0,0,"unix"),Ve("x",0,0,"valueOf"),er("x",Ce),er("X",Zt),te("X",function(T,R,V){V._d=new Date(parseFloat(T)*1e3)}),te("x",function(T,R,V){V._d=new Date(St(T))});return t.version="2.31.0",r(po),t.fn=Ar,t.min=gu,t.max=Bd,t.now=jo,t.utc=P,t.unix=Vf,t.months=Fu,t.isDate=h,t.locale=Rn,t.invalid=F,t.duration=Ai,t.isMoment=Ae,t.weekdays=Za,t.parseZone=Kh,t.localeData=Bs,t.isDuration=jd,t.monthsShort=Yh,t.weekdaysMin=Jh,t.defineLocale=Mi,t.updateLocale=vn,t.locales=Il,t.weekdaysShort=xa,t.normalizeUnits=Qe,t.relativeTimeRounding=tv,t.relativeTimeThreshold=t0,t.calendarFormat=Nl,t.prototype=Ar,t.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},t})});function gg(){return!process.stdout.isTTY||process.env.FORCE_NON_TTY==="1"||process.env.CI==="true"||process.env.CI==="1"||process.env.PAGES_SOURCE==="skills"||process.env.EDGEONE_NON_INTERACTIVE==="1"}function nO({prefix:e="cli"}){return Xo.default.createElement(Ho.Text,{color:"grey"},"[",e,"]")}function ms(e,t="cli"){if(gg()){console.log(`\x1B[90m[${t}]\x1B[0m\x1B[31m[\u2718] \x1B[0m${e}`);return}let{unmount:r}=(0,Ho.render)(Xo.default.createElement(Ho.Text,null,Xo.default.createElement(nO,{prefix:t}),Xo.default.createElement(Ho.Text,{color:"red"},"[\u2718] "),e));r()}function pE(e,t="cli"){if(gg()){console.log(`\x1B[90m[${t}]\x1B[0m\x1B[32m[\u2714] \x1B[0m${e}`);return}let{unmount:r}=(0,Ho.render)(Xo.default.createElement(Ho.Text,null,Xo.default.createElement(nO,{prefix:t}),Xo.default.createElement(Ho.Text,{color:"green"},"[\u2714] "),e));r()}function Qi(e,t="cli"){if(gg()){console.log(`\x1B[90m[${t}]\x1B[0m \x1B[33mWARNING:\x1B[0m ${e}`);return}let{unmount:r}=(0,Ho.render)(Xo.default.createElement(Ho.Text,null,Xo.default.createElement(nO,{prefix:t}),Xo.default.createElement(Ho.Text,{color:"orange"},"\u2757\uFE0F "),e));r()}function ine(e){if(gg()){console.log(e);return}let{unmount:t}=(0,Ho.render)(Xo.default.createElement(Ho.Text,{color:"cyan"},e));t()}function ur(e,t="cli"){if(gg()){console.log(`\x1B[90m[${t}]\x1B[0m ${e}`);return}let{unmount:r}=(0,Ho.render)(Xo.default.createElement(Ho.Text,null,Xo.default.createElement(nO,{prefix:t})," ",e));r()}function XB({timestamp:e}){return Xo.default.createElement(Ho.Box,{width:13},Xo.default.createElement(Ho.Text,{color:"grey"},(0,EC.default)(e).format("HH:mm:ss.SSS")))}function sne(e,t){if(gg()){console.log(`${(0,EC.default)(t).format("HH:mm:ss.SSS")} ${e}`);return}let{unmount:r}=(0,Ho.render)(Xo.default.createElement(Ho.Box,null,Xo.default.createElement(XB,{timestamp:t}),Xo.default.createElement(Ho.Text,null,e)));r()}function one(e,t){if(gg()){console.log(`${(0,EC.default)(t).format("HH:mm:ss.SSS")} [WARNING] ${e}`);return}let{unmount:r}=(0,Ho.render)(Xo.default.createElement(Ho.Box,null,Xo.default.createElement(XB,{timestamp:t}),Xo.default.createElement(Ho.Text,{color:"white",backgroundColor:"yellow"},"[WARNING]"),Xo.default.createElement(Ho.Text,null," ",e)));r()}function ZB(e,t){if(gg()){console.log(`${(0,EC.default)(t).format("HH:mm:ss.SSS")} [ERROR] ${e}`);return}let{unmount:r}=(0,Ho.render)(Xo.default.createElement(Ho.Box,null,Xo.default.createElement(XB,{timestamp:t}),Xo.default.createElement(Ho.Text,{color:"white",backgroundColor:"red"},"[ERROR]"),Xo.default.createElement(Ho.Text,null," ",e)));r()}var Ho,Xo,EC,uu=_t(()=>{Ho=nr(bC()),Xo=nr(Pa()),EC=nr(nne())});var une,ane=_t(()=>{une={name:"edgeone",version:"1.6.47",description:"Command-line interface for TencentCloud Pages Functions",bin:{edgeone:"./edgeone-bin/edgeone.js"},files:["./edgeone-bin/edgeone.js","./edgeone-dist/cli.js","./edgeone-dist/config-schema.js","./edgeone-dist/edgeone.schema.json","./edgeone-dist/pages/templates","./edgeone-dist/pages/dev/runner-worker.js","./edgeone-dist/pages/observability-python/**","./edgeone-dist/libs-pages-blob-python/**","./edgeone-dist/libs-pages-agent-toolkit/**","./edgeone-dist/studio/**","./edgeone-dist/plugins/**","./libs-pages-blob-python/**","./libs-pages-agent-toolkit/**"],author:"",keywords:["tencent","edgeone","edgefunctions","edgeone","cli","typescript"],scripts:{clean:"rimraf ./edgeone-dist ./edgeone-bin ./libs-node-ai ./libs-kv-client",bundle:"node -r esbuild-register ./scripts/bundle.ts",watch:"node -r esbuild-register ./scripts/bundle.ts watch",build:"npm run clean && npm run build:pages-ai && npm run build:kv-client && npm run prepare:blob-wheel && npm run prepare:agent-toolkit-wheel && npm run bundle","build:pages-ai":"node ./scripts/build-pages-ai.js","build:kv-client":"node ./scripts/build-kv-client.js","prepare:blob-wheel":"node ./scripts/prepare-pages-blob-wheel.js","prepare:agent-toolkit-wheel":"node ./scripts/prepare-pages-agent-toolkit-wheel.js","verify:publish-assets":"node ./scripts/verify-publish-assets.js","upload:agent-version-manifest":"node ./scripts/upload-agent-version-manifest.js","build:sandbox-tarball":"bash ./scripts/build-sandbox-tarball.sh","upload:sandbox-tarball":"node ./scripts/upload-sandbox-tarball.js","sync:sandbox-lock":"cd packaging/sandbox && npm install --package-lock-only --omit=dev",format:'prettier --write "src/**/*.{ts,tsx,js,jsx,json,md}" "scripts/**/*.{ts,js}" "*.{json,md}"',prepack:"npm run build && npm run verify:publish-assets",prepublishOnly:"npm run build && npm run verify:publish-assets",test:"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","test:observability":"vitest run --config src/agent/observability/node/tests/vitest.config.ts && cd src/agent/observability/python && uv run pytest tests/ -q"},dependencies:{"@babel/generator":"^7.28.0","@babel/parser":"^7.28.0","@babel/traverse":"^7.28.0","@babel/types":"^7.28.0","@edgeone/nuxt-pages":"1.1.2-beta.1","@edgeone/opennextjs-pages":"0.2.10-beta.12","@edgeone/pages-agent-toolkit":"0.1.38","@edgeone/pages-blob":"^0.0.16",chokidar:"^4.0.1",esbuild:"^0.19.2","esbuild-plugin-polyfill-node":"^0.3.0","extract-zip":"^2.0.1","fast-glob":"^3.3.0",giget:"^2.0.0",minimatch:"^9.0.5",open:"^8.4.2"},devDependencies:{"@e2b/code-interpreter":"2.4.2","@edgeone/framework-detect":"^0.0.2","@edgeone/is-spa":"^0.0.3","@edgeone/types":"^1.0.2","@modelcontextprotocol/sdk":"1.29.0","@opentelemetry/api":"^1.9.1","@opentelemetry/core":"^1.30.1","@opentelemetry/exporter-metrics-otlp-http":"^0.55.0","@opentelemetry/exporter-trace-otlp-http":"^0.55.0","@opentelemetry/instrumentation":"^0.55.0","@opentelemetry/otlp-transformer":"^0.55.0","@opentelemetry/resources":"^1.30.1","@opentelemetry/sdk-metrics":"^1.30.1","@opentelemetry/sdk-trace-base":"^1.30.1","@opentelemetry/sdk-trace-node":"^1.30.1","@opentelemetry/semantic-conventions":"^1.40.0","@tencent/capi-nodejs-sdk":"^2.3.2","@types/http-proxy":"^1.17.12","@types/inquirer":"^9.0.8","@types/ip":"^1.1.0","@types/js-yaml":"^4.0.9","@types/lodash":"^4.14.198","@types/prompts":"^2.4.4","@types/react":"^17.0.2","@types/uuid":"^9.0.3","@types/ws":"^8.5.7","@types/yargs":"^17.0.24","@vitest/coverage-v8":"^4.0.17",archiver:"^7.0.1",axios:"^1.7.9",chalk:"^5.3.0","common-path-prefix":"^1.0.0",cookie:"^1.0.2","cos-nodejs-sdk-v5":"^2.14.7","cross-spawn":"^7.0.6","detect-port":"^2.1.0",dotenv:"^16.3.1","esbuild-register":"^3.6.0",execa:"^7.1.1","fs-extra":"^11.3.1","http-proxy":"^1.18.1",husky:"^8.0.3",ink:"^3.2.0","ink-table":"^3.1.0",inquirer:"^8.2.4",ip:"^2.0.1","js-yaml":"^4.3.1",json5:"^2.2.3","lint-staged":"^15.2.0",lodash:"^4.17.21","mime-types":"^3.0.1",moment:"^2.30.1","node-fetch":"^3.3.2","node-persist":"^4.0.3","p-map":"^5.5.0",portfinder:"^1.0.32",prettier:"^3.1.1",prompts:"^2.4.2",protobufjs:"^8.4.2",react:"^17.0.2",rimraf:"^6.0.1",semiver:"^1.1.0",sirv:"^2.0.3","tencentcloud-cls-sdk-js-web":"^1.0.13","ts-node":"^10.9.2",typescript:"^5.9.3",undici:"^5.29.0","update-check":"^1.5.4",uuid:"^9.0.0",vitest:"^4.0.17",ws:"^8.14.2",yargs:"^17.6.2",zod:"^3.23.8","zod-to-json-schema":"^3.23.5"},overrides:{"@e2b/code-interpreter":"2.4.2",e2b:"2.19.5"},engines:{node:">=12"},"lint-staged":{"*.{ts,tsx,js,jsx,json,md}":["prettier --write"]}}});function gUe(){var e,t;return{run_id:mUe,cli_version:(t=(e=une)==null?void 0:e.version)!=null?t:"unknown",node_version:process.version,os_platform:e6.default.platform(),os_arch:e6.default.arch(),app_type:"cli",app_id:process.env.AppId||void 0,uin:process.env.Uin||void 0,instance_id:process.env.ProjectId||void 0,is_ci:process.env.CI==="true"}}function yUe(e,t){try{if(typeof process.send!="function")return;process.send(JSON.stringify({name:e,value:JSON.stringify(t)}))}catch{}}function Cc(e){var r;let t={...gUe(),...e};yUe((r=t.event_name)!=null?r:"unknown",t)}function gh(e){if(e==null)return{message:"unknown error",stack:""};if(typeof e=="string")return{message:iO(e,QB),stack:""};if(typeof e=="object"){let t=e,r=iO(typeof t.message=="string"?t.message:String(t),QB),s=iO(typeof t.stack=="string"?t.stack:"",vUe);return{message:r,stack:s}}return{message:iO(String(e),QB),stack:""}}function iO(e,t){return e.length>t?e.slice(0,t)+"\u2026[truncated]":e}var e6,Tc,Pc,mUe,cne,QB,vUe,yg=_t(()=>{e6=nr(require("os"));ane();Tc={COMMAND:"command",REQUEST:"request",LOCAL_FLOW:"local_flow",EXIT:"exit"},Pc={SUCCESS:"success",FAIL:"fail",START:"start"},mUe=`cli-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;cne=(e,t)=>{let r=gh(t);Cc({event_name:"error",event_scope:Tc.COMMAND,event_result:Pc.FAIL,error_message:`${e} ${r.message}`.trim(),error_stack:r.stack})},QB=500,vUe=2e3});var wC,fE,t6=_t(()=>{wC={NEXTJS:"nextjs",NUXTJS:"nuxtjs",ASTRO:"astro",UNKNOWN:"unknown"},fE={FRAMEWORK_DETECT:"framework_detect",PLUGIN_RESOLVE:"plugin_resolve",PLUGIN_LOAD:"plugin_load",PLUGIN_HOOK:"plugin_hook",CONFIG_LOAD:"config_load"}});function SUe(e){if((e==null?void 0:e.code)===_Ue)return!0;let t=typeof e=="string"?e:e==null?void 0:e.message;return t==null?void 0:t.includes(xUe)}async function Sx(e=!1){try{let t=await dI(e);return Cc({event_name:"Config:Load:Success",event_scope:Tc.LOCAL_FLOW,event_phase:fE.CONFIG_LOAD,event_result:Pc.SUCCESS,has_build_command:(t==null?void 0:t.buildCommand)!=null,has_install_command:(t==null?void 0:t.installCommand)!=null,has_output_directory:(t==null?void 0:t.outputDirectory)!=null,has_node_version:(t==null?void 0:t.nodeVersion)!=null}),t}catch(t){let r=gh(t);if(Cc({event_name:"Config:Load:Fail",event_scope:Tc.LOCAL_FLOW,event_phase:fE.CONFIG_LOAD,event_result:Pc.FAIL,error_message:r.message}),SUe(t))throw t;return(0,mf.showError)()&&console.error("%c [ error ]-80","font-size:13px; background:pink; color:#bf2c9f;",t),null}}var xUe,_Ue,r6=_t(()=>{Wb();rI();yg();t6();xUe="[BLOCKING_CONFIG_ERROR]",_Ue="BLOCKING_CONFIG_ERROR"});var sO,Op,oO=_t(()=>{sO=[{funcName:"onRequestGet",method:"GET"},{funcName:"onRequestPost",method:"POST"},{funcName:"onRequestDelete",method:"DELETE"},{funcName:"onRequestPatch",method:"PATCH"},{funcName:"onRequestPut",method:"PUT"},{funcName:"onRequestHead",method:"HEAD"},{funcName:"onRequestOptions",method:"OPTIONS"}],Op=["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"]});async function bUe(e){let t;aO.default.statSync(e).isFile()?t=dE.default.resolve(dE.default.dirname(e)):t=e;let r=dE.default.parse(t).root;if(t===r)return null;for(;t!==r;){let s=dE.default.join(t,"package.json");try{return await aO.default.promises.access(s),s}catch{if(t=dE.default.dirname(t),t===r)break}}return null}async function hE(e){if(e.endsWith(".mjs"))return"esm";if(e.endsWith(".cjs"))return"commonjs";try{let t=await bUe(e);if(t&&JSON.parse(await aO.default.promises.readFile(t,"utf-8")).type==="module")return"esm"}catch(t){console.warn("Failed to read package.json:",t)}return"commonjs"}var aO,dE,TC=_t(()=>{aO=nr(require("fs")),dE=nr(require("path"))});function wUe(e){let t=n6.default.extname(e);return EUe[t]||"ts"}function CUe(e){return e.split(",").map(t=>t.trim()).map(t=>{let r=t.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(!r)return"";let[,s,a]=r;return!PUe.has(a)||s===a?"":`const ${a} = ${s};`}).filter(Boolean).join(`
|
|
168
|
+
`+new Error().stack),We[T]=!0)}t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;function Et(T){return typeof Function<"u"&&T instanceof Function||Object.prototype.toString.call(T)==="[object Function]"}var It={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Qe(T){return typeof T=="string"?It[T]||It[T.toLowerCase()]:void 0}function pe(T){var R={},V,X;for(X in T)n(T,X)&&(V=Qe(X),V&&(R[V]=T[X]));return R}var Le={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function Me(T){var R=[],V;for(V in T)n(T,V)&&R.push({unit:V,priority:Le[V]});return R.sort(function(X,oe){return X.priority-oe.priority}),R}function tt(T,R,V){var X=""+Math.abs(T),oe=R-X.length,He=T>=0;return(He?V?"+":"":"-")+Math.pow(10,Math.max(0,oe)).toString().substr(1)+X}var wt=/(\[[^\[]*\])|(\\e)|(\\)?(eHHmm|[Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,cr=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Pr={},ot={};function Ve(T,R,V,X){var oe=X;typeof X=="string"&&(oe=function(){return this[X]()}),T&&(ot[T]=oe),R&&(ot[R[0]]=function(){return tt(oe.apply(this,arguments),R[1],R[2])}),V&&(ot[V]=function(){return this.localeData().ordinal(oe.apply(this,arguments),T)})}function ze(T){return T.match(/\[[\s\S]/)?T.replace(/^\[|\]$/g,""):T.replace(/\\/g,"")}function Bt(T){var R=T.match(wt),V,X;for(V=0,X=R.length;V<X;V++)ot[R[V]]?R[V]=ot[R[V]]:R[V]=ze(R[V]);return function(oe){var He="",Gt;for(Gt=0;Gt<X;Gt++)He+=Et(R[Gt])?R[Gt].call(oe,T):R[Gt];return He}}function Oe(T,R){if(!T.isValid())return T.localeData().invalidDate();R=ft(R,T.localeData());var V="$"+R;return n(Pr,V)||(Pr[V]=Bt(R)),Pr[V](T)}function ft(T,R){var V=5;function X(oe){return R.longDateFormat(oe)||oe}for(cr.lastIndex=0;V>=0&&cr.test(T);)T=T.replace(cr,X),cr.lastIndex=0,V-=1;return T}var lt=/\d/,Kt=/\d\d/,zr=/\d{3}/,gr=/\d{4}/,pr=/[+-]?\d{6}/,D=/\d\d?/,Wt=/\d\d\d\d?/,ar=/\d\d\d\d\d\d?/,Qr=/\d{1,3}/,Yt=/\d{1,4}/,Vt=/[+-]?\d{1,6}/,Jt=/\d+/,Ce=/[+-]?\d+/,Be=/Z|[+-]\d\d:?\d\d/gi,gt=/Z|[+-]\d\d(?::?\d\d)?/gi,Zt=/[+-]?\d+(\.\d{1,3})?/,Ir=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,br=/^[1-9]\d?/,pn=/^([1-9]\d|\d)/,en;en={};function er(T,R,V){en[T]=Et(R)?R:function(X,oe){return X&&V?V:R}}function ts(T,R){return n(en,T)?en[T](R._strict,R._locale):new RegExp(M(T))}function M(T){return Je(T.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(R,V,X,oe,He){return V||X||oe||He}))}function Je(T){return T.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Ot(T){return T<0?Math.ceil(T)||0:Math.floor(T)}function St(T){var R=+T,V=0;return R!==0&&isFinite(R)&&(V=Ot(R)),V}var Ht={};function te(T,R){var V,X=R,oe;for(typeof T=="string"&&(T=[T]),d(R)&&(X=function(He,Gt){Gt[R]=St(He)}),oe=T.length,V=0;V<oe;V++)Ht[T[V]]=X}function ve(T,R){te(T,function(V,X,oe,He){oe._w=oe._w||{},R(V,oe._w,oe,He)})}function Re(T,R,V){R!=null&&n(Ht,T)&&Ht[T](R,V._a,V,T)}function Ge(T){return T%4===0&&T%100!==0||T%400===0}var et=0,Tt=1,st=2,$t=3,vr=4,Er=5,Fr=6,tn=7,yn=8;Ve("Y",0,0,function(){var T=this.year();return T<=9999?tt(T,4):"+"+T}),Ve(0,["YY",2],0,function(){return this.year()%100}),Ve(0,["YYYY",4],0,"year"),Ve(0,["YYYYY",5],0,"year"),Ve(0,["YYYYYY",6,!0],0,"year"),er("Y",Ce),er("YY",D,Kt),er("YYYY",Yt,gr),er("YYYYY",Vt,pr),er("YYYYYY",Vt,pr),te(["YYYYY","YYYYYY"],et),te("YYYY",function(T,R){R[et]=T.length===2?t.parseTwoDigitYear(T):St(T)}),te("YY",function(T,R){R[et]=t.parseTwoDigitYear(T)}),te("Y",function(T,R){R[et]=parseInt(T,10)});function rs(T){return Ge(T)?366:365}t.parseTwoDigitYear=function(T){return St(T)+(St(T)>68?1900:2e3)};var xo=To("FullYear",!0);function co(){return Ge(this.year())}function To(T,R){return function(V){return V!=null?(Gu(this,T,V),t.updateOffset(this,R),this):lo(this,T)}}function lo(T,R){if(!T.isValid())return NaN;var V=T._d,X=T._isUTC;switch(R){case"Milliseconds":return X?V.getUTCMilliseconds():V.getMilliseconds();case"Seconds":return X?V.getUTCSeconds():V.getSeconds();case"Minutes":return X?V.getUTCMinutes():V.getMinutes();case"Hours":return X?V.getUTCHours():V.getHours();case"Date":return X?V.getUTCDate():V.getDate();case"Day":return X?V.getUTCDay():V.getDay();case"Month":return X?V.getUTCMonth():V.getMonth();case"FullYear":return X?V.getUTCFullYear():V.getFullYear();default:return NaN}}function Gu(T,R,V){var X,oe,He,Gt,Mr;if(!(!T.isValid()||isNaN(V))){switch(X=T._d,oe=T._isUTC,R){case"Milliseconds":return void(oe?X.setUTCMilliseconds(V):X.setMilliseconds(V));case"Seconds":return void(oe?X.setUTCSeconds(V):X.setSeconds(V));case"Minutes":return void(oe?X.setUTCMinutes(V):X.setMinutes(V));case"Hours":return void(oe?X.setUTCHours(V):X.setHours(V));case"Date":return void(oe?X.setUTCDate(V):X.setDate(V));case"FullYear":break;default:return}He=V,Gt=T.month(),Mr=T.date(),Mr=Mr===29&&Gt===1&&!Ge(He)?28:Mr,oe?X.setUTCFullYear(He,Gt,Mr):X.setFullYear(He,Gt,Mr)}}function Aa(T){return T=Qe(T),Et(this[T])?this[T]():this}function hn(T,R){if(typeof T=="object"){T=pe(T);var V=Me(T),X,oe=V.length;for(X=0;X<oe;X++)this[V[X].unit](T[V[X].unit])}else if(T=Qe(T),Et(this[T]))return this[T](R);return this}function El(T,R){return(T%R+R)%R}var Ts;Array.prototype.indexOf?Ts=Array.prototype.indexOf:Ts=function(T){var R;for(R=0;R<this.length;++R)if(this[R]===T)return R;return-1};function lp(T,R){if(isNaN(T)||isNaN(R))return NaN;var V=El(R,12);return T+=(R-V)/12,V===1?Ge(T)?29:28:31-V%7%2}Ve("M",["MM",2],"Mo",function(){return this.month()+1}),Ve("MMM",0,0,function(T){return this.localeData().monthsShort(this,T)}),Ve("MMMM",0,0,function(T){return this.localeData().months(this,T)}),er("M",D,br),er("MM",D,Kt),er("MMM",function(T,R){return R.monthsShortRegex(T)}),er("MMMM",function(T,R){return R.monthsRegex(T)}),te(["M","MM"],function(T,R){R[Tt]=St(T)-1}),te(["MMM","MMMM"],function(T,R,V,X){var oe=V._locale.monthsParse(T,X,V._strict);oe!=null?R[Tt]=oe:x(V).invalidMonth=T});var pp="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),dc="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Da=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,wl=Ir,kc=Ir,Qc=["monthsParse","longMonthsParse","shortMonthsParse","monthsRegex","monthsShortRegex","monthsStrictRegex","monthsShortStrictRegex"];function Tl(T,R){var V,X;for(V=0;V<Qc.length;V++)X=Qc[V],n(R,X)||delete T["_"+X]}function qp(T,R){return T?s(this._months)?this._months[T.month()]:this._months[(this._months.isFormat||Da).test(R)?"format":"standalone"][T.month()]:s(this._months)?this._months:this._months.standalone}function ii(T,R){return T?s(this._monthsShort)?this._monthsShort[T.month()]:this._monthsShort[Da.test(R)?"format":"standalone"][T.month()]:s(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Dd(T,R,V){var X,oe,He,Gt=T.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],X=0;X<12;++X)He=P([2e3,X]),this._shortMonthsParse[X]=this.monthsShort(He,"").toLocaleLowerCase(),this._longMonthsParse[X]=this.months(He,"").toLocaleLowerCase();return V?R==="MMM"?(oe=Ts.call(this._shortMonthsParse,Gt),oe!==-1?oe:null):(oe=Ts.call(this._longMonthsParse,Gt),oe!==-1?oe:null):R==="MMM"?(oe=Ts.call(this._shortMonthsParse,Gt),oe!==-1?oe:(oe=Ts.call(this._longMonthsParse,Gt),oe!==-1?oe:null)):(oe=Ts.call(this._longMonthsParse,Gt),oe!==-1?oe:(oe=Ts.call(this._shortMonthsParse,Gt),oe!==-1?oe:null))}function el(T,R,V){var X,oe,He;if(this._monthsParseExact)return Dd.call(this,T,R,V);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),X=0;X<12;X++){if(oe=P([2e3,X]),V&&!this._longMonthsParse[X]&&(this._longMonthsParse[X]=new RegExp("^"+this.months(oe,"").replace(".","")+"$","i"),this._shortMonthsParse[X]=new RegExp("^"+this.monthsShort(oe,"").replace(".","")+"$","i")),!V&&!this._monthsParse[X]&&(He="^"+this.months(oe,"")+"|^"+this.monthsShort(oe,""),this._monthsParse[X]=new RegExp(He.replace(".",""),"i")),V&&R==="MMMM"&&this._longMonthsParse[X].test(T))return X;if(V&&R==="MMM"&&this._shortMonthsParse[X].test(T))return X;if(!V&&this._monthsParse[X].test(T))return X}}function hc(T,R){if(!T.isValid())return T;if(typeof R=="string"){if(/^\d+$/.test(R))R=St(R);else if(R=T.localeData().monthsParse(R),!d(R))return T}var V=R,X=T.date();return X=X<29?X:Math.min(X,lp(T.year(),V)),T._isUTC?T._d.setUTCMonth(V,X):T._d.setMonth(V,X),T}function Ps(T){return T!=null?(hc(this,T),t.updateOffset(this,!0),this):lo(this,"Month")}function Ms(){return lp(this.year(),this.month())}function Pl(T){return this._monthsParseExact?(n(this,"_monthsRegex")||ta.call(this),T?this._monthsShortStrictRegex:this._monthsShortRegex):(n(this,"_monthsShortRegex")||(this._monthsShortRegex=wl),this._monthsShortStrictRegex&&T?this._monthsShortStrictRegex:this._monthsShortRegex)}function ea(T){return this._monthsParseExact?(n(this,"_monthsRegex")||ta.call(this),T?this._monthsStrictRegex:this._monthsRegex):(n(this,"_monthsRegex")||(this._monthsRegex=kc),this._monthsStrictRegex&&T?this._monthsStrictRegex:this._monthsRegex)}function ta(){function T(ci,Jn){return Jn.length-ci.length}var R=[],V=[],X=[],oe,He,Gt,Mr;for(oe=0;oe<12;oe++)He=P([2e3,oe]),Gt=Je(this.monthsShort(He,"")),Mr=Je(this.months(He,"")),R.push(Gt),V.push(Mr),X.push(Mr),X.push(Gt);R.sort(T),V.sort(T),X.sort(T),this._monthsRegex=new RegExp("^("+X.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+V.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+R.join("|")+")","i")}Ve("d",0,"do","day"),Ve("dd",0,0,function(T){return this.localeData().weekdaysMin(this,T)}),Ve("ddd",0,0,function(T){return this.localeData().weekdaysShort(this,T)}),Ve("dddd",0,0,function(T){return this.localeData().weekdays(this,T)}),Ve("e",0,0,"weekday"),Ve("E",0,0,"isoWeekday"),Ve("eHHmm",0,0,function(){return""+this.weekday()+tt(this.hours(),2)+tt(this.minutes(),2)}),er("d",D),er("e",D),er("E",D),er("eHHmm",ar),er("dd",function(T,R){return R.weekdaysMinRegex(T)}),er("ddd",function(T,R){return R.weekdaysShortRegex(T)}),er("dddd",function(T,R){return R.weekdaysRegex(T)}),ve(["dd","ddd","dddd"],function(T,R,V,X){var oe=V._locale.weekdaysParse(T,X,V._strict);oe!=null?R.d=oe:x(V).invalidWeekday=T}),ve(["d","e","E"],function(T,R,V,X){R[X]=St(T)}),ve("eHHmm",function(T,R,V){var X=T.length-4;R.e=St(T.substr(0,X)),V._a[$t]=St(T.substr(X,2)),V._a[vr]=St(T.substr(X+2))});function Ku(T,R){return typeof T!="string"?T:isNaN(T)?(T=R.weekdaysParse(T),typeof T=="number"?T:null):parseInt(T,10)}function lu(T,R){return typeof T=="string"?R.weekdaysParse(T)%7||7:isNaN(T)?null:T}function ra(T,R){return T.slice(R,7).concat(T.slice(0,R))}var Up="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),T0="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),If="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),fp=Ir,pu=Ir,yr=Ir,Yu=["weekdaysParse","fullWeekdaysParse","shortWeekdaysParse","minWeekdaysParse","weekdaysRegex","weekdaysShortRegex","weekdaysMinRegex","weekdaysStrictRegex","weekdaysShortStrictRegex","weekdaysMinStrictRegex"];function Tm(T,R){var V,X;for(V=0;V<Yu.length;V++)X=Yu[V],n(R,X)||delete T["_"+X]}function $p(T,R){var V=s(this._weekdays)?this._weekdays:this._weekdays[T&&T!==!0&&this._weekdays.isFormat.test(R)?"format":"standalone"];return T===!0?ra(V,this._week.dow):T?V[T.day()]:V}function Cs(T){return T===!0?ra(this._weekdaysShort,this._week.dow):T?this._weekdaysShort[T.day()]:this._weekdaysShort}function Cl(T){return T===!0?ra(this._weekdaysMin,this._week.dow):T?this._weekdaysMin[T.day()]:this._weekdaysMin}function P0(T,R,V){var X,oe,He,Gt=T.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],X=0;X<7;++X)He=P([2e3,1]).day(X),this._minWeekdaysParse[X]=this.weekdaysMin(He,"").toLocaleLowerCase(),this._shortWeekdaysParse[X]=this.weekdaysShort(He,"").toLocaleLowerCase(),this._weekdaysParse[X]=this.weekdays(He,"").toLocaleLowerCase();return V?R==="dddd"?(oe=Ts.call(this._weekdaysParse,Gt),oe!==-1?oe:null):R==="ddd"?(oe=Ts.call(this._shortWeekdaysParse,Gt),oe!==-1?oe:null):(oe=Ts.call(this._minWeekdaysParse,Gt),oe!==-1?oe:null):R==="dddd"?(oe=Ts.call(this._weekdaysParse,Gt),oe!==-1||(oe=Ts.call(this._shortWeekdaysParse,Gt),oe!==-1)?oe:(oe=Ts.call(this._minWeekdaysParse,Gt),oe!==-1?oe:null)):R==="ddd"?(oe=Ts.call(this._shortWeekdaysParse,Gt),oe!==-1||(oe=Ts.call(this._weekdaysParse,Gt),oe!==-1)?oe:(oe=Ts.call(this._minWeekdaysParse,Gt),oe!==-1?oe:null)):(oe=Ts.call(this._minWeekdaysParse,Gt),oe!==-1||(oe=Ts.call(this._weekdaysParse,Gt),oe!==-1)?oe:(oe=Ts.call(this._shortWeekdaysParse,Gt),oe!==-1?oe:null))}function Pm(T,R,V){var X,oe,He;if(this._weekdaysParseExact)return P0.call(this,T,R,V);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),X=0;X<7;X++){if(oe=P([2e3,1]).day(X),V&&!this._fullWeekdaysParse[X]&&(this._fullWeekdaysParse[X]=new RegExp("^"+this.weekdays(oe,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[X]=new RegExp("^"+this.weekdaysShort(oe,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[X]=new RegExp("^"+this.weekdaysMin(oe,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[X]||(He="^"+this.weekdays(oe,"")+"|^"+this.weekdaysShort(oe,"")+"|^"+this.weekdaysMin(oe,""),this._weekdaysParse[X]=new RegExp(He.replace(".",""),"i")),V&&R==="dddd"&&this._fullWeekdaysParse[X].test(T))return X;if(V&&R==="ddd"&&this._shortWeekdaysParse[X].test(T))return X;if(V&&R==="dd"&&this._minWeekdaysParse[X].test(T))return X;if(!V&&this._weekdaysParse[X].test(T))return X}}function Of(T){if(!this.isValid())return T!=null?this:NaN;var R=lo(this,"Day");return T!=null?(T=Ku(T,this.localeData()),this.add(T-R,"d")):R}function kd(T){if(!this.isValid())return T!=null?this:NaN;var R=(this.day()+7-this.localeData()._week.dow)%7;return T==null?R:this.add(T-R,"d")}function qr(T){if(!this.isValid())return T!=null?this:NaN;if(T!=null){var R=lu(T,this.localeData());return this.day(this.day()%7?R:R-7)}else return this.day()||7}function Io(T){return this._weekdaysParseExact?(n(this,"_weekdaysRegex")||ma.call(this),T?this._weekdaysStrictRegex:this._weekdaysRegex):(n(this,"_weekdaysRegex")||(this._weekdaysRegex=fp),this._weekdaysStrictRegex&&T?this._weekdaysStrictRegex:this._weekdaysRegex)}function Nf(T){return this._weekdaysParseExact?(n(this,"_weekdaysRegex")||ma.call(this),T?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(n(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=pu),this._weekdaysShortStrictRegex&&T?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Al(T){return this._weekdaysParseExact?(n(this,"_weekdaysRegex")||ma.call(this),T?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(n(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=yr),this._weekdaysMinStrictRegex&&T?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function ma(){function T(Oo,ll){return ll.length-Oo.length}var R=[],V=[],X=[],oe=[],He,Gt,Mr,ci,Jn;for(He=0;He<7;He++)Gt=P([2e3,1]).day(He),Mr=Je(this.weekdaysMin(Gt,"")),ci=Je(this.weekdaysShort(Gt,"")),Jn=Je(this.weekdays(Gt,"")),R.push(Mr),V.push(ci),X.push(Jn),oe.push(Mr),oe.push(ci),oe.push(Jn);R.sort(T),V.sort(T),X.sort(T),oe.sort(T),this._weekdaysRegex=new RegExp("^("+oe.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+X.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+V.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+R.join("|")+")","i")}function Rf(T){var R,V;Tl(this,T),Tm(this,T);for(V in T)n(T,V)&&(R=T[V],Et(R)?this[V]=R:this["_"+V]=R);this._config=T,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function Id(T,R){var V=w({},T),X;for(X in R)n(R,X)&&(a(T[X])&&a(R[X])?(V[X]={},w(V[X],T[X]),w(V[X],R[X])):R[X]!=null?V[X]=R[X]:delete V[X]);for(X in T)n(T,X)&&!n(R,X)&&a(T[X])&&(V[X]=w({},V[X]));return V}function Od(T){T!=null&&this.set(T)}var Nd;Object.keys?Nd=Object.keys:Nd=function(T){var R,V=[];for(R in T)n(T,R)&&V.push(R);return V};var Du={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function mc(T,R,V){var X=this._calendar[T]||this._calendar.sameElse;return Et(X)?X.call(R,V):X}var Nh={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function Cm(T){var R=this._longDateFormat[T],V=this._longDateFormat[T.toUpperCase()],X=this._longDateFormatCache;return R||!V?R:X&&X[T]&&X[T].formatUpper===V?X[T].format:(R=V.match(wt).map(function(oe){return oe==="MMMM"||oe==="MM"||oe==="DD"||oe==="dddd"?oe.slice(1):oe}).join(""),X||(X=this._longDateFormatCache={}),X[T]={formatUpper:V,format:R},R)}var Ff="Invalid date";function fu(){return this._invalidDate}var Vp="%d",Ju=/\d{1,2}/;function dp(T){return this._ordinal.replace("%d",T)}var Ic={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Oc(T,R,V,X){var oe=this._relativeTime[V];return Et(oe)?oe(T,R,V,X):oe.replace(/%d/i,T)}function Nc(T,R,V,X){return this.postformat(Oc.call(this,T,R,V,X))}function tl(T,R){var V=this._relativeTime[T>0?"future":"past"];return Et(V)?V(R):V.replace(/%s/i,R)}function Po(T,R){return this.postformat(tl.call(this,T,R))}function pi(T,R,V,X,oe,He,Gt){var Mr;return T<100&&T>=0?(Mr=new Date(T+400,R,V,X,oe,He,Gt),isFinite(Mr.getFullYear())&&Mr.setFullYear(T)):Mr=new Date(T,R,V,X,oe,He,Gt),Mr}function za(T){var R,V;return T<100&&T>=0?(V=Array.prototype.slice.call(arguments),V[0]=T+400,R=new Date(Date.UTC.apply(null,V)),isFinite(R.getUTCFullYear())&&R.setUTCFullYear(T)):R=new Date(Date.UTC.apply(null,arguments)),R}function Lf(T,R,V){var X=7+R-V,oe=(7+za(T,0,X).getUTCDay()-R)%7;return-oe+X-1}function fi(T,R,V,X,oe){var He=(7+V-X)%7,Gt=Lf(T,X,oe),Mr=1+7*(R-1)+He+Gt,ci,Jn;return Mr<=0?(ci=T-1,Jn=rs(ci)+Mr):Mr>rs(T)?(ci=T+1,Jn=Mr-rs(T)):(ci=T,Jn=Mr),{year:ci,dayOfYear:Jn}}function ls(T,R,V,X){var oe=Lf(T,V,X),He=Math.floor((R-oe-1)/7)+1,Gt,Mr;return He<1?(Mr=T-1,Gt=He+ku(Mr,V,X)):He>ku(T,V,X)?(Gt=He-ku(T,V,X),Mr=T+1):(Mr=T,Gt=He),{week:Gt,year:Mr}}function Hp(T,R,V){return ls(T.year(),T.dayOfYear(),R,V)}function gc(T,R,V,X,oe){var He=Math.round((za(T,R,V)-za(T,0,1))/864e5)+1;return ls(T,He,X,oe)}function ku(T,R,V){var X=Lf(T,R,V),oe=Lf(T+1,R,V);return(rs(T)-X+oe)/7}Ve("w",["ww",2],"wo","week"),Ve("W",["WW",2],"Wo","isoWeek"),er("w",D,br),er("ww",D,Kt),er("W",D,br),er("WW",D,Kt),ve(["w","ww","W","WW"],function(T,R,V,X){R[X.substr(0,1)]=St(T)});function Wa(T){return Hp(T,this._week.dow,this._week.doy).week}var Rd={dow:0,doy:6};function C0(){return this._week.dow}function Xu(){return this._week.doy}function Iu(T){var R=this.localeData().week(this);return T==null?R:this.add((T-R)*7,"d")}function Co(T){var R=Hp(this,1,4).week;return T==null?R:this.add((T-R)*7,"d")}function Rc(){return this.hours()%12||12}function hp(){return this.hours()||24}Ve("H",["HH",2],0,"hour"),Ve("h",["hh",2],0,Rc),Ve("k",["kk",2],0,hp),Ve("hmm",0,0,function(){return""+Rc.apply(this)+tt(this.minutes(),2)}),Ve("hmmss",0,0,function(){return""+Rc.apply(this)+tt(this.minutes(),2)+tt(this.seconds(),2)}),Ve("Hmm",0,0,function(){return""+this.hours()+tt(this.minutes(),2)}),Ve("Hmmss",0,0,function(){return""+this.hours()+tt(this.minutes(),2)+tt(this.seconds(),2)});function ga(T,R){Ve(T,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),R)})}ga("a",!0),ga("A",!1);function Dl(T,R){return R._meridiemParse}er("a",Dl),er("A",Dl),er("H",D,pn),er("h",D,br),er("k",D,br),er("HH",D,Kt),er("hh",D,Kt),er("kk",D,Kt),er("hmm",Wt),er("hmmss",ar),er("Hmm",Wt),er("Hmmss",ar),te(["H","HH"],$t),te(["k","kk"],function(T,R,V){var X=St(T);R[$t]=X===24?0:X}),te(["a","A"],function(T,R,V){V._isPm=V._locale.isPM(T),V._meridiem=T}),te(["h","hh"],function(T,R,V){R[$t]=St(T),x(V).bigHour=!0}),te("hmm",function(T,R,V){var X=T.length-2;R[$t]=St(T.substr(0,X)),R[vr]=St(T.substr(X)),x(V).bigHour=!0}),te("hmmss",function(T,R,V){var X=T.length-4,oe=T.length-2;R[$t]=St(T.substr(0,X)),R[vr]=St(T.substr(X,2)),R[Er]=St(T.substr(oe)),x(V).bigHour=!0}),te("Hmm",function(T,R,V){var X=T.length-2;R[$t]=St(T.substr(0,X)),R[vr]=St(T.substr(X))}),te("Hmmss",function(T,R,V){var X=T.length-4,oe=T.length-2;R[$t]=St(T.substr(0,X)),R[vr]=St(T.substr(X,2)),R[Er]=St(T.substr(oe))});function Ga(T){return(T+"").toLowerCase().charAt(0)==="p"}var Fc=/[ap]\.?m?\.?/i,kl=To("Hours",!0);function _e(T,R,V){return T>11?V?"pm":"PM":V?"am":"AM"}var fe={calendar:Du,longDateFormat:Nh,invalidDate:Ff,ordinal:Vp,dayOfMonthOrdinalParse:Ju,relativeTime:Ic,months:pp,monthsShort:dc,week:Rd,weekdays:Up,weekdaysMin:If,weekdaysShort:T0,meridiemParse:Fc},ge={},Xe={},yt;function At(T,R){var V,X=Math.min(T.length,R.length);for(V=0;V<X;V+=1)if(T[V]!==R[V])return V;return X}function Ft(T){return T&&T.toLowerCase().replace("_","-")}function rr(T){for(var R=0,V,X,oe,He;R<T.length;){for(He=Ft(T[R]).split("-"),V=He.length,X=Ft(T[R+1]),X=X?X.split("-"):null;V>0;){if(oe=Ur(He.slice(0,V).join("-")),oe)return oe;if(X&&X.length>=V&&At(He,X)>=V-1)break;V--}R++}return yt}function xr(T){return typeof T=="string"&&/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(T)}function Ur(T){var R=null,V,X;if(n(ge,T))return ge[T];if(X=Ft(T),n(ge,X))return ge[X];if(typeof lE<"u"&&lE&&lE.exports&&xr(X))try{R=yt._abbr,V=require,V("./locale/"+X),Rn(R)}catch{ge[X]=null}if(n(ge,X))return ge[X]}function Rn(T,R){var V;return T&&(p(R)?V=Bs(T):V=Mi(T,R),V?yt=V:typeof console<"u"&&console.warn&&console.warn("Locale "+T+" not found. Did you forget to load it?")),yt._abbr}function Mi(T,R){if(R!==null){var V,X=fe;if(R.abbr=T,ge[T]!=null)Rt("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),X=ge[T]._config;else if(R.parentLocale!=null)if(ge[R.parentLocale]!=null)X=ge[R.parentLocale]._config;else if(V=Ur(R.parentLocale),V!=null)X=V._config;else return Xe[R.parentLocale]||(Xe[R.parentLocale]=[]),Xe[R.parentLocale].push({name:T,config:R}),null;return ge[T]=new Od(Id(X,R)),Xe[T]&&Xe[T].forEach(function(oe){Mi(oe.name,oe.config)}),Rn(T),ge[T]}else return delete ge[T],null}function vn(T,R){var V,X=Ur(T),oe=fe;return X!=null&&(T=X._abbr),R!=null?(ge[T]!=null&&ge[T].parentLocale!=null?ge[T].set(Id(ge[T]._config,R)):(X!=null&&(oe=X._config),R=Id(oe,R),X==null&&(R.abbr=T),V=new Od(R),V.parentLocale=ge[T],ge[T]=V),Rn(T)):ge[T]!=null&&(ge[T].parentLocale!=null?(ge[T]=ge[T].parentLocale,T===Rn()&&Rn(T)):ge[T]!=null&&delete ge[T]),ge[T]}function Bs(T){var R;if(T&&T._locale&&T._locale._abbr&&(T=T._locale._abbr),!T)return yt;if(!s(T)){if(R=Ur(T),R)return R;T=[T]}return rr(T)}function Il(){return Nd(ge)}function Ka(T){var R,V=T._a;return V&&x(T).overflow===-2&&(R=V[Tt]<0||V[Tt]>11?Tt:V[st]<1||V[st]>lp(V[et],V[Tt])?st:V[$t]<0||V[$t]>24||V[$t]===24&&(V[vr]!==0||V[Er]!==0||V[Fr]!==0)?$t:V[vr]<0||V[vr]>59?vr:V[Er]<0||V[Er]>59?Er:V[Fr]<0||V[Fr]>999?Fr:-1,x(T)._overflowDayOfYear&&(R<et||R>st)&&(R=st),x(T)._overflowWeeks&&R===-1&&(R=tn),x(T)._overflowWeekday&&R===-1&&(R=yn),x(T).overflow=R),T}var ya=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ji=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Hn=/Z|[+-]\d\d(?::?\d\d)?/,mn=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Dn=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ci=/^\/?Date\((-?\d+)/i,ns=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Bo={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function du(T){var R,V,X=T._i,oe=ya.exec(X)||Ji.exec(X),He,Gt,Mr,ci,Jn=mn.length,Oo=Dn.length;if(oe){for(x(T).iso=!0,R=0,V=Jn;R<V;R++)if(mn[R][1].exec(oe[1])){Gt=mn[R][0],He=mn[R][2]!==!1;break}if(Gt==null){T._isValid=!1;return}if(oe[3]){for(R=0,V=Oo;R<V;R++)if(Dn[R][1].exec(oe[3])){Mr=(oe[2]||" ")+Dn[R][0];break}if(Mr==null){T._isValid=!1;return}}if(!He&&Mr!=null){T._isValid=!1;return}if(oe[4])if(Hn.exec(oe[4]))ci="Z";else{T._isValid=!1;return}T._f=Gt+(Mr||"")+(ci||""),na(T)}else T._isValid=!1}function rl(T,R,V,X,oe,He){var Gt=[zo(T),dc.indexOf(R),parseInt(V,10),parseInt(X,10),parseInt(oe,10)];return He&&Gt.push(parseInt(He,10)),Gt}function zo(T){var R=parseInt(T,10);return R<=49?2e3+R:R<=999?1900+R:R}function hu(T){return T.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function mu(T,R,V){if(T){var X=T0.indexOf(T),oe=new Date(R[0],R[1],R[2]).getDay();if(X!==oe)return x(V).weekdayMismatch=!0,V._isValid=!1,!1}return!0}function zp(T,R,V){if(T)return Bo[T];if(R)return 0;var X=parseInt(V,10),oe=X%100,He=(X-oe)/100;return He*60+oe}function Ol(T){var R=ns.exec(hu(T._i)),V;if(R){if(V=rl(R[4],R[3],R[2],R[5],R[6],R[7]),!mu(R[1],V,T))return;T._a=V,T._tzm=zp(R[8],R[9],R[10]),T._d=za.apply(null,T._a),T._d.setUTCMinutes(T._d.getUTCMinutes()-T._tzm),x(T).rfc2822=!0}else T._isValid=!1}function yc(T){var R=Ci.exec(T._i);if(R!==null){T._d=new Date(+R[1]);return}if(du(T),T._isValid===!1)delete T._isValid;else return;if(Ol(T),T._isValid===!1)delete T._isValid;else return;T._strict?T._isValid=!1:t.createFromInputFallback(T)}t.createFromInputFallback=rt("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(T){T._d=new Date(T._i+(T._useUTC?" UTC":""))});function nl(T,R,V){return T!=null?T:R!=null?R:V}function ka(T,R,V){var X=Object.prototype.hasOwnProperty.call(T,"_isDefaultDatePartsForWeek"),oe=T._isDefaultDatePartsForWeek;T._isDefaultDatePartsForWeek=!!V;try{return t._getDefaultDateParts(T,R,V)}finally{X?T._isDefaultDatePartsForWeek=oe:delete T._isDefaultDatePartsForWeek}}function Ei(T){var R=T._defaultDatePartsNow;return R?(R.hasValue||(R.value=t.now(),R.hasValue=!0),R.value):t.now()}function Rh(T,R,V){var X=V||T._isDefaultDatePartsForWeek,oe=X?po(R):new Date(R);return X?[oe.year(),oe.month(),oe.date()]:T._useUTC?[oe.getUTCFullYear(),oe.getUTCMonth(),oe.getUTCDate()]:[oe.getFullYear(),oe.getMonth(),oe.getDate()]}t._getDefaultDateParts=Rh;function js(T){var R,V,X=[],oe,He,Gt,Mr,ci;if(!T._d){for((T._a[et]==null||T._a[Tt]==null||T._a[st]==null)&&(oe=Ei(T),He=ka(T,oe)),T._w&&T._a[st]==null&&T._a[Tt]==null&&Fh(T,ka(T,oe,!0)),T._dayOfYear!=null&&(Mr=T._a[et]!=null?T._a[et]:He[et],(T._dayOfYear>rs(Mr)||T._dayOfYear===0)&&(x(T)._overflowDayOfYear=!0),V=za(Mr,0,T._dayOfYear),T._a[Tt]=V.getUTCMonth(),T._a[st]=V.getUTCDate()),ci=T._a[et]==null||T._a[Tt]==null||T._a[st]==null,R=0;R<3&&T._a[R]==null;++R)T._a[R]=X[R]=He[R];for(;R<7;R++)T._a[R]=X[R]=T._a[R]==null?R===2?1:0:T._a[R];T._a[$t]===24&&T._a[vr]===0&&T._a[Er]===0&&T._a[Fr]===0&&(T._nextDay=!0,T._a[$t]=0),T._d=(T._useUTC?za:pi).apply(null,X),Gt=T._useUTC?T._d.getUTCDay():T._d.getDay(),T._tzm!=null&&T._d.setUTCMinutes(T._d.getUTCMinutes()-T._tzm),T._nextDay&&(T._a[$t]=24),T._w&&typeof T._w.d<"u"&&!ci&&T._w.d!==Gt&&(x(T).weekdayMismatch=!0)}}function Fh(T,R){var V,X,oe,He,Gt,Mr,ci,Jn,Oo;V=T._w,V.GG!=null||V.W!=null||V.E!=null?(Gt=1,Mr=4,X=nl(V.GG,T._a[et],gc(R[et],R[Tt],R[st],1,4).year),oe=nl(V.W,1),He=nl(V.E,1),(He<1||He>7)&&(Jn=!0)):(Gt=T._locale._week.dow,Mr=T._locale._week.doy,Oo=gc(R[et],R[Tt],R[st],Gt,Mr),X=nl(V.gg,T._a[et],Oo.year),oe=nl(V.w,Oo.week),V.d!=null?(He=V.d,(He<0||He>6)&&(Jn=!0)):V.e!=null?(He=V.e+Gt,(V.e<0||V.e>6)&&(Jn=!0)):He=Gt),oe<1||oe>ku(X,Gt,Mr)?x(T)._overflowWeeks=!0:Jn!=null?x(T)._overflowWeekday=!0:(ci=fi(X,oe,He,Gt,Mr),T._a[et]=ci.year,T._dayOfYear=ci.dayOfYear)}t.ISO_8601=function(){},t.RFC_2822=function(){};function na(T){if(T._f===t.ISO_8601){du(T);return}if(T._f===t.RFC_2822){Ol(T);return}T._a=[],x(T).empty=!0;var R=""+T._i,V,X,oe,He,Gt,Mr=R.length,ci=0,Jn,Oo;for(oe=ft(T._f,T._locale).match(wt)||[],Oo=oe.length,V=0;V<Oo;V++)He=oe[V],X=(R.match(ts(He,T))||[])[0],X&&(Gt=R.substr(0,R.indexOf(X)),Gt.length>0&&x(T).unusedInput.push(Gt),R=R.slice(R.indexOf(X)+X.length),ci+=X.length),ot[He]?(X?x(T).empty=!1:x(T).unusedTokens.push(He),Re(He,X,T)):T._strict&&!X&&x(T).unusedTokens.push(He);x(T).charsLeftOver=Mr-ci,R.length>0&&x(T).unusedInput.push(R),T._a[$t]<=12&&x(T).bigHour===!0&&T._a[$t]>0&&(x(T).bigHour=void 0),x(T).parsedDateParts=T._a.slice(0),x(T).meridiem=T._meridiem,T._a[$t]=Xi(T._locale,T._a[$t],T._meridiem),Jn=x(T).era,Jn!==null&&(T._a[et]=T._locale.erasConvertYear(Jn,T._a[et])),js(T),Ka(T)}function Xi(T,R,V){var X;return V==null?R:T.meridiemHour!=null?T.meridiemHour(R,V):(T.isPM!=null&&(X=T.isPM(V),X&&R<12&&(R+=12),!X&&R===12&&(R=0)),R)}function vc(T){var R,V,X,oe,He,Gt,Mr=!1,ci={},Jn=T._f.length;if(Jn===0){x(T).invalidFormat=!0,T._d=new Date(NaN);return}for(oe=0;oe<Jn;oe++)He=0,Gt=!1,R=ne({},T),T._useUTC!=null&&(R._useUTC=T._useUTC),R._defaultDatePartsNow=ci,R._f=T._f[oe],na(R),q(R)&&(Gt=!0),He+=x(R).charsLeftOver,He+=x(R).unusedTokens.length*10,x(R).score=He,Mr?He<X&&(X=He,V=R):(X==null||He<X||Gt)&&(X=He,V=R,Gt&&(Mr=!0));w(T,V||R)}function Lh(T){if(!T._d){var R=pe(T._i),V=R.day===void 0?R.date:R.day;T._a=y([R.year,R.month,V,R.hour,R.minute,R.second,R.millisecond],function(X){return X&&parseInt(X,10)}),js(T)}}function Fd(T){var R=new me(Ka(Am(T)));return R._nextDay&&(R.add(1,"d"),R._nextDay=void 0),R}function Am(T){var R=T._i,V=T._f;return T._locale=T._locale||Bs(T._l),R===null||V===void 0&&R===""?F({nullInput:!0}):(typeof R=="string"&&(T._i=R=T._locale.preparse(R)),Ae(R)?new me(Ka(R)):(h(R)?T._d=R:s(V)?vc(T):V?na(T):Ld(T),q(T)||(T._d=null),T))}function Ld(T){var R=T._i;p(R)?T._d=new Date(t.now()):h(R)?T._d=new Date(R.valueOf()):typeof R=="string"?yc(T):s(R)?(T._a=y(R.slice(0),function(V){return parseInt(V,10)}),js(T)):a(R)?Lh(T):d(R)?T._d=new Date(R):t.createFromInputFallback(T)}function Md(T,R,V,X,oe){var He={};return(R===!0||R===!1)&&(X=R,R=void 0),(V===!0||V===!1)&&(X=V,V=void 0),(a(T)&&c(T)||s(T)&&T.length===0)&&(T=void 0),He._isAMomentObject=!0,He._useUTC=He._isUTC=oe,He._l=V,He._i=T,He._f=R,He._strict=X,Fd(He)}function po(T,R,V,X){return Md(T,R,V,X,!1)}var mp=rt("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var T=po.apply(null,arguments);return this.isValid()&&T.isValid()?T<this?this:T:F()}),Lc=rt("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var T=po.apply(null,arguments);return this.isValid()&&T.isValid()?T>this?this:T:F()});function Ou(T,R){var V,X;if(R.length===1&&s(R[0])&&(R=R[0]),!R.length)return po();for(X=0;X<R.length;++X)if(Ae(R[X])){V=R[X];break}if(!V)return F();for(++X;X<R.length;++X)Ae(R[X])&&(!R[X].isValid()||R[X][T](V))&&(V=R[X]);return V}function gu(){var T=[].slice.call(arguments,0);return Ou("isBefore",T)}function Bd(){var T=[].slice.call(arguments,0);return Ou("isAfter",T)}var jo=function(){return Date.now?Date.now():+new Date},ia=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ao(T){var R,V=!1,X,oe=ia.length;for(R in T)if(n(T,R)&&!(Ts.call(ia,R)!==-1&&(T[R]==null||!isNaN(T[R]))))return!1;for(X=0;X<oe;++X)if(T[ia[X]]){if(V)return!1;parseFloat(T[ia[X]])!==St(T[ia[X]])&&(V=!0)}return!0}function Ia(){return this._isValid}function Mf(){return Ai(NaN)}function Zi(T){var R=pe(T),V=R.year||0,X=R.quarter||0,oe=R.month||0,He=R.week||R.isoWeek||0,Gt=R.day||0,Mr=R.hour||0,ci=R.minute||0,Jn=R.second||0,Oo=R.millisecond||0;this._isValid=Ao(R),this._milliseconds=+Oo+Jn*1e3+ci*6e4+Mr*1e3*60*60,this._days=+Gt+He*7,this._months=+oe+X*3+V*12,this._data={},this._locale=Bs(),this._bubble()}function jd(T){return T instanceof Zi}function Mh(T){return T<0?Math.round(-1*T)*-1:Math.round(T)}function yu(T,R,V){var X=Math.min(T.length,R.length),oe=Math.abs(T.length-R.length),He=0,Gt;for(Gt=0;Gt<X;Gt++)St(T[Gt])!==St(R[Gt])&&He++;return He+oe}function vu(T,R){Ve(T,0,0,function(){var V=this.utcOffset(),X="+";return V<0&&(V=-V,X="-"),X+tt(~~(V/60),2)+R+tt(~~V%60,2)})}vu("Z",":"),vu("ZZ",""),er("Z",gt),er("ZZ",gt),te(["Z","ZZ"],function(T,R,V){var X=ct(gt,T);V._useUTC=!0,V._tzm=X,X===null&&(x(V).invalidOffset=T)});var sa=/([\+\-]|\d\d)/gi;function ct(T,R){var V=(R||"").match(T),X,oe,He;return V===null||(X=V[V.length-1]||[],oe=(X+"").match(sa)||["-",0,0],He=+(oe[1]*60)+St(oe[2]),St(oe[2])>59||(oe[0]==="+"?He>14*60:He>12*60))?null:He===0?0:oe[0]==="+"?He:-He}function Qt(T,R){var V,X;return R._isUTC?(V=R.clone(),X=(Ae(T)||h(T)?T.valueOf():po(T).valueOf())-V.valueOf(),V._d.setTime(V._d.valueOf()+X),t.updateOffset(V,!1),V):po(T).local()}function Ut(T){return-Math.round(T._d.getTimezoneOffset())}t.updateOffset=function(){};function Cr(T,R,V){var X=this._offset||0,oe;if(!this.isValid())return T!=null?this:NaN;if(T!=null){if(typeof T=="string"){if(T=ct(gt,T),T===null)return this}else Math.abs(T)<16&&!V&&(T=T*60);return!this._isUTC&&R&&(oe=Ut(this)),this._offset=T,this._isUTC=!0,oe!=null&&this.add(oe,"m"),X!==T&&(!R||this._changeInProgress?Bh(this,Ai(T-X,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?X:Ut(this)}function Fn(T,R){return T!=null?(typeof T!="string"&&(T=-T),this.utcOffset(T,R),this):-this.utcOffset()}function $i(T){return this.utcOffset(0,T)}function eo(T){return this._isUTC&&(this.utcOffset(0,T),this._isUTC=!1,T&&this.subtract(Ut(this),"m")),this}function qs(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var T=ct(Be,this._i);T!=null?this.utcOffset(T):this.utcOffset(0,!0)}return this}function Mc(T){return this.isValid()?(T=T?po(T).utcOffset():0,(this.utcOffset()-T)%60===0):!1}function Dm(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ya(){if(!p(this._isDSTShifted))return this._isDSTShifted;var T={},R;return ne(T,this),T=Am(T),T._a?(R=T._isUTC?P(T._a):po(T._a),this._isDSTShifted=this.isValid()&&yu(T._a,R.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Ja(){return this.isValid()?!this._isUTC:!1}function Vi(){return this.isValid()?this._isUTC:!1}function il(){return this.isValid()?this._isUTC&&this._offset===0:!1}var qd=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Bf=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Ai(T,R){var V=T,X=null,oe,He,Gt;return jd(T)?V={ms:T._milliseconds,d:T._days,M:T._months}:d(T)||!isNaN(+T)?(V={},R?V[R]=+T:V.milliseconds=+T):(X=qd.exec(T))?(oe=X[1]==="-"?-1:1,V={y:0,d:St(X[st])*oe,h:St(X[$t])*oe,m:St(X[vr])*oe,s:St(X[Er])*oe,ms:St(Mh(X[Fr]*1e3))*oe}):(X=Bf.exec(T))?(oe=X[1]==="-"?-1:1,V={y:Wp(X[2],oe),M:Wp(X[3],oe),w:Wp(X[4],oe),d:Wp(X[5],oe),h:Wp(X[6],oe),m:Wp(X[7],oe),s:Wp(X[8],oe)}):V==null?V={}:typeof V=="object"&&("from"in V||"to"in V)&&(Gt=Im(po(V.from),po(V.to)),V={},V.ms=Gt.milliseconds,V.M=Gt.months),He=new Zi(V),jd(T)&&n(T,"_locale")&&(He._locale=T._locale),jd(T)&&n(T,"_isValid")&&(He._isValid=T._isValid),He}Ai.fn=Zi.prototype,Ai.invalid=Mf;function Wp(T,R){var V=T&&parseFloat(T.replace(",","."));return(isNaN(V)?0:V)*R}function km(T,R){var V={};return V.months=R.month()-T.month()+(R.year()-T.year())*12,T.clone().add(V.months,"M").isAfter(R)&&--V.months,V.milliseconds=+R-+T.clone().add(V.months,"M"),V}function Im(T,R){var V;return T.isValid()&&R.isValid()?(R=Qt(R,T),T.isBefore(R)?V=km(T,R):(V=km(R,T),V.milliseconds=-V.milliseconds,V.months=-V.months),V):{milliseconds:0,months:0}}function A0(T,R){return function(V,X){var oe,He;return X!==null&&!isNaN(+X)&&(Rt(R,"moment()."+R+"(period, number) is deprecated. Please use moment()."+R+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),He=V,V=X,X=He),oe=Ai(V,X),Bh(this,oe,T),this}}function Bh(T,R,V,X){var oe=R._milliseconds,He=Mh(R._days),Gt=Mh(R._months);T.isValid()&&(X=X==null?!0:X,Gt&&hc(T,lo(T,"Month")+Gt*V),He&&Gu(T,"Date",lo(T,"Date")+He*V),oe&&T._d.setTime(T._d.valueOf()+oe*V),X&&t.updateOffset(T,He||Gt))}var Zy=A0(1,"add"),Zu=A0(-1,"subtract");function xu(T){return typeof T=="string"||T instanceof String}function Oa(T){return Ae(T)||h(T)||xu(T)||d(T)||Na(T)||xc(T)||T===null||T===void 0}function xc(T){var R=a(T)&&!c(T),V=!1,X=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],oe,He,Gt=X.length;for(oe=0;oe<Gt;oe+=1)He=X[oe],V=V||n(T,He);return R&&V}function Na(T){var R=s(T),V=!1;return R&&(V=T.filter(function(X){return!d(X)&&xu(T)}).length===0),R&&V}function Gp(T){var R=a(T)&&!c(T),V=!1,X=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],oe,He;for(oe=0;oe<X.length;oe+=1)He=X[oe],V=V||n(T,He);return R&&V}function Nl(T,R){var V=T.diff(R,"days",!0);return V<-6?"sameElse":V<-1?"lastWeek":V<0?"lastDay":V<1?"sameDay":V<2?"nextDay":V<7?"nextWeek":"sameElse"}function Bc(T,R){arguments.length===1&&(arguments[0]?Oa(arguments[0])?(T=arguments[0],R=void 0):Gp(arguments[0])&&(R=arguments[0],T=void 0):(T=void 0,R=void 0));var V=T||po(),X=Qt(V,this).startOf("day"),oe=t.calendarFormat(this,X)||"sameElse",He=R&&(Et(R[oe])?R[oe].call(this,V):R[oe]);return this.format(He||this.localeData().calendar(oe,this,po(V)))}function jf(){return new me(this)}function Rl(T,R){var V=Ae(T)?T:po(T);return this.isValid()&&V.isValid()?(R=Qe(R)||"millisecond",R==="millisecond"?this.valueOf()>V.valueOf():V.valueOf()<this.clone().startOf(R).valueOf()):!1}function sl(T,R){var V=Ae(T)?T:po(T);return this.isValid()&&V.isValid()?(R=Qe(R)||"millisecond",R==="millisecond"?this.valueOf()<V.valueOf():this.clone().endOf(R).valueOf()<V.valueOf()):!1}function jh(T,R,V,X){var oe=Ae(T)?T:po(T),He=Ae(R)?R:po(R);return this.isValid()&&oe.isValid()&&He.isValid()?(X=X||"()",(X[0]==="("?this.isAfter(oe,V):!this.isBefore(oe,V))&&(X[1]===")"?this.isBefore(He,V):!this.isAfter(He,V))):!1}function Om(T,R){var V=Ae(T)?T:po(T),X;return this.isValid()&&V.isValid()?(R=Qe(R)||"millisecond",R==="millisecond"?this.valueOf()===V.valueOf():(X=V.valueOf(),this.clone().startOf(R).valueOf()<=X&&X<=this.clone().endOf(R).valueOf())):!1}function Ud(T,R){return this.isSame(T,R)||this.isAfter(T,R)}function Kp(T,R){return this.isSame(T,R)||this.isBefore(T,R)}function qh(T,R,V){var X,oe,He;if(!this.isValid())return NaN;if(X=Qt(T,this),!X.isValid())return NaN;switch(oe=(X.utcOffset()-this.utcOffset())*6e4,R=Qe(R),R){case"year":He=Xa(this,X)/12;break;case"month":He=Xa(this,X);break;case"quarter":He=Xa(this,X)/3;break;case"second":He=(this-X)/1e3;break;case"minute":He=(this-X)/6e4;break;case"hour":He=(this-X)/36e5;break;case"day":He=(this-X-oe)/864e5;break;case"week":He=(this-X-oe)/6048e5;break;default:He=this-X}return V?He:Ot(He)}function Xa(T,R){if(T.date()<R.date())return-Xa(R,T);var V=(R.year()-T.year())*12+(R.month()-T.month()),X=T.clone().add(V,"months"),oe,He;return R-X<0?(oe=T.clone().add(V-1,"months"),He=(R-X)/(X-oe)):(oe=T.clone().add(V+1,"months"),He=(R-X)/(oe-X)),-(V+He)||0}t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function D0(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function $d(T){if(!this.isValid())return null;var R=T!==!0,V=R?this.clone().utc():this;return V.year()<0||V.year()>9999?Oe(V,R?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):Et(Date.prototype.toISOString)?R?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Oe(V,"Z")):Oe(V,R?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Vd(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var T="moment",R="",V,X,oe,He;return this.isLocal()||(T=this.utcOffset()===0?"moment.utc":"moment.parseZone",R="Z"),V="["+T+'("]',X=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",oe="-MM-DD[T]HH:mm:ss.SSS",He=R+'[")]',this.format(V+X+oe+He)}function Uh(T){T||(T=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var R=Oe(this,T);return this.localeData().postformat(R)}function Qy(T,R){return this.isValid()&&(Ae(T)&&T.isValid()||po(T).isValid())?Ai({to:this,from:T}).locale(this.locale()).humanize(!R):this.localeData().invalidDate()}function gi(T){return this.from(po(),T)}function ys(T,R){return this.isValid()&&(Ae(T)&&T.isValid()||po(T).isValid())?Ai({from:this,to:T}).locale(this.locale()).humanize(!R):this.localeData().invalidDate()}function ol(T){return this.to(po(),T)}function jc(T){var R;return T===void 0?this._locale._abbr:(R=Bs(T),R!=null&&(this._locale=R),this)}var al=rt("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(T){return T===void 0?this.localeData():this.locale(T)});function Qu(){return this._locale}var qc=1e3,Ra=60*qc,Hd=60*Ra,gp=(365*400+97)*24*Hd;function Nu(T,R){return(T%R+R)%R}function Fl(T,R,V){return T<100&&T>=0?new Date(T+400,R,V)-gp:new Date(T,R,V).valueOf()}function k0(T,R,V){return T<100&&T>=0?Date.UTC(T+400,R,V)-gp:Date.UTC(T,R,V)}function qf(T){var R,V;if(T=Qe(T),T===void 0||T==="millisecond"||!this.isValid())return this;switch(V=this._isUTC?k0:Fl,T){case"year":R=V(this.year(),0,1);break;case"quarter":R=V(this.year(),this.month()-this.month()%3,1);break;case"month":R=V(this.year(),this.month(),1);break;case"week":R=V(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":R=V(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":R=V(this.year(),this.month(),this.date());break;case"hour":R=this._d.valueOf(),R-=Nu(R+(this._isUTC?0:this.utcOffset()*Ra),Hd);break;case"minute":R=this._d.valueOf(),R-=Nu(R,Ra);break;case"second":R=this._d.valueOf(),R-=Nu(R,qc);break}return this._d.setTime(R),t.updateOffset(this,!0),this}function I0(T){var R,V;if(T=Qe(T),T===void 0||T==="millisecond"||!this.isValid())return this;switch(V=this._isUTC?k0:Fl,T){case"year":R=V(this.year()+1,0,1)-1;break;case"quarter":R=V(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":R=V(this.year(),this.month()+1,1)-1;break;case"week":R=V(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":R=V(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":R=V(this.year(),this.month(),this.date()+1)-1;break;case"hour":R=this._d.valueOf(),R+=Hd-Nu(R+(this._isUTC?0:this.utcOffset()*Ra),Hd)-1;break;case"minute":R=this._d.valueOf(),R+=Ra-Nu(R,Ra)-1;break;case"second":R=this._d.valueOf(),R+=qc-Nu(R,qc)-1;break}return this._d.setTime(R),t.updateOffset(this,!0),this}function Hg(){return this._d.valueOf()-(this._offset||0)*6e4}function zg(){return Math.floor(this.valueOf()/1e3)}function Nm(){return new Date(this.valueOf())}function Uf(){var T=this;return[T.year(),T.month(),T.date(),T.hour(),T.minute(),T.second(),T.millisecond()]}function $h(){var T=this;return{years:T.year(),months:T.month(),date:T.date(),hours:T.hours(),minutes:T.minutes(),seconds:T.seconds(),milliseconds:T.milliseconds()}}function Vh(){return this.isValid()?this.toISOString():null}function zd(){return q(this)}function le(){return w({},x(this))}function yp(){return x(this).overflow}function vp(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}Ve("N",0,0,"eraAbbr"),Ve("NN",0,0,"eraAbbr"),Ve("NNN",0,0,"eraAbbr"),Ve("NNNN",0,0,"eraName"),Ve("NNNNN",0,0,"eraNarrow"),Ve("y",["y",1],"yo","eraYear"),Ve("y",["yy",2],0,"eraYear"),Ve("y",["yyy",3],0,"eraYear"),Ve("y",["yyyy",4],0,"eraYear"),er("N",Ll),er("NN",Ll),er("NNN",Ll),er("NNNN",Ru),er("NNNNN",ul),te(["N","NN","NNN","NNNN","NNNNN"],function(T,R,V,X){var oe=V._locale.erasParse(T,X,V._strict);oe?x(V).era=oe:x(V).invalidEra=T}),er("y",Jt),er("yy",Jt),er("yyy",Jt),er("yyyy",Jt),er("yo",$f),te(["y","yy","yyy","yyyy"],et),te(["yo"],function(T,R,V,X){var oe;V._locale._eraYearOrdinalRegex&&(oe=T.match(V._locale._eraYearOrdinalRegex)),V._locale.eraYearOrdinalParse?R[et]=V._locale.eraYearOrdinalParse(T,oe):R[et]=parseInt(T,10)});function ec(T,R){var V,X,oe,He=this._eras||Bs("en")._eras;for(V=0,X=He.length;V<X;++V){switch(typeof He[V].since){case"string":oe=t(He[V].since).startOf("day"),He[V].since=oe.valueOf();break}switch(typeof He[V].until){case"undefined":He[V].until=1/0;break;case"string":oe=t(He[V].until).startOf("day").valueOf(),He[V].until=oe.valueOf();break}}return He}function Bi(T,R,V){var X,oe,He=this.eras(),Gt,Mr,ci;for(T=T.toUpperCase(),X=0,oe=He.length;X<oe;++X)if(Gt=He[X].name.toUpperCase(),Mr=He[X].abbr.toUpperCase(),ci=He[X].narrow.toUpperCase(),V)switch(R){case"N":case"NN":case"NNN":if(Mr===T)return He[X];break;case"NNNN":if(Gt===T)return He[X];break;case"NNNNN":if(ci===T)return He[X];break}else if([Gt,Mr,ci].indexOf(T)>=0)return He[X]}function O0(T,R){var V=T.since<=T.until?1:-1;return R===void 0?t(T.since).year():t(T.since).year()+(R-T.offset)*V}function Rm(){var T,R,V,X=this.localeData().eras();for(T=0,R=X.length;T<R;++T)if(V=this.clone().startOf("day").valueOf(),X[T].since<=V&&V<=X[T].until||X[T].until<=V&&V<=X[T].since)return X[T].name;return""}function N0(){var T,R,V,X=this.localeData().eras();for(T=0,R=X.length;T<R;++T)if(V=this.clone().startOf("day").valueOf(),X[T].since<=V&&V<=X[T].until||X[T].until<=V&&V<=X[T].since)return X[T].narrow;return""}function xp(){var T,R,V,X=this.localeData().eras();for(T=0,R=X.length;T<R;++T)if(V=this.clone().startOf("day").valueOf(),X[T].since<=V&&V<=X[T].until||X[T].until<=V&&V<=X[T].since)return X[T].abbr;return""}function Wd(){var T,R,V,X,oe=this.localeData().eras();for(T=0,R=oe.length;T<R;++T)if(V=oe[T].since<=oe[T].until?1:-1,X=this.clone().startOf("day").valueOf(),oe[T].since<=X&&X<=oe[T].until||oe[T].until<=X&&X<=oe[T].since)return(this.year()-t(oe[T].since).year())*V+oe[T].offset;return this.year()}function Wg(T){return n(this,"_erasNameRegex")||Hh.call(this),T?this._erasNameRegex:this._erasRegex}function R0(T){return n(this,"_erasAbbrRegex")||Hh.call(this),T?this._erasAbbrRegex:this._erasRegex}function F0(T){return n(this,"_erasNarrowRegex")||Hh.call(this),T?this._erasNarrowRegex:this._erasRegex}function Ll(T,R){return R.erasAbbrRegex(T)}function Ru(T,R){return R.erasNameRegex(T)}function ul(T,R){return R.erasNarrowRegex(T)}function $f(T,R){return R._eraYearOrdinalRegex||Jt}function Hh(){var T=[],R=[],V=[],X=[],oe,He,Gt,Mr,ci,Jn=this.eras();for(oe=0,He=Jn.length;oe<He;++oe)Gt=Je(Jn[oe].name),Mr=Je(Jn[oe].abbr),ci=Je(Jn[oe].narrow),R.push(Gt),T.push(Mr),V.push(ci),X.push(Gt),X.push(Mr),X.push(ci);this._erasRegex=new RegExp("^("+X.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+R.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+T.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+V.join("|")+")","i")}Ve(0,["gg",2],0,function(){return this.weekYear()%100}),Ve(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Ml(T,R){Ve(0,[T,T.length],0,R)}Ml("gggg","weekYear"),Ml("ggggg","weekYear"),Ml("GGGG","isoWeekYear"),Ml("GGGGG","isoWeekYear"),er("G",Ce),er("g",Ce),er("GG",D,Kt),er("gg",D,Kt),er("GGGG",Yt,gr),er("gggg",Yt,gr),er("GGGGG",Vt,pr),er("ggggg",Vt,pr),ve(["gggg","ggggg","GGGG","GGGGG"],function(T,R,V,X){R[X.substr(0,2)]=St(T)}),ve(["gg","GG"],function(T,R,V,X){R[X]=t.parseTwoDigitYear(T)});function Bl(T){return Wh.call(this,T,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function cl(T){return Wh.call(this,T,this.isoWeek(),this.isoWeekday(),1,4)}function zh(){return ku(this.year(),1,4)}function L0(){return ku(this.isoWeekYear(),1,4)}function Gg(){var T=this.localeData()._week;return ku(this.year(),T.dow,T.doy)}function Kg(){var T=this.localeData()._week;return ku(this.weekYear(),T.dow,T.doy)}function Wh(T,R,V,X,oe){var He;return T==null?Hp(this,X,oe).year:(He=ku(T,X,oe),R>He&&(R=He),jl.call(this,T,R,V,X,oe))}function jl(T,R,V,X,oe){var He=fi(T,R,V,X,oe),Gt=za(He.year,0,He.dayOfYear);return this.year(Gt.getUTCFullYear()),this.month(Gt.getUTCMonth()),this.date(Gt.getUTCDate()),this}Ve("Q",0,"Qo","quarter"),er("Q",lt),te("Q",function(T,R){R[Tt]=(St(T)-1)*3});function Fm(T){return T==null?Math.ceil((this.month()+1)/3):this.month((T-1)*3+this.month()%3)}Ve("D",["DD",2],"Do","date"),er("D",D,br),er("DD",D,Kt),er("Do",function(T,R){return T?R._dayOfMonthOrdinalParse||R._ordinalParse:R._dayOfMonthOrdinalParseLenient}),te(["D","DD"],st),te("Do",function(T,R){R[st]=St(T.match(D)[0])});var Yn=To("Date",!0);Ve("DDD",["DDDD",3],"DDDo","dayOfYear"),er("DDD",Qr),er("DDDD",zr),te(["DDD","DDDD"],function(T,R,V){V._dayOfYear=St(T)});function fo(T){var R=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return T==null?R:this.add(T-R,"d")}Ve("m",["mm",2],0,"minute"),er("m",D,pn),er("mm",D,Kt),te(["m","mm"],vr);var va=To("Minutes",!1);Ve("s",["ss",2],0,"second"),er("s",D,pn),er("ss",D,Kt),te(["s","ss"],Er);var _u=To("Seconds",!1);Ve("S",0,0,function(){return~~(this.millisecond()/100)}),Ve(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),Ve(0,["SSS",3],0,"millisecond"),Ve(0,["SSSS",4],0,function(){return this.millisecond()*10}),Ve(0,["SSSSS",5],0,function(){return this.millisecond()*100}),Ve(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),Ve(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),Ve(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),Ve(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),er("S",Qr,lt),er("SS",Qr,Kt),er("SSS",Qr,zr);var Fa,Gh;for(Fa="SSSS";Fa.length<=9;Fa+="S")er(Fa,Jt);function oa(T,R){R[Fr]=St(("0."+T)*1e3)}for(Fa="S";Fa.length<=9;Fa+="S")te(Fa,oa);Gh=To("Milliseconds",!1),Ve("z",0,0,"zoneAbbr"),Ve("zz",0,0,"zoneName");function Gd(){return this._isUTC?"UTC":""}function vi(){return this._isUTC?"Coordinated Universal Time":""}var Ar=me.prototype;Ar.add=Zy,Ar.calendar=Bc,Ar.clone=jf,Ar.diff=qh,Ar.endOf=I0,Ar.format=Uh,Ar.from=Qy,Ar.fromNow=gi,Ar.to=ys,Ar.toNow=ol,Ar.get=Aa,Ar.invalidAt=yp,Ar.isAfter=Rl,Ar.isBefore=sl,Ar.isBetween=jh,Ar.isSame=Om,Ar.isSameOrAfter=Ud,Ar.isSameOrBefore=Kp,Ar.isValid=zd,Ar.lang=al,Ar.locale=jc,Ar.localeData=Qu,Ar.max=Lc,Ar.min=mp,Ar.parsingFlags=le,Ar.set=hn,Ar.startOf=qf,Ar.subtract=Zu,Ar.toArray=Uf,Ar.toObject=$h,Ar.toDate=Nm,Ar.toISOString=$d,Ar.inspect=Vd,typeof Symbol<"u"&&Symbol.for!=null&&(Ar[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),Ar.toJSON=Vh,Ar.toString=D0,Ar.unix=zg,Ar.valueOf=Hg,Ar.creationData=vp,Ar.eraName=Rm,Ar.eraNarrow=N0,Ar.eraAbbr=xp,Ar.eraYear=Wd,Ar.year=xo,Ar.isLeapYear=co,Ar.weekYear=Bl,Ar.isoWeekYear=cl,Ar.quarter=Ar.quarters=Fm,Ar.month=Ps,Ar.daysInMonth=Ms,Ar.week=Ar.weeks=Iu,Ar.isoWeek=Ar.isoWeeks=Co,Ar.weeksInYear=Gg,Ar.weeksInWeekYear=Kg,Ar.isoWeeksInYear=zh,Ar.isoWeeksInISOWeekYear=L0,Ar.date=Yn,Ar.day=Ar.days=Of,Ar.weekday=kd,Ar.isoWeekday=qr,Ar.dayOfYear=fo,Ar.hour=Ar.hours=kl,Ar.minute=Ar.minutes=va,Ar.second=Ar.seconds=_u,Ar.millisecond=Ar.milliseconds=Gh,Ar.utcOffset=Cr,Ar.utc=$i,Ar.local=eo,Ar.parseZone=qs,Ar.hasAlignedHourOffset=Mc,Ar.isDST=Dm,Ar.isLocal=Ja,Ar.isUtcOffset=Vi,Ar.isUtc=il,Ar.isUTC=il,Ar.zoneAbbr=Gd,Ar.zoneName=vi,Ar.dates=rt("dates accessor is deprecated. Use date instead.",Yn),Ar.months=rt("months accessor is deprecated. Use month instead",Ps),Ar.years=rt("years accessor is deprecated. Use year instead",xo),Ar.zone=rt("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Fn),Ar.isDSTShifted=rt("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Ya);function Vf(T){return po(T*1e3)}function Kh(){return po.apply(null,arguments).parseZone()}function Hf(T){return T}var Wi=Od.prototype;Wi.calendar=mc,Wi.longDateFormat=Cm,Wi.invalidDate=fu,Wi.ordinal=dp,Wi.preparse=Hf,Wi.postformat=Hf,Wi.relativeTime=Nc,Wi.pastFuture=Po,Wi.set=Rf,Wi.eras=ec,Wi.erasParse=Bi,Wi.erasConvertYear=O0,Wi.erasAbbrRegex=R0,Wi.erasNameRegex=Wg,Wi.erasNarrowRegex=F0,Wi.months=qp,Wi.monthsShort=ii,Wi.monthsParse=el,Wi.monthsRegex=ea,Wi.monthsShortRegex=Pl,Wi.week=Wa,Wi.firstDayOfYear=Xu,Wi.firstDayOfWeek=C0,Wi.weekdays=$p,Wi.weekdaysMin=Cl,Wi.weekdaysShort=Cs,Wi.weekdaysParse=Pm,Wi.weekdaysRegex=Io,Wi.weekdaysShortRegex=Nf,Wi.weekdaysMinRegex=Al,Wi.isPM=Ga,Wi.meridiem=_e;function Kd(T,R,V,X){var oe=Bs(),He=P().set(X,R);return oe[V](He,T)}function ql(T,R,V){if(d(T)&&(R=T,T=void 0),T=T||"",R!=null)return Kd(T,R,V,"month");var X,oe=[];for(X=0;X<12;X++)oe[X]=Kd(T,X,V,"month");return oe}function an(T,R,V,X){typeof T=="boolean"?(d(R)&&(V=R,R=void 0),R=R||""):(R=T,V=R,T=!1,d(R)&&(V=R,R=void 0),R=R||"");var oe=Bs(),He=T?oe._week.dow:0,Gt,Mr=[];if(V!=null)return Kd(R,(V+He)%7,X,"day");for(Gt=0;Gt<7;Gt++)Mr[Gt]=Kd(R,(Gt+He)%7,X,"day");return Mr}function Fu(T,R){return ql(T,R,"months")}function Yh(T,R){return ql(T,R,"monthsShort")}function Za(T,R,V){return an(T,R,V,"weekdays")}function xa(T,R,V){return an(T,R,V,"weekdaysShort")}function Jh(T,R,V){return an(T,R,V,"weekdaysMin")}Rn("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(T){var R=T%10,V=St(T%100/10)===1?"th":R===1?"st":R===2?"nd":R===3?"rd":"th";return T+V}}),t.lang=rt("moment.lang is deprecated. Use moment.locale instead.",Rn),t.langData=rt("moment.langData is deprecated. Use moment.localeData instead.",Bs);var tc=Math.abs;function Yd(){var T=this._data;return this._milliseconds=tc(this._milliseconds),this._days=tc(this._days),this._months=tc(this._months),T.milliseconds=tc(T.milliseconds),T.seconds=tc(T.seconds),T.minutes=tc(T.minutes),T.hours=tc(T.hours),T.months=tc(T.months),T.years=tc(T.years),this}function Yp(T,R,V,X){var oe=Ai(R,V);return T._milliseconds+=X*oe._milliseconds,T._days+=X*oe._days,T._months+=X*oe._months,T._bubble()}function Su(T,R){return Yp(this,T,R,1)}function Jd(T,R){return Yp(this,T,R,-1)}function Jp(T){return T<0?Math.floor(T):Math.ceil(T)}function _p(){var T=this._milliseconds,R=this._days,V=this._months,X=this._data,oe,He,Gt,Mr,ci;return T>=0&&R>=0&&V>=0||T<=0&&R<=0&&V<=0||(T+=Jp(_c(V)+R)*864e5,R=0,V=0),X.milliseconds=T%1e3,oe=Ot(T/1e3),X.seconds=oe%60,He=Ot(oe/60),X.minutes=He%60,Gt=Ot(He/60),X.hours=Gt%24,R+=Ot(Gt/24),ci=Ot(Uc(R)),V+=ci,R-=Jp(_c(ci)),Mr=Ot(V/12),V%=12,X.days=R,X.months=V,X.years=Mr,this}function Uc(T){return T*4800/146097}function _c(T){return T*146097/4800}function Wo(T){if(!this.isValid())return NaN;var R,V,X=this._milliseconds;if(T=Qe(T),T==="month"||T==="quarter"||T==="year")switch(R=this._days+X/864e5,V=this._months+Uc(R),T){case"month":return V;case"quarter":return V/3;case"year":return V/12}else switch(R=this._days+Math.round(_c(this._months)),T){case"week":return R/7+X/6048e5;case"day":return R+X/864e5;case"hour":return R*24+X/36e5;case"minute":return R*1440+X/6e4;case"second":return R*86400+X/1e3;case"millisecond":return Math.floor(R*864e5)+X;default:throw new Error("Unknown unit "+T)}}function Qa(T){return function(){return this.as(T)}}var eu=Qa("ms"),ji=Qa("s"),to=Qa("m"),zf=Qa("h"),Sa=Qa("d"),Lm=Qa("w"),aa=Qa("M"),Xh=Qa("Q"),ev=Qa("y"),Mm=eu;function M0(){return Ai(this)}function Xd(T){return T=Qe(T),this.isValid()?this[T+"s"]():NaN}function Sp(T){return function(){return this.isValid()?this._data[T]:NaN}}var Ul=Sp("milliseconds"),Bm=Sp("seconds"),Yg=Sp("minutes"),Zh=Sp("hours"),Qh=Sp("days"),Jg=Sp("months"),jm=Sp("years");function Lu(){return Ot(this.days()/7)}var La=Math.round,Wf={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function e0(T,R,V,X,oe){return Oc.call(oe,R||1,!!V,T,X)}function $l(T,R,V,X){var oe=Ai(T).abs(),He=La(oe.as("s")),Gt=La(oe.as("m")),Mr=La(oe.as("h")),ci=La(oe.as("d")),Jn=La(oe.as("M")),Oo=La(oe.as("w")),ll=La(oe.as("y")),Ln=He<=V.ss&&["s",He]||He<V.s&&["ss",He]||Gt<=1&&["m"]||Gt<V.m&&["mm",Gt]||Mr<=1&&["h"]||Mr<V.h&&["hh",Mr]||ci<=1&&["d"]||ci<V.d&&["dd",ci];return V.w!=null&&(Ln=Ln||Oo<=1&&["w"]||Oo<V.w&&["ww",Oo]),Ln=Ln||Jn<=1&&["M"]||Jn<V.M&&["MM",Jn]||ll<=1&&["y"]||["yy",ll],Ln[2]=R,Ln[3]=+T>0,Ln[4]=X,e0.apply(null,Ln)}function tv(T){return T===void 0?La:typeof T=="function"?(La=T,!0):!1}function t0(T,R){return Wf[T]===void 0?!1:R===void 0?Wf[T]:(Wf[T]=R,T==="s"&&(Wf.ss=R-1),!0)}function $c(T,R){if(!this.isValid())return this.localeData().invalidDate();var V=!1,X=Wf,oe,He;return typeof T=="object"&&(R=T,T=!1),typeof T=="boolean"&&(V=T),typeof R=="object"&&(X=w(w({},Wf),R||{}),R.s!=null&&R.ss==null&&(X.ss=R.s-1)),oe=this.localeData(),He=$l(this,!V,X,oe),V&&(He=tl.call(oe,+this,He)),oe.postformat(He)}var Gf=Math.abs;function rc(T){return(T>0)-(T<0)||+T}function Vl(){if(!this.isValid())return this.localeData().invalidDate();var T=Gf(this._milliseconds)/1e3,R=Gf(this._days),V=Gf(this._months),X,oe,He,Gt,Mr=this.asSeconds(),ci,Jn,Oo,ll;return Mr?(X=Ot(T/60),oe=Ot(X/60),T%=60,X%=60,He=Ot(V/12),V%=12,Gt=T?T.toFixed(3).replace(/\.?0+$/,""):"",ci=Mr<0?"-":"",Jn=rc(this._months)!==rc(Mr)?"-":"",Oo=rc(this._days)!==rc(Mr)?"-":"",ll=rc(this._milliseconds)!==rc(Mr)?"-":"",ci+"P"+(He?Jn+He+"Y":"")+(V?Jn+V+"M":"")+(R?Oo+R+"D":"")+(oe||X||T?"T":"")+(oe?ll+oe+"H":"")+(X?ll+X+"M":"")+(T?ll+Gt+"S":"")):"P0D"}var is=Zi.prototype;is.isValid=Ia,is.abs=Yd,is.add=Su,is.subtract=Jd,is.as=Wo,is.asMilliseconds=eu,is.asSeconds=ji,is.asMinutes=to,is.asHours=zf,is.asDays=Sa,is.asWeeks=Lm,is.asMonths=aa,is.asQuarters=Xh,is.asYears=ev,is.valueOf=Mm,is._bubble=_p,is.clone=M0,is.get=Xd,is.milliseconds=Ul,is.seconds=Bm,is.minutes=Yg,is.hours=Zh,is.days=Qh,is.weeks=Lu,is.months=Jg,is.years=jm,is.humanize=$c,is.toISOString=Vl,is.toString=Vl,is.toJSON=Vl,is.locale=jc,is.localeData=Qu,is.toIsoString=rt("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Vl),is.lang=al,Ve("X",0,0,"unix"),Ve("x",0,0,"valueOf"),er("x",Ce),er("X",Zt),te("X",function(T,R,V){V._d=new Date(parseFloat(T)*1e3)}),te("x",function(T,R,V){V._d=new Date(St(T))});return t.version="2.31.0",r(po),t.fn=Ar,t.min=gu,t.max=Bd,t.now=jo,t.utc=P,t.unix=Vf,t.months=Fu,t.isDate=h,t.locale=Rn,t.invalid=F,t.duration=Ai,t.isMoment=Ae,t.weekdays=Za,t.parseZone=Kh,t.localeData=Bs,t.isDuration=jd,t.monthsShort=Yh,t.weekdaysMin=Jh,t.defineLocale=Mi,t.updateLocale=vn,t.locales=Il,t.weekdaysShort=xa,t.normalizeUnits=Qe,t.relativeTimeRounding=tv,t.relativeTimeThreshold=t0,t.calendarFormat=Nl,t.prototype=Ar,t.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},t})});function gg(){return!process.stdout.isTTY||process.env.FORCE_NON_TTY==="1"||process.env.CI==="true"||process.env.CI==="1"||process.env.PAGES_SOURCE==="skills"||process.env.EDGEONE_NON_INTERACTIVE==="1"}function nO({prefix:e="cli"}){return Xo.default.createElement(Ho.Text,{color:"grey"},"[",e,"]")}function ms(e,t="cli"){if(gg()){console.log(`\x1B[90m[${t}]\x1B[0m\x1B[31m[\u2718] \x1B[0m${e}`);return}let{unmount:r}=(0,Ho.render)(Xo.default.createElement(Ho.Text,null,Xo.default.createElement(nO,{prefix:t}),Xo.default.createElement(Ho.Text,{color:"red"},"[\u2718] "),e));r()}function pE(e,t="cli"){if(gg()){console.log(`\x1B[90m[${t}]\x1B[0m\x1B[32m[\u2714] \x1B[0m${e}`);return}let{unmount:r}=(0,Ho.render)(Xo.default.createElement(Ho.Text,null,Xo.default.createElement(nO,{prefix:t}),Xo.default.createElement(Ho.Text,{color:"green"},"[\u2714] "),e));r()}function Qi(e,t="cli"){if(gg()){console.log(`\x1B[90m[${t}]\x1B[0m \x1B[33mWARNING:\x1B[0m ${e}`);return}let{unmount:r}=(0,Ho.render)(Xo.default.createElement(Ho.Text,null,Xo.default.createElement(nO,{prefix:t}),Xo.default.createElement(Ho.Text,{color:"orange"},"\u2757\uFE0F "),e));r()}function ine(e){if(gg()){console.log(e);return}let{unmount:t}=(0,Ho.render)(Xo.default.createElement(Ho.Text,{color:"cyan"},e));t()}function ur(e,t="cli"){if(gg()){console.log(`\x1B[90m[${t}]\x1B[0m ${e}`);return}let{unmount:r}=(0,Ho.render)(Xo.default.createElement(Ho.Text,null,Xo.default.createElement(nO,{prefix:t})," ",e));r()}function XB({timestamp:e}){return Xo.default.createElement(Ho.Box,{width:13},Xo.default.createElement(Ho.Text,{color:"grey"},(0,EC.default)(e).format("HH:mm:ss.SSS")))}function sne(e,t){if(gg()){console.log(`${(0,EC.default)(t).format("HH:mm:ss.SSS")} ${e}`);return}let{unmount:r}=(0,Ho.render)(Xo.default.createElement(Ho.Box,null,Xo.default.createElement(XB,{timestamp:t}),Xo.default.createElement(Ho.Text,null,e)));r()}function one(e,t){if(gg()){console.log(`${(0,EC.default)(t).format("HH:mm:ss.SSS")} [WARNING] ${e}`);return}let{unmount:r}=(0,Ho.render)(Xo.default.createElement(Ho.Box,null,Xo.default.createElement(XB,{timestamp:t}),Xo.default.createElement(Ho.Text,{color:"white",backgroundColor:"yellow"},"[WARNING]"),Xo.default.createElement(Ho.Text,null," ",e)));r()}function ZB(e,t){if(gg()){console.log(`${(0,EC.default)(t).format("HH:mm:ss.SSS")} [ERROR] ${e}`);return}let{unmount:r}=(0,Ho.render)(Xo.default.createElement(Ho.Box,null,Xo.default.createElement(XB,{timestamp:t}),Xo.default.createElement(Ho.Text,{color:"white",backgroundColor:"red"},"[ERROR]"),Xo.default.createElement(Ho.Text,null," ",e)));r()}var Ho,Xo,EC,uu=_t(()=>{Ho=nr(bC()),Xo=nr(Pa()),EC=nr(nne())});var une,ane=_t(()=>{une={name:"edgeone",version:"1.6.48",description:"Command-line interface for TencentCloud Pages Functions",bin:{edgeone:"./edgeone-bin/edgeone.js"},files:["./edgeone-bin/edgeone.js","./edgeone-dist/cli.js","./edgeone-dist/config-schema.js","./edgeone-dist/edgeone.schema.json","./edgeone-dist/pages/templates","./edgeone-dist/pages/dev/runner-worker.js","./edgeone-dist/pages/observability-python/**","./edgeone-dist/libs-pages-blob-python/**","./edgeone-dist/libs-pages-agent-toolkit/**","./edgeone-dist/studio/**","./edgeone-dist/plugins/**","./libs-pages-blob-python/**","./libs-pages-agent-toolkit/**"],author:"",keywords:["tencent","edgeone","edgefunctions","edgeone","cli","typescript"],scripts:{clean:"rimraf ./edgeone-dist ./edgeone-bin ./libs-node-ai ./libs-kv-client",bundle:"node -r esbuild-register ./scripts/bundle.ts",watch:"node -r esbuild-register ./scripts/bundle.ts watch",build:"npm run clean && npm run build:pages-ai && npm run build:kv-client && npm run prepare:blob-wheel && npm run prepare:agent-toolkit-wheel && npm run bundle","build:pages-ai":"node ./scripts/build-pages-ai.js","build:kv-client":"node ./scripts/build-kv-client.js","prepare:blob-wheel":"node ./scripts/prepare-pages-blob-wheel.js","prepare:agent-toolkit-wheel":"node ./scripts/prepare-pages-agent-toolkit-wheel.js","verify:publish-assets":"node ./scripts/verify-publish-assets.js","upload:agent-version-manifest":"node ./scripts/upload-agent-version-manifest.js","build:sandbox-tarball":"bash ./scripts/build-sandbox-tarball.sh","upload:sandbox-tarball":"node ./scripts/upload-sandbox-tarball.js","sync:sandbox-lock":"cd packaging/sandbox && npm install --package-lock-only --omit=dev",format:'prettier --write "src/**/*.{ts,tsx,js,jsx,json,md}" "scripts/**/*.{ts,js}" "*.{json,md}"',prepack:"npm run build && npm run verify:publish-assets",prepublishOnly:"npm run build && npm run verify:publish-assets",test:"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","test:observability":"vitest run --config src/agent/observability/node/tests/vitest.config.ts && cd src/agent/observability/python && uv run pytest tests/ -q"},dependencies:{"@babel/generator":"^7.28.0","@babel/parser":"^7.28.0","@babel/traverse":"^7.28.0","@babel/types":"^7.28.0","@edgeone/nuxt-pages":"1.1.2-beta.1","@edgeone/opennextjs-pages":"0.2.10-beta.13","@edgeone/pages-agent-toolkit":"0.1.38","@edgeone/pages-blob":"0.0.19",chokidar:"^4.0.1",esbuild:"^0.19.2","esbuild-plugin-polyfill-node":"^0.3.0","extract-zip":"^2.0.1","fast-glob":"^3.3.0",giget:"^2.0.0",minimatch:"^9.0.5",open:"^8.4.2"},devDependencies:{"@e2b/code-interpreter":"2.4.2","@edgeone/framework-detect":"^0.0.2","@edgeone/is-spa":"^0.0.3","@edgeone/types":"^1.0.2","@modelcontextprotocol/sdk":"1.29.0","@opentelemetry/api":"^1.9.1","@opentelemetry/core":"^1.30.1","@opentelemetry/exporter-metrics-otlp-http":"^0.55.0","@opentelemetry/exporter-trace-otlp-http":"^0.55.0","@opentelemetry/instrumentation":"^0.55.0","@opentelemetry/otlp-transformer":"^0.55.0","@opentelemetry/resources":"^1.30.1","@opentelemetry/sdk-metrics":"^1.30.1","@opentelemetry/sdk-trace-base":"^1.30.1","@opentelemetry/sdk-trace-node":"^1.30.1","@opentelemetry/semantic-conventions":"^1.40.0","@tencent/capi-nodejs-sdk":"^2.3.2","@types/http-proxy":"^1.17.12","@types/inquirer":"^9.0.8","@types/ip":"^1.1.0","@types/js-yaml":"^4.0.9","@types/lodash":"^4.14.198","@types/prompts":"^2.4.4","@types/react":"^17.0.2","@types/uuid":"^9.0.3","@types/ws":"^8.5.7","@types/yargs":"^17.0.24","@vitest/coverage-v8":"^4.0.17",archiver:"^7.0.1",axios:"^1.7.9",chalk:"^5.3.0","common-path-prefix":"^1.0.0",cookie:"^1.0.2","cos-nodejs-sdk-v5":"^2.14.7","cross-spawn":"^7.0.6","detect-port":"^2.1.0",dotenv:"^16.3.1","esbuild-register":"^3.6.0",execa:"^7.1.1","fs-extra":"^11.3.1","http-proxy":"^1.18.1",husky:"^8.0.3",ink:"^3.2.0","ink-table":"^3.1.0",inquirer:"^8.2.4",ip:"^2.0.1","js-yaml":"^4.3.1",json5:"^2.2.3","lint-staged":"^15.2.0",lodash:"^4.17.21","mime-types":"^3.0.1",moment:"^2.30.1","node-fetch":"^3.3.2","node-persist":"^4.0.3","p-map":"^5.5.0",portfinder:"^1.0.32",prettier:"^3.1.1",prompts:"^2.4.2",protobufjs:"^8.4.2",react:"^17.0.2",rimraf:"^6.0.1",semiver:"^1.1.0",sirv:"^2.0.3","tencentcloud-cls-sdk-js-web":"^1.0.13","ts-node":"^10.9.2",typescript:"^5.9.3",undici:"^5.29.0","update-check":"^1.5.4",uuid:"^9.0.0",vitest:"^4.0.17",ws:"^8.14.2",yargs:"^17.6.2",zod:"^3.23.8","zod-to-json-schema":"^3.23.5"},overrides:{"@e2b/code-interpreter":"2.4.2",e2b:"2.19.5"},engines:{node:">=12"},"lint-staged":{"*.{ts,tsx,js,jsx,json,md}":["prettier --write"]}}});function gUe(){var e,t;return{run_id:mUe,cli_version:(t=(e=une)==null?void 0:e.version)!=null?t:"unknown",node_version:process.version,os_platform:e6.default.platform(),os_arch:e6.default.arch(),app_type:"cli",app_id:process.env.AppId||void 0,uin:process.env.Uin||void 0,instance_id:process.env.ProjectId||void 0,is_ci:process.env.CI==="true"}}function yUe(e,t){try{if(typeof process.send!="function")return;process.send(JSON.stringify({name:e,value:JSON.stringify(t)}))}catch{}}function Cc(e){var r;let t={...gUe(),...e};yUe((r=t.event_name)!=null?r:"unknown",t)}function gh(e){if(e==null)return{message:"unknown error",stack:""};if(typeof e=="string")return{message:iO(e,QB),stack:""};if(typeof e=="object"){let t=e,r=iO(typeof t.message=="string"?t.message:String(t),QB),s=iO(typeof t.stack=="string"?t.stack:"",vUe);return{message:r,stack:s}}return{message:iO(String(e),QB),stack:""}}function iO(e,t){return e.length>t?e.slice(0,t)+"\u2026[truncated]":e}var e6,Tc,Pc,mUe,cne,QB,vUe,yg=_t(()=>{e6=nr(require("os"));ane();Tc={COMMAND:"command",REQUEST:"request",LOCAL_FLOW:"local_flow",EXIT:"exit"},Pc={SUCCESS:"success",FAIL:"fail",START:"start"},mUe=`cli-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;cne=(e,t)=>{let r=gh(t);Cc({event_name:"error",event_scope:Tc.COMMAND,event_result:Pc.FAIL,error_message:`${e} ${r.message}`.trim(),error_stack:r.stack})},QB=500,vUe=2e3});var wC,fE,t6=_t(()=>{wC={NEXTJS:"nextjs",NUXTJS:"nuxtjs",ASTRO:"astro",UNKNOWN:"unknown"},fE={FRAMEWORK_DETECT:"framework_detect",PLUGIN_RESOLVE:"plugin_resolve",PLUGIN_LOAD:"plugin_load",PLUGIN_HOOK:"plugin_hook",CONFIG_LOAD:"config_load"}});function SUe(e){if((e==null?void 0:e.code)===_Ue)return!0;let t=typeof e=="string"?e:e==null?void 0:e.message;return t==null?void 0:t.includes(xUe)}async function Sx(e=!1){try{let t=await dI(e);return Cc({event_name:"Config:Load:Success",event_scope:Tc.LOCAL_FLOW,event_phase:fE.CONFIG_LOAD,event_result:Pc.SUCCESS,has_build_command:(t==null?void 0:t.buildCommand)!=null,has_install_command:(t==null?void 0:t.installCommand)!=null,has_output_directory:(t==null?void 0:t.outputDirectory)!=null,has_node_version:(t==null?void 0:t.nodeVersion)!=null}),t}catch(t){let r=gh(t);if(Cc({event_name:"Config:Load:Fail",event_scope:Tc.LOCAL_FLOW,event_phase:fE.CONFIG_LOAD,event_result:Pc.FAIL,error_message:r.message}),SUe(t))throw t;return(0,mf.showError)()&&console.error("%c [ error ]-80","font-size:13px; background:pink; color:#bf2c9f;",t),null}}var xUe,_Ue,r6=_t(()=>{Wb();rI();yg();t6();xUe="[BLOCKING_CONFIG_ERROR]",_Ue="BLOCKING_CONFIG_ERROR"});var sO,Op,oO=_t(()=>{sO=[{funcName:"onRequestGet",method:"GET"},{funcName:"onRequestPost",method:"POST"},{funcName:"onRequestDelete",method:"DELETE"},{funcName:"onRequestPatch",method:"PATCH"},{funcName:"onRequestPut",method:"PUT"},{funcName:"onRequestHead",method:"HEAD"},{funcName:"onRequestOptions",method:"OPTIONS"}],Op=["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"]});async function bUe(e){let t;aO.default.statSync(e).isFile()?t=dE.default.resolve(dE.default.dirname(e)):t=e;let r=dE.default.parse(t).root;if(t===r)return null;for(;t!==r;){let s=dE.default.join(t,"package.json");try{return await aO.default.promises.access(s),s}catch{if(t=dE.default.dirname(t),t===r)break}}return null}async function hE(e){if(e.endsWith(".mjs"))return"esm";if(e.endsWith(".cjs"))return"commonjs";try{let t=await bUe(e);if(t&&JSON.parse(await aO.default.promises.readFile(t,"utf-8")).type==="module")return"esm"}catch(t){console.warn("Failed to read package.json:",t)}return"commonjs"}var aO,dE,TC=_t(()=>{aO=nr(require("fs")),dE=nr(require("path"))});function wUe(e){let t=n6.default.extname(e);return EUe[t]||"ts"}function CUe(e){return e.split(",").map(t=>t.trim()).map(t=>{let r=t.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(!r)return"";let[,s,a]=r;return!PUe.has(a)||s===a?"":`const ${a} = ${s};`}).filter(Boolean).join(`
|
|
169
169
|
`)}async function fne(e,t,r,s){let a=`mod_${TUe++}`,c=(await pne.default.build({stdin:{contents:e,loader:wUe(r),resolveDir:n6.default.dirname(r)},write:!1,bundle:!0,format:"esm",platform:"node",target:"node14",minify:!1,resolveExtensions:[".ts",".js",".mjs",".json"],nodePaths:[process.cwd()],absWorkingDir:process.cwd(),external:(s==null?void 0:s.externalModules)||[]})).outputFiles[0].text,p=[];c=c.replace(/^import\s+[^'"]*['"][^'"]*['"]\s*;?\n/gm,w=>(p.push(w),"")),c=c.replace(/export (async )?function/g,"$1function"),c=c.replace(/export const/g,"const"),c=c.replace(/export let/g,"let"),c=c.replace(/export var/g,"var"),c=c.replace(/export default/g,""),c=c.replace(/export\s*\{([^}]+)\};?/g,(w,P)=>CUe(P)),c=c.replace(/export class/g,"class");let d=/const\s+app\s*=/.test(c),h=`${p.join(`
|
|
170
170
|
`)}`;return{code:s!=null&&s.isFramework?`
|
|
171
171
|
const ${a} = (() => {
|
|
@@ -1716,10 +1716,100 @@ function firstForwardedProto(value) {
|
|
|
1716
1716
|
return String(raw || '').split(',')[0].trim().toLowerCase();
|
|
1717
1717
|
}
|
|
1718
1718
|
|
|
1719
|
+
function createBodyReadError(code, message, cause) {
|
|
1720
|
+
const err = new Error(message);
|
|
1721
|
+
err.code = code;
|
|
1722
|
+
if (cause) err.cause = cause;
|
|
1723
|
+
return err;
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
/**
|
|
1727
|
+
* Read the whole IncomingMessage exactly once into memory.
|
|
1728
|
+
*
|
|
1729
|
+
* The stream can only be consumed once. Handing the live stream to
|
|
1730
|
+
* new Request() and then clone()-ing it tees one source into two branches:
|
|
1731
|
+
* when the source errors mid-read both branches error, and the user's
|
|
1732
|
+
* request.text() throws with nothing in our logs. Buffering first means
|
|
1733
|
+
* every later read (text / json / clone / the body getter) works on memory.
|
|
1734
|
+
*
|
|
1735
|
+
* No size cap is applied here; request size limits are left to the platform
|
|
1736
|
+
* gateway and the function's memory configuration.
|
|
1737
|
+
*
|
|
1738
|
+
* Rejects with err.code:
|
|
1739
|
+
* - EO_BODY_TRUNCATED received bytes differ from Content-Length
|
|
1740
|
+
* - EO_BODY_READ_FAILED stream errored / aborted before end
|
|
1741
|
+
*/
|
|
1742
|
+
async function readIncomingBody(req) {
|
|
1743
|
+
const chunks = [];
|
|
1744
|
+
let size = 0;
|
|
1745
|
+
try {
|
|
1746
|
+
for await (const chunk of req) {
|
|
1747
|
+
size += chunk.length;
|
|
1748
|
+
chunks.push(chunk);
|
|
1749
|
+
}
|
|
1750
|
+
} catch (error) {
|
|
1751
|
+
throw createBodyReadError(
|
|
1752
|
+
'EO_BODY_READ_FAILED',
|
|
1753
|
+
'Request body read failed after ' + size + ' bytes: ' + ((error && error.message) || String(error)),
|
|
1754
|
+
error,
|
|
1755
|
+
);
|
|
1756
|
+
}
|
|
1757
|
+
const buf = chunks.length === 0 ? Buffer.alloc(0) : Buffer.concat(chunks, size);
|
|
1758
|
+
const declaredRaw = req.headers && req.headers['content-length'];
|
|
1759
|
+
if (declaredRaw !== undefined && declaredRaw !== '') {
|
|
1760
|
+
const declared = Number(declaredRaw);
|
|
1761
|
+
if (Number.isFinite(declared) && declared !== buf.length) {
|
|
1762
|
+
throw createBodyReadError('EO_BODY_TRUNCATED', 'Request body truncated: received ' + buf.length + ' of ' + declared + ' bytes');
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
return buf;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
/**
|
|
1769
|
+
* Log a body read failure on one line and reply with an explicit error,
|
|
1770
|
+
* instead of handing a broken / empty body to user code.
|
|
1771
|
+
* Only lengths and error text are logged, never body content.
|
|
1772
|
+
*/
|
|
1773
|
+
function respondBodyReadError(req, res, error, pathname) {
|
|
1774
|
+
const code = (error && error.code) || 'EO_BODY_READ_FAILED';
|
|
1775
|
+
const status = 400;
|
|
1776
|
+
const requestId = req.headers['x-scf-request-id'] || req.headers['functions-request-id'] || '';
|
|
1777
|
+
try {
|
|
1778
|
+
console.error('[body-read] failed ' + JSON.stringify({
|
|
1779
|
+
scfRequestId: requestId,
|
|
1780
|
+
method: req.method,
|
|
1781
|
+
path: pathname,
|
|
1782
|
+
contentLength: req.headers['content-length'] || '',
|
|
1783
|
+
transferEncoding: req.headers['transfer-encoding'] || '',
|
|
1784
|
+
reqComplete: !!req.complete,
|
|
1785
|
+
reqAborted: !!req.aborted,
|
|
1786
|
+
reqDestroyed: !!req.destroyed,
|
|
1787
|
+
code,
|
|
1788
|
+
error: (error && error.name ? error.name + ': ' : '') + ((error && error.message) || String(error)),
|
|
1789
|
+
cause: error && error.cause ? String(error.cause.message || error.cause) : '',
|
|
1790
|
+
}));
|
|
1791
|
+
} catch {}
|
|
1792
|
+
if (res.headersSent || res.writableEnded) return;
|
|
1793
|
+
res.writeHead(status, {
|
|
1794
|
+
'Content-Type': 'application/json',
|
|
1795
|
+
'Functions-Request-Id': requestId,
|
|
1796
|
+
'eo-pages-inner-body-error': code,
|
|
1797
|
+
});
|
|
1798
|
+
res.end(JSON.stringify({
|
|
1799
|
+
error: 'Request body read failed',
|
|
1800
|
+
code,
|
|
1801
|
+
message: (error && error.message) || '',
|
|
1802
|
+
functions_request_id: requestId || null,
|
|
1803
|
+
}));
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1719
1806
|
/**
|
|
1720
|
-
* Create enhanced request object, adding Edgeone-compatible body handling
|
|
1807
|
+
* Create enhanced request object, adding Edgeone-compatible body handling.
|
|
1808
|
+
* Async: the body is fully buffered before the Request is built.
|
|
1809
|
+
* On read failure the request is still returned with _bodyReadError set;
|
|
1810
|
+
* callers must check it before invoking user code.
|
|
1721
1811
|
*/
|
|
1722
|
-
function createEdgeoneCompatibleRequest(originalReq, isFramework = false) {
|
|
1812
|
+
async function createEdgeoneCompatibleRequest(originalReq, isFramework = false) {
|
|
1723
1813
|
const method = (originalReq.method || 'GET').toUpperCase();
|
|
1724
1814
|
const protocol = firstForwardedProto(originalReq.headers['x-forwarded-proto']) || 'http';
|
|
1725
1815
|
const host = originalReq.headers.host || 'localhost';
|
|
@@ -1743,39 +1833,43 @@ function createEdgeoneCompatibleRequest(originalReq, isFramework = false) {
|
|
|
1743
1833
|
headers: new Headers(headerPairs)
|
|
1744
1834
|
};
|
|
1745
1835
|
|
|
1836
|
+
let rawBody = undefined;
|
|
1837
|
+
let bodyReadError = null;
|
|
1746
1838
|
if (method !== 'GET' && method !== 'HEAD') {
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1839
|
+
try {
|
|
1840
|
+
rawBody = await readIncomingBody(originalReq);
|
|
1841
|
+
} catch (err) {
|
|
1842
|
+
bodyReadError = err;
|
|
1843
|
+
}
|
|
1844
|
+
// In-memory body: clone()/text() can be repeated, no tee over a live stream
|
|
1845
|
+
if (rawBody && rawBody.length > 0) {
|
|
1846
|
+
init.body = rawBody;
|
|
1847
|
+
}
|
|
1750
1848
|
}
|
|
1751
1849
|
|
|
1752
1850
|
const request = new Request(url, init);
|
|
1851
|
+
request._rawBodyBuffer = rawBody;
|
|
1852
|
+
request._bodyReadError = bodyReadError;
|
|
1753
1853
|
|
|
1754
|
-
//
|
|
1854
|
+
// Parsed body for the legacy request.body getter, computed lazily from the
|
|
1855
|
+
// same buffer; a parse failure only affects this getter, not text()/json().
|
|
1755
1856
|
let parsedBodyCache = undefined;
|
|
1756
1857
|
let parsedBodyReady = false;
|
|
1757
1858
|
let parsedBodyError = null;
|
|
1758
1859
|
const contentType = request.headers.get('content-type') || '';
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1860
|
+
const ensureParsedBody = () => {
|
|
1861
|
+
if (parsedBodyReady) return;
|
|
1862
|
+
parsedBodyReady = true;
|
|
1863
|
+
if (bodyReadError) {
|
|
1864
|
+
parsedBodyError = bodyReadError;
|
|
1764
1865
|
return;
|
|
1765
1866
|
}
|
|
1766
1867
|
try {
|
|
1767
|
-
|
|
1768
|
-
const ab = await clone.arrayBuffer();
|
|
1769
|
-
const buf = Buffer.from(ab);
|
|
1770
|
-
request._rawBodyBuffer = buf; // for debugging/advanced usage
|
|
1771
|
-
parsedBodyCache = EdgeoneBodyParser.parseBodyByContentType(buf, contentType);
|
|
1772
|
-
parsedBodyReady = true;
|
|
1868
|
+
parsedBodyCache = EdgeoneBodyParser.parseBodyByContentType(rawBody, contentType);
|
|
1773
1869
|
} catch (err) {
|
|
1774
1870
|
parsedBodyError = err;
|
|
1775
|
-
parsedBodyReady = true;
|
|
1776
1871
|
}
|
|
1777
1872
|
};
|
|
1778
|
-
request._bodyPreloadPromise = preloadBody();
|
|
1779
1873
|
|
|
1780
1874
|
// Add cookies getter
|
|
1781
1875
|
if (!('cookies' in request)) {
|
|
@@ -1803,21 +1897,9 @@ function createEdgeoneCompatibleRequest(originalReq, isFramework = false) {
|
|
|
1803
1897
|
// This shadows the standard Request.body (stream). Users can still call request.json()/text().
|
|
1804
1898
|
Object.defineProperty(request, 'body', {
|
|
1805
1899
|
get() {
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
}
|
|
1810
|
-
return new Promise((resolve, reject) => {
|
|
1811
|
-
(async () => {
|
|
1812
|
-
try {
|
|
1813
|
-
await request._bodyPreloadPromise;
|
|
1814
|
-
if (parsedBodyError) return reject(parsedBodyError);
|
|
1815
|
-
resolve(parsedBodyCache);
|
|
1816
|
-
} catch (e) {
|
|
1817
|
-
reject(e);
|
|
1818
|
-
}
|
|
1819
|
-
})();
|
|
1820
|
-
});
|
|
1900
|
+
ensureParsedBody();
|
|
1901
|
+
if (parsedBodyError) throw parsedBodyError;
|
|
1902
|
+
return parsedBodyCache;
|
|
1821
1903
|
},
|
|
1822
1904
|
configurable: true,
|
|
1823
1905
|
enumerable: true
|
|
@@ -3976,70 +4058,76 @@ var require_dist = __commonJS({
|
|
|
3976
4058
|
"node_modules/@edgeone/pages-blob/dist/index.js"(exports, module) {
|
|
3977
4059
|
"use strict";
|
|
3978
4060
|
var U = Object.defineProperty;
|
|
3979
|
-
var
|
|
3980
|
-
var
|
|
3981
|
-
var
|
|
3982
|
-
var
|
|
3983
|
-
for (var
|
|
3984
|
-
U(t,
|
|
3985
|
-
};
|
|
3986
|
-
var
|
|
4061
|
+
var ge = Object.getOwnPropertyDescriptor;
|
|
4062
|
+
var fe = Object.getOwnPropertyNames;
|
|
4063
|
+
var he = Object.prototype.hasOwnProperty;
|
|
4064
|
+
var me = (t, e) => {
|
|
4065
|
+
for (var n in e)
|
|
4066
|
+
U(t, n, { get: e[n], enumerable: true });
|
|
4067
|
+
};
|
|
4068
|
+
var ye = (t, e, n, r) => {
|
|
3987
4069
|
if (e && typeof e == "object" || typeof e == "function")
|
|
3988
|
-
for (let s of
|
|
3989
|
-
!
|
|
4070
|
+
for (let s of fe(e))
|
|
4071
|
+
!he.call(t, s) && s !== n && U(t, s, { get: () => e[s], enumerable: !(r = ge(e, s)) || r.enumerable });
|
|
3990
4072
|
return t;
|
|
3991
4073
|
};
|
|
3992
|
-
var
|
|
3993
|
-
var
|
|
3994
|
-
|
|
3995
|
-
module.exports =
|
|
3996
|
-
var
|
|
4074
|
+
var pe = (t) => ye(U({}, "__esModule", { value: true }), t);
|
|
4075
|
+
var Le = {};
|
|
4076
|
+
me(Le, { InvalidKeyError: () => w, InvalidStoreNameError: () => p, MissingProjectIdError: () => S, PagesBlobError: () => m, PreconditionFailedError: () => b, QuotaExceededError: () => x, RateLimitedError: () => B, Store: () => T, getStore: () => _e, listStores: () => Ne });
|
|
4077
|
+
module.exports = pe(Le);
|
|
4078
|
+
var m = class extends Error {
|
|
3997
4079
|
code;
|
|
3998
|
-
constructor(e,
|
|
3999
|
-
super(\`PagesBlob: \${
|
|
4080
|
+
constructor(e, n) {
|
|
4081
|
+
super(\`PagesBlob: \${n}\`), this.name = "PagesBlobError", this.code = e;
|
|
4000
4082
|
}
|
|
4001
4083
|
};
|
|
4002
|
-
var w = class extends
|
|
4084
|
+
var w = class extends m {
|
|
4003
4085
|
constructor(e) {
|
|
4004
4086
|
super("INVALID_KEY", e);
|
|
4005
4087
|
}
|
|
4006
4088
|
};
|
|
4007
|
-
var
|
|
4089
|
+
var p = class extends m {
|
|
4008
4090
|
constructor(e) {
|
|
4009
4091
|
super("INVALID_STORE_NAME", e);
|
|
4010
4092
|
}
|
|
4011
4093
|
};
|
|
4012
|
-
var
|
|
4094
|
+
var E = class extends m {
|
|
4013
4095
|
constructor(e) {
|
|
4014
4096
|
super("MISSING_ENVIRONMENT", \`Environment not configured for Pages Blob. Missing: \${e.join(", ")}. Supply these properties when creating a store, or ensure the function is running in a Pages environment.\`);
|
|
4015
4097
|
}
|
|
4016
4098
|
};
|
|
4017
|
-
var
|
|
4018
|
-
|
|
4019
|
-
|
|
4099
|
+
var we = "If usage just dropped back under the limit, wait a few minutes and retry.";
|
|
4100
|
+
var Ce = { storage: "write denied: storage quota exceeded (free plan 1 GB). Reads and deletes still work; delete objects or upgrade the plan.", "complex-operations": "write denied: complex operation quota (writes and lists) exceeded. Reads and deletes still work; upgrade the plan or wait until usage is back under the limit.", egress: "write denied: egress bandwidth quota exceeded. Only deletes still work; upgrade the plan or wait until usage is back under the limit." };
|
|
4101
|
+
var x = class extends m {
|
|
4102
|
+
reason;
|
|
4103
|
+
overMetrics;
|
|
4104
|
+
constructor(e = {}) {
|
|
4105
|
+
let n = e.reason && Ce[e.reason] || "write denied: blob quota exceeded.";
|
|
4106
|
+
super("QUOTA_EXCEEDED", \`\${n} \${we}\`), this.reason = e.reason, this.overMetrics = e.overMetrics ?? [];
|
|
4020
4107
|
}
|
|
4021
4108
|
};
|
|
4022
|
-
var
|
|
4109
|
+
var B = class extends m {
|
|
4023
4110
|
constructor() {
|
|
4024
4111
|
super("RATE_LIMITED", "request rate limited, please retry later");
|
|
4025
4112
|
}
|
|
4026
4113
|
};
|
|
4027
|
-
var
|
|
4114
|
+
var S = class extends m {
|
|
4028
4115
|
constructor() {
|
|
4029
4116
|
super("MISSING_PROJECT_ID", "projectId is required when using API token mode. Please supply { name, projectId, token } to getStore() / listStores().");
|
|
4030
4117
|
}
|
|
4031
4118
|
};
|
|
4032
|
-
var
|
|
4119
|
+
var y = class extends m {
|
|
4033
4120
|
constructor(e) {
|
|
4034
4121
|
super("CREDENTIAL_ERROR", e);
|
|
4035
4122
|
}
|
|
4036
4123
|
};
|
|
4037
|
-
var
|
|
4038
|
-
|
|
4039
|
-
|
|
4124
|
+
var h = class extends m {
|
|
4125
|
+
statusCode;
|
|
4126
|
+
constructor(e, n) {
|
|
4127
|
+
super("COS_ERROR", \`COS returned \${e}: \${n}\`), this.statusCode = e;
|
|
4040
4128
|
}
|
|
4041
4129
|
};
|
|
4042
|
-
var
|
|
4130
|
+
var b = class extends m {
|
|
4043
4131
|
constructor() {
|
|
4044
4132
|
super("PRECONDITION_FAILED", "conditional write failed (key already exists)");
|
|
4045
4133
|
}
|
|
@@ -4052,202 +4140,203 @@ var require_dist = __commonJS({
|
|
|
4052
4140
|
if (new TextEncoder().encode(t).length > 600)
|
|
4053
4141
|
throw new w("Blob key must be a sequence of Unicode characters whose UTF-8 encoding is at most 600 bytes long.");
|
|
4054
4142
|
}
|
|
4055
|
-
function
|
|
4143
|
+
function F(t) {
|
|
4056
4144
|
if (t === "")
|
|
4057
|
-
throw new
|
|
4145
|
+
throw new p("Store name must not be empty.");
|
|
4058
4146
|
if (t.includes("/") || t.includes(":"))
|
|
4059
|
-
throw new
|
|
4147
|
+
throw new p("Store name must not contain forward slashes (/) or colons (:).");
|
|
4060
4148
|
if (!/^[a-zA-Z0-9_-]+$/.test(t))
|
|
4061
|
-
throw new
|
|
4149
|
+
throw new p("Store name must only contain letters, digits, underscores, and hyphens.");
|
|
4062
4150
|
if (new TextEncoder().encode(t).length > 64)
|
|
4063
|
-
throw new
|
|
4151
|
+
throw new p("Store name must be a sequence of Unicode characters whose UTF-8 encoding is at most 64 bytes long.");
|
|
4064
4152
|
}
|
|
4065
|
-
var
|
|
4153
|
+
var T = class {
|
|
4066
4154
|
cosClient;
|
|
4067
4155
|
storeName;
|
|
4068
4156
|
defaultConsistency;
|
|
4069
|
-
constructor(e,
|
|
4070
|
-
this.cosClient = e, this.storeName =
|
|
4157
|
+
constructor(e, n, r = "eventual") {
|
|
4158
|
+
this.cosClient = e, this.storeName = n, this.defaultConsistency = r;
|
|
4071
4159
|
}
|
|
4072
4160
|
resolveConsistency(e) {
|
|
4073
4161
|
return e ?? this.defaultConsistency;
|
|
4074
4162
|
}
|
|
4075
|
-
async set(e,
|
|
4163
|
+
async set(e, n, r) {
|
|
4076
4164
|
C(e);
|
|
4077
|
-
let s = await this.cosClient.putObject(this.storeName, e,
|
|
4078
|
-
if ((
|
|
4079
|
-
throw new
|
|
4165
|
+
let s = await this.cosClient.putObject(this.storeName, e, n, { onlyIfNew: r == null ? void 0 : r.onlyIfNew, cacheControl: r == null ? void 0 : r.cacheControl });
|
|
4166
|
+
if ((r == null ? void 0 : r.onlyIfNew) && s.statusCode === 412)
|
|
4167
|
+
throw new b();
|
|
4080
4168
|
}
|
|
4081
|
-
async setJSON(e,
|
|
4169
|
+
async setJSON(e, n, r) {
|
|
4082
4170
|
C(e);
|
|
4083
|
-
let s = JSON.stringify(
|
|
4084
|
-
if ((
|
|
4085
|
-
throw new
|
|
4171
|
+
let s = JSON.stringify(n), o = await this.cosClient.putObject(this.storeName, e, s, { onlyIfNew: r == null ? void 0 : r.onlyIfNew, contentType: "application/json", cacheControl: r == null ? void 0 : r.cacheControl });
|
|
4172
|
+
if ((r == null ? void 0 : r.onlyIfNew) && o.statusCode === 412)
|
|
4173
|
+
throw new b();
|
|
4086
4174
|
}
|
|
4087
|
-
async createUploadUrl(e,
|
|
4175
|
+
async createUploadUrl(e, n) {
|
|
4088
4176
|
C(e);
|
|
4089
|
-
let { url:
|
|
4090
|
-
return { url:
|
|
4177
|
+
let { url: r, expiresAt: s } = await this.cosClient.createPresignedPutUrl(this.storeName, e, { expireSeconds: n == null ? void 0 : n.expireSeconds, contentType: n == null ? void 0 : n.contentType });
|
|
4178
|
+
return { url: r, key: e, expiresAt: s };
|
|
4091
4179
|
}
|
|
4092
|
-
async get(e,
|
|
4180
|
+
async get(e, n) {
|
|
4093
4181
|
C(e);
|
|
4094
|
-
let
|
|
4182
|
+
let r = this.resolveConsistency(n == null ? void 0 : n.consistency), s = await this.cosClient.getObject(this.storeName, e, r);
|
|
4095
4183
|
if (s === null)
|
|
4096
4184
|
return null;
|
|
4097
|
-
let { body:
|
|
4098
|
-
switch (
|
|
4185
|
+
let { body: o } = s, c = (n == null ? void 0 : n.type) ?? "text", i = new TextDecoder("utf-8");
|
|
4186
|
+
switch (c) {
|
|
4099
4187
|
case "text":
|
|
4100
|
-
return
|
|
4188
|
+
return i.decode(o);
|
|
4101
4189
|
case "json":
|
|
4102
|
-
return JSON.parse(
|
|
4190
|
+
return JSON.parse(i.decode(o));
|
|
4103
4191
|
case "arrayBuffer":
|
|
4104
|
-
return
|
|
4192
|
+
return o.buffer.slice(o.byteOffset, o.byteOffset + o.byteLength);
|
|
4105
4193
|
case "blob":
|
|
4106
|
-
return new Blob([
|
|
4194
|
+
return new Blob([o]);
|
|
4107
4195
|
case "stream":
|
|
4108
|
-
return new ReadableStream({ start(
|
|
4109
|
-
|
|
4196
|
+
return new ReadableStream({ start(d) {
|
|
4197
|
+
d.enqueue(o), d.close();
|
|
4110
4198
|
} });
|
|
4111
4199
|
default:
|
|
4112
|
-
return
|
|
4200
|
+
return i.decode(o);
|
|
4113
4201
|
}
|
|
4114
4202
|
}
|
|
4115
|
-
async getMetadata(e,
|
|
4203
|
+
async getMetadata(e, n) {
|
|
4116
4204
|
C(e);
|
|
4117
|
-
let
|
|
4118
|
-
return this.cosClient.headObject(this.storeName, e,
|
|
4205
|
+
let r = this.resolveConsistency(n == null ? void 0 : n.consistency);
|
|
4206
|
+
return this.cosClient.headObject(this.storeName, e, r);
|
|
4119
4207
|
}
|
|
4120
|
-
async getWithHeaders(e,
|
|
4208
|
+
async getWithHeaders(e, n) {
|
|
4121
4209
|
C(e);
|
|
4122
|
-
let
|
|
4210
|
+
let r = this.resolveConsistency(n == null ? void 0 : n.consistency), s = await this.cosClient.getObject(this.storeName, e, r);
|
|
4123
4211
|
return s ? { body: new TextDecoder("utf-8").decode(s.body), headers: s.headers || {} } : null;
|
|
4124
4212
|
}
|
|
4125
4213
|
async delete(e) {
|
|
4126
4214
|
C(e), await this.cosClient.deleteObject(this.storeName, e);
|
|
4127
4215
|
}
|
|
4128
4216
|
async list(e) {
|
|
4129
|
-
let
|
|
4130
|
-
for (;
|
|
4131
|
-
let
|
|
4132
|
-
if (
|
|
4217
|
+
let n = (e == null ? void 0 : e.paginate) !== false, r = e == null ? void 0 : e.limit, s = [], o = [], c = this.resolveConsistency(e == null ? void 0 : e.consistency), i = (e == null ? void 0 : e.cursor) || "", d = true, a;
|
|
4218
|
+
for (; d; ) {
|
|
4219
|
+
let l = r !== void 0 ? r - s.length : 1e3, g = Math.min(l, 1e3);
|
|
4220
|
+
if (g <= 0)
|
|
4133
4221
|
break;
|
|
4134
|
-
let
|
|
4135
|
-
for (let
|
|
4136
|
-
s.push({ key:
|
|
4137
|
-
|
|
4222
|
+
let u = await this.cosClient.listObjects(this.storeName, { prefix: e == null ? void 0 : e.prefix, delimiter: (e == null ? void 0 : e.directories) ? "/" : void 0, marker: i || void 0, maxKeys: g, consistency: c });
|
|
4223
|
+
for (let f of u.contents)
|
|
4224
|
+
s.push({ key: f.key, etag: f.etag });
|
|
4225
|
+
o.push(...u.commonPrefixes), r !== void 0 && s.length >= r ? (s.length = r, (u.isTruncated || u.contents.length === g) && (a = u.nextMarker), d = false) : u.isTruncated ? !n && r === void 0 ? (a = u.nextMarker, d = false) : i = u.nextMarker : d = false;
|
|
4138
4226
|
}
|
|
4139
|
-
return { blobs: s, directories:
|
|
4227
|
+
return { blobs: s, directories: o, ...a ? { cursor: a } : {} };
|
|
4140
4228
|
}
|
|
4141
4229
|
};
|
|
4142
|
-
var
|
|
4143
|
-
function
|
|
4144
|
-
let e =
|
|
4145
|
-
return
|
|
4230
|
+
var xe = new TextEncoder();
|
|
4231
|
+
function K(t) {
|
|
4232
|
+
let e = xe.encode(t), n = new ArrayBuffer(e.byteLength), r = new Uint8Array(n);
|
|
4233
|
+
return r.set(e), r;
|
|
4146
4234
|
}
|
|
4147
|
-
function
|
|
4148
|
-
let e = t instanceof Uint8Array ? t : new Uint8Array(t),
|
|
4149
|
-
for (let
|
|
4150
|
-
|
|
4151
|
-
return
|
|
4235
|
+
function V(t) {
|
|
4236
|
+
let e = t instanceof Uint8Array ? t : new Uint8Array(t), n = "";
|
|
4237
|
+
for (let r = 0; r < e.length; r++)
|
|
4238
|
+
n += e[r].toString(16).padStart(2, "0");
|
|
4239
|
+
return n;
|
|
4152
4240
|
}
|
|
4153
|
-
async function
|
|
4154
|
-
let
|
|
4155
|
-
return
|
|
4241
|
+
async function W(t, e) {
|
|
4242
|
+
let n = await crypto.subtle.importKey("raw", K(t), { name: "HMAC", hash: "SHA-1" }, false, ["sign"]), r = await crypto.subtle.sign("HMAC", n, K(e));
|
|
4243
|
+
return V(r);
|
|
4156
4244
|
}
|
|
4157
|
-
async function
|
|
4158
|
-
let e = await crypto.subtle.digest("SHA-1",
|
|
4159
|
-
return
|
|
4245
|
+
async function be(t) {
|
|
4246
|
+
let e = await crypto.subtle.digest("SHA-1", K(t));
|
|
4247
|
+
return V(e);
|
|
4160
4248
|
}
|
|
4161
|
-
function
|
|
4249
|
+
function j(t) {
|
|
4162
4250
|
return encodeURIComponent(t).replace(/[!'()*]/g, (e) => "%" + e.charCodeAt(0).toString(16).toUpperCase());
|
|
4163
4251
|
}
|
|
4164
|
-
function
|
|
4252
|
+
function I(t) {
|
|
4165
4253
|
try {
|
|
4166
4254
|
return decodeURIComponent(t);
|
|
4167
4255
|
} catch {
|
|
4168
4256
|
return t;
|
|
4169
4257
|
}
|
|
4170
4258
|
}
|
|
4171
|
-
function
|
|
4172
|
-
return t.split("/").map((e) =>
|
|
4259
|
+
function Ee(t) {
|
|
4260
|
+
return t.split("/").map((e) => I(e)).join("/");
|
|
4173
4261
|
}
|
|
4174
|
-
function
|
|
4175
|
-
return
|
|
4262
|
+
function k(t) {
|
|
4263
|
+
return Ee(I(t));
|
|
4176
4264
|
}
|
|
4177
|
-
function
|
|
4178
|
-
return t.split("/").map((e) =>
|
|
4265
|
+
function J(t) {
|
|
4266
|
+
return t.split("/").map((e) => j(I(e))).join("/");
|
|
4179
4267
|
}
|
|
4180
|
-
var
|
|
4181
|
-
function
|
|
4182
|
-
return t === "host" || t === "x-cos-security-token" ? false : !!(
|
|
4268
|
+
var Se = /* @__PURE__ */ new Set(["cache-control", "content-disposition", "content-encoding", "content-length", "content-md5", "content-type", "expect", "expires", "if-match", "if-modified-since", "if-none-match", "if-unmodified-since", "origin", "range", "transfer-encoding"]);
|
|
4269
|
+
function Te(t) {
|
|
4270
|
+
return t === "host" || t === "x-cos-security-token" ? false : !!(Se.has(t) || t.startsWith("x-cos-"));
|
|
4183
4271
|
}
|
|
4184
4272
|
function X(t) {
|
|
4185
4273
|
if (!t)
|
|
4186
4274
|
return [];
|
|
4187
4275
|
let e = [];
|
|
4188
|
-
for (let [
|
|
4189
|
-
|
|
4190
|
-
return e.sort(([
|
|
4276
|
+
for (let [n, r] of Object.entries(t))
|
|
4277
|
+
r != null && e.push([n.toLowerCase(), String(r)]);
|
|
4278
|
+
return e.sort(([n], [r]) => n < r ? -1 : n > r ? 1 : 0), e;
|
|
4191
4279
|
}
|
|
4192
4280
|
function Y(t) {
|
|
4193
|
-
return t.map(([e,
|
|
4281
|
+
return t.map(([e, n]) => \`\${j(e)}=\${j(n)}\`).join("&");
|
|
4194
4282
|
}
|
|
4195
|
-
function
|
|
4196
|
-
return t.map(([e]) =>
|
|
4197
|
-
}
|
|
4198
|
-
async function
|
|
4199
|
-
let e = t.method.toLowerCase(),
|
|
4200
|
-
\${
|
|
4201
|
-
\${
|
|
4202
|
-
\${
|
|
4203
|
-
\`,
|
|
4204
|
-
\${
|
|
4205
|
-
\${await
|
|
4206
|
-
\`,
|
|
4207
|
-
for (let [
|
|
4208
|
-
|
|
4209
|
-
return { authorization:
|
|
4210
|
-
}
|
|
4211
|
-
async function
|
|
4212
|
-
let e = new URL(t.domain),
|
|
4283
|
+
function G(t) {
|
|
4284
|
+
return t.map(([e]) => j(e)).join(";");
|
|
4285
|
+
}
|
|
4286
|
+
async function Z(t) {
|
|
4287
|
+
let e = t.method.toLowerCase(), n = t.pathname.startsWith("/") ? t.pathname : \`/\${t.pathname}\`, r = Math.floor(Date.now() / 1e3), s = r + (t.expireSeconds ?? 3600), o = \`\${r};\${s}\`, i = X(t.headers).filter(([L]) => Te(L)), d = G(i), a = Y(i), l = X(t.query), g = G(l), u = Y(l), f = \`\${e}
|
|
4288
|
+
\${n}
|
|
4289
|
+
\${u}
|
|
4290
|
+
\${a}
|
|
4291
|
+
\`, _ = \`sha1
|
|
4292
|
+
\${o}
|
|
4293
|
+
\${await be(f)}
|
|
4294
|
+
\`, N = await W(t.secretKey, o), de = await W(N, _), le = ["q-sign-algorithm=sha1", \`q-ak=\${t.secretId}\`, \`q-sign-time=\${o}\`, \`q-key-time=\${o}\`, \`q-header-list=\${d}\`, \`q-url-param-list=\${g}\`, \`q-signature=\${de}\`].join("&"), H = {};
|
|
4295
|
+
for (let [L, ue] of i)
|
|
4296
|
+
H[L] = ue;
|
|
4297
|
+
return { authorization: le, signedHeaders: H };
|
|
4298
|
+
}
|
|
4299
|
+
async function Q(t) {
|
|
4300
|
+
let e = new URL(t.domain), n = I(t.key), r = \`/\${k(t.key)}\`, s = \`/\${J(n)}\`;
|
|
4213
4301
|
e.pathname = s;
|
|
4214
|
-
let { authorization:
|
|
4302
|
+
let { authorization: o } = await Z({ method: t.method, pathname: r, query: t.query, headers: t.headers, secretId: t.credential.secretId, secretKey: t.credential.secretKey, expireSeconds: t.expireSeconds });
|
|
4215
4303
|
if (t.query)
|
|
4216
|
-
for (let [
|
|
4217
|
-
|
|
4218
|
-
for (let
|
|
4219
|
-
let
|
|
4220
|
-
if (
|
|
4304
|
+
for (let [c, i] of Object.entries(t.query))
|
|
4305
|
+
i != null && e.searchParams.set(c, String(i));
|
|
4306
|
+
for (let c of o.split("&")) {
|
|
4307
|
+
let i = c.indexOf("=");
|
|
4308
|
+
if (i === -1)
|
|
4221
4309
|
continue;
|
|
4222
|
-
let
|
|
4223
|
-
e.searchParams.set(
|
|
4310
|
+
let d = c.slice(0, i), a = c.slice(i + 1);
|
|
4311
|
+
e.searchParams.set(d, a);
|
|
4224
4312
|
}
|
|
4225
4313
|
return t.credential.sessionToken && e.searchParams.set("x-cos-security-token", t.credential.sessionToken), e.toString();
|
|
4226
4314
|
}
|
|
4227
|
-
async function
|
|
4228
|
-
let e = new URL(t.domain),
|
|
4315
|
+
async function P(t) {
|
|
4316
|
+
let e = new URL(t.domain), n = t.key ? I(t.key) : "", r = t.key ? \`/\${k(t.key)}\` : "/", s = n ? \`/\${J(n)}\` : "/";
|
|
4229
4317
|
if (e.pathname = s, t.query)
|
|
4230
|
-
for (let [
|
|
4231
|
-
|
|
4232
|
-
let { authorization:
|
|
4318
|
+
for (let [g, u] of Object.entries(t.query))
|
|
4319
|
+
u != null && e.searchParams.set(g, String(u));
|
|
4320
|
+
let { authorization: o } = await Z({ method: t.method, pathname: r, query: t.query, headers: t.headers, secretId: t.credential.secretId, secretKey: t.credential.secretKey }), c = new Headers();
|
|
4233
4321
|
if (t.headers)
|
|
4234
|
-
for (let [
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
let
|
|
4238
|
-
for (let
|
|
4322
|
+
for (let [g, u] of Object.entries(t.headers))
|
|
4323
|
+
u != null && c.set(g, String(u));
|
|
4324
|
+
c.set("Authorization", o), t.credential.sessionToken && c.set("x-cos-security-token", t.credential.sessionToken);
|
|
4325
|
+
let i = e.toString(), d = { method: t.method, headers: c, body: t.body ?? void 0, signal: t.signal }, a = 2, l;
|
|
4326
|
+
for (let g = 0; g <= a; g++)
|
|
4239
4327
|
try {
|
|
4240
|
-
return await fetch(
|
|
4241
|
-
} catch (
|
|
4242
|
-
if (
|
|
4243
|
-
throw
|
|
4244
|
-
|
|
4245
|
-
}
|
|
4246
|
-
throw
|
|
4247
|
-
}
|
|
4248
|
-
var
|
|
4249
|
-
var
|
|
4250
|
-
var
|
|
4328
|
+
return await fetch(i, d);
|
|
4329
|
+
} catch (u) {
|
|
4330
|
+
if (l = u, u instanceof DOMException && u.name === "AbortError")
|
|
4331
|
+
throw u;
|
|
4332
|
+
g < a && await new Promise((f) => setTimeout(f, 1e3 * (g + 1)));
|
|
4333
|
+
}
|
|
4334
|
+
throw l;
|
|
4335
|
+
}
|
|
4336
|
+
var Pe = "blob.edgeone.site";
|
|
4337
|
+
var Ie = "blob-nocache.edgeone.site";
|
|
4338
|
+
var ke = "max-age=0, stale-while-revalidate=60";
|
|
4339
|
+
var D = class t {
|
|
4251
4340
|
credentialManager;
|
|
4252
4341
|
bucket = "";
|
|
4253
4342
|
region = "";
|
|
@@ -4255,17 +4344,17 @@ var require_dist = __commonJS({
|
|
|
4255
4344
|
cachedDomain = "";
|
|
4256
4345
|
uncachedDomain = "";
|
|
4257
4346
|
initialized = false;
|
|
4258
|
-
static buildErrorDetail(e,
|
|
4259
|
-
let
|
|
4260
|
-
return \`\${e} \${
|
|
4347
|
+
static buildErrorDetail(e, n, r, s, o) {
|
|
4348
|
+
let c = r ? \`\${n}/\${r}\` : n, i = o ? \` [request-id: \${o}]\` : "";
|
|
4349
|
+
return \`\${e} \${c} - \${Ae(s)}\${i}\`;
|
|
4261
4350
|
}
|
|
4262
4351
|
constructor(e) {
|
|
4263
4352
|
this.credentialManager = e;
|
|
4264
4353
|
}
|
|
4265
4354
|
computeSubdomain(e) {
|
|
4266
|
-
let
|
|
4267
|
-
if (e.appId &&
|
|
4268
|
-
return
|
|
4355
|
+
let n = [];
|
|
4356
|
+
if (e.appId && n.push(e.appId), e.zoneId && n.push(e.zoneId), e.projectId && n.push(e.projectId), n.length >= 2)
|
|
4357
|
+
return n.join("-");
|
|
4269
4358
|
if (e.resourcePrefix) {
|
|
4270
4359
|
let s = e.resourcePrefix.replace(/\\/?\\*$/, "").split("/").filter(Boolean);
|
|
4271
4360
|
if (s.length >= 2)
|
|
@@ -4278,12 +4367,16 @@ var require_dist = __commonJS({
|
|
|
4278
4367
|
return;
|
|
4279
4368
|
let e = await this.credentialManager.getCredential();
|
|
4280
4369
|
!this.keyPrefix && e.resourcePrefix && (this.keyPrefix = e.resourcePrefix.replace(/\\/?\\*$/, ""));
|
|
4281
|
-
let
|
|
4282
|
-
!this.bucket &&
|
|
4283
|
-
let
|
|
4284
|
-
if (!
|
|
4285
|
-
|
|
4286
|
-
|
|
4370
|
+
let n = e.edgeRegion === "CN", r = e.cosMainland, s = e.cosOverseas, o = n ? r || s : s || r;
|
|
4371
|
+
!this.bucket && o && (this.bucket = o.bucket, this.region = o.region);
|
|
4372
|
+
let { cachedDomain: c, uncachedDomain: i } = e;
|
|
4373
|
+
if (!c || !i) {
|
|
4374
|
+
let d = this.computeSubdomain(e);
|
|
4375
|
+
if (!d)
|
|
4376
|
+
throw new h(0, "unable to derive tenant subdomain from credential; missing appId/zoneId/projectId or resourcePrefix");
|
|
4377
|
+
c || (c = \`https://\${d}.\${Pe}\`), i || (i = \`https://\${d}.\${Ie}\`);
|
|
4378
|
+
}
|
|
4379
|
+
this.cachedDomain = c, this.uncachedDomain = i, this.initialized = true;
|
|
4287
4380
|
}
|
|
4288
4381
|
async resolveDomain(e) {
|
|
4289
4382
|
return await this.ensureInitialized(), e === "strong" ? this.uncachedDomain : this.cachedDomain;
|
|
@@ -4292,127 +4385,158 @@ var require_dist = __commonJS({
|
|
|
4292
4385
|
let e = await this.credentialManager.getCredential();
|
|
4293
4386
|
return { secretId: e.tmpSecretId, secretKey: e.tmpSecretKey, sessionToken: e.sessionToken };
|
|
4294
4387
|
}
|
|
4295
|
-
buildCosKey(e,
|
|
4296
|
-
return \`\${this.keyPrefix}/\${e}/\${
|
|
4388
|
+
buildCosKey(e, n) {
|
|
4389
|
+
return \`\${this.keyPrefix}/\${e}/\${n}\`;
|
|
4297
4390
|
}
|
|
4298
4391
|
async getDomains() {
|
|
4299
4392
|
return await this.ensureInitialized(), { cached: this.cachedDomain, uncached: this.uncachedDomain };
|
|
4300
4393
|
}
|
|
4301
|
-
async putObject(e,
|
|
4302
|
-
let
|
|
4303
|
-
(s == null ? void 0 : s.onlyIfNew) && (
|
|
4394
|
+
async putObject(e, n, r, s) {
|
|
4395
|
+
let o = await this.resolveDomain("strong"), c = await this.ensureWriteAllowed(), i = await this.resolveCredential(), d = this.buildCosKey(e, n), { defaultCacheControl: a = ke } = c, l = (s == null ? void 0 : s.cacheControl) === null ? void 0 : (s == null ? void 0 : s.cacheControl) ?? a, g = {};
|
|
4396
|
+
(s == null ? void 0 : s.onlyIfNew) && (g["x-cos-forbid-overwrite"] = "true"), l && (g["Cache-Control"] = l), (s == null ? void 0 : s.contentType) && (g["Content-Type"] = s.contentType);
|
|
4397
|
+
let u;
|
|
4304
4398
|
try {
|
|
4305
|
-
let
|
|
4306
|
-
if (
|
|
4307
|
-
return await
|
|
4399
|
+
let f = await P({ domain: o, method: "PUT", key: d, headers: g, body: r, credential: i });
|
|
4400
|
+
if ((s == null ? void 0 : s.onlyIfNew) && (f.status === 409 || f.status === 412))
|
|
4401
|
+
return await f.arrayBuffer().catch(() => {
|
|
4308
4402
|
}), { etag: "", statusCode: 412 };
|
|
4309
|
-
if (
|
|
4310
|
-
let
|
|
4311
|
-
|
|
4403
|
+
if (f.ok) {
|
|
4404
|
+
let N = f.headers.get("etag") || "";
|
|
4405
|
+
return await f.arrayBuffer().catch(() => {
|
|
4406
|
+
}), { etag: N, statusCode: f.status };
|
|
4312
4407
|
}
|
|
4313
|
-
let
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4408
|
+
let _ = await A(f);
|
|
4409
|
+
u = new h(f.status, t.buildErrorDetail("PUT", o, d, _ || \`status \${f.status}\`, R(f)));
|
|
4410
|
+
} catch (f) {
|
|
4411
|
+
u = new h(0, t.buildErrorDetail("PUT", o, d, v(f)));
|
|
4412
|
+
}
|
|
4413
|
+
throw await this.explainWriteFailure(u);
|
|
4414
|
+
}
|
|
4415
|
+
async ensureWriteAllowed() {
|
|
4416
|
+
let e = await this.credentialManager.getCredential();
|
|
4417
|
+
if (e.writeAllowed !== false)
|
|
4418
|
+
return e;
|
|
4419
|
+
let n = e;
|
|
4420
|
+
try {
|
|
4421
|
+
n = await this.credentialManager.refreshCredential();
|
|
4422
|
+
} catch {
|
|
4318
4423
|
}
|
|
4424
|
+
return ee(n), n;
|
|
4319
4425
|
}
|
|
4320
|
-
async
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4426
|
+
async explainWriteFailure(e) {
|
|
4427
|
+
if (![0, 403, 550].includes(e.statusCode))
|
|
4428
|
+
return e;
|
|
4429
|
+
try {
|
|
4430
|
+
let n = await this.credentialManager.refreshCredential();
|
|
4431
|
+
ee(n);
|
|
4432
|
+
} catch (n) {
|
|
4433
|
+
if (n instanceof x)
|
|
4434
|
+
return n;
|
|
4435
|
+
}
|
|
4436
|
+
return e;
|
|
4325
4437
|
}
|
|
4326
|
-
async
|
|
4327
|
-
let s = await this.resolveDomain(
|
|
4438
|
+
async createPresignedPutUrl(e, n, r) {
|
|
4439
|
+
let s = await this.resolveDomain("strong");
|
|
4440
|
+
await this.ensureWriteAllowed();
|
|
4441
|
+
let o = await this.resolveCredential(), c = this.buildCosKey(e, n), i = {};
|
|
4442
|
+
(r == null ? void 0 : r.contentType) && (i["Content-Type"] = r.contentType);
|
|
4443
|
+
let d = (r == null ? void 0 : r.expireSeconds) ?? 3600, a = await Q({ domain: s, method: "PUT", key: c, headers: i, credential: o, expireSeconds: d }), l = Math.floor(Date.now() / 1e3) + d;
|
|
4444
|
+
return { url: a, expiresAt: l };
|
|
4445
|
+
}
|
|
4446
|
+
async getObject(e, n, r) {
|
|
4447
|
+
let s = await this.resolveDomain(r), o = await this.resolveCredential(), c = this.buildCosKey(e, n);
|
|
4328
4448
|
try {
|
|
4329
|
-
let
|
|
4330
|
-
if (
|
|
4331
|
-
return await
|
|
4449
|
+
let i = await P({ domain: s, method: "GET", key: c, credential: o });
|
|
4450
|
+
if (i.status === 404)
|
|
4451
|
+
return await i.arrayBuffer().catch(() => {
|
|
4332
4452
|
}), null;
|
|
4333
|
-
if (!
|
|
4334
|
-
let
|
|
4335
|
-
throw new
|
|
4453
|
+
if (!i.ok) {
|
|
4454
|
+
let l = await A(i);
|
|
4455
|
+
throw new h(i.status, t.buildErrorDetail("GET", s, c, l || \`status \${i.status}\`, R(i)));
|
|
4336
4456
|
}
|
|
4337
|
-
let
|
|
4338
|
-
return { body:
|
|
4339
|
-
} catch (
|
|
4340
|
-
throw
|
|
4457
|
+
let d = new Uint8Array(await i.arrayBuffer()), a = te(i.headers);
|
|
4458
|
+
return { body: d, contentType: a["content-type"], headers: a };
|
|
4459
|
+
} catch (i) {
|
|
4460
|
+
throw i instanceof h ? i : new h(0, t.buildErrorDetail("GET", s, c, v(i)));
|
|
4341
4461
|
}
|
|
4342
4462
|
}
|
|
4343
|
-
async headObject(e,
|
|
4344
|
-
let s = await this.resolveDomain(
|
|
4463
|
+
async headObject(e, n, r) {
|
|
4464
|
+
let s = await this.resolveDomain(r), o = await this.resolveCredential(), c = this.buildCosKey(e, n);
|
|
4345
4465
|
try {
|
|
4346
|
-
let
|
|
4347
|
-
if (
|
|
4466
|
+
let i = await P({ domain: s, method: "HEAD", key: c, credential: o });
|
|
4467
|
+
if (i.status === 404)
|
|
4348
4468
|
return null;
|
|
4349
|
-
if (!
|
|
4350
|
-
let
|
|
4351
|
-
throw new
|
|
4469
|
+
if (!i.ok) {
|
|
4470
|
+
let a = await A(i);
|
|
4471
|
+
throw new h(i.status, t.buildErrorDetail("HEAD", s, c, a || \`status \${i.status}\`, R(i)));
|
|
4352
4472
|
}
|
|
4353
|
-
let
|
|
4354
|
-
return { cacheControl:
|
|
4355
|
-
} catch (
|
|
4356
|
-
throw
|
|
4473
|
+
let d = te(i.headers);
|
|
4474
|
+
return { cacheControl: d["cache-control"], contentType: d["content-type"], etag: d.etag, headers: d };
|
|
4475
|
+
} catch (i) {
|
|
4476
|
+
throw i instanceof h ? i : new h(0, t.buildErrorDetail("HEAD", s, c, v(i)));
|
|
4357
4477
|
}
|
|
4358
4478
|
}
|
|
4359
|
-
async deleteObject(e,
|
|
4360
|
-
let
|
|
4479
|
+
async deleteObject(e, n) {
|
|
4480
|
+
let r = await this.resolveDomain("strong"), s = await this.resolveCredential(), o = this.buildCosKey(e, n);
|
|
4361
4481
|
try {
|
|
4362
|
-
let
|
|
4363
|
-
if (
|
|
4364
|
-
await
|
|
4482
|
+
let c = await P({ domain: r, method: "DELETE", key: o, credential: s });
|
|
4483
|
+
if (c.status === 204 || c.status === 404 || c.ok) {
|
|
4484
|
+
await c.arrayBuffer().catch(() => {
|
|
4365
4485
|
});
|
|
4366
4486
|
return;
|
|
4367
4487
|
}
|
|
4368
|
-
let
|
|
4369
|
-
throw new
|
|
4370
|
-
} catch (
|
|
4371
|
-
throw
|
|
4488
|
+
let i = await A(c);
|
|
4489
|
+
throw new h(c.status, t.buildErrorDetail("DELETE", r, o, i || \`status \${c.status}\`, R(c)));
|
|
4490
|
+
} catch (c) {
|
|
4491
|
+
throw c instanceof h ? c : new h(0, t.buildErrorDetail("DELETE", r, o, v(c)));
|
|
4372
4492
|
}
|
|
4373
4493
|
}
|
|
4374
|
-
async listObjects(e,
|
|
4494
|
+
async listObjects(e, n) {
|
|
4375
4495
|
await this.ensureInitialized();
|
|
4376
|
-
let
|
|
4377
|
-
let
|
|
4378
|
-
return
|
|
4379
|
-
}).filter((
|
|
4380
|
-
return { contents:
|
|
4496
|
+
let r = \`\${this.keyPrefix}/\${e}/\`, s = (n == null ? void 0 : n.prefix) ? r + n.prefix : r, o = await this.getBucketRaw({ prefix: s, delimiter: n == null ? void 0 : n.delimiter, marker: n == null ? void 0 : n.marker, maxKeys: n == null ? void 0 : n.maxKeys, consistency: n == null ? void 0 : n.consistency }), c = o.contents.map((d) => {
|
|
4497
|
+
let a = d.key, l = a.startsWith(r) ? a.slice(r.length) : a;
|
|
4498
|
+
return l ? { key: l, etag: d.etag } : null;
|
|
4499
|
+
}).filter((d) => d !== null), i = o.commonPrefixes.map((d) => d.startsWith(r) ? d.slice(r.length) : d).filter((d) => !!d);
|
|
4500
|
+
return { contents: c, commonPrefixes: i, isTruncated: o.isTruncated, nextMarker: o.nextMarker };
|
|
4381
4501
|
}
|
|
4382
4502
|
async listStores(e) {
|
|
4383
|
-
let
|
|
4503
|
+
let n = [], r = "", s = true;
|
|
4384
4504
|
for (; s; ) {
|
|
4385
4505
|
await this.ensureInitialized();
|
|
4386
|
-
let
|
|
4387
|
-
for (let
|
|
4388
|
-
let
|
|
4389
|
-
|
|
4506
|
+
let o = \`\${this.keyPrefix}/\`, c = await this.getBucketRaw({ prefix: o, delimiter: "/", maxKeys: 1e3, marker: r || void 0, consistency: e });
|
|
4507
|
+
for (let i of c.commonPrefixes) {
|
|
4508
|
+
let d = i.startsWith(o) ? i.slice(o.length, -1) : i.slice(0, -1);
|
|
4509
|
+
d && n.push(d);
|
|
4390
4510
|
}
|
|
4391
|
-
if (s =
|
|
4511
|
+
if (s = c.isTruncated, r = c.nextMarker, !s || !r)
|
|
4392
4512
|
break;
|
|
4393
4513
|
}
|
|
4394
|
-
return
|
|
4514
|
+
return n;
|
|
4395
4515
|
}
|
|
4396
4516
|
async getBucketRaw(e) {
|
|
4397
|
-
let
|
|
4398
|
-
e.delimiter && (s.delimiter = e.delimiter), e.marker && (s.marker =
|
|
4517
|
+
let n = await this.resolveDomain(e.consistency), r = await this.resolveCredential(), s = { prefix: k(e.prefix) };
|
|
4518
|
+
e.delimiter && (s.delimiter = e.delimiter), e.marker && (s.marker = k(e.marker)), e.maxKeys && (s["max-keys"] = e.maxKeys);
|
|
4399
4519
|
try {
|
|
4400
|
-
let
|
|
4401
|
-
if (!
|
|
4402
|
-
let
|
|
4403
|
-
throw new
|
|
4520
|
+
let o = await P({ domain: n, method: "GET", query: s, credential: r });
|
|
4521
|
+
if (!o.ok) {
|
|
4522
|
+
let i = await A(o);
|
|
4523
|
+
throw new h(o.status, t.buildErrorDetail("LIST", n, e.prefix, i || \`status \${o.status}\`, R(o)));
|
|
4404
4524
|
}
|
|
4405
|
-
let
|
|
4406
|
-
return
|
|
4407
|
-
} catch (
|
|
4408
|
-
throw
|
|
4525
|
+
let c = await o.text();
|
|
4526
|
+
return Re(c);
|
|
4527
|
+
} catch (o) {
|
|
4528
|
+
throw o instanceof h ? o : new h(0, t.buildErrorDetail("LIST", n, e.prefix, v(o)));
|
|
4409
4529
|
}
|
|
4410
4530
|
}
|
|
4411
4531
|
};
|
|
4412
|
-
function
|
|
4532
|
+
function ee(t) {
|
|
4533
|
+
if (t.writeAllowed === false)
|
|
4534
|
+
throw new x({ reason: t.writeDeniedReason, overMetrics: t.overMetrics });
|
|
4535
|
+
}
|
|
4536
|
+
function Ae(t) {
|
|
4413
4537
|
return t.replace(/[a-zA-Z0-9\\-]+\\.cos\\.[a-zA-Z0-9\\-.]+\\.myqcloud\\.com/gi, "[cos-origin]").replace(/[a-zA-Z0-9\\-]+\\.cos\\.[a-zA-Z0-9\\-.]+\\.tencentcos\\.cn/gi, "[cos-origin]");
|
|
4414
4538
|
}
|
|
4415
|
-
async function
|
|
4539
|
+
async function A(t) {
|
|
4416
4540
|
try {
|
|
4417
4541
|
return await t.text();
|
|
4418
4542
|
} catch {
|
|
@@ -4422,87 +4546,89 @@ var require_dist = __commonJS({
|
|
|
4422
4546
|
function R(t) {
|
|
4423
4547
|
return t.headers.get("x-cos-request-id") || t.headers.get("x-eo-log-id") || void 0;
|
|
4424
4548
|
}
|
|
4425
|
-
function
|
|
4426
|
-
let e = t,
|
|
4427
|
-
if (
|
|
4428
|
-
let s =
|
|
4429
|
-
return s ? \`\${
|
|
4549
|
+
function v(t) {
|
|
4550
|
+
let e = t, n = e.message || String(t), r = e.cause;
|
|
4551
|
+
if (r) {
|
|
4552
|
+
let s = r.message || r.code || "";
|
|
4553
|
+
return s ? \`\${n} (\${s})\` : n;
|
|
4430
4554
|
}
|
|
4431
|
-
return
|
|
4555
|
+
return n;
|
|
4432
4556
|
}
|
|
4433
|
-
function
|
|
4557
|
+
function te(t) {
|
|
4434
4558
|
let e = {};
|
|
4435
|
-
return t.forEach((
|
|
4436
|
-
e[
|
|
4559
|
+
return t.forEach((n, r) => {
|
|
4560
|
+
e[r.toLowerCase()] = n;
|
|
4437
4561
|
}), e;
|
|
4438
4562
|
}
|
|
4439
|
-
function
|
|
4440
|
-
let e = [],
|
|
4441
|
-
for (; (
|
|
4442
|
-
let
|
|
4443
|
-
|
|
4563
|
+
function Re(t) {
|
|
4564
|
+
let e = [], n = /<Contents>([\\s\\S]*?)<\\/Contents>/g, r;
|
|
4565
|
+
for (; (r = n.exec(t)) !== null; ) {
|
|
4566
|
+
let a = r[1], l = M(a, "Key"), g = M(a, "ETag");
|
|
4567
|
+
l !== null && e.push({ key: q(l), etag: g || "" });
|
|
4444
4568
|
}
|
|
4445
|
-
let s = [],
|
|
4446
|
-
for (; (
|
|
4447
|
-
let
|
|
4448
|
-
|
|
4569
|
+
let s = [], o = /<CommonPrefixes>([\\s\\S]*?)<\\/CommonPrefixes>/g;
|
|
4570
|
+
for (; (r = o.exec(t)) !== null; ) {
|
|
4571
|
+
let a = r[1], l = M(a, "Prefix");
|
|
4572
|
+
l !== null && s.push(q(l));
|
|
4449
4573
|
}
|
|
4450
|
-
let
|
|
4451
|
-
return { contents: e, commonPrefixes: s, isTruncated:
|
|
4574
|
+
let i = M(t, "IsTruncated") === "true", d = M(t, "NextMarker") || "";
|
|
4575
|
+
return { contents: e, commonPrefixes: s, isTruncated: i, nextMarker: q(d) };
|
|
4452
4576
|
}
|
|
4453
|
-
function
|
|
4454
|
-
let
|
|
4455
|
-
return
|
|
4577
|
+
function M(t, e) {
|
|
4578
|
+
let r = new RegExp(\`<\${e}>([\\\\s\\\\S]*?)<\\\\/\${e}>\`).exec(t);
|
|
4579
|
+
return r ? r[1] : null;
|
|
4456
4580
|
}
|
|
4457
|
-
function
|
|
4581
|
+
function q(t) {
|
|
4458
4582
|
return t.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
4459
4583
|
}
|
|
4460
|
-
var
|
|
4461
|
-
async function
|
|
4584
|
+
var ve = "X-RateLimit-Reset";
|
|
4585
|
+
async function $(t, e, n = 2) {
|
|
4462
4586
|
var _a, _b;
|
|
4463
4587
|
(_b = (_a = e.signal) == null ? void 0 : _a.throwIfAborted) == null ? void 0 : _b.call(_a);
|
|
4464
4588
|
try {
|
|
4465
|
-
let
|
|
4466
|
-
if (
|
|
4467
|
-
let s =
|
|
4468
|
-
return await
|
|
4589
|
+
let r = await fetch(t, e);
|
|
4590
|
+
if (n > 0 && (r.status === 429 || r.status >= 500)) {
|
|
4591
|
+
let s = ne(r.headers.get(ve));
|
|
4592
|
+
return await re(s, e.signal), $(t, e, n - 1);
|
|
4469
4593
|
}
|
|
4470
|
-
return
|
|
4471
|
-
} catch (
|
|
4472
|
-
if (
|
|
4473
|
-
throw
|
|
4474
|
-
let s =
|
|
4475
|
-
return await
|
|
4594
|
+
return r;
|
|
4595
|
+
} catch (r) {
|
|
4596
|
+
if (n === 0 || r instanceof DOMException && r.name === "AbortError")
|
|
4597
|
+
throw r;
|
|
4598
|
+
let s = ne();
|
|
4599
|
+
return await re(s, e.signal), $(t, e, n - 1);
|
|
4476
4600
|
}
|
|
4477
4601
|
}
|
|
4478
|
-
function
|
|
4602
|
+
function ne(t) {
|
|
4479
4603
|
return t ? Math.max(Number(t) * 1e3 - Date.now(), 500) : 1500;
|
|
4480
4604
|
}
|
|
4481
|
-
function
|
|
4482
|
-
return new Promise((
|
|
4605
|
+
function re(t, e) {
|
|
4606
|
+
return new Promise((n, r) => {
|
|
4483
4607
|
if (e == null ? void 0 : e.aborted)
|
|
4484
|
-
return
|
|
4608
|
+
return r(e.reason);
|
|
4485
4609
|
let s = setTimeout(() => {
|
|
4486
|
-
e == null ? void 0 : e.removeEventListener("abort",
|
|
4487
|
-
}, t),
|
|
4488
|
-
clearTimeout(s),
|
|
4610
|
+
e == null ? void 0 : e.removeEventListener("abort", o), n();
|
|
4611
|
+
}, t), o = () => {
|
|
4612
|
+
clearTimeout(s), r(e.reason);
|
|
4489
4613
|
};
|
|
4490
|
-
e == null ? void 0 : e.addEventListener("abort",
|
|
4614
|
+
e == null ? void 0 : e.addEventListener("abort", o, { once: true });
|
|
4491
4615
|
});
|
|
4492
4616
|
}
|
|
4493
|
-
var
|
|
4494
|
-
function
|
|
4617
|
+
var Me = "prod";
|
|
4618
|
+
function se() {
|
|
4495
4619
|
let t = typeof process < "u" ? process.env.PAGES_BLOB_STS_ENV : void 0;
|
|
4496
|
-
return t === "test" || t === "prod" ? t :
|
|
4620
|
+
return t === "test" || t === "prod" ? t : Me;
|
|
4497
4621
|
}
|
|
4498
|
-
var
|
|
4499
|
-
var
|
|
4500
|
-
var
|
|
4622
|
+
var De = 300;
|
|
4623
|
+
var Oe = 6e4;
|
|
4624
|
+
var Be = "https://blob-sts.edgeone.site/";
|
|
4625
|
+
var O = class {
|
|
4501
4626
|
authToken;
|
|
4502
4627
|
projectId;
|
|
4503
4628
|
cached = null;
|
|
4504
|
-
|
|
4505
|
-
|
|
4629
|
+
lastForcedRefreshAt = 0;
|
|
4630
|
+
constructor(e, n) {
|
|
4631
|
+
this.authToken = e, this.projectId = n;
|
|
4506
4632
|
}
|
|
4507
4633
|
async getCredential() {
|
|
4508
4634
|
if (this.cached && !this.isExpired(this.cached))
|
|
@@ -4510,108 +4636,122 @@ var require_dist = __commonJS({
|
|
|
4510
4636
|
let e = await this.fetchCredential();
|
|
4511
4637
|
return this.cached = e, e;
|
|
4512
4638
|
}
|
|
4639
|
+
async refreshCredential() {
|
|
4640
|
+
if (this.cached && Date.now() - this.lastForcedRefreshAt < Oe)
|
|
4641
|
+
return this.cached;
|
|
4642
|
+
this.lastForcedRefreshAt = Date.now();
|
|
4643
|
+
let e = await this.fetchCredential(true);
|
|
4644
|
+
return this.cached = e, e;
|
|
4645
|
+
}
|
|
4513
4646
|
clearCache() {
|
|
4514
4647
|
this.cached = null;
|
|
4515
4648
|
}
|
|
4516
4649
|
isExpired(e) {
|
|
4517
|
-
let
|
|
4518
|
-
return e.expiredTime -
|
|
4650
|
+
let n = Math.floor(Date.now() / 1e3);
|
|
4651
|
+
return e.expiredTime - n < De;
|
|
4519
4652
|
}
|
|
4520
|
-
async fetchCredential() {
|
|
4521
|
-
for (let
|
|
4522
|
-
let
|
|
4653
|
+
async fetchCredential(e = false) {
|
|
4654
|
+
for (let s = 1; s <= 3; s++) {
|
|
4655
|
+
let o = new AbortController(), c = setTimeout(() => o.abort(), 1e4), i;
|
|
4523
4656
|
try {
|
|
4524
|
-
|
|
4525
|
-
} catch (
|
|
4526
|
-
if (
|
|
4527
|
-
await
|
|
4657
|
+
i = await $(Be, { method: "POST", headers: { "Content-Type": "application/json", Authorization: \`Bearer \${this.authToken}\`, "X-Env": se(), ...e ? { "X-SKIP-CACHE": "true" } : {} }, body: JSON.stringify(this.projectId ? { ProjectId: this.projectId } : {}), signal: o.signal });
|
|
4658
|
+
} catch (l) {
|
|
4659
|
+
if (s < 3) {
|
|
4660
|
+
await z(500 * s);
|
|
4528
4661
|
continue;
|
|
4529
4662
|
}
|
|
4530
|
-
throw new
|
|
4663
|
+
throw new y(\`failed to obtain STS credential: \${l.message || "timeout"}\`);
|
|
4531
4664
|
} finally {
|
|
4532
|
-
clearTimeout(
|
|
4533
|
-
}
|
|
4534
|
-
if (
|
|
4535
|
-
throw new
|
|
4536
|
-
if (
|
|
4537
|
-
throw new
|
|
4538
|
-
if (!
|
|
4539
|
-
if (
|
|
4540
|
-
await
|
|
4665
|
+
clearTimeout(c);
|
|
4666
|
+
}
|
|
4667
|
+
if (i.status === 413)
|
|
4668
|
+
throw new y("storage quota exceeded");
|
|
4669
|
+
if (i.status === 429)
|
|
4670
|
+
throw new y("rate limited, please retry later");
|
|
4671
|
+
if (!i.ok) {
|
|
4672
|
+
if (i.status >= 500 && s < 3) {
|
|
4673
|
+
await z(500 * s);
|
|
4541
4674
|
continue;
|
|
4542
4675
|
}
|
|
4543
|
-
let
|
|
4544
|
-
throw new
|
|
4676
|
+
let l = await i.text().catch(() => "unknown error");
|
|
4677
|
+
throw new y(\`failed to obtain STS credential: \${i.status} \${l}\`);
|
|
4545
4678
|
}
|
|
4546
|
-
let
|
|
4547
|
-
if (
|
|
4548
|
-
let
|
|
4549
|
-
return { tmpSecretId:
|
|
4679
|
+
let d = await i.json(), a = d.data && typeof d.data == "object" ? d.data : d;
|
|
4680
|
+
if (a.tmpSecretId && a.tmpSecretKey && a.sessionToken && a.expiredTime) {
|
|
4681
|
+
let l = a.cosMainland, g = a.cosOverseas, u = i.headers.get("X-Edge-Region") || void 0;
|
|
4682
|
+
return { tmpSecretId: a.tmpSecretId, tmpSecretKey: a.tmpSecretKey, sessionToken: a.sessionToken, expiredTime: a.expiredTime, appId: a.appId || void 0, zoneId: a.zoneId || void 0, projectId: a.projectId || void 0, resourcePrefix: a.resourcePrefix || void 0, cosMainland: l || void 0, cosOverseas: g || void 0, edgeRegion: u, defaultCacheControl: typeof a.defaultCacheControl == "string" && a.defaultCacheControl ? a.defaultCacheControl : void 0, cachedDomain: ie(a.cachedDomain), uncachedDomain: ie(a.uncachedDomain), writeAllowed: typeof a.writeAllowed == "boolean" ? a.writeAllowed : void 0, writeDeniedReason: typeof a.writeDeniedReason == "string" && a.writeDeniedReason ? a.writeDeniedReason : void 0, overMetrics: Array.isArray(a.overMetrics) ? a.overMetrics.filter((f) => typeof f == "string") : void 0 };
|
|
4550
4683
|
}
|
|
4551
|
-
if (
|
|
4552
|
-
let
|
|
4553
|
-
throw new
|
|
4684
|
+
if (a.code !== void 0 && a.code !== 0) {
|
|
4685
|
+
let l = a.msg || a.message || "unknown error";
|
|
4686
|
+
throw new y(\`credential exchange failed (code=\${a.code}): \${l}\`);
|
|
4554
4687
|
}
|
|
4555
|
-
if (
|
|
4556
|
-
let
|
|
4557
|
-
throw new
|
|
4688
|
+
if (d.code !== void 0 && d.code !== 0) {
|
|
4689
|
+
let l = d.msg || d.message || "unknown error";
|
|
4690
|
+
throw new y(\`credential exchange failed (code=\${d.code}): \${l}\`);
|
|
4558
4691
|
}
|
|
4559
|
-
if (
|
|
4560
|
-
await
|
|
4692
|
+
if (s < 3) {
|
|
4693
|
+
await z(500 * s);
|
|
4561
4694
|
continue;
|
|
4562
4695
|
}
|
|
4563
|
-
throw new
|
|
4696
|
+
throw new y("invalid STS credential response");
|
|
4564
4697
|
}
|
|
4565
|
-
throw new
|
|
4698
|
+
throw new y("invalid STS credential response");
|
|
4566
4699
|
}
|
|
4567
4700
|
};
|
|
4568
|
-
function
|
|
4701
|
+
function ie(t) {
|
|
4702
|
+
if (typeof t != "string")
|
|
4703
|
+
return;
|
|
4704
|
+
let e = t.trim().replace(/\\/+$/, "");
|
|
4705
|
+
if (e)
|
|
4706
|
+
return /^https?:\\/\\//i.test(e) ? e : \`https://\${e}\`;
|
|
4707
|
+
}
|
|
4708
|
+
function z(t) {
|
|
4569
4709
|
return new Promise((e) => setTimeout(e, t));
|
|
4570
4710
|
}
|
|
4571
|
-
var
|
|
4572
|
-
function
|
|
4573
|
-
let t = {}, e =
|
|
4711
|
+
var je = "{{PAGES_BLOB_DEPLOY_CREDENTIAL}}";
|
|
4712
|
+
function ae() {
|
|
4713
|
+
let t = {}, e = $e();
|
|
4574
4714
|
if (e)
|
|
4575
4715
|
t.deployCredential = e;
|
|
4576
4716
|
else {
|
|
4577
|
-
let
|
|
4578
|
-
|
|
4717
|
+
let r = oe("PAGES_BLOB_DEPLOY_CREDENTIAL");
|
|
4718
|
+
r && (t.deployCredential = r);
|
|
4579
4719
|
}
|
|
4580
|
-
let
|
|
4581
|
-
return
|
|
4720
|
+
let n = oe("PAGES_PROJECT_ID");
|
|
4721
|
+
return n && (t.projectId = n), t;
|
|
4582
4722
|
}
|
|
4583
|
-
function
|
|
4584
|
-
let t =
|
|
4723
|
+
function $e() {
|
|
4724
|
+
let t = je;
|
|
4585
4725
|
if (!(t.startsWith("{{") && t.endsWith("}}")))
|
|
4586
4726
|
return t || void 0;
|
|
4587
4727
|
}
|
|
4588
|
-
function
|
|
4728
|
+
function oe(t) {
|
|
4589
4729
|
if (typeof process < "u" && process.env)
|
|
4590
4730
|
return process.env[t];
|
|
4591
4731
|
}
|
|
4592
|
-
function
|
|
4732
|
+
function _e(t) {
|
|
4593
4733
|
let e = typeof t == "string" ? t : t.name;
|
|
4594
|
-
|
|
4595
|
-
let
|
|
4596
|
-
return new
|
|
4734
|
+
F(e);
|
|
4735
|
+
let n = ce(typeof t == "string" ? void 0 : t), r = new O(n.authToken, n.projectId), s = new D(r);
|
|
4736
|
+
return new T(s, e, n.consistency ?? "eventual");
|
|
4597
4737
|
}
|
|
4598
|
-
async function
|
|
4599
|
-
let e =
|
|
4600
|
-
return { stores: (await new
|
|
4738
|
+
async function Ne(t) {
|
|
4739
|
+
let e = ce(t ? { name: "__list__", projectId: t.projectId, token: t.token, consistency: t.consistency } : void 0), n = new O(e.authToken, e.projectId);
|
|
4740
|
+
return { stores: (await new D(n).listStores(e.consistency)).map((o) => ({ name: o })) };
|
|
4601
4741
|
}
|
|
4602
|
-
function
|
|
4603
|
-
let e =
|
|
4742
|
+
function ce(t) {
|
|
4743
|
+
let e = ae(), n = (t == null ? void 0 : t.token) || e.deployCredential, r = (t == null ? void 0 : t.projectId) || e.projectId;
|
|
4604
4744
|
if ((t == null ? void 0 : t.token) || e.projectId) {
|
|
4605
|
-
if (!n)
|
|
4606
|
-
throw new T();
|
|
4607
4745
|
if (!r)
|
|
4608
|
-
throw new
|
|
4609
|
-
|
|
4746
|
+
throw new S();
|
|
4747
|
+
if (!n)
|
|
4748
|
+
throw new E(["token"]);
|
|
4749
|
+
return { authToken: n, projectId: r, consistency: t == null ? void 0 : t.consistency };
|
|
4610
4750
|
}
|
|
4611
|
-
if ((t == null ? void 0 : t.projectId) && !
|
|
4612
|
-
throw new
|
|
4751
|
+
if ((t == null ? void 0 : t.projectId) && !n)
|
|
4752
|
+
throw new E(["token"]);
|
|
4613
4753
|
if (!e.deployCredential)
|
|
4614
|
-
throw new
|
|
4754
|
+
throw new E(["deployCredential"]);
|
|
4615
4755
|
return { authToken: e.deployCredential, consistency: t == null ? void 0 : t.consistency };
|
|
4616
4756
|
}
|
|
4617
4757
|
}
|
|
@@ -6737,7 +6877,7 @@ globalThis.__EDGEONE_CLOUD_FUNCTION_AGENT_STORE__ = {
|
|
|
6737
6877
|
createInMemoryStore,
|
|
6738
6878
|
getStore: import_pages_blob.getStore
|
|
6739
6879
|
};
|
|
6740
|
-
`,typeof t=="string"&&t?t:vNt(e?[kxe]:[])}function _Nt(e,t){try{let r=_0(e,t);return(0,g4.default)(r,{ExpressionStatement(s){let a=s.node.expression;Ca.isCallExpression(a)&&Ca.isMemberExpression(a.callee)&&Ca.isIdentifier(a.callee.object,{name:"app"})&&Ca.isIdentifier(a.callee.property,{name:"listen"})&&s.remove()}}),(0,GV.default)(r,{}).code}catch(r){throw r.message.includes("Unexpected token")||r.message.includes("SyntaxError")?new Error(`Failed to parse ast:::Syntax error in function file: ${r.message}`):r}}function d4(e){return e.charAt(0).toUpperCase()+e.slice(1)}function SNt(e,t){let r=_0(e,"temp.ts");return(0,g4.default)(r,{ImportDeclaration(s){let a=s.node.source.value;t.includes(a)&&s.remove()},CallExpression(s){if(Ca.isIdentifier(s.node.callee,{name:"require"})&&s.node.arguments.length===1&&Ca.isStringLiteral(s.node.arguments[0])){let a=s.node.arguments[0].value;t.includes(a)&&s.replaceWith(Ca.memberExpression(Ca.identifier("global"),Ca.identifier(a.replace(/[^a-zA-Z0-9]/g,"_"))))}}}),(0,GV.default)(r).code}function zV(e,t=[],r=[],s=process.cwd()){if(!Yi.default.existsSync(e))throw new Error(`File not found: ${e}`);let a=Yi.default.readFileSync(e,"utf-8");t.length>0&&(a=SNt(a,t)),r.length>0&&(a=ole(a,e,r,s));try{return a=_Nt(a,e),a}catch(n){throw n.message.includes("Syntax error in function file")?new Error(`Syntax error in ${e}: ${n.message.replace("Syntax error in function file: ","")}`):n}}function y1(){let e=Ws.default.resolve(process.cwd(),".edgeone/cloud-functions/api-node");Yi.default.existsSync(e)||Yi.default.mkdirSync(e,{recursive:!0})}async function bNt(e,t=[]){try{let r=Yi.default.statSync(e),s=Axe.get(e);if(s&&s.mtime===r.mtimeMs)return s.result;let a=process.cwd(),n=await v1.default.build({entryPoints:[e],bundle:!0,write:!1,metafile:!0,platform:"node",format:"esm",absWorkingDir:a,sourcemap:!1,minify:!1,logLevel:"silent",mainFields:["module","main"],resolveExtensions:[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts"],external:["@prisma/client","sharp","puppeteer","playwright",...t]}),c=new Set;for(let h of Object.values(n.metafile.outputs))for(let y of h.imports)c.add(y.path);for(let h of Object.keys(n.metafile.inputs))c.add(h);let p=h=>[...c].some(y=>y===h||y.startsWith(`${h}/`)||y.includes(`node_modules/${h}`)),d={isFramework:!1,framework:null,prefix:"/"};return p("hono")?d={isFramework:!0,framework:"hono",prefix:"/"}:p("express")?d={isFramework:!0,framework:"express",prefix:"/"}:p("koa")&&(d={isFramework:!0,framework:"koa",prefix:"/"}),Axe.set(e,{mtime:r.mtimeMs,result:d}),d}catch{return{isFramework:!1,framework:null,prefix:"/"}}}var g4,GV,Ca,Yi,Ws,v1,Exe,HV,wxe,kxe,hNt,mNt,gNt,WV,Axe,Nxe,Ch,Dxe,m4,KV=_t(()=>{Wb();df();lh();uu();yg();r6();oO();dne();mne();Wq();t7();ale();S7();iR();_xe();jV();qV();yS();g4=nr(Py()),GV=nr(cN()),Ca=nr(Ki()),Yi=nr(require("fs")),Ws=nr(require("path")),v1=nr(require("esbuild"));$V();TC();VV();zE();Exe=!0,HV="cloud-functions",wxe="node-functions",kxe="@edgeone/pages-blob",hNt="makers-conversation-id",mNt=new Set([".js",".ts",".cjs",".mjs",".jsx",".tsx",".py"]);gNt=[".js",".ts",".cjs",".jsx",".tsx"];WV={OUTPUT:"./.edgeone/cloud-functions/api-node/index.js",OUTPUT_CONFIG:"./.edgeone/cloud-functions/api-node/config.json"};Axe=new Map;Nxe=(p=>(p.NO_FUNCTIONS="NO_FUNCTIONS",p.SCAN_ERROR="SCAN_ERROR",p.BUILD_ERROR="BUILD_ERROR",p.OUTPUT_DIR_ERROR="OUTPUT_DIR_ERROR",p.ENV_LOAD_ERROR="ENV_LOAD_ERROR",p.FRAMEWORK_DETECTION_ERROR="FRAMEWORK_DETECTION_ERROR",p.FILE_PROCESSING_ERROR="FILE_PROCESSING_ERROR",p))(Nxe||{}),Ch=class extends Error{constructor(r,s){super(r);this.code=s;this.name="CloudFunctionError"}},Dxe=[{method:"GET",funcName:"onRequestGet"},{method:"POST",funcName:"onRequestPost"},{method:"PUT",funcName:"onRequestPut"},{method:"DELETE",funcName:"onRequestDelete"},{method:"PATCH",funcName:"onRequestPatch"},{method:"HEAD",funcName:"onRequestHead"},{method:"OPTIONS",funcName:"onRequestOptions"},{method:"*",funcName:"onRequest"}],m4=class{mode;env;logicText;bundleText;cssText;functionList;functionIndex;silent;binaryDependencies=new Set;userExternalPackages=new Set;externalNodeModules;esbuildCtx=null;incrementalCache=new Map;sortedFunctions=[];wrapPort=9e3;functionRoot=h4();static async decide(){try{let t=h4();return Yi.default.readdirSync(t).length>0}catch{return!1}}isBinaryDependency(t){return this.externalNodeModules.includes(t)?!1:!!(this.userExternalPackages.has(t)||["sharp","canvas","sqlite3","bcrypt","skia-canvas","wink-nlp","puppeteer","puppeteer-core","playwright","@playwright/test","playwright-core","chrome-aws-lambda","ffi-napi","ref-napi","ref-struct-napi","node-gyp","node-pre-gyp","prebuild","prebuild-install","node-addon-api","nan","node-gyp-build","better-sqlite3","pg-native","oracledb","ibm_db","aws-sdk","google-cloud-storage","azure-storage","minio","jimp","gm","fluent-ffmpeg","ffmpeg-static","typescript","tensorflow","@tensorflow/tfjs-node","@mapbox/node-pre-gyp","onnxruntime-node","argon2","scrypt","wink-eng-lite-web-model","bindings"].includes(t))}constructor(t){this.mode=t.mode||"prod",this.env=t.env||{},this.logicText="",this.bundleText="",this.cssText="",this.functionList=[],this.functionIndex=0,this.silent=t.silent||!1,t.external&&t.external.split(",").map(s=>s.trim()).filter(Boolean).forEach(s=>this.userExternalPackages.add(s)),this.externalNodeModules=t.externalNodeModules||[],this.initializeEnvironment(t)}initializeEnvironment(t){if(!t.env)try{let r=Tn("./.env");Yi.default.existsSync(r)||(r=Tn("./.env.local"));let s=mx(r);delete s.TENCENT_SECRET_ID,delete s.TENCENT_SECRET_KEY,this.env=s}catch{this.env={}}}removeDuplicateRoutes(t){let r=new Map,s=[];for(let a of t){let n=a.route;r.has(n)||(r.set(n,a),s.push(a))}return s}generateRoutes(){return this.functionList.map(t=>({route:t.route,filePath:Ws.default.relative(this.functionRoot,t.filePath),isDynamic:t.isDynamic,isMultiLevel:t.isMultiLevel,left:t.left,routePattern:t.routePattern,dynamicSegments:t.dynamicSegments,hasDefaultHandler:t.hasDefaultHandler,methods:t.methods,isFramework:t.isFramework,framework:t.framework,frameworkPrefix:t.frameworkPrefix}))}generateRouteMetadata(t,r){let s=r.route;s.startsWith("/")||(s="/"+s);let a=s.replace(/\/([^/]+)$/g,"")||"/",n=`${this.functionRoot.replace("./","")}/${t}:onRequest`;return{routePath:s,mountPath:a,method:r.methods,module:[n],isFramework:r.isFramework}}async saveRouteMetadata(t){try{y1();let r=Ws.default.dirname(WV.OUTPUT),s=WV.OUTPUT_CONFIG;await Yi.default.promises.mkdir(r,{recursive:!0});let n={routes:t.map(d=>this.generateRouteMetadata(d.filePath,d))}.routes.map(d=>{let h=u4(d.routePath);return{src:h.src,method:d.method,isFramework:d.isFramework,_specificity:h.specificity,_matchType:c4(h.src),_prefix:l4(h.src)}});n.sort((d,h)=>d._prefix!==h._prefix?d._prefix.localeCompare(h._prefix):d._matchType!==h._matchType?d._matchType-h._matchType:h._specificity-d._specificity);let p={routes:n.map(d=>{let h=d.method,y=Op.every(P=>h.includes(P))&&h.length===Op.length,w={src:d.src,isFramework:d.isFramework};return!y&&h.length>0&&(w.methods=h),w})};await Yi.default.promises.writeFile(s,JSON.stringify(p,null,2),"utf-8")}catch(r){throw new Ch(`Failed to save route metadata: ${r.message}`,Nxe.METADATA_SAVE_ERROR)}}analyzeCloudFunctionExports(t,r){let s=new Set,a=new Set(Dxe.map(({funcName:d})=>d)),n=!1,c=d=>{a.has(d)&&s.add(d),d==="app"&&(n=!0)},p=_0(t,r);return(0,g4.default)(p,{ExportDefaultDeclaration(d){let h=d.node.declaration;if(Ca.isIdentifier(h)){c(h.name);return}Ca.isFunctionDeclaration(h)&&h.id&&c(h.id.name)},ExportNamedDeclaration(d){let h=d.node.declaration;if(h){if((Ca.isFunctionDeclaration(h)||Ca.isClassDeclaration(h))&&h.id){c(h.id.name);return}if(Ca.isVariableDeclaration(h))for(let y of h.declarations)Ca.isIdentifier(y.id)&&c(y.id.name);return}for(let y of d.node.specifiers){if(!Ca.isExportSpecifier(y))continue;let w=Ca.isIdentifier(y.exported)?y.exported.name:y.exported.value;c(w)}}}),{handlers:s,hasAppExport:n}}isCloudFunction(t,r){if(!(t.indexOf("onRequest")>-1||t.indexOf("export default app")>-1||t.indexOf("export app")>-1||t.indexOf("export { app")>-1))return!1;try{let a=this.analyzeCloudFunctionExports(t,r);return a.handlers.size>0||a.hasAppExport}catch{return!0}}async detectFramework(t,r){let s=await Vce(t,r);if(s!=null&&s.isFramework)return s;try{let a=await bNt(r,this.externalNodeModules);if(a!=null&&a.isFramework)return a}catch{}return{isFramework:!1,framework:null,prefix:"/"}}detectHttpMethods(t,r){let s=[],a=this.analyzeCloudFunctionExports(t,r);return a.handlers.has("onRequest")?{methods:Op,hasDefaultHandler:!0}:(Dxe.forEach(({method:n,funcName:c})=>{n!=="*"&&a.handlers.has(c)&&s.push(n)}),{methods:s.length>0?s:["GET"],hasDefaultHandler:!1})}matchPath(t){let r=t.match(/:([^/*]+)\*$/);if(r){let c=r[1],p=t.lastIndexOf(`:${c}*`),d=t.substring(0,p);return{id:c,mode:2,left:d||"/",pattern:null,isMultiLevel:!0}}let s=/:([^/*]+)(?![^*]*\*)/g,a=t.match(s),n=a?a.map(c=>c.slice(1)):[];if(n.length>0){let c=t.indexOf(":"),p=t.substring(0,c),d=t;return n==null||n.forEach(h=>{d=d.replace(`:${h}`,"([^/]+)")}),d=d+"$",{id:n,mode:1,left:p||"/",pattern:d.replace(/\//g,"\\/"),isMultiLevel:!1}}return{id:"",mode:0,left:"",pattern:t.replace(/\//g,"\\/"),isMultiLevel:!1}}async processRoutePath(t){try{let r=zV(t),a=Ws.default.relative(this.functionRoot,t).replace(/\\/g,"/").replace(/\.(js|ts|cjs|jsx|tsx)$/,"").replace(/\/index$/,"");a==="index"&&(a="");let n="/"+a;n=n.replace(/\/\[\[([^/]+)\]\]/g,"/:$1*").replace(/\/\[([^/]+)\]$/,"/:$1?").replace(/\/\[([^/]+)\]/g,"/:$1"),n.startsWith("/")||(n="/"+n),n=n.replace(/[^\w/:*\-?]/g,"");let c=Ws.default.basename(t).replace(/\.(js|ts|cjs|jsx|tsx)$/,""),p={route:n,filePath:t,fileName:c,methods:[],isDynamic:!1,hasDefaultHandler:!1},{isFramework:d,framework:h,prefix:y}=await this.detectFramework(r,t).catch(x=>(console.error("[builder] Error detecting framework",x),Cc({event_name:"Pages Build:Framework Detect:Fail",event_scope:Tc.LOCAL_FLOW,event_phase:"framework_detect",event_result:Pc.FAIL,command:"pages",subcommand:"build",builder_type:"node-function",error_message:gh(x).message}),{isFramework:!1,framework:null,prefix:"/"}));if(d){let x=[],$=Ws.default.basename(t,Ws.default.extname(t));if($.startsWith("[[")&&$.endsWith("]]")){x.push({...p,route:n,isFramework:d,framework:h,frameworkPrefix:y,methods:Op,hasDefaultHandler:!0,isDynamic:!0,isMultiLevel:!0});let q=n.split("/").filter(Boolean);if(q.length>1){let Y="/"+q.slice(0,-1).join("/");x.push({...p,route:Y,isFramework:d,framework:h,frameworkPrefix:y,methods:Op,hasDefaultHandler:!0,isDynamic:!0,isMultiLevel:!0})}}else if($.startsWith("[")&&$.endsWith("]"))x.push({...p,route:n,isFramework:d,framework:h,frameworkPrefix:y,methods:Op,hasDefaultHandler:!0,isDynamic:!0,isMultiLevel:!1});else{let q=y==="/"?"/:routes*":`${y}/:routes*`;x.push({...p,route:q,isFramework:d,framework:h,frameworkPrefix:y,methods:Op,hasDefaultHandler:!0,isDynamic:!0,isMultiLevel:!0})}return y!=="/"&&x.push({...p,route:y,isFramework:d,framework:h,frameworkPrefix:y,methods:Op,hasDefaultHandler:!0,isDynamic:!1,isMultiLevel:!1}),x}let w=this.matchPath(n),{methods:P,hasDefaultHandler:O}=this.detectHttpMethods(r,t);return[{...p,methods:P,hasDefaultHandler:O,isDynamic:w.mode>0,isMultiLevel:w.isMultiLevel,dynamicSegments:Array.isArray(w.id)?w.id:[w.id],routePattern:w.pattern,left:w.left}]}catch(r){console.error("[builder] Error processing route path",r)}}generateRouteMatchingLogic(t,r,s){if(t.isFramework&&t.isDynamic)return`
|
|
6880
|
+
`,typeof t=="string"&&t?t:vNt(e?[kxe]:[])}function _Nt(e,t){try{let r=_0(e,t);return(0,g4.default)(r,{ExpressionStatement(s){let a=s.node.expression;Ca.isCallExpression(a)&&Ca.isMemberExpression(a.callee)&&Ca.isIdentifier(a.callee.object,{name:"app"})&&Ca.isIdentifier(a.callee.property,{name:"listen"})&&s.remove()}}),(0,GV.default)(r,{}).code}catch(r){throw r.message.includes("Unexpected token")||r.message.includes("SyntaxError")?new Error(`Failed to parse ast:::Syntax error in function file: ${r.message}`):r}}function d4(e){return e.charAt(0).toUpperCase()+e.slice(1)}function SNt(e,t){let r=_0(e,"temp.ts");return(0,g4.default)(r,{ImportDeclaration(s){let a=s.node.source.value;t.includes(a)&&s.remove()},CallExpression(s){if(Ca.isIdentifier(s.node.callee,{name:"require"})&&s.node.arguments.length===1&&Ca.isStringLiteral(s.node.arguments[0])){let a=s.node.arguments[0].value;t.includes(a)&&s.replaceWith(Ca.memberExpression(Ca.identifier("global"),Ca.identifier(a.replace(/[^a-zA-Z0-9]/g,"_"))))}}}),(0,GV.default)(r).code}function zV(e,t=[],r=[],s=process.cwd()){if(!Yi.default.existsSync(e))throw new Error(`File not found: ${e}`);let a=Yi.default.readFileSync(e,"utf-8");t.length>0&&(a=SNt(a,t)),r.length>0&&(a=ole(a,e,r,s));try{return a=_Nt(a,e),a}catch(n){throw n.message.includes("Syntax error in function file")?new Error(`Syntax error in ${e}: ${n.message.replace("Syntax error in function file: ","")}`):n}}function y1(){let e=Ws.default.resolve(process.cwd(),".edgeone/cloud-functions/api-node");Yi.default.existsSync(e)||Yi.default.mkdirSync(e,{recursive:!0})}async function bNt(e,t=[]){try{let r=Yi.default.statSync(e),s=Axe.get(e);if(s&&s.mtime===r.mtimeMs)return s.result;let a=process.cwd(),n=await v1.default.build({entryPoints:[e],bundle:!0,write:!1,metafile:!0,platform:"node",format:"esm",absWorkingDir:a,sourcemap:!1,minify:!1,logLevel:"silent",mainFields:["module","main"],resolveExtensions:[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts"],external:["@prisma/client","sharp","puppeteer","playwright",...t]}),c=new Set;for(let h of Object.values(n.metafile.outputs))for(let y of h.imports)c.add(y.path);for(let h of Object.keys(n.metafile.inputs))c.add(h);let p=h=>[...c].some(y=>y===h||y.startsWith(`${h}/`)||y.includes(`node_modules/${h}`)),d={isFramework:!1,framework:null,prefix:"/"};return p("hono")?d={isFramework:!0,framework:"hono",prefix:"/"}:p("express")?d={isFramework:!0,framework:"express",prefix:"/"}:p("koa")&&(d={isFramework:!0,framework:"koa",prefix:"/"}),Axe.set(e,{mtime:r.mtimeMs,result:d}),d}catch{return{isFramework:!1,framework:null,prefix:"/"}}}var Ws,g4,GV,Ca,Yi,v1,Exe,HV,wxe,kxe,hNt,mNt,gNt,WV,Axe,Nxe,Ch,Dxe,m4,KV=_t(()=>{Wb();df();lh();uu();yg();r6();oO();dne();mne();Wq();t7();ale();S7();iR();_xe();jV();qV();yS();Ws=nr(require("path")),g4=nr(Py()),GV=nr(cN()),Ca=nr(Ki()),Yi=nr(require("fs")),v1=nr(require("esbuild"));$V();TC();VV();zE();Exe=!0,HV="cloud-functions",wxe="node-functions",kxe="@edgeone/pages-blob",hNt="makers-conversation-id",mNt=new Set([".js",".ts",".cjs",".mjs",".jsx",".tsx",".py"]);gNt=[".js",".ts",".cjs",".jsx",".tsx"];WV={OUTPUT:"./.edgeone/cloud-functions/api-node/index.js",OUTPUT_CONFIG:"./.edgeone/cloud-functions/api-node/config.json"};Axe=new Map;Nxe=(p=>(p.NO_FUNCTIONS="NO_FUNCTIONS",p.SCAN_ERROR="SCAN_ERROR",p.BUILD_ERROR="BUILD_ERROR",p.OUTPUT_DIR_ERROR="OUTPUT_DIR_ERROR",p.ENV_LOAD_ERROR="ENV_LOAD_ERROR",p.FRAMEWORK_DETECTION_ERROR="FRAMEWORK_DETECTION_ERROR",p.FILE_PROCESSING_ERROR="FILE_PROCESSING_ERROR",p))(Nxe||{}),Ch=class extends Error{constructor(r,s){super(r);this.code=s;this.name="CloudFunctionError"}},Dxe=[{method:"GET",funcName:"onRequestGet"},{method:"POST",funcName:"onRequestPost"},{method:"PUT",funcName:"onRequestPut"},{method:"DELETE",funcName:"onRequestDelete"},{method:"PATCH",funcName:"onRequestPatch"},{method:"HEAD",funcName:"onRequestHead"},{method:"OPTIONS",funcName:"onRequestOptions"},{method:"*",funcName:"onRequest"}],m4=class{mode;env;logicText;bundleText;cssText;functionList;functionIndex;silent;binaryDependencies=new Set;userExternalPackages=new Set;externalNodeModules;esbuildCtx=null;incrementalCache=new Map;sortedFunctions=[];wrapPort=9e3;functionRoot=h4();static async decide(){try{let t=h4();return Yi.default.readdirSync(t).length>0}catch{return!1}}isBinaryDependency(t){return this.externalNodeModules.includes(t)?!1:!!(this.userExternalPackages.has(t)||["sharp","canvas","sqlite3","bcrypt","skia-canvas","wink-nlp","puppeteer","puppeteer-core","playwright","@playwright/test","playwright-core","chrome-aws-lambda","ffi-napi","ref-napi","ref-struct-napi","node-gyp","node-pre-gyp","prebuild","prebuild-install","node-addon-api","nan","node-gyp-build","better-sqlite3","pg-native","oracledb","ibm_db","aws-sdk","google-cloud-storage","azure-storage","minio","jimp","gm","fluent-ffmpeg","ffmpeg-static","typescript","tensorflow","@tensorflow/tfjs-node","@mapbox/node-pre-gyp","onnxruntime-node","argon2","scrypt","wink-eng-lite-web-model","bindings"].includes(t))}constructor(t){this.mode=t.mode||"prod",this.env=t.env||{},this.logicText="",this.bundleText="",this.cssText="",this.functionList=[],this.functionIndex=0,this.silent=t.silent||!1,t.external&&t.external.split(",").map(s=>s.trim()).filter(Boolean).forEach(s=>this.userExternalPackages.add(s)),this.externalNodeModules=t.externalNodeModules||[],this.initializeEnvironment(t)}initializeEnvironment(t){if(!t.env)try{let r=Tn("./.env");Yi.default.existsSync(r)||(r=Tn("./.env.local"));let s=mx(r);delete s.TENCENT_SECRET_ID,delete s.TENCENT_SECRET_KEY,this.env=s}catch{this.env={}}}removeDuplicateRoutes(t){let r=new Map,s=[];for(let a of t){let n=a.route;r.has(n)||(r.set(n,a),s.push(a))}return s}generateRoutes(){return this.functionList.map(t=>({route:t.route,filePath:Ws.default.relative(this.functionRoot,t.filePath),isDynamic:t.isDynamic,isMultiLevel:t.isMultiLevel,left:t.left,routePattern:t.routePattern,dynamicSegments:t.dynamicSegments,hasDefaultHandler:t.hasDefaultHandler,methods:t.methods,isFramework:t.isFramework,framework:t.framework,frameworkPrefix:t.frameworkPrefix}))}generateRouteMetadata(t,r){let s=r.route;s.startsWith("/")||(s="/"+s);let a=s.replace(/\/([^/]+)$/g,"")||"/",n=`${this.functionRoot.replace("./","")}/${t}:onRequest`;return{routePath:s,mountPath:a,method:r.methods,module:[n],isFramework:r.isFramework}}async saveRouteMetadata(t){try{y1();let r=Ws.default.dirname(WV.OUTPUT),s=WV.OUTPUT_CONFIG;await Yi.default.promises.mkdir(r,{recursive:!0});let n={routes:t.map(d=>this.generateRouteMetadata(d.filePath,d))}.routes.map(d=>{let h=u4(d.routePath);return{src:h.src,method:d.method,isFramework:d.isFramework,_specificity:h.specificity,_matchType:c4(h.src),_prefix:l4(h.src)}});n.sort((d,h)=>d._prefix!==h._prefix?d._prefix.localeCompare(h._prefix):d._matchType!==h._matchType?d._matchType-h._matchType:h._specificity-d._specificity);let p={routes:n.map(d=>{let h=d.method,y=Op.every(P=>h.includes(P))&&h.length===Op.length,w={src:d.src,isFramework:d.isFramework};return!y&&h.length>0&&(w.methods=h),w})};await Yi.default.promises.writeFile(s,JSON.stringify(p,null,2),"utf-8")}catch(r){throw new Ch(`Failed to save route metadata: ${r.message}`,Nxe.METADATA_SAVE_ERROR)}}analyzeCloudFunctionExports(t,r){let s=new Set,a=new Set(Dxe.map(({funcName:d})=>d)),n=!1,c=d=>{a.has(d)&&s.add(d),d==="app"&&(n=!0)},p=_0(t,r);return(0,g4.default)(p,{ExportDefaultDeclaration(d){let h=d.node.declaration;if(Ca.isIdentifier(h)){c(h.name);return}Ca.isFunctionDeclaration(h)&&h.id&&c(h.id.name)},ExportNamedDeclaration(d){let h=d.node.declaration;if(h){if((Ca.isFunctionDeclaration(h)||Ca.isClassDeclaration(h))&&h.id){c(h.id.name);return}if(Ca.isVariableDeclaration(h))for(let y of h.declarations)Ca.isIdentifier(y.id)&&c(y.id.name);return}for(let y of d.node.specifiers){if(!Ca.isExportSpecifier(y))continue;let w=Ca.isIdentifier(y.exported)?y.exported.name:y.exported.value;c(w)}}}),{handlers:s,hasAppExport:n}}isCloudFunction(t,r){if(!(t.indexOf("onRequest")>-1||t.indexOf("export default app")>-1||t.indexOf("export app")>-1||t.indexOf("export { app")>-1))return!1;try{let a=this.analyzeCloudFunctionExports(t,r);return a.handlers.size>0||a.hasAppExport}catch{return!0}}async detectFramework(t,r){let s=await Vce(t,r);if(s!=null&&s.isFramework)return s;try{let a=await bNt(r,this.externalNodeModules);if(a!=null&&a.isFramework)return a}catch{}return{isFramework:!1,framework:null,prefix:"/"}}detectHttpMethods(t,r){let s=[],a=this.analyzeCloudFunctionExports(t,r);return a.handlers.has("onRequest")?{methods:Op,hasDefaultHandler:!0}:(Dxe.forEach(({method:n,funcName:c})=>{n!=="*"&&a.handlers.has(c)&&s.push(n)}),{methods:s.length>0?s:["GET"],hasDefaultHandler:!1})}matchPath(t){let r=t.match(/:([^/*]+)\*$/);if(r){let c=r[1],p=t.lastIndexOf(`:${c}*`),d=t.substring(0,p);return{id:c,mode:2,left:d||"/",pattern:null,isMultiLevel:!0}}let s=/:([^/*]+)(?![^*]*\*)/g,a=t.match(s),n=a?a.map(c=>c.slice(1)):[];if(n.length>0){let c=t.indexOf(":"),p=t.substring(0,c),d=t;return n==null||n.forEach(h=>{d=d.replace(`:${h}`,"([^/]+)")}),d=d+"$",{id:n,mode:1,left:p||"/",pattern:d.replace(/\//g,"\\/"),isMultiLevel:!1}}return{id:"",mode:0,left:"",pattern:t.replace(/\//g,"\\/"),isMultiLevel:!1}}async processRoutePath(t){try{let r=zV(t),a=Ws.default.relative(this.functionRoot,t).replace(/\\/g,"/").replace(/\.(js|ts|cjs|jsx|tsx)$/,"").replace(/\/index$/,"");a==="index"&&(a="");let n="/"+a;n=n.replace(/\/\[\[([^/]+)\]\]/g,"/:$1*").replace(/\/\[([^/]+)\]$/,"/:$1?").replace(/\/\[([^/]+)\]/g,"/:$1"),n.startsWith("/")||(n="/"+n),n=n.replace(/[^\w/:*\-?]/g,"");let c=Ws.default.basename(t).replace(/\.(js|ts|cjs|jsx|tsx)$/,""),p={route:n,filePath:t,fileName:c,methods:[],isDynamic:!1,hasDefaultHandler:!1},{isFramework:d,framework:h,prefix:y}=await this.detectFramework(r,t).catch(x=>(console.error("[builder] Error detecting framework",x),Cc({event_name:"Pages Build:Framework Detect:Fail",event_scope:Tc.LOCAL_FLOW,event_phase:"framework_detect",event_result:Pc.FAIL,command:"pages",subcommand:"build",builder_type:"node-function",error_message:gh(x).message}),{isFramework:!1,framework:null,prefix:"/"}));if(d){let x=[],$=Ws.default.basename(t,Ws.default.extname(t));if($.startsWith("[[")&&$.endsWith("]]")){x.push({...p,route:n,isFramework:d,framework:h,frameworkPrefix:y,methods:Op,hasDefaultHandler:!0,isDynamic:!0,isMultiLevel:!0});let q=n.split("/").filter(Boolean);if(q.length>1){let Y="/"+q.slice(0,-1).join("/");x.push({...p,route:Y,isFramework:d,framework:h,frameworkPrefix:y,methods:Op,hasDefaultHandler:!0,isDynamic:!0,isMultiLevel:!0})}}else if($.startsWith("[")&&$.endsWith("]"))x.push({...p,route:n,isFramework:d,framework:h,frameworkPrefix:y,methods:Op,hasDefaultHandler:!0,isDynamic:!0,isMultiLevel:!1});else{let q=y==="/"?"/:routes*":`${y}/:routes*`;x.push({...p,route:q,isFramework:d,framework:h,frameworkPrefix:y,methods:Op,hasDefaultHandler:!0,isDynamic:!0,isMultiLevel:!0})}return y!=="/"&&x.push({...p,route:y,isFramework:d,framework:h,frameworkPrefix:y,methods:Op,hasDefaultHandler:!0,isDynamic:!1,isMultiLevel:!1}),x}let w=this.matchPath(n),{methods:P,hasDefaultHandler:O}=this.detectHttpMethods(r,t);return[{...p,methods:P,hasDefaultHandler:O,isDynamic:w.mode>0,isMultiLevel:w.isMultiLevel,dynamicSegments:Array.isArray(w.id)?w.id:[w.id],routePattern:w.pattern,left:w.left}]}catch(r){console.error("[builder] Error processing route path",r)}}generateRouteMatchingLogic(t,r,s){if(t.isFramework&&t.isDynamic)return`
|
|
6741
6881
|
|
|
6742
6882
|
|
|
6743
6883
|
// Dynamic route matching: ${t.route}
|
|
@@ -7021,28 +7161,7 @@ globalThis.__EDGEONE_CLOUD_FUNCTION_AGENT_STORE__ = {
|
|
|
7021
7161
|
|
|
7022
7162
|
// Handle multi-level dynamic route: ${t.route}
|
|
7023
7163
|
if (pathname.startsWith('${t.left}')) {
|
|
7024
|
-
|
|
7025
|
-
enhancedRequest = createEdgeoneCompatibleRequest(req, false);
|
|
7026
|
-
|
|
7027
|
-
// Await body preloading (to be consistent with Vercel behavior)
|
|
7028
|
-
if (enhancedRequest._bodyPreloadPromise) {
|
|
7029
|
-
try {
|
|
7030
|
-
await enhancedRequest._bodyPreloadPromise;
|
|
7031
|
-
} catch (error) {
|
|
7032
|
-
// Body preload failed, but does not block handling
|
|
7033
|
-
console.warn('Body preload failed:', error.message);
|
|
7034
|
-
}
|
|
7035
|
-
}
|
|
7036
|
-
|
|
7037
|
-
// Build context object
|
|
7038
|
-
context = createCloudFunctionContext({
|
|
7039
|
-
req,
|
|
7040
|
-
safeGeo,
|
|
7041
|
-
request: enhancedRequest,
|
|
7042
|
-
params: {},
|
|
7043
|
-
conversation_id: agentConversationId
|
|
7044
|
-
});
|
|
7045
|
-
stripInternalRequestHeaders(req);
|
|
7164
|
+
${this.generateEnhancedRequestCode()}
|
|
7046
7165
|
const routeMatch = pathname.slice('${t.left}'.length);
|
|
7047
7166
|
// Remove leading slash if present
|
|
7048
7167
|
const cleanPath = routeMatch.startsWith('/') ? routeMatch.slice(1) : routeMatch;
|
|
@@ -7076,28 +7195,7 @@ globalThis.__EDGEONE_CLOUD_FUNCTION_AGENT_STORE__ = {
|
|
|
7076
7195
|
|
|
7077
7196
|
|
|
7078
7197
|
if (params) {
|
|
7079
|
-
|
|
7080
|
-
enhancedRequest = createEdgeoneCompatibleRequest(req, false);
|
|
7081
|
-
|
|
7082
|
-
// Await body preloading (to be consistent with Vercel behavior)
|
|
7083
|
-
if (enhancedRequest._bodyPreloadPromise) {
|
|
7084
|
-
try {
|
|
7085
|
-
await enhancedRequest._bodyPreloadPromise;
|
|
7086
|
-
} catch (error) {
|
|
7087
|
-
// Body preload failed, but does not block handling
|
|
7088
|
-
console.warn('Body preload failed:', error.message);
|
|
7089
|
-
}
|
|
7090
|
-
}
|
|
7091
|
-
|
|
7092
|
-
// Build context object
|
|
7093
|
-
context = createCloudFunctionContext({
|
|
7094
|
-
req,
|
|
7095
|
-
safeGeo,
|
|
7096
|
-
request: enhancedRequest,
|
|
7097
|
-
params: {},
|
|
7098
|
-
conversation_id: agentConversationId
|
|
7099
|
-
});
|
|
7100
|
-
stripInternalRequestHeaders(req);
|
|
7198
|
+
${this.generateEnhancedRequestCode()}
|
|
7101
7199
|
context.params = params;
|
|
7102
7200
|
${s}
|
|
7103
7201
|
${this.generateMethodHandlerCode(r)}
|
|
@@ -7114,19 +7212,22 @@ globalThis.__EDGEONE_CLOUD_FUNCTION_AGENT_STORE__ = {
|
|
|
7114
7212
|
// Handle static route: ${t.route}
|
|
7115
7213
|
if (pathname === '${t.route}') {
|
|
7116
7214
|
${s}
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7215
|
+
${this.generateEnhancedRequestCode()}
|
|
7216
|
+
${this.generateMethodHandlerCode(r)}
|
|
7217
|
+
const requestEndTime = Date.now();
|
|
7218
|
+
// console.log(\`Request processing time: \${requestEndTime - requestStartTime}ms\`);
|
|
7219
|
+
|
|
7220
|
+
console.log('Makers request path: ' + fullPath + ' |scfRequestId=' + (context.server ? context.server.requestId : '') + '|statusCode=' + String(response?.status || 200) + '|');
|
|
7221
|
+
await handleResponse(res, response, getResponsePassHeaders(context, agentConversationId));
|
|
7222
|
+
return;
|
|
7223
|
+
}`}generateEnhancedRequestCode(){return`
|
|
7224
|
+
enhancedRequest = await createEdgeoneCompatibleRequest(req, false);
|
|
7225
|
+
if (enhancedRequest._bodyReadError) {
|
|
7226
|
+
respondBodyReadError(req, res, enhancedRequest._bodyReadError, pathname);
|
|
7227
|
+
console.log('Makers request path: ' + fullPath + ' |scfRequestId=' + (req.headers['x-scf-request-id'] || '') + '|statusCode=400|');
|
|
7228
|
+
return;
|
|
7128
7229
|
}
|
|
7129
|
-
|
|
7230
|
+
|
|
7130
7231
|
// Build context object
|
|
7131
7232
|
context = createCloudFunctionContext({
|
|
7132
7233
|
req,
|
|
@@ -7135,15 +7236,7 @@ globalThis.__EDGEONE_CLOUD_FUNCTION_AGENT_STORE__ = {
|
|
|
7135
7236
|
params: {},
|
|
7136
7237
|
conversation_id: agentConversationId
|
|
7137
7238
|
});
|
|
7138
|
-
stripInternalRequestHeaders(req)
|
|
7139
|
-
${this.generateMethodHandlerCode(r)}
|
|
7140
|
-
const requestEndTime = Date.now();
|
|
7141
|
-
// console.log(\`Request processing time: \${requestEndTime - requestStartTime}ms\`);
|
|
7142
|
-
|
|
7143
|
-
console.log('Makers request path: ' + fullPath + ' |scfRequestId=' + (context.server ? context.server.requestId : '') + '|statusCode=' + String(response?.status || 200) + '|');
|
|
7144
|
-
await handleResponse(res, response, getResponsePassHeaders(context, agentConversationId));
|
|
7145
|
-
return;
|
|
7146
|
-
}`}generateMethodHandlerCode(t){return`
|
|
7239
|
+
stripInternalRequestHeaders(req);`}generateMethodHandlerCode(t){return`
|
|
7147
7240
|
try {
|
|
7148
7241
|
const handler = (() => {
|
|
7149
7242
|
const method = req.method;
|
|
@@ -7787,6 +7880,13 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
|
|
|
7787
7880
|
return null; // \u6CA1\u6709\u4E2D\u95F4\u4EF6\uFF0C\u7EE7\u7EED\u6267\u884C\u540E\u7EED\u51FD\u6570
|
|
7788
7881
|
}
|
|
7789
7882
|
`;let r=JSON.stringify(e),s=(n=t.normalizedMatcher)!=null&&n.length?t.normalizedMatcher:TSe(t.matcher),a={...t,normalizedMatcher:s};return`
|
|
7883
|
+
let __middlewareHookCtxWarned = false;
|
|
7884
|
+
function __warnMissingHookCtxFetch() {
|
|
7885
|
+
if (__middlewareHookCtxWarned) return;
|
|
7886
|
+
__middlewareHookCtxWarned = true;
|
|
7887
|
+
console.warn('[middleware] hookCtx.fetch missing, falling back to globalThis.fetch');
|
|
7888
|
+
}
|
|
7889
|
+
|
|
7790
7890
|
const __middlewareModule = (() => {
|
|
7791
7891
|
const module = { exports: {} };
|
|
7792
7892
|
const exports = module.exports;
|
|
@@ -8068,11 +8168,12 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
|
|
|
8068
8168
|
|
|
8069
8169
|
/**
|
|
8070
8170
|
* \u6267\u884C\u4E2D\u95F4\u4EF6\u5E76\u8FD4\u56DE\u54CD\u5E94\uFF08\u5982\u679C\u4E2D\u95F4\u4EF6\u8FD4\u56DE\u4E86\u54CD\u5E94\uFF09
|
|
8071
|
-
* @param {Object} context - \u5305\u542B request, urlInfo, env, waitUntil
|
|
8171
|
+
* @param {Object} context - \u5305\u542B request, urlInfo, env, waitUntil \u7684\u4E0A\u4E0B\u6587\uFF1BhookCtx \u4E3A\u53EF\u9009\u7684\u5E73\u53F0\u8FD0\u884C\u65F6\u589E\u5F3A
|
|
8072
8172
|
* @returns {Response|null} \u5982\u679C\u4E2D\u95F4\u4EF6\u8FD4\u56DE\u54CD\u5E94\u5219\u8FD4\u56DE\uFF0C\u5426\u5219\u8FD4\u56DE null
|
|
8073
8173
|
*/
|
|
8074
8174
|
async function executeMiddleware(context) {
|
|
8075
|
-
const { request, urlInfo, env, waitUntil
|
|
8175
|
+
const { request, urlInfo, env, waitUntil } = context;
|
|
8176
|
+
const hookCtx = context.hookCtx ?? {};
|
|
8076
8177
|
const pathname = urlInfo.pathname;
|
|
8077
8178
|
|
|
8078
8179
|
// \u68C0\u67E5\u8DEF\u5F84\u662F\u5426\u5339\u914D matcher
|
|
@@ -8093,8 +8194,12 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
|
|
|
8093
8194
|
// \u5C06 hookCtx.fetch \u4E34\u65F6\u8D4B\u7ED9 globalThis.fetch
|
|
8094
8195
|
// \u56E0\u4E3A\u4E2D\u95F4\u4EF6\u901A\u8FC7 new Function \u52A0\u8F7D\uFF0C\u53EA\u80FD\u8BBF\u95EE globalThis.fetch
|
|
8095
8196
|
const __savedGlobalFetch = globalThis.fetch;
|
|
8197
|
+
const __effectiveFetch = hookCtx.fetch ?? __savedGlobalFetch;
|
|
8198
|
+
if (!hookCtx.fetch) {
|
|
8199
|
+
__warnMissingHookCtxFetch();
|
|
8200
|
+
}
|
|
8096
8201
|
try {
|
|
8097
|
-
globalThis.fetch =
|
|
8202
|
+
globalThis.fetch = __effectiveFetch;
|
|
8098
8203
|
|
|
8099
8204
|
const middlewareContext = {
|
|
8100
8205
|
request,
|
|
@@ -9158,12 +9263,14 @@ function __mcpJsonRpcError(code, message) {
|
|
|
9158
9263
|
return { jsonrpc: '2.0', id: null, error: { code, message } };
|
|
9159
9264
|
}
|
|
9160
9265
|
|
|
9266
|
+
// \u8BFB\u5931\u8D25\uFF08\u65AD\u6D41 / \u4E2D\u9014\u62A5\u9519\uFF09\u4E0D\u518D\u541E\u6210\u7A7A body\uFF0C\u7531\u8C03\u7528\u65B9\u56DE\u660E\u786E\u7684 JSON-RPC \u9519\u8BEF\u3002
|
|
9161
9267
|
function __mcpReadRawBody(req) {
|
|
9162
|
-
return new Promise((resolve) => {
|
|
9268
|
+
return new Promise((resolve, reject) => {
|
|
9163
9269
|
const chunks = [];
|
|
9164
9270
|
req.on('data', (c) => chunks.push(c));
|
|
9165
9271
|
req.on('end', () => resolve(chunks.length === 0 ? Buffer.alloc(0) : Buffer.concat(chunks)));
|
|
9166
|
-
req.on('error', () =>
|
|
9272
|
+
req.on('error', (err) => reject(err));
|
|
9273
|
+
req.on('aborted', () => reject(new Error('aborted')));
|
|
9167
9274
|
});
|
|
9168
9275
|
}
|
|
9169
9276
|
|
|
@@ -9183,7 +9290,14 @@ async function handleMcpRequest(req, res, requestId) {
|
|
|
9183
9290
|
}
|
|
9184
9291
|
|
|
9185
9292
|
// \u9274\u6743\uFF1A\u5E73\u53F0\u7EA7\u8EAB\u4EFD\u6821\u9A8C\u7EDF\u4E00\u7531\u4E2D\u63A7\uFF08\u8FB9\u7F18\uFF09\u5B8C\u6210\uFF0CSCF \u4FA7\u4E0D\u518D\u81EA\u884C\u6821\u9A8C token\u3002
|
|
9186
|
-
|
|
9293
|
+
let raw;
|
|
9294
|
+
try {
|
|
9295
|
+
raw = await __mcpReadRawBody(req);
|
|
9296
|
+
} catch (err) {
|
|
9297
|
+
console.error('[mcp] request body read failed:', (err && err.message) || String(err));
|
|
9298
|
+
__mcpSendJson(res, requestId, 400, __mcpJsonRpcError(-32600, 'Request body read failed'));
|
|
9299
|
+
return;
|
|
9300
|
+
}
|
|
9187
9301
|
let parsedBody;
|
|
9188
9302
|
try {
|
|
9189
9303
|
const text = raw.toString('utf-8');
|
|
@@ -9591,19 +9705,9 @@ function parseEoConnectingGeo(headers) {
|
|
|
9591
9705
|
return safeGeo;
|
|
9592
9706
|
}
|
|
9593
9707
|
|
|
9708
|
+
// \u8BFB\u5931\u8D25\uFF08\u65AD\u6D41 / \u622A\u65AD\uFF09\u4E0D\u518D\u541E\u6210\u7A7A body\uFF0C\u7531\u8C03\u7528\u65B9\u663E\u5F0F\u56DE\u9519\u8BEF\u3002
|
|
9594
9709
|
function readBody(req) {
|
|
9595
|
-
return
|
|
9596
|
-
const chunks = [];
|
|
9597
|
-
req.on('data', (chunk) => chunks.push(chunk));
|
|
9598
|
-
req.on('end', () => {
|
|
9599
|
-
if (chunks.length === 0) {
|
|
9600
|
-
resolve(Buffer.alloc(0));
|
|
9601
|
-
return;
|
|
9602
|
-
}
|
|
9603
|
-
resolve(Buffer.concat(chunks));
|
|
9604
|
-
});
|
|
9605
|
-
req.on('error', () => resolve(Buffer.alloc(0)));
|
|
9606
|
-
});
|
|
9710
|
+
return readIncomingBody(req);
|
|
9607
9711
|
}
|
|
9608
9712
|
|
|
9609
9713
|
// \u8BF7\u6C42\u5165\u53E3\u603B\u89C8\uFF1A
|
|
@@ -9638,7 +9742,14 @@ async function requestHandler(req, res) {
|
|
|
9638
9742
|
}
|
|
9639
9743
|
runtimeUrl = xForwardedProto + '://' + host + pathname + search;
|
|
9640
9744
|
}
|
|
9641
|
-
|
|
9745
|
+
let rawBody;
|
|
9746
|
+
try {
|
|
9747
|
+
rawBody = await readBody(req);
|
|
9748
|
+
} catch (bodyError) {
|
|
9749
|
+
respondBodyReadError(req, res, bodyError, pathname);
|
|
9750
|
+
console.log(\`Makers request path: \${fullPath} |scfRequestId=\${requestId}|statusCode=400|conversationId=\${String(req.headers['makers-conversation-id'] || '')}|\`);
|
|
9751
|
+
return;
|
|
9752
|
+
}
|
|
9642
9753
|
// \u6309 content-type \u505A\u4E00\u6B21\u534F\u8BAE\u5C42\u89E3\u7801\uFF0C\u4E1A\u52A1 handler \u76F4\u63A5\u6D88\u8D39\u7ED3\u6784\u5316 body\u3002
|
|
9643
9754
|
const body = EdgeoneBodyParser.parseBodyByContentType(rawBody, String(req.headers['content-type'] || ''));
|
|
9644
9755
|
const eo = {
|
|
@@ -56129,70 +56240,76 @@ mime-types/index.js:
|
|
|
56129
56240
|
"node_modules/@edgeone/pages-blob/dist/index.js"(exports, module) {
|
|
56130
56241
|
"use strict";
|
|
56131
56242
|
var U = Object.defineProperty;
|
|
56132
|
-
var
|
|
56133
|
-
var
|
|
56134
|
-
var
|
|
56135
|
-
var
|
|
56136
|
-
for (var
|
|
56137
|
-
U(t,
|
|
56243
|
+
var ge = Object.getOwnPropertyDescriptor;
|
|
56244
|
+
var fe = Object.getOwnPropertyNames;
|
|
56245
|
+
var he = Object.prototype.hasOwnProperty;
|
|
56246
|
+
var me = (t, e) => {
|
|
56247
|
+
for (var n in e)
|
|
56248
|
+
U(t, n, { get: e[n], enumerable: true });
|
|
56138
56249
|
};
|
|
56139
|
-
var
|
|
56250
|
+
var ye = (t, e, n, r) => {
|
|
56140
56251
|
if (e && typeof e == "object" || typeof e == "function")
|
|
56141
|
-
for (let s of
|
|
56142
|
-
!
|
|
56252
|
+
for (let s of fe(e))
|
|
56253
|
+
!he.call(t, s) && s !== n && U(t, s, { get: () => e[s], enumerable: !(r = ge(e, s)) || r.enumerable });
|
|
56143
56254
|
return t;
|
|
56144
56255
|
};
|
|
56145
|
-
var
|
|
56146
|
-
var
|
|
56147
|
-
|
|
56148
|
-
module.exports =
|
|
56149
|
-
var
|
|
56256
|
+
var pe = (t) => ye(U({}, "__esModule", { value: true }), t);
|
|
56257
|
+
var Le = {};
|
|
56258
|
+
me(Le, { InvalidKeyError: () => w, InvalidStoreNameError: () => p, MissingProjectIdError: () => S, PagesBlobError: () => m, PreconditionFailedError: () => b, QuotaExceededError: () => x, RateLimitedError: () => B, Store: () => T, getStore: () => _e, listStores: () => Ne });
|
|
56259
|
+
module.exports = pe(Le);
|
|
56260
|
+
var m = class extends Error {
|
|
56150
56261
|
code;
|
|
56151
|
-
constructor(e,
|
|
56152
|
-
super(\`PagesBlob: \${
|
|
56262
|
+
constructor(e, n) {
|
|
56263
|
+
super(\`PagesBlob: \${n}\`), this.name = "PagesBlobError", this.code = e;
|
|
56153
56264
|
}
|
|
56154
56265
|
};
|
|
56155
|
-
var w = class extends
|
|
56266
|
+
var w = class extends m {
|
|
56156
56267
|
constructor(e) {
|
|
56157
56268
|
super("INVALID_KEY", e);
|
|
56158
56269
|
}
|
|
56159
56270
|
};
|
|
56160
|
-
var
|
|
56271
|
+
var p = class extends m {
|
|
56161
56272
|
constructor(e) {
|
|
56162
56273
|
super("INVALID_STORE_NAME", e);
|
|
56163
56274
|
}
|
|
56164
56275
|
};
|
|
56165
|
-
var
|
|
56276
|
+
var E = class extends m {
|
|
56166
56277
|
constructor(e) {
|
|
56167
56278
|
super("MISSING_ENVIRONMENT", \`Environment not configured for Pages Blob. Missing: \${e.join(", ")}. Supply these properties when creating a store, or ensure the function is running in a Pages environment.\`);
|
|
56168
56279
|
}
|
|
56169
56280
|
};
|
|
56170
|
-
var
|
|
56171
|
-
|
|
56172
|
-
|
|
56281
|
+
var we = "If usage just dropped back under the limit, wait a few minutes and retry.";
|
|
56282
|
+
var Ce = { storage: "write denied: storage quota exceeded (free plan 1 GB). Reads and deletes still work; delete objects or upgrade the plan.", "complex-operations": "write denied: complex operation quota (writes and lists) exceeded. Reads and deletes still work; upgrade the plan or wait until usage is back under the limit.", egress: "write denied: egress bandwidth quota exceeded. Only deletes still work; upgrade the plan or wait until usage is back under the limit." };
|
|
56283
|
+
var x = class extends m {
|
|
56284
|
+
reason;
|
|
56285
|
+
overMetrics;
|
|
56286
|
+
constructor(e = {}) {
|
|
56287
|
+
let n = e.reason && Ce[e.reason] || "write denied: blob quota exceeded.";
|
|
56288
|
+
super("QUOTA_EXCEEDED", \`\${n} \${we}\`), this.reason = e.reason, this.overMetrics = e.overMetrics ?? [];
|
|
56173
56289
|
}
|
|
56174
56290
|
};
|
|
56175
|
-
var
|
|
56291
|
+
var B = class extends m {
|
|
56176
56292
|
constructor() {
|
|
56177
56293
|
super("RATE_LIMITED", "request rate limited, please retry later");
|
|
56178
56294
|
}
|
|
56179
56295
|
};
|
|
56180
|
-
var
|
|
56296
|
+
var S = class extends m {
|
|
56181
56297
|
constructor() {
|
|
56182
56298
|
super("MISSING_PROJECT_ID", "projectId is required when using API token mode. Please supply { name, projectId, token } to getStore() / listStores().");
|
|
56183
56299
|
}
|
|
56184
56300
|
};
|
|
56185
|
-
var
|
|
56301
|
+
var y = class extends m {
|
|
56186
56302
|
constructor(e) {
|
|
56187
56303
|
super("CREDENTIAL_ERROR", e);
|
|
56188
56304
|
}
|
|
56189
56305
|
};
|
|
56190
|
-
var
|
|
56191
|
-
|
|
56192
|
-
|
|
56306
|
+
var h = class extends m {
|
|
56307
|
+
statusCode;
|
|
56308
|
+
constructor(e, n) {
|
|
56309
|
+
super("COS_ERROR", \`COS returned \${e}: \${n}\`), this.statusCode = e;
|
|
56193
56310
|
}
|
|
56194
56311
|
};
|
|
56195
|
-
var
|
|
56312
|
+
var b = class extends m {
|
|
56196
56313
|
constructor() {
|
|
56197
56314
|
super("PRECONDITION_FAILED", "conditional write failed (key already exists)");
|
|
56198
56315
|
}
|
|
@@ -56205,202 +56322,203 @@ mime-types/index.js:
|
|
|
56205
56322
|
if (new TextEncoder().encode(t).length > 600)
|
|
56206
56323
|
throw new w("Blob key must be a sequence of Unicode characters whose UTF-8 encoding is at most 600 bytes long.");
|
|
56207
56324
|
}
|
|
56208
|
-
function
|
|
56325
|
+
function F(t) {
|
|
56209
56326
|
if (t === "")
|
|
56210
|
-
throw new
|
|
56327
|
+
throw new p("Store name must not be empty.");
|
|
56211
56328
|
if (t.includes("/") || t.includes(":"))
|
|
56212
|
-
throw new
|
|
56329
|
+
throw new p("Store name must not contain forward slashes (/) or colons (:).");
|
|
56213
56330
|
if (!/^[a-zA-Z0-9_-]+$/.test(t))
|
|
56214
|
-
throw new
|
|
56331
|
+
throw new p("Store name must only contain letters, digits, underscores, and hyphens.");
|
|
56215
56332
|
if (new TextEncoder().encode(t).length > 64)
|
|
56216
|
-
throw new
|
|
56333
|
+
throw new p("Store name must be a sequence of Unicode characters whose UTF-8 encoding is at most 64 bytes long.");
|
|
56217
56334
|
}
|
|
56218
|
-
var
|
|
56335
|
+
var T = class {
|
|
56219
56336
|
cosClient;
|
|
56220
56337
|
storeName;
|
|
56221
56338
|
defaultConsistency;
|
|
56222
|
-
constructor(e,
|
|
56223
|
-
this.cosClient = e, this.storeName =
|
|
56339
|
+
constructor(e, n, r = "eventual") {
|
|
56340
|
+
this.cosClient = e, this.storeName = n, this.defaultConsistency = r;
|
|
56224
56341
|
}
|
|
56225
56342
|
resolveConsistency(e) {
|
|
56226
56343
|
return e ?? this.defaultConsistency;
|
|
56227
56344
|
}
|
|
56228
|
-
async set(e,
|
|
56345
|
+
async set(e, n, r) {
|
|
56229
56346
|
C(e);
|
|
56230
|
-
let s = await this.cosClient.putObject(this.storeName, e,
|
|
56231
|
-
if ((
|
|
56232
|
-
throw new
|
|
56347
|
+
let s = await this.cosClient.putObject(this.storeName, e, n, { onlyIfNew: r == null ? void 0 : r.onlyIfNew, cacheControl: r == null ? void 0 : r.cacheControl });
|
|
56348
|
+
if ((r == null ? void 0 : r.onlyIfNew) && s.statusCode === 412)
|
|
56349
|
+
throw new b();
|
|
56233
56350
|
}
|
|
56234
|
-
async setJSON(e,
|
|
56351
|
+
async setJSON(e, n, r) {
|
|
56235
56352
|
C(e);
|
|
56236
|
-
let s = JSON.stringify(
|
|
56237
|
-
if ((
|
|
56238
|
-
throw new
|
|
56353
|
+
let s = JSON.stringify(n), o = await this.cosClient.putObject(this.storeName, e, s, { onlyIfNew: r == null ? void 0 : r.onlyIfNew, contentType: "application/json", cacheControl: r == null ? void 0 : r.cacheControl });
|
|
56354
|
+
if ((r == null ? void 0 : r.onlyIfNew) && o.statusCode === 412)
|
|
56355
|
+
throw new b();
|
|
56239
56356
|
}
|
|
56240
|
-
async createUploadUrl(e,
|
|
56357
|
+
async createUploadUrl(e, n) {
|
|
56241
56358
|
C(e);
|
|
56242
|
-
let { url:
|
|
56243
|
-
return { url:
|
|
56359
|
+
let { url: r, expiresAt: s } = await this.cosClient.createPresignedPutUrl(this.storeName, e, { expireSeconds: n == null ? void 0 : n.expireSeconds, contentType: n == null ? void 0 : n.contentType });
|
|
56360
|
+
return { url: r, key: e, expiresAt: s };
|
|
56244
56361
|
}
|
|
56245
|
-
async get(e,
|
|
56362
|
+
async get(e, n) {
|
|
56246
56363
|
C(e);
|
|
56247
|
-
let
|
|
56364
|
+
let r = this.resolveConsistency(n == null ? void 0 : n.consistency), s = await this.cosClient.getObject(this.storeName, e, r);
|
|
56248
56365
|
if (s === null)
|
|
56249
56366
|
return null;
|
|
56250
|
-
let { body:
|
|
56251
|
-
switch (
|
|
56367
|
+
let { body: o } = s, c = (n == null ? void 0 : n.type) ?? "text", i = new TextDecoder("utf-8");
|
|
56368
|
+
switch (c) {
|
|
56252
56369
|
case "text":
|
|
56253
|
-
return
|
|
56370
|
+
return i.decode(o);
|
|
56254
56371
|
case "json":
|
|
56255
|
-
return JSON.parse(
|
|
56372
|
+
return JSON.parse(i.decode(o));
|
|
56256
56373
|
case "arrayBuffer":
|
|
56257
|
-
return
|
|
56374
|
+
return o.buffer.slice(o.byteOffset, o.byteOffset + o.byteLength);
|
|
56258
56375
|
case "blob":
|
|
56259
|
-
return new Blob([
|
|
56376
|
+
return new Blob([o]);
|
|
56260
56377
|
case "stream":
|
|
56261
|
-
return new ReadableStream({ start(
|
|
56262
|
-
|
|
56378
|
+
return new ReadableStream({ start(d) {
|
|
56379
|
+
d.enqueue(o), d.close();
|
|
56263
56380
|
} });
|
|
56264
56381
|
default:
|
|
56265
|
-
return
|
|
56382
|
+
return i.decode(o);
|
|
56266
56383
|
}
|
|
56267
56384
|
}
|
|
56268
|
-
async getMetadata(e,
|
|
56385
|
+
async getMetadata(e, n) {
|
|
56269
56386
|
C(e);
|
|
56270
|
-
let
|
|
56271
|
-
return this.cosClient.headObject(this.storeName, e,
|
|
56387
|
+
let r = this.resolveConsistency(n == null ? void 0 : n.consistency);
|
|
56388
|
+
return this.cosClient.headObject(this.storeName, e, r);
|
|
56272
56389
|
}
|
|
56273
|
-
async getWithHeaders(e,
|
|
56390
|
+
async getWithHeaders(e, n) {
|
|
56274
56391
|
C(e);
|
|
56275
|
-
let
|
|
56392
|
+
let r = this.resolveConsistency(n == null ? void 0 : n.consistency), s = await this.cosClient.getObject(this.storeName, e, r);
|
|
56276
56393
|
return s ? { body: new TextDecoder("utf-8").decode(s.body), headers: s.headers || {} } : null;
|
|
56277
56394
|
}
|
|
56278
56395
|
async delete(e) {
|
|
56279
56396
|
C(e), await this.cosClient.deleteObject(this.storeName, e);
|
|
56280
56397
|
}
|
|
56281
56398
|
async list(e) {
|
|
56282
|
-
let
|
|
56283
|
-
for (;
|
|
56284
|
-
let
|
|
56285
|
-
if (
|
|
56399
|
+
let n = (e == null ? void 0 : e.paginate) !== false, r = e == null ? void 0 : e.limit, s = [], o = [], c = this.resolveConsistency(e == null ? void 0 : e.consistency), i = (e == null ? void 0 : e.cursor) || "", d = true, a;
|
|
56400
|
+
for (; d; ) {
|
|
56401
|
+
let l = r !== void 0 ? r - s.length : 1e3, g = Math.min(l, 1e3);
|
|
56402
|
+
if (g <= 0)
|
|
56286
56403
|
break;
|
|
56287
|
-
let
|
|
56288
|
-
for (let
|
|
56289
|
-
s.push({ key:
|
|
56290
|
-
|
|
56404
|
+
let u = await this.cosClient.listObjects(this.storeName, { prefix: e == null ? void 0 : e.prefix, delimiter: (e == null ? void 0 : e.directories) ? "/" : void 0, marker: i || void 0, maxKeys: g, consistency: c });
|
|
56405
|
+
for (let f of u.contents)
|
|
56406
|
+
s.push({ key: f.key, etag: f.etag });
|
|
56407
|
+
o.push(...u.commonPrefixes), r !== void 0 && s.length >= r ? (s.length = r, (u.isTruncated || u.contents.length === g) && (a = u.nextMarker), d = false) : u.isTruncated ? !n && r === void 0 ? (a = u.nextMarker, d = false) : i = u.nextMarker : d = false;
|
|
56291
56408
|
}
|
|
56292
|
-
return { blobs: s, directories:
|
|
56409
|
+
return { blobs: s, directories: o, ...a ? { cursor: a } : {} };
|
|
56293
56410
|
}
|
|
56294
56411
|
};
|
|
56295
|
-
var
|
|
56296
|
-
function
|
|
56297
|
-
let e =
|
|
56298
|
-
return
|
|
56412
|
+
var xe = new TextEncoder();
|
|
56413
|
+
function K(t) {
|
|
56414
|
+
let e = xe.encode(t), n = new ArrayBuffer(e.byteLength), r = new Uint8Array(n);
|
|
56415
|
+
return r.set(e), r;
|
|
56299
56416
|
}
|
|
56300
|
-
function
|
|
56301
|
-
let e = t instanceof Uint8Array ? t : new Uint8Array(t),
|
|
56302
|
-
for (let
|
|
56303
|
-
|
|
56304
|
-
return
|
|
56417
|
+
function V(t) {
|
|
56418
|
+
let e = t instanceof Uint8Array ? t : new Uint8Array(t), n = "";
|
|
56419
|
+
for (let r = 0; r < e.length; r++)
|
|
56420
|
+
n += e[r].toString(16).padStart(2, "0");
|
|
56421
|
+
return n;
|
|
56305
56422
|
}
|
|
56306
|
-
async function
|
|
56307
|
-
let
|
|
56308
|
-
return
|
|
56423
|
+
async function W(t, e) {
|
|
56424
|
+
let n = await crypto.subtle.importKey("raw", K(t), { name: "HMAC", hash: "SHA-1" }, false, ["sign"]), r = await crypto.subtle.sign("HMAC", n, K(e));
|
|
56425
|
+
return V(r);
|
|
56309
56426
|
}
|
|
56310
|
-
async function
|
|
56311
|
-
let e = await crypto.subtle.digest("SHA-1",
|
|
56312
|
-
return
|
|
56427
|
+
async function be(t) {
|
|
56428
|
+
let e = await crypto.subtle.digest("SHA-1", K(t));
|
|
56429
|
+
return V(e);
|
|
56313
56430
|
}
|
|
56314
|
-
function
|
|
56431
|
+
function j(t) {
|
|
56315
56432
|
return encodeURIComponent(t).replace(/[!'()*]/g, (e) => "%" + e.charCodeAt(0).toString(16).toUpperCase());
|
|
56316
56433
|
}
|
|
56317
|
-
function
|
|
56434
|
+
function I(t) {
|
|
56318
56435
|
try {
|
|
56319
56436
|
return decodeURIComponent(t);
|
|
56320
56437
|
} catch {
|
|
56321
56438
|
return t;
|
|
56322
56439
|
}
|
|
56323
56440
|
}
|
|
56324
|
-
function
|
|
56325
|
-
return t.split("/").map((e) =>
|
|
56441
|
+
function Ee(t) {
|
|
56442
|
+
return t.split("/").map((e) => I(e)).join("/");
|
|
56326
56443
|
}
|
|
56327
|
-
function
|
|
56328
|
-
return
|
|
56444
|
+
function k(t) {
|
|
56445
|
+
return Ee(I(t));
|
|
56329
56446
|
}
|
|
56330
|
-
function
|
|
56331
|
-
return t.split("/").map((e) =>
|
|
56447
|
+
function J(t) {
|
|
56448
|
+
return t.split("/").map((e) => j(I(e))).join("/");
|
|
56332
56449
|
}
|
|
56333
|
-
var
|
|
56334
|
-
function
|
|
56335
|
-
return t === "host" || t === "x-cos-security-token" ? false : !!(
|
|
56450
|
+
var Se = /* @__PURE__ */ new Set(["cache-control", "content-disposition", "content-encoding", "content-length", "content-md5", "content-type", "expect", "expires", "if-match", "if-modified-since", "if-none-match", "if-unmodified-since", "origin", "range", "transfer-encoding"]);
|
|
56451
|
+
function Te(t) {
|
|
56452
|
+
return t === "host" || t === "x-cos-security-token" ? false : !!(Se.has(t) || t.startsWith("x-cos-"));
|
|
56336
56453
|
}
|
|
56337
56454
|
function X(t) {
|
|
56338
56455
|
if (!t)
|
|
56339
56456
|
return [];
|
|
56340
56457
|
let e = [];
|
|
56341
|
-
for (let [
|
|
56342
|
-
|
|
56343
|
-
return e.sort(([
|
|
56458
|
+
for (let [n, r] of Object.entries(t))
|
|
56459
|
+
r != null && e.push([n.toLowerCase(), String(r)]);
|
|
56460
|
+
return e.sort(([n], [r]) => n < r ? -1 : n > r ? 1 : 0), e;
|
|
56344
56461
|
}
|
|
56345
56462
|
function Y(t) {
|
|
56346
|
-
return t.map(([e,
|
|
56463
|
+
return t.map(([e, n]) => \`\${j(e)}=\${j(n)}\`).join("&");
|
|
56347
56464
|
}
|
|
56348
|
-
function
|
|
56349
|
-
return t.map(([e]) =>
|
|
56350
|
-
}
|
|
56351
|
-
async function
|
|
56352
|
-
let e = t.method.toLowerCase(),
|
|
56353
|
-
\${
|
|
56354
|
-
\${
|
|
56355
|
-
\${
|
|
56356
|
-
\`,
|
|
56357
|
-
\${
|
|
56358
|
-
\${await
|
|
56359
|
-
\`,
|
|
56360
|
-
for (let [
|
|
56361
|
-
|
|
56362
|
-
return { authorization:
|
|
56363
|
-
}
|
|
56364
|
-
async function
|
|
56365
|
-
let e = new URL(t.domain),
|
|
56465
|
+
function G(t) {
|
|
56466
|
+
return t.map(([e]) => j(e)).join(";");
|
|
56467
|
+
}
|
|
56468
|
+
async function Z(t) {
|
|
56469
|
+
let e = t.method.toLowerCase(), n = t.pathname.startsWith("/") ? t.pathname : \`/\${t.pathname}\`, r = Math.floor(Date.now() / 1e3), s = r + (t.expireSeconds ?? 3600), o = \`\${r};\${s}\`, i = X(t.headers).filter(([L]) => Te(L)), d = G(i), a = Y(i), l = X(t.query), g = G(l), u = Y(l), f = \`\${e}
|
|
56470
|
+
\${n}
|
|
56471
|
+
\${u}
|
|
56472
|
+
\${a}
|
|
56473
|
+
\`, _ = \`sha1
|
|
56474
|
+
\${o}
|
|
56475
|
+
\${await be(f)}
|
|
56476
|
+
\`, N = await W(t.secretKey, o), de = await W(N, _), le = ["q-sign-algorithm=sha1", \`q-ak=\${t.secretId}\`, \`q-sign-time=\${o}\`, \`q-key-time=\${o}\`, \`q-header-list=\${d}\`, \`q-url-param-list=\${g}\`, \`q-signature=\${de}\`].join("&"), H = {};
|
|
56477
|
+
for (let [L, ue] of i)
|
|
56478
|
+
H[L] = ue;
|
|
56479
|
+
return { authorization: le, signedHeaders: H };
|
|
56480
|
+
}
|
|
56481
|
+
async function Q(t) {
|
|
56482
|
+
let e = new URL(t.domain), n = I(t.key), r = \`/\${k(t.key)}\`, s = \`/\${J(n)}\`;
|
|
56366
56483
|
e.pathname = s;
|
|
56367
|
-
let { authorization:
|
|
56484
|
+
let { authorization: o } = await Z({ method: t.method, pathname: r, query: t.query, headers: t.headers, secretId: t.credential.secretId, secretKey: t.credential.secretKey, expireSeconds: t.expireSeconds });
|
|
56368
56485
|
if (t.query)
|
|
56369
|
-
for (let [
|
|
56370
|
-
|
|
56371
|
-
for (let
|
|
56372
|
-
let
|
|
56373
|
-
if (
|
|
56486
|
+
for (let [c, i] of Object.entries(t.query))
|
|
56487
|
+
i != null && e.searchParams.set(c, String(i));
|
|
56488
|
+
for (let c of o.split("&")) {
|
|
56489
|
+
let i = c.indexOf("=");
|
|
56490
|
+
if (i === -1)
|
|
56374
56491
|
continue;
|
|
56375
|
-
let
|
|
56376
|
-
e.searchParams.set(
|
|
56492
|
+
let d = c.slice(0, i), a = c.slice(i + 1);
|
|
56493
|
+
e.searchParams.set(d, a);
|
|
56377
56494
|
}
|
|
56378
56495
|
return t.credential.sessionToken && e.searchParams.set("x-cos-security-token", t.credential.sessionToken), e.toString();
|
|
56379
56496
|
}
|
|
56380
|
-
async function
|
|
56381
|
-
let e = new URL(t.domain),
|
|
56497
|
+
async function P(t) {
|
|
56498
|
+
let e = new URL(t.domain), n = t.key ? I(t.key) : "", r = t.key ? \`/\${k(t.key)}\` : "/", s = n ? \`/\${J(n)}\` : "/";
|
|
56382
56499
|
if (e.pathname = s, t.query)
|
|
56383
|
-
for (let [
|
|
56384
|
-
|
|
56385
|
-
let { authorization:
|
|
56500
|
+
for (let [g, u] of Object.entries(t.query))
|
|
56501
|
+
u != null && e.searchParams.set(g, String(u));
|
|
56502
|
+
let { authorization: o } = await Z({ method: t.method, pathname: r, query: t.query, headers: t.headers, secretId: t.credential.secretId, secretKey: t.credential.secretKey }), c = new Headers();
|
|
56386
56503
|
if (t.headers)
|
|
56387
|
-
for (let [
|
|
56388
|
-
|
|
56389
|
-
|
|
56390
|
-
let
|
|
56391
|
-
for (let
|
|
56504
|
+
for (let [g, u] of Object.entries(t.headers))
|
|
56505
|
+
u != null && c.set(g, String(u));
|
|
56506
|
+
c.set("Authorization", o), t.credential.sessionToken && c.set("x-cos-security-token", t.credential.sessionToken);
|
|
56507
|
+
let i = e.toString(), d = { method: t.method, headers: c, body: t.body ?? void 0, signal: t.signal }, a = 2, l;
|
|
56508
|
+
for (let g = 0; g <= a; g++)
|
|
56392
56509
|
try {
|
|
56393
|
-
return await fetch(
|
|
56394
|
-
} catch (
|
|
56395
|
-
if (
|
|
56396
|
-
throw
|
|
56397
|
-
|
|
56398
|
-
}
|
|
56399
|
-
throw
|
|
56400
|
-
}
|
|
56401
|
-
var
|
|
56402
|
-
var
|
|
56403
|
-
var
|
|
56510
|
+
return await fetch(i, d);
|
|
56511
|
+
} catch (u) {
|
|
56512
|
+
if (l = u, u instanceof DOMException && u.name === "AbortError")
|
|
56513
|
+
throw u;
|
|
56514
|
+
g < a && await new Promise((f) => setTimeout(f, 1e3 * (g + 1)));
|
|
56515
|
+
}
|
|
56516
|
+
throw l;
|
|
56517
|
+
}
|
|
56518
|
+
var Pe = "blob.edgeone.site";
|
|
56519
|
+
var Ie = "blob-nocache.edgeone.site";
|
|
56520
|
+
var ke = "max-age=0, stale-while-revalidate=60";
|
|
56521
|
+
var D = class t {
|
|
56404
56522
|
credentialManager;
|
|
56405
56523
|
bucket = "";
|
|
56406
56524
|
region = "";
|
|
@@ -56408,17 +56526,17 @@ mime-types/index.js:
|
|
|
56408
56526
|
cachedDomain = "";
|
|
56409
56527
|
uncachedDomain = "";
|
|
56410
56528
|
initialized = false;
|
|
56411
|
-
static buildErrorDetail(e,
|
|
56412
|
-
let
|
|
56413
|
-
return \`\${e} \${
|
|
56529
|
+
static buildErrorDetail(e, n, r, s, o) {
|
|
56530
|
+
let c = r ? \`\${n}/\${r}\` : n, i = o ? \` [request-id: \${o}]\` : "";
|
|
56531
|
+
return \`\${e} \${c} - \${Ae(s)}\${i}\`;
|
|
56414
56532
|
}
|
|
56415
56533
|
constructor(e) {
|
|
56416
56534
|
this.credentialManager = e;
|
|
56417
56535
|
}
|
|
56418
56536
|
computeSubdomain(e) {
|
|
56419
|
-
let
|
|
56420
|
-
if (e.appId &&
|
|
56421
|
-
return
|
|
56537
|
+
let n = [];
|
|
56538
|
+
if (e.appId && n.push(e.appId), e.zoneId && n.push(e.zoneId), e.projectId && n.push(e.projectId), n.length >= 2)
|
|
56539
|
+
return n.join("-");
|
|
56422
56540
|
if (e.resourcePrefix) {
|
|
56423
56541
|
let s = e.resourcePrefix.replace(/\\/?\\*$/, "").split("/").filter(Boolean);
|
|
56424
56542
|
if (s.length >= 2)
|
|
@@ -56431,12 +56549,16 @@ mime-types/index.js:
|
|
|
56431
56549
|
return;
|
|
56432
56550
|
let e = await this.credentialManager.getCredential();
|
|
56433
56551
|
!this.keyPrefix && e.resourcePrefix && (this.keyPrefix = e.resourcePrefix.replace(/\\/?\\*$/, ""));
|
|
56434
|
-
let
|
|
56435
|
-
!this.bucket &&
|
|
56436
|
-
let
|
|
56437
|
-
if (!
|
|
56438
|
-
|
|
56439
|
-
|
|
56552
|
+
let n = e.edgeRegion === "CN", r = e.cosMainland, s = e.cosOverseas, o = n ? r || s : s || r;
|
|
56553
|
+
!this.bucket && o && (this.bucket = o.bucket, this.region = o.region);
|
|
56554
|
+
let { cachedDomain: c, uncachedDomain: i } = e;
|
|
56555
|
+
if (!c || !i) {
|
|
56556
|
+
let d = this.computeSubdomain(e);
|
|
56557
|
+
if (!d)
|
|
56558
|
+
throw new h(0, "unable to derive tenant subdomain from credential; missing appId/zoneId/projectId or resourcePrefix");
|
|
56559
|
+
c || (c = \`https://\${d}.\${Pe}\`), i || (i = \`https://\${d}.\${Ie}\`);
|
|
56560
|
+
}
|
|
56561
|
+
this.cachedDomain = c, this.uncachedDomain = i, this.initialized = true;
|
|
56440
56562
|
}
|
|
56441
56563
|
async resolveDomain(e) {
|
|
56442
56564
|
return await this.ensureInitialized(), e === "strong" ? this.uncachedDomain : this.cachedDomain;
|
|
@@ -56445,127 +56567,158 @@ mime-types/index.js:
|
|
|
56445
56567
|
let e = await this.credentialManager.getCredential();
|
|
56446
56568
|
return { secretId: e.tmpSecretId, secretKey: e.tmpSecretKey, sessionToken: e.sessionToken };
|
|
56447
56569
|
}
|
|
56448
|
-
buildCosKey(e,
|
|
56449
|
-
return \`\${this.keyPrefix}/\${e}/\${
|
|
56570
|
+
buildCosKey(e, n) {
|
|
56571
|
+
return \`\${this.keyPrefix}/\${e}/\${n}\`;
|
|
56450
56572
|
}
|
|
56451
56573
|
async getDomains() {
|
|
56452
56574
|
return await this.ensureInitialized(), { cached: this.cachedDomain, uncached: this.uncachedDomain };
|
|
56453
56575
|
}
|
|
56454
|
-
async putObject(e,
|
|
56455
|
-
let
|
|
56456
|
-
(s == null ? void 0 : s.onlyIfNew) && (
|
|
56576
|
+
async putObject(e, n, r, s) {
|
|
56577
|
+
let o = await this.resolveDomain("strong"), c = await this.ensureWriteAllowed(), i = await this.resolveCredential(), d = this.buildCosKey(e, n), { defaultCacheControl: a = ke } = c, l = (s == null ? void 0 : s.cacheControl) === null ? void 0 : (s == null ? void 0 : s.cacheControl) ?? a, g = {};
|
|
56578
|
+
(s == null ? void 0 : s.onlyIfNew) && (g["x-cos-forbid-overwrite"] = "true"), l && (g["Cache-Control"] = l), (s == null ? void 0 : s.contentType) && (g["Content-Type"] = s.contentType);
|
|
56579
|
+
let u;
|
|
56457
56580
|
try {
|
|
56458
|
-
let
|
|
56459
|
-
if (
|
|
56460
|
-
return await
|
|
56581
|
+
let f = await P({ domain: o, method: "PUT", key: d, headers: g, body: r, credential: i });
|
|
56582
|
+
if ((s == null ? void 0 : s.onlyIfNew) && (f.status === 409 || f.status === 412))
|
|
56583
|
+
return await f.arrayBuffer().catch(() => {
|
|
56461
56584
|
}), { etag: "", statusCode: 412 };
|
|
56462
|
-
if (
|
|
56463
|
-
let
|
|
56464
|
-
|
|
56585
|
+
if (f.ok) {
|
|
56586
|
+
let N = f.headers.get("etag") || "";
|
|
56587
|
+
return await f.arrayBuffer().catch(() => {
|
|
56588
|
+
}), { etag: N, statusCode: f.status };
|
|
56465
56589
|
}
|
|
56466
|
-
let
|
|
56467
|
-
|
|
56468
|
-
|
|
56469
|
-
|
|
56470
|
-
throw l instanceof f ? l : new f(0, t.buildErrorDetail("PUT", i, o, A(l)));
|
|
56590
|
+
let _ = await A(f);
|
|
56591
|
+
u = new h(f.status, t.buildErrorDetail("PUT", o, d, _ || \`status \${f.status}\`, R(f)));
|
|
56592
|
+
} catch (f) {
|
|
56593
|
+
u = new h(0, t.buildErrorDetail("PUT", o, d, v(f)));
|
|
56471
56594
|
}
|
|
56595
|
+
throw await this.explainWriteFailure(u);
|
|
56472
56596
|
}
|
|
56473
|
-
async
|
|
56474
|
-
let
|
|
56475
|
-
(
|
|
56476
|
-
|
|
56477
|
-
|
|
56597
|
+
async ensureWriteAllowed() {
|
|
56598
|
+
let e = await this.credentialManager.getCredential();
|
|
56599
|
+
if (e.writeAllowed !== false)
|
|
56600
|
+
return e;
|
|
56601
|
+
let n = e;
|
|
56602
|
+
try {
|
|
56603
|
+
n = await this.credentialManager.refreshCredential();
|
|
56604
|
+
} catch {
|
|
56605
|
+
}
|
|
56606
|
+
return ee(n), n;
|
|
56478
56607
|
}
|
|
56479
|
-
async
|
|
56480
|
-
|
|
56608
|
+
async explainWriteFailure(e) {
|
|
56609
|
+
if (![0, 403, 550].includes(e.statusCode))
|
|
56610
|
+
return e;
|
|
56481
56611
|
try {
|
|
56482
|
-
let
|
|
56483
|
-
|
|
56484
|
-
|
|
56612
|
+
let n = await this.credentialManager.refreshCredential();
|
|
56613
|
+
ee(n);
|
|
56614
|
+
} catch (n) {
|
|
56615
|
+
if (n instanceof x)
|
|
56616
|
+
return n;
|
|
56617
|
+
}
|
|
56618
|
+
return e;
|
|
56619
|
+
}
|
|
56620
|
+
async createPresignedPutUrl(e, n, r) {
|
|
56621
|
+
let s = await this.resolveDomain("strong");
|
|
56622
|
+
await this.ensureWriteAllowed();
|
|
56623
|
+
let o = await this.resolveCredential(), c = this.buildCosKey(e, n), i = {};
|
|
56624
|
+
(r == null ? void 0 : r.contentType) && (i["Content-Type"] = r.contentType);
|
|
56625
|
+
let d = (r == null ? void 0 : r.expireSeconds) ?? 3600, a = await Q({ domain: s, method: "PUT", key: c, headers: i, credential: o, expireSeconds: d }), l = Math.floor(Date.now() / 1e3) + d;
|
|
56626
|
+
return { url: a, expiresAt: l };
|
|
56627
|
+
}
|
|
56628
|
+
async getObject(e, n, r) {
|
|
56629
|
+
let s = await this.resolveDomain(r), o = await this.resolveCredential(), c = this.buildCosKey(e, n);
|
|
56630
|
+
try {
|
|
56631
|
+
let i = await P({ domain: s, method: "GET", key: c, credential: o });
|
|
56632
|
+
if (i.status === 404)
|
|
56633
|
+
return await i.arrayBuffer().catch(() => {
|
|
56485
56634
|
}), null;
|
|
56486
|
-
if (!
|
|
56487
|
-
let
|
|
56488
|
-
throw new
|
|
56635
|
+
if (!i.ok) {
|
|
56636
|
+
let l = await A(i);
|
|
56637
|
+
throw new h(i.status, t.buildErrorDetail("GET", s, c, l || \`status \${i.status}\`, R(i)));
|
|
56489
56638
|
}
|
|
56490
|
-
let
|
|
56491
|
-
return { body:
|
|
56492
|
-
} catch (
|
|
56493
|
-
throw
|
|
56639
|
+
let d = new Uint8Array(await i.arrayBuffer()), a = te(i.headers);
|
|
56640
|
+
return { body: d, contentType: a["content-type"], headers: a };
|
|
56641
|
+
} catch (i) {
|
|
56642
|
+
throw i instanceof h ? i : new h(0, t.buildErrorDetail("GET", s, c, v(i)));
|
|
56494
56643
|
}
|
|
56495
56644
|
}
|
|
56496
|
-
async headObject(e,
|
|
56497
|
-
let s = await this.resolveDomain(
|
|
56645
|
+
async headObject(e, n, r) {
|
|
56646
|
+
let s = await this.resolveDomain(r), o = await this.resolveCredential(), c = this.buildCosKey(e, n);
|
|
56498
56647
|
try {
|
|
56499
|
-
let
|
|
56500
|
-
if (
|
|
56648
|
+
let i = await P({ domain: s, method: "HEAD", key: c, credential: o });
|
|
56649
|
+
if (i.status === 404)
|
|
56501
56650
|
return null;
|
|
56502
|
-
if (!
|
|
56503
|
-
let
|
|
56504
|
-
throw new
|
|
56651
|
+
if (!i.ok) {
|
|
56652
|
+
let a = await A(i);
|
|
56653
|
+
throw new h(i.status, t.buildErrorDetail("HEAD", s, c, a || \`status \${i.status}\`, R(i)));
|
|
56505
56654
|
}
|
|
56506
|
-
let
|
|
56507
|
-
return { cacheControl:
|
|
56508
|
-
} catch (
|
|
56509
|
-
throw
|
|
56655
|
+
let d = te(i.headers);
|
|
56656
|
+
return { cacheControl: d["cache-control"], contentType: d["content-type"], etag: d.etag, headers: d };
|
|
56657
|
+
} catch (i) {
|
|
56658
|
+
throw i instanceof h ? i : new h(0, t.buildErrorDetail("HEAD", s, c, v(i)));
|
|
56510
56659
|
}
|
|
56511
56660
|
}
|
|
56512
|
-
async deleteObject(e,
|
|
56513
|
-
let
|
|
56661
|
+
async deleteObject(e, n) {
|
|
56662
|
+
let r = await this.resolveDomain("strong"), s = await this.resolveCredential(), o = this.buildCosKey(e, n);
|
|
56514
56663
|
try {
|
|
56515
|
-
let
|
|
56516
|
-
if (
|
|
56517
|
-
await
|
|
56664
|
+
let c = await P({ domain: r, method: "DELETE", key: o, credential: s });
|
|
56665
|
+
if (c.status === 204 || c.status === 404 || c.ok) {
|
|
56666
|
+
await c.arrayBuffer().catch(() => {
|
|
56518
56667
|
});
|
|
56519
56668
|
return;
|
|
56520
56669
|
}
|
|
56521
|
-
let
|
|
56522
|
-
throw new
|
|
56523
|
-
} catch (
|
|
56524
|
-
throw
|
|
56670
|
+
let i = await A(c);
|
|
56671
|
+
throw new h(c.status, t.buildErrorDetail("DELETE", r, o, i || \`status \${c.status}\`, R(c)));
|
|
56672
|
+
} catch (c) {
|
|
56673
|
+
throw c instanceof h ? c : new h(0, t.buildErrorDetail("DELETE", r, o, v(c)));
|
|
56525
56674
|
}
|
|
56526
56675
|
}
|
|
56527
|
-
async listObjects(e,
|
|
56676
|
+
async listObjects(e, n) {
|
|
56528
56677
|
await this.ensureInitialized();
|
|
56529
|
-
let
|
|
56530
|
-
let
|
|
56531
|
-
return
|
|
56532
|
-
}).filter((
|
|
56533
|
-
return { contents:
|
|
56678
|
+
let r = \`\${this.keyPrefix}/\${e}/\`, s = (n == null ? void 0 : n.prefix) ? r + n.prefix : r, o = await this.getBucketRaw({ prefix: s, delimiter: n == null ? void 0 : n.delimiter, marker: n == null ? void 0 : n.marker, maxKeys: n == null ? void 0 : n.maxKeys, consistency: n == null ? void 0 : n.consistency }), c = o.contents.map((d) => {
|
|
56679
|
+
let a = d.key, l = a.startsWith(r) ? a.slice(r.length) : a;
|
|
56680
|
+
return l ? { key: l, etag: d.etag } : null;
|
|
56681
|
+
}).filter((d) => d !== null), i = o.commonPrefixes.map((d) => d.startsWith(r) ? d.slice(r.length) : d).filter((d) => !!d);
|
|
56682
|
+
return { contents: c, commonPrefixes: i, isTruncated: o.isTruncated, nextMarker: o.nextMarker };
|
|
56534
56683
|
}
|
|
56535
56684
|
async listStores(e) {
|
|
56536
|
-
let
|
|
56685
|
+
let n = [], r = "", s = true;
|
|
56537
56686
|
for (; s; ) {
|
|
56538
56687
|
await this.ensureInitialized();
|
|
56539
|
-
let
|
|
56540
|
-
for (let
|
|
56541
|
-
let
|
|
56542
|
-
|
|
56688
|
+
let o = \`\${this.keyPrefix}/\`, c = await this.getBucketRaw({ prefix: o, delimiter: "/", maxKeys: 1e3, marker: r || void 0, consistency: e });
|
|
56689
|
+
for (let i of c.commonPrefixes) {
|
|
56690
|
+
let d = i.startsWith(o) ? i.slice(o.length, -1) : i.slice(0, -1);
|
|
56691
|
+
d && n.push(d);
|
|
56543
56692
|
}
|
|
56544
|
-
if (s =
|
|
56693
|
+
if (s = c.isTruncated, r = c.nextMarker, !s || !r)
|
|
56545
56694
|
break;
|
|
56546
56695
|
}
|
|
56547
|
-
return
|
|
56696
|
+
return n;
|
|
56548
56697
|
}
|
|
56549
56698
|
async getBucketRaw(e) {
|
|
56550
|
-
let
|
|
56551
|
-
e.delimiter && (s.delimiter = e.delimiter), e.marker && (s.marker =
|
|
56699
|
+
let n = await this.resolveDomain(e.consistency), r = await this.resolveCredential(), s = { prefix: k(e.prefix) };
|
|
56700
|
+
e.delimiter && (s.delimiter = e.delimiter), e.marker && (s.marker = k(e.marker)), e.maxKeys && (s["max-keys"] = e.maxKeys);
|
|
56552
56701
|
try {
|
|
56553
|
-
let
|
|
56554
|
-
if (!
|
|
56555
|
-
let
|
|
56556
|
-
throw new
|
|
56702
|
+
let o = await P({ domain: n, method: "GET", query: s, credential: r });
|
|
56703
|
+
if (!o.ok) {
|
|
56704
|
+
let i = await A(o);
|
|
56705
|
+
throw new h(o.status, t.buildErrorDetail("LIST", n, e.prefix, i || \`status \${o.status}\`, R(o)));
|
|
56557
56706
|
}
|
|
56558
|
-
let
|
|
56559
|
-
return
|
|
56560
|
-
} catch (
|
|
56561
|
-
throw
|
|
56707
|
+
let c = await o.text();
|
|
56708
|
+
return Re(c);
|
|
56709
|
+
} catch (o) {
|
|
56710
|
+
throw o instanceof h ? o : new h(0, t.buildErrorDetail("LIST", n, e.prefix, v(o)));
|
|
56562
56711
|
}
|
|
56563
56712
|
}
|
|
56564
56713
|
};
|
|
56565
|
-
function
|
|
56714
|
+
function ee(t) {
|
|
56715
|
+
if (t.writeAllowed === false)
|
|
56716
|
+
throw new x({ reason: t.writeDeniedReason, overMetrics: t.overMetrics });
|
|
56717
|
+
}
|
|
56718
|
+
function Ae(t) {
|
|
56566
56719
|
return t.replace(/[a-zA-Z0-9\\-]+\\.cos\\.[a-zA-Z0-9\\-.]+\\.myqcloud\\.com/gi, "[cos-origin]").replace(/[a-zA-Z0-9\\-]+\\.cos\\.[a-zA-Z0-9\\-.]+\\.tencentcos\\.cn/gi, "[cos-origin]");
|
|
56567
56720
|
}
|
|
56568
|
-
async function
|
|
56721
|
+
async function A(t) {
|
|
56569
56722
|
try {
|
|
56570
56723
|
return await t.text();
|
|
56571
56724
|
} catch {
|
|
@@ -56575,87 +56728,89 @@ mime-types/index.js:
|
|
|
56575
56728
|
function R(t) {
|
|
56576
56729
|
return t.headers.get("x-cos-request-id") || t.headers.get("x-eo-log-id") || void 0;
|
|
56577
56730
|
}
|
|
56578
|
-
function
|
|
56579
|
-
let e = t,
|
|
56580
|
-
if (
|
|
56581
|
-
let s =
|
|
56582
|
-
return s ? \`\${
|
|
56731
|
+
function v(t) {
|
|
56732
|
+
let e = t, n = e.message || String(t), r = e.cause;
|
|
56733
|
+
if (r) {
|
|
56734
|
+
let s = r.message || r.code || "";
|
|
56735
|
+
return s ? \`\${n} (\${s})\` : n;
|
|
56583
56736
|
}
|
|
56584
|
-
return
|
|
56737
|
+
return n;
|
|
56585
56738
|
}
|
|
56586
|
-
function
|
|
56739
|
+
function te(t) {
|
|
56587
56740
|
let e = {};
|
|
56588
|
-
return t.forEach((
|
|
56589
|
-
e[
|
|
56741
|
+
return t.forEach((n, r) => {
|
|
56742
|
+
e[r.toLowerCase()] = n;
|
|
56590
56743
|
}), e;
|
|
56591
56744
|
}
|
|
56592
|
-
function
|
|
56593
|
-
let e = [],
|
|
56594
|
-
for (; (
|
|
56595
|
-
let
|
|
56596
|
-
|
|
56745
|
+
function Re(t) {
|
|
56746
|
+
let e = [], n = /<Contents>([\\s\\S]*?)<\\/Contents>/g, r;
|
|
56747
|
+
for (; (r = n.exec(t)) !== null; ) {
|
|
56748
|
+
let a = r[1], l = M(a, "Key"), g = M(a, "ETag");
|
|
56749
|
+
l !== null && e.push({ key: q(l), etag: g || "" });
|
|
56597
56750
|
}
|
|
56598
|
-
let s = [],
|
|
56599
|
-
for (; (
|
|
56600
|
-
let
|
|
56601
|
-
|
|
56751
|
+
let s = [], o = /<CommonPrefixes>([\\s\\S]*?)<\\/CommonPrefixes>/g;
|
|
56752
|
+
for (; (r = o.exec(t)) !== null; ) {
|
|
56753
|
+
let a = r[1], l = M(a, "Prefix");
|
|
56754
|
+
l !== null && s.push(q(l));
|
|
56602
56755
|
}
|
|
56603
|
-
let
|
|
56604
|
-
return { contents: e, commonPrefixes: s, isTruncated:
|
|
56756
|
+
let i = M(t, "IsTruncated") === "true", d = M(t, "NextMarker") || "";
|
|
56757
|
+
return { contents: e, commonPrefixes: s, isTruncated: i, nextMarker: q(d) };
|
|
56605
56758
|
}
|
|
56606
|
-
function
|
|
56607
|
-
let
|
|
56608
|
-
return
|
|
56759
|
+
function M(t, e) {
|
|
56760
|
+
let r = new RegExp(\`<\${e}>([\\\\s\\\\S]*?)<\\\\/\${e}>\`).exec(t);
|
|
56761
|
+
return r ? r[1] : null;
|
|
56609
56762
|
}
|
|
56610
|
-
function
|
|
56763
|
+
function q(t) {
|
|
56611
56764
|
return t.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
56612
56765
|
}
|
|
56613
|
-
var
|
|
56614
|
-
async function
|
|
56766
|
+
var ve = "X-RateLimit-Reset";
|
|
56767
|
+
async function $(t, e, n = 2) {
|
|
56615
56768
|
var _a, _b;
|
|
56616
56769
|
(_b = (_a = e.signal) == null ? void 0 : _a.throwIfAborted) == null ? void 0 : _b.call(_a);
|
|
56617
56770
|
try {
|
|
56618
|
-
let
|
|
56619
|
-
if (
|
|
56620
|
-
let s =
|
|
56621
|
-
return await
|
|
56771
|
+
let r = await fetch(t, e);
|
|
56772
|
+
if (n > 0 && (r.status === 429 || r.status >= 500)) {
|
|
56773
|
+
let s = ne(r.headers.get(ve));
|
|
56774
|
+
return await re(s, e.signal), $(t, e, n - 1);
|
|
56622
56775
|
}
|
|
56623
|
-
return
|
|
56624
|
-
} catch (
|
|
56625
|
-
if (
|
|
56626
|
-
throw
|
|
56627
|
-
let s =
|
|
56628
|
-
return await
|
|
56776
|
+
return r;
|
|
56777
|
+
} catch (r) {
|
|
56778
|
+
if (n === 0 || r instanceof DOMException && r.name === "AbortError")
|
|
56779
|
+
throw r;
|
|
56780
|
+
let s = ne();
|
|
56781
|
+
return await re(s, e.signal), $(t, e, n - 1);
|
|
56629
56782
|
}
|
|
56630
56783
|
}
|
|
56631
|
-
function
|
|
56784
|
+
function ne(t) {
|
|
56632
56785
|
return t ? Math.max(Number(t) * 1e3 - Date.now(), 500) : 1500;
|
|
56633
56786
|
}
|
|
56634
|
-
function
|
|
56635
|
-
return new Promise((
|
|
56787
|
+
function re(t, e) {
|
|
56788
|
+
return new Promise((n, r) => {
|
|
56636
56789
|
if (e == null ? void 0 : e.aborted)
|
|
56637
|
-
return
|
|
56790
|
+
return r(e.reason);
|
|
56638
56791
|
let s = setTimeout(() => {
|
|
56639
|
-
e == null ? void 0 : e.removeEventListener("abort",
|
|
56640
|
-
}, t),
|
|
56641
|
-
clearTimeout(s),
|
|
56792
|
+
e == null ? void 0 : e.removeEventListener("abort", o), n();
|
|
56793
|
+
}, t), o = () => {
|
|
56794
|
+
clearTimeout(s), r(e.reason);
|
|
56642
56795
|
};
|
|
56643
|
-
e == null ? void 0 : e.addEventListener("abort",
|
|
56796
|
+
e == null ? void 0 : e.addEventListener("abort", o, { once: true });
|
|
56644
56797
|
});
|
|
56645
56798
|
}
|
|
56646
|
-
var
|
|
56647
|
-
function
|
|
56799
|
+
var Me = "prod";
|
|
56800
|
+
function se() {
|
|
56648
56801
|
let t = typeof process < "u" ? process.env.PAGES_BLOB_STS_ENV : void 0;
|
|
56649
|
-
return t === "test" || t === "prod" ? t :
|
|
56802
|
+
return t === "test" || t === "prod" ? t : Me;
|
|
56650
56803
|
}
|
|
56651
|
-
var
|
|
56652
|
-
var
|
|
56653
|
-
var
|
|
56804
|
+
var De = 300;
|
|
56805
|
+
var Oe = 6e4;
|
|
56806
|
+
var Be = "https://blob-sts.edgeone.site/";
|
|
56807
|
+
var O = class {
|
|
56654
56808
|
authToken;
|
|
56655
56809
|
projectId;
|
|
56656
56810
|
cached = null;
|
|
56657
|
-
|
|
56658
|
-
|
|
56811
|
+
lastForcedRefreshAt = 0;
|
|
56812
|
+
constructor(e, n) {
|
|
56813
|
+
this.authToken = e, this.projectId = n;
|
|
56659
56814
|
}
|
|
56660
56815
|
async getCredential() {
|
|
56661
56816
|
if (this.cached && !this.isExpired(this.cached))
|
|
@@ -56663,108 +56818,122 @@ mime-types/index.js:
|
|
|
56663
56818
|
let e = await this.fetchCredential();
|
|
56664
56819
|
return this.cached = e, e;
|
|
56665
56820
|
}
|
|
56821
|
+
async refreshCredential() {
|
|
56822
|
+
if (this.cached && Date.now() - this.lastForcedRefreshAt < Oe)
|
|
56823
|
+
return this.cached;
|
|
56824
|
+
this.lastForcedRefreshAt = Date.now();
|
|
56825
|
+
let e = await this.fetchCredential(true);
|
|
56826
|
+
return this.cached = e, e;
|
|
56827
|
+
}
|
|
56666
56828
|
clearCache() {
|
|
56667
56829
|
this.cached = null;
|
|
56668
56830
|
}
|
|
56669
56831
|
isExpired(e) {
|
|
56670
|
-
let
|
|
56671
|
-
return e.expiredTime -
|
|
56832
|
+
let n = Math.floor(Date.now() / 1e3);
|
|
56833
|
+
return e.expiredTime - n < De;
|
|
56672
56834
|
}
|
|
56673
|
-
async fetchCredential() {
|
|
56674
|
-
for (let
|
|
56675
|
-
let
|
|
56835
|
+
async fetchCredential(e = false) {
|
|
56836
|
+
for (let s = 1; s <= 3; s++) {
|
|
56837
|
+
let o = new AbortController(), c = setTimeout(() => o.abort(), 1e4), i;
|
|
56676
56838
|
try {
|
|
56677
|
-
|
|
56678
|
-
} catch (
|
|
56679
|
-
if (
|
|
56680
|
-
await
|
|
56839
|
+
i = await $(Be, { method: "POST", headers: { "Content-Type": "application/json", Authorization: \`Bearer \${this.authToken}\`, "X-Env": se(), ...e ? { "X-SKIP-CACHE": "true" } : {} }, body: JSON.stringify(this.projectId ? { ProjectId: this.projectId } : {}), signal: o.signal });
|
|
56840
|
+
} catch (l) {
|
|
56841
|
+
if (s < 3) {
|
|
56842
|
+
await z(500 * s);
|
|
56681
56843
|
continue;
|
|
56682
56844
|
}
|
|
56683
|
-
throw new
|
|
56845
|
+
throw new y(\`failed to obtain STS credential: \${l.message || "timeout"}\`);
|
|
56684
56846
|
} finally {
|
|
56685
|
-
clearTimeout(
|
|
56847
|
+
clearTimeout(c);
|
|
56686
56848
|
}
|
|
56687
|
-
if (
|
|
56688
|
-
throw new
|
|
56689
|
-
if (
|
|
56690
|
-
throw new
|
|
56691
|
-
if (!
|
|
56692
|
-
if (
|
|
56693
|
-
await
|
|
56849
|
+
if (i.status === 413)
|
|
56850
|
+
throw new y("storage quota exceeded");
|
|
56851
|
+
if (i.status === 429)
|
|
56852
|
+
throw new y("rate limited, please retry later");
|
|
56853
|
+
if (!i.ok) {
|
|
56854
|
+
if (i.status >= 500 && s < 3) {
|
|
56855
|
+
await z(500 * s);
|
|
56694
56856
|
continue;
|
|
56695
56857
|
}
|
|
56696
|
-
let
|
|
56697
|
-
throw new
|
|
56858
|
+
let l = await i.text().catch(() => "unknown error");
|
|
56859
|
+
throw new y(\`failed to obtain STS credential: \${i.status} \${l}\`);
|
|
56698
56860
|
}
|
|
56699
|
-
let
|
|
56700
|
-
if (
|
|
56701
|
-
let
|
|
56702
|
-
return { tmpSecretId:
|
|
56861
|
+
let d = await i.json(), a = d.data && typeof d.data == "object" ? d.data : d;
|
|
56862
|
+
if (a.tmpSecretId && a.tmpSecretKey && a.sessionToken && a.expiredTime) {
|
|
56863
|
+
let l = a.cosMainland, g = a.cosOverseas, u = i.headers.get("X-Edge-Region") || void 0;
|
|
56864
|
+
return { tmpSecretId: a.tmpSecretId, tmpSecretKey: a.tmpSecretKey, sessionToken: a.sessionToken, expiredTime: a.expiredTime, appId: a.appId || void 0, zoneId: a.zoneId || void 0, projectId: a.projectId || void 0, resourcePrefix: a.resourcePrefix || void 0, cosMainland: l || void 0, cosOverseas: g || void 0, edgeRegion: u, defaultCacheControl: typeof a.defaultCacheControl == "string" && a.defaultCacheControl ? a.defaultCacheControl : void 0, cachedDomain: ie(a.cachedDomain), uncachedDomain: ie(a.uncachedDomain), writeAllowed: typeof a.writeAllowed == "boolean" ? a.writeAllowed : void 0, writeDeniedReason: typeof a.writeDeniedReason == "string" && a.writeDeniedReason ? a.writeDeniedReason : void 0, overMetrics: Array.isArray(a.overMetrics) ? a.overMetrics.filter((f) => typeof f == "string") : void 0 };
|
|
56703
56865
|
}
|
|
56704
|
-
if (
|
|
56705
|
-
let
|
|
56706
|
-
throw new
|
|
56866
|
+
if (a.code !== void 0 && a.code !== 0) {
|
|
56867
|
+
let l = a.msg || a.message || "unknown error";
|
|
56868
|
+
throw new y(\`credential exchange failed (code=\${a.code}): \${l}\`);
|
|
56707
56869
|
}
|
|
56708
|
-
if (
|
|
56709
|
-
let
|
|
56710
|
-
throw new
|
|
56870
|
+
if (d.code !== void 0 && d.code !== 0) {
|
|
56871
|
+
let l = d.msg || d.message || "unknown error";
|
|
56872
|
+
throw new y(\`credential exchange failed (code=\${d.code}): \${l}\`);
|
|
56711
56873
|
}
|
|
56712
|
-
if (
|
|
56713
|
-
await
|
|
56874
|
+
if (s < 3) {
|
|
56875
|
+
await z(500 * s);
|
|
56714
56876
|
continue;
|
|
56715
56877
|
}
|
|
56716
|
-
throw new
|
|
56878
|
+
throw new y("invalid STS credential response");
|
|
56717
56879
|
}
|
|
56718
|
-
throw new
|
|
56880
|
+
throw new y("invalid STS credential response");
|
|
56719
56881
|
}
|
|
56720
56882
|
};
|
|
56721
|
-
function
|
|
56883
|
+
function ie(t) {
|
|
56884
|
+
if (typeof t != "string")
|
|
56885
|
+
return;
|
|
56886
|
+
let e = t.trim().replace(/\\/+$/, "");
|
|
56887
|
+
if (e)
|
|
56888
|
+
return /^https?:\\/\\//i.test(e) ? e : \`https://\${e}\`;
|
|
56889
|
+
}
|
|
56890
|
+
function z(t) {
|
|
56722
56891
|
return new Promise((e) => setTimeout(e, t));
|
|
56723
56892
|
}
|
|
56724
|
-
var
|
|
56725
|
-
function
|
|
56726
|
-
let t = {}, e =
|
|
56893
|
+
var je = "{{PAGES_BLOB_DEPLOY_CREDENTIAL}}";
|
|
56894
|
+
function ae() {
|
|
56895
|
+
let t = {}, e = $e();
|
|
56727
56896
|
if (e)
|
|
56728
56897
|
t.deployCredential = e;
|
|
56729
56898
|
else {
|
|
56730
|
-
let
|
|
56731
|
-
|
|
56899
|
+
let r = oe("PAGES_BLOB_DEPLOY_CREDENTIAL");
|
|
56900
|
+
r && (t.deployCredential = r);
|
|
56732
56901
|
}
|
|
56733
|
-
let
|
|
56734
|
-
return
|
|
56902
|
+
let n = oe("PAGES_PROJECT_ID");
|
|
56903
|
+
return n && (t.projectId = n), t;
|
|
56735
56904
|
}
|
|
56736
|
-
function
|
|
56737
|
-
let t =
|
|
56905
|
+
function $e() {
|
|
56906
|
+
let t = je;
|
|
56738
56907
|
if (!(t.startsWith("{{") && t.endsWith("}}")))
|
|
56739
56908
|
return t || void 0;
|
|
56740
56909
|
}
|
|
56741
|
-
function
|
|
56910
|
+
function oe(t) {
|
|
56742
56911
|
if (typeof process < "u" && process.env)
|
|
56743
56912
|
return process.env[t];
|
|
56744
56913
|
}
|
|
56745
|
-
function
|
|
56914
|
+
function _e(t) {
|
|
56746
56915
|
let e = typeof t == "string" ? t : t.name;
|
|
56747
|
-
|
|
56748
|
-
let
|
|
56749
|
-
return new
|
|
56916
|
+
F(e);
|
|
56917
|
+
let n = ce(typeof t == "string" ? void 0 : t), r = new O(n.authToken, n.projectId), s = new D(r);
|
|
56918
|
+
return new T(s, e, n.consistency ?? "eventual");
|
|
56750
56919
|
}
|
|
56751
|
-
async function
|
|
56752
|
-
let e =
|
|
56753
|
-
return { stores: (await new
|
|
56920
|
+
async function Ne(t) {
|
|
56921
|
+
let e = ce(t ? { name: "__list__", projectId: t.projectId, token: t.token, consistency: t.consistency } : void 0), n = new O(e.authToken, e.projectId);
|
|
56922
|
+
return { stores: (await new D(n).listStores(e.consistency)).map((o) => ({ name: o })) };
|
|
56754
56923
|
}
|
|
56755
|
-
function
|
|
56756
|
-
let e =
|
|
56924
|
+
function ce(t) {
|
|
56925
|
+
let e = ae(), n = (t == null ? void 0 : t.token) || e.deployCredential, r = (t == null ? void 0 : t.projectId) || e.projectId;
|
|
56757
56926
|
if ((t == null ? void 0 : t.token) || e.projectId) {
|
|
56758
|
-
if (!n)
|
|
56759
|
-
throw new T();
|
|
56760
56927
|
if (!r)
|
|
56761
|
-
throw new
|
|
56762
|
-
|
|
56928
|
+
throw new S();
|
|
56929
|
+
if (!n)
|
|
56930
|
+
throw new E(["token"]);
|
|
56931
|
+
return { authToken: n, projectId: r, consistency: t == null ? void 0 : t.consistency };
|
|
56763
56932
|
}
|
|
56764
|
-
if ((t == null ? void 0 : t.projectId) && !
|
|
56765
|
-
throw new
|
|
56933
|
+
if ((t == null ? void 0 : t.projectId) && !n)
|
|
56934
|
+
throw new E(["token"]);
|
|
56766
56935
|
if (!e.deployCredential)
|
|
56767
|
-
throw new
|
|
56936
|
+
throw new E(["deployCredential"]);
|
|
56768
56937
|
return { authToken: e.deployCredential, consistency: t == null ? void 0 : t.consistency };
|
|
56769
56938
|
}
|
|
56770
56939
|
}
|
|
@@ -59866,70 +60035,76 @@ mime-types/index.js:
|
|
|
59866
60035
|
"node_modules/@edgeone/pages-blob/dist/index.js"(exports, module) {
|
|
59867
60036
|
"use strict";
|
|
59868
60037
|
var U = Object.defineProperty;
|
|
59869
|
-
var
|
|
59870
|
-
var
|
|
59871
|
-
var
|
|
59872
|
-
var
|
|
59873
|
-
for (var
|
|
59874
|
-
U(t,
|
|
60038
|
+
var ge = Object.getOwnPropertyDescriptor;
|
|
60039
|
+
var fe = Object.getOwnPropertyNames;
|
|
60040
|
+
var he = Object.prototype.hasOwnProperty;
|
|
60041
|
+
var me = (t, e) => {
|
|
60042
|
+
for (var n in e)
|
|
60043
|
+
U(t, n, { get: e[n], enumerable: true });
|
|
59875
60044
|
};
|
|
59876
|
-
var
|
|
60045
|
+
var ye = (t, e, n, r) => {
|
|
59877
60046
|
if (e && typeof e == "object" || typeof e == "function")
|
|
59878
|
-
for (let s of
|
|
59879
|
-
!
|
|
60047
|
+
for (let s of fe(e))
|
|
60048
|
+
!he.call(t, s) && s !== n && U(t, s, { get: () => e[s], enumerable: !(r = ge(e, s)) || r.enumerable });
|
|
59880
60049
|
return t;
|
|
59881
60050
|
};
|
|
59882
|
-
var
|
|
59883
|
-
var
|
|
59884
|
-
|
|
59885
|
-
module.exports =
|
|
59886
|
-
var
|
|
60051
|
+
var pe = (t) => ye(U({}, "__esModule", { value: true }), t);
|
|
60052
|
+
var Le = {};
|
|
60053
|
+
me(Le, { InvalidKeyError: () => w, InvalidStoreNameError: () => p, MissingProjectIdError: () => S, PagesBlobError: () => m, PreconditionFailedError: () => b, QuotaExceededError: () => x, RateLimitedError: () => B, Store: () => T, getStore: () => _e, listStores: () => Ne });
|
|
60054
|
+
module.exports = pe(Le);
|
|
60055
|
+
var m = class extends Error {
|
|
59887
60056
|
code;
|
|
59888
|
-
constructor(e,
|
|
59889
|
-
super(\`PagesBlob: \${
|
|
60057
|
+
constructor(e, n) {
|
|
60058
|
+
super(\`PagesBlob: \${n}\`), this.name = "PagesBlobError", this.code = e;
|
|
59890
60059
|
}
|
|
59891
60060
|
};
|
|
59892
|
-
var w = class extends
|
|
60061
|
+
var w = class extends m {
|
|
59893
60062
|
constructor(e) {
|
|
59894
60063
|
super("INVALID_KEY", e);
|
|
59895
60064
|
}
|
|
59896
60065
|
};
|
|
59897
|
-
var
|
|
60066
|
+
var p = class extends m {
|
|
59898
60067
|
constructor(e) {
|
|
59899
60068
|
super("INVALID_STORE_NAME", e);
|
|
59900
60069
|
}
|
|
59901
60070
|
};
|
|
59902
|
-
var
|
|
60071
|
+
var E = class extends m {
|
|
59903
60072
|
constructor(e) {
|
|
59904
60073
|
super("MISSING_ENVIRONMENT", \`Environment not configured for Pages Blob. Missing: \${e.join(", ")}. Supply these properties when creating a store, or ensure the function is running in a Pages environment.\`);
|
|
59905
60074
|
}
|
|
59906
60075
|
};
|
|
59907
|
-
var
|
|
59908
|
-
|
|
59909
|
-
|
|
60076
|
+
var we = "If usage just dropped back under the limit, wait a few minutes and retry.";
|
|
60077
|
+
var Ce = { storage: "write denied: storage quota exceeded (free plan 1 GB). Reads and deletes still work; delete objects or upgrade the plan.", "complex-operations": "write denied: complex operation quota (writes and lists) exceeded. Reads and deletes still work; upgrade the plan or wait until usage is back under the limit.", egress: "write denied: egress bandwidth quota exceeded. Only deletes still work; upgrade the plan or wait until usage is back under the limit." };
|
|
60078
|
+
var x = class extends m {
|
|
60079
|
+
reason;
|
|
60080
|
+
overMetrics;
|
|
60081
|
+
constructor(e = {}) {
|
|
60082
|
+
let n = e.reason && Ce[e.reason] || "write denied: blob quota exceeded.";
|
|
60083
|
+
super("QUOTA_EXCEEDED", \`\${n} \${we}\`), this.reason = e.reason, this.overMetrics = e.overMetrics ?? [];
|
|
59910
60084
|
}
|
|
59911
60085
|
};
|
|
59912
|
-
var
|
|
60086
|
+
var B = class extends m {
|
|
59913
60087
|
constructor() {
|
|
59914
60088
|
super("RATE_LIMITED", "request rate limited, please retry later");
|
|
59915
60089
|
}
|
|
59916
60090
|
};
|
|
59917
|
-
var
|
|
60091
|
+
var S = class extends m {
|
|
59918
60092
|
constructor() {
|
|
59919
60093
|
super("MISSING_PROJECT_ID", "projectId is required when using API token mode. Please supply { name, projectId, token } to getStore() / listStores().");
|
|
59920
60094
|
}
|
|
59921
60095
|
};
|
|
59922
|
-
var
|
|
60096
|
+
var y = class extends m {
|
|
59923
60097
|
constructor(e) {
|
|
59924
60098
|
super("CREDENTIAL_ERROR", e);
|
|
59925
60099
|
}
|
|
59926
60100
|
};
|
|
59927
|
-
var
|
|
59928
|
-
|
|
59929
|
-
|
|
60101
|
+
var h = class extends m {
|
|
60102
|
+
statusCode;
|
|
60103
|
+
constructor(e, n) {
|
|
60104
|
+
super("COS_ERROR", \`COS returned \${e}: \${n}\`), this.statusCode = e;
|
|
59930
60105
|
}
|
|
59931
60106
|
};
|
|
59932
|
-
var
|
|
60107
|
+
var b = class extends m {
|
|
59933
60108
|
constructor() {
|
|
59934
60109
|
super("PRECONDITION_FAILED", "conditional write failed (key already exists)");
|
|
59935
60110
|
}
|
|
@@ -59942,202 +60117,203 @@ mime-types/index.js:
|
|
|
59942
60117
|
if (new TextEncoder().encode(t).length > 600)
|
|
59943
60118
|
throw new w("Blob key must be a sequence of Unicode characters whose UTF-8 encoding is at most 600 bytes long.");
|
|
59944
60119
|
}
|
|
59945
|
-
function
|
|
60120
|
+
function F(t) {
|
|
59946
60121
|
if (t === "")
|
|
59947
|
-
throw new
|
|
60122
|
+
throw new p("Store name must not be empty.");
|
|
59948
60123
|
if (t.includes("/") || t.includes(":"))
|
|
59949
|
-
throw new
|
|
60124
|
+
throw new p("Store name must not contain forward slashes (/) or colons (:).");
|
|
59950
60125
|
if (!/^[a-zA-Z0-9_-]+$/.test(t))
|
|
59951
|
-
throw new
|
|
60126
|
+
throw new p("Store name must only contain letters, digits, underscores, and hyphens.");
|
|
59952
60127
|
if (new TextEncoder().encode(t).length > 64)
|
|
59953
|
-
throw new
|
|
60128
|
+
throw new p("Store name must be a sequence of Unicode characters whose UTF-8 encoding is at most 64 bytes long.");
|
|
59954
60129
|
}
|
|
59955
|
-
var
|
|
60130
|
+
var T = class {
|
|
59956
60131
|
cosClient;
|
|
59957
60132
|
storeName;
|
|
59958
60133
|
defaultConsistency;
|
|
59959
|
-
constructor(e,
|
|
59960
|
-
this.cosClient = e, this.storeName =
|
|
60134
|
+
constructor(e, n, r = "eventual") {
|
|
60135
|
+
this.cosClient = e, this.storeName = n, this.defaultConsistency = r;
|
|
59961
60136
|
}
|
|
59962
60137
|
resolveConsistency(e) {
|
|
59963
60138
|
return e ?? this.defaultConsistency;
|
|
59964
60139
|
}
|
|
59965
|
-
async set(e,
|
|
60140
|
+
async set(e, n, r) {
|
|
59966
60141
|
C(e);
|
|
59967
|
-
let s = await this.cosClient.putObject(this.storeName, e,
|
|
59968
|
-
if ((
|
|
59969
|
-
throw new
|
|
60142
|
+
let s = await this.cosClient.putObject(this.storeName, e, n, { onlyIfNew: r == null ? void 0 : r.onlyIfNew, cacheControl: r == null ? void 0 : r.cacheControl });
|
|
60143
|
+
if ((r == null ? void 0 : r.onlyIfNew) && s.statusCode === 412)
|
|
60144
|
+
throw new b();
|
|
59970
60145
|
}
|
|
59971
|
-
async setJSON(e,
|
|
60146
|
+
async setJSON(e, n, r) {
|
|
59972
60147
|
C(e);
|
|
59973
|
-
let s = JSON.stringify(
|
|
59974
|
-
if ((
|
|
59975
|
-
throw new
|
|
60148
|
+
let s = JSON.stringify(n), o = await this.cosClient.putObject(this.storeName, e, s, { onlyIfNew: r == null ? void 0 : r.onlyIfNew, contentType: "application/json", cacheControl: r == null ? void 0 : r.cacheControl });
|
|
60149
|
+
if ((r == null ? void 0 : r.onlyIfNew) && o.statusCode === 412)
|
|
60150
|
+
throw new b();
|
|
59976
60151
|
}
|
|
59977
|
-
async createUploadUrl(e,
|
|
60152
|
+
async createUploadUrl(e, n) {
|
|
59978
60153
|
C(e);
|
|
59979
|
-
let { url:
|
|
59980
|
-
return { url:
|
|
60154
|
+
let { url: r, expiresAt: s } = await this.cosClient.createPresignedPutUrl(this.storeName, e, { expireSeconds: n == null ? void 0 : n.expireSeconds, contentType: n == null ? void 0 : n.contentType });
|
|
60155
|
+
return { url: r, key: e, expiresAt: s };
|
|
59981
60156
|
}
|
|
59982
|
-
async get(e,
|
|
60157
|
+
async get(e, n) {
|
|
59983
60158
|
C(e);
|
|
59984
|
-
let
|
|
60159
|
+
let r = this.resolveConsistency(n == null ? void 0 : n.consistency), s = await this.cosClient.getObject(this.storeName, e, r);
|
|
59985
60160
|
if (s === null)
|
|
59986
60161
|
return null;
|
|
59987
|
-
let { body:
|
|
59988
|
-
switch (
|
|
60162
|
+
let { body: o } = s, c = (n == null ? void 0 : n.type) ?? "text", i = new TextDecoder("utf-8");
|
|
60163
|
+
switch (c) {
|
|
59989
60164
|
case "text":
|
|
59990
|
-
return
|
|
60165
|
+
return i.decode(o);
|
|
59991
60166
|
case "json":
|
|
59992
|
-
return JSON.parse(
|
|
60167
|
+
return JSON.parse(i.decode(o));
|
|
59993
60168
|
case "arrayBuffer":
|
|
59994
|
-
return
|
|
60169
|
+
return o.buffer.slice(o.byteOffset, o.byteOffset + o.byteLength);
|
|
59995
60170
|
case "blob":
|
|
59996
|
-
return new Blob([
|
|
60171
|
+
return new Blob([o]);
|
|
59997
60172
|
case "stream":
|
|
59998
|
-
return new ReadableStream({ start(
|
|
59999
|
-
|
|
60173
|
+
return new ReadableStream({ start(d) {
|
|
60174
|
+
d.enqueue(o), d.close();
|
|
60000
60175
|
} });
|
|
60001
60176
|
default:
|
|
60002
|
-
return
|
|
60177
|
+
return i.decode(o);
|
|
60003
60178
|
}
|
|
60004
60179
|
}
|
|
60005
|
-
async getMetadata(e,
|
|
60180
|
+
async getMetadata(e, n) {
|
|
60006
60181
|
C(e);
|
|
60007
|
-
let
|
|
60008
|
-
return this.cosClient.headObject(this.storeName, e,
|
|
60182
|
+
let r = this.resolveConsistency(n == null ? void 0 : n.consistency);
|
|
60183
|
+
return this.cosClient.headObject(this.storeName, e, r);
|
|
60009
60184
|
}
|
|
60010
|
-
async getWithHeaders(e,
|
|
60185
|
+
async getWithHeaders(e, n) {
|
|
60011
60186
|
C(e);
|
|
60012
|
-
let
|
|
60187
|
+
let r = this.resolveConsistency(n == null ? void 0 : n.consistency), s = await this.cosClient.getObject(this.storeName, e, r);
|
|
60013
60188
|
return s ? { body: new TextDecoder("utf-8").decode(s.body), headers: s.headers || {} } : null;
|
|
60014
60189
|
}
|
|
60015
60190
|
async delete(e) {
|
|
60016
60191
|
C(e), await this.cosClient.deleteObject(this.storeName, e);
|
|
60017
60192
|
}
|
|
60018
60193
|
async list(e) {
|
|
60019
|
-
let
|
|
60020
|
-
for (;
|
|
60021
|
-
let
|
|
60022
|
-
if (
|
|
60194
|
+
let n = (e == null ? void 0 : e.paginate) !== false, r = e == null ? void 0 : e.limit, s = [], o = [], c = this.resolveConsistency(e == null ? void 0 : e.consistency), i = (e == null ? void 0 : e.cursor) || "", d = true, a;
|
|
60195
|
+
for (; d; ) {
|
|
60196
|
+
let l = r !== void 0 ? r - s.length : 1e3, g = Math.min(l, 1e3);
|
|
60197
|
+
if (g <= 0)
|
|
60023
60198
|
break;
|
|
60024
|
-
let
|
|
60025
|
-
for (let
|
|
60026
|
-
s.push({ key:
|
|
60027
|
-
|
|
60199
|
+
let u = await this.cosClient.listObjects(this.storeName, { prefix: e == null ? void 0 : e.prefix, delimiter: (e == null ? void 0 : e.directories) ? "/" : void 0, marker: i || void 0, maxKeys: g, consistency: c });
|
|
60200
|
+
for (let f of u.contents)
|
|
60201
|
+
s.push({ key: f.key, etag: f.etag });
|
|
60202
|
+
o.push(...u.commonPrefixes), r !== void 0 && s.length >= r ? (s.length = r, (u.isTruncated || u.contents.length === g) && (a = u.nextMarker), d = false) : u.isTruncated ? !n && r === void 0 ? (a = u.nextMarker, d = false) : i = u.nextMarker : d = false;
|
|
60028
60203
|
}
|
|
60029
|
-
return { blobs: s, directories:
|
|
60204
|
+
return { blobs: s, directories: o, ...a ? { cursor: a } : {} };
|
|
60030
60205
|
}
|
|
60031
60206
|
};
|
|
60032
|
-
var
|
|
60033
|
-
function
|
|
60034
|
-
let e =
|
|
60035
|
-
return
|
|
60207
|
+
var xe = new TextEncoder();
|
|
60208
|
+
function K(t) {
|
|
60209
|
+
let e = xe.encode(t), n = new ArrayBuffer(e.byteLength), r = new Uint8Array(n);
|
|
60210
|
+
return r.set(e), r;
|
|
60036
60211
|
}
|
|
60037
|
-
function
|
|
60038
|
-
let e = t instanceof Uint8Array ? t : new Uint8Array(t),
|
|
60039
|
-
for (let
|
|
60040
|
-
|
|
60041
|
-
return
|
|
60212
|
+
function V(t) {
|
|
60213
|
+
let e = t instanceof Uint8Array ? t : new Uint8Array(t), n = "";
|
|
60214
|
+
for (let r = 0; r < e.length; r++)
|
|
60215
|
+
n += e[r].toString(16).padStart(2, "0");
|
|
60216
|
+
return n;
|
|
60042
60217
|
}
|
|
60043
|
-
async function
|
|
60044
|
-
let
|
|
60045
|
-
return
|
|
60218
|
+
async function W(t, e) {
|
|
60219
|
+
let n = await crypto.subtle.importKey("raw", K(t), { name: "HMAC", hash: "SHA-1" }, false, ["sign"]), r = await crypto.subtle.sign("HMAC", n, K(e));
|
|
60220
|
+
return V(r);
|
|
60046
60221
|
}
|
|
60047
|
-
async function
|
|
60048
|
-
let e = await crypto.subtle.digest("SHA-1",
|
|
60049
|
-
return
|
|
60222
|
+
async function be(t) {
|
|
60223
|
+
let e = await crypto.subtle.digest("SHA-1", K(t));
|
|
60224
|
+
return V(e);
|
|
60050
60225
|
}
|
|
60051
|
-
function
|
|
60226
|
+
function j(t) {
|
|
60052
60227
|
return encodeURIComponent(t).replace(/[!'()*]/g, (e) => "%" + e.charCodeAt(0).toString(16).toUpperCase());
|
|
60053
60228
|
}
|
|
60054
|
-
function
|
|
60229
|
+
function I(t) {
|
|
60055
60230
|
try {
|
|
60056
60231
|
return decodeURIComponent(t);
|
|
60057
60232
|
} catch {
|
|
60058
60233
|
return t;
|
|
60059
60234
|
}
|
|
60060
60235
|
}
|
|
60061
|
-
function
|
|
60062
|
-
return t.split("/").map((e) =>
|
|
60236
|
+
function Ee(t) {
|
|
60237
|
+
return t.split("/").map((e) => I(e)).join("/");
|
|
60063
60238
|
}
|
|
60064
|
-
function
|
|
60065
|
-
return
|
|
60239
|
+
function k(t) {
|
|
60240
|
+
return Ee(I(t));
|
|
60066
60241
|
}
|
|
60067
|
-
function
|
|
60068
|
-
return t.split("/").map((e) =>
|
|
60242
|
+
function J(t) {
|
|
60243
|
+
return t.split("/").map((e) => j(I(e))).join("/");
|
|
60069
60244
|
}
|
|
60070
|
-
var
|
|
60071
|
-
function
|
|
60072
|
-
return t === "host" || t === "x-cos-security-token" ? false : !!(
|
|
60245
|
+
var Se = /* @__PURE__ */ new Set(["cache-control", "content-disposition", "content-encoding", "content-length", "content-md5", "content-type", "expect", "expires", "if-match", "if-modified-since", "if-none-match", "if-unmodified-since", "origin", "range", "transfer-encoding"]);
|
|
60246
|
+
function Te(t) {
|
|
60247
|
+
return t === "host" || t === "x-cos-security-token" ? false : !!(Se.has(t) || t.startsWith("x-cos-"));
|
|
60073
60248
|
}
|
|
60074
60249
|
function X(t) {
|
|
60075
60250
|
if (!t)
|
|
60076
60251
|
return [];
|
|
60077
60252
|
let e = [];
|
|
60078
|
-
for (let [
|
|
60079
|
-
|
|
60080
|
-
return e.sort(([
|
|
60253
|
+
for (let [n, r] of Object.entries(t))
|
|
60254
|
+
r != null && e.push([n.toLowerCase(), String(r)]);
|
|
60255
|
+
return e.sort(([n], [r]) => n < r ? -1 : n > r ? 1 : 0), e;
|
|
60081
60256
|
}
|
|
60082
60257
|
function Y(t) {
|
|
60083
|
-
return t.map(([e,
|
|
60258
|
+
return t.map(([e, n]) => \`\${j(e)}=\${j(n)}\`).join("&");
|
|
60084
60259
|
}
|
|
60085
|
-
function
|
|
60086
|
-
return t.map(([e]) =>
|
|
60087
|
-
}
|
|
60088
|
-
async function
|
|
60089
|
-
let e = t.method.toLowerCase(),
|
|
60090
|
-
\${
|
|
60091
|
-
\${
|
|
60092
|
-
\${
|
|
60093
|
-
\`,
|
|
60094
|
-
\${
|
|
60095
|
-
\${await
|
|
60096
|
-
\`,
|
|
60097
|
-
for (let [
|
|
60098
|
-
|
|
60099
|
-
return { authorization:
|
|
60100
|
-
}
|
|
60101
|
-
async function
|
|
60102
|
-
let e = new URL(t.domain),
|
|
60260
|
+
function G2(t) {
|
|
60261
|
+
return t.map(([e]) => j(e)).join(";");
|
|
60262
|
+
}
|
|
60263
|
+
async function Z(t) {
|
|
60264
|
+
let e = t.method.toLowerCase(), n = t.pathname.startsWith("/") ? t.pathname : \`/\${t.pathname}\`, r = Math.floor(Date.now() / 1e3), s = r + (t.expireSeconds ?? 3600), o = \`\${r};\${s}\`, i = X(t.headers).filter(([L]) => Te(L)), d = G2(i), a = Y(i), l = X(t.query), g = G2(l), u = Y(l), f = \`\${e}
|
|
60265
|
+
\${n}
|
|
60266
|
+
\${u}
|
|
60267
|
+
\${a}
|
|
60268
|
+
\`, _ = \`sha1
|
|
60269
|
+
\${o}
|
|
60270
|
+
\${await be(f)}
|
|
60271
|
+
\`, N = await W(t.secretKey, o), de = await W(N, _), le = ["q-sign-algorithm=sha1", \`q-ak=\${t.secretId}\`, \`q-sign-time=\${o}\`, \`q-key-time=\${o}\`, \`q-header-list=\${d}\`, \`q-url-param-list=\${g}\`, \`q-signature=\${de}\`].join("&"), H = {};
|
|
60272
|
+
for (let [L, ue] of i)
|
|
60273
|
+
H[L] = ue;
|
|
60274
|
+
return { authorization: le, signedHeaders: H };
|
|
60275
|
+
}
|
|
60276
|
+
async function Q(t) {
|
|
60277
|
+
let e = new URL(t.domain), n = I(t.key), r = \`/\${k(t.key)}\`, s = \`/\${J(n)}\`;
|
|
60103
60278
|
e.pathname = s;
|
|
60104
|
-
let { authorization:
|
|
60279
|
+
let { authorization: o } = await Z({ method: t.method, pathname: r, query: t.query, headers: t.headers, secretId: t.credential.secretId, secretKey: t.credential.secretKey, expireSeconds: t.expireSeconds });
|
|
60105
60280
|
if (t.query)
|
|
60106
|
-
for (let [
|
|
60107
|
-
|
|
60108
|
-
for (let
|
|
60109
|
-
let
|
|
60110
|
-
if (
|
|
60281
|
+
for (let [c, i] of Object.entries(t.query))
|
|
60282
|
+
i != null && e.searchParams.set(c, String(i));
|
|
60283
|
+
for (let c of o.split("&")) {
|
|
60284
|
+
let i = c.indexOf("=");
|
|
60285
|
+
if (i === -1)
|
|
60111
60286
|
continue;
|
|
60112
|
-
let
|
|
60113
|
-
e.searchParams.set(
|
|
60287
|
+
let d = c.slice(0, i), a = c.slice(i + 1);
|
|
60288
|
+
e.searchParams.set(d, a);
|
|
60114
60289
|
}
|
|
60115
60290
|
return t.credential.sessionToken && e.searchParams.set("x-cos-security-token", t.credential.sessionToken), e.toString();
|
|
60116
60291
|
}
|
|
60117
|
-
async function
|
|
60118
|
-
let e = new URL(t.domain),
|
|
60292
|
+
async function P(t) {
|
|
60293
|
+
let e = new URL(t.domain), n = t.key ? I(t.key) : "", r = t.key ? \`/\${k(t.key)}\` : "/", s = n ? \`/\${J(n)}\` : "/";
|
|
60119
60294
|
if (e.pathname = s, t.query)
|
|
60120
|
-
for (let [
|
|
60121
|
-
|
|
60122
|
-
let { authorization:
|
|
60295
|
+
for (let [g, u] of Object.entries(t.query))
|
|
60296
|
+
u != null && e.searchParams.set(g, String(u));
|
|
60297
|
+
let { authorization: o } = await Z({ method: t.method, pathname: r, query: t.query, headers: t.headers, secretId: t.credential.secretId, secretKey: t.credential.secretKey }), c = new Headers();
|
|
60123
60298
|
if (t.headers)
|
|
60124
|
-
for (let [
|
|
60125
|
-
|
|
60126
|
-
|
|
60127
|
-
let
|
|
60128
|
-
for (let
|
|
60299
|
+
for (let [g, u] of Object.entries(t.headers))
|
|
60300
|
+
u != null && c.set(g, String(u));
|
|
60301
|
+
c.set("Authorization", o), t.credential.sessionToken && c.set("x-cos-security-token", t.credential.sessionToken);
|
|
60302
|
+
let i = e.toString(), d = { method: t.method, headers: c, body: t.body ?? void 0, signal: t.signal }, a = 2, l;
|
|
60303
|
+
for (let g = 0; g <= a; g++)
|
|
60129
60304
|
try {
|
|
60130
|
-
return await fetch(
|
|
60131
|
-
} catch (
|
|
60132
|
-
if (
|
|
60133
|
-
throw
|
|
60134
|
-
|
|
60135
|
-
}
|
|
60136
|
-
throw
|
|
60137
|
-
}
|
|
60138
|
-
var
|
|
60139
|
-
var
|
|
60140
|
-
var
|
|
60305
|
+
return await fetch(i, d);
|
|
60306
|
+
} catch (u) {
|
|
60307
|
+
if (l = u, u instanceof DOMException && u.name === "AbortError")
|
|
60308
|
+
throw u;
|
|
60309
|
+
g < a && await new Promise((f) => setTimeout(f, 1e3 * (g + 1)));
|
|
60310
|
+
}
|
|
60311
|
+
throw l;
|
|
60312
|
+
}
|
|
60313
|
+
var Pe = "blob.edgeone.site";
|
|
60314
|
+
var Ie = "blob-nocache.edgeone.site";
|
|
60315
|
+
var ke = "max-age=0, stale-while-revalidate=60";
|
|
60316
|
+
var D = class t {
|
|
60141
60317
|
credentialManager;
|
|
60142
60318
|
bucket = "";
|
|
60143
60319
|
region = "";
|
|
@@ -60145,17 +60321,17 @@ mime-types/index.js:
|
|
|
60145
60321
|
cachedDomain = "";
|
|
60146
60322
|
uncachedDomain = "";
|
|
60147
60323
|
initialized = false;
|
|
60148
|
-
static buildErrorDetail(e,
|
|
60149
|
-
let
|
|
60150
|
-
return \`\${e} \${
|
|
60324
|
+
static buildErrorDetail(e, n, r, s, o) {
|
|
60325
|
+
let c = r ? \`\${n}/\${r}\` : n, i = o ? \` [request-id: \${o}]\` : "";
|
|
60326
|
+
return \`\${e} \${c} - \${Ae(s)}\${i}\`;
|
|
60151
60327
|
}
|
|
60152
60328
|
constructor(e) {
|
|
60153
60329
|
this.credentialManager = e;
|
|
60154
60330
|
}
|
|
60155
60331
|
computeSubdomain(e) {
|
|
60156
|
-
let
|
|
60157
|
-
if (e.appId &&
|
|
60158
|
-
return
|
|
60332
|
+
let n = [];
|
|
60333
|
+
if (e.appId && n.push(e.appId), e.zoneId && n.push(e.zoneId), e.projectId && n.push(e.projectId), n.length >= 2)
|
|
60334
|
+
return n.join("-");
|
|
60159
60335
|
if (e.resourcePrefix) {
|
|
60160
60336
|
let s = e.resourcePrefix.replace(/\\/?\\*$/, "").split("/").filter(Boolean);
|
|
60161
60337
|
if (s.length >= 2)
|
|
@@ -60168,12 +60344,16 @@ mime-types/index.js:
|
|
|
60168
60344
|
return;
|
|
60169
60345
|
let e = await this.credentialManager.getCredential();
|
|
60170
60346
|
!this.keyPrefix && e.resourcePrefix && (this.keyPrefix = e.resourcePrefix.replace(/\\/?\\*$/, ""));
|
|
60171
|
-
let
|
|
60172
|
-
!this.bucket &&
|
|
60173
|
-
let
|
|
60174
|
-
if (!
|
|
60175
|
-
|
|
60176
|
-
|
|
60347
|
+
let n = e.edgeRegion === "CN", r = e.cosMainland, s = e.cosOverseas, o = n ? r || s : s || r;
|
|
60348
|
+
!this.bucket && o && (this.bucket = o.bucket, this.region = o.region);
|
|
60349
|
+
let { cachedDomain: c, uncachedDomain: i } = e;
|
|
60350
|
+
if (!c || !i) {
|
|
60351
|
+
let d = this.computeSubdomain(e);
|
|
60352
|
+
if (!d)
|
|
60353
|
+
throw new h(0, "unable to derive tenant subdomain from credential; missing appId/zoneId/projectId or resourcePrefix");
|
|
60354
|
+
c || (c = \`https://\${d}.\${Pe}\`), i || (i = \`https://\${d}.\${Ie}\`);
|
|
60355
|
+
}
|
|
60356
|
+
this.cachedDomain = c, this.uncachedDomain = i, this.initialized = true;
|
|
60177
60357
|
}
|
|
60178
60358
|
async resolveDomain(e) {
|
|
60179
60359
|
return await this.ensureInitialized(), e === "strong" ? this.uncachedDomain : this.cachedDomain;
|
|
@@ -60182,127 +60362,158 @@ mime-types/index.js:
|
|
|
60182
60362
|
let e = await this.credentialManager.getCredential();
|
|
60183
60363
|
return { secretId: e.tmpSecretId, secretKey: e.tmpSecretKey, sessionToken: e.sessionToken };
|
|
60184
60364
|
}
|
|
60185
|
-
buildCosKey(e,
|
|
60186
|
-
return \`\${this.keyPrefix}/\${e}/\${
|
|
60365
|
+
buildCosKey(e, n) {
|
|
60366
|
+
return \`\${this.keyPrefix}/\${e}/\${n}\`;
|
|
60187
60367
|
}
|
|
60188
60368
|
async getDomains() {
|
|
60189
60369
|
return await this.ensureInitialized(), { cached: this.cachedDomain, uncached: this.uncachedDomain };
|
|
60190
60370
|
}
|
|
60191
|
-
async putObject(e,
|
|
60192
|
-
let
|
|
60193
|
-
(s == null ? void 0 : s.onlyIfNew) && (
|
|
60371
|
+
async putObject(e, n, r, s) {
|
|
60372
|
+
let o = await this.resolveDomain("strong"), c = await this.ensureWriteAllowed(), i = await this.resolveCredential(), d = this.buildCosKey(e, n), { defaultCacheControl: a = ke } = c, l = (s == null ? void 0 : s.cacheControl) === null ? void 0 : (s == null ? void 0 : s.cacheControl) ?? a, g = {};
|
|
60373
|
+
(s == null ? void 0 : s.onlyIfNew) && (g["x-cos-forbid-overwrite"] = "true"), l && (g["Cache-Control"] = l), (s == null ? void 0 : s.contentType) && (g["Content-Type"] = s.contentType);
|
|
60374
|
+
let u;
|
|
60194
60375
|
try {
|
|
60195
|
-
let
|
|
60196
|
-
if (
|
|
60197
|
-
return await
|
|
60376
|
+
let f = await P({ domain: o, method: "PUT", key: d, headers: g, body: r, credential: i });
|
|
60377
|
+
if ((s == null ? void 0 : s.onlyIfNew) && (f.status === 409 || f.status === 412))
|
|
60378
|
+
return await f.arrayBuffer().catch(() => {
|
|
60198
60379
|
}), { etag: "", statusCode: 412 };
|
|
60199
|
-
if (
|
|
60200
|
-
let
|
|
60201
|
-
|
|
60380
|
+
if (f.ok) {
|
|
60381
|
+
let N = f.headers.get("etag") || "";
|
|
60382
|
+
return await f.arrayBuffer().catch(() => {
|
|
60383
|
+
}), { etag: N, statusCode: f.status };
|
|
60202
60384
|
}
|
|
60203
|
-
let
|
|
60204
|
-
|
|
60205
|
-
|
|
60206
|
-
|
|
60207
|
-
throw l instanceof f ? l : new f(0, t.buildErrorDetail("PUT", i, o, A(l)));
|
|
60385
|
+
let _ = await A(f);
|
|
60386
|
+
u = new h(f.status, t.buildErrorDetail("PUT", o, d, _ || \`status \${f.status}\`, R(f)));
|
|
60387
|
+
} catch (f) {
|
|
60388
|
+
u = new h(0, t.buildErrorDetail("PUT", o, d, v(f)));
|
|
60208
60389
|
}
|
|
60390
|
+
throw await this.explainWriteFailure(u);
|
|
60209
60391
|
}
|
|
60210
|
-
async
|
|
60211
|
-
let
|
|
60212
|
-
(
|
|
60213
|
-
|
|
60214
|
-
|
|
60392
|
+
async ensureWriteAllowed() {
|
|
60393
|
+
let e = await this.credentialManager.getCredential();
|
|
60394
|
+
if (e.writeAllowed !== false)
|
|
60395
|
+
return e;
|
|
60396
|
+
let n = e;
|
|
60397
|
+
try {
|
|
60398
|
+
n = await this.credentialManager.refreshCredential();
|
|
60399
|
+
} catch {
|
|
60400
|
+
}
|
|
60401
|
+
return ee(n), n;
|
|
60215
60402
|
}
|
|
60216
|
-
async
|
|
60217
|
-
|
|
60403
|
+
async explainWriteFailure(e) {
|
|
60404
|
+
if (![0, 403, 550].includes(e.statusCode))
|
|
60405
|
+
return e;
|
|
60218
60406
|
try {
|
|
60219
|
-
let
|
|
60220
|
-
|
|
60221
|
-
|
|
60407
|
+
let n = await this.credentialManager.refreshCredential();
|
|
60408
|
+
ee(n);
|
|
60409
|
+
} catch (n) {
|
|
60410
|
+
if (n instanceof x)
|
|
60411
|
+
return n;
|
|
60412
|
+
}
|
|
60413
|
+
return e;
|
|
60414
|
+
}
|
|
60415
|
+
async createPresignedPutUrl(e, n, r) {
|
|
60416
|
+
let s = await this.resolveDomain("strong");
|
|
60417
|
+
await this.ensureWriteAllowed();
|
|
60418
|
+
let o = await this.resolveCredential(), c = this.buildCosKey(e, n), i = {};
|
|
60419
|
+
(r == null ? void 0 : r.contentType) && (i["Content-Type"] = r.contentType);
|
|
60420
|
+
let d = (r == null ? void 0 : r.expireSeconds) ?? 3600, a = await Q({ domain: s, method: "PUT", key: c, headers: i, credential: o, expireSeconds: d }), l = Math.floor(Date.now() / 1e3) + d;
|
|
60421
|
+
return { url: a, expiresAt: l };
|
|
60422
|
+
}
|
|
60423
|
+
async getObject(e, n, r) {
|
|
60424
|
+
let s = await this.resolveDomain(r), o = await this.resolveCredential(), c = this.buildCosKey(e, n);
|
|
60425
|
+
try {
|
|
60426
|
+
let i = await P({ domain: s, method: "GET", key: c, credential: o });
|
|
60427
|
+
if (i.status === 404)
|
|
60428
|
+
return await i.arrayBuffer().catch(() => {
|
|
60222
60429
|
}), null;
|
|
60223
|
-
if (!
|
|
60224
|
-
let
|
|
60225
|
-
throw new
|
|
60430
|
+
if (!i.ok) {
|
|
60431
|
+
let l = await A(i);
|
|
60432
|
+
throw new h(i.status, t.buildErrorDetail("GET", s, c, l || \`status \${i.status}\`, R(i)));
|
|
60226
60433
|
}
|
|
60227
|
-
let
|
|
60228
|
-
return { body:
|
|
60229
|
-
} catch (
|
|
60230
|
-
throw
|
|
60434
|
+
let d = new Uint8Array(await i.arrayBuffer()), a = te(i.headers);
|
|
60435
|
+
return { body: d, contentType: a["content-type"], headers: a };
|
|
60436
|
+
} catch (i) {
|
|
60437
|
+
throw i instanceof h ? i : new h(0, t.buildErrorDetail("GET", s, c, v(i)));
|
|
60231
60438
|
}
|
|
60232
60439
|
}
|
|
60233
|
-
async headObject(e,
|
|
60234
|
-
let s = await this.resolveDomain(
|
|
60440
|
+
async headObject(e, n, r) {
|
|
60441
|
+
let s = await this.resolveDomain(r), o = await this.resolveCredential(), c = this.buildCosKey(e, n);
|
|
60235
60442
|
try {
|
|
60236
|
-
let
|
|
60237
|
-
if (
|
|
60443
|
+
let i = await P({ domain: s, method: "HEAD", key: c, credential: o });
|
|
60444
|
+
if (i.status === 404)
|
|
60238
60445
|
return null;
|
|
60239
|
-
if (!
|
|
60240
|
-
let
|
|
60241
|
-
throw new
|
|
60446
|
+
if (!i.ok) {
|
|
60447
|
+
let a = await A(i);
|
|
60448
|
+
throw new h(i.status, t.buildErrorDetail("HEAD", s, c, a || \`status \${i.status}\`, R(i)));
|
|
60242
60449
|
}
|
|
60243
|
-
let
|
|
60244
|
-
return { cacheControl:
|
|
60245
|
-
} catch (
|
|
60246
|
-
throw
|
|
60450
|
+
let d = te(i.headers);
|
|
60451
|
+
return { cacheControl: d["cache-control"], contentType: d["content-type"], etag: d.etag, headers: d };
|
|
60452
|
+
} catch (i) {
|
|
60453
|
+
throw i instanceof h ? i : new h(0, t.buildErrorDetail("HEAD", s, c, v(i)));
|
|
60247
60454
|
}
|
|
60248
60455
|
}
|
|
60249
|
-
async deleteObject(e,
|
|
60250
|
-
let
|
|
60456
|
+
async deleteObject(e, n) {
|
|
60457
|
+
let r = await this.resolveDomain("strong"), s = await this.resolveCredential(), o = this.buildCosKey(e, n);
|
|
60251
60458
|
try {
|
|
60252
|
-
let
|
|
60253
|
-
if (
|
|
60254
|
-
await
|
|
60459
|
+
let c = await P({ domain: r, method: "DELETE", key: o, credential: s });
|
|
60460
|
+
if (c.status === 204 || c.status === 404 || c.ok) {
|
|
60461
|
+
await c.arrayBuffer().catch(() => {
|
|
60255
60462
|
});
|
|
60256
60463
|
return;
|
|
60257
60464
|
}
|
|
60258
|
-
let
|
|
60259
|
-
throw new
|
|
60260
|
-
} catch (
|
|
60261
|
-
throw
|
|
60465
|
+
let i = await A(c);
|
|
60466
|
+
throw new h(c.status, t.buildErrorDetail("DELETE", r, o, i || \`status \${c.status}\`, R(c)));
|
|
60467
|
+
} catch (c) {
|
|
60468
|
+
throw c instanceof h ? c : new h(0, t.buildErrorDetail("DELETE", r, o, v(c)));
|
|
60262
60469
|
}
|
|
60263
60470
|
}
|
|
60264
|
-
async listObjects(e,
|
|
60471
|
+
async listObjects(e, n) {
|
|
60265
60472
|
await this.ensureInitialized();
|
|
60266
|
-
let
|
|
60267
|
-
let
|
|
60268
|
-
return
|
|
60269
|
-
}).filter((
|
|
60270
|
-
return { contents:
|
|
60473
|
+
let r = \`\${this.keyPrefix}/\${e}/\`, s = (n == null ? void 0 : n.prefix) ? r + n.prefix : r, o = await this.getBucketRaw({ prefix: s, delimiter: n == null ? void 0 : n.delimiter, marker: n == null ? void 0 : n.marker, maxKeys: n == null ? void 0 : n.maxKeys, consistency: n == null ? void 0 : n.consistency }), c = o.contents.map((d) => {
|
|
60474
|
+
let a = d.key, l = a.startsWith(r) ? a.slice(r.length) : a;
|
|
60475
|
+
return l ? { key: l, etag: d.etag } : null;
|
|
60476
|
+
}).filter((d) => d !== null), i = o.commonPrefixes.map((d) => d.startsWith(r) ? d.slice(r.length) : d).filter((d) => !!d);
|
|
60477
|
+
return { contents: c, commonPrefixes: i, isTruncated: o.isTruncated, nextMarker: o.nextMarker };
|
|
60271
60478
|
}
|
|
60272
60479
|
async listStores(e) {
|
|
60273
|
-
let
|
|
60480
|
+
let n = [], r = "", s = true;
|
|
60274
60481
|
for (; s; ) {
|
|
60275
60482
|
await this.ensureInitialized();
|
|
60276
|
-
let
|
|
60277
|
-
for (let
|
|
60278
|
-
let
|
|
60279
|
-
|
|
60483
|
+
let o = \`\${this.keyPrefix}/\`, c = await this.getBucketRaw({ prefix: o, delimiter: "/", maxKeys: 1e3, marker: r || void 0, consistency: e });
|
|
60484
|
+
for (let i of c.commonPrefixes) {
|
|
60485
|
+
let d = i.startsWith(o) ? i.slice(o.length, -1) : i.slice(0, -1);
|
|
60486
|
+
d && n.push(d);
|
|
60280
60487
|
}
|
|
60281
|
-
if (s =
|
|
60488
|
+
if (s = c.isTruncated, r = c.nextMarker, !s || !r)
|
|
60282
60489
|
break;
|
|
60283
60490
|
}
|
|
60284
|
-
return
|
|
60491
|
+
return n;
|
|
60285
60492
|
}
|
|
60286
60493
|
async getBucketRaw(e) {
|
|
60287
|
-
let
|
|
60288
|
-
e.delimiter && (s.delimiter = e.delimiter), e.marker && (s.marker =
|
|
60494
|
+
let n = await this.resolveDomain(e.consistency), r = await this.resolveCredential(), s = { prefix: k(e.prefix) };
|
|
60495
|
+
e.delimiter && (s.delimiter = e.delimiter), e.marker && (s.marker = k(e.marker)), e.maxKeys && (s["max-keys"] = e.maxKeys);
|
|
60289
60496
|
try {
|
|
60290
|
-
let
|
|
60291
|
-
if (!
|
|
60292
|
-
let
|
|
60293
|
-
throw new
|
|
60497
|
+
let o = await P({ domain: n, method: "GET", query: s, credential: r });
|
|
60498
|
+
if (!o.ok) {
|
|
60499
|
+
let i = await A(o);
|
|
60500
|
+
throw new h(o.status, t.buildErrorDetail("LIST", n, e.prefix, i || \`status \${o.status}\`, R(o)));
|
|
60294
60501
|
}
|
|
60295
|
-
let
|
|
60296
|
-
return
|
|
60297
|
-
} catch (
|
|
60298
|
-
throw
|
|
60502
|
+
let c = await o.text();
|
|
60503
|
+
return Re(c);
|
|
60504
|
+
} catch (o) {
|
|
60505
|
+
throw o instanceof h ? o : new h(0, t.buildErrorDetail("LIST", n, e.prefix, v(o)));
|
|
60299
60506
|
}
|
|
60300
60507
|
}
|
|
60301
60508
|
};
|
|
60302
|
-
function
|
|
60509
|
+
function ee(t) {
|
|
60510
|
+
if (t.writeAllowed === false)
|
|
60511
|
+
throw new x({ reason: t.writeDeniedReason, overMetrics: t.overMetrics });
|
|
60512
|
+
}
|
|
60513
|
+
function Ae(t) {
|
|
60303
60514
|
return t.replace(/[a-zA-Z0-9\\-]+\\.cos\\.[a-zA-Z0-9\\-.]+\\.myqcloud\\.com/gi, "[cos-origin]").replace(/[a-zA-Z0-9\\-]+\\.cos\\.[a-zA-Z0-9\\-.]+\\.tencentcos\\.cn/gi, "[cos-origin]");
|
|
60304
60515
|
}
|
|
60305
|
-
async function
|
|
60516
|
+
async function A(t) {
|
|
60306
60517
|
try {
|
|
60307
60518
|
return await t.text();
|
|
60308
60519
|
} catch {
|
|
@@ -60312,87 +60523,89 @@ mime-types/index.js:
|
|
|
60312
60523
|
function R(t) {
|
|
60313
60524
|
return t.headers.get("x-cos-request-id") || t.headers.get("x-eo-log-id") || void 0;
|
|
60314
60525
|
}
|
|
60315
|
-
function
|
|
60316
|
-
let e = t,
|
|
60317
|
-
if (
|
|
60318
|
-
let s =
|
|
60319
|
-
return s ? \`\${
|
|
60526
|
+
function v(t) {
|
|
60527
|
+
let e = t, n = e.message || String(t), r = e.cause;
|
|
60528
|
+
if (r) {
|
|
60529
|
+
let s = r.message || r.code || "";
|
|
60530
|
+
return s ? \`\${n} (\${s})\` : n;
|
|
60320
60531
|
}
|
|
60321
|
-
return
|
|
60532
|
+
return n;
|
|
60322
60533
|
}
|
|
60323
|
-
function
|
|
60534
|
+
function te(t) {
|
|
60324
60535
|
let e = {};
|
|
60325
|
-
return t.forEach((
|
|
60326
|
-
e[
|
|
60536
|
+
return t.forEach((n, r) => {
|
|
60537
|
+
e[r.toLowerCase()] = n;
|
|
60327
60538
|
}), e;
|
|
60328
60539
|
}
|
|
60329
|
-
function
|
|
60330
|
-
let e = [],
|
|
60331
|
-
for (; (
|
|
60332
|
-
let
|
|
60333
|
-
|
|
60540
|
+
function Re(t) {
|
|
60541
|
+
let e = [], n = /<Contents>([\\s\\S]*?)<\\/Contents>/g, r;
|
|
60542
|
+
for (; (r = n.exec(t)) !== null; ) {
|
|
60543
|
+
let a = r[1], l = M(a, "Key"), g = M(a, "ETag");
|
|
60544
|
+
l !== null && e.push({ key: q(l), etag: g || "" });
|
|
60334
60545
|
}
|
|
60335
|
-
let s = [],
|
|
60336
|
-
for (; (
|
|
60337
|
-
let
|
|
60338
|
-
|
|
60546
|
+
let s = [], o = /<CommonPrefixes>([\\s\\S]*?)<\\/CommonPrefixes>/g;
|
|
60547
|
+
for (; (r = o.exec(t)) !== null; ) {
|
|
60548
|
+
let a = r[1], l = M(a, "Prefix");
|
|
60549
|
+
l !== null && s.push(q(l));
|
|
60339
60550
|
}
|
|
60340
|
-
let
|
|
60341
|
-
return { contents: e, commonPrefixes: s, isTruncated:
|
|
60551
|
+
let i = M(t, "IsTruncated") === "true", d = M(t, "NextMarker") || "";
|
|
60552
|
+
return { contents: e, commonPrefixes: s, isTruncated: i, nextMarker: q(d) };
|
|
60342
60553
|
}
|
|
60343
|
-
function
|
|
60344
|
-
let
|
|
60345
|
-
return
|
|
60554
|
+
function M(t, e) {
|
|
60555
|
+
let r = new RegExp(\`<\${e}>([\\\\s\\\\S]*?)<\\\\/\${e}>\`).exec(t);
|
|
60556
|
+
return r ? r[1] : null;
|
|
60346
60557
|
}
|
|
60347
|
-
function
|
|
60558
|
+
function q(t) {
|
|
60348
60559
|
return t.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
60349
60560
|
}
|
|
60350
|
-
var
|
|
60351
|
-
async function
|
|
60561
|
+
var ve = "X-RateLimit-Reset";
|
|
60562
|
+
async function $(t, e, n = 2) {
|
|
60352
60563
|
var _a3, _b;
|
|
60353
60564
|
(_b = (_a3 = e.signal) == null ? void 0 : _a3.throwIfAborted) == null ? void 0 : _b.call(_a3);
|
|
60354
60565
|
try {
|
|
60355
|
-
let
|
|
60356
|
-
if (
|
|
60357
|
-
let s =
|
|
60358
|
-
return await
|
|
60566
|
+
let r = await fetch(t, e);
|
|
60567
|
+
if (n > 0 && (r.status === 429 || r.status >= 500)) {
|
|
60568
|
+
let s = ne(r.headers.get(ve));
|
|
60569
|
+
return await re(s, e.signal), $(t, e, n - 1);
|
|
60359
60570
|
}
|
|
60360
|
-
return
|
|
60361
|
-
} catch (
|
|
60362
|
-
if (
|
|
60363
|
-
throw
|
|
60364
|
-
let s =
|
|
60365
|
-
return await
|
|
60571
|
+
return r;
|
|
60572
|
+
} catch (r) {
|
|
60573
|
+
if (n === 0 || r instanceof DOMException && r.name === "AbortError")
|
|
60574
|
+
throw r;
|
|
60575
|
+
let s = ne();
|
|
60576
|
+
return await re(s, e.signal), $(t, e, n - 1);
|
|
60366
60577
|
}
|
|
60367
60578
|
}
|
|
60368
|
-
function
|
|
60579
|
+
function ne(t) {
|
|
60369
60580
|
return t ? Math.max(Number(t) * 1e3 - Date.now(), 500) : 1500;
|
|
60370
60581
|
}
|
|
60371
|
-
function
|
|
60372
|
-
return new Promise((
|
|
60582
|
+
function re(t, e) {
|
|
60583
|
+
return new Promise((n, r) => {
|
|
60373
60584
|
if (e == null ? void 0 : e.aborted)
|
|
60374
|
-
return
|
|
60585
|
+
return r(e.reason);
|
|
60375
60586
|
let s = setTimeout(() => {
|
|
60376
|
-
e == null ? void 0 : e.removeEventListener("abort",
|
|
60377
|
-
}, t),
|
|
60378
|
-
clearTimeout(s),
|
|
60587
|
+
e == null ? void 0 : e.removeEventListener("abort", o), n();
|
|
60588
|
+
}, t), o = () => {
|
|
60589
|
+
clearTimeout(s), r(e.reason);
|
|
60379
60590
|
};
|
|
60380
|
-
e == null ? void 0 : e.addEventListener("abort",
|
|
60591
|
+
e == null ? void 0 : e.addEventListener("abort", o, { once: true });
|
|
60381
60592
|
});
|
|
60382
60593
|
}
|
|
60383
|
-
var
|
|
60384
|
-
function
|
|
60594
|
+
var Me = "prod";
|
|
60595
|
+
function se() {
|
|
60385
60596
|
let t = typeof process < "u" ? process.env.PAGES_BLOB_STS_ENV : void 0;
|
|
60386
|
-
return t === "test" || t === "prod" ? t :
|
|
60597
|
+
return t === "test" || t === "prod" ? t : Me;
|
|
60387
60598
|
}
|
|
60388
|
-
var
|
|
60389
|
-
var
|
|
60390
|
-
var
|
|
60599
|
+
var De = 300;
|
|
60600
|
+
var Oe = 6e4;
|
|
60601
|
+
var Be = "https://blob-sts.edgeone.site/";
|
|
60602
|
+
var O = class {
|
|
60391
60603
|
authToken;
|
|
60392
60604
|
projectId;
|
|
60393
60605
|
cached = null;
|
|
60394
|
-
|
|
60395
|
-
|
|
60606
|
+
lastForcedRefreshAt = 0;
|
|
60607
|
+
constructor(e, n) {
|
|
60608
|
+
this.authToken = e, this.projectId = n;
|
|
60396
60609
|
}
|
|
60397
60610
|
async getCredential() {
|
|
60398
60611
|
if (this.cached && !this.isExpired(this.cached))
|
|
@@ -60400,108 +60613,122 @@ mime-types/index.js:
|
|
|
60400
60613
|
let e = await this.fetchCredential();
|
|
60401
60614
|
return this.cached = e, e;
|
|
60402
60615
|
}
|
|
60616
|
+
async refreshCredential() {
|
|
60617
|
+
if (this.cached && Date.now() - this.lastForcedRefreshAt < Oe)
|
|
60618
|
+
return this.cached;
|
|
60619
|
+
this.lastForcedRefreshAt = Date.now();
|
|
60620
|
+
let e = await this.fetchCredential(true);
|
|
60621
|
+
return this.cached = e, e;
|
|
60622
|
+
}
|
|
60403
60623
|
clearCache() {
|
|
60404
60624
|
this.cached = null;
|
|
60405
60625
|
}
|
|
60406
60626
|
isExpired(e) {
|
|
60407
|
-
let
|
|
60408
|
-
return e.expiredTime -
|
|
60627
|
+
let n = Math.floor(Date.now() / 1e3);
|
|
60628
|
+
return e.expiredTime - n < De;
|
|
60409
60629
|
}
|
|
60410
|
-
async fetchCredential() {
|
|
60411
|
-
for (let
|
|
60412
|
-
let
|
|
60630
|
+
async fetchCredential(e = false) {
|
|
60631
|
+
for (let s = 1; s <= 3; s++) {
|
|
60632
|
+
let o = new AbortController(), c = setTimeout(() => o.abort(), 1e4), i;
|
|
60413
60633
|
try {
|
|
60414
|
-
|
|
60415
|
-
} catch (
|
|
60416
|
-
if (
|
|
60417
|
-
await
|
|
60634
|
+
i = await $(Be, { method: "POST", headers: { "Content-Type": "application/json", Authorization: \`Bearer \${this.authToken}\`, "X-Env": se(), ...e ? { "X-SKIP-CACHE": "true" } : {} }, body: JSON.stringify(this.projectId ? { ProjectId: this.projectId } : {}), signal: o.signal });
|
|
60635
|
+
} catch (l) {
|
|
60636
|
+
if (s < 3) {
|
|
60637
|
+
await z2(500 * s);
|
|
60418
60638
|
continue;
|
|
60419
60639
|
}
|
|
60420
|
-
throw new
|
|
60640
|
+
throw new y(\`failed to obtain STS credential: \${l.message || "timeout"}\`);
|
|
60421
60641
|
} finally {
|
|
60422
|
-
clearTimeout(
|
|
60642
|
+
clearTimeout(c);
|
|
60423
60643
|
}
|
|
60424
|
-
if (
|
|
60425
|
-
throw new
|
|
60426
|
-
if (
|
|
60427
|
-
throw new
|
|
60428
|
-
if (!
|
|
60429
|
-
if (
|
|
60430
|
-
await
|
|
60644
|
+
if (i.status === 413)
|
|
60645
|
+
throw new y("storage quota exceeded");
|
|
60646
|
+
if (i.status === 429)
|
|
60647
|
+
throw new y("rate limited, please retry later");
|
|
60648
|
+
if (!i.ok) {
|
|
60649
|
+
if (i.status >= 500 && s < 3) {
|
|
60650
|
+
await z2(500 * s);
|
|
60431
60651
|
continue;
|
|
60432
60652
|
}
|
|
60433
|
-
let
|
|
60434
|
-
throw new
|
|
60653
|
+
let l = await i.text().catch(() => "unknown error");
|
|
60654
|
+
throw new y(\`failed to obtain STS credential: \${i.status} \${l}\`);
|
|
60435
60655
|
}
|
|
60436
|
-
let
|
|
60437
|
-
if (
|
|
60438
|
-
let
|
|
60439
|
-
return { tmpSecretId:
|
|
60656
|
+
let d = await i.json(), a = d.data && typeof d.data == "object" ? d.data : d;
|
|
60657
|
+
if (a.tmpSecretId && a.tmpSecretKey && a.sessionToken && a.expiredTime) {
|
|
60658
|
+
let l = a.cosMainland, g = a.cosOverseas, u = i.headers.get("X-Edge-Region") || void 0;
|
|
60659
|
+
return { tmpSecretId: a.tmpSecretId, tmpSecretKey: a.tmpSecretKey, sessionToken: a.sessionToken, expiredTime: a.expiredTime, appId: a.appId || void 0, zoneId: a.zoneId || void 0, projectId: a.projectId || void 0, resourcePrefix: a.resourcePrefix || void 0, cosMainland: l || void 0, cosOverseas: g || void 0, edgeRegion: u, defaultCacheControl: typeof a.defaultCacheControl == "string" && a.defaultCacheControl ? a.defaultCacheControl : void 0, cachedDomain: ie(a.cachedDomain), uncachedDomain: ie(a.uncachedDomain), writeAllowed: typeof a.writeAllowed == "boolean" ? a.writeAllowed : void 0, writeDeniedReason: typeof a.writeDeniedReason == "string" && a.writeDeniedReason ? a.writeDeniedReason : void 0, overMetrics: Array.isArray(a.overMetrics) ? a.overMetrics.filter((f) => typeof f == "string") : void 0 };
|
|
60440
60660
|
}
|
|
60441
|
-
if (
|
|
60442
|
-
let
|
|
60443
|
-
throw new
|
|
60661
|
+
if (a.code !== void 0 && a.code !== 0) {
|
|
60662
|
+
let l = a.msg || a.message || "unknown error";
|
|
60663
|
+
throw new y(\`credential exchange failed (code=\${a.code}): \${l}\`);
|
|
60444
60664
|
}
|
|
60445
|
-
if (
|
|
60446
|
-
let
|
|
60447
|
-
throw new
|
|
60665
|
+
if (d.code !== void 0 && d.code !== 0) {
|
|
60666
|
+
let l = d.msg || d.message || "unknown error";
|
|
60667
|
+
throw new y(\`credential exchange failed (code=\${d.code}): \${l}\`);
|
|
60448
60668
|
}
|
|
60449
|
-
if (
|
|
60450
|
-
await
|
|
60669
|
+
if (s < 3) {
|
|
60670
|
+
await z2(500 * s);
|
|
60451
60671
|
continue;
|
|
60452
60672
|
}
|
|
60453
|
-
throw new
|
|
60673
|
+
throw new y("invalid STS credential response");
|
|
60454
60674
|
}
|
|
60455
|
-
throw new
|
|
60675
|
+
throw new y("invalid STS credential response");
|
|
60456
60676
|
}
|
|
60457
60677
|
};
|
|
60458
|
-
function
|
|
60678
|
+
function ie(t) {
|
|
60679
|
+
if (typeof t != "string")
|
|
60680
|
+
return;
|
|
60681
|
+
let e = t.trim().replace(/\\/+$/, "");
|
|
60682
|
+
if (e)
|
|
60683
|
+
return /^https?:\\/\\//i.test(e) ? e : \`https://\${e}\`;
|
|
60684
|
+
}
|
|
60685
|
+
function z2(t) {
|
|
60459
60686
|
return new Promise((e) => setTimeout(e, t));
|
|
60460
60687
|
}
|
|
60461
|
-
var
|
|
60462
|
-
function
|
|
60463
|
-
let t = {}, e =
|
|
60688
|
+
var je = "{{PAGES_BLOB_DEPLOY_CREDENTIAL}}";
|
|
60689
|
+
function ae() {
|
|
60690
|
+
let t = {}, e = $e();
|
|
60464
60691
|
if (e)
|
|
60465
60692
|
t.deployCredential = e;
|
|
60466
60693
|
else {
|
|
60467
|
-
let
|
|
60468
|
-
|
|
60694
|
+
let r = oe("PAGES_BLOB_DEPLOY_CREDENTIAL");
|
|
60695
|
+
r && (t.deployCredential = r);
|
|
60469
60696
|
}
|
|
60470
|
-
let
|
|
60471
|
-
return
|
|
60697
|
+
let n = oe("PAGES_PROJECT_ID");
|
|
60698
|
+
return n && (t.projectId = n), t;
|
|
60472
60699
|
}
|
|
60473
|
-
function
|
|
60474
|
-
let t =
|
|
60700
|
+
function $e() {
|
|
60701
|
+
let t = je;
|
|
60475
60702
|
if (!(t.startsWith("{{") && t.endsWith("}}")))
|
|
60476
60703
|
return t || void 0;
|
|
60477
60704
|
}
|
|
60478
|
-
function
|
|
60705
|
+
function oe(t) {
|
|
60479
60706
|
if (typeof process < "u" && process.env)
|
|
60480
60707
|
return process.env[t];
|
|
60481
60708
|
}
|
|
60482
|
-
function
|
|
60709
|
+
function _e(t) {
|
|
60483
60710
|
let e = typeof t == "string" ? t : t.name;
|
|
60484
|
-
|
|
60485
|
-
let
|
|
60486
|
-
return new
|
|
60711
|
+
F(e);
|
|
60712
|
+
let n = ce(typeof t == "string" ? void 0 : t), r = new O(n.authToken, n.projectId), s = new D(r);
|
|
60713
|
+
return new T(s, e, n.consistency ?? "eventual");
|
|
60487
60714
|
}
|
|
60488
|
-
async function
|
|
60489
|
-
let e =
|
|
60490
|
-
return { stores: (await new
|
|
60715
|
+
async function Ne(t) {
|
|
60716
|
+
let e = ce(t ? { name: "__list__", projectId: t.projectId, token: t.token, consistency: t.consistency } : void 0), n = new O(e.authToken, e.projectId);
|
|
60717
|
+
return { stores: (await new D(n).listStores(e.consistency)).map((o) => ({ name: o })) };
|
|
60491
60718
|
}
|
|
60492
|
-
function
|
|
60493
|
-
let e =
|
|
60719
|
+
function ce(t) {
|
|
60720
|
+
let e = ae(), n = (t == null ? void 0 : t.token) || e.deployCredential, r = (t == null ? void 0 : t.projectId) || e.projectId;
|
|
60494
60721
|
if ((t == null ? void 0 : t.token) || e.projectId) {
|
|
60495
|
-
if (!n)
|
|
60496
|
-
throw new T();
|
|
60497
60722
|
if (!r)
|
|
60498
|
-
throw new
|
|
60499
|
-
|
|
60723
|
+
throw new S();
|
|
60724
|
+
if (!n)
|
|
60725
|
+
throw new E(["token"]);
|
|
60726
|
+
return { authToken: n, projectId: r, consistency: t == null ? void 0 : t.consistency };
|
|
60500
60727
|
}
|
|
60501
|
-
if ((t == null ? void 0 : t.projectId) && !
|
|
60502
|
-
throw new
|
|
60728
|
+
if ((t == null ? void 0 : t.projectId) && !n)
|
|
60729
|
+
throw new E(["token"]);
|
|
60503
60730
|
if (!e.deployCredential)
|
|
60504
|
-
throw new
|
|
60731
|
+
throw new E(["deployCredential"]);
|
|
60505
60732
|
return { authToken: e.deployCredential, consistency: t == null ? void 0 : t.consistency };
|
|
60506
60733
|
}
|
|
60507
60734
|
}
|
|
@@ -103729,7 +103956,7 @@ mime-types/index.js:
|
|
|
103729
103956
|
* MIT Licensed
|
|
103730
103957
|
*)
|
|
103731
103958
|
*/
|
|
103732
|
-
`,typeof t=="string"&&t)return t;let r=[...e.externalizePagesBlob?[fW]:[],...e.externalizeToolkit?[dW]:[]];return ABt(r)}var Ha,Mo,kF,bEe,lW,EEe,Jw,Pd,H8t,z8t,W8t,G8t,K8t,yEe,fW,dW,Yw,Y8t,hW,A1,J8t,wEe,TEe,mW,X8t,pW,vEe,Z8t,Q8t,eBt,PEe,IF,DEe=_t(()=>{Ha=nr(require("fs")),Mo=nr(require("path")),kF=nr(require("esbuild")),bEe=require("crypto"),lW=require("module"),EEe=nr(Py()),Jw=nr(Ki());Zbe();tEe();eW();Wb();lh();uu();r6();VV();nEe();iR();S7();tW();iW();t7();yS();oW();zE();oO();$V();pEe();dEe();aW();DF();DF();Pd=Mo.default.resolve(process.cwd(),".edgeone/agent-node"),H8t=Mo.default.join(Pd,"index.mjs"),z8t=Mo.default.join(Pd,"server.mjs"),W8t=Mo.default.join(Pd,"launcher.js"),G8t=Mo.default.join(Pd,"config.json"),K8t=Mo.default.join(Pd,"package.json"),yEe=new Set([...lW.builtinModules,...lW.builtinModules.map(e=>`node:${e}`)]),fW="@edgeone/pages-blob",dW="@edgeone/pages-agent-toolkit",Yw="@e2b/code-interpreter",Y8t="e2b",hW="undici",A1="@anthropic-ai/claude-agent-sdk",J8t="@anthropic-ai/claude-agent-sdk-",wEe="@modelcontextprotocol/sdk",TEe="zod",mW={[fW]:"0.0.
|
|
103959
|
+
`,typeof t=="string"&&t)return t;let r=[...e.externalizePagesBlob?[fW]:[],...e.externalizeToolkit?[dW]:[]];return ABt(r)}var Ha,Mo,kF,bEe,lW,EEe,Jw,Pd,H8t,z8t,W8t,G8t,K8t,yEe,fW,dW,Yw,Y8t,hW,A1,J8t,wEe,TEe,mW,X8t,pW,vEe,Z8t,Q8t,eBt,PEe,IF,DEe=_t(()=>{Ha=nr(require("fs")),Mo=nr(require("path")),kF=nr(require("esbuild")),bEe=require("crypto"),lW=require("module"),EEe=nr(Py()),Jw=nr(Ki());Zbe();tEe();eW();Wb();lh();uu();r6();VV();nEe();iR();S7();tW();iW();t7();yS();oW();zE();oO();$V();pEe();dEe();aW();DF();DF();Pd=Mo.default.resolve(process.cwd(),".edgeone/agent-node"),H8t=Mo.default.join(Pd,"index.mjs"),z8t=Mo.default.join(Pd,"server.mjs"),W8t=Mo.default.join(Pd,"launcher.js"),G8t=Mo.default.join(Pd,"config.json"),K8t=Mo.default.join(Pd,"package.json"),yEe=new Set([...lW.builtinModules,...lW.builtinModules.map(e=>`node:${e}`)]),fW="@edgeone/pages-blob",dW="@edgeone/pages-agent-toolkit",Yw="@e2b/code-interpreter",Y8t="e2b",hW="undici",A1="@anthropic-ai/claude-agent-sdk",J8t="@anthropic-ai/claude-agent-sdk-",wEe="@modelcontextprotocol/sdk",TEe="zod",mW={[fW]:"0.0.19",[dW]:"0.1.38",[Yw]:"2.4.2",[wEe]:"1.29.0",[TEe]:"3.25.76",[hW]:"7.29.0"},X8t={[Yw]:"2.4.2",[Y8t]:"2.19.5"},pW=new Set([hW]),vEe=e=>{C1(e,"agent-node-deduplicated")},Z8t=["deepagents",A1],Q8t=`
|
|
103733
103960
|
import { createRequire as __edgeoneCreateRequire } from 'module';
|
|
103734
103961
|
const require = __edgeoneCreateRequire(import.meta.url);
|
|
103735
103962
|
`,eBt="onRequest",PEe=sO.map(e=>({method:e.method.toUpperCase(),funcName:e.funcName}));IF=class{mode;env;externalNodeModules=[];framework;sandbox={};timeoutSeconds;memoryQuota={};enableDevBlobTokenProjectStore=!1;devBlobAuth={};wrapPort=9e3;routes=[];routeRecordsByUnit=new Map;agentsDir;constructor(t={}){this.mode=t.mode||"prod",this.env=t.env||{},this.externalNodeModules=[...new Set(t.externalNodeModules||[])],this.framework=t.framework,this.sandbox=t.sandbox||{},this.timeoutSeconds=t.timeoutSeconds,this.memoryQuota=t.memoryQuota||{},this.enableDevBlobTokenProjectStore=!!t.enableDevBlobTokenProjectStore,this.devBlobAuth=t.devBlobAuth||{},this.agentsDir=Pf().absolutePath,this.initializeEnvironment(t)}initializeEnvironment(t){if(!t.env)try{let r=Tn("./.env");Ha.default.existsSync(r)||(r=Tn("./.env.local"));let s=mx(r);delete s.TENCENT_SECRET_ID,delete s.TENCENT_SECRET_KEY,this.env=s}catch{this.env={}}}static async decide(){return AEe(Pf().absolutePath)}getRoutes(){return this.routes}async processExternalModulesConfig(){var t;try{let r=await Sx();if(!r)return;let s=e7(r),a=s.externalNodeModules;if(this.framework=s.framework||this.framework,this.sandbox=s.sandbox||this.sandbox,this.timeoutSeconds=(t=s.timeout)!=null?t:this.timeoutSeconds,this.memoryQuota=s.memoryQuota||this.memoryQuota,a.length===0)return;this.externalNodeModules=[...new Set([...this.externalNodeModules,...a])],ur(`[agent-node] Configured ${a.length} externalNodeModules`)}catch(r){Qi(`[agent-node] Failed to process external modules config: ${r.message}`)}}async processIncludedFilesConfig(){try{let t=await Sx();if(!t)return;let r=e7(t).includeFiles;if(r.length===0)return;let s=await $N(r,process.cwd(),Pd,"included_files");s>0&&ur(`[agent-node] Processed ${s} includeFiles entries`)}catch(t){Qi(`[agent-node] Failed to process includeFiles: ${t.message}`)}}async rebuildFunction(t){let r=cW({agentsDir:this.agentsDir,currentRecordsByUnit:this.routeRecordsByUnit,changedFilePath:t});r.strategy==="incremental"?ur(`[agent-node] Incremental rebuild: ${r.unitName}`):ur(`[agent-node] Full rebuild: ${t}`),this.routeRecordsByUnit=r.nextRecordsByUnit,await this.buildWithRouteEntries(r.routeEntries,r.warnings)}async buildWithRouteEntries(t,r=[]){if(t.length===0)return r.forEach(De=>Qi(`[agent-node] ${De}`)),this.routes=[],{logicText:"",bundleText:"",cssText:"",routes:[]};let s=wBt(t);if([...r,...s.warnings].forEach(De=>Qi(`[agent-node] ${De}`)),s.routes.length===0)return this.routes=[],{logicText:"",bundleText:"",cssText:"",routes:[]};let n=this.externalNodeModules.includes(fW),c=this.externalNodeModules.includes(dW),p=AF(s.routes);p.warnings.forEach(De=>Qi(`[agent-node] [mcp] ${De}`));let d=p.tools.length>0,h=DBt({externalizePagesBlob:n,externalizeToolkit:c}),y=TBt(s.routes,h,this.wrapPort,this.env,{enableDevBlobTokenProjectStore:this.enableDevBlobTokenProjectStore,devBlobAuth:this.devBlobAuth,timeoutSeconds:this.timeoutSeconds,memoryQuota:this.memoryQuota,framework:this.framework,sandbox:this.sandbox,mode:this.mode,mcp:{tools:p.tools}});TF(Pd,["node_modules"],"agent-node-generated");let w=Qbe(this.agentsDir),P=Wbe(w);P.entries.length>0&&ur(`[agent-node] Observability: ${P.entries.map(De=>De.name).join(", ")}`);let O=gBt(process.cwd()),x=d?[wEe,TEe]:[],$=[...new Set([...Z8t,...this.externalNodeModules,...O,...P.requiredExternals,...x])],q=await kF.default.build({stdin:{contents:y,loader:"ts",resolveDir:process.cwd()},outfile:z8t,bundle:!0,format:"esm",platform:"node",target:"node14",sourcemap:!1,minify:!1,logLevel:"silent",banner:{js:Q8t},external:$,metafile:!0}),F=nBt(q.metafile),Y=sBt(this.mode,this.sandbox,c),se=new Set([...F,...this.externalNodeModules,...O,...Y]);wF({outputDir:Pd,dependencyDirName:"node_modules",namespace:"agent-node",cacheKey:tBt(this.mode,se,P.requiredDeps)});let ne=Zz(P,{skipOtelCore:this.mode==="prod"});Xbe(Pd,P,{skipOtelCore:this.mode==="prod",removeDir:vEe}),Kbe(Pd,`// src/agent/observability/node/setup.ts
|
|
@@ -104550,7 +104777,7 @@ export {
|
|
|
104550
104777
|
`+te.slice(et,Tt),et=Tt+1),st=$t;return vr+=`
|
|
104551
104778
|
`,te.length-et>ve&&st>et?vr+=te.slice(et,st)+`
|
|
104552
104779
|
`+te.slice(st+1):vr+=te.slice(et),vr.slice(1)}function br(te){let ve="",Re=0;for(let Ge=0;Ge<te.length;Re>=65536?Ge+=2:Ge++){Re=pr(te,Ge);let et=pe[Re];!et&&ft(Re)?(ve+=te[Ge],Re>=65536&&(ve+=te[Ge+1])):ve+=et||wt(Re)}return ve}function pn(te,ve,Re){let Ge="",et=te.tag;for(let Tt=0,st=Re.length;Tt<st;Tt+=1){let $t=Re[Tt];te.replacer&&($t=te.replacer.call(Re,String(Tt),$t)),(Je(te,ve,$t,!1,!1)||typeof $t>"u"&&Je(te,ve,null,!1,!1))&&(Ge!==""&&(Ge+=","+(te.condenseFlow?"":" ")),Ge+=te.dump)}te.tag=et,te.dump="["+Ge+"]"}function en(te,ve,Re,Ge){let et="",Tt=te.tag;for(let st=0,$t=Re.length;st<$t;st+=1){let vr=Re[st];te.replacer&&(vr=te.replacer.call(Re,String(st),vr)),(Je(te,ve+1,vr,!0,!0,!1,!0)||typeof vr>"u"&&Je(te,ve+1,null,!0,!0,!1,!0))&&((!Ge||et!=="")&&(et+=ze(te,ve)),te.dump&&p===te.dump.charCodeAt(0)?et+="-":et+="- ",et+=te.dump)}te.tag=Tt,te.dump=et||"[]"}function er(te,ve,Re){let Ge="",et=te.tag,Tt=Object.keys(Re);for(let st=0,$t=Tt.length;st<$t;st+=1){let vr="";Ge!==""&&(vr+=", "),te.condenseFlow&&(vr+='"');let Er=Tt[st],Fr=Re[Er];te.replacer&&(Fr=te.replacer.call(Re,Er,Fr)),Je(te,ve,Er,!1,!1)&&(te.dump.length>1024&&(vr+="? "),vr+=te.dump+(te.condenseFlow?'"':"")+":"+(te.condenseFlow?"":" "),Je(te,ve,Fr,!1,!1)&&(vr+=te.dump,Ge+=vr))}te.tag=et,te.dump="{"+Ge+"}"}function ts(te,ve,Re,Ge){let et="",Tt=te.tag,st=Object.keys(Re);if(te.sortKeys===!0)st.sort();else if(typeof te.sortKeys=="function")st.sort(te.sortKeys);else if(te.sortKeys)throw new t("sortKeys must be a boolean or a function");for(let $t=0,vr=st.length;$t<vr;$t+=1){let Er="";(!Ge||et!=="")&&(Er+=ze(te,ve));let Fr=st[$t],tn=Re[Fr];if(te.replacer&&(tn=te.replacer.call(Re,Fr,tn)),!Je(te,ve+1,Fr,!0,!0,!0))continue;let yn=te.tag!==null&&te.tag!=="?"||te.dump&&te.dump.length>1024;yn&&(te.dump&&p===te.dump.charCodeAt(0)?Er+="?":Er+="? "),Er+=te.dump,yn&&(Er+=ze(te,ve)),Je(te,ve+1,tn,!0,yn)&&(te.dump&&p===te.dump.charCodeAt(0)?Er+=":":Er+=": ",Er+=te.dump,et+=Er)}te.tag=Tt,te.dump=et||"{}"}function M(te,ve,Re){let Ge=Re?te.explicitTypes:te.implicitTypes;for(let et=0,Tt=Ge.length;et<Tt;et+=1){let st=Ge[et];if((st.instanceOf||st.predicate)&&(!st.instanceOf||typeof ve=="object"&&ve instanceof st.instanceOf)&&(!st.predicate||st.predicate(ve))){if(Re?st.multi&&st.representName?te.tag=st.representName(ve):te.tag=st.tag:te.tag="?",st.represent){let $t=te.styleMap[st.tag]||st.defaultStyle,vr;if(s.call(st.represent)==="[object Function]")vr=st.represent(ve,$t);else if(a.call(st.represent,$t))vr=st.represent[$t](ve,$t);else throw new t("!<"+st.tag+'> tag resolver accepts not "'+$t+'" style');te.dump=vr}return!0}}return!1}function Je(te,ve,Re,Ge,et,Tt,st){te.tag=null,te.dump=Re,M(te,Re,!1)||M(te,Re,!0);let $t=s.call(te.dump),vr=Ge;Ge&&(Ge=te.flowLevel<0||te.flowLevel>ve);let Er=$t==="[object Object]"||$t==="[object Array]",Fr,tn;if(Er&&(Fr=te.duplicates.indexOf(Re),tn=Fr!==-1),(te.tag!==null&&te.tag!=="?"||tn||te.indent!==2&&ve>0)&&(et=!1),tn&&te.usedDuplicates[Fr])te.dump="*ref_"+Fr;else{if(Er&&tn&&!te.usedDuplicates[Fr]&&(te.usedDuplicates[Fr]=!0),$t==="[object Object]")Ge&&Object.keys(te.dump).length!==0?(ts(te,ve,te.dump,et),tn&&(te.dump="&ref_"+Fr+te.dump)):(er(te,ve,te.dump),tn&&(te.dump="&ref_"+Fr+" "+te.dump));else if($t==="[object Array]")Ge&&te.dump.length!==0?(te.noArrayIndent&&!st&&ve>0?en(te,ve-1,te.dump,et):en(te,ve,te.dump,et),tn&&(te.dump="&ref_"+Fr+te.dump)):(pn(te,ve,te.dump),tn&&(te.dump="&ref_"+Fr+" "+te.dump));else if($t==="[object String]")te.tag!=="?"&&Ce(te,te.dump,ve,Tt,vr);else{if($t==="[object Undefined]")return!1;if(te.skipInvalid)return!1;throw new t("unacceptable kind of an object to dump "+$t)}if(te.tag!==null&&te.tag!=="?"){let yn=encodeURI(te.tag[0]==="!"?te.tag.slice(1):te.tag).replace(/!/g,"%21");te.tag[0]==="!"?yn="!"+yn:yn.slice(0,18)==="tag:yaml.org,2002:"?yn="!!"+yn.slice(18):yn="!<"+yn+">",te.dump=yn+" "+te.dump}}return!0}function Ot(te,ve){let Re=[],Ge=[];St(te,Re,Ge);let et=Ge.length;for(let Tt=0;Tt<et;Tt+=1)ve.duplicates.push(Re[Ge[Tt]]);ve.usedDuplicates=new Array(et)}function St(te,ve,Re){if(te!==null&&typeof te=="object"){let Ge=ve.indexOf(te);if(Ge!==-1)Re.indexOf(Ge)===-1&&Re.push(Ge);else if(ve.push(te),Array.isArray(te))for(let et=0,Tt=te.length;et<Tt;et+=1)St(te[et],ve,Re);else{let et=Object.keys(te);for(let Tt=0,st=et.length;Tt<st;Tt+=1)St(te[et[Tt]],ve,Re)}}}function Ht(te,ve){ve=ve||{};let Re=new ot(ve);Re.noRefs||Ot(te,Re);let Ge=te;return Re.replacer&&(Ge=Re.replacer.call({"":Ge},"",Ge)),Je(Re,0,Ge,!0,!0)?Re.dump+`
|
|
104553
|
-
`:""}return $W.dump=Ht,$W}function RBt(){if(nwe)return Df;nwe=1;let e=OBt(),t=NBt();function r(s,a){return function(){throw new Error("Function yaml."+s+" is removed in js-yaml 4. Use yaml."+a+" instead, which is now safe by default.")}}return Df.Type=Cd(),Df.Schema=iwe(),Df.FAILSAFE_SCHEMA=uwe(),Df.JSON_SCHEMA=dwe(),Df.CORE_SCHEMA=hwe(),Df.DEFAULT_SCHEMA=VW(),Df.load=e.load,Df.loadAll=e.loadAll,Df.dump=t.dump,Df.YAMLException=tk(),Df.types={binary:ywe(),float:fwe(),map:awe(),null:cwe(),pairs:xwe(),set:_we(),timestamp:mwe(),bool:lwe(),int:pwe(),merge:gwe(),omap:vwe(),seq:owe(),str:swe()},Df.safeLoad=r("safeLoad","load"),Df.safeLoadAll=r("safeLoadAll","loadAll"),Df.safeDump=r("safeDump","dump"),Df}var Df,OF,o_,NEe,SW,REe,bW,FEe,EW,LEe,wW,MEe,TW,BEe,PW,jEe,CW,qEe,AW,UEe,DW,$Ee,kW,VEe,IW,HEe,OW,zEe,NW,WEe,RW,GEe,FW,KEe,LW,YEe,MW,JEe,BW,XEe,jW,ZEe,qW,QEe,UW,ewe,twe,$W,rwe,nwe,FBt,HW,Hcr,zcr,Wcr,Gcr,Kcr,Ycr,Jcr,Xcr,Zcr,Qcr,elr,tlr,rlr,nlr,Swe=_t(()=>{Df={},OF={},o_={};$W={};FBt=RBt(),HW=kBt(FBt),{Type:Hcr,Schema:zcr,FAILSAFE_SCHEMA:Wcr,JSON_SCHEMA:Gcr,CORE_SCHEMA:Kcr,DEFAULT_SCHEMA:Ycr,load:Jcr,loadAll:Xcr,dump:Zcr,YAMLException:Qcr,types:elr,safeLoad:tlr,safeLoadAll:rlr,safeDump:nlr}=HW});function LBt(){let e=[Vg.default.resolve(__dirname,"../../agent/observability/python/registry.json"),Vg.default.resolve(__dirname,"pages/observability-python/registry.json"),Vg.default.resolve(__dirname,"..","..","pages/observability-python/registry.json")],t;for(let r of e)try{return t=JSON.parse($g.default.readFileSync(r,"utf-8")),t.map(s=>({...s,compiledPatterns:s.importPatterns.map(a=>new RegExp(`(?:^|\\n)\\s*(?:import\\s+${a}|from\\s+${a}\\b)`))}))}catch{continue}return console.warn("[observability] Python registry.json not found, Python instrumentation detection disabled."),[]}function wwe(e){if(!$g.default.existsSync(e))return{entries:[],requiredPipPackages:[],otelCorePipPackages:[],activeEntryNames:[]};let t=new Set;if(Awe(e,a=>{for(let n of Ewe)for(let c of n.compiledPatterns)if(c.test(a)){t.add(n.name);break}}),t.size===0)return{entries:[],requiredPipPackages:[],otelCorePipPackages:[...bwe],activeEntryNames:[]};let r=[],s=new Set;for(let a of Ewe){if(!t.has(a.name))continue;let n=MBt[a.name];if(!(n!=null&&n.some(c=>t.has(c)))){r.push(a.name);for(let c of a.pipPackages)s.add(c)}}return{entries:r,requiredPipPackages:[...s],otelCorePipPackages:[...bwe],activeEntryNames:r}}function Twe(e){return[`os.environ.setdefault('AGENT_OBSERVABILITY_ENTRIES', '${JSON.stringify(e).replace(/'/g,"\\'")}')`,""]}function Pwe(e){let t=BBt();$g.default.existsSync(t)&&Cwe(t,e,{exclude:["tests","pytest.ini","__pycache__",".venv","venv",".pytest_cache","pyproject.toml","uv.lock"]})}function BBt(){let e=[Vg.default.resolve(__dirname,"pages/observability-python"),Vg.default.resolve(__dirname,"..","..","pages/observability-python"),Vg.default.resolve(__dirname,"..","..","agent/observability/python")];for(let t of e)if($g.default.existsSync(t))return t;return Vg.default.resolve(__dirname,"../../agent/observability/python")}function Cwe(e,t,r={}){var s;if($g.default.mkdirSync(t,{recursive:!0}),!!$g.default.existsSync(e))for(let a of $g.default.readdirSync(e,{withFileTypes:!0})){if((s=r.exclude)!=null&&s.includes(a.name)||a.name==="__pycache__")continue;let n=Vg.default.join(e,a.name),c=Vg.default.join(t,a.name);a.isDirectory()?Cwe(n,c,r):$g.default.copyFileSync(n,c)}}function Awe(e,t){let r;try{r=$g.default.readdirSync(e,{withFileTypes:!0})}catch{return}for(let s of r){if(s.name==="__pycache__"||s.name.startsWith("."))continue;let a=Vg.default.join(e,s.name);s.isDirectory()?Awe(a,t):s.name.endsWith(".py")&&t($g.default.readFileSync(a,"utf-8"))}}var $g,Vg,bwe,Ewe,MBt,Dwe=_t(()=>{$g=nr(require("fs")),Vg=nr(require("path")),bwe=["opentelemetry-api>=1.28","opentelemetry-sdk>=1.28","opentelemetry-exporter-otlp-proto-http>=1.28","opentelemetry-semantic-conventions>=0.49b0"];Ewe=LBt(),MBt={openai:["openai-agents"]}});var Gwe={};nP(Gwe,{AgentPythonBuilder:()=>rk,SERVER_IMAGE_BASE_PACKAGES:()=>GW,SERVER_IMAGE_E2B_PACKAGE_VERSIONS:()=>Fwe,SERVER_IMAGE_EXTENDED_PACKAGES:()=>Lwe,buildAgentToolkitRequirement:()=>Rwe,buildPagesBlobPythonRequirement:()=>FF,collectPyMcpRouteMetadata:()=>Bwe,extractPkgName:()=>jwe,getAgentToolkitWheelInfo:()=>Nwe,getPagesBlobWheelInfo:()=>RF,getServerImageBundledPackages:()=>JW,mergeRequirements:()=>zwe,normalizePkgName:()=>Zw,parseMcpMetadataFromPyDocstring:()=>Mwe,parseUserRequirements:()=>qwe});function RF(e){let t=e!=null?e:[ni.default.resolve(__dirname,"libs-pages-blob-python"),ni.default.resolve(__dirname,"..","..","libs-pages-blob-python"),ni.default.resolve(__dirname,"..","..","..","..","libs-pages-blob-python")];for(let r of t){if(!Nn.default.existsSync(r))continue;let s=Nn.default.readdirSync(r).filter(n=>n.endsWith(".whl"));if(s.length===0)continue;let a=s.sort()[s.length-1];return{dir:r,file:a}}return null}function FF(e,t="pages-blob-python==0.
|
|
104780
|
+
`:""}return $W.dump=Ht,$W}function RBt(){if(nwe)return Df;nwe=1;let e=OBt(),t=NBt();function r(s,a){return function(){throw new Error("Function yaml."+s+" is removed in js-yaml 4. Use yaml."+a+" instead, which is now safe by default.")}}return Df.Type=Cd(),Df.Schema=iwe(),Df.FAILSAFE_SCHEMA=uwe(),Df.JSON_SCHEMA=dwe(),Df.CORE_SCHEMA=hwe(),Df.DEFAULT_SCHEMA=VW(),Df.load=e.load,Df.loadAll=e.loadAll,Df.dump=t.dump,Df.YAMLException=tk(),Df.types={binary:ywe(),float:fwe(),map:awe(),null:cwe(),pairs:xwe(),set:_we(),timestamp:mwe(),bool:lwe(),int:pwe(),merge:gwe(),omap:vwe(),seq:owe(),str:swe()},Df.safeLoad=r("safeLoad","load"),Df.safeLoadAll=r("safeLoadAll","loadAll"),Df.safeDump=r("safeDump","dump"),Df}var Df,OF,o_,NEe,SW,REe,bW,FEe,EW,LEe,wW,MEe,TW,BEe,PW,jEe,CW,qEe,AW,UEe,DW,$Ee,kW,VEe,IW,HEe,OW,zEe,NW,WEe,RW,GEe,FW,KEe,LW,YEe,MW,JEe,BW,XEe,jW,ZEe,qW,QEe,UW,ewe,twe,$W,rwe,nwe,FBt,HW,Hcr,zcr,Wcr,Gcr,Kcr,Ycr,Jcr,Xcr,Zcr,Qcr,elr,tlr,rlr,nlr,Swe=_t(()=>{Df={},OF={},o_={};$W={};FBt=RBt(),HW=kBt(FBt),{Type:Hcr,Schema:zcr,FAILSAFE_SCHEMA:Wcr,JSON_SCHEMA:Gcr,CORE_SCHEMA:Kcr,DEFAULT_SCHEMA:Ycr,load:Jcr,loadAll:Xcr,dump:Zcr,YAMLException:Qcr,types:elr,safeLoad:tlr,safeLoadAll:rlr,safeDump:nlr}=HW});function LBt(){let e=[Vg.default.resolve(__dirname,"../../agent/observability/python/registry.json"),Vg.default.resolve(__dirname,"pages/observability-python/registry.json"),Vg.default.resolve(__dirname,"..","..","pages/observability-python/registry.json")],t;for(let r of e)try{return t=JSON.parse($g.default.readFileSync(r,"utf-8")),t.map(s=>({...s,compiledPatterns:s.importPatterns.map(a=>new RegExp(`(?:^|\\n)\\s*(?:import\\s+${a}|from\\s+${a}\\b)`))}))}catch{continue}return console.warn("[observability] Python registry.json not found, Python instrumentation detection disabled."),[]}function wwe(e){if(!$g.default.existsSync(e))return{entries:[],requiredPipPackages:[],otelCorePipPackages:[],activeEntryNames:[]};let t=new Set;if(Awe(e,a=>{for(let n of Ewe)for(let c of n.compiledPatterns)if(c.test(a)){t.add(n.name);break}}),t.size===0)return{entries:[],requiredPipPackages:[],otelCorePipPackages:[...bwe],activeEntryNames:[]};let r=[],s=new Set;for(let a of Ewe){if(!t.has(a.name))continue;let n=MBt[a.name];if(!(n!=null&&n.some(c=>t.has(c)))){r.push(a.name);for(let c of a.pipPackages)s.add(c)}}return{entries:r,requiredPipPackages:[...s],otelCorePipPackages:[...bwe],activeEntryNames:r}}function Twe(e){return[`os.environ.setdefault('AGENT_OBSERVABILITY_ENTRIES', '${JSON.stringify(e).replace(/'/g,"\\'")}')`,""]}function Pwe(e){let t=BBt();$g.default.existsSync(t)&&Cwe(t,e,{exclude:["tests","pytest.ini","__pycache__",".venv","venv",".pytest_cache","pyproject.toml","uv.lock"]})}function BBt(){let e=[Vg.default.resolve(__dirname,"pages/observability-python"),Vg.default.resolve(__dirname,"..","..","pages/observability-python"),Vg.default.resolve(__dirname,"..","..","agent/observability/python")];for(let t of e)if($g.default.existsSync(t))return t;return Vg.default.resolve(__dirname,"../../agent/observability/python")}function Cwe(e,t,r={}){var s;if($g.default.mkdirSync(t,{recursive:!0}),!!$g.default.existsSync(e))for(let a of $g.default.readdirSync(e,{withFileTypes:!0})){if((s=r.exclude)!=null&&s.includes(a.name)||a.name==="__pycache__")continue;let n=Vg.default.join(e,a.name),c=Vg.default.join(t,a.name);a.isDirectory()?Cwe(n,c,r):$g.default.copyFileSync(n,c)}}function Awe(e,t){let r;try{r=$g.default.readdirSync(e,{withFileTypes:!0})}catch{return}for(let s of r){if(s.name==="__pycache__"||s.name.startsWith("."))continue;let a=Vg.default.join(e,s.name);s.isDirectory()?Awe(a,t):s.name.endsWith(".py")&&t($g.default.readFileSync(a,"utf-8"))}}var $g,Vg,bwe,Ewe,MBt,Dwe=_t(()=>{$g=nr(require("fs")),Vg=nr(require("path")),bwe=["opentelemetry-api>=1.28","opentelemetry-sdk>=1.28","opentelemetry-exporter-otlp-proto-http>=1.28","opentelemetry-semantic-conventions>=0.49b0"];Ewe=LBt(),MBt={openai:["openai-agents"]}});var Gwe={};nP(Gwe,{AgentPythonBuilder:()=>rk,SERVER_IMAGE_BASE_PACKAGES:()=>GW,SERVER_IMAGE_E2B_PACKAGE_VERSIONS:()=>Fwe,SERVER_IMAGE_EXTENDED_PACKAGES:()=>Lwe,buildAgentToolkitRequirement:()=>Rwe,buildPagesBlobPythonRequirement:()=>FF,collectPyMcpRouteMetadata:()=>Bwe,extractPkgName:()=>jwe,getAgentToolkitWheelInfo:()=>Nwe,getPagesBlobWheelInfo:()=>RF,getServerImageBundledPackages:()=>JW,mergeRequirements:()=>zwe,normalizePkgName:()=>Zw,parseMcpMetadataFromPyDocstring:()=>Mwe,parseUserRequirements:()=>qwe});function RF(e){let t=e!=null?e:[ni.default.resolve(__dirname,"libs-pages-blob-python"),ni.default.resolve(__dirname,"..","..","libs-pages-blob-python"),ni.default.resolve(__dirname,"..","..","..","..","libs-pages-blob-python")];for(let r of t){if(!Nn.default.existsSync(r))continue;let s=Nn.default.readdirSync(r).filter(n=>n.endsWith(".whl"));if(s.length===0)continue;let a=s.sort()[s.length-1];return{dir:r,file:a}}return null}function FF(e,t="pages-blob-python==0.13.0"){let r=RF(e);if(!r)return t;let a=ni.default.join(r.dir,r.file).replace(/\\/g,"/").replace(/^([A-Za-z]:)/,"/$1");return`pages-blob-python @ file://${a.startsWith("/")?"":"/"}${a}`}function Nwe(e){let t=e!=null?e:[ni.default.resolve(__dirname,"libs-pages-agent-toolkit"),ni.default.resolve(__dirname,"..","..","libs-pages-agent-toolkit"),ni.default.resolve(__dirname,"..","..","..","..","libs-pages-agent-toolkit")];for(let r of t){if(!Nn.default.existsSync(r))continue;let s=Nn.default.readdirSync(r).filter(n=>n.endsWith(".whl"));if(s.length===0)continue;let a=s.sort()[s.length-1];return{dir:r,file:a}}return null}function Rwe(e,t="pages-agent-toolkit==0.1.46"){let r=Nwe(e);if(!r)return t;let a=ni.default.join(r.dir,r.file).replace(/\\/g,"/").replace(/^([A-Za-z]:)/,"/$1");return`pages-agent-toolkit @ file://${a.startsWith("/")?"":"/"}${a}`}function zBt(e=process.env){let t=(e.EDGEONE_AGENT_PYTHON_AGGRESSIVE_EXCLUDE||"").trim().toLowerCase();return t==="1"||t==="true"||t==="yes"}function JW(e=process.env){return(e.EDGEONE_ASSUME_SERVER_IMAGE||"").trim().toLowerCase()==="v1"?[...GW]:[...GW,...Lwe]}function GBt(){let e=ni.default.resolve(__dirname,"pages/templates/agent-python");return Nn.default.existsSync(e)?e:ni.default.resolve(__dirname,"../templates/agent-python")}function YBt(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e,r=t.type;if(typeof r!="string"||!KBt.has(r))return;let s={type:r};if(typeof t.description=="string"&&t.description.length>0&&(s.description=t.description),Array.isArray(t.enum)){let a=t.enum.map(n=>typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"?String(n):"").filter(n=>n.length>0);a.length>0&&(s.enum=a)}return s}function JBt(e){let t=/(?:^|\n)\s*(?:[rRbBuU]{0,2})("""|''')([\s\S]*?)\1/.exec(e);return t?t[2]:void 0}function XBt(e){let t=e.split(`
|
|
104554
104781
|
`),r=-1;for(let s=0;s<t.length;s++)if(/^(mcp_tool_name|mcp_description|mcp_hidden|mcp_parameters)\s*:/.exec(t[s])){r=s;break}if(!(r<0))return t.slice(r).join(`
|
|
104555
104782
|
`)}function Mwe(e){let t=JBt(e);if(!t)return;let r=XBt(t);if(!r)return;let s;try{s=HW.load(r)}catch{return}if(!s||typeof s!="object"||Array.isArray(s))return;let a=s,n={};if(typeof a.mcp_tool_name=="string"&&/^[A-Za-z0-9_]+$/.test(a.mcp_tool_name)&&(n.mcp_tool_name=a.mcp_tool_name),typeof a.mcp_description=="string"&&a.mcp_description.length>0&&(n.mcp_description=a.mcp_description),a.mcp_hidden===!0?n.mcp_hidden=!0:typeof a.mcp_hidden=="string"&&(n.mcp_hidden=a.mcp_hidden.toLowerCase()==="true"),a.mcp_parameters&&typeof a.mcp_parameters=="object"&&!Array.isArray(a.mcp_parameters)){let c=a.mcp_parameters,p={},d=[];for(let h of Object.keys(c)){if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(h))continue;let y=YBt(c[h]);if(!y)continue;p[h]=y;let w=c[h];w&&w.required===!0&&d.push(h)}Object.keys(p).length>0&&(n.mcp_parameters=p,d.length>0&&(n.mcp_required=d))}return Object.keys(n).length>0?n:void 0}function Bwe(e){let t={};for(let r of e){let s="";try{s=Nn.default.readFileSync(r.filePath,"utf-8")}catch{continue}let a;try{a=Mwe(s)}catch{a=void 0}a&&Object.keys(a).length>0&&(t[r.routePath]=a)}return t}function jwe(e){let t=e.trim();if(!t)return"";let r=t.match(/^[A-Za-z0-9_.-]+/);return r?r[0]:""}function Zw(e){return e.toLowerCase().replace(/[._]+/g,"-")}function qwe(e){if(!e||!Nn.default.existsSync(e))return[];let t=Nn.default.readFileSync(e,"utf-8"),r=[];for(let s of t.split(`
|
|
104556
104783
|
`)){let a=s,n=a.indexOf("#");if(n!==0&&(n>0&&/\s/.test(a[n-1])&&(a=a.slice(0,n)),a=a.trim(),!!a)){if(a.startsWith("-r ")||a.startsWith("-e ")||a.startsWith("--requirement")||a.startsWith("--editable")){ur(`[agent-python] Skipping unsupported requirements directive: ${a}`);continue}r.push(a)}}return r}function ZBt(e){if(!Nn.default.existsSync(e)){Nn.default.mkdirSync(e,{recursive:!0});return}TF(e,["lib","__pycache__",".blob-local"],"agent-python-generated")}function QBt(e,t,r=[]){let s=ni.default.join(t,".deps-hash");if(!Nn.default.existsSync(s))return!1;try{let a=XW(e),n=Nn.default.readFileSync(s,"utf-8").trim();if(a!==n)return!1}catch{return!1}return r.every(a=>Nn.default.existsSync(ni.default.join(t,a)))}function XW(e){return Owe.default.createHash("sha256").update(e6t).update(`
|