dsh-edge 0.17.0-alpha.1 → 0.17.0
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/package.json
CHANGED
package/worker/direct/index.js
CHANGED
|
@@ -150,7 +150,7 @@ Known schemas:
|
|
|
150
150
|
- `)}`,new Error(je)}let pt=`${l}/$ref`,Ke=us(e,Re,n,r,i,s,o,pt,c);if(Ke.valid||he.push({instanceLocation:o,keyword:"$ref",keywordLocation:pt,error:"A subschema had errors."},...Ke.errors),n==="4"||n==="7")return{valid:he.length===0,errors:he}}if(Array.isArray(g)){let Me=g.length,Re=!1;for(let pt=0;pt<Me;pt++)if(d===g[pt]||g[pt]==="integer"&&d==="number"&&e%1===0&&e===e){Re=!0;break}Re||he.push({instanceLocation:o,keyword:"type",keywordLocation:`${l}/type`,error:`Instance type "${d}" is invalid. Expected "${g.join('", "')}".`})}else g==="integer"?(d!=="number"||e%1||e!==e)&&he.push({instanceLocation:o,keyword:"type",keywordLocation:`${l}/type`,error:`Instance type "${d}" is invalid. Expected "${g}".`}):g!==void 0&&d!==g&&he.push({instanceLocation:o,keyword:"type",keywordLocation:`${l}/type`,error:`Instance type "${d}" is invalid. Expected "${g}".`});if(y!==void 0&&(d==="object"||d==="array"?Ly(e,y)||he.push({instanceLocation:o,keyword:"const",keywordLocation:`${l}/const`,error:`Instance does not match ${JSON.stringify(y)}.`}):e!==y&&he.push({instanceLocation:o,keyword:"const",keywordLocation:`${l}/const`,error:`Instance does not match ${JSON.stringify(y)}.`})),v!==void 0&&(d==="object"||d==="array"?v.some(Me=>Ly(e,Me))||he.push({instanceLocation:o,keyword:"enum",keywordLocation:`${l}/enum`,error:`Instance does not match any of ${JSON.stringify(v)}.`}):v.some(Me=>e===Me)||he.push({instanceLocation:o,keyword:"enum",keywordLocation:`${l}/enum`,error:`Instance does not match any of ${JSON.stringify(v)}.`})),b!==void 0){let Me=`${l}/not`;us(e,b,n,r,i,s,o,Me).valid&&he.push({instanceLocation:o,keyword:"not",keywordLocation:Me,error:'Instance matched "not" schema.'})}let nt=[];if(S!==void 0){let Me=`${l}/anyOf`,Re=he.length,pt=!1;for(let Ke=0;Ke<S.length;Ke++){let je=S[Ke],ut=Object.create(c),Se=us(e,je,n,r,i,f===!0?s:null,o,`${Me}/${Ke}`,ut);he.push(...Se.errors),pt=pt||Se.valid,Se.valid&&nt.push(ut)}pt?he.length=Re:he.splice(Re,0,{instanceLocation:o,keyword:"anyOf",keywordLocation:Me,error:"Instance does not match any subschemas."})}if(k!==void 0){let Me=`${l}/allOf`,Re=he.length,pt=!0;for(let Ke=0;Ke<k.length;Ke++){let je=k[Ke],ut=Object.create(c),Se=us(e,je,n,r,i,f===!0?s:null,o,`${Me}/${Ke}`,ut);he.push(...Se.errors),pt=pt&&Se.valid,Se.valid&&nt.push(ut)}pt?he.length=Re:he.splice(Re,0,{instanceLocation:o,keyword:"allOf",keywordLocation:Me,error:"Instance does not match every subschema."})}if(E!==void 0){let Me=`${l}/oneOf`,Re=he.length,pt=E.filter((Ke,je)=>{let ut=Object.create(c),Se=us(e,Ke,n,r,i,f===!0?s:null,o,`${Me}/${je}`,ut);return he.push(...Se.errors),Se.valid&&nt.push(ut),Se.valid}).length;pt===1?he.length=Re:he.splice(Re,0,{instanceLocation:o,keyword:"oneOf",keywordLocation:Me,error:`Instance does not match exactly one subschema (${pt} matches).`})}if((d==="object"||d==="array")&&Object.assign(c,...nt),T!==void 0){let Me=`${l}/if`;if(us(e,T,n,r,i,s,o,Me,c).valid){if(I!==void 0){let pt=us(e,I,n,r,i,s,o,`${l}/then`,c);pt.valid||he.push({instanceLocation:o,keyword:"if",keywordLocation:Me,error:'Instance does not match "then" schema.'},...pt.errors)}}else if(N!==void 0){let pt=us(e,N,n,r,i,s,o,`${l}/else`,c);pt.valid||he.push({instanceLocation:o,keyword:"if",keywordLocation:Me,error:'Instance does not match "else" schema.'},...pt.errors)}}if(d==="object"){if(w!==void 0)for(let Ke of w)Ke in e||he.push({instanceLocation:o,keyword:"required",keywordLocation:`${l}/required`,error:`Instance does not have required property "${Ke}".`});let Me=Object.keys(e);if(A!==void 0&&Me.length<A&&he.push({instanceLocation:o,keyword:"minProperties",keywordLocation:`${l}/minProperties`,error:`Instance does not have at least ${A} properties.`}),H!==void 0&&Me.length>H&&he.push({instanceLocation:o,keyword:"maxProperties",keywordLocation:`${l}/maxProperties`,error:`Instance does not have at least ${H} properties.`}),ee!==void 0){let Ke=`${l}/propertyNames`;for(let je in e){let ut=`${o}/${Al(je)}`,Se=us(je,ee,n,r,i,s,ut,Ke);Se.valid||he.push({instanceLocation:o,keyword:"propertyNames",keywordLocation:Ke,error:`Property name "${je}" does not match schema.`},...Se.errors)}}if(G!==void 0){let Ke=`${l}/dependantRequired`;for(let je in G)if(je in e){let ut=G[je];for(let Se of ut)Se in e||he.push({instanceLocation:o,keyword:"dependentRequired",keywordLocation:Ke,error:`Instance has "${je}" but does not have "${Se}".`})}}if(B!==void 0)for(let Ke in B){let je=`${l}/dependentSchemas`;if(Ke in e){let ut=us(e,B[Ke],n,r,i,s,o,`${je}/${Al(Ke)}`,c);ut.valid||he.push({instanceLocation:o,keyword:"dependentSchemas",keywordLocation:je,error:`Instance has "${Ke}" but does not match dependant schema.`},...ut.errors)}}if(L!==void 0){let Ke=`${l}/dependencies`;for(let je in L)if(je in e){let ut=L[je];if(Array.isArray(ut))for(let Se of ut)Se in e||he.push({instanceLocation:o,keyword:"dependencies",keywordLocation:Ke,error:`Instance has "${je}" but does not have "${Se}".`});else{let Se=us(e,ut,n,r,i,s,o,`${Ke}/${Al(je)}`);Se.valid||he.push({instanceLocation:o,keyword:"dependencies",keywordLocation:Ke,error:`Instance has "${je}" but does not match dependant schema.`},...Se.errors)}}}let Re=Object.create(null),pt=!1;if(F!==void 0){let Ke=`${l}/properties`;for(let je in F){if(!(je in e))continue;let ut=`${o}/${Al(je)}`,Se=us(e[je],F[je],n,r,i,s,ut,`${Ke}/${Al(je)}`);if(Se.valid)c[je]=Re[je]=!0;else if(pt=i,he.push({instanceLocation:o,keyword:"properties",keywordLocation:Ke,error:`Property "${je}" does not match schema.`},...Se.errors),pt)break}}if(!pt&&$!==void 0){let Ke=`${l}/patternProperties`;for(let je in $){let ut=new RegExp(je,"u"),Se=$[je];for(let yt in e){if(!ut.test(yt))continue;let Mt=`${o}/${Al(yt)}`,it=us(e[yt],Se,n,r,i,s,Mt,`${Ke}/${Al(je)}`);it.valid?c[yt]=Re[yt]=!0:(pt=i,he.push({instanceLocation:o,keyword:"patternProperties",keywordLocation:Ke,error:`Property "${yt}" matches pattern "${je}" but does not match associated schema.`},...it.errors))}}}if(!pt&&U!==void 0){let Ke=`${l}/additionalProperties`;for(let je in e){if(Re[je])continue;let ut=`${o}/${Al(je)}`,Se=us(e[je],U,n,r,i,s,ut,Ke);Se.valid?c[je]=!0:(pt=i,he.push({instanceLocation:o,keyword:"additionalProperties",keywordLocation:Ke,error:`Property "${je}" does not match additional properties schema.`},...Se.errors))}}else if(!pt&&K!==void 0){let Ke=`${l}/unevaluatedProperties`;for(let je in e)if(!c[je]){let ut=`${o}/${Al(je)}`,Se=us(e[je],K,n,r,i,s,ut,Ke);Se.valid?c[je]=!0:he.push({instanceLocation:o,keyword:"unevaluatedProperties",keywordLocation:Ke,error:`Property "${je}" does not match unevaluated properties schema.`},...Se.errors)}}}else if(d==="array"){Te!==void 0&&e.length>Te&&he.push({instanceLocation:o,keyword:"maxItems",keywordLocation:`${l}/maxItems`,error:`Array has too many items (${e.length} > ${Te}).`}),qe!==void 0&&e.length<qe&&he.push({instanceLocation:o,keyword:"minItems",keywordLocation:`${l}/minItems`,error:`Array has too few items (${e.length} < ${qe}).`});let Me=e.length,Re=0,pt=!1;if(W!==void 0){let Ke=`${l}/prefixItems`,je=Math.min(W.length,Me);for(;Re<je;Re++){let ut=us(e[Re],W[Re],n,r,i,s,`${o}/${Re}`,`${Ke}/${Re}`);if(c[Re]=!0,!ut.valid&&(pt=i,he.push({instanceLocation:o,keyword:"prefixItems",keywordLocation:Ke,error:"Items did not match schema."},...ut.errors),pt))break}}if(ae!==void 0){let Ke=`${l}/items`;if(Array.isArray(ae)){let je=Math.min(ae.length,Me);for(;Re<je;Re++){let ut=us(e[Re],ae[Re],n,r,i,s,`${o}/${Re}`,`${Ke}/${Re}`);if(c[Re]=!0,!ut.valid&&(pt=i,he.push({instanceLocation:o,keyword:"items",keywordLocation:Ke,error:"Items did not match schema."},...ut.errors),pt))break}}else for(;Re<Me;Re++){let je=us(e[Re],ae,n,r,i,s,`${o}/${Re}`,Ke);if(c[Re]=!0,!je.valid&&(pt=i,he.push({instanceLocation:o,keyword:"items",keywordLocation:Ke,error:"Items did not match schema."},...je.errors),pt))break}if(!pt&&fe!==void 0){let je=`${l}/additionalItems`;for(;Re<Me;Re++){let ut=us(e[Re],fe,n,r,i,s,`${o}/${Re}`,je);c[Re]=!0,ut.valid||(pt=i,he.push({instanceLocation:o,keyword:"additionalItems",keywordLocation:je,error:"Items did not match additional items schema."},...ut.errors))}}}if(z!==void 0)if(Me===0&&Ce===void 0)he.push({instanceLocation:o,keyword:"contains",keywordLocation:`${l}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(Ce!==void 0&&Me<Ce)he.push({instanceLocation:o,keyword:"minContains",keywordLocation:`${l}/minContains`,error:`Array has less items (${Me}) than minContains (${Ce}).`});else{let Ke=`${l}/contains`,je=he.length,ut=0;for(let Se=0;Se<Me;Se++){let yt=us(e[Se],z,n,r,i,s,`${o}/${Se}`,Ke);yt.valid?(c[Se]=!0,ut++):he.push(...yt.errors)}ut>=(Ce||0)&&(he.length=je),Ce===void 0&&Xe===void 0&&ut===0?he.splice(je,0,{instanceLocation:o,keyword:"contains",keywordLocation:Ke,error:"Array does not contain item matching schema."}):Ce!==void 0&&ut<Ce?he.push({instanceLocation:o,keyword:"minContains",keywordLocation:`${l}/minContains`,error:`Array must contain at least ${Ce} items matching schema. Only ${ut} items were found.`}):Xe!==void 0&&ut>Xe&&he.push({instanceLocation:o,keyword:"maxContains",keywordLocation:`${l}/maxContains`,error:`Array may contain at most ${Xe} items matching schema. ${ut} items were found.`})}if(!pt&&ue!==void 0){let Ke=`${l}/unevaluatedItems`;for(Re;Re<Me;Re++){if(c[Re])continue;let je=us(e[Re],ue,n,r,i,s,`${o}/${Re}`,Ke);c[Re]=!0,je.valid||he.push({instanceLocation:o,keyword:"unevaluatedItems",keywordLocation:Ke,error:"Items did not match unevaluated items schema."},...je.errors)}}if(at)for(let Ke=0;Ke<Me;Ke++){let je=e[Ke],ut=typeof je=="object"&&je!==null;for(let Se=0;Se<Me;Se++){if(Ke===Se)continue;let yt=e[Se];(je===yt||ut&&(typeof yt=="object"&&yt!==null)&&Ly(je,yt))&&(he.push({instanceLocation:o,keyword:"uniqueItems",keywordLocation:`${l}/uniqueItems`,error:`Duplicate items at indexes ${Ke} and ${Se}.`}),Ke=Number.MAX_SAFE_INTEGER,Se=Number.MAX_SAFE_INTEGER)}}}else if(d==="number"){if(n==="4"?(ze!==void 0&&(me===!0&&e<=ze||e<ze)&&he.push({instanceLocation:o,keyword:"minimum",keywordLocation:`${l}/minimum`,error:`${e} is less than ${me?"or equal to ":""} ${ze}.`}),xe!==void 0&&(xt===!0&&e>=xe||e>xe)&&he.push({instanceLocation:o,keyword:"maximum",keywordLocation:`${l}/maximum`,error:`${e} is greater than ${xt?"or equal to ":""} ${xe}.`})):(ze!==void 0&&e<ze&&he.push({instanceLocation:o,keyword:"minimum",keywordLocation:`${l}/minimum`,error:`${e} is less than ${ze}.`}),xe!==void 0&&e>xe&&he.push({instanceLocation:o,keyword:"maximum",keywordLocation:`${l}/maximum`,error:`${e} is greater than ${xe}.`}),me!==void 0&&e<=me&&he.push({instanceLocation:o,keyword:"exclusiveMinimum",keywordLocation:`${l}/exclusiveMinimum`,error:`${e} is less than ${me}.`}),xt!==void 0&&e>=xt&&he.push({instanceLocation:o,keyword:"exclusiveMaximum",keywordLocation:`${l}/exclusiveMaximum`,error:`${e} is greater than or equal to ${xt}.`})),Qe!==void 0){let Me=e%Qe;Math.abs(0-Me)>=11920929e-14&&Math.abs(Qe-Me)>=11920929e-14&&he.push({instanceLocation:o,keyword:"multipleOf",keywordLocation:`${l}/multipleOf`,error:`${e} is not a multiple of ${Qe}.`})}}else if(d==="string"){let Me=lt===void 0&&Ae===void 0?0:xde(e);lt!==void 0&&Me<lt&&he.push({instanceLocation:o,keyword:"minLength",keywordLocation:`${l}/minLength`,error:`String is too short (${Me} < ${lt}).`}),Ae!==void 0&&Me>Ae&&he.push({instanceLocation:o,keyword:"maxLength",keywordLocation:`${l}/maxLength`,error:`String is too long (${Me} > ${Ae}).`}),ge!==void 0&&!new RegExp(ge,"u").test(e)&&he.push({instanceLocation:o,keyword:"pattern",keywordLocation:`${l}/pattern`,error:"String does not match pattern."}),P!==void 0&&oj[P]&&!oj[P](e)&&he.push({instanceLocation:o,keyword:"format",keywordLocation:`${l}/format`,error:`String does not match format "${P}".`})}return{valid:he.length===0,errors:he}}var cj=re(()=>{sj();FI();aj();LI();lj();a(us,"validate")});var jI,bde=re(()=>{FI();cj();jI=class{static{a(this,"Validator")}schema;draft;shortCircuit;lookup;constructor(t,n="2019-09",r=!0){this.schema=t,this.draft=n,this.shortCircuit=r,this.lookup=dp(t)}validate(t){return us(t,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(t,n){n&&(t={...t,$id:n}),dp(t,this.lookup)}}});var wde=re(()=>{sj();FI();aj();LI();vde();lj();cj();bde()});var qI,Sde=re(()=>{wde();qI=class{static{a(this,"CfWorkerJsonSchemaValidator")}constructor(t){this.shortcircuit=t?.shortcircuit??!0,this.draft=t?.draft??"2020-12"}getValidator(t){let n=new jI(t,this.draft,this.shortcircuit);return r=>{let i=n.validate(r);return i.valid?{valid:!0,data:r,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:i.errors.map(s=>`${s.instanceLocation}: ${s.error}`).join("; ")}}}}});var Hs,UI=re(()=>{"use strict";Hs={probeTimeoutMs:3e4,callTimeoutMs:6e4,maxToolsPerServer:128,maxCatalogPages:10,maxCatalogBytes:131072,maxDescriptionLength:512,maxErrorMessageChars:300,maxPublicNameLength:64,maxInstructionsLength:1024,metaToolThreshold:20}});import{createHash as YQe}from"node:crypto";function eet(e){let t=e.replace(/[.*+?^${}()|[\]\\]/gu,n=>n==="*"?"\0":`\\${n}`);return new RegExp(`^${t.replaceAll("\0",".*")}$`)}function kde(e,t,n){let r=t??"read_only";return r==="allow_all"?"allow":r==="approve_all"?"ask":n===!0?"allow":n===!1?"ask":QQe.some(i=>eet(i).test(e))?"allow":"ask"}function dd(e){return e.replace(/Bearer\s+[^\s"']+/giu,"Bearer ***").replace(/(https?:\/\/[^\s"'?]+)\?[^\s"']*/giu,"$1?***").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/gu,"").slice(0,Hs.maxErrorMessageChars)}function Ede(e,t){let n=`mcp__${e}__${t}`,r=n.replace(/[^A-Za-z0-9_-]/gu,"_");if(r===n&&r.length<=Hs.maxPublicNameLength)return r;let i=tet(e,t),s=Hs.maxPublicNameLength-i.length-1;return`${r.slice(0,s)}_${i}`}function tet(e,t){return YQe("sha256").update(`${e}\0${t}`).digest("hex").slice(0,12)}function _de(e){if(!(e==null||typeof e!="object"))try{let t=JSON.parse(JSON.stringify(e));return lm(t),t}catch{return}}function iet(e){return net.has(e)}function Tde(e){return e.type!=="image"||e.data===void 0||e.mimeType===void 0||!iet(e.mimeType)||!ret.test(e.data)?void 0:{data:Uint8Array.from(atob(e.data),n=>n.charCodeAt(0)),mediaType:e.mimeType}}function Ide(e){return e.some(t=>t.type==="image"&&t.data!==void 0)}function kw(e){if(e.isError)return[{type:"text",text:e.content.filter(i=>i.type==="text"&&typeof i.text=="string").map(i=>i.text).join(`
|
|
151
151
|
`)||"MCP tool returned an error."}];let t=[],n=[];for(let r of e.content)if(r.type==="text"&&typeof r.text=="string")n.push(r.text);else if(r.type==="resource_link"&&r.uri!==void 0)n.push(`Resource: ${r.name??"unnamed"} (${r.uri})`);else if(r.type==="image"&&r.data!==void 0)n.push(``);else if(r.type==="image")n.push(`[image: ${r.mimeType??"unknown type"}]`);else if(r.type==="audio")n.push("[audio result unsupported on Cloudflare Workers]");else if(r.type==="resource"&&r.resource?.text!==void 0){let i=r.resource.uri??"embedded resource";n.push(`--- ${i} ---
|
|
152
152
|
${r.resource.text}`)}else r.type==="resource"?n.push("[embedded resource: binary content not displayed]"):n.push(`[unsupported MCP content type: ${r.type}]`);return n.length>0&&t.push({type:"text",text:n.join(`
|
|
153
|
-
`)}),t.length>0?t:[{type:"text",text:"(empty MCP result)"}]}var QQe,net,ret,zI=re(()=>{"use strict";ko();UI();QQe=["get_*","list_*","read_*","search_*","find_*","fetch_*","describe_*"];a(eet,"globToRegExp");a(kde,"evaluateMcpToolPolicy");a(dd,"scrubMcpErrorMessage");a(Ede,"publicToolName");a(tet,"hashSuffix");a(_de,"supportedOutputSchema");net=new Set(["image/png","image/jpeg"]),ret=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u;a(iet,"isImageMediaType");a(Tde,"decodeImageBlock");a(Ide,"containsImage");a(kw,"mapMcpResultToContentBlocks")});var uj,Ade=re(()=>{uj={name:"dsh-edge",version:"0.17.0-alpha.1",description:"Your DeepSeek Harness, anywhere \u2014 deploy a persistent personal coding agent to Cloudflare Workers in one command",author:"pawaca",license:"MIT",type:"module",bin:{"dsh-edge":"scripts/cli.mjs"},files:["dist","worker","scripts/*.d.mts","scripts/*.mjs","wrangler.jsonc","README.md","README.zh.md","LICENSE","THIRD_PARTY_NOTICES.md"],repository:{type:"git",url:"git+https://github.com/pawaca/dsh-edge.git",directory:"apps/dsh-edge"},homepage:"https://github.com/pawaca/dsh-edge#readme",bugs:{url:"https://github.com/pawaca/dsh-edge/issues"},keywords:["deepseek","deepseek-harness","ai-agents","byok","cloudflare-workers","durable-objects","self-hosted"],engines:{node:">=22.14.0"},publishConfig:{access:"public"},dshEdge:{upstreamVersion:"0.1.5-rc.2"},scripts:{"bundle:direct":"pnpm run web:build && pnpm --dir standalone run build:worker:direct && node standalone/scripts/promote.mjs direct","bundle:isolated":"pnpm run web:build && pnpm --dir standalone run build:worker:isolated && node standalone/scripts/promote.mjs isolated","bundle:workers":"pnpm --dir standalone run build && pnpm --dir standalone run verify && node standalone/scripts/promote.mjs all",dev:"pnpm run bundle:direct && node scripts/dev.mjs direct","dev:isolated":"pnpm run bundle:isolated && node scripts/dev.mjs isolated","dsh-edge":"node scripts/cli.mjs","example:install":"node examples/install-keyless.mjs","install:cloudflare":"pnpm run bundle:workers && node scripts/cli.mjs install","legal:write":"node scripts/legal-files.mjs write","pack:verify":"node scripts/verify-packed.mjs",prepack:"node scripts/legal-files.mjs verify && pnpm run bundle:workers","web:build":"pnpm --dir standalone run build:web && node standalone/scripts/promote.mjs web",test:"vitest run --root ../.. --project edge-runtime","test:integration":"pnpm run bundle:workers && node tests/run-session-integration.mjs","test:snapshot":"vitest run --root ../.. --config apps/dsh-edge/vitest.snapshot.config.ts",typecheck:"tsc --noEmit"},dependencies:{"@clack/prompts":"1.7.0","compare-versions":"6.1.1",execa:"^10.0.1","jsonc-parser":"^3.3.1",wrangler:"4.129.0"},devDependencies:{"@cfworker/json-schema":"^4.1.1","@cloudflare/computer":"0.2.1","@cloudflare/workers-types":"5.20260904.1","@deepseek-ai/cordis":"4.0.2","@deepseek-ai/dsh-agent":"0.1.5-rc.2","@deepseek-ai/dsh-agent-loop":"0.1.5-rc.2","@deepseek-ai/dsh-anonymous-user-id":"0.1.5-rc.2","@deepseek-ai/dsh-api-gateway":"0.1.5-rc.2","@deepseek-ai/dsh-api-remotes":"0.1.5-rc.2","@deepseek-ai/dsh-api-session-controller":"0.1.5-rc.2","@deepseek-ai/dsh-api-settings-controller":"0.1.5-rc.2","@deepseek-ai/dsh-api-workspace-controller":"0.1.5-rc.2","@deepseek-ai/dsh-api-workspace-files":"0.1.5-rc.2","@deepseek-ai/dsh-attachment":"0.1.5-rc.2","@deepseek-ai/dsh-brand":"0.1.5-rc.2","@deepseek-ai/dsh-client-store":"0.1.5-rc.2","@deepseek-ai/dsh-code-runtime":"0.1.5-rc.2","@deepseek-ai/dsh-commands":"0.1.5-rc.2","@deepseek-ai/dsh-compaction":"0.1.5-rc.2","@deepseek-ai/dsh-compaction-basic":"0.1.5-rc.2","@deepseek-ai/dsh-compaction-tool-result-pruner":"0.1.5-rc.2","@deepseek-ai/dsh-credentials":"0.1.5-rc.2","@deepseek-ai/dsh-file-reference":"0.1.5-rc.2","@deepseek-ai/dsh-fs":"0.1.5-rc.2","@deepseek-ai/dsh-goal":"0.1.5-rc.2","@deepseek-ai/dsh-goal-round-driver":"0.1.5-rc.2","@deepseek-ai/dsh-host-directory-picker":"0.1.5-rc.2","@deepseek-ai/dsh-host-plugin-inventory":"0.1.5-rc.2","@deepseek-ai/dsh-invariants":"0.1.5-rc.2","@deepseek-ai/dsh-jobs":"0.1.5-rc.2","@deepseek-ai/dsh-jobs-local":"0.1.5-rc.2","@deepseek-ai/dsh-launch-environment":"0.1.5-rc.2","@deepseek-ai/dsh-llm":"0.1.5-rc.2","@deepseek-ai/dsh-llm-deepseek":"0.1.5-rc.2","@deepseek-ai/dsh-message-feedback":"0.1.5-rc.2","@deepseek-ai/dsh-output-retention":"0.1.5-rc.2","@deepseek-ai/dsh-plan-mode":"0.1.5-rc.2","@deepseek-ai/dsh-sandbox":"0.1.5-rc.2","@deepseek-ai/dsh-schedule":"0.1.5-rc.2","@deepseek-ai/dsh-scope":"0.1.5-rc.2","@deepseek-ai/dsh-session":"0.1.5-rc.2","@deepseek-ai/dsh-session-format":"0.1.5-rc.2","@deepseek-ai/dsh-session-format-catalog":"0.1.5-rc.2","@deepseek-ai/dsh-session-format-v0-to-v1":"0.1.5-rc.2","@deepseek-ai/dsh-session-format-v1-to-v2":"0.1.5-rc.2","@deepseek-ai/dsh-session-format-v2-to-v3":"0.1.5-rc.2","@deepseek-ai/dsh-session-persistence":"0.1.5-rc.2","@deepseek-ai/dsh-session-projection":"0.1.5-rc.2","@deepseek-ai/dsh-session-projection-cache":"0.1.5-rc.2","@deepseek-ai/dsh-session-query":"0.1.5-rc.2","@deepseek-ai/dsh-session-reference":"0.1.5-rc.2","@deepseek-ai/dsh-session-title":"0.1.5-rc.2","@deepseek-ai/dsh-session-title-first-prompt-llm":"0.1.5-rc.2","@deepseek-ai/dsh-session-title-llm":"0.1.5-rc.2","@deepseek-ai/dsh-settings":"0.1.5-rc.2","@deepseek-ai/dsh-skill":"0.1.5-rc.2","@deepseek-ai/dsh-spill":"0.1.5-rc.2","@deepseek-ai/dsh-spill-policy":"0.1.5-rc.2","@deepseek-ai/dsh-storage":"0.1.5-rc.2","@deepseek-ai/dsh-storage-domain":"0.1.5-rc.2","@deepseek-ai/dsh-subagent":"0.1.5-rc.2","@deepseek-ai/dsh-subagent-in-process-driver":"0.1.5-rc.2","@deepseek-ai/dsh-subagent-spawn-in-process":"0.1.5-rc.2","@deepseek-ai/dsh-system-prompt":"0.1.5-rc.2","@deepseek-ai/dsh-timeout":"0.1.5-rc.2","@deepseek-ai/dsh-token-meter":"0.1.5-rc.2","@deepseek-ai/dsh-tool-ask-user":"0.1.5-rc.2","@deepseek-ai/dsh-tool-call-timeout-policy":"0.1.5-rc.2","@deepseek-ai/dsh-tool-fs":"0.1.5-rc.2","@deepseek-ai/dsh-tool-goal":"0.1.5-rc.2","@deepseek-ai/dsh-tool-jobs":"0.1.5-rc.2","@deepseek-ai/dsh-tool-skill":"0.1.5-rc.2","@deepseek-ai/dsh-tool-subagent":"0.1.5-rc.2","@deepseek-ai/dsh-tool-web":"0.1.5-rc.2","@deepseek-ai/dsh-tool-workflow":"0.1.5-rc.2","@deepseek-ai/dsh-tools":"0.1.5-rc.2","@deepseek-ai/dsh-typert-protocol":"0.1.5-rc.2","@deepseek-ai/dsh-typert-registry":"0.1.5-rc.2","@deepseek-ai/dsh-user-approval":"0.1.5-rc.2","@deepseek-ai/dsh-user-questions":"0.1.5-rc.2","@deepseek-ai/dsh-util-values":"0.1.5-rc.2","@deepseek-ai/dsh-web":"0.1.5-rc.2","@deepseek-ai/dsh-web-fetch-http":"0.1.5-rc.2","@deepseek-ai/dsh-web-search-deepseek":"0.1.5-rc.2","@deepseek-ai/dsh-workflow":"0.1.5-rc.2","@deepseek-ai/dsh-workspace":"0.1.5-rc.2","@deepseek-ai/schemastery":"3.18.2","@mixmark-io/domino":"2.2.0","@modelcontextprotocol/sdk":"1.30.0",acorn:"8.18.0","fast-png":"8.0.0","jpeg-js":"0.4.4","just-bash":"3.4.2",playwright:"^1.49.0",sucrase:"3.35.1",typescript:"^6.0.3",vitest:"^4.1.8",ws:"^8.21.0"}}});var Fy,Cde,BI=re(()=>{"use strict";Ade();Fy=uj.version,Cde=uj.dshEdge.upstreamVersion});function uet(e){let t=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/iu.exec(e);if(t!==null)return t[1];let n=/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/iu.exec(e);if(n!==null){let r=parseInt(n[1],16),i=parseInt(n[2],16);return`${String(r>>8)}.${String(r&255)}.${String(i>>8)}.${String(i&255)}`}}function det(e){return/^\d+\.\d+\.\d+\.\d+$/u.test(e)||e.includes(":")}function pp(e){let t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error("MCP server URL must use http: or https: protocol.");let n=t.hostname.toLowerCase(),r=n.endsWith(".")?n.slice(0,-1):n,i=r.startsWith("[")&&r.endsWith("]")?r.slice(1,-1):r;if(!(i==="localhost"||i==="127.0.0.1"||i==="::1")){for(let s of oet)if(i.endsWith(s))throw new Error(`MCP server hostname "${i}" is blocked.`);if(det(i)){let s=uet(i),o=s??i;for(let l of aet)if(l.test(o))throw new Error(`MCP server address "${i}" is a private IP and is blocked.`);if(s===void 0){for(let l of cet)if(l.test(i))throw new Error(`MCP server address "${i}" is a private IP and is blocked.`)}}}}function pet(e){return e?.type==="bearer"&&e.token!==void 0?{Authorization:`Bearer ${e.token}`}:{}}async function Rde(e,t,n){pp(e);let r=new MI(new URL(e),{requestInit:{headers:pet(t),signal:n},fetch:Dm}),i=new NI({name:"dsh-edge",version:Fy},{capabilities:{},jsonSchemaValidator:fet});return await i.connect(r),{client:i,close:a(async()=>{await i.close().catch(()=>{})},"close")}}async function $de(e,t,n){let r=AbortSignal.timeout(Hs.probeTimeoutMs),i;try{i=await Rde(t,n,r)}catch(l){throw new Error(dd(l instanceof Error?l.message:String(l)))}let{client:s,close:o}=i;try{let l=[],c=new Set,u=new Set,d;for(let f=0;f<Hs.maxCatalogPages;f++){let g=await s.listTools(d===void 0?void 0:{cursor:d},{signal:r});for(let y of g.tools){if(l.length>=Hs.maxToolsPerServer)break;let v=Ede(e,y.name);if(c.has(v))throw new Error(`Server listed tool "${y.name}" more than once`);c.add(v);let w=y.annotations?.readOnlyHint,b=_de(y.outputSchema);l.push({name:y.name,publicName:v,description:y.description??"",inputSchema:y.inputSchema??{type:"object"},...b!==void 0?{outputSchema:b}:{},...w!==void 0?{annotations:{readOnlyHint:w}}:{}})}if(l.length>=Hs.maxToolsPerServer||(d=g.nextCursor??void 0,d===void 0))break;if(u.has(d))throw new Error("Server repeated a tools/list continuation cursor");u.add(d)}let p=s.getServerVersion?.(),h=s.getInstructions?.();return{tools:l,serverInfo:p?{name:p.name,version:p.version}:void 0,instructions:typeof h=="string"&&h.length>0?h.slice(0,Hs.maxInstructionsLength):void 0}}finally{await o()}}async function WI(e,t,n,r,i,s){let o=s??Hs.callTimeoutMs,l=i?AbortSignal.any([i,AbortSignal.timeout(o)]):AbortSignal.timeout(o),c;try{c=await Rde(e,r,l)}catch(u){throw new Error(dd(u instanceof Error?u.message:String(u)))}try{let u=await c.client.callTool({name:t,arguments:n},void 0,{signal:l});return{content:u.content??[],structuredContent:u.structuredContent,isError:u.isError===!0}}catch(u){throw new Error(dd(u instanceof Error?u.message:String(u)))}finally{await c.close()}}var oet,aet,cet,fet,Dm,Ew=re(()=>{"use strict";Due();hde();Sde();zI();UI();BI();oet=[".internal",".local",".localhost"],aet=[/^127\./u,/^10\./u,/^172\.(1[6-9]|2\d|3[01])\./u,/^192\.168\./u,/^0\./u,/^169\.254\./u],cet=[/^::1$/u,/^fc/iu,/^fd/iu,/^fe[89ab][0-9a-f]:/iu];a(uet,"extractMappedIPv4");a(det,"isIpAddress");a(pp,"assertSafeUrl");a(pet,"buildHeaders");fet=new qI,Dm=a(async(e,t)=>{let n=await globalThis.fetch(e,{...t,redirect:"manual"});if(n.status>=300&&n.status<400)throw new Error(`MCP server returned HTTP ${String(n.status)} redirect; redirects are blocked for security.`);return n},"noRedirectFetch");a(Rde,"connectClient");a($de,"probe");a(WI,"callTool")});import{Buffer as het}from"node:buffer";function vet(e){return e instanceof Error&&"code"in e&&typeof e.code=="string"&&yet.has(e.code)}function Pde(e){return e instanceof Error&&"code"in e&&typeof e.code=="string"&&get.has(e.code)}function Nde(e,t,n){let r=het.from(e,"base64");if(e.length===0&&t==="reject"||r.toString("base64")!==e)throw new Wn(n==="INVALID_IMAGE_BASE64"?"Image upload is not canonical base64.":"File upload is not canonical base64.",n);return new Uint8Array(r)}function xet(e){return Nde(e,"reject","INVALID_IMAGE_BASE64")}function bet(e){return{data:xet(e.data),mediaType:e.mediaType,...e.name===void 0?{}:{name:e.name}}}async function _w(e,t){return e.saveImages(t.map(bet))}async function wet(e,t){return e.saveFile({data:Nde(t.data,"accept","INVALID_FILE_BASE64"),...t.name===void 0?{}:{name:t.name}})}function Dde(e,t,n){let r=Math.min(1,Math.sqrt(n/(e*t)));if(r===1)return{width:e,height:t};if(e>=t){let o=Math.max(1,Math.floor(e*r)),l=Math.max(1,Math.round(o*t/e));for(;o*l>n&&o>1;)o-=1,l=Math.max(1,Math.round(o*t/e));return{width:o,height:l}}let i=Math.max(1,Math.floor(t*r)),s=Math.max(1,Math.round(i*e/t));for(;s*i>n&&i>1;)i-=1,s=Math.max(1,Math.round(i*e/t));return{width:s,height:i}}var Ode,met,get,yet,Wn,dj,fp=re(()=>{Qn();Ode=["TOO_MANY_IMAGES","IMAGES_TOO_LARGE","UNSUPPORTED_IMAGE_TYPE","INVALID_IMAGE_BASE64","INVALID_IMAGE","IMAGE_TYPE_MISMATCH","IMAGE_TOO_LARGE","IMAGE_TOO_MANY_PIXELS","IMAGE_DIMENSION_TOO_LARGE"],met=[...Ode,"INVALID_FILE_BASE64","INVALID_ATTACHMENT_REF","ATTACHMENT_CORRUPT","ATTACHMENT_WRITE_FAILED","ATTACHMENT_NOT_FOUND","ATTACHMENT_READ_FAILED","ATTACHMENT_PROJECTION_UNSUPPORTED","ATTACHMENT_FILES_UNSUPPORTED"],get=new Set(Ode),yet=new Set(met),Wn=class extends Error{static{a(this,"AttachmentError")}code;constructor(e,t,n){super(e,n),this.name="AttachmentError",this.code=t}};a(vet,"isAttachmentError");a(Pde,"isImageAdmissionError");a(Nde,"decodeCanonicalBase64");a(xet,"decodeBase64");a(bet,"saveInput");a(_w,"admitEncodedImages");a(wet,"admitEncodedFile");a(Dde,"requestImageDimensions");dj=class extends At{static{a(this,"AttachmentStore")}constructor(e){super(e,"attachments")}validateImageBatch(e){let{maxImagesPerMessage:t,maxMessageImageBytes:n,mediaTypes:r}=this.imageLimits;if(e.length>t)throw new Wn("Image batch exceeds the configured image-count limit.","TOO_MANY_IMAGES");if(e.reduce((i,s)=>i+s.data.byteLength,0)>n)throw new Wn("Image batch exceeds the configured aggregate image-byte limit.","IMAGES_TOO_LARGE");for(let i of e)if(!r.includes(i.mediaType))throw new Wn(`Image type ${i.mediaType} is not accepted by this deployment.`,"UNSUPPORTED_IMAGE_TYPE")}async saveImages(e){this.validateImageBatch(e);for(let n of e)await this.validateImage(n);let t=[];for(let n of e)t.push(await this.saveImage(n));return t}async admitPromptContent(e){if(e.every(r=>r.type!=="image"))return e.map(r=>r.type==="text"?{type:"text",text:r.text}:{type:"file",attachment:r.attachment});let t=await _w(this,e.filter(r=>r.type==="image")),n=0;return e.map(r=>r.type==="text"?{type:"text",text:r.text}:r.type==="file"?{type:"file",attachment:r.attachment}:{type:"image",attachment:t[n++]})}admitEncodedFile(e){return wet(this,e)}isAttachmentError(e){return vet(e)}imageHostPath(e){}saveFile(e){return Promise.reject(new Wn("The mounted attachment provider cannot store verbatim files.","ATTACHMENT_FILES_UNSUPPORTED"))}saveFileStream(e){return Promise.reject(new Wn("The mounted attachment provider cannot stream verbatim files.","ATTACHMENT_FILES_UNSUPPORTED"))}async*readFileStream(e,t){t?.throwIfAborted(),await Promise.reject(new Wn("The mounted attachment provider cannot read verbatim files.","ATTACHMENT_FILES_UNSUPPORTED"))}fileHostPath(e){}readImageRequest(e,t,n){return n?.throwIfAborted(),Promise.reject(new Wn("The mounted attachment provider cannot derive model-request images.","ATTACHMENT_PROJECTION_UNSUPPORTED"))}}});var VI={};On(VI,{buildAuthorizationUrl:()=>$et,discoverEndpoints:()=>Cet,exchangeCode:()=>Oet,isTokenExpired:()=>Net,refreshToken:()=>Pet,registerClient:()=>Ret});function jde(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(2,"0")).join("").slice(0,e)}async function Aet(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return btoa(String.fromCharCode(...new Uint8Array(n))).replace(/\+/gu,"-").replace(/\//gu,"_").replace(/=/gu,"")}async function Cet(e){let t=AbortSignal.timeout(HI),n=new URL(e),r=n.pathname==="/"?"/.well-known/oauth-protected-resource":`/.well-known/oauth-protected-resource${n.pathname}`,i=new URL(r,n.origin);pp(i.href);let s=await Dm(i.href,{signal:t});if(!s.ok)throw new Error(`PRM discovery failed: HTTP ${s.status}`);let l=(await s.json()).authorization_servers?.[0];if(typeof l!="string")throw new Error("No authorization server in PRM");let c=new URL(l),u=c.pathname==="/"?"/.well-known/oauth-authorization-server":`/.well-known/oauth-authorization-server${c.pathname}`,d=new URL(u,c.origin);pp(d.href);let p=await Dm(d.href,{signal:t});if(!p.ok)throw new Error(`AS metadata failed: HTTP ${p.status}`);let h=await p.json();if(typeof h.authorization_endpoint!="string"||typeof h.token_endpoint!="string")throw new Error("Missing required endpoints in AS metadata");return{authorization:h.authorization_endpoint,token:h.token_endpoint,registration:h.registration_endpoint}}async function Ret(e,t,n){let r=AbortSignal.timeout(HI);pp(e);let i=await Dm(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({client_name:n,redirect_uris:[t],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none"}),signal:r});if(!i.ok)throw new Error(`DCR failed: HTTP ${i.status}`);let s=await i.json();if(typeof s.client_id!="string")throw new Error("DCR response missing client_id");return{clientId:s.client_id,clientSecret:s.client_secret}}async function $et(e,t,n,r,i){let s=jde(32),o=jde(64),l=await Aet(o),c=new URL(e.authorization);for(let[u,d]of Object.entries({response_type:"code",client_id:t.clientId,redirect_uri:n,state:s,code_challenge:l,code_challenge_method:"S256",resource:i}))c.searchParams.set(u,d);return{authorizationUrl:c.href,pendingFlow:{state:s,codeVerifier:o,redirectUri:n,serverName:r,serverUrl:i,stagedClient:t,createdAt:Date.now()}}}async function Oet(e,t,n,r,i,s){let o=AbortSignal.timeout(HI),l=new URLSearchParams({grant_type:"authorization_code",code:n,redirect_uri:i,client_id:t.clientId,code_verifier:r});s!==void 0&&l.set("resource",s),t.clientSecret!==void 0&&l.set("client_secret",t.clientSecret),pp(e);let c=await Dm(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:l.toString(),signal:o});if(!c.ok)throw new Error(`Token exchange failed: HTTP ${c.status}`);return qde(await c.json())}async function Pet(e,t,n,r){let i=AbortSignal.timeout(HI),s=new URLSearchParams({grant_type:"refresh_token",refresh_token:n,client_id:t.clientId});r!==void 0&&s.set("resource",r),t.clientSecret!==void 0&&s.set("client_secret",t.clientSecret),pp(e);let o=await Dm(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s.toString(),signal:i});if(!o.ok)throw new Error(`Token refresh failed: HTTP ${o.status}`);return qde(await o.json())}function qde(e){let t=e;if(typeof t.access_token!="string")throw new Error("Missing access_token");let n=typeof t.expires_in=="number"?t.expires_in:void 0;return{accessToken:t.access_token,refreshToken:typeof t.refresh_token=="string"?t.refresh_token:void 0,expiresAt:n!==void 0?Date.now()+n*1e3:void 0,tokenType:typeof t.token_type=="string"?t.token_type:"Bearer",scope:typeof t.scope=="string"?t.scope:void 0}}function Net(e){return e.expiresAt===void 0?!1:Date.now()>e.expiresAt-12e4}var HI,GI=re(()=>{"use strict";Ew();HI=1e4;a(jde,"randomString");a(Aet,"sha256Base64Url");a(Cet,"discoverEndpoints");a(Ret,"registerClient");a($et,"buildAuthorizationUrl");a(Oet,"exchangeCode");a(Pet,"refreshToken");a(qde,"parseTokenResponse");a(Net,"isTokenExpired")});var Kn,Zde,KI=re(()=>{Qn();Ir();Kn=class extends Pr{static{a(this,"FsError")}code;constructor(e,t,n){super(e,t,n),this.code=t}},Zde=class extends At{static{a(this,"FileSystem")}constructor(e){super(e,"fs")}get sandboxMode(){}processPathFromHostPath(e){}}});function Cj(e){return sA.test(e)}function oA(e){return e.invocation.modelInvocable}function qy(e){return e.invocation.userInvocable}function Rj(e){let t=mnt(e);return[`<skill_content name="${gnt(e.name)}">`,"<skill_resources>",...t,"</skill_resources>","","<skill_instructions>",e.content,"</skill_instructions>","</skill_content>"].join(`
|
|
153
|
+
`)}),t.length>0?t:[{type:"text",text:"(empty MCP result)"}]}var QQe,net,ret,zI=re(()=>{"use strict";ko();UI();QQe=["get_*","list_*","read_*","search_*","find_*","fetch_*","describe_*"];a(eet,"globToRegExp");a(kde,"evaluateMcpToolPolicy");a(dd,"scrubMcpErrorMessage");a(Ede,"publicToolName");a(tet,"hashSuffix");a(_de,"supportedOutputSchema");net=new Set(["image/png","image/jpeg"]),ret=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u;a(iet,"isImageMediaType");a(Tde,"decodeImageBlock");a(Ide,"containsImage");a(kw,"mapMcpResultToContentBlocks")});var uj,Ade=re(()=>{uj={name:"dsh-edge",version:"0.17.0",description:"Your DeepSeek Harness, anywhere \u2014 deploy a persistent personal coding agent to Cloudflare Workers in one command",author:"pawaca",license:"MIT",type:"module",bin:{"dsh-edge":"scripts/cli.mjs"},files:["dist","worker","scripts/*.d.mts","scripts/*.mjs","wrangler.jsonc","README.md","README.zh.md","LICENSE","THIRD_PARTY_NOTICES.md"],repository:{type:"git",url:"git+https://github.com/pawaca/dsh-edge.git",directory:"apps/dsh-edge"},homepage:"https://github.com/pawaca/dsh-edge#readme",bugs:{url:"https://github.com/pawaca/dsh-edge/issues"},keywords:["deepseek","deepseek-harness","ai-agents","byok","cloudflare-workers","durable-objects","self-hosted"],engines:{node:">=22.14.0"},publishConfig:{access:"public"},dshEdge:{upstreamVersion:"0.1.5-rc.2"},scripts:{"bundle:direct":"pnpm run web:build && pnpm --dir standalone run build:worker:direct && node standalone/scripts/promote.mjs direct","bundle:isolated":"pnpm run web:build && pnpm --dir standalone run build:worker:isolated && node standalone/scripts/promote.mjs isolated","bundle:workers":"pnpm --dir standalone run build && pnpm --dir standalone run verify && node standalone/scripts/promote.mjs all",dev:"pnpm run bundle:direct && node scripts/dev.mjs direct","dev:isolated":"pnpm run bundle:isolated && node scripts/dev.mjs isolated","dsh-edge":"node scripts/cli.mjs","example:install":"node examples/install-keyless.mjs","install:cloudflare":"pnpm run bundle:workers && node scripts/cli.mjs install","legal:write":"node scripts/legal-files.mjs write","pack:verify":"node scripts/verify-packed.mjs",prepack:"node scripts/legal-files.mjs verify && pnpm run bundle:workers","web:build":"pnpm --dir standalone run build:web && node standalone/scripts/promote.mjs web",test:"vitest run --root ../.. --project edge-runtime","test:integration":"pnpm run bundle:workers && node tests/run-session-integration.mjs","test:snapshot":"vitest run --root ../.. --config apps/dsh-edge/vitest.snapshot.config.ts",typecheck:"tsc --noEmit"},dependencies:{"@clack/prompts":"1.7.0","compare-versions":"6.1.1",execa:"^10.0.1","jsonc-parser":"^3.3.1",wrangler:"4.129.0"},devDependencies:{"@cfworker/json-schema":"^4.1.1","@cloudflare/computer":"0.2.1","@cloudflare/workers-types":"5.20260904.1","@deepseek-ai/cordis":"4.0.2","@deepseek-ai/dsh-agent":"0.1.5-rc.2","@deepseek-ai/dsh-agent-loop":"0.1.5-rc.2","@deepseek-ai/dsh-anonymous-user-id":"0.1.5-rc.2","@deepseek-ai/dsh-api-gateway":"0.1.5-rc.2","@deepseek-ai/dsh-api-remotes":"0.1.5-rc.2","@deepseek-ai/dsh-api-session-controller":"0.1.5-rc.2","@deepseek-ai/dsh-api-settings-controller":"0.1.5-rc.2","@deepseek-ai/dsh-api-workspace-controller":"0.1.5-rc.2","@deepseek-ai/dsh-api-workspace-files":"0.1.5-rc.2","@deepseek-ai/dsh-attachment":"0.1.5-rc.2","@deepseek-ai/dsh-brand":"0.1.5-rc.2","@deepseek-ai/dsh-client-store":"0.1.5-rc.2","@deepseek-ai/dsh-code-runtime":"0.1.5-rc.2","@deepseek-ai/dsh-commands":"0.1.5-rc.2","@deepseek-ai/dsh-compaction":"0.1.5-rc.2","@deepseek-ai/dsh-compaction-basic":"0.1.5-rc.2","@deepseek-ai/dsh-compaction-tool-result-pruner":"0.1.5-rc.2","@deepseek-ai/dsh-credentials":"0.1.5-rc.2","@deepseek-ai/dsh-file-reference":"0.1.5-rc.2","@deepseek-ai/dsh-fs":"0.1.5-rc.2","@deepseek-ai/dsh-goal":"0.1.5-rc.2","@deepseek-ai/dsh-goal-round-driver":"0.1.5-rc.2","@deepseek-ai/dsh-host-directory-picker":"0.1.5-rc.2","@deepseek-ai/dsh-host-plugin-inventory":"0.1.5-rc.2","@deepseek-ai/dsh-invariants":"0.1.5-rc.2","@deepseek-ai/dsh-jobs":"0.1.5-rc.2","@deepseek-ai/dsh-jobs-local":"0.1.5-rc.2","@deepseek-ai/dsh-launch-environment":"0.1.5-rc.2","@deepseek-ai/dsh-llm":"0.1.5-rc.2","@deepseek-ai/dsh-llm-deepseek":"0.1.5-rc.2","@deepseek-ai/dsh-message-feedback":"0.1.5-rc.2","@deepseek-ai/dsh-output-retention":"0.1.5-rc.2","@deepseek-ai/dsh-plan-mode":"0.1.5-rc.2","@deepseek-ai/dsh-sandbox":"0.1.5-rc.2","@deepseek-ai/dsh-schedule":"0.1.5-rc.2","@deepseek-ai/dsh-scope":"0.1.5-rc.2","@deepseek-ai/dsh-session":"0.1.5-rc.2","@deepseek-ai/dsh-session-format":"0.1.5-rc.2","@deepseek-ai/dsh-session-format-catalog":"0.1.5-rc.2","@deepseek-ai/dsh-session-format-v0-to-v1":"0.1.5-rc.2","@deepseek-ai/dsh-session-format-v1-to-v2":"0.1.5-rc.2","@deepseek-ai/dsh-session-format-v2-to-v3":"0.1.5-rc.2","@deepseek-ai/dsh-session-persistence":"0.1.5-rc.2","@deepseek-ai/dsh-session-projection":"0.1.5-rc.2","@deepseek-ai/dsh-session-projection-cache":"0.1.5-rc.2","@deepseek-ai/dsh-session-query":"0.1.5-rc.2","@deepseek-ai/dsh-session-reference":"0.1.5-rc.2","@deepseek-ai/dsh-session-title":"0.1.5-rc.2","@deepseek-ai/dsh-session-title-first-prompt-llm":"0.1.5-rc.2","@deepseek-ai/dsh-session-title-llm":"0.1.5-rc.2","@deepseek-ai/dsh-settings":"0.1.5-rc.2","@deepseek-ai/dsh-skill":"0.1.5-rc.2","@deepseek-ai/dsh-spill":"0.1.5-rc.2","@deepseek-ai/dsh-spill-policy":"0.1.5-rc.2","@deepseek-ai/dsh-storage":"0.1.5-rc.2","@deepseek-ai/dsh-storage-domain":"0.1.5-rc.2","@deepseek-ai/dsh-subagent":"0.1.5-rc.2","@deepseek-ai/dsh-subagent-in-process-driver":"0.1.5-rc.2","@deepseek-ai/dsh-subagent-spawn-in-process":"0.1.5-rc.2","@deepseek-ai/dsh-system-prompt":"0.1.5-rc.2","@deepseek-ai/dsh-timeout":"0.1.5-rc.2","@deepseek-ai/dsh-token-meter":"0.1.5-rc.2","@deepseek-ai/dsh-tool-ask-user":"0.1.5-rc.2","@deepseek-ai/dsh-tool-call-timeout-policy":"0.1.5-rc.2","@deepseek-ai/dsh-tool-fs":"0.1.5-rc.2","@deepseek-ai/dsh-tool-goal":"0.1.5-rc.2","@deepseek-ai/dsh-tool-jobs":"0.1.5-rc.2","@deepseek-ai/dsh-tool-skill":"0.1.5-rc.2","@deepseek-ai/dsh-tool-subagent":"0.1.5-rc.2","@deepseek-ai/dsh-tool-web":"0.1.5-rc.2","@deepseek-ai/dsh-tool-workflow":"0.1.5-rc.2","@deepseek-ai/dsh-tools":"0.1.5-rc.2","@deepseek-ai/dsh-typert-protocol":"0.1.5-rc.2","@deepseek-ai/dsh-typert-registry":"0.1.5-rc.2","@deepseek-ai/dsh-user-approval":"0.1.5-rc.2","@deepseek-ai/dsh-user-questions":"0.1.5-rc.2","@deepseek-ai/dsh-util-values":"0.1.5-rc.2","@deepseek-ai/dsh-web":"0.1.5-rc.2","@deepseek-ai/dsh-web-fetch-http":"0.1.5-rc.2","@deepseek-ai/dsh-web-search-deepseek":"0.1.5-rc.2","@deepseek-ai/dsh-workflow":"0.1.5-rc.2","@deepseek-ai/dsh-workspace":"0.1.5-rc.2","@deepseek-ai/schemastery":"3.18.2","@mixmark-io/domino":"2.2.0","@modelcontextprotocol/sdk":"1.30.0",acorn:"8.18.0","fast-png":"8.0.0","jpeg-js":"0.4.4","just-bash":"3.4.2",playwright:"^1.49.0",sucrase:"3.35.1",typescript:"^6.0.3",vitest:"^4.1.8",ws:"^8.21.0"}}});var Fy,Cde,BI=re(()=>{"use strict";Ade();Fy=uj.version,Cde=uj.dshEdge.upstreamVersion});function uet(e){let t=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/iu.exec(e);if(t!==null)return t[1];let n=/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/iu.exec(e);if(n!==null){let r=parseInt(n[1],16),i=parseInt(n[2],16);return`${String(r>>8)}.${String(r&255)}.${String(i>>8)}.${String(i&255)}`}}function det(e){return/^\d+\.\d+\.\d+\.\d+$/u.test(e)||e.includes(":")}function pp(e){let t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error("MCP server URL must use http: or https: protocol.");let n=t.hostname.toLowerCase(),r=n.endsWith(".")?n.slice(0,-1):n,i=r.startsWith("[")&&r.endsWith("]")?r.slice(1,-1):r;if(!(i==="localhost"||i==="127.0.0.1"||i==="::1")){for(let s of oet)if(i.endsWith(s))throw new Error(`MCP server hostname "${i}" is blocked.`);if(det(i)){let s=uet(i),o=s??i;for(let l of aet)if(l.test(o))throw new Error(`MCP server address "${i}" is a private IP and is blocked.`);if(s===void 0){for(let l of cet)if(l.test(i))throw new Error(`MCP server address "${i}" is a private IP and is blocked.`)}}}}function pet(e){return e?.type==="bearer"&&e.token!==void 0?{Authorization:`Bearer ${e.token}`}:{}}async function Rde(e,t,n){pp(e);let r=new MI(new URL(e),{requestInit:{headers:pet(t),signal:n},fetch:Dm}),i=new NI({name:"dsh-edge",version:Fy},{capabilities:{},jsonSchemaValidator:fet});return await i.connect(r),{client:i,close:a(async()=>{await i.close().catch(()=>{})},"close")}}async function $de(e,t,n){let r=AbortSignal.timeout(Hs.probeTimeoutMs),i;try{i=await Rde(t,n,r)}catch(l){throw new Error(dd(l instanceof Error?l.message:String(l)))}let{client:s,close:o}=i;try{let l=[],c=new Set,u=new Set,d;for(let f=0;f<Hs.maxCatalogPages;f++){let g=await s.listTools(d===void 0?void 0:{cursor:d},{signal:r});for(let y of g.tools){if(l.length>=Hs.maxToolsPerServer)break;let v=Ede(e,y.name);if(c.has(v))throw new Error(`Server listed tool "${y.name}" more than once`);c.add(v);let w=y.annotations?.readOnlyHint,b=_de(y.outputSchema);l.push({name:y.name,publicName:v,description:y.description??"",inputSchema:y.inputSchema??{type:"object"},...b!==void 0?{outputSchema:b}:{},...w!==void 0?{annotations:{readOnlyHint:w}}:{}})}if(l.length>=Hs.maxToolsPerServer||(d=g.nextCursor??void 0,d===void 0))break;if(u.has(d))throw new Error("Server repeated a tools/list continuation cursor");u.add(d)}let p=s.getServerVersion?.(),h=s.getInstructions?.();return{tools:l,serverInfo:p?{name:p.name,version:p.version}:void 0,instructions:typeof h=="string"&&h.length>0?h.slice(0,Hs.maxInstructionsLength):void 0}}finally{await o()}}async function WI(e,t,n,r,i,s){let o=s??Hs.callTimeoutMs,l=i?AbortSignal.any([i,AbortSignal.timeout(o)]):AbortSignal.timeout(o),c;try{c=await Rde(e,r,l)}catch(u){throw new Error(dd(u instanceof Error?u.message:String(u)))}try{let u=await c.client.callTool({name:t,arguments:n},void 0,{signal:l});return{content:u.content??[],structuredContent:u.structuredContent,isError:u.isError===!0}}catch(u){throw new Error(dd(u instanceof Error?u.message:String(u)))}finally{await c.close()}}var oet,aet,cet,fet,Dm,Ew=re(()=>{"use strict";Due();hde();Sde();zI();UI();BI();oet=[".internal",".local",".localhost"],aet=[/^127\./u,/^10\./u,/^172\.(1[6-9]|2\d|3[01])\./u,/^192\.168\./u,/^0\./u,/^169\.254\./u],cet=[/^::1$/u,/^fc/iu,/^fd/iu,/^fe[89ab][0-9a-f]:/iu];a(uet,"extractMappedIPv4");a(det,"isIpAddress");a(pp,"assertSafeUrl");a(pet,"buildHeaders");fet=new qI,Dm=a(async(e,t)=>{let n=await globalThis.fetch(e,{...t,redirect:"manual"});if(n.status>=300&&n.status<400)throw new Error(`MCP server returned HTTP ${String(n.status)} redirect; redirects are blocked for security.`);return n},"noRedirectFetch");a(Rde,"connectClient");a($de,"probe");a(WI,"callTool")});import{Buffer as het}from"node:buffer";function vet(e){return e instanceof Error&&"code"in e&&typeof e.code=="string"&&yet.has(e.code)}function Pde(e){return e instanceof Error&&"code"in e&&typeof e.code=="string"&&get.has(e.code)}function Nde(e,t,n){let r=het.from(e,"base64");if(e.length===0&&t==="reject"||r.toString("base64")!==e)throw new Wn(n==="INVALID_IMAGE_BASE64"?"Image upload is not canonical base64.":"File upload is not canonical base64.",n);return new Uint8Array(r)}function xet(e){return Nde(e,"reject","INVALID_IMAGE_BASE64")}function bet(e){return{data:xet(e.data),mediaType:e.mediaType,...e.name===void 0?{}:{name:e.name}}}async function _w(e,t){return e.saveImages(t.map(bet))}async function wet(e,t){return e.saveFile({data:Nde(t.data,"accept","INVALID_FILE_BASE64"),...t.name===void 0?{}:{name:t.name}})}function Dde(e,t,n){let r=Math.min(1,Math.sqrt(n/(e*t)));if(r===1)return{width:e,height:t};if(e>=t){let o=Math.max(1,Math.floor(e*r)),l=Math.max(1,Math.round(o*t/e));for(;o*l>n&&o>1;)o-=1,l=Math.max(1,Math.round(o*t/e));return{width:o,height:l}}let i=Math.max(1,Math.floor(t*r)),s=Math.max(1,Math.round(i*e/t));for(;s*i>n&&i>1;)i-=1,s=Math.max(1,Math.round(i*e/t));return{width:s,height:i}}var Ode,met,get,yet,Wn,dj,fp=re(()=>{Qn();Ode=["TOO_MANY_IMAGES","IMAGES_TOO_LARGE","UNSUPPORTED_IMAGE_TYPE","INVALID_IMAGE_BASE64","INVALID_IMAGE","IMAGE_TYPE_MISMATCH","IMAGE_TOO_LARGE","IMAGE_TOO_MANY_PIXELS","IMAGE_DIMENSION_TOO_LARGE"],met=[...Ode,"INVALID_FILE_BASE64","INVALID_ATTACHMENT_REF","ATTACHMENT_CORRUPT","ATTACHMENT_WRITE_FAILED","ATTACHMENT_NOT_FOUND","ATTACHMENT_READ_FAILED","ATTACHMENT_PROJECTION_UNSUPPORTED","ATTACHMENT_FILES_UNSUPPORTED"],get=new Set(Ode),yet=new Set(met),Wn=class extends Error{static{a(this,"AttachmentError")}code;constructor(e,t,n){super(e,n),this.name="AttachmentError",this.code=t}};a(vet,"isAttachmentError");a(Pde,"isImageAdmissionError");a(Nde,"decodeCanonicalBase64");a(xet,"decodeBase64");a(bet,"saveInput");a(_w,"admitEncodedImages");a(wet,"admitEncodedFile");a(Dde,"requestImageDimensions");dj=class extends At{static{a(this,"AttachmentStore")}constructor(e){super(e,"attachments")}validateImageBatch(e){let{maxImagesPerMessage:t,maxMessageImageBytes:n,mediaTypes:r}=this.imageLimits;if(e.length>t)throw new Wn("Image batch exceeds the configured image-count limit.","TOO_MANY_IMAGES");if(e.reduce((i,s)=>i+s.data.byteLength,0)>n)throw new Wn("Image batch exceeds the configured aggregate image-byte limit.","IMAGES_TOO_LARGE");for(let i of e)if(!r.includes(i.mediaType))throw new Wn(`Image type ${i.mediaType} is not accepted by this deployment.`,"UNSUPPORTED_IMAGE_TYPE")}async saveImages(e){this.validateImageBatch(e);for(let n of e)await this.validateImage(n);let t=[];for(let n of e)t.push(await this.saveImage(n));return t}async admitPromptContent(e){if(e.every(r=>r.type!=="image"))return e.map(r=>r.type==="text"?{type:"text",text:r.text}:{type:"file",attachment:r.attachment});let t=await _w(this,e.filter(r=>r.type==="image")),n=0;return e.map(r=>r.type==="text"?{type:"text",text:r.text}:r.type==="file"?{type:"file",attachment:r.attachment}:{type:"image",attachment:t[n++]})}admitEncodedFile(e){return wet(this,e)}isAttachmentError(e){return vet(e)}imageHostPath(e){}saveFile(e){return Promise.reject(new Wn("The mounted attachment provider cannot store verbatim files.","ATTACHMENT_FILES_UNSUPPORTED"))}saveFileStream(e){return Promise.reject(new Wn("The mounted attachment provider cannot stream verbatim files.","ATTACHMENT_FILES_UNSUPPORTED"))}async*readFileStream(e,t){t?.throwIfAborted(),await Promise.reject(new Wn("The mounted attachment provider cannot read verbatim files.","ATTACHMENT_FILES_UNSUPPORTED"))}fileHostPath(e){}readImageRequest(e,t,n){return n?.throwIfAborted(),Promise.reject(new Wn("The mounted attachment provider cannot derive model-request images.","ATTACHMENT_PROJECTION_UNSUPPORTED"))}}});var VI={};On(VI,{buildAuthorizationUrl:()=>$et,discoverEndpoints:()=>Cet,exchangeCode:()=>Oet,isTokenExpired:()=>Net,refreshToken:()=>Pet,registerClient:()=>Ret});function jde(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(2,"0")).join("").slice(0,e)}async function Aet(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return btoa(String.fromCharCode(...new Uint8Array(n))).replace(/\+/gu,"-").replace(/\//gu,"_").replace(/=/gu,"")}async function Cet(e){let t=AbortSignal.timeout(HI),n=new URL(e),r=n.pathname==="/"?"/.well-known/oauth-protected-resource":`/.well-known/oauth-protected-resource${n.pathname}`,i=new URL(r,n.origin);pp(i.href);let s=await Dm(i.href,{signal:t});if(!s.ok)throw new Error(`PRM discovery failed: HTTP ${s.status}`);let l=(await s.json()).authorization_servers?.[0];if(typeof l!="string")throw new Error("No authorization server in PRM");let c=new URL(l),u=c.pathname==="/"?"/.well-known/oauth-authorization-server":`/.well-known/oauth-authorization-server${c.pathname}`,d=new URL(u,c.origin);pp(d.href);let p=await Dm(d.href,{signal:t});if(!p.ok)throw new Error(`AS metadata failed: HTTP ${p.status}`);let h=await p.json();if(typeof h.authorization_endpoint!="string"||typeof h.token_endpoint!="string")throw new Error("Missing required endpoints in AS metadata");return{authorization:h.authorization_endpoint,token:h.token_endpoint,registration:h.registration_endpoint}}async function Ret(e,t,n){let r=AbortSignal.timeout(HI);pp(e);let i=await Dm(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({client_name:n,redirect_uris:[t],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none"}),signal:r});if(!i.ok)throw new Error(`DCR failed: HTTP ${i.status}`);let s=await i.json();if(typeof s.client_id!="string")throw new Error("DCR response missing client_id");return{clientId:s.client_id,clientSecret:s.client_secret}}async function $et(e,t,n,r,i){let s=jde(32),o=jde(64),l=await Aet(o),c=new URL(e.authorization);for(let[u,d]of Object.entries({response_type:"code",client_id:t.clientId,redirect_uri:n,state:s,code_challenge:l,code_challenge_method:"S256",resource:i}))c.searchParams.set(u,d);return{authorizationUrl:c.href,pendingFlow:{state:s,codeVerifier:o,redirectUri:n,serverName:r,serverUrl:i,stagedClient:t,createdAt:Date.now()}}}async function Oet(e,t,n,r,i,s){let o=AbortSignal.timeout(HI),l=new URLSearchParams({grant_type:"authorization_code",code:n,redirect_uri:i,client_id:t.clientId,code_verifier:r});s!==void 0&&l.set("resource",s),t.clientSecret!==void 0&&l.set("client_secret",t.clientSecret),pp(e);let c=await Dm(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:l.toString(),signal:o});if(!c.ok)throw new Error(`Token exchange failed: HTTP ${c.status}`);return qde(await c.json())}async function Pet(e,t,n,r){let i=AbortSignal.timeout(HI),s=new URLSearchParams({grant_type:"refresh_token",refresh_token:n,client_id:t.clientId});r!==void 0&&s.set("resource",r),t.clientSecret!==void 0&&s.set("client_secret",t.clientSecret),pp(e);let o=await Dm(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s.toString(),signal:i});if(!o.ok)throw new Error(`Token refresh failed: HTTP ${o.status}`);return qde(await o.json())}function qde(e){let t=e;if(typeof t.access_token!="string")throw new Error("Missing access_token");let n=typeof t.expires_in=="number"?t.expires_in:void 0;return{accessToken:t.access_token,refreshToken:typeof t.refresh_token=="string"?t.refresh_token:void 0,expiresAt:n!==void 0?Date.now()+n*1e3:void 0,tokenType:typeof t.token_type=="string"?t.token_type:"Bearer",scope:typeof t.scope=="string"?t.scope:void 0}}function Net(e){return e.expiresAt===void 0?!1:Date.now()>e.expiresAt-12e4}var HI,GI=re(()=>{"use strict";Ew();HI=1e4;a(jde,"randomString");a(Aet,"sha256Base64Url");a(Cet,"discoverEndpoints");a(Ret,"registerClient");a($et,"buildAuthorizationUrl");a(Oet,"exchangeCode");a(Pet,"refreshToken");a(qde,"parseTokenResponse");a(Net,"isTokenExpired")});var Kn,Zde,KI=re(()=>{Qn();Ir();Kn=class extends Pr{static{a(this,"FsError")}code;constructor(e,t,n){super(e,t,n),this.code=t}},Zde=class extends At{static{a(this,"FileSystem")}constructor(e){super(e,"fs")}get sandboxMode(){}processPathFromHostPath(e){}}});function Cj(e){return sA.test(e)}function oA(e){return e.invocation.modelInvocable}function qy(e){return e.invocation.userInvocable}function Rj(e){let t=mnt(e);return[`<skill_content name="${gnt(e.name)}">`,"<skill_resources>",...t,"</skill_resources>","","<skill_instructions>",e.content,"</skill_instructions>","</skill_content>"].join(`
|
|
154
154
|
`)}function mnt(e){let t=e.resourceBase;if(t===void 0)return[`Resources for this skill are managed by provider "${jy(e.provider)}".`,"Load referenced resources only as needed."];switch(t.kind){case"directory":return[`Base directory for this skill: ${jy(t.path)}`,"Resolve relative paths mentioned by this skill against the base directory before using them. Load referenced resources only as needed."];case"url":return[`Base URL for this skill: ${jy(t.url)}`,"Resolve relative URLs mentioned by this skill against the base URL before using them. Load referenced resources only as needed."];case"opaque":return[`Resources for this skill: ${jy(t.description)}`,"Load referenced resources only as needed."];default:return wi(t,"SkillResourceBase.kind")}}function gnt(e){return e.replaceAll("&","&").replaceAll('"',""").replaceAll("<","<")}function jy(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")}function vnt(e,t){if(Array.isArray(e))return{candidates:e,complete:!0};if(e===null||typeof e!="object")throw wpe(t);let n=e;if(!Array.isArray(n.candidates)||typeof n.complete!="boolean")throw wpe(t);return n}function wpe(e){return new TypeError(`skill provider "${e}" list() must return an array or { candidates, complete } observation`)}function bnt(e){return{name:e.name,description:e.description,...e.whenToUse!==void 0?{whenToUse:e.whenToUse}:{},invocation:e.invocation,source:e.source,provider:e.provider,...e.resourceBase!==void 0?{resourceBase:e.resourceBase}:{},rank:hnt,locator:e,...e.path!==void 0?{path:e.path}:{},...e.metadata!==void 0?{metadata:e.metadata}:{}}}function wnt(e,t){if(typeof e.name!="string")throw new TypeError(`skill provider "${t}" returned a non-string skill name`);if(!sA.test(e.name))throw new Error(`skill provider "${t}" returned invalid skill name "${e.name}"`);if(typeof e.description!="string")throw new TypeError(`skill provider "${t}" returned skill "${e.name}" with a non-string description`);if(e.description.length===0)throw new Error(`skill provider "${t}" returned skill "${e.name}" without a description`);if($j(e.invocation,`skill provider "${t}" returned skill "${e.name}"`),e.whenToUse!==void 0&&typeof e.whenToUse!="string")throw new TypeError(`skill provider "${t}" returned skill "${e.name}" with a non-string whenToUse`);if(typeof e.source!="string")throw new TypeError(`skill provider "${t}" returned skill "${e.name}" with a non-string source`);if(typeof e.rank!="number"||!Number.isFinite(e.rank))throw new Error(`skill provider "${t}" returned skill "${e.name}" with an invalid rank`);if(typeof e.provider!="string")throw new TypeError(`skill provider "${t}" returned skill "${e.name}" with a non-string provider`);if(e.provider!==t)throw new Error(`skill provider "${t}" returned skill "${e.name}" for provider "${e.provider}"`);if(e.path!==void 0&&typeof e.path!="string")throw new TypeError(`skill provider "${t}" returned skill "${e.name}" with a non-string path`)}function Snt(e){if(!sA.test(e.name))throw new Error(`invalid skill name "${e.name}"`);if(e.description.length===0)throw new Error(`skill "${e.name}" requires a description`);$j(e.invocation,`runtime skill "${e.name}"`)}function knt(e){let t=e.name,n=e.description,r=e.whenToUse,i=e.invocation,s=e.source,o=e.provider,l=e.content,c=e.path;if(typeof t!="string")throw new TypeError("loaded skill name must be a string");if(!sA.test(t))throw new Error(`loaded skill has invalid name "${t}"`);if(typeof n!="string")throw new TypeError(`loaded skill "${t}" description must be a string`);if(n.length===0)throw new Error(`loaded skill "${t}" requires a description`);if($j(i,`loaded skill "${t}"`),r!==void 0&&typeof r!="string")throw new TypeError(`loaded skill "${t}" whenToUse must be a string`);if(typeof s!="string")throw new TypeError(`loaded skill "${t}" source must be a string`);if(typeof o!="string")throw new TypeError(`loaded skill "${t}" provider must be a string`);if(typeof l!="string")throw new TypeError(`loaded skill "${t}" content must be a string`);if(c!==void 0&&typeof c!="string")throw new TypeError(`loaded skill "${t}" path must be a string`)}function Ent(e){let{name:t,description:n,whenToUse:r,invocation:i,source:s,provider:o,resourceBase:l}=e;return{name:t,description:n,...r!==void 0?{whenToUse:r}:{},invocation:i,source:s,provider:o,...l!==void 0?{resourceBase:l}:{}}}function $j(e,t){if(e===void 0)return;if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError(`${t} with a non-object invocation policy`);let n=e;if(typeof n.modelInvocable!="boolean")throw new TypeError(`${t} with a non-boolean invocation.modelInvocable`);if(typeof n.userInvocable!="boolean")throw new TypeError(`${t} with a non-boolean invocation.userInvocable`)}function _nt(e,t){return _pe(e.name,t.name)}function _pe(e,t){return e<t?-1:e>t?1:0}function Tnt(e,t){return e.candidate.rank-t.candidate.rank||e.providerOrder-t.providerOrder||e.localOrder-t.localOrder}function Int(e,t,n=1){if(!Number.isInteger(t)||t<n)throw new Error(`skill: ${e} must be an integer greater than or equal to ${n}`)}function Spe(e,t){return t===void 0?e:(Cw(t),new Promise((n,r)=>{let i=a(()=>{t.removeEventListener("abort",s)},"cleanup"),s=a(()=>{i(),r(iA(t.reason))},"onAbort");t.addEventListener("abort",s,{once:!0}),e.then(o=>{i(),n(o)},o=>{i(),r(iA(o))})}))}function Cw(e){if(e?.aborted===!0)throw iA(e.reason)}function iA(e){try{if(e instanceof Error)return e}catch{}return new Error(rA(e))}function rA(e){try{return String(e)}catch{return"[unrenderable thrown value]"}}var sA,bpe,fnt,nA,hnt,kpe,ynt,Epe,xnt,Uy=re(()=>{Qn();cs();Ja();ir();sA=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,bpe=128,fnt=2,nA="runtime",hnt=250,kpe=600;a(Cj,"isSkillName");a(oA,"isModelInvocable");a(qy,"isUserInvocable");a(Rj,"renderSkillContent");a(mnt,"renderResourceHint");a(gnt,"escapeAttr");a(jy,"escapeText");ynt=class{static{a(this,"SkillLayer")}providers;runtime=new Map;constructor(e){this.providers=new ed(t=>new Error(e===void 0?`a skill provider named "${t}" is already registered`:`a skill provider named "${t}" is already registered in this scope`))}isEmpty(){return this.providers.isEmpty()&&this.runtime.size===0}},Epe=class extends At{static{a(this,"SkillRegistry")}static Config=j.object({collectCacheMaxEntries:j.number().default(bpe)});collectCacheMaxEntries;layers=new nd(e=>new ynt(e),()=>{this.invalidateCache()});collectCache=new Map;revision=0;nextProviderOrder=0;scopeIds=new WeakMap;nextScopeId=1;constructor(e,t={}){super(e,"skills"),this.collectCacheMaxEntries=t.collectCacheMaxEntries??bpe,Int("collectCacheMaxEntries",this.collectCacheMaxEntries)}registerProvider(e){let t=new AbortController,n,r,i={signal:t.signal,invalidate:a(()=>{let s=n;s!==void 0&&s.layer.providers.get(s.name)?.provider===r&&this.invalidateCache()},"invalidate")};try{r=e(i);let s=r.name;if(s===nA)throw new Error(`"${nA}" is reserved for runtime skill registrations`);let o=this.nextProviderOrder;return this.nextProviderOrder+=1,this.layers.effect(this.ctx,l=>{let c=l.providers.insert(s,{provider:r,order:o});return n={layer:l,name:s},()=>{n=void 0,c(),t.abort(new Error(`skill provider "${s}" disposed`))}},{label:"skills.registerProvider()"})}catch(s){throw t.abort(s),s}}register(e){Snt(e);let t=aa(this.ctx),n=t===void 0?this.layers.global:this.layers.peek(t);if(n!==void 0&&n.runtime.has(e.name))return this.ctx.logger.warn(`runtime skill "${e.name}" ignored because it is already registered`),()=>{};let r={...e,invocation:e.invocation??{modelInvocable:!0,userInvocable:!0},provider:e.provider??nA};return this.layers.effect(this.ctx,i=>(i.runtime.set(r.name,r),()=>{i.runtime.delete(r.name)}),{label:"skills.register()"})}async list(e={}){return(await this.snapshot(e)).skills}async snapshot(e={}){let t=await this.collect(e);return{skills:[...t.entries.values()].map(n=>Ent(n.candidate)).sort(_nt),complete:t.cacheable}}async get(e,t={}){if(!Cj(e))return;let n=await this.collect(t);Cw(t.signal);let r=n.entries.get(e);if(r===void 0)return;let i=await Spe(r.provider.get(r.candidate,t),t.signal);if(i!==void 0){if(knt(i),i.name!==r.candidate.name){this.invalidateEntry(r);return}return i}}async collect(e){Cw(e.signal);let t=1;for(;;){let n=this.revision,r=this.collectCacheKey(e.cwd,Xx(e.scope),n),i=this.collectCache.get(r);if(i!==void 0)return{entries:i,cacheable:!0};let s=await this.collectFresh(e);if(Cw(e.signal),n!==this.revision){if(t<fnt){t+=1;continue}return{entries:s.entries,cacheable:!1}}if(s.cacheable&&(this.collectCache.set(r,s.entries),this.collectCache.size>this.collectCacheMaxEntries)){let o=this.collectCache.keys().next();this.collectCache.delete(o.value)}return s}}async collectFresh(e){let t=[this.layers.global,...this.layers.chainLayers(e.scope)],n=new Map,r=!0;for(let i of t){let s=await this.collectLayer(i,e);s.cacheable||(r=!1);for(let o of s.entries)n.set(o.candidate.name,o)}return{entries:n,cacheable:r}}async collectLayer(e,t){let n=await this.listLayerCandidates(e,t);n.entries.sort(Tnt);let r=new Set,i=[];for(let s of n.entries){let o=s.candidate;if(r.has(o.name)){this.ctx.logger.warn(`skill "${o.name}" from ${o.source} ignored because a higher-priority skill already exists`);continue}r.add(o.name),i.push(s)}return{entries:i,cacheable:n.cacheable}}async listLayerCandidates(e,t){Cw(t.signal);let n=[],r=!0,i=0;for(let s of[...e.runtime.values()].sort((o,l)=>_pe(o.name,l.name)))n.push({candidate:bnt(s),provider:xnt,providerOrder:-1,localOrder:i,layer:e}),i+=1;for(let{provider:s,order:o}of[...e.providers.values()]){let l=0,c;try{c=await Spe(s.list(t),t.signal)}catch(d){if(t.signal?.aborted===!0)throw iA(t.signal.reason);r=!1,this.ctx.logger.warn(`skill provider "${s.name}" skipped: ${rA(d)}`)}if(c===void 0)continue;let u=vnt(c,s.name);u.complete||(r=!1);for(let d of u.candidates)wnt(d,s.name),n.push({candidate:d,provider:s,providerOrder:o,localOrder:l,layer:e}),l+=1}return{entries:n,cacheable:r}}invalidateCache(){this.revision+=1,this.collectCache.clear(),this.notifyChange()}invalidateEntry(e){e.layer.providers.get(e.provider.name)?.provider===e.provider&&this.invalidateCache()}scopeId(e){let t=this.scopeIds.get(e);return t===void 0&&(t=this.nextScopeId,this.nextScopeId+=1,this.scopeIds.set(e,t)),t}collectCacheKey(e,t,n){return JSON.stringify({cwd:e,scopes:t.map(r=>this.scopeId(r)),revision:n})}notifyChange(){for(let e of this.ctx.events.dispatch("emit",["skills/change"]))try{let t=e();Promise.resolve(t).catch(n=>{this.ctx.logger.warn(`skills/change listener rejected: ${rA(n)}`)})}catch(t){this.ctx.logger.warn(`skills/change listener threw: ${rA(t)}`)}}};a(vnt,"normalizeProviderObservation");a(wpe,"invalidProviderObservation");xnt={name:nA,list(){return Promise.resolve([])},get(e){return Promise.resolve(e.locator)}};a(bnt,"runtimeCandidate");a(wnt,"validateCandidate");a(Snt,"validateRuntimeSkill");a(knt,"validateDefinition");a(Ent,"toSummary");a($j,"validateInvocation");a(_nt,"compareSkillSummary");a(_pe,"compareCodePoints");a(Tnt,"compareIndexedCandidates");a(Int,"assertPositiveInteger");a(Spe,"waitWithAbort");a(Cw,"throwIfAborted");a(iA,"toError");a(rA,"errorMessage")});var ou,By=re(()=>{ou=class{static{a(this,"Deque")}buffer=new Array(16);head=0;count=0;get size(){return this.count}pushBack(e){this.ensureCapacity();let t=this.head+this.count;this.buffer[t<this.buffer.length?t:t-this.buffer.length]=e,this.count+=1}pushFront(e){this.ensureCapacity(),this.head=this.head===0?this.buffer.length-1:this.head-1,this.buffer[this.head]=e,this.count+=1}popFront(){if(this.count===0)return;let e=this.buffer[this.head];return this.buffer[this.head]=void 0,this.head+=1,this.head===this.buffer.length&&(this.head=0),this.count-=1,this.compact(),e}clear(){this.buffer=new Array(16),this.head=0,this.count=0}ensureCapacity(){this.count<this.buffer.length||this.resize(this.buffer.length*2)}compact(){if(this.count===0){this.head=0;return}this.buffer.length>16&&this.count<=this.buffer.length/4&&this.resize(Math.max(16,this.buffer.length/2))}resize(e){let t=new Array(e),n=this.head;for(let r=0;r<this.count;r+=1)t[r]=this.buffer[n],n+=1,n===this.buffer.length&&(n=0);this.buffer=t,this.head=0}}});var mp,lfe,Wj=re(()=>{Qn();mp=class extends Error{static{a(this,"DirectoryPickerError")}code;path;constructor(e,t,n){super(n),this.code=e,this.path=t,this.name="DirectoryPickerError"}},lfe=class extends At{static{a(this,"DirectoryPicker")}constructor(e){super(e,"directoryPicker")}}});var Nhe=de((fun,jA)=>{var Phe=Phe||function(e){return Buffer.from(e).toString("base64")};function yot(e){var t=this,n=Math.round,r=Math.floor,i=new Array(64),s=new Array(64),o=new Array(64),l=new Array(64),c,u,d,p,h=new Array(65535),f=new Array(65535),g=new Array(64),y=new Array(64),v=[],w=0,b=7,S=new Array(64),k=new Array(64),E=new Array(64),T=new Array(256),I=new Array(2048),N,P=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],F=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],$=[0,1,2,3,4,5,6,7,8,9,10,11],U=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],K=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],A=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],H=[0,1,2,3,4,5,6,7,8,9,10,11],ee=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],G=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function B(te){for(var Oe=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],he=0;he<64;he++){var nt=r((Oe[he]*te+50)/100);nt<1?nt=1:nt>255&&(nt=255),i[P[he]]=nt}for(var Me=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],Re=0;Re<64;Re++){var pt=r((Me[Re]*te+50)/100);pt<1?pt=1:pt>255&&(pt=255),s[P[Re]]=pt}for(var Ke=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],je=0,ut=0;ut<8;ut++)for(var Se=0;Se<8;Se++)o[je]=1/(i[P[je]]*Ke[ut]*Ke[Se]*8),l[je]=1/(s[P[je]]*Ke[ut]*Ke[Se]*8),je++}a(B,"initQuantTables");function L(te,Oe){for(var he=0,nt=0,Me=new Array,Re=1;Re<=16;Re++){for(var pt=1;pt<=te[Re];pt++)Me[Oe[nt]]=[],Me[Oe[nt]][0]=he,Me[Oe[nt]][1]=Re,nt++,he++;he*=2}return Me}a(L,"computeHuffmanTbl");function W(){c=L(F,$),u=L(A,H),d=L(U,K),p=L(ee,G)}a(W,"initHuffmanTbl");function ae(){for(var te=1,Oe=2,he=1;he<=15;he++){for(var nt=te;nt<Oe;nt++)f[32767+nt]=he,h[32767+nt]=[],h[32767+nt][1]=he,h[32767+nt][0]=nt;for(var Me=-(Oe-1);Me<=-te;Me++)f[32767+Me]=he,h[32767+Me]=[],h[32767+Me][1]=he,h[32767+Me][0]=Oe-1+Me;te<<=1,Oe<<=1}}a(ae,"initCategoryNumber");function fe(){for(var te=0;te<256;te++)I[te]=19595*te,I[te+256>>0]=38470*te,I[te+512>>0]=7471*te+32768,I[te+768>>0]=-11059*te,I[te+1024>>0]=-21709*te,I[te+1280>>0]=32768*te+8421375,I[te+1536>>0]=-27439*te,I[te+1792>>0]=-5329*te}a(fe,"initRGBYUVTable");function ue(te){for(var Oe=te[0],he=te[1]-1;he>=0;)Oe&1<<he&&(w|=1<<b),he--,b--,b<0&&(w==255?(z(255),z(0)):z(w),b=7,w=0)}a(ue,"writeBits");function z(te){v.push(te)}a(z,"writeByte");function Ce(te){z(te>>8&255),z(te&255)}a(Ce,"writeWord");function Xe(te,Oe){var he,nt,Me,Re,pt,Ke,je,ut,Se=0,yt,Mt=8,it=64;for(yt=0;yt<Mt;++yt){he=te[Se],nt=te[Se+1],Me=te[Se+2],Re=te[Se+3],pt=te[Se+4],Ke=te[Se+5],je=te[Se+6],ut=te[Se+7];var an=he+ut,Dt=he-ut,Rt=nt+je,ne=nt-je,_e=Me+Ke,Fe=Me-Ke,Ye=Re+pt,wt=Re-pt,Be=an+Ye,Jt=an-Ye,Gt=Rt+_e,ln=Rt-_e;te[Se]=Be+Gt,te[Se+4]=Be-Gt;var Tt=(ln+Jt)*.707106781;te[Se+2]=Jt+Tt,te[Se+6]=Jt-Tt,Be=wt+Fe,Gt=Fe+ne,ln=ne+Dt;var pr=(Be-ln)*.382683433,gr=.5411961*Be+pr,Li=1.306562965*ln+pr,ti=Gt*.707106781,Vn=Dt+ti,Fi=Dt-ti;te[Se+5]=Fi+gr,te[Se+3]=Fi-gr,te[Se+1]=Vn+Li,te[Se+7]=Vn-Li,Se+=8}for(Se=0,yt=0;yt<Mt;++yt){he=te[Se],nt=te[Se+8],Me=te[Se+16],Re=te[Se+24],pt=te[Se+32],Ke=te[Se+40],je=te[Se+48],ut=te[Se+56];var as=he+ut,Es=he-ut,Ls=nt+je,$t=nt-je,xn=Me+Ke,Fs=Me-Ke,No=Re+pt,no=Re-pt,ro=as+No,po=as-No,Do=Ls+xn,na=Ls-xn;te[Se]=ro+Do,te[Se+32]=ro-Do;var Sl=(na+po)*.707106781;te[Se+16]=po+Sl,te[Se+48]=po-Sl,ro=no+Fs,Do=Fs+$t,na=$t+Es;var Ua=(ro-na)*.382683433,Fc=.5411961*ro+Ua,jc=1.306562965*na+Ua,qc=Do*.707106781,Uc=Es+qc,Wd=Es-qc;te[Se+40]=Wd+Fc,te[Se+24]=Wd-Fc,te[Se+8]=Uc+jc,te[Se+56]=Uc-jc,Se++}var Mu;for(yt=0;yt<it;++yt)Mu=te[yt]*Oe[yt],g[yt]=Mu>0?Mu+.5|0:Mu-.5|0;return g}a(Xe,"fDCTQuant");function qe(){Ce(65504),Ce(16),z(74),z(70),z(73),z(70),z(0),z(1),z(1),z(0),Ce(1),Ce(1),z(0),z(0)}a(qe,"writeAPP0");function Te(te){if(te){Ce(65505),te[0]===69&&te[1]===120&&te[2]===105&&te[3]===102?Ce(te.length+2):(Ce(te.length+5+2),z(69),z(120),z(105),z(102),z(0));for(var Oe=0;Oe<te.length;Oe++)z(te[Oe])}}a(Te,"writeAPP1");function at(te,Oe){Ce(65472),Ce(17),z(8),Ce(Oe),Ce(te),z(3),z(1),z(17),z(0),z(2),z(17),z(1),z(3),z(17),z(1)}a(at,"writeSOF0");function ze(){Ce(65499),Ce(132),z(0);for(var te=0;te<64;te++)z(i[te]);z(1);for(var Oe=0;Oe<64;Oe++)z(s[Oe])}a(ze,"writeDQT");function xe(){Ce(65476),Ce(418),z(0);for(var te=0;te<16;te++)z(F[te+1]);for(var Oe=0;Oe<=11;Oe++)z($[Oe]);z(16);for(var he=0;he<16;he++)z(U[he+1]);for(var nt=0;nt<=161;nt++)z(K[nt]);z(1);for(var Me=0;Me<16;Me++)z(A[Me+1]);for(var Re=0;Re<=11;Re++)z(H[Re]);z(17);for(var pt=0;pt<16;pt++)z(ee[pt+1]);for(var Ke=0;Ke<=161;Ke++)z(G[Ke])}a(xe,"writeDHT");function me(te){typeof te>"u"||te.constructor!==Array||te.forEach(Oe=>{if(typeof Oe=="string"){Ce(65534);var he=Oe.length;Ce(he+2);var nt;for(nt=0;nt<he;nt++)z(Oe.charCodeAt(nt))}})}a(me,"writeCOM");function xt(){Ce(65498),Ce(12),z(3),z(1),z(0),z(2),z(17),z(3),z(17),z(0),z(63),z(0)}a(xt,"writeSOS");function Qe(te,Oe,he,nt,Me){for(var Re=Me[0],pt=Me[240],Ke,je=16,ut=63,Se=64,yt=Xe(te,Oe),Mt=0;Mt<Se;++Mt)y[P[Mt]]=yt[Mt];var it=y[0]-he;he=y[0],it==0?ue(nt[0]):(Ke=32767+it,ue(nt[f[Ke]]),ue(h[Ke]));for(var an=63;an>0&&y[an]==0;an--);if(an==0)return ue(Re),he;for(var Dt=1,Rt;Dt<=an;){for(var ne=Dt;y[Dt]==0&&Dt<=an;++Dt);var _e=Dt-ne;if(_e>=je){Rt=_e>>4;for(var Fe=1;Fe<=Rt;++Fe)ue(pt);_e=_e&15}Ke=32767+y[Dt],ue(Me[(_e<<4)+f[Ke]]),ue(h[Ke]),Dt++}return an!=ut&&ue(Re),he}a(Qe,"processDU");function lt(){for(var te=String.fromCharCode,Oe=0;Oe<256;Oe++)T[Oe]=te(Oe)}a(lt,"initCharLookupTable"),this.encode=function(te,Oe){var he=new Date().getTime();Oe&&Ae(Oe),v=new Array,w=0,b=7,Ce(65496),qe(),me(te.comments),Te(te.exifBuffer),ze(),at(te.width,te.height),xe(),xt();var nt=0,Me=0,Re=0;w=0,b=7,this.encode.displayName="_encode_";for(var pt=te.data,Ke=te.width,je=te.height,ut=Ke*4,Se=Ke*3,yt,Mt=0,it,an,Dt,Rt,ne,_e,Fe,Ye;Mt<je;){for(yt=0;yt<ut;){for(Rt=ut*Mt+yt,ne=Rt,_e=-1,Fe=0,Ye=0;Ye<64;Ye++)Fe=Ye>>3,_e=(Ye&7)*4,ne=Rt+Fe*ut+_e,Mt+Fe>=je&&(ne-=ut*(Mt+1+Fe-je)),yt+_e>=ut&&(ne-=yt+_e-ut+4),it=pt[ne++],an=pt[ne++],Dt=pt[ne++],S[Ye]=(I[it]+I[an+256>>0]+I[Dt+512>>0]>>16)-128,k[Ye]=(I[it+768>>0]+I[an+1024>>0]+I[Dt+1280>>0]>>16)-128,E[Ye]=(I[it+1280>>0]+I[an+1536>>0]+I[Dt+1792>>0]>>16)-128;nt=Qe(S,o,nt,c,d),Me=Qe(k,l,Me,u,p),Re=Qe(E,l,Re,u,p),yt+=32}Mt+=8}if(b>=0){var wt=[];wt[1]=b+1,wt[0]=(1<<b+1)-1,ue(wt)}if(Ce(65497),typeof jA>"u")return new Uint8Array(v);return Buffer.from(v);var Be,Jt};function Ae(te){if(te<=0&&(te=1),te>100&&(te=100),N!=te){var Oe=0;te<50?Oe=Math.floor(5e3/te):Oe=Math.floor(200-te*2),B(Oe),N=te}}a(Ae,"setQuality");function ge(){var te=new Date().getTime();e||(e=50),lt(),W(),ae(),fe(),Ae(e);var Oe=new Date().getTime()-te}a(ge,"init"),ge()}a(yot,"JPEGEncoder");typeof jA<"u"?jA.exports=Ohe:typeof window<"u"&&(window["jpeg-js"]=window["jpeg-js"]||{},window["jpeg-js"].encode=Ohe);function Ohe(e,t){typeof t>"u"&&(t=50);var n=new yot(t),r=n.encode(e,t);return{data:r,width:e.width,height:e.height}}a(Ohe,"encode")});var Mhe=de((mun,bq)=>{var xq=a((function(){"use strict";var t=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),n=4017,r=799,i=3406,s=2276,o=1567,l=3784,c=5793,u=2896;function d(){}a(d,"constructor");function p(b,S){for(var k=0,E=[],T,I,N=16;N>0&&!b[N-1];)N--;E.push({children:[],index:0});var P=E[0],F;for(T=0;T<N;T++){for(I=0;I<b[T];I++){for(P=E.pop(),P.children[P.index]=S[k];P.index>0;){if(E.length===0)throw new Error("Could not recreate Huffman Table");P=E.pop()}for(P.index++,E.push(P);E.length<=T;)E.push(F={children:[],index:0}),P.children[P.index]=F.children,P=F;k++}T+1<N&&(E.push(F={children:[],index:0}),P.children[P.index]=F.children,P=F)}return E[0].children}a(p,"buildHuffmanTable");function h(b,S,k,E,T,I,N,P,F,$){var U=k.precision,K=k.samplesPerLine,A=k.scanLines,H=k.mcusPerLine,ee=k.progressive,G=k.maxH,B=k.maxV,L=S,W=0,ae=0;function fe(){if(ae>0)return ae--,W>>ae&1;if(W=b[S++],W==255){var Se=b[S++];if(Se)throw new Error("unexpected marker: "+(W<<8|Se).toString(16))}return ae=7,W>>>7}a(fe,"readBit");function ue(Se){for(var yt=Se,Mt;(Mt=fe())!==null;){if(yt=yt[Mt],typeof yt=="number")return yt;if(typeof yt!="object")throw new Error("invalid huffman sequence")}return null}a(ue,"decodeHuffman");function z(Se){for(var yt=0;Se>0;){var Mt=fe();if(Mt===null)return;yt=yt<<1|Mt,Se--}return yt}a(z,"receive");function Ce(Se){var yt=z(Se);return yt>=1<<Se-1?yt:yt+(-1<<Se)+1}a(Ce,"receiveAndExtend");function Xe(Se,yt){var Mt=ue(Se.huffmanTableDC),it=Mt===0?0:Ce(Mt);yt[0]=Se.pred+=it;for(var an=1;an<64;){var Dt=ue(Se.huffmanTableAC),Rt=Dt&15,ne=Dt>>4;if(Rt===0){if(ne<15)break;an+=16;continue}an+=ne;var _e=t[an];yt[_e]=Ce(Rt),an++}}a(Xe,"decodeBaseline");function qe(Se,yt){var Mt=ue(Se.huffmanTableDC),it=Mt===0?0:Ce(Mt)<<F;yt[0]=Se.pred+=it}a(qe,"decodeDCFirst");function Te(Se,yt){yt[0]|=fe()<<F}a(Te,"decodeDCSuccessive");var at=0;function ze(Se,yt){if(at>0){at--;return}for(var Mt=I,it=N;Mt<=it;){var an=ue(Se.huffmanTableAC),Dt=an&15,Rt=an>>4;if(Dt===0){if(Rt<15){at=z(Rt)+(1<<Rt)-1;break}Mt+=16;continue}Mt+=Rt;var ne=t[Mt];yt[ne]=Ce(Dt)*(1<<F),Mt++}}a(ze,"decodeACFirst");var xe=0,me;function xt(Se,yt){for(var Mt=I,it=N,an=0;Mt<=it;){var Dt=t[Mt],Rt=yt[Dt]<0?-1:1;switch(xe){case 0:var ne=ue(Se.huffmanTableAC),_e=ne&15,an=ne>>4;if(_e===0)an<15?(at=z(an)+(1<<an),xe=4):(an=16,xe=1);else{if(_e!==1)throw new Error("invalid ACn encoding");me=Ce(_e),xe=an?2:3}continue;case 1:case 2:yt[Dt]?yt[Dt]+=(fe()<<F)*Rt:(an--,an===0&&(xe=xe==2?3:0));break;case 3:yt[Dt]?yt[Dt]+=(fe()<<F)*Rt:(yt[Dt]=me<<F,xe=0);break;case 4:yt[Dt]&&(yt[Dt]+=(fe()<<F)*Rt);break}Mt++}xe===4&&(at--,at===0&&(xe=0))}a(xt,"decodeACSuccessive");function Qe(Se,yt,Mt,it,an){var Dt=Mt/H|0,Rt=Mt%H,ne=Dt*Se.v+it,_e=Rt*Se.h+an;Se.blocks[ne]===void 0&&$.tolerantDecoding||yt(Se,Se.blocks[ne][_e])}a(Qe,"decodeMcu");function lt(Se,yt,Mt){var it=Mt/Se.blocksPerLine|0,an=Mt%Se.blocksPerLine;Se.blocks[it]===void 0&&$.tolerantDecoding||yt(Se,Se.blocks[it][an])}a(lt,"decodeBlock");var Ae=E.length,ge,te,Oe,he,nt,Me;ee?I===0?Me=P===0?qe:Te:Me=P===0?ze:xt:Me=Xe;var Re=0,pt,Ke;Ae==1?Ke=E[0].blocksPerLine*E[0].blocksPerColumn:Ke=H*k.mcusPerColumn,T||(T=Ke);for(var je,ut;Re<Ke;){for(te=0;te<Ae;te++)E[te].pred=0;if(at=0,Ae==1)for(ge=E[0],nt=0;nt<T;nt++)lt(ge,Me,Re),Re++;else for(nt=0;nt<T;nt++){for(te=0;te<Ae;te++)for(ge=E[te],je=ge.h,ut=ge.v,Oe=0;Oe<ut;Oe++)for(he=0;he<je;he++)Qe(ge,Me,Re,Oe,he);if(Re++,Re===Ke)break}if(Re===Ke)do{if(b[S]===255&&b[S+1]!==0)break;S+=1}while(S<b.length-2);if(ae=0,pt=b[S]<<8|b[S+1],pt<65280)throw new Error("marker was not found");if(pt>=65488&&pt<=65495)S+=2;else break}return S-L}a(h,"decodeScan");function f(b,S){var k=[],E=S.blocksPerLine,T=S.blocksPerColumn,I=E<<3,N=new Int32Array(64),P=new Uint8Array(64);function F(L,W,ae){var fe=S.quantizationTable,ue,z,Ce,Xe,qe,Te,at,ze,xe,me=ae,xt;for(xt=0;xt<64;xt++)me[xt]=L[xt]*fe[xt];for(xt=0;xt<8;++xt){var Qe=8*xt;if(me[1+Qe]==0&&me[2+Qe]==0&&me[3+Qe]==0&&me[4+Qe]==0&&me[5+Qe]==0&&me[6+Qe]==0&&me[7+Qe]==0){xe=c*me[0+Qe]+512>>10,me[0+Qe]=xe,me[1+Qe]=xe,me[2+Qe]=xe,me[3+Qe]=xe,me[4+Qe]=xe,me[5+Qe]=xe,me[6+Qe]=xe,me[7+Qe]=xe;continue}ue=c*me[0+Qe]+128>>8,z=c*me[4+Qe]+128>>8,Ce=me[2+Qe],Xe=me[6+Qe],qe=u*(me[1+Qe]-me[7+Qe])+128>>8,ze=u*(me[1+Qe]+me[7+Qe])+128>>8,Te=me[3+Qe]<<4,at=me[5+Qe]<<4,xe=ue-z+1>>1,ue=ue+z+1>>1,z=xe,xe=Ce*l+Xe*o+128>>8,Ce=Ce*o-Xe*l+128>>8,Xe=xe,xe=qe-at+1>>1,qe=qe+at+1>>1,at=xe,xe=ze+Te+1>>1,Te=ze-Te+1>>1,ze=xe,xe=ue-Xe+1>>1,ue=ue+Xe+1>>1,Xe=xe,xe=z-Ce+1>>1,z=z+Ce+1>>1,Ce=xe,xe=qe*s+ze*i+2048>>12,qe=qe*i-ze*s+2048>>12,ze=xe,xe=Te*r+at*n+2048>>12,Te=Te*n-at*r+2048>>12,at=xe,me[0+Qe]=ue+ze,me[7+Qe]=ue-ze,me[1+Qe]=z+at,me[6+Qe]=z-at,me[2+Qe]=Ce+Te,me[5+Qe]=Ce-Te,me[3+Qe]=Xe+qe,me[4+Qe]=Xe-qe}for(xt=0;xt<8;++xt){var lt=xt;if(me[8+lt]==0&&me[16+lt]==0&&me[24+lt]==0&&me[32+lt]==0&&me[40+lt]==0&&me[48+lt]==0&&me[56+lt]==0){xe=c*ae[xt+0]+8192>>14,me[0+lt]=xe,me[8+lt]=xe,me[16+lt]=xe,me[24+lt]=xe,me[32+lt]=xe,me[40+lt]=xe,me[48+lt]=xe,me[56+lt]=xe;continue}ue=c*me[0+lt]+2048>>12,z=c*me[32+lt]+2048>>12,Ce=me[16+lt],Xe=me[48+lt],qe=u*(me[8+lt]-me[56+lt])+2048>>12,ze=u*(me[8+lt]+me[56+lt])+2048>>12,Te=me[24+lt],at=me[40+lt],xe=ue-z+1>>1,ue=ue+z+1>>1,z=xe,xe=Ce*l+Xe*o+2048>>12,Ce=Ce*o-Xe*l+2048>>12,Xe=xe,xe=qe-at+1>>1,qe=qe+at+1>>1,at=xe,xe=ze+Te+1>>1,Te=ze-Te+1>>1,ze=xe,xe=ue-Xe+1>>1,ue=ue+Xe+1>>1,Xe=xe,xe=z-Ce+1>>1,z=z+Ce+1>>1,Ce=xe,xe=qe*s+ze*i+2048>>12,qe=qe*i-ze*s+2048>>12,ze=xe,xe=Te*r+at*n+2048>>12,Te=Te*n-at*r+2048>>12,at=xe,me[0+lt]=ue+ze,me[56+lt]=ue-ze,me[8+lt]=z+at,me[48+lt]=z-at,me[16+lt]=Ce+Te,me[40+lt]=Ce-Te,me[24+lt]=Xe+qe,me[32+lt]=Xe-qe}for(xt=0;xt<64;++xt){var Ae=128+(me[xt]+8>>4);W[xt]=Ae<0?0:Ae>255?255:Ae}}a(F,"quantizeAndInverse"),w(I*T*8);for(var $,U,K=0;K<T;K++){var A=K<<3;for($=0;$<8;$++)k.push(new Uint8Array(I));for(var H=0;H<E;H++){F(S.blocks[K][H],P,N);var ee=0,G=H<<3;for(U=0;U<8;U++){var B=k[A+U];for($=0;$<8;$++)B[G+$]=P[ee++]}}}return k}a(f,"buildComponentData");function g(b){return b<0?0:b>255?255:b}a(g,"clampTo8bit"),d.prototype={load:a(function(S){var k=new XMLHttpRequest;k.open("GET",S,!0),k.responseType="arraybuffer",k.onload=(function(){var E=new Uint8Array(k.response||k.mozResponseArrayBuffer);this.parse(E),this.onload&&this.onload()}).bind(this),k.send(null)},"load"),parse:a(function(S){var k=this.opts.maxResolutionInMP*1e3*1e3,E=0,T=S.length;function I(){var ne=S[E]<<8|S[E+1];return E+=2,ne}a(I,"readUint16");function N(){var ne=I(),_e=S.subarray(E,E+ne-2);return E+=_e.length,_e}a(N,"readDataBlock");function P(ne){var _e=1,Fe=1,Ye,wt;for(wt in ne.components)ne.components.hasOwnProperty(wt)&&(Ye=ne.components[wt],_e<Ye.h&&(_e=Ye.h),Fe<Ye.v&&(Fe=Ye.v));var Be=Math.ceil(ne.samplesPerLine/8/_e),Jt=Math.ceil(ne.scanLines/8/Fe);for(wt in ne.components)if(ne.components.hasOwnProperty(wt)){Ye=ne.components[wt];var Gt=Math.ceil(Math.ceil(ne.samplesPerLine/8)*Ye.h/_e),ln=Math.ceil(Math.ceil(ne.scanLines/8)*Ye.v/Fe),Tt=Be*Ye.h,pr=Jt*Ye.v,gr=pr*Tt,Li=[];w(gr*256);for(var ti=0;ti<pr;ti++){for(var Vn=[],Fi=0;Fi<Tt;Fi++)Vn.push(new Int32Array(64));Li.push(Vn)}Ye.blocksPerLine=Gt,Ye.blocksPerColumn=ln,Ye.blocks=Li}ne.maxH=_e,ne.maxV=Fe,ne.mcusPerLine=Be,ne.mcusPerColumn=Jt}a(P,"prepareComponents");var F=null,$=null,U=null,K,A,H=[],ee=[],G=[],B=[],L=I(),W=-1;if(this.comments=[],L!=65496)throw new Error("SOI not found");for(L=I();L!=65497;){var ae,fe,ue;switch(L){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var z=N();if(L===65534){var Ce=String.fromCharCode.apply(null,z);this.comments.push(Ce)}L===65504&&z[0]===74&&z[1]===70&&z[2]===73&&z[3]===70&&z[4]===0&&(F={version:{major:z[5],minor:z[6]},densityUnits:z[7],xDensity:z[8]<<8|z[9],yDensity:z[10]<<8|z[11],thumbWidth:z[12],thumbHeight:z[13],thumbData:z.subarray(14,14+3*z[12]*z[13])}),L===65505&&z[0]===69&&z[1]===120&&z[2]===105&&z[3]===102&&z[4]===0&&(this.exifBuffer=z.subarray(5,z.length)),L===65518&&z[0]===65&&z[1]===100&&z[2]===111&&z[3]===98&&z[4]===101&&z[5]===0&&($={version:z[6],flags0:z[7]<<8|z[8],flags1:z[9]<<8|z[10],transformCode:z[11]});break;case 65499:for(var Xe=I(),qe=Xe+E-2;E<qe;){var Te=S[E++];w(256);var at=new Int32Array(64);if(Te>>4===0)for(fe=0;fe<64;fe++){var ze=t[fe];at[ze]=S[E++]}else if(Te>>4===1)for(fe=0;fe<64;fe++){var ze=t[fe];at[ze]=I()}else throw new Error("DQT: invalid table spec");H[Te&15]=at}break;case 65472:case 65473:case 65474:I(),K={},K.extended=L===65473,K.progressive=L===65474,K.precision=S[E++],K.scanLines=I(),K.samplesPerLine=I(),K.components={},K.componentsOrder=[];var xe=K.scanLines*K.samplesPerLine;if(xe>k){var me=Math.ceil((xe-k)/1e6);throw new Error(`maxResolutionInMP limit exceeded by ${me}MP`)}var xt=S[E++],Qe,lt=0,Ae=0;for(ae=0;ae<xt;ae++){Qe=S[E];var ge=S[E+1]>>4,te=S[E+1]&15,Oe=S[E+2];if(ge<=0||te<=0)throw new Error("Invalid sampling factor, expected values above 0");K.componentsOrder.push(Qe),K.components[Qe]={h:ge,v:te,quantizationIdx:Oe},E+=3}P(K),ee.push(K);break;case 65476:var he=I();for(ae=2;ae<he;){var nt=S[E++],Me=new Uint8Array(16),Re=0;for(fe=0;fe<16;fe++,E++)Re+=Me[fe]=S[E];w(16+Re);var pt=new Uint8Array(Re);for(fe=0;fe<Re;fe++,E++)pt[fe]=S[E];ae+=17+Re,(nt>>4===0?B:G)[nt&15]=p(Me,pt)}break;case 65501:I(),A=I();break;case 65500:I(),I();break;case 65498:var Ke=I(),je=S[E++],ut=[],Se;for(ae=0;ae<je;ae++){Se=K.components[S[E++]];var yt=S[E++];Se.huffmanTableDC=B[yt>>4],Se.huffmanTableAC=G[yt&15],ut.push(Se)}var Mt=S[E++],it=S[E++],an=S[E++],Dt=h(S,E,K,ut,A,Mt,it,an>>4,an&15,this.opts);E+=Dt;break;case 65535:S[E]!==255&&E--;break;default:if(S[E-3]==255&&S[E-2]>=192&&S[E-2]<=254){E-=3;break}else if(L===224||L==225){if(W!==-1)throw new Error(`first unknown JPEG marker at offset ${W.toString(16)}, second unknown JPEG marker ${L.toString(16)} at offset ${(E-1).toString(16)}`);W=E-1;let ne=I();if(S[E+ne-2]===255){E+=ne-2;break}}throw new Error("unknown JPEG marker "+L.toString(16))}L=I()}if(ee.length!=1)throw new Error("only single frame JPEGs supported");for(var ae=0;ae<ee.length;ae++){var Rt=ee[ae].components;for(var fe in Rt)Rt[fe].quantizationTable=H[Rt[fe].quantizationIdx],delete Rt[fe].quantizationIdx}this.width=K.samplesPerLine,this.height=K.scanLines,this.jfif=F,this.adobe=$,this.components=[];for(var ae=0;ae<K.componentsOrder.length;ae++){var Se=K.components[K.componentsOrder[ae]];this.components.push({lines:f(K,Se),scaleX:Se.h/K.maxH,scaleY:Se.v/K.maxV})}},"parse"),getData:a(function(S,k){var E=this.width/S,T=this.height/k,I,N,P,F,$,U,K,A,H,ee,G=0,B,L,W,ae,fe,ue,z,Ce,Xe,qe,Te,at=S*k*this.components.length;w(at);var ze=new Uint8Array(at);switch(this.components.length){case 1:for(I=this.components[0],ee=0;ee<k;ee++)for($=I.lines[0|ee*I.scaleY*T],H=0;H<S;H++)B=$[0|H*I.scaleX*E],ze[G++]=B;break;case 2:for(I=this.components[0],N=this.components[1],ee=0;ee<k;ee++)for($=I.lines[0|ee*I.scaleY*T],U=N.lines[0|ee*N.scaleY*T],H=0;H<S;H++)B=$[0|H*I.scaleX*E],ze[G++]=B,B=U[0|H*N.scaleX*E],ze[G++]=B;break;case 3:for(Te=!0,this.adobe&&this.adobe.transformCode?Te=!0:typeof this.opts.colorTransform<"u"&&(Te=!!this.opts.colorTransform),I=this.components[0],N=this.components[1],P=this.components[2],ee=0;ee<k;ee++)for($=I.lines[0|ee*I.scaleY*T],U=N.lines[0|ee*N.scaleY*T],K=P.lines[0|ee*P.scaleY*T],H=0;H<S;H++)Te?(B=$[0|H*I.scaleX*E],L=U[0|H*N.scaleX*E],W=K[0|H*P.scaleX*E],Ce=g(B+1.402*(W-128)),Xe=g(B-.3441363*(L-128)-.71413636*(W-128)),qe=g(B+1.772*(L-128))):(Ce=$[0|H*I.scaleX*E],Xe=U[0|H*N.scaleX*E],qe=K[0|H*P.scaleX*E]),ze[G++]=Ce,ze[G++]=Xe,ze[G++]=qe;break;case 4:if(!this.adobe)throw new Error("Unsupported color mode (4 components)");for(Te=!1,this.adobe&&this.adobe.transformCode?Te=!0:typeof this.opts.colorTransform<"u"&&(Te=!!this.opts.colorTransform),I=this.components[0],N=this.components[1],P=this.components[2],F=this.components[3],ee=0;ee<k;ee++)for($=I.lines[0|ee*I.scaleY*T],U=N.lines[0|ee*N.scaleY*T],K=P.lines[0|ee*P.scaleY*T],A=F.lines[0|ee*F.scaleY*T],H=0;H<S;H++)Te?(B=$[0|H*I.scaleX*E],L=U[0|H*N.scaleX*E],W=K[0|H*P.scaleX*E],ae=A[0|H*F.scaleX*E],fe=255-g(B+1.402*(W-128)),ue=255-g(B-.3441363*(L-128)-.71413636*(W-128)),z=255-g(B+1.772*(L-128))):(fe=$[0|H*I.scaleX*E],ue=U[0|H*N.scaleX*E],z=K[0|H*P.scaleX*E],ae=A[0|H*F.scaleX*E]),ze[G++]=255-fe,ze[G++]=255-ue,ze[G++]=255-z,ze[G++]=255-ae;break;default:throw new Error("Unsupported color mode")}return ze},"getData"),copyToImageData:a(function(S,k){var E=S.width,T=S.height,I=S.data,N=this.getData(E,T),P=0,F=0,$,U,K,A,H,ee,G,B,L;switch(this.components.length){case 1:for(U=0;U<T;U++)for($=0;$<E;$++)K=N[P++],I[F++]=K,I[F++]=K,I[F++]=K,k&&(I[F++]=255);break;case 3:for(U=0;U<T;U++)for($=0;$<E;$++)G=N[P++],B=N[P++],L=N[P++],I[F++]=G,I[F++]=B,I[F++]=L,k&&(I[F++]=255);break;case 4:for(U=0;U<T;U++)for($=0;$<E;$++)H=N[P++],ee=N[P++],K=N[P++],A=N[P++],G=255-g(H*(1-A/255)+A),B=255-g(ee*(1-A/255)+A),L=255-g(K*(1-A/255)+A),I[F++]=G,I[F++]=B,I[F++]=L,k&&(I[F++]=255);break;default:throw new Error("Unsupported color mode")}},"copyToImageData")};var y=0,v=0;function w(b=0){var S=y+b;if(S>v){var k=Math.ceil((S-v)/1024/1024);throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${k}MB`)}y=S}return a(w,"requestMemoryAllocation"),d.resetMaxMemoryUsage=function(b){y=0,v=b},d.getBytesAllocated=function(){return y},d.requestMemoryAllocation=w,d}),"jpegImage")();typeof bq<"u"?bq.exports=Dhe:typeof window<"u"&&(window["jpeg-js"]=window["jpeg-js"]||{},window["jpeg-js"].decode=Dhe);function Dhe(e,t={}){var n={colorTransform:void 0,useTArray:!1,formatAsRGBA:!0,tolerantDecoding:!0,maxResolutionInMP:100,maxMemoryUsageInMB:512},r={...n,...t},i=new Uint8Array(e),s=new xq;s.opts=r,xq.resetMaxMemoryUsage(r.maxMemoryUsageInMB*1024*1024),s.parse(i);var o=r.formatAsRGBA?4:3,l=s.width*s.height*o;try{xq.requestMemoryAllocation(l);var c={width:s.width,height:s.height,exifBuffer:s.exifBuffer,data:r.useTArray?new Uint8Array(l):Buffer.alloc(l)};s.comments.length>0&&(c.comments=s.comments)}catch(u){throw u instanceof RangeError?new Error("Could not allocate enough memory for the image. Required: "+l):u instanceof ReferenceError&&u.message==="Buffer is not defined"?new Error("Buffer is not globally defined in this environment. Consider setting useTArray to true"):u}return s.copyToImageData(c,r.formatAsRGBA),c}a(Dhe,"decode")});var Fhe=de((yun,Lhe)=>{var vot=Nhe(),xot=Mhe();Lhe.exports={encode:vot,decode:xot}});var i0=de((npn,sge)=>{"use strict";sge.exports=Vm;Vm.CAPTURING_PHASE=1;Vm.AT_TARGET=2;Vm.BUBBLING_PHASE=3;function Vm(e,t){if(this.type="",this.target=null,this.currentTarget=null,this.eventPhase=Vm.AT_TARGET,this.bubbles=!1,this.cancelable=!1,this.isTrusted=!1,this.defaultPrevented=!1,this.timeStamp=Date.now(),this._propagationStopped=!1,this._immediatePropagationStopped=!1,this._initialized=!0,this._dispatching=!1,e&&(this.type=e),t)for(var n in t)this[n]=t[n]}a(Vm,"Event");Vm.prototype=Object.create(Object.prototype,{constructor:{value:Vm},stopPropagation:{value:a(function(){this._propagationStopped=!0},"stopPropagation")},stopImmediatePropagation:{value:a(function(){this._propagationStopped=!0,this._immediatePropagationStopped=!0},"stopImmediatePropagation")},preventDefault:{value:a(function(){this.cancelable&&(this.defaultPrevented=!0)},"preventDefault")},initEvent:{value:a(function(t,n,r){this._initialized=!0,!this._dispatching&&(this._propagationStopped=!1,this._immediatePropagationStopped=!1,this.defaultPrevented=!1,this.isTrusted=!1,this.target=null,this.type=t,this.bubbles=n,this.cancelable=r)},"initEvent")}})});var gU=de((ipn,age)=>{"use strict";var oge=i0();age.exports=mU;function mU(){oge.call(this),this.view=null,this.detail=0}a(mU,"UIEvent");mU.prototype=Object.create(oge.prototype,{constructor:{value:mU},initUIEvent:{value:a(function(e,t,n,r,i){this.initEvent(e,t,n),this.view=r,this.detail=i},"value")}})});var vU=de((opn,cge)=>{"use strict";var lge=gU();cge.exports=yU;function yU(){lge.call(this),this.screenX=this.screenY=this.clientX=this.clientY=0,this.ctrlKey=this.altKey=this.shiftKey=this.metaKey=!1,this.button=0,this.buttons=1,this.relatedTarget=null}a(yU,"MouseEvent");yU.prototype=Object.create(lge.prototype,{constructor:{value:yU},initMouseEvent:{value:a(function(e,t,n,r,i,s,o,l,c,u,d,p,h,f,g){switch(this.initEvent(e,t,n,r,i),this.screenX=s,this.screenY=o,this.clientX=l,this.clientY=c,this.ctrlKey=u,this.altKey=d,this.shiftKey=p,this.metaKey=h,this.button=f,f){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2;break;default:this.buttons=0;break}this.relatedTarget=g},"value")},getModifierState:{value:a(function(e){switch(e){case"Alt":return this.altKey;case"Control":return this.ctrlKey;case"Shift":return this.shiftKey;case"Meta":return this.metaKey;default:return!1}},"value")}})});var aC=de((lpn,dge)=>{"use strict";dge.exports=oC;var $ct=1,Oct=3,Pct=4,Nct=5,Dct=7,Mct=8,Lct=9,Fct=11,jct=12,qct=13,Uct=14,zct=15,Bct=17,Wct=18,Hct=19,Vct=20,Gct=21,Zct=22,Kct=23,Jct=24,Xct=25,Yct=[null,"INDEX_SIZE_ERR",null,"HIERARCHY_REQUEST_ERR","WRONG_DOCUMENT_ERR","INVALID_CHARACTER_ERR",null,"NO_MODIFICATION_ALLOWED_ERR","NOT_FOUND_ERR","NOT_SUPPORTED_ERR","INUSE_ATTRIBUTE_ERR","INVALID_STATE_ERR","SYNTAX_ERR","INVALID_MODIFICATION_ERR","NAMESPACE_ERR","INVALID_ACCESS_ERR",null,"TYPE_MISMATCH_ERR","SECURITY_ERR","NETWORK_ERR","ABORT_ERR","URL_MISMATCH_ERR","QUOTA_EXCEEDED_ERR","TIMEOUT_ERR","INVALID_NODE_TYPE_ERR","DATA_CLONE_ERR"],Qct=[null,"INDEX_SIZE_ERR (1): the index is not in the allowed range",null,"HIERARCHY_REQUEST_ERR (3): the operation would yield an incorrect nodes model","WRONG_DOCUMENT_ERR (4): the object is in the wrong Document, a call to importNode is required","INVALID_CHARACTER_ERR (5): the string contains invalid characters",null,"NO_MODIFICATION_ALLOWED_ERR (7): the object can not be modified","NOT_FOUND_ERR (8): the object can not be found here","NOT_SUPPORTED_ERR (9): this operation is not supported","INUSE_ATTRIBUTE_ERR (10): setAttributeNode called on owned Attribute","INVALID_STATE_ERR (11): the object is in an invalid state","SYNTAX_ERR (12): the string did not match the expected pattern","INVALID_MODIFICATION_ERR (13): the object can not be modified in this way","NAMESPACE_ERR (14): the operation is not allowed by Namespaces in XML","INVALID_ACCESS_ERR (15): the object does not support the operation or argument",null,"TYPE_MISMATCH_ERR (17): the type of the object does not match the expected type","SECURITY_ERR (18): the operation is insecure","NETWORK_ERR (19): a network error occurred","ABORT_ERR (20): the user aborted an operation","URL_MISMATCH_ERR (21): the given URL does not match another URL","QUOTA_EXCEEDED_ERR (22): the quota has been exceeded","TIMEOUT_ERR (23): a timeout occurred","INVALID_NODE_TYPE_ERR (24): the supplied node is invalid or has an invalid ancestor for this operation","DATA_CLONE_ERR (25): the object can not be cloned."],uge={INDEX_SIZE_ERR:$ct,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:Oct,WRONG_DOCUMENT_ERR:Pct,INVALID_CHARACTER_ERR:Nct,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:Dct,NOT_FOUND_ERR:Mct,NOT_SUPPORTED_ERR:Lct,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:Fct,SYNTAX_ERR:jct,INVALID_MODIFICATION_ERR:qct,NAMESPACE_ERR:Uct,INVALID_ACCESS_ERR:zct,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:Bct,SECURITY_ERR:Wct,NETWORK_ERR:Hct,ABORT_ERR:Vct,URL_MISMATCH_ERR:Gct,QUOTA_EXCEEDED_ERR:Zct,TIMEOUT_ERR:Kct,INVALID_NODE_TYPE_ERR:Jct,DATA_CLONE_ERR:Xct};function oC(e){Error.call(this),Error.captureStackTrace(this,this.constructor),this.code=e,this.message=Qct[e],this.name=Yct[e]}a(oC,"DOMException");oC.prototype.__proto__=Error.prototype;for(sC in uge)xU={value:uge[sC]},Object.defineProperty(oC,sC,xU),Object.defineProperty(oC.prototype,sC,xU);var xU,sC});var lC=de(pge=>{pge.isApiWritable=!globalThis.__domino_frozen__});var Cs=de(ai=>{"use strict";var As=aC(),Vs=As,eut=lC().isApiWritable;ai.NAMESPACE={HTML:"http://www.w3.org/1999/xhtml",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink"};ai.IndexSizeError=function(){throw new As(Vs.INDEX_SIZE_ERR)};ai.HierarchyRequestError=function(){throw new As(Vs.HIERARCHY_REQUEST_ERR)};ai.WrongDocumentError=function(){throw new As(Vs.WRONG_DOCUMENT_ERR)};ai.InvalidCharacterError=function(){throw new As(Vs.INVALID_CHARACTER_ERR)};ai.NoModificationAllowedError=function(){throw new As(Vs.NO_MODIFICATION_ALLOWED_ERR)};ai.NotFoundError=function(){throw new As(Vs.NOT_FOUND_ERR)};ai.NotSupportedError=function(){throw new As(Vs.NOT_SUPPORTED_ERR)};ai.InvalidStateError=function(){throw new As(Vs.INVALID_STATE_ERR)};ai.SyntaxError=function(){throw new As(Vs.SYNTAX_ERR)};ai.InvalidModificationError=function(){throw new As(Vs.INVALID_MODIFICATION_ERR)};ai.NamespaceError=function(){throw new As(Vs.NAMESPACE_ERR)};ai.InvalidAccessError=function(){throw new As(Vs.INVALID_ACCESS_ERR)};ai.TypeMismatchError=function(){throw new As(Vs.TYPE_MISMATCH_ERR)};ai.SecurityError=function(){throw new As(Vs.SECURITY_ERR)};ai.NetworkError=function(){throw new As(Vs.NETWORK_ERR)};ai.AbortError=function(){throw new As(Vs.ABORT_ERR)};ai.UrlMismatchError=function(){throw new As(Vs.URL_MISMATCH_ERR)};ai.QuotaExceededError=function(){throw new As(Vs.QUOTA_EXCEEDED_ERR)};ai.TimeoutError=function(){throw new As(Vs.TIMEOUT_ERR)};ai.InvalidNodeTypeError=function(){throw new As(Vs.INVALID_NODE_TYPE_ERR)};ai.DataCloneError=function(){throw new As(Vs.DATA_CLONE_ERR)};ai.nyi=function(){throw new Error("NotYetImplemented")};ai.shouldOverride=function(){throw new Error("Abstract function; should be overriding in subclass.")};ai.assert=function(e,t){if(!e)throw new Error("Assertion failed: "+(t||"")+`
|
|
155
155
|
`+new Error().stack)};ai.expose=function(e,t){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],writable:eut})};ai.merge=function(e,t){for(var n in t)e[n]=t[n]};ai.documentOrder=function(e,t){return 3-(e.compareDocumentPosition(t)&6)};ai.toASCIILowerCase=function(e){return e.replace(/[A-Z]+/g,function(t){return t.toLowerCase()})};ai.toASCIIUpperCase=function(e){return e.replace(/[a-z]+/g,function(t){return t.toUpperCase()})}});var bU=de((ppn,hge)=>{"use strict";var Gm=i0(),tut=vU(),nut=Cs();hge.exports=fge;function fge(){}a(fge,"EventTarget");fge.prototype={addEventListener:a(function(t,n,r){if(n){r===void 0&&(r=!1),this._listeners||(this._listeners=Object.create(null)),this._listeners[t]||(this._listeners[t]=[]);for(var i=this._listeners[t],s=0,o=i.length;s<o;s++){var l=i[s];if(l.listener===n&&l.capture===r)return}var c={listener:n,capture:r};typeof n=="function"&&(c.f=n),i.push(c)}},"addEventListener"),removeEventListener:a(function(t,n,r){if(r===void 0&&(r=!1),this._listeners){var i=this._listeners[t];if(i)for(var s=0,o=i.length;s<o;s++){var l=i[s];if(l.listener===n&&l.capture===r){i.length===1?this._listeners[t]=void 0:i.splice(s,1);return}}}},"removeEventListener"),dispatchEvent:a(function(t){return this._dispatchEvent(t,!1)},"dispatchEvent"),_dispatchEvent:a(function(t,n){typeof n!="boolean"&&(n=!1);function r(u,d){var p=d.type,h=d.eventPhase;if(d.currentTarget=u,h!==Gm.CAPTURING_PHASE&&u._handlers&&u._handlers[p]){var f=u._handlers[p],g;if(typeof f=="function")g=f.call(d.currentTarget,d);else{var y=f.handleEvent;if(typeof y!="function")throw new TypeError("handleEvent property of event handler object isnot a function.");g=y.call(f,d)}d.type==="mouseover"?g===!0&&d.preventDefault():g===!1&&d.preventDefault()}var v=u._listeners&&u._listeners[p];if(v){v=v.slice();for(var w=0,b=v.length;w<b;w++){if(d._immediatePropagationStopped)return;var S=v[w];if(!(h===Gm.CAPTURING_PHASE&&!S.capture||h===Gm.BUBBLING_PHASE&&S.capture))if(S.f)S.f.call(d.currentTarget,d);else{var k=S.listener.handleEvent;if(typeof k!="function")throw new TypeError("handleEvent property of event listener object is not a function.");k.call(S.listener,d)}}}}a(r,"invoke"),(!t._initialized||t._dispatching)&&nut.InvalidStateError(),t.isTrusted=n,t._dispatching=!0,t.target=this;for(var i=[],s=this.parentNode;s;s=s.parentNode)i.push(s);t.eventPhase=Gm.CAPTURING_PHASE;for(var o=i.length-1;o>=0&&(r(i[o],t),!t._propagationStopped);o--);if(t._propagationStopped||(t.eventPhase=Gm.AT_TARGET,r(this,t)),t.bubbles&&!t._propagationStopped){t.eventPhase=Gm.BUBBLING_PHASE;for(var l=0,c=i.length;l<c&&(r(i[l],t),!t._propagationStopped);l++);}if(t._dispatching=!1,t.eventPhase=Gm.AT_TARGET,t.currentTarget=null,n&&!t.defaultPrevented&&t instanceof tut)switch(t.type){case"mousedown":this._armed={x:t.clientX,y:t.clientY,t:t.timeStamp};break;case"mouseout":case"mouseover":this._armed=null;break;case"mouseup":this._isClick(t)&&this._doClick(t),this._armed=null;break}return!t.defaultPrevented},"_dispatchEvent"),_isClick:a(function(e){return this._armed!==null&&e.type==="mouseup"&&e.isTrusted&&e.button===0&&e.timeStamp-this._armed.t<1e3&&Math.abs(e.clientX-this._armed.x)<10&&Math.abs(e.clientY-this._armed.Y)<10},"_isClick"),_doClick:a(function(e){if(!this._click_in_progress){this._click_in_progress=!0;for(var t=this;t&&!t._post_click_activation_steps;)t=t.parentNode;t&&t._pre_click_activation_steps&&t._pre_click_activation_steps();var n=this.ownerDocument.createEvent("MouseEvent");n.initMouseEvent("click",!0,!0,this.ownerDocument.defaultView,1,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,null);var r=this._dispatchEvent(n,!0);t&&(r?t._post_click_activation_steps&&t._post_click_activation_steps(n):t._cancelled_activation_steps&&t._cancelled_activation_steps())}},"_doClick"),_setEventHandler:a(function(t,n){this._handlers||(this._handlers=Object.create(null)),this._handlers[t]=n},"_setEventHandler"),_getEventHandler:a(function(t){return this._handlers&&this._handlers[t]||null},"_getEventHandler")}});var wU=de((hpn,mge)=>{"use strict";var vp=Cs(),hc=mge.exports={valid:a(function(e){return vp.assert(e,"list falsy"),vp.assert(e._previousSibling,"previous falsy"),vp.assert(e._nextSibling,"next falsy"),!0},"valid"),insertBefore:a(function(e,t){vp.assert(hc.valid(e)&&hc.valid(t));var n=e,r=e._previousSibling,i=t,s=t._previousSibling;n._previousSibling=s,r._nextSibling=i,s._nextSibling=n,i._previousSibling=r,vp.assert(hc.valid(e)&&hc.valid(t))},"insertBefore"),replace:a(function(e,t){vp.assert(hc.valid(e)&&(t===null||hc.valid(t))),t!==null&&hc.insertBefore(t,e),hc.remove(e),vp.assert(hc.valid(e)&&(t===null||hc.valid(t)))},"replace"),remove:a(function(e){vp.assert(hc.valid(e));var t=e._previousSibling;if(t!==e){var n=e._nextSibling;t._nextSibling=n,n._previousSibling=t,e._previousSibling=e._nextSibling=e,vp.assert(hc.valid(e))}},"remove")}});var SU=de((gpn,kge)=>{"use strict";kge.exports={serializeOne:cut,\u0275escapeMatchingClosingTag:bge,\u0275escapeClosingCommentTag:wge,\u0275escapeProcessingInstructionContent:Sge};var xge=Cs(),Zm=xge.NAMESPACE,gge={STYLE:!0,SCRIPT:!0,XMP:!0,IFRAME:!0,NOEMBED:!0,NOFRAMES:!0,PLAINTEXT:!0},rut={area:!0,base:!0,basefont:!0,bgsound:!0,br:!0,col:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},iut={},yge=/[&<>\u00A0]/g,vge=/[&"<>\u00A0]/g;function sut(e){return yge.test(e)?e.replace(yge,t=>{switch(t){case"&":return"&";case"<":return"<";case">":return">";case"\xA0":return" "}}):e}a(sut,"escape");function out(e){return vge.test(e)?e.replace(vge,t=>{switch(t){case"<":return"<";case">":return">";case"&":return"&";case'"':return""";case"\xA0":return" "}}):e}a(out,"escapeAttr");function aut(e){var t=e.namespaceURI;return t?t===Zm.XML?"xml:"+e.localName:t===Zm.XLINK?"xlink:"+e.localName:t===Zm.XMLNS?e.localName==="xmlns"?"xmlns":"xmlns:"+e.localName:e.name:e.localName}a(aut,"attrname");function bge(e,t){let n="</"+t;if(!e.toLowerCase().includes(n))return e;let r=[...e],i=e.matchAll(new RegExp(n,"ig"));for(let s of i)r[s.index]="<";return r.join("")}a(bge,"escapeMatchingClosingTag");var lut=/--!?>/;function wge(e){return lut.test(e)?e.replace(/(--\!?)>/g,"$1>"):e}a(wge,"escapeClosingCommentTag");function Sge(e){return e.includes(">")?e.replaceAll(">",">"):e}a(Sge,"escapeProcessingInstructionContent");function cut(e,t){var n="";switch(e.nodeType){case 1:var r=e.namespaceURI,i=r===Zm.HTML,s=i||r===Zm.SVG||r===Zm.MATHML?e.localName:e.tagName;n+="<"+s;for(var o=0,l=e._numattrs;o<l;o++){var c=e._attr(o);n+=" "+aut(c),c.value!==void 0&&(n+='="'+out(c.value)+'"')}if(n+=">",!(i&&rut[s])){var u=e.serialize();gge[s.toUpperCase()]&&(u=bge(u,s)),i&&iut[s]&&u.charAt(0)===`
|
|
156
156
|
`&&(n+=`
|
|
@@ -4857,7 +4857,7 @@ The web search request used endpoint ${JSON.stringify(e)}. Search endpoint confi
|
|
|
4857
4857
|
button, .button { display: inline-block; box-sizing: border-box; margin-top: 1rem; padding: .75rem 1rem; border: 0; border-radius: .6rem; background: #5a87ff; color: #071022; font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; }
|
|
4858
4858
|
.secondary { background: #29314b; color: #edf2ff; }
|
|
4859
4859
|
.error { padding: .75rem; border-radius: .5rem; background: #461d2b; color: #ffd6df; }
|
|
4860
|
-
`}a(_2e,"pageStyles");BI();ir();var OV=Object.freeze({id:"direct",capabilities:Object.freeze(["bash"]),plan:"free",shell:"just-bash-direct",probe:a(e=>e.LOADER===void 0?"available":"needs-binding","probe")}),ok=Object.freeze({id:"dynamic-worker",capabilities:Object.freeze(["bash","coding"]),plan:"paid",shell:"just-bash-isolated",probe:a(e=>e.LOADER===void 0?"needs-binding":"available","probe")}),WIt=Object.freeze([ok,OV]);function PV(e,t=WIt){return t.filter(n=>n.probe(e)==="available")}a(PV,"availableEdgeRuntimeProviders");function NV(e,t={}){let n=a((i,s)=>e.find(o=>o.id===s&&o.capabilities.includes(i)),"serves"),r=n("bash",t.bash)??e.find(i=>i.capabilities.includes("bash"));if(r===void 0)throw new Error("No available runtime provider serves the bash layer.");return{bash:r.id,coding:n("coding",t.coding)?.id??null,subprocess:n("subprocess",t.subprocess)?.id??null}}a(NV,"resolveEdgeRuntimeSelection");function T2e(e){let t=PV(e),{bash:n}=NV(t);return t.find(r=>r.id===n).shell}a(T2e,"resolveEdgeRuntimeShell");function HIt(){return"dsh-edge@0.17.0-alpha.1/direct"}a(HIt,"resolveEdgeDeploymentId");function ak(e){return{baseURL:cU(e.DEEPSEEK_BASE_URL),maxTokens:pU(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:Hm(e.DEEPSEEK_MODEL),reasoningEffort:uU(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:VC(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:dU(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:nk(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}a(ak,"resolveEdgeDeploymentConfig");function VIt(e){return typeof e.DEEPSEEK_API_KEY=="string"&&e.DEEPSEEK_API_KEY.trim().length>0}a(VIt,"edgeDeploymentApiKeyConfigured");function GIt(e){let t=cU(e),n=new URL(t);return n.search.length===0&&n.hash.length===0?t:(n.search="",n.hash="",n.href)}a(GIt,"projectedEdgeBaseURL");function DV(e,t){return{shell:T2e(e),storage:"durable-object-sqlite-vfs",attachmentStorage:t??(e.DSH_EDGE_ATTACHMENTS===void 0?"temporary-do":"private-r2"),deploymentId:HIt(),apiKeyConfigured:VIt(e),baseURL:GIt(e.DEEPSEEK_BASE_URL),maxTokens:pU(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:Hm(e.DEEPSEEK_MODEL),reasoningEffort:uU(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:VC(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:dU(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:nk(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}a(DV,"resolveEdgeDeploymentProfile");function DR(e){ak(e);let t=DV(e);return{ok:!0,service:"dsh-edge",storage:t.storage,attachmentStorage:t.attachmentStorage,shell:t.shell,agent:"upstream-react-loop-agent",access:"single-owner-cookie",deploymentId:t.deploymentId,...e.CF_VERSION_METADATA===void 0?{}:{workerVersionId:e.CF_VERSION_METADATA.id},version:Fy,upstreamVersion:Cde,status:"ready"}}a(DR,"resolveEdgeDeploymentHealth");import{AsyncLocalStorage as iFt}from"node:async_hooks";var ZIt={session:"sessions",skill:"skills",agentPreset:"agentPresets",subagent:"subagents",goal:"goals",event:"events",download:"downloads"};function A2e(e,t){let n=t.indexOf("."),r=t.indexOf("/"),i=n>=0?n:r;if(i<0)return;let s=t.slice(0,i),o=t.slice(i+1),l=ZIt[s]??s,c=e[l];if(c===void 0)return;let u=c[o];return typeof u=="function"?u:void 0}a(A2e,"resolve");function KIt(e,t){return Response.json({type:"server-response",rpcId:e,result:{ok:!1,error:t}})}a(KIt,"errorResponse");async function MV(e,t,n,r,i){let s=A2e(e,t);if(s!==void 0)return await s({rpcId:n,payload:r},i)}a(MV,"callEdgeApi");async function C2e(e,t){let r=new URL(t.url).pathname;if(t.method!=="POST"||!r.startsWith("/api/"))return new Response("not found",{status:404});if(r==="/api/respond")return Response.json({accepted:!1,reason:"not-pending"});let i=r.slice(5);if(A2e(e,i)===void 0)return new Response("not found",{status:404});let s;try{s=await t.json()}catch{return new Response("body is not JSON",{status:400})}let o=typeof s.rpcId=="string"?s.rpcId:"invalid-request",l=s.payload??{};try{let c=await MV(e,i,o,l,t.signal);return c===void 0?new Response("not found",{status:404}):Response.json({type:"server-response",rpcId:c.rpcId,result:c.result})}catch(c){return KIt(o,{code:"internal",message:String(c),details:{}})}}a(C2e,"dispatchEdgeApi");Ir();ws();wf();import{DurableObject as sFt}from"cloudflare:workers";import{WorkerEntrypoint as VSn}from"cloudflare:workers";var Yg=kl(R2e());var LV=a((e,t,n)=>{let r=e instanceof RegExp?$2e(e,n):e,i=t instanceof RegExp?$2e(t,n):t,s=r!==null&&i!=null&&JIt(r,i,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+r.length,s[1]),post:n.slice(s[1]+i.length)}},"balanced"),$2e=a((e,t)=>{let n=t.match(e);return n?n[0]:null},"maybeMatch"),JIt=a((e,t,n)=>{let r,i,s,o,l,c=n.indexOf(e),u=n.indexOf(t,c+1),d=c;if(c>=0&&u>0){if(e===t)return[c,u];for(r=[],s=n.length;d>=0&&!l;){if(d===c)r.push(d),c=n.indexOf(e,d+1);else if(r.length===1){let p=r.pop();p!==void 0&&(l=[p,u])}else i=r.pop(),i!==void 0&&i<s&&(s=i,o=u),u=n.indexOf(t,d+1);d=c<u&&c>=0?c:u}r.length&&o!==void 0&&(l=[s,o])}return l},"range");var O2e="\0SLASH"+Math.random()+"\0",P2e="\0OPEN"+Math.random()+"\0",qV="\0CLOSE"+Math.random()+"\0",N2e="\0COMMA"+Math.random()+"\0",D2e="\0PERIOD"+Math.random()+"\0",XIt=new RegExp(O2e,"g"),YIt=new RegExp(P2e,"g"),QIt=new RegExp(qV,"g"),eAt=new RegExp(N2e,"g"),tAt=new RegExp(D2e,"g"),nAt=/\\\\/g,rAt=/\\{/g,iAt=/\\}/g,sAt=/\\,/g,oAt=/\\\./g,aAt=1e5,lAt=4e6;function FV(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}a(FV,"numeric");function cAt(e){return e.replace(nAt,O2e).replace(rAt,P2e).replace(iAt,qV).replace(sAt,N2e).replace(oAt,D2e)}a(cAt,"escapeBraces");function uAt(e){return e.replace(XIt,"\\").replace(YIt,"{").replace(QIt,"}").replace(eAt,",").replace(tAt,".")}a(uAt,"unescapeBraces");function M2e(e){if(!e)return[""];let t=[],n=LV("{","}",e);if(!n)return e.split(",");let{pre:r,body:i,post:s}=n,o=r.split(",");o[o.length-1]+="{"+i+"}";let l=M2e(s);return s.length&&(o[o.length-1]+=l.shift(),o.push.apply(o,l)),t.push.apply(t,o),t}a(M2e,"parseCommaParts");function L2e(e,t={}){if(!e)return[];let{max:n=aAt,maxLength:r=lAt}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),jV(cAt(e),n,r,!0).map(uAt)}a(L2e,"expand");function dAt(e){return"{"+e+"}"}a(dAt,"embrace");function pAt(e){return/^-?0\d/.test(e)}a(pAt,"isPadded");function fAt(e,t){return e<=t}a(fAt,"lte");function hAt(e,t){return e>=t}a(hAt,"gte");function lk(e,t,n,r,i,s){let o=[],l=0;for(let c=0;c<e.length;c++)for(let u=0;u<n.length;u++){if(o.length>=r)return o;let d=e[c]+t+n[u];if(!(s&&!d)){if(l+d.length>i)return o;o.push(d),l+=d.length}}return o}a(lk,"combine");function mAt(e,t,n,r){let i=e.split(/\.\./),s=[];if(i[0]===void 0||i[1]===void 0)return s;let o=FV(i[0]),l=FV(i[1]),c=Math.max(i[0].length,i[1].length),u=i.length===3&&i[2]!==void 0?Math.max(Math.abs(FV(i[2])),1):1,d=fAt;l<o&&(u*=-1,d=hAt);let h=i.some(pAt),f=0;for(let g=o;d(g,l)&&s.length<n;g+=u){let y;if(t)y=String.fromCharCode(g),y==="\\"&&(y="");else if(y=String(g),h){let v=c-y.length;if(v>0){let w=new Array(v+1).join("0");g<0?y="-"+w+y.slice(1):y=w+y}}if(f+y.length>r)break;s.push(y),f+=y.length}return s}a(mAt,"expandSequence");function jV(e,t,n,r){let i=[""],s=!1,o=!0;for(;;){let l=LV("{","}",e);if(!l)return lk(i,e,[""],t,n,s);let c=l.pre;if(/\$$/.test(c)){if(i=lk(i,c+"{"+l.body+"}",[""],t,n,s&&!l.post.length),o=!1,!l.post.length)break;e=l.post;continue}let u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(l.body),d=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(l.body),p=u||d,h=l.body.indexOf(",")>=0;if(!p&&!h){if(l.post.match(/,(?!,).*\}/)){e=l.pre+"{"+l.body+qV+l.post,r=!0;continue}return lk(i,c+"{"+l.body+"}"+l.post,[""],t,n,s)}o&&(s=r&&!p,o=!1);let f;if(p)f=mAt(l.body,d,t,n);else{let g=M2e(l.body);if(g.length===1&&g[0]!==void 0&&(g=jV(g[0],t,n,!1).map(dAt),g.length===1)){if(i=lk(i,c+g[0],[""],t,n,s&&!l.post.length),!l.post.length)break;e=l.post;continue}let y=s&&!l.post.length&&!c;for(let w=0;y&&w<i.length;w++)i[w]&&(y=!1);f=[];let v=0;e:for(let w=0;w<g.length;w++){let b=jV(g[w],t,n,!1);for(let S=0;S<b.length;S++){let k=b[S];if(!(y&&!k)){if(f.length>=t||v+k.length>n)break e;f.push(k),v+=k.length}}}}if(i=lk(i,c,f,t,n,s&&!l.post.length),!l.post.length)break;e=l.post}return i}a(jV,"expand_");var ck=a(e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var gAt={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},uk=a(e=>e.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),yAt=a(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),F2e=a(e=>e.join(""),"rangesToString"),j2e=a((e,t)=>{let n=t;if(e.charAt(n)!=="[")throw new Error("not in a brace expression");let r=[],i=[],s=n+1,o=!1,l=!1,c=!1,u=!1,d=n,p="";e:for(;s<e.length;){let y=e.charAt(s);if((y==="!"||y==="^")&&s===n+1){u=!0,s++;continue}if(y==="]"&&o&&!c){d=s+1;break}if(o=!0,y==="\\"&&!c){c=!0,s++;continue}if(y==="["&&!c){for(let[v,[w,b,S]]of Object.entries(gAt))if(e.startsWith(v,s)){if(p)return["$.",!1,e.length-n,!0];s+=v.length,S?i.push(w):r.push(w),l=l||b;continue e}}if(c=!1,p){y>p?r.push(uk(p)+"-"+uk(y)):y===p&&r.push(uk(y)),p="",s++;continue}if(e.startsWith("-]",s+1)){r.push(uk(y+"-")),s+=2;continue}if(e.startsWith("-",s+1)){p=y,s+=2;continue}r.push(uk(y)),s++}if(d<s)return["",!1,0,!1];if(!r.length&&!i.length)return["$.",!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!u){let y=r[0].length===2?r[0].slice(-1):r[0];return[yAt(y),!1,d-n,!1]}let h="["+(u?"^":"")+F2e(r)+"]",f="["+(u?"":"^")+F2e(i)+"]";return[r.length&&i.length?"("+h+"|"+f+")":r.length?h:f,l,d-n,!0]},"parseClass");var fh=a((e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?e.replace(/\[([^/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1"),"unescape");var dl,vAt=new Set(["!","?","+","*","@"]),UV=a(e=>vAt.has(e),"isExtglobType"),q2e=a(e=>UV(e.type),"isExtglobAST"),xAt=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),bAt=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),wAt=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),U2e=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),SAt="(?!(?:^|/)\\.\\.?(?:$|/))",LR="(?!\\.)",kAt=new Set(["[","."]),EAt=new Set(["..","."]),_At=new Set("().*{}+?[]^$\\!"),TAt=a(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),zV="[^/]",z2e=zV+"*?",B2e=zV+"+?",IAt=0,wg=class{static{a(this,"AST")}type;#e;#n;#r=!1;#t=[];#i;#s;#a;#d=!1;#l;#o;#c=!1;id=++IAt;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(t,n,r={}){this.type=t,t&&(this.#n=!0),this.#i=n,this.#e=this.#i?this.#i.#e:this,this.#l=this.#e===this?r:this.#e.#l,this.#a=this.#e===this?[]:this.#e.#a,t==="!"&&!this.#e.#d&&this.#a.push(this),this.#s=this.#i?this.#i.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#o!==void 0?this.#o:this.type?this.#o=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#o=this.#t.map(t=>String(t)).join("")}#E(){if(this!==this.#e)throw new Error("should only call on root");if(this.#d)return this;this.toString(),this.#d=!0;let t;for(;t=this.#a.pop();){if(t.type!=="!")continue;let n=t,r=n.#i;for(;r;){for(let i=n.#s+1;!r.type&&i<r.#t.length;i++)for(let s of t.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(r.#t[i])}n=r,r=n.#i}}return this}push(...t){for(let n of t)if(n!==""){if(typeof n!="string"&&!(n instanceof dl&&n.#i===this))throw new Error("invalid part: "+n);this.#t.push(n)}}toJSON(){let t=this.type===null?this.#t.slice().map(n=>typeof n=="string"?n:n.toJSON()):[this.type,...this.#t.map(n=>n.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#d&&this.#i?.type==="!")&&t.push({}),t}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#s===0)return!0;let t=this.#i;for(let n=0;n<this.#s;n++){let r=t.#t[n];if(!(r instanceof dl&&r.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type==="!")return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let t=this.#i?this.#i.#t.length:0;return this.#s===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let n=new dl(this.type,t);for(let r of this.#t)n.copyIn(r);return n}static#m(t,n,r,i,s){let o=i.maxExtglobRecursion??2,l=!1,c=!1,u=-1,d=!1;if(n.type===null){let y=r,v="";for(;y<t.length;){let w=t.charAt(y++);if(l||w==="\\"){l=!l,v+=w;continue}if(c){y===u+1?(w==="^"||w==="!")&&(d=!0):w==="]"&&!(y===u+2&&d)&&(c=!1),v+=w;continue}else if(w==="["){c=!0,u=y,d=!1,v+=w;continue}if(!i.noext&&UV(w)&&t.charAt(y)==="("&&s<=o){n.push(v),v="";let S=new dl(w,n);y=dl.#m(t,S,y,i,s+1),n.push(S);continue}v+=w}return n.push(v),y}let p=r+1,h=new dl(null,n),f=[],g="";for(;p<t.length;){let y=t.charAt(p++);if(l||y==="\\"){l=!l,g+=y;continue}if(c){p===u+1?(y==="^"||y==="!")&&(d=!0):y==="]"&&!(p===u+2&&d)&&(c=!1),g+=y;continue}else if(y==="["){c=!0,u=p,d=!1,g+=y;continue}if(!i.noext&&UV(y)&&t.charAt(p)==="("&&(s<=o||n&&n.#y(y))){let w=n&&n.#y(y)?0:1;h.push(g),g="";let b=new dl(y,h);h.push(b),p=dl.#m(t,b,p,i,s+w);continue}if(y==="|"){h.push(g),g="",f.push(h),h=new dl(null,n);continue}if(y===")")return g===""&&n.#t.length===0&&(n.#c=!0),h.push(g),g="",n.push(...f,h),p;g+=y}return n.type=null,n.#n=void 0,n.#t=[t.substring(r-1)],p}#P(t){return this.#g(t,bAt)}#g(t,n=xAt){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null)return!1;let r=t.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#y(r.type,n)}#y(t,n=wAt){return!!n.get(this.type)?.includes(t)}#p(t,n){let r=t.#t[0],i=new dl(null,r,this.options);i.#t.push(""),r.push(i),this.#_(t,n)}#_(t,n){let r=t.#t[0];this.#t.splice(n,1,...r.#t);for(let i of r.#t)typeof i=="object"&&(i.#i=this);this.#o=void 0}#T(t){return!!U2e.get(this.type)?.has(t)}#N(t){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let n=t.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#T(n.type)}#v(t){let n=U2e.get(this.type),r=t.#t[0],i=n?.get(r.type);if(!i)return!1;this.#t=r.#t;for(let s of this.#t)typeof s=="object"&&(s.#i=this);this.type=i,this.#o=void 0,this.#c=!1}static fromGlob(t,n={}){let r=new dl(null,void 0,n);return dl.#m(t,r,0,n,0),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let t=this.toString(),[n,r,i,s]=this.toRegExpSource();if(!(i||this.#n||this.#l.nocase&&!this.#l.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return r;let l=(this.#l.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${n}$`,l),{_src:n,_glob:t})}get options(){return this.#l}toRegExpSource(t){let n=t??!!this.#l.dot;if(this.#e===this&&(this.#f(),this.#E()),!q2e(this)){let c=this.isStart()&&this.isEnd()&&!this.#t.some(f=>typeof f!="string"),u=this.#t.map(f=>{let[g,y,v,w]=typeof f=="string"?dl.#I(f,this.#n,c):f.toRegExpSource(t);return this.#n=this.#n||v,this.#r=this.#r||w,g}).join(""),d="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&EAt.has(this.#t[0]))){let g=kAt,y=n&&g.has(u.charAt(0))||u.startsWith("\\.")&&g.has(u.charAt(2))||u.startsWith("\\.\\.")&&g.has(u.charAt(4)),v=!n&&!t&&g.has(u.charAt(0));d=y?SAt:v?LR:""}let p="";return this.isEnd()&&this.#e.#d&&this.#i?.type==="!"&&(p="(?:$|\\/)"),[d+u+p,fh(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#x(n);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),u=this;return u.#t=[c],u.type=null,u.#n=void 0,[c,fh(this.toString()),!1,!1]}let o=!r||t||n||!LR?"":this.#x(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let l="";if(this.type==="!"&&this.#c)l=(this.isStart()&&!n?LR:"")+B2e;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!t?LR:"")+z2e+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;l=i+s+c}return[l,fh(s),this.#n=!!this.#n,this.#r]}#f(){if(q2e(this)){let t=0,n=!1;do{n=!0;for(let r=0;r<this.#t.length;r++){let i=this.#t[r];typeof i=="object"&&(i.#f(),this.#g(i)?(n=!1,this.#_(i,r)):this.#P(i)?(n=!1,this.#p(i,r)):this.#N(i)&&(n=!1,this.#v(i)))}}while(!n&&++t<10)}else for(let t of this.#t)typeof t=="object"&&t.#f();this.#o=void 0}#x(t){return this.#t.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[r,i,s,o]=n.toRegExpSource(t);return this.#r=this.#r||o,r}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#I(t,n,r=!1){let i=!1,s="",o=!1,l=!1;for(let c=0;c<t.length;c++){let u=t.charAt(c);if(i){i=!1,s+=(_At.has(u)?"\\":"")+u;continue}if(u==="*"){if(l)continue;l=!0,s+=r&&/^[*]+$/.test(t)?B2e:z2e,n=!0;continue}else l=!1;if(u==="\\"){c===t.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[d,p,h,f]=j2e(t,c);if(h){s+=d,o=o||p,c+=h-1,n=n||f;continue}}if(u==="?"){s+=zV,n=!0;continue}s+=TAt(u)}return[s,fh(t),!!n,o]}};dl=wg;var BV=a((e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Ro=a((e,t,n={})=>(ck(t),!n.nocomment&&t.charAt(0)==="#"?!1:new W0(t,n).match(e)),"minimatch"),AAt=/^\*+([^+@!?*[(]*)$/,CAt=a(e=>t=>!t.startsWith(".")&&t.endsWith(e),"starDotExtTest"),RAt=a(e=>t=>t.endsWith(e),"starDotExtTestDot"),$At=a(e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),"starDotExtTestNocase"),OAt=a(e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),"starDotExtTestNocaseDot"),PAt=/^\*+\.\*+$/,NAt=a(e=>!e.startsWith(".")&&e.includes("."),"starDotStarTest"),DAt=a(e=>e!=="."&&e!==".."&&e.includes("."),"starDotStarTestDot"),MAt=/^\.\*+$/,LAt=a(e=>e!=="."&&e!==".."&&e.startsWith("."),"dotStarTest"),FAt=/^\*+$/,jAt=a(e=>e.length!==0&&!e.startsWith("."),"starTest"),qAt=a(e=>e.length!==0&&e!=="."&&e!=="..","starTestDot"),UAt=/^\?+([^+@!?*[(]*)?$/,zAt=a(([e,t=""])=>{let n=V2e([e]);return t?(t=t.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(t)):n},"qmarksTestNocase"),BAt=a(([e,t=""])=>{let n=G2e([e]);return t?(t=t.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(t)):n},"qmarksTestNocaseDot"),WAt=a(([e,t=""])=>{let n=G2e([e]);return t?r=>n(r)&&r.endsWith(t):n},"qmarksTestDot"),HAt=a(([e,t=""])=>{let n=V2e([e]);return t?r=>n(r)&&r.endsWith(t):n},"qmarksTest"),V2e=a(([e])=>{let t=e.length;return n=>n.length===t&&!n.startsWith(".")},"qmarksTestNoExt"),G2e=a(([e])=>{let t=e.length;return n=>n.length===t&&n!=="."&&n!==".."},"qmarksTestNoExtDot"),Z2e=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",W2e={win32:{sep:"\\"},posix:{sep:"/"}},VAt=Z2e==="win32"?W2e.win32.sep:W2e.posix.sep;Ro.sep=VAt;var wa=Symbol("globstar **");Ro.GLOBSTAR=wa;var GAt="[^/]",ZAt=GAt+"*?",KAt="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",JAt="(?:(?!(?:\\/|^)\\.).)*?",XAt=a((e,t={})=>n=>Ro(n,e,t),"filter");Ro.filter=XAt;var Sc=a((e,t={})=>Object.assign({},e,t),"ext"),YAt=a(e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return Ro;let t=Ro;return Object.assign(a((r,i,s={})=>t(r,i,Sc(e,s)),"m"),{Minimatch:class extends t.Minimatch{static{a(this,"Minimatch")}constructor(i,s={}){super(i,Sc(e,s))}static defaults(i){return t.defaults(Sc(e,i)).Minimatch}},AST:class extends t.AST{static{a(this,"AST")}constructor(i,s,o={}){super(i,s,Sc(e,o))}static fromGlob(i,s={}){return t.AST.fromGlob(i,Sc(e,s))}},unescape:a((r,i={})=>t.unescape(r,Sc(e,i)),"unescape"),escape:a((r,i={})=>t.escape(r,Sc(e,i)),"escape"),filter:a((r,i={})=>t.filter(r,Sc(e,i)),"filter"),defaults:a(r=>t.defaults(Sc(e,r)),"defaults"),makeRe:a((r,i={})=>t.makeRe(r,Sc(e,i)),"makeRe"),braceExpand:a((r,i={})=>t.braceExpand(r,Sc(e,i)),"braceExpand"),match:a((r,i,s={})=>t.match(r,i,Sc(e,s)),"match"),sep:t.sep,GLOBSTAR:wa})},"defaults");Ro.defaults=YAt;var K2e=a((e,t={})=>(ck(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:L2e(e,{max:t.braceExpandMax})),"braceExpand");Ro.braceExpand=K2e;var QAt=a((e,t={})=>new W0(e,t).makeRe(),"makeRe");Ro.makeRe=QAt;var eCt=a((e,t,n={})=>{let r=new W0(t,n);return e=e.filter(i=>r.match(i)),r.options.nonull&&!e.length&&e.push(t),e},"match");Ro.match=eCt;var H2e=/[?*]|[+@!]\(.*?\)|\[|\]/,tCt=a(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),W0=class{static{a(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,n={}){ck(t),n=n||{},this.options=n,this.maxGlobstarRecursion=n.maxGlobstarRecursion??200,this.pattern=t,this.platform=n.platform||Z2e,this.isWindows=this.platform==="win32";let r="allowWindowsEscape";this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n[r]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let n of t)if(typeof n!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,n=this.options;if(!n.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,l)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!H2e.test(s[2]))&&!H2e.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(d=>this.parse(d))];if(u)return[s[0],...s.slice(1).map(d=>this.parse(d))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let r of t)for(let i=0;i<r.length;i++)r[i]==="**"&&(r[i]="*");let{optimizationLevel:n=1}=this.options;return n>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):n>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(n=>{let r=-1;for(;(r=n.indexOf("**",r+1))!==-1;){let i=r;for(;n[i+1]==="**";)i++;i!==r&&n.splice(r,i-r)}return n})}levelOneOptimize(t){return t.map(n=>(n=n.reduce((r,i)=>{let s=r[r.length-1];return i==="**"&&s==="**"?r:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(i),r)},[]),n.length===0?[""]:n))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){let s=t[i];i===1&&s===""&&t[0]===""||(s==="."||s==="")&&(n=!0,t.splice(i,1),i--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(n=!0,t.pop())}let r=0;for(;(r=t.indexOf("..",r+1))!==-1;){let i=t[r-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(n=!0,t.splice(r-1,2),r-=2)}}while(n);return t.length===0?[""]:t}firstPhasePreProcess(t){let n=!1;do{n=!1;for(let r of t){let i=-1;for(;(i=r.indexOf("**",i+1))!==-1;){let o=i;for(;r[o+1]==="**";)o++;o>i&&r.splice(i+1,o-i);let l=r[i+1],c=r[i+2],u=r[i+3];if(l!==".."||!c||c==="."||c===".."||!u||u==="."||u==="..")continue;n=!0,r.splice(i,1);let d=r.slice(0);d[i]="**",t.push(d),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<r.length-1;o++){let l=r[o];o===1&&l===""&&r[0]===""||(l==="."||l==="")&&(n=!0,r.splice(o,1),o--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(n=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let o=r[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){n=!0;let c=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...c),r.length===0&&r.push(""),s-=2}}}}while(n);return t}secondPhasePreProcess(t){for(let n=0;n<t.length-1;n++)for(let r=n+1;r<t.length;r++){let i=this.partsMatch(t[n],t[r],!this.preserveMultipleSlashes);if(i){t[n]=[],t[r]=i;break}}return t.filter(n=>n.length)}partsMatch(t,n,r=!1){let i=0,s=0,o=[],l="";for(;i<t.length&&s<n.length;)if(t[i]===n[s])o.push(l==="b"?n[s]:t[i]),i++,s++;else if(r&&t[i]==="**"&&n[s]===t[i+1])o.push(t[i]),i++;else if(r&&n[s]==="**"&&t[i]===n[s+1])o.push(n[s]),s++;else if(t[i]==="*"&&n[s]&&(this.options.dot||!n[s].startsWith("."))&&n[s]!=="**"){if(l==="b")return!1;l="a",o.push(t[i]),i++,s++}else if(n[s]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(l==="a")return!1;l="b",o.push(n[s]),i++,s++}else return!1;return t.length===n.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,n=!1,r=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)n=!n,r++;r&&(this.pattern=t.slice(r)),this.negate=n}matchOne(t,n,r=!1){let i=0,s=0;if(this.isWindows){let l=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),c=!l&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),u=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),d=!u&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),p=c?3:l?0:void 0,h=d?3:u?0:void 0;if(typeof p=="number"&&typeof h=="number"){let[f,g]=[t[p],n[h]];f.toLowerCase()===g.toLowerCase()&&(n[h]=f,s=h,i=p)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(t=this.levelTwoFileOptimize(t)),n.includes(wa)?this.#e(t,n,r,i,s):this.#r(t,n,r,i,s)}#e(t,n,r,i,s){let o=n.indexOf(wa,s),l=n.lastIndexOf(wa),[c,u,d]=r?[n.slice(s,o),n.slice(o+1),[]]:[n.slice(s,o),n.slice(o+1,l),n.slice(l+1)];if(c.length){let b=t.slice(i,i+c.length);if(!this.#r(b,c,r,0,0))return!1;i+=c.length,s+=c.length}let p=0;if(d.length){if(d.length+i>t.length)return!1;let b=t.length-d.length;if(this.#r(t,d,r,b,0))p=d.length;else{if(t[t.length-1]!==""||i+d.length===t.length||(b--,!this.#r(t,d,r,b,0)))return!1;p=d.length+1}}if(!u.length){let b=!!p;for(let S=i;S<t.length-p;S++){let k=String(t[S]);if(b=!0,k==="."||k===".."||!this.options.dot&&k.startsWith("."))return!1}return r||b}let h=[[[],0]],f=h[0],g=0,y=[0];for(let b of u)b===wa?(y.push(g),f=[[],0],h.push(f)):(f[0].push(b),g++);let v=h.length-1,w=t.length-p;for(let b of h)b[1]=w-(y[v--]+b[0].length);return!!this.#n(t,h,i,0,r,0,!!p)}#n(t,n,r,i,s,o,l){let c=n[i];if(!c){for(let p=r;p<t.length;p++){l=!0;let h=t[p];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1}return l}let[u,d]=c;for(;r<=d;){if(this.#r(t.slice(0,r+u.length),u,s,r,0)&&o<this.maxGlobstarRecursion){let f=this.#n(t,n,r+u.length,i+1,s,o+1,l);if(f!==!1)return f}let h=t[r];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1;r++}return s||null}#r(t,n,r,i,s){let o,l,c,u;for(o=i,l=s,u=t.length,c=n.length;o<u&&l<c;o++,l++){this.debug("matchOne loop");let d=n[l],p=t[o];if(this.debug(n,d,p),d===!1||d===wa)return!1;let h;if(typeof d=="string"?(h=p===d,this.debug("string match",d,p,h)):(h=d.test(p),this.debug("pattern match",d,p,h)),!h)return!1}if(o===u&&l===c)return!0;if(o===u)return r;if(l===c)return o===u-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return K2e(this.pattern,this.options)}parse(t){ck(t);let n=this.options;if(t==="**")return wa;if(t==="")return"";let r,i=null;(r=t.match(FAt))?i=n.dot?qAt:jAt:(r=t.match(AAt))?i=(n.nocase?n.dot?OAt:$At:n.dot?RAt:CAt)(r[1]):(r=t.match(UAt))?i=(n.nocase?n.dot?BAt:zAt:n.dot?WAt:HAt)(r):(r=t.match(PAt))?i=n.dot?DAt:NAt:(r=t.match(MAt))&&(i=LAt);let s=wg.fromGlob(t,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let n=this.options,r=n.noglobstar?ZAt:n.dot?KAt:JAt,i=new Set(n.nocase?["i"]:[]),s=t.map(c=>{let u=c.map(p=>{if(p instanceof RegExp)for(let h of p.flags.split(""))i.add(h);return typeof p=="string"?tCt(p):p===wa?wa:p._src});u.forEach((p,h)=>{let f=u[h+1],g=u[h-1];p!==wa||g===wa||(g===void 0?f!==void 0&&f!==wa?u[h+1]="(?:\\/|"+r+"\\/)?"+f:u[h]=r:f===void 0?u[h-1]=g+"(?:\\/|\\/"+r+")?":f!==wa&&(u[h-1]=g+"(?:\\/|\\/"+r+"\\/)"+f,u[h+1]=wa))});let d=u.filter(p=>p!==wa);if(this.partial&&d.length>=1){let p=[];for(let h=1;h<=d.length;h++)p.push(d.slice(0,h).join("/"));return"(?:"+p.join("|")+")"}return d.join("/")}).join("|"),[o,l]=t.length>1?["(?:",")"]:["",""];s="^"+o+s+l+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+l+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,n=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&n)return!0;let r=this.options;this.isWindows&&(t=t.split("\\").join("/"));let i=this.slashSplit(t);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let l=i.length-2;!o&&l>=0;l--)o=i[l];for(let l of s){let c=i;if(r.matchBase&&l.length===1&&(c=[o]),this.matchOne(c,l,n))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(t){return Ro.defaults(t).Minimatch}};Ro.AST=wg;Ro.Minimatch=W0;Ro.escape=BV;Ro.unescape=fh;import{gunzipSync as oRt}from"node:zlib";var dk=class{static{a(this,"Diff")}diff(t,n,r={}){let i;typeof r=="function"?(i=r,r={}):"callback"in r&&(i=r.callback);let s=this.castInput(t,r),o=this.castInput(n,r),l=this.removeEmpty(this.tokenize(s,r)),c=this.removeEmpty(this.tokenize(o,r));return this.diffWithOptionsObj(l,c,r,i)}diffWithOptionsObj(t,n,r,i){var s;let o=a(b=>{if(b=this.postProcess(b,r),i){setTimeout(function(){i(b)},0);return}else return b},"done"),l=n.length,c=t.length,u=1,d=l+c;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));let p=(s=r.timeout)!==null&&s!==void 0?s:1/0,h=Date.now()+p,f=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(f[0],n,t,0,r);if(f[0].oldPos+1>=c&&g+1>=l)return o(this.buildValues(f[0].lastComponent,n,t));let y=-1/0,v=1/0,w=a(()=>{for(let b=Math.max(y,-u);b<=Math.min(v,u);b+=2){let S,k=f[b-1],E=f[b+1];k&&(f[b-1]=void 0);let T=!1;if(E){let N=E.oldPos-b;T=E&&0<=N&&N<l}let I=k&&k.oldPos+1<c;if(!T&&!I){f[b]=void 0;continue}if(!I||T&&k.oldPos<E.oldPos?S=this.addToPath(E,!0,!1,0,r):S=this.addToPath(k,!1,!0,1,r),g=this.extractCommon(S,n,t,b,r),S.oldPos+1>=c&&g+1>=l)return o(this.buildValues(S.lastComponent,n,t))||!0;f[b]=S,S.oldPos+1>=c&&(v=Math.min(v,b-1)),g+1>=l&&(y=Math.max(y,b+1))}u++},"execEditLength");if(i)a(function b(){setTimeout(function(){if(u>d||Date.now()>h)return i(void 0);w()||b()},0)},"exec")();else for(;u<=d&&Date.now()<=h;){let b=w();if(b)return b}}addToPath(t,n,r,i,s){let o=t.lastComponent;return o&&!s.oneChangePerToken&&o.added===n&&o.removed===r?{oldPos:t.oldPos+i,lastComponent:{count:o.count+1,added:n,removed:r,previousComponent:o.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:o}}}extractCommon(t,n,r,i,s){let o=n.length,l=r.length,c=t.oldPos,u=c-i,d=0;for(;u+1<o&&c+1<l&&this.equals(r[c+1],n[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){let n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){let i=[],s;for(;t;)i.push(t),s=t.previousComponent,delete t.previousComponent,t=s;i.reverse();let o=i.length,l=0,c=0,u=0;for(;l<o;l++){let d=i[l];if(d.removed)d.value=this.join(r.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let p=n.slice(c,c+d.count);p=p.map(function(h,f){let g=r[u+f];return g.length>h.length?g:h}),d.value=this.join(p)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return i}};var WV=class extends dk{static{a(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=rCt}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
4860
|
+
`}a(_2e,"pageStyles");BI();ir();var OV=Object.freeze({id:"direct",capabilities:Object.freeze(["bash"]),plan:"free",shell:"just-bash-direct",probe:a(e=>e.LOADER===void 0?"available":"needs-binding","probe")}),ok=Object.freeze({id:"dynamic-worker",capabilities:Object.freeze(["bash","coding"]),plan:"paid",shell:"just-bash-isolated",probe:a(e=>e.LOADER===void 0?"needs-binding":"available","probe")}),WIt=Object.freeze([ok,OV]);function PV(e,t=WIt){return t.filter(n=>n.probe(e)==="available")}a(PV,"availableEdgeRuntimeProviders");function NV(e,t={}){let n=a((i,s)=>e.find(o=>o.id===s&&o.capabilities.includes(i)),"serves"),r=n("bash",t.bash)??e.find(i=>i.capabilities.includes("bash"));if(r===void 0)throw new Error("No available runtime provider serves the bash layer.");return{bash:r.id,coding:n("coding",t.coding)?.id??null,subprocess:n("subprocess",t.subprocess)?.id??null}}a(NV,"resolveEdgeRuntimeSelection");function T2e(e){let t=PV(e),{bash:n}=NV(t);return t.find(r=>r.id===n).shell}a(T2e,"resolveEdgeRuntimeShell");function HIt(){return"dsh-edge@0.17.0/direct"}a(HIt,"resolveEdgeDeploymentId");function ak(e){return{baseURL:cU(e.DEEPSEEK_BASE_URL),maxTokens:pU(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:Hm(e.DEEPSEEK_MODEL),reasoningEffort:uU(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:VC(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:dU(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:nk(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}a(ak,"resolveEdgeDeploymentConfig");function VIt(e){return typeof e.DEEPSEEK_API_KEY=="string"&&e.DEEPSEEK_API_KEY.trim().length>0}a(VIt,"edgeDeploymentApiKeyConfigured");function GIt(e){let t=cU(e),n=new URL(t);return n.search.length===0&&n.hash.length===0?t:(n.search="",n.hash="",n.href)}a(GIt,"projectedEdgeBaseURL");function DV(e,t){return{shell:T2e(e),storage:"durable-object-sqlite-vfs",attachmentStorage:t??(e.DSH_EDGE_ATTACHMENTS===void 0?"temporary-do":"private-r2"),deploymentId:HIt(),apiKeyConfigured:VIt(e),baseURL:GIt(e.DEEPSEEK_BASE_URL),maxTokens:pU(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:Hm(e.DEEPSEEK_MODEL),reasoningEffort:uU(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:VC(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:dU(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:nk(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}a(DV,"resolveEdgeDeploymentProfile");function DR(e){ak(e);let t=DV(e);return{ok:!0,service:"dsh-edge",storage:t.storage,attachmentStorage:t.attachmentStorage,shell:t.shell,agent:"upstream-react-loop-agent",access:"single-owner-cookie",deploymentId:t.deploymentId,...e.CF_VERSION_METADATA===void 0?{}:{workerVersionId:e.CF_VERSION_METADATA.id},version:Fy,upstreamVersion:Cde,status:"ready"}}a(DR,"resolveEdgeDeploymentHealth");import{AsyncLocalStorage as iFt}from"node:async_hooks";var ZIt={session:"sessions",skill:"skills",agentPreset:"agentPresets",subagent:"subagents",goal:"goals",event:"events",download:"downloads"};function A2e(e,t){let n=t.indexOf("."),r=t.indexOf("/"),i=n>=0?n:r;if(i<0)return;let s=t.slice(0,i),o=t.slice(i+1),l=ZIt[s]??s,c=e[l];if(c===void 0)return;let u=c[o];return typeof u=="function"?u:void 0}a(A2e,"resolve");function KIt(e,t){return Response.json({type:"server-response",rpcId:e,result:{ok:!1,error:t}})}a(KIt,"errorResponse");async function MV(e,t,n,r,i){let s=A2e(e,t);if(s!==void 0)return await s({rpcId:n,payload:r},i)}a(MV,"callEdgeApi");async function C2e(e,t){let r=new URL(t.url).pathname;if(t.method!=="POST"||!r.startsWith("/api/"))return new Response("not found",{status:404});if(r==="/api/respond")return Response.json({accepted:!1,reason:"not-pending"});let i=r.slice(5);if(A2e(e,i)===void 0)return new Response("not found",{status:404});let s;try{s=await t.json()}catch{return new Response("body is not JSON",{status:400})}let o=typeof s.rpcId=="string"?s.rpcId:"invalid-request",l=s.payload??{};try{let c=await MV(e,i,o,l,t.signal);return c===void 0?new Response("not found",{status:404}):Response.json({type:"server-response",rpcId:c.rpcId,result:c.result})}catch(c){return KIt(o,{code:"internal",message:String(c),details:{}})}}a(C2e,"dispatchEdgeApi");Ir();ws();wf();import{DurableObject as sFt}from"cloudflare:workers";import{WorkerEntrypoint as VSn}from"cloudflare:workers";var Yg=kl(R2e(),1);var LV=a((e,t,n)=>{let r=e instanceof RegExp?$2e(e,n):e,i=t instanceof RegExp?$2e(t,n):t,s=r!==null&&i!=null&&JIt(r,i,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+r.length,s[1]),post:n.slice(s[1]+i.length)}},"balanced"),$2e=a((e,t)=>{let n=t.match(e);return n?n[0]:null},"maybeMatch"),JIt=a((e,t,n)=>{let r,i,s,o,l,c=n.indexOf(e),u=n.indexOf(t,c+1),d=c;if(c>=0&&u>0){if(e===t)return[c,u];for(r=[],s=n.length;d>=0&&!l;){if(d===c)r.push(d),c=n.indexOf(e,d+1);else if(r.length===1){let p=r.pop();p!==void 0&&(l=[p,u])}else i=r.pop(),i!==void 0&&i<s&&(s=i,o=u),u=n.indexOf(t,d+1);d=c<u&&c>=0?c:u}r.length&&o!==void 0&&(l=[s,o])}return l},"range");var O2e="\0SLASH"+Math.random()+"\0",P2e="\0OPEN"+Math.random()+"\0",qV="\0CLOSE"+Math.random()+"\0",N2e="\0COMMA"+Math.random()+"\0",D2e="\0PERIOD"+Math.random()+"\0",XIt=new RegExp(O2e,"g"),YIt=new RegExp(P2e,"g"),QIt=new RegExp(qV,"g"),eAt=new RegExp(N2e,"g"),tAt=new RegExp(D2e,"g"),nAt=/\\\\/g,rAt=/\\{/g,iAt=/\\}/g,sAt=/\\,/g,oAt=/\\\./g,aAt=1e5,lAt=4e6;function FV(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}a(FV,"numeric");function cAt(e){return e.replace(nAt,O2e).replace(rAt,P2e).replace(iAt,qV).replace(sAt,N2e).replace(oAt,D2e)}a(cAt,"escapeBraces");function uAt(e){return e.replace(XIt,"\\").replace(YIt,"{").replace(QIt,"}").replace(eAt,",").replace(tAt,".")}a(uAt,"unescapeBraces");function M2e(e){if(!e)return[""];let t=[],n=LV("{","}",e);if(!n)return e.split(",");let{pre:r,body:i,post:s}=n,o=r.split(",");o[o.length-1]+="{"+i+"}";let l=M2e(s);return s.length&&(o[o.length-1]+=l.shift(),o.push.apply(o,l)),t.push.apply(t,o),t}a(M2e,"parseCommaParts");function L2e(e,t={}){if(!e)return[];let{max:n=aAt,maxLength:r=lAt}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),jV(cAt(e),n,r,!0).map(uAt)}a(L2e,"expand");function dAt(e){return"{"+e+"}"}a(dAt,"embrace");function pAt(e){return/^-?0\d/.test(e)}a(pAt,"isPadded");function fAt(e,t){return e<=t}a(fAt,"lte");function hAt(e,t){return e>=t}a(hAt,"gte");function lk(e,t,n,r,i,s){let o=[],l=0;for(let c=0;c<e.length;c++)for(let u=0;u<n.length;u++){if(o.length>=r)return o;let d=e[c]+t+n[u];if(!(s&&!d)){if(l+d.length>i)return o;o.push(d),l+=d.length}}return o}a(lk,"combine");function mAt(e,t,n,r){let i=e.split(/\.\./),s=[];if(i[0]===void 0||i[1]===void 0)return s;let o=FV(i[0]),l=FV(i[1]),c=Math.max(i[0].length,i[1].length),u=i.length===3&&i[2]!==void 0?Math.max(Math.abs(FV(i[2])),1):1,d=fAt;l<o&&(u*=-1,d=hAt);let h=i.some(pAt),f=0;for(let g=o;d(g,l)&&s.length<n;g+=u){let y;if(t)y=String.fromCharCode(g),y==="\\"&&(y="");else if(y=String(g),h){let v=c-y.length;if(v>0){let w=new Array(v+1).join("0");g<0?y="-"+w+y.slice(1):y=w+y}}if(f+y.length>r)break;s.push(y),f+=y.length}return s}a(mAt,"expandSequence");function jV(e,t,n,r){let i=[""],s=!1,o=!0;for(;;){let l=LV("{","}",e);if(!l)return lk(i,e,[""],t,n,s);let c=l.pre;if(/\$$/.test(c)){if(i=lk(i,c+"{"+l.body+"}",[""],t,n,s&&!l.post.length),o=!1,!l.post.length)break;e=l.post;continue}let u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(l.body),d=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(l.body),p=u||d,h=l.body.indexOf(",")>=0;if(!p&&!h){if(l.post.match(/,(?!,).*\}/)){e=l.pre+"{"+l.body+qV+l.post,r=!0;continue}return lk(i,c+"{"+l.body+"}"+l.post,[""],t,n,s)}o&&(s=r&&!p,o=!1);let f;if(p)f=mAt(l.body,d,t,n);else{let g=M2e(l.body);if(g.length===1&&g[0]!==void 0&&(g=jV(g[0],t,n,!1).map(dAt),g.length===1)){if(i=lk(i,c+g[0],[""],t,n,s&&!l.post.length),!l.post.length)break;e=l.post;continue}let y=s&&!l.post.length&&!c;for(let w=0;y&&w<i.length;w++)i[w]&&(y=!1);f=[];let v=0;e:for(let w=0;w<g.length;w++){let b=jV(g[w],t,n,!1);for(let S=0;S<b.length;S++){let k=b[S];if(!(y&&!k)){if(f.length>=t||v+k.length>n)break e;f.push(k),v+=k.length}}}}if(i=lk(i,c,f,t,n,s&&!l.post.length),!l.post.length)break;e=l.post}return i}a(jV,"expand_");var ck=a(e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var gAt={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},uk=a(e=>e.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),yAt=a(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),F2e=a(e=>e.join(""),"rangesToString"),j2e=a((e,t)=>{let n=t;if(e.charAt(n)!=="[")throw new Error("not in a brace expression");let r=[],i=[],s=n+1,o=!1,l=!1,c=!1,u=!1,d=n,p="";e:for(;s<e.length;){let y=e.charAt(s);if((y==="!"||y==="^")&&s===n+1){u=!0,s++;continue}if(y==="]"&&o&&!c){d=s+1;break}if(o=!0,y==="\\"&&!c){c=!0,s++;continue}if(y==="["&&!c){for(let[v,[w,b,S]]of Object.entries(gAt))if(e.startsWith(v,s)){if(p)return["$.",!1,e.length-n,!0];s+=v.length,S?i.push(w):r.push(w),l=l||b;continue e}}if(c=!1,p){y>p?r.push(uk(p)+"-"+uk(y)):y===p&&r.push(uk(y)),p="",s++;continue}if(e.startsWith("-]",s+1)){r.push(uk(y+"-")),s+=2;continue}if(e.startsWith("-",s+1)){p=y,s+=2;continue}r.push(uk(y)),s++}if(d<s)return["",!1,0,!1];if(!r.length&&!i.length)return["$.",!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!u){let y=r[0].length===2?r[0].slice(-1):r[0];return[yAt(y),!1,d-n,!1]}let h="["+(u?"^":"")+F2e(r)+"]",f="["+(u?"":"^")+F2e(i)+"]";return[r.length&&i.length?"("+h+"|"+f+")":r.length?h:f,l,d-n,!0]},"parseClass");var fh=a((e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?e.replace(/\[([^/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1"),"unescape");var dl,vAt=new Set(["!","?","+","*","@"]),UV=a(e=>vAt.has(e),"isExtglobType"),q2e=a(e=>UV(e.type),"isExtglobAST"),xAt=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),bAt=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),wAt=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),U2e=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),SAt="(?!(?:^|/)\\.\\.?(?:$|/))",LR="(?!\\.)",kAt=new Set(["[","."]),EAt=new Set(["..","."]),_At=new Set("().*{}+?[]^$\\!"),TAt=a(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),zV="[^/]",z2e=zV+"*?",B2e=zV+"+?",IAt=0,wg=class{static{a(this,"AST")}type;#e;#n;#r=!1;#t=[];#i;#s;#a;#d=!1;#l;#o;#c=!1;id=++IAt;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(t,n,r={}){this.type=t,t&&(this.#n=!0),this.#i=n,this.#e=this.#i?this.#i.#e:this,this.#l=this.#e===this?r:this.#e.#l,this.#a=this.#e===this?[]:this.#e.#a,t==="!"&&!this.#e.#d&&this.#a.push(this),this.#s=this.#i?this.#i.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#o!==void 0?this.#o:this.type?this.#o=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#o=this.#t.map(t=>String(t)).join("")}#E(){if(this!==this.#e)throw new Error("should only call on root");if(this.#d)return this;this.toString(),this.#d=!0;let t;for(;t=this.#a.pop();){if(t.type!=="!")continue;let n=t,r=n.#i;for(;r;){for(let i=n.#s+1;!r.type&&i<r.#t.length;i++)for(let s of t.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(r.#t[i])}n=r,r=n.#i}}return this}push(...t){for(let n of t)if(n!==""){if(typeof n!="string"&&!(n instanceof dl&&n.#i===this))throw new Error("invalid part: "+n);this.#t.push(n)}}toJSON(){let t=this.type===null?this.#t.slice().map(n=>typeof n=="string"?n:n.toJSON()):[this.type,...this.#t.map(n=>n.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#d&&this.#i?.type==="!")&&t.push({}),t}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#s===0)return!0;let t=this.#i;for(let n=0;n<this.#s;n++){let r=t.#t[n];if(!(r instanceof dl&&r.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type==="!")return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let t=this.#i?this.#i.#t.length:0;return this.#s===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let n=new dl(this.type,t);for(let r of this.#t)n.copyIn(r);return n}static#m(t,n,r,i,s){let o=i.maxExtglobRecursion??2,l=!1,c=!1,u=-1,d=!1;if(n.type===null){let y=r,v="";for(;y<t.length;){let w=t.charAt(y++);if(l||w==="\\"){l=!l,v+=w;continue}if(c){y===u+1?(w==="^"||w==="!")&&(d=!0):w==="]"&&!(y===u+2&&d)&&(c=!1),v+=w;continue}else if(w==="["){c=!0,u=y,d=!1,v+=w;continue}if(!i.noext&&UV(w)&&t.charAt(y)==="("&&s<=o){n.push(v),v="";let S=new dl(w,n);y=dl.#m(t,S,y,i,s+1),n.push(S);continue}v+=w}return n.push(v),y}let p=r+1,h=new dl(null,n),f=[],g="";for(;p<t.length;){let y=t.charAt(p++);if(l||y==="\\"){l=!l,g+=y;continue}if(c){p===u+1?(y==="^"||y==="!")&&(d=!0):y==="]"&&!(p===u+2&&d)&&(c=!1),g+=y;continue}else if(y==="["){c=!0,u=p,d=!1,g+=y;continue}if(!i.noext&&UV(y)&&t.charAt(p)==="("&&(s<=o||n&&n.#y(y))){let w=n&&n.#y(y)?0:1;h.push(g),g="";let b=new dl(y,h);h.push(b),p=dl.#m(t,b,p,i,s+w);continue}if(y==="|"){h.push(g),g="",f.push(h),h=new dl(null,n);continue}if(y===")")return g===""&&n.#t.length===0&&(n.#c=!0),h.push(g),g="",n.push(...f,h),p;g+=y}return n.type=null,n.#n=void 0,n.#t=[t.substring(r-1)],p}#P(t){return this.#g(t,bAt)}#g(t,n=xAt){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null)return!1;let r=t.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#y(r.type,n)}#y(t,n=wAt){return!!n.get(this.type)?.includes(t)}#p(t,n){let r=t.#t[0],i=new dl(null,r,this.options);i.#t.push(""),r.push(i),this.#_(t,n)}#_(t,n){let r=t.#t[0];this.#t.splice(n,1,...r.#t);for(let i of r.#t)typeof i=="object"&&(i.#i=this);this.#o=void 0}#T(t){return!!U2e.get(this.type)?.has(t)}#N(t){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let n=t.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#T(n.type)}#v(t){let n=U2e.get(this.type),r=t.#t[0],i=n?.get(r.type);if(!i)return!1;this.#t=r.#t;for(let s of this.#t)typeof s=="object"&&(s.#i=this);this.type=i,this.#o=void 0,this.#c=!1}static fromGlob(t,n={}){let r=new dl(null,void 0,n);return dl.#m(t,r,0,n,0),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let t=this.toString(),[n,r,i,s]=this.toRegExpSource();if(!(i||this.#n||this.#l.nocase&&!this.#l.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return r;let l=(this.#l.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${n}$`,l),{_src:n,_glob:t})}get options(){return this.#l}toRegExpSource(t){let n=t??!!this.#l.dot;if(this.#e===this&&(this.#f(),this.#E()),!q2e(this)){let c=this.isStart()&&this.isEnd()&&!this.#t.some(f=>typeof f!="string"),u=this.#t.map(f=>{let[g,y,v,w]=typeof f=="string"?dl.#I(f,this.#n,c):f.toRegExpSource(t);return this.#n=this.#n||v,this.#r=this.#r||w,g}).join(""),d="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&EAt.has(this.#t[0]))){let g=kAt,y=n&&g.has(u.charAt(0))||u.startsWith("\\.")&&g.has(u.charAt(2))||u.startsWith("\\.\\.")&&g.has(u.charAt(4)),v=!n&&!t&&g.has(u.charAt(0));d=y?SAt:v?LR:""}let p="";return this.isEnd()&&this.#e.#d&&this.#i?.type==="!"&&(p="(?:$|\\/)"),[d+u+p,fh(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#x(n);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),u=this;return u.#t=[c],u.type=null,u.#n=void 0,[c,fh(this.toString()),!1,!1]}let o=!r||t||n||!LR?"":this.#x(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let l="";if(this.type==="!"&&this.#c)l=(this.isStart()&&!n?LR:"")+B2e;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!t?LR:"")+z2e+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;l=i+s+c}return[l,fh(s),this.#n=!!this.#n,this.#r]}#f(){if(q2e(this)){let t=0,n=!1;do{n=!0;for(let r=0;r<this.#t.length;r++){let i=this.#t[r];typeof i=="object"&&(i.#f(),this.#g(i)?(n=!1,this.#_(i,r)):this.#P(i)?(n=!1,this.#p(i,r)):this.#N(i)&&(n=!1,this.#v(i)))}}while(!n&&++t<10)}else for(let t of this.#t)typeof t=="object"&&t.#f();this.#o=void 0}#x(t){return this.#t.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[r,i,s,o]=n.toRegExpSource(t);return this.#r=this.#r||o,r}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#I(t,n,r=!1){let i=!1,s="",o=!1,l=!1;for(let c=0;c<t.length;c++){let u=t.charAt(c);if(i){i=!1,s+=(_At.has(u)?"\\":"")+u;continue}if(u==="*"){if(l)continue;l=!0,s+=r&&/^[*]+$/.test(t)?B2e:z2e,n=!0;continue}else l=!1;if(u==="\\"){c===t.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[d,p,h,f]=j2e(t,c);if(h){s+=d,o=o||p,c+=h-1,n=n||f;continue}}if(u==="?"){s+=zV,n=!0;continue}s+=TAt(u)}return[s,fh(t),!!n,o]}};dl=wg;var BV=a((e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Ro=a((e,t,n={})=>(ck(t),!n.nocomment&&t.charAt(0)==="#"?!1:new W0(t,n).match(e)),"minimatch"),AAt=/^\*+([^+@!?*[(]*)$/,CAt=a(e=>t=>!t.startsWith(".")&&t.endsWith(e),"starDotExtTest"),RAt=a(e=>t=>t.endsWith(e),"starDotExtTestDot"),$At=a(e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),"starDotExtTestNocase"),OAt=a(e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),"starDotExtTestNocaseDot"),PAt=/^\*+\.\*+$/,NAt=a(e=>!e.startsWith(".")&&e.includes("."),"starDotStarTest"),DAt=a(e=>e!=="."&&e!==".."&&e.includes("."),"starDotStarTestDot"),MAt=/^\.\*+$/,LAt=a(e=>e!=="."&&e!==".."&&e.startsWith("."),"dotStarTest"),FAt=/^\*+$/,jAt=a(e=>e.length!==0&&!e.startsWith("."),"starTest"),qAt=a(e=>e.length!==0&&e!=="."&&e!=="..","starTestDot"),UAt=/^\?+([^+@!?*[(]*)?$/,zAt=a(([e,t=""])=>{let n=V2e([e]);return t?(t=t.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(t)):n},"qmarksTestNocase"),BAt=a(([e,t=""])=>{let n=G2e([e]);return t?(t=t.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(t)):n},"qmarksTestNocaseDot"),WAt=a(([e,t=""])=>{let n=G2e([e]);return t?r=>n(r)&&r.endsWith(t):n},"qmarksTestDot"),HAt=a(([e,t=""])=>{let n=V2e([e]);return t?r=>n(r)&&r.endsWith(t):n},"qmarksTest"),V2e=a(([e])=>{let t=e.length;return n=>n.length===t&&!n.startsWith(".")},"qmarksTestNoExt"),G2e=a(([e])=>{let t=e.length;return n=>n.length===t&&n!=="."&&n!==".."},"qmarksTestNoExtDot"),Z2e=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",W2e={win32:{sep:"\\"},posix:{sep:"/"}},VAt=Z2e==="win32"?W2e.win32.sep:W2e.posix.sep;Ro.sep=VAt;var wa=Symbol("globstar **");Ro.GLOBSTAR=wa;var GAt="[^/]",ZAt=GAt+"*?",KAt="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",JAt="(?:(?!(?:\\/|^)\\.).)*?",XAt=a((e,t={})=>n=>Ro(n,e,t),"filter");Ro.filter=XAt;var Sc=a((e,t={})=>Object.assign({},e,t),"ext"),YAt=a(e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return Ro;let t=Ro;return Object.assign(a((r,i,s={})=>t(r,i,Sc(e,s)),"m"),{Minimatch:class extends t.Minimatch{static{a(this,"Minimatch")}constructor(i,s={}){super(i,Sc(e,s))}static defaults(i){return t.defaults(Sc(e,i)).Minimatch}},AST:class extends t.AST{static{a(this,"AST")}constructor(i,s,o={}){super(i,s,Sc(e,o))}static fromGlob(i,s={}){return t.AST.fromGlob(i,Sc(e,s))}},unescape:a((r,i={})=>t.unescape(r,Sc(e,i)),"unescape"),escape:a((r,i={})=>t.escape(r,Sc(e,i)),"escape"),filter:a((r,i={})=>t.filter(r,Sc(e,i)),"filter"),defaults:a(r=>t.defaults(Sc(e,r)),"defaults"),makeRe:a((r,i={})=>t.makeRe(r,Sc(e,i)),"makeRe"),braceExpand:a((r,i={})=>t.braceExpand(r,Sc(e,i)),"braceExpand"),match:a((r,i,s={})=>t.match(r,i,Sc(e,s)),"match"),sep:t.sep,GLOBSTAR:wa})},"defaults");Ro.defaults=YAt;var K2e=a((e,t={})=>(ck(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:L2e(e,{max:t.braceExpandMax})),"braceExpand");Ro.braceExpand=K2e;var QAt=a((e,t={})=>new W0(e,t).makeRe(),"makeRe");Ro.makeRe=QAt;var eCt=a((e,t,n={})=>{let r=new W0(t,n);return e=e.filter(i=>r.match(i)),r.options.nonull&&!e.length&&e.push(t),e},"match");Ro.match=eCt;var H2e=/[?*]|[+@!]\(.*?\)|\[|\]/,tCt=a(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),W0=class{static{a(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,n={}){ck(t),n=n||{},this.options=n,this.maxGlobstarRecursion=n.maxGlobstarRecursion??200,this.pattern=t,this.platform=n.platform||Z2e,this.isWindows=this.platform==="win32";let r="allowWindowsEscape";this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n[r]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let n of t)if(typeof n!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,n=this.options;if(!n.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,l)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!H2e.test(s[2]))&&!H2e.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(d=>this.parse(d))];if(u)return[s[0],...s.slice(1).map(d=>this.parse(d))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let r of t)for(let i=0;i<r.length;i++)r[i]==="**"&&(r[i]="*");let{optimizationLevel:n=1}=this.options;return n>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):n>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(n=>{let r=-1;for(;(r=n.indexOf("**",r+1))!==-1;){let i=r;for(;n[i+1]==="**";)i++;i!==r&&n.splice(r,i-r)}return n})}levelOneOptimize(t){return t.map(n=>(n=n.reduce((r,i)=>{let s=r[r.length-1];return i==="**"&&s==="**"?r:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(i),r)},[]),n.length===0?[""]:n))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){let s=t[i];i===1&&s===""&&t[0]===""||(s==="."||s==="")&&(n=!0,t.splice(i,1),i--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(n=!0,t.pop())}let r=0;for(;(r=t.indexOf("..",r+1))!==-1;){let i=t[r-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(n=!0,t.splice(r-1,2),r-=2)}}while(n);return t.length===0?[""]:t}firstPhasePreProcess(t){let n=!1;do{n=!1;for(let r of t){let i=-1;for(;(i=r.indexOf("**",i+1))!==-1;){let o=i;for(;r[o+1]==="**";)o++;o>i&&r.splice(i+1,o-i);let l=r[i+1],c=r[i+2],u=r[i+3];if(l!==".."||!c||c==="."||c===".."||!u||u==="."||u==="..")continue;n=!0,r.splice(i,1);let d=r.slice(0);d[i]="**",t.push(d),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<r.length-1;o++){let l=r[o];o===1&&l===""&&r[0]===""||(l==="."||l==="")&&(n=!0,r.splice(o,1),o--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(n=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let o=r[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){n=!0;let c=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...c),r.length===0&&r.push(""),s-=2}}}}while(n);return t}secondPhasePreProcess(t){for(let n=0;n<t.length-1;n++)for(let r=n+1;r<t.length;r++){let i=this.partsMatch(t[n],t[r],!this.preserveMultipleSlashes);if(i){t[n]=[],t[r]=i;break}}return t.filter(n=>n.length)}partsMatch(t,n,r=!1){let i=0,s=0,o=[],l="";for(;i<t.length&&s<n.length;)if(t[i]===n[s])o.push(l==="b"?n[s]:t[i]),i++,s++;else if(r&&t[i]==="**"&&n[s]===t[i+1])o.push(t[i]),i++;else if(r&&n[s]==="**"&&t[i]===n[s+1])o.push(n[s]),s++;else if(t[i]==="*"&&n[s]&&(this.options.dot||!n[s].startsWith("."))&&n[s]!=="**"){if(l==="b")return!1;l="a",o.push(t[i]),i++,s++}else if(n[s]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(l==="a")return!1;l="b",o.push(n[s]),i++,s++}else return!1;return t.length===n.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,n=!1,r=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)n=!n,r++;r&&(this.pattern=t.slice(r)),this.negate=n}matchOne(t,n,r=!1){let i=0,s=0;if(this.isWindows){let l=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),c=!l&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),u=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),d=!u&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),p=c?3:l?0:void 0,h=d?3:u?0:void 0;if(typeof p=="number"&&typeof h=="number"){let[f,g]=[t[p],n[h]];f.toLowerCase()===g.toLowerCase()&&(n[h]=f,s=h,i=p)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(t=this.levelTwoFileOptimize(t)),n.includes(wa)?this.#e(t,n,r,i,s):this.#r(t,n,r,i,s)}#e(t,n,r,i,s){let o=n.indexOf(wa,s),l=n.lastIndexOf(wa),[c,u,d]=r?[n.slice(s,o),n.slice(o+1),[]]:[n.slice(s,o),n.slice(o+1,l),n.slice(l+1)];if(c.length){let b=t.slice(i,i+c.length);if(!this.#r(b,c,r,0,0))return!1;i+=c.length,s+=c.length}let p=0;if(d.length){if(d.length+i>t.length)return!1;let b=t.length-d.length;if(this.#r(t,d,r,b,0))p=d.length;else{if(t[t.length-1]!==""||i+d.length===t.length||(b--,!this.#r(t,d,r,b,0)))return!1;p=d.length+1}}if(!u.length){let b=!!p;for(let S=i;S<t.length-p;S++){let k=String(t[S]);if(b=!0,k==="."||k===".."||!this.options.dot&&k.startsWith("."))return!1}return r||b}let h=[[[],0]],f=h[0],g=0,y=[0];for(let b of u)b===wa?(y.push(g),f=[[],0],h.push(f)):(f[0].push(b),g++);let v=h.length-1,w=t.length-p;for(let b of h)b[1]=w-(y[v--]+b[0].length);return!!this.#n(t,h,i,0,r,0,!!p)}#n(t,n,r,i,s,o,l){let c=n[i];if(!c){for(let p=r;p<t.length;p++){l=!0;let h=t[p];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1}return l}let[u,d]=c;for(;r<=d;){if(this.#r(t.slice(0,r+u.length),u,s,r,0)&&o<this.maxGlobstarRecursion){let f=this.#n(t,n,r+u.length,i+1,s,o+1,l);if(f!==!1)return f}let h=t[r];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1;r++}return s||null}#r(t,n,r,i,s){let o,l,c,u;for(o=i,l=s,u=t.length,c=n.length;o<u&&l<c;o++,l++){this.debug("matchOne loop");let d=n[l],p=t[o];if(this.debug(n,d,p),d===!1||d===wa)return!1;let h;if(typeof d=="string"?(h=p===d,this.debug("string match",d,p,h)):(h=d.test(p),this.debug("pattern match",d,p,h)),!h)return!1}if(o===u&&l===c)return!0;if(o===u)return r;if(l===c)return o===u-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return K2e(this.pattern,this.options)}parse(t){ck(t);let n=this.options;if(t==="**")return wa;if(t==="")return"";let r,i=null;(r=t.match(FAt))?i=n.dot?qAt:jAt:(r=t.match(AAt))?i=(n.nocase?n.dot?OAt:$At:n.dot?RAt:CAt)(r[1]):(r=t.match(UAt))?i=(n.nocase?n.dot?BAt:zAt:n.dot?WAt:HAt)(r):(r=t.match(PAt))?i=n.dot?DAt:NAt:(r=t.match(MAt))&&(i=LAt);let s=wg.fromGlob(t,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let n=this.options,r=n.noglobstar?ZAt:n.dot?KAt:JAt,i=new Set(n.nocase?["i"]:[]),s=t.map(c=>{let u=c.map(p=>{if(p instanceof RegExp)for(let h of p.flags.split(""))i.add(h);return typeof p=="string"?tCt(p):p===wa?wa:p._src});u.forEach((p,h)=>{let f=u[h+1],g=u[h-1];p!==wa||g===wa||(g===void 0?f!==void 0&&f!==wa?u[h+1]="(?:\\/|"+r+"\\/)?"+f:u[h]=r:f===void 0?u[h-1]=g+"(?:\\/|\\/"+r+")?":f!==wa&&(u[h-1]=g+"(?:\\/|\\/"+r+"\\/)"+f,u[h+1]=wa))});let d=u.filter(p=>p!==wa);if(this.partial&&d.length>=1){let p=[];for(let h=1;h<=d.length;h++)p.push(d.slice(0,h).join("/"));return"(?:"+p.join("|")+")"}return d.join("/")}).join("|"),[o,l]=t.length>1?["(?:",")"]:["",""];s="^"+o+s+l+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+l+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,n=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&n)return!0;let r=this.options;this.isWindows&&(t=t.split("\\").join("/"));let i=this.slashSplit(t);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let l=i.length-2;!o&&l>=0;l--)o=i[l];for(let l of s){let c=i;if(r.matchBase&&l.length===1&&(c=[o]),this.matchOne(c,l,n))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(t){return Ro.defaults(t).Minimatch}};Ro.AST=wg;Ro.Minimatch=W0;Ro.escape=BV;Ro.unescape=fh;import{gunzipSync as oRt}from"node:zlib";var dk=class{static{a(this,"Diff")}diff(t,n,r={}){let i;typeof r=="function"?(i=r,r={}):"callback"in r&&(i=r.callback);let s=this.castInput(t,r),o=this.castInput(n,r),l=this.removeEmpty(this.tokenize(s,r)),c=this.removeEmpty(this.tokenize(o,r));return this.diffWithOptionsObj(l,c,r,i)}diffWithOptionsObj(t,n,r,i){var s;let o=a(b=>{if(b=this.postProcess(b,r),i){setTimeout(function(){i(b)},0);return}else return b},"done"),l=n.length,c=t.length,u=1,d=l+c;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));let p=(s=r.timeout)!==null&&s!==void 0?s:1/0,h=Date.now()+p,f=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(f[0],n,t,0,r);if(f[0].oldPos+1>=c&&g+1>=l)return o(this.buildValues(f[0].lastComponent,n,t));let y=-1/0,v=1/0,w=a(()=>{for(let b=Math.max(y,-u);b<=Math.min(v,u);b+=2){let S,k=f[b-1],E=f[b+1];k&&(f[b-1]=void 0);let T=!1;if(E){let N=E.oldPos-b;T=E&&0<=N&&N<l}let I=k&&k.oldPos+1<c;if(!T&&!I){f[b]=void 0;continue}if(!I||T&&k.oldPos<E.oldPos?S=this.addToPath(E,!0,!1,0,r):S=this.addToPath(k,!1,!0,1,r),g=this.extractCommon(S,n,t,b,r),S.oldPos+1>=c&&g+1>=l)return o(this.buildValues(S.lastComponent,n,t))||!0;f[b]=S,S.oldPos+1>=c&&(v=Math.min(v,b-1)),g+1>=l&&(y=Math.max(y,b+1))}u++},"execEditLength");if(i)a(function b(){setTimeout(function(){if(u>d||Date.now()>h)return i(void 0);w()||b()},0)},"exec")();else for(;u<=d&&Date.now()<=h;){let b=w();if(b)return b}}addToPath(t,n,r,i,s){let o=t.lastComponent;return o&&!s.oneChangePerToken&&o.added===n&&o.removed===r?{oldPos:t.oldPos+i,lastComponent:{count:o.count+1,added:n,removed:r,previousComponent:o.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:o}}}extractCommon(t,n,r,i,s){let o=n.length,l=r.length,c=t.oldPos,u=c-i,d=0;for(;u+1<o&&c+1<l&&this.equals(r[c+1],n[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){let n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){let i=[],s;for(;t;)i.push(t),s=t.previousComponent,delete t.previousComponent,t=s;i.reverse();let o=i.length,l=0,c=0,u=0;for(;l<o;l++){let d=i[l];if(d.removed)d.value=this.join(r.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let p=n.slice(c,c+d.count);p=p.map(function(h,f){let g=r[u+f];return g.length>h.length?g:h}),d.value=this.join(p)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return i}};var WV=class extends dk{static{a(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=rCt}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
4861
4861
|
`))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
|
|
4862
4862
|
`))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
|
|
4863
4863
|
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
package/worker/isolated/index.js
CHANGED
|
@@ -150,7 +150,7 @@ Known schemas:
|
|
|
150
150
|
- `)}`,new Error(je)}let ut=`${l}/$ref`,Ze=Bs(e,Ie,n,r,s,i,a,ut,c);if(Ze.valid||ue.push({instanceLocation:a,keyword:"$ref",keywordLocation:ut,error:"A subschema had errors."},...Ze.errors),n==="4"||n==="7")return{valid:ue.length===0,errors:ue}}if(Array.isArray(g)){let De=g.length,Ie=!1;for(let ut=0;ut<De;ut++)if(d===g[ut]||g[ut]==="integer"&&d==="number"&&e%1===0&&e===e){Ie=!0;break}Ie||ue.push({instanceLocation:a,keyword:"type",keywordLocation:`${l}/type`,error:`Instance type "${d}" is invalid. Expected "${g.join('", "')}".`})}else g==="integer"?(d!=="number"||e%1||e!==e)&&ue.push({instanceLocation:a,keyword:"type",keywordLocation:`${l}/type`,error:`Instance type "${d}" is invalid. Expected "${g}".`}):g!==void 0&&d!==g&&ue.push({instanceLocation:a,keyword:"type",keywordLocation:`${l}/type`,error:`Instance type "${d}" is invalid. Expected "${g}".`});if(y!==void 0&&(d==="object"||d==="array"?Yg(e,y)||ue.push({instanceLocation:a,keyword:"const",keywordLocation:`${l}/const`,error:`Instance does not match ${JSON.stringify(y)}.`}):e!==y&&ue.push({instanceLocation:a,keyword:"const",keywordLocation:`${l}/const`,error:`Instance does not match ${JSON.stringify(y)}.`})),x!==void 0&&(d==="object"||d==="array"?x.some(De=>Yg(e,De))||ue.push({instanceLocation:a,keyword:"enum",keywordLocation:`${l}/enum`,error:`Instance does not match any of ${JSON.stringify(x)}.`}):x.some(De=>e===De)||ue.push({instanceLocation:a,keyword:"enum",keywordLocation:`${l}/enum`,error:`Instance does not match any of ${JSON.stringify(x)}.`})),S!==void 0){let De=`${l}/not`;Bs(e,S,n,r,s,i,a,De).valid&&ue.push({instanceLocation:a,keyword:"not",keywordLocation:De,error:'Instance matched "not" schema.'})}let et=[];if(k!==void 0){let De=`${l}/anyOf`,Ie=ue.length,ut=!1;for(let Ze=0;Ze<k.length;Ze++){let je=k[Ze],lt=Object.create(c),we=Bs(e,je,n,r,s,h===!0?i:null,a,`${De}/${Ze}`,lt);ue.push(...we.errors),ut=ut||we.valid,we.valid&&et.push(lt)}ut?ue.length=Ie:ue.splice(Ie,0,{instanceLocation:a,keyword:"anyOf",keywordLocation:De,error:"Instance does not match any subschemas."})}if(b!==void 0){let De=`${l}/allOf`,Ie=ue.length,ut=!0;for(let Ze=0;Ze<b.length;Ze++){let je=b[Ze],lt=Object.create(c),we=Bs(e,je,n,r,s,h===!0?i:null,a,`${De}/${Ze}`,lt);ue.push(...we.errors),ut=ut&&we.valid,we.valid&&et.push(lt)}ut?ue.length=Ie:ue.splice(Ie,0,{instanceLocation:a,keyword:"allOf",keywordLocation:De,error:"Instance does not match every subschema."})}if(_!==void 0){let De=`${l}/oneOf`,Ie=ue.length,ut=_.filter((Ze,je)=>{let lt=Object.create(c),we=Bs(e,Ze,n,r,s,h===!0?i:null,a,`${De}/${je}`,lt);return ue.push(...we.errors),we.valid&&et.push(lt),we.valid}).length;ut===1?ue.length=Ie:ue.splice(Ie,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:De,error:`Instance does not match exactly one subschema (${ut} matches).`})}if((d==="object"||d==="array")&&Object.assign(c,...et),T!==void 0){let De=`${l}/if`;if(Bs(e,T,n,r,s,i,a,De,c).valid){if(R!==void 0){let ut=Bs(e,R,n,r,s,i,a,`${l}/then`,c);ut.valid||ue.push({instanceLocation:a,keyword:"if",keywordLocation:De,error:'Instance does not match "then" schema.'},...ut.errors)}}else if(F!==void 0){let ut=Bs(e,F,n,r,s,i,a,`${l}/else`,c);ut.valid||ue.push({instanceLocation:a,keyword:"if",keywordLocation:De,error:'Instance does not match "else" schema.'},...ut.errors)}}if(d==="object"){if(w!==void 0)for(let Ze of w)Ze in e||ue.push({instanceLocation:a,keyword:"required",keywordLocation:`${l}/required`,error:`Instance does not have required property "${Ze}".`});let De=Object.keys(e);if(N!==void 0&&De.length<N&&ue.push({instanceLocation:a,keyword:"minProperties",keywordLocation:`${l}/minProperties`,error:`Instance does not have at least ${N} properties.`}),G!==void 0&&De.length>G&&ue.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${l}/maxProperties`,error:`Instance does not have at least ${G} properties.`}),ye!==void 0){let Ze=`${l}/propertyNames`;for(let je in e){let lt=`${a}/${qo(je)}`,we=Bs(je,ye,n,r,s,i,lt,Ze);we.valid||ue.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:Ze,error:`Property name "${je}" does not match schema.`},...we.errors)}}if(U!==void 0){let Ze=`${l}/dependantRequired`;for(let je in U)if(je in e){let lt=U[je];for(let we of lt)we in e||ue.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:Ze,error:`Instance has "${je}" but does not have "${we}".`})}}if(Y!==void 0)for(let Ze in Y){let je=`${l}/dependentSchemas`;if(Ze in e){let lt=Bs(e,Y[Ze],n,r,s,i,a,`${je}/${qo(Ze)}`,c);lt.valid||ue.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:je,error:`Instance has "${Ze}" but does not match dependant schema.`},...lt.errors)}}if(W!==void 0){let Ze=`${l}/dependencies`;for(let je in W)if(je in e){let lt=W[je];if(Array.isArray(lt))for(let we of lt)we in e||ue.push({instanceLocation:a,keyword:"dependencies",keywordLocation:Ze,error:`Instance has "${je}" but does not have "${we}".`});else{let we=Bs(e,lt,n,r,s,i,a,`${Ze}/${qo(je)}`);we.valid||ue.push({instanceLocation:a,keyword:"dependencies",keywordLocation:Ze,error:`Instance has "${je}" but does not match dependant schema.`},...we.errors)}}}let Ie=Object.create(null),ut=!1;if(K!==void 0){let Ze=`${l}/properties`;for(let je in K){if(!(je in e))continue;let lt=`${a}/${qo(je)}`,we=Bs(e[je],K[je],n,r,s,i,lt,`${Ze}/${qo(je)}`);if(we.valid)c[je]=Ie[je]=!0;else if(ut=s,ue.push({instanceLocation:a,keyword:"properties",keywordLocation:Ze,error:`Property "${je}" does not match schema.`},...we.errors),ut)break}}if(!ut&&P!==void 0){let Ze=`${l}/patternProperties`;for(let je in P){let lt=new RegExp(je,"u"),we=P[je];for(let mt in e){if(!lt.test(mt))continue;let Nt=`${a}/${qo(mt)}`,nt=Bs(e[mt],we,n,r,s,i,Nt,`${Ze}/${qo(je)}`);nt.valid?c[mt]=Ie[mt]=!0:(ut=s,ue.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:Ze,error:`Property "${mt}" matches pattern "${je}" but does not match associated schema.`},...nt.errors))}}}if(!ut&&j!==void 0){let Ze=`${l}/additionalProperties`;for(let je in e){if(Ie[je])continue;let lt=`${a}/${qo(je)}`,we=Bs(e[je],j,n,r,s,i,lt,Ze);we.valid?c[je]=!0:(ut=s,ue.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:Ze,error:`Property "${je}" does not match additional properties schema.`},...we.errors))}}else if(!ut&&ee!==void 0){let Ze=`${l}/unevaluatedProperties`;for(let je in e)if(!c[je]){let lt=`${a}/${qo(je)}`,we=Bs(e[je],ee,n,r,s,i,lt,Ze);we.valid?c[je]=!0:ue.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:Ze,error:`Property "${je}" does not match unevaluated properties schema.`},...we.errors)}}}else if(d==="array"){_e!==void 0&&e.length>_e&&ue.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${l}/maxItems`,error:`Array has too many items (${e.length} > ${_e}).`}),Ue!==void 0&&e.length<Ue&&ue.push({instanceLocation:a,keyword:"minItems",keywordLocation:`${l}/minItems`,error:`Array has too few items (${e.length} < ${Ue}).`});let De=e.length,Ie=0,ut=!1;if(q!==void 0){let Ze=`${l}/prefixItems`,je=Math.min(q.length,De);for(;Ie<je;Ie++){let lt=Bs(e[Ie],q[Ie],n,r,s,i,`${a}/${Ie}`,`${Ze}/${Ie}`);if(c[Ie]=!0,!lt.valid&&(ut=s,ue.push({instanceLocation:a,keyword:"prefixItems",keywordLocation:Ze,error:"Items did not match schema."},...lt.errors),ut))break}}if(pe!==void 0){let Ze=`${l}/items`;if(Array.isArray(pe)){let je=Math.min(pe.length,De);for(;Ie<je;Ie++){let lt=Bs(e[Ie],pe[Ie],n,r,s,i,`${a}/${Ie}`,`${Ze}/${Ie}`);if(c[Ie]=!0,!lt.valid&&(ut=s,ue.push({instanceLocation:a,keyword:"items",keywordLocation:Ze,error:"Items did not match schema."},...lt.errors),ut))break}}else for(;Ie<De;Ie++){let je=Bs(e[Ie],pe,n,r,s,i,`${a}/${Ie}`,Ze);if(c[Ie]=!0,!je.valid&&(ut=s,ue.push({instanceLocation:a,keyword:"items",keywordLocation:Ze,error:"Items did not match schema."},...je.errors),ut))break}if(!ut&&xe!==void 0){let je=`${l}/additionalItems`;for(;Ie<De;Ie++){let lt=Bs(e[Ie],xe,n,r,s,i,`${a}/${Ie}`,je);c[Ie]=!0,lt.valid||(ut=s,ue.push({instanceLocation:a,keyword:"additionalItems",keywordLocation:je,error:"Items did not match additional items schema."},...lt.errors))}}}if(D!==void 0)if(De===0&&Oe===void 0)ue.push({instanceLocation:a,keyword:"contains",keywordLocation:`${l}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(Oe!==void 0&&De<Oe)ue.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${l}/minContains`,error:`Array has less items (${De}) than minContains (${Oe}).`});else{let Ze=`${l}/contains`,je=ue.length,lt=0;for(let we=0;we<De;we++){let mt=Bs(e[we],D,n,r,s,i,`${a}/${we}`,Ze);mt.valid?(c[we]=!0,lt++):ue.push(...mt.errors)}lt>=(Oe||0)&&(ue.length=je),Oe===void 0&&Je===void 0&<===0?ue.splice(je,0,{instanceLocation:a,keyword:"contains",keywordLocation:Ze,error:"Array does not contain item matching schema."}):Oe!==void 0&<<Oe?ue.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${l}/minContains`,error:`Array must contain at least ${Oe} items matching schema. Only ${lt} items were found.`}):Je!==void 0&<>Je&&ue.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${l}/maxContains`,error:`Array may contain at most ${Je} items matching schema. ${lt} items were found.`})}if(!ut&&ce!==void 0){let Ze=`${l}/unevaluatedItems`;for(Ie;Ie<De;Ie++){if(c[Ie])continue;let je=Bs(e[Ie],ce,n,r,s,i,`${a}/${Ie}`,Ze);c[Ie]=!0,je.valid||ue.push({instanceLocation:a,keyword:"unevaluatedItems",keywordLocation:Ze,error:"Items did not match unevaluated items schema."},...je.errors)}}if(it)for(let Ze=0;Ze<De;Ze++){let je=e[Ze],lt=typeof je=="object"&&je!==null;for(let we=0;we<De;we++){if(Ze===we)continue;let mt=e[we];(je===mt||lt&&(typeof mt=="object"&&mt!==null)&&Yg(je,mt))&&(ue.push({instanceLocation:a,keyword:"uniqueItems",keywordLocation:`${l}/uniqueItems`,error:`Duplicate items at indexes ${Ze} and ${we}.`}),Ze=Number.MAX_SAFE_INTEGER,we=Number.MAX_SAFE_INTEGER)}}}else if(d==="number"){if(n==="4"?(qe!==void 0&&(de===!0&&e<=qe||e<qe)&&ue.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${l}/minimum`,error:`${e} is less than ${de?"or equal to ":""} ${qe}.`}),ge!==void 0&&(yt===!0&&e>=ge||e>ge)&&ue.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${l}/maximum`,error:`${e} is greater than ${yt?"or equal to ":""} ${ge}.`})):(qe!==void 0&&e<qe&&ue.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${l}/minimum`,error:`${e} is less than ${qe}.`}),ge!==void 0&&e>ge&&ue.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${l}/maximum`,error:`${e} is greater than ${ge}.`}),de!==void 0&&e<=de&&ue.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${l}/exclusiveMinimum`,error:`${e} is less than ${de}.`}),yt!==void 0&&e>=yt&&ue.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${l}/exclusiveMaximum`,error:`${e} is greater than or equal to ${yt}.`})),Xe!==void 0){let De=e%Xe;Math.abs(0-De)>=11920929e-14&&Math.abs(Xe-De)>=11920929e-14&&ue.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${l}/multipleOf`,error:`${e} is not a multiple of ${Xe}.`})}}else if(d==="string"){let De=at===void 0&&Ae===void 0?0:gae(e);at!==void 0&&De<at&&ue.push({instanceLocation:a,keyword:"minLength",keywordLocation:`${l}/minLength`,error:`String is too short (${De} < ${at}).`}),Ae!==void 0&&De>Ae&&ue.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${l}/maxLength`,error:`String is too long (${De} > ${Ae}).`}),fe!==void 0&&!new RegExp(fe,"u").test(e)&&ue.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${l}/pattern`,error:"String does not match pattern."}),B!==void 0&&qD[B]&&!qD[B](e)&&ue.push({instanceLocation:a,keyword:"format",keywordLocation:`${l}/format`,error:`String does not match format "${B}".`})}return{valid:ue.length===0,errors:ue}}var WD=te(()=>{UD();uE();zD();cE();BD();o(Bs,"validate")});var dE,yae=te(()=>{uE();WD();dE=class{static{o(this,"Validator")}schema;draft;shortCircuit;lookup;constructor(t,n="2019-09",r=!0){this.schema=t,this.draft=n,this.shortCircuit=r,this.lookup=nd(t)}validate(t){return Bs(t,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(t,n){n&&(t={...t,$id:n}),nd(t,this.lookup)}}});var vae=te(()=>{UD();uE();zD();cE();mae();BD();WD();yae()});var pE,xae=te(()=>{vae();pE=class{static{o(this,"CfWorkerJsonSchemaValidator")}constructor(t){this.shortcircuit=t?.shortcircuit??!0,this.draft=t?.draft??"2020-12"}getValidator(t){let n=new dE(t,this.draft,this.shortcircuit);return r=>{let s=n.validate(r);return s.valid?{valid:!0,data:r,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:s.errors.map(i=>`${i.instanceLocation}: ${i.error}`).join("; ")}}}}});var bi,fE=te(()=>{"use strict";bi={probeTimeoutMs:3e4,callTimeoutMs:6e4,maxToolsPerServer:128,maxCatalogPages:10,maxCatalogBytes:131072,maxDescriptionLength:512,maxErrorMessageChars:300,maxPublicNameLength:64,maxInstructionsLength:1024,metaToolThreshold:20}});import{createHash as _We}from"node:crypto";function AWe(e){let t=e.replace(/[.*+?^${}()|[\]\\]/gu,n=>n==="*"?"\0":`\\${n}`);return new RegExp(`^${t.replaceAll("\0",".*")}$`)}function bae(e,t,n){let r=t??"read_only";return r==="allow_all"?"allow":r==="approve_all"?"ask":n===!0?"allow":n===!1?"ask":TWe.some(s=>AWe(s).test(e))?"allow":"ask"}function cu(e){return e.replace(/Bearer\s+[^\s"']+/giu,"Bearer ***").replace(/(https?:\/\/[^\s"'?]+)\?[^\s"']*/giu,"$1?***").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/gu,"").slice(0,bi.maxErrorMessageChars)}function wae(e,t){let n=`mcp__${e}__${t}`,r=n.replace(/[^A-Za-z0-9_-]/gu,"_");if(r===n&&r.length<=bi.maxPublicNameLength)return r;let s=IWe(e,t),i=bi.maxPublicNameLength-s.length-1;return`${r.slice(0,i)}_${s}`}function IWe(e,t){return _We("sha256").update(`${e}\0${t}`).digest("hex").slice(0,12)}function Sae(e){if(!(e==null||typeof e!="object"))try{let t=JSON.parse(JSON.stringify(e));return jf(t),t}catch{return}}function $We(e){return CWe.has(e)}function kae(e){return e.type!=="image"||e.data===void 0||e.mimeType===void 0||!$We(e.mimeType)||!RWe.test(e.data)?void 0:{data:Uint8Array.from(atob(e.data),n=>n.charCodeAt(0)),mediaType:e.mimeType}}function Eae(e){return e.some(t=>t.type==="image"&&t.data!==void 0)}function hv(e){if(e.isError)return[{type:"text",text:e.content.filter(s=>s.type==="text"&&typeof s.text=="string").map(s=>s.text).join(`
|
|
151
151
|
`)||"MCP tool returned an error."}];let t=[],n=[];for(let r of e.content)if(r.type==="text"&&typeof r.text=="string")n.push(r.text);else if(r.type==="resource_link"&&r.uri!==void 0)n.push(`Resource: ${r.name??"unnamed"} (${r.uri})`);else if(r.type==="image"&&r.data!==void 0)n.push(``);else if(r.type==="image")n.push(`[image: ${r.mimeType??"unknown type"}]`);else if(r.type==="audio")n.push("[audio result unsupported on Cloudflare Workers]");else if(r.type==="resource"&&r.resource?.text!==void 0){let s=r.resource.uri??"embedded resource";n.push(`--- ${s} ---
|
|
152
152
|
${r.resource.text}`)}else r.type==="resource"?n.push("[embedded resource: binary content not displayed]"):n.push(`[unsupported MCP content type: ${r.type}]`);return n.length>0&&t.push({type:"text",text:n.join(`
|
|
153
|
-
`)}),t.length>0?t:[{type:"text",text:"(empty MCP result)"}]}var TWe,CWe,RWe,hE=te(()=>{"use strict";Vi();fE();TWe=["get_*","list_*","read_*","search_*","find_*","fetch_*","describe_*"];o(AWe,"globToRegExp");o(bae,"evaluateMcpToolPolicy");o(cu,"scrubMcpErrorMessage");o(wae,"publicToolName");o(IWe,"hashSuffix");o(Sae,"supportedOutputSchema");CWe=new Set(["image/png","image/jpeg"]),RWe=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u;o($We,"isImageMediaType");o(kae,"decodeImageBlock");o(Eae,"containsImage");o(hv,"mapMcpResultToContentBlocks")});var HD,_ae=te(()=>{HD={name:"dsh-edge",version:"0.17.0-alpha.1",description:"Your DeepSeek Harness, anywhere \u2014 deploy a persistent personal coding agent to Cloudflare Workers in one command",author:"pawaca",license:"MIT",type:"module",bin:{"dsh-edge":"scripts/cli.mjs"},files:["dist","worker","scripts/*.d.mts","scripts/*.mjs","wrangler.jsonc","README.md","README.zh.md","LICENSE","THIRD_PARTY_NOTICES.md"],repository:{type:"git",url:"git+https://github.com/pawaca/dsh-edge.git",directory:"apps/dsh-edge"},homepage:"https://github.com/pawaca/dsh-edge#readme",bugs:{url:"https://github.com/pawaca/dsh-edge/issues"},keywords:["deepseek","deepseek-harness","ai-agents","byok","cloudflare-workers","durable-objects","self-hosted"],engines:{node:">=22.14.0"},publishConfig:{access:"public"},dshEdge:{upstreamVersion:"0.1.5-rc.2"},scripts:{"bundle:direct":"pnpm run web:build && pnpm --dir standalone run build:worker:direct && node standalone/scripts/promote.mjs direct","bundle:isolated":"pnpm run web:build && pnpm --dir standalone run build:worker:isolated && node standalone/scripts/promote.mjs isolated","bundle:workers":"pnpm --dir standalone run build && pnpm --dir standalone run verify && node standalone/scripts/promote.mjs all",dev:"pnpm run bundle:direct && node scripts/dev.mjs direct","dev:isolated":"pnpm run bundle:isolated && node scripts/dev.mjs isolated","dsh-edge":"node scripts/cli.mjs","example:install":"node examples/install-keyless.mjs","install:cloudflare":"pnpm run bundle:workers && node scripts/cli.mjs install","legal:write":"node scripts/legal-files.mjs write","pack:verify":"node scripts/verify-packed.mjs",prepack:"node scripts/legal-files.mjs verify && pnpm run bundle:workers","web:build":"pnpm --dir standalone run build:web && node standalone/scripts/promote.mjs web",test:"vitest run --root ../.. --project edge-runtime","test:integration":"pnpm run bundle:workers && node tests/run-session-integration.mjs","test:snapshot":"vitest run --root ../.. --config apps/dsh-edge/vitest.snapshot.config.ts",typecheck:"tsc --noEmit"},dependencies:{"@clack/prompts":"1.7.0","compare-versions":"6.1.1",execa:"^10.0.1","jsonc-parser":"^3.3.1",wrangler:"4.129.0"},devDependencies:{"@cfworker/json-schema":"^4.1.1","@cloudflare/computer":"0.2.1","@cloudflare/workers-types":"5.20260904.1","@deepseek-ai/cordis":"4.0.2","@deepseek-ai/dsh-agent":"0.1.5-rc.2","@deepseek-ai/dsh-agent-loop":"0.1.5-rc.2","@deepseek-ai/dsh-anonymous-user-id":"0.1.5-rc.2","@deepseek-ai/dsh-api-gateway":"0.1.5-rc.2","@deepseek-ai/dsh-api-remotes":"0.1.5-rc.2","@deepseek-ai/dsh-api-session-controller":"0.1.5-rc.2","@deepseek-ai/dsh-api-settings-controller":"0.1.5-rc.2","@deepseek-ai/dsh-api-workspace-controller":"0.1.5-rc.2","@deepseek-ai/dsh-api-workspace-files":"0.1.5-rc.2","@deepseek-ai/dsh-attachment":"0.1.5-rc.2","@deepseek-ai/dsh-brand":"0.1.5-rc.2","@deepseek-ai/dsh-client-store":"0.1.5-rc.2","@deepseek-ai/dsh-code-runtime":"0.1.5-rc.2","@deepseek-ai/dsh-commands":"0.1.5-rc.2","@deepseek-ai/dsh-compaction":"0.1.5-rc.2","@deepseek-ai/dsh-compaction-basic":"0.1.5-rc.2","@deepseek-ai/dsh-compaction-tool-result-pruner":"0.1.5-rc.2","@deepseek-ai/dsh-credentials":"0.1.5-rc.2","@deepseek-ai/dsh-file-reference":"0.1.5-rc.2","@deepseek-ai/dsh-fs":"0.1.5-rc.2","@deepseek-ai/dsh-goal":"0.1.5-rc.2","@deepseek-ai/dsh-goal-round-driver":"0.1.5-rc.2","@deepseek-ai/dsh-host-directory-picker":"0.1.5-rc.2","@deepseek-ai/dsh-host-plugin-inventory":"0.1.5-rc.2","@deepseek-ai/dsh-invariants":"0.1.5-rc.2","@deepseek-ai/dsh-jobs":"0.1.5-rc.2","@deepseek-ai/dsh-jobs-local":"0.1.5-rc.2","@deepseek-ai/dsh-launch-environment":"0.1.5-rc.2","@deepseek-ai/dsh-llm":"0.1.5-rc.2","@deepseek-ai/dsh-llm-deepseek":"0.1.5-rc.2","@deepseek-ai/dsh-message-feedback":"0.1.5-rc.2","@deepseek-ai/dsh-output-retention":"0.1.5-rc.2","@deepseek-ai/dsh-plan-mode":"0.1.5-rc.2","@deepseek-ai/dsh-sandbox":"0.1.5-rc.2","@deepseek-ai/dsh-schedule":"0.1.5-rc.2","@deepseek-ai/dsh-scope":"0.1.5-rc.2","@deepseek-ai/dsh-session":"0.1.5-rc.2","@deepseek-ai/dsh-session-format":"0.1.5-rc.2","@deepseek-ai/dsh-session-format-catalog":"0.1.5-rc.2","@deepseek-ai/dsh-session-format-v0-to-v1":"0.1.5-rc.2","@deepseek-ai/dsh-session-format-v1-to-v2":"0.1.5-rc.2","@deepseek-ai/dsh-session-format-v2-to-v3":"0.1.5-rc.2","@deepseek-ai/dsh-session-persistence":"0.1.5-rc.2","@deepseek-ai/dsh-session-projection":"0.1.5-rc.2","@deepseek-ai/dsh-session-projection-cache":"0.1.5-rc.2","@deepseek-ai/dsh-session-query":"0.1.5-rc.2","@deepseek-ai/dsh-session-reference":"0.1.5-rc.2","@deepseek-ai/dsh-session-title":"0.1.5-rc.2","@deepseek-ai/dsh-session-title-first-prompt-llm":"0.1.5-rc.2","@deepseek-ai/dsh-session-title-llm":"0.1.5-rc.2","@deepseek-ai/dsh-settings":"0.1.5-rc.2","@deepseek-ai/dsh-skill":"0.1.5-rc.2","@deepseek-ai/dsh-spill":"0.1.5-rc.2","@deepseek-ai/dsh-spill-policy":"0.1.5-rc.2","@deepseek-ai/dsh-storage":"0.1.5-rc.2","@deepseek-ai/dsh-storage-domain":"0.1.5-rc.2","@deepseek-ai/dsh-subagent":"0.1.5-rc.2","@deepseek-ai/dsh-subagent-in-process-driver":"0.1.5-rc.2","@deepseek-ai/dsh-subagent-spawn-in-process":"0.1.5-rc.2","@deepseek-ai/dsh-system-prompt":"0.1.5-rc.2","@deepseek-ai/dsh-timeout":"0.1.5-rc.2","@deepseek-ai/dsh-token-meter":"0.1.5-rc.2","@deepseek-ai/dsh-tool-ask-user":"0.1.5-rc.2","@deepseek-ai/dsh-tool-call-timeout-policy":"0.1.5-rc.2","@deepseek-ai/dsh-tool-fs":"0.1.5-rc.2","@deepseek-ai/dsh-tool-goal":"0.1.5-rc.2","@deepseek-ai/dsh-tool-jobs":"0.1.5-rc.2","@deepseek-ai/dsh-tool-skill":"0.1.5-rc.2","@deepseek-ai/dsh-tool-subagent":"0.1.5-rc.2","@deepseek-ai/dsh-tool-web":"0.1.5-rc.2","@deepseek-ai/dsh-tool-workflow":"0.1.5-rc.2","@deepseek-ai/dsh-tools":"0.1.5-rc.2","@deepseek-ai/dsh-typert-protocol":"0.1.5-rc.2","@deepseek-ai/dsh-typert-registry":"0.1.5-rc.2","@deepseek-ai/dsh-user-approval":"0.1.5-rc.2","@deepseek-ai/dsh-user-questions":"0.1.5-rc.2","@deepseek-ai/dsh-util-values":"0.1.5-rc.2","@deepseek-ai/dsh-web":"0.1.5-rc.2","@deepseek-ai/dsh-web-fetch-http":"0.1.5-rc.2","@deepseek-ai/dsh-web-search-deepseek":"0.1.5-rc.2","@deepseek-ai/dsh-workflow":"0.1.5-rc.2","@deepseek-ai/dsh-workspace":"0.1.5-rc.2","@deepseek-ai/schemastery":"3.18.2","@mixmark-io/domino":"2.2.0","@modelcontextprotocol/sdk":"1.30.0",acorn:"8.18.0","fast-png":"8.0.0","jpeg-js":"0.4.4","just-bash":"3.4.2",playwright:"^1.49.0",sucrase:"3.35.1",typescript:"^6.0.3",vitest:"^4.1.8",ws:"^8.21.0"}}});var e1,Tae,mE=te(()=>{"use strict";_ae();e1=HD.version,Tae=HD.dshEdge.upstreamVersion});function MWe(e){let t=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/iu.exec(e);if(t!==null)return t[1];let n=/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/iu.exec(e);if(n!==null){let r=parseInt(n[1],16),s=parseInt(n[2],16);return`${String(r>>8)}.${String(r&255)}.${String(s>>8)}.${String(s&255)}`}}function LWe(e){return/^\d+\.\d+\.\d+\.\d+$/u.test(e)||e.includes(":")}function rd(e){let t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error("MCP server URL must use http: or https: protocol.");let n=t.hostname.toLowerCase(),r=n.endsWith(".")?n.slice(0,-1):n,s=r.startsWith("[")&&r.endsWith("]")?r.slice(1,-1):r;if(!(s==="localhost"||s==="127.0.0.1"||s==="::1")){for(let i of OWe)if(s.endsWith(i))throw new Error(`MCP server hostname "${s}" is blocked.`);if(LWe(s)){let i=MWe(s),a=i??s;for(let l of PWe)if(l.test(a))throw new Error(`MCP server address "${s}" is a private IP and is blocked.`);if(i===void 0){for(let l of DWe)if(l.test(s))throw new Error(`MCP server address "${s}" is a private IP and is blocked.`)}}}}function jWe(e){return e?.type==="bearer"&&e.token!==void 0?{Authorization:`Bearer ${e.token}`}:{}}async function Aae(e,t,n){rd(e);let r=new lE(new URL(e),{requestInit:{headers:jWe(t),signal:n},fetch:dh}),s=new aE({name:"dsh-edge",version:e1},{capabilities:{},jsonSchemaValidator:FWe});return await s.connect(r),{client:s,close:o(async()=>{await s.close().catch(()=>{})},"close")}}async function Iae(e,t,n){let r=AbortSignal.timeout(bi.probeTimeoutMs),s;try{s=await Aae(t,n,r)}catch(l){throw new Error(cu(l instanceof Error?l.message:String(l)))}let{client:i,close:a}=s;try{let l=[],c=new Set,u=new Set,d;for(let h=0;h<bi.maxCatalogPages;h++){let g=await i.listTools(d===void 0?void 0:{cursor:d},{signal:r});for(let y of g.tools){if(l.length>=bi.maxToolsPerServer)break;let x=wae(e,y.name);if(c.has(x))throw new Error(`Server listed tool "${y.name}" more than once`);c.add(x);let w=y.annotations?.readOnlyHint,S=Sae(y.outputSchema);l.push({name:y.name,publicName:x,description:y.description??"",inputSchema:y.inputSchema??{type:"object"},...S!==void 0?{outputSchema:S}:{},...w!==void 0?{annotations:{readOnlyHint:w}}:{}})}if(l.length>=bi.maxToolsPerServer||(d=g.nextCursor??void 0,d===void 0))break;if(u.has(d))throw new Error("Server repeated a tools/list continuation cursor");u.add(d)}let p=i.getServerVersion?.(),m=i.getInstructions?.();return{tools:l,serverInfo:p?{name:p.name,version:p.version}:void 0,instructions:typeof m=="string"&&m.length>0?m.slice(0,bi.maxInstructionsLength):void 0}}finally{await a()}}async function gE(e,t,n,r,s,i){let a=i??bi.callTimeoutMs,l=s?AbortSignal.any([s,AbortSignal.timeout(a)]):AbortSignal.timeout(a),c;try{c=await Aae(e,r,l)}catch(u){throw new Error(cu(u instanceof Error?u.message:String(u)))}try{let u=await c.client.callTool({name:t,arguments:n},void 0,{signal:l});return{content:u.content??[],structuredContent:u.structuredContent,isError:u.isError===!0}}catch(u){throw new Error(cu(u instanceof Error?u.message:String(u)))}finally{await c.close()}}var OWe,PWe,DWe,FWe,dh,mv=te(()=>{"use strict";Nie();dae();xae();hE();fE();mE();OWe=[".internal",".local",".localhost"],PWe=[/^127\./u,/^10\./u,/^172\.(1[6-9]|2\d|3[01])\./u,/^192\.168\./u,/^0\./u,/^169\.254\./u],DWe=[/^::1$/u,/^fc/iu,/^fd/iu,/^fe[89ab][0-9a-f]:/iu];o(MWe,"extractMappedIPv4");o(LWe,"isIpAddress");o(rd,"assertSafeUrl");o(jWe,"buildHeaders");FWe=new pE,dh=o(async(e,t)=>{let n=await globalThis.fetch(e,{...t,redirect:"manual"});if(n.status>=300&&n.status<400)throw new Error(`MCP server returned HTTP ${String(n.status)} redirect; redirects are blocked for security.`);return n},"noRedirectFetch");o(Aae,"connectClient");o(Iae,"probe");o(gE,"callTool")});import{Buffer as UWe}from"node:buffer";function WWe(e){return e instanceof Error&&"code"in e&&typeof e.code=="string"&&BWe.has(e.code)}function Rae(e){return e instanceof Error&&"code"in e&&typeof e.code=="string"&&zWe.has(e.code)}function $ae(e,t,n){let r=UWe.from(e,"base64");if(e.length===0&&t==="reject"||r.toString("base64")!==e)throw new Un(n==="INVALID_IMAGE_BASE64"?"Image upload is not canonical base64.":"File upload is not canonical base64.",n);return new Uint8Array(r)}function HWe(e){return $ae(e,"reject","INVALID_IMAGE_BASE64")}function VWe(e){return{data:HWe(e.data),mediaType:e.mediaType,...e.name===void 0?{}:{name:e.name}}}async function gv(e,t){return e.saveImages(t.map(VWe))}async function GWe(e,t){return e.saveFile({data:$ae(t.data,"accept","INVALID_FILE_BASE64"),...t.name===void 0?{}:{name:t.name}})}function Nae(e,t,n){let r=Math.min(1,Math.sqrt(n/(e*t)));if(r===1)return{width:e,height:t};if(e>=t){let a=Math.max(1,Math.floor(e*r)),l=Math.max(1,Math.round(a*t/e));for(;a*l>n&&a>1;)a-=1,l=Math.max(1,Math.round(a*t/e));return{width:a,height:l}}let s=Math.max(1,Math.floor(t*r)),i=Math.max(1,Math.round(s*e/t));for(;i*s>n&&s>1;)s-=1,i=Math.max(1,Math.round(s*e/t));return{width:i,height:s}}var Cae,qWe,zWe,BWe,Un,VD,sd=te(()=>{Zn();Cae=["TOO_MANY_IMAGES","IMAGES_TOO_LARGE","UNSUPPORTED_IMAGE_TYPE","INVALID_IMAGE_BASE64","INVALID_IMAGE","IMAGE_TYPE_MISMATCH","IMAGE_TOO_LARGE","IMAGE_TOO_MANY_PIXELS","IMAGE_DIMENSION_TOO_LARGE"],qWe=[...Cae,"INVALID_FILE_BASE64","INVALID_ATTACHMENT_REF","ATTACHMENT_CORRUPT","ATTACHMENT_WRITE_FAILED","ATTACHMENT_NOT_FOUND","ATTACHMENT_READ_FAILED","ATTACHMENT_PROJECTION_UNSUPPORTED","ATTACHMENT_FILES_UNSUPPORTED"],zWe=new Set(Cae),BWe=new Set(qWe),Un=class extends Error{static{o(this,"AttachmentError")}code;constructor(e,t,n){super(e,n),this.name="AttachmentError",this.code=t}};o(WWe,"isAttachmentError");o(Rae,"isImageAdmissionError");o($ae,"decodeCanonicalBase64");o(HWe,"decodeBase64");o(VWe,"saveInput");o(gv,"admitEncodedImages");o(GWe,"admitEncodedFile");o(Nae,"requestImageDimensions");VD=class extends _t{static{o(this,"AttachmentStore")}constructor(e){super(e,"attachments")}validateImageBatch(e){let{maxImagesPerMessage:t,maxMessageImageBytes:n,mediaTypes:r}=this.imageLimits;if(e.length>t)throw new Un("Image batch exceeds the configured image-count limit.","TOO_MANY_IMAGES");if(e.reduce((s,i)=>s+i.data.byteLength,0)>n)throw new Un("Image batch exceeds the configured aggregate image-byte limit.","IMAGES_TOO_LARGE");for(let s of e)if(!r.includes(s.mediaType))throw new Un(`Image type ${s.mediaType} is not accepted by this deployment.`,"UNSUPPORTED_IMAGE_TYPE")}async saveImages(e){this.validateImageBatch(e);for(let n of e)await this.validateImage(n);let t=[];for(let n of e)t.push(await this.saveImage(n));return t}async admitPromptContent(e){if(e.every(r=>r.type!=="image"))return e.map(r=>r.type==="text"?{type:"text",text:r.text}:{type:"file",attachment:r.attachment});let t=await gv(this,e.filter(r=>r.type==="image")),n=0;return e.map(r=>r.type==="text"?{type:"text",text:r.text}:r.type==="file"?{type:"file",attachment:r.attachment}:{type:"image",attachment:t[n++]})}admitEncodedFile(e){return GWe(this,e)}isAttachmentError(e){return WWe(e)}imageHostPath(e){}saveFile(e){return Promise.reject(new Un("The mounted attachment provider cannot store verbatim files.","ATTACHMENT_FILES_UNSUPPORTED"))}saveFileStream(e){return Promise.reject(new Un("The mounted attachment provider cannot stream verbatim files.","ATTACHMENT_FILES_UNSUPPORTED"))}async*readFileStream(e,t){t?.throwIfAborted(),await Promise.reject(new Un("The mounted attachment provider cannot read verbatim files.","ATTACHMENT_FILES_UNSUPPORTED"))}fileHostPath(e){}readImageRequest(e,t,n){return n?.throwIfAborted(),Promise.reject(new Un("The mounted attachment provider cannot derive model-request images.","ATTACHMENT_PROJECTION_UNSUPPORTED"))}}});var vE={};In(vE,{buildAuthorizationUrl:()=>nHe,discoverEndpoints:()=>eHe,exchangeCode:()=>rHe,isTokenExpired:()=>iHe,refreshToken:()=>sHe,registerClient:()=>tHe});function Mae(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(2,"0")).join("").slice(0,e)}async function YWe(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return btoa(String.fromCharCode(...new Uint8Array(n))).replace(/\+/gu,"-").replace(/\//gu,"_").replace(/=/gu,"")}async function eHe(e){let t=AbortSignal.timeout(yE),n=new URL(e),r=n.pathname==="/"?"/.well-known/oauth-protected-resource":`/.well-known/oauth-protected-resource${n.pathname}`,s=new URL(r,n.origin);rd(s.href);let i=await dh(s.href,{signal:t});if(!i.ok)throw new Error(`PRM discovery failed: HTTP ${i.status}`);let l=(await i.json()).authorization_servers?.[0];if(typeof l!="string")throw new Error("No authorization server in PRM");let c=new URL(l),u=c.pathname==="/"?"/.well-known/oauth-authorization-server":`/.well-known/oauth-authorization-server${c.pathname}`,d=new URL(u,c.origin);rd(d.href);let p=await dh(d.href,{signal:t});if(!p.ok)throw new Error(`AS metadata failed: HTTP ${p.status}`);let m=await p.json();if(typeof m.authorization_endpoint!="string"||typeof m.token_endpoint!="string")throw new Error("Missing required endpoints in AS metadata");return{authorization:m.authorization_endpoint,token:m.token_endpoint,registration:m.registration_endpoint}}async function tHe(e,t,n){let r=AbortSignal.timeout(yE);rd(e);let s=await dh(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({client_name:n,redirect_uris:[t],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none"}),signal:r});if(!s.ok)throw new Error(`DCR failed: HTTP ${s.status}`);let i=await s.json();if(typeof i.client_id!="string")throw new Error("DCR response missing client_id");return{clientId:i.client_id,clientSecret:i.client_secret}}async function nHe(e,t,n,r,s){let i=Mae(32),a=Mae(64),l=await YWe(a),c=new URL(e.authorization);for(let[u,d]of Object.entries({response_type:"code",client_id:t.clientId,redirect_uri:n,state:i,code_challenge:l,code_challenge_method:"S256",resource:s}))c.searchParams.set(u,d);return{authorizationUrl:c.href,pendingFlow:{state:i,codeVerifier:a,redirectUri:n,serverName:r,serverUrl:s,stagedClient:t,createdAt:Date.now()}}}async function rHe(e,t,n,r,s,i){let a=AbortSignal.timeout(yE),l=new URLSearchParams({grant_type:"authorization_code",code:n,redirect_uri:s,client_id:t.clientId,code_verifier:r});i!==void 0&&l.set("resource",i),t.clientSecret!==void 0&&l.set("client_secret",t.clientSecret),rd(e);let c=await dh(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:l.toString(),signal:a});if(!c.ok)throw new Error(`Token exchange failed: HTTP ${c.status}`);return Lae(await c.json())}async function sHe(e,t,n,r){let s=AbortSignal.timeout(yE),i=new URLSearchParams({grant_type:"refresh_token",refresh_token:n,client_id:t.clientId});r!==void 0&&i.set("resource",r),t.clientSecret!==void 0&&i.set("client_secret",t.clientSecret),rd(e);let a=await dh(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:i.toString(),signal:s});if(!a.ok)throw new Error(`Token refresh failed: HTTP ${a.status}`);return Lae(await a.json())}function Lae(e){let t=e;if(typeof t.access_token!="string")throw new Error("Missing access_token");let n=typeof t.expires_in=="number"?t.expires_in:void 0;return{accessToken:t.access_token,refreshToken:typeof t.refresh_token=="string"?t.refresh_token:void 0,expiresAt:n!==void 0?Date.now()+n*1e3:void 0,tokenType:typeof t.token_type=="string"?t.token_type:"Bearer",scope:typeof t.scope=="string"?t.scope:void 0}}function iHe(e){return e.expiresAt===void 0?!1:Date.now()>e.expiresAt-12e4}var yE,xE=te(()=>{"use strict";mv();yE=1e4;o(Mae,"randomString");o(YWe,"sha256Base64Url");o(eHe,"discoverEndpoints");o(tHe,"registerClient");o(nHe,"buildAuthorizationUrl");o(rHe,"exchangeCode");o(sHe,"refreshToken");o(Lae,"parseTokenResponse");o(iHe,"isTokenExpired")});var Hn,Hae,wE=te(()=>{Zn();xr();Hn=class extends _r{static{o(this,"FsError")}code;constructor(e,t,n){super(e,t,n),this.code=t}},Hae=class extends _t{static{o(this,"FileSystem")}constructor(e){super(e,"fs")}get sandboxMode(){}processPathFromHostPath(e){}}});function uM(e){return $E.test(e)}function NE(e){return e.invocation.modelInvocable}function n1(e){return e.invocation.userInvocable}function dM(e){let t=UVe(e);return[`<skill_content name="${qVe(e.name)}">`,"<skill_resources>",...t,"</skill_resources>","","<skill_instructions>",e.content,"</skill_instructions>","</skill_content>"].join(`
|
|
153
|
+
`)}),t.length>0?t:[{type:"text",text:"(empty MCP result)"}]}var TWe,CWe,RWe,hE=te(()=>{"use strict";Vi();fE();TWe=["get_*","list_*","read_*","search_*","find_*","fetch_*","describe_*"];o(AWe,"globToRegExp");o(bae,"evaluateMcpToolPolicy");o(cu,"scrubMcpErrorMessage");o(wae,"publicToolName");o(IWe,"hashSuffix");o(Sae,"supportedOutputSchema");CWe=new Set(["image/png","image/jpeg"]),RWe=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u;o($We,"isImageMediaType");o(kae,"decodeImageBlock");o(Eae,"containsImage");o(hv,"mapMcpResultToContentBlocks")});var HD,_ae=te(()=>{HD={name:"dsh-edge",version:"0.17.0",description:"Your DeepSeek Harness, anywhere \u2014 deploy a persistent personal coding agent to Cloudflare Workers in one command",author:"pawaca",license:"MIT",type:"module",bin:{"dsh-edge":"scripts/cli.mjs"},files:["dist","worker","scripts/*.d.mts","scripts/*.mjs","wrangler.jsonc","README.md","README.zh.md","LICENSE","THIRD_PARTY_NOTICES.md"],repository:{type:"git",url:"git+https://github.com/pawaca/dsh-edge.git",directory:"apps/dsh-edge"},homepage:"https://github.com/pawaca/dsh-edge#readme",bugs:{url:"https://github.com/pawaca/dsh-edge/issues"},keywords:["deepseek","deepseek-harness","ai-agents","byok","cloudflare-workers","durable-objects","self-hosted"],engines:{node:">=22.14.0"},publishConfig:{access:"public"},dshEdge:{upstreamVersion:"0.1.5-rc.2"},scripts:{"bundle:direct":"pnpm run web:build && pnpm --dir standalone run build:worker:direct && node standalone/scripts/promote.mjs direct","bundle:isolated":"pnpm run web:build && pnpm --dir standalone run build:worker:isolated && node standalone/scripts/promote.mjs isolated","bundle:workers":"pnpm --dir standalone run build && pnpm --dir standalone run verify && node standalone/scripts/promote.mjs all",dev:"pnpm run bundle:direct && node scripts/dev.mjs direct","dev:isolated":"pnpm run bundle:isolated && node scripts/dev.mjs isolated","dsh-edge":"node scripts/cli.mjs","example:install":"node examples/install-keyless.mjs","install:cloudflare":"pnpm run bundle:workers && node scripts/cli.mjs install","legal:write":"node scripts/legal-files.mjs write","pack:verify":"node scripts/verify-packed.mjs",prepack:"node scripts/legal-files.mjs verify && pnpm run bundle:workers","web:build":"pnpm --dir standalone run build:web && node standalone/scripts/promote.mjs web",test:"vitest run --root ../.. --project edge-runtime","test:integration":"pnpm run bundle:workers && node tests/run-session-integration.mjs","test:snapshot":"vitest run --root ../.. --config apps/dsh-edge/vitest.snapshot.config.ts",typecheck:"tsc --noEmit"},dependencies:{"@clack/prompts":"1.7.0","compare-versions":"6.1.1",execa:"^10.0.1","jsonc-parser":"^3.3.1",wrangler:"4.129.0"},devDependencies:{"@cfworker/json-schema":"^4.1.1","@cloudflare/computer":"0.2.1","@cloudflare/workers-types":"5.20260904.1","@deepseek-ai/cordis":"4.0.2","@deepseek-ai/dsh-agent":"0.1.5-rc.2","@deepseek-ai/dsh-agent-loop":"0.1.5-rc.2","@deepseek-ai/dsh-anonymous-user-id":"0.1.5-rc.2","@deepseek-ai/dsh-api-gateway":"0.1.5-rc.2","@deepseek-ai/dsh-api-remotes":"0.1.5-rc.2","@deepseek-ai/dsh-api-session-controller":"0.1.5-rc.2","@deepseek-ai/dsh-api-settings-controller":"0.1.5-rc.2","@deepseek-ai/dsh-api-workspace-controller":"0.1.5-rc.2","@deepseek-ai/dsh-api-workspace-files":"0.1.5-rc.2","@deepseek-ai/dsh-attachment":"0.1.5-rc.2","@deepseek-ai/dsh-brand":"0.1.5-rc.2","@deepseek-ai/dsh-client-store":"0.1.5-rc.2","@deepseek-ai/dsh-code-runtime":"0.1.5-rc.2","@deepseek-ai/dsh-commands":"0.1.5-rc.2","@deepseek-ai/dsh-compaction":"0.1.5-rc.2","@deepseek-ai/dsh-compaction-basic":"0.1.5-rc.2","@deepseek-ai/dsh-compaction-tool-result-pruner":"0.1.5-rc.2","@deepseek-ai/dsh-credentials":"0.1.5-rc.2","@deepseek-ai/dsh-file-reference":"0.1.5-rc.2","@deepseek-ai/dsh-fs":"0.1.5-rc.2","@deepseek-ai/dsh-goal":"0.1.5-rc.2","@deepseek-ai/dsh-goal-round-driver":"0.1.5-rc.2","@deepseek-ai/dsh-host-directory-picker":"0.1.5-rc.2","@deepseek-ai/dsh-host-plugin-inventory":"0.1.5-rc.2","@deepseek-ai/dsh-invariants":"0.1.5-rc.2","@deepseek-ai/dsh-jobs":"0.1.5-rc.2","@deepseek-ai/dsh-jobs-local":"0.1.5-rc.2","@deepseek-ai/dsh-launch-environment":"0.1.5-rc.2","@deepseek-ai/dsh-llm":"0.1.5-rc.2","@deepseek-ai/dsh-llm-deepseek":"0.1.5-rc.2","@deepseek-ai/dsh-message-feedback":"0.1.5-rc.2","@deepseek-ai/dsh-output-retention":"0.1.5-rc.2","@deepseek-ai/dsh-plan-mode":"0.1.5-rc.2","@deepseek-ai/dsh-sandbox":"0.1.5-rc.2","@deepseek-ai/dsh-schedule":"0.1.5-rc.2","@deepseek-ai/dsh-scope":"0.1.5-rc.2","@deepseek-ai/dsh-session":"0.1.5-rc.2","@deepseek-ai/dsh-session-format":"0.1.5-rc.2","@deepseek-ai/dsh-session-format-catalog":"0.1.5-rc.2","@deepseek-ai/dsh-session-format-v0-to-v1":"0.1.5-rc.2","@deepseek-ai/dsh-session-format-v1-to-v2":"0.1.5-rc.2","@deepseek-ai/dsh-session-format-v2-to-v3":"0.1.5-rc.2","@deepseek-ai/dsh-session-persistence":"0.1.5-rc.2","@deepseek-ai/dsh-session-projection":"0.1.5-rc.2","@deepseek-ai/dsh-session-projection-cache":"0.1.5-rc.2","@deepseek-ai/dsh-session-query":"0.1.5-rc.2","@deepseek-ai/dsh-session-reference":"0.1.5-rc.2","@deepseek-ai/dsh-session-title":"0.1.5-rc.2","@deepseek-ai/dsh-session-title-first-prompt-llm":"0.1.5-rc.2","@deepseek-ai/dsh-session-title-llm":"0.1.5-rc.2","@deepseek-ai/dsh-settings":"0.1.5-rc.2","@deepseek-ai/dsh-skill":"0.1.5-rc.2","@deepseek-ai/dsh-spill":"0.1.5-rc.2","@deepseek-ai/dsh-spill-policy":"0.1.5-rc.2","@deepseek-ai/dsh-storage":"0.1.5-rc.2","@deepseek-ai/dsh-storage-domain":"0.1.5-rc.2","@deepseek-ai/dsh-subagent":"0.1.5-rc.2","@deepseek-ai/dsh-subagent-in-process-driver":"0.1.5-rc.2","@deepseek-ai/dsh-subagent-spawn-in-process":"0.1.5-rc.2","@deepseek-ai/dsh-system-prompt":"0.1.5-rc.2","@deepseek-ai/dsh-timeout":"0.1.5-rc.2","@deepseek-ai/dsh-token-meter":"0.1.5-rc.2","@deepseek-ai/dsh-tool-ask-user":"0.1.5-rc.2","@deepseek-ai/dsh-tool-call-timeout-policy":"0.1.5-rc.2","@deepseek-ai/dsh-tool-fs":"0.1.5-rc.2","@deepseek-ai/dsh-tool-goal":"0.1.5-rc.2","@deepseek-ai/dsh-tool-jobs":"0.1.5-rc.2","@deepseek-ai/dsh-tool-skill":"0.1.5-rc.2","@deepseek-ai/dsh-tool-subagent":"0.1.5-rc.2","@deepseek-ai/dsh-tool-web":"0.1.5-rc.2","@deepseek-ai/dsh-tool-workflow":"0.1.5-rc.2","@deepseek-ai/dsh-tools":"0.1.5-rc.2","@deepseek-ai/dsh-typert-protocol":"0.1.5-rc.2","@deepseek-ai/dsh-typert-registry":"0.1.5-rc.2","@deepseek-ai/dsh-user-approval":"0.1.5-rc.2","@deepseek-ai/dsh-user-questions":"0.1.5-rc.2","@deepseek-ai/dsh-util-values":"0.1.5-rc.2","@deepseek-ai/dsh-web":"0.1.5-rc.2","@deepseek-ai/dsh-web-fetch-http":"0.1.5-rc.2","@deepseek-ai/dsh-web-search-deepseek":"0.1.5-rc.2","@deepseek-ai/dsh-workflow":"0.1.5-rc.2","@deepseek-ai/dsh-workspace":"0.1.5-rc.2","@deepseek-ai/schemastery":"3.18.2","@mixmark-io/domino":"2.2.0","@modelcontextprotocol/sdk":"1.30.0",acorn:"8.18.0","fast-png":"8.0.0","jpeg-js":"0.4.4","just-bash":"3.4.2",playwright:"^1.49.0",sucrase:"3.35.1",typescript:"^6.0.3",vitest:"^4.1.8",ws:"^8.21.0"}}});var e1,Tae,mE=te(()=>{"use strict";_ae();e1=HD.version,Tae=HD.dshEdge.upstreamVersion});function MWe(e){let t=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/iu.exec(e);if(t!==null)return t[1];let n=/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/iu.exec(e);if(n!==null){let r=parseInt(n[1],16),s=parseInt(n[2],16);return`${String(r>>8)}.${String(r&255)}.${String(s>>8)}.${String(s&255)}`}}function LWe(e){return/^\d+\.\d+\.\d+\.\d+$/u.test(e)||e.includes(":")}function rd(e){let t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error("MCP server URL must use http: or https: protocol.");let n=t.hostname.toLowerCase(),r=n.endsWith(".")?n.slice(0,-1):n,s=r.startsWith("[")&&r.endsWith("]")?r.slice(1,-1):r;if(!(s==="localhost"||s==="127.0.0.1"||s==="::1")){for(let i of OWe)if(s.endsWith(i))throw new Error(`MCP server hostname "${s}" is blocked.`);if(LWe(s)){let i=MWe(s),a=i??s;for(let l of PWe)if(l.test(a))throw new Error(`MCP server address "${s}" is a private IP and is blocked.`);if(i===void 0){for(let l of DWe)if(l.test(s))throw new Error(`MCP server address "${s}" is a private IP and is blocked.`)}}}}function jWe(e){return e?.type==="bearer"&&e.token!==void 0?{Authorization:`Bearer ${e.token}`}:{}}async function Aae(e,t,n){rd(e);let r=new lE(new URL(e),{requestInit:{headers:jWe(t),signal:n},fetch:dh}),s=new aE({name:"dsh-edge",version:e1},{capabilities:{},jsonSchemaValidator:FWe});return await s.connect(r),{client:s,close:o(async()=>{await s.close().catch(()=>{})},"close")}}async function Iae(e,t,n){let r=AbortSignal.timeout(bi.probeTimeoutMs),s;try{s=await Aae(t,n,r)}catch(l){throw new Error(cu(l instanceof Error?l.message:String(l)))}let{client:i,close:a}=s;try{let l=[],c=new Set,u=new Set,d;for(let h=0;h<bi.maxCatalogPages;h++){let g=await i.listTools(d===void 0?void 0:{cursor:d},{signal:r});for(let y of g.tools){if(l.length>=bi.maxToolsPerServer)break;let x=wae(e,y.name);if(c.has(x))throw new Error(`Server listed tool "${y.name}" more than once`);c.add(x);let w=y.annotations?.readOnlyHint,S=Sae(y.outputSchema);l.push({name:y.name,publicName:x,description:y.description??"",inputSchema:y.inputSchema??{type:"object"},...S!==void 0?{outputSchema:S}:{},...w!==void 0?{annotations:{readOnlyHint:w}}:{}})}if(l.length>=bi.maxToolsPerServer||(d=g.nextCursor??void 0,d===void 0))break;if(u.has(d))throw new Error("Server repeated a tools/list continuation cursor");u.add(d)}let p=i.getServerVersion?.(),m=i.getInstructions?.();return{tools:l,serverInfo:p?{name:p.name,version:p.version}:void 0,instructions:typeof m=="string"&&m.length>0?m.slice(0,bi.maxInstructionsLength):void 0}}finally{await a()}}async function gE(e,t,n,r,s,i){let a=i??bi.callTimeoutMs,l=s?AbortSignal.any([s,AbortSignal.timeout(a)]):AbortSignal.timeout(a),c;try{c=await Aae(e,r,l)}catch(u){throw new Error(cu(u instanceof Error?u.message:String(u)))}try{let u=await c.client.callTool({name:t,arguments:n},void 0,{signal:l});return{content:u.content??[],structuredContent:u.structuredContent,isError:u.isError===!0}}catch(u){throw new Error(cu(u instanceof Error?u.message:String(u)))}finally{await c.close()}}var OWe,PWe,DWe,FWe,dh,mv=te(()=>{"use strict";Nie();dae();xae();hE();fE();mE();OWe=[".internal",".local",".localhost"],PWe=[/^127\./u,/^10\./u,/^172\.(1[6-9]|2\d|3[01])\./u,/^192\.168\./u,/^0\./u,/^169\.254\./u],DWe=[/^::1$/u,/^fc/iu,/^fd/iu,/^fe[89ab][0-9a-f]:/iu];o(MWe,"extractMappedIPv4");o(LWe,"isIpAddress");o(rd,"assertSafeUrl");o(jWe,"buildHeaders");FWe=new pE,dh=o(async(e,t)=>{let n=await globalThis.fetch(e,{...t,redirect:"manual"});if(n.status>=300&&n.status<400)throw new Error(`MCP server returned HTTP ${String(n.status)} redirect; redirects are blocked for security.`);return n},"noRedirectFetch");o(Aae,"connectClient");o(Iae,"probe");o(gE,"callTool")});import{Buffer as UWe}from"node:buffer";function WWe(e){return e instanceof Error&&"code"in e&&typeof e.code=="string"&&BWe.has(e.code)}function Rae(e){return e instanceof Error&&"code"in e&&typeof e.code=="string"&&zWe.has(e.code)}function $ae(e,t,n){let r=UWe.from(e,"base64");if(e.length===0&&t==="reject"||r.toString("base64")!==e)throw new Un(n==="INVALID_IMAGE_BASE64"?"Image upload is not canonical base64.":"File upload is not canonical base64.",n);return new Uint8Array(r)}function HWe(e){return $ae(e,"reject","INVALID_IMAGE_BASE64")}function VWe(e){return{data:HWe(e.data),mediaType:e.mediaType,...e.name===void 0?{}:{name:e.name}}}async function gv(e,t){return e.saveImages(t.map(VWe))}async function GWe(e,t){return e.saveFile({data:$ae(t.data,"accept","INVALID_FILE_BASE64"),...t.name===void 0?{}:{name:t.name}})}function Nae(e,t,n){let r=Math.min(1,Math.sqrt(n/(e*t)));if(r===1)return{width:e,height:t};if(e>=t){let a=Math.max(1,Math.floor(e*r)),l=Math.max(1,Math.round(a*t/e));for(;a*l>n&&a>1;)a-=1,l=Math.max(1,Math.round(a*t/e));return{width:a,height:l}}let s=Math.max(1,Math.floor(t*r)),i=Math.max(1,Math.round(s*e/t));for(;i*s>n&&s>1;)s-=1,i=Math.max(1,Math.round(s*e/t));return{width:i,height:s}}var Cae,qWe,zWe,BWe,Un,VD,sd=te(()=>{Zn();Cae=["TOO_MANY_IMAGES","IMAGES_TOO_LARGE","UNSUPPORTED_IMAGE_TYPE","INVALID_IMAGE_BASE64","INVALID_IMAGE","IMAGE_TYPE_MISMATCH","IMAGE_TOO_LARGE","IMAGE_TOO_MANY_PIXELS","IMAGE_DIMENSION_TOO_LARGE"],qWe=[...Cae,"INVALID_FILE_BASE64","INVALID_ATTACHMENT_REF","ATTACHMENT_CORRUPT","ATTACHMENT_WRITE_FAILED","ATTACHMENT_NOT_FOUND","ATTACHMENT_READ_FAILED","ATTACHMENT_PROJECTION_UNSUPPORTED","ATTACHMENT_FILES_UNSUPPORTED"],zWe=new Set(Cae),BWe=new Set(qWe),Un=class extends Error{static{o(this,"AttachmentError")}code;constructor(e,t,n){super(e,n),this.name="AttachmentError",this.code=t}};o(WWe,"isAttachmentError");o(Rae,"isImageAdmissionError");o($ae,"decodeCanonicalBase64");o(HWe,"decodeBase64");o(VWe,"saveInput");o(gv,"admitEncodedImages");o(GWe,"admitEncodedFile");o(Nae,"requestImageDimensions");VD=class extends _t{static{o(this,"AttachmentStore")}constructor(e){super(e,"attachments")}validateImageBatch(e){let{maxImagesPerMessage:t,maxMessageImageBytes:n,mediaTypes:r}=this.imageLimits;if(e.length>t)throw new Un("Image batch exceeds the configured image-count limit.","TOO_MANY_IMAGES");if(e.reduce((s,i)=>s+i.data.byteLength,0)>n)throw new Un("Image batch exceeds the configured aggregate image-byte limit.","IMAGES_TOO_LARGE");for(let s of e)if(!r.includes(s.mediaType))throw new Un(`Image type ${s.mediaType} is not accepted by this deployment.`,"UNSUPPORTED_IMAGE_TYPE")}async saveImages(e){this.validateImageBatch(e);for(let n of e)await this.validateImage(n);let t=[];for(let n of e)t.push(await this.saveImage(n));return t}async admitPromptContent(e){if(e.every(r=>r.type!=="image"))return e.map(r=>r.type==="text"?{type:"text",text:r.text}:{type:"file",attachment:r.attachment});let t=await gv(this,e.filter(r=>r.type==="image")),n=0;return e.map(r=>r.type==="text"?{type:"text",text:r.text}:r.type==="file"?{type:"file",attachment:r.attachment}:{type:"image",attachment:t[n++]})}admitEncodedFile(e){return GWe(this,e)}isAttachmentError(e){return WWe(e)}imageHostPath(e){}saveFile(e){return Promise.reject(new Un("The mounted attachment provider cannot store verbatim files.","ATTACHMENT_FILES_UNSUPPORTED"))}saveFileStream(e){return Promise.reject(new Un("The mounted attachment provider cannot stream verbatim files.","ATTACHMENT_FILES_UNSUPPORTED"))}async*readFileStream(e,t){t?.throwIfAborted(),await Promise.reject(new Un("The mounted attachment provider cannot read verbatim files.","ATTACHMENT_FILES_UNSUPPORTED"))}fileHostPath(e){}readImageRequest(e,t,n){return n?.throwIfAborted(),Promise.reject(new Un("The mounted attachment provider cannot derive model-request images.","ATTACHMENT_PROJECTION_UNSUPPORTED"))}}});var vE={};In(vE,{buildAuthorizationUrl:()=>nHe,discoverEndpoints:()=>eHe,exchangeCode:()=>rHe,isTokenExpired:()=>iHe,refreshToken:()=>sHe,registerClient:()=>tHe});function Mae(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(2,"0")).join("").slice(0,e)}async function YWe(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return btoa(String.fromCharCode(...new Uint8Array(n))).replace(/\+/gu,"-").replace(/\//gu,"_").replace(/=/gu,"")}async function eHe(e){let t=AbortSignal.timeout(yE),n=new URL(e),r=n.pathname==="/"?"/.well-known/oauth-protected-resource":`/.well-known/oauth-protected-resource${n.pathname}`,s=new URL(r,n.origin);rd(s.href);let i=await dh(s.href,{signal:t});if(!i.ok)throw new Error(`PRM discovery failed: HTTP ${i.status}`);let l=(await i.json()).authorization_servers?.[0];if(typeof l!="string")throw new Error("No authorization server in PRM");let c=new URL(l),u=c.pathname==="/"?"/.well-known/oauth-authorization-server":`/.well-known/oauth-authorization-server${c.pathname}`,d=new URL(u,c.origin);rd(d.href);let p=await dh(d.href,{signal:t});if(!p.ok)throw new Error(`AS metadata failed: HTTP ${p.status}`);let m=await p.json();if(typeof m.authorization_endpoint!="string"||typeof m.token_endpoint!="string")throw new Error("Missing required endpoints in AS metadata");return{authorization:m.authorization_endpoint,token:m.token_endpoint,registration:m.registration_endpoint}}async function tHe(e,t,n){let r=AbortSignal.timeout(yE);rd(e);let s=await dh(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({client_name:n,redirect_uris:[t],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none"}),signal:r});if(!s.ok)throw new Error(`DCR failed: HTTP ${s.status}`);let i=await s.json();if(typeof i.client_id!="string")throw new Error("DCR response missing client_id");return{clientId:i.client_id,clientSecret:i.client_secret}}async function nHe(e,t,n,r,s){let i=Mae(32),a=Mae(64),l=await YWe(a),c=new URL(e.authorization);for(let[u,d]of Object.entries({response_type:"code",client_id:t.clientId,redirect_uri:n,state:i,code_challenge:l,code_challenge_method:"S256",resource:s}))c.searchParams.set(u,d);return{authorizationUrl:c.href,pendingFlow:{state:i,codeVerifier:a,redirectUri:n,serverName:r,serverUrl:s,stagedClient:t,createdAt:Date.now()}}}async function rHe(e,t,n,r,s,i){let a=AbortSignal.timeout(yE),l=new URLSearchParams({grant_type:"authorization_code",code:n,redirect_uri:s,client_id:t.clientId,code_verifier:r});i!==void 0&&l.set("resource",i),t.clientSecret!==void 0&&l.set("client_secret",t.clientSecret),rd(e);let c=await dh(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:l.toString(),signal:a});if(!c.ok)throw new Error(`Token exchange failed: HTTP ${c.status}`);return Lae(await c.json())}async function sHe(e,t,n,r){let s=AbortSignal.timeout(yE),i=new URLSearchParams({grant_type:"refresh_token",refresh_token:n,client_id:t.clientId});r!==void 0&&i.set("resource",r),t.clientSecret!==void 0&&i.set("client_secret",t.clientSecret),rd(e);let a=await dh(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:i.toString(),signal:s});if(!a.ok)throw new Error(`Token refresh failed: HTTP ${a.status}`);return Lae(await a.json())}function Lae(e){let t=e;if(typeof t.access_token!="string")throw new Error("Missing access_token");let n=typeof t.expires_in=="number"?t.expires_in:void 0;return{accessToken:t.access_token,refreshToken:typeof t.refresh_token=="string"?t.refresh_token:void 0,expiresAt:n!==void 0?Date.now()+n*1e3:void 0,tokenType:typeof t.token_type=="string"?t.token_type:"Bearer",scope:typeof t.scope=="string"?t.scope:void 0}}function iHe(e){return e.expiresAt===void 0?!1:Date.now()>e.expiresAt-12e4}var yE,xE=te(()=>{"use strict";mv();yE=1e4;o(Mae,"randomString");o(YWe,"sha256Base64Url");o(eHe,"discoverEndpoints");o(tHe,"registerClient");o(nHe,"buildAuthorizationUrl");o(rHe,"exchangeCode");o(sHe,"refreshToken");o(Lae,"parseTokenResponse");o(iHe,"isTokenExpired")});var Hn,Hae,wE=te(()=>{Zn();xr();Hn=class extends _r{static{o(this,"FsError")}code;constructor(e,t,n){super(e,t,n),this.code=t}},Hae=class extends _t{static{o(this,"FileSystem")}constructor(e){super(e,"fs")}get sandboxMode(){}processPathFromHostPath(e){}}});function uM(e){return $E.test(e)}function NE(e){return e.invocation.modelInvocable}function n1(e){return e.invocation.userInvocable}function dM(e){let t=UVe(e);return[`<skill_content name="${qVe(e.name)}">`,"<skill_resources>",...t,"</skill_resources>","","<skill_instructions>",e.content,"</skill_instructions>","</skill_content>"].join(`
|
|
154
154
|
`)}function UVe(e){let t=e.resourceBase;if(t===void 0)return[`Resources for this skill are managed by provider "${t1(e.provider)}".`,"Load referenced resources only as needed."];switch(t.kind){case"directory":return[`Base directory for this skill: ${t1(t.path)}`,"Resolve relative paths mentioned by this skill against the base directory before using them. Load referenced resources only as needed."];case"url":return[`Base URL for this skill: ${t1(t.url)}`,"Resolve relative URLs mentioned by this skill against the base URL before using them. Load referenced resources only as needed."];case"opaque":return[`Resources for this skill: ${t1(t.description)}`,"Load referenced resources only as needed."];default:return cs(t,"SkillResourceBase.kind")}}function qVe(e){return e.replaceAll("&","&").replaceAll('"',""").replaceAll("<","<")}function t1(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")}function BVe(e,t){if(Array.isArray(e))return{candidates:e,complete:!0};if(e===null||typeof e!="object")throw voe(t);let n=e;if(!Array.isArray(n.candidates)||typeof n.complete!="boolean")throw voe(t);return n}function voe(e){return new TypeError(`skill provider "${e}" list() must return an array or { candidates, complete } observation`)}function HVe(e){return{name:e.name,description:e.description,...e.whenToUse!==void 0?{whenToUse:e.whenToUse}:{},invocation:e.invocation,source:e.source,provider:e.provider,...e.resourceBase!==void 0?{resourceBase:e.resourceBase}:{},rank:FVe,locator:e,...e.path!==void 0?{path:e.path}:{},...e.metadata!==void 0?{metadata:e.metadata}:{}}}function VVe(e,t){if(typeof e.name!="string")throw new TypeError(`skill provider "${t}" returned a non-string skill name`);if(!$E.test(e.name))throw new Error(`skill provider "${t}" returned invalid skill name "${e.name}"`);if(typeof e.description!="string")throw new TypeError(`skill provider "${t}" returned skill "${e.name}" with a non-string description`);if(e.description.length===0)throw new Error(`skill provider "${t}" returned skill "${e.name}" without a description`);if(pM(e.invocation,`skill provider "${t}" returned skill "${e.name}"`),e.whenToUse!==void 0&&typeof e.whenToUse!="string")throw new TypeError(`skill provider "${t}" returned skill "${e.name}" with a non-string whenToUse`);if(typeof e.source!="string")throw new TypeError(`skill provider "${t}" returned skill "${e.name}" with a non-string source`);if(typeof e.rank!="number"||!Number.isFinite(e.rank))throw new Error(`skill provider "${t}" returned skill "${e.name}" with an invalid rank`);if(typeof e.provider!="string")throw new TypeError(`skill provider "${t}" returned skill "${e.name}" with a non-string provider`);if(e.provider!==t)throw new Error(`skill provider "${t}" returned skill "${e.name}" for provider "${e.provider}"`);if(e.path!==void 0&&typeof e.path!="string")throw new TypeError(`skill provider "${t}" returned skill "${e.name}" with a non-string path`)}function GVe(e){if(!$E.test(e.name))throw new Error(`invalid skill name "${e.name}"`);if(e.description.length===0)throw new Error(`skill "${e.name}" requires a description`);pM(e.invocation,`runtime skill "${e.name}"`)}function ZVe(e){let t=e.name,n=e.description,r=e.whenToUse,s=e.invocation,i=e.source,a=e.provider,l=e.content,c=e.path;if(typeof t!="string")throw new TypeError("loaded skill name must be a string");if(!$E.test(t))throw new Error(`loaded skill has invalid name "${t}"`);if(typeof n!="string")throw new TypeError(`loaded skill "${t}" description must be a string`);if(n.length===0)throw new Error(`loaded skill "${t}" requires a description`);if(pM(s,`loaded skill "${t}"`),r!==void 0&&typeof r!="string")throw new TypeError(`loaded skill "${t}" whenToUse must be a string`);if(typeof i!="string")throw new TypeError(`loaded skill "${t}" source must be a string`);if(typeof a!="string")throw new TypeError(`loaded skill "${t}" provider must be a string`);if(typeof l!="string")throw new TypeError(`loaded skill "${t}" content must be a string`);if(c!==void 0&&typeof c!="string")throw new TypeError(`loaded skill "${t}" path must be a string`)}function KVe(e){let{name:t,description:n,whenToUse:r,invocation:s,source:i,provider:a,resourceBase:l}=e;return{name:t,description:n,...r!==void 0?{whenToUse:r}:{},invocation:s,source:i,provider:a,...l!==void 0?{resourceBase:l}:{}}}function pM(e,t){if(e===void 0)return;if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError(`${t} with a non-object invocation policy`);let n=e;if(typeof n.modelInvocable!="boolean")throw new TypeError(`${t} with a non-boolean invocation.modelInvocable`);if(typeof n.userInvocable!="boolean")throw new TypeError(`${t} with a non-boolean invocation.userInvocable`)}function JVe(e,t){return Soe(e.name,t.name)}function Soe(e,t){return e<t?-1:e>t?1:0}function XVe(e,t){return e.candidate.rank-t.candidate.rank||e.providerOrder-t.providerOrder||e.localOrder-t.localOrder}function QVe(e,t,n=1){if(!Number.isInteger(t)||t<n)throw new Error(`skill: ${e} must be an integer greater than or equal to ${n}`)}function xoe(e,t){return t===void 0?e:(bv(t),new Promise((n,r)=>{let s=o(()=>{t.removeEventListener("abort",i)},"cleanup"),i=o(()=>{s(),r(RE(t.reason))},"onAbort");t.addEventListener("abort",i,{once:!0}),e.then(a=>{s(),n(a)},a=>{s(),r(RE(a))})}))}function bv(e){if(e?.aborted===!0)throw RE(e.reason)}function RE(e){try{if(e instanceof Error)return e}catch{}return new Error(CE(e))}function CE(e){try{return String(e)}catch{return"[unrenderable thrown value]"}}var $E,yoe,jVe,IE,FVe,boe,zVe,woe,WVe,r1=te(()=>{Zn();zs();mo();Qn();$E=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,yoe=128,jVe=2,IE="runtime",FVe=250,boe=600;o(uM,"isSkillName");o(NE,"isModelInvocable");o(n1,"isUserInvocable");o(dM,"renderSkillContent");o(UVe,"renderResourceHint");o(qVe,"escapeAttr");o(t1,"escapeText");zVe=class{static{o(this,"SkillLayer")}providers;runtime=new Map;constructor(e){this.providers=new Qc(t=>new Error(e===void 0?`a skill provider named "${t}" is already registered`:`a skill provider named "${t}" is already registered in this scope`))}isEmpty(){return this.providers.isEmpty()&&this.runtime.size===0}},woe=class extends _t{static{o(this,"SkillRegistry")}static Config=O.object({collectCacheMaxEntries:O.number().default(yoe)});collectCacheMaxEntries;layers=new eu(e=>new zVe(e),()=>{this.invalidateCache()});collectCache=new Map;revision=0;nextProviderOrder=0;scopeIds=new WeakMap;nextScopeId=1;constructor(e,t={}){super(e,"skills"),this.collectCacheMaxEntries=t.collectCacheMaxEntries??yoe,QVe("collectCacheMaxEntries",this.collectCacheMaxEntries)}registerProvider(e){let t=new AbortController,n,r,s={signal:t.signal,invalidate:o(()=>{let i=n;i!==void 0&&i.layer.providers.get(i.name)?.provider===r&&this.invalidateCache()},"invalidate")};try{r=e(s);let i=r.name;if(i===IE)throw new Error(`"${IE}" is reserved for runtime skill registrations`);let a=this.nextProviderOrder;return this.nextProviderOrder+=1,this.layers.effect(this.ctx,l=>{let c=l.providers.insert(i,{provider:r,order:a});return n={layer:l,name:i},()=>{n=void 0,c(),t.abort(new Error(`skill provider "${i}" disposed`))}},{label:"skills.registerProvider()"})}catch(i){throw t.abort(i),i}}register(e){GVe(e);let t=Aa(this.ctx),n=t===void 0?this.layers.global:this.layers.peek(t);if(n!==void 0&&n.runtime.has(e.name))return this.ctx.logger.warn(`runtime skill "${e.name}" ignored because it is already registered`),()=>{};let r={...e,invocation:e.invocation??{modelInvocable:!0,userInvocable:!0},provider:e.provider??IE};return this.layers.effect(this.ctx,s=>(s.runtime.set(r.name,r),()=>{s.runtime.delete(r.name)}),{label:"skills.register()"})}async list(e={}){return(await this.snapshot(e)).skills}async snapshot(e={}){let t=await this.collect(e);return{skills:[...t.entries.values()].map(n=>KVe(n.candidate)).sort(JVe),complete:t.cacheable}}async get(e,t={}){if(!uM(e))return;let n=await this.collect(t);bv(t.signal);let r=n.entries.get(e);if(r===void 0)return;let s=await xoe(r.provider.get(r.candidate,t),t.signal);if(s!==void 0){if(ZVe(s),s.name!==r.candidate.name){this.invalidateEntry(r);return}return s}}async collect(e){bv(e.signal);let t=1;for(;;){let n=this.revision,r=this.collectCacheKey(e.cwd,zy(e.scope),n),s=this.collectCache.get(r);if(s!==void 0)return{entries:s,cacheable:!0};let i=await this.collectFresh(e);if(bv(e.signal),n!==this.revision){if(t<jVe){t+=1;continue}return{entries:i.entries,cacheable:!1}}if(i.cacheable&&(this.collectCache.set(r,i.entries),this.collectCache.size>this.collectCacheMaxEntries)){let a=this.collectCache.keys().next();this.collectCache.delete(a.value)}return i}}async collectFresh(e){let t=[this.layers.global,...this.layers.chainLayers(e.scope)],n=new Map,r=!0;for(let s of t){let i=await this.collectLayer(s,e);i.cacheable||(r=!1);for(let a of i.entries)n.set(a.candidate.name,a)}return{entries:n,cacheable:r}}async collectLayer(e,t){let n=await this.listLayerCandidates(e,t);n.entries.sort(XVe);let r=new Set,s=[];for(let i of n.entries){let a=i.candidate;if(r.has(a.name)){this.ctx.logger.warn(`skill "${a.name}" from ${a.source} ignored because a higher-priority skill already exists`);continue}r.add(a.name),s.push(i)}return{entries:s,cacheable:n.cacheable}}async listLayerCandidates(e,t){bv(t.signal);let n=[],r=!0,s=0;for(let i of[...e.runtime.values()].sort((a,l)=>Soe(a.name,l.name)))n.push({candidate:HVe(i),provider:WVe,providerOrder:-1,localOrder:s,layer:e}),s+=1;for(let{provider:i,order:a}of[...e.providers.values()]){let l=0,c;try{c=await xoe(i.list(t),t.signal)}catch(d){if(t.signal?.aborted===!0)throw RE(t.signal.reason);r=!1,this.ctx.logger.warn(`skill provider "${i.name}" skipped: ${CE(d)}`)}if(c===void 0)continue;let u=BVe(c,i.name);u.complete||(r=!1);for(let d of u.candidates)VVe(d,i.name),n.push({candidate:d,provider:i,providerOrder:a,localOrder:l,layer:e}),l+=1}return{entries:n,cacheable:r}}invalidateCache(){this.revision+=1,this.collectCache.clear(),this.notifyChange()}invalidateEntry(e){e.layer.providers.get(e.provider.name)?.provider===e.provider&&this.invalidateCache()}scopeId(e){let t=this.scopeIds.get(e);return t===void 0&&(t=this.nextScopeId,this.nextScopeId+=1,this.scopeIds.set(e,t)),t}collectCacheKey(e,t,n){return JSON.stringify({cwd:e,scopes:t.map(r=>this.scopeId(r)),revision:n})}notifyChange(){for(let e of this.ctx.events.dispatch("emit",["skills/change"]))try{let t=e();Promise.resolve(t).catch(n=>{this.ctx.logger.warn(`skills/change listener rejected: ${CE(n)}`)})}catch(t){this.ctx.logger.warn(`skills/change listener threw: ${CE(t)}`)}}};o(BVe,"normalizeProviderObservation");o(voe,"invalidProviderObservation");WVe={name:IE,list(){return Promise.resolve([])},get(e){return Promise.resolve(e.locator)}};o(HVe,"runtimeCandidate");o(VVe,"validateCandidate");o(GVe,"validateRuntimeSkill");o(ZVe,"validateDefinition");o(KVe,"toSummary");o(pM,"validateInvocation");o(JVe,"compareSkillSummary");o(Soe,"compareCodePoints");o(XVe,"compareIndexedCandidates");o(QVe,"assertPositiveInteger");o(xoe,"waitWithAbort");o(bv,"throwIfAborted");o(RE,"toError");o(CE,"errorMessage")});var cc,i1=te(()=>{cc=class{static{o(this,"Deque")}buffer=new Array(16);head=0;count=0;get size(){return this.count}pushBack(e){this.ensureCapacity();let t=this.head+this.count;this.buffer[t<this.buffer.length?t:t-this.buffer.length]=e,this.count+=1}pushFront(e){this.ensureCapacity(),this.head=this.head===0?this.buffer.length-1:this.head-1,this.buffer[this.head]=e,this.count+=1}popFront(){if(this.count===0)return;let e=this.buffer[this.head];return this.buffer[this.head]=void 0,this.head+=1,this.head===this.buffer.length&&(this.head=0),this.count-=1,this.compact(),e}clear(){this.buffer=new Array(16),this.head=0,this.count=0}ensureCapacity(){this.count<this.buffer.length||this.resize(this.buffer.length*2)}compact(){if(this.count===0){this.head=0;return}this.buffer.length>16&&this.count<=this.buffer.length/4&&this.resize(Math.max(16,this.buffer.length/2))}resize(e){let t=new Array(e),n=this.head;for(let r=0;r<this.count;r+=1)t[r]=this.buffer[n],n+=1,n===this.buffer.length&&(n=0);this.buffer=t,this.head=0}}});var ad,ile,_M=te(()=>{Zn();ad=class extends Error{static{o(this,"DirectoryPickerError")}code;path;constructor(e,t,n){super(n),this.code=e,this.path=t,this.name="DirectoryPickerError"}},ile=class extends _t{static{o(this,"DirectoryPicker")}constructor(e){super(e,"directoryPicker")}}});var Nce=oe((JGt,u6)=>{var $ce=$ce||function(e){return Buffer.from(e).toString("base64")};function zJe(e){var t=this,n=Math.round,r=Math.floor,s=new Array(64),i=new Array(64),a=new Array(64),l=new Array(64),c,u,d,p,m=new Array(65535),h=new Array(65535),g=new Array(64),y=new Array(64),x=[],w=0,S=7,k=new Array(64),b=new Array(64),_=new Array(64),T=new Array(256),R=new Array(2048),F,B=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],K=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],P=[0,1,2,3,4,5,6,7,8,9,10,11],j=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],ee=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],N=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],G=[0,1,2,3,4,5,6,7,8,9,10,11],ye=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],U=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function Y(X){for(var Re=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],ue=0;ue<64;ue++){var et=r((Re[ue]*X+50)/100);et<1?et=1:et>255&&(et=255),s[B[ue]]=et}for(var De=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],Ie=0;Ie<64;Ie++){var ut=r((De[Ie]*X+50)/100);ut<1?ut=1:ut>255&&(ut=255),i[B[Ie]]=ut}for(var Ze=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],je=0,lt=0;lt<8;lt++)for(var we=0;we<8;we++)a[je]=1/(s[B[je]]*Ze[lt]*Ze[we]*8),l[je]=1/(i[B[je]]*Ze[lt]*Ze[we]*8),je++}o(Y,"initQuantTables");function W(X,Re){for(var ue=0,et=0,De=new Array,Ie=1;Ie<=16;Ie++){for(var ut=1;ut<=X[Ie];ut++)De[Re[et]]=[],De[Re[et]][0]=ue,De[Re[et]][1]=Ie,et++,ue++;ue*=2}return De}o(W,"computeHuffmanTbl");function q(){c=W(K,P),u=W(N,G),d=W(j,ee),p=W(ye,U)}o(q,"initHuffmanTbl");function pe(){for(var X=1,Re=2,ue=1;ue<=15;ue++){for(var et=X;et<Re;et++)h[32767+et]=ue,m[32767+et]=[],m[32767+et][1]=ue,m[32767+et][0]=et;for(var De=-(Re-1);De<=-X;De++)h[32767+De]=ue,m[32767+De]=[],m[32767+De][1]=ue,m[32767+De][0]=Re-1+De;X<<=1,Re<<=1}}o(pe,"initCategoryNumber");function xe(){for(var X=0;X<256;X++)R[X]=19595*X,R[X+256>>0]=38470*X,R[X+512>>0]=7471*X+32768,R[X+768>>0]=-11059*X,R[X+1024>>0]=-21709*X,R[X+1280>>0]=32768*X+8421375,R[X+1536>>0]=-27439*X,R[X+1792>>0]=-5329*X}o(xe,"initRGBYUVTable");function ce(X){for(var Re=X[0],ue=X[1]-1;ue>=0;)Re&1<<ue&&(w|=1<<S),ue--,S--,S<0&&(w==255?(D(255),D(0)):D(w),S=7,w=0)}o(ce,"writeBits");function D(X){x.push(X)}o(D,"writeByte");function Oe(X){D(X>>8&255),D(X&255)}o(Oe,"writeWord");function Je(X,Re){var ue,et,De,Ie,ut,Ze,je,lt,we=0,mt,Nt=8,nt=64;for(mt=0;mt<Nt;++mt){ue=X[we],et=X[we+1],De=X[we+2],Ie=X[we+3],ut=X[we+4],Ze=X[we+5],je=X[we+6],lt=X[we+7];var rn=ue+lt,$t=ue-lt,At=et+je,Q=et-je,Ee=De+Ze,Le=De-Ze,Ke=Ie+ut,xt=Ie-ut,ze=rn+Ke,Vt=rn-Ke,Bt=At+Ee,sn=At-Ee;X[we]=ze+Bt,X[we+4]=ze-Bt;var kt=(sn+Vt)*.707106781;X[we+2]=Vt+kt,X[we+6]=Vt-kt,ze=xt+Le,Bt=Le+Q,sn=Q+$t;var ir=(ze-sn)*.382683433,ur=.5411961*ze+ir,ws=1.306562965*sn+ir,Vr=Bt*.707106781,zn=$t+Vr,Ss=$t-Vr;X[we+5]=Ss+ur,X[we+3]=Ss-ur,X[we+1]=zn+ws,X[we+7]=zn-ws,we+=8}for(we=0,mt=0;mt<Nt;++mt){ue=X[we],et=X[we+8],De=X[we+16],Ie=X[we+24],ut=X[we+32],Ze=X[we+40],je=X[we+48],lt=X[we+56];var Us=ue+lt,ei=ue-lt,pi=et+je,It=et-je,mn=De+Ze,fi=De-Ze,ta=Ie+ut,Ii=Ie-ut,Ci=Us+ta,Li=Us-ta,na=pi+mn,Sa=pi-mn;X[we]=Ci+na,X[we+32]=Ci-na;var Do=(Sa+Li)*.707106781;X[we+16]=Li+Do,X[we+48]=Li-Do,Ci=Ii+fi,na=fi+It,Sa=It+ei;var io=(Ci-Sa)*.382683433,ql=.5411961*Ci+io,zl=1.306562965*Sa+io,Bl=na*.707106781,Wl=ei+Bl,Du=ei-Bl;X[we+40]=Du+ql,X[we+24]=Du-ql,X[we+8]=Wl+zl,X[we+56]=Wl-zl,we++}var Pc;for(mt=0;mt<nt;++mt)Pc=X[mt]*Re[mt],g[mt]=Pc>0?Pc+.5|0:Pc-.5|0;return g}o(Je,"fDCTQuant");function Ue(){Oe(65504),Oe(16),D(74),D(70),D(73),D(70),D(0),D(1),D(1),D(0),Oe(1),Oe(1),D(0),D(0)}o(Ue,"writeAPP0");function _e(X){if(X){Oe(65505),X[0]===69&&X[1]===120&&X[2]===105&&X[3]===102?Oe(X.length+2):(Oe(X.length+5+2),D(69),D(120),D(105),D(102),D(0));for(var Re=0;Re<X.length;Re++)D(X[Re])}}o(_e,"writeAPP1");function it(X,Re){Oe(65472),Oe(17),D(8),Oe(Re),Oe(X),D(3),D(1),D(17),D(0),D(2),D(17),D(1),D(3),D(17),D(1)}o(it,"writeSOF0");function qe(){Oe(65499),Oe(132),D(0);for(var X=0;X<64;X++)D(s[X]);D(1);for(var Re=0;Re<64;Re++)D(i[Re])}o(qe,"writeDQT");function ge(){Oe(65476),Oe(418),D(0);for(var X=0;X<16;X++)D(K[X+1]);for(var Re=0;Re<=11;Re++)D(P[Re]);D(16);for(var ue=0;ue<16;ue++)D(j[ue+1]);for(var et=0;et<=161;et++)D(ee[et]);D(1);for(var De=0;De<16;De++)D(N[De+1]);for(var Ie=0;Ie<=11;Ie++)D(G[Ie]);D(17);for(var ut=0;ut<16;ut++)D(ye[ut+1]);for(var Ze=0;Ze<=161;Ze++)D(U[Ze])}o(ge,"writeDHT");function de(X){typeof X>"u"||X.constructor!==Array||X.forEach(Re=>{if(typeof Re=="string"){Oe(65534);var ue=Re.length;Oe(ue+2);var et;for(et=0;et<ue;et++)D(Re.charCodeAt(et))}})}o(de,"writeCOM");function yt(){Oe(65498),Oe(12),D(3),D(1),D(0),D(2),D(17),D(3),D(17),D(0),D(63),D(0)}o(yt,"writeSOS");function Xe(X,Re,ue,et,De){for(var Ie=De[0],ut=De[240],Ze,je=16,lt=63,we=64,mt=Je(X,Re),Nt=0;Nt<we;++Nt)y[B[Nt]]=mt[Nt];var nt=y[0]-ue;ue=y[0],nt==0?ce(et[0]):(Ze=32767+nt,ce(et[h[Ze]]),ce(m[Ze]));for(var rn=63;rn>0&&y[rn]==0;rn--);if(rn==0)return ce(Ie),ue;for(var $t=1,At;$t<=rn;){for(var Q=$t;y[$t]==0&&$t<=rn;++$t);var Ee=$t-Q;if(Ee>=je){At=Ee>>4;for(var Le=1;Le<=At;++Le)ce(ut);Ee=Ee&15}Ze=32767+y[$t],ce(De[(Ee<<4)+h[Ze]]),ce(m[Ze]),$t++}return rn!=lt&&ce(Ie),ue}o(Xe,"processDU");function at(){for(var X=String.fromCharCode,Re=0;Re<256;Re++)T[Re]=X(Re)}o(at,"initCharLookupTable"),this.encode=function(X,Re){var ue=new Date().getTime();Re&&Ae(Re),x=new Array,w=0,S=7,Oe(65496),Ue(),de(X.comments),_e(X.exifBuffer),qe(),it(X.width,X.height),ge(),yt();var et=0,De=0,Ie=0;w=0,S=7,this.encode.displayName="_encode_";for(var ut=X.data,Ze=X.width,je=X.height,lt=Ze*4,we=Ze*3,mt,Nt=0,nt,rn,$t,At,Q,Ee,Le,Ke;Nt<je;){for(mt=0;mt<lt;){for(At=lt*Nt+mt,Q=At,Ee=-1,Le=0,Ke=0;Ke<64;Ke++)Le=Ke>>3,Ee=(Ke&7)*4,Q=At+Le*lt+Ee,Nt+Le>=je&&(Q-=lt*(Nt+1+Le-je)),mt+Ee>=lt&&(Q-=mt+Ee-lt+4),nt=ut[Q++],rn=ut[Q++],$t=ut[Q++],k[Ke]=(R[nt]+R[rn+256>>0]+R[$t+512>>0]>>16)-128,b[Ke]=(R[nt+768>>0]+R[rn+1024>>0]+R[$t+1280>>0]>>16)-128,_[Ke]=(R[nt+1280>>0]+R[rn+1536>>0]+R[$t+1792>>0]>>16)-128;et=Xe(k,a,et,c,d),De=Xe(b,l,De,u,p),Ie=Xe(_,l,Ie,u,p),mt+=32}Nt+=8}if(S>=0){var xt=[];xt[1]=S+1,xt[0]=(1<<S+1)-1,ce(xt)}if(Oe(65497),typeof u6>"u")return new Uint8Array(x);return Buffer.from(x);var ze,Vt};function Ae(X){if(X<=0&&(X=1),X>100&&(X=100),F!=X){var Re=0;X<50?Re=Math.floor(5e3/X):Re=Math.floor(200-X*2),Y(Re),F=X}}o(Ae,"setQuality");function fe(){var X=new Date().getTime();e||(e=50),at(),q(),pe(),xe(),Ae(e);var Re=new Date().getTime()-X}o(fe,"init"),fe()}o(zJe,"JPEGEncoder");typeof u6<"u"?u6.exports=Rce:typeof window<"u"&&(window["jpeg-js"]=window["jpeg-js"]||{},window["jpeg-js"].encode=Rce);function Rce(e,t){typeof t>"u"&&(t=50);var n=new zJe(t),r=n.encode(e,t);return{data:r,width:e.width,height:e.height}}o(Rce,"encode")});var Pce=oe((QGt,nL)=>{var tL=o((function(){"use strict";var t=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),n=4017,r=799,s=3406,i=2276,a=1567,l=3784,c=5793,u=2896;function d(){}o(d,"constructor");function p(S,k){for(var b=0,_=[],T,R,F=16;F>0&&!S[F-1];)F--;_.push({children:[],index:0});var B=_[0],K;for(T=0;T<F;T++){for(R=0;R<S[T];R++){for(B=_.pop(),B.children[B.index]=k[b];B.index>0;){if(_.length===0)throw new Error("Could not recreate Huffman Table");B=_.pop()}for(B.index++,_.push(B);_.length<=T;)_.push(K={children:[],index:0}),B.children[B.index]=K.children,B=K;b++}T+1<F&&(_.push(K={children:[],index:0}),B.children[B.index]=K.children,B=K)}return _[0].children}o(p,"buildHuffmanTable");function m(S,k,b,_,T,R,F,B,K,P){var j=b.precision,ee=b.samplesPerLine,N=b.scanLines,G=b.mcusPerLine,ye=b.progressive,U=b.maxH,Y=b.maxV,W=k,q=0,pe=0;function xe(){if(pe>0)return pe--,q>>pe&1;if(q=S[k++],q==255){var we=S[k++];if(we)throw new Error("unexpected marker: "+(q<<8|we).toString(16))}return pe=7,q>>>7}o(xe,"readBit");function ce(we){for(var mt=we,Nt;(Nt=xe())!==null;){if(mt=mt[Nt],typeof mt=="number")return mt;if(typeof mt!="object")throw new Error("invalid huffman sequence")}return null}o(ce,"decodeHuffman");function D(we){for(var mt=0;we>0;){var Nt=xe();if(Nt===null)return;mt=mt<<1|Nt,we--}return mt}o(D,"receive");function Oe(we){var mt=D(we);return mt>=1<<we-1?mt:mt+(-1<<we)+1}o(Oe,"receiveAndExtend");function Je(we,mt){var Nt=ce(we.huffmanTableDC),nt=Nt===0?0:Oe(Nt);mt[0]=we.pred+=nt;for(var rn=1;rn<64;){var $t=ce(we.huffmanTableAC),At=$t&15,Q=$t>>4;if(At===0){if(Q<15)break;rn+=16;continue}rn+=Q;var Ee=t[rn];mt[Ee]=Oe(At),rn++}}o(Je,"decodeBaseline");function Ue(we,mt){var Nt=ce(we.huffmanTableDC),nt=Nt===0?0:Oe(Nt)<<K;mt[0]=we.pred+=nt}o(Ue,"decodeDCFirst");function _e(we,mt){mt[0]|=xe()<<K}o(_e,"decodeDCSuccessive");var it=0;function qe(we,mt){if(it>0){it--;return}for(var Nt=R,nt=F;Nt<=nt;){var rn=ce(we.huffmanTableAC),$t=rn&15,At=rn>>4;if($t===0){if(At<15){it=D(At)+(1<<At)-1;break}Nt+=16;continue}Nt+=At;var Q=t[Nt];mt[Q]=Oe($t)*(1<<K),Nt++}}o(qe,"decodeACFirst");var ge=0,de;function yt(we,mt){for(var Nt=R,nt=F,rn=0;Nt<=nt;){var $t=t[Nt],At=mt[$t]<0?-1:1;switch(ge){case 0:var Q=ce(we.huffmanTableAC),Ee=Q&15,rn=Q>>4;if(Ee===0)rn<15?(it=D(rn)+(1<<rn),ge=4):(rn=16,ge=1);else{if(Ee!==1)throw new Error("invalid ACn encoding");de=Oe(Ee),ge=rn?2:3}continue;case 1:case 2:mt[$t]?mt[$t]+=(xe()<<K)*At:(rn--,rn===0&&(ge=ge==2?3:0));break;case 3:mt[$t]?mt[$t]+=(xe()<<K)*At:(mt[$t]=de<<K,ge=0);break;case 4:mt[$t]&&(mt[$t]+=(xe()<<K)*At);break}Nt++}ge===4&&(it--,it===0&&(ge=0))}o(yt,"decodeACSuccessive");function Xe(we,mt,Nt,nt,rn){var $t=Nt/G|0,At=Nt%G,Q=$t*we.v+nt,Ee=At*we.h+rn;we.blocks[Q]===void 0&&P.tolerantDecoding||mt(we,we.blocks[Q][Ee])}o(Xe,"decodeMcu");function at(we,mt,Nt){var nt=Nt/we.blocksPerLine|0,rn=Nt%we.blocksPerLine;we.blocks[nt]===void 0&&P.tolerantDecoding||mt(we,we.blocks[nt][rn])}o(at,"decodeBlock");var Ae=_.length,fe,X,Re,ue,et,De;ye?R===0?De=B===0?Ue:_e:De=B===0?qe:yt:De=Je;var Ie=0,ut,Ze;Ae==1?Ze=_[0].blocksPerLine*_[0].blocksPerColumn:Ze=G*b.mcusPerColumn,T||(T=Ze);for(var je,lt;Ie<Ze;){for(X=0;X<Ae;X++)_[X].pred=0;if(it=0,Ae==1)for(fe=_[0],et=0;et<T;et++)at(fe,De,Ie),Ie++;else for(et=0;et<T;et++){for(X=0;X<Ae;X++)for(fe=_[X],je=fe.h,lt=fe.v,Re=0;Re<lt;Re++)for(ue=0;ue<je;ue++)Xe(fe,De,Ie,Re,ue);if(Ie++,Ie===Ze)break}if(Ie===Ze)do{if(S[k]===255&&S[k+1]!==0)break;k+=1}while(k<S.length-2);if(pe=0,ut=S[k]<<8|S[k+1],ut<65280)throw new Error("marker was not found");if(ut>=65488&&ut<=65495)k+=2;else break}return k-W}o(m,"decodeScan");function h(S,k){var b=[],_=k.blocksPerLine,T=k.blocksPerColumn,R=_<<3,F=new Int32Array(64),B=new Uint8Array(64);function K(W,q,pe){var xe=k.quantizationTable,ce,D,Oe,Je,Ue,_e,it,qe,ge,de=pe,yt;for(yt=0;yt<64;yt++)de[yt]=W[yt]*xe[yt];for(yt=0;yt<8;++yt){var Xe=8*yt;if(de[1+Xe]==0&&de[2+Xe]==0&&de[3+Xe]==0&&de[4+Xe]==0&&de[5+Xe]==0&&de[6+Xe]==0&&de[7+Xe]==0){ge=c*de[0+Xe]+512>>10,de[0+Xe]=ge,de[1+Xe]=ge,de[2+Xe]=ge,de[3+Xe]=ge,de[4+Xe]=ge,de[5+Xe]=ge,de[6+Xe]=ge,de[7+Xe]=ge;continue}ce=c*de[0+Xe]+128>>8,D=c*de[4+Xe]+128>>8,Oe=de[2+Xe],Je=de[6+Xe],Ue=u*(de[1+Xe]-de[7+Xe])+128>>8,qe=u*(de[1+Xe]+de[7+Xe])+128>>8,_e=de[3+Xe]<<4,it=de[5+Xe]<<4,ge=ce-D+1>>1,ce=ce+D+1>>1,D=ge,ge=Oe*l+Je*a+128>>8,Oe=Oe*a-Je*l+128>>8,Je=ge,ge=Ue-it+1>>1,Ue=Ue+it+1>>1,it=ge,ge=qe+_e+1>>1,_e=qe-_e+1>>1,qe=ge,ge=ce-Je+1>>1,ce=ce+Je+1>>1,Je=ge,ge=D-Oe+1>>1,D=D+Oe+1>>1,Oe=ge,ge=Ue*i+qe*s+2048>>12,Ue=Ue*s-qe*i+2048>>12,qe=ge,ge=_e*r+it*n+2048>>12,_e=_e*n-it*r+2048>>12,it=ge,de[0+Xe]=ce+qe,de[7+Xe]=ce-qe,de[1+Xe]=D+it,de[6+Xe]=D-it,de[2+Xe]=Oe+_e,de[5+Xe]=Oe-_e,de[3+Xe]=Je+Ue,de[4+Xe]=Je-Ue}for(yt=0;yt<8;++yt){var at=yt;if(de[8+at]==0&&de[16+at]==0&&de[24+at]==0&&de[32+at]==0&&de[40+at]==0&&de[48+at]==0&&de[56+at]==0){ge=c*pe[yt+0]+8192>>14,de[0+at]=ge,de[8+at]=ge,de[16+at]=ge,de[24+at]=ge,de[32+at]=ge,de[40+at]=ge,de[48+at]=ge,de[56+at]=ge;continue}ce=c*de[0+at]+2048>>12,D=c*de[32+at]+2048>>12,Oe=de[16+at],Je=de[48+at],Ue=u*(de[8+at]-de[56+at])+2048>>12,qe=u*(de[8+at]+de[56+at])+2048>>12,_e=de[24+at],it=de[40+at],ge=ce-D+1>>1,ce=ce+D+1>>1,D=ge,ge=Oe*l+Je*a+2048>>12,Oe=Oe*a-Je*l+2048>>12,Je=ge,ge=Ue-it+1>>1,Ue=Ue+it+1>>1,it=ge,ge=qe+_e+1>>1,_e=qe-_e+1>>1,qe=ge,ge=ce-Je+1>>1,ce=ce+Je+1>>1,Je=ge,ge=D-Oe+1>>1,D=D+Oe+1>>1,Oe=ge,ge=Ue*i+qe*s+2048>>12,Ue=Ue*s-qe*i+2048>>12,qe=ge,ge=_e*r+it*n+2048>>12,_e=_e*n-it*r+2048>>12,it=ge,de[0+at]=ce+qe,de[56+at]=ce-qe,de[8+at]=D+it,de[48+at]=D-it,de[16+at]=Oe+_e,de[40+at]=Oe-_e,de[24+at]=Je+Ue,de[32+at]=Je-Ue}for(yt=0;yt<64;++yt){var Ae=128+(de[yt]+8>>4);q[yt]=Ae<0?0:Ae>255?255:Ae}}o(K,"quantizeAndInverse"),w(R*T*8);for(var P,j,ee=0;ee<T;ee++){var N=ee<<3;for(P=0;P<8;P++)b.push(new Uint8Array(R));for(var G=0;G<_;G++){K(k.blocks[ee][G],B,F);var ye=0,U=G<<3;for(j=0;j<8;j++){var Y=b[N+j];for(P=0;P<8;P++)Y[U+P]=B[ye++]}}}return b}o(h,"buildComponentData");function g(S){return S<0?0:S>255?255:S}o(g,"clampTo8bit"),d.prototype={load:o(function(k){var b=new XMLHttpRequest;b.open("GET",k,!0),b.responseType="arraybuffer",b.onload=(function(){var _=new Uint8Array(b.response||b.mozResponseArrayBuffer);this.parse(_),this.onload&&this.onload()}).bind(this),b.send(null)},"load"),parse:o(function(k){var b=this.opts.maxResolutionInMP*1e3*1e3,_=0,T=k.length;function R(){var Q=k[_]<<8|k[_+1];return _+=2,Q}o(R,"readUint16");function F(){var Q=R(),Ee=k.subarray(_,_+Q-2);return _+=Ee.length,Ee}o(F,"readDataBlock");function B(Q){var Ee=1,Le=1,Ke,xt;for(xt in Q.components)Q.components.hasOwnProperty(xt)&&(Ke=Q.components[xt],Ee<Ke.h&&(Ee=Ke.h),Le<Ke.v&&(Le=Ke.v));var ze=Math.ceil(Q.samplesPerLine/8/Ee),Vt=Math.ceil(Q.scanLines/8/Le);for(xt in Q.components)if(Q.components.hasOwnProperty(xt)){Ke=Q.components[xt];var Bt=Math.ceil(Math.ceil(Q.samplesPerLine/8)*Ke.h/Ee),sn=Math.ceil(Math.ceil(Q.scanLines/8)*Ke.v/Le),kt=ze*Ke.h,ir=Vt*Ke.v,ur=ir*kt,ws=[];w(ur*256);for(var Vr=0;Vr<ir;Vr++){for(var zn=[],Ss=0;Ss<kt;Ss++)zn.push(new Int32Array(64));ws.push(zn)}Ke.blocksPerLine=Bt,Ke.blocksPerColumn=sn,Ke.blocks=ws}Q.maxH=Ee,Q.maxV=Le,Q.mcusPerLine=ze,Q.mcusPerColumn=Vt}o(B,"prepareComponents");var K=null,P=null,j=null,ee,N,G=[],ye=[],U=[],Y=[],W=R(),q=-1;if(this.comments=[],W!=65496)throw new Error("SOI not found");for(W=R();W!=65497;){var pe,xe,ce;switch(W){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var D=F();if(W===65534){var Oe=String.fromCharCode.apply(null,D);this.comments.push(Oe)}W===65504&&D[0]===74&&D[1]===70&&D[2]===73&&D[3]===70&&D[4]===0&&(K={version:{major:D[5],minor:D[6]},densityUnits:D[7],xDensity:D[8]<<8|D[9],yDensity:D[10]<<8|D[11],thumbWidth:D[12],thumbHeight:D[13],thumbData:D.subarray(14,14+3*D[12]*D[13])}),W===65505&&D[0]===69&&D[1]===120&&D[2]===105&&D[3]===102&&D[4]===0&&(this.exifBuffer=D.subarray(5,D.length)),W===65518&&D[0]===65&&D[1]===100&&D[2]===111&&D[3]===98&&D[4]===101&&D[5]===0&&(P={version:D[6],flags0:D[7]<<8|D[8],flags1:D[9]<<8|D[10],transformCode:D[11]});break;case 65499:for(var Je=R(),Ue=Je+_-2;_<Ue;){var _e=k[_++];w(256);var it=new Int32Array(64);if(_e>>4===0)for(xe=0;xe<64;xe++){var qe=t[xe];it[qe]=k[_++]}else if(_e>>4===1)for(xe=0;xe<64;xe++){var qe=t[xe];it[qe]=R()}else throw new Error("DQT: invalid table spec");G[_e&15]=it}break;case 65472:case 65473:case 65474:R(),ee={},ee.extended=W===65473,ee.progressive=W===65474,ee.precision=k[_++],ee.scanLines=R(),ee.samplesPerLine=R(),ee.components={},ee.componentsOrder=[];var ge=ee.scanLines*ee.samplesPerLine;if(ge>b){var de=Math.ceil((ge-b)/1e6);throw new Error(`maxResolutionInMP limit exceeded by ${de}MP`)}var yt=k[_++],Xe,at=0,Ae=0;for(pe=0;pe<yt;pe++){Xe=k[_];var fe=k[_+1]>>4,X=k[_+1]&15,Re=k[_+2];if(fe<=0||X<=0)throw new Error("Invalid sampling factor, expected values above 0");ee.componentsOrder.push(Xe),ee.components[Xe]={h:fe,v:X,quantizationIdx:Re},_+=3}B(ee),ye.push(ee);break;case 65476:var ue=R();for(pe=2;pe<ue;){var et=k[_++],De=new Uint8Array(16),Ie=0;for(xe=0;xe<16;xe++,_++)Ie+=De[xe]=k[_];w(16+Ie);var ut=new Uint8Array(Ie);for(xe=0;xe<Ie;xe++,_++)ut[xe]=k[_];pe+=17+Ie,(et>>4===0?Y:U)[et&15]=p(De,ut)}break;case 65501:R(),N=R();break;case 65500:R(),R();break;case 65498:var Ze=R(),je=k[_++],lt=[],we;for(pe=0;pe<je;pe++){we=ee.components[k[_++]];var mt=k[_++];we.huffmanTableDC=Y[mt>>4],we.huffmanTableAC=U[mt&15],lt.push(we)}var Nt=k[_++],nt=k[_++],rn=k[_++],$t=m(k,_,ee,lt,N,Nt,nt,rn>>4,rn&15,this.opts);_+=$t;break;case 65535:k[_]!==255&&_--;break;default:if(k[_-3]==255&&k[_-2]>=192&&k[_-2]<=254){_-=3;break}else if(W===224||W==225){if(q!==-1)throw new Error(`first unknown JPEG marker at offset ${q.toString(16)}, second unknown JPEG marker ${W.toString(16)} at offset ${(_-1).toString(16)}`);q=_-1;let Q=R();if(k[_+Q-2]===255){_+=Q-2;break}}throw new Error("unknown JPEG marker "+W.toString(16))}W=R()}if(ye.length!=1)throw new Error("only single frame JPEGs supported");for(var pe=0;pe<ye.length;pe++){var At=ye[pe].components;for(var xe in At)At[xe].quantizationTable=G[At[xe].quantizationIdx],delete At[xe].quantizationIdx}this.width=ee.samplesPerLine,this.height=ee.scanLines,this.jfif=K,this.adobe=P,this.components=[];for(var pe=0;pe<ee.componentsOrder.length;pe++){var we=ee.components[ee.componentsOrder[pe]];this.components.push({lines:h(ee,we),scaleX:we.h/ee.maxH,scaleY:we.v/ee.maxV})}},"parse"),getData:o(function(k,b){var _=this.width/k,T=this.height/b,R,F,B,K,P,j,ee,N,G,ye,U=0,Y,W,q,pe,xe,ce,D,Oe,Je,Ue,_e,it=k*b*this.components.length;w(it);var qe=new Uint8Array(it);switch(this.components.length){case 1:for(R=this.components[0],ye=0;ye<b;ye++)for(P=R.lines[0|ye*R.scaleY*T],G=0;G<k;G++)Y=P[0|G*R.scaleX*_],qe[U++]=Y;break;case 2:for(R=this.components[0],F=this.components[1],ye=0;ye<b;ye++)for(P=R.lines[0|ye*R.scaleY*T],j=F.lines[0|ye*F.scaleY*T],G=0;G<k;G++)Y=P[0|G*R.scaleX*_],qe[U++]=Y,Y=j[0|G*F.scaleX*_],qe[U++]=Y;break;case 3:for(_e=!0,this.adobe&&this.adobe.transformCode?_e=!0:typeof this.opts.colorTransform<"u"&&(_e=!!this.opts.colorTransform),R=this.components[0],F=this.components[1],B=this.components[2],ye=0;ye<b;ye++)for(P=R.lines[0|ye*R.scaleY*T],j=F.lines[0|ye*F.scaleY*T],ee=B.lines[0|ye*B.scaleY*T],G=0;G<k;G++)_e?(Y=P[0|G*R.scaleX*_],W=j[0|G*F.scaleX*_],q=ee[0|G*B.scaleX*_],Oe=g(Y+1.402*(q-128)),Je=g(Y-.3441363*(W-128)-.71413636*(q-128)),Ue=g(Y+1.772*(W-128))):(Oe=P[0|G*R.scaleX*_],Je=j[0|G*F.scaleX*_],Ue=ee[0|G*B.scaleX*_]),qe[U++]=Oe,qe[U++]=Je,qe[U++]=Ue;break;case 4:if(!this.adobe)throw new Error("Unsupported color mode (4 components)");for(_e=!1,this.adobe&&this.adobe.transformCode?_e=!0:typeof this.opts.colorTransform<"u"&&(_e=!!this.opts.colorTransform),R=this.components[0],F=this.components[1],B=this.components[2],K=this.components[3],ye=0;ye<b;ye++)for(P=R.lines[0|ye*R.scaleY*T],j=F.lines[0|ye*F.scaleY*T],ee=B.lines[0|ye*B.scaleY*T],N=K.lines[0|ye*K.scaleY*T],G=0;G<k;G++)_e?(Y=P[0|G*R.scaleX*_],W=j[0|G*F.scaleX*_],q=ee[0|G*B.scaleX*_],pe=N[0|G*K.scaleX*_],xe=255-g(Y+1.402*(q-128)),ce=255-g(Y-.3441363*(W-128)-.71413636*(q-128)),D=255-g(Y+1.772*(W-128))):(xe=P[0|G*R.scaleX*_],ce=j[0|G*F.scaleX*_],D=ee[0|G*B.scaleX*_],pe=N[0|G*K.scaleX*_]),qe[U++]=255-xe,qe[U++]=255-ce,qe[U++]=255-D,qe[U++]=255-pe;break;default:throw new Error("Unsupported color mode")}return qe},"getData"),copyToImageData:o(function(k,b){var _=k.width,T=k.height,R=k.data,F=this.getData(_,T),B=0,K=0,P,j,ee,N,G,ye,U,Y,W;switch(this.components.length){case 1:for(j=0;j<T;j++)for(P=0;P<_;P++)ee=F[B++],R[K++]=ee,R[K++]=ee,R[K++]=ee,b&&(R[K++]=255);break;case 3:for(j=0;j<T;j++)for(P=0;P<_;P++)U=F[B++],Y=F[B++],W=F[B++],R[K++]=U,R[K++]=Y,R[K++]=W,b&&(R[K++]=255);break;case 4:for(j=0;j<T;j++)for(P=0;P<_;P++)G=F[B++],ye=F[B++],ee=F[B++],N=F[B++],U=255-g(G*(1-N/255)+N),Y=255-g(ye*(1-N/255)+N),W=255-g(ee*(1-N/255)+N),R[K++]=U,R[K++]=Y,R[K++]=W,b&&(R[K++]=255);break;default:throw new Error("Unsupported color mode")}},"copyToImageData")};var y=0,x=0;function w(S=0){var k=y+S;if(k>x){var b=Math.ceil((k-x)/1024/1024);throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${b}MB`)}y=k}return o(w,"requestMemoryAllocation"),d.resetMaxMemoryUsage=function(S){y=0,x=S},d.getBytesAllocated=function(){return y},d.requestMemoryAllocation=w,d}),"jpegImage")();typeof nL<"u"?nL.exports=Oce:typeof window<"u"&&(window["jpeg-js"]=window["jpeg-js"]||{},window["jpeg-js"].decode=Oce);function Oce(e,t={}){var n={colorTransform:void 0,useTArray:!1,formatAsRGBA:!0,tolerantDecoding:!0,maxResolutionInMP:100,maxMemoryUsageInMB:512},r={...n,...t},s=new Uint8Array(e),i=new tL;i.opts=r,tL.resetMaxMemoryUsage(r.maxMemoryUsageInMB*1024*1024),i.parse(s);var a=r.formatAsRGBA?4:3,l=i.width*i.height*a;try{tL.requestMemoryAllocation(l);var c={width:i.width,height:i.height,exifBuffer:i.exifBuffer,data:r.useTArray?new Uint8Array(l):Buffer.alloc(l)};i.comments.length>0&&(c.comments=i.comments)}catch(u){throw u instanceof RangeError?new Error("Could not allocate enough memory for the image. Required: "+l):u instanceof ReferenceError&&u.message==="Buffer is not defined"?new Error("Buffer is not globally defined in this environment. Consider setting useTArray to true"):u}return i.copyToImageData(c,r.formatAsRGBA),c}o(Oce,"decode")});var Mce=oe((eZt,Dce)=>{var BJe=Nce(),WJe=Pce();Dce.exports={encode:BJe,decode:WJe}});var b1=oe((FKt,rde)=>{"use strict";rde.exports=wh;wh.CAPTURING_PHASE=1;wh.AT_TARGET=2;wh.BUBBLING_PHASE=3;function wh(e,t){if(this.type="",this.target=null,this.currentTarget=null,this.eventPhase=wh.AT_TARGET,this.bubbles=!1,this.cancelable=!1,this.isTrusted=!1,this.defaultPrevented=!1,this.timeStamp=Date.now(),this._propagationStopped=!1,this._immediatePropagationStopped=!1,this._initialized=!0,this._dispatching=!1,e&&(this.type=e),t)for(var n in t)this[n]=t[n]}o(wh,"Event");wh.prototype=Object.create(Object.prototype,{constructor:{value:wh},stopPropagation:{value:o(function(){this._propagationStopped=!0},"stopPropagation")},stopImmediatePropagation:{value:o(function(){this._propagationStopped=!0,this._immediatePropagationStopped=!0},"stopImmediatePropagation")},preventDefault:{value:o(function(){this.cancelable&&(this.defaultPrevented=!0)},"preventDefault")},initEvent:{value:o(function(t,n,r){this._initialized=!0,!this._dispatching&&(this._propagationStopped=!1,this._immediatePropagationStopped=!1,this.defaultPrevented=!1,this.isTrusted=!1,this.target=null,this.type=t,this.bubbles=n,this.cancelable=r)},"initEvent")}})});var QL=oe((qKt,ide)=>{"use strict";var sde=b1();ide.exports=XL;function XL(){sde.call(this),this.view=null,this.detail=0}o(XL,"UIEvent");XL.prototype=Object.create(sde.prototype,{constructor:{value:XL},initUIEvent:{value:o(function(e,t,n,r,s){this.initEvent(e,t,n),this.view=r,this.detail=s},"value")}})});var ej=oe((BKt,ode)=>{"use strict";var ade=QL();ode.exports=YL;function YL(){ade.call(this),this.screenX=this.screenY=this.clientX=this.clientY=0,this.ctrlKey=this.altKey=this.shiftKey=this.metaKey=!1,this.button=0,this.buttons=1,this.relatedTarget=null}o(YL,"MouseEvent");YL.prototype=Object.create(ade.prototype,{constructor:{value:YL},initMouseEvent:{value:o(function(e,t,n,r,s,i,a,l,c,u,d,p,m,h,g){switch(this.initEvent(e,t,n,r,s),this.screenX=i,this.screenY=a,this.clientX=l,this.clientY=c,this.ctrlKey=u,this.altKey=d,this.shiftKey=p,this.metaKey=m,this.button=h,h){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2;break;default:this.buttons=0;break}this.relatedTarget=g},"value")},getModifierState:{value:o(function(e){switch(e){case"Alt":return this.altKey;case"Control":return this.ctrlKey;case"Shift":return this.shiftKey;case"Meta":return this.metaKey;default:return!1}},"value")}})});var N6=oe((HKt,cde)=>{"use strict";cde.exports=$6;var net=1,ret=3,set=4,iet=5,aet=7,oet=8,cet=9,uet=11,det=12,pet=13,fet=14,het=15,met=17,get=18,yet=19,vet=20,xet=21,bet=22,wet=23,ket=24,Eet=25,_et=[null,"INDEX_SIZE_ERR",null,"HIERARCHY_REQUEST_ERR","WRONG_DOCUMENT_ERR","INVALID_CHARACTER_ERR",null,"NO_MODIFICATION_ALLOWED_ERR","NOT_FOUND_ERR","NOT_SUPPORTED_ERR","INUSE_ATTRIBUTE_ERR","INVALID_STATE_ERR","SYNTAX_ERR","INVALID_MODIFICATION_ERR","NAMESPACE_ERR","INVALID_ACCESS_ERR",null,"TYPE_MISMATCH_ERR","SECURITY_ERR","NETWORK_ERR","ABORT_ERR","URL_MISMATCH_ERR","QUOTA_EXCEEDED_ERR","TIMEOUT_ERR","INVALID_NODE_TYPE_ERR","DATA_CLONE_ERR"],Tet=[null,"INDEX_SIZE_ERR (1): the index is not in the allowed range",null,"HIERARCHY_REQUEST_ERR (3): the operation would yield an incorrect nodes model","WRONG_DOCUMENT_ERR (4): the object is in the wrong Document, a call to importNode is required","INVALID_CHARACTER_ERR (5): the string contains invalid characters",null,"NO_MODIFICATION_ALLOWED_ERR (7): the object can not be modified","NOT_FOUND_ERR (8): the object can not be found here","NOT_SUPPORTED_ERR (9): this operation is not supported","INUSE_ATTRIBUTE_ERR (10): setAttributeNode called on owned Attribute","INVALID_STATE_ERR (11): the object is in an invalid state","SYNTAX_ERR (12): the string did not match the expected pattern","INVALID_MODIFICATION_ERR (13): the object can not be modified in this way","NAMESPACE_ERR (14): the operation is not allowed by Namespaces in XML","INVALID_ACCESS_ERR (15): the object does not support the operation or argument",null,"TYPE_MISMATCH_ERR (17): the type of the object does not match the expected type","SECURITY_ERR (18): the operation is insecure","NETWORK_ERR (19): a network error occurred","ABORT_ERR (20): the user aborted an operation","URL_MISMATCH_ERR (21): the given URL does not match another URL","QUOTA_EXCEEDED_ERR (22): the quota has been exceeded","TIMEOUT_ERR (23): a timeout occurred","INVALID_NODE_TYPE_ERR (24): the supplied node is invalid or has an invalid ancestor for this operation","DATA_CLONE_ERR (25): the object can not be cloned."],lde={INDEX_SIZE_ERR:net,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:ret,WRONG_DOCUMENT_ERR:set,INVALID_CHARACTER_ERR:iet,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:aet,NOT_FOUND_ERR:oet,NOT_SUPPORTED_ERR:cet,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:uet,SYNTAX_ERR:det,INVALID_MODIFICATION_ERR:pet,NAMESPACE_ERR:fet,INVALID_ACCESS_ERR:het,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:met,SECURITY_ERR:get,NETWORK_ERR:yet,ABORT_ERR:vet,URL_MISMATCH_ERR:xet,QUOTA_EXCEEDED_ERR:bet,TIMEOUT_ERR:wet,INVALID_NODE_TYPE_ERR:ket,DATA_CLONE_ERR:Eet};function $6(e){Error.call(this),Error.captureStackTrace(this,this.constructor),this.code=e,this.message=Tet[e],this.name=_et[e]}o($6,"DOMException");$6.prototype.__proto__=Error.prototype;for(R6 in lde)tj={value:lde[R6]},Object.defineProperty($6,R6,tj),Object.defineProperty($6.prototype,R6,tj);var tj,R6});var O6=oe(ude=>{ude.isApiWritable=!globalThis.__domino_frozen__});var ii=oe(Qr=>{"use strict";var si=N6(),wi=si,Aet=O6().isApiWritable;Qr.NAMESPACE={HTML:"http://www.w3.org/1999/xhtml",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink"};Qr.IndexSizeError=function(){throw new si(wi.INDEX_SIZE_ERR)};Qr.HierarchyRequestError=function(){throw new si(wi.HIERARCHY_REQUEST_ERR)};Qr.WrongDocumentError=function(){throw new si(wi.WRONG_DOCUMENT_ERR)};Qr.InvalidCharacterError=function(){throw new si(wi.INVALID_CHARACTER_ERR)};Qr.NoModificationAllowedError=function(){throw new si(wi.NO_MODIFICATION_ALLOWED_ERR)};Qr.NotFoundError=function(){throw new si(wi.NOT_FOUND_ERR)};Qr.NotSupportedError=function(){throw new si(wi.NOT_SUPPORTED_ERR)};Qr.InvalidStateError=function(){throw new si(wi.INVALID_STATE_ERR)};Qr.SyntaxError=function(){throw new si(wi.SYNTAX_ERR)};Qr.InvalidModificationError=function(){throw new si(wi.INVALID_MODIFICATION_ERR)};Qr.NamespaceError=function(){throw new si(wi.NAMESPACE_ERR)};Qr.InvalidAccessError=function(){throw new si(wi.INVALID_ACCESS_ERR)};Qr.TypeMismatchError=function(){throw new si(wi.TYPE_MISMATCH_ERR)};Qr.SecurityError=function(){throw new si(wi.SECURITY_ERR)};Qr.NetworkError=function(){throw new si(wi.NETWORK_ERR)};Qr.AbortError=function(){throw new si(wi.ABORT_ERR)};Qr.UrlMismatchError=function(){throw new si(wi.URL_MISMATCH_ERR)};Qr.QuotaExceededError=function(){throw new si(wi.QUOTA_EXCEEDED_ERR)};Qr.TimeoutError=function(){throw new si(wi.TIMEOUT_ERR)};Qr.InvalidNodeTypeError=function(){throw new si(wi.INVALID_NODE_TYPE_ERR)};Qr.DataCloneError=function(){throw new si(wi.DATA_CLONE_ERR)};Qr.nyi=function(){throw new Error("NotYetImplemented")};Qr.shouldOverride=function(){throw new Error("Abstract function; should be overriding in subclass.")};Qr.assert=function(e,t){if(!e)throw new Error("Assertion failed: "+(t||"")+`
|
|
155
155
|
`+new Error().stack)};Qr.expose=function(e,t){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],writable:Aet})};Qr.merge=function(e,t){for(var n in t)e[n]=t[n]};Qr.documentOrder=function(e,t){return 3-(e.compareDocumentPosition(t)&6)};Qr.toASCIILowerCase=function(e){return e.replace(/[A-Z]+/g,function(t){return t.toLowerCase()})};Qr.toASCIIUpperCase=function(e){return e.replace(/[a-z]+/g,function(t){return t.toUpperCase()})}});var nj=oe((KKt,pde)=>{"use strict";var Sh=b1(),Iet=ej(),Cet=ii();pde.exports=dde;function dde(){}o(dde,"EventTarget");dde.prototype={addEventListener:o(function(t,n,r){if(n){r===void 0&&(r=!1),this._listeners||(this._listeners=Object.create(null)),this._listeners[t]||(this._listeners[t]=[]);for(var s=this._listeners[t],i=0,a=s.length;i<a;i++){var l=s[i];if(l.listener===n&&l.capture===r)return}var c={listener:n,capture:r};typeof n=="function"&&(c.f=n),s.push(c)}},"addEventListener"),removeEventListener:o(function(t,n,r){if(r===void 0&&(r=!1),this._listeners){var s=this._listeners[t];if(s)for(var i=0,a=s.length;i<a;i++){var l=s[i];if(l.listener===n&&l.capture===r){s.length===1?this._listeners[t]=void 0:s.splice(i,1);return}}}},"removeEventListener"),dispatchEvent:o(function(t){return this._dispatchEvent(t,!1)},"dispatchEvent"),_dispatchEvent:o(function(t,n){typeof n!="boolean"&&(n=!1);function r(u,d){var p=d.type,m=d.eventPhase;if(d.currentTarget=u,m!==Sh.CAPTURING_PHASE&&u._handlers&&u._handlers[p]){var h=u._handlers[p],g;if(typeof h=="function")g=h.call(d.currentTarget,d);else{var y=h.handleEvent;if(typeof y!="function")throw new TypeError("handleEvent property of event handler object isnot a function.");g=y.call(h,d)}d.type==="mouseover"?g===!0&&d.preventDefault():g===!1&&d.preventDefault()}var x=u._listeners&&u._listeners[p];if(x){x=x.slice();for(var w=0,S=x.length;w<S;w++){if(d._immediatePropagationStopped)return;var k=x[w];if(!(m===Sh.CAPTURING_PHASE&&!k.capture||m===Sh.BUBBLING_PHASE&&k.capture))if(k.f)k.f.call(d.currentTarget,d);else{var b=k.listener.handleEvent;if(typeof b!="function")throw new TypeError("handleEvent property of event listener object is not a function.");b.call(k.listener,d)}}}}o(r,"invoke"),(!t._initialized||t._dispatching)&&Cet.InvalidStateError(),t.isTrusted=n,t._dispatching=!0,t.target=this;for(var s=[],i=this.parentNode;i;i=i.parentNode)s.push(i);t.eventPhase=Sh.CAPTURING_PHASE;for(var a=s.length-1;a>=0&&(r(s[a],t),!t._propagationStopped);a--);if(t._propagationStopped||(t.eventPhase=Sh.AT_TARGET,r(this,t)),t.bubbles&&!t._propagationStopped){t.eventPhase=Sh.BUBBLING_PHASE;for(var l=0,c=s.length;l<c&&(r(s[l],t),!t._propagationStopped);l++);}if(t._dispatching=!1,t.eventPhase=Sh.AT_TARGET,t.currentTarget=null,n&&!t.defaultPrevented&&t instanceof Iet)switch(t.type){case"mousedown":this._armed={x:t.clientX,y:t.clientY,t:t.timeStamp};break;case"mouseout":case"mouseover":this._armed=null;break;case"mouseup":this._isClick(t)&&this._doClick(t),this._armed=null;break}return!t.defaultPrevented},"_dispatchEvent"),_isClick:o(function(e){return this._armed!==null&&e.type==="mouseup"&&e.isTrusted&&e.button===0&&e.timeStamp-this._armed.t<1e3&&Math.abs(e.clientX-this._armed.x)<10&&Math.abs(e.clientY-this._armed.Y)<10},"_isClick"),_doClick:o(function(e){if(!this._click_in_progress){this._click_in_progress=!0;for(var t=this;t&&!t._post_click_activation_steps;)t=t.parentNode;t&&t._pre_click_activation_steps&&t._pre_click_activation_steps();var n=this.ownerDocument.createEvent("MouseEvent");n.initMouseEvent("click",!0,!0,this.ownerDocument.defaultView,1,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,null);var r=this._dispatchEvent(n,!0);t&&(r?t._post_click_activation_steps&&t._post_click_activation_steps(n):t._cancelled_activation_steps&&t._cancelled_activation_steps())}},"_doClick"),_setEventHandler:o(function(t,n){this._handlers||(this._handlers=Object.create(null)),this._handlers[t]=n},"_setEventHandler"),_getEventHandler:o(function(t){return this._handlers&&this._handlers[t]||null},"_getEventHandler")}});var rj=oe((XKt,fde)=>{"use strict";var cd=ii(),kl=fde.exports={valid:o(function(e){return cd.assert(e,"list falsy"),cd.assert(e._previousSibling,"previous falsy"),cd.assert(e._nextSibling,"next falsy"),!0},"valid"),insertBefore:o(function(e,t){cd.assert(kl.valid(e)&&kl.valid(t));var n=e,r=e._previousSibling,s=t,i=t._previousSibling;n._previousSibling=i,r._nextSibling=s,i._nextSibling=n,s._previousSibling=r,cd.assert(kl.valid(e)&&kl.valid(t))},"insertBefore"),replace:o(function(e,t){cd.assert(kl.valid(e)&&(t===null||kl.valid(t))),t!==null&&kl.insertBefore(t,e),kl.remove(e),cd.assert(kl.valid(e)&&(t===null||kl.valid(t)))},"replace"),remove:o(function(e){cd.assert(kl.valid(e));var t=e._previousSibling;if(t!==e){var n=e._nextSibling;t._nextSibling=n,n._previousSibling=t,e._previousSibling=e._nextSibling=e,cd.assert(kl.valid(e))}},"remove")}});var sj=oe((YKt,wde)=>{"use strict";wde.exports={serializeOne:Met,\u0275escapeMatchingClosingTag:vde,\u0275escapeClosingCommentTag:xde,\u0275escapeProcessingInstructionContent:bde};var yde=ii(),kh=yde.NAMESPACE,hde={STYLE:!0,SCRIPT:!0,XMP:!0,IFRAME:!0,NOEMBED:!0,NOFRAMES:!0,PLAINTEXT:!0},Ret={area:!0,base:!0,basefont:!0,bgsound:!0,br:!0,col:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},$et={},mde=/[&<>\u00A0]/g,gde=/[&"<>\u00A0]/g;function Net(e){return mde.test(e)?e.replace(mde,t=>{switch(t){case"&":return"&";case"<":return"<";case">":return">";case"\xA0":return" "}}):e}o(Net,"escape");function Oet(e){return gde.test(e)?e.replace(gde,t=>{switch(t){case"<":return"<";case">":return">";case"&":return"&";case'"':return""";case"\xA0":return" "}}):e}o(Oet,"escapeAttr");function Pet(e){var t=e.namespaceURI;return t?t===kh.XML?"xml:"+e.localName:t===kh.XLINK?"xlink:"+e.localName:t===kh.XMLNS?e.localName==="xmlns"?"xmlns":"xmlns:"+e.localName:e.name:e.localName}o(Pet,"attrname");function vde(e,t){let n="</"+t;if(!e.toLowerCase().includes(n))return e;let r=[...e],s=e.matchAll(new RegExp(n,"ig"));for(let i of s)r[i.index]="<";return r.join("")}o(vde,"escapeMatchingClosingTag");var Det=/--!?>/;function xde(e){return Det.test(e)?e.replace(/(--\!?)>/g,"$1>"):e}o(xde,"escapeClosingCommentTag");function bde(e){return e.includes(">")?e.replaceAll(">",">"):e}o(bde,"escapeProcessingInstructionContent");function Met(e,t){var n="";switch(e.nodeType){case 1:var r=e.namespaceURI,s=r===kh.HTML,i=s||r===kh.SVG||r===kh.MATHML?e.localName:e.tagName;n+="<"+i;for(var a=0,l=e._numattrs;a<l;a++){var c=e._attr(a);n+=" "+Pet(c),c.value!==void 0&&(n+='="'+Oet(c.value)+'"')}if(n+=">",!(s&&Ret[i])){var u=e.serialize();hde[i.toUpperCase()]&&(u=vde(u,i)),s&&$et[i]&&u.charAt(0)===`
|
|
156
156
|
`&&(n+=`
|
|
@@ -4857,7 +4857,7 @@ The web search request used endpoint ${JSON.stringify(e)}. Search endpoint confi
|
|
|
4857
4857
|
button, .button { display: inline-block; box-sizing: border-box; margin-top: 1rem; padding: .75rem 1rem; border: 0; border-radius: .6rem; background: #5a87ff; color: #071022; font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; }
|
|
4858
4858
|
.secondary { background: #29314b; color: #edf2ff; }
|
|
4859
4859
|
.error { padding: .75rem; border-radius: .5rem; background: #461d2b; color: #ffd6df; }
|
|
4860
|
-
`}o(kxe,"pageStyles");mE();Qn();var hB=Object.freeze({id:"direct",capabilities:Object.freeze(["bash"]),plan:"free",shell:"just-bash-direct",probe:o(e=>e.LOADER===void 0?"available":"needs-binding","probe")}),Xx=Object.freeze({id:"dynamic-worker",capabilities:Object.freeze(["bash","coding"]),plan:"paid",shell:"just-bash-isolated",probe:o(e=>e.LOADER===void 0?"needs-binding":"available","probe")}),yvt=Object.freeze([Xx,hB]);function mB(e,t=yvt){return t.filter(n=>n.probe(e)==="available")}o(mB,"availableEdgeRuntimeProviders");function gB(e,t={}){let n=o((s,i)=>e.find(a=>a.id===i&&a.capabilities.includes(s)),"serves"),r=n("bash",t.bash)??e.find(s=>s.capabilities.includes("bash"));if(r===void 0)throw new Error("No available runtime provider serves the bash layer.");return{bash:r.id,coding:n("coding",t.coding)?.id??null,subprocess:n("subprocess",t.subprocess)?.id??null}}o(gB,"resolveEdgeRuntimeSelection");function Exe(e){let t=mB(e),{bash:n}=gB(t);return t.find(r=>r.id===n).shell}o(Exe,"resolveEdgeRuntimeShell");function vvt(){return"dsh-edge@0.17.0-alpha.1/isolated"}o(vvt,"resolveEdgeDeploymentId");function Qx(e){return{baseURL:HL(e.DEEPSEEK_BASE_URL),maxTokens:ZL(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:bh(e.DEEPSEEK_MODEL),reasoningEffort:VL(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:y4(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:GL(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:Gx(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}o(Qx,"resolveEdgeDeploymentConfig");function xvt(e){return typeof e.DEEPSEEK_API_KEY=="string"&&e.DEEPSEEK_API_KEY.trim().length>0}o(xvt,"edgeDeploymentApiKeyConfigured");function bvt(e){let t=HL(e),n=new URL(t);return n.search.length===0&&n.hash.length===0?t:(n.search="",n.hash="",n.href)}o(bvt,"projectedEdgeBaseURL");function yB(e,t){return{shell:Exe(e),storage:"durable-object-sqlite-vfs",attachmentStorage:t??(e.DSH_EDGE_ATTACHMENTS===void 0?"temporary-do":"private-r2"),deploymentId:vvt(),apiKeyConfigured:xvt(e),baseURL:bvt(e.DEEPSEEK_BASE_URL),maxTokens:ZL(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:bh(e.DEEPSEEK_MODEL),reasoningEffort:VL(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:y4(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:GL(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:Gx(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}o(yB,"resolveEdgeDeploymentProfile");function aT(e){Qx(e);let t=yB(e);return{ok:!0,service:"dsh-edge",storage:t.storage,attachmentStorage:t.attachmentStorage,shell:t.shell,agent:"upstream-react-loop-agent",access:"single-owner-cookie",deploymentId:t.deploymentId,...e.CF_VERSION_METADATA===void 0?{}:{workerVersionId:e.CF_VERSION_METADATA.id},version:e1,upstreamVersion:Tae,status:"ready"}}o(aT,"resolveEdgeDeploymentHealth");import{AsyncLocalStorage as q_t}from"node:async_hooks";var wvt={session:"sessions",skill:"skills",agentPreset:"agentPresets",subagent:"subagents",goal:"goals",event:"events",download:"downloads"};function Txe(e,t){let n=t.indexOf("."),r=t.indexOf("/"),s=n>=0?n:r;if(s<0)return;let i=t.slice(0,s),a=t.slice(s+1),l=wvt[i]??i,c=e[l];if(c===void 0)return;let u=c[a];return typeof u=="function"?u:void 0}o(Txe,"resolve");function Svt(e,t){return Response.json({type:"server-response",rpcId:e,result:{ok:!1,error:t}})}o(Svt,"errorResponse");async function vB(e,t,n,r,s){let i=Txe(e,t);if(i!==void 0)return await i({rpcId:n,payload:r},s)}o(vB,"callEdgeApi");async function Axe(e,t){let r=new URL(t.url).pathname;if(t.method!=="POST"||!r.startsWith("/api/"))return new Response("not found",{status:404});if(r==="/api/respond")return Response.json({accepted:!1,reason:"not-pending"});let s=r.slice(5);if(Txe(e,s)===void 0)return new Response("not found",{status:404});let i;try{i=await t.json()}catch{return new Response("body is not JSON",{status:400})}let a=typeof i.rpcId=="string"?i.rpcId:"invalid-request",l=i.payload??{};try{let c=await vB(e,s,a,l,t.signal);return c===void 0?new Response("not found",{status:404}):Response.json({type:"server-response",rpcId:c.rpcId,result:c.result})}catch(c){return Svt(a,{code:"internal",message:String(c),details:{}})}}o(Axe,"dispatchEdgeApi");xr();Qs();tp();import{DurableObject as z_t}from"cloudflare:workers";import{WorkerEntrypoint as Gcn}from"cloudflare:workers";var fm=Mo(Ixe(),1);var xB=o((e,t,n)=>{let r=e instanceof RegExp?Cxe(e,n):e,s=t instanceof RegExp?Cxe(t,n):t,i=r!==null&&s!=null&&kvt(r,s,n);return i&&{start:i[0],end:i[1],pre:n.slice(0,i[0]),body:n.slice(i[0]+r.length,i[1]),post:n.slice(i[1]+s.length)}},"balanced"),Cxe=o((e,t)=>{let n=t.match(e);return n?n[0]:null},"maybeMatch"),kvt=o((e,t,n)=>{let r,s,i,a,l,c=n.indexOf(e),u=n.indexOf(t,c+1),d=c;if(c>=0&&u>0){if(e===t)return[c,u];for(r=[],i=n.length;d>=0&&!l;){if(d===c)r.push(d),c=n.indexOf(e,d+1);else if(r.length===1){let p=r.pop();p!==void 0&&(l=[p,u])}else s=r.pop(),s!==void 0&&s<i&&(i=s,a=u),u=n.indexOf(t,d+1);d=c<u&&c>=0?c:u}r.length&&a!==void 0&&(l=[i,a])}return l},"range");var Rxe="\0SLASH"+Math.random()+"\0",$xe="\0OPEN"+Math.random()+"\0",SB="\0CLOSE"+Math.random()+"\0",Nxe="\0COMMA"+Math.random()+"\0",Oxe="\0PERIOD"+Math.random()+"\0",Evt=new RegExp(Rxe,"g"),_vt=new RegExp($xe,"g"),Tvt=new RegExp(SB,"g"),Avt=new RegExp(Nxe,"g"),Ivt=new RegExp(Oxe,"g"),Cvt=/\\\\/g,Rvt=/\\{/g,$vt=/\\}/g,Nvt=/\\,/g,Ovt=/\\\./g,Pvt=1e5,Dvt=4e6;function bB(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}o(bB,"numeric");function Mvt(e){return e.replace(Cvt,Rxe).replace(Rvt,$xe).replace($vt,SB).replace(Nvt,Nxe).replace(Ovt,Oxe)}o(Mvt,"escapeBraces");function Lvt(e){return e.replace(Evt,"\\").replace(_vt,"{").replace(Tvt,"}").replace(Avt,",").replace(Ivt,".")}o(Lvt,"unescapeBraces");function Pxe(e){if(!e)return[""];let t=[],n=xB("{","}",e);if(!n)return e.split(",");let{pre:r,body:s,post:i}=n,a=r.split(",");a[a.length-1]+="{"+s+"}";let l=Pxe(i);return i.length&&(a[a.length-1]+=l.shift(),a.push.apply(a,l)),t.push.apply(t,a),t}o(Pxe,"parseCommaParts");function Dxe(e,t={}){if(!e)return[];let{max:n=Pvt,maxLength:r=Dvt}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),wB(Mvt(e),n,r,!0).map(Lvt)}o(Dxe,"expand");function jvt(e){return"{"+e+"}"}o(jvt,"embrace");function Fvt(e){return/^-?0\d/.test(e)}o(Fvt,"isPadded");function Uvt(e,t){return e<=t}o(Uvt,"lte");function qvt(e,t){return e>=t}o(qvt,"gte");function Yx(e,t,n,r,s,i){let a=[],l=0;for(let c=0;c<e.length;c++)for(let u=0;u<n.length;u++){if(a.length>=r)return a;let d=e[c]+t+n[u];if(!(i&&!d)){if(l+d.length>s)return a;a.push(d),l+=d.length}}return a}o(Yx,"combine");function zvt(e,t,n,r){let s=e.split(/\.\./),i=[];if(s[0]===void 0||s[1]===void 0)return i;let a=bB(s[0]),l=bB(s[1]),c=Math.max(s[0].length,s[1].length),u=s.length===3&&s[2]!==void 0?Math.max(Math.abs(bB(s[2])),1):1,d=Uvt;l<a&&(u*=-1,d=qvt);let m=s.some(Fvt),h=0;for(let g=a;d(g,l)&&i.length<n;g+=u){let y;if(t)y=String.fromCharCode(g),y==="\\"&&(y="");else if(y=String(g),m){let x=c-y.length;if(x>0){let w=new Array(x+1).join("0");g<0?y="-"+w+y.slice(1):y=w+y}}if(h+y.length>r)break;i.push(y),h+=y.length}return i}o(zvt,"expandSequence");function wB(e,t,n,r){let s=[""],i=!1,a=!0;for(;;){let l=xB("{","}",e);if(!l)return Yx(s,e,[""],t,n,i);let c=l.pre;if(/\$$/.test(c)){if(s=Yx(s,c+"{"+l.body+"}",[""],t,n,i&&!l.post.length),a=!1,!l.post.length)break;e=l.post;continue}let u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(l.body),d=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(l.body),p=u||d,m=l.body.indexOf(",")>=0;if(!p&&!m){if(l.post.match(/,(?!,).*\}/)){e=l.pre+"{"+l.body+SB+l.post,r=!0;continue}return Yx(s,c+"{"+l.body+"}"+l.post,[""],t,n,i)}a&&(i=r&&!p,a=!1);let h;if(p)h=zvt(l.body,d,t,n);else{let g=Pxe(l.body);if(g.length===1&&g[0]!==void 0&&(g=wB(g[0],t,n,!1).map(jvt),g.length===1)){if(s=Yx(s,c+g[0],[""],t,n,i&&!l.post.length),!l.post.length)break;e=l.post;continue}let y=i&&!l.post.length&&!c;for(let w=0;y&&w<s.length;w++)s[w]&&(y=!1);h=[];let x=0;e:for(let w=0;w<g.length;w++){let S=wB(g[w],t,n,!1);for(let k=0;k<S.length;k++){let b=S[k];if(!(y&&!b)){if(h.length>=t||x+b.length>n)break e;h.push(b),x+=b.length}}}}if(s=Yx(s,c,h,t,n,i&&!l.post.length),!l.post.length)break;e=l.post}return s}o(wB,"expand_");var eb=o(e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var Bvt={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},tb=o(e=>e.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),Wvt=o(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),Mxe=o(e=>e.join(""),"rangesToString"),Lxe=o((e,t)=>{let n=t;if(e.charAt(n)!=="[")throw new Error("not in a brace expression");let r=[],s=[],i=n+1,a=!1,l=!1,c=!1,u=!1,d=n,p="";e:for(;i<e.length;){let y=e.charAt(i);if((y==="!"||y==="^")&&i===n+1){u=!0,i++;continue}if(y==="]"&&a&&!c){d=i+1;break}if(a=!0,y==="\\"&&!c){c=!0,i++;continue}if(y==="["&&!c){for(let[x,[w,S,k]]of Object.entries(Bvt))if(e.startsWith(x,i)){if(p)return["$.",!1,e.length-n,!0];i+=x.length,k?s.push(w):r.push(w),l=l||S;continue e}}if(c=!1,p){y>p?r.push(tb(p)+"-"+tb(y)):y===p&&r.push(tb(y)),p="",i++;continue}if(e.startsWith("-]",i+1)){r.push(tb(y+"-")),i+=2;continue}if(e.startsWith("-",i+1)){p=y,i+=2;continue}r.push(tb(y)),i++}if(d<i)return["",!1,0,!1];if(!r.length&&!s.length)return["$.",!1,e.length-n,!0];if(s.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!u){let y=r[0].length===2?r[0].slice(-1):r[0];return[Wvt(y),!1,d-n,!1]}let m="["+(u?"^":"")+Mxe(r)+"]",h="["+(u?"":"^")+Mxe(s)+"]";return[r.length&&s.length?"("+m+"|"+h+")":r.length?m:h,l,d-n,!0]},"parseClass");var Gp=o((e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?e.replace(/\[([^/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1"),"unescape");var Ro,Hvt=new Set(["!","?","+","*","@"]),kB=o(e=>Hvt.has(e),"isExtglobType"),jxe=o(e=>kB(e.type),"isExtglobAST"),Vvt=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Gvt=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Zvt=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),Fxe=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Kvt="(?!(?:^|/)\\.\\.?(?:$|/))",lT="(?!\\.)",Jvt=new Set(["[","."]),Xvt=new Set(["..","."]),Qvt=new Set("().*{}+?[]^$\\!"),Yvt=o(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),EB="[^/]",Uxe=EB+"*?",qxe=EB+"+?",ext=0,Jh=class{static{o(this,"AST")}type;#e;#n;#r=!1;#t=[];#s;#i;#o;#d=!1;#l;#a;#c=!1;id=++ext;get depth(){return(this.#s?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#s?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(t,n,r={}){this.type=t,t&&(this.#n=!0),this.#s=n,this.#e=this.#s?this.#s.#e:this,this.#l=this.#e===this?r:this.#e.#l,this.#o=this.#e===this?[]:this.#e.#o,t==="!"&&!this.#e.#d&&this.#o.push(this),this.#i=this.#s?this.#s.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#a!==void 0?this.#a:this.type?this.#a=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#a=this.#t.map(t=>String(t)).join("")}#E(){if(this!==this.#e)throw new Error("should only call on root");if(this.#d)return this;this.toString(),this.#d=!0;let t;for(;t=this.#o.pop();){if(t.type!=="!")continue;let n=t,r=n.#s;for(;r;){for(let s=n.#i+1;!r.type&&s<r.#t.length;s++)for(let i of t.#t){if(typeof i=="string")throw new Error("string part in extglob AST??");i.copyIn(r.#t[s])}n=r,r=n.#s}}return this}push(...t){for(let n of t)if(n!==""){if(typeof n!="string"&&!(n instanceof Ro&&n.#s===this))throw new Error("invalid part: "+n);this.#t.push(n)}}toJSON(){let t=this.type===null?this.#t.slice().map(n=>typeof n=="string"?n:n.toJSON()):[this.type,...this.#t.map(n=>n.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#d&&this.#s?.type==="!")&&t.push({}),t}isStart(){if(this.#e===this)return!0;if(!this.#s?.isStart())return!1;if(this.#i===0)return!0;let t=this.#s;for(let n=0;n<this.#i;n++){let r=t.#t[n];if(!(r instanceof Ro&&r.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#s?.type==="!")return!0;if(!this.#s?.isEnd())return!1;if(!this.type)return this.#s?.isEnd();let t=this.#s?this.#s.#t.length:0;return this.#i===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let n=new Ro(this.type,t);for(let r of this.#t)n.copyIn(r);return n}static#m(t,n,r,s,i){let a=s.maxExtglobRecursion??2,l=!1,c=!1,u=-1,d=!1;if(n.type===null){let y=r,x="";for(;y<t.length;){let w=t.charAt(y++);if(l||w==="\\"){l=!l,x+=w;continue}if(c){y===u+1?(w==="^"||w==="!")&&(d=!0):w==="]"&&!(y===u+2&&d)&&(c=!1),x+=w;continue}else if(w==="["){c=!0,u=y,d=!1,x+=w;continue}if(!s.noext&&kB(w)&&t.charAt(y)==="("&&i<=a){n.push(x),x="";let k=new Ro(w,n);y=Ro.#m(t,k,y,s,i+1),n.push(k);continue}x+=w}return n.push(x),y}let p=r+1,m=new Ro(null,n),h=[],g="";for(;p<t.length;){let y=t.charAt(p++);if(l||y==="\\"){l=!l,g+=y;continue}if(c){p===u+1?(y==="^"||y==="!")&&(d=!0):y==="]"&&!(p===u+2&&d)&&(c=!1),g+=y;continue}else if(y==="["){c=!0,u=p,d=!1,g+=y;continue}if(!s.noext&&kB(y)&&t.charAt(p)==="("&&(i<=a||n&&n.#y(y))){let w=n&&n.#y(y)?0:1;m.push(g),g="";let S=new Ro(y,m);m.push(S),p=Ro.#m(t,S,p,s,i+w);continue}if(y==="|"){m.push(g),g="",h.push(m),m=new Ro(null,n);continue}if(y===")")return g===""&&n.#t.length===0&&(n.#c=!0),m.push(g),g="",n.push(...h,m),p;g+=y}return n.type=null,n.#n=void 0,n.#t=[t.substring(r-1)],p}#O(t){return this.#g(t,Gvt)}#g(t,n=Vvt){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null)return!1;let r=t.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#y(r.type,n)}#y(t,n=Zvt){return!!n.get(this.type)?.includes(t)}#p(t,n){let r=t.#t[0],s=new Ro(null,r,this.options);s.#t.push(""),r.push(s),this.#_(t,n)}#_(t,n){let r=t.#t[0];this.#t.splice(n,1,...r.#t);for(let s of r.#t)typeof s=="object"&&(s.#s=this);this.#a=void 0}#T(t){return!!Fxe.get(this.type)?.has(t)}#P(t){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let n=t.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#T(n.type)}#v(t){let n=Fxe.get(this.type),r=t.#t[0],s=n?.get(r.type);if(!s)return!1;this.#t=r.#t;for(let i of this.#t)typeof i=="object"&&(i.#s=this);this.type=s,this.#a=void 0,this.#c=!1}static fromGlob(t,n={}){let r=new Ro(null,void 0,n);return Ro.#m(t,r,0,n,0),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let t=this.toString(),[n,r,s,i]=this.toRegExpSource();if(!(s||this.#n||this.#l.nocase&&!this.#l.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return r;let l=(this.#l.nocase?"i":"")+(i?"u":"");return Object.assign(new RegExp(`^${n}$`,l),{_src:n,_glob:t})}get options(){return this.#l}toRegExpSource(t){let n=t??!!this.#l.dot;if(this.#e===this&&(this.#f(),this.#E()),!jxe(this)){let c=this.isStart()&&this.isEnd()&&!this.#t.some(h=>typeof h!="string"),u=this.#t.map(h=>{let[g,y,x,w]=typeof h=="string"?Ro.#A(h,this.#n,c):h.toRegExpSource(t);return this.#n=this.#n||x,this.#r=this.#r||w,g}).join(""),d="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&Xvt.has(this.#t[0]))){let g=Jvt,y=n&&g.has(u.charAt(0))||u.startsWith("\\.")&&g.has(u.charAt(2))||u.startsWith("\\.\\.")&&g.has(u.charAt(4)),x=!n&&!t&&g.has(u.charAt(0));d=y?Kvt:x?lT:""}let p="";return this.isEnd()&&this.#e.#d&&this.#s?.type==="!"&&(p="(?:$|\\/)"),[d+u+p,Gp(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",s=this.type==="!"?"(?:(?!(?:":"(?:",i=this.#x(n);if(this.isStart()&&this.isEnd()&&!i&&this.type!=="!"){let c=this.toString(),u=this;return u.#t=[c],u.type=null,u.#n=void 0,[c,Gp(this.toString()),!1,!1]}let a=!r||t||n||!lT?"":this.#x(!0);a===i&&(a=""),a&&(i=`(?:${i})(?:${a})*?`);let l="";if(this.type==="!"&&this.#c)l=(this.isStart()&&!n?lT:"")+qxe;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!t?lT:"")+Uxe+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;l=s+i+c}return[l,Gp(i),this.#n=!!this.#n,this.#r]}#f(){if(jxe(this)){let t=0,n=!1;do{n=!0;for(let r=0;r<this.#t.length;r++){let s=this.#t[r];typeof s=="object"&&(s.#f(),this.#g(s)?(n=!1,this.#_(s,r)):this.#O(s)?(n=!1,this.#p(s,r)):this.#P(s)&&(n=!1,this.#v(s)))}}while(!n&&++t<10)}else for(let t of this.#t)typeof t=="object"&&t.#f();this.#a=void 0}#x(t){return this.#t.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[r,s,i,a]=n.toRegExpSource(t);return this.#r=this.#r||a,r}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#A(t,n,r=!1){let s=!1,i="",a=!1,l=!1;for(let c=0;c<t.length;c++){let u=t.charAt(c);if(s){s=!1,i+=(Qvt.has(u)?"\\":"")+u;continue}if(u==="*"){if(l)continue;l=!0,i+=r&&/^[*]+$/.test(t)?qxe:Uxe,n=!0;continue}else l=!1;if(u==="\\"){c===t.length-1?i+="\\\\":s=!0;continue}if(u==="["){let[d,p,m,h]=Lxe(t,c);if(m){i+=d,a=a||p,c+=m-1,n=n||h;continue}}if(u==="?"){i+=EB,n=!0;continue}i+=Yvt(u)}return[i,Gp(t),!!n,a]}};Ro=Jh;var _B=o((e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Yi=o((e,t,n={})=>(eb(t),!n.nocomment&&t.charAt(0)==="#"?!1:new a0(t,n).match(e)),"minimatch"),txt=/^\*+([^+@!?*[(]*)$/,nxt=o(e=>t=>!t.startsWith(".")&&t.endsWith(e),"starDotExtTest"),rxt=o(e=>t=>t.endsWith(e),"starDotExtTestDot"),sxt=o(e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),"starDotExtTestNocase"),ixt=o(e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),"starDotExtTestNocaseDot"),axt=/^\*+\.\*+$/,oxt=o(e=>!e.startsWith(".")&&e.includes("."),"starDotStarTest"),lxt=o(e=>e!=="."&&e!==".."&&e.includes("."),"starDotStarTestDot"),cxt=/^\.\*+$/,uxt=o(e=>e!=="."&&e!==".."&&e.startsWith("."),"dotStarTest"),dxt=/^\*+$/,pxt=o(e=>e.length!==0&&!e.startsWith("."),"starTest"),fxt=o(e=>e.length!==0&&e!=="."&&e!=="..","starTestDot"),hxt=/^\?+([^+@!?*[(]*)?$/,mxt=o(([e,t=""])=>{let n=Wxe([e]);return t?(t=t.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(t)):n},"qmarksTestNocase"),gxt=o(([e,t=""])=>{let n=Hxe([e]);return t?(t=t.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(t)):n},"qmarksTestNocaseDot"),yxt=o(([e,t=""])=>{let n=Hxe([e]);return t?r=>n(r)&&r.endsWith(t):n},"qmarksTestDot"),vxt=o(([e,t=""])=>{let n=Wxe([e]);return t?r=>n(r)&&r.endsWith(t):n},"qmarksTest"),Wxe=o(([e])=>{let t=e.length;return n=>n.length===t&&!n.startsWith(".")},"qmarksTestNoExt"),Hxe=o(([e])=>{let t=e.length;return n=>n.length===t&&n!=="."&&n!==".."},"qmarksTestNoExtDot"),Vxe=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",zxe={win32:{sep:"\\"},posix:{sep:"/"}},xxt=Vxe==="win32"?zxe.win32.sep:zxe.posix.sep;Yi.sep=xxt;var qa=Symbol("globstar **");Yi.GLOBSTAR=qa;var bxt="[^/]",wxt=bxt+"*?",Sxt="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",kxt="(?:(?!(?:\\/|^)\\.).)*?",Ext=o((e,t={})=>n=>Yi(n,e,t),"filter");Yi.filter=Ext;var $l=o((e,t={})=>Object.assign({},e,t),"ext"),_xt=o(e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return Yi;let t=Yi;return Object.assign(o((r,s,i={})=>t(r,s,$l(e,i)),"m"),{Minimatch:class extends t.Minimatch{static{o(this,"Minimatch")}constructor(s,i={}){super(s,$l(e,i))}static defaults(s){return t.defaults($l(e,s)).Minimatch}},AST:class extends t.AST{static{o(this,"AST")}constructor(s,i,a={}){super(s,i,$l(e,a))}static fromGlob(s,i={}){return t.AST.fromGlob(s,$l(e,i))}},unescape:o((r,s={})=>t.unescape(r,$l(e,s)),"unescape"),escape:o((r,s={})=>t.escape(r,$l(e,s)),"escape"),filter:o((r,s={})=>t.filter(r,$l(e,s)),"filter"),defaults:o(r=>t.defaults($l(e,r)),"defaults"),makeRe:o((r,s={})=>t.makeRe(r,$l(e,s)),"makeRe"),braceExpand:o((r,s={})=>t.braceExpand(r,$l(e,s)),"braceExpand"),match:o((r,s,i={})=>t.match(r,s,$l(e,i)),"match"),sep:t.sep,GLOBSTAR:qa})},"defaults");Yi.defaults=_xt;var Gxe=o((e,t={})=>(eb(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:Dxe(e,{max:t.braceExpandMax})),"braceExpand");Yi.braceExpand=Gxe;var Txt=o((e,t={})=>new a0(e,t).makeRe(),"makeRe");Yi.makeRe=Txt;var Axt=o((e,t,n={})=>{let r=new a0(t,n);return e=e.filter(s=>r.match(s)),r.options.nonull&&!e.length&&e.push(t),e},"match");Yi.match=Axt;var Bxe=/[?*]|[+@!]\(.*?\)|\[|\]/,Ixt=o(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),a0=class{static{o(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,n={}){eb(t),n=n||{},this.options=n,this.maxGlobstarRecursion=n.maxGlobstarRecursion??200,this.pattern=t,this.platform=n.platform||Vxe,this.isWindows=this.platform==="win32";let r="allowWindowsEscape";this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n[r]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let n of t)if(typeof n!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,n=this.options;if(!n.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=(...i)=>console.error(...i)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(i=>this.slashSplit(i));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let s=this.globParts.map((i,a,l)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=i[0]===""&&i[1]===""&&(i[2]==="?"||!Bxe.test(i[2]))&&!Bxe.test(i[3]),u=/^[a-z]:/i.test(i[0]);if(c)return[...i.slice(0,4),...i.slice(4).map(d=>this.parse(d))];if(u)return[i[0],...i.slice(1).map(d=>this.parse(d))]}return i.map(c=>this.parse(c))});if(this.debug(this.pattern,s),this.set=s.filter(i=>i.indexOf(!1)===-1),this.isWindows)for(let i=0;i<this.set.length;i++){let a=this.set[i];a[0]===""&&a[1]===""&&this.globParts[i][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let r of t)for(let s=0;s<r.length;s++)r[s]==="**"&&(r[s]="*");let{optimizationLevel:n=1}=this.options;return n>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):n>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(n=>{let r=-1;for(;(r=n.indexOf("**",r+1))!==-1;){let s=r;for(;n[s+1]==="**";)s++;s!==r&&n.splice(r,s-r)}return n})}levelOneOptimize(t){return t.map(n=>(n=n.reduce((r,s)=>{let i=r[r.length-1];return s==="**"&&i==="**"?r:s===".."&&i&&i!==".."&&i!=="."&&i!=="**"?(r.pop(),r):(r.push(s),r)},[]),n.length===0?[""]:n))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let s=1;s<t.length-1;s++){let i=t[s];s===1&&i===""&&t[0]===""||(i==="."||i==="")&&(n=!0,t.splice(s,1),s--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(n=!0,t.pop())}let r=0;for(;(r=t.indexOf("..",r+1))!==-1;){let s=t[r-1];s&&s!=="."&&s!==".."&&s!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(s))&&(n=!0,t.splice(r-1,2),r-=2)}}while(n);return t.length===0?[""]:t}firstPhasePreProcess(t){let n=!1;do{n=!1;for(let r of t){let s=-1;for(;(s=r.indexOf("**",s+1))!==-1;){let a=s;for(;r[a+1]==="**";)a++;a>s&&r.splice(s+1,a-s);let l=r[s+1],c=r[s+2],u=r[s+3];if(l!==".."||!c||c==="."||c===".."||!u||u==="."||u==="..")continue;n=!0,r.splice(s,1);let d=r.slice(0);d[s]="**",t.push(d),s--}if(!this.preserveMultipleSlashes){for(let a=1;a<r.length-1;a++){let l=r[a];a===1&&l===""&&r[0]===""||(l==="."||l==="")&&(n=!0,r.splice(a,1),a--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(n=!0,r.pop())}let i=0;for(;(i=r.indexOf("..",i+1))!==-1;){let a=r[i-1];if(a&&a!=="."&&a!==".."&&a!=="**"){n=!0;let c=i===1&&r[i+1]==="**"?["."]:[];r.splice(i-1,2,...c),r.length===0&&r.push(""),i-=2}}}}while(n);return t}secondPhasePreProcess(t){for(let n=0;n<t.length-1;n++)for(let r=n+1;r<t.length;r++){let s=this.partsMatch(t[n],t[r],!this.preserveMultipleSlashes);if(s){t[n]=[],t[r]=s;break}}return t.filter(n=>n.length)}partsMatch(t,n,r=!1){let s=0,i=0,a=[],l="";for(;s<t.length&&i<n.length;)if(t[s]===n[i])a.push(l==="b"?n[i]:t[s]),s++,i++;else if(r&&t[s]==="**"&&n[i]===t[s+1])a.push(t[s]),s++;else if(r&&n[i]==="**"&&t[s]===n[i+1])a.push(n[i]),i++;else if(t[s]==="*"&&n[i]&&(this.options.dot||!n[i].startsWith("."))&&n[i]!=="**"){if(l==="b")return!1;l="a",a.push(t[s]),s++,i++}else if(n[i]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(l==="a")return!1;l="b",a.push(n[i]),s++,i++}else return!1;return t.length===n.length&&a}parseNegate(){if(this.nonegate)return;let t=this.pattern,n=!1,r=0;for(let s=0;s<t.length&&t.charAt(s)==="!";s++)n=!n,r++;r&&(this.pattern=t.slice(r)),this.negate=n}matchOne(t,n,r=!1){let s=0,i=0;if(this.isWindows){let l=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),c=!l&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),u=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),d=!u&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),p=c?3:l?0:void 0,m=d?3:u?0:void 0;if(typeof p=="number"&&typeof m=="number"){let[h,g]=[t[p],n[m]];h.toLowerCase()===g.toLowerCase()&&(n[m]=h,i=m,s=p)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(t=this.levelTwoFileOptimize(t)),n.includes(qa)?this.#e(t,n,r,s,i):this.#r(t,n,r,s,i)}#e(t,n,r,s,i){let a=n.indexOf(qa,i),l=n.lastIndexOf(qa),[c,u,d]=r?[n.slice(i,a),n.slice(a+1),[]]:[n.slice(i,a),n.slice(a+1,l),n.slice(l+1)];if(c.length){let S=t.slice(s,s+c.length);if(!this.#r(S,c,r,0,0))return!1;s+=c.length,i+=c.length}let p=0;if(d.length){if(d.length+s>t.length)return!1;let S=t.length-d.length;if(this.#r(t,d,r,S,0))p=d.length;else{if(t[t.length-1]!==""||s+d.length===t.length||(S--,!this.#r(t,d,r,S,0)))return!1;p=d.length+1}}if(!u.length){let S=!!p;for(let k=s;k<t.length-p;k++){let b=String(t[k]);if(S=!0,b==="."||b===".."||!this.options.dot&&b.startsWith("."))return!1}return r||S}let m=[[[],0]],h=m[0],g=0,y=[0];for(let S of u)S===qa?(y.push(g),h=[[],0],m.push(h)):(h[0].push(S),g++);let x=m.length-1,w=t.length-p;for(let S of m)S[1]=w-(y[x--]+S[0].length);return!!this.#n(t,m,s,0,r,0,!!p)}#n(t,n,r,s,i,a,l){let c=n[s];if(!c){for(let p=r;p<t.length;p++){l=!0;let m=t[p];if(m==="."||m===".."||!this.options.dot&&m.startsWith("."))return!1}return l}let[u,d]=c;for(;r<=d;){if(this.#r(t.slice(0,r+u.length),u,i,r,0)&&a<this.maxGlobstarRecursion){let h=this.#n(t,n,r+u.length,s+1,i,a+1,l);if(h!==!1)return h}let m=t[r];if(m==="."||m===".."||!this.options.dot&&m.startsWith("."))return!1;r++}return i||null}#r(t,n,r,s,i){let a,l,c,u;for(a=s,l=i,u=t.length,c=n.length;a<u&&l<c;a++,l++){this.debug("matchOne loop");let d=n[l],p=t[a];if(this.debug(n,d,p),d===!1||d===qa)return!1;let m;if(typeof d=="string"?(m=p===d,this.debug("string match",d,p,m)):(m=d.test(p),this.debug("pattern match",d,p,m)),!m)return!1}if(a===u&&l===c)return!0;if(a===u)return r;if(l===c)return a===u-1&&t[a]==="";throw new Error("wtf?")}braceExpand(){return Gxe(this.pattern,this.options)}parse(t){eb(t);let n=this.options;if(t==="**")return qa;if(t==="")return"";let r,s=null;(r=t.match(dxt))?s=n.dot?fxt:pxt:(r=t.match(txt))?s=(n.nocase?n.dot?ixt:sxt:n.dot?rxt:nxt)(r[1]):(r=t.match(hxt))?s=(n.nocase?n.dot?gxt:mxt:n.dot?yxt:vxt)(r):(r=t.match(axt))?s=n.dot?lxt:oxt:(r=t.match(cxt))&&(s=uxt);let i=Jh.fromGlob(t,this.options).toMMPattern();return s&&typeof i=="object"&&Reflect.defineProperty(i,"test",{value:s}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let n=this.options,r=n.noglobstar?wxt:n.dot?Sxt:kxt,s=new Set(n.nocase?["i"]:[]),i=t.map(c=>{let u=c.map(p=>{if(p instanceof RegExp)for(let m of p.flags.split(""))s.add(m);return typeof p=="string"?Ixt(p):p===qa?qa:p._src});u.forEach((p,m)=>{let h=u[m+1],g=u[m-1];p!==qa||g===qa||(g===void 0?h!==void 0&&h!==qa?u[m+1]="(?:\\/|"+r+"\\/)?"+h:u[m]=r:h===void 0?u[m-1]=g+"(?:\\/|\\/"+r+")?":h!==qa&&(u[m-1]=g+"(?:\\/|\\/"+r+"\\/)"+h,u[m+1]=qa))});let d=u.filter(p=>p!==qa);if(this.partial&&d.length>=1){let p=[];for(let m=1;m<=d.length;m++)p.push(d.slice(0,m).join("/"));return"(?:"+p.join("|")+")"}return d.join("/")}).join("|"),[a,l]=t.length>1?["(?:",")"]:["",""];i="^"+a+i+l+"$",this.partial&&(i="^(?:\\/|"+a+i.slice(1,-1)+l+")$"),this.negate&&(i="^(?!"+i+").+$");try{this.regexp=new RegExp(i,[...s].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,n=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&n)return!0;let r=this.options;this.isWindows&&(t=t.split("\\").join("/"));let s=this.slashSplit(t);this.debug(this.pattern,"split",s);let i=this.set;this.debug(this.pattern,"set",i);let a=s[s.length-1];if(!a)for(let l=s.length-2;!a&&l>=0;l--)a=s[l];for(let l of i){let c=s;if(r.matchBase&&l.length===1&&(c=[a]),this.matchOne(c,l,n))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(t){return Yi.defaults(t).Minimatch}};Yi.AST=Jh;Yi.Minimatch=a0;Yi.escape=_B;Yi.unescape=Gp;import{gunzipSync as Q3t}from"node:zlib";var nb=class{static{o(this,"Diff")}diff(t,n,r={}){let s;typeof r=="function"?(s=r,r={}):"callback"in r&&(s=r.callback);let i=this.castInput(t,r),a=this.castInput(n,r),l=this.removeEmpty(this.tokenize(i,r)),c=this.removeEmpty(this.tokenize(a,r));return this.diffWithOptionsObj(l,c,r,s)}diffWithOptionsObj(t,n,r,s){var i;let a=o(S=>{if(S=this.postProcess(S,r),s){setTimeout(function(){s(S)},0);return}else return S},"done"),l=n.length,c=t.length,u=1,d=l+c;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));let p=(i=r.timeout)!==null&&i!==void 0?i:1/0,m=Date.now()+p,h=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(h[0],n,t,0,r);if(h[0].oldPos+1>=c&&g+1>=l)return a(this.buildValues(h[0].lastComponent,n,t));let y=-1/0,x=1/0,w=o(()=>{for(let S=Math.max(y,-u);S<=Math.min(x,u);S+=2){let k,b=h[S-1],_=h[S+1];b&&(h[S-1]=void 0);let T=!1;if(_){let F=_.oldPos-S;T=_&&0<=F&&F<l}let R=b&&b.oldPos+1<c;if(!T&&!R){h[S]=void 0;continue}if(!R||T&&b.oldPos<_.oldPos?k=this.addToPath(_,!0,!1,0,r):k=this.addToPath(b,!1,!0,1,r),g=this.extractCommon(k,n,t,S,r),k.oldPos+1>=c&&g+1>=l)return a(this.buildValues(k.lastComponent,n,t))||!0;h[S]=k,k.oldPos+1>=c&&(x=Math.min(x,S-1)),g+1>=l&&(y=Math.max(y,S+1))}u++},"execEditLength");if(s)o(function S(){setTimeout(function(){if(u>d||Date.now()>m)return s(void 0);w()||S()},0)},"exec")();else for(;u<=d&&Date.now()<=m;){let S=w();if(S)return S}}addToPath(t,n,r,s,i){let a=t.lastComponent;return a&&!i.oneChangePerToken&&a.added===n&&a.removed===r?{oldPos:t.oldPos+s,lastComponent:{count:a.count+1,added:n,removed:r,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+s,lastComponent:{count:1,added:n,removed:r,previousComponent:a}}}extractCommon(t,n,r,s,i){let a=n.length,l=r.length,c=t.oldPos,u=c-s,d=0;for(;u+1<a&&c+1<l&&this.equals(r[c+1],n[u+1],i);)u++,c++,d++,i.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!i.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){let n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){let s=[],i;for(;t;)s.push(t),i=t.previousComponent,delete t.previousComponent,t=i;s.reverse();let a=s.length,l=0,c=0,u=0;for(;l<a;l++){let d=s[l];if(d.removed)d.value=this.join(r.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let p=n.slice(c,c+d.count);p=p.map(function(m,h){let g=r[u+h];return g.length>m.length?g:m}),d.value=this.join(p)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return s}};var TB=class extends nb{static{o(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=Rxt}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
4860
|
+
`}o(kxe,"pageStyles");mE();Qn();var hB=Object.freeze({id:"direct",capabilities:Object.freeze(["bash"]),plan:"free",shell:"just-bash-direct",probe:o(e=>e.LOADER===void 0?"available":"needs-binding","probe")}),Xx=Object.freeze({id:"dynamic-worker",capabilities:Object.freeze(["bash","coding"]),plan:"paid",shell:"just-bash-isolated",probe:o(e=>e.LOADER===void 0?"needs-binding":"available","probe")}),yvt=Object.freeze([Xx,hB]);function mB(e,t=yvt){return t.filter(n=>n.probe(e)==="available")}o(mB,"availableEdgeRuntimeProviders");function gB(e,t={}){let n=o((s,i)=>e.find(a=>a.id===i&&a.capabilities.includes(s)),"serves"),r=n("bash",t.bash)??e.find(s=>s.capabilities.includes("bash"));if(r===void 0)throw new Error("No available runtime provider serves the bash layer.");return{bash:r.id,coding:n("coding",t.coding)?.id??null,subprocess:n("subprocess",t.subprocess)?.id??null}}o(gB,"resolveEdgeRuntimeSelection");function Exe(e){let t=mB(e),{bash:n}=gB(t);return t.find(r=>r.id===n).shell}o(Exe,"resolveEdgeRuntimeShell");function vvt(){return"dsh-edge@0.17.0/isolated"}o(vvt,"resolveEdgeDeploymentId");function Qx(e){return{baseURL:HL(e.DEEPSEEK_BASE_URL),maxTokens:ZL(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:bh(e.DEEPSEEK_MODEL),reasoningEffort:VL(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:y4(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:GL(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:Gx(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}o(Qx,"resolveEdgeDeploymentConfig");function xvt(e){return typeof e.DEEPSEEK_API_KEY=="string"&&e.DEEPSEEK_API_KEY.trim().length>0}o(xvt,"edgeDeploymentApiKeyConfigured");function bvt(e){let t=HL(e),n=new URL(t);return n.search.length===0&&n.hash.length===0?t:(n.search="",n.hash="",n.href)}o(bvt,"projectedEdgeBaseURL");function yB(e,t){return{shell:Exe(e),storage:"durable-object-sqlite-vfs",attachmentStorage:t??(e.DSH_EDGE_ATTACHMENTS===void 0?"temporary-do":"private-r2"),deploymentId:vvt(),apiKeyConfigured:xvt(e),baseURL:bvt(e.DEEPSEEK_BASE_URL),maxTokens:ZL(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:bh(e.DEEPSEEK_MODEL),reasoningEffort:VL(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:y4(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:GL(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:Gx(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}o(yB,"resolveEdgeDeploymentProfile");function aT(e){Qx(e);let t=yB(e);return{ok:!0,service:"dsh-edge",storage:t.storage,attachmentStorage:t.attachmentStorage,shell:t.shell,agent:"upstream-react-loop-agent",access:"single-owner-cookie",deploymentId:t.deploymentId,...e.CF_VERSION_METADATA===void 0?{}:{workerVersionId:e.CF_VERSION_METADATA.id},version:e1,upstreamVersion:Tae,status:"ready"}}o(aT,"resolveEdgeDeploymentHealth");import{AsyncLocalStorage as q_t}from"node:async_hooks";var wvt={session:"sessions",skill:"skills",agentPreset:"agentPresets",subagent:"subagents",goal:"goals",event:"events",download:"downloads"};function Txe(e,t){let n=t.indexOf("."),r=t.indexOf("/"),s=n>=0?n:r;if(s<0)return;let i=t.slice(0,s),a=t.slice(s+1),l=wvt[i]??i,c=e[l];if(c===void 0)return;let u=c[a];return typeof u=="function"?u:void 0}o(Txe,"resolve");function Svt(e,t){return Response.json({type:"server-response",rpcId:e,result:{ok:!1,error:t}})}o(Svt,"errorResponse");async function vB(e,t,n,r,s){let i=Txe(e,t);if(i!==void 0)return await i({rpcId:n,payload:r},s)}o(vB,"callEdgeApi");async function Axe(e,t){let r=new URL(t.url).pathname;if(t.method!=="POST"||!r.startsWith("/api/"))return new Response("not found",{status:404});if(r==="/api/respond")return Response.json({accepted:!1,reason:"not-pending"});let s=r.slice(5);if(Txe(e,s)===void 0)return new Response("not found",{status:404});let i;try{i=await t.json()}catch{return new Response("body is not JSON",{status:400})}let a=typeof i.rpcId=="string"?i.rpcId:"invalid-request",l=i.payload??{};try{let c=await vB(e,s,a,l,t.signal);return c===void 0?new Response("not found",{status:404}):Response.json({type:"server-response",rpcId:c.rpcId,result:c.result})}catch(c){return Svt(a,{code:"internal",message:String(c),details:{}})}}o(Axe,"dispatchEdgeApi");xr();Qs();tp();import{DurableObject as z_t}from"cloudflare:workers";import{WorkerEntrypoint as Gcn}from"cloudflare:workers";var fm=Mo(Ixe(),1);var xB=o((e,t,n)=>{let r=e instanceof RegExp?Cxe(e,n):e,s=t instanceof RegExp?Cxe(t,n):t,i=r!==null&&s!=null&&kvt(r,s,n);return i&&{start:i[0],end:i[1],pre:n.slice(0,i[0]),body:n.slice(i[0]+r.length,i[1]),post:n.slice(i[1]+s.length)}},"balanced"),Cxe=o((e,t)=>{let n=t.match(e);return n?n[0]:null},"maybeMatch"),kvt=o((e,t,n)=>{let r,s,i,a,l,c=n.indexOf(e),u=n.indexOf(t,c+1),d=c;if(c>=0&&u>0){if(e===t)return[c,u];for(r=[],i=n.length;d>=0&&!l;){if(d===c)r.push(d),c=n.indexOf(e,d+1);else if(r.length===1){let p=r.pop();p!==void 0&&(l=[p,u])}else s=r.pop(),s!==void 0&&s<i&&(i=s,a=u),u=n.indexOf(t,d+1);d=c<u&&c>=0?c:u}r.length&&a!==void 0&&(l=[i,a])}return l},"range");var Rxe="\0SLASH"+Math.random()+"\0",$xe="\0OPEN"+Math.random()+"\0",SB="\0CLOSE"+Math.random()+"\0",Nxe="\0COMMA"+Math.random()+"\0",Oxe="\0PERIOD"+Math.random()+"\0",Evt=new RegExp(Rxe,"g"),_vt=new RegExp($xe,"g"),Tvt=new RegExp(SB,"g"),Avt=new RegExp(Nxe,"g"),Ivt=new RegExp(Oxe,"g"),Cvt=/\\\\/g,Rvt=/\\{/g,$vt=/\\}/g,Nvt=/\\,/g,Ovt=/\\\./g,Pvt=1e5,Dvt=4e6;function bB(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}o(bB,"numeric");function Mvt(e){return e.replace(Cvt,Rxe).replace(Rvt,$xe).replace($vt,SB).replace(Nvt,Nxe).replace(Ovt,Oxe)}o(Mvt,"escapeBraces");function Lvt(e){return e.replace(Evt,"\\").replace(_vt,"{").replace(Tvt,"}").replace(Avt,",").replace(Ivt,".")}o(Lvt,"unescapeBraces");function Pxe(e){if(!e)return[""];let t=[],n=xB("{","}",e);if(!n)return e.split(",");let{pre:r,body:s,post:i}=n,a=r.split(",");a[a.length-1]+="{"+s+"}";let l=Pxe(i);return i.length&&(a[a.length-1]+=l.shift(),a.push.apply(a,l)),t.push.apply(t,a),t}o(Pxe,"parseCommaParts");function Dxe(e,t={}){if(!e)return[];let{max:n=Pvt,maxLength:r=Dvt}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),wB(Mvt(e),n,r,!0).map(Lvt)}o(Dxe,"expand");function jvt(e){return"{"+e+"}"}o(jvt,"embrace");function Fvt(e){return/^-?0\d/.test(e)}o(Fvt,"isPadded");function Uvt(e,t){return e<=t}o(Uvt,"lte");function qvt(e,t){return e>=t}o(qvt,"gte");function Yx(e,t,n,r,s,i){let a=[],l=0;for(let c=0;c<e.length;c++)for(let u=0;u<n.length;u++){if(a.length>=r)return a;let d=e[c]+t+n[u];if(!(i&&!d)){if(l+d.length>s)return a;a.push(d),l+=d.length}}return a}o(Yx,"combine");function zvt(e,t,n,r){let s=e.split(/\.\./),i=[];if(s[0]===void 0||s[1]===void 0)return i;let a=bB(s[0]),l=bB(s[1]),c=Math.max(s[0].length,s[1].length),u=s.length===3&&s[2]!==void 0?Math.max(Math.abs(bB(s[2])),1):1,d=Uvt;l<a&&(u*=-1,d=qvt);let m=s.some(Fvt),h=0;for(let g=a;d(g,l)&&i.length<n;g+=u){let y;if(t)y=String.fromCharCode(g),y==="\\"&&(y="");else if(y=String(g),m){let x=c-y.length;if(x>0){let w=new Array(x+1).join("0");g<0?y="-"+w+y.slice(1):y=w+y}}if(h+y.length>r)break;i.push(y),h+=y.length}return i}o(zvt,"expandSequence");function wB(e,t,n,r){let s=[""],i=!1,a=!0;for(;;){let l=xB("{","}",e);if(!l)return Yx(s,e,[""],t,n,i);let c=l.pre;if(/\$$/.test(c)){if(s=Yx(s,c+"{"+l.body+"}",[""],t,n,i&&!l.post.length),a=!1,!l.post.length)break;e=l.post;continue}let u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(l.body),d=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(l.body),p=u||d,m=l.body.indexOf(",")>=0;if(!p&&!m){if(l.post.match(/,(?!,).*\}/)){e=l.pre+"{"+l.body+SB+l.post,r=!0;continue}return Yx(s,c+"{"+l.body+"}"+l.post,[""],t,n,i)}a&&(i=r&&!p,a=!1);let h;if(p)h=zvt(l.body,d,t,n);else{let g=Pxe(l.body);if(g.length===1&&g[0]!==void 0&&(g=wB(g[0],t,n,!1).map(jvt),g.length===1)){if(s=Yx(s,c+g[0],[""],t,n,i&&!l.post.length),!l.post.length)break;e=l.post;continue}let y=i&&!l.post.length&&!c;for(let w=0;y&&w<s.length;w++)s[w]&&(y=!1);h=[];let x=0;e:for(let w=0;w<g.length;w++){let S=wB(g[w],t,n,!1);for(let k=0;k<S.length;k++){let b=S[k];if(!(y&&!b)){if(h.length>=t||x+b.length>n)break e;h.push(b),x+=b.length}}}}if(s=Yx(s,c,h,t,n,i&&!l.post.length),!l.post.length)break;e=l.post}return s}o(wB,"expand_");var eb=o(e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var Bvt={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},tb=o(e=>e.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),Wvt=o(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),Mxe=o(e=>e.join(""),"rangesToString"),Lxe=o((e,t)=>{let n=t;if(e.charAt(n)!=="[")throw new Error("not in a brace expression");let r=[],s=[],i=n+1,a=!1,l=!1,c=!1,u=!1,d=n,p="";e:for(;i<e.length;){let y=e.charAt(i);if((y==="!"||y==="^")&&i===n+1){u=!0,i++;continue}if(y==="]"&&a&&!c){d=i+1;break}if(a=!0,y==="\\"&&!c){c=!0,i++;continue}if(y==="["&&!c){for(let[x,[w,S,k]]of Object.entries(Bvt))if(e.startsWith(x,i)){if(p)return["$.",!1,e.length-n,!0];i+=x.length,k?s.push(w):r.push(w),l=l||S;continue e}}if(c=!1,p){y>p?r.push(tb(p)+"-"+tb(y)):y===p&&r.push(tb(y)),p="",i++;continue}if(e.startsWith("-]",i+1)){r.push(tb(y+"-")),i+=2;continue}if(e.startsWith("-",i+1)){p=y,i+=2;continue}r.push(tb(y)),i++}if(d<i)return["",!1,0,!1];if(!r.length&&!s.length)return["$.",!1,e.length-n,!0];if(s.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!u){let y=r[0].length===2?r[0].slice(-1):r[0];return[Wvt(y),!1,d-n,!1]}let m="["+(u?"^":"")+Mxe(r)+"]",h="["+(u?"":"^")+Mxe(s)+"]";return[r.length&&s.length?"("+m+"|"+h+")":r.length?m:h,l,d-n,!0]},"parseClass");var Gp=o((e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?e.replace(/\[([^/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1"),"unescape");var Ro,Hvt=new Set(["!","?","+","*","@"]),kB=o(e=>Hvt.has(e),"isExtglobType"),jxe=o(e=>kB(e.type),"isExtglobAST"),Vvt=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Gvt=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Zvt=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),Fxe=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Kvt="(?!(?:^|/)\\.\\.?(?:$|/))",lT="(?!\\.)",Jvt=new Set(["[","."]),Xvt=new Set(["..","."]),Qvt=new Set("().*{}+?[]^$\\!"),Yvt=o(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),EB="[^/]",Uxe=EB+"*?",qxe=EB+"+?",ext=0,Jh=class{static{o(this,"AST")}type;#e;#n;#r=!1;#t=[];#s;#i;#o;#d=!1;#l;#a;#c=!1;id=++ext;get depth(){return(this.#s?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#s?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(t,n,r={}){this.type=t,t&&(this.#n=!0),this.#s=n,this.#e=this.#s?this.#s.#e:this,this.#l=this.#e===this?r:this.#e.#l,this.#o=this.#e===this?[]:this.#e.#o,t==="!"&&!this.#e.#d&&this.#o.push(this),this.#i=this.#s?this.#s.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#a!==void 0?this.#a:this.type?this.#a=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#a=this.#t.map(t=>String(t)).join("")}#E(){if(this!==this.#e)throw new Error("should only call on root");if(this.#d)return this;this.toString(),this.#d=!0;let t;for(;t=this.#o.pop();){if(t.type!=="!")continue;let n=t,r=n.#s;for(;r;){for(let s=n.#i+1;!r.type&&s<r.#t.length;s++)for(let i of t.#t){if(typeof i=="string")throw new Error("string part in extglob AST??");i.copyIn(r.#t[s])}n=r,r=n.#s}}return this}push(...t){for(let n of t)if(n!==""){if(typeof n!="string"&&!(n instanceof Ro&&n.#s===this))throw new Error("invalid part: "+n);this.#t.push(n)}}toJSON(){let t=this.type===null?this.#t.slice().map(n=>typeof n=="string"?n:n.toJSON()):[this.type,...this.#t.map(n=>n.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#d&&this.#s?.type==="!")&&t.push({}),t}isStart(){if(this.#e===this)return!0;if(!this.#s?.isStart())return!1;if(this.#i===0)return!0;let t=this.#s;for(let n=0;n<this.#i;n++){let r=t.#t[n];if(!(r instanceof Ro&&r.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#s?.type==="!")return!0;if(!this.#s?.isEnd())return!1;if(!this.type)return this.#s?.isEnd();let t=this.#s?this.#s.#t.length:0;return this.#i===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let n=new Ro(this.type,t);for(let r of this.#t)n.copyIn(r);return n}static#m(t,n,r,s,i){let a=s.maxExtglobRecursion??2,l=!1,c=!1,u=-1,d=!1;if(n.type===null){let y=r,x="";for(;y<t.length;){let w=t.charAt(y++);if(l||w==="\\"){l=!l,x+=w;continue}if(c){y===u+1?(w==="^"||w==="!")&&(d=!0):w==="]"&&!(y===u+2&&d)&&(c=!1),x+=w;continue}else if(w==="["){c=!0,u=y,d=!1,x+=w;continue}if(!s.noext&&kB(w)&&t.charAt(y)==="("&&i<=a){n.push(x),x="";let k=new Ro(w,n);y=Ro.#m(t,k,y,s,i+1),n.push(k);continue}x+=w}return n.push(x),y}let p=r+1,m=new Ro(null,n),h=[],g="";for(;p<t.length;){let y=t.charAt(p++);if(l||y==="\\"){l=!l,g+=y;continue}if(c){p===u+1?(y==="^"||y==="!")&&(d=!0):y==="]"&&!(p===u+2&&d)&&(c=!1),g+=y;continue}else if(y==="["){c=!0,u=p,d=!1,g+=y;continue}if(!s.noext&&kB(y)&&t.charAt(p)==="("&&(i<=a||n&&n.#y(y))){let w=n&&n.#y(y)?0:1;m.push(g),g="";let S=new Ro(y,m);m.push(S),p=Ro.#m(t,S,p,s,i+w);continue}if(y==="|"){m.push(g),g="",h.push(m),m=new Ro(null,n);continue}if(y===")")return g===""&&n.#t.length===0&&(n.#c=!0),m.push(g),g="",n.push(...h,m),p;g+=y}return n.type=null,n.#n=void 0,n.#t=[t.substring(r-1)],p}#O(t){return this.#g(t,Gvt)}#g(t,n=Vvt){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null)return!1;let r=t.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#y(r.type,n)}#y(t,n=Zvt){return!!n.get(this.type)?.includes(t)}#p(t,n){let r=t.#t[0],s=new Ro(null,r,this.options);s.#t.push(""),r.push(s),this.#_(t,n)}#_(t,n){let r=t.#t[0];this.#t.splice(n,1,...r.#t);for(let s of r.#t)typeof s=="object"&&(s.#s=this);this.#a=void 0}#T(t){return!!Fxe.get(this.type)?.has(t)}#P(t){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let n=t.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#T(n.type)}#v(t){let n=Fxe.get(this.type),r=t.#t[0],s=n?.get(r.type);if(!s)return!1;this.#t=r.#t;for(let i of this.#t)typeof i=="object"&&(i.#s=this);this.type=s,this.#a=void 0,this.#c=!1}static fromGlob(t,n={}){let r=new Ro(null,void 0,n);return Ro.#m(t,r,0,n,0),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let t=this.toString(),[n,r,s,i]=this.toRegExpSource();if(!(s||this.#n||this.#l.nocase&&!this.#l.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return r;let l=(this.#l.nocase?"i":"")+(i?"u":"");return Object.assign(new RegExp(`^${n}$`,l),{_src:n,_glob:t})}get options(){return this.#l}toRegExpSource(t){let n=t??!!this.#l.dot;if(this.#e===this&&(this.#f(),this.#E()),!jxe(this)){let c=this.isStart()&&this.isEnd()&&!this.#t.some(h=>typeof h!="string"),u=this.#t.map(h=>{let[g,y,x,w]=typeof h=="string"?Ro.#A(h,this.#n,c):h.toRegExpSource(t);return this.#n=this.#n||x,this.#r=this.#r||w,g}).join(""),d="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&Xvt.has(this.#t[0]))){let g=Jvt,y=n&&g.has(u.charAt(0))||u.startsWith("\\.")&&g.has(u.charAt(2))||u.startsWith("\\.\\.")&&g.has(u.charAt(4)),x=!n&&!t&&g.has(u.charAt(0));d=y?Kvt:x?lT:""}let p="";return this.isEnd()&&this.#e.#d&&this.#s?.type==="!"&&(p="(?:$|\\/)"),[d+u+p,Gp(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",s=this.type==="!"?"(?:(?!(?:":"(?:",i=this.#x(n);if(this.isStart()&&this.isEnd()&&!i&&this.type!=="!"){let c=this.toString(),u=this;return u.#t=[c],u.type=null,u.#n=void 0,[c,Gp(this.toString()),!1,!1]}let a=!r||t||n||!lT?"":this.#x(!0);a===i&&(a=""),a&&(i=`(?:${i})(?:${a})*?`);let l="";if(this.type==="!"&&this.#c)l=(this.isStart()&&!n?lT:"")+qxe;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!t?lT:"")+Uxe+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;l=s+i+c}return[l,Gp(i),this.#n=!!this.#n,this.#r]}#f(){if(jxe(this)){let t=0,n=!1;do{n=!0;for(let r=0;r<this.#t.length;r++){let s=this.#t[r];typeof s=="object"&&(s.#f(),this.#g(s)?(n=!1,this.#_(s,r)):this.#O(s)?(n=!1,this.#p(s,r)):this.#P(s)&&(n=!1,this.#v(s)))}}while(!n&&++t<10)}else for(let t of this.#t)typeof t=="object"&&t.#f();this.#a=void 0}#x(t){return this.#t.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[r,s,i,a]=n.toRegExpSource(t);return this.#r=this.#r||a,r}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#A(t,n,r=!1){let s=!1,i="",a=!1,l=!1;for(let c=0;c<t.length;c++){let u=t.charAt(c);if(s){s=!1,i+=(Qvt.has(u)?"\\":"")+u;continue}if(u==="*"){if(l)continue;l=!0,i+=r&&/^[*]+$/.test(t)?qxe:Uxe,n=!0;continue}else l=!1;if(u==="\\"){c===t.length-1?i+="\\\\":s=!0;continue}if(u==="["){let[d,p,m,h]=Lxe(t,c);if(m){i+=d,a=a||p,c+=m-1,n=n||h;continue}}if(u==="?"){i+=EB,n=!0;continue}i+=Yvt(u)}return[i,Gp(t),!!n,a]}};Ro=Jh;var _B=o((e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Yi=o((e,t,n={})=>(eb(t),!n.nocomment&&t.charAt(0)==="#"?!1:new a0(t,n).match(e)),"minimatch"),txt=/^\*+([^+@!?*[(]*)$/,nxt=o(e=>t=>!t.startsWith(".")&&t.endsWith(e),"starDotExtTest"),rxt=o(e=>t=>t.endsWith(e),"starDotExtTestDot"),sxt=o(e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),"starDotExtTestNocase"),ixt=o(e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),"starDotExtTestNocaseDot"),axt=/^\*+\.\*+$/,oxt=o(e=>!e.startsWith(".")&&e.includes("."),"starDotStarTest"),lxt=o(e=>e!=="."&&e!==".."&&e.includes("."),"starDotStarTestDot"),cxt=/^\.\*+$/,uxt=o(e=>e!=="."&&e!==".."&&e.startsWith("."),"dotStarTest"),dxt=/^\*+$/,pxt=o(e=>e.length!==0&&!e.startsWith("."),"starTest"),fxt=o(e=>e.length!==0&&e!=="."&&e!=="..","starTestDot"),hxt=/^\?+([^+@!?*[(]*)?$/,mxt=o(([e,t=""])=>{let n=Wxe([e]);return t?(t=t.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(t)):n},"qmarksTestNocase"),gxt=o(([e,t=""])=>{let n=Hxe([e]);return t?(t=t.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(t)):n},"qmarksTestNocaseDot"),yxt=o(([e,t=""])=>{let n=Hxe([e]);return t?r=>n(r)&&r.endsWith(t):n},"qmarksTestDot"),vxt=o(([e,t=""])=>{let n=Wxe([e]);return t?r=>n(r)&&r.endsWith(t):n},"qmarksTest"),Wxe=o(([e])=>{let t=e.length;return n=>n.length===t&&!n.startsWith(".")},"qmarksTestNoExt"),Hxe=o(([e])=>{let t=e.length;return n=>n.length===t&&n!=="."&&n!==".."},"qmarksTestNoExtDot"),Vxe=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",zxe={win32:{sep:"\\"},posix:{sep:"/"}},xxt=Vxe==="win32"?zxe.win32.sep:zxe.posix.sep;Yi.sep=xxt;var qa=Symbol("globstar **");Yi.GLOBSTAR=qa;var bxt="[^/]",wxt=bxt+"*?",Sxt="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",kxt="(?:(?!(?:\\/|^)\\.).)*?",Ext=o((e,t={})=>n=>Yi(n,e,t),"filter");Yi.filter=Ext;var $l=o((e,t={})=>Object.assign({},e,t),"ext"),_xt=o(e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return Yi;let t=Yi;return Object.assign(o((r,s,i={})=>t(r,s,$l(e,i)),"m"),{Minimatch:class extends t.Minimatch{static{o(this,"Minimatch")}constructor(s,i={}){super(s,$l(e,i))}static defaults(s){return t.defaults($l(e,s)).Minimatch}},AST:class extends t.AST{static{o(this,"AST")}constructor(s,i,a={}){super(s,i,$l(e,a))}static fromGlob(s,i={}){return t.AST.fromGlob(s,$l(e,i))}},unescape:o((r,s={})=>t.unescape(r,$l(e,s)),"unescape"),escape:o((r,s={})=>t.escape(r,$l(e,s)),"escape"),filter:o((r,s={})=>t.filter(r,$l(e,s)),"filter"),defaults:o(r=>t.defaults($l(e,r)),"defaults"),makeRe:o((r,s={})=>t.makeRe(r,$l(e,s)),"makeRe"),braceExpand:o((r,s={})=>t.braceExpand(r,$l(e,s)),"braceExpand"),match:o((r,s,i={})=>t.match(r,s,$l(e,i)),"match"),sep:t.sep,GLOBSTAR:qa})},"defaults");Yi.defaults=_xt;var Gxe=o((e,t={})=>(eb(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:Dxe(e,{max:t.braceExpandMax})),"braceExpand");Yi.braceExpand=Gxe;var Txt=o((e,t={})=>new a0(e,t).makeRe(),"makeRe");Yi.makeRe=Txt;var Axt=o((e,t,n={})=>{let r=new a0(t,n);return e=e.filter(s=>r.match(s)),r.options.nonull&&!e.length&&e.push(t),e},"match");Yi.match=Axt;var Bxe=/[?*]|[+@!]\(.*?\)|\[|\]/,Ixt=o(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),a0=class{static{o(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,n={}){eb(t),n=n||{},this.options=n,this.maxGlobstarRecursion=n.maxGlobstarRecursion??200,this.pattern=t,this.platform=n.platform||Vxe,this.isWindows=this.platform==="win32";let r="allowWindowsEscape";this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n[r]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let n of t)if(typeof n!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,n=this.options;if(!n.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=(...i)=>console.error(...i)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(i=>this.slashSplit(i));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let s=this.globParts.map((i,a,l)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=i[0]===""&&i[1]===""&&(i[2]==="?"||!Bxe.test(i[2]))&&!Bxe.test(i[3]),u=/^[a-z]:/i.test(i[0]);if(c)return[...i.slice(0,4),...i.slice(4).map(d=>this.parse(d))];if(u)return[i[0],...i.slice(1).map(d=>this.parse(d))]}return i.map(c=>this.parse(c))});if(this.debug(this.pattern,s),this.set=s.filter(i=>i.indexOf(!1)===-1),this.isWindows)for(let i=0;i<this.set.length;i++){let a=this.set[i];a[0]===""&&a[1]===""&&this.globParts[i][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let r of t)for(let s=0;s<r.length;s++)r[s]==="**"&&(r[s]="*");let{optimizationLevel:n=1}=this.options;return n>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):n>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(n=>{let r=-1;for(;(r=n.indexOf("**",r+1))!==-1;){let s=r;for(;n[s+1]==="**";)s++;s!==r&&n.splice(r,s-r)}return n})}levelOneOptimize(t){return t.map(n=>(n=n.reduce((r,s)=>{let i=r[r.length-1];return s==="**"&&i==="**"?r:s===".."&&i&&i!==".."&&i!=="."&&i!=="**"?(r.pop(),r):(r.push(s),r)},[]),n.length===0?[""]:n))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let s=1;s<t.length-1;s++){let i=t[s];s===1&&i===""&&t[0]===""||(i==="."||i==="")&&(n=!0,t.splice(s,1),s--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(n=!0,t.pop())}let r=0;for(;(r=t.indexOf("..",r+1))!==-1;){let s=t[r-1];s&&s!=="."&&s!==".."&&s!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(s))&&(n=!0,t.splice(r-1,2),r-=2)}}while(n);return t.length===0?[""]:t}firstPhasePreProcess(t){let n=!1;do{n=!1;for(let r of t){let s=-1;for(;(s=r.indexOf("**",s+1))!==-1;){let a=s;for(;r[a+1]==="**";)a++;a>s&&r.splice(s+1,a-s);let l=r[s+1],c=r[s+2],u=r[s+3];if(l!==".."||!c||c==="."||c===".."||!u||u==="."||u==="..")continue;n=!0,r.splice(s,1);let d=r.slice(0);d[s]="**",t.push(d),s--}if(!this.preserveMultipleSlashes){for(let a=1;a<r.length-1;a++){let l=r[a];a===1&&l===""&&r[0]===""||(l==="."||l==="")&&(n=!0,r.splice(a,1),a--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(n=!0,r.pop())}let i=0;for(;(i=r.indexOf("..",i+1))!==-1;){let a=r[i-1];if(a&&a!=="."&&a!==".."&&a!=="**"){n=!0;let c=i===1&&r[i+1]==="**"?["."]:[];r.splice(i-1,2,...c),r.length===0&&r.push(""),i-=2}}}}while(n);return t}secondPhasePreProcess(t){for(let n=0;n<t.length-1;n++)for(let r=n+1;r<t.length;r++){let s=this.partsMatch(t[n],t[r],!this.preserveMultipleSlashes);if(s){t[n]=[],t[r]=s;break}}return t.filter(n=>n.length)}partsMatch(t,n,r=!1){let s=0,i=0,a=[],l="";for(;s<t.length&&i<n.length;)if(t[s]===n[i])a.push(l==="b"?n[i]:t[s]),s++,i++;else if(r&&t[s]==="**"&&n[i]===t[s+1])a.push(t[s]),s++;else if(r&&n[i]==="**"&&t[s]===n[i+1])a.push(n[i]),i++;else if(t[s]==="*"&&n[i]&&(this.options.dot||!n[i].startsWith("."))&&n[i]!=="**"){if(l==="b")return!1;l="a",a.push(t[s]),s++,i++}else if(n[i]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(l==="a")return!1;l="b",a.push(n[i]),s++,i++}else return!1;return t.length===n.length&&a}parseNegate(){if(this.nonegate)return;let t=this.pattern,n=!1,r=0;for(let s=0;s<t.length&&t.charAt(s)==="!";s++)n=!n,r++;r&&(this.pattern=t.slice(r)),this.negate=n}matchOne(t,n,r=!1){let s=0,i=0;if(this.isWindows){let l=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),c=!l&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),u=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),d=!u&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),p=c?3:l?0:void 0,m=d?3:u?0:void 0;if(typeof p=="number"&&typeof m=="number"){let[h,g]=[t[p],n[m]];h.toLowerCase()===g.toLowerCase()&&(n[m]=h,i=m,s=p)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(t=this.levelTwoFileOptimize(t)),n.includes(qa)?this.#e(t,n,r,s,i):this.#r(t,n,r,s,i)}#e(t,n,r,s,i){let a=n.indexOf(qa,i),l=n.lastIndexOf(qa),[c,u,d]=r?[n.slice(i,a),n.slice(a+1),[]]:[n.slice(i,a),n.slice(a+1,l),n.slice(l+1)];if(c.length){let S=t.slice(s,s+c.length);if(!this.#r(S,c,r,0,0))return!1;s+=c.length,i+=c.length}let p=0;if(d.length){if(d.length+s>t.length)return!1;let S=t.length-d.length;if(this.#r(t,d,r,S,0))p=d.length;else{if(t[t.length-1]!==""||s+d.length===t.length||(S--,!this.#r(t,d,r,S,0)))return!1;p=d.length+1}}if(!u.length){let S=!!p;for(let k=s;k<t.length-p;k++){let b=String(t[k]);if(S=!0,b==="."||b===".."||!this.options.dot&&b.startsWith("."))return!1}return r||S}let m=[[[],0]],h=m[0],g=0,y=[0];for(let S of u)S===qa?(y.push(g),h=[[],0],m.push(h)):(h[0].push(S),g++);let x=m.length-1,w=t.length-p;for(let S of m)S[1]=w-(y[x--]+S[0].length);return!!this.#n(t,m,s,0,r,0,!!p)}#n(t,n,r,s,i,a,l){let c=n[s];if(!c){for(let p=r;p<t.length;p++){l=!0;let m=t[p];if(m==="."||m===".."||!this.options.dot&&m.startsWith("."))return!1}return l}let[u,d]=c;for(;r<=d;){if(this.#r(t.slice(0,r+u.length),u,i,r,0)&&a<this.maxGlobstarRecursion){let h=this.#n(t,n,r+u.length,s+1,i,a+1,l);if(h!==!1)return h}let m=t[r];if(m==="."||m===".."||!this.options.dot&&m.startsWith("."))return!1;r++}return i||null}#r(t,n,r,s,i){let a,l,c,u;for(a=s,l=i,u=t.length,c=n.length;a<u&&l<c;a++,l++){this.debug("matchOne loop");let d=n[l],p=t[a];if(this.debug(n,d,p),d===!1||d===qa)return!1;let m;if(typeof d=="string"?(m=p===d,this.debug("string match",d,p,m)):(m=d.test(p),this.debug("pattern match",d,p,m)),!m)return!1}if(a===u&&l===c)return!0;if(a===u)return r;if(l===c)return a===u-1&&t[a]==="";throw new Error("wtf?")}braceExpand(){return Gxe(this.pattern,this.options)}parse(t){eb(t);let n=this.options;if(t==="**")return qa;if(t==="")return"";let r,s=null;(r=t.match(dxt))?s=n.dot?fxt:pxt:(r=t.match(txt))?s=(n.nocase?n.dot?ixt:sxt:n.dot?rxt:nxt)(r[1]):(r=t.match(hxt))?s=(n.nocase?n.dot?gxt:mxt:n.dot?yxt:vxt)(r):(r=t.match(axt))?s=n.dot?lxt:oxt:(r=t.match(cxt))&&(s=uxt);let i=Jh.fromGlob(t,this.options).toMMPattern();return s&&typeof i=="object"&&Reflect.defineProperty(i,"test",{value:s}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let n=this.options,r=n.noglobstar?wxt:n.dot?Sxt:kxt,s=new Set(n.nocase?["i"]:[]),i=t.map(c=>{let u=c.map(p=>{if(p instanceof RegExp)for(let m of p.flags.split(""))s.add(m);return typeof p=="string"?Ixt(p):p===qa?qa:p._src});u.forEach((p,m)=>{let h=u[m+1],g=u[m-1];p!==qa||g===qa||(g===void 0?h!==void 0&&h!==qa?u[m+1]="(?:\\/|"+r+"\\/)?"+h:u[m]=r:h===void 0?u[m-1]=g+"(?:\\/|\\/"+r+")?":h!==qa&&(u[m-1]=g+"(?:\\/|\\/"+r+"\\/)"+h,u[m+1]=qa))});let d=u.filter(p=>p!==qa);if(this.partial&&d.length>=1){let p=[];for(let m=1;m<=d.length;m++)p.push(d.slice(0,m).join("/"));return"(?:"+p.join("|")+")"}return d.join("/")}).join("|"),[a,l]=t.length>1?["(?:",")"]:["",""];i="^"+a+i+l+"$",this.partial&&(i="^(?:\\/|"+a+i.slice(1,-1)+l+")$"),this.negate&&(i="^(?!"+i+").+$");try{this.regexp=new RegExp(i,[...s].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,n=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&n)return!0;let r=this.options;this.isWindows&&(t=t.split("\\").join("/"));let s=this.slashSplit(t);this.debug(this.pattern,"split",s);let i=this.set;this.debug(this.pattern,"set",i);let a=s[s.length-1];if(!a)for(let l=s.length-2;!a&&l>=0;l--)a=s[l];for(let l of i){let c=s;if(r.matchBase&&l.length===1&&(c=[a]),this.matchOne(c,l,n))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(t){return Yi.defaults(t).Minimatch}};Yi.AST=Jh;Yi.Minimatch=a0;Yi.escape=_B;Yi.unescape=Gp;import{gunzipSync as Q3t}from"node:zlib";var nb=class{static{o(this,"Diff")}diff(t,n,r={}){let s;typeof r=="function"?(s=r,r={}):"callback"in r&&(s=r.callback);let i=this.castInput(t,r),a=this.castInput(n,r),l=this.removeEmpty(this.tokenize(i,r)),c=this.removeEmpty(this.tokenize(a,r));return this.diffWithOptionsObj(l,c,r,s)}diffWithOptionsObj(t,n,r,s){var i;let a=o(S=>{if(S=this.postProcess(S,r),s){setTimeout(function(){s(S)},0);return}else return S},"done"),l=n.length,c=t.length,u=1,d=l+c;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));let p=(i=r.timeout)!==null&&i!==void 0?i:1/0,m=Date.now()+p,h=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(h[0],n,t,0,r);if(h[0].oldPos+1>=c&&g+1>=l)return a(this.buildValues(h[0].lastComponent,n,t));let y=-1/0,x=1/0,w=o(()=>{for(let S=Math.max(y,-u);S<=Math.min(x,u);S+=2){let k,b=h[S-1],_=h[S+1];b&&(h[S-1]=void 0);let T=!1;if(_){let F=_.oldPos-S;T=_&&0<=F&&F<l}let R=b&&b.oldPos+1<c;if(!T&&!R){h[S]=void 0;continue}if(!R||T&&b.oldPos<_.oldPos?k=this.addToPath(_,!0,!1,0,r):k=this.addToPath(b,!1,!0,1,r),g=this.extractCommon(k,n,t,S,r),k.oldPos+1>=c&&g+1>=l)return a(this.buildValues(k.lastComponent,n,t))||!0;h[S]=k,k.oldPos+1>=c&&(x=Math.min(x,S-1)),g+1>=l&&(y=Math.max(y,S+1))}u++},"execEditLength");if(s)o(function S(){setTimeout(function(){if(u>d||Date.now()>m)return s(void 0);w()||S()},0)},"exec")();else for(;u<=d&&Date.now()<=m;){let S=w();if(S)return S}}addToPath(t,n,r,s,i){let a=t.lastComponent;return a&&!i.oneChangePerToken&&a.added===n&&a.removed===r?{oldPos:t.oldPos+s,lastComponent:{count:a.count+1,added:n,removed:r,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+s,lastComponent:{count:1,added:n,removed:r,previousComponent:a}}}extractCommon(t,n,r,s,i){let a=n.length,l=r.length,c=t.oldPos,u=c-s,d=0;for(;u+1<a&&c+1<l&&this.equals(r[c+1],n[u+1],i);)u++,c++,d++,i.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!i.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){let n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){let s=[],i;for(;t;)s.push(t),i=t.previousComponent,delete t.previousComponent,t=i;s.reverse();let a=s.length,l=0,c=0,u=0;for(;l<a;l++){let d=s[l];if(d.removed)d.value=this.join(r.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let p=n.slice(c,c+d.count);p=p.map(function(m,h){let g=r[u+h];return g.length>m.length?g:m}),d.value=this.join(p)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return s}};var TB=class extends nb{static{o(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=Rxt}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
4861
4861
|
`))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
|
|
4862
4862
|
`))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
|
|
4863
4863
|
`)&&(t=t.slice(0,-1)),n.endsWith(`
|