edgeone 1.6.28-beta.11 → 1.6.28-beta.12
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
CHANGED
|
@@ -590,7 +590,7 @@ ${A.join(`
|
|
|
590
590
|
`;y.forEach(A=>{v+=A}),t.fail(v)}};let p={};s.conflicts=function(m,y){Ni("<string|object> [array|string]",[m,y],arguments.length),typeof m=="object"?Object.keys(m).forEach(v=>{s.conflicts(v,m[v])}):(e.global(m),p[m]||(p[m]=[]),Array.isArray(y)?y.forEach(v=>s.conflicts(m,v)):p[m].push(y))},s.getConflicting=()=>p,s.conflicting=function(m){Object.keys(m).forEach(y=>{p[y]&&p[y].forEach(v=>{v&&m[y]!==void 0&&m[v]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",y,v))})}),e.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(p).forEach(y=>{p[y].forEach(v=>{v&&m[r.Parser.camelCase(y)]!==void 0&&m[r.Parser.camelCase(v)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",y,v))})})},s.recommendCommands=function(m,y){y=y.sort((w,k)=>k.length-w.length);let A=null,C=1/0;for(let w=0,k;(k=y[w])!==void 0;w++){let N=xUe(m,k);N<=3&&N<C&&(C=N,A=k)}A&&t.fail(n("Did you mean %s?",A))},s.reset=function(m){return c=lD(c,y=>!m[y]),p=lD(p,y=>!m[y]),s};let f=[];return s.freeze=function(){f.push({implied:c,conflicting:p})},s.unfreeze=function(){let m=f.pop();qA(m,void 0,r),{implied:c,conflicting:p}=m},s}var Qi=function(e,t,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},Ze=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},Ad,RR,k5,Vb,Cx,ZJ,fD,NR,eK,Gb,tK,Wb,bS,Ix,Yb,rK,S4,_m,us,nK,iK,kx,OR,C4,FR,dD,sK,fo,LR,jR,MR,Bo,oK,ES,Vf;function UUe(e){return(t=[],r=e.process.cwd(),n)=>{let o=new Uhe(t,r,n,e);return Object.defineProperty(o,"argv",{get:()=>o.parse(),enumerable:!0}),o.help(),o.version(),o}}var wUe=Symbol("copyDoubleDash"),_Ue=Symbol("copyDoubleDash"),Phe=Symbol("deleteFromParserHintObject"),SUe=Symbol("emitWarning"),CUe=Symbol("freeze"),IUe=Symbol("getDollarZero"),QR=Symbol("getParserConfiguration"),kUe=Symbol("getUsageConfiguration"),Rhe=Symbol("guessLocale"),TUe=Symbol("guessVersion"),DUe=Symbol("parsePositionalNumbers"),Nhe=Symbol("pkgUp"),hD=Symbol("populateParserHintArray"),I4=Symbol("populateParserHintSingleValueDictionary"),Ohe=Symbol("populateParserHintArrayDictionary"),Fhe=Symbol("populateParserHintDictionary"),Lhe=Symbol("sanitizeKey"),jhe=Symbol("setKey"),Mhe=Symbol("unfreeze"),BUe=Symbol("validateAsync"),PUe=Symbol("getCommandInstance"),RUe=Symbol("getContext"),NUe=Symbol("getHasOutput"),OUe=Symbol("getLoggerInstance"),FUe=Symbol("getParseContext"),LUe=Symbol("getUsageInstance"),jUe=Symbol("getValidationInstance"),aK=Symbol("hasParseCallback"),MUe=Symbol("isGlobalContext"),qR=Symbol("postProcess"),QUe=Symbol("rebase"),Qhe=Symbol("reset"),T5=Symbol("runYargsParserAndExecuteCommands"),qhe=Symbol("runValidation"),qUe=Symbol("setHasOutput"),UR=Symbol("kTrackManuallySetKeys"),Uhe=class{constructor(t=[],r,n,o){this.customScriptName=!1,this.parsed=!1,Ad.set(this,void 0),RR.set(this,void 0),k5.set(this,{commands:[],fullCommands:[]}),Vb.set(this,null),Cx.set(this,null),ZJ.set(this,"show-hidden"),fD.set(this,null),NR.set(this,!0),eK.set(this,{}),Gb.set(this,!0),tK.set(this,[]),Wb.set(this,void 0),bS.set(this,{}),Ix.set(this,!1),Yb.set(this,null),rK.set(this,!0),S4.set(this,void 0),_m.set(this,""),us.set(this,void 0),nK.set(this,void 0),iK.set(this,{}),kx.set(this,null),OR.set(this,null),C4.set(this,{}),FR.set(this,{}),dD.set(this,void 0),sK.set(this,!1),fo.set(this,void 0),LR.set(this,!1),jR.set(this,!1),MR.set(this,!1),Bo.set(this,void 0),oK.set(this,{}),ES.set(this,null),Vf.set(this,void 0),Qi(this,fo,o,"f"),Qi(this,dD,t,"f"),Qi(this,RR,r,"f"),Qi(this,nK,n,"f"),Qi(this,Wb,new JJ(this),"f"),this.$0=this[IUe](),this[Qhe](),Qi(this,Ad,Ze(this,Ad,"f"),"f"),Qi(this,Bo,Ze(this,Bo,"f"),"f"),Qi(this,Vf,Ze(this,Vf,"f"),"f"),Qi(this,us,Ze(this,us,"f"),"f"),Ze(this,us,"f").showHiddenOpt=Ze(this,ZJ,"f"),Qi(this,S4,this[_Ue](),"f")}addHelpOpt(t,r){let n="help";return Ni("[string|boolean] [string]",[t,r],arguments.length),Ze(this,Yb,"f")&&(this[Phe](Ze(this,Yb,"f")),Qi(this,Yb,null,"f")),t===!1&&r===void 0?this:(Qi(this,Yb,typeof t=="string"?t:n,"f"),this.boolean(Ze(this,Yb,"f")),this.describe(Ze(this,Yb,"f"),r||Ze(this,Bo,"f").deferY18nLookup("Show help")),this)}help(t,r){return this.addHelpOpt(t,r)}addShowHiddenOpt(t,r){if(Ni("[string|boolean] [string]",[t,r],arguments.length),t===!1&&r===void 0)return this;let n=typeof t=="string"?t:Ze(this,ZJ,"f");return this.boolean(n),this.describe(n,r||Ze(this,Bo,"f").deferY18nLookup("Show hidden options")),Ze(this,us,"f").showHiddenOpt=n,this}showHidden(t,r){return this.addShowHiddenOpt(t,r)}alias(t,r){return Ni("<object|string|array> [string|array]",[t,r],arguments.length),this[Ohe](this.alias.bind(this),"alias",t,r),this}array(t){return Ni("<array|string>",[t],arguments.length),this[hD]("array",t),this[UR](t),this}boolean(t){return Ni("<array|string>",[t],arguments.length),this[hD]("boolean",t),this[UR](t),this}check(t,r){return Ni("<function> [boolean]",[t,r],arguments.length),this.middleware((n,o)=>PR(()=>t(n,o.getOptions()),s=>(s?(typeof s=="string"||s instanceof Error)&&Ze(this,Bo,"f").fail(s.toString(),s):Ze(this,Bo,"f").fail(Ze(this,fo,"f").y18n.__("Argument check failed: %s",t.toString())),n),s=>(Ze(this,Bo,"f").fail(s.message?s.message:s.toString(),s),n)),!1,r),this}choices(t,r){return Ni("<object|string|array> [string|array]",[t,r],arguments.length),this[Ohe](this.choices.bind(this),"choices",t,r),this}coerce(t,r){if(Ni("<object|string|array> [function]",[t,r],arguments.length),Array.isArray(t)){if(!r)throw new ap("coerce callback must be provided");for(let n of t)this.coerce(n,r);return this}else if(typeof t=="object"){for(let n of Object.keys(t))this.coerce(n,t[n]);return this}if(!r)throw new ap("coerce callback must be provided");return Ze(this,us,"f").key[t]=!0,Ze(this,Wb,"f").addCoerceMiddleware((n,o)=>{let s;return Object.prototype.hasOwnProperty.call(n,t)?PR(()=>(s=o.getAliases(),r(n[t])),u=>{n[t]=u;let p=o.getInternalMethods().getParserConfiguration()["strip-aliased"];if(s[t]&&p!==!0)for(let f of s[t])n[f]=u;return n},u=>{throw new ap(u.message)}):n},t),this}conflicts(t,r){return Ni("<string|object> [string|array]",[t,r],arguments.length),Ze(this,Vf,"f").conflicts(t,r),this}config(t="config",r,n){return Ni("[object|string] [string|function] [function]",[t,r,n],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=S5(t,Ze(this,RR,"f"),this[QR]()["deep-merge-config"]||!1,Ze(this,fo,"f")),Ze(this,us,"f").configObjects=(Ze(this,us,"f").configObjects||[]).concat(t),this):(typeof r=="function"&&(n=r,r=void 0),this.describe(t,r||Ze(this,Bo,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(o=>{Ze(this,us,"f").config[o]=n||!0}),this)}completion(t,r,n){return Ni("[string] [string|boolean|function] [function]",[t,r,n],arguments.length),typeof r=="function"&&(n=r,r=void 0),Qi(this,Cx,t||Ze(this,Cx,"f")||"completion","f"),!r&&r!==!1&&(r="generate completion script"),this.command(Ze(this,Cx,"f"),r),n&&Ze(this,Vb,"f").registerFunction(n),this}command(t,r,n,o,s,c){return Ni("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,r,n,o,s,c],arguments.length),Ze(this,Ad,"f").addHandler(t,r,n,o,s,c),this}commands(t,r,n,o,s,c){return this.command(t,r,n,o,s,c)}commandDir(t,r){Ni("<string> [object]",[t,r],arguments.length);let n=Ze(this,nK,"f")||Ze(this,fo,"f").require;return Ze(this,Ad,"f").addDirectory(t,n,Ze(this,fo,"f").getCallerFile(),r),this}count(t){return Ni("<array|string>",[t],arguments.length),this[hD]("count",t),this[UR](t),this}default(t,r,n){return Ni("<object|string|array> [*] [string]",[t,r,n],arguments.length),n&&(Ihe(t,Ze(this,fo,"f")),Ze(this,us,"f").defaultDescription[t]=n),typeof r=="function"&&(Ihe(t,Ze(this,fo,"f")),Ze(this,us,"f").defaultDescription[t]||(Ze(this,us,"f").defaultDescription[t]=Ze(this,Bo,"f").functionDescription(r)),r=r.call()),this[I4](this.default.bind(this),"default",t,r),this}defaults(t,r,n){return this.default(t,r,n)}demandCommand(t=1,r,n,o){return Ni("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,r,n,o],arguments.length),typeof r!="number"&&(n=r,r=1/0),this.global("_",!1),Ze(this,us,"f").demandedCommands._={min:t,max:r,minMsg:n,maxMsg:o},this}demand(t,r,n){return Array.isArray(r)?(r.forEach(o=>{qA(n,!0,Ze(this,fo,"f")),this.demandOption(o,n)}),r=1/0):typeof r!="number"&&(n=r,r=1/0),typeof t=="number"?(qA(n,!0,Ze(this,fo,"f")),this.demandCommand(t,r,n,n)):Array.isArray(t)?t.forEach(o=>{qA(n,!0,Ze(this,fo,"f")),this.demandOption(o,n)}):typeof n=="string"?this.demandOption(t,n):(n===!0||typeof n>"u")&&this.demandOption(t),this}demandOption(t,r){return Ni("<object|string|array> [string]",[t,r],arguments.length),this[I4](this.demandOption.bind(this),"demandedOptions",t,r),this}deprecateOption(t,r){return Ni("<string> [string|boolean]",[t,r],arguments.length),Ze(this,us,"f").deprecatedOptions[t]=r,this}describe(t,r){return Ni("<object|string|array> [string]",[t,r],arguments.length),this[jhe](t,!0),Ze(this,Bo,"f").describe(t,r),this}detectLocale(t){return Ni("<boolean>",[t],arguments.length),Qi(this,NR,t,"f"),this}env(t){return Ni("[string|boolean]",[t],arguments.length),t===!1?delete Ze(this,us,"f").envPrefix:Ze(this,us,"f").envPrefix=t||"",this}epilogue(t){return Ni("<string>",[t],arguments.length),Ze(this,Bo,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,r){return Ni("<string|array> [string]",[t,r],arguments.length),Array.isArray(t)?t.forEach(n=>this.example(...n)):Ze(this,Bo,"f").example(t,r),this}exit(t,r){Qi(this,Ix,!0,"f"),Qi(this,fD,r,"f"),Ze(this,Gb,"f")&&Ze(this,fo,"f").process.exit(t)}exitProcess(t=!0){return Ni("[boolean]",[t],arguments.length),Qi(this,Gb,t,"f"),this}fail(t){if(Ni("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new ap("Invalid first argument. Expected function or boolean 'false'");return Ze(this,Bo,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,r){return Ni("<array> [function]",[t,r],arguments.length),r?Ze(this,Vb,"f").getCompletion(t,r):new Promise((n,o)=>{Ze(this,Vb,"f").getCompletion(t,(s,c)=>{s?o(s):n(c)})})}getDemandedOptions(){return Ni([],0),Ze(this,us,"f").demandedOptions}getDemandedCommands(){return Ni([],0),Ze(this,us,"f").demandedCommands}getDeprecatedOptions(){return Ni([],0),Ze(this,us,"f").deprecatedOptions}getDetectLocale(){return Ze(this,NR,"f")}getExitProcess(){return Ze(this,Gb,"f")}getGroups(){return Object.assign({},Ze(this,bS,"f"),Ze(this,FR,"f"))}getHelp(){if(Qi(this,Ix,!0,"f"),!Ze(this,Bo,"f").hasCachedHelpMessage()){if(!this.parsed){let r=this[T5](Ze(this,dD,"f"),void 0,void 0,0,!0);if(cp(r))return r.then(()=>Ze(this,Bo,"f").help())}let t=Ze(this,Ad,"f").runDefaultBuilderOn(this);if(cp(t))return t.then(()=>Ze(this,Bo,"f").help())}return Promise.resolve(Ze(this,Bo,"f").help())}getOptions(){return Ze(this,us,"f")}getStrict(){return Ze(this,LR,"f")}getStrictCommands(){return Ze(this,jR,"f")}getStrictOptions(){return Ze(this,MR,"f")}global(t,r){return Ni("<string|array> [boolean]",[t,r],arguments.length),t=[].concat(t),r!==!1?Ze(this,us,"f").local=Ze(this,us,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{Ze(this,us,"f").local.includes(n)||Ze(this,us,"f").local.push(n)}),this}group(t,r){Ni("<string|array> <string>",[t,r],arguments.length);let n=Ze(this,FR,"f")[r]||Ze(this,bS,"f")[r];Ze(this,FR,"f")[r]&&delete Ze(this,FR,"f")[r];let o={};return Ze(this,bS,"f")[r]=(n||[]).concat(t).filter(s=>o[s]?!1:o[s]=!0),this}hide(t){return Ni("<string>",[t],arguments.length),Ze(this,us,"f").hiddenOptions.push(t),this}implies(t,r){return Ni("<string|object> [number|string|array]",[t,r],arguments.length),Ze(this,Vf,"f").implies(t,r),this}locale(t){return Ni("[string]",[t],arguments.length),t===void 0?(this[Rhe](),Ze(this,fo,"f").y18n.getLocale()):(Qi(this,NR,!1,"f"),Ze(this,fo,"f").y18n.setLocale(t),this)}middleware(t,r,n){return Ze(this,Wb,"f").addMiddleware(t,!!r,n)}nargs(t,r){return Ni("<string|object|array> [number]",[t,r],arguments.length),this[I4](this.nargs.bind(this),"narg",t,r),this}normalize(t){return Ni("<array|string>",[t],arguments.length),this[hD]("normalize",t),this}number(t){return Ni("<array|string>",[t],arguments.length),this[hD]("number",t),this[UR](t),this}option(t,r){if(Ni("<string|object> [object]",[t,r],arguments.length),typeof t=="object")Object.keys(t).forEach(n=>{this.options(n,t[n])});else{typeof r!="object"&&(r={}),this[UR](t),Ze(this,ES,"f")&&(t==="version"||(r==null?void 0:r.alias)==="version")&&this[SUe](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
|
|
591
591
|
`),void 0,"versionWarning"),Ze(this,us,"f").key[t]=!0,r.alias&&this.alias(t,r.alias);let n=r.deprecate||r.deprecated;n&&this.deprecateOption(t,n);let o=r.demand||r.required||r.require;o&&this.demand(t,o),r.demandOption&&this.demandOption(t,typeof r.demandOption=="string"?r.demandOption:void 0),r.conflicts&&this.conflicts(t,r.conflicts),"default"in r&&this.default(t,r.default),r.implies!==void 0&&this.implies(t,r.implies),r.nargs!==void 0&&this.nargs(t,r.nargs),r.config&&this.config(t,r.configParser),r.normalize&&this.normalize(t),r.choices&&this.choices(t,r.choices),r.coerce&&this.coerce(t,r.coerce),r.group&&this.group(t,r.group),(r.boolean||r.type==="boolean")&&(this.boolean(t),r.alias&&this.boolean(r.alias)),(r.array||r.type==="array")&&(this.array(t),r.alias&&this.array(r.alias)),(r.number||r.type==="number")&&(this.number(t),r.alias&&this.number(r.alias)),(r.string||r.type==="string")&&(this.string(t),r.alias&&this.string(r.alias)),(r.count||r.type==="count")&&this.count(t),typeof r.global=="boolean"&&this.global(t,r.global),r.defaultDescription&&(Ze(this,us,"f").defaultDescription[t]=r.defaultDescription),r.skipValidation&&this.skipValidation(t);let s=r.describe||r.description||r.desc,c=Ze(this,Bo,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(c,t)||typeof s=="string")&&this.describe(t,s),r.hidden&&this.hide(t),r.requiresArg&&this.requiresArg(t)}return this}options(t,r){return this.option(t,r)}parse(t,r,n){Ni("[string|array] [function|boolean|object] [function]",[t,r,n],arguments.length),this[CUe](),typeof t>"u"&&(t=Ze(this,dD,"f")),typeof r=="object"&&(Qi(this,OR,r,"f"),r=n),typeof r=="function"&&(Qi(this,kx,r,"f"),r=!1),r||Qi(this,dD,t,"f"),Ze(this,kx,"f")&&Qi(this,Gb,!1,"f");let o=this[T5](t,!!r),s=this.parsed;return Ze(this,Vb,"f").setParsed(this.parsed),cp(o)?o.then(c=>(Ze(this,kx,"f")&&Ze(this,kx,"f").call(this,Ze(this,fD,"f"),c,Ze(this,_m,"f")),c)).catch(c=>{throw Ze(this,kx,"f")&&Ze(this,kx,"f")(c,this.parsed.argv,Ze(this,_m,"f")),c}).finally(()=>{this[Mhe](),this.parsed=s}):(Ze(this,kx,"f")&&Ze(this,kx,"f").call(this,Ze(this,fD,"f"),o,Ze(this,_m,"f")),this[Mhe](),this.parsed=s,o)}parseAsync(t,r,n){let o=this.parse(t,r,n);return cp(o)?o:Promise.resolve(o)}parseSync(t,r,n){let o=this.parse(t,r,n);if(cp(o))throw new ap(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return o}parserConfiguration(t){return Ni("<object>",[t],arguments.length),Qi(this,iK,t,"f"),this}pkgConf(t,r){Ni("<string> [string]",[t,r],arguments.length);let n=null,o=this[Nhe](r||Ze(this,RR,"f"));return o[t]&&typeof o[t]=="object"&&(n=S5(o[t],r||Ze(this,RR,"f"),this[QR]()["deep-merge-config"]||!1,Ze(this,fo,"f")),Ze(this,us,"f").configObjects=(Ze(this,us,"f").configObjects||[]).concat(n)),this}positional(t,r){Ni("<string> <object>",[t,r],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];r=lD(r,(c,u)=>c==="type"&&!["string","number","boolean"].includes(u)?!1:n.includes(c));let o=Ze(this,k5,"f").fullCommands[Ze(this,k5,"f").fullCommands.length-1],s=o?Ze(this,Ad,"f").cmdToParseOptions(o):{array:[],alias:{},default:{},demand:{}};return w4(s).forEach(c=>{let u=s[c];Array.isArray(u)?u.indexOf(t)!==-1&&(r[c]=!0):u[t]&&!(c in r)&&(r[c]=u[t])}),this.group(t,Ze(this,Bo,"f").getPositionalGroupName()),this.option(t,r)}recommendCommands(t=!0){return Ni("[boolean]",[t],arguments.length),Qi(this,sK,t,"f"),this}required(t,r,n){return this.demand(t,r,n)}require(t,r,n){return this.demand(t,r,n)}requiresArg(t){return Ni("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&Ze(this,us,"f").narg[t]?this:(this[I4](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,r){return Ni("[string] [string]",[t,r],arguments.length),t=t||this.$0,Ze(this,S4,"f").log(Ze(this,Vb,"f").generateCompletionScript(t,r||Ze(this,Cx,"f")||"completion")),this}showHelp(t){if(Ni("[string|function]",[t],arguments.length),Qi(this,Ix,!0,"f"),!Ze(this,Bo,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[T5](Ze(this,dD,"f"),void 0,void 0,0,!0);if(cp(n))return n.then(()=>{Ze(this,Bo,"f").showHelp(t)}),this}let r=Ze(this,Ad,"f").runDefaultBuilderOn(this);if(cp(r))return r.then(()=>{Ze(this,Bo,"f").showHelp(t)}),this}return Ze(this,Bo,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,r){return Ni("[boolean|string] [string]",[t,r],arguments.length),Ze(this,Bo,"f").showHelpOnFail(t,r),this}showVersion(t){return Ni("[string|function]",[t],arguments.length),Ze(this,Bo,"f").showVersion(t),this}skipValidation(t){return Ni("<array|string>",[t],arguments.length),this[hD]("skipValidation",t),this}strict(t){return Ni("[boolean]",[t],arguments.length),Qi(this,LR,t!==!1,"f"),this}strictCommands(t){return Ni("[boolean]",[t],arguments.length),Qi(this,jR,t!==!1,"f"),this}strictOptions(t){return Ni("[boolean]",[t],arguments.length),Qi(this,MR,t!==!1,"f"),this}string(t){return Ni("<array|string>",[t],arguments.length),this[hD]("string",t),this[UR](t),this}terminalWidth(){return Ni([],0),Ze(this,fo,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return Ni("<object>",[t],arguments.length),Qi(this,NR,!1,"f"),Ze(this,fo,"f").y18n.updateLocale(t),this}usage(t,r,n,o){if(Ni("<string|null|undefined> [string|boolean] [function|object] [function]",[t,r,n,o],arguments.length),r!==void 0){if(qA(t,null,Ze(this,fo,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,r,n,o);throw new ap(".usage() description must start with $0 if being used as alias for .command()")}else return Ze(this,Bo,"f").usage(t),this}usageConfiguration(t){return Ni("<object>",[t],arguments.length),Qi(this,oK,t,"f"),this}version(t,r,n){let o="version";if(Ni("[boolean|string] [string] [string]",[t,r,n],arguments.length),Ze(this,ES,"f")&&(this[Phe](Ze(this,ES,"f")),Ze(this,Bo,"f").version(void 0),Qi(this,ES,null,"f")),arguments.length===0)n=this[TUe](),t=o;else if(arguments.length===1){if(t===!1)return this;n=t,t=o}else arguments.length===2&&(n=r,r=void 0);return Qi(this,ES,typeof t=="string"?t:o,"f"),r=r||Ze(this,Bo,"f").deferY18nLookup("Show version number"),Ze(this,Bo,"f").version(n||void 0),this.boolean(Ze(this,ES,"f")),this.describe(Ze(this,ES,"f"),r),this}wrap(t){return Ni("<number|null|undefined>",[t],arguments.length),Ze(this,Bo,"f").wrap(t),this}[(Ad=new WeakMap,RR=new WeakMap,k5=new WeakMap,Vb=new WeakMap,Cx=new WeakMap,ZJ=new WeakMap,fD=new WeakMap,NR=new WeakMap,eK=new WeakMap,Gb=new WeakMap,tK=new WeakMap,Wb=new WeakMap,bS=new WeakMap,Ix=new WeakMap,Yb=new WeakMap,rK=new WeakMap,S4=new WeakMap,_m=new WeakMap,us=new WeakMap,nK=new WeakMap,iK=new WeakMap,kx=new WeakMap,OR=new WeakMap,C4=new WeakMap,FR=new WeakMap,dD=new WeakMap,sK=new WeakMap,fo=new WeakMap,LR=new WeakMap,jR=new WeakMap,MR=new WeakMap,Bo=new WeakMap,oK=new WeakMap,ES=new WeakMap,Vf=new WeakMap,wUe)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch{}return t}[_Ue](){return{log:(...t)=>{this[aK]()||console.log(...t),Qi(this,Ix,!0,"f"),Ze(this,_m,"f").length&&Qi(this,_m,Ze(this,_m,"f")+`
|
|
592
592
|
`,"f"),Qi(this,_m,Ze(this,_m,"f")+t.join(" "),"f")},error:(...t)=>{this[aK]()||console.error(...t),Qi(this,Ix,!0,"f"),Ze(this,_m,"f").length&&Qi(this,_m,Ze(this,_m,"f")+`
|
|
593
|
-
`,"f"),Qi(this,_m,Ze(this,_m,"f")+t.join(" "),"f")}}}[Phe](t){w4(Ze(this,us,"f")).forEach(r=>{if((o=>o==="configObjects")(r))return;let n=Ze(this,us,"f")[r];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete Ze(this,Bo,"f").getDescriptions()[t]}[SUe](t,r,n){Ze(this,eK,"f")[n]||(Ze(this,fo,"f").process.emitWarning(t,r),Ze(this,eK,"f")[n]=!0)}[CUe](){Ze(this,tK,"f").push({options:Ze(this,us,"f"),configObjects:Ze(this,us,"f").configObjects.slice(0),exitProcess:Ze(this,Gb,"f"),groups:Ze(this,bS,"f"),strict:Ze(this,LR,"f"),strictCommands:Ze(this,jR,"f"),strictOptions:Ze(this,MR,"f"),completionCommand:Ze(this,Cx,"f"),output:Ze(this,_m,"f"),exitError:Ze(this,fD,"f"),hasOutput:Ze(this,Ix,"f"),parsed:this.parsed,parseFn:Ze(this,kx,"f"),parseContext:Ze(this,OR,"f")}),Ze(this,Bo,"f").freeze(),Ze(this,Vf,"f").freeze(),Ze(this,Ad,"f").freeze(),Ze(this,Wb,"f").freeze()}[IUe](){let t="",r;return/\b(node|iojs|electron)(\.exe)?$/.test(Ze(this,fo,"f").process.argv()[0])?r=Ze(this,fo,"f").process.argv().slice(1,2):r=Ze(this,fo,"f").process.argv().slice(0,1),t=r.map(n=>{let o=this[QUe](Ze(this,RR,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&o.length<n.length?o:n}).join(" ").trim(),Ze(this,fo,"f").getEnv("_")&&Ze(this,fo,"f").getProcessArgvBin()===Ze(this,fo,"f").getEnv("_")&&(t=Ze(this,fo,"f").getEnv("_").replace(`${Ze(this,fo,"f").path.dirname(Ze(this,fo,"f").process.execPath())}/`,"")),t}[QR](){return Ze(this,iK,"f")}[kUe](){return Ze(this,oK,"f")}[Rhe](){if(!Ze(this,NR,"f"))return;let t=Ze(this,fo,"f").getEnv("LC_ALL")||Ze(this,fo,"f").getEnv("LC_MESSAGES")||Ze(this,fo,"f").getEnv("LANG")||Ze(this,fo,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[TUe](){return this[Nhe]().version||"unknown"}[DUe](t){let r=t["--"]?t["--"]:t._;for(let n=0,o;(o=r[n])!==void 0;n++)Ze(this,fo,"f").Parser.looksLikeNumber(o)&&Number.isSafeInteger(Math.floor(parseFloat(`${o}`)))&&(r[n]=Number(o));return t}[Nhe](t){let r=t||"*";if(Ze(this,C4,"f")[r])return Ze(this,C4,"f")[r];let n={};try{let o=t||Ze(this,fo,"f").mainFilename;!t&&Ze(this,fo,"f").path.extname(o)&&(o=Ze(this,fo,"f").path.dirname(o));let s=Ze(this,fo,"f").findUp(o,(c,u)=>{if(u.includes("package.json"))return"package.json"});qA(s,void 0,Ze(this,fo,"f")),n=JSON.parse(Ze(this,fo,"f").readFileSync(s,"utf8"))}catch{}return Ze(this,C4,"f")[r]=n||{},Ze(this,C4,"f")[r]}[hD](t,r){r=[].concat(r),r.forEach(n=>{n=this[Lhe](n),Ze(this,us,"f")[t].push(n)})}[I4](t,r,n,o){this[Fhe](t,r,n,o,(s,c,u)=>{Ze(this,us,"f")[s][c]=u})}[Ohe](t,r,n,o){this[Fhe](t,r,n,o,(s,c,u)=>{Ze(this,us,"f")[s][c]=(Ze(this,us,"f")[s][c]||[]).concat(u)})}[Fhe](t,r,n,o,s){if(Array.isArray(n))n.forEach(c=>{t(c,o)});else if((c=>typeof c=="object")(n))for(let c of w4(n))t(c,n[c]);else s(r,this[Lhe](n),o)}[Lhe](t){return t==="__proto__"?"___proto___":t}[jhe](t,r){return this[I4](this[jhe].bind(this),"key",t,r),this}[Mhe](){var t,r,n,o,s,c,u,p,f,h,m,y;let v=Ze(this,tK,"f").pop();qA(v,void 0,Ze(this,fo,"f"));let A;t=this,r=this,n=this,o=this,s=this,c=this,u=this,p=this,f=this,h=this,m=this,y=this,{options:{set value(C){Qi(t,us,C,"f")}}.value,configObjects:A,exitProcess:{set value(C){Qi(r,Gb,C,"f")}}.value,groups:{set value(C){Qi(n,bS,C,"f")}}.value,output:{set value(C){Qi(o,_m,C,"f")}}.value,exitError:{set value(C){Qi(s,fD,C,"f")}}.value,hasOutput:{set value(C){Qi(c,Ix,C,"f")}}.value,parsed:this.parsed,strict:{set value(C){Qi(u,LR,C,"f")}}.value,strictCommands:{set value(C){Qi(p,jR,C,"f")}}.value,strictOptions:{set value(C){Qi(f,MR,C,"f")}}.value,completionCommand:{set value(C){Qi(h,Cx,C,"f")}}.value,parseFn:{set value(C){Qi(m,kx,C,"f")}}.value,parseContext:{set value(C){Qi(y,OR,C,"f")}}.value}=v,Ze(this,us,"f").configObjects=A,Ze(this,Bo,"f").unfreeze(),Ze(this,Vf,"f").unfreeze(),Ze(this,Ad,"f").unfreeze(),Ze(this,Wb,"f").unfreeze()}[BUe](t,r){return PR(r,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[PUe].bind(this),getContext:this[RUe].bind(this),getHasOutput:this[NUe].bind(this),getLoggerInstance:this[OUe].bind(this),getParseContext:this[FUe].bind(this),getParserConfiguration:this[QR].bind(this),getUsageConfiguration:this[kUe].bind(this),getUsageInstance:this[LUe].bind(this),getValidationInstance:this[jUe].bind(this),hasParseCallback:this[aK].bind(this),isGlobalContext:this[MUe].bind(this),postProcess:this[qR].bind(this),reset:this[Qhe].bind(this),runValidation:this[qhe].bind(this),runYargsParserAndExecuteCommands:this[T5].bind(this),setHasOutput:this[qUe].bind(this)}}[PUe](){return Ze(this,Ad,"f")}[RUe](){return Ze(this,k5,"f")}[NUe](){return Ze(this,Ix,"f")}[OUe](){return Ze(this,S4,"f")}[FUe](){return Ze(this,OR,"f")||{}}[LUe](){return Ze(this,Bo,"f")}[jUe](){return Ze(this,Vf,"f")}[aK](){return!!Ze(this,kx,"f")}[MUe](){return Ze(this,rK,"f")}[qR](t,r,n,o){return n||cp(t)||(r||(t=this[wUe](t)),(this[QR]()["parse-positional-numbers"]||this[QR]()["parse-positional-numbers"]===void 0)&&(t=this[DUe](t)),o&&(t=BR(t,this,Ze(this,Wb,"f").getMiddleware(),!1))),t}[Qhe](t={}){Qi(this,us,Ze(this,us,"f")||{},"f");let r={};r.local=Ze(this,us,"f").local||[],r.configObjects=Ze(this,us,"f").configObjects||[];let n={};r.local.forEach(c=>{n[c]=!0,(t[c]||[]).forEach(u=>{n[u]=!0})}),Object.assign(Ze(this,FR,"f"),Object.keys(Ze(this,bS,"f")).reduce((c,u)=>{let p=Ze(this,bS,"f")[u].filter(f=>!(f in n));return p.length>0&&(c[u]=p),c},{})),Qi(this,bS,{},"f");let o=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return o.forEach(c=>{r[c]=(Ze(this,us,"f")[c]||[]).filter(u=>!n[u])}),s.forEach(c=>{r[c]=lD(Ze(this,us,"f")[c],u=>!n[u])}),r.envPrefix=Ze(this,us,"f").envPrefix,Qi(this,us,r,"f"),Qi(this,Bo,Ze(this,Bo,"f")?Ze(this,Bo,"f").reset(n):gUe(this,Ze(this,fo,"f")),"f"),Qi(this,Vf,Ze(this,Vf,"f")?Ze(this,Vf,"f").reset(n):EUe(this,Ze(this,Bo,"f"),Ze(this,fo,"f")),"f"),Qi(this,Ad,Ze(this,Ad,"f")?Ze(this,Ad,"f").reset():dUe(Ze(this,Bo,"f"),Ze(this,Vf,"f"),Ze(this,Wb,"f"),Ze(this,fo,"f")),"f"),Ze(this,Vb,"f")||Qi(this,Vb,vUe(this,Ze(this,Bo,"f"),Ze(this,Ad,"f"),Ze(this,fo,"f")),"f"),Ze(this,Wb,"f").reset(),Qi(this,Cx,null,"f"),Qi(this,_m,"","f"),Qi(this,fD,null,"f"),Qi(this,Ix,!1,"f"),this.parsed=!1,this}[QUe](t,r){return Ze(this,fo,"f").path.relative(t,r)}[T5](t,r,n,o=0,s=!1){let c=!!n||s;t=t||Ze(this,dD,"f"),Ze(this,us,"f").__=Ze(this,fo,"f").y18n.__,Ze(this,us,"f").configuration=this[QR]();let u=!!Ze(this,us,"f").configuration["populate--"],p=Object.assign({},Ze(this,us,"f").configuration,{"populate--":!0}),f=Ze(this,fo,"f").Parser.detailed(t,Object.assign({},Ze(this,us,"f"),{configuration:{"parse-positional-numbers":!1,...p}})),h=Object.assign(f.argv,Ze(this,OR,"f")),m,y=f.aliases,v=!1,A=!1;Object.keys(h).forEach(C=>{C===Ze(this,Yb,"f")&&h[C]?v=!0:C===Ze(this,ES,"f")&&h[C]&&(A=!0)}),h.$0=this.$0,this.parsed=f,o===0&&Ze(this,Bo,"f").clearCachedHelpMessage();try{if(this[Rhe](),r)return this[qR](h,u,!!n,!1);Ze(this,Yb,"f")&&[Ze(this,Yb,"f")].concat(y[Ze(this,Yb,"f")]||[]).filter(Q=>Q.length>1).includes(""+h._[h._.length-1])&&(h._.pop(),v=!0),Qi(this,rK,!1,"f");let C=Ze(this,Ad,"f").getCommands(),w=Ze(this,Vb,"f").completionKey in h,k=v||w||s;if(h._.length){if(C.length){let N;for(let Q=o||0,L;h._[Q]!==void 0;Q++)if(L=String(h._[Q]),C.includes(L)&&L!==Ze(this,Cx,"f")){let H=Ze(this,Ad,"f").runCommand(L,this,f,Q+1,s,v||A||s);return this[qR](H,u,!!n,!1)}else if(!N&&L!==Ze(this,Cx,"f")){N=L;break}!Ze(this,Ad,"f").hasDefaultCommand()&&Ze(this,sK,"f")&&N&&!k&&Ze(this,Vf,"f").recommendCommands(N,C)}Ze(this,Cx,"f")&&h._.includes(Ze(this,Cx,"f"))&&!w&&(Ze(this,Gb,"f")&&pD(!0),this.showCompletionScript(),this.exit(0))}if(Ze(this,Ad,"f").hasDefaultCommand()&&!k){let N=Ze(this,Ad,"f").runCommand(null,this,f,0,s,v||A||s);return this[qR](N,u,!!n,!1)}if(w){Ze(this,Gb,"f")&&pD(!0),t=[].concat(t);let N=t.slice(t.indexOf(`--${Ze(this,Vb,"f").completionKey}`)+1);return Ze(this,Vb,"f").getCompletion(N,(Q,L)=>{if(Q)throw new ap(Q.message);(L||[]).forEach(H=>{Ze(this,S4,"f").log(H)}),this.exit(0)}),this[qR](h,!u,!!n,!1)}if(Ze(this,Ix,"f")||(v?(Ze(this,Gb,"f")&&pD(!0),c=!0,this.showHelp("log"),this.exit(0)):A&&(Ze(this,Gb,"f")&&pD(!0),c=!0,Ze(this,Bo,"f").showVersion("log"),this.exit(0))),!c&&Ze(this,us,"f").skipValidation.length>0&&(c=Object.keys(h).some(N=>Ze(this,us,"f").skipValidation.indexOf(N)>=0&&h[N]===!0)),!c){if(f.error)throw new ap(f.error.message);if(!w){let N=this[qhe](y,{},f.error);n||(m=BR(h,this,Ze(this,Wb,"f").getMiddleware(),!0)),m=this[BUe](N,m!=null?m:h),cp(m)&&!n&&(m=m.then(()=>BR(h,this,Ze(this,Wb,"f").getMiddleware(),!1)))}}}catch(C){if(C instanceof ap)Ze(this,Bo,"f").fail(C.message,C);else throw C}return this[qR](m!=null?m:h,u,!!n,!0)}[qhe](t,r,n,o){let s={...this.getDemandedOptions()};return c=>{if(n)throw new ap(n.message);Ze(this,Vf,"f").nonOptionCount(c),Ze(this,Vf,"f").requiredArguments(c,s);let u=!1;Ze(this,jR,"f")&&(u=Ze(this,Vf,"f").unknownCommands(c)),Ze(this,LR,"f")&&!u?Ze(this,Vf,"f").unknownArguments(c,t,r,!!o):Ze(this,MR,"f")&&Ze(this,Vf,"f").unknownArguments(c,t,{},!1,!1),Ze(this,Vf,"f").limitedChoices(c),Ze(this,Vf,"f").implications(c),Ze(this,Vf,"f").conflicting(c)}}[qUe](){Qi(this,Ix,!0,"f")}[UR](t){if(typeof t=="string")Ze(this,us,"f").key[t]=!0;else for(let r of t)Ze(this,us,"f").key[r]=!0}};function hUe(e){return!!e&&typeof e.getInternalMethods=="function"}var Kpr=UUe(Che),$Ue=Kpr;var i1={name:"edgeone",version:"1.6.28-beta.11",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.1","@edgeone/opennextjs-pages":"0.2.10","@edgeone/pages-agent-toolkit":"0.1.0-beta.6","@edgeone/pages-blob":"^0.0.16",chokidar:"^4.0.1",esbuild:"^0.19.2","esbuild-plugin-polyfill-node":"^0.3.0","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.1","@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/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",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"]}};var CN=Nt(require("fs")),IN=Nt(require("path")),A$e=require("module"),y$e=require("url");DI();jme();ll();function v$e(e){e.command("compile","Compile edgeone.config.ts to edgeone.json",()=>{},()=>QAr()).command("validate","Validate the current config file",()=>{},()=>qAr()).command("schema","Write edgeone.schema.json for IDE validation",()=>{},()=>UAr())}async function QAr(e=process.cwd()){var u;let[t,r]=K5(e);if(!r){console.error("No config file found (edgeone.config.ts / edgeone.json / edgeone.json5)."),process.exitCode=1;return}if(t.endsWith(".json")||t.endsWith(".json5")){console.log("Config is already JSON, nothing to compile.");return}let n;try{n=SN(e)}catch(p){console.error((u=p==null?void 0:p.message)!=null?u:p),process.exitCode=1;return}let[o,s]=H5(n,["root"]);if((s||[]).forEach(p=>console.log(`error in ${p.path.join(".")}: ${p.message}`)),s!=null&&s.length){process.exitCode=1;return}let c=IN.default.join(e,"edgeone.json");await g$e(e,o),console.log(`Compiled to ${c}`)}function qAr(e=process.cwd()){var u;let[t,r]=K5(e);if(!r){console.error("No config file found (edgeone.config.ts / edgeone.json / edgeone.json5)."),process.exitCode=1;return}console.log(`
|
|
593
|
+
`,"f"),Qi(this,_m,Ze(this,_m,"f")+t.join(" "),"f")}}}[Phe](t){w4(Ze(this,us,"f")).forEach(r=>{if((o=>o==="configObjects")(r))return;let n=Ze(this,us,"f")[r];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete Ze(this,Bo,"f").getDescriptions()[t]}[SUe](t,r,n){Ze(this,eK,"f")[n]||(Ze(this,fo,"f").process.emitWarning(t,r),Ze(this,eK,"f")[n]=!0)}[CUe](){Ze(this,tK,"f").push({options:Ze(this,us,"f"),configObjects:Ze(this,us,"f").configObjects.slice(0),exitProcess:Ze(this,Gb,"f"),groups:Ze(this,bS,"f"),strict:Ze(this,LR,"f"),strictCommands:Ze(this,jR,"f"),strictOptions:Ze(this,MR,"f"),completionCommand:Ze(this,Cx,"f"),output:Ze(this,_m,"f"),exitError:Ze(this,fD,"f"),hasOutput:Ze(this,Ix,"f"),parsed:this.parsed,parseFn:Ze(this,kx,"f"),parseContext:Ze(this,OR,"f")}),Ze(this,Bo,"f").freeze(),Ze(this,Vf,"f").freeze(),Ze(this,Ad,"f").freeze(),Ze(this,Wb,"f").freeze()}[IUe](){let t="",r;return/\b(node|iojs|electron)(\.exe)?$/.test(Ze(this,fo,"f").process.argv()[0])?r=Ze(this,fo,"f").process.argv().slice(1,2):r=Ze(this,fo,"f").process.argv().slice(0,1),t=r.map(n=>{let o=this[QUe](Ze(this,RR,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&o.length<n.length?o:n}).join(" ").trim(),Ze(this,fo,"f").getEnv("_")&&Ze(this,fo,"f").getProcessArgvBin()===Ze(this,fo,"f").getEnv("_")&&(t=Ze(this,fo,"f").getEnv("_").replace(`${Ze(this,fo,"f").path.dirname(Ze(this,fo,"f").process.execPath())}/`,"")),t}[QR](){return Ze(this,iK,"f")}[kUe](){return Ze(this,oK,"f")}[Rhe](){if(!Ze(this,NR,"f"))return;let t=Ze(this,fo,"f").getEnv("LC_ALL")||Ze(this,fo,"f").getEnv("LC_MESSAGES")||Ze(this,fo,"f").getEnv("LANG")||Ze(this,fo,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[TUe](){return this[Nhe]().version||"unknown"}[DUe](t){let r=t["--"]?t["--"]:t._;for(let n=0,o;(o=r[n])!==void 0;n++)Ze(this,fo,"f").Parser.looksLikeNumber(o)&&Number.isSafeInteger(Math.floor(parseFloat(`${o}`)))&&(r[n]=Number(o));return t}[Nhe](t){let r=t||"*";if(Ze(this,C4,"f")[r])return Ze(this,C4,"f")[r];let n={};try{let o=t||Ze(this,fo,"f").mainFilename;!t&&Ze(this,fo,"f").path.extname(o)&&(o=Ze(this,fo,"f").path.dirname(o));let s=Ze(this,fo,"f").findUp(o,(c,u)=>{if(u.includes("package.json"))return"package.json"});qA(s,void 0,Ze(this,fo,"f")),n=JSON.parse(Ze(this,fo,"f").readFileSync(s,"utf8"))}catch{}return Ze(this,C4,"f")[r]=n||{},Ze(this,C4,"f")[r]}[hD](t,r){r=[].concat(r),r.forEach(n=>{n=this[Lhe](n),Ze(this,us,"f")[t].push(n)})}[I4](t,r,n,o){this[Fhe](t,r,n,o,(s,c,u)=>{Ze(this,us,"f")[s][c]=u})}[Ohe](t,r,n,o){this[Fhe](t,r,n,o,(s,c,u)=>{Ze(this,us,"f")[s][c]=(Ze(this,us,"f")[s][c]||[]).concat(u)})}[Fhe](t,r,n,o,s){if(Array.isArray(n))n.forEach(c=>{t(c,o)});else if((c=>typeof c=="object")(n))for(let c of w4(n))t(c,n[c]);else s(r,this[Lhe](n),o)}[Lhe](t){return t==="__proto__"?"___proto___":t}[jhe](t,r){return this[I4](this[jhe].bind(this),"key",t,r),this}[Mhe](){var t,r,n,o,s,c,u,p,f,h,m,y;let v=Ze(this,tK,"f").pop();qA(v,void 0,Ze(this,fo,"f"));let A;t=this,r=this,n=this,o=this,s=this,c=this,u=this,p=this,f=this,h=this,m=this,y=this,{options:{set value(C){Qi(t,us,C,"f")}}.value,configObjects:A,exitProcess:{set value(C){Qi(r,Gb,C,"f")}}.value,groups:{set value(C){Qi(n,bS,C,"f")}}.value,output:{set value(C){Qi(o,_m,C,"f")}}.value,exitError:{set value(C){Qi(s,fD,C,"f")}}.value,hasOutput:{set value(C){Qi(c,Ix,C,"f")}}.value,parsed:this.parsed,strict:{set value(C){Qi(u,LR,C,"f")}}.value,strictCommands:{set value(C){Qi(p,jR,C,"f")}}.value,strictOptions:{set value(C){Qi(f,MR,C,"f")}}.value,completionCommand:{set value(C){Qi(h,Cx,C,"f")}}.value,parseFn:{set value(C){Qi(m,kx,C,"f")}}.value,parseContext:{set value(C){Qi(y,OR,C,"f")}}.value}=v,Ze(this,us,"f").configObjects=A,Ze(this,Bo,"f").unfreeze(),Ze(this,Vf,"f").unfreeze(),Ze(this,Ad,"f").unfreeze(),Ze(this,Wb,"f").unfreeze()}[BUe](t,r){return PR(r,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[PUe].bind(this),getContext:this[RUe].bind(this),getHasOutput:this[NUe].bind(this),getLoggerInstance:this[OUe].bind(this),getParseContext:this[FUe].bind(this),getParserConfiguration:this[QR].bind(this),getUsageConfiguration:this[kUe].bind(this),getUsageInstance:this[LUe].bind(this),getValidationInstance:this[jUe].bind(this),hasParseCallback:this[aK].bind(this),isGlobalContext:this[MUe].bind(this),postProcess:this[qR].bind(this),reset:this[Qhe].bind(this),runValidation:this[qhe].bind(this),runYargsParserAndExecuteCommands:this[T5].bind(this),setHasOutput:this[qUe].bind(this)}}[PUe](){return Ze(this,Ad,"f")}[RUe](){return Ze(this,k5,"f")}[NUe](){return Ze(this,Ix,"f")}[OUe](){return Ze(this,S4,"f")}[FUe](){return Ze(this,OR,"f")||{}}[LUe](){return Ze(this,Bo,"f")}[jUe](){return Ze(this,Vf,"f")}[aK](){return!!Ze(this,kx,"f")}[MUe](){return Ze(this,rK,"f")}[qR](t,r,n,o){return n||cp(t)||(r||(t=this[wUe](t)),(this[QR]()["parse-positional-numbers"]||this[QR]()["parse-positional-numbers"]===void 0)&&(t=this[DUe](t)),o&&(t=BR(t,this,Ze(this,Wb,"f").getMiddleware(),!1))),t}[Qhe](t={}){Qi(this,us,Ze(this,us,"f")||{},"f");let r={};r.local=Ze(this,us,"f").local||[],r.configObjects=Ze(this,us,"f").configObjects||[];let n={};r.local.forEach(c=>{n[c]=!0,(t[c]||[]).forEach(u=>{n[u]=!0})}),Object.assign(Ze(this,FR,"f"),Object.keys(Ze(this,bS,"f")).reduce((c,u)=>{let p=Ze(this,bS,"f")[u].filter(f=>!(f in n));return p.length>0&&(c[u]=p),c},{})),Qi(this,bS,{},"f");let o=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return o.forEach(c=>{r[c]=(Ze(this,us,"f")[c]||[]).filter(u=>!n[u])}),s.forEach(c=>{r[c]=lD(Ze(this,us,"f")[c],u=>!n[u])}),r.envPrefix=Ze(this,us,"f").envPrefix,Qi(this,us,r,"f"),Qi(this,Bo,Ze(this,Bo,"f")?Ze(this,Bo,"f").reset(n):gUe(this,Ze(this,fo,"f")),"f"),Qi(this,Vf,Ze(this,Vf,"f")?Ze(this,Vf,"f").reset(n):EUe(this,Ze(this,Bo,"f"),Ze(this,fo,"f")),"f"),Qi(this,Ad,Ze(this,Ad,"f")?Ze(this,Ad,"f").reset():dUe(Ze(this,Bo,"f"),Ze(this,Vf,"f"),Ze(this,Wb,"f"),Ze(this,fo,"f")),"f"),Ze(this,Vb,"f")||Qi(this,Vb,vUe(this,Ze(this,Bo,"f"),Ze(this,Ad,"f"),Ze(this,fo,"f")),"f"),Ze(this,Wb,"f").reset(),Qi(this,Cx,null,"f"),Qi(this,_m,"","f"),Qi(this,fD,null,"f"),Qi(this,Ix,!1,"f"),this.parsed=!1,this}[QUe](t,r){return Ze(this,fo,"f").path.relative(t,r)}[T5](t,r,n,o=0,s=!1){let c=!!n||s;t=t||Ze(this,dD,"f"),Ze(this,us,"f").__=Ze(this,fo,"f").y18n.__,Ze(this,us,"f").configuration=this[QR]();let u=!!Ze(this,us,"f").configuration["populate--"],p=Object.assign({},Ze(this,us,"f").configuration,{"populate--":!0}),f=Ze(this,fo,"f").Parser.detailed(t,Object.assign({},Ze(this,us,"f"),{configuration:{"parse-positional-numbers":!1,...p}})),h=Object.assign(f.argv,Ze(this,OR,"f")),m,y=f.aliases,v=!1,A=!1;Object.keys(h).forEach(C=>{C===Ze(this,Yb,"f")&&h[C]?v=!0:C===Ze(this,ES,"f")&&h[C]&&(A=!0)}),h.$0=this.$0,this.parsed=f,o===0&&Ze(this,Bo,"f").clearCachedHelpMessage();try{if(this[Rhe](),r)return this[qR](h,u,!!n,!1);Ze(this,Yb,"f")&&[Ze(this,Yb,"f")].concat(y[Ze(this,Yb,"f")]||[]).filter(Q=>Q.length>1).includes(""+h._[h._.length-1])&&(h._.pop(),v=!0),Qi(this,rK,!1,"f");let C=Ze(this,Ad,"f").getCommands(),w=Ze(this,Vb,"f").completionKey in h,k=v||w||s;if(h._.length){if(C.length){let N;for(let Q=o||0,L;h._[Q]!==void 0;Q++)if(L=String(h._[Q]),C.includes(L)&&L!==Ze(this,Cx,"f")){let H=Ze(this,Ad,"f").runCommand(L,this,f,Q+1,s,v||A||s);return this[qR](H,u,!!n,!1)}else if(!N&&L!==Ze(this,Cx,"f")){N=L;break}!Ze(this,Ad,"f").hasDefaultCommand()&&Ze(this,sK,"f")&&N&&!k&&Ze(this,Vf,"f").recommendCommands(N,C)}Ze(this,Cx,"f")&&h._.includes(Ze(this,Cx,"f"))&&!w&&(Ze(this,Gb,"f")&&pD(!0),this.showCompletionScript(),this.exit(0))}if(Ze(this,Ad,"f").hasDefaultCommand()&&!k){let N=Ze(this,Ad,"f").runCommand(null,this,f,0,s,v||A||s);return this[qR](N,u,!!n,!1)}if(w){Ze(this,Gb,"f")&&pD(!0),t=[].concat(t);let N=t.slice(t.indexOf(`--${Ze(this,Vb,"f").completionKey}`)+1);return Ze(this,Vb,"f").getCompletion(N,(Q,L)=>{if(Q)throw new ap(Q.message);(L||[]).forEach(H=>{Ze(this,S4,"f").log(H)}),this.exit(0)}),this[qR](h,!u,!!n,!1)}if(Ze(this,Ix,"f")||(v?(Ze(this,Gb,"f")&&pD(!0),c=!0,this.showHelp("log"),this.exit(0)):A&&(Ze(this,Gb,"f")&&pD(!0),c=!0,Ze(this,Bo,"f").showVersion("log"),this.exit(0))),!c&&Ze(this,us,"f").skipValidation.length>0&&(c=Object.keys(h).some(N=>Ze(this,us,"f").skipValidation.indexOf(N)>=0&&h[N]===!0)),!c){if(f.error)throw new ap(f.error.message);if(!w){let N=this[qhe](y,{},f.error);n||(m=BR(h,this,Ze(this,Wb,"f").getMiddleware(),!0)),m=this[BUe](N,m!=null?m:h),cp(m)&&!n&&(m=m.then(()=>BR(h,this,Ze(this,Wb,"f").getMiddleware(),!1)))}}}catch(C){if(C instanceof ap)Ze(this,Bo,"f").fail(C.message,C);else throw C}return this[qR](m!=null?m:h,u,!!n,!0)}[qhe](t,r,n,o){let s={...this.getDemandedOptions()};return c=>{if(n)throw new ap(n.message);Ze(this,Vf,"f").nonOptionCount(c),Ze(this,Vf,"f").requiredArguments(c,s);let u=!1;Ze(this,jR,"f")&&(u=Ze(this,Vf,"f").unknownCommands(c)),Ze(this,LR,"f")&&!u?Ze(this,Vf,"f").unknownArguments(c,t,r,!!o):Ze(this,MR,"f")&&Ze(this,Vf,"f").unknownArguments(c,t,{},!1,!1),Ze(this,Vf,"f").limitedChoices(c),Ze(this,Vf,"f").implications(c),Ze(this,Vf,"f").conflicting(c)}}[qUe](){Qi(this,Ix,!0,"f")}[UR](t){if(typeof t=="string")Ze(this,us,"f").key[t]=!0;else for(let r of t)Ze(this,us,"f").key[r]=!0}};function hUe(e){return!!e&&typeof e.getInternalMethods=="function"}var Kpr=UUe(Che),$Ue=Kpr;var i1={name:"edgeone",version:"1.6.28-beta.12",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.1","@edgeone/opennextjs-pages":"0.2.10","@edgeone/pages-agent-toolkit":"0.1.0-beta.6","@edgeone/pages-blob":"^0.0.16",chokidar:"^4.0.1",esbuild:"^0.19.2","esbuild-plugin-polyfill-node":"^0.3.0","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.1","@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/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",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"]}};var CN=Nt(require("fs")),IN=Nt(require("path")),A$e=require("module"),y$e=require("url");DI();jme();ll();function v$e(e){e.command("compile","Compile edgeone.config.ts to edgeone.json",()=>{},()=>QAr()).command("validate","Validate the current config file",()=>{},()=>qAr()).command("schema","Write edgeone.schema.json for IDE validation",()=>{},()=>UAr())}async function QAr(e=process.cwd()){var u;let[t,r]=K5(e);if(!r){console.error("No config file found (edgeone.config.ts / edgeone.json / edgeone.json5)."),process.exitCode=1;return}if(t.endsWith(".json")||t.endsWith(".json5")){console.log("Config is already JSON, nothing to compile.");return}let n;try{n=SN(e)}catch(p){console.error((u=p==null?void 0:p.message)!=null?u:p),process.exitCode=1;return}let[o,s]=H5(n,["root"]);if((s||[]).forEach(p=>console.log(`error in ${p.path.join(".")}: ${p.message}`)),s!=null&&s.length){process.exitCode=1;return}let c=IN.default.join(e,"edgeone.json");await g$e(e,o),console.log(`Compiled to ${c}`)}function qAr(e=process.cwd()){var u;let[t,r]=K5(e);if(!r){console.error("No config file found (edgeone.config.ts / edgeone.json / edgeone.json5)."),process.exitCode=1;return}console.log(`
|
|
594
594
|
> Start validating the configuration file:`);let n;try{n=SN(e)}catch(p){console.error((u=p==null?void 0:p.message)!=null?u:p),process.exitCode=1;return}let[o,s,c]=H5(n,["root"]);(c||[]).forEach(p=>console.warn(p.message)),s!=null&&s.length?(s.forEach(p=>console.log(`error in ${p.path.join(".")}: ${p.message}`)),process.exitCode=1):console.log("none error in configuration file"),console.log(`End validating!
|
|
595
595
|
`)}function UAr(e=process.cwd()){let t;try{let n=(0,A$e.createRequire)("file:///Users/cc/Desktop/Pages/Code/ef-dev-tools/packages/tef-cli/edgeone-dist/cli.js"),o=IN.default.join(IN.default.dirname((0,y$e.fileURLToPath)("file:///Users/cc/Desktop/Pages/Code/ef-dev-tools/packages/tef-cli/edgeone-dist/cli.js")),"edgeone.schema.json");t=CN.default.existsSync(o)?JSON.parse(CN.default.readFileSync(o,"utf-8")):n("@edgeone/types/edgeone.schema.json")}catch(n){console.error(`Failed to load edgeone.schema.json: ${n==null?void 0:n.message}`),process.exitCode=1;return}let r=IN.default.join(e,h$e);gD(r,t),console.log(`Schema written to ${r}.`),$Ar(e)}function $Ar(e){let t=IN.default.join(e,".vscode"),r=IN.default.join(t,"settings.json"),n={fileMatch:["edgeone.json"],url:"./edgeone.schema.json"},o={};try{CN.default.existsSync(r)&&(o=JSON.parse(CN.default.readFileSync(r,"utf-8")),(typeof o!="object"||o===null||Array.isArray(o))&&(console.warn(`[schema] ${r} is not a JSON object, backing up as settings.json.bak`),CN.default.copyFileSync(r,`${r}.bak`),o={}))}catch(u){console.warn(`[schema] Failed to parse ${r}: ${u==null?void 0:u.message}; skipping VS Code association`);return}let s=Array.isArray(o["json.schemas"])?o["json.schemas"]:[],c=s.find(u=>Array.isArray(u==null?void 0:u.fileMatch)&&u.fileMatch.includes("edgeone.json"));c?c.url=n.url:s.push({...n}),o["json.schemas"]=s,CN.default.mkdirSync(t,{recursive:!0}),gD(r,o),console.log(`Registered VS Code schema association in ${r} \u2014 manual edgeone.json files will get hints without a $schema field.`)}var Xve=Nt(pl()),Zve=Nt(f3()),exe=Nt(W0e());function J9(e,t){return function(){return e.apply(t,arguments)}}var{toString:qEr}=Object.prototype,{getPrototypeOf:PX}=Object,{iterator:RX,toStringTag:oWe}=Symbol,NX=(e=>t=>{let r=qEr.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),g1=e=>(e=e.toLowerCase(),t=>NX(t)===e),OX=e=>t=>typeof t===e,{isArray:QN}=Array,m3=OX("undefined");function g3(e){return e!==null&&!m3(e)&&e.constructor!==null&&!m3(e.constructor)&&mv(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var aWe=g1("ArrayBuffer");function UEr(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&aWe(e.buffer),t}var $Er=OX("string"),mv=OX("function"),cWe=OX("number"),K9=e=>e!==null&&typeof e=="object",zEr=e=>e===!0||e===!1,BX=e=>{if(NX(e)!=="object")return!1;let t=PX(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(oWe in e)&&!(RX in e)},HEr=e=>{if(!K9(e)||g3(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},VEr=g1("Date"),GEr=g1("File"),WEr=e=>!!(e&&typeof e.uri<"u"),YEr=e=>e&&typeof e.getParts<"u",JEr=g1("Blob"),KEr=g1("FileList"),XEr=e=>K9(e)&&mv(e.pipe);function ZEr(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}var iWe=ZEr(),sWe=typeof iWe.FormData<"u"?iWe.FormData:void 0,ewr=e=>{if(!e)return!1;if(sWe&&e instanceof sWe)return!0;let t=PX(e);if(!t||t===Object.prototype||!mv(e.append))return!1;let r=NX(e);return r==="formdata"||r==="object"&&mv(e.toString)&&e.toString()==="[object FormData]"},twr=g1("URLSearchParams"),[rwr,nwr,iwr,swr]=["ReadableStream","Request","Response","Headers"].map(g1),owr=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function X9(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,o;if(typeof e!="object"&&(e=[e]),QN(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{if(g3(e))return;let s=r?Object.getOwnPropertyNames(e):Object.keys(e),c=s.length,u;for(n=0;n<c;n++)u=s[n],t.call(null,e[u],u,e)}}function uWe(e,t){if(g3(e))return null;t=t.toLowerCase();let r=Object.keys(e),n=r.length,o;for(;n-- >0;)if(o=r[n],t===o.toLowerCase())return o;return null}var MN=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,lWe=e=>!m3(e)&&e!==MN;function Y0e(...e){let{caseless:t,skipUndefined:r}=lWe(this)&&this||{},n={},o=(s,c)=>{if(c==="__proto__"||c==="constructor"||c==="prototype")return;let u=t&&typeof c=="string"&&uWe(n,c)||c,p=J0e(n,u)?n[u]:void 0;BX(p)&&BX(s)?n[u]=Y0e(p,s):BX(s)?n[u]=Y0e({},s):QN(s)?n[u]=s.slice():(!r||!m3(s))&&(n[u]=s)};for(let s=0,c=e.length;s<c;s++){let u=e[s];if(!u||g3(u)||(X9(u,o),typeof u!="object"||QN(u)))continue;let p=Object.getOwnPropertySymbols(u);for(let f=0;f<p.length;f++){let h=p[f];ywr.call(u,h)&&o(u[h],h)}}return n}var awr=(e,t,r,{allOwnKeys:n}={})=>(X9(t,(o,s)=>{r&&mv(o)?Object.defineProperty(e,s,{__proto__:null,value:J9(o,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,s,{__proto__:null,value:o,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),cwr=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),uwr=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),r&&Object.assign(e.prototype,r)},lwr=(e,t,r,n)=>{let o,s,c,u={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)c=o[s],(!n||n(c,e,t))&&!u[c]&&(t[c]=e[c],u[c]=!0);e=r!==!1&&PX(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},pwr=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},fwr=e=>{if(!e)return null;if(QN(e))return e;let t=e.length;if(!cWe(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},dwr=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&PX(Uint8Array)),hwr=(e,t)=>{let n=(e&&e[RX]).call(e),o;for(;(o=n.next())&&!o.done;){let s=o.value;t.call(e,s[0],s[1])}},mwr=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},gwr=g1("HTMLFormElement"),Awr=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,o){return n.toUpperCase()+o}),J0e=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),{propertyIsEnumerable:ywr}=Object.prototype,vwr=g1("RegExp"),pWe=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};X9(r,(o,s)=>{let c;(c=t(o,s,e))!==!1&&(n[s]=c||o)}),Object.defineProperties(e,n)},xwr=e=>{pWe(e,(t,r)=>{if(mv(e)&&["arguments","caller","callee"].includes(r))return!1;let n=e[r];if(mv(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},bwr=(e,t)=>{let r={},n=o=>{o.forEach(s=>{r[s]=!0})};return QN(e)?n(e):n(String(e).split(t)),r},Ewr=()=>{},wwr=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function _wr(e){return!!(e&&mv(e.append)&&e[oWe]==="FormData"&&e[RX])}var Swr=e=>{let t=new WeakSet,r=n=>{if(K9(n)){if(t.has(n))return;if(g3(n))return n;if(!("toJSON"in n)){t.add(n);let o=QN(n)?[]:{};return X9(n,(s,c)=>{let u=r(s);!m3(u)&&(o[c]=u)}),t.delete(n),o}}return n};return r(e)},Cwr=g1("AsyncFunction"),Iwr=e=>e&&(K9(e)||mv(e))&&mv(e.then)&&mv(e.catch),fWe=((e,t)=>e?setImmediate:t?((r,n)=>(MN.addEventListener("message",({source:o,data:s})=>{o===MN&&s===r&&n.length&&n.shift()()},!1),o=>{n.push(o),MN.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",mv(MN.postMessage)),kwr=typeof queueMicrotask<"u"?queueMicrotask.bind(MN):typeof process<"u"&&process.nextTick||fWe,Twr=e=>e!=null&&mv(e[RX]),vt={isArray:QN,isArrayBuffer:aWe,isBuffer:g3,isFormData:ewr,isArrayBufferView:UEr,isString:$Er,isNumber:cWe,isBoolean:zEr,isObject:K9,isPlainObject:BX,isEmptyObject:HEr,isReadableStream:rwr,isRequest:nwr,isResponse:iwr,isHeaders:swr,isUndefined:m3,isDate:VEr,isFile:GEr,isReactNativeBlob:WEr,isReactNative:YEr,isBlob:JEr,isRegExp:vwr,isFunction:mv,isStream:XEr,isURLSearchParams:twr,isTypedArray:dwr,isFileList:KEr,forEach:X9,merge:Y0e,extend:awr,trim:owr,stripBOM:cwr,inherits:uwr,toFlatObject:lwr,kindOf:NX,kindOfTest:g1,endsWith:pwr,toArray:fwr,forEachEntry:hwr,matchAll:mwr,isHTMLForm:gwr,hasOwnProperty:J0e,hasOwnProp:J0e,reduceDescriptors:pWe,freezeMethods:xwr,toObjectSet:bwr,toCamelCase:Awr,noop:Ewr,toFiniteNumber:wwr,findKey:uWe,global:MN,isContextDefined:lWe,isSpecCompliantForm:_wr,toJSONObject:Swr,isAsyncFn:Cwr,isThenable:Iwr,setImmediate:fWe,asap:kwr,isIterable:Twr};var Dwr=vt.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),dWe=e=>{let t={},r,n,o;return e&&e.split(`
|
|
596
596
|
`).forEach(function(c){o=c.indexOf(":"),r=c.substring(0,o).trim().toLowerCase(),n=c.substring(o+1).trim(),!(!r||t[r]&&Dwr[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};function Bwr(e){let t=0,r=e.length;for(;t<r;){let n=e.charCodeAt(t);if(n!==9&&n!==32)break;t+=1}for(;r>t;){let n=e.charCodeAt(r-1);if(n!==9&&n!==32)break;r-=1}return t===0&&r===e.length?e:e.slice(t,r)}var Pwr=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Rwr=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function K0e(e,t){return vt.isArray(e)?e.map(r=>K0e(r,t)):Bwr(String(e).replace(t,""))}var hWe=e=>K0e(e,Pwr),Nwr=e=>K0e(e,Rwr);function A3(e){let t=Object.create(null);return vt.forEach(e.toJSON(),(r,n)=>{t[n]=Nwr(r)}),t}var mWe=Symbol("internals");function Z9(e){return e&&String(e).trim().toLowerCase()}function FX(e){return e===!1||e==null?e:vt.isArray(e)?e.map(FX):hWe(String(e))}function Owr(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}var Fwr=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function X0e(e,t,r,n,o){if(vt.isFunction(n))return n.call(this,t,r);if(o&&(t=r),!!vt.isString(t)){if(vt.isString(n))return t.indexOf(n)!==-1;if(vt.isRegExp(n))return n.test(t)}}function Lwr(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function jwr(e,t){let r=vt.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{__proto__:null,value:function(o,s,c){return this[n].call(this,t,o,s,c)},configurable:!0})})}var y3=class{constructor(t){t&&this.set(t)}set(t,r,n){let o=this;function s(u,p,f){let h=Z9(p);if(!h)return;let m=vt.findKey(o,h);(!m||o[m]===void 0||f===!0||f===void 0&&o[m]!==!1)&&(o[m||p]=FX(u))}let c=(u,p)=>vt.forEach(u,(f,h)=>s(f,h,p));if(vt.isPlainObject(t)||t instanceof this.constructor)c(t,r);else if(vt.isString(t)&&(t=t.trim())&&!Fwr(t))c(dWe(t),r);else if(vt.isObject(t)&&vt.isIterable(t)){let u={},p,f;for(let h of t){if(!vt.isArray(h))throw new TypeError("Object iterator must return a key-value pair");u[f=h[0]]=(p=u[f])?vt.isArray(p)?[...p,h[1]]:[p,h[1]]:h[1]}c(u,r)}else t!=null&&s(r,t,n);return this}get(t,r){if(t=Z9(t),t){let n=vt.findKey(this,t);if(n){let o=this[n];if(!r)return o;if(r===!0)return Owr(o);if(vt.isFunction(r))return r.call(this,o,n);if(vt.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Z9(t),t){let n=vt.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||X0e(this,this[n],n,r)))}return!1}delete(t,r){let n=this,o=!1;function s(c){if(c=Z9(c),c){let u=vt.findKey(n,c);u&&(!r||X0e(n,n[u],u,r))&&(delete n[u],o=!0)}}return vt.isArray(t)?t.forEach(s):s(t),o}clear(t){let r=Object.keys(this),n=r.length,o=!1;for(;n--;){let s=r[n];(!t||X0e(this,this[s],s,t,!0))&&(delete this[s],o=!0)}return o}normalize(t){let r=this,n={};return vt.forEach(this,(o,s)=>{let c=vt.findKey(n,s);if(c){r[c]=FX(o),delete r[s];return}let u=t?Lwr(s):String(s).trim();u!==s&&delete r[s],r[u]=FX(o),n[u]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return vt.forEach(this,(n,o)=>{n!=null&&n!==!1&&(r[o]=t&&vt.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
|
@@ -7643,7 +7643,7 @@ function useLocalAgentMemoryStore() {
|
|
|
7643
7643
|
}
|
|
7644
7644
|
|
|
7645
7645
|
function usePagesBlobTestStsEnvForDev() {
|
|
7646
|
-
process.env.PAGES_BLOB_STS_ENV = ${JSON.stringify("
|
|
7646
|
+
process.env.PAGES_BLOB_STS_ENV = ${JSON.stringify("test")};
|
|
7647
7647
|
}
|
|
7648
7648
|
|
|
7649
7649
|
function getAgentMemoryProjectId() {
|
|
@@ -9270,7 +9270,7 @@ function useLocalInMemoryStore() {
|
|
|
9270
9270
|
return process.env.EDGEONE_AGENT_LOCAL_IN_MEMORY_STORE === '1';
|
|
9271
9271
|
}
|
|
9272
9272
|
function usePagesBlobTestStsEnvForDev() {
|
|
9273
|
-
process.env.PAGES_BLOB_STS_ENV = ${JSON.stringify("
|
|
9273
|
+
process.env.PAGES_BLOB_STS_ENV = ${JSON.stringify("test")};
|
|
9274
9274
|
}
|
|
9275
9275
|
function toAgentStoreName(routePath) {
|
|
9276
9276
|
const normalized = String(routePath || '').replace(/^\\/+|\\/+$/g, '');
|
|
@@ -117458,7 +117458,7 @@ ${p}`)}process.platform!=="win32"&&oi.default.chmodSync(n,"755")}generateMetaJso
|
|
|
117458
117458
|
Update \`scripts.dev\` (or \`edgeone.json devCommand\`) to a real
|
|
117459
117459
|
frontend dev command to silence this warning.`}}return jE("no replacement available, skipping frontend dev server"),{cmd:"",warning:`${Hwt}
|
|
117460
117460
|
Skipping frontend dev server. Set a real frontend dev command in
|
|
117461
|
-
package.json or edgeone.json if you need one.`}}oo();var Skn=Nt($1t(),1),Ckn=Nt(dTe(),1),Ikn=Nt(gTe(),1),Z1t=Nt(ase(),1),kkn=Nt(X1t(),1);var e_t=Z1t.default;oo();var K1=Nt(require("fs")),n8=Nt(require("path"));ul();sk();var _Te={CODE_SIZE:5*1024*1024};function use(e){let t=0;if(!K1.default.existsSync(e))return 0;for(let r of K1.default.readdirSync(e)){let n=n8.default.join(e,r);K1.default.statSync(n).isDirectory()?t+=use(n):t+=1}return t}function lse(e,t){if(!K1.default.existsSync(e))return!1;let r=new Set([".git",".edgeone","node_modules","__pycache__","venv",".venv","dist","build"]);for(let n of K1.default.readdirSync(e,{withFileTypes:!0})){let o=n8.default.join(e,n.name);if(n.isDirectory()){if(r.has(n.name))continue;if(lse(o,t))return!0;continue}let s=o.replace(/\\/g,"/");if(t(s,n.name))return!0}return!1}function yy(e){switch(e){case"node-function":return K1.default.existsSync(fr("cloud-functions"))?lse(fr("cloud-functions"),t=>t.includes("/cloud-functions/")&&I_e(t)):use(fr("node-functions"))>0;case"python-function":return lse(fr("cloud-functions"),(t,r)=>r.endsWith(".py"));case"go-function":return lse(fr("cloud-functions"),(t,r)=>r.endsWith(".go"));case"edge-function":return use(fr("edge-functions"))>0||use(fr("functions"))>0;case"agent-node":{let t=Wp().absolutePath;return r_t(t,/\.(mjs|cjs|js|ts|mts|cts|jsx|tsx)$/)}case"agent-python":{let t=Wp().absolutePath;return n_t(t)}default:return!1}}function STe(e){let t=e.replace(/\\/g,"/"),r=new Set;if((t.startsWith("edge-functions/")||t.startsWith("functions/"))&&!t.endsWith("/")&&r.add("edge-function"),t.startsWith("node-functions/")&&!t.endsWith("/")&&r.add("node-function"),b_e(t)&&!t.endsWith("/")){let o=n8.default.extname(t);o===".py"?r.add("agent-python"):o===".md"?(r.add("agent-node"),r.add("agent-python")):r.add("agent-node")}return t.startsWith("cloud-functions/")&&!t.endsWith("/")&&(I_e(t)&&r.add("node-function"),t.endsWith(".py")&&r.add("python-function"),t.endsWith(".go")&&r.add("go-function")),Array.from(r)}function t_t(e){return new Promise((t,r)=>{let n=new e_t(e);n.on("error",console.error),n.on("open",function(){t(!0)}),n.on("close",function(){Lt("Function log server disconnected")}),n.on("message",function(s){let{logs:c,event_info:u,exceptions:p}=JSON.parse(s.toString());c.forEach(f=>{let{timestamp:h,level:m,content:y}=f;m==="INFO"?JKe(y,h):m==="WARN"?KKe(y,h):m==="ERROR"&&bye(y,h)}),p.forEach(f=>{bye(f.content,f.timestamp)})})})}function CTe(e){let t=Buffer.byteLength(e||"","utf8"),r=(t/(1024*1024)).toFixed(2),n=(_Te.CODE_SIZE/(1024*1024)).toFixed(0);t>_Te.CODE_SIZE&&mr(`Code package size (${r} MB) exceeds the limit of ${n} MB. Please reduce your code size.`),t>_Te.CODE_SIZE*.8&&Is(`Code package size (${r} MB) is approaching the limit of ${n} MB. Consider optimizing your code.`)}function r_t(e,t){if(!K1.default.existsSync(e))return!1;let r=K1.default.readdirSync(e,{withFileTypes:!0});for(let n of r){if(n.name.startsWith("_")||n.name==="__pycache__"||n.name==="skills")continue;let o=n8.default.join(e,n.name);if(n.isDirectory()){if(r_t(o,t))return!0}else if(t.test(n.name))return!0}return!1}function n_t(e){if(!K1.default.existsSync(e))return!1;let t=K1.default.readdirSync(e,{withFileTypes:!0});for(let r of t){if(r.name.startsWith("_")||r.name==="__pycache__"||r.name==="skills")continue;let n=n8.default.join(e,r.name);if(r.isDirectory()){if(n_t(n))return!0}else if(r.name.endsWith(".py")&&r.name!=="__init__.py")return!0}return!1}async function Tkn(e,t,r){let n=await $p("CreateDebugFunction",{JSContent:e,ProjectId:t,MetaData:r});if(n!=null&&n.Error)throw new Error("Start remote dev server failed: "+n.Error.Message);if(!n||!n.WsLogUrl||!n.DebugUrl||!n.SessionId)throw process.env.DEBUG&&console.error("Start remote dev server failed.",n),new Error("Start remote dev server failed.");return n}var i8=class{devSessionId;config;destUrl;routes;constructor(t){this.devConfig=t,this.config={...t,watchPaths:qE(this)};let r=new IM({mode:"dev",env:t.env});this.buildInstance=r}async buildAndGetBundle(){let{bundle:t,meta:r}=await this.buildInstance.build();return{jsBundle:t,meta:r}}async start(){try{let{jsBundle:t,meta:r}=await this.buildAndGetBundle();if(!t)throw new Error("Build error, please check your edge-functions code!");CTe(t),Lt("Waiting for edge-function dev server start...");let n=JSON.parse(r);this.routes=n.routes;let{DebugUrl:o,SessionId:s,WsLogUrl:c}=await Tkn(t,this.devConfig.ProjectId,r);return this.devSessionId=s,this.destUrl=o,await t_t(c),{destUrl:this.destUrl,builder:this.buildInstance,runner:this,watch:this.config.watchPaths,type:"edge-function",config:this.config,routes:this.routes,status:"started"}}catch(t){return{destUrl:null,builder:this.buildInstance,runner:this,watch:this.config.watchPaths,type:"edge-function",config:this.config,routes:[],status:"startFailed",error:t.message||String(t)}}}async handleFileChange(){let{jsBundle:t,meta:r}=await this.buildAndGetBundle();if(!t)throw new Error("Build error, please check your edge-functions code!");CTe(t);let n=await $p("ModifyDebugFunction",{JSContent:t,SessionId:this.devSessionId,MetaData:r}).catch(o=>{throw console.log("Modify debug function failed",o),new Error(o)});if(n){n!=null&&n.Message&&mr(`Rebuild remote dev server failed: ${n.Message}`);let o=JSON.parse(r);this.routes=o.routes}return{destUrl:this.destUrl,builder:this.buildInstance,runner:this,watch:this.config.watchPaths,type:"edge-function",config:this.config,routes:this.routes}}stop(){}};var kTe=Nt(require("path")),s_t=require("child_process");oo();var i_t=Nt(require("net"));function ITe(e,t=5e3){let r=Date.now();return new Promise(n=>{let o=()=>{let s=i_t.default.createServer(),c=!1,u=p=>{if(!c){if(c=!0,s.removeAllListeners(),p){s.close(()=>n());return}if(Date.now()-r>t){console.warn(`[dev] Port ${e} still in use after ${t}ms, proceeding anyway`),n();return}setTimeout(o,100)}};s.once("error",()=>u(!1)),s.once("listening",()=>u(!0)),s.listen(e,"127.0.0.1")};o()})}var s8=class{devConfig;buildInstance;config;server;runtimePort;constructor(t){this.devConfig=t,this.runtimePort=Number(t.runtimePort||9e3),this.config={...t,watchPaths:qE(this)},this.buildInstance=new BM({mode:"dev",env:t.env,enableDevBlobTokenProjectStore:!0,devBlobAuth:t.agentDevBlobAuth})}async startEsmServer(t){let r=(0,s_t.spawn)("node",[t],{stdio:["pipe","inherit","inherit"],env:{...process.env,...this.devConfig.env,NODE_ENV:"development",PAGES_BLOB_STS_ENV:"production"},cwd:process.cwd()});return await new Promise((n,o)=>{let s=!1,c=()=>{r.removeListener("spawn",u),r.removeListener("error",p),r.removeListener("exit",f)},u=()=>{setTimeout(()=>{s||(s=!0,c(),n())},200)},p=h=>{s||(s=!0,c(),o(h))},f=h=>{s||(s=!0,c(),o(new Error(`[dev] agent node dev server exited early with code ${h!=null?h:"unknown"}`)))};r.on("spawn",u),r.on("error",p),r.on("exit",f)}),r}async stopChildProcess(t){t.exitCode!==null||t.signalCode!==null||await new Promise(r=>{let n=!1,o=()=>{clearTimeout(u),t.removeListener("exit",c)},s=()=>{n||(n=!0,o(),r())},c=()=>s(),u=setTimeout(()=>{try{t.kill("SIGKILL")}catch{}setTimeout(s,300)},3e3);t.once("exit",c);try{t.kill("SIGTERM")||s()}catch{s()}})}async start(t={}){process.env.PAGES_BLOB_STS_ENV="production";let r=2,n=this.runtimePort||9e3,o=null;for(let s=0;s<r;s+=1)try{let c=await Lg(n);c!==n&&Lt(`[dev] agent-node port occupied, fallback to: ${c}`);let p=!!(t.skipBuild&&this.buildInstance.wrapPort===c)?{routes:this.buildInstance.getRoutes()}:await this.buildInstance.build({port:c});if(!p.routes||p.routes.length===0)return this.runtimePort=c,{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"no-routes"};if(this.server&&await this.stop(),await G3(process.cwd())==="esm"){let h=kTe.default.join(process.cwd(),".edgeone/agent-node/index.mjs");this.server=await this.startEsmServer(h)}else{let h=kTe.default.join(process.cwd(),".edgeone/agent-node/launcher.js");delete require.cache[require.resolve(h)];let m=require(h);this.server=await m.startServer()}return this.runtimePort=this.buildInstance.wrapPort,{destUrl:`http://localhost:${this.buildInstance.wrapPort}`,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:p.routes,status:"started"}}catch(c){let u=c;o=u;let p=u.message||"";if(s===0&&(p.includes("EADDRINUSE")||p.includes("exited early"))){let h=(this.buildInstance.wrapPort||n)+1;Lt(`[dev] agent-node EADDRINUSE detected, retry from port: ${h}`),n=h;continue}break}return{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"startFailed",error:(o==null?void 0:o.message)||"Start failed"}}async stop(){let t=this.server,r=this.runtimePort||this.buildInstance.wrapPort;if(t){if(this.server=null,t.kill){await this.stopChildProcess(t),r&&await ITe(r),Lt("[dev] agent node dev server stopped");return}await new Promise((n,o)=>{t.close(s=>{if(s){o(s);return}n()})}),r&&await ITe(r)}}async handleFileChange(t){try{let r=!1;if(this.buildInstance&&this.buildInstance.rebuildFunction&&t){Lt(`[dev] Agent incremental rebuilding for: ${t}`);try{await this.buildInstance.rebuildFunction(t)}catch(o){return mr(`[dev] rebuild failed, keep current: ${o.message}`),{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"rebuildFailed",error:o.message}}r=!0}await this.stop();let n=await this.start({skipBuild:r});return n.status==="startFailed"?(mr(`[dev] Agent rebuild failed after restart: ${n.error}`),{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"rebuildFailed",error:n.error}):{destUrl:n.destUrl,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:n.routes,status:"rebuilt"}}catch(r){return mr("[dev] Agent rebuild failed:",r.message),{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"rebuildFailed",error:r.message}}}};oo();var pse=Nt(require("path")),o_t=require("child_process");var o8=class{devConfig;buildInstance;config;server=null;isStarting=!1;constructor(t){this.devConfig=t,this.config={...t,watchPaths:qE(this)},this.buildInstance=new JM({mode:"dev",env:t.env})}async start(t={}){if(this.isStarting)return console.log("[dev] Python function server is already starting, skipping..."),{destUrl:this.server?`http://127.0.0.1:${this.buildInstance.wrapPort}`:null,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:[],status:"starting"};if(this.server&&!this.server.killed)return console.log("[dev] Python function server is already running, skipping..."),{destUrl:`http://127.0.0.1:${this.buildInstance.wrapPort}`,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:this.buildInstance.getRoutes().map(n=>{var o;return{src:n.src,routePath:n.path,method:n.method||["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"],isFramework:(o=n.isFramework)!=null?o:!n.isCatchAll}}),status:"running"};this.isStarting=!0;let r=await Lg(9100);try{let n;if(t.skipBuild?n={routes:this.buildInstance.getRoutes()}:n=await this.buildInstance.build({port:r}),n.routes.length===0)return{destUrl:null,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:[],status:"no-routes"};this.server&&await this.stop();let o=pse.default.join(process.cwd(),".edgeone/cloud-functions/api-python/app.py"),s=this.detectPythonCommand(),c=(0,o_t.spawn)(s,[o],{stdio:["pipe","inherit","inherit"],env:{...process.env,...this.devConfig.env,PYTHONPATH:pse.default.join(process.cwd(),".edgeone/cloud-functions/api-python"),PORT:String(r),...this.devConfig.agentDevBlobAuth?{PAGES_BLOB_DEPLOY_CREDENTIAL:this.devConfig.agentDevBlobAuth.token,PAGES_PROJECT_ID:this.devConfig.agentDevBlobAuth.projectId}:{},PAGES_BLOB_STS_ENV:"production"},cwd:pse.default.join(process.cwd(),".edgeone/cloud-functions/api-python")});await new Promise((p,f)=>{c.on("spawn",()=>{p(void 0)}),c.on("error",h=>{mr("Failed to start Python dev server:",h.message),f(h)})}),this.server=c,this.isStarting=!1;let u=n.routes.map(p=>{var f;return{src:p.src,routePath:p.path,method:p.method||["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"],isFramework:(f=p.isFramework)!=null?f:!p.isCatchAll}});return{destUrl:`http://127.0.0.1:${r}`,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:u,status:"started"}}catch(n){return this.isStarting=!1,{destUrl:null,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:[],status:"startFailed",error:n.message}}}async stop(){if(this.server){let t=this.server;return this.server=null,new Promise(r=>{let n=setTimeout(()=>{console.log("[dev] Python server kill timeout, force killing...");try{t.kill("SIGKILL")}catch{}r()},3e3);t.once("exit",()=>{clearTimeout(n),console.log("[dev] Python function dev server stopped"),r()});try{t.kill("SIGTERM")}catch{clearTimeout(n),r()}})}}async handleFileChange(t){try{Lt(`[dev] Python function file changed: ${t}`),this.isStarting=!1,await this.stop();let r=await this.start({skipBuild:!1});return r.status==="startFailed"?{destUrl:null,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:r.routes,status:"rebuildFailed",error:r.error}:{destUrl:`http://127.0.0.1:${this.buildInstance.wrapPort}`,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:r.routes,status:"rebuilt"}}catch(r){return{destUrl:null,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:[],status:"rebuildFailed",error:r.message}}}detectPythonCommand(){let t=this.buildInstance.getPythonCommand();if(t)return t;throw new Error(`Python 3.10+ is not available.
|
|
117461
|
+
package.json or edgeone.json if you need one.`}}oo();var Skn=Nt($1t(),1),Ckn=Nt(dTe(),1),Ikn=Nt(gTe(),1),Z1t=Nt(ase(),1),kkn=Nt(X1t(),1);var e_t=Z1t.default;oo();var K1=Nt(require("fs")),n8=Nt(require("path"));ul();sk();var _Te={CODE_SIZE:5*1024*1024};function use(e){let t=0;if(!K1.default.existsSync(e))return 0;for(let r of K1.default.readdirSync(e)){let n=n8.default.join(e,r);K1.default.statSync(n).isDirectory()?t+=use(n):t+=1}return t}function lse(e,t){if(!K1.default.existsSync(e))return!1;let r=new Set([".git",".edgeone","node_modules","__pycache__","venv",".venv","dist","build"]);for(let n of K1.default.readdirSync(e,{withFileTypes:!0})){let o=n8.default.join(e,n.name);if(n.isDirectory()){if(r.has(n.name))continue;if(lse(o,t))return!0;continue}let s=o.replace(/\\/g,"/");if(t(s,n.name))return!0}return!1}function yy(e){switch(e){case"node-function":return K1.default.existsSync(fr("cloud-functions"))?lse(fr("cloud-functions"),t=>t.includes("/cloud-functions/")&&I_e(t)):use(fr("node-functions"))>0;case"python-function":return lse(fr("cloud-functions"),(t,r)=>r.endsWith(".py"));case"go-function":return lse(fr("cloud-functions"),(t,r)=>r.endsWith(".go"));case"edge-function":return use(fr("edge-functions"))>0||use(fr("functions"))>0;case"agent-node":{let t=Wp().absolutePath;return r_t(t,/\.(mjs|cjs|js|ts|mts|cts|jsx|tsx)$/)}case"agent-python":{let t=Wp().absolutePath;return n_t(t)}default:return!1}}function STe(e){let t=e.replace(/\\/g,"/"),r=new Set;if((t.startsWith("edge-functions/")||t.startsWith("functions/"))&&!t.endsWith("/")&&r.add("edge-function"),t.startsWith("node-functions/")&&!t.endsWith("/")&&r.add("node-function"),b_e(t)&&!t.endsWith("/")){let o=n8.default.extname(t);o===".py"?r.add("agent-python"):o===".md"?(r.add("agent-node"),r.add("agent-python")):r.add("agent-node")}return t.startsWith("cloud-functions/")&&!t.endsWith("/")&&(I_e(t)&&r.add("node-function"),t.endsWith(".py")&&r.add("python-function"),t.endsWith(".go")&&r.add("go-function")),Array.from(r)}function t_t(e){return new Promise((t,r)=>{let n=new e_t(e);n.on("error",console.error),n.on("open",function(){t(!0)}),n.on("close",function(){Lt("Function log server disconnected")}),n.on("message",function(s){let{logs:c,event_info:u,exceptions:p}=JSON.parse(s.toString());c.forEach(f=>{let{timestamp:h,level:m,content:y}=f;m==="INFO"?JKe(y,h):m==="WARN"?KKe(y,h):m==="ERROR"&&bye(y,h)}),p.forEach(f=>{bye(f.content,f.timestamp)})})})}function CTe(e){let t=Buffer.byteLength(e||"","utf8"),r=(t/(1024*1024)).toFixed(2),n=(_Te.CODE_SIZE/(1024*1024)).toFixed(0);t>_Te.CODE_SIZE&&mr(`Code package size (${r} MB) exceeds the limit of ${n} MB. Please reduce your code size.`),t>_Te.CODE_SIZE*.8&&Is(`Code package size (${r} MB) is approaching the limit of ${n} MB. Consider optimizing your code.`)}function r_t(e,t){if(!K1.default.existsSync(e))return!1;let r=K1.default.readdirSync(e,{withFileTypes:!0});for(let n of r){if(n.name.startsWith("_")||n.name==="__pycache__"||n.name==="skills")continue;let o=n8.default.join(e,n.name);if(n.isDirectory()){if(r_t(o,t))return!0}else if(t.test(n.name))return!0}return!1}function n_t(e){if(!K1.default.existsSync(e))return!1;let t=K1.default.readdirSync(e,{withFileTypes:!0});for(let r of t){if(r.name.startsWith("_")||r.name==="__pycache__"||r.name==="skills")continue;let n=n8.default.join(e,r.name);if(r.isDirectory()){if(n_t(n))return!0}else if(r.name.endsWith(".py")&&r.name!=="__init__.py")return!0}return!1}async function Tkn(e,t,r){let n=await $p("CreateDebugFunction",{JSContent:e,ProjectId:t,MetaData:r});if(n!=null&&n.Error)throw new Error("Start remote dev server failed: "+n.Error.Message);if(!n||!n.WsLogUrl||!n.DebugUrl||!n.SessionId)throw process.env.DEBUG&&console.error("Start remote dev server failed.",n),new Error("Start remote dev server failed.");return n}var i8=class{devSessionId;config;destUrl;routes;constructor(t){this.devConfig=t,this.config={...t,watchPaths:qE(this)};let r=new IM({mode:"dev",env:t.env});this.buildInstance=r}async buildAndGetBundle(){let{bundle:t,meta:r}=await this.buildInstance.build();return{jsBundle:t,meta:r}}async start(){try{let{jsBundle:t,meta:r}=await this.buildAndGetBundle();if(!t)throw new Error("Build error, please check your edge-functions code!");CTe(t),Lt("Waiting for edge-function dev server start...");let n=JSON.parse(r);this.routes=n.routes;let{DebugUrl:o,SessionId:s,WsLogUrl:c}=await Tkn(t,this.devConfig.ProjectId,r);return this.devSessionId=s,this.destUrl=o,await t_t(c),{destUrl:this.destUrl,builder:this.buildInstance,runner:this,watch:this.config.watchPaths,type:"edge-function",config:this.config,routes:this.routes,status:"started"}}catch(t){return{destUrl:null,builder:this.buildInstance,runner:this,watch:this.config.watchPaths,type:"edge-function",config:this.config,routes:[],status:"startFailed",error:t.message||String(t)}}}async handleFileChange(){let{jsBundle:t,meta:r}=await this.buildAndGetBundle();if(!t)throw new Error("Build error, please check your edge-functions code!");CTe(t);let n=await $p("ModifyDebugFunction",{JSContent:t,SessionId:this.devSessionId,MetaData:r}).catch(o=>{throw console.log("Modify debug function failed",o),new Error(o)});if(n){n!=null&&n.Message&&mr(`Rebuild remote dev server failed: ${n.Message}`);let o=JSON.parse(r);this.routes=o.routes}return{destUrl:this.destUrl,builder:this.buildInstance,runner:this,watch:this.config.watchPaths,type:"edge-function",config:this.config,routes:this.routes}}stop(){}};var kTe=Nt(require("path")),s_t=require("child_process");oo();var i_t=Nt(require("net"));function ITe(e,t=5e3){let r=Date.now();return new Promise(n=>{let o=()=>{let s=i_t.default.createServer(),c=!1,u=p=>{if(!c){if(c=!0,s.removeAllListeners(),p){s.close(()=>n());return}if(Date.now()-r>t){console.warn(`[dev] Port ${e} still in use after ${t}ms, proceeding anyway`),n();return}setTimeout(o,100)}};s.once("error",()=>u(!1)),s.once("listening",()=>u(!0)),s.listen(e,"127.0.0.1")};o()})}var s8=class{devConfig;buildInstance;config;server;runtimePort;constructor(t){this.devConfig=t,this.runtimePort=Number(t.runtimePort||9e3),this.config={...t,watchPaths:qE(this)},this.buildInstance=new BM({mode:"dev",env:t.env,enableDevBlobTokenProjectStore:!0,devBlobAuth:t.agentDevBlobAuth})}async startEsmServer(t){let r=(0,s_t.spawn)("node",[t],{stdio:["pipe","inherit","inherit"],env:{...process.env,...this.devConfig.env,NODE_ENV:"development",PAGES_BLOB_STS_ENV:"test"},cwd:process.cwd()});return await new Promise((n,o)=>{let s=!1,c=()=>{r.removeListener("spawn",u),r.removeListener("error",p),r.removeListener("exit",f)},u=()=>{setTimeout(()=>{s||(s=!0,c(),n())},200)},p=h=>{s||(s=!0,c(),o(h))},f=h=>{s||(s=!0,c(),o(new Error(`[dev] agent node dev server exited early with code ${h!=null?h:"unknown"}`)))};r.on("spawn",u),r.on("error",p),r.on("exit",f)}),r}async stopChildProcess(t){t.exitCode!==null||t.signalCode!==null||await new Promise(r=>{let n=!1,o=()=>{clearTimeout(u),t.removeListener("exit",c)},s=()=>{n||(n=!0,o(),r())},c=()=>s(),u=setTimeout(()=>{try{t.kill("SIGKILL")}catch{}setTimeout(s,300)},3e3);t.once("exit",c);try{t.kill("SIGTERM")||s()}catch{s()}})}async start(t={}){process.env.PAGES_BLOB_STS_ENV="test";let r=2,n=this.runtimePort||9e3,o=null;for(let s=0;s<r;s+=1)try{let c=await Lg(n);c!==n&&Lt(`[dev] agent-node port occupied, fallback to: ${c}`);let p=!!(t.skipBuild&&this.buildInstance.wrapPort===c)?{routes:this.buildInstance.getRoutes()}:await this.buildInstance.build({port:c});if(!p.routes||p.routes.length===0)return this.runtimePort=c,{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"no-routes"};if(this.server&&await this.stop(),await G3(process.cwd())==="esm"){let h=kTe.default.join(process.cwd(),".edgeone/agent-node/index.mjs");this.server=await this.startEsmServer(h)}else{let h=kTe.default.join(process.cwd(),".edgeone/agent-node/launcher.js");delete require.cache[require.resolve(h)];let m=require(h);this.server=await m.startServer()}return this.runtimePort=this.buildInstance.wrapPort,{destUrl:`http://localhost:${this.buildInstance.wrapPort}`,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:p.routes,status:"started"}}catch(c){let u=c;o=u;let p=u.message||"";if(s===0&&(p.includes("EADDRINUSE")||p.includes("exited early"))){let h=(this.buildInstance.wrapPort||n)+1;Lt(`[dev] agent-node EADDRINUSE detected, retry from port: ${h}`),n=h;continue}break}return{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"startFailed",error:(o==null?void 0:o.message)||"Start failed"}}async stop(){let t=this.server,r=this.runtimePort||this.buildInstance.wrapPort;if(t){if(this.server=null,t.kill){await this.stopChildProcess(t),r&&await ITe(r),Lt("[dev] agent node dev server stopped");return}await new Promise((n,o)=>{t.close(s=>{if(s){o(s);return}n()})}),r&&await ITe(r)}}async handleFileChange(t){try{let r=!1;if(this.buildInstance&&this.buildInstance.rebuildFunction&&t){Lt(`[dev] Agent incremental rebuilding for: ${t}`);try{await this.buildInstance.rebuildFunction(t)}catch(o){return mr(`[dev] rebuild failed, keep current: ${o.message}`),{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"rebuildFailed",error:o.message}}r=!0}await this.stop();let n=await this.start({skipBuild:r});return n.status==="startFailed"?(mr(`[dev] Agent rebuild failed after restart: ${n.error}`),{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"rebuildFailed",error:n.error}):{destUrl:n.destUrl,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:n.routes,status:"rebuilt"}}catch(r){return mr("[dev] Agent rebuild failed:",r.message),{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"rebuildFailed",error:r.message}}}};oo();var pse=Nt(require("path")),o_t=require("child_process");var o8=class{devConfig;buildInstance;config;server=null;isStarting=!1;constructor(t){this.devConfig=t,this.config={...t,watchPaths:qE(this)},this.buildInstance=new JM({mode:"dev",env:t.env})}async start(t={}){if(this.isStarting)return console.log("[dev] Python function server is already starting, skipping..."),{destUrl:this.server?`http://127.0.0.1:${this.buildInstance.wrapPort}`:null,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:[],status:"starting"};if(this.server&&!this.server.killed)return console.log("[dev] Python function server is already running, skipping..."),{destUrl:`http://127.0.0.1:${this.buildInstance.wrapPort}`,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:this.buildInstance.getRoutes().map(n=>{var o;return{src:n.src,routePath:n.path,method:n.method||["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"],isFramework:(o=n.isFramework)!=null?o:!n.isCatchAll}}),status:"running"};this.isStarting=!0;let r=await Lg(9100);try{let n;if(t.skipBuild?n={routes:this.buildInstance.getRoutes()}:n=await this.buildInstance.build({port:r}),n.routes.length===0)return{destUrl:null,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:[],status:"no-routes"};this.server&&await this.stop();let o=pse.default.join(process.cwd(),".edgeone/cloud-functions/api-python/app.py"),s=this.detectPythonCommand(),c=(0,o_t.spawn)(s,[o],{stdio:["pipe","inherit","inherit"],env:{...process.env,...this.devConfig.env,PYTHONPATH:pse.default.join(process.cwd(),".edgeone/cloud-functions/api-python"),PORT:String(r),...this.devConfig.agentDevBlobAuth?{PAGES_BLOB_DEPLOY_CREDENTIAL:this.devConfig.agentDevBlobAuth.token,PAGES_PROJECT_ID:this.devConfig.agentDevBlobAuth.projectId}:{},PAGES_BLOB_STS_ENV:"test"},cwd:pse.default.join(process.cwd(),".edgeone/cloud-functions/api-python")});await new Promise((p,f)=>{c.on("spawn",()=>{p(void 0)}),c.on("error",h=>{mr("Failed to start Python dev server:",h.message),f(h)})}),this.server=c,this.isStarting=!1;let u=n.routes.map(p=>{var f;return{src:p.src,routePath:p.path,method:p.method||["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"],isFramework:(f=p.isFramework)!=null?f:!p.isCatchAll}});return{destUrl:`http://127.0.0.1:${r}`,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:u,status:"started"}}catch(n){return this.isStarting=!1,{destUrl:null,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:[],status:"startFailed",error:n.message}}}async stop(){if(this.server){let t=this.server;return this.server=null,new Promise(r=>{let n=setTimeout(()=>{console.log("[dev] Python server kill timeout, force killing...");try{t.kill("SIGKILL")}catch{}r()},3e3);t.once("exit",()=>{clearTimeout(n),console.log("[dev] Python function dev server stopped"),r()});try{t.kill("SIGTERM")}catch{clearTimeout(n),r()}})}}async handleFileChange(t){try{Lt(`[dev] Python function file changed: ${t}`),this.isStarting=!1,await this.stop();let r=await this.start({skipBuild:!1});return r.status==="startFailed"?{destUrl:null,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:r.routes,status:"rebuildFailed",error:r.error}:{destUrl:`http://127.0.0.1:${this.buildInstance.wrapPort}`,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:r.routes,status:"rebuilt"}}catch(r){return{destUrl:null,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:[],status:"rebuildFailed",error:r.message}}}detectPythonCommand(){let t=this.buildInstance.getPythonCommand();if(t)return t;throw new Error(`Python 3.10+ is not available.
|
|
117462
117462
|
Please install Python 3.10:
|
|
117463
117463
|
macOS: brew install python@3.10
|
|
117464
117464
|
Ubuntu: sudo apt install python3.10
|
|
@@ -117472,7 +117472,7 @@ Please install Python 3.12:
|
|
|
117472
117472
|
Ubuntu: sudo apt install python3.12
|
|
117473
117473
|
Windows: winget install Python.Python.3.12
|
|
117474
117474
|
Or install uv (will auto-install Python 3.12):
|
|
117475
|
-
curl -LsSf https://astral.sh/uv/install.sh | sh`);let o={...process.env,...this.devConfig.env,PYTHONPATH:[c8.default.join(r,"lib"),r].join(c8.default.delimiter),AGENT_ROUTE_TABLE:this.getRouteTableJson(),AGENT_TIMEOUT:String(((c=this.devConfig.env)==null?void 0:c.AGENT_TIMEOUT)||"300"),OTEL_LOG_LEVEL:process.env.OTEL_LOG_LEVEL||"error",PAGES_BLOB_STS_ENV:"
|
|
117475
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh`);let o={...process.env,...this.devConfig.env,PYTHONPATH:[c8.default.join(r,"lib"),r].join(c8.default.delimiter),AGENT_ROUTE_TABLE:this.getRouteTableJson(),AGENT_TIMEOUT:String(((c=this.devConfig.env)==null?void 0:c.AGENT_TIMEOUT)||"300"),OTEL_LOG_LEVEL:process.env.OTEL_LOG_LEVEL||"error",PAGES_BLOB_STS_ENV:"test",...this.devConfig.agentDevBlobAuth?{PAGES_BLOB_DEPLOY_CREDENTIAL:this.devConfig.agentDevBlobAuth.token,PAGES_PROJECT_ID:this.devConfig.agentDevBlobAuth.projectId}:{},...this.getObservabilityEnv(r)},s=(0,l_t.spawn)(n,["-m","uvicorn","_platform.adapter:app","--host","0.0.0.0","--port",String(t)],{cwd:r,env:o,stdio:"pipe"});return(u=s.stdout)==null||u.on("data",f=>{let h=f.toString().trimEnd();h.startsWith("[agent-python]")?Lt(h):Lt(`[agent-python] ${h}`)}),(p=s.stderr)==null||p.on("data",f=>{let h=f.toString().trimEnd();h.startsWith("[agent-python]")?Lt(h):Lt(`[agent-python] ${h}`)}),s.on("error",f=>{mr(`[agent-python] Process error: ${f.message}`)}),new Promise((f,h)=>{s.on("spawn",()=>f(s)),s.on("error",h)})}getObservabilityEnv(t){let r=c8.default.join(t,".observability-entries");if(!fse.default.existsSync(r))return{};try{let n=fse.default.readFileSync(r,"utf-8").trim();if(n)return{AGENT_OBSERVABILITY_ENTRIES:n}}catch{}return{}}async waitForHealth(t){let r=Date.now(),n=0,o="";for(;Date.now()-r<c_t;){let s=await new Promise(u=>{let p=u_t.default.get(`http://127.0.0.1:${t}/health`,{timeout:1e3},f=>{u({ok:f.statusCode===200,reason:`status=${f.statusCode}`})});p.on("error",f=>u({ok:!1,reason:`err=${f.code||f.message}`})),p.on("timeout",()=>{p.destroy(),u({ok:!1,reason:"timeout"})})});if(o=s.reason,s.ok)return Lt(`[agent-python] Health check passed at ${Date.now()-r}ms on port ${t}`),!0;let c=Date.now()-r;c-n>=5e3&&(Lt(`[agent-python] Still waiting for Python cold start... (${c}ms, last: ${s.reason})`),n=c),await new Promise(u=>setTimeout(u,Bkn))}return Lt(`[agent-python] Health check timed out after ${c_t}ms on port ${t} (last probe: ${o})`),!1}killProcess(t){return new Promise(r=>{if(t.killed){r();return}let n=setTimeout(()=>{try{t.kill("SIGKILL")}catch{}},Dkn);t.once("exit",()=>{clearTimeout(n),r()});try{t.kill("SIGTERM")}catch{clearTimeout(n),r()}})}getRouteTableJson(){try{let t=c8.default.resolve(process.cwd(),".edgeone/agent-python/main.py"),n=fse.default.readFileSync(t,"utf-8").match(/AGENT_ROUTE_TABLE'?,\s*'(.+?)'\)/);return n?n[1]:"{}"}catch{return"{}"}}makeResult(t){return{destUrl:this.currentServer?`http://127.0.0.1:${this.currentPort}`:null,watch:this.config.watchPaths,type:"agent-python",config:this.config,routes:this.buildInstance.getRoutes().map(r=>({src:r.src,routePath:r.path})),status:t||(this.currentServer?"running":"stopped")}}};var UE=Nt(require("fs"));var d_t=require("net"),h_t=require("util");var TTe=Nt(require("os"),1);function Pkn(){let e="eth",t=TTe.default.platform();return t==="darwin"?e="en":t==="win32"&&(e=void 0),e}function Rkn(e,t){return t==="IPv4"?e==="IPv4"||e===4:t==="IPv6"?e==="IPv6"||e===6:e===t}function p_t(e,t,r=!1){let n;for(let o of e)if(Rkn(o.family,t)){if(r&&o.address.startsWith("127."))continue;if(t==="IPv6"){if(o.scopeid===0)return o;n||(n=o)}else return o}return n}function Nkn(e,t){let r=TTe.default.networkInterfaces(),n=!t;if(t=t||Pkn(),e=e||"IPv4",t)for(let o=-1;o<8;o++){let s=t+(o>=0?o:""),c=r[s];if(c){let u=p_t(c,e);if(u)return u}}if(n)for(let o in r){let s=r[o];if(s){let c=p_t(s,e,!0);if(c)return c}}}function f_t(e){let t=Nkn("IPv4",e);return t==null?void 0:t.address}var f8=(0,h_t.debuglog)("detect-port"),DTe=class extends Error{constructor(t){super("The IP address is not available on this machine",t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor)}};function PTe(e,t){let r="";e&&typeof e=="object"?(r=e.hostname,t=e.callback,e=e.port):typeof e=="function"&&(t=e,e=void 0),e=parseInt(e)||0;let n=e+10;return n>65535&&(n=65535),f8("detect free port between [%s, %s)",e,n),typeof t=="function"?BTe(e,n,r).then(o=>t(null,o)).catch(t):BTe(e,n,r)}async function l8(e,t,r){return e>=t&&(f8("port: %s >= maxPort: %s, give up and use random port",e,t),e=0,t=0),await BTe(e,t,r)}async function BTe(e,t,r){if(r)try{return await p8(e,r)}catch(n){if(n.code==="EADDRNOTAVAIL")throw new DTe({cause:n});return await l8(++e,t,r)}try{await p8(e)}catch(n){if(e===0)throw n;return await l8(++e,t,r)}try{await p8(e,"0.0.0.0")}catch{return await l8(++e,t,r)}try{await p8(e,"127.0.0.1")}catch{return await l8(++e,t,r)}try{await p8(e,"localhost")}catch(n){if(n.code!=="EADDRNOTAVAIL")return await l8(++e,t,r)}try{return await p8(e,f_t())}catch{return await l8(++e,t,r)}}function p8(e,t){let r=(0,d_t.createServer)();return new Promise((n,o)=>{r.once("error",s=>(f8("listen %s:%s error: %s",t,e,s),r.close(),s.code==="ENOTFOUND"?(f8("ignore dns ENOTFOUND error, get free %s:%s",t,e),n(e)):o(s))),f8("try listen %d on %s",e,t),r.listen(e,t,()=>(e=r.address().port,f8("get free %s:%s",t,e),r.close(),n(e)))})}var m_t=require("util");var bKi=(0,m_t.debuglog)("detect-port:wait-port");var g_t=PTe;sk();async function A_t(){var f,h;let e={},t={},r=fr("./package.json"),n=fr("./edgeone.json");if(UE.default.existsSync(r))try{e=Tx(r)}catch(m){mr(`Error reading package.json: ${m.message}`)}if(UE.default.existsSync(n))try{t=Tx(n)}catch(m){mr(`Error reading edgeone.json: ${m.message}`)}let o=(f=e==null?void 0:e.scripts)!=null&&f.dev?`npx ${e.scripts.dev}`:"",s=(h=e==null?void 0:e.scripts)!=null&&h.start?`npx ${e.scripts.start}`:"",c=[];t!=null&&t.devCommand&&c.push({source:"edgeone.json",cmd:t.devCommand}),o?c.push({source:"scripts.dev",cmd:o}):s&&c.push({source:"scripts.start",cmd:s});let{cmd:u,warning:p}=await Wwt(c,process.cwd());return p&&Is(p),u}function y_t(e){let t=[];yy("edge-function")&&t.push("edge-function"),yy("node-function")&&t.push("node-function"),yy("agent-node")&&t.push("agent-node"),yy("agent-python")&&t.push("agent-python"),yy("python-function")&&t.push("python-function"),yy("go-function")&&t.push("go-function");let r=new Map;for(let n of t)e.has(n)&&r.set(n,e.get(n));return r}function qE(e){let t=[],r=Wp(),n=r.relativePath==="."?".":`./${r.relativePath}`;return e instanceof i8&&(UE.default.existsSync(fr("edge-functions"))?t.push("./edge-functions"):UE.default.existsSync(fr("functions"))&&t.push("./functions")),e instanceof d8&&(UE.default.existsSync(fr("cloud-functions"))?t.push("./cloud-functions"):UE.default.existsSync(fr("node-functions"))&&t.push("./node-functions")),e instanceof s8&&(UE.default.existsSync(r.absolutePath)&&t.push(n),UE.default.existsSync(fr(".claude"))&&t.push("./.claude")),e instanceof u8&&(UE.default.existsSync(r.absolutePath)&&t.push(n),UE.default.existsSync(fr(".claude"))&&t.push("./.claude")),(e instanceof o8||e instanceof a8)&&UE.default.existsSync(fr("cloud-functions"))&&t.push("./cloud-functions"),t}async function Lg(e){return await g_t(e)}var v_t=`<!doctype html>
|
|
117476
117476
|
<html lang="en">
|
|
117477
117477
|
<head>
|
|
117478
117478
|
<meta charset="UTF-8" />
|
|
@@ -117590,7 +117590,7 @@ Or install uv (will auto-install Python 3.12):
|
|
|
117590
117590
|
</div>
|
|
117591
117591
|
|
|
117592
117592
|
</body>
|
|
117593
|
-
</html>`;var d8=class{devConfig;buildInstance;config;server;runtimePort;constructor(t){this.devConfig=t,this.runtimePort=Number(t.runtimePort||9e3),this.config={...t,watchPaths:qE(this)},this.buildInstance=new CM({mode:"dev",env:t.env})}getDevBlobEnv(t=process.env){if(!this.devConfig.agentDevBlobAuth)return{};let r=this.devConfig.agentDevBlobAuth.token,n=this.devConfig.agentDevBlobAuth.projectId;return{EDGEONE_PAGES_API_TOKEN:String(t.EDGEONE_PAGES_API_TOKEN||r),EDGEONE_PROJECT_ID:String(t.EDGEONE_PROJECT_ID||n),PAGES_BLOB_DEPLOY_CREDENTIAL:String(t.PAGES_BLOB_DEPLOY_CREDENTIAL||r),PAGES_PROJECT_ID:String(t.PAGES_PROJECT_ID||n)}}applyDevBlobEnv(){let t=this.getDevBlobEnv({...process.env,...this.devConfig.env});for(let[r,n]of Object.entries(t))process.env[r]=n;process.env.PAGES_BLOB_STS_ENV=String(process.env.PAGES_BLOB_STS_ENV||"
|
|
117593
|
+
</html>`;var d8=class{devConfig;buildInstance;config;server;runtimePort;constructor(t){this.devConfig=t,this.runtimePort=Number(t.runtimePort||9e3),this.config={...t,watchPaths:qE(this)},this.buildInstance=new CM({mode:"dev",env:t.env})}getDevBlobEnv(t=process.env){if(!this.devConfig.agentDevBlobAuth)return{};let r=this.devConfig.agentDevBlobAuth.token,n=this.devConfig.agentDevBlobAuth.projectId;return{EDGEONE_PAGES_API_TOKEN:String(t.EDGEONE_PAGES_API_TOKEN||r),EDGEONE_PROJECT_ID:String(t.EDGEONE_PROJECT_ID||n),PAGES_BLOB_DEPLOY_CREDENTIAL:String(t.PAGES_BLOB_DEPLOY_CREDENTIAL||r),PAGES_PROJECT_ID:String(t.PAGES_PROJECT_ID||n)}}applyDevBlobEnv(){let t=this.getDevBlobEnv({...process.env,...this.devConfig.env});for(let[r,n]of Object.entries(t))process.env[r]=n;process.env.PAGES_BLOB_STS_ENV=String(process.env.PAGES_BLOB_STS_ENV||"test")}async startEsmServer(t){let r={...process.env,...this.devConfig.env},n=(0,x_t.spawn)("node",[t],{stdio:["pipe","inherit","inherit"],env:{...r,...this.getDevBlobEnv(r),NODE_ENV:"development",PAGES_BLOB_STS_ENV:String(r.PAGES_BLOB_STS_ENV||"test")},cwd:process.cwd()});return await new Promise((o,s)=>{let c=!1,u=()=>{n.removeListener("spawn",p),n.removeListener("error",f),n.removeListener("exit",h)},p=()=>{setTimeout(()=>{c||(c=!0,u(),o())},200)},f=m=>{c||(c=!0,u(),s(m))},h=m=>{c||(c=!0,u(),s(new Error(`[dev] node function dev server exited early with code ${m!=null?m:"unknown"}`)))};n.on("spawn",p),n.on("error",f),n.on("exit",h)}),n}async start(t={}){let n=this.runtimePort||9e3,o=null;for(let s=0;s<2;s+=1)try{let c=await Lg(n);c!==n?Lt(`[dev] node-function port occupied, fallback to: ${c}`):Lt(`[dev] node-function port selected: ${c}`);let p=!!(t.skipBuild&&this.buildInstance.wrapPort===c)?{routes:this.buildInstance.getRoutes()}:await this.buildInstance.build({port:c});if(p.routes.length===0)return this.runtimePort=c,{destUrl:null,watch:this.config.watchPaths,type:"node-function",config:this.config,routes:[],status:"no-routes"};if(this.server&&await this.stop(),await G3(process.cwd())==="esm"){let h=RTe.default.join(process.cwd(),".edgeone/cloud-functions/api-node/index.mjs");this.server=await this.startEsmServer(h),console.log("[dev] node function dev server started")}else{this.applyDevBlobEnv();let h=RTe.default.join(process.cwd(),".edgeone/cloud-functions/api-node/launcher.js");delete require.cache[require.resolve(h)];let m=require(h);this.server=await m.startServer(),console.log("[dev] node function dev server started")}return this.runtimePort=this.buildInstance.wrapPort,{destUrl:`http://localhost:${this.buildInstance.wrapPort}`,watch:this.config.watchPaths,type:"node-function",config:this.config,routes:p.routes,status:"started"}}catch(c){let u=c;o=u;let p=u.message||"";if(s===0&&(p.includes("EADDRINUSE")||p.includes("exited early"))){let h=(this.buildInstance.wrapPort||n)+1;Lt(`[dev] node-function EADDRINUSE detected, retry from port: ${h}`),n=h;continue}break}return{destUrl:null,watch:this.config.watchPaths,type:"node-function",config:this.config,routes:[],status:"startFailed",error:(o==null?void 0:o.message)||"Start failed"}}async stop(){this.server&&(this.server.kill?(this.server.kill("SIGTERM"),console.log("[dev] node function dev server stopped")):await new Promise((t,r)=>{this.server.close(n=>{n?(console.log("[dev] node function dev server stopped with error",n),r(n)):(console.log("[dev] node function dev server stopped"),t())})}),this.server=null)}async handleFileChange(t){try{let r=!1;this.buildInstance&&this.buildInstance.rebuildFunction&&t?(Lt(`[dev] Incremental rebuilding for: ${t}`),await this.buildInstance.rebuildFunction(t),r=!0):Lt("[dev] Falling back to full rebuild"),await this.stop();let n=await this.start({skipBuild:r});return n.status==="startFailed"?{destUrl:null,watch:this.config.watchPaths,type:"node-function",config:this.config,routes:n.routes,status:"rebuildFailed",error:n.error}:{destUrl:`http://localhost:${this.buildInstance.wrapPort}`,watch:this.config.watchPaths,type:"node-function",config:this.config,routes:n.routes,status:"rebuilt"}}catch(r){return{destUrl:null,watch:this.config.watchPaths,type:"node-function",config:this.config,routes:[],status:"rebuildFailed",error:r.message}}}};var FB=new Map;FB.set("edge-function",i8);FB.set("agent-node",s8);FB.set("agent-python",u8);FB.set("node-function",d8);FB.set("python-function",o8);FB.set("go-function",a8);var b_t=require("worker_threads"),E_t=require("path"),w_t=require("events");oo();var dse=class extends w_t.EventEmitter{workers=new Map;constructor(){super(),process.on("exit",()=>this.stopAll())}async startRunner(t,r){await this.stopRunner(t);let n=new b_t.Worker((0,E_t.join)(__dirname,"pages","dev","runner-worker.js"),{workerData:{key:t,config:r},env:{...process.env,FORCE_COLOR:!0}});return this.workers.set(t,n),n.on("error",o=>{console.error(`[Worker ${t}] Error:`,o),Nr({event_name:"Pages Dev:Worker:Error",event_scope:Rr.LOCAL_FLOW,event_phase:"worker",event_result:kr.FAIL,command:"pages",subcommand:"dev",runner_key:t,error_message:os(o).message})}),n.on("exit",o=>{console.error(`[Worker ${t}] Exited with code ${o}`),Nr({event_name:"Pages Dev:Worker:Exit",event_scope:Rr.LOCAL_FLOW,event_phase:"worker",event_result:o===0?kr.SUCCESS:kr.FAIL,command:"pages",subcommand:"dev",runner_key:t,exit_code:o}),this.workers.delete(t)}),new Promise((o,s)=>{let c=u=>{if(process.env.DEBUG&&console.log(`[Worker ${t}] messageHandler`,u),u.type==="started"){n.off("message",c);let p=u.devMatch;Cs(`Dev server runner started for ${t}.`),p.process=n,n.on("message",f=>{if(f.type==="rebuilt")Rs(`[Worker ${t}] Rebuilt completed, updating devMatch`),Object.assign(p,f.devMatch),this.emit("rebuilt",{key:t,devMatch:{...f.devMatch,process:n}});else if(f.type==="startFailed"||f.type==="rebuildFailed")this.emit(f.type,{key:t,error:f.error,devMatch:p}),this.stopRunner(t);else if(f.type==="error"){let h=f.phase||"unknown";Nr({event_name:`Pages Dev:Worker Error:${h}`,event_scope:Rr.LOCAL_FLOW,event_phase:"worker",event_result:kr.FAIL,command:"pages",subcommand:"dev",runner_key:f.key||t,error_message:typeof f.error=="string"?f.error:"unknown",worker_error_phase:h})}}),o(p)}else u.type==="startFailed"?(n.off("message",c),s(new Error(`Runner startup failed for ${t}: ${u.error}`))):u.type==="error"&&u.phase==="startup"&&(n.off("message",c),s(new Error(u.error)))};n.on("message",c),n.postMessage({type:"start"})})}async stopRunner(t){let r=this.workers.get(t);if(!(!r||!r.threadId))return Rs(`[WorkerManager] Stopping runner worker for ${t}`),new Promise(n=>{let o=setTimeout(()=>{console.warn(`[Worker ${t}] Force terminating after timeout`),Nr({event_name:"Pages Dev:Worker:ForceTerminate",event_scope:Rr.LOCAL_FLOW,event_phase:"worker",event_result:kr.FAIL,command:"pages",subcommand:"dev",runner_key:t,error_message:"Worker force terminated after stop timeout"}),r.terminate(),this.workers.delete(t),n()},5e3);r.once("exit",()=>{clearTimeout(o),this.workers.delete(t),n()});try{r.postMessage({type:"stop"})}catch(s){console.error(`[Worker ${t}] Error sending stop message:`,s),r.terminate(),this.workers.delete(t),n()}})}async stopAll(){let t=[];for(let r of this.workers.keys())t.push(this.stopRunner(r));await Promise.all(t)}getWorker(t){return this.workers.get(t)}async sendRebuildMessage(t,r){let n=this.workers.get(t);if(!n||!n.threadId)return console.log("Rebuild message failed, worker not found",t,n,this.workers),!1;Rs(`[Worker ${t}] Sending rebuild message`,t);try{return n.postMessage({type:"rebuild",filePath:r}),!0}catch(o){return console.error(`[Worker ${t}] Error sending rebuild message:`,o),!1}}};sk();var NTe=Nt(require("fs"));ul();oo();var __t=["middleware.js","middleware.ts"],S_t=["./","./src/"],h8=class{middlewareExecutor=null;config=null;env;constructor(t={}){this.env=t}static hasMiddleware(){for(let t of S_t)for(let r of __t){let n=fr(`${t}${r}`);if(NTe.default.existsSync(n))return!0}return!1}findMiddlewareFile(){for(let t of S_t)for(let r of __t){let n=fr(`${t}${r}`);if(NTe.default.existsSync(n))return n}return null}async build(){var r,n,o;let t=this.findMiddlewareFile();if(!t){Lt("\u26A0\uFE0F No middleware file found"),this.middlewareExecutor=null,this.config=null;return}try{let c=await new sz({mode:"dev",env:this.env,silent:!1}).buildMiddleware(t),u=(n=(r=c.config)==null?void 0:r.normalizedMatcher)!=null&&n.length?c.config.normalizedMatcher:Ute((o=c.config)==null?void 0:o.matcher);this.config={...c.config,normalizedMatcher:u},this.middlewareExecutor=this.createRuntimeExecutor(c.code,this.config),Lt("\u2705 Middleware loaded successfully")}catch(s){let c=s instanceof Error?s.message:String(s);throw mr(`\u274C Failed to build middleware: ${c}`),s}}createRuntimeExecutor(t,r){let o=new Function(`${qte(t,r)}
|
|
117594
117594
|
return { executeMiddleware };`)();if(!o||typeof o.executeMiddleware!="function")throw new Error("Middleware runtime did not expose executeMiddleware");return o.executeMiddleware}async execute(t){if(!this.middlewareExecutor)return null;let r=t.request;if(!r)throw new Error("Invalid middleware context: request is undefined");try{let o={request:this.createFetchRequest(r),urlInfo:t.urlInfo,env:t.env,waitUntil:t.waitUntil};return await this.middlewareExecutor(o)}catch(n){let o=n instanceof Error?n.message:String(n);return mr(`Middleware execution error: ${o}`),null}}createFetchRequest(t){var u;let r=this.convertHeaders(t.headers||{}),n=t.url||"/",o=((u=t.headers)==null?void 0:u.host)||"localhost",s=n.startsWith("http://")||n.startsWith("https://")?n:`http://${o}${n.startsWith("/")?n:`/${n}`}`,c=t.method||"GET";return new Request(s,{method:c,headers:r})}convertHeaders(t){let r=new Headers;for(let[n,o]of Object.entries(t))o&&(Array.isArray(o)?o.forEach(s=>{typeof s=="string"&&r.append(n,s)}):typeof o=="string"&&r.set(n,o));return r}getConfig(){return this.config}};oo();var BF=Nt(require("fs")),GCt=Nt(require("http")),s_=Nt(require("path")),WCt=require("url");function xy(e){return typeof e=="number"&&Number.isFinite(e)?e:0}var C_t="langfuse.";function $E(e,t){var r;return(r=e[t])!=null?r:e[`${C_t}${t}`]}function Okn(e){var r;let t=(r=e["output.value"])!=null?r:e[`${C_t}output.value`];if(typeof t!="string")return{inputTokens:0,outputTokens:0,totalTokens:0};try{let o=function(p){let f=p.usage_metadata;if(f&&typeof f=="object"&&!Array.isArray(f))return f;let h=p.data;if(h&&typeof h=="object"&&!Array.isArray(h)){let A=h.usage_metadata;if(A&&typeof A=="object"&&!Array.isArray(A))return A}let m=p.kwargs;if(m&&typeof m=="object"&&!Array.isArray(m)){let v=m,A=v.usage_metadata;if(A&&typeof A=="object"&&!Array.isArray(A))return A;for(let[,C]of Object.entries(v))if(C&&typeof C=="object"&&!Array.isArray(C)){let k=C.usage_metadata;if(k&&typeof k=="object"&&!Array.isArray(k))return k}}let y=p.update;if(y&&typeof y=="object"&&!Array.isArray(y)){let v=y.messages;if(Array.isArray(v)){let A=s(v);if(A)return A}}},s=function(p){for(let f=p.length-1;f>=0;f--){let h=p[f];if(h){if(typeof h=="object"&&!Array.isArray(h)){let m=h,y=o(m);if(y)return y;if(m.kwargs&&typeof m.kwargs=="object"&&!Array.isArray(m.kwargs)){let v=o(m.kwargs);if(v)return v}for(let[,v]of Object.entries(m))if(v&&typeof v=="object")if(Array.isArray(v)){let A=s(v);if(A)return A}else{let A=o(v);if(A)return A;let C=c(v);if(C)return C}}if(Array.isArray(h)){let m=s(h);if(m)return m}}}},c=function(p){let f=o(p);if(f)return f;for(let[,h]of Object.entries(p))if(h&&typeof h=="object")if(Array.isArray(h)){let m=s(h);if(m)return m}else{let m=c(h);if(m)return m}},n=JSON.parse(t),u;if(Array.isArray(n))u=s(n);else if(n&&typeof n=="object"){let p=n;if(u=o(p),!u){let f=p.messages;Array.isArray(f)&&(u=s(f))}if(!u){let f=p.generations;Array.isArray(f)&&(u=s(f))}}return u?{inputTokens:xy(u.input_tokens),outputTokens:xy(u.output_tokens),totalTokens:xy(u.total_tokens)}:{inputTokens:0,outputTokens:0,totalTokens:0}}catch{return{inputTokens:0,outputTokens:0,totalTokens:0}}}function LB(e){if(!e)return{prompt:0,completion:0,total:0};let t=xy($E(e,"llm.token_count.total"))||xy($E(e,"gen_ai.usage.total_tokens"))||xy($E(e,"llm.usage.total_tokens"))||xy($E(e,"totalTokens")),r=xy($E(e,"llm.token_count.prompt"))||xy($E(e,"gen_ai.usage.input_tokens"))||xy($E(e,"gen_ai.usage.prompt_tokens"))||xy($E(e,"promptTokens")),n=xy($E(e,"llm.token_count.completion"))||xy($E(e,"gen_ai.usage.output_tokens"))||xy($E(e,"gen_ai.usage.completion_tokens"))||xy($E(e,"completionTokens")),s=t===0||r===0||n===0?Okn(e):{inputTokens:0,outputTokens:0,totalTokens:0},c=r||s.inputTokens,u=n||s.outputTokens,p=t||s.totalTokens||c+u;return{prompt:c,completion:u,total:p}}function I_t(e,t){var o,s;let r=t.get(e.traceId)||[],n=Fkn(r);return{TraceId:e.traceId,StartTimeMs:e.startedAt,EndTimeMs:(o=e.endedAt)!=null?o:e.startedAt,DurationMs:(s=e.durationMs)!=null?s:0,SpanCount:r.length,TotalToken:n,Cost:null,HasError:e.status!=="ok"&&e.status!=="running",RootSpanId:e.traceId,RootOperation:e.routePath,Service:e.runtime,Env:"development"}}function Fkn(e){let t=0;for(let o of e)if(o.kind==="llm.call"){let s=LB(o.attributes);s.total>0&&(t+=s.total)}if(t>0)return t;let r=[];for(let o of e){let s=LB(o.attributes);s.total>0&&r.push({span:o,total:s.total})}if(r.length===0)return 0;let n=new Set;for(let{span:o}of r)o.parentSpanId&&n.add(o.parentSpanId);for(let{span:o,total:s}of r)n.has(o.spanId)||(t+=s);return t}function k_t(e){let t=new Map;for(let r of e){let n=r.runtime,o=t.get(n);o||(o={Name:n,LastActivityMs:0,TraceCount:0,ErrorCount:0,HasError:!1,AvgDurationMs:0},t.set(n,o)),o.TraceCount+=1,o.LastActivityMs=Math.max(o.LastActivityMs,r.startedAt),r.status!=="ok"&&r.status!=="running"&&(o.ErrorCount+=1,o.HasError=!0),typeof r.durationMs=="number"&&(o.AvgDurationMs+=r.durationMs)}for(let r of t.values())r.AvgDurationMs=r.TraceCount>0?Math.round(r.AvgDurationMs/r.TraceCount):0;return Array.from(t.values()).sort((r,n)=>n.LastActivityMs-r.LastActivityMs)}var Lkn=new Map([["llm.call","LLM"],["tool.call","TOOL"],["agent.invoke","AGENT"],["memory.op","CHAIN"],["store.op","CHAIN"],["custom","CHAIN"]]);function T_t(e,t){var h,m,y,v,A,C;let r=t.map(w=>jkn(w,e.runtime)),n=[],o=0,s=0,c=0,u=0,p=0,f=[];for(let w of t){let k=Lkn.get(w.kind)||"CHAIN",N=w.startedAt-e.startedAt;if(w.kind==="llm.call"){u+=1;let Q=LB(w.attributes);Q.total>0&&(o+=Q.prompt,s+=Q.completion,c+=Q.total)}if(w.kind==="tool.call"&&(p+=1),w.status==="error"){let Q=(h=w.events)==null?void 0:h.find(H=>H.name==="exception"),L=((m=Q==null?void 0:Q.data)==null?void 0:m["exception.message"])||((y=w.attributes)==null?void 0:y["error.message"])||((v=w.attributes)==null?void 0:v.error)||"error";f.push({SpanId:w.spanId,Operation:w.name,Message:String(L)})}(k==="LLM"||k==="TOOL")&&n.push({SpanId:w.spanId,Kind:k,OperationName:w.name,StartOffsetMs:N,DurationMs:(A=w.durationMs)!=null?A:0,HasError:w.status==="error"})}if(c===0){let w=[];for(let N of t){if(N.kind==="llm.call")continue;let Q=LB(N.attributes);Q.total>0&&w.push({span:N,...Q})}let k=new Set;for(let{span:N}of w)N.parentSpanId&&k.add(N.parentSpanId);for(let{span:N,prompt:Q,completion:L,total:H}of w)k.has(N.spanId)||(o+=Q,s+=L,c+=H)}return{Spans:r,Total:r.length,Summary:{DurationMs:(C=e.durationMs)!=null?C:0,LlmCallCount:u,ToolCallCount:p,Tokens:{Prompt:o,Completion:s,Total:c},Errors:f},Steps:n}}function jkn(e,t){var n,o;let r=[];for(let[s,c]of Object.entries(e.attributes||{})){if(c==null)continue;let u=typeof c=="string"?c:Mkn(c);r.push({Key:s,Value:u})}if(e.status==="error"){r.push({Key:"error",Value:"true"}),r.push({Key:"statusCode",Value:"2"});let s=(n=e.events)==null?void 0:n.find(c=>c.name==="exception");if(s!=null&&s.data){let c=s.data;c["exception.message"]&&r.push({Key:"error.message",Value:String(c["exception.message"])}),c["exception.type"]&&r.push({Key:"error.object",Value:String(c["exception.type"])}),c["exception.stacktrace"]&&r.push({Key:"exception.stacktrace",Value:String(c["exception.stacktrace"])})}}else r.push({Key:"statusCode",Value:"0"});return{TraceId:e.traceId,SpanId:e.spanId,OperationName:e.name,StartTime:e.startedAt*1e3,Duration:((o=e.durationMs)!=null?o:0)*1e3,Tags:r,Logs:[],Process:{ServiceName:t,Tags:[]},References:e.parentSpanId?[{RefType:"CHILD_OF",SpanId:e.parentSpanId,TraceId:e.traceId}]:void 0}}function Mkn(e){try{return JSON.stringify(e)}catch{return String(e)}}function B_t(e){let t=0,r=0,n=0,o=0;for(let u of e)if(u.kind==="llm.call"){t+=1,r+=u.durationMs||0,u.status==="error"&&(o+=1);let p=LB(u.attributes);p.total>0&&(n+=p.total)}if(t>0)return{llmCallCount:t,llmTotalDurationMs:r,tokenTotal:n,llmErrorCount:o};let s=[];for(let u of e){let p=LB(u.attributes);p.total>0&&s.push({span:u,total:p.total})}if(s.length===0)return{llmCallCount:0,llmTotalDurationMs:0,tokenTotal:0,llmErrorCount:0};let c=new Set(s.filter(({span:u})=>u.parentSpanId).map(({span:u})=>u.parentSpanId));for(let{span:u,total:p}of s)c.has(u.spanId)||(t+=1,r+=u.durationMs||0,n+=p,u.status==="error"&&(o+=1));return{llmCallCount:t,llmTotalDurationMs:r,tokenTotal:n,llmErrorCount:o}}var D_t={"15min":{bucketSizeMs:30*1e3,format:e=>`${wf(e.getMonth()+1)}-${wf(e.getDate())} ${wf(e.getHours())}:${wf(e.getMinutes())}`},"30min":{bucketSizeMs:30*1e3,format:e=>`${wf(e.getMonth()+1)}-${wf(e.getDate())} ${wf(e.getHours())}:${wf(e.getMinutes())}`},"1hour":{bucketSizeMs:60*1e3,format:e=>`${wf(e.getMonth()+1)}-${wf(e.getDate())} ${wf(e.getHours())}:${wf(e.getMinutes())}`},"6hour":{bucketSizeMs:3*60*1e3,format:e=>`${wf(e.getMonth()+1)}-${wf(e.getDate())} ${wf(e.getHours())}:${wf(e.getMinutes())}`},"24hour":{bucketSizeMs:10*60*1e3,format:e=>`${wf(e.getMonth()+1)}-${wf(e.getDate())} ${wf(e.getHours())}:${wf(e.getMinutes())}`},"7day":{bucketSizeMs:60*60*1e3,format:e=>`${wf(e.getMonth()+1)}-${wf(e.getDate())} ${wf(e.getHours())}:00`}};function Qkn(e,t,r,n){let o=0,s=0,c=0,u=0,p=0;for(let f of e){if(f.startedAt<r||f.startedAt>n||f.status==="running")continue;o+=1,f.status!=="ok"&&(s+=1);let h=t.get(f.traceId)||[],m=B_t(h);c+=m.llmCallCount,u+=m.llmTotalDurationMs,p+=m.tokenTotal}return{agentCallCount:o,agentErrorCount:s,llmCallCount:c,llmTotalDurationMs:u,tokenTotal:p}}function m8(e,t){return t===0?e===0?0:100:Number(((e-t)/t*100).toFixed(2))}function P_t(e){let{traces:t,spansByTrace:r,windowStart:n,windowEnd:o}=e,s=D_t[e.timeRange||"24hour"]||D_t["24hour"],c=0,u=0,p=0,f=0,h=0,m=new Map,y=Ee=>{let Ce=qkn(Ee,s.bucketSizeMs),Me=m.get(Ce);return Me||(Me={agentCalls:0,agentSuccesses:0,llmCalls:0,llmDurationMs:0,tokens:0},m.set(Ce,Me)),Me};for(let Ee of t){if(Ee.startedAt<n||Ee.startedAt>o||Ee.status==="running")continue;c+=1;let Ce=Ee.status==="ok";Ce||(u+=1);let Me=y(Ee.startedAt);Me.agentCalls+=1,Ce&&(Me.agentSuccesses+=1);let Xe=r.get(Ee.traceId)||[],bt=B_t(Xe);if(p+=bt.llmCallCount,f+=bt.llmTotalDurationMs,h+=bt.tokenTotal,bt.llmCallCount>0){let Pt=y(Ee.startedAt);Pt.llmCalls+=bt.llmCallCount,Pt.llmDurationMs+=bt.llmTotalDurationMs,Pt.tokens+=bt.tokenTotal}}let v=c>0?u*100/c:0,A=p>0?f/p/1e3:0,C=p>0?Math.round(h/p):0,w,k,N,Q,L,H;if(e.baselineTraces&&typeof e.baselineWindowStart=="number"&&typeof e.baselineWindowEnd=="number"){let Ee=Qkn(e.baselineTraces,r,e.baselineWindowStart,e.baselineWindowEnd),Ce=Ee.agentCallCount>0?Ee.agentErrorCount*100/Ee.agentCallCount:0,Me=Ee.llmCallCount>0?Ee.llmTotalDurationMs/Ee.llmCallCount/1e3:0,Xe=Ee.llmCallCount>0?Math.round(Ee.tokenTotal/Ee.llmCallCount):0;w=m8(c,Ee.agentCallCount),k=m8(p,Ee.llmCallCount),N=m8(v,Ce),Q=m8(A,Me),L=m8(h,Ee.tokenTotal),H=m8(C,Xe)}let re=[{Key:"agent_call",Label:"Agent \u8C03\u7528",Value:c,Unit:"\u6B21",DeltaSemantic:"higherIsBetter",...w!==void 0?{Yoy:w}:{}},{Key:"model_call",Label:"\u6A21\u578B\u8C03\u7528",Value:p,Unit:"\u6B21",...k!==void 0?{Yoy:k}:{}},{Key:"model_error_rate",Label:"\u6A21\u578B\u8C03\u7528\u9519\u8BEF\u7387",Value:Number(v.toFixed(2)),Unit:"%",DeltaSemantic:"lowerIsBetter",...N!==void 0?{Yoy:N}:{}},{Key:"model_avg_latency",Label:"\u6A21\u578B\u8C03\u7528\u5E73\u5747\u8017\u65F6",Value:A.toFixed(4),Unit:"s",DeltaSemantic:"lowerIsBetter",...Q!==void 0?{Yoy:Q}:{}},{Key:"token_total",Label:"Token \u603B\u6D88\u8017",Value:h,Unit:"\u4E2A",...L!==void 0?{Yoy:L}:{}},{Key:"avg_token_per_model",Label:"\u5E73\u5747 Token/\u6A21\u578B\u8C03\u7528",Value:C,Unit:"\u4E2A",...H!==void 0?{Yoy:H}:{}}],X=Array.from(m.keys()).sort((Ee,Ce)=>Ee-Ce),ve=Ee=>Math.floor(Ee/1e3);function oe(Ee){let Ce=X.map(Pt=>({ts:Pt,data:Ee(m.get(Pt))})),Me=[],Xe=new Set;function bt(Pt){Pt<0||Pt>=Ce.length||Xe.has(Pt)||(Xe.add(Pt),Me.push({Name:ve(Ce[Pt].ts),Data:Ce[Pt].data}))}for(let Pt=0;Pt<Ce.length;Pt++)Ce[Pt].data>0&&(Pt>0&&Ce[Pt-1].data===0&&bt(Pt-1),bt(Pt),Pt+1<Ce.length&&Ce[Pt+1].data===0&&bt(Pt+1));return Me.length===0?Ce.length>0?[{Name:ve(Ce[0].ts),Data:0}]:[]:(Me.sort((Pt,rt)=>Number(Pt.Name)-Number(rt.Name)),Me)}let fe=oe(Ee=>Ee.agentCalls),ne=[];for(let Ee of X){let Ce=m.get(Ee);if(Ce.agentCalls===0)continue;let Me=Ce.agentCalls-Ce.agentSuccesses;ne.push({Name:ve(Ee),Data:Number((Me*100/Ce.agentCalls).toFixed(2))})}let xe=oe(Ee=>Ee.llmCalls),Z=[];for(let Ee of X){let Ce=m.get(Ee);Ce.llmCalls!==0&&Z.push({Name:ve(Ee),Data:Number((Ce.llmDurationMs/Ce.llmCalls/1e3).toFixed(4))})}let V=oe(Ee=>Ee.tokens),ge=[];for(let Ee of X){let Ce=m.get(Ee);Ce.llmCalls!==0&&ge.push({Name:ve(Ee),Data:Math.round(Ce.tokens/Ce.llmCalls)})}return{overview:re,charts:[{Key:"agent_call_chart",Title:"Agent \u8C03\u7528",Unit:"\u6B21",Series:fe},{Key:"model_call_chart",Title:"\u6A21\u578B\u8C03\u7528",Unit:"\u6B21",Series:xe},{Key:"model_error_rate_chart",Title:"\u6A21\u578B\u8C03\u7528\u9519\u8BEF\u7387",Unit:"%",Series:ne},{Key:"model_avg_latency_chart",Title:"\u6A21\u578B\u8C03\u7528\u5E73\u5747\u8017\u65F6",Unit:"s",Series:Z},{Key:"token_total_chart",Title:"Token \u603B\u6D88\u8017",Unit:"\u4E2A",Series:V},{Key:"avg_token_per_model_chart",Title:"\u5E73\u5747 Token/\u6A21\u578B\u8C03\u7528",Unit:"\u4E2A",Series:ge}]}}function OTe(e){if(e.startedAtMin&&e.startedAtMax)return{start:e.startedAtMin,end:e.startedAtMax};let t=Date.now(),r=e.timeRange||"24hour",n={"15min":15*60*1e3,"30min":30*60*1e3,"1hour":60*60*1e3,"6hour":6*60*60*1e3,"24hour":24*60*60*1e3,"7day":7*24*60*60*1e3},o=n[r]||n["24hour"];return{start:t-o,end:t}}function qkn(e,t){return Math.floor(e/t)*t}function wf(e){return e<10?`0${e}`:String(e)}function R_t(e){var t,r;if(e){if(e.stringValue!=null)return e.stringValue;if(e.boolValue!=null)return e.boolValue;if(e.intValue!=null)return Number(e.intValue);if(e.doubleValue!=null)return e.doubleValue;if((t=e.arrayValue)!=null&&t.values)return e.arrayValue.values.map(n=>R_t(n));if((r=e.kvlistValue)!=null&&r.values)return hse(e.kvlistValue.values);if(e.bytesValue)return Buffer.from(e.bytesValue).toString("base64")}}function hse(e){let t={};if(!e)return t;for(let r of e){if(!r||typeof r.key!="string")continue;let n=R_t(r.value);n!==void 0&&(t[r.key]=n)}return t}function FTe(e){if(e==null)return"";if(typeof e=="string"){if(/^[0-9a-fA-F]+$/.test(e))return e.toLowerCase();try{return Buffer.from(e,"base64").toString("hex")}catch{return e}}return Buffer.from(e).toString("hex")}function LTe(e){if(e==null)return 0;if(typeof e=="number")return Math.floor(e/1e6);if(typeof e=="string")try{return Number(BigInt(e)/1000000n)}catch{let t=Number(e);return Number.isFinite(t)?Math.floor(t/1e6):0}if(typeof e=="object"&&e!==null){let t=e;if(typeof t.low=="number"&&typeof t.high=="number"){let r=BigInt(t.high>>>0)<<32n|BigInt(t.low>>>0);return Number(r/1000000n)}}return 0}var Ukn="langfuse.";function jB(e,t){var r;return(r=e[t])!=null?r:e[`${Ukn}${t}`]}function $kn(e,t){if(jB(e,"agent.invoke.target_route")!=null)return"agent.invoke";let r=jB(e,"openinference.span.kind");if(r==="TOOL"||jB(e,"tool.name")!=null)return"tool.call";let n=e["gen_ai.span.kind"];return r==="LLM"||n==="LLM"||n==="generation"||e["gen_ai.system"]!=null?"llm.call":t.startsWith("memory.")?"memory.op":t.startsWith("store.")?"store.op":"custom"}function zkn(e){var f,h,m,y;let t=hse((f=e.attributes)!=null?f:[]),r=LTe(e.startTimeUnixNano),n=LTe(e.endTimeUnixNano),o=((h=e.status)==null?void 0:h.code)===2?"error":"ok",s=FTe(e.traceId),c=FTe(e.spanId),u=e.parentSpanId?FTe(e.parentSpanId):void 0,p=String((m=jB(t,"agent.run_id"))!=null?m:s);return{spanId:c,traceId:s,parentSpanId:u,runId:p,kind:$kn(t,e.name),name:e.name,startedAt:r,endedAt:n>0?n:void 0,durationMs:n>0?Math.max(0,n-r):void 0,status:o,attributes:t,events:((y=e.events)!=null?y:[]).map(v=>{var A;return{ts:LTe(v.timeUnixNano),name:v.name,data:hse((A=v.attributes)!=null?A:[])}})}}function Hkn(e,t){var m,y,v,A;let r=t.filter(C=>!C.parentSpanId),n=(r.length>0?r:t).reduce((C,w)=>C.startedAt<=w.startedAt?C:w,t[0]),o=(m=n.attributes)!=null?m:{},s=String((y=jB(o,"agent.conversation_id"))!=null?y:""),c=String((v=jB(o,"agent.route_path"))!=null?v:n.name.startsWith("agent.request:")?n.name.slice(14):n.name),u=Vkn(o),p=n.startedAt,f=(A=n.endedAt)!=null?A:0;for(let C of t)C.startedAt<p&&(p=C.startedAt),C.endedAt&&C.endedAt>f&&(f=C.endedAt);let h;return n.status==="error"?h="error":n.endedAt?h="ok":h="running",{traceId:e,conversationId:s,routePath:c,runtime:u,startedAt:p,endedAt:f>0?f:void 0,durationMs:f>0?Math.max(0,f-p):void 0,status:h,attributes:o}}function Vkn(e){let t=jB(e,"agent.runtime");if(t==="agent-python")return"agent-python";if(t==="agent-node")return"agent-node";let r=jB(e,"telemetry.sdk.language");return typeof r=="string"&&r.toLowerCase()==="python"?"agent-python":"agent-node"}function N_t(e,t,r){var c,u,p,f,h,m,y;let n=0,o=0,s=new Map;for(let v of(c=e.resourceSpans)!=null?c:[]){let A=hse((p=(u=v.resource)==null?void 0:u.attributes)!=null?p:[]);for(let C of(f=v.scopeSpans)!=null?f:[]){let w=(h=C.scope)==null?void 0:h.name;for(let k of(m=C.spans)!=null?m:[]){if(!k.traceId||!k.spanId){o+=1;continue}let N=zkn(k);N.attributes={...A,...N.attributes},w&&!N.attributes["otel.scope.name"]&&(N.attributes["otel.scope.name"]=w),t(N),n+=1;let Q=(y=s.get(N.traceId))!=null?y:[];Q.push(N),s.set(N.traceId,Q)}}}for(let[v,A]of s)r(Hkn(v,A));return{spanCount:n,traceCount:s.size,rejectedCount:o}}var FCt=Nt(OCt());var FDe=null;function yDn(){if(FDe)return FDe;let e=FCt.Root.fromJSON(vDn());return FDe=e,e}function LCt(e){let r=yDn().lookupType("opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest"),n=r.decode(e),o=r.toObject(n,{longs:String,enums:String,bytes:String,arrays:!0,objects:!0,oneofs:!0});return LDe(o)}function vDn(){return{name:"opentelemetry",nested:{opentelemetry:{nested:{proto:{nested:{collector:{nested:{trace:{nested:{v1:{nested:{ExportTraceServiceRequest:{fields:{resource_spans:{type:"opentelemetry.proto.collector.trace.v1.ResourceSpans",id:1,rule:"repeated"}}},ResourceSpans:{fields:{resource:{type:"opentelemetry.proto.collector.trace.v1.Resource",id:1},scope_spans:{type:"opentelemetry.proto.collector.trace.v1.ScopeSpans",id:2,rule:"repeated"}}},Resource:{fields:{attributes:{type:"opentelemetry.proto.collector.trace.v1.KeyValue",id:1,rule:"repeated"},dropped_attributes_count:{type:"int32",id:2}}},ScopeSpans:{fields:{scope:{type:"opentelemetry.proto.collector.trace.v1.InstrumentationScope",id:1},spans:{type:"opentelemetry.proto.collector.trace.v1.Span",id:2,rule:"repeated"}}},InstrumentationScope:{fields:{name:{type:"string",id:1},version:{type:"string",id:2},attributes:{type:"opentelemetry.proto.collector.trace.v1.KeyValue",id:3,rule:"repeated"},dropped_attributes_count:{type:"int32",id:4}}},Span:{fields:{trace_id:{type:"bytes",id:1},span_id:{type:"bytes",id:2},trace_state:{type:"string",id:3},parent_span_id:{type:"bytes",id:4},name:{type:"string",id:5},kind:{type:"int32",id:6},start_time_unix_nano:{type:"fixed64",id:7},end_time_unix_nano:{type:"fixed64",id:8},attributes:{type:"opentelemetry.proto.collector.trace.v1.KeyValue",id:9,rule:"repeated"},dropped_attributes_count:{type:"int32",id:10},events:{type:"opentelemetry.proto.collector.trace.v1.Span.Event",id:11,rule:"repeated"},dropped_events_count:{type:"int32",id:12},links:{type:"opentelemetry.proto.collector.trace.v1.Span.Link",id:13,rule:"repeated"},dropped_links_count:{type:"int32",id:14},status:{type:"opentelemetry.proto.collector.trace.v1.Status",id:15}},nested:{Event:{fields:{name:{type:"string",id:1},time_unix_nano:{type:"fixed64",id:2},attributes:{type:"opentelemetry.proto.collector.trace.v1.KeyValue",id:3,rule:"repeated"},dropped_attributes_count:{type:"int32",id:4}}},Link:{fields:{trace_id:{type:"bytes",id:1},span_id:{type:"bytes",id:2},trace_state:{type:"string",id:3},attributes:{type:"opentelemetry.proto.collector.trace.v1.KeyValue",id:4,rule:"repeated"},dropped_attributes_count:{type:"int32",id:5}}}}},Status:{fields:{code:{type:"int32",id:1},message:{type:"string",id:2}}},KeyValue:{fields:{key:{type:"string",id:1},value:{type:"opentelemetry.proto.collector.trace.v1.AnyValue",id:2}}},AnyValue:{oneofs:{value:{oneof:["string_value","int_value","double_value","bool_value","array_value","kvlist_value","bytes_value"]}},fields:{string_value:{type:"string",id:1},bool_value:{type:"bool",id:2},int_value:{type:"int64",id:3},double_value:{type:"double",id:4},array_value:{type:"opentelemetry.proto.collector.trace.v1.ArrayValue",id:5},kvlist_value:{type:"opentelemetry.proto.collector.trace.v1.KeyValueList",id:6},bytes_value:{type:"bytes",id:7}}},ArrayValue:{fields:{values:{type:"opentelemetry.proto.collector.trace.v1.AnyValue",id:1,rule:"repeated"}}},KeyValueList:{fields:{values:{type:"opentelemetry.proto.collector.trace.v1.KeyValue",id:1,rule:"repeated"}}}}}}}}}}}}}}}}function LDe(e){let t={};for(let[r,n]of Object.entries(e)){let o=xDn(r);n!==null&&typeof n=="object"&&!Array.isArray(n)?t[o]=LDe(n):Array.isArray(n)?t[o]=n.map(s=>s!==null&&typeof s=="object"?LDe(s):s):Buffer.isBuffer(n)?t[o]=n.toString("hex"):t[o]=n}return t}function xDn(e){return e.replace(/_([a-z0-9])/g,(t,r)=>r.toUpperCase())}var bDn=15e3,Lse=class{clients=new Set;nextEventId=1;attach(t,r){r.writeHead(200,{"Content-Type":"text/event-stream; charset=utf-8","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"}),r.write(`retry: 5000
|
|
117595
117595
|
|
|
117596
117596
|
`),r.write(`event: hello
|
|
@@ -164,7 +164,7 @@ Read about how to prevent this error on https://github.com/vadimdemedes/ink/#isr
|
|
|
164
164
|
`.repeat(e));Tte.displayName="Newline";eC.default=Tte});var Dte=Z(tC=>{"use strict";var Cte=tC&&tC.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(tC,"__esModule",{value:!0});var Gje=Cte(Ta()),Kje=Cte(RI()),Ate=()=>Gje.default.createElement(Kje.default,{flexGrow:1});Ate.displayName="Spacer";tC.default=Ate});var BI=Z(rC=>{"use strict";var Yje=rC&&rC.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(rC,"__esModule",{value:!0});var Jje=Ta(),Xje=Yje(uB()),Zje=()=>Jje.useContext(Xje.default);rC.default=Zje});var Ite=Z(nC=>{"use strict";var Qje=nC&&nC.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(nC,"__esModule",{value:!0});var kte=Ta(),e5e=Qje(BI()),t5e=(e,t={})=>{let{stdin:r,setRawMode:s,internal_exitOnCtrlC:a}=e5e.default();kte.useEffect(()=>{if(t.isActive!==!1)return s(!0),()=>{s(!1)}},[t.isActive,s]),kte.useEffect(()=>{if(t.isActive===!1)return;let n=l=>{let p=String(l),m={upArrow:p==="\x1B[A",downArrow:p==="\x1B[B",leftArrow:p==="\x1B[D",rightArrow:p==="\x1B[C",pageDown:p==="\x1B[6~",pageUp:p==="\x1B[5~",return:p==="\r",escape:p==="\x1B",ctrl:!1,shift:!1,tab:p===" "||p==="\x1B[Z",backspace:p==="\b",delete:p==="\x7F"||p==="\x1B[3~",meta:!1};p<=""&&!m.return&&(p=String.fromCharCode(p.charCodeAt(0)+97-1),m.ctrl=!0),p.startsWith("\x1B")&&(p=p.slice(1),m.meta=!0);let g=p>="A"&&p<="Z",v=p>="\u0410"&&p<="\u042F";p.length===1&&(g||v)&&(m.shift=!0),m.tab&&p==="[Z"&&(m.shift=!0),(m.tab||m.backspace||m.delete)&&(p=""),(!(p==="c"&&m.ctrl)||!a)&&e(p,m)};return r==null||r.on("data",n),()=>{r==null||r.off("data",n)}},[t.isActive,r,a,e])};nC.default=t5e});var Ote=Z(iC=>{"use strict";var r5e=iC&&iC.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(iC,"__esModule",{value:!0});var n5e=Ta(),i5e=r5e(oB()),s5e=()=>n5e.useContext(i5e.default);iC.default=s5e});var Nte=Z(sC=>{"use strict";var o5e=sC&&sC.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(sC,"__esModule",{value:!0});var a5e=Ta(),u5e=o5e(lB()),c5e=()=>a5e.useContext(u5e.default);sC.default=c5e});var Rte=Z(oC=>{"use strict";var l5e=oC&&oC.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(oC,"__esModule",{value:!0});var p5e=Ta(),f5e=l5e(fB()),d5e=()=>p5e.useContext(f5e.default);oC.default=d5e});var Lte=Z(uC=>{"use strict";var Fte=uC&&uC.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(uC,"__esModule",{value:!0});var aC=Ta(),h5e=Fte(NI()),m5e=Fte(BI()),g5e=({isActive:e=!0,autoFocus:t=!1,id:r}={})=>{let{isRawModeSupported:s,setRawMode:a}=m5e.default(),{activeId:n,add:l,remove:p,activate:m,deactivate:g,focus:v}=aC.useContext(h5e.default),w=aC.useMemo(()=>r!=null?r:Math.random().toString().slice(2,7),[r]);return aC.useEffect(()=>(l(w,{autoFocus:t}),()=>{p(w)}),[w,t]),aC.useEffect(()=>{e?m(w):g(w)},[e,w]),aC.useEffect(()=>{if(!(!s||!e))return a(!0),()=>{a(!1)}},[e]),{isFocused:!!w&&n===w,focus:v}};uC.default=g5e});var Mte=Z(cC=>{"use strict";var y5e=cC&&cC.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(cC,"__esModule",{value:!0});var v5e=Ta(),x5e=y5e(NI()),_5e=()=>{let e=v5e.useContext(x5e.default);return{enableFocus:e.enableFocus,disableFocus:e.disableFocus,focusNext:e.focusNext,focusPrevious:e.focusPrevious,focus:e.focus}};cC.default=_5e});var Bte=Z(_B=>{"use strict";Object.defineProperty(_B,"__esModule",{value:!0});_B.default=e=>{var t,r,s,a;return{width:(r=(t=e.yogaNode)===null||t===void 0?void 0:t.getComputedWidth())!==null&&r!==void 0?r:0,height:(a=(s=e.yogaNode)===null||s===void 0?void 0:s.getComputedHeight())!==null&&a!==void 0?a:0}}});var lC=Z(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var S5e=_te();Object.defineProperty(Lp,"render",{enumerable:!0,get:function(){return S5e.default}});var b5e=RI();Object.defineProperty(Lp,"Box",{enumerable:!0,get:function(){return b5e.default}});var E5e=vB();Object.defineProperty(Lp,"Text",{enumerable:!0,get:function(){return E5e.default}});var w5e=bte();Object.defineProperty(Lp,"Static",{enumerable:!0,get:function(){return w5e.default}});var T5e=wte();Object.defineProperty(Lp,"Transform",{enumerable:!0,get:function(){return T5e.default}});var P5e=Pte();Object.defineProperty(Lp,"Newline",{enumerable:!0,get:function(){return P5e.default}});var C5e=Dte();Object.defineProperty(Lp,"Spacer",{enumerable:!0,get:function(){return C5e.default}});var A5e=Ite();Object.defineProperty(Lp,"useInput",{enumerable:!0,get:function(){return A5e.default}});var D5e=Ote();Object.defineProperty(Lp,"useApp",{enumerable:!0,get:function(){return D5e.default}});var k5e=BI();Object.defineProperty(Lp,"useStdin",{enumerable:!0,get:function(){return k5e.default}});var I5e=Nte();Object.defineProperty(Lp,"useStdout",{enumerable:!0,get:function(){return I5e.default}});var O5e=Rte();Object.defineProperty(Lp,"useStderr",{enumerable:!0,get:function(){return O5e.default}});var N5e=Lte();Object.defineProperty(Lp,"useFocus",{enumerable:!0,get:function(){return N5e.default}});var R5e=Mte();Object.defineProperty(Lp,"useFocusManager",{enumerable:!0,get:function(){return R5e.default}});var F5e=Bte();Object.defineProperty(Lp,"measureElement",{enumerable:!0,get:function(){return F5e.default}})});var jte=Z((SB,nE)=>{(function(e,t){typeof SB=="object"&&typeof nE<"u"?nE.exports=t():typeof define=="function"&&define.amd?define(t):e.moment=t()})(SB,function(){"use strict";var e;function t(){return e.apply(null,arguments)}function r(T){e=T}function s(T){return T instanceof Array||Object.prototype.toString.call(T)==="[object Array]"}function a(T){return T!=null&&Object.prototype.toString.call(T)==="[object Object]"}function n(T,R){return Object.prototype.hasOwnProperty.call(T,R)}function l(T){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(T).length===0;var R;for(R in T)if(n(T,R))return!1;return!0}function p(T){return T===void 0}function m(T){return typeof T=="number"||Object.prototype.toString.call(T)==="[object Number]"}function g(T){return T instanceof Date||Object.prototype.toString.call(T)==="[object Date]"}function v(T,R){var V=[],X,oe=T.length;for(X=0;X<oe;++X)V.push(R(T[X],X));return V}function w(T,R){for(var V in R)n(R,V)&&(T[V]=R[V]);return n(R,"toString")&&(T.toString=R.toString),n(R,"valueOf")&&(T.valueOf=R.valueOf),T}function C(T,R,V,X){return Jp(T,R,V,X,!0).utc()}function O(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function x(T){return T._pf==null&&(T._pf=O()),T._pf}var U;Array.prototype.some?U=Array.prototype.some:U=function(T){var R=Object(this),V=R.length>>>0,X;for(X=0;X<V;X++)if(X in R&&T.call(this,R[X],X,R))return!0;return!1};function B(T){var R=null,V=!1,X=T._d&&!isNaN(T._d.getTime());if(X&&(R=x(T),V=U.call(R.parsedDateParts,function(oe){return oe!=null}),X=R.overflow<0&&!R.empty&&!R.invalidEra&&!R.invalidMonth&&!R.invalidWeekday&&!R.weekdayMismatch&&!R.nullInput&&!R.invalidFormat&&!R.userInvalidated&&(!R.meridiem||R.meridiem&&V),T._strict&&(X=X&&R.charsLeftOver===0&&R.unusedTokens.length===0&&R.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(T))T._isValid=X;else return X;return T._isValid}function q(T){var R=C(NaN);return T!=null?w(x(R),T):x(R).userInvalidated=!0,R}var J=t.momentProperties=[],le=!1;function ne(T,R){var V,X,oe,qe=J.length;if(p(R._isAMomentObject)||(T._isAMomentObject=R._isAMomentObject),p(R._i)||(T._i=R._i),p(R._f)||(T._f=R._f),p(R._l)||(T._l=R._l),p(R._strict)||(T._strict=R._strict),p(R._tzm)||(T._tzm=R._tzm),p(R._isUTC)||(T._isUTC=R._isUTC),p(R._offset)||(T._offset=R._offset),p(R._pf)||(T._pf=x(R)),p(R._locale)||(T._locale=R._locale),qe>0)for(V=0;V<qe;V++)X=J[V],oe=R[X],p(oe)||(T[X]=oe);return T}function ge(T){ne(this,T),this._d=new Date(T._d!=null?T._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),le===!1&&(le=!0,t.updateOffset(this),le=!1)}function Re(T){return T instanceof ge||T!=null&&T._isAMomentObject!=null}function Ue(T){t.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+T)}function Qe(T,R){var V=!0;return w(function(){if(t.deprecationHandler!=null&&t.deprecationHandler(null,T),V){var X=[],oe,qe,Nt,Or=arguments.length;for(qe=0;qe<Or;qe++){if(oe="",typeof arguments[qe]=="object"){oe+=`
|
|
165
165
|
[`+qe+"] ";for(Nt in arguments[0])n(arguments[0],Nt)&&(oe+=Nt+": "+arguments[0][Nt]+", ");oe=oe.slice(0,-2)}else oe=arguments[qe];X.push(oe)}Ue(T+`
|
|
166
166
|
Arguments: `+Array.prototype.slice.call(X).join("")+`
|
|
167
|
-
`+new Error().stack),V=!1}return R.apply(this,arguments)},R)}var ze={};function $t(T,R){t.deprecationHandler!=null&&t.deprecationHandler(T,R),ze[T]||(Ue(R),ze[T]=!0)}t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;function bt(T){return typeof Function<"u"&&T instanceof Function||Object.prototype.toString.call(T)==="[object Function]"}function _t(T){var R,V;for(V in T)n(T,V)&&(R=T[V],bt(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 Ge(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 fe(T){T!=null&&this.set(T)}var Le;Object.keys?Le=Object.keys:Le=function(T){var R,V=[];for(R in T)n(T,R)&&V.push(R);return V};var tt={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function De(T,R,V){var X=this._calendar[T]||this._calendar.sameElse;return bt(X)?X.call(R,V):X}function Oe(T,R,V){var X=""+Math.abs(T),oe=R-X.length,qe=T>=0;return(qe?V?"+":"":"-")+Math.pow(10,Math.max(0,oe)).toString().substr(1)+X}var $e=/(\[[^\[]*\])|(\\)?([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,ht=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Ot={},sr={};function st(T,R,V,X){var oe=X;typeof X=="string"&&(oe=function(){return this[X]()}),T&&(sr[T]=oe),R&&(sr[R[0]]=function(){return Oe(oe.apply(this,arguments),R[1],R[2])}),V&&(sr[V]=function(){return this.localeData().ordinal(oe.apply(this,arguments),T)})}function Vt(T){return T.match(/\[[\s\S]/)?T.replace(/^\[|\]$/g,""):T.replace(/\\/g,"")}function Be(T){var R=T.match($e),V,X;for(V=0,X=R.length;V<X;V++)sr[R[V]]?R[V]=sr[R[V]]:R[V]=Vt(R[V]);return function(oe){var qe="",Nt;for(Nt=0;Nt<X;Nt++)qe+=bt(R[Nt])?R[Nt].call(oe,T):R[Nt];return qe}}function lt(T,R){return T.isValid()?(R=xt(R,T.localeData()),Ot[R]=Ot[R]||Be(R),Ot[R](T)):T.localeData().invalidDate()}function xt(T,R){var V=5;function X(oe){return R.longDateFormat(oe)||oe}for(ht.lastIndex=0;V>=0&&ht.test(T);)T=T.replace(ht,X),ht.lastIndex=0,V-=1;return T}var or={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 jt(T){var R=this._longDateFormat[T],V=this._longDateFormat[T.toUpperCase()];return R||!V?R:(this._longDateFormat[T]=V.match($e).map(function(X){return X==="MMMM"||X==="MM"||X==="DD"||X==="dddd"?X.slice(1):X}).join(""),this._longDateFormat[T])}var Et="Invalid date";function At(){return this._invalidDate}var D="%d",Ht=/\d{1,2}/;function fr(T){return this._ordinal.replace("%d",T)}var en={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 Rt(T,R,V,X){var oe=this._relativeTime[V];return bt(oe)?oe(T,R,V,X):oe.replace(/%d/i,T)}function Bt(T,R){var V=this._relativeTime[T>0?"future":"past"];return bt(V)?V(R):V.replace(/%s/i,R)}var mr={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 we(T){return typeof T=="string"?mr[T]||mr[T.toLowerCase()]:void 0}function ot(T){var R={},V,X;for(X in T)n(T,X)&&(V=we(X),V&&(R[V]=T[X]));return R}var ir={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 Sr(T){var R=[],V;for(V in T)n(T,V)&&R.push({unit:V,priority:ir[V]});return R.sort(function(X,oe){return X.priority-oe.priority}),R}var an=/\d/,yn=/\d\d/,oi=/\d{3}/,Zn=/\d{4}/,Ci=/[+-]?\d{6}/,Un=/\d\d?/,va=/\d\d\d\d?/,Aa=/\d\d\d\d\d\d?/,Os=/\d{1,3}/,xa=/\d{1,4}/,uc=/[+-]?\d{1,6}/,Tu=/\d+/,ft=/[+-]?\d+/,Jt=/Z|[+-]\d\d:?\d\d/gi,Gt=/Z|[+-]\d\d(?::?\d\d)?/gi,gr=/[+-]?\d+(\.\d{1,3})?/,Qr=/[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,$r=/^[1-9]\d?/,ci=/^([1-9]\d|\d)/,ss;ss={};function Qt(T,R,V){ss[T]=bt(R)?R:function(X,oe){return X&&V?V:R}}function us(T,R){return n(ss,T)?ss[T](R._strict,R._locale):new RegExp(ao(T))}function ao(T){return cs(T.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(R,V,X,oe,qe){return V||X||oe||qe}))}function cs(T){return T.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function os(T){return T<0?Math.ceil(T)||0:Math.floor(T)}function kn(T){var R=+T,V=0;return R!==0&&isFinite(R)&&(V=os(R)),V}var Eo={};function li(T,R){var V,X=R,oe;for(typeof T=="string"&&(T=[T]),m(R)&&(X=function(qe,Nt){Nt[R]=kn(qe)}),oe=T.length,V=0;V<oe;V++)Eo[T[V]]=X}function zs(T,R){li(T,function(V,X,oe,qe){oe._w=oe._w||{},R(V,oe._w,oe,qe)})}function Yc(T,R,V){R!=null&&n(Eo,T)&&Eo[T](R,V._a,V,T)}function ea(T){return T%4===0&&T%100!==0||T%400===0}var Pr=0,Da=1,aa=2,mo=3,ka=4,ua=5,wo=6,fp=7,Cc=8;st("Y",0,0,function(){var T=this.year();return T<=9999?Oe(T,4):"+"+T}),st(0,["YY",2],0,function(){return this.year()%100}),st(0,["YYYY",4],0,"year"),st(0,["YYYYY",5],0,"year"),st(0,["YYYYYY",6,!0],0,"year"),Qt("Y",ft),Qt("YY",Un,yn),Qt("YYYY",xa,Zn),Qt("YYYYY",uc,Ci),Qt("YYYYYY",uc,Ci),li(["YYYYY","YYYYYY"],Pr),li("YYYY",function(T,R){R[Pr]=T.length===2?t.parseTwoDigitYear(T):kn(T)}),li("YY",function(T,R){R[Pr]=t.parseTwoDigitYear(T)}),li("Y",function(T,R){R[Pr]=parseInt(T,10)});function Hu(T){return ea(T)?366:365}t.parseTwoDigitYear=function(T){return kn(T)+(kn(T)>68?1900:2e3)};var Jc=Pn("FullYear",!0);function Vp(){return ea(this.year())}function Pn(T,R){return function(V){return V!=null?(dp(this,T,V),t.updateOffset(this,R),this):cc(this,T)}}function cc(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 dp(T,R,V){var X,oe,qe,Nt,Or;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}qe=V,Nt=T.month(),Or=T.date(),Or=Or===29&&Nt===1&&!ea(qe)?28:Or,oe?X.setUTCFullYear(qe,Nt,Or):X.setFullYear(qe,Nt,Or)}}function Pu(T){return T=we(T),bt(this[T])?this[T]():this}function Xs(T,R){if(typeof T=="object"){T=ot(T);var V=Sr(T),X,oe=V.length;for(X=0;X<oe;X++)this[V[X].unit](T[V[X].unit])}else if(T=we(T),bt(this[T]))return this[T](R);return this}function Ns(T,R){return(T%R+R)%R}var Cs;Array.prototype.indexOf?Cs=Array.prototype.indexOf:Cs=function(T){var R;for(R=0;R<this.length;++R)if(this[R]===T)return R;return-1};function Oo(T,R){if(isNaN(T)||isNaN(R))return NaN;var V=Ns(R,12);return T+=(R-V)/12,V===1?ea(T)?29:28:31-V%7%2}st("M",["MM",2],"Mo",function(){return this.month()+1}),st("MMM",0,0,function(T){return this.localeData().monthsShort(this,T)}),st("MMMM",0,0,function(T){return this.localeData().months(this,T)}),Qt("M",Un,$r),Qt("MM",Un,yn),Qt("MMM",function(T,R){return R.monthsShortRegex(T)}),Qt("MMMM",function(T,R){return R.monthsRegex(T)}),li(["M","MM"],function(T,R){R[Da]=kn(T)-1}),li(["MMM","MMMM"],function(T,R,V,X){var oe=V._locale.monthsParse(T,X,V._strict);oe!=null?R[Da]=oe:x(V).invalidMonth=T});var Sa="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Cu="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),ou=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ia=Qr,Hp=Qr;function pm(T,R){return T?s(this._months)?this._months[T.month()]:this._months[(this._months.isFormat||ou).test(R)?"format":"standalone"][T.month()]:s(this._months)?this._months:this._months.standalone}function zp(T,R){return T?s(this._monthsShort)?this._monthsShort[T.month()]:this._monthsShort[ou.test(R)?"format":"standalone"][T.month()]:s(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function hp(T,R,V){var X,oe,qe,Nt=T.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],X=0;X<12;++X)qe=C([2e3,X]),this._shortMonthsParse[X]=this.monthsShort(qe,"").toLocaleLowerCase(),this._longMonthsParse[X]=this.months(qe,"").toLocaleLowerCase();return V?R==="MMM"?(oe=Cs.call(this._shortMonthsParse,Nt),oe!==-1?oe:null):(oe=Cs.call(this._longMonthsParse,Nt),oe!==-1?oe:null):R==="MMM"?(oe=Cs.call(this._shortMonthsParse,Nt),oe!==-1?oe:(oe=Cs.call(this._longMonthsParse,Nt),oe!==-1?oe:null)):(oe=Cs.call(this._longMonthsParse,Nt),oe!==-1?oe:(oe=Cs.call(this._shortMonthsParse,Nt),oe!==-1?oe:null))}function au(T,R,V){var X,oe,qe;if(this._monthsParseExact)return hp.call(this,T,R,V);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),X=0;X<12;X++){if(oe=C([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]&&(qe="^"+this.months(oe,"")+"|^"+this.monthsShort(oe,""),this._monthsParse[X]=new RegExp(qe.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 rr(T,R){if(!T.isValid())return T;if(typeof R=="string"){if(/^\d+$/.test(R))R=kn(R);else if(R=T.localeData().monthsParse(R),!m(R))return T}var V=R,X=T.date();return X=X<29?X:Math.min(X,Oo(T.year(),V)),T._isUTC?T._d.setUTCMonth(V,X):T._d.setMonth(V,X),T}function Ac(T){return T!=null?(rr(this,T),t.updateOffset(this,!0),this):cc(this,"Month")}function c0(){return Oo(this.year(),this.month())}function Sl(T){return this._monthsParseExact?(n(this,"_monthsRegex")||bl.call(this),T?this._monthsShortStrictRegex:this._monthsShortRegex):(n(this,"_monthsShortRegex")||(this._monthsShortRegex=Ia),this._monthsShortStrictRegex&&T?this._monthsShortStrictRegex:this._monthsShortRegex)}function Rs(T){return this._monthsParseExact?(n(this,"_monthsRegex")||bl.call(this),T?this._monthsStrictRegex:this._monthsRegex):(n(this,"_monthsRegex")||(this._monthsRegex=Hp),this._monthsStrictRegex&&T?this._monthsStrictRegex:this._monthsRegex)}function bl(){function T(Ln,Li){return Li.length-Ln.length}var R=[],V=[],X=[],oe,qe,Nt,Or;for(oe=0;oe<12;oe++)qe=C([2e3,oe]),Nt=cs(this.monthsShort(qe,"")),Or=cs(this.months(qe,"")),R.push(Nt),V.push(Or),X.push(Or),X.push(Nt);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")}function Sh(T,R,V,X,oe,qe,Nt){var Or;return T<100&&T>=0?(Or=new Date(T+400,R,V,X,oe,qe,Nt),isFinite(Or.getFullYear())&&Or.setFullYear(T)):Or=new Date(T,R,V,X,oe,qe,Nt),Or}function qf(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 Xc(T,R,V){var X=7+R-V,oe=(7+qf(T,0,X).getUTCDay()-R)%7;return-oe+X-1}function bh(T,R,V,X,oe){var qe=(7+V-X)%7,Nt=Xc(T,X,oe),Or=1+7*(R-1)+qe+Nt,Ln,Li;return Or<=0?(Ln=T-1,Li=Hu(Ln)+Or):Or>Hu(T)?(Ln=T+1,Li=Or-Hu(T)):(Ln=T,Li=Or),{year:Ln,dayOfYear:Li}}function wr(T,R,V){var X=Xc(T.year(),R,V),oe=Math.floor((T.dayOfYear()-X-1)/7)+1,qe,Nt;return oe<1?(Nt=T.year()-1,qe=oe+ls(Nt,R,V)):oe>ls(T.year(),R,V)?(qe=oe-ls(T.year(),R,V),Nt=T.year()+1):(Nt=T.year(),qe=oe),{week:qe,year:Nt}}function ls(T,R,V){var X=Xc(T,R,V),oe=Xc(T+1,R,V);return(Hu(T)-X+oe)/7}st("w",["ww",2],"wo","week"),st("W",["WW",2],"Wo","isoWeek"),Qt("w",Un,$r),Qt("ww",Un,yn),Qt("W",Un,$r),Qt("WW",Un,yn),zs(["w","ww","W","WW"],function(T,R,V,X){R[X.substr(0,1)]=kn(T)});function Uf(T){return wr(T,this._week.dow,this._week.doy).week}var lc={dow:0,doy:6};function pc(){return this._week.dow}function $f(){return this._week.doy}function fm(T){var R=this.localeData().week(this);return T==null?R:this.add((T-R)*7,"d")}function Eh(T){var R=wr(this,1,4).week;return T==null?R:this.add((T-R)*7,"d")}st("d",0,"do","day"),st("dd",0,0,function(T){return this.localeData().weekdaysMin(this,T)}),st("ddd",0,0,function(T){return this.localeData().weekdaysShort(this,T)}),st("dddd",0,0,function(T){return this.localeData().weekdays(this,T)}),st("e",0,0,"weekday"),st("E",0,0,"isoWeekday"),Qt("d",Un),Qt("e",Un),Qt("E",Un),Qt("dd",function(T,R){return R.weekdaysMinRegex(T)}),Qt("ddd",function(T,R){return R.weekdaysShortRegex(T)}),Qt("dddd",function(T,R){return R.weekdaysRegex(T)}),zs(["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}),zs(["d","e","E"],function(T,R,V,X){R[X]=kn(T)});function l0(T,R){return typeof T!="string"?T:isNaN(T)?(T=R.weekdaysParse(T),typeof T=="number"?T:null):parseInt(T,10)}function Au(T,R){return typeof T=="string"?R.weekdaysParse(T)%7||7:isNaN(T)?null:T}function Du(T,R){return T.slice(R,7).concat(T.slice(0,R))}var p0="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),f0="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Vf="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Va=Qr,Hf=Qr,zu=Qr;function mp(T,R){var V=s(this._weekdays)?this._weekdays:this._weekdays[T&&T!==!0&&this._weekdays.isFormat.test(R)?"format":"standalone"];return T===!0?Du(V,this._week.dow):T?V[T.day()]:V}function Dc(T){return T===!0?Du(this._weekdaysShort,this._week.dow):T?this._weekdaysShort[T.day()]:this._weekdaysShort}function fc(T){return T===!0?Du(this._weekdaysMin,this._week.dow):T?this._weekdaysMin[T.day()]:this._weekdaysMin}function El(T,R,V){var X,oe,qe,Nt=T.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],X=0;X<7;++X)qe=C([2e3,1]).day(X),this._minWeekdaysParse[X]=this.weekdaysMin(qe,"").toLocaleLowerCase(),this._shortWeekdaysParse[X]=this.weekdaysShort(qe,"").toLocaleLowerCase(),this._weekdaysParse[X]=this.weekdays(qe,"").toLocaleLowerCase();return V?R==="dddd"?(oe=Cs.call(this._weekdaysParse,Nt),oe!==-1?oe:null):R==="ddd"?(oe=Cs.call(this._shortWeekdaysParse,Nt),oe!==-1?oe:null):(oe=Cs.call(this._minWeekdaysParse,Nt),oe!==-1?oe:null):R==="dddd"?(oe=Cs.call(this._weekdaysParse,Nt),oe!==-1||(oe=Cs.call(this._shortWeekdaysParse,Nt),oe!==-1)?oe:(oe=Cs.call(this._minWeekdaysParse,Nt),oe!==-1?oe:null)):R==="ddd"?(oe=Cs.call(this._shortWeekdaysParse,Nt),oe!==-1||(oe=Cs.call(this._weekdaysParse,Nt),oe!==-1)?oe:(oe=Cs.call(this._minWeekdaysParse,Nt),oe!==-1?oe:null)):(oe=Cs.call(this._minWeekdaysParse,Nt),oe!==-1||(oe=Cs.call(this._weekdaysParse,Nt),oe!==-1)?oe:(oe=Cs.call(this._shortWeekdaysParse,Nt),oe!==-1?oe:null))}function wl(T,R,V){var X,oe,qe;if(this._weekdaysParseExact)return El.call(this,T,R,V);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),X=0;X<7;X++){if(oe=C([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]||(qe="^"+this.weekdays(oe,"")+"|^"+this.weekdaysShort(oe,"")+"|^"+this.weekdaysMin(oe,""),this._weekdaysParse[X]=new RegExp(qe.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 To(T){if(!this.isValid())return T!=null?this:NaN;var R=cc(this,"Day");return T!=null?(T=l0(T,this.localeData()),this.add(T-R,"d")):R}function Qn(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 Zc(T){if(!this.isValid())return T!=null?this:NaN;if(T!=null){var R=Au(T,this.localeData());return this.day(this.day()%7?R:R-7)}else return this.day()||7}function Ws(T){return this._weekdaysParseExact?(n(this,"_weekdaysRegex")||Gp.call(this),T?this._weekdaysStrictRegex:this._weekdaysRegex):(n(this,"_weekdaysRegex")||(this._weekdaysRegex=Va),this._weekdaysStrictRegex&&T?this._weekdaysStrictRegex:this._weekdaysRegex)}function ei(T){return this._weekdaysParseExact?(n(this,"_weekdaysRegex")||Gp.call(this),T?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(n(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Hf),this._weekdaysShortStrictRegex&&T?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Wp(T){return this._weekdaysParseExact?(n(this,"_weekdaysRegex")||Gp.call(this),T?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(n(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=zu),this._weekdaysMinStrictRegex&&T?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Gp(){function T(mu,Zu){return Zu.length-mu.length}var R=[],V=[],X=[],oe=[],qe,Nt,Or,Ln,Li;for(qe=0;qe<7;qe++)Nt=C([2e3,1]).day(qe),Or=cs(this.weekdaysMin(Nt,"")),Ln=cs(this.weekdaysShort(Nt,"")),Li=cs(this.weekdays(Nt,"")),R.push(Or),V.push(Ln),X.push(Li),oe.push(Or),oe.push(Ln),oe.push(Li);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 Wu(){return this.hours()%12||12}function zf(){return this.hours()||24}st("H",["HH",2],0,"hour"),st("h",["hh",2],0,Wu),st("k",["kk",2],0,zf),st("hmm",0,0,function(){return""+Wu.apply(this)+Oe(this.minutes(),2)}),st("hmmss",0,0,function(){return""+Wu.apply(this)+Oe(this.minutes(),2)+Oe(this.seconds(),2)}),st("Hmm",0,0,function(){return""+this.hours()+Oe(this.minutes(),2)}),st("Hmmss",0,0,function(){return""+this.hours()+Oe(this.minutes(),2)+Oe(this.seconds(),2)});function Oa(T,R){st(T,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),R)})}Oa("a",!0),Oa("A",!1);function Wf(T,R){return R._meridiemParse}Qt("a",Wf),Qt("A",Wf),Qt("H",Un,ci),Qt("h",Un,$r),Qt("k",Un,$r),Qt("HH",Un,yn),Qt("hh",Un,yn),Qt("kk",Un,yn),Qt("hmm",va),Qt("hmmss",Aa),Qt("Hmm",va),Qt("Hmmss",Aa),li(["H","HH"],mo),li(["k","kk"],function(T,R,V){var X=kn(T);R[mo]=X===24?0:X}),li(["a","A"],function(T,R,V){V._isPm=V._locale.isPM(T),V._meridiem=T}),li(["h","hh"],function(T,R,V){R[mo]=kn(T),x(V).bigHour=!0}),li("hmm",function(T,R,V){var X=T.length-2;R[mo]=kn(T.substr(0,X)),R[ka]=kn(T.substr(X)),x(V).bigHour=!0}),li("hmmss",function(T,R,V){var X=T.length-4,oe=T.length-2;R[mo]=kn(T.substr(0,X)),R[ka]=kn(T.substr(X,2)),R[ua]=kn(T.substr(oe)),x(V).bigHour=!0}),li("Hmm",function(T,R,V){var X=T.length-2;R[mo]=kn(T.substr(0,X)),R[ka]=kn(T.substr(X))}),li("Hmmss",function(T,R,V){var X=T.length-4,oe=T.length-2;R[mo]=kn(T.substr(0,X)),R[ka]=kn(T.substr(X,2)),R[ua]=kn(T.substr(oe))});function wh(T){return(T+"").toLowerCase().charAt(0)==="p"}var dc=/[ap]\.?m?\.?/i,ps=Pn("Hours",!0);function gp(T,R,V){return T>11?V?"pm":"PM":V?"am":"AM"}var ku={calendar:tt,longDateFormat:or,invalidDate:Et,ordinal:D,dayOfMonthOrdinalParse:Ht,relativeTime:en,months:Sa,monthsShort:Cu,week:lc,weekdays:p0,weekdaysMin:Vf,weekdaysShort:f0,meridiemParse:dc},Zs={},No={},zo;function Gf(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 hc(T){return T&&T.toLowerCase().replace("_","-")}function Tl(T){for(var R=0,V,X,oe,qe;R<T.length;){for(qe=hc(T[R]).split("-"),V=qe.length,X=hc(T[R+1]),X=X?X.split("-"):null;V>0;){if(oe=se(qe.slice(0,V).join("-")),oe)return oe;if(X&&X.length>=V&&Gf(qe,X)>=V-1)break;V--}R++}return zo}function ye(T){return!!(T&&T.match("^[^/\\\\]*$"))}function se(T){var R=null,V;if(Zs[T]===void 0&&typeof nE<"u"&&nE&&nE.exports&&ye(T))try{R=zo._abbr,V=require,V("./locale/"+T),de(R)}catch{Zs[T]=null}return Zs[T]}function de(T,R){var V;return T&&(p(R)?V=it(T):V=je(T,R),V?zo=V:typeof console<"u"&&console.warn&&console.warn("Locale "+T+" not found. Did you forget to load it?")),zo._abbr}function je(T,R){if(R!==null){var V,X=ku;if(R.abbr=T,Zs[T]!=null)$t("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=Zs[T]._config;else if(R.parentLocale!=null)if(Zs[R.parentLocale]!=null)X=Zs[R.parentLocale]._config;else if(V=se(R.parentLocale),V!=null)X=V._config;else return No[R.parentLocale]||(No[R.parentLocale]=[]),No[R.parentLocale].push({name:T,config:R}),null;return Zs[T]=new fe(Ge(X,R)),No[T]&&No[T].forEach(function(oe){je(oe.name,oe.config)}),de(T),Zs[T]}else return delete Zs[T],null}function mt(T,R){if(R!=null){var V,X,oe=ku;Zs[T]!=null&&Zs[T].parentLocale!=null?Zs[T].set(Ge(Zs[T]._config,R)):(X=se(T),X!=null&&(oe=X._config),R=Ge(oe,R),X==null&&(R.abbr=T),V=new fe(R),V.parentLocale=Zs[T],Zs[T]=V),de(T)}else Zs[T]!=null&&(Zs[T].parentLocale!=null?(Zs[T]=Zs[T].parentLocale,T===de()&&de(T)):Zs[T]!=null&&delete Zs[T]);return Zs[T]}function it(T){var R;if(T&&T._locale&&T._locale._abbr&&(T=T._locale._abbr),!T)return zo;if(!s(T)){if(R=se(T),R)return R;T=[T]}return Tl(T)}function It(){return Le(Zs)}function Ft(T){var R,V=T._a;return V&&x(T).overflow===-2&&(R=V[Da]<0||V[Da]>11?Da:V[aa]<1||V[aa]>Oo(V[Pr],V[Da])?aa:V[mo]<0||V[mo]>24||V[mo]===24&&(V[ka]!==0||V[ua]!==0||V[wo]!==0)?mo:V[ka]<0||V[ka]>59?ka:V[ua]<0||V[ua]>59?ua:V[wo]<0||V[wo]>999?wo:-1,x(T)._overflowDayOfYear&&(R<Pr||R>aa)&&(R=aa),x(T)._overflowWeeks&&R===-1&&(R=fp),x(T)._overflowWeekday&&R===-1&&(R=Cc),x(T).overflow=R),T}var Zt=/^\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)?)?$/,jr=/^\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)?)?$/,ti=/Z|[+-]\d\d(?::?\d\d)?/,un=[["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]],Bn=[["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/]],uu=/^\/?Date\((-?\d+)/i,Kp=/^(?:(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}))$/,Ha={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 Na(T){var R,V,X=T._i,oe=Zt.exec(X)||jr.exec(X),qe,Nt,Or,Ln,Li=un.length,mu=Bn.length;if(oe){for(x(T).iso=!0,R=0,V=Li;R<V;R++)if(un[R][1].exec(oe[1])){Nt=un[R][0],qe=un[R][2]!==!1;break}if(Nt==null){T._isValid=!1;return}if(oe[3]){for(R=0,V=mu;R<V;R++)if(Bn[R][1].exec(oe[3])){Or=(oe[2]||" ")+Bn[R][0];break}if(Or==null){T._isValid=!1;return}}if(!qe&&Or!=null){T._isValid=!1;return}if(oe[4])if(ti.exec(oe[4]))Ln="Z";else{T._isValid=!1;return}T._f=Nt+(Or||"")+(Ln||""),za(T)}else T._isValid=!1}function Wi(T,R,V,X,oe,qe){var Nt=[In(T),Cu.indexOf(R),parseInt(V,10),parseInt(X,10),parseInt(oe,10)];return qe&&Nt.push(parseInt(qe,10)),Nt}function In(T){var R=parseInt(T,10);return R<=49?2e3+R:R<=999?1900+R:R}function tn(T){return T.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function xn(T,R,V){if(T){var X=f0.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 hi(T,R,V){if(T)return Ha[T];if(R)return 0;var X=parseInt(V,10),oe=X%100,qe=(X-oe)/100;return qe*60+oe}function _s(T){var R=Kp.exec(tn(T._i)),V;if(R){if(V=Wi(R[4],R[3],R[2],R[5],R[6],R[7]),!xn(R[1],V,T))return;T._a=V,T._tzm=hi(R[8],R[9],R[10]),T._d=qf.apply(null,T._a),T._d.setUTCMinutes(T._d.getUTCMinutes()-T._tzm),x(T).rfc2822=!0}else T._isValid=!1}function Ro(T){var R=uu.exec(T._i);if(R!==null){T._d=new Date(+R[1]);return}if(Na(T),T._isValid===!1)delete T._isValid;else return;if(_s(T),T._isValid===!1)delete T._isValid;else return;T._strict?T._isValid=!1:t.createFromInputFallback(T)}t.createFromInputFallback=Qe("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 ca(T,R,V){return T!=null?T:R!=null?R:V}function kc(T){var R=new Date(t.now());return T._useUTC?[R.getUTCFullYear(),R.getUTCMonth(),R.getUTCDate()]:[R.getFullYear(),R.getMonth(),R.getDate()]}function Fo(T){var R,V,X=[],oe,qe,Nt;if(!T._d){for(oe=kc(T),T._w&&T._a[aa]==null&&T._a[Da]==null&&Iu(T),T._dayOfYear!=null&&(Nt=ca(T._a[Pr],oe[Pr]),(T._dayOfYear>Hu(Nt)||T._dayOfYear===0)&&(x(T)._overflowDayOfYear=!0),V=qf(Nt,0,T._dayOfYear),T._a[Da]=V.getUTCMonth(),T._a[aa]=V.getUTCDate()),R=0;R<3&&T._a[R]==null;++R)T._a[R]=X[R]=oe[R];for(;R<7;R++)T._a[R]=X[R]=T._a[R]==null?R===2?1:0:T._a[R];T._a[mo]===24&&T._a[ka]===0&&T._a[ua]===0&&T._a[wo]===0&&(T._nextDay=!0,T._a[mo]=0),T._d=(T._useUTC?qf:Sh).apply(null,X),qe=T._useUTC?T._d.getUTCDay():T._d.getDay(),T._tzm!=null&&T._d.setUTCMinutes(T._d.getUTCMinutes()-T._tzm),T._nextDay&&(T._a[mo]=24),T._w&&typeof T._w.d<"u"&&T._w.d!==qe&&(x(T).weekdayMismatch=!0)}}function Iu(T){var R,V,X,oe,qe,Nt,Or,Ln,Li;R=T._w,R.GG!=null||R.W!=null||R.E!=null?(qe=1,Nt=4,V=ca(R.GG,T._a[Pr],wr(Yn(),1,4).year),X=ca(R.W,1),oe=ca(R.E,1),(oe<1||oe>7)&&(Ln=!0)):(qe=T._locale._week.dow,Nt=T._locale._week.doy,Li=wr(Yn(),qe,Nt),V=ca(R.gg,T._a[Pr],Li.year),X=ca(R.w,Li.week),R.d!=null?(oe=R.d,(oe<0||oe>6)&&(Ln=!0)):R.e!=null?(oe=R.e+qe,(R.e<0||R.e>6)&&(Ln=!0)):oe=qe),X<1||X>ls(V,qe,Nt)?x(T)._overflowWeeks=!0:Ln!=null?x(T)._overflowWeekday=!0:(Or=bh(V,X,oe,qe,Nt),T._a[Pr]=Or.year,T._dayOfYear=Or.dayOfYear)}t.ISO_8601=function(){},t.RFC_2822=function(){};function za(T){if(T._f===t.ISO_8601){Na(T);return}if(T._f===t.RFC_2822){_s(T);return}T._a=[],x(T).empty=!0;var R=""+T._i,V,X,oe,qe,Nt,Or=R.length,Ln=0,Li,mu;for(oe=xt(T._f,T._locale).match($e)||[],mu=oe.length,V=0;V<mu;V++)qe=oe[V],X=(R.match(us(qe,T))||[])[0],X&&(Nt=R.substr(0,R.indexOf(X)),Nt.length>0&&x(T).unusedInput.push(Nt),R=R.slice(R.indexOf(X)+X.length),Ln+=X.length),sr[qe]?(X?x(T).empty=!1:x(T).unusedTokens.push(qe),Yc(qe,X,T)):T._strict&&!X&&x(T).unusedTokens.push(qe);x(T).charsLeftOver=Or-Ln,R.length>0&&x(T).unusedInput.push(R),T._a[mo]<=12&&x(T).bigHour===!0&&T._a[mo]>0&&(x(T).bigHour=void 0),x(T).parsedDateParts=T._a.slice(0),x(T).meridiem=T._meridiem,T._a[mo]=Pl(T._locale,T._a[mo],T._meridiem),Li=x(T).era,Li!==null&&(T._a[Pr]=T._locale.erasConvertYear(Li,T._a[Pr])),Fo(T),Ft(T)}function Pl(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 yp(T){var R,V,X,oe,qe,Nt,Or=!1,Ln=T._f.length;if(Ln===0){x(T).invalidFormat=!0,T._d=new Date(NaN);return}for(oe=0;oe<Ln;oe++)qe=0,Nt=!1,R=ne({},T),T._useUTC!=null&&(R._useUTC=T._useUTC),R._f=T._f[oe],za(R),B(R)&&(Nt=!0),qe+=x(R).charsLeftOver,qe+=x(R).unusedTokens.length*10,x(R).score=qe,Or?qe<X&&(X=qe,V=R):(X==null||qe<X||Nt)&&(X=qe,V=R,Nt&&(Or=!0));w(T,V||R)}function Qc(T){if(!T._d){var R=ot(T._i),V=R.day===void 0?R.date:R.day;T._a=v([R.year,R.month,V,R.hour,R.minute,R.second,R.millisecond],function(X){return X&&parseInt(X,10)}),Fo(T)}}function Yp(T){var R=new ge(Ft(Fs(T)));return R._nextDay&&(R.add(1,"d"),R._nextDay=void 0),R}function Fs(T){var R=T._i,V=T._f;return T._locale=T._locale||it(T._l),R===null||V===void 0&&R===""?q({nullInput:!0}):(typeof R=="string"&&(T._i=R=T._locale.preparse(R)),Re(R)?new ge(Ft(R)):(g(R)?T._d=R:s(V)?yp(T):V?za(T):fs(T),B(T)||(T._d=null),T))}function fs(T){var R=T._i;p(R)?T._d=new Date(t.now()):g(R)?T._d=new Date(R.valueOf()):typeof R=="string"?Ro(T):s(R)?(T._a=v(R.slice(0),function(V){return parseInt(V,10)}),Fo(T)):a(R)?Qc(T):m(R)?T._d=new Date(R):t.createFromInputFallback(T)}function Jp(T,R,V,X,oe){var qe={};return(R===!0||R===!1)&&(X=R,R=void 0),(V===!0||V===!1)&&(X=V,V=void 0),(a(T)&&l(T)||s(T)&&T.length===0)&&(T=void 0),qe._isAMomentObject=!0,qe._useUTC=qe._isUTC=oe,qe._l=V,qe._i=T,qe._f=R,qe._strict=X,Yp(qe)}function Yn(T,R,V,X){return Jp(T,R,V,X,!1)}var Th=Qe("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var T=Yn.apply(null,arguments);return this.isValid()&&T.isValid()?T<this?this:T:q()}),Wa=Qe("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var T=Yn.apply(null,arguments);return this.isValid()&&T.isValid()?T>this?this:T:q()});function $i(T,R){var V,X;if(R.length===1&&s(R[0])&&(R=R[0]),!R.length)return Yn();for(V=R[0],X=1;X<R.length;++X)(!R[X].isValid()||R[X][T](V))&&(V=R[X]);return V}function mc(){var T=[].slice.call(arguments,0);return $i("isBefore",T)}function Ph(){var T=[].slice.call(arguments,0);return $i("isAfter",T)}var Od=function(){return Date.now?Date.now():+new Date},el=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Yy(T){var R,V=!1,X,oe=el.length;for(R in T)if(n(T,R)&&!(Cs.call(el,R)!==-1&&(T[R]==null||!isNaN(T[R]))))return!1;for(X=0;X<oe;++X)if(T[el[X]]){if(V)return!1;parseFloat(T[el[X]])!==kn(T[el[X]])&&(V=!0)}return!0}function Ch(){return this._isValid}function Ah(){return ai(NaN)}function tl(T){var R=ot(T),V=R.year||0,X=R.quarter||0,oe=R.month||0,qe=R.week||R.isoWeek||0,Nt=R.day||0,Or=R.hour||0,Ln=R.minute||0,Li=R.second||0,mu=R.millisecond||0;this._isValid=Yy(R),this._milliseconds=+mu+Li*1e3+Ln*6e4+Or*1e3*60*60,this._days=+Nt+qe*7,this._months=+oe+X*3+V*12,this._data={},this._locale=it(),this._bubble()}function ta(T){return T instanceof tl}function Ic(T){return T<0?Math.round(-1*T)*-1:Math.round(T)}function gc(T,R,V){var X=Math.min(T.length,R.length),oe=Math.abs(T.length-R.length),qe=0,Nt;for(Nt=0;Nt<X;Nt++)(V&&T[Nt]!==R[Nt]||!V&&kn(T[Nt])!==kn(R[Nt]))&&qe++;return qe+oe}function Kf(T,R){st(T,0,0,function(){var V=this.utcOffset(),X="+";return V<0&&(V=-V,X="-"),X+Oe(~~(V/60),2)+R+Oe(~~V%60,2)})}Kf("Z",":"),Kf("ZZ",""),Qt("Z",Gt),Qt("ZZ",Gt),li(["Z","ZZ"],function(T,R,V){V._useUTC=!0,V._tzm=Lo(Gt,T)});var Wo=/([\+\-]|\d\d)/gi;function Lo(T,R){var V=(R||"").match(T),X,oe,qe;return V===null?null:(X=V[V.length-1]||[],oe=(X+"").match(Wo)||["-",0,0],qe=+(oe[1]*60)+kn(oe[2]),qe===0?0:oe[0]==="+"?qe:-qe)}function Ss(T,R){var V,X;return R._isUTC?(V=R.clone(),X=(Re(T)||g(T)?T.valueOf():Yn(T).valueOf())-V.valueOf(),V._d.setTime(V._d.valueOf()+X),t.updateOffset(V,!1),V):Yn(T).local()}function rl(T){return-Math.round(T._d.getTimezoneOffset())}t.updateOffset=function(){};function Nd(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=Lo(Gt,T),T===null)return this}else Math.abs(T)<16&&!V&&(T=T*60);return!this._isUTC&&R&&(oe=rl(this)),this._offset=T,this._isUTC=!0,oe!=null&&this.add(oe,"m"),X!==T&&(!R||this._changeInProgress?Ou(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:rl(this)}function as(T,R){return T!=null?(typeof T!="string"&&(T=-T),this.utcOffset(T,R),this):-this.utcOffset()}function dm(T){return this.utcOffset(0,T)}function hm(T){return this._isUTC&&(this.utcOffset(0,T),this._isUTC=!1,T&&this.subtract(rl(this),"m")),this}function cu(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var T=Lo(Jt,this._i);T!=null?this.utcOffset(T):this.utcOffset(0,!0)}return this}function Go(T){return this.isValid()?(T=T?Yn(T).utcOffset():0,(this.utcOffset()-T)%60===0):!1}function Je(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Lt(){if(!p(this._isDSTShifted))return this._isDSTShifted;var T={},R;return ne(T,this),T=Fs(T),T._a?(R=T._isUTC?C(T._a):Yn(T._a),this._isDSTShifted=this.isValid()&&gc(T._a,R.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Pt(){return this.isValid()?!this._isUTC:!1}function Lr(){return this.isValid()?this._isUTC:!1}function Ir(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Ei=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,uo=/^(-|\+)?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,qe,Nt;return ta(T)?V={ms:T._milliseconds,d:T._days,M:T._months}:m(T)||!isNaN(+T)?(V={},R?V[R]=+T:V.milliseconds=+T):(X=Ei.exec(T))?(oe=X[1]==="-"?-1:1,V={y:0,d:kn(X[aa])*oe,h:kn(X[mo])*oe,m:kn(X[ka])*oe,s:kn(X[ua])*oe,ms:kn(Ic(X[wo]*1e3))*oe}):(X=uo.exec(T))?(oe=X[1]==="-"?-1:1,V={y:nl(X[2],oe),M:nl(X[3],oe),w:nl(X[4],oe),d:nl(X[5],oe),h:nl(X[6],oe),m:nl(X[7],oe),s:nl(X[8],oe)}):V==null?V={}:typeof V=="object"&&("from"in V||"to"in V)&&(Nt=Gu(Yn(V.from),Yn(V.to)),V={},V.ms=Nt.milliseconds,V.M=Nt.months),qe=new tl(V),ta(T)&&n(T,"_locale")&&(qe._locale=T._locale),ta(T)&&n(T,"_isValid")&&(qe._isValid=T._isValid),qe}ai.fn=tl.prototype,ai.invalid=Ah;function nl(T,R){var V=T&&parseFloat(T.replace(",","."));return(isNaN(V)?0:V)*R}function il(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 Gu(T,R){var V;return T.isValid()&&R.isValid()?(R=Ss(R,T),T.isBefore(R)?V=il(T,R):(V=il(R,T),V.milliseconds=-V.milliseconds,V.months=-V.months),V):{milliseconds:0,months:0}}function Cl(T,R){return function(V,X){var oe,qe;return X!==null&&!isNaN(+X)&&($t(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."),qe=V,V=X,X=qe),oe=ai(V,X),Ou(this,oe,T),this}}function Ou(T,R,V,X){var oe=R._milliseconds,qe=Ic(R._days),Nt=Ic(R._months);T.isValid()&&(X=X==null?!0:X,Nt&&rr(T,cc(T,"Month")+Nt*V),qe&&dp(T,"Date",cc(T,"Date")+qe*V),oe&&T._d.setTime(T._d.valueOf()+oe*V),X&&t.updateOffset(T,qe||Nt))}var mi=Cl(1,"add"),Xp=Cl(-1,"subtract");function Yf(T){return typeof T=="string"||T instanceof String}function ds(T){return Re(T)||g(T)||Yf(T)||m(T)||mm(T)||Lg(T)||T===null||T===void 0}function Lg(T){var R=a(T)&&!l(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,qe,Nt=X.length;for(oe=0;oe<Nt;oe+=1)qe=X[oe],V=V||n(T,qe);return R&&V}function mm(T){var R=s(T),V=!1;return R&&(V=T.filter(function(X){return!m(X)&&Yf(T)}).length===0),R&&V}function d0(T){var R=a(T)&&!l(T),V=!1,X=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],oe,qe;for(oe=0;oe<X.length;oe+=1)qe=X[oe],V=V||n(T,qe);return R&&V}function A1(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 gm(T,R){arguments.length===1&&(arguments[0]?ds(arguments[0])?(T=arguments[0],R=void 0):d0(arguments[0])&&(R=arguments[0],T=void 0):(T=void 0,R=void 0));var V=T||Yn(),X=Ss(V,this).startOf("day"),oe=t.calendarFormat(this,X)||"sameElse",qe=R&&(bt(R[oe])?R[oe].call(this,V):R[oe]);return this.format(qe||this.localeData().calendar(oe,this,Yn(V)))}function h0(){return new ge(this)}function m0(T,R){var V=Re(T)?T:Yn(T);return this.isValid()&&V.isValid()?(R=we(R)||"millisecond",R==="millisecond"?this.valueOf()>V.valueOf():V.valueOf()<this.clone().startOf(R).valueOf()):!1}function Ra(T,R){var V=Re(T)?T:Yn(T);return this.isValid()&&V.isValid()?(R=we(R)||"millisecond",R==="millisecond"?this.valueOf()<V.valueOf():this.clone().endOf(R).valueOf()<V.valueOf()):!1}function sl(T,R,V,X){var oe=Re(T)?T:Yn(T),qe=Re(R)?R:Yn(R);return this.isValid()&&oe.isValid()&&qe.isValid()?(X=X||"()",(X[0]==="("?this.isAfter(oe,V):!this.isBefore(oe,V))&&(X[1]===")"?this.isBefore(qe,V):!this.isAfter(qe,V))):!1}function lu(T,R){var V=Re(T)?T:Yn(T),X;return this.isValid()&&V.isValid()?(R=we(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 Nu(T,R){return this.isSame(T,R)||this.isAfter(T,R)}function pu(T,R){return this.isSame(T,R)||this.isBefore(T,R)}function Zp(T,R,V){var X,oe,qe;if(!this.isValid())return NaN;if(X=Ss(T,this),!X.isValid())return NaN;switch(oe=(X.utcOffset()-this.utcOffset())*6e4,R=we(R),R){case"year":qe=Ru(this,X)/12;break;case"month":qe=Ru(this,X);break;case"quarter":qe=Ru(this,X)/3;break;case"second":qe=(this-X)/1e3;break;case"minute":qe=(this-X)/6e4;break;case"hour":qe=(this-X)/36e5;break;case"day":qe=(this-X-oe)/864e5;break;case"week":qe=(this-X-oe)/6048e5;break;default:qe=this-X}return V?qe:os(qe)}function Ru(T,R){if(T.date()<R.date())return-Ru(R,T);var V=(R.year()-T.year())*12+(R.month()-T.month()),X=T.clone().add(V,"months"),oe,qe;return R-X<0?(oe=T.clone().add(V-1,"months"),qe=(R-X)/(X-oe)):(oe=T.clone().add(V+1,"months"),qe=(R-X)/(oe-X)),-(V+qe)||0}t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function Al(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function Dl(T){if(!this.isValid())return null;var R=T!==!0,V=R?this.clone().utc():this;return V.year()<0||V.year()>9999?lt(V,R?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):bt(Date.prototype.toISOString)?R?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",lt(V,"Z")):lt(V,R?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Oc(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var T="moment",R="",V,X,oe,qe;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",qe=R+'[")]',this.format(V+X+oe+qe)}function Qp(T){T||(T=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var R=lt(this,T);return this.localeData().postformat(R)}function Mg(T,R){return this.isValid()&&(Re(T)&&T.isValid()||Yn(T).isValid())?ai({to:this,from:T}).locale(this.locale()).humanize(!R):this.localeData().invalidDate()}function ym(T){return this.from(Yn(),T)}function Rd(T,R){return this.isValid()&&(Re(T)&&T.isValid()||Yn(T).isValid())?ai({from:this,to:T}).locale(this.locale()).humanize(!R):this.localeData().invalidDate()}function ol(T){return this.to(Yn(),T)}function Fd(T){var R;return T===void 0?this._locale._abbr:(R=it(T),R!=null&&(this._locale=R),this)}var Ku=Qe("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 vm(){return this._locale}var kl=1e3,Il=60*kl,ef=60*Il,la=(365*400+97)*24*ef;function Jn(T,R){return(T%R+R)%R}function Fa(T,R,V){return T<100&&T>=0?new Date(T+400,R,V)-la:new Date(T,R,V).valueOf()}function Nc(T,R,V){return T<100&&T>=0?Date.UTC(T+400,R,V)-la:Date.UTC(T,R,V)}function Rc(T){var R,V;if(T=we(T),T===void 0||T==="millisecond"||!this.isValid())return this;switch(V=this._isUTC?Nc:Fa,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-=Jn(R+(this._isUTC?0:this.utcOffset()*Il),ef);break;case"minute":R=this._d.valueOf(),R-=Jn(R,Il);break;case"second":R=this._d.valueOf(),R-=Jn(R,kl);break}return this._d.setTime(R),t.updateOffset(this,!0),this}function vp(T){var R,V;if(T=we(T),T===void 0||T==="millisecond"||!this.isValid())return this;switch(V=this._isUTC?Nc:Fa,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+=ef-Jn(R+(this._isUTC?0:this.utcOffset()*Il),ef)-1;break;case"minute":R=this._d.valueOf(),R+=Il-Jn(R,Il)-1;break;case"second":R=this._d.valueOf(),R+=kl-Jn(R,kl)-1;break}return this._d.setTime(R),t.updateOffset(this,!0),this}function Fu(){return this._d.valueOf()-(this._offset||0)*6e4}function al(){return Math.floor(this.valueOf()/1e3)}function ul(){return new Date(this.valueOf())}function Ld(){var T=this;return[T.year(),T.month(),T.date(),T.hour(),T.minute(),T.second(),T.millisecond()]}function Jf(){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 Ol(){return this.isValid()?this.toISOString():null}function tf(){return B(this)}function Dh(){return w({},x(this))}function Bg(){return x(this).overflow}function g0(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}st("N",0,0,"eraAbbr"),st("NN",0,0,"eraAbbr"),st("NNN",0,0,"eraAbbr"),st("NNNN",0,0,"eraName"),st("NNNNN",0,0,"eraNarrow"),st("y",["y",1],"yo","eraYear"),st("y",["yy",2],0,"eraYear"),st("y",["yyy",3],0,"eraYear"),st("y",["yyyy",4],0,"eraYear"),Qt("N",Ai),Qt("NN",Ai),Qt("NNN",Ai),Qt("NNNN",y0),Qt("NNNNN",v0),li(["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}),Qt("y",Tu),Qt("yy",Tu),Qt("yyy",Tu),Qt("yyyy",Tu),Qt("yo",_m),li(["y","yy","yyy","yyyy"],Pr),li(["yo"],function(T,R,V,X){var oe;V._locale._eraYearOrdinalRegex&&(oe=T.match(V._locale._eraYearOrdinalRegex)),V._locale.eraYearOrdinalParse?R[Pr]=V._locale.eraYearOrdinalParse(T,oe):R[Pr]=parseInt(T,10)});function jg(T,R){var V,X,oe,qe=this._eras||it("en")._eras;for(V=0,X=qe.length;V<X;++V){switch(typeof qe[V].since){case"string":oe=t(qe[V].since).startOf("day"),qe[V].since=oe.valueOf();break}switch(typeof qe[V].until){case"undefined":qe[V].until=1/0;break;case"string":oe=t(qe[V].until).startOf("day").valueOf(),qe[V].until=oe.valueOf();break}}return qe}function qg(T,R,V){var X,oe,qe=this.eras(),Nt,Or,Ln;for(T=T.toUpperCase(),X=0,oe=qe.length;X<oe;++X)if(Nt=qe[X].name.toUpperCase(),Or=qe[X].abbr.toUpperCase(),Ln=qe[X].narrow.toUpperCase(),V)switch(R){case"N":case"NN":case"NNN":if(Or===T)return qe[X];break;case"NNNN":if(Nt===T)return qe[X];break;case"NNNNN":if(Ln===T)return qe[X];break}else if([Nt,Or,Ln].indexOf(T)>=0)return qe[X]}function xm(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 Nl(){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 Md(){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 Ug(){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 ae(){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 pa(T){return n(this,"_erasNameRegex")||Fc.call(this),T?this._erasNameRegex:this._erasRegex}function Xf(T){return n(this,"_erasAbbrRegex")||Fc.call(this),T?this._erasAbbrRegex:this._erasRegex}function Ga(T){return n(this,"_erasNarrowRegex")||Fc.call(this),T?this._erasNarrowRegex:this._erasRegex}function Ai(T,R){return R.erasAbbrRegex(T)}function y0(T,R){return R.erasNameRegex(T)}function v0(T,R){return R.erasNarrowRegex(T)}function _m(T,R){return R._eraYearOrdinalRegex||Tu}function Fc(){var T=[],R=[],V=[],X=[],oe,qe,Nt,Or,Ln,Li=this.eras();for(oe=0,qe=Li.length;oe<qe;++oe)Nt=cs(Li[oe].name),Or=cs(Li[oe].abbr),Ln=cs(Li[oe].narrow),R.push(Nt),T.push(Or),V.push(Ln),X.push(Nt),X.push(Or),X.push(Ln);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")}st(0,["gg",2],0,function(){return this.weekYear()%100}),st(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Bd(T,R){st(0,[T,T.length],0,R)}Bd("gggg","weekYear"),Bd("ggggg","weekYear"),Bd("GGGG","isoWeekYear"),Bd("GGGGG","isoWeekYear"),Qt("G",ft),Qt("g",ft),Qt("GG",Un,yn),Qt("gg",Un,yn),Qt("GGGG",xa,Zn),Qt("gggg",xa,Zn),Qt("GGGGG",uc,Ci),Qt("ggggg",uc,Ci),zs(["gggg","ggggg","GGGG","GGGGG"],function(T,R,V,X){R[X.substr(0,2)]=kn(T)}),zs(["gg","GG"],function(T,R,V,X){R[X]=t.parseTwoDigitYear(T)});function jd(T){return Lc.call(this,T,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function $g(T){return Lc.call(this,T,this.isoWeek(),this.isoWeekday(),1,4)}function x0(){return ls(this.year(),1,4)}function _0(){return ls(this.isoWeekYear(),1,4)}function fu(){var T=this.localeData()._week;return ls(this.year(),T.dow,T.doy)}function Zf(){var T=this.localeData()._week;return ls(this.weekYear(),T.dow,T.doy)}function Lc(T,R,V,X,oe){var qe;return T==null?wr(this,X,oe).year:(qe=ls(T,X,oe),R>qe&&(R=qe),Qf.call(this,T,R,V,X,oe))}function Qf(T,R,V,X,oe){var qe=bh(T,R,V,X,oe),Nt=qf(qe.year,0,qe.dayOfYear);return this.year(Nt.getUTCFullYear()),this.month(Nt.getUTCMonth()),this.date(Nt.getUTCDate()),this}st("Q",0,"Qo","quarter"),Qt("Q",an),li("Q",function(T,R){R[Da]=(kn(T)-1)*3});function Sm(T){return T==null?Math.ceil((this.month()+1)/3):this.month((T-1)*3+this.month()%3)}st("D",["DD",2],"Do","date"),Qt("D",Un,$r),Qt("DD",Un,yn),Qt("Do",function(T,R){return T?R._dayOfMonthOrdinalParse||R._ordinalParse:R._dayOfMonthOrdinalParseLenient}),li(["D","DD"],aa),li("Do",function(T,R){R[aa]=kn(T.match(Un)[0])});var rf=Pn("Date",!0);st("DDD",["DDDD",3],"DDDo","dayOfYear"),Qt("DDD",Os),Qt("DDDD",oi),li(["DDD","DDDD"],function(T,R,V){V._dayOfYear=kn(T)});function La(T){var R=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return T==null?R:this.add(T-R,"d")}st("m",["mm",2],0,"minute"),Qt("m",Un,ci),Qt("mm",Un,yn),li(["m","mm"],ka);var bm=Pn("Minutes",!1);st("s",["ss",2],0,"second"),Qt("s",Un,ci),Qt("ss",Un,yn),li(["s","ss"],ua);var kh=Pn("Seconds",!1);st("S",0,0,function(){return~~(this.millisecond()/100)}),st(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),st(0,["SSS",3],0,"millisecond"),st(0,["SSSS",4],0,function(){return this.millisecond()*10}),st(0,["SSSSS",5],0,function(){return this.millisecond()*100}),st(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),st(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),st(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),st(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),Qt("S",Os,an),Qt("SS",Os,yn),Qt("SSS",Os,oi);var cl,Em;for(cl="SSSS";cl.length<=9;cl+="S")Qt(cl,Tu);function Vg(T,R){R[wo]=kn(("0."+T)*1e3)}for(cl="S";cl.length<=9;cl+="S")li(cl,Vg);Em=Pn("Milliseconds",!1),st("z",0,0,"zoneAbbr"),st("zz",0,0,"zoneName");function Rl(){return this._isUTC?"UTC":""}function S0(){return this._isUTC?"Coordinated Universal Time":""}var hr=ge.prototype;hr.add=mi,hr.calendar=gm,hr.clone=h0,hr.diff=Zp,hr.endOf=vp,hr.format=Qp,hr.from=Mg,hr.fromNow=ym,hr.to=Rd,hr.toNow=ol,hr.get=Pu,hr.invalidAt=Bg,hr.isAfter=m0,hr.isBefore=Ra,hr.isBetween=sl,hr.isSame=lu,hr.isSameOrAfter=Nu,hr.isSameOrBefore=pu,hr.isValid=tf,hr.lang=Ku,hr.locale=Fd,hr.localeData=vm,hr.max=Wa,hr.min=Th,hr.parsingFlags=Dh,hr.set=Xs,hr.startOf=Rc,hr.subtract=Xp,hr.toArray=Ld,hr.toObject=Jf,hr.toDate=ul,hr.toISOString=Dl,hr.inspect=Oc,typeof Symbol<"u"&&Symbol.for!=null&&(hr[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),hr.toJSON=Ol,hr.toString=Al,hr.unix=al,hr.valueOf=Fu,hr.creationData=g0,hr.eraName=Nl,hr.eraNarrow=Md,hr.eraAbbr=Ug,hr.eraYear=ae,hr.year=Jc,hr.isLeapYear=Vp,hr.weekYear=jd,hr.isoWeekYear=$g,hr.quarter=hr.quarters=Sm,hr.month=Ac,hr.daysInMonth=c0,hr.week=hr.weeks=fm,hr.isoWeek=hr.isoWeeks=Eh,hr.weeksInYear=fu,hr.weeksInWeekYear=Zf,hr.isoWeeksInYear=x0,hr.isoWeeksInISOWeekYear=_0,hr.date=rf,hr.day=hr.days=To,hr.weekday=Qn,hr.isoWeekday=Zc,hr.dayOfYear=La,hr.hour=hr.hours=ps,hr.minute=hr.minutes=bm,hr.second=hr.seconds=kh,hr.millisecond=hr.milliseconds=Em,hr.utcOffset=Nd,hr.utc=dm,hr.local=hm,hr.parseZone=cu,hr.hasAlignedHourOffset=Go,hr.isDST=Je,hr.isLocal=Pt,hr.isUtcOffset=Lr,hr.isUtc=Ir,hr.isUTC=Ir,hr.zoneAbbr=Rl,hr.zoneName=S0,hr.dates=Qe("dates accessor is deprecated. Use date instead.",rf),hr.months=Qe("months accessor is deprecated. Use month instead",Ac),hr.years=Qe("years accessor is deprecated. Use year instead",Jc),hr.zone=Qe("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",as),hr.isDSTShifted=Qe("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Lt);function cn(T){return Yn(T*1e3)}function du(){return Yn.apply(null,arguments).parseZone()}function fa(T){return T}var ri=fe.prototype;ri.calendar=De,ri.longDateFormat=jt,ri.invalidDate=At,ri.ordinal=fr,ri.preparse=fa,ri.postformat=fa,ri.relativeTime=Rt,ri.pastFuture=Bt,ri.set=_t,ri.eras=jg,ri.erasParse=qg,ri.erasConvertYear=xm,ri.erasAbbrRegex=Xf,ri.erasNameRegex=pa,ri.erasNarrowRegex=Ga,ri.months=pm,ri.monthsShort=zp,ri.monthsParse=au,ri.monthsRegex=Rs,ri.monthsShortRegex=Sl,ri.week=Uf,ri.firstDayOfYear=$f,ri.firstDayOfWeek=pc,ri.weekdays=mp,ri.weekdaysMin=fc,ri.weekdaysShort=Dc,ri.weekdaysParse=wl,ri.weekdaysRegex=Ws,ri.weekdaysShortRegex=ei,ri.weekdaysMinRegex=Wp,ri.isPM=wh,ri.meridiem=gp;function Yu(T,R,V,X){var oe=it(),qe=C().set(X,R);return oe[V](qe,T)}function Ih(T,R,V){if(m(T)&&(R=T,T=void 0),T=T||"",R!=null)return Yu(T,R,V,"month");var X,oe=[];for(X=0;X<12;X++)oe[X]=Yu(T,X,V,"month");return oe}function Mo(T,R,V,X){typeof T=="boolean"?(m(R)&&(V=R,R=void 0),R=R||""):(R=T,V=R,T=!1,m(R)&&(V=R,R=void 0),R=R||"");var oe=it(),qe=T?oe._week.dow:0,Nt,Or=[];if(V!=null)return Yu(R,(V+qe)%7,X,"day");for(Nt=0;Nt<7;Nt++)Or[Nt]=Yu(R,(Nt+qe)%7,X,"day");return Or}function qd(T,R){return Ih(T,R,"months")}function pi(T,R){return Ih(T,R,"monthsShort")}function Ud(T,R,V){return Mo(T,R,V,"weekdays")}function xp(T,R,V){return Mo(T,R,V,"weekdaysShort")}function ed(T,R,V){return Mo(T,R,V,"weekdaysMin")}de("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=kn(T%100/10)===1?"th":R===1?"st":R===2?"nd":R===3?"rd":"th";return T+V}}),t.lang=Qe("moment.lang is deprecated. Use moment.locale instead.",de),t.langData=Qe("moment.langData is deprecated. Use moment.localeData instead.",it);var yc=Math.abs;function wm(){var T=this._data;return this._milliseconds=yc(this._milliseconds),this._days=yc(this._days),this._months=yc(this._months),T.milliseconds=yc(T.milliseconds),T.seconds=yc(T.seconds),T.minutes=yc(T.minutes),T.hours=yc(T.hours),T.months=yc(T.months),T.years=yc(T.years),this}function Oh(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 nf(T,R){return Oh(this,T,R,1)}function Mr(T,R){return Oh(this,T,R,-1)}function _p(T){return T<0?Math.floor(T):Math.ceil(T)}function Sp(){var T=this._milliseconds,R=this._days,V=this._months,X=this._data,oe,qe,Nt,Or,Ln;return T>=0&&R>=0&&V>=0||T<=0&&R<=0&&V<=0||(T+=_p(Fl(V)+R)*864e5,R=0,V=0),X.milliseconds=T%1e3,oe=os(T/1e3),X.seconds=oe%60,qe=os(oe/60),X.minutes=qe%60,Nt=os(qe/60),X.hours=Nt%24,R+=os(Nt/24),Ln=os(Bo(R)),V+=Ln,R-=_p(Fl(Ln)),Or=os(V/12),V%=12,X.days=R,X.months=V,X.years=Or,this}function Bo(T){return T*4800/146097}function Fl(T){return T*146097/4800}function $d(T){if(!this.isValid())return NaN;var R,V,X=this._milliseconds;if(T=we(T),T==="month"||T==="quarter"||T==="year")switch(R=this._days+X/864e5,V=this._months+Bo(R),T){case"month":return V;case"quarter":return V/3;case"year":return V/12}else switch(R=this._days+Math.round(Fl(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 Ju(T){return function(){return this.as(T)}}var Ll=Ju("ms"),Ml=Ju("s"),Bl=Ju("m"),Nh=Ju("h"),jl=Ju("d"),Vd=Ju("w"),Mc=Ju("M"),co=Ju("Q"),td=Ju("y"),sf=Ll;function Po(){return ai(this)}function hs(T){return T=we(T),this.isValid()?this[T+"s"]():NaN}function Zi(T){return function(){return this.isValid()?this._data[T]:NaN}}var ql=Zi("milliseconds"),Xu=Zi("seconds"),hu=Zi("minutes"),of=Zi("hours"),Tm=Zi("days"),Jy=Zi("months"),Pm=Zi("years");function Hd(){return os(this.days()/7)}var Bc=Math.round,jc={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function rd(T,R,V,X,oe){return oe.relativeTime(R||1,!!V,T,X)}function Hg(T,R,V,X){var oe=ai(T).abs(),qe=Bc(oe.as("s")),Nt=Bc(oe.as("m")),Or=Bc(oe.as("h")),Ln=Bc(oe.as("d")),Li=Bc(oe.as("M")),mu=Bc(oe.as("w")),Zu=Bc(oe.as("y")),Co=qe<=V.ss&&["s",qe]||qe<V.s&&["ss",qe]||Nt<=1&&["m"]||Nt<V.m&&["mm",Nt]||Or<=1&&["h"]||Or<V.h&&["hh",Or]||Ln<=1&&["d"]||Ln<V.d&&["dd",Ln];return V.w!=null&&(Co=Co||mu<=1&&["w"]||mu<V.w&&["ww",mu]),Co=Co||Li<=1&&["M"]||Li<V.M&&["MM",Li]||Zu<=1&&["y"]||["yy",Zu],Co[2]=R,Co[3]=+T>0,Co[4]=X,rd.apply(null,Co)}function zg(T){return T===void 0?Bc:typeof T=="function"?(Bc=T,!0):!1}function bp(T,R){return jc[T]===void 0?!1:R===void 0?jc[T]:(jc[T]=R,T==="s"&&(jc.ss=R-1),!0)}function Xy(T,R){if(!this.isValid())return this.localeData().invalidDate();var V=!1,X=jc,oe,qe;return typeof T=="object"&&(R=T,T=!1),typeof T=="boolean"&&(V=T),typeof R=="object"&&(X=Object.assign({},jc,R),R.s!=null&&R.ss==null&&(X.ss=R.s-1)),oe=this.localeData(),qe=Hg(this,!V,X,oe),V&&(qe=oe.pastFuture(+this,qe)),oe.postformat(qe)}var b0=Math.abs;function Ul(T){return(T>0)-(T<0)||+T}function Ka(){if(!this.isValid())return this.localeData().invalidDate();var T=b0(this._milliseconds)/1e3,R=b0(this._days),V=b0(this._months),X,oe,qe,Nt,Or=this.asSeconds(),Ln,Li,mu,Zu;return Or?(X=os(T/60),oe=os(X/60),T%=60,X%=60,qe=os(V/12),V%=12,Nt=T?T.toFixed(3).replace(/\.?0+$/,""):"",Ln=Or<0?"-":"",Li=Ul(this._months)!==Ul(Or)?"-":"",mu=Ul(this._days)!==Ul(Or)?"-":"",Zu=Ul(this._milliseconds)!==Ul(Or)?"-":"",Ln+"P"+(qe?Li+qe+"Y":"")+(V?Li+V+"M":"")+(R?mu+R+"D":"")+(oe||X||T?"T":"")+(oe?Zu+oe+"H":"")+(X?Zu+X+"M":"")+(T?Zu+Nt+"S":"")):"P0D"}var _i=tl.prototype;_i.isValid=Ch,_i.abs=wm,_i.add=nf,_i.subtract=Mr,_i.as=$d,_i.asMilliseconds=Ll,_i.asSeconds=Ml,_i.asMinutes=Bl,_i.asHours=Nh,_i.asDays=jl,_i.asWeeks=Vd,_i.asMonths=Mc,_i.asQuarters=co,_i.asYears=td,_i.valueOf=sf,_i._bubble=Sp,_i.clone=Po,_i.get=hs,_i.milliseconds=ql,_i.seconds=Xu,_i.minutes=hu,_i.hours=of,_i.days=Tm,_i.weeks=Hd,_i.months=Jy,_i.years=Pm,_i.humanize=Xy,_i.toISOString=Ka,_i.toString=Ka,_i.toJSON=Ka,_i.locale=Fd,_i.localeData=vm,_i.toIsoString=Qe("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Ka),_i.lang=Ku,st("X",0,0,"unix"),st("x",0,0,"valueOf"),Qt("x",ft),Qt("X",gr),li("X",function(T,R,V){V._d=new Date(parseFloat(T)*1e3)}),li("x",function(T,R,V){V._d=new Date(kn(T))});return t.version="2.30.1",r(Yn),t.fn=hr,t.min=mc,t.max=Ph,t.now=Od,t.utc=C,t.unix=cn,t.months=qd,t.isDate=g,t.locale=de,t.invalid=q,t.duration=ai,t.isMoment=Re,t.weekdays=Ud,t.parseZone=du,t.localeData=it,t.isDuration=ta,t.monthsShort=pi,t.weekdaysMin=ed,t.defineLocale=je,t.updateLocale=mt,t.locales=It,t.weekdaysShort=xp,t.normalizeUnits=we,t.relativeTimeRounding=zg,t.relativeTimeThreshold=bp,t.calendarFormat=A1,t.prototype=hr,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 ag(){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 jI({prefix:e="cli"}){return ia.default.createElement(Qo.Text,{color:"grey"},"[",e,"]")}function ns(e,t="cli"){if(ag()){console.log(`\x1B[90m[${t}]\x1B[0m\x1B[31m[\u2718] \x1B[0m${e}`);return}let{unmount:r}=(0,Qo.render)(ia.default.createElement(Qo.Text,null,ia.default.createElement(jI,{prefix:t}),ia.default.createElement(Qo.Text,{color:"red"},"[\u2718] "),e));r()}function iE(e,t="cli"){if(ag()){console.log(`\x1B[90m[${t}]\x1B[0m\x1B[32m[\u2714] \x1B[0m${e}`);return}let{unmount:r}=(0,Qo.render)(ia.default.createElement(Qo.Text,null,ia.default.createElement(jI,{prefix:t}),ia.default.createElement(Qo.Text,{color:"green"},"[\u2714] "),e));r()}function is(e,t="cli"){if(ag()){console.log(`\x1B[90m[${t}]\x1B[0m \x1B[33mWARNING:\x1B[0m ${e}`);return}let{unmount:r}=(0,Qo.render)(ia.default.createElement(Qo.Text,null,ia.default.createElement(jI,{prefix:t}),ia.default.createElement(Qo.Text,{color:"orange"},"\u2757\uFE0F "),e));r()}function qte(e){if(ag()){console.log(e);return}let{unmount:t}=(0,Qo.render)(ia.default.createElement(Qo.Text,{color:"cyan"},e));t()}function Wt(e,t="cli"){if(ag()){console.log(`\x1B[90m[${t}]\x1B[0m ${e}`);return}let{unmount:r}=(0,Qo.render)(ia.default.createElement(Qo.Text,null,ia.default.createElement(jI,{prefix:t})," ",e));r()}function bB({timestamp:e}){return ia.default.createElement(Qo.Box,{width:13},ia.default.createElement(Qo.Text,{color:"grey"},(0,pC.default)(e).format("HH:mm:ss.SSS")))}function Ute(e,t){if(ag()){console.log(`${(0,pC.default)(t).format("HH:mm:ss.SSS")} ${e}`);return}let{unmount:r}=(0,Qo.render)(ia.default.createElement(Qo.Box,null,ia.default.createElement(bB,{timestamp:t}),ia.default.createElement(Qo.Text,null,e)));r()}function $te(e,t){if(ag()){console.log(`${(0,pC.default)(t).format("HH:mm:ss.SSS")} [WARNING] ${e}`);return}let{unmount:r}=(0,Qo.render)(ia.default.createElement(Qo.Box,null,ia.default.createElement(bB,{timestamp:t}),ia.default.createElement(Qo.Text,{color:"white",backgroundColor:"yellow"},"[WARNING]"),ia.default.createElement(Qo.Text,null," ",e)));r()}function EB(e,t){if(ag()){console.log(`${(0,pC.default)(t).format("HH:mm:ss.SSS")} [ERROR] ${e}`);return}let{unmount:r}=(0,Qo.render)(ia.default.createElement(Qo.Box,null,ia.default.createElement(bB,{timestamp:t}),ia.default.createElement(Qo.Text,{color:"white",backgroundColor:"red"},"[ERROR]"),ia.default.createElement(Qo.Text,null," ",e)));r()}var Qo,ia,pC,iu=gt(()=>{Qo=zt(lC()),ia=zt(Ta()),pC=zt(jte())});var Hte,Vte=gt(()=>{Hte={name:"edgeone",version:"1.6.28-beta.11",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.1","@edgeone/opennextjs-pages":"0.2.10","@edgeone/pages-agent-toolkit":"0.1.0-beta.6","@edgeone/pages-blob":"^0.0.16",chokidar:"^4.0.1",esbuild:"^0.19.2","esbuild-plugin-polyfill-node":"^0.3.0","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.1","@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/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",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 B5e(){var e,t;return{run_id:M5e,cli_version:(t=(e=Hte)==null?void 0:e.version)!=null?t:"unknown",node_version:process.version,os_platform:TB.default.platform(),os_arch:TB.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 j5e(e,t){try{if(typeof process.send!="function")return;process.send(JSON.stringify({name:e,value:JSON.stringify(t)}))}catch{}}function Tc(e){var r;let t={...B5e(),...e};j5e((r=t.event_name)!=null?r:"unknown",t)}function ih(e){if(e==null)return{message:"unknown error",stack:""};if(typeof e=="string")return{message:qI(e,wB),stack:""};if(typeof e=="object"){let t=e,r=qI(typeof t.message=="string"?t.message:String(t),wB),s=qI(typeof t.stack=="string"?t.stack:"",q5e);return{message:r,stack:s}}return{message:qI(String(e),wB),stack:""}}function qI(e,t){return e.length>t?e.slice(0,t)+"\u2026[truncated]":e}var TB,Ec,wc,M5e,zte,wB,q5e,ug=gt(()=>{TB=zt(require("os"));Vte();Ec={COMMAND:"command",REQUEST:"request",LOCAL_FLOW:"local_flow",EXIT:"exit"},wc={SUCCESS:"success",FAIL:"fail",START:"start"},M5e=`cli-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;zte=(e,t)=>{let r=ih(t);Tc({event_name:"error",event_scope:Ec.COMMAND,event_result:wc.FAIL,error_message:`${e} ${r.message}`.trim(),error_stack:r.stack})},wB=500,q5e=2e3});var fC,sE,PB=gt(()=>{fC={NEXTJS:"nextjs",NUXTJS:"nuxtjs",ASTRO:"astro",UNKNOWN:"unknown"},sE={FRAMEWORK_DETECT:"framework_detect",PLUGIN_RESOLVE:"plugin_resolve",PLUGIN_LOAD:"plugin_load",PLUGIN_HOOK:"plugin_hook",CONFIG_LOAD:"config_load"}});function V5e(e){if((e==null?void 0:e.code)===$5e)return!0;let t=typeof e=="string"?e:e==null?void 0:e.message;return t==null?void 0:t.includes(U5e)}async function vx(e=!1){try{let t=await Yk(e);return Tc({event_name:"Config:Load:Success",event_scope:Ec.LOCAL_FLOW,event_phase:sE.CONFIG_LOAD,event_result:wc.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=ih(t);if(Tc({event_name:"Config:Load:Fail",event_scope:Ec.LOCAL_FLOW,event_phase:sE.CONFIG_LOAD,event_result:wc.FAIL,error_message:r.message}),V5e(t))throw t;return(0,Pf.showError)()&&console.error("%c [ error ]-80","font-size:13px; background:pink; color:#bf2c9f;",t),null}}var U5e,$5e,CB=gt(()=>{jb();Bk();ug();PB();U5e="[BLOCKING_CONFIG_ERROR]",$5e="BLOCKING_CONFIG_ERROR"});var UI,Mp,$I=gt(()=>{UI=[{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"}],Mp=["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"]});async function H5e(e){let t;VI.default.statSync(e).isFile()?t=oE.default.resolve(oE.default.dirname(e)):t=e;let r=oE.default.parse(t).root;if(t===r)return null;for(;t!==r;){let s=oE.default.join(t,"package.json");try{return await VI.default.promises.access(s),s}catch{if(t=oE.default.dirname(t),t===r)break}}return null}async function aE(e){if(e.endsWith(".mjs"))return"esm";if(e.endsWith(".cjs"))return"commonjs";try{let t=await H5e(e);if(t&&JSON.parse(await VI.default.promises.readFile(t,"utf-8")).type==="module")return"esm"}catch(t){console.warn("Failed to read package.json:",t)}return"commonjs"}var VI,oE,dC=gt(()=>{VI=zt(require("fs")),oE=zt(require("path"))});function W5e(e){let t=AB.default.extname(e);return z5e[t]||"ts"}function Y5e(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!K5e.has(a)||s===a?"":`const ${a} = ${s};`}).filter(Boolean).join(`
|
|
167
|
+
`+new Error().stack),V=!1}return R.apply(this,arguments)},R)}var ze={};function $t(T,R){t.deprecationHandler!=null&&t.deprecationHandler(T,R),ze[T]||(Ue(R),ze[T]=!0)}t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;function bt(T){return typeof Function<"u"&&T instanceof Function||Object.prototype.toString.call(T)==="[object Function]"}function _t(T){var R,V;for(V in T)n(T,V)&&(R=T[V],bt(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 Ge(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 fe(T){T!=null&&this.set(T)}var Le;Object.keys?Le=Object.keys:Le=function(T){var R,V=[];for(R in T)n(T,R)&&V.push(R);return V};var tt={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function De(T,R,V){var X=this._calendar[T]||this._calendar.sameElse;return bt(X)?X.call(R,V):X}function Oe(T,R,V){var X=""+Math.abs(T),oe=R-X.length,qe=T>=0;return(qe?V?"+":"":"-")+Math.pow(10,Math.max(0,oe)).toString().substr(1)+X}var $e=/(\[[^\[]*\])|(\\)?([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,ht=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Ot={},sr={};function st(T,R,V,X){var oe=X;typeof X=="string"&&(oe=function(){return this[X]()}),T&&(sr[T]=oe),R&&(sr[R[0]]=function(){return Oe(oe.apply(this,arguments),R[1],R[2])}),V&&(sr[V]=function(){return this.localeData().ordinal(oe.apply(this,arguments),T)})}function Vt(T){return T.match(/\[[\s\S]/)?T.replace(/^\[|\]$/g,""):T.replace(/\\/g,"")}function Be(T){var R=T.match($e),V,X;for(V=0,X=R.length;V<X;V++)sr[R[V]]?R[V]=sr[R[V]]:R[V]=Vt(R[V]);return function(oe){var qe="",Nt;for(Nt=0;Nt<X;Nt++)qe+=bt(R[Nt])?R[Nt].call(oe,T):R[Nt];return qe}}function lt(T,R){return T.isValid()?(R=xt(R,T.localeData()),Ot[R]=Ot[R]||Be(R),Ot[R](T)):T.localeData().invalidDate()}function xt(T,R){var V=5;function X(oe){return R.longDateFormat(oe)||oe}for(ht.lastIndex=0;V>=0&&ht.test(T);)T=T.replace(ht,X),ht.lastIndex=0,V-=1;return T}var or={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 jt(T){var R=this._longDateFormat[T],V=this._longDateFormat[T.toUpperCase()];return R||!V?R:(this._longDateFormat[T]=V.match($e).map(function(X){return X==="MMMM"||X==="MM"||X==="DD"||X==="dddd"?X.slice(1):X}).join(""),this._longDateFormat[T])}var Et="Invalid date";function At(){return this._invalidDate}var D="%d",Ht=/\d{1,2}/;function fr(T){return this._ordinal.replace("%d",T)}var en={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 Rt(T,R,V,X){var oe=this._relativeTime[V];return bt(oe)?oe(T,R,V,X):oe.replace(/%d/i,T)}function Bt(T,R){var V=this._relativeTime[T>0?"future":"past"];return bt(V)?V(R):V.replace(/%s/i,R)}var mr={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 we(T){return typeof T=="string"?mr[T]||mr[T.toLowerCase()]:void 0}function ot(T){var R={},V,X;for(X in T)n(T,X)&&(V=we(X),V&&(R[V]=T[X]));return R}var ir={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 Sr(T){var R=[],V;for(V in T)n(T,V)&&R.push({unit:V,priority:ir[V]});return R.sort(function(X,oe){return X.priority-oe.priority}),R}var an=/\d/,yn=/\d\d/,oi=/\d{3}/,Zn=/\d{4}/,Ci=/[+-]?\d{6}/,Un=/\d\d?/,va=/\d\d\d\d?/,Aa=/\d\d\d\d\d\d?/,Os=/\d{1,3}/,xa=/\d{1,4}/,uc=/[+-]?\d{1,6}/,Tu=/\d+/,ft=/[+-]?\d+/,Jt=/Z|[+-]\d\d:?\d\d/gi,Gt=/Z|[+-]\d\d(?::?\d\d)?/gi,gr=/[+-]?\d+(\.\d{1,3})?/,Qr=/[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,$r=/^[1-9]\d?/,ci=/^([1-9]\d|\d)/,ss;ss={};function Qt(T,R,V){ss[T]=bt(R)?R:function(X,oe){return X&&V?V:R}}function us(T,R){return n(ss,T)?ss[T](R._strict,R._locale):new RegExp(ao(T))}function ao(T){return cs(T.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(R,V,X,oe,qe){return V||X||oe||qe}))}function cs(T){return T.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function os(T){return T<0?Math.ceil(T)||0:Math.floor(T)}function kn(T){var R=+T,V=0;return R!==0&&isFinite(R)&&(V=os(R)),V}var Eo={};function li(T,R){var V,X=R,oe;for(typeof T=="string"&&(T=[T]),m(R)&&(X=function(qe,Nt){Nt[R]=kn(qe)}),oe=T.length,V=0;V<oe;V++)Eo[T[V]]=X}function zs(T,R){li(T,function(V,X,oe,qe){oe._w=oe._w||{},R(V,oe._w,oe,qe)})}function Yc(T,R,V){R!=null&&n(Eo,T)&&Eo[T](R,V._a,V,T)}function ea(T){return T%4===0&&T%100!==0||T%400===0}var Pr=0,Da=1,aa=2,mo=3,ka=4,ua=5,wo=6,fp=7,Cc=8;st("Y",0,0,function(){var T=this.year();return T<=9999?Oe(T,4):"+"+T}),st(0,["YY",2],0,function(){return this.year()%100}),st(0,["YYYY",4],0,"year"),st(0,["YYYYY",5],0,"year"),st(0,["YYYYYY",6,!0],0,"year"),Qt("Y",ft),Qt("YY",Un,yn),Qt("YYYY",xa,Zn),Qt("YYYYY",uc,Ci),Qt("YYYYYY",uc,Ci),li(["YYYYY","YYYYYY"],Pr),li("YYYY",function(T,R){R[Pr]=T.length===2?t.parseTwoDigitYear(T):kn(T)}),li("YY",function(T,R){R[Pr]=t.parseTwoDigitYear(T)}),li("Y",function(T,R){R[Pr]=parseInt(T,10)});function Hu(T){return ea(T)?366:365}t.parseTwoDigitYear=function(T){return kn(T)+(kn(T)>68?1900:2e3)};var Jc=Pn("FullYear",!0);function Vp(){return ea(this.year())}function Pn(T,R){return function(V){return V!=null?(dp(this,T,V),t.updateOffset(this,R),this):cc(this,T)}}function cc(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 dp(T,R,V){var X,oe,qe,Nt,Or;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}qe=V,Nt=T.month(),Or=T.date(),Or=Or===29&&Nt===1&&!ea(qe)?28:Or,oe?X.setUTCFullYear(qe,Nt,Or):X.setFullYear(qe,Nt,Or)}}function Pu(T){return T=we(T),bt(this[T])?this[T]():this}function Xs(T,R){if(typeof T=="object"){T=ot(T);var V=Sr(T),X,oe=V.length;for(X=0;X<oe;X++)this[V[X].unit](T[V[X].unit])}else if(T=we(T),bt(this[T]))return this[T](R);return this}function Ns(T,R){return(T%R+R)%R}var Cs;Array.prototype.indexOf?Cs=Array.prototype.indexOf:Cs=function(T){var R;for(R=0;R<this.length;++R)if(this[R]===T)return R;return-1};function Oo(T,R){if(isNaN(T)||isNaN(R))return NaN;var V=Ns(R,12);return T+=(R-V)/12,V===1?ea(T)?29:28:31-V%7%2}st("M",["MM",2],"Mo",function(){return this.month()+1}),st("MMM",0,0,function(T){return this.localeData().monthsShort(this,T)}),st("MMMM",0,0,function(T){return this.localeData().months(this,T)}),Qt("M",Un,$r),Qt("MM",Un,yn),Qt("MMM",function(T,R){return R.monthsShortRegex(T)}),Qt("MMMM",function(T,R){return R.monthsRegex(T)}),li(["M","MM"],function(T,R){R[Da]=kn(T)-1}),li(["MMM","MMMM"],function(T,R,V,X){var oe=V._locale.monthsParse(T,X,V._strict);oe!=null?R[Da]=oe:x(V).invalidMonth=T});var Sa="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Cu="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),ou=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ia=Qr,Hp=Qr;function pm(T,R){return T?s(this._months)?this._months[T.month()]:this._months[(this._months.isFormat||ou).test(R)?"format":"standalone"][T.month()]:s(this._months)?this._months:this._months.standalone}function zp(T,R){return T?s(this._monthsShort)?this._monthsShort[T.month()]:this._monthsShort[ou.test(R)?"format":"standalone"][T.month()]:s(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function hp(T,R,V){var X,oe,qe,Nt=T.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],X=0;X<12;++X)qe=C([2e3,X]),this._shortMonthsParse[X]=this.monthsShort(qe,"").toLocaleLowerCase(),this._longMonthsParse[X]=this.months(qe,"").toLocaleLowerCase();return V?R==="MMM"?(oe=Cs.call(this._shortMonthsParse,Nt),oe!==-1?oe:null):(oe=Cs.call(this._longMonthsParse,Nt),oe!==-1?oe:null):R==="MMM"?(oe=Cs.call(this._shortMonthsParse,Nt),oe!==-1?oe:(oe=Cs.call(this._longMonthsParse,Nt),oe!==-1?oe:null)):(oe=Cs.call(this._longMonthsParse,Nt),oe!==-1?oe:(oe=Cs.call(this._shortMonthsParse,Nt),oe!==-1?oe:null))}function au(T,R,V){var X,oe,qe;if(this._monthsParseExact)return hp.call(this,T,R,V);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),X=0;X<12;X++){if(oe=C([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]&&(qe="^"+this.months(oe,"")+"|^"+this.monthsShort(oe,""),this._monthsParse[X]=new RegExp(qe.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 rr(T,R){if(!T.isValid())return T;if(typeof R=="string"){if(/^\d+$/.test(R))R=kn(R);else if(R=T.localeData().monthsParse(R),!m(R))return T}var V=R,X=T.date();return X=X<29?X:Math.min(X,Oo(T.year(),V)),T._isUTC?T._d.setUTCMonth(V,X):T._d.setMonth(V,X),T}function Ac(T){return T!=null?(rr(this,T),t.updateOffset(this,!0),this):cc(this,"Month")}function c0(){return Oo(this.year(),this.month())}function Sl(T){return this._monthsParseExact?(n(this,"_monthsRegex")||bl.call(this),T?this._monthsShortStrictRegex:this._monthsShortRegex):(n(this,"_monthsShortRegex")||(this._monthsShortRegex=Ia),this._monthsShortStrictRegex&&T?this._monthsShortStrictRegex:this._monthsShortRegex)}function Rs(T){return this._monthsParseExact?(n(this,"_monthsRegex")||bl.call(this),T?this._monthsStrictRegex:this._monthsRegex):(n(this,"_monthsRegex")||(this._monthsRegex=Hp),this._monthsStrictRegex&&T?this._monthsStrictRegex:this._monthsRegex)}function bl(){function T(Ln,Li){return Li.length-Ln.length}var R=[],V=[],X=[],oe,qe,Nt,Or;for(oe=0;oe<12;oe++)qe=C([2e3,oe]),Nt=cs(this.monthsShort(qe,"")),Or=cs(this.months(qe,"")),R.push(Nt),V.push(Or),X.push(Or),X.push(Nt);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")}function Sh(T,R,V,X,oe,qe,Nt){var Or;return T<100&&T>=0?(Or=new Date(T+400,R,V,X,oe,qe,Nt),isFinite(Or.getFullYear())&&Or.setFullYear(T)):Or=new Date(T,R,V,X,oe,qe,Nt),Or}function qf(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 Xc(T,R,V){var X=7+R-V,oe=(7+qf(T,0,X).getUTCDay()-R)%7;return-oe+X-1}function bh(T,R,V,X,oe){var qe=(7+V-X)%7,Nt=Xc(T,X,oe),Or=1+7*(R-1)+qe+Nt,Ln,Li;return Or<=0?(Ln=T-1,Li=Hu(Ln)+Or):Or>Hu(T)?(Ln=T+1,Li=Or-Hu(T)):(Ln=T,Li=Or),{year:Ln,dayOfYear:Li}}function wr(T,R,V){var X=Xc(T.year(),R,V),oe=Math.floor((T.dayOfYear()-X-1)/7)+1,qe,Nt;return oe<1?(Nt=T.year()-1,qe=oe+ls(Nt,R,V)):oe>ls(T.year(),R,V)?(qe=oe-ls(T.year(),R,V),Nt=T.year()+1):(Nt=T.year(),qe=oe),{week:qe,year:Nt}}function ls(T,R,V){var X=Xc(T,R,V),oe=Xc(T+1,R,V);return(Hu(T)-X+oe)/7}st("w",["ww",2],"wo","week"),st("W",["WW",2],"Wo","isoWeek"),Qt("w",Un,$r),Qt("ww",Un,yn),Qt("W",Un,$r),Qt("WW",Un,yn),zs(["w","ww","W","WW"],function(T,R,V,X){R[X.substr(0,1)]=kn(T)});function Uf(T){return wr(T,this._week.dow,this._week.doy).week}var lc={dow:0,doy:6};function pc(){return this._week.dow}function $f(){return this._week.doy}function fm(T){var R=this.localeData().week(this);return T==null?R:this.add((T-R)*7,"d")}function Eh(T){var R=wr(this,1,4).week;return T==null?R:this.add((T-R)*7,"d")}st("d",0,"do","day"),st("dd",0,0,function(T){return this.localeData().weekdaysMin(this,T)}),st("ddd",0,0,function(T){return this.localeData().weekdaysShort(this,T)}),st("dddd",0,0,function(T){return this.localeData().weekdays(this,T)}),st("e",0,0,"weekday"),st("E",0,0,"isoWeekday"),Qt("d",Un),Qt("e",Un),Qt("E",Un),Qt("dd",function(T,R){return R.weekdaysMinRegex(T)}),Qt("ddd",function(T,R){return R.weekdaysShortRegex(T)}),Qt("dddd",function(T,R){return R.weekdaysRegex(T)}),zs(["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}),zs(["d","e","E"],function(T,R,V,X){R[X]=kn(T)});function l0(T,R){return typeof T!="string"?T:isNaN(T)?(T=R.weekdaysParse(T),typeof T=="number"?T:null):parseInt(T,10)}function Au(T,R){return typeof T=="string"?R.weekdaysParse(T)%7||7:isNaN(T)?null:T}function Du(T,R){return T.slice(R,7).concat(T.slice(0,R))}var p0="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),f0="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Vf="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Va=Qr,Hf=Qr,zu=Qr;function mp(T,R){var V=s(this._weekdays)?this._weekdays:this._weekdays[T&&T!==!0&&this._weekdays.isFormat.test(R)?"format":"standalone"];return T===!0?Du(V,this._week.dow):T?V[T.day()]:V}function Dc(T){return T===!0?Du(this._weekdaysShort,this._week.dow):T?this._weekdaysShort[T.day()]:this._weekdaysShort}function fc(T){return T===!0?Du(this._weekdaysMin,this._week.dow):T?this._weekdaysMin[T.day()]:this._weekdaysMin}function El(T,R,V){var X,oe,qe,Nt=T.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],X=0;X<7;++X)qe=C([2e3,1]).day(X),this._minWeekdaysParse[X]=this.weekdaysMin(qe,"").toLocaleLowerCase(),this._shortWeekdaysParse[X]=this.weekdaysShort(qe,"").toLocaleLowerCase(),this._weekdaysParse[X]=this.weekdays(qe,"").toLocaleLowerCase();return V?R==="dddd"?(oe=Cs.call(this._weekdaysParse,Nt),oe!==-1?oe:null):R==="ddd"?(oe=Cs.call(this._shortWeekdaysParse,Nt),oe!==-1?oe:null):(oe=Cs.call(this._minWeekdaysParse,Nt),oe!==-1?oe:null):R==="dddd"?(oe=Cs.call(this._weekdaysParse,Nt),oe!==-1||(oe=Cs.call(this._shortWeekdaysParse,Nt),oe!==-1)?oe:(oe=Cs.call(this._minWeekdaysParse,Nt),oe!==-1?oe:null)):R==="ddd"?(oe=Cs.call(this._shortWeekdaysParse,Nt),oe!==-1||(oe=Cs.call(this._weekdaysParse,Nt),oe!==-1)?oe:(oe=Cs.call(this._minWeekdaysParse,Nt),oe!==-1?oe:null)):(oe=Cs.call(this._minWeekdaysParse,Nt),oe!==-1||(oe=Cs.call(this._weekdaysParse,Nt),oe!==-1)?oe:(oe=Cs.call(this._shortWeekdaysParse,Nt),oe!==-1?oe:null))}function wl(T,R,V){var X,oe,qe;if(this._weekdaysParseExact)return El.call(this,T,R,V);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),X=0;X<7;X++){if(oe=C([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]||(qe="^"+this.weekdays(oe,"")+"|^"+this.weekdaysShort(oe,"")+"|^"+this.weekdaysMin(oe,""),this._weekdaysParse[X]=new RegExp(qe.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 To(T){if(!this.isValid())return T!=null?this:NaN;var R=cc(this,"Day");return T!=null?(T=l0(T,this.localeData()),this.add(T-R,"d")):R}function Qn(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 Zc(T){if(!this.isValid())return T!=null?this:NaN;if(T!=null){var R=Au(T,this.localeData());return this.day(this.day()%7?R:R-7)}else return this.day()||7}function Ws(T){return this._weekdaysParseExact?(n(this,"_weekdaysRegex")||Gp.call(this),T?this._weekdaysStrictRegex:this._weekdaysRegex):(n(this,"_weekdaysRegex")||(this._weekdaysRegex=Va),this._weekdaysStrictRegex&&T?this._weekdaysStrictRegex:this._weekdaysRegex)}function ei(T){return this._weekdaysParseExact?(n(this,"_weekdaysRegex")||Gp.call(this),T?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(n(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Hf),this._weekdaysShortStrictRegex&&T?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Wp(T){return this._weekdaysParseExact?(n(this,"_weekdaysRegex")||Gp.call(this),T?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(n(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=zu),this._weekdaysMinStrictRegex&&T?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Gp(){function T(mu,Zu){return Zu.length-mu.length}var R=[],V=[],X=[],oe=[],qe,Nt,Or,Ln,Li;for(qe=0;qe<7;qe++)Nt=C([2e3,1]).day(qe),Or=cs(this.weekdaysMin(Nt,"")),Ln=cs(this.weekdaysShort(Nt,"")),Li=cs(this.weekdays(Nt,"")),R.push(Or),V.push(Ln),X.push(Li),oe.push(Or),oe.push(Ln),oe.push(Li);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 Wu(){return this.hours()%12||12}function zf(){return this.hours()||24}st("H",["HH",2],0,"hour"),st("h",["hh",2],0,Wu),st("k",["kk",2],0,zf),st("hmm",0,0,function(){return""+Wu.apply(this)+Oe(this.minutes(),2)}),st("hmmss",0,0,function(){return""+Wu.apply(this)+Oe(this.minutes(),2)+Oe(this.seconds(),2)}),st("Hmm",0,0,function(){return""+this.hours()+Oe(this.minutes(),2)}),st("Hmmss",0,0,function(){return""+this.hours()+Oe(this.minutes(),2)+Oe(this.seconds(),2)});function Oa(T,R){st(T,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),R)})}Oa("a",!0),Oa("A",!1);function Wf(T,R){return R._meridiemParse}Qt("a",Wf),Qt("A",Wf),Qt("H",Un,ci),Qt("h",Un,$r),Qt("k",Un,$r),Qt("HH",Un,yn),Qt("hh",Un,yn),Qt("kk",Un,yn),Qt("hmm",va),Qt("hmmss",Aa),Qt("Hmm",va),Qt("Hmmss",Aa),li(["H","HH"],mo),li(["k","kk"],function(T,R,V){var X=kn(T);R[mo]=X===24?0:X}),li(["a","A"],function(T,R,V){V._isPm=V._locale.isPM(T),V._meridiem=T}),li(["h","hh"],function(T,R,V){R[mo]=kn(T),x(V).bigHour=!0}),li("hmm",function(T,R,V){var X=T.length-2;R[mo]=kn(T.substr(0,X)),R[ka]=kn(T.substr(X)),x(V).bigHour=!0}),li("hmmss",function(T,R,V){var X=T.length-4,oe=T.length-2;R[mo]=kn(T.substr(0,X)),R[ka]=kn(T.substr(X,2)),R[ua]=kn(T.substr(oe)),x(V).bigHour=!0}),li("Hmm",function(T,R,V){var X=T.length-2;R[mo]=kn(T.substr(0,X)),R[ka]=kn(T.substr(X))}),li("Hmmss",function(T,R,V){var X=T.length-4,oe=T.length-2;R[mo]=kn(T.substr(0,X)),R[ka]=kn(T.substr(X,2)),R[ua]=kn(T.substr(oe))});function wh(T){return(T+"").toLowerCase().charAt(0)==="p"}var dc=/[ap]\.?m?\.?/i,ps=Pn("Hours",!0);function gp(T,R,V){return T>11?V?"pm":"PM":V?"am":"AM"}var ku={calendar:tt,longDateFormat:or,invalidDate:Et,ordinal:D,dayOfMonthOrdinalParse:Ht,relativeTime:en,months:Sa,monthsShort:Cu,week:lc,weekdays:p0,weekdaysMin:Vf,weekdaysShort:f0,meridiemParse:dc},Zs={},No={},zo;function Gf(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 hc(T){return T&&T.toLowerCase().replace("_","-")}function Tl(T){for(var R=0,V,X,oe,qe;R<T.length;){for(qe=hc(T[R]).split("-"),V=qe.length,X=hc(T[R+1]),X=X?X.split("-"):null;V>0;){if(oe=se(qe.slice(0,V).join("-")),oe)return oe;if(X&&X.length>=V&&Gf(qe,X)>=V-1)break;V--}R++}return zo}function ye(T){return!!(T&&T.match("^[^/\\\\]*$"))}function se(T){var R=null,V;if(Zs[T]===void 0&&typeof nE<"u"&&nE&&nE.exports&&ye(T))try{R=zo._abbr,V=require,V("./locale/"+T),de(R)}catch{Zs[T]=null}return Zs[T]}function de(T,R){var V;return T&&(p(R)?V=it(T):V=je(T,R),V?zo=V:typeof console<"u"&&console.warn&&console.warn("Locale "+T+" not found. Did you forget to load it?")),zo._abbr}function je(T,R){if(R!==null){var V,X=ku;if(R.abbr=T,Zs[T]!=null)$t("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=Zs[T]._config;else if(R.parentLocale!=null)if(Zs[R.parentLocale]!=null)X=Zs[R.parentLocale]._config;else if(V=se(R.parentLocale),V!=null)X=V._config;else return No[R.parentLocale]||(No[R.parentLocale]=[]),No[R.parentLocale].push({name:T,config:R}),null;return Zs[T]=new fe(Ge(X,R)),No[T]&&No[T].forEach(function(oe){je(oe.name,oe.config)}),de(T),Zs[T]}else return delete Zs[T],null}function mt(T,R){if(R!=null){var V,X,oe=ku;Zs[T]!=null&&Zs[T].parentLocale!=null?Zs[T].set(Ge(Zs[T]._config,R)):(X=se(T),X!=null&&(oe=X._config),R=Ge(oe,R),X==null&&(R.abbr=T),V=new fe(R),V.parentLocale=Zs[T],Zs[T]=V),de(T)}else Zs[T]!=null&&(Zs[T].parentLocale!=null?(Zs[T]=Zs[T].parentLocale,T===de()&&de(T)):Zs[T]!=null&&delete Zs[T]);return Zs[T]}function it(T){var R;if(T&&T._locale&&T._locale._abbr&&(T=T._locale._abbr),!T)return zo;if(!s(T)){if(R=se(T),R)return R;T=[T]}return Tl(T)}function It(){return Le(Zs)}function Ft(T){var R,V=T._a;return V&&x(T).overflow===-2&&(R=V[Da]<0||V[Da]>11?Da:V[aa]<1||V[aa]>Oo(V[Pr],V[Da])?aa:V[mo]<0||V[mo]>24||V[mo]===24&&(V[ka]!==0||V[ua]!==0||V[wo]!==0)?mo:V[ka]<0||V[ka]>59?ka:V[ua]<0||V[ua]>59?ua:V[wo]<0||V[wo]>999?wo:-1,x(T)._overflowDayOfYear&&(R<Pr||R>aa)&&(R=aa),x(T)._overflowWeeks&&R===-1&&(R=fp),x(T)._overflowWeekday&&R===-1&&(R=Cc),x(T).overflow=R),T}var Zt=/^\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)?)?$/,jr=/^\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)?)?$/,ti=/Z|[+-]\d\d(?::?\d\d)?/,un=[["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]],Bn=[["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/]],uu=/^\/?Date\((-?\d+)/i,Kp=/^(?:(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}))$/,Ha={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 Na(T){var R,V,X=T._i,oe=Zt.exec(X)||jr.exec(X),qe,Nt,Or,Ln,Li=un.length,mu=Bn.length;if(oe){for(x(T).iso=!0,R=0,V=Li;R<V;R++)if(un[R][1].exec(oe[1])){Nt=un[R][0],qe=un[R][2]!==!1;break}if(Nt==null){T._isValid=!1;return}if(oe[3]){for(R=0,V=mu;R<V;R++)if(Bn[R][1].exec(oe[3])){Or=(oe[2]||" ")+Bn[R][0];break}if(Or==null){T._isValid=!1;return}}if(!qe&&Or!=null){T._isValid=!1;return}if(oe[4])if(ti.exec(oe[4]))Ln="Z";else{T._isValid=!1;return}T._f=Nt+(Or||"")+(Ln||""),za(T)}else T._isValid=!1}function Wi(T,R,V,X,oe,qe){var Nt=[In(T),Cu.indexOf(R),parseInt(V,10),parseInt(X,10),parseInt(oe,10)];return qe&&Nt.push(parseInt(qe,10)),Nt}function In(T){var R=parseInt(T,10);return R<=49?2e3+R:R<=999?1900+R:R}function tn(T){return T.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function xn(T,R,V){if(T){var X=f0.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 hi(T,R,V){if(T)return Ha[T];if(R)return 0;var X=parseInt(V,10),oe=X%100,qe=(X-oe)/100;return qe*60+oe}function _s(T){var R=Kp.exec(tn(T._i)),V;if(R){if(V=Wi(R[4],R[3],R[2],R[5],R[6],R[7]),!xn(R[1],V,T))return;T._a=V,T._tzm=hi(R[8],R[9],R[10]),T._d=qf.apply(null,T._a),T._d.setUTCMinutes(T._d.getUTCMinutes()-T._tzm),x(T).rfc2822=!0}else T._isValid=!1}function Ro(T){var R=uu.exec(T._i);if(R!==null){T._d=new Date(+R[1]);return}if(Na(T),T._isValid===!1)delete T._isValid;else return;if(_s(T),T._isValid===!1)delete T._isValid;else return;T._strict?T._isValid=!1:t.createFromInputFallback(T)}t.createFromInputFallback=Qe("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 ca(T,R,V){return T!=null?T:R!=null?R:V}function kc(T){var R=new Date(t.now());return T._useUTC?[R.getUTCFullYear(),R.getUTCMonth(),R.getUTCDate()]:[R.getFullYear(),R.getMonth(),R.getDate()]}function Fo(T){var R,V,X=[],oe,qe,Nt;if(!T._d){for(oe=kc(T),T._w&&T._a[aa]==null&&T._a[Da]==null&&Iu(T),T._dayOfYear!=null&&(Nt=ca(T._a[Pr],oe[Pr]),(T._dayOfYear>Hu(Nt)||T._dayOfYear===0)&&(x(T)._overflowDayOfYear=!0),V=qf(Nt,0,T._dayOfYear),T._a[Da]=V.getUTCMonth(),T._a[aa]=V.getUTCDate()),R=0;R<3&&T._a[R]==null;++R)T._a[R]=X[R]=oe[R];for(;R<7;R++)T._a[R]=X[R]=T._a[R]==null?R===2?1:0:T._a[R];T._a[mo]===24&&T._a[ka]===0&&T._a[ua]===0&&T._a[wo]===0&&(T._nextDay=!0,T._a[mo]=0),T._d=(T._useUTC?qf:Sh).apply(null,X),qe=T._useUTC?T._d.getUTCDay():T._d.getDay(),T._tzm!=null&&T._d.setUTCMinutes(T._d.getUTCMinutes()-T._tzm),T._nextDay&&(T._a[mo]=24),T._w&&typeof T._w.d<"u"&&T._w.d!==qe&&(x(T).weekdayMismatch=!0)}}function Iu(T){var R,V,X,oe,qe,Nt,Or,Ln,Li;R=T._w,R.GG!=null||R.W!=null||R.E!=null?(qe=1,Nt=4,V=ca(R.GG,T._a[Pr],wr(Yn(),1,4).year),X=ca(R.W,1),oe=ca(R.E,1),(oe<1||oe>7)&&(Ln=!0)):(qe=T._locale._week.dow,Nt=T._locale._week.doy,Li=wr(Yn(),qe,Nt),V=ca(R.gg,T._a[Pr],Li.year),X=ca(R.w,Li.week),R.d!=null?(oe=R.d,(oe<0||oe>6)&&(Ln=!0)):R.e!=null?(oe=R.e+qe,(R.e<0||R.e>6)&&(Ln=!0)):oe=qe),X<1||X>ls(V,qe,Nt)?x(T)._overflowWeeks=!0:Ln!=null?x(T)._overflowWeekday=!0:(Or=bh(V,X,oe,qe,Nt),T._a[Pr]=Or.year,T._dayOfYear=Or.dayOfYear)}t.ISO_8601=function(){},t.RFC_2822=function(){};function za(T){if(T._f===t.ISO_8601){Na(T);return}if(T._f===t.RFC_2822){_s(T);return}T._a=[],x(T).empty=!0;var R=""+T._i,V,X,oe,qe,Nt,Or=R.length,Ln=0,Li,mu;for(oe=xt(T._f,T._locale).match($e)||[],mu=oe.length,V=0;V<mu;V++)qe=oe[V],X=(R.match(us(qe,T))||[])[0],X&&(Nt=R.substr(0,R.indexOf(X)),Nt.length>0&&x(T).unusedInput.push(Nt),R=R.slice(R.indexOf(X)+X.length),Ln+=X.length),sr[qe]?(X?x(T).empty=!1:x(T).unusedTokens.push(qe),Yc(qe,X,T)):T._strict&&!X&&x(T).unusedTokens.push(qe);x(T).charsLeftOver=Or-Ln,R.length>0&&x(T).unusedInput.push(R),T._a[mo]<=12&&x(T).bigHour===!0&&T._a[mo]>0&&(x(T).bigHour=void 0),x(T).parsedDateParts=T._a.slice(0),x(T).meridiem=T._meridiem,T._a[mo]=Pl(T._locale,T._a[mo],T._meridiem),Li=x(T).era,Li!==null&&(T._a[Pr]=T._locale.erasConvertYear(Li,T._a[Pr])),Fo(T),Ft(T)}function Pl(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 yp(T){var R,V,X,oe,qe,Nt,Or=!1,Ln=T._f.length;if(Ln===0){x(T).invalidFormat=!0,T._d=new Date(NaN);return}for(oe=0;oe<Ln;oe++)qe=0,Nt=!1,R=ne({},T),T._useUTC!=null&&(R._useUTC=T._useUTC),R._f=T._f[oe],za(R),B(R)&&(Nt=!0),qe+=x(R).charsLeftOver,qe+=x(R).unusedTokens.length*10,x(R).score=qe,Or?qe<X&&(X=qe,V=R):(X==null||qe<X||Nt)&&(X=qe,V=R,Nt&&(Or=!0));w(T,V||R)}function Qc(T){if(!T._d){var R=ot(T._i),V=R.day===void 0?R.date:R.day;T._a=v([R.year,R.month,V,R.hour,R.minute,R.second,R.millisecond],function(X){return X&&parseInt(X,10)}),Fo(T)}}function Yp(T){var R=new ge(Ft(Fs(T)));return R._nextDay&&(R.add(1,"d"),R._nextDay=void 0),R}function Fs(T){var R=T._i,V=T._f;return T._locale=T._locale||it(T._l),R===null||V===void 0&&R===""?q({nullInput:!0}):(typeof R=="string"&&(T._i=R=T._locale.preparse(R)),Re(R)?new ge(Ft(R)):(g(R)?T._d=R:s(V)?yp(T):V?za(T):fs(T),B(T)||(T._d=null),T))}function fs(T){var R=T._i;p(R)?T._d=new Date(t.now()):g(R)?T._d=new Date(R.valueOf()):typeof R=="string"?Ro(T):s(R)?(T._a=v(R.slice(0),function(V){return parseInt(V,10)}),Fo(T)):a(R)?Qc(T):m(R)?T._d=new Date(R):t.createFromInputFallback(T)}function Jp(T,R,V,X,oe){var qe={};return(R===!0||R===!1)&&(X=R,R=void 0),(V===!0||V===!1)&&(X=V,V=void 0),(a(T)&&l(T)||s(T)&&T.length===0)&&(T=void 0),qe._isAMomentObject=!0,qe._useUTC=qe._isUTC=oe,qe._l=V,qe._i=T,qe._f=R,qe._strict=X,Yp(qe)}function Yn(T,R,V,X){return Jp(T,R,V,X,!1)}var Th=Qe("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var T=Yn.apply(null,arguments);return this.isValid()&&T.isValid()?T<this?this:T:q()}),Wa=Qe("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var T=Yn.apply(null,arguments);return this.isValid()&&T.isValid()?T>this?this:T:q()});function $i(T,R){var V,X;if(R.length===1&&s(R[0])&&(R=R[0]),!R.length)return Yn();for(V=R[0],X=1;X<R.length;++X)(!R[X].isValid()||R[X][T](V))&&(V=R[X]);return V}function mc(){var T=[].slice.call(arguments,0);return $i("isBefore",T)}function Ph(){var T=[].slice.call(arguments,0);return $i("isAfter",T)}var Od=function(){return Date.now?Date.now():+new Date},el=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Yy(T){var R,V=!1,X,oe=el.length;for(R in T)if(n(T,R)&&!(Cs.call(el,R)!==-1&&(T[R]==null||!isNaN(T[R]))))return!1;for(X=0;X<oe;++X)if(T[el[X]]){if(V)return!1;parseFloat(T[el[X]])!==kn(T[el[X]])&&(V=!0)}return!0}function Ch(){return this._isValid}function Ah(){return ai(NaN)}function tl(T){var R=ot(T),V=R.year||0,X=R.quarter||0,oe=R.month||0,qe=R.week||R.isoWeek||0,Nt=R.day||0,Or=R.hour||0,Ln=R.minute||0,Li=R.second||0,mu=R.millisecond||0;this._isValid=Yy(R),this._milliseconds=+mu+Li*1e3+Ln*6e4+Or*1e3*60*60,this._days=+Nt+qe*7,this._months=+oe+X*3+V*12,this._data={},this._locale=it(),this._bubble()}function ta(T){return T instanceof tl}function Ic(T){return T<0?Math.round(-1*T)*-1:Math.round(T)}function gc(T,R,V){var X=Math.min(T.length,R.length),oe=Math.abs(T.length-R.length),qe=0,Nt;for(Nt=0;Nt<X;Nt++)(V&&T[Nt]!==R[Nt]||!V&&kn(T[Nt])!==kn(R[Nt]))&&qe++;return qe+oe}function Kf(T,R){st(T,0,0,function(){var V=this.utcOffset(),X="+";return V<0&&(V=-V,X="-"),X+Oe(~~(V/60),2)+R+Oe(~~V%60,2)})}Kf("Z",":"),Kf("ZZ",""),Qt("Z",Gt),Qt("ZZ",Gt),li(["Z","ZZ"],function(T,R,V){V._useUTC=!0,V._tzm=Lo(Gt,T)});var Wo=/([\+\-]|\d\d)/gi;function Lo(T,R){var V=(R||"").match(T),X,oe,qe;return V===null?null:(X=V[V.length-1]||[],oe=(X+"").match(Wo)||["-",0,0],qe=+(oe[1]*60)+kn(oe[2]),qe===0?0:oe[0]==="+"?qe:-qe)}function Ss(T,R){var V,X;return R._isUTC?(V=R.clone(),X=(Re(T)||g(T)?T.valueOf():Yn(T).valueOf())-V.valueOf(),V._d.setTime(V._d.valueOf()+X),t.updateOffset(V,!1),V):Yn(T).local()}function rl(T){return-Math.round(T._d.getTimezoneOffset())}t.updateOffset=function(){};function Nd(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=Lo(Gt,T),T===null)return this}else Math.abs(T)<16&&!V&&(T=T*60);return!this._isUTC&&R&&(oe=rl(this)),this._offset=T,this._isUTC=!0,oe!=null&&this.add(oe,"m"),X!==T&&(!R||this._changeInProgress?Ou(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:rl(this)}function as(T,R){return T!=null?(typeof T!="string"&&(T=-T),this.utcOffset(T,R),this):-this.utcOffset()}function dm(T){return this.utcOffset(0,T)}function hm(T){return this._isUTC&&(this.utcOffset(0,T),this._isUTC=!1,T&&this.subtract(rl(this),"m")),this}function cu(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var T=Lo(Jt,this._i);T!=null?this.utcOffset(T):this.utcOffset(0,!0)}return this}function Go(T){return this.isValid()?(T=T?Yn(T).utcOffset():0,(this.utcOffset()-T)%60===0):!1}function Je(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Lt(){if(!p(this._isDSTShifted))return this._isDSTShifted;var T={},R;return ne(T,this),T=Fs(T),T._a?(R=T._isUTC?C(T._a):Yn(T._a),this._isDSTShifted=this.isValid()&&gc(T._a,R.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Pt(){return this.isValid()?!this._isUTC:!1}function Lr(){return this.isValid()?this._isUTC:!1}function Ir(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Ei=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,uo=/^(-|\+)?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,qe,Nt;return ta(T)?V={ms:T._milliseconds,d:T._days,M:T._months}:m(T)||!isNaN(+T)?(V={},R?V[R]=+T:V.milliseconds=+T):(X=Ei.exec(T))?(oe=X[1]==="-"?-1:1,V={y:0,d:kn(X[aa])*oe,h:kn(X[mo])*oe,m:kn(X[ka])*oe,s:kn(X[ua])*oe,ms:kn(Ic(X[wo]*1e3))*oe}):(X=uo.exec(T))?(oe=X[1]==="-"?-1:1,V={y:nl(X[2],oe),M:nl(X[3],oe),w:nl(X[4],oe),d:nl(X[5],oe),h:nl(X[6],oe),m:nl(X[7],oe),s:nl(X[8],oe)}):V==null?V={}:typeof V=="object"&&("from"in V||"to"in V)&&(Nt=Gu(Yn(V.from),Yn(V.to)),V={},V.ms=Nt.milliseconds,V.M=Nt.months),qe=new tl(V),ta(T)&&n(T,"_locale")&&(qe._locale=T._locale),ta(T)&&n(T,"_isValid")&&(qe._isValid=T._isValid),qe}ai.fn=tl.prototype,ai.invalid=Ah;function nl(T,R){var V=T&&parseFloat(T.replace(",","."));return(isNaN(V)?0:V)*R}function il(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 Gu(T,R){var V;return T.isValid()&&R.isValid()?(R=Ss(R,T),T.isBefore(R)?V=il(T,R):(V=il(R,T),V.milliseconds=-V.milliseconds,V.months=-V.months),V):{milliseconds:0,months:0}}function Cl(T,R){return function(V,X){var oe,qe;return X!==null&&!isNaN(+X)&&($t(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."),qe=V,V=X,X=qe),oe=ai(V,X),Ou(this,oe,T),this}}function Ou(T,R,V,X){var oe=R._milliseconds,qe=Ic(R._days),Nt=Ic(R._months);T.isValid()&&(X=X==null?!0:X,Nt&&rr(T,cc(T,"Month")+Nt*V),qe&&dp(T,"Date",cc(T,"Date")+qe*V),oe&&T._d.setTime(T._d.valueOf()+oe*V),X&&t.updateOffset(T,qe||Nt))}var mi=Cl(1,"add"),Xp=Cl(-1,"subtract");function Yf(T){return typeof T=="string"||T instanceof String}function ds(T){return Re(T)||g(T)||Yf(T)||m(T)||mm(T)||Lg(T)||T===null||T===void 0}function Lg(T){var R=a(T)&&!l(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,qe,Nt=X.length;for(oe=0;oe<Nt;oe+=1)qe=X[oe],V=V||n(T,qe);return R&&V}function mm(T){var R=s(T),V=!1;return R&&(V=T.filter(function(X){return!m(X)&&Yf(T)}).length===0),R&&V}function d0(T){var R=a(T)&&!l(T),V=!1,X=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],oe,qe;for(oe=0;oe<X.length;oe+=1)qe=X[oe],V=V||n(T,qe);return R&&V}function A1(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 gm(T,R){arguments.length===1&&(arguments[0]?ds(arguments[0])?(T=arguments[0],R=void 0):d0(arguments[0])&&(R=arguments[0],T=void 0):(T=void 0,R=void 0));var V=T||Yn(),X=Ss(V,this).startOf("day"),oe=t.calendarFormat(this,X)||"sameElse",qe=R&&(bt(R[oe])?R[oe].call(this,V):R[oe]);return this.format(qe||this.localeData().calendar(oe,this,Yn(V)))}function h0(){return new ge(this)}function m0(T,R){var V=Re(T)?T:Yn(T);return this.isValid()&&V.isValid()?(R=we(R)||"millisecond",R==="millisecond"?this.valueOf()>V.valueOf():V.valueOf()<this.clone().startOf(R).valueOf()):!1}function Ra(T,R){var V=Re(T)?T:Yn(T);return this.isValid()&&V.isValid()?(R=we(R)||"millisecond",R==="millisecond"?this.valueOf()<V.valueOf():this.clone().endOf(R).valueOf()<V.valueOf()):!1}function sl(T,R,V,X){var oe=Re(T)?T:Yn(T),qe=Re(R)?R:Yn(R);return this.isValid()&&oe.isValid()&&qe.isValid()?(X=X||"()",(X[0]==="("?this.isAfter(oe,V):!this.isBefore(oe,V))&&(X[1]===")"?this.isBefore(qe,V):!this.isAfter(qe,V))):!1}function lu(T,R){var V=Re(T)?T:Yn(T),X;return this.isValid()&&V.isValid()?(R=we(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 Nu(T,R){return this.isSame(T,R)||this.isAfter(T,R)}function pu(T,R){return this.isSame(T,R)||this.isBefore(T,R)}function Zp(T,R,V){var X,oe,qe;if(!this.isValid())return NaN;if(X=Ss(T,this),!X.isValid())return NaN;switch(oe=(X.utcOffset()-this.utcOffset())*6e4,R=we(R),R){case"year":qe=Ru(this,X)/12;break;case"month":qe=Ru(this,X);break;case"quarter":qe=Ru(this,X)/3;break;case"second":qe=(this-X)/1e3;break;case"minute":qe=(this-X)/6e4;break;case"hour":qe=(this-X)/36e5;break;case"day":qe=(this-X-oe)/864e5;break;case"week":qe=(this-X-oe)/6048e5;break;default:qe=this-X}return V?qe:os(qe)}function Ru(T,R){if(T.date()<R.date())return-Ru(R,T);var V=(R.year()-T.year())*12+(R.month()-T.month()),X=T.clone().add(V,"months"),oe,qe;return R-X<0?(oe=T.clone().add(V-1,"months"),qe=(R-X)/(X-oe)):(oe=T.clone().add(V+1,"months"),qe=(R-X)/(oe-X)),-(V+qe)||0}t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function Al(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function Dl(T){if(!this.isValid())return null;var R=T!==!0,V=R?this.clone().utc():this;return V.year()<0||V.year()>9999?lt(V,R?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):bt(Date.prototype.toISOString)?R?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",lt(V,"Z")):lt(V,R?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Oc(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var T="moment",R="",V,X,oe,qe;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",qe=R+'[")]',this.format(V+X+oe+qe)}function Qp(T){T||(T=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var R=lt(this,T);return this.localeData().postformat(R)}function Mg(T,R){return this.isValid()&&(Re(T)&&T.isValid()||Yn(T).isValid())?ai({to:this,from:T}).locale(this.locale()).humanize(!R):this.localeData().invalidDate()}function ym(T){return this.from(Yn(),T)}function Rd(T,R){return this.isValid()&&(Re(T)&&T.isValid()||Yn(T).isValid())?ai({from:this,to:T}).locale(this.locale()).humanize(!R):this.localeData().invalidDate()}function ol(T){return this.to(Yn(),T)}function Fd(T){var R;return T===void 0?this._locale._abbr:(R=it(T),R!=null&&(this._locale=R),this)}var Ku=Qe("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 vm(){return this._locale}var kl=1e3,Il=60*kl,ef=60*Il,la=(365*400+97)*24*ef;function Jn(T,R){return(T%R+R)%R}function Fa(T,R,V){return T<100&&T>=0?new Date(T+400,R,V)-la:new Date(T,R,V).valueOf()}function Nc(T,R,V){return T<100&&T>=0?Date.UTC(T+400,R,V)-la:Date.UTC(T,R,V)}function Rc(T){var R,V;if(T=we(T),T===void 0||T==="millisecond"||!this.isValid())return this;switch(V=this._isUTC?Nc:Fa,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-=Jn(R+(this._isUTC?0:this.utcOffset()*Il),ef);break;case"minute":R=this._d.valueOf(),R-=Jn(R,Il);break;case"second":R=this._d.valueOf(),R-=Jn(R,kl);break}return this._d.setTime(R),t.updateOffset(this,!0),this}function vp(T){var R,V;if(T=we(T),T===void 0||T==="millisecond"||!this.isValid())return this;switch(V=this._isUTC?Nc:Fa,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+=ef-Jn(R+(this._isUTC?0:this.utcOffset()*Il),ef)-1;break;case"minute":R=this._d.valueOf(),R+=Il-Jn(R,Il)-1;break;case"second":R=this._d.valueOf(),R+=kl-Jn(R,kl)-1;break}return this._d.setTime(R),t.updateOffset(this,!0),this}function Fu(){return this._d.valueOf()-(this._offset||0)*6e4}function al(){return Math.floor(this.valueOf()/1e3)}function ul(){return new Date(this.valueOf())}function Ld(){var T=this;return[T.year(),T.month(),T.date(),T.hour(),T.minute(),T.second(),T.millisecond()]}function Jf(){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 Ol(){return this.isValid()?this.toISOString():null}function tf(){return B(this)}function Dh(){return w({},x(this))}function Bg(){return x(this).overflow}function g0(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}st("N",0,0,"eraAbbr"),st("NN",0,0,"eraAbbr"),st("NNN",0,0,"eraAbbr"),st("NNNN",0,0,"eraName"),st("NNNNN",0,0,"eraNarrow"),st("y",["y",1],"yo","eraYear"),st("y",["yy",2],0,"eraYear"),st("y",["yyy",3],0,"eraYear"),st("y",["yyyy",4],0,"eraYear"),Qt("N",Ai),Qt("NN",Ai),Qt("NNN",Ai),Qt("NNNN",y0),Qt("NNNNN",v0),li(["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}),Qt("y",Tu),Qt("yy",Tu),Qt("yyy",Tu),Qt("yyyy",Tu),Qt("yo",_m),li(["y","yy","yyy","yyyy"],Pr),li(["yo"],function(T,R,V,X){var oe;V._locale._eraYearOrdinalRegex&&(oe=T.match(V._locale._eraYearOrdinalRegex)),V._locale.eraYearOrdinalParse?R[Pr]=V._locale.eraYearOrdinalParse(T,oe):R[Pr]=parseInt(T,10)});function jg(T,R){var V,X,oe,qe=this._eras||it("en")._eras;for(V=0,X=qe.length;V<X;++V){switch(typeof qe[V].since){case"string":oe=t(qe[V].since).startOf("day"),qe[V].since=oe.valueOf();break}switch(typeof qe[V].until){case"undefined":qe[V].until=1/0;break;case"string":oe=t(qe[V].until).startOf("day").valueOf(),qe[V].until=oe.valueOf();break}}return qe}function qg(T,R,V){var X,oe,qe=this.eras(),Nt,Or,Ln;for(T=T.toUpperCase(),X=0,oe=qe.length;X<oe;++X)if(Nt=qe[X].name.toUpperCase(),Or=qe[X].abbr.toUpperCase(),Ln=qe[X].narrow.toUpperCase(),V)switch(R){case"N":case"NN":case"NNN":if(Or===T)return qe[X];break;case"NNNN":if(Nt===T)return qe[X];break;case"NNNNN":if(Ln===T)return qe[X];break}else if([Nt,Or,Ln].indexOf(T)>=0)return qe[X]}function xm(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 Nl(){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 Md(){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 Ug(){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 ae(){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 pa(T){return n(this,"_erasNameRegex")||Fc.call(this),T?this._erasNameRegex:this._erasRegex}function Xf(T){return n(this,"_erasAbbrRegex")||Fc.call(this),T?this._erasAbbrRegex:this._erasRegex}function Ga(T){return n(this,"_erasNarrowRegex")||Fc.call(this),T?this._erasNarrowRegex:this._erasRegex}function Ai(T,R){return R.erasAbbrRegex(T)}function y0(T,R){return R.erasNameRegex(T)}function v0(T,R){return R.erasNarrowRegex(T)}function _m(T,R){return R._eraYearOrdinalRegex||Tu}function Fc(){var T=[],R=[],V=[],X=[],oe,qe,Nt,Or,Ln,Li=this.eras();for(oe=0,qe=Li.length;oe<qe;++oe)Nt=cs(Li[oe].name),Or=cs(Li[oe].abbr),Ln=cs(Li[oe].narrow),R.push(Nt),T.push(Or),V.push(Ln),X.push(Nt),X.push(Or),X.push(Ln);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")}st(0,["gg",2],0,function(){return this.weekYear()%100}),st(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Bd(T,R){st(0,[T,T.length],0,R)}Bd("gggg","weekYear"),Bd("ggggg","weekYear"),Bd("GGGG","isoWeekYear"),Bd("GGGGG","isoWeekYear"),Qt("G",ft),Qt("g",ft),Qt("GG",Un,yn),Qt("gg",Un,yn),Qt("GGGG",xa,Zn),Qt("gggg",xa,Zn),Qt("GGGGG",uc,Ci),Qt("ggggg",uc,Ci),zs(["gggg","ggggg","GGGG","GGGGG"],function(T,R,V,X){R[X.substr(0,2)]=kn(T)}),zs(["gg","GG"],function(T,R,V,X){R[X]=t.parseTwoDigitYear(T)});function jd(T){return Lc.call(this,T,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function $g(T){return Lc.call(this,T,this.isoWeek(),this.isoWeekday(),1,4)}function x0(){return ls(this.year(),1,4)}function _0(){return ls(this.isoWeekYear(),1,4)}function fu(){var T=this.localeData()._week;return ls(this.year(),T.dow,T.doy)}function Zf(){var T=this.localeData()._week;return ls(this.weekYear(),T.dow,T.doy)}function Lc(T,R,V,X,oe){var qe;return T==null?wr(this,X,oe).year:(qe=ls(T,X,oe),R>qe&&(R=qe),Qf.call(this,T,R,V,X,oe))}function Qf(T,R,V,X,oe){var qe=bh(T,R,V,X,oe),Nt=qf(qe.year,0,qe.dayOfYear);return this.year(Nt.getUTCFullYear()),this.month(Nt.getUTCMonth()),this.date(Nt.getUTCDate()),this}st("Q",0,"Qo","quarter"),Qt("Q",an),li("Q",function(T,R){R[Da]=(kn(T)-1)*3});function Sm(T){return T==null?Math.ceil((this.month()+1)/3):this.month((T-1)*3+this.month()%3)}st("D",["DD",2],"Do","date"),Qt("D",Un,$r),Qt("DD",Un,yn),Qt("Do",function(T,R){return T?R._dayOfMonthOrdinalParse||R._ordinalParse:R._dayOfMonthOrdinalParseLenient}),li(["D","DD"],aa),li("Do",function(T,R){R[aa]=kn(T.match(Un)[0])});var rf=Pn("Date",!0);st("DDD",["DDDD",3],"DDDo","dayOfYear"),Qt("DDD",Os),Qt("DDDD",oi),li(["DDD","DDDD"],function(T,R,V){V._dayOfYear=kn(T)});function La(T){var R=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return T==null?R:this.add(T-R,"d")}st("m",["mm",2],0,"minute"),Qt("m",Un,ci),Qt("mm",Un,yn),li(["m","mm"],ka);var bm=Pn("Minutes",!1);st("s",["ss",2],0,"second"),Qt("s",Un,ci),Qt("ss",Un,yn),li(["s","ss"],ua);var kh=Pn("Seconds",!1);st("S",0,0,function(){return~~(this.millisecond()/100)}),st(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),st(0,["SSS",3],0,"millisecond"),st(0,["SSSS",4],0,function(){return this.millisecond()*10}),st(0,["SSSSS",5],0,function(){return this.millisecond()*100}),st(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),st(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),st(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),st(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),Qt("S",Os,an),Qt("SS",Os,yn),Qt("SSS",Os,oi);var cl,Em;for(cl="SSSS";cl.length<=9;cl+="S")Qt(cl,Tu);function Vg(T,R){R[wo]=kn(("0."+T)*1e3)}for(cl="S";cl.length<=9;cl+="S")li(cl,Vg);Em=Pn("Milliseconds",!1),st("z",0,0,"zoneAbbr"),st("zz",0,0,"zoneName");function Rl(){return this._isUTC?"UTC":""}function S0(){return this._isUTC?"Coordinated Universal Time":""}var hr=ge.prototype;hr.add=mi,hr.calendar=gm,hr.clone=h0,hr.diff=Zp,hr.endOf=vp,hr.format=Qp,hr.from=Mg,hr.fromNow=ym,hr.to=Rd,hr.toNow=ol,hr.get=Pu,hr.invalidAt=Bg,hr.isAfter=m0,hr.isBefore=Ra,hr.isBetween=sl,hr.isSame=lu,hr.isSameOrAfter=Nu,hr.isSameOrBefore=pu,hr.isValid=tf,hr.lang=Ku,hr.locale=Fd,hr.localeData=vm,hr.max=Wa,hr.min=Th,hr.parsingFlags=Dh,hr.set=Xs,hr.startOf=Rc,hr.subtract=Xp,hr.toArray=Ld,hr.toObject=Jf,hr.toDate=ul,hr.toISOString=Dl,hr.inspect=Oc,typeof Symbol<"u"&&Symbol.for!=null&&(hr[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),hr.toJSON=Ol,hr.toString=Al,hr.unix=al,hr.valueOf=Fu,hr.creationData=g0,hr.eraName=Nl,hr.eraNarrow=Md,hr.eraAbbr=Ug,hr.eraYear=ae,hr.year=Jc,hr.isLeapYear=Vp,hr.weekYear=jd,hr.isoWeekYear=$g,hr.quarter=hr.quarters=Sm,hr.month=Ac,hr.daysInMonth=c0,hr.week=hr.weeks=fm,hr.isoWeek=hr.isoWeeks=Eh,hr.weeksInYear=fu,hr.weeksInWeekYear=Zf,hr.isoWeeksInYear=x0,hr.isoWeeksInISOWeekYear=_0,hr.date=rf,hr.day=hr.days=To,hr.weekday=Qn,hr.isoWeekday=Zc,hr.dayOfYear=La,hr.hour=hr.hours=ps,hr.minute=hr.minutes=bm,hr.second=hr.seconds=kh,hr.millisecond=hr.milliseconds=Em,hr.utcOffset=Nd,hr.utc=dm,hr.local=hm,hr.parseZone=cu,hr.hasAlignedHourOffset=Go,hr.isDST=Je,hr.isLocal=Pt,hr.isUtcOffset=Lr,hr.isUtc=Ir,hr.isUTC=Ir,hr.zoneAbbr=Rl,hr.zoneName=S0,hr.dates=Qe("dates accessor is deprecated. Use date instead.",rf),hr.months=Qe("months accessor is deprecated. Use month instead",Ac),hr.years=Qe("years accessor is deprecated. Use year instead",Jc),hr.zone=Qe("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",as),hr.isDSTShifted=Qe("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Lt);function cn(T){return Yn(T*1e3)}function du(){return Yn.apply(null,arguments).parseZone()}function fa(T){return T}var ri=fe.prototype;ri.calendar=De,ri.longDateFormat=jt,ri.invalidDate=At,ri.ordinal=fr,ri.preparse=fa,ri.postformat=fa,ri.relativeTime=Rt,ri.pastFuture=Bt,ri.set=_t,ri.eras=jg,ri.erasParse=qg,ri.erasConvertYear=xm,ri.erasAbbrRegex=Xf,ri.erasNameRegex=pa,ri.erasNarrowRegex=Ga,ri.months=pm,ri.monthsShort=zp,ri.monthsParse=au,ri.monthsRegex=Rs,ri.monthsShortRegex=Sl,ri.week=Uf,ri.firstDayOfYear=$f,ri.firstDayOfWeek=pc,ri.weekdays=mp,ri.weekdaysMin=fc,ri.weekdaysShort=Dc,ri.weekdaysParse=wl,ri.weekdaysRegex=Ws,ri.weekdaysShortRegex=ei,ri.weekdaysMinRegex=Wp,ri.isPM=wh,ri.meridiem=gp;function Yu(T,R,V,X){var oe=it(),qe=C().set(X,R);return oe[V](qe,T)}function Ih(T,R,V){if(m(T)&&(R=T,T=void 0),T=T||"",R!=null)return Yu(T,R,V,"month");var X,oe=[];for(X=0;X<12;X++)oe[X]=Yu(T,X,V,"month");return oe}function Mo(T,R,V,X){typeof T=="boolean"?(m(R)&&(V=R,R=void 0),R=R||""):(R=T,V=R,T=!1,m(R)&&(V=R,R=void 0),R=R||"");var oe=it(),qe=T?oe._week.dow:0,Nt,Or=[];if(V!=null)return Yu(R,(V+qe)%7,X,"day");for(Nt=0;Nt<7;Nt++)Or[Nt]=Yu(R,(Nt+qe)%7,X,"day");return Or}function qd(T,R){return Ih(T,R,"months")}function pi(T,R){return Ih(T,R,"monthsShort")}function Ud(T,R,V){return Mo(T,R,V,"weekdays")}function xp(T,R,V){return Mo(T,R,V,"weekdaysShort")}function ed(T,R,V){return Mo(T,R,V,"weekdaysMin")}de("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=kn(T%100/10)===1?"th":R===1?"st":R===2?"nd":R===3?"rd":"th";return T+V}}),t.lang=Qe("moment.lang is deprecated. Use moment.locale instead.",de),t.langData=Qe("moment.langData is deprecated. Use moment.localeData instead.",it);var yc=Math.abs;function wm(){var T=this._data;return this._milliseconds=yc(this._milliseconds),this._days=yc(this._days),this._months=yc(this._months),T.milliseconds=yc(T.milliseconds),T.seconds=yc(T.seconds),T.minutes=yc(T.minutes),T.hours=yc(T.hours),T.months=yc(T.months),T.years=yc(T.years),this}function Oh(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 nf(T,R){return Oh(this,T,R,1)}function Mr(T,R){return Oh(this,T,R,-1)}function _p(T){return T<0?Math.floor(T):Math.ceil(T)}function Sp(){var T=this._milliseconds,R=this._days,V=this._months,X=this._data,oe,qe,Nt,Or,Ln;return T>=0&&R>=0&&V>=0||T<=0&&R<=0&&V<=0||(T+=_p(Fl(V)+R)*864e5,R=0,V=0),X.milliseconds=T%1e3,oe=os(T/1e3),X.seconds=oe%60,qe=os(oe/60),X.minutes=qe%60,Nt=os(qe/60),X.hours=Nt%24,R+=os(Nt/24),Ln=os(Bo(R)),V+=Ln,R-=_p(Fl(Ln)),Or=os(V/12),V%=12,X.days=R,X.months=V,X.years=Or,this}function Bo(T){return T*4800/146097}function Fl(T){return T*146097/4800}function $d(T){if(!this.isValid())return NaN;var R,V,X=this._milliseconds;if(T=we(T),T==="month"||T==="quarter"||T==="year")switch(R=this._days+X/864e5,V=this._months+Bo(R),T){case"month":return V;case"quarter":return V/3;case"year":return V/12}else switch(R=this._days+Math.round(Fl(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 Ju(T){return function(){return this.as(T)}}var Ll=Ju("ms"),Ml=Ju("s"),Bl=Ju("m"),Nh=Ju("h"),jl=Ju("d"),Vd=Ju("w"),Mc=Ju("M"),co=Ju("Q"),td=Ju("y"),sf=Ll;function Po(){return ai(this)}function hs(T){return T=we(T),this.isValid()?this[T+"s"]():NaN}function Zi(T){return function(){return this.isValid()?this._data[T]:NaN}}var ql=Zi("milliseconds"),Xu=Zi("seconds"),hu=Zi("minutes"),of=Zi("hours"),Tm=Zi("days"),Jy=Zi("months"),Pm=Zi("years");function Hd(){return os(this.days()/7)}var Bc=Math.round,jc={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function rd(T,R,V,X,oe){return oe.relativeTime(R||1,!!V,T,X)}function Hg(T,R,V,X){var oe=ai(T).abs(),qe=Bc(oe.as("s")),Nt=Bc(oe.as("m")),Or=Bc(oe.as("h")),Ln=Bc(oe.as("d")),Li=Bc(oe.as("M")),mu=Bc(oe.as("w")),Zu=Bc(oe.as("y")),Co=qe<=V.ss&&["s",qe]||qe<V.s&&["ss",qe]||Nt<=1&&["m"]||Nt<V.m&&["mm",Nt]||Or<=1&&["h"]||Or<V.h&&["hh",Or]||Ln<=1&&["d"]||Ln<V.d&&["dd",Ln];return V.w!=null&&(Co=Co||mu<=1&&["w"]||mu<V.w&&["ww",mu]),Co=Co||Li<=1&&["M"]||Li<V.M&&["MM",Li]||Zu<=1&&["y"]||["yy",Zu],Co[2]=R,Co[3]=+T>0,Co[4]=X,rd.apply(null,Co)}function zg(T){return T===void 0?Bc:typeof T=="function"?(Bc=T,!0):!1}function bp(T,R){return jc[T]===void 0?!1:R===void 0?jc[T]:(jc[T]=R,T==="s"&&(jc.ss=R-1),!0)}function Xy(T,R){if(!this.isValid())return this.localeData().invalidDate();var V=!1,X=jc,oe,qe;return typeof T=="object"&&(R=T,T=!1),typeof T=="boolean"&&(V=T),typeof R=="object"&&(X=Object.assign({},jc,R),R.s!=null&&R.ss==null&&(X.ss=R.s-1)),oe=this.localeData(),qe=Hg(this,!V,X,oe),V&&(qe=oe.pastFuture(+this,qe)),oe.postformat(qe)}var b0=Math.abs;function Ul(T){return(T>0)-(T<0)||+T}function Ka(){if(!this.isValid())return this.localeData().invalidDate();var T=b0(this._milliseconds)/1e3,R=b0(this._days),V=b0(this._months),X,oe,qe,Nt,Or=this.asSeconds(),Ln,Li,mu,Zu;return Or?(X=os(T/60),oe=os(X/60),T%=60,X%=60,qe=os(V/12),V%=12,Nt=T?T.toFixed(3).replace(/\.?0+$/,""):"",Ln=Or<0?"-":"",Li=Ul(this._months)!==Ul(Or)?"-":"",mu=Ul(this._days)!==Ul(Or)?"-":"",Zu=Ul(this._milliseconds)!==Ul(Or)?"-":"",Ln+"P"+(qe?Li+qe+"Y":"")+(V?Li+V+"M":"")+(R?mu+R+"D":"")+(oe||X||T?"T":"")+(oe?Zu+oe+"H":"")+(X?Zu+X+"M":"")+(T?Zu+Nt+"S":"")):"P0D"}var _i=tl.prototype;_i.isValid=Ch,_i.abs=wm,_i.add=nf,_i.subtract=Mr,_i.as=$d,_i.asMilliseconds=Ll,_i.asSeconds=Ml,_i.asMinutes=Bl,_i.asHours=Nh,_i.asDays=jl,_i.asWeeks=Vd,_i.asMonths=Mc,_i.asQuarters=co,_i.asYears=td,_i.valueOf=sf,_i._bubble=Sp,_i.clone=Po,_i.get=hs,_i.milliseconds=ql,_i.seconds=Xu,_i.minutes=hu,_i.hours=of,_i.days=Tm,_i.weeks=Hd,_i.months=Jy,_i.years=Pm,_i.humanize=Xy,_i.toISOString=Ka,_i.toString=Ka,_i.toJSON=Ka,_i.locale=Fd,_i.localeData=vm,_i.toIsoString=Qe("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Ka),_i.lang=Ku,st("X",0,0,"unix"),st("x",0,0,"valueOf"),Qt("x",ft),Qt("X",gr),li("X",function(T,R,V){V._d=new Date(parseFloat(T)*1e3)}),li("x",function(T,R,V){V._d=new Date(kn(T))});return t.version="2.30.1",r(Yn),t.fn=hr,t.min=mc,t.max=Ph,t.now=Od,t.utc=C,t.unix=cn,t.months=qd,t.isDate=g,t.locale=de,t.invalid=q,t.duration=ai,t.isMoment=Re,t.weekdays=Ud,t.parseZone=du,t.localeData=it,t.isDuration=ta,t.monthsShort=pi,t.weekdaysMin=ed,t.defineLocale=je,t.updateLocale=mt,t.locales=It,t.weekdaysShort=xp,t.normalizeUnits=we,t.relativeTimeRounding=zg,t.relativeTimeThreshold=bp,t.calendarFormat=A1,t.prototype=hr,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 ag(){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 jI({prefix:e="cli"}){return ia.default.createElement(Qo.Text,{color:"grey"},"[",e,"]")}function ns(e,t="cli"){if(ag()){console.log(`\x1B[90m[${t}]\x1B[0m\x1B[31m[\u2718] \x1B[0m${e}`);return}let{unmount:r}=(0,Qo.render)(ia.default.createElement(Qo.Text,null,ia.default.createElement(jI,{prefix:t}),ia.default.createElement(Qo.Text,{color:"red"},"[\u2718] "),e));r()}function iE(e,t="cli"){if(ag()){console.log(`\x1B[90m[${t}]\x1B[0m\x1B[32m[\u2714] \x1B[0m${e}`);return}let{unmount:r}=(0,Qo.render)(ia.default.createElement(Qo.Text,null,ia.default.createElement(jI,{prefix:t}),ia.default.createElement(Qo.Text,{color:"green"},"[\u2714] "),e));r()}function is(e,t="cli"){if(ag()){console.log(`\x1B[90m[${t}]\x1B[0m \x1B[33mWARNING:\x1B[0m ${e}`);return}let{unmount:r}=(0,Qo.render)(ia.default.createElement(Qo.Text,null,ia.default.createElement(jI,{prefix:t}),ia.default.createElement(Qo.Text,{color:"orange"},"\u2757\uFE0F "),e));r()}function qte(e){if(ag()){console.log(e);return}let{unmount:t}=(0,Qo.render)(ia.default.createElement(Qo.Text,{color:"cyan"},e));t()}function Wt(e,t="cli"){if(ag()){console.log(`\x1B[90m[${t}]\x1B[0m ${e}`);return}let{unmount:r}=(0,Qo.render)(ia.default.createElement(Qo.Text,null,ia.default.createElement(jI,{prefix:t})," ",e));r()}function bB({timestamp:e}){return ia.default.createElement(Qo.Box,{width:13},ia.default.createElement(Qo.Text,{color:"grey"},(0,pC.default)(e).format("HH:mm:ss.SSS")))}function Ute(e,t){if(ag()){console.log(`${(0,pC.default)(t).format("HH:mm:ss.SSS")} ${e}`);return}let{unmount:r}=(0,Qo.render)(ia.default.createElement(Qo.Box,null,ia.default.createElement(bB,{timestamp:t}),ia.default.createElement(Qo.Text,null,e)));r()}function $te(e,t){if(ag()){console.log(`${(0,pC.default)(t).format("HH:mm:ss.SSS")} [WARNING] ${e}`);return}let{unmount:r}=(0,Qo.render)(ia.default.createElement(Qo.Box,null,ia.default.createElement(bB,{timestamp:t}),ia.default.createElement(Qo.Text,{color:"white",backgroundColor:"yellow"},"[WARNING]"),ia.default.createElement(Qo.Text,null," ",e)));r()}function EB(e,t){if(ag()){console.log(`${(0,pC.default)(t).format("HH:mm:ss.SSS")} [ERROR] ${e}`);return}let{unmount:r}=(0,Qo.render)(ia.default.createElement(Qo.Box,null,ia.default.createElement(bB,{timestamp:t}),ia.default.createElement(Qo.Text,{color:"white",backgroundColor:"red"},"[ERROR]"),ia.default.createElement(Qo.Text,null," ",e)));r()}var Qo,ia,pC,iu=gt(()=>{Qo=zt(lC()),ia=zt(Ta()),pC=zt(jte())});var Hte,Vte=gt(()=>{Hte={name:"edgeone",version:"1.6.28-beta.12",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.1","@edgeone/opennextjs-pages":"0.2.10","@edgeone/pages-agent-toolkit":"0.1.0-beta.6","@edgeone/pages-blob":"^0.0.16",chokidar:"^4.0.1",esbuild:"^0.19.2","esbuild-plugin-polyfill-node":"^0.3.0","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.1","@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/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",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 B5e(){var e,t;return{run_id:M5e,cli_version:(t=(e=Hte)==null?void 0:e.version)!=null?t:"unknown",node_version:process.version,os_platform:TB.default.platform(),os_arch:TB.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 j5e(e,t){try{if(typeof process.send!="function")return;process.send(JSON.stringify({name:e,value:JSON.stringify(t)}))}catch{}}function Tc(e){var r;let t={...B5e(),...e};j5e((r=t.event_name)!=null?r:"unknown",t)}function ih(e){if(e==null)return{message:"unknown error",stack:""};if(typeof e=="string")return{message:qI(e,wB),stack:""};if(typeof e=="object"){let t=e,r=qI(typeof t.message=="string"?t.message:String(t),wB),s=qI(typeof t.stack=="string"?t.stack:"",q5e);return{message:r,stack:s}}return{message:qI(String(e),wB),stack:""}}function qI(e,t){return e.length>t?e.slice(0,t)+"\u2026[truncated]":e}var TB,Ec,wc,M5e,zte,wB,q5e,ug=gt(()=>{TB=zt(require("os"));Vte();Ec={COMMAND:"command",REQUEST:"request",LOCAL_FLOW:"local_flow",EXIT:"exit"},wc={SUCCESS:"success",FAIL:"fail",START:"start"},M5e=`cli-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;zte=(e,t)=>{let r=ih(t);Tc({event_name:"error",event_scope:Ec.COMMAND,event_result:wc.FAIL,error_message:`${e} ${r.message}`.trim(),error_stack:r.stack})},wB=500,q5e=2e3});var fC,sE,PB=gt(()=>{fC={NEXTJS:"nextjs",NUXTJS:"nuxtjs",ASTRO:"astro",UNKNOWN:"unknown"},sE={FRAMEWORK_DETECT:"framework_detect",PLUGIN_RESOLVE:"plugin_resolve",PLUGIN_LOAD:"plugin_load",PLUGIN_HOOK:"plugin_hook",CONFIG_LOAD:"config_load"}});function V5e(e){if((e==null?void 0:e.code)===$5e)return!0;let t=typeof e=="string"?e:e==null?void 0:e.message;return t==null?void 0:t.includes(U5e)}async function vx(e=!1){try{let t=await Yk(e);return Tc({event_name:"Config:Load:Success",event_scope:Ec.LOCAL_FLOW,event_phase:sE.CONFIG_LOAD,event_result:wc.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=ih(t);if(Tc({event_name:"Config:Load:Fail",event_scope:Ec.LOCAL_FLOW,event_phase:sE.CONFIG_LOAD,event_result:wc.FAIL,error_message:r.message}),V5e(t))throw t;return(0,Pf.showError)()&&console.error("%c [ error ]-80","font-size:13px; background:pink; color:#bf2c9f;",t),null}}var U5e,$5e,CB=gt(()=>{jb();Bk();ug();PB();U5e="[BLOCKING_CONFIG_ERROR]",$5e="BLOCKING_CONFIG_ERROR"});var UI,Mp,$I=gt(()=>{UI=[{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"}],Mp=["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"]});async function H5e(e){let t;VI.default.statSync(e).isFile()?t=oE.default.resolve(oE.default.dirname(e)):t=e;let r=oE.default.parse(t).root;if(t===r)return null;for(;t!==r;){let s=oE.default.join(t,"package.json");try{return await VI.default.promises.access(s),s}catch{if(t=oE.default.dirname(t),t===r)break}}return null}async function aE(e){if(e.endsWith(".mjs"))return"esm";if(e.endsWith(".cjs"))return"commonjs";try{let t=await H5e(e);if(t&&JSON.parse(await VI.default.promises.readFile(t,"utf-8")).type==="module")return"esm"}catch(t){console.warn("Failed to read package.json:",t)}return"commonjs"}var VI,oE,dC=gt(()=>{VI=zt(require("fs")),oE=zt(require("path"))});function W5e(e){let t=AB.default.extname(e);return z5e[t]||"ts"}function Y5e(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!K5e.has(a)||s===a?"":`const ${a} = ${s};`}).filter(Boolean).join(`
|
|
168
168
|
`)}async function Kte(e,t,r,s){let a=`mod_${G5e++}`,l=(await Gte.default.build({stdin:{contents:e,loader:W5e(r),resolveDir:AB.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=[];l=l.replace(/^import\s+[^'"]*['"][^'"]*['"]\s*;?\n/gm,w=>(p.push(w),"")),l=l.replace(/export (async )?function/g,"$1function"),l=l.replace(/export const/g,"const"),l=l.replace(/export let/g,"let"),l=l.replace(/export var/g,"var"),l=l.replace(/export default/g,""),l=l.replace(/export\s*\{([^}]+)\};?/g,(w,C)=>Y5e(C)),l=l.replace(/export class/g,"class");let m=/const\s+app\s*=/.test(l),g=`${p.join(`
|
|
169
169
|
`)}`;return{code:s!=null&&s.isFramework?`
|
|
170
170
|
const ${a} = (() => {
|
|
@@ -7362,7 +7362,7 @@ function useLocalAgentMemoryStore() {
|
|
|
7362
7362
|
}
|
|
7363
7363
|
|
|
7364
7364
|
function usePagesBlobTestStsEnvForDev() {
|
|
7365
|
-
process.env.PAGES_BLOB_STS_ENV = ${JSON.stringify("
|
|
7365
|
+
process.env.PAGES_BLOB_STS_ENV = ${JSON.stringify("test")};
|
|
7366
7366
|
}
|
|
7367
7367
|
|
|
7368
7368
|
function getAgentMemoryProjectId() {
|
|
@@ -9008,7 +9008,7 @@ function useLocalInMemoryStore() {
|
|
|
9008
9008
|
return process.env.EDGEONE_AGENT_LOCAL_IN_MEMORY_STORE === '1';
|
|
9009
9009
|
}
|
|
9010
9010
|
function usePagesBlobTestStsEnvForDev() {
|
|
9011
|
-
process.env.PAGES_BLOB_STS_ENV = ${JSON.stringify("
|
|
9011
|
+
process.env.PAGES_BLOB_STS_ENV = ${JSON.stringify("test")};
|
|
9012
9012
|
}
|
|
9013
9013
|
function toAgentStoreName(routePath) {
|
|
9014
9014
|
const normalized = String(routePath || '').replace(/^\\/+|\\/+$/g, '');
|
|
@@ -114284,7 +114284,7 @@ async function setup(options = {}) {
|
|
|
114284
114284
|
export {
|
|
114285
114285
|
setup
|
|
114286
114286
|
};
|
|
114287
|
-
`),$a.default.writeFileSync(H3t,cSe(v),"utf-8"),await yLt(B,this.mode,U,q),this.mode==="prod"&&iz(kd,kSe),await this.processIncludedFilesConfig();let le=eF(process.cwd(),kd,"[agent-node]");return le>0&&Wt(`[agent-node] Copied ${le} Claude skill/command file(s)`),await rF.default.build({stdin:{contents:wLt(),loader:"ts",resolveDir:process.cwd()},bundle:!0,format:"cjs",platform:"node",target:"node14",outfile:W3t,minify:!1,logLevel:"silent"}),this.routes=s.routes.map(ne=>({src:KR(ne.routePath),method:ne.methods})),$a.default.writeFileSync(G3t,JSON.stringify({routes:this.routes},null,2),"utf-8"),Wt(`[agent-node] Build completed (${this.mode}) with ${this.routes.length} route(s)`),{logicText:"",bundleText:"",cssText:"",routes:this.routes}}async build(t={port:9e3}){this.wrapPort=t.port,this.agentsDir=Lf().absolutePath,await this.processExternalModulesConfig();let r=Lw(this.agentsDir),s=Mw(r.recordsByUnit);return this.routeRecordsByUnit=r.recordsByUnit,this.buildWithRouteEntries(s.routeEntries,[...r.warnings,...s.warnings])}}});function _z(e,t=5e3){let r=Date.now();return new Promise(s=>{let a=()=>{let n=qSe.default.createServer(),l=!1,p=m=>{if(!l){if(l=!0,n.removeAllListeners(),m){n.close(()=>s());return}if(Date.now()-r>t){console.warn(`[dev] Port ${e} still in use after ${t}ms, proceeding anyway`),s();return}setTimeout(a,100)}};n.once("error",()=>p(!1)),n.once("listening",()=>p(!0)),n.listen(e,"127.0.0.1")};a()})}var qSe,USe=gt(()=>{qSe=zt(require("net"))});var Sz,$Se,jw,bz=gt(()=>{Sz=zt(require("path")),$Se=require("child_process");jSe();iu();bS();dC();USe();jw=class{devConfig;buildInstance;config;server;runtimePort;constructor(t){this.devConfig=t,this.runtimePort=Number(t.runtimePort||9e3),this.config={...t,watchPaths:cm(this)},this.buildInstance=new nF({mode:"dev",env:t.env,enableDevBlobTokenProjectStore:!0,devBlobAuth:t.agentDevBlobAuth})}async startEsmServer(t){let r=(0,$Se.spawn)("node",[t],{stdio:["pipe","inherit","inherit"],env:{...process.env,...this.devConfig.env,NODE_ENV:"development",PAGES_BLOB_STS_ENV:"production"},cwd:process.cwd()});return await new Promise((s,a)=>{let n=!1,l=()=>{r.removeListener("spawn",p),r.removeListener("error",m),r.removeListener("exit",g)},p=()=>{setTimeout(()=>{n||(n=!0,l(),s())},200)},m=v=>{n||(n=!0,l(),a(v))},g=v=>{n||(n=!0,l(),a(new Error(`[dev] agent node dev server exited early with code ${v!=null?v:"unknown"}`)))};r.on("spawn",p),r.on("error",m),r.on("exit",g)}),r}async stopChildProcess(t){t.exitCode!==null||t.signalCode!==null||await new Promise(r=>{let s=!1,a=()=>{clearTimeout(p),t.removeListener("exit",l)},n=()=>{s||(s=!0,a(),r())},l=()=>n(),p=setTimeout(()=>{try{t.kill("SIGKILL")}catch{}setTimeout(n,300)},3e3);t.once("exit",l);try{t.kill("SIGTERM")||n()}catch{n()}})}async start(t={}){process.env.PAGES_BLOB_STS_ENV="production";let r=2,s=this.runtimePort||9e3,a=null;for(let n=0;n<r;n+=1)try{let l=await Og(s);l!==s&&Wt(`[dev] agent-node port occupied, fallback to: ${l}`);let m=!!(t.skipBuild&&this.buildInstance.wrapPort===l)?{routes:this.buildInstance.getRoutes()}:await this.buildInstance.build({port:l});if(!m.routes||m.routes.length===0)return this.runtimePort=l,{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"no-routes"};if(this.server&&await this.stop(),await aE(process.cwd())==="esm"){let v=Sz.default.join(process.cwd(),".edgeone/agent-node/index.mjs");this.server=await this.startEsmServer(v)}else{let v=Sz.default.join(process.cwd(),".edgeone/agent-node/launcher.js");delete require.cache[require.resolve(v)];let w=require(v);this.server=await w.startServer()}return this.runtimePort=this.buildInstance.wrapPort,{destUrl:`http://localhost:${this.buildInstance.wrapPort}`,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:m.routes,status:"started"}}catch(l){let p=l;a=p;let m=p.message||"";if(n===0&&(m.includes("EADDRINUSE")||m.includes("exited early"))){let v=(this.buildInstance.wrapPort||s)+1;Wt(`[dev] agent-node EADDRINUSE detected, retry from port: ${v}`),s=v;continue}break}return{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"startFailed",error:(a==null?void 0:a.message)||"Start failed"}}async stop(){let t=this.server,r=this.runtimePort||this.buildInstance.wrapPort;if(t){if(this.server=null,t.kill){await this.stopChildProcess(t),r&&await _z(r),Wt("[dev] agent node dev server stopped");return}await new Promise((s,a)=>{t.close(n=>{if(n){a(n);return}s()})}),r&&await _z(r)}}async handleFileChange(t){try{let r=!1;if(this.buildInstance&&this.buildInstance.rebuildFunction&&t){Wt(`[dev] Agent incremental rebuilding for: ${t}`);try{await this.buildInstance.rebuildFunction(t)}catch(a){return ns(`[dev] rebuild failed, keep current: ${a.message}`),{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"rebuildFailed",error:a.message}}r=!0}await this.stop();let s=await this.start({skipBuild:r});return s.status==="startFailed"?(ns(`[dev] Agent rebuild failed after restart: ${s.error}`),{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"rebuildFailed",error:s.error}):{destUrl:s.destUrl,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:s.routes,status:"rebuilt"}}catch(r){return ns("[dev] Agent rebuild failed:",r.message),{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"rebuildFailed",error:r.message}}}}});function ALt(){let e=[Rg.default.resolve(__dirname,"../../agent/observability/python/registry.json"),Rg.default.resolve(__dirname,"pages/observability-python/registry.json"),Rg.default.resolve(__dirname,"..","..","pages/observability-python/registry.json")],t;for(let r of e)try{return t=JSON.parse(Ng.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 zSe(e){if(!Ng.default.existsSync(e))return{entries:[],requiredPipPackages:[],otelCorePipPackages:[],activeEntryNames:[]};let t=new Set;if(YSe(e,a=>{for(let n of HSe)for(let l of n.compiledPatterns)if(l.test(a)){t.add(n.name);break}}),t.size===0)return{entries:[],requiredPipPackages:[],otelCorePipPackages:[...VSe],activeEntryNames:[]};let r=[],s=new Set;for(let a of HSe){if(!t.has(a.name))continue;let n=DLt[a.name];if(!(n!=null&&n.some(l=>t.has(l)))){r.push(a.name);for(let l of a.pipPackages)s.add(l)}}return{entries:r,requiredPipPackages:[...s],otelCorePipPackages:[...VSe],activeEntryNames:r}}function WSe(e){return[`os.environ.setdefault('AGENT_OBSERVABILITY_ENTRIES', '${JSON.stringify(e).replace(/'/g,"\\'")}')`,""]}function GSe(e){let t=kLt();Ng.default.existsSync(t)&&KSe(t,e,{exclude:["tests","pytest.ini","__pycache__",".venv","venv",".pytest_cache","pyproject.toml","uv.lock"]})}function kLt(){let e=[Rg.default.resolve(__dirname,"pages/observability-python"),Rg.default.resolve(__dirname,"..","..","pages/observability-python"),Rg.default.resolve(__dirname,"..","..","agent/observability/python")];for(let t of e)if(Ng.default.existsSync(t))return t;return Rg.default.resolve(__dirname,"../../agent/observability/python")}function KSe(e,t,r={}){var s;if(Ng.default.mkdirSync(t,{recursive:!0}),!!Ng.default.existsSync(e))for(let a of Ng.default.readdirSync(e,{withFileTypes:!0})){if((s=r.exclude)!=null&&s.includes(a.name)||a.name==="__pycache__")continue;let n=Rg.default.join(e,a.name),l=Rg.default.join(t,a.name);a.isDirectory()?KSe(n,l,r):Ng.default.copyFileSync(n,l)}}function YSe(e,t){let r;try{r=Ng.default.readdirSync(e,{withFileTypes:!0})}catch{return}for(let s of r){if(s.name==="__pycache__"||s.name.startsWith("."))continue;let a=Rg.default.join(e,s.name);s.isDirectory()?YSe(a,t):s.name.endsWith(".py")&&t(Ng.default.readFileSync(a,"utf-8"))}}var Ng,Rg,VSe,HSe,DLt,JSe=gt(()=>{Ng=zt(require("fs")),Rg=zt(require("path")),VSe=["opentelemetry-api>=1.28","opentelemetry-sdk>=1.28","opentelemetry-exporter-otlp-proto-http>=1.28","opentelemetry-semantic-conventions>=0.49b0"];HSe=ALt(),DLt={openai:["openai-agents"]}});var fbe={};GT(fbe,{AgentPythonBuilder:()=>BD,SERVER_IMAGE_BASE_PACKAGES:()=>Tz,SERVER_IMAGE_E2B_PACKAGE_VERSIONS:()=>rbe,SERVER_IMAGE_EXTENDED_PACKAGES:()=>nbe,buildAgentToolkitRequirement:()=>tbe,buildPagesBlobPythonRequirement:()=>oF,extractPkgName:()=>ibe,getAgentToolkitWheelInfo:()=>ebe,getPagesBlobWheelInfo:()=>sF,getServerImageBundledPackages:()=>Az,mergeRequirements:()=>lbe,normalizePkgName:()=>qw,parseUserRequirements:()=>sbe});function sF(e){let t=e!=null?e:[Kn.default.resolve(__dirname,"libs-pages-blob-python"),Kn.default.resolve(__dirname,"..","..","libs-pages-blob-python"),Kn.default.resolve(__dirname,"..","..","..","..","libs-pages-blob-python")];for(let r of t){if(!Dn.default.existsSync(r))continue;let s=Dn.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 oF(e,t="pages-blob-python==0.12.0"){let r=sF(e);if(!r)return t;let a=Kn.default.join(r.dir,r.file).replace(/\\/g,"/").replace(/^([A-Za-z]:)/,"/$1");return`pages-blob-python @ file://${a.startsWith("/")?"":"/"}${a}`}function ebe(e){let t=e!=null?e:[Kn.default.resolve(__dirname,"libs-pages-agent-toolkit"),Kn.default.resolve(__dirname,"..","..","libs-pages-agent-toolkit"),Kn.default.resolve(__dirname,"..","..","..","..","libs-pages-agent-toolkit")];for(let r of t){if(!Dn.default.existsSync(r))continue;let s=Dn.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 tbe(e,t="pages-agent-toolkit==0.1.44"){let r=ebe(e);if(!r)return t;let a=Kn.default.join(r.dir,r.file).replace(/\\/g,"/").replace(/^([A-Za-z]:)/,"/$1");return`pages-agent-toolkit @ file://${a.startsWith("/")?"":"/"}${a}`}function LLt(e=process.env){let t=(e.EDGEONE_AGENT_PYTHON_AGGRESSIVE_EXCLUDE||"").trim().toLowerCase();return t==="1"||t==="true"||t==="yes"}function Az(e=process.env){return(e.EDGEONE_ASSUME_SERVER_IMAGE||"").trim().toLowerCase()==="v1"?[...Tz]:[...Tz,...nbe]}function BLt(){let e=Kn.default.resolve(__dirname,"pages/templates/agent-python");return Dn.default.existsSync(e)?e:Kn.default.resolve(__dirname,"../templates/agent-python")}function ibe(e){let t=e.trim();if(!t)return"";let r=t.match(/^[A-Za-z0-9_.-]+/);return r?r[0]:""}function qw(e){return e.toLowerCase().replace(/[._]+/g,"-")}function sbe(e){if(!e||!Dn.default.existsSync(e))return[];let t=Dn.default.readFileSync(e,"utf-8"),r=[];for(let s of t.split(`
|
|
114287
|
+
`),$a.default.writeFileSync(H3t,cSe(v),"utf-8"),await yLt(B,this.mode,U,q),this.mode==="prod"&&iz(kd,kSe),await this.processIncludedFilesConfig();let le=eF(process.cwd(),kd,"[agent-node]");return le>0&&Wt(`[agent-node] Copied ${le} Claude skill/command file(s)`),await rF.default.build({stdin:{contents:wLt(),loader:"ts",resolveDir:process.cwd()},bundle:!0,format:"cjs",platform:"node",target:"node14",outfile:W3t,minify:!1,logLevel:"silent"}),this.routes=s.routes.map(ne=>({src:KR(ne.routePath),method:ne.methods})),$a.default.writeFileSync(G3t,JSON.stringify({routes:this.routes},null,2),"utf-8"),Wt(`[agent-node] Build completed (${this.mode}) with ${this.routes.length} route(s)`),{logicText:"",bundleText:"",cssText:"",routes:this.routes}}async build(t={port:9e3}){this.wrapPort=t.port,this.agentsDir=Lf().absolutePath,await this.processExternalModulesConfig();let r=Lw(this.agentsDir),s=Mw(r.recordsByUnit);return this.routeRecordsByUnit=r.recordsByUnit,this.buildWithRouteEntries(s.routeEntries,[...r.warnings,...s.warnings])}}});function _z(e,t=5e3){let r=Date.now();return new Promise(s=>{let a=()=>{let n=qSe.default.createServer(),l=!1,p=m=>{if(!l){if(l=!0,n.removeAllListeners(),m){n.close(()=>s());return}if(Date.now()-r>t){console.warn(`[dev] Port ${e} still in use after ${t}ms, proceeding anyway`),s();return}setTimeout(a,100)}};n.once("error",()=>p(!1)),n.once("listening",()=>p(!0)),n.listen(e,"127.0.0.1")};a()})}var qSe,USe=gt(()=>{qSe=zt(require("net"))});var Sz,$Se,jw,bz=gt(()=>{Sz=zt(require("path")),$Se=require("child_process");jSe();iu();bS();dC();USe();jw=class{devConfig;buildInstance;config;server;runtimePort;constructor(t){this.devConfig=t,this.runtimePort=Number(t.runtimePort||9e3),this.config={...t,watchPaths:cm(this)},this.buildInstance=new nF({mode:"dev",env:t.env,enableDevBlobTokenProjectStore:!0,devBlobAuth:t.agentDevBlobAuth})}async startEsmServer(t){let r=(0,$Se.spawn)("node",[t],{stdio:["pipe","inherit","inherit"],env:{...process.env,...this.devConfig.env,NODE_ENV:"development",PAGES_BLOB_STS_ENV:"test"},cwd:process.cwd()});return await new Promise((s,a)=>{let n=!1,l=()=>{r.removeListener("spawn",p),r.removeListener("error",m),r.removeListener("exit",g)},p=()=>{setTimeout(()=>{n||(n=!0,l(),s())},200)},m=v=>{n||(n=!0,l(),a(v))},g=v=>{n||(n=!0,l(),a(new Error(`[dev] agent node dev server exited early with code ${v!=null?v:"unknown"}`)))};r.on("spawn",p),r.on("error",m),r.on("exit",g)}),r}async stopChildProcess(t){t.exitCode!==null||t.signalCode!==null||await new Promise(r=>{let s=!1,a=()=>{clearTimeout(p),t.removeListener("exit",l)},n=()=>{s||(s=!0,a(),r())},l=()=>n(),p=setTimeout(()=>{try{t.kill("SIGKILL")}catch{}setTimeout(n,300)},3e3);t.once("exit",l);try{t.kill("SIGTERM")||n()}catch{n()}})}async start(t={}){process.env.PAGES_BLOB_STS_ENV="test";let r=2,s=this.runtimePort||9e3,a=null;for(let n=0;n<r;n+=1)try{let l=await Og(s);l!==s&&Wt(`[dev] agent-node port occupied, fallback to: ${l}`);let m=!!(t.skipBuild&&this.buildInstance.wrapPort===l)?{routes:this.buildInstance.getRoutes()}:await this.buildInstance.build({port:l});if(!m.routes||m.routes.length===0)return this.runtimePort=l,{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"no-routes"};if(this.server&&await this.stop(),await aE(process.cwd())==="esm"){let v=Sz.default.join(process.cwd(),".edgeone/agent-node/index.mjs");this.server=await this.startEsmServer(v)}else{let v=Sz.default.join(process.cwd(),".edgeone/agent-node/launcher.js");delete require.cache[require.resolve(v)];let w=require(v);this.server=await w.startServer()}return this.runtimePort=this.buildInstance.wrapPort,{destUrl:`http://localhost:${this.buildInstance.wrapPort}`,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:m.routes,status:"started"}}catch(l){let p=l;a=p;let m=p.message||"";if(n===0&&(m.includes("EADDRINUSE")||m.includes("exited early"))){let v=(this.buildInstance.wrapPort||s)+1;Wt(`[dev] agent-node EADDRINUSE detected, retry from port: ${v}`),s=v;continue}break}return{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"startFailed",error:(a==null?void 0:a.message)||"Start failed"}}async stop(){let t=this.server,r=this.runtimePort||this.buildInstance.wrapPort;if(t){if(this.server=null,t.kill){await this.stopChildProcess(t),r&&await _z(r),Wt("[dev] agent node dev server stopped");return}await new Promise((s,a)=>{t.close(n=>{if(n){a(n);return}s()})}),r&&await _z(r)}}async handleFileChange(t){try{let r=!1;if(this.buildInstance&&this.buildInstance.rebuildFunction&&t){Wt(`[dev] Agent incremental rebuilding for: ${t}`);try{await this.buildInstance.rebuildFunction(t)}catch(a){return ns(`[dev] rebuild failed, keep current: ${a.message}`),{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"rebuildFailed",error:a.message}}r=!0}await this.stop();let s=await this.start({skipBuild:r});return s.status==="startFailed"?(ns(`[dev] Agent rebuild failed after restart: ${s.error}`),{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"rebuildFailed",error:s.error}):{destUrl:s.destUrl,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:s.routes,status:"rebuilt"}}catch(r){return ns("[dev] Agent rebuild failed:",r.message),{destUrl:null,watch:this.config.watchPaths,type:"agent-node",config:this.config,routes:[],status:"rebuildFailed",error:r.message}}}}});function ALt(){let e=[Rg.default.resolve(__dirname,"../../agent/observability/python/registry.json"),Rg.default.resolve(__dirname,"pages/observability-python/registry.json"),Rg.default.resolve(__dirname,"..","..","pages/observability-python/registry.json")],t;for(let r of e)try{return t=JSON.parse(Ng.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 zSe(e){if(!Ng.default.existsSync(e))return{entries:[],requiredPipPackages:[],otelCorePipPackages:[],activeEntryNames:[]};let t=new Set;if(YSe(e,a=>{for(let n of HSe)for(let l of n.compiledPatterns)if(l.test(a)){t.add(n.name);break}}),t.size===0)return{entries:[],requiredPipPackages:[],otelCorePipPackages:[...VSe],activeEntryNames:[]};let r=[],s=new Set;for(let a of HSe){if(!t.has(a.name))continue;let n=DLt[a.name];if(!(n!=null&&n.some(l=>t.has(l)))){r.push(a.name);for(let l of a.pipPackages)s.add(l)}}return{entries:r,requiredPipPackages:[...s],otelCorePipPackages:[...VSe],activeEntryNames:r}}function WSe(e){return[`os.environ.setdefault('AGENT_OBSERVABILITY_ENTRIES', '${JSON.stringify(e).replace(/'/g,"\\'")}')`,""]}function GSe(e){let t=kLt();Ng.default.existsSync(t)&&KSe(t,e,{exclude:["tests","pytest.ini","__pycache__",".venv","venv",".pytest_cache","pyproject.toml","uv.lock"]})}function kLt(){let e=[Rg.default.resolve(__dirname,"pages/observability-python"),Rg.default.resolve(__dirname,"..","..","pages/observability-python"),Rg.default.resolve(__dirname,"..","..","agent/observability/python")];for(let t of e)if(Ng.default.existsSync(t))return t;return Rg.default.resolve(__dirname,"../../agent/observability/python")}function KSe(e,t,r={}){var s;if(Ng.default.mkdirSync(t,{recursive:!0}),!!Ng.default.existsSync(e))for(let a of Ng.default.readdirSync(e,{withFileTypes:!0})){if((s=r.exclude)!=null&&s.includes(a.name)||a.name==="__pycache__")continue;let n=Rg.default.join(e,a.name),l=Rg.default.join(t,a.name);a.isDirectory()?KSe(n,l,r):Ng.default.copyFileSync(n,l)}}function YSe(e,t){let r;try{r=Ng.default.readdirSync(e,{withFileTypes:!0})}catch{return}for(let s of r){if(s.name==="__pycache__"||s.name.startsWith("."))continue;let a=Rg.default.join(e,s.name);s.isDirectory()?YSe(a,t):s.name.endsWith(".py")&&t(Ng.default.readFileSync(a,"utf-8"))}}var Ng,Rg,VSe,HSe,DLt,JSe=gt(()=>{Ng=zt(require("fs")),Rg=zt(require("path")),VSe=["opentelemetry-api>=1.28","opentelemetry-sdk>=1.28","opentelemetry-exporter-otlp-proto-http>=1.28","opentelemetry-semantic-conventions>=0.49b0"];HSe=ALt(),DLt={openai:["openai-agents"]}});var fbe={};GT(fbe,{AgentPythonBuilder:()=>BD,SERVER_IMAGE_BASE_PACKAGES:()=>Tz,SERVER_IMAGE_E2B_PACKAGE_VERSIONS:()=>rbe,SERVER_IMAGE_EXTENDED_PACKAGES:()=>nbe,buildAgentToolkitRequirement:()=>tbe,buildPagesBlobPythonRequirement:()=>oF,extractPkgName:()=>ibe,getAgentToolkitWheelInfo:()=>ebe,getPagesBlobWheelInfo:()=>sF,getServerImageBundledPackages:()=>Az,mergeRequirements:()=>lbe,normalizePkgName:()=>qw,parseUserRequirements:()=>sbe});function sF(e){let t=e!=null?e:[Kn.default.resolve(__dirname,"libs-pages-blob-python"),Kn.default.resolve(__dirname,"..","..","libs-pages-blob-python"),Kn.default.resolve(__dirname,"..","..","..","..","libs-pages-blob-python")];for(let r of t){if(!Dn.default.existsSync(r))continue;let s=Dn.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 oF(e,t="pages-blob-python==0.12.0"){let r=sF(e);if(!r)return t;let a=Kn.default.join(r.dir,r.file).replace(/\\/g,"/").replace(/^([A-Za-z]:)/,"/$1");return`pages-blob-python @ file://${a.startsWith("/")?"":"/"}${a}`}function ebe(e){let t=e!=null?e:[Kn.default.resolve(__dirname,"libs-pages-agent-toolkit"),Kn.default.resolve(__dirname,"..","..","libs-pages-agent-toolkit"),Kn.default.resolve(__dirname,"..","..","..","..","libs-pages-agent-toolkit")];for(let r of t){if(!Dn.default.existsSync(r))continue;let s=Dn.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 tbe(e,t="pages-agent-toolkit==0.1.44"){let r=ebe(e);if(!r)return t;let a=Kn.default.join(r.dir,r.file).replace(/\\/g,"/").replace(/^([A-Za-z]:)/,"/$1");return`pages-agent-toolkit @ file://${a.startsWith("/")?"":"/"}${a}`}function LLt(e=process.env){let t=(e.EDGEONE_AGENT_PYTHON_AGGRESSIVE_EXCLUDE||"").trim().toLowerCase();return t==="1"||t==="true"||t==="yes"}function Az(e=process.env){return(e.EDGEONE_ASSUME_SERVER_IMAGE||"").trim().toLowerCase()==="v1"?[...Tz]:[...Tz,...nbe]}function BLt(){let e=Kn.default.resolve(__dirname,"pages/templates/agent-python");return Dn.default.existsSync(e)?e:Kn.default.resolve(__dirname,"../templates/agent-python")}function ibe(e){let t=e.trim();if(!t)return"";let r=t.match(/^[A-Za-z0-9_.-]+/);return r?r[0]:""}function qw(e){return e.toLowerCase().replace(/[._]+/g,"-")}function sbe(e){if(!e||!Dn.default.existsSync(e))return[];let t=Dn.default.readFileSync(e,"utf-8"),r=[];for(let s of t.split(`
|
|
114288
114288
|
`)){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")){Wt(`[agent-python] Skipping unsupported requirements directive: ${a}`);continue}r.push(a)}}return r}function jLt(e){if(!Dn.default.existsSync(e)){Dn.default.mkdirSync(e,{recursive:!0});return}QR(e,["lib","__pycache__",".blob-local"],"agent-python-generated")}function qLt(e,t,r=[]){let s=Kn.default.join(t,".deps-hash");if(!Dn.default.existsSync(s))return!1;try{let a=Dz(e),n=Dn.default.readFileSync(s,"utf-8").trim();if(a!==n)return!1}catch{return!1}return r.every(a=>Dn.default.existsSync(Kn.default.join(t,a)))}function Dz(e){return QSe.default.createHash("sha256").update(ULt).update(`
|
|
114289
114289
|
`).update(Dn.default.readFileSync(e,"utf-8")).digest("hex")}function $Lt(e,t){try{Dn.default.writeFileSync(Kn.default.join(t,".deps-hash"),Dz(e))}catch{}}function obe(e){if(!Dn.default.existsSync(e))return!1;let t=Dn.default.readdirSync(e,{withFileTypes:!0});for(let r of t){if(r.name.startsWith("_")||r.name==="__pycache__"||r.name==="skills")continue;let s=Kn.default.join(e,r.name);if(r.isDirectory()){if(obe(s))return!0}else if(r.name.endsWith(".py")&&r.name!=="__init__.py")return!0}return!1}function VLt(e,t){let r={};for(let s of e){let a=Kn.default.relative(Kn.default.resolve(t),s.filePath),l=[Cz,...a.replace(/\.py$/,"").split(Kn.default.sep).filter(Boolean)].join(".");r[s.routePath]={module:l,isIndex:s.isIndexRoute}}return r}function HLt(e){if(!Dn.default.existsSync(e))return new Set;let t=Dn.default.readdirSync(e,{withFileTypes:!0}),r=[];for(let s of t)s.name.startsWith(".")||s.name==="__pycache__"||s.name==="node_modules"||s.name==="venv"||(s.isDirectory()?r.push(s.name):s.isFile()&&s.name.endsWith(".py")&&s.name!=="__init__.py"&&r.push(s.name.slice(0,-3)));return new Set(r)}function zLt(e,t){return e.replace(/^(\s*(?:from|import)\s+)agents\.([\w.]+)/gm,(r,s,a)=>{let n=a.split(".")[0];return t.has(n)?`${s}${Cz}.${a}`:r})}function abe(e,t,r,s=!0){Dn.default.mkdirSync(t,{recursive:!0});let a=Dn.default.readdirSync(e,{withFileTypes:!0});for(let n of a){if(n.name==="__pycache__"||n.name===".git"||n.name==="node_modules"||n.name==="venv"||n.name===".venv")continue;let l=Kn.default.join(e,n.name),p=Kn.default.join(t,n.name);if(n.isDirectory())abe(l,p,r,!1);else if(n.name.endsWith(".py")){let m=Dn.default.readFileSync(l,"utf-8");Dn.default.writeFileSync(p,zLt(m,r),"utf-8")}else Dn.default.copyFileSync(l,p)}}function ube(e,t=!0){let r=Kn.default.join(e,"__init__.py");Dn.default.existsSync(r)||Dn.default.writeFileSync(r,"");let s=Dn.default.readdirSync(e,{withFileTypes:!0});for(let a of s)a.isDirectory()&&a.name!=="__pycache__"&&ube(Kn.default.join(e,a.name),!1)}function WLt(e){Dn.default.writeFileSync(Kn.default.join(e,"sitecustomize.py"),["import warnings",'warnings.filterwarnings("ignore", category=DeprecationWarning)'].join(`
|
|
114290
114290
|
`))}function cbe(e){let t=Kn.default.join(e,"requirements.txt");if(Dn.default.existsSync(t))return t;let r=dn("requirements.txt");return Dn.default.existsSync(r)?r:null}function GLt(e){let t={anthropic:"anthropic>=0.20.0",claude_agent_sdk:"claude-agent-sdk>=0.1.0",openai:"openai>=1.0.0",agents:"openai-agents>=0.0.17",langchain:"langchain>=0.1.0",langgraph:"langgraph>=0.0.1",crewai:"crewai>=0.1.0",fastapi:"fastapi>=0.100.0",flask:"flask>=2.0.0",requests:"requests>=2.28.0",httpx:"httpx>=0.24.0",pydantic:"pydantic>=2.0.0",dotenv:"python-dotenv>=1.0.0"},r=new Set;return kz(e,s=>{for(let[a,n]of Object.entries(t))new RegExp(`(?:^|\\n)\\s*(?:import\\s+${a}|from\\s+${a}\\b)`).test(s)&&r.add(n)}),Array.from(r)}function kz(e,t){if(Dn.default.existsSync(e))for(let r of Dn.default.readdirSync(e,{withFileTypes:!0})){if(r.name==="__pycache__"||r.name.startsWith(".")||r.name.startsWith("_"))continue;let s=Kn.default.join(e,r.name);r.isDirectory()?kz(s,t):r.name.endsWith(".py")&&t(Dn.default.readFileSync(s,"utf-8"))}}function lbe(e,t,r){let s=new Map,a=n=>{let l=qw(ibe(n));l&&s.set(l,n)};for(let n of t)a(n);for(let n of sbe(r))a(n);for(let n of e)a(n);return[...s.values()].sort()}async function ZSe(e,t,r,s){if(!r.length)return;let a=["pip","install",...r,"--target",t,"--python-version",lm,"--no-cache"];s&&a.splice(2,0,"--python",s);try{await t_(e,a,{...process.env,PYTHONWARNINGS:"ignore"})}catch(n){is(`[agent-python] Prebake install for [${r.join(", ")}] failed: ${n.message}`);return}for(let n of r){let l=Kn.default.join(t,n);Dn.default.existsSync(l)&&pbe(l)}Wt(`[agent-python] Prebaked pure-Python forms of: ${r.join(", ")}`)}function pbe(e){for(let t of Dn.default.readdirSync(e,{withFileTypes:!0})){let r=Kn.default.join(e,t.name);if(t.isDirectory()){pbe(r);continue}if(t.isFile()){let s=Kn.default.extname(t.name).toLowerCase();(s===".so"||s===".pyd")&&Dn.default.rmSync(r,{force:!0})}}}function KLt(){let e=Lf().absolutePath;if(!Dn.default.existsSync(e))return!1;let t=cbe(e);if(t)try{let s=Dn.default.readFileSync(t,"utf-8");if(/^\s*lancedb\b/mi.test(s))return!0}catch{}let r=!1;return kz(e,s=>{if(!r){if(/(?:^|\n)\s*(?:import\s+lancedb|from\s+lancedb\b)/.test(s)){r=!0;return}/memory\s*=\s*True/.test(s)&&(r=!0)}}),r}function YLt(e){let t=Az(),r=[...wz],s=(process.env.EDGEONE_KEEP_LANCEDB||"").trim().toLowerCase();(s==="1"||s==="true"||s==="yes"||KLt())&&(r=r.filter(g=>!["lancedb","lance-namespace","lance-namespace-urllib3-client"].includes(g)),Wt("[agent-python] Detected lancedb usage \u2014 keeping lancedb in lib/ (~130MB)."));let n=new Set([...t.map(qw),...r.map(qw)]);if(!Dn.default.existsSync(e))return;let l=0,p=0;for(let g of Dn.default.readdirSync(e,{withFileTypes:!0})){let v=g.name;if(v.endsWith(".dist-info")){let w=v.indexOf("-");if(w>0){let C=qw(v.substring(0,w));if(n.has(C)){let O=Kn.default.join(e,v),x=iF(O);w1(O,"agent-python-prod-purge"),l++,p+=x;continue}}}if(g.isDirectory()){let w=qw(v);if(n.has(w)){let C=Kn.default.join(e,v),O=iF(C);w1(C,"agent-python-prod-purge"),l++,p+=O}}}let m=Kn.default.join(e,"bin");if(Dn.default.existsSync(m)){let g=iF(m);w1(m,"agent-python-prod-purge"),p+=g,Wt(`[agent-python] Removed bin/ directory (~${(g/1024/1024).toFixed(1)}MB) \u2014 console_scripts not needed on server.`)}if(l>0){let g=(p/1024/1024).toFixed(1);Wt(`[agent-python] Purged ${l} server-image packages from lib/ (freed ~${g}MB)`)}}function iF(e){let t=0;try{for(let r of Dn.default.readdirSync(e,{withFileTypes:!0})){let s=Kn.default.join(e,r.name);if(r.isDirectory())t+=iF(s);else try{t+=Dn.default.statSync(s).size}catch{}}}catch{}return t}function JLt(e){let t=Kn.default.join(Pz.default.tmpdir(),`agent-python-excludes-${Date.now()}.txt`);return Dn.default.writeFileSync(t,e.join(`
|
|
@@ -116278,7 +116278,7 @@ except ImportError:
|
|
|
116278
116278
|
__all__ = ['agent']
|
|
116279
116279
|
`,r=Ni.default.join(dn(ya.OUTPUT_DIR),"edgeone_functions.py");vn.default.writeFileSync(r,t)}generateScfBootstrap(){let t=`#!/bin/bash
|
|
116280
116280
|
/var/lang/python310/bin/python3 -W ignore -u app.py
|
|
116281
|
-
`,r=dn(Ni.default.join(ya.OUTPUT_DIR,"scf_bootstrap"));vn.default.writeFileSync(r,t,{mode:493})}copyMemoryModule(){if(!this.hasAgentStore)return;let t=dn(ya.OUTPUT_DIR),r=[Ni.default.resolve(__dirname,"pages","templates","agent-python","memory.py"),Ni.default.resolve(__dirname,"..","templates","agent-python","memory.py"),Ni.default.resolve(__dirname,"..","templates","agent-python","memory.py"),Ni.default.resolve(__dirname,"..","..","builder","templates","agent-python","memory.py")];for(let s of r)if(vn.default.existsSync(s)){vn.default.copyFileSync(s,Ni.default.join(t,"_memory.py"));return}this.warn("memory.py not found, context.agent.store will have limited functionality")}async packageToZip(){let{execSync:t}=require("child_process"),r=dn(ya.OUTPUT_DIR),s=dn(Ni.default.join(ya.CLOUD_FUNCTIONS_DIR,"python.zip"));vn.default.existsSync(s)&&vn.default.unlinkSync(s);try{t(`cd "${r}" && zip -rq "${s}" .`,{stdio:this.silent?"pipe":"inherit"});let n=(vn.default.statSync(s).size/1024/1024).toFixed(1);this.log(`Packaged to python.zip (${n}MB)`)}catch(a){throw this.error(`Failed to create zip package: ${a.message}`),a}}async build(t={}){t.port&&(this.wrapPort=t.port);let r=dn(ya.OUTPUT_DIR);this.prepareOutputDirectory(r);let s=dn(ya.FUNCTION);if(this.functionList=this.scanPythonFiles(s),this.functionList.length===0)return this.log("No Python functions found"),{routes:[],watch:[]};this.log(`Found ${this.functionList.length} Python functions`),this.copyUserFiles(),this.hasAgentStore=this.detectAgentsDirectory(),this.hasAgentStore&&this.log("Detected agents directory \u2014 context.agent.store will be injected"),this.generateAppPy(),this.generateSiteCustomize(),this.generateEdgeoneFunctionsModule(),this.copyMemoryModule(),this.generateMetaJson(),this.generateRequirements(),await this.installDependencies();let n=[...this.functionList].sort((l,p)=>{if(!l.isDynamic&&p.isDynamic)return-1;if(l.isDynamic&&!p.isDynamic)return 1;let m=l.route.includes(":")&&l.route.includes("*"),g=p.route.includes(":")&&p.route.includes("*");return!m&&g?-1:m&&!g?1:p.route.length-l.route.length}).map(l=>{let p=l.route.includes(":")&&l.route.includes("*"),m={src:l.isDynamic?this.routeToRegex(l.route):`^${l.route}(?:/.*)?$`,path:l.route,file:l.filePath};return l.isDynamic&&l.paramNames.length>0&&(m.params=l.paramNames),p&&(m.isCatchAll=!0),m.method=l.methods,m.isFramework=l.isFramework,m});return Wt(`\u2728 Python functions build completed: ${this.functionList.length} functions`),{routes:n,watch:[dn(ya.FUNCTION)]}}getRoutes(){return[...this.functionList].sort((r,s)=>{if(!r.isDynamic&&s.isDynamic)return-1;if(r.isDynamic&&!s.isDynamic)return 1;let a=r.route.includes(":")&&r.route.includes("*"),n=s.route.includes(":")&&s.route.includes("*");return!a&&n?-1:a&&!n?1:s.route.length-r.route.length}).map(r=>{let s=r.route.includes(":")&&r.route.includes("*"),a={src:r.isDynamic?this.routeToRegex(r.route):`^${r.route}(?:/.*)?$`,path:r.route,file:r.filePath};return r.isDynamic&&r.paramNames.length>0&&(a.params=r.paramNames),s&&(a.isCatchAll=!0),a.method=r.methods,a.isFramework=r.isFramework,a})}}});var cF,ybe,Uw,Iz=gt(()=>{gbe();iu();cF=zt(require("path")),ybe=require("child_process");bS();Uw=class{devConfig;buildInstance;config;server=null;isStarting=!1;constructor(t){this.devConfig=t,this.config={...t,watchPaths:cm(this)},this.buildInstance=new uF({mode:"dev",env:t.env})}async start(t={}){if(this.isStarting)return console.log("[dev] Python function server is already starting, skipping..."),{destUrl:this.server?`http://127.0.0.1:${this.buildInstance.wrapPort}`:null,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:[],status:"starting"};if(this.server&&!this.server.killed)return console.log("[dev] Python function server is already running, skipping..."),{destUrl:`http://127.0.0.1:${this.buildInstance.wrapPort}`,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:this.buildInstance.getRoutes().map(s=>{var a;return{src:s.src,routePath:s.path,method:s.method||["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"],isFramework:(a=s.isFramework)!=null?a:!s.isCatchAll}}),status:"running"};this.isStarting=!0;let r=await Og(9100);try{let s;if(t.skipBuild?s={routes:this.buildInstance.getRoutes()}:s=await this.buildInstance.build({port:r}),s.routes.length===0)return{destUrl:null,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:[],status:"no-routes"};this.server&&await this.stop();let a=cF.default.join(process.cwd(),".edgeone/cloud-functions/api-python/app.py"),n=this.detectPythonCommand(),l=(0,ybe.spawn)(n,[a],{stdio:["pipe","inherit","inherit"],env:{...process.env,...this.devConfig.env,PYTHONPATH:cF.default.join(process.cwd(),".edgeone/cloud-functions/api-python"),PORT:String(r),...this.devConfig.agentDevBlobAuth?{PAGES_BLOB_DEPLOY_CREDENTIAL:this.devConfig.agentDevBlobAuth.token,PAGES_PROJECT_ID:this.devConfig.agentDevBlobAuth.projectId}:{},PAGES_BLOB_STS_ENV:"
|
|
116281
|
+
`,r=dn(Ni.default.join(ya.OUTPUT_DIR,"scf_bootstrap"));vn.default.writeFileSync(r,t,{mode:493})}copyMemoryModule(){if(!this.hasAgentStore)return;let t=dn(ya.OUTPUT_DIR),r=[Ni.default.resolve(__dirname,"pages","templates","agent-python","memory.py"),Ni.default.resolve(__dirname,"..","templates","agent-python","memory.py"),Ni.default.resolve(__dirname,"..","templates","agent-python","memory.py"),Ni.default.resolve(__dirname,"..","..","builder","templates","agent-python","memory.py")];for(let s of r)if(vn.default.existsSync(s)){vn.default.copyFileSync(s,Ni.default.join(t,"_memory.py"));return}this.warn("memory.py not found, context.agent.store will have limited functionality")}async packageToZip(){let{execSync:t}=require("child_process"),r=dn(ya.OUTPUT_DIR),s=dn(Ni.default.join(ya.CLOUD_FUNCTIONS_DIR,"python.zip"));vn.default.existsSync(s)&&vn.default.unlinkSync(s);try{t(`cd "${r}" && zip -rq "${s}" .`,{stdio:this.silent?"pipe":"inherit"});let n=(vn.default.statSync(s).size/1024/1024).toFixed(1);this.log(`Packaged to python.zip (${n}MB)`)}catch(a){throw this.error(`Failed to create zip package: ${a.message}`),a}}async build(t={}){t.port&&(this.wrapPort=t.port);let r=dn(ya.OUTPUT_DIR);this.prepareOutputDirectory(r);let s=dn(ya.FUNCTION);if(this.functionList=this.scanPythonFiles(s),this.functionList.length===0)return this.log("No Python functions found"),{routes:[],watch:[]};this.log(`Found ${this.functionList.length} Python functions`),this.copyUserFiles(),this.hasAgentStore=this.detectAgentsDirectory(),this.hasAgentStore&&this.log("Detected agents directory \u2014 context.agent.store will be injected"),this.generateAppPy(),this.generateSiteCustomize(),this.generateEdgeoneFunctionsModule(),this.copyMemoryModule(),this.generateMetaJson(),this.generateRequirements(),await this.installDependencies();let n=[...this.functionList].sort((l,p)=>{if(!l.isDynamic&&p.isDynamic)return-1;if(l.isDynamic&&!p.isDynamic)return 1;let m=l.route.includes(":")&&l.route.includes("*"),g=p.route.includes(":")&&p.route.includes("*");return!m&&g?-1:m&&!g?1:p.route.length-l.route.length}).map(l=>{let p=l.route.includes(":")&&l.route.includes("*"),m={src:l.isDynamic?this.routeToRegex(l.route):`^${l.route}(?:/.*)?$`,path:l.route,file:l.filePath};return l.isDynamic&&l.paramNames.length>0&&(m.params=l.paramNames),p&&(m.isCatchAll=!0),m.method=l.methods,m.isFramework=l.isFramework,m});return Wt(`\u2728 Python functions build completed: ${this.functionList.length} functions`),{routes:n,watch:[dn(ya.FUNCTION)]}}getRoutes(){return[...this.functionList].sort((r,s)=>{if(!r.isDynamic&&s.isDynamic)return-1;if(r.isDynamic&&!s.isDynamic)return 1;let a=r.route.includes(":")&&r.route.includes("*"),n=s.route.includes(":")&&s.route.includes("*");return!a&&n?-1:a&&!n?1:s.route.length-r.route.length}).map(r=>{let s=r.route.includes(":")&&r.route.includes("*"),a={src:r.isDynamic?this.routeToRegex(r.route):`^${r.route}(?:/.*)?$`,path:r.route,file:r.filePath};return r.isDynamic&&r.paramNames.length>0&&(a.params=r.paramNames),s&&(a.isCatchAll=!0),a.method=r.methods,a.isFramework=r.isFramework,a})}}});var cF,ybe,Uw,Iz=gt(()=>{gbe();iu();cF=zt(require("path")),ybe=require("child_process");bS();Uw=class{devConfig;buildInstance;config;server=null;isStarting=!1;constructor(t){this.devConfig=t,this.config={...t,watchPaths:cm(this)},this.buildInstance=new uF({mode:"dev",env:t.env})}async start(t={}){if(this.isStarting)return console.log("[dev] Python function server is already starting, skipping..."),{destUrl:this.server?`http://127.0.0.1:${this.buildInstance.wrapPort}`:null,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:[],status:"starting"};if(this.server&&!this.server.killed)return console.log("[dev] Python function server is already running, skipping..."),{destUrl:`http://127.0.0.1:${this.buildInstance.wrapPort}`,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:this.buildInstance.getRoutes().map(s=>{var a;return{src:s.src,routePath:s.path,method:s.method||["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"],isFramework:(a=s.isFramework)!=null?a:!s.isCatchAll}}),status:"running"};this.isStarting=!0;let r=await Og(9100);try{let s;if(t.skipBuild?s={routes:this.buildInstance.getRoutes()}:s=await this.buildInstance.build({port:r}),s.routes.length===0)return{destUrl:null,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:[],status:"no-routes"};this.server&&await this.stop();let a=cF.default.join(process.cwd(),".edgeone/cloud-functions/api-python/app.py"),n=this.detectPythonCommand(),l=(0,ybe.spawn)(n,[a],{stdio:["pipe","inherit","inherit"],env:{...process.env,...this.devConfig.env,PYTHONPATH:cF.default.join(process.cwd(),".edgeone/cloud-functions/api-python"),PORT:String(r),...this.devConfig.agentDevBlobAuth?{PAGES_BLOB_DEPLOY_CREDENTIAL:this.devConfig.agentDevBlobAuth.token,PAGES_PROJECT_ID:this.devConfig.agentDevBlobAuth.projectId}:{},PAGES_BLOB_STS_ENV:"test"},cwd:cF.default.join(process.cwd(),".edgeone/cloud-functions/api-python")});await new Promise((m,g)=>{l.on("spawn",()=>{m(void 0)}),l.on("error",v=>{ns("Failed to start Python dev server:",v.message),g(v)})}),this.server=l,this.isStarting=!1;let p=s.routes.map(m=>{var g;return{src:m.src,routePath:m.path,method:m.method||["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"],isFramework:(g=m.isFramework)!=null?g:!m.isCatchAll}});return{destUrl:`http://127.0.0.1:${r}`,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:p,status:"started"}}catch(s){return this.isStarting=!1,{destUrl:null,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:[],status:"startFailed",error:s.message}}}async stop(){if(this.server){let t=this.server;return this.server=null,new Promise(r=>{let s=setTimeout(()=>{console.log("[dev] Python server kill timeout, force killing...");try{t.kill("SIGKILL")}catch{}r()},3e3);t.once("exit",()=>{clearTimeout(s),console.log("[dev] Python function dev server stopped"),r()});try{t.kill("SIGTERM")}catch{clearTimeout(s),r()}})}}async handleFileChange(t){try{Wt(`[dev] Python function file changed: ${t}`),this.isStarting=!1,await this.stop();let r=await this.start({skipBuild:!1});return r.status==="startFailed"?{destUrl:null,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:r.routes,status:"rebuildFailed",error:r.error}:{destUrl:`http://127.0.0.1:${this.buildInstance.wrapPort}`,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:r.routes,status:"rebuilt"}}catch(r){return{destUrl:null,watch:this.config.watchPaths,type:"python-function",config:this.config,routes:[],status:"rebuildFailed",error:r.message}}}detectPythonCommand(){let t=this.buildInstance.getPythonCommand();if(t)return t;throw new Error(`Python 3.10+ is not available.
|
|
116282
116282
|
Please install Python 3.10:
|
|
116283
116283
|
macOS: brew install python@3.10
|
|
116284
116284
|
Ubuntu: sudo apt install python3.10
|
|
@@ -117205,7 +117205,7 @@ Please install Python 3.12:
|
|
|
117205
117205
|
Ubuntu: sudo apt install python3.12
|
|
117206
117206
|
Windows: winget install Python.Python.3.12
|
|
117207
117207
|
Or install uv (will auto-install Python 3.12):
|
|
117208
|
-
curl -LsSf https://astral.sh/uv/install.sh | sh`);let a={...process.env,...this.devConfig.env,PYTHONPATH:[Vw.default.join(r,"lib"),r].join(Vw.default.delimiter),AGENT_ROUTE_TABLE:this.getRouteTableJson(),AGENT_TIMEOUT:String(((l=this.devConfig.env)==null?void 0:l.AGENT_TIMEOUT)||"300"),OTEL_LOG_LEVEL:process.env.OTEL_LOG_LEVEL||"error",PAGES_BLOB_STS_ENV:"production",...this.devConfig.agentDevBlobAuth?{PAGES_BLOB_DEPLOY_CREDENTIAL:this.devConfig.agentDevBlobAuth.token,PAGES_PROJECT_ID:this.devConfig.agentDevBlobAuth.projectId}:{},...this.getObservabilityEnv(r)},n=(0,bbe.spawn)(s,["-m","uvicorn","_platform.adapter:app","--host","0.0.0.0","--port",String(t)],{cwd:r,env:a,stdio:"pipe"});return(p=n.stdout)==null||p.on("data",g=>{let v=g.toString().trimEnd();v.startsWith("[agent-python]")?Wt(v):Wt(`[agent-python] ${v}`)}),(m=n.stderr)==null||m.on("data",g=>{let v=g.toString().trimEnd();v.startsWith("[agent-python]")?Wt(v):Wt(`[agent-python] ${v}`)}),n.on("error",g=>{ns(`[agent-python] Process error: ${g.message}`)}),new Promise((g,v)=>{n.on("spawn",()=>g(n)),n.on("error",v)})}getObservabilityEnv(t){let r=Vw.default.join(t,".observability-entries");if(!pF.default.existsSync(r))return{};try{let s=pF.default.readFileSync(r,"utf-8").trim();if(s)return{AGENT_OBSERVABILITY_ENTRIES:s}}catch{}return{}}async waitForHealth(t){let r=Date.now(),s=0,a="";for(;Date.now()-r<_be;){let n=await new Promise(p=>{let m=Sbe.default.get(`http://127.0.0.1:${t}/health`,{timeout:1e3},g=>{p({ok:g.statusCode===200,reason:`status=${g.statusCode}`})});m.on("error",g=>p({ok:!1,reason:`err=${g.code||g.message}`})),m.on("timeout",()=>{m.destroy(),p({ok:!1,reason:"timeout"})})});if(a=n.reason,n.ok)return Wt(`[agent-python] Health check passed at ${Date.now()-r}ms on port ${t}`),!0;let l=Date.now()-r;l-s>=5e3&&(Wt(`[agent-python] Still waiting for Python cold start... (${l}ms, last: ${n.reason})`),s=l),await new Promise(p=>setTimeout(p,rMt))}return Wt(`[agent-python] Health check timed out after ${_be}ms on port ${t} (last probe: ${a})`),!1}killProcess(t){return new Promise(r=>{if(t.killed){r();return}let s=setTimeout(()=>{try{t.kill("SIGKILL")}catch{}},tMt);t.once("exit",()=>{clearTimeout(s),r()});try{t.kill("SIGTERM")}catch{clearTimeout(s),r()}})}getRouteTableJson(){try{let t=Vw.default.resolve(process.cwd(),".edgeone/agent-python/main.py"),s=pF.default.readFileSync(t,"utf-8").match(/AGENT_ROUTE_TABLE'?,\s*'(.+?)'\)/);return s?s[1]:"{}"}catch{return"{}"}}makeResult(t){return{destUrl:this.currentServer?`http://127.0.0.1:${this.currentPort}`:null,watch:this.config.watchPaths,type:"agent-python",config:this.config,routes:this.buildInstance.getRoutes().map(r=>({src:r.src,routePath:r.path})),status:t||(this.currentServer?"running":"stopped")}}}});function nMt(){let e="eth",t=Rz.default.platform();return t==="darwin"?e="en":t==="win32"&&(e=void 0),e}function iMt(e,t){return t==="IPv4"?e==="IPv4"||e===4:t==="IPv6"?e==="IPv6"||e===6:e===t}function Ebe(e,t,r=!1){let s;for(let a of e)if(iMt(a.family,t)){if(r&&a.address.startsWith("127."))continue;if(t==="IPv6"){if(a.scopeid===0)return a;s||(s=a)}else return a}return s}function sMt(e,t){let r=Rz.default.networkInterfaces(),s=!t;if(t=t||nMt(),e=e||"IPv4",t)for(let a=-1;a<8;a++){let n=t+(a>=0?a:""),l=r[n];if(l){let p=Ebe(l,e);if(p)return p}}if(s)for(let a in r){let n=r[a];if(n){let l=Ebe(n,e,!0);if(l)return l}}}function wbe(e){let t=sMt("IPv4",e);return t==null?void 0:t.address}var Rz,Fz=gt(()=>{Rz=zt(require("os"),1)});var Tbe=gt(()=>{Fz();Fz()});function Bz(e,t){let r="";e&&typeof e=="object"?(r=e.hostname,t=e.callback,e=e.port):typeof e=="function"&&(t=e,e=void 0),e=parseInt(e)||0;let s=e+10;return s>65535&&(s=65535),Gw("detect free port between [%s, %s)",e,s),typeof t=="function"?Mz(e,s,r).then(a=>t(null,a)).catch(t):Mz(e,s,r)}async function zw(e,t,r){return e>=t&&(Gw("port: %s >= maxPort: %s, give up and use random port",e,t),e=0,t=0),await Mz(e,t,r)}async function Mz(e,t,r){if(r)try{return await Ww(e,r)}catch(s){if(s.code==="EADDRNOTAVAIL")throw new Lz({cause:s});return await zw(++e,t,r)}try{await Ww(e)}catch(s){if(e===0)throw s;return await zw(++e,t,r)}try{await Ww(e,"0.0.0.0")}catch{return await zw(++e,t,r)}try{await Ww(e,"127.0.0.1")}catch{return await zw(++e,t,r)}try{await Ww(e,"localhost")}catch(s){if(s.code!=="EADDRNOTAVAIL")return await zw(++e,t,r)}try{return await Ww(e,wbe())}catch{return await zw(++e,t,r)}}function Ww(e,t){let r=(0,Pbe.createServer)();return new Promise((s,a)=>{r.once("error",n=>(Gw("listen %s:%s error: %s",t,e,n),r.close(),n.code==="ENOTFOUND"?(Gw("ignore dns ENOTFOUND error, get free %s:%s",t,e),s(e)):a(n))),Gw("try listen %d on %s",e,t),r.listen(e,t,()=>(e=r.address().port,Gw("get free %s:%s",t,e),r.close(),s(e)))})}var Pbe,Cbe,Gw,Lz,fF=gt(()=>{Pbe=require("net"),Cbe=require("util");Tbe();Gw=(0,Cbe.debuglog)("detect-port"),Lz=class extends Error{constructor(t){super("The IP address is not available on this machine",t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor)}}});var Abe,Ior,Dbe=gt(()=>{Abe=require("util");fF();Ior=(0,Abe.debuglog)("detect-port:wait-port")});var kbe,Ibe=gt(()=>{fF();fF();Dbe();kbe=Bz});function cm(e){let t=[],r=Lf(),s=r.relativePath==="."?".":`./${r.relativePath}`;return e instanceof Rw&&(Gy.default.existsSync(dn("edge-functions"))?t.push("./edge-functions"):Gy.default.existsSync(dn("functions"))&&t.push("./functions")),e instanceof Kw&&(Gy.default.existsSync(dn("cloud-functions"))?t.push("./cloud-functions"):Gy.default.existsSync(dn("node-functions"))&&t.push("./node-functions")),e instanceof jw&&(Gy.default.existsSync(r.absolutePath)&&t.push(s),Gy.default.existsSync(dn(".claude"))&&t.push("./.claude")),e instanceof Hw&&(Gy.default.existsSync(r.absolutePath)&&t.push(s),Gy.default.existsSync(dn(".claude"))&&t.push("./.claude")),(e instanceof Uw||e instanceof $w)&&Gy.default.existsSync(dn("cloud-functions"))&&t.push("./cloud-functions"),t}async function Og(e){return await kbe(e)}var Gy,bS=gt(()=>{hd();Zd();iu();O_e();jz();tz();bz();Iz();Oz();Nz();Gy=zt(require("fs"));Ibe();WR();aS()});var qz,Obe,Kw,jz=gt(()=>{eV();iu();qz=zt(require("path")),Obe=require("child_process");bS();dC();Kw=class{devConfig;buildInstance;config;server;runtimePort;constructor(t){this.devConfig=t,this.runtimePort=Number(t.runtimePort||9e3),this.config={...t,watchPaths:cm(this)},this.buildInstance=new W4({mode:"dev",env:t.env})}getDevBlobEnv(t=process.env){if(!this.devConfig.agentDevBlobAuth)return{};let r=this.devConfig.agentDevBlobAuth.token,s=this.devConfig.agentDevBlobAuth.projectId;return{EDGEONE_PAGES_API_TOKEN:String(t.EDGEONE_PAGES_API_TOKEN||r),EDGEONE_PROJECT_ID:String(t.EDGEONE_PROJECT_ID||s),PAGES_BLOB_DEPLOY_CREDENTIAL:String(t.PAGES_BLOB_DEPLOY_CREDENTIAL||r),PAGES_PROJECT_ID:String(t.PAGES_PROJECT_ID||s)}}applyDevBlobEnv(){let t=this.getDevBlobEnv({...process.env,...this.devConfig.env});for(let[r,s]of Object.entries(t))process.env[r]=s;process.env.PAGES_BLOB_STS_ENV=String(process.env.PAGES_BLOB_STS_ENV||"production")}async startEsmServer(t){let r={...process.env,...this.devConfig.env},s=(0,Obe.spawn)("node",[t],{stdio:["pipe","inherit","inherit"],env:{...r,...this.getDevBlobEnv(r),NODE_ENV:"development",PAGES_BLOB_STS_ENV:String(r.PAGES_BLOB_STS_ENV||"production")},cwd:process.cwd()});return await new Promise((a,n)=>{let l=!1,p=()=>{s.removeListener("spawn",m),s.removeListener("error",g),s.removeListener("exit",v)},m=()=>{setTimeout(()=>{l||(l=!0,p(),a())},200)},g=w=>{l||(l=!0,p(),n(w))},v=w=>{l||(l=!0,p(),n(new Error(`[dev] node function dev server exited early with code ${w!=null?w:"unknown"}`)))};s.on("spawn",m),s.on("error",g),s.on("exit",v)}),s}async start(t={}){let s=this.runtimePort||9e3,a=null;for(let n=0;n<2;n+=1)try{let l=await Og(s);l!==s?Wt(`[dev] node-function port occupied, fallback to: ${l}`):Wt(`[dev] node-function port selected: ${l}`);let m=!!(t.skipBuild&&this.buildInstance.wrapPort===l)?{routes:this.buildInstance.getRoutes()}:await this.buildInstance.build({port:l});if(m.routes.length===0)return this.runtimePort=l,{destUrl:null,watch:this.config.watchPaths,type:"node-function",config:this.config,routes:[],status:"no-routes"};if(this.server&&await this.stop(),await aE(process.cwd())==="esm"){let v=qz.default.join(process.cwd(),".edgeone/cloud-functions/api-node/index.mjs");this.server=await this.startEsmServer(v),console.log("[dev] node function dev server started")}else{this.applyDevBlobEnv();let v=qz.default.join(process.cwd(),".edgeone/cloud-functions/api-node/launcher.js");delete require.cache[require.resolve(v)];let w=require(v);this.server=await w.startServer(),console.log("[dev] node function dev server started")}return this.runtimePort=this.buildInstance.wrapPort,{destUrl:`http://localhost:${this.buildInstance.wrapPort}`,watch:this.config.watchPaths,type:"node-function",config:this.config,routes:m.routes,status:"started"}}catch(l){let p=l;a=p;let m=p.message||"";if(n===0&&(m.includes("EADDRINUSE")||m.includes("exited early"))){let v=(this.buildInstance.wrapPort||s)+1;Wt(`[dev] node-function EADDRINUSE detected, retry from port: ${v}`),s=v;continue}break}return{destUrl:null,watch:this.config.watchPaths,type:"node-function",config:this.config,routes:[],status:"startFailed",error:(a==null?void 0:a.message)||"Start failed"}}async stop(){this.server&&(this.server.kill?(this.server.kill("SIGTERM"),console.log("[dev] node function dev server stopped")):await new Promise((t,r)=>{this.server.close(s=>{s?(console.log("[dev] node function dev server stopped with error",s),r(s)):(console.log("[dev] node function dev server stopped"),t())})}),this.server=null)}async handleFileChange(t){try{let r=!1;this.buildInstance&&this.buildInstance.rebuildFunction&&t?(Wt(`[dev] Incremental rebuilding for: ${t}`),await this.buildInstance.rebuildFunction(t),r=!0):Wt("[dev] Falling back to full rebuild"),await this.stop();let s=await this.start({skipBuild:r});return s.status==="startFailed"?{destUrl:null,watch:this.config.watchPaths,type:"node-function",config:this.config,routes:s.routes,status:"rebuildFailed",error:s.error}:{destUrl:`http://localhost:${this.buildInstance.wrapPort}`,watch:this.config.watchPaths,type:"node-function",config:this.config,routes:s.routes,status:"rebuilt"}}catch(r){return{destUrl:null,watch:this.config.watchPaths,type:"node-function",config:this.config,routes:[],status:"rebuildFailed",error:r.message}}}}});var Nbe={};GT(Nbe,{runners:()=>wS});var wS,Rbe=gt(()=>{jz();tz();bz();Iz();Oz();Nz();wS=new Map;wS.set("edge-function",Rw);wS.set("agent-node",jw);wS.set("agent-python",Hw);wS.set("node-function",Kw);wS.set("python-function",Uw);wS.set("go-function",$w)});var{parentPort:Ky,workerData:oMt}=require("worker_threads"),{runners:aMt}=(Rbe(),TG(Nbe));async function uMt(){let{key:e,config:t}=oMt,r=null,s=null,a=!1;try{Ky.on("message",async l=>{var p;if(l.type==="start"){if(a||r){console.log(`[Worker ${e}] Already started, ignoring duplicate start message`);return}a=!0;let m=aMt.get(e);r=new m(t);let g=(p=await r.start())!=null?p:{},{destUrl:v,watch:w,type:C,config:O,routes:x,status:U,error:B}=g;if(U==="startFailed"){Ky.postMessage({type:"startFailed",error:B||"Start failed",key:e});return}if(U==="no-routes"){console.log(`[Worker ${e}] No routes found, skipping server start`),Ky.postMessage({type:"started",devMatch:{destUrl:null,watch:w,type:C,config:O,routes:[]}});return}Ky.postMessage({type:"started",devMatch:{destUrl:v,watch:w,type:C,config:O,routes:x}})}else if(l.type==="stop")await n(),Ky.postMessage({type:"stopped",key:e}),process.exit(0);else if(l.type==="rebuild")try{console.log(`[Worker ${e}] Rebuilding due to file change: ${l.filePath||"unknown"}`);let m=await r.handleFileChange(l.filePath),{destUrl:g,watch:v,type:w,config:C,routes:O,status:x,error:U}=m;if(x==="rebuildFailed"){console.error(`[Worker ${e}] Rebuild failed:`,U),Ky.postMessage({type:"rebuildFailed",key:e,error:U||"Rebuild failed"});return}Ky.postMessage({type:"rebuilt",key:e,success:!0,devMatch:{destUrl:g,watch:v,type:w,config:C,routes:O}})}catch(m){console.error(`[Worker ${e}] Rebuild failed:`,m),Ky.postMessage({type:"rebuildFailed",key:e,error:m.message,stack:m.stack})}})}catch(l){console.error(`[Worker ${e}] Startup error:`,l),Ky.postMessage({type:"error",phase:"startup",key:e,error:l.message,stack:l.stack}),process.exit(1)}process.on("uncaughtException",l=>{console.error(`[Worker ${e}] Uncaught exception:`,l),Ky.postMessage({type:"error",phase:"uncaught_exception",key:e,error:l.message,stack:l.stack})});async function n(){if(s&&(await s.close(),s=null),r){try{await r.stop()}catch(l){console.error(`[Worker ${e}] Error stopping runner:`,l)}r=null}}process.on("exit",async()=>{await n()})}uMt();
|
|
117208
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh`);let a={...process.env,...this.devConfig.env,PYTHONPATH:[Vw.default.join(r,"lib"),r].join(Vw.default.delimiter),AGENT_ROUTE_TABLE:this.getRouteTableJson(),AGENT_TIMEOUT:String(((l=this.devConfig.env)==null?void 0:l.AGENT_TIMEOUT)||"300"),OTEL_LOG_LEVEL:process.env.OTEL_LOG_LEVEL||"error",PAGES_BLOB_STS_ENV:"test",...this.devConfig.agentDevBlobAuth?{PAGES_BLOB_DEPLOY_CREDENTIAL:this.devConfig.agentDevBlobAuth.token,PAGES_PROJECT_ID:this.devConfig.agentDevBlobAuth.projectId}:{},...this.getObservabilityEnv(r)},n=(0,bbe.spawn)(s,["-m","uvicorn","_platform.adapter:app","--host","0.0.0.0","--port",String(t)],{cwd:r,env:a,stdio:"pipe"});return(p=n.stdout)==null||p.on("data",g=>{let v=g.toString().trimEnd();v.startsWith("[agent-python]")?Wt(v):Wt(`[agent-python] ${v}`)}),(m=n.stderr)==null||m.on("data",g=>{let v=g.toString().trimEnd();v.startsWith("[agent-python]")?Wt(v):Wt(`[agent-python] ${v}`)}),n.on("error",g=>{ns(`[agent-python] Process error: ${g.message}`)}),new Promise((g,v)=>{n.on("spawn",()=>g(n)),n.on("error",v)})}getObservabilityEnv(t){let r=Vw.default.join(t,".observability-entries");if(!pF.default.existsSync(r))return{};try{let s=pF.default.readFileSync(r,"utf-8").trim();if(s)return{AGENT_OBSERVABILITY_ENTRIES:s}}catch{}return{}}async waitForHealth(t){let r=Date.now(),s=0,a="";for(;Date.now()-r<_be;){let n=await new Promise(p=>{let m=Sbe.default.get(`http://127.0.0.1:${t}/health`,{timeout:1e3},g=>{p({ok:g.statusCode===200,reason:`status=${g.statusCode}`})});m.on("error",g=>p({ok:!1,reason:`err=${g.code||g.message}`})),m.on("timeout",()=>{m.destroy(),p({ok:!1,reason:"timeout"})})});if(a=n.reason,n.ok)return Wt(`[agent-python] Health check passed at ${Date.now()-r}ms on port ${t}`),!0;let l=Date.now()-r;l-s>=5e3&&(Wt(`[agent-python] Still waiting for Python cold start... (${l}ms, last: ${n.reason})`),s=l),await new Promise(p=>setTimeout(p,rMt))}return Wt(`[agent-python] Health check timed out after ${_be}ms on port ${t} (last probe: ${a})`),!1}killProcess(t){return new Promise(r=>{if(t.killed){r();return}let s=setTimeout(()=>{try{t.kill("SIGKILL")}catch{}},tMt);t.once("exit",()=>{clearTimeout(s),r()});try{t.kill("SIGTERM")}catch{clearTimeout(s),r()}})}getRouteTableJson(){try{let t=Vw.default.resolve(process.cwd(),".edgeone/agent-python/main.py"),s=pF.default.readFileSync(t,"utf-8").match(/AGENT_ROUTE_TABLE'?,\s*'(.+?)'\)/);return s?s[1]:"{}"}catch{return"{}"}}makeResult(t){return{destUrl:this.currentServer?`http://127.0.0.1:${this.currentPort}`:null,watch:this.config.watchPaths,type:"agent-python",config:this.config,routes:this.buildInstance.getRoutes().map(r=>({src:r.src,routePath:r.path})),status:t||(this.currentServer?"running":"stopped")}}}});function nMt(){let e="eth",t=Rz.default.platform();return t==="darwin"?e="en":t==="win32"&&(e=void 0),e}function iMt(e,t){return t==="IPv4"?e==="IPv4"||e===4:t==="IPv6"?e==="IPv6"||e===6:e===t}function Ebe(e,t,r=!1){let s;for(let a of e)if(iMt(a.family,t)){if(r&&a.address.startsWith("127."))continue;if(t==="IPv6"){if(a.scopeid===0)return a;s||(s=a)}else return a}return s}function sMt(e,t){let r=Rz.default.networkInterfaces(),s=!t;if(t=t||nMt(),e=e||"IPv4",t)for(let a=-1;a<8;a++){let n=t+(a>=0?a:""),l=r[n];if(l){let p=Ebe(l,e);if(p)return p}}if(s)for(let a in r){let n=r[a];if(n){let l=Ebe(n,e,!0);if(l)return l}}}function wbe(e){let t=sMt("IPv4",e);return t==null?void 0:t.address}var Rz,Fz=gt(()=>{Rz=zt(require("os"),1)});var Tbe=gt(()=>{Fz();Fz()});function Bz(e,t){let r="";e&&typeof e=="object"?(r=e.hostname,t=e.callback,e=e.port):typeof e=="function"&&(t=e,e=void 0),e=parseInt(e)||0;let s=e+10;return s>65535&&(s=65535),Gw("detect free port between [%s, %s)",e,s),typeof t=="function"?Mz(e,s,r).then(a=>t(null,a)).catch(t):Mz(e,s,r)}async function zw(e,t,r){return e>=t&&(Gw("port: %s >= maxPort: %s, give up and use random port",e,t),e=0,t=0),await Mz(e,t,r)}async function Mz(e,t,r){if(r)try{return await Ww(e,r)}catch(s){if(s.code==="EADDRNOTAVAIL")throw new Lz({cause:s});return await zw(++e,t,r)}try{await Ww(e)}catch(s){if(e===0)throw s;return await zw(++e,t,r)}try{await Ww(e,"0.0.0.0")}catch{return await zw(++e,t,r)}try{await Ww(e,"127.0.0.1")}catch{return await zw(++e,t,r)}try{await Ww(e,"localhost")}catch(s){if(s.code!=="EADDRNOTAVAIL")return await zw(++e,t,r)}try{return await Ww(e,wbe())}catch{return await zw(++e,t,r)}}function Ww(e,t){let r=(0,Pbe.createServer)();return new Promise((s,a)=>{r.once("error",n=>(Gw("listen %s:%s error: %s",t,e,n),r.close(),n.code==="ENOTFOUND"?(Gw("ignore dns ENOTFOUND error, get free %s:%s",t,e),s(e)):a(n))),Gw("try listen %d on %s",e,t),r.listen(e,t,()=>(e=r.address().port,Gw("get free %s:%s",t,e),r.close(),s(e)))})}var Pbe,Cbe,Gw,Lz,fF=gt(()=>{Pbe=require("net"),Cbe=require("util");Tbe();Gw=(0,Cbe.debuglog)("detect-port"),Lz=class extends Error{constructor(t){super("The IP address is not available on this machine",t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor)}}});var Abe,Ior,Dbe=gt(()=>{Abe=require("util");fF();Ior=(0,Abe.debuglog)("detect-port:wait-port")});var kbe,Ibe=gt(()=>{fF();fF();Dbe();kbe=Bz});function cm(e){let t=[],r=Lf(),s=r.relativePath==="."?".":`./${r.relativePath}`;return e instanceof Rw&&(Gy.default.existsSync(dn("edge-functions"))?t.push("./edge-functions"):Gy.default.existsSync(dn("functions"))&&t.push("./functions")),e instanceof Kw&&(Gy.default.existsSync(dn("cloud-functions"))?t.push("./cloud-functions"):Gy.default.existsSync(dn("node-functions"))&&t.push("./node-functions")),e instanceof jw&&(Gy.default.existsSync(r.absolutePath)&&t.push(s),Gy.default.existsSync(dn(".claude"))&&t.push("./.claude")),e instanceof Hw&&(Gy.default.existsSync(r.absolutePath)&&t.push(s),Gy.default.existsSync(dn(".claude"))&&t.push("./.claude")),(e instanceof Uw||e instanceof $w)&&Gy.default.existsSync(dn("cloud-functions"))&&t.push("./cloud-functions"),t}async function Og(e){return await kbe(e)}var Gy,bS=gt(()=>{hd();Zd();iu();O_e();jz();tz();bz();Iz();Oz();Nz();Gy=zt(require("fs"));Ibe();WR();aS()});var qz,Obe,Kw,jz=gt(()=>{eV();iu();qz=zt(require("path")),Obe=require("child_process");bS();dC();Kw=class{devConfig;buildInstance;config;server;runtimePort;constructor(t){this.devConfig=t,this.runtimePort=Number(t.runtimePort||9e3),this.config={...t,watchPaths:cm(this)},this.buildInstance=new W4({mode:"dev",env:t.env})}getDevBlobEnv(t=process.env){if(!this.devConfig.agentDevBlobAuth)return{};let r=this.devConfig.agentDevBlobAuth.token,s=this.devConfig.agentDevBlobAuth.projectId;return{EDGEONE_PAGES_API_TOKEN:String(t.EDGEONE_PAGES_API_TOKEN||r),EDGEONE_PROJECT_ID:String(t.EDGEONE_PROJECT_ID||s),PAGES_BLOB_DEPLOY_CREDENTIAL:String(t.PAGES_BLOB_DEPLOY_CREDENTIAL||r),PAGES_PROJECT_ID:String(t.PAGES_PROJECT_ID||s)}}applyDevBlobEnv(){let t=this.getDevBlobEnv({...process.env,...this.devConfig.env});for(let[r,s]of Object.entries(t))process.env[r]=s;process.env.PAGES_BLOB_STS_ENV=String(process.env.PAGES_BLOB_STS_ENV||"test")}async startEsmServer(t){let r={...process.env,...this.devConfig.env},s=(0,Obe.spawn)("node",[t],{stdio:["pipe","inherit","inherit"],env:{...r,...this.getDevBlobEnv(r),NODE_ENV:"development",PAGES_BLOB_STS_ENV:String(r.PAGES_BLOB_STS_ENV||"test")},cwd:process.cwd()});return await new Promise((a,n)=>{let l=!1,p=()=>{s.removeListener("spawn",m),s.removeListener("error",g),s.removeListener("exit",v)},m=()=>{setTimeout(()=>{l||(l=!0,p(),a())},200)},g=w=>{l||(l=!0,p(),n(w))},v=w=>{l||(l=!0,p(),n(new Error(`[dev] node function dev server exited early with code ${w!=null?w:"unknown"}`)))};s.on("spawn",m),s.on("error",g),s.on("exit",v)}),s}async start(t={}){let s=this.runtimePort||9e3,a=null;for(let n=0;n<2;n+=1)try{let l=await Og(s);l!==s?Wt(`[dev] node-function port occupied, fallback to: ${l}`):Wt(`[dev] node-function port selected: ${l}`);let m=!!(t.skipBuild&&this.buildInstance.wrapPort===l)?{routes:this.buildInstance.getRoutes()}:await this.buildInstance.build({port:l});if(m.routes.length===0)return this.runtimePort=l,{destUrl:null,watch:this.config.watchPaths,type:"node-function",config:this.config,routes:[],status:"no-routes"};if(this.server&&await this.stop(),await aE(process.cwd())==="esm"){let v=qz.default.join(process.cwd(),".edgeone/cloud-functions/api-node/index.mjs");this.server=await this.startEsmServer(v),console.log("[dev] node function dev server started")}else{this.applyDevBlobEnv();let v=qz.default.join(process.cwd(),".edgeone/cloud-functions/api-node/launcher.js");delete require.cache[require.resolve(v)];let w=require(v);this.server=await w.startServer(),console.log("[dev] node function dev server started")}return this.runtimePort=this.buildInstance.wrapPort,{destUrl:`http://localhost:${this.buildInstance.wrapPort}`,watch:this.config.watchPaths,type:"node-function",config:this.config,routes:m.routes,status:"started"}}catch(l){let p=l;a=p;let m=p.message||"";if(n===0&&(m.includes("EADDRINUSE")||m.includes("exited early"))){let v=(this.buildInstance.wrapPort||s)+1;Wt(`[dev] node-function EADDRINUSE detected, retry from port: ${v}`),s=v;continue}break}return{destUrl:null,watch:this.config.watchPaths,type:"node-function",config:this.config,routes:[],status:"startFailed",error:(a==null?void 0:a.message)||"Start failed"}}async stop(){this.server&&(this.server.kill?(this.server.kill("SIGTERM"),console.log("[dev] node function dev server stopped")):await new Promise((t,r)=>{this.server.close(s=>{s?(console.log("[dev] node function dev server stopped with error",s),r(s)):(console.log("[dev] node function dev server stopped"),t())})}),this.server=null)}async handleFileChange(t){try{let r=!1;this.buildInstance&&this.buildInstance.rebuildFunction&&t?(Wt(`[dev] Incremental rebuilding for: ${t}`),await this.buildInstance.rebuildFunction(t),r=!0):Wt("[dev] Falling back to full rebuild"),await this.stop();let s=await this.start({skipBuild:r});return s.status==="startFailed"?{destUrl:null,watch:this.config.watchPaths,type:"node-function",config:this.config,routes:s.routes,status:"rebuildFailed",error:s.error}:{destUrl:`http://localhost:${this.buildInstance.wrapPort}`,watch:this.config.watchPaths,type:"node-function",config:this.config,routes:s.routes,status:"rebuilt"}}catch(r){return{destUrl:null,watch:this.config.watchPaths,type:"node-function",config:this.config,routes:[],status:"rebuildFailed",error:r.message}}}}});var Nbe={};GT(Nbe,{runners:()=>wS});var wS,Rbe=gt(()=>{jz();tz();bz();Iz();Oz();Nz();wS=new Map;wS.set("edge-function",Rw);wS.set("agent-node",jw);wS.set("agent-python",Hw);wS.set("node-function",Kw);wS.set("python-function",Uw);wS.set("go-function",$w)});var{parentPort:Ky,workerData:oMt}=require("worker_threads"),{runners:aMt}=(Rbe(),TG(Nbe));async function uMt(){let{key:e,config:t}=oMt,r=null,s=null,a=!1;try{Ky.on("message",async l=>{var p;if(l.type==="start"){if(a||r){console.log(`[Worker ${e}] Already started, ignoring duplicate start message`);return}a=!0;let m=aMt.get(e);r=new m(t);let g=(p=await r.start())!=null?p:{},{destUrl:v,watch:w,type:C,config:O,routes:x,status:U,error:B}=g;if(U==="startFailed"){Ky.postMessage({type:"startFailed",error:B||"Start failed",key:e});return}if(U==="no-routes"){console.log(`[Worker ${e}] No routes found, skipping server start`),Ky.postMessage({type:"started",devMatch:{destUrl:null,watch:w,type:C,config:O,routes:[]}});return}Ky.postMessage({type:"started",devMatch:{destUrl:v,watch:w,type:C,config:O,routes:x}})}else if(l.type==="stop")await n(),Ky.postMessage({type:"stopped",key:e}),process.exit(0);else if(l.type==="rebuild")try{console.log(`[Worker ${e}] Rebuilding due to file change: ${l.filePath||"unknown"}`);let m=await r.handleFileChange(l.filePath),{destUrl:g,watch:v,type:w,config:C,routes:O,status:x,error:U}=m;if(x==="rebuildFailed"){console.error(`[Worker ${e}] Rebuild failed:`,U),Ky.postMessage({type:"rebuildFailed",key:e,error:U||"Rebuild failed"});return}Ky.postMessage({type:"rebuilt",key:e,success:!0,devMatch:{destUrl:g,watch:v,type:w,config:C,routes:O}})}catch(m){console.error(`[Worker ${e}] Rebuild failed:`,m),Ky.postMessage({type:"rebuildFailed",key:e,error:m.message,stack:m.stack})}})}catch(l){console.error(`[Worker ${e}] Startup error:`,l),Ky.postMessage({type:"error",phase:"startup",key:e,error:l.message,stack:l.stack}),process.exit(1)}process.on("uncaughtException",l=>{console.error(`[Worker ${e}] Uncaught exception:`,l),Ky.postMessage({type:"error",phase:"uncaught_exception",key:e,error:l.message,stack:l.stack})});async function n(){if(s&&(await s.close(),s=null),r){try{await r.stop()}catch(l){console.error(`[Worker ${e}] Error stopping runner:`,l)}r=null}}process.on("exit",async()=>{await n()})}uMt();
|
|
117209
117209
|
/*! Bundled license information:
|
|
117210
117210
|
|
|
117211
117211
|
object-assign/index.js:
|